浏览代码

feat: 控制大运河显示状态

chenlei 1 年之前
父节点
当前提交
914938bedb
共有 4 个文件被更改,包括 93 次插入77 次删除
  1. 3 0
      public/config.js
  2. 1 0
      src/global.d.ts
  3. 3 0
      src/views/home/index.scss
  4. 86 77
      src/views/ver-scroll-home/index.vue

+ 3 - 0
public/config.js

@@ -1,3 +1,6 @@
+// 隐藏大运河按钮
+hideRiverMenu = true;
+
 // 场馆 Record<场馆id, string>
 museum = { 3: "苏州博物馆(本馆),苏州博物馆(西馆)" };
 

+ 1 - 0
src/global.d.ts

@@ -4,6 +4,7 @@ interface Window {
   cloudScenicUrl: string;
   company: string;
   division: string;
+  hideRiverMenu: boolean;
   companyId: number;
   SCENIC_MUSEUM_POS: {
     id: number;

+ 3 - 0
src/views/home/index.scss

@@ -35,6 +35,9 @@
     bottom: calc(2.5rem /* 200/80 */ + 1rem /* 80/80 */);
     z-index: 2;
 
+    &.hide-river {
+      bottom: calc(3.5rem /* 280/80 */ + 1rem /* 80/80 */);
+    }
     &-list {
       display: flex;
       flex-direction: column;

+ 86 - 77
src/views/ver-scroll-home/index.vue

@@ -21,7 +21,7 @@
       </div>
     </div>
 
-    <div class="home-menu">
+    <div class="home-menu" :class="[hideRiverMenu && 'hide-river']">
       <div class="home-menu-list">
         <img
           v-for="(item, index) in menuList"
@@ -78,92 +78,101 @@ const showPointerHelper = ref(window.showPointerHelper);
 const dialogVisible = ref(false);
 const router = useRouter();
 const curIndex = ref(0);
+const hideRiverMenu = ref(window.hideRiverMenu);
 const animation = ref(false);
-const menuList = computed(() => [
-  {
-    icon: MuseumNormalImg,
-    activeIcon: MuseumActiveImg,
-    async event() {
-      try {
-        loading.value = true;
-        if (window.openCloudApi) {
-          const online = await isOnlineFn();
-          store.commit("setIsOnline", online);
+const menuList = computed(() => {
+  const list = [
+    {
+      icon: MuseumNormalImg,
+      activeIcon: MuseumActiveImg,
+      async event() {
+        try {
+          loading.value = true;
+          if (window.openCloudApi) {
+            const online = await isOnlineFn();
+            store.commit("setIsOnline", online);
+          }
+          router.push({ name: "cloudMuseum", params: { id: 34 } });
+        } finally {
+          loading.value = false;
         }
-        router.push({ name: "cloudMuseum", params: { id: 34 } });
-      } finally {
-        loading.value = false;
-      }
+      },
     },
-  },
-  {
-    icon: SceneryNormalImg,
-    activeIcon: SceneryActiveImg,
-    event() {
-      router.push({
-        name: "iframe",
-        params: { url: window.cloudScenicUrl, showBtn: 0 },
-      });
+    {
+      icon: SceneryNormalImg,
+      activeIcon: SceneryActiveImg,
+      event() {
+        router.push({
+          name: "iframe",
+          params: { url: window.cloudScenicUrl, showBtn: 0 },
+        });
+      },
     },
-  },
-  {
-    icon: RiverNormalImg,
-    activeIcon: RiverNormalImg,
-    event() {
-      router.push({
-        name: "iframe",
-        params: { url: window.riverUrl, showBtn: 0 },
-      });
+    {
+      icon: RiverNormalImg,
+      activeIcon: RiverNormalImg,
+      event() {
+        router.push({
+          name: "iframe",
+          params: { url: window.riverUrl, showBtn: 0 },
+        });
+      },
     },
-  },
-  {
-    icon: ReservationNormalImg,
-    activeIcon: ReservationActiveImg,
-    async event() {
-      try {
-        if (window.venueReservationUrl) {
-          router.push({
-            name: "iframe",
-            params: {
-              url: encodeURIComponent(window.venueReservationUrl),
-              showBtn: 0,
-            },
-          });
-          return;
-        }
+    {
+      icon: ReservationNormalImg,
+      activeIcon: ReservationActiveImg,
+      async event() {
+        try {
+          if (window.venueReservationUrl) {
+            router.push({
+              name: "iframe",
+              params: {
+                url: encodeURIComponent(window.venueReservationUrl),
+                showBtn: 0,
+              },
+            });
+            return;
+          }
 
-        loading.value = true;
-        const online = await isOnlineFn();
-        isOnline.value = online;
+          loading.value = true;
+          const online = await isOnlineFn();
+          isOnline.value = online;
 
-        const today = formatDate(new Date());
-        const curTime = parseDate(new Date()) || new Date();
-        const startTime = parseDate(`${today} 8:00`) || new Date();
-        const endTime = parseDate(`${today} 18:00`) || new Date();
+          const today = formatDate(new Date());
+          const curTime = parseDate(new Date()) || new Date();
+          const startTime = parseDate(`${today} 8:00`) || new Date();
+          const endTime = parseDate(`${today} 18:00`) || new Date();
 
-        if (
-          curTime.getTime() < startTime.getTime() ||
-          curTime.getTime() > endTime.getTime() ||
-          [0, 6].includes(curTime.getDay())
-        ) {
-          dialogText.value = "开放时间:每周一至周五的8:00~18:00";
-          dialogVisible.value = true;
-        } else if (window.venueDebug || !online) {
-          dialogText.value = !online ? "网络异常" : "预约功能调试中";
-          dialogVisible.value = true;
-        } else {
-          router.push({ name: "venueReservation" });
-        }
+          if (
+            curTime.getTime() < startTime.getTime() ||
+            curTime.getTime() > endTime.getTime() ||
+            [0, 6].includes(curTime.getDay())
+          ) {
+            dialogText.value = "开放时间:每周一至周五的8:00~18:00";
+            dialogVisible.value = true;
+          } else if (window.venueDebug || !online) {
+            dialogText.value = !online ? "网络异常" : "预约功能调试中";
+            dialogVisible.value = true;
+          } else {
+            router.push({ name: "venueReservation" });
+          }
 
-        store.commit("setIsOnline", online);
-      } catch (err) {
-        console.log(err);
-      } finally {
-        loading.value = false;
-      }
+          store.commit("setIsOnline", online);
+        } catch (err) {
+          console.log(err);
+        } finally {
+          loading.value = false;
+        }
+      },
     },
-  },
-]);
+  ];
+
+  if (window.hideRiverMenu) {
+    list.splice(2, 1);
+  }
+
+  return list;
+});
 const translateY = ref(0);
 
 const onMousedown = (e: MouseEvent) => {