Comments for the Authors和Confidential Comments to the Editor不能包含中文

This commit is contained in:
2024-11-21 12:56:42 +08:00
parent 7d7f516cfc
commit dc71a4c936

View File

@@ -622,79 +622,97 @@ export default {
questionSubmit() { questionSubmit() {
if (this.questionform.is_anonymous == '' && this.questionform.is_anonymous != '0') { if (this.questionform.is_anonymous == '' && this.questionform.is_anonymous != '0') {
this.$message.error('Please choose disclose your name or remain anonymous.'); this.$message.error('Please choose disclose your name or remain anonymous.');
} else {
// 验证相加的字数
let Char_Cter =
this.questionform.qu9contents +
' ' +
this.questionform.qu10contents +
' ' +
this.questionform.qu11contents +
' ' +
this.questionform.qu12contents +
' ' +
this.questionform.qu13contents +
' ' +
this.questionform.comment;
if (new RegExp('[\\u4E00-\\u9FFF]+', 'g').test(Char_Cter)) {
//中文
let blankCount = 0;
for (let i in Char_Cter.match(/ /g)) {
blankCount++;
}
let wenziCount = 0;
for (let j = 0; j < Char_Cter.length; j++) {
if (Char_Cter.charCodeAt(j) < 0 || Char_Cter.charCodeAt(j) > 255) {
wenziCount++;
}
}
if (blankCount + wenziCount <= 60) { return false;
this.$message.error('We encourage you to enrich your comment further to help improve the peer paper.'); }
this.$message({ const regex = /[\u4E00-\u9FA5\uF900-\uFA2D]{1,}/;
offset: '380', if (this.questionform.comment && this.questionform.comment != '') {
type: 'error', if (regex.test(this.questionform.comment)) {
message: 'We encourage you to enrich your comment further to help improve the peer paper.' // 如果输入的是中文,则清空输入框
}); this.$message.error('Comments for the Authors cannot use Chinese.');
return false;
} return false;
} else { }
//英文 }
let blankCount = 0; if (this.questionform.confident && this.questionform.confident != '') {
for (let i in Char_Cter.match(/ /g)) { if (regex.test(this.questionform.confident)) {
blankCount++; // 如果输入的是中文,则清空输入框
} this.$message.error('Confidential Comments to the Editor cannot be in Chinese.');
if (blankCount <= 50) {
this.$message.error('We encourage you to enrich your comment further to help improve the peer paper.'); return false;
this.$message({ }
offset: '380', }
type: 'error', // 验证相加的字数
message: 'We encourage you to enrich your comment further to help improve the peer paper.' let Char_Cter =
}); this.questionform.qu9contents +
return false; ' ' +
this.questionform.qu10contents +
' ' +
this.questionform.qu11contents +
' ' +
this.questionform.qu12contents +
' ' +
this.questionform.qu13contents +
' ' +
this.questionform.comment;
if (new RegExp('[\\u4E00-\\u9FFF]+', 'g').test(Char_Cter)) {
//中文
let blankCount = 0;
for (let i in Char_Cter.match(/ /g)) {
blankCount++;
}
let wenziCount = 0;
for (let j = 0; j < Char_Cter.length; j++) {
if (Char_Cter.charCodeAt(j) < 0 || Char_Cter.charCodeAt(j) > 255) {
wenziCount++;
} }
} }
// 提交接口
this.loading = true; if (blankCount + wenziCount <= 60) {
this.$refs.question.validate((valid) => { this.$message.error('We encourage you to enrich your comment further to help improve the peer paper.');
if (valid) { this.$message({
this.$api.post('api/Reviewer/questionSubmit', this.questionform).then((res) => { offset: '380',
if (res.code == 0) { type: 'error',
this.loading = false; message: 'We encourage you to enrich your comment further to help improve the peer paper.'
this.$message.success('Success!!'); });
this.getData(); return false;
this.$router.push('/per_text_success'); }
} else { } else {
this.loading = false; //英文
// this.$message.error('Question submit error!'); let blankCount = 0;
this.$message.error(res.msg); for (let i in Char_Cter.match(/ /g)) {
} blankCount++;
}); }
} else { if (blankCount <= 50) {
this.loading = false; this.$message.error('We encourage you to enrich your comment further to help improve the peer paper.');
} this.$message({
}); offset: '380',
type: 'error',
message: 'We encourage you to enrich your comment further to help improve the peer paper.'
});
return false;
}
} }
// 提交接口
this.loading = true;
this.$refs.question.validate((valid) => {
if (valid) {
this.$api.post('api/Reviewer/questionSubmit', this.questionform).then((res) => {
if (res.code == 0) {
this.loading = false;
this.$message.success('Success!!');
this.getData();
this.$router.push('/per_text_success');
} else {
this.loading = false;
// this.$message.error('Question submit error!');
this.$message.error(res.msg);
}
});
} else {
this.loading = false;
}
});
} }
}, },
mounted() {} mounted() {}