Commit 2565a35b by zhangleyuan

feat:解决合并代码后的冲突

parents 68364144 2c7387fc
/* /*
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2020-08-31 09:34:31 * @Date: 2020-08-31 09:34:31
* @LastEditors: wufan * @LastEditors: Please set LastEditors
* @LastEditTime: 2021-05-27 10:42:12 * @LastEditTime: 2021-06-23 10:22:39
* @Description: * @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有 * @Copyright: 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -100,6 +100,10 @@ class Axios { ...@@ -100,6 +100,10 @@ class Axios {
} else if (success || resultCode === 0) { } else if (success || resultCode === 0) {
return response; return response;
} else if (!options.reject) { } else if (!options.reject) {
// if(code === "NONE_STORE_USER"){
// window.RCHistory.replace('/login');
// return Promise.reject();
// }
message.error(ResMessage || resultMsg); message.error(ResMessage || resultMsg);
} }
return Promise.reject(response.data); return Promise.reject(response.data);
...@@ -125,6 +129,7 @@ class Axios { ...@@ -125,6 +129,7 @@ class Axios {
break; break;
default: default:
message.error(error.message); message.error(error.message);
console.log('222');
break; break;
} }
return Promise.reject(error.message); return Promise.reject(error.message);
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2020-08-31 09:34:25 * @Date: 2020-08-31 09:34:25
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @LastEditTime: 2021-05-12 17:27:08 * @LastEditTime: 2021-06-23 10:22:51
* @Description: * @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有 * @Copyright: 杭州杰竞科技有限公司 版权所有
*/ */
import Storage from './storage'; import Storage from './storage';
import { PREFIX, USER_PREFIX } from '@/domains/basic-domain/constants'; import { PREFIX, USER_PREFIX } from '@/domains/basic-domain/constants';
declare var window:any;
class User { class User {
getVersion() { getVersion() {
...@@ -21,7 +21,7 @@ class User { ...@@ -21,7 +21,7 @@ class User {
} }
getEnterpriseId() { getEnterpriseId() {
return Storage.get(`${PREFIX}_enterpriseId`); return window.currentStoreUserInfo.enterpriseId || Storage.get(`${PREFIX}_enterpriseId`);
} }
getStoreName() { getStoreName() {
...@@ -33,21 +33,23 @@ class User { ...@@ -33,21 +33,23 @@ class User {
} }
getStoreUserId() { getStoreUserId() {
return Storage.get(`${PREFIX}_storeUserId`); return window.currentStoreUserInfo.storeUserId || Storage.get(`${PREFIX}_storeUserId`);
} }
getCustomerId() { getCustomerId() {
return Storage.get(`${PREFIX}_customerId`); return Storage.get(`${PREFIX}_customerId`);
} }
getUserId() { getUserId() {
return Storage.get(`${PREFIX}_userId`); return window.currentStoreUserInfo.userId || Storage.get(`${PREFIX}_userId`);
} }
getUserRole() { getUserRole() {
return Storage.get(`${PREFIX}_userRole`); return Storage.get(`${PREFIX}_userRole`);
} }
getToken() { getToken() {
return Storage.get(`${PREFIX}_token`); return window.currentStoreUserInfo.token || Storage.get(`${PREFIX}_token`);
} }
getIsAdmin() { getIsAdmin() {
......
/* /*
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2020-04-27 20:35:34 * @Date: 2020-04-27 20:35:34
* @LastEditors: wufan * @LastEditors: Please set LastEditors
* @LastEditTime: 2021-03-26 16:14:09 * @LastEditTime: 2021-06-23 10:16:30
* @Description: * @Description:
*/ */
...@@ -23,8 +23,8 @@ import User from '@/common/js/user'; ...@@ -23,8 +23,8 @@ import User from '@/common/js/user';
import Service from "@/common/js/service"; import Service from "@/common/js/service";
declare var getParameterByName: any; declare var getParameterByName: any;
declare var window: any;
window.currentStoreUserInfo = {}
const history = createHashHistory(); const history = createHashHistory();
window.RCHistory = _.extend({}, history, { window.RCHistory = _.extend({}, history, {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2019-07-10 10:30:49 * @Date: 2019-07-10 10:30:49
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @LastEditTime: 2021-05-24 16:29:05 * @LastEditTime: 2021-06-22 17:47:02
* @Description: * @Description:
*/ */
import React, { useContext, useEffect, useState } from 'react'; import React, { useContext, useEffect, useState } from 'react';
...@@ -32,7 +32,7 @@ const App: React.FC = (props: any) => { ...@@ -32,7 +32,7 @@ const App: React.FC = (props: any) => {
const [menuType, setMenuType] = useState(true); const [menuType, setMenuType] = useState(true);
const enterpriseId = User.getEnterpriseId(); const enterpriseId = User.getEnterpriseId();
window.ctx = ctx; window.ctx = ctx;
useEffect(() => { useEffect(() => {
WechatApi.initShareConfig(); WechatApi.initShareConfig();
...@@ -64,24 +64,36 @@ const App: React.FC = (props: any) => { ...@@ -64,24 +64,36 @@ const App: React.FC = (props: any) => {
async function getStoreAndUserInfo() { async function getStoreAndUserInfo() {
await (enterpriseId ? getStoreInfo() : getStoreGroupAndStoreList()); await (enterpriseId ? getStoreInfo() : getStoreGroupAndStoreList());
} }
function getStoreInfo() { function getStoreInfo() {
console.log("currentStoreUserInfo",window.currentStoreUserInfo);
const params = { const params = {
storeId: User.getStoreId(), storeId: User.getStoreId(),
userId: User.getUserId(), userId: User.getUserId(),
}; };
Service.Hades('public/customerHades/getStoreAndUserMsg', params).then((res) => { Service.Hades('public/customerHades/getStoreAndUserMsg', params).then((res) => {
const { id, storeUserId, storeName, userRole, storeType } = res.result; if(res.success){
User.setStoreId(id); const { id, storeUserId, storeName, userRole, storeType } = res.result;
User.setStoreUserId(storeUserId); User.setStoreId(id);
User.setStoreName(storeName); User.setStoreUserId(storeUserId);
Bus.trigger('storeNameChange',storeName); User.setStoreName(storeName);
User.setUserRole(userRole); Bus.trigger('storeNameChange',storeName);
User.setStoreType(storeType); User.setUserRole(userRole);
setStoreUserId(storeUserId) User.setStoreType(storeType);
getUserPermission(); setCurrentStoreUserInfo(id,storeUserId)
setStoreUserId(storeUserId);
getUserPermission();
}
}) })
} }
function setCurrentStoreUserInfo(storeId:any,storeUserId:any){
window.currentStoreUserInfo.storeId = storeId;
window.currentStoreUserInfo.storeUserId = storeUserId;
window.currentStoreUserInfo.userId = User.getUserId();
window.currentStoreUserInfo.token = User.getToken();
window.currentStoreUserInfo.enterpriseId = User.getEnterpriseId();
}
function getStoreGroupAndStoreList() { function getStoreGroupAndStoreList() {
...@@ -101,6 +113,7 @@ const App: React.FC = (props: any) => { ...@@ -101,6 +113,7 @@ const App: React.FC = (props: any) => {
Bus.trigger('storeNameChange', storeName); Bus.trigger('storeNameChange', storeName);
User.setUserRole(userRole); User.setUserRole(userRole);
User.setStoreType(storeType); User.setStoreType(storeType);
setCurrentStoreUserInfo(id,storeUserId);
ctx.dispatch(setStoreGroupList(storeGroupVOS)) ctx.dispatch(setStoreGroupList(storeGroupVOS))
ctx.dispatch(setStoreList(storeVOS)); ctx.dispatch(setStoreList(storeVOS));
setStoreUserId(storeUserId) setStoreUserId(storeUserId)
......
...@@ -278,6 +278,8 @@ export default class CollegeManagePage extends React.Component { ...@@ -278,6 +278,8 @@ export default class CollegeManagePage extends React.Component {
}; };
User.setStoreId(item.id); User.setStoreId(item.id);
User.setStoreUserId(item.storeUserId); User.setStoreUserId(item.storeUserId);
window.currentStoreUserInfo.storeId = item.id;
window.currentStoreUserInfo.storeUserId = item.storeUserId;
window.RCHistory.push('/home') window.RCHistory.push('/home')
}} }}
> >
...@@ -296,6 +298,8 @@ export default class CollegeManagePage extends React.Component { ...@@ -296,6 +298,8 @@ export default class CollegeManagePage extends React.Component {
e.stopPropagation(); e.stopPropagation();
User.setStoreId(item.id); User.setStoreId(item.id);
User.setStoreUserId(item.storeUserId); User.setStoreUserId(item.storeUserId);
window.currentStoreUserInfo.storeId = item.id;
window.currentStoreUserInfo.storeUserId = item.storeUserId;
window.RCHistory.push('/college-info') window.RCHistory.push('/college-info')
}} }}
>编辑</span> >编辑</span>
...@@ -351,6 +355,8 @@ export default class CollegeManagePage extends React.Component { ...@@ -351,6 +355,8 @@ export default class CollegeManagePage extends React.Component {
}; };
User.setStoreId(item.id); User.setStoreId(item.id);
User.setStoreUserId(item.storeUserId); User.setStoreUserId(item.storeUserId);
window.currentStoreUserInfo.storeId = item.id;
window.currentStoreUserInfo.storeUserId = item.storeUserId;
window.RCHistory.push('/home') window.RCHistory.push('/home')
}} }}
> >
...@@ -369,6 +375,8 @@ export default class CollegeManagePage extends React.Component { ...@@ -369,6 +375,8 @@ export default class CollegeManagePage extends React.Component {
e.stopPropagation(); e.stopPropagation();
User.setStoreId(item.id); User.setStoreId(item.id);
User.setStoreUserId(item.storeUserId); User.setStoreUserId(item.storeUserId);
window.currentStoreUserInfo.storeId = item.id;
window.currentStoreUserInfo.storeUserId = item.storeUserId;
window.RCHistory.push('/college-info') window.RCHistory.push('/college-info')
}} }}
>编辑</span> >编辑</span>
......
...@@ -271,6 +271,14 @@ function Header(props) { ...@@ -271,6 +271,14 @@ function Header(props) {
onChange={(e) => { onChange={(e) => {
setStoreId(e.target.value); setStoreId(e.target.value);
User.setStoreId(e.target.value); User.setStoreId(e.target.value);
list.map((item)=>{
if(item.id === e.target.value){
User.setStoreUserId(item.storeUserId);
}
})
User.setUserId(window.currentStoreUserInfo.userId);
User.setToken(window.currentStoreUserInfo.token);
User.setEnterpriseId(window.currentStoreUserInfo.enterpriseId)
window.RCHistory.push('/home'); window.RCHistory.push('/home');
window.location.reload(); window.location.reload();
}} }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment