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,27 @@
1
+ "use strict";
2
+ const common_vendor = require("../common/vendor.js");
3
+ const store_system = require("../store/system.js");
4
+ const store_local_index = require("../store/local/index.js");
5
+ const getSystemInfo = () => {
6
+ const { systemInfo } = common_vendor.storeToRefs(store_system.useSystemInfo());
7
+ return new Promise((_resolve) => {
8
+ common_vendor.index.getSystemInfo({
9
+ success: (e) => {
10
+ console.log(e, "getSystemInfo");
11
+ systemInfo.value = e;
12
+ let statusBar = e.statusBarHeight || 0;
13
+ let customBar;
14
+ let menu = common_vendor.index.getMenuButtonBoundingClientRect();
15
+ customBar = menu.bottom + menu.top - statusBar;
16
+ const safeBottom = e.screenHeight - (e.safeArea ? e.safeArea.height + e.safeArea.top : 0);
17
+ store_local_index.setNavbarHeihgt({
18
+ statusBarH: statusBar,
19
+ customBarH: customBar,
20
+ safeBottom
21
+ });
22
+ _resolve(e);
23
+ }
24
+ });
25
+ });
26
+ };
27
+ exports.getSystemInfo = getSystemInfo;
@@ -1,30 +1,33 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-18 15:35:24
4
- * @LastEditTime: 2023-07-20 15:06:25
4
+ * @LastEditTime: 2023-08-25 16:42:53
5
5
  * @Description:
6
6
  */
7
7
  import { useHttp } from './lib';
8
8
  import { useGet, usePost } from './requests';
9
9
 
10
+ /**
11
+ * 自动根据对应的环境,使用对应的接口地址,避免重复打包
12
+ */
13
+ const EnvConfig = {
14
+ develop: 'https://dev.req.cn',
15
+ trial: 'https://test.req.cn',
16
+ release: 'https://online.req.cn',
17
+ };
18
+
19
+ export const getReqUrl = (): string =>
20
+ // @ts-ignore
21
+ import.meta.env.VITE_API_BASE_URL || EnvConfig[__wxConfig.envVersion];
22
+
10
23
  const http = useHttp({
11
- baseURL: import.meta.env.VITE_API_BASE_URL,
24
+ baseURL: getReqUrl(),
12
25
  loading: {
13
26
  start: () => {
14
- if (import.meta.env.VITE_CUSTOM_LOADING) {
15
- const { httpLoadingEl } = storeToRefs(useHttpLoading());
16
- httpLoadingEl.value?.start();
17
- } else {
18
- showLoading();
19
- }
27
+ showLoading();
20
28
  },
21
29
  end: () => {
22
- if (import.meta.env.VITE_CUSTOM_LOADING) {
23
- const { httpLoadingEl } = storeToRefs(useHttpLoading());
24
- httpLoadingEl.value?.end();
25
- } else {
26
- hideLoading();
27
- }
30
+ hideLoading();
28
31
  },
29
32
  },
30
33
  headers: {
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-19 12:12:29
4
- * @LastEditTime: 2023-07-19 14:27:31
4
+ * @LastEditTime: 2023-08-25 16:26:53
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -15,24 +15,17 @@ withDefaults(defineProps<{
15
15
  */
16
16
  tip?: string;
17
17
  }>(), {
18
- loadingGif: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png',
18
+ // @ts-ignore
19
+ loadingGif: __wxConfig.accountInfo.icon,
19
20
  tip: '加载中...'
20
21
  });
21
22
 
22
- const loading = ref(true);
23
-
24
- const start = () => loading.value = true;
25
- const end = () => loading.value = false;
26
-
27
- defineExpose({
28
- start,
29
- end
30
- });
23
+ const { fullscreenLoading } = storeToRefs(useHttpLoading());
31
24
  </script>
32
25
  <template>
33
- <view v-if="loading"
26
+ <view v-show="fullscreenLoading"
34
27
  class="w100vw h100vh fixed left-0 top-0 z-999999 bg-white flex flex-col items-center justify-center">
35
- <image :src="loadingGif" class="w240rpx h240rpx mb-32rpx" />
28
+ <image :src="loadingGif" class="w140rpx h140rpx mb-32rpx" />
36
29
  <text class="text-[#999] text-24rpx leading-36rpx">{{ tip }}</text>
37
30
  </view>
38
31
  </template>
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-20 14:48:35
4
- * @LastEditTime: 2023-07-20 15:09:28
4
+ * @LastEditTime: 2023-08-25 16:27:13
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -19,18 +19,11 @@ withDefaults(defineProps<{
19
19
  tip: '拼命加载中...'
20
20
  });
21
21
 
22
- const loading = ref(false);
22
+ const { smallLoading } = storeToRefs(useHttpLoading());
23
23
 
24
- const start = () => loading.value = true;
25
- const end = () => loading.value = false;
26
-
27
- defineExpose({
28
- start,
29
- end
30
- });
31
24
  </script>
32
25
  <template>
33
- <view v-if="loading"
26
+ <view v-show="smallLoading"
34
27
  class="w100vw h100vh fixed left-0 top-0 z-999998 bg-[#333] opacity-90 flex flex-col items-center justify-center">
35
28
  <image :src="loadingGif" class="w240rpx h240rpx mb-32rpx" />
36
29
  <text class="text-[#fff] text-24rpx leading-36rpx">{{ tip }}</text>
@@ -1,11 +1,10 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-20 10:55:54
4
- * @LastEditTime: 2023-07-20 15:40:22
4
+ * @LastEditTime: 2023-08-25 16:21:46
5
5
  * @Description: todo: 默认布局,按需调整
6
6
  -->
7
7
  <script lang="ts" setup>
8
- const { httpLoadingEl } = storeToRefs(useHttpLoading());
9
8
  const { pagesInfo } = storeToRefs(useSystemInfo());
10
9
 
11
10
  onLoad(() => {
@@ -19,6 +18,6 @@ onLoad(() => {
19
18
  </script>
20
19
 
21
20
  <template>
22
- <young-loading-mini ref="httpLoadingEl" />
21
+ <young-loading-mini />
23
22
  <slot />
24
23
  </template>
@@ -1,28 +1,35 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-20 11:00:42
4
- * @LastEditTime: 2023-07-20 15:09:18
4
+ * @LastEditTime: 2023-08-25 16:37:12
5
5
  * @Description: tabbar 页面的默认布局
6
6
  -->
7
7
  <script lang="ts" setup>
8
8
  const { customBarH, safeBottom } = getNavbarHeihgt();
9
- const loadingEl = ref();
10
9
 
11
- const { httpLoadingEl } = storeToRefs(useHttpLoading());
10
+ const { pagesInfo } = storeToRefs(useSystemInfo());
12
11
 
13
- onMounted(() => {
14
- setTimeout(() => {
15
- loadingEl.value?.end();
16
- }, 3e3);
12
+ const showNavBar = ref(false);
13
+ const navBarAttr = ref<ParamsObj>({});
14
+
15
+ onLoad(() => {
16
+ const [page] = getCurrentPages();
17
+
18
+ const pageConf = pagesInfo.value.find((p) => p.path === page.route);
19
+
20
+ if (pageConf?.navbar) {
21
+ showNavBar.value = true;
22
+ navBarAttr.value = pageConf.navbar;
23
+ }
17
24
  });
18
25
  </script>
19
26
  <template>
20
- <young-loading ref="loadingEl" />
21
- <young-loading-mini ref="httpLoadingEl" />
22
- <div class="flex flex-col" :style="{ height: `calc(100vh - ${customBarH}px - ${safeBottom}px - 44px)` }">
23
- <scroll-view scroll-y class="flex-1 bg-transparent">
24
- <slot></slot>
25
- </scroll-view>
26
- <young-tabbar :z="999" />
27
- </div>
27
+ <young-navbar v-if="showNavBar" v-bind="navBarAttr" />
28
+ <young-loading />
29
+ <young-loading-mini />
30
+ <scroll-view scroll-y class="flex flex-col bg-transparent"
31
+ :style="{ height: `calc(100vh - ${customBarH}px - ${safeBottom}px - 44px)` }">
32
+ <slot></slot>
33
+ </scroll-view>
34
+ <young-tabbar :z="999" />
28
35
  </template>
@@ -1,13 +1,16 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-18 11:23:36
4
- * @LastEditTime: 2023-07-20 15:24:46
4
+ * @LastEditTime: 2023-08-25 16:39:24
5
5
  * @Description:
6
6
  -->
7
7
  <route lang="json">
8
8
  {
9
9
  "needLogin": true,
10
- "layout": "tabbar"
10
+ "layout": "tabbar",
11
+ "navbar": {
12
+ "isback": false
13
+ }
11
14
  }
12
15
  </route>
13
16
 
@@ -20,10 +23,16 @@ const testGet = async () => {
20
23
  const testPost = async () => {
21
24
  await apis.post.createRepo('BluesYoung-web');
22
25
  };
26
+
27
+ const { fullscreenLoading } = storeToRefs(useHttpLoading());
28
+ fullscreenLoading.value = true;
29
+
30
+ setTimeout(() => {
31
+ fullscreenLoading.value = false;
32
+ }, 3e3);
23
33
  </script>
24
34
 
25
35
  <template>
26
- <young-navbar :isback="false" />
27
36
  <h1 class="text-32">我是页面</h1>
28
37
  <view class="uni-primary">主色</view>
29
38
  <view class="uni-success">成功色</view>
@@ -1,25 +1,28 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-18 17:53:43
4
- * @LastEditTime: 2023-07-20 11:56:29
4
+ * @LastEditTime: 2023-08-25 16:39:28
5
5
  * @Description:
6
6
  -->
7
7
  <route lang="json">
8
8
  {
9
9
  "needLogin": true,
10
- "layout": "tabbar"
10
+ "layout": "tabbar",
11
+ "navbar": {
12
+ "isback": false
13
+ }
11
14
  }
12
15
  </route>
13
16
 
17
+ <script lang="ts" setup>
18
+ const { fullscreenLoading } = storeToRefs(useHttpLoading());
19
+ fullscreenLoading.value = true;
20
+
21
+ setTimeout(() => {
22
+ fullscreenLoading.value = false;
23
+ }, 3e3);
24
+ </script>
25
+
14
26
  <template>
15
- <uni-nav-bar status-bar :border="false" title="个人中心" />
16
- <h1 class="text-32">我是页面</h1>
17
- <view class="uni-primary">主色</view>
18
- <view class="uni-success">成功色</view>
19
- <view class="uni-warning">警告色</view>
20
- <view class="uni-error">错误色</view>
21
- <uni-card title="基础卡片" sub-title="副标题" extra="额外信息"
22
- thumbnail="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png">
23
- <text>这是一个带头像和双标题的基础卡片,此示例展示了一个完整的卡片。</text>
24
- </uni-card>
27
+ <h1 class="text-32">我是个人中心</h1>
25
28
  </template>
@@ -5,13 +5,19 @@
5
5
  "path": "pages/index",
6
6
  "type": "home",
7
7
  "needLogin": true,
8
- "layout": "tabbar"
8
+ "layout": "tabbar",
9
+ "navbar": {
10
+ "isback": false
11
+ }
9
12
  },
10
13
  {
11
14
  "path": "pages/my",
12
15
  "type": "page",
13
16
  "needLogin": true,
14
- "layout": "tabbar"
17
+ "layout": "tabbar",
18
+ "navbar": {
19
+ "isback": false
20
+ }
15
21
  },
16
22
  {
17
23
  "path": "pages/demo/index",
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-18 15:20:04
4
- * @LastEditTime: 2023-07-20 15:00:01
4
+ * @LastEditTime: 2023-08-25 16:20:11
5
5
  * @Description:
6
6
  */
7
7
  import type { PageMetaDatum } from '@uni-helper/vite-plugin-uni-pages';
@@ -15,6 +15,7 @@ export const useSystemInfo = defineStore('useSystemInfo', () => {
15
15
  });
16
16
 
17
17
  export const useHttpLoading = defineStore('useHttpLoading', () => {
18
- const httpLoadingEl = ref();
19
- return { httpLoadingEl };
18
+ const fullscreenLoading = ref(false);
19
+ const smallLoading = ref(false);
20
+ return { smallLoading, fullscreenLoading };
20
21
  });
@@ -0,0 +1,7 @@
1
+ /*
2
+ * @Author: zhangyang
3
+ * @Date: 2023-08-25 16:36:22
4
+ * @LastEditTime: 2023-08-25 16:36:22
5
+ * @Description:
6
+ */
7
+ type ParamsObj = Record<string, any>;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-18 14:28:16
4
- * @LastEditTime: 2023-07-19 16:51:04
4
+ * @LastEditTime: 2023-08-29 10:22:48
5
5
  * @Description: 权限相关
6
6
  */
7
7
  /**
@@ -123,3 +123,73 @@ export const authLocation = async (cancelback = true, isShowModal = true) =>
123
123
  },
124
124
  });
125
125
  });
126
+
127
+ /**
128
+ * 获取本机支持的生物认证信息
129
+ */
130
+ export const getAuthInfo = async () => {
131
+ return new Promise<UniApp.CheckIsSupportSoterAuthenticationRes['supportMode'] | false>(
132
+ (resolve) => {
133
+ uni.checkIsSupportSoterAuthentication({
134
+ success(res) {
135
+ resolve(res.supportMode);
136
+ },
137
+ fail(err) {
138
+ console.log('🚀 ~ file: auth.ts:234 ~ fail ~ err:', err);
139
+ resolve(false);
140
+ },
141
+ });
142
+ },
143
+ );
144
+ };
145
+
146
+ /**
147
+ * 检查本机是否录入过指纹
148
+ */
149
+ export const checkFingerPrint = async () => {
150
+ return new Promise<boolean>((resolve) => {
151
+ uni.checkIsSoterEnrolledInDevice({
152
+ checkAuthMode: 'fingerPrint',
153
+ success: () => resolve(true),
154
+ fail: () => resolve(false),
155
+ });
156
+ });
157
+ };
158
+
159
+ /**
160
+ * 指纹认证
161
+ */
162
+ export const fingerPrintAuth = async (signStr: string, authContent = '请验证本机指纹') => {
163
+ return new Promise<boolean>(async (resolve) => {
164
+ const authMethods = await getAuthInfo();
165
+ if (authMethods && authMethods.includes('fingerPrint')) {
166
+ uni.checkIsSupportSoterAuthentication({
167
+ async success(res) {
168
+ if (res.supportMode.includes('fingerPrint') && (await checkFingerPrint())) {
169
+ uni.startSoterAuthentication({
170
+ requestAuthModes: ['fingerPrint'],
171
+ challenge: signStr,
172
+ authContent,
173
+ success(res) {
174
+ console.log('success', res);
175
+ resolve(true);
176
+ },
177
+ fail(err) {
178
+ console.log('fail', err);
179
+ resolve(false);
180
+ },
181
+ });
182
+ } else {
183
+ resolve(false);
184
+ }
185
+ },
186
+ fail(err) {
187
+ console.log('fail', err);
188
+ resolve(false);
189
+ },
190
+ });
191
+ } else {
192
+ resolve(false);
193
+ }
194
+ });
195
+ };
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-18 14:12:25
4
- * @LastEditTime: 2023-07-18 14:24:22
4
+ * @LastEditTime: 2023-08-25 16:22:55
5
5
  * @Description: ui 交互,弹窗之类的
6
6
  */
7
7
  import { sleep } from '@bluesyoung/utils';
@@ -14,18 +14,41 @@ let loadingCount = 0;
14
14
  * @param title - 提示文本
15
15
  */
16
16
  export function showLoading(title = '加载中...', mask = true) {
17
+ const { fullscreenLoading, smallLoading } = storeToRefs(useHttpLoading());
18
+
19
+ if (fullscreenLoading.value) {
20
+ return;
21
+ }
22
+
17
23
  loadingCount++;
18
- uni.showLoading({
19
- mask,
20
- title,
21
- });
24
+
25
+ if (import.meta.env.VITE_CUSTOM_LOADING) {
26
+ smallLoading.value = true;
27
+ } else {
28
+ uni.showLoading({
29
+ mask,
30
+ title,
31
+ });
32
+ }
22
33
  }
23
34
 
24
35
  /**
25
36
  * 隐藏loading
26
37
  */
27
38
  export function hideLoading() {
28
- --loadingCount === 0 && uni.hideLoading();
39
+ const { smallLoading, fullscreenLoading } = storeToRefs(useHttpLoading());
40
+
41
+ if (fullscreenLoading.value) {
42
+ return;
43
+ }
44
+
45
+ if (--loadingCount === 0) {
46
+ if (import.meta.env.VITE_CUSTOM_LOADING) {
47
+ smallLoading.value = false;
48
+ } else {
49
+ uni.hideLoading();
50
+ }
51
+ }
29
52
  }
30
53
 
31
54
  /**
@@ -49,7 +72,7 @@ const modalPage = new Set<string>();
49
72
  */
50
73
  export async function showModal(options: UniApp.ShowModalOptions) {
51
74
  const page = getCurrentPages();
52
- const route = page[page.length - 1].route || '';
75
+ const route = page[page.length - 1]?.route || '';
53
76
  if (modalPage.has(route)) {
54
77
  hasModel = true;
55
78
  } else {
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2022-05-30 16:28:37
4
- * @LastEditTime: 2023-01-06 11:35:16
4
+ * @LastEditTime: 2023-08-02 10:44:18
5
5
  * @Description: 菜单管理
6
6
  -->
7
7
  <route lang="yaml">
@@ -180,7 +180,7 @@ getList()
180
180
  <ElInput v-model="form.title" placeholder="请输入页面标题" />
181
181
  </ElFormItem>
182
182
  <ElFormItem label="排序">
183
- <ElInput v-model.number="form.sort" />
183
+ <ElInputNumber v-model.number="form.sort" />
184
184
  </ElFormItem>
185
185
  <ElFormItem label="路径" prop="component" :rules="form.parentId === 0 ? {} :
186
186
  { message: '请输入合法的路径, eg: /path/page', trigger: 'blur', validator: (_: any, v: string) => v.trim() === '' || /\/(.*)\/(.*)/.test(v) }
@@ -191,4 +191,4 @@ getList()
191
191
  </template>
192
192
  </YoungDialog>
193
193
  </div>
194
- </template>
194
+ </template>