dev_aliyun2
杨树林 6 years ago committed by harry
parent c6e2291a77
commit 87dcbd9a20

@ -201,6 +201,8 @@ export function initAxiosInterceptors(props) {
//响应前的设置 //响应前的设置
axios.interceptors.request.use( axios.interceptors.request.use(
config => { config => {
setpostcookie()
clearAllCookie()
// config.headers['Content-Type']= 'no-cache' // config.headers['Content-Type']= 'no-cache'
// if (token) { // 每次发送请求之前判断是否存在token如果存在则统一在http请求的header都加上token不用每次请求都手动添加了 // if (token) { // 每次发送请求之前判断是否存在token如果存在则统一在http请求的header都加上token不用每次请求都手动添加了
// config.headers.Authorization = token; // config.headers.Authorization = token;
@ -263,6 +265,114 @@ export function initAxiosInterceptors(props) {
if (config.url.indexOf(proxy) != -1 || config.url.indexOf(':') != -1) {
return config
}
requestProxy(config)
let url = `/api${config.url}`;
//qq登录去掉api
if(config.params&&config.params.redirect_uri!=undefined){
if(config.params.redirect_uri.indexOf('otherloginqq')!=-1){
url = `${config.url}`;
}
}
if(`${config[0]}`!=`true`){
let timestamp = Date.parse(new Date())/1000;
if (window.location.port === "3007") {
// let timestamp=railsgettimes(proxy);
// console.log(timestamp)
// `https://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp`
railsgettimes( `${proxy}/api/main/first_stamp.json`);
let newopens=md5(opens+timestamp)
config.url = `${proxy}${url}`;
if (config.url.indexOf('?') == -1) {
config.url = `${config.url}?debug=${debugType}&randomcode=${timestamp}&client_key=${newopens}`;
} else {
config.url = `${config.url}&debug=${debugType}&randomcode=${timestamp}&client_key=${newopens}`;
}
} else {
// 加api前缀
// railsgettimes(`http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp`);
railsgettimes( `/api/main/first_stamp.json`);
let newopens=md5(opens+timestamp)
config.url = url;
if (config.url.indexOf('?') == -1) {
config.url = `${config.url}?randomcode=${timestamp}&client_key=${newopens}`;
} else {
config.url = `${config.url}&randomcode=${timestamp}&client_key=${newopens}`;
}
}
setpostcookie();
}
//
// console.log(config);
if (requestMap[config.url] === true) {
return false;
}
// // 非file_update请求
if (config.url.indexOf('update_file') === -1) {
requestMap[config.url] = true;
// --------------------------------------------- 測試3007连测试服的代码
// if (url.indexOf('file_update') != -1 || url.indexOf('game_build') != -1 || url.indexOf('game_status') != -1) {
// proxy = 'https://testbdweb.trustie.net'
// } else {
// 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];
// var _educoder_sessionmys="";
// var autologin_trusties="";
// _search.split('&').forEach(item => {
// const _arr = item.split('=');
// if(_arr[0]==='_educoder_session'){
// cookie.save('_educoder_session',_arr[1], { domain: '.educoder.net', path: '/'});
// _educoder_sessionmys=_arr[1];
// }else{
// cookie.save('autologin_trustie',_arr[1], { domain: '.educoder.net', path: '/'});
// autologin_trusties=_arr[1];
// }
// });
// try {
// const autlogins= `_educoder_session=${_educoder_sessionmys}; autologin_trustie=${autologin_trusties} `;
// config.params = {'Cookie': autlogins}
// config.headers['Cookie'] =autlogins;
// // console.log("设置了cookis");
// } catch (e) {
//
// }
// try {
// const autloginysls= `_educoder_session=${_educoder_sessionmys}; autologin_trustie=${autologin_trusties} `;
// config.params = {'autloginysls': autloginysls}
// config.headers['Cookie'] =autloginysls;
// // console.log("设置了cookis");
// }catch (e) {
//
// }
// }
// }
// }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
} }

@ -12,6 +12,7 @@ import './questioncss/questioncom.css';
import SiderBars from "../question/component/SiderBars"; import SiderBars from "../question/component/SiderBars";
import QuestionModalys from "./component/QuestionModalys"; import QuestionModalys from "./component/QuestionModalys";
var Undoclickable=true;
class Question extends Component { class Question extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -59,6 +60,9 @@ class Question extends Component {
isVisible: false, isVisible: false,
selectionbools:false, selectionbools:false,
chakanjiexiboolindex:"无", chakanjiexiboolindex:"无",
} }
} }
@ -279,7 +283,10 @@ class Question extends Component {
}) })
this.getdataslen(response.data.items); this.getdataslen(response.data.items);
// Undoclickable=true;
}).catch((error) => { }).catch((error) => {
// Undoclickable=true;
}); });
} }
@ -626,6 +633,7 @@ class Question extends Component {
single_questions_count: result.data.single_questions_count, single_questions_count: result.data.single_questions_count,
subjective_questions_count: result.data.subjective_questions_count, subjective_questions_count: result.data.subjective_questions_count,
}) })
// Undoclickable=true;
}).catch((error) => { }).catch((error) => {
// ////console.log(error); // ////console.log(error);
@ -639,6 +647,8 @@ class Question extends Component {
subjective_questions_count: 0, subjective_questions_count: 0,
}) })
}) })
// Undoclickable=true;
})
} }
@ -675,6 +685,11 @@ class Question extends Component {
} }
// 撤销 // 撤销
getitem_basketss=(id)=>{ getitem_basketss=(id)=>{
this.setState({
})
if(Undoclickable===true){
Undoclickable=false;
//选用题型可以上传单个 或者多个题型 //选用题型可以上传单个 或者多个题型
let url=`/item_baskets/${id}.json`; let url=`/item_baskets/${id}.json`;
@ -695,10 +710,24 @@ class Question extends Component {
}; };
this.getdatasy(data); this.getdatasy(data);
this.getbasket_listdata(); this.getbasket_listdata();
setTimeout(()=>{
Undoclickable=true;
},1000);
} }
}).catch((error) => { }).catch((error) => {
////console.log(error); ////console.log(error);
setTimeout(()=>{
Undoclickable=true;
},1000);
}) })
}else{
return
}
} }
//全选试题库 //全选试题库
selectallquestionsonthispage = () => { selectallquestionsonthispage = () => {

@ -579,7 +579,7 @@ class Questionitem_banks extends Component {
"" ""
: :
<Bottomsubmit {...this.props} {...this.state} bottomvalue={item_type === "PROGRAM" ? "创建" : "保存"} <Bottomsubmit {...this.props} {...this.state} bottomvalue={item_type === "PROGRAM" ? "创建" : "保存"}
onSubmits={() => this.preservation()} url={item_type === "PROGRAM" ? '/problems' : '/question'}></Bottomsubmit> onSubmits={() => this.preservation()} url={'/question'}></Bottomsubmit>
} }
</div> </div>
) )

Loading…
Cancel
Save