loulijun2021
2022-12-06 881cd19ffa9e5d05b722cfeae951f50971c0593a
1.增加页签关闭时重新登录功能
已修改5个文件
14 ■■■■ 文件已修改
src/permission.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/app.js 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/user.js 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/request.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/scgl/sckbg.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/permission.js
@@ -19,7 +19,8 @@
  // determine whether the user has logged in
  // const hasToken = getToken()
  const hasToken = getCookie('admin')
  // const hasToken = getCookie('admin')
  const hasToken = store.state.app.isGoToIndex
  if (hasToken) {
    if (to.path === '/login') {
      // if is logged in, redirect to the home page
src/store/modules/app.js
@@ -6,7 +6,8 @@
    withoutAnimation: false
  },
  device: 'desktop',
  buttonIsDisabled: false // 自定义全局变量参数  控制按钮提交时disabled
  buttonIsDisabled: false, // 自定义全局变量参数  控制按钮提交时disabled
  isGoToIndex: false // 自定义全局变量参数  是否进入到系统首页
}
const mutations = {
@@ -44,6 +45,7 @@
export default {
  namespaced: true,
  buttonIsDisabled: false,
  isGoToIndex: false,
  state,
  mutations,
  actions
src/store/modules/user.js
@@ -1,6 +1,7 @@
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 {
@@ -53,7 +54,7 @@
        // if (res.code === '302') {
        setCookie('code', res.code)
        // }
        store.state.app.isGoToIndex = true
        // commit('SET_TOKEN', data.token)
        // setToken(res)
        // commit('SET_TOKEN', res)
@@ -116,6 +117,7 @@
      logout(data).then(res => {
        if (res.code === '200') {
          store.state.app.isGoToIndex = false
          removeToken() // must remove  token  first
          resetRouter()
src/utils/request.js
@@ -68,6 +68,7 @@
        removeCookie('rediskey')
        removeCookie('code')
        removeCookie('guid')
        store.state.app.isGoToIndex = false
        setTimeout(() => {
          sessionStorage.removeItem('tabViews')
          window.location.reload()
src/views/scgl/sckbg.vue
@@ -297,7 +297,7 @@
                sortable="custom"
              />
              <el-table-column
                label="未报工数量"
                label="未收料数量"
                width="120"
              >
                <!--                sortable="custom"-->