xctc-utils 1.6.4 → 1.6.6

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/README.md CHANGED
@@ -25,15 +25,15 @@ all:boolean 为true时删除调用方法的所有缓存,否则只删除当前
25
25
  删除永久缓存: useUtils.removeLocalStorage(key,all)
26
26
  ```
27
27
 
28
- ### 地址栏参数处理
28
+ ### 地址栏参数处理
29
29
  #### 设置参数
30
30
  ```
31
31
  interface SetOptions {
32
32
  url:string, // 完整的 url 地址
33
33
  data:string, // 具体需要拼接在地址参数
34
34
  keyword:string, // 地址栏参数 key 值
35
- key:string, // 参数加密 key
36
- iv:string // 参数加密 iv
35
+ key?:string, // 参数加密 key
36
+ iv?:string // 参数加密 iv
37
37
  }
38
38
  useUtils.params.set( options:SetOptions )
39
39
  ```
@@ -43,8 +43,8 @@ interface GetOptions {
43
43
  keys:string[],
44
44
  cache?:string, // 是否需要缓存地址栏数据: 不传或传空,则不做处理,session 临时缓存 local永久缓存
45
45
  cacheKey?:string, // 缓存数据的键 默认值 urlParamsData
46
- key:string, // 参数加密 key
47
- iv:string // 参数加密 iv
46
+ key?:string, // 参数解密 key 必须与设置参数 key 一致
47
+ iv?:string // 参数解密 iv 必须与设置参数 iv 一致
48
48
  }
49
49
  useUtils.params.get( options:GetOptions )
50
50
  ```
@@ -2,8 +2,8 @@ interface SetOptions {
2
2
  url: string;
3
3
  data: string;
4
4
  keyword: string;
5
- key: string;
6
- iv: string;
5
+ key?: string;
6
+ iv?: string;
7
7
  }
8
8
  export declare const set: (options: SetOptions) => string | undefined;
9
9
  /**
@@ -123,7 +123,7 @@ function login(code) {
123
123
  (0, index_1.useSessionStorage)("loginParams", JSON.stringify(obj));
124
124
  // 调试字段 isPassLogin ,为true 时不继续执行微信登录,前端可拿到 code 给后端测试
125
125
  // if(weixinConfig['isPassLogin']) return
126
- weixinConfig.http(obj).then(function (res) {
126
+ weixinConfig === null || weixinConfig === void 0 ? void 0 : weixinConfig.http(obj).then(function (res) {
127
127
  var _a;
128
128
  (0, index_1.useSessionStorage)("loginRes", res);
129
129
  if (res.code == 40163) {
@@ -229,7 +229,8 @@ function envSDK() {
229
229
  exports.envSDK = envSDK;
230
230
  // 前往微信授权登录页面
231
231
  function getCode(appId, scope) {
232
- params.get({ keys: ['code', 'state'], cache: "session" });
232
+ var _a = weixinConfig.cryptoiv, cryptoiv = _a === void 0 ? defaultIv : _a, _b = weixinConfig.cryptokey, cryptokey = _b === void 0 ? defaultKey : _b;
233
+ params.get({ keys: ['code', 'state'], cache: "session", key: cryptokey, iv: cryptoiv });
233
234
  if ((0, utils_1.weixinBrowser)()) {
234
235
  var id = "";
235
236
  if (weixinConfig['appId']) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xctc-utils",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
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",