Bläddra i källkod

更新 首页;菜单

wzh 3 år sedan
förälder
incheckning
c2ac49decf
5 ändrade filer med 69 tillägg och 45 borttagningar
  1. BIN
      public/menuIcons/workplace.png
  2. 15 2
      src/auth/menuData.js
  3. 48 42
      src/components/Header.vue
  4. 1 1
      src/router/index.js
  5. 5 0
      src/views/index/Login.vue

BIN
public/menuIcons/workplace.png


+ 15 - 2
src/auth/menuData.js

@@ -1,13 +1,13 @@
 let menuData = [
   {
     icon: "menuIcons/index.png",
-    title: "首页",
+    title: "总台",
     code: "VOYAGELIST",
     path: "/index",
     items: [
       {
         path: "/index",
-        name: "首页",
+        name: "总台",
         code: "VOYAGELIST",
       },
     ],
@@ -25,6 +25,19 @@ let menuData = [
       },
     ],
   },
+  {
+    icon: "menuIcons/workplace.png",
+    title: "工作站",
+    code: "VOYAGELIST",
+    path: "/workplaceManage",
+    items: [
+      {
+        path: "/workplaceManage/workplace",
+        name: "工作站",
+        code: "VOYAGELIST",
+      },
+    ],
+  },
   {
     icon: "menuIcons/agency.png",
     title: "代理管理",

+ 48 - 42
src/components/Header.vue

@@ -3,7 +3,9 @@
     <div class="left">
       <!-- <img class="first" src="../assets/three.png" alt="" />
       <div class="shu"></div> -->
+      <div class="cargo-owner" v-if="cargoOwnerName">{{ cargoOwnerName }}</div>
       <img
+        v-else
         class="logo pointer"
         src="../assets/white-logo.png"
         alt=""
@@ -60,7 +62,7 @@
     </div>
   </div>
 </template>
-<script>
+<script setup>
 import store from "../store";
 import router from "../router";
 import { onMounted, ref } from "vue";
@@ -69,47 +71,43 @@ const db = tcb.database();
 const v = db.collection("huihenduo_versions");
 const __ = db.command;
 
-export default {
-  setup() {
-    let contactName = localStorage.contactName;
-    function quit() {
-      localStorage.clear();
-      store.commit("changeLogin", false);
-      router.push({ path: "/login" });
-    }
-
-    function goToIndex() {
-      router.replace({ path: "/index" });
-    }
-
-    let timelineData = ref([]);
-    onMounted(() => {
-      cloudLogin();
-    });
-    async function getAbledVersions() {
-      let res = await v
-        .aggregate()
-        .match({ deleted: __.neq(true) })
-        .sort({
-          createTime: -1,
-        })
-        .limit(10)
-        .end();
-      timelineData.value = res.data;
-    }
-
-    async function cloudLogin() {
-      await AnonymousLogin();
-      getAbledVersions();
-    }
-    return {
-      quit,
-      contactName,
-      timelineData,
-      goToIndex,
-    };
-  },
-};
+let logoUrl = ref("");
+let cargoOwnerName = ref("");
+let contactName = localStorage.contactName;
+function quit() {
+  localStorage.clear();
+  store.commit("changeLogin", false);
+  router.push({ path: "/login" });
+}
+
+function goToIndex() {
+  router.replace({ path: "/index" });
+}
+
+let timelineData = ref([]);
+
+async function getAbledVersions() {
+  let res = await v
+    .aggregate()
+    .match({ deleted: __.neq(true) })
+    .sort({
+      createTime: -1,
+    })
+    .limit(10)
+    .end();
+  timelineData.value = res.data;
+}
+
+async function cloudLogin() {
+  await AnonymousLogin();
+  getAbledVersions();
+}
+
+onMounted(() => {
+  cloudLogin();
+  // logoUrl.value = localStorage.logoUrl || "../assets/white-logo.png";
+  cargoOwnerName.value = localStorage.userName;
+});
 </script>
 <style scoped>
 .header {
@@ -144,6 +142,8 @@ export default {
   width: 120px;
   height: 40px;
   margin-left: 20px;
+  object-fit: contain;
+  /* background: #fff; */
 }
 
 .title {
@@ -181,4 +181,10 @@ export default {
 .quit {
   margin-left: 26px;
 }
+
+.cargo-owner {
+  margin: 20px;
+  color: #fff;
+  font-size: 28px;
+}
 </style>

+ 1 - 1
src/router/index.js

@@ -15,7 +15,7 @@ const router = createRouter({
       path: "/index",
       name: "index",
       meta: {
-        title: "主页",
+        title: "总台",
       },
       component: Index,
     },

+ 5 - 0
src/views/index/Login.vue

@@ -228,6 +228,11 @@ function login() {
         localStorage.setItem("contactName", contactName);
         localStorage.setItem("userType", 1);
         localStorage.setItem("loginAccountId", loginAccountId);
+        localStorage.setItem(
+          "logoUrl",
+          cargoOwners.value[currentCompanyLevelTwo.value]?.logoUrl ||
+            cargoOwners.value["wuchan"]?.logoUrl
+        );
         rolePermission = rolePermission || [];
         let arr = [...new Set([...rolePermission])];
         localStorage.setItem("rolePermission", arr);