Blame view

src/views/layout/aside/aside.vue 5.04 KB
c1b532ad   梁保满   权限配置,路由基础设置
1
  <template>
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
2
    <div class="aside-box">
c1b532ad   梁保满   权限配置,路由基础设置
3
4
      <el-aside id="asideNav">
        <div class="logo-name">
6d7bd862   梁保满   飞书bug
5
          <img v-if="$store.getters.logoShow" class="logo" :src="code?csLogo:logo" alt="" />
d4283687   梁保满   首页布局完成,页面顶部返回组件
6
          <template v-else>
6d7bd862   梁保满   飞书bug
7
8
9
10
            <img class="logo" :src="code?csLogo:logo" alt="" />
            <p class="ellipsis">
              {{ code ? "331互动课堂云平台" : "中天易教云平台" }}
            </p>
d4283687   梁保满   首页布局完成,页面顶部返回组件
11
          </template>
c1b532ad   梁保满   权限配置,路由基础设置
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
        </div>
        <el-menu
          :default-active="$route.path"
          class="el-menu-vertical"
          @select="selectmenu"
          :collapse="$store.getters.isCollapse"
          background-color="#03152A"
          text-color="rgba(255,255,255,.7)"
          active-text-color="#ffffff"
          :router="$store.getters.uniquerouter"
          :unique-opened="$store.getters.uniquerouter"
          :collapse-transition="true"
        >
          <template v-for="(item, index) in $store.getters.routers">
            <template v-if="!item.hidden">
              <el-submenu
                v-if="!item.alone && item.children.length > 0"
                :index="index + ''"
                :key="index"
              >
                <template slot="title">
                  <i :class="item.iconCls ? item.iconCls : [fa, fa - server]"></i>
d4283687   梁保满   首页布局完成,页面顶部返回组件
34
                  <span slot="title">{{ item.name }}</span>
c1b532ad   梁保满   权限配置,路由基础设置
35
36
37
38
                </template>
  
                <menu-tree :menuData="item.children"></menu-tree>
              </el-submenu>
6d7bd862   梁保满   飞书bug
39
40
41
42
43
44
              <el-menu-item
                :index="item.path"
                v-else
                :key="item.path"
                :class="path.includes(item.path) ? 'is-active' : ''"
              >
c1b532ad   梁保满   权限配置,路由基础设置
45
46
47
48
49
50
51
52
53
54
55
56
                <i :class="item.iconCls ? item.iconCls : [fa, fa - file]" />
                <span slot="title">{{ item.name }}</span>
              </el-menu-item>
            </template>
          </template>
        </el-menu>
      </el-aside>
    </div>
  </template>
  
  <script>
  import menuTree from "./menuTree";
6d7bd862   梁保满   飞书bug
57
58
59
  import { getURLParams } from "@/utils";
  const logo = require('../../../assets/images/logo.png')
  const csLogo = require('../../../assets/images/331logo.png')
c1b532ad   梁保满   权限配置,路由基础设置
60
61
62
63
64
65
66
67
  export default {
    name: "asideNav",
    components: {
      menuTree,
    },
    watch: {
      // 监听浏览器直接输入路由,将此路由添加到tabnavBox
      "$route.path": function (val) {
4c4f7640   梁保满   路由表,路由前端文件
68
        // this.selectmenu(val);
6d7bd862   梁保满   飞书bug
69
        this.path = val;
c1b532ad   梁保满   权限配置,路由基础设置
70
71
      },
    },
6d7bd862   梁保满   飞书bug
72
    data() {
ca39cc52   阿宝   飞书问题处理
73
      return {
6d7bd862   梁保满   飞书bug
74
75
76
77
78
        path: "",
        code: "",
        logo:logo,
        csLogo:csLogo,
      };
ca39cc52   阿宝   飞书问题处理
79
    },
6d7bd862   梁保满   飞书bug
80
81
82
    created() {
      this.code = getURLParams("code") || localStorage.getItem("csCode") || "";
      this.path = this.$route.path;
ca39cc52   阿宝   飞书问题处理
83
    },
c1b532ad   梁保满   权限配置,路由基础设置
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
    methods: {
      selectmenu(key, indexpath) {
        // 如果不使用 elemenUI 菜单的 vue-router 的模式将用以下方式进行页面跳转 el-menu的router设置为false
        // this.$router.push(indexpath.join("/"))
        let router = this.$store.getters.routers;
        let name = "";
        let navTitle = function (path, routerARR) {
          for (let i = 0; i < routerARR.length; i++) {
            if (routerARR[i].children.length > 0 || routerARR[i].path === path) {
              if (
                routerARR[i].path === path &&
                routerARR[i].children.length < 1
              ) {
                name = routerARR[i].name;
                break;
              }
              navTitle(path, routerARR[i].children);
            }
          }
          return name;
        };
        this.$store.dispatch("addTab", {
          title: navTitle(key, router),
          path: key,
        });
      },
    },
  };
  </script>
  
  <style lang="scss">
  $top: top;
  $bottom: bottom;
  $left: left;
  $right: right;
  %w100 {
    width: 100%;
  }
  
  %h100 {
    height: 100%;
  }
  
  %cursor {
    cursor: pointer;
  }
  
  @mixin set-value($side, $value) {
    @each $prop in $leftright {
      #{$side}-#{$prop}: $value;
    }
  }
6d7bd862   梁保满   飞书bug
136
137
  .aside-box {
    max-width: 200px;
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
138
  }
c1b532ad   梁保满   权限配置,路由基础设置
139
140
141
142
  #asideNav {
    width: auto !important;
    display: flex;
    flex-direction: column;
c1b532ad   梁保满   权限配置,路由基础设置
143
144
    .logo-name {
      background-color: #03152a !important;
4c4f7640   梁保满   路由表,路由前端文件
145
146
147
148
      display: flex;
      align-items: center;
      width: 100%;
      height: 50px;
d4283687   梁保满   首页布局完成,页面顶部返回组件
149
      padding: 0 16px;
4c4f7640   梁保满   路由表,路由前端文件
150
      box-sizing: border-box;
c1b532ad   梁保满   权限配置,路由基础设置
151
      @extend %w100;
d4283687   梁保满   首页布局完成,页面顶部返回组件
152
153
154
155
      .logo {
        width: 24px;
        height: 24px;
        margin-right: 10px;
4c4f7640   梁保满   路由表,路由前端文件
156
      }
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
157
158
      .ellipsis {
        overflow: hidden;
c1b532ad   梁保满   权限配置,路由基础设置
159
160
161
        line-height: 50px;
        text-align: center;
        font-size: 16px;
4c4f7640   梁保满   路由表,路由前端文件
162
        color: #fff;
c1b532ad   梁保满   权限配置,路由基础设置
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
      }
    }
    .el-menu-vertical:not(.el-menu--collapse) {
      width: 200px;
      @extend %h100;
      overflow-y: scroll;
      overflow-x: hidden;
    }
    .el-menu {
      flex: 1;
      overflow: inherit;
      border-right: none;
      &::-webkit-scrollbar {
        display: none;
      }
      .fa {
        vertical-align: middle;
        margin-right: 5px;
        width: 24px;
        text-align: center;
        font-size: 18px;
      }
      .el-menu-item {
        background-color: #020f1d !important;
        border-bottom: 1px solid #020f1d;
        &:hover {
          color: #ffffff !important;
          background-color: #375573 !important;
        }
      }
      .el-menu-item.is-active {
        background-color: #56a9ff !important;
      }
      .is-opened > .el-submenu__title > .el-icon-arrow-down {
        color: #ffffff;
        font-weight: 500;
        font-size: 18px;
      }
    }
  }
6d7bd862   梁保满   飞书bug
203
204
  :deep(.is-active) {
    color: #fff;
ca39cc52   阿宝   飞书问题处理
205
  }
c1b532ad   梁保满   权限配置,路由基础设置
206
  </style>