登录界面 css 优化

This commit is contained in:
pixel
2019-10-10 23:33:35 +08:00
parent ba379e9705
commit b0c6bd5a13
4 changed files with 62 additions and 46 deletions
+10 -20
View File
@@ -1,6 +1,5 @@
import { login } from '@/api/user'
import router from '@/router/index'
import { Message } from 'element-ui'
export const user = {
namespaced: true,
state: {
@@ -36,26 +35,17 @@ export const user = {
},
actions: {
async LoginIn({ commit }, loginInfo) {
try {
const res = await login(loginInfo)
commit('setUserInfo', res.data.user)
commit('setToken', res.data.token)
commit('setExpiresAt', res.data.expiresAt)
if (res.success) {
const redirect = router.history.current.query.redirect
if (redirect) {
router.push({ path: redirect, replace: true })
} else {
router.push({ path: '/layout/dashbord', replace: true })
}
const res = await login(loginInfo)
commit('setUserInfo', res.data.user)
commit('setToken', res.data.token)
commit('setExpiresAt', res.data.expiresAt)
if (res.success) {
const redirect = router.history.current.query.redirect
if (redirect) {
router.push({ path: redirect, replace: true })
} else {
router.push({ path: '/layout/dashbord', replace: true })
}
} catch (err) {
Message({
type: 'error',
message: err,
showClose: true
})
return Promise.reject(err)
}
}
},