diff --git a/public/react/src/modules/tpm/TPMsettings/Configuration.js b/public/react/src/modules/tpm/TPMsettings/Configuration.js
index 803a6bf89..9bf457993 100644
--- a/public/react/src/modules/tpm/TPMsettings/Configuration.js
+++ b/public/react/src/modules/tpm/TPMsettings/Configuration.js
@@ -69,16 +69,16 @@ export default class Shixuninformation extends Component {
}
componentDidMount() {
- if (this.props.data&&this.props.data.shixun) {
-
- this.setState({
- can_copy:this.props.data.shixun && this.props.data.shixun.can_copy === undefined ? false : this.props.data.shixun&&this.props.data.shixun.can_copy,
- use_scope: this.props.data.shixun && this.props.data.shixun.use_scope,
- opening_time: this.props.data.shixun && this.props.data.shixun.opening_time,
- opentime: !this.props.data.shixun && this.props.data.shixun.opening_time ? false : true,
- oldscope_partment:this.props.data.shixun && this.props.data.shixun.scope_partment,
- })
-
+ if (this.props.data) {
+ if (this.props.data.shixun) {
+ this.setState({
+ can_copy: this.props.data && this.props.data.shixun.can_copy === undefined ? false : this.props.data && 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,
+ })
+ }
}
let departmentsUrl = `/shixuns/departments.json`;
axios.get(departmentsUrl).then((response) => {
@@ -98,15 +98,15 @@ export default class Shixuninformation extends Component {
componentDidUpdate(prevProps, prevState) {
if (prevProps.data != this.props.data) {
if (this.props.data) {
-
- this.setState({
- can_copy: this.props.data.shixun && this.props.data.shixun.can_copy === undefined ? false : this.props.data.shixun&&this.props.data.shixun.can_copy,
- use_scope: this.props.data.shixun&& this.props.data.shixun.use_scope,
- opening_time: this.props.data.shixun && this.props.data.shixun.opening_time,
- opentime: !this.props.data.shixun && this.props.data.shixun.opening_time ? false : true,
- oldscope_partment: this.props.data.shixun && this.props.data.shixun.scope_partment,
- })
-
+ if (this.props.data.shixun) {
+ this.setState({
+ can_copy: this.props.data && this.props.data.shixun.can_copy === undefined ? false : this.props.data && 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,
+ })
+ }
}
}
}
@@ -262,7 +262,7 @@ export default class Shixuninformation extends Component {
- {this.props.data.shixun && this.props.data.shixun.use_scope === 0 && this.props.data.shixun && 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 ? "" :
公开程度:
diff --git a/public/react/src/modules/tpm/TPMsettings/LearningSettings.js b/public/react/src/modules/tpm/TPMsettings/LearningSettings.js
index 8d02cb4b8..dfcdda5ba 100644
--- a/public/react/src/modules/tpm/TPMsettings/LearningSettings.js
+++ b/public/react/src/modules/tpm/TPMsettings/LearningSettings.js
@@ -34,35 +34,8 @@ export default class Shixuninformation extends Component {
componentDidMount() {
- if (this.props.data&&this.props.data.shixun) {
-
- 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
- // })
- // }
-
- }
-
- }
-
- componentDidUpdate(prevProps, prevState) {
- if (prevProps.data != this.props.data) {
- if (this.props.data) {
-
+ if (this.props.data ) {
+ if (this.props.data.shixun) {
this.setState({
vnc: this.props.data && this.props.data.shixun.vnc,
code_hidden: this.props.data && this.props.data.shixun.code_hidden,
@@ -84,6 +57,35 @@ export default class Shixuninformation extends Component {
}
}
+
+ }
+
+ componentDidUpdate(prevProps, prevState) {
+ if (prevProps.data != this.props.data) {
+ if (this.props.data) {
+ if (this.props.data.shixun) {
+ 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
+ // })
+ // }
+
+ }
+ }
+ }
}
diff --git a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js
index 1b2dad166..2fdd30146 100644
--- a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js
+++ b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js
@@ -55,39 +55,41 @@ class Shixuninformation extends Component {
componentDidUpdate(prevProps, prevState) {
if (prevProps.data != this.props.data) {
- if (this.props.data&&this.props.data.shixun) {
- this.setState({
- shixunName: this.props.data.shixun&&this.props.data.shixun.name,
- trainee:this.props.data.shixun&&this.props.data.shixun.trainee,
- choice_main_type: this.props.data.shixun&&this.props.data.shixun.choice_main_type,
- choice_small_type: this.props.data.shixun&&this.props.data.shixun.choice_small_type,
- choice_standard_scripts:this.props.data.shixun&&this.props.data.shixun.choice_standard_scripts,
- shixunmemoMDvalue: this.props.data.shixun&&this.props.data.shixun.evaluate_script,
- simichecked: this.props.data.shixun&&this.props.data.shixun.is_secret_repository,
- shixun_service_configs: this.props.data.shixun&&this.props.data.shixun.shixun_service_configs,
- standard_scripts:this.props.data.shixun&&this.props.data.shixun.standard_scripts,
- shixun_service_configlist:this.props.data.shixun&&this.props.data.shixun.shixun_service_configs,
+
+ if (this.props.data ) {
+ if (this.props.data.shixun){
+ this.setState({
+ shixunName: this.props.data && this.props.data.shixun.name,
+ trainee: this.props.data && this.props.data.shixun.trainee,
+ choice_main_type: this.props.data && this.props.data.shixun.choice_main_type,
+ choice_small_type: this.props.data && this.props.data.shixun.choice_small_type,
+ choice_standard_scripts: this.props.data && this.props.data.shixun.choice_standard_scripts,
+ shixunmemoMDvalue: this.props.data && this.props.data.shixun.evaluate_script,
+ simichecked: this.props.data && this.props.data.shixun.is_secret_repository,
+ shixun_service_configs: this.props.data && this.props.data.shixun.shixun_service_configs,
+ standard_scripts: this.props.data && this.props.data.shixun.standard_scripts,
+ shixun_service_configlist: this.props.data && this.props.data.shixun.shixun_service_configs,
})
- if(this.props.data.shixun&&this.props.data.shixun.choice_standard_scripts===null){
+ if (this.props.data && this.props.data.shixun.choice_standard_scripts === null) {
this.setState({
- choice_standard_scripts:{id: this.props.data.shixun&&this.props.data.shixun.standard_scripts[0].id, value: ""},
- choice_standard_scriptssum:this.props.data.shixun&&this.props.data.shixun.standard_scripts[0].id
+ choice_standard_scripts: {id: this.props.data && this.props.data.shixun.standard_scripts[0].id, value: ""},
+ choice_standard_scriptssum: this.props.data && this.props.data.shixun.standard_scripts[0].id
})
this.props.form.setFieldsValue({
- selectscripts:this.props.data.shixun&&this.props.data.shixun.standard_scripts[0].id
+ selectscripts: this.props.data && this.props.data.shixun.standard_scripts[0].id
})
- this.get_mirror_script(this.props.data.shixun&&this.props.data.shixun.standard_scripts[0].id)
- }else{
+ this.get_mirror_script(this.props.data && this.props.data.shixun.standard_scripts[0].id)
+ } else {
this.props.form.setFieldsValue({
- selectscripts:this.props.data.shixun&&this.props.data.shixun.choice_standard_scripts
+ selectscripts: this.props.data && this.props.data.shixun.choice_standard_scripts
})
}
let newlist = ""
- this.props.data.shixun&&this.props.data.shixun.choice_small_type.map((item, key) => {
- this.props.data.shixun.small_type.map((i,k)=>{
- if (item===i.id) {
+ this.props.data && this.props.data.shixun.choice_small_type.map((item, key) => {
+ this.props.data && this.props.data.shixun.small_type.map((i, k) => {
+ if (item === i.id) {
newlist = newlist + `${i.description}`
}
})
@@ -96,23 +98,24 @@ class Shixuninformation extends Component {
subvalues: newlist
})
- this.props.data.shixun&&this.props.data.shixun.main_type.map((item,key)=>{
- if(item.id===this.props.data.shixun&&this.props.data.shixun.choice_main_type){
+ this.props.data && this.props.data.shixun.main_type.map((item, key) => {
+ if (item.id === this.props.data && this.props.data.shixun.choice_main_type) {
this.setState({
- mainvalues:item.description,
+ mainvalues: item.description,
})
}
})
this.props.form.setFieldsValue({
- name:this.props.data.shixun&&this.props.data.shixun.name,
- trainee: this.props.data.shixun&&this.props.data.shixun.trainee,
- selectleft: this.props.data.shixun&&this.props.data.shixun.choice_main_type,
- selectright:this.props.data.shixun&&this.props.data.shixun.choice_small_type,
+ name: this.props.data && this.props.data.shixun.name,
+ trainee: this.props.data && this.props.data.shixun.trainee,
+ selectleft: this.props.data && this.props.data.shixun.choice_main_type,
+ selectright: this.props.data && this.props.data.shixun.choice_small_type,
})
- this.contentMdRef.current.setValue(this.props.data.shixun&&this.props.data.shixun.description);
+ this.contentMdRef.current.setValue(this.props.data && this.props.data.shixun.description);
}
}
+ }
}
getshixunmemoMDvalue = (value, e) => {
@@ -754,7 +757,7 @@ class Shixuninformation extends Component {
return isLt150M;
},
}
- let operateauthority = this.props.identity === 1 ? true : this.props.identity < 5 && this.props.data.shixun&&this.props.data.shixun.status == 0 ? true : false;
+ let operateauthority = this.props.identity === 1 ? true : this.props.identity < 5 && this.props.data&&this.props.data.shixun.status == 0 ? true : false;
return (