create-young-proj 0.6.1 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. package/README.md +5 -3
  2. package/dist/index.mjs +9 -9
  3. package/package.json +3 -6
  4. package/template-nuxt-admin/Dockerfile +41 -0
  5. package/template-nuxt-admin/README.md +57 -0
  6. package/template-nuxt-admin/_gitignore +23 -0
  7. package/template-nuxt-admin/_npmrc +2 -0
  8. package/template-nuxt-admin/app.vue +41 -0
  9. package/template-nuxt-admin/boot.mjs +16 -0
  10. package/template-nuxt-admin/components/ScreenFull.vue +18 -0
  11. package/template-nuxt-admin/components/TopSearch.vue +73 -0
  12. package/template-nuxt-admin/components/TopUser.vue +69 -0
  13. package/template-nuxt-admin/components/YoungChangePassword.vue +87 -0
  14. package/template-nuxt-admin/components/YoungCodeInput.vue +60 -0
  15. package/template-nuxt-admin/components/YoungLink.vue +23 -0
  16. package/template-nuxt-admin/components/YoungLoading.vue +39 -0
  17. package/template-nuxt-admin/components/layout/Footer.vue +29 -0
  18. package/template-nuxt-admin/components/layout/Logo.vue +52 -0
  19. package/template-nuxt-admin/components/layout/Main.vue +26 -0
  20. package/template-nuxt-admin/components/layout/NavBar.vue +77 -0
  21. package/template-nuxt-admin/components/layout/SideBar.vue +89 -0
  22. package/template-nuxt-admin/components/layout/SubMenu.vue +46 -0
  23. package/template-nuxt-admin/components/layout/TabsBar.vue +183 -0
  24. package/template-nuxt-admin/composables/api.ts +104 -0
  25. package/template-nuxt-admin/composables/apis/delete.ts +37 -0
  26. package/template-nuxt-admin/composables/apis/get.ts +83 -0
  27. package/template-nuxt-admin/composables/apis/index.ts +10 -0
  28. package/template-nuxt-admin/composables/apis/patch.ts +74 -0
  29. package/template-nuxt-admin/composables/apis/post.ts +85 -0
  30. package/template-nuxt-admin/composables/config.ts +13 -0
  31. package/template-nuxt-admin/composables/icon.ts +27 -0
  32. package/template-nuxt-admin/composables/nav.ts +60 -0
  33. package/template-nuxt-admin/composables/tags.ts +114 -0
  34. package/template-nuxt-admin/composables/user.ts +29 -0
  35. package/template-nuxt-admin/config/.devrc +1 -0
  36. package/template-nuxt-admin/config/.onlinerc +1 -0
  37. package/template-nuxt-admin/config/.testrc +1 -0
  38. package/template-nuxt-admin/env.d.ts +47 -0
  39. package/template-nuxt-admin/error.vue +53 -0
  40. package/template-nuxt-admin/layouts/blank.vue +9 -0
  41. package/template-nuxt-admin/layouts/default.vue +124 -0
  42. package/template-nuxt-admin/middleware/auth.global.ts +50 -0
  43. package/template-nuxt-admin/nuxt.config.ts +101 -0
  44. package/template-nuxt-admin/package.json +44 -0
  45. package/template-nuxt-admin/pages/home/[id].vue +28 -0
  46. package/template-nuxt-admin/pages/index.vue +20 -0
  47. package/template-nuxt-admin/pages/login.vue +179 -0
  48. package/template-nuxt-admin/pages/system/api.vue +166 -0
  49. package/template-nuxt-admin/pages/system/hooks/useRole.ts +336 -0
  50. package/template-nuxt-admin/pages/system/menuList.vue +329 -0
  51. package/template-nuxt-admin/pages/system/role.vue +117 -0
  52. package/template-nuxt-admin/pages/system/user.vue +214 -0
  53. package/template-nuxt-admin/plugins/directive.ts +26 -0
  54. package/template-nuxt-admin/public/default_avatar.svg +1 -0
  55. package/template-nuxt-admin/public/favicon.ico +0 -0
  56. package/template-nuxt-admin/public/image_placeholder.svg +15 -0
  57. package/template-nuxt-admin/public/tabbar_bg.png +0 -0
  58. package/template-nuxt-admin/rome.json +26 -0
  59. package/template-nuxt-admin/server/api/[...all].ts +10 -0
  60. package/template-nuxt-admin/server/plugins/env.ts +89 -0
  61. package/template-nuxt-admin/server/routes/get/env.ts +13 -0
  62. package/template-nuxt-admin/server/tsconfig.json +3 -0
  63. package/template-nuxt-admin/server/utils/index.ts +35 -0
  64. package/template-nuxt-admin/styles/element.scss +30 -0
  65. package/template-nuxt-admin/styles/index.scss +59 -0
  66. package/template-nuxt-admin/styles/variable.scss +103 -0
  67. package/template-nuxt-admin/tsconfig.json +7 -0
  68. package/template-nuxt-admin/typings/global.d.ts +16 -0
  69. package/template-nuxt-admin/typings/system.d.ts +66 -0
  70. package/template-nuxt-admin/typings/user.d.ts +19 -0
  71. package/template-nuxt-admin/uno.config.ts +40 -0
  72. package/template-nuxt-admin/utils/tool.ts +207 -0
  73. package/template-nuxt-admin/yarn.lock +7103 -0
  74. package/template-uni-app/README.md +20 -0
  75. package/template-uni-app/_env +1 -1
  76. package/template-uni-app/_env.development +2 -2
  77. package/template-uni-app/_env.production +0 -3
  78. package/template-uni-app/_env.test +0 -3
  79. package/template-uni-app/_npmrc +2 -0
  80. package/template-uni-app/auto-imports.d.ts +3 -0
  81. package/template-uni-app/dist/dev/mp-weixin/apis/index.js +44 -0
  82. package/template-uni-app/dist/dev/mp-weixin/apis/lib/index.js +90 -0
  83. package/template-uni-app/dist/dev/mp-weixin/apis/requests/get.js +10 -0
  84. package/template-uni-app/dist/dev/mp-weixin/apis/requests/index.js +1 -0
  85. package/template-uni-app/dist/dev/mp-weixin/apis/requests/post.js +15 -0
  86. package/template-uni-app/dist/dev/mp-weixin/app.js +93 -0
  87. package/template-uni-app/dist/dev/mp-weixin/app.json +51 -0
  88. package/template-uni-app/dist/dev/mp-weixin/app.wxss +2378 -0
  89. package/template-uni-app/dist/dev/mp-weixin/common/assets.js +13 -0
  90. package/template-uni-app/dist/dev/mp-weixin/common/vendor.js +10189 -0
  91. package/template-uni-app/dist/dev/mp-weixin/components/young-loading/young-loading.js +22 -0
  92. package/template-uni-app/dist/dev/mp-weixin/components/young-loading/young-loading.json +4 -0
  93. package/template-uni-app/dist/dev/mp-weixin/components/young-loading/young-loading.wxml +1 -0
  94. package/template-uni-app/dist/dev/mp-weixin/components/young-loading/young-loading.wxss +0 -0
  95. package/template-uni-app/dist/dev/mp-weixin/components/young-loading-mini/young-loading-mini.js +22 -0
  96. package/template-uni-app/dist/dev/mp-weixin/components/young-loading-mini/young-loading-mini.json +4 -0
  97. package/template-uni-app/dist/dev/mp-weixin/components/young-loading-mini/young-loading-mini.wxml +1 -0
  98. package/template-uni-app/dist/dev/mp-weixin/components/young-loading-mini/young-loading-mini.wxss +0 -0
  99. package/template-uni-app/dist/dev/mp-weixin/components/young-navbar/young-navbar.js +82 -0
  100. package/template-uni-app/dist/dev/mp-weixin/components/young-navbar/young-navbar.json +4 -0
  101. package/template-uni-app/dist/dev/mp-weixin/components/young-navbar/young-navbar.wxml +1 -0
  102. package/template-uni-app/dist/dev/mp-weixin/components/young-navbar/young-navbar.wxss +108 -0
  103. package/template-uni-app/dist/dev/mp-weixin/components/young-tabbar/young-tabbar.js +56 -0
  104. package/template-uni-app/dist/dev/mp-weixin/components/young-tabbar/young-tabbar.json +4 -0
  105. package/template-uni-app/dist/dev/mp-weixin/components/young-tabbar/young-tabbar.wxml +1 -0
  106. package/template-uni-app/dist/dev/mp-weixin/components/young-tabbar/young-tabbar.wxss +88 -0
  107. package/template-uni-app/dist/dev/mp-weixin/config/enum.js +21 -0
  108. package/template-uni-app/dist/dev/mp-weixin/config/index.js +1 -0
  109. package/template-uni-app/dist/dev/mp-weixin/config/map.js +1 -0
  110. package/template-uni-app/dist/dev/mp-weixin/layouts/default.js +30 -0
  111. package/template-uni-app/dist/dev/mp-weixin/layouts/default.json +6 -0
  112. package/template-uni-app/dist/dev/mp-weixin/layouts/default.wxml +1 -0
  113. package/template-uni-app/dist/dev/mp-weixin/layouts/default.wxss +0 -0
  114. package/template-uni-app/dist/dev/mp-weixin/layouts/tabbar.js +56 -0
  115. package/template-uni-app/dist/dev/mp-weixin/layouts/tabbar.json +9 -0
  116. package/template-uni-app/dist/dev/mp-weixin/layouts/tabbar.wxml +1 -0
  117. package/template-uni-app/dist/dev/mp-weixin/layouts/tabbar.wxss +0 -0
  118. package/template-uni-app/dist/dev/mp-weixin/node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.js +98 -0
  119. package/template-uni-app/dist/dev/mp-weixin/node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.json +4 -0
  120. package/template-uni-app/dist/dev/mp-weixin/node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.wxml +1 -0
  121. package/template-uni-app/dist/dev/mp-weixin/node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.wxss +125 -0
  122. package/template-uni-app/dist/dev/mp-weixin/pages/demo/index.js +38 -0
  123. package/template-uni-app/dist/dev/mp-weixin/pages/demo/index.json +5 -0
  124. package/template-uni-app/dist/dev/mp-weixin/pages/demo/index.wxml +1 -0
  125. package/template-uni-app/dist/dev/mp-weixin/pages/demo/index.wxss +0 -0
  126. package/template-uni-app/dist/dev/mp-weixin/pages/index.js +51 -0
  127. package/template-uni-app/dist/dev/mp-weixin/pages/index.json +5 -0
  128. package/template-uni-app/dist/dev/mp-weixin/pages/index.wxml +1 -0
  129. package/template-uni-app/dist/dev/mp-weixin/pages/index.wxss +0 -0
  130. package/template-uni-app/dist/dev/mp-weixin/pages/my.js +22 -0
  131. package/template-uni-app/dist/dev/mp-weixin/pages/my.json +3 -0
  132. package/template-uni-app/dist/dev/mp-weixin/pages/my.wxml +1 -0
  133. package/template-uni-app/dist/dev/mp-weixin/pages/my.wxss +0 -0
  134. package/template-uni-app/dist/dev/mp-weixin/project.config.json +56 -0
  135. package/template-uni-app/dist/dev/mp-weixin/static/back.png +0 -0
  136. package/template-uni-app/dist/dev/mp-weixin/static/h.png +0 -0
  137. package/template-uni-app/dist/dev/mp-weixin/static/home.png +0 -0
  138. package/template-uni-app/dist/dev/mp-weixin/static/home_active.png +0 -0
  139. package/template-uni-app/dist/dev/mp-weixin/static/more.png +0 -0
  140. package/template-uni-app/dist/dev/mp-weixin/static/my.png +0 -0
  141. package/template-uni-app/dist/dev/mp-weixin/static/my_active.png +0 -0
  142. package/template-uni-app/dist/dev/mp-weixin/static/network.png +0 -0
  143. package/template-uni-app/dist/dev/mp-weixin/store/index.js +8 -0
  144. package/template-uni-app/dist/dev/mp-weixin/store/local/index.js +11 -0
  145. package/template-uni-app/dist/dev/mp-weixin/store/system.js +14 -0
  146. package/template-uni-app/dist/dev/mp-weixin/utils/modal.js +82 -0
  147. package/template-uni-app/dist/dev/mp-weixin/utils/route.js +85 -0
  148. package/template-uni-app/dist/dev/mp-weixin/utils/system.js +27 -0
  149. package/template-uni-app/src/apis/index.ts +17 -14
  150. package/template-uni-app/src/components/young-loading/young-loading.vue +6 -13
  151. package/template-uni-app/src/components/young-loading-mini/young-loading-mini.vue +3 -10
  152. package/template-uni-app/src/layouts/default.vue +2 -3
  153. package/template-uni-app/src/layouts/tabbar.vue +22 -15
  154. package/template-uni-app/src/pages/index.vue +12 -3
  155. package/template-uni-app/src/pages/my.vue +15 -12
  156. package/template-uni-app/src/pages.json +8 -2
  157. package/template-uni-app/src/store/system.ts +4 -3
  158. package/template-uni-app/src/typings/global.d.ts +7 -0
  159. package/template-uni-app/src/utils/auth.ts +71 -1
  160. package/template-uni-app/src/utils/modal.ts +30 -7
  161. package/template-vue-admin/src/views/system/menuList.vue +3 -3
@@ -0,0 +1,87 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2023-07-24 14:21:55
4
+ * @LastEditTime: 2023-08-02 10:38:16
5
+ * @Description:
6
+ -->
7
+ <script lang="ts" setup>
8
+ import { isMobile } from '@bluesyoung/utils';
9
+ import type { FormInstance } from 'element-plus';
10
+
11
+ type Props = {
12
+ onDestroy?: Function;
13
+ };
14
+
15
+ const props = withDefaults(defineProps<Props>(), {
16
+ onDestroy: () => console.log('为了节省性能,此时应该销毁dom'),
17
+ });
18
+
19
+ const showPopup = ref(false);
20
+
21
+ const show = () => {
22
+ showPopup.value = true;
23
+ };
24
+
25
+ const hide = () => {
26
+ showPopup.value = false;
27
+ props.onDestroy();
28
+ };
29
+
30
+ const form = reactive<LoginForm>({
31
+ mobile: '',
32
+ vercode: '',
33
+ password: '',
34
+ });
35
+
36
+ const { cookie } = storeToRefs(useUserStore());
37
+
38
+ const formRef = ref<FormInstance>();
39
+ const sure = () => {
40
+ formRef.value?.validate(async (valid) => {
41
+ if (valid) {
42
+ await apis.post.changePassword(form);
43
+ hide();
44
+ await showDialog({
45
+ message: '密码修改成功,请重新登录'
46
+ })
47
+ // @ts-ignore
48
+ cookie.value = undefined;
49
+ const redirect = location.pathname === '/login' ? '/' : encodeURIComponent(location.href.replace(location.origin, ''));
50
+ navigateTo(`/login?redirect=${redirect}`);
51
+ }
52
+ });
53
+ };
54
+
55
+ defineExpose({
56
+ show
57
+ });
58
+ </script>
59
+
60
+ <template>
61
+ <ElDialog v-model="showPopup" title="修改密码" :before-close="hide" width="430px" lt-sm="!w-[96%]">
62
+ <template #default>
63
+ <ElForm ref="formRef" :model="form">
64
+ <ElFormItem prop="mobile" :rules="[
65
+ { required: true, trigger: 'blur', message: '请输入手机号' },
66
+ { message: '请输入合法的手机号', trigger: 'blur', validator: (_: any, v: string) => isMobile(v) }
67
+ ]" class="mt-20px">
68
+ <ElInput v-model.trim="form.mobile" placeholder="请输入手机号" maxlength="11" class="!h-52px" clearable />
69
+ </ElFormItem>
70
+ <ElFormItem prop="vercode" :rules="[{ required: true, trigger: 'blur', message: '请输入验证码' }]">
71
+ <YoungCodeInput v-model.trim="form.vercode" :tel="form.mobile" />
72
+ </ElFormItem>
73
+ <ElFormItem prop="password" :rules="[
74
+ { required: true, trigger: 'blur', message: '请输入密码' },
75
+ { min: 8, max: 16, trigger: 'blur', message: '请输入8-16位字符!' }
76
+ ]">
77
+ <ElInput type="password" v-model.trim="form.password" minlength="8" maxlength="16" placeholder="请输入密码"
78
+ class="!h-52px" clearable show-password @keyup.enter="sure" />
79
+ </ElFormItem>
80
+ </ElForm>
81
+ </template>
82
+ <template #footer>
83
+ <ElButton @click="hide">取消</ElButton>
84
+ <ElButton type="primary" @click="sure">确认</ElButton>
85
+ </template>
86
+ </ElDialog>
87
+ </template>
@@ -0,0 +1,60 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2022-08-19 13:52:58
4
+ * @LastEditTime: 2023-07-24 11:57:12
5
+ * @Description:
6
+ -->
7
+ <script lang="ts" setup>
8
+ import { YoungSlideVerify } from '@bluesyoung/ui-vue3';
9
+ import { useVerifyCode } from '@bluesyoung/ui-vue3-element-plus';
10
+ import { isNumber } from '@bluesyoung/utils';
11
+ type Props = {
12
+ modelValue: string;
13
+ tel: string;
14
+ maxlength?: number;
15
+ };
16
+
17
+ const emit = defineEmits<{
18
+ (e: 'update:modelValue', v: string): void;
19
+ (e: 'enter'): void;
20
+ }>();
21
+
22
+ const props = withDefaults(defineProps<Props>(), {
23
+ maxlength: 6
24
+ });
25
+
26
+ const canGet = computed(() => {
27
+ return props.tel.length === 11;
28
+ });
29
+
30
+ const {
31
+ getCode,
32
+ tip,
33
+ showSlider,
34
+ pass,
35
+ cancel
36
+ } = useVerifyCode(async () => {
37
+ await apis.get.sendCode(props.tel);
38
+ ElMessage.success('短信已发送至您的手机,请注意查收!');
39
+ });
40
+
41
+ </script>
42
+ <template>
43
+ <div class="w-full">
44
+ <ElInput :model-value="modelValue" :maxlength="maxlength" @update:model-value="(e) => emit('update:modelValue', e)"
45
+ class="!h-52px" placeholder="请输入验证码" @keyup.enter="emit('enter')">
46
+ <template #suffix>
47
+ <ElLink v-if="isNumber(+tip)" type="primary" :disabled="!canGet" :underline="false" @click="getCode">{{ tip }}
48
+ </ElLink>
49
+ <div v-else>{{ tip }}</div>
50
+ </template>
51
+ </ElInput>
52
+ <YoungSlideVerify :show="showSlider" @success="pass" @close="cancel" />
53
+ </div>
54
+ </template>
55
+
56
+ <style>
57
+ .vue-puzzle-vcode {
58
+ z-index: 10001 !important;
59
+ }
60
+ </style>
@@ -0,0 +1,23 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2023-07-21 14:47:12
4
+ * @LastEditTime: 2023-07-26 10:39:40
5
+ * @Description:
6
+ -->
7
+ <script lang="ts" setup>
8
+ import { isHttpUrl } from '@bluesyoung/utils';
9
+ defineProps<{ to: string }>();
10
+ </script>
11
+
12
+ <template>
13
+ <a v-if="isHttpUrl(to)" :href="to" target="_blank" rel="noopener" referrerpolicy="no-referrer" class="w-full">
14
+ <div class="flex items-center">
15
+ <slot />
16
+ </div>
17
+ </a>
18
+ <NuxtLink v-else :to="to" class="w-full">
19
+ <div class="flex items-center">
20
+ <slot />
21
+ </div>
22
+ </NuxtLink>
23
+ </template>
@@ -0,0 +1,39 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2023-07-07 11:57:22
4
+ * @LastEditTime: 2023-07-26 10:42:39
5
+ * @Description:
6
+ -->
7
+ <template>
8
+ <div class="w-100vw h-100vh flex justify-center items-center bg-[#333] opacity-80 fixed top-0 z-999999">
9
+ <svg class="nuxt-spa-loading" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 37 25" fill="none" width="80">
10
+ <path d="M24.236 22.006h10.742L25.563 5.822l-8.979 14.31a4 4 0 0 1-3.388 1.874H2.978l11.631-20 5.897 10.567"></path>
11
+ </svg>
12
+ </div>
13
+ </template>
14
+
15
+ <style>
16
+ .nuxt-spa-loading {
17
+ position: fixed;
18
+ top: 50%;
19
+ left: 50%;
20
+ transform: translate(-50%, -50%)
21
+ }
22
+
23
+ .nuxt-spa-loading>path {
24
+ fill: none;
25
+ stroke: #00DC82;
26
+ stroke-width: 4px;
27
+ stroke-linecap: round;
28
+ stroke-linejoin: round;
29
+ stroke-dasharray: 128;
30
+ stroke-dashoffset: 128;
31
+ animation: nuxt-spa-loading-move 3s linear infinite
32
+ }
33
+
34
+ @keyframes nuxt-spa-loading-move {
35
+ 100% {
36
+ stroke-dashoffset: -128
37
+ }
38
+ }
39
+ </style>
@@ -0,0 +1,29 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2023-07-21 12:03:00
4
+ * @LastEditTime: 2023-07-24 10:05:41
5
+ * @Description:
6
+ -->
7
+ <script setup lang="ts">
8
+ const fullYear = new Date().getFullYear();
9
+ </script>
10
+
11
+ <template>
12
+ <div class="layout-footer-container">
13
+ &copy;{{ fullYear }} - Current
14
+ By&nbsp;<a href="https://gitee.com/BluesYoung-web" target="_blank">BluesYoung-web</a>
15
+ </div>
16
+ </template>
17
+
18
+ <style lang="scss" scoped>
19
+ .layout-footer-container {
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: center;
23
+ min-height: $base-app-footer-height;
24
+ padding: 0 20px;
25
+ color: rgb(0 0 0 / 45%);
26
+ background: var(--el-color-white);
27
+ border-top: 1px dashed #dcdfe6;
28
+ }
29
+ </style>
@@ -0,0 +1,52 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2023-07-21 12:21:02
4
+ * @LastEditTime: 2023-07-28 16:53:30
5
+ * @Description:
6
+ -->
7
+ <script lang="ts" setup>
8
+ const { isCollapse } = storeToRefs(useNavStore());
9
+
10
+ const title = window.__YOUNG_ENV__.NUXT_PUBLIC_TITLE;
11
+ const logo = window.__YOUNG_ENV__.NUXT_PUBLIC_LOGIN_LOGO;
12
+ </script>
13
+
14
+ <template>
15
+ <div class="logo-container flex-center">
16
+ <NuxtLink to="/">
17
+ <img class="logo" alt="logo" :src="logo" />
18
+ <h1 class="title" v-if="!(isCollapse || WindowSize['lt-lg'])">{{ title }}</h1>
19
+ </NuxtLink>
20
+ </div>
21
+ </template>
22
+
23
+ <style scoped lang="scss">
24
+ .logo-container {
25
+ position: relative;
26
+ display: flex;
27
+ justify-content: center;
28
+
29
+ // padding-left: 24px;
30
+ height: 60px;
31
+ overflow: hidden;
32
+ line-height: 60px;
33
+ background: transparent;
34
+
35
+ .title {
36
+ display: inline-block;
37
+ margin-left: 12px;
38
+ font-family: Avenir, 'Helvetica Neue', Arial, Helvetica, sans-serif;
39
+ font-size: 20px;
40
+ font-weight: 600;
41
+ color: #fff;
42
+ vertical-align: middle;
43
+ }
44
+
45
+ .logo {
46
+ display: inline-block;
47
+ width: 32px;
48
+ height: 32px;
49
+ vertical-align: middle;
50
+ }
51
+ }
52
+ </style>
@@ -0,0 +1,26 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2023-07-21 11:55:27
4
+ * @LastEditTime: 2023-08-25 16:49:08
5
+ * @Description:
6
+ -->
7
+ <template>
8
+ <main class="app-main-height w-full">
9
+ <NuxtPage ref="page" :keepalive="!$route.meta.noCache" />
10
+ </main>
11
+ </template>
12
+
13
+ <style scoped lang="scss">
14
+ .app-main-height {
15
+ min-height: $base-app-main-height;
16
+ background-color: inherit;
17
+ padding: 20px;
18
+
19
+ @screen lt-lg {
20
+ & {
21
+ min-height: -webkit-calc($base-app-main-height + $base-tabs-bar-height) !important;
22
+ min-height: calc($base-app-main-height + $base-tabs-bar-height) !important;
23
+ }
24
+ }
25
+ }
26
+ </style>
@@ -0,0 +1,77 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2023-07-21 16:38:20
4
+ * @LastEditTime: 2023-07-28 16:37:04
5
+ * @Description:
6
+ -->
7
+ <script lang="ts" setup>
8
+ const { isCollapse } = storeToRefs(useNavStore());
9
+
10
+ const collapseHandler = () => {
11
+ if (WindowSize['lt-lg']) {
12
+ /**
13
+ * 触发 Ctrl + K 事件
14
+ */
15
+ const event = new KeyboardEvent('keydown', {
16
+ key: 'k',
17
+ ctrlKey: true,
18
+ bubbles: true,
19
+ cancelable: true,
20
+ composed: true,
21
+ view: window,
22
+ });
23
+
24
+ document.body.dispatchEvent(event);
25
+ } else {
26
+ isCollapse.value = !isCollapse.value;
27
+ }
28
+ };
29
+ </script>
30
+
31
+ <template>
32
+ <div class="nav-bar-container flex justify-between">
33
+ <div class="left-panel">
34
+ <div class="fold-unfold i-ep-expand" :class="[isCollapse ? '' : 'rotate-180']"
35
+ :title="`${(isCollapse ? '展开' : '收起')}菜单`" @click="collapseHandler" />
36
+ </div>
37
+ <div class="right-panel">
38
+ <TopSearch />
39
+ <ScreenFull />
40
+ <TopUser />
41
+ </div>
42
+ </div>
43
+ </template>
44
+
45
+ <style scoped lang="scss">
46
+ .nav-bar-container {
47
+ position: relative;
48
+ height: $base-nav-bar-height;
49
+ padding-right: $base-padding;
50
+ padding-left: $base-padding;
51
+ overflow: hidden;
52
+ user-select: none;
53
+ background: $base-color-white;
54
+ box-shadow: $base-box-shadow;
55
+
56
+ .left-panel {
57
+ display: flex;
58
+ align-items: center;
59
+ justify-items: center;
60
+ height: 60px;
61
+
62
+ .fold-unfold {
63
+ font-size: 18px;
64
+ color: $base-color-gray;
65
+ cursor: pointer;
66
+ }
67
+ }
68
+
69
+ .right-panel {
70
+ display: flex;
71
+ align-content: center;
72
+ align-items: center;
73
+ justify-content: flex-end;
74
+ height: $base-nav-bar-height;
75
+ }
76
+ }
77
+ </style>
@@ -0,0 +1,89 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2023-07-21 12:25:23
4
+ * @LastEditTime: 2023-09-04 09:24:44
5
+ * @Description:
6
+ -->
7
+ <script lang="ts" setup>
8
+ const { isCollapse, nav_arr } = storeToRefs(useNavStore());
9
+ </script>
10
+
11
+ <template>
12
+ <div class="layout-sidebar-container" :class="{ 'is-collapse': isCollapse }">
13
+ <LayoutLogo />
14
+
15
+ <ElScrollbar>
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="click" :collapse-transition="false">
18
+ <LayoutSubMenu :menuList="nav_arr" />
19
+ </ElMenu>
20
+ </ElScrollbar>
21
+ </div>
22
+ </template>
23
+
24
+ <style scoped lang="scss">
25
+ @mixin active {
26
+ &:hover {
27
+ color: $base-color-white;
28
+ }
29
+
30
+ &.is-active {
31
+ color: $base-color-white;
32
+ background-color: var(--el-color-primary) !important;
33
+ }
34
+ }
35
+
36
+ .layout-sidebar-container {
37
+ position: fixed;
38
+ top: 0;
39
+ bottom: 0;
40
+ left: 0;
41
+ z-index: $base-z-index;
42
+ width: $base-left-menu-width;
43
+ height: 100vh;
44
+ background: $base-menu-background;
45
+ box-shadow: 2px 0 6px rgb(0 21 41 / 35%);
46
+ transition: width $base-transition-time;
47
+
48
+ @screen lt-lg {
49
+ & {
50
+ @apply hidden;
51
+ // @apply block;
52
+ // width: $base-left-menu-width-min;
53
+ }
54
+ }
55
+
56
+ &.is-collapse {
57
+ width: $base-left-menu-width-min;
58
+ border-right: 0;
59
+
60
+ // @screen lt-lg {
61
+ // & {
62
+ // @apply hidden;
63
+ // }
64
+ // }
65
+ }
66
+
67
+ :deep(.el-scrollbar__wrap) {
68
+ overflow-x: hidden;
69
+
70
+ .el-menu {
71
+ border: 0;
72
+ }
73
+
74
+ .el-menu-item,
75
+ .el-submenu__title {
76
+ height: $base-menu-item-height;
77
+ overflow: hidden;
78
+ line-height: $base-menu-item-height;
79
+ text-overflow: ellipsis;
80
+ white-space: nowrap;
81
+ vertical-align: middle;
82
+ }
83
+
84
+ .el-menu-item {
85
+ @include active;
86
+ }
87
+ }
88
+ }
89
+ </style>
@@ -0,0 +1,46 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2023-07-21 14:06:48
4
+ * @LastEditTime: 2023-07-28 15:59:48
5
+ * @Description:
6
+ -->
7
+ <script lang="ts" setup>
8
+ import { randomId } from '@bluesyoung/utils';
9
+
10
+ const props = withDefaults(defineProps<{
11
+ menuList?: NavArrItem[];
12
+ }>(), {
13
+ menuList: () => []
14
+ });
15
+
16
+ const randomKey = randomId();
17
+ const visibleMenu = computed(() => props.menuList.filter((n) => +n.visible === 1));
18
+ const { isCollapse } = storeToRefs(useNavStore());
19
+ const collapseMenu = () => {
20
+ if (WindowSize['lt-lg']) {
21
+ isCollapse.value = true;
22
+ }
23
+ };
24
+ </script>
25
+
26
+ <template>
27
+ <template v-for="(subItem, index) in visibleMenu" :key="subItem.component + randomKey + index">
28
+ <ElSubMenu v-if="subItem.children && subItem.children.length > 0" :index="subItem.component + randomKey + index">
29
+ <template #title>
30
+ <ElIcon>
31
+ <div v-if="subItem.icon" :class="subItem.icon" />
32
+ </ElIcon>
33
+ <span>{{ subItem.title }}</span>
34
+ </template>
35
+ <LayoutSubMenu :menuList="subItem.children" />
36
+ </ElSubMenu>
37
+ <ElMenuItem v-else :index="subItem.component + randomKey + index">
38
+ <YoungLink :to="subItem.component" @click="collapseMenu">
39
+ <ElIcon>
40
+ <div v-if="subItem.icon" :class="subItem.icon" />
41
+ </ElIcon>
42
+ {{ subItem.title }}
43
+ </YoungLink>
44
+ </ElMenuItem>
45
+ </template>
46
+ </template>