jinx 6 mesi fa
parent
commit
08a96cc04d

+ 1 - 7
packages/qjkankan-editor/src/Store/modules/base.js

@@ -214,13 +214,7 @@ export default {
           name: "",
           password: "",
         },
-        workBackgroundMusic: {
-          fodderId: "",
-          id: null,
-          name: "",
-          ossPath: "",
-          workId: "",
-        },
+        workBackgroundMusic: null,
         workCoverType: {
           coverImageInWay: 0,
           coverImageOrder: "",

+ 37 - 45
packages/qjkankan-editor/src/views/base/backgroundMusicSettings.vue

@@ -1,31 +1,25 @@
 <template>
   <div class="background-music-settings">
-    <span class="title">{{set_bgm}}</span>
-    <br>
+    <span class="title">{{ set_bgm }}</span>
+    <br />
     <button v-if="!(info && info.workBackgroundMusic && info.workBackgroundMusic.name)" @click="onClickMusicSelectionBtn">
       <i class="iconfont icon-editor_add"></i>
-      {{add_audio}}
+      {{ add_audio }}
     </button>
     <template v-else>
       <div class="music-display" @click.self="onClickCurrentMusic">
         <Audio ref="my-audio" class="audio-control" :backgroundColor="'#1A1B1D'" :myAudioUrl="info.workBackgroundMusic.ossPath"></Audio>
-        <div class="name" v-title="info.workBackgroundMusic.name" @click="onClickCurrentMusic">{{info.workBackgroundMusic.name}}</div>
+        <div class="name" v-title="info.workBackgroundMusic.name" @click="onClickCurrentMusic">{{ info.workBackgroundMusic.name }}</div>
         <i class="iconfont icon-editor_list_delete" @click.stop="onClickDeleteMusicBtn"></i>
       </div>
       <button @click="onClickMusicSelectionBtn">
         <i class="iconfont icon-editor_update"></i>
-        {{change_audio}}
+        {{ change_audio }}
       </button>
     </template>
 
     <div class="dialog" style="z-index: 2000" v-if="isShowSelectionWindow">
-      <MaterialSelector
-        :title="select_material"
-        @cancel="isShowSelectionWindow = false"
-        @submit="handleSubmitFromMaterialSelector"
-        :selectableType="['audio']"
-        initialMaterialType="audio"
-      />
+      <MaterialSelector :title="select_material" @cancel="isShowSelectionWindow = false" @submit="handleSubmitFromMaterialSelector" :selectableType="['audio']" initialMaterialType="audio" />
     </div>
   </div>
 </template>
@@ -34,7 +28,7 @@
 import { mapGetters } from "vuex";
 import MaterialSelector from "@/components/materialSelector.vue";
 import Audio from "@/components/audio/audioButton.vue";
-import {i18n} from "@/lang"
+import { i18n } from "@/lang";
 
 export default {
   components: {
@@ -43,51 +37,49 @@ export default {
   },
   data() {
     return {
-      set_bgm:i18n.t("edit_settings.set_bgm"),
-      add_audio:i18n.t("edit_settings.add_audio"),
-      change_audio:i18n.t("edit_settings.change_audio"),
-      select_material:i18n.t("gather.select_material"),
+      set_bgm: i18n.t("edit_settings.set_bgm"),
+      add_audio: i18n.t("edit_settings.add_audio"),
+      change_audio: i18n.t("edit_settings.change_audio"),
+      select_material: i18n.t("gather.select_material"),
       isShowSelectionWindow: false,
-    }
+    };
   },
   computed: {
     ...mapGetters({
       // info:'info'
-      info:'base/baseInfo'
+      info: "base/baseInfo",
     }),
   },
   methods: {
     onClickMusicSelectionBtn() {
-      this.isShowSelectionWindow = true
+      this.isShowSelectionWindow = true;
     },
     onClickDeleteMusicBtn() {
-      this.info.workBackgroundMusic.id = null 
-      this.info.workBackgroundMusic.fodderId = null
-      this.info.workBackgroundMusic.name = null
-      this.info.workBackgroundMusic.ossPath = null
+      this.info.workBackgroundMusic = null;
+      // this.info.workBackgroundMusic.id = null
+      // this.info.workBackgroundMusic.fodderId = null
+      // this.info.workBackgroundMusic.name = null
+      // this.info.workBackgroundMusic.ossPath = null
     },
     handleSubmitFromMaterialSelector(selected) {
-      this.isShowSelectionWindow = false
-      this.info.workBackgroundMusic.fodderId = selected[0].id
-      this.info.workBackgroundMusic.name = selected[0].name
-      this.info.workBackgroundMusic.ossPath = selected[0].ossPath
+      this.isShowSelectionWindow = false;
+      this.info.workBackgroundMusic = {};
+      this.info.workBackgroundMusic.fodderId = selected[0].id;
+      this.info.workBackgroundMusic.name = selected[0].name;
+      this.info.workBackgroundMusic.ossPath = selected[0].ossPath;
     },
     onClickCurrentMusic() {
-      if (this.$refs['my-audio']) {
-        this.$refs['my-audio'].switchPlayPause()
+      if (this.$refs["my-audio"]) {
+        this.$refs["my-audio"].switchPlayPause();
       }
-    }
+    },
   },
   mounted() {
     if (!this.info.workBackgroundMusic) {
-      this.info.workBackgroundMusic = {
-        id: '',
-        name: '',
-        ossPath: '',
-      }
+      this.info.workBackgroundMusic = null;
     }
-  }
-}
+  },
+};
 </script>
 
 <style lang="less" scoped>
@@ -97,17 +89,17 @@ export default {
   height: 546px;
   > .title {
     font-size: 18px;
-    color: #FFFFFF;
+    color: #ffffff;
   }
   > button {
     margin-top: 16px;
     width: 234px;
     height: 40px;
-    background: #1A1B1D;
+    background: #1a1b1d;
     border-radius: 2px;
     border: 1px solid #404040;
     display: block;
-    color: #0076F6;
+    color: #0076f6;
     font-size: 14px;
     cursor: pointer;
     &:hover {
@@ -122,7 +114,7 @@ export default {
     margin-top: 16px;
     width: 234px;
     height: 40px;
-    background: #1A1B1D;
+    background: #1a1b1d;
     border-radius: 2px;
     border: 1px solid #404040;
     color: #fff;
@@ -130,7 +122,7 @@ export default {
     position: relative;
     text-align: center;
     &:hover {
-      color: #0076F6;
+      color: #0076f6;
       border-color: @color;
       > .audio-control {
         display: inline-block;
@@ -164,9 +156,9 @@ export default {
       transform: translateY(-50%);
       right: 18px;
       &:hover {
-        color: #FA5555;
+        color: #fa5555;
       }
     }
   }
 }
-</style>
+</style>

+ 7 - 2
packages/qjkankan-editor/src/views/base/index.vue

@@ -16,7 +16,7 @@ export default {
   },
   data() {
     return {
-      isInit: false,
+      isInit: true,
     };
   },
   computed: {
@@ -44,7 +44,12 @@ export default {
       handler(newVal, oldVal) {
         if (newVal && this.$route.name == "base") {
           // if (JSON.stringify(newVal).length != JSON.stringify(oldVal).length && this.$route.name == "base") {
-          this.$store.commit("scene/setSaveApiList", "base");
+          if (this.isInit) {
+            //防止第一次获取数据的时候触发
+            this.isInit = false;
+          } else {
+            this.$store.commit("scene/setSaveApiList", "base");
+          }
         }
       },
       deep: true,

+ 0 - 1
packages/qjkankan-editor/src/views/base/passwordSettings.vue

@@ -37,7 +37,6 @@ export default {
   watch: {
     'info.work.password': {
       handler(v) {
-        console.error(213123)
         this.info.work.password = v.replace(/[^\w]/g, '').replace(/_/g, '')
       }
     }