From 97812d590e40f00084565ac275d4b3d8f59db7e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 18 Jan 2020 12:39:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 20 --------- public/react/src/modules/wxcode/index.js | 45 +++++++++----------- public/react/src/services/wxcodeService.js | 48 +++++++++++----------- 3 files changed, 44 insertions(+), 69 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index e82a0c454..8e2660a7f 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -109,10 +109,6 @@ export function initAxiosInterceptors(props) { // proxy="https://test-jupyterweb.educoder.net" //proxy="http://192.168.2.63:3001" try { - var u = navigator.userAgent; - var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 - if (isIOS) { - //苹果走 const str =window.location.pathname; if(str.indexOf("/wxcode") !== -1){ // console.log("开始重写cookis"); @@ -133,22 +129,6 @@ export function initAxiosInterceptors(props) { }); } } - }else{ - // const str =window.location.pathname; - // if(str.indexOf("/wxcode") !== -1){ - // 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], { - // path: '/', - // domain: '.educoder.net' - // }); - // }); - // } - // } - } }catch (e) { } diff --git a/public/react/src/modules/wxcode/index.js b/public/react/src/modules/wxcode/index.js index bb253cb6e..3a0904b60 100644 --- a/public/react/src/modules/wxcode/index.js +++ b/public/react/src/modules/wxcode/index.js @@ -46,31 +46,26 @@ const App = (props) => { // 获取路径参数 const _params = window.location.search; const setCookier = () => { - var u = navigator.userAgent; - var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 - if (isIOS) { - - }else{ - const _params = window.location.search; - if (_params) { - let _search = _params.split('?')[1]; - _search.split('&').forEach(item => { - // console.log(item); - const _arr = item.split('='); - cookie.remove(_arr[0], { - domain: '.educoder.net', - path: '/', - - }); - cookie.save(_arr[0], _arr[1], { - path: '/', - domain: '.educoder.net' - }); - }); - } - - } - + // var u = navigator.userAgent; + // var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 + // if (isIOS) { + // }else{ + // if (_params) { + // let _cookie = ''; + // let _search = _params.split('?')[1]; + // if(_search.split('=')) { + // _cookie = _search.split('=')[1]; + // cookie.save('_educoder_session', _cookie); + // } + // _search.split('&').forEach(item => { + // const _arr = item.split('='); + // cookie.save(_arr[0], _arr[1], { + // path: '/', + // domain: '.educoder.net' + // }); + // }); + // } + // } } setCookier(); diff --git a/public/react/src/services/wxcodeService.js b/public/react/src/services/wxcodeService.js index 65824839a..74a57d703 100644 --- a/public/react/src/services/wxcodeService.js +++ b/public/react/src/services/wxcodeService.js @@ -11,30 +11,30 @@ import cookie from 'react-cookies' // axios.defaults.withCredentials = true; const setCookier = () => { - var u = navigator.userAgent; - var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 - if (isIOS) { - - }else{ - const _params = window.location.search; - if (_params) { - let _search = _params.split('?')[1]; - _search.split('&').forEach(item => { - // console.log(item); - const _arr = item.split('='); - cookie.remove(_arr[0], { - domain: '.educoder.net', - path: '/', - - }); - cookie.save(_arr[0], _arr[1], { - path: '/', - domain: '.educoder.net' - }); - }); - } - - } + // var u = navigator.userAgent; + // var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 + // if (isIOS) { + // + // }else{ + // const _params = window.location.search; + // if (_params) { + // let _search = _params.split('?')[1]; + // _search.split('&').forEach(item => { + // // console.log(item); + // const _arr = item.split('='); + // cookie.remove(_arr[0], { + // domain: '.educoder.net', + // path: '/', + // + // }); + // cookie.save(_arr[0], _arr[1], { + // path: '/', + // domain: '.educoder.net' + // }); + // }); + // } + // + // } } // 获取代码块