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个文件
145 ■■■■ 文件已修改
src/layout/components/Navbar.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/index.vue 132 ●●●● 补丁 | 查看 | 原始文档 | 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
@@ -1,18 +1,18 @@
<template>
  <div :class="classObj" class="app-wrapper">
    <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
    <div v-if="device === 'mobile' && sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
    <sidebar class="sidebar-container" />
    <div class="main-container">
      <div :class="{'fixed-header':fixedHeader}">
      <div :class="{ 'fixed-header': fixedHeader }">
        <navbar />
      </div>
      <div class="clearFixed" />
      <!-- 清除定位的影响 -->
      <div class="breadcrumb">
      <Breadcrumb class="breadcrumb-container" ref="breadcrumb" />
        <Breadcrumb class="breadcrumb-container" ref="breadcrumb" />
      </div>
      <div class="app-main">
      <app-main ref="main" @triggerCombackBtn="triggerCombackBtn"/>
        <app-main ref="main" @triggerCombackBtn="triggerCombackBtn" />
      </div>
    </div>
  </div>
@@ -51,20 +51,26 @@
      }
    }
  },
  created() {
    if (sessionStorage.getItem("flushPage") == 0) {
      location.reload();
      sessionStorage.setItem("flushPage",1)
    }
  },
  methods: {
    handleClickOutside() {
      this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
    },
    combackPlan(){
        this.$refs.main.childMethod()
    combackPlan() {
      this.$refs.main.childMethod()
    },
    indexAdd(){
    indexAdd() {
      this.$refs.main.mainAdd()
    },
    showIndexAdd(){
    showIndexAdd() {
      this.$refs.breadcrumb.showadd()
    },
    triggerCombackBtn(){
    triggerCombackBtn() {
      this.$refs.breadcrumb.triggerBtnPlan()
    }
  }
@@ -72,63 +78,69 @@
</script>
<style lang="scss" scoped>
  @import "~@/styles/mixin.scss";
  @import "~@/styles/variables.scss";
@import "~@/styles/mixin.scss";
@import "~@/styles/variables.scss";
  .app-wrapper {
    @include clearfix;
    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;
    width: 100%;
    top: 0;
    height: 100%;
    position: absolute;
    z-index: 999;
  }
.app-wrapper {
  @include clearfix;
  position: relative;
  height: 100%;
  width: 100%;
  .fixed-header {
  &.mobile.openSidebar {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 9;
    width: calc(100% - #{$sideBarWidth});
    // width: calc(100% - 100px);
    transition: width 0.28s;
  }
  .hideSidebar .fixed-header {
    width: calc(100% - #{$sideBarWidth})
  .sidebar-container {
    box-shadow: 0 0 0.857143rem rgba(0, 0, 0, .12);
  }
  .mobile .fixed-header {
    width: 100%;
  .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;
    }
  }
</style>
}
.drawer-bg {
  background: #000;
  opacity: 0.3;
  width: 100%;
  top: 0;
  height: 100%;
  position: absolute;
  z-index: 999;
}
.fixed-header {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 9;
  width: calc(100% - #{$sideBarWidth});
  // width: calc(100% - 100px);
  transition: width 0.28s;
}
.hideSidebar .fixed-header {
  width: calc(100% - #{$sideBarWidth})
}
.mobile .fixed-header {
  width: 100%;
}</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