Browse Source

refactor(app): 更新主题变量和优化布局组件

EvilDragon 5 months ago
parent
commit
492ff17308

+ 39 - 0
packages/app/.gitignore

@@ -0,0 +1,39 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+lerna-debug.log*
+
+node_modules
+.DS_Store
+dist
+*.local
+.yalc
+
+# Editor directories and files
+.idea
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
+.hbuilderx
+
+.stylelintcache
+
+# lock 文件还是不要了,我主要的版本写死就好了
+# pnpm-lock.yaml
+# package-lock.json
+
+# TIPS:如果某些文件已经加入了版本管理,现在重新加入 .gitignore 是不生效的,需要执行下面的操作
+# `git rm -r --cached .` 然后提交 commit 即可。
+
+# git rm -r --cached file1 file2  ## 针对某些文件
+# git rm -r --cached dir1 dir2  ## 针对某些文件夹
+# git rm -r --cached .  ## 针对所有文件
+
+# 更新 uni-app 官方版本
+# npx @dcloudio/uvm@latest

+ 159 - 0
packages/app/package.json

@@ -0,0 +1,159 @@
+{
+  "name": "@designer-hub/app",
+  "type": "commonjs",
+  "version": "2.4.3",
+  "description": "unibest - 最好的 uniapp 开发模板",
+  "author": {
+    "name": "codercup",
+    "zhName": "菲鸽",
+    "email": "1020103647@qq.com",
+    "github": "https://github.com/codercup",
+    "gitee": "https://gitee.com/codercup"
+  },
+  "license": "MIT",
+  "repository": "https://github.com/codercup/unibest",
+  "repository-gitee": "https://gitee.com/codercup/unibest",
+  "bugs": {
+    "url": "https://github.com/codercup/unibest/issues"
+  },
+  "homepage": "https://codercup.github.io/unibest/",
+  "engines": {
+    "node": ">=18",
+    "pnpm": ">=7.30"
+  },
+  "scripts": {
+    "preinstall": "npx only-allow pnpm",
+    "uvm": "npx @dcloudio/uvm@latest",
+    "uvm-rm": "node ./scripts/postupgrade.js",
+    "postuvm": "echo upgrade uni-app success!",
+    "dev:app": "uni -p app",
+    "dev:app-android": "uni -p app-android",
+    "dev:app-ios": "uni -p app-ios",
+    "dev:custom": "uni -p",
+    "dev": "uni",
+    "dev:h5": "uni",
+    "dev:h5:ssr": "uni --ssr",
+    "dev:mp": "uni -p mp-weixin",
+    "dev:mp-alipay": "uni -p mp-alipay",
+    "dev:mp-baidu": "uni -p mp-baidu",
+    "dev:mp-jd": "uni -p mp-jd",
+    "dev:mp-kuaishou": "uni -p mp-kuaishou",
+    "dev:mp-lark": "uni -p mp-lark",
+    "dev:mp-qq": "uni -p mp-qq",
+    "dev:mp-toutiao": "uni -p mp-toutiao",
+    "dev:mp-weixin": "uni -p mp-weixin",
+    "dev:quickapp-webview": "uni -p quickapp-webview",
+    "dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",
+    "dev:quickapp-webview-union": "uni -p quickapp-webview-union",
+    "build:app": "uni build -p app",
+    "build:app-android": "uni build -p app-android",
+    "build:app-ios": "uni build -p app-ios",
+    "build:custom": "uni build -p",
+    "build:h5": "uni build",
+    "build": "uni build",
+    "build:h5:ssr": "uni build --ssr",
+    "build:mp-alipay": "uni build -p mp-alipay",
+    "build:mp": "uni build -p mp-weixin",
+    "build:mp-baidu": "uni build -p mp-baidu",
+    "build:mp-jd": "uni build -p mp-jd",
+    "build:mp-kuaishou": "uni build -p mp-kuaishou",
+    "build:mp-lark": "uni build -p mp-lark",
+    "build:mp-qq": "uni build -p mp-qq",
+    "build:mp-toutiao": "uni build -p mp-toutiao",
+    "build:mp-weixin": "uni build -p mp-weixin",
+    "build:quickapp-webview": "uni build -p quickapp-webview",
+    "build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
+    "build:quickapp-webview-union": "uni build -p quickapp-webview-union",
+    "upload:mp-weixin": "minici --platform weixin",
+    "prepare": "git init && husky install ",
+    "type-check": "vue-tsc --noEmit",
+    "cz": "czg"
+  },
+  "lint-staged": {
+    "**/*.{html,vue,ts,cjs,json,md}": [
+      "prettier --write"
+    ],
+    "**/*.{vue,js,ts,jsx,tsx}": [
+      "eslint --fix"
+    ],
+    "**/*.{vue,css,scss,html}": [
+      "stylelint --fix"
+    ]
+  },
+  "resolutions": {
+    "bin-wrapper": "npm:bin-wrapper-china"
+  },
+  "dependencies": {
+    "@dcloudio/uni-app": "3.0.0-alpha-4010520240507001",
+    "@dcloudio/uni-app-plus": "3.0.0-alpha-4010520240507001",
+    "@dcloudio/uni-components": "3.0.0-alpha-4010520240507001",
+    "@dcloudio/uni-h5": "3.0.0-alpha-4010520240507001",
+    "@dcloudio/uni-mp-weixin": "3.0.0-alpha-4010520240507001",
+    "@webevostudio/test.ui.login-test": "^0.0.1",
+    "czg": "^1.9.3",
+    "dayjs": "1.11.10",
+    "pinia": "2.0.36",
+    "pinia-plugin-persistedstate": "3.2.1",
+    "qs": "6.5.3",
+    "radash": "^12.1.0",
+    "vue": "3.4.21",
+    "wot-design-uni": "^1.2.26",
+    "z-paging": "^2.7.10"
+  },
+  "devDependencies": {
+    "@commitlint/cli": "^18.6.1",
+    "@commitlint/config-conventional": "^18.6.3",
+    "@dcloudio/types": "^3.4.8",
+    "@dcloudio/uni-automator": "3.0.0-alpha-4010520240507001",
+    "@dcloudio/uni-cli-shared": "3.0.0-alpha-4010520240507001",
+    "@dcloudio/uni-stacktracey": "3.0.0-alpha-4010520240507001",
+    "@dcloudio/vite-plugin-uni": "3.0.0-alpha-4010520240507001",
+    "@esbuild/darwin-arm64": "0.20.2",
+    "@esbuild/darwin-x64": "0.20.2",
+    "@iconify-json/carbon": "^1.1.35",
+    "@rollup/rollup-darwin-x64": "^4.18.0",
+    "@types/node": "^20.14.2",
+    "@types/wechat-miniprogram": "^3.4.7",
+    "@typescript-eslint/eslint-plugin": "^6.21.0",
+    "@typescript-eslint/parser": "^6.21.0",
+    "@uni-helper/vite-plugin-uni-layouts": "^0.1.10",
+    "@uni-helper/vite-plugin-uni-manifest": "^0.2.6",
+    "@uni-helper/vite-plugin-uni-pages": "0.2.20",
+    "@uni-helper/vite-plugin-uni-platform": "^0.0.4",
+    "@unocss/preset-legacy-compat": "^0.59.4",
+    "@vue/runtime-core": "^3.4.29",
+    "@vue/tsconfig": "^0.1.3",
+    "autoprefixer": "^10.4.19",
+    "commitlint": "^18.6.1",
+    "eslint": "^8.57.0",
+    "eslint-config-prettier": "^9.1.0",
+    "eslint-config-standard": "^17.1.0",
+    "eslint-import-resolver-typescript": "^3.6.1",
+    "eslint-plugin-import": "^2.29.1",
+    "eslint-plugin-prettier": "^5.1.3",
+    "eslint-plugin-vue": "^9.26.0",
+    "husky": "^8.0.3",
+    "lint-staged": "^15.2.7",
+    "postcss": "^8.4.38",
+    "postcss-html": "^1.7.0",
+    "postcss-scss": "^4.0.9",
+    "rollup-plugin-visualizer": "^5.12.0",
+    "sass": "^1.77.5",
+    "stylelint": "^16.6.1",
+    "stylelint-config-html": "^1.1.0",
+    "stylelint-config-recess-order": "^4.6.0",
+    "stylelint-config-recommended": "^14.0.0",
+    "stylelint-config-recommended-scss": "^14.0.0",
+    "stylelint-config-recommended-vue": "^1.5.0",
+    "stylelint-prettier": "^5.0.0",
+    "terser": "^5.31.1",
+    "typescript": "^4.9.5",
+    "uni-mini-ci": "^0.0.11",
+    "unocss": "^0.58.9",
+    "unocss-applet": "^0.7.8",
+    "unplugin-auto-import": "^0.17.6",
+    "vite": "5.2.8",
+    "vite-plugin-restart": "^0.4.0",
+    "vue-tsc": "^1.8.27"
+  }
+}

+ 15 - 0
packages/app/src/core/themes/default.ts

@@ -0,0 +1,15 @@
+import {ConfigProviderThemeVars} from "wot-design-uni";
+
+export const defaultThemeVars: ConfigProviderThemeVars = {
+  // colorTheme: 'red',
+  buttonPrimaryBgColor: '#000',
+  // buttonPrimaryColor: '#07c160',
+  buttonMediumRadius: '16rpx',
+  buttonMediumHeight: '92rpx',
+  // buttonLargeRadius: '8px',
+  // buttonSmallRadius: '8px',
+  tagPrimaryBg: '#000',
+  tagPrimaryColor: '#fff',
+  tagInfoBg: '#efefef',
+  tagRoundRadius: '8rpx',
+};

+ 2 - 15
packages/app/src/layouts/default.vue

@@ -1,22 +1,9 @@
 <script lang="ts" setup>
-import type { ConfigProviderThemeVars } from 'wot-design-uni'
+import {defaultThemeVars} from "@/core/themes/default";
 
-const themeVars: ConfigProviderThemeVars = {
-  // colorTheme: 'red',
-  buttonPrimaryBgColor: '#000',
-  // buttonPrimaryColor: '#07c160',
-  buttonMediumRadius: '16rpx',
-  buttonMediumHeight: '92rpx',
-  // buttonLargeRadius: '8px',
-  // buttonSmallRadius: '8px',
-  tagPrimaryBg: '#000',
-  tagPrimaryColor: '#fff',
-  tagInfoBg: '#efefef',
-  tagRoundRadius: '8rpx',
-}
 </script>
 <template>
-  <wd-config-provider class="flex-grow flex flex-col" style="flex-grow: 1" :themeVars="themeVars">
+  <wd-config-provider class="flex-grow flex flex-col" custom-class="flex-grow" :themeVars="defaultThemeVars">
     <view class="bg-[#f6f6f6] flex-grow flex flex-col">
       <slot />
     </view>

+ 2 - 8
packages/app/src/layouts/tabbar.vue

@@ -13,14 +13,8 @@ import {
   publish,
 } from '@/core/libs/svgs'
 import { currRoute } from '@/utils'
-import { select } from 'radash'
-import type { ConfigProviderThemeVars } from 'wot-design-uni'
+import {defaultThemeVars} from "@/core/themes/default";
 
-const themeVars: ConfigProviderThemeVars = {
-  // colorTheme: 'red',
-  buttonPrimaryBgColor: '#000',
-  // buttonPrimaryColor: '#07c160',
-}
 const publishState = ref(false)
 const items = [
   {
@@ -73,7 +67,7 @@ const toPublishCase = () => {
 </script>
 
 <template>
-  <wd-config-provider :themeVars="themeVars">
+  <wd-config-provider :themeVars="defaultThemeVars">
     <view class="bg-[#f6f6f6] pb-20">
       <slot />
     </view>