Browse Source

feat: add exchange api

gemercheung 1 year ago
parent
commit
a37de32601

+ 15 - 0
packages/qjkankan-view/src/apis/index.js

@@ -61,3 +61,18 @@ export function checkWork(ok, no) {
     no
   );
 }
+
+/**
+ * 检查作品是否可用
+ * @param {*} data
+ * @param {*} ok
+ * @param {*} no
+ */
+export function exchangeId(data, ok, no) {
+  return http.post(
+    `${URL_FILL}/web/common/getIdInfo`,
+    data,
+    ok,
+    no
+  );
+}

+ 14 - 8
packages/qjkankan-view/src/pages/show.vue

@@ -1,10 +1,7 @@
 <template>
   <template v-if="workEnable">
     <LoadingLogo />
-    <Opening
-      :coverData="coverInfo"
-      v-if="coverInfo.isShowCover && !hasPasswordLock"
-    />
+    <Opening :coverData="coverInfo" v-if="coverInfo.isShowCover && !hasPasswordLock" />
     <Password @pass="handlePass" />
     <Share />
     <div class="ui-view-layout" :class="{ show: show }">
@@ -33,7 +30,7 @@ import Opening from "@/components/assembly/Opening";
 import { createApp } from "@/app";
 
 import { ref, onMounted, computed, watch, nextTick, unref } from "vue";
-import { getPanoInfo, checkWork } from "@/apis";
+import { getPanoInfo, checkWork, exchangeId } from "@/apis";
 import { useStore } from "vuex";
 import config from "@/utils/config";
 import browser from "@/utils/browser";
@@ -68,6 +65,16 @@ onMounted(async () => {
     );
     return;
   }
+
+  if (!config.projectNum) {
+    return;
+  }
+  const idRes = await exchangeId({
+    id: config.projectNum
+  })
+  const { id, num } = idRes.data
+  config.projectNum = id
+
   let res = await checkWork();
 
   if (!res.data) {
@@ -164,9 +171,8 @@ onMounted(async () => {
 
     const app = createApp({
       // xml: "%HTMLPATH%/static/template/tour.xml",
-      xml: `${process.env.VUE_APP_CDN}/720yun_fd_manage/${
-        config.projectNum
-      }/tour.xml?rnd=${Math.random()}`,
+      xml: `${process.env.VUE_APP_CDN}/720yun_fd_manage/${config.projectNum
+        }/tour.xml?rnd=${Math.random()}`,
       swf: "%HTMLPATH%/showviewer/lib/krpano/tour.swf",
       target: "pano",
       html5: "auto",

+ 8 - 1
packages/qjkankan-view/src/pages/showMobile.vue

@@ -85,7 +85,14 @@ onMounted(async () => {
     );
     return;
   }
-
+  if (!config.projectNum) {
+    return;
+  }
+  const idRes = await exchangeId({
+    id: config.projectNum
+  })
+  const { id, num } = idRes.data
+  config.projectNum = id
   let res = await checkWork();
   if (!res.data) {
     workEnable.value = res.data;