wzh 4 лет назад
Родитель
Сommit
407670b6b9
1 измененных файлов с 115 добавлено и 3 удалено
  1. 115 3
      src/components/Header.vue

+ 115 - 3
src/components/Header.vue

@@ -1,8 +1,120 @@
-<template>Header</template>
+<template>
+  <div class="header df aic jcsb">
+    <div class="df aic">
+      <div class="start df aic">
+        <div class="logo mr30">汇很多</div>
+        <div class="title">汇很多航运数字经济总控平台</div>
+      </div>
+      <div class="tabs df aic">
+        <div
+          :class="[
+            `${
+              this.$store.state.currentTabText == item.tabText
+                ? 'current-tab'
+                : ''
+            }`,
+          ]"
+          @click="changeTab(item)"
+          v-for="item in tabs"
+          :key="item.tabText"
+        >
+          {{ item.tabText }}
+        </div>
+      </div>
+    </div>
+    <div class="end df aic">
+      <div class="question">?</div>
+      <div class="timer">2021-09-02 13:58:23</div>
+      <div class="user">Admin</div>
+      <div class="quit" @click="logOut">[退出登录]</div>
+    </div>
+  </div>
+</template>
 
 <script>
-export default {};
+import router from "router";
+import store from "store";
+import { ref, onMounted } from "vue";
+export default {
+  setup() {
+    let tabs = ref([
+      { path: 0, tabText: "运输安全管理中心" },
+      { path: 0, tabText: "智能交易中心" },
+      { path: 0, tabText: "环境中心" },
+      { path: "/digitalEmpowermentCenter", tabText: "数字化赋能中心" },
+    ]);
+    function changeTab(item) {
+      store.commit("changeTab", item.tabText);
+    }
+    async function logOut() {
+      let res = await store.dispatch("LogOut");
+      if (res == 0) {
+        router.replace("/login");
+      }
+    }
+    onMounted(() => {
+      store.commit("changeTab", "运输安全管理中心");
+    });
+    return {
+      tabs,
+      changeTab,
+      logOut,
+    };
+  },
+};
 </script>
+<style lang="scss" scoped>
+.header {
+  width: 100%;
+  height: 60px;
+  background: #1d2c43;
+  box-sizing: border-box;
+  color: #fff;
+  padding-left: 80px;
+  padding-right: 40px;
+}
 
-<style>
+.start {
+  font-size: 20px;
+  font-family: PingFangSC-Semibold, PingFang SC;
+  font-weight: 600;
+  margin-right: 100px;
+}
+
+.tabs {
+  font-size: 14px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #7a97ad;
+  & > * {
+    cursor: pointer;
+    margin-right: 50px;
+  }
+}
+
+.end {
+  font-size: 14px;
+  font-family: PingFangSC-Medium, PingFang SC;
+  font-weight: 500;
+  & > * {
+    cursor: pointer;
+    margin-left: 24px;
+  }
+  .question {
+    width: 20px;
+    height: 20px;
+    line-height: 17px;
+    box-sizing: border-box;
+    color: #898a9a;
+    border: 2px solid #898a9a;
+    border-radius: 50%;
+    text-align: center;
+  }
+}
+
+.current-tab {
+  font-family: PingFangSC-Medium, PingFang SC;
+  font-weight: 500;
+  color: #ffffff;
+}
 </style>