create-young-proj 0.13.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +31 -22
- package/dist/index.mjs +34 -34
- package/package.json +12 -11
- package/template-nuxt-admin/README.md +23 -16
- package/template-nuxt-website/README.md +117 -0
- package/template-uni-app/README.md +5 -0
- package/template-admin-server/.editorconfig +0 -11
- package/template-admin-server/.nvmrc +0 -1
- package/template-admin-server/.vscode/extensions.json +0 -6
- package/template-admin-server/.vscode/settings.json +0 -4
- package/template-admin-server/_gitignore +0 -15
- package/template-admin-server/boot.mjs +0 -11
- package/template-admin-server/package.json +0 -60
- package/template-admin-server/rome.json +0 -22
- package/template-admin-server/src/config/config.default.ts +0 -56
- package/template-admin-server/src/configuration.ts +0 -47
- package/template-admin-server/src/controller/admin.controller.ts +0 -397
- package/template-admin-server/src/controller/api.controller.ts +0 -98
- package/template-admin-server/src/controller/base.controller.ts +0 -70
- package/template-admin-server/src/controller/dto/api.ts +0 -47
- package/template-admin-server/src/controller/dto/index.ts +0 -36
- package/template-admin-server/src/controller/dto/menu.ts +0 -41
- package/template-admin-server/src/controller/dto/role.ts +0 -41
- package/template-admin-server/src/controller/dto/user.ts +0 -52
- package/template-admin-server/src/controller/menu.controller.ts +0 -138
- package/template-admin-server/src/controller/role.controller.ts +0 -116
- package/template-admin-server/src/controller/user.controller.ts +0 -108
- package/template-admin-server/src/entities/Api.ts +0 -29
- package/template-admin-server/src/entities/BaseCreate.ts +0 -30
- package/template-admin-server/src/entities/Menu.ts +0 -39
- package/template-admin-server/src/entities/Role.ts +0 -36
- package/template-admin-server/src/entities/User.ts +0 -35
- package/template-admin-server/src/entities/index.ts +0 -10
- package/template-admin-server/src/filter/default.filter.ts +0 -22
- package/template-admin-server/src/filter/notfound.filter.ts +0 -23
- package/template-admin-server/src/middleware/helper.middleware.ts +0 -28
- package/template-admin-server/src/middleware/index.ts +0 -9
- package/template-admin-server/src/middleware/jwt.middleware.ts +0 -32
- package/template-admin-server/src/middleware/report.middleware.ts +0 -26
- package/template-admin-server/src/service/api.service.ts +0 -174
- package/template-admin-server/src/service/basic.ts +0 -118
- package/template-admin-server/src/service/index.ts +0 -10
- package/template-admin-server/src/service/menu.service.ts +0 -139
- package/template-admin-server/src/service/role.service.ts +0 -286
- package/template-admin-server/src/service/user.service.ts +0 -124
- package/template-admin-server/src/strategy/jwt.strategy.ts +0 -26
- package/template-admin-server/src/types/index.ts +0 -42
- package/template-admin-server/src/types/types.d.ts +0 -31
- package/template-admin-server/tsconfig.json +0 -24
- package/template-nuxt-admin/.eslintrc +0 -14
- package/template-nuxt-admin/.vscode/extensions.json +0 -12
- package/template-nuxt-admin/.vscode/settings.json +0 -25
- package/template-nuxt-admin/Dockerfile +0 -41
- package/template-nuxt-admin/_gitignore +0 -23
- package/template-nuxt-admin/_npmrc +0 -2
- package/template-nuxt-admin/app.vue +0 -41
- package/template-nuxt-admin/boot.mjs +0 -16
- package/template-nuxt-admin/components/ScreenFull.vue +0 -19
- package/template-nuxt-admin/components/TopSearch.vue +0 -77
- package/template-nuxt-admin/components/TopUser.vue +0 -72
- package/template-nuxt-admin/components/YoungChangePassword.vue +0 -97
- package/template-nuxt-admin/components/YoungCodeInput.vue +0 -66
- package/template-nuxt-admin/components/YoungLink.vue +0 -24
- package/template-nuxt-admin/components/YoungLoading.vue +0 -39
- package/template-nuxt-admin/components/layout/Footer.vue +0 -29
- package/template-nuxt-admin/components/layout/Logo.vue +0 -54
- package/template-nuxt-admin/components/layout/Main.vue +0 -26
- package/template-nuxt-admin/components/layout/NavBar.vue +0 -89
- package/template-nuxt-admin/components/layout/SideBar.vue +0 -96
- package/template-nuxt-admin/components/layout/SubMenu.vue +0 -52
- package/template-nuxt-admin/components/layout/TabsBar.vue +0 -184
- package/template-nuxt-admin/composables/api.ts +0 -105
- package/template-nuxt-admin/composables/apis/delete.ts +0 -37
- package/template-nuxt-admin/composables/apis/get.ts +0 -83
- package/template-nuxt-admin/composables/apis/index.ts +0 -10
- package/template-nuxt-admin/composables/apis/patch.ts +0 -74
- package/template-nuxt-admin/composables/apis/post.ts +0 -85
- package/template-nuxt-admin/composables/config.ts +0 -13
- package/template-nuxt-admin/composables/icon.ts +0 -27
- package/template-nuxt-admin/composables/nav.ts +0 -75
- package/template-nuxt-admin/composables/tags.ts +0 -136
- package/template-nuxt-admin/composables/user.ts +0 -46
- package/template-nuxt-admin/config/.devrc +0 -1
- package/template-nuxt-admin/config/.onlinerc +0 -1
- package/template-nuxt-admin/config/.testrc +0 -1
- package/template-nuxt-admin/env.d.ts +0 -47
- package/template-nuxt-admin/error.vue +0 -61
- package/template-nuxt-admin/layouts/blank.vue +0 -9
- package/template-nuxt-admin/layouts/default.vue +0 -125
- package/template-nuxt-admin/middleware/auth.global.ts +0 -69
- package/template-nuxt-admin/nuxt.config.ts +0 -106
- package/template-nuxt-admin/package.json +0 -64
- package/template-nuxt-admin/pages/home/[id].vue +0 -28
- package/template-nuxt-admin/pages/index.vue +0 -15
- package/template-nuxt-admin/pages/login.vue +0 -199
- package/template-nuxt-admin/pages/system/api.vue +0 -179
- package/template-nuxt-admin/pages/system/hooks/useRole.ts +0 -335
- package/template-nuxt-admin/pages/system/menuList.vue +0 -353
- package/template-nuxt-admin/pages/system/role.vue +0 -145
- package/template-nuxt-admin/pages/system/user.vue +0 -225
- package/template-nuxt-admin/plugins/directive.ts +0 -26
- package/template-nuxt-admin/public/bg.webp +0 -0
- package/template-nuxt-admin/public/default_avatar.svg +0 -1
- package/template-nuxt-admin/public/favicon.svg +0 -2
- package/template-nuxt-admin/public/image_placeholder.svg +0 -15
- package/template-nuxt-admin/public/logo.svg +0 -2
- package/template-nuxt-admin/public/tabbar_bg.png +0 -0
- package/template-nuxt-admin/server/api/[...all].ts +0 -10
- package/template-nuxt-admin/server/plugins/env.ts +0 -87
- package/template-nuxt-admin/server/routes/get/env.ts +0 -13
- package/template-nuxt-admin/server/tsconfig.json +0 -3
- package/template-nuxt-admin/server/utils/index.ts +0 -36
- package/template-nuxt-admin/styles/element.scss +0 -30
- package/template-nuxt-admin/styles/index.scss +0 -59
- package/template-nuxt-admin/styles/variable.scss +0 -103
- package/template-nuxt-admin/tsconfig.json +0 -7
- package/template-nuxt-admin/typings/global.d.ts +0 -16
- package/template-nuxt-admin/typings/system.d.ts +0 -66
- package/template-nuxt-admin/typings/user.d.ts +0 -19
- package/template-nuxt-admin/uno.config.ts +0 -40
- package/template-nuxt-admin/utils/tool.ts +0 -199
- package/template-nuxt-admin/yarn.lock +0 -8487
- package/template-uni-app/.eslintignore +0 -1
- package/template-uni-app/.eslintrc +0 -16
- package/template-uni-app/.vscode/.server-controller-port.log +0 -5
- package/template-uni-app/.vscode/css.code-snippets +0 -398
- package/template-uni-app/.vscode/extensions.json +0 -12
- package/template-uni-app/.vscode/js.code-snippets +0 -1669
- package/template-uni-app/.vscode/settings.json +0 -25
- package/template-uni-app/.vscode/vue-html.code-snippets +0 -682
- package/template-uni-app/_env +0 -3
- package/template-uni-app/_env.development +0 -11
- package/template-uni-app/_env.production +0 -8
- package/template-uni-app/_env.test +0 -11
- package/template-uni-app/_gitignore +0 -3
- package/template-uni-app/_npmrc +0 -2
- package/template-uni-app/auto-imports.d.ts +0 -413
- package/template-uni-app/components.d.ts +0 -17
- package/template-uni-app/custom-plugins/index.ts +0 -7
- package/template-uni-app/custom-plugins/multiconf.ts +0 -74
- package/template-uni-app/dist/dev/mp-weixin/apis/index.js +0 -43
- package/template-uni-app/dist/dev/mp-weixin/apis/requests/get.js +0 -10
- package/template-uni-app/dist/dev/mp-weixin/apis/requests/index.js +0 -1
- package/template-uni-app/dist/dev/mp-weixin/apis/requests/post.js +0 -15
- package/template-uni-app/dist/dev/mp-weixin/app.js +0 -92
- package/template-uni-app/dist/dev/mp-weixin/app.json +0 -51
- package/template-uni-app/dist/dev/mp-weixin/app.wxss +0 -2378
- package/template-uni-app/dist/dev/mp-weixin/common/assets.js +0 -13
- package/template-uni-app/dist/dev/mp-weixin/common/vendor.js +0 -9166
- package/template-uni-app/dist/dev/mp-weixin/components/young-loading/young-loading.js +0 -22
- package/template-uni-app/dist/dev/mp-weixin/components/young-loading/young-loading.json +0 -4
- package/template-uni-app/dist/dev/mp-weixin/components/young-loading/young-loading.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/components/young-loading/young-loading.wxss +0 -0
- package/template-uni-app/dist/dev/mp-weixin/components/young-loading-mini/young-loading-mini.js +0 -22
- package/template-uni-app/dist/dev/mp-weixin/components/young-loading-mini/young-loading-mini.json +0 -4
- package/template-uni-app/dist/dev/mp-weixin/components/young-loading-mini/young-loading-mini.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/components/young-loading-mini/young-loading-mini.wxss +0 -0
- package/template-uni-app/dist/dev/mp-weixin/components/young-navbar/young-navbar.js +0 -81
- package/template-uni-app/dist/dev/mp-weixin/components/young-navbar/young-navbar.json +0 -4
- package/template-uni-app/dist/dev/mp-weixin/components/young-navbar/young-navbar.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/components/young-navbar/young-navbar.wxss +0 -108
- package/template-uni-app/dist/dev/mp-weixin/components/young-tabbar/young-tabbar.js +0 -55
- package/template-uni-app/dist/dev/mp-weixin/components/young-tabbar/young-tabbar.json +0 -4
- package/template-uni-app/dist/dev/mp-weixin/components/young-tabbar/young-tabbar.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/components/young-tabbar/young-tabbar.wxss +0 -88
- package/template-uni-app/dist/dev/mp-weixin/config/enum.js +0 -21
- package/template-uni-app/dist/dev/mp-weixin/config/index.js +0 -1
- package/template-uni-app/dist/dev/mp-weixin/config/map.js +0 -1
- package/template-uni-app/dist/dev/mp-weixin/layouts/default.js +0 -29
- package/template-uni-app/dist/dev/mp-weixin/layouts/default.json +0 -6
- package/template-uni-app/dist/dev/mp-weixin/layouts/default.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/layouts/default.wxss +0 -0
- package/template-uni-app/dist/dev/mp-weixin/layouts/tabbar.js +0 -56
- package/template-uni-app/dist/dev/mp-weixin/layouts/tabbar.json +0 -9
- package/template-uni-app/dist/dev/mp-weixin/layouts/tabbar.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/layouts/tabbar.wxss +0 -0
- package/template-uni-app/dist/dev/mp-weixin/node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.js +0 -98
- package/template-uni-app/dist/dev/mp-weixin/node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.json +0 -4
- package/template-uni-app/dist/dev/mp-weixin/node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.wxss +0 -125
- package/template-uni-app/dist/dev/mp-weixin/pages/demo/index.js +0 -37
- package/template-uni-app/dist/dev/mp-weixin/pages/demo/index.json +0 -5
- package/template-uni-app/dist/dev/mp-weixin/pages/demo/index.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/pages/demo/index.wxss +0 -0
- package/template-uni-app/dist/dev/mp-weixin/pages/index.js +0 -50
- package/template-uni-app/dist/dev/mp-weixin/pages/index.json +0 -5
- package/template-uni-app/dist/dev/mp-weixin/pages/index.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/pages/index.wxss +0 -0
- package/template-uni-app/dist/dev/mp-weixin/pages/my.js +0 -22
- package/template-uni-app/dist/dev/mp-weixin/pages/my.json +0 -3
- package/template-uni-app/dist/dev/mp-weixin/pages/my.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/pages/my.wxss +0 -0
- package/template-uni-app/dist/dev/mp-weixin/project.config.json +0 -55
- package/template-uni-app/dist/dev/mp-weixin/project.private.config.json +0 -6
- package/template-uni-app/dist/dev/mp-weixin/static/back.png +0 -0
- package/template-uni-app/dist/dev/mp-weixin/static/h.png +0 -0
- package/template-uni-app/dist/dev/mp-weixin/static/home.png +0 -0
- package/template-uni-app/dist/dev/mp-weixin/static/home_active.png +0 -0
- package/template-uni-app/dist/dev/mp-weixin/static/more.png +0 -0
- package/template-uni-app/dist/dev/mp-weixin/static/my.png +0 -0
- package/template-uni-app/dist/dev/mp-weixin/static/my_active.png +0 -0
- package/template-uni-app/dist/dev/mp-weixin/static/network.png +0 -0
- package/template-uni-app/dist/dev/mp-weixin/store/index.js +0 -8
- package/template-uni-app/dist/dev/mp-weixin/store/local/index.js +0 -13
- package/template-uni-app/dist/dev/mp-weixin/store/system.js +0 -14
- package/template-uni-app/dist/dev/mp-weixin/utils/modal.js +0 -78
- package/template-uni-app/dist/dev/mp-weixin/utils/route.js +0 -83
- package/template-uni-app/dist/dev/mp-weixin/utils/system.js +0 -27
- package/template-uni-app/index.html +0 -23
- package/template-uni-app/manifest.config.ts +0 -88
- package/template-uni-app/package.json +0 -108
- package/template-uni-app/pages.config.ts +0 -58
- package/template-uni-app/pnpm-lock.yaml +0 -9967
- package/template-uni-app/src/App.vue +0 -79
- package/template-uni-app/src/apis/index.ts +0 -54
- package/template-uni-app/src/apis/requests/get.ts +0 -52
- package/template-uni-app/src/apis/requests/index.ts +0 -8
- package/template-uni-app/src/apis/requests/post.ts +0 -23
- package/template-uni-app/src/components/young-loading/young-loading.vue +0 -36
- package/template-uni-app/src/components/young-loading-mini/young-loading-mini.vue +0 -35
- package/template-uni-app/src/components/young-navbar/young-navbar.vue +0 -252
- package/template-uni-app/src/components/young-tabbar/young-tabbar.vue +0 -145
- package/template-uni-app/src/config/enum.ts +0 -47
- package/template-uni-app/src/config/index.ts +0 -8
- package/template-uni-app/src/config/map.ts +0 -15
- package/template-uni-app/src/env.d.ts +0 -36
- package/template-uni-app/src/layouts/default.vue +0 -22
- package/template-uni-app/src/layouts/tabbar.vue +0 -38
- package/template-uni-app/src/main.ts +0 -20
- package/template-uni-app/src/manifest.json +0 -75
- package/template-uni-app/src/pages/demo/index.vue +0 -30
- package/template-uni-app/src/pages/index.vue +0 -65
- package/template-uni-app/src/pages/my.vue +0 -30
- package/template-uni-app/src/pages.json +0 -74
- package/template-uni-app/src/static/back.png +0 -0
- package/template-uni-app/src/static/h.png +0 -0
- package/template-uni-app/src/static/home.png +0 -0
- package/template-uni-app/src/static/home_active.png +0 -0
- package/template-uni-app/src/static/more.png +0 -0
- package/template-uni-app/src/static/my.png +0 -0
- package/template-uni-app/src/static/my_active.png +0 -0
- package/template-uni-app/src/static/network.png +0 -0
- package/template-uni-app/src/store/index.ts +0 -16
- package/template-uni-app/src/store/local/index.ts +0 -42
- package/template-uni-app/src/store/system.ts +0 -21
- package/template-uni-app/src/typings/global.d.ts +0 -7
- package/template-uni-app/src/uni.scss +0 -76
- package/template-uni-app/src/utils/auth.ts +0 -204
- package/template-uni-app/src/utils/index.ts +0 -11
- package/template-uni-app/src/utils/map.ts +0 -98
- package/template-uni-app/src/utils/modal.ts +0 -120
- package/template-uni-app/src/utils/route.ts +0 -151
- package/template-uni-app/src/utils/system.ts +0 -67
- package/template-uni-app/tsconfig.json +0 -16
- package/template-uni-app/unocss.config.ts +0 -30
- package/template-uni-app/vite.config.ts +0 -63
- package/template-uni-app/volar.config.js +0 -6
- package/template-vue-mobile/.vscode/base.code-snippets +0 -24
- package/template-vue-mobile/.vscode/extensions.json +0 -10
- package/template-vue-mobile/.vscode/settings.json +0 -7
- package/template-vue-mobile/Dockerfile +0 -42
- package/template-vue-mobile/_env +0 -6
- package/template-vue-mobile/_gitignore +0 -30
- package/template-vue-mobile/boot.mjs +0 -16
- package/template-vue-mobile/build/custom-plugin.ts +0 -30
- package/template-vue-mobile/build/index.ts +0 -7
- package/template-vue-mobile/build/plugins.ts +0 -68
- package/template-vue-mobile/config/.devrc +0 -2
- package/template-vue-mobile/config/.onlinerc +0 -1
- package/template-vue-mobile/config/.testrc +0 -1
- package/template-vue-mobile/index.html +0 -25
- package/template-vue-mobile/nitro.config.ts +0 -19
- package/template-vue-mobile/package.json +0 -48
- package/template-vue-mobile/plugins/env.ts +0 -26
- package/template-vue-mobile/public/vite.svg +0 -1
- package/template-vue-mobile/rome.json +0 -24
- package/template-vue-mobile/routes/[...all].ts +0 -11
- package/template-vue-mobile/routes/get/env.ts +0 -25
- package/template-vue-mobile/src/App.vue +0 -29
- package/template-vue-mobile/src/auto-components.d.ts +0 -24
- package/template-vue-mobile/src/auto-imports.d.ts +0 -289
- package/template-vue-mobile/src/components/Init.vue +0 -36
- package/template-vue-mobile/src/global.d.ts +0 -7
- package/template-vue-mobile/src/hooks/useVerifyCode.ts +0 -46
- package/template-vue-mobile/src/layouts/blank.vue +0 -9
- package/template-vue-mobile/src/layouts/default.vue +0 -27
- package/template-vue-mobile/src/layouts/sub.vue +0 -20
- package/template-vue-mobile/src/main.ts +0 -35
- package/template-vue-mobile/src/modules/1-router.ts +0 -40
- package/template-vue-mobile/src/modules/2-pinia.ts +0 -10
- package/template-vue-mobile/src/modules/3-net.ts +0 -46
- package/template-vue-mobile/src/modules/4-auth.ts +0 -64
- package/template-vue-mobile/src/views/[...all_404].vue +0 -557
- package/template-vue-mobile/src/views/base/login.vue +0 -110
- package/template-vue-mobile/src/views/base/resetPasswd.vue +0 -88
- package/template-vue-mobile/src/views/index.vue +0 -18
- package/template-vue-mobile/src/views/my.vue +0 -15
- package/template-vue-mobile/src/views/sub.vue +0 -18
- package/template-vue-mobile/src/vite-env.d.ts +0 -43
- package/template-vue-mobile/tsconfig.json +0 -21
- package/template-vue-mobile/tsconfig.node.json +0 -9
- package/template-vue-mobile/unocss.config.ts +0 -47
- package/template-vue-mobile/vite.config.ts +0 -32
- package/template-vue-mobile/yarn.lock +0 -4395
- package/template-vue-thin/.vscode/extensions.json +0 -10
- package/template-vue-thin/.vscode/settings.json +0 -4
- package/template-vue-thin/_env +0 -1
- package/template-vue-thin/_gitignore +0 -29
- package/template-vue-thin/index.html +0 -21
- package/template-vue-thin/package.json +0 -40
- package/template-vue-thin/public/vite.svg +0 -1
- package/template-vue-thin/src/App.vue +0 -9
- package/template-vue-thin/src/layouts/blank.vue +0 -9
- package/template-vue-thin/src/layouts/default.vue +0 -12
- package/template-vue-thin/src/layouts/list.vue +0 -12
- package/template-vue-thin/src/main.ts +0 -58
- package/template-vue-thin/src/views/[...all_404].vue +0 -488
- package/template-vue-thin/src/views/index.vue +0 -19
- package/template-vue-thin/src/views/list.vue +0 -17
- package/template-vue-thin/src/vite-env.d.ts +0 -22
- package/template-vue-thin/tsconfig.json +0 -21
- package/template-vue-thin/tsconfig.node.json +0 -9
- package/template-vue-thin/unocss.config.ts +0 -47
- package/template-vue-thin/vite.config.ts +0 -64
@@ -1,69 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2023-07-21 10:02:19
|
4
|
-
* @LastEditTime: 2023-09-13 09:45:34
|
5
|
-
* @Description:
|
6
|
-
*/
|
7
|
-
export default defineNuxtRouteMiddleware(async (to, from) => {
|
8
|
-
if (to.matched.length === 0)
|
9
|
-
throw createError({ message: '页面不存在', statusCode: 404 })
|
10
|
-
|
11
|
-
const { hasLogin } = storeToRefs(useUserStore())
|
12
|
-
const { nav_arr, flat_nav_arr, nodeMap, breadcrumb_arr } = storeToRefs(useNavStore())
|
13
|
-
|
14
|
-
const changeTitle = () => {
|
15
|
-
let nav = flat_nav_arr.value.find(item => item.component === to.path)
|
16
|
-
|
17
|
-
breadcrumb_arr.value.length = 0
|
18
|
-
|
19
|
-
if (nav && nav.title) {
|
20
|
-
to.meta.title = nav.title
|
21
|
-
|
22
|
-
while (nav) {
|
23
|
-
breadcrumb_arr.value.unshift(nav.title!)
|
24
|
-
if (nav.parent_id)
|
25
|
-
nav = nodeMap.value.get(nav.parent_id.toString())
|
26
|
-
else
|
27
|
-
break
|
28
|
-
}
|
29
|
-
}
|
30
|
-
|
31
|
-
document.title = (to.meta.title as string) || window.__YOUNG_ENV__.NUXT_PUBLIC_TITLE
|
32
|
-
}
|
33
|
-
|
34
|
-
const { addView } = useTagsStore()
|
35
|
-
|
36
|
-
// 页面无需登录
|
37
|
-
if (to.meta.auth === false) {
|
38
|
-
changeTitle()
|
39
|
-
addView(to)
|
40
|
-
return
|
41
|
-
}
|
42
|
-
|
43
|
-
if (!hasLogin.value && to.path !== '/login') {
|
44
|
-
// 页面需要登录,但是未登录
|
45
|
-
showNotify({
|
46
|
-
type: 'danger',
|
47
|
-
message: '未登录或登录过期,请重新登录',
|
48
|
-
})
|
49
|
-
return navigateTo(`/login?redirect=${encodeURIComponent(to.fullPath)}`, {
|
50
|
-
replace: true,
|
51
|
-
})
|
52
|
-
}
|
53
|
-
else if (hasLogin.value && to.path === '/login') {
|
54
|
-
// 已登录进入登录页
|
55
|
-
return navigateTo('/', {
|
56
|
-
replace: true,
|
57
|
-
})
|
58
|
-
}
|
59
|
-
else {
|
60
|
-
nav_arr.value.length === 0 && (await generateNavData())
|
61
|
-
if (hasPermission(to.path)) {
|
62
|
-
changeTitle()
|
63
|
-
addView(to)
|
64
|
-
}
|
65
|
-
else {
|
66
|
-
throw createError({ message: '无权限,请联系系统管理员', statusCode: 403 })
|
67
|
-
}
|
68
|
-
}
|
69
|
-
})
|
@@ -1,106 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2023-05-25 19:45:20
|
4
|
-
* @LastEditTime: 2023-09-16 16:34:29
|
5
|
-
* @Description:
|
6
|
-
*/
|
7
|
-
import { resolve } from 'node:path'
|
8
|
-
|
9
|
-
// https://nuxt.com/docs/api/configuration/nuxt-config
|
10
|
-
export default defineNuxtConfig({
|
11
|
-
ssr: false,
|
12
|
-
app: {
|
13
|
-
head: {
|
14
|
-
viewport: 'width=device-width,initial-scale=1.0,user-scalable=no,shrink-to-fit=no',
|
15
|
-
meta: [
|
16
|
-
{ name: 'theme-color', content: '#ffffff' },
|
17
|
-
{ name: 'screen-orientation', content: 'portrait' },
|
18
|
-
{ name: 'x5-orientation', content: 'portrait' },
|
19
|
-
{ name: 'renderer', content: 'webkit' },
|
20
|
-
{ name: 'mobile-web-app-capable', content: 'yes' },
|
21
|
-
{ name: 'creator', content: 'BluesYoung-web' },
|
22
|
-
],
|
23
|
-
link: [
|
24
|
-
{
|
25
|
-
rel: 'icon',
|
26
|
-
href: '/favicon.svg',
|
27
|
-
},
|
28
|
-
{
|
29
|
-
rel: 'preload',
|
30
|
-
as: 'image',
|
31
|
-
href: '/image_placeholder.svg',
|
32
|
-
},
|
33
|
-
{
|
34
|
-
rel: 'preload',
|
35
|
-
as: 'image',
|
36
|
-
href: '/tabbar_bg.png',
|
37
|
-
},
|
38
|
-
],
|
39
|
-
script: [
|
40
|
-
{
|
41
|
-
innerHTML: `
|
42
|
-
this.globalThis || (this.globalThis = this);
|
43
|
-
window.onerror = function(e) {
|
44
|
-
if (e.toString().includes('ResizeObserver loop')) {
|
45
|
-
return;
|
46
|
-
}
|
47
|
-
console.log(e);
|
48
|
-
window.alert('您的浏览器版本过低,请尝试使用其他浏览器或将浏览器升级至最新版本后重试!');
|
49
|
-
window.alert(e);
|
50
|
-
}
|
51
|
-
`,
|
52
|
-
},
|
53
|
-
],
|
54
|
-
},
|
55
|
-
},
|
56
|
-
|
57
|
-
lazyLoad: {
|
58
|
-
audio: false,
|
59
|
-
// 默认使用原生的 loading="lazy"
|
60
|
-
// native: true,
|
61
|
-
// js 实现,仅指令生效 v-lazy-load
|
62
|
-
// directiveOnly: true,
|
63
|
-
// @ts-expect-error js 实现的占位图
|
64
|
-
defaultImage: '/image_placeholder.svg',
|
65
|
-
},
|
66
|
-
|
67
|
-
nitro: {
|
68
|
-
output: {
|
69
|
-
dir: resolve(__dirname, './dist'),
|
70
|
-
},
|
71
|
-
},
|
72
|
-
|
73
|
-
// 开发调试工具,按需启用
|
74
|
-
// devtools: {
|
75
|
-
// enabled: true,
|
76
|
-
// },
|
77
|
-
|
78
|
-
modules: [
|
79
|
-
'@vueuse/nuxt',
|
80
|
-
'@unocss/nuxt',
|
81
|
-
'@element-plus/nuxt',
|
82
|
-
'@pinia/nuxt',
|
83
|
-
'@vant/nuxt',
|
84
|
-
'nuxt-lazy-load',
|
85
|
-
],
|
86
|
-
|
87
|
-
pinia: {
|
88
|
-
autoImports: ['defineStore', 'storeToRefs', 'acceptHMRUpdate'],
|
89
|
-
},
|
90
|
-
|
91
|
-
vite: {
|
92
|
-
build: {
|
93
|
-
// 兼容钉钉浏览器
|
94
|
-
target: 'es2015',
|
95
|
-
sourcemap: false,
|
96
|
-
},
|
97
|
-
css: {
|
98
|
-
preprocessorOptions: {
|
99
|
-
scss: {
|
100
|
-
javascriptEnabled: true,
|
101
|
-
additionalData: '@import "~/styles/variable.scss";',
|
102
|
-
},
|
103
|
-
},
|
104
|
-
},
|
105
|
-
},
|
106
|
-
})
|
@@ -1,64 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "nuxt-app",
|
3
|
-
"version": "0.0.0",
|
4
|
-
"private": true,
|
5
|
-
"scripts": {
|
6
|
-
"build": "nuxt build",
|
7
|
-
"dev": "nuxt dev --host",
|
8
|
-
"generate": "nuxt generate",
|
9
|
-
"preview": "nuxt preview --host",
|
10
|
-
"postinstall": "nuxt prepare && simple-git-hooks",
|
11
|
-
"lint": "eslint .",
|
12
|
-
"lint:fix": "eslint . --fix"
|
13
|
-
},
|
14
|
-
"dependencies": {
|
15
|
-
"@bluesyoung/casdoor-auth": "^0.1.0",
|
16
|
-
"@bluesyoung/http": "^1.0.1",
|
17
|
-
"@bluesyoung/ui-vue3": "^0.1.1",
|
18
|
-
"@bluesyoung/ui-vue3-element-plus": "0.13.0",
|
19
|
-
"@bluesyoung/utils": "0.2.1",
|
20
|
-
"@wangeditor/editor": "^5.1.23",
|
21
|
-
"@wangeditor/editor-for-vue": "^5.1.12",
|
22
|
-
"c12": "^1.4.2",
|
23
|
-
"file-saver": "^2.0.5",
|
24
|
-
"http-proxy": "^1.18.1",
|
25
|
-
"jszip": "^3.10.1",
|
26
|
-
"md5": "^2.3.0",
|
27
|
-
"qrcode": "^1.5.3",
|
28
|
-
"sortablejs": "^1.15.0",
|
29
|
-
"vue-cropper": "^1.0.9"
|
30
|
-
},
|
31
|
-
"devDependencies": {
|
32
|
-
"@antfu/eslint-config": "^0.42.0",
|
33
|
-
"@bluesyoung/logger": "^0.0.1",
|
34
|
-
"@element-plus/nuxt": "^1.0.5",
|
35
|
-
"@iconify/json": "^2.2.93",
|
36
|
-
"@nuxt/devtools": "^0.8.2",
|
37
|
-
"@pinia/nuxt": "^0.4.11",
|
38
|
-
"@types/file-saver": "^2.0.5",
|
39
|
-
"@types/md5": "^2.3.2",
|
40
|
-
"@types/node": "20.6.2",
|
41
|
-
"@types/qrcode": "^1.5.1",
|
42
|
-
"@unocss/nuxt": "^0.55.6",
|
43
|
-
"@vant/nuxt": "^1.0.2",
|
44
|
-
"@vueuse/nuxt": "^10.2.1",
|
45
|
-
"add": "^2.0.6",
|
46
|
-
"dayjs": "^1.11.9",
|
47
|
-
"element-plus": "^2.3.8",
|
48
|
-
"eslint": "^8.48.0",
|
49
|
-
"lint-staged": "^14.0.1",
|
50
|
-
"nuxt": "^3.7.3",
|
51
|
-
"nuxt-lazy-load": "^3.0.4",
|
52
|
-
"pinia": "^2.1.4",
|
53
|
-
"sass": "^1.64.0",
|
54
|
-
"simple-git-hooks": "^2.9.0",
|
55
|
-
"typescript": "^5.2.2",
|
56
|
-
"vant": "^4.6.2"
|
57
|
-
},
|
58
|
-
"simple-git-hooks": {
|
59
|
-
"pre-commit": "npx lint-staged"
|
60
|
-
},
|
61
|
-
"lint-staged": {
|
62
|
-
"*": "eslint --fix"
|
63
|
-
}
|
64
|
-
}
|
@@ -1,28 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2023-07-21 17:35:12
|
4
|
-
* @LastEditTime: 2023-09-15 15:20:25
|
5
|
-
* @Description:
|
6
|
-
-->
|
7
|
-
<script lang="ts" setup>
|
8
|
-
definePageMeta({
|
9
|
-
title: '工作台',
|
10
|
-
auth: false,
|
11
|
-
noCache: true,
|
12
|
-
})
|
13
|
-
|
14
|
-
const { nick } = storeToRefs(useUserStore())
|
15
|
-
const { nav_arr } = storeToRefs(useNavStore())
|
16
|
-
|
17
|
-
useTabNoCache(() => {
|
18
|
-
nav_arr.value.length === 0 && generateNavData()
|
19
|
-
})
|
20
|
-
</script>
|
21
|
-
|
22
|
-
<template>
|
23
|
-
<div>
|
24
|
-
<div class="text-4xl my-20px text-center font-bold">
|
25
|
-
欢迎回来,{{ nick }}
|
26
|
-
</div>
|
27
|
-
</div>
|
28
|
-
</template>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2023-07-21 09:27:14
|
4
|
-
* @LastEditTime: 2023-09-18 14:15:35
|
5
|
-
* @Description:
|
6
|
-
-->
|
7
|
-
<script setup lang="ts">
|
8
|
-
definePageMeta({
|
9
|
-
redirect: '/home/index',
|
10
|
-
})
|
11
|
-
</script>
|
12
|
-
|
13
|
-
<template>
|
14
|
-
<div />
|
15
|
-
</template>
|
@@ -1,199 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2023-07-21 10:03:11
|
4
|
-
* @LastEditTime: 2023-09-15 15:19:59
|
5
|
-
* @Description:
|
6
|
-
-->
|
7
|
-
<script lang="ts" setup>
|
8
|
-
import { isMobile } from '@bluesyoung/utils'
|
9
|
-
import type { FormInstance } from 'element-plus'
|
10
|
-
|
11
|
-
definePageMeta({
|
12
|
-
auth: false,
|
13
|
-
title: '用户登录',
|
14
|
-
noCache: true,
|
15
|
-
layout: 'blank',
|
16
|
-
})
|
17
|
-
|
18
|
-
const {
|
19
|
-
NUXT_PUBLIC_LOGIN_LOGO: LoginLogo,
|
20
|
-
NUXT_PUBLIC_LOGIN_BG: LoginBg,
|
21
|
-
NUXT_PUBLIC_TITLE: Title,
|
22
|
-
NUXT_PUBLIC_SUB_TITLE: SubTitle,
|
23
|
-
NUXT_PUBLIC_SLOGAN: SloGan,
|
24
|
-
NUXT_PUBLIC_CURRENT_VERSION: Version,
|
25
|
-
} = window.__YOUNG_ENV__
|
26
|
-
|
27
|
-
const { SaveFlag, hasLogin, cookie, Exptime } = storeToRefs(useUserStore())
|
28
|
-
|
29
|
-
const loginType = ref<'account' | 'code'>('account')
|
30
|
-
|
31
|
-
const form = reactive<LoginForm>({
|
32
|
-
mobile: '',
|
33
|
-
vercode: '',
|
34
|
-
password: '',
|
35
|
-
})
|
36
|
-
|
37
|
-
const formRef = ref<FormInstance>()
|
38
|
-
|
39
|
-
function loginHandler() {
|
40
|
-
formRef.value?.validate(async (valid: boolean) => {
|
41
|
-
try {
|
42
|
-
if (valid) {
|
43
|
-
const { enter } = useFullscreen()
|
44
|
-
const { width, height } = useWindowSize()
|
45
|
-
|
46
|
-
const data = await apis.post.login(form)
|
47
|
-
if (data) {
|
48
|
-
cookie.value = data
|
49
|
-
// 三天后过期
|
50
|
-
Exptime.value = Date.now() + 1000 * 60 * 60 * 24 * 3
|
51
|
-
height.value > width.value && enter()
|
52
|
-
showSuccessToast('登录成功!')
|
53
|
-
navigateTo('/')
|
54
|
-
}
|
55
|
-
}
|
56
|
-
else {
|
57
|
-
ElMessage.error('请仔细检查输入内容')
|
58
|
-
}
|
59
|
-
}
|
60
|
-
catch (error) {
|
61
|
-
console.error(error)
|
62
|
-
}
|
63
|
-
})
|
64
|
-
}
|
65
|
-
|
66
|
-
useTabNoCache(() => {
|
67
|
-
if (SaveFlag.value && hasLogin.value) {
|
68
|
-
navigateTo({
|
69
|
-
path: '/',
|
70
|
-
replace: true,
|
71
|
-
})
|
72
|
-
}
|
73
|
-
})
|
74
|
-
</script>
|
75
|
-
|
76
|
-
<template>
|
77
|
-
<img :src="LoginBg" class="absolute object-center object-cover w-100vw h-100vh blur-6 brightness-50">
|
78
|
-
<div class="flex flex-col items-center login-container pt-6%">
|
79
|
-
<div class="w-80px h-80px">
|
80
|
-
<img class="h-full" :src="LoginLogo" referrerpolicy="no-referrer">
|
81
|
-
</div>
|
82
|
-
<div class="title">
|
83
|
-
{{ Title }}
|
84
|
-
</div>
|
85
|
-
<div v-if="SubTitle" class="sub-title" v-html="SubTitle" />
|
86
|
-
|
87
|
-
<ElCard class="w-430px mt-3%" lt-sm="w-[96%] mx-[2%]">
|
88
|
-
<ElForm ref="formRef" :model="form">
|
89
|
-
<VanTabs v-model:active="loginType" size="large" @change="formRef?.resetFields?.()">
|
90
|
-
<VanTab name="account" title="账密登录">
|
91
|
-
<ElFormItem
|
92
|
-
prop="mobile" :rules="[
|
93
|
-
{ required: true, trigger: 'blur', message: '请输入手机号' },
|
94
|
-
{ message: '请输入合法的手机号', trigger: 'blur', validator: (_: any, v: string) => isMobile(v) },
|
95
|
-
]" class="mt-20px"
|
96
|
-
>
|
97
|
-
<ElInput v-model.trim="form.mobile" placeholder="请输入手机号" maxlength="11" class="!h-52px" clearable />
|
98
|
-
</ElFormItem>
|
99
|
-
<ElFormItem
|
100
|
-
v-if="loginType === 'account'" prop="password" :rules="[
|
101
|
-
{ required: true, trigger: 'blur', message: '请输入密码' },
|
102
|
-
{ min: 8, max: 16, trigger: 'blur', message: '请输入8-16位字符!' },
|
103
|
-
]"
|
104
|
-
>
|
105
|
-
<ElInput
|
106
|
-
v-model.trim="form.password" type="password" minlength="8" maxlength="16" placeholder="请输入密码"
|
107
|
-
class="!h-52px" clearable show-password @keyup.enter="loginHandler"
|
108
|
-
/>
|
109
|
-
</ElFormItem>
|
110
|
-
</VanTab>
|
111
|
-
<VanTab name="code" title="短信登录">
|
112
|
-
<ElFormItem
|
113
|
-
prop="mobile" :rules="[
|
114
|
-
{ required: true, trigger: 'blur', message: '请输入手机号' },
|
115
|
-
{ message: '请输入合法的手机号', trigger: 'blur', validator: (_: any, v: string) => isMobile(v) },
|
116
|
-
]" class="mt-20px"
|
117
|
-
>
|
118
|
-
<ElInput v-model.trim="form.mobile" placeholder="请输入手机号" maxlength="11" class="!h-52px" clearable />
|
119
|
-
</ElFormItem>
|
120
|
-
<ElFormItem
|
121
|
-
v-if="loginType === 'code'" prop="vercode"
|
122
|
-
:rules="[{ required: true, trigger: 'blur', message: '请输入验证码' }]"
|
123
|
-
>
|
124
|
-
<YoungCodeInput v-model.trim="form.vercode" :tel="form.mobile" @enter="loginHandler" />
|
125
|
-
</ElFormItem>
|
126
|
-
</VanTab>
|
127
|
-
</VanTabs>
|
128
|
-
|
129
|
-
<ElFormItem>
|
130
|
-
<div class="flex justify-between w-full">
|
131
|
-
<ElCheckbox v-model="SaveFlag">
|
132
|
-
三天之内免登录
|
133
|
-
</ElCheckbox>
|
134
|
-
<ElButton v-show="loginType === 'account'" type="warning" link @click="useChangePassword">
|
135
|
-
忘记密码?
|
136
|
-
</ElButton>
|
137
|
-
</div>
|
138
|
-
</ElFormItem>
|
139
|
-
</ElForm>
|
140
|
-
|
141
|
-
<VanButton type="primary" class="w-full" @click="loginHandler">
|
142
|
-
登录
|
143
|
-
</VanButton>
|
144
|
-
</ElCard>
|
145
|
-
|
146
|
-
<div v-if="SloGan" class="slogan">
|
147
|
-
{{ SloGan }}
|
148
|
-
</div>
|
149
|
-
<div class="content-wrapper">
|
150
|
-
<div class="mb-5% text-[#c0c0c0] text-16px">
|
151
|
-
{{ Version }}
|
152
|
-
</div>
|
153
|
-
</div>
|
154
|
-
</div>
|
155
|
-
</template>
|
156
|
-
|
157
|
-
<style lang="scss" scoped>
|
158
|
-
@-webkit-keyframes left-to-right {
|
159
|
-
from {
|
160
|
-
-webkit-transform: translateX(-100%);
|
161
|
-
transform: translateX(-100%);
|
162
|
-
}
|
163
|
-
|
164
|
-
to {
|
165
|
-
-webkit-transform: translateX(0);
|
166
|
-
transform: translateX(0);
|
167
|
-
}
|
168
|
-
}
|
169
|
-
|
170
|
-
@keyframes left-to-right {
|
171
|
-
from {
|
172
|
-
-webkit-transform: translateX(-100%);
|
173
|
-
transform: translateX(-100%);
|
174
|
-
}
|
175
|
-
|
176
|
-
to {
|
177
|
-
-webkit-transform: translateX(0);
|
178
|
-
transform: translateX(0);
|
179
|
-
}
|
180
|
-
}
|
181
|
-
|
182
|
-
.login-container {
|
183
|
-
@apply relative overflow-hidden h-100vh w-full;
|
184
|
-
|
185
|
-
.title {
|
186
|
-
@apply mt-10px text-[#fff] text-24px font-bold;
|
187
|
-
}
|
188
|
-
|
189
|
-
.sub-title {
|
190
|
-
@apply mt-10px text-[#f5f5f5] text-16px mb-30px;
|
191
|
-
}
|
192
|
-
|
193
|
-
.slogan {
|
194
|
-
@apply flex flex-1 justify-center items-center text-[#fff] font-500 text-26px text-shadow;
|
195
|
-
-webkit-animation: left-to-right 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
196
|
-
animation: left-to-right 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
197
|
-
}
|
198
|
-
}
|
199
|
-
</style>
|
@@ -1,179 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2023-07-25 16:44:56
|
4
|
-
* @LastEditTime: 2023-08-25 16:54:08
|
5
|
-
* @Description:
|
6
|
-
-->
|
7
|
-
<script lang="ts" setup>
|
8
|
-
import { YoungDialog, YoungPagination, YoungSearchForm, YoungSelect, YoungTablePro, useFormMode, useQuery } from '@bluesyoung/ui-vue3-element-plus'
|
9
|
-
import type { SelectOptionItem, TableDataItem, TableHeadItem, YoungSearchScheme } from '@bluesyoung/ui-vue3-element-plus'
|
10
|
-
import { deepClone } from '@bluesyoung/utils'
|
11
|
-
import { ElButton, ElTag } from 'element-plus'
|
12
|
-
|
13
|
-
definePageMeta({
|
14
|
-
title: '接口管理',
|
15
|
-
})
|
16
|
-
|
17
|
-
interface Form extends ApiItem { op?: any };
|
18
|
-
const FORM_TEMP: Form = {
|
19
|
-
id: 0,
|
20
|
-
path: '',
|
21
|
-
desc: '',
|
22
|
-
method: 'POST',
|
23
|
-
category: '',
|
24
|
-
roleIds: [],
|
25
|
-
}
|
26
|
-
const {
|
27
|
-
isAdd,
|
28
|
-
isEdit,
|
29
|
-
edit,
|
30
|
-
del,
|
31
|
-
sure,
|
32
|
-
clear,
|
33
|
-
form,
|
34
|
-
formRef,
|
35
|
-
validForm,
|
36
|
-
} = useFormMode<Form>(FORM_TEMP, {
|
37
|
-
addCbk: async () => {
|
38
|
-
const res = await validForm() as boolean
|
39
|
-
if (res) {
|
40
|
-
const v = deepClone(form.value)
|
41
|
-
await apis.post.addApiItem(v)
|
42
|
-
ElMessage.success('新增成功!')
|
43
|
-
}
|
44
|
-
return res
|
45
|
-
},
|
46
|
-
modCbk: async () => {
|
47
|
-
const res = await validForm() as boolean
|
48
|
-
if (res) {
|
49
|
-
const v = deepClone(form.value)
|
50
|
-
await apis.patch.changeApiItem(v)
|
51
|
-
ElMessage.success('修改成功!')
|
52
|
-
}
|
53
|
-
return res
|
54
|
-
},
|
55
|
-
delCbk: async (row) => {
|
56
|
-
await apis.delete.deleteApi(row.id.toString())
|
57
|
-
ElMessage.success('删除成功!')
|
58
|
-
query.value.pageNum = 1
|
59
|
-
},
|
60
|
-
cgEffect: () => getList(),
|
61
|
-
})
|
62
|
-
const tableHead: TableHeadItem<Form>[] = [
|
63
|
-
{ prop: 'id', label: '接口ID' },
|
64
|
-
{ prop: 'desc', label: '接口描述' },
|
65
|
-
{ prop: 'category', label: '接口分组' },
|
66
|
-
{ prop: 'path', label: '接口路径' },
|
67
|
-
{ prop: 'creator', label: '创建信息' },
|
68
|
-
{
|
69
|
-
prop: 'method',
|
70
|
-
label: '接口方法',
|
71
|
-
render: row => h(ElTag, {
|
72
|
-
effect: 'dark',
|
73
|
-
type: MethodObj[row.method],
|
74
|
-
},
|
75
|
-
{
|
76
|
-
default: () => row.method,
|
77
|
-
},
|
78
|
-
),
|
79
|
-
},
|
80
|
-
{
|
81
|
-
prop: 'op',
|
82
|
-
label: '操作',
|
83
|
-
render: row => h('div', [
|
84
|
-
h(ElButton, { type: 'primary', link: true, onClick: () => edit(row) }, { default: () => '编辑' }),
|
85
|
-
h(ElButton, { type: 'danger', link: true, onClick: () => del(row) }, { default: () => '删除' }),
|
86
|
-
]),
|
87
|
-
},
|
88
|
-
]
|
89
|
-
const tableData = ref<TableDataItem<Form>[]>([])
|
90
|
-
|
91
|
-
async function getList() {
|
92
|
-
const { list: role_list } = await apis.get.getRoleList({ noPagination: true })
|
93
|
-
roleList.value = (role_list || []).map((item: RoleItem) => {
|
94
|
-
return {
|
95
|
-
label: item.name,
|
96
|
-
value: item.id,
|
97
|
-
}
|
98
|
-
})
|
99
|
-
|
100
|
-
const { list, pageNum, pageSize, total } = await apis.get.getApiList(query.value)
|
101
|
-
tableData.value = deepClone(list || [])
|
102
|
-
query.value.pageNum = +pageNum || 1
|
103
|
-
query.value.pageSize = +pageSize || 50
|
104
|
-
query.value.total = +total || 0
|
105
|
-
}
|
106
|
-
|
107
|
-
type Query = BaseQuery & Partial<Form>
|
108
|
-
const { query, reset } = useQuery<Query>(
|
109
|
-
{
|
110
|
-
pageNum: 1,
|
111
|
-
pageSize: 10,
|
112
|
-
total: 0,
|
113
|
-
path: '',
|
114
|
-
},
|
115
|
-
getList,
|
116
|
-
)
|
117
|
-
const queryScheme: YoungSearchScheme<Query> = {
|
118
|
-
path: {
|
119
|
-
type: 'input',
|
120
|
-
tip: '接口路径',
|
121
|
-
attrs: {
|
122
|
-
placeholder: '请输入接口路径',
|
123
|
-
},
|
124
|
-
},
|
125
|
-
}
|
126
|
-
|
127
|
-
const roleList = ref<SelectOptionItem<number>[]>([])
|
128
|
-
|
129
|
-
useTabReOpen(getList)
|
130
|
-
</script>
|
131
|
-
|
132
|
-
<template>
|
133
|
-
<ElCard>
|
134
|
-
<YoungSearchForm v-model="query" :search-scheme="queryScheme" :on-search="getList" :on-reset="reset">
|
135
|
-
<template #btns>
|
136
|
-
<ElButton type="success" @click="isAdd = true">
|
137
|
-
添加接口
|
138
|
-
</ElButton>
|
139
|
-
</template>
|
140
|
-
</YoungSearchForm>
|
141
|
-
</ElCard>
|
142
|
-
|
143
|
-
<br>
|
144
|
-
|
145
|
-
<ElCard>
|
146
|
-
<YoungTablePro :table-data="tableData" :table-head="tableHead" />
|
147
|
-
<YoungPagination
|
148
|
-
v-model:page="query.pageNum" v-model:limit="query.pageSize" :total="query.total"
|
149
|
-
@page-change="getList"
|
150
|
-
/>
|
151
|
-
</ElCard>
|
152
|
-
<YoungDialog :is-add="isAdd" :is-edit="isEdit" :diff-form="form" width="520px" @sure="sure" @clear="clear">
|
153
|
-
<template #body>
|
154
|
-
<ElForm ref="formRef" :model="form" label-width="100px" :label-position="WindowSize['lt-lg'] ? 'top' : 'left'">
|
155
|
-
<ElFormItem label="分组名称" prop="category" :rules="{ required: true, message: '请填写分组名称', trigger: 'blur' }">
|
156
|
-
<ElInput v-model.trim="form.category" class="!w-300px" />
|
157
|
-
</ElFormItem>
|
158
|
-
<ElFormItem label="接口描述" prop="desc" :rules="{ required: true, message: '请填写接口描述', trigger: 'blur' }">
|
159
|
-
<ElInput v-model.trim="form.desc" class="!w-300px" />
|
160
|
-
</ElFormItem>
|
161
|
-
<ElFormItem label="请求方法">
|
162
|
-
<YoungSelect
|
163
|
-
v-model="form.method" class="!w-300px"
|
164
|
-
:options="Object.keys(MethodObj).map((item) => ({ label: item, value: item }))"
|
165
|
-
/>
|
166
|
-
</ElFormItem>
|
167
|
-
<ElFormItem
|
168
|
-
label="接口路径" prop="path"
|
169
|
-
:rules="{ message: '请填写合法的接口路径, eg: /user/list', trigger: 'blur', validator: (_: any, v: string) => /\/(.*)\/(.*)/.test(v) }"
|
170
|
-
>
|
171
|
-
<ElInput v-model.trim="form.path" class="!w-300px" />
|
172
|
-
</ElFormItem>
|
173
|
-
<ElFormItem label="关联角色">
|
174
|
-
<YoungSelect v-model="form.roleIds" multiple placeholder="请选择角色" class="!w-300px" :options="roleList" />
|
175
|
-
</ElFormItem>
|
176
|
-
</ElForm>
|
177
|
-
</template>
|
178
|
-
</YoungDialog>
|
179
|
-
</template>
|