xctc-utils 1.1.9 → 1.2.0

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.
@@ -93,7 +93,12 @@ function weixinLogin(code) {
93
93
  return weixinCode();
94
94
  }
95
95
  var data = res === null || res === void 0 ? void 0 : res.data;
96
- (0, index_1.useSessionStorage)("weixinLoginstatus", "success");
96
+ if (data instanceof Object) {
97
+ (0, index_1.useSessionStorage)("weixinLoginData", JSON.stringify(data));
98
+ }
99
+ else {
100
+ (0, index_1.useSessionStorage)("weixinLoginStatus", "\u5FAE\u4FE1\u767B\u5F55\u5931\u8D25\uFF1A".concat(res.code, "\uFF1B").concat(res.msg));
101
+ }
97
102
  for (var key in data) {
98
103
  var item = data[key];
99
104
  if (item instanceof Object) {
@@ -102,8 +107,10 @@ function weixinLogin(code) {
102
107
  (0, index_1.useSessionStorage)(key, item);
103
108
  }
104
109
  var url = loc.origin;
110
+ var hashVal = loc.hash;
105
111
  var state = (0, index_1.getSessionStorage)(stateKey);
106
112
  var str = "";
113
+ (0, index_1.useSessionStorage)("getWeixinSessionState", state);
107
114
  if (state) {
108
115
  var stateObj = (0, index_1.getSessionStorage)("".concat(stateKey, "Obj"));
109
116
  for (var key in stateObj) {
@@ -127,6 +134,7 @@ function weixinLogin(code) {
127
134
  loc.replace(url);
128
135
  }
129
136
  else {
137
+ url = "".concat(url, "/").concat(hashVal);
130
138
  loc.replace(url);
131
139
  }
132
140
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xctc-utils",
3
- "version": "1.1.9",
3
+ "version": "1.2.0",
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",