af-mobile-client-vue3 1.3.54 → 1.3.57

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 (56) hide show
  1. package/package.json +115 -115
  2. package/public/favicon.svg +4 -4
  3. package/scripts/verifyCommit.js +19 -19
  4. package/src/App.vue +1 -1
  5. package/src/api/user/index.ts +45 -45
  6. package/src/components/data/UserDetail/types.ts +1 -1
  7. package/src/components/data/XReportGrid/XAddReport/index.ts +1 -1
  8. package/src/components/data/XReportGrid/XReportDrawer/index.ts +1 -1
  9. package/src/components/data/XTag/index.vue +10 -10
  10. package/src/components/layout/TabBarLayout/index.vue +40 -40
  11. package/src/font-style/Inter-Bold.woff2 +0 -0
  12. package/src/font-style/Inter-Medium.woff2 +0 -0
  13. package/src/font-style/Inter-Regular.woff2 +0 -0
  14. package/src/font-style/Inter-SemiBold.woff2 +0 -0
  15. package/src/font-style/PingFangSC-Medium.subset.woff2 +0 -0
  16. package/src/font-style/PingFangSC-Medium.woff2 +0 -0
  17. package/src/font-style/PingFangSC-Regular.subset.woff2 +0 -0
  18. package/src/font-style/PingFangSC-Semibold.subset.woff2 +0 -0
  19. package/src/font-style/PingFangSC-Semibold.woff2 +0 -0
  20. package/src/font-style/font.css +59 -2
  21. package/src/hooks/useCommon.ts +9 -9
  22. package/src/plugins/AppData.ts +38 -38
  23. package/src/router/external-routes.ts +69 -69
  24. package/src/router/guards.ts +131 -131
  25. package/src/router/invoiceRoutes.ts +33 -33
  26. package/src/router/routes.ts +421 -421
  27. package/src/services/api/Login.ts +6 -6
  28. package/src/services/api/common.ts +109 -109
  29. package/src/services/api/manage.ts +8 -8
  30. package/src/services/api/search.ts +16 -16
  31. package/src/services/restTools.ts +56 -56
  32. package/src/services/v3Api.ts +11 -11
  33. package/src/stores/modules/user.ts +1 -1
  34. package/src/styles/login.less +109 -109
  35. package/src/types/platform.ts +194 -194
  36. package/src/utils/authority-utils.ts +84 -84
  37. package/src/utils/crypto.ts +39 -39
  38. package/src/utils/environment.ts +10 -10
  39. package/src/utils/platform-auth.ts +150 -150
  40. package/src/utils/routerUtil.ts +81 -2
  41. package/src/utils/runEvalFunction.ts +13 -13
  42. package/src/utils/wechat.ts +297 -297
  43. package/src/views/component/EvaluateRecordView/index.vue +40 -40
  44. package/src/views/component/XCellDetailView/index.vue +217 -217
  45. package/src/views/component/XReportFormIframeView/index.vue +47 -47
  46. package/src/views/component/XReportFormView/index.vue +13 -13
  47. package/src/views/component/XSignatureView/index.vue +50 -50
  48. package/src/views/component/notice.vue +46 -46
  49. package/src/views/component/topNav.vue +36 -36
  50. package/src/views/invoiceShow/index.vue +61 -61
  51. package/src/views/loading/AuthLoading.vue +378 -378
  52. package/src/views/user/login/index.vue +22 -22
  53. package/src/views/user/register/index.vue +1 -1
  54. package/vite.config.ts +114 -114
  55. package/certs/127.0.0.1+2-key.pem +0 -28
  56. package/certs/127.0.0.1+2.pem +0 -27
@@ -1,38 +1,38 @@
1
- import type { App } from 'vue'
2
- import { manageApi } from '@af-mobile-client-vue3/services/api/manage'
3
- import { APP_WEB_CONFIG_KEY } from '@af-mobile-client-vue3/stores/mutation-type'
4
- import { handleTree } from '@af-mobile-client-vue3/utils/dataUtil'
5
- import { indexedDB } from '@af-mobile-client-vue3/utils/indexedDB'
6
- import { createStorage } from '@af-mobile-client-vue3/utils/Storage'
7
-
8
- const Storage = createStorage({ storage: localStorage })
9
-
10
- export const GetAppDataService = {
11
- install(app: App<Element>) {
12
- app.provide('$appdata', GetAppDataService)
13
- },
14
- async load() {
15
- },
16
- // 返回树形省市区
17
- async getDivisionsOhChinaForTree() {
18
- // 获取省市区数据
19
- return new Promise((resolve, reject) => {
20
- try {
21
- indexedDB.getByWeb('divisionsOhChina', manageApi.getDivisionsOhChina, {}, (res) => {
22
- resolve(res)
23
- }, (processRes) => {
24
- return handleTree(processRes, 'code', 'parentcode', null)
25
- })
26
- }
27
- catch (e) {
28
- reject(e)
29
- }
30
- })
31
- },
32
- getWebConfigByKey(key: string) {
33
- const object = Storage.get(APP_WEB_CONFIG_KEY)
34
- return object[key]
35
- },
36
- }
37
-
38
- export default GetAppDataService
1
+ import type { App } from 'vue'
2
+ import { manageApi } from '@af-mobile-client-vue3/services/api/manage'
3
+ import { APP_WEB_CONFIG_KEY } from '@af-mobile-client-vue3/stores/mutation-type'
4
+ import { handleTree } from '@af-mobile-client-vue3/utils/dataUtil'
5
+ import { indexedDB } from '@af-mobile-client-vue3/utils/indexedDB'
6
+ import { createStorage } from '@af-mobile-client-vue3/utils/Storage'
7
+
8
+ const Storage = createStorage({ storage: localStorage })
9
+
10
+ export const GetAppDataService = {
11
+ install(app: App<Element>) {
12
+ app.provide('$appdata', GetAppDataService)
13
+ },
14
+ async load() {
15
+ },
16
+ // 返回树形省市区
17
+ async getDivisionsOhChinaForTree() {
18
+ // 获取省市区数据
19
+ return new Promise((resolve, reject) => {
20
+ try {
21
+ indexedDB.getByWeb('divisionsOhChina', manageApi.getDivisionsOhChina, {}, (res) => {
22
+ resolve(res)
23
+ }, (processRes) => {
24
+ return handleTree(processRes, 'code', 'parentcode', null)
25
+ })
26
+ }
27
+ catch (e) {
28
+ reject(e)
29
+ }
30
+ })
31
+ },
32
+ getWebConfigByKey(key: string) {
33
+ const object = Storage.get(APP_WEB_CONFIG_KEY)
34
+ return object[key]
35
+ },
36
+ }
37
+
38
+ export default GetAppDataService
@@ -1,69 +1,69 @@
1
- /**
2
- * 外部用户路由配置(简化版示例)
3
- * 为外部用户提供基本的示例页面
4
- */
5
-
6
- import type { RouteRecordRaw } from 'vue-router'
7
-
8
- // 导入外部用户专用组件
9
- import ExternalHome from '@af-mobile-client-vue3/views/external/index.vue'
10
- import my from '@af-mobile-client-vue3/views/user/my/index.vue'
11
-
12
- /**
13
- * 外部用户路由元信息的默认配置
14
- */
15
- const externalUserMeta = {
16
- requiresAuth: true,
17
- allowExternalUser: true,
18
- }
19
-
20
- /**
21
- * 外部用户专用路由(简化版示例)
22
- */
23
- const externalUserRoutes: Array<RouteRecordRaw> = [
24
- // 外部用户首页
25
- {
26
- path: '/wechat',
27
- name: 'ExternalHome',
28
- component: ExternalHome,
29
- meta: {
30
- ...externalUserMeta,
31
- title: '外部用户首页',
32
- },
33
- },
34
- {
35
- path: '/wx-mini-program',
36
- name: 'ExternalHome',
37
- component: ExternalHome,
38
- meta: {
39
- ...externalUserMeta,
40
- title: '外部用户首页',
41
- },
42
- },
43
- // 用户个人中心
44
- {
45
- path: '/wechat/my',
46
- name: 'ExternalUserProfile',
47
- component: my,
48
- meta: {
49
- ...externalUserMeta,
50
- title: '个人中心',
51
- },
52
- },
53
- ]
54
-
55
- /**
56
- * 获取外部用户可访问的路由列表
57
- */
58
- export function getExternalUserRoutes(): RouteRecordRaw[] {
59
- return externalUserRoutes
60
- }
61
-
62
- /**
63
- * 检查路由是否为外部用户路由
64
- */
65
- export function isExternalUserRoute(path: string): boolean {
66
- return path.startsWith('/ex/')
67
- }
68
-
69
- export default externalUserRoutes
1
+ /**
2
+ * 外部用户路由配置(简化版示例)
3
+ * 为外部用户提供基本的示例页面
4
+ */
5
+
6
+ import type { RouteRecordRaw } from 'vue-router'
7
+
8
+ // 导入外部用户专用组件
9
+ import ExternalHome from '@af-mobile-client-vue3/views/external/index.vue'
10
+ import my from '@af-mobile-client-vue3/views/user/my/index.vue'
11
+
12
+ /**
13
+ * 外部用户路由元信息的默认配置
14
+ */
15
+ const externalUserMeta = {
16
+ requiresAuth: true,
17
+ allowExternalUser: true,
18
+ }
19
+
20
+ /**
21
+ * 外部用户专用路由(简化版示例)
22
+ */
23
+ const externalUserRoutes: Array<RouteRecordRaw> = [
24
+ // 外部用户首页
25
+ {
26
+ path: '/wechat',
27
+ name: 'ExternalHome',
28
+ component: ExternalHome,
29
+ meta: {
30
+ ...externalUserMeta,
31
+ title: '外部用户首页',
32
+ },
33
+ },
34
+ {
35
+ path: '/wx-mini-program',
36
+ name: 'ExternalHome',
37
+ component: ExternalHome,
38
+ meta: {
39
+ ...externalUserMeta,
40
+ title: '外部用户首页',
41
+ },
42
+ },
43
+ // 用户个人中心
44
+ {
45
+ path: '/wechat/my',
46
+ name: 'ExternalUserProfile',
47
+ component: my,
48
+ meta: {
49
+ ...externalUserMeta,
50
+ title: '个人中心',
51
+ },
52
+ },
53
+ ]
54
+
55
+ /**
56
+ * 获取外部用户可访问的路由列表
57
+ */
58
+ export function getExternalUserRoutes(): RouteRecordRaw[] {
59
+ return externalUserRoutes
60
+ }
61
+
62
+ /**
63
+ * 检查路由是否为外部用户路由
64
+ */
65
+ export function isExternalUserRoute(path: string): boolean {
66
+ return path.startsWith('/ex/')
67
+ }
68
+
69
+ export default externalUserRoutes
@@ -1,131 +1,131 @@
1
- import type { RouteLocationNormalized } from 'vue-router'
2
- import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
3
- import { UserType } from '@af-mobile-client-vue3/types/auth'
4
- import { hasAuthority } from '@af-mobile-client-vue3/utils/authority-utils'
5
- import { isExternalUser } from '@af-mobile-client-vue3/utils/platform-auth'
6
- import { showToast } from 'vant'
7
-
8
- // 不需要登录拦截的路由配置
9
- const loginIgnore = {
10
- names: ['404', '403', 'user-appointment', 'appointment-form', 'appointment-history', 'AuthLoading'], // 根据路由名称匹配
11
- paths: ['/login', '/XReportFormIframeView', '/invoiceShow', '/register', '/loading'], // 根据路由fullPath匹配
12
- /**
13
- * 判断路由是否包含在该配置中
14
- * @param route vue-router 的 route 对象
15
- */
16
- includes(route) {
17
- return this.names.includes(route.name) || this.paths.includes(route.path)
18
- },
19
- }
20
-
21
- /**
22
- * 登录守卫 - 支持外部用户微信授权
23
- * @param to 目标路由
24
- * @param from 来源路由
25
- * @param next 导航函数
26
- */
27
- function loginGuard(to: RouteLocationNormalized, from: RouteLocationNormalized, next: any) {
28
- const userStore = useUserStore()
29
- const token = userStore.getToken()
30
-
31
- // 跳过不需要登录验证的路由
32
- if (loginIgnore.includes(to)) {
33
- next()
34
- return
35
- }
36
-
37
- // 已登录用户的处理
38
- if (token) {
39
- // 如果已登录且访问登录页,重定向到首页
40
- if (to.path === '/login') {
41
- const defaultRoute = userStore.getDefaultRoute()
42
- next({ path: defaultRoute })
43
- return
44
- }
45
- next()
46
- return
47
- }
48
-
49
- // 未登录用户的处理
50
- if (!token) {
51
- // 使用统一的检测函数判断用户类型
52
- const externalResult = isExternalUser(to)
53
-
54
- if (externalResult.isExternal) {
55
- // 外部用户统一跳转到 loading 页面
56
- const query: any = {
57
- redirect: to.path,
58
- }
59
-
60
- // 直接将认证参数传递到路由查询参数中
61
- if (externalResult.authParams) {
62
- Object.assign(query, externalResult.authParams)
63
- }
64
-
65
- next({
66
- path: '/loading',
67
- query,
68
- })
69
- return
70
- }
71
-
72
- // 内部用户跳转到登录页
73
- showToast({
74
- message: '登录状态已失效,请重新登录!',
75
- position: 'bottom',
76
- })
77
- next({ path: '/login' })
78
- }
79
- }
80
-
81
- /**
82
- * 权限守卫 - 支持外部用户权限检查
83
- * @param to 目标路由
84
- * @param from 来源路由
85
- * @param next 导航函数
86
- */
87
- function authorityGuard(to: RouteLocationNormalized, from: RouteLocationNormalized, next: any) {
88
- const userStore = useUserStore()
89
- const userType = userStore.getUserType()
90
- const permissions = userStore.getPermissions()
91
- const roles = userStore.getRoles()
92
-
93
- // 跳过不需要权限验证的路由
94
- if (loginIgnore.includes(to)) {
95
- next()
96
- return
97
- }
98
-
99
- const meta = to.meta
100
-
101
- // 如果路由不需要认证,直接通过
102
- if (meta.requiresAuth === false) {
103
- next()
104
- return
105
- }
106
-
107
- // 检查用户类型权限
108
- const isExternalUser = userType === UserType.EXTERNAL
109
- const allowExternalUser = meta.allowExternalUser ?? false
110
-
111
- if (isExternalUser && !allowExternalUser) {
112
- // 外部用户访问不被允许的页面,重定向到403页面
113
- next({ path: '/403' })
114
- return
115
- }
116
-
117
- // 传统权限检查
118
- if (!hasAuthority(to, permissions, roles)) {
119
- // 没有权限,重定向到403页面
120
- next({ path: '/403' })
121
- return
122
- }
123
-
124
- // 权限检查通过
125
- next()
126
- }
127
-
128
- export default {
129
- beforeEach: [loginGuard, authorityGuard],
130
- afterEach: [],
131
- }
1
+ import type { RouteLocationNormalized } from 'vue-router'
2
+ import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
3
+ import { UserType } from '@af-mobile-client-vue3/types/auth'
4
+ import { hasAuthority } from '@af-mobile-client-vue3/utils/authority-utils'
5
+ import { isExternalUser } from '@af-mobile-client-vue3/utils/platform-auth'
6
+ import { showToast } from 'vant'
7
+
8
+ // 不需要登录拦截的路由配置
9
+ const loginIgnore = {
10
+ names: ['404', '403', 'user-appointment', 'appointment-form', 'appointment-history', 'AuthLoading'], // 根据路由名称匹配
11
+ paths: ['/login', '/XReportFormIframeView', '/invoiceShow', '/register', '/loading'], // 根据路由fullPath匹配
12
+ /**
13
+ * 判断路由是否包含在该配置中
14
+ * @param route vue-router 的 route 对象
15
+ */
16
+ includes(route) {
17
+ return this.names.includes(route.name) || this.paths.includes(route.path)
18
+ },
19
+ }
20
+
21
+ /**
22
+ * 登录守卫 - 支持外部用户微信授权
23
+ * @param to 目标路由
24
+ * @param from 来源路由
25
+ * @param next 导航函数
26
+ */
27
+ function loginGuard(to: RouteLocationNormalized, from: RouteLocationNormalized, next: any) {
28
+ const userStore = useUserStore()
29
+ const token = userStore.getToken()
30
+
31
+ // 跳过不需要登录验证的路由
32
+ if (loginIgnore.includes(to)) {
33
+ next()
34
+ return
35
+ }
36
+
37
+ // 已登录用户的处理
38
+ if (token) {
39
+ // 如果已登录且访问登录页,重定向到首页
40
+ if (to.path === '/login') {
41
+ const defaultRoute = userStore.getDefaultRoute()
42
+ next({ path: defaultRoute })
43
+ return
44
+ }
45
+ next()
46
+ return
47
+ }
48
+
49
+ // 未登录用户的处理
50
+ if (!token) {
51
+ // 使用统一的检测函数判断用户类型
52
+ const externalResult = isExternalUser(to)
53
+
54
+ if (externalResult.isExternal) {
55
+ // 外部用户统一跳转到 loading 页面
56
+ const query: any = {
57
+ redirect: to.path,
58
+ }
59
+
60
+ // 直接将认证参数传递到路由查询参数中
61
+ if (externalResult.authParams) {
62
+ Object.assign(query, externalResult.authParams)
63
+ }
64
+
65
+ next({
66
+ path: '/loading',
67
+ query,
68
+ })
69
+ return
70
+ }
71
+
72
+ // 内部用户跳转到登录页
73
+ showToast({
74
+ message: '登录状态已失效,请重新登录!',
75
+ position: 'bottom',
76
+ })
77
+ next({ path: '/login' })
78
+ }
79
+ }
80
+
81
+ /**
82
+ * 权限守卫 - 支持外部用户权限检查
83
+ * @param to 目标路由
84
+ * @param from 来源路由
85
+ * @param next 导航函数
86
+ */
87
+ function authorityGuard(to: RouteLocationNormalized, from: RouteLocationNormalized, next: any) {
88
+ const userStore = useUserStore()
89
+ const userType = userStore.getUserType()
90
+ const permissions = userStore.getPermissions()
91
+ const roles = userStore.getRoles()
92
+
93
+ // 跳过不需要权限验证的路由
94
+ if (loginIgnore.includes(to)) {
95
+ next()
96
+ return
97
+ }
98
+
99
+ const meta = to.meta
100
+
101
+ // 如果路由不需要认证,直接通过
102
+ if (meta.requiresAuth === false) {
103
+ next()
104
+ return
105
+ }
106
+
107
+ // 检查用户类型权限
108
+ const isExternalUser = userType === UserType.EXTERNAL
109
+ const allowExternalUser = meta.allowExternalUser ?? false
110
+
111
+ if (isExternalUser && !allowExternalUser) {
112
+ // 外部用户访问不被允许的页面,重定向到403页面
113
+ next({ path: '/403' })
114
+ return
115
+ }
116
+
117
+ // 传统权限检查
118
+ if (!hasAuthority(to, permissions, roles)) {
119
+ // 没有权限,重定向到403页面
120
+ next({ path: '/403' })
121
+ return
122
+ }
123
+
124
+ // 权限检查通过
125
+ next()
126
+ }
127
+
128
+ export default {
129
+ beforeEach: [loginGuard, authorityGuard],
130
+ afterEach: [],
131
+ }
@@ -1,33 +1,33 @@
1
- import type { RouteRecordRaw } from 'vue-router'
2
- import PageLayout from '@af-mobile-client-vue3/layout/PageLayout.vue'
3
- import NotFound from '@af-mobile-client-vue3/views/common/NotFound.vue'
4
- import invoiceShow from '@af-mobile-client-vue3/views/invoiceShow/index.vue'
5
-
6
- const routes: Array<RouteRecordRaw> = [
7
- {
8
- path: '/',
9
- name: 'root',
10
- component: PageLayout,
11
- redirect: { name: 'Component' },
12
- children: [
13
- {
14
- path: '/invoiceShow',
15
- name: 'invoiceShow',
16
- component: invoiceShow,
17
- },
18
- ],
19
- },
20
- {
21
- path: '/404',
22
- name: '404',
23
- component: NotFound,
24
- },
25
- {
26
- path: '/:pathMatch(.*)',
27
- redirect: {
28
- name: '404',
29
- },
30
- },
31
- ]
32
-
33
- export default routes
1
+ import type { RouteRecordRaw } from 'vue-router'
2
+ import PageLayout from '@af-mobile-client-vue3/layout/PageLayout.vue'
3
+ import NotFound from '@af-mobile-client-vue3/views/common/NotFound.vue'
4
+ import invoiceShow from '@af-mobile-client-vue3/views/invoiceShow/index.vue'
5
+
6
+ const routes: Array<RouteRecordRaw> = [
7
+ {
8
+ path: '/',
9
+ name: 'root',
10
+ component: PageLayout,
11
+ redirect: { name: 'Component' },
12
+ children: [
13
+ {
14
+ path: '/invoiceShow',
15
+ name: 'invoiceShow',
16
+ component: invoiceShow,
17
+ },
18
+ ],
19
+ },
20
+ {
21
+ path: '/404',
22
+ name: '404',
23
+ component: NotFound,
24
+ },
25
+ {
26
+ path: '/:pathMatch(.*)',
27
+ redirect: {
28
+ name: '404',
29
+ },
30
+ },
31
+ ]
32
+
33
+ export default routes