Commit d462f7f1 authored by 崔佳豪's avatar 崔佳豪

fix: 未选中记住密码时仍然记住密码

parent a0f7a260
Pipeline #48610 skipped with stages
...@@ -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 (
...@@ -190,8 +189,9 @@ const Layout = props => { ...@@ -190,8 +189,9 @@ const Layout = props => {
// const basename = getBaseName(); // const basename = getBaseName();
const history = useHistory(); const history = useHistory();
useEffect(() => { useEffect(() => {
siteAction.setGlobalConfig(props.global); const tk = Cookies.get('token') || props.global.token;
if (!Cookies.get('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;
......
...@@ -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}` : '';
......
...@@ -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