ecinc-cloud-mappaio 9.7.6 → 9.7.8

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,33 +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
- try {
1049
- if (!window.$auth.getProductCode()) {
1050
- //app进入h5,不调用login
1051
- window.$auth.setProductCode(data['PRODUCT_CODE_LIST'], loginUser.sysCode);
1052
- window.$auth.setToken(jwtToken);
1053
- }
1054
- } catch (e) {
1055
- console.log(e);
1056
- }
1049
+ window.$auth.setProductCode(data['PRODUCT_CODE_LIST'], loginUser.sysCode);
1050
+ window.$auth.setToken(jwtToken);
1057
1051
  window.$auth.setTicket(data[window.ecwebTicket || 'ecweb-ticket']);
1058
1052
  window.$auth.setCsrfToken(data['ecweb-csrf-token']);
1059
1053
  commit('SET_ROLES', data['ROLE_CODE_LIST']);
@@ -1076,11 +1070,11 @@ var actions = {
1076
1070
  }).catch(function (error) {
1077
1071
  resolve(error);
1078
1072
  });
1079
- _context3.next = 11;
1073
+ _context3.next = 12;
1080
1074
  break;
1081
- case 10:
1082
- resolve(true);
1083
1075
  case 11:
1076
+ resolve(true);
1077
+ case 12:
1084
1078
  case "end":
1085
1079
  return _context3.stop();
1086
1080
  }
@@ -1167,15 +1161,10 @@ var actions = {
1167
1161
  window.$user.findUserRolePermissions().then(function (response) {
1168
1162
  if (response.code === 'success') {
1169
1163
  var data = response.body;
1170
- try {
1171
- if (!window.$auth.getProductCode()) {
1172
- //app进入h5,不调用login
1173
- window.$auth.setProductCode(data['PRODUCT_CODE_LIST'], loginUser.sysCode);
1174
- window.$auth.setToken(jwtToken);
1175
- }
1176
- } catch (e) {
1177
- console.log(e);
1178
- }
1164
+
1165
+ // 始终先设置产品代码和令牌,确保 setTicket 使用正确的闭包 productCode
1166
+ window.$auth.setProductCode(data['PRODUCT_CODE_LIST'], loginUser.sysCode);
1167
+ window.$auth.setToken(jwtToken);
1179
1168
  window.$auth.setTicket(data[window.ecwebTicket || 'ecweb-ticket']);
1180
1169
  window.$auth.setCsrfToken(data['ecweb-csrf-token']);
1181
1170
  commit('SET_ROLES', data['ROLE_CODE_LIST']);
@@ -54907,6 +54896,7 @@ var auth_install = function install(Vue) {
54907
54896
  },
54908
54897
  removeTicket: function removeTicket() {
54909
54898
  js_cookie_default().remove((window.ecwebTicket || 'ecweb-ticket') + port);
54899
+ js_cookie_default().remove((window.ecwebTicket || 'ecweb-ticket') + productCode);
54910
54900
  return sessionStorage.removeItem((window.ecwebTicket || 'ecweb-ticket') + productCode);
54911
54901
  },
54912
54902
  getToken: function getToken() {
@@ -1037,33 +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
- try {
1059
- if (!window.$auth.getProductCode()) {
1060
- //app进入h5,不调用login
1061
- window.$auth.setProductCode(data['PRODUCT_CODE_LIST'], loginUser.sysCode);
1062
- window.$auth.setToken(jwtToken);
1063
- }
1064
- } catch (e) {
1065
- console.log(e);
1066
- }
1059
+ window.$auth.setProductCode(data['PRODUCT_CODE_LIST'], loginUser.sysCode);
1060
+ window.$auth.setToken(jwtToken);
1067
1061
  window.$auth.setTicket(data[window.ecwebTicket || 'ecweb-ticket']);
1068
1062
  window.$auth.setCsrfToken(data['ecweb-csrf-token']);
1069
1063
  commit('SET_ROLES', data['ROLE_CODE_LIST']);
@@ -1086,11 +1080,11 @@ var actions = {
1086
1080
  }).catch(function (error) {
1087
1081
  resolve(error);
1088
1082
  });
1089
- _context3.next = 11;
1083
+ _context3.next = 12;
1090
1084
  break;
1091
- case 10:
1092
- resolve(true);
1093
1085
  case 11:
1086
+ resolve(true);
1087
+ case 12:
1094
1088
  case "end":
1095
1089
  return _context3.stop();
1096
1090
  }
@@ -1177,15 +1171,10 @@ var actions = {
1177
1171
  window.$user.findUserRolePermissions().then(function (response) {
1178
1172
  if (response.code === 'success') {
1179
1173
  var data = response.body;
1180
- try {
1181
- if (!window.$auth.getProductCode()) {
1182
- //app进入h5,不调用login
1183
- window.$auth.setProductCode(data['PRODUCT_CODE_LIST'], loginUser.sysCode);
1184
- window.$auth.setToken(jwtToken);
1185
- }
1186
- } catch (e) {
1187
- console.log(e);
1188
- }
1174
+
1175
+ // 始终先设置产品代码和令牌,确保 setTicket 使用正确的闭包 productCode
1176
+ window.$auth.setProductCode(data['PRODUCT_CODE_LIST'], loginUser.sysCode);
1177
+ window.$auth.setToken(jwtToken);
1189
1178
  window.$auth.setTicket(data[window.ecwebTicket || 'ecweb-ticket']);
1190
1179
  window.$auth.setCsrfToken(data['ecweb-csrf-token']);
1191
1180
  commit('SET_ROLES', data['ROLE_CODE_LIST']);
@@ -54917,6 +54906,7 @@ var auth_install = function install(Vue) {
54917
54906
  },
54918
54907
  removeTicket: function removeTicket() {
54919
54908
  js_cookie_default().remove((window.ecwebTicket || 'ecweb-ticket') + port);
54909
+ js_cookie_default().remove((window.ecwebTicket || 'ecweb-ticket') + productCode);
54920
54910
  return sessionStorage.removeItem((window.ecwebTicket || 'ecweb-ticket') + productCode);
54921
54911
  },
54922
54912
  getToken: function getToken() {