chenlei 2 лет назад
Родитель
Сommit
b56447f76d

+ 3 - 0
public/config.js

@@ -1,6 +1,9 @@
 // 场馆 Record<场馆id, string>
 // 场馆 Record<场馆id, string>
 museum = { 3: "苏州博物馆(本馆),苏州博物馆(西馆)" };
 museum = { 3: "苏州博物馆(本馆),苏州博物馆(西馆)" };
 
 
+// 是否显示滑动手势
+showPointerHelper = true;
+
 // 是否开启预约调试弹窗
 // 是否开启预约调试弹窗
 venueDebug = false;
 venueDebug = false;
 
 

+ 1 - 1
src/background.ts

@@ -45,7 +45,7 @@ async function createWindow() {
   } else {
   } else {
     createProtocol("app");
     createProtocol("app");
     // Load the index.html when not in development
     // Load the index.html when not in development
-    win.loadURL("app://./index.html");
+    win.loadURL(path.join("file://", __dirname, "/index.html"));
   }
   }
 
 
   // win.setMenu(null);
   // win.setMenu(null);

+ 1 - 0
src/global.d.ts

@@ -14,5 +14,6 @@ interface Window {
   venueDebug: boolean;
   venueDebug: boolean;
   venueReservationUrl: string;
   venueReservationUrl: string;
   openCloudApi: boolean;
   openCloudApi: boolean;
+  showPointerHelper: boolean;
   MUSEUM_LIST_TIME: Record<number, string[]>;
   MUSEUM_LIST_TIME: Record<number, string[]>;
 }
 }

+ 1 - 1
src/views/cloud-museum/components/card.vue

@@ -2,7 +2,7 @@
   <div class="cloud-museum-card" @click="handleClick">
   <div class="cloud-museum-card" @click="handleClick">
     <div class="cloud-museum-card__img">
     <div class="cloud-museum-card__img">
       <el-image
       <el-image
-        :src="props.item.thumb"
+        :src="'./' + props.item.thumb"
         fit="cover"
         fit="cover"
         style="width: 100%; height: 100%"
         style="width: 100%; height: 100%"
       />
       />

+ 16 - 6
src/views/cloud-museum/index.vue

@@ -75,8 +75,6 @@ import Card from "./components/card.vue";
 import { useRoute, useRouter } from "vue-router";
 import { useRoute, useRouter } from "vue-router";
 import "./index.scss";
 import "./index.scss";
 import { OpenVirtualKeyBoard } from "@/utils/open-keyboard";
 import { OpenVirtualKeyBoard } from "@/utils/open-keyboard";
-import cityListData from "/public/getCity-data.json";
-import pageCityListData from "/public/pageCityList-data.json";
 import { useStore } from "vuex";
 import { useStore } from "vuex";
 
 
 const store = useStore();
 const store = useStore();
@@ -94,6 +92,7 @@ const noMore = ref(!store.state.isOnline);
 let total = 0;
 let total = 0;
 let pageNum = 1;
 let pageNum = 1;
 let pageSize = 10;
 let pageSize = 10;
+let pageCityListData: CityMuseumItemType[] = [];
 const list = ref<CityMuseumItemType[]>([]);
 const list = ref<CityMuseumItemType[]>([]);
 const load = async () => {
 const load = async () => {
   if (
   if (
@@ -101,7 +100,8 @@ const load = async () => {
     loading.value ||
     loading.value ||
     noMore.value ||
     noMore.value ||
     total === 0 ||
     total === 0 ||
-    !store.state.isOnline
+    !store.state.isOnline ||
+    !window.openCloudApi
   )
   )
     return;
     return;
 
 
@@ -120,6 +120,7 @@ onActivated(() => {
   resetPage();
   resetPage();
   curCity.value = Number(route.params.id);
   curCity.value = Number(route.params.id);
   curType.value = DEFAULT_TYPE[0];
   curType.value = DEFAULT_TYPE[0];
+
   Promise.all([getCity(), getCityMuseumList()]).finally(() => {
   Promise.all([getCity(), getCityMuseumList()]).finally(() => {
     loading.value = false;
     loading.value = false;
   });
   });
@@ -128,8 +129,12 @@ onActivated(() => {
 const getCity = async () => {
 const getCity = async () => {
   if (cityList.value.length) return;
   if (cityList.value.length) return;
 
 
-  if (!store.state.isOnline) {
-    cityList.value = cityListData;
+  if (!store.state.isOnline || !window.openCloudApi) {
+    fetch("./getCity-data.json")
+      .then((res) => res.json())
+      .then((data) => {
+        cityList.value = data;
+      });
     return;
     return;
   }
   }
 
 
@@ -170,10 +175,15 @@ const handleFocus = () => {
 };
 };
 
 
 const getCityMuseumList = async (load?: boolean) => {
 const getCityMuseumList = async (load?: boolean) => {
-  if (!window.openCloudApi || !store.state.isOnline) {
+  if (!window.openCloudApi || !store.state.isOnline || !window.openCloudApi) {
     console.log("===读取静态数据===");
     console.log("===读取静态数据===");
     const regex = new RegExp(searchKey.value, "gi");
     const regex = new RegExp(searchKey.value, "gi");
 
 
+    if (!pageCityListData.length) {
+      const res = await fetch("./pageCityList-data.json");
+      pageCityListData = await res.json();
+    }
+
     list.value = pageCityListData.filter((i: CityMuseumItemType) => {
     list.value = pageCityListData.filter((i: CityMuseumItemType) => {
       const needValidType = curType.value !== "全部类型";
       const needValidType = curType.value !== "全部类型";
       const needValidKeyword = !!searchKey.value;
       const needValidKeyword = !!searchKey.value;

+ 19 - 11
src/views/ver-scroll-home/index.vue

@@ -39,7 +39,7 @@
       />
       />
     </div>
     </div>
 
 
-    <div class="home-helper">
+    <div v-if="showPointerHelper" class="home-helper">
       <img draggable="false" src="./imgs/icon_gesture@2x.png" />
       <img draggable="false" src="./imgs/icon_gesture@2x.png" />
       <span>可通过上下滑动切换地图</span>
       <span>可通过上下滑动切换地图</span>
     </div>
     </div>
@@ -73,6 +73,7 @@ const store = useStore();
 const loading = ref(false);
 const loading = ref(false);
 const isOnline = ref(true);
 const isOnline = ref(true);
 const dialogText = ref("");
 const dialogText = ref("");
+const showPointerHelper = ref(window.showPointerHelper);
 const dialogVisible = ref(false);
 const dialogVisible = ref(false);
 const router = useRouter();
 const router = useRouter();
 const curIndex = ref(0);
 const curIndex = ref(0);
@@ -109,6 +110,17 @@ const menuList = computed(() => [
     activeIcon: ReservationActiveImg,
     activeIcon: ReservationActiveImg,
     async event() {
     async event() {
       try {
       try {
+        if (window.venueReservationUrl) {
+          router.push({
+            name: "iframe",
+            params: {
+              url: encodeURIComponent(window.venueReservationUrl),
+              showBtn: 0,
+            },
+          });
+          return;
+        }
+
         loading.value = true;
         loading.value = true;
         const online = await isOnlineFn();
         const online = await isOnlineFn();
         isOnline.value = online;
         isOnline.value = online;
@@ -128,14 +140,6 @@ const menuList = computed(() => [
         } else if (window.venueDebug || !online) {
         } else if (window.venueDebug || !online) {
           dialogText.value = !online ? "网络异常" : "预约功能调试中";
           dialogText.value = !online ? "网络异常" : "预约功能调试中";
           dialogVisible.value = true;
           dialogVisible.value = true;
-        } else if (window.venueReservationUrl) {
-          router.push({
-            name: "iframe",
-            params: {
-              url: encodeURIComponent(window.venueReservationUrl),
-              showBtn: 0,
-            },
-          });
         } else {
         } else {
           router.push({ name: "venueReservation" });
           router.push({ name: "venueReservation" });
         }
         }
@@ -156,7 +160,7 @@ const onMousedown = (e: MouseEvent) => {
   scroll = true;
   scroll = true;
 };
 };
 const onMousemove = (e: MouseEvent) => {
 const onMousemove = (e: MouseEvent) => {
-  if (!scroll) return;
+  if (!scroll || !window.showPointerHelper) return;
 
 
   moveY = e.screenY - startY;
   moveY = e.screenY - startY;
 
 
@@ -169,6 +173,8 @@ const onMousemove = (e: MouseEvent) => {
   translateY.value = _moveY + moveY;
   translateY.value = _moveY + moveY;
 };
 };
 const onMouseup = () => {
 const onMouseup = () => {
+  if (!window.showPointerHelper) return;
+
   scroll = false;
   scroll = false;
   animation.value = true;
   animation.value = true;
   if (curIndex.value === 0) {
   if (curIndex.value === 0) {
@@ -202,7 +208,7 @@ const onTouchstart = (e: TouchEvent) => {
   scroll = true;
   scroll = true;
 };
 };
 const onTouchmove = (e: TouchEvent) => {
 const onTouchmove = (e: TouchEvent) => {
-  if (!scroll) return;
+  if (!scroll || !window.showPointerHelper) return;
 
 
   moveY = e.changedTouches[0].screenY - startY;
   moveY = e.changedTouches[0].screenY - startY;
 
 
@@ -215,6 +221,8 @@ const onTouchmove = (e: TouchEvent) => {
   translateY.value = _moveY + moveY;
   translateY.value = _moveY + moveY;
 };
 };
 const onTouchend = () => {
 const onTouchend = () => {
+  if (!window.showPointerHelper) return;
+
   animation.value = true;
   animation.value = true;
   if (curIndex.value === 0) {
   if (curIndex.value === 0) {
     if (moveY < -250) {
     if (moveY < -250) {