From 11f02c025440f2a21125497a02f7490dff23fbb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=85=88=E7=91=9E?= <1490493387@qq.com> Date: Wed, 4 May 2022 15:02:33 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E5=85=A8=E5=B1=80=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: bb50c8419b8fcdeb48c93fce9f399d901e8f5a52 --- commitlint.config.js | 50 +- index.html | 20 +- src/App.vue | 34 +- src/api/lab/seata.ts | 36 +- src/api/login/index.ts | 40 +- src/api/oms/order.ts | 33 +- src/api/pms/attribute.ts | 29 +- src/api/pms/brand.ts | 81 +- src/api/pms/category.ts | 82 +- src/api/pms/goods.ts | 58 +- src/api/sms/advert.ts | 60 +- src/api/system/client.ts | 80 +- src/api/system/dept.ts | 66 +- src/api/system/dict.ts | 128 +- src/api/system/file.ts | 33 +- src/api/system/menu.ts | 73 +- src/api/system/perm.ts | 76 +- src/api/system/role.ts | 125 +- src/api/system/user.ts | 140 ++- src/api/ums/member.ts | 50 +- src/components.d.ts | 12 +- src/components/Breadcrumb/index.vue | 150 +-- src/components/GithubCorner/index.vue | 89 +- src/components/Hamburger/index.vue | 62 +- src/components/IconSelect/index.vue | 109 +- src/components/LangSelect/index.vue | 68 +- src/components/Pagination/index.vue | 143 ++- src/components/RightPanel/index.vue | 215 ++-- src/components/Screenfull/index.vue | 15 +- src/components/SizeSelect/index.vue | 54 +- src/components/SvgIcon/index.vue | 46 +- src/components/ThemePicker/index.vue | 67 +- src/components/Upload/SingleUpload.vue | 188 +-- src/components/WangEditor/index.vue | 99 +- src/directive/index.ts | 2 +- src/directive/permission/index.ts | 81 +- src/env.d.ts | 18 +- src/lang/en.ts | 46 +- src/lang/index.ts | 63 +- src/lang/zh-cn.ts | 44 +- src/layout/components/AppMain.vue | 57 +- src/layout/components/Navbar.vue | 264 ++-- src/layout/components/Settings/index.vue | 130 +- src/layout/components/Sidebar/Link.vue | 76 +- src/layout/components/Sidebar/Logo.vue | 118 +- src/layout/components/Sidebar/SidebarItem.vue | 172 +-- src/layout/components/Sidebar/index.vue | 82 +- src/layout/components/TagsView/ScrollPane.vue | 170 ++- src/layout/components/TagsView/index.vue | 532 ++++---- src/layout/components/index.ts | 8 +- src/layout/index.vue | 120 +- src/main.ts | 43 +- src/permission.ts | 96 +- src/router/index.ts | 120 +- src/settings.ts | 31 +- src/store/index.ts | 24 +- src/store/modules/app.ts | 88 +- src/store/modules/permission.ts | 138 +- src/store/modules/settings.ts | 85 +- src/store/modules/tagsView.ts | 332 ++--- src/store/modules/user.ts | 203 +-- src/styles/element-plus.scss | 40 +- src/styles/index.scss | 53 +- src/styles/mixin.scss | 36 +- src/styles/sidebar.scss | 370 +++--- src/styles/transition.scss | 24 +- src/styles/variables.module.scss | 30 +- src/types/api/base.d.ts | 10 +- src/types/api/lab/seata.d.ts | 10 +- src/types/api/oms/order.d.ts | 6 +- src/types/api/pms/brand.d.ts | 25 +- src/types/api/pms/goods.d.ts | 36 +- src/types/api/sms/advert.d.ts | 34 +- src/types/api/system/client.d.ts | 37 +- src/types/api/system/dept.d.ts | 37 +- src/types/api/system/dict.d.ts | 87 +- src/types/api/system/login.d.ts | 19 +- src/types/api/system/menu.d.ts | 99 +- src/types/api/system/perm.d.ts | 32 +- src/types/api/system/role.d.ts | 21 +- src/types/api/system/user.d.ts | 70 +- src/types/api/ums/member.d.ts | 26 +- src/types/common.d.ts | 11 +- src/types/index.d.ts | 35 +- src/types/store.d.ts | 48 +- src/utils/filter.ts | 78 +- src/utils/i18n.ts | 18 +- src/utils/index.ts | 40 +- src/utils/request.ts | 109 +- src/utils/resize.ts | 115 +- src/utils/scroll-to.ts | 92 +- src/utils/storage.ts | 68 +- src/utils/validate.ts | 5 +- .../dashboard/components/Chart/BarChart.vue | 315 +++-- .../components/Chart/FunnelChart.vue | 231 ++-- .../dashboard/components/Chart/PieChart.vue | 192 ++- .../dashboard/components/Chart/RadarChart.vue | 230 ++-- .../dashboard/components/Project/index.vue | 186 +-- src/views/dashboard/components/Team/index.vue | 381 +++--- src/views/dashboard/index.vue | 423 ++++--- src/views/error-page/401.vue | 182 +-- src/views/error-page/404.vue | 456 +++---- src/views/lab/seata/index.vue | 560 +++++---- src/views/login/index.vue | 587 +++++---- src/views/nested/level1/index.vue | 10 +- src/views/nested/level1/level2/index.vue | 10 +- .../nested/level1/level2/level3/index1.vue | 6 +- .../nested/level1/level2/level3/index2.vue | 6 +- src/views/oms/order/index.vue | 367 +++--- src/views/pms/brand/index.vue | 371 +++--- .../pms/category/components/Attribute.vue | 264 ++-- .../pms/category/components/Category.vue | 415 +++--- src/views/pms/category/index.vue | 110 +- .../pms/goods/components/GoodsAttribute.vue | 240 ++-- .../pms/goods/components/GoodsCategory.vue | 145 ++- src/views/pms/goods/components/GoodsInfo.vue | 294 +++-- src/views/pms/goods/components/GoodsStock.vue | 945 +++++++------- src/views/pms/goods/detail.vue | 130 +- src/views/pms/goods/index.vue | 440 +++---- src/views/redirect/index.vue | 10 +- src/views/sms/advert/index.vue | 425 ++++--- src/views/system/client/index.vue | 540 ++++---- src/views/system/dept/index.vue | 455 ++++--- src/views/system/dict/components/Dict.vue | 376 +++--- src/views/system/dict/components/DictItem.vue | 448 ++++--- src/views/system/dict/index.vue | 84 +- src/views/system/menu/components/Menu.vue | 616 +++++---- src/views/system/menu/components/Perm.vue | 578 +++++---- src/views/system/menu/index.vue | 87 +- src/views/system/role/components/Menu.vue | 133 +- src/views/system/role/components/Perm.vue | 224 ++-- src/views/system/role/components/Role.vue | 377 +++--- src/views/system/role/index.vue | 189 ++- src/views/system/user/index.vue | 1117 ++++++++++------- src/views/ums/member/index.vue | 257 ++-- tsconfig.json | 40 +- 136 files changed, 11147 insertions(+), 9780 deletions(-) diff --git a/commitlint.config.js b/commitlint.config.js index de3022d2..89ed81a6 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] - } - } \ No newline at end of file + // 继承的规则 + 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 753e4046..28ac5713 100644 --- a/index.html +++ b/index.html @@ -1,13 +1,13 @@ - - - - - vue3-element-admin - - -
- - + + + + + vue3-element-admin + + +
+ + diff --git a/src/App.vue b/src/App.vue index 9c8c0a10..8b6bdec9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,18 +1,18 @@ - diff --git a/src/api/lab/seata.ts b/src/api/lab/seata.ts index 24f69fc2..7ca6c3c2 100644 --- a/src/api/lab/seata.ts +++ b/src/api/lab/seata.ts @@ -1,36 +1,36 @@ -import { SeataFormData } from '@/types' -import request from '@/utils/request' +import { SeataFormData } from '@/types'; +import request from '@/utils/request'; /** * 订单支付 - * @returns + * @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 + }); } /** * 获取Seata模拟数据(包括订单信息、商品信息、会员余额信息) - * @returns + * @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' + }); } /** * 重置Seata模拟数据 - * @returns + * @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 77e48567..a4583083 100644 --- a/src/api/login/index.ts +++ b/src/api/login/index.ts @@ -1,38 +1,38 @@ -import { Captcha, LoginFormData, LoginResponseData } from "@/types"; -import request from "@/utils/request"; -import { AxiosPromise } from "axios"; +import { Captcha, LoginFormData, LoginResponseData } from '@/types'; +import request from '@/utils/request'; +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' - }) -} \ No newline at end of file + 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 3a9f53a6..649fd051 100644 --- a/src/api/oms/order.ts +++ b/src/api/oms/order.ts @@ -1,29 +1,30 @@ -import { OrderPageResult, OrderQueryParam } from '@/types' -import request from '@/utils/request' -import { AxiosPromise } from 'axios' +import { OrderPageResult, OrderQueryParam } from '@/types'; +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; /** * 获取订单分页列表 * * @param queryParams */ -export function listOrderPages(queryParams: OrderQueryParam): AxiosPromise { - return request({ - url: '/mall-oms/api/v1/orders', - method: 'get', - params: queryParams - }) +export function listOrderPages( + queryParams: OrderQueryParam +): AxiosPromise { + return request({ + url: '/mall-oms/api/v1/orders', + method: 'get', + params: queryParams + }); } - /** * 获取订单详情 * * @param orderId */ -export function getOrderDetail(orderId: number){ - return request({ - url: '/mall-oms/api/v1/orders/' + orderId, - method: 'get' - }) -} \ No newline at end of file +export function getOrderDetail(orderId: number) { + 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 e81db3dc..02a7a9ea 100644 --- a/src/api/pms/attribute.ts +++ b/src/api/pms/attribute.ts @@ -1,30 +1,27 @@ -import request from '@/utils/request' +import request from '@/utils/request'; /** * 获取商品属性列表 * * @param params */ -export function listAttributes(params:object) { - return request({ - url: '/mall-pms/api/v1/attributes', - method: 'get', - params: params - }) +export function listAttributes(params: object) { + return request({ + url: '/mall-pms/api/v1/attributes', + method: 'get', + params: params + }); } - /** * 批量修改商品属性 * * @param data */ -export function saveAttributeBatch(data:object) { - return request({ - url: '/mall-pms/api/v1/attributes/batch', - method: 'post', - data: data - }) +export function saveAttributeBatch(data: object) { + 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 1123f846..e9a0718c 100644 --- a/src/api/pms/brand.ts +++ b/src/api/pms/brand.ts @@ -1,18 +1,25 @@ -import { BrandFormData, BrandItem, BrandPageResult, BrandQueryParam } from '@/types' -import request from '@/utils/request' -import { AxiosPromise } from 'axios' +import { + BrandFormData, + BrandItem, + BrandPageResult, + BrandQueryParam +} from '@/types'; +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; /** * 获取品牌分页列表 * * @param queryParams */ -export function listBrandPages(queryParams: BrandQueryParam):AxiosPromise { - return request({ - url: '/mall-pms/api/v1/brands/page', - method: 'get', - params: queryParams - }) +export function listBrandPages( + queryParams: BrandQueryParam +): AxiosPromise { + return request({ + url: '/mall-pms/api/v1/brands/page', + method: 'get', + params: queryParams + }); } /** @@ -20,12 +27,14 @@ export function listBrandPages(queryParams: BrandQueryParam):AxiosPromise { - return request({ - url: '/mall-pms/api/v1/brands', - method: 'get', - params: queryParams - }) +export function listBrands( + queryParams?: BrandQueryParam +): AxiosPromise { + return request({ + url: '/mall-pms/api/v1/brands', + method: 'get', + params: queryParams + }); } /** @@ -33,11 +42,11 @@ export function listBrands(queryParams?: BrandQueryParam):AxiosPromise { - return request({ - url: '/mall-pms/api/v1/brands/' + id, - method: 'get' - }) +export function getBrandFormDetail(id: number): AxiosPromise { + return request({ + url: '/mall-pms/api/v1/brands/' + id, + method: 'get' + }); } /** @@ -46,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 + }); } /** @@ -59,12 +68,12 @@ export function addBrand(data: BrandFormData) { * @param id * @param data */ -export function updateBrand(id:number, data:BrandFormData) { - return request({ - url: '/mall-pms/api/v1/brands/' + id, - method: 'put', - data: data - }) +export function updateBrand(id: number, data: BrandFormData) { + return request({ + url: '/mall-pms/api/v1/brands/' + id, + method: 'put', + data: data + }); } /** @@ -73,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' - }) -} \ No newline at end of file + 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 0975e407..666adba5 100644 --- a/src/api/pms/category.ts +++ b/src/api/pms/category.ts @@ -1,16 +1,16 @@ -import request from "@/utils/request"; +import request from '@/utils/request'; /** * 获取商品分类列表 * * @param queryParams */ -export function listCategories(queryParams:object){ - return request({ - url: '/mall-pms/api/v1/categories', - method: 'get', - params: queryParams - }) +export function listCategories(queryParams: object) { + return request({ + url: '/mall-pms/api/v1/categories', + method: 'get', + params: queryParams + }); } /** @@ -18,12 +18,12 @@ 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 - }) +export function listCascadeCategories(queryParams?: object) { + return request({ + url: '/mall-pms/api/v1/categories/cascade', + method: 'get', + params: queryParams + }); } /** @@ -31,11 +31,11 @@ export function listCascadeCategories(queryParams?:object) { * * @param id */ -export function getCategoryDetail(id:number){ - return request({ - url: '/mall-pms/api/v1/categories/' + id, - method: 'get' - }) +export function getCategoryDetail(id: number) { + return request({ + url: '/mall-pms/api/v1/categories/' + id, + method: 'get' + }); } /** @@ -43,12 +43,12 @@ export function getCategoryDetail(id:number){ * * @param data */ -export function addCategory(data:object){ - return request({ - url: '/mall-pms/api/v1/categories', - method: 'post', - data: data - }) +export function addCategory(data: object) { + return request({ + url: '/mall-pms/api/v1/categories', + method: 'post', + data: data + }); } /** @@ -57,12 +57,12 @@ export function addCategory(data:object){ * @param id * @param data */ -export function updateCategory(id:number, data:object) { - return request({ - url: '/mall-pms/api/v1/categories/' + id, - method: 'put', - data: data - }) +export function updateCategory(id: number, data: object) { + return request({ + url: '/mall-pms/api/v1/categories/' + id, + method: 'put', + data: data + }); } /** @@ -70,11 +70,11 @@ 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' - }) +export function deleteCategories(ids: string) { + return request({ + url: '/mall-pms/api/v1/categories/' + ids, + method: 'delete' + }); } /** @@ -83,10 +83,10 @@ export function deleteCategories(ids:string) { * @param id * @param data */ -export function updateCategoryPart(id:number, data:object) { - return request({ - url: '/mall-pms/api/v1/categories/' + id, - method: 'patch', - data: data - }) +export function updateCategoryPart(id: number, data: object) { + 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 4d647842..34c632bb 100644 --- a/src/api/pms/goods.ts +++ b/src/api/pms/goods.ts @@ -1,18 +1,20 @@ -import { GoodsDetail, GoodsPageResult, GoodsQueryParam } from '@/types' -import request from '@/utils/request' -import { AxiosPromise } from 'axios' +import { GoodsDetail, GoodsPageResult, GoodsQueryParam } from '@/types'; +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; /** * 获取商品分页列表 * * @param queryParams */ -export function listGoodsPages(queryParams: GoodsQueryParam):AxiosPromise { - return request({ - url: '/mall-pms/api/v1/goods/page', - method: 'get', - params: queryParams - }) +export function listGoodsPages( + queryParams: GoodsQueryParam +): AxiosPromise { + return request({ + url: '/mall-pms/api/v1/goods/page', + method: 'get', + params: queryParams + }); } /** @@ -20,11 +22,11 @@ export function listGoodsPages(queryParams: GoodsQueryParam):AxiosPromise { - return request({ - url: '/mall-pms/api/v1/goods/' + id, - method: 'get' - }) +export function getGoodsDetail(id: string): AxiosPromise { + return request({ + url: '/mall-pms/api/v1/goods/' + id, + method: 'get' + }); } /** @@ -33,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 + }); } /** @@ -47,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 + }); } /** @@ -60,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 d284c9f7..1cde2d15 100644 --- a/src/api/sms/advert.ts +++ b/src/api/sms/advert.ts @@ -1,18 +1,20 @@ -import { AdvertFormData, AdvertPageResult, AdvertQueryParam } from '@/types' -import request from '@/utils/request' -import { AxiosPromise } from 'axios' +import { AdvertFormData, AdvertPageResult, AdvertQueryParam } from '@/types'; +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; /** * 获取广告分页列表 * * @param queryParams */ -export function listAdvertPages(queryParams: AdvertQueryParam):AxiosPromise { - return request({ - url: '/mall-sms/api/v1/adverts', - method: 'get', - params: queryParams - }) +export function listAdvertPages( + queryParams: AdvertQueryParam +): AxiosPromise { + return request({ + url: '/mall-sms/api/v1/adverts', + method: 'get', + params: queryParams + }); } /** @@ -20,11 +22,11 @@ export function listAdvertPages(queryParams: AdvertQueryParam):AxiosPromise { - return request({ - url: '/mall-sms/api/v1/adverts/' + id, - method: 'get' - }) +export function getAdvertFormDetail(id: number): AxiosPromise { + return request({ + url: '/mall-sms/api/v1/adverts/' + id, + method: 'get' + }); } /** @@ -33,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 + }); } /** @@ -47,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 + }); } /** @@ -59,9 +61,9 @@ 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' - }) +export function deleteAdverts(ids: string) { + 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 e1266fb1..5af29404 100644 --- a/src/api/system/client.ts +++ b/src/api/system/client.ts @@ -1,49 +1,55 @@ -import { ClientFormData, ClientPageResult, ClientQueryParam } from '@/types/api/system/client' -import request from '@/utils/request' -import { AxiosPromise } from 'axios' +import { + ClientFormData, + ClientPageResult, + ClientQueryParam +} from '@/types/api/system/client'; +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; -export function listClientPages(queryParams:ClientQueryParam):AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/oauth-clients', - method: 'get', - params: queryParams - }) +export function listClientPages( + queryParams: ClientQueryParam +): AxiosPromise { + 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' - }) +export function getClientFormDetial(id: number): AxiosPromise { + 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 - }) +export function addClient(data: ClientFormData) { + 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 - }) +export function updateClient(id: string, data: ClientFormData) { + 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' - }) +export function deleteClients(ids: string) { + 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 - }) +export function updateClientPart(id: number, data: object) { + 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 f4b92653..3b1a0c9b 100644 --- a/src/api/system/dept.ts +++ b/src/api/system/dept.ts @@ -1,28 +1,30 @@ -import { DeptFormData, DeptItem, DeptQueryParam, Option } from '@/types' -import request from '@/utils/request' -import { AxiosPromise } from 'axios' +import { DeptFormData, DeptItem, DeptQueryParam, Option } from '@/types'; +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; /** * 部门树形表格 * * @param queryParams */ -export function listTableDepartments(queryParams?: DeptQueryParam): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/depts/table', - method: 'get', - params: queryParams - }) +export function listTableDepartments( + queryParams?: DeptQueryParam +): AxiosPromise { + 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' + }); } /** @@ -31,24 +33,23 @@ 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' + }); } - /** * 新增部门 * * @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 + }); } /** @@ -58,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 + }); } /** @@ -71,9 +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 47744a0d..eb015a51 100644 --- a/src/api/system/dict.ts +++ b/src/api/system/dict.ts @@ -1,18 +1,28 @@ -import { DictFormData, DictItemFormData, DictItemPageResult, DictItemQueryParam, DictPageResult, DictQueryParam, Option } from "@/types"; -import request from "@/utils/request"; -import { AxiosPromise } from "axios"; +import { + DictFormData, + DictItemFormData, + DictItemPageResult, + DictItemQueryParam, + DictPageResult, + DictQueryParam, + Option +} from '@/types'; +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; /** * 获取字典分页列表 * * @param queryParams */ -export function listDictPages(queryParams: DictQueryParam): AxiosPromise { - return request({ - url: '/youlai-admin/api/v2/dict/page', - method: 'get', - params: queryParams - }) +export function listDictPages( + queryParams: DictQueryParam +): AxiosPromise { + return request({ + url: '/youlai-admin/api/v2/dict/page', + method: 'get', + params: queryParams + }); } /** @@ -21,24 +31,23 @@ export function listDictPages(queryParams: DictQueryParam): AxiosPromise { - return request({ - url: '/youlai-admin/api/v2/dict/' + id, - method: 'get' - }) + return request({ + url: '/youlai-admin/api/v2/dict/' + id, + method: 'get' + }); } - /** * 新增字典 * * @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 + }); } /** @@ -48,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 + }); } /** @@ -60,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' + }); } /** @@ -71,26 +80,27 @@ export function deleteDict(ids: string) { * * @param queryParams */ -export function listDictItemPages(queryParams: DictItemQueryParam): AxiosPromise { - return request({ - url: '/youlai-admin/api/v2/dict/items/page', - method: 'get', - params: queryParams - }) +export function listDictItemPages( + queryParams: DictItemQueryParam +): AxiosPromise { + return request({ + url: '/youlai-admin/api/v2/dict/items/page', + method: 'get', + params: queryParams + }); } - /** * 根据字典编码获取字典项列表 * * @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 } + }); } /** @@ -99,25 +109,23 @@ 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' + }); } - - /** * 新增字典项 * * @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 + }); } /** @@ -127,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 + }); } /** @@ -139,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 61e6dd93..2769f1a3 100644 --- a/src/api/system/file.ts +++ b/src/api/system/file.ts @@ -1,4 +1,4 @@ -import request from '@/utils/request' +import request from '@/utils/request'; /** * 上传文件 @@ -6,17 +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' + } + }); } /** @@ -25,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 2c6e2b81..97671688 100644 --- a/src/api/system/menu.ts +++ b/src/api/system/menu.ts @@ -1,15 +1,15 @@ -import { MenuFormData, MenuItem, MenuQueryParam, Option } from '@/types' -import request from '@/utils/request' -import { AxiosPromise } from 'axios' +import { MenuFormData, MenuItem, MenuQueryParam, Option } from '@/types'; +import request from '@/utils/request'; +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' + }); } /** @@ -17,34 +17,35 @@ export function listRoutes() { * * @param queryParams */ -export function listTableMenus(queryParams: MenuQueryParam): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/menus/table', - method: 'get', - params: queryParams - }) +export function listTableMenus( + queryParams: MenuQueryParam +): AxiosPromise { + 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' + }); } - /** * 获取菜单详情 * @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' + }); } /** @@ -53,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 + }); } /** @@ -67,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 + }); } /** @@ -80,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 3b7a9ea3..6b2dc7e5 100644 --- a/src/api/system/perm.ts +++ b/src/api/system/perm.ts @@ -1,18 +1,25 @@ -import { PermFormData, PermItem, PermPageResult, PermQueryParam } from '@/types' -import request from '@/utils/request' -import { AxiosPromise } from 'axios' +import { + PermFormData, + PermItem, + PermPageResult, + PermQueryParam +} from '@/types'; +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; /** * 获取权限分页列表 * * @param queryParams */ -export function listPermPages(queryParams: PermQueryParam): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/permissions/page', - method: 'get', - params: queryParams - }) +export function listPermPages( + queryParams: PermQueryParam +): AxiosPromise { + return request({ + url: '/youlai-admin/api/v1/permissions/page', + method: 'get', + params: queryParams + }); } /** @@ -20,12 +27,14 @@ export function listPermPages(queryParams: PermQueryParam): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/permissions', - method: 'get', - params: queryParams - }) +export function listPerms( + queryParams: PermQueryParam +): AxiosPromise { + return request({ + url: '/youlai-admin/api/v1/permissions', + method: 'get', + params: queryParams + }); } /** @@ -34,10 +43,10 @@ export function listPerms(queryParams: PermQueryParam): AxiosPromise * @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' + }); } /** @@ -46,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 + }); } /** @@ -60,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 + }); } /** @@ -73,9 +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 384113bd..2d37a56b 100644 --- a/src/api/system/role.ts +++ b/src/api/system/role.ts @@ -1,18 +1,25 @@ -import { RoleFormData, RoleItem, RolePageResult, RoleQueryParam } from '@/types' -import request from '@/utils/request' -import { AxiosPromise } from 'axios' +import { + RoleFormData, + RoleItem, + RolePageResult, + RoleQueryParam +} from '@/types'; +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; /** * 获取角色分页列表 * * @param queryParams */ -export function listRolePages(queryParams?: RoleQueryParam):AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/roles/page', - method: 'get', - params: queryParams - }) +export function listRolePages( + queryParams?: RoleQueryParam +): AxiosPromise { + return request({ + url: '/youlai-admin/api/v1/roles/page', + method: 'get', + params: queryParams + }); } /** @@ -20,12 +27,14 @@ export function listRolePages(queryParams?: RoleQueryParam):AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/roles', - method: 'get', - params: queryParams - }) +export function listRoles( + queryParams?: RoleQueryParam +): AxiosPromise { + return request({ + url: '/youlai-admin/api/v1/roles', + method: 'get', + params: queryParams + }); } /** @@ -33,11 +42,11 @@ export function listRoles(queryParams?: RoleQueryParam):AxiosPromise * * @param id */ -export function getRoleFormDetail(id: number):AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/roles/' + id, - method: 'get' - }) +export function getRoleFormDetail(id: number): AxiosPromise { + return request({ + url: '/youlai-admin/api/v1/roles/' + id, + method: 'get' + }); } /** @@ -46,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 + }); } /** @@ -60,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 + }); } /** @@ -73,23 +82,22 @@ 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' + }); } - /** * 获取角色的菜单列表 * * @param roleId */ -export function listRoleMenuIds(roleId: number):AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/roles/' + roleId + '/menu_ids', - method: 'get', - }) +export function listRoleMenuIds(roleId: number): AxiosPromise { + return request({ + url: '/youlai-admin/api/v1/roles/' + roleId + '/menu_ids', + method: 'get' + }); } /** @@ -99,25 +107,24 @@ 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 } + }); } - /** * 获取角色的权限列表 * * @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 } + }); } /** @@ -127,10 +134,14 @@ export function listRolePerms(roleId: number, menuId: number) { * @param roleId * @param permIds */ -export function saveRolePerms(roleId: number, menuId: number, permIds: Array) { - return request({ - url: '/youlai-admin/api/v1/roles/' + roleId + '/permissions', - method: 'put', - data: {menuId: menuId, permIds: permIds} - }) +export function saveRolePerms( + roleId: number, + menuId: number, + permIds: Array +) { + 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 6e8c3dc5..72354f62 100644 --- a/src/api/system/user.ts +++ b/src/api/system/user.ts @@ -1,15 +1,20 @@ -import request from "@/utils/request"; -import { AxiosPromise } from "axios"; -import { UserFormData, UserInfo, UserPageResult, UserQueryParam } from "@/types"; +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; +import { + 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' + }); } /** @@ -17,12 +22,14 @@ export function getUserInfo(): AxiosPromise { * * @param queryParams */ -export function listUsersPage(queryParams: UserQueryParam): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/users/page', - method: 'get', - params: queryParams - }) +export function listUsersPage( + queryParams: UserQueryParam +): AxiosPromise { + return request({ + url: '/youlai-admin/api/v1/users/page', + method: 'get', + params: queryParams + }); } /** @@ -31,10 +38,10 @@ export function listUsersPage(queryParams: UserQueryParam): AxiosPromise { - return request({ - url: '/youlai-admin/api/v1/users/' + userId, - method: 'get' - }) + return request({ + url: '/youlai-admin/api/v1/users/' + userId, + method: 'get' + }); } /** @@ -43,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 + }); } /** @@ -57,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 + }); } /** @@ -71,51 +78,51 @@ 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 + }); } /** * 删除用户 - * + * * @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' + }); } /** * 下载用户导入模板 - * - * @returns + * + * @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' + }); } /** * 导出用户 - * - * @param queryParams - * @returns + * + * @param queryParams + * @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' + }); } /** @@ -124,17 +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' - } - }) -} \ No newline at end of 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' + } + }); +} diff --git a/src/api/ums/member.ts b/src/api/ums/member.ts index 0fddb7b0..c3940f4b 100644 --- a/src/api/ums/member.ts +++ b/src/api/ums/member.ts @@ -1,18 +1,20 @@ -import { MemberPageResult, MemberQueryParam } from '@/types' -import request from '@/utils/request' -import { AxiosPromise } from 'axios' +import { MemberPageResult, MemberQueryParam } from '@/types'; +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; /** * 获取会员分页列表 * * @param queryParams */ -export function listMemebersPage(queryParams: MemberQueryParam): AxiosPromise { - return request({ - url: '/mall-ums/api/v1/members', - method: 'get', - params: queryParams - }) +export function listMemebersPage( + queryParams: MemberQueryParam +): AxiosPromise { + return request({ + url: '/mall-ums/api/v1/members', + method: 'get', + params: queryParams + }); } /** @@ -21,10 +23,10 @@ export function listMemebersPage(queryParams: MemberQueryParam): AxiosPromise - - - - {{ generateTitle(item.meta.title) }} - - {{ generateTitle(item.meta.title) }} - - - - + + + + {{ generateTitle(item.meta.title) }} + + {{ generateTitle(item.meta.title) }} + + + + \ No newline at end of file + diff --git a/src/components/GithubCorner/index.vue b/src/components/GithubCorner/index.vue index 2f507ca4..007dae1d 100644 --- a/src/components/GithubCorner/index.vue +++ b/src/components/GithubCorner/index.vue @@ -1,54 +1,59 @@ diff --git a/src/components/Hamburger/index.vue b/src/components/Hamburger/index.vue index 368b0021..59b96d80 100644 --- a/src/components/Hamburger/index.vue +++ b/src/components/Hamburger/index.vue @@ -1,44 +1,46 @@ diff --git a/src/components/IconSelect/index.vue b/src/components/IconSelect/index.vue index 22126ed9..386404bd 100644 --- a/src/components/IconSelect/index.vue +++ b/src/components/IconSelect/index.vue @@ -1,27 +1,40 @@ - \ No newline at end of file + diff --git a/src/components/LangSelect/index.vue b/src/components/LangSelect/index.vue index b94de2fb..e97eafcb 100644 --- a/src/components/LangSelect/index.vue +++ b/src/components/LangSelect/index.vue @@ -1,49 +1,47 @@ - \ No newline at end of file + diff --git a/src/components/Pagination/index.vue b/src/components/Pagination/index.vue index d48f405b..b65b75cb 100644 --- a/src/components/Pagination/index.vue +++ b/src/components/Pagination/index.vue @@ -1,94 +1,101 @@ diff --git a/src/components/RightPanel/index.vue b/src/components/RightPanel/index.vue index 0d6166cd..83a807d0 100644 --- a/src/components/RightPanel/index.vue +++ b/src/components/RightPanel/index.vue @@ -1,154 +1,163 @@ diff --git a/src/components/Screenfull/index.vue b/src/components/Screenfull/index.vue index 35c55e70..f2e999a2 100644 --- a/src/components/Screenfull/index.vue +++ b/src/components/Screenfull/index.vue @@ -1,12 +1,15 @@ \ No newline at end of file + diff --git a/src/components/SizeSelect/index.vue b/src/components/SizeSelect/index.vue index 92b7031c..1cd04efe 100644 --- a/src/components/SizeSelect/index.vue +++ b/src/components/SizeSelect/index.vue @@ -1,43 +1,47 @@ - \ No newline at end of file + diff --git a/src/components/SvgIcon/index.vue b/src/components/SvgIcon/index.vue index 9a9ff40c..1825a704 100644 --- a/src/components/SvgIcon/index.vue +++ b/src/components/SvgIcon/index.vue @@ -1,36 +1,36 @@ \ No newline at end of file + diff --git a/src/components/ThemePicker/index.vue b/src/components/ThemePicker/index.vue index ad231232..7b437438 100644 --- a/src/components/ThemePicker/index.vue +++ b/src/components/ThemePicker/index.vue @@ -1,56 +1,67 @@ diff --git a/src/components/Upload/SingleUpload.vue b/src/components/Upload/SingleUpload.vue index 68a0df9f..8a43f547 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 bff95967..9db17741 100644 --- a/src/components/WangEditor/index.vue +++ b/src/components/WangEditor/index.vue @@ -1,70 +1,79 @@ - \ No newline at end of file + diff --git a/src/directive/index.ts b/src/directive/index.ts index 984b4016..39edd276 100644 --- a/src/directive/index.ts +++ b/src/directive/index.ts @@ -1 +1 @@ -export {hasPerm,hasRole} from "./permission"; \ No newline at end of file +export { hasPerm, hasRole } from './permission'; diff --git a/src/directive/permission/index.ts b/src/directive/permission/index.ts index 5c8d4e92..211f9c35 100644 --- a/src/directive/permission/index.ts +++ b/src/directive/permission/index.ts @@ -1,55 +1,56 @@ -import useStore from "@/store"; -import { Directive, DirectiveBinding } from "vue"; +import useStore from '@/store'; +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; - - if (value) { - const requiredRoles = value; // DOM绑定需要的角色编码 - const { user } = useStore() - const hasRole = user.roles.some(perm => { - return requiredRoles.includes(perm) - }) + mounted(el: HTMLElement, binding: DirectiveBinding) { + const { value } = binding; - if (!hasRole) { - el.parentNode && el.parentNode.removeChild(el); - } - } else { - throw new Error("need roles! Like v-has-role=\"['admin','test']\""); - } - } + 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']\""); + } + } }; - diff --git a/src/env.d.ts b/src/env.d.ts index 272014dc..b4958e04 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 -} \ No newline at end of file + readonly env: ImportMetaEnv; +} diff --git a/src/lang/en.ts b/src/lang/en.ts index 535a45ba..5f4f8a24 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' - } -} \ No newline at end of file + // 路由国际化 + 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 b56f979d..fcac2c92 100644 --- a/src/lang/index.ts +++ b/src/lang/index.ts @@ -1,46 +1,45 @@ - // 自定义国际化配置 -import {createI18n} from 'vue-i18n' -import {localStorage} from '@/utils/storage' +import { createI18n } from 'vue-i18n'; +import { localStorage } from '@/utils/storage'; // 本地语言包 -import enLocale from './en' -import zhCnLocale from './zh-cn' +import enLocale from './en'; +import zhCnLocale from './zh-cn'; const messages = { - 'zh-cn': { - ...zhCnLocale - }, - en: { - ...enLocale - } -} + 'zh-cn': { + ...zhCnLocale + }, + en: { + ...enLocale + } +}; /** * 获取当前系统使用语言字符串 - * + * * @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 \ No newline at end of file +export default i18n; diff --git a/src/lang/zh-cn.ts b/src/lang/zh-cn.ts index f0b0017e..f84da521 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:'码云' - } -} \ No newline at end of file + // 路由国际化 + 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 3480cd75..ef45a2dc 100644 --- a/src/layout/components/AppMain.vue +++ b/src/layout/components/AppMain.vue @@ -1,19 +1,18 @@ - diff --git a/src/layout/components/Settings/index.vue b/src/layout/components/Settings/index.vue index 5e5f5588..6eea1dad 100644 --- a/src/layout/components/Settings/index.vue +++ b/src/layout/components/Settings/index.vue @@ -1,103 +1,103 @@ diff --git a/src/layout/components/Sidebar/Link.vue b/src/layout/components/Sidebar/Link.vue index 0254b59a..108fc26a 100644 --- a/src/layout/components/Sidebar/Link.vue +++ b/src/layout/components/Sidebar/Link.vue @@ -1,53 +1,45 @@ \ No newline at end of file + props: { + to: { + type: String, + required: true + } + }, + setup(props) { + const router = useRouter(); + const push = () => { + if (device.value === 'mobile' && sidebar.value.opened == true) { + app.closeSideBar(false); + } + router.push(props.to).catch(err => { + console.log(err); + }); + }; + return { + push, + isExternal + }; + } +}); + diff --git a/src/layout/components/Sidebar/Logo.vue b/src/layout/components/Sidebar/Logo.vue index 39c5a7e1..dfab5090 100644 --- a/src/layout/components/Sidebar/Logo.vue +++ b/src/layout/components/Sidebar/Logo.vue @@ -1,85 +1,89 @@ diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue index 069fe7c2..637b78fe 100644 --- a/src/layout/components/Sidebar/SidebarItem.vue +++ b/src/layout/components/Sidebar/SidebarItem.vue @@ -1,102 +1,114 @@ - \ No newline at end of file + diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue index 3f320d8d..586e362c 100644 --- a/src/layout/components/Sidebar/index.vue +++ b/src/layout/components/Sidebar/index.vue @@ -1,51 +1,51 @@ diff --git a/src/layout/components/TagsView/ScrollPane.vue b/src/layout/components/TagsView/ScrollPane.vue index cde627f1..a37def4e 100644 --- a/src/layout/components/TagsView/ScrollPane.vue +++ b/src/layout/components/TagsView/ScrollPane.vue @@ -1,25 +1,24 @@ diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index 047ff011..15d4f50e 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -1,64 +1,82 @@ - - \ No newline at end of file + diff --git a/src/layout/components/index.ts b/src/layout/components/index.ts index 6fea3b87..4dca96ed 100644 --- a/src/layout/components/index.ts +++ b/src/layout/components/index.ts @@ -1,4 +1,4 @@ -export { default as Navbar } from './Navbar.vue' -export { default as AppMain } from './AppMain.vue' -export { default as Settings } from './Settings/index.vue' -export { default as TagsView } from './TagsView/index.vue' +export { default as Navbar } from './Navbar.vue'; +export { default as AppMain } from './AppMain.vue'; +export { default as Settings } from './Settings/index.vue'; +export { default as TagsView } from './TagsView/index.vue'; diff --git a/src/layout/index.vue b/src/layout/index.vue index b177484e..77932127 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -1,32 +1,32 @@ diff --git a/src/main.ts b/src/main.ts index ceaea6aa..eece50cd 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,42 +1,43 @@ -import {createApp, Directive} from 'vue' -import App from './App.vue' -import router from "@/router"; +import { createApp, Directive } from 'vue'; +import App from './App.vue'; +import router from '@/router'; -import { createPinia } from "pinia" +import { createPinia } from 'pinia'; -import ElementPlus from 'element-plus' -import 'element-plus/theme-chalk/index.css' -import Pagination from '@/components/Pagination/index.vue' -import '@/permission' +import ElementPlus from 'element-plus'; +import 'element-plus/theme-chalk/index.css'; +import Pagination from '@/components/Pagination/index.vue'; +import '@/permission'; // 引入svg注册脚本 import 'virtual:svg-icons-register'; // 国际化 -import i18n from "@/lang/index"; +import i18n from '@/lang/index'; // 自定义样式 -import '@/styles/index.scss' +import '@/styles/index.scss'; // 根据字典编码获取字典列表全局方法 -import {listDictsByCode} from '@/api/system/dict' +import { listDictsByCode } from '@/api/system/dict'; -const app = createApp(App) +const app = createApp(App); // 自定义指令 -import * as directive from "@/directive"; +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]); }); // 全局方法 -app.config.globalProperties.$listDictsByCode = listDictsByCode +app.config.globalProperties.$listDictsByCode = listDictsByCode; // 注册全局组件 -app.component('Pagination', Pagination) - .use(createPinia()) - .use(router) - .use(ElementPlus) - .use(i18n) - .mount('#app') +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 9bb38745..194ef8e9 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -1,55 +1,55 @@ -import router from "@/router"; -import { ElMessage } from "element-plus"; -import useStore from "@/store"; +import router from '@/router'; +import { ElMessage } from 'element-plus'; +import useStore from '@/store'; import NProgress from 'nprogress'; -import 'nprogress/nprogress.css' -NProgress.configure({ showSpinner: false }) // 进度环显示/隐藏 +import 'nprogress/nprogress.css'; +NProgress.configure({ showSpinner: false }); // 进度环显示/隐藏 // 白名单路由 -const whiteList = ['/login', '/auth-redirect'] +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 6c9674a1..abbdfa04 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,53 +1,53 @@ -import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router' -import useStore from "@/store"; +import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'; +import useStore from '@/store'; -export const Layout = () => import('@/layout/index.vue') +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', @@ -97,25 +97,25 @@ 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 \ No newline at end of file +export default router; diff --git a/src/settings.ts b/src/settings.ts index cbff21f2..3df78d86 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -1,21 +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 \ No newline at end of file +export default defaultSettings; diff --git a/src/store/index.ts b/src/store/index.ts index 184ebbdc..026df6bd 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,15 +1,15 @@ -import useUserStore from './modules/user' -import useAppStore from './modules/app' -import usePermissionStore from './modules/permission' -import useSettingStore from './modules/settings' -import useTagsViewStore from './modules/tagsView' +import useUserStore from './modules/user'; +import useAppStore from './modules/app'; +import usePermissionStore from './modules/permission'; +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 \ No newline at end of file +export default useStore; diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts index c4f53207..0b0a4cf1 100644 --- a/src/store/modules/app.ts +++ b/src/store/modules/app.ts @@ -1,46 +1,48 @@ -import { AppState } from "@/types"; -import { localStorage } from "@/utils/storage"; -import { defineStore } from "pinia"; -import { getLanguage } from '@/lang/index' +import { AppState } from '@/types'; +import { localStorage } from '@/utils/storage'; +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; \ No newline at end of file +export default useAppStore; diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index 4048129b..b02103f5 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -1,76 +1,80 @@ -import { PermissionState } from "@/types"; -import { RouteRecordRaw } from 'vue-router' -import { defineStore } from "pinia"; -import { constantRoutes } from '@/router' -import { listRoutes } from "@/api/system/menu"; +import { PermissionState } from '@/types'; +import { RouteRecordRaw } from 'vue-router'; +import { defineStore } from 'pinia'; +import { constantRoutes } from '@/router'; +import { listRoutes } from '@/api/system/menu'; -const modules = import.meta.glob("../../views/**/**.vue"); -export const Layout = () => import('@/layout/index.vue') +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[]) => { - 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 -} +export const filterAsyncRoutes = ( + 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); + 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 de344526..d22798f5 100644 --- a/src/store/modules/settings.ts +++ b/src/store/modules/settings.ts @@ -1,45 +1,50 @@ -import { defineStore } from "pinia"; -import { SettingState } from "@/types"; -import defaultSettings from '../../settings' -import { localStorage } from "@/utils/storage"; +import { defineStore } from 'pinia'; +import { SettingState } from '@/types'; +import defaultSettings from '../../settings'; +import { localStorage } from '@/utils/storage'; -const { showSettings, tagsView, fixedHeader, sidebarLogo } = defaultSettings -const el = document.documentElement +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 8acaad37..d08d5887 100644 --- a/src/store/modules/tagsView.ts +++ b/src/store/modules/tagsView.ts @@ -1,175 +1,175 @@ -import { defineStore } from "pinia"; -import { TagsViewState } from "@/types"; +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]) - }) + 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]); + }); + }, - }, - 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]); + }); + }, - }, + 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; + } - delOtherVisitedViews(view: any) { - return new Promise(resolve => { - this.visitedViews = this.visitedViews.filter(v => { - return v.meta?.affix || v.path === view.path - }) - resolve([...this.visitedViews]) - }) + 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; + } - }, - 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 - } - - 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 4b5f9556..69269e3d 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,105 +1,108 @@ -import { defineStore } from "pinia"; -import { LoginFormData, UserState } from "@/types"; -import { localStorage } from "@/utils/storage"; -import { login, logout } from "@/api/login"; -import { getUserInfo } from "@/api/system/user"; -import { resetRouter } from "@/router"; +import { defineStore } from 'pinia'; +import { LoginFormData, UserState } from '@/types'; +import { localStorage } from '@/utils/storage'; +import { login, logout } from '@/api/login'; +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; \ No newline at end of file +export default useUserStore; diff --git a/src/styles/element-plus.scss b/src/styles/element-plus.scss index 492b113a..7ef568d3 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; +.el-card__header { + height: 60px !important; } // 表格表头和表体未对齐 -.el-table__header col[name="gutter"] { - display: table-cell !important; -} \ No newline at end of file +.el-table__header col[name='gutter'] { + display: table-cell !important; +} diff --git a/src/styles/index.scss b/src/styles/index.scss index 1416e9dc..224a053b 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -5,63 +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 36b74bbd..2a0e04a9 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 b53e82c0..0ed5a6f1 100644 --- a/src/styles/sidebar.scss +++ b/src/styles/sidebar.scss @@ -1,228 +1,228 @@ #app { - .main-container { - min-height: 100%; - transition: margin-left .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 .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 4cb27cc8..b69e4a30 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 .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 .5s; + transition: all 0.5s; } .breadcrumb-enter, .breadcrumb-leave-active { - opacity: 0; - transform: translateX(20px); + opacity: 0; + transform: translateX(20px); } .breadcrumb-move { - transition: all .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 be557726..d0d48ea1 100644 --- a/src/styles/variables.module.scss +++ b/src/styles/variables.module.scss @@ -1,25 +1,25 @@ // sidebar -$menuText:#bfcbd9; -$menuActiveText:#409EFF; -$subMenuActiveText:#f4f4f5; //https://github.com/ElemeFE/element/issues/12951 +$menuText: #bfcbd9; +$menuActiveText: #409eff; +$subMenuActiveText: #f4f4f5; //https://github.com/ElemeFE/element/issues/12951 -$menuBg:#304156; -$menuHover:#263445; +$menuBg: #304156; +$menuHover: #263445; -$subMenuBg:#1f2d3d; -$subMenuHover:#001528; +$subMenuBg: #1f2d3d; +$subMenuHover: #001528; $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 d934383c..9bc3c8a6 100644 --- a/src/types/api/base.d.ts +++ b/src/types/api/base.d.ts @@ -1,11 +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 e3d555a7..eaef667b 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; -} \ No newline at end of file + 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 f4b941d5..be3a3acb 100644 --- a/src/types/api/oms/order.d.ts +++ b/src/types/api/oms/order.d.ts @@ -1,4 +1,4 @@ -import { PageQueryParam, PageResult } from "../base" +import { PageQueryParam, PageResult } from '../base'; /** * 订单查询参数类型声明 @@ -38,7 +38,7 @@ export interface OrderItem { /** * 订单分页项类型声明 */ -export type OrderPageResult = PageResult +export type OrderPageResult = PageResult; /** * 订单表单类型声明 @@ -53,4 +53,4 @@ export interface OrderDetail { sort: number; url: string; remark: string; -} \ No newline at end of file +} diff --git a/src/types/api/pms/brand.d.ts b/src/types/api/pms/brand.d.ts index 8d0dda67..1f29ecd8 100644 --- a/src/types/api/pms/brand.d.ts +++ b/src/types/api/pms/brand.d.ts @@ -1,34 +1,33 @@ -import { PageQueryParam, PageResult } from "../base" +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; } /** * 品牌分页项类型声明 */ -export type BrandPageResult = PageResult +export type BrandPageResult = PageResult; /** * 品牌表单类型声明 */ export interface BrandFormData { - id: number | undefined, - name: string, - logoUrl: string, - sort: number -} \ No newline at end of file + 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 9493cb64..f82b05ae 100644 --- a/src/types/api/pms/goods.d.ts +++ b/src/types/api/pms/goods.d.ts @@ -1,11 +1,11 @@ -import { PageQueryParam, PageResult } from "../base" +import { PageQueryParam, PageResult } from '../base'; /** * 商品查询参数类型声明 */ export interface GoodsQueryParam extends PageQueryParam { - name?: stirng, - categoryId?: number + name?: stirng; + categoryId?: number; } /** @@ -48,25 +48,23 @@ export interface SkuItem { /** * 商品分页项类型声明 */ -export type GoodsPageResult = PageResult +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 99a3185f..6862b804 100644 --- a/src/types/api/sms/advert.d.ts +++ b/src/types/api/sms/advert.d.ts @@ -1,38 +1,38 @@ -import { PageQueryParam, PageResult } from "../base" +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; } /** * 广告分页项类型声明 */ -export type AdvertPageResult = PageResult +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; -} \ No newline at end of file + 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 e9bcaabe..72d6b70f 100644 --- a/src/types/api/system/client.d.ts +++ b/src/types/api/system/client.d.ts @@ -1,21 +1,20 @@ -import { PageQueryParam, PageResult } from "../base" +import { PageQueryParam, PageResult } from '../base'; /** * 客户端查询参数类型声明 */ export interface ClientQueryParam extends PageQueryParam { - /** - * 客户端名称 - */ - clientId: string | undefined + /** + * 客户端名称 + */ + clientId: string | undefined; } - /** * 客户端分页列表项声明 */ export interface ClientItem { - clientId: string; + clientId: string; clientSecret: string; resourceIds: string; scope: string; @@ -31,20 +30,20 @@ export interface ClientItem { /** * 客户端分页项类型声明 */ -export type ClientPageResult = PageResult +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; -} \ No newline at end of file + 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 1f78f3d4..abc31b15 100644 --- a/src/types/api/system/dept.d.ts +++ b/src/types/api/system/dept.d.ts @@ -1,10 +1,9 @@ - /** * 部门查询参数类型声明 */ export interface DeptQueryParam { - name: string | undefined, - status: number | undefined + name: string | undefined; + status: number | undefined; } /** @@ -12,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 -} \ No newline at end of file + 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 f749fa9d..02fb413d 100644 --- a/src/types/api/system/dict.d.ts +++ b/src/types/api/system/dict.d.ts @@ -1,87 +1,86 @@ -import { PageQueryParam, PageResult } from "../base" +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; } /** * 字典分页项类型声明 */ -export type DictPageResult = PageResult +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; } /** * 字典分页项类型声明 */ -export type DictItemPageResult = PageResult +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; -} \ No newline at end of file + 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 bbc3a33c..15d6f23f 100644 --- a/src/types/api/system/login.d.ts +++ b/src/types/api/system/login.d.ts @@ -2,26 +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 18229de2..b6597df1 100644 --- a/src/types/api/system/menu.d.ts +++ b/src/types/api/system/menu.d.ts @@ -1,9 +1,8 @@ - /** * 菜单查询参数类型声明 */ export interface MenuQueryParam { - name?: string + name?: string; } /** @@ -11,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 -} \ No newline at end of file + /** + * 菜单类型(1:菜单;2:目录;3:外链) + */ + type: string; +} diff --git a/src/types/api/system/perm.d.ts b/src/types/api/system/perm.d.ts index 370d2c51..21c3fae8 100644 --- a/src/types/api/system/perm.d.ts +++ b/src/types/api/system/perm.d.ts @@ -1,37 +1,37 @@ -import { PageQueryParam, PageResult } from "../base" +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[]; } /** * 权限分页项类型声明 */ -export type PermPageResult = PageResult +export type PermPageResult = PageResult; /** * 权限表单类型声明 */ export interface PermFormData { - id: number|undefined, - name: string, - urlPerm: string, - btnPerm: string, - menuId: string -} \ No newline at end of file + 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 f1b3a35b..63f20581 100644 --- a/src/types/api/system/role.d.ts +++ b/src/types/api/system/role.d.ts @@ -1,17 +1,17 @@ -import { PageQueryParam, PageResult } from "../base" +import { PageQueryParam, PageResult } from '../base'; /** * 角色查询参数类型声明 */ export interface RoleQueryParam extends PageQueryParam { - name?: string + name?: string; } /** * 角色分页列表项声明 */ export interface RoleItem { - id: string; + id: string; name: string; code: string; sort: number; @@ -21,19 +21,18 @@ export interface RoleItem { permissionIds?: any; } - /** * 角色分页项类型声明 */ -export type RolePageResult = PageResult +export type RolePageResult = PageResult; /** * 角色表单类型声明 */ export interface RoleFormData { - id: number|undefined, - name: string, - code: string, - sort: number, - status: number -} \ No newline at end of file + 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 1ad18007..5b02e33e 100644 --- a/src/types/api/system/user.d.ts +++ b/src/types/api/system/user.d.ts @@ -1,67 +1,67 @@ -import { PageQueryParam, PageResult } from "../base" +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; } /** * 用户分页项类型声明 */ -export type UserPageResult = PageResult +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[] -} \ No newline at end of file + deptId: number; + roleIds: number[]; +} diff --git a/src/types/api/ums/member.d.ts b/src/types/api/ums/member.d.ts index cc846603..438748e0 100644 --- a/src/types/api/ums/member.d.ts +++ b/src/types/api/ums/member.d.ts @@ -1,10 +1,10 @@ -import { PageQueryParam, PageResult } from "../base" +import { PageQueryParam, PageResult } from '../base'; /** * 会员查询参数类型声明 */ export interface MemberQueryParam extends PageQueryParam { - nickName?: string + nickName?: string; } /** @@ -46,19 +46,19 @@ export interface AddressItem { /** * 会员分页项类型声明 */ -export type MemberPageResult = PageResult +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; -} \ No newline at end of file + 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 1aeff93f..0df1bbe4 100644 --- a/src/types/common.d.ts +++ b/src/types/common.d.ts @@ -6,16 +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/index.d.ts b/src/types/index.d.ts index 03e864f9..3784e446 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -1,22 +1,19 @@ +export * from './api/system/login'; +export * from './api/system/user'; +export * from './api/system/role'; +export * from './api/system/menu'; +export * from './api/system/dept'; +export * from './api/system/dict'; +export * from './api/system/perm'; +export * from './api/system/client'; -export * from './api/system/login' -export * from './api/system/user' -export * from './api/system/role' -export * from './api/system/menu' -export * from './api/system/dept' -export * from './api/system/dict' -export * from './api/system/perm' -export * from './api/system/client' +export * from './api/pms/goods'; +export * from './api/pms/brand'; +export * from './api/sms/advert'; +export * from './api/oms/order'; +export * from './api/ums/member'; +export * from './api/lab/seata'; +export * from './store'; -export * from './api/pms/goods' -export * from './api/pms/brand' -export * from './api/sms/advert' -export * from './api/oms/order' -export * from './api/ums/member' -export * from './api/lab/seata' - -export * from './store' - -export * from './common' - +export * from './common'; diff --git a/src/types/store.d.ts b/src/types/store.d.ts index 3c94d5cc..2091f77c 100644 --- a/src/types/store.d.ts +++ b/src/types/store.d.ts @@ -1,57 +1,55 @@ - -import { RouteRecordRaw, RouteLocationNormalized } from "vue-router"; +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 b5c9871b..beb11e30 100644 --- a/src/utils/filter.ts +++ b/src/utils/filter.ts @@ -1,29 +1,28 @@ - /** * Show plural label if time is plural number * @param {number} time * @param {string} label * @return {string} */ -function pluralize(time:number, label:string) { - if (time === 1) { - return time + label - } - return time + label + 's' +function pluralize(time: number, label: string) { + 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') - } +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'); + } } /** @@ -32,45 +31,50 @@ export function timeAgo(time:number) { * @param {number} num * @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() +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(); } /** * 10000 => "10,000" * @param {number} num */ -export function toThousandFilter(num:number) { - return (+num || 0).toString().replace(/^-?\d+/g, m => m.replace(/(?=(?!\b)(\d{3})+$)/g, ',')) +export function toThousandFilter(num: number) { + return (+num || 0) + .toString() + .replace(/^-?\d+/g, m => m.replace(/(?=(?!\b)(\d{3})+$)/g, ',')); } /** * Upper case first char * @param {String} string */ -export function uppercaseFirst(string:string) { - return string.charAt(0).toUpperCase() + string.slice(1) +export function uppercaseFirst(string: string) { + return string.charAt(0).toUpperCase() + string.slice(1); } - /** * 金额转换(分->元) * 100 => 1 * @param {number} num */ -export function moneyFormatter(num:number) { - return '¥'+(isNaN(num) ? 0.00 : parseFloat((num / 100).toFixed(2))) +export function moneyFormatter(num: number) { + return '¥' + (isNaN(num) ? 0.0 : parseFloat((num / 100).toFixed(2))); } diff --git a/src/utils/i18n.ts b/src/utils/i18n.ts index 06d8dede..bc765c28 100644 --- a/src/utils/i18n.ts +++ b/src/utils/i18n.ts @@ -1,12 +1,12 @@ // translate router.meta.title, be used in breadcrumb sidebar tagsview -import i18n from "@/lang/index"; +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 -} \ No newline at end of file + // 判断是否存在国际化配置,如果没有原生返回 + 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 1b09f098..080f8a18 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 7af875bf..34235766 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -1,66 +1,69 @@ -import axios, { AxiosRequestConfig, AxiosResponse } from "axios"; -import { ElMessage, ElMessageBox } from "element-plus"; -import { localStorage } from "@/utils/storage"; -import useStore from "@/store"; +import axios, { AxiosRequestConfig, AxiosResponse } from 'axios'; +import { ElMessage, ElMessageBox } from 'element-plus'; +import { localStorage } from '@/utils/storage'; +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 { + (response: AxiosResponse) => { + const { code, msg } = response.data; + if (code === '00000') { + return response.data; + } else { + // 响应数据为二进制流处理(Excel导出) + if (response.data instanceof ArrayBuffer) { + return response; + } - // 响应数据为二进制流处理(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 实例 -export default service +export default service; diff --git a/src/utils/resize.ts b/src/utils/resize.ts index 7b87e539..e2710ca8 100644 --- a/src/utils/resize.ts +++ b/src/utils/resize.ts @@ -1,67 +1,72 @@ +import { ref } from 'vue'; +export default function () { + const chart = ref(); + const sidebarElm = ref(); -import { ref } from 'vue' -export default function() { - 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 eefab29a..1ff96482 100644 --- a/src/utils/scroll-to.ts +++ b/src/utils/scroll-to.ts @@ -1,33 +1,41 @@ 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); + } + ); +})(); /** * Because it's so fucking difficult to detect the scrolling element, just move them all * @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 + ); +}; /** * @param {number} to @@ -35,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 ba9be68b..3ba50bdb 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 19e07050..264b7e63 100644 --- a/src/utils/validate.ts +++ b/src/utils/validate.ts @@ -7,7 +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 17d90180..fee2e66c 100644 --- a/src/views/dashboard/components/Chart/BarChart.vue +++ b/src/views/dashboard/components/Chart/BarChart.vue @@ -1,183 +1,174 @@ \ No newline at end of file + mounted(); + nextTick(() => { + initChart(); + }); +}); + diff --git a/src/views/dashboard/components/Chart/FunnelChart.vue b/src/views/dashboard/components/Chart/FunnelChart.vue index 3234d992..2a7acb64 100644 --- a/src/views/dashboard/components/Chart/FunnelChart.vue +++ b/src/views/dashboard/components/Chart/FunnelChart.vue @@ -1,142 +1,135 @@ - \ No newline at end of file + diff --git a/src/views/dashboard/components/Chart/PieChart.vue b/src/views/dashboard/components/Chart/PieChart.vue index ae41becc..eaeddaed 100644 --- a/src/views/dashboard/components/Chart/PieChart.vue +++ b/src/views/dashboard/components/Chart/PieChart.vue @@ -1,123 +1,115 @@ - \ No newline at end of file + diff --git a/src/views/dashboard/components/Chart/RadarChart.vue b/src/views/dashboard/components/Chart/RadarChart.vue index 24177f67..05985d95 100644 --- a/src/views/dashboard/components/Chart/RadarChart.vue +++ b/src/views/dashboard/components/Chart/RadarChart.vue @@ -1,142 +1,134 @@ - \ No newline at end of file + diff --git a/src/views/dashboard/components/Project/index.vue b/src/views/dashboard/components/Project/index.vue index 6d5598f7..2ca397c8 100644 --- a/src/views/dashboard/components/Project/index.vue +++ b/src/views/dashboard/components/Project/index.vue @@ -1,93 +1,119 @@ \ No newline at end of file + diff --git a/src/views/dashboard/components/Team/index.vue b/src/views/dashboard/components/Team/index.vue index 1313916d..bd69a9c8 100644 --- a/src/views/dashboard/components/Team/index.vue +++ b/src/views/dashboard/components/Team/index.vue @@ -1,110 +1,129 @@ - diff --git a/src/views/error-page/401.vue b/src/views/error-page/401.vue index a52ed23b..8f71920e 100644 --- a/src/views/error-page/401.vue +++ b/src/views/error-page/401.vue @@ -1,99 +1,103 @@ diff --git a/src/views/error-page/404.vue b/src/views/error-page/404.vue index 1791f55a..f576a8e5 100644 --- a/src/views/error-page/404.vue +++ b/src/views/error-page/404.vue @@ -1,228 +1,252 @@ diff --git a/src/views/lab/seata/index.vue b/src/views/lab/seata/index.vue index f2c2827d..5a717f19 100644 --- a/src/views/lab/seata/index.vue +++ b/src/views/lab/seata/index.vue @@ -1,7 +1,7 @@ @@ -9,307 +9,367 @@ export default { import { reactive, onMounted, toRefs } from 'vue'; import SvgIcon from '@/components/SvgIcon/index.vue'; import { - Money, - Refresh, - RefreshLeft, - Right, - CircleCheckFilled, - CircleCloseFilled -} from "@element-plus/icons-vue"; -import { - payOrder, - getSeataData, - resetSeataData -} from "@/api/lab/seata"; + 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"; +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) +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(); }); \ No newline at end of file + diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 5e94ab86..e68f7fe5 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -1,80 +1,125 @@ @@ -214,78 +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; + } } @@ -295,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 6938bf1c..e5d07358 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 a9f31caa..4c21daa3 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 94de1f0d..64cb2376 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 e933503a..b027cd25 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 e00e49ba..f15e84d0 100644 --- a/src/views/oms/order/index.vue +++ b/src/views/oms/order/index.vue @@ -1,239 +1,232 @@ - + diff --git a/src/views/pms/brand/index.vue b/src/views/pms/brand/index.vue index 4c540caf..3633d836 100644 --- a/src/views/pms/brand/index.vue +++ b/src/views/pms/brand/index.vue @@ -1,232 +1,275 @@ - - + diff --git a/src/views/pms/category/components/Attribute.vue b/src/views/pms/category/components/Attribute.vue index 023cd730..a0fe5f0c 100644 --- a/src/views/pms/category/components/Attribute.vue +++ b/src/views/pms/category/components/Attribute.vue @@ -1,143 +1,183 @@ diff --git a/src/views/pms/category/components/Category.vue b/src/views/pms/category/components/Category.vue index c7aad993..a5a73f47 100644 --- a/src/views/pms/category/components/Category.vue +++ b/src/views/pms/category/components/Category.vue @@ -1,234 +1,291 @@ diff --git a/src/views/pms/category/index.vue b/src/views/pms/category/index.vue index 7abc51bc..aacc72b5 100644 --- a/src/views/pms/category/index.vue +++ b/src/views/pms/category/index.vue @@ -1,73 +1,79 @@ - + diff --git a/src/views/pms/goods/components/GoodsAttribute.vue b/src/views/pms/goods/components/GoodsAttribute.vue index 89c0c337..4e0745b9 100644 --- a/src/views/pms/goods/components/GoodsAttribute.vue +++ b/src/views/pms/goods/components/GoodsAttribute.vue @@ -1,144 +1,178 @@ diff --git a/src/views/pms/goods/components/GoodsCategory.vue b/src/views/pms/goods/components/GoodsCategory.vue index 6b3e723e..1081c319 100644 --- a/src/views/pms/goods/components/GoodsCategory.vue +++ b/src/views/pms/goods/components/GoodsCategory.vue @@ -1,97 +1,112 @@ diff --git a/src/views/pms/goods/components/GoodsInfo.vue b/src/views/pms/goods/components/GoodsInfo.vue index 96e1d3a0..7afb33ed 100644 --- a/src/views/pms/goods/components/GoodsInfo.vue +++ b/src/views/pms/goods/components/GoodsInfo.vue @@ -1,185 +1,219 @@ diff --git a/src/views/pms/goods/components/GoodsStock.vue b/src/views/pms/goods/components/GoodsStock.vue index 9cb5d6b1..ffab66e8 100644 --- a/src/views/pms/goods/components/GoodsStock.vue +++ b/src/views/pms/goods/components/GoodsStock.vue @@ -1,133 +1,208 @@ diff --git a/src/views/pms/goods/detail.vue b/src/views/pms/goods/detail.vue index a042c3ae..f03e4d28 100644 --- a/src/views/pms/goods/detail.vue +++ b/src/views/pms/goods/detail.vue @@ -1,82 +1,110 @@ diff --git a/src/views/pms/goods/index.vue b/src/views/pms/goods/index.vue index acf4ea45..f78eddc0 100644 --- a/src/views/pms/goods/index.vue +++ b/src/views/pms/goods/index.vue @@ -1,266 +1,276 @@ - + diff --git a/src/views/redirect/index.vue b/src/views/redirect/index.vue index 2363a22e..5558ffc3 100644 --- a/src/views/redirect/index.vue +++ b/src/views/redirect/index.vue @@ -1,15 +1,15 @@ diff --git a/src/views/sms/advert/index.vue b/src/views/sms/advert/index.vue index b745b245..3fd2617d 100644 --- a/src/views/sms/advert/index.vue +++ b/src/views/sms/advert/index.vue @@ -1,244 +1,297 @@ \ No newline at end of file + + + + diff --git a/src/views/system/client/index.vue b/src/views/system/client/index.vue index 79131a07..a2d7ba02 100644 --- a/src/views/system/client/index.vue +++ b/src/views/system/client/index.vue @@ -1,300 +1,370 @@ \ No newline at end of file + + + + diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index ce942da3..2fd74897 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -1,168 +1,168 @@ diff --git a/src/views/system/dict/components/Dict.vue b/src/views/system/dict/components/Dict.vue index d9514e9a..412d9d6b 100644 --- a/src/views/system/dict/components/Dict.vue +++ b/src/views/system/dict/components/Dict.vue @@ -1,221 +1,265 @@ diff --git a/src/views/system/dict/components/DictItem.vue b/src/views/system/dict/components/DictItem.vue index 0b24a39a..f32a3650 100644 --- a/src/views/system/dict/components/DictItem.vue +++ b/src/views/system/dict/components/DictItem.vue @@ -1,250 +1,300 @@ \ No newline at end of file + diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue index 57935565..2d164f35 100644 --- a/src/views/system/dict/index.vue +++ b/src/views/system/dict/index.vue @@ -1,54 +1,56 @@ diff --git a/src/views/system/menu/components/Menu.vue b/src/views/system/menu/components/Menu.vue index 074b0f62..09b63d37 100644 --- a/src/views/system/menu/components/Menu.vue +++ b/src/views/system/menu/components/Menu.vue @@ -1,360 +1,450 @@ \ No newline at end of file + diff --git a/src/views/system/menu/components/Perm.vue b/src/views/system/menu/components/Perm.vue index 0ee7c54f..b0d2f696 100644 --- a/src/views/system/menu/components/Perm.vue +++ b/src/views/system/menu/components/Perm.vue @@ -1,31 +1,30 @@ - diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue index d921d7e4..38d52b55 100644 --- a/src/views/system/menu/index.vue +++ b/src/views/system/menu/index.vue @@ -1,56 +1,57 @@ - \ No newline at end of file + diff --git a/src/views/system/role/components/Menu.vue b/src/views/system/role/components/Menu.vue index 7023bd72..6b01f898 100644 --- a/src/views/system/role/components/Menu.vue +++ b/src/views/system/role/components/Menu.vue @@ -1,113 +1,128 @@ diff --git a/src/views/system/role/components/Perm.vue b/src/views/system/role/components/Perm.vue index 40fca0d6..be4e636b 100644 --- a/src/views/system/role/components/Perm.vue +++ b/src/views/system/role/components/Perm.vue @@ -1,144 +1,162 @@ diff --git a/src/views/system/role/components/Role.vue b/src/views/system/role/components/Role.vue index cc335664..1e44a134 100644 --- a/src/views/system/role/components/Role.vue +++ b/src/views/system/role/components/Role.vue @@ -1,228 +1,277 @@ - - - \ No newline at end of file + diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue index 5e187a80..4243b730 100644 --- a/src/views/system/role/index.vue +++ b/src/views/system/role/index.vue @@ -1,117 +1,116 @@ - + diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 100a1a9f..ae305513 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -1,61 +1,67 @@ - - - + diff --git a/src/views/ums/member/index.vue b/src/views/ums/member/index.vue index 8a27fd82..825048e1 100644 --- a/src/views/ums/member/index.vue +++ b/src/views/ums/member/index.vue @@ -1,149 +1,174 @@ - + diff --git a/tsconfig.json b/tsconfig.json index d8b764c2..9ea54bdf 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"] }