dev_cs
杨树林 5 years ago
parent 7660b7232a
commit 63133c4073

@ -58,7 +58,7 @@ class Eduinforms extends Component{
} }
this.getinputdatas(dataqueryss); this.getinputdatas(dataqueryss);
} }
//截取数据
foo=(url)=> { foo=(url)=> {
var json = {}; var json = {};
var regExp = /[\?\&](\w+)(=?)(\w*)/g; var regExp = /[\?\&](\w+)(=?)(\w*)/g;
@ -131,14 +131,14 @@ class Eduinforms extends Component{
}) })
}); });
} }
getinputdatas=(dataquerys)=>{ getinputdatas=(yslwebobject)=>{
this.setState({ this.setState({
isSpin:true, isSpin:true,
}) })
let url = `/courses/${this.props.match.params.coursesId}/informs.json`; let url = `/courses/${this.props.match.params.coursesId}/informs.json`;
// //
axios.get(url, axios.get(url,
{params:dataquerys} {params:yslwebobject}
).then((response) => { ).then((response) => {
if(response){ if(response){
if(response.data){ if(response.data){

@ -43,7 +43,7 @@ class Index extends Component{
<Route path="/paths/:pathId/edit" exact <Route path="/paths/:pathId/edit" exact
render={(props)=>(<PathsNew {...this.props} {...this.state} {...props}/>)} render={(props)=>(<PathsNew {...this.props} {...this.state} {...props}/>)}
></Route> ></Route>
{/*编辑页面*/}
<Route path="/paths/:pathId" exact <Route path="/paths/:pathId" exact
render={(props)=>(<PathsDetail {...this.props} {...this.state} {...props}/>)} render={(props)=>(<PathsDetail {...this.props} {...this.state} {...props}/>)}
></Route> ></Route>

@ -146,14 +146,60 @@ class PathDetailIndex extends Component{
} }
componentDidMount(){ componentDidMount(){
this.getdatasindex() 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:{},
});
return
}
this.setState({
dataquerys:foqus,
});
dataqueryss=foqus;
}catch (e) {
this.setState({
dataquerys:{},
})
} }
this.getdatasindexs(undefined,dataqueryss)
}
//截取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;
getdatasindex=(key)=>{ json[key] = value;
}
} while (arr);
return json;
}
getdatasindexs=(key,yslwebobject)=>{
// yslwebobject 后端需要的接口
let pathid=this.props.match.params.pathId; let pathid=this.props.match.params.pathId;
let url="/paths/"+pathid+".json"; let url="/paths/"+pathid+".json";
axios.get(url).then((result)=>{ axios.get(url,
{params:yslwebobject}
).then((result)=>{
if (result.data.status === 407 || result.data.status === 401) { if (result.data.status === 407 || result.data.status === 401) {
debugger debugger
return; return;
@ -180,6 +226,63 @@ class PathDetailIndex extends Component{
}) })
let righturl="/paths/"+pathid+"/right_banner.json";
axios.get(righturl).then((result)=>{
if (result.data.status === 407 || result.data.status === 401) {
debugger
return;
}
if (result.data.status === 403) {
debugger
// window.location.href = "/403";
return;
}
this.setState({
// detailInfoList:result.data,
tags:result.data.tags,
progress:result.data.progress,
members:result.data.members,
items: getItems(result.data.members.length),
})
}).catch((error)=>{
console.log(error);
})
};
getdatasindex=(key,yslwebobject)=>{
// yslwebobject 后端需要的接口
let pathid=this.props.match.params.pathId;
let url="/paths/"+pathid+".json";
axios.get(url).then((result)=>{
if (result.data.status === 407 || result.data.status === 401) {
debugger
return;
}
if (result.data.status === 403) {
debugger
// window.location.href = "/403";
return;
}
configShareForCustom(result.data.name, result.data.description)
if(result.data.allow_visit===true){
this.setState({
detailInfoList:result.data,
courses:result.data.courses,
pathtopskey:key===undefined?1:key,
// items: getItems(result.data.members.length),
})
}
}).catch((error)=>{
console.log(error);
});
let righturl="/paths/"+pathid+"/right_banner.json"; let righturl="/paths/"+pathid+"/right_banner.json";
axios.get(righturl).then((result)=>{ axios.get(righturl).then((result)=>{
if (result.data.status === 407 || result.data.status === 401) { if (result.data.status === 407 || result.data.status === 401) {

Loading…
Cancel
Save