liuyg
2021-09-02 8a95f7285758a3051f69ac544c68d79999608e5c
首页配置
5 files modified
120 ■■■■ changed files
src/config/website.js 76 ●●●●● patch | view | raw | blame | history
src/page/index/tags.vue 3 ●●●●● patch | view | raw | blame | history
src/page/index/top/top-menu.vue 36 ●●●●● patch | view | raw | blame | history
src/store/getters.js 1 ●●●● patch | view | raw | blame | history
src/store/modules/user.js 4 ●●●● patch | view | raw | blame | history
src/config/website.js
@@ -54,7 +54,7 @@
                    value: '/securityUnit/localCompany',
                    imgs: 'url(/img/gldw.jpg)'
                }, {
                    label: '统计分析',
                    label: '智能分析',
                    value: '/securityAnalysis/index',
                    imgs: 'url(/img/glgz.jpg)'
                },]
@@ -82,6 +82,80 @@
                    value: '/expression/index',
                    imgs: 'url(/img/tongji.jpg)'
                },]
        },
        {
            userName: '未持证保安',
            list: [
                {
                    label: '保安员信息',
                    value: '/securityMan/index',
                    imgs: 'url(/img/yijianbaoj.jpg)'
                }, {
                    label: '派遣记录',
                    value: '/dispatchChildoperableSee/index',
                    imgs: 'url(/img/fangyi.jpg)'
                }, {
                    label: '从业记录',
                    value: '/job/index',
                    imgs: 'url(/img/anjian.jpg)'
                }, {
                    label: '工作汇报',
                    value: '/workreport/workreport',
                    imgs: 'url(/img/tiwen.jpg)'
                }, {
                    label: '表现记录',
                    value: '/expression/index',
                    imgs: 'url(/img/tongji.jpg)'
                },]
        },
        {
            userName: '保安公司管理员',
            list: [
                {
                    label: '智能分析',
                    value: '/securityAnalysis/index',
                    imgs: 'url(/img/glgz.jpg)'
                }, {
                    label: '保安员管理',
                    value: '/securityGuard/index',
                    imgs: 'url(/img/glba.jpg)'
                }, {
                    label: '单位信息',
                    value: '/securityUnitChild/index',
                    imgs: 'url(/img/gldw.jpg)'
                }, {
                    label: '派遣记录',
                    value: '/dispatch/dispatchChildoperable',
                    imgs: 'url(/img/glgj.jpg)'
                }, {
                    label: '通知公告',
                    value: '/desk/index',
                    imgs: 'url(/img/gltz.jpg)'
                },]
        }, {
            userName: '公安管理员',
            list: [
                {
                    label: '智能分析',
                    value: '/securityAnalysis/index',
                    imgs: 'url(/img/glgz.jpg)'
                }, {
                    label: '保安员管理',
                    value: '/securityGuard/index',
                    imgs: 'url(/img/glba.jpg)'
                }, {
                    label: '公司管理',
                    value: '/securityUnit/index',
                    imgs: 'url(/img/gldw.jpg)'
                }, {
                    label: '通知公告',
                    value: '/desk/index',
                    imgs: 'url(/img/gltz.jpg)'
                }, {
                    label: '工作汇报',
                    value: '/workreport/workreply',
                    imgs: 'url(/img/glgj.jpg)'
                }]
        }
    ],
src/page/index/tags.vue
@@ -80,6 +80,7 @@
    this.tagList.forEach((item, index) => {
      if (item.label == "首页" && this.userInfo.role_name == "培训公司管理员") {
        this.tagList.splice(index, 1);
        this.$store.commit("set_hideHome", true);
        // getRoutes().then((res) => {
        //   const data = res.data.data;
        //   var child = {},
@@ -102,6 +103,8 @@
          }
        }
        this.$router.push({ path: path });
      } else {
        this.$store.commit("set_hideHome", false);
      }
    });
  },
src/page/index/top/top-menu.vue
@@ -1,18 +1,25 @@
<template>
  <div class="top-menu">
    <el-menu :default-active="activeIndex"
             mode="horizontal"
             text-color="#333">
      <el-menu-item index="0" @click.native="openHome(itemHome)" key="0">
    <el-menu :default-active="activeIndex" mode="horizontal" text-color="#333">
      <el-menu-item
        index="0"
        @click.native="openHome(itemHome)"
        key="0"
        v-if="!hideHome"
      >
        <template slot="title">
          <i :class="itemHome.source"></i>
          <span>{{generateTitle(itemHome)}}</span>
        </template>
      </el-menu-item>
      <template v-for="(item,index) in items">
        <el-menu-item :index="item.id+''" @click.native="openMenu(item)" :key="index">
        <el-menu-item
          :index="item.id + ''"
          @click.native="openMenu(item)"
          :key="index"
        >
          <template slot="title">
            <i :class="item.source" style="padding-right: 5px;"></i>
            <i :class="item.source" style="padding-right: 5px"></i>
            <span>{{generateTitle(item)}}</span>
          </template>
        </el-menu-item>
@@ -29,8 +36,8 @@
    data() {
      return {
        itemHome: {
          name: '首页',
          source: 'el-icon-menu',
        name: "首页",
        source: "el-icon-menu",
        },
        activeIndex: "0",
        items: [],
@@ -41,20 +48,23 @@
      this.getMenu();
    },
    computed: {
      ...mapGetters(["tagCurrent", "menu"])
    ...mapGetters(["tagCurrent", "menu", "hideHome"]),
    },
    methods: {
      openHome(itemHome) {
        this.index.openMenu(itemHome);
        this.$router.push({
          path: this.$router.$avueRouter.getPath({name: itemHome.name, src: ''}, {})
        path: this.$router.$avueRouter.getPath(
          { name: itemHome.name, src: "" },
          {}
        ),
        });
      },
      openMenu(item) {
        this.index.openMenu(item)
      this.index.openMenu(item);
      },
      getMenu() {
        this.$store.dispatch("GetTopMenu").then(res => {
      this.$store.dispatch("GetTopMenu").then((res) => {
          this.items = res;
        });
      },
@@ -64,6 +74,6 @@
          (item.meta || {}).i18n
        );
      },
    }
  },
  };
</script>
src/store/getters.js
@@ -19,6 +19,7 @@
  roles: state => state.user.roles,
  permission: state => state.user.permission,
  menu: state => state.user.menu,
  hideHome: state => state.user.hideHome,
  menuId: state => state.user.menuId,
  menuAll: state => state.user.menuAll,
  logsList: state => state.logs.logsList,
src/store/modules/user.js
@@ -43,6 +43,7 @@
    menuAll: getStore({name: 'menuAll'}) || [],
    token: getStore({name: 'token'}) || '',
    refreshToken: getStore({name: 'refreshToken'}) || '',
    hideHome: false,
  },
  actions: {
    //根据用户名登录
@@ -199,6 +200,9 @@
    },
  },
  mutations: {
    set_hideHome: (state, val) => {
      state.hideHome = val;
    },
    SET_TOKEN: (state, token) => {
      setToken(token);
      state.token = token;