提交参数变动

dev_cs
杨树林 5 years ago
parent 1940d2222f
commit bd319f53ec

@ -83,7 +83,8 @@ class PathDetailIndex extends Component{
loadtype:false,
courses:undefined,
items: getItems(10),
pathtopskey:1
pathtopskey:1,
dataquerys:{},
}
this.onDragEnd = this.onDragEnd.bind(this);
@ -258,7 +259,9 @@ class PathDetailIndex extends Component{
// yslwebobject 后端需要的接口
let pathid=this.props.match.params.pathId;
let url="/paths/"+pathid+".json";
axios.get(url).then((result)=>{
axios.get(url,
{params:this.state.dataquerys}
).then((result)=>{
if (result.data.status === 407 || result.data.status === 401) {
debugger
return;

@ -81,7 +81,8 @@ export function TPMIndexHOC(WrappedComponent) {
isRender: false,
AccountProfiletype: false,
globalLoading: false
globalLoading: false,
dataquerys:{},
}
}
@ -165,7 +166,32 @@ export function TPMIndexHOC(WrappedComponent) {
$.ajaxSetup({
cache: true
});
this.fetchUser();
//帮助后台传参数
const query = this.props.location.search;
// const type = query.split('?chinaoocTimestamp=');
// console.log("Eduinforms12345");
// console.log(this.foo(query));
// console.log(JSON.stringify(this.foo(query)));
var dataqueryss={}
try {
var foqus=this.foo(query);
if(JSON.stringify(foqus) ==="{}"){
this.setState({
dataquerys:{},
});
}else{
this.setState({
dataquerys:foqus,
});
dataqueryss=foqus;
}
}catch (e) {
this.setState({
dataquerys:{},
})
}
this.fetchUsers(dataqueryss);
let url=`/users/get_navigation_info.json`;
axios.get(url, {
@ -260,9 +286,23 @@ export function TPMIndexHOC(WrappedComponent) {
courseId = parseInt(type[2])
// url += `?course_id=${courseId}`
}
var datay={};
if(JSON.stringify(this.state.dataquerys) ==="{}"){
datay={
course_id:isNaN(courseId)?undefined:courseId,
school:1
}
}else{
datay={
course_id:isNaN(courseId)?undefined:courseId,
school:1,
chinaoocTimestamp:this.state.dataquerys.chinaoocTimestamp,
websiteName:this.state.dataquerys.websiteName,
chinaoocKey:this.state.dataquerys.chinaoocKey,
}
}
axios.get(url,{params:{
course_id:isNaN(courseId)?undefined:courseId,
school:1
datay
}
},
{
@ -301,7 +341,94 @@ export function TPMIndexHOC(WrappedComponent) {
}).catch((error) => {
console.log(error)
})
}
};
fetchUsers = (yslurlobject) => {
let url = `/users/get_user_info.json`
let courseId;
let query = this.props.location.pathname;
const type = query.split('/');
if (type[1] == 'courses' && type[2]) {
courseId = parseInt(type[2])
// url += `?course_id=${courseId}`
}
var datay={};
if(JSON.stringify(yslurlobject) ==="{}"){
datay={
course_id:isNaN(courseId)?undefined:courseId,
school:1
}
}else{
datay={
course_id:isNaN(courseId)?undefined:courseId,
school:1,
chinaoocTimestamp:yslurlobject.chinaoocTimestamp,
websiteName:yslurlobject.websiteName,
chinaoocKey:yslurlobject.chinaoocKey,
}
}
axios.get(url,{params:{
datay
}
},
{
// withCredentials: true
}
).then((response) => {
/*
{
"username": "黄井泉",
"login": "Hjqreturn",
"user_id": 12,
"image_url": "avatar/User/12",
"admin": true,
"is_teacher": false,
"tidding_count": 0
}
*/
if(response=== undefined){
return
}
if (response.data) {
this.initCommonState(response.data)
this.setState({
tpmLoading: false,
coursedata: {
course_identity: response.data.course_identity >= 0 ? response.data.course_identity : undefined,
course_public: response.data.course_public,
name: response.data.course_name,
userid:response.data.user_id
},
})
}
}).catch((error) => {
console.log(error)
})
};
//截取url 数据的
foo=(url)=> {
var json = {};
var regExp = /[\?\&](\w+)(=?)(\w*)/g;
var arr;
do {
arr = regExp.exec(url);
// console.log(arr); // arr = [完整的字符串, key, 等号或'', value或'']
if (arr) {
var key = arr[1];
var value = arr[3];
// arr[2] === ''时, value = undefined
if (!arr[2])
value = undefined;
json[key] = value;
}
} while (arr);
return json;
};
hideLoginDialog = () => {
this.setState({
isRender: false

Loading…
Cancel
Save