no message

Former-commit-id: 2fa068b68b43c3ff5fc6ba0be409f146c54bada9
Former-commit-id: 47a21c24b3293a94749b6d3dc7f64273e3c8a4e6
Former-commit-id: 70292108e4607f934f649e0e0ec824a67b14edc8
This commit is contained in:
李杨
2018-01-27 09:45:46 +08:00
parent 5e830d81e7
commit 25afbbe45e
3 changed files with 18 additions and 2 deletions

View File

@@ -31,7 +31,7 @@ Mock.mock('/login', 'post', ({url, type, body}) => {
} }
} else { } else {
return { return {
code: 500, code: 401,
msg: '用户名或密码错误' msg: '用户名或密码错误'
} }
} }

View File

@@ -74,9 +74,12 @@ export default {
password: this.formLogin.password password: this.formLogin.password
} }
}) })
.then (res => { .then(res => {
this.$log('登录结果', res) this.$log('登录结果', res)
}) })
.catch(err => {
console.log(err)
})
} else { } else {
return false return false
} }

View File

@@ -1,4 +1,17 @@
import Vue from 'vue' import Vue from 'vue'
import { Message } from 'element-ui'
import axios from 'axios' import axios from 'axios'
axios.interceptors.response.use(res => {
// 在这里对返回的数据进行处理
if (res.data.code !== 0) {
Message.error(res.data.msg)
return Promise.reject(res.data.msg)
} else {
return res.data.data
}
}, err => {
return Promise.reject(err)
})
Vue.prototype.$http = axios Vue.prototype.$http = axios