@oinone/kunlun-vue-admin-base 6.2.3 → 6.2.5

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,14 +1,24 @@
1
1
  import { ActiveRecord, SubmitValue } from '@oinone/kunlun-engine';
2
+ import { StandardString } from '@oinone/kunlun-shared';
2
3
  import { OioTreeNode } from '@oinone/kunlun-vue-ui-common';
3
4
  import { TreeNodeResponseBody } from '../../../../service';
4
- import { TreeData, TreeNodeMetadata } from '../../../../typing';
5
+ import { AddressTypeEnum, ResourceAddress, TreeData, TreeNodeMetadata } from '../../../../typing';
5
6
  import { FormM2OCascaderFieldWidget } from '../cascader/FormM2OCascaderFieldWidget';
6
7
  export declare class FormM2OAddressFieldWidget extends FormM2OCascaderFieldWidget {
8
+ static readonly AddressTypes: AddressTypeEnum[];
7
9
  protected get changeOnSelect(): boolean;
8
10
  protected generatorDefaultTreeDefinition(props: any): TreeNodeMetadata | undefined;
9
11
  protected getSubmitField(metadata: TreeNodeMetadata): Record<string, string> | undefined;
10
12
  protected $onSelectedChange(selectedNodes: OioTreeNode<TreeData>[] | null | undefined): void;
13
+ protected $onSelectedChangeNext(currentValue: ResourceAddress, selectedNode: OioTreeNode<TreeData> | undefined): void;
14
+ protected getResourceAddressValue(currentValue: ResourceAddress, type: AddressTypeEnum): {
15
+ code: StandardString;
16
+ name: StandardString;
17
+ } | undefined;
18
+ protected setResourceAddressValue(currentValue: ResourceAddress, type: AddressTypeEnum, code: StandardString, name: StandardString): AddressTypeEnum | null | undefined;
11
19
  protected fetchBackfillData(currentValues: ActiveRecord[], metadataList: TreeNodeMetadata[]): Promise<TreeNodeResponseBody[] | undefined>;
20
+ protected fetchBackfillDataNext(currentValues: ActiveRecord[], metadataList: TreeNodeMetadata[]): Promise<TreeNodeResponseBody[] | undefined>;
12
21
  protected generatorCompareRecords(currentValues: ActiveRecord[], metadataList: TreeNodeMetadata[]): ActiveRecord[] | undefined;
22
+ protected generatorCompareRecordsNext(currentValues: ActiveRecord[], metadataList: TreeNodeMetadata[]): ActiveRecord[] | undefined;
13
23
  submit(submitValue: SubmitValue): Promise<Record<string, unknown> | undefined>;
14
24
  }
@@ -1,29 +1,29 @@
1
1
  import { ActiveRecord } from '@oinone/kunlun-engine';
2
2
  export interface ResourceAddress extends ActiveRecord {
3
3
  id?: string;
4
- countryCode?: string;
5
- countryName?: string;
4
+ countryCode?: string | null;
5
+ countryName?: string | null;
6
6
  originCountry?: ResourceCountry;
7
- provinceCode?: string;
8
- provinceName?: string;
7
+ provinceCode?: string | null;
8
+ provinceName?: string | null;
9
9
  originProvince?: ResourceProvince;
10
- cityCode?: string;
11
- cityName?: string;
10
+ cityCode?: string | null;
11
+ cityName?: string | null;
12
12
  originCity?: ResourceCity;
13
- districtCode?: string;
14
- districtName?: string;
13
+ districtCode?: string | null;
14
+ districtName?: string | null;
15
15
  originDistrict?: ResourceDistrict;
16
- streetCode?: string;
17
- streetName?: string;
16
+ streetCode?: string | null;
17
+ streetName?: string | null;
18
18
  originStreet?: ResourceStreet;
19
19
  /**
20
20
  * 详细地址
21
21
  */
22
- street2?: string;
22
+ street2?: string | null;
23
23
  /**
24
24
  * 完整地址
25
25
  */
26
- fullAddress?: string;
26
+ fullAddress?: string | null;
27
27
  }
28
28
  export interface ResourceCountry extends ActiveRecord {
29
29
  id?: string;
@@ -51,3 +51,18 @@ export interface ResourceStreet extends ActiveRecord {
51
51
  code?: string;
52
52
  name?: string;
53
53
  }
54
+ export interface ResourceRegion extends ActiveRecord {
55
+ id?: string;
56
+ type?: AddressTypeEnum;
57
+ code?: string | null;
58
+ name?: string | null;
59
+ pCode?: string;
60
+ parent?: ResourceRegion;
61
+ }
62
+ export declare enum AddressTypeEnum {
63
+ Country = "Country",
64
+ Province = "Province",
65
+ City = "City",
66
+ District = "District",
67
+ Street = "Street"
68
+ }
@@ -2,7 +2,7 @@ import { MajorConfig } from '@oinone/kunlun-engine';
2
2
  import { Router } from '@oinone/kunlun-router';
3
3
  import { LoginConfig, LoginData, LoginMode, RuntimeLanguage } from '@oinone/kunlun-vue-ui-common';
4
4
  import { BaseI18nRouterWidget } from '../../basic/BaseI18nRouterWidget';
5
- export declare class LoginPageWidget extends BaseI18nRouterWidget {
5
+ export declare class LoginWidget extends BaseI18nRouterWidget {
6
6
  protected moduleName: string;
7
7
  errorMessages: Record<string, string>;
8
8
  /**
@@ -106,3 +106,7 @@ export declare class LoginPageWidget extends BaseI18nRouterWidget {
106
106
  protected queryLanguageSetting(langCode: any): Promise<Record<string, unknown>>;
107
107
  protected beforeMount(): Promise<void>;
108
108
  }
109
+ /**
110
+ * @deprecated please using LoginWidget
111
+ */
112
+ export declare const LoginPageWidget: typeof LoginWidget;
@@ -2,9 +2,9 @@ import { MajorConfig } from '@oinone/kunlun-engine';
2
2
  import { Router } from '@oinone/kunlun-router';
3
3
  import { FormItemRule, OioFormInstance } from '@oinone/kunlun-vue-ui-antd';
4
4
  import { SelectItem } from '@oinone/kunlun-vue-ui-common';
5
+ import { BaseI18nRouterWidget } from '../../basic';
5
6
  import { ResourceCountry } from '../../typing';
6
7
  import { ResetPasswordData } from './typing';
7
- import { BaseI18nRouterWidget } from '../../basic/BaseI18nRouterWidget';
8
8
  export declare class ForgetPasswordWidget extends BaseI18nRouterWidget {
9
9
  protected moduleName: string;
10
10
  protected router: Router;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oinone/kunlun-vue-admin-base",
3
- "version": "6.2.3",
3
+ "version": "6.2.5",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "prebuild": "rimraf dist",
@@ -14,13 +14,13 @@
14
14
  "doc": "typedoc --out docs src/index.ts"
15
15
  },
16
16
  "dependencies": {
17
- "@oinone/kunlun-vue-admin-layout": "6.2.3",
18
- "@oinone/kunlun-vue-router": "6.2.3",
19
- "@oinone/kunlun-vue-ui": "6.2.3",
20
- "@oinone/kunlun-vue-ui-antd": "6.2.3",
21
- "@oinone/kunlun-vue-ui-common": "6.2.3",
22
- "@oinone/kunlun-vue-ui-el": "6.2.3",
23
- "@oinone/kunlun-vue-widget": "6.2.3",
17
+ "@oinone/kunlun-vue-admin-layout": "6.2.5",
18
+ "@oinone/kunlun-vue-router": "6.2.5",
19
+ "@oinone/kunlun-vue-ui": "6.2.5",
20
+ "@oinone/kunlun-vue-ui-antd": "6.2.5",
21
+ "@oinone/kunlun-vue-ui-common": "6.2.5",
22
+ "@oinone/kunlun-vue-ui-el": "6.2.5",
23
+ "@oinone/kunlun-vue-widget": "6.2.5",
24
24
  "@wangeditor/editor": "5.1.23",
25
25
  "@wangeditor/editor-for-vue": "5.1.11",
26
26
  "@wangeditor/plugin-upload-attachment": "1.1.0",
@@ -1,6 +1,6 @@
1
- import { RouterWidget } from '@oinone/kunlun-vue-router';
2
1
  import { getDefaultBrowser, initI18n, OioProvider, translateValueByKey } from '@oinone/kunlun-engine';
3
2
  import { SYSTEM_MODULE_NAME } from '@oinone/kunlun-meta';
3
+ import { RouterWidget } from '@oinone/kunlun-vue-router';
4
4
 
5
5
  /**
6
6
  * 无模块需要国际化的路由页面
@@ -1,12 +1,26 @@
1
- import { ActiveRecord, ActiveRecordExtendKeys, parseConfigs, SubmitHandler, SubmitValue } from '@oinone/kunlun-engine';
1
+ import {
2
+ ActiveRecord,
3
+ ActiveRecordExtendKeys,
4
+ ExperimentalConfigManager,
5
+ parseConfigs,
6
+ SubmitHandler,
7
+ SubmitValue
8
+ } from '@oinone/kunlun-engine';
2
9
  import { ModelFieldType, ViewType } from '@oinone/kunlun-meta';
3
- import { BooleanHelper, CastHelper, ObjectUtils, Optional, uniqueKeyGenerator } from '@oinone/kunlun-shared';
10
+ import {
11
+ BooleanHelper,
12
+ CastHelper,
13
+ ObjectUtils,
14
+ Optional,
15
+ StandardString,
16
+ uniqueKeyGenerator
17
+ } from '@oinone/kunlun-shared';
4
18
  import { SPI } from '@oinone/kunlun-spi';
5
19
  import { OioTreeNode } from '@oinone/kunlun-vue-ui-common';
6
20
  import { Widget } from '@oinone/kunlun-vue-widget';
7
21
  import { FormFieldWidget } from '../../../../basic';
8
22
  import { TreeNodeResponseBody, TreeService } from '../../../../service';
9
- import { TreeData, TreeNodeMetadata } from '../../../../typing';
23
+ import { AddressTypeEnum, ResourceAddress, ResourceRegion, TreeData, TreeNodeMetadata } from '../../../../typing';
10
24
  import { FetchUtil } from '../../../../util';
11
25
  import { generatorDefaultAddressTreeDefinition } from '../../../../util/default-tree-definition';
12
26
  import { FormM2OCascaderFieldWidget } from '../cascader/FormM2OCascaderFieldWidget';
@@ -19,6 +33,14 @@ import { FormM2OCascaderFieldWidget } from '../cascader/FormM2OCascaderFieldWidg
19
33
  })
20
34
  )
21
35
  export class FormM2OAddressFieldWidget extends FormM2OCascaderFieldWidget {
36
+ public static readonly AddressTypes = [
37
+ AddressTypeEnum.Street,
38
+ AddressTypeEnum.District,
39
+ AddressTypeEnum.City,
40
+ AddressTypeEnum.Province,
41
+ AddressTypeEnum.Country
42
+ ];
43
+
22
44
  @Widget.Reactive()
23
45
  protected get changeOnSelect(): boolean {
24
46
  return Optional.ofNullable(this.getDsl().changeOnSelect).map(BooleanHelper.toBoolean).orElse(true)!;
@@ -63,7 +85,7 @@ export class FormM2OAddressFieldWidget extends FormM2OCascaderFieldWidget {
63
85
  return;
64
86
  }
65
87
  const { value } = this;
66
- let currentValue: ActiveRecord | undefined;
88
+ let currentValue: ResourceAddress | undefined;
67
89
  if (value) {
68
90
  currentValue = FetchUtil.generatorPksObjectByPks(['id'], value);
69
91
  if (currentValue) {
@@ -77,25 +99,155 @@ export class FormM2OAddressFieldWidget extends FormM2OCascaderFieldWidget {
77
99
  __draftId: uniqueKeyGenerator()
78
100
  };
79
101
  }
102
+ if (ExperimentalConfigManager.addressWidgetNext()) {
103
+ this.$onSelectedChangeNext(currentValue, selectedNode);
104
+ } else {
105
+ while (selectedNode) {
106
+ const targetValue = selectedNode.value.data;
107
+ if (targetValue) {
108
+ const submitFields = this.getSubmitField(selectedNode.value.metadata);
109
+ if (submitFields) {
110
+ Object.entries(submitFields).forEach(([relationField, referenceField]) => {
111
+ currentValue![relationField] = targetValue[referenceField as string];
112
+ });
113
+ }
114
+ }
115
+ selectedNode = selectedNode.parent;
116
+ }
117
+ }
118
+ this.change(currentValue);
119
+ }
120
+
121
+ protected $onSelectedChangeNext(currentValue: ResourceAddress, selectedNode: OioTreeNode<TreeData> | undefined) {
122
+ let nextAddressType: AddressTypeEnum | null | undefined = AddressTypeEnum.Street;
80
123
  while (selectedNode) {
81
- const targetValue = selectedNode.value.data;
82
- if (targetValue) {
83
- const submitFields = this.getSubmitField(selectedNode.value.metadata);
84
- if (submitFields) {
85
- Object.entries(submitFields).forEach(([relationField, referenceField]) => {
86
- currentValue![relationField] = targetValue[referenceField as string];
87
- });
124
+ const targetValue = selectedNode.value.data as ResourceRegion | undefined;
125
+ if (!targetValue) {
126
+ selectedNode = selectedNode.parent;
127
+ continue;
128
+ }
129
+ const { type, code, name } = targetValue;
130
+ if (!type) {
131
+ console.error('Invalid region type.', selectedNode);
132
+ this.change(null);
133
+ return;
134
+ }
135
+ if (nextAddressType) {
136
+ while (type !== nextAddressType) {
137
+ nextAddressType = this.setResourceAddressValue(currentValue, nextAddressType, null, null);
138
+ if (nextAddressType === null) {
139
+ break;
140
+ }
141
+ if (!nextAddressType) {
142
+ return;
143
+ }
88
144
  }
145
+ } else {
146
+ nextAddressType = type;
147
+ }
148
+ nextAddressType = this.setResourceAddressValue(currentValue, type, code, name);
149
+ if (nextAddressType === null) {
150
+ break;
151
+ }
152
+ if (!nextAddressType) {
153
+ return;
89
154
  }
90
155
  selectedNode = selectedNode.parent;
91
156
  }
92
- this.change(currentValue);
157
+ }
158
+
159
+ protected getResourceAddressValue(
160
+ currentValue: ResourceAddress,
161
+ type: AddressTypeEnum
162
+ ):
163
+ | {
164
+ code: StandardString;
165
+ name: StandardString;
166
+ }
167
+ | undefined {
168
+ switch (type) {
169
+ case AddressTypeEnum.Country: {
170
+ const { countryCode, countryName } = currentValue;
171
+ if (countryCode && countryName) {
172
+ return { code: countryCode, name: countryName };
173
+ }
174
+ return undefined;
175
+ }
176
+ case AddressTypeEnum.Province: {
177
+ const { provinceCode, provinceName } = currentValue;
178
+ if (provinceCode && provinceName) {
179
+ return { code: provinceCode, name: provinceName };
180
+ }
181
+ return undefined;
182
+ }
183
+ case AddressTypeEnum.City: {
184
+ const { cityCode, cityName } = currentValue;
185
+ if (cityCode && cityName) {
186
+ return { code: cityCode, name: cityName };
187
+ }
188
+ return undefined;
189
+ }
190
+ case AddressTypeEnum.District: {
191
+ const { districtCode, districtName } = currentValue;
192
+ if (districtCode && districtName) {
193
+ return { code: districtCode, name: districtName };
194
+ }
195
+ return undefined;
196
+ }
197
+ case AddressTypeEnum.Street: {
198
+ const { streetCode, streetName } = currentValue;
199
+ if (streetCode && streetName) {
200
+ return { code: streetCode, name: streetName };
201
+ }
202
+ return undefined;
203
+ }
204
+ default:
205
+ console.error('Invalid region type.', type);
206
+ return undefined;
207
+ }
208
+ }
209
+
210
+ protected setResourceAddressValue(
211
+ currentValue: ResourceAddress,
212
+ type: AddressTypeEnum,
213
+ code: StandardString,
214
+ name: StandardString
215
+ ): AddressTypeEnum | null | undefined {
216
+ switch (type) {
217
+ case AddressTypeEnum.Country:
218
+ currentValue.countryCode = code;
219
+ currentValue.countryName = name;
220
+ return null;
221
+ case AddressTypeEnum.Province:
222
+ currentValue.provinceCode = code;
223
+ currentValue.provinceName = name;
224
+ return AddressTypeEnum.Country;
225
+ case AddressTypeEnum.City:
226
+ currentValue.cityCode = code;
227
+ currentValue.cityName = name;
228
+ return AddressTypeEnum.Province;
229
+ case AddressTypeEnum.District:
230
+ currentValue.districtCode = code;
231
+ currentValue.districtName = name;
232
+ return AddressTypeEnum.City;
233
+ case AddressTypeEnum.Street:
234
+ currentValue.streetCode = code;
235
+ currentValue.streetName = name;
236
+ return AddressTypeEnum.District;
237
+ default:
238
+ console.error('Invalid region type.', type);
239
+ this.change(null);
240
+ return undefined;
241
+ }
93
242
  }
94
243
 
95
244
  protected async fetchBackfillData(
96
245
  currentValues: ActiveRecord[],
97
246
  metadataList: TreeNodeMetadata[]
98
247
  ): Promise<TreeNodeResponseBody[] | undefined> {
248
+ if (ExperimentalConfigManager.addressWidgetNext()) {
249
+ return this.fetchBackfillDataNext(currentValues, metadataList);
250
+ }
99
251
  const finalValues: ActiveRecord[] = [];
100
252
  let finalMetadataList: TreeNodeMetadata[] | undefined;
101
253
  for (const currentValue of currentValues) {
@@ -130,10 +282,37 @@ export class FormM2OAddressFieldWidget extends FormM2OCascaderFieldWidget {
130
282
  return undefined;
131
283
  }
132
284
 
285
+ protected async fetchBackfillDataNext(
286
+ currentValues: ActiveRecord[],
287
+ metadataList: TreeNodeMetadata[]
288
+ ): Promise<TreeNodeResponseBody[] | undefined> {
289
+ const currentValue = currentValues[0] as ResourceAddress | undefined;
290
+ if (!currentValue) {
291
+ return undefined;
292
+ }
293
+ let lastRegion: ResourceRegion | undefined;
294
+ for (const type of FormM2OAddressFieldWidget.AddressTypes) {
295
+ lastRegion = this.getResourceAddressValue(currentValue, type);
296
+ if (lastRegion) {
297
+ break;
298
+ }
299
+ }
300
+ if (lastRegion) {
301
+ return TreeService.reverselyQueryWithSize([lastRegion], metadataList, {
302
+ expressionParameters: this.generatorExpressionParameters(),
303
+ disabledIsLeaf: true
304
+ });
305
+ }
306
+ return undefined;
307
+ }
308
+
133
309
  protected generatorCompareRecords(
134
310
  currentValues: ActiveRecord[],
135
311
  metadataList: TreeNodeMetadata[]
136
312
  ): ActiveRecord[] | undefined {
313
+ if (ExperimentalConfigManager.addressWidgetNext()) {
314
+ return this.generatorCompareRecordsNext(currentValues, metadataList);
315
+ }
137
316
  const compareRecords: ActiveRecord[] = [];
138
317
  for (const currentValue of currentValues) {
139
318
  for (const metadata of metadataList) {
@@ -161,6 +340,27 @@ export class FormM2OAddressFieldWidget extends FormM2OCascaderFieldWidget {
161
340
  return [compareRecords[compareRecords.length - 1]];
162
341
  }
163
342
 
343
+ protected generatorCompareRecordsNext(
344
+ currentValues: ActiveRecord[],
345
+ metadataList: TreeNodeMetadata[]
346
+ ): ActiveRecord[] | undefined {
347
+ const currentValue = currentValues[0] as ResourceAddress | undefined;
348
+ if (!currentValue) {
349
+ return undefined;
350
+ }
351
+ let lastRegion: ResourceRegion | undefined;
352
+ for (const type of FormM2OAddressFieldWidget.AddressTypes) {
353
+ lastRegion = this.getResourceAddressValue(currentValue, type);
354
+ if (lastRegion) {
355
+ break;
356
+ }
357
+ }
358
+ if (lastRegion) {
359
+ return [lastRegion];
360
+ }
361
+ return undefined;
362
+ }
363
+
164
364
  public async submit(submitValue: SubmitValue) {
165
365
  return SubmitHandler.DEFAULT(this.field, this.itemName, submitValue, this.value);
166
366
  }
@@ -23,7 +23,11 @@ import { clearSharedSession, getSharedSession, setSharedSession } from './sessio
23
23
  import SharedMainView from './SharedMainView.vue';
24
24
  import { SharedViewUtils } from './utils';
25
25
 
26
- @SPI.ClassFactory(RouterWidget.Token({ widget: SHARED_VIEW_WIDGET }))
26
+ @SPI.ClassFactory(
27
+ RouterWidget.Token({
28
+ widget: SHARED_VIEW_WIDGET
29
+ })
30
+ )
27
31
  export class SharedMainViewWidget extends RouterWidget {
28
32
  protected metadataViewWidget: MetadataViewWidget | undefined;
29
33
 
@@ -3,35 +3,35 @@ import { ActiveRecord } from '@oinone/kunlun-engine';
3
3
  export interface ResourceAddress extends ActiveRecord {
4
4
  id?: string;
5
5
 
6
- countryCode?: string;
7
- countryName?: string;
6
+ countryCode?: string | null;
7
+ countryName?: string | null;
8
8
  originCountry?: ResourceCountry;
9
9
 
10
- provinceCode?: string;
11
- provinceName?: string;
10
+ provinceCode?: string | null;
11
+ provinceName?: string | null;
12
12
  originProvince?: ResourceProvince;
13
13
 
14
- cityCode?: string;
15
- cityName?: string;
14
+ cityCode?: string | null;
15
+ cityName?: string | null;
16
16
  originCity?: ResourceCity;
17
17
 
18
- districtCode?: string;
19
- districtName?: string;
18
+ districtCode?: string | null;
19
+ districtName?: string | null;
20
20
  originDistrict?: ResourceDistrict;
21
21
 
22
- streetCode?: string;
23
- streetName?: string;
22
+ streetCode?: string | null;
23
+ streetName?: string | null;
24
24
  originStreet?: ResourceStreet;
25
25
 
26
26
  /**
27
27
  * 详细地址
28
28
  */
29
- street2?: string;
29
+ street2?: string | null;
30
30
 
31
31
  /**
32
32
  * 完整地址
33
33
  */
34
- fullAddress?: string;
34
+ fullAddress?: string | null;
35
35
  }
36
36
 
37
37
  export interface ResourceCountry extends ActiveRecord {
@@ -65,3 +65,20 @@ export interface ResourceStreet extends ActiveRecord {
65
65
  code?: string;
66
66
  name?: string;
67
67
  }
68
+
69
+ export interface ResourceRegion extends ActiveRecord {
70
+ id?: string;
71
+ type?: AddressTypeEnum;
72
+ code?: string | null;
73
+ name?: string | null;
74
+ pCode?: string;
75
+ parent?: ResourceRegion;
76
+ }
77
+
78
+ export enum AddressTypeEnum {
79
+ Country = 'Country',
80
+ Province = 'Province',
81
+ City = 'City',
82
+ District = 'District',
83
+ Street = 'Street'
84
+ }
@@ -1,4 +1,5 @@
1
1
  import { XMLParse } from '@oinone/kunlun-dsl';
2
+ import { ExperimentalConfigManager } from '@oinone/kunlun-engine';
2
3
  import { TreeNodeMetadata } from '../typing';
3
4
  import { TreeUtils } from './tree-utils';
4
5
 
@@ -13,7 +14,17 @@ const defaultAddressTemplate = XMLParse.INSTANCE.parse(`<template>
13
14
  </template>
14
15
  `);
15
16
 
17
+ const defaultAddressTemplateNext = XMLParse.INSTANCE.parse(`<template>
18
+ <nodes>
19
+ <node model="resource.ResourceRegion" label="activeRecord.name" labelFields="name" selfReferences="parent" />
20
+ </nodes>
21
+ </template>
22
+ `);
23
+
16
24
  export function generatorDefaultAddressTreeDefinition(): TreeNodeMetadata | undefined {
25
+ if (ExperimentalConfigManager.addressWidgetNext()) {
26
+ return TreeUtils.convert(defaultAddressTemplateNext);
27
+ }
17
28
  return TreeUtils.convert(defaultAddressTemplate);
18
29
  }
19
30
 
@@ -10,7 +10,14 @@ import {
10
10
  translateValueByKey
11
11
  } from '@oinone/kunlun-engine';
12
12
  import { RuntimeConfig, SYSTEM_MODULE_NAME } from '@oinone/kunlun-meta';
13
- import { gql, HttpClientError, ILevel, useMessageHub } from '@oinone/kunlun-request';
13
+ import {
14
+ gql,
15
+ HttpClientError,
16
+ ILevel,
17
+ isFirstResetPasswordError,
18
+ isPicCodeError,
19
+ useMessageHub
20
+ } from '@oinone/kunlun-request';
14
21
  import { Router } from '@oinone/kunlun-router';
15
22
  import { http } from '@oinone/kunlun-service';
16
23
  import { SPI } from '@oinone/kunlun-spi';
@@ -28,15 +35,17 @@ import {
28
35
  LoginMode,
29
36
  RuntimeLanguage
30
37
  } from '@oinone/kunlun-vue-ui-common';
31
- import { VueWidget, Widget } from '@oinone/kunlun-vue-widget';
32
- import { toString } from 'lodash-es';
38
+ import { Widget } from '@oinone/kunlun-vue-widget';
33
39
  import { BaseI18nRouterWidget } from '../../basic/BaseI18nRouterWidget';
34
-
35
40
  import { encrypt, homepageMaybeRuntimeContext } from '../../util';
36
41
  import LoginComponent from './Login.vue';
37
42
 
38
- @SPI.ClassFactory(RouterWidget.Token({ widget: 'Login' }))
39
- export class LoginPageWidget extends BaseI18nRouterWidget {
43
+ @SPI.ClassFactory(
44
+ RouterWidget.Token({
45
+ widget: 'Login'
46
+ })
47
+ )
48
+ export class LoginWidget extends BaseI18nRouterWidget {
40
49
  protected moduleName = SYSTEM_MODULE_NAME.USER;
41
50
 
42
51
  public errorMessages = defaultLoginErrorMessages;
@@ -601,7 +610,7 @@ export class LoginPageWidget extends BaseI18nRouterWidget {
601
610
  return;
602
611
  }
603
612
 
604
- if (['20200008', '20060008'].includes(toString(errorCode))) {
613
+ if (isFirstResetPasswordError(errorCode)) {
605
614
  // 首次登录需修改密码
606
615
  this.router.push({ segments: [{ path: 'first' }] });
607
616
  return;
@@ -635,7 +644,7 @@ export class LoginPageWidget extends BaseI18nRouterWidget {
635
644
  const hub = useMessageHub(loginMessageHubName);
636
645
  hub.subscribe((error) => {
637
646
  const { errorCode } = error;
638
- if (errorCode === '20060080') {
647
+ if (isPicCodeError(errorCode)) {
639
648
  this.getPicCode();
640
649
  }
641
650
  hub.unsubscribe();
@@ -689,3 +698,8 @@ export class LoginPageWidget extends BaseI18nRouterWidget {
689
698
  });
690
699
  }
691
700
  }
701
+
702
+ /**
703
+ * @deprecated please using LoginWidget
704
+ */
705
+ export const LoginPageWidget = LoginWidget;
@@ -9,7 +9,11 @@ import { UserService } from '../../service';
9
9
  import FirstResetPassword from './FirstResetPassword.vue';
10
10
  import { ForgetPasswordWidget } from './ForgetPasswordWidget';
11
11
 
12
- @SPI.ClassFactory(RouterWidget.Token({ widget: 'FirstResetPassword' }))
12
+ @SPI.ClassFactory(
13
+ RouterWidget.Token({
14
+ widget: 'FirstResetPassword'
15
+ })
16
+ )
13
17
  export class FirstResetPasswordWidget extends ForgetPasswordWidget {
14
18
  public initialize(config) {
15
19
  super.initialize(config);
@@ -1,4 +1,5 @@
1
1
  import { getMajorConfig, MajorConfig, translateValueByKey } from '@oinone/kunlun-engine';
2
+ import { SYSTEM_MODULE_NAME } from '@oinone/kunlun-meta';
2
3
  import { Router } from '@oinone/kunlun-router';
3
4
  import { http } from '@oinone/kunlun-service';
4
5
  import { SPI } from '@oinone/kunlun-spi';
@@ -6,14 +7,17 @@ import { RouterWidget, useRouter } from '@oinone/kunlun-vue-router';
6
7
  import { FormItemRule, OioFormInstance, OioMessage } from '@oinone/kunlun-vue-ui-antd';
7
8
  import { SelectItem } from '@oinone/kunlun-vue-ui-common';
8
9
  import { Widget } from '@oinone/kunlun-vue-widget';
10
+ import { BaseI18nRouterWidget } from '../../basic';
9
11
  import { PhoneCodeQueryService, UserService } from '../../service';
10
12
  import { ResourceCountry } from '../../typing';
11
13
  import ForgetPassword from './ForgetPassword.vue';
12
14
  import { ResetPasswordData } from './typing';
13
- import { BaseI18nRouterWidget } from '../../basic/BaseI18nRouterWidget';
14
- import { SYSTEM_MODULE_NAME } from '@oinone/kunlun-meta';
15
15
 
16
- @SPI.ClassFactory(RouterWidget.Token({ widget: 'ForgetPassword' }))
16
+ @SPI.ClassFactory(
17
+ RouterWidget.Token({
18
+ widget: 'ForgetPassword'
19
+ })
20
+ )
17
21
  export class ForgetPasswordWidget extends BaseI18nRouterWidget {
18
22
  protected moduleName = SYSTEM_MODULE_NAME.USER;
19
23