From 517ebc2eb4c1f56d404b6cddc2e4452c9d5f1cf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Dec 2019 09:37:20 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E8=AE=BE=E7=BD=AE=E5=88=86=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shixunHomework/Trainingjobsetting.js | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js index 1b20f56bc..03ae5ec33 100644 --- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js +++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js @@ -132,7 +132,9 @@ class Trainingjobsetting extends Component { CalculateMax: 100,//总分值 borredszf:"ml10 color-grey-9", borredszfl:true, - borredszfls:'' + borredszfls:'', + total_scoretwo:0, + total_score:0, } // console.log("获取到的值") // console.log("Trainingjobsetting") @@ -302,7 +304,10 @@ class Trainingjobsetting extends Component { proportion: result.data.shixun_evaluation === 0 ? "均分比例" : result.data.shixun_evaluation === 1 ? "经验值比例" : result.data.shixun_evaluation === 2 ? "自定义分值" : "", publicwork: result.data.work_public, challenge_settings: result.data.challenge_settings, - code_review: result.data.code_review + code_review: result.data.code_review, + total_scoretwo:result.data.total_score, + total_score:result.data.total_score, + }) this.props.Getdataback(result, result.data); @@ -646,6 +651,7 @@ class Trainingjobsetting extends Component { if (this.state.completionefficiencyscore === true) { latedeductiontwos = this.state.latedeductiontwo; } + //从这里开始记得等于0的时候还要做判断 if (challenge_scoredata.length > 0) { var len = 0; for (var k = 0; k < challenge_scoredata.length; k++) { @@ -680,6 +686,16 @@ class Trainingjobsetting extends Component { } + }else{ + try { + if(parseFloat(this.state.CalculateMax)!==parseFloat(0)){ + this.props.showNotification(`分值之和必须等于总分值:${this.state.CalculateMax}分`); + this.scrollToAnchor("zongfentimeid"); + return; + } + }catch (e) { + + } } var url = `/homework_commons/${homeworkid}/update_settings.json`; @@ -707,7 +723,9 @@ class Trainingjobsetting extends Component { shixun_evaluation: this.state.proportion === "均分比例" ? 0 : this.state.proportion === "经验值比例" ? 1 : this.state.proportion === "自定义分值" ? 2 : 0, challenge_settings: array, score_open: this.state.publicwork, - total_score:this.state.CalculateMax + total_score:this.state.CalculateMax, + total_scoretwo:this.state.CalculateMax,//记录总分值点击取消的时候还原总分值 + } } else { // //非统一配置 @@ -738,7 +756,8 @@ class Trainingjobsetting extends Component { shixun_evaluation: this.state.proportion === "均分比例" ? 0 : this.state.proportion === "经验值比例" ? 1 : this.state.proportion === "自定义分值" ? 2 : 0, challenge_settings: array, score_open: this.state.publicwork, - total_score:this.state.CalculateMax + total_score:this.state.CalculateMax, + total_scoretwo:this.state.CalculateMax } } @@ -1193,8 +1212,7 @@ class Trainingjobsetting extends Component { } //总比分 Totalscorecalculation = (value) => { - - + debugger this.setState({ CalculateMax: value, }) @@ -2150,6 +2168,9 @@ class Trainingjobsetting extends Component { }) this.refs.targetElementTrainingjobsetting.scrollIntoView(); this.getTrainingjobsetting(false); + this.setState({ + CalculateMax:this.state.total_scoretwo, + }) } rulesCheckInfo = (rules) => { From fc4ec9aab3a925b6106b602e1153873c31aebaec Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Fri, 6 Dec 2019 09:59:02 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dissues=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E8=A1=8C=E6=97=B6=E9=97=B4=E5=8F=8A=E4=BB=A3=E7=A0=81=E5=9D=97?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E4=B8=8D=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/page/component/WebSSHTimer.js | 7 +++---- .../react/src/modules/page/component/monaco/TPIMonaco.js | 4 +++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/page/component/WebSSHTimer.js b/public/react/src/modules/page/component/WebSSHTimer.js index a42dfc29b..e83887345 100644 --- a/public/react/src/modules/page/component/WebSSHTimer.js +++ b/public/react/src/modules/page/component/WebSSHTimer.js @@ -47,7 +47,7 @@ const five_min = 5 * 60 * 1000; 倒计时为0时,出现“重启”按钮 */ const isSSHInIframe = false; -class WebSSHTimer extends React.PureComponent { +class WebSSHTimer extends Component { constructor(props) { super(props) @@ -165,7 +165,6 @@ class WebSSHTimer extends React.PureComponent { }) } componentDidUpdate(prevProps, prevState, snapshot) { - console.log('======',prevProps, this.state, this.startTimeRemain); // 仅初始化一次 if (prevProps.showTimerProp === false && this.props.showTimerProp === true) { if (this.intervalHandler) { @@ -199,8 +198,8 @@ class WebSSHTimer extends React.PureComponent { // } } else if (e.data.tp === "sshWorking") { - this.startTimeRemain = 60; - this.forceUpdate() + // this.startTimeRemain = 60; + // this.forceUpdate(); } }); // } else { diff --git a/public/react/src/modules/page/component/monaco/TPIMonaco.js b/public/react/src/modules/page/component/monaco/TPIMonaco.js index 519125f93..5e687e9ce 100644 --- a/public/react/src/modules/page/component/monaco/TPIMonaco.js +++ b/public/react/src/modules/page/component/monaco/TPIMonaco.js @@ -244,8 +244,10 @@ class TPIMonaco extends Component { // 重要:setState(因获取代码、重置代码等接口引起的调用)调用引起的变化才需要setValue editor_monaco.setValue(this.props.repositoryCode) } - // 代码没变也需要layout,可能从命令行自动切回了代码tab + // 代码没变也需要layout,可能从命令行自动切回了代码tab + editor_monaco.layout(); + // Clears the editor's undo history. // TODO // extend_editor.clearHistory() From a100dacc6eb9d6a7a46e0c1ba547d382ac89db00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Dec 2019 10:57:52 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6=E5=92=8C?= =?UTF-8?q?=E8=A1=A8=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/user/account/AccountBasicEdit.js | 122 ++++++++++++------ 1 file changed, 86 insertions(+), 36 deletions(-) diff --git a/public/react/src/modules/user/account/AccountBasicEdit.js b/public/react/src/modules/user/account/AccountBasicEdit.js index 033f433b0..9d292a168 100644 --- a/public/react/src/modules/user/account/AccountBasicEdit.js +++ b/public/react/src/modules/user/account/AccountBasicEdit.js @@ -136,7 +136,7 @@ class AccountBasic extends Component { } handleSubmit = () => { - this.props.form.validateFieldsAndScroll((err, values) => { + this.props.form.validateFieldsAndScroll({ force: true }, (err, values) => { console.log(values); let {basicInfo}=this.props; if(!err ){ @@ -148,12 +148,12 @@ class AccountBasic extends Component { this.props.showNotification('请先选择院系/部门') return; } - + let url=`/users/accounts/${basicInfo.id}.json` axios.put((url),{ nickname:values.nickname, // 认证中的不能修改 - name: basicInfo.authentication == 'uncertified' ? + name: basicInfo.authentication == 'uncertified' ? (this.state.showRealName ? values.name : this.state.realName ) : basicInfo.name, show_realname:this.state.showRealName, gender:parseInt(values.sex), @@ -173,7 +173,7 @@ class AccountBasic extends Component { } this.props.getBasicInfo(); this.props.history.push('/account/profile') - + } }).catch((error)=>{ console.log(error); @@ -357,7 +357,7 @@ class AccountBasic extends Component { }) } - + addOrgSuccess = (name) => { // const schoolList = this.state.schoolList.slice(0) @@ -377,7 +377,7 @@ class AccountBasic extends Component { } showApplyForAddOrgModal = () => { - this.applyForAddOrgForm.setVisible(true) + this.applyForAddOrgForm.setVisible(true) } showApplyForAddChildOrgModal = () => { let{school,schoolList}=this.state; @@ -385,18 +385,18 @@ class AccountBasic extends Component { return item.name == school; }); if(arr.length > 0){ - this.applyForAddChildOrgForm.setVisible(true) + this.applyForAddChildOrgForm.setVisible(true) }else{ this.props.showNotification("请先选择正确的单位或者学校!"); } } - checkNameLength = (rule, value, callback) => { - if (value && value.length <= MAX_NAME_LENGTH) { - callback(); - return; - } - callback(`请输入真实姓名,最大限制${MAX_NAME_LENGTH}个字符`); - } + // checkNameLength = (rule, value, callback) => { + // if (value && value.length <= MAX_NAME_LENGTH) { + // callback(); + // return; + // } + // callback(`请输入真实姓名,最大限制${MAX_NAME_LENGTH}个字符`); + // } // 切换职称 changeJob=(e)=>{ this.setState({ @@ -410,9 +410,53 @@ class AccountBasic extends Component { }) } } - + //昵称 + handleSubmitName(rule, value, callback){ + if (value) { + let iconRule1 = /[`~!@#$%^&*()\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im; +// 判断是否含有emoji表情 + let iconRule2 = /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/ig; +// 如果为true,字符串含有emoji表情 ,false不含 + const iconRule2s =iconRule2.test(value); +// 如果为true,字符串含有特殊符号 ,false不 + const iconRule1s =iconRule1.test(value); + + if (iconRule2s===true|| iconRule1s===true) { + callback('2-20位中英文、数字及下划线'); + } + else if(value.length<2){ + callback('2-20位中英文、数字及下划线'); + }else if(value.length>=21){ + callback('2-20位中英文、数字及下划线'); + } + } + callback(); + } + + // 姓名 + handleSubmitNames(rule, value, callback){ + if (value) { + let iconRule1 = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im; +// 判断是否含有emoji表情 + let iconRule2 = /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/ig; +// 如果为true,字符串含有emoji表情 ,false不含 + const iconRule2s =iconRule2.test(value); +// 如果为true,字符串含有特殊符号 ,false不 + const iconRule1s =iconRule1.test(value); + + if (iconRule2s===true|| iconRule1s===true) { + callback('2-10位中英文、数字'); + } + else if(value.length<2){ + callback('2-10位中英文、数字'); + }else if(value.length>=11){ + callback('2-10位中英文、数字'); + } + } + callback(); + } render() { - let{ + let{ nameLength, showRealName, filterSchoolList, @@ -446,10 +490,10 @@ class AccountBasic extends Component { {...propsWithoutForm} addOrgSuccess={this.addOrgSuccess} > this.applyForAddChildOrgForm = form} + {...propsWithoutForm} wrappedComponentRef={(form) => this.applyForAddChildOrgForm = form} addChildOrgSuccess={this.addChildOrgSuccess} > - +