ecinc-cloud-mappaio 9.7.7 → 9.7.9

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.
@@ -1027,28 +1027,27 @@ var actions = {
1027
1027
  state = _ref5.state;
1028
1028
  return new Promise( /*#__PURE__*/function () {
1029
1029
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
1030
- var jwtToken, loginUser;
1030
+ var jwtToken, tokenChanged, loginUser;
1031
1031
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1032
1032
  while (1) switch (_context3.prev = _context3.next) {
1033
1033
  case 0:
1034
- jwtToken = inJwtToken || window.$auth.getToken();
1035
- if (!((!state.loginUser.userId || !state.productCodeAll || inJwtToken) && jwtToken)) {
1036
- _context3.next = 10;
1034
+ jwtToken = inJwtToken || window.$auth.getToken(); // 检测令牌是否被外部更新(如 WebView 通过 cookie 传入新 token)
1035
+ tokenChanged = jwtToken && state.token && jwtToken !== state.token;
1036
+ if (!((!state.loginUser.userId || !state.productCodeAll || inJwtToken || tokenChanged) && jwtToken)) {
1037
+ _context3.next = 11;
1037
1038
  break;
1038
1039
  }
1039
- _context3.next = 4;
1040
+ _context3.next = 5;
1040
1041
  return window.$user.getLoginUser(jwtToken);
1041
- case 4:
1042
+ case 5:
1042
1043
  loginUser = _context3.sent;
1043
1044
  commit('SET_TOKEN', window.$auth.getToken());
1044
1045
  commit('SET_LOGIN_USER', loginUser);
1045
1046
  window.$user.findUserRolePermissions().then(function (response) {
1046
1047
  if (response.code === 'success') {
1047
1048
  var data = response.body;
1048
- if (!window.$auth.getToken() !== inJwtToken && inJwtToken) {
1049
- window.$auth.setProductCode(data['PRODUCT_CODE_LIST'], loginUser.sysCode);
1050
- window.$auth.setToken(jwtToken);
1051
- }
1049
+ window.$auth.setProductCode(data['PRODUCT_CODE_LIST'], loginUser.sysCode);
1050
+ window.$auth.setToken(jwtToken);
1052
1051
  window.$auth.setTicket(data[window.ecwebTicket || 'ecweb-ticket']);
1053
1052
  window.$auth.setCsrfToken(data['ecweb-csrf-token']);
1054
1053
  commit('SET_ROLES', data['ROLE_CODE_LIST']);
@@ -1071,11 +1070,11 @@ var actions = {
1071
1070
  }).catch(function (error) {
1072
1071
  resolve(error);
1073
1072
  });
1074
- _context3.next = 11;
1073
+ _context3.next = 12;
1075
1074
  break;
1076
- case 10:
1077
- resolve(true);
1078
1075
  case 11:
1076
+ resolve(true);
1077
+ case 12:
1079
1078
  case "end":
1080
1079
  return _context3.stop();
1081
1080
  }
@@ -1037,28 +1037,27 @@ var actions = {
1037
1037
  state = _ref5.state;
1038
1038
  return new Promise( /*#__PURE__*/function () {
1039
1039
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
1040
- var jwtToken, loginUser;
1040
+ var jwtToken, tokenChanged, loginUser;
1041
1041
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1042
1042
  while (1) switch (_context3.prev = _context3.next) {
1043
1043
  case 0:
1044
- jwtToken = inJwtToken || window.$auth.getToken();
1045
- if (!((!state.loginUser.userId || !state.productCodeAll || inJwtToken) && jwtToken)) {
1046
- _context3.next = 10;
1044
+ jwtToken = inJwtToken || window.$auth.getToken(); // 检测令牌是否被外部更新(如 WebView 通过 cookie 传入新 token)
1045
+ tokenChanged = jwtToken && state.token && jwtToken !== state.token;
1046
+ if (!((!state.loginUser.userId || !state.productCodeAll || inJwtToken || tokenChanged) && jwtToken)) {
1047
+ _context3.next = 11;
1047
1048
  break;
1048
1049
  }
1049
- _context3.next = 4;
1050
+ _context3.next = 5;
1050
1051
  return window.$user.getLoginUser(jwtToken);
1051
- case 4:
1052
+ case 5:
1052
1053
  loginUser = _context3.sent;
1053
1054
  commit('SET_TOKEN', window.$auth.getToken());
1054
1055
  commit('SET_LOGIN_USER', loginUser);
1055
1056
  window.$user.findUserRolePermissions().then(function (response) {
1056
1057
  if (response.code === 'success') {
1057
1058
  var data = response.body;
1058
- if (!window.$auth.getToken() !== inJwtToken && inJwtToken) {
1059
- window.$auth.setProductCode(data['PRODUCT_CODE_LIST'], loginUser.sysCode);
1060
- window.$auth.setToken(jwtToken);
1061
- }
1059
+ window.$auth.setProductCode(data['PRODUCT_CODE_LIST'], loginUser.sysCode);
1060
+ window.$auth.setToken(jwtToken);
1062
1061
  window.$auth.setTicket(data[window.ecwebTicket || 'ecweb-ticket']);
1063
1062
  window.$auth.setCsrfToken(data['ecweb-csrf-token']);
1064
1063
  commit('SET_ROLES', data['ROLE_CODE_LIST']);
@@ -1081,11 +1080,11 @@ var actions = {
1081
1080
  }).catch(function (error) {
1082
1081
  resolve(error);
1083
1082
  });
1084
- _context3.next = 11;
1083
+ _context3.next = 12;
1085
1084
  break;
1086
- case 10:
1087
- resolve(true);
1088
1085
  case 11:
1086
+ resolve(true);
1087
+ case 12:
1089
1088
  case "end":
1090
1089
  return _context3.stop();
1091
1090
  }