|
|
|
@ -94,9 +94,30 @@ class CoursesBanner extends Component {
|
|
|
|
|
this.updatabanner()
|
|
|
|
|
}
|
|
|
|
|
updatabanner=()=>{
|
|
|
|
|
const query = this.props.location.search;
|
|
|
|
|
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:{},
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
let courseId = this.props.match.params.coursesId;
|
|
|
|
|
let url = "/courses/" + courseId + "/top_banner.json"
|
|
|
|
|
axios.get(url).then((result) => {
|
|
|
|
|
axios.get(url,{params:
|
|
|
|
|
dataqueryss
|
|
|
|
|
}).then((result) => {
|
|
|
|
|
if( result!=undefined){
|
|
|
|
|
let data = result.data;
|
|
|
|
|
this.setState({
|
|
|
|
@ -107,7 +128,28 @@ class CoursesBanner extends Component {
|
|
|
|
|
this.onloadupdatabanner()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
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;
|
|
|
|
|
};
|
|
|
|
|
showeditmenu = () => {
|
|
|
|
|
this.setState({
|
|
|
|
|
show: true,
|
|
|
|
|