@kengic/uni 0.4.0 → 0.5.0

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,28 +1,28 @@
1
- // noinspection ES6UnusedImports
2
-
3
- import { httpClient, IRequestConfig, IRequestOptions } from '../../../../service';
4
- import * as DEF from '../../../def';
5
- import { keys } from '../../models';
6
-
7
- /** 请求参数. */
8
- export class GetLatestApkVersionQuery {}
9
-
10
- /**
11
- * 获取 APK 最新的版本号.
12
- *
13
- * @param config 请求配置.
14
- * @param option 请求选项.
15
- */
16
- export function GetLatestApkVersion(config?: IRequestConfig<GetLatestApkVersionQuery, {}>, option?: IRequestOptions): Promise<number> {
17
- return httpClient().request(
18
- {
19
- method: GetLatestApkVersion.method,
20
- url: `${option?.mock ? '/mock' : ''}${GetLatestApkVersion.url}`,
21
- ...(config ?? {}),
22
- },
23
- option,
24
- );
25
- }
26
-
27
- GetLatestApkVersion.method = 'GET' as const;
28
- GetLatestApkVersion.url = '/sys/common/getLatestApkVersion';
1
+ // noinspection ES6UnusedImports
2
+
3
+ import { httpClient, IRequestConfig, IRequestOptions } from '../../../../service';
4
+ import * as DEF from '../../../def';
5
+ import { keys } from '../../models';
6
+
7
+ /** 请求参数. */
8
+ export class GetLatestApkVersionQuery {}
9
+
10
+ /**
11
+ * 获取 APK 最新的版本号.
12
+ *
13
+ * @param config 请求配置.
14
+ * @param option 请求选项.
15
+ */
16
+ export function GetLatestApkVersion(config?: IRequestConfig<GetLatestApkVersionQuery, {}>, option?: IRequestOptions): Promise<string> {
17
+ return httpClient().request(
18
+ {
19
+ method: GetLatestApkVersion.method,
20
+ url: `${option?.mock ? '/mock' : ''}${GetLatestApkVersion.url}`,
21
+ ...(config ?? {}),
22
+ },
23
+ option,
24
+ );
25
+ }
26
+
27
+ GetLatestApkVersion.method = 'GET' as const;
28
+ GetLatestApkVersion.url = '/sys/common/getLatestApkVersion';
@@ -1 +1 @@
1
- export { GetLatestApkVersion, GetLatestApkVersionQuery } from './GetLatestApkVersion';
1
+ export { GetLatestApkVersion, GetLatestApkVersionQuery } from './GetLatestApkVersion';
@@ -1,28 +1,28 @@
1
- // noinspection ES6UnusedImports
2
-
3
- import { httpClient, IRequestConfig, IRequestOptions } from '../../../../service';
4
- import * as DEF from '../../../def';
5
- import { keys } from '../../models';
6
-
7
- /** 请求参数. */
8
- export class LogoutQuery {}
9
-
10
- /**
11
- * 退出登录.
12
- *
13
- * @param config 请求配置.
14
- * @param option 请求选项.
15
- */
16
- export function Logout(config?: IRequestConfig<LogoutQuery, {}>, option?: IRequestOptions): Promise<Record<any, any>> {
17
- return httpClient().request(
18
- {
19
- method: Logout.method,
20
- url: `${option?.mock ? '/mock' : ''}${Logout.url}`,
21
- ...(config ?? {}),
22
- },
23
- option,
24
- );
25
- }
26
-
27
- Logout.method = 'GET' as const;
28
- Logout.url = '/sys/logout';
1
+ // noinspection ES6UnusedImports
2
+
3
+ import { httpClient, IRequestConfig, IRequestOptions } from '../../../../service';
4
+ import * as DEF from '../../../def';
5
+ import { keys } from '../../models';
6
+
7
+ /** 请求参数. */
8
+ export class LogoutQuery {}
9
+
10
+ /**
11
+ * 退出登录.
12
+ *
13
+ * @param config 请求配置.
14
+ * @param option 请求选项.
15
+ */
16
+ export function Logout(config?: IRequestConfig<LogoutQuery, {}>, option?: IRequestOptions): Promise<Record<any, any>> {
17
+ return httpClient().request(
18
+ {
19
+ method: Logout.method,
20
+ url: `${option?.mock ? '/mock' : ''}${Logout.url}`,
21
+ ...(config ?? {}),
22
+ },
23
+ option,
24
+ );
25
+ }
26
+
27
+ Logout.method = 'GET' as const;
28
+ Logout.url = '/sys/logout';
@@ -1 +1 @@
1
- export { Logout, LogoutQuery } from './Logout';
1
+ export { Logout, LogoutQuery } from './Logout';
@@ -1,92 +1,92 @@
1
- // noinspection ES6UnusedImports
2
-
3
- import { httpClient, IRequestConfig, IRequestOptions } from '../../../../service';
4
- import * as DEF from '../../../def';
5
- import { keys } from '../../models';
6
-
7
- /** 请求参数. */
8
- export class ListVOQuery {
9
- /** 是否可用 */
10
- public activeFlg?: number | null;
11
- /** 地址编号 */
12
- public adrId?: string | null;
13
- /** 地址名 */
14
- public adrnam?: string | null;
15
- /** 公司代码 */
16
- public comCod?: string | null;
17
- /** 默认仓库 */
18
- public defWhFlg?: number | null;
19
- /** 主键. */
20
- public id?: string | null;
21
- /** 所属地/国编号 */
22
- public orgcod?: string | null;
23
- /** 永久调整托盘 */
24
- public permAdjLod?: string | null;
25
- /** 永久调整箱 */
26
- public permAdjSub?: string | null;
27
- /** 永久创建托盘 */
28
- public permCreLod?: string | null;
29
- /** 永久创建箱 */
30
- public permCreSub?: string | null;
31
- /** 仓库名称 */
32
- public whDsc?: string | null;
33
- /** 仓库编号 */
34
- public whId?: string | null;
35
- /** 排序字段. */
36
- public column?: string | null;
37
- /** 排序方式. */
38
- public order?: 'asc' | 'desc' | null;
39
- /** 当前页数. */
40
- public pageNo?: number | null;
41
- /** 每页条数. */
42
- public pageSize?: number | null;
43
-
44
- public constructor(obj?: ListVOQuery) {
45
- keys(obj ?? {}).forEach((key: PropertyKey) => {
46
- switch (key) {
47
- case 'activeFlg':
48
- case 'adrId':
49
- case 'adrnam':
50
- case 'comCod':
51
- case 'defWhFlg':
52
- case 'id':
53
- case 'orgcod':
54
- case 'permAdjLod':
55
- case 'permAdjSub':
56
- case 'permCreLod':
57
- case 'permCreSub':
58
- case 'whDsc':
59
- case 'whId':
60
- case 'column':
61
- case 'order':
62
- case 'pageNo':
63
- case 'pageSize':
64
- Reflect.set(this, key, Reflect.get(obj ?? {}, key));
65
- break;
66
- default:
67
- break;
68
- }
69
- });
70
- }
71
- }
72
-
73
- /**
74
- * wh-分页列表查询VO
75
- wh-分页列表查询VO
76
- *
77
- * @param config 请求配置.
78
- * @param option 请求选项.
79
- */
80
- export function ListVO(config?: IRequestConfig<ListVOQuery, {}>, option?: IRequestOptions): Promise<DEF.WMS.IPage<DEF.WMS.WhDTO>> {
81
- return httpClient().request(
82
- {
83
- method: ListVO.method,
84
- url: `${option?.mock ? '/mock' : ''}${ListVO.url}`,
85
- ...(config ?? {}),
86
- },
87
- option,
88
- );
89
- }
90
-
91
- ListVO.method = 'GET' as const;
92
- ListVO.url = '/wh/wh/listVO';
1
+ // noinspection ES6UnusedImports
2
+
3
+ import { httpClient, IRequestConfig, IRequestOptions } from '../../../../service';
4
+ import * as DEF from '../../../def';
5
+ import { keys } from '../../models';
6
+
7
+ /** 请求参数. */
8
+ export class ListVOQuery {
9
+ /** 是否可用 */
10
+ public activeFlg?: number | null;
11
+ /** 地址编号 */
12
+ public adrId?: string | null;
13
+ /** 地址名 */
14
+ public adrnam?: string | null;
15
+ /** 公司代码 */
16
+ public comCod?: string | null;
17
+ /** 默认仓库 */
18
+ public defWhFlg?: number | null;
19
+ /** 主键. */
20
+ public id?: string | null;
21
+ /** 所属地/国编号 */
22
+ public orgcod?: string | null;
23
+ /** 永久调整托盘 */
24
+ public permAdjLod?: string | null;
25
+ /** 永久调整箱 */
26
+ public permAdjSub?: string | null;
27
+ /** 永久创建托盘 */
28
+ public permCreLod?: string | null;
29
+ /** 永久创建箱 */
30
+ public permCreSub?: string | null;
31
+ /** 仓库名称 */
32
+ public whDsc?: string | null;
33
+ /** 仓库编号 */
34
+ public whId?: string | null;
35
+ /** 排序字段. */
36
+ public column?: string | null;
37
+ /** 排序方式. */
38
+ public order?: 'asc' | 'desc' | null;
39
+ /** 当前页数. */
40
+ public pageNo?: number | null;
41
+ /** 每页条数. */
42
+ public pageSize?: number | null;
43
+
44
+ public constructor(obj?: ListVOQuery) {
45
+ keys(obj ?? {}).forEach((key: PropertyKey) => {
46
+ switch (key) {
47
+ case 'activeFlg':
48
+ case 'adrId':
49
+ case 'adrnam':
50
+ case 'comCod':
51
+ case 'defWhFlg':
52
+ case 'id':
53
+ case 'orgcod':
54
+ case 'permAdjLod':
55
+ case 'permAdjSub':
56
+ case 'permCreLod':
57
+ case 'permCreSub':
58
+ case 'whDsc':
59
+ case 'whId':
60
+ case 'column':
61
+ case 'order':
62
+ case 'pageNo':
63
+ case 'pageSize':
64
+ Reflect.set(this, key, Reflect.get(obj ?? {}, key));
65
+ break;
66
+ default:
67
+ break;
68
+ }
69
+ });
70
+ }
71
+ }
72
+
73
+ /**
74
+ * wh-分页列表查询VO
75
+ wh-分页列表查询VO
76
+ *
77
+ * @param config 请求配置.
78
+ * @param option 请求选项.
79
+ */
80
+ export function ListVO(config?: IRequestConfig<ListVOQuery, {}>, option?: IRequestOptions): Promise<DEF.WMS.IPage<DEF.WMS.WhDTO>> {
81
+ return httpClient().request(
82
+ {
83
+ method: ListVO.method,
84
+ url: `${option?.mock ? '/mock' : ''}${ListVO.url}`,
85
+ ...(config ?? {}),
86
+ },
87
+ option,
88
+ );
89
+ }
90
+
91
+ ListVO.method = 'GET' as const;
92
+ ListVO.url = '/wh/wh/listVO';
@@ -1 +1 @@
1
- export { ListVO, ListVOQuery } from './ListVO';
1
+ export { ListVO, ListVOQuery } from './ListVO';
@@ -1,3 +1,3 @@
1
- export * as CommonController from './CommonController';
2
- export * as LoginController from './LoginController';
3
- export * as WhController from './WhController';
1
+ export * as CommonController from './CommonController';
2
+ export * as LoginController from './LoginController';
3
+ export * as WhController from './WhController';
@@ -1,2 +1,2 @@
1
- export * as WMSAPI from './Controllers';
2
- export * as WMSDEF from './models';
1
+ export * as WMSAPI from './Controllers';
2
+ export * as WMSDEF from './models';
@@ -1,192 +1,192 @@
1
- export class IPage<T0> {
2
- /** Current. */
3
- public current?: number | null;
4
- /** Pages. */
5
- public pages?: number | null;
6
- /** Records. */
7
- public records?: Array<T0> | null;
8
- /** Size. */
9
- public size?: number | null;
10
- /** Total. */
11
- public total?: number | null;
12
-
13
- public constructor(obj?: IPage<T0>) {
14
- keys(obj ?? {}).forEach((key: PropertyKey) => {
15
- switch (key) {
16
- case 'current':
17
- case 'pages':
18
- case 'records':
19
- case 'size':
20
- case 'total':
21
- Reflect.set(this, key, Reflect.get(obj ?? {}, key));
22
- break;
23
- default:
24
- break;
25
- }
26
- });
27
- }
28
- }
29
-
30
- /** 用户. */
31
- export class SysUser {
32
- /** Activiti Sync. */
33
- public activitiSync?: number | null;
34
- /** 头像. */
35
- public avatar?: string | null;
36
- /** Birthday. */
37
- public birthday?: string | null;
38
- /** Client Id. */
39
- public clientId?: string | null;
40
- /** Create By. */
41
- public createBy?: string | null;
42
- /** Create Time. */
43
- public createTime?: string | null;
44
- /** Del Flag. */
45
- public delFlag?: number | null;
46
- /** Depart Ids. */
47
- public departIds?: string | null;
48
- /** 邮件. */
49
- public email?: string | null;
50
- /** Home Path. */
51
- public homePath?: string | null;
52
- /** Id. */
53
- public id?: string | null;
54
- /** Org Code. */
55
- public orgCode?: string | null;
56
- /** Org Code Txt. */
57
- public orgCodeTxt?: string | null;
58
- /** Password. */
59
- public password?: string | null;
60
- /** 电话. */
61
- public phone?: string | null;
62
- /** Post. */
63
- public post?: string | null;
64
- /** 姓名. */
65
- public realname?: string | null;
66
- /** Rel Tenant Ids. */
67
- public relTenantIds?: string | null;
68
- /** Salt. */
69
- public salt?: string | null;
70
- /** Sex. */
71
- public sex?: number | null;
72
- /** 状态. */
73
- public status?: number | null;
74
- /** Telephone. */
75
- public telephone?: string | null;
76
- /** Update By. */
77
- public updateBy?: string | null;
78
- /** Update Time. */
79
- public updateTime?: string | null;
80
- /** User Identity. */
81
- public userIdentity?: number | null;
82
- /** 账号. */
83
- public username?: string | null;
84
- /** 工号. */
85
- public workNo?: string | null;
86
-
87
- public constructor(obj?: SysUser) {
88
- keys(obj ?? {}).forEach((key: PropertyKey) => {
89
- switch (key) {
90
- case 'activitiSync':
91
- case 'avatar':
92
- case 'birthday':
93
- case 'clientId':
94
- case 'createBy':
95
- case 'createTime':
96
- case 'delFlag':
97
- case 'departIds':
98
- case 'email':
99
- case 'homePath':
100
- case 'id':
101
- case 'orgCode':
102
- case 'orgCodeTxt':
103
- case 'password':
104
- case 'phone':
105
- case 'post':
106
- case 'realname':
107
- case 'relTenantIds':
108
- case 'salt':
109
- case 'sex':
110
- case 'status':
111
- case 'telephone':
112
- case 'updateBy':
113
- case 'updateTime':
114
- case 'userIdentity':
115
- case 'username':
116
- case 'workNo':
117
- Reflect.set(this, key, Reflect.get(obj ?? {}, key));
118
- break;
119
- default:
120
- break;
121
- }
122
- });
123
- }
124
- }
125
-
126
- /** 仓库数据传输对象 */
127
- export class WhDTO {
128
- /** 是否可用 */
129
- public activeFlg?: number | null;
130
- /** 地址编号 */
131
- public adrId?: string | null;
132
- /** 地址名 */
133
- public adrnam?: string | null;
134
- /** 公司代码 */
135
- public comCod?: string | null;
136
- /** 默认仓库 */
137
- public defWhFlg?: number | null;
138
- /** 主键. */
139
- public id?: string | null;
140
- /** 所属地/国编号 */
141
- public orgcod?: string | null;
142
- /** 永久调整托盘 */
143
- public permAdjLod?: string | null;
144
- /** 永久调整箱 */
145
- public permAdjSub?: string | null;
146
- /** 永久创建托盘 */
147
- public permCreLod?: string | null;
148
- /** 永久创建箱 */
149
- public permCreSub?: string | null;
150
- /** 仓库名称 */
151
- public whDsc?: string | null;
152
- /** 仓库编号 */
153
- public whId?: string | null;
154
-
155
- public constructor(obj?: WhDTO) {
156
- keys(obj ?? {}).forEach((key: PropertyKey) => {
157
- switch (key) {
158
- case 'activeFlg':
159
- case 'adrId':
160
- case 'adrnam':
161
- case 'comCod':
162
- case 'defWhFlg':
163
- case 'id':
164
- case 'orgcod':
165
- case 'permAdjLod':
166
- case 'permAdjSub':
167
- case 'permCreLod':
168
- case 'permCreSub':
169
- case 'whDsc':
170
- case 'whId':
171
- Reflect.set(this, key, Reflect.get(obj ?? {}, key));
172
- break;
173
- default:
174
- break;
175
- }
176
- });
177
- }
178
- }
179
-
180
- /**
181
- * 获取对象的属性名数组.
182
- * @param obj 对象.
183
- */
184
- export function keys<C extends object>(obj: C): Array<keyof C> {
185
- const type = typeof obj;
186
-
187
- if (!(obj != null && (type === 'object' || type === 'function'))) {
188
- return [];
189
- }
190
-
191
- return Reflect.ownKeys(obj) as Array<keyof C>;
192
- }
1
+ export class IPage<T0> {
2
+ /** Current. */
3
+ public current?: number | null;
4
+ /** Pages. */
5
+ public pages?: number | null;
6
+ /** Records. */
7
+ public records?: Array<T0> | null;
8
+ /** Size. */
9
+ public size?: number | null;
10
+ /** Total. */
11
+ public total?: number | null;
12
+
13
+ public constructor(obj?: IPage<T0>) {
14
+ keys(obj ?? {}).forEach((key: PropertyKey) => {
15
+ switch (key) {
16
+ case 'current':
17
+ case 'pages':
18
+ case 'records':
19
+ case 'size':
20
+ case 'total':
21
+ Reflect.set(this, key, Reflect.get(obj ?? {}, key));
22
+ break;
23
+ default:
24
+ break;
25
+ }
26
+ });
27
+ }
28
+ }
29
+
30
+ /** 用户. */
31
+ export class SysUser {
32
+ /** Activiti Sync. */
33
+ public activitiSync?: number | null;
34
+ /** 头像. */
35
+ public avatar?: string | null;
36
+ /** Birthday. */
37
+ public birthday?: string | null;
38
+ /** Client Id. */
39
+ public clientId?: string | null;
40
+ /** Create By. */
41
+ public createBy?: string | null;
42
+ /** Create Time. */
43
+ public createTime?: string | null;
44
+ /** Del Flag. */
45
+ public delFlag?: number | null;
46
+ /** Depart Ids. */
47
+ public departIds?: string | null;
48
+ /** 邮件. */
49
+ public email?: string | null;
50
+ /** Home Path. */
51
+ public homePath?: string | null;
52
+ /** Id. */
53
+ public id?: string | null;
54
+ /** Org Code. */
55
+ public orgCode?: string | null;
56
+ /** Org Code Txt. */
57
+ public orgCodeTxt?: string | null;
58
+ /** Password. */
59
+ public password?: string | null;
60
+ /** 电话. */
61
+ public phone?: string | null;
62
+ /** Post. */
63
+ public post?: string | null;
64
+ /** 姓名. */
65
+ public realname?: string | null;
66
+ /** Rel Tenant Ids. */
67
+ public relTenantIds?: string | null;
68
+ /** Salt. */
69
+ public salt?: string | null;
70
+ /** Sex. */
71
+ public sex?: number | null;
72
+ /** 状态. */
73
+ public status?: number | null;
74
+ /** Telephone. */
75
+ public telephone?: string | null;
76
+ /** Update By. */
77
+ public updateBy?: string | null;
78
+ /** Update Time. */
79
+ public updateTime?: string | null;
80
+ /** User Identity. */
81
+ public userIdentity?: number | null;
82
+ /** 账号. */
83
+ public username?: string | null;
84
+ /** 工号. */
85
+ public workNo?: string | null;
86
+
87
+ public constructor(obj?: SysUser) {
88
+ keys(obj ?? {}).forEach((key: PropertyKey) => {
89
+ switch (key) {
90
+ case 'activitiSync':
91
+ case 'avatar':
92
+ case 'birthday':
93
+ case 'clientId':
94
+ case 'createBy':
95
+ case 'createTime':
96
+ case 'delFlag':
97
+ case 'departIds':
98
+ case 'email':
99
+ case 'homePath':
100
+ case 'id':
101
+ case 'orgCode':
102
+ case 'orgCodeTxt':
103
+ case 'password':
104
+ case 'phone':
105
+ case 'post':
106
+ case 'realname':
107
+ case 'relTenantIds':
108
+ case 'salt':
109
+ case 'sex':
110
+ case 'status':
111
+ case 'telephone':
112
+ case 'updateBy':
113
+ case 'updateTime':
114
+ case 'userIdentity':
115
+ case 'username':
116
+ case 'workNo':
117
+ Reflect.set(this, key, Reflect.get(obj ?? {}, key));
118
+ break;
119
+ default:
120
+ break;
121
+ }
122
+ });
123
+ }
124
+ }
125
+
126
+ /** 仓库数据传输对象 */
127
+ export class WhDTO {
128
+ /** 是否可用 */
129
+ public activeFlg?: number | null;
130
+ /** 地址编号 */
131
+ public adrId?: string | null;
132
+ /** 地址名 */
133
+ public adrnam?: string | null;
134
+ /** 公司代码 */
135
+ public comCod?: string | null;
136
+ /** 默认仓库 */
137
+ public defWhFlg?: number | null;
138
+ /** 主键. */
139
+ public id?: string | null;
140
+ /** 所属地/国编号 */
141
+ public orgcod?: string | null;
142
+ /** 永久调整托盘 */
143
+ public permAdjLod?: string | null;
144
+ /** 永久调整箱 */
145
+ public permAdjSub?: string | null;
146
+ /** 永久创建托盘 */
147
+ public permCreLod?: string | null;
148
+ /** 永久创建箱 */
149
+ public permCreSub?: string | null;
150
+ /** 仓库名称 */
151
+ public whDsc?: string | null;
152
+ /** 仓库编号 */
153
+ public whId?: string | null;
154
+
155
+ public constructor(obj?: WhDTO) {
156
+ keys(obj ?? {}).forEach((key: PropertyKey) => {
157
+ switch (key) {
158
+ case 'activeFlg':
159
+ case 'adrId':
160
+ case 'adrnam':
161
+ case 'comCod':
162
+ case 'defWhFlg':
163
+ case 'id':
164
+ case 'orgcod':
165
+ case 'permAdjLod':
166
+ case 'permAdjSub':
167
+ case 'permCreLod':
168
+ case 'permCreSub':
169
+ case 'whDsc':
170
+ case 'whId':
171
+ Reflect.set(this, key, Reflect.get(obj ?? {}, key));
172
+ break;
173
+ default:
174
+ break;
175
+ }
176
+ });
177
+ }
178
+ }
179
+
180
+ /**
181
+ * 获取对象的属性名数组.
182
+ * @param obj 对象.
183
+ */
184
+ export function keys<C extends object>(obj: C): Array<keyof C> {
185
+ const type = typeof obj;
186
+
187
+ if (!(obj != null && (type === 'object' || type === 'function'))) {
188
+ return [];
189
+ }
190
+
191
+ return Reflect.ownKeys(obj) as Array<keyof C>;
192
+ }
package/dist/api/api.ts CHANGED
@@ -1 +1 @@
1
- export { WMSAPI as WMS } from './WMS';
1
+ export { WMSAPI as WMS } from './WMS';
package/dist/api/def.ts CHANGED
@@ -1 +1 @@
1
- export { WMSDEF as WMS } from './WMS';
1
+ export { WMSDEF as WMS } from './WMS';
package/dist/api/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * as API from './api';
2
- export * as DEF from './def';
1
+ export * as API from './api';
2
+ export * as DEF from './def';
@@ -101,7 +101,6 @@ function handleError<T = any>(
101
101
  ) {
102
102
  // @ts-ignore
103
103
  if (response.errMsg === 'request:fail') {
104
- // store.dispatch('logout');
105
104
  return;
106
105
  }
107
106
 
@@ -109,7 +108,6 @@ function handleError<T = any>(
109
108
  // @ts-ignore
110
109
  const message = (response.data as any)?.message || response?.errMsg || '请求出错';
111
110
  uni.showToast({ title: message, icon: 'none', duration: 3000 });
112
- } else {
113
111
  }
114
112
 
115
113
  reject(response);
@@ -145,6 +143,7 @@ const _httpClient: IHttpClient = {
145
143
  }
146
144
 
147
145
  uni.request({
146
+ ...(options ?? {}),
148
147
  method,
149
148
  url: _url,
150
149
  header: options?.header ?? {},
@@ -62,13 +62,26 @@ export const useAppStore = defineStore('app', {
62
62
 
63
63
  /**
64
64
  * 退出登录.
65
+ * @param param.isRequest 是否请求后端退出登录接口, 默认为 true.
65
66
  */
66
- async logout() {
67
- if (this.getToken) {
68
- await API.WMS.LoginController.Logout({}, { header: { 'X-Access-Token': this.getToken } });
69
- }
67
+ async logout(param: { isRequest?: boolean } = {}) {
68
+ const { isRequest = true } = param;
69
+
70
70
  this.setToken('');
71
71
  this.setUser(null);
72
+
73
+ if (isRequest && this.getToken) {
74
+ API.WMS.LoginController.Logout(
75
+ {},
76
+ {
77
+ header: { 'X-Access-Token': this.getToken },
78
+ timeout: 5 * 1000,
79
+ },
80
+ ).catch(() => {
81
+ // 调用退出登录接口失败, 但是并不影响前端退出,
82
+ });
83
+ }
84
+
72
85
  uni.reLaunch({ url: '/pages/login/Login' });
73
86
  },
74
87
 
@@ -76,6 +89,6 @@ export const useAppStore = defineStore('app', {
76
89
  * 打开更新弹窗.
77
90
  * @param version 最新版本.
78
91
  */
79
- openKgUpdatePopup(version: number) {},
92
+ openKgUpdatePopup(version: string) {},
80
93
  },
81
94
  });
package/dist/util/kg.ts CHANGED
@@ -90,29 +90,43 @@ export class Kg {
90
90
 
91
91
  const appStore = useAppStore();
92
92
 
93
+ if (!appStore.getToken) {
94
+ return false;
95
+ }
96
+
93
97
  if (isRespectCancel && appStore.getIsUpdateCancel) {
94
98
  return false;
95
99
  }
96
100
 
97
101
  // 当前版本
98
- const oldVersion: number = Number(plus.runtime.versionCode);
102
+ const oldVersionSegments: Array<string> = (plus.runtime.version || '').split('.');
103
+ const major: number = Number(oldVersionSegments[0]);
104
+ const minor: number = Number(oldVersionSegments[1]);
105
+ const patch: number = Number(oldVersionSegments[2]);
99
106
 
100
107
  try {
101
- const newVersion = await API.WMS.CommonController.GetLatestApkVersion();
108
+ const newVersion = await API.WMS.CommonController.GetLatestApkVersion({}, { timeout: 5 * 1000 });
109
+
110
+ // 最新版本
111
+ const newVersionSegments = newVersion.split('.');
112
+ const _major: number = Number(newVersionSegments[0]);
113
+ const _minor: number = Number(newVersionSegments[1]);
114
+ const _patch: number = Number(newVersionSegments[2]);
102
115
 
116
+ // 有新版本
117
+ if (_major > major || (_major == major && _minor > minor) || (_major == major && _minor == minor && _patch > patch)) {
118
+ appStore.openKgUpdatePopup(newVersion);
119
+ return true;
120
+ }
103
121
  // 无新版本
104
- if (newVersion === 0 || oldVersion >= newVersion) {
122
+ else {
105
123
  if (isShowToast) {
106
124
  uni.showToast({ title: '已是最新版本.', icon: 'none' });
107
125
  }
108
126
  return false;
109
127
  }
110
-
111
- // 有新版本
112
- appStore.openKgUpdatePopup(newVersion);
113
- return true;
114
128
  } catch (e) {
115
- console.error(e);
129
+ // 接口请求失败
116
130
  }
117
131
 
118
132
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kengic/uni",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "scripts": {
5
5
  "build": "npm run switch-node-version && rimraf dist && vue-tsc && vite build",
6
6
  "------ -------------------------------------------": "",