diff --git a/src/components/common/langs/en.js b/src/components/common/langs/en.js
index 4294e80..768204e 100644
--- a/src/components/common/langs/en.js
+++ b/src/components/common/langs/en.js
@@ -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',
diff --git a/src/components/common/langs/zh.js b/src/components/common/langs/zh.js
index 330e6df..9a771e9 100644
--- a/src/components/common/langs/zh.js
+++ b/src/components/common/langs/zh.js
@@ -16,6 +16,8 @@ const zh = {
label: '标签选项',
labelother: '关闭其他',
labelall: '关闭所有'
+ }, info: {
+ realname: '英文名字只能包含大小写英文字母、"-" 、和 空格'
},
total: {
author: '作者',
diff --git a/src/components/page/components/reviewerList/add.vue b/src/components/page/components/reviewerList/add.vue
index 1d9585f..5fb7a24 100644
--- a/src/components/page/components/reviewerList/add.vue
+++ b/src/components/page/components/reviewerList/add.vue
@@ -120,7 +120,7 @@
-
+
{{ addForm.realname }}
@@ -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) => {
diff --git a/src/components/page/partyList.vue b/src/components/page/partyList.vue
index 64e04f8..0cc295d 100644
--- a/src/components/page/partyList.vue
+++ b/src/components/page/partyList.vue
@@ -123,7 +123,7 @@
-
+
@@ -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 => {
diff --git a/src/components/page/partyRole.vue b/src/components/page/partyRole.vue
index fe85f84..f1a288a 100644
--- a/src/components/page/partyRole.vue
+++ b/src/components/page/partyRole.vue
@@ -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) => {
diff --git a/src/main.js b/src/main.js
index 21e2e6b..7ac5975 100644
--- a/src/main.js
+++ b/src/main.js
@@ -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'