jmash-core-mp 0.1.21 → 0.1.22

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 (150) hide show
  1. package/.editorconfig +9 -9
  2. package/README.md +60 -60
  3. package/babel.config.json +34 -34
  4. package/eslint.config.mjs +7 -7
  5. package/lib/api/auth/index.d.ts +21 -21
  6. package/lib/api/auth/index.js +199 -199
  7. package/lib/api/auth/types.d.ts +86 -86
  8. package/lib/api/auth/types.js +9 -9
  9. package/lib/api/cms/index.d.ts +20 -20
  10. package/lib/api/cms/index.js +161 -161
  11. package/lib/api/cms/types.d.ts +200 -200
  12. package/lib/api/cms/types.js +1 -1
  13. package/lib/api/constant.d.ts +5 -5
  14. package/lib/api/constant.js +6 -6
  15. package/lib/api/dict/index.d.ts +18 -18
  16. package/lib/api/dict/index.js +34 -34
  17. package/lib/api/dict/types.d.ts +28 -28
  18. package/lib/api/dict/types.js +1 -1
  19. package/lib/api/dicts.d.ts +18 -18
  20. package/lib/api/dicts.js +67 -67
  21. package/lib/api/files/index.d.ts +25 -25
  22. package/lib/api/files/index.js +135 -135
  23. package/lib/api/files/types.d.ts +38 -38
  24. package/lib/api/files/types.js +1 -1
  25. package/lib/api/index.d.ts +4 -4
  26. package/lib/api/index.js +6 -6
  27. package/lib/api/myorgan/types.d.ts +22 -22
  28. package/lib/api/myorgan/types.js +1 -1
  29. package/lib/api/region/index.d.ts +7 -7
  30. package/lib/api/region/index.js +19 -19
  31. package/lib/api/region/types.d.ts +19 -19
  32. package/lib/api/region/types.js +1 -1
  33. package/lib/api/storage/index.d.ts +10 -10
  34. package/lib/api/storage/index.js +43 -43
  35. package/lib/api/storage/types.d.ts +28 -28
  36. package/lib/api/storage/types.js +1 -1
  37. package/lib/api/types.d.ts +42 -42
  38. package/lib/api/types.js +1 -1
  39. package/lib/app.mpx.d.ts +1 -1
  40. package/lib/components/auth-user/jmash-update-user.mpx.d.ts +1 -1
  41. package/lib/components/auth-user/jmash-user.mpx.d.ts +1 -1
  42. package/lib/components/cms/jmash-cms-acticle-list.mpx.d.ts +1 -1
  43. package/lib/components/cms/jmash-cms-article-item.mpx.d.ts +1 -1
  44. package/lib/components/cms/jmash-cms-article-view.mpx.d.ts +1 -0
  45. package/lib/components/cms/jmash-cms-article.mpx.d.ts +1 -1
  46. package/lib/components/cms/jmash-cms-like.mpx.d.ts +1 -1
  47. package/lib/components/common/jmash-upload-picture.mpx.d.ts +1 -0
  48. package/lib/components/core/jmash-login.mpx.d.ts +1 -0
  49. package/lib/index.d.ts +21 -21
  50. package/lib/index.js +14 -14
  51. package/lib/packages/pages/cms/cms-article-list.mpx.d.ts +1 -1
  52. package/lib/pages/index.mpx.d.ts +1 -0
  53. package/lib/store/user.d.ts +31 -31
  54. package/lib/store/user.js +227 -227
  55. package/lib/utils/common.d.ts +35 -35
  56. package/lib/utils/common.js +166 -166
  57. package/lib/utils/config.d.ts +5 -5
  58. package/lib/utils/config.js +29 -29
  59. package/lib/utils/db.d.ts +21 -21
  60. package/lib/utils/db.js +84 -84
  61. package/lib/utils/grpc.d.ts +5 -5
  62. package/lib/utils/grpc.js +20 -20
  63. package/lib/utils/net.d.ts +7 -7
  64. package/lib/utils/net.js +15 -15
  65. package/lib/utils/request.d.ts +2 -2
  66. package/lib/utils/request.js +123 -123
  67. package/mpx.config.js +27 -27
  68. package/package.json +1 -1
  69. package/postcss.config.js +11 -11
  70. package/project.config.json +24 -24
  71. package/project.private.config.json +13 -13
  72. package/public/index.html +15 -15
  73. package/src/api/auth/index.ts +227 -227
  74. package/src/api/auth/types.ts +166 -166
  75. package/src/api/cms/index.ts +218 -218
  76. package/src/api/cms/types.ts +379 -379
  77. package/src/api/constant.ts +6 -6
  78. package/src/api/dict/index.ts +44 -44
  79. package/src/api/dict/types.ts +49 -49
  80. package/src/api/dicts.ts +72 -72
  81. package/src/api/files/index.ts +163 -163
  82. package/src/api/files/types.ts +67 -67
  83. package/src/api/index.ts +11 -11
  84. package/src/api/myorgan/types.ts +42 -42
  85. package/src/api/region/index.ts +23 -23
  86. package/src/api/region/types.ts +36 -36
  87. package/src/api/storage/index.ts +62 -62
  88. package/src/api/storage/types.ts +54 -54
  89. package/src/api/types.ts +72 -72
  90. package/src/app.mpx +71 -71
  91. package/src/components/auth-user/jmash-logout.mpx +91 -91
  92. package/src/components/auth-user/jmash-update-user.mpx +386 -386
  93. package/src/components/auth-user/jmash-update-user.web.mpx +366 -366
  94. package/src/components/auth-user/jmash-user.mpx +359 -359
  95. package/src/components/cms/jmash-cms-acticle-list.mpx +182 -182
  96. package/src/components/cms/jmash-cms-article-item.mpx +241 -241
  97. package/src/components/cms/jmash-cms-article-view.mpx +131 -131
  98. package/src/components/cms/jmash-cms-article.mpx +68 -68
  99. package/src/components/cms/jmash-cms-like.mpx +151 -151
  100. package/src/components/common/jmash-avatar-edit.mpx +153 -153
  101. package/src/components/common/jmash-cascader-region.mpx +112 -112
  102. package/src/components/common/jmash-menu.mpx +129 -129
  103. package/src/components/common/jmash-none-data.mpx +82 -82
  104. package/src/components/common/jmash-pic-swiper.mpx +71 -71
  105. package/src/components/common/jmash-popup.mpx +137 -137
  106. package/src/components/common/jmash-search.mpx +126 -126
  107. package/src/components/common/jmash-single-btn.mpx +53 -53
  108. package/src/components/common/jmash-stepper.mpx +214 -214
  109. package/src/components/common/jmash-tab-bar.mpx +50 -50
  110. package/src/components/common/jmash-textarea.mpx +88 -88
  111. package/src/components/common/jmash-top-navigation.mpx +203 -203
  112. package/src/components/common/jmash-upload-picture.mpx +129 -126
  113. package/src/components/core/jmash-cms-protocol.mpx +66 -66
  114. package/src/components/core/jmash-login.ali.mpx +284 -284
  115. package/src/components/core/jmash-login.mpx +348 -348
  116. package/src/components/core/jmash-login.web.mpx +421 -421
  117. package/src/components/core/jmash-popup-login.ali.mpx +311 -311
  118. package/src/components/core/jmash-popup-login.mpx +415 -415
  119. package/src/components/core/jmash-popup-login.web.mpx +389 -389
  120. package/src/custom-tab-bar/index.mpx +10 -10
  121. package/src/global.d.ts +11 -11
  122. package/src/index.ts +71 -71
  123. package/src/packages/index.mpx +10 -10
  124. package/src/packages/pages/auth/cms-protocol.mpx +31 -31
  125. package/src/packages/pages/auth/login.mpx +59 -59
  126. package/src/packages/pages/auth/update-user.mpx +17 -17
  127. package/src/packages/pages/cms/cms-article-list.mpx +164 -164
  128. package/src/packages/pages/cms/cms-article.mpx +32 -32
  129. package/src/pages/basic-component.mpx +30 -30
  130. package/src/pages/half-home.mpx +58 -58
  131. package/src/pages/home.mpx +52 -52
  132. package/src/pages/home2.mpx +47 -47
  133. package/src/pages/index.mpx +13 -3
  134. package/src/pages/tabbar/home.mpx +77 -77
  135. package/src/pages/tabbar/my.mpx +80 -80
  136. package/src/store/user.ts +270 -270
  137. package/src/styles/index.scss +20 -20
  138. package/src/styles/vars.scss +27 -27
  139. package/src/utils/common.ts +179 -179
  140. package/src/utils/config.ts +35 -35
  141. package/src/utils/db.ts +100 -100
  142. package/src/utils/grpc.ts +21 -21
  143. package/src/utils/net.ts +18 -18
  144. package/src/utils/request.ts +134 -134
  145. package/static/ali/mini.project.json +4 -4
  146. package/static/dd/project.config.json +15 -15
  147. package/static/swan/project.swan.json +14 -14
  148. package/static/tt/project.config.json +11 -11
  149. package/static/wx/project.config.json +40 -40
  150. package/uno.config.js +9 -9
package/lib/store/user.js CHANGED
@@ -1,227 +1,227 @@
1
- import { defineStore } from "@mpxjs/pinia";
2
- import { authApi } from "../api/auth/index";
3
- import { db } from "../utils/db";
4
- import { net } from "../utils/net";
5
- import mpx from "@mpxjs/core";
6
- export const useUserStore = defineStore("user", {
7
- state: () => ({
8
- userInfo: db.getUserInfo() || {},
9
- roleCodes: db.getRoleCodes() || [],
10
- permCodes: db.getPermCodes() || [],
11
- accessToken: db.getToken() || "",
12
- expiresDate: db.getTokenExpiresDate() || 0,
13
- }),
14
- actions: {
15
- /** 登录检查 */
16
- loginOnlyAC() {
17
- // 1. 已登录 → 直接返回成功
18
- if (this.checkLogin()) {
19
- return Promise.resolve(true);
20
- }
21
- const config = getApp().globalData.config;
22
- // 2. 测试环境特殊配置 → 直接返回失败
23
- if (config.dev && config.testNewUser) {
24
- return Promise.reject("测试环境,要求用户登录!");
25
- }
26
- // 3. 执行静默登录
27
- return this.silentLogin().then((res) => {
28
- return res.status;
29
- });
30
- },
31
- /** 登录检查并跳转登录 */
32
- loginAC(backurl, tabbar, loginurl = "/jmash/pages/auth/login") {
33
- // 1. 已登录 → 直接 resolve
34
- if (this.checkLogin()) {
35
- return Promise.resolve(true);
36
- }
37
- // 2. 拼接登录跳转地址(抽离公共逻辑)
38
- const toUrl = `${loginurl}?tabbar=${tabbar}&backurl=${encodeURIComponent(backurl)}`;
39
- const config = getApp().globalData.config;
40
- // 3. 测试环境特殊处理
41
- if (config.dev && config.testNewUser) {
42
- mpx.navigateTo({ url: toUrl });
43
- return Promise.resolve(false);
44
- }
45
- // 4. 生产环境:执行静默登录
46
- return this.silentLogin()
47
- .then((res) => {
48
- // 静默登录成功
49
- return Promise.resolve(res.status);
50
- })
51
- .catch(() => {
52
- mpx.navigateTo({ url: toUrl });
53
- return Promise.resolve(false);
54
- });
55
- },
56
- /** 静默登录 */
57
- silentLogin() {
58
- const obj = __mpx_mode__ === "ali" ? { scopes: "auth_base" } : {};
59
- const config = getApp().globalData.config;
60
- return mpx
61
- .login(obj)
62
- .then((res) => {
63
- console.log("silentLogin-res", res);
64
- if (res.code) {
65
- return authApi
66
- .mpLogin({
67
- loginCode: res.code,
68
- appId: config.appId,
69
- componentAppid: config.componentAppid,
70
- })
71
- .then(this.loginProcess);
72
- }
73
- throw new Error("接口登录失败!");
74
- })
75
- .catch((error) => {
76
- console.log("小程序登录失败!", error);
77
- return Promise.reject(error);
78
- });
79
- },
80
- // 手机号code 注册登录
81
- mpRegister(phoneCode, nickName = "", avatar = "") {
82
- const obj = __mpx_mode__ === "ali" ? { scopes: "auth_user" } : {};
83
- const config = getApp().globalData.config;
84
- return mpx
85
- .login(obj)
86
- .then((res) => {
87
- if (res.code) {
88
- return authApi
89
- .mpPhoneRegister({
90
- phoneCode: phoneCode,
91
- loginCode: res.code,
92
- appId: config.appId,
93
- nickName: nickName,
94
- avatar: avatar,
95
- componentAppid: config.componentAppid,
96
- })
97
- .then(this.loginProcess);
98
- }
99
- throw new Error("小程序登录失败!");
100
- });
101
- },
102
- //web登录.
103
- webLogin(userName, pwd) {
104
- // 编码密码
105
- const encodePwd = net.encrypt(pwd);
106
- return authApi
107
- .webLogin({ userName, encodePwd: encodePwd })
108
- .then((res) => {
109
- return {
110
- status: true,
111
- token: this.loginSuccess(res.data),
112
- message: "登录成功!",
113
- };
114
- });
115
- },
116
- // 登录处理
117
- loginProcess(resp) {
118
- //console.log("miniappLogin", resp);
119
- if (resp.statusCode === 200 && resp.data.status === true) {
120
- console.log("login success");
121
- this.loginSuccess(resp.data.token);
122
- }
123
- else if (resp.statusCode !== 200) {
124
- throw new Error(resp.errMsg);
125
- }
126
- else if (resp.data.status === false) {
127
- throw new Error("用户未注册!");
128
- }
129
- return resp.data;
130
- },
131
- loginSuccess(token) {
132
- this.accessToken = token.accessToken;
133
- this.expiresDate = token.expiresIn * 1000 + new Date().getTime();
134
- db.setToken(token);
135
- this.getUserInfo(false);
136
- this.getRolePerm(false);
137
- return token;
138
- },
139
- // 退出登录,清空状态
140
- logout() {
141
- db.clearStorage();
142
- this.userInfo = {};
143
- this.roleCodes = [];
144
- this.permCodes = [];
145
- this.accessToken = "";
146
- this.expiresDate = 0;
147
- },
148
- /** 检查登录是否有效? */
149
- checkLogin() {
150
- if (this.accessToken && !this.isTokenExpires()) {
151
- return true;
152
- }
153
- return false;
154
- },
155
- //是否Token过期.
156
- isTokenExpires() {
157
- const expiresDate = this.expiresDate;
158
- //无token/无过期时间直接视为过期
159
- if (!this.accessToken || !expiresDate)
160
- return true;
161
- const now = new Date().getTime();
162
- return now + 30000 > expiresDate;
163
- },
164
- // 检查角色
165
- checkRole(role) {
166
- // 获取roleCodes
167
- const roleCodes = this.roleCodes;
168
- return roleCodes.length > 0 && roleCodes.indexOf(role) !== -1;
169
- },
170
- // 获取用户信息
171
- getUserInfo(cache = true) {
172
- const userInfo = this.userInfo;
173
- // 有缓存直接返回
174
- if (cache && Object.keys(userInfo).length > 0) {
175
- return Promise.resolve(userInfo);
176
- }
177
- // 无缓存请求接口
178
- return authApi
179
- .userInfo()
180
- .then((resp) => {
181
- this.userInfo = resp.data;
182
- db.setUserInfo(resp.data);
183
- return resp.data;
184
- })
185
- .catch(() => Promise.reject("获取用户信息错误!"));
186
- },
187
- setUserInfo(userInfo) {
188
- this.userInfo = userInfo;
189
- db.setUserInfo(userInfo);
190
- },
191
- // 获取角色权限
192
- getRolePerm(cache = true) {
193
- const rolesPerms = {
194
- roleCodes: this.roleCodes,
195
- permCodes: this.permCodes,
196
- };
197
- // 有缓存直接返回
198
- if (cache &&
199
- (rolesPerms.roleCodes.length > 0 || rolesPerms.permCodes.length > 0)) {
200
- return Promise.resolve(rolesPerms);
201
- }
202
- // 无缓存请求接口
203
- return authApi
204
- .userRolesPerms()
205
- .then((response) => {
206
- this.roleCodes = response.data.roleCodes;
207
- this.permCodes = response.data.permCodes;
208
- db.setRoleCodes(response.data.roleCodes);
209
- db.setPermCodes(response.data.permCodes);
210
- return response.data;
211
- })
212
- .catch(() => Promise.reject("获取角色权限错误!"));
213
- },
214
- // 刷新Token.
215
- refreshToken() {
216
- return authApi
217
- .refreshToken()
218
- .then((response) => {
219
- this.accessToken = response.data.accessToken;
220
- this.expiresDate =
221
- response.data.expiresIn * 1000 + new Date().getTime();
222
- db.setToken(response.data);
223
- return true;
224
- });
225
- },
226
- },
227
- });
1
+ import { defineStore } from "@mpxjs/pinia";
2
+ import { authApi } from "../api/auth/index";
3
+ import { db } from "../utils/db";
4
+ import { net } from "../utils/net";
5
+ import mpx from "@mpxjs/core";
6
+ export const useUserStore = defineStore("user", {
7
+ state: () => ({
8
+ userInfo: db.getUserInfo() || {},
9
+ roleCodes: db.getRoleCodes() || [],
10
+ permCodes: db.getPermCodes() || [],
11
+ accessToken: db.getToken() || "",
12
+ expiresDate: db.getTokenExpiresDate() || 0,
13
+ }),
14
+ actions: {
15
+ /** 登录检查 */
16
+ loginOnlyAC() {
17
+ // 1. 已登录 → 直接返回成功
18
+ if (this.checkLogin()) {
19
+ return Promise.resolve(true);
20
+ }
21
+ const config = getApp().globalData.config;
22
+ // 2. 测试环境特殊配置 → 直接返回失败
23
+ if (config.dev && config.testNewUser) {
24
+ return Promise.reject("测试环境,要求用户登录!");
25
+ }
26
+ // 3. 执行静默登录
27
+ return this.silentLogin().then((res) => {
28
+ return res.status;
29
+ });
30
+ },
31
+ /** 登录检查并跳转登录 */
32
+ loginAC(backurl, tabbar, loginurl = "/jmash/pages/auth/login") {
33
+ // 1. 已登录 → 直接 resolve
34
+ if (this.checkLogin()) {
35
+ return Promise.resolve(true);
36
+ }
37
+ // 2. 拼接登录跳转地址(抽离公共逻辑)
38
+ const toUrl = `${loginurl}?tabbar=${tabbar}&backurl=${encodeURIComponent(backurl)}`;
39
+ const config = getApp().globalData.config;
40
+ // 3. 测试环境特殊处理
41
+ if (config.dev && config.testNewUser) {
42
+ mpx.navigateTo({ url: toUrl });
43
+ return Promise.resolve(false);
44
+ }
45
+ // 4. 生产环境:执行静默登录
46
+ return this.silentLogin()
47
+ .then((res) => {
48
+ // 静默登录成功
49
+ return Promise.resolve(res.status);
50
+ })
51
+ .catch(() => {
52
+ mpx.navigateTo({ url: toUrl });
53
+ return Promise.resolve(false);
54
+ });
55
+ },
56
+ /** 静默登录 */
57
+ silentLogin() {
58
+ const obj = __mpx_mode__ === "ali" ? { scopes: "auth_base" } : {};
59
+ const config = getApp().globalData.config;
60
+ return mpx
61
+ .login(obj)
62
+ .then((res) => {
63
+ console.log("silentLogin-res", res);
64
+ if (res.code) {
65
+ return authApi
66
+ .mpLogin({
67
+ loginCode: res.code,
68
+ appId: config.appId,
69
+ componentAppid: config.componentAppid,
70
+ })
71
+ .then(this.loginProcess);
72
+ }
73
+ throw new Error("接口登录失败!");
74
+ })
75
+ .catch((error) => {
76
+ console.log("小程序登录失败!", error);
77
+ return Promise.reject(error);
78
+ });
79
+ },
80
+ // 手机号code 注册登录
81
+ mpRegister(phoneCode, nickName = "", avatar = "") {
82
+ const obj = __mpx_mode__ === "ali" ? { scopes: "auth_user" } : {};
83
+ const config = getApp().globalData.config;
84
+ return mpx
85
+ .login(obj)
86
+ .then((res) => {
87
+ if (res.code) {
88
+ return authApi
89
+ .mpPhoneRegister({
90
+ phoneCode: phoneCode,
91
+ loginCode: res.code,
92
+ appId: config.appId,
93
+ nickName: nickName,
94
+ avatar: avatar,
95
+ componentAppid: config.componentAppid,
96
+ })
97
+ .then(this.loginProcess);
98
+ }
99
+ throw new Error("小程序登录失败!");
100
+ });
101
+ },
102
+ //web登录.
103
+ webLogin(userName, pwd) {
104
+ // 编码密码
105
+ const encodePwd = net.encrypt(pwd);
106
+ return authApi
107
+ .webLogin({ userName, encodePwd: encodePwd })
108
+ .then((res) => {
109
+ return {
110
+ status: true,
111
+ token: this.loginSuccess(res.data),
112
+ message: "登录成功!",
113
+ };
114
+ });
115
+ },
116
+ // 登录处理
117
+ loginProcess(resp) {
118
+ //console.log("miniappLogin", resp);
119
+ if (resp.statusCode === 200 && resp.data.status === true) {
120
+ console.log("login success");
121
+ this.loginSuccess(resp.data.token);
122
+ }
123
+ else if (resp.statusCode !== 200) {
124
+ throw new Error(resp.errMsg);
125
+ }
126
+ else if (resp.data.status === false) {
127
+ throw new Error("用户未注册!");
128
+ }
129
+ return resp.data;
130
+ },
131
+ loginSuccess(token) {
132
+ this.accessToken = token.accessToken;
133
+ this.expiresDate = token.expiresIn * 1000 + new Date().getTime();
134
+ db.setToken(token);
135
+ this.getUserInfo(false);
136
+ this.getRolePerm(false);
137
+ return token;
138
+ },
139
+ // 退出登录,清空状态
140
+ logout() {
141
+ db.clearStorage();
142
+ this.userInfo = {};
143
+ this.roleCodes = [];
144
+ this.permCodes = [];
145
+ this.accessToken = "";
146
+ this.expiresDate = 0;
147
+ },
148
+ /** 检查登录是否有效? */
149
+ checkLogin() {
150
+ if (this.accessToken && !this.isTokenExpires()) {
151
+ return true;
152
+ }
153
+ return false;
154
+ },
155
+ //是否Token过期.
156
+ isTokenExpires() {
157
+ const expiresDate = this.expiresDate;
158
+ //无token/无过期时间直接视为过期
159
+ if (!this.accessToken || !expiresDate)
160
+ return true;
161
+ const now = new Date().getTime();
162
+ return now + 30000 > expiresDate;
163
+ },
164
+ // 检查角色
165
+ checkRole(role) {
166
+ // 获取roleCodes
167
+ const roleCodes = this.roleCodes;
168
+ return roleCodes.length > 0 && roleCodes.indexOf(role) !== -1;
169
+ },
170
+ // 获取用户信息
171
+ getUserInfo(cache = true) {
172
+ const userInfo = this.userInfo;
173
+ // 有缓存直接返回
174
+ if (cache && Object.keys(userInfo).length > 0) {
175
+ return Promise.resolve(userInfo);
176
+ }
177
+ // 无缓存请求接口
178
+ return authApi
179
+ .userInfo()
180
+ .then((resp) => {
181
+ this.userInfo = resp.data;
182
+ db.setUserInfo(resp.data);
183
+ return resp.data;
184
+ })
185
+ .catch(() => Promise.reject("获取用户信息错误!"));
186
+ },
187
+ setUserInfo(userInfo) {
188
+ this.userInfo = userInfo;
189
+ db.setUserInfo(userInfo);
190
+ },
191
+ // 获取角色权限
192
+ getRolePerm(cache = true) {
193
+ const rolesPerms = {
194
+ roleCodes: this.roleCodes,
195
+ permCodes: this.permCodes,
196
+ };
197
+ // 有缓存直接返回
198
+ if (cache &&
199
+ (rolesPerms.roleCodes.length > 0 || rolesPerms.permCodes.length > 0)) {
200
+ return Promise.resolve(rolesPerms);
201
+ }
202
+ // 无缓存请求接口
203
+ return authApi
204
+ .userRolesPerms()
205
+ .then((response) => {
206
+ this.roleCodes = response.data.roleCodes;
207
+ this.permCodes = response.data.permCodes;
208
+ db.setRoleCodes(response.data.roleCodes);
209
+ db.setPermCodes(response.data.permCodes);
210
+ return response.data;
211
+ })
212
+ .catch(() => Promise.reject("获取角色权限错误!"));
213
+ },
214
+ // 刷新Token.
215
+ refreshToken() {
216
+ return authApi
217
+ .refreshToken()
218
+ .then((response) => {
219
+ this.accessToken = response.data.accessToken;
220
+ this.expiresDate =
221
+ response.data.expiresIn * 1000 + new Date().getTime();
222
+ db.setToken(response.data);
223
+ return true;
224
+ });
225
+ },
226
+ },
227
+ });
@@ -1,35 +1,35 @@
1
- export declare const getHeight: () => {
2
- navigationPaddingHeight: number;
3
- topHeight: number;
4
- bottomHeight: number;
5
- MenuButtonRight: number;
6
- MenuButtonLeft: number;
7
- MenuButtonTop: number;
8
- MenuButtonBottom: number;
9
- MenuButtonWidth: number;
10
- MenuButtonHeight: number;
11
- MenuButtonBounding: number;
12
- screenWidth: number;
13
- screenHeight: number;
14
- computeHeightFn: (height: number, stackingHeight: number) => number;
15
- addition: (height: number, addHeight: number) => number;
16
- };
17
- /**
18
- * 格式化日期时间字符串
19
- * @param dateTimeString 日期时间字符串
20
- * @returns 格式化后的日期时间字符串
21
- */
22
- export declare const formatDateTime: (dateTimeString: string, format?: any) => string;
23
- /**
24
- * 正则校验规则
25
- * @param {string} value 需要校验的值
26
- * @param {string} message 错误提示信息
27
- * @param {string} rules 正则校验规则
28
- */
29
- export declare const validateRules: (value: string, message: string, rules: any) => boolean;
30
- /**
31
- * 校验必填项
32
- * @param {string} value 需要校验的值
33
- * @param {string} message 错误提示信息
34
- */
35
- export declare const validateRequired: (value: string | number, message: string) => boolean;
1
+ export declare const getHeight: () => {
2
+ navigationPaddingHeight: number;
3
+ topHeight: number;
4
+ bottomHeight: number;
5
+ MenuButtonRight: number;
6
+ MenuButtonLeft: number;
7
+ MenuButtonTop: number;
8
+ MenuButtonBottom: number;
9
+ MenuButtonWidth: number;
10
+ MenuButtonHeight: number;
11
+ MenuButtonBounding: number;
12
+ screenWidth: number;
13
+ screenHeight: number;
14
+ computeHeightFn: (height: number, stackingHeight: number) => number;
15
+ addition: (height: number, addHeight: number) => number;
16
+ };
17
+ /**
18
+ * 格式化日期时间字符串
19
+ * @param dateTimeString 日期时间字符串
20
+ * @returns 格式化后的日期时间字符串
21
+ */
22
+ export declare const formatDateTime: (dateTimeString: string, format?: any) => string;
23
+ /**
24
+ * 正则校验规则
25
+ * @param {string} value 需要校验的值
26
+ * @param {string} message 错误提示信息
27
+ * @param {string} rules 正则校验规则
28
+ */
29
+ export declare const validateRules: (value: string, message: string, rules: any) => boolean;
30
+ /**
31
+ * 校验必填项
32
+ * @param {string} value 需要校验的值
33
+ * @param {string} message 错误提示信息
34
+ */
35
+ export declare const validateRequired: (value: string | number, message: string) => boolean;