feat: 全面升级 Wot UI v2 并修复暗黑模式适配
- 修复 TabBar 切换激活状态不同步问题 - 修复大量 Wot UI 2.x 图标名称不匹配 - 修复暗黑模式下主题变量错误注入导致亮色模式显示异常 - 优化个人中心 UI(头像标记、图标背景色、菜单结构) - 重构首页图表时间选择器为自定义分段选择器 - 修复登录弹窗文字丢失及验证顺序 - 修复设置页面布局、退出登录按钮及 cell 点击态
This commit is contained in:
@@ -1,27 +1,32 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<wd-cell-group>
|
||||
<wd-cell title="主题设置" icon="setting1" is-link @click="navigateToTheme" />
|
||||
<wd-cell title="用户协议" icon="user" is-link @click="navigateToUserAgreement" />
|
||||
<wd-cell title="关于我们" icon="info-circle" is-link @click="navigateToAbout" />
|
||||
</wd-cell-group>
|
||||
|
||||
<wd-cell-group custom-style="margin-top:40rpx">
|
||||
<wd-cell title="网络测试" icon="wifi" is-link @click="navigateToNetworkTest" />
|
||||
<wd-cell
|
||||
title="清空缓存"
|
||||
icon="delete1"
|
||||
:value="cacheSize"
|
||||
clickable
|
||||
@click="handleClearCache"
|
||||
/>
|
||||
</wd-cell-group>
|
||||
|
||||
<view v-if="isLogin" class="logout-section">
|
||||
<wd-button custom-class="logout-btn" plain @click="handleLogout">退出登录</wd-button>
|
||||
<view class="page settings-page">
|
||||
<view class="settings-group-wrap">
|
||||
<wd-cell-group>
|
||||
<wd-cell title="主题设置" icon="settings" is-link @click="navigateToTheme" />
|
||||
<wd-cell title="用户协议" icon="user" is-link @click="navigateToUserAgreement" />
|
||||
<wd-cell title="关于我们" icon="info-circle" is-link @click="navigateToAbout" />
|
||||
</wd-cell-group>
|
||||
</view>
|
||||
|
||||
<view class="settings-group-wrap">
|
||||
<wd-cell-group custom-style="margin-top:24rpx">
|
||||
<wd-cell title="网络测试" icon="wifi" is-link @click="navigateToNetworkTest" />
|
||||
<wd-cell
|
||||
title="清空缓存"
|
||||
icon="delete"
|
||||
:value="cacheSize"
|
||||
clickable
|
||||
@click="handleClearCache"
|
||||
/>
|
||||
</wd-cell-group>
|
||||
</view>
|
||||
|
||||
<view v-if="isLogin" class="logout-section">
|
||||
<wd-button type="danger" block custom-class="logout-btn" @click="handleLogout">
|
||||
退出登录
|
||||
</wd-button>
|
||||
</view>
|
||||
|
||||
<!-- 使用wot-design-uni的Loading组件 -->
|
||||
<wd-loading
|
||||
v-if="isClearing"
|
||||
v-model="isClearing"
|
||||
@@ -35,11 +40,10 @@
|
||||
<script lang="ts" setup>
|
||||
import { useUserStore } from "@/store";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import { useToast, useDialog } from "@wot-ui/ui";
|
||||
import { useToast } from "@wot-ui/ui";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const toast = useToast();
|
||||
const { messageBox } = useDialog();
|
||||
const isLogin = computed(() => !!userStore.userInfo);
|
||||
|
||||
// 主题设置
|
||||
@@ -149,14 +153,21 @@ const handleClearCache = async () => {
|
||||
};
|
||||
|
||||
// 退出登录
|
||||
const handleLogout = async () => {
|
||||
try {
|
||||
await messageBox({ title: "提示", msg: "确定要退出登录吗?", type: "warning" });
|
||||
userStore.logout();
|
||||
toast.success("已退出登录");
|
||||
} catch {
|
||||
// 用户取消
|
||||
}
|
||||
const handleLogout = () => {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "确定要退出登录吗?",
|
||||
confirmColor: "#ff4757",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
userStore.logout();
|
||||
toast.success("已退出登录");
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({ url: "/pages/mine/index" });
|
||||
}, 800);
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
// 检查登录状态
|
||||
@@ -182,17 +193,27 @@ onLoad(() => {
|
||||
margin-top: 60rpx;
|
||||
}
|
||||
|
||||
:deep(.logout-btn) {
|
||||
width: 80%;
|
||||
height: 80rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
border-radius: 40rpx;
|
||||
.settings-page {
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.8;
|
||||
transform: scale(0.98);
|
||||
}
|
||||
.settings-group-wrap {
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.logout-section {
|
||||
margin-top: 48rpx;
|
||||
}
|
||||
|
||||
:deep(.wd-cell:active) {
|
||||
background-color: var(--color-bg-tertiary) !important;
|
||||
}
|
||||
|
||||
:deep(.logout-btn) {
|
||||
height: 88rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 24rpx;
|
||||
}
|
||||
|
||||
.loading-center {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<!-- 预设颜色选择 -->
|
||||
<wd-cell title="预设主题色">
|
||||
<template #default>
|
||||
<view class="flex gap-16rpx">
|
||||
<view class="flex flex-wrap gap-12rpx">
|
||||
<view
|
||||
v-for="(color, index) in themeColorOptions"
|
||||
:key="index"
|
||||
@@ -54,7 +54,7 @@
|
||||
<wd-cell-group title="效果预览" border custom-class="mt-24rpx">
|
||||
<wd-cell>
|
||||
<template #default>
|
||||
<view class="flex gap-24rpx py-12rpx">
|
||||
<view class="flex items-center justify-center gap-24rpx py-12rpx">
|
||||
<wd-button type="primary" size="small">主要按钮</wd-button>
|
||||
<text class="text-28rpx font-500" :style="{ color: currentThemeColor }">
|
||||
主题色文本
|
||||
@@ -67,7 +67,9 @@
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<view class="mt-32rpx">
|
||||
<wd-button type="info" size="large" block @click="handleResetTheme">重置为默认主题</wd-button>
|
||||
<wd-button type="primary" plain size="large" block @click="handleResetTheme">
|
||||
重置为默认主题
|
||||
</wd-button>
|
||||
</view>
|
||||
|
||||
<!-- 自定义颜色输入弹窗 -->
|
||||
@@ -88,7 +90,12 @@
|
||||
<text class="text-28rpx color-text-secondary">请输入十六进制颜色值</text>
|
||||
<view class="flex items-center gap-16rpx mt-16rpx">
|
||||
<view class="color-dot-lg" :style="{ backgroundColor: customColor || '#FF4757' }" />
|
||||
<wd-input v-model="customColor" placeholder="例如: #FF4757" :maxlength="7" />
|
||||
<wd-input
|
||||
v-model="customColor"
|
||||
placeholder="例如: #FF4757"
|
||||
:maxlength="7"
|
||||
custom-class="theme-input"
|
||||
/>
|
||||
</view>
|
||||
<text class="text-24rpx color-text-placeholder mt-12rpx">支持格式:#RGB 或 #RRGGBB</text>
|
||||
</view>
|
||||
@@ -280,4 +287,9 @@ onShow(() => {
|
||||
padding: 24rpx 32rpx;
|
||||
border-top: 1rpx solid var(--color-border);
|
||||
}
|
||||
|
||||
:deep(.theme-input) {
|
||||
background-color: var(--color-bg-secondary) !important;
|
||||
color: var(--color-text) !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user