af-mobile-client-vue3 1.4.64 → 1.4.66

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.
@@ -1,194 +1,194 @@
1
- /**
2
- * 平台类型枚举定义
3
- */
4
- export enum PlatformType {
5
- /**
6
- * 微信公众号
7
- */
8
- WECHAT_OFFICIAL = 'WECHAT_OFFICIAL',
9
-
10
- /**
11
- * 微信小程序
12
- */
13
- WECHAT_MINI = 'WECHAT_MINI',
14
-
15
- /**
16
- * 支付宝
17
- */
18
- ALIPAY = 'ALIPAY',
19
-
20
- /**
21
- * 钉钉
22
- */
23
- DINGTALK = 'DINGTALK',
24
-
25
- /**
26
- * 第三方应用
27
- */
28
- THIRD_PARTY_APP = 'THIRD_PARTY_APP',
29
-
30
- /**
31
- * 飞书
32
- */
33
- FEISHU = 'FEISHU',
34
-
35
- /**
36
- * 抖音
37
- */
38
- TIKTOK = 'TIKTOK',
39
-
40
- /**
41
- * 自定义平台
42
- */
43
- CUSTOM = 'CUSTOM',
44
- }
45
-
46
- /**
47
- * 平台配置信息
48
- */
49
- export interface PlatformConfig {
50
- /** 平台类型 */
51
- type: PlatformType
52
- /** 平台显示名称 */
53
- name: string
54
- /** 平台路由前缀 */
55
- routePrefix: string
56
- /** 平台描述 */
57
- description?: string
58
- /** 认证加载显示名称 */
59
- authDisplayName?: string
60
- }
61
-
62
- /**
63
- * 平台类型与路由前缀的映射配置
64
- */
65
- export const PLATFORM_ROUTE_MAP: Record<PlatformType, string> = {
66
- [PlatformType.WECHAT_OFFICIAL]: '/wechat/',
67
- [PlatformType.WECHAT_MINI]: '/wx-mini-program/',
68
- [PlatformType.ALIPAY]: '/alipay/',
69
- [PlatformType.DINGTALK]: '/ding-talk/',
70
- [PlatformType.THIRD_PARTY_APP]: '/app/',
71
- [PlatformType.FEISHU]: '/feishu/',
72
- [PlatformType.TIKTOK]: '/tiktok/',
73
- [PlatformType.CUSTOM]: '/custom/',
74
- }
75
-
76
- /**
77
- * 平台详细配置信息
78
- */
79
- export const PLATFORM_CONFIGS: Record<PlatformType, PlatformConfig> = {
80
- [PlatformType.WECHAT_OFFICIAL]: {
81
- type: PlatformType.WECHAT_OFFICIAL,
82
- name: '微信公众号',
83
- routePrefix: '/wechat/',
84
- description: '微信公众号外部用户',
85
- },
86
- [PlatformType.WECHAT_MINI]: {
87
- type: PlatformType.WECHAT_MINI,
88
- name: '微信小程序',
89
- routePrefix: '/wx-mini-program/',
90
- description: '微信小程序用户',
91
- },
92
- [PlatformType.ALIPAY]: {
93
- type: PlatformType.ALIPAY,
94
- name: '支付宝',
95
- routePrefix: '/alipay/',
96
- description: '支付宝用户',
97
- },
98
- [PlatformType.DINGTALK]: {
99
- type: PlatformType.DINGTALK,
100
- name: '钉钉',
101
- routePrefix: '/ding-talk/',
102
- description: '钉钉用户',
103
- },
104
- [PlatformType.THIRD_PARTY_APP]: {
105
- type: PlatformType.THIRD_PARTY_APP,
106
- name: '第三方应用',
107
- routePrefix: '/app/',
108
- description: '第三方应用用户',
109
- },
110
- [PlatformType.FEISHU]: {
111
- type: PlatformType.FEISHU,
112
- name: '飞书',
113
- routePrefix: '/feishu/',
114
- description: '飞书用户',
115
- },
116
- [PlatformType.TIKTOK]: {
117
- type: PlatformType.TIKTOK,
118
- name: '抖音',
119
- routePrefix: '/tiktok/',
120
- description: '抖音用户',
121
- },
122
- [PlatformType.CUSTOM]: {
123
- type: PlatformType.CUSTOM,
124
- name: '自定义平台',
125
- routePrefix: '/custom/',
126
- description: '自定义平台用户',
127
- },
128
- }
129
-
130
- /**
131
- * 根据平台类型获取路由前缀
132
- * @param platformType 平台类型
133
- * @returns 路由前缀,默认为 '/ex/'
134
- */
135
- export function getPlatformRoutePrefix(platformType?: string): string {
136
- if (!platformType) {
137
- return '/ex/' // 默认外部用户路径
138
- }
139
-
140
- const route = PLATFORM_ROUTE_MAP[platformType as PlatformType]
141
- return route || '/ex/' // 找不到时使用默认路径
142
- }
143
-
144
- /**
145
- * 根据平台类型获取平台配置
146
- * @param platformType 平台类型
147
- * @returns 平台配置信息
148
- */
149
- export function getPlatformConfig(platformType?: string): PlatformConfig | null {
150
- if (!platformType) {
151
- return null
152
- }
153
-
154
- return PLATFORM_CONFIGS[platformType as PlatformType] || null
155
- }
156
-
157
- /**
158
- * 检查是否为有效的平台类型
159
- * @param platformType 平台类型
160
- * @returns 是否为有效平台类型
161
- */
162
- export function isValidPlatformType(platformType: string): platformType is PlatformType {
163
- return Object.values(PlatformType).includes(platformType as PlatformType)
164
- }
165
-
166
- /**
167
- * 获取所有支持的平台类型列表
168
- * @returns 平台类型数组
169
- */
170
- export function getAllPlatformTypes(): PlatformType[] {
171
- return Object.values(PlatformType)
172
- }
173
-
174
- /**
175
- * 获取所有平台配置列表
176
- * @returns 平台配置数组
177
- */
178
- export function getAllPlatformConfigs(): PlatformConfig[] {
179
- return Object.values(PLATFORM_CONFIGS)
180
- }
181
-
182
- /**
183
- * 根据平台类型获取认证显示名称
184
- * @param platformType 平台类型
185
- * @returns 认证显示名称,默认为 '第三方登录'
186
- */
187
- export function getPlatformAuthDisplayName(platformType?: string): string {
188
- if (!platformType) {
189
- return '第三方登录'
190
- }
191
-
192
- const config = PLATFORM_CONFIGS[platformType as PlatformType]
193
- return config?.authDisplayName || '第三方登录'
194
- }
1
+ /**
2
+ * 平台类型枚举定义
3
+ */
4
+ export enum PlatformType {
5
+ /**
6
+ * 微信公众号
7
+ */
8
+ WECHAT_OFFICIAL = 'WECHAT_OFFICIAL',
9
+
10
+ /**
11
+ * 微信小程序
12
+ */
13
+ WECHAT_MINI = 'WECHAT_MINI',
14
+
15
+ /**
16
+ * 支付宝
17
+ */
18
+ ALIPAY = 'ALIPAY',
19
+
20
+ /**
21
+ * 钉钉
22
+ */
23
+ DINGTALK = 'DINGTALK',
24
+
25
+ /**
26
+ * 第三方应用
27
+ */
28
+ THIRD_PARTY_APP = 'THIRD_PARTY_APP',
29
+
30
+ /**
31
+ * 飞书
32
+ */
33
+ FEISHU = 'FEISHU',
34
+
35
+ /**
36
+ * 抖音
37
+ */
38
+ TIKTOK = 'TIKTOK',
39
+
40
+ /**
41
+ * 自定义平台
42
+ */
43
+ CUSTOM = 'CUSTOM',
44
+ }
45
+
46
+ /**
47
+ * 平台配置信息
48
+ */
49
+ export interface PlatformConfig {
50
+ /** 平台类型 */
51
+ type: PlatformType
52
+ /** 平台显示名称 */
53
+ name: string
54
+ /** 平台路由前缀 */
55
+ routePrefix: string
56
+ /** 平台描述 */
57
+ description?: string
58
+ /** 认证加载显示名称 */
59
+ authDisplayName?: string
60
+ }
61
+
62
+ /**
63
+ * 平台类型与路由前缀的映射配置
64
+ */
65
+ export const PLATFORM_ROUTE_MAP: Record<PlatformType, string> = {
66
+ [PlatformType.WECHAT_OFFICIAL]: '/wechat/',
67
+ [PlatformType.WECHAT_MINI]: '/wx-mini-program/',
68
+ [PlatformType.ALIPAY]: '/alipay/',
69
+ [PlatformType.DINGTALK]: '/ding-talk/',
70
+ [PlatformType.THIRD_PARTY_APP]: '/app/',
71
+ [PlatformType.FEISHU]: '/feishu/',
72
+ [PlatformType.TIKTOK]: '/tiktok/',
73
+ [PlatformType.CUSTOM]: '/custom/',
74
+ }
75
+
76
+ /**
77
+ * 平台详细配置信息
78
+ */
79
+ export const PLATFORM_CONFIGS: Record<PlatformType, PlatformConfig> = {
80
+ [PlatformType.WECHAT_OFFICIAL]: {
81
+ type: PlatformType.WECHAT_OFFICIAL,
82
+ name: '微信公众号',
83
+ routePrefix: '/wechat/',
84
+ description: '微信公众号外部用户',
85
+ },
86
+ [PlatformType.WECHAT_MINI]: {
87
+ type: PlatformType.WECHAT_MINI,
88
+ name: '微信小程序',
89
+ routePrefix: '/wx-mini-program/',
90
+ description: '微信小程序用户',
91
+ },
92
+ [PlatformType.ALIPAY]: {
93
+ type: PlatformType.ALIPAY,
94
+ name: '支付宝',
95
+ routePrefix: '/alipay/',
96
+ description: '支付宝用户',
97
+ },
98
+ [PlatformType.DINGTALK]: {
99
+ type: PlatformType.DINGTALK,
100
+ name: '钉钉',
101
+ routePrefix: '/ding-talk/',
102
+ description: '钉钉用户',
103
+ },
104
+ [PlatformType.THIRD_PARTY_APP]: {
105
+ type: PlatformType.THIRD_PARTY_APP,
106
+ name: '第三方应用',
107
+ routePrefix: '/app/',
108
+ description: '第三方应用用户',
109
+ },
110
+ [PlatformType.FEISHU]: {
111
+ type: PlatformType.FEISHU,
112
+ name: '飞书',
113
+ routePrefix: '/feishu/',
114
+ description: '飞书用户',
115
+ },
116
+ [PlatformType.TIKTOK]: {
117
+ type: PlatformType.TIKTOK,
118
+ name: '抖音',
119
+ routePrefix: '/tiktok/',
120
+ description: '抖音用户',
121
+ },
122
+ [PlatformType.CUSTOM]: {
123
+ type: PlatformType.CUSTOM,
124
+ name: '自定义平台',
125
+ routePrefix: '/custom/',
126
+ description: '自定义平台用户',
127
+ },
128
+ }
129
+
130
+ /**
131
+ * 根据平台类型获取路由前缀
132
+ * @param platformType 平台类型
133
+ * @returns 路由前缀,默认为 '/ex/'
134
+ */
135
+ export function getPlatformRoutePrefix(platformType?: string): string {
136
+ if (!platformType) {
137
+ return '/ex/' // 默认外部用户路径
138
+ }
139
+
140
+ const route = PLATFORM_ROUTE_MAP[platformType as PlatformType]
141
+ return route || '/ex/' // 找不到时使用默认路径
142
+ }
143
+
144
+ /**
145
+ * 根据平台类型获取平台配置
146
+ * @param platformType 平台类型
147
+ * @returns 平台配置信息
148
+ */
149
+ export function getPlatformConfig(platformType?: string): PlatformConfig | null {
150
+ if (!platformType) {
151
+ return null
152
+ }
153
+
154
+ return PLATFORM_CONFIGS[platformType as PlatformType] || null
155
+ }
156
+
157
+ /**
158
+ * 检查是否为有效的平台类型
159
+ * @param platformType 平台类型
160
+ * @returns 是否为有效平台类型
161
+ */
162
+ export function isValidPlatformType(platformType: string): platformType is PlatformType {
163
+ return Object.values(PlatformType).includes(platformType as PlatformType)
164
+ }
165
+
166
+ /**
167
+ * 获取所有支持的平台类型列表
168
+ * @returns 平台类型数组
169
+ */
170
+ export function getAllPlatformTypes(): PlatformType[] {
171
+ return Object.values(PlatformType)
172
+ }
173
+
174
+ /**
175
+ * 获取所有平台配置列表
176
+ * @returns 平台配置数组
177
+ */
178
+ export function getAllPlatformConfigs(): PlatformConfig[] {
179
+ return Object.values(PLATFORM_CONFIGS)
180
+ }
181
+
182
+ /**
183
+ * 根据平台类型获取认证显示名称
184
+ * @param platformType 平台类型
185
+ * @returns 认证显示名称,默认为 '第三方登录'
186
+ */
187
+ export function getPlatformAuthDisplayName(platformType?: string): string {
188
+ if (!platformType) {
189
+ return '第三方登录'
190
+ }
191
+
192
+ const config = PLATFORM_CONFIGS[platformType as PlatformType]
193
+ return config?.authDisplayName || '第三方登录'
194
+ }