From bd74a89cd9f772fcaba89e8fef92392b29951fb8 Mon Sep 17 00:00:00 2001 From: JY_en_ke_hao Date: Thu, 28 Mar 2024 10:37:55 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E9=BB=91?= =?UTF-8?q?=E6=9A=97=E4=B8=BB=E9=A2=98=20src=20=E6=A0=B9=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8B=E7=9A=84theme.json=E4=B8=AD=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BB=E9=A2=98=E9=BB=98=E8=AE=A4=E9=A2=9C=E8=89=B2=EF=BC=8C?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=AA=92=E4=BD=93=E6=9F=A5=E8=AF=A2=E7=BB=99?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E7=9A=84=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 3 ++- manifest.config.ts | 16 +++++++++++++++- pages.config.ts | 21 +++++++++++---------- src/pages/demo/index.vue | 4 ++-- src/style/index.scss | 19 ++++++++++++++++++- src/theme.json | 38 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 86 insertions(+), 15 deletions(-) create mode 100644 src/theme.json diff --git a/.vscode/settings.json b/.vscode/settings.json index 5bef4dbb..9ef18614 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -49,5 +49,6 @@ "uvui", "WechatMiniprogram" ], - "typescript.tsdk": "node_modules\\typescript\\lib" + "typescript.tsdk": "node_modules\\typescript\\lib", + "i18n-ally.localesPaths": ["src/locale"] } diff --git a/manifest.config.ts b/manifest.config.ts index 4cc4e1f2..beb7aaa0 100644 --- a/manifest.config.ts +++ b/manifest.config.ts @@ -38,12 +38,21 @@ export default defineManifestConfig({ autoclose: true, delay: 0, }, + safearea: { + // iOS平台的安全区域 + background: '@bgColorBottom', + backgroundDark: '#2f0508', // HX 3.1.19+支持 + bottom: { + offset: 'auto', + }, + }, /* 模块配置 */ modules: {}, /* 应用发布信息 */ distribute: { /* android打包配置 */ android: { + darkmode: true, // 暗黑模式 minSdkVersion: 30, targetSdkVersion: 30, abiFilters: ['armeabi-v7a', 'arm64-v8a'], @@ -66,7 +75,9 @@ export default defineManifestConfig({ ], }, /* ios打包配置 */ - ios: {}, + ios: { + darkmode: true, // 暗黑模式 + }, /* SDK配置 */ sdkConfigs: {}, /* 图标配置 */ @@ -80,6 +91,7 @@ export default defineManifestConfig({ quickapp: {}, /* 小程序特有相关 */ 'mp-weixin': { + darkmode: true, // 暗黑模式 appid: VITE_WX_APPID, setting: { urlCheck: false, @@ -87,7 +99,9 @@ export default defineManifestConfig({ usingComponents: true, // __usePrivacyCheck__: true, }, + // 支付宝小程序配置 'mp-alipay': { + // darkmode: true, // 暗黑模式 usingComponents: true, }, 'mp-baidu': { diff --git a/pages.config.ts b/pages.config.ts index 0a51fb8b..0c190406 100644 --- a/pages.config.ts +++ b/pages.config.ts @@ -4,9 +4,12 @@ export default defineUniPages({ globalStyle: { navigationStyle: 'default', navigationBarTitleText: 'unibest', - navigationBarBackgroundColor: '#f8f8f8', - navigationBarTextStyle: 'black', - backgroundColor: '#FFFFFF', + navigationBarBackgroundColor: '@navBgColor', + navigationBarTextStyle: '@navTxtStyle', + backgroundColor: '@bgColor', + backgroundTextStyle: '@bgTxtStyle', + backgroundColorTop: '@bgColorTop', + backgroundColorBottom: '@bgColorBottom', h5: { navigationStyle: 'custom', }, @@ -14,20 +17,18 @@ export default defineUniPages({ easycom: { autoscan: true, custom: { - '^uni-(.*)': '@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue', - '^uv-(.*)': '@climblee/uv-ui/components/uv-$1/uv-$1.vue', '^wd-(.*)': 'wot-design-uni/components/wd-$1/wd-$1.vue', }, }, tabBar: { - color: '#999999', - selectedColor: '#018d71', - backgroundColor: '#F8F8F8', - borderStyle: 'black', height: '50px', fontSize: '10px', - iconWidth: '24px', + iconWidth: '30px', spacing: '3px', + color: '@tabFontColor', + selectedColor: '@tabSelectedColor', + backgroundColor: '@tabBgColor', + borderStyle: '@tabBorderStyle', list: [ { iconPath: 'static/tabbar/home.png', diff --git a/src/pages/demo/index.vue b/src/pages/demo/index.vue index 6c797d75..9e0f170f 100644 --- a/src/pages/demo/index.vue +++ b/src/pages/demo/index.vue @@ -13,7 +13,7 @@ v-for="(tab, idx) in tabList" :key="tab.id" > - {{ tab.title }} + {{ tab.title }} @@ -23,7 +23,7 @@ class="flex bg-white items-center justify-between p-3 mb-2" @click="goDetailPage(item.path)" > - {{ item.title }} + {{ item.title }} diff --git a/src/style/index.scss b/src/style/index.scss index 15ac3dd6..9d0d6d3b 100644 --- a/src/style/index.scss +++ b/src/style/index.scss @@ -6,6 +6,23 @@ color: red; } +// 黑暗模式需要用到媒体查询来确定样式 +@media (prefers-color-scheme: dark) { + /* DarkMode 下的样式 start */ + .bg-white { + background: #1b1b1b; + } + + .bg-slate-100 { + background: #1b1b1b; + } + + .some-text { + color: #fff; + } + /* DarkMode 下的样式 end */ +} + // 全局字体引用 DEMO // @font-face { // font-family: TiTi; @@ -14,4 +31,4 @@ // .titi { // font-family: TiTi, Arial, sans-serif; -// } +// } \ No newline at end of file diff --git a/src/theme.json b/src/theme.json new file mode 100644 index 00000000..ef178c6a --- /dev/null +++ b/src/theme.json @@ -0,0 +1,38 @@ +{ + "light": { + "navBgColor": "#f8f8f8", + "navTxtStyle": "black", + "bgColor": "#ffffff", + "bgTxtStyle": "light", + "bgColorTop": "#eeeeee", + "bgColorBottom": "#efefef", + "tabFontColor": "#000000", + "tabSelectedColor": "#3cc51f", + "tabBgColor": "#ffffff", + "tabBorderStyle": "black", + "iconPath1": "/static/tabbar/home-w.png", + "selectedIconPath1": "/static/tabbar/home.png", + "iconPath2": "/static/tabbar/word-w.png", + "selectedIconPath2": "/static/tabbar/word.png", + "iconPath3": "/static/tabbar/order-w.png", + "selectedIconPath3": "/static/tabbar/order.png" + }, + "dark": { + "navBgColor": "#292929", + "navTxtStyle": "white", + "bgColor": "#1f1f1f", + "bgTxtStyle": "dark", + "bgColorTop": "#292929", + "bgColorBottom": "#1f1f1f", + "tabFontColor": "#ffffff", + "tabSelectedColor": "#51a937", + "tabBgColor": "#292929", + "tabBorderStyle": "white", + "iconPath1": "/static/tabbar/home-b.png", + "selectedIconPath1": "/static/tabbar/B-home.png", + "iconPath2": "/static/tabbar/order-b.png", + "selectedIconPath2": "/static/tabbar/B-word.png", + "iconPath3": "/static/tabbar/word-b.png", + "selectedIconPath3": "/static/tabbar/B-order.png" + } +} From acc3b40b612941400ec9e66c4235df7ebba347e8 Mon Sep 17 00:00:00 2001 From: JY_en_ke_hao Date: Thu, 28 Mar 2024 12:59:58 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat(=E5=A2=9E=E5=8A=A0=20wot-UI=E5=BA=93?= =?UTF-8?q?=E7=9A=84=E9=BB=91=E6=9A=97=E9=80=82=E9=85=8D=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E5=AE=9A=E5=88=B6wot=E7=9A=84=E4=B8=BB=E9=A2=98=E8=89=B2):=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=BB=91=E6=9A=97=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.config.ts | 1 + src/layouts/default.vue | 20 +++++++++++++++++++- src/static/tabbar/codeDark.png | Bin 0 -> 2317 bytes src/static/tabbar/codeLight.png | Bin 0 -> 2249 bytes src/static/tabbar/homeDark.png | Bin 0 -> 2788 bytes src/static/tabbar/homeLight.png | Bin 0 -> 2795 bytes src/static/tabbar/myDark.png | Bin 0 -> 3095 bytes src/static/tabbar/myLight.png | Bin 0 -> 3175 bytes src/theme.json | 24 ++++++++++++------------ 9 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 src/static/tabbar/codeDark.png create mode 100644 src/static/tabbar/codeLight.png create mode 100644 src/static/tabbar/homeDark.png create mode 100644 src/static/tabbar/homeLight.png create mode 100644 src/static/tabbar/myDark.png create mode 100644 src/static/tabbar/myLight.png diff --git a/pages.config.ts b/pages.config.ts index 0c190406..625889fc 100644 --- a/pages.config.ts +++ b/pages.config.ts @@ -17,6 +17,7 @@ export default defineUniPages({ easycom: { autoscan: true, custom: { + '^uv-(.*)': '@climblee/uv-ui/components/uv-$1/uv-$1.vue', '^wd-(.*)': 'wot-design-uni/components/wd-$1/wd-$1.vue', }, }, diff --git a/src/layouts/default.vue b/src/layouts/default.vue index 2e4a0400..c8d59e89 100644 --- a/src/layouts/default.vue +++ b/src/layouts/default.vue @@ -1,8 +1,26 @@ +