create-young-proj 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. package/package.json +3 -6
  2. package/template-nuxt-admin/README.md +22 -0
  3. package/template-nuxt-admin/_gitignore +23 -0
  4. package/template-nuxt-admin/_npmrc +2 -0
  5. package/template-nuxt-admin/components/YoungChangePassword.vue +4 -4
  6. package/template-nuxt-admin/components/layout/Main.vue +2 -17
  7. package/template-nuxt-admin/components/layout/SideBar.vue +2 -3
  8. package/template-nuxt-admin/components/layout/TabsBar.vue +2 -2
  9. package/template-nuxt-admin/composables/tags.ts +26 -20
  10. package/template-nuxt-admin/middleware/auth.global.ts +15 -4
  11. package/template-nuxt-admin/package.json +9 -9
  12. package/template-nuxt-admin/pages/login.vue +5 -5
  13. package/template-nuxt-admin/pages/system/api.vue +5 -5
  14. package/template-nuxt-admin/pages/system/menuList.vue +8 -8
  15. package/template-nuxt-admin/pages/system/role.vue +5 -5
  16. package/template-nuxt-admin/pages/system/user.vue +6 -6
  17. package/template-nuxt-admin/yarn.lock +2322 -2068
  18. package/template-uni-app/README.md +20 -0
  19. package/template-uni-app/_env +1 -1
  20. package/template-uni-app/_env.development +2 -2
  21. package/template-uni-app/_env.production +0 -3
  22. package/template-uni-app/_env.test +0 -3
  23. package/template-uni-app/auto-imports.d.ts +3 -0
  24. package/template-uni-app/dist/dev/mp-weixin/apis/index.js +44 -0
  25. package/template-uni-app/dist/dev/mp-weixin/apis/lib/index.js +90 -0
  26. package/template-uni-app/dist/dev/mp-weixin/apis/requests/get.js +10 -0
  27. package/template-uni-app/dist/dev/mp-weixin/apis/requests/index.js +1 -0
  28. package/template-uni-app/dist/dev/mp-weixin/apis/requests/post.js +15 -0
  29. package/template-uni-app/dist/dev/mp-weixin/app.js +93 -0
  30. package/template-uni-app/dist/dev/mp-weixin/app.json +51 -0
  31. package/template-uni-app/dist/dev/mp-weixin/app.wxss +2378 -0
  32. package/template-uni-app/dist/dev/mp-weixin/common/assets.js +13 -0
  33. package/template-uni-app/dist/dev/mp-weixin/common/vendor.js +10189 -0
  34. package/template-uni-app/dist/dev/mp-weixin/components/young-loading/young-loading.js +22 -0
  35. package/template-uni-app/dist/dev/mp-weixin/components/young-loading/young-loading.json +4 -0
  36. package/template-uni-app/dist/dev/mp-weixin/components/young-loading/young-loading.wxml +1 -0
  37. package/template-uni-app/dist/dev/mp-weixin/components/young-loading/young-loading.wxss +0 -0
  38. package/template-uni-app/dist/dev/mp-weixin/components/young-loading-mini/young-loading-mini.js +22 -0
  39. package/template-uni-app/dist/dev/mp-weixin/components/young-loading-mini/young-loading-mini.json +4 -0
  40. package/template-uni-app/dist/dev/mp-weixin/components/young-loading-mini/young-loading-mini.wxml +1 -0
  41. package/template-uni-app/dist/dev/mp-weixin/components/young-loading-mini/young-loading-mini.wxss +0 -0
  42. package/template-uni-app/dist/dev/mp-weixin/components/young-navbar/young-navbar.js +82 -0
  43. package/template-uni-app/dist/dev/mp-weixin/components/young-navbar/young-navbar.json +4 -0
  44. package/template-uni-app/dist/dev/mp-weixin/components/young-navbar/young-navbar.wxml +1 -0
  45. package/template-uni-app/dist/dev/mp-weixin/components/young-navbar/young-navbar.wxss +108 -0
  46. package/template-uni-app/dist/dev/mp-weixin/components/young-tabbar/young-tabbar.js +56 -0
  47. package/template-uni-app/dist/dev/mp-weixin/components/young-tabbar/young-tabbar.json +4 -0
  48. package/template-uni-app/dist/dev/mp-weixin/components/young-tabbar/young-tabbar.wxml +1 -0
  49. package/template-uni-app/dist/dev/mp-weixin/components/young-tabbar/young-tabbar.wxss +88 -0
  50. package/template-uni-app/dist/dev/mp-weixin/config/enum.js +21 -0
  51. package/template-uni-app/dist/dev/mp-weixin/config/index.js +1 -0
  52. package/template-uni-app/dist/dev/mp-weixin/config/map.js +1 -0
  53. package/template-uni-app/dist/dev/mp-weixin/layouts/default.js +30 -0
  54. package/template-uni-app/dist/dev/mp-weixin/layouts/default.json +6 -0
  55. package/template-uni-app/dist/dev/mp-weixin/layouts/default.wxml +1 -0
  56. package/template-uni-app/dist/dev/mp-weixin/layouts/default.wxss +0 -0
  57. package/template-uni-app/dist/dev/mp-weixin/layouts/tabbar.js +56 -0
  58. package/template-uni-app/dist/dev/mp-weixin/layouts/tabbar.json +9 -0
  59. package/template-uni-app/dist/dev/mp-weixin/layouts/tabbar.wxml +1 -0
  60. package/template-uni-app/dist/dev/mp-weixin/layouts/tabbar.wxss +0 -0
  61. package/template-uni-app/dist/dev/mp-weixin/node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.js +98 -0
  62. package/template-uni-app/dist/dev/mp-weixin/node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.json +4 -0
  63. package/template-uni-app/dist/dev/mp-weixin/node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.wxml +1 -0
  64. package/template-uni-app/dist/dev/mp-weixin/node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.wxss +125 -0
  65. package/template-uni-app/dist/dev/mp-weixin/pages/demo/index.js +38 -0
  66. package/template-uni-app/dist/dev/mp-weixin/pages/demo/index.json +5 -0
  67. package/template-uni-app/dist/dev/mp-weixin/pages/demo/index.wxml +1 -0
  68. package/template-uni-app/dist/dev/mp-weixin/pages/demo/index.wxss +0 -0
  69. package/template-uni-app/dist/dev/mp-weixin/pages/index.js +51 -0
  70. package/template-uni-app/dist/dev/mp-weixin/pages/index.json +5 -0
  71. package/template-uni-app/dist/dev/mp-weixin/pages/index.wxml +1 -0
  72. package/template-uni-app/dist/dev/mp-weixin/pages/index.wxss +0 -0
  73. package/template-uni-app/dist/dev/mp-weixin/pages/my.js +22 -0
  74. package/template-uni-app/dist/dev/mp-weixin/pages/my.json +3 -0
  75. package/template-uni-app/dist/dev/mp-weixin/pages/my.wxml +1 -0
  76. package/template-uni-app/dist/dev/mp-weixin/pages/my.wxss +0 -0
  77. package/template-uni-app/dist/dev/mp-weixin/project.config.json +56 -0
  78. package/template-uni-app/dist/dev/mp-weixin/static/back.png +0 -0
  79. package/template-uni-app/dist/dev/mp-weixin/static/h.png +0 -0
  80. package/template-uni-app/dist/dev/mp-weixin/static/home.png +0 -0
  81. package/template-uni-app/dist/dev/mp-weixin/static/home_active.png +0 -0
  82. package/template-uni-app/dist/dev/mp-weixin/static/more.png +0 -0
  83. package/template-uni-app/dist/dev/mp-weixin/static/my.png +0 -0
  84. package/template-uni-app/dist/dev/mp-weixin/static/my_active.png +0 -0
  85. package/template-uni-app/dist/dev/mp-weixin/static/network.png +0 -0
  86. package/template-uni-app/dist/dev/mp-weixin/store/index.js +8 -0
  87. package/template-uni-app/dist/dev/mp-weixin/store/local/index.js +11 -0
  88. package/template-uni-app/dist/dev/mp-weixin/store/system.js +14 -0
  89. package/template-uni-app/dist/dev/mp-weixin/utils/modal.js +82 -0
  90. package/template-uni-app/dist/dev/mp-weixin/utils/route.js +85 -0
  91. package/template-uni-app/dist/dev/mp-weixin/utils/system.js +27 -0
  92. package/template-uni-app/src/apis/index.ts +17 -14
  93. package/template-uni-app/src/components/young-loading/young-loading.vue +6 -13
  94. package/template-uni-app/src/components/young-loading-mini/young-loading-mini.vue +3 -10
  95. package/template-uni-app/src/layouts/default.vue +2 -3
  96. package/template-uni-app/src/layouts/tabbar.vue +17 -10
  97. package/template-uni-app/src/pages/index.vue +23 -18
  98. package/template-uni-app/src/pages/my.vue +15 -8
  99. package/template-uni-app/src/pages.json +8 -2
  100. package/template-uni-app/src/store/system.ts +4 -3
  101. package/template-uni-app/src/typings/global.d.ts +7 -0
  102. package/template-uni-app/src/utils/auth.ts +71 -1
  103. package/template-uni-app/src/utils/modal.ts +30 -7
  104. package/template-vue-admin/src/views/system/menuList.vue +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-young-proj",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "create project from template",
5
5
  "main": "index.mjs",
6
6
  "bin": {
@@ -32,21 +32,18 @@
32
32
  "author": "BluesYoung-web",
33
33
  "license": "MIT",
34
34
  "devDependencies": {
35
- "bumpp": "^8.2.1",
36
- "changelogen": "^0.4.0",
35
+ "@types/node": "16",
37
36
  "cross-spawn": "^7.0.3",
38
37
  "kolorist": "^1.6.0",
39
38
  "minimist": "^1.2.7",
40
39
  "prompts": "^2.4.2",
41
40
  "rome": "^10.0.1",
42
- "unbuild": "^1.0.1",
43
- "@types/node": "16"
41
+ "unbuild": "^1.0.1"
44
42
  },
45
43
  "scripts": {
46
44
  "dev": "unbuild --stub",
47
45
  "build": "unbuild",
48
46
  "format": "rome format . --write",
49
- "release": "changelogen && bumpp --no-push",
50
47
  "push": "pnpm publish --access public"
51
48
  }
52
49
  }
@@ -1,5 +1,27 @@
1
1
  # 基于 Nuxt 3 的后台
2
2
 
3
+ ## 配套 git 提交工具
4
+
5
+ ### 安装
6
+
7
+ ```bash
8
+ npm i -g young-commit
9
+ ```
10
+
11
+ ### 使用
12
+
13
+ - 正常使用 `git add` 将要提交的文件添加到暂存区
14
+
15
+ - 提交步骤使用 `yc` 或者 `young-commit` 进行提交
16
+
17
+ #### 命令选项
18
+
19
+ - `yc -i` 初始化(仅刚创建项目时使用,会自动执行 `git init`)
20
+
21
+ - `yc -r` 进行版本发布,会根据之前的提交及最近一个 `tag` 生成 `changelog`
22
+
23
+ > **受限于 Nuxt3 的 keep-alive 机制,setup 直接执行 / onMounted 包裹的,需要替换为 useTabReOpen 包裹的**
24
+
3
25
  ## 使用响应式布局
4
26
 
5
27
  兼容 `PC` 端与移动端
@@ -0,0 +1,23 @@
1
+ # Nuxt dev/build outputs
2
+ .output
3
+ .nuxt
4
+ .nitro
5
+ .cache
6
+ dist
7
+
8
+ # Node dependencies
9
+ node_modules
10
+
11
+ # Logs
12
+ logs
13
+ *.log
14
+
15
+ # Misc
16
+ .DS_Store
17
+ .fleet
18
+ .idea
19
+
20
+ # Local env files
21
+ .env
22
+ .env.*
23
+ !.env.example
@@ -0,0 +1,2 @@
1
+ shamefully-hoist=true
2
+ strict-peer-dependencies=false
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-24 14:21:55
4
- * @LastEditTime: 2023-07-24 14:59:34
4
+ * @LastEditTime: 2023-08-02 10:38:16
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -65,16 +65,16 @@ defineExpose({
65
65
  { required: true, trigger: 'blur', message: '请输入手机号' },
66
66
  { message: '请输入合法的手机号', trigger: 'blur', validator: (_: any, v: string) => isMobile(v) }
67
67
  ]" class="mt-20px">
68
- <ElInput v-model="form.mobile" placeholder="请输入手机号" maxlength="11" class="!h-52px" clearable />
68
+ <ElInput v-model.trim="form.mobile" placeholder="请输入手机号" maxlength="11" class="!h-52px" clearable />
69
69
  </ElFormItem>
70
70
  <ElFormItem prop="vercode" :rules="[{ required: true, trigger: 'blur', message: '请输入验证码' }]">
71
- <YoungCodeInput v-model="form.vercode" :tel="form.mobile" />
71
+ <YoungCodeInput v-model.trim="form.vercode" :tel="form.mobile" />
72
72
  </ElFormItem>
73
73
  <ElFormItem prop="password" :rules="[
74
74
  { required: true, trigger: 'blur', message: '请输入密码' },
75
75
  { min: 8, max: 16, trigger: 'blur', message: '请输入8-16位字符!' }
76
76
  ]">
77
- <ElInput type="password" v-model="form.password" minlength="8" maxlength="16" placeholder="请输入密码"
77
+ <ElInput type="password" v-model.trim="form.password" minlength="8" maxlength="16" placeholder="请输入密码"
78
78
  class="!h-52px" clearable show-password @keyup.enter="sure" />
79
79
  </ElFormItem>
80
80
  </ElForm>
@@ -1,27 +1,12 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-21 11:55:27
4
- * @LastEditTime: 2023-07-28 17:15:07
4
+ * @LastEditTime: 2023-08-25 16:49:08
5
5
  * @Description:
6
6
  -->
7
- <script lang="ts" setup>
8
- const { cachedViews, visitedViews } = storeToRefs(useTagsStore());
9
- const route = useRoute();
10
- const name = computed(() => route.name);
11
- const isCached = computed(() => {
12
- // 无需缓存的界面
13
- if (route.meta.noCache) {
14
- return false;
15
- }
16
- const arr = visitedViews.value.map((view) => view.name);
17
- // 已经缓存,或者首次打开(防止二次初始化)
18
- return cachedViews.value.includes(name.value) || !arr.includes(name.value as unknown as string);
19
- });
20
- </script>
21
-
22
7
  <template>
23
8
  <main class="app-main-height w-full">
24
- <NuxtPage :keepalive="isCached" />
9
+ <NuxtPage ref="page" :keepalive="!$route.meta.noCache" />
25
10
  </main>
26
11
  </template>
27
12
 
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-21 12:25:23
4
- * @LastEditTime: 2023-07-28 17:39:48
4
+ * @LastEditTime: 2023-09-04 09:24:44
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -14,8 +14,7 @@ const { isCollapse, nav_arr } = storeToRefs(useNavStore());
14
14
 
15
15
  <ElScrollbar>
16
16
  <ElMenu background-color="#001529" text-color="hsla(0,0%,100%,.65)" active-text-color="#fff" unique-opened
17
- :collapse="isCollapse || WindowSize['lt-lg']" :menu-trigger="WindowSize['lt-lg'] ? 'click' : 'hover'"
18
- :collapse-transition="false">
17
+ :collapse="isCollapse || WindowSize['lt-lg']" menu-trigger="click" :collapse-transition="false">
19
18
  <LayoutSubMenu :menuList="nav_arr" />
20
19
  </ElMenu>
21
20
  </ElScrollbar>
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-21 17:05:40
4
- * @LastEditTime: 2023-07-23 17:00:42
4
+ * @LastEditTime: 2023-09-04 09:27:21
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -61,7 +61,7 @@ const closeAllTab = () => {
61
61
  <template>
62
62
  <div class="tabs-bar-container">
63
63
  <div class="tabs-content">
64
- <ElTabs v-if="visitedViews.length > 0" type="card" v-model="$route.path" @tab-click="tabClick"
64
+ <ElTabs v-if="visitedViews.length > 0" type="card" :model-value="$route.path" @tab-click="tabClick"
65
65
  @tab-remove="removeTab">
66
66
  <ElTabPane v-for="item in visitedViews" type="card" :key="item.path" :path="item.path"
67
67
  :label="(item.meta.title as string)" :name="item.path" :closable="!isAffix(item)">
@@ -1,31 +1,37 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-21 17:13:59
4
- * @LastEditTime: 2023-07-21 17:18:41
4
+ * @LastEditTime: 2023-08-25 16:49:28
5
5
  * @Description:
6
6
  */
7
7
  import type { RouteLocationNormalized } from 'vue-router';
8
8
 
9
- type CachedView = string | symbol | null | undefined;
9
+ // hack nuxt3 keep-alive 没办法像 vue3 那样自由控制
10
+ export const useTabReOpen = (cbk: Function = () => console.log('this tab page is reopen')) => {
11
+ const tagState = useTagsStore();
12
+ const route = useRoute();
13
+
14
+ tagState.$onAction(({ name, args, after }) => {
15
+ if (name === 'addToCache') {
16
+ if (args[0].name === route.name) {
17
+ after(() => cbk());
18
+ }
19
+ }
20
+ });
21
+
22
+ cbk();
23
+ };
10
24
 
11
- interface TagsViewState {
12
- /**
13
- * 访问过的页面,路由对象
14
- */
15
- visitedViews: RouteLocationNormalized[];
16
- /**
17
- * 已缓存的页面名称
18
- */
19
- cachedViews: CachedView[];
20
- }
21
25
  // @ts-ignore
22
26
  export const useTagsStore = defineStore('useTagsStore', {
23
27
  state: () => {
24
- const state = reactive<TagsViewState>({
25
- visitedViews: [],
26
- cachedViews: [],
27
- });
28
- return state;
28
+ const visitedViews = ref<RouteLocationNormalized[]>([]);
29
+ const cachedViews = ref<string[]>([]);
30
+
31
+ return {
32
+ visitedViews,
33
+ cachedViews,
34
+ };
29
35
  },
30
36
  actions: {
31
37
  /**
@@ -54,10 +60,10 @@ export const useTagsStore = defineStore('useTagsStore', {
54
60
  */
55
61
  addToCache(view: RouteLocationNormalized) {
56
62
  // 查询该标签是否已缓存
57
- if (this.cachedViews.includes(view.name)) {
63
+ if (this.cachedViews.includes(view.name as string)) {
58
64
  null;
59
65
  } else if (!view.meta?.noCache) {
60
- this.cachedViews.push(view.name);
66
+ this.cachedViews.push(view.name as string);
61
67
  }
62
68
  },
63
69
  /**
@@ -80,7 +86,7 @@ export const useTagsStore = defineStore('useTagsStore', {
80
86
  * 删除页面缓存
81
87
  */
82
88
  delCachedView(view: RouteLocationNormalized) {
83
- const index = this.cachedViews.indexOf(view.name);
89
+ const index = this.cachedViews.indexOf(view.name as string);
84
90
  index > -1 && this.cachedViews.splice(index, 1);
85
91
  },
86
92
  /**
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-21 10:02:19
4
- * @LastEditTime: 2023-07-31 12:16:20
4
+ * @LastEditTime: 2023-08-02 14:57:03
5
5
  * @Description:
6
6
  */
7
7
  export default defineNuxtRouteMiddleware(async (to, from) => {
@@ -9,17 +9,27 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
9
9
  throw createError({ message: '页面不存在', statusCode: 404 });
10
10
  }
11
11
 
12
+ const { hasLogin } = storeToRefs(useUserStore());
13
+ const { nav_arr, flat_nav_arr } = storeToRefs(useNavStore());
14
+
15
+ const changeTitle = () => {
16
+ const nav = flat_nav_arr.value.find((item) => item.component === to.path);
17
+ if (nav && nav.title) {
18
+ to.meta.title = nav.title;
19
+ }
20
+
21
+ document.title = (to.meta.title as string) || window.__YOUNG_ENV__.NUXT_PUBLIC_TITLE;
22
+ };
23
+
12
24
  const { addView } = useTagsStore();
13
25
 
14
26
  // 页面无需登录
15
27
  if (to.meta.auth === false) {
28
+ changeTitle();
16
29
  addView(to);
17
30
  return;
18
31
  }
19
32
 
20
- const { hasLogin } = storeToRefs(useUserStore());
21
- const { nav_arr } = storeToRefs(useNavStore());
22
-
23
33
  if (!hasLogin.value && to.path !== '/login') {
24
34
  // 页面需要登录,但是未登录
25
35
  showFailToast('未登录或登录过期,请重新登录');
@@ -30,6 +40,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
30
40
  } else {
31
41
  nav_arr.value.length === 0 && (await generateNavData());
32
42
  if (hasPermission(to.path)) {
43
+ changeTitle();
33
44
  addView(to);
34
45
  return;
35
46
  } else {
@@ -3,36 +3,36 @@
3
3
  "private": true,
4
4
  "scripts": {
5
5
  "build": "nuxt build",
6
- "dev": "nuxt dev",
6
+ "dev": "nuxt dev --host",
7
7
  "generate": "nuxt generate",
8
- "preview": "nuxt preview",
8
+ "preview": "nuxt preview --host",
9
9
  "postinstall": "nuxt prepare"
10
10
  },
11
11
  "devDependencies": {
12
12
  "@bluesyoung/logger": "^0.0.1",
13
13
  "@element-plus/nuxt": "^1.0.5",
14
14
  "@iconify/json": "^2.2.93",
15
- "@nuxt/devtools": "^0.7.2",
15
+ "@nuxt/devtools": "^0.8.2",
16
16
  "@pinia/nuxt": "^0.4.11",
17
17
  "@types/file-saver": "^2.0.5",
18
- "@types/node": "18",
18
+ "@types/node": "20.5.7",
19
19
  "@types/qrcode": "^1.5.1",
20
- "@unocss/nuxt": "^0.53.5",
20
+ "@unocss/nuxt": "^0.55.4",
21
21
  "@vant/nuxt": "^1.0.2",
22
22
  "@vueuse/nuxt": "^10.2.1",
23
23
  "dayjs": "^1.11.9",
24
24
  "element-plus": "^2.3.8",
25
- "nuxt": "^3.6.5",
25
+ "nuxt": "^3.7.0",
26
26
  "nuxt-lazy-load": "^3.0.4",
27
27
  "pinia": "^2.1.4",
28
28
  "sass": "^1.64.0",
29
29
  "vant": "^4.6.2"
30
30
  },
31
31
  "dependencies": {
32
- "@bluesyoung/http": "0.3.1",
32
+ "@bluesyoung/http": "0.3.4",
33
33
  "@bluesyoung/ui-vue3": "^0.1.1",
34
- "@bluesyoung/ui-vue3-element-plus": "0.11.1",
35
- "@bluesyoung/utils": "^0.1.0",
34
+ "@bluesyoung/ui-vue3-element-plus": "0.11.5",
35
+ "@bluesyoung/utils": "^0.2.1",
36
36
  "c12": "^1.4.2",
37
37
  "file-saver": "^2.0.5",
38
38
  "http-proxy": "^1.18.1",
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-21 10:03:11
4
- * @LastEditTime: 2023-07-28 11:06:30
4
+ * @LastEditTime: 2023-08-02 10:39:05
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -87,13 +87,13 @@ onMounted(() => {
87
87
  { required: true, trigger: 'blur', message: '请输入手机号' },
88
88
  { message: '请输入合法的手机号', trigger: 'blur', validator: (_: any, v: string) => isMobile(v) }
89
89
  ]" class="mt-20px">
90
- <ElInput v-model="form.mobile" placeholder="请输入手机号" maxlength="11" class="!h-52px" clearable />
90
+ <ElInput v-model.trim="form.mobile" placeholder="请输入手机号" maxlength="11" class="!h-52px" clearable />
91
91
  </ElFormItem>
92
92
  <ElFormItem v-if="loginType === 'account'" prop="password" :rules="[
93
93
  { required: true, trigger: 'blur', message: '请输入密码' },
94
94
  { min: 8, max: 16, trigger: 'blur', message: '请输入8-16位字符!' }
95
95
  ]">
96
- <ElInput type="password" v-model="form.password" minlength="8" maxlength="16" placeholder="请输入密码"
96
+ <ElInput type="password" v-model.trim="form.password" minlength="8" maxlength="16" placeholder="请输入密码"
97
97
  class="!h-52px" clearable show-password @keyup.enter="loginHandler" />
98
98
  </ElFormItem>
99
99
  </VanTab>
@@ -102,11 +102,11 @@ onMounted(() => {
102
102
  { required: true, trigger: 'blur', message: '请输入手机号' },
103
103
  { message: '请输入合法的手机号', trigger: 'blur', validator: (_: any, v: string) => isMobile(v) }
104
104
  ]" class="mt-20px">
105
- <ElInput v-model="form.mobile" placeholder="请输入手机号" maxlength="11" class="!h-52px" clearable />
105
+ <ElInput v-model.trim="form.mobile" placeholder="请输入手机号" maxlength="11" class="!h-52px" clearable />
106
106
  </ElFormItem>
107
107
  <ElFormItem v-if="loginType === 'code'" prop="vercode"
108
108
  :rules="[{ required: true, trigger: 'blur', message: '请输入验证码' }]">
109
- <YoungCodeInput v-model="form.vercode" :tel="form.mobile" @enter="loginHandler" />
109
+ <YoungCodeInput v-model.trim="form.vercode" :tel="form.mobile" @enter="loginHandler" />
110
110
  </ElFormItem>
111
111
  </VanTab>
112
112
  </VanTabs>
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-25 16:44:56
4
- * @LastEditTime: 2023-07-31 11:36:37
4
+ * @LastEditTime: 2023-08-25 16:54:08
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -122,7 +122,7 @@ const queryScheme: YoungSearchScheme<Query> = {
122
122
 
123
123
  const roleList = ref<SelectOptionItem<number>[]>([]);
124
124
 
125
- getList();
125
+ useTabReOpen(getList);
126
126
  </script>
127
127
  <template>
128
128
  <ElCard>
@@ -144,10 +144,10 @@ getList();
144
144
  <template #body>
145
145
  <ElForm ref="formRef" :model="form" label-width="100px" :label-position="WindowSize['lt-lg'] ? 'top' : 'left'">
146
146
  <ElFormItem label="分组名称" prop="category" :rules="{ required: true, message: '请填写分组名称', trigger: 'blur' }">
147
- <ElInput v-model="form.category" class="!w-300px" />
147
+ <ElInput v-model.trim="form.category" class="!w-300px" />
148
148
  </ElFormItem>
149
149
  <ElFormItem label="接口描述" prop="desc" :rules="{ required: true, message: '请填写接口描述', trigger: 'blur' }">
150
- <ElInput v-model="form.desc" class="!w-300px" />
150
+ <ElInput v-model.trim="form.desc" class="!w-300px" />
151
151
  </ElFormItem>
152
152
  <ElFormItem label="请求方法">
153
153
  <YoungSelect v-model="form.method" class="!w-300px"
@@ -155,7 +155,7 @@ getList();
155
155
  </ElFormItem>
156
156
  <ElFormItem label="接口路径" prop="path"
157
157
  :rules="{ message: '请填写合法的接口路径, eg: /user/list', trigger: 'blur', validator: (_: any, v: string) => /\/(.*)\/(.*)/.test(v) }">
158
- <ElInput v-model="form.path" class="!w-300px" />
158
+ <ElInput v-model.trim="form.path" class="!w-300px" />
159
159
  </ElFormItem>
160
160
  <ElFormItem label="关联角色">
161
161
  <YoungSelect v-model="form.roleIds" multiple placeholder="请选择角色" class="!w-300px" :options="roleList" />
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-25 16:45:17
4
- * @LastEditTime: 2023-07-31 14:21:34
4
+ * @LastEditTime: 2023-08-25 16:55:00
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -66,10 +66,10 @@ const topMenuOption = ref<Partial<NavArrItem>[]>([]);
66
66
  /**
67
67
  * 生成节点映射
68
68
  */
69
- const nodeMap = new Map<string | number, NavArrItem>();
69
+ const nodeMap = new Map<string, NavArrItem>();
70
70
  const generateNodeMap = (list: NavArrItem[]) => {
71
71
  for (const node of list) {
72
- nodeMap.set(node.id, node);
72
+ nodeMap.set(node.id.toString(), node);
73
73
  if (node.children && node.children?.length > 0) {
74
74
  generateNodeMap(node.children);
75
75
  }
@@ -261,7 +261,7 @@ const tableHead: TableHeadItem<NavArrItem>[] = [
261
261
  }
262
262
  ];
263
263
 
264
- getList();
264
+ useTabReOpen(getList);
265
265
  </script>
266
266
 
267
267
  <template>
@@ -287,10 +287,10 @@ getList();
287
287
  @update:model-value="(e: any) => form.parentId = e[e.length - 1]" />
288
288
  </ElFormItem>
289
289
  <ElFormItem label="英文名称" prop="name" :rules="{ required: true, message: '请输入英文名', trigger: 'blur' }">
290
- <ElInput v-model="form.name" placeholder="请输入英文名" />
290
+ <ElInput v-model.trim="form.name" placeholder="请输入英文名" />
291
291
  </ElFormItem>
292
292
  <ElFormItem label="标题" prop="title" :rules="{ required: true, message: '请输入页面标题', trigger: 'blur' }">
293
- <ElInput v-model="form.title" placeholder="请输入页面标题" />
293
+ <ElInput v-model.trim="form.title" placeholder="请输入页面标题" />
294
294
  </ElFormItem>
295
295
  <ElFormItem label="图标">
296
296
  <ElSelect v-model="form.icon" class="select_icon" placeholder="请选择图标">
@@ -303,7 +303,7 @@ getList();
303
303
  </ElSelect>
304
304
  </ElFormItem>
305
305
  <ElFormItem label="排序">
306
- <ElInput v-model.number="form.sort" />
306
+ <ElInputNumber v-model.number="form.sort" />
307
307
  </ElFormItem>
308
308
  <ElFormItem label="是否显示">
309
309
  <ElRadioGroup v-model="form.visible">
@@ -314,7 +314,7 @@ getList();
314
314
  <ElFormItem label="路径" prop="component" :rules="form.parentId === 0 ? {} :
315
315
  { message: '请输入合法的路径, eg: /path/page', trigger: 'blur', validator: (_: any, v: string) => v.trim() === '' || /\/(.*)\/(.*)/.test(v) }
316
316
  ">
317
- <ElInput v-model="form.component" />
317
+ <ElInput v-model.trim="form.component" />
318
318
  </ElFormItem>
319
319
  </ElForm>
320
320
  </template>
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-25 16:45:39
4
- * @LastEditTime: 2023-07-31 11:05:49
4
+ * @LastEditTime: 2023-08-25 16:55:10
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -27,7 +27,7 @@ const { showPriority, menu } = useRoleMenu();
27
27
 
28
28
  const { showApi, api } = useRoleApi();
29
29
 
30
- getList();
30
+ useTabReOpen(getList);
31
31
  </script>
32
32
 
33
33
  <template>
@@ -64,13 +64,13 @@ getList();
64
64
  <ElForm ref="baseFormRef" :model="base.form" label-width="120px"
65
65
  :label-position="WindowSize['lt-lg'] ? 'top' : 'left'">
66
66
  <ElFormItem label="角色名称(中文)" prop="name" :rules="[{ required: true, message: '请填写角色名称', trigger: 'blur' }]">
67
- <ElInput v-model="base.form.name" class="!w-300px" />
67
+ <ElInput v-model.trim="base.form.name" class="!w-300px" />
68
68
  </ElFormItem>
69
69
  <ElFormItem label="关键字(英文)" prop="keyword" :rules="[{ required: true, message: '请填写关键字', trigger: 'blur' }]">
70
- <ElInput v-model="base.form.keyword" class="!w-300px" />
70
+ <ElInput v-model.trim="base.form.keyword" class="!w-300px" />
71
71
  </ElFormItem>
72
72
  <ElFormItem label="角色描述">
73
- <ElInput v-model="base.form.desc" class="!w-300px" />
73
+ <ElInput v-model.trim="base.form.desc" class="!w-300px" />
74
74
  </ElFormItem>
75
75
  </ElForm>
76
76
  </template>
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-25 16:46:00
4
- * @LastEditTime: 2023-07-31 14:39:16
4
+ * @LastEditTime: 2023-08-25 16:55:17
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -170,7 +170,7 @@ const queryScheme: YoungSearchScheme<Query> = {
170
170
 
171
171
  const roleList = ref<SelectOptionItem<number>[]>([]);
172
172
 
173
- getList();
173
+ useTabReOpen(getList);
174
174
  </script>
175
175
  <template>
176
176
  <ElCard>
@@ -193,20 +193,20 @@ getList();
193
193
  <template #body>
194
194
  <ElForm ref="formRef" :model="form" label-width="100px" :label-position="WindowSize['lt-lg'] ? 'top' : 'left'">
195
195
  <ElFormItem label="用户名" prop="username" :rules="{ required: true, message: '请输用户名', trigger: 'blur' }">
196
- <ElInput v-model="form.username" class="!w-300px" />
196
+ <ElInput v-model.trim="form.username" class="!w-300px" />
197
197
  </ElFormItem>
198
198
  <ElFormItem label="昵称" prop="nickname" :rules="{ required: true, message: '请输昵称(用于右上角展示)', trigger: 'blur' }">
199
- <ElInput v-model="form.nickname" class="!w-300px" />
199
+ <ElInput v-model.trim="form.nickname" class="!w-300px" />
200
200
  </ElFormItem>
201
201
  <ElFormItem label="手机号" prop="mobile" :rules="{ required: true, message: '请输手机号', trigger: 'blur' }">
202
- <ElInput v-model="form.mobile" :maxlength="11" class="!w-300px" />
202
+ <ElInput v-model.trim="form.mobile" :maxlength="11" class="!w-300px" />
203
203
  </ElFormItem>
204
204
  <ElFormItem label="角色">
205
205
  <YoungSelect v-model="form.roleId" placeholder="请选择角色" :options="roleList" />
206
206
  </ElFormItem>
207
207
  <ElFormItem v-if="isAdd" label="初始密码" prop="initPassword"
208
208
  :rules="{ required: true, message: '请输初始密码', trigger: 'blur' }">
209
- <ElInput v-model="form.initPassword" class="!w-300px" />
209
+ <ElInput v-model.trim="form.initPassword" class="!w-300px" />
210
210
  </ElFormItem>
211
211
  </ElForm>
212
212
  </template>