dev_cs
杨树林 6 years ago
parent 628e248a2d
commit 6067f74b86

@ -44,8 +44,8 @@ export function initAxiosInterceptors(props) {
// proxy = "https://testeduplus2.educoder.net" // proxy = "https://testeduplus2.educoder.net"
proxy="http://47.96.87.25:48080" proxy="http://47.96.87.25:48080"
// wy // wy
proxy="https://pre-newweb.educoder.net" // proxy="https://pre-newweb.educoder.net"
proxy="https://test-newweb.educoder.net";
// wy // wy
// proxy="http://192.168.2.63:3001" // proxy="http://192.168.2.63:3001"

@ -1,10 +1,10 @@
const isDev = window.location.port == 3007; 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) { export function getImageUrl(path) {
// https://www.educoder.net // https://www.educoder.net
// https://testbdweb.trustie.net // https://testbdweb.trustie.net
// const local = 'http://localhost:3000' // const local = 'http://localhost:3000'
const local = 'https://pre-newweb.educoder.net' const local = 'https://test-newweb.educoder.net'
if (isDev) { if (isDev) {
return `${local}/${path}` return `${local}/${path}`
} }
@ -12,7 +12,7 @@ export function getImageUrl(path) {
} }
export function setImagesUrl(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); let firstStr=path.substr(0,1);
// console.log(firstStr); // console.log(firstStr);
if(firstStr=="/"){ if(firstStr=="/"){
@ -31,7 +31,7 @@ export function getUrl(path, goTest) {
// testbdweb.educoder.net testbdweb.trustie.net // testbdweb.educoder.net testbdweb.trustie.net
// const local = goTest ? 'https://testeduplus2.educoder.net' : 'http://localhost:3000' // const local = goTest ? 'https://testeduplus2.educoder.net' : 'http://localhost:3000'
// const local = 'https://testeduplus2.educoder.net' // const local = 'https://testeduplus2.educoder.net'
const local = 'https://pre-newweb.educoder.net' const local = 'https://test-newweb.educoder.net'
if (isDev) { if (isDev) {
return `${local}${path?path:''}` return `${local}${path?path:''}`
} }

@ -93,9 +93,9 @@ class Elearning extends Component{
if(prevProps.yslElearning===this.props.yslElearning) { if(prevProps.yslElearning===this.props.yslElearning) {
if(prevProps.yslElearning===true && this.props.yslElearning===true){ if(prevProps.yslElearning===true && this.props.yslElearning===true){
console.log("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"); // console.log("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
console.log(prevProps.yslElearning); // console.log(prevProps.yslElearning);
console.log(this.props.yslElearning); // console.log(this.props.yslElearning);
this.getdata(); this.getdata();
this.props.comyslElearning(false); this.props.comyslElearning(false);
} }

@ -160,7 +160,54 @@ class YslDetailCards extends Component{
console.log(error); 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=()=>{ updatapathCardsedit=()=>{
this.setState({ this.setState({
@ -183,16 +230,18 @@ class YslDetailCards extends Component{
//编辑用 //编辑用
pathCardsedit=(key,pathid)=>{ pathCardsedit=(key,pathid)=>{
let url=`/stages/`+pathid+`/edit.json`; let url=`/course_stages/${pathid}/edit.json`;
axios.get(url).then((result)=>{ axios.get(url).then((result)=>{
if(result.status===200){ if(result){
this.setState({ if(result.status===200){
idsum:key, this.setState({
pathCardsedittype:true, idsum:key,
pathlistedit:result.data, pathCardsedittype:true,
editbuttomtype:true, pathlistedit:result.data,
editbuttomtypeadd:true editbuttomtype:true,
}) editbuttomtypeadd:true
})
}
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
@ -232,23 +281,33 @@ class YslDetailCards extends Component{
let {delecttype,editdelectid}=this.state; let {delecttype,editdelectid}=this.state;
let id=editdelectid; let id=editdelectid;
if(delecttype===true){ if(delecttype===true){
let url ='/stages/'+id+'.json' let url =`/course_stages/${id}.json`
axios.delete(url).then((response) => { axios.delete(url).then((response) => {
if(response.data.status===1){ if(response){
// window.location.href = "/paths/" + response.data.subject_id if(response.data){
this.setState({ if(response.data.status===0){
idsum:undefined, this.setState({
pathCardsedittype:false, idsum:undefined,
Modalstype:false, pathCardsedittype:false,
Modalstopval:'', Modalstype:false,
Modalsbottomval:'', Modalstopval:'',
delecttype:false, Modalsbottomval:'',
editdelectid:undefined delecttype:false,
}) editdelectid:undefined
// this.getPathCardsList(); })
this.updatapathCardsedit() this.updatapathCardsedit()
this.props.showNotification(`删除成功`);
}else {
this.props.showNotification(`删除失败`);
}
}else{
this.props.showNotification(`删除失败`);
}
}else {
this.props.showNotification(`删除失败`);
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}) })
@ -265,7 +324,7 @@ class YslDetailCards extends Component{
// console.log(editbuttomtype); // console.log(editbuttomtype);
// console.log("this.props.isAdmin"); // console.log("this.props.isAdmin");
// console.log(this.props.isAdmin()); // console.log(this.props.isAdmin());
console.log(this.state.delecttype); // console.log(this.state.delecttype);
return( return(
<div> <div>
{ {
@ -354,7 +413,7 @@ class YslDetailCards extends Component{
} }
</a> </a>
{ {
stages.length=== key+1?"":<a className="fr ring-op-green mr20" onClick={()=>this.operations(item.down_path)}> stages.length=== key+1?"":<a className="fr ring-op-green mr20" onClick={()=>this.chapterdown(item.stage_id)}>
<Tooltip placement="bottom" title="向下移动"> <Tooltip placement="bottom" title="向下移动">
<img src={getImageUrl("images/educoder/icon/movedown.svg")} className="fl mt2 ml4"/> <img src={getImageUrl("images/educoder/icon/movedown.svg")} className="fl mt2 ml4"/>
</Tooltip> </Tooltip>
@ -363,7 +422,7 @@ class YslDetailCards extends Component{
{key===0?"": {key===0?"":
<a className="fr ring-op-green mr20" onClick={()=>this.operations(item.up_path)}> <a className="fr ring-op-green mr20" onClick={()=>this.chapterup(item.stage_id)}>
<Tooltip placement="bottom" title="向上移动"> <Tooltip placement="bottom" title="向上移动">
<img src={getImageUrl("images/educoder/icon/moveup.svg")} className="fl mt2 ml4"/> <img src={getImageUrl("images/educoder/icon/moveup.svg")} className="fl mt2 ml4"/>
</Tooltip> </Tooltip>
@ -438,6 +497,7 @@ class YslDetailCards extends Component{
updatapathCardsedits={this.updatapathCardsedit} updatapathCardsedits={this.updatapathCardsedit}
pathlisteditlist={pathlistedit} pathlisteditlist={pathlistedit}
stageid={item.stage_id} stageid={item.stage_id}
ysldetailcards={"ysldetailcards"}
pathid={pathid} pathid={pathid}
></DetailCardsEditAndEdit> ></DetailCardsEditAndEdit>
</div> </div>
@ -446,7 +506,7 @@ class YslDetailCards extends Component{
} }
</div> </div>
} }
{ editbuttomtypeadd===true?'': { editbuttomtypeadd===true?'':this.props.isAdmin()===true?
<DetailCardsEditAndAdd <DetailCardsEditAndAdd
{...this.props} {...this.props}
sum={stages && stages.length+1} sum={stages && stages.length+1}
@ -454,7 +514,9 @@ class YslDetailCards extends Component{
detailInfoList={this.props.detailInfoList} detailInfoList={this.props.detailInfoList}
getPathCardsLists={this.updatapathCardsedit} getPathCardsLists={this.updatapathCardsedit}
editeditbuttomtypes={this.editeditbuttomtypecanle} editeditbuttomtypes={this.editeditbuttomtypecanle}
ysldetailcards={"ysldetailcards"}
></DetailCardsEditAndAdd> ></DetailCardsEditAndAdd>
:""
} }
</div> </div>

@ -94,21 +94,27 @@ class DetailCardsEditAndAdd extends Component{
axios.post(url,{ axios.post(url,{
shixun_id:patheditarry shixun_id:patheditarry
}).then((response) => { }).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<newshixun_lists.length; z++){
newshixuns_listedit.push(newshixun_lists[z]);
}
for(var i=0; i<newshixun_lists.length; i++){
list.push(newshixun_lists[i].shixun_id);
}
this.setState({
shixuns_listedit:newshixuns_listedit,
shixuns_listeditlist:list,
patheditarry:[],
selectShixun:false,
page:1,
})
}
for(var z=0; z<newshixun_lists.length; z++){
newshixuns_listedit.push(newshixun_lists[z]);
}
for(var i=0; i<newshixun_lists.length; i++){
list.push(newshixun_lists[i].shixun_id);
} }
this.setState({
shixuns_listedit:newshixuns_listedit,
shixuns_listeditlist:list,
patheditarry:[],
selectShixun:false,
page:1,
})
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
@ -276,7 +282,12 @@ class DetailCardsEditAndAdd extends Component{
let pathId=this.props.pathid; 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, { axios.post(url, {
name:stage_names, name:stage_names,
description:newstage_descriptions, description:newstage_descriptions,

@ -236,10 +236,12 @@ class DetailCardsEditAndEdit extends Component{
}else{ }else{
newstage_descriptions="" newstage_descriptions=""
} }
let url;
if(this.props.ysldetailcards===undefined){
url='/stages/'+stageid+'.json';
let url='/stages/'+stageid+'.json' }else{
url=`/course_stages/${stageid}.json`;
}
axios.put(url, { axios.put(url, {
name:stage_name, name:stage_name,
description:newstage_descriptions, description:newstage_descriptions,

@ -11,7 +11,7 @@ if(window.wx) {
title: ' title', // 分享标题 title: ' title', // 分享标题
desc: 'hello world', // 分享描述 desc: 'hello world', // 分享描述
link: 'https://www.educoder.net', // 分享链接该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 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 () { success: function () {
// 设置成功 // 设置成功
} }

Loading…
Cancel
Save