소스 검색

fix: 增加全局缓存站点

周玉环 4 일 전
부모
커밋
601c1bda2e
2개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 0
      xinkeaboard-seller/src/models/global.js
  2. 1 1
      xinkeaboard-seller/src/utils/utils.js

+ 1 - 0
xinkeaboard-seller/src/models/global.js

@@ -94,6 +94,7 @@ export default {
       };
     },
     setCurrentSite(state, { payload }) {
+      localStorage.setItem('currentSite', payload)
       return {
         ...state,
         currentSite: payload,

+ 1 - 1
xinkeaboard-seller/src/utils/utils.js

@@ -1379,7 +1379,7 @@ export function getSldStatYTitle() {
  * */
 export function sldComRequest(method, url, params, data_type = '') {
   const state = window.g_app._store.getState();
-  const currentSite = state.global.currentSite;
+  const currentSite = state.global.currentSite || localStorage.getItem('currentSite');
   const currentPath = state.routing.location.pathname;
   if (!currentPath.includes('/apply') && !currentPath.includes('/user/login')) {
     params = Object.assign({}, params ?? {}, { webSite: currentSite })