Fixiaobai
2023-08-28 6622218409bdb6d1cbf85be33367b7630f84029e
	modified:   src/layout/components/Navbar.vue
modified: src/layout/index.vue
modified: src/router/index.js
modified: src/views/login/index.vue
已修改4个文件
29 ■■■■ 文件已修改
src/layout/components/Navbar.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/index.vue 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/login/index.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/components/Navbar.vue
@@ -107,7 +107,7 @@
    },
    async logout() {
      // await this.$store.dispatch('user/logout')
      localStorage.removeItem("user")
      sessionStorage.removeItem("user")
      this.$router.push(`/login?redirect=${this.$route.fullPath}`)     
      this.$router.replace({path: '/login'});
      location.reload();
@@ -115,7 +115,7 @@
        getUser(){
            get(this.$url.info).then(res=>{
                this.user = res.data
        localStorage.setItem("user",JSON.stringify(res.data))
        sessionStorage.setItem("user",JSON.stringify(res.data))
            })
        }
  }
src/layout/index.vue
@@ -51,6 +51,12 @@
      }
    }
  },
  created() {
    if (sessionStorage.getItem("flushPage") == 0) {
      location.reload();
      sessionStorage.setItem("flushPage",1)
    }
  },
  methods: {
    handleClickOutside() {
      this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
@@ -80,30 +86,37 @@
    position: relative;
    height: 100%;
    width: 100%;
    &.mobile.openSidebar{
      position: fixed;
      top: 0;
    }
    .sidebar-container{
      box-shadow: 0 0 0.857143rem rgba(0,0,0,.12);
    }
    .main-container{
      position: relative;
      background:  #f0f2f5;
      .clearFixed{
        height: 50px;
      }
      .breadcrumb{
        position: fixed;
        left: 0.57rem !important;
        width: 93.8%;
        z-index: 999;
      }
      .app-main{
        margin-top: 4vh;
      }
    }
  }
  .drawer-bg {
    background: #000;
    opacity: 0.3;
@@ -130,5 +143,4 @@
  .mobile .fixed-header {
    width: 100%;
  }
</style>
}</style>
src/router/index.js
@@ -526,8 +526,8 @@
function createRouter(Routees) {
  if (JSON.parse(localStorage.getItem("user")) != undefined && JSON.parse(localStorage.getItem("user")) != null) {
    let role = JSON.parse(localStorage.getItem("user")).role
  if (JSON.parse(sessionStorage.getItem("user")) != undefined && JSON.parse(sessionStorage.getItem("user")) != null) {
    let role = JSON.parse(sessionStorage.getItem("user")).role
    let menuFather = baseRouter
    const dataMenuFather = fn3(menuFather)
    role.roleMenuList.forEach((r) => {
@@ -607,7 +607,7 @@
  } else {
    // 不是登录页面
    // 2. 判断 是否登录过
    let token = localStorage.getItem('user')
    let token = sessionStorage.getItem('user')
    if(token!=null&&token!=undefined){
      await resetRouter()
    }
src/views/login/index.vue
@@ -96,7 +96,8 @@
          this.$store.dispatch('user/login', this.loginForm).then(async () => {
            await get(this.$url.info).then(res => {
              this.user = res.data
              localStorage.setItem("user", JSON.stringify(res.data))
              sessionStorage.setItem("user", JSON.stringify(res.data))
              sessionStorage.setItem("flushPage",0)
            })
            this.$router.push({ path: this.redirect || '/' })
            this.loading = false