loulijun2021
2022-12-08 2c7c1e76b012138ca25b869771b9011fe4de2803
1.修改刷新退出bug
已修改4个文件
11 ■■■■ 文件已修改
src/permission.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/app.js 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/user.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/request.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/permission.js
@@ -19,8 +19,7 @@
  // determine whether the user has logged in
  // const hasToken = getToken()
  // const hasToken = getCookie('admin')
  const hasToken = store.state.app.isGoToIndex
  const hasToken = getCookie('admin')
  if (hasToken) {
    if (to.path === '/login') {
      // if is logged in, redirect to the home page
src/store/modules/app.js
@@ -6,8 +6,7 @@
    withoutAnimation: false
  },
  device: 'desktop',
  buttonIsDisabled: false, // 自定义全局变量参数  控制按钮提交时disabled
  isGoToIndex: false // 自定义全局变量参数  是否进入到系统首页
  buttonIsDisabled: false // 自定义全局变量参数  控制按钮提交时disabled
}
const mutations = {
@@ -45,7 +44,6 @@
export default {
  namespaced: true,
  buttonIsDisabled: false,
  isGoToIndex: false,
  state,
  mutations,
  actions
src/store/modules/user.js
@@ -1,7 +1,6 @@
import { login, logout, getInfo, LoginMenu } from '@/api/user'
import { getToken, setToken, removeToken, setCookie, removeCookie, getCookie } from '@/utils/auth'
import { resetRouter } from '@/router'
import store from '@/store'
const getDefaultState = () => {
  return {
@@ -54,7 +53,6 @@
        // if (res.code === '302') {
        setCookie('code', res.code)
        // }
        store.state.app.isGoToIndex = true
        // commit('SET_TOKEN', data.token)
        // setToken(res)
        // commit('SET_TOKEN', res)
@@ -117,7 +115,6 @@
      logout(data).then(res => {
        if (res.code === '200') {
          store.state.app.isGoToIndex = false
          removeToken() // must remove  token  first
          resetRouter()
src/utils/request.js
@@ -68,7 +68,6 @@
        removeCookie('rediskey')
        removeCookie('code')
        removeCookie('guid')
        store.state.app.isGoToIndex = false
        setTimeout(() => {
          sessionStorage.removeItem('tabViews')
          window.location.reload()