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(
{ @@ -354,7 +413,7 @@ class YslDetailCards extends Component{ } { - stages.length=== key+1?"":this.operations(item.down_path)}> + stages.length=== key+1?"":this.chapterdown(item.stage_id)}> @@ -363,7 +422,7 @@ class YslDetailCards extends Component{ {key===0?"": - this.operations(item.up_path)}> + this.chapterup(item.stage_id)}> @@ -438,6 +497,7 @@ class YslDetailCards extends Component{ updatapathCardsedits={this.updatapathCardsedit} pathlisteditlist={pathlistedit} stageid={item.stage_id} + ysldetailcards={"ysldetailcards"} pathid={pathid} >
@@ -446,7 +506,7 @@ class YslDetailCards extends Component{ } } - { editbuttomtypeadd===true?'': + { editbuttomtypeadd===true?'':this.props.isAdmin()===true? + :"" } diff --git a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js index 934896bb6..1d6582778 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js +++ b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js @@ -94,21 +94,27 @@ class DetailCardsEditAndAdd extends Component{ axios.post(url,{ shixun_id:patheditarry }).then((response) => { - let newshixun_lists=response.data.shixun_lists; + if(response){ + if(response.data){ + let newshixun_lists=response.data.shixun_lists; + + for(var z=0; z { console.log(error) }); @@ -276,7 +282,12 @@ class DetailCardsEditAndAdd extends Component{ let pathId=this.props.pathid; - let url='/stages.json?subject_id='+pathId + let url; + if(this.props.ysldetailcards===undefined){ + url='/stages.json?subject_id='+pathId; + }else{ + url=`/courses/${pathId}/course_stages.json`; + } axios.post(url, { name:stage_names, description:newstage_descriptions, diff --git a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js index 30859d962..e52ad0ad6 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js +++ b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js @@ -236,10 +236,12 @@ class DetailCardsEditAndEdit extends Component{ }else{ newstage_descriptions="" } - - - - let url='/stages/'+stageid+'.json' + let url; + if(this.props.ysldetailcards===undefined){ + url='/stages/'+stageid+'.json'; + }else{ + url=`/course_stages/${stageid}.json`; + } axios.put(url, { name:stage_name, description:newstage_descriptions, diff --git a/public/react/src/modules/test/ShareTest.js b/public/react/src/modules/test/ShareTest.js index 293396109..c715f8910 100644 --- a/public/react/src/modules/test/ShareTest.js +++ b/public/react/src/modules/test/ShareTest.js @@ -11,7 +11,7 @@ if(window.wx) { title: ' title', // 分享标题 desc: 'hello world', // 分享描述 link: 'https://www.educoder.net', // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 - imgUrl: 'https://pre-newweb.educoder.net/images/educoder/headNavLogo.png', // 分享图标 + imgUrl: 'https://test-newweb.educoder.net/images/educoder/headNavLogo.png', // 分享图标 success: function () { // 设置成功 }