xctc-utils 1.6.14 → 1.6.16

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.
@@ -54,13 +54,13 @@ function getUrlCode(config) {
54
54
  weixinConfig['stateKey'] = stateKey;
55
55
  (0, index_1.useSessionStorage)("weixinConfig", weixinConfig);
56
56
  var _b = weixinConfig.cryptoiv, cryptoiv = _b === void 0 ? defaultIv : _b, _c = weixinConfig.cryptokey, cryptokey = _c === void 0 ? defaultKey : _c, _d = weixinConfig.debuggerStatus, debuggerStatus = _d === void 0 ? false : _d;
57
- var search = loc.search; // ?code=0916SzFa1KH9TA0Ke7Ha1AQx6446SzFr&state=123
58
57
  initSdk(); // 加载微信sdk环境
59
58
  // 默认第一次通过链接进入系统,没有code和state
60
59
  var codeIndex = -1;
61
60
  var stateIndex = -1;
62
61
  var msgStr = "";
63
62
  var isAuth = false; // 是否完成 code 授权
63
+ var search = loc.search; // ?code=0916SzFa1KH9TA0Ke7Ha1AQx6446SzFr&state=123
64
64
  if (search) {
65
65
  codeIndex = search.indexOf("code=");
66
66
  stateIndex = search.indexOf("state=");
@@ -306,7 +306,12 @@ var defaultOpenTagList = [
306
306
  ];
307
307
  var isContinue = function () {
308
308
  var localCodeData = (0, index_1.getSessionStorage)("urlParamsData") || "";
309
- if (localCodeData && localCodeData.hasOwnProperty("code")) {
309
+ var search = loc.search; // ?code=0916SzFa1KH9TA0Ke7Ha1AQx6446SzFr&state=123
310
+ var codeIndex = -1;
311
+ if (search) {
312
+ codeIndex = search.indexOf("code=");
313
+ }
314
+ if (localCodeData && localCodeData.hasOwnProperty("code") && codeIndex == -1) {
310
315
  return true;
311
316
  }
312
317
  else {
@@ -365,6 +370,7 @@ function configReady(config) {
365
370
  signature: data === null || data === void 0 ? void 0 : data.signature, //必填,生成的签名
366
371
  };
367
372
  var wx = initSdk();
373
+ (0, index_1.useSessionStorage)("wxconfigdata", obj);
368
374
  wx.config(obj);
369
375
  wx.ready(function (res) {
370
376
  console.log("加载微信分享配置完成:", res);
@@ -373,7 +379,7 @@ function configReady(config) {
373
379
  config.cb();
374
380
  });
375
381
  wx.error(function (err) {
376
- (0, index_1.useSessionStorage)("configReadyError", "\u52A0\u8F7D\u5FAE\u4FE1\u5206\u4EAB\u914D\u7F6E\u9519\u8BEF\uFF1A".concat(err));
382
+ (0, index_1.useSessionStorage)("configReadyError", err);
377
383
  });
378
384
  }
379
385
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xctc-utils",
3
- "version": "1.6.14",
3
+ "version": "1.6.16",
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",