Commit a753f7f7 authored by 曾婧's avatar 曾婧
parents c79783a1 35442c9e
Pipeline #48628 passed with stages
in 2 minutes 19 seconds
...@@ -46,7 +46,6 @@ const optionsWith = [{ label: '按站点', value: 'site' }, { label: '按城市' ...@@ -46,7 +46,6 @@ const optionsWith = [{ label: '按站点', value: 'site' }, { label: '按城市'
const HOT = ['HOT', '县', '市', 'New']; const HOT = ['HOT', '县', '市', 'New'];
const StationsItem = (item, action, onChangeVisible) => { const StationsItem = (item, action, onChangeVisible) => {
const changeGroup = (event, data) => { const changeGroup = (event, data) => {
debugger;
action.changeGroup && action.changeGroup(event, data, onChangeVisible); action.changeGroup && action.changeGroup(event, data, onChangeVisible);
}; };
return ( return (
...@@ -191,7 +190,9 @@ const Layout = props => { ...@@ -191,7 +190,9 @@ const Layout = props => {
const history = useHistory(); const history = useHistory();
useEffect(() => { useEffect(() => {
siteAction.setGlobalConfig(props.global); siteAction.setGlobalConfig(props.global);
if (!Cookies.get('token')) { const tk = Cookies.get('token') || props.global.token;
const isLogin = tk !== null && tk !== 'undefined' && tk !== (void 0);
if (!isLogin) {
let client = props.global && props.global.hasOwnProperty('client') ? props.global.get('client') : null; let client = props.global && props.global.hasOwnProperty('client') ? props.global.get('client') : null;
client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client : 'city'; client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client : 'city';
let generateType = props.global && props.global.hasOwnProperty('get') ? props.global.get('generateType') : null; let generateType = props.global && props.global.hasOwnProperty('get') ? props.global.get('generateType') : null;
...@@ -231,7 +232,6 @@ const Layout = props => { ...@@ -231,7 +232,6 @@ const Layout = props => {
useEffect(() => { useEffect(() => {
window.share.event.on('updateSite', res => { window.share.event.on('updateSite', res => {
debugger;
setCityData(res); setCityData(res);
}); });
return () => { return () => {
......
...@@ -45,8 +45,8 @@ class SecurityLayout extends React.Component { ...@@ -45,8 +45,8 @@ class SecurityLayout extends React.Component {
render() { render() {
const { isReady } = this.state; const { isReady } = this.state;
const { children, global, loading } = this.props; const { children, global, loading } = this.props;
const isLogin = Cookies.get('token') !== null && global.token !== null; const tk = Cookies.get('token') || global.token;
const isLogin = tk !== null && tk !== 'undefined' && tk !== (void 0);
if (!isLogin && window.location.pathname !== '/civbase/user/login') { if (!isLogin && window.location.pathname !== '/civbase/user/login') {
const { query = {}, search, pathname } = history.location; const { query = {}, search, pathname } = history.location;
const { redirect } = query; const { redirect } = query;
...@@ -54,7 +54,7 @@ class SecurityLayout extends React.Component { ...@@ -54,7 +54,7 @@ class SecurityLayout extends React.Component {
// redirect: pathname + search, // redirect: pathname + search,
// }); // });
this.props.updateCurrentIndex && this.props.updateCurrentIndex(0); this.props.updateCurrentIndex && this.props.updateCurrentIndex(0);
let client = global.client || Cookies.get('city'); let client = global.client || Cookies.get('client');
client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client : 'city'; client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client : 'city';
let { generateType } = global; let { generateType } = global;
generateType = !_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined' ? `&generateType=${generateType}` : ''; generateType = !_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined' ? `&generateType=${generateType}` : '';
......
...@@ -361,6 +361,10 @@ class Site { ...@@ -361,6 +361,10 @@ class Site {
window.share && window.share.event && window.share.event.emit('reloadNotice'); window.share && window.share.event && window.share.event.emit('reloadNotice');
const config = self.globalConfig; const config = self.globalConfig;
let url = !config.home ? ((config.homepage === '' || _.isNull(config.homepage)) ? `/civweb4`: `/civweb4/${config.homepage.replace(/^\//, '').replace(/^civweb4\//, '')}`) : `/${config.homepage.replace(/^\//, '')}`; let url = !config.home ? ((config.homepage === '' || _.isNull(config.homepage)) ? `/civweb4`: `/civweb4/${config.homepage.replace(/^\//, '').replace(/^civweb4\//, '')}`) : `/${config.homepage.replace(/^\//, '')}`;
// 在云平台上,切换前后如果url一致会出问题
if(config.userInfo && config.userInfo.site) {
url += `${url.indexOf('|') > -1 ? '&' : '|' }__site__=${config.userInfo.site}`;
}
self.props.history && self.props.history.push(url); self.props.history && self.props.history.push(url);
self.props && self.props.updateCollapsed && self.props.updateCollapsed(false); self.props && self.props.updateCollapsed && self.props.updateCollapsed(false);
window.share.event.emit('triggerMicro', this.props.global); window.share.event.emit('triggerMicro', this.props.global);
......
...@@ -914,7 +914,6 @@ class Login { ...@@ -914,7 +914,6 @@ class Login {
const self = this; const self = this;
const token = response && ( response.token ? response.token: ( response.access_token !== null && response.user_token !== null) ? response.user_token: ''); const token = response && ( response.token ? response.token: ( response.access_token !== null && response.user_token !== null) ? response.user_token: '');
if (token) { if (token) {
Cookies.set('token', token);
const exp = 86400000; const exp = 86400000;
self.globalConfig.token = token; self.globalConfig.token = token;
if(response.access_token!== "") { if(response.access_token!== "") {
......
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