Blame view

code/finance_web/src/components/nav.vue 4.85 KB
a  
谢明辉 committed
1
<template>
a  
谢明辉 committed
2
  <el-container id="nav">
谢明辉 committed
3
    <el-aside width="10%">
a  
谢明辉 committed
4
      <el-menu :default-active="$route.path" class="el-menu-vertical-demo" router :collapse="false" text-color="white" background-color="black" active-text-color="#ffd04b">
谢明辉 committed
5 6 7
        <div style="height:20%;text-align:center">
          <img src="../assets/logo.png" alt="" style="width:100%;height:26%">
        </div>
a  
谢明辉 committed
8

谢明辉 committed
9 10 11 12
        <el-menu-item index="/nav/search">
          <i class="icon i-search"></i>
          <span slot="title">检索合同</span>
        </el-menu-item>
a  
谢明辉 committed
13
        <el-menu-item index="/nav/contract/0" @click="contract" v-if="contract_show">
谢明辉 committed
14 15 16 17 18 19 20
          <i class="icon i-file"></i>
          <span slot="title">合同信息</span>
        </el-menu-item>
        <el-menu-item index="/nav/user">
          <i class="icon i-user"></i>
          <span slot="title">个人管理</span>
        </el-menu-item>
a  
谢明辉 committed
21 22 23 24
        <el-menu-item index="/nav/manage" v-show="management">
          <i class="icon i-setting"></i>
          <span slot="title">后台管理</span>
        </el-menu-item>
谢明辉 committed
25 26 27 28 29 30
        <el-menu-item index="" @click="exit">
          <i class="icon i-login"></i>
          <span slot="title">退出</span>
        </el-menu-item>
      </el-menu>
    </el-aside>
a  
谢明辉 committed
31

a  
谢明辉 committed
32
    <el-main :style="color">
谢明辉 committed
33 34 35 36 37
      <keep-alive include="search">
        <router-view></router-view>
      </keep-alive>
    </el-main>
  </el-container>
a  
谢明辉 committed
38

a  
谢明辉 committed
39 40 41
</template>

<script>
a  
谢明辉 committed
42 43 44 45
  export default {
    name: "HelloWorld",
    data() {
      return {
a  
谢明辉 committed
46
        color: "background-color: lightblue",
a  
谢明辉 committed
47 48 49 50 51 52 53
        management: false,
        username: "",
        department: "",
        collapse: true,
        contract_show: true
      };
    },
a  
谢明辉 committed
54

a  
谢明辉 committed
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
    methods: {
      contract() {
        if (sessionStorage.getItem("modify")) {
          sessionStorage.removeItem("modify");
        }
      },
      exit() {
        this.$confirm("确认退出?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            sessionStorage.clear();
            this.$router.push({ path: "/" });
          })
          .catch(() => {});
谢明辉 committed
72 73
      }
    },
a  
谢明辉 committed
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
    beforeCreate() {
      if (!sessionStorage.getItem("login_check")) {
        alert("请登录");
        this.$router.push({ path: "/" });
      }
    },
    created() {
      if (
        sessionStorage.getItem("user_roles") != "null" &&
        sessionStorage.getItem("user_roles")
      ) {
        var roles = JSON.parse(sessionStorage.getItem("user_roles"));
        for (let i = 0; i < roles.length; i++) {
          const e = roles[i];
          if (e.role_unid == "91d5185d47e3bad099e17570b0dd0ed2") {
          }
谢明辉 committed
90
        }
a  
谢明辉 committed
91 92 93 94 95 96 97 98 99
      } else {
        this.contract_show = false;
      }
      if (sessionStorage.getItem("user_name") === "Admin") {
        this.management = true;
      }
      if (sessionStorage.getItem("manager")) {
        this.management = true;
        this.contract_show = true;
a  
谢明辉 committed
100
      }
a  
谢明辉 committed
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 136 137 138 139 140 141

      if (localStorage.getItem("color")) {
        var style = {};
        switch (localStorage.getItem("color")) {
          case "天空蓝":
            this.color = "background-color: lightblue";
            style.color = "lightblue";
            style.image = null;
            break;
          case "梦幻紫":
            this.color =
              "background-color:#8ec5fc;background-image:linear-gradient(225deg, #8ec5fc 0%, #e0c3fc 100%)";
            style.color = "#8ec5fc";
            style.image = "linear-gradient(225deg, #8ec5fc 0%, #e0c3fc 100%)";
            break;
          case "活力橙":
            this.color =
              "background-color:#FBAB7E;background-image:linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%)";
            style.color = "#FBAB7E";
            style.image = "linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%)";
            break;
          case "柠檬绿":
            this.color =
              "background-color:#F4D03F;background-image:linear-gradient(132deg, #F4D03F 0%, #16A085 100%)";
            style.color = "#F4D03F";
            style.image = "linear-gradient(132deg, #F4D03F 0%, #16A085 100%)";
            break;
          case "灰灰灰":
            this.color = "background-color:#f0f0f0";
            style.color = "#f0f0f0";
            style.image = null;
            break;
          case "小清新":
            this.color =
              "background-color:#FFDEE9;background-image:linear-gradient(0deg, #FFDEE9 0%, #B5FFFC 100%)";
            style.color = "#FFDEE9";
            style.image = "linear-gradient(0deg, #FFDEE9 0%, #B5FFFC 100%)";
            break;
        }
        localStorage.setItem("style", JSON.stringify(style));
      }
a  
谢明辉 committed
142
    }
a  
谢明辉 committed
143
  };
a  
谢明辉 committed
144 145 146
</script>

<style>
a  
谢明辉 committed
147
.el-container > .el-main {
a  
谢明辉 committed
148
  min-width: 1120px;
a  
谢明辉 committed
149
  text-align: center;
a  
谢明辉 committed
150
  padding: 0;
a  
谢明辉 committed
151
  overflow-y: scroll;
a  
谢明辉 committed
152 153 154
}
.el-container,
.el-aside {
a  
谢明辉 committed
155
  min-width: 167px;
a  
谢明辉 committed
156 157
  height: 100%;
}
a  
谢明辉 committed
158
.el-aside > .el-menu {
s  
谢明辉 committed
159
  height: 100%;
a  
谢明辉 committed
160 161
}
</style>