From 81595f81dbb0a10677e25c2d04958d63f768bd6a Mon Sep 17 00:00:00 2001 From: xingyu Date: Fri, 13 Jan 2023 20:18:19 +0800 Subject: [PATCH 1/8] chore: update deps --- yudao-ui-admin-vue3/package.json | 14 ++-- yudao-ui-admin-vue3/pnpm-lock.yaml | 104 ++++++++++++++--------------- 2 files changed, 58 insertions(+), 60 deletions(-) diff --git a/yudao-ui-admin-vue3/package.json b/yudao-ui-admin-vue3/package.json index 20f02859f..9d6ed136b 100644 --- a/yudao-ui-admin-vue3/package.json +++ b/yudao-ui-admin-vue3/package.json @@ -1,6 +1,6 @@ { "name": "yudao-ui-admin-vue3", - "version": "1.6.6-snapshot.1911", + "version": "1.6.6-snapshot.1912", "description": "基于vue3、vite4、element-plus、typesScript", "author": "xingyu", "private": false, @@ -55,9 +55,9 @@ "xe-utils": "^3.5.7" }, "devDependencies": { - "@commitlint/cli": "^17.4.1", - "@commitlint/config-conventional": "^17.4.0", - "@iconify/json": "^2.2.5", + "@commitlint/cli": "^17.4.2", + "@commitlint/config-conventional": "^17.4.2", + "@iconify/json": "^2.2.6", "@intlify/unplugin-vue-i18n": "^0.8.1", "@purge-icons/generated": "^0.9.0", "@types/intro.js": "^5.1.0", @@ -77,14 +77,14 @@ "eslint-config-prettier": "^8.6.0", "eslint-define-config": "^1.14.0", "eslint-plugin-prettier": "^4.2.1", - "eslint-plugin-vue": "^9.8.0", + "eslint-plugin-vue": "^9.9.0", "lint-staged": "^13.1.0", "postcss": "^8.4.21", "postcss-html": "^1.5.0", "postcss-scss": "^4.0.6", "prettier": "^2.8.2", - "rimraf": "^3.0.2", - "rollup": "^3.9.1", + "rimraf": "^4.0.4", + "rollup": "^3.10.0", "sass": "^1.57.1", "stylelint": "^14.16.1", "stylelint-config-html": "^1.1.0", diff --git a/yudao-ui-admin-vue3/pnpm-lock.yaml b/yudao-ui-admin-vue3/pnpm-lock.yaml index af51c2bc8..4bf227df5 100644 --- a/yudao-ui-admin-vue3/pnpm-lock.yaml +++ b/yudao-ui-admin-vue3/pnpm-lock.yaml @@ -1,10 +1,10 @@ lockfileVersion: 5.4 specifiers: - '@commitlint/cli': ^17.4.1 - '@commitlint/config-conventional': ^17.4.0 + '@commitlint/cli': ^17.4.2 + '@commitlint/config-conventional': ^17.4.2 '@iconify/iconify': ^3.0.1 - '@iconify/json': ^2.2.5 + '@iconify/json': ^2.2.6 '@intlify/unplugin-vue-i18n': ^0.8.1 '@purge-icons/generated': ^0.9.0 '@types/intro.js': ^5.1.0 @@ -36,7 +36,7 @@ specifiers: eslint-config-prettier: ^8.6.0 eslint-define-config: ^1.14.0 eslint-plugin-prettier: ^4.2.1 - eslint-plugin-vue: ^9.8.0 + eslint-plugin-vue: ^9.9.0 intro.js: ^6.0.0 jsencrypt: ^3.3.1 lint-staged: ^13.1.0 @@ -50,8 +50,8 @@ specifiers: prettier: ^2.8.2 qrcode: ^1.5.1 qs: ^6.11.0 - rimraf: ^3.0.2 - rollup: ^3.9.1 + rimraf: ^4.0.4 + rollup: ^3.10.0 sass: ^1.57.1 stylelint: ^14.16.1 stylelint-config-html: ^1.1.0 @@ -114,9 +114,9 @@ dependencies: xe-utils: 3.5.7 devDependencies: - '@commitlint/cli': 17.4.1 - '@commitlint/config-conventional': 17.4.0 - '@iconify/json': 2.2.5 + '@commitlint/cli': 17.4.2 + '@commitlint/config-conventional': 17.4.2 + '@iconify/json': 2.2.6 '@intlify/unplugin-vue-i18n': 0.8.1_vue-i18n@9.2.2 '@purge-icons/generated': 0.9.0 '@types/intro.js': 5.1.0 @@ -136,14 +136,14 @@ devDependencies: eslint-config-prettier: 8.6.0_eslint@8.31.0 eslint-define-config: 1.14.0 eslint-plugin-prettier: 4.2.1_iu5s7nk6dw7o3tajefwfiqfmge - eslint-plugin-vue: 9.8.0_eslint@8.31.0 + eslint-plugin-vue: 9.9.0_eslint@8.31.0 lint-staged: 13.1.0 postcss: 8.4.21 postcss-html: 1.5.0 postcss-scss: 4.0.6_postcss@8.4.21 prettier: 2.8.2 - rimraf: 3.0.2 - rollup: 3.9.1 + rimraf: 4.0.4 + rollup: 3.10.0 sass: 1.57.1 stylelint: 14.16.1 stylelint-config-html: 1.1.0_kbto3rg3njmczth2rrsgfnlsqa @@ -506,15 +506,15 @@ packages: '@babel/helper-validator-identifier': 7.19.1 to-fast-properties: 2.0.0 - /@commitlint/cli/17.4.1: - resolution: {integrity: sha512-W8OJwz+izY+fVwyUt1HveCDmABMZNRVZHSVPw/Bh9Y62tp11SmmQaycgbsYLMiMy7JGn4mAJqEGlSHS9Uti9ZQ==} + /@commitlint/cli/17.4.2: + resolution: {integrity: sha512-0rPGJ2O1owhpxMIXL9YJ2CgPkdrFLKZElIZHXDN8L8+qWK1DGH7Q7IelBT1pchXTYTuDlqkOTdh//aTvT3bSUA==} engines: {node: '>=v14'} hasBin: true dependencies: '@commitlint/format': 17.4.0 - '@commitlint/lint': 17.4.0 - '@commitlint/load': 17.4.1 - '@commitlint/read': 17.4.0 + '@commitlint/lint': 17.4.2 + '@commitlint/load': 17.4.2 + '@commitlint/read': 17.4.2 '@commitlint/types': 17.4.0 execa: 5.1.1 lodash.isfunction: 3.0.9 @@ -526,8 +526,8 @@ packages: - '@swc/wasm' dev: true - /@commitlint/config-conventional/17.4.0: - resolution: {integrity: sha512-G4XBf45J4ZMspO4NwBFzY3g/1Kb+B42BcIxeikF8wucQxcyxcmhRdjeQpRpS1XEcBq5pdtEEQFipuB9IuiNFhw==} + /@commitlint/config-conventional/17.4.2: + resolution: {integrity: sha512-JVo1moSj5eDMoql159q8zKCU8lkOhQ+b23Vl3LVVrS6PXDLQIELnJ34ChQmFVbBdSSRNAbbXnRDhosFU+wnuHw==} engines: {node: '>=v14'} dependencies: conventional-changelog-conventionalcommits: 5.0.0 @@ -566,26 +566,26 @@ packages: chalk: 4.1.2 dev: true - /@commitlint/is-ignored/17.4.0: - resolution: {integrity: sha512-mkRuBlPUaBimvSvJyIHEHEW1/jP1SqEI7NOoaO9/eyJkMbsaiv5b1QgDYL4ZXlHdS64RMV7Y21MVVzuIceImDA==} + /@commitlint/is-ignored/17.4.2: + resolution: {integrity: sha512-1b2Y2qJ6n7bHG9K6h8S4lBGUl6kc7mMhJN9gy1SQfUZqe92ToDjUTtgNWb6LbzR1X8Cq4SEus4VU8Z/riEa94Q==} engines: {node: '>=v14'} dependencies: '@commitlint/types': 17.4.0 semver: 7.3.8 dev: true - /@commitlint/lint/17.4.0: - resolution: {integrity: sha512-HG2YT4TUbQKs9v8QvpQjJ6OK+fhflsDB8M+D5tLrY79hbQOWA9mDKdRkABsW/AAhpNI9+zeGUWF3jj245jSHKw==} + /@commitlint/lint/17.4.2: + resolution: {integrity: sha512-HcymabrdBhsDMNzIv146+ZPNBPBK5gMNsVH+el2lCagnYgCi/4ixrHooeVyS64Fgce2K26+MC7OQ4vVH8wQWVw==} engines: {node: '>=v14'} dependencies: - '@commitlint/is-ignored': 17.4.0 - '@commitlint/parse': 17.4.0 - '@commitlint/rules': 17.4.0 + '@commitlint/is-ignored': 17.4.2 + '@commitlint/parse': 17.4.2 + '@commitlint/rules': 17.4.2 '@commitlint/types': 17.4.0 dev: true - /@commitlint/load/17.4.1: - resolution: {integrity: sha512-6A7/LhIaQpL4ieciIDcVvK2d5z/UI1GBrtDaHm6sQSCL0265clB2/F7XKQNTJHXv9yG4LByT2r+QCpM4GugIfw==} + /@commitlint/load/17.4.2: + resolution: {integrity: sha512-Si++F85rJ9t4hw6JcOw1i2h0fdpdFQt0YKwjuK4bk9KhFjyFkRxvR3SB2dPaMs+EwWlDrDBGL+ygip1QD6gmPw==} engines: {node: '>=v14'} dependencies: '@commitlint/config-validator': 17.4.0 @@ -607,13 +607,13 @@ packages: - '@swc/wasm' dev: true - /@commitlint/message/17.4.0: - resolution: {integrity: sha512-USGJDU9PPxcgQjKXCzvPUal65KAhxWq3hp+MrU1pNCN2itWM654CLIoY2LMIQ7rScTli9B5dTLH3vXhzbItmzA==} + /@commitlint/message/17.4.2: + resolution: {integrity: sha512-3XMNbzB+3bhKA1hSAWPCQA3lNxR4zaeQAQcHj0Hx5sVdO6ryXtgUBGGv+1ZCLMgAPRixuc6en+iNAzZ4NzAa8Q==} engines: {node: '>=v14'} dev: true - /@commitlint/parse/17.4.0: - resolution: {integrity: sha512-x8opKc5p+Hgs+CrMbq3VAnW2L2foPAX6arW8u9c8nTzksldGgFsENT+XVyPmpSMLlVBswZ1tndcz1xyKiY9TJA==} + /@commitlint/parse/17.4.2: + resolution: {integrity: sha512-DK4EwqhxfXpyCA+UH8TBRIAXAfmmX4q9QRBz/2h9F9sI91yt6mltTrL6TKURMcjUVmgaB80wgS9QybNIyVBIJA==} engines: {node: '>=v14'} dependencies: '@commitlint/types': 17.4.0 @@ -621,8 +621,8 @@ packages: conventional-commits-parser: 3.2.4 dev: true - /@commitlint/read/17.4.0: - resolution: {integrity: sha512-pGDeZpbkyvhxK8ZoCDUacPPRpauKPWF3n2XpDBEnuGreqUF2clq2PVJpwMMaNN5cHW8iFKCbcoOjXhD01sln0A==} + /@commitlint/read/17.4.2: + resolution: {integrity: sha512-hasYOdbhEg+W4hi0InmXHxtD/1favB4WdwyFxs1eOy/DvMw6+2IZBmATgGOlqhahsypk4kChhxjAFJAZ2F+JBg==} engines: {node: '>=v14'} dependencies: '@commitlint/top-level': 17.4.0 @@ -644,12 +644,12 @@ packages: resolve-global: 1.0.0 dev: true - /@commitlint/rules/17.4.0: - resolution: {integrity: sha512-lz3i1jet2NNjTWpAMwjjQjMZCPWBIHK1Kkja9o09UmUtMjRdALTb8uMLe8gCyeq3DiiZ5lLYOhbsoPK56xGQKA==} + /@commitlint/rules/17.4.2: + resolution: {integrity: sha512-OGrPsMb9Fx3/bZ64/EzJehY9YDSGWzp81Pj+zJiY+r/NSgJI3nUYdlS37jykNIugzazdEXfMtQ10kmA+Kx2pZQ==} engines: {node: '>=v14'} dependencies: '@commitlint/ensure': 17.4.0 - '@commitlint/message': 17.4.0 + '@commitlint/message': 17.4.2 '@commitlint/to-lines': 17.4.0 '@commitlint/types': 17.4.0 execa: 5.1.1 @@ -963,8 +963,8 @@ packages: dependencies: '@iconify/types': 2.0.0 - /@iconify/json/2.2.5: - resolution: {integrity: sha512-AIbJTRF9HJz7FJ8t7058huwDXHaFEY4a4f6uuPtctEQ8/I3ybrX66iZMgoLD1kLaamU4tzZPlZ6tSpA3pM8LZg==} + /@iconify/json/2.2.6: + resolution: {integrity: sha512-fRP5PwXvX0PAGne1/xHvd6zVYiHq9dQzdvhhxamwJuNjoIVRWNNP5y465NkxybzEX94kn2JnoULkA9kbZkXoqA==} dependencies: '@iconify/types': 2.0.0 pathe: 1.0.0 @@ -3029,8 +3029,8 @@ packages: prettier-linter-helpers: 1.0.0 dev: true - /eslint-plugin-vue/9.8.0_eslint@8.31.0: - resolution: {integrity: sha512-E/AXwcTzunyzM83C2QqDHxepMzvI2y6x+mmeYHbVDQlKFqmKYvRrhaVixEeeG27uI44p9oKDFiyCRw4XxgtfHA==} + /eslint-plugin-vue/9.9.0_eslint@8.31.0: + resolution: {integrity: sha512-YbubS7eK0J7DCf0U2LxvVP7LMfs6rC6UltihIgval3azO3gyDwEGVgsCMe1TmDiEkl6GdMKfRpaME6QxIYtzDQ==} engines: {node: ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.2.0 || ^7.0.0 || ^8.0.0 @@ -3039,7 +3039,7 @@ packages: eslint-utils: 3.0.0_eslint@8.31.0 natural-compare: 1.4.0 nth-check: 2.1.1 - postcss-selector-parser: 6.0.10 + postcss-selector-parser: 6.0.11 semver: 7.3.8 vue-eslint-parser: 9.1.0_eslint@8.31.0 xml-name-validator: 4.0.0 @@ -4880,14 +4880,6 @@ packages: postcss: 8.4.21 dev: true - /postcss-selector-parser/6.0.10: - resolution: {integrity: sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==} - engines: {node: '>=4'} - dependencies: - cssesc: 3.0.0 - util-deprecate: 1.0.2 - dev: true - /postcss-selector-parser/6.0.11: resolution: {integrity: sha512-zbARubNdogI9j7WY4nQJBiNqQf3sLS3wCP4WfOidu+p28LofJqDH1tcXypGrcmMHhDk2t9wGhCsYe/+szLTy1g==} engines: {node: '>=4'} @@ -5200,6 +5192,12 @@ packages: glob: 7.2.3 dev: true + /rimraf/4.0.4: + resolution: {integrity: sha512-R0hoVr9xTwemarQjoWlNt/nb5dEGVTBhVdkRmEX2zEkT8T6onH0XKiGjuaC7rNNj/gYzY2p4NVRJ3sjO1ascHQ==} + engines: {node: '>=14'} + hasBin: true + dev: true + /rollup-plugin-purge-icons/0.9.1: resolution: {integrity: sha512-hRDKBsPUz47UMdBufki2feTmBF2ClEJlYqL7N6vpVAHSLd7V2BJUaNKOF7YYbLMofVVF+9hm44YSkYO6k9hUgg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/rollup-plugin-purge-icons/-/rollup-plugin-purge-icons-0.9.1.tgz} engines: {node: '>= 12'} @@ -5219,8 +5217,8 @@ packages: fsevents: 2.3.2 dev: true - /rollup/3.9.1: - resolution: {integrity: sha512-GswCYHXftN8ZKGVgQhTFUJB/NBXxrRGgO2NCy6E8s1rwEJ4Q9/VttNqcYfEvx4dTo4j58YqdC3OVztPzlKSX8w==} + /rollup/3.10.0: + resolution: {integrity: sha512-JmRYz44NjC1MjVF2VKxc0M1a97vn+cDxeqWmnwyAF4FvpjK8YFdHpaqvQB+3IxCvX05vJxKZkoMDU8TShhmJVA==} engines: {node: '>=14.18.0', npm: '>=8.0.0'} hasBin: true optionalDependencies: @@ -6207,7 +6205,7 @@ packages: esbuild: 0.16.5 postcss: 8.4.21 resolve: 1.22.1 - rollup: 3.9.1 + rollup: 3.10.0 sass: 1.57.1 terser: 5.16.1 optionalDependencies: From 3a8cd9afe96ca0ea7697c0844a13b08d69d4cdf4 Mon Sep 17 00:00:00 2001 From: xingyu Date: Fri, 13 Jan 2023 20:18:46 +0800 Subject: [PATCH 2/8] refactor: router --- yudao-ui-admin-vue3/src/main.ts | 2 + yudao-ui-admin-vue3/src/permission.ts | 70 ++++++++++++++++++ yudao-ui-admin-vue3/src/router/index.ts | 71 ------------------- yudao-ui-admin-vue3/src/store/modules/user.ts | 7 +- 4 files changed, 78 insertions(+), 72 deletions(-) create mode 100644 yudao-ui-admin-vue3/src/permission.ts diff --git a/yudao-ui-admin-vue3/src/main.ts b/yudao-ui-admin-vue3/src/main.ts index e7c935a28..e4511d9b1 100644 --- a/yudao-ui-admin-vue3/src/main.ts +++ b/yudao-ui-admin-vue3/src/main.ts @@ -35,6 +35,8 @@ import { createApp } from 'vue' import App from './App.vue' +import './permission' + // 创建实例 const setupAll = async () => { const app = createApp(App) diff --git a/yudao-ui-admin-vue3/src/permission.ts b/yudao-ui-admin-vue3/src/permission.ts new file mode 100644 index 000000000..bcba0119d --- /dev/null +++ b/yudao-ui-admin-vue3/src/permission.ts @@ -0,0 +1,70 @@ +import router from './router' +import type { RouteRecordRaw } from 'vue-router' +import { isRelogin } from '@/config/axios/service' +import { getAccessToken } from '@/utils/auth' +import { useTitle } from '@/hooks/web/useTitle' +import { useNProgress } from '@/hooks/web/useNProgress' +import { usePageLoading } from '@/hooks/web/usePageLoading' +import { useDictStoreWithOut } from '@/store/modules/dict' +import { useUserStoreWithOut } from '@/store/modules/user' +import { usePermissionStoreWithOut } from '@/store/modules/permission' + +const { start, done } = useNProgress() + +const { loadStart, loadDone } = usePageLoading() +// 路由不重定向白名单 +const whiteList = [ + '/login', + '/social-login', + '/auth-redirect', + '/bind', + '/register', + '/oauthLogin/gitee' +] + +// 路由加载前 +router.beforeEach(async (to, from, next) => { + start() + loadStart() + if (getAccessToken()) { + if (to.path === '/login') { + next({ path: '/' }) + } else { + // 获取所有字典 + const dictStore = useDictStoreWithOut() + const userStore = useUserStoreWithOut() + const permissionStore = usePermissionStoreWithOut() + if (!dictStore.getIsSetDict) { + dictStore.setDictMap() + } + if (!userStore.getIsSetUser) { + isRelogin.show = true + await userStore.setUserInfoAction() + isRelogin.show = false + // 后端过滤菜单 + await permissionStore.generateRoutes() + permissionStore.getAddRouters.forEach((route) => { + router.addRoute(route as unknown as RouteRecordRaw) // 动态添加可访问路由表 + }) + const redirectPath = from.query.redirect || to.path + const redirect = decodeURIComponent(redirectPath as string) + const nextData = to.path === redirect ? { ...to, replace: true } : { path: redirect } + next(nextData) + } else { + next() + } + } + } else { + if (whiteList.indexOf(to.path) !== -1) { + next() + } else { + next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页 + } + } +}) + +router.afterEach((to) => { + useTitle(to?.meta?.title as string) + done() // 结束Progress + loadDone() +}) diff --git a/yudao-ui-admin-vue3/src/router/index.ts b/yudao-ui-admin-vue3/src/router/index.ts index f5fb53dd6..02d913f86 100644 --- a/yudao-ui-admin-vue3/src/router/index.ts +++ b/yudao-ui-admin-vue3/src/router/index.ts @@ -2,19 +2,6 @@ import type { App } from 'vue' import type { RouteRecordRaw } from 'vue-router' import { createRouter, createWebHashHistory } from 'vue-router' import remainingRouter from './modules/remaining' -import { isRelogin } from '@/config/axios/service' -import { getAccessToken } from '@/utils/auth' -import { useTitle } from '@/hooks/web/useTitle' -import { useNProgress } from '@/hooks/web/useNProgress' -import { usePageLoading } from '@/hooks/web/usePageLoading' -import { useDictStoreWithOut } from '@/store/modules/dict' -import { useUserStoreWithOut } from '@/store/modules/user' -import { usePermissionStoreWithOut } from '@/store/modules/permission' -import { getInfoApi } from '@/api/login' - -const { start, done } = useNProgress() - -const { loadStart, loadDone } = usePageLoading() // 创建路由实例 const router = createRouter({ @@ -24,64 +11,6 @@ const router = createRouter({ scrollBehavior: () => ({ left: 0, top: 0 }) }) -// 路由不重定向白名单 -const whiteList = [ - '/login', - '/social-login', - '/auth-redirect', - '/bind', - '/register', - '/oauthLogin/gitee' -] - -// 路由加载前 -router.beforeEach(async (to, from, next) => { - start() - loadStart() - if (getAccessToken()) { - if (to.path === '/login') { - next({ path: '/' }) - } else { - // 获取所有字典 - const dictStore = useDictStoreWithOut() - const userStore = useUserStoreWithOut() - const permissionStore = usePermissionStoreWithOut() - if (!dictStore.getIsSetDict) { - dictStore.setDictMap() - } - if (!userStore.getIsSetUser) { - isRelogin.show = true - const res = await getInfoApi() - await userStore.setUserInfoAction(res) - isRelogin.show = false - // 后端过滤菜单 - await permissionStore.generateRoutes() - permissionStore.getAddRouters.forEach((route) => { - router.addRoute(route as unknown as RouteRecordRaw) // 动态添加可访问路由表 - }) - const redirectPath = from.query.redirect || to.path - const redirect = decodeURIComponent(redirectPath as string) - const nextData = to.path === redirect ? { ...to, replace: true } : { path: redirect } - next(nextData) - } else { - next() - } - } - } else { - if (whiteList.indexOf(to.path) !== -1) { - next() - } else { - next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页 - } - } -}) - -router.afterEach((to) => { - useTitle(to?.meta?.title as string) - done() // 结束Progress - loadDone() -}) - export const resetRouter = (): void => { const resetWhiteNameList = ['Redirect', 'Login', 'NoFind', 'Root'] router.getRoutes().forEach((route) => { diff --git a/yudao-ui-admin-vue3/src/store/modules/user.ts b/yudao-ui-admin-vue3/src/store/modules/user.ts index d4f4df55e..2621e2dff 100644 --- a/yudao-ui-admin-vue3/src/store/modules/user.ts +++ b/yudao-ui-admin-vue3/src/store/modules/user.ts @@ -2,6 +2,7 @@ import { store } from '../index' import { defineStore } from 'pinia' import { getAccessToken, removeToken } from '@/utils/auth' import { CACHE_KEY, useCache } from '@/hooks/web/useCache' +import { getInfoApi } from '@/api/login' const { wsCache } = useCache() @@ -43,11 +44,15 @@ export const useUserStore = defineStore('admin-user', { } }, actions: { - async setUserInfoAction(userInfo: UserInfoVO) { + async setUserInfoAction() { if (!getAccessToken()) { this.resetState() return null } + let userInfo = wsCache.get(CACHE_KEY.USER) + if (!userInfo) { + userInfo = await getInfoApi() + } this.permissions = userInfo.permissions this.roles = userInfo.roles this.user = userInfo.user From fb65423b627c83ec7e882769feb86804b99b0f2a Mon Sep 17 00:00:00 2001 From: xingyu Date: Fri, 13 Jan 2023 20:29:18 +0800 Subject: [PATCH 3/8] =?UTF-8?q?fix:=20=E9=83=A8=E9=97=A8=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=90=8E=20=E6=A0=91=E6=B2=A1=E6=9C=89=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-ui-admin-vue3/src/views/system/dept/index.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/yudao-ui-admin-vue3/src/views/system/dept/index.vue b/yudao-ui-admin-vue3/src/views/system/dept/index.vue index f6bd26d2b..c095982fa 100644 --- a/yudao-ui-admin-vue3/src/views/system/dept/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/dept/index.vue @@ -167,6 +167,7 @@ const submitForm = async () => { dialogVisible.value = false } finally { actionLoading.value = false + await getTree() await reload() } } From 923672600674cb9bd04a200e293f0f9cd84f035d Mon Sep 17 00:00:00 2001 From: xingyu Date: Fri, 13 Jan 2023 22:40:04 +0800 Subject: [PATCH 4/8] fix: vueTypes warn --- yudao-ui-admin-vue3/src/utils/propTypes.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/yudao-ui-admin-vue3/src/utils/propTypes.ts b/yudao-ui-admin-vue3/src/utils/propTypes.ts index 5d685f318..fb8f84e70 100644 --- a/yudao-ui-admin-vue3/src/utils/propTypes.ts +++ b/yudao-ui-admin-vue3/src/utils/propTypes.ts @@ -17,13 +17,12 @@ const propTypes = createTypes({ // 需要自定义扩展的类型 // see: https://dwightjack.github.io/vue-types/advanced/extending-vue-types.html#the-extend-method -propTypes.extend([ - { - name: 'style', - getter: true, - type: [String, Object], - default: undefined - } -]) - +// propTypes.extend([ +// { +// name: 'style', +// getter: true, +// type: [String, Object], +// default: undefined +// } +// ]) export { propTypes } From 258577e86a9ae011989582b8b3c100a435e12455 Mon Sep 17 00:00:00 2001 From: xingyu Date: Fri, 13 Jan 2023 23:31:39 +0800 Subject: [PATCH 5/8] feat: scss --- .../src/components/XTable/src/style/dark.scss | 2 +- .../components/XTable/src/style/index.scss | 4 +- .../components/XTable/src/style/light.scss | 2 +- .../src/plugins/vxeTable/index.scss | 6 -- .../src/plugins/vxeTable/theme/dark.scss | 81 ------------------- .../src/plugins/vxeTable/theme/light.scss | 16 ---- yudao-ui-admin-vue3/src/styles/variables.scss | 2 + 7 files changed, 6 insertions(+), 107 deletions(-) delete mode 100644 yudao-ui-admin-vue3/src/plugins/vxeTable/index.scss delete mode 100644 yudao-ui-admin-vue3/src/plugins/vxeTable/theme/dark.scss delete mode 100644 yudao-ui-admin-vue3/src/plugins/vxeTable/theme/light.scss diff --git a/yudao-ui-admin-vue3/src/components/XTable/src/style/dark.scss b/yudao-ui-admin-vue3/src/components/XTable/src/style/dark.scss index 4e87c4b39..d981b0418 100644 --- a/yudao-ui-admin-vue3/src/components/XTable/src/style/dark.scss +++ b/yudao-ui-admin-vue3/src/components/XTable/src/style/dark.scss @@ -78,4 +78,4 @@ $vxe-modal-border-color: #3b3b3b; /*pulldown*/ $vxe-pulldown-panel-background-color: #262626 !default; -@import 'vxe-table/styles/index'; +@import 'vxe-table/styles/index.scss'; diff --git a/yudao-ui-admin-vue3/src/components/XTable/src/style/index.scss b/yudao-ui-admin-vue3/src/components/XTable/src/style/index.scss index 350ce0c09..e37af37a8 100644 --- a/yudao-ui-admin-vue3/src/components/XTable/src/style/index.scss +++ b/yudao-ui-admin-vue3/src/components/XTable/src/style/index.scss @@ -1,5 +1,5 @@ -@import 'vxe-table/styles/variable.scss'; -@import 'vxe-table/styles/modules.scss'; +// @import 'vxe-table/styles/variable.scss'; +// @import 'vxe-table/styles/modules.scss'; // @import './theme/light.scss'; i { border-color: initial; diff --git a/yudao-ui-admin-vue3/src/components/XTable/src/style/light.scss b/yudao-ui-admin-vue3/src/components/XTable/src/style/light.scss index f979155ef..f2f1309f4 100644 --- a/yudao-ui-admin-vue3/src/components/XTable/src/style/light.scss +++ b/yudao-ui-admin-vue3/src/components/XTable/src/style/light.scss @@ -13,4 +13,4 @@ $vxe-danger-color: #f56c6c !default; $vxe-disabled-color: #bfbfbf !default; $vxe-primary-disabled-color: #c0c4cc !default; -@import 'vxe-table/styles/index'; +@import 'vxe-table/styles/index.scss'; diff --git a/yudao-ui-admin-vue3/src/plugins/vxeTable/index.scss b/yudao-ui-admin-vue3/src/plugins/vxeTable/index.scss deleted file mode 100644 index 350ce0c09..000000000 --- a/yudao-ui-admin-vue3/src/plugins/vxeTable/index.scss +++ /dev/null @@ -1,6 +0,0 @@ -@import 'vxe-table/styles/variable.scss'; -@import 'vxe-table/styles/modules.scss'; -// @import './theme/light.scss'; -i { - border-color: initial; -} diff --git a/yudao-ui-admin-vue3/src/plugins/vxeTable/theme/dark.scss b/yudao-ui-admin-vue3/src/plugins/vxeTable/theme/dark.scss deleted file mode 100644 index 4e87c4b39..000000000 --- a/yudao-ui-admin-vue3/src/plugins/vxeTable/theme/dark.scss +++ /dev/null @@ -1,81 +0,0 @@ -// 修改样式变量 -//@import 'vxe-table/styles/variable.scss'; - -/*font*/ -$vxe-font-color: #e5e7eb; -// $vxe-font-size: 14px !default; -// $vxe-font-size-medium: 16px !default; -// $vxe-font-size-small: 14px !default; -// $vxe-font-size-mini: 12px !default; - -/*color*/ -$vxe-primary-color: #409eff !default; -$vxe-success-color: #67c23a !default; -$vxe-info-color: #909399 !default; -$vxe-warning-color: #e6a23c !default; -$vxe-danger-color: #f56c6c !default; -$vxe-disabled-color: #bfbfbf !default; -$vxe-primary-disabled-color: #c0c4cc !default; - -/*loading*/ -$vxe-loading-color: $vxe-primary-color !default; -$vxe-loading-background-color: #1d1e1f !default; -$vxe-loading-z-index: 999 !default; - -/*icon*/ -$vxe-icon-font-family: Verdana, Arial, Tahoma !default; -$vxe-icon-background-color: #e5e7eb !default; - -/*toolbar*/ -$vxe-toolbar-background-color: #1d1e1f !default; -$vxe-toolbar-button-border: #dcdfe6 !default; -$vxe-toolbar-custom-active-background-color: #d9dadb !default; -$vxe-toolbar-panel-background-color: #e5e7eb !default; - -$vxe-table-font-color: #e5e7eb; -$vxe-table-header-background-color: #1d1e1f; -$vxe-table-body-background-color: #141414; -$vxe-table-row-striped-background-color: #1d1d1d; -$vxe-table-row-hover-background-color: #1d1e1f; -$vxe-table-row-hover-striped-background-color: #1e1e1e; -$vxe-table-footer-background-color: #1d1e1f; -$vxe-table-row-current-background-color: #302d2d; -$vxe-table-column-current-background-color: #302d2d; -$vxe-table-column-hover-background-color: #302d2d; -$vxe-table-row-hover-current-background-color: #302d2d; -$vxe-table-row-checkbox-checked-background-color: #3e3c37 !default; -$vxe-table-row-hover-checkbox-checked-background-color: #615a4a !default; -$vxe-table-menu-background-color: #1d1e1f; -$vxe-table-border-width: 1px !default; -$vxe-table-border-color: #4c4d4f !default; -$vxe-table-fixed-left-scrolling-box-shadow: 8px 0px 10px -5px rgba(0, 0, 0, 0.12) !default; -$vxe-table-fixed-right-scrolling-box-shadow: -8px 0px 10px -5px rgba(0, 0, 0, 0.12) !default; - -$vxe-form-background-color: #141414; - -/*pager*/ -$vxe-pager-background-color: #1d1e1f !default; -$vxe-pager-perfect-background-color: #262727 !default; -$vxe-pager-perfect-button-background-color: #a7a3a3 !default; - -$vxe-input-background-color: #141414; -$vxe-input-border-color: #4c4d4f !default; - -$vxe-select-option-hover-background-color: #262626 !default; -$vxe-select-panel-background-color: #141414 !default; -$vxe-select-empty-color: #262626 !default; -$vxe-optgroup-title-color: #909399 !default; - -/*button*/ -$vxe-button-default-background-color: #262626; -$vxe-button-dropdown-panel-background-color: #141414; - -/*modal*/ -$vxe-modal-header-background-color: #141414; -$vxe-modal-body-background-color: #141414; -$vxe-modal-border-color: #3b3b3b; - -/*pulldown*/ -$vxe-pulldown-panel-background-color: #262626 !default; - -@import 'vxe-table/styles/index'; diff --git a/yudao-ui-admin-vue3/src/plugins/vxeTable/theme/light.scss b/yudao-ui-admin-vue3/src/plugins/vxeTable/theme/light.scss deleted file mode 100644 index f2f1309f4..000000000 --- a/yudao-ui-admin-vue3/src/plugins/vxeTable/theme/light.scss +++ /dev/null @@ -1,16 +0,0 @@ -// 修改样式变量 -// /*font*/ -// $vxe-font-size: 12px !default; -// $vxe-font-size-medium: 16px !default; -// $vxe-font-size-small: 14px !default; -// $vxe-font-size-mini: 12px !default; -/*color*/ -$vxe-primary-color: #409eff !default; -$vxe-success-color: #67c23a !default; -$vxe-info-color: #909399 !default; -$vxe-warning-color: #e6a23c !default; -$vxe-danger-color: #f56c6c !default; -$vxe-disabled-color: #bfbfbf !default; -$vxe-primary-disabled-color: #c0c4cc !default; - -@import 'vxe-table/styles/index.scss'; diff --git a/yudao-ui-admin-vue3/src/styles/variables.scss b/yudao-ui-admin-vue3/src/styles/variables.scss index 00b66f1fc..ffa78c9fc 100644 --- a/yudao-ui-admin-vue3/src/styles/variables.scss +++ b/yudao-ui-admin-vue3/src/styles/variables.scss @@ -2,3 +2,5 @@ $namespace: v; // el命名空间 $elNamespace: el; +// vxe命名空间 +$vxeNamespace: vxe; From 4941a43e082d9e546aa209e9f53c7db50851c53c Mon Sep 17 00:00:00 2001 From: xingyu Date: Fri, 13 Jan 2023 23:58:14 +0800 Subject: [PATCH 6/8] =?UTF-8?q?perf:=20=E9=87=8D=E6=9E=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=94=9F=E6=88=90=20=E4=BC=98=E5=8C=96=E6=80=A7?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/infra/codegen/EditTable.vue | 15 +- .../codegen/components/BasicInfoForm.vue | 100 ++++++++++- .../codegen/components/CloumInfoForm.vue | 164 +++++++++--------- .../infra/codegen/components/GenInfoForm.vue | 135 -------------- .../views/infra/codegen/components/index.ts | 3 +- 5 files changed, 187 insertions(+), 230 deletions(-) delete mode 100644 yudao-ui-admin-vue3/src/views/infra/codegen/components/GenInfoForm.vue diff --git a/yudao-ui-admin-vue3/src/views/infra/codegen/EditTable.vue b/yudao-ui-admin-vue3/src/views/infra/codegen/EditTable.vue index 7c4349df5..301ab1007 100644 --- a/yudao-ui-admin-vue3/src/views/infra/codegen/EditTable.vue +++ b/yudao-ui-admin-vue3/src/views/infra/codegen/EditTable.vue @@ -8,9 +8,6 @@ - - - diff --git a/yudao-ui-admin-vue3/src/views/infra/codegen/components/index.ts b/yudao-ui-admin-vue3/src/views/infra/codegen/components/index.ts index f6fc155b7..b84c5a031 100644 --- a/yudao-ui-admin-vue3/src/views/infra/codegen/components/index.ts +++ b/yudao-ui-admin-vue3/src/views/infra/codegen/components/index.ts @@ -1,6 +1,5 @@ import BasicInfoForm from './BasicInfoForm.vue' import CloumInfoForm from './CloumInfoForm.vue' -import GenInfoForm from './GenInfoForm.vue' import ImportTable from './ImportTable.vue' import Preview from './Preview.vue' -export { BasicInfoForm, CloumInfoForm, GenInfoForm, ImportTable, Preview } +export { BasicInfoForm, CloumInfoForm, ImportTable, Preview } From a9c7d8787241a4d217a47bcb00381316d8edaea4 Mon Sep 17 00:00:00 2001 From: xingyu Date: Sat, 14 Jan 2023 00:00:34 +0800 Subject: [PATCH 7/8] =?UTF-8?q?perf:=20=E8=B0=83=E6=95=B4=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=94=9F=E6=88=90=E5=99=A8=E5=9F=BA=E7=A1=80=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../codegen/components/BasicInfoForm.vue | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/yudao-ui-admin-vue3/src/views/infra/codegen/components/BasicInfoForm.vue b/yudao-ui-admin-vue3/src/views/infra/codegen/components/BasicInfoForm.vue index 2384a850c..865f57ec3 100644 --- a/yudao-ui-admin-vue3/src/views/infra/codegen/components/BasicInfoForm.vue +++ b/yudao-ui-admin-vue3/src/views/infra/codegen/components/BasicInfoForm.vue @@ -40,6 +40,21 @@ const rules = reactive({ classComment: [required] }) const schema = reactive([ + { + label: '上级菜单', + field: 'parentMenuId', + component: 'TreeSelect', + componentProps: { + data: menuOptions, + props: defaultProps, + checkStrictly: true, + nodeKey: 'id' + }, + labelMessage: '分配到指定菜单下,例如 系统管理', + colProps: { + span: 24 + } + }, { label: '表名称', field: 'tableName', @@ -64,6 +79,15 @@ const schema = reactive([ span: 12 } }, + { + label: '类名称', + field: 'className', + component: 'Input', + labelMessage: '类名称(首字母大写),例如SysUser、SysMenu、SysDictData 等等', + colProps: { + span: 12 + } + }, { label: '生成模板', field: 'templateType', @@ -104,15 +128,6 @@ const schema = reactive([ span: 12 } }, - { - label: '类名称', - field: 'className', - component: 'Input', - labelMessage: '类名称(首字母大写),例如SysUser、SysMenu、SysDictData 等等', - colProps: { - span: 12 - } - }, { label: '类描述', field: 'classComment', @@ -122,21 +137,6 @@ const schema = reactive([ span: 12 } }, - { - label: '上级菜单', - field: 'parentMenuId', - component: 'TreeSelect', - componentProps: { - data: menuOptions, - props: defaultProps, - checkStrictly: true, - nodeKey: 'id' - }, - labelMessage: '分配到指定菜单下,例如 系统管理', - colProps: { - span: 12 - } - }, { label: '作者', field: 'author', @@ -154,7 +154,7 @@ const schema = reactive([ rows: 4 }, colProps: { - span: 12 + span: 24 } } ]) From 073b3048d1f69de21cc243cec702dcea7cea9460 Mon Sep 17 00:00:00 2001 From: xingyu Date: Sat, 14 Jan 2023 00:03:02 +0800 Subject: [PATCH 8/8] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=94=9F=E6=88=90=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-ui-admin-vue3/src/views/infra/codegen/EditTable.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-ui-admin-vue3/src/views/infra/codegen/EditTable.vue b/yudao-ui-admin-vue3/src/views/infra/codegen/EditTable.vue index 301ab1007..32371d52f 100644 --- a/yudao-ui-admin-vue3/src/views/infra/codegen/EditTable.vue +++ b/yudao-ui-admin-vue3/src/views/infra/codegen/EditTable.vue @@ -48,8 +48,8 @@ const getList = async () => { if (id) { // 获取表详细信息 const res = await getCodegenTableApi(id) - tableCurrentRow.value = res.table title.value = '修改[ ' + res.table.tableName + ' ]生成配置' + tableCurrentRow.value = res.table cloumCurrentRow.value = res.columns } }