From 6067f74b8639ec01a31644fa49c5acda79ca0a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Sep 2019 10:03:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 4 +- public/react/src/common/UrlTool.js | 8 +- .../modules/courses/elearning/Elearning.js | 6 +- .../courses/elearning/YslDetailCards.js | 120 +++++++++++++----- .../paths/PathDetail/DetailCardsEditAndAdd.js | 39 ++++-- .../PathDetail/DetailCardsEditAndEdit.js | 10 +- public/react/src/modules/test/ShareTest.js | 2 +- 7 files changed, 132 insertions(+), 57 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 939d2cdaa..5785709f4 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -44,8 +44,8 @@ export function initAxiosInterceptors(props) { // proxy = "https://testeduplus2.educoder.net" 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 // proxy="http://192.168.2.63:3001" diff --git a/public/react/src/common/UrlTool.js b/public/react/src/common/UrlTool.js index 8098e4f38..3ad52f264 100644 --- a/public/react/src/common/UrlTool.js +++ b/public/react/src/common/UrlTool.js @@ -1,10 +1,10 @@ const isDev = window.location.port == 3007; -export const TEST_HOST = "https://pre-newweb.educoder.net" +export const TEST_HOST = "https://test-newweb.educoder.net" export function getImageUrl(path) { // https://www.educoder.net // https://testbdweb.trustie.net // const local = 'http://localhost:3000' - const local = 'https://pre-newweb.educoder.net' + const local = 'https://test-newweb.educoder.net' if (isDev) { return `${local}/${path}` } @@ -12,7 +12,7 @@ export function getImageUrl(path) { } export function setImagesUrl(path){ - const local = 'https://pre-newweb.educoder.net' + const local = 'https://test-newweb.educoder.net' let firstStr=path.substr(0,1); // console.log(firstStr); if(firstStr=="/"){ @@ -31,7 +31,7 @@ export function getUrl(path, goTest) { // testbdweb.educoder.net testbdweb.trustie.net // const local = goTest ? 'https://testeduplus2.educoder.net' : 'http://localhost:3000' // const local = 'https://testeduplus2.educoder.net' - const local = 'https://pre-newweb.educoder.net' + const local = 'https://test-newweb.educoder.net' if (isDev) { return `${local}${path?path:''}` } diff --git a/public/react/src/modules/courses/elearning/Elearning.js b/public/react/src/modules/courses/elearning/Elearning.js index 85366730c..a604f2f78 100644 --- a/public/react/src/modules/courses/elearning/Elearning.js +++ b/public/react/src/modules/courses/elearning/Elearning.js @@ -93,9 +93,9 @@ class Elearning extends Component{ if(prevProps.yslElearning===this.props.yslElearning) { if(prevProps.yslElearning===true && this.props.yslElearning===true){ - console.log("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"); - console.log(prevProps.yslElearning); - console.log(this.props.yslElearning); + // console.log("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"); + // console.log(prevProps.yslElearning); + // console.log(this.props.yslElearning); this.getdata(); this.props.comyslElearning(false); } diff --git a/public/react/src/modules/courses/elearning/YslDetailCards.js b/public/react/src/modules/courses/elearning/YslDetailCards.js index b6c9bae6e..c29533b71 100644 --- a/public/react/src/modules/courses/elearning/YslDetailCards.js +++ b/public/react/src/modules/courses/elearning/YslDetailCards.js @@ -160,7 +160,54 @@ class YslDetailCards extends Component{ console.log(error); }) - } + }; + + //章节下移 + chapterdown=(id)=>{ + let url=`/course_stages/${id}/down_position.json`; + axios.post(url).then((response) => { + if(response){ + if(response.data){ + if(response.data.status===0){ + this.props.showNotification(`下移成功`); + }else{ + this.props.showNotification(`下移失败`); + } + }else{ + this.props.showNotification(`下移失败`); + } + }else { + this.props.showNotification(`下移失败`); + } + }).catch((error) => { + console.log(error) + }); + }; + + //章节上移 + chapterup=(id)=>{ + let url=`/course_stages/${id}/up_position.json`; + axios.post(url).then((response) => { + if(response){ + if(response.data){ + if(response.data.status===0){ + this.props.showNotification(`上移成功`); + }else{ + this.props.showNotification(`上移失败`); + } + }else{ + this.props.showNotification(`上移失败`); + } + }else{ + this.props.showNotification(`上移失败`); + } + }).catch((error) => { + console.log(error) + }); + }; + + + //取消的 updatapathCardsedit=()=>{ this.setState({ @@ -183,16 +230,18 @@ class YslDetailCards extends Component{ //编辑用 pathCardsedit=(key,pathid)=>{ - let url=`/stages/`+pathid+`/edit.json`; + let url=`/course_stages/${pathid}/edit.json`; axios.get(url).then((result)=>{ - if(result.status===200){ - this.setState({ - idsum:key, - pathCardsedittype:true, - pathlistedit:result.data, - editbuttomtype:true, - editbuttomtypeadd:true - }) + if(result){ + if(result.status===200){ + this.setState({ + idsum:key, + pathCardsedittype:true, + pathlistedit:result.data, + editbuttomtype:true, + editbuttomtypeadd:true + }) + } } }).catch((error)=>{ console.log(error); @@ -232,23 +281,33 @@ class YslDetailCards extends Component{ let {delecttype,editdelectid}=this.state; let id=editdelectid; if(delecttype===true){ - let url ='/stages/'+id+'.json' + let url =`/course_stages/${id}.json` axios.delete(url).then((response) => { - if(response.data.status===1){ - // window.location.href = "/paths/" + response.data.subject_id - this.setState({ - idsum:undefined, - pathCardsedittype:false, - Modalstype:false, - Modalstopval:'', - Modalsbottomval:'', - delecttype:false, - editdelectid:undefined - }) - // this.getPathCardsList(); - - this.updatapathCardsedit() + if(response){ + if(response.data){ + if(response.data.status===0){ + this.setState({ + idsum:undefined, + pathCardsedittype:false, + Modalstype:false, + Modalstopval:'', + Modalsbottomval:'', + delecttype:false, + editdelectid:undefined + }) + + this.updatapathCardsedit() + this.props.showNotification(`删除成功`); + }else { + this.props.showNotification(`删除失败`); + } + }else{ + this.props.showNotification(`删除失败`); + } + }else { + this.props.showNotification(`删除失败`); } + }).catch((error) => { console.log(error) }) @@ -265,7 +324,7 @@ class YslDetailCards extends Component{ // console.log(editbuttomtype); // console.log("this.props.isAdmin"); // console.log(this.props.isAdmin()); - console.log(this.state.delecttype); + // console.log(this.state.delecttype); return(