From b4ff6fcd38a5b89240c980f03679de9506f5b7ab Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Sun, 26 Nov 2023 23:58:21 +0800 Subject: [PATCH 001/258] =?UTF-8?q?refactor:=20:recycle:=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E7=B1=BB=E5=9E=8B=E5=A3=B0=E6=98=8E=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E8=87=B3=20`src/typings`=20=E5=92=8C=20`elem?= =?UTF-8?q?ent-plus`=20=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {types => src/typings}/auto-imports.d.ts | 0 {types => src/typings}/components.d.ts | 0 {types => src/typings}/env.d.ts | 0 {types => src/typings}/global.d.ts | 0 {types => src/typings}/router.d.ts | 0 {types => src/typings}/shims-vue.d.ts | 0 tsconfig.json | 2 +- vite.config.ts | 4 ++-- 8 files changed, 3 insertions(+), 3 deletions(-) rename {types => src/typings}/auto-imports.d.ts (100%) rename {types => src/typings}/components.d.ts (100%) rename {types => src/typings}/env.d.ts (100%) rename {types => src/typings}/global.d.ts (100%) rename {types => src/typings}/router.d.ts (100%) rename {types => src/typings}/shims-vue.d.ts (100%) diff --git a/types/auto-imports.d.ts b/src/typings/auto-imports.d.ts similarity index 100% rename from types/auto-imports.d.ts rename to src/typings/auto-imports.d.ts diff --git a/types/components.d.ts b/src/typings/components.d.ts similarity index 100% rename from types/components.d.ts rename to src/typings/components.d.ts diff --git a/types/env.d.ts b/src/typings/env.d.ts similarity index 100% rename from types/env.d.ts rename to src/typings/env.d.ts diff --git a/types/global.d.ts b/src/typings/global.d.ts similarity index 100% rename from types/global.d.ts rename to src/typings/global.d.ts diff --git a/types/router.d.ts b/src/typings/router.d.ts similarity index 100% rename from types/router.d.ts rename to src/typings/router.d.ts diff --git a/types/shims-vue.d.ts b/src/typings/shims-vue.d.ts similarity index 100% rename from types/shims-vue.d.ts rename to src/typings/shims-vue.d.ts diff --git a/tsconfig.json b/tsconfig.json index 6164b063..6d1e993c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,7 +27,7 @@ "include": [ "src/**/*.ts", "src/**/*.vue", - "types/**/*.d.ts", + "src/typings/**/*.d.ts", "mock/**/*.ts", "vite.config.ts" ], diff --git a/vite.config.ts b/vite.config.ts index 139e03b3..75851bee 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -81,7 +81,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { vueTemplate: true, // 配置文件生成位置(false:关闭自动生成) dts: false, - // dts: "types/auto-imports.d.ts", + // dts: "src/typings/auto-imports.d.ts", }), Components({ @@ -95,7 +95,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { dirs: ["src/components", "src/**/components"], // 配置文件位置 (false:关闭自动生成) dts: false, - // dts: "types/components.d.ts", + // dts: "src/typings/components.d.ts", }), Icons({ -- Gitee From 639cea45f7c07bcfccfa6c82f3cefa968820ba6e Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Sat, 2 Dec 2023 14:40:04 +0800 Subject: [PATCH 002/258] =?UTF-8?q?fix:=20:bug:=20=E5=AD=97=E5=85=B8?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BC=B9=E7=AA=97=E6=97=A0=E6=B3=95=E6=89=93?= =?UTF-8?q?=E5=BC=80=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/dict/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue index 63ed6c1a..5740dce3 100644 --- a/src/views/system/dict/index.vue +++ b/src/views/system/dict/index.vue @@ -149,10 +149,10 @@ function handleDelete(dictTypeId?: number) { }); } -const dictDataDialog = { +const dictDataDialog = reactive({ title: "", visible: false, -}; +}); const selectedDictType = reactive({ typeCode: "", typeName: "" }); // 当前选中的字典类型 -- Gitee From b8ebd926f5f9ad17c28cf8c482a0d60976cf91c7 Mon Sep 17 00:00:00 2001 From: yangzhiwen <1163139003@qq.com> Date: Tue, 12 Dec 2023 22:48:03 +0800 Subject: [PATCH 003/258] =?UTF-8?q?build:=20:package:=20=E5=B0=86=E6=89=93?= =?UTF-8?q?=E5=8C=85=E5=90=8E=E7=9A=84=E6=96=87=E4=BB=B6=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/vite.config.ts b/vite.config.ts index 75851bee..6696f5ff 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -192,6 +192,33 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { comments: false, // 删除注释 }, }, + rollupOptions: { + output: { + // manualChunks: { + // "vue-i18n": ["vue-i18n"], + // }, + // 用于从入口点创建的块的打包输出格式[name]表示文件名,[hash]表示该文件内容hash值 + entryFileNames: "js/[name].[hash].js", + // 用于命名代码拆分时创建的共享块的输出命名 + chunkFileNames: "js/[name].[hash].js", + // 用于输出静态资源的命名,[ext]表示文件扩展名 + assetFileNames: (assetInfo: any) => { + const info = assetInfo.name.split("."); + let extType = info[info.length - 1]; + // console.log('文件信息', assetInfo.name) + if ( + /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/i.test(assetInfo.name) + ) { + extType = "media"; + } else if (/\.(png|jpe?g|gif|svg)(\?.*)?$/.test(assetInfo.name)) { + extType = "img"; + } else if (/\.(woff2?|eot|ttf|otf)(\?.*)?$/i.test(assetInfo.name)) { + extType = "fonts"; + } + return `${extType}/[name].[hash].[ext]`; + }, + }, + }, }, }; }); -- Gitee From 7861d5b62457a7cfc4afe019e2d02c42b50484dd Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Tue, 12 Dec 2023 23:33:31 +0800 Subject: [PATCH 004/258] =?UTF-8?q?build:=20:package:=20=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=E5=8D=87=E7=BA=A7=202.7.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/settings.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a71aeed8..0202bc8b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue3-element-admin", - "version": "2.7.0", + "version": "2.7.1", "private": true, "scripts": { "preinstall": "npx only-allow pnpm", diff --git a/src/settings.ts b/src/settings.ts index 7fd27c68..23e2de92 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -1,6 +1,6 @@ const defaultSettings: AppSettings = { title: "vue3-element-admin", - version: "v2.7.0", + version: "v2.7.1", showSettings: true, tagsView: true, fixedHeader: false, -- Gitee From 7cd5582e13d5b40da128c279e6e6798faf3d9a90 Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Sun, 24 Dec 2023 22:06:00 +0800 Subject: [PATCH 005/258] =?UTF-8?q?build:=20:package:=20=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=89=88=E6=9C=AC=E5=8F=B7=E5=92=8C=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E4=BE=9D=E8=B5=96=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 49 ++++++++++++++++++++++++------------------------- src/settings.ts | 2 +- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index 0202bc8b..8573c7a6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue3-element-admin", - "version": "2.7.1", + "version": "2.7.2", "private": true, "scripts": { "preinstall": "npx only-allow pnpm", @@ -40,14 +40,14 @@ ] }, "dependencies": { - "@element-plus/icons-vue": "^2.1.0", - "@vitejs/plugin-vue": "^4.4.0", - "@vueuse/core": "^10.5.0", + "@element-plus/icons-vue": "^2.3.1", + "@vitejs/plugin-vue": "^4.5.2", + "@vueuse/core": "^10.7.0", "@wangeditor/editor": "^5.1.23", "@wangeditor/editor-for-vue": "5.1.10", - "axios": "^1.6.0", + "axios": "^1.6.2", "echarts": "^5.4.3", - "element-plus": "^2.4.2", + "element-plus": "^2.4.4", "lodash-es": "^4.17.21", "mockjs": "^1.1.0", "net": "^1.0.2", @@ -57,60 +57,59 @@ "pinia": "^2.1.7", "screenfull": "^6.0.2", "sockjs-client": "1.6.1", - "sortablejs": "^1.15.0", + "sortablejs": "^1.15.1", "stompjs": "^2.3.3", - "terser": "^5.24.0", - "vue": "^3.3.8", + "terser": "^5.26.0", + "vue": "^3.3.13", "vue-i18n": "9.2.2", "vue-router": "^4.2.5", - "xlsx": "^0.18.5", - "dayjs": "^1.11.10" + "xlsx": "^0.18.5" }, "devDependencies": { "@commitlint/cli": "^17.8.1", "@commitlint/config-conventional": "^17.8.1", - "@iconify-json/ep": "^1.1.12", - "@types/lodash": "^4.14.201", + "@iconify-json/ep": "^1.1.14", + "@types/lodash": "^4.14.202", "@types/nprogress": "^0.2.3", "@types/path-browserify": "^1.0.2", "@types/sockjs-client": "^1.5.4", - "@types/sortablejs": "^1.15.5", - "@types/stompjs": "^2.3.8", + "@types/sortablejs": "^1.15.7", + "@types/stompjs": "^2.3.9", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", - "@vitejs/plugin-vue-jsx": "^3.0.2", + "@vitejs/plugin-vue-jsx": "^3.1.0", "autoprefixer": "^10.4.16", "commitizen": "^4.3.0", - "cz-git": "^1.7.1", - "eslint": "^8.53.0", + "cz-git": "^1.8.0", + "eslint": "^8.56.0", "eslint-config-prettier": "^8.10.0", - "eslint-plugin-import": "^2.29.0", + "eslint-plugin-import": "^2.29.1", "eslint-plugin-prettier": "^4.2.1", - "eslint-plugin-vue": "^9.18.1", + "eslint-plugin-vue": "^9.19.2", "fast-glob": "^3.3.2", "husky": "^8.0.3", "lint-staged": "^13.3.0", - "postcss": "^8.4.31", + "postcss": "^8.4.32", "postcss-html": "^1.5.0", "postcss-scss": "^4.0.9", "prettier": "^2.8.8", "sass": "^1.69.5", "stylelint": "^15.11.0", "stylelint-config-html": "^1.1.0", - "stylelint-config-recess-order": "^4.3.0", + "stylelint-config-recess-order": "^4.4.0", "stylelint-config-recommended-scss": "^13.1.0", "stylelint-config-recommended-vue": "^1.5.0", "stylelint-config-standard": "^34.0.0", "stylelint-config-standard-scss": "^11.1.0", - "typescript": "^5.2.2", + "typescript": "^5.3.3", "unocss": "^0.51.13", "unplugin-auto-import": "^0.15.3", "unplugin-icons": "^0.16.6", "unplugin-vue-components": "^0.24.1", - "vite": "^4.5.0", + "vite": "^4.5.1", "vite-plugin-mock": "^3.0.0", "vite-plugin-svg-icons": "^2.0.1", - "vue-tsc": "^1.8.22" + "vue-tsc": "^1.8.26" }, "repository": "https://gitee.com/youlaiorg/vue3-element-admin.git", "author": "有来开源组织", diff --git a/src/settings.ts b/src/settings.ts index 23e2de92..930ffe34 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -1,6 +1,6 @@ const defaultSettings: AppSettings = { title: "vue3-element-admin", - version: "v2.7.1", + version: "v2.7.2", showSettings: true, tagsView: true, fixedHeader: false, -- Gitee From c82b055fe89e0c42915f5588eb33923233cf6af7 Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Wed, 27 Dec 2023 23:03:45 +0800 Subject: [PATCH 006/258] =?UTF-8?q?build:=20:package:=20=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=20Vite=205=20=EF=BC=8C=E8=A6=81=E6=B1=82=20node=20=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E2=89=A5=2018?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++---- package.json | 16 ++++++++-------- src/settings.ts | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 1ce80183..084ce7a7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

- - - + + + @@ -55,7 +55,7 @@ | 环境 | 名称版本 | 备注 | | -------------------- | :----------------------------------------------------------- | ------------------------------------------------------------ | | **开发工具** | VSCode | [下载地址](https://code.visualstudio.com/Download) | -| **运行环境** | Node 16+ | [下载地址](http://nodejs.cn/download) | +| **运行环境** | Node 18+ | [下载地址](http://nodejs.cn/download) | | **VSCode插件(必装)** | 1. `Vue Language Features (Volar) `
2. `TypeScript Vue Plugin (Volar) `
3. 禁用 Vetur | ![vscode-plugin](https://foruda.gitee.com/images/1687755823108948048/d0198b2d_716974.png) | diff --git a/package.json b/package.json index 8573c7a6..d19090c0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue3-element-admin", - "version": "2.7.2", + "version": "2.8.0", "private": true, "scripts": { "preinstall": "npx only-allow pnpm", @@ -41,11 +41,11 @@ }, "dependencies": { "@element-plus/icons-vue": "^2.3.1", - "@vitejs/plugin-vue": "^4.5.2", - "@vueuse/core": "^10.7.0", + "@vitejs/plugin-vue": "^4.6.0", + "@vueuse/core": "^10.7.1", "@wangeditor/editor": "^5.1.23", "@wangeditor/editor-for-vue": "5.1.10", - "axios": "^1.6.2", + "axios": "^1.6.3", "echarts": "^5.4.3", "element-plus": "^2.4.4", "lodash-es": "^4.17.21", @@ -102,19 +102,19 @@ "stylelint-config-standard": "^34.0.0", "stylelint-config-standard-scss": "^11.1.0", "typescript": "^5.3.3", - "unocss": "^0.51.13", + "unocss": "^0.58.1", "unplugin-auto-import": "^0.15.3", "unplugin-icons": "^0.16.6", "unplugin-vue-components": "^0.24.1", - "vite": "^4.5.1", + "vite": "^5.0.10", "vite-plugin-mock": "^3.0.0", "vite-plugin-svg-icons": "^2.0.1", - "vue-tsc": "^1.8.26" + "vue-tsc": "^1.8.27" }, "repository": "https://gitee.com/youlaiorg/vue3-element-admin.git", "author": "有来开源组织", "license": "MIT", "engines": { - "node": ">=16.0.0" + "node": ">=18.0.0" } } diff --git a/src/settings.ts b/src/settings.ts index 930ffe34..736ef222 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -1,6 +1,6 @@ const defaultSettings: AppSettings = { title: "vue3-element-admin", - version: "v2.7.2", + version: "v2.8.0", showSettings: true, tagsView: true, fixedHeader: false, -- Gitee From 5f51268918684d368189eb1aff7724183f33d43a Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Mon, 8 Jan 2024 23:49:50 +0800 Subject: [PATCH 007/258] =?UTF-8?q?fix:=20:bug:=20=E7=A7=BB=E9=99=A4=20`Th?= =?UTF-8?q?e=20CJS=20build=20of=20Vite=E2=80=98s=20Node=20API=20is=20depre?= =?UTF-8?q?cated`=20=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index d19090c0..b3612a06 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "vue3-element-admin", "version": "2.8.0", "private": true, + "type": "module", "scripts": { "preinstall": "npx only-allow pnpm", "dev": "vite serve --mode development", -- Gitee From 38f598668d5bc1f709cb2ea4e7f25bca9f1e57c7 Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Tue, 9 Jan 2024 23:49:38 +0800 Subject: [PATCH 008/258] =?UTF-8?q?refactor:=20:recycle:=20=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=20mock=20=E6=96=B9=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mock/user.mock.ts | 21 ++++++ mock/user.ts | 182 ---------------------------------------------- 2 files changed, 21 insertions(+), 182 deletions(-) create mode 100644 mock/user.mock.ts delete mode 100644 mock/user.ts diff --git a/mock/user.mock.ts b/mock/user.mock.ts new file mode 100644 index 00000000..fc86f793 --- /dev/null +++ b/mock/user.mock.ts @@ -0,0 +1,21 @@ +import { defineMock } from "vite-plugin-mock-dev-server"; + +export default defineMock([ + { + url: "/api/hello_world", + method: ["GET"], + }, + { + url: "/api/v1/auth/captcha", + method: ["GET"], + body: { + code: "00000", + data: { + captchaKey: "534b8ef2b0a24121bec76391ddd159f9", + captchaBase64: + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAkCAIAAADNSmkJAAAFKUlEQVR4Xu2ZXUwcVRiGV70wMWo08V5NvPXCrDbFaGpMaZW2hqQxaoiJTRsaMBCNSYtpa2JTKiFSelFa+Q/QZcMWqEhBlh+htbEpZhMrBQrlJ0hBywLLyrJ0WZbje3bqOvPNLHPWrDvdOE9ONmfe78zkzMs335wzWJhJQrBQweS/wTQ6QWgYHdoIOcecOe05O+t2WkutO+p2ZF3Ksg/YV9ZW6FATYajR3nveg60H9327r3O8c35lHgp+r05dPdJzBL73TPSQ8SaCKIxGLsPlop+K0JHrEkPuoT31e5qGmmjARACF0agYyGVNlyVm/pzZXrN9fHGcBkz0UBid+31u93i3XFFT80vN8cvHqWqih8Lo1NpUqS5vwh3vnd223VQ10UNh9NbyrcFQUK6oCawHUipSqGqiB83oBf+CXFGDMp1mS6OqiR4Ko7FexkpOrqhpHGw82nOUqiZ6KIzGrkRuorW0dJMmOy+hOCfYGzb2RBFv6HRO0gEJw/U7y+pgL1bwmTxexN6sZ31TdEwEhdG+gA+7EqyXpUO1uZH20cWL8hMTRt1N9tBXzCJrOIRoCPJpSO2RAp4HmtCdIfZ+2JWgEBN9LbR28seTGU0Zue1tMLp+YIAMSADzfvbkKX4/eb28j4YODiGin3heqmIlLja5hAUCu+nmGY3JWKvpMAlqNGgebsauBOvlqSX+JEx7p7EbTLen53XlzfmWUioqXikrc68Y8N2juJ/fyVsNChGHEE//rBANYWaZz+TRQqpLaBgNsPfDrgSpbS21YtV87IdjrlkX9JZbt5DOma2t9ITo5F+5glN22WwL/n+yDv00mw06orKxOqQ5+J04hhViwzAXETIcJDVm8uxZqktoGx2Nj9t43Wgaul/ERQiGQvtbWnDWgZYW9CXlQFjZ/7ciyHNn+Z2MexTimIeLz59TiIln0M1e+IbPpOAaDUnEYPTi6iqKxpbycs/qKo1tCslfKcffPn9enuMiPPY1vxO/ckeFQ4h46cdGqUWoidE/y54q5tPY5WDrGzQqIXot4BgchEE57e00IMCw2/1qZSVO/7SjA78o9INzcxsbrL+fnTnDDh9mmZn8F30oG1Hm+nABv5mQMopDS/h1HxtqTzWbABMe9sxpPoe9zezeOo1GELqWhPS8t46M0IAYHbdvR1aHbaOjbjfLz2eFhez6dba4yAfgF30o0BFVE8+Mjh/wFxPI+I5mAEHU6Ls+38vhTFwOBGhMDF8gkFpbC5ffsdv/uBs6dIj19dExEtARVXv9YNbop8NFY3aZ6gRRo+tu3IBHnzmdNCBMXldXJKPfL74WzWUJRE+coDUknqsOdZXQbAJYwluVTbOZI3Qt8GFzMwxyjo3RgBiN4fr+elXVpZGRLWXl6PdOTtJBSlBDUK/lnIrjOlrtqWYTQDJaF6FrTXu9sOa1ysrVoM5HVE1GFxZQcyJ/p+xzv6K/rbr6N6+XDpUBl0tKFIrbz78qWB6YnWFMCBld4XLBms+7df75ook/GNzb0GCV7U1Qfz9p64TyQWNjYD3qe9rj4SMJtQP3MyjSDPzWIRHPjH7X4YAvfXoPuyZf9Pbi3PcuXIh4mp3NllYC6XY79C+jl2o8PBipxjnBttn4MgMNnWgfcRJGPI2OL8hTj3LloIlmRicvBhiNykvecpqoa3RSY4DRcLAwyicuOepVR1JjgNFYHWONHL04czTX0UmNAUYD7Pr+xc4wqTHGaBb2OtZvHUmNYUazcA2J6etdUmOk0f8rTKMTxF91RG0D1SwYGwAAAABJRU5ErkJggg==", + }, + msg: "一切ok", + }, + }, +]); diff --git a/mock/user.ts b/mock/user.ts deleted file mode 100644 index 690f8ea7..00000000 --- a/mock/user.ts +++ /dev/null @@ -1,182 +0,0 @@ -import { MockMethod } from "vite-plugin-mock"; - -export default [ - { - url: "/api/hello_world", - method: "get", - response: (request) => { - return { - msg: "hello world", - headers: request.headers, - }; - }, - }, - { - url: "/api/v1/auth/captcha", - method: "get", - response: () => { - return { - code: "00000", - data: { - captchaKey: "534b8ef2b0a24121bec76391ddd159f9", - captchaBase64: - "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAkCAIAAADNSmkJAAAFKUlEQVR4Xu2ZXUwcVRiGV70wMWo08V5NvPXCrDbFaGpMaZW2hqQxaoiJTRsaMBCNSYtpa2JTKiFSelFa+Q/QZcMWqEhBlh+htbEpZhMrBQrlJ0hBywLLyrJ0WZbje3bqOvPNLHPWrDvdOE9ONmfe78zkzMs335wzWJhJQrBQweS/wTQ6QWgYHdoIOcecOe05O+t2WkutO+p2ZF3Ksg/YV9ZW6FATYajR3nveg60H9327r3O8c35lHgp+r05dPdJzBL73TPSQ8SaCKIxGLsPlop+K0JHrEkPuoT31e5qGmmjARACF0agYyGVNlyVm/pzZXrN9fHGcBkz0UBid+31u93i3XFFT80vN8cvHqWqih8Lo1NpUqS5vwh3vnd223VQ10UNh9NbyrcFQUK6oCawHUipSqGqiB83oBf+CXFGDMp1mS6OqiR4Ko7FexkpOrqhpHGw82nOUqiZ6KIzGrkRuorW0dJMmOy+hOCfYGzb2RBFv6HRO0gEJw/U7y+pgL1bwmTxexN6sZ31TdEwEhdG+gA+7EqyXpUO1uZH20cWL8hMTRt1N9tBXzCJrOIRoCPJpSO2RAp4HmtCdIfZ+2JWgEBN9LbR28seTGU0Zue1tMLp+YIAMSADzfvbkKX4/eb28j4YODiGin3heqmIlLja5hAUCu+nmGY3JWKvpMAlqNGgebsauBOvlqSX+JEx7p7EbTLen53XlzfmWUioqXikrc68Y8N2juJ/fyVsNChGHEE//rBANYWaZz+TRQqpLaBgNsPfDrgSpbS21YtV87IdjrlkX9JZbt5DOma2t9ITo5F+5glN22WwL/n+yDv00mw06orKxOqQ5+J04hhViwzAXETIcJDVm8uxZqktoGx2Nj9t43Wgaul/ERQiGQvtbWnDWgZYW9CXlQFjZ/7ciyHNn+Z2MexTimIeLz59TiIln0M1e+IbPpOAaDUnEYPTi6iqKxpbycs/qKo1tCslfKcffPn9enuMiPPY1vxO/ckeFQ4h46cdGqUWoidE/y54q5tPY5WDrGzQqIXot4BgchEE57e00IMCw2/1qZSVO/7SjA78o9INzcxsbrL+fnTnDDh9mmZn8F30oG1Hm+nABv5mQMopDS/h1HxtqTzWbABMe9sxpPoe9zezeOo1GELqWhPS8t46M0IAYHbdvR1aHbaOjbjfLz2eFhez6dba4yAfgF30o0BFVE8+Mjh/wFxPI+I5mAEHU6Ls+38vhTFwOBGhMDF8gkFpbC5ffsdv/uBs6dIj19dExEtARVXv9YNbop8NFY3aZ6gRRo+tu3IBHnzmdNCBMXldXJKPfL74WzWUJRE+coDUknqsOdZXQbAJYwluVTbOZI3Qt8GFzMwxyjo3RgBiN4fr+elXVpZGRLWXl6PdOTtJBSlBDUK/lnIrjOlrtqWYTQDJaF6FrTXu9sOa1ysrVoM5HVE1GFxZQcyJ/p+xzv6K/rbr6N6+XDpUBl0tKFIrbz78qWB6YnWFMCBld4XLBms+7df75ook/GNzb0GCV7U1Qfz9p64TyQWNjYD3qe9rj4SMJtQP3MyjSDPzWIRHPjH7X4YAvfXoPuyZf9Pbi3PcuXIh4mp3NllYC6XY79C+jl2o8PBipxjnBttn4MgMNnWgfcRJGPI2OL8hTj3LloIlmRicvBhiNykvecpqoa3RSY4DRcLAwyicuOepVR1JjgNFYHWONHL04czTX0UmNAUYD7Pr+xc4wqTHGaBb2OtZvHUmNYUazcA2J6etdUmOk0f8rTKMTxF91RG0D1SwYGwAAAABJRU5ErkJggg==", - }, - msg: "一切ok", - }; - }, - }, - { - url: "/api/v1/auth/login", - method: "post", - response: () => { - return { - code: "00000", - data: { - accessToken: - "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImp0aSI6IjE2YWJkNTlkOTAxNzQwZDliYmI3ZjczODBhZDkyNzNhIiwidXNlcklkIjoyLCJ1c2VybmFtZSI6ImFkbWluIiwiZGVwdElkIjoxLCJkYXRhU2NvcGUiOjEsImF1dGhvcml0aWVzIjpbIlJPTEVfQURNSU4iXSwiZXhwIjoxNjkxMTAzMzgyfQ.P4cuIfmPepl3HuguhMS7NXn5a7IUPpsLbmtA_rHOhHk", - tokenType: "Bearer", - refreshToken: null, - expires: null, - }, - msg: "一切ok", - }; - }, - }, - { - url: "/api/v1/users/me", - method: "get", - response: () => { - return { - code: "00000", - data: { - userId: 2, - nickname: "系统管理员", - avatar: - "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif", - roles: ["ADMIN"], - perms: [ - "sys:menu:delete", - "sys:dept:edit", - "sys:dict_type:add", - "sys:dict:edit", - "sys:dict:delete", - "sys:dict_type:edit", - "sys:menu:add", - "sys:user:add", - "sys:role:edit", - "sys:dept:delete", - "sys:user:edit", - "sys:user:delete", - "sys:user:reset_pwd", - "sys:dept:add", - "sys:role:delete", - "sys:dict_type:delete", - "sys:menu:edit", - "sys:dict:add", - "sys:role:add", - ], - }, - msg: "一切ok", - }; - }, - }, - { - url: "/api/v1/auth/logout", - method: "delete", - response: () => { - return { - code: "00000", - data: {}, - msg: "string", - }; - }, - }, - { - url: "/api/v1/users/page", - method: "get", - response: () => { - return { - code: "00000", - data: { - list: [ - { - id: 2, - username: "admin", - nickname: "系统管理员", - mobile: "17621210366", - genderLabel: "男", - avatar: - "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif", - email: null, - status: 1, - deptName: "有来技术", - roleNames: "系统管理员", - createTime: "2019-10-10", - }, - { - id: 3, - username: "test", - nickname: "测试小用户", - mobile: "17621210366", - genderLabel: "男", - avatar: - "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif", - email: null, - status: 1, - deptName: "测试部门", - roleNames: "访问游客", - createTime: "2021-06-04", - }, - ], - total: 2, - }, - msg: "一切ok", - }; - }, - }, - - { - url: "/api/v1/users/:id/form", - method: "get", - response: ({ url }) => { - const id = url.match(/\/api\/v1\/users\/(\d+)\/form/)[1]; - let formData = null; - if (id == 2) { - formData = { - id: 2, - username: "admin", - nickname: "系统管理员", - mobile: "17621210366", - gender: 1, - avatar: - "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif", - email: "", - status: 1, - deptId: 1, - roleIds: [2], - }; - } else if (id == 3) { - formData = { - id: 3, - username: "test", - nickname: "测试小用户", - mobile: "17621210366", - gender: 1, - avatar: - "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif", - email: "youlaitech@163.com", - status: 1, - deptId: 3, - roleIds: [3], - }; - } - - return { - code: "00000", - data: formData, - msg: "一切ok", - }; - }, - }, -] as MockMethod[]; -- Gitee From 5d168689e55b1ba6d333e89e94f39cb8e2c007cd 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, 10 Jan 2024 23:03:25 +0800 Subject: [PATCH 009/258] =?UTF-8?q?refactor:=20:recycle:=20mock=20?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=96=B9=E6=A1=88=E6=96=B9=E6=A1=88=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E4=B8=BA=20`vite-plugin-mock-dev-server`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 10 +- .env.production | 7 +- mock/article.ts | 168 ------- mock/auth.mock.ts | 48 ++ mock/dept.mock.ts | 33 ++ mock/dept.ts | 30 -- mock/{dict.ts => dict.mock.ts} | 17 +- mock/menu.mock.ts | 412 ++++++++++++++++++ mock/role.mock.ts | 63 +++ mock/role.ts | 165 ------- mock/router.ts | 412 ------------------ mock/user.mock.ts | 131 ++++++ mock/user.ts | 182 -------- package.json | 4 +- .../permission/components/SwitchRoles.vue | 27 -- src/views/demo/permission/page.vue | 21 - src/views/demo/table/Export2Excel.js | 257 ----------- src/views/demo/table/drag-table.vue | 175 -------- .../dynamic-table/components/FixedThead.vue | 55 --- .../dynamic-table/components/UnfixedThead.vue | 45 -- src/views/demo/table/dynamic-table/index.vue | 24 - vite.config.ts | 18 +- 22 files changed, 711 insertions(+), 1593 deletions(-) delete mode 100644 mock/article.ts create mode 100644 mock/auth.mock.ts create mode 100644 mock/dept.mock.ts delete mode 100644 mock/dept.ts rename mock/{dict.ts => dict.mock.ts} (56%) create mode 100644 mock/menu.mock.ts create mode 100644 mock/role.mock.ts delete mode 100644 mock/role.ts delete mode 100644 mock/router.ts create mode 100644 mock/user.mock.ts delete mode 100644 mock/user.ts delete mode 100644 src/views/demo/permission/components/SwitchRoles.vue delete mode 100644 src/views/demo/permission/page.vue delete mode 100644 src/views/demo/table/Export2Excel.js delete mode 100644 src/views/demo/table/drag-table.vue delete mode 100644 src/views/demo/table/dynamic-table/components/FixedThead.vue delete mode 100644 src/views/demo/table/dynamic-table/components/UnfixedThead.vue delete mode 100644 src/views/demo/table/dynamic-table/index.vue diff --git a/.env.development b/.env.development index daa0fc6d..9544eb57 100644 --- a/.env.development +++ b/.env.development @@ -1,14 +1,8 @@ ## 开发环境 - -# 变量必须以 VITE_ 为前缀才能暴露给外部读取 NODE_ENV='development' +# 应用端口 VITE_APP_PORT = 3000 -# API请求前缀 +# 代理前缀 VITE_APP_BASE_API = '/dev-api' - -# proxy代理配置 -VITE_APP_API_URL = 'http://vapi.youlai.tech' # 线上接口 -# VITE_APP_API_URL = 'http://localhost:8989' # 本地接口,本地启动后端:https://gitee.com/youlaiorg/youlai-boot -# VITE_APP_API_URL = 'http://localhost:3000' # 本地Mock diff --git a/.env.production b/.env.production index c8c69313..a2d828cb 100644 --- a/.env.production +++ b/.env.production @@ -1,9 +1,6 @@ ## 生产环境 +NODE_ENV='production' -VITE_APP_PORT = 3000 - -# API请求前缀 +# 代理前缀 VITE_APP_BASE_API = '/prod-api' -# proxy代理配置 -VITE_APP_API_URL = "http://vapi.youlai.tech" diff --git a/mock/article.ts b/mock/article.ts deleted file mode 100644 index 8563e6ed..00000000 --- a/mock/article.ts +++ /dev/null @@ -1,168 +0,0 @@ -import { MockMethod } from "vite-plugin-mock"; - -const article_list: any = []; -const count = 100; - -for (let i = 0; i < count; i++) { - article_list.push({ - id: i, - timestamp: new Date().getTime(), - author: `Author ${i}`, - reviewer: `reviewer ${i}`, - title: `Title ${i}`, - importance: Math.floor(Math.random() * 3) + 1, - type: ["CN", "US", "JP", "EU"][Math.floor(Math.random() * 4)], - status: ["published", "draft"][Math.floor(Math.random() * 2)], - display_time: new Date().toISOString(), - pageviews: Math.floor(Math.random() * (5000 - 300)) + 300, - remark: `remark ${i}`, - }); -} - -export default [ - { - url: "/api/v1/article/list", - timeout: 200, - method: "get", - response: ({ query }) => { - const { importance, type, title, page = 1, limit = 10, sort } = query; - let mock_list = article_list.filter((item: any) => { - if (importance && item.importance !== +importance) return false; - if (type && item.type !== type) return false; - if (title && item.title.indexOf(title) < 0) return false; - if (item.status === "deleted") return false; - return true; - }); - if (sort === "-id") { - mock_list = mock_list.reverse(); - } - const page_list = mock_list.filter( - (item: any, index: number) => - index < limit * page && index >= limit * (page - 1) - ); - - return { - code: "00000", - data: { total: mock_list.length, page: page, items: page_list }, - msg: "一切ok", - }; - }, - }, - { - url: "/api/v1/article/detail", - timeout: 200, - method: "get", - response: ({ query }) => { - const { id } = query; - for (const article of article_list) { - if (article.id === +id) { - return { - code: "00000", - data: article, - msg: "一切ok", - }; - } - } - }, - }, - { - url: "/api/v1/article/pv", - timeout: 200, - method: "get", - response: ({ query }) => { - const { id } = query; - for (const article of article_list) { - if (article.id === +id) { - return { - code: "00000", - data: { - pv: article.pageviews, - pvData: [ - { key: "PC", pv: 1024 }, - { key: "mobile", pv: 1024 }, - { key: "ios", pv: 1024 }, - { key: "android", pv: 1024 }, - ], - }, - msg: "一切ok", - }; - } - } - }, - }, - { - url: "/api/v1/article/update", - timeout: 200, - method: "post", - response: ({ body }) => { - const { id, ...updatedFields } = body; - // 查找要更新的文章 - const articleToUpdate = article_list.find( - (article: any) => article.id === id - ); - - // 如果找到了要更新的文章 - if (articleToUpdate) { - // 使用 Object.assign 方法更新文章 - Object.assign(articleToUpdate, updatedFields); - return { - code: "00000", - data: { - article: articleToUpdate, - }, - msg: "一切ok", - }; - } else { - console.error(`Article with id ${id} not found.`); - } - }, - }, - { - url: "/api/v1/article/create", - timeout: 200, - method: "post", - response: ({ body }) => { - const { title, author, importance, type, status, remark, timestamp } = - body; - // article_list最大的id值; - const maxId = article_list.reduce((maxId: number, article: any) => { - return Math.max(maxId, article.id); - }, -1); - const article = { - id: maxId + 1, - timestamp, - author, - reviewer: `reviewer ${maxId + 1}`, - title, - importance, - type, - status, - display_time: new Date(timestamp).toISOString(), - pageviews: Math.floor(Math.random() * (5000 - 300)) + 300, - remark, - }; - article_list.push(article); - return { - code: "00000", - data: { - article, - }, - msg: "一切ok", - }; - }, - }, - { - url: "/api/v1/article/delete", - timeout: 200, - method: "post", - response: ({ body }) => { - const { id } = body; - const index = article_list.findIndex((article: any) => article.id === id); - article_list.splice(index, 1); - return { - code: "00000", - msg: "一切ok", - }; - }, - }, -] as MockMethod[]; diff --git a/mock/auth.mock.ts b/mock/auth.mock.ts new file mode 100644 index 00000000..73a7359d --- /dev/null +++ b/mock/auth.mock.ts @@ -0,0 +1,48 @@ +import path from "path"; +import { createDefineMock } from "vite-plugin-mock-dev-server"; + +const defineMock = createDefineMock((mock) => { + mock.url = path.join(import.meta.env.VITE_APP_BASE_API, mock.url); // 路径会拼接为: /dev-api + url +}); + +export default defineMock([ + { + url: "/api/v1/auth/captcha", + method: ["GET"], + body: { + code: "00000", + data: { + captchaKey: "534b8ef2b0a24121bec76391ddd159f9", + captchaBase64: + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAkCAIAAADNSmkJAAAFKUlEQVR4Xu2ZXUwcVRiGV70wMWo08V5NvPXCrDbFaGpMaZW2hqQxaoiJTRsaMBCNSYtpa2JTKiFSelFa+Q/QZcMWqEhBlh+htbEpZhMrBQrlJ0hBywLLyrJ0WZbje3bqOvPNLHPWrDvdOE9ONmfe78zkzMs335wzWJhJQrBQweS/wTQ6QWgYHdoIOcecOe05O+t2WkutO+p2ZF3Ksg/YV9ZW6FATYajR3nveg60H9327r3O8c35lHgp+r05dPdJzBL73TPSQ8SaCKIxGLsPlop+K0JHrEkPuoT31e5qGmmjARACF0agYyGVNlyVm/pzZXrN9fHGcBkz0UBid+31u93i3XFFT80vN8cvHqWqih8Lo1NpUqS5vwh3vnd223VQ10UNh9NbyrcFQUK6oCawHUipSqGqiB83oBf+CXFGDMp1mS6OqiR4Ko7FexkpOrqhpHGw82nOUqiZ6KIzGrkRuorW0dJMmOy+hOCfYGzb2RBFv6HRO0gEJw/U7y+pgL1bwmTxexN6sZ31TdEwEhdG+gA+7EqyXpUO1uZH20cWL8hMTRt1N9tBXzCJrOIRoCPJpSO2RAp4HmtCdIfZ+2JWgEBN9LbR28seTGU0Zue1tMLp+YIAMSADzfvbkKX4/eb28j4YODiGin3heqmIlLja5hAUCu+nmGY3JWKvpMAlqNGgebsauBOvlqSX+JEx7p7EbTLen53XlzfmWUioqXikrc68Y8N2juJ/fyVsNChGHEE//rBANYWaZz+TRQqpLaBgNsPfDrgSpbS21YtV87IdjrlkX9JZbt5DOma2t9ITo5F+5glN22WwL/n+yDv00mw06orKxOqQ5+J04hhViwzAXETIcJDVm8uxZqktoGx2Nj9t43Wgaul/ERQiGQvtbWnDWgZYW9CXlQFjZ/7ciyHNn+Z2MexTimIeLz59TiIln0M1e+IbPpOAaDUnEYPTi6iqKxpbycs/qKo1tCslfKcffPn9enuMiPPY1vxO/ckeFQ4h46cdGqUWoidE/y54q5tPY5WDrGzQqIXot4BgchEE57e00IMCw2/1qZSVO/7SjA78o9INzcxsbrL+fnTnDDh9mmZn8F30oG1Hm+nABv5mQMopDS/h1HxtqTzWbABMe9sxpPoe9zezeOo1GELqWhPS8t46M0IAYHbdvR1aHbaOjbjfLz2eFhez6dba4yAfgF30o0BFVE8+Mjh/wFxPI+I5mAEHU6Ls+38vhTFwOBGhMDF8gkFpbC5ffsdv/uBs6dIj19dExEtARVXv9YNbop8NFY3aZ6gRRo+tu3IBHnzmdNCBMXldXJKPfL74WzWUJRE+coDUknqsOdZXQbAJYwluVTbOZI3Qt8GFzMwxyjo3RgBiN4fr+elXVpZGRLWXl6PdOTtJBSlBDUK/lnIrjOlrtqWYTQDJaF6FrTXu9sOa1ysrVoM5HVE1GFxZQcyJ/p+xzv6K/rbr6N6+XDpUBl0tKFIrbz78qWB6YnWFMCBld4XLBms+7df75ook/GNzb0GCV7U1Qfz9p64TyQWNjYD3qe9rj4SMJtQP3MyjSDPzWIRHPjH7X4YAvfXoPuyZf9Pbi3PcuXIh4mp3NllYC6XY79C+jl2o8PBipxjnBttn4MgMNnWgfcRJGPI2OL8hTj3LloIlmRicvBhiNykvecpqoa3RSY4DRcLAwyicuOepVR1JjgNFYHWONHL04czTX0UmNAUYD7Pr+xc4wqTHGaBb2OtZvHUmNYUazcA2J6etdUmOk0f8rTKMTxF91RG0D1SwYGwAAAABJRU5ErkJggg==", + }, + msg: "一切ok", + }, + }, + + { + url: "/api/v1/auth/login", + method: ["POST"], + body: { + code: "00000", + data: { + accessToken: + "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImp0aSI6IjE2YWJkNTlkOTAxNzQwZDliYmI3ZjczODBhZDkyNzNhIiwidXNlcklkIjoyLCJ1c2VybmFtZSI6ImFkbWluIiwiZGVwdElkIjoxLCJkYXRhU2NvcGUiOjEsImF1dGhvcml0aWVzIjpbIlJPTEVfQURNSU4iXSwiZXhwIjoxNjkxMTAzMzgyfQ.P4cuIfmPepl3HuguhMS7NXn5a7IUPpsLbmtA_rHOhHk", + tokenType: "Bearer", + refreshToken: null, + expires: null, + }, + msg: "一切ok", + }, + }, + + { + url: "/api/v1/auth/logout", + method: ["DELETE"], + body: { + code: "00000", + data: {}, + msg: "string", + }, + }, +]); diff --git a/mock/dept.mock.ts b/mock/dept.mock.ts new file mode 100644 index 00000000..47dd2bc2 --- /dev/null +++ b/mock/dept.mock.ts @@ -0,0 +1,33 @@ +import path from "path"; +import { createDefineMock } from "vite-plugin-mock-dev-server"; + +const defineMock = createDefineMock((mock) => { + mock.url = path.join(import.meta.env.VITE_APP_BASE_API, mock.url); // 路径会拼接为: /dev-api + url +}); + +export default defineMock([ + { + url: "/api/v1/dept/options", + method: ["GET"], + body: { + code: "00000", + data: [ + { + value: 1, + label: "有来技术", + children: [ + { + value: 2, + label: "研发部门", + }, + { + value: 3, + label: "测试部门", + }, + ], + }, + ], + msg: "一切ok", + }, + }, +]); diff --git a/mock/dept.ts b/mock/dept.ts deleted file mode 100644 index 91746f4f..00000000 --- a/mock/dept.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { MockMethod } from "vite-plugin-mock"; - -export default [ - { - url: "/api/v1/dept/options", - method: "get", - response: () => { - return { - code: "00000", - data: [ - { - value: 1, - label: "有来技术", - children: [ - { - value: 2, - label: "研发部门", - }, - { - value: 3, - label: "测试部门", - }, - ], - }, - ], - msg: "一切ok", - }; - }, - }, -] as MockMethod[]; diff --git a/mock/dict.ts b/mock/dict.mock.ts similarity index 56% rename from mock/dict.ts rename to mock/dict.mock.ts index 4ee38c38..8a6cfed1 100644 --- a/mock/dict.ts +++ b/mock/dict.mock.ts @@ -1,11 +1,16 @@ -import { MockMethod } from "vite-plugin-mock"; +import path from "path"; +import { createDefineMock } from "vite-plugin-mock-dev-server"; -export default [ +const defineMock = createDefineMock((mock) => { + mock.url = path.join(import.meta.env.VITE_APP_BASE_API, mock.url); // 路径会拼接为: /dev-api + url +}); + +export default defineMock([ { url: "/api/v1/dict/:code/options", - method: "get", - response: ({ url }) => { - const typeCode = url.match(/\/api\/v1\/dict\/(\w+)\/options/)[1]; + method: ["GET"], + body: ({ params }) => { + const typeCode = params.code; let list = null; @@ -33,4 +38,4 @@ export default [ }; }, }, -] as MockMethod[]; +]); diff --git a/mock/menu.mock.ts b/mock/menu.mock.ts new file mode 100644 index 00000000..215c9b15 --- /dev/null +++ b/mock/menu.mock.ts @@ -0,0 +1,412 @@ +import path from "path"; +import { createDefineMock } from "vite-plugin-mock-dev-server"; + +const defineMock = createDefineMock((mock) => { + mock.url = path.join(import.meta.env.VITE_APP_BASE_API, mock.url); // 路径会拼接为: /dev-api + url +}); + +export default defineMock([ + { + url: "/api/v1/menus/routes", // 路径会拼接为: /dev-api/api/v1/menus/routes + method: ["GET"], + body: { + code: "00000", + data: [ + { + path: "/system", + component: "Layout", + redirect: "/system/user", + meta: { + title: "系统管理", + icon: "system", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + children: [ + { + path: "user", + component: "system/user/index", + name: "User", + meta: { + title: "用户管理", + icon: "user", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + { + path: "role", + component: "system/role/index", + name: "Role", + meta: { + title: "角色管理", + icon: "role", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + { + path: "menu", + component: "system/menu/index", + name: "Menu", + meta: { + title: "菜单管理", + icon: "menu", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + { + path: "dept", + component: "system/dept/index", + name: "Dept", + meta: { + title: "部门管理", + icon: "tree", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + { + path: "dict", + component: "system/dict/index", + name: "DictType", + meta: { + title: "字典管理", + icon: "dict", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + ], + }, + + { + path: "/api", + component: "Layout", + meta: { + title: "接口", + icon: "api", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + children: [ + { + path: "apidoc", + component: "demo/api-doc", + name: "Apidoc", + meta: { + title: "接口文档", + icon: "api", + hidden: false, + roles: ["ADMIN"], + keepAlive: false, + }, + }, + ], + }, + { + path: "/external-link", + component: "Layout", + redirect: "noredirect", + meta: { + title: "外部链接", + icon: "link", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + children: [ + { + path: "https://juejin.cn/post/7228990409909108793", + meta: { + title: "document", + icon: "document", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + ], + }, + { + path: "/multi-level", + component: "Layout", + redirect: "/multi-level/multi-level1", + meta: { + title: "多级菜单", + icon: "multi_level", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + children: [ + { + path: "multi-level1", + component: "demo/multi-level/level1", + redirect: "/multi-level/multi-level2", + meta: { + title: "菜单一级", + icon: "", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + children: [ + { + path: "multi-level2", + component: "demo/multi-level/children/level2", + redirect: "/multi-level/multi-level2/multi-level3-1", + meta: { + title: "菜单二级", + icon: "", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + children: [ + { + path: "multi-level3-1", + component: "demo/multi-level/children/children/level3-1", + name: "MultiLevel31", + meta: { + title: "菜单三级-1", + icon: "", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + { + path: "multi-level3-2", + component: "demo/multi-level/children/children/level3-2", + name: "MultiLevel32", + meta: { + title: "菜单三级-2", + icon: "", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + ], + }, + ], + }, + ], + }, + { + path: "/component", + component: "Layout", + meta: { + title: "组件封装", + icon: "menu", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + children: [ + { + path: "wang-editor", + component: "demo/wang-editor", + name: "wang-editor", + meta: { + title: "富文本编辑器", + icon: "", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + { + path: "upload", + component: "demo/upload", + name: "upload", + meta: { + title: "图片上传", + icon: "", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + { + path: "icon-selector", + component: "demo/icon-selector", + name: "icon-selector", + meta: { + title: "图标选择器", + icon: "", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + { + path: "dict-demo", + component: "demo/dict", + name: "DictDemo", + meta: { + title: "字典组件", + icon: "", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + { + path: "taginput", + component: "demo/taginput", + name: "taginput", + meta: { + title: "标签输入框", + icon: "", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + { + path: "signature", + component: "demo/signature", + name: "signature", + meta: { + title: "签名", + icon: "", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + { + path: "table", + component: "demo/table", + name: "Table", + meta: { + title: "表格", + icon: "", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + ], + }, + { + path: "/table", + component: "Layout", + meta: { + title: "Table", + icon: "table", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + children: [ + { + path: "dynamic-table", + component: "demo/table/dynamic-table/index", + name: "DynamicTable", + meta: { + title: "动态Table", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + { + path: "drag-table", + component: "demo/table/drag-table", + name: "DragTable", + meta: { + title: "拖拽Table", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + { + path: "complex-table", + component: "demo/table/complex-table", + name: "ComplexTable", + meta: { + title: "综合Table", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + ], + }, + { + path: "/function", + component: "Layout", + meta: { + title: "功能演示", + icon: "menu", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + children: [ + { + path: "permission", + component: "demo/permission/page", + name: "Permission", + meta: { + title: "Permission", + icon: "", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + { + path: "icon-demo", + component: "demo/icons", + name: "Icons", + meta: { + title: "图标", + icon: "", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + { + path: "websocket", + component: "demo/websocket", + name: "Websocket", + meta: { + title: "Websocket", + icon: "", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + { + path: "other", + component: "demo/other", + meta: { + title: "敬请期待...", + icon: "", + hidden: false, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + ], + }, + ], + msg: "一切ok", + }, + }, +]); diff --git a/mock/role.mock.ts b/mock/role.mock.ts new file mode 100644 index 00000000..060f914e --- /dev/null +++ b/mock/role.mock.ts @@ -0,0 +1,63 @@ +import path from "path"; +import { createDefineMock } from "vite-plugin-mock-dev-server"; + +const defineMock = createDefineMock((mock) => { + mock.url = path.join(import.meta.env.VITE_APP_BASE_API, mock.url); // 路径会拼接为: /dev-api + url +}); + +export default defineMock([ + { + url: "/api/v1/roles/options", + method: ["GET"], + body: { + code: "00000", + data: [ + { + value: 2, + label: "系统管理员", + }, + { + value: 4, + label: "系统管理员1", + }, + { + value: 5, + label: "系统管理员2", + }, + { + value: 6, + label: "系统管理员3", + }, + { + value: 7, + label: "系统管理员4", + }, + { + value: 8, + label: "系统管理员5", + }, + { + value: 9, + label: "系统管理员6", + }, + { + value: 10, + label: "系统管理员7", + }, + { + value: 11, + label: "系统管理员8", + }, + { + value: 12, + label: "系统管理员9", + }, + { + value: 3, + label: "访问游客", + }, + ], + msg: "一切ok", + }, + }, +]); diff --git a/mock/role.ts b/mock/role.ts deleted file mode 100644 index 6c3419f6..00000000 --- a/mock/role.ts +++ /dev/null @@ -1,165 +0,0 @@ -import { MockMethod } from "vite-plugin-mock"; - -export default [ - { - url: "/api/v1/roles/options", - method: "get", - response: () => { - return { - code: "00000", - data: [ - { - value: 2, - label: "系统管理员", - }, - { - value: 4, - label: "系统管理员1", - }, - { - value: 5, - label: "系统管理员2", - }, - { - value: 6, - label: "系统管理员3", - }, - { - value: 7, - label: "系统管理员4", - }, - { - value: 8, - label: "系统管理员5", - }, - { - value: 9, - label: "系统管理员6", - }, - { - value: 10, - label: "系统管理员7", - }, - { - value: 11, - label: "系统管理员8", - }, - { - value: 12, - label: "系统管理员9", - }, - { - value: 3, - label: "访问游客", - }, - ], - msg: "一切ok", - }; - }, - }, - { - url: "/api/v1/roles/page", - method: "get", - response: () => { - return { - code: "00000", - data: { - list: [ - { - id: 2, - name: "系统管理员", - code: "ADMIN", - status: 1, - sort: 2, - createTime: "2021-03-25 12:39:54", - updateTime: null, - }, - { - id: 3, - name: "访问游客", - code: "GUEST", - status: 1, - sort: 3, - createTime: "2021-05-26 15:49:05", - updateTime: "2019-05-05 16:00:00", - }, - { - id: 4, - name: "系统管理员1", - code: "ADMIN1", - status: 1, - sort: 2, - createTime: "2021-03-25 12:39:54", - updateTime: null, - }, - { - id: 5, - name: "系统管理员2", - code: "ADMIN1", - status: 1, - sort: 2, - createTime: "2021-03-25 12:39:54", - updateTime: null, - }, - { - id: 6, - name: "系统管理员3", - code: "ADMIN1", - status: 1, - sort: 2, - createTime: "2021-03-25 12:39:54", - updateTime: null, - }, - { - id: 7, - name: "系统管理员4", - code: "ADMIN1", - status: 1, - sort: 2, - createTime: "2021-03-25 12:39:54", - updateTime: null, - }, - { - id: 8, - name: "系统管理员5", - code: "ADMIN1", - status: 1, - sort: 2, - createTime: "2021-03-25 12:39:54", - updateTime: null, - }, - { - id: 9, - name: "系统管理员6", - code: "ADMIN1", - status: 1, - sort: 2, - createTime: "2021-03-25 12:39:54", - updateTime: null, - }, - { - id: 10, - name: "系统管理员7", - code: "ADMIN1", - status: 1, - sort: 2, - createTime: "2021-03-25 12:39:54", - updateTime: null, - }, - { - id: 11, - name: "系统管理员8", - code: "ADMIN1", - status: 1, - sort: 2, - createTime: "2021-03-25 12:39:54", - updateTime: null, - }, - ], - total: 11, - }, - msg: "一切ok", - }; - }, - }, -] as MockMethod[]; diff --git a/mock/router.ts b/mock/router.ts deleted file mode 100644 index 60375071..00000000 --- a/mock/router.ts +++ /dev/null @@ -1,412 +0,0 @@ -import { MockMethod } from "vite-plugin-mock"; -const url = "/api/v1/menus/routes"; -const method = "get"; -const data = { - code: "00000", - data: [ - { - path: "/system", - component: "Layout", - redirect: "/system/user", - meta: { - title: "系统管理", - icon: "system", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - children: [ - { - path: "user", - component: "system/user/index", - name: "User", - meta: { - title: "用户管理", - icon: "user", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - { - path: "role", - component: "system/role/index", - name: "Role", - meta: { - title: "角色管理", - icon: "role", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - { - path: "menu", - component: "system/menu/index", - name: "Menu", - meta: { - title: "菜单管理", - icon: "menu", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - { - path: "dept", - component: "system/dept/index", - name: "Dept", - meta: { - title: "部门管理", - icon: "tree", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - { - path: "dict", - component: "system/dict/index", - name: "DictType", - meta: { - title: "字典管理", - icon: "dict", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - ], - }, - - { - path: "/api", - component: "Layout", - meta: { - title: "接口", - icon: "api", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - children: [ - { - path: "apidoc", - component: "demo/api-doc", - name: "Apidoc", - meta: { - title: "接口文档", - icon: "api", - hidden: false, - roles: ["ADMIN"], - keepAlive: false, - }, - }, - ], - }, - { - path: "/external-link", - component: "Layout", - redirect: "noredirect", - meta: { - title: "外部链接", - icon: "link", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - children: [ - { - path: "https://juejin.cn/post/7228990409909108793", - meta: { - title: "document", - icon: "document", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - ], - }, - { - path: "/multi-level", - component: "Layout", - redirect: "/multi-level/multi-level1", - meta: { - title: "多级菜单", - icon: "multi_level", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - children: [ - { - path: "multi-level1", - component: "demo/multi-level/level1", - redirect: "/multi-level/multi-level2", - meta: { - title: "菜单一级", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - children: [ - { - path: "multi-level2", - component: "demo/multi-level/children/level2", - redirect: "/multi-level/multi-level2/multi-level3-1", - meta: { - title: "菜单二级", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - children: [ - { - path: "multi-level3-1", - component: "demo/multi-level/children/children/level3-1", - name: "MultiLevel31", - meta: { - title: "菜单三级-1", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - { - path: "multi-level3-2", - component: "demo/multi-level/children/children/level3-2", - name: "MultiLevel32", - meta: { - title: "菜单三级-2", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - ], - }, - ], - }, - ], - }, - { - path: "/component", - component: "Layout", - meta: { - title: "组件封装", - icon: "menu", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - children: [ - { - path: "wang-editor", - component: "demo/wang-editor", - name: "wang-editor", - meta: { - title: "富文本编辑器", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - { - path: "upload", - component: "demo/upload", - name: "upload", - meta: { - title: "图片上传", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - { - path: "icon-selector", - component: "demo/icon-selector", - name: "icon-selector", - meta: { - title: "图标选择器", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - { - path: "dict-demo", - component: "demo/dict", - name: "DictDemo", - meta: { - title: "字典组件", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - { - path: "taginput", - component: "demo/taginput", - name: "taginput", - meta: { - title: "标签输入框", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - { - path: "signature", - component: "demo/signature", - name: "signature", - meta: { - title: "签名", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - { - path: "table", - component: "demo/table", - name: "Table", - meta: { - title: "表格", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - ], - }, - { - path: "/table", - component: "Layout", - meta: { - title: "Table", - icon: "table", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - children: [ - { - path: "dynamic-table", - component: "demo/table/dynamic-table/index", - name: "DynamicTable", - meta: { - title: "动态Table", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - { - path: "drag-table", - component: "demo/table/drag-table", - name: "DragTable", - meta: { - title: "拖拽Table", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - { - path: "complex-table", - component: "demo/table/complex-table", - name: "ComplexTable", - meta: { - title: "综合Table", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - ], - }, - { - path: "/function", - component: "Layout", - meta: { - title: "功能演示", - icon: "menu", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - children: [ - { - path: "permission", - component: "demo/permission/page", - name: "Permission", - meta: { - title: "Permission", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - { - path: "icon-demo", - component: "demo/icons", - name: "Icons", - meta: { - title: "图标", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - { - path: "websocket", - component: "demo/websocket", - name: "Websocket", - meta: { - title: "Websocket", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - { - path: "other", - component: "demo/other", - meta: { - title: "敬请期待...", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - ], - }, - ], - msg: "一切ok", -}; - -export default [ - { - url: url, - method: method, - response: () => { - return data; - }, - }, -] as MockMethod[]; diff --git a/mock/user.mock.ts b/mock/user.mock.ts new file mode 100644 index 00000000..bc30fb7a --- /dev/null +++ b/mock/user.mock.ts @@ -0,0 +1,131 @@ +import path from "path"; +import { createDefineMock } from "vite-plugin-mock-dev-server"; + +const defineMock = createDefineMock((mock) => { + mock.url = path.join(import.meta.env.VITE_APP_BASE_API, mock.url); // 路径会拼接为: /dev-api + url +}); + +export default defineMock([ + { + url: "/api/v1/users/me", + method: ["GET"], + body: { + code: "00000", + data: { + userId: 2, + nickname: "系统管理员", + avatar: + "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif", + roles: ["ADMIN"], + perms: [ + "sys:menu:delete", + "sys:dept:edit", + "sys:dict_type:add", + "sys:dict:edit", + "sys:dict:delete", + "sys:dict_type:edit", + "sys:menu:add", + "sys:user:add", + "sys:role:edit", + "sys:dept:delete", + "sys:user:edit", + "sys:user:delete", + "sys:user:reset_pwd", + "sys:dept:add", + "sys:role:delete", + "sys:dict_type:delete", + "sys:menu:edit", + "sys:dict:add", + "sys:role:add", + ], + }, + msg: "一切ok", + }, + }, + + { + url: "/api/v1/users/page", + method: ["GET"], + body: { + code: "00000", + data: { + list: [ + { + id: 2, + username: "admin", + nickname: "系统管理员", + mobile: "17621210366", + genderLabel: "男", + avatar: + "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif", + email: null, + status: 1, + deptName: "有来技术", + roleNames: "系统管理员", + createTime: "2019-10-10", + }, + { + id: 3, + username: "test", + nickname: "测试小用户", + mobile: "17621210366", + genderLabel: "男", + avatar: + "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif", + email: null, + status: 1, + deptName: "测试部门", + roleNames: "访问游客", + createTime: "2021-06-04", + }, + ], + total: 2, + }, + msg: "一切ok", + }, + }, + + { + url: "/api/v1/users/:userId/form", + method: ["GET"], + body: ({ params }) => { + const userId = params.userId; + let formData = null; + if (userId == 2) { + formData = { + id: 2, + username: "admin", + nickname: "系统管理员", + mobile: "17621210366", + gender: 1, + avatar: + "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif", + email: "", + status: 1, + deptId: 1, + roleIds: [2], + }; + } else if (userId == 3) { + formData = { + id: 3, + username: "test", + nickname: "测试小用户", + mobile: "17621210366", + gender: 1, + avatar: + "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif", + email: "youlaitech@163.com", + status: 1, + deptId: 3, + roleIds: [3], + }; + } + + return { + code: "00000", + data: formData, + msg: "一切ok", + }; + }, + }, +]); diff --git a/mock/user.ts b/mock/user.ts deleted file mode 100644 index 690f8ea7..00000000 --- a/mock/user.ts +++ /dev/null @@ -1,182 +0,0 @@ -import { MockMethod } from "vite-plugin-mock"; - -export default [ - { - url: "/api/hello_world", - method: "get", - response: (request) => { - return { - msg: "hello world", - headers: request.headers, - }; - }, - }, - { - url: "/api/v1/auth/captcha", - method: "get", - response: () => { - return { - code: "00000", - data: { - captchaKey: "534b8ef2b0a24121bec76391ddd159f9", - captchaBase64: - "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAkCAIAAADNSmkJAAAFKUlEQVR4Xu2ZXUwcVRiGV70wMWo08V5NvPXCrDbFaGpMaZW2hqQxaoiJTRsaMBCNSYtpa2JTKiFSelFa+Q/QZcMWqEhBlh+htbEpZhMrBQrlJ0hBywLLyrJ0WZbje3bqOvPNLHPWrDvdOE9ONmfe78zkzMs335wzWJhJQrBQweS/wTQ6QWgYHdoIOcecOe05O+t2WkutO+p2ZF3Ksg/YV9ZW6FATYajR3nveg60H9327r3O8c35lHgp+r05dPdJzBL73TPSQ8SaCKIxGLsPlop+K0JHrEkPuoT31e5qGmmjARACF0agYyGVNlyVm/pzZXrN9fHGcBkz0UBid+31u93i3XFFT80vN8cvHqWqih8Lo1NpUqS5vwh3vnd223VQ10UNh9NbyrcFQUK6oCawHUipSqGqiB83oBf+CXFGDMp1mS6OqiR4Ko7FexkpOrqhpHGw82nOUqiZ6KIzGrkRuorW0dJMmOy+hOCfYGzb2RBFv6HRO0gEJw/U7y+pgL1bwmTxexN6sZ31TdEwEhdG+gA+7EqyXpUO1uZH20cWL8hMTRt1N9tBXzCJrOIRoCPJpSO2RAp4HmtCdIfZ+2JWgEBN9LbR28seTGU0Zue1tMLp+YIAMSADzfvbkKX4/eb28j4YODiGin3heqmIlLja5hAUCu+nmGY3JWKvpMAlqNGgebsauBOvlqSX+JEx7p7EbTLen53XlzfmWUioqXikrc68Y8N2juJ/fyVsNChGHEE//rBANYWaZz+TRQqpLaBgNsPfDrgSpbS21YtV87IdjrlkX9JZbt5DOma2t9ITo5F+5glN22WwL/n+yDv00mw06orKxOqQ5+J04hhViwzAXETIcJDVm8uxZqktoGx2Nj9t43Wgaul/ERQiGQvtbWnDWgZYW9CXlQFjZ/7ciyHNn+Z2MexTimIeLz59TiIln0M1e+IbPpOAaDUnEYPTi6iqKxpbycs/qKo1tCslfKcffPn9enuMiPPY1vxO/ckeFQ4h46cdGqUWoidE/y54q5tPY5WDrGzQqIXot4BgchEE57e00IMCw2/1qZSVO/7SjA78o9INzcxsbrL+fnTnDDh9mmZn8F30oG1Hm+nABv5mQMopDS/h1HxtqTzWbABMe9sxpPoe9zezeOo1GELqWhPS8t46M0IAYHbdvR1aHbaOjbjfLz2eFhez6dba4yAfgF30o0BFVE8+Mjh/wFxPI+I5mAEHU6Ls+38vhTFwOBGhMDF8gkFpbC5ffsdv/uBs6dIj19dExEtARVXv9YNbop8NFY3aZ6gRRo+tu3IBHnzmdNCBMXldXJKPfL74WzWUJRE+coDUknqsOdZXQbAJYwluVTbOZI3Qt8GFzMwxyjo3RgBiN4fr+elXVpZGRLWXl6PdOTtJBSlBDUK/lnIrjOlrtqWYTQDJaF6FrTXu9sOa1ysrVoM5HVE1GFxZQcyJ/p+xzv6K/rbr6N6+XDpUBl0tKFIrbz78qWB6YnWFMCBld4XLBms+7df75ook/GNzb0GCV7U1Qfz9p64TyQWNjYD3qe9rj4SMJtQP3MyjSDPzWIRHPjH7X4YAvfXoPuyZf9Pbi3PcuXIh4mp3NllYC6XY79C+jl2o8PBipxjnBttn4MgMNnWgfcRJGPI2OL8hTj3LloIlmRicvBhiNykvecpqoa3RSY4DRcLAwyicuOepVR1JjgNFYHWONHL04czTX0UmNAUYD7Pr+xc4wqTHGaBb2OtZvHUmNYUazcA2J6etdUmOk0f8rTKMTxF91RG0D1SwYGwAAAABJRU5ErkJggg==", - }, - msg: "一切ok", - }; - }, - }, - { - url: "/api/v1/auth/login", - method: "post", - response: () => { - return { - code: "00000", - data: { - accessToken: - "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImp0aSI6IjE2YWJkNTlkOTAxNzQwZDliYmI3ZjczODBhZDkyNzNhIiwidXNlcklkIjoyLCJ1c2VybmFtZSI6ImFkbWluIiwiZGVwdElkIjoxLCJkYXRhU2NvcGUiOjEsImF1dGhvcml0aWVzIjpbIlJPTEVfQURNSU4iXSwiZXhwIjoxNjkxMTAzMzgyfQ.P4cuIfmPepl3HuguhMS7NXn5a7IUPpsLbmtA_rHOhHk", - tokenType: "Bearer", - refreshToken: null, - expires: null, - }, - msg: "一切ok", - }; - }, - }, - { - url: "/api/v1/users/me", - method: "get", - response: () => { - return { - code: "00000", - data: { - userId: 2, - nickname: "系统管理员", - avatar: - "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif", - roles: ["ADMIN"], - perms: [ - "sys:menu:delete", - "sys:dept:edit", - "sys:dict_type:add", - "sys:dict:edit", - "sys:dict:delete", - "sys:dict_type:edit", - "sys:menu:add", - "sys:user:add", - "sys:role:edit", - "sys:dept:delete", - "sys:user:edit", - "sys:user:delete", - "sys:user:reset_pwd", - "sys:dept:add", - "sys:role:delete", - "sys:dict_type:delete", - "sys:menu:edit", - "sys:dict:add", - "sys:role:add", - ], - }, - msg: "一切ok", - }; - }, - }, - { - url: "/api/v1/auth/logout", - method: "delete", - response: () => { - return { - code: "00000", - data: {}, - msg: "string", - }; - }, - }, - { - url: "/api/v1/users/page", - method: "get", - response: () => { - return { - code: "00000", - data: { - list: [ - { - id: 2, - username: "admin", - nickname: "系统管理员", - mobile: "17621210366", - genderLabel: "男", - avatar: - "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif", - email: null, - status: 1, - deptName: "有来技术", - roleNames: "系统管理员", - createTime: "2019-10-10", - }, - { - id: 3, - username: "test", - nickname: "测试小用户", - mobile: "17621210366", - genderLabel: "男", - avatar: - "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif", - email: null, - status: 1, - deptName: "测试部门", - roleNames: "访问游客", - createTime: "2021-06-04", - }, - ], - total: 2, - }, - msg: "一切ok", - }; - }, - }, - - { - url: "/api/v1/users/:id/form", - method: "get", - response: ({ url }) => { - const id = url.match(/\/api\/v1\/users\/(\d+)\/form/)[1]; - let formData = null; - if (id == 2) { - formData = { - id: 2, - username: "admin", - nickname: "系统管理员", - mobile: "17621210366", - gender: 1, - avatar: - "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif", - email: "", - status: 1, - deptId: 1, - roleIds: [2], - }; - } else if (id == 3) { - formData = { - id: 3, - username: "test", - nickname: "测试小用户", - mobile: "17621210366", - gender: 1, - avatar: - "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif", - email: "youlaitech@163.com", - status: 1, - deptId: 3, - roleIds: [3], - }; - } - - return { - code: "00000", - data: formData, - msg: "一切ok", - }; - }, - }, -] as MockMethod[]; diff --git a/package.json b/package.json index d19090c0..4b542653 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "vue3-element-admin", "version": "2.8.0", "private": true, + "type": "module", "scripts": { "preinstall": "npx only-allow pnpm", "dev": "vite serve --mode development", @@ -49,7 +50,6 @@ "echarts": "^5.4.3", "element-plus": "^2.4.4", "lodash-es": "^4.17.21", - "mockjs": "^1.1.0", "net": "^1.0.2", "nprogress": "^0.2.0", "path-browserify": "^1.0.1", @@ -107,7 +107,7 @@ "unplugin-icons": "^0.16.6", "unplugin-vue-components": "^0.24.1", "vite": "^5.0.10", - "vite-plugin-mock": "^3.0.0", + "vite-plugin-mock-dev-server": "^1.4.3", "vite-plugin-svg-icons": "^2.0.1", "vue-tsc": "^1.8.27" }, diff --git a/src/views/demo/permission/components/SwitchRoles.vue b/src/views/demo/permission/components/SwitchRoles.vue deleted file mode 100644 index a2b3c186..00000000 --- a/src/views/demo/permission/components/SwitchRoles.vue +++ /dev/null @@ -1,27 +0,0 @@ - - - diff --git a/src/views/demo/permission/page.vue b/src/views/demo/permission/page.vue deleted file mode 100644 index 38901295..00000000 --- a/src/views/demo/permission/page.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - diff --git a/src/views/demo/table/Export2Excel.js b/src/views/demo/table/Export2Excel.js deleted file mode 100644 index 6a14ff21..00000000 --- a/src/views/demo/table/Export2Excel.js +++ /dev/null @@ -1,257 +0,0 @@ -/* eslint-disable */ -import * as XLSX from "xlsx"; - -// TODO: this is a toy example, may be file-saver is a better choice -// import { saveAs } from 'file-saver' -function saveAs(blob, fileName) { - const type = fileName.split(".")[1]; - console.log(type); - const file = new window.File([blob], fileName, { type: type }); - console.log(file); - // 创建一个指向 File 对象的 URL - const url = URL.createObjectURL(file); - - // 创建一个 a 标签 - const a = document.createElement("a"); - a.href = url; - a.download = fileName; - - // 将 a 标签添加到文档中 - document.body.appendChild(a); - - // 模拟点击 a 标签,开始下载 - a.click(); - - // 下载完成后,从文档中移除 a 标签,并释放 URL - document.body.removeChild(a); - URL.revokeObjectURL(url); - return file; -} - -function generateArray(table) { - var out = []; - var rows = table.querySelectorAll("tr"); - var ranges = []; - for (var R = 0; R < rows.length; ++R) { - var outRow = []; - var row = rows[R]; - var columns = row.querySelectorAll("td"); - for (var C = 0; C < columns.length; ++C) { - var cell = columns[C]; - var colspan = cell.getAttribute("colspan"); - var rowspan = cell.getAttribute("rowspan"); - var cellValue = cell.innerText; - if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue; - - //Skip ranges - ranges.forEach(function (range) { - if ( - R >= range.s.r && - R <= range.e.r && - outRow.length >= range.s.c && - outRow.length <= range.e.c - ) { - for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null); - } - }); - - //Handle Row Span - if (rowspan || colspan) { - rowspan = rowspan || 1; - colspan = colspan || 1; - ranges.push({ - s: { - r: R, - c: outRow.length, - }, - e: { - r: R + rowspan - 1, - c: outRow.length + colspan - 1, - }, - }); - } - - //Handle Value - outRow.push(cellValue !== "" ? cellValue : null); - - //Handle Colspan - if (colspan) for (var k = 0; k < colspan - 1; ++k) outRow.push(null); - } - out.push(outRow); - } - return [out, ranges]; -} - -function datenum(v, date1904) { - if (date1904) v += 1462; - var epoch = Date.parse(v); - return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000); -} - -function sheet_from_array_of_arrays(data, opts) { - var ws = {}; - var range = { - s: { - c: 10000000, - r: 10000000, - }, - e: { - c: 0, - r: 0, - }, - }; - for (var R = 0; R != data.length; ++R) { - for (var C = 0; C != data[R].length; ++C) { - if (range.s.r > R) range.s.r = R; - if (range.s.c > C) range.s.c = C; - if (range.e.r < R) range.e.r = R; - if (range.e.c < C) range.e.c = C; - var cell = { - v: data[R][C], - }; - if (cell.v == null) continue; - var cell_ref = XLSX.utils.encode_cell({ - c: C, - r: R, - }); - - if (typeof cell.v === "number") cell.t = "n"; - else if (typeof cell.v === "boolean") cell.t = "b"; - else if (cell.v instanceof Date) { - cell.t = "n"; - cell.z = XLSX.SSF._table[14]; - cell.v = datenum(cell.v); - } else cell.t = "s"; - - ws[cell_ref] = cell; - } - } - if (range.s.c < 10000000) ws["!ref"] = XLSX.utils.encode_range(range); - return ws; -} - -function Workbook() { - if (!(this instanceof Workbook)) return new Workbook(); - this.SheetNames = []; - this.Sheets = {}; -} - -function s2ab(s) { - var buf = new ArrayBuffer(s.length); - var view = new Uint8Array(buf); - for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xff; - return buf; -} - -export function export_table_to_excel(id) { - var theTable = document.getElementById(id); - var oo = generateArray(theTable); - var ranges = oo[1]; - - /* original data */ - var data = oo[0]; - var ws_name = "SheetJS"; - - var wb = new Workbook(), - ws = sheet_from_array_of_arrays(data); - - /* add ranges to worksheet */ - // ws['!cols'] = ['apple', 'banan']; - ws["!merges"] = ranges; - - /* add worksheet to workbook */ - wb.SheetNames.push(ws_name); - wb.Sheets[ws_name] = ws; - - var wbout = XLSX.write(wb, { - bookType: "xlsx", - bookSST: false, - type: "binary", - }); - - saveAs( - new Blob([s2ab(wbout)], { - type: "application/octet-stream", - }), - "test.xlsx" - ); -} - -export function export_json_to_excel({ - multiHeader = [], - header, - data, - filename, - merges = [], - autoWidth = true, - bookType = "xlsx", -} = {}) { - /* original data */ - filename = filename || "excel-list"; - data = [...data]; - data.unshift(header); - - for (let i = multiHeader.length - 1; i > -1; i--) { - data.unshift(multiHeader[i]); - } - - var ws_name = "SheetJS"; - var wb = new Workbook(), - ws = sheet_from_array_of_arrays(data); - - if (merges.length > 0) { - if (!ws["!merges"]) ws["!merges"] = []; - merges.forEach((item) => { - ws["!merges"].push(XLSX.utils.decode_range(item)); - }); - } - - if (autoWidth) { - /*设置worksheet每列的最大宽度*/ - const colWidth = data.map((row) => - row.map((val) => { - /*先判断是否为null/undefined*/ - if (val == null) { - return { - wch: 10, - }; - } else if (val.toString().charCodeAt(0) > 255) { - /*再判断是否为中文*/ - return { - wch: val.toString().length * 2, - }; - } else { - return { - wch: val.toString().length, - }; - } - }) - ); - /*以第一行为初始值*/ - let result = colWidth[0]; - for (let i = 1; i < colWidth.length; i++) { - for (let j = 0; j < colWidth[i].length; j++) { - if (result[j]["wch"] < colWidth[i][j]["wch"]) { - result[j]["wch"] = colWidth[i][j]["wch"]; - } - } - } - ws["!cols"] = result; - } - - /* add worksheet to workbook */ - wb.SheetNames.push(ws_name); - wb.Sheets[ws_name] = ws; - - var wbout = XLSX.write(wb, { - bookType: bookType, - bookSST: false, - type: "binary", - }); - saveAs( - new Blob([s2ab(wbout)], { - type: "application/octet-stream", - }), - `${filename}.${bookType}` - ); -} diff --git a/src/views/demo/table/drag-table.vue b/src/views/demo/table/drag-table.vue deleted file mode 100644 index c4c65f37..00000000 --- a/src/views/demo/table/drag-table.vue +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - - diff --git a/src/views/demo/table/dynamic-table/components/FixedThead.vue b/src/views/demo/table/dynamic-table/components/FixedThead.vue deleted file mode 100644 index 84ce9def..00000000 --- a/src/views/demo/table/dynamic-table/components/FixedThead.vue +++ /dev/null @@ -1,55 +0,0 @@ - - - diff --git a/src/views/demo/table/dynamic-table/components/UnfixedThead.vue b/src/views/demo/table/dynamic-table/components/UnfixedThead.vue deleted file mode 100644 index 8056267f..00000000 --- a/src/views/demo/table/dynamic-table/components/UnfixedThead.vue +++ /dev/null @@ -1,45 +0,0 @@ - - - diff --git a/src/views/demo/table/dynamic-table/index.vue b/src/views/demo/table/dynamic-table/index.vue deleted file mode 100644 index acabac11..00000000 --- a/src/views/demo/table/dynamic-table/index.vue +++ /dev/null @@ -1,24 +0,0 @@ - - - diff --git a/vite.config.ts b/vite.config.ts index 6696f5ff..6710249f 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -9,8 +9,8 @@ import Icons from "unplugin-icons/vite"; import IconsResolver from "unplugin-icons/resolver"; import { createSvgIconsPlugin } from "vite-plugin-svg-icons"; +import mockDevServerPlugin from "vite-plugin-mock-dev-server"; -import { viteMockServe } from "vite-plugin-mock"; import vueJsx from "@vitejs/plugin-vue-jsx"; import UnoCSS from "unocss/vite"; @@ -47,15 +47,14 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { open: true, proxy: { /** - * 反向代理解决跨域配置 - * http://localhost:3000/dev-api/users (F12可见请求路径) => http://localhost:8989/users (实际请求后端 API 路径) - * * env.VITE_APP_BASE_API: /dev-api - * env.VITE_APP_API_URL: http://localhost:8989 */ [env.VITE_APP_BASE_API]: { changeOrigin: true, - target: env.VITE_APP_API_URL, + // 线上接口地址 + target: "http://vapi.youlai.tech", + // 开发接口地址 + // target: http://localhost:8989 rewrite: (path) => path.replace(new RegExp("^" + env.VITE_APP_BASE_API), ""), }, @@ -107,11 +106,8 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { // 指定symbolId格式 symbolId: "icon-[dir]-[name]", }), - viteMockServe({ - ignore: /^\_/, - mockPath: "mock", - enable: mode === "development", - }), + // 开启 mock + mockDevServerPlugin(), ], // 预加载项目必需的组件 optimizeDeps: { -- Gitee From 06c448ebbc494ba4bc95fe603611cf546fa377df Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Wed, 10 Jan 2024 23:43:59 +0800 Subject: [PATCH 010/258] =?UTF-8?q?refactor:=20:recycle:=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=20log=20=E5=92=8C=E5=AE=8C=E5=96=84=20mock=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mock/dept.mock.ts | 42 ++ mock/dict.mock.ts | 58 ++ mock/menu.mock.ts | 854 ++++++++++++++++++++--- mock/role.mock.ts | 104 +++ mock/user.mock.ts | 22 - src/layout/components/TagsView/index.vue | 6 - src/store/modules/tagsView.ts | 6 - src/views/system/role/index.vue | 1 - src/views/system/user/index.vue | 1 - vite.config.ts | 4 +- 10 files changed, 964 insertions(+), 134 deletions(-) diff --git a/mock/dept.mock.ts b/mock/dept.mock.ts index 47dd2bc2..46e628d8 100644 --- a/mock/dept.mock.ts +++ b/mock/dept.mock.ts @@ -30,4 +30,46 @@ export default defineMock([ msg: "一切ok", }, }, + + { + url: "/api/v1/dept", + method: ["GET"], + body: { + code: "00000", + data: [ + { + id: 1, + parentId: 0, + name: "有来技术", + sort: 1, + status: 1, + children: [ + { + id: 2, + parentId: 1, + name: "研发部门", + sort: 1, + status: 1, + children: [], + createTime: null, + updateTime: "2022-04-19 12:46", + }, + { + id: 3, + parentId: 1, + name: "测试部门", + sort: 1, + status: 1, + children: [], + createTime: null, + updateTime: "2022-04-19 12:46", + }, + ], + createTime: null, + updateTime: null, + }, + ], + msg: "一切ok", + }, + }, ]); diff --git a/mock/dict.mock.ts b/mock/dict.mock.ts index 8a6cfed1..9f4a17de 100644 --- a/mock/dict.mock.ts +++ b/mock/dict.mock.ts @@ -38,4 +38,62 @@ export default defineMock([ }; }, }, + + { + url: "/api/v1/dict/types/page", + method: ["GET"], + body: { + code: "00000", + data: { + list: [ + { + id: 1, + name: "性别", + code: "gender", + status: 1, + }, + { + id: 2, + name: "状态", + code: "status", + status: 1, + }, + ], + total: 2, + }, + msg: "一切ok", + }, + }, + + { + url: "/api/v1/dict/page", + method: ["GET"], + body: { + code: "00000", + data: { + list: [ + { + id: 1, + name: "男", + value: "1", + status: 1, + }, + { + id: 2, + name: "女", + value: "2", + status: 1, + }, + { + id: 3, + name: "未知", + value: "0", + status: 1, + }, + ], + total: 3, + }, + msg: "一切ok", + }, + }, ]); diff --git a/mock/menu.mock.ts b/mock/menu.mock.ts index 215c9b15..6924c120 100644 --- a/mock/menu.mock.ts +++ b/mock/menu.mock.ts @@ -16,12 +16,12 @@ export default defineMock([ path: "/system", component: "Layout", redirect: "/system/user", + name: "/system", meta: { title: "系统管理", icon: "system", hidden: false, roles: ["ADMIN"], - keepAlive: true, }, children: [ { @@ -75,7 +75,7 @@ export default defineMock([ { path: "dict", component: "system/dict/index", - name: "DictType", + name: "Dict", meta: { title: "字典管理", icon: "dict", @@ -86,52 +86,86 @@ export default defineMock([ }, ], }, - { path: "/api", component: "Layout", + name: "/api", meta: { - title: "接口", + title: "接口文档", icon: "api", hidden: false, roles: ["ADMIN"], - keepAlive: true, + alwaysShow: true, }, children: [ { - path: "apidoc", - component: "demo/api-doc", - name: "Apidoc", + path: "apifox", + component: "demo/api/apifox", + name: "Apifox", meta: { - title: "接口文档", + title: "Apifox", icon: "api", hidden: false, roles: ["ADMIN"], - keepAlive: false, + keepAlive: true, + }, + }, + { + path: "swagger", + component: "demo/api/swagger", + name: "Swagger", + meta: { + title: "Swagger", + icon: "api", + hidden: true, + roles: ["ADMIN"], + keepAlive: true, + }, + }, + { + path: "knife4j", + component: "demo/api/knife4j", + name: "Knife4j", + meta: { + title: "Knife4j", + icon: "api", + hidden: true, + roles: ["ADMIN"], + keepAlive: true, }, }, ], }, { - path: "/external-link", + path: "/doc", component: "Layout", - redirect: "noredirect", + name: "/doc", meta: { - title: "外部链接", - icon: "link", + title: "平台文档", + icon: "document", hidden: false, roles: ["ADMIN"], - keepAlive: true, }, children: [ { - path: "https://juejin.cn/post/7228990409909108793", + path: "internal-doc", + component: "demo/internal-doc", + name: "InternalDoc", meta: { - title: "document", + title: "平台文档(内嵌)", icon: "document", hidden: false, roles: ["ADMIN"], - keepAlive: true, + }, + }, + { + path: "https://juejin.cn/post/7228990409909108793", + name: "Https://juejin.cn/post/7228990409909108793", + meta: { + title: "平台文档(外链)", + icon: "link", + hidden: false, + roles: ["ADMIN"], }, }, ], @@ -140,18 +174,19 @@ export default defineMock([ path: "/multi-level", component: "Layout", redirect: "/multi-level/multi-level1", + name: "/multiLevel", meta: { title: "多级菜单", - icon: "multi_level", + icon: "cascader", hidden: false, roles: ["ADMIN"], - keepAlive: true, }, children: [ { path: "multi-level1", component: "demo/multi-level/level1", redirect: "/multi-level/multi-level2", + name: "MultiLevel1", meta: { title: "菜单一级", icon: "", @@ -164,6 +199,7 @@ export default defineMock([ path: "multi-level2", component: "demo/multi-level/children/level2", redirect: "/multi-level/multi-level2/multi-level3-1", + name: "MultiLevel2", meta: { title: "菜单二级", icon: "", @@ -205,18 +241,18 @@ export default defineMock([ { path: "/component", component: "Layout", + name: "/component", meta: { title: "组件封装", icon: "menu", hidden: false, roles: ["ADMIN"], - keepAlive: true, }, children: [ { path: "wang-editor", component: "demo/wang-editor", - name: "wang-editor", + name: "WangEditor", meta: { title: "富文本编辑器", icon: "", @@ -228,7 +264,7 @@ export default defineMock([ { path: "upload", component: "demo/upload", - name: "upload", + name: "Upload", meta: { title: "图片上传", icon: "", @@ -240,7 +276,7 @@ export default defineMock([ { path: "icon-selector", component: "demo/icon-selector", - name: "icon-selector", + name: "IconSelector", meta: { title: "图标选择器", icon: "", @@ -261,22 +297,10 @@ export default defineMock([ keepAlive: true, }, }, - { - path: "taginput", - component: "demo/taginput", - name: "taginput", - meta: { - title: "标签输入框", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, { path: "signature", component: "demo/signature", - name: "signature", + name: "Signature", meta: { title: "签名", icon: "", @@ -300,108 +324,746 @@ export default defineMock([ ], }, { - path: "/table", + path: "/function", component: "Layout", + name: "/function", meta: { - title: "Table", - icon: "table", + title: "功能演示", + icon: "menu", hidden: false, roles: ["ADMIN"], - keepAlive: true, }, children: [ { - path: "dynamic-table", - component: "demo/table/dynamic-table/index", - name: "DynamicTable", + path: "icon-demo", + component: "demo/icons", + name: "IconDemo", meta: { - title: "动态Table", + title: "Icons", + icon: "el-icon-edit", hidden: false, roles: ["ADMIN"], keepAlive: true, }, }, { - path: "drag-table", - component: "demo/table/drag-table", - name: "DragTable", + path: "/function/websocket", + component: "demo/websocket", + name: "/function/websocket", meta: { - title: "拖拽Table", + title: "Websocket", + icon: "", hidden: false, roles: ["ADMIN"], keepAlive: true, }, }, { - path: "complex-table", - component: "demo/table/complex-table", - name: "ComplexTable", + path: "other", + component: "demo/other", + name: "Other", meta: { - title: "综合Table", + title: "敬请期待...", + icon: "", hidden: false, roles: ["ADMIN"], - keepAlive: true, }, }, ], }, + ], + msg: "一切ok", + }, + }, + + { + url: "/api/v1/menus", // 路径会拼接为: /dev-api/api/v1/menus/routes + method: ["GET"], + body: { + code: "00000", + data: [ { - path: "/function", + id: 1, + parentId: 0, + name: "系统管理", + type: "CATALOG", + path: "/system", component: "Layout", - meta: { - title: "功能演示", - icon: "menu", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, + sort: 1, + visible: 1, + icon: "system", + redirect: "/system/user", + perm: null, children: [ { - path: "permission", - component: "demo/permission/page", - name: "Permission", - meta: { - title: "Permission", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, + id: 2, + parentId: 1, + name: "用户管理", + type: "MENU", + path: "user", + component: "system/user/index", + sort: 1, + visible: 1, + icon: "user", + redirect: null, + perm: null, + children: [ + { + id: 31, + parentId: 2, + name: "用户新增", + type: "BUTTON", + path: "", + component: null, + sort: 1, + visible: 1, + icon: "", + redirect: "", + perm: "sys:user:add", + children: [], + }, + { + id: 32, + parentId: 2, + name: "用户编辑", + type: "BUTTON", + path: "", + component: null, + sort: 2, + visible: 1, + icon: "", + redirect: "", + perm: "sys:user:edit", + children: [], + }, + { + id: 33, + parentId: 2, + name: "用户删除", + type: "BUTTON", + path: "", + component: null, + sort: 3, + visible: 1, + icon: "", + redirect: "", + perm: "sys:user:delete", + children: [], + }, + { + id: 88, + parentId: 2, + name: "重置密码", + type: "BUTTON", + path: "", + component: null, + sort: 4, + visible: 1, + icon: "", + redirect: null, + perm: "sys:user:reset_pwd", + children: [], + }, + ], + }, + { + id: 3, + parentId: 1, + name: "角色管理", + type: "MENU", + path: "role", + component: "system/role/index", + sort: 2, + visible: 1, + icon: "role", + redirect: null, + perm: null, + children: [ + { + id: 70, + parentId: 3, + name: "角色新增", + type: "BUTTON", + path: "", + component: null, + sort: 1, + visible: 1, + icon: "", + redirect: null, + perm: "sys:role:add", + children: [], + }, + { + id: 71, + parentId: 3, + name: "角色编辑", + type: "BUTTON", + path: "", + component: null, + sort: 2, + visible: 1, + icon: "", + redirect: null, + perm: "sys:role:edit", + children: [], + }, + { + id: 72, + parentId: 3, + name: "角色删除", + type: "BUTTON", + path: "", + component: null, + sort: 3, + visible: 1, + icon: "", + redirect: null, + perm: "sys:role:delete", + children: [], + }, + ], + }, + { + id: 4, + parentId: 1, + name: "菜单管理", + type: "MENU", + path: "menu", + component: "system/menu/index", + sort: 3, + visible: 1, + icon: "menu", + redirect: null, + perm: null, + children: [ + { + id: 73, + parentId: 4, + name: "菜单新增", + type: "BUTTON", + path: "", + component: null, + sort: 1, + visible: 1, + icon: "", + redirect: null, + perm: "sys:menu:add", + children: [], + }, + { + id: 74, + parentId: 4, + name: "菜单编辑", + type: "BUTTON", + path: "", + component: null, + sort: 3, + visible: 1, + icon: "", + redirect: null, + perm: "sys:menu:edit", + children: [], + }, + { + id: 75, + parentId: 4, + name: "菜单删除", + type: "BUTTON", + path: "", + component: null, + sort: 3, + visible: 1, + icon: "", + redirect: null, + perm: "sys:menu:delete", + children: [], + }, + ], + }, + { + id: 5, + parentId: 1, + name: "部门管理", + type: "MENU", + path: "dept", + component: "system/dept/index", + sort: 4, + visible: 1, + icon: "tree", + redirect: null, + perm: null, + children: [ + { + id: 76, + parentId: 5, + name: "部门新增", + type: "BUTTON", + path: "", + component: null, + sort: 1, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dept:add", + children: [], + }, + { + id: 77, + parentId: 5, + name: "部门编辑", + type: "BUTTON", + path: "", + component: null, + sort: 2, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dept:edit", + children: [], + }, + { + id: 78, + parentId: 5, + name: "部门删除", + type: "BUTTON", + path: "", + component: null, + sort: 3, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dept:delete", + children: [], + }, + ], + }, + { + id: 6, + parentId: 1, + name: "字典管理", + type: "MENU", + path: "dict", + component: "system/dict/index", + sort: 5, + visible: 1, + icon: "dict", + redirect: null, + perm: null, + children: [ + { + id: 79, + parentId: 6, + name: "字典类型新增", + type: "BUTTON", + path: "", + component: null, + sort: 1, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dict_type:add", + children: [], + }, + { + id: 81, + parentId: 6, + name: "字典类型编辑", + type: "BUTTON", + path: "", + component: null, + sort: 2, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dict_type:edit", + children: [], + }, + { + id: 84, + parentId: 6, + name: "字典类型删除", + type: "BUTTON", + path: "", + component: null, + sort: 3, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dict_type:delete", + children: [], + }, + { + id: 85, + parentId: 6, + name: "字典数据新增", + type: "BUTTON", + path: "", + component: null, + sort: 4, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dict:add", + children: [], + }, + { + id: 86, + parentId: 6, + name: "字典数据编辑", + type: "BUTTON", + path: "", + component: null, + sort: 5, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dict:edit", + children: [], + }, + { + id: 87, + parentId: 6, + name: "字典数据删除", + type: "BUTTON", + path: "", + component: null, + sort: 6, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dict:delete", + children: [], + }, + ], + }, + ], + }, + { + id: 40, + parentId: 0, + name: "接口文档", + type: "CATALOG", + path: "/api", + component: "Layout", + sort: 7, + visible: 1, + icon: "api", + redirect: "", + perm: null, + children: [ + { + id: 41, + parentId: 40, + name: "Apifox", + type: "MENU", + path: "apifox", + component: "demo/api/apifox", + sort: 1, + visible: 1, + icon: "api", + redirect: "", + perm: null, + children: [], + }, + { + id: 103, + parentId: 40, + name: "Swagger", + type: "MENU", + path: "swagger", + component: "demo/api/swagger", + sort: 2, + visible: 0, + icon: "api", + redirect: "", + perm: null, + children: [], + }, + { + id: 104, + parentId: 40, + name: "Knife4j", + type: "MENU", + path: "knife4j", + component: "demo/api/knife4j", + sort: 3, + visible: 0, + icon: "api", + redirect: "", + perm: null, + children: [], + }, + ], + }, + { + id: 26, + parentId: 0, + name: "平台文档", + type: "CATALOG", + path: "/doc", + component: "Layout", + sort: 8, + visible: 1, + icon: "document", + redirect: null, + perm: null, + children: [ + { + id: 102, + parentId: 26, + name: "平台文档(内嵌)", + type: "EXTLINK", + path: "internal-doc", + component: "demo/internal-doc", + sort: 1, + visible: 1, + icon: "document", + redirect: "", + perm: null, + children: [], + }, + { + id: 30, + parentId: 26, + name: "平台文档(外链)", + type: "EXTLINK", + path: "https://juejin.cn/post/7228990409909108793", + component: "", + sort: 2, + visible: 1, + icon: "link", + redirect: "", + perm: null, + children: [], + }, + ], + }, + { + id: 20, + parentId: 0, + name: "多级菜单", + type: "CATALOG", + path: "/multi-level", + component: "Layout", + sort: 9, + visible: 1, + icon: "cascader", + redirect: "/multi-level/multi-level1", + perm: null, + children: [ + { + id: 21, + parentId: 20, + name: "菜单一级", + type: "MENU", + path: "multi-level1", + component: "demo/multi-level/level1", + sort: 1, + visible: 1, + icon: "", + redirect: "/multi-level/multi-level2", + perm: null, + children: [ + { + id: 22, + parentId: 21, + name: "菜单二级", + type: "MENU", + path: "multi-level2", + component: "demo/multi-level/children/level2", + sort: 1, + visible: 1, + icon: "", + redirect: "/multi-level/multi-level2/multi-level3-1", + perm: null, + children: [ + { + id: 23, + parentId: 22, + name: "菜单三级-1", + type: "MENU", + path: "multi-level3-1", + component: "demo/multi-level/children/children/level3-1", + sort: 1, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], + }, + { + id: 24, + parentId: 22, + name: "菜单三级-2", + type: "MENU", + path: "multi-level3-2", + component: "demo/multi-level/children/children/level3-2", + sort: 2, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], + }, + ], + }, + ], + }, + ], + }, + { + id: 36, + parentId: 0, + name: "组件封装", + type: "CATALOG", + path: "/component", + component: "Layout", + sort: 10, + visible: 1, + icon: "menu", + redirect: "", + perm: null, + children: [ + { + id: 37, + parentId: 36, + name: "富文本编辑器", + type: "MENU", + path: "wang-editor", + component: "demo/wang-editor", + sort: 1, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], + }, + { + id: 38, + parentId: 36, + name: "图片上传", + type: "MENU", + path: "upload", + component: "demo/upload", + sort: 2, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], + }, + { + id: 39, + parentId: 36, + name: "图标选择器", + type: "MENU", + path: "icon-selector", + component: "demo/icon-selector", + sort: 3, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], + }, + { + id: 95, + parentId: 36, + name: "字典组件", + type: "MENU", + path: "dict-demo", + component: "demo/dict", + sort: 4, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], + }, + { + id: 93, + parentId: 36, + name: "签名", + type: "MENU", + path: "signature", + component: "demo/signature", + sort: 6, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], + }, + { + id: 94, + parentId: 36, + name: "表格", + type: "MENU", + path: "table", + component: "demo/table", + sort: 7, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], }, + ], + }, + { + id: 89, + parentId: 0, + name: "功能演示", + type: "CATALOG", + path: "/function", + component: "Layout", + sort: 11, + visible: 1, + icon: "menu", + redirect: "", + perm: null, + children: [ { + id: 97, + parentId: 89, + name: "Icons", + type: "MENU", path: "icon-demo", component: "demo/icons", - name: "Icons", - meta: { - title: "图标", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, + sort: 2, + visible: 1, + icon: "el-icon-edit", + redirect: "", + perm: null, + children: [], }, { - path: "websocket", - component: "demo/websocket", + id: 90, + parentId: 89, name: "Websocket", - meta: { - title: "Websocket", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, + type: "MENU", + path: "/function/websocket", + component: "demo/websocket", + sort: 3, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], }, { + id: 91, + parentId: 89, + name: "敬请期待...", + type: "CATALOG", path: "other", component: "demo/other", - meta: { - title: "敬请期待...", - icon: "", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, + sort: 4, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], }, ], }, diff --git a/mock/role.mock.ts b/mock/role.mock.ts index 060f914e..b6124613 100644 --- a/mock/role.mock.ts +++ b/mock/role.mock.ts @@ -60,4 +60,108 @@ export default defineMock([ msg: "一切ok", }, }, + + { + url: "/api/v1/roles/page", + method: ["GET"], + body: { + code: "00000", + data: { + list: [ + { + id: 2, + name: "系统管理员", + code: "ADMIN", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + { + id: 3, + name: "访问游客", + code: "GUEST", + status: 1, + sort: 3, + createTime: "2021-05-26 15:49:05", + updateTime: "2019-05-05 16:00:00", + }, + { + id: 4, + name: "系统管理员1", + code: "ADMIN1", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + { + id: 5, + name: "系统管理员2", + code: "ADMIN2", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + { + id: 6, + name: "系统管理员3", + code: "ADMIN3", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + { + id: 7, + name: "系统管理员4", + code: "ADMIN4", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + { + id: 8, + name: "系统管理员5", + code: "ADMIN5", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + { + id: 9, + name: "系统管理员6", + code: "ADMIN6", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: "2023-12-04 11:43:15", + }, + { + id: 10, + name: "系统管理员7", + code: "ADMIN7", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + { + id: 11, + name: "系统管理员8", + code: "ADMIN8", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + ], + total: 10, + }, + msg: "一切ok", + }, + }, ]); diff --git a/mock/user.mock.ts b/mock/user.mock.ts index b92c134c..bc30fb7a 100644 --- a/mock/user.mock.ts +++ b/mock/user.mock.ts @@ -129,25 +129,3 @@ export default defineMock([ }, }, ]); - -import { defineMock } from "vite-plugin-mock-dev-server"; - -export default defineMock([ - { - url: "/api/hello_world", - method: ["GET"], - }, - { - url: "/api/v1/auth/captcha", - method: ["GET"], - body: { - code: "00000", - data: { - captchaKey: "534b8ef2b0a24121bec76391ddd159f9", - captchaBase64: - "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAkCAIAAADNSmkJAAAFKUlEQVR4Xu2ZXUwcVRiGV70wMWo08V5NvPXCrDbFaGpMaZW2hqQxaoiJTRsaMBCNSYtpa2JTKiFSelFa+Q/QZcMWqEhBlh+htbEpZhMrBQrlJ0hBywLLyrJ0WZbje3bqOvPNLHPWrDvdOE9ONmfe78zkzMs335wzWJhJQrBQweS/wTQ6QWgYHdoIOcecOe05O+t2WkutO+p2ZF3Ksg/YV9ZW6FATYajR3nveg60H9327r3O8c35lHgp+r05dPdJzBL73TPSQ8SaCKIxGLsPlop+K0JHrEkPuoT31e5qGmmjARACF0agYyGVNlyVm/pzZXrN9fHGcBkz0UBid+31u93i3XFFT80vN8cvHqWqih8Lo1NpUqS5vwh3vnd223VQ10UNh9NbyrcFQUK6oCawHUipSqGqiB83oBf+CXFGDMp1mS6OqiR4Ko7FexkpOrqhpHGw82nOUqiZ6KIzGrkRuorW0dJMmOy+hOCfYGzb2RBFv6HRO0gEJw/U7y+pgL1bwmTxexN6sZ31TdEwEhdG+gA+7EqyXpUO1uZH20cWL8hMTRt1N9tBXzCJrOIRoCPJpSO2RAp4HmtCdIfZ+2JWgEBN9LbR28seTGU0Zue1tMLp+YIAMSADzfvbkKX4/eb28j4YODiGin3heqmIlLja5hAUCu+nmGY3JWKvpMAlqNGgebsauBOvlqSX+JEx7p7EbTLen53XlzfmWUioqXikrc68Y8N2juJ/fyVsNChGHEE//rBANYWaZz+TRQqpLaBgNsPfDrgSpbS21YtV87IdjrlkX9JZbt5DOma2t9ITo5F+5glN22WwL/n+yDv00mw06orKxOqQ5+J04hhViwzAXETIcJDVm8uxZqktoGx2Nj9t43Wgaul/ERQiGQvtbWnDWgZYW9CXlQFjZ/7ciyHNn+Z2MexTimIeLz59TiIln0M1e+IbPpOAaDUnEYPTi6iqKxpbycs/qKo1tCslfKcffPn9enuMiPPY1vxO/ckeFQ4h46cdGqUWoidE/y54q5tPY5WDrGzQqIXot4BgchEE57e00IMCw2/1qZSVO/7SjA78o9INzcxsbrL+fnTnDDh9mmZn8F30oG1Hm+nABv5mQMopDS/h1HxtqTzWbABMe9sxpPoe9zezeOo1GELqWhPS8t46M0IAYHbdvR1aHbaOjbjfLz2eFhez6dba4yAfgF30o0BFVE8+Mjh/wFxPI+I5mAEHU6Ls+38vhTFwOBGhMDF8gkFpbC5ffsdv/uBs6dIj19dExEtARVXv9YNbop8NFY3aZ6gRRo+tu3IBHnzmdNCBMXldXJKPfL74WzWUJRE+coDUknqsOdZXQbAJYwluVTbOZI3Qt8GFzMwxyjo3RgBiN4fr+elXVpZGRLWXl6PdOTtJBSlBDUK/lnIrjOlrtqWYTQDJaF6FrTXu9sOa1ysrVoM5HVE1GFxZQcyJ/p+xzv6K/rbr6N6+XDpUBl0tKFIrbz78qWB6YnWFMCBld4XLBms+7df75ook/GNzb0GCV7U1Qfz9p64TyQWNjYD3qe9rj4SMJtQP3MyjSDPzWIRHPjH7X4YAvfXoPuyZf9Pbi3PcuXIh4mp3NllYC6XY79C+jl2o8PBipxjnBttn4MgMNnWgfcRJGPI2OL8hTj3LloIlmRicvBhiNykvecpqoa3RSY4DRcLAwyicuOepVR1JjgNFYHWONHL04czTX0UmNAUYD7Pr+xc4wqTHGaBb2OtZvHUmNYUazcA2J6etdUmOk0f8rTKMTxF91RG0D1SwYGwAAAABJRU5ErkJggg==", - }, - msg: "一切ok", - }, - }, -]); diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index aa6267b4..f58f7d34 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -79,7 +79,6 @@ const tagsViewStore = useTagsViewStore(); const appStore = useAppStore(); const { visitedViews } = storeToRefs(tagsViewStore); -console.log("visitedViews", visitedViews); const settingsStore = useSettingsStore(); const layout = computed(() => settingsStore.layout); @@ -142,14 +141,11 @@ function filterAffixTags(routes: RouteRecordRaw[], basePath = "/") { let tags: TagView[] = []; routes.forEach(processRoute); - console.log("filterAffixTags", tags); - return tags; } function initTags() { const tags: TagView[] = filterAffixTags(permissionStore.routes); - console.log("initTags", tags); affixTags.value = tags; for (const tag of tags) { // Must have tag name @@ -160,7 +156,6 @@ function initTags() { } function addTags() { - console.log("addTags", visitedViews); if (route.meta.title) { tagsViewStore.addView({ name: route.name as string, @@ -174,7 +169,6 @@ function addTags() { } function moveToCurrentTag() { - console.log("moveToCurrentTag", visitedViews); // 使用 nextTick() 的目的是确保在更新 tagsView 组件之前,scrollPaneRef 对象已经滚动到了正确的位置。 nextTick(() => { for (const tag of visitedViews.value) { diff --git a/src/store/modules/tagsView.ts b/src/store/modules/tagsView.ts index b18646cf..6327ca99 100644 --- a/src/store/modules/tagsView.ts +++ b/src/store/modules/tagsView.ts @@ -4,13 +4,10 @@ export const useTagsViewStore = defineStore("tagsView", () => { const visitedViews = ref([]); const cachedViews = ref([]); - console.log("first visitedViews", visitedViews, "cachedViews", cachedViews); - /** * 添加已访问视图到已访问视图列表中 */ function addVisitedView(view: TagView) { - console.log("addVisitedView", visitedViews, view); // 如果已经存在于已访问的视图列表中,则不再添加 if (visitedViews.value.some((v) => v.fullPath === view.fullPath)) { return; @@ -28,7 +25,6 @@ export const useTagsViewStore = defineStore("tagsView", () => { * 添加缓存视图到缓存视图列表中 */ function addCachedView(view: TagView) { - console.log("addCachedView", visitedViews, view); const viewName = view.name; // 如果缓存视图名称已经存在于缓存视图列表中,则不再添加 if (cachedViews.value.includes(viewName)) { @@ -90,7 +86,6 @@ export const useTagsViewStore = defineStore("tagsView", () => { } function updateVisitedView(view: TagView) { - console.log("updateVisitedView", visitedViews, view); for (let v of visitedViews.value) { if (v.path === view.path) { v = Object.assign(v, view); @@ -100,7 +95,6 @@ export const useTagsViewStore = defineStore("tagsView", () => { } function addView(view: TagView) { - console.log("addView", visitedViews, view); addVisitedView(view); addCachedView(view); } diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue index 82790d11..17742b7a 100644 --- a/src/views/system/role/index.vue +++ b/src/views/system/role/index.vue @@ -182,7 +182,6 @@ function openMenuDialog(row: RolePageVO) { getRoleMenuIds(roleId) .then(({ data }) => { const checkedMenuIds = data; - console.log("勾选权限", checkedMenuIds); checkedMenuIds.forEach((menuId) => menuRef.value.setChecked(menuId, true, false) ); diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 7b340e55..80ca5c4e 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -291,7 +291,6 @@ function downloadTemplate() { /** Excel文件 Change */ function handleFileChange(file: any) { importData.file = file.raw; - console.log(importData.file); } /** Excel文件 Exceed */ diff --git a/vite.config.ts b/vite.config.ts index 6710249f..15fa8bed 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -66,6 +66,8 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { UnoCSS({ hmrTopLevelAwait: false, }), + // MOCK 服务 + mockDevServerPlugin(), // 自动导入参考: https://github.com/sxzz/element-plus-best-practices/blob/main/vite.config.ts AutoImport({ // 自动导入 Vue 相关函数,如:ref, reactive, toRef 等 @@ -106,8 +108,6 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { // 指定symbolId格式 symbolId: "icon-[dir]-[name]", }), - // 开启 mock - mockDevServerPlugin(), ], // 预加载项目必需的组件 optimizeDeps: { -- Gitee From 9f9104574a3a149f4436ae6cf7d5475722ca460e Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Wed, 10 Jan 2024 23:52:35 +0800 Subject: [PATCH 011/258] =?UTF-8?q?refactor:=20:recycle:=20=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E8=A7=92=E8=89=B2=20mock=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mock/role.mock.ts | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/mock/role.mock.ts b/mock/role.mock.ts index b6124613..f86c8ae2 100644 --- a/mock/role.mock.ts +++ b/mock/role.mock.ts @@ -164,4 +164,47 @@ export default defineMock([ msg: "一切ok", }, }, + + { + url: "/api/v1/roles/:id/form", + method: ["GET"], + body: ({ params }) => { + const id = params.id; + let formData = null; + if (id == 2) { + formData = { + id: 2, + name: "系统管理员", + code: "ADMIN", + sort: 2, + status: 1, + dataScope: 1, + }; + } else if (id == 3) { + formData = { + id: 3, + name: "访问游客", + code: "GUEST", + sort: 3, + status: 1, + dataScope: 2, + }; + } else { + formData = { + id: 4, + name: "系统管理员1", + code: "ADMIN1", + sort: 2, + status: 1, + dataScope: 1, + }; + } + + return { + code: "00000", + data: formData, + msg: "一切ok", + }; + }, + }, ]); -- Gitee From 2990b563dc50be9453faddf611f0129993cadd3e Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Thu, 11 Jan 2024 00:10:52 +0800 Subject: [PATCH 012/258] =?UTF-8?q?chore:=20:hammer:=20=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=85=B3=E9=97=AD=20Mock=20=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 15fa8bed..592397d4 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -62,12 +62,12 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { }, plugins: [ vue(), + // MOCK 服务,开启 MOCK 放开注释即可 + // mockDevServerPlugin(), vueJsx(), UnoCSS({ hmrTopLevelAwait: false, }), - // MOCK 服务 - mockDevServerPlugin(), // 自动导入参考: https://github.com/sxzz/element-plus-best-practices/blob/main/vite.config.ts AutoImport({ // 自动导入 Vue 相关函数,如:ref, reactive, toRef 等 -- Gitee From 7879c8d731bc49425f7b04154233bb44c871b3c1 Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Thu, 11 Jan 2024 08:21:21 +0800 Subject: [PATCH 013/258] =?UTF-8?q?docs:=20:memo:=20=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 084ce7a7..d233463e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

- - - + + + @@ -78,6 +78,10 @@ pnpm install pnpm run dev ``` +## 开启Mock + +默认使用线上接口,要使用 Mock 接口,只需在 vite.config.ts 文件的 plugins 配置中取消对 mockDevServerPlugin() 的注释**即可**。 + ## 项目部署 ```bash @@ -122,27 +126,23 @@ server { 重启 VSCode 尝试 -- **接口切换 Mock** - - v2.5.0 版本支持 Mock , 修改 `.env.development` 的 `VITE_APP_API_URL` 值为 `http://localhost:3000` 即可 。 - - **其他问题** 如果有其他问题或者建议,建议 [ISSUE](https://gitee.com/youlaiorg/vue3-element-admin/issues/new) -## 接口支持 +## 后端接口 -- **接口调用地址**:[https://vapi.youlai.tech](https://vapi.youlai.tech) +- **后端接口地址**:[https://vapi.youlai.tech](https://vapi.youlai.tech) - **接口文档地址**:[在线接口文档](https://www.apifox.cn/apidoc/shared-195e783f-4d85-4235-a038-eec696de4ea5) -- **OpenAPI文档地址**:[http://vapi.youlai.tech/v3/api-docs](http://vapi.youlai.tech/v3/api-docs) +- **OpenAPI地址**:[http://vapi.youlai.tech/v3/api-docs](http://vapi.youlai.tech/v3/api-docs) -- **本地接口**:默认使用线上接口,你可以通过以下步骤完成本地接口环境搭建: +- **本地接口环境搭建**: + - 首先,获取基于 `Java` 和 `SpringBoot` 开发的后端 [youlai-boot](https://gitee.com/youlaiorg/youlai-boot.git) 源码。 + - 其次,根据后端工程的说明文档 [README.md](https://gitee.com/youlaiorg/youlai-boot#%E9%A1%B9%E7%9B%AE%E8%BF%90%E8%A1%8C) 完成本地启动。 + - 最后,修改 `vite.config.ts` 文件中的 `server.proxy` 配置项,将 target 的值从 `http://vapi.youlai.tech` 更改为 `http://localhost:8989`。 - > 1. 获取基于 `Java 、SpringBoot` 开发的后端 [youlai-boot](https://gitee.com/youlaiorg/youlai-boot.git) 源码 ; - > 2. 根据后端工程说明文档 [README.md](https://gitee.com/youlaiorg/youlai-boot#%E9%A1%B9%E7%9B%AE%E8%BF%90%E8%A1%8C) 完成本地启动; - > 3. 替换 [.env.development](.env.development) 的代理目标地址 `VITE_APP_API_URL` 的值 `vapi.youlai.tech` 为本地的 `localhost:8989` -- Gitee From d3157ca7bce029088ba24ce46c6da6116919b103 Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Thu, 11 Jan 2024 08:22:00 +0800 Subject: [PATCH 014/258] =?UTF-8?q?docs:=20:memo:=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=8D=87=E7=BA=A7=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0559d8c..b71e9517 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,40 @@ +# 2.8.1 (2023/01/10) + +### ✨ feat +- 替换 Mock 解决方案 vite-plugin-mock 为 vite-plugin-mock-dev-server 适配 Vite5 + +# 2.8.0 (2023/12/27) + +### ⬆️ chore +- 升级 Vite4 至 Vite5 + +# 2.7.1 (2023/12/12) + +### 🔄 refactor +- 将打包后的文件进行分类 (author by [ityangzhiwen](https://gitee.com/ityangzhiwen)) + +# 2.7.0 (2023/11/19) + +### 🔄 refactor +- 代码重构优化 +- 修改自动导入组件类型声明文件路径 +- 完善 typescript 类型 + +### 🐛 fix +- 修复管理页面部分弹窗无法打开问题 + + +# 2.7.0 (2023/11/19) + +### 🔄 refactor +- 代码重构 +- 修改自动导入组件类型声明文件路径 +- 完善 typescript 类型 + +### 🐛 fix +- 修复管理页面部分弹窗无法打开问题 + + # 2.6.3 (2023/10/22) ### ✨ feat -- Gitee From 221493e0afd1cdcdac6ce8709aae591e378d1765 Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Thu, 11 Jan 2024 08:22:37 +0800 Subject: [PATCH 015/258] =?UTF-8?q?chore:=20:hammer:=20=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E8=87=B3=E6=9C=80=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 4b542653..d3877d04 100644 --- a/package.json +++ b/package.json @@ -42,13 +42,13 @@ }, "dependencies": { "@element-plus/icons-vue": "^2.3.1", - "@vitejs/plugin-vue": "^4.6.0", + "@vitejs/plugin-vue": "^4.6.2", "@vueuse/core": "^10.7.1", "@wangeditor/editor": "^5.1.23", "@wangeditor/editor-for-vue": "5.1.10", - "axios": "^1.6.3", + "axios": "^1.6.5", "echarts": "^5.4.3", - "element-plus": "^2.4.4", + "element-plus": "^2.5.0", "lodash-es": "^4.17.21", "net": "^1.0.2", "nprogress": "^0.2.0", @@ -60,7 +60,7 @@ "sortablejs": "^1.15.1", "stompjs": "^2.3.3", "terser": "^5.26.0", - "vue": "^3.3.13", + "vue": "^3.4.8", "vue-i18n": "9.2.2", "vue-router": "^4.2.5", "xlsx": "^0.18.5" @@ -85,15 +85,15 @@ "eslint-config-prettier": "^8.10.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-prettier": "^4.2.1", - "eslint-plugin-vue": "^9.19.2", + "eslint-plugin-vue": "^9.20.0", "fast-glob": "^3.3.2", "husky": "^8.0.3", "lint-staged": "^13.3.0", - "postcss": "^8.4.32", + "postcss": "^8.4.33", "postcss-html": "^1.5.0", "postcss-scss": "^4.0.9", "prettier": "^2.8.8", - "sass": "^1.69.5", + "sass": "^1.69.7", "stylelint": "^15.11.0", "stylelint-config-html": "^1.1.0", "stylelint-config-recess-order": "^4.4.0", @@ -102,12 +102,12 @@ "stylelint-config-standard": "^34.0.0", "stylelint-config-standard-scss": "^11.1.0", "typescript": "^5.3.3", - "unocss": "^0.58.1", + "unocss": "^0.58.3", "unplugin-auto-import": "^0.15.3", "unplugin-icons": "^0.16.6", "unplugin-vue-components": "^0.24.1", - "vite": "^5.0.10", - "vite-plugin-mock-dev-server": "^1.4.3", + "vite": "^5.0.11", + "vite-plugin-mock-dev-server": "^1.4.5", "vite-plugin-svg-icons": "^2.0.1", "vue-tsc": "^1.8.27" }, -- Gitee From e5b7578b52d9d5c0a8ced24ecf174f2bb8ff7e70 Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Thu, 11 Jan 2024 08:24:03 +0800 Subject: [PATCH 016/258] =?UTF-8?q?chore:=20:hammer:=20=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7=E8=87=B32.8.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 1e824bfa..415819c6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,10 +10,10 @@ "strings": true }, "editor.codeActionsOnSave": { - "source.fixAll": true, - "source.fixAll.eslint": true, - "source.fixAll.stylelint": true - }, + "source.fixAll": "explicit", + "source.fixAll.eslint": "explicit", + "source.fixAll.stylelint": "explicit" + }, "files.eol": "\n", "search.exclude": { "**/node_modules": true, -- Gitee From 403418f62a3cf86ff3086fa0d6a27de64de878e3 Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Thu, 11 Jan 2024 08:29:02 +0800 Subject: [PATCH 017/258] =?UTF-8?q?docs:=20:memo:=20=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E8=AF=B4=E6=98=8E=E6=96=87=E6=A1=A3=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d233463e..b4641f76 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ ## 项目介绍 -[vue3-element-admin](https://gitee.com/youlaiorg/vue3-element-admin) 是基于 Vue3 + Vite4+ TypeScript5 + Element-Plus + Pinia 等最新主流技术栈构建的后台管理前端模板(配套后端源码)。 +[vue3-element-admin](https://gitee.com/youlaiorg/vue3-element-admin) 是基于 Vue3 + Vite5+ TypeScript5 + Element-Plus + Pinia 等最新主流技术栈构建的后台管理前端模板(配套[后端源码(]https://gitee.com/youlaiorg/youlai-boot))。 项目有以下特性: @@ -80,7 +80,7 @@ pnpm run dev ## 开启Mock -默认使用线上接口,要使用 Mock 接口,只需在 vite.config.ts 文件的 plugins 配置中取消对 mockDevServerPlugin() 的注释**即可**。 +项目同时支持在线和 Mock 接口,默认使用线上接口,如需替换为 Mock 接口,只需在 `vite.config.ts` 文件的 `plugins` 配置中取消对 `mockDevServerPlugin()` 的注释**即可**。 ## 项目部署 -- Gitee From be7806653b8bb6d5d5ce08a6b16a85b5ff96f7e1 Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Thu, 11 Jan 2024 08:30:25 +0800 Subject: [PATCH 018/258] =?UTF-8?q?docs:=20:memo:=20=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E8=AF=B4=E6=98=8E=E6=96=87=E6=A1=A3=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b4641f76..be4623a0 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ ## 项目介绍 -[vue3-element-admin](https://gitee.com/youlaiorg/vue3-element-admin) 是基于 Vue3 + Vite5+ TypeScript5 + Element-Plus + Pinia 等最新主流技术栈构建的后台管理前端模板(配套[后端源码(]https://gitee.com/youlaiorg/youlai-boot))。 +[vue3-element-admin](https://gitee.com/youlaiorg/vue3-element-admin) 是基于 Vue3 + Vite5+ TypeScript5 + Element-Plus + Pinia 等最新主流技术栈构建的后台管理前端模板(配套[后端源码](https://gitee.com/youlaiorg/youlai-boot))。 项目有以下特性: -- Gitee From 9d0840b8fc7b683637ea0846835665ba4a110c07 Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Thu, 11 Jan 2024 22:57:43 +0800 Subject: [PATCH 019/258] =?UTF-8?q?chore:=20:hammer:=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/settings.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/settings.ts b/src/settings.ts index 736ef222..710581da 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -1,6 +1,6 @@ const defaultSettings: AppSettings = { title: "vue3-element-admin", - version: "v2.8.0", + version: "v2.8.1", showSettings: true, tagsView: true, fixedHeader: false, -- Gitee From a71f66a4e4ea76118d88be52178c0103c36205bc Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Fri, 12 Jan 2024 00:14:35 +0800 Subject: [PATCH 020/258] =?UTF-8?q?fix:=20:bug:=20=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E6=97=A0=E6=B3=95=E8=B7=B3=E8=BD=AC=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/components/TagsView/index.vue | 27 ++++++++---------------- src/router/index.ts | 1 - 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index f58f7d34..ccb62d7a 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -4,20 +4,20 @@ {{ translateRouteTitle(tag.title) }} - - + + + @@ -411,15 +411,6 @@ onMounted(() => { border-radius: 50%; } } - - &-close { - border-radius: 100%; - - &:hover { - color: #fff; - background: rgb(0 0 0 / 16%); - } - } } } diff --git a/src/router/index.ts b/src/router/index.ts index 17a249a8..009777e9 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -24,7 +24,6 @@ export const constantRoutes: RouteRecordRaw[] = [ { path: "/", - name: "/", component: Layout, redirect: "/dashboard", children: [ -- Gitee From 0e71a2c4a30b27d09b1978b30a0ee4b9f6d7a9a0 Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Fri, 12 Jan 2024 00:16:13 +0800 Subject: [PATCH 021/258] =?UTF-8?q?fix:=20:bug:=20tagview=20=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/components/TagsView/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index ccb62d7a..e85b9bff 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -12,7 +12,7 @@ > {{ translateRouteTitle(tag.title) }} - + Date: Fri, 12 Jan 2024 07:59:55 +0800 Subject: [PATCH 022/258] =?UTF-8?q?fix:=20:bug:=20=E6=B7=B7=E5=90=88?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E8=B7=B3=E8=BD=AC=E9=A6=96=E9=A1=B5=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/components/TagsView/index.vue | 12 +++++------- src/router/index.ts | 1 + 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index e85b9bff..093b6da2 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -12,13 +12,11 @@ > {{ translateRouteTitle(tag.title) }} - - - + diff --git a/src/router/index.ts b/src/router/index.ts index 009777e9..17a249a8 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -24,6 +24,7 @@ export const constantRoutes: RouteRecordRaw[] = [ { path: "/", + name: "/", component: Layout, redirect: "/dashboard", children: [ -- Gitee From a25e4dc602023a4d276d3dc4960054d36cfbc4cf Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Fri, 12 Jan 2024 08:05:28 +0800 Subject: [PATCH 023/258] =?UTF-8?q?chore:=20:hammer:=20=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=89=88=E6=9C=AC=E5=8F=B7=202.8.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/settings.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d3877d04..3edafdab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue3-element-admin", - "version": "2.8.0", + "version": "2.8.2", "private": true, "type": "module", "scripts": { diff --git a/src/settings.ts b/src/settings.ts index 710581da..27cc2078 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -1,6 +1,6 @@ const defaultSettings: AppSettings = { title: "vue3-element-admin", - version: "v2.8.1", + version: "v2.8.2", showSettings: true, tagsView: true, fixedHeader: false, -- Gitee From b8328beaf35f764a288346d17f05616a7b78cd34 Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Fri, 12 Jan 2024 08:06:21 +0800 Subject: [PATCH 024/258] =?UTF-8?q?chore:=20:hammer:=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=20copyright=20=E7=9A=84=E5=B9=B4=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/login/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/login/index.vue b/src/views/login/index.vue index dadf82c3..fcc1f554 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -120,7 +120,7 @@ v-show="useAppStore().device == 'desktop'" >

- Copyright © 2021 - 2023 youlai.tech All Rights Reserved. 有来技术 + Copyright © 2021 - 2024 youlai.tech All Rights Reserved. 有来技术 版权所有

皖ICP备20006496号-3

-- Gitee From 90c25c57b1cae7a63c552fc2aa80d53ab8ff372c Mon Sep 17 00:00:00 2001 From: skyselang <215817969@qq.com> Date: Tue, 16 Jan 2024 09:08:27 +0800 Subject: [PATCH 025/258] =?UTF-8?q?fix:=20=F0=9F=90=9B=20=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E9=85=8D=E7=BD=AE=E9=A1=B5=E9=9D=A2=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=AF=BC=E8=87=B4=E6=9A=97=E9=BB=91=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E5=A4=B1=E6=95=88=E9=97=AE=E9=A2=98=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/settings.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/store/modules/settings.ts b/src/store/modules/settings.ts index 5db3d7fc..3c037587 100644 --- a/src/store/modules/settings.ts +++ b/src/store/modules/settings.ts @@ -38,10 +38,12 @@ export const useSettingsStore = defineStore("setting", () => { const setting = settingsMap[key]; if (setting !== undefined) { setting.value = value; - if (key === "theme" && value === "dark") { - document.documentElement.classList.add("dark"); - } else { - document.documentElement.classList.remove("dark"); + if (key === "theme") { + if (value === "dark") { + document.documentElement.classList.add("dark"); + } else { + document.documentElement.classList.remove("dark"); + } } } } -- Gitee From 6230caae8cc388f4f024423d791992ba89b81e97 Mon Sep 17 00:00:00 2001 From: skyselang <215817969@qq.com> Date: Tue, 16 Jan 2024 11:56:51 +0800 Subject: [PATCH 026/258] =?UTF-8?q?fix:=20=F0=9F=90=9B=20=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E9=A1=B5=E9=AA=8C=E8=AF=81=E7=A0=81=E4=B8=8E=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E6=A1=86=E9=AB=98=E5=BA=A6=E4=B8=8D=E4=B8=80=E8=87=B4?= =?UTF-8?q?(=E5=88=87=E6=8D=A2=E5=B8=83=E5=B1=80=E5=A4=A7=E5=B0=8F)?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/login/index.vue | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/views/login/index.vue b/src/views/login/index.vue index fcc1f554..7561775b 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -87,6 +87,7 @@ -@/api/call-center/route/index@/api/call-center/route/types diff --git a/src/views/call-center/route/index.vue b/src/views/call-center/route/index.vue index c797d0cc..b35f67d9 100644 --- a/src/views/call-center/route/index.vue +++ b/src/views/call-center/route/index.vue @@ -486,4 +486,3 @@ onMounted(() => { -@/api/call-center/route/index@/api/call-center/route/types diff --git a/src/views/case/main/index.vue b/src/views/case/main/index.vue new file mode 100644 index 00000000..504be2d6 --- /dev/null +++ b/src/views/case/main/index.vue @@ -0,0 +1,377 @@ + + + -- Gitee From 58cf80b33fb6ecc87af07312c36dea2e76e1de6c Mon Sep 17 00:00:00 2001 From: starphin <18819135347@163.com> Date: Sun, 3 Mar 2024 15:22:21 +0800 Subject: [PATCH 054/258] =?UTF-8?q?feat:=20=E7=AD=9B=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E5=85=B3=E8=81=94=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/case/misc/index.ts | 42 ++++++++++++++-- src/views/case/main/index.vue | 91 +++++++++++++++++++++++++---------- 2 files changed, 103 insertions(+), 30 deletions(-) diff --git a/src/api/case/misc/index.ts b/src/api/case/misc/index.ts index 27413b2a..05657f55 100644 --- a/src/api/case/misc/index.ts +++ b/src/api/case/misc/index.ts @@ -1,30 +1,50 @@ import request from "@/utils/request"; import { AxiosPromise } from "axios"; import { ClientVO, SueTplVO, CaseStateVO, CourtVO, LawyerVO } from "./types"; +import { CasePageQuery } from "../main/types"; +import qs from "qs"; const root_path = "/api/v1/case/misc/"; /** * 获取案源方 * */ -export function listClients(): AxiosPromise { +export function listClients( + pageQuery?: CasePageQuery +): AxiosPromise { return request({ url: root_path + "listClients", method: "get", + params: pageQuery, + paramsSerializer: function (params) { + return qs.stringify(params, { arrayFormat: "repeat" }); + }, }); } -export function listCaseLawyers(): AxiosPromise { +export function listCaseLawyers( + pageQuery?: CasePageQuery +): AxiosPromise { return request({ url: root_path + "listCaseLawyers", method: "get", + params: pageQuery, + paramsSerializer: function (params) { + return qs.stringify(params, { arrayFormat: "repeat" }); + }, }); } -export function listCaseCourts(): AxiosPromise { +export function listCaseCourts( + pageQuery?: CasePageQuery +): AxiosPromise { return request({ url: root_path + "listCaseCourts", method: "get", + params: pageQuery, + paramsSerializer: function (params) { + return qs.stringify(params, { arrayFormat: "repeat" }); + }, }); } @@ -32,10 +52,16 @@ export function listCaseCourts(): AxiosPromise { * 获取所有案件状态 * */ -export function listCaseStates(): AxiosPromise { +export function listCaseStates( + pageQuery?: CasePageQuery +): AxiosPromise { return request({ url: root_path + "listCaseStates", method: "get", + params: pageQuery, + paramsSerializer: function (params) { + return qs.stringify(params, { arrayFormat: "repeat" }); + }, }); } @@ -43,9 +69,15 @@ export function listCaseStates(): AxiosPromise { * 获取所有模板 * */ -export function listSueTpls(): AxiosPromise { +export function listSueTpls( + pageQuery?: CasePageQuery +): AxiosPromise { return request({ url: root_path + "listSueTpls", method: "get", + params: pageQuery, + paramsSerializer: function (params) { + return qs.stringify(params, { arrayFormat: "repeat" }); + }, }); } diff --git a/src/views/case/main/index.vue b/src/views/case/main/index.vue index 504be2d6..42fd60ee 100644 --- a/src/views/case/main/index.vue +++ b/src/views/case/main/index.vue @@ -21,6 +21,8 @@ import { LawyerVO, CourtVO, } from "@/api/case/misc/types"; + +import { toRefs } from "vue"; import { TableColumnCtx } from "element-plus"; defineOptions({ @@ -96,6 +98,38 @@ const courtList = ref(); const caseStateList = ref(); const sueTplList = ref(); +function updateStatistics() { + let copiedQueryParams = JSON.parse(JSON.stringify(queryParams)); + copiedQueryParams.clientId = undefined; + listClients(copiedQueryParams).then(({ data }) => { + clientList.value = data; + }); + + copiedQueryParams = JSON.parse(JSON.stringify(queryParams)); + copiedQueryParams.lawyerId = undefined; + listCaseLawyers(copiedQueryParams).then(({ data }) => { + lawyerList.value = data; + }); + + copiedQueryParams = JSON.parse(JSON.stringify(queryParams)); + copiedQueryParams.courtIds = undefined; + listCaseCourts(copiedQueryParams).then(({ data }) => { + courtList.value = data; + }); + + copiedQueryParams = JSON.parse(JSON.stringify(queryParams)); + copiedQueryParams.stateId = undefined; + listCaseStates(copiedQueryParams).then(({ data }) => { + caseStateList.value = data; + }); + + copiedQueryParams = JSON.parse(JSON.stringify(queryParams)); + copiedQueryParams.sueTplId = undefined; + listSueTpls(copiedQueryParams).then(({ data }) => { + sueTplList.value = data; + }); +} + /** 查询 */ function handleQuery(resetPage = false) { loading.value = true; @@ -111,6 +145,8 @@ function handleQuery(resetPage = false) { } loading.value = false; }); + + updateStatistics(); } /** 重置查询 */ @@ -123,23 +159,18 @@ function resetQuery() { handleQuery(); } -onMounted(() => { - listClients().then(({ data }) => { - clientList.value = data; - }); - listCaseLawyers().then(({ data }) => { - lawyerList.value = data; - }); - listCaseCourts().then(({ data }) => { - courtList.value = data; - }); - listCaseStates().then(({ data }) => { - caseStateList.value = data; - }); - listSueTpls().then(({ data }) => { - sueTplList.value = data; - }); +const eventTypeNameMap: Record = { + [1]: "主动联系法院", + [2]: "法院回联", + [3]: "法院短信通知", + [4]: "律师平台反馈", + [5]: "执行操作", + [6]: "系统录入", + [7]: "其他", + [8]: "广东诉讼服务网反馈", +}; +onMounted(() => { handleQuery(); }); @@ -163,6 +194,7 @@ onMounted(() => { placeholder="全部" filterable clearable + collapse-tags class="!w-[200px]" > { filterable clearable placeholder="全部" - class="!w-[200px]" + class="!w-[300px]" > { min-width="100" fixed="left" /> - -