+ style={{display: this.state.use_scope === 0 ? 'none' : 'block'}}>
);
}
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 {