xctc-utils 1.6.17 → 1.6.19
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.js +17 -5
- package/package.json +1 -1
package/dist/weixin/index.js
CHANGED
|
@@ -156,9 +156,13 @@ function login(code) {
|
|
|
156
156
|
if (res === null || res === void 0 ? void 0 : res.hasOwnProperty("code")) {
|
|
157
157
|
code = res.code;
|
|
158
158
|
}
|
|
159
|
-
if (res === null || res === void 0 ? void 0 : res.hasOwnProperty("Code")) {
|
|
159
|
+
else if (res === null || res === void 0 ? void 0 : res.hasOwnProperty("Code")) {
|
|
160
160
|
code = res.Code;
|
|
161
161
|
}
|
|
162
|
+
else {
|
|
163
|
+
console.error("http响应数据格式必须是:res:{code:xx,data:{}}");
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
162
166
|
if (code == 40163) {
|
|
163
167
|
// 未登录则先执行登录
|
|
164
168
|
return getCode();
|
|
@@ -167,9 +171,13 @@ function login(code) {
|
|
|
167
171
|
if (res === null || res === void 0 ? void 0 : res.hasOwnProperty("data")) {
|
|
168
172
|
data = res.data;
|
|
169
173
|
}
|
|
170
|
-
if (res === null || res === void 0 ? void 0 : res.hasOwnProperty("Data")) {
|
|
174
|
+
else if (res === null || res === void 0 ? void 0 : res.hasOwnProperty("Data")) {
|
|
171
175
|
data = res.Data;
|
|
172
176
|
}
|
|
177
|
+
else {
|
|
178
|
+
console.error("http响应数据格式必须是:res:{code:xx,data:{}}");
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
173
181
|
for (var key in data) {
|
|
174
182
|
var item = data[key];
|
|
175
183
|
if (item instanceof Object) {
|
|
@@ -349,9 +357,13 @@ function configReady(config) {
|
|
|
349
357
|
if (res === null || res === void 0 ? void 0 : res.hasOwnProperty("data")) {
|
|
350
358
|
data = res.data;
|
|
351
359
|
}
|
|
352
|
-
if (res === null || res === void 0 ? void 0 : res.hasOwnProperty("Data")) {
|
|
360
|
+
else if (res === null || res === void 0 ? void 0 : res.hasOwnProperty("Data")) {
|
|
353
361
|
data = res.Data;
|
|
354
362
|
}
|
|
363
|
+
else {
|
|
364
|
+
console.error("http响应数据格式必须是:res:{data:{appid:xx,timestamp:xx,noncestr:xx,signature:xx}}");
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
355
367
|
for (var key in data) {
|
|
356
368
|
var newKey = key.toLowerCase();
|
|
357
369
|
data[newKey] = data[key];
|
|
@@ -365,14 +377,14 @@ function configReady(config) {
|
|
|
365
377
|
openTagList: openTagListData,
|
|
366
378
|
debug: false,
|
|
367
379
|
appId: data === null || data === void 0 ? void 0 : data.appid,
|
|
368
|
-
timestamp:
|
|
380
|
+
timestamp: data === null || data === void 0 ? void 0 : data.timestamp,
|
|
369
381
|
nonceStr: data === null || data === void 0 ? void 0 : data.noncestr,
|
|
370
382
|
signature: data === null || data === void 0 ? void 0 : data.signature, //必填,生成的签名
|
|
371
383
|
};
|
|
372
384
|
var wx = initSdk();
|
|
373
385
|
wx.config(obj);
|
|
374
386
|
wx.ready(function (res) {
|
|
375
|
-
(0, index_1.useSessionStorage)("configReadySuccess",
|
|
387
|
+
(0, index_1.useSessionStorage)("configReadySuccess", "wx.ready");
|
|
376
388
|
if (config['cb'] && typeof config.cb === "function")
|
|
377
389
|
config.cb();
|
|
378
390
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xctc-utils",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.19",
|
|
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",
|