瀏覽代碼

fix: 重构

jinx 9 月之前
父節點
當前提交
cbf8ddb486

+ 3 - 1
packages/qjkankan-editor/src/Store/modules/navigation.js

@@ -24,6 +24,7 @@ export default {
   },
   getters: {
     isSave: (state) => state.isSave,
+    saveFristScene: (state) => state.saveFristScene,
     currentRootId: (state) => state.currentRootId,
     currentSecondId: (state) => state.currentSecondId,
   },
@@ -80,7 +81,8 @@ export default {
                     this.commit("scene/setCurrentScene", curreentScene);
                   }
                 }, 0);
-                if (rootState.base.baseInfo.firstScene) {//如果初始场景是新增的,则需要更新id
+                if (rootState.base.baseInfo.firstScene) {
+                  //如果初始场景是新增的,则需要更新id
                   setTimeout(() => {
                     let firstScene = rootState.base.sceneList.find((item) => item.sid && item.sid == rootState.base.baseInfo.firstScene.sid);
                     if (firstScene) {

+ 3 - 1
packages/qjkankan-editor/src/Store/modules/scene.js

@@ -85,7 +85,9 @@ export default {
     },
     //添加需要保存的API
     setSaveApiList(state, payload) {
-      if (!state.saveApiList.some((i) => i == payload)) {
+      if (state.saveApiList.some((i) => i == payload)) {
+        return;
+      } else {
         state.saveApiList.push(payload);
       }
       console.error("setSaveApiList", state.saveApiList);

+ 3 - 2
packages/qjkankan-editor/src/framework/play/pano/components/new-list.vue

@@ -65,7 +65,7 @@
         </div>
       </div>
     </div>
-    <div class="bottom-com">
+    <div class="bottom-com" :style="`width:${catalogRootW}px;`">
       <div v-if="info.navigationTrees.length > 1" :style="`width:${catalogRootW}px;`" class="root-group-list swiper-container" ref="root-group">
         <div class="swiper-wrapper root-group-wrapper">
           <div
@@ -218,7 +218,7 @@ export default {
       // console.error(sceneList.length)
       this.$store.commit("scene/setCurrentScenesList", sceneList);
       this.$nextTick(() => {
-        this.rootGroupSwiper.slideTo(index);
+        // this.rootGroupSwiper.slideTo(index);
       });
     },
     changeSceneList() {
@@ -470,6 +470,7 @@ export default {
     }
   }
   .bottom-com {
+    margin: 0px auto;
     .root-group-list {
       max-width: @width;
       margin: 0 auto;

+ 2 - 2
packages/qjkankan-editor/src/pages/Edit.vue

@@ -18,6 +18,7 @@ export default {
     ...mapGetters({
       isInfoChangedSinceSave: "isInfoChangedSinceSave",
       saveApiList: "scene/saveApiList",
+      saveFristScene: "navigation/saveFristScene",
     }),
   },
   watch: {
@@ -91,8 +92,7 @@ export default {
         //   e.preventDefault();
         //   e.returnValue = "您有未保存的修改,仍要离开?"; // 如今的浏览器不会显示这条信息了。
         // }
-      
-        if (this.saveApiList.length) {
+        if (this.saveApiList.length || this.saveFristScene) {
           e.preventDefault();
           e.returnValue = "您有未保存的修改,仍要离开?"; // 如今的浏览器不会显示这条信息了。
         }

+ 9 - 10
packages/qjkankan-editor/src/views/base/index.vue

@@ -26,14 +26,14 @@ export default {
     }),
     newInfo() {
       let info = {
-        work: this.info.work,
-        workBackgroundMusic: this.info.workBackgroundMusic,
-        workCoverType: this.info.workCoverType,
-        workCustomButton: this.info.workCustomButton,
-        workId: this.info.workId,
-        workLogo: this.info.workLogo,
-        workOpeningAnimation: this.info.workOpeningAnimation,
-        workOpeningTip: this.info.workOpeningTip,
+        work: this.info?.work,
+        workBackgroundMusic: this.info?.workBackgroundMusic,
+        workCoverType: this.info?.workCoverType,
+        workCustomButton: this.info?.workCustomButton,
+        workId: this.info?.workId,
+        workLogo: this.info?.workLogo,
+        workOpeningAnimation: this.info?.workOpeningAnimation,
+        workOpeningTip: this.info?.workOpeningTip,
       };
       return JSON.parse(JSON.stringify(info));
       // return info;
@@ -43,8 +43,7 @@ export default {
     newInfo: {
       handler(newVal, oldVal) {
         if (newVal && this.$route.name == "base") {
-        // if (JSON.stringify(newVal).length != JSON.stringify(oldVal).length && this.$route.name == "base") {
-          console.error("base change");
+          // if (JSON.stringify(newVal).length != JSON.stringify(oldVal).length && this.$route.name == "base") {
           this.$store.commit("scene/setSaveApiList", "base");
         }
       },

+ 1 - 1
packages/qjkankan-editor/src/views/mask/setting.vue

@@ -143,7 +143,7 @@ export default {
   watch: {
     currentMask: {
       handler(newVal, oldVal) {
-        if (newVal && this.$route.name == "mask" && newVal.navigationId == oldVal.navigationId) {
+        if (newVal && oldVal && this.$route.name == "mask" && newVal.navigationId == oldVal.navigationId) {
           this.$store.commit("scene/setSaveApiList", "mask");
         }
       },