Pārlūkot izejas kodu

Merge branch 'bugfix-no-token' into develop

master
2183691628 pirms 2 gadiem
vecāks
revīzija
9d5e4117d3
3 mainītis faili ar 22 papildinājumiem un 6 dzēšanām
  1. +4
    -2
      README.md
  2. +14
    -4
      src/utils/request.js
  3. +4
    -0
      src/views/login/index.vue

+ 4
- 2
README.md Parādīt failu

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

+ 14
- 4
src/utils/request.js Parādīt failu

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

@@ -63,7 +63,7 @@ service.interceptors.response.use(
// 106 token验证过期;
if (res.code === 106) {
// to re-login
MessageBox.confirm('登录过期,是否重新登录?', {
/* MessageBox.confirm('登录过期,是否重新登录?', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
@@ -71,7 +71,17 @@ service.interceptors.response.use(
store.dispatch('user/resetToken').then(() => {
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'))
} else {


+ 4
- 0
src/views/login/index.vue Parādīt failu

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


Notiek ielāde…
Atcelt
Saglabāt