diff --git a/public/react/src/modules/wxcode/index.js b/public/react/src/modules/wxcode/index.js index eb0f5cbca..7f47452bc 100644 --- a/public/react/src/modules/wxcode/index.js +++ b/public/react/src/modules/wxcode/index.js @@ -44,23 +44,33 @@ const App = (props) => { const {identifier} = props.match.params; // 获取路径参数 - + const _params = window.location.search; const setCookier = () => { var u = navigator.userAgent; var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; if(isAndroid){ - const _params = window.location.search; if (_params) { + let _cookie = ''; let _search = _params.split('?')[1]; + if(_search.split('=')) { + _cookie = _search.split('=')[1]; + cookie.save('_educoder_session', _cookie); + } + console.log(_cookie); _search.split('&').forEach(item => { + console.log(item); const _arr = item.split('='); - cookie.save(_arr[0], _arr[1], { domain: '.educoder.net', path: '/'}); + cookie.save(_arr[0], _arr[1], { + path: '/', + domain: '.educoder.net' + }); }); } }else{ } } + setCookier(); const [isActive, setIsActive] = useState(-1); const [tip, setTip] = useState(''); diff --git a/public/react/src/services/wxcodeService.js b/public/react/src/services/wxcodeService.js index 0f2df8ce6..bfb9d1fbb 100644 --- a/public/react/src/services/wxcodeService.js +++ b/public/react/src/services/wxcodeService.js @@ -11,21 +11,21 @@ import cookie from 'react-cookies' // axios.defaults.withCredentials = true; const setCookier = () => { - - var u = navigator.userAgent; - var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; - if(isAndroid){ - const _params = window.location.search; - if (_params) { - let _search = _params.split('?')[1]; - _search.split('&').forEach(item => { - const _arr = item.split('='); - cookie.save(_arr[0], _arr[1], { domain: '.educoder.net', path: '/'}); - }); - } - }else{ - - } + // + // var u = navigator.userAgent; + // var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; + // if(isAndroid){ + // const _params = window.location.search; + // if (_params) { + // let _search = _params.split('?')[1]; + // _search.split('&').forEach(item => { + // const _arr = item.split('='); + // cookie.save(_arr[0], _arr[1], { domain: '.educoder.net', path: '/'}); + // }); + // } + // }else{ + // + // } }