From fb0c769022609c0bf1b264b0c135eee900432f70 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期四, 22 十月 2026 18:04:18 +0800
Subject: [PATCH] 1、整理APP端主题变量,统一主色、浅色背景、边框色、页面背景及卡片背景等公共样式 2、排查APP端列表分页情况,区分主列表分页与下拉选择器数据请求 3、补齐考勤记录、考勤异常、考勤汇总、员工社保档案、薪酬核算、薪资发放、班次、节假日、考勤规则、备件台账、领用记录及工序流转等页面分页
---
src/pages/profile/settings.vue | 177 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 158 insertions(+), 19 deletions(-)
diff --git a/src/pages/profile/settings.vue b/src/pages/profile/settings.vue
index 1593088..704f543 100644
--- a/src/pages/profile/settings.vue
+++ b/src/pages/profile/settings.vue
@@ -2,14 +2,30 @@
import { reactive } from "vue";
import { onShow } from "@dcloudio/uni-app";
+ import type { ThemeKey } from "../../stores/theme";
+ import { useAppTheme } from "../../stores/theme";
+
const PROFILE_SETTINGS_KEY = "mom_profile_settings";
const settings = reactive({
messageNotify: true,
compactDisplay: false,
keepLastModule: true,
});
+ const {
+ themes,
+ theme,
+ themeKey,
+ themeStyle,
+ primaryColor,
+ setTheme,
+ resetTheme,
+ restoreTheme,
+ } = useAppTheme();
- onShow(() => loadSettings());
+ onShow(() => {
+ loadSettings();
+ restoreTheme();
+ });
function loadSettings() {
try {
@@ -29,44 +45,80 @@
saveSettings();
}
+ function selectTheme(key: ThemeKey) {
+ if (key === themeKey.value) return;
+ setTheme(key);
+ uni.showToast({ title: "涓婚宸插垏鎹�", icon: "success" });
+ }
+
async function clearLocalPreference() {
const { confirm } = await uni.showModal({
title: "鎭㈠榛樿璁剧疆",
- content: "浠呮仮澶嶆湰鏈烘樉绀哄亸濂斤紝涓嶄細閫�鍑虹櫥褰曘��",
+ content: "灏嗘仮澶嶉粯璁ゆ樉绀哄亸濂藉拰鍟嗗姟钃濅富棰橈紝涓嶄細閫�鍑虹櫥褰曘��",
});
if (!confirm) return;
settings.messageNotify = true;
settings.compactDisplay = false;
settings.keepLastModule = true;
uni.removeStorageSync(PROFILE_SETTINGS_KEY);
+ resetTheme();
uni.showToast({ title: "宸叉仮澶嶉粯璁よ缃�", icon: "success" });
}
</script>
<template>
- <view class="page">
+ <view class="page" :style="themeStyle">
+ <view class="section-title">涓婚棰滆壊</view>
+ <view class="theme-card">
+ <view
+ v-for="item in themes"
+ :key="item.key"
+ class="theme-option"
+ :class="{ active: themeKey === item.key }"
+ @click="selectTheme(item.key)"
+ >
+ <view class="theme-swatch" :style="{ background: item.primary }">
+ <text v-if="themeKey === item.key">鉁�</text>
+ </view>
+ <view class="theme-copy">
+ <text>{{ item.name }}</text>
+ <text>{{ item.description }}</text>
+ </view>
+ <text class="theme-check">{{ themeKey === item.key ? "宸蹭娇鐢�" : "" }}</text>
+ </view>
+ </view>
+
+ <view class="section-title">鏄剧ず鍋忓ソ</view>
<view class="card">
<view class="setting-row">
<view><text>娑堟伅鎻愰啋</text><text>淇濈暀娑堟伅椤电孩鐐逛笌鎻愰啋鏄剧ず</text></view>
<switch :checked="settings.messageNotify"
- color="#1769d8"
+ :color="primaryColor"
@change="updateSetting('messageNotify', $event.detail.value)" />
</view>
<view class="setting-row">
<view><text>绱у噾鏄剧ず</text><text>璁板綍鍒楄〃鍋忓ソ锛屽悗缁〉闈㈠彲璇诲彇浣跨敤</text></view>
<switch :checked="settings.compactDisplay"
- color="#1769d8"
+ :color="primaryColor"
@change="updateSetting('compactDisplay', $event.detail.value)" />
</view>
<view class="setting-row">
<view><text>璁颁綇涓婃妯″潡</text><text>淇濈暀鏈�杩戜娇鐢ㄦā鍧楃殑鏈湴鍋忓ソ</text></view>
<switch :checked="settings.keepLastModule"
- color="#1769d8"
+ :color="primaryColor"
@change="updateSetting('keepLastModule', $event.detail.value)" />
</view>
</view>
- <button class="plain-button"
- @click="clearLocalPreference">鎭㈠榛樿璁剧疆</button>
+
+ <view class="theme-preview">
+ <view>
+ <text>褰撳墠涓婚</text>
+ <text>{{ theme.name }}</text>
+ </view>
+ <view class="preview-button">涓昏鎿嶄綔</view>
+ </view>
+
+ <button class="plain-button" @click="clearLocalPreference">鎭㈠榛樿璁剧疆</button>
</view>
</template>
@@ -74,12 +126,71 @@
.page {
min-height: 100vh;
padding: 24rpx;
- background: #f6f7f9;
+ background: var(--color-bg-page, #f6f7f9);
}
+ .section-title {
+ margin: 8rpx 4rpx 14rpx;
+ color: var(--color-text-secondary, #65758b);
+ font-size: 24rpx;
+ font-weight: 600;
+ }
+ .theme-card,
.card {
overflow: hidden;
- background: #fff;
+ margin-bottom: 28rpx;
+ background: var(--color-bg-card, #fff);
border-radius: 20rpx;
+ }
+ .theme-option {
+ display: flex;
+ min-height: 112rpx;
+ align-items: center;
+ gap: 20rpx;
+ padding: 18rpx 28rpx;
+ border-bottom: 1rpx solid var(--color-border, #edf0f4);
+ }
+ .theme-option:last-child,
+ .setting-row:last-child {
+ border-bottom: 0;
+ }
+ .theme-option.active {
+ background: var(--color-primary-soft, #eef5ff);
+ }
+ .theme-swatch {
+ display: flex;
+ flex: none;
+ width: 54rpx;
+ height: 54rpx;
+ align-items: center;
+ justify-content: center;
+ color: #fff;
+ font-size: 28rpx;
+ font-weight: 700;
+ border: 6rpx solid rgba(255, 255, 255, 0.78);
+ border-radius: 50%;
+ box-shadow: 0 0 0 2rpx rgba(32, 49, 72, 0.12);
+ }
+ .theme-copy {
+ flex: 1;
+ min-width: 0;
+ }
+ .theme-copy text {
+ display: block;
+ }
+ .theme-copy text:first-child {
+ color: var(--color-text-primary, #24344e);
+ font-size: 28rpx;
+ font-weight: 700;
+ }
+ .theme-copy text:last-child {
+ margin-top: 5rpx;
+ color: var(--color-text-muted, #8a96a8);
+ font-size: 22rpx;
+ }
+ .theme-check {
+ flex: none;
+ color: var(--color-primary, #1769d8);
+ font-size: 23rpx;
}
.setting-row {
display: flex;
@@ -88,10 +199,7 @@
justify-content: space-between;
gap: 20rpx;
padding: 20rpx 28rpx;
- border-bottom: 1rpx solid #edf0f4;
- }
- .setting-row:last-child {
- border-bottom: 0;
+ border-bottom: 1rpx solid var(--color-border, #edf0f4);
}
.setting-row > view {
flex: 1;
@@ -101,23 +209,54 @@
display: block;
}
.setting-row text:first-child {
- color: #24344e;
+ color: var(--color-text-primary, #24344e);
font-size: 28rpx;
font-weight: 700;
}
.setting-row text:last-child {
margin-top: 8rpx;
- color: #8a96a8;
+ color: var(--color-text-muted, #8a96a8);
font-size: 23rpx;
line-height: 1.4;
}
+ .theme-preview {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 24rpx;
+ padding: 24rpx 28rpx;
+ background: var(--color-bg-card, #fff);
+ border: 1rpx solid var(--color-primary-border, #bfdbff);
+ border-radius: 18rpx;
+ }
+ .theme-preview text {
+ display: block;
+ }
+ .theme-preview text:first-child {
+ color: var(--color-text-muted, #8a96a8);
+ font-size: 22rpx;
+ }
+ .theme-preview text:last-child {
+ margin-top: 4rpx;
+ color: var(--color-text-primary, #24344e);
+ font-size: 28rpx;
+ font-weight: 700;
+ }
+ .preview-button {
+ flex: none;
+ padding: 14rpx 26rpx;
+ color: #fff;
+ font-size: 24rpx;
+ background: var(--color-primary, #1769d8);
+ border-radius: 10rpx;
+ }
.plain-button {
height: 84rpx;
- margin-top: 32rpx;
- color: #1769d8;
+ margin-top: 28rpx;
+ color: var(--color-primary, #1769d8);
font-size: 28rpx;
line-height: 84rpx;
- background: #fff;
+ background: var(--color-bg-card, #fff);
border-radius: 16rpx;
}
.plain-button::after {
--
Gitblit v1.9.3