|
@@ -104,30 +104,20 @@
|
|
|
return
|
|
|
}
|
|
|
const userInfo = {name: username, password}
|
|
|
-
|
|
|
- // 将user保存到vuex的state,同时保存到本地
|
|
|
- this.$store.dispatch('saveUser', userInfo)
|
|
|
- // 保存记住用户名和密码的状态
|
|
|
- storageUtils.saveStatus(this.check)
|
|
|
- // 将token保存到会议存储
|
|
|
- // storageUtils.saveToken(res.token)
|
|
|
- // 跳转到管理界面
|
|
|
- this.$router.replace('/admin')
|
|
|
-
|
|
|
// 请求登录
|
|
|
- // const res = await reqLogin(userInfo, 'login')
|
|
|
- // if (res.token) {
|
|
|
- // // 将user保存到vuex的state,同时保存到本地
|
|
|
- // this.$store.dispatch('saveUser', userInfo)
|
|
|
- // // 保存记住用户名和密码的状态
|
|
|
- // storageUtils.saveStatus(this.check)
|
|
|
- // // 将token保存到会议存储
|
|
|
- // storageUtils.saveToken(res.token)
|
|
|
- // // 跳转到管理界面
|
|
|
- // this.$router.replace('/admin')
|
|
|
- // } else {
|
|
|
- // this.$message.error('用户名或密码错误!')
|
|
|
- // }
|
|
|
+ const res = await reqLogin(userInfo, 'login')
|
|
|
+ if (res.token) {
|
|
|
+ // 将user保存到vuex的state,同时保存到本地
|
|
|
+ this.$store.dispatch('saveUser', userInfo)
|
|
|
+ // 保存记住用户名和密码的状态
|
|
|
+ storageUtils.saveStatus(this.check)
|
|
|
+ // 将token保存到会议存储
|
|
|
+ storageUtils.saveToken(res.token)
|
|
|
+ // 跳转到管理界面
|
|
|
+ this.$router.replace('/admin')
|
|
|
+ } else {
|
|
|
+ this.$message.error('用户名或密码错误!')
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
// 重置表单
|