From 872babf2c2d4451d9994a4179130a3637f94c2a5 Mon Sep 17 00:00:00 2001 From: h_mo <596417202@qq.com> Date: Sat, 8 Jun 2024 00:58:20 +0800 Subject: [PATCH] wip: next --- .env | 2 - .env.development | 14 -- .env.production | 12 - .eslintrc.cjs | 77 ------- .husky/commit-msg | 4 - .husky/lintstagedrc.cjs | 9 - .husky/pre-commit | 7 - .npmrc | 3 +- .prettierignore | 16 -- .prettierrc.cjs | 17 -- .vscode/extensions.json | 12 +- .vscode/settings.json | 86 +++++-- README.md | 60 +++-- commitlint.config.cjs | 37 ---- env/.env | 2 + env/.env.development | 17 ++ env/.env.production | 12 + eslint.config.js | 34 +++ index.html | 41 ++-- package.json | 190 ++++++++-------- scripts/verify-commit.ts | 28 +++ shims-uni.d.ts | 10 + src/App.vue | 14 +- src/androidPrivacy.json | 50 ++--- src/assets/main.scss | 69 ------ src/components/AppProvider/index.vue | 8 +- src/components/BasicButton/index.vue | 36 +-- src/components/BasicButton/prpos.ts | 4 +- src/components/BasicInput/index.vue | 42 ++-- src/components/Iconify/index.vue | 65 ++---- src/components/Test/index.vue | 14 +- src/enums/appEnum.ts | 7 - src/enums/httpEnum.ts | 22 +- src/enums/platformEnum.ts | 112 ---------- src/enums/routerEnum.ts | 13 -- src/hooks/app/useGlobalStyle.ts | 18 +- src/hooks/app/useSystem.ts | 153 +------------ src/main.ts | 20 +- src/manifest.json | 222 +++++++++---------- src/mock/index.ts | 18 +- src/mock/utils.ts | 34 +-- src/mock/v1/modules/auth.ts | 29 +-- src/pages.json | 215 +++++++----------- src/pages/about/index.vue | 66 +----- src/pages/demo/index.vue | 20 +- src/pages/index/index.vue | 76 ++----- src/pages/log/index.vue | 6 +- src/pages/login/index.vue | 166 +++++++------- src/pages/notFound/404.vue | 24 +- src/pages/template/index.vue | 2 +- src/pagesA/list/test1/index.vue | 18 +- src/pagesA/list/test2/index.vue | 18 +- src/pagesB/detail/index.vue | 6 +- src/router/guard.ts | 66 +++--- src/router/index.ts | 12 +- src/services/api/auth.ts | 6 +- src/services/model/authModel.d.ts | 6 +- src/services/model/baseModel.d.ts | 8 +- src/settings/encryptionSetting.ts | 4 +- src/state/app.ts | 12 - src/state/modules/auth.ts | 55 ----- src/state/modules/user.ts | 12 - src/stores/app.ts | 12 + src/{state => stores}/index.ts | 2 +- src/stores/modules/auth.ts | 56 +++++ src/stores/modules/user.ts | 12 + src/styles/main.css | 0 src/types.d.ts | 3 +- src/types/env.d.ts | 26 ++- src/types/uni-mini-router.d.ts | 8 + src/types/unplugin-transform-class-vite.d.ts | 4 + src/uni.scss | 47 ++++ src/utils/cache/index.ts | 23 +- src/utils/cache/storageCache.ts | 197 ++++++++-------- src/utils/cipher.ts | 58 ++--- src/utils/env.ts | 21 +- src/utils/http/checkStatus.ts | 86 +++---- src/utils/http/index.ts | 105 ++++----- src/utils/index.ts | 10 +- src/utils/interceptors/index.ts | 1 - src/utils/is.ts | 64 +++--- src/utils/log.ts | 4 +- src/utils/platform.ts | 133 +---------- src/utils/uniapi/index.ts | 58 ++--- src/utils/uniapi/prompt.ts | 68 +++--- tsconfig.json | 110 ++++----- unocss.config.js | 108 +++++---- vite.config.ts | 180 ++++++++------- 88 files changed, 1628 insertions(+), 2206 deletions(-) delete mode 100644 .env delete mode 100644 .env.development delete mode 100644 .env.production delete mode 100644 .eslintrc.cjs delete mode 100644 .husky/commit-msg delete mode 100644 .husky/lintstagedrc.cjs delete mode 100644 .husky/pre-commit delete mode 100644 .prettierignore delete mode 100644 .prettierrc.cjs delete mode 100644 commitlint.config.cjs create mode 100644 env/.env create mode 100644 env/.env.development create mode 100644 env/.env.production create mode 100644 eslint.config.js create mode 100644 scripts/verify-commit.ts create mode 100644 shims-uni.d.ts delete mode 100644 src/assets/main.scss delete mode 100644 src/enums/platformEnum.ts delete mode 100644 src/enums/routerEnum.ts delete mode 100644 src/state/app.ts delete mode 100644 src/state/modules/auth.ts delete mode 100644 src/state/modules/user.ts create mode 100644 src/stores/app.ts rename src/{state => stores}/index.ts (89%) create mode 100644 src/stores/modules/auth.ts create mode 100644 src/stores/modules/user.ts create mode 100644 src/styles/main.css create mode 100644 src/types/uni-mini-router.d.ts create mode 100644 src/types/unplugin-transform-class-vite.d.ts diff --git a/.env b/.env deleted file mode 100644 index 20ee9a9..0000000 --- a/.env +++ /dev/null @@ -1,2 +0,0 @@ -# title -VITE_APP_TITLE = Uni-app Vue3 Ts --Vite diff --git a/.env.development b/.env.development deleted file mode 100644 index a1198d3..0000000 --- a/.env.development +++ /dev/null @@ -1,14 +0,0 @@ -# 运行环境 -VITE_ENV = development - -# 是否使用模拟数据 -VITE_USE_MOCK = true - -VITE_PORT = 3000 - -# BASE_URL -VITE_BASE_URL = /api/v1 - -# 上传域名 -VITE_UPLOAD_URL = /upload - diff --git a/.env.production b/.env.production deleted file mode 100644 index a170745..0000000 --- a/.env.production +++ /dev/null @@ -1,12 +0,0 @@ -# 运行环境 -VITE_ENV = production - -# 是否使用模拟数据 -VITE_USE_MOCK = true - -# api域名 -VITE_BASE_URL = /api/v1 - - -# 上传域名 -VITE_UPLOAD_URL = /upload diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 53c7743..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,77 +0,0 @@ -// 参考:https://eslint.bootcss.com/docs/rules/ -// 参考:https://blog.csdn.net/x550392236/article/details/89497202 -// 参考:https://blog.csdn.net/brokenkay/article/details/111106266 - -module.exports = { - root: true, - /**环境提供预定义的全局变量 */ - env: { - /**Node.js全局变量和Node.js范围 */ - node: true, - /**浏览器全局变量 */ - browser: true, - }, - /**定义ESLint的解析器 */ - parser: 'vue-eslint-parser', - parserOptions: { - ecmaVersion: 'latest', - sourceType: 'module', - parser: '@typescript-eslint/parser', - }, - /**定义文件继承的子规范 */ - extends: ['eslint:recommended', 'plugin:vue/vue3-essential', 'plugin:@typescript-eslint/recommended','./.eslintrc-auto-import.json'], - plugins: ['vue', '@typescript-eslint'], - rules: { - 'no-var': 'error', //要求使用 let 或 const 而不是 var - camelcase: 'error', // 双峰驼命名格式 - indent: ['error', 4, { SwitchCase: 1 }], //代码缩进2个空格 - semi: ['error', 'always'], //行尾需要有分号 - quotes: ['error', 'single'], //强制使用一致的反勾号、双引号或单引号 - 'linebreak-style': ['error', 'windows'], //强制使用一致的换行风格,"unix":\n 表示 LF , "windows":\r\n 表示 CRLF - eqeqeq: ['error', 'always', { null: 'ignore' }], //比较时强制使用 === 或者 !==,但对null作比较时可以不用全等 - 'no-unused-vars': 'off', - '@typescript-eslint/no-unused-vars': [ - 'warn', - { - argsIgnorePattern: '^_', - varsIgnorePattern: '^_', - }, - ], //不允许使用未使用的变量 - '@typescript-eslint/no-explicit-any': 'off', //不允许任何类型 - '@typescript-eslint/no-empty-function': 'off', //不允许空函数 - 'vue/html-indent': ['error', 4], //在