Browse Source

Merge branch 'bugfix-no-token' into develop

master
2183691628 2 years ago
parent
commit
9d5e4117d3
3 changed files with 22 additions and 6 deletions
  1. +4
    -2
      README.md
  2. +14
    -4
      src/utils/request.js
  3. +4
    -0
      src/views/login/index.vue

+ 4
- 2
README.md View File

@@ -1,7 +1,7 @@
<!-- <!--
* @Date: 2021-11-29 11:14:13 * @Date: 2021-11-29 11:14:13
* @LastEditors: JinxuChen * @LastEditors: JinxuChen
* @LastEditTime: 2021-12-14 09:26:47
* @LastEditTime: 2021-12-14 09:44:53
* @FilePath: \GpsCardAdmin\README.md * @FilePath: \GpsCardAdmin\README.md
* @description: * @description:
--> -->
@@ -82,4 +82,6 @@ FIX
`2021年12月14日` `2021年12月14日`
FIX FIX
- 修复 token过期移动端无法跳转的问题 - 修复 token过期移动端无法跳转的问题
- 删除 页面中不使用的 TopMenu组件
- 删除 页面中不使用的 TopMenu组件
- 取消 登录过期弹窗退出登录确认弹窗
- 增加 登录成功提示

+ 14
- 4
src/utils/request.js View File

@@ -1,12 +1,12 @@
/* /*
* @Date: 2021-12-08 15:59:46 * @Date: 2021-12-08 15:59:46
* @LastEditors: JinxuChen * @LastEditors: JinxuChen
* @LastEditTime: 2021-12-14 09:25:12
* @LastEditTime: 2021-12-14 09:40:30
* @FilePath: \GpsCardAdmin\src\utils\request.js * @FilePath: \GpsCardAdmin\src\utils\request.js
* @description: * @description:
*/ */
import axios from 'axios' import axios from 'axios'
import { MessageBox, Message } from 'element-ui'
import { Message } from 'element-ui'
import store from '@/store' import store from '@/store'
/* import { getToken } from '@/utils/auth' */ /* import { getToken } from '@/utils/auth' */


@@ -63,7 +63,7 @@ service.interceptors.response.use(
// 106 token验证过期; // 106 token验证过期;
if (res.code === 106) { if (res.code === 106) {
// to re-login // to re-login
MessageBox.confirm('登录过期,是否重新登录?', {
/* MessageBox.confirm('登录过期,是否重新登录?', {
confirmButtonText: '确认', confirmButtonText: '确认',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
@@ -71,7 +71,17 @@ service.interceptors.response.use(
store.dispatch('user/resetToken').then(() => { store.dispatch('user/resetToken').then(() => {
location.reload() location.reload()
}) })
})
}) */
setTimeout(() => {
store.dispatch('user/resetToken').then(() => {
Message({
message:/* res.message || */ 'token过期,请重新登录',
type: 'error',
duration: 1500
})
location.reload()
})
}, 1500)
} }
return Promise.reject(new Error(res.message || 'Error')) return Promise.reject(new Error(res.message || 'Error'))
} else { } else {


+ 4
- 0
src/views/login/index.vue View File

@@ -114,6 +114,10 @@ export default {
console.log("res", res.userName); console.log("res", res.userName);
this.$localStore.commit('userName', res.userName); this.$localStore.commit('userName', res.userName);
_this.$store.dispatch('user/getInfo'); _this.$store.dispatch('user/getInfo');
_this.$message({
message: '登录成功!',
type: 'success'
})
this.$router.push({ path: this.redirect || '/' }) this.$router.push({ path: this.redirect || '/' })
this.loading = false this.loading = false
}).catch(() => { }).catch(() => {


Loading…
Cancel
Save