gemercheung 2 lat temu
rodzic
commit
d52461e818

+ 1 - 1
packages/qjkankan-editor/.env.testprod

@@ -7,5 +7,5 @@ VUE_APP_PROXY_URL_ROOT='https://test.4dkankan.com'
 VUE_APP_PROXY_URL='https://test.4dkankan.com/qjkankan/'
 VUE_APP_ORIGIN=
 VUE_APP_URL_FILL=/qjkankan
-VUE_APP_DEBBUG_FLAG=0608-01
+VUE_APP_DEBBUG_FLAG=0612-01
 VUE_APP_DEBBUG_NOTIFY=0

+ 38 - 3
packages/qjkankan-editor/src/components/RichTextEditor.vue

@@ -2,10 +2,13 @@
   <div class="rich-text-editor">
     <div class="editor-title">
       <div class="title">
-        <span> {{ $i18n.t("hotspot.edit_article_title") }}</span>
+        <span>
+          {{ title ? title : $i18n.t("hotspot.edit_article_title") }}
+        </span>
       </div>
     </div>
     <Toolbar
+      v-if="isShowToolbar"
       style="border-bottom: 1px solid #ccc"
       :editor="editor"
       :defaultConfig="toolbarConfig"
@@ -16,6 +19,9 @@
       v-model="html"
       :defaultConfig="editorConfig"
       :mode="mode"
+      class="editor"
+      @change="onEditorChange"
+      @onMaxLength="onEditorMaxLength"
       @onCreated="onEditorCreated"
     />
     <div class="bottom-bar">
@@ -65,18 +71,38 @@ export default Vue.extend({
     MaterialSelector,
   },
   props: {
+    title: {
+      type: String,
+      default: "",
+    },
+    limit: {
+      type: Number,
+      default: 0,
+    },
+    placeholder: {
+      type: String,
+      default: "",
+    },
+
     initialHtml: {
       type: String,
       default: "",
     },
+    isShowToolbar: {
+      type: Boolean,
+      default: true,
+    },
   },
   data() {
     return {
       editor: null,
       html: this.initialHtml,
+      size: 0,
       toolbarConfig: {},
       editorConfig: {
-        placeholder: "",
+        placeholder: this.placeholder,
+        maxLength: this.limit > 0 ? this.limit : null,
+
         MENU_CONF: {
           uploadImage: {
             customBrowseAndUpload: (insertFn) => {
@@ -137,6 +163,13 @@ export default Vue.extend({
         );
       }
     },
+    onEditorChange(content) {
+      console.log("content", content);
+      this.size = content.size;
+    },
+    onEditorMaxLength() {
+      console.log("超出大小");
+    },
   },
   mounted() {},
   beforeDestroy() {
@@ -152,6 +185,9 @@ export default Vue.extend({
 <style lang="less" scoped>
 .rich-text-editor {
   // border: 1px solid #ccc;
+  .editor {
+    border: 1px solid #545454;
+  }
   .editor-title {
     height: 64px;
     .title {
@@ -174,7 +210,6 @@ export default Vue.extend({
     align-items: center;
     > button {
       margin-left: 10px;
-   
     }
   }
 }

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

@@ -453,7 +453,13 @@ export default {
     },
     showList() {
       if (this.materialTypeAlias === "pano") {
-        return this.list.filter((i) => i.status === 3);
+        return this.list.filter((i) => {
+          if (i.type !== "dir" && i.status < 3) {
+            return false;
+          } else {
+            return true;
+          }
+        });
       }
       return this.list;
     },
@@ -561,18 +567,22 @@ export default {
       item.materialType = this.materialType; // 三维场景数据没有type字段来表明自己是三维场景。所以统一加一个字段。
       if (this.isMultiSelection) {
         if (v) {
+          // eslint-disable-next-line vue/no-mutating-props
           this.select.push(item);
         } else {
           const toDeleteIdx = this.select.findIndex((eachSelect) => {
             return eachSelect.id === item.id;
           });
           if (toDeleteIdx >= 0) {
+            // eslint-disable-next-line vue/no-mutating-props
             this.select.splice(toDeleteIdx, 1);
           }
         }
       } else {
+        // eslint-disable-next-line vue/no-mutating-props
         this.select.splice(0, this.select.length);
         if (v) {
+          // eslint-disable-next-line vue/no-mutating-props
           this.select.push(item);
         }
       }
@@ -661,6 +671,7 @@ export default {
           .concat(uploadlist)
           .filter((a) => !res.has(a.backendId) && res.set(a.backendId, 1));
         console.log("latestUploadlist", latestUploadlist);
+        // console.log("origin-list", this.list);
         const capitalizedMaterialType = capitalize(this.materialType);
         this.$store.commit(
           `setUploadStatusList${capitalizedMaterialType}`,

+ 5 - 4
packages/qjkankan-editor/src/lang/_en.json

@@ -907,7 +907,7 @@
     "newTab": "New Tab",
     "add_scene": "Add a scene",
     "change_scene": "Change a scene",
-    "text_placeholder": "Please enter no more than 500 words of text.",
+    "text_placeholder": "Please enter no more than 2000 words of text.",
     "add_video": "Add a video",
     "select_video": "Add a video",
     "change_video": "Change a video",
@@ -920,9 +920,10 @@
     "change_pdf": "Change the PDF",
     "pdf_invalid_tip": "Please upload PDF files within 50M",
     "add_article": "Add Paragraph",
-
-    "edit_article_title":"Edit paragraph",
-    "edit_article":"Edit paragraph",
+    "edit_article_title": "Edit paragraph",
+    "edit_article": "Edit paragraph",
+    "edit_text_title": "编辑文本",
+    "edit_text": "编辑文本内容",
     "cancel_add_hotspot": "The edited content will not be saved, confirm to close it"
   },
   "explanation": {

+ 3 - 1
packages/qjkankan-editor/src/lang/_zh.json

@@ -891,7 +891,7 @@
     "newTab": "新窗口打开",
     "add_scene": "添加场景",
     "change_scene": "更换场景",
-    "text_placeholder": "请输入文字内容,限1000    字",
+    "text_placeholder": "请输入文字内容,限2000字",
     "add_video": "添加视频",
     "select_video": "添加视频",
     "change_video": "更换视频",
@@ -906,6 +906,8 @@
     "add_article": "添加文章内容",
     "edit_article_title": "编辑文章",
     "edit_article": "编辑文章内容",
+    "edit_text_title": "编辑文本",
+    "edit_text": "编辑文本内容",
     "cancel_add_hotspot": "已编辑内容将不会保存,确定要关闭吗?"
   },
   "explanation": {

+ 118 - 53
packages/qjkankan-editor/src/views/hotspot/hotspotType/textarea.vue

@@ -1,79 +1,144 @@
 <template>
   <div>
-    <div class="textarea-wrapper">
-      <!-- <textarea
-        v-model.trim="text"
-        maxlength="500"
-        placeholder="请输入文字内容,限500字"
-        type="text"
-      /> -->
+    <div class="textarea-wrapper-setting">
+      <button class="change-btn" @click="onClickEdit">
+        <img
+          class="icon-editor_update"
+          src="@/assets/images/icons/edit.png"
+          alt=""
+          draggable="false"
+        />
+        {{ $i18n.t("hotspot.edit_text") }}
+      </button>
 
-      <editor ref="editor" :html="text" :placeholder="$i18n.t('hotspot.text_placeholder')" :maxlength="1000" @change="onEditorChange"></editor>
-      <span class="count">{{size}}/1000</span>
+      <div class="dialog" style="z-index: 2000" v-if="isShowEditor">
+        <!-- <editor
+          ref="editor"
+          :html="text"
+          :placeholder="$i18n.t('hotspot.text_placeholder')"
+          :maxlength="1000"
+          @change="onEditorChange"
+        ></editor> -->
+        <RichTextEditor
+          class="rich-text-editor"
+          :title="$i18n.t('hotspot.edit_text_title')"
+          :placeholder="$i18n.t('hotspot.text_placeholder')"
+          :isShowToolbar="false"
+          :limit="2000"
+          :initialHtml="text"
+          @ok="onEditorOk"
+          @cancel="onEditorCancel"
+        />
+
+      </div>
     </div>
   </div>
 </template>
 <script>
-
-import Editor from "@/components/shared/Editor"
-
+import Editor from "@/components/shared/Editor";
+import RichTextEditor from "@/components/RichTextEditor.vue";
 export default {
-  components: { Editor },
-  props: ['textarea'],
+  components: { RichTextEditor },
+  props: ["textarea"],
   data() {
     return {
       text: this.textarea,
-      size: 0
-    }
+      isShowEditor: false,
+      size: 0,
+    };
+  },
+  computed: {
+    layerTitle() {
+      return this.$i18n.t("hotspot.edit_article_title");
+    },
   },
   methods: {
+    onClickEdit() {
+      this.isShowEditor = true;
+    },
     onEditorChange(content) {
-      this.$emit('textChange', content.html)
-      this.size = content.size
-      // this.description = content.html
-      // this.validates.description.length = content.size
+      this.$emit("textChange", content.html);
+      this.size = content.size;
+    },
+    onEditorOk(data) {
+      this.isShowEditor = false;
+      this.text = data;
+      this.$emit("textChange", data);
+    },
+    onEditorCancel() {
+      this.isShowEditor = false;
     },
   },
-  watch: {
-    text(newVal) {
-      this.$emit('textChange', newVal)
-    }
-  }
-}
+ 
+};
 </script>
 
 <style lang="less" scoped>
-.textarea-wrapper {
-  position: relative;
-  border: 1px solid rgba(151, 151, 151, 0.2);
-  background: #1A1B1D;
-  border-radius: 2px;
-  height: 119px;
-  width: 100%;
-
-  &:focus-within {
-    border-color: #0076F6;
-  }
-
-  >textarea {
-    padding: 9px 16px 30px 16px;
-    resize: none;
-    border: none;
-    background: transparent;
-    outline: none;
+.textarea-wrapper-setting {
+  > .change-btn {
+    margin-top: 16px;
     width: 100%;
-    height: calc(100% - 30px);
-    color: #fff;
-    letter-spacing: 1px;
+    height: 40px;
+    background: #1a1b1d;
+    border-radius: 2px;
+    border: 1px solid #404040;
+    display: block;
+    color: #0076f6;
     font-size: 14px;
+    cursor: pointer;
+    &:hover {
+      border-color: @color;
+    }
+    img {
+      width: 14px;
+      height: 14px;
+    }
   }
 
-  >.count {
-    position: absolute;
-    right: 16px;
-    bottom: 9px;
-    font-size: 14px;
-    color: rgba(255, 255, 255, 0.2);
+  .dialog {
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    .rich-text-editor {
+      flex: 0 0 auto;
+      width: 65%;
+      &.w-e-full-screen-container {
+        transform: initial !important;
+      }
+    }
   }
 }
+// .textarea-wrapper {
+//   position: relative;
+//   border: 1px solid rgba(151, 151, 151, 0.2);
+//   background: #1a1b1d;
+//   border-radius: 2px;
+//   height: 119px;
+//   width: 100%;
+
+//   &:focus-within {
+//     border-color: #0076f6;
+//   }
+
+//   > textarea {
+//     padding: 9px 16px 30px 16px;
+//     resize: none;
+//     border: none;
+//     background: transparent;
+//     outline: none;
+//     width: 100%;
+//     height: calc(100% - 30px);
+//     color: #fff;
+//     letter-spacing: 1px;
+//     font-size: 14px;
+//   }
+
+//   > .count {
+//     position: absolute;
+//     right: 16px;
+//     bottom: 9px;
+//     font-size: 14px;
+//     color: rgba(255, 255, 255, 0.2);
+//   }
+// }
 </style>

+ 4 - 3
packages/qjkankan-view/src/components/Pano/index.vue

@@ -73,7 +73,7 @@ watch(
       // if (store.getters["fdkk/fdkkBGM"]) {
       //   store.commit("fdkk/setFdkkBGM", "");
       // }
-
+      store.dispatch("audio/setLock", false);
       nextTick(() => {
         loadScene(newVal);
         console.log(newVal, "newVal");
@@ -97,13 +97,14 @@ watch(
           if (!flag) {
             if (unref(isHasNormalBGM)) {
               console.log("不存在V3并存在普通bgm");
-              await store.dispatch("audio/setLock", false);
               // store.dispatch("audio/playBGM", 0);
-              setTimeout(() => store.dispatch("audio/pauseBGM"), 50);
+              store.dispatch("audio/pauseBGM");
             }
           } else {
             setTimeout(() => store.dispatch("audio/pauseBGM"), 100);
           }
+        } else {
+          store.dispatch("audio/setLock", false);
         }
       });
     }

+ 1 - 0
packages/qjkankan-view/src/components/assembly/Tags/metas/metas-image.vue

@@ -198,6 +198,7 @@ const onSwiper = (swiper) => {
 const onSwiperChange = (swiper) => {
   const { activeIndex } = swiper;
   currentIndex.value = activeIndex;
+  scaleRate.value = 1;
   console.log("activeIndex", activeIndex);
 };
 </script>

+ 1 - 0
packages/qjkankan-view/src/components/assembly/Tags/metas/metas-imagetext.vue

@@ -212,6 +212,7 @@ const onSwiper = (swiper) => {
 const onSwiperChange = (swiper) => {
   const { activeIndex } = swiper;
   currentIndex.value = activeIndex;
+  scaleRate.value = 1;
   console.log("activeIndex", activeIndex);
 };
 const onClickPrevious = () => {

+ 0 - 0
packages/qjkankan-view/src/components/assembly/notify.vue


+ 235 - 227
packages/qjkankan-view/src/hooks/useAudio.js

@@ -1,266 +1,274 @@
 /**
  * 利用
  */
-import store from '@/store';
-import { computed, onMounted, watch, ref, unref } from 'vue';
-import debounce from 'lodash-es/debounce'
-import mitt from 'mitt';
-let CLICKFIRST = false
+import store from "@/store";
+import { computed, onMounted, watch, ref, unref } from "vue";
+import debounce from "lodash-es/debounce";
+import mitt from "mitt";
+let CLICKFIRST = false;
 
 const currentPlayer = ref(null);
 const isInit = ref(false);
-const currentAudio = computed(() => store.getters['audio/currentAudio']);
+const currentAudio = computed(() => store.getters["audio/currentAudio"]);
 const isDoneforCover = computed(() => store.getters["scene/isDoneforCover"]);
 const currentScene = computed(() => store.getters["scene/currentScene"]);
 const isShowCover = computed(
-    () => store.getters["scene/metadata"].coverInfo.isShowCover === 1 || false
+  () => store.getters["scene/metadata"].coverInfo.isShowCover === 1 || false
 );
 
-
 async function initDefaultAudio() {
-    watch([isShowCover, isDoneforCover, currentScene], ([val1, val2, val3]) => {
-        //开场完成后才开始初始化audioplayer
-        console.log('initDefaultAudio', unref(val1), unref(val2));
-        if (!unref(val1)) {
-            // 开场封面关闭时
-            initAudioPlayer();
-        } else {
-            // 开场封面开启时并跳转完成时
-            if (unref(val2)) {
-                initAudioPlayer();
-            }
+  watch(
+    [isShowCover, isDoneforCover, currentScene],
+    ([val1, val2, val3]) => {
+      //开场完成后才开始初始化audioplayer
+      console.log("initDefaultAudio", unref(val1), unref(val2));
+      if (!unref(val1)) {
+        // 开场封面关闭时
+        initAudioPlayer();
+      } else {
+        // 开场封面开启时并跳转完成时
+        if (unref(val2)) {
+          initAudioPlayer();
         }
-        watchUpdateCurrentScenEexplanation(unref(val3))
-        watchResetV4BGM(unref(val3))
-    }, {
-        deep: true,
-        immediate: true,
-    })
+      }
+      watchUpdateCurrentScenEexplanation(unref(val3));
+      watchResetV4BGM(unref(val3));
+    },
+    {
+      deep: true,
+      immediate: true,
+    }
+  );
 
-    watch(currentAudio, (val, old) => {
-        const isSame = unref(old) && unref(val).url === unref(old).url;
-        console.log('isSame', isSame);
-        if (unref(val) && unref(val).url.length > 0) {
-            if (unref(currentPlayer)) {
-                const url = unref(val).url
-                const autoplay = unref(val).isAuto
-                const loop = unref(val).repeat
-                console.log('currentAudio', unref(val).url, autoplay, loop);
-                if (!isSame) {
-                    unref(currentPlayer).switchUrl(url, autoplay, loop);
-                } else {
-                    //相同URL的再次播放
-                    unref(currentPlayer).resume();
-                }
-            }
+  watch(
+    currentAudio,
+    (val, old) => {
+      const isSame = unref(old) && unref(val).url === unref(old).url;
+      console.log("isSame", isSame);
+      if (unref(val) && unref(val).url.length > 0) {
+        if (unref(currentPlayer)) {
+          const url = unref(val).url;
+          const autoplay = unref(val).isAuto;
+          const loop = unref(val).repeat;
+          console.log("currentAudio", unref(val).url, autoplay, loop);
+          if (!isSame) {
+            unref(currentPlayer).switchUrl(url, autoplay, loop);
+          } else {
+            //相同URL的再次播放
+            unref(currentPlayer).resume();
+          }
         }
-    }, {
-        deep: true,
-        immediate: true,
-    })
+      }
+    },
+    {
+      deep: true,
+      immediate: true,
+    }
+  );
 }
 function initAudioPlayer() {
-    if (!unref(isInit)) {
-        isInit.value = true
-        console.log('initAudioPlayer');
-        const player = createAudioPlayer(unref(currentAudio).url, unref(currentAudio).isAuto, unref(currentAudio).repeat);
-        currentPlayer.value = player
-        player.on('play', () => {
-            console.log('play--22', player.isPlaying);
-            store.dispatch('audio/updatePlayerStatus', player.isPlaying);
-        })
-        player.on('pause', () => {
-            console.log('pause--33', player.isPlaying);
-            store.dispatch('audio/updatePlayerStatus', player.isPlaying);
-        })
-        player.on('end', () => {
-            console.log('end--33', player.isPlaying);
-            store.dispatch('audio/updatePlayerStatus', player.isPlaying);
-        })
-        window.store = store
-    }
+  if (!unref(isInit)) {
+    isInit.value = true;
+    console.log("initAudioPlayer");
+    const player = createAudioPlayer(
+      unref(currentAudio).url,
+      unref(currentAudio).isAuto,
+      unref(currentAudio).repeat
+    );
+    currentPlayer.value = player;
+    player.on("play", () => {
+      console.log("play--22", player.isPlaying);
+      store.dispatch("audio/updatePlayerStatus", player.isPlaying);
+    });
+    player.on("pause", () => {
+      console.log("pause--33", player.isPlaying);
+      store.dispatch("audio/updatePlayerStatus", player.isPlaying);
+    });
+    player.on("end", () => {
+      console.log("end--33", player.isPlaying);
+      store.dispatch("audio/updatePlayerStatus", player.isPlaying);
+    });
+    window.store = store;
+  }
 }
 
 function watchUpdateCurrentScenEexplanation(data) {
-
-    if ("explanation" in data) {
-        store.dispatch("audio/initExplanationBGM", {
-            url: data.explanation.audioUrl,
-            repeat: data.explanation.repeat,
-            isAuto: data.explanation.openByDefault,
-        });
-    } else {
-        console.log('not initExplanationBGM');
-        store.dispatch("audio/initExplanationBGM", {
-            url: "",
-            repeat: false,
-            isAuto: false,
-
-        });
-    }
+  if ("explanation" in data) {
+    store.dispatch("audio/initExplanationBGM", {
+      url: data.explanation.audioUrl,
+      repeat: data.explanation.repeat,
+      isAuto: data.explanation.openByDefault,
+    });
+  } else {
+    console.log("not initExplanationBGM");
+    store.dispatch("audio/initExplanationBGM", {
+      url: "",
+      repeat: false,
+      isAuto: false,
+    });
+  }
 }
 function watchResetV4BGM(data) {
-    console.log('data.type', data.type)
-    if (data.type !== '4dkk') {
-        store.dispatch('audio/initV4BGM', '')
-    }
-
+  console.log("data.type", data.type);
+  if (data.type !== "4dkk") {
+    store.dispatch("audio/initV4BGM", "");
+  }
 }
 
 function createAudioPlayer(url, autoplay, loop = true) {
-    const player = new AudioPlayer({
-        src: url,
-        autoplay: autoplay,
-        loop: loop
-    });
+  const player = new AudioPlayer({
+    src: url,
+    autoplay: autoplay,
+    loop: loop,
+  });
 
-    return player
+  return player;
 }
 
 class AudioPlayer {
-    constructor(options) {
-        this._src = options.src;
-        this._loop = options.loop;
-        this._autoplay = options.autoplay;
-        this._isPlaying = false;
-        this._lock = false;
-        const emitter = mitt()
-        Object.keys(emitter).forEach((method) => {
-            this[method] = emitter[method]
-        })
-        this.audio = null
-        this.switchUrl = debounce(this.switchUrlSource, 300).bind(this);
-        this.play = debounce(this.toPlay, 300).bind(this);
-        this.init();
-    }
-    get isPlaying() {
-        return this._isPlaying;
-    }
-
-    switchUrlSource(url, autoplay, loop) {
-        this.audio.unload();
-        if ('unload' in this.audio) {
-            console.log('switchUrlSource-1');
-            this.audio.unload();
-        } else {
-            console.log('switchUrlSource-2');
-            return
-        }
-        console.log('switchUrlSource', url);
-        this._isPlaying = false;
-        this._lock = false;
-        this._autoplay = autoplay || false;
-        this._loop = loop || false;
-        this._src = url;
-        this.audio = null;
-        this.createAudio();
-        this.play();
-        this.emit('change', this.audio);
-    }
-    init() {
-        this.createAudio();
-        this.bindElement();
-        this.play();
-        this.emit('ready', this.audio);
-    }
-    createAudio() {
-        this.audio = new Howl({
-            preload: true,
-            src: [this._src],
-            loop: this._loop || false,
-            html5: false,
-            onplay: () => {
-                this._isPlaying = true
-                this.emit('play')
-            },
-            onpause: () => {
-                this._isPlaying = false
-                this.emit('pause')
-            },
-            onend: () => {
-                this._isPlaying = false
-                this.audio.unload();
-                this.emit('end')
-            },
-
-        })
+  constructor(options) {
+    this._src = options.src;
+    this._loop = options.loop;
+    this._autoplay = options.autoplay;
+    this._isPlaying = false;
+    this._lock = false;
+    const emitter = mitt();
+    Object.keys(emitter).forEach((method) => {
+      this[method] = emitter[method];
+    });
+    this.audio = null;
+    this.switchUrl = debounce(this.switchUrlSource, 300).bind(this);
+    this.play = debounce(this.toPlay, 300).bind(this);
+    this.init();
+  }
+  get isPlaying() {
+    return this._isPlaying;
+  }
 
+  switchUrlSource(url, autoplay, loop) {
+    this.audio.unload();
+    if ("unload" in this.audio) {
+      console.log("switchUrlSource-1");
+      this.audio.unload();
+    } else {
+      console.log("switchUrlSource-2");
+      return;
     }
-    bindElement() {
-        const $player = document.querySelector('.ui-view-layout')
-        const onclick = () => {
-            $player.removeEventListener('click', onclick)
-            $player.removeEventListener('touchstart', onclick)
-            //判断是否第一次进入或者是否已点击过
-            if (CLICKFIRST) {
-                return
-            }
-            CLICKFIRST = true
-            this.play();
-        }
-        $player.addEventListener('click', onclick)
-        $player.addEventListener('touchstart', onclick)
-    }
+    console.log("switchUrlSource", url);
+    this._isPlaying = false;
+    // this._lock = false;
+    this._autoplay = autoplay || false;
+    this._loop = loop || false;
+    this._src = url;
+    this.audio = null;
+    this.createAudio();
+    this.play();
+    this.emit("change", this.audio);
+  }
+  init() {
+    this.createAudio();
+    this.bindElement();
+    this.play();
+    this.emit("ready", this.audio);
+  }
+  createAudio() {
+    this.audio = new Howl({
+      preload: true,
+      src: [this._src],
+      loop: this._loop || false,
+      html5: false,
+      onplay: () => {
+        this._isPlaying = true;
+        this.emit("play");
+      },
+      onpause: () => {
+        this._isPlaying = false;
+        this.emit("pause");
+      },
+      onend: () => {
+        this._isPlaying = false;
+        this.audio.unload();
+        this.emit("end");
+      },
+    });
+  }
+  bindElement() {
+    const $player = document.querySelector(".ui-view-layout");
+    const onclick = () => {
+      $player.removeEventListener("click", onclick);
+      $player.removeEventListener("touchstart", onclick);
+      //判断是否第一次进入或者是否已点击过
+      if (CLICKFIRST) {
+        return;
+      }
+      CLICKFIRST = true;
+      this.play();
+    };
+    $player.addEventListener("click", onclick);
+    $player.addEventListener("touchstart", onclick);
+  }
 
-    async toPlay() {
-        try {
-            if (!this._isPlaying && !this._lock) {
-                console.log('play---1', this._autoplay)
-                if (this._autoplay) {
-                    await this.audio.play();
-                } else {
-                    //默认不自动播放重置状态
-                    this._isPlaying = false
-                    store.dispatch('audio/updatePlayerStatus', false);
-                }
-            }
-        } catch (error) {
-            console.warn('playError', error);
-        }
-    }
-    pause() {
-        return this.audio.pause();
-    }
-    resume() {
-        console.log('resume');
-        if (!this._isPlaying) {
-            return this.audio.play();
-        }
-    }
-    stop() {
-        this.pause();
-        store.dispatch('audio/updatePlayerStatus', false);
-    }
-    destroy() {
-        console.warn('audio-destroy');
-        if ('unload' in this.audio) {
-            this.audio.unload();
+  async toPlay() {
+    try {
+      if (!this._isPlaying && !this._lock) {
+        console.log("play---1", this._autoplay, this._lock);
+        if (this._autoplay) {
+          await this.audio.play();
+        } else {
+          //默认不自动播放重置状态
+          this._isPlaying = false;
+          store.dispatch("audio/updatePlayerStatus", false);
         }
-        this._isPlaying = false;
-        this._autoplay = false;
-        this._loop = false;
-        this._src = '';
-        this.audio = null;
-        store.dispatch('audio/updatePlayerStatus', false);
-        this.emit('destroy');
-    }
-    lock() {
-        this._lock = true
+      }
+    } catch (error) {
+      console.warn("playError", error);
     }
-    unlock() {
-        this._lock = false
+  }
+  pause() {
+    return this.audio.pause();
+  }
+  resume() {
+    console.log("resume");
+    if (!this._isPlaying) {
+      return this.audio.play();
     }
-    mute() {
-        return this.audio.mute(true);
-    }
-    unmute() {
-        return this.audio.mute(false);
+  }
+  stop() {
+    this.pause();
+    store.dispatch("audio/updatePlayerStatus", false);
+  }
+  destroy() {
+    console.warn("audio-destroy");
+    if ("unload" in this.audio) {
+      this.audio.unload();
     }
+    this._isPlaying = false;
+    this._autoplay = false;
+    this._loop = false;
+    this._src = "";
+    this.audio = null;
+    store.dispatch("audio/updatePlayerStatus", false);
+    this.emit("destroy");
+  }
+  lock() {
+    console.log("audio-lock");
+    this._lock = true;
+  }
+  unlock() {
+    console.log("audio-unlock");
+    this._lock = false;
+  }
+  mute() {
+    return this.audio.mute(true);
+  }
+  unmute() {
+    return this.audio.mute(false);
+  }
 }
 
 export function useAudio() {
-    return {
-        initDefaultAudio,
-        currentPlayer,
-    };
-}
+  return {
+    initDefaultAudio,
+    currentPlayer,
+  };
+}