diff --git a/src/api/login.js b/src/api/login.js index eed7c5b..40e7363 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -1,11 +1,11 @@ import fetch from '@/utils/fetch' -export function login(email, password) { +export function login(username, password) { return fetch({ url: '/user/login', method: 'post', data: { - email, + username, password } }) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 5a204b3..f236e7e 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -27,9 +27,9 @@ const user = { actions: { // 登录 Login({ commit }, userInfo) { - const email = userInfo.email.trim() + const username = userInfo.username.trim() return new Promise((resolve, reject) => { - login(email, userInfo.password).then(response => { + login(username, userInfo.password).then(response => { const data = response.data setToken(data.token) commit('SET_TOKEN', data.token) diff --git a/src/utils/validate.js b/src/utils/validate.js index 41339a2..834a8dd 100644 --- a/src/utils/validate.js +++ b/src/utils/validate.js @@ -2,10 +2,9 @@ * Created by jiachenpan on 16/11/18. */ -/* 是否是公司邮箱*/ -export function isWscnEmail(str) { - const reg = /^[a-z0-9](?:[-_.+]?[a-z0-9]+)*@wallstreetcn\.com$/i - return reg.test(str.trim()) +export function isvalidUsername(str) { + const valid_map = ['admin', 'editor'] + return valid_map.indexOf(str.trim()) >= 0 } /* 合法uri*/ diff --git a/src/views/login/index.vue b/src/views/login/index.vue index fba73b0..0da87b9 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -3,11 +3,11 @@ 系统登录 - - - + + + - + @@ -21,21 +21,21 @@ 登录 - admin账号为:admin@wallstreetcn.com 密码随便填 - editor账号:editor@wallstreetcn.com 密码随便填 + 账号:admin 密码随便填 + 账号:editor 密码随便填