|
|
|
@ -56,6 +56,43 @@ if (isDev) {
|
|
|
|
|
//debugType="teacher";
|
|
|
|
|
// 学生
|
|
|
|
|
//debugType="student";
|
|
|
|
|
function setpostcookie() {
|
|
|
|
|
try {
|
|
|
|
|
const str =window.location.pathname;
|
|
|
|
|
let newdomain=".educoder.net"
|
|
|
|
|
|
|
|
|
|
if(window.location.origin==="https://www.educoder.net"){
|
|
|
|
|
newdomain=".educoder.net";
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
newdomain="test-newweb.educoder.net";
|
|
|
|
|
}
|
|
|
|
|
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'){
|
|
|
|
|
console.log(newdomain)
|
|
|
|
|
cookie.save('_educoder_session',_arr[1],{ path: '/' });
|
|
|
|
|
cookie.save('_educoder_session',_arr[1], { domain: newdomain, path: '/'});
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
console.log(newdomain)
|
|
|
|
|
cookie.save('autologin_trustie',_arr[1],{ path: '/' });
|
|
|
|
|
cookie.save('autologin_trustie',_arr[1], { domain: newdomain, path: '/'});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function railsgettimes(proxy) {
|
|
|
|
@ -63,6 +100,7 @@ if (isDev) {
|
|
|
|
|
$.ajax({url:proxy,async:false,success:function(data){
|
|
|
|
|
if(data.status===0){
|
|
|
|
|
timestamp=data.message;
|
|
|
|
|
setpostcookie();
|
|
|
|
|
}
|
|
|
|
|
}})
|
|
|
|
|
checkSubmitFlg=true
|
|
|
|
@ -73,6 +111,7 @@ if (isDev) {
|
|
|
|
|
$.ajax({url:proxy,async:false,success:function(data){
|
|
|
|
|
if(data.status===0){
|
|
|
|
|
timestamp=data.message;
|
|
|
|
|
setpostcookie();
|
|
|
|
|
}
|
|
|
|
|
}})
|
|
|
|
|
checkSubmitFlg=true
|
|
|
|
@ -81,6 +120,11 @@ if (isDev) {
|
|
|
|
|
}, 2000);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window._debugType = debugType;
|
|
|
|
|
export function initAxiosInterceptors(props) {
|
|
|
|
|
initOnlineOfflineListener()
|
|
|
|
@ -100,31 +144,7 @@ export function initAxiosInterceptors(props) {
|
|
|
|
|
// proxy="https://test-newweb.educoder.net"
|
|
|
|
|
// proxy="https://test-jupyterweb.educoder.net"
|
|
|
|
|
//proxy="http://192.168.2.63:3001"
|
|
|
|
|
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: '/' });
|
|
|
|
|
cookie.save('_educoder_session',_arr[1], { domain: '.educoder.net', path: '/'});
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
cookie.save('autologin_trustie',_arr[1],{ path: '/' });
|
|
|
|
|
cookie.save('autologin_trustie',_arr[1], { domain: '.educoder.net', path: '/'});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求;
|
|
|
|
|
// 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制
|
|
|
|
|