xctc-utils 1.6.13 → 1.6.14

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.
@@ -304,8 +304,21 @@ var defaultOpenTagList = [
304
304
  "wx-open-subscribe", "wx-open-launch-app", "wx-open-launch-weapp",
305
305
  "wx-open-audio"
306
306
  ];
307
+ var isContinue = function () {
308
+ var localCodeData = (0, index_1.getSessionStorage)("urlParamsData") || "";
309
+ if (localCodeData && localCodeData.hasOwnProperty("code")) {
310
+ return true;
311
+ }
312
+ else {
313
+ return false;
314
+ }
315
+ };
307
316
  function configReady(config) {
308
317
  var _a;
318
+ if (!isContinue()) {
319
+ console.error("还未执行微信登录流程");
320
+ return;
321
+ }
309
322
  var _b = config || {}, appId = _b.appId, url = _b.url, _c = _b.urlKey, urlKey = _c === void 0 ? "url" : _c, _d = _b.appIdKey, appIdKey = _d === void 0 ? "appId" : _d, cb = _b.cb, _e = _b.jsApiList, jsApiList = _e === void 0 ? [] : _e, _f = _b.openTagList, openTagList = _f === void 0 ? [] : _f, _g = _b.http, http = _g === void 0 ? "" : _g;
310
323
  if (!http)
311
324
  return;
@@ -327,7 +340,6 @@ function configReady(config) {
327
340
  }
328
341
  config.http(param).then(function (res) {
329
342
  if (res) {
330
- (0, index_1.useSessionStorage)("configReady-res", res);
331
343
  var data = {};
332
344
  if (res === null || res === void 0 ? void 0 : res.hasOwnProperty("data")) {
333
345
  data = res.data;
@@ -339,7 +351,6 @@ function configReady(config) {
339
351
  var newKey = key.toLowerCase();
340
352
  data[newKey] = data[key];
341
353
  }
342
- (0, index_1.useSessionStorage)("configReady-data", data);
343
354
  if (!(data === null || data === void 0 ? void 0 : data.appid)) {
344
355
  console.error("后端响应的data数据中缺乏appid或者appId或者AppId字段!");
345
356
  return;
@@ -353,7 +364,6 @@ function configReady(config) {
353
364
  nonceStr: data === null || data === void 0 ? void 0 : data.noncestr,
354
365
  signature: data === null || data === void 0 ? void 0 : data.signature, //必填,生成的签名
355
366
  };
356
- (0, index_1.useSessionStorage)("configReady-obj", obj);
357
367
  var wx = initSdk();
358
368
  wx.config(obj);
359
369
  wx.ready(function (res) {
@@ -370,6 +380,10 @@ function configReady(config) {
370
380
  }
371
381
  exports.configReady = configReady;
372
382
  function shareReady(options) {
383
+ if (!isContinue()) {
384
+ console.error("还未执行微信登录流程");
385
+ return;
386
+ }
373
387
  var title = "微信分享标题";
374
388
  if (options['title'])
375
389
  title = options.title;
@@ -432,6 +446,10 @@ function shareReady(options) {
432
446
  }
433
447
  exports.shareReady = shareReady;
434
448
  function onlinePay(config) {
449
+ if (!isContinue()) {
450
+ console.error("还未执行微信登录流程");
451
+ return;
452
+ }
435
453
  var wx = initSdk();
436
454
  // let { timeStamp,signType,prepay_id,paySign,package,nonceStr,appId } = params
437
455
  var cb = "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xctc-utils",
3
- "version": "1.6.13",
3
+ "version": "1.6.14",
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",