mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-21 04:46:26 +00:00
refactor(theme): 移除暗黑模式相关代码并简化主题设置页面
重构主题相关功能,移除不再使用的暗黑模式样式和配置 将主题颜色设置逻辑迁移到utils/theme模块 简化主题设置页面UI,移除预览区域 更新全局样式配置和页面路由类型定义
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
||||
<html build-time="%BUILD_TIME%">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="shortcut icon" href="/favicon.png" type="image/x-icon" />
|
||||
<link rel="shortcut icon" href="./public/favicon.png" type="image/x-icon" />
|
||||
<script>
|
||||
var coverSupport =
|
||||
"CSS" in window &&
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
// pages.config.ts
|
||||
import { defineUniPages } from "@uni-helper/vite-plugin-uni-pages";
|
||||
|
||||
export default defineUniPages({
|
||||
// 你也可以定义 pages 字段,它具有最高的优先级。
|
||||
pages: [],
|
||||
globalStyle: {
|
||||
// 导航栏配置
|
||||
navigationBarBackgroundColor: "@navBgColor",
|
||||
navigationBarTextStyle: "@navTxtStyle",
|
||||
navigationBarTitleText: "FastApp",
|
||||
|
||||
// 页面背景配置
|
||||
backgroundColor: "@bgColor",
|
||||
backgroundTextStyle: "@bgTxtStyle",
|
||||
backgroundColorTop: "@bgColorTop",
|
||||
backgroundColorBottom: "@bgColorBottom",
|
||||
|
||||
// 下拉刷新配置
|
||||
enablePullDownRefresh: false,
|
||||
onReachBottomDistance: 50,
|
||||
|
||||
// 动画配置
|
||||
animationType: "pop-in",
|
||||
animationDuration: 300,
|
||||
},
|
||||
|
||||
tabBar: {
|
||||
custom: true,
|
||||
// #ifdef MP-ALIPAY
|
||||
customize: true,
|
||||
// 暂时不生效。4.71.2025061206-alpha已修复:https://uniapp.dcloud.net.cn/release-note-alpha.html#_4-71-2025061206-alpha,我们等正式版发布后更新。
|
||||
overlay: true,
|
||||
// #endif
|
||||
height: "0",
|
||||
color: "@tabColor",
|
||||
selectedColor: "@tabSelectedColor",
|
||||
backgroundColor: "@tabBgColor",
|
||||
borderStyle: "@tabBorderStyle",
|
||||
list: [
|
||||
{
|
||||
pagePath: "pages/index/index",
|
||||
},
|
||||
{
|
||||
pagePath: "pages/work/index",
|
||||
},
|
||||
{
|
||||
pagePath: "pages/mine/index",
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
+15
-14
@@ -1,4 +1,12 @@
|
||||
{
|
||||
"easycom": {
|
||||
"autoscan": true,
|
||||
"custom": {
|
||||
"^wd-(.*)": "wot-design-uni/components/wd-$1/wd-$1.vue",
|
||||
"^cu-(.*)": "@/components/cu-$1/index.vue"
|
||||
}
|
||||
},
|
||||
|
||||
"pages": [
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
@@ -119,27 +127,20 @@
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
"navigationBarBackgroundColor": "@navBgColor",
|
||||
"navigationBarTextStyle": "@navTxtStyle",
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "FastApp",
|
||||
"backgroundColor": "@bgColor",
|
||||
"backgroundTextStyle": "@bgTxtStyle",
|
||||
"backgroundColorTop": "@bgColorTop",
|
||||
"backgroundColorBottom": "@bgColorBottom",
|
||||
"enablePullDownRefresh": false,
|
||||
"onReachBottomDistance": 50,
|
||||
"animationType": "pop-in",
|
||||
"animationDuration": 300
|
||||
"navigationBarBackgroundColor": "#F8F8F8",
|
||||
"backgroundColor": "#F8F8F8"
|
||||
},
|
||||
"tabBar": {
|
||||
"custom": true,
|
||||
"customize": true,
|
||||
"overlay": true,
|
||||
"height": "0",
|
||||
"color": "@tabColor",
|
||||
"selectedColor": "@tabSelectedColor",
|
||||
"backgroundColor": "@tabBgColor",
|
||||
"borderStyle": "@tabBorderStyle",
|
||||
"color": "#474747",
|
||||
"selectedColor": "#3B8DFF",
|
||||
"backgroundColor": "#F8F8F8",
|
||||
"borderStyle": "black",
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "pages/index/index"
|
||||
|
||||
@@ -325,18 +325,15 @@ watch(
|
||||
margin-bottom: 8rpx;
|
||||
font-size: 34rpx;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.user-id {
|
||||
font-size: 24rpx;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
|
||||
.login-prompt {
|
||||
margin-bottom: 16rpx;
|
||||
font-size: 28rpx;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
<template>
|
||||
<view class="app-container dark:text-[var(--wot-dark-color)]">
|
||||
<wd-navbar
|
||||
title="主题设置"
|
||||
left-arrow
|
||||
placeholder
|
||||
safe-area-inset-top
|
||||
@click-left="handleBack"
|
||||
/>
|
||||
<!-- 页面标题 -->
|
||||
<view class="page-header">
|
||||
<text class="page-title">主题设置</text>
|
||||
@@ -77,31 +70,7 @@
|
||||
</wd-cell>
|
||||
</wd-card>
|
||||
|
||||
<!-- 预览区域 -->
|
||||
<wd-card class="setting-section">
|
||||
<view class="section-header">
|
||||
<wd-icon name="eye" size="20" />
|
||||
<text class="section-title">效果预览</text>
|
||||
</view>
|
||||
|
||||
<wd-divider />
|
||||
|
||||
<wd-grid :column="2" border>
|
||||
<wd-grid-item use-slot>
|
||||
<wd-button size="small" type="primary">按钮</wd-button>
|
||||
</wd-grid-item>
|
||||
<wd-grid-item use-slot>
|
||||
<wd-button size="small" plain :style="{ borderColor: currentThemeColor }">边框</wd-button>
|
||||
</wd-grid-item>
|
||||
<wd-grid-item use-slot>
|
||||
<wd-text class="preview-text" :style="{ color: currentThemeColor }" text="文本"></wd-text>
|
||||
</wd-grid-item>
|
||||
|
||||
<wd-grid-item use-slot>
|
||||
<wd-tag type="primary" mark>标签</wd-tag>
|
||||
</wd-grid-item>
|
||||
</wd-grid>
|
||||
</wd-card>
|
||||
<wd-divider />
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<wd-card class="action-section">
|
||||
@@ -261,11 +230,6 @@ onMounted(() => {
|
||||
onShow(() => {
|
||||
customColor.value = currentThemeColor.value;
|
||||
});
|
||||
|
||||
// 返回
|
||||
const handleBack = () => {
|
||||
uni.navigateBack();
|
||||
};
|
||||
</script>
|
||||
|
||||
<route lang="json">
|
||||
@@ -414,12 +378,6 @@ const handleBack = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 效果预览
|
||||
.preview-text {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.preview-border {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Vendored
+3
-1
@@ -42,6 +42,7 @@ declare global {
|
||||
const getDarkerColor: typeof import('../utils/colorUtils')['getDarkerColor']
|
||||
const getLighterColor: typeof import('../utils/colorUtils')['getLighterColor']
|
||||
const getRefreshToken: typeof import('../utils/auth')['getRefreshToken']
|
||||
const getThemeColor: typeof import('../utils/theme')['getThemeColor']
|
||||
const getToken: typeof import('../utils/storage')['getToken']
|
||||
const getUserInfo: typeof import('../utils/auth')['getUserInfo']
|
||||
const guessSerializerType: typeof import('@uni-helper/uni-use')['guessSerializerType']
|
||||
@@ -117,7 +118,8 @@ declare global {
|
||||
const setActivePinia: typeof import('pinia')['setActivePinia']
|
||||
const setMapStoreSuffix: typeof import('pinia')['setMapStoreSuffix']
|
||||
const setRefreshToken: typeof import('../utils/auth')['setRefreshToken']
|
||||
const setThemeColor: typeof import('../composables/useTheme')['setThemeColor']
|
||||
const setThemeColor: typeof import('../utils/theme')['setThemeColor']
|
||||
const setThemeColorCache: typeof import('../utils/theme')['setThemeColorCache']
|
||||
const setToken: typeof import('../utils/storage')['setToken']
|
||||
const setUserInfo: typeof import('../utils/auth')['setUserInfo']
|
||||
const setupStore: typeof import('../store/index')['setupStore']
|
||||
|
||||
@@ -74,69 +74,3 @@ $uni-color-subtitle: #555; // 二级标题颜色
|
||||
$uni-font-size-subtitle: 18px;
|
||||
$uni-color-paragraph: #3f536e; // 文章段落颜色
|
||||
$uni-font-size-paragraph: 15px;
|
||||
|
||||
/* 暗黑模式全局样式 */
|
||||
.wot-theme-dark {
|
||||
color: #f5f5f5 !important;
|
||||
background-color: #1a1a1a !important;
|
||||
|
||||
/* 页面背景 */
|
||||
page {
|
||||
color: #f5f5f5 !important;
|
||||
background-color: #1a1a1a !important;
|
||||
}
|
||||
|
||||
/* H5 环境 body 样式 */
|
||||
body {
|
||||
color: #f5f5f5 !important;
|
||||
background-color: #1a1a1a !important;
|
||||
}
|
||||
|
||||
/* 通用组件暗黑模式适配 */
|
||||
.uni-page-wrapper {
|
||||
color: #f5f5f5 !important;
|
||||
background-color: #1a1a1a !important;
|
||||
}
|
||||
|
||||
/* 导航栏暗黑模式 */
|
||||
.uni-navbar {
|
||||
color: #f5f5f5 !important;
|
||||
background-color: #2a2a2a !important;
|
||||
border-bottom-color: #404040 !important;
|
||||
}
|
||||
|
||||
/* 标签栏暗黑模式 */
|
||||
.uni-tabbar {
|
||||
background-color: #2a2a2a !important;
|
||||
border-top-color: #404040 !important;
|
||||
}
|
||||
|
||||
/* 卡片组件暗黑模式 */
|
||||
.uni-card {
|
||||
color: #f5f5f5 !important;
|
||||
background-color: #2a2a2a !important;
|
||||
}
|
||||
|
||||
/* 列表项暗黑模式 */
|
||||
.uni-list-item {
|
||||
color: #f5f5f5 !important;
|
||||
background-color: #2a2a2a !important;
|
||||
border-bottom-color: #404040 !important;
|
||||
}
|
||||
|
||||
/* 输入框暗黑模式 */
|
||||
.uni-input {
|
||||
color: #f5f5f5 !important;
|
||||
background-color: #404040 !important;
|
||||
border-color: #606060 !important;
|
||||
}
|
||||
|
||||
/* 按钮暗黑模式适配 */
|
||||
.uni-button {
|
||||
&.uni-button-default {
|
||||
color: #f5f5f5 !important;
|
||||
background-color: #404040 !important;
|
||||
border-color: #606060 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
-36
@@ -1,36 +0,0 @@
|
||||
/* eslint-disable */
|
||||
/* prettier-ignore */
|
||||
// @ts-nocheck
|
||||
// Generated by vite-plugin-uni-pages
|
||||
|
||||
interface NavigateToOptions {
|
||||
url: "/pages/index/index" |
|
||||
"/pages/login/index" |
|
||||
"/pages/mine/index" |
|
||||
"/pages/work/index" |
|
||||
"/pages/mine/about/index" |
|
||||
"/pages/mine/faq/index" |
|
||||
"/pages/mine/feedback/index" |
|
||||
"/pages/mine/profile/complete-profile" |
|
||||
"/pages/mine/profile/index" |
|
||||
"/pages/mine/settings/index" |
|
||||
"/pages/mine/settings/account/index" |
|
||||
"/pages/mine/settings/agreement/index" |
|
||||
"/pages/mine/settings/network/index" |
|
||||
"/pages/mine/settings/privacy/index" |
|
||||
"/pages/mine/settings/theme/index";
|
||||
}
|
||||
interface RedirectToOptions extends NavigateToOptions {}
|
||||
|
||||
interface SwitchTabOptions {
|
||||
url: "/pages/index/index" | "/pages/work/index" | "/pages/mine/index"
|
||||
}
|
||||
|
||||
type ReLaunchOptions = NavigateToOptions | SwitchTabOptions;
|
||||
|
||||
declare interface Uni {
|
||||
navigateTo(options: UniNamespace.NavigateToOptions & NavigateToOptions): void;
|
||||
redirectTo(options: UniNamespace.RedirectToOptions & RedirectToOptions): void;
|
||||
switchTab(options: UniNamespace.SwitchTabOptions & SwitchTabOptions): void;
|
||||
reLaunch(options: UniNamespace.ReLaunchOptions & ReLaunchOptions): void;
|
||||
}
|
||||
@@ -16,15 +16,6 @@ export default {
|
||||
"flex-start": "flex justify-start items-center",
|
||||
"flex-end": "flex justify-end items-center",
|
||||
"flex-between": "flex justify-between items-center",
|
||||
"flex-around": "flex justify-around items-center",
|
||||
"flex-evenly": "flex justify-evenly items-center",
|
||||
"flex-stretch": "flex justify-stretch items-center",
|
||||
"flex-baseline": "flex justify-baseline items-center",
|
||||
"flex-column": "flex flex-col",
|
||||
"flex-row": "flex flex-row",
|
||||
|
||||
// 垂直布局并居中对齐
|
||||
"flex-col-center": "flex flex-col items-center",
|
||||
},
|
||||
],
|
||||
|
||||
|
||||
Reference in New Issue
Block a user