xyvcard-wechat-auth 0.0.1 → 0.0.2
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 +10 -2
- package/dist/index.js +23 -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
package/dist/utils/request.js
CHANGED
|
@@ -1 +1,86 @@
|
|
|
1
|
-
|
|
1
|
+
import { config } from "./config.js";
|
|
2
|
+
import { db } from "./db.js";
|
|
3
|
+
import { auth } from "./auth.js";
|
|
4
|
+
let isRefreshing = false;
|
|
5
|
+
let refreshPromise = null;
|
|
6
|
+
const request = async (options = {}, tenant = "") => {
|
|
7
|
+
if (db.isTokenExpire()) {
|
|
8
|
+
if (!isRefreshing) {
|
|
9
|
+
isRefreshing = true;
|
|
10
|
+
if (!refreshPromise) {
|
|
11
|
+
refreshPromise = new Promise((resolve, reject) => {
|
|
12
|
+
auth.refreshToken().then(() => resolve(true)).catch((err) => {
|
|
13
|
+
wx.clearStorage();
|
|
14
|
+
reject(err);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
await refreshPromise;
|
|
19
|
+
isRefreshing = false;
|
|
20
|
+
} else {
|
|
21
|
+
await refreshPromise;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
let header = {
|
|
26
|
+
"content-type": "application/json",
|
|
27
|
+
"Authorization": db.getBearerToken(),
|
|
28
|
+
"Grpc-Metadata-Tenant": tenant
|
|
29
|
+
};
|
|
30
|
+
const response = await sendRequest(options, header);
|
|
31
|
+
return response;
|
|
32
|
+
} catch (error) {
|
|
33
|
+
return Promise.reject(error);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const sendRequest = (options, header) => {
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
wx.request({
|
|
39
|
+
url: config.baseUrl + options.url,
|
|
40
|
+
method: options.method,
|
|
41
|
+
data: options.data,
|
|
42
|
+
header,
|
|
43
|
+
responseType: options.responseType ? "text" : options.responseType,
|
|
44
|
+
success(response) {
|
|
45
|
+
if (response.statusCode === 200) {
|
|
46
|
+
resolve({
|
|
47
|
+
code: response.statusCode,
|
|
48
|
+
message: response.errMsg,
|
|
49
|
+
data: response.data
|
|
50
|
+
});
|
|
51
|
+
} else if (response.statusCode === 401) {
|
|
52
|
+
console.log("token过期....");
|
|
53
|
+
wx.clearStorage();
|
|
54
|
+
} else {
|
|
55
|
+
resolve({
|
|
56
|
+
code: response.statusCode,
|
|
57
|
+
message: response.errMsg,
|
|
58
|
+
data: response.data
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
fail(error) {
|
|
63
|
+
reject(error);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
function clearEmpty(params) {
|
|
69
|
+
for (const key in params) {
|
|
70
|
+
if (typeof params[key] === "object") {
|
|
71
|
+
clearEmpty(params[key]);
|
|
72
|
+
}
|
|
73
|
+
if (typeof params[key] === "object" && Object.keys(params[key]).length === 0) {
|
|
74
|
+
delete params[key];
|
|
75
|
+
}
|
|
76
|
+
if (params[key] === "") {
|
|
77
|
+
delete params[key];
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return params;
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
clearEmpty,
|
|
84
|
+
request,
|
|
85
|
+
sendRequest
|
|
86
|
+
};
|
package/dist/utils/util.d.ts
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 格式化日期时间字符串,格式化后的日期时间字符串2024-05-16
|
|
3
|
+
* @param dateTimeString 转换前的字符串2024-05-16T00:00:00.000Z
|
|
4
|
+
* @param format 转换格式
|
|
5
|
+
*/
|
|
6
|
+
export declare const formatDateTime: (dateTimeString: string, format?: any) => string;
|
|
1
7
|
export declare const formatTime: (date: Date) => string;
|
|
8
|
+
export declare function splitOrganTenant(organ: any): any;
|
|
9
|
+
export declare function splitVcardTenant(vcard: any): any;
|
|
10
|
+
export declare function splitVcardTenantReturn(vcardId: string, vcardTenant: string): string;
|
package/dist/utils/util.js
CHANGED
|
@@ -1 +1,88 @@
|
|
|
1
|
-
|
|
1
|
+
const formatDateTime = (dateTimeString, format) => {
|
|
2
|
+
var date = new Date(dateTimeString);
|
|
3
|
+
var year = date.getFullYear();
|
|
4
|
+
var month = ("0" + (date.getMonth() + 1)).slice(-2);
|
|
5
|
+
var day = ("0" + date.getDate()).slice(-2);
|
|
6
|
+
var hours = ("0" + date.getHours()).slice(-2);
|
|
7
|
+
var minutes = ("0" + date.getMinutes()).slice(-2);
|
|
8
|
+
var seconds = ("0" + date.getSeconds()).slice(-2);
|
|
9
|
+
if (format === "YYYY-MM-DD HH:mm:ss") {
|
|
10
|
+
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
|
11
|
+
}
|
|
12
|
+
if (format === "YYYY-MM-DD HH:mm") {
|
|
13
|
+
return year + "-" + month + "-" + day + " " + hours + ":" + minutes;
|
|
14
|
+
}
|
|
15
|
+
if (format === "YYYY-MM-DD") {
|
|
16
|
+
return year + "-" + month + "-" + day;
|
|
17
|
+
}
|
|
18
|
+
if (format === "YYYY-MM") {
|
|
19
|
+
return year + "-" + month;
|
|
20
|
+
}
|
|
21
|
+
if (format === "YYYY年MM月DD日") {
|
|
22
|
+
return year + "年" + month + "月" + day + "日";
|
|
23
|
+
}
|
|
24
|
+
if (format === "YYYY年MM月DD日 HH:mm") {
|
|
25
|
+
return year + "年" + month + "月" + day + "日 " + hours + ":" + minutes;
|
|
26
|
+
}
|
|
27
|
+
if (format === "YYYY年MM月DD日 HH:mm:ss") {
|
|
28
|
+
return year + "年" + month + "月" + day + "日 " + hours + ":" + minutes + ":" + seconds;
|
|
29
|
+
}
|
|
30
|
+
if (format === "YYYY年MM月DD日 HH时mm分") {
|
|
31
|
+
return year + "年" + month + "月" + day + "日 " + hours + "时" + minutes + "分";
|
|
32
|
+
}
|
|
33
|
+
if (format === "MM.DD") {
|
|
34
|
+
return month + "." + day;
|
|
35
|
+
}
|
|
36
|
+
if (format === "MM/DD") {
|
|
37
|
+
return month + "/" + day;
|
|
38
|
+
}
|
|
39
|
+
if (format === "MM月DD日") {
|
|
40
|
+
return month + "月" + day + "日";
|
|
41
|
+
}
|
|
42
|
+
if (format === "MM月DD日 HH:mm") {
|
|
43
|
+
return month + "月" + day + "日 " + hours + ":" + minutes;
|
|
44
|
+
}
|
|
45
|
+
return "";
|
|
46
|
+
};
|
|
47
|
+
const formatTime = (date) => {
|
|
48
|
+
const year = date.getFullYear();
|
|
49
|
+
const month = date.getMonth() + 1;
|
|
50
|
+
const day = date.getDate();
|
|
51
|
+
const hour = date.getHours();
|
|
52
|
+
const minute = date.getMinutes();
|
|
53
|
+
const second = date.getSeconds();
|
|
54
|
+
return [year, month, day].map(formatNumber).join("/") + " " + [hour, minute, second].map(formatNumber).join(":");
|
|
55
|
+
};
|
|
56
|
+
const formatNumber = (n) => {
|
|
57
|
+
const s = n.toString();
|
|
58
|
+
return s[1] ? s : "0" + s;
|
|
59
|
+
};
|
|
60
|
+
function splitOrganTenant(organ) {
|
|
61
|
+
let tenant = organ.organTenant;
|
|
62
|
+
if (organ.orgId) {
|
|
63
|
+
tenant = organ.organTenant.split("@")[1];
|
|
64
|
+
}
|
|
65
|
+
return tenant;
|
|
66
|
+
}
|
|
67
|
+
function splitVcardTenant(vcard) {
|
|
68
|
+
let tenant = vcard.organTenant;
|
|
69
|
+
if (vcard.orgId) {
|
|
70
|
+
tenant = vcard.organTenant.split("@")[1];
|
|
71
|
+
}
|
|
72
|
+
return tenant;
|
|
73
|
+
}
|
|
74
|
+
function splitVcardTenantReturn(vcardId, vcardTenant) {
|
|
75
|
+
const isOrganVcard = (vcardTenant == null ? void 0 : vcardTenant.indexOf("@e")) > -1 ? true : false;
|
|
76
|
+
console.log("是否是组织名片", isOrganVcard);
|
|
77
|
+
if (isOrganVcard) {
|
|
78
|
+
vcardTenant = vcardId.split("@")[1] ? vcardId.split("@")[1] : vcardTenant;
|
|
79
|
+
}
|
|
80
|
+
return vcardTenant;
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
formatDateTime,
|
|
84
|
+
formatTime,
|
|
85
|
+
splitOrganTenant,
|
|
86
|
+
splitVcardTenant,
|
|
87
|
+
splitVcardTenantReturn
|
|
88
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xyvcard-wechat-auth",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
"author": "",
|
|
10
10
|
"license": "",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"miniprogram-api-typings": "^4.0
|
|
12
|
+
"miniprogram-api-typings": "^4.1.0",
|
|
13
|
+
"@vant/weapp": "^1.11.7"
|
|
13
14
|
},
|
|
14
15
|
"devDependencies": {
|
|
15
|
-
"xyvcard-
|
|
16
|
+
"xyvcard-wechat-build": "^0.0.2",
|
|
16
17
|
"typescript": "^5.8.3"
|
|
17
18
|
},
|
|
18
19
|
"scripts": {
|
|
Binary file
|
package/dist/app.d.ts
DELETED
|
File without changes
|
package/dist/app.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";App({globalData:{},onLaunch(){(wx.getStorageSync("logs")||[]).unshift(Date.now()),wx.login({success:e=>{}})}}),"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
|
package/dist/app.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"pages": [
|
|
3
|
-
"pages/index/index"
|
|
4
|
-
],
|
|
5
|
-
"window": {
|
|
6
|
-
"navigationBarTextStyle": "black",
|
|
7
|
-
"navigationBarTitleText": "",
|
|
8
|
-
"navigationBarBackgroundColor": "#fff"
|
|
9
|
-
},
|
|
10
|
-
"style": "v2",
|
|
11
|
-
"rendererOptions": {
|
|
12
|
-
"skyline": {
|
|
13
|
-
"defaultDisplayBlock": true,
|
|
14
|
-
"defaultContentBox": true,
|
|
15
|
-
"tagNameStyleIsolation": "legacy",
|
|
16
|
-
"disableABTest": true,
|
|
17
|
-
"sdkVersionBegin": "3.0.0",
|
|
18
|
-
"sdkVersionEnd": "15.255.255"
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
"componentFramework": "glass-easel",
|
|
22
|
-
"sitemapLocation": "sitemap.json",
|
|
23
|
-
"lazyCodeLoading": "requiredComponents"
|
|
24
|
-
}
|
package/dist/app.wxss
DELETED
|
File without changes
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Page({data:{},onLoad(){},onReady(){},onShow(){},onHide(){},onUnload(){},onPullDownRefresh(){},onReachBottom(){},onShareAppMessage(){}}),"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(o){exports[o]=module.exports[o]});
|
|
File without changes
|