xyvcard-wechat-auth 0.0.1 → 0.0.3
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.
- package/README.md +1 -1
- package/dist/api/auth/index.js +159 -1
- package/dist/api/auth/types.js +1 -1
- package/dist/api/dict/index.js +36 -1
- package/dist/api/dict/types.js +1 -1
- package/dist/api/dicts.js +53 -1
- package/dist/api/files/index.js +135 -1
- package/dist/api/files/types.js +1 -1
- package/dist/api/index.js +12 -1
- package/dist/api/myorgan/index.js +1 -1
- package/dist/api/myorgan/types.js +1 -1
- package/dist/api/types.d.ts +47 -0
- package/dist/api/types.js +9 -1
- package/dist/components/common/btn/footer-btn/index.js +34 -1
- package/dist/components/common/btn/footer-btn/index.wxml +1 -1
- package/dist/components/common/btn/footer-double-btn/index.js +67 -1
- package/dist/components/common/btn/footer-double-btn/index.wxml +4 -2
- package/dist/components/common/btn/footer-double-btn/index.wxss +1 -0
- package/dist/components/common/choose-avatar/index.js +82 -1
- package/dist/components/common/choose-avatar/index.wxss +1 -1
- package/dist/components/common/none-data/index.js +53 -1
- package/dist/components/common/none-data/index.wxml +2 -2
- package/dist/components/common/none-data/index.wxss +1 -1
- package/dist/components/common/popup/index.js +50 -1
- package/dist/components/common/popup/index.wxml +1 -1
- package/dist/components/common/popup/index.wxss +1 -1
- package/dist/components/common/search/index.d.ts +1 -0
- package/dist/components/common/search/index.js +55 -0
- package/dist/components/common/search/index.json +4 -0
- package/dist/components/common/search/index.wxml +7 -0
- package/dist/components/common/search/index.wxss +1 -0
- package/dist/components/common/top-navigation/index.d.ts +1 -0
- package/dist/components/common/top-navigation/index.js +49 -0
- package/dist/components/common/top-navigation/index.json +4 -0
- package/dist/components/common/top-navigation/index.wxml +6 -0
- package/dist/components/common/top-navigation/index.wxss +1 -0
- package/dist/components/jmash-half-login/index.d.ts +1 -0
- package/dist/components/jmash-half-login/index.js +105 -0
- package/dist/components/jmash-half-login/index.json +8 -0
- package/dist/components/jmash-half-login/index.wxml +46 -0
- package/dist/components/jmash-half-login/index.wxss +1 -0
- package/dist/components/jmash-login/index.d.ts +1 -0
- package/dist/components/jmash-login/index.js +99 -0
- package/dist/components/jmash-login/index.json +4 -0
- package/dist/components/jmash-login/index.wxml +16 -0
- package/dist/components/jmash-login/index.wxss +1 -0
- package/dist/constant.js +15 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.js +25 -1
- package/dist/styles/{global.scss → index.scss} +11 -1
- package/dist/utils/auth.d.ts +3 -2
- package/dist/utils/auth.js +199 -1
- package/dist/utils/common.d.ts +16 -0
- package/dist/utils/common.js +112 -1
- package/dist/utils/config.d.ts +3 -1
- package/dist/utils/config.js +27 -1
- package/dist/utils/db.js +188 -1
- package/dist/utils/request.js +86 -1
- package/dist/utils/util.d.ts +9 -0
- package/dist/utils/util.js +88 -1
- package/package.json +4 -3
- package/xyvcard-wechat-auth-0.0.1.tgz +0 -0
- package/dist/app.d.ts +0 -0
- package/dist/app.js +0 -1
- package/dist/app.json +0 -24
- package/dist/app.wxss +0 -0
- package/dist/pages/index/index.d.ts +0 -0
- package/dist/pages/index/index.js +0 -1
- package/dist/pages/index/index.json +0 -7
- package/dist/pages/index/index.wxml +0 -4
- package/dist/pages/index/index.wxss +0 -0
- package/dist/sitemap.json +0 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.index_bj{width:100%}.login_container{position:relative;margin-top:-35%;display:flex;flex-direction:column;align-items:center}.login_logo{width:250px}.login_box{border-top-left-radius:20px;border-top-right-radius:20px;background-color:#fff;padding:13% 3% 4%;margin-top:40px;display:flex;flex-direction:column;align-items:center}.login_box .login_btn{background-color:#2563eb;color:#fff;padding:16px 0;width:100%;font-size:14px}.login_box .protocol_agree{color:#999;font-size:14px;margin-top:20px}.login_box .protocol_agree text{color:#2563eb}.login_box .tips_box{color:#2563eb;font-size:12px;margin-top:40%}
|
package/dist/constant.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
3
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
4
|
+
};
|
|
5
|
+
var require_constant = __commonJS({
|
|
6
|
+
"constant.js"(exports, module) {
|
|
7
|
+
const _Constant = class _Constant {
|
|
8
|
+
};
|
|
9
|
+
_Constant.MODULE_RBAC = "rbac";
|
|
10
|
+
_Constant.ENUM_GENDER = "jmash.protobuf.Gender";
|
|
11
|
+
let Constant = _Constant;
|
|
12
|
+
module.exports = Constant;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
export default require_constant();
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
+
export { clearEmpty, request, sendRequest } from "./utils/request";
|
|
2
|
+
export { config } from "./utils/config";
|
|
1
3
|
export { auth } from "./utils/auth";
|
|
2
4
|
export { db } from "./utils/db";
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
+
export type { BaseConfig } from "./utils/config";
|
|
6
|
+
export { validateRequired } from "./utils/common";
|
|
7
|
+
export type { RequestData, ResponseData, RequestHeader } from "./api/types";
|
|
5
8
|
export { Dict } from "./api/index";
|
|
6
9
|
export { EntryDict, EnumDict } from "./api/dicts";
|
|
10
|
+
export { authApi } from "./api/auth/index";
|
|
11
|
+
export type { LoginReq, LoginRes, PhoneNumberReq, RefreshTokenReq, TokenRes, RolesPerms, UserInfo, UpdateUserReq, UserInfoReq } from "./api/auth/types";
|
|
12
|
+
export { dictApi } from "./api/dict/index";
|
|
13
|
+
export type { Entry, DictEntryModel, DictEntryReq } from "./api/dict/types";
|
|
14
|
+
export { fileApi } from "./api/files/index";
|
|
15
|
+
export type { FileInfo, FileBase64Req, FileDownInfo, FileWebReq } from "./api/files/types";
|
package/dist/index.js
CHANGED
|
@@ -1 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
import { clearEmpty, request, sendRequest } from "./utils/request.js";
|
|
2
|
+
import { config } from "./utils/config.js";
|
|
3
|
+
import { auth } from "./utils/auth.js";
|
|
4
|
+
import { db } from "./utils/db.js";
|
|
5
|
+
import { validateRequired } from "./utils/common.js";
|
|
6
|
+
import { Dict } from "./api/index.js";
|
|
7
|
+
import { EntryDict, EnumDict } from "./api/dicts.js";
|
|
8
|
+
import { authApi } from "./api/auth/index.js";
|
|
9
|
+
import { dictApi } from "./api/dict/index.js";
|
|
10
|
+
import { fileApi } from "./api/files/index.js";
|
|
11
|
+
export {
|
|
12
|
+
Dict,
|
|
13
|
+
EntryDict,
|
|
14
|
+
EnumDict,
|
|
15
|
+
auth,
|
|
16
|
+
authApi,
|
|
17
|
+
clearEmpty,
|
|
18
|
+
config,
|
|
19
|
+
db,
|
|
20
|
+
dictApi,
|
|
21
|
+
fileApi,
|
|
22
|
+
request,
|
|
23
|
+
sendRequest,
|
|
24
|
+
validateRequired
|
|
25
|
+
};
|
|
@@ -10,6 +10,7 @@ $white-color: #fff;
|
|
|
10
10
|
$red-color: #EF4444;
|
|
11
11
|
$green-color: #16A34A;
|
|
12
12
|
$blue-color: #2563EB;
|
|
13
|
+
$black-color: #000;
|
|
13
14
|
// 字体颜色
|
|
14
15
|
$font-color: #333;
|
|
15
16
|
$font-color-grey: #666;
|
|
@@ -19,4 +20,13 @@ $width: 100%;
|
|
|
19
20
|
// 层级
|
|
20
21
|
$z-index: 99999;
|
|
21
22
|
// 下拉线颜色
|
|
22
|
-
$border-line: #EBEBEB;
|
|
23
|
+
$border-line: #EBEBEB;
|
|
24
|
+
// 背景色
|
|
25
|
+
$background-color: #f6f6f6;
|
|
26
|
+
// 白色背景
|
|
27
|
+
$background-white-color: #fff;
|
|
28
|
+
// 灰色字体
|
|
29
|
+
$grey-color: #999;
|
|
30
|
+
$grey-dark-color: #666;
|
|
31
|
+
// 字体大小
|
|
32
|
+
$font-mini-size: 12px;
|
package/dist/utils/auth.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { LoginRes, RolesPerms, UserInfo } from "../api/auth/types";
|
|
2
2
|
declare class Auth {
|
|
3
|
+
/** 登录检查 */
|
|
4
|
+
loginOnlyAC(): Promise<boolean>;
|
|
3
5
|
/** 登录检查并跳转登录 */
|
|
4
|
-
loginAC(backurl: string, tabbar: boolean):
|
|
6
|
+
loginAC(backurl: string, tabbar: boolean, loginurl?: string): Promise<boolean>;
|
|
5
7
|
/** 检查登录是否有效? */
|
|
6
8
|
checkLogin(): boolean;
|
|
7
|
-
_checkLogin(): Promise<unknown>;
|
|
8
9
|
hasUser(): Promise<boolean>;
|
|
9
10
|
checkRole(role: string): boolean;
|
|
10
11
|
/** 静默登录 */
|
package/dist/utils/auth.js
CHANGED
|
@@ -1 +1,199 @@
|
|
|
1
|
-
|
|
1
|
+
import { config } from "./config.js";
|
|
2
|
+
import { db } from "./db.js";
|
|
3
|
+
import { authApi } from "../api/auth/index.js";
|
|
4
|
+
class Auth {
|
|
5
|
+
/** 登录检查 */
|
|
6
|
+
loginOnlyAC() {
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
if (this.checkLogin()) {
|
|
9
|
+
resolve(true);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
this.silentLogin().then((res) => {
|
|
13
|
+
if (res.status) {
|
|
14
|
+
resolve(true);
|
|
15
|
+
} else {
|
|
16
|
+
reject(false);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/** 登录检查并跳转登录 */
|
|
22
|
+
loginAC(backurl, tabbar, loginurl = "/pages/auth/login/index") {
|
|
23
|
+
return new Promise((resolve, reject) => {
|
|
24
|
+
if (this.checkLogin()) {
|
|
25
|
+
resolve(true);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
this.silentLogin().then((res) => {
|
|
29
|
+
if (res.status) {
|
|
30
|
+
resolve(true);
|
|
31
|
+
} else {
|
|
32
|
+
reject(false);
|
|
33
|
+
let toUrl = loginurl + "?tabbar=" + (tabbar ? "true" : "false");
|
|
34
|
+
toUrl += "&backurl=" + backurl;
|
|
35
|
+
wx.navigateTo({
|
|
36
|
+
url: toUrl
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/** 检查登录是否有效? */
|
|
43
|
+
checkLogin() {
|
|
44
|
+
if (db.getToken() && !db.isTokenExpire()) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
// 判断是否存在有效用户.
|
|
50
|
+
async hasUser() {
|
|
51
|
+
const isLoggedIn = auth.checkLogin();
|
|
52
|
+
if (!isLoggedIn) {
|
|
53
|
+
return auth.silentLogin().then((res) => {
|
|
54
|
+
console.log("静默登录--------", res);
|
|
55
|
+
if (!res.status) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
59
|
+
}).catch((err) => {
|
|
60
|
+
console.error("Silent login failed:", err);
|
|
61
|
+
return false;
|
|
62
|
+
});
|
|
63
|
+
} else {
|
|
64
|
+
return Promise.resolve(true);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// 检查角色
|
|
68
|
+
checkRole(role) {
|
|
69
|
+
const roleCodes = db.getRoleCodes();
|
|
70
|
+
return roleCodes.length > 0 && roleCodes.indexOf(role) !== -1;
|
|
71
|
+
}
|
|
72
|
+
/** 静默登录 */
|
|
73
|
+
silentLogin() {
|
|
74
|
+
return new Promise((resolve, reject) => {
|
|
75
|
+
try {
|
|
76
|
+
wx.login({
|
|
77
|
+
success: (res) => {
|
|
78
|
+
if (res.code) {
|
|
79
|
+
authApi.miniappLogin({
|
|
80
|
+
loginCode: res.code,
|
|
81
|
+
appId: config.appId,
|
|
82
|
+
componentAppid: config.componentAppid
|
|
83
|
+
}).then((response) => {
|
|
84
|
+
if (response.code === 200 && response.data.status === true) {
|
|
85
|
+
db.loginStorage(response.data);
|
|
86
|
+
console.log("login success");
|
|
87
|
+
this.getUserInfo(false);
|
|
88
|
+
this.getRolePerm(false).then(() => {
|
|
89
|
+
resolve(response.data);
|
|
90
|
+
});
|
|
91
|
+
} else if (response.code === 200) {
|
|
92
|
+
resolve(response.data);
|
|
93
|
+
} else {
|
|
94
|
+
reject(response.message);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
fail: (fail) => {
|
|
100
|
+
console.log("登录失败2", fail.errMsg);
|
|
101
|
+
reject(fail.errMsg);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.log("silentLogin静默登录抛出异常");
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
// 手机号code 注册登录
|
|
110
|
+
phoneCodeLogin(phoneCode, nickName = "") {
|
|
111
|
+
return new Promise((resolve, reject) => {
|
|
112
|
+
wx.login({
|
|
113
|
+
success: (res) => {
|
|
114
|
+
if (res.code) {
|
|
115
|
+
authApi.miniappPhoneNumber({
|
|
116
|
+
phoneCode,
|
|
117
|
+
loginCode: res.code,
|
|
118
|
+
appId: config.appId,
|
|
119
|
+
nickName,
|
|
120
|
+
componentAppid: config.componentAppid
|
|
121
|
+
}).then(
|
|
122
|
+
(resp) => {
|
|
123
|
+
console.log("phoneCodeLogin-res", resp);
|
|
124
|
+
if (resp.code === 200 && resp.data.status === true) {
|
|
125
|
+
db.loginStorage(resp.data);
|
|
126
|
+
console.log("login success");
|
|
127
|
+
this.getRolePerm().then(() => {
|
|
128
|
+
resolve(resp.data);
|
|
129
|
+
});
|
|
130
|
+
} else {
|
|
131
|
+
reject(resp.message);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
fail: (fail) => {
|
|
138
|
+
console.log("登录失败3", fail.errMsg);
|
|
139
|
+
reject(fail.errMsg);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
// 获取角色
|
|
145
|
+
getRolePerm(cache = true) {
|
|
146
|
+
return new Promise((resolve, reject) => {
|
|
147
|
+
let rolesPerms = { roleCodes: db.getRoleCodes(), permCodes: db.getPermCodes() };
|
|
148
|
+
if (cache && (Object.keys(rolesPerms.roleCodes).length > 0 || Object.keys(rolesPerms.permCodes).length > 0)) {
|
|
149
|
+
resolve(rolesPerms);
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
authApi.userRolesPerms().then((response) => {
|
|
153
|
+
db.rolesPermsStorage(response.data);
|
|
154
|
+
resolve(response.data);
|
|
155
|
+
}).catch(() => {
|
|
156
|
+
reject("获取角色权限错误!");
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
// 获取用户信息
|
|
161
|
+
getUserInfo(cache = true) {
|
|
162
|
+
return new Promise((resolve, reject) => {
|
|
163
|
+
let userInfo = db.getUserInfo();
|
|
164
|
+
if (cache && Object.keys(userInfo).length > 0) {
|
|
165
|
+
resolve(userInfo);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
authApi.userInfo().then((resp) => {
|
|
169
|
+
db.userInfoStorage(resp.data);
|
|
170
|
+
resolve(resp.data);
|
|
171
|
+
}).catch(() => {
|
|
172
|
+
reject("获取角色权限错误!");
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
// 刷新Token.
|
|
177
|
+
refreshToken() {
|
|
178
|
+
return new Promise((resolve, reject) => {
|
|
179
|
+
authApi.refreshToken({
|
|
180
|
+
tenant: config.tenant,
|
|
181
|
+
refreshToken: db.getRefreshToken(),
|
|
182
|
+
clientId: config.appId
|
|
183
|
+
}).then((response) => {
|
|
184
|
+
db.tokenStorage(response.data);
|
|
185
|
+
resolve(true);
|
|
186
|
+
}).catch((error) => {
|
|
187
|
+
reject(error);
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
// 登出
|
|
192
|
+
loginOut() {
|
|
193
|
+
db.clearStorage();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
const auth = new Auth();
|
|
197
|
+
export {
|
|
198
|
+
auth
|
|
199
|
+
};
|
package/dist/utils/common.d.ts
CHANGED
|
@@ -24,3 +24,19 @@ export declare function kbToMb(kb: number, decimalPlaces?: number): number;
|
|
|
24
24
|
* @returns 返回 ISO 格式字符串 (如 "2023-01-01T00:00:00.000Z")
|
|
25
25
|
*/
|
|
26
26
|
export declare function convertToISOString(dateString: string): string;
|
|
27
|
+
export declare const getHeight: () => {
|
|
28
|
+
navigationPaddingHeight: number;
|
|
29
|
+
topHeight: number;
|
|
30
|
+
bottomHeight: number;
|
|
31
|
+
MenuButtonRight: number;
|
|
32
|
+
MenuButtonLeft: number;
|
|
33
|
+
MenuButtonTop: number;
|
|
34
|
+
MenuButtonBottom: number;
|
|
35
|
+
MenuButtonWidth: number;
|
|
36
|
+
MenuButtonHeight: number;
|
|
37
|
+
MenuButtonBounding: number;
|
|
38
|
+
screenWidth: number;
|
|
39
|
+
screenHeight: number;
|
|
40
|
+
computeHeightFn: (height: number, stackingHeight: number) => number;
|
|
41
|
+
addition: (height: number, addHeight: number) => number;
|
|
42
|
+
};
|
package/dist/utils/common.js
CHANGED
|
@@ -1 +1,112 @@
|
|
|
1
|
-
|
|
1
|
+
function validateRules(value, message, rules) {
|
|
2
|
+
if (value && !rules.test(value)) {
|
|
3
|
+
wx.showToast({
|
|
4
|
+
title: message,
|
|
5
|
+
icon: "none",
|
|
6
|
+
duration: 2e3
|
|
7
|
+
});
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
function validateRequired(value, message) {
|
|
13
|
+
console.log(value, message);
|
|
14
|
+
if (!value || value.trim() == "") {
|
|
15
|
+
wx.showToast({
|
|
16
|
+
title: message,
|
|
17
|
+
icon: "none",
|
|
18
|
+
duration: 2e3
|
|
19
|
+
});
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
const formatDateTime = (dateTimeString, format) => {
|
|
25
|
+
var date = new Date(dateTimeString);
|
|
26
|
+
if (isNaN(date.getTime())) {
|
|
27
|
+
return "";
|
|
28
|
+
}
|
|
29
|
+
var year = date.getFullYear();
|
|
30
|
+
var month = ("0" + (date.getMonth() + 1)).slice(-2);
|
|
31
|
+
var day = ("0" + date.getDate()).slice(-2);
|
|
32
|
+
var hours = ("0" + date.getHours()).slice(-2);
|
|
33
|
+
var minutes = ("0" + date.getMinutes()).slice(-2);
|
|
34
|
+
var seconds = ("0" + date.getSeconds()).slice(-2);
|
|
35
|
+
if (format === "YYYY-MM-DD HH:mm:ss") {
|
|
36
|
+
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
|
37
|
+
}
|
|
38
|
+
if (format === "YYYY-MM-DD HH:mm") {
|
|
39
|
+
return year + "-" + month + "-" + day + " " + hours + ":" + minutes;
|
|
40
|
+
}
|
|
41
|
+
if (format === "YYYY-MM-DD") {
|
|
42
|
+
return year + "-" + month + "-" + day;
|
|
43
|
+
}
|
|
44
|
+
return "";
|
|
45
|
+
};
|
|
46
|
+
function kbToMb(kb, decimalPlaces = 2) {
|
|
47
|
+
return parseFloat((kb / 1024 / 1024).toFixed(decimalPlaces));
|
|
48
|
+
}
|
|
49
|
+
function convertToISOString(dateString) {
|
|
50
|
+
const date = new Date(dateString);
|
|
51
|
+
return date.toISOString();
|
|
52
|
+
}
|
|
53
|
+
const getHeight = () => {
|
|
54
|
+
let navigationPaddingHeight = 0;
|
|
55
|
+
let topHeight = 0;
|
|
56
|
+
let bottomHeight = 0;
|
|
57
|
+
let MenuButtonRight = 0;
|
|
58
|
+
let MenuButtonLeft = 0;
|
|
59
|
+
let MenuButtonTop = 0;
|
|
60
|
+
let MenuButtonBottom = 0;
|
|
61
|
+
let MenuButtonWidth = 0;
|
|
62
|
+
let MenuButtonHeight = 0;
|
|
63
|
+
let MenuButtonBounding = 0;
|
|
64
|
+
let screenWidth = 0;
|
|
65
|
+
let screenHeight = 0;
|
|
66
|
+
try {
|
|
67
|
+
MenuButtonHeight = wx.getMenuButtonBoundingClientRect().height ? wx.getMenuButtonBoundingClientRect().height : 0;
|
|
68
|
+
navigationPaddingHeight = wx.getWindowInfo().statusBarHeight + 7 ? wx.getWindowInfo().statusBarHeight + 7 : 0;
|
|
69
|
+
topHeight = MenuButtonHeight + navigationPaddingHeight;
|
|
70
|
+
bottomHeight = wx.getWindowInfo().screenHeight - wx.getWindowInfo().safeArea.bottom ? wx.getWindowInfo().screenHeight - wx.getWindowInfo().safeArea.bottom : 0;
|
|
71
|
+
MenuButtonRight = wx.getMenuButtonBoundingClientRect().right;
|
|
72
|
+
MenuButtonLeft = wx.getMenuButtonBoundingClientRect().left;
|
|
73
|
+
MenuButtonTop = wx.getMenuButtonBoundingClientRect().top;
|
|
74
|
+
MenuButtonBottom = wx.getMenuButtonBoundingClientRect().bottom;
|
|
75
|
+
MenuButtonWidth = wx.getMenuButtonBoundingClientRect().width;
|
|
76
|
+
MenuButtonBounding = wx.getWindowInfo().statusBarHeight;
|
|
77
|
+
screenWidth = wx.getWindowInfo().screenWidth;
|
|
78
|
+
screenHeight = wx.getWindowInfo().screenHeight;
|
|
79
|
+
} catch (error) {
|
|
80
|
+
console.log("getHeight", error);
|
|
81
|
+
}
|
|
82
|
+
function computeHeightFn(height, stackingHeight) {
|
|
83
|
+
return height !== 0 ? height : height + stackingHeight;
|
|
84
|
+
}
|
|
85
|
+
function addition(height, addHeight) {
|
|
86
|
+
return height + addHeight;
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
navigationPaddingHeight,
|
|
90
|
+
topHeight,
|
|
91
|
+
bottomHeight,
|
|
92
|
+
MenuButtonRight,
|
|
93
|
+
MenuButtonLeft,
|
|
94
|
+
MenuButtonTop,
|
|
95
|
+
MenuButtonBottom,
|
|
96
|
+
MenuButtonWidth,
|
|
97
|
+
MenuButtonHeight,
|
|
98
|
+
MenuButtonBounding,
|
|
99
|
+
screenWidth,
|
|
100
|
+
screenHeight,
|
|
101
|
+
computeHeightFn,
|
|
102
|
+
addition
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
export {
|
|
106
|
+
convertToISOString,
|
|
107
|
+
formatDateTime,
|
|
108
|
+
getHeight,
|
|
109
|
+
kbToMb,
|
|
110
|
+
validateRequired,
|
|
111
|
+
validateRules
|
|
112
|
+
};
|
package/dist/utils/config.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
interface BaseConfig {
|
|
2
|
+
name: string;
|
|
2
3
|
baseUrl: string;
|
|
3
4
|
resourceUrl: string;
|
|
4
5
|
appId: string;
|
|
@@ -7,4 +8,5 @@ interface BaseConfig {
|
|
|
7
8
|
siteId: string;
|
|
8
9
|
}
|
|
9
10
|
declare const config: BaseConfig;
|
|
10
|
-
export { config };
|
|
11
|
+
export { config, BaseConfig };
|
|
12
|
+
export declare const initconfig: (appConfig: BaseConfig) => void;
|
package/dist/utils/config.js
CHANGED
|
@@ -1 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
const https = "https://";
|
|
2
|
+
const host = "gh.sooyie.cn";
|
|
3
|
+
const agentUrl = "/v1/file/path/wxapp";
|
|
4
|
+
const config = {
|
|
5
|
+
name: "Jmash框架",
|
|
6
|
+
baseUrl: https + host,
|
|
7
|
+
// 接口域名
|
|
8
|
+
resourceUrl: https + host + agentUrl,
|
|
9
|
+
// 资源域名
|
|
10
|
+
// 测试版本
|
|
11
|
+
appId: wx.getAccountInfoSync().miniProgram.appId,
|
|
12
|
+
// 小程序appid 查看详情里面id wxf201f46341e0adf6
|
|
13
|
+
tenant: "xyvcard",
|
|
14
|
+
// 登录租户
|
|
15
|
+
componentAppid: "wxe1b784ea80c01f40",
|
|
16
|
+
// 测试版·微信第三方平台,ext.json extAppid
|
|
17
|
+
// componentAppid: "wx8a77494240acd868", // 正式版·微信第三方平台,ext.json extAppid
|
|
18
|
+
siteId: "552416fb-5dc8-46b8-8a35-bc26b1a09be1"
|
|
19
|
+
// 站点id
|
|
20
|
+
};
|
|
21
|
+
const initconfig = (appConfig) => {
|
|
22
|
+
Object.assign(config, appConfig);
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
config,
|
|
26
|
+
initconfig
|
|
27
|
+
};
|