xctc-utils 1.6.46 → 1.6.47
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/dist/weixin/index.d.ts +3 -0
- package/dist/weixin/index.js +14 -5
- package/package.json +1 -1
package/dist/weixin/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ interface ShareConfig {
|
|
|
25
25
|
url?: string;
|
|
26
26
|
urlKey?: string;
|
|
27
27
|
appIdKey?: string;
|
|
28
|
+
dataType?: string;
|
|
28
29
|
}
|
|
29
30
|
export declare function configReady(config: ShareConfig): void;
|
|
30
31
|
interface ShareOptions {
|
|
@@ -37,6 +38,7 @@ interface ShareOptions {
|
|
|
37
38
|
key?: string;
|
|
38
39
|
shareUrl?: string;
|
|
39
40
|
dbug?: boolean;
|
|
41
|
+
dataType?: string;
|
|
40
42
|
}
|
|
41
43
|
export declare function shareReady(options: ShareOptions): void;
|
|
42
44
|
/**
|
|
@@ -51,6 +53,7 @@ interface ConfigPay {
|
|
|
51
53
|
signType: string;
|
|
52
54
|
paySign: string;
|
|
53
55
|
cb?: any;
|
|
56
|
+
dataType?: string;
|
|
54
57
|
}
|
|
55
58
|
export declare function onlinePay(config: ConfigPay): void;
|
|
56
59
|
export {};
|
package/dist/weixin/index.js
CHANGED
|
@@ -314,15 +314,24 @@ var defaultOpenTagList = [
|
|
|
314
314
|
"wx-open-subscribe", "wx-open-launch-app", "wx-open-launch-weapp",
|
|
315
315
|
"wx-open-audio"
|
|
316
316
|
];
|
|
317
|
-
var isContinue = function () {
|
|
317
|
+
var isContinue = function (dataType) {
|
|
318
318
|
var localCodeData = (0, index_1.getSessionStorage)("urlParamsData") || "";
|
|
319
|
+
var wxInfo = (0, index_1.getLocalStorage)("WxInfo") || "";
|
|
319
320
|
var search = loc.search; // ?code=0916SzFa1KH9TA0Ke7Ha1AQx6446SzFr&state=123
|
|
320
321
|
var codeIndex = -1;
|
|
321
322
|
if (search) {
|
|
322
323
|
codeIndex = search.indexOf("code=");
|
|
323
324
|
}
|
|
324
325
|
// 必须是已经存储微信授权 code ,并且链接中已无 code 字段,已完成刷新状态
|
|
325
|
-
if (
|
|
326
|
+
if (!dataType || dataType == "session") {
|
|
327
|
+
if (localCodeData && localCodeData.hasOwnProperty("code") && codeIndex == -1) {
|
|
328
|
+
return true;
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
else if (dataType == "local" && wxInfo && wxInfo['openid'] && codeIndex == -1) {
|
|
326
335
|
return true;
|
|
327
336
|
}
|
|
328
337
|
else {
|
|
@@ -331,7 +340,7 @@ var isContinue = function () {
|
|
|
331
340
|
};
|
|
332
341
|
function configReady(config) {
|
|
333
342
|
var _a;
|
|
334
|
-
if (!isContinue()) {
|
|
343
|
+
if (!isContinue(config === null || config === void 0 ? void 0 : config.dataType)) {
|
|
335
344
|
console.error("还未执行微信登录流程");
|
|
336
345
|
return;
|
|
337
346
|
}
|
|
@@ -399,7 +408,7 @@ function configReady(config) {
|
|
|
399
408
|
}
|
|
400
409
|
exports.configReady = configReady;
|
|
401
410
|
function shareReady(options) {
|
|
402
|
-
if (!isContinue()) {
|
|
411
|
+
if (!isContinue(options === null || options === void 0 ? void 0 : options.dataType)) {
|
|
403
412
|
console.error("还未执行微信登录流程");
|
|
404
413
|
return;
|
|
405
414
|
}
|
|
@@ -468,7 +477,7 @@ function shareReady(options) {
|
|
|
468
477
|
}
|
|
469
478
|
exports.shareReady = shareReady;
|
|
470
479
|
function onlinePay(config) {
|
|
471
|
-
if (!isContinue()) {
|
|
480
|
+
if (!isContinue(config === null || config === void 0 ? void 0 : config.dataType)) {
|
|
472
481
|
console.error("还未执行微信登录流程");
|
|
473
482
|
return;
|
|
474
483
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xctc-utils",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.47",
|
|
4
4
|
"description": "localStorage存储\r ```\r sessionStorage存储\r ```\r crypto-js加密、解密\r ```\r 微信授权登录、微信分享\r ```\r 设备环境获取\r ```\r 是否是微信浏览器\r ```\r 时间戳转时间,字符串转时间戳",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|