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() {
if (this.questionform.is_anonymous == '' && this.questionform.is_anonymous != '0') {
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) {
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;
}
} else {
//英文
let blankCount = 0;
for (let i in Char_Cter.match(/ /g)) {
blankCount++;
}
if (blankCount <= 50) {
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;
return false;
}
const regex = /[\u4E00-\u9FA5\uF900-\uFA2D]{1,}/;
if (this.questionform.comment && this.questionform.comment != '') {
if (regex.test(this.questionform.comment)) {
// 如果输入的是中文,则清空输入框
this.$message.error('Comments for the Authors cannot use Chinese.');
return false;
}
}
if (this.questionform.confident && this.questionform.confident != '') {
if (regex.test(this.questionform.confident)) {
// 如果输入的是中文,则清空输入框
this.$message.error('Confidential Comments to the Editor cannot be in Chinese.');
return false;
}
}
// 验证相加的字数
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++;
}
}
// 提交接口
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;
}
});
if (blankCount + wenziCount <= 60) {
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;
}
} else {
//英文
let blankCount = 0;
for (let i in Char_Cter.match(/ /g)) {
blankCount++;
}
if (blankCount <= 50) {
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() {}