xctc-utils 1.2.1 → 1.2.2

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.
@@ -6,6 +6,7 @@ interface configOption {
6
6
  stateKey?: string;
7
7
  cryptoiv?: string;
8
8
  cryptokey?: string;
9
+ isPassLogin?: boolean;
9
10
  }
10
11
  export declare function weixinUrlCode(config: configOption): void;
11
12
  interface ShareConfig {
@@ -105,18 +105,25 @@ function weixinLogin(code) {
105
105
  if (!http)
106
106
  return;
107
107
  (0, index_1.useSessionStorage)("weixinLoginParams", JSON.stringify(obj));
108
+ if (weixinConfig === null || weixinConfig === void 0 ? void 0 : weixinConfig.isPassLogin)
109
+ return;
108
110
  weixinConfig.http(obj).then(function (res) {
109
111
  if (res.code == 40163) {
110
112
  // 未登录则先执行登录
111
113
  return weixinCode();
112
114
  }
113
115
  var data = res === null || res === void 0 ? void 0 : res.data;
114
- if (data instanceof Object) {
115
- (0, index_1.useSessionStorage)("weixinLoginData", JSON.stringify(data));
116
- }
117
- else {
118
- (0, index_1.useSessionStorage)("weixinLoginStatus", "\u5FAE\u4FE1\u767B\u5F55\u5931\u8D25\uFF1A".concat(res.code, "\uFF1B").concat(res.msg));
119
- }
116
+ // if( data instanceof Object ){
117
+ // useSessionStorage( "weixinLoginData" , JSON.stringify(data) )
118
+ // }else{
119
+ // useSessionStorage( "weixinLoginStatus" , `微信登录失败:${res.code};${res.msg}` )
120
+ // }
121
+ var resobj = {
122
+ code: res.code,
123
+ msg: res.msg,
124
+ data: res.data
125
+ };
126
+ (0, index_1.useSessionStorage)("weixinLoginData", JSON.stringify(resobj));
120
127
  for (var key in data) {
121
128
  var item = data[key];
122
129
  if (item instanceof Object) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xctc-utils",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
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",