From 3866ec9bbbbd6aef94e146cefeaacd7dc03855d7 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 24 Jun 2019 11:29:37 +0800 Subject: [PATCH 01/17] =?UTF-8?q?=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/busyWork/CommonWorkList.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js index 6abfcd777..dcc33056f 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkList.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js @@ -84,7 +84,7 @@ function buildColumns(that, student_works) { }] if (!niPingAndIsStudent) { columns.push({ - width: 180, + width: 88, title: '学号', dataIndex: 'student_id', key: 'student_id', @@ -152,7 +152,7 @@ function buildColumns(that, student_works) { )}, }, { - width: 133, + width: 150, title: '更新时间', dataIndex: 'update_time', key: 'update_time', @@ -217,7 +217,7 @@ function buildColumns(that, student_works) { */ columns.push({ width: 84, - title:
匿评
评分
, + title:
匿评
评分
, key: 'student_score', dataIndex: 'student_score', From 7c3e91fb881a997d12d0ddefa0a96e064e2aaf5c Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 24 Jun 2019 13:52:48 +0800 Subject: [PATCH 02/17] isNiPing --- public/react/src/modules/courses/busyWork/CommonWorkList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js index dcc33056f..10f98a4ab 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkList.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js @@ -51,7 +51,7 @@ function buildColumns(that, student_works) { const isAdmin = that.props.isAdmin() const isAdminOrStudent = that.props.isAdminOrStudent() const isStudent = that.props.isStudent() - const isNiPing = homework_status.indexOf('匿评中') != -1 + const isNiPing = homework_status && homework_status.indexOf('匿评中') != -1 // https://www.trustie.net/issues/21450 分组作业作品列表 学时视角,匿评阶段的列表显示信息不正确 const niPingAndIsStudent = isStudent && isNiPing From 6103f76bc03f2adb0dad65de104d361a0d44b6c1 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 24 Jun 2019 13:56:02 +0800 Subject: [PATCH 03/17] font-14 --- .../react/src/modules/courses/busyWork/CommonWorkAppraise.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js b/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js index a43576acf..616c86f33 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js @@ -209,7 +209,7 @@ class CommonWorkAppraise extends Component{ { update_time && 更新 - {update_user_name} + {update_user_name} {moment(update_time).format('YYYY-MM-DD HH:mm')==="Invalid date"?"":moment(update_time).format('YYYY-MM-DD HH:mm')} @@ -218,7 +218,7 @@ class CommonWorkAppraise extends Component{ { commit_time && 提交 - {author_name} + {author_name} {moment(commit_time).format('YYYY-MM-DD HH:mm')==="Invalid date"?"":moment(commit_time).format('YYYY-MM-DD HH:mm')} From 453c462565902f8c2ad8db08aa49ee9e8c3acaea Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 24 Jun 2019 14:04:50 +0800 Subject: [PATCH 04/17] =?UTF-8?q?=E5=85=B1=E6=9C=891=E6=9D=A1=E5=8C=BF?= =?UTF-8?q?=E8=AF=84=E7=94=B3=E8=AF=89=EF=BC=8C0=E6=9D=A1=E5=BE=85?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/busyWork/CommonWorkList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js index 10f98a4ab..608ca36f2 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkList.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js @@ -250,7 +250,7 @@ function buildColumns(that, student_works) { { !!appeal_all_count && - {`${appeal_all_count}/${record.appeal_deal_count}`} + {`${record.appeal_deal_count}/${appeal_all_count}`} } From bc74c4ee9cd61035deebbdae2902278273567105 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 24 Jun 2019 14:38:01 +0800 Subject: [PATCH 05/17] iden --- public/react/src/common/Const.js | 24 ++++++++++++++----- .../react/src/context/TPIContextProvider.js | 17 ++++++++++++- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/public/react/src/common/Const.js b/public/react/src/common/Const.js index ed90302e3..f680cb78d 100644 --- a/public/react/src/common/Const.js +++ b/public/react/src/common/Const.js @@ -1,7 +1,19 @@ +/** +EDU_ADMIN = 1 # 超级管理员 +EDU_BUSINESS = 2 # 运营人员 +EDU_SHIXUN_MANAGER = 3 # 实训管理员 +EDU_SHIXUN_MEMBER = 4 # 实训成员 +EDU_CERTIFICATION_TEACHER = 5 # 平台认证的老师 +EDU_GAME_MANAGER = 6 # TPI的创建者 +EDU_TEACHER = 7 # 平台老师,但是未认证 +EDU_NORMAL = 8 # 普通用户 +*/ + export const EDU_ADMIN = 1 // 超级管理员 -export const EDU_SHIXUN_MANAGER = 2 // 实训管理员 -export const EDU_SHIXUN_MEMBER = 3 // 实训成员 -export const EDU_CERTIFICATION_TEACHER = 4 // 平台认证的老师 -export const EDU_GAME_MANAGER = 5 // TPI的创建者 -export const EDU_TEACHER = 6 // 平台老师,但是未认证 -export const EDU_NORMAL = 7 // 普通用户 \ No newline at end of file +export const EDU_BUSINESS = 2 // # 运营人员 +export const EDU_SHIXUN_MANAGER = 3 // 实训管理员 +export const EDU_SHIXUN_MEMBER = 4 // 实训成员 +export const EDU_CERTIFICATION_TEACHER = 5 // 平台认证的老师 +export const EDU_GAME_MANAGER = 6 // TPI的创建者 +export const EDU_TEACHER = 7 // 平台老师,但是未认证 +export const EDU_NORMAL = 8 // 普通用户 \ No newline at end of file diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js index 881a596e1..60d63a1bd 100644 --- a/public/react/src/context/TPIContextProvider.js +++ b/public/react/src/context/TPIContextProvider.js @@ -32,7 +32,7 @@ import _ from 'lodash' import TPIContext from './TPIContext' import { EDU_ADMIN, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER - , EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL} from 'educoder' + , EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL, EDU_BUSINESS} from 'educoder' import { MuiThemeProvider, createMuiTheme, withStyles } from 'material-ui/styles'; import MUIDialogStyleUtil from '../modules/page/component/MUIDialogStyleUtil' @@ -447,6 +447,18 @@ pop_box_new(htmlvalue, 480, 182); // const EDU_TEACHER = 6 // 平台老师,但是未认证 // const EDU_NORMAL = 7 // 普通用户 + + /** + EDU_ADMIN = 1 # 超级管理员 + EDU_BUSINESS = 2 # 运营人员 + EDU_SHIXUN_MANAGER = 3 # 实训管理员 + EDU_SHIXUN_MEMBER = 4 # 实训成员 + EDU_CERTIFICATION_TEACHER = 5 # 平台认证的老师 + EDU_GAME_MANAGER = 6 # TPI的创建者 + EDU_TEACHER = 7 # 平台老师,但是未认证 + EDU_NORMAL = 8 # 普通用户 + */ + // myshixun_manager power is_teacher resData.power = 0 resData.myshixun_manager = false @@ -455,6 +467,9 @@ pop_box_new(htmlvalue, 480, 182); if (resData.user.identity === EDU_ADMIN) { resData.power = 1 resData.myshixun_manager = true + } else if (resData.user.identity === EDU_BUSINESS) { + resData.power = 1 + resData.myshixun_manager = true } else if (resData.user.identity === EDU_SHIXUN_MANAGER) { resData.power = 1 resData.myshixun_manager = true From 6ad93f8cfbde997255897ddce3af74b87e31a4f8 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 24 Jun 2019 14:54:42 +0800 Subject: [PATCH 06/17] appeal_all_count --- .../react/src/modules/courses/busyWork/CommonWorkList.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js index 608ca36f2..1e8c634f6 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkList.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js @@ -31,7 +31,9 @@ function renderScore(score, content) { } else if (score >= 60) { color = '#FF6800' } - return {score == '--' ? '--': (content || score)} + return + {score == null || score == undefined || score == '--' ? '--': (content || score)} + } function getScoreTip(score, dom) { return score == '--' ? '未评分' : score == '**' ? '未公开' : dom @@ -217,7 +219,7 @@ function buildColumns(that, student_works) { */ columns.push({ width: 84, - title:
匿评
评分
, + title:
匿评
评分
, key: 'student_score', dataIndex: 'student_score', @@ -253,6 +255,7 @@ function buildColumns(that, student_works) { {`${record.appeal_deal_count}/${appeal_all_count}`} } + { !appeal_all_count && '-/-'} ), }) From 4a392e4ba386e01d2de294fd96f24648363ba4b9 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 24 Jun 2019 14:55:11 +0800 Subject: [PATCH 07/17] iden --- public/react/src/common/educoder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js index 285c9eac2..c4fd1544f 100644 --- a/public/react/src/common/educoder.js +++ b/public/react/src/common/educoder.js @@ -24,7 +24,7 @@ export { toStore as toStore, fromStore as fromStore } from './Store' export { trace_collapse, trace, debug, info, warn, error, trace_c, debug_c, info_c, warn_c, error_c } from './LogUtil' -export { EDU_ADMIN, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER +export { EDU_ADMIN, EDU_BUSINESS, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER , EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL} from './Const' export { ModalHOC } from './components/ModalHOC' From 49453d3b2a6f4825a4428e080e2127b85487c07f Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 24 Jun 2019 14:59:57 +0800 Subject: [PATCH 08/17] new --- public/react/src/modules/courses/busyWork/Index.js | 8 +------- public/react/src/modules/courses/busyWork/IndexGroup.js | 2 +- public/react/src/modules/courses/busyWork/common.js | 4 ++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/Index.js b/public/react/src/modules/courses/busyWork/Index.js index 1f03551fa..e109c36f5 100644 --- a/public/react/src/modules/courses/busyWork/Index.js +++ b/public/react/src/modules/courses/busyWork/Index.js @@ -75,12 +75,6 @@ class CoursesWorkIndex extends Component{ (props) => () } > - () - } - > - {/* 作业问答 */} () } > - () } diff --git a/public/react/src/modules/courses/busyWork/IndexGroup.js b/public/react/src/modules/courses/busyWork/IndexGroup.js index 0a4415f2f..cfe38766a 100644 --- a/public/react/src/modules/courses/busyWork/IndexGroup.js +++ b/public/react/src/modules/courses/busyWork/IndexGroup.js @@ -117,7 +117,7 @@ class CoursesWorkIndex extends Component{ (props) => () } > - () } diff --git a/public/react/src/modules/courses/busyWork/common.js b/public/react/src/modules/courses/busyWork/common.js index 902e5f34d..70e059f17 100644 --- a/public/react/src/modules/courses/busyWork/common.js +++ b/public/react/src/modules/courses/busyWork/common.js @@ -67,9 +67,9 @@ export function RouteHOC(options = {}) { this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/${_studentWorkId}/appraise`) } } - toNewPage = (courseId, workId) => { + toNewPage = (courseId) => { const secondName = this.getModuleName() - this.props.history.push(`/courses/${courseId.coursesId}/${secondName}/new`) + this.props.history.push(`/courses/${courseId.coursesId}/${secondName}/${courseId.categroy_id}/new`) } toListPage = (_courseId, _workId) => { const secondName = this.getModuleName() From 7db2a25c77b090421f9c4ea7891705ec0d18cb2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 24 Jun 2019 15:06:53 +0800 Subject: [PATCH 09/17] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E6=9D=83=E9=99=90?= =?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 | 2 +- .../tasks/GraduationTasksappraise.js | 35 +++++++++---------- .../src/modules/login/Trialapplication.js | 4 +-- public/react/src/modules/tpm/TPMBanner.js | 2 +- .../tpm/shixunchild/Challenges/Challenges.js | 10 +++--- 5 files changed, 26 insertions(+), 27 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 6c4a20fa9..61ab83126 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -31,7 +31,7 @@ export function initAxiosInterceptors(props) { // proxy = "http://testbdweb.trustie.net" // proxy = "http://testbdweb.educoder.net" proxy = "https://testeduplus2.educoder.net" - proxy="http://47.96.87.25:48080" + //proxy="http://47.96.87.25:48080" // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; // 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制 diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js index 47f38746c..2fd67bd57 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js @@ -259,26 +259,25 @@ class GraduationTasksappraise extends Component{ - +
{firelistdata===undefined?"":firelistdata.length===0?"":firelistdata.revise_attachments.map((item,key)=>{ - return( -
- - - - - {item.title} - - {item.filesize} - {item.delete===true?:""} - -
- ) - })} - - + return( + + + + + + {item.title} + + {item.filesize} + {item.delete===true?:""} + + ) + })} + +
diff --git a/public/react/src/modules/login/Trialapplication.js b/public/react/src/modules/login/Trialapplication.js index 77abca50c..283574938 100644 --- a/public/react/src/modules/login/Trialapplication.js +++ b/public/react/src/modules/login/Trialapplication.js @@ -34,8 +34,8 @@ class Trialapplication extends Component { showTrial: false, } //user_phone_binded 判断是否手机号验证 - console.log("Trialapplication"); - console.log(props); + // console.log("Trialapplication"); + // console.log(props); } Cancel = () => { diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index 51d4cee9f..82c18a09d 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -640,7 +640,7 @@ class TPMBanner extends Component { className="fr user_default_btn task-btn-orange font-18" id="shixun_operation" data-remote="true" > - {shixunsDetails.task_operation === undefined ? "" : shixunsDetails.status > 1 ? shixunsDetails.task_operation[0] : "模拟实战"} + {shixunsDetails.task_operation === undefined ? "" : shixunsDetails.task_operation[0]} : "" diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js index 73dcb0b49..49d7cf016 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js @@ -359,7 +359,7 @@ class Challenges extends Component { {item.delete_url != undefined && this.delOperations(item.challenge_id)} - style={{ display: this.props.identity < 4 && this.props.status === 0 ? "block" : 'none' }} + style={{ display:this.props.user.admin===true?"block":this.props.identity < 4 && this.props.status === 0 ? "block" : 'none' }} className="fl ring-op-green mr25"> @@ -371,7 +371,7 @@ class Challenges extends Component { {item.up_url != undefined && this.operations(item.challenge_id, "up")} - style={{ display: this.props.identity < 4 && this.props.status === 0 ? "block" : 'none' }} + style={{ display:this.props.user.admin===true?"block":this.props.identity < 4 && this.props.status === 0 ? "block" : 'none' }} className="fl ring-op-green mr25"> @@ -381,7 +381,7 @@ class Challenges extends Component { {item.down_url != undefined && this.operations(item.challenge_id, "down")} - style={{ display: this.props.identity < 4 && this.props.status === 0 ? "block" : 'none' }} + style={{ display: this.props.user.admin===true?"block":this.props.identity < 4 && this.props.status === 0 ? "block" : 'none' }} className="fl ring-op-green mr25"> @@ -393,7 +393,7 @@ class Challenges extends Component { item.st === 1 ? Date: Mon, 24 Jun 2019 15:35:35 +0800 Subject: [PATCH 10/17] =?UTF-8?q?=E7=AB=8B=E5=8D=B3=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/busyWork/PublishRightnow.js | 6 +++--- public/react/src/modules/courses/busyWork/common.js | 2 +- public/react/src/modules/courses/busyWork/commonWork.js | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/PublishRightnow.js b/public/react/src/modules/courses/busyWork/PublishRightnow.js index b4576f58d..da2054124 100644 --- a/public/react/src/modules/courses/busyWork/PublishRightnow.js +++ b/public/react/src/modules/courses/busyWork/PublishRightnow.js @@ -52,9 +52,9 @@ class PublishRightnow extends Component{ modalname: isPublish ? "立即发布" : "立即截止", modaltype:1, visible:true, - Topval: isPublish ? "本操作只对“未发布”的对象生效" : "本操作只对“提交中”的对象生效", - Botvalleft: isPublish ? "暂不发布" : "暂不截止", - Botval: isPublish ? "则通过后续手动设置,定时发布" : "则将根据已设置的截止时间,定时截止", + Topval: isPublish ? "学生将立即收到作业" : "学生将不能再提交作品", + // Botvalleft: isPublish ? "暂不发布" : "暂不截止", + Botval: this.props.fromListPage ? (isPublish ? "本操作只对“未发布”的分班有效" : "本操作只对“提交中”的分班有效") : '', starttime: isPublish ? `发布时间:${startMoment.format(dateFormat)}` : '', starttimes:isPublish ? `${startMoment.format(dateFormat)}` : '', endtime: isPublish ? `截止时间:${startMoment.add(1, 'months').add(1, 'hours').minutes(0).format(dateFormat)}` : '', diff --git a/public/react/src/modules/courses/busyWork/common.js b/public/react/src/modules/courses/busyWork/common.js index 70e059f17..61bd7fcee 100644 --- a/public/react/src/modules/courses/busyWork/common.js +++ b/public/react/src/modules/courses/busyWork/common.js @@ -69,7 +69,7 @@ export function RouteHOC(options = {}) { } toNewPage = (courseId) => { const secondName = this.getModuleName() - this.props.history.push(`/courses/${courseId.coursesId}/${secondName}/${courseId.categroy_id}/new`) + this.props.history.push(`/courses/${courseId.coursesId}/${secondName}/${courseId.category_id}/new`) } toListPage = (_courseId, _workId) => { const secondName = this.getModuleName() diff --git a/public/react/src/modules/courses/busyWork/commonWork.js b/public/react/src/modules/courses/busyWork/commonWork.js index b0b80d147..18c668efe 100644 --- a/public/react/src/modules/courses/busyWork/commonWork.js +++ b/public/react/src/modules/courses/busyWork/commonWork.js @@ -75,7 +75,6 @@ class commonWork extends Component{ } componentDidUpdate(prevProps, prevState) { - debugger; if (prevProps.match.path != this.props.match.path) { this.componentDidMount() } @@ -198,6 +197,7 @@ class commonWork extends Component{ this.clearSelection() let {search,order}=this.state; this.getList(1,search,order); + this.props.updataleftNavfun() } console.log(response) }).catch((error) => { @@ -395,11 +395,11 @@ class commonWork extends Component{
  • + isPublish={true} doWhenSuccess={this.doWhenSuccess} fromListPage={true}>
  • + isPublish={false} doWhenSuccess={this.doWhenSuccess} fromListPage={true}>
  • { !!course_public &&
  • 设为公开
  • } From 7145037a53db1c5336310ab0cfd33bf426f05171 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 24 Jun 2019 15:44:15 +0800 Subject: [PATCH 11/17] =?UTF-8?q?=E6=96=87=E5=AD=97=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/busyWork/CommonWorkQuestion.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkQuestion.js b/public/react/src/modules/courses/busyWork/CommonWorkQuestion.js index 2c1902e59..7932311b1 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkQuestion.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkQuestion.js @@ -101,14 +101,13 @@ class CommonWorkQuestion extends Component{ {isGroup &&
    -
    分组要求:
    -
    分组人数: {group_info.min_num} - {group_info.max_num} 人
    -
    {group_info.base_on_project ? '基于项目实施' : '不基于项目实施'}:
    +
    分组要求: {group_info.min_num} ~ {group_info.max_num}
    +
    {group_info.base_on_project ? '基于项目实施' : '不基于项目'}:
    -
    (提交作品时需要关联同组成员,组内成员作品共享)
    -
    ({group_info.base_on_project ? '基于项目,则项目管理员角色的成员可以提交作品' : '非基于项目,则任意小组成员可以提交作品'})
    -
    (各小组必须在educoder平台创建项目)
    +
    (学生提交作品时需要关联同组成员,组内成员作品共享)
    +
    ({group_info.base_on_project ? '学生必须在本平台创建项目,项目管理员可以提交作品' : '无需再平台创建项目,任意小组成员均可以提交作品'})
    + {/*
    (各小组必须在educoder平台创建项目)
    */}
    } From 8d637c79e802cfd7aacfc67c4967c85e1365671a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 24 Jun 2019 15:57:29 +0800 Subject: [PATCH 12/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9E=E8=AE=AD?= =?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 --- .../modules/tpm/TPMsettings/TPMsettings.js | 3469 +++++++++-------- 1 file changed, 1736 insertions(+), 1733 deletions(-) diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js index e2d14127e..351a461f4 100644 --- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js +++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js @@ -1,1733 +1,1736 @@ -import React, { Component } from 'react'; - -import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker} from 'antd'; - -// import "antd/dist/antd.css"; - -import locale from 'antd/lib/date-picker/locale/zh_CN'; - -import moment from 'moment'; - -import axios from 'axios'; - -import './css/TPMsettings.css'; - -import { getImageUrl, toPath, getUrl } from 'educoder'; - -let origin = getUrl(); - -let path = getUrl("/editormd/lib/") - -const $ = window.$; - -let timeout; - -let currentValue; - -const Option = Select.Option; - -const RadioGroup = Radio.Group; - -// 恢复数据 -function md_rec_data(k,mdu,id, editor){ - if(window.sessionStorage.getItem(k+mdu) !== null){ - editor.setValue(window.sessionStorage.getItem(k+mdu)); - md_clear_data(k,mdu,id); - } -} - -// 保存数据 -function md_add_data(k,mdu,d){ - window.sessionStorage.setItem(k+mdu,d); -} - -// 清空保存的数据 -function md_clear_data(k,mdu,id){ - window.sessionStorage.removeItem(k+mdu); - var id1 = "#e_tip_"+id; - var id2 = "#e_tips_"+id; - if(k == 'content'){ - $(id2).html(""); - }else{ - $(id1).html(""); - } -} - -function md_elocalStorage(editor,mdu,id){ - if (window.sessionStorage){ - var oc = window.sessionStorage.getItem('content'+mdu); - if(oc !== null ){ - $("#e_tips_"+id).data('editor', editor); - var h = '您上次有已保存的数据,是否恢复 ? / 不恢复'; - $("#e_tips_"+id).html(h); - } - setInterval(function() { - var d = new Date(); - var h = d.getHours(); - var m = d.getMinutes(); - var s = d.getSeconds(); - h = h < 10 ? '0' + h : h; - m = m < 10 ? '0' + m : m; - s = s < 10 ? '0' + s : s; - if(editor.getValue().trim() != ""){ - md_add_data("content",mdu,editor.getValue()); - var id1 = "#e_tip_"+id; - var id2 = "#e_tips_"+id; - - $(id1).html(" 数据已于 " + h + ':' + m + ':' + s +" 保存 "); - $(id2).html(""); - } - },10000); - - }else{ - $("#e_tip_"+id).after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!'); - } -} - -function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callback) { - var editorName = window.editormd(id, { - width: width, - height: high, - path: path, // "/editormd/lib/" - markdown : initValue, - syncScrolling: "single", - tex: true, - tocm: true, - emoji: true, - taskList: true, - codeFold: true, - searchReplace: true, - htmlDecode: "style,script,iframe", - sequenceDiagram: true, - autoFocus: false, - placeholder: placeholder, - toolbarIcons: function () { - // Or return editormd.toolbarModes[name]; // full, simple, mini - // Using "||" set icons align right. - return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"] - }, - toolbarCustomIcons: { - testIcon: "
    ", - testIcon1: "
    " - }, - //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 - saveHTMLToTextarea: true, - // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 - dialogMaskOpacity: 0.6, - imageUpload: true, - imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], - imageUploadURL: imageUrl,//url - onload: function () { - // this.previewing(); - $("#" + id + " [type=\"latex\"]").bind("click", function () { - editorName.cm.replaceSelection("```latex"); - editorName.cm.replaceSelection("\n"); - editorName.cm.replaceSelection("\n"); - editorName.cm.replaceSelection("```"); - var __Cursor = editorName.cm.getDoc().getCursor(); - editorName.cm.setCursor(__Cursor.line - 1, 0); - }); - - $("#" + id + " [type=\"inline\"]").bind("click", function () { - editorName.cm.replaceSelection("$$$$"); - var __Cursor = editorName.cm.getDoc().getCursor(); - editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); - editorName.cm.focus(); - }); - $("[type=\"inline\"]").attr("title", "行内公式"); - $("[type=\"latex\"]").attr("title", "多行公式"); - - callback && callback() - } - }); - return editorName; -} - - -function 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"); - $('#collaborators_list_info').show() - }, 200) -} - - -export default class TPMsettings extends Component { - constructor(props) { - super(props) - this.state = { - commandLine: 0, - Openpublic: 0, - settingsData: undefined, - webssh: 0, - use_scope: 0, - shixunsstatus: 0, - shixunsID: undefined, - exec_time: undefined, - trainee: undefined, - can_copy: undefined, - task_pass: undefined, - test_set_permission: undefined, - hide_code: undefined, - code_hidden: undefined, - forbid_copy: undefined, - vnc: undefined, - name: undefined, - scope_partment: undefined, - scopetype: false, - departmentslist: undefined, - description: '', - evaluate_script:undefined, - standard_scripts: undefined, - choice_main_type: "", - choice_small_type: [""], - choice_standard_scripts:undefined, - editordescriptios: undefined, - editorevaluate_scripts: undefined, - choice_standard_scriptssum: undefined, - visibleTemplate: false, - Executiveordervalue: "", - Compilecommandvalue: "", - Executivetyoe: false, - postapplyvisible: false, - sendsure_applyvalue: undefined, - postapplytitle: false, - shixunnametype: false, - shixunmaintype: false, - evaluate_scripttype: false, - exec_timetype: false, - traineetype: false, - standard_scriptsModal:false, - standard_scriptsModals:false, - SelectTheCommandtype:false, - multi_webssh:false, - status:0, - opers:false, - operss:false, - testscripttiptype:false, - opersss:false, - operateshixunstype:false, - opening_time:"", - opensmail:false, - scope_partmenttype:false, - newuse_scope:undefined, - scope_partments:0, - - pod_exist_time: undefined, - pod_exist_timetype: false, - shixunmemoMDvalue:"" - } - } - descriptionMD=(initValue, id)=> { - - this.contentChanged = false; - const placeholder = ""; -// amp; -// 编辑时要传memoId - const imageUrl = `/api/attachments.json`; -// 创建editorMd - - const description_editormd =create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue,()=> { - setTimeout(() => { - description_editormd.resize() - description_editormd.cm && description_editormd.cm.refresh() - }, 500) - - if (initValue != undefined) { - description_editormd.setValue(initValue) - } - description_editormd.cm.on("change", (_cm, changeObj) => { - console.log('....contentChanged') - this.contentChanged = true; - }) - }); - md_elocalStorage(description_editormd, `MemoQuestion_${id}`, `${id}Question`); - this.description_editormd = description_editormd; - window.description_editormd = description_editormd; - } - - evaluate_scriptMD=(initValue, id)=> { - this.contentChanged = false; - const placeholder = ""; -// amp; -// 编辑时要传memoId - const imageUrl = `/api/attachments.json`; -// 创建editorMd - - const evaluate_script_editormd =create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue,()=> { - setTimeout(() => { - evaluate_script_editormd.resize() - evaluate_script_editormd.cm && evaluate_script_editormd.cm.refresh() - }, 500) - - if (initValue != undefined) { - evaluate_script_editormd.setValue(initValue) - } - evaluate_script_editormd.cm.on("change", (_cm, changeObj) => { - console.log('....contentChanged') - this.contentChanged = true; - }) - }); - md_elocalStorage(evaluate_script_editormd, `MemoQuestion_${id}`, `${id}Question`); - this.evaluate_script_editormd = evaluate_script_editormd; - window.evaluate_script_editormd = evaluate_script_editormd; - - } - - - - componentDidMount() { - - let id=this.props.match.params.shixunId; - - let Url=`/shixuns/`+id+`/settings.json`; - - axios.get(Url).then((response)=> { - // alert(response.data.shixun.choice_standard_scripts) - if(response.status===200){ - this.setState({ - shixunsID: id, - settingsData: response.data, - webssh: response.data.shixun.webssh, - use_scope: response.data.shixun.use_scope, - shixunsstatus: response.data.shixun.status, - exec_time: response.data.shixun.exec_time, - trainee: response.data.shixun.trainee, - can_copy: response.data.shixun.can_copy, - task_pass: response.data.shixun.task_pass, - test_set_permission: response.data.shixun.test_set_permission, - hide_code: response.data.shixun.hide_code, - code_hidden: response.data.shixun.code_hidden, - forbid_copy: response.data.shixun.forbid_copy, - vnc: response.data.shixun.vnc, - name: response.data.shixun.name, - scope_partment: response.data.shixun.scope_partment, - description: response.data.shixun.description, - evaluate_script: response.data.shixun.evaluate_script, - choice_main_type: response.data.shixun.choice_main_type, - choice_small_type: response.data.shixun.choice_small_type, - choice_standard_scripts: response.data.shixun.choice_standard_scripts, - standard_scripts:response.data.shixun.standard_scripts, - multi_webssh:response.data.shixun.multi_webssh, - status:response.data.shixun.status, - opening_time:response.data.shixun.opening_time, - newuse_scope:response.data.shixun.use_scope, - scope_partments: response.data.shixun.scope_partment.length, - shixunmemoMDvalue:response.data.shixun.evaluate_script - }) - - // if(response.data.status===403){ - // message: "您没有权限进行该操作" - // this.setState({ - // :true - // message403:response.data.message - // }) - // } - - - if(response.data.shixun.multi_webssh===true){ - this.setState({ - SelectTheCommandtype:true - }) - }else{ - this.setState({ - SelectTheCommandtype:false - }) - } - if (response.data.shixun.scope_partment.length > 0) { - this.setState({ - scopetype: true - }) - } - // console.log(response.data.shixun.description) - // console.log(response.data.shixun.evaluate_script) - // console.log(response.data.shixun.description) - // this.props.identity<4&&this.props.status==0||this.props.identity===1&&this.props.status==2 - - - // this.evaluate_scriptMD(response.data.shixun.evaluate_script, "shixunmemoMD"); - - this.descriptionMD(response.data.shixun.description, "shixundescription"); - // if (response.data.shixun.status === 2) { - // - // } else if (response.data.shixun.status === 1) { - // this.props.showSnackbar("这个实训已发布不能修改!"); - // } else if (response.data.shixun.status === 3) { - // this.props.showSnackbar("这个实训已关闭不能修改!"); - // } - } - - }); - - - let departmentsUrl = `/shixuns/departments.json`; - axios.get(departmentsUrl).then((response) => { - if (response.status === 200) { - this.setState({ - departmentslist: response.data.shools_name - }); - } - }).catch((error) => { - console.log(error) - }); - - - - } - - SelectshixunCommand=(e)=>{ - // console.log( e.target.value) - this.setState({ - webssh: e.target.value, - }); - if(e.target.value===2){ - this.setState({ - SelectTheCommandtype: true, - multi_webssh:false - }); - }else{ - this.setState({ - SelectTheCommandtype: false, - multi_webssh:false - }); - } - } - - SelectOpenpublic=(e)=>{ - this.setState({ - Openpublic: e.target.value - }); - } - - can_copy=(e)=>{ - let sum = "" - if (e.target.checked === false) { - sum = 0 - } else if (e.target.checked === true) { - sum = 1 - } - this.setState({ - can_copy: sum, - }); - - } - - task_pass=(e)=>{ - - let sum = "" - if (e.target.checked === false) { - sum = 0 - } else if (e.target.checked === true) { - sum = 1 - } - this.setState({ - task_pass: sum, - }); - } - - test_set_permission=(e)=>{ - let sum = "" - if (e.target.checked === false) { - sum = 0 - } else if (e.target.checked === true) { - sum = 1 - } - this.setState({ - test_set_permission: sum, - }); - - } - - hide_code=(e)=>{ - let sum = "" - if (e.target.checked === false) { - sum = 0 - } else if (e.target.checked === true) { - sum = 1 - } - this.setState({ - hide_code: sum, - }); - - } - - code_hidden=(e)=>{ - let sum = "" - if (e.target.checked === false) { - sum = 0 - } else if (e.target.checked === true) { - sum = 1 - } - this.setState({ - code_hidden: sum, - }); - - } - forbid_copy = (e) => { - let sum = "" - if (e.target.checked === false) { - sum = 0 - } else if (e.target.checked === true) { - sum = 1 - } - this.setState({ - forbid_copy: sum, - }); - } - - shixun_vnc=(e)=>{ - let sum = "" - if (e.target.checked === false) { - sum = 0 - } else if (e.target.checked === true) { - sum = 1 - } - this.setState({ - vnc: sum, - }); - - } - shixunsname = (e) => { - // let {shixunsstatus}=this.state; - // if(shixunsstatus>0){ - // return - // } - this.setState({ - name: e.target.value, - shixunnametype:false - }) - } - - bigClass = (value) => { - let url = `/shixuns/get_mirror_script.json?mirror_id=`+value; - axios.get(url).then((response) => { - if (response.status === 200) { - // console.log(response.data) - this.setState({ - choice_main_type: value, - standard_scripts:response.data, - choice_standard_scripts:null - }) - } - }).catch((error) => { - console.log(error) - }); - - - - } - - littleClass = (value) => { - this.setState({ - choice_small_type: value - }) - } - onPodExistTimeChange = (e) => { - this.setState({ - pod_exist_time: e.target.value, - pod_exist_timetype: false, - }) - } - Timevalue = (e) => { - this.setState({ - exec_time: e.target.value - }) - } - SelectOpenpublic = (e) => { - this.setState({ - scopetype: false, - use_scope: e.target.value, - }); - if (e.target.value === 1) { - this.setState({ - scopetype: true - }); - } - - } - deleteScopeInput = (key) => { - let {scope_partment} = this.state; - let datalist = scope_partment; - datalist.splice(key, 1); - this.setState({ - scope_partment: datalist - }); - } - - shixunScopeInput = (e) => { - let {scope_partment} = this.state; - let datalist = scope_partment; - if (datalist===undefined) { - datalist=[] - } - - datalist.push(e) - // else { - // datalist[id] = e - // } - this.setState({ - scope_partment: datalist - }); - } - // adduse_scopeinput = () => { - // let {scope_partment} = this.state; - // let array = scope_partment; - // let newarray = "" - // array.push(newarray) - // this.setState({ - // scope_partment: array, - // }); - // } - submit_edit_shixun = () => { - let { - name, description, choice_main_type, choice_small_type, choice_standard_scripts, scope_partment, choice_standard_scriptssum, - evaluate_script, exec_time, webssh, use_scope, trainee, can_copy, task_pass, test_set_permission, hide_code, code_hidden, forbid_copy, vnc,multi_webssh, - opening_time, pod_exist_time,shixunmemoMDvalue - } = this.state; - let operateauthority=this.props.identity<4&&this.props.status==0||this.props.identity===1&&this.props.status==2||this.props.identity===1&&this.props.status==1; - - const description_editormd = this.description_editormd.getValue(); - - let evaluate_script_editormd; - - if(operateauthority===true){ - // evaluate_script_editormd = this.evaluate_script_editormd.getValue(); - evaluate_script_editormd = shixunmemoMDvalue - }else{ - evaluate_script_editormd = evaluate_script; - } - - - if (name === "") { - this.setState({ - shixunnametype: true - }) - $('html').animate({ - scrollTop: 10 - }, 1000); - return - } - if (choice_main_type === "") { - this.setState({ - shixunmaintype: true - }) - $('html').animate({ - scrollTop: 800 - }, 1000); - return - } - if (evaluate_script_editormd === "") { - this.setState({ - evaluate_scripttype: true - }) - $('html').animate({ - scrollTop: 1200 - }, 1000); - return - } - if(use_scope===1){ - - if(scope_partment===undefined||scope_partment.length===0){ - this.setState({ - scope_partmenttype: true - }) - $('html').animate({ - scrollTop: 2500 - }, 1000); - this.props.showSnackbar("公开程度,指定单位为空"); - return - } - } - if (exec_time === "") { - this.setState({ - exec_timetype: true - }) - $('html').animate({ - scrollTop: 1500 - }, 1000); - return - } - - // if (!pod_exist_time) { - // this.setState({ - // pod_exist_timetype: true - // }) - // $("html, body").animate({ scrollTop: $('#pod_exist_time').offset().top - 100 }, 1000) - // return - // } - - if (trainee === "") { - this.setState({ - traineetype: true - }) - return - } - - let id = this.props.match.params.shixunId; - - let newmulti_webssh=multi_webssh; - if(newmulti_webssh===true){ - newmulti_webssh=1 - }else{ - newmulti_webssh=0 - } - - if(newmulti_webssh===null){ - newmulti_webssh=0 - } - - let Url = `/shixuns/` + id + `.json`; - let data = { - name: name, - description: description_editormd, - main_type: choice_main_type, - small_type: choice_small_type, - webssh: webssh, - user_scope: use_scope, - scope_partment: scope_partment, - can_copy: can_copy, - vnc: vnc, - test_set_permission: test_set_permission, - code_hidden: code_hidden, - trainee: trainee, - task_pass: task_pass, - standard_scripts: choice_standard_scripts, - hide_code: hide_code, - forbid_copy: forbid_copy, - exec_time: exec_time, - evaluate_script: evaluate_script_editormd, - multi_webssh:newmulti_webssh, - opening_time:opening_time, - mirror_script_id:choice_standard_scriptssum, - delType:1 - } - - axios.put(Url, data).then((response) => { - // console.log(response) - if(response.status){ - if (response.data.status === -1) { - this.props.showSnackbar(response.data.message); - return - } else { - window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges"; - } - } - - }).catch((error) => { - console.log(error) - }) - - - } - shixunsfetch = (value, callback) => { - if (timeout) { - clearTimeout(timeout); - timeout = null; - } - currentValue = value; - - function fake() { - let departmentsUrl = `/shixuns/departments.json?q=` + currentValue; - axios.get(departmentsUrl).then((response) => { - callback(response.data.shools_name); - }).catch((error) => { - console.log(error) - }); - } - - timeout = setTimeout(fake, 300); - } - shixunHandleSearch = (value) => { - this.shixunsfetch(value, departmentslist => this.setState({departmentslist})); - } - - - - - shixunsclose = () => { - let id = this.props.match.params.shixunId; - let cul = `/shixuns/` + id + `/close.json`; - axios.post(cul).then((response) => { - if(response.data.status===1){ - this.props.showSnackbar("操作成功"); - this.setState({ - operateshixunstype: false, - }); - - window.location.href = "/shixuns/" + id + "/challenges"; - } - }).catch((error) => { - console.log(error) - }) - } - - shixunsdel= () => { - let id = this.props.match.params.shixunId; - let cul = `/shixuns/` + id +`.json`; - - axios.delete(cul).then((response) => { - if(response.data.status===1){ - this.props.showSnackbar("操作成功"); - this.setState({ - operateshixunstype: false, - }); - - window.location.href = "/shixuns"; - } - }).catch((error) => { - console.log(error) - }) - } - - Executiveorder = (e) => { - this.setState({ - Executiveordervalue: e.target.value - }) - } - - Compilecommand = (e) => { - this.setState({ - Compilecommandvalue: e.target.value - }) - } - - handleCancelTemplate = (e) => { - this.setState({ - Executiveordervalue: "", - Compilecommandvalue: "", - visibleTemplate: false - }) - } - - hideModalTemplate = (e) => { - let id = this.props.match.params.shixunId; - let {Executiveordervalue, Compilecommandvalue} = this.state; - - if (Executiveordervalue === "") { - this.setState({ - Executivetyoe: true, - }); - return - } - // Executiveordervalue=String(Executiveordervalue); - // Compilecommandvalue=String(Compilecommandvalue); - let trl = `/shixuns/${id}/get_custom_script.json?compile=${Executiveordervalue}&excutive=${Compilecommandvalue}` - axios.get(trl).then((response) => { - // this.evaluate_scriptMD(response.data.shixun_script, "shixunmemoMD"); - this.setState({ - shixunmemoMDvalue:response.data.shixun_script - }) - }).catch((error) => { - console.log(error) - }); - this.setState({ - visibleTemplate: false - }) - } - - showModal = () => { - this.setState({ - visibleTemplate: true, - }); - } - Selecttrainee = (value) => { - this.setState({ - trainee: value, - }); - } - - post_apply = () => { - this.setState({ - postapplyvisible: true - }) - } - - sendsure_applyvalues = (e) => { - this.setState({ - sendsure_applyvalue: e.target.value - }) - } - - sendsure_apply = () => { - let {sendsure_applyvalue} = this.state; - let url = "/shixuns/apply_shixun_mirror.json"; - axios.post(url, { - note: sendsure_applyvalue - }).then((response) => { - if (response.status === 200) { - if (response.data.status == 1) { - this.setState({ - postapplyvisible: false, - postapplytitle: true - }) - } - - } - }).catch((error) => { - console.log(error) - }); - - } - - sendhideModaly = () => { - this.setState({ - postapplyvisible: false - }) - } - - yeshidemodel = () => { - this.setState({ - postapplytitle: false - }) - } - - SelectScput = (value, e) => { - this.setState({ - choice_standard_scriptssum: value, - choice_standard_scripts: {id:e.props.value,value:""}, - standard_scriptsModal:true - }) - } - - hidestandard_scriptsModal=()=>{ - this.setState({ - standard_scriptsModal:false, - standard_scriptsModals:false - }) - } - - get_mirror_script=()=>{ - let {choice_standard_scriptssum}=this.state; - let id = this.props.match.params.shixunId; - let pul = "/shixuns/" + id + "/get_script_contents.json?script_id=" + choice_standard_scriptssum; - axios.get(pul).then((response) => { - if(response.status===200){ - // this.evaluate_scriptMD(response.data.content, "shixunmemoMD"); - this.setState({ - standard_scriptsModal:false, - standard_scriptsModals:true, - shixunmemoMDvalue:response.data.content - }) - } - - }).catch((error) => { - console.log(error) - }) - } - - - SelectTheCommandonChange=(e)=>{ - this.setState({ - multi_webssh:e.target.checked - }) - } - - bigopen=()=>{ - this.setState({ - opers:true - }) - } - - bigopens=()=>{ - this.setState({ - opers:false, - operss:false, - opersss:false, - opensmail:false - }) - } - bigopensmal=()=>{ - this.setState({ - opensmail:true - }) - } - sbigopen=()=>{ - this.setState({ - operss:true - }) - } - - sbigopens=()=>{ - this.setState({ - operss:false - }) - } - sbigopenss=()=>{ - this.setState({ - opersss:true - }) - } - - sbigopensss=()=>{ - this.setState({ - opersss:false - }) - } - testscripttip=(val)=>{ - if(val===0){ - this.setState({ - testscripttiptype:true - }) - }else if(val===1){ - this.setState({ - testscripttiptype:false - }) - } - } - - operateshixuns=(value)=>{ - this.setState({ - operateshixunstype:true, - delType:value - }) - } - - hideoperateshixuns=()=>{ - this.setState({ - operateshixunstype:false - }) - } - onChangeTimePicker =(value, dateString)=> { - this.setState({ - opening_time:dateString - }) - } - - getshixunmemoMDvalue=(e)=>{ - this.setState({ - shixunmemoMDvalue:e.target.value - }) - } - render() { - let { - postapplyvisible, - sendsure_applyvalue, - postapplytitle, - shixunnametype, - shixunmaintype, - evaluate_scripttype, - exec_timetype, - traineetype, - standard_scripts, - description, - evaluate_script, - name, - settingsData, - webssh, - use_scope, - shixunsstatus, - shixunsID, - exec_time, - pod_exist_time, - pod_exist_timetype, - can_copy, - choice_standard_scripts, - Executiveordervalue, - Executivetyoe, - Compilecommandvalue, - task_pass, - test_set_permission, - hide_code, - forbid_copy, - code_hidden, - vnc, - scopetype, - scope_partment, - departmentslist, - trainee, - choice_main_type, - choice_small_type, - standard_scriptsModal, - standard_scriptsModals, - SelectTheCommandtype, - status, - opers, - operss, - opersss, - testscripttiptype, - operateshixunstype, - opening_time, - opensmail, - scope_partmenttype, - newuse_scope, - scope_partments, - shixunmemoMDvalue,delType - } = this.state; - - let options; - - if (departmentslist != undefined) { - options = this.state.departmentslist.map((d, k) => { - return ( - - ) - }) - } - - const dateFormat = 'YYYY-MM-DD HH:mm:ss'; - let operateauthority=this.props.identity<4&&this.props.status==0||this.props.identity===1&&this.props.status==2||this.props.identity===1&&this.props.status==1; - - return ( -
    -
    -
    - 配置 - { - this.props.identity===1&&this.props.status==2? - this.operateshixuns(2)}> - 永久关闭 - :"" - } - { - this.props.identity < 4 && this.props.status==0? - this.operateshixuns(1)}> - 删除实训 - :"" - } - { - this.props.identity == 1 && this.props.status == 2 ? - this.operateshixuns(1)}> - 删除实训 - :"" - } - - -
    - {delType===1?

    是否确认删除 ?

    :

    关闭后,
    用户不能再开始挑战了是否确认关闭 ?

    } -
    -
    - 取消 - {delType===2?确定:确定} -
    -
    - -
    - -
    - -

    实训名称

    - -
    - * -
    -
    - {settingsData === undefined ? "" : - } -
    -
    - 必填项 -
    -
    - - -
    - -
    -
    - -
    - -

    简介

    - -
    - -
    -
    -
    -

    -

    -
    - -
    -
    -

    技术平台

    - - -
    - * -
    - -

    - 列表中没有? - 申请新建 -

    - - - - - - -
    -

    新建申请已提交,请等待管理员的审核

    -
  • 我们将在1-2个工作日内与您联系 -
  • -
    -
    - 知道啦 -
    -
    -
    -
    - -
    - -
    -
    - 必填项 -
    - {/*

    请在配置页面完成后续的评测脚本设置操作

    */} - -
    -
    -
    -
    -
    -

    评测脚本

    -
    - - -
    -

    原有脚本将被新的脚本覆盖,无法撤销

    -

    是否确认执行覆盖操作

    -
    - - -
    - - -

    评测脚本生成成功!

    - -
    - - { - this.props.identity<4||this.props.power==true? - 使用自定义脚本 : "" - } - - - -
    -
  • - - -

    执行命令不能为空

    -
  • - -
  • - - -
  • -
    -
    -
    -
    - -
    -
    - * -
    - - -
    - -
    - - - {/*
    */} - {/*{evaluate_script===undefined?"":evaluate_script}*/} - - {/*
    */} - - -
    - this.testscripttip(0)}> -
    - -
    -

    - 使用自定义模板,平台无法自动更新脚本,
    - 请在关卡创建完后手动更新脚本中的必填参
    - 数和以下2个数组元素:
    - challengeProgramNames
    - sourceClassNames

    - 示例:有2个关卡的实训

    - 各关卡的待编译文件为:
    - src/step1/HelloWorld.java
    - src/step2/Other.java

    - 各关卡的编译后生成的执行文件为:
    - step1.HelloWorld
    - step2.Other

    - 则数组元素更新如下:
    - challengeProgramNames=("src/step1/
    - HelloWorld.java" "src/step2/Other.java")
    - sourceClassNames=("step1.HelloWorld
    - " "step2.Other")

    - 其它参数可按实际需求定制 -

    -
    -

    - this.testscripttip(1)}>知道了 -

    -
    -
    -
    - -
    -
    -
    - - 必填项 -
    -

    -

    -
    -
    - -
    - * - -

    程序最大执行时间

    - - - -
    - 必填项 -
    -
    - - {/*
    - * - -

    Pod存活时间

    - - - -
    - 必填项 -
    -
    */} - - -
    -

    命令行

    - - 无命令行窗口 (选中则不给学员的实践任务提供命令窗口) - 命令行练习窗口 (选中则给学员提供用于练习操作的命令行窗口) - 命令行评测窗口 (选中则给学员提供用于关卡评测的命令行窗口) - - 多个命令行窗口(选中则允许学员同时开启多个命令行窗口) - - -
    - -
    -

    公开程度

    - - 对所有公开 (选中则所有已被试用授权的用户可以学习) - 对指定单位公开 (选中则下方指定单位的已被试用授权的用户可以学习) - - -
    -
    -
    -
    -
    - -
    - (搜索并选中添加单位名称) -
    - {/*+*/} - {/*添加*/} -
    - -
    - - {/*{*/} - {/*scope_partment===undefined?"":scope_partment.map((item,key)=>{*/} - {/*return(*/} - {/*
    */} - {/*this.deleteScopeInput(key)} style={{ color: 'rgba(0,0,0,.25)' }} />}*/} - {/*value={item}*/} - {/*/>*/} - {/*
    */} - - {/*)*/} - {/*})*/} - {/*}*/} -
    - - - 请选择需要公开的单位 - -
    -
    -
    - -
    -

    发布信息

    - -
    - * - 面向学员: - -
    - -
    - 实训难易度定位,不限定用户群体 -
    - 必填项 -
    - -
    -
    - 复制: - - - - -
    - -
    - 跳关: - - - - -
    -
    - 测试集解锁: - - - - -
    - -
    - 隐藏代码窗口: - - - - -
    - -
    - 代码目录隐藏: - - - - -
    - -
    - 禁用复制粘贴: - - - - -
    - -
    - 开启时间: - - - - -
    - {/*
    */} - {/*VNC图形化:*/} - {/**/} - {/**/} - {/**/} - {/**/} - {/*
    */} - -
    - -

    - { - // this.props.identity<4&&this.props.status==0? - this.props.identity<4? -

    - 保存 - 取消 -
    :"" - } - {/*{*/} - {/*this.props.identity===1&&this.props.status==2?*/} - {/*
    */} - {/*保存*/} - {/*取消*/} - {/*/!**!/*/} - {/*/!*永久关闭*!/*/} - {/*/!**!/*/} - {/*
    :""*/} - {/*}*/} - - - - - {/*{*/} - {/*this.props.identity===1||this.props.power==true?*/} - {/*
    */} - {/*保存*/} - {/*取消*/} - {/**/} - {/**/} - {/*{status===0?"":"永久关闭"}*/} - {/**/} - {/**/} - {/*
    :""*/} - - {/*}*/} - {/*
    */} - {/*保存*/} - {/*取消*/} - {/*
    */} -

    - -
    - ); - } -} - - +import React, { Component } from 'react'; + +import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker} from 'antd'; + +// import "antd/dist/antd.css"; + +import locale from 'antd/lib/date-picker/locale/zh_CN'; + +import moment from 'moment'; + +import axios from 'axios'; + +import './css/TPMsettings.css'; + +import { getImageUrl, toPath, getUrl } from 'educoder'; + +let origin = getUrl(); + +let path = getUrl("/editormd/lib/") + +const $ = window.$; + +let timeout; + +let currentValue; + +const Option = Select.Option; + +const RadioGroup = Radio.Group; + +// 恢复数据 +function md_rec_data(k,mdu,id, editor){ + if(window.sessionStorage.getItem(k+mdu) !== null){ + editor.setValue(window.sessionStorage.getItem(k+mdu)); + md_clear_data(k,mdu,id); + } +} + +// 保存数据 +function md_add_data(k,mdu,d){ + window.sessionStorage.setItem(k+mdu,d); +} + +// 清空保存的数据 +function md_clear_data(k,mdu,id){ + window.sessionStorage.removeItem(k+mdu); + var id1 = "#e_tip_"+id; + var id2 = "#e_tips_"+id; + if(k == 'content'){ + $(id2).html(""); + }else{ + $(id1).html(""); + } +} + +function md_elocalStorage(editor,mdu,id){ + if (window.sessionStorage){ + var oc = window.sessionStorage.getItem('content'+mdu); + if(oc !== null ){ + $("#e_tips_"+id).data('editor', editor); + var h = '您上次有已保存的数据,是否恢复 ? / 不恢复'; + $("#e_tips_"+id).html(h); + } + setInterval(function() { + var d = new Date(); + var h = d.getHours(); + var m = d.getMinutes(); + var s = d.getSeconds(); + h = h < 10 ? '0' + h : h; + m = m < 10 ? '0' + m : m; + s = s < 10 ? '0' + s : s; + if(editor.getValue().trim() != ""){ + md_add_data("content",mdu,editor.getValue()); + var id1 = "#e_tip_"+id; + var id2 = "#e_tips_"+id; + + $(id1).html(" 数据已于 " + h + ':' + m + ':' + s +" 保存 "); + $(id2).html(""); + } + },10000); + + }else{ + $("#e_tip_"+id).after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!'); + } +} + +function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callback) { + var editorName = window.editormd(id, { + width: width, + height: high, + path: path, // "/editormd/lib/" + markdown : initValue, + syncScrolling: "single", + tex: true, + tocm: true, + emoji: true, + taskList: true, + codeFold: true, + searchReplace: true, + htmlDecode: "style,script,iframe", + sequenceDiagram: true, + autoFocus: false, + placeholder: placeholder, + toolbarIcons: function () { + // Or return editormd.toolbarModes[name]; // full, simple, mini + // Using "||" set icons align right. + return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"] + }, + toolbarCustomIcons: { + testIcon: "
    ", + testIcon1: "
    " + }, + //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 + saveHTMLToTextarea: true, + // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 + dialogMaskOpacity: 0.6, + imageUpload: true, + imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], + imageUploadURL: imageUrl,//url + onload: function () { + // this.previewing(); + $("#" + id + " [type=\"latex\"]").bind("click", function () { + editorName.cm.replaceSelection("```latex"); + editorName.cm.replaceSelection("\n"); + editorName.cm.replaceSelection("\n"); + editorName.cm.replaceSelection("```"); + var __Cursor = editorName.cm.getDoc().getCursor(); + editorName.cm.setCursor(__Cursor.line - 1, 0); + }); + + $("#" + id + " [type=\"inline\"]").bind("click", function () { + editorName.cm.replaceSelection("$$$$"); + var __Cursor = editorName.cm.getDoc().getCursor(); + editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); + editorName.cm.focus(); + }); + $("[type=\"inline\"]").attr("title", "行内公式"); + $("[type=\"latex\"]").attr("title", "多行公式"); + + callback && callback() + } + }); + return editorName; +} + + +function 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"); + $('#collaborators_list_info').show() + }, 200) +} + + +export default class TPMsettings extends Component { + constructor(props) { + super(props) + this.state = { + commandLine: 0, + Openpublic: 0, + settingsData: undefined, + webssh: 0, + use_scope: 0, + shixunsstatus: 0, + shixunsID: undefined, + exec_time: undefined, + trainee: undefined, + can_copy: undefined, + task_pass: undefined, + test_set_permission: undefined, + hide_code: undefined, + code_hidden: undefined, + forbid_copy: undefined, + vnc: undefined, + name: undefined, + scope_partment: undefined, + scopetype: false, + departmentslist: undefined, + description: '', + evaluate_script:undefined, + standard_scripts: undefined, + choice_main_type: "", + choice_small_type: [""], + choice_standard_scripts:undefined, + editordescriptios: undefined, + editorevaluate_scripts: undefined, + choice_standard_scriptssum: undefined, + visibleTemplate: false, + Executiveordervalue: "", + Compilecommandvalue: "", + Executivetyoe: false, + postapplyvisible: false, + sendsure_applyvalue: undefined, + postapplytitle: false, + shixunnametype: false, + shixunmaintype: false, + evaluate_scripttype: false, + exec_timetype: false, + traineetype: false, + standard_scriptsModal:false, + standard_scriptsModals:false, + SelectTheCommandtype:false, + multi_webssh:false, + status:0, + opers:false, + operss:false, + testscripttiptype:false, + opersss:false, + operateshixunstype:false, + opening_time:"", + opensmail:false, + scope_partmenttype:false, + newuse_scope:undefined, + scope_partments:0, + + pod_exist_time: undefined, + pod_exist_timetype: false, + shixunmemoMDvalue:"" + } + } + descriptionMD=(initValue, id)=> { + + this.contentChanged = false; + const placeholder = ""; +// amp; +// 编辑时要传memoId + const imageUrl = `/api/attachments.json`; +// 创建editorMd + + const description_editormd =create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue,()=> { + setTimeout(() => { + description_editormd.resize() + description_editormd.cm && description_editormd.cm.refresh() + }, 500) + + if (initValue != undefined) { + description_editormd.setValue(initValue) + } + description_editormd.cm.on("change", (_cm, changeObj) => { + console.log('....contentChanged') + this.contentChanged = true; + }) + }); + md_elocalStorage(description_editormd, `MemoQuestion_${id}`, `${id}Question`); + this.description_editormd = description_editormd; + window.description_editormd = description_editormd; + } + + evaluate_scriptMD=(initValue, id)=> { + this.contentChanged = false; + const placeholder = ""; +// amp; +// 编辑时要传memoId + const imageUrl = `/api/attachments.json`; +// 创建editorMd + + const evaluate_script_editormd =create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue,()=> { + setTimeout(() => { + evaluate_script_editormd.resize() + evaluate_script_editormd.cm && evaluate_script_editormd.cm.refresh() + }, 500) + + if (initValue != undefined) { + evaluate_script_editormd.setValue(initValue) + } + evaluate_script_editormd.cm.on("change", (_cm, changeObj) => { + console.log('....contentChanged') + this.contentChanged = true; + }) + }); + md_elocalStorage(evaluate_script_editormd, `MemoQuestion_${id}`, `${id}Question`); + this.evaluate_script_editormd = evaluate_script_editormd; + window.evaluate_script_editormd = evaluate_script_editormd; + + } + + + + componentDidMount() { + + let id=this.props.match.params.shixunId; + + let Url=`/shixuns/`+id+`/settings.json`; + + axios.get(Url).then((response)=> { + // alert(response.data.shixun.choice_standard_scripts) + if(response.status===200){ + this.setState({ + shixunsID: id, + settingsData: response.data, + webssh: response.data.shixun.webssh, + use_scope: response.data.shixun.use_scope, + shixunsstatus: response.data.shixun.status, + exec_time: response.data.shixun.exec_time, + trainee: response.data.shixun.trainee, + can_copy: response.data.shixun.can_copy, + task_pass: response.data.shixun.task_pass, + test_set_permission: response.data.shixun.test_set_permission, + hide_code: response.data.shixun.hide_code, + code_hidden: response.data.shixun.code_hidden, + forbid_copy: response.data.shixun.forbid_copy, + vnc: response.data.shixun.vnc, + name: response.data.shixun.name, + scope_partment: response.data.shixun.scope_partment, + description: response.data.shixun.description, + evaluate_script: response.data.shixun.evaluate_script, + choice_main_type: response.data.shixun.choice_main_type, + choice_small_type: response.data.shixun.choice_small_type, + choice_standard_scripts: response.data.shixun.choice_standard_scripts, + standard_scripts:response.data.shixun.standard_scripts, + multi_webssh:response.data.shixun.multi_webssh, + status:response.data.shixun.status, + opening_time:response.data.shixun.opening_time, + newuse_scope:response.data.shixun.use_scope, + scope_partments: response.data.shixun.scope_partment.length, + shixunmemoMDvalue:response.data.shixun.evaluate_script + }) + + // if(response.data.status===403){ + // message: "您没有权限进行该操作" + // this.setState({ + // :true + // message403:response.data.message + // }) + // } + + + if(response.data.shixun.multi_webssh===true){ + this.setState({ + SelectTheCommandtype:true + }) + }else{ + this.setState({ + SelectTheCommandtype:false + }) + } + if (response.data.shixun.scope_partment.length > 0) { + this.setState({ + scopetype: true + }) + } + // console.log(response.data.shixun.description) + // console.log(response.data.shixun.evaluate_script) + // console.log(response.data.shixun.description) + // this.props.identity<4&&this.props.status==0||this.props.identity===1&&this.props.status==2 + + + // this.evaluate_scriptMD(response.data.shixun.evaluate_script, "shixunmemoMD"); + + this.descriptionMD(response.data.shixun.description, "shixundescription"); + + // this.bigClass() + // if (response.data.shixun.status === 2) { + // + // } else if (response.data.shixun.status === 1) { + // this.props.showSnackbar("这个实训已发布不能修改!"); + // } else if (response.data.shixun.status === 3) { + // this.props.showSnackbar("这个实训已关闭不能修改!"); + // } + } + + }); + + + let departmentsUrl = `/shixuns/departments.json`; + axios.get(departmentsUrl).then((response) => { + if (response.status === 200) { + this.setState({ + departmentslist: response.data.shools_name + }); + } + }).catch((error) => { + console.log(error) + }); + + + + } + + SelectshixunCommand=(e)=>{ + // console.log( e.target.value) + this.setState({ + webssh: e.target.value, + }); + if(e.target.value===2){ + this.setState({ + SelectTheCommandtype: true, + multi_webssh:false + }); + }else{ + this.setState({ + SelectTheCommandtype: false, + multi_webssh:false + }); + } + } + + SelectOpenpublic=(e)=>{ + this.setState({ + Openpublic: e.target.value + }); + } + + can_copy=(e)=>{ + let sum = "" + if (e.target.checked === false) { + sum = 0 + } else if (e.target.checked === true) { + sum = 1 + } + this.setState({ + can_copy: sum, + }); + + } + + task_pass=(e)=>{ + + let sum = "" + if (e.target.checked === false) { + sum = 0 + } else if (e.target.checked === true) { + sum = 1 + } + this.setState({ + task_pass: sum, + }); + } + + test_set_permission=(e)=>{ + let sum = "" + if (e.target.checked === false) { + sum = 0 + } else if (e.target.checked === true) { + sum = 1 + } + this.setState({ + test_set_permission: sum, + }); + + } + + hide_code=(e)=>{ + let sum = "" + if (e.target.checked === false) { + sum = 0 + } else if (e.target.checked === true) { + sum = 1 + } + this.setState({ + hide_code: sum, + }); + + } + + code_hidden=(e)=>{ + let sum = "" + if (e.target.checked === false) { + sum = 0 + } else if (e.target.checked === true) { + sum = 1 + } + this.setState({ + code_hidden: sum, + }); + + } + forbid_copy = (e) => { + let sum = "" + if (e.target.checked === false) { + sum = 0 + } else if (e.target.checked === true) { + sum = 1 + } + this.setState({ + forbid_copy: sum, + }); + } + + shixun_vnc=(e)=>{ + let sum = "" + if (e.target.checked === false) { + sum = 0 + } else if (e.target.checked === true) { + sum = 1 + } + this.setState({ + vnc: sum, + }); + + } + shixunsname = (e) => { + // let {shixunsstatus}=this.state; + // if(shixunsstatus>0){ + // return + // } + this.setState({ + name: e.target.value, + shixunnametype:false + }) + } + + bigClass = (value) => { + + let url = `/shixuns/get_mirror_script.json?mirror_id=`+value; + axios.get(url).then((response) => { + if (response.status === 200) { + // console.log(response.data) + this.setState({ + choice_main_type: value, + standard_scripts:response.data, + choice_standard_scripts:null + }) + } + }).catch((error) => { + console.log(error) + }); + + + + } + + littleClass = (value) => { + this.setState({ + choice_small_type: value + }) + } + onPodExistTimeChange = (e) => { + this.setState({ + pod_exist_time: e.target.value, + pod_exist_timetype: false, + }) + } + Timevalue = (e) => { + this.setState({ + exec_time: e.target.value + }) + } + SelectOpenpublic = (e) => { + this.setState({ + scopetype: false, + use_scope: e.target.value, + }); + if (e.target.value === 1) { + this.setState({ + scopetype: true + }); + } + + } + deleteScopeInput = (key) => { + let {scope_partment} = this.state; + let datalist = scope_partment; + datalist.splice(key, 1); + this.setState({ + scope_partment: datalist + }); + } + + shixunScopeInput = (e) => { + let {scope_partment} = this.state; + let datalist = scope_partment; + if (datalist===undefined) { + datalist=[] + } + + datalist.push(e) + // else { + // datalist[id] = e + // } + this.setState({ + scope_partment: datalist + }); + } + // adduse_scopeinput = () => { + // let {scope_partment} = this.state; + // let array = scope_partment; + // let newarray = "" + // array.push(newarray) + // this.setState({ + // scope_partment: array, + // }); + // } + submit_edit_shixun = () => { + let { + name, description, choice_main_type, choice_small_type, choice_standard_scripts, scope_partment, choice_standard_scriptssum, + evaluate_script, exec_time, webssh, use_scope, trainee, can_copy, task_pass, test_set_permission, hide_code, code_hidden, forbid_copy, vnc,multi_webssh, + opening_time, pod_exist_time,shixunmemoMDvalue + } = this.state; + let operateauthority=this.props.identity<4&&this.props.status==0||this.props.identity===1&&this.props.status==2||this.props.identity===1&&this.props.status==1; + + const description_editormd = this.description_editormd.getValue(); + + let evaluate_script_editormd; + + if(operateauthority===true){ + // evaluate_script_editormd = this.evaluate_script_editormd.getValue(); + evaluate_script_editormd = shixunmemoMDvalue + }else{ + evaluate_script_editormd = evaluate_script; + } + + + if (name === "") { + this.setState({ + shixunnametype: true + }) + $('html').animate({ + scrollTop: 10 + }, 1000); + return + } + if (choice_main_type === "") { + this.setState({ + shixunmaintype: true + }) + $('html').animate({ + scrollTop: 800 + }, 1000); + return + } + if (evaluate_script_editormd === "") { + this.setState({ + evaluate_scripttype: true + }) + $('html').animate({ + scrollTop: 1200 + }, 1000); + return + } + if(use_scope===1){ + + if(scope_partment===undefined||scope_partment.length===0){ + this.setState({ + scope_partmenttype: true + }) + $('html').animate({ + scrollTop: 2500 + }, 1000); + this.props.showSnackbar("公开程度,指定单位为空"); + return + } + } + if (exec_time === "") { + this.setState({ + exec_timetype: true + }) + $('html').animate({ + scrollTop: 1500 + }, 1000); + return + } + + // if (!pod_exist_time) { + // this.setState({ + // pod_exist_timetype: true + // }) + // $("html, body").animate({ scrollTop: $('#pod_exist_time').offset().top - 100 }, 1000) + // return + // } + + if (trainee === "") { + this.setState({ + traineetype: true + }) + return + } + + let id = this.props.match.params.shixunId; + + let newmulti_webssh=multi_webssh; + if(newmulti_webssh===true){ + newmulti_webssh=1 + }else{ + newmulti_webssh=0 + } + + if(newmulti_webssh===null){ + newmulti_webssh=0 + } + + let Url = `/shixuns/` + id + `.json`; + let data = { + name: name, + description: description_editormd, + main_type: choice_main_type, + small_type: choice_small_type, + webssh: webssh, + user_scope: use_scope, + scope_partment: scope_partment, + can_copy: can_copy, + vnc: vnc, + test_set_permission: test_set_permission, + code_hidden: code_hidden, + trainee: trainee, + task_pass: task_pass, + standard_scripts: choice_standard_scripts, + hide_code: hide_code, + forbid_copy: forbid_copy, + exec_time: exec_time, + evaluate_script: evaluate_script_editormd, + multi_webssh:newmulti_webssh, + opening_time:opening_time, + mirror_script_id:choice_standard_scriptssum, + delType:1 + } + + axios.put(Url, data).then((response) => { + // console.log(response) + if(response.status){ + if (response.data.status === -1) { + this.props.showSnackbar(response.data.message); + return + } else { + window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges"; + } + } + + }).catch((error) => { + console.log(error) + }) + + + } + shixunsfetch = (value, callback) => { + if (timeout) { + clearTimeout(timeout); + timeout = null; + } + currentValue = value; + + function fake() { + let departmentsUrl = `/shixuns/departments.json?q=` + currentValue; + axios.get(departmentsUrl).then((response) => { + callback(response.data.shools_name); + }).catch((error) => { + console.log(error) + }); + } + + timeout = setTimeout(fake, 300); + } + shixunHandleSearch = (value) => { + this.shixunsfetch(value, departmentslist => this.setState({departmentslist})); + } + + + + + shixunsclose = () => { + let id = this.props.match.params.shixunId; + let cul = `/shixuns/` + id + `/close.json`; + axios.post(cul).then((response) => { + if(response.data.status===1){ + this.props.showSnackbar("操作成功"); + this.setState({ + operateshixunstype: false, + }); + + window.location.href = "/shixuns/" + id + "/challenges"; + } + }).catch((error) => { + console.log(error) + }) + } + + shixunsdel= () => { + let id = this.props.match.params.shixunId; + let cul = `/shixuns/` + id +`.json`; + + axios.delete(cul).then((response) => { + if(response.data.status===1){ + this.props.showSnackbar("操作成功"); + this.setState({ + operateshixunstype: false, + }); + + window.location.href = "/shixuns"; + } + }).catch((error) => { + console.log(error) + }) + } + + Executiveorder = (e) => { + this.setState({ + Executiveordervalue: e.target.value + }) + } + + Compilecommand = (e) => { + this.setState({ + Compilecommandvalue: e.target.value + }) + } + + handleCancelTemplate = (e) => { + this.setState({ + Executiveordervalue: "", + Compilecommandvalue: "", + visibleTemplate: false + }) + } + + hideModalTemplate = (e) => { + let id = this.props.match.params.shixunId; + let {Executiveordervalue, Compilecommandvalue} = this.state; + + if (Executiveordervalue === "") { + this.setState({ + Executivetyoe: true, + }); + return + } + // Executiveordervalue=String(Executiveordervalue); + // Compilecommandvalue=String(Compilecommandvalue); + let trl = `/shixuns/${id}/get_custom_script.json?compile=${Executiveordervalue}&excutive=${Compilecommandvalue}` + axios.get(trl).then((response) => { + // this.evaluate_scriptMD(response.data.shixun_script, "shixunmemoMD"); + this.setState({ + shixunmemoMDvalue:response.data.shixun_script + }) + }).catch((error) => { + console.log(error) + }); + this.setState({ + visibleTemplate: false + }) + } + + showModal = () => { + this.setState({ + visibleTemplate: true, + }); + } + Selecttrainee = (value) => { + this.setState({ + trainee: value, + }); + } + + post_apply = () => { + this.setState({ + postapplyvisible: true + }) + } + + sendsure_applyvalues = (e) => { + this.setState({ + sendsure_applyvalue: e.target.value + }) + } + + sendsure_apply = () => { + let {sendsure_applyvalue} = this.state; + let url = "/shixuns/apply_shixun_mirror.json"; + axios.post(url, { + note: sendsure_applyvalue + }).then((response) => { + if (response.status === 200) { + if (response.data.status == 1) { + this.setState({ + postapplyvisible: false, + postapplytitle: true + }) + } + + } + }).catch((error) => { + console.log(error) + }); + + } + + sendhideModaly = () => { + this.setState({ + postapplyvisible: false + }) + } + + yeshidemodel = () => { + this.setState({ + postapplytitle: false + }) + } + + SelectScput = (value, e) => { + this.setState({ + choice_standard_scriptssum: value, + choice_standard_scripts: {id:e.props.value,value:""}, + standard_scriptsModal:true + }) + } + + hidestandard_scriptsModal=()=>{ + this.setState({ + standard_scriptsModal:false, + standard_scriptsModals:false + }) + } + + get_mirror_script=()=>{ + let {choice_standard_scriptssum}=this.state; + let id = this.props.match.params.shixunId; + let pul = "/shixuns/" + id + "/get_script_contents.json?script_id=" + choice_standard_scriptssum; + axios.get(pul).then((response) => { + if(response.status===200){ + // this.evaluate_scriptMD(response.data.content, "shixunmemoMD"); + this.setState({ + standard_scriptsModal:false, + standard_scriptsModals:true, + shixunmemoMDvalue:response.data.content + }) + } + + }).catch((error) => { + console.log(error) + }) + } + + + SelectTheCommandonChange=(e)=>{ + this.setState({ + multi_webssh:e.target.checked + }) + } + + bigopen=()=>{ + this.setState({ + opers:true + }) + } + + bigopens=()=>{ + this.setState({ + opers:false, + operss:false, + opersss:false, + opensmail:false + }) + } + bigopensmal=()=>{ + this.setState({ + opensmail:true + }) + } + sbigopen=()=>{ + this.setState({ + operss:true + }) + } + + sbigopens=()=>{ + this.setState({ + operss:false + }) + } + sbigopenss=()=>{ + this.setState({ + opersss:true + }) + } + + sbigopensss=()=>{ + this.setState({ + opersss:false + }) + } + testscripttip=(val)=>{ + if(val===0){ + this.setState({ + testscripttiptype:true + }) + }else if(val===1){ + this.setState({ + testscripttiptype:false + }) + } + } + + operateshixuns=(value)=>{ + this.setState({ + operateshixunstype:true, + delType:value + }) + } + + hideoperateshixuns=()=>{ + this.setState({ + operateshixunstype:false + }) + } + onChangeTimePicker =(value, dateString)=> { + this.setState({ + opening_time:dateString + }) + } + + getshixunmemoMDvalue=(e)=>{ + this.setState({ + shixunmemoMDvalue:e.target.value + }) + } + render() { + let { + postapplyvisible, + sendsure_applyvalue, + postapplytitle, + shixunnametype, + shixunmaintype, + evaluate_scripttype, + exec_timetype, + traineetype, + standard_scripts, + description, + evaluate_script, + name, + settingsData, + webssh, + use_scope, + shixunsstatus, + shixunsID, + exec_time, + pod_exist_time, + pod_exist_timetype, + can_copy, + choice_standard_scripts, + Executiveordervalue, + Executivetyoe, + Compilecommandvalue, + task_pass, + test_set_permission, + hide_code, + forbid_copy, + code_hidden, + vnc, + scopetype, + scope_partment, + departmentslist, + trainee, + choice_main_type, + choice_small_type, + standard_scriptsModal, + standard_scriptsModals, + SelectTheCommandtype, + status, + opers, + operss, + opersss, + testscripttiptype, + operateshixunstype, + opening_time, + opensmail, + scope_partmenttype, + newuse_scope, + scope_partments, + shixunmemoMDvalue,delType + } = this.state; + + let options; + + if (departmentslist != undefined) { + options = this.state.departmentslist.map((d, k) => { + return ( + + ) + }) + } + + const dateFormat = 'YYYY-MM-DD HH:mm:ss'; + let operateauthority=this.props.identity===1?true:this.props.identity<4&&this.props.status==0; + + return ( +
    +
    +
    + 配置 + { + this.props.identity===1&&this.props.status==2? + this.operateshixuns(2)}> + 永久关闭 + :"" + } + { + this.props.identity < 4 && this.props.status==0? + this.operateshixuns(1)}> + 删除实训 + :"" + } + { + this.props.identity == 1 && this.props.status == 2 ? + this.operateshixuns(1)}> + 删除实训 + :"" + } + + +
    + {delType===1?

    是否确认删除 ?

    :

    关闭后,
    用户不能再开始挑战了是否确认关闭 ?

    } +
    +
    + 取消 + {delType===2?确定:确定} +
    +
    + +
    + +
    + +

    实训名称

    + +
    + * +
    +
    + {settingsData === undefined ? "" : + } +
    +
    + 必填项 +
    +
    + + +
    + +
    +
    + +
    + +

    简介

    + +
    + +
    +
    +
    +

    +

    +
    + +
    +
    +

    技术平台

    + + +
    + * +
    + +

    + 列表中没有? + 申请新建 +

    + + + + + + +
    +

    新建申请已提交,请等待管理员的审核

    +
  • 我们将在1-2个工作日内与您联系 +
  • +
    +
    + 知道啦 +
    +
    +
    +
    + +
    + +
    +
    + 必填项 +
    + {/*

    请在配置页面完成后续的评测脚本设置操作

    */} + +
    +
    +
    +
    +
    +

    评测脚本

    +
    + + +
    +

    原有脚本将被新的脚本覆盖,无法撤销

    +

    是否确认执行覆盖操作

    +
    + + +
    + + +

    评测脚本生成成功!

    + +
    + + { + this.props.identity<4||this.props.power==true? + 使用自定义脚本 : "" + } + + + +
    +
  • + + +

    执行命令不能为空

    +
  • + +
  • + + +
  • +
    +
    +
    +
    + +
    +
    + * +
    + + +
    + +
    + + + {/*
    */} + {/*{evaluate_script===undefined?"":evaluate_script}*/} + + {/*
    */} + + +
    + this.testscripttip(0)}> +
    + +
    +

    + 使用自定义模板,平台无法自动更新脚本,
    + 请在关卡创建完后手动更新脚本中的必填参
    + 数和以下2个数组元素:
    + challengeProgramNames
    + sourceClassNames

    + 示例:有2个关卡的实训

    + 各关卡的待编译文件为:
    + src/step1/HelloWorld.java
    + src/step2/Other.java

    + 各关卡的编译后生成的执行文件为:
    + step1.HelloWorld
    + step2.Other

    + 则数组元素更新如下:
    + challengeProgramNames=("src/step1/
    + HelloWorld.java" "src/step2/Other.java")
    + sourceClassNames=("step1.HelloWorld
    + " "step2.Other")

    + 其它参数可按实际需求定制 +

    +
    +

    + this.testscripttip(1)}>知道了 +

    +
    +
    +
    + +
    +
    +
    + + 必填项 +
    +

    +

    +
    +
    + +
    + * + +

    程序最大执行时间

    + + + +
    + 必填项 +
    +
    + + {/*
    + * + +

    Pod存活时间

    + + + +
    + 必填项 +
    +
    */} + + +
    +

    命令行

    + + 无命令行窗口 (选中则不给学员的实践任务提供命令窗口) + 命令行练习窗口 (选中则给学员提供用于练习操作的命令行窗口) + 命令行评测窗口 (选中则给学员提供用于关卡评测的命令行窗口) + + 多个命令行窗口(选中则允许学员同时开启多个命令行窗口) + + +
    + +
    +

    公开程度

    + + 对所有公开 (选中则所有已被试用授权的用户可以学习) + 对指定单位公开 (选中则下方指定单位的已被试用授权的用户可以学习) + + +
    +
    +
    +
    +
    + +
    + (搜索并选中添加单位名称) +
    + {/*+*/} + {/*添加*/} +
    + +
    + + {/*{*/} + {/*scope_partment===undefined?"":scope_partment.map((item,key)=>{*/} + {/*return(*/} + {/*
    */} + {/*this.deleteScopeInput(key)} style={{ color: 'rgba(0,0,0,.25)' }} />}*/} + {/*value={item}*/} + {/*/>*/} + {/*
    */} + + {/*)*/} + {/*})*/} + {/*}*/} +
    + + + 请选择需要公开的单位 + +
    +
    +
    + +
    +

    发布信息

    + +
    + * + 面向学员: + +
    + +
    + 实训难易度定位,不限定用户群体 +
    + 必填项 +
    + +
    +
    + 复制: + + + + +
    + +
    + 跳关: + + + + +
    +
    + 测试集解锁: + + + + +
    + +
    + 隐藏代码窗口: + + + + +
    + +
    + 代码目录隐藏: + + + + +
    + +
    + 禁用复制粘贴: + + + + +
    + +
    + 开启时间: + + + + +
    + {/*
    */} + {/*VNC图形化:*/} + {/**/} + {/**/} + {/**/} + {/**/} + {/*
    */} + +
    + +

    + { + // this.props.identity<4&&this.props.status==0? + this.props.identity<4? +

    + 保存 + 取消 +
    :"" + } + {/*{*/} + {/*this.props.identity===1&&this.props.status==2?*/} + {/*
    */} + {/*保存*/} + {/*取消*/} + {/*/!**!/*/} + {/*/!*永久关闭*!/*/} + {/*/!**!/*/} + {/*
    :""*/} + {/*}*/} + + + + + {/*{*/} + {/*this.props.identity===1||this.props.power==true?*/} + {/*
    */} + {/*保存*/} + {/*取消*/} + {/**/} + {/**/} + {/*{status===0?"":"永久关闭"}*/} + {/**/} + {/**/} + {/*
    :""*/} + + {/*}*/} + {/*
    */} + {/*保存*/} + {/*取消*/} + {/*
    */} +

    + +
    + ); + } +} + + From 3993378c4d60512230e481a589d9892cb19febd2 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 24 Jun 2019 16:33:17 +0800 Subject: [PATCH 13/17] =?UTF-8?q?=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/busyWork/CommonWorkAppraise.js | 7 ++ .../courses/busyWork/CommonWorkList.js | 2 +- .../courses/busyWork/CommonWorkSetting.js | 78 ++++++++++++++----- .../GraduationTasksappraiseMainEditor.js | 3 +- .../courses/poll/PollDetailTabForthRules.js | 4 +- 5 files changed, 68 insertions(+), 26 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js b/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js index 616c86f33..77317792e 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js @@ -180,6 +180,12 @@ class CommonWorkAppraise extends Component{
    */}
    + +
    {(description || (attachments && attachments.length != 0)) &&
    内容 @@ -286,6 +292,7 @@ class CommonWorkAppraise extends Component{
    } +
    {/* task_type={datalist&&datalist.task_type} */} diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js index 1e8c634f6..a9090a02e 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkList.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js @@ -228,7 +228,7 @@ function buildColumns(that, student_works) { -
    {`${record.student_comment_count}名学生进行了匿评`}
    + {record.student_comment_count &&
    {`${record.student_comment_count}名学生进行了匿评`}
    }
    有效平均分:{record.student_score}分
    ) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkSetting.js b/public/react/src/modules/courses/busyWork/CommonWorkSetting.js index 1574d692d..181a34b1b 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkSetting.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkSetting.js @@ -259,15 +259,20 @@ class CommonWorkSetting extends Component{ unified_setting: checked }) } + // 启用匿评 anonymous_comment_change = (e) => { const checked = e.target.checked; - const { end_time } = this.state; + const currentEndTime = this._getCurrentEndTime() let evaluation_start, evaluation_end, evaluation_num = 0, absence_penalty = 0; if (checked) { - if (end_time) { - evaluation_start = moment(end_time).add(7, 'days').format(dateFormat) - evaluation_end = moment(end_time).add(21, 'days').format(dateFormat) + if (currentEndTime) { + evaluation_start = moment(currentEndTime).add(7, 'days').format(dateFormat) + evaluation_end = moment(currentEndTime).add(21, 'days').format(dateFormat) + } + if (!this.state.evaluation_num) { evaluation_num = 3 + } + if (!this.state.absence_penalty) { absence_penalty = 2 } } else { @@ -310,6 +315,7 @@ class CommonWorkSetting extends Component{ absence_penalty:value }) } + // 启用匿评申诉 anonymous_appeal_change = (e) => { const { evaluation_end } = this.state; const anonymous_appeal = e.target.checked @@ -389,9 +395,10 @@ class CommonWorkSetting extends Component{ this.setState({ late_penalty: 5 }) - if (this.state.end_time && !this.state.late_time) { + const currentEndTime = this._getCurrentEndTime(); + if (currentEndTime && !this.state.late_time) { this.setState({ - late_time: moment(handleDateString(this.state.end_time)).add(1, 'months').format(dateFormat) + late_time: moment(handleDateString(currentEndTime)).add(1, 'months').format(dateFormat) }) } } @@ -469,6 +476,20 @@ class CommonWorkSetting extends Component{ // } } + _getCurrentEndTime = () => { + const { unified_setting, end_time, rules } = this.state; + if (unified_setting) { + return end_time + } else { + let max_un_unified_setting_end_time = null; + rules.map(item => { + if (!max_un_unified_setting_end_time || moment(item.end_time) > moment(max_un_unified_setting_end_time)) { + max_un_unified_setting_end_time = item.end_time; + } + }) + return max_un_unified_setting_end_time + } + } saveWorkSetting=()=>{ let workId=this.props.match.params.workId; @@ -1077,6 +1098,7 @@ class CommonWorkSetting extends Component{ course_group={adaptered_group_settings} rulesCheckInfo={(info)=>this.rulesCheckInfo(info)} flagPageEdit={true} + moduleName="作业" > } @@ -1254,7 +1276,7 @@ class CommonWorkSetting extends Component{ margin-left: 18px; } `} - +

    允许学生对自己作品的匿评评分进行申诉,由教师和助教处理申诉
    @@ -1297,7 +1319,7 @@ class CommonWorkSetting extends Component{ - + (学生提交匿评申诉的时间截点) {

    {appeal_time_tip}
    } @@ -1311,7 +1333,7 @@ class CommonWorkSetting extends Component{ /> - + (学生违规匿评TA人作品时,其成绩将被扣减的分值) {this.state.appeal_penalty_tip &&
    {this.state.appeal_penalty_tip}
    } @@ -1346,21 +1368,17 @@ class CommonWorkSetting extends Component{ 多项评分配比(选中,则按照比例计算最终成绩) - +

    计算说明:
    - 优先顺序排前的非零评分 * 100% -
    - ( 迟交扣分 + 缺评扣分 * 缺评数 + 违规匿评扣分 * 违规匿评数 )
    - 例:有教师评分则教师评分100%,否则教辅评分100%,依次类推 - {/* 教师评分 * 其百分比 + 助教评分 * 其百分比 + 学生匿评平均分 * 其百分比 -
    - ( 迟交扣分 + 缺评扣分 * 缺评数 + 违规匿评扣分 * 违规匿评数 )
    - -
    + 教师评分 * 其百分比 + 助教评分 * 其百分比 + 学生匿评平均分 * 其百分比 - (
    + 迟交扣分 + 缺评扣分 * 缺评数 + 违规匿评扣分 * 违规匿评数 )

    注意
    - 非零百分比的评分选项,在没有评分记录的情况下,其百分比平摊到另外的评
    - 分选项上。例如:教师评分40% + 助教评分35% + 学生匿评25%,学生A没
    - 有得到教师评分,则最终成绩将按照助教评分55% + 学生匿评45%进行计算 */} + 非零百分比的评分选项,若评分记录为空,则其百分比将自动平摊到其它非零
    + 评分选项上。
    + 例:教师评分40% + 助教评分35% + 学生匿评25%,学生A没有教师评分记
    + 录,则其最终成绩按照助教评分55% + 学生匿评45%进行计算

    @@ -1392,12 +1410,30 @@ class CommonWorkSetting extends Component{ {
    {final_mode_false_tip}
    } 单项评分优先(选中,则按照优先顺序计算最终成绩) + +

    + 计算说明:
    + + 优先顺序排前的非零评分 * 100% -
    + ( 迟交扣分 + 缺评扣分 * 缺评数 + 违规匿评扣分 * 违规匿评数 )
    + 例:有教师评分则教师评分100%,否则教辅评分100%,依次类推 + {/* 教师评分 * 其百分比 + 助教评分 * 其百分比 + 学生匿评平均分 * 其百分比 -
    + ( 迟交扣分 + 缺评扣分 * 缺评数 + 违规匿评扣分 * 违规匿评数 )
    + +
    + 注意
    + 非零百分比的评分选项,在没有评分记录的情况下,其百分比平摊到另外的评
    + 分选项上。例如:教师评分40% + 助教评分35% + 学生匿评25%,学生A没
    + 有得到教师评分,则最终成绩将按照助教评分55% + 学生匿评45%进行计算 */} + +

    +
    教师评分 → 教辅评分 → 学生匿评评分 - (有教师评分则教师评分100%,否则教辅评分100%,依次类推 ) + {/* (有教师评分则教师评分100%,否则教辅评分100%,依次类推 ) */}
    diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js index e722ac00b..15300c628 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseMainEditor.js @@ -197,7 +197,6 @@ class GraduationTasksappraiseMainEditor extends Component{ .mainEditor { padding: 0 10px; padding-bottom: 8px; - height: 288px; } .mainEditorTitle { margin-bottom: 6px; @@ -218,7 +217,7 @@ class GraduationTasksappraiseMainEditor extends Component{ -
    +

      - (学生收到{this.props.type==="Exercise"?"试卷":"问卷"}的时间) - (学生可以答题的时间截点) + (学生收到{this.props.moduleName || (this.props.type==="Exercise"?"试卷":"问卷")}的时间) + ({this.props.moduleName == '作业' ? '学生“按时”提交作品的时间截点' : '学生可以答题的时间截点'})

    { From 786cdff86cbec190f1837708500ba3918faa6545 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 24 Jun 2019 16:46:06 +0800 Subject: [PATCH 14/17] memberNumMax --- public/react/src/modules/courses/busyWork/CommonWorkPost.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkPost.js b/public/react/src/modules/courses/busyWork/CommonWorkPost.js index c75e62a10..0193d8659 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkPost.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkPost.js @@ -173,7 +173,7 @@ class CommonWorkPost extends Component{ } if(isGroup){ if(userids!=undefined){ - if(userids.lengthmemberNumMax){ + }else if(userids.length + 1>memberNumMax){ this.setState({ minvalue: memberNumMax, setvalue:"大于", From e8b00031aae80e0ea307474e8b8a0d88ef2aeb53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 24 Jun 2019 17:13:23 +0800 Subject: [PATCH 15/17] =?UTF-8?q?=20=E5=AE=9E=E8=AE=AD=E6=9D=83=E9=99=90?= =?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/tpm/TPMBanner.js | 20 +++++++++---------- .../tpm/shixunchild/Challenges/Challenges.js | 18 ++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index 82c18a09d..25a6ab9c7 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -354,7 +354,7 @@ class TPMBanner extends Component { //开始实战按钮 startshixunCombat=(id)=>{ let {shixunsDetails} = this.props - if( shixunsDetails.status>1){ + if( shixunsDetails.shixun_status>1){ this.setState({ startbtn:true, hidestartshixunsreplacevalue:"" @@ -463,11 +463,11 @@ class TPMBanner extends Component { // // } if(shixunsDetails!=undefined){ - if (shixunsDetails.status === 0 ) { + if (shixunsDetails.shixun_status === 0 ) { challengeBtnText = '继续实战' - } else if (shixunsDetails.status === 1) { + } else if (shixunsDetails.shixun_status === 1) { challengeBtnText = '查看实战' - } else if (shixunsDetails.status === 3) { + } else if (shixunsDetails.shixun_status === 3) { challengeBtnText = '继续实战' }else{ challengeBtnText = "开始实战" @@ -640,7 +640,7 @@ class TPMBanner extends Component { className="fr user_default_btn task-btn-orange font-18" id="shixun_operation" data-remote="true" > - {shixunsDetails.task_operation === undefined ? "" : shixunsDetails.task_operation[0]} + {shixunsDetails.task_operation === undefined ? "" : shixunsDetails.shixun_status > 1 ? shixunsDetails.task_operation[0] : "模拟实战"} : "" @@ -707,7 +707,7 @@ class TPMBanner extends Component { {/*>{shixunsDetails.task_operation===undefined?"":shixunsDetails.task_operation[0]}:""*/} {/*}*/} - {shixunsDetails.status === 0 && this.props.identity < 4 ? + {shixunsDetails.shixun_status === 0 && this.props.identity < 4 ? 申请发布 : "" } @@ -772,7 +772,7 @@ class TPMBanner extends Component { - {shixunsDetails.status === 1 && this.props.identity < 4 ? + {shixunsDetails.shixun_status === 1 && this.props.identity < 4 ? 撤销发布 : "" } @@ -781,7 +781,7 @@ class TPMBanner extends Component { 发送至 @@ -847,7 +847,7 @@ class TPMBanner extends Component {
    - {shixunsDetails.status === 3 && + {shixunsDetails.shixun_status === 3 && 已关闭 } @@ -918,7 +918,7 @@ class TPMBanner extends Component {
    正在等待管理员的审核。在审核通过前,可以随时撤销发布
    diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js index 49d7cf016..09bab590d 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js @@ -239,7 +239,7 @@ class Challenges extends Component {

    简介 - @@ -249,7 +249,7 @@ class Challenges extends Component {

    - {ChallengesDataList === undefined ? "" :ChallengesDataList.description===null?"": + {ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"":

    }

    @@ -262,7 +262,7 @@ class Challenges extends Component {

    全部任务 - {this.props.identity < 4 && this.props.status === 0 ? + {this.props.identity < 4 && ChallengesDataList&&ChallengesDataList.shixun_status=== 0 ? : "" } - {this.props.identity < 4 && this.props.status === 0 ? + {this.props.identity < 4 && ChallengesDataList&&ChallengesDataList.shixun_status=== 0 ? this.delOperations(item.challenge_id)} - style={{ display:this.props.user.admin===true?"block":this.props.identity < 4 && this.props.status === 0 ? "block" : 'none' }} + style={{ display:this.props.user.admin===true?"block":this.props.identity < 4 && ChallengesDataList.shixun_status === 0 ? "block" : 'none' }} className="fl ring-op-green mr25"> @@ -371,7 +371,7 @@ class Challenges extends Component { {item.up_url != undefined && this.operations(item.challenge_id, "up")} - style={{ display:this.props.user.admin===true?"block":this.props.identity < 4 && this.props.status === 0 ? "block" : 'none' }} + style={{ display:this.props.user.admin===true?"block":this.props.identity < 4 && ChallengesDataList.shixun_status === 0 ? "block" : 'none' }} className="fl ring-op-green mr25"> @@ -381,7 +381,7 @@ class Challenges extends Component { {item.down_url != undefined && this.operations(item.challenge_id, "down")} - style={{ display: this.props.user.admin===true?"block":this.props.identity < 4 && this.props.status === 0 ? "block" : 'none' }} + style={{ display: this.props.user.admin===true?"block":this.props.identity < 4 && ChallengesDataList.shixun_status=== 0 ? "block" : 'none' }} className="fl ring-op-green mr25"> @@ -393,7 +393,7 @@ class Challenges extends Component { item.st === 1 ? Date: Mon, 24 Jun 2019 17:41:36 +0800 Subject: [PATCH 16/17] ConnectProject --- .../courses/busyWork/CommonWorkItem.js | 19 +++++++++++++- .../courses/busyWork/ConnectProject.js | 26 ++++++++++++++++--- .../modules/courses/busyWork/commonWork.js | 23 +++++++++++++++- 3 files changed, 63 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkItem.js b/public/react/src/modules/courses/busyWork/CommonWorkItem.js index 7f5bea2da..2ac4761e1 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkItem.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkItem.js @@ -97,6 +97,13 @@ class CommonWorkItem extends Component{ setupdate = () => { } + toCreateProject = () => { + if (window.location.port == 3007) { + window.location.href = '/testbdweb.educoder.net/projects/new' + } else { + window.location.href = '/projects/new' + } + } render(){ let { mainList,workType }=this.props; const { aModalVisible, fileList, revise_reason } = this.state @@ -195,12 +202,22 @@ class CommonWorkItem extends Component{

  • { // item.work_status && item.work_status.indexOf('关联项目') != -1 && - this.props.openConnectionProject(item)}>关联项目 + + this.props.toCreateProject(item)}>创建项目 + this.props.openConnectionProject(item)}>关联项目 + + } + + { // + item.work_status && item.work_status.indexOf('取消关联') != -1 && + this.props.cancelConnectionProject(item)}>取消关联 } { // item.work_status && item.work_status.indexOf('提交作品') != -1 && this.props.toWorkPostPage(this.props.match.params, item.homework_id)}>提交作品 } + + { // item.work_status && item.work_status.indexOf('补交作品') != -1 && diff --git a/public/react/src/modules/courses/busyWork/ConnectProject.js b/public/react/src/modules/courses/busyWork/ConnectProject.js index 4e359651b..73a4da8f8 100644 --- a/public/react/src/modules/courses/busyWork/ConnectProject.js +++ b/public/react/src/modules/courses/busyWork/ConnectProject.js @@ -44,6 +44,7 @@ class ConnectProject extends Component{ }).then((result)=>{ if(result.data.status==0){ this.closeConnectionProject() + this.props.connectSuccess() this.props.showNotification('关联成功') } }).catch((error)=>{ @@ -122,7 +123,24 @@ class ConnectProject extends Component{ footer={null} destroyOnClose={true} > -
    + +
    { (projects && !!projects.length || this.state.keyword) &&
    @@ -131,7 +149,7 @@ class ConnectProject extends Component{ onSearch={this.onSearchValue} > -
    +
    { projects.map(item => { - return

    {item.name}

    + return

    + 12 ? item.name : ''} className="name">{item.name} +

    })}
    diff --git a/public/react/src/modules/courses/busyWork/commonWork.js b/public/react/src/modules/courses/busyWork/commonWork.js index 18c668efe..28199c4c0 100644 --- a/public/react/src/modules/courses/busyWork/commonWork.js +++ b/public/react/src/modules/courses/busyWork/commonWork.js @@ -279,6 +279,26 @@ class commonWork extends Component{ console.log(error) }) } + connectSuccess = () => { + let {page,search,order}=this.state; + this.getList(page,search,order); + } + + cancelConnectionProject = (work) => { + let workId=this.props.match.params.workId; + let courseId=this.props.match.params.coursesId; + + const url = `/homework_commons/${work.homework_id}/student_works/cancel_relate_project.json` + axios.get(url).then((response)=> { + if (response.data.status == 0) { + let {page,search,order}=this.state; + this.getList(page,search,order); + this.props.showNotification('取消关联成功') + } + }).catch((error)=>{ + console.log(error) + }) + } render(){ @@ -341,7 +361,7 @@ class commonWork extends Component{
    */} - + From 16e1a517c65d61477c9fcc8541c783fd04173a1e Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 24 Jun 2019 18:23:56 +0800 Subject: [PATCH 17/17] .state --- .../modules/courses/coursesDetail/CoursesBanner.js | 8 ++++++-- .../src/modules/courses/members/studentsList.js | 13 ++++++++----- .../src/modules/courses/members/teacherList.js | 3 ++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index 74e79b172..3a1ab9331 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -1,7 +1,7 @@ import React, {Component} from 'react'; import {Link} from "react-router-dom"; import axios from 'axios'; -import {getImageUrl, trigger} from 'educoder'; +import {getImageUrl, trigger, on, off} from 'educoder'; import { Tooltip, message,Popover} from 'antd'; import CoursesListType from '../coursesPublic/CoursesListType'; import Addcourses from '../coursesPublic/Addcourses'; @@ -48,8 +48,12 @@ class CoursesBanner extends Component { componentDidMount() { this.onloadupdatabanner() - + on('updatabanner', this.updatabanner) + } + componentWillUnmount() { + off('updatabanner', this.updatabanner) } + onloadupdatabanner=()=>{ this.updatabanner() diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index ba29dfccb..3cb9bff77 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -79,7 +79,7 @@ const buildColumns = (that) => { return columns; } -// 1-按照学号排序 2-按照分班排序, +// 1-按照学生学号 2-按照分班名称, const ORDER_BY_NUM = 1; const ORDER_BY_GROUP = 2; @@ -317,6 +317,8 @@ class studentsList extends Component{ if (result.data.status == 0) { this.props.showNotification('移动成功') this.fetchAll() + this.props.updataleftNavfun() + } }).catch((error)=>{ console.log(error); @@ -362,6 +364,7 @@ class studentsList extends Component{ this.props.showNotification('删除成功') this.fetchAll() this.setState({checkBoxValues: []}) + trigger('updatabanner') } }).catch((error)=>{ console.log(error); @@ -428,9 +431,9 @@ class studentsList extends Component{ checkBoxValues, checkAllValue }=this.state; - let currentOrderName = '学号排序' + let currentOrderName = '学生学号' if (order == ORDER_BY_GROUP) { - currentOrderName = '分班排序' + currentOrderName = '分班名称' } const { coursesids } = this.props const course_group_id = this.props.match.params.course_group_id @@ -574,8 +577,8 @@ class studentsList extends Component{
  • {currentOrderName}
      -
    • this.onSortTypeChange(ORDER_BY_NUM)} >学号排序
    • -
    • this.onSortTypeChange(ORDER_BY_GROUP)} >分班排序
    • +
    • this.onSortTypeChange(ORDER_BY_NUM)} >学生学号
    • +
    • this.onSortTypeChange(ORDER_BY_GROUP)} >分班名称
  • diff --git a/public/react/src/modules/courses/members/teacherList.js b/public/react/src/modules/courses/members/teacherList.js index 02fab16a9..c9637f1f8 100644 --- a/public/react/src/modules/courses/members/teacherList.js +++ b/public/react/src/modules/courses/members/teacherList.js @@ -51,7 +51,7 @@ function buildColumns(that) { dataIndex: 'role', key: 'role', }] - that.course_groups && that.course_groups.length && columns.push({ + that.state.course_groups && that.state.course_groups.length && columns.push({ title: 管理权限, width: 230, key: 'course_groups', @@ -462,6 +462,7 @@ class studentsList extends Component{ if (response.data.status == 0) { // {"status":1,"message":"删除成功"} this.props.showNotification('删除成功') + trigger('updatabanner') this.fetchAll() } })