Browse Source

custom music

bianjiang 1 year ago
parent
commit
46ee435f38

+ 6 - 5
src/modules/editor/components/CompUI/basicUI/Page/MusicSelect.tsx

@@ -2,10 +2,10 @@ import { useEditor } from "@/modules/editor";
 import { useResource } from "@/modules/resource";
 import { PlusOutlined } from "@ant-design/icons-vue";
 import { Button, Divider, Select } from "ant-design-vue";
-import { defineComponent, onMounted, reactive } from "vue";
-import { any } from "vue-types";
-import { MusicOptions } from "./localMusic";
 import { queenApi } from "queenjs";
+import { defineComponent } from "vue";
+import { any } from "vue-types";
+
 export default defineComponent({
   props: {
     otherProps: any(),
@@ -51,11 +51,12 @@ export default defineComponent({
       }
     };
     return () => {
+      const { musicOptions } = controls.mediaCtrl.state;
       const compMusic = helper.findRootComp()?.value.music || "";
-      const curValue = MusicOptions.find((e) => {
+      const curValue = musicOptions.find((e: any) => {
         return e.value == compMusic;
       });
-      const { musicOptions } = controls.mediaCtrl.state;
+
       return (
         <Select
           class={"w-full flex-1 overflow-hidden"}

+ 0 - 62
src/modules/editor/components/CompUI/basicUI/Page/localMusic.ts

@@ -1,62 +0,0 @@
-export const MusicOptions = [
-  {
-    label: "安静舒缓",
-    value: "soothing&quiet",
-    src: require("@/assets/audio/soothing&quiet.mp3"),
-  },
-  {
-    label: "和煦的风",
-    value: "balmy_wind",
-    src: require("@/assets/audio/balmy_wind.mp3"),
-  },
-  {
-    label: "纽约落日",
-    value: "sunset_in_newyork",
-    src: require("@/assets/audio/sunset_in_newyork.mp3"),
-  },
-  {
-    label: "温情回忆",
-    value: "warm_memories",
-    src: require("@/assets/audio/warm_memories.mp3"),
-  },
-  {
-    label: "春华秋实",
-    value: "spring&autumn",
-    src: require("@/assets/audio/spring&autumn.mp3"),
-  },
-  {
-    label: "明媚阳光",
-    value: "bright_sunshine",
-    src: require("@/assets/audio/bright_sunshine.mp3"),
-  },
-  {
-    label: "动感活力",
-    value: "dynamic&energetic",
-    src: require("@/assets/audio/dynamic&energetic.mp3"),
-  },
-  {
-    label: "冲上云霄",
-    value: "soar_into_the_sky",
-    src: require("@/assets/audio/soar_into_the_sky.mp3"),
-  },
-  {
-    label: "命运希望",
-    value: "destiny&hope",
-    src: require("@/assets/audio/destiny&hope.mp3"),
-  },
-  {
-    label: "励志活力",
-    value: "inspirational_vitality",
-    src: require("@/assets/audio/inspirational_vitality.mp3"),
-  },
-  {
-    label: "励志希望",
-    value: "inspirational_hope",
-    src: require("@/assets/audio/inspirational_hope.mp3"),
-  },
-  {
-    label: "活力鼓舞",
-    value: "inspiration_vigour",
-    src: require("@/assets/audio/inspiration_vigour.mp3"),
-  },
-];