English name

This commit is contained in:
2024-10-29 09:57:14 +08:00
parent a67e52d60d
commit 62a4f2769a
6 changed files with 57 additions and 15 deletions

View File

@@ -17,6 +17,9 @@ const en = {
labelother: 'close other',
labelall: 'close all'
},
info:{
realname:'English names can only contain uppercase and lowercase letters, "-", and spaces'
},
total: {
author: 'author',
editor: 'editor',

View File

@@ -16,6 +16,8 @@ const zh = {
label: '标签选项',
labelother: '关闭其他',
labelall: '关闭所有'
}, info: {
realname: '英文名字只能包含大小写英文字母、"-" 、和 空格'
},
total: {
author: '作者',

View File

@@ -120,7 +120,7 @@
<el-option v-for="item in df_country" :label="item.en_name" :key="item.en_name" :value="item.en_name"></el-option>
</el-select>
</el-form-item>
<el-form-item label="Realname :" prop="realname">
<el-form-item label="English name :" prop="realname">
<span v-if="this.email_num == 1">{{ addForm.realname }}</span>
<el-input v-model="addForm.realname" v-else></el-input>
</el-form-item>
@@ -529,10 +529,10 @@ export default {
this.getCountry();
this.addVisible = true;
this.btn_alert = false;
if(this.$refs.add_Form){
this.$refs.add_Form.resetFields();
if (this.$refs.add_Form) {
this.$refs.add_Form.resetFields();
}
this.addForm.email = '';
this.email_num = 0;
this.reviewerForm = {};
@@ -653,7 +653,7 @@ export default {
.then((res) => {
console.log('res at line 554:', res);
if (res.code == 0) {
this.btn_alert=false;
this.btn_alert = false;
this.reviewerForm = res.data.result;
this.addForm = {
account: this.reviewerForm.account,
@@ -927,7 +927,6 @@ export default {
// 保存用户的添加
saveAdd(addForm) {
this.$refs.add_Form.validate((valid) => {
if (valid) {
let path_add = '';
@@ -963,8 +962,16 @@ export default {
if (this.email_num == 2) {
// 新的
path_add = this.urlList.addReviewer;
if(this.btn_alert){
return false
if (this.btn_alert) {
return false;
}
if (this.$validateString(data.realname)) {
console.log('Input string is valid.');
} else {
console.log('Input string is invalid.');
this.$message.error(this.$t('info.realname'));
return false;
}
} else {
// 重复
@@ -972,11 +979,15 @@ export default {
data.user_id = data.reviewer_id;
}
if (this.cvitaTable.length == 0) {
if (this.addForm.qualifications == '' || this.addForm.qualifications == undefined) {
this.$message.error('Please make sure that CV. document is uploaded successfully');
return false;
if (this.addForm.qualifications == '' || this.addForm.qualifications == undefined) {
this.$message.error('Please make sure that CV. document is uploaded successfully');
return false;
}
}
}
return false;
this.$api
.post(path_add, data)
.then((res) => {

View File

@@ -123,7 +123,7 @@
<el-form-item label="Confirm password :" prop="repassword">
<el-input v-model="addForm.repassword" type="password"></el-input>
</el-form-item>
<el-form-item label="Realname :" prop="realname">
<el-form-item label="English name :" prop="realname">
<el-input v-model="addForm.realname"></el-input>
</el-form-item>
<el-form-item label="Phone :" prop="phone">
@@ -315,6 +315,10 @@
// 检测邮箱弹出框
handleAdd() {
this.emailForm = {
mark_new: ''
}
this.email_num = 0
this.emailVisible = true
},
@@ -359,6 +363,7 @@
this.email_num = 1
this.emailForm.mark_new = 'Account already exist!'
} else {
this.addForm={}
this.addForm.email = this.emailForm.email
this.addForm.account = this.emailForm.account
this.email_num = 2
@@ -386,6 +391,16 @@
this.$refs.addTab.validate((valid) => {
if (valid) {
if (this.addForm.password == this.addForm.repassword) {
if (this.$validateString(this.addForm.realname)) {
console.log('Input string is valid.');
} else {
console.log('Input string is invalid.');
this.$message.error(this.$t('info.realname'))
return false
}
this.$api
.post('api/User/addUser', this.addForm)
.then(res => {

View File

@@ -813,7 +813,8 @@
export default {
data() {
return {
citeLoading: false, authorList: [],
citeLoading: false,
authorList: [],
loading: false,
authorArticlesList: [],
userrole: localStorage.getItem('U_status'),
@@ -1300,6 +1301,14 @@ export default {
// 保存个人信息
saveMessage() {
if (this.$validateString(this.MessForm.realname)) {
console.log('Input string is valid.');
} else {
console.log('Input string is invalid.');
this.$message.error(this.$t('info.realname'))
return false
}
this.$api
.post('api/Ucenter/updateUserInfo', this.MessForm)
.then((res) => {

View File

@@ -12,7 +12,9 @@ import './components/common/directives';
import 'babel-polyfill';
import api from './api/index.js';
import Common from './components/common/common'
Vue.prototype.$validateString = function (str) {
return /^[a-zA-Z\s-]+$/.test(str);
}
// 引入富文本编辑器
import VueQuillEditor from 'vue-quill-editor'