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 { broadcastChannelOnmessage ,SetAppModel, isDev, queryString } from 'educoder';
import { notification } from 'antd';
import cookie from 'react-cookies';
import './index.css';
const $ = window.$;
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 开发期多个身份切换
let debugType =""
@ -96,7 +109,7 @@ export function initAxiosInterceptors(props) {
requestMap[keyName] = false;
}
//响应前的设置
axios.interceptors.request.use(
config => {
// config.headers['Content-Type']= 'no-cache'
@ -111,6 +124,33 @@ export function initAxiosInterceptors(props) {
// 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) {
return config
}

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

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

Loading…
Cancel
Save