diff --git a/public/react/src/modules/courses/coursesPublic/AppraiseModal.js b/public/react/src/modules/courses/coursesPublic/AppraiseModal.js index 1a8c6cc75..9d1efa5b0 100644 --- a/public/react/src/modules/courses/coursesPublic/AppraiseModal.js +++ b/public/react/src/modules/courses/coursesPublic/AppraiseModal.js @@ -10,7 +10,6 @@ class AppraiseModal extends Component{ group_ids:[], fileList:[], Inputsval:undefined, - valuetype:0, textareavaltype:false, comment:undefined, hidden_comment:undefined @@ -18,11 +17,23 @@ class AppraiseModal extends Component{ } componentDidMount() { - - this.setState({ - valuetype:this.props.work_type===undefined?0:this.props.work_type, - textareaval:this.props.work_comment, - }) + let{data,work_comment,work_comment_hidden}=this.props; + + if(this.props.showAppraisetype==="child"){ + data.stage_list.map((item,key)=>{ + if(this.props.challenge_id===item.challenge_id){ + this.setState({ + comment:item.challenge_comment, + hidden_comment:item.challenge_comment_hidden, + }) + } + }) + }else{ + this.setState({ + comment:work_comment, + hidden_comment:work_comment_hidden, + }) + } } @@ -38,11 +49,10 @@ class AppraiseModal extends Component{ }) } Saves=()=>{ - let{textareaval,valuetype,comment,hidden_comment}=this.state; + let{comment,hidden_comment}=this.state; let commenttype=comment===undefined||comment===null||comment===""; let hidden_commenttype=hidden_comment===undefined||hidden_comment===null||hidden_comment===""; - if(commenttype===true&&hidden_commenttype===true){ this.setState({ textareavaltype:true @@ -50,20 +60,20 @@ class AppraiseModal extends Component{ return } - //comment 是 text 可见的评阅内容 // hidden_comment 是 text 不可见的评阅内容 // challenge_id 否 int 关卡id(关卡评阅才需传关卡id) - + let challenge_id=this.props.showAppraisetype==="child"?this.props.challenge_id:undefined let url=`/student_works/${this.props.match.params.homeworkid}/shixun_work_comment.json` axios.post(url, { - comment:textareaval, - hidden_comment:valuetype + comment:comment, + hidden_comment:hidden_comment, + challenge_id:challenge_id }).then((response) => { if(response.data.status===0){ this.props.showNotification(response.data.message) - this.props.showCancel(textareaval,valuetype) + this.props.showCancel(comment,hidden_comment,challenge_id) }else{ this.props.showNotification(response.data.message) } diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js index 31e749867..374aef8d4 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js @@ -11,6 +11,7 @@ import Coursesshixundetails from './shixunreport/Coursesshixundetails'; import Shixunechart from './shixunreport/Shixunechart'; import DownloadMessageysl from "../../modals/DownloadMessageysl" import AppraiseModal from "../coursesPublic/AppraiseModal"; +import ShowAppraiseList from './ShowAppraiseList'; import {UnControlled as CodeMirror} from 'react-codemirror2'; import 'codemirror/mode/cmake/cmake'; import 'codemirror/mode/xml/xml'; @@ -34,9 +35,8 @@ class ShixunWorkReport extends Component { DownloadMessageval:undefined, isspinning:false, showAppraiseModaltype:false, - work_comment_hidden:false, - showAppraiseModalsshow:true, - work_comment:null + work_comment_hidden:undefined, + work_comment:undefined, } } @@ -102,7 +102,7 @@ class ShixunWorkReport extends Component { let homeworkid=this.props.match.params.homeworkid; let url = `/student_works/${homeworkid}/shixun_work_report.json` axios.get(url).then((result) => { - if (result.data.status === 403||result.data.status === 401||result.data.status === 407||result.data.status === 408||result.data.status === 409) { + if (result.data.status === 403 || result.data.status === 401 || result.data.status === 407 || result.data.status === 408|| result.data.status === 409 || result.data.status === 500) { }else{ this.setState({ @@ -155,76 +155,138 @@ class ShixunWorkReport extends Component { }) } - showAppraiseModal=(type,id)=>{ + showAppraiseModal=(type,id,show,hidden)=>{ + let{data}=this.state; + debugger if(type==="child"){ + data.stage_list.forEach((item,key)=>{ + if(item.challenge_id===id){ + item.challenge_comment=show; + item.challenge_comment_hidden=hidden; + } + }) this.setState({ + showAppraiseModaltype:true, showAppraisetype:type, - challenge_id:id + challenge_id:id, + data:data }) }else{ this.setState({ + showAppraiseModaltype:true, showAppraisetype:type, - challenge_id:undefined + challenge_id:undefined, + work_comment:show, + work_comment_hidden:hidden }) } - - let{work_comment,work_comment_hidden}=this.state; - this.setState({ - showAppraiseModaltype:true, - work_comment_hidden:work_comment===null||work_comment===undefined?this.state.work_type?true:false:work_comment_hidden, - }) } hideAppraiseModal=()=>{ - let{work_comment,work_comment_hidden}=this.state; this.setState({ showAppraiseModaltype:false, - work_comment_hidden:work_comment===null||work_comment===undefined?this.state.work_type===1?true:false:work_comment_hidden, }) } - showAppraiseModals=(list,type)=>{ + showAppraiseModals=(show,hidden,id)=>{ + + let{data,showAppraisetype}=this.state; + + debugger + if(showAppraisetype==="child"){ + data.stage_list.forEach((item,key)=>{ + if(item.challenge_id===id){ + item.challenge_comment=show; + item.challenge_comment_hidden=hidden; + } + }) + this.setState({ + showAppraiseModaltype:false, + data:data + }) + }else{ + this.setState({ + showAppraiseModaltype:false, + work_comment:show, + work_comment_hidden:hidden + }) + } - this.setState({ - showAppraiseModaltype:false, - work_comment_hidden:type===0?false:true, - work_comment:list, - work_type:type, - showAppraiseModals:true, - showAppraiseModalsshow:true, - }) } - isdeleteModal=()=>{ + isdeleteModal=(comment_id,visible_comment)=>{ this.setState({ modalsType: true, modalsTopval:"是否确认删除?", - modalSave: ()=>this.isdeleteModals(), - modalCancel:()=>this.hideisdeleteModal(), + modalSave: ()=>this.isdeleteModals(comment_id,visible_comment), + modalCancel:()=>this.hideisdeleteModals(), }) } - hideisdeleteModal=()=>{ + hideisdeleteModals=()=>{ this.setState({ - modalsType: false, + modalsType:false, modalsTopval:"是否确认删除?", - modalSave: ()=>this.isdeleteModals(), - modalCancel:()=>this.hideisdeleteModal(), + modalSave: "", + modalCancel:"", }) } - isdeleteModals=()=>{ + + hideisdeleteModal=(comment_id,visible_comment)=>{ + + + let{data,work_comment,work_comment_hidden,showAppraisetype}=this.state; + if(showAppraisetype==="child"){ + data.stage_list.forEach((item,key)=>{ + if(item.comment_id===comment_id){ + if(visible_comment===true){ + item.challenge_comment=null; + }else{ + item.challenge_comment_hidden=null; + } + } + }) + this.setState({ + modalsType:false, + modalsTopval:"是否确认删除?", + modalSave: "", + modalCancel:"", + data:data + }) + }else{ + if(visible_comment===true){ + this.setState({ + modalsType:false, + modalsTopval:"是否确认删除?", + modalSave: "", + modalCancel:"", + work_comment:visible_comment===true?null:work_comment, + }) + }else{ + this.setState({ + modalsType:false, + modalsTopval:"是否确认删除?", + modalSave: "", + modalCancel:"", + work_comment_hidden:visible_comment===false?null:work_comment_hidden + }) + } + + } + + } + + isdeleteModals=(comment_id,visible_comment)=>{ let url =`/student_works/${this.props.match.params.homeworkid}/destroy_work_comment.json` - axios.delete(url).then((response) => { + axios.delete(url, { data: { + comment_id:comment_id, + visible_comment:visible_comment + }}).then((response) => { // const { status } = response.data; if(response.data.status===0){ this.props.showNotification(response.data.message) - this.setState({ - showAppraiseModalsshow:false, - work_comment_hidden:false, - work_comment:undefined, - work_type:0, - }) - this.hideisdeleteModal() + + this.hideisdeleteModal(comment_id,visible_comment) }else{ this.props.showNotification(response.data.message) } @@ -234,7 +296,7 @@ class ShixunWorkReport extends Component { }); } render() { - let{data,showAppraiseModaltype,work_comment_hidden,showAppraiseModalsshow,work_comment} =this.state; + let{data,showAppraiseModaltype,work_comment_hidden,work_comment} =this.state; let category_id=data===undefined?"":data.category===null?"":data.category.category_id; let homework_common_id=data===undefined?"":data.homework_common_id; @@ -243,7 +305,9 @@ class ShixunWorkReport extends Component { // let showAppraiseModals=this.props&&this.props.isAdminOrTeacher()===true?work_comment===null||work_comment===undefined?false:true:work_comment===null||work_comment===undefined?false:true; let showAppraiseModals=work_comment===null||work_comment===undefined?false:true; - console.log(showAppraiseModals) + console.log(data) + console.log(work_comment_hidden) + console.log(work_comment) return ( data===undefined?"": @@ -262,10 +326,12 @@ class ShixunWorkReport extends Component { {...this.state} visible={showAppraiseModaltype} Cancel={()=>this.hideAppraiseModal()} - showCancel={(list,type)=>this.showAppraiseModals(list,type)} + showCancel={(show,hidden,id)=>this.showAppraiseModals(show,hidden,id)} work_comment={this.state.work_comment} work_type={work_comment===null||work_comment===undefined?this.state.work_type:work_comment_hidden===true?1:0} />:""} + +
@@ -303,9 +369,11 @@ class ShixunWorkReport extends Component { {/*>评阅 : ""}*/} {this.props.isAdmin() ?this.showAppraiseModal("main")} + onClick={()=>this.showAppraiseModal("main",undefined,work_comment,work_comment_hidden)} >评阅:""}
+ + {/*{work_comment===null||work_comment===undefined?"评阅":"编辑评阅"}*/} + {data===undefined?"":work_comment===undefined||work_comment===null||work_comment===""?"": +
+
+ +
+ 总体评阅评阅内容 + + {this.props&&this.props.isAdminOrTeacher()===true?this.props.isdeleteModal(data.comment_id,true)} + >删除:""} + + {this.props&&this.props.isAdminOrTeacher()===true?this.props.showAppraiseModal("main",undefined,work_comment,work_comment_hidden)} + >编辑:""} + +
+ +
+
+
+
+
+
+
+ +
+
} + + + + {data===undefined?"":work_comment_hidden===undefined||work_comment_hidden===null||work_comment_hidden===""?"":this.props&&this.props.isAdminOrTeacher()===true? +
+
+ +
+ 总体评阅评阅内容(仅对课堂老师可见) + + {this.props&&this.props.isAdminOrTeacher()===true?this.props.isdeleteModal(data.comment_id,false)} + >删除:""} + + {this.props&&this.props.isAdminOrTeacher()===true?this.props.showAppraiseModal("main",undefined,work_comment,work_comment_hidden)} + >编辑:""} + +
+ +
+
+
+
+
+
+
+ +
+
:""} + + + + {data===undefined?"":data.stage_list.map((item,key)=>{ + let challenge_comment_hidden=item.challenge_comment_hidden===undefined||item.challenge_comment_hidden===null||item.challenge_comment_hidden===""; + let challenge_comment=item.challenge_comment===undefined||item.challenge_comment===null||item.challenge_comment===""; + return( +
+ {challenge_comment===false?
+
+ +
+ 第{key+1}关评阅内容 + {this.props&&this.props.isAdminOrTeacher()===true?this.props.isdeleteModal(item.comment_id,true)} + >删除:""} + + {this.props&&this.props.isAdminOrTeacher()===true?this.props.showAppraiseModal("child",item.challenge_id,item.challenge_comment,item.challenge_comment_hidden)} + >编辑:""} +
+
+
+
+
+
+
+
+ +
+
:""} + + + {challenge_comment_hidden===false&&this.props&&this.props.isAdminOrTeacher()===true?
+
+
+ 第{key+1}关评阅内容(仅对课堂老师可见) + + {this.props&&this.props.isAdminOrTeacher()===true?this.props.isdeleteModal(item.comment_id,false)} + >删除:""} + + {this.props&&this.props.isAdminOrTeacher()===true?this.props.showAppraiseModal("child",item.challenge_id,item.challenge_comment,item.challenge_comment_hidden)} + >编辑:""} +
+
+
+
+
+
+
+
+ +
+
:""} + +
) + }) + } + + +
+ ) + } +} +export default ShowAppraiseList; + diff --git a/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js b/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js index fe88ef87d..0cb75dee3 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js +++ b/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js @@ -207,7 +207,7 @@ class OfficialAcademicTranscript extends Component { render: (text, record) => ( - {console.log(record)} + this.props.showAppraiseModal("child",record.challenge_id.id,record.challenge_comment,record.challenge_comment_hidden)} diff --git a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js index f432c18b2..bd7b02e7d 100644 --- a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js +++ b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js @@ -14,24 +14,24 @@ import TPMRightSection from "../../tpm/component/TPMRightSection"; import styled from "styled-components"; const getItemStyle = (isDragging, draggableStyle) => ({ - // change background colour if dragging - background: isDragging ? '#dceeff' : '', - // styles we need to apply on draggables - ...draggableStyle, + // change background colour if dragging + background: isDragging ? '#dceeff' : '', + // styles we need to apply on draggables + ...draggableStyle, }); const getItems = count => - Array.from({ length: count }, (v, k) => k).map(k => ({ - id: `item-${k}`, - content: `item ${k}` - })); + Array.from({ length: count }, (v, k) => k).map(k => ({ + id: `item-${k}`, + content: `item ${k}` + })); // a little function to help us with reordering the result const reorder = (list, startIndex, endIndex) => { - const result = Array.from(list); - const [removed] = result.splice(startIndex, 1); - result.splice(endIndex, 0, removed); + const result = Array.from(list); + const [removed] = result.splice(startIndex, 1); + result.splice(endIndex, 0, removed); - return result; + return result; }; const List = styled.div` @@ -66,90 +66,90 @@ const DragHandle = styled.div` `; const $ =window.$ class PathDetailIndex extends Component{ - constructor(props){ - super(props) - this.state={ + constructor(props){ + super(props) + this.state={ progress:undefined, tags:undefined, members:undefined, - detailInfoList:undefined, - clickdetailInfoListtype:false, - Modalstype:false, - Modalstopval:undefined, - Modalsbottomval:undefined, - cardsModalcancel:this.cardsModalcancel, - cardsModalsave:this.cardsModalsave, - user_id:undefined, - loadtype:false, + detailInfoList:undefined, + clickdetailInfoListtype:false, + Modalstype:false, + Modalstopval:undefined, + Modalsbottomval:undefined, + cardsModalcancel:this.cardsModalcancel, + cardsModalsave:this.cardsModalsave, + user_id:undefined, + loadtype:false, courses:undefined, - items: getItems(10), + items: getItems(10), pathtopskey:1 - } - this.onDragEnd = this.onDragEnd.bind(this); + } + this.onDragEnd = this.onDragEnd.bind(this); - } - onDragEnd(result) { - // dropped outside the list - if (!result.destination) { - return; - } + } + onDragEnd(result) { + // dropped outside the list + if (!result.destination) { + return; + } - try { + try { - }catch (e) { + }catch (e) { - } - const items = reorder( - this.state.members, - result.source.index, - result.destination.index - ); + } + const items = reorder( + this.state.members, + result.source.index, + result.destination.index + ); - this.setState({ - detailInfoList:this.state.detailInfoList, + this.setState({ + detailInfoList:this.state.detailInfoList, members:items, - items - }); - console.log(this.state.members) - console.log("items 数组数组数组数组") - console.log(items) - } - cardsModalcancel=()=>{ - this.setState({ - Modalstype:false, - }) - // TODO 这个是临时处理,还需要优化,这里要看怎么区分处理 - if (this.state.Modalstopval == '你确定要删除该成员吗?') { - return; - } + items + }); + console.log(this.state.members) + console.log("items 数组数组数组数组") + console.log(items) + } + cardsModalcancel=()=>{ + this.setState({ + Modalstype:false, + }) + // TODO 这个是临时处理,还需要优化,这里要看怎么区分处理 + if (this.state.Modalstopval == '你确定要删除该成员吗?') { + return; + } this.props.history.goBack() - } + } - cardsModalsave=()=>{ - this.setState({ - Modalstype:false, - }) + cardsModalsave=()=>{ + this.setState({ + Modalstype:false, + }) this.props.history.goBack() - } - // 加载markdown - updatamakedown=(id)=>{ - setTimeout(()=>{ - var shixunDescr = window.editormd.markdownToHTML(id, { - htmlDecode: "style,script,iframe", - taskList: true, - tex: true, - flowChart: true, - sequenceDiagram: true - }); - $("#"+id+" p:first").addClass("ReactMarkdown"); - }, 200) - } + } + // 加载markdown + updatamakedown=(id)=>{ + setTimeout(()=>{ + var shixunDescr = window.editormd.markdownToHTML(id, { + htmlDecode: "style,script,iframe", + taskList: true, + tex: true, + flowChart: true, + sequenceDiagram: true + }); + $("#"+id+" p:first").addClass("ReactMarkdown"); + }, 200) + } - componentDidMount(){ - this.getdatasindex() - } + componentDidMount(){ + this.getdatasindex() + } - getdatasindex=(key)=>{ + getdatasindex=(key)=>{ let pathid=this.props.match.params.pathId; let url="/paths/"+pathid+".json"; @@ -168,7 +168,7 @@ class PathDetailIndex extends Component{ if(result.data.allow_visit===true){ this.setState({ detailInfoList:result.data, - courses:result.data.courses, + courses:result.data.courses, pathtopskey:key===undefined?1:key, // items: getItems(result.data.members.length), }) @@ -205,157 +205,157 @@ class PathDetailIndex extends Component{ }) } - updatadetailInfoList=()=>{ - this.getdatasindex(); - } - - clickNewsubscript=(val)=>{ - if(val===0){ - this.setState({ - clickdetailInfoListtype:true - }) - }else{ - this.setState({ - clickdetailInfoListtype:false - }) - } + updatadetailInfoList=()=>{ + this.getdatasindex(); + } - } + clickNewsubscript=(val)=>{ + if(val===0){ + this.setState({ + clickdetailInfoListtype:true + }) + }else{ + this.setState({ + clickdetailInfoListtype:false + }) + } - timeStamp=(value)=>{ - var secondTime = parseInt(value);// 秒 - var minuteTime = 0;// 分 - var hourTime = 0;// 小时 - if(secondTime > 60) {//如果秒数大于60,将秒数转换成整数 - //获取分钟,除以60取整数,得到整数分钟 - minuteTime = parseInt(secondTime / 60); - //获取秒数,秒数取佘,得到整数秒数 - secondTime = parseInt(secondTime % 60); - //如果分钟大于60,将分钟转换成小时 - if(minuteTime > 60) { - //获取小时,获取分钟除以60,得到整数小时 - hourTime = parseInt(minuteTime / 60); - //获取小时后取佘的分,获取分钟除以60取佘的分 - minuteTime = parseInt(minuteTime % 60); - } - } - var result = "" + parseInt(secondTime) + "秒"; - - if(minuteTime > 0) { - result = "" + parseInt(minuteTime) + "分" + result; - } - if(hourTime > 0) { - result = "" + parseInt(hourTime) + "小时" + result; - } - return result; - } + } + timeStamp=(value)=>{ + var secondTime = parseInt(value);// 秒 + var minuteTime = 0;// 分 + var hourTime = 0;// 小时 + if(secondTime > 60) {//如果秒数大于60,将秒数转换成整数 + //获取分钟,除以60取整数,得到整数分钟 + minuteTime = parseInt(secondTime / 60); + //获取秒数,秒数取佘,得到整数秒数 + secondTime = parseInt(secondTime % 60); + //如果分钟大于60,将分钟转换成小时 + if(minuteTime > 60) { + //获取小时,获取分钟除以60,得到整数小时 + hourTime = parseInt(minuteTime / 60); + //获取小时后取佘的分,获取分钟除以60取佘的分 + minuteTime = parseInt(minuteTime % 60); + } + } + var result = "" + parseInt(secondTime) + "秒"; + + if(minuteTime > 0) { + result = "" + parseInt(minuteTime) + "分" + result; + } + if(hourTime > 0) { + result = "" + parseInt(hourTime) + "小时" + result; + } + return result; + } - shanchuallow=(id)=>{ - this.setState({ - user_id:id, - Modalstype:true, - Modalstopval:"你确定要删除该成员吗?", - cardsModalsave:this.delectshanchuallow, - loadtype:false - }) - } - delectshanchuallow=()=>{ - let{user_id}=this.state; - let pathid=this.props.match.params.pathId; - let url="/paths/"+pathid+"/delete_member.json"; - let param={user_id:user_id}; - axios.delete(url,{data:param}).then((response) => { - if(response.data.status===1){ - if (this.props.current_user.user_id == user_id) { - this.props.history.push('/paths') - return; - } - this.props.showNotification(response.data.message) - this.setState({ - Modalstype:false, - // Modalstopval:response.data.message, - loadtype:false, - // cardsModalsave:this.cardsModalsave, - }) - this.updatadetailInfoList(); - } - }).catch((error) => { - console.log(error) - }) - } + shanchuallow=(id)=>{ + this.setState({ + user_id:id, + Modalstype:true, + Modalstopval:"你确定要删除该成员吗?", + cardsModalsave:this.delectshanchuallow, + loadtype:false + }) + } - //上移 - moveup=(data)=>{ - // console.log(data); - let pathid=this.props.match.params.pathId; - let url=`/paths/${pathid}/up_member_position.json`; - axios.post(url,{ - user_id:data.id - }).then((response) => { - if(response.status === 200){ - console.log("上移"); - // console.log(this.state.detailInfoList.members); - // console.log(response); - - this.setState({ - detailInfoList:this.state.detailInfoList, + delectshanchuallow=()=>{ + let{user_id}=this.state; + let pathid=this.props.match.params.pathId; + let url="/paths/"+pathid+"/delete_member.json"; + let param={user_id:user_id}; + axios.delete(url,{data:param}).then((response) => { + if(response.data.status===1){ + if (this.props.current_user.user_id == user_id) { + this.props.history.push('/paths') + return; + } + this.props.showNotification(response.data.message) + this.setState({ + Modalstype:false, + // Modalstopval:response.data.message, + loadtype:false, + // cardsModalsave:this.cardsModalsave, + }) + this.updatadetailInfoList(); + } + }).catch((error) => { + console.log(error) + }) + } + + //上移 + moveup=(data)=>{ + // console.log(data); + let pathid=this.props.match.params.pathId; + let url=`/paths/${pathid}/up_member_position.json`; + axios.post(url,{ + user_id:data.id + }).then((response) => { + if(response.status === 200){ + console.log("上移"); + // console.log(this.state.detailInfoList.members); + // console.log(response); + + this.setState({ + detailInfoList:this.state.detailInfoList, members:response.data.members - }); - // console.log(this.state.detailInfoList.members); + }); + // console.log(this.state.detailInfoList.members); - } + } - }).catch((error) => { - console.log(error) - }) - } + }).catch((error) => { + console.log(error) + }) + } - //下移 - movedown =(data) => { - // console.log(data); - let pathid=this.props.match.params.pathId; - let url=`/paths/${pathid}/down_member_position.json`; - axios.post(url,{ - user_id:data.id - }).then((response) => { - if( response.status === 200){ - console.log("下移"); - // console.log(this.state.detailInfoList.members); - // console.log(response); - this.setState({ - detailInfoList:this.state.detailInfoList, - members:response.data.members - }); - // console.log(this.state.detailInfoList.members); - } - - }).catch((error) => { - console.log(error) - }) - } - render(){ - - this.updatamakedown("shixuns_propaedeutics"); - this.updatamakedown("subject_learning_notes"); - let {detailInfoList, - clickdetailInfoListtype, - Modalstype, - Modalstopval, - Modalsbottomval, - cardsModalcancel, - cardsModalsave, - loadtype, + //下移 + movedown =(data) => { + // console.log(data); + let pathid=this.props.match.params.pathId; + let url=`/paths/${pathid}/down_member_position.json`; + axios.post(url,{ + user_id:data.id + }).then((response) => { + if( response.status === 200){ + console.log("下移"); + // console.log(this.state.detailInfoList.members); + // console.log(response); + this.setState({ + detailInfoList:this.state.detailInfoList, + members:response.data.members + }); + // console.log(this.state.detailInfoList.members); + } + + }).catch((error) => { + console.log(error) + }) + } + render(){ + + this.updatamakedown("shixuns_propaedeutics"); + this.updatamakedown("subject_learning_notes"); + let {detailInfoList, + clickdetailInfoListtype, + Modalstype, + Modalstopval, + Modalsbottomval, + cardsModalcancel, + cardsModalsave, + loadtype, progress, members, tags, courses, - } = this.state + } = this.state - return( -
+ return( +
- - -
- this.getdatasindex(key)}> -
-
-
-

- 简介 - {/*{detailInfoList===undefined?"":detailInfoList.allow_statistics===true?*/} - {/**/} - {/**/} - {/**/} - {/**/} - {/**/} - {/*:""*/} - {/*}*/} -

-
-
- {detailInfoList === undefined ? "" :detailInfoList.description===null?"": -
- } -
-
-
- - -
-
-
-

- 课程须知 - {/*{detailInfoList===undefined?"":detailInfoList.allow_statistics===true?*/} - {/**/} - {/**/} - {/**/} - {/**/} - {/**/} - {/*:""*/} - {/*}*/} -

-
- {detailInfoList === undefined ? "" :detailInfoList.learning_notes===null?"": -
+ + +
+ this.getdatasindex(key)}> +
+
+
+

+ 简介 + {/*{detailInfoList===undefined?"":detailInfoList.allow_statistics===true?*/} + {/**/} + {/**/} + {/**/} + {/**/} + {/**/} + {/*:""*/} + {/*}*/} +

+
+
+ {detailInfoList === undefined ? "" :detailInfoList.description===null?"": +
} -
-
- {tags === undefined ? "" :tags === null ? "": -
-

技能标签 {tags.length}

- -
-
- { - tags && tags.map((item,key)=>{ - return( - {item.tag_name} - ) - }) - } -
-
- - -
20&&clickdetailInfoListtype===false?"newsubscript mb9 color-grey-9 fr":"newsubscript mb9 color-grey-9 none"} - onClick={()=>this.clickNewsubscript(0)} - >... -
-
- - -
this.clickNewsubscript(1)}> -
-
- -
- } - { - this.props.checkIfLogin()===false?"":progress === undefined ? "" : progress === null ? "" : -
-

- 关卡数 - - {progress.my_score} / {progress.all_score} - -

-

- 已学 {progress.learned}% - 学习耗时{this.timeStamp(progress.time)} -

-
-
- } - - { - members ===undefined ?"":members === null ?"": -
-

教学团队

- - { members===undefined? - members && members.map((item,key)=>{ - return( -
- ) - }) - :detailInfoList===undefined?"":detailInfoList.allow_add_member===true? - members && members.map((item,key)=>{ - return( -
- - 头像 - - -
-

{item.name} - {/* 新增role 判断是否能删除 1 管理员 2 合作者 */} - - { - detailInfoList===undefined?"":detailInfoList.allow_add_member===true && item.role == 2? - this.shanchuallow(item.id)}>:"" - } -

-
-

{item.school}{item.identity}

-
- { - detailInfoList===undefined?"":detailInfoList.allow_add_member===true?
- {key!=0?:""} - {key+1== members.length?"":} -
- :"" - } - -
-
- ) - }) - : members && members.map((item,key)=>{ - return( -
- - 头像 - - -
-

{item.name} - {/*{*/} - {/* detailInfoList===undefined?"":detailInfoList.allow_add_member===true?*/} - {/* this.shanchuallow(item.id)}>:""*/} - {/*}*/} -

-
-

{item.school}{item.identity}

-
-
-
- ) - })} - -
- } - - - - -
-
-
- -
- ) - } +
+
+
+ + +
+
+
+

+ 课程须知 + {/*{detailInfoList===undefined?"":detailInfoList.allow_statistics===true?*/} + {/**/} + {/**/} + {/**/} + {/**/} + {/**/} + {/*:""*/} + {/*}*/} +

+
+ {detailInfoList === undefined ? "" :detailInfoList.learning_notes===null?"": +
+ } +
+
+ {tags === undefined ? "" :tags === null ? "": +
+

技能标签 {tags.length}

+ +
+
+ { + tags && tags.map((item,key)=>{ + return( + {item.tag_name} + ) + }) + } +
+
+ + +
20&&clickdetailInfoListtype===false?"newsubscript mb9 color-grey-9 fr":"newsubscript mb9 color-grey-9 none"} + onClick={()=>this.clickNewsubscript(0)} + >... +
+
+ + +
this.clickNewsubscript(1)}> +
+
+ +
+ } + { + this.props.checkIfLogin()===false?"":progress === undefined ? "" : progress === null ? "" : +
+

+ 我的进展 + + {progress.my_score} / {progress.all_score} + +

+

+ 已学 {progress.learned}% + 学习耗时{this.timeStamp(progress.time)} +

+
+
+ } + + { + members ===undefined ?"":members === null ?"": +
+

教学团队

+ + { members===undefined? + members && members.map((item,key)=>{ + return( +
+ + 头像 + + +
+

{item.name} + {/*{*/} + {/* detailInfoList===undefined?"":detailInfoList.allow_add_member===true?*/} + {/* this.shanchuallow(item.id)}>:""*/} + {/*}*/} +

+
+

{item.school}{item.identity}

+
+
+
+ ) + }) + :detailInfoList===undefined?"":detailInfoList.allow_add_member===true? + members && members.map((item,key)=>{ + return( +
+ + 头像 + + +
+

{item.name} + {/* 新增role 判断是否能删除 1 管理员 2 合作者 */} + + { + detailInfoList===undefined?"":detailInfoList.allow_add_member===true && item.role == 2? + this.shanchuallow(item.id)}>:"" + } +

+
+

{item.school}{item.identity}

+
+ { + detailInfoList===undefined?"":detailInfoList.allow_add_member===true?
+ {key!=0?:""} + {key+1== members.length?"":} +
+ :"" + } + +
+
+ ) + }) + : members && members.map((item,key)=>{ + return( +
+ + 头像 + + +
+

{item.name} + {/*{*/} + {/* detailInfoList===undefined?"":detailInfoList.allow_add_member===true?*/} + {/* this.shanchuallow(item.id)}>:""*/} + {/*}*/} +

+
+

{item.school}{item.identity}

+
+
+
+ ) + })} + +
+ } + + + + +
+
+
+ +
+ ) + } } export default PathDetailIndex; \ No newline at end of file diff --git a/public/react/src/modules/tpm/component/TPMRightSection.js b/public/react/src/modules/tpm/component/TPMRightSection.js index f824e7d83..904ef40b8 100644 --- a/public/react/src/modules/tpm/component/TPMRightSection.js +++ b/public/react/src/modules/tpm/component/TPMRightSection.js @@ -13,192 +13,192 @@ import {Icon,Tooltip} from 'antd'; // import "antd/dist/antd.css"; class TPMRightSection extends Component { - constructor(props) { - super(props) - this.state = { - - TPMRightSection:false, - clickNewsubscripttype:false - } - } - - // componentDidMount() { - // let id=this.props.match.params.shixunId; - // - // let shixunsDetailsURL=`/shixuns/`+id+`/show_right.json`; - // - // axios.get(shixunsDetailsURL).then((response)=> { - // if(response.status===200){ - // this.setState({ - // TPMRightSectionData: response.data - // }); - // } - // }).catch((error)=>{ - // console.log(error) - // }); - // } - - // shouldComponentUpdate(nextProps, nextState) { - // return nextProps.TPMRightSectionData !== this.state.TPMRightSectionData - // } - clickNewsubscript=(val)=>{ - if(val===0){ - this.setState({ - TPMRightSection:true, - clickNewsubscripttype:true - }) - }else{ - this.setState({ - TPMRightSection:false, - clickNewsubscripttype:false - }) - } - - } - render() { - let {TPMRightSection,clickNewsubscripttype}=this.state; - let {TPMRightSectionData}=this.props - - return ( -
- { - TPMRightSectionData===undefined?"": -
-
-

创建者

-
- - 头像 - -
- -

{TPMRightSectionData===undefined?"":TPMRightSectionData.creator===undefined?"":TPMRightSectionData.creator.name}

-
- 发布 {TPMRightSectionData.user_shixuns_count} - {/*粉丝 {TPMRightSectionData.fans_count}*/} - {/* 取消关注 */} -
- -
-
-
- { - TPMRightSectionData === undefined ? "" :TPMRightSectionData.tags===undefined?"": TPMRightSectionData.tags.length === 0 ? "" : -
-

技能标签 {TPMRightSectionData.tags.length}

-
-
- { TPMRightSectionData.tags.map((item,key)=>{ - return( - {item.tag_name} - )}) - } -
-
- - -
15&&clickNewsubscripttype===false?"newsubscript mb9 color-grey-9":"newsubscript mb9 color-grey-9 none"} - - data-tip-down="显示全部" - onClick={()=>this.clickNewsubscript(0)}>... -
- - -
this.clickNewsubscript(1)}> -
- -
- - - } - - -
-

所属课程

-
- { - TPMRightSectionData===undefined?"":TPMRightSectionData.paths===undefined?"":TPMRightSectionData.paths.map((i,k)=>{ - - return( - -
- - - 实训 - - -
- {i.name} -

- - - {i.stages_count} - - - {/**/} - {/*{i.score_count}*/} - {/**/} - - - {i.members_count} - - -

-
- -
- - ) - }) - } -
-
- -
-

推荐实训

-
- { - TPMRightSectionData===undefined?"":TPMRightSectionData.recommands===undefined?"":TPMRightSectionData.recommands.map((item,key)=>{ - return( -
- - 69?1526971094 - -
- - {item.name} - -

- {item.stu_num} 人学习 -

-

{item.level}

-
-
- ) - }) - } -
-
- -
- } -
- ) + constructor(props) { + super(props) + this.state = { + + TPMRightSection:false, + clickNewsubscripttype:false + } + } + + // componentDidMount() { + // let id=this.props.match.params.shixunId; + // + // let shixunsDetailsURL=`/shixuns/`+id+`/show_right.json`; + // + // axios.get(shixunsDetailsURL).then((response)=> { + // if(response.status===200){ + // this.setState({ + // TPMRightSectionData: response.data + // }); + // } + // }).catch((error)=>{ + // console.log(error) + // }); + // } + + // shouldComponentUpdate(nextProps, nextState) { + // return nextProps.TPMRightSectionData !== this.state.TPMRightSectionData + // } + clickNewsubscript=(val)=>{ + if(val===0){ + this.setState({ + TPMRightSection:true, + clickNewsubscripttype:true + }) + }else{ + this.setState({ + TPMRightSection:false, + clickNewsubscripttype:false + }) + } + + } + render() { + let {TPMRightSection,clickNewsubscripttype}=this.state; + let {TPMRightSectionData}=this.props + + return ( +
+ { + TPMRightSectionData===undefined?"": +
+
+

创建者

+
+ + 头像 + +
+ +

{TPMRightSectionData===undefined?"":TPMRightSectionData.creator===undefined?"":TPMRightSectionData.creator.name}

+
+ 发布 {TPMRightSectionData.user_shixuns_count} + {/*粉丝 {TPMRightSectionData.fans_count}*/} + {/* 取消关注 */} +
+ +
+
+
+ { + TPMRightSectionData === undefined ? "" :TPMRightSectionData.tags===undefined?"": TPMRightSectionData.tags.length === 0 ? "" : +
+

技能标签 {TPMRightSectionData.tags.length}

+
+
+ { TPMRightSectionData.tags.map((item,key)=>{ + return( + {item.tag_name} + )}) + } +
+
+ + +
15&&clickNewsubscripttype===false?"newsubscript mb9 color-grey-9":"newsubscript mb9 color-grey-9 none"} + + data-tip-down="显示全部" + onClick={()=>this.clickNewsubscript(0)}>... +
+ + +
this.clickNewsubscript(1)}> +
+ +
+ + + } + + +
+

相关实践课程

+
+ { + TPMRightSectionData===undefined?"":TPMRightSectionData.paths===undefined?"":TPMRightSectionData.paths.map((i,k)=>{ + + return( + +
+ + + 实训 + + +
+ {i.name} +

+ + + {i.stages_count} + + + {/**/} + {/*{i.score_count}*/} + {/**/} + + + {i.members_count} + + +

+
+ +
+ + ) + }) + } +
+
+ +
+

推荐实训

+
+ { + TPMRightSectionData===undefined?"":TPMRightSectionData.recommands===undefined?"":TPMRightSectionData.recommands.map((item,key)=>{ + return( +
+ + 69?1526971094 + +
+ + {item.name} + +

+ {item.stu_num} 人学习 +

+

{item.level}

+
+
+ ) + }) + } +
+
+ +
+ } +
+ ) - } + } } export default TPMRightSection;