liufan9527
2024-11-22 7ed3f40b4e8feaac97e90008649fcf047eabe1f9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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
<template>
  <div class="home">
    <div class="header">作战实验条件建设</div>
    <div class="tab" v-if="name != '门户'">
      <div
        :class="name == item.name ? 'item-height' : 'item'"
        v-for="(item, index) in tab"
        :key="index"
        @click="tabChange(item)"
      >
        {{ item.name }}
      </div>
    </div>
    <div class="btn">
      <img src="../assets/img/home/home.png" alt="" />
      <img
        src="../assets/img/home/return.png"
        alt=""
        v-show="name != '门户'"
        @click="toDoor"
      />
    </div>
    <div class="content">
      <router-view :key="key" />
    </div>
  </div>
</template>
 
<script>
import { mapState } from "vuex";
export default {
  computed: {
    tab() {
      return this.$store.state.user.tab;
    },
 
    key() {
      return this.$route.path;
    }
  },
  mounted() {
    this.$watch("$route", (to, from) => {
      this.name = to.name;
    });
  },
  data() {
    return {
      name: "门户"
    };
  },
  methods: {
    tabChange(e) {
      this.$router.push(e.url);
    },
    toDoor() {
      this.$router.push("/home/door");
    }
  }
};
</script>
 
<style lang="less" scoped>
.home {
  position: relative;
  width: 100%;
  height: 100%;
  background: #091631;
  .header {
    width: 100%;
    height: 87px;
    line-height: 87px;
    background: url("../assets/img/home/header_bg.png");
    font-family: Source Han Sans CN;
    font-weight: bold;
    font-size: 48px;
    color: #00e7fb;
    text-align: center;
  }
  .btn {
    position: absolute;
    top: 60px;
    right: 60px;
    img {
      margin-left: 10px;
    }
  }
  .tab {
    position: absolute;
    top: 60px;
    left: 200px;
    display: flex;
    :nth-child(3) {
      margin-left: 480px;
    }
    .item {
      width: 256px;
      height: 75px;
      line-height: 75px;
      text-align: center;
      background: url("../assets/img/home/tab.png");
      font-family: Source Han Sans CN;
      font-weight: bold;
      font-size: 28px;
      color: #ffffff;
    }
    .item-height {
      width: 256px;
      height: 75px;
      line-height: 75px;
      text-align: center;
      background: url("../assets/img/home/tab_height.png");
      font-family: Source Han Sans CN;
      font-weight: bold;
      font-size: 28px;
      color: #ffffff;
    }
  }
  .content {
    margin-top: 60px;
  }
}
</style>