Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_video
daiao 5 years ago
commit cd4f0ac2a4

@ -5,6 +5,7 @@ import md5 from 'md5';
import { requestProxy } from "./indexEduplus2RequestProxy"; import { requestProxy } from "./indexEduplus2RequestProxy";
import { broadcastChannelOnmessage ,SetAppModel, isDev, queryString } from 'educoder'; import { broadcastChannelOnmessage ,SetAppModel, isDev, queryString } from 'educoder';
import { notification } from 'antd'; import { notification } from 'antd';
import cookie from 'react-cookies';
import './index.css'; import './index.css';
const $ = window.$; const $ = window.$;
const opens ="79e33abd4b6588941ab7622aed1e67e8"; const opens ="79e33abd4b6588941ab7622aed1e67e8";
@ -24,6 +25,18 @@ function locationurl(list){
} }
function setCookier(){
const _params = window.location.search;
if (_params) {
let _search = _params.split('?')[1];
_search.split('&').forEach(item => {
console.log(item);
const _arr = item.split('=');
cookie.save('_educoder_session',_arr[0]);
cookie.save('autologin_trustie',_arr[1]);
});
}
}
// TODO 开发期多个身份切换 // TODO 开发期多个身份切换
let debugType ="" let debugType =""
@ -96,7 +109,7 @@ export function initAxiosInterceptors(props) {
requestMap[keyName] = false; requestMap[keyName] = false;
} }
//响应前的设置
axios.interceptors.request.use( axios.interceptors.request.use(
config => { config => {
// config.headers['Content-Type']= 'no-cache' // config.headers['Content-Type']= 'no-cache'
@ -111,6 +124,33 @@ export function initAxiosInterceptors(props) {
// proxy = 'http://localhost:3000' // proxy = 'http://localhost:3000'
// } // }
// --------------------------------------------- // ---------------------------------------------
// console.log("开始请求了");
// console.log(config.url);
// console.log(window.location.pathname);
try {
const str =window.location.pathname;
if(str.indexOf("/wxcode") !== -1){
// console.log("开始重写cookis");
const _params = window.location.search;
// console.log("1111");
if (_params) {
// console.log("22222");
let _search = _params.split('?')[1];
_search.split('&').forEach(item => {
const _arr = item.split('=');
if(_arr[0]==='_educoder_session'){
cookie.save('_educoder_session',_arr[1],{ path: '/' });
}else{
cookie.save('autologin_trustie',_arr[1],{ path: '/' });
}
});
}
}
}catch (e) {
}
//
if (config.url.indexOf(proxy) != -1 || config.url.indexOf(':') != -1) { if (config.url.indexOf(proxy) != -1 || config.url.indexOf(':') != -1) {
return config return config
} }

@ -1,7 +1,7 @@
/* /*
* @Description: 微信端代码编辑器 * @Description: 微信端代码编辑器
* @Author: tangjiang * @Author: tangjiang
* @Github: * @Github:
* @Date: 2020-01-15 09:56:34 * @Date: 2020-01-15 09:56:34
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2020-01-17 15:34:40 * @LastEditTime : 2020-01-17 15:34:40
@ -35,28 +35,28 @@ const App = (props) => {
evaluateWxCode, evaluateWxCode,
showWXCodeTextCase, showWXCodeTextCase,
changeWXCodeEvaluateLoading changeWXCodeEvaluateLoading
} = props; } = props;
const {identifier} = props.match.params; const {identifier} = props.match.params;
// 获取路径参数 // 获取路径参数
const setCookier = () => { const setCookier = () => {
const _params = window.location.search; // const _params = window.location.search;
if (_params) { // if (_params) {
let _search = _params.split('?')[1]; // let _search = _params.split('?')[1];
_search.split('&').forEach(item => { // _search.split('&').forEach(item => {
// console.log(item); // // console.log(item);
const _arr = item.split('='); // const _arr = item.split('=');
cookie.remove(_arr[0], { // cookie.remove(_arr[0], {
path: '/', // path: '/',
domain: '.educoder.net' // domain: '.educoder.net'
}); // });
cookie.save(_arr[0], _arr[1], { // cookie.save(_arr[0], _arr[1], {
path: '/', // path: '/',
domain: '.educoder.net' // domain: '.educoder.net'
}); // });
}); // });
} // }
} }
setCookier(); setCookier();
const [isActive, setIsActive] = useState(-1); const [isActive, setIsActive] = useState(-1);
@ -111,7 +111,7 @@ const App = (props) => {
updateWXCodeForInterval(identifier, path); updateWXCodeForInterval(identifier, path);
}, 10000); }, 10000);
} }
} }
// 关闭单个测试集 // 关闭单个测试集
const handleCloseItem = (i, flag) => { const handleCloseItem = (i, flag) => {
@ -130,7 +130,7 @@ const App = (props) => {
changeWXCodeEvaluateLoading(true); changeWXCodeEvaluateLoading(true);
evaluateWxCode(identifier, path); evaluateWxCode(identifier, path);
} }
const tcclasses = isShow ? `wx-code-test-case active` : 'wx-code-test-case'; const tcclasses = isShow ? `wx-code-test-case active` : 'wx-code-test-case';
const loading = showLoading ? 'code-evaluate-loading active' : 'code-evaluate-loading'; const loading = showLoading ? 'code-evaluate-loading active' : 'code-evaluate-loading';
const _val = sets_error_count === 0; const _val = sets_error_count === 0;
@ -200,19 +200,19 @@ const App = (props) => {
</h2> </h2>
{ {
is_public is_public
? (result ? (result
? <span className="iconfont icon-wancheng case_item_success"></span> ? <span className="iconfont icon-wancheng case_item_success"></span>
: <span className="iconfont icon-jinggao1 case_item_fail"></span>) : <span className="iconfont icon-jinggao1 case_item_fail"></span>)
: (<span className="case-item-tips"> : (<span className="case-item-tips">
隐藏测试集暂不支持解锁和查看 隐藏测试集暂不支持解锁和查看
{/* {result {/* {result
? <span className="iconfont icon-wancheng case_item_success"></span> ? <span className="iconfont icon-wancheng case_item_success"></span>
: <span className="iconfont icon-jinggao1 case_item_fail"></span> : <span className="iconfont icon-jinggao1 case_item_fail"></span>
} */} } */}
</span>) </span>)
} }
</div> </div>
<div className={_classes}> <div className={_classes}>
<span className="desc-title">测试输入</span> <span className="desc-title">测试输入</span>
<span className="test-input">{input || '-'}</span> <span className="test-input">{input || '-'}</span>

@ -1,7 +1,7 @@
/* /*
* @Description: * @Description:
* @Author: tangjiang * @Author: tangjiang
* @Github: * @Github:
* @Date: 2020-01-15 15:44:36 * @Date: 2020-01-15 15:44:36
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2020-01-17 16:40:03 * @LastEditTime : 2020-01-17 16:40:03
@ -11,27 +11,27 @@ import cookie from 'react-cookies'
// axios.defaults.withCredentials = true; // axios.defaults.withCredentials = true;
const setCookier = () => { const setCookier = () => {
const _params = window.location.search; // const _params = window.location.search;
if (_params) { // if (_params) {
let _search = _params.split('?')[1]; // let _search = _params.split('?')[1];
_search.split('&').forEach(item => { // _search.split('&').forEach(item => {
// console.log(item); // // console.log(item);
const _arr = item.split('='); // const _arr = item.split('=');
cookie.remove(_arr[0], { // cookie.remove(_arr[0], {
path: '/', // path: '/',
domain: '.educoder.net' // domain: '.educoder.net'
}); // });
cookie.save(_arr[0], _arr[1], { // cookie.save(_arr[0], _arr[1], {
path: '/', // path: '/',
domain: '.educoder.net' // domain: '.educoder.net'
}); // });
}); // });
} // }
} }
// 获取代码块 // 获取代码块
export async function fetchWxCode (identifier, params) { export async function fetchWxCode (identifier, params) {
setCookier(); setCookier();
const url = `/tasks/${identifier}/rep_content.json`; const url = `/tasks/${identifier}/rep_content.json`;
params = Object.assign({}, params, {withCredentials: true}); params = Object.assign({}, params, {withCredentials: true});
return axios.get(url, {params}); return axios.get(url, {params});

Loading…
Cancel
Save