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', labelother: 'close other',
labelall: 'close all' labelall: 'close all'
}, },
info:{
realname:'English names can only contain uppercase and lowercase letters, "-", and spaces'
},
total: { total: {
author: 'author', author: 'author',
editor: 'editor', editor: 'editor',

View File

@@ -16,6 +16,8 @@ const zh = {
label: '标签选项', label: '标签选项',
labelother: '关闭其他', labelother: '关闭其他',
labelall: '关闭所有' labelall: '关闭所有'
}, info: {
realname: '英文名字只能包含大小写英文字母、"-" 、和 空格'
}, },
total: { total: {
author: '作者', 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-option v-for="item in df_country" :label="item.en_name" :key="item.en_name" :value="item.en_name"></el-option>
</el-select> </el-select>
</el-form-item> </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> <span v-if="this.email_num == 1">{{ addForm.realname }}</span>
<el-input v-model="addForm.realname" v-else></el-input> <el-input v-model="addForm.realname" v-else></el-input>
</el-form-item> </el-form-item>
@@ -529,10 +529,10 @@ export default {
this.getCountry(); this.getCountry();
this.addVisible = true; this.addVisible = true;
this.btn_alert = false; this.btn_alert = false;
if(this.$refs.add_Form){ if (this.$refs.add_Form) {
this.$refs.add_Form.resetFields(); this.$refs.add_Form.resetFields();
} }
this.addForm.email = ''; this.addForm.email = '';
this.email_num = 0; this.email_num = 0;
this.reviewerForm = {}; this.reviewerForm = {};
@@ -653,7 +653,7 @@ export default {
.then((res) => { .then((res) => {
console.log('res at line 554:', res); console.log('res at line 554:', res);
if (res.code == 0) { if (res.code == 0) {
this.btn_alert=false; this.btn_alert = false;
this.reviewerForm = res.data.result; this.reviewerForm = res.data.result;
this.addForm = { this.addForm = {
account: this.reviewerForm.account, account: this.reviewerForm.account,
@@ -927,7 +927,6 @@ export default {
// 保存用户的添加 // 保存用户的添加
saveAdd(addForm) { saveAdd(addForm) {
this.$refs.add_Form.validate((valid) => { this.$refs.add_Form.validate((valid) => {
if (valid) { if (valid) {
let path_add = ''; let path_add = '';
@@ -963,8 +962,16 @@ export default {
if (this.email_num == 2) { if (this.email_num == 2) {
// 新的 // 新的
path_add = this.urlList.addReviewer; path_add = this.urlList.addReviewer;
if(this.btn_alert){ if (this.btn_alert) {
return false 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 { } else {
// 重复 // 重复
@@ -972,11 +979,15 @@ export default {
data.user_id = data.reviewer_id; data.user_id = data.reviewer_id;
} }
if (this.cvitaTable.length == 0) { if (this.cvitaTable.length == 0) {
if (this.addForm.qualifications == '' || this.addForm.qualifications == undefined) { if (this.addForm.qualifications == '' || this.addForm.qualifications == undefined) {
this.$message.error('Please make sure that CV. document is uploaded successfully'); this.$message.error('Please make sure that CV. document is uploaded successfully');
return false; return false;
}
} }
}
return false;
this.$api this.$api
.post(path_add, data) .post(path_add, data)
.then((res) => { .then((res) => {

View File

@@ -123,7 +123,7 @@
<el-form-item label="Confirm password :" prop="repassword"> <el-form-item label="Confirm password :" prop="repassword">
<el-input v-model="addForm.repassword" type="password"></el-input> <el-input v-model="addForm.repassword" type="password"></el-input>
</el-form-item> </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-input v-model="addForm.realname"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="Phone :" prop="phone"> <el-form-item label="Phone :" prop="phone">
@@ -315,6 +315,10 @@
// 检测邮箱弹出框 // 检测邮箱弹出框
handleAdd() { handleAdd() {
this.emailForm = {
mark_new: ''
}
this.email_num = 0 this.email_num = 0
this.emailVisible = true this.emailVisible = true
}, },
@@ -359,6 +363,7 @@
this.email_num = 1 this.email_num = 1
this.emailForm.mark_new = 'Account already exist!' this.emailForm.mark_new = 'Account already exist!'
} else { } else {
this.addForm={}
this.addForm.email = this.emailForm.email this.addForm.email = this.emailForm.email
this.addForm.account = this.emailForm.account this.addForm.account = this.emailForm.account
this.email_num = 2 this.email_num = 2
@@ -386,6 +391,16 @@
this.$refs.addTab.validate((valid) => { this.$refs.addTab.validate((valid) => {
if (valid) { if (valid) {
if (this.addForm.password == this.addForm.repassword) { 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 this.$api
.post('api/User/addUser', this.addForm) .post('api/User/addUser', this.addForm)
.then(res => { .then(res => {

View File

@@ -813,7 +813,8 @@
export default { export default {
data() { data() {
return { return {
citeLoading: false, authorList: [], citeLoading: false,
authorList: [],
loading: false, loading: false,
authorArticlesList: [], authorArticlesList: [],
userrole: localStorage.getItem('U_status'), userrole: localStorage.getItem('U_status'),
@@ -1300,6 +1301,14 @@ export default {
// 保存个人信息 // 保存个人信息
saveMessage() { 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 this.$api
.post('api/Ucenter/updateUserInfo', this.MessForm) .post('api/Ucenter/updateUserInfo', this.MessForm)
.then((res) => { .then((res) => {

View File

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