diff --git a/public/react/src/modules/modals/Bottomsubmit.js b/public/react/src/modules/modals/Bottomsubmit.js index b128b2afe..c324a9692 100644 --- a/public/react/src/modules/modals/Bottomsubmit.js +++ b/public/react/src/modules/modals/Bottomsubmit.js @@ -1,15 +1,16 @@ import React, {Component} from 'react'; +import { + Button, +} from 'antd'; class Bottomsubmit extends Component { constructor(props) { super(props) - this.state = { - - } + this.state = {} } - cannelfun=()=>{ + cannelfun = () => { // window.location.href= this.props.history.replace(this.props.url); } @@ -30,8 +31,11 @@ class Bottomsubmit extends Component {
- - + +
@@ -41,7 +45,6 @@ class Bottomsubmit extends Component { } - export default Bottomsubmit; diff --git a/public/react/src/modules/tpm/TPMsettings/Configuration.js b/public/react/src/modules/tpm/TPMsettings/Configuration.js index c7156abe8..3b135ac7a 100644 --- a/public/react/src/modules/tpm/TPMsettings/Configuration.js +++ b/public/react/src/modules/tpm/TPMsettings/Configuration.js @@ -11,8 +11,6 @@ import { Button, } from 'antd'; -// import "antd/dist/antd.css"; - import locale from 'antd/lib/date-picker/locale/zh_CN'; import moment from 'moment'; @@ -21,8 +19,8 @@ import axios from 'axios'; import './css/TPMsettings.css'; -import {getImageUrl, toPath, getUrl, appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder'; import {handleDateStrings} from "./oldTPMsettings"; + import Bottomsubmit from "../../modals/Bottomsubmit"; const $ = window.$; @@ -34,7 +32,6 @@ let currentValue; const Option = Select.Option; const RadioGroup = Radio.Group; -const confirm = Modal.confirm; function range(start, end) { const result = []; @@ -61,12 +58,13 @@ export default class Shixuninformation extends Component { constructor(props) { super(props) this.state = { - can_copy:false, - use_scope:0, - opening_time:null, - opentime:false, - oldscope_partment:[], - scope_partment:[] + can_copy: false, + use_scope: 0, + opening_time: null, + opentime: false, + oldscope_partment: [], + scope_partment: [], + loading: false } } @@ -74,11 +72,11 @@ export default class Shixuninformation extends Component { if (this.props.data) { this.setState({ - can_copy: this.props.data && this.props.data.shixun.can_copy === undefined ? false :this.props.data.shixun.can_copy, - use_scope:this.props.data && this.props.data.shixun.use_scope, + can_copy: this.props.data && this.props.data.shixun.can_copy === undefined ? false : this.props.data.shixun.can_copy, + use_scope: this.props.data && this.props.data.shixun.use_scope, opening_time: this.props.data && this.props.data.shixun.opening_time, - opentime:!this.props.data && this.props.data.shixun.opening_time?false:true, - oldscope_partment:this.props.data&&this.props.data.shixun.scope_partment, + opentime: !this.props.data && this.props.data.shixun.opening_time ? false : true, + oldscope_partment: this.props.data && this.props.data.shixun.scope_partment, }) } @@ -102,11 +100,11 @@ export default class Shixuninformation extends Component { if (this.props.data) { this.setState({ - can_copy: this.props.data && this.props.data.shixun.can_copy === undefined ? false :this.props.data.shixun.can_copy, - use_scope:this.props.data && this.props.data.shixun.use_scope, + can_copy: this.props.data && this.props.data.shixun.can_copy === undefined ? false : this.props.data.shixun.can_copy, + use_scope: this.props.data && this.props.data.shixun.use_scope, opening_time: this.props.data && this.props.data.shixun.opening_time, - opentime:!this.props.data && this.props.data.shixun.opening_time?false:true, - oldscope_partment:this.props.data&&this.props.data.shixun.scope_partment, + opentime: !this.props.data && this.props.data.shixun.opening_time ? false : true, + oldscope_partment: this.props.data && this.props.data.shixun.scope_partment, }) } @@ -115,75 +113,84 @@ export default class Shixuninformation extends Component { onChangeTimePicker = (value, dateString) => { this.setState({ - opening_time: dateString === "" ? "" :handleDateStrings(dateString) + opening_time: dateString === "" ? "" : handleDateStrings(dateString) }) } onSubmits = () => { - let {can_copy,use_scope,scope_partment,opening_time }=this.state; + this.setState({ + loading: true + }) + let {can_copy, use_scope, scope_partment, opening_time} = this.state; let id = this.props.match.params.shixunId; - let url=`/shixuns/${id}/update_permission_setting.json`; + let url = `/shixuns/${id}/update_permission_setting.json`; axios.post(url, { - scope_partment:scope_partment, - shixun:{ - can_copy: can_copy, - use_scope:use_scope, - opening_time:opening_time + scope_partment: scope_partment, + shixun: { + can_copy: can_copy, + use_scope: use_scope, + opening_time: opening_time + } } - } ).then((response) => { - if(response.data.status===-1){ + if (response.data.status === -1) { - }else{ + } else { this.props.getdatas() - this.props.showNotification("保存成功") + this.props.showNotification("权限配置保存成功!") + this.setState({ + loading: false + }) } }).catch((error) => { - console.log(error) + this.setState({ + loading: false + }) }) } - CheckboxonChange=(e)=>{ - this.setState({ - can_copy:e.target.checked - }) - } - SelectOpenpublic=(e)=>{ + CheckboxonChange = (e) => { + this.setState({ + can_copy: e.target.checked + }) + } + + SelectOpenpublic = (e) => { this.setState({ use_scope: e.target.value }); } shixunScopeInput = (e) => { - let {scope_partment,oldscope_partment} = this.state; + let {scope_partment, oldscope_partment} = this.state; let datalist = scope_partment; - if (datalist===undefined) { - datalist=[] + if (datalist === undefined) { + datalist = [] } datalist.push(e) - let scopetype=false; + let scopetype = false; - scope_partment.map((item,key)=>{ - if(item===e){ - scopetype=true + scope_partment.map((item, key) => { + if (item === e) { + scopetype = true } }) - oldscope_partment.map((item,key)=>{ - if(item===e){ - scopetype=true + oldscope_partment.map((item, key) => { + if (item === e) { + scopetype = true } }) - if(scopetype===false){ + if (scopetype === false) { this.setState({ scope_partment: datalist }); - }else{ + } else { this.props.showNotification("请勿指定相同的单位") } @@ -221,11 +228,12 @@ export default class Shixuninformation extends Component { }); } - setopentime=(e)=>{ + setopentime = (e) => { this.setState({ - opentime:e.target.checked + opentime: e.target.checked }) } + render() { let options; @@ -253,9 +261,10 @@ export default class Shixuninformation extends Component {
- {this.props.data && this.props.data.shixun.use_scope === 0 &&this.props.data && this.props.data.shixun.status === 2?"":
- 公开程度: - + {this.props.data && this.props.data.shixun.use_scope === 0 && this.props.data && this.props.data.shixun.status === 2 ? "" : +
+ 公开程度: + 对所有单位公开 (实训发布后,所有用户可见) @@ -264,7 +273,7 @@ export default class Shixuninformation extends Component {
+ style={{display: this.state.use_scope === 0 ? 'none' : 'block'}}>
@@ -292,12 +301,12 @@ export default class Shixuninformation extends Component {
{ - this.state.oldscope_partment.map((item,key)=>{ + this.state.oldscope_partment.map((item, key) => { return (
  • - +
  • ) }) @@ -307,9 +316,9 @@ export default class Shixuninformation extends Component { return (
  • - this.deleteScopeInput(key)}> + this.deleteScopeInput(key)}>
  • @@ -331,31 +340,32 @@ export default class Shixuninformation extends Component { -
    } +
    }
    开启时间: - +
    - {this.state.opentime===false?"":
    - -
    } + {this.state.opentime === false ? "" :
    + +
    }
    @@ -365,7 +375,7 @@ export default class Shixuninformation extends Component {
    {this.props.identity < 5 ? : ""} + onSubmits={this.onSubmits} loadings={this.state.loading}/> : ""}
    ); } diff --git a/public/react/src/modules/tpm/TPMsettings/LearningSettings.js b/public/react/src/modules/tpm/TPMsettings/LearningSettings.js index d8caa83ee..40112c730 100644 --- a/public/react/src/modules/tpm/TPMsettings/LearningSettings.js +++ b/public/react/src/modules/tpm/TPMsettings/LearningSettings.js @@ -1,29 +1,14 @@ import React, {Component} from 'react'; import { - Input, - Select, Radio, Checkbox, - Popconfirm, - message, - Modal, - Icon, - DatePicker, - Breadcrumb, - Upload, - Button, - notification, - Tooltip, - Tabs } from 'antd'; import axios from 'axios'; import './css/TPMsettings.css'; -import {getImageUrl, toPath, getUrl, appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder'; - import Bottomsubmit from "../../modals/Bottomsubmit"; const RadioGroup = Radio.Group; @@ -32,7 +17,19 @@ const RadioGroup = Radio.Group; export default class Shixuninformation extends Component { constructor(props) { super(props) - this.state = {} + this.state = { + vnc: false, + hide_code: false, + is_secret_repository: false, + code_hidden: false, + forbid_copy: false, + test_set_permission: true, + task_pass: true, + websshshow: false, + multi_webssh: false, + opensshRadio: null, + loading: false + } } @@ -41,27 +38,188 @@ export default class Shixuninformation extends Component { this.setState({ vnc: this.props.data && this.props.data.shixun.vnc, - use_scope: this.props.data && this.props.data.shixun.use_scope, - opening_time: this.props.data && this.props.data.shixun.opening_time, - opentime: !this.props.data && this.props.data.shixun.opening_time ? false : true, - oldscope_partment: this.props.data && this.props.data.shixun.scope_partment, + code_hidden: this.props.data && this.props.data.shixun.code_hidden, + forbid_copy: this.props.data && this.props.data.shixun.forbid_copy, + hide_code: this.props.data && this.props.data.shixun.hide_code, + task_pass: this.props.data && this.props.data.shixun.task_pass, + test_set_permission: this.props.data && this.props.data.shixun.test_set_permission, + is_secret_repository: this.props.data && this.props.data.shixun.is_secret_repository, + websshshow: this.props.data && this.props.data.shixun.webssh === 0 ? false : true, + multi_webssh: this.props.data && this.props.data.shixun.multi_webssh, + opensshRadio: this.props.data && this.props.data.shixun.webssh === 0 ? null : this.props.data && this.props.data.shixun.webssh, }) + // if(this.props.data && this.props.data.shixun.status===0){ + // this.setState({ + // task_pass:true + // }) + // } + + } + + } + + componentDidUpdate(prevProps, prevState) { + if (prevProps.data != this.props.data) { + if (this.props.data) { + + this.setState({ + vnc: this.props.data && this.props.data.shixun.vnc, + code_hidden: this.props.data && this.props.data.shixun.code_hidden, + forbid_copy: this.props.data && this.props.data.shixun.forbid_copy, + hide_code: this.props.data && this.props.data.shixun.hide_code, + task_pass: this.props.data && this.props.data.shixun.task_pass, + test_set_permission: this.props.data && this.props.data.shixun.test_set_permission, + is_secret_repository: this.props.data && this.props.data.shixun.is_secret_repository, + websshshow: this.props.data && this.props.data.shixun.webssh === 0 ? false : true, + multi_webssh: this.props.data && this.props.data.shixun.multi_webssh, + opensshRadio: this.props.data && this.props.data.shixun.webssh === 0 ? null : this.props.data && this.props.data.shixun.webssh, + }) + + // if(this.props.data && this.props.data.shixun.status===0){ + // this.setState({ + // task_pass:true + // }) + // } + + } } - let departmentsUrl = `/shixuns/departments.json`; - axios.get(departmentsUrl).then((response) => { - if (response.status === 200) { - if (response.data.message === undefined) { - this.setState({ - departmentslist: response.data.shools_name - }); - } + } + + + onSubmits = () => { + this.setState({ + loading: true + }) + let id = this.props.match.params.shixunId; + let url = `/shixuns/${id}/update_permission_setting.json`; + axios.post(url, + { + shixun: { + code_hidden: this.state.code_hidden, + forbid_copy: this.state.forbid_copy, + hide_code: this.state.hide_code, + multi_webssh: this.state.multi_webssh, + task_pass: this.state.task_pass, + test_set_permission: this.state.test_set_permission, + vnc: this.state.vnc, + webssh: this.state.websshshow === false ? 0 : this.state.opensshRadio, + }, + is_secret_repository: this.state.is_secret_repository + } + ).then((response) => { + if (response.data.status === -1) { + + } else { + this.props.getdatas() + this.props.showNotification("学习页面设置保存成功!") + this.setState({ + loading: false + }) } }).catch((error) => { - console.log(error) - }); + this.setState({ + loading: false + }) + }) + } + + Checkvnc = () => { + console.log(this.state.vnc) + if (this.state.vnc === false) { + this.setState({ + hide_code: false, + is_secret_repository: false, + code_hidden: false, + forbid_copy: false, + multi_webssh: false, + websshshow: false, + }) + } + this.setState({ + vnc: !this.state.vnc + }) + } + + Checkhide_code = () => { + if (this.state.hide_code === false) { + this.setState({ + is_secret_repository: false + }) + } + this.setState({ + hide_code: !this.state.hide_code + }) + } + + Checkis_secret_repository = () => { + this.setState({ + is_secret_repository: !this.state.is_secret_repository + }) + } + + Checkcode_hidden = () => { + this.setState({ + code_hidden: !this.state.code_hidden + }) + } + + Checkforbid_copy = () => { + this.setState({ + forbid_copy: !this.state.forbid_copy + }) } + Checktask_pass = () => { + this.setState({ + task_pass: !this.state.task_pass + }) + } + + Checktest_set_permission = () => { + this.setState({ + test_set_permission: !this.state.test_set_permission + }) + } + + Checkwebsshshow = () => { + if (this.state.websshshow === false) { + this.setState({ + vnc: false, + opensshRadio: 1 + }) + } else { + this.setState({ + multi_webssh: false, + opensshRadio: null + }) + } + this.setState({ + websshshow: !this.state.websshshow + }) + + } + + Checkmulti_webssh = () => { + this.setState({ + multi_webssh: !this.state.multi_webssh + }) + } + + opensshRadio = (e) => { + if (e.target.value === 1) { + this.setState({ + multi_webssh: false + }) + } else { + this.setState({ + multi_webssh: true + }) + } + this.setState({ + opensshRadio: e.target.value + }); + } render() { console.log(this.props) @@ -69,107 +227,107 @@ export default class Shixuninformation extends Component {
    -
    + {this.state.websshshow === true ? "" :
    开启图形化界面: + checked={this.state.vnc} + onChange={this.Checkvnc}> -
    +
    } -
    + {this.state.vnc === true ? "" :
    命令行: + checked={this.state.websshshow} + onChange={this.Checkwebsshshow}> -
    +
    } -
    + {this.state.vnc === true ? "" : this.state.websshshow === true ?
    - - 命令行练习窗口 + 命令行练习窗口 (选中则给学员提供用于练习操作的命令行,命令行的操作不会对学生的实验环境造成影响) - 命令行评测窗口 命令行评测窗口 (选中则给学员提供用于评测操作的命令行,命令行的操作可以对学生的实验环境产生影响) - + {this.state.opensshRadio === 2 ?
    + checked={this.state.multi_webssh} + onChange={this.Checkmulti_webssh}>
    -
    -
    + : ""} +
    : ""} -
    + {this.state.vnc === true ? "" :
    隐藏代码窗口: + checked={this.state.hide_code} + onChange={this.Checkhide_code}> -
    +
    } -
    + {this.state.vnc === true || this.state.hide_code === true ? "" :
    公开版本库: + checked={this.state.is_secret_repository} + onChange={this.Checkis_secret_repository}> -
    +
    } -
    - 隐藏代码目录: + {this.state.vnc === true ? "" :
    + 隐藏代码目录: + checked={this.state.code_hidden} + onChange={this.Checkcode_hidden}> -
    +
    } -
    - 禁用复制粘贴: + {this.state.vnc === true ? "" :
    + 禁用复制粘贴: + checked={this.state.forbid_copy} + onChange={this.Checkforbid_copy}> -
    +
    }
    - 跳关: + 跳关: + checked={this.state.task_pass} + onChange={this.Checktask_pass}>
    - 测试集解锁: + 测试集解锁: + checked={this.state.test_set_permission} + onChange={this.Checktest_set_permission}>
    @@ -179,7 +337,7 @@ export default class Shixuninformation extends Component { {this.props.identity < 5 ? : ""} + onSubmits={this.onSubmits} loadings={this.state.loading}/> : ""}
    ); } diff --git a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js index 61f8c6bd8..f36c3a738 100644 --- a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js +++ b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js @@ -44,7 +44,8 @@ class Shixuninformation extends Component { Executiveordervalue: "", Compilecommandvalue: "", shixun_service_configs: undefined, - fileList:[] + fileList:[], + loading:false } } @@ -77,6 +78,10 @@ class Shixuninformation extends Component { selectscripts:this.props.data.shixun.standard_scripts[0].id }) this.get_mirror_script(this.props.data.shixun.standard_scripts[0].id) + }else{ + this.props.form.setFieldsValue({ + selectscripts:this.props.data.shixun.choice_standard_scripts + }) } let newlist = "" @@ -641,6 +646,9 @@ class Shixuninformation extends Component { } onSubmits=()=>{ + this.setState({ + loading:true + }) const mdContnet = this.contentMdRef.current.getValue().trim(); let{choice_standard_scriptssum,choice_standard_scripts}=this.state; this.props.form.validateFieldsAndScroll((err, values) => { @@ -675,14 +683,22 @@ class Shixuninformation extends Component { if (result.data) { this.props.getdatas() if(result.data.shixun_identifier){ - this.props.showNotification("基本信息更新成功") - + this.props.showNotification("基本信息更新成功!") + this.setState({ + loading:false + }) } } } }).catch((error) => { - // ////console.log(error) + this.setState({ + loading:false + }) }); + }else{ + this.setState({ + loading:false + }) } }); } @@ -997,7 +1013,8 @@ class Shixuninformation extends Component { { this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter===true?"": 私密版本库: (若需要对学员隐藏部分版本库内容时,请选中;选中保存后表示启用私密版本库,请将需要对学员隐藏的文件存储在私密版本库) + value={this.state.simichecked}> + {this.state.simichecked===false?"(若需要对学员隐藏部分版本库内容时,请选中;选中保存后表示启用私密版本库,请将需要对学员隐藏的文件存储在私密版本库)":"已创建的私密版本库及其内容,将在“保存”时被删除"} } {this.props.identity < 3 ?
    @@ -1064,6 +1081,24 @@ class Shixuninformation extends Component { } : ""} + {/**/} + {/*
    */} + {/*

    已创建的私密版本库及其内容,将在“保存”时被删除

    */} + {/*

    是否确认取消选择?

    */} + {/*
    */} + + {/* */} + {/**/} + + {this.props.identity < 5 ? : ""} + onSubmits={this.onSubmits} loadings={this.state.loading} /> : ""}
    ); diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js index ed04b63ab..343b07ec7 100644 --- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js +++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js @@ -32,7 +32,7 @@ export default class TPMsettings extends Component { this.getdatas() } - getdatas=()=>{ + getdatas = () => { let id = this.props.match.params.shixunId; let Url = `/shixuns/` + id + `/settings.json`; @@ -113,7 +113,14 @@ export default class TPMsettings extends Component { render() { - let showtabs= this.props.shixunsDetails === undefined ?"":this.props.shixunsDetails.is_jupyter===true?"":"学习页面设置" + let showtabs = this.props.shixunsDetails === undefined ? "" : this.props.shixunsDetails.is_jupyter === true ? "" : "学习页面设置" + + // let a="isvnc"; + // let b="isVNC"; + // console.log(a.indexOf("vnc")) + // console.log(b.indexOf("vnc")) + + console.log( this.props.shixunsDetails === undefined ? "" : this.props.shixunsDetails.is_jupyter === false ? "学习页面设置" : "") return (
    @@ -130,6 +137,9 @@ export default class TPMsettings extends Component { .ant-tabs-nav{ margin-left:20px; } + .ant-tabs-nav .ant-tabs-tab { + font-size: 16px; + } ` } @@ -161,22 +171,24 @@ export default class TPMsettings extends Component { this.getdatas()} + getdatas={() => this.getdatas()} /> this.getdatas()} + getdatas={() => this.getdatas()} /> - {/*{ this.props.shixunsDetails===undefined?"":this.props.shixunsDetails.is_jupyter===true?"":*/} - {/* */} - {/*}*/} + {this.props.shixunsDetails === undefined ? "" : this.props.shixunsDetails.is_jupyter === false ? + + this.getdatas()} + /> + :"" } { + this.setState({ + loading: true + }) const mdContnet = this.contentMdRef.current.getValue().trim(); this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { @@ -110,17 +113,20 @@ class Newshixuns extends Component { // window.open("/shixuns/"+response.data.shixun_identifier+"/challenges"); } else { this.setState({ - bottonloading: false + loading: true }) } }).catch((error) => { - console.log(error) this.setState({ - bottonloading: false + loading: true }) }) + }else{ + this.setState({ + loading: true + }) } }); }; @@ -703,7 +709,7 @@ class Newshixuns extends Component {
    - this.handleSubmit()}/> + this.handleSubmit()} loadings={this.state.loading}/>
    );