From 09f4b0079b0d73be3717d4cd7cd68d847b20c363 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Thu, 12 Sep 2019 09:13:26 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=AE=9E=E8=B7=B5=E8=AF=BE=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/paths/PathNew.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/paths/PathNew.js b/public/react/src/modules/paths/PathNew.js index 7dcef663b..4e1621bc5 100644 --- a/public/react/src/modules/paths/PathNew.js +++ b/public/react/src/modules/paths/PathNew.js @@ -288,7 +288,7 @@ class PathNew extends Component{
- + {this.isEditPage ? 取消 From 335a3b4378abeb4058262b66decb72bff6b8a8fc Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 12 Sep 2019 09:31:31 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E4=B8=AD=EF=BC=8C=20tpi?= =?UTF-8?q?=20=20this.props.shixun.code=5Fedit=5Fpermission?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/context/TPIContextProvider.js | 4 ++- .../src/modules/page/MainContentContainer.js | 35 ++++++++++++++----- public/react/src/modules/page/VNCContainer.js | 27 ++++++++++---- .../page/component/monaco/TPIMonaco.js | 4 +-- .../modules/page/main/CodeRepositoryView.js | 9 ++--- .../page/main/CodeRepositoryViewContainer.js | 4 ++- 6 files changed, 59 insertions(+), 24 deletions(-) diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js index df738ef98..2d58140e6 100644 --- a/public/react/src/context/TPIContextProvider.js +++ b/public/react/src/context/TPIContextProvider.js @@ -268,12 +268,14 @@ pop_box_new(htmlvalue, 480, 182); }); } - onPathChange(index) { + onPathChange(index, callback) { let { challenge } = this.state; // challenge = Object.assign({}, challenge) // challenge.pathIndex = index; this.setState({ challenge: update(challenge, {pathIndex: { $set: index }}), + }, () => { + callback && callback() }) // TODO load new path content } diff --git a/public/react/src/modules/page/MainContentContainer.js b/public/react/src/modules/page/MainContentContainer.js index 3a9643f8d..8d6153186 100644 --- a/public/react/src/modules/page/MainContentContainer.js +++ b/public/react/src/modules/page/MainContentContainer.js @@ -208,11 +208,12 @@ class MainContentContainer extends Component { if (!this.props || !this.props.game || ( newProps.game.identifier !== this.props.game.identifier ) ) { setTimeout(this.fetchRepositoryCode( newProps), 1500); - } else if ( this.props.challenge.pathIndex != newProps.challenge.pathIndex - && newProps.challenge.pathIndex !== -1) { // 切换到只读文件 + } + // else if ( this.props.challenge.pathIndex != newProps.challenge.pathIndex + // && newProps.challenge.pathIndex !== -1) { // 切换到只读文件 // pathIndex切换 - setTimeout(this.fetchRepositoryCode( newProps), 1500); - } + // setTimeout(this.fetchRepositoryCode( newProps), 1500); + // } } if (newProps.myshixun) { var stageId = newProps.match.params.stageId; @@ -231,9 +232,13 @@ class MainContentContainer extends Component { // 切换关卡时,停止轮训 this.oldGameIdentifier = prevProps.game.identifier; this.doFileUpdateRequestOnCodeMirrorBlur(prevProps) - } else if (challenge && (challenge.pathIndex || prevProps.challenge.pathIndex) && challenge.pathIndex != prevProps.challenge.pathIndex) { + } + // else if (this.props.shixun && this.props.shixun.code_edit_permission && this.state.currentPath != prevState.currentPath) { + // this.doFileUpdateRequestOnCodeMirrorBlur(prevProps) + // } + else if (challenge && (challenge.pathIndex || prevProps.challenge.pathIndex) && challenge.pathIndex != prevProps.challenge.pathIndex) { this.doFileUpdateRequestOnCodeMirrorBlur(prevProps) - } + } } @@ -253,6 +258,9 @@ class MainContentContainer extends Component { this.setState({ codeLoading: false }); return; } + if (type && arg_path) { + this.doFileUpdateRequestOnCodeMirrorBlur(this.props) + } const stageId = game.identifier let path; let isEditablePath = false; @@ -535,7 +543,9 @@ class MainContentContainer extends Component { this.oldRepositoryCode = codeContent; let argPath; - if (challenge.pathIndex === -1) { // 当前是只读文件 + if (this.props.shixun && this.props.shixun.code_edit_permission == true) { + argPath = this.state.currentPath + } else if (challenge.pathIndex === -1) { // 当前是只读文件 argPath = challenge.multiPath === true ? challenge.path[0] : challenge.path } else { argPath = challenge.multiPath === true ? challenge.path[challenge.pathIndex] : challenge.path @@ -624,6 +634,11 @@ class MainContentContainer extends Component { gameBuilding: false }) } + onPathChange = (index, isDropDown) => { + this.props.onPathChange(index, () => { + isDropDown && this.fetchRepositoryCode() + }) + } onRunCodeTest() { // tipContent(0, 100, 30, 360, 1) // return; // for test @@ -634,7 +649,7 @@ class MainContentContainer extends Component { showDialog({ contentText: '需要先切回可编辑的文件才可评测,确认要现在切换吗?', callback: () => { - onPathChange(0) + this.onPathChange(0, true) handleGdialogClose(); } }) @@ -957,7 +972,9 @@ class MainContentContainer extends Component { onRepositoryCodeUpdate={this.onRepositoryCodeUpdate} onRunCodeTest={this.onRunCodeTest} codemirrorDidMount={this.codemirrorDidMount} fetchRepositoryCode={this.fetchRepositoryCode} showResetCodeDialog={this.showResetCodeDialog} showResetPassedCodeDialog={this.showResetPassedCodeDialog} - doFileUpdateRequestOnCodeMirrorBlur={this.doFileUpdateRequestOnCodeMirrorBlur} > + doFileUpdateRequestOnCodeMirrorBlur={this.doFileUpdateRequestOnCodeMirrorBlur} + onPathChange={this.onPathChange} + > ); diff --git a/public/react/src/modules/page/VNCContainer.js b/public/react/src/modules/page/VNCContainer.js index ec8a31820..3a85976bb 100644 --- a/public/react/src/modules/page/VNCContainer.js +++ b/public/react/src/modules/page/VNCContainer.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import axios from 'axios' -import { Spin } from 'antd' +import { Spin, Icon } from 'antd' import ClipboardJS from 'clipboard' import VNCDisplay from './VNCDisplay' @@ -22,7 +22,9 @@ class VNCContainer extends Component { this.state = { fileTreeSelectedKeys: [], repositoryCode: '', - displayKey: 1 + displayKey: 1, + vnc_reseting: false, + } } componentDidMount() { @@ -116,6 +118,7 @@ class VNCContainer extends Component { this.setState({ bottomDrawer: true }) } onResetVNC = () => { + if (this.state.vnc_reseting) return; // 桌面系统将恢复到初始状态,您在系统中创建的数据可能会丢失 // 请确保您的数据已保存(如:版本库代码已推送到服务器) // 是否确认重置? @@ -127,13 +130,15 @@ class VNCContainer extends Component {
, onOk: () => { const url = `/tasks/${this.props.game.identifier}/reset_vnc_link.json` + this.setState({ vnc_reseting: true }) axios.get(url, { }).then((response) => { if (response.data.data && response.data.data.vnc_url) { // reset this.setState({ displayKey: this.state.displayKey + 1, - vnc_url: response.data.data.vnc_url + vnc_url: response.data.data.vnc_url, + vnc_reseting: false }) } else { } @@ -141,7 +146,7 @@ class VNCContainer extends Component { }).catch(error =>{ console.log(error) - this.setState({ readingCodeLoading: false }); + this.setState({ vnc_reseting: false }); this.props.showSnackbar(`服务端异常,请联系管理员!`); }) @@ -270,15 +275,23 @@ class VNCContainer extends Component { > - + {/* */} + {this.state.vnc_reseting ? + : } 重置桌面系统 + + {/* + */} + + - + > + + { domArray.push( -

this.onPathChange(index) } > +

this.onPathChange(index, true) } > {item}

) }) @@ -501,7 +501,8 @@ class CodeRepositoryView extends Component { } */}
+ style={{ backgroundImage: `url('${notEditablePathImg}')` + , display: (isEditablePath || this.props.shixun && this.props.shixun.code_edit_permission ? 'none' : 'block') }}> {/**/} {/* cm monaco 切换 */} {/* */} diff --git a/public/react/src/modules/page/main/CodeRepositoryViewContainer.js b/public/react/src/modules/page/main/CodeRepositoryViewContainer.js index c6e7ddc79..111ccd253 100644 --- a/public/react/src/modules/page/main/CodeRepositoryViewContainer.js +++ b/public/react/src/modules/page/main/CodeRepositoryViewContainer.js @@ -231,12 +231,14 @@ class CodeRepositoryViewContainer extends Component { const { fetchRepositoryCode, onPathChange, showSnackbar, challenge } = this.props; const nodePath = info.node.props.eventKey; + let isCurrentFile = false; // 设置pathIndex为-1,那么代码文件下拉可以切回可编辑的文件 if (!challenge.multiPath) { // 单path任务 多path任务 path是数组 if (challenge.path.trim() == nodePath.trim()) { if (challenge.pathIndex === 0) { showSnackbar(`当前编辑文件已经是${nodePath}`) } else { + fetchRepositoryCode(null, nodePath, 1); onPathChange(0) } return; @@ -244,7 +246,7 @@ class CodeRepositoryViewContainer extends Component { onPathChange(-1) } } else { - let isCurrentFile = false; + let cur_index = -1; if (challenge.path && challenge.path.forEach) { challenge.path.forEach((item, index) => { From f23f5828e889918651fe9b04543743fe1db206b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 12 Sep 2019 09:35:18 +0800 Subject: [PATCH 3/6] =?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/modules/courses/Index.js | 2 +- .../react/src/modules/courses/elearning/Elearning.js | 11 ++++++++--- .../src/modules/courses/elearning/YslDetailCards.js | 6 ++++-- .../modules/paths/PathDetail/DetailCardsEditAndAdd.js | 6 +++--- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/public/react/src/modules/courses/Index.js b/public/react/src/modules/courses/Index.js index a2f9a14e5..95927893d 100644 --- a/public/react/src/modules/courses/Index.js +++ b/public/react/src/modules/courses/Index.js @@ -305,7 +305,7 @@ class CoursesIndex extends Component{ //Do your stuff here }); } - + //更新左边课堂导航 updataleftNav=()=>{ let query=this.props.location.pathname let {isaloadtype}=this.state; diff --git a/public/react/src/modules/courses/elearning/Elearning.js b/public/react/src/modules/courses/elearning/Elearning.js index 74fdfe201..8a0c4e007 100644 --- a/public/react/src/modules/courses/elearning/Elearning.js +++ b/public/react/src/modules/courses/elearning/Elearning.js @@ -29,13 +29,15 @@ class Elearning extends Component{ userlogin:"", isRender:false, subject_id:0, + myupdataleftNavs:this.myupdataleftNav } } componentDidMount() { // 记得删除退出课堂 - // console.log("获取到数据"); - // console.log(this.props); + console.log("在线学习"); + console.log("获取到数据"); + console.log(this.props); this.getdata(); } @@ -289,6 +291,9 @@ class Elearning extends Component{ }) }; + myupdataleftNav=()=>{ + this.props.updataleftNavfun(); + } render(){ console.log("Elearning++++++++"); // console.log(this.props.Chapterupdate); @@ -397,7 +402,7 @@ class Elearning extends Component{
{/*开始学习*/} - this.Startlearningtwo()} Myreload={()=>this.Myreload()} Tojoinclass={()=>this.Tojoinclass()} getPathCardsList={()=>this.getdata()}> + this.Startlearningtwo()} Myreload={()=>this.Myreload()} Tojoinclass={()=>this.Tojoinclass()} getPathCardsList={()=>this.getdata()} >
diff --git a/public/react/src/modules/courses/elearning/YslDetailCards.js b/public/react/src/modules/courses/elearning/YslDetailCards.js index cb6f06fde..4b295f118 100644 --- a/public/react/src/modules/courses/elearning/YslDetailCards.js +++ b/public/react/src/modules/courses/elearning/YslDetailCards.js @@ -210,7 +210,7 @@ class YslDetailCards extends Component{ - //取消的 + //确认的 updatapathCardsedit=()=>{ this.setState({ idsum:undefined, @@ -219,9 +219,10 @@ class YslDetailCards extends Component{ editbuttomtypeadd:false }) this.props.getPathCardsList(); + this.props.myupdataleftNavs(); // this.props.updatadetailInfoLists(); }; - //确认的 + //取消的 editeditbuttomtypecanle=()=>{ this.setState({ editbuttomtype:true, @@ -300,6 +301,7 @@ class YslDetailCards extends Component{ this.updatapathCardsedit() this.props.showNotification(`删除成功`); + this.props.myupdataleftNavs(); }else { this.props.showNotification(`删除失败`); } diff --git a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js index ce38a73ea..87e398888 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js +++ b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js @@ -123,10 +123,11 @@ class DetailCardsEditAndAdd extends Component{ //点击新建阶段 addStage=()=>{ - this.props.editeditbuttomtypes(); this.setState({ editPanel:true }) + this.props.editeditbuttomtypes(); + } //取消新建阶段 @@ -294,13 +295,12 @@ class DetailCardsEditAndAdd extends Component{ shixun_id:shixuns_listeditlist }).then((response) => { // window.location.href = "/paths/" + response.data.subject_id - this.props.getPathCardsLists(); - this.cancelAddState(); this.setState({ stage_nametype:false, descriptiontype:false }) + this.props.getPathCardsLists(); }).catch((error) => { console.log(error) }); From 0abe6f9a540b43e96129bcc2b800511714e9ed48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 12 Sep 2019 09:36:07 +0800 Subject: [PATCH 4/6] =?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/modules/courses/elearning/Elearning.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/elearning/Elearning.js b/public/react/src/modules/courses/elearning/Elearning.js index 8a0c4e007..2ed4bbaa8 100644 --- a/public/react/src/modules/courses/elearning/Elearning.js +++ b/public/react/src/modules/courses/elearning/Elearning.js @@ -35,9 +35,9 @@ class Elearning extends Component{ componentDidMount() { // 记得删除退出课堂 - console.log("在线学习"); - console.log("获取到数据"); - console.log(this.props); + // console.log("在线学习"); + // console.log("获取到数据"); + // console.log(this.props); this.getdata(); } From 674c44427e94386a09d302ea35316340970e4895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 12 Sep 2019 09:43:45 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=9D=83=E9=99=90=E6=A2=B3=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMIndexHOC.js | 26 +++++++-------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 657a1ef6b..c366b21a3 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -202,48 +202,40 @@ export function TPMIndexHOC(WrappedComponent) { NORMAL = 6 # 普通用户 Anonymous = 7 # 普未登录 */ - //超管 + //超管0 isSuperAdmin = () => { // return false return this.state.coursedata&&this.state.coursedata.course_identity === 0 } - // 课堂管理等 + //超管、运维0-1 isClassManagement = () => { - // return this.state.coursedata&&this.state.coursedata.course_identity >= 0 && return this.state.coursedata&&this.state.coursedata.course_identity < 2 } - //老师等 + //超管、运维、课堂管理0-2 isAdminOrCreator = () => { - // return this.state.coursedata&&this.state.coursedata.course_identity >= 0 && return this.state.coursedata&&this.state.coursedata.course_identity < 3 } - // 助教等 + //超管、运维、课堂管理、老师0-3 isAdminOrTeacher = () => { - // return this.state.coursedata&&this.state.coursedata.course_identity >= 0 && return this.state.coursedata&&this.state.coursedata.course_identity < 4 } - // 老师、管理员等 + // 超管、运维、课堂管理、老师、助教0-4 isAdmin = () => { - // return false - // return this.state.coursedata&&this.state.coursedata.course_identity >= 0 && return this.state.coursedata&&this.state.coursedata.course_identity < 5 } - // 学生 + // 学生5 isStudent = () => { - // return true - // return this.state.coursedata&&this.state.coursedata.course_identity >= 0 && return this.state.coursedata&&this.state.coursedata.course_identity === 5 } + // 超管、运维、课堂管理、老师、助教、学生0-5 isAdminOrStudent = () => { - // return this.state.coursedata&&this.state.coursedata.course_identity >= 0 && return this.state.coursedata&&this.state.coursedata.course_identity <= 5 } - // 非课堂成员 + // 游客未登录/非课堂成员6> isNotMember = () => { - // return this.state.coursedata&&this.state.coursedata.course_identity >= 0 && return this.state.coursedata&&this.state.coursedata.course_identity >= 6 } - + //课堂是否已结束 isCourseEnd = () => { return this.state.current_user ? this.state.current_user.course_is_end : false } From 6f68c79f18c388b790ac4aee3d25ad921bf66991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 12 Sep 2019 09:44:43 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=9D=83=E9=99=90=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/shixunHomework/shixunHomework.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/shixunHomework/shixunHomework.js b/public/react/src/modules/courses/shixunHomework/shixunHomework.js index fe959b691..a2cd5a938 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunHomework.js +++ b/public/react/src/modules/courses/shixunHomework/shixunHomework.js @@ -1037,7 +1037,7 @@ class ShixunHomework extends Component{ {/*{datas&&datas.category_name===undefined||datas&&datas.category_name===null?datas&&datas.main_category_name:datas&&datas.category_name+" 作业列表"}*/} 实训作业
  • - {datas===undefined?"":datas.homeworks && datas.homeworks.length>1?this.props.isClassManagement()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null? + {datas===undefined?"":datas.homeworks && datas.homeworks.length>1?this.props.isAdminOrCreator()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null? 调整排序