xctc-utils 1.6.9 → 1.6.11

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.
@@ -152,7 +152,14 @@ function login(code) {
152
152
  weixinConfig === null || weixinConfig === void 0 ? void 0 : weixinConfig.http(obj).then(function (res) {
153
153
  var _a;
154
154
  (0, index_1.useSessionStorage)("loginRes", res);
155
- if (res.code == 40163) {
155
+ var code = -1;
156
+ if (res === null || res === void 0 ? void 0 : res.hasOwnProperty("code")) {
157
+ code = res.code;
158
+ }
159
+ if (res === null || res === void 0 ? void 0 : res.hasOwnProperty("Code")) {
160
+ code = res.Code;
161
+ }
162
+ if (code == 40163) {
156
163
  // 未登录则先执行登录
157
164
  return getCode();
158
165
  }
@@ -319,7 +326,7 @@ function configReady(config) {
319
326
  openTagListData = openTagList;
320
327
  }
321
328
  config.http(param).then(function (res) {
322
- if (res.code == 0) {
329
+ if (res) {
323
330
  var data = {};
324
331
  if (res === null || res === void 0 ? void 0 : res.hasOwnProperty("data")) {
325
332
  data = res.data;
@@ -331,11 +338,15 @@ function configReady(config) {
331
338
  var newKey = key.toLowerCase();
332
339
  data[newKey] = data[key];
333
340
  }
341
+ if (!(data === null || data === void 0 ? void 0 : data.appid)) {
342
+ console.error("后端响应的data数据中缺乏appid或者appId或者AppId字段!");
343
+ return;
344
+ }
334
345
  var obj = {
335
346
  jsApiList: jsApiListData,
336
347
  openTagList: openTagListData,
337
348
  debug: false,
338
- appId: data === null || data === void 0 ? void 0 : data.appId,
349
+ appId: data === null || data === void 0 ? void 0 : data.appid,
339
350
  timestamp: data === null || data === void 0 ? void 0 : data.timestamp,
340
351
  nonceStr: data === null || data === void 0 ? void 0 : data.noncestr,
341
352
  signature: data === null || data === void 0 ? void 0 : data.signature, //必填,生成的签名
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xctc-utils",
3
- "version": "1.6.9",
3
+ "version": "1.6.11",
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",