diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index f5279573b..c6430bd1d 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -38,6 +38,14 @@ function setCookier(){ } } +function setCookie(key, value) { + const d = new Date(); + d.setTime(d.getTime() + (30 * 24 * 60 * 60 * 1000)); + const expires = "expires=" + d.toGMTString(); + document.cookie = `_educoder_session=${key}; domain=.educoder.net; path=/; expires=${expires}`; +} + + // TODO 开发期多个身份切换 let debugType ="" if (isDev) { @@ -114,7 +122,7 @@ export function initAxiosInterceptors(props) { if(_arr[0]==='_educoder_session'){ cookie.save('_educoder_session',_arr[1],{ path: '/' }); cookie.save('_educoder_session',_arr[1], { domain: '.educoder.net', path: '/'}); - + setCookie(_arr[1]); }else{ cookie.save('autologin_trustie',_arr[1],{ path: '/' }); cookie.save('autologin_trustie',_arr[1], { domain: '.educoder.net', path: '/'}); @@ -122,6 +130,9 @@ export function initAxiosInterceptors(props) { }); } } + + + }catch (e) { }