Merge branch 'dev_aliyun' into dev_cs

dev_cs
hjm 6 years ago
commit 6b1eabaa9f

@ -38,13 +38,13 @@ export function initAxiosInterceptors(props) {
// https://github.com/axios/axios/issues/1497
// TODO 读取到package.json中的配置
var proxy = "http://localhost:3000"
var proxy = "http://localhost:3000";
// proxy = "http://testbdweb.trustie.net"
// proxy = "http://testbdweb.educoder.net"
// proxy = "https://testeduplus2.educoder.net"
proxy="http://47.96.87.25:48080"
proxy="http://47.96.87.25:48080";
// wy
proxy="https://pre-newweb.educoder.net"
proxy="https://pre-newweb.educoder.net";
proxy="https://test-newweb.educoder.net"
// wy

@ -25,16 +25,61 @@ class Eduinforms extends Component{
eduintits:"",
informs:[],
yslbool:false,
dataquerys:{},
}
}
componentDidMount() {
console.log("Eduinformss");
console.log("获取到数据");
console.log(this.props);
this.getinputdata();
// console.log(this.props);
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.getinputdatas(dataqueryss);
}
//截取数据
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;
}
getyslbooltrue(){
console.log("调用了getyslbooltrue");
this.setState({
@ -54,7 +99,47 @@ class Eduinforms extends Component{
})
let url = `/courses/${this.props.match.params.coursesId}/informs.json`;
//
axios.get(url).then((response) => {
axios.get(url,
{params:this.state.dataquerys}
).then((response) => {
if(response){
if(response.data){
this.setState({
informs:response.data.informs,
isSpin:false,
})
}else {
this.setState({
informs:[],
isSpin:false,
})
}
}else {
this.setState({
informs:[],
isSpin:false,
})
}
}).catch((error) => {
console.log(error)
this.setState({
informs:[],
isSpin:false,
})
});
}
getinputdatas=(yslwebobject)=>{
this.setState({
isSpin:true,
})
let url = `/courses/${this.props.match.params.coursesId}/informs.json`;
//
axios.get(url,
{params:yslwebobject}
).then((response) => {
if(response){
if(response.data){
this.setState({

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

@ -146,11 +146,114 @@ class PathDetailIndex extends Component{
}
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;
json[key] = value;
}
} while (arr);
return json;
}
getdatasindexs=(key,yslwebobject)=>{
// yslwebobject 后端需要的接口
let pathid=this.props.match.params.pathId;
let url="/paths/"+pathid+".json";
axios.get(url,
{params:yslwebobject}
).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),
})
}
getdatasindex=(key)=>{
}).catch((error)=>{
console.log(error);
})
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)=>{
@ -177,7 +280,7 @@ class PathDetailIndex extends Component{
}).catch((error)=>{
console.log(error);
})
});
let righturl="/paths/"+pathid+"/right_banner.json";

Loading…
Cancel
Save