create-pubinfo-pr 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +20 -0
  3. package/dist/cli-BgCjzF7D.d.ts +2 -0
  4. package/dist/cli.js +258 -0
  5. package/dist/helper-Cwc2jDwQ.js +229 -0
  6. package/dist/index-DCf5j10Q.d.ts +122 -0
  7. package/dist/index.js +3 -0
  8. package/package.json +52 -0
  9. package/templates/pubinfo-app/.browserslistrc +5 -0
  10. package/templates/pubinfo-app/.editorconfig +10 -0
  11. package/templates/pubinfo-app/.env +2 -0
  12. package/templates/pubinfo-app/.env.development +4 -0
  13. package/templates/pubinfo-app/.env.production +10 -0
  14. package/templates/pubinfo-app/.vscode/settings.json +50 -0
  15. package/templates/pubinfo-app/_gitignore +38 -0
  16. package/templates/pubinfo-app/_npmrc +5 -0
  17. package/templates/pubinfo-app/eslint.config.ts +3 -0
  18. package/templates/pubinfo-app/index.html +47 -0
  19. package/templates/pubinfo-app/openapi.config.ts.hbs +33 -0
  20. package/templates/pubinfo-app/package.json.hbs +59 -0
  21. package/templates/pubinfo-app/pubinfo.config.ts +9 -0
  22. package/templates/pubinfo-app/public/browser_upgrade/chrome.png +0 -0
  23. package/templates/pubinfo-app/public/browser_upgrade/edge.png +0 -0
  24. package/templates/pubinfo-app/public/browser_upgrade/index.css +49 -0
  25. package/templates/pubinfo-app/public/loading.css +92 -0
  26. package/templates/pubinfo-app/src/App.vue +7 -0
  27. package/templates/pubinfo-app/src/api/modules/auth/index.ts +3 -0
  28. package/templates/pubinfo-app/src/api/modules/auth/renzhengfuwu.ts +145 -0
  29. package/templates/pubinfo-app/src/api/modules/auth/typings.d.ts +97 -0
  30. package/templates/pubinfo-app/src/api/request.ts +125 -0
  31. package/templates/pubinfo-app/src/assets/icons/logo.svg +1 -0
  32. package/templates/pubinfo-app/src/assets/icons/process-management.svg +1 -0
  33. package/templates/pubinfo-app/src/assets/icons/workbench.svg +1 -0
  34. package/templates/pubinfo-app/src/assets/images/login-bg.webp +0 -0
  35. package/templates/pubinfo-app/src/assets/images/login-bg_dark.webp +0 -0
  36. package/templates/pubinfo-app/src/assets/images/login-small.png +0 -0
  37. package/templates/pubinfo-app/src/assets/images/login-small_dark.webp +0 -0
  38. package/templates/pubinfo-app/src/components/UIProvider/index.vue +51 -0
  39. package/templates/pubinfo-app/src/layouts/index.vue +48 -0
  40. package/templates/pubinfo-app/src/main.ts.hbs +26 -0
  41. package/templates/pubinfo-app/src/modules/captcha.ts +8 -0
  42. package/templates/pubinfo-app/src/modules/rbac.ts +10 -0
  43. package/templates/pubinfo-app/src/routes/index.ts +71 -0
  44. package/templates/pubinfo-app/src/routes/modules/demo/breadcrumb.example.ts +62 -0
  45. package/templates/pubinfo-app/src/routes/modules/demo/link.ts +15 -0
  46. package/templates/pubinfo-app/src/routes/modules/demo/multilevel.menu.example.ts +68 -0
  47. package/templates/pubinfo-app/src/routes/modules/demo/other.page.ts +37 -0
  48. package/templates/pubinfo-app/src/routes/modules/demo/single.ts +14 -0
  49. package/templates/pubinfo-app/src/settings.ts.hbs +8 -0
  50. package/templates/pubinfo-app/src/stores/index.ts +2 -0
  51. package/templates/pubinfo-app/src/stores/modules/conter.ts +16 -0
  52. package/templates/pubinfo-app/src/views/demo/breadcrumb_example/detail1.vue +11 -0
  53. package/templates/pubinfo-app/src/views/demo/breadcrumb_example/detail2.vue +11 -0
  54. package/templates/pubinfo-app/src/views/demo/breadcrumb_example/list1.vue +11 -0
  55. package/templates/pubinfo-app/src/views/demo/breadcrumb_example/list2.vue +11 -0
  56. package/templates/pubinfo-app/src/views/demo/multilevel_menu_example/level2/level3/page1.vue +11 -0
  57. package/templates/pubinfo-app/src/views/demo/multilevel_menu_example/level2/level3/page2.vue +11 -0
  58. package/templates/pubinfo-app/src/views/demo/multilevel_menu_example/level2/page.vue +11 -0
  59. package/templates/pubinfo-app/src/views/demo/multilevel_menu_example/page.vue +11 -0
  60. package/templates/pubinfo-app/src/views/demo/other_page/des.vue +13 -0
  61. package/templates/pubinfo-app/src/views/demo/other_page/index.vue +25 -0
  62. package/templates/pubinfo-app/src/views/demo/preview-empty/index.vue +17 -0
  63. package/templates/pubinfo-app/src/views/demo/single/index.vue +13 -0
  64. package/templates/pubinfo-app/src/views/system/index.vue +5 -0
  65. package/templates/pubinfo-app/src/views/system/login/components/LoginForm.vue +29 -0
  66. package/templates/pubinfo-app/src/views/system/login/components/LoginWithPhone.vue +213 -0
  67. package/templates/pubinfo-app/src/views/system/login/components/PasswordLogin.vue +178 -0
  68. package/templates/pubinfo-app/src/views/system/login/components/Savephone.vue +17 -0
  69. package/templates/pubinfo-app/src/views/system/login/components/Useragreement.vue +26 -0
  70. package/templates/pubinfo-app/src/views/system/login/composables.ts +63 -0
  71. package/templates/pubinfo-app/src/views/system/login/index.vue +142 -0
  72. package/templates/pubinfo-app/stylelint.config.js +3 -0
  73. package/templates/pubinfo-app/tsconfig.json +3 -0
  74. package/templates/pubinfo-app/uno.config.ts +17 -0
  75. package/templates/pubinfo-module/.editorconfig +10 -0
  76. package/templates/pubinfo-module/.vscode/settings.json +50 -0
  77. package/templates/pubinfo-module/README.md.hbs +27 -0
  78. package/templates/pubinfo-module/_gitignore +38 -0
  79. package/templates/pubinfo-module/_npmrc +5 -0
  80. package/templates/pubinfo-module/eslint.config.ts +3 -0
  81. package/templates/pubinfo-module/package.json.hbs +67 -0
  82. package/templates/pubinfo-module/playground/.env +2 -0
  83. package/templates/pubinfo-module/playground/.env.development +4 -0
  84. package/templates/pubinfo-module/playground/.env.production +10 -0
  85. package/templates/pubinfo-module/playground/index.html +47 -0
  86. package/templates/pubinfo-module/playground/openapi.config.ts.hbs +33 -0
  87. package/templates/pubinfo-module/playground/package.json.hbs +21 -0
  88. package/templates/pubinfo-module/playground/pubinfo.config.ts +9 -0
  89. package/templates/pubinfo-module/playground/public/browser_upgrade/chrome.png +0 -0
  90. package/templates/pubinfo-module/playground/public/browser_upgrade/edge.png +0 -0
  91. package/templates/pubinfo-module/playground/public/browser_upgrade/index.css +49 -0
  92. package/templates/pubinfo-module/playground/public/loading.css +92 -0
  93. package/templates/pubinfo-module/playground/src/App.vue +7 -0
  94. package/templates/pubinfo-module/playground/src/api/modules/auth/index.ts +3 -0
  95. package/templates/pubinfo-module/playground/src/api/modules/auth/renzhengfuwu.ts +145 -0
  96. package/templates/pubinfo-module/playground/src/api/modules/auth/typings.d.ts +97 -0
  97. package/templates/pubinfo-module/playground/src/api/request.ts +125 -0
  98. package/templates/pubinfo-module/playground/src/assets/icons/logo.svg +1 -0
  99. package/templates/pubinfo-module/playground/src/assets/icons/process-management.svg +1 -0
  100. package/templates/pubinfo-module/playground/src/assets/icons/workbench.svg +1 -0
  101. package/templates/pubinfo-module/playground/src/assets/images/login-bg.webp +0 -0
  102. package/templates/pubinfo-module/playground/src/assets/images/login-bg_dark.webp +0 -0
  103. package/templates/pubinfo-module/playground/src/assets/images/login-small.png +0 -0
  104. package/templates/pubinfo-module/playground/src/assets/images/login-small_dark.webp +0 -0
  105. package/templates/pubinfo-module/playground/src/components/UIProvider/index.vue +51 -0
  106. package/templates/pubinfo-module/playground/src/layouts/index.vue +44 -0
  107. package/templates/pubinfo-module/playground/src/main.ts.hbs +22 -0
  108. package/templates/pubinfo-module/playground/src/modules/rbac.ts +10 -0
  109. package/templates/pubinfo-module/playground/src/routes/index.ts +71 -0
  110. package/templates/pubinfo-module/playground/src/routes/modules/demo/breadcrumb.example.ts +62 -0
  111. package/templates/pubinfo-module/playground/src/routes/modules/demo/link.ts +15 -0
  112. package/templates/pubinfo-module/playground/src/routes/modules/demo/multilevel.menu.example.ts +68 -0
  113. package/templates/pubinfo-module/playground/src/routes/modules/demo/other.page.ts +37 -0
  114. package/templates/pubinfo-module/playground/src/routes/modules/demo/single.ts +14 -0
  115. package/templates/pubinfo-module/playground/src/settings.ts +8 -0
  116. package/templates/pubinfo-module/playground/src/stores/index.ts +2 -0
  117. package/templates/pubinfo-module/playground/src/stores/modules/conter.ts +16 -0
  118. package/templates/pubinfo-module/playground/src/views/demo/breadcrumb_example/detail1.vue +11 -0
  119. package/templates/pubinfo-module/playground/src/views/demo/breadcrumb_example/detail2.vue +11 -0
  120. package/templates/pubinfo-module/playground/src/views/demo/breadcrumb_example/list1.vue +11 -0
  121. package/templates/pubinfo-module/playground/src/views/demo/breadcrumb_example/list2.vue +11 -0
  122. package/templates/pubinfo-module/playground/src/views/demo/multilevel_menu_example/level2/level3/page1.vue +11 -0
  123. package/templates/pubinfo-module/playground/src/views/demo/multilevel_menu_example/level2/level3/page2.vue +11 -0
  124. package/templates/pubinfo-module/playground/src/views/demo/multilevel_menu_example/level2/page.vue +11 -0
  125. package/templates/pubinfo-module/playground/src/views/demo/multilevel_menu_example/page.vue +11 -0
  126. package/templates/pubinfo-module/playground/src/views/demo/other_page/des.vue +13 -0
  127. package/templates/pubinfo-module/playground/src/views/demo/other_page/index.vue +25 -0
  128. package/templates/pubinfo-module/playground/src/views/demo/preview-empty/index.vue +17 -0
  129. package/templates/pubinfo-module/playground/src/views/demo/single/index.vue +13 -0
  130. package/templates/pubinfo-module/playground/src/views/system/index.vue +5 -0
  131. package/templates/pubinfo-module/playground/src/views/system/login/components/LoginForm.vue +29 -0
  132. package/templates/pubinfo-module/playground/src/views/system/login/components/LoginWithPhone.vue +213 -0
  133. package/templates/pubinfo-module/playground/src/views/system/login/components/PasswordLogin.vue +194 -0
  134. package/templates/pubinfo-module/playground/src/views/system/login/components/Savephone.vue +17 -0
  135. package/templates/pubinfo-module/playground/src/views/system/login/components/Useragreement.vue +26 -0
  136. package/templates/pubinfo-module/playground/src/views/system/login/composables.ts +84 -0
  137. package/templates/pubinfo-module/playground/src/views/system/login/index.vue +142 -0
  138. package/templates/pubinfo-module/playground/tsconfig.json +3 -0
  139. package/templates/pubinfo-module/playground/uno.config.ts +17 -0
  140. package/templates/pubinfo-module/pnpm-workspace.yaml +2 -0
  141. package/templates/pubinfo-module/pubinfo.config.ts.hbs +36 -0
  142. package/templates/pubinfo-module/src/index.ts.hbs +9 -0
  143. package/templates/pubinfo-module/src/pages/demo.vue +11 -0
  144. package/templates/pubinfo-module/stylelint.config.js +3 -0
  145. package/templates/pubinfo-module/tsconfig.json +16 -0
  146. package/templates/pubinfo-module/uno.config.ts +8 -0
  147. package/templates/pubinfo-monorepo/.browserslistrc +5 -0
  148. package/templates/pubinfo-monorepo/.editorconfig +10 -0
  149. package/templates/pubinfo-monorepo/.vscode/settings.json +50 -0
  150. package/templates/pubinfo-monorepo/_gitignore +38 -0
  151. package/templates/pubinfo-monorepo/_npmrc +5 -0
  152. package/templates/pubinfo-monorepo/apps/basic/.env +2 -0
  153. package/templates/pubinfo-monorepo/apps/basic/.env.development +4 -0
  154. package/templates/pubinfo-monorepo/apps/basic/.env.production +10 -0
  155. package/templates/pubinfo-monorepo/apps/basic/index.html +47 -0
  156. package/templates/pubinfo-monorepo/apps/basic/openapi.config.ts.hbs +33 -0
  157. package/templates/pubinfo-monorepo/apps/basic/package.json.hbs +26 -0
  158. package/templates/pubinfo-monorepo/apps/basic/pubinfo.config.ts +9 -0
  159. package/templates/pubinfo-monorepo/apps/basic/public/browser_upgrade/chrome.png +0 -0
  160. package/templates/pubinfo-monorepo/apps/basic/public/browser_upgrade/edge.png +0 -0
  161. package/templates/pubinfo-monorepo/apps/basic/public/browser_upgrade/index.css +49 -0
  162. package/templates/pubinfo-monorepo/apps/basic/public/loading.css +92 -0
  163. package/templates/pubinfo-monorepo/apps/basic/src/App.vue +7 -0
  164. package/templates/pubinfo-monorepo/apps/basic/src/api/modules/auth/index.ts +3 -0
  165. package/templates/pubinfo-monorepo/apps/basic/src/api/modules/auth/renzhengfuwu.ts +145 -0
  166. package/templates/pubinfo-monorepo/apps/basic/src/api/modules/auth/typings.d.ts +97 -0
  167. package/templates/pubinfo-monorepo/apps/basic/src/api/request.ts +125 -0
  168. package/templates/pubinfo-monorepo/apps/basic/src/assets/icons/logo.svg +1 -0
  169. package/templates/pubinfo-monorepo/apps/basic/src/assets/icons/process-management.svg +1 -0
  170. package/templates/pubinfo-monorepo/apps/basic/src/assets/icons/workbench.svg +1 -0
  171. package/templates/pubinfo-monorepo/apps/basic/src/assets/images/login-bg.webp +0 -0
  172. package/templates/pubinfo-monorepo/apps/basic/src/assets/images/login-bg_dark.webp +0 -0
  173. package/templates/pubinfo-monorepo/apps/basic/src/assets/images/login-small.png +0 -0
  174. package/templates/pubinfo-monorepo/apps/basic/src/assets/images/login-small_dark.webp +0 -0
  175. package/templates/pubinfo-monorepo/apps/basic/src/components/UIProvider/index.vue +51 -0
  176. package/templates/pubinfo-monorepo/apps/basic/src/layouts/index.vue +48 -0
  177. package/templates/pubinfo-monorepo/apps/basic/src/main.ts.hbs +26 -0
  178. package/templates/pubinfo-monorepo/apps/basic/src/modules/captcha.ts +8 -0
  179. package/templates/pubinfo-monorepo/apps/basic/src/modules/rbac.ts +10 -0
  180. package/templates/pubinfo-monorepo/apps/basic/src/routes/index.ts +71 -0
  181. package/templates/pubinfo-monorepo/apps/basic/src/routes/modules/demo/breadcrumb.example.ts +62 -0
  182. package/templates/pubinfo-monorepo/apps/basic/src/routes/modules/demo/link.ts +15 -0
  183. package/templates/pubinfo-monorepo/apps/basic/src/routes/modules/demo/multilevel.menu.example.ts +68 -0
  184. package/templates/pubinfo-monorepo/apps/basic/src/routes/modules/demo/other.page.ts +37 -0
  185. package/templates/pubinfo-monorepo/apps/basic/src/routes/modules/demo/single.ts +14 -0
  186. package/templates/pubinfo-monorepo/apps/basic/src/settings.ts.hbs +8 -0
  187. package/templates/pubinfo-monorepo/apps/basic/src/stores/index.ts +2 -0
  188. package/templates/pubinfo-monorepo/apps/basic/src/stores/modules/conter.ts +16 -0
  189. package/templates/pubinfo-monorepo/apps/basic/src/views/demo/breadcrumb_example/detail1.vue +11 -0
  190. package/templates/pubinfo-monorepo/apps/basic/src/views/demo/breadcrumb_example/detail2.vue +11 -0
  191. package/templates/pubinfo-monorepo/apps/basic/src/views/demo/breadcrumb_example/list1.vue +11 -0
  192. package/templates/pubinfo-monorepo/apps/basic/src/views/demo/breadcrumb_example/list2.vue +11 -0
  193. package/templates/pubinfo-monorepo/apps/basic/src/views/demo/multilevel_menu_example/level2/level3/page1.vue +11 -0
  194. package/templates/pubinfo-monorepo/apps/basic/src/views/demo/multilevel_menu_example/level2/level3/page2.vue +11 -0
  195. package/templates/pubinfo-monorepo/apps/basic/src/views/demo/multilevel_menu_example/level2/page.vue +11 -0
  196. package/templates/pubinfo-monorepo/apps/basic/src/views/demo/multilevel_menu_example/page.vue +11 -0
  197. package/templates/pubinfo-monorepo/apps/basic/src/views/demo/other_page/des.vue +13 -0
  198. package/templates/pubinfo-monorepo/apps/basic/src/views/demo/other_page/index.vue +25 -0
  199. package/templates/pubinfo-monorepo/apps/basic/src/views/demo/preview-empty/index.vue +17 -0
  200. package/templates/pubinfo-monorepo/apps/basic/src/views/demo/single/index.vue +13 -0
  201. package/templates/pubinfo-monorepo/apps/basic/src/views/system/index.vue +5 -0
  202. package/templates/pubinfo-monorepo/apps/basic/src/views/system/login/components/LoginForm.vue +29 -0
  203. package/templates/pubinfo-monorepo/apps/basic/src/views/system/login/components/LoginWithPhone.vue +213 -0
  204. package/templates/pubinfo-monorepo/apps/basic/src/views/system/login/components/PasswordLogin.vue +178 -0
  205. package/templates/pubinfo-monorepo/apps/basic/src/views/system/login/components/Savephone.vue +17 -0
  206. package/templates/pubinfo-monorepo/apps/basic/src/views/system/login/components/Useragreement.vue +26 -0
  207. package/templates/pubinfo-monorepo/apps/basic/src/views/system/login/composables.ts +63 -0
  208. package/templates/pubinfo-monorepo/apps/basic/src/views/system/login/index.vue +142 -0
  209. package/templates/pubinfo-monorepo/apps/basic/tsconfig.json +3 -0
  210. package/templates/pubinfo-monorepo/apps/basic/uno.config.ts +17 -0
  211. package/templates/pubinfo-monorepo/eslint.config.ts +3 -0
  212. package/templates/pubinfo-monorepo/package.json.hbs +45 -0
  213. package/templates/pubinfo-monorepo/pnpm-lock.yaml +12686 -0
  214. package/templates/pubinfo-monorepo/pnpm-workspace.yaml +11 -0
  215. package/templates/pubinfo-monorepo/stylelint.config.js +3 -0
@@ -0,0 +1,2 @@
1
+ export * from './modules/conter';
2
+ export { useUserStore } from 'pubinfo';
@@ -0,0 +1,16 @@
1
+ import { defineStore } from 'pinia';
2
+ import { computed, ref } from 'vue';
3
+
4
+ export const useCounterStore = defineStore('counter', () => {
5
+ const count = ref(0);
6
+ const doubleCount = computed(() => count.value * 2);
7
+ function increment() {
8
+ count.value++;
9
+ }
10
+
11
+ return {
12
+ count,
13
+ doubleCount,
14
+ increment,
15
+ };
16
+ });
@@ -0,0 +1,11 @@
1
+ <script setup lang="ts">
2
+ import { PageMain } from 'pubinfo';
3
+ </script>
4
+
5
+ <template>
6
+ <div>
7
+ <PageMain>
8
+ 注意看面包屑导航的变化
9
+ </PageMain>
10
+ </div>
11
+ </template>
@@ -0,0 +1,11 @@
1
+ <script setup lang="ts">
2
+ import { PageMain } from 'pubinfo';
3
+ </script>
4
+
5
+ <template>
6
+ <div>
7
+ <PageMain>
8
+ 注意看面包屑导航的变化
9
+ </PageMain>
10
+ </div>
11
+ </template>
@@ -0,0 +1,11 @@
1
+ <script setup lang="ts">
2
+ import { PageMain } from 'pubinfo';
3
+ </script>
4
+
5
+ <template>
6
+ <PageMain>
7
+ <RouterLink :to="{ name: 'breadcrumbExampleDetail1' }">
8
+ 查看详情页
9
+ </RouterLink>
10
+ </PageMain>
11
+ </template>
@@ -0,0 +1,11 @@
1
+ <script setup lang="ts">
2
+ import { PageMain } from 'pubinfo';
3
+ </script>
4
+
5
+ <template>
6
+ <PageMain>
7
+ <RouterLink :to="{ name: 'breadcrumbExampleDetail2' }">
8
+ 查看详情页
9
+ </RouterLink>
10
+ </PageMain>
11
+ </template>
@@ -0,0 +1,11 @@
1
+ <script setup lang="ts">
2
+ import { PageMain } from 'pubinfo';
3
+ </script>
4
+
5
+ <template>
6
+ <div>
7
+ <PageMain>
8
+ 多级导航2-2-2221
9
+ </PageMain>
10
+ </div>
11
+ </template>
@@ -0,0 +1,11 @@
1
+ <script setup lang="ts">
2
+ import { PageMain } from 'pubinfo';
3
+ </script>
4
+
5
+ <template>
6
+ <div>
7
+ <PageMain>
8
+ 多级导航2-2-1
9
+ </PageMain>
10
+ </div>
11
+ </template>
@@ -0,0 +1,11 @@
1
+ <script setup lang="ts">
2
+ import { PageMain } from 'pubinfo';
3
+ </script>
4
+
5
+ <template>
6
+ <div>
7
+ <PageMain>
8
+ 多级导航2-1
9
+ </PageMain>
10
+ </div>
11
+ </template>
@@ -0,0 +1,11 @@
1
+ <script setup lang="ts">
2
+ import { PageMain } from 'pubinfo';
3
+ </script>
4
+
5
+ <template>
6
+ <div>
7
+ <PageMain>
8
+ 多级导航1
9
+ </PageMain>
10
+ </div>
11
+ </template>
@@ -0,0 +1,13 @@
1
+ <script setup lang="ts">
2
+ import { PageMain } from 'pubinfo';
3
+
4
+ defineOptions({
5
+ name: 'OtherPageDetail',
6
+ });
7
+ </script>
8
+
9
+ <template>
10
+ <PageMain>
11
+ 123
12
+ </PageMain>
13
+ </template>
@@ -0,0 +1,25 @@
1
+ <script setup lang="ts">
2
+ import { PageMain } from 'pubinfo';
3
+
4
+ defineOptions({
5
+ name: 'OtherPage',
6
+ });
7
+ /* =============================================
8
+ = 逻辑代码 =
9
+ ============================================= */
10
+ const router = useRouter();
11
+ function jump() {
12
+ router.push({
13
+ name: 'OtherPageDetail',
14
+ });
15
+ }
16
+ </script>
17
+
18
+ <template>
19
+ <PageMain>
20
+ 列表页
21
+ <a-button type="primary" @click="jump">
22
+ 点击跳转入详情页
23
+ </a-button>
24
+ </PageMain>
25
+ </template>
@@ -0,0 +1,17 @@
1
+ <script setup lang="ts">
2
+ /* =============================================
3
+ = Vue SFC Options 配置 =
4
+ ============================================= */
5
+ defineOptions({
6
+ name: 'PreviewEmpty',
7
+ });
8
+ /* =============================================
9
+ = 逻辑代码 =
10
+ ============================================= */
11
+ </script>
12
+
13
+ <template>
14
+ <div>
15
+ 空白展示页面
16
+ </div>
17
+ </template>
@@ -0,0 +1,13 @@
1
+ <script setup lang="ts">
2
+ import { PageMain } from 'pubinfo';
3
+
4
+ defineOptions({
5
+ name: 'Demo',
6
+ });
7
+ </script>
8
+
9
+ <template>
10
+ <PageMain>
11
+ 演示页面,没有任何内容
12
+ </PageMain>
13
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class="home">
3
+ 主页
4
+ </div>
5
+ </template>
@@ -0,0 +1,29 @@
1
+ <script setup lang="ts">
2
+ import { useLoginTabs } from '../composables';
3
+
4
+ defineOptions({
5
+ name: 'LoginFrom',
6
+ });
7
+
8
+ const { tabs, initialTab, changeActiveTab } = useLoginTabs();
9
+ </script>
10
+
11
+ <template>
12
+ <div class="flex flex-col w-456px [background:transparent]">
13
+ <div class="flex flex-row overflow-hidden border border-solid border-[#e7e8e9] rounded-1">
14
+ <div
15
+ v-for="(tab, index) in tabs"
16
+ :key="tab.title"
17
+ class="flex flex-row items-center justify-center h-10 text-base cursor-pointer rounded"
18
+ :class="[initialTab === index ? 'text-[#2f6bff] bg-[#ecf1fd]' : 'text-[#8a8e92] ']"
19
+ :style="{ width: `${100 / tabs.length}%` }"
20
+ @click="changeActiveTab(index)"
21
+ >
22
+ {{ tab.title }}
23
+ </div>
24
+ </div>
25
+ <div class="relative min-h-350px">
26
+ <component :is="tabs[initialTab].component" :key="tabs[initialTab].title" :name="tabs[initialTab].title" />
27
+ </div>
28
+ </div>
29
+ </template>
@@ -0,0 +1,213 @@
1
+ <script setup lang="ts">
2
+ import type { SelectProps } from 'ant-design-vue';
3
+ import type { FormInstance, Rule } from 'ant-design-vue/es/form';
4
+ import { useToggle } from '@vueuse/core';
5
+ import { message } from 'ant-design-vue';
6
+ import { useCountdown } from '../composables';
7
+ import Savephone from './Savephone.vue';
8
+
9
+ defineOptions({
10
+ name: 'LoginWithPhone',
11
+ });
12
+
13
+ interface FormState {
14
+ phone: string
15
+ verify: string
16
+ checked: false
17
+ }
18
+ const [verifyDisabled, setVerifyDisabled] = useToggle(true);
19
+ const phoneForm = ref<FormInstance>();
20
+ const { count, start, isStart } = useCountdown();
21
+ const regionCode = ref<number>(0);
22
+ const router = useRouter();
23
+ const route = useRoute();
24
+
25
+ const formState = reactive<FormState>({
26
+ phone: '',
27
+ verify: '',
28
+ checked: false,
29
+ });
30
+
31
+ const rules: Record<string, Rule[]> = {
32
+ phone: [
33
+ {
34
+ validator: checkPhoneIsCorrect,
35
+ whitespace: true,
36
+ trigger: 'change',
37
+ },
38
+ ],
39
+ verify: [
40
+ {
41
+ required: true,
42
+ whitespace: true,
43
+ message: '请输入验证码',
44
+ },
45
+ ],
46
+ };
47
+
48
+ const regionCodeOptins: SelectProps['options'] = [
49
+ {
50
+ value: 0,
51
+ label: '+86 (中国大陆)',
52
+ },
53
+ {
54
+ value: 1,
55
+ label: '+852 (香港行政区)',
56
+ },
57
+ {
58
+ value: 2,
59
+ label: '+853 (澳门行政区)',
60
+ },
61
+ {
62
+ value: 3,
63
+ label: '+886 (台湾省)',
64
+ },
65
+ ];
66
+
67
+ async function checkPhoneIsCorrect(_rule: Rule, value: string) {
68
+ function reject(area: string) {
69
+ setVerifyDisabled(true);
70
+ return Promise.reject(new Error(`请输入正确的${area}手机号`));
71
+ }
72
+ if (!value) {
73
+ setVerifyDisabled(true);
74
+ return Promise.reject(new Error(`请输入手机号`));
75
+ }
76
+ switch (regionCode.value) {
77
+ // 中国大陆
78
+ case 0:
79
+ if (!/^1[3-9]\d{9}$/.test(value)) {
80
+ return reject('中国大陆');
81
+ }
82
+ break;
83
+ // 香港特别行政区
84
+ case 1:
85
+ if (!/^([569])\d{7}$/.test(value)) {
86
+ return reject('香港特别行政区');
87
+ }
88
+ break;
89
+ // 澳门特别行政区
90
+ case 2:
91
+ if (!/^6\d{7}$/.test(value)) {
92
+ return reject('澳门特别行政区');
93
+ }
94
+ break;
95
+ // 台湾省
96
+ case 3:
97
+ if (!/^9\d{8}$/.test(value)) {
98
+ return reject('台湾省');
99
+ }
100
+ break;
101
+ default:
102
+ break;
103
+ }
104
+ setVerifyDisabled(false);
105
+ }
106
+
107
+ async function areaChange() {
108
+ if (!formState.phone) {
109
+ return;
110
+ }
111
+ phoneForm.value?.validateFields('phone');
112
+ }
113
+
114
+ async function sendVerifyCode() {
115
+ message.success('验证码已发送,请注意查收');
116
+ start();
117
+ }
118
+
119
+ async function submit() {
120
+ try {
121
+ await phoneForm.value?.validate();
122
+
123
+ // 实现手机号登录逻辑
124
+
125
+ if (formState.checked) {
126
+ localStorage.setItem('pubinfo_web_savedPhone', formState.phone);
127
+ }
128
+ else {
129
+ localStorage.removeItem('pubinfo_web_savedPhone');
130
+ }
131
+ message.success('登录成功');
132
+ router.push(route.query.redirect?.toString() ?? '/');
133
+ }
134
+ catch (error) {
135
+ }
136
+ }
137
+
138
+ onMounted(() => {
139
+ const phone = localStorage.getItem('pubinfo_web_savedPhone');
140
+ if (phone) {
141
+ formState.phone = phone;
142
+ setVerifyDisabled(false);
143
+ formState.checked = true as any;
144
+ }
145
+ });
146
+ </script>
147
+
148
+ <template>
149
+ <div class="phone-form" mt-40px>
150
+ <a-form
151
+ ref="phoneForm"
152
+ :model="formState"
153
+ autocomplete="off"
154
+ :rules="rules"
155
+ @finish="submit"
156
+ >
157
+ <a-form-item name="phone">
158
+ <a-input-group compact>
159
+ <a-form-item-rest>
160
+ <a-select
161
+ v-model:value="regionCode"
162
+ size="large"
163
+ style="width: 35%;"
164
+ :options="regionCodeOptins"
165
+ @change="areaChange"
166
+ />
167
+ </a-form-item-rest>
168
+ <a-input
169
+ v-model:value="formState.phone"
170
+ allow-clear
171
+ size="large"
172
+ placeholder="请输入手机号"
173
+ style="width: 65%;"
174
+ />
175
+ </a-input-group>
176
+ </a-form-item>
177
+
178
+ <a-form-item name="verify">
179
+ <a-input
180
+ v-model:value="formState.verify"
181
+ allow-clear
182
+ size="large"
183
+ placeholder="请输入验证码"
184
+ >
185
+ <template #suffix>
186
+ <a-button
187
+ size="small"
188
+ type="link"
189
+ :disabled="verifyDisabled"
190
+ >
191
+ <span v-if="!isStart" @click="sendVerifyCode">获取短信验证码</span>
192
+ <span v-else text="#8A8E92">{{ count }}秒后重新获取</span>
193
+ </a-button>
194
+ </template>
195
+ </a-input>
196
+ </a-form-item>
197
+ <a-form-item>
198
+ <Savephone v-model:checked="formState.checked" />
199
+ </a-form-item>
200
+ <a-form-item>
201
+ <a-button
202
+ class="h-48px!"
203
+ block
204
+ type="primary"
205
+ html-type="submit"
206
+ :disabled="!formState.checked"
207
+ >
208
+ 登录
209
+ </a-button>
210
+ </a-form-item>
211
+ </a-form>
212
+ </div>
213
+ </template>
@@ -0,0 +1,178 @@
1
+ <script setup lang="ts">
2
+ import type { FormInstance, Rule } from 'ant-design-vue/es/form';
3
+ import type { UnwrapRef } from 'vue';
4
+ import { PubinfoVerifyInput } from '@pubinfo/module-captcha';
5
+ import { useToggle } from '@vueuse/core';
6
+ import { message, Modal } from 'ant-design-vue';
7
+ import { RESPONSE_CODE, useUserStore } from 'pubinfo';
8
+ import { useFocusElement } from '../composables';
9
+ import Useragreement from './Useragreement.vue';
10
+
11
+ defineOptions({
12
+ name: 'PasswordLogin',
13
+ });
14
+
15
+ interface FormState {
16
+ account: string
17
+ password: string
18
+ captchas: string
19
+ captchaHash: string
20
+ checked: boolean
21
+ }
22
+
23
+ interface HttpError {
24
+ code: RESPONSE_CODE
25
+ data: any
26
+ hint: string
27
+ msg: string
28
+ success: boolean
29
+ }
30
+
31
+ function isHttpError(error: unknown): error is HttpError {
32
+ return (error as HttpError).code !== undefined;
33
+ }
34
+
35
+ const pubinfoVerifyInputRef = ref<InstanceType<typeof PubinfoVerifyInput> | null>(null);
36
+ const userStore = useUserStore();
37
+ const router = useRouter();
38
+ const route = useRoute();
39
+ const { focusElementDataId } = useFocusElement();
40
+
41
+ const loginForm = ref<FormInstance | null>(null);
42
+ const formState: UnwrapRef<FormState & { captchaType?: string }> = reactive({
43
+ account: '',
44
+ password: '',
45
+ captchas: '',
46
+ checked: true,
47
+ captchaHash: '',
48
+ captchaType: '',
49
+ });
50
+
51
+ const rules: Record<string, Rule[]> = {
52
+ account: [{ required: true, whitespace: true, message: '请输入账号' }],
53
+ password: [{ required: true, whitespace: true, message: '请输入密码' }],
54
+ captchas: [{ required: true, whitespace: true, message: '请输入验证码' }],
55
+ };
56
+
57
+ function getCaptchaHash(hash: string) {
58
+ formState.captchaHash = hash;
59
+ }
60
+
61
+ const [loading, setLoading] = useToggle(false);
62
+
63
+ async function onSubmit() {
64
+ if (loading.value) {
65
+ return;
66
+ }
67
+ setLoading(true);
68
+ try {
69
+ await loginForm.value?.validate();
70
+ await userStore.signIn(formState);
71
+ message.success('登录成功');
72
+ router.push(route.query.redirect?.toString() ?? '/');
73
+ }
74
+ catch (error) {
75
+ if (isHttpError(error)) {
76
+ const code = error.code;
77
+ switch (code) {
78
+ case RESPONSE_CODE.LOGINNAME_PASSWORD_WRONG:
79
+ case RESPONSE_CODE.CODE_OVERTIME:
80
+ case RESPONSE_CODE.CODE_WRONG:
81
+ pubinfoVerifyInputRef.value?.refresh();
82
+ break;
83
+ case RESPONSE_CODE.CHANGE_INIT_PASSWORD:
84
+ case RESPONSE_CODE.PASSWORD_EXPIRED:
85
+ createChangePasswordModal(error.msg, error?.data?.accessToken);
86
+ break;
87
+ default:
88
+ break;
89
+ }
90
+ }
91
+ }
92
+ finally {
93
+ setLoading(false);
94
+ }
95
+ }
96
+
97
+ function createChangePasswordModal(msg: string, token: string) {
98
+ Modal.confirm({
99
+ title: '提示',
100
+ content() {
101
+ return msg;
102
+ },
103
+ okText: '修改密码',
104
+ cancelText: '暂不登录',
105
+ onOk() {
106
+ router.push({
107
+ name: 'ChangePassword',
108
+ params: {
109
+ changePassWordToken: token,
110
+ },
111
+ });
112
+ },
113
+ });
114
+ }
115
+ </script>
116
+
117
+ <template>
118
+ <div class="mt-10">
119
+ <AForm ref="loginForm" :model="formState" :rules="rules" @finish="onSubmit">
120
+ <a-form-item name="account">
121
+ <a-input
122
+ v-model:value="formState.account"
123
+ allow-clear
124
+ size="large"
125
+ placeholder="请输入登录账号"
126
+ data-id="account"
127
+ >
128
+ <template #prefix>
129
+ <PubinfoIcon v-if="focusElementDataId === 'account'" name="i-solar-user-bold" color="#1578FF" />
130
+ <PubinfoIcon v-else name="i-solar-user-broken" color="#AFB0B2" />
131
+ </template>
132
+ </a-input>
133
+ </a-form-item>
134
+ <a-form-item name="password">
135
+ <a-input-password
136
+ v-model:value="formState.password"
137
+ allow-clear
138
+ size="large"
139
+ placeholder="请输入登录密码"
140
+ visibility-toggle
141
+ data-id="password"
142
+ >
143
+ <template #prefix>
144
+ <PubinfoIcon v-if="focusElementDataId === 'password'" name="i-solar-lock-password-unlocked-bold" color="#1578FF" />
145
+ <PubinfoIcon v-else name="i-solar-lock-password-unlocked-broken" color="#AFB0B2" />
146
+ </template>
147
+ </a-input-password>
148
+ </a-form-item>
149
+ <a-form-item name="captchas">
150
+ <PubinfoVerifyInput ref="pubinfoVerifyInputRef" v-model="formState.captchas" size="large" @get-captcha-hash="getCaptchaHash" />
151
+ </a-form-item>
152
+ <a-form-item>
153
+ <Useragreement v-model:checked="formState.checked" />
154
+ </a-form-item>
155
+ <a-form-item>
156
+ <div w-full h-48px>
157
+ <a-button
158
+ class="h-48px!"
159
+ type="primary"
160
+ html-type="submit"
161
+ block
162
+ :disabled="!formState.checked"
163
+ :loading="loading"
164
+ >
165
+ 登录
166
+ </a-button>
167
+ </div>
168
+ </a-form-item>
169
+ </AForm>
170
+ </div>
171
+ </template>
172
+
173
+ <style scoped>
174
+ :deep(.ant-input-group-addon) {
175
+ padding: 0 !important;
176
+ overflow: hidden;
177
+ }
178
+ </style>
@@ -0,0 +1,17 @@
1
+ <script setup lang="ts">
2
+ defineOptions({
3
+ name: 'Savephone',
4
+ });
5
+
6
+ const checked = defineModel(
7
+ 'checked',
8
+ {
9
+ type: Boolean, default: false,
10
+ });
11
+ </script>
12
+
13
+ <template>
14
+ <a-checkbox v-model:checked="checked">
15
+ 记住手机号
16
+ </a-checkbox>
17
+ </template>
@@ -0,0 +1,26 @@
1
+ <script setup lang="ts">
2
+ defineOptions({
3
+ name: 'Useragreement',
4
+ });
5
+
6
+ const checked = defineModel(
7
+ 'checked',
8
+ {
9
+ type: Boolean, default: true,
10
+ });
11
+
12
+ function jumpUseragreementPage() {
13
+ // 暂未实现用户协议、隐私政策
14
+ }
15
+ </script>
16
+
17
+ <template>
18
+ <a-checkbox v-model:checked="checked">
19
+ 我已阅读并同意<span
20
+ hover:underline
21
+ decoration-2
22
+ text="#1578FF"
23
+ @click.prevent="jumpUseragreementPage"
24
+ >用户协议、隐私政策</span>
25
+ </a-checkbox>
26
+ </template>