gemercheung 2 years ago
parent
commit
600b6c5ead

+ 3 - 2
packages/qjkankan-editor/src/api/index.js

@@ -746,8 +746,9 @@ export function getWorksList(data, ok, no) {
  */
 export function saveWorks(data, ok, no) {
   !data.id && (data.id = number())
-
-  return http.postJson(`${URL_FILL}/manage/work/edit`, data, ok, no)
+ 
+  return http.postJson(`http://192.168.0.152:8001/qjkankan/manage/work/edit`, data, ok, no)
+  // return http.postJson(`${URL_FILL}/manage/work/edit`, data, ok, no)
 }
 
 

+ 1 - 1
packages/qjkankan-editor/src/components/materialListInMaterialSelector.vue

@@ -282,7 +282,7 @@
 
     <div class="btns">
       <button v-if="canUpload && !searchKey" class="ui-button upload-btn" @click="onClickUpload">
-        <span>{{ $i18n.t("gather.upload_material") }}xxx</span>
+        <span>{{ $i18n.t("gather.upload_material") }}</span>
         <i
           class="iconfont icon-material_prompt tool-tip-for-editor"
           v-tooltip="fileInputBtnTip"

+ 0 - 1
packages/qjkankan-editor/src/components/materialSelectorFolderMixin.js

@@ -58,7 +58,6 @@ export default {
           const targetPathIdList = clickedItem.ancestors.split(',').map((item) => {
             return Number(item)
           })
-          debugger
           this.folderPath = nodeIdList2nodeInfoListByNodeTree(targetPathIdList, this.folderTree)
         } else {
           // 在folderTree里找到id等于clickedItem.dirId的那个文件夹,从而确定folderPath

+ 141 - 56
packages/qjkankan-editor/src/framework/EditorHead.vue

@@ -5,18 +5,31 @@
       {{ back_myworks }}
     </a>
     <span class="app-head-title">{{ info.name }}</span>
-    <div class="app-head-save ui-button deepcancel app-head-view" @click="onView"
-      :class="{ disable: !canLoad || isEditing }">
+    <div
+      class="app-head-save ui-button deepcancel app-head-view"
+      @click="onView"
+      :class="{ disable: !canLoad || isEditing }"
+    >
       <i class="iconfont iconeditor_preview"></i>
       {{ preview }}
     </div>
 
-    <div class="ui-button submit app-head-save" @click="onSave" :class="{ disable: !canLoad || isEditing }">
+    <div
+      class="ui-button submit app-head-save"
+      @click="onSave"
+      :class="{ disable: !canLoad || isEditing }"
+    >
       <i class="iconfont iconeditor_save"></i>
       {{ savetips }}
     </div>
-    <preview v-if="info" :key="Math.random()" :name="info.name" :show="showPreview"
-      :ifr="`./show.html?id=${info.id}&lang=${$lang}&rnd=${Math.random()}`" @close="showPreview = false" />
+    <preview
+      v-if="info"
+      :key="Math.random()"
+      :name="info.name"
+      :show="showPreview"
+      :ifr="`./show.html?id=${info.id}&lang=${$lang}&rnd=${Math.random()}`"
+      @close="showPreview = false"
+    />
   </header>
 </template>
 <script>
@@ -24,7 +37,7 @@ import { saveWorks, getPanoInfo, checkLogin } from "@/api";
 import { mapGetters } from "vuex";
 // import config from '@/config'
 import preview from "@/components/preview";
-import { i18n } from "@/lang"
+import { i18n } from "@/lang";
 import { $waiting } from "@/components/shared/loading";
 
 let hhhreg = /\\\\\\\\/g;
@@ -37,7 +50,6 @@ export default {
       preview: i18n.t("edit_page.preview"),
       savetips: i18n.t("edit_page.save"),
 
-
       showPreview: false,
       canLoad: false,
     };
@@ -52,8 +64,8 @@ export default {
         this.getInfo().then((res) => {
           // getInfo里调用了后端接口,底层用了jquery的网络请求方法,为啥会导致promise嵌套没有展平,res拿到的不是promise 对象的resolve值而是promise对象本身????
           res.then(() => {
-            this.$store.commit("TakeInfoSnapShotAtSave")
-          })
+            this.$store.commit("TakeInfoSnapShotAtSave");
+          });
         });
       }
     });
@@ -69,9 +81,14 @@ export default {
   },
   methods: {
     checkParams() {
-      if (!this.info.name && !this.info.icon && !this.info.description && this.info.scenes.length <= 0) {
+      if (
+        !this.info.name &&
+        !this.info.icon &&
+        !this.info.description &&
+        this.info.scenes.length <= 0
+      ) {
         this.$alert({
-          content: this.$i18n.t('gather.nothing_edit'),
+          content: this.$i18n.t("gather.nothing_edit"),
           ok: () => {
             this.$router.push({ path: "/base" });
           },
@@ -91,7 +108,7 @@ export default {
         }
         return item;
       });
-      $waiting.show()
+      $waiting.show();
 
       saveWorks(
         {
@@ -99,7 +116,7 @@ export default {
           someData: { ...this.info, status: 1 },
         },
         () => {
-          this.$msg.success(this.$i18n.t('gather.save_done'));
+          this.$msg.success(this.$i18n.t("gather.save_done"));
           document.title = this.info.name;
           // this.getInfo().then((res) => {
           //   // getInfo里调用了后端接口,底层用了jquery的网络请求方法,为啥会导致promise嵌套没有展平,res拿到的不是promise 对象的resolve值而是promise对象本身????
@@ -116,10 +133,10 @@ export default {
           //     }, 500);
           //   })
           // });
-          $waiting.hide()
+          $waiting.hide();
           if (this.info.scenes.length <= 0 && this.isShow) {
             return this.$alert({
-              content: this.$i18n.t('gather.at_least_one_scene'),
+              content: this.$i18n.t("gather.at_least_one_scene"),
             });
           }
           this.showPreview = true;
@@ -134,9 +151,58 @@ export default {
       }
 
       if (this.info.firstScene) {
-        this.info.firstScene = this.info.scenes.find((item) => item.sceneCode == this.info.firstScene.sceneCode);
+        this.info.firstScene = this.info.scenes.find(
+          (item) => item.sceneCode == this.info.firstScene.sceneCode
+        );
       }
-       // fodderId:[] 资源引用给后端
+      const scenes = this.info.scenes;
+      if (scenes && scenes.length > 0) {
+        scenes.forEach((scene, index) => {
+          if (
+            scene.someData &&
+            scene.someData.hotspots &&
+            scene.someData.hotspots.length > 0
+          ) {
+            this.lockHotspotResourceTree(index, scene.someData.hotspots);
+          }
+        });
+      }
+
+      // this.lockHotspotResourceTree();
+      // fodderId:[] 资源引用给后端
+    },
+    /**
+     * 给热点的资源引用上锁
+     */
+    lockHotspotResourceTree(sceneIndex, hotspots) {
+      hotspots.forEach((item, index) => {
+        const target = this.info.scenes[sceneIndex].someData.hotspots[index];
+        let fodderId = [];
+
+        switch (item.hotspotType) {
+          case "image":
+            fodderId = target.image.reduce((p, c) => p.concat(c["id"]), []);
+            target.fodderId = fodderId;
+            break;
+          case "audio":
+            target.fodderId = [target.audio.id];
+            break;
+          case "imageText":
+            fodderId = target.imageTextInfo.imageList.reduce(
+              (p, c) => p.concat(c["id"]),
+              []
+            );
+            fodderId.push(target.imageTextInfo.audio.id);
+            target.fodderId = fodderId;
+            break;
+          case "video":
+            target.fodderId = [target.video.id];
+            break;
+          default:
+            target.fodderId = [];
+            break;
+        }
+      });
     },
 
     onSave() {
@@ -151,7 +217,7 @@ export default {
         }
         return item;
       });
-      $waiting.show()
+      $waiting.show();
 
       saveWorks(
         {
@@ -159,61 +225,80 @@ export default {
           someData: { ...this.info, status: 1 },
         },
         () => {
-          this.$msg.success(this.$i18n.t('gather.save_done'));
+          this.$msg.success(this.$i18n.t("gather.save_done"));
           document.title = this.info.name;
-          $waiting.hide()
+          $waiting.hide();
           // this.getInfo();
           // this.$store.commit("UpdateIsShowState", true);
-          this.$store.commit("TakeInfoSnapShotAtSave")
+          this.$store.commit("TakeInfoSnapShotAtSave");
         },
-        () => { }
+        () => {}
       );
     },
     getInfo() {
       return checkLogin().then((res) => {
         return new Promise((resolve, reject) => {
-          $waiting.hide()
+          $waiting.hide();
 
           if (res.code == 0) {
-            $waiting.show()
-            getPanoInfo("", (data) => {
-              this.$store.commit("SetInfo", data);
-              this.$store.commit("scene/setScenes", data.scenes);
-              $waiting.hide()
+            $waiting.show();
+            getPanoInfo(
+              "",
+              (data) => {
+                this.$store.commit("SetInfo", data);
+                this.$store.commit("scene/setScenes", data.scenes);
+                $waiting.hide();
 
-              let firstScene = "";
+                let firstScene = "";
 
-              if (data.firstScene) {
-                firstScene = data.scenes.find((item) => item.sceneCode == data.firstScene.sceneCode);
-              }
+                if (data.firstScene) {
+                  firstScene = data.scenes.find(
+                    (item) => item.sceneCode == data.firstScene.sceneCode
+                  );
+                }
 
-              //判断列表里是否有全景图
-              if (data.scenes.some(item => item.type == 'pano') && firstScene && firstScene.type == '4dkk') {
-                console.log(this.currentScene.sceneCode);
-                //如果当前有选中场景,则激活选中场景,无则显示第一个全景图
-                firstScene = this.currentScene.sceneCode ? this.currentScene : data.scenes.find(item => item.type == 'pano')
-              }
+                //判断列表里是否有全景图
+                if (
+                  data.scenes.some((item) => item.type == "pano") &&
+                  firstScene &&
+                  firstScene.type == "4dkk"
+                ) {
+                  console.log(this.currentScene.sceneCode);
+                  //如果当前有选中场景,则激活选中场景,无则显示第一个全景图
+                  firstScene = this.currentScene.sceneCode
+                    ? this.currentScene
+                    : data.scenes.find((item) => item.type == "pano");
+                }
 
-              console.log(firstScene, 'firstScene');
-              this.$store.commit("scene/setCurrentScene", firstScene || data.scenes[0]);
+                console.log(firstScene, "firstScene");
+                this.$store.commit(
+                  "scene/setCurrentScene",
+                  firstScene || data.scenes[0]
+                );
 
-              // 查询初始场景的所在1级分组
-              let catalog = data.catalogs.find((item) => item.id == this.currentScene.category);
-              data.catalogRoot.forEach((item) => {
-                let temp = item.children && item.children.find((sub) => sub == catalog.id);
-                if (temp) {
-                  this.$store.commit("scene/setCurrentCatalogRoot", item);
-                  return;
-                }
-              });
-              resolve()
-            }, (err) => {
-              reject(err)
-            });
+                // 查询初始场景的所在1级分组
+                let catalog = data.catalogs.find(
+                  (item) => item.id == this.currentScene.category
+                );
+                data.catalogRoot.forEach((item) => {
+                  let temp =
+                    item.children &&
+                    item.children.find((sub) => sub == catalog.id);
+                  if (temp) {
+                    this.$store.commit("scene/setCurrentCatalogRoot", item);
+                    return;
+                  }
+                });
+                resolve();
+              },
+              (err) => {
+                reject(err);
+              }
+            );
           } else {
-            reject()
+            reject();
           }
-        })
+        });
       });
     },
   },
@@ -237,7 +322,7 @@ export default {
   top: 50%;
   transform: translateY(-50%);
 
-  >i {
+  > i {
     margin-right: 15px;
   }
 }

+ 1 - 1
packages/qjkankan-editor/src/views/hotspot/EditPanel.vue

@@ -244,7 +244,7 @@ export default {
         // console.error("this.hotspot", val);
         console.error("hotspot", val);
         this.$bus.emit("edithotspot", val);
-        console.log("this.$bus", this.$bus);
+        // console.log("this.$bus", this.$bus);
         // this.$getKrpano().call("removeJQHotspot(" + val.name + ");");
         // this.$bus.emit("addhotspot", val);
       },

+ 1 - 1
packages/qjkankan-editor/src/views/material/pano/index.vue

@@ -233,7 +233,7 @@
       >
         <img :src="config.empty" alt="" />
         <span>{{ no_material_result }}</span>
-        <button @click="$refs.uploadFile.click()" class="upload-btn-in-table">
+        <button @click="$refs.uploadFile.click();" class="upload-btn-in-table">
           {{ upload_material }}
         </button>
       </div>

+ 1 - 0
packages/qjkankan-editor/src/views/material/style.less

@@ -170,6 +170,7 @@
       width: 100%;
       margin: 0;
       top: 150px;
+      z-index: 10000;
       > span {
         color: #646566;
       }

+ 2 - 4
packages/qjkankan-view/src/components/assembly/Tags/metas/metas-phone.vue

@@ -13,7 +13,7 @@
       </div>
       <div class="telephone">
         <img :src="require(`@/assets/images/icon/telephone.svg`)" alt="" />
-        <span>{{ customTelephone.value }}</span>
+        <span>{{ currentTag.phoneInfo.phone }}</span>
       </div>
     </div>
   </div>
@@ -35,9 +35,7 @@ import {
 import { useStore } from "vuex";
 const store = useStore();
 
-const metadata = computed(() => store.getters["scene/metadata"]);
-
-const customTelephone = computed(() => store.getters["scene/customTelephone"]);
+const currentTag = computed(() => store.getters["tags/currentTag"]);
 
 const close = () => {
   store.commit("functions/setShowTelephone", false);