login
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
// import { Dialog } from './utils.js'
|
import { Dialog } from './utils.js'
|
||||||
import store from '../vuex/store'
|
import store from '../vuex/store'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
import i18n from '../i18n/i18n'
|
import i18n from '../i18n/i18n'
|
||||||
@@ -37,6 +37,7 @@ axios.interceptors.response.use(
|
|||||||
if (error && error.response) {
|
if (error && error.response) {
|
||||||
switch (error.response.status) {
|
switch (error.response.status) {
|
||||||
case 400:
|
case 400:
|
||||||
|
Dialog(error.message)
|
||||||
break
|
break
|
||||||
case 401:
|
case 401:
|
||||||
store.dispatch('setSignOut')
|
store.dispatch('setSignOut')
|
||||||
@@ -57,7 +58,7 @@ export const post = (sevmethod, params) => {
|
|||||||
resolve(response.data)
|
resolve(response.data)
|
||||||
}, error => {
|
}, error => {
|
||||||
// Dialog(error.message)
|
// Dialog(error.message)
|
||||||
reject(error.message)
|
reject(error)
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
reject(error)
|
reject(error)
|
||||||
|
|||||||
@@ -151,14 +151,19 @@ export default {
|
|||||||
async _authlogin () {
|
async _authlogin () {
|
||||||
try {
|
try {
|
||||||
let res = await authlogin(this.username, encrypt(this.password))
|
let res = await authlogin(this.username, encrypt(this.password))
|
||||||
|
if (res.code === '1') {
|
||||||
let obj = {}
|
let obj = {}
|
||||||
obj = Object.assign({}, res)
|
obj = Object.assign({}, res.result)
|
||||||
this.$store.dispatch('userInfo', JSON.stringify(obj))
|
this.$store.dispatch('userInfo', JSON.stringify(obj))
|
||||||
this.hide()
|
this.hide()
|
||||||
this.$router.push('/index/home')
|
this.$router.push('/index/home')
|
||||||
|
} else {
|
||||||
|
this.Dialog(res.desc)
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.disabled = false
|
this.disabled = false
|
||||||
// this.toast(err)
|
// this.toast(err)
|
||||||
|
if (err.status !== 400) {
|
||||||
const loading = this.$loading({
|
const loading = this.$loading({
|
||||||
lock: true,
|
lock: true,
|
||||||
text: this.$t('common.loading'),
|
text: this.$t('common.loading'),
|
||||||
@@ -169,6 +174,7 @@ export default {
|
|||||||
loading.close()
|
loading.close()
|
||||||
}, 4000)
|
}, 4000)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
show (e) {
|
show (e) {
|
||||||
// 关闭中文keyboard
|
// 关闭中文keyboard
|
||||||
|
|||||||
Reference in New Issue
Block a user