diff --git a/.eslintrc.js b/.eslintrc.js index 1ee72aed..92e186c8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,30 +1,30 @@ module.exports = { - env: { - browser: true, - es2021: true, - node: true - }, - globals: { - defineProps: 'readonly', - defineEmits: 'readonly', - defineExpose: 'readonly' - }, - parser: 'vue-eslint-parser', - extends: [ - 'eslint:recommended', - 'plugin:vue/vue3-essential', - 'plugin:@typescript-eslint/recommended' - ], - parserOptions: { - ecmaVersion: 'latest', - parser: '@typescript-eslint/parser', - sourceType: 'module' - }, - plugins: ['vue', '@typescript-eslint'], - rules: { - 'vue/multi-word-component-names': 'off', - '@typescript-eslint/no-empty-function': 'off', // 关闭空方法检查 - '@typescript-eslint/no-explicit-any': 'off', // 关闭any类型的警告 - 'vue/no-v-model-argument': 'off' - } + env: { + browser: true, + es2021: true, + node: true + }, + globals: { + defineProps: 'readonly', + defineEmits: 'readonly', + defineExpose: 'readonly' + }, + parser: 'vue-eslint-parser', + extends: [ + 'eslint:recommended', + 'plugin:vue/vue3-essential', + 'plugin:@typescript-eslint/recommended' + ], + parserOptions: { + ecmaVersion: 'latest', + parser: '@typescript-eslint/parser', + sourceType: 'module' + }, + plugins: ['vue', '@typescript-eslint'], + rules: { + 'vue/multi-word-component-names': 'off', + '@typescript-eslint/no-empty-function': 'off', // 关闭空方法检查 + '@typescript-eslint/no-explicit-any': 'off', // 关闭any类型的警告 + 'vue/no-v-model-argument': 'off' + } }; diff --git a/.prettierrc.js b/.prettierrc.js index 73b647f4..7a424269 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -2,35 +2,35 @@ * 代码格式化配置 */ module.exports = { - // 指定每个缩进级别的空格数 - tabWidth: 2, - // 使用制表符而不是空格缩进行 - useTabs: true, - // 在语句末尾打印分号 - semi: true, - // 使用单引号而不是双引号 - singleQuote: true, - // 更改引用对象属性的时间 可选值"" - quoteProps: 'as-needed', - // 多行时尽可能打印尾随逗号。(例如,单行数组永远不会出现逗号结尾。) 可选值"",默认none - trailingComma: 'none', - // 在对象文字中的括号之间打印空格 - bracketSpacing: true, - // 在单独的箭头函数参数周围包括括号 always:(x) => x \ avoid:x => x - arrowParens: 'avoid', - // 这两个选项可用于格式化以给定字符偏移量(分别包括和不包括)开始和结束的代码 - rangeStart: 0, - rangeEnd: Infinity, - // 指定要使用的解析器,不需要写文件开头的 @prettier - requirePragma: false, - // 不需要自动在文件开头插入 @prettier - insertPragma: false, - // 换行设置 always\never\preserve - proseWrap: 'never', - // 指定HTML文件的全局空格敏感度 css\strict\ignore - htmlWhitespaceSensitivity: 'css', - // Vue文件脚本和样式标签缩进 - vueIndentScriptAndStyle: false, - // 换行符使用 lf 结尾是 可选值"" - endOfLine: 'lf' + // 指定每个缩进级别的空格数 + tabWidth: 2, + // 使用制表符而不是空格缩进行 + useTabs: false, + // 在语句末尾打印分号 + semi: true, + // 使用单引号而不是双引号 + singleQuote: true, + // 更改引用对象属性的时间 可选值"" + quoteProps: 'as-needed', + // 多行时尽可能打印尾随逗号。(例如,单行数组永远不会出现逗号结尾。) 可选值"",默认none + trailingComma: 'none', + // 在对象文字中的括号之间打印空格 + bracketSpacing: true, + // 在单独的箭头函数参数周围包括括号 always:(x) => x \ avoid:x => x + arrowParens: 'avoid', + // 这两个选项可用于格式化以给定字符偏移量(分别包括和不包括)开始和结束的代码 + rangeStart: 0, + rangeEnd: Infinity, + // 指定要使用的解析器,不需要写文件开头的 @prettier + requirePragma: false, + // 不需要自动在文件开头插入 @prettier + insertPragma: false, + // 换行设置 always\never\preserve + proseWrap: 'never', + // 指定HTML文件的全局空格敏感度 css\strict\ignore + htmlWhitespaceSensitivity: 'css', + // Vue文件脚本和样式标签缩进 + vueIndentScriptAndStyle: false, + // 换行符使用 lf 结尾是 可选值"" + endOfLine: 'lf' }; diff --git a/commitlint.config.js b/commitlint.config.js index 89ed81a6..efff0540 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,26 +1,26 @@ module.exports = { - // 继承的规则 - extends: ['@commitlint/config-conventional'], - // 定义规则类型 - rules: { - // type 类型定义,表示 git 提交的 type 必须在以下类型范围内 - 'type-enum': [ - 2, - 'always', - [ - 'feat', // 新功能 feature - 'fix', // 修复 bug - 'docs', // 文档注释 - 'style', // 代码格式(不影响代码运行的变动) - 'refactor', // 重构(既不增加新功能,也不是修复bug) - 'perf', // 性能优化 - 'test', // 增加测试 - 'chore', // 构建过程或辅助工具的变动 - 'revert', // 回退 - 'build' // 打包 - ] - ], - // subject 大小写不做校验 - 'subject-case': [0] - } + // 继承的规则 + extends: ['@commitlint/config-conventional'], + // 定义规则类型 + rules: { + // type 类型定义,表示 git 提交的 type 必须在以下类型范围内 + 'type-enum': [ + 2, + 'always', + [ + 'feat', // 新功能 feature + 'fix', // 修复 bug + 'docs', // 文档注释 + 'style', // 代码格式(不影响代码运行的变动) + 'refactor', // 重构(既不增加新功能,也不是修复bug) + 'perf', // 性能优化 + 'test', // 增加测试 + 'chore', // 构建过程或辅助工具的变动 + 'revert', // 回退 + 'build' // 打包 + ] + ], + // subject 大小写不做校验 + 'subject-case': [0] + } }; diff --git a/index.html b/index.html index 28ac5713..753e4046 100644 --- a/index.html +++ b/index.html @@ -1,13 +1,13 @@ - - - - - vue3-element-admin - - -
- - + + + + + vue3-element-admin + + +
+ + diff --git a/package.json b/package.json index f52a375b..28836a49 100644 --- a/package.json +++ b/package.json @@ -1,55 +1,55 @@ { - "name": "vue3-element-admin", - "version": "1.0.0", - "scripts": { - "dev": "vite serve --mode development", - "build:prod": "vue-tsc --noEmit && vite build --mode production", - "serve": "vite preview", - "lint": "eslint src/**/*.{ts,js,vue} --fix", - "prepare": "husky install", - "prettier": "prettier --write ." - }, - "dependencies": { - "@element-plus/icons-vue": "^1.0.0", - "@wangeditor/editor": "^5.0.0", - "@wangeditor/editor-for-vue": "^5.1.10", - "axios": "^0.24.0", - "better-scroll": "^2.4.2", - "echarts": "^5.2.2", - "element-plus": "^2.1.8", - "nprogress": "^0.2.0", - "path-browserify": "^1.0.1", - "path-to-regexp": "^6.2.0", - "pinia": "^2.0.12", - "screenfull": "^6.0.0", - "sortablejs": "^1.14.0", - "vue": "^3.2.25", - "vue-i18n": "^9.1.9", - "vue-router": "^4.0.12" - }, - "devDependencies": { - "@commitlint/cli": "^16.2.3", - "@commitlint/config-conventional": "^16.2.1", - "@types/node": "^16.11.7", - "@types/nprogress": "^0.2.0", - "@types/path-browserify": "^1.0.0", - "@typescript-eslint/eslint-plugin": "^5.19.0", - "@typescript-eslint/parser": "^5.19.0", - "@vitejs/plugin-vue": "^1.9.3", - "eslint": "^8.14.0", - "eslint-config-prettier": "^8.5.0", - "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-vue": "^8.6.0", - "fast-glob": "^3.2.11", - "husky": "^7.0.4", - "prettier": "^2.6.2", - "sass": "^1.43.4", - "typescript": "^4.5.4", - "vite": "^2.9.7", - "vite-plugin-svg-icons": "^2.0.1", - "vue-tsc": "^0.34.7" - }, - "repository": "https://gitee.com/youlaiorg/vue3-element-admin.git", - "author": "有来开源组织", - "license": "MIT" + "name": "vue3-element-admin", + "version": "1.0.0", + "scripts": { + "dev": "vite serve --mode development", + "build:prod": "vue-tsc --noEmit && vite build --mode production", + "serve": "vite preview", + "lint": "eslint src/**/*.{ts,js,vue} --fix", + "prepare": "husky install", + "prettier": "prettier --write ." + }, + "dependencies": { + "@element-plus/icons-vue": "^1.0.0", + "@wangeditor/editor": "^5.0.0", + "@wangeditor/editor-for-vue": "^5.1.10", + "axios": "^0.24.0", + "better-scroll": "^2.4.2", + "echarts": "^5.2.2", + "element-plus": "^2.1.8", + "nprogress": "^0.2.0", + "path-browserify": "^1.0.1", + "path-to-regexp": "^6.2.0", + "pinia": "^2.0.12", + "screenfull": "^6.0.0", + "sortablejs": "^1.14.0", + "vue": "^3.2.25", + "vue-i18n": "^9.1.9", + "vue-router": "^4.0.12" + }, + "devDependencies": { + "@commitlint/cli": "^16.2.3", + "@commitlint/config-conventional": "^16.2.1", + "@types/node": "^16.11.7", + "@types/nprogress": "^0.2.0", + "@types/path-browserify": "^1.0.0", + "@typescript-eslint/eslint-plugin": "^5.19.0", + "@typescript-eslint/parser": "^5.19.0", + "@vitejs/plugin-vue": "^1.9.3", + "eslint": "^8.14.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-prettier": "^4.0.0", + "eslint-plugin-vue": "^8.6.0", + "husky": "^7.0.4", + "prettier": "^2.6.2", + "sass": "^1.43.4", + "typescript": "^4.5.4", + "vite": "^2.9.7", + "fast-glob": "^3.2.11", + "vite-plugin-svg-icons": "^2.0.1", + "vue-tsc": "^0.34.7" + }, + "repository": "https://gitee.com/youlaiorg/vue3-element-admin.git", + "author": "有来开源组织", + "license": "MIT" } diff --git a/src/App.vue b/src/App.vue index 8b6bdec9..f2d66977 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,7 +1,7 @@ diff --git a/src/api/lab/seata.ts b/src/api/lab/seata.ts index 7ca6c3c2..01e819f2 100644 --- a/src/api/lab/seata.ts +++ b/src/api/lab/seata.ts @@ -6,11 +6,11 @@ import request from '@/utils/request'; * @returns */ export function payOrder(data: SeataFormData) { - return request({ - url: '/youlai-lab/api/v1/seata/order/_pay', - method: 'post', - data: data - }); + return request({ + url: '/youlai-lab/api/v1/seata/order/_pay', + method: 'post', + data: data + }); } /** @@ -18,10 +18,10 @@ export function payOrder(data: SeataFormData) { * @returns */ export function getSeataData() { - return request({ - url: '/youlai-lab/api/v1/seata/data', - method: 'get' - }); + return request({ + url: '/youlai-lab/api/v1/seata/data', + method: 'get' + }); } /** @@ -29,8 +29,8 @@ export function getSeataData() { * @returns */ export function resetSeataData() { - return request({ - url: '/youlai-lab/api/v1/seata/data/_reset', - method: 'put' - }); + return request({ + url: '/youlai-lab/api/v1/seata/data/_reset', + method: 'put' + }); } diff --git a/src/api/login/index.ts b/src/api/login/index.ts index a4583083..865b428f 100644 --- a/src/api/login/index.ts +++ b/src/api/login/index.ts @@ -7,32 +7,32 @@ import { AxiosPromise } from 'axios'; * @param data */ export function login(data: LoginFormData): AxiosPromise { - return request({ - url: '/youlai-auth/oauth/token', - method: 'post', - params: data, - headers: { - Authorization: 'Basic bWFsbC1hZG1pbi13ZWI6MTIzNDU2' // 客户端信息Base64明文:mall-admin-web:123456 - } - }); + return request({ + url: '/youlai-auth/oauth/token', + method: 'post', + params: data, + headers: { + Authorization: 'Basic bWFsbC1hZG1pbi13ZWI6MTIzNDU2' // 客户端信息Base64明文:mall-admin-web:123456 + } + }); } /** * 注销 */ export function logout() { - return request({ - url: '/youlai-auth/oauth/logout', - method: 'delete' - }); + return request({ + url: '/youlai-auth/oauth/logout', + method: 'delete' + }); } /** * 获取图片验证码 */ export function getCaptcha(): AxiosPromise { - return request({ - url: '/captcha?t=' + new Date().getTime().toString(), - method: 'get' - }); + return request({ + url: '/captcha?t=' + new Date().getTime().toString(), + method: 'get' + }); } diff --git a/src/api/oms/order.ts b/src/api/oms/order.ts index 649fd051..8a8228d7 100644 --- a/src/api/oms/order.ts +++ b/src/api/oms/order.ts @@ -8,13 +8,13 @@ import { AxiosPromise } from 'axios'; * @param queryParams */ export function listOrderPages( - queryParams: OrderQueryParam + queryParams: OrderQueryParam ): AxiosPromise { - return request({ - url: '/mall-oms/api/v1/orders', - method: 'get', - params: queryParams - }); + return request({ + url: '/mall-oms/api/v1/orders', + method: 'get', + params: queryParams + }); } /** @@ -23,8 +23,8 @@ export function listOrderPages( * @param orderId */ export function getOrderDetail(orderId: number) { - return request({ - url: '/mall-oms/api/v1/orders/' + orderId, - method: 'get' - }); + return request({ + url: '/mall-oms/api/v1/orders/' + orderId, + method: 'get' + }); } diff --git a/src/api/pms/attribute.ts b/src/api/pms/attribute.ts index 02a7a9ea..5afb4d69 100644 --- a/src/api/pms/attribute.ts +++ b/src/api/pms/attribute.ts @@ -6,11 +6,11 @@ import request from '@/utils/request'; * @param params */ export function listAttributes(params: object) { - return request({ - url: '/mall-pms/api/v1/attributes', - method: 'get', - params: params - }); + return request({ + url: '/mall-pms/api/v1/attributes', + method: 'get', + params: params + }); } /** @@ -19,9 +19,9 @@ export function listAttributes(params: object) { * @param data */ export function saveAttributeBatch(data: object) { - return request({ - url: '/mall-pms/api/v1/attributes/batch', - method: 'post', - data: data - }); + return request({ + url: '/mall-pms/api/v1/attributes/batch', + method: 'post', + data: data + }); } diff --git a/src/api/pms/brand.ts b/src/api/pms/brand.ts index e9a0718c..0cc8b68e 100644 --- a/src/api/pms/brand.ts +++ b/src/api/pms/brand.ts @@ -1,8 +1,8 @@ import { - BrandFormData, - BrandItem, - BrandPageResult, - BrandQueryParam + BrandFormData, + BrandItem, + BrandPageResult, + BrandQueryParam } from '@/types'; import request from '@/utils/request'; import { AxiosPromise } from 'axios'; @@ -13,13 +13,13 @@ import { AxiosPromise } from 'axios'; * @param queryParams */ export function listBrandPages( - queryParams: BrandQueryParam + queryParams: BrandQueryParam ): AxiosPromise { - return request({ - url: '/mall-pms/api/v1/brands/page', - method: 'get', - params: queryParams - }); + return request({ + url: '/mall-pms/api/v1/brands/page', + method: 'get', + params: queryParams + }); } /** @@ -28,13 +28,13 @@ export function listBrandPages( * @param queryParams */ export function listBrands( - queryParams?: BrandQueryParam + queryParams?: BrandQueryParam ): AxiosPromise { - return request({ - url: '/mall-pms/api/v1/brands', - method: 'get', - params: queryParams - }); + return request({ + url: '/mall-pms/api/v1/brands', + method: 'get', + params: queryParams + }); } /** @@ -43,10 +43,10 @@ export function listBrands( * @param id */ export function getBrandFormDetail(id: number): AxiosPromise { - return request({ - url: '/mall-pms/api/v1/brands/' + id, - method: 'get' - }); + return request({ + url: '/mall-pms/api/v1/brands/' + id, + method: 'get' + }); } /** @@ -55,11 +55,11 @@ export function getBrandFormDetail(id: number): AxiosPromise { * @param data */ export function addBrand(data: BrandFormData) { - return request({ - url: '/mall-pms/api/v1/brands', - method: 'post', - data: data - }); + return request({ + url: '/mall-pms/api/v1/brands', + method: 'post', + data: data + }); } /** @@ -69,11 +69,11 @@ export function addBrand(data: BrandFormData) { * @param data */ export function updateBrand(id: number, data: BrandFormData) { - return request({ - url: '/mall-pms/api/v1/brands/' + id, - method: 'put', - data: data - }); + return request({ + url: '/mall-pms/api/v1/brands/' + id, + method: 'put', + data: data + }); } /** @@ -82,8 +82,8 @@ export function updateBrand(id: number, data: BrandFormData) { * @param ids */ export function deleteBrands(ids: string) { - return request({ - url: '/mall-pms/api/v1/brands/' + ids, - method: 'delete' - }); + return request({ + url: '/mall-pms/api/v1/brands/' + ids, + method: 'delete' + }); } diff --git a/src/api/pms/category.ts b/src/api/pms/category.ts index 666adba5..04018ba8 100644 --- a/src/api/pms/category.ts +++ b/src/api/pms/category.ts @@ -6,11 +6,11 @@ import request from '@/utils/request'; * @param queryParams */ export function listCategories(queryParams: object) { - return request({ - url: '/mall-pms/api/v1/categories', - method: 'get', - params: queryParams - }); + return request({ + url: '/mall-pms/api/v1/categories', + method: 'get', + params: queryParams + }); } /** @@ -19,11 +19,11 @@ export function listCategories(queryParams: object) { * @param queryParams */ export function listCascadeCategories(queryParams?: object) { - return request({ - url: '/mall-pms/api/v1/categories/cascade', - method: 'get', - params: queryParams - }); + return request({ + url: '/mall-pms/api/v1/categories/cascade', + method: 'get', + params: queryParams + }); } /** @@ -32,10 +32,10 @@ export function listCascadeCategories(queryParams?: object) { * @param id */ export function getCategoryDetail(id: number) { - return request({ - url: '/mall-pms/api/v1/categories/' + id, - method: 'get' - }); + return request({ + url: '/mall-pms/api/v1/categories/' + id, + method: 'get' + }); } /** @@ -44,11 +44,11 @@ export function getCategoryDetail(id: number) { * @param data */ export function addCategory(data: object) { - return request({ - url: '/mall-pms/api/v1/categories', - method: 'post', - data: data - }); + return request({ + url: '/mall-pms/api/v1/categories', + method: 'post', + data: data + }); } /** @@ -58,11 +58,11 @@ export function addCategory(data: object) { * @param data */ export function updateCategory(id: number, data: object) { - return request({ - url: '/mall-pms/api/v1/categories/' + id, - method: 'put', - data: data - }); + return request({ + url: '/mall-pms/api/v1/categories/' + id, + method: 'put', + data: data + }); } /** @@ -71,10 +71,10 @@ export function updateCategory(id: number, data: object) { * @param ids */ export function deleteCategories(ids: string) { - return request({ - url: '/mall-pms/api/v1/categories/' + ids, - method: 'delete' - }); + return request({ + url: '/mall-pms/api/v1/categories/' + ids, + method: 'delete' + }); } /** @@ -84,9 +84,9 @@ export function deleteCategories(ids: string) { * @param data */ export function updateCategoryPart(id: number, data: object) { - return request({ - url: '/mall-pms/api/v1/categories/' + id, - method: 'patch', - data: data - }); + return request({ + url: '/mall-pms/api/v1/categories/' + id, + method: 'patch', + data: data + }); } diff --git a/src/api/pms/goods.ts b/src/api/pms/goods.ts index 34c632bb..9b9b5121 100644 --- a/src/api/pms/goods.ts +++ b/src/api/pms/goods.ts @@ -8,13 +8,13 @@ import { AxiosPromise } from 'axios'; * @param queryParams */ export function listGoodsPages( - queryParams: GoodsQueryParam + queryParams: GoodsQueryParam ): AxiosPromise { - return request({ - url: '/mall-pms/api/v1/goods/page', - method: 'get', - params: queryParams - }); + return request({ + url: '/mall-pms/api/v1/goods/page', + method: 'get', + params: queryParams + }); } /** @@ -23,10 +23,10 @@ export function listGoodsPages( * @param id */ export function getGoodsDetail(id: string): AxiosPromise { - return request({ - url: '/mall-pms/api/v1/goods/' + id, - method: 'get' - }); + return request({ + url: '/mall-pms/api/v1/goods/' + id, + method: 'get' + }); } /** @@ -35,11 +35,11 @@ export function getGoodsDetail(id: string): AxiosPromise { * @param data */ export function addGoods(data: object) { - return request({ - url: '/mall-pms/api/v1/goods', - method: 'post', - data: data - }); + return request({ + url: '/mall-pms/api/v1/goods', + method: 'post', + data: data + }); } /** @@ -49,11 +49,11 @@ export function addGoods(data: object) { * @param data */ export function updateGoods(id: number, data: object) { - return request({ - url: '/mall-pms/api/v1/goods/' + id, - method: 'put', - data: data - }); + return request({ + url: '/mall-pms/api/v1/goods/' + id, + method: 'put', + data: data + }); } /** @@ -62,8 +62,8 @@ export function updateGoods(id: number, data: object) { * @param ids */ export function deleteGoods(ids: string) { - return request({ - url: '/mall-pms/api/v1/goods/' + ids, - method: 'delete' - }); + return request({ + url: '/mall-pms/api/v1/goods/' + ids, + method: 'delete' + }); } diff --git a/src/api/sms/advert.ts b/src/api/sms/advert.ts index 1cde2d15..3587d8d1 100644 --- a/src/api/sms/advert.ts +++ b/src/api/sms/advert.ts @@ -8,13 +8,13 @@ import { AxiosPromise } from 'axios'; * @param queryParams */ export function listAdvertPages( - queryParams: AdvertQueryParam + queryParams: AdvertQueryParam ): AxiosPromise { - return request({ - url: '/mall-sms/api/v1/adverts', - method: 'get', - params: queryParams - }); + return request({ + url: '/mall-sms/api/v1/adverts', + method: 'get', + params: queryParams + }); } /** @@ -23,10 +23,10 @@ export function listAdvertPages( * @param id */ export function getAdvertFormDetail(id: number): AxiosPromise { - return request({ - url: '/mall-sms/api/v1/adverts/' + id, - method: 'get' - }); + return request({ + url: '/mall-sms/api/v1/adverts/' + id, + method: 'get' + }); } /** @@ -35,11 +35,11 @@ export function getAdvertFormDetail(id: number): AxiosPromise { * @param data */ export function addAdvert(data: AdvertFormData) { - return request({ - url: '/mall-sms/api/v1/adverts', - method: 'post', - data: data - }); + return request({ + url: '/mall-sms/api/v1/adverts', + method: 'post', + data: data + }); } /** @@ -49,11 +49,11 @@ export function addAdvert(data: AdvertFormData) { * @param data */ export function updateAdvert(id: number, data: AdvertFormData) { - return request({ - url: '/mall-sms/api/v1/adverts/' + id, - method: 'put', - data: data - }); + return request({ + url: '/mall-sms/api/v1/adverts/' + id, + method: 'put', + data: data + }); } /** @@ -62,8 +62,8 @@ export function updateAdvert(id: number, data: AdvertFormData) { * @param ids */ export function deleteAdverts(ids: string) { - return request({ - url: '/mall-sms/api/v1/adverts/' + ids, - method: 'delete' - }); + return request({ + url: '/mall-sms/api/v1/adverts/' + ids, + method: 'delete' + }); } diff --git a/src/api/system/client.ts b/src/api/system/client.ts index 5af29404..6dc26b23 100644 --- a/src/api/system/client.ts +++ b/src/api/system/client.ts @@ -1,55 +1,55 @@ import { - ClientFormData, - ClientPageResult, - ClientQueryParam + ClientFormData, + ClientPageResult, + ClientQueryParam } from '@/types/api/system/client'; import request from '@/utils/request'; import { AxiosPromise } from 'axios'; export function listClientPages( - queryParams: ClientQueryParam + queryParams: ClientQueryParam ): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/oauth-clients', - method: 'get', - params: queryParams - }); + return request({ + url: '/youlai-admin/api/v1/oauth-clients', + method: 'get', + params: queryParams + }); } export function getClientFormDetial(id: number): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/oauth-clients/' + id, - method: 'get' - }); + return request({ + url: '/youlai-admin/api/v1/oauth-clients/' + id, + method: 'get' + }); } export function addClient(data: ClientFormData) { - return request({ - url: '/youlai-admin/api/v1/oauth-clients', - method: 'post', - data: data - }); + return request({ + url: '/youlai-admin/api/v1/oauth-clients', + method: 'post', + data: data + }); } export function updateClient(id: string, data: ClientFormData) { - return request({ - url: '/youlai-admin/api/v1/oauth-clients/' + id, - method: 'put', - data: data - }); + return request({ + url: '/youlai-admin/api/v1/oauth-clients/' + id, + method: 'put', + data: data + }); } export function deleteClients(ids: string) { - return request({ - url: '/youlai-admin/api/v1/oauth-clients/' + ids, - method: 'delete' - }); + return request({ + url: '/youlai-admin/api/v1/oauth-clients/' + ids, + method: 'delete' + }); } export function updateClientPart(id: number, data: object) { - return request({ - url: '/youlai-admin/api/v1/oauth-clients/' + id, - method: 'patch', - data: data - }); + return request({ + url: '/youlai-admin/api/v1/oauth-clients/' + id, + method: 'patch', + data: data + }); } diff --git a/src/api/system/dept.ts b/src/api/system/dept.ts index 3b1a0c9b..9b5adc62 100644 --- a/src/api/system/dept.ts +++ b/src/api/system/dept.ts @@ -8,23 +8,23 @@ import { AxiosPromise } from 'axios'; * @param queryParams */ export function listTableDepartments( - queryParams?: DeptQueryParam + queryParams?: DeptQueryParam ): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/depts/table', - method: 'get', - params: queryParams - }); + return request({ + url: '/youlai-admin/api/v1/depts/table', + method: 'get', + params: queryParams + }); } /** * 部门下拉列表 */ export function listSelectDepartments(): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/depts/select', - method: 'get' - }); + return request({ + url: '/youlai-admin/api/v1/depts/select', + method: 'get' + }); } /** @@ -33,10 +33,10 @@ export function listSelectDepartments(): AxiosPromise { * @param id */ export function getDeptDetail(id: string): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/depts/' + id, - method: 'get' - }); + return request({ + url: '/youlai-admin/api/v1/depts/' + id, + method: 'get' + }); } /** @@ -45,11 +45,11 @@ export function getDeptDetail(id: string): AxiosPromise { * @param data */ export function addDept(data: DeptFormData) { - return request({ - url: '/youlai-admin/api/v1/depts', - method: 'post', - data: data - }); + return request({ + url: '/youlai-admin/api/v1/depts', + method: 'post', + data: data + }); } /** @@ -59,11 +59,11 @@ export function addDept(data: DeptFormData) { * @param data */ export function updateDept(id: string, data: DeptFormData) { - return request({ - url: '/youlai-admin/api/v1/depts/' + id, - method: 'put', - data: data - }); + return request({ + url: '/youlai-admin/api/v1/depts/' + id, + method: 'put', + data: data + }); } /** @@ -72,8 +72,8 @@ export function updateDept(id: string, data: DeptFormData) { * @param ids */ export function deleteDept(ids: string) { - return request({ - url: '/youlai-admin/api/v1/depts/' + ids, - method: 'delete' - }); + return request({ + url: '/youlai-admin/api/v1/depts/' + ids, + method: 'delete' + }); } diff --git a/src/api/system/dict.ts b/src/api/system/dict.ts index eb015a51..e0b639f5 100644 --- a/src/api/system/dict.ts +++ b/src/api/system/dict.ts @@ -1,11 +1,11 @@ import { - DictFormData, - DictItemFormData, - DictItemPageResult, - DictItemQueryParam, - DictPageResult, - DictQueryParam, - Option + DictFormData, + DictItemFormData, + DictItemPageResult, + DictItemQueryParam, + DictPageResult, + DictQueryParam, + Option } from '@/types'; import request from '@/utils/request'; import { AxiosPromise } from 'axios'; @@ -16,13 +16,13 @@ import { AxiosPromise } from 'axios'; * @param queryParams */ export function listDictPages( - queryParams: DictQueryParam + queryParams: DictQueryParam ): AxiosPromise { - return request({ - url: '/youlai-admin/api/v2/dict/page', - method: 'get', - params: queryParams - }); + return request({ + url: '/youlai-admin/api/v2/dict/page', + method: 'get', + params: queryParams + }); } /** @@ -31,10 +31,10 @@ export function listDictPages( * @param id */ export function getDictFormDetail(id: number): AxiosPromise { - return request({ - url: '/youlai-admin/api/v2/dict/' + id, - method: 'get' - }); + return request({ + url: '/youlai-admin/api/v2/dict/' + id, + method: 'get' + }); } /** @@ -43,11 +43,11 @@ export function getDictFormDetail(id: number): AxiosPromise { * @param data */ export function addDict(data: DictFormData) { - return request({ - url: '/youlai-admin/api/v2/dict', - method: 'post', - data: data - }); + return request({ + url: '/youlai-admin/api/v2/dict', + method: 'post', + data: data + }); } /** @@ -57,11 +57,11 @@ export function addDict(data: DictFormData) { * @param data */ export function updateDict(id: number, data: DictFormData) { - return request({ - url: '/youlai-admin/api/v2/dict/' + id, - method: 'put', - data: data - }); + return request({ + url: '/youlai-admin/api/v2/dict/' + id, + method: 'put', + data: data + }); } /** @@ -69,10 +69,10 @@ export function updateDict(id: number, data: DictFormData) { * @param ids 字典ID,多个以英文逗号(,)分割 */ export function deleteDict(ids: string) { - return request({ - url: '/youlai-admin/api/v2/dict/' + ids, - method: 'delete' - }); + return request({ + url: '/youlai-admin/api/v2/dict/' + ids, + method: 'delete' + }); } /** @@ -81,13 +81,13 @@ export function deleteDict(ids: string) { * @param queryParams */ export function listDictItemPages( - queryParams: DictItemQueryParam + queryParams: DictItemQueryParam ): AxiosPromise { - return request({ - url: '/youlai-admin/api/v2/dict/items/page', - method: 'get', - params: queryParams - }); + return request({ + url: '/youlai-admin/api/v2/dict/items/page', + method: 'get', + params: queryParams + }); } /** @@ -96,11 +96,11 @@ export function listDictItemPages( * @param dictCode */ export function listDictsByCode(dictCode: string): AxiosPromise { - return request({ - url: '/youlai-admin/api/v2/dict/items', - method: 'get', - params: { dictCode: dictCode } - }); + return request({ + url: '/youlai-admin/api/v2/dict/items', + method: 'get', + params: { dictCode: dictCode } + }); } /** @@ -109,10 +109,10 @@ export function listDictsByCode(dictCode: string): AxiosPromise { * @param id */ export function getDictItemDetail(id: number): AxiosPromise { - return request({ - url: '/youlai-admin/api/v2/dict/items/' + id, - method: 'get' - }); + return request({ + url: '/youlai-admin/api/v2/dict/items/' + id, + method: 'get' + }); } /** @@ -121,11 +121,11 @@ export function getDictItemDetail(id: number): AxiosPromise { * @param data */ export function addDictItem(data: any) { - return request({ - url: '/youlai-admin/api/v2/dict/items', - method: 'post', - data: data - }); + return request({ + url: '/youlai-admin/api/v2/dict/items', + method: 'post', + data: data + }); } /** @@ -135,11 +135,11 @@ export function addDictItem(data: any) { * @param data */ export function updateDictItem(id: number, data: any) { - return request({ - url: '/youlai-admin/api/v2/dict/items/' + id, - method: 'put', - data: data - }); + return request({ + url: '/youlai-admin/api/v2/dict/items/' + id, + method: 'put', + data: data + }); } /** @@ -147,8 +147,8 @@ export function updateDictItem(id: number, data: any) { * @param ids 字典项ID,多个以英文逗号(,)分割 */ export function deleteDictItem(ids: string) { - return request({ - url: '/youlai-admin/api/v2/dict/items/' + ids, - method: 'delete' - }); + return request({ + url: '/youlai-admin/api/v2/dict/items/' + ids, + method: 'delete' + }); } diff --git a/src/api/system/file.ts b/src/api/system/file.ts index 2769f1a3..1b7d14af 100644 --- a/src/api/system/file.ts +++ b/src/api/system/file.ts @@ -6,16 +6,16 @@ import request from '@/utils/request'; * @param file */ export function uploadFile(file: File) { - const formData = new FormData(); - formData.append('file', file); - return request({ - url: '/youlai-admin/api/v1/files', - method: 'post', - data: formData, - headers: { - 'Content-Type': 'multipart/form-data' - } - }); + const formData = new FormData(); + formData.append('file', file); + return request({ + url: '/youlai-admin/api/v1/files', + method: 'post', + data: formData, + headers: { + 'Content-Type': 'multipart/form-data' + } + }); } /** @@ -24,9 +24,9 @@ export function uploadFile(file: File) { * @param path */ export function deleteFile(path?: string) { - return request({ - url: '/youlai-admin/api/v1/files', - method: 'delete', - params: { path: path } - }); + return request({ + url: '/youlai-admin/api/v1/files', + method: 'delete', + params: { path: path } + }); } diff --git a/src/api/system/menu.ts b/src/api/system/menu.ts index 97671688..a068cb75 100644 --- a/src/api/system/menu.ts +++ b/src/api/system/menu.ts @@ -6,10 +6,10 @@ import { AxiosPromise } from 'axios'; * 获取路由列表 */ export function listRoutes() { - return request({ - url: '/youlai-admin/api/v1/menus/route', - method: 'get' - }); + return request({ + url: '/youlai-admin/api/v1/menus/route', + method: 'get' + }); } /** @@ -18,23 +18,23 @@ export function listRoutes() { * @param queryParams */ export function listTableMenus( - queryParams: MenuQueryParam + queryParams: MenuQueryParam ): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/menus/table', - method: 'get', - params: queryParams - }); + return request({ + url: '/youlai-admin/api/v1/menus/table', + method: 'get', + params: queryParams + }); } /** * 获取菜单下拉列表 */ export function listSelectMenus(): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/menus/select', - method: 'get' - }); + return request({ + url: '/youlai-admin/api/v1/menus/select', + method: 'get' + }); } /** @@ -42,10 +42,10 @@ export function listSelectMenus(): AxiosPromise { * @param id */ export function getMenuDetail(id: number): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/menus/' + id, - method: 'get' - }); + return request({ + url: '/youlai-admin/api/v1/menus/' + id, + method: 'get' + }); } /** @@ -54,11 +54,11 @@ export function getMenuDetail(id: number): AxiosPromise { * @param data */ export function addMenu(data: MenuFormData) { - return request({ - url: '/youlai-admin/api/v1/menus', - method: 'post', - data: data - }); + return request({ + url: '/youlai-admin/api/v1/menus', + method: 'post', + data: data + }); } /** @@ -68,11 +68,11 @@ export function addMenu(data: MenuFormData) { * @param data */ export function updateMenu(id: string, data: MenuFormData) { - return request({ - url: '/youlai-admin/api/v1/menus/' + id, - method: 'put', - data: data - }); + return request({ + url: '/youlai-admin/api/v1/menus/' + id, + method: 'put', + data: data + }); } /** @@ -81,8 +81,8 @@ export function updateMenu(id: string, data: MenuFormData) { * @param ids 菜单ID,多个以英文逗号(,)分割 */ export function deleteMenus(ids: string) { - return request({ - url: '/youlai-admin/api/v1/menus/' + ids, - method: 'delete' - }); + return request({ + url: '/youlai-admin/api/v1/menus/' + ids, + method: 'delete' + }); } diff --git a/src/api/system/perm.ts b/src/api/system/perm.ts index 6b2dc7e5..35b9393d 100644 --- a/src/api/system/perm.ts +++ b/src/api/system/perm.ts @@ -1,8 +1,8 @@ import { - PermFormData, - PermItem, - PermPageResult, - PermQueryParam + PermFormData, + PermItem, + PermPageResult, + PermQueryParam } from '@/types'; import request from '@/utils/request'; import { AxiosPromise } from 'axios'; @@ -13,13 +13,13 @@ import { AxiosPromise } from 'axios'; * @param queryParams */ export function listPermPages( - queryParams: PermQueryParam + queryParams: PermQueryParam ): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/permissions/page', - method: 'get', - params: queryParams - }); + return request({ + url: '/youlai-admin/api/v1/permissions/page', + method: 'get', + params: queryParams + }); } /** @@ -28,13 +28,13 @@ export function listPermPages( * @param queryParams */ export function listPerms( - queryParams: PermQueryParam + queryParams: PermQueryParam ): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/permissions', - method: 'get', - params: queryParams - }); + return request({ + url: '/youlai-admin/api/v1/permissions', + method: 'get', + params: queryParams + }); } /** @@ -43,10 +43,10 @@ export function listPerms( * @param id */ export function getPermFormDetail(id: number): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/permissions/' + id, - method: 'get' - }); + return request({ + url: '/youlai-admin/api/v1/permissions/' + id, + method: 'get' + }); } /** @@ -55,11 +55,11 @@ export function getPermFormDetail(id: number): AxiosPromise { * @param data */ export function addPerm(data: PermFormData) { - return request({ - url: '/youlai-admin/api/v1/permissions', - method: 'post', - data: data - }); + return request({ + url: '/youlai-admin/api/v1/permissions', + method: 'post', + data: data + }); } /** @@ -69,11 +69,11 @@ export function addPerm(data: PermFormData) { * @param data */ export function updatePerm(id: number, data: PermFormData) { - return request({ - url: '/youlai-admin/api/v1/permissions/' + id, - method: 'put', - data: data - }); + return request({ + url: '/youlai-admin/api/v1/permissions/' + id, + method: 'put', + data: data + }); } /** @@ -82,8 +82,8 @@ export function updatePerm(id: number, data: PermFormData) { * @param ids */ export function deletePerms(ids: string) { - return request({ - url: '/youlai-admin/api/v1/permissions/' + ids, - method: 'delete' - }); + return request({ + url: '/youlai-admin/api/v1/permissions/' + ids, + method: 'delete' + }); } diff --git a/src/api/system/role.ts b/src/api/system/role.ts index 2d37a56b..c78a0e85 100644 --- a/src/api/system/role.ts +++ b/src/api/system/role.ts @@ -1,8 +1,8 @@ import { - RoleFormData, - RoleItem, - RolePageResult, - RoleQueryParam + RoleFormData, + RoleItem, + RolePageResult, + RoleQueryParam } from '@/types'; import request from '@/utils/request'; import { AxiosPromise } from 'axios'; @@ -13,13 +13,13 @@ import { AxiosPromise } from 'axios'; * @param queryParams */ export function listRolePages( - queryParams?: RoleQueryParam + queryParams?: RoleQueryParam ): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/roles/page', - method: 'get', - params: queryParams - }); + return request({ + url: '/youlai-admin/api/v1/roles/page', + method: 'get', + params: queryParams + }); } /** @@ -28,13 +28,13 @@ export function listRolePages( * @param queryParams */ export function listRoles( - queryParams?: RoleQueryParam + queryParams?: RoleQueryParam ): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/roles', - method: 'get', - params: queryParams - }); + return request({ + url: '/youlai-admin/api/v1/roles', + method: 'get', + params: queryParams + }); } /** @@ -43,10 +43,10 @@ export function listRoles( * @param id */ export function getRoleFormDetail(id: number): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/roles/' + id, - method: 'get' - }); + return request({ + url: '/youlai-admin/api/v1/roles/' + id, + method: 'get' + }); } /** @@ -55,11 +55,11 @@ export function getRoleFormDetail(id: number): AxiosPromise { * @param data */ export function addRole(data: RoleFormData) { - return request({ - url: '/youlai-admin/api/v1/roles', - method: 'post', - data: data - }); + return request({ + url: '/youlai-admin/api/v1/roles', + method: 'post', + data: data + }); } /** @@ -69,11 +69,11 @@ export function addRole(data: RoleFormData) { * @param data */ export function updateRole(id: number, data: RoleFormData) { - return request({ - url: '/youlai-admin/api/v1/roles/' + id, - method: 'put', - data: data - }); + return request({ + url: '/youlai-admin/api/v1/roles/' + id, + method: 'put', + data: data + }); } /** @@ -82,10 +82,10 @@ export function updateRole(id: number, data: RoleFormData) { * @param ids */ export function deleteRoles(ids: string) { - return request({ - url: '/youlai-admin/api/v1/roles/' + ids, - method: 'delete' - }); + return request({ + url: '/youlai-admin/api/v1/roles/' + ids, + method: 'delete' + }); } /** @@ -94,10 +94,10 @@ export function deleteRoles(ids: string) { * @param roleId */ export function listRoleMenuIds(roleId: number): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/roles/' + roleId + '/menu_ids', - method: 'get' - }); + return request({ + url: '/youlai-admin/api/v1/roles/' + roleId + '/menu_ids', + method: 'get' + }); } /** @@ -107,11 +107,11 @@ export function listRoleMenuIds(roleId: number): AxiosPromise { * @param menuIds */ export function updateRoleMenu(roleId: number, menuIds: Array) { - return request({ - url: '/youlai-admin/api/v1/roles/' + roleId + '/menus', - method: 'put', - data: { menuIds: menuIds } - }); + return request({ + url: '/youlai-admin/api/v1/roles/' + roleId + '/menus', + method: 'put', + data: { menuIds: menuIds } + }); } /** @@ -120,11 +120,11 @@ export function updateRoleMenu(roleId: number, menuIds: Array) { * @param roleId */ export function listRolePerms(roleId: number, menuId: number) { - return request({ - url: '/youlai-admin/api/v1/roles/' + roleId + '/permissions', - method: 'get', - params: { menuId: menuId } - }); + return request({ + url: '/youlai-admin/api/v1/roles/' + roleId + '/permissions', + method: 'get', + params: { menuId: menuId } + }); } /** @@ -135,13 +135,13 @@ export function listRolePerms(roleId: number, menuId: number) { * @param permIds */ export function saveRolePerms( - roleId: number, - menuId: number, - permIds: Array + roleId: number, + menuId: number, + permIds: Array ) { - return request({ - url: '/youlai-admin/api/v1/roles/' + roleId + '/permissions', - method: 'put', - data: { menuId: menuId, permIds: permIds } - }); + return request({ + url: '/youlai-admin/api/v1/roles/' + roleId + '/permissions', + method: 'put', + data: { menuId: menuId, permIds: permIds } + }); } diff --git a/src/api/system/user.ts b/src/api/system/user.ts index 72354f62..b019de5f 100644 --- a/src/api/system/user.ts +++ b/src/api/system/user.ts @@ -1,20 +1,20 @@ import request from '@/utils/request'; import { AxiosPromise } from 'axios'; import { - UserFormData, - UserInfo, - UserPageResult, - UserQueryParam + UserFormData, + UserInfo, + UserPageResult, + UserQueryParam } from '@/types'; /** * 登录成功后获取用户信息(昵称、头像、权限集合和角色集合) */ export function getUserInfo(): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/users/me', - method: 'get' - }); + return request({ + url: '/youlai-admin/api/v1/users/me', + method: 'get' + }); } /** @@ -23,13 +23,13 @@ export function getUserInfo(): AxiosPromise { * @param queryParams */ export function listUsersPage( - queryParams: UserQueryParam + queryParams: UserQueryParam ): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/users/page', - method: 'get', - params: queryParams - }); + return request({ + url: '/youlai-admin/api/v1/users/page', + method: 'get', + params: queryParams + }); } /** @@ -38,10 +38,10 @@ export function listUsersPage( * @param userId */ export function getUserDetail(userId: number): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/users/' + userId, - method: 'get' - }); + return request({ + url: '/youlai-admin/api/v1/users/' + userId, + method: 'get' + }); } /** @@ -50,11 +50,11 @@ export function getUserDetail(userId: number): AxiosPromise { * @param data */ export function addUser(data: any) { - return request({ - url: '/youlai-admin/api/v1/users', - method: 'post', - data: data - }); + return request({ + url: '/youlai-admin/api/v1/users', + method: 'post', + data: data + }); } /** @@ -64,11 +64,11 @@ export function addUser(data: any) { * @param data */ export function updateUser(id: number, data: UserFormData) { - return request({ - url: '/youlai-admin/api/v1/users/' + id, - method: 'put', - data: data - }); + return request({ + url: '/youlai-admin/api/v1/users/' + id, + method: 'put', + data: data + }); } /** @@ -78,11 +78,11 @@ export function updateUser(id: number, data: UserFormData) { * @param data */ export function updateUserPart(id: number, data: any) { - return request({ - url: '/youlai-admin/api/v1/users/' + id, - method: 'patch', - data: data - }); + return request({ + url: '/youlai-admin/api/v1/users/' + id, + method: 'patch', + data: data + }); } /** @@ -91,10 +91,10 @@ export function updateUserPart(id: number, data: any) { * @param ids */ export function deleteUsers(ids: string) { - return request({ - url: '/youlai-admin/api/v1/users/' + ids, - method: 'delete' - }); + return request({ + url: '/youlai-admin/api/v1/users/' + ids, + method: 'delete' + }); } /** @@ -103,11 +103,11 @@ export function deleteUsers(ids: string) { * @returns */ export function downloadTemplate() { - return request({ - url: '/youlai-admin/api/v1/users/template', - method: 'get', - responseType: 'arraybuffer' - }); + return request({ + url: '/youlai-admin/api/v1/users/template', + method: 'get', + responseType: 'arraybuffer' + }); } /** @@ -117,12 +117,12 @@ export function downloadTemplate() { * @returns */ export function exportUser(queryParams: UserQueryParam) { - return request({ - url: '/youlai-admin/api/v1/users/_export', - method: 'get', - params: queryParams, - responseType: 'arraybuffer' - }); + return request({ + url: '/youlai-admin/api/v1/users/_export', + method: 'get', + params: queryParams, + responseType: 'arraybuffer' + }); } /** @@ -131,16 +131,16 @@ export function exportUser(queryParams: UserQueryParam) { * @param file */ export function importUser(deptId: number, roleIds: string, file: File) { - const formData = new FormData(); - formData.append('file', file); - formData.append('deptId', deptId.toString()); - formData.append('roleIds', roleIds); - return request({ - url: '/youlai-admin/api/v1/users/_import', - method: 'post', - data: formData, - headers: { - 'Content-Type': 'multipart/form-data' - } - }); + const formData = new FormData(); + formData.append('file', file); + formData.append('deptId', deptId.toString()); + formData.append('roleIds', roleIds); + return request({ + url: '/youlai-admin/api/v1/users/_import', + method: 'post', + data: formData, + headers: { + 'Content-Type': 'multipart/form-data' + } + }); } diff --git a/src/api/ums/member.ts b/src/api/ums/member.ts index c3940f4b..d54e6bf0 100644 --- a/src/api/ums/member.ts +++ b/src/api/ums/member.ts @@ -8,13 +8,13 @@ import { AxiosPromise } from 'axios'; * @param queryParams */ export function listMemebersPage( - queryParams: MemberQueryParam + queryParams: MemberQueryParam ): AxiosPromise { - return request({ - url: '/mall-ums/api/v1/members', - method: 'get', - params: queryParams - }); + return request({ + url: '/mall-ums/api/v1/members', + method: 'get', + params: queryParams + }); } /** @@ -23,10 +23,10 @@ export function listMemebersPage( * @param id */ export function getMemberDetail(id: number) { - return request({ - url: '/mall-ums/api/v1/members/' + id, - method: 'get' - }); + return request({ + url: '/mall-ums/api/v1/members/' + id, + method: 'get' + }); } /** @@ -35,11 +35,11 @@ export function getMemberDetail(id: number) { * @param data */ export function addMember(data: object) { - return request({ - url: '/mall-ums/api/v1/members', - method: 'post', - data: data - }); + return request({ + url: '/mall-ums/api/v1/members', + method: 'post', + data: data + }); } /** @@ -49,9 +49,9 @@ export function addMember(data: object) { * @param data */ export function updateMember(id: number, data: object) { - return request({ - url: '/mall-ums/api/v1/members/' + id, - method: 'put', - data: data - }); + return request({ + url: '/mall-ums/api/v1/members/' + id, + method: 'put', + data: data + }); } diff --git a/src/components.d.ts b/src/components.d.ts index 758a7c96..94e8b829 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -2,8 +2,8 @@ import Pagination from '@/components/Pagination/index.vue'; declare module '@vue/runtime-core' { - export interface GlobalComponents { - Pagination: typeof Pagination; - } + export interface GlobalComponents { + Pagination: typeof Pagination; + } } export {}; diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue index 5676b400..0b0b05f1 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -1,20 +1,20 @@ diff --git a/src/components/GithubCorner/index.vue b/src/components/GithubCorner/index.vue index 007dae1d..c9a4b324 100644 --- a/src/components/GithubCorner/index.vue +++ b/src/components/GithubCorner/index.vue @@ -1,59 +1,59 @@ diff --git a/src/components/Hamburger/index.vue b/src/components/Hamburger/index.vue index 59b96d80..8502f533 100644 --- a/src/components/Hamburger/index.vue +++ b/src/components/Hamburger/index.vue @@ -1,46 +1,46 @@ diff --git a/src/components/IconSelect/index.vue b/src/components/IconSelect/index.vue index 386404bd..9670dcfb 100644 --- a/src/components/IconSelect/index.vue +++ b/src/components/IconSelect/index.vue @@ -1,29 +1,29 @@ diff --git a/src/components/LangSelect/index.vue b/src/components/LangSelect/index.vue index e97eafcb..dd795e3c 100644 --- a/src/components/LangSelect/index.vue +++ b/src/components/LangSelect/index.vue @@ -1,19 +1,19 @@ diff --git a/src/components/Pagination/index.vue b/src/components/Pagination/index.vue index b65b75cb..62ca76a5 100644 --- a/src/components/Pagination/index.vue +++ b/src/components/Pagination/index.vue @@ -1,16 +1,16 @@ diff --git a/src/components/RightPanel/index.vue b/src/components/RightPanel/index.vue index 83a807d0..621a0b97 100644 --- a/src/components/RightPanel/index.vue +++ b/src/components/RightPanel/index.vue @@ -1,26 +1,26 @@ diff --git a/src/components/Screenfull/index.vue b/src/components/Screenfull/index.vue index f2e999a2..f0ed7d6c 100644 --- a/src/components/Screenfull/index.vue +++ b/src/components/Screenfull/index.vue @@ -1,10 +1,10 @@ diff --git a/src/components/SvgIcon/index.vue b/src/components/SvgIcon/index.vue index 1825a704..1f23cd6a 100644 --- a/src/components/SvgIcon/index.vue +++ b/src/components/SvgIcon/index.vue @@ -1,25 +1,25 @@ diff --git a/src/components/Upload/SingleUpload.vue b/src/components/Upload/SingleUpload.vue index 8a43f547..4143a3e2 100644 --- a/src/components/Upload/SingleUpload.vue +++ b/src/components/Upload/SingleUpload.vue @@ -1,67 +1,67 @@ diff --git a/src/components/WangEditor/index.vue b/src/components/WangEditor/index.vue index 9db17741..a6a1f229 100644 --- a/src/components/WangEditor/index.vue +++ b/src/components/WangEditor/index.vue @@ -1,22 +1,22 @@ diff --git a/src/directive/permission/index.ts b/src/directive/permission/index.ts index 211f9c35..40fd3378 100644 --- a/src/directive/permission/index.ts +++ b/src/directive/permission/index.ts @@ -5,52 +5,52 @@ import { Directive, DirectiveBinding } from 'vue'; * 按钮权限校验 */ export const hasPerm: Directive = { - mounted(el: HTMLElement, binding: DirectiveBinding) { - // 「超级管理员」拥有所有的按钮权限 - const { user } = useStore(); - const roles = user.roles; - if (roles.includes('ROOT')) { - return true; - } - // 「其他角色」按钮权限校验 - const { value } = binding; - if (value) { - const requiredPerms = value; // DOM绑定需要的按钮权限标识 + mounted(el: HTMLElement, binding: DirectiveBinding) { + // 「超级管理员」拥有所有的按钮权限 + const { user } = useStore(); + const roles = user.roles; + if (roles.includes('ROOT')) { + return true; + } + // 「其他角色」按钮权限校验 + const { value } = binding; + if (value) { + const requiredPerms = value; // DOM绑定需要的按钮权限标识 - const hasPerm = user.perms?.some(perm => { - return requiredPerms.includes(perm); - }); + const hasPerm = user.perms?.some(perm => { + return requiredPerms.includes(perm); + }); - if (!hasPerm) { - el.parentNode && el.parentNode.removeChild(el); - } - } else { - throw new Error( - "need perms! Like v-has-perm=\"['sys:user:add','sys:user:edit']\"" - ); - } - } + if (!hasPerm) { + el.parentNode && el.parentNode.removeChild(el); + } + } else { + throw new Error( + "need perms! Like v-has-perm=\"['sys:user:add','sys:user:edit']\"" + ); + } + } }; /** * 角色权限校验 */ export const hasRole: Directive = { - mounted(el: HTMLElement, binding: DirectiveBinding) { - const { value } = binding; + mounted(el: HTMLElement, binding: DirectiveBinding) { + const { value } = binding; - if (value) { - const requiredRoles = value; // DOM绑定需要的角色编码 - const { user } = useStore(); - const hasRole = user.roles.some(perm => { - return requiredRoles.includes(perm); - }); + if (value) { + const requiredRoles = value; // DOM绑定需要的角色编码 + const { user } = useStore(); + const hasRole = user.roles.some(perm => { + return requiredRoles.includes(perm); + }); - if (!hasRole) { - el.parentNode && el.parentNode.removeChild(el); - } - } else { - throw new Error("need roles! Like v-has-role=\"['admin','test']\""); - } - } + if (!hasRole) { + el.parentNode && el.parentNode.removeChild(el); + } + } else { + throw new Error("need roles! Like v-has-role=\"['admin','test']\""); + } + } }; diff --git a/src/env.d.ts b/src/env.d.ts index b4958e04..bcddf3e8 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -1,19 +1,19 @@ /// declare module '*.vue' { - import { DefineComponent } from 'vue'; - // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types - const component: DefineComponent<{}, {}, any>; - export default component; + import { DefineComponent } from 'vue'; + // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types + const component: DefineComponent<{}, {}, any>; + export default component; } // 环境变量 TypeScript的智能提示 interface ImportMetaEnv { - VITE_APP_TITLE: string; - VITE_APP_PORT: string; - VITE_APP_BASE_API: string; + VITE_APP_TITLE: string; + VITE_APP_PORT: string; + VITE_APP_BASE_API: string; } interface ImportMeta { - readonly env: ImportMetaEnv; + readonly env: ImportMetaEnv; } diff --git a/src/lang/en.ts b/src/lang/en.ts index 5f4f8a24..71b7e60d 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -1,24 +1,24 @@ export default { - // 路由国际化 - route: { - dashboard: 'Dashboard', - document: 'Document' - }, - // 登录页面国际化 - login: { - title: 'vue3-element-admin', - username: 'Username', - password: 'Password', - login: 'Login', - code: 'Verification Code', - copyright: '', - icp: '' - }, - // 导航栏国际化 - navbar: { - dashboard: 'Dashboard', - logout: 'Logout', - document: 'Document', - gitee: 'Gitee' - } + // 路由国际化 + route: { + dashboard: 'Dashboard', + document: 'Document' + }, + // 登录页面国际化 + login: { + title: 'vue3-element-admin', + username: 'Username', + password: 'Password', + login: 'Login', + code: 'Verification Code', + copyright: '', + icp: '' + }, + // 导航栏国际化 + navbar: { + dashboard: 'Dashboard', + logout: 'Logout', + document: 'Document', + gitee: 'Gitee' + } }; diff --git a/src/lang/index.ts b/src/lang/index.ts index fcac2c92..c5270750 100644 --- a/src/lang/index.ts +++ b/src/lang/index.ts @@ -7,12 +7,12 @@ import enLocale from './en'; import zhCnLocale from './zh-cn'; const messages = { - 'zh-cn': { - ...zhCnLocale - }, - en: { - ...enLocale - } + 'zh-cn': { + ...zhCnLocale + }, + en: { + ...enLocale + } }; /** @@ -21,25 +21,25 @@ const messages = { * @returns zh-cn|en ... */ export const getLanguage = () => { - // 本地缓存获取 - let language = localStorage.get('language'); - if (language) { - return language; - } - // 浏览器使用语言 - language = navigator.language.toLowerCase(); - const locales = Object.keys(messages); - for (const locale of locales) { - if (language.indexOf(locale) > -1) { - return locale; - } - } - return 'zh-cn'; + // 本地缓存获取 + let language = localStorage.get('language'); + if (language) { + return language; + } + // 浏览器使用语言 + language = navigator.language.toLowerCase(); + const locales = Object.keys(messages); + for (const locale of locales) { + if (language.indexOf(locale) > -1) { + return locale; + } + } + return 'zh-cn'; }; const i18n = createI18n({ - locale: getLanguage(), - messages: messages + locale: getLanguage(), + messages: messages }); export default i18n; diff --git a/src/lang/zh-cn.ts b/src/lang/zh-cn.ts index f84da521..01bf8a97 100644 --- a/src/lang/zh-cn.ts +++ b/src/lang/zh-cn.ts @@ -1,23 +1,23 @@ export default { - // 路由国际化 - route: { - dashboard: '首页', - document: '项目文档' - }, - // 登录页面国际化 - login: { - title: 'vue3-element-admin', - username: '用户名', - password: '密码', - login: '登 录', - code: '请输入验证码', - copyright: '', - icp: '' - }, - navbar: { - dashboard: '首页', - logout: '注销', - document: '项目文档', - gitee: '码云' - } + // 路由国际化 + route: { + dashboard: '首页', + document: '项目文档' + }, + // 登录页面国际化 + login: { + title: 'vue3-element-admin', + username: '用户名', + password: '密码', + login: '登 录', + code: '请输入验证码', + copyright: '', + icp: '' + }, + navbar: { + dashboard: '首页', + logout: '注销', + document: '项目文档', + gitee: '码云' + } }; diff --git a/src/layout/components/AppMain.vue b/src/layout/components/AppMain.vue index ef45a2dc..7084cd14 100644 --- a/src/layout/components/AppMain.vue +++ b/src/layout/components/AppMain.vue @@ -1,13 +1,13 @@ diff --git a/src/layout/components/Settings/index.vue b/src/layout/components/Settings/index.vue index 6eea1dad..c5baf705 100644 --- a/src/layout/components/Settings/index.vue +++ b/src/layout/components/Settings/index.vue @@ -1,28 +1,28 @@ diff --git a/src/layout/components/Sidebar/Link.vue b/src/layout/components/Sidebar/Link.vue index 108fc26a..babd008b 100644 --- a/src/layout/components/Sidebar/Link.vue +++ b/src/layout/components/Sidebar/Link.vue @@ -1,10 +1,10 @@ diff --git a/src/layout/components/Sidebar/Logo.vue b/src/layout/components/Sidebar/Logo.vue index dfab5090..4422f926 100644 --- a/src/layout/components/Sidebar/Logo.vue +++ b/src/layout/components/Sidebar/Logo.vue @@ -1,35 +1,35 @@ diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue index 586e362c..1bfc829f 100644 --- a/src/layout/components/Sidebar/index.vue +++ b/src/layout/components/Sidebar/index.vue @@ -1,27 +1,27 @@ diff --git a/src/layout/components/TagsView/ScrollPane.vue b/src/layout/components/TagsView/ScrollPane.vue index a37def4e..b13605d9 100644 --- a/src/layout/components/TagsView/ScrollPane.vue +++ b/src/layout/components/TagsView/ScrollPane.vue @@ -1,21 +1,21 @@ diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index 15d4f50e..eb6ed0c1 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -1,71 +1,71 @@ diff --git a/src/layout/index.vue b/src/layout/index.vue index 77932127..bf310c08 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -1,22 +1,22 @@ @@ -65,41 +65,41 @@ function handleClickOutside() { @import '@/styles/variables.module.scss'; .app-wrapper { - @include clearfix; - position: relative; - height: 100%; - width: 100%; + @include clearfix; + position: relative; + height: 100%; + width: 100%; - &.mobile.openSidebar { - position: fixed; - top: 0; - } + &.mobile.openSidebar { + position: fixed; + top: 0; + } } .drawer-bg { - background: #000; - opacity: 0.3; - width: 100%; - top: 0; - height: 100%; - position: absolute; - z-index: 999; + background: #000; + opacity: 0.3; + width: 100%; + top: 0; + height: 100%; + position: absolute; + z-index: 999; } .fixed-header { - position: fixed; - top: 0; - right: 0; - z-index: 9; - width: calc(100% - #{$sideBarWidth}); - transition: width 0.28s; + position: fixed; + top: 0; + right: 0; + z-index: 9; + width: calc(100% - #{$sideBarWidth}); + transition: width 0.28s; } .hideSidebar .fixed-header { - width: calc(100% - 54px); + width: calc(100% - 54px); } .mobile .fixed-header { - width: 100%; + width: 100%; } diff --git a/src/main.ts b/src/main.ts index eece50cd..a288cb9b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -27,7 +27,7 @@ const app = createApp(App); import * as directive from '@/directive'; Object.keys(directive).forEach(key => { - app.directive(key, (directive as { [key: string]: Directive })[key]); + app.directive(key, (directive as { [key: string]: Directive })[key]); }); // 全局方法 @@ -35,9 +35,9 @@ app.config.globalProperties.$listDictsByCode = listDictsByCode; // 注册全局组件 app - .component('Pagination', Pagination) - .use(createPinia()) - .use(router) - .use(ElementPlus) - .use(i18n) - .mount('#app'); + .component('Pagination', Pagination) + .use(createPinia()) + .use(router) + .use(ElementPlus) + .use(i18n) + .mount('#app'); diff --git a/src/permission.ts b/src/permission.ts index 194ef8e9..0d8dd192 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -9,47 +9,47 @@ NProgress.configure({ showSpinner: false }); // 进度环显示/隐藏 const whiteList = ['/login', '/auth-redirect']; router.beforeEach(async (to, form, next) => { - NProgress.start(); - const { user, permission } = useStore(); - const hasToken = user.token; - if (hasToken) { - // 登录成功,跳转到首页 - if (to.path === '/login') { - next({ path: '/' }); - NProgress.done(); - } else { - const hasGetUserInfo = user.roles.length > 0; - if (hasGetUserInfo) { - next(); - } else { - try { - await user.getUserInfo(); - const roles = user.roles; - const accessRoutes: any = await permission.generateRoutes(roles); - accessRoutes.forEach((route: any) => { - router.addRoute(route); - }); - next({ ...to, replace: true }); - } catch (error) { - // 移除 token 并跳转登录页 - await user.resetToken(); - ElMessage.error((error as any) || 'Has Error'); - next(`/login?redirect=${to.path}`); - NProgress.done(); - } - } - } - } else { - // 未登录可以访问白名单页面(登录页面) - if (whiteList.indexOf(to.path) !== -1) { - next(); - } else { - next(`/login?redirect=${to.path}`); - NProgress.done(); - } - } + NProgress.start(); + const { user, permission } = useStore(); + const hasToken = user.token; + if (hasToken) { + // 登录成功,跳转到首页 + if (to.path === '/login') { + next({ path: '/' }); + NProgress.done(); + } else { + const hasGetUserInfo = user.roles.length > 0; + if (hasGetUserInfo) { + next(); + } else { + try { + await user.getUserInfo(); + const roles = user.roles; + const accessRoutes: any = await permission.generateRoutes(roles); + accessRoutes.forEach((route: any) => { + router.addRoute(route); + }); + next({ ...to, replace: true }); + } catch (error) { + // 移除 token 并跳转登录页 + await user.resetToken(); + ElMessage.error((error as any) || 'Has Error'); + next(`/login?redirect=${to.path}`); + NProgress.done(); + } + } + } + } else { + // 未登录可以访问白名单页面(登录页面) + if (whiteList.indexOf(to.path) !== -1) { + next(); + } else { + next(`/login?redirect=${to.path}`); + NProgress.done(); + } + } }); router.afterEach(() => { - NProgress.done(); + NProgress.done(); }); diff --git a/src/router/index.ts b/src/router/index.ts index abbdfa04..33c539ec 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -6,48 +6,48 @@ export const Layout = () => import('@/layout/index.vue'); // 参数说明: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html // 静态路由 export const constantRoutes: Array = [ - { - path: '/redirect', - component: Layout, - meta: { hidden: true }, - children: [ - { - path: '/redirect/:path(.*)', - component: () => import('@/views/redirect/index.vue') - } - ] - }, - { - path: '/login', - component: () => import('@/views/login/index.vue'), - meta: { hidden: true } - }, - { - path: '/404', - component: () => import('@/views/error-page/404.vue'), - meta: { hidden: true } - }, - { - path: '/401', - component: () => import('@/views/error-page/401.vue'), - meta: { hidden: true } - }, - { - path: '/', - component: Layout, - redirect: '/dashboard', - children: [ - { - path: 'dashboard', - component: () => import('@/views/dashboard/index.vue'), - name: 'Dashboard', - meta: { title: 'dashboard', icon: 'homepage', affix: true } - } - ] - } + { + path: '/redirect', + component: Layout, + meta: { hidden: true }, + children: [ + { + path: '/redirect/:path(.*)', + component: () => import('@/views/redirect/index.vue') + } + ] + }, + { + path: '/login', + component: () => import('@/views/login/index.vue'), + meta: { hidden: true } + }, + { + path: '/404', + component: () => import('@/views/error-page/404.vue'), + meta: { hidden: true } + }, + { + path: '/401', + component: () => import('@/views/error-page/401.vue'), + meta: { hidden: true } + }, + { + path: '/', + component: Layout, + redirect: '/dashboard', + children: [ + { + path: 'dashboard', + component: () => import('@/views/dashboard/index.vue'), + name: 'Dashboard', + meta: { title: 'dashboard', icon: 'homepage', affix: true } + } + ] + } - // 外部链接 - /*{ + // 外部链接 + /*{ path: '/external-link', component: Layout, children: [ @@ -57,8 +57,8 @@ export const constantRoutes: Array = [ } ] }*/ - // 多级嵌套路由 - /* { + // 多级嵌套路由 + /* { path: '/nested', component: Layout, redirect: '/nested/level1/level2', @@ -101,21 +101,21 @@ export const constantRoutes: Array = [ // 创建路由 const router = createRouter({ - history: createWebHashHistory(), - routes: constantRoutes as RouteRecordRaw[], - // 刷新时,滚动条位置还原 - scrollBehavior: () => ({ left: 0, top: 0 }) + history: createWebHashHistory(), + routes: constantRoutes as RouteRecordRaw[], + // 刷新时,滚动条位置还原 + scrollBehavior: () => ({ left: 0, top: 0 }) }); // 重置路由 export function resetRouter() { - const { permission } = useStore(); - permission.routes.forEach(route => { - const name = route.name; - if (name && router.hasRoute(name)) { - router.removeRoute(name); - } - }); + const { permission } = useStore(); + permission.routes.forEach(route => { + const name = route.name; + if (name && router.hasRoute(name)) { + router.removeRoute(name); + } + }); } export default router; diff --git a/src/settings.ts b/src/settings.ts index 3df78d86..c59bd08a 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -1,20 +1,20 @@ interface DefaultSettings { - title: string; - showSettings: boolean; - tagsView: boolean; - fixedHeader: boolean; - sidebarLogo: boolean; - errorLog: string; + title: string; + showSettings: boolean; + tagsView: boolean; + fixedHeader: boolean; + sidebarLogo: boolean; + errorLog: string; } const defaultSettings: DefaultSettings = { - title: 'vue3-element-admin', - showSettings: true, - tagsView: true, - fixedHeader: false, - // 是否显示Logo - sidebarLogo: true, - errorLog: 'production' + title: 'vue3-element-admin', + showSettings: true, + tagsView: true, + fixedHeader: false, + // 是否显示Logo + sidebarLogo: true, + errorLog: 'production' }; export default defaultSettings; diff --git a/src/store/index.ts b/src/store/index.ts index 026df6bd..57b9ecfb 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -5,11 +5,11 @@ import useSettingStore from './modules/settings'; import useTagsViewStore from './modules/tagsView'; const useStore = () => ({ - user: useUserStore(), - app: useAppStore(), - permission: usePermissionStore(), - setting: useSettingStore(), - tagsView: useTagsViewStore() + user: useUserStore(), + app: useAppStore(), + permission: usePermissionStore(), + setting: useSettingStore(), + tagsView: useTagsViewStore() }); export default useStore; diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts index 0b0a4cf1..09832345 100644 --- a/src/store/modules/app.ts +++ b/src/store/modules/app.ts @@ -4,45 +4,45 @@ import { defineStore } from 'pinia'; import { getLanguage } from '@/lang/index'; const useAppStore = defineStore({ - id: 'app', - state: (): AppState => ({ - device: 'desktop', - sidebar: { - opened: localStorage.get('sidebarStatus') - ? !!+localStorage.get('sidebarStatus') - : true, - withoutAnimation: false - }, - language: getLanguage(), - size: localStorage.get('size') || 'default' - }), - actions: { - toggleSidebar() { - this.sidebar.opened = !this.sidebar.opened; - this.sidebar.withoutAnimation = false; - if (this.sidebar.opened) { - localStorage.set('sidebarStatus', 1); - } else { - localStorage.set('sidebarStatus', 0); - } - }, - closeSideBar(withoutAnimation: any) { - localStorage.set('sidebarStatus', 0); - this.sidebar.opened = false; - this.sidebar.withoutAnimation = withoutAnimation; - }, - toggleDevice(device: string) { - this.device = device; - }, - setSize(size: string) { - this.size = size; - localStorage.set('size', size); - }, - setLanguage(language: string) { - this.language = language; - localStorage.set('language', language); - } - } + id: 'app', + state: (): AppState => ({ + device: 'desktop', + sidebar: { + opened: localStorage.get('sidebarStatus') + ? !!+localStorage.get('sidebarStatus') + : true, + withoutAnimation: false + }, + language: getLanguage(), + size: localStorage.get('size') || 'default' + }), + actions: { + toggleSidebar() { + this.sidebar.opened = !this.sidebar.opened; + this.sidebar.withoutAnimation = false; + if (this.sidebar.opened) { + localStorage.set('sidebarStatus', 1); + } else { + localStorage.set('sidebarStatus', 0); + } + }, + closeSideBar(withoutAnimation: any) { + localStorage.set('sidebarStatus', 0); + this.sidebar.opened = false; + this.sidebar.withoutAnimation = withoutAnimation; + }, + toggleDevice(device: string) { + this.device = device; + }, + setSize(size: string) { + this.size = size; + localStorage.set('size', size); + }, + setLanguage(language: string) { + this.language = language; + localStorage.set('language', language); + } + } }); export default useAppStore; diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index b02103f5..98531af9 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -8,73 +8,73 @@ const modules = import.meta.glob('../../views/**/**.vue'); export const Layout = () => import('@/layout/index.vue'); const hasPermission = (roles: string[], route: RouteRecordRaw) => { - if (route.meta && route.meta.roles) { - if (roles.includes('ROOT')) { - return true; - } - return roles.some(role => { - if (route.meta?.roles !== undefined) { - return (route.meta.roles as string[]).includes(role); - } - }); - } - return false; + if (route.meta && route.meta.roles) { + if (roles.includes('ROOT')) { + return true; + } + return roles.some(role => { + if (route.meta?.roles !== undefined) { + return (route.meta.roles as string[]).includes(role); + } + }); + } + return false; }; export const filterAsyncRoutes = ( - routes: RouteRecordRaw[], - roles: string[] + routes: RouteRecordRaw[], + roles: string[] ) => { - const res: RouteRecordRaw[] = []; - routes.forEach(route => { - const tmp = { ...route } as any; - if (hasPermission(roles, tmp)) { - if (tmp.component == 'Layout') { - tmp.component = Layout; - } else { - const component = modules[`../../views/${tmp.component}.vue`] as any; - if (component) { - tmp.component = modules[`../../views/${tmp.component}.vue`]; - } else { - tmp.component = modules[`../../views/error-page/404.vue`]; - } - } - res.push(tmp); + const res: RouteRecordRaw[] = []; + routes.forEach(route => { + const tmp = { ...route } as any; + if (hasPermission(roles, tmp)) { + if (tmp.component == 'Layout') { + tmp.component = Layout; + } else { + const component = modules[`../../views/${tmp.component}.vue`] as any; + if (component) { + tmp.component = modules[`../../views/${tmp.component}.vue`]; + } else { + tmp.component = modules[`../../views/error-page/404.vue`]; + } + } + res.push(tmp); - if (tmp.children) { - tmp.children = filterAsyncRoutes(tmp.children, roles); - } - } - }); - return res; + if (tmp.children) { + tmp.children = filterAsyncRoutes(tmp.children, roles); + } + } + }); + return res; }; const usePermissionStore = defineStore({ - id: 'permission', - state: (): PermissionState => ({ - routes: [], - addRoutes: [] - }), - actions: { - setRoutes(routes: RouteRecordRaw[]) { - this.addRoutes = routes; - this.routes = constantRoutes.concat(routes); - }, - generateRoutes(roles: string[]) { - return new Promise((resolve, reject) => { - listRoutes() - .then(response => { - const asyncRoutes = response.data; - const accessedRoutes = filterAsyncRoutes(asyncRoutes, roles); - this.setRoutes(accessedRoutes); - resolve(accessedRoutes); - }) - .catch(error => { - reject(error); - }); - }); - } - } + id: 'permission', + state: (): PermissionState => ({ + routes: [], + addRoutes: [] + }), + actions: { + setRoutes(routes: RouteRecordRaw[]) { + this.addRoutes = routes; + this.routes = constantRoutes.concat(routes); + }, + generateRoutes(roles: string[]) { + return new Promise((resolve, reject) => { + listRoutes() + .then(response => { + const asyncRoutes = response.data; + const accessedRoutes = filterAsyncRoutes(asyncRoutes, roles); + this.setRoutes(accessedRoutes); + resolve(accessedRoutes); + }) + .catch(error => { + reject(error); + }); + }); + } + } }); export default usePermissionStore; diff --git a/src/store/modules/settings.ts b/src/store/modules/settings.ts index d22798f5..31e9a60e 100644 --- a/src/store/modules/settings.ts +++ b/src/store/modules/settings.ts @@ -7,44 +7,44 @@ const { showSettings, tagsView, fixedHeader, sidebarLogo } = defaultSettings; const el = document.documentElement; export const useSettingStore = defineStore({ - id: 'setting', - state: (): SettingState => ({ - theme: - localStorage.get('theme') || - getComputedStyle(el).getPropertyValue(`--el-color-primary`), - showSettings: showSettings, - tagsView: - localStorage.get('tagsView') != null - ? localStorage.get('tagsView') - : tagsView, - fixedHeader: fixedHeader, - sidebarLogo: sidebarLogo - }), - actions: { - async changeSetting(payload: { key: string; value: any }) { - const { key, value } = payload; - switch (key) { - case 'theme': - this.theme = value; - break; - case 'showSettings': - this.showSettings = value; - break; - case 'fixedHeader': - this.fixedHeader = value; - break; - case 'tagsView': - this.tagsView = value; - localStorage.set('tagsView', value); - break; - case 'sidebarLogo': - this.sidebarLogo = value; - break; - default: - break; - } - } - } + id: 'setting', + state: (): SettingState => ({ + theme: + localStorage.get('theme') || + getComputedStyle(el).getPropertyValue(`--el-color-primary`), + showSettings: showSettings, + tagsView: + localStorage.get('tagsView') != null + ? localStorage.get('tagsView') + : tagsView, + fixedHeader: fixedHeader, + sidebarLogo: sidebarLogo + }), + actions: { + async changeSetting(payload: { key: string; value: any }) { + const { key, value } = payload; + switch (key) { + case 'theme': + this.theme = value; + break; + case 'showSettings': + this.showSettings = value; + break; + case 'fixedHeader': + this.fixedHeader = value; + break; + case 'tagsView': + this.tagsView = value; + localStorage.set('tagsView', value); + break; + case 'sidebarLogo': + this.sidebarLogo = value; + break; + default: + break; + } + } + } }); export default useSettingStore; diff --git a/src/store/modules/tagsView.ts b/src/store/modules/tagsView.ts index d08d5887..76624558 100644 --- a/src/store/modules/tagsView.ts +++ b/src/store/modules/tagsView.ts @@ -2,174 +2,174 @@ import { defineStore } from 'pinia'; import { TagsViewState } from '@/types'; const useTagsViewStore = defineStore({ - id: 'tagsView', - state: (): TagsViewState => ({ - visitedViews: [], - cachedViews: [] - }), - actions: { - addVisitedView(view: any) { - if (this.visitedViews.some(v => v.path === view.path)) return; - this.visitedViews.push( - Object.assign({}, view, { - title: view.meta?.title || 'no-name' - }) - ); - }, - addCachedView(view: any) { - if (this.cachedViews.includes(view.name)) return; - if (!view.meta.noCache) { - this.cachedViews.push(view.name); - } - }, + id: 'tagsView', + state: (): TagsViewState => ({ + visitedViews: [], + cachedViews: [] + }), + actions: { + addVisitedView(view: any) { + if (this.visitedViews.some(v => v.path === view.path)) return; + this.visitedViews.push( + Object.assign({}, view, { + title: view.meta?.title || 'no-name' + }) + ); + }, + addCachedView(view: any) { + if (this.cachedViews.includes(view.name)) return; + if (!view.meta.noCache) { + this.cachedViews.push(view.name); + } + }, - delVisitedView(view: any) { - return new Promise(resolve => { - for (const [i, v] of this.visitedViews.entries()) { - if (v.path === view.path) { - this.visitedViews.splice(i, 1); - break; - } - } - resolve([...this.visitedViews]); - }); - }, - delCachedView(view: any) { - return new Promise(resolve => { - const index = this.cachedViews.indexOf(view.name); - index > -1 && this.cachedViews.splice(index, 1); - resolve([...this.cachedViews]); - }); - }, + delVisitedView(view: any) { + return new Promise(resolve => { + for (const [i, v] of this.visitedViews.entries()) { + if (v.path === view.path) { + this.visitedViews.splice(i, 1); + break; + } + } + resolve([...this.visitedViews]); + }); + }, + delCachedView(view: any) { + return new Promise(resolve => { + const index = this.cachedViews.indexOf(view.name); + index > -1 && this.cachedViews.splice(index, 1); + resolve([...this.cachedViews]); + }); + }, - delOtherVisitedViews(view: any) { - return new Promise(resolve => { - this.visitedViews = this.visitedViews.filter(v => { - return v.meta?.affix || v.path === view.path; - }); - resolve([...this.visitedViews]); - }); - }, - delOtherCachedViews(view: any) { - return new Promise(resolve => { - const index = this.cachedViews.indexOf(view.name); - if (index > -1) { - this.cachedViews = this.cachedViews.slice(index, index + 1); - } else { - // if index = -1, there is no cached tags - this.cachedViews = []; - } - resolve([...this.cachedViews]); - }); - }, + delOtherVisitedViews(view: any) { + return new Promise(resolve => { + this.visitedViews = this.visitedViews.filter(v => { + return v.meta?.affix || v.path === view.path; + }); + resolve([...this.visitedViews]); + }); + }, + delOtherCachedViews(view: any) { + return new Promise(resolve => { + const index = this.cachedViews.indexOf(view.name); + if (index > -1) { + this.cachedViews = this.cachedViews.slice(index, index + 1); + } else { + // if index = -1, there is no cached tags + this.cachedViews = []; + } + resolve([...this.cachedViews]); + }); + }, - updateVisitedView(view: any) { - for (let v of this.visitedViews) { - if (v.path === view.path) { - v = Object.assign(v, view); - break; - } - } - }, - addView(view: any) { - this.addVisitedView(view); - this.addCachedView(view); - }, - delView(view: any) { - return new Promise(resolve => { - this.delVisitedView(view); - this.delCachedView(view); - resolve({ - visitedViews: [...this.visitedViews], - cachedViews: [...this.cachedViews] - }); - }); - }, - delOtherViews(view: any) { - return new Promise(resolve => { - this.delOtherVisitedViews(view); - this.delOtherCachedViews(view); - resolve({ - visitedViews: [...this.visitedViews], - cachedViews: [...this.cachedViews] - }); - }); - }, - delLeftViews(view: any) { - return new Promise(resolve => { - const currIndex = this.visitedViews.findIndex( - v => v.path === view.path - ); - if (currIndex === -1) { - return; - } - this.visitedViews = this.visitedViews.filter((item, index) => { - // affix:true 固定tag,例如“首页” - if (index >= currIndex || (item.meta && item.meta.affix)) { - return true; - } + updateVisitedView(view: any) { + for (let v of this.visitedViews) { + if (v.path === view.path) { + v = Object.assign(v, view); + break; + } + } + }, + addView(view: any) { + this.addVisitedView(view); + this.addCachedView(view); + }, + delView(view: any) { + return new Promise(resolve => { + this.delVisitedView(view); + this.delCachedView(view); + resolve({ + visitedViews: [...this.visitedViews], + cachedViews: [...this.cachedViews] + }); + }); + }, + delOtherViews(view: any) { + return new Promise(resolve => { + this.delOtherVisitedViews(view); + this.delOtherCachedViews(view); + resolve({ + visitedViews: [...this.visitedViews], + cachedViews: [...this.cachedViews] + }); + }); + }, + delLeftViews(view: any) { + return new Promise(resolve => { + const currIndex = this.visitedViews.findIndex( + v => v.path === view.path + ); + if (currIndex === -1) { + return; + } + this.visitedViews = this.visitedViews.filter((item, index) => { + // affix:true 固定tag,例如“首页” + if (index >= currIndex || (item.meta && item.meta.affix)) { + return true; + } - const cacheIndex = this.cachedViews.indexOf(item.name as string); - if (cacheIndex > -1) { - this.cachedViews.splice(cacheIndex, 1); - } - return false; - }); - resolve({ - visitedViews: [...this.visitedViews] - }); - }); - }, - delRightViews(view: any) { - return new Promise(resolve => { - const currIndex = this.visitedViews.findIndex( - v => v.path === view.path - ); - if (currIndex === -1) { - return; - } - this.visitedViews = this.visitedViews.filter((item, index) => { - // affix:true 固定tag,例如“首页” - if (index <= currIndex || (item.meta && item.meta.affix)) { - return true; - } + const cacheIndex = this.cachedViews.indexOf(item.name as string); + if (cacheIndex > -1) { + this.cachedViews.splice(cacheIndex, 1); + } + return false; + }); + resolve({ + visitedViews: [...this.visitedViews] + }); + }); + }, + delRightViews(view: any) { + return new Promise(resolve => { + const currIndex = this.visitedViews.findIndex( + v => v.path === view.path + ); + if (currIndex === -1) { + return; + } + this.visitedViews = this.visitedViews.filter((item, index) => { + // affix:true 固定tag,例如“首页” + if (index <= currIndex || (item.meta && item.meta.affix)) { + return true; + } - const cacheIndex = this.cachedViews.indexOf(item.name as string); - if (cacheIndex > -1) { - this.cachedViews.splice(cacheIndex, 1); - } - return false; - }); - resolve({ - visitedViews: [...this.visitedViews] - }); - }); - }, - delAllViews() { - return new Promise(resolve => { - const affixTags = this.visitedViews.filter(tag => tag.meta?.affix); - this.visitedViews = affixTags; - this.cachedViews = []; - resolve({ - visitedViews: [...this.visitedViews], - cachedViews: [...this.cachedViews] - }); - }); - }, - delAllVisitedViews() { - return new Promise(resolve => { - const affixTags = this.visitedViews.filter(tag => tag.meta?.affix); - this.visitedViews = affixTags; - resolve([...this.visitedViews]); - }); - }, - delAllCachedViews() { - return new Promise(resolve => { - this.cachedViews = []; - resolve([...this.cachedViews]); - }); - } - } + const cacheIndex = this.cachedViews.indexOf(item.name as string); + if (cacheIndex > -1) { + this.cachedViews.splice(cacheIndex, 1); + } + return false; + }); + resolve({ + visitedViews: [...this.visitedViews] + }); + }); + }, + delAllViews() { + return new Promise(resolve => { + const affixTags = this.visitedViews.filter(tag => tag.meta?.affix); + this.visitedViews = affixTags; + this.cachedViews = []; + resolve({ + visitedViews: [...this.visitedViews], + cachedViews: [...this.cachedViews] + }); + }); + }, + delAllVisitedViews() { + return new Promise(resolve => { + const affixTags = this.visitedViews.filter(tag => tag.meta?.affix); + this.visitedViews = affixTags; + resolve([...this.visitedViews]); + }); + }, + delAllCachedViews() { + return new Promise(resolve => { + this.cachedViews = []; + resolve([...this.cachedViews]); + }); + } + } }); export default useTagsViewStore; diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 69269e3d..55b4a42e 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -6,103 +6,103 @@ import { getUserInfo } from '@/api/system/user'; import { resetRouter } from '@/router'; const useUserStore = defineStore({ - id: 'user', - state: (): UserState => ({ - token: localStorage.get('token') || '', - nickname: '', - avatar: '', - roles: [], - perms: [] - }), - actions: { - async RESET_STATE() { - this.$reset(); - }, - /** - * 用户登录请求 - * @param userInfo 登录用户信息 - * username: 用户名 - * password: 密码 - * code: 验证码 - * uuid: 匹配正确验证码的 key - */ - login(userInfo: LoginFormData) { - const { username, password, code, uuid } = userInfo; - return new Promise((resolve, reject) => { - login({ - username: username.trim(), - password: password, - grant_type: 'captcha', - code: code, - uuid: uuid - }) - .then(response => { - const { access_token, token_type } = response.data; - const accessToken = token_type + ' ' + access_token; - localStorage.set('token', accessToken); - this.token = accessToken; - resolve(access_token); - }) - .catch(error => { - reject(error); - }); - }); - }, - /** - * 获取用户信息(昵称、头像、角色集合、权限集合) - */ - getUserInfo() { - return new Promise((resolve, reject) => { - getUserInfo() - .then(({ data }) => { - if (!data) { - return reject('Verification failed, please Login again.'); - } - const { nickname, avatar, roles, perms } = data; - if (!roles || roles.length <= 0) { - reject('getUserInfo: roles must be a non-null array!'); - } - this.nickname = nickname; - this.avatar = avatar; - this.roles = roles; - this.perms = perms; - resolve(data); - }) - .catch(error => { - reject(error); - }); - }); - }, + id: 'user', + state: (): UserState => ({ + token: localStorage.get('token') || '', + nickname: '', + avatar: '', + roles: [], + perms: [] + }), + actions: { + async RESET_STATE() { + this.$reset(); + }, + /** + * 用户登录请求 + * @param userInfo 登录用户信息 + * username: 用户名 + * password: 密码 + * code: 验证码 + * uuid: 匹配正确验证码的 key + */ + login(userInfo: LoginFormData) { + const { username, password, code, uuid } = userInfo; + return new Promise((resolve, reject) => { + login({ + username: username.trim(), + password: password, + grant_type: 'captcha', + code: code, + uuid: uuid + }) + .then(response => { + const { access_token, token_type } = response.data; + const accessToken = token_type + ' ' + access_token; + localStorage.set('token', accessToken); + this.token = accessToken; + resolve(access_token); + }) + .catch(error => { + reject(error); + }); + }); + }, + /** + * 获取用户信息(昵称、头像、角色集合、权限集合) + */ + getUserInfo() { + return new Promise((resolve, reject) => { + getUserInfo() + .then(({ data }) => { + if (!data) { + return reject('Verification failed, please Login again.'); + } + const { nickname, avatar, roles, perms } = data; + if (!roles || roles.length <= 0) { + reject('getUserInfo: roles must be a non-null array!'); + } + this.nickname = nickname; + this.avatar = avatar; + this.roles = roles; + this.perms = perms; + resolve(data); + }) + .catch(error => { + reject(error); + }); + }); + }, - /** - * 注销 - */ - logout() { - return new Promise((resolve, reject) => { - logout() - .then(() => { - localStorage.remove('token'); - this.RESET_STATE(); - resetRouter(); - resolve(null); - }) - .catch(error => { - reject(error); - }); - }); - }, + /** + * 注销 + */ + logout() { + return new Promise((resolve, reject) => { + logout() + .then(() => { + localStorage.remove('token'); + this.RESET_STATE(); + resetRouter(); + resolve(null); + }) + .catch(error => { + reject(error); + }); + }); + }, - /** - * 清除 Token - */ - resetToken() { - return new Promise(resolve => { - localStorage.remove('token'); - this.RESET_STATE(); - resolve(null); - }); - } - } + /** + * 清除 Token + */ + resetToken() { + return new Promise(resolve => { + localStorage.remove('token'); + this.RESET_STATE(); + resolve(null); + }); + } + } }); export default useUserStore; diff --git a/src/styles/element-plus.scss b/src/styles/element-plus.scss index 7ef568d3..fa401fe6 100644 --- a/src/styles/element-plus.scss +++ b/src/styles/element-plus.scss @@ -1,50 +1,50 @@ :root { - // 这里可以设置你自定义的颜色变量 - // 这个是element主要按钮:active的颜色,当主题更改后此变量的值也随之更改 - --el-color-primary-dark: #0d84ff; - // element plus 2.1.0 禁用文本色值和正常文本色值无法区分问题 - --el-text-color-disabled: #ccc; + // 这里可以设置你自定义的颜色变量 + // 这个是element主要按钮:active的颜色,当主题更改后此变量的值也随之更改 + --el-color-primary-dark: #0d84ff; + // element plus 2.1.0 禁用文本色值和正常文本色值无法区分问题 + --el-text-color-disabled: #ccc; } // 覆盖 element-plus 的样式 .el-breadcrumb__inner, .el-breadcrumb__inner a { - font-weight: 400 !important; + font-weight: 400 !important; } .el-upload { - input[type='file'] { - display: none !important; - } + input[type='file'] { + display: none !important; + } } .el-upload__input { - display: none; + display: none; } // dropdown .el-dropdown-menu { - a { - display: block; - } + a { + display: block; + } } // to fix el-date-picker css style .el-range-separator { - box-sizing: content-box; + box-sizing: content-box; } // 选中行背景色值 .el-table__body tr.current-row td { - background-color: #e1f3d8b5 !important; + background-color: #e1f3d8b5 !important; } // card 的header统一高度 .el-card__header { - height: 60px !important; + height: 60px !important; } // 表格表头和表体未对齐 .el-table__header col[name='gutter'] { - display: table-cell !important; + display: table-cell !important; } diff --git a/src/styles/index.scss b/src/styles/index.scss index 224a053b..90f2d40d 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -5,64 +5,64 @@ @import './sidebar.scss'; body { - margin: 0; - padding: 0; - height: 100%; - -moz-osx-font-smoothing: grayscale; - -webkit-font-smoothing: antialiased; - text-rendering: optimizeLegibility; - font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, - Microsoft YaHei, Arial, sans-serif; + margin: 0; + padding: 0; + height: 100%; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; + text-rendering: optimizeLegibility; + font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, + Microsoft YaHei, Arial, sans-serif; } label { - font-weight: 700; + font-weight: 700; } html { - height: 100%; - box-sizing: border-box; + height: 100%; + box-sizing: border-box; } #app { - height: 100%; + height: 100%; } *, *:before, *:after { - box-sizing: inherit; + box-sizing: inherit; } a:focus, a:active { - outline: none; + outline: none; } a, a:focus, a:hover { - cursor: pointer; - color: inherit; - text-decoration: none; + cursor: pointer; + color: inherit; + text-decoration: none; } div:focus { - outline: none; + outline: none; } .clearfix { - &:after { - visibility: hidden; - display: block; - font-size: 0; - content: ' '; - clear: both; - height: 0; - } + &:after { + visibility: hidden; + display: block; + font-size: 0; + content: ' '; + clear: both; + height: 0; + } } // main-container global css .app-container { - padding: 20px; + padding: 20px; } diff --git a/src/styles/mixin.scss b/src/styles/mixin.scss index 2a0e04a9..3ca71684 100644 --- a/src/styles/mixin.scss +++ b/src/styles/mixin.scss @@ -1,28 +1,28 @@ @mixin clearfix { - &:after { - content: ''; - display: table; - clear: both; - } + &:after { + content: ''; + display: table; + clear: both; + } } @mixin scrollBar { - &::-webkit-scrollbar-track-piece { - background: #d3dce6; - } + &::-webkit-scrollbar-track-piece { + background: #d3dce6; + } - &::-webkit-scrollbar { - width: 6px; - } + &::-webkit-scrollbar { + width: 6px; + } - &::-webkit-scrollbar-thumb { - background: #99a9bf; - border-radius: 20px; - } + &::-webkit-scrollbar-thumb { + background: #99a9bf; + border-radius: 20px; + } } @mixin relative { - position: relative; - width: 100%; - height: 100%; + position: relative; + width: 100%; + height: 100%; } diff --git a/src/styles/sidebar.scss b/src/styles/sidebar.scss index 0ed5a6f1..651e763d 100644 --- a/src/styles/sidebar.scss +++ b/src/styles/sidebar.scss @@ -1,228 +1,228 @@ #app { - .main-container { - min-height: 100%; - transition: margin-left 0.28s; - margin-left: $sideBarWidth; - position: relative; - } + .main-container { + min-height: 100%; + transition: margin-left 0.28s; + margin-left: $sideBarWidth; + position: relative; + } - .sidebar-container { - transition: width 0.28s; - width: $sideBarWidth !important; - background-color: $menuBg; - height: 100%; - position: fixed; - font-size: 0px; - top: 0; - bottom: 0; - left: 0; - z-index: 1001; - overflow: hidden; + .sidebar-container { + transition: width 0.28s; + width: $sideBarWidth !important; + background-color: $menuBg; + height: 100%; + position: fixed; + font-size: 0px; + top: 0; + bottom: 0; + left: 0; + z-index: 1001; + overflow: hidden; - // reset element-ui css - .horizontal-collapse-transition { - transition: 0s width ease-in-out, 0s padding-left ease-in-out, - 0s padding-right ease-in-out; - } + // reset element-ui css + .horizontal-collapse-transition { + transition: 0s width ease-in-out, 0s padding-left ease-in-out, + 0s padding-right ease-in-out; + } - .scrollbar-wrapper { - overflow-x: hidden !important; - } + .scrollbar-wrapper { + overflow-x: hidden !important; + } - .el-scrollbar__bar.is-vertical { - right: 0px; - } + .el-scrollbar__bar.is-vertical { + right: 0px; + } - .el-scrollbar { - height: 100%; - } + .el-scrollbar { + height: 100%; + } - &.has-logo { - .el-scrollbar { - height: calc(100% - 50px); - } - } + &.has-logo { + .el-scrollbar { + height: calc(100% - 50px); + } + } - .is-horizontal { - display: none; - } + .is-horizontal { + display: none; + } - a { - display: inline-block; - width: 100%; - overflow: hidden; - } + a { + display: inline-block; + width: 100%; + overflow: hidden; + } - .svg-icon { - margin-right: 16px; - } + .svg-icon { + margin-right: 16px; + } - .sub-el-icon { - margin-right: 12px; - margin-left: -2px; - } + .sub-el-icon { + margin-right: 12px; + margin-left: -2px; + } - .el-menu { - border: none; - height: 100%; - width: 100% !important; - } + .el-menu { + border: none; + height: 100%; + width: 100% !important; + } - // menu hover - .submenu-title-noDropdown, - .el-sub-menu__title { - &:hover { - background-color: $menuHover !important; - } - } + // menu hover + .submenu-title-noDropdown, + .el-sub-menu__title { + &:hover { + background-color: $menuHover !important; + } + } - .is-active > .el-sub-menu__title { - color: $subMenuActiveText !important; - } + .is-active > .el-sub-menu__title { + color: $subMenuActiveText !important; + } - & .nest-menu .el-sub-menu > .el-sub-menu__title, - & .el-sub-menu .el-menu-item { - min-width: $sideBarWidth !important; - background-color: $subMenuBg !important; + & .nest-menu .el-sub-menu > .el-sub-menu__title, + & .el-sub-menu .el-menu-item { + min-width: $sideBarWidth !important; + background-color: $subMenuBg !important; - &:hover { - background-color: $subMenuHover !important; - } - } - } + &:hover { + background-color: $subMenuHover !important; + } + } + } - .hideSidebar { - .sidebar-container { - width: 54px !important; - .svg-icon { - margin-right: 0px; - } - } + .hideSidebar { + .sidebar-container { + width: 54px !important; + .svg-icon { + margin-right: 0px; + } + } - .main-container { - margin-left: 54px; - } + .main-container { + margin-left: 54px; + } - .submenu-title-noDropdown { - padding: 0 !important; - position: relative; + .submenu-title-noDropdown { + padding: 0 !important; + position: relative; - .el-tooltip { - padding: 0 !important; + .el-tooltip { + padding: 0 !important; - .svg-icon { - margin-left: 20px; - } + .svg-icon { + margin-left: 20px; + } - .sub-el-icon { - margin-left: 19px; - } - } - } + .sub-el-icon { + margin-left: 19px; + } + } + } - .el-sub-menu { - overflow: hidden; + .el-sub-menu { + overflow: hidden; - & > .el-sub-menu__title { - padding: 0 !important; + & > .el-sub-menu__title { + padding: 0 !important; - .svg-icon { - margin-left: 20px; - } + .svg-icon { + margin-left: 20px; + } - .sub-el-icon { - margin-left: 19px; - } + .sub-el-icon { + margin-left: 19px; + } - .el-sub-menu__icon-arrow { - display: none; - } - } - } + .el-sub-menu__icon-arrow { + display: none; + } + } + } - .el-menu--collapse { - .el-sub-menu { - & > .el-sub-menu__title { - & > span { - height: 0; - width: 0; - overflow: hidden; - visibility: hidden; - display: inline-block; - } - } - } - } - } + .el-menu--collapse { + .el-sub-menu { + & > .el-sub-menu__title { + & > span { + height: 0; + width: 0; + overflow: hidden; + visibility: hidden; + display: inline-block; + } + } + } + } + } - .el-menu--collapse .el-menu .el-sub-menu { - min-width: $sideBarWidth !important; - } + .el-menu--collapse .el-menu .el-sub-menu { + min-width: $sideBarWidth !important; + } - // mobile responsive - .mobile { - .main-container { - margin-left: 0px; - } + // mobile responsive + .mobile { + .main-container { + margin-left: 0px; + } - .sidebar-container { - transition: transform 0.28s; - width: $sideBarWidth !important; - } + .sidebar-container { + transition: transform 0.28s; + width: $sideBarWidth !important; + } - &.hideSidebar { - .sidebar-container { - pointer-events: none; - transition-duration: 0.3s; - transform: translate3d(-$sideBarWidth, 0, 0); - } - } - } + &.hideSidebar { + .sidebar-container { + pointer-events: none; + transition-duration: 0.3s; + transform: translate3d(-$sideBarWidth, 0, 0); + } + } + } - .withoutAnimation { - .main-container, - .sidebar-container { - transition: none; - } - } + .withoutAnimation { + .main-container, + .sidebar-container { + transition: none; + } + } } // when menu collapsed .el-menu--vertical { - & > .el-menu { - .svg-icon { - margin-right: 16px; - } - .sub-el-icon { - margin-right: 12px; - margin-left: -2px; - } - } + & > .el-menu { + .svg-icon { + margin-right: 16px; + } + .sub-el-icon { + margin-right: 12px; + margin-left: -2px; + } + } - .nest-menu .el-sub-menu > .el-sub-menu__title, - .el-menu-item { - &:hover { - // you can use $subMenuHover - background-color: $menuHover !important; - } - } + .nest-menu .el-sub-menu > .el-sub-menu__title, + .el-menu-item { + &:hover { + // you can use $subMenuHover + background-color: $menuHover !important; + } + } - // the scroll bar appears when the subMenu is too long - > .el-menu--popup { - max-height: 100vh; - overflow-y: auto; + // the scroll bar appears when the subMenu is too long + > .el-menu--popup { + max-height: 100vh; + overflow-y: auto; - &::-webkit-scrollbar-track-piece { - background: #d3dce6; - } + &::-webkit-scrollbar-track-piece { + background: #d3dce6; + } - &::-webkit-scrollbar { - width: 6px; - } + &::-webkit-scrollbar { + width: 6px; + } - &::-webkit-scrollbar-thumb { - background: #99a9bf; - border-radius: 20px; - } - } + &::-webkit-scrollbar-thumb { + background: #99a9bf; + border-radius: 20px; + } + } } diff --git a/src/styles/transition.scss b/src/styles/transition.scss index b69e4a30..b02f60b1 100644 --- a/src/styles/transition.scss +++ b/src/styles/transition.scss @@ -3,46 +3,46 @@ /* fade */ .fade-enter-active, .fade-leave-active { - transition: opacity 0.28s; + transition: opacity 0.28s; } .fade-enter, .fade-leave-active { - opacity: 0; + opacity: 0; } /* fade-transform */ .fade-transform-leave-active, .fade-transform-enter-active { - transition: all 0.5s; + transition: all 0.5s; } .fade-transform-enter { - opacity: 0; - transform: translateX(-30px); + opacity: 0; + transform: translateX(-30px); } .fade-transform-leave-to { - opacity: 0; - transform: translateX(30px); + opacity: 0; + transform: translateX(30px); } /* breadcrumb transition */ .breadcrumb-enter-active, .breadcrumb-leave-active { - transition: all 0.5s; + transition: all 0.5s; } .breadcrumb-enter, .breadcrumb-leave-active { - opacity: 0; - transform: translateX(20px); + opacity: 0; + transform: translateX(20px); } .breadcrumb-move { - transition: all 0.5s; + transition: all 0.5s; } .breadcrumb-leave-active { - position: absolute; + position: absolute; } diff --git a/src/styles/variables.module.scss b/src/styles/variables.module.scss index d0d48ea1..8e20bc38 100644 --- a/src/styles/variables.module.scss +++ b/src/styles/variables.module.scss @@ -14,12 +14,12 @@ $sideBarWidth: 210px; // the :export directive is the magic sauce for webpack // https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass :export { - menuText: $menuText; - menuActiveText: $menuActiveText; - subMenuActiveText: $subMenuActiveText; - menuBg: $menuBg; - menuHover: $menuHover; - subMenuBg: $subMenuBg; - subMenuHover: $subMenuHover; - sideBarWidth: $sideBarWidth; + menuText: $menuText; + menuActiveText: $menuActiveText; + subMenuActiveText: $subMenuActiveText; + menuBg: $menuBg; + menuHover: $menuHover; + subMenuBg: $subMenuBg; + subMenuHover: $subMenuHover; + sideBarWidth: $sideBarWidth; } diff --git a/src/types/api/base.d.ts b/src/types/api/base.d.ts index 9bc3c8a6..874d2d5c 100644 --- a/src/types/api/base.d.ts +++ b/src/types/api/base.d.ts @@ -1,9 +1,9 @@ export interface PageQueryParam { - pageNum: number; - pageSize: number; + pageNum: number; + pageSize: number; } export interface PageResult { - list: T; - total: number; + list: T; + total: number; } diff --git a/src/types/api/lab/seata.d.ts b/src/types/api/lab/seata.d.ts index eaef667b..1d371eb8 100644 --- a/src/types/api/lab/seata.d.ts +++ b/src/types/api/lab/seata.d.ts @@ -2,8 +2,8 @@ * Seata表单类型声明 */ export interface SeataFormData { - openTx: boolean; - stockEx: boolean; - accountEx: boolean; - orderEx: boolean; + openTx: boolean; + stockEx: boolean; + accountEx: boolean; + orderEx: boolean; } diff --git a/src/types/api/oms/order.d.ts b/src/types/api/oms/order.d.ts index be3a3acb..695713d2 100644 --- a/src/types/api/oms/order.d.ts +++ b/src/types/api/oms/order.d.ts @@ -4,35 +4,35 @@ import { PageQueryParam, PageResult } from '../base'; * 订单查询参数类型声明 */ export interface OrderQueryParam extends PageQueryParam { - orderSn: string | undefined; - status: number | undefined; + orderSn: string | undefined; + status: number | undefined; } /** * 订单分页列表项声明 */ export interface Order { - id: string; - orderSn: string; - totalAmount: string; - payAmount: string; - payType: number; - status: number; - totalQuantity: number; - gmtCreate: string; - memberId: string; - sourceType: number; - orderItems: OrderItem[]; + id: string; + orderSn: string; + totalAmount: string; + payAmount: string; + payType: number; + status: number; + totalQuantity: number; + gmtCreate: string; + memberId: string; + sourceType: number; + orderItems: OrderItem[]; } export interface OrderItem { - id: string; - orderId: string; - skuId: string; - skuName: string; - picUrl: string; - price: string; - count: number; - totalAmount: number; + id: string; + orderId: string; + skuId: string; + skuName: string; + picUrl: string; + price: string; + count: number; + totalAmount: number; } /** @@ -44,13 +44,13 @@ export type OrderPageResult = PageResult; * 订单表单类型声明 */ export interface OrderDetail { - id: number | undefined; - title: string; - picUrl: string; - beginTime: string; - endTime: string; - status: number; - sort: number; - url: string; - remark: string; + id: number | undefined; + title: string; + picUrl: string; + beginTime: string; + endTime: string; + status: number; + sort: number; + url: string; + remark: string; } diff --git a/src/types/api/pms/brand.d.ts b/src/types/api/pms/brand.d.ts index 1f29ecd8..6ddddec2 100644 --- a/src/types/api/pms/brand.d.ts +++ b/src/types/api/pms/brand.d.ts @@ -4,17 +4,17 @@ import { PageQueryParam, PageResult } from '../base'; * 品牌查询参数类型声明 */ export interface BrandQueryParam extends PageQueryParam { - name?: string; + name?: string; } /** * 品牌分页列表项声明 */ export interface BrandItem { - id: string; - name: string; - logoUrl: string; - sort: number; + id: string; + name: string; + logoUrl: string; + sort: number; } /** @@ -26,8 +26,8 @@ export type BrandPageResult = PageResult; * 品牌表单类型声明 */ export interface BrandFormData { - id: number | undefined; - name: string; - logoUrl: string; - sort: number; + id: number | undefined; + name: string; + logoUrl: string; + sort: number; } diff --git a/src/types/api/pms/goods.d.ts b/src/types/api/pms/goods.d.ts index f82b05ae..f118f23e 100644 --- a/src/types/api/pms/goods.d.ts +++ b/src/types/api/pms/goods.d.ts @@ -4,45 +4,45 @@ import { PageQueryParam, PageResult } from '../base'; * 商品查询参数类型声明 */ export interface GoodsQueryParam extends PageQueryParam { - name?: stirng; - categoryId?: number; + name?: stirng; + categoryId?: number; } /** * 商品列表项类型声明 */ export interface GoodsItem { - id: string; - name: string; - categoryId?: any; - brandId?: any; - originPrice: string; - price: string; - sales: number; - picUrl?: any; - album?: any; - unit?: any; - description: string; - detail: string; - status?: any; - categoryName: string; - brandName: string; - skuList: SkuItem[]; + id: string; + name: string; + categoryId?: any; + brandId?: any; + originPrice: string; + price: string; + sales: number; + picUrl?: any; + album?: any; + unit?: any; + description: string; + detail: string; + status?: any; + categoryName: string; + brandName: string; + skuList: SkuItem[]; } /** * 商品规格项类型声明 */ export interface SkuItem { - id: string; - skuSn?: any; - name: string; - spuId?: any; - specIds: string; - price: string; - stockNum: number; - lockedStockNum?: any; - picUrl?: any; + id: string; + skuSn?: any; + name: string; + spuId?: any; + specIds: string; + price: string; + stockNum: number; + lockedStockNum?: any; + picUrl?: any; } /** @@ -54,17 +54,17 @@ export type GoodsPageResult = PageResult; * 商品表单数据类型声明 */ export interface GoodsDetail { - id?: string; - name?: string; - categoryId?: string; - brandId?: string; - originPrice?: number; - price?: number; - picUrl?: string; - album: string[]; - description?: string; - detail?: string; - attrList: any[]; - specList: any[]; - skuList: any[]; + id?: string; + name?: string; + categoryId?: string; + brandId?: string; + originPrice?: number; + price?: number; + picUrl?: string; + album: string[]; + description?: string; + detail?: string; + attrList: any[]; + specList: any[]; + skuList: any[]; } diff --git a/src/types/api/sms/advert.d.ts b/src/types/api/sms/advert.d.ts index 6862b804..610ae57d 100644 --- a/src/types/api/sms/advert.d.ts +++ b/src/types/api/sms/advert.d.ts @@ -4,17 +4,17 @@ import { PageQueryParam, PageResult } from '../base'; * 广告查询参数类型声明 */ export interface AdvertQueryParam extends PageQueryParam { - title?: string; + title?: string; } /** * 广告分页列表项声明 */ export interface AdvertItem { - id: string; - name: string; - logoUrl: string; - sort: number; + id: string; + name: string; + logoUrl: string; + sort: number; } /** @@ -26,13 +26,13 @@ export type AdvertPageResult = PageResult; * 广告表单类型声明 */ export interface AdvertFormData { - id?: number; - title: string; - picUrl: string; - beginTime: string; - endTime: string; - status: number; - sort: number; - url: string; - remark: string; + id?: number; + title: string; + picUrl: string; + beginTime: string; + endTime: string; + status: number; + sort: number; + url: string; + remark: string; } diff --git a/src/types/api/system/client.d.ts b/src/types/api/system/client.d.ts index 72d6b70f..98f97467 100644 --- a/src/types/api/system/client.d.ts +++ b/src/types/api/system/client.d.ts @@ -4,27 +4,27 @@ import { PageQueryParam, PageResult } from '../base'; * 客户端查询参数类型声明 */ export interface ClientQueryParam extends PageQueryParam { - /** - * 客户端名称 - */ - clientId: string | undefined; + /** + * 客户端名称 + */ + clientId: string | undefined; } /** * 客户端分页列表项声明 */ export interface ClientItem { - clientId: string; - clientSecret: string; - resourceIds: string; - scope: string; - authorizedGrantTypes: string; - webServerRedirectUri?: any; - authorities?: any; - accessTokenValidity: number; - refreshTokenValidity: number; - additionalInformation?: any; - autoapprove: string; + clientId: string; + clientSecret: string; + resourceIds: string; + scope: string; + authorizedGrantTypes: string; + webServerRedirectUri?: any; + authorities?: any; + accessTokenValidity: number; + refreshTokenValidity: number; + additionalInformation?: any; + autoapprove: string; } /** @@ -36,14 +36,14 @@ export type ClientPageResult = PageResult; * 客户端表单类型声明 */ export interface ClientFormData { - authorizedGrantTypes: string; - clientId: string; - clientSecret: string; - accessTokenValidity: string; - refreshTokenValidity: string; - webServerRedirectUri: string; - authorities: string; - additionalInformation: string; - autoapprove: string; - scope: string; + authorizedGrantTypes: string; + clientId: string; + clientSecret: string; + accessTokenValidity: string; + refreshTokenValidity: string; + webServerRedirectUri: string; + authorities: string; + additionalInformation: string; + autoapprove: string; + scope: string; } diff --git a/src/types/api/system/dept.d.ts b/src/types/api/system/dept.d.ts index abc31b15..cd19d867 100644 --- a/src/types/api/system/dept.d.ts +++ b/src/types/api/system/dept.d.ts @@ -2,8 +2,8 @@ * 部门查询参数类型声明 */ export interface DeptQueryParam { - name: string | undefined; - status: number | undefined; + name: string | undefined; + status: number | undefined; } /** @@ -11,25 +11,25 @@ export interface DeptQueryParam { */ export interface DeptItem { - id: string; - name: string; - parentId: string; - treePath: string; - sort: number; - status: number; - leader?: string; - mobile?: string; - email?: string; - children: DeptItem[]; + id: string; + name: string; + parentId: string; + treePath: string; + sort: number; + status: number; + leader?: string; + mobile?: string; + email?: string; + children: DeptItem[]; } /** * 部门表单类型声明 */ export interface DeptFormData { - id?: string; - parentId: string; - name: string; - sort: number; - status: number; + id?: string; + parentId: string; + name: string; + sort: number; + status: number; } diff --git a/src/types/api/system/dict.d.ts b/src/types/api/system/dict.d.ts index 02fb413d..53f47f7e 100644 --- a/src/types/api/system/dict.d.ts +++ b/src/types/api/system/dict.d.ts @@ -4,21 +4,21 @@ import { PageQueryParam, PageResult } from '../base'; * 字典查询参数类型声明 */ export interface DictQueryParam extends PageQueryParam { - /** - * 字典名称 - */ - name: string | undefined; + /** + * 字典名称 + */ + name: string | undefined; } /** * 字典分页列表项声明 */ export interface Dict { - id: number; - code: string; - name: string; - status: number; - remark: string; + id: number; + code: string; + name: string; + status: number; + remark: string; } /** @@ -30,39 +30,39 @@ export type DictPageResult = PageResult; * 字典表单类型声明 */ export interface DictFormData { - id: number | undefined; - name: string; - code: string; - status: number; - remark: string; + id: number | undefined; + name: string; + code: string; + status: number; + remark: string; } /** * 字典项查询参数类型声明 */ export interface DictItemQueryParam extends PageQueryParam { - /** - * 字典项名称 - */ - name: string | undefined; - /** - * 字典编码 - */ - dictCode: string | undefined; + /** + * 字典项名称 + */ + name: string | undefined; + /** + * 字典编码 + */ + dictCode: string | undefined; } /** * 字典分页列表项声明 */ export interface DictItem { - id: number; - name: string; - value: string; - dictCode: string; - sort: number; - status: number; - defaulted: number; - remark?: string; + id: number; + name: string; + value: string; + dictCode: string; + sort: number; + status: number; + defaulted: number; + remark?: string; } /** @@ -74,13 +74,13 @@ export type DictItemPageResult = PageResult; * 字典表单类型声明 */ export interface DictItemFormData { - id?: number; - dictCode?: string; - dictName?: string; - name: string; - code: string; - value: string; - status: number; - sort: number; - remark: string; + id?: number; + dictCode?: string; + dictName?: string; + name: string; + code: string; + value: string; + status: number; + sort: number; + remark: string; } diff --git a/src/types/api/system/login.d.ts b/src/types/api/system/login.d.ts index 15d6f23f..75905c8a 100644 --- a/src/types/api/system/login.d.ts +++ b/src/types/api/system/login.d.ts @@ -2,25 +2,25 @@ * 登录表单类型声明 */ export interface LoginFormData { - username: string; - password: string; - grant_type: string; - code: string; - uuid: string; + username: string; + password: string; + grant_type: string; + code: string; + uuid: string; } /** * 登录响应类型声明 */ export interface LoginResponseData { - access_token: string; - token_type: string; + access_token: string; + token_type: string; } /** * 验证码类型声明 */ export interface Captcha { - img: string; - uuid: string; + img: string; + uuid: string; } diff --git a/src/types/api/system/menu.d.ts b/src/types/api/system/menu.d.ts index b6597df1..d0c30366 100644 --- a/src/types/api/system/menu.d.ts +++ b/src/types/api/system/menu.d.ts @@ -2,7 +2,7 @@ * 菜单查询参数类型声明 */ export interface MenuQueryParam { - name?: string; + name?: string; } /** @@ -10,58 +10,58 @@ export interface MenuQueryParam { */ export interface MenuItem { - id: number; - parentId: number; - gmtCreate: string; - gmtModified: string; - name: string; - icon: string; - component: string; - sort: number; - visible: number; - children: MenuItem[]; + id: number; + parentId: number; + gmtCreate: string; + gmtModified: string; + name: string; + icon: string; + component: string; + sort: number; + visible: number; + children: MenuItem[]; } /** * 菜单表单类型声明 */ export interface MenuFormData { - /** - * 菜单ID - */ - id?: string; - /** - * 父菜单ID - */ - parentId: string; - /** - * 菜单名称 - */ - name: string; - /** - * 菜单是否可见(1:是;0:否;) - */ - visible: number; - icon?: string; - /** - * 排序 - */ - sort: number; - /** - * 组件路径 - */ - component?: string; - /** - * 路由路径 - */ - path: string; - /** - * 跳转路由路径 - */ - redirect?: string; + /** + * 菜单ID + */ + id?: string; + /** + * 父菜单ID + */ + parentId: string; + /** + * 菜单名称 + */ + name: string; + /** + * 菜单是否可见(1:是;0:否;) + */ + visible: number; + icon?: string; + /** + * 排序 + */ + sort: number; + /** + * 组件路径 + */ + component?: string; + /** + * 路由路径 + */ + path: string; + /** + * 跳转路由路径 + */ + redirect?: string; - /** - * 菜单类型(1:菜单;2:目录;3:外链) - */ - type: string; + /** + * 菜单类型(1:菜单;2:目录;3:外链) + */ + type: string; } diff --git a/src/types/api/system/perm.d.ts b/src/types/api/system/perm.d.ts index 21c3fae8..cf5a81a5 100644 --- a/src/types/api/system/perm.d.ts +++ b/src/types/api/system/perm.d.ts @@ -4,20 +4,20 @@ import { PageQueryParam, PageResult } from '../base'; * 权限查询参数类型声明 */ export interface PermQueryParam extends PageQueryParam { - menuId: any; - name: string | undefined; + menuId: any; + name: string | undefined; } /** * 权限分页列表项声明 */ export interface PermItem { - id: number; - name: string; - menuId: string; - urlPerm: string; - btnPerm: string; - roles?: string[]; + id: number; + name: string; + menuId: string; + urlPerm: string; + btnPerm: string; + roles?: string[]; } /** @@ -29,9 +29,9 @@ export type PermPageResult = PageResult; * 权限表单类型声明 */ export interface PermFormData { - id: number | undefined; - name: string; - urlPerm: string; - btnPerm: string; - menuId: string; + id: number | undefined; + name: string; + urlPerm: string; + btnPerm: string; + menuId: string; } diff --git a/src/types/api/system/role.d.ts b/src/types/api/system/role.d.ts index 63f20581..f4dc31b2 100644 --- a/src/types/api/system/role.d.ts +++ b/src/types/api/system/role.d.ts @@ -4,21 +4,21 @@ import { PageQueryParam, PageResult } from '../base'; * 角色查询参数类型声明 */ export interface RoleQueryParam extends PageQueryParam { - name?: string; + name?: string; } /** * 角色分页列表项声明 */ export interface RoleItem { - id: string; - name: string; - code: string; - sort: number; - status: number; - deleted: number; - menuIds?: any; - permissionIds?: any; + id: string; + name: string; + code: string; + sort: number; + status: number; + deleted: number; + menuIds?: any; + permissionIds?: any; } /** @@ -30,9 +30,9 @@ export type RolePageResult = PageResult; * 角色表单类型声明 */ export interface RoleFormData { - id: number | undefined; - name: string; - code: string; - sort: number; - status: number; + id: number | undefined; + name: string; + code: string; + sort: number; + status: number; } diff --git a/src/types/api/system/user.d.ts b/src/types/api/system/user.d.ts index 5b02e33e..795ed6f8 100644 --- a/src/types/api/system/user.d.ts +++ b/src/types/api/system/user.d.ts @@ -4,36 +4,36 @@ import { PageQueryParam, PageResult } from '../base'; * 登录用户类型声明 */ export interface UserInfo { - nickname: string; - avatar: string; - roles: string[]; - perms: string[]; + nickname: string; + avatar: string; + roles: string[]; + perms: string[]; } /** * 用户查询参数类型声明 */ export interface UserQueryParam extends PageQueryParam { - keywords: string; - status: number; - deptId: number; + keywords: string; + status: number; + deptId: number; } /** * 用户分页列表项声明 */ export interface UserItem { - id: string; - username: string; - nickname: string; - mobile: string; - gender: number; - avatar: string; - email: string; - status: number; - deptName: string; - roleNames: string; - gmtCreate: string; + id: string; + username: string; + nickname: string; + mobile: string; + gender: number; + avatar: string; + email: string; + status: number; + deptName: string; + roleNames: string; + gmtCreate: string; } /** @@ -45,23 +45,23 @@ export type UserPageResult = PageResult; * 用户表单类型声明 */ export interface UserFormData { - id: number | undefined; - deptId: number; - username: string; - nickname: string; - password: string; - mobile: string; - email: string; - gender: number; - status: number; - remark: string; - roleIds: number[]; + id: number | undefined; + deptId: number; + username: string; + nickname: string; + password: string; + mobile: string; + email: string; + gender: number; + status: number; + remark: string; + roleIds: number[]; } /** * 用户导入表单类型声明 */ export interface UserImportFormData { - deptId: number; - roleIds: number[]; + deptId: number; + roleIds: number[]; } diff --git a/src/types/api/ums/member.d.ts b/src/types/api/ums/member.d.ts index 438748e0..fc51d80a 100644 --- a/src/types/api/ums/member.d.ts +++ b/src/types/api/ums/member.d.ts @@ -4,43 +4,43 @@ import { PageQueryParam, PageResult } from '../base'; * 会员查询参数类型声明 */ export interface MemberQueryParam extends PageQueryParam { - nickName?: string; + nickName?: string; } /** * 会员分页列表项声明 */ export interface MemberItem { - id: string; - gender: number; - nickName: string; - mobile: string; - birthday?: any; - avatarUrl: string; - openid: string; - sessionKey?: any; - city: string; - country: string; - language: string; - province: string; - status: number; - balance: string; - deleted: number; - point: number; - addressList: AddressItem[]; + id: string; + gender: number; + nickName: string; + mobile: string; + birthday?: any; + avatarUrl: string; + openid: string; + sessionKey?: any; + city: string; + country: string; + language: string; + province: string; + status: number; + balance: string; + deleted: number; + point: number; + addressList: AddressItem[]; } export interface AddressItem { - id: string; - memberId: string; - consigneeName: string; - consigneeMobile: string; - province: string; - city: string; - area: string; - detailAddress: string; - zipCode?: any; - defaulted: number; + id: string; + memberId: string; + consigneeName: string; + consigneeMobile: string; + province: string; + city: string; + area: string; + detailAddress: string; + zipCode?: any; + defaulted: number; } /** @@ -52,13 +52,13 @@ export type MemberPageResult = PageResult; * 会员表单类型声明 */ export interface MemberFormData { - id: number | undefined; - title: string; - picUrl: string; - beginTime: string; - endTime: string; - status: number; - sort: number; - url: string; - remark: string; + id: number | undefined; + title: string; + picUrl: string; + beginTime: string; + endTime: string; + status: number; + sort: number; + url: string; + remark: string; } diff --git a/src/types/common.d.ts b/src/types/common.d.ts index 0df1bbe4..7a00ee13 100644 --- a/src/types/common.d.ts +++ b/src/types/common.d.ts @@ -6,15 +6,15 @@ * 弹窗属性类型声明 */ export interface Dialog { - title: string; - visible: boolean; + title: string; + visible: boolean; } /** * 通用组件选择项类型声明 */ export interface Option { - value: string; - label: string; - children?: Option[]; + value: string; + label: string; + children?: Option[]; } diff --git a/src/types/store.d.ts b/src/types/store.d.ts index 2091f77c..6cc47a8a 100644 --- a/src/types/store.d.ts +++ b/src/types/store.d.ts @@ -3,53 +3,53 @@ import { RouteRecordRaw, RouteLocationNormalized } from 'vue-router'; * 用户状态类型声明 */ export interface AppState { - device: string; - sidebar: { - opened: boolean; - withoutAnimation: boolean; - }; - language: string; - size: string; + device: string; + sidebar: { + opened: boolean; + withoutAnimation: boolean; + }; + language: string; + size: string; } /** * 权限类型声明 */ export interface PermissionState { - routes: RouteRecordRaw[]; - addRoutes: RouteRecordRaw[]; + routes: RouteRecordRaw[]; + addRoutes: RouteRecordRaw[]; } /** * 设置状态类型声明 */ export interface SettingState { - theme: string; - tagsView: boolean; - fixedHeader: boolean; - showSettings: boolean; - sidebarLogo: boolean; + theme: string; + tagsView: boolean; + fixedHeader: boolean; + showSettings: boolean; + sidebarLogo: boolean; } /** * 标签状态类型声明 */ export interface TagView extends Partial { - title?: string; + title?: string; } export interface TagsViewState { - visitedViews: TagView[]; - cachedViews: string[]; + visitedViews: TagView[]; + cachedViews: string[]; } /** * 用户状态类型声明 */ export interface UserState { - token: string; - nickname: string; - avatar: string; - roles: string[]; - perms: string[]; + token: string; + nickname: string; + avatar: string; + roles: string[]; + perms: string[]; } diff --git a/src/utils/filter.ts b/src/utils/filter.ts index beb11e30..38c28bc2 100644 --- a/src/utils/filter.ts +++ b/src/utils/filter.ts @@ -5,24 +5,24 @@ * @return {string} */ function pluralize(time: number, label: string) { - if (time === 1) { - return time + label; - } - return time + label + 's'; + if (time === 1) { + return time + label; + } + return time + label + 's'; } /** * @param {number} time */ export function timeAgo(time: number) { - const between = Date.now() / 1000 - Number(time); - if (between < 3600) { - return pluralize(~~(between / 60), ' minute'); - } else if (between < 86400) { - return pluralize(~~(between / 3600), ' hour'); - } else { - return pluralize(~~(between / 86400), ' day'); - } + const between = Date.now() / 1000 - Number(time); + if (between < 3600) { + return pluralize(~~(between / 60), ' minute'); + } else if (between < 86400) { + return pluralize(~~(between / 3600), ' hour'); + } else { + return pluralize(~~(between / 86400), ' day'); + } } /** @@ -32,24 +32,24 @@ export function timeAgo(time: number) { * @param {number} digits */ export function numberFormatter(num: number, digits: number) { - const si = [ - { value: 1e18, symbol: 'E' }, - { value: 1e15, symbol: 'P' }, - { value: 1e12, symbol: 'T' }, - { value: 1e9, symbol: 'G' }, - { value: 1e6, symbol: 'M' }, - { value: 1e3, symbol: 'k' } - ]; - for (let i = 0; i < si.length; i++) { - if (num >= si[i].value) { - return ( - (num / si[i].value) - .toFixed(digits) - .replace(/\.0+$|(\.[0-9]*[1-9])0+$/, '$1') + si[i].symbol - ); - } - } - return num.toString(); + const si = [ + { value: 1e18, symbol: 'E' }, + { value: 1e15, symbol: 'P' }, + { value: 1e12, symbol: 'T' }, + { value: 1e9, symbol: 'G' }, + { value: 1e6, symbol: 'M' }, + { value: 1e3, symbol: 'k' } + ]; + for (let i = 0; i < si.length; i++) { + if (num >= si[i].value) { + return ( + (num / si[i].value) + .toFixed(digits) + .replace(/\.0+$|(\.[0-9]*[1-9])0+$/, '$1') + si[i].symbol + ); + } + } + return num.toString(); } /** @@ -57,9 +57,9 @@ export function numberFormatter(num: number, digits: number) { * @param {number} num */ export function toThousandFilter(num: number) { - return (+num || 0) - .toString() - .replace(/^-?\d+/g, m => m.replace(/(?=(?!\b)(\d{3})+$)/g, ',')); + return (+num || 0) + .toString() + .replace(/^-?\d+/g, m => m.replace(/(?=(?!\b)(\d{3})+$)/g, ',')); } /** @@ -67,7 +67,7 @@ export function toThousandFilter(num: number) { * @param {String} string */ export function uppercaseFirst(string: string) { - return string.charAt(0).toUpperCase() + string.slice(1); + return string.charAt(0).toUpperCase() + string.slice(1); } /** @@ -76,5 +76,5 @@ export function uppercaseFirst(string: string) { * @param {number} num */ export function moneyFormatter(num: number) { - return '¥' + (isNaN(num) ? 0.0 : parseFloat((num / 100).toFixed(2))); + return '¥' + (isNaN(num) ? 0.0 : parseFloat((num / 100).toFixed(2))); } diff --git a/src/utils/i18n.ts b/src/utils/i18n.ts index bc765c28..b95552a0 100644 --- a/src/utils/i18n.ts +++ b/src/utils/i18n.ts @@ -2,11 +2,11 @@ import i18n from '@/lang/index'; export function generateTitle(title: any) { - // 判断是否存在国际化配置,如果没有原生返回 - const hasKey = i18n.global.te('route.' + title); - if (hasKey) { - const translatedTitle = i18n.global.t('route.' + title); - return translatedTitle; - } - return title; + // 判断是否存在国际化配置,如果没有原生返回 + const hasKey = i18n.global.te('route.' + title); + if (hasKey) { + const translatedTitle = i18n.global.t('route.' + title); + return translatedTitle; + } + return title; } diff --git a/src/utils/index.ts b/src/utils/index.ts index 080f8a18..fee5a09b 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -5,7 +5,7 @@ * @returns {boolean} */ export function hasClass(ele: HTMLElement, cls: string) { - return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')); + return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')); } /** @@ -14,7 +14,7 @@ export function hasClass(ele: HTMLElement, cls: string) { * @param {string} cls */ export function addClass(ele: HTMLElement, cls: string) { - if (!hasClass(ele, cls)) ele.className += ' ' + cls; + if (!hasClass(ele, cls)) ele.className += ' ' + cls; } /** @@ -23,25 +23,25 @@ export function addClass(ele: HTMLElement, cls: string) { * @param {string} cls */ export function removeClass(ele: HTMLElement, cls: string) { - if (hasClass(ele, cls)) { - const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)'); - ele.className = ele.className.replace(reg, ' '); - } + if (hasClass(ele, cls)) { + const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)'); + ele.className = ele.className.replace(reg, ' '); + } } export function mix(color1: string, color2: string, weight: number) { - weight = Math.max(Math.min(Number(weight), 1), 0); - const r1 = parseInt(color1.substring(1, 3), 16); - const g1 = parseInt(color1.substring(3, 5), 16); - const b1 = parseInt(color1.substring(5, 7), 16); - const r2 = parseInt(color2.substring(1, 3), 16); - const g2 = parseInt(color2.substring(3, 5), 16); - const b2 = parseInt(color2.substring(5, 7), 16); - const r = Math.round(r1 * (1 - weight) + r2 * weight); - const g = Math.round(g1 * (1 - weight) + g2 * weight); - const b = Math.round(b1 * (1 - weight) + b2 * weight); - const rStr = ('0' + (r || 0).toString(16)).slice(-2); - const gStr = ('0' + (g || 0).toString(16)).slice(-2); - const bStr = ('0' + (b || 0).toString(16)).slice(-2); - return '#' + rStr + gStr + bStr; + weight = Math.max(Math.min(Number(weight), 1), 0); + const r1 = parseInt(color1.substring(1, 3), 16); + const g1 = parseInt(color1.substring(3, 5), 16); + const b1 = parseInt(color1.substring(5, 7), 16); + const r2 = parseInt(color2.substring(1, 3), 16); + const g2 = parseInt(color2.substring(3, 5), 16); + const b2 = parseInt(color2.substring(5, 7), 16); + const r = Math.round(r1 * (1 - weight) + r2 * weight); + const g = Math.round(g1 * (1 - weight) + g2 * weight); + const b = Math.round(b1 * (1 - weight) + b2 * weight); + const rStr = ('0' + (r || 0).toString(16)).slice(-2); + const gStr = ('0' + (g || 0).toString(16)).slice(-2); + const bStr = ('0' + (b || 0).toString(16)).slice(-2); + return '#' + rStr + gStr + bStr; } diff --git a/src/utils/request.ts b/src/utils/request.ts index 34235766..5af8335c 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -5,64 +5,64 @@ import useStore from '@/store'; // 创建 axios 实例 const service = axios.create({ - baseURL: import.meta.env.VITE_APP_BASE_API, - timeout: 50000, - headers: { 'Content-Type': 'application/json;charset=utf-8' } + baseURL: import.meta.env.VITE_APP_BASE_API, + timeout: 50000, + headers: { 'Content-Type': 'application/json;charset=utf-8' } }); // 请求拦截器 service.interceptors.request.use( - (config: AxiosRequestConfig) => { - if (!config.headers) { - throw new Error( - `Expected 'config' and 'config.headers' not to be undefined` - ); - } - const { user } = useStore(); - if (user.token) { - config.headers.Authorization = `${localStorage.get('token')}`; - } - return config; - }, - error => { - return Promise.reject(error); - } + (config: AxiosRequestConfig) => { + if (!config.headers) { + throw new Error( + `Expected 'config' and 'config.headers' not to be undefined` + ); + } + const { user } = useStore(); + if (user.token) { + config.headers.Authorization = `${localStorage.get('token')}`; + } + return config; + }, + error => { + return Promise.reject(error); + } ); // 响应拦截器 service.interceptors.response.use( - (response: AxiosResponse) => { - const { code, msg } = response.data; - if (code === '00000') { - return response.data; - } else { - // 响应数据为二进制流处理(Excel导出) - if (response.data instanceof ArrayBuffer) { - return response; - } + (response: AxiosResponse) => { + const { code, msg } = response.data; + if (code === '00000') { + return response.data; + } else { + // 响应数据为二进制流处理(Excel导出) + if (response.data instanceof ArrayBuffer) { + return response; + } - ElMessage({ - message: msg || '系统出错', - type: 'error' - }); - return Promise.reject(new Error(msg || 'Error')); - } - }, - error => { - const { code, msg } = error.response.data; - if (code === 'A0230') { - // token 过期 - localStorage.clear(); // 清除浏览器全部缓存 - window.location.href = '/'; // 跳转登录页 - ElMessageBox.alert('当前页面已失效,请重新登录', '提示', {}); - } else { - ElMessage({ - message: msg || '系统出错', - type: 'error' - }); - } - return Promise.reject(new Error(msg || 'Error')); - } + ElMessage({ + message: msg || '系统出错', + type: 'error' + }); + return Promise.reject(new Error(msg || 'Error')); + } + }, + error => { + const { code, msg } = error.response.data; + if (code === 'A0230') { + // token 过期 + localStorage.clear(); // 清除浏览器全部缓存 + window.location.href = '/'; // 跳转登录页 + ElMessageBox.alert('当前页面已失效,请重新登录', '提示', {}); + } else { + ElMessage({ + message: msg || '系统出错', + type: 'error' + }); + } + return Promise.reject(new Error(msg || 'Error')); + } ); // 导出 axios 实例 diff --git a/src/utils/resize.ts b/src/utils/resize.ts index e2710ca8..4cfdab84 100644 --- a/src/utils/resize.ts +++ b/src/utils/resize.ts @@ -1,72 +1,72 @@ import { ref } from 'vue'; export default function () { - const chart = ref(); - const sidebarElm = ref(); + const chart = ref(); + const sidebarElm = ref(); - const chartResizeHandler = () => { - if (chart.value) { - chart.value.resize(); - } - }; + const chartResizeHandler = () => { + if (chart.value) { + chart.value.resize(); + } + }; - const sidebarResizeHandler = (e: TransitionEvent) => { - if (e.propertyName === 'width') { - chartResizeHandler(); - } - }; + const sidebarResizeHandler = (e: TransitionEvent) => { + if (e.propertyName === 'width') { + chartResizeHandler(); + } + }; - const initResizeEvent = () => { - window.addEventListener('resize', chartResizeHandler); - }; + const initResizeEvent = () => { + window.addEventListener('resize', chartResizeHandler); + }; - const destroyResizeEvent = () => { - window.removeEventListener('resize', chartResizeHandler); - }; + const destroyResizeEvent = () => { + window.removeEventListener('resize', chartResizeHandler); + }; - const initSidebarResizeEvent = () => { - sidebarElm.value = document.getElementsByClassName('sidebar-container')[0]; - if (sidebarElm.value) { - sidebarElm.value.addEventListener( - 'transitionend', - sidebarResizeHandler as EventListener - ); - } - }; + const initSidebarResizeEvent = () => { + sidebarElm.value = document.getElementsByClassName('sidebar-container')[0]; + if (sidebarElm.value) { + sidebarElm.value.addEventListener( + 'transitionend', + sidebarResizeHandler as EventListener + ); + } + }; - const destroySidebarResizeEvent = () => { - if (sidebarElm.value) { - sidebarElm.value.removeEventListener( - 'transitionend', - sidebarResizeHandler as EventListener - ); - } - }; + const destroySidebarResizeEvent = () => { + if (sidebarElm.value) { + sidebarElm.value.removeEventListener( + 'transitionend', + sidebarResizeHandler as EventListener + ); + } + }; - const mounted = () => { - initResizeEvent(); - initSidebarResizeEvent(); - }; + const mounted = () => { + initResizeEvent(); + initSidebarResizeEvent(); + }; - const beforeDestroy = () => { - destroyResizeEvent(); - destroySidebarResizeEvent(); - }; + const beforeDestroy = () => { + destroyResizeEvent(); + destroySidebarResizeEvent(); + }; - const activated = () => { - initResizeEvent(); - initSidebarResizeEvent(); - }; + const activated = () => { + initResizeEvent(); + initSidebarResizeEvent(); + }; - const deactivated = () => { - destroyResizeEvent(); - destroySidebarResizeEvent(); - }; + const deactivated = () => { + destroyResizeEvent(); + destroySidebarResizeEvent(); + }; - return { - chart, - mounted, - beforeDestroy, - activated, - deactivated - }; + return { + chart, + mounted, + beforeDestroy, + activated, + deactivated + }; } diff --git a/src/utils/scroll-to.ts b/src/utils/scroll-to.ts index 1ff96482..591e3ec0 100644 --- a/src/utils/scroll-to.ts +++ b/src/utils/scroll-to.ts @@ -1,22 +1,22 @@ const easeInOutQuad = (t: number, b: number, c: number, d: number) => { - t /= d / 2; - if (t < 1) { - return (c / 2) * t * t + b; - } - t--; - return (-c / 2) * (t * (t - 2) - 1) + b; + t /= d / 2; + if (t < 1) { + return (c / 2) * t * t + b; + } + t--; + return (-c / 2) * (t * (t - 2) - 1) + b; }; // requestAnimationFrame for Smart Animating http://goo.gl/sx5sts const requestAnimFrame = (function () { - return ( - window.requestAnimationFrame || - (window as any).webkitRequestAnimationFrame || - (window as any).mozRequestAnimationFrame || - function (callback) { - window.setTimeout(callback, 1000 / 60); - } - ); + return ( + window.requestAnimationFrame || + (window as any).webkitRequestAnimationFrame || + (window as any).mozRequestAnimationFrame || + function (callback) { + window.setTimeout(callback, 1000 / 60); + } + ); })(); /** @@ -24,17 +24,17 @@ const requestAnimFrame = (function () { * @param {number} amount */ const move = (amount: number) => { - document.documentElement.scrollTop = amount; - (document.body.parentNode as HTMLElement).scrollTop = amount; - document.body.scrollTop = amount; + document.documentElement.scrollTop = amount; + (document.body.parentNode as HTMLElement).scrollTop = amount; + document.body.scrollTop = amount; }; const position = () => { - return ( - document.documentElement.scrollTop || - (document.body.parentNode as HTMLElement).scrollTop || - document.body.scrollTop - ); + return ( + document.documentElement.scrollTop || + (document.body.parentNode as HTMLElement).scrollTop || + document.body.scrollTop + ); }; /** @@ -43,27 +43,27 @@ const position = () => { * @param {Function} callback */ export const scrollTo = (to: number, duration: number, callback?: any) => { - const start = position(); - const change = to - start; - const increment = 20; - let currentTime = 0; - duration = typeof duration === 'undefined' ? 500 : duration; - const animateScroll = function () { - // increment the time - currentTime += increment; - // find the value with the quadratic in-out easing function - const val = easeInOutQuad(currentTime, start, change, duration); - // move the document.body - move(val); - // do the animation unless its over - if (currentTime < duration) { - requestAnimFrame(animateScroll); - } else { - if (callback && typeof callback === 'function') { - // the animation is done so lets callback - callback(); - } - } - }; - animateScroll(); + const start = position(); + const change = to - start; + const increment = 20; + let currentTime = 0; + duration = typeof duration === 'undefined' ? 500 : duration; + const animateScroll = function () { + // increment the time + currentTime += increment; + // find the value with the quadratic in-out easing function + const val = easeInOutQuad(currentTime, start, change, duration); + // move the document.body + move(val); + // do the animation unless its over + if (currentTime < duration) { + requestAnimFrame(animateScroll); + } else { + if (callback && typeof callback === 'function') { + // the animation is done so lets callback + callback(); + } + } + }; + animateScroll(); }; diff --git a/src/utils/storage.ts b/src/utils/storage.ts index 3ba50bdb..6e348fb4 100644 --- a/src/utils/storage.ts +++ b/src/utils/storage.ts @@ -2,44 +2,44 @@ * window.localStorage 浏览器永久缓存 */ export const localStorage = { - // 设置永久缓存 - set(key: string, val: any) { - window.localStorage.setItem(key, JSON.stringify(val)); - }, - // 获取永久缓存 - get(key: string) { - const json: any = window.localStorage.getItem(key); - return JSON.parse(json); - }, - // 移除永久缓存 - remove(key: string) { - window.localStorage.removeItem(key); - }, - // 移除全部永久缓存 - clear() { - window.localStorage.clear(); - } + // 设置永久缓存 + set(key: string, val: any) { + window.localStorage.setItem(key, JSON.stringify(val)); + }, + // 获取永久缓存 + get(key: string) { + const json: any = window.localStorage.getItem(key); + return JSON.parse(json); + }, + // 移除永久缓存 + remove(key: string) { + window.localStorage.removeItem(key); + }, + // 移除全部永久缓存 + clear() { + window.localStorage.clear(); + } }; /** * window.sessionStorage 浏览器临时缓存 */ export const sessionStorage = { - // 设置临时缓存 - set(key: string, val: any) { - window.sessionStorage.setItem(key, JSON.stringify(val)); - }, - // 获取临时缓存 - get(key: string) { - const json: any = window.sessionStorage.getItem(key); - return JSON.parse(json); - }, - // 移除临时缓存 - remove(key: string) { - window.sessionStorage.removeItem(key); - }, - // 移除全部临时缓存 - clear() { - window.sessionStorage.clear(); - } + // 设置临时缓存 + set(key: string, val: any) { + window.sessionStorage.setItem(key, JSON.stringify(val)); + }, + // 获取临时缓存 + get(key: string) { + const json: any = window.sessionStorage.getItem(key); + return JSON.parse(json); + }, + // 移除临时缓存 + remove(key: string) { + window.sessionStorage.removeItem(key); + }, + // 移除全部临时缓存 + clear() { + window.sessionStorage.clear(); + } }; diff --git a/src/utils/validate.ts b/src/utils/validate.ts index 264b7e63..bc8cceec 100644 --- a/src/utils/validate.ts +++ b/src/utils/validate.ts @@ -7,6 +7,6 @@ * @returns {Boolean} */ export function isExternal(path: string) { - const isExternal = /^(https?:|http?:|mailto:|tel:)/.test(path); - return isExternal; + const isExternal = /^(https?:|http?:|mailto:|tel:)/.test(path); + return isExternal; } diff --git a/src/views/dashboard/components/Chart/BarChart.vue b/src/views/dashboard/components/Chart/BarChart.vue index fee2e66c..f8ecfe3e 100644 --- a/src/views/dashboard/components/Chart/BarChart.vue +++ b/src/views/dashboard/components/Chart/BarChart.vue @@ -1,174 +1,174 @@ diff --git a/src/views/dashboard/components/Chart/FunnelChart.vue b/src/views/dashboard/components/Chart/FunnelChart.vue index 2a7acb64..b2d64fa1 100644 --- a/src/views/dashboard/components/Chart/FunnelChart.vue +++ b/src/views/dashboard/components/Chart/FunnelChart.vue @@ -1,134 +1,134 @@ diff --git a/src/views/dashboard/components/Chart/PieChart.vue b/src/views/dashboard/components/Chart/PieChart.vue index eaeddaed..04611e47 100644 --- a/src/views/dashboard/components/Chart/PieChart.vue +++ b/src/views/dashboard/components/Chart/PieChart.vue @@ -1,114 +1,114 @@ diff --git a/src/views/dashboard/components/Chart/RadarChart.vue b/src/views/dashboard/components/Chart/RadarChart.vue index 05985d95..db0f4314 100644 --- a/src/views/dashboard/components/Chart/RadarChart.vue +++ b/src/views/dashboard/components/Chart/RadarChart.vue @@ -1,133 +1,133 @@ diff --git a/src/views/dashboard/components/Project/index.vue b/src/views/dashboard/components/Project/index.vue index 2ca397c8..60d1d429 100644 --- a/src/views/dashboard/components/Project/index.vue +++ b/src/views/dashboard/components/Project/index.vue @@ -1,119 +1,119 @@ diff --git a/src/views/dashboard/components/Team/index.vue b/src/views/dashboard/components/Team/index.vue index bd69a9c8..16afd332 100644 --- a/src/views/dashboard/components/Team/index.vue +++ b/src/views/dashboard/components/Team/index.vue @@ -1,75 +1,75 @@ diff --git a/src/views/error-page/404.vue b/src/views/error-page/404.vue index f576a8e5..3000e0e7 100644 --- a/src/views/error-page/404.vue +++ b/src/views/error-page/404.vue @@ -1,252 +1,252 @@ diff --git a/src/views/lab/seata/index.vue b/src/views/lab/seata/index.vue index 5a717f19..553180c0 100644 --- a/src/views/lab/seata/index.vue +++ b/src/views/lab/seata/index.vue @@ -1,7 +1,7 @@ @@ -9,47 +9,47 @@ export default { import { reactive, onMounted, toRefs } from 'vue'; import SvgIcon from '@/components/SvgIcon/index.vue'; import { - Money, - Refresh, - RefreshLeft, - Right, - CircleCheckFilled, - CircleCloseFilled + Money, + Refresh, + RefreshLeft, + Right, + CircleCheckFilled, + CircleCloseFilled } from '@element-plus/icons-vue'; import { payOrder, getSeataData, resetSeataData } from '@/api/lab/seata'; import { ElMessage, ElMessageBox } from 'element-plus'; import { SeataFormData } from '@/types'; const state = reactive({ - // 保留改变前数据 - cacheSeataData: { - status: undefined, - stockNum: undefined, - balance: undefined - }, - seataData: { - orderInfo: { - orderSn: undefined, - status: undefined - }, - stockInfo: { - name: undefined, - picUrl: undefined, - stockNum: undefined - }, - accountInfo: { - nickName: undefined, - avatarUrl: undefined, - balance: undefined - } - }, + // 保留改变前数据 + cacheSeataData: { + status: undefined, + stockNum: undefined, + balance: undefined + }, + seataData: { + orderInfo: { + orderSn: undefined, + status: undefined + }, + stockInfo: { + name: undefined, + picUrl: undefined, + stockNum: undefined + }, + accountInfo: { + nickName: undefined, + avatarUrl: undefined, + balance: undefined + } + }, - loading: false, + loading: false, - submitData: { - openTx: true, // 是否开启事务 - orderEx: true // 订单修改异常 - } as SeataFormData + submitData: { + openTx: true, // 是否开启事务 + orderEx: true // 订单修改异常 + } as SeataFormData }); const { cacheSeataData, seataData, loading, submitData } = toRefs(state); @@ -58,318 +58,318 @@ const { cacheSeataData, seataData, loading, submitData } = toRefs(state); * 订单支付(模拟) */ function handleOrderPay() { - // 数据校验 - if ( - (seataData.value.stockInfo.stockNum && - seataData.value.stockInfo.stockNum != 999) || - (seataData.value.accountInfo.balance && - seataData.value.accountInfo.balance != 1000000000) || - (seataData.value.orderInfo.status && - seataData.value.orderInfo.status != 101) - ) { - ElMessageBox.confirm( - '检查到当前数据已被污染,请先重置数据后尝试提交?', - '警告', - { - confirmButtonText: '重置数据', - cancelButtonText: '取消', - type: 'warning' - } - ) - .then(() => { - handleDataReset(); - }) - .catch(() => {}); - } else { - // 订单支付模拟提交 + // 数据校验 + if ( + (seataData.value.stockInfo.stockNum && + seataData.value.stockInfo.stockNum != 999) || + (seataData.value.accountInfo.balance && + seataData.value.accountInfo.balance != 1000000000) || + (seataData.value.orderInfo.status && + seataData.value.orderInfo.status != 101) + ) { + ElMessageBox.confirm( + '检查到当前数据已被污染,请先重置数据后尝试提交?', + '警告', + { + confirmButtonText: '重置数据', + cancelButtonText: '取消', + type: 'warning' + } + ) + .then(() => { + handleDataReset(); + }) + .catch(() => {}); + } else { + // 订单支付模拟提交 - loading.value = true; - payOrder(submitData.value) - .then(() => { - ElMessage.success('订单支付成功'); - }) - .finally(() => { - cacheSeataData.value = { - status: seataData.value.orderInfo.status, - stockNum: seataData.value.stockInfo.stockNum, - balance: seataData.value.accountInfo.balance - }; - loadData(); - }); - } + loading.value = true; + payOrder(submitData.value) + .then(() => { + ElMessage.success('订单支付成功'); + }) + .finally(() => { + cacheSeataData.value = { + status: seataData.value.orderInfo.status, + stockNum: seataData.value.stockInfo.stockNum, + balance: seataData.value.accountInfo.balance + }; + loadData(); + }); + } } /** * 加载数据 */ function loadData() { - loading.value = true; - getSeataData().then((response: any) => { - seataData.value = response.data; - loading.value = false; - }); + loading.value = true; + getSeataData().then((response: any) => { + seataData.value = response.data; + loading.value = false; + }); } /** * 刷新数据 */ function handleDataRefresh() { - loading.value = true; - loadData(); + loading.value = true; + loadData(); } /** * 数据重置 */ function handleDataReset() { - loading.value = true; - resetSeataData().then(() => { - ElMessage.success('数据还原成功'); - loading.value = false; - cacheSeataData.value = { - status: undefined, - stockNum: undefined, - balance: undefined - }; - loadData(); - }); + loading.value = true; + resetSeataData().then(() => { + ElMessage.success('数据还原成功'); + loading.value = false; + cacheSeataData.value = { + status: undefined, + stockNum: undefined, + balance: undefined + }; + loadData(); + }); } onMounted(() => { - // 第一次加载重置数据测试 - handleDataReset(); + // 第一次加载重置数据测试 + handleDataReset(); }); diff --git a/src/views/login/index.vue b/src/views/login/index.vue index e68f7fe5..f75f476d 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -1,107 +1,107 @@ @@ -258,77 +258,77 @@ $cursor: #fff; /* reset element-ui css */ .login-container { - .title-container { - position: relative; + .title-container { + position: relative; - .title { - font-size: 26px; - color: $light_gray; - margin: 0px auto 40px auto; - text-align: center; - font-weight: bold; - } + .title { + font-size: 26px; + color: $light_gray; + margin: 0px auto 40px auto; + text-align: center; + font-weight: bold; + } - .set-language { - color: #fff; - position: absolute; - top: 3px; - font-size: 18px; - right: 0px; - cursor: pointer; - } - } + .set-language { + color: #fff; + position: absolute; + top: 3px; + font-size: 18px; + right: 0px; + cursor: pointer; + } + } - .el-input { - display: inline-block; - height: 47px; - width: 85%; - .el-input__wrapper { - padding: 0; - background: transparent; - box-shadow: none; - .el-input__inner { - background: transparent; - border: 0px; - -webkit-appearance: none; - border-radius: 0px; - padding: 12px 5px 12px 15px; - color: $light_gray; - height: 47px; - caret-color: $cursor; + .el-input { + display: inline-block; + height: 47px; + width: 85%; + .el-input__wrapper { + padding: 0; + background: transparent; + box-shadow: none; + .el-input__inner { + background: transparent; + border: 0px; + -webkit-appearance: none; + border-radius: 0px; + padding: 12px 5px 12px 15px; + color: $light_gray; + height: 47px; + caret-color: $cursor; - &:-webkit-autofill { - box-shadow: 0 0 0px 1000px $bg inset !important; - -webkit-text-fill-color: $cursor !important; - } - } - } - } + &:-webkit-autofill { + box-shadow: 0 0 0px 1000px $bg inset !important; + -webkit-text-fill-color: $cursor !important; + } + } + } + } - .el-input__inner { - &:hover { - border-color: var(--el-input-hover-border, var(--el-border-color-hover)); - box-shadow: none; - } + .el-input__inner { + &:hover { + border-color: var(--el-input-hover-border, var(--el-border-color-hover)); + box-shadow: none; + } - box-shadow: none; - } + box-shadow: none; + } - .el-form-item { - border: 1px solid rgba(255, 255, 255, 0.1); - background: rgba(0, 0, 0, 0.1); - border-radius: 5px; - color: #454545; - } + .el-form-item { + border: 1px solid rgba(255, 255, 255, 0.1); + background: rgba(0, 0, 0, 0.1); + border-radius: 5px; + color: #454545; + } - .copyright { - width: 100%; - position: absolute; - bottom: 0; - font-size: 12px; - text-align: center; - color: #cccccc; - } + .copyright { + width: 100%; + position: absolute; + bottom: 0; + font-size: 12px; + text-align: center; + color: #cccccc; + } } @@ -338,72 +338,72 @@ $dark_gray: #889aa4; $light_gray: #eee; .login-container { - min-height: 100%; - width: 100%; - background-color: $bg; - overflow: hidden; + min-height: 100%; + width: 100%; + background-color: $bg; + overflow: hidden; - .login-form { - position: relative; - width: 520px; - max-width: 100%; - padding: 160px 35px 0; - margin: 0 auto; - overflow: hidden; - } + .login-form { + position: relative; + width: 520px; + max-width: 100%; + padding: 160px 35px 0; + margin: 0 auto; + overflow: hidden; + } - .tips { - font-size: 14px; - color: #fff; - margin-bottom: 10px; + .tips { + font-size: 14px; + color: #fff; + margin-bottom: 10px; - span { - &:first-of-type { - margin-right: 16px; - } - } - } + span { + &:first-of-type { + margin-right: 16px; + } + } + } - .svg-container { - padding: 6px 5px 6px 15px; - color: $dark_gray; - vertical-align: middle; - width: 30px; - display: inline-block; - } + .svg-container { + padding: 6px 5px 6px 15px; + color: $dark_gray; + vertical-align: middle; + width: 30px; + display: inline-block; + } - .title-container { - position: relative; + .title-container { + position: relative; - .title { - font-size: 26px; - color: $light_gray; - margin: 0px auto 40px auto; - text-align: center; - font-weight: bold; - } - } + .title { + font-size: 26px; + color: $light_gray; + margin: 0px auto 40px auto; + text-align: center; + font-weight: bold; + } + } - .show-pwd { - position: absolute; - right: 10px; - top: 7px; - font-size: 16px; - color: $dark_gray; - cursor: pointer; - user-select: none; - } + .show-pwd { + position: absolute; + right: 10px; + top: 7px; + font-size: 16px; + color: $dark_gray; + cursor: pointer; + user-select: none; + } - .captcha { - position: absolute; - right: 0; - top: 0; + .captcha { + position: absolute; + right: 0; + top: 0; - img { - height: 52px; - cursor: pointer; - vertical-align: middle; - } - } + img { + height: 52px; + cursor: pointer; + vertical-align: middle; + } + } } diff --git a/src/views/nested/level1/index.vue b/src/views/nested/level1/index.vue index e5d07358..7daf19c2 100644 --- a/src/views/nested/level1/index.vue +++ b/src/views/nested/level1/index.vue @@ -1,7 +1,7 @@ diff --git a/src/views/nested/level1/level2/index.vue b/src/views/nested/level1/level2/index.vue index 4c21daa3..abcc3a7e 100644 --- a/src/views/nested/level1/level2/index.vue +++ b/src/views/nested/level1/level2/index.vue @@ -1,7 +1,7 @@ diff --git a/src/views/nested/level1/level2/level3/index1.vue b/src/views/nested/level1/level2/level3/index1.vue index 64cb2376..888f58e9 100644 --- a/src/views/nested/level1/level2/level3/index1.vue +++ b/src/views/nested/level1/level2/level3/index1.vue @@ -1,5 +1,5 @@ diff --git a/src/views/nested/level1/level2/level3/index2.vue b/src/views/nested/level1/level2/level3/index2.vue index b027cd25..a99c98e9 100644 --- a/src/views/nested/level1/level2/level3/index2.vue +++ b/src/views/nested/level1/level2/level3/index2.vue @@ -1,5 +1,5 @@ diff --git a/src/views/oms/order/index.vue b/src/views/oms/order/index.vue index f15e84d0..e0f5a550 100644 --- a/src/views/oms/order/index.vue +++ b/src/views/oms/order/index.vue @@ -1,7 +1,7 @@ @@ -15,218 +15,218 @@ import { Search, Refresh } from '@element-plus/icons-vue'; const queryFormRef = ref(ElForm); const orderSourceMap = { - 1: '微信小程序', - 2: 'APP', - 3: 'PC' + 1: '微信小程序', + 2: 'APP', + 3: 'PC' }; const orderStatusMap = { - 101: '待付款', - 102: '用户取消', - 103: '系统取消', - 201: '已付款', - 202: '申请退款', - 203: '已退款', - 301: '待发货', - 401: '已发货', - 501: '用户收货', - 502: '系统收货', - 901: '已完成' + 101: '待付款', + 102: '用户取消', + 103: '系统取消', + 201: '已付款', + 202: '申请退款', + 203: '已退款', + 301: '待发货', + 401: '已发货', + 501: '用户收货', + 502: '系统收货', + 901: '已完成' }; const payTypeMap = { - 1: '支付宝', - 2: '微信', - 3: '会员余额' + 1: '支付宝', + 2: '微信', + 3: '会员余额' }; const state = reactive({ - loading: false, - ids: [], - single: true, - multiple: true, - dateRange: [], - queryParams: { - pageNum: 1, - pageSize: 10 - } as OrderQueryParam, - orderList: [] as Order[], - total: 0, - dialog: { - title: '订单详情', - visible: false - } as Dialog, - dialogVisible: false, - orderDetail: { - order: { - refundAmount: undefined, - refundType: undefined, - refundNote: undefined, - gmtRefund: undefined, - confirmTime: undefined, - gmtDelivery: undefined, - shipSn: undefined, - shipChannel: undefined, - gmtPay: undefined, - integralPrice: undefined, - payChannel: undefined, - skuPrice: undefined, - couponPrice: undefined, - freightPrice: undefined, - orderPrice: undefined - }, - member: {}, - orderItems: [] - }, - orderSourceMap, - orderStatusMap, - payTypeMap + loading: false, + ids: [], + single: true, + multiple: true, + dateRange: [], + queryParams: { + pageNum: 1, + pageSize: 10 + } as OrderQueryParam, + orderList: [] as Order[], + total: 0, + dialog: { + title: '订单详情', + visible: false + } as Dialog, + dialogVisible: false, + orderDetail: { + order: { + refundAmount: undefined, + refundType: undefined, + refundNote: undefined, + gmtRefund: undefined, + confirmTime: undefined, + gmtDelivery: undefined, + shipSn: undefined, + shipChannel: undefined, + gmtPay: undefined, + integralPrice: undefined, + payChannel: undefined, + skuPrice: undefined, + couponPrice: undefined, + freightPrice: undefined, + orderPrice: undefined + }, + member: {}, + orderItems: [] + }, + orderSourceMap, + orderStatusMap, + payTypeMap }); const { loading, queryParams, orderList, total, dateRange } = toRefs(state); function handleQuery() { - state.loading = true; - listOrderPages(state.queryParams).then(({ data }) => { - state.orderList = data.list; - state.total = data.total; - state.loading = false; - }); + state.loading = true; + listOrderPages(state.queryParams).then(({ data }) => { + state.orderList = data.list; + state.total = data.total; + state.loading = false; + }); } function resetQuery() { - queryFormRef.value.resetFields(); - handleQuery(); + queryFormRef.value.resetFields(); + handleQuery(); } function viewDetail(row: any) { - state.dialog.visible = true; - getOrderDetail(row.id).then((response: any) => { - state.orderDetail = response.data; - }); + state.dialog.visible = true; + getOrderDetail(row.id).then((response: any) => { + state.orderDetail = response.data; + }); } onMounted(() => { - handleQuery(); + handleQuery(); }); diff --git a/src/views/pms/brand/index.vue b/src/views/pms/brand/index.vue index 3633d836..9e186fd9 100644 --- a/src/views/pms/brand/index.vue +++ b/src/views/pms/brand/index.vue @@ -1,7 +1,7 @@ @@ -11,11 +11,11 @@ import { ElForm, ElTable, ElMessage, ElMessageBox } from 'element-plus'; import { Search, Plus, Edit, Refresh, Delete } from '@element-plus/icons-vue'; import { BrandFormData, BrandItem, BrandQueryParam, Dialog } from '@/types'; import { - listBrandPages, - getBrandFormDetail, - updateBrand, - addBrand, - deleteBrands + listBrandPages, + getBrandFormDetail, + updateBrand, + addBrand, + deleteBrands } from '@/api/pms/brand'; import SingleUpload from '@/components/Upload/SingleUpload.vue'; @@ -23,253 +23,253 @@ const queryFormRef = ref(ElForm); // 属性名必须和元素的ref属性值一 const dataFormRef = ref(ElForm); // 属性名必须和元素的ref属性值一致 const state = reactive({ - loading: true, - // 选中ID数组 - ids: [], - // 非单个禁用 - single: true, - // 非多个禁用 - multiple: true, - queryParams: { - pageNum: 1, - pageSize: 10 - } as BrandQueryParam, - brandList: [] as BrandItem[], - total: 0, - dialog: {} as Dialog, - formData: { sort: 1 } as BrandFormData, - rules: { - name: [ - { - required: true, - message: '请输入品牌名称', - trigger: 'blur' - } - ] - } + loading: true, + // 选中ID数组 + ids: [], + // 非单个禁用 + single: true, + // 非多个禁用 + multiple: true, + queryParams: { + pageNum: 1, + pageSize: 10 + } as BrandQueryParam, + brandList: [] as BrandItem[], + total: 0, + dialog: {} as Dialog, + formData: { sort: 1 } as BrandFormData, + rules: { + name: [ + { + required: true, + message: '请输入品牌名称', + trigger: 'blur' + } + ] + } }); const { - loading, - multiple, - queryParams, - brandList, - total, - dialog, - formData, - rules + loading, + multiple, + queryParams, + brandList, + total, + dialog, + formData, + rules } = toRefs(state); function handleQuery() { - state.loading = true; - listBrandPages(state.queryParams).then(({ data }) => { - state.brandList = data.list; - state.total = data.total; - state.loading = false; - }); + state.loading = true; + listBrandPages(state.queryParams).then(({ data }) => { + state.brandList = data.list; + state.total = data.total; + state.loading = false; + }); } function resetQuery() { - queryFormRef.value.resetFields(); - handleQuery(); + queryFormRef.value.resetFields(); + handleQuery(); } function handleSelectionChange(selection: any) { - state.ids = selection.map((item: any) => item.id); - state.single = selection.length !== 1; - state.multiple = !selection.length; + state.ids = selection.map((item: any) => item.id); + state.single = selection.length !== 1; + state.multiple = !selection.length; } function handleAdd() { - state.dialog = { - title: '添加品牌', - visible: true - }; + state.dialog = { + title: '添加品牌', + visible: true + }; } function handleUpdate(row: any) { - state.dialog = { - title: '修改品牌', - visible: true - }; - const brandId = row.id || state.ids; - getBrandFormDetail(brandId).then(({ data }) => { - state.formData = data; - }); + state.dialog = { + title: '修改品牌', + visible: true + }; + const brandId = row.id || state.ids; + getBrandFormDetail(brandId).then(({ data }) => { + state.formData = data; + }); } /** * 表单提交 */ function submitForm() { - dataFormRef.value.validate((isValid: boolean) => { - if (isValid) { - if (state.formData.id) { - updateBrand(state.formData.id, state.formData).then(() => { - ElMessage.success('修改成功'); - cancel(); - handleQuery(); - }); - } else { - addBrand(state.formData).then(() => { - ElMessage.success('新增成功'); - cancel(); - handleQuery(); - }); - } - } - }); + dataFormRef.value.validate((isValid: boolean) => { + if (isValid) { + if (state.formData.id) { + updateBrand(state.formData.id, state.formData).then(() => { + ElMessage.success('修改成功'); + cancel(); + handleQuery(); + }); + } else { + addBrand(state.formData).then(() => { + ElMessage.success('新增成功'); + cancel(); + handleQuery(); + }); + } + } + }); } /** * 取消 */ function cancel() { - state.dialog.visible = false; - dataFormRef.value.resetFields(); + state.dialog.visible = false; + dataFormRef.value.resetFields(); } /** * 删除 */ function handleDelete(row: any) { - const ids = [row.id || state.ids].join(','); - ElMessageBox.confirm('确认删除已选中的数据项?', '警告', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }) - .then(() => { - deleteBrands(ids).then(() => { - ElMessage.success('删除成功'); - handleQuery(); - }); - }) - .catch(() => ElMessage.info('已取消删除')); + const ids = [row.id || state.ids].join(','); + ElMessageBox.confirm('确认删除已选中的数据项?', '警告', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }) + .then(() => { + deleteBrands(ids).then(() => { + ElMessage.success('删除成功'); + handleQuery(); + }); + }) + .catch(() => ElMessage.info('已取消删除')); } onMounted(() => { - handleQuery(); + handleQuery(); }); diff --git a/src/views/pms/category/components/Attribute.vue b/src/views/pms/category/components/Attribute.vue index a0fe5f0c..0b81e3c8 100644 --- a/src/views/pms/category/components/Attribute.vue +++ b/src/views/pms/category/components/Attribute.vue @@ -1,61 +1,61 @@ diff --git a/src/views/pms/category/components/Category.vue b/src/views/pms/category/components/Category.vue index a5a73f47..9cdbfc6f 100644 --- a/src/views/pms/category/components/Category.vue +++ b/src/views/pms/category/components/Category.vue @@ -1,117 +1,117 @@ diff --git a/src/views/pms/category/index.vue b/src/views/pms/category/index.vue index aacc72b5..367c8e91 100644 --- a/src/views/pms/category/index.vue +++ b/src/views/pms/category/index.vue @@ -1,7 +1,7 @@ @@ -13,67 +13,67 @@ import SvgIcon from '@/components/SvgIcon/index.vue'; import { reactive, toRefs } from 'vue'; const state = reactive({ - category: { - id: undefined, - name: '', - childrenLen: 0 - } + category: { + id: undefined, + name: '', + childrenLen: 0 + } }); const { category } = toRefs(state); function handleCategoryClick(categoryRow: any) { - if (categoryRow) { - state.category = { - id: categoryRow.id, - name: categoryRow.name, - childrenLen: categoryRow.children.length - }; - } else { - state.category = { - id: undefined, - name: '', - childrenLen: 0 - }; - } + if (categoryRow) { + state.category = { + id: categoryRow.id, + name: categoryRow.name, + childrenLen: categoryRow.children.length + }; + } else { + state.category = { + id: undefined, + name: '', + childrenLen: 0 + }; + } } diff --git a/src/views/pms/goods/components/GoodsAttribute.vue b/src/views/pms/goods/components/GoodsAttribute.vue index 4e0745b9..b56589f5 100644 --- a/src/views/pms/goods/components/GoodsAttribute.vue +++ b/src/views/pms/goods/components/GoodsAttribute.vue @@ -1,80 +1,80 @@ diff --git a/src/views/pms/goods/components/GoodsCategory.vue b/src/views/pms/goods/components/GoodsCategory.vue index 1081c319..65459f00 100644 --- a/src/views/pms/goods/components/GoodsCategory.vue +++ b/src/views/pms/goods/components/GoodsCategory.vue @@ -1,38 +1,38 @@ diff --git a/src/views/pms/goods/components/GoodsInfo.vue b/src/views/pms/goods/components/GoodsInfo.vue index 7afb33ed..1d6421f1 100644 --- a/src/views/pms/goods/components/GoodsInfo.vue +++ b/src/views/pms/goods/components/GoodsInfo.vue @@ -1,93 +1,93 @@ diff --git a/src/views/pms/goods/components/GoodsStock.vue b/src/views/pms/goods/components/GoodsStock.vue index ffab66e8..995d595d 100644 --- a/src/views/pms/goods/components/GoodsStock.vue +++ b/src/views/pms/goods/components/GoodsStock.vue @@ -1,193 +1,193 @@ diff --git a/src/views/pms/goods/detail.vue b/src/views/pms/goods/detail.vue index f03e4d28..80f90263 100644 --- a/src/views/pms/goods/detail.vue +++ b/src/views/pms/goods/detail.vue @@ -1,46 +1,46 @@ diff --git a/src/views/pms/goods/index.vue b/src/views/pms/goods/index.vue index f78eddc0..e5b31438 100644 --- a/src/views/pms/goods/index.vue +++ b/src/views/pms/goods/index.vue @@ -1,7 +1,7 @@ @@ -11,12 +11,12 @@ import { ElTable, ElMessage, ElMessageBox } from 'element-plus'; import { useRouter } from 'vue-router'; import { - Search, - Position, - Edit, - Refresh, - Delete, - View + Search, + Position, + Edit, + Refresh, + Delete, + View } from '@element-plus/icons-vue'; import { listGoodsPages, deleteGoods } from '@/api/pms/goods'; import { listCascadeCategories } from '@/api/pms/category'; @@ -27,250 +27,250 @@ const dataTableRef = ref(ElTable); const router = useRouter(); const state = reactive({ - // 遮罩层 - loading: true, - // 选中数组 - ids: [], - // 非单个禁用 - single: true, - // 非多个禁用 - multiple: true, - total: 0, - queryParams: { - pageNum: 1, - pageSize: 10 - } as GoodsQueryParam, - goodsList: [] as GoodsItem[], - categoryOptions: [], - goodDetail: undefined, - dialogVisible: false + // 遮罩层 + loading: true, + // 选中数组 + ids: [], + // 非单个禁用 + single: true, + // 非多个禁用 + multiple: true, + total: 0, + queryParams: { + pageNum: 1, + pageSize: 10 + } as GoodsQueryParam, + goodsList: [] as GoodsItem[], + categoryOptions: [], + goodDetail: undefined, + dialogVisible: false }); const { - loading, - multiple, - queryParams, - goodsList, - categoryOptions, - goodDetail, - total, - dialogVisible + loading, + multiple, + queryParams, + goodsList, + categoryOptions, + goodDetail, + total, + dialogVisible } = toRefs(state); function handleQuery() { - state.loading = true; - listGoodsPages(state.queryParams).then(({ data }) => { - state.goodsList = data.list; - state.total = data.total; - state.loading = false; - }); + state.loading = true; + listGoodsPages(state.queryParams).then(({ data }) => { + state.goodsList = data.list; + state.total = data.total; + state.loading = false; + }); } function resetQuery() { - state.queryParams = { - pageNum: 1, - pageSize: 10, - name: undefined, - categoryId: undefined - }; - handleQuery(); + state.queryParams = { + pageNum: 1, + pageSize: 10, + name: undefined, + categoryId: undefined + }; + handleQuery(); } function handleGoodsView(detail: any) { - state.goodDetail = detail; - state.dialogVisible = true; + state.goodDetail = detail; + state.dialogVisible = true; } function handleAdd() { - router.push({ path: 'goods-detail' }); + router.push({ path: 'goods-detail' }); } function handleUpdate(row: any) { - router.push({ - path: 'goods-detail', - query: { goodsId: row.id, categoryId: row.categoryId } - }); + router.push({ + path: 'goods-detail', + query: { goodsId: row.id, categoryId: row.categoryId } + }); } function handleDelete(row: any) { - const ids = row.id || state.ids.join(','); - ElMessageBox.confirm('是否确认删除选中的数据项?', '警告', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }) - .then(function () { - return deleteGoods(ids); - }) - .then(() => { - ElMessage.success('删除成功'); - handleQuery(); - }); + const ids = row.id || state.ids.join(','); + ElMessageBox.confirm('是否确认删除选中的数据项?', '警告', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }) + .then(function () { + return deleteGoods(ids); + }) + .then(() => { + ElMessage.success('删除成功'); + handleQuery(); + }); } function handleRowClick(row: any) { - dataTableRef.value.toggleRowSelection(row); + dataTableRef.value.toggleRowSelection(row); } function handleSelectionChange(selection: any) { - state.ids = selection.map((item: { id: any }) => item.id); - state.single = selection.length != 1; - state.multiple = !selection.length; + state.ids = selection.map((item: { id: any }) => item.id); + state.single = selection.length != 1; + state.multiple = !selection.length; } onMounted(() => { - listCascadeCategories({}).then(response => { - state.categoryOptions = ref(response.data); - }); - handleQuery(); + listCascadeCategories({}).then(response => { + state.categoryOptions = ref(response.data); + }); + handleQuery(); }); diff --git a/src/views/redirect/index.vue b/src/views/redirect/index.vue index 5558ffc3..47cad96e 100644 --- a/src/views/redirect/index.vue +++ b/src/views/redirect/index.vue @@ -1,5 +1,5 @@ @@ -11,11 +11,11 @@ import { ElForm, ElMessage, ElMessageBox } from 'element-plus'; import { Search, Plus, Edit, Refresh, Delete } from '@element-plus/icons-vue'; import SingleUpload from '@/components/Upload/SingleUpload.vue'; import { - listAdvertPages, - getAdvertFormDetail, - updateAdvert, - addAdvert, - deleteAdverts + listAdvertPages, + getAdvertFormDetail, + updateAdvert, + addAdvert, + deleteAdverts } from '@/api/sms/advert'; import { AdvertFormData, AdvertItem, AdvertQueryParam, Dialog } from '@/types'; @@ -23,275 +23,275 @@ const queryFormRef = ref(ElForm); // 属性名必须和元素的ref属性值一 const dataFormRef = ref(ElForm); // 属性名必须和元素的ref属性值一致 const state = reactive({ - loading: true, - // 选中ID数组 - ids: [], - // 非单个禁用 - single: true, - // 非多个禁用 - multiple: true, - queryParams: { pageNum: 1, pageSize: 10 } as AdvertQueryParam, - advertList: [] as AdvertItem[], - total: 0, - dialog: {} as Dialog, - formData: { - status: 1, - sort: 100 - } as AdvertFormData, - rules: { - title: [{ required: true, message: '请输入广告名称', trigger: 'blur' }], - beginTime: [{ required: true, message: '请填写开始时间', trigger: 'blur' }], - endTime: [{ required: true, message: '请填写结束时间', trigger: 'blur' }], - picUrl: [{ required: true, message: '请上传广告图片', trigger: 'blur' }] - } + loading: true, + // 选中ID数组 + ids: [], + // 非单个禁用 + single: true, + // 非多个禁用 + multiple: true, + queryParams: { pageNum: 1, pageSize: 10 } as AdvertQueryParam, + advertList: [] as AdvertItem[], + total: 0, + dialog: {} as Dialog, + formData: { + status: 1, + sort: 100 + } as AdvertFormData, + rules: { + title: [{ required: true, message: '请输入广告名称', trigger: 'blur' }], + beginTime: [{ required: true, message: '请填写开始时间', trigger: 'blur' }], + endTime: [{ required: true, message: '请填写结束时间', trigger: 'blur' }], + picUrl: [{ required: true, message: '请上传广告图片', trigger: 'blur' }] + } }); const { - loading, - multiple, - queryParams, - advertList, - total, - dialog, - formData, - rules + loading, + multiple, + queryParams, + advertList, + total, + dialog, + formData, + rules } = toRefs(state); function handleQuery() { - state.loading = true; - listAdvertPages(state.queryParams).then(({ data }) => { - state.advertList = data.list; - state.total = data.total; - state.loading = false; - }); + state.loading = true; + listAdvertPages(state.queryParams).then(({ data }) => { + state.advertList = data.list; + state.total = data.total; + state.loading = false; + }); } function resetQuery() { - queryFormRef.value.resetFields(); - handleQuery(); + queryFormRef.value.resetFields(); + handleQuery(); } function handleSelectionChange(selection: any) { - state.ids = selection.map((item: any) => item.id); - state.single = selection.length !== 1; - state.multiple = !selection.length; + state.ids = selection.map((item: any) => item.id); + state.single = selection.length !== 1; + state.multiple = !selection.length; } function handleAdd() { - state.dialog = { - title: '添加广告', - visible: true - }; + state.dialog = { + title: '添加广告', + visible: true + }; } function handleUpdate(row: any) { - state.dialog = { - title: '修改广告', - visible: true - }; - const advertId = row.id || state.ids; - getAdvertFormDetail(advertId).then(response => { - state.formData = response.data; - }); + state.dialog = { + title: '修改广告', + visible: true + }; + const advertId = row.id || state.ids; + getAdvertFormDetail(advertId).then(response => { + state.formData = response.data; + }); } function submitForm() { - dataFormRef.value.validate((valid: any) => { - if (valid) { - const avertId = state.formData.id; - if (avertId) { - updateAdvert(avertId, state.formData).then(() => { - ElMessage.success('修改成功'); - cancel(); - handleQuery(); - }); - } else { - addAdvert(state.formData).then(() => { - ElMessage.success('新增成功'); - cancel(); - handleQuery(); - }); - } - } - }); + dataFormRef.value.validate((valid: any) => { + if (valid) { + const avertId = state.formData.id; + if (avertId) { + updateAdvert(avertId, state.formData).then(() => { + ElMessage.success('修改成功'); + cancel(); + handleQuery(); + }); + } else { + addAdvert(state.formData).then(() => { + ElMessage.success('新增成功'); + cancel(); + handleQuery(); + }); + } + } + }); } function cancel() { - state.formData.id = undefined; - dataFormRef.value.resetFields(); - state.dialog.visible = false; + state.formData.id = undefined; + dataFormRef.value.resetFields(); + state.dialog.visible = false; } function handleDelete(row: any) { - const ids = [row.id || state.ids].join(','); - ElMessageBox.confirm('确认删除已选中的数据项?', '警告', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }) - .then(() => { - deleteAdverts(ids).then(() => { - ElMessage.success('删除成功'); - handleQuery(); - }); - }) - .catch(() => ElMessage.info('已取消删除')); + const ids = [row.id || state.ids].join(','); + ElMessageBox.confirm('确认删除已选中的数据项?', '警告', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }) + .then(() => { + deleteAdverts(ids).then(() => { + ElMessage.success('删除成功'); + handleQuery(); + }); + }) + .catch(() => ElMessage.info('已取消删除')); } onMounted(() => { - handleQuery(); + handleQuery(); }); diff --git a/src/views/system/client/index.vue b/src/views/system/client/index.vue index a2d7ba02..a880a30e 100644 --- a/src/views/system/client/index.vue +++ b/src/views/system/client/index.vue @@ -1,17 +1,17 @@ diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index 2fd74897..c97868b5 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -1,7 +1,7 @@ @@ -11,23 +11,23 @@ import { onMounted, reactive, ref, toRefs } from 'vue'; // API依赖 import { - getDeptDetail, - deleteDept, - updateDept, - addDept, - listSelectDepartments, - listTableDepartments + getDeptDetail, + deleteDept, + updateDept, + addDept, + listSelectDepartments, + listTableDepartments } from '@/api/system/dept'; // 组件依赖 import { Search, Plus, Edit, Refresh, Delete } from '@element-plus/icons-vue'; import { ElForm, ElMessage, ElMessageBox } from 'element-plus'; import { - DeptFormData, - DeptItem, - DeptQueryParam, - Dialog, - Option + DeptFormData, + DeptItem, + DeptQueryParam, + Dialog, + Option } from '@/types'; // DOM元素的引用声明定义 @@ -35,134 +35,134 @@ const queryFormRef = ref(ElForm); const dataFormRef = ref(ElForm); const state = reactive({ - // 选中ID数组 - ids: [] as number[], - // 非单个禁用 - single: true, - loading: true, - // 表格树数据 - deptList: [] as DeptItem[], - // 部门下拉选项 - deptOptions: [] as Option[], - // 弹窗属性 - dialog: { visible: false } as Dialog, - // 查询参数 - queryParams: {} as DeptQueryParam, - // 表单数据 - formData: { - sort: 1, - status: 1 - } as DeptFormData, - // 表单参数校验 - rules: { - parentId: [ - { required: true, message: '上级部门不能为空', trigger: 'blur' } - ], - name: [{ required: true, message: '部门名称不能为空', trigger: 'blur' }], - sort: [{ required: true, message: '显示排序不能为空', trigger: 'blur' }] - } + // 选中ID数组 + ids: [] as number[], + // 非单个禁用 + single: true, + loading: true, + // 表格树数据 + deptList: [] as DeptItem[], + // 部门下拉选项 + deptOptions: [] as Option[], + // 弹窗属性 + dialog: { visible: false } as Dialog, + // 查询参数 + queryParams: {} as DeptQueryParam, + // 表单数据 + formData: { + sort: 1, + status: 1 + } as DeptFormData, + // 表单参数校验 + rules: { + parentId: [ + { required: true, message: '上级部门不能为空', trigger: 'blur' } + ], + name: [{ required: true, message: '部门名称不能为空', trigger: 'blur' }], + sort: [{ required: true, message: '显示排序不能为空', trigger: 'blur' }] + } }); const { - single, - loading, - deptList, - deptOptions, - queryParams, - formData, - rules, - dialog + single, + loading, + deptList, + deptOptions, + queryParams, + formData, + rules, + dialog } = toRefs(state); /** * 部门查询 */ function handleQuery() { - state.loading = true; - listTableDepartments(state.queryParams).then(({ data }) => { - state.deptList = data; - state.loading = false; - }); + state.loading = true; + listTableDepartments(state.queryParams).then(({ data }) => { + state.deptList = data; + state.loading = false; + }); } /** * 重置查询 */ function resetQuery() { - queryFormRef.value.resetFields(); - handleQuery(); + queryFormRef.value.resetFields(); + handleQuery(); } function handleSelectionChange(selection: any) { - state.ids = selection.map((item: any) => item.id); - state.single = selection.length === 0; + state.ids = selection.map((item: any) => item.id); + state.single = selection.length === 0; } /** * 加载部门下拉数据源 */ async function loadDeptData() { - const deptOptions: any[] = []; - listSelectDepartments().then(response => { - const rootDeptOption = { - value: '0', - label: '顶级部门', - children: response.data - }; - deptOptions.push(rootDeptOption); - state.deptOptions = deptOptions; - }); + const deptOptions: any[] = []; + listSelectDepartments().then(response => { + const rootDeptOption = { + value: '0', + label: '顶级部门', + children: response.data + }; + deptOptions.push(rootDeptOption); + state.deptOptions = deptOptions; + }); } /** * 添加部门 */ function handleAdd(row: any) { - loadDeptData(); - state.formData.id = undefined; - state.formData.parentId = row.id; - state.dialog = { - title: '添加部门', - visible: true - }; + loadDeptData(); + state.formData.id = undefined; + state.formData.parentId = row.id; + state.dialog = { + title: '添加部门', + visible: true + }; } /** * 修改部门 */ async function handleUpdate(row: any) { - await loadDeptData(); - const deptId = row.id || state.ids; - state.dialog = { - title: '修改部门', - visible: true - }; - getDeptDetail(deptId).then((response: any) => { - state.formData = response.data; - }); + await loadDeptData(); + const deptId = row.id || state.ids; + state.dialog = { + title: '修改部门', + visible: true + }; + getDeptDetail(deptId).then((response: any) => { + state.formData = response.data; + }); } /** * 部门表单提交 */ function submitForm() { - dataFormRef.value.validate((valid: any) => { - if (valid) { - if (state.formData.id) { - updateDept(state.formData.id, state.formData).then(() => { - ElMessage.success('修改成功'); - cancel(); - handleQuery(); - }); - } else { - addDept(state.formData).then(() => { - ElMessage.success('新增成功'); - cancel(); - handleQuery(); - }); - } - } - }); + dataFormRef.value.validate((valid: any) => { + if (valid) { + if (state.formData.id) { + updateDept(state.formData.id, state.formData).then(() => { + ElMessage.success('修改成功'); + cancel(); + handleQuery(); + }); + } else { + addDept(state.formData).then(() => { + ElMessage.success('新增成功'); + cancel(); + handleQuery(); + }); + } + } + }); } /** @@ -171,181 +171,181 @@ function submitForm() { * @param row */ function handleDelete(row: any) { - const ids = [row.id || state.ids].join(','); - ElMessageBox.confirm(`确认删除已选中的数据项?`, '警告', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }) - .then(() => { - deleteDept(ids) - .then(() => { - handleQuery(); - ElMessage.success('删除成功'); - }) - .catch(() => { - console.log(`删除失败`); - }); - }) - .catch(() => ElMessage.info('已取消删除')); + const ids = [row.id || state.ids].join(','); + ElMessageBox.confirm(`确认删除已选中的数据项?`, '警告', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }) + .then(() => { + deleteDept(ids) + .then(() => { + handleQuery(); + ElMessage.success('删除成功'); + }) + .catch(() => { + console.log(`删除失败`); + }); + }) + .catch(() => ElMessage.info('已取消删除')); } /** * 取消/关闭弹窗 **/ function cancel() { - dataFormRef.value.resetFields(); - state.dialog.visible = false; + dataFormRef.value.resetFields(); + state.dialog.visible = false; } onMounted(() => { - handleQuery(); + handleQuery(); }); diff --git a/src/views/system/dict/components/Dict.vue b/src/views/system/dict/components/Dict.vue index 412d9d6b..91c126b8 100644 --- a/src/views/system/dict/components/Dict.vue +++ b/src/views/system/dict/components/Dict.vue @@ -1,142 +1,142 @@ diff --git a/src/views/system/dict/components/DictItem.vue b/src/views/system/dict/components/DictItem.vue index f32a3650..3b83ff35 100644 --- a/src/views/system/dict/components/DictItem.vue +++ b/src/views/system/dict/components/DictItem.vue @@ -1,300 +1,300 @@ diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue index 2d164f35..cc2f16b2 100644 --- a/src/views/system/dict/index.vue +++ b/src/views/system/dict/index.vue @@ -1,33 +1,33 @@ diff --git a/src/views/system/menu/components/Menu.vue b/src/views/system/menu/components/Menu.vue index 09b63d37..590a3466 100644 --- a/src/views/system/menu/components/Menu.vue +++ b/src/views/system/menu/components/Menu.vue @@ -1,217 +1,217 @@ diff --git a/src/views/system/menu/components/Perm.vue b/src/views/system/menu/components/Perm.vue index b0d2f696..4e8444b1 100644 --- a/src/views/system/menu/components/Perm.vue +++ b/src/views/system/menu/components/Perm.vue @@ -1,29 +1,29 @@ diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue index 38d52b55..e31eb23f 100644 --- a/src/views/system/menu/index.vue +++ b/src/views/system/menu/index.vue @@ -1,32 +1,32 @@ diff --git a/src/views/system/role/components/Menu.vue b/src/views/system/role/components/Menu.vue index 6b01f898..39e9d173 100644 --- a/src/views/system/role/components/Menu.vue +++ b/src/views/system/role/components/Menu.vue @@ -1,7 +1,7 @@ @@ -15,114 +15,114 @@ import { Option } from '@/types'; const emit = defineEmits(['menuClick']); const props = defineProps({ - role: { - type: Object, - default: () => {} - } + role: { + type: Object, + default: () => {} + } }); const menuRef = ref(ElTree); // 属性名必须和元素的ref属性值一致 watch( - () => props.role.id, - newVal => { - if (newVal) { - state.checkStrictly = true; - // 获取角色拥有的的菜单ID - listRoleMenuIds(newVal).then(({ data }) => { - menuRef.value.setCheckedKeys(data); - state.checkStrictly = false; - }); - } - } + () => props.role.id, + newVal => { + if (newVal) { + state.checkStrictly = true; + // 获取角色拥有的的菜单ID + listRoleMenuIds(newVal).then(({ data }) => { + menuRef.value.setCheckedKeys(data); + state.checkStrictly = false; + }); + } + } ); const state = reactive({ - expandedKeys: [], // 展开的节点 - menuOptions: [] as Option[], - checkStrictly: false, - isExpandAll: true, - refreshTree: true + expandedKeys: [], // 展开的节点 + menuOptions: [] as Option[], + checkStrictly: false, + isExpandAll: true, + refreshTree: true }); const { expandedKeys, menuOptions, checkStrictly, isExpandAll, refreshTree } = - toRefs(state); + toRefs(state); /** * 加载菜单树 */ async function loadMenuData() { - await listSelectMenus().then(({ data }) => { - state.menuOptions = data; - }); + await listSelectMenus().then(({ data }) => { + state.menuOptions = data; + }); } function handleNodeClick(node: any) { - emit('menuClick', node); + emit('menuClick', node); } /** * 展开/收缩 */ function toggleExpandAll() { - state.refreshTree = false; - state.isExpandAll = !state.isExpandAll; - nextTick(() => { - state.refreshTree = true; - }); + state.refreshTree = false; + state.isExpandAll = !state.isExpandAll; + nextTick(() => { + state.refreshTree = true; + }); } /** * 保存角色菜单 */ function handleSubmit() { - const checkedMenuIds = menuRef.value - .getCheckedNodes(false, true) - .map((node: any) => node.value); - updateRoleMenu(props.role.id, checkedMenuIds).then(() => { - ElMessage.success('提交成功'); - }); + const checkedMenuIds = menuRef.value + .getCheckedNodes(false, true) + .map((node: any) => node.value); + updateRoleMenu(props.role.id, checkedMenuIds).then(() => { + ElMessage.success('提交成功'); + }); } onMounted(() => { - loadMenuData(); + loadMenuData(); }); diff --git a/src/views/system/role/components/Perm.vue b/src/views/system/role/components/Perm.vue index be4e636b..35458c6c 100644 --- a/src/views/system/role/components/Perm.vue +++ b/src/views/system/role/components/Perm.vue @@ -1,53 +1,53 @@ diff --git a/src/views/system/role/components/Role.vue b/src/views/system/role/components/Role.vue index 1e44a134..563c11ba 100644 --- a/src/views/system/role/components/Role.vue +++ b/src/views/system/role/components/Role.vue @@ -1,18 +1,18 @@ diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue index 4243b730..61def509 100644 --- a/src/views/system/role/index.vue +++ b/src/views/system/role/index.vue @@ -1,61 +1,61 @@ diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index ae305513..f3b10234 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -1,63 +1,63 @@ diff --git a/src/views/ums/member/index.vue b/src/views/ums/member/index.vue index 825048e1..f597ba7a 100644 --- a/src/views/ums/member/index.vue +++ b/src/views/ums/member/index.vue @@ -1,7 +1,7 @@ @@ -14,161 +14,161 @@ import { listMemebersPage } from '@/api/ums/member'; import { MemberQueryParam, MemberItem } from '@/types'; const state = reactive({ - // 遮罩层 - loading: true, - // 选中数组 - ids: [], - // 非单个禁用 - single: true, - // 非多个禁用 - multiple: true, - total: 0, - queryParams: { - pageNum: 1, - pageSize: 10 - } as MemberQueryParam, - memberList: [] as MemberItem[] + // 遮罩层 + loading: true, + // 选中数组 + ids: [], + // 非单个禁用 + single: true, + // 非多个禁用 + multiple: true, + total: 0, + queryParams: { + pageNum: 1, + pageSize: 10 + } as MemberQueryParam, + memberList: [] as MemberItem[] }); const { loading, queryParams, memberList, total } = toRefs(state); function handleQuery() { - state.loading = true; - listMemebersPage(state.queryParams).then(({ data }) => { - state.memberList = data.list; - state.total = data.total; - state.loading = false; - }); + state.loading = true; + listMemebersPage(state.queryParams).then(({ data }) => { + state.memberList = data.list; + state.total = data.total; + state.loading = false; + }); } function resetQuery() { - state.queryParams = { - pageNum: 1, - pageSize: 10, - nickName: '' - }; - handleQuery(); + state.queryParams = { + pageNum: 1, + pageSize: 10, + nickName: '' + }; + handleQuery(); } function handleSelectionChange(selection: any) { - state.ids = selection.map((item: { id: any }) => item.id); - state.single = selection.length != 1; - state.multiple = !selection.length; + state.ids = selection.map((item: { id: any }) => item.id); + state.single = selection.length != 1; + state.multiple = !selection.length; } onMounted(() => { - handleQuery(); + handleQuery(); }); diff --git a/tsconfig.json b/tsconfig.json index 9ea54bdf..961fc4cd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,22 +1,22 @@ { - "compilerOptions": { - "target": "esnext", - "useDefineForClassFields": true, - "module": "esnext", - "moduleResolution": "node", - "strict": true, - "jsx": "preserve", - "sourceMap": true, - "resolveJsonModule": true, - "esModuleInterop": true, - "lib": ["esnext", "dom"], - "baseUrl": "./", - "paths": { - "@/*": ["src/*"] - }, - "allowSyntheticDefaultImports": true, // 默认导入 - "skipLibCheck": true, // 不对第三方依赖类型检查 ,element-plus 生产打包报错 - "types": ["element-plus/global"] - }, - "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"] + "compilerOptions": { + "target": "esnext", + "useDefineForClassFields": true, + "module": "esnext", + "moduleResolution": "node", + "strict": true, + "jsx": "preserve", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "lib": ["esnext", "dom"], + "baseUrl": "./", + "paths": { + "@/*": ["src/*"] + }, + "allowSyntheticDefaultImports": true, // 默认导入 + "skipLibCheck": true, // 不对第三方依赖类型检查 ,element-plus 生产打包报错 + "types": ["element-plus/global"] + }, + "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"] } diff --git a/vite.config.ts b/vite.config.ts index dd63feb5..8782f9d2 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,38 +5,38 @@ import path from 'path'; // @see: https://gitee.com/holysheng/vite2-config-description/blob/master/vite.config.ts export default ({ mode }: ConfigEnv): UserConfig => { - // 获取 .env 环境配置文件 - const env = loadEnv(mode, process.cwd()); + // 获取 .env 环境配置文件 + const env = loadEnv(mode, process.cwd()); - return { - plugins: [ - vue(), - createSvgIconsPlugin({ - // 指定需要缓存的图标文件夹 - iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')], - // 指定symbolId格式 - symbolId: 'icon-[dir]-[name]' - }) - ], - // 本地反向代理解决浏览器跨域限制 - server: { - host: 'localhost', - port: Number(env.VITE_APP_PORT), - open: true, // 运行自动打开浏览器 - proxy: { - [env.VITE_APP_BASE_API]: { - target: 'http://www.youlai.tech:9999', - changeOrigin: true, - rewrite: path => - path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '') - } - } - }, - resolve: { - // Vite路径别名配置 - alias: { - '@': path.resolve('./src') // @代替src - } - } - }; + return { + plugins: [ + vue(), + createSvgIconsPlugin({ + // 指定需要缓存的图标文件夹 + iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')], + // 指定symbolId格式 + symbolId: 'icon-[dir]-[name]' + }) + ], + // 本地反向代理解决浏览器跨域限制 + server: { + host: 'localhost', + port: Number(env.VITE_APP_PORT), + open: true, // 运行自动打开浏览器 + proxy: { + [env.VITE_APP_BASE_API]: { + target: 'http://www.youlai.tech:9999', + changeOrigin: true, + rewrite: path => + path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '') + } + } + }, + resolve: { + // Vite路径别名配置 + alias: { + '@': path.resolve('./src') // @代替src + } + } + }; };