@smart100/spu-web-plugin 1.0.25-beta.3 → 1.0.25-beta.5

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.
@@ -1,4 +1,4 @@
1
- var version = "1.0.25-beta.3";
1
+ var version = "1.0.25-beta.5";
2
2
 
3
3
  /** Detect free variable `global` from Node.js. */
4
4
  var freeGlobal$2 = typeof global == 'object' && global && global.Object === Object && global;
@@ -16839,7 +16839,7 @@ function singleLogin(_x3) {
16839
16839
  }
16840
16840
  function _singleLogin() {
16841
16841
  _singleLogin = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee8(query) {
16842
- var flag, token, refreshtoken, tokenexpires, envname, context, setBaseInfo, isneedlogin, loginRole, refreshTokenUser, tokenUser, nowEnvname, envData;
16842
+ var flag, token, refreshtoken, tokenexpires, envname, context, setBaseInfo, isneedlogin, loginRole, curUser, cacheUser, refreshTokenUser, tokenUser, nowEnvname, envData;
16843
16843
  return _regeneratorRuntime$1().wrap(function _callee8$(_context8) {
16844
16844
  while (1) switch (_context8.prev = _context8.next) {
16845
16845
  case 0:
@@ -16858,7 +16858,9 @@ function _singleLogin() {
16858
16858
  }
16859
16859
  };
16860
16860
  query = cloneDeep$1(query);
16861
- if (!globalOptions.isfixapptokenexpired) {
16861
+ // App SPUWebview 内用 Native-Api 获取token 而不是从 url 上取
16862
+ // 暂时只在 门户引擎 中启用 等门户引擎验证通过之后 再改成所有 SPU 默认
16863
+ if (!(globalOptions.isfixapptokenexpired && globalOptions.modulekey === 'portalEngine')) {
16862
16864
  _context8.next = 6;
16863
16865
  break;
16864
16866
  }
@@ -16874,141 +16876,153 @@ function _singleLogin() {
16874
16876
  envname = query.envname;
16875
16877
  context = query.context;
16876
16878
  if (!checkLoginByToken(token)) {
16877
- _context8.next = 65;
16879
+ _context8.next = 67;
16878
16880
  break;
16879
16881
  }
16880
16882
  isneedlogin = true; // 是否需要走单点登录流程
16881
16883
  loginRole = getRoleByToken(token);
16882
- if (loginRole === 'center') {
16883
- // 如果本地已经登录 query 登录参数与本地一致 说明是刚登录没多久【token也没刷新过】 视为已经登录 不需再走单点登录流程
16884
- // 之所以不强制校验 refreshtoken tokenexpires 是因为安装卸载配置页面有可能放在产品运营中心 没有这两字段
16885
- if (checkLogin() && token === getToken()) {
16886
- isneedlogin = false;
16887
- }
16888
- } else {
16889
- // 如果本地已经登录 且 query 登录参数与本地一致 说明是刚登录没多久【token也没刷新过】 视为已经登录 不需再走单点登录流程
16890
- if (checkLogin() && token === getToken() && refreshtoken === getRefreshToken() && tokenexpires === getTokenExpires()) {
16891
- isneedlogin = false;
16884
+ curUser = getUserByToken(token);
16885
+ cacheUser = getUserByToken(getToken()); // 如果本地已经登录
16886
+ if (checkLogin()) {
16887
+ // 产品运营中心单点登录只有 token
16888
+ if (loginRole === 'center') {
16889
+ if ((curUser === null || curUser === void 0 ? void 0 : curUser.userCode) === (cacheUser === null || cacheUser === void 0 ? void 0 : cacheUser.userCode) && (curUser === null || curUser === void 0 ? void 0 : curUser.appId) === (cacheUser === null || cacheUser === void 0 ? void 0 : cacheUser.appId)) {
16890
+ isneedlogin = false;
16891
+ }
16892
+ } else {
16893
+ // 不重复走单点登录的逻辑
16894
+ // 旧:判断当前单点登录的 token/refreshtoken/tokenexpires 是否与本地缓存的一致
16895
+ // 新:解析当前单点登录 token 中的 mbcode、tenantcode,如果与缓存的一致,说明本次登录与上次登录是同个人同个租户
16896
+ // 新逻辑暂时只用于超表
16897
+ if (globalOptions.modulekey === 'litheformspu' && globalOptions.isoptimizesingleloginlogic) {
16898
+ if ((curUser === null || curUser === void 0 ? void 0 : curUser.memberCode) === (cacheUser === null || cacheUser === void 0 ? void 0 : cacheUser.memberCode) && (curUser === null || curUser === void 0 ? void 0 : curUser.tenantCode) === (cacheUser === null || cacheUser === void 0 ? void 0 : cacheUser.tenantCode)) {
16899
+ isneedlogin = false;
16900
+ }
16901
+ } else {
16902
+ if (token === getToken() && refreshtoken === getRefreshToken() && tokenexpires === getTokenExpires()) {
16903
+ isneedlogin = false;
16904
+ }
16905
+ }
16892
16906
  }
16893
16907
  }
16894
16908
  // isneedlogin = true
16895
16909
  // debugger
16896
16910
  if (!isneedlogin) {
16897
- _context8.next = 62;
16911
+ _context8.next = 64;
16898
16912
  break;
16899
16913
  }
16900
16914
  setBaseInfo();
16901
16915
  // 单点登录写入 token 之后
16902
- _context8.prev = 18;
16916
+ _context8.prev = 20;
16903
16917
  if (!checkLogin()) {
16904
- _context8.next = 25;
16918
+ _context8.next = 27;
16905
16919
  break;
16906
16920
  }
16907
16921
  refreshTokenUser = getUserByToken(getRefreshToken());
16908
16922
  tokenUser = getUserByToken(getToken()); // 如果 refreshtoken 不完整【由于web端登录时 如果有选择租户或选择职位的情况 得到的 refreshtoken 是不完整】 则通过完整的 token 换取完整的 refreshtoken 如果不换的话 通过刷新 token 接口得到的 token 也变成不完整的了
16909
16923
  if (!(!(refreshTokenUser !== null && refreshTokenUser !== void 0 && refreshTokenUser.tokenId) && tokenUser !== null && tokenUser !== void 0 && tokenUser.tokenId)) {
16910
- _context8.next = 25;
16924
+ _context8.next = 27;
16911
16925
  break;
16912
16926
  }
16913
- _context8.next = 25;
16927
+ _context8.next = 27;
16914
16928
  return updateToken();
16915
- case 25:
16916
- _context8.next = 30;
16917
- break;
16918
16929
  case 27:
16919
- _context8.prev = 27;
16920
- _context8.t0 = _context8["catch"](18);
16921
- console.error(_context8.t0);
16922
- case 30:
16923
16930
  _context8.next = 32;
16924
- return getEnvname();
16931
+ break;
16932
+ case 29:
16933
+ _context8.prev = 29;
16934
+ _context8.t0 = _context8["catch"](20);
16935
+ console.error(_context8.t0);
16925
16936
  case 32:
16937
+ _context8.next = 34;
16938
+ return getEnvname();
16939
+ case 34:
16926
16940
  nowEnvname = _context8.sent;
16927
16941
  if (!nowEnvname) {
16928
- _context8.next = 53;
16942
+ _context8.next = 55;
16929
16943
  break;
16930
16944
  }
16931
- _context8.next = 36;
16945
+ _context8.next = 38;
16932
16946
  return requestEnvdata(nowEnvname);
16933
- case 36:
16947
+ case 38:
16934
16948
  envData = _context8.sent;
16935
16949
  if (!envData) {
16936
- _context8.next = 49;
16950
+ _context8.next = 51;
16937
16951
  break;
16938
16952
  }
16939
16953
  saveEnvdata(envData);
16940
16954
  if (!envData.tenantcode) {
16941
- _context8.next = 45;
16955
+ _context8.next = 47;
16942
16956
  break;
16943
16957
  }
16944
16958
  setTecode(envData.tenantcode);
16945
16959
  // 租户配置
16946
- _context8.next = 43;
16960
+ _context8.next = 45;
16947
16961
  return tenantSetting.requestAndSetTenantSetting(envData.tenantcode);
16948
- case 43:
16949
- _context8.next = 47;
16950
- break;
16951
16962
  case 45:
16963
+ _context8.next = 49;
16964
+ break;
16965
+ case 47:
16952
16966
  tenantSetting.removeTenantSetting();
16953
16967
  removeTecode();
16954
- case 47:
16955
- _context8.next = 51;
16956
- break;
16957
16968
  case 49:
16969
+ _context8.next = 53;
16970
+ break;
16971
+ case 51:
16958
16972
  removeEnvdata();
16959
16973
  removeTecode();
16960
- case 51:
16961
- _context8.next = 55;
16962
- break;
16963
16974
  case 53:
16975
+ _context8.next = 57;
16976
+ break;
16977
+ case 55:
16964
16978
  removeEnvdata();
16965
16979
  removeTecode();
16966
- case 55:
16967
- _context8.next = 57;
16968
- return getAndSetTenant();
16969
16980
  case 57:
16970
16981
  _context8.next = 59;
16971
- return getAndSetUserInfo();
16982
+ return getAndSetTenant();
16972
16983
  case 59:
16984
+ _context8.next = 61;
16985
+ return getAndSetUserInfo();
16986
+ case 61:
16973
16987
  flag = true;
16974
- _context8.next = 63;
16988
+ _context8.next = 65;
16975
16989
  break;
16976
- case 62:
16990
+ case 64:
16977
16991
  flag = true;
16978
- case 63:
16979
- _context8.next = 68;
16980
- break;
16981
16992
  case 65:
16993
+ _context8.next = 70;
16994
+ break;
16995
+ case 67:
16982
16996
  flag = false;
16983
16997
  setBaseInfo(); // 传递的token过期依然写入 如果不写入的话 有可能之前的token本来没过期 页面依然可用
16984
- console.error('单点登录失败,请检查链接所传 token/refreshtoken/tokenexpires 是否非法或过期。');
16985
- case 68:
16998
+ console.error('单点登录失败,请检查链接所传 token/refreshtoken/tokenexpires/envname 是否非法或过期。');
16999
+ case 70:
16986
17000
  if (!flag) {
16987
- _context8.next = 77;
17001
+ _context8.next = 79;
16988
17002
  break;
16989
17003
  }
16990
17004
  // 启动刷新token机制
16991
17005
  startRefreshtoken();
16992
17006
  // 获取spu 信息
16993
- _context8.next = 72;
17007
+ _context8.next = 74;
16994
17008
  return core$1.initGetData();
16995
- case 72:
17009
+ case 74:
16996
17010
  // 删除 query 中相关参数
16997
17011
  token && delete query.token;
16998
17012
  refreshtoken && delete query.refreshtoken;
16999
17013
  tokenexpires && delete query.tokenexpires;
17000
17014
  envname && delete query.envname;
17001
17015
  context && delete query.context;
17002
- case 77:
17016
+ case 79:
17003
17017
  return _context8.abrupt("return", {
17004
17018
  flag: flag,
17005
17019
  query: query
17006
17020
  });
17007
- case 78:
17021
+ case 80:
17008
17022
  case "end":
17009
17023
  return _context8.stop();
17010
17024
  }
17011
- }, _callee8, null, [[18, 27]]);
17025
+ }, _callee8, null, [[20, 29]]);
17012
17026
  }));
17013
17027
  return _singleLogin.apply(this, arguments);
17014
17028
  }
@@ -17779,7 +17793,8 @@ var getLocationByNative = /*#__PURE__*/function () {
17779
17793
  district: res.district || '',
17780
17794
  street: res.street || '',
17781
17795
  number: res.number || '',
17782
- detailaddr: res.detailaddr || ''
17796
+ detailaddr: res.detailaddr || '',
17797
+ citycode: res.citycode || ''
17783
17798
  // poiid: res.poiid || '',
17784
17799
  // poitypename: res.poitypename || '',
17785
17800
  // poitypecode: res.poitypecode || '',
@@ -17888,6 +17903,7 @@ var getLocationByAMap = /*#__PURE__*/function () {
17888
17903
  address: '',
17889
17904
  // poiname: '',
17890
17905
  regionid: '',
17906
+ citycode: '',
17891
17907
  country: '',
17892
17908
  province: '',
17893
17909
  city: '',
@@ -17910,12 +17926,13 @@ var getLocationByAMap = /*#__PURE__*/function () {
17910
17926
  if (addrssDetail) {
17911
17927
  result.address = addrssDetail.addressDetail.address;
17912
17928
  // result.poiname = addrssDetail.addressDetail.poiname
17913
- result.regionid = addrssDetail.addressDetail.regionid;
17914
- result.country = addrssDetail.addressDetail.country;
17915
- result.province = addrssDetail.addressDetail.province;
17916
- result.city = addrssDetail.addressDetail.city;
17917
- result.district = addrssDetail.addressDetail.district;
17918
- result.street = addrssDetail.addressDetail.street;
17929
+ result.regionid = addrssDetail.addressDetail.regionid || '';
17930
+ result.citycode = addrssDetail.addressDetail.citycode || '';
17931
+ result.country = addrssDetail.addressDetail.country || '';
17932
+ result.province = addrssDetail.addressDetail.province || '';
17933
+ result.city = addrssDetail.addressDetail.city || '';
17934
+ result.district = addrssDetail.addressDetail.district || '';
17935
+ result.street = addrssDetail.addressDetail.street || '';
17919
17936
  result.number = addrssDetail.addressDetail.number;
17920
17937
  result.detailaddr = addrssDetail.addressDetail.detailaddr;
17921
17938
  // result.poiid = addrssDetail.addressDetail.poiid
@@ -17977,6 +17994,7 @@ var getCityLocationByAMap = /*#__PURE__*/function () {
17977
17994
  address: '',
17978
17995
  // poiname: '',
17979
17996
  regionid: '',
17997
+ citycode: '',
17980
17998
  country: '',
17981
17999
  province: '',
17982
18000
  city: '',
@@ -18001,12 +18019,13 @@ var getCityLocationByAMap = /*#__PURE__*/function () {
18001
18019
  if (addrssDetail) {
18002
18020
  result.address = addrssDetail.addressDetail.address;
18003
18021
  // result.poiname = addrssDetail.addressDetail.poiname
18004
- result.regionid = addrssDetail.addressDetail.regionid;
18005
- result.country = addrssDetail.addressDetail.country;
18006
- result.province = addrssDetail.addressDetail.province;
18007
- result.city = addrssDetail.addressDetail.city;
18008
- result.district = addrssDetail.addressDetail.district;
18009
- result.street = addrssDetail.addressDetail.street;
18022
+ result.regionid = addrssDetail.addressDetail.regionid || '';
18023
+ result.citycode = addrssDetail.addressDetail.citycode || '';
18024
+ result.country = addrssDetail.addressDetail.country || '';
18025
+ result.province = addrssDetail.addressDetail.province || '';
18026
+ result.city = addrssDetail.addressDetail.city || '';
18027
+ result.district = addrssDetail.addressDetail.district || '';
18028
+ result.street = addrssDetail.addressDetail.street || '';
18010
18029
  result.number = addrssDetail.addressDetail.number;
18011
18030
  result.detailaddr = addrssDetail.addressDetail.detailaddr;
18012
18031
  // result.poiid = addrssDetail.addressDetail.poiid
@@ -18145,6 +18164,7 @@ var getAddressDetailByAMap = /*#__PURE__*/function () {
18145
18164
  address: address || '',
18146
18165
  // poiname: poiname || '',
18147
18166
  regionid: addressComponent.adcode || '',
18167
+ citycode: addressComponent.citycode || '',
18148
18168
  country: country || '',
18149
18169
  province: addressComponent.province || '',
18150
18170
  city: addressComponent.city || '',
@@ -52474,7 +52494,7 @@ var getUrl = /*#__PURE__*/function () {
52474
52494
  copeStr = provider !== null && provider !== void 0 && provider.isAliyun ? getAliyunCope(cope) : getCope(cope);
52475
52495
  contentType = getContentType(suffix);
52476
52496
  if (!(provider !== null && provider !== void 0 && provider.isAliyun)) {
52477
- _context.next = 26;
52497
+ _context.next = 25;
52478
52498
  break;
52479
52499
  }
52480
52500
  ossClient = new AliClient({
@@ -52489,11 +52509,10 @@ var getUrl = /*#__PURE__*/function () {
52489
52509
  responseHeader = {
52490
52510
  // 'content-type': contentType || undefined,
52491
52511
  'content-disposition': 'attachment; filename=' + (filename && encodeURIComponent(filename)) // 阿里云提供的下载名字
52492
- };
52493
-
52494
- if (contentType) {
52495
- responseHeader['content-type'] = contentType;
52496
- }
52512
+ }; // TODO 阿里云不在提供,会报错
52513
+ // if (contentType) {
52514
+ // responseHeader['content-type'] = contentType
52515
+ // }
52497
52516
  ossUrl = ossClient.signatureUrl(objectKey, {
52498
52517
  response: responseHeader,
52499
52518
  process: copeStr
@@ -52503,9 +52522,9 @@ var getUrl = /*#__PURE__*/function () {
52503
52522
  // ossUrl = ossUrl.replace(paths[1] + '/' + paths[2], paths[1])
52504
52523
  // }
52505
52524
  return _context.abrupt("return", ossUrl);
52506
- case 26:
52525
+ case 25:
52507
52526
  if (!(provider !== null && provider !== void 0 && provider.isHuawei)) {
52508
- _context.next = 43;
52527
+ _context.next = 42;
52509
52528
  break;
52510
52529
  }
52511
52530
  obs = new ObsClient({
@@ -52517,7 +52536,7 @@ var getUrl = /*#__PURE__*/function () {
52517
52536
  if (objectKey && objectKey[0] === '/') {
52518
52537
  objectKey = objectKey.slice(1);
52519
52538
  }
52520
- _context.prev = 29;
52539
+ _context.prev = 28;
52521
52540
  Params = {
52522
52541
  // Method: 'get',
52523
52542
  Bucket: storageConfig.cloudserv_storage_storagebucket,
@@ -52537,17 +52556,17 @@ var getUrl = /*#__PURE__*/function () {
52537
52556
  // if (expires) setCacheUrl(cacheKey, signedUrl, +expires)
52538
52557
  // 华为云通过 createSignedUrlSync 生产的签名链接默认带有 :80 或者 :443 端口 后端删除时需要去除
52539
52558
  return _context.abrupt("return", signedUrl.replace(/:(80|443)/, ''));
52540
- case 37:
52541
- _context.prev = 37;
52542
- _context.t0 = _context["catch"](29);
52559
+ case 36:
52560
+ _context.prev = 36;
52561
+ _context.t0 = _context["catch"](28);
52543
52562
  console.error(_context.t0);
52544
52563
  throw Error(_context.t0);
52545
- case 41:
52546
- _context.next = 56;
52564
+ case 40:
52565
+ _context.next = 55;
52547
52566
  break;
52548
- case 43:
52567
+ case 42:
52549
52568
  if (!(provider !== null && provider !== void 0 && provider.isMinio)) {
52550
- _context.next = 55;
52569
+ _context.next = 54;
52551
52570
  break;
52552
52571
  }
52553
52572
  s3Params = {
@@ -52585,18 +52604,18 @@ var getUrl = /*#__PURE__*/function () {
52585
52604
  });
52586
52605
  });
52587
52606
  };
52588
- _context.next = 51;
52607
+ _context.next = 50;
52589
52608
  return getSignedUrlPro();
52590
- case 51:
52609
+ case 50:
52591
52610
  _signedUrl = _context.sent;
52592
52611
  return _context.abrupt("return", _signedUrl);
52593
- case 55:
52612
+ case 54:
52594
52613
  throw Error("\u6682\u4E0D\u652F\u6301".concat(provider === null || provider === void 0 ? void 0 : provider.name, "\u5B58\u50A8\u7C7B\u578B"));
52595
- case 56:
52614
+ case 55:
52596
52615
  case "end":
52597
52616
  return _context.stop();
52598
52617
  }
52599
- }, _callee, null, [[29, 37]]);
52618
+ }, _callee, null, [[28, 36]]);
52600
52619
  }));
52601
52620
  return function getUrl(_x) {
52602
52621
  return _ref2.apply(this, arguments);
@@ -70651,6 +70670,7 @@ var getDefaultGlobalOptions = function getDefaultGlobalOptions() {
70651
70670
  moduleversion: arr[2] || '',
70652
70671
  storageproxyprefix: '',
70653
70672
  isfixapptokenexpired: false,
70673
+ isoptimizesingleloginlogic: false,
70654
70674
  singleLoginCallback: null,
70655
70675
  router: null
70656
70676
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smart100/spu-web-plugin",
3
- "version": "1.0.25-beta.3",
3
+ "version": "1.0.25-beta.5",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "dev": "npm run build:types && rollup -c -w",
@@ -29,7 +29,6 @@
29
29
  "@rollup/plugin-node-resolve": "^15.2.3",
30
30
  "@rollup/plugin-terser": "^0.4.4",
31
31
  "@rollup/plugin-typescript": "^11.1.5",
32
- "@rollup/rollup-darwin-x64": "^4.53.3",
33
32
  "@types/crypto-js": "^4.2.2",
34
33
  "@types/lodash-es": "^4.17.10",
35
34
  "@types/node": "^20.8.10",
package/src/index.ts CHANGED
@@ -58,6 +58,7 @@ const getDefaultGlobalOptions = () => {
58
58
  moduleversion: arr[2] || '',
59
59
  storageproxyprefix: '',
60
60
  isfixapptokenexpired: false, // 是否修复apptoken过期问题 目前版本暂时不默认修复 等门户引擎验证通过之后 再改成默认修复
61
+ isoptimizesingleloginlogic: false, // 是否优化判断不重复走单点登录的逻辑 暂时只在超表上优化
61
62
  singleLoginCallback: null,
62
63
  router: null
63
64
  }
package/src/login.ts CHANGED
@@ -601,7 +601,9 @@ const fixAppTokenExpired = async () => {
601
601
  // 单点登录
602
602
  async function singleLogin(query: IAny) {
603
603
  query = cloneDeep(query)
604
- if (globalOptions.isfixapptokenexpired) {
604
+ // App SPUWebview 内用 Native-Api 获取token 而不是从 url 上取
605
+ // 暂时只在 门户引擎 中启用 等门户引擎验证通过之后 再改成所有 SPU 默认
606
+ if (globalOptions.isfixapptokenexpired && globalOptions.modulekey === 'portalEngine') {
605
607
  query = await fixLoginQuery(query)
606
608
  }
607
609
 
@@ -630,24 +632,33 @@ async function singleLogin(query: IAny) {
630
632
  if (checkLoginByToken(token)) {
631
633
  let isneedlogin = true // 是否需要走单点登录流程
632
634
  const loginRole = getRoleByToken(token)
633
-
634
- if (loginRole === 'center') {
635
- // 如果本地已经登录 且 query 登录参数与本地一致 说明是刚登录没多久【token也没刷新过】 视为已经登录 不需再走单点登录流程
636
- // 之所以不强制校验 refreshtoken tokenexpires 是因为安装卸载配置页面有可能放在产品运营中心 没有这两字段
637
- if (checkLogin() && token === getToken()) {
638
- isneedlogin = false
639
- }
640
- } else {
641
- // 如果本地已经登录 且 query 登录参数与本地一致 说明是刚登录没多久【token也没刷新过】 视为已经登录 不需再走单点登录流程
642
- if (
643
- checkLogin() &&
644
- token === getToken() &&
645
- refreshtoken === getRefreshToken() &&
646
- tokenexpires === getTokenExpires()
647
- ) {
648
- isneedlogin = false
635
+ const curUser = getUserByToken(token)
636
+ const cacheUser = getUserByToken(getToken())
637
+
638
+ // 如果本地已经登录
639
+ if (checkLogin()) {
640
+ // 产品运营中心单点登录只有 token
641
+ if (loginRole === 'center') {
642
+ if (curUser?.userCode === cacheUser?.userCode && curUser?.appId === cacheUser?.appId) {
643
+ isneedlogin = false
644
+ }
645
+ } else {
646
+ // 不重复走单点登录的逻辑
647
+ // 旧:判断当前单点登录的 token/refreshtoken/tokenexpires 是否与本地缓存的一致
648
+ // 新:解析当前单点登录 token 中的 mbcode、tenantcode,如果与缓存的一致,说明本次登录与上次登录是同个人同个租户
649
+ // 新逻辑暂时只用于超表
650
+ if (globalOptions.modulekey === 'litheformspu' && globalOptions.isoptimizesingleloginlogic) {
651
+ if (curUser?.memberCode === cacheUser?.memberCode && curUser?.tenantCode === cacheUser?.tenantCode) {
652
+ isneedlogin = false
653
+ }
654
+ } else {
655
+ if (token === getToken() && refreshtoken === getRefreshToken() && tokenexpires === getTokenExpires()) {
656
+ isneedlogin = false
657
+ }
658
+ }
649
659
  }
650
660
  }
661
+
651
662
  // isneedlogin = true
652
663
  // debugger
653
664
 
@@ -702,7 +713,7 @@ async function singleLogin(query: IAny) {
702
713
  } else {
703
714
  flag = false
704
715
  setBaseInfo() // 传递的token过期依然写入 如果不写入的话 有可能之前的token本来没过期 页面依然可用
705
- console.error('单点登录失败,请检查链接所传 token/refreshtoken/tokenexpires 是否非法或过期。')
716
+ console.error('单点登录失败,请检查链接所传 token/refreshtoken/tokenexpires/envname 是否非法或过期。')
706
717
  }
707
718
 
708
719
  // 单点登录成功
package/src/map/index.ts CHANGED
@@ -49,6 +49,7 @@ const getLocationByNative = async (): Promise<Location> => {
49
49
  street: res.street || '',
50
50
  number: res.number || '',
51
51
  detailaddr: res.detailaddr || '',
52
+ citycode: res.citycode || '',
52
53
  // poiid: res.poiid || '',
53
54
  // poitypename: res.poitypename || '',
54
55
  // poitypecode: res.poitypecode || '',
@@ -216,6 +217,7 @@ const getLocationByAMap = async (): Promise<Location> => {
216
217
  address: '',
217
218
  // poiname: '',
218
219
  regionid: '',
220
+ citycode: '',
219
221
  country: '',
220
222
  province: '',
221
223
  city: '',
@@ -238,12 +240,13 @@ const getLocationByAMap = async (): Promise<Location> => {
238
240
  if (addrssDetail) {
239
241
  result.address = addrssDetail.addressDetail.address
240
242
  // result.poiname = addrssDetail.addressDetail.poiname
241
- result.regionid = addrssDetail.addressDetail.regionid
242
- result.country = addrssDetail.addressDetail.country
243
- result.province = addrssDetail.addressDetail.province
244
- result.city = addrssDetail.addressDetail.city
245
- result.district = addrssDetail.addressDetail.district
246
- result.street = addrssDetail.addressDetail.street
243
+ result.regionid = addrssDetail.addressDetail.regionid || ''
244
+ result.citycode = addrssDetail.addressDetail.citycode || ''
245
+ result.country = addrssDetail.addressDetail.country || ''
246
+ result.province = addrssDetail.addressDetail.province || ''
247
+ result.city = addrssDetail.addressDetail.city || ''
248
+ result.district = addrssDetail.addressDetail.district || ''
249
+ result.street = addrssDetail.addressDetail.street || ''
247
250
  result.number = addrssDetail.addressDetail.number
248
251
  result.detailaddr = addrssDetail.addressDetail.detailaddr
249
252
  // result.poiid = addrssDetail.addressDetail.poiid
@@ -292,6 +295,7 @@ const getCityLocationByAMap = async (): Promise<Location> => {
292
295
  address: '',
293
296
  // poiname: '',
294
297
  regionid: '',
298
+ citycode: '',
295
299
  country: '',
296
300
  province: '',
297
301
  city: '',
@@ -316,12 +320,13 @@ const getCityLocationByAMap = async (): Promise<Location> => {
316
320
  if (addrssDetail) {
317
321
  result.address = addrssDetail.addressDetail.address
318
322
  // result.poiname = addrssDetail.addressDetail.poiname
319
- result.regionid = addrssDetail.addressDetail.regionid
320
- result.country = addrssDetail.addressDetail.country
321
- result.province = addrssDetail.addressDetail.province
322
- result.city = addrssDetail.addressDetail.city
323
- result.district = addrssDetail.addressDetail.district
324
- result.street = addrssDetail.addressDetail.street
323
+ result.regionid = addrssDetail.addressDetail.regionid || ''
324
+ result.citycode = addrssDetail.addressDetail.citycode || ''
325
+ result.country = addrssDetail.addressDetail.country || ''
326
+ result.province = addrssDetail.addressDetail.province || ''
327
+ result.city = addrssDetail.addressDetail.city || ''
328
+ result.district = addrssDetail.addressDetail.district || ''
329
+ result.street = addrssDetail.addressDetail.street || ''
325
330
  result.number = addrssDetail.addressDetail.number
326
331
  result.detailaddr = addrssDetail.addressDetail.detailaddr
327
332
  // result.poiid = addrssDetail.addressDetail.poiid
@@ -383,6 +388,7 @@ interface IAddressDetail {
383
388
  address: string
384
389
  // poiname: string
385
390
  regionid: string
391
+ citycode: string
386
392
  country: string
387
393
  province: string
388
394
  city: string
@@ -469,6 +475,7 @@ const getAddressDetailByAMap = async (position: Location): Promise<IAddressDetai
469
475
  address: address || '',
470
476
  // poiname: poiname || '',
471
477
  regionid: addressComponent.adcode || '',
478
+ citycode: addressComponent.citycode || '',
472
479
  country: country || '',
473
480
  province: addressComponent.province || '',
474
481
  city: addressComponent.city || '',
@@ -163,9 +163,10 @@ const getUrl = async ({
163
163
  // 'content-type': contentType || undefined,
164
164
  'content-disposition': 'attachment; filename=' + (filename && encodeURIComponent(filename)) // 阿里云提供的下载名字
165
165
  }
166
- if (contentType) {
167
- responseHeader['content-type'] = contentType
168
- }
166
+ // TODO 阿里云不在提供,会报错
167
+ // if (contentType) {
168
+ // responseHeader['content-type'] = contentType
169
+ // }
169
170
 
170
171
  const ossUrl = ossClient.signatureUrl(objectKey, {
171
172
  response: responseHeader,