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
@@ -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,25 +1,32 @@
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
- <slot name="nav"></slot>
21
- <young-loading ref="loadingEl" />
22
- <young-loading-mini ref="httpLoadingEl" />
27
+ <young-navbar v-if="showNavBar" v-bind="navBarAttr" />
28
+ <young-loading />
29
+ <young-loading-mini />
23
30
  <scroll-view scroll-y class="flex flex-col bg-transparent"
24
31
  :style="{ height: `calc(100vh - ${customBarH}px - ${safeBottom}px - 44px)` }">
25
32
  <slot></slot>
@@ -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,25 +23,27 @@ 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
- <template #nav>
27
- <young-navbar :isback="false" />
28
- </template>
29
- <template #default>
30
- <h1 class="text-32">我是页面</h1>
31
- <view class="uni-primary">主色</view>
32
- <view class="uni-success">成功色</view>
33
- <view class="uni-warning">警告色</view>
34
- <view class="uni-error">错误色</view>
36
+ <h1 class="text-32">我是页面</h1>
37
+ <view class="uni-primary">主色</view>
38
+ <view class="uni-success">成功色</view>
39
+ <view class="uni-warning">警告色</view>
40
+ <view class="uni-error">错误色</view>
35
41
 
36
- <button @click="testGet">点我测试 Get 请求</button>
37
- <button @click="testPost">点我测试 Post 请求</button>
42
+ <button @click="testGet">点我测试 Get 请求</button>
43
+ <button @click="testPost">点我测试 Post 请求</button>
38
44
 
39
- <uni-card title="基础卡片" sub-title="副标题" extra="额外信息"
40
- thumbnail="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png" @click="to(Pages.测试子页面)">
41
- <text>这是一个带头像和双标题的基础卡片,此示例展示了一个完整的卡片。</text>
42
- </uni-card>
43
- </template>
45
+ <uni-card title="基础卡片" sub-title="副标题" extra="额外信息"
46
+ thumbnail="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png" @click="to(Pages.测试子页面)">
47
+ <text>这是一个带头像和双标题的基础卡片,此示例展示了一个完整的卡片。</text>
48
+ </uni-card>
44
49
  </template>
@@ -1,21 +1,28 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-18 17:53:43
4
- * @LastEditTime: 2023-08-01 12:07:03
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
- <template #nav>
16
- <young-navbar :isback="false" />
17
- </template>
18
- <template #default>
19
- <h1 class="text-32">我是个人中心</h1>
20
- </template>
27
+ <h1 class="text-32">我是个人中心</h1>
21
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>