瀏覽代碼

热点类型:图文

任一存 2 年之前
父節點
當前提交
71b0f2eb7a

+ 1 - 1
packages/qjkankan-editor/src/lang/_en.json

@@ -881,7 +881,7 @@
       "link": "热点链接",
       "textarea": "热点文本",
       "tag": "",
-      "imgText": "热点图文",
+      "imageText": "热点图文",
       "article": "热点文章",
       "pdf": "热点PDF",
       "phone": "热点电话"

+ 5 - 2
packages/qjkankan-editor/src/lang/_zh.json

@@ -885,7 +885,7 @@
       "link": "热点链接",
       "textarea": "热点文本",
       "tag": "",
-      "imgText": "热点图文",
+      "imageText": "热点图文",
       "article": "热点文章",
       "pdf": "热点PDF",
       "phone": "热点电话"
@@ -905,7 +905,10 @@
     "text_placeholder": "请输入文字内容,限500字",
     "add_video": "添加视频",
     "select_video": "添加视频",
-    "change_video": "更换视频"
+    "change_video": "更换视频",
+    "10MB_limit": "不超过10MB",
+    "text_content": "文字内容",
+    "apply_to_all": "应用到所有"
   },
   "explanation": {
     "explanation_settings": "语音讲解",

+ 37 - 3
packages/qjkankan-editor/src/views/hotspot/HotSpotList.vue

@@ -258,7 +258,6 @@ export default {
             isTextWrap: false,
             textNumPerLine: 10,
           },
-          
           name: "_" + this.$randomWord(true, 8, 8),
           hotspotTitle: this.$i18n.t('hotspot.click_to_comfirm'),
           fontSize: 12,
@@ -274,7 +273,33 @@ export default {
           textarea: '',
           image: [],
           audio: '',
-          video: ''
+          video: '',
+          imageTextInfo: { // 热点类型为图文时,图文内容
+            imageList: [],
+            text: '',
+            isApplyToAll: true,
+            audio: {
+              // ancestors: "",
+              // createTime: "2022-08-01 14:30",
+              // dirId: 1,
+              // dirName: "根目录",
+              // dpi: "0",
+              // fileName: "20220801_143047668.mp3",
+              // fileSize: "2.08MB",
+              // icon: "0",
+              // id: 2594,
+              // materialType: "audio",
+              // name: "谢海清 - 清平乐",
+              // ossPath: "https://ossxiaoan.4dage.com/720yun_fd_manage/fodder/20220801_143047668.mp3",
+              // previewIcon: "",
+              // sceneCode: "0",
+              // status: 0,
+              // tempId: "u_4zK9YIFW",
+              // type: "audio",
+              // updateTime: "2022-11-01 19:49",
+              // userId: "13825625448",
+            }
+          }
         }
       } else {
         hotspotData = browser.CloneObject(data)
@@ -313,10 +338,19 @@ export default {
         } else if (hotspotData.visible === false) {
           hotspotData.titleDisplayMode = 'never'
         }
-        // v1.3新增了titlePosition
+        // v1.3新增
         if (!hotspotData.titlePosition) {
           hotspotData.titlePosition = 'top'
         }
+        // v1.3新增
+        if (!hotspotData.imageTextInfo) {
+          hotspotData.imageTextInfo = {
+            imageList: [],
+            text: '',
+            isApplyToAll: true,
+            audio: {}
+          }
+        }
       }
 
       this.$store.commit("SetHotspot", hotspotData)

+ 410 - 0
packages/qjkankan-editor/src/views/hotspot/hotspotType/imageText.vue

@@ -0,0 +1,410 @@
+<template>
+  <div class="image-text-effect-setting">
+    
+    <div class="image-list-wrap">
+      <button
+        class="add-btn"
+        v-if="hotspot.imageTextInfo.imageList.length === 0"
+        @click="isShowImageSelect = true"
+      >
+        <img src="@/assets/images/default/hotspot_scene_add.png" alt="">
+        <div class="name">{{$i18n.t('hotspot.add_image')}}</div>
+        <div class="tip">{{$i18n.t('hotspot.10MB_limit')}}</div>
+      </button>
+      <ul class="image-list" v-else>
+        <button class="add-btn" @click="isShowImageSelect = true">
+          <div class="inner-wrap">
+            <img src="@/assets/images/default/hotspot_scene_add.png" alt="">
+            <div>{{$i18n.t('hotspot.add_tooltips')}}</div>
+          </div>
+        </button>
+        <li v-for="(item,i) in hotspot.imageTextInfo.imageList" :key="i">
+          <img class="thumb" :src="item.icon || $thumb" alt="">
+          <button class="delete-btn" @click="del(item)">
+            <img class="normal" src="@/assets/images/icons/close01_normal@2x.png" alt="">
+            <img class="hover" src="@/assets/images/icons/close01_hover@2x.png" alt="">
+          </button>
+        </li>
+      </ul>
+    </div>
+
+    <div class="remark">{{$i18n.t('hotspot.text_content')}}</div>
+    <div class="textarea-wrapper">
+      <!-- <textarea
+        v-model.trim="text"
+        maxlength="200"
+        placeholder="请输入文字内容,限200字"
+        type="text"
+      /> -->
+      <editor
+        ref="editor"
+        :html="hotspot.imageTextInfo.text"
+        :placeholder="$i18n.t('hotspot.text_placeholder')"
+        :maxlength="200"
+        @change="onEditorChange"
+      />
+      <span class="count">{{textLength}}/200</span>
+    </div>
+
+    <div class="switcher-wrap">
+    <span class="remark">{{$i18n.t('hotspot.apply_to_all')}}</span>
+      <Switcher
+        :value="hotspot.imageTextInfo.isApplyToAll"
+        @change="onSwitcherChange"
+      />
+    </div>
+    
+    <div class="remark">{{$i18n.t('hotspot.add_audio')}}</div>
+    <button class="add-btn" v-if="!hotspot.imageTextInfo.audio.id" @click="isShowAudioSelect = true">
+      <i class="iconfont icon-editor_add"></i>
+      {{$i18n.t('hotspot.add_audio')}}
+    </button>
+    <template v-else>
+      <div class="music-display" @click.self="onClickCurrentMusic">
+        <Audio ref="my-audio" class="audio-control" :backgroundColor="'#1A1B1D'" :myAudioUrl="hotspot.imageTextInfo.audio.ossPath"></Audio>
+        <div class="name" v-title="hotspot.imageTextInfo.audio.name" @click="onClickCurrentMusic">{{hotspot.imageTextInfo.audio.name}}</div>
+        <i class="iconfont icon-editor_list_delete" @click.stop="hotspot.imageTextInfo.audio = {}"></i>
+      </div>
+      <button class="change-btn" @click="isShowImageSelect = true">
+        <i class="iconfont icon-editor_update"></i>
+      {{$i18n.t('hotspot.change_audio')}}
+        
+      </button>
+    </template>
+
+    <div class="dialog" style="z-index: 2000" v-if="isShowImageSelect">
+      <MaterialSelector
+        :title="$i18n.t('hotspot.select_image')"
+        @cancle="isShowImageSelect = false"
+        @submit="onImageSelected"
+        :selectableType="['image']"
+        :isMultiSelection="true"
+      />
+    </div>
+
+    <div class="dialog" style="z-index: 2000" v-if="isShowAudioSelect">
+      <MaterialSelector
+        :title="$i18n.t('hotspot.select_audio')"
+        @cancle="isShowAudioSelect = false"
+        @submit="onAudioSelected"
+        :selectableType="['audio']"
+        initialMaterialType="audio"
+      />
+    </div>
+
+  </div>
+</template>
+
+<script>
+import { mapGetters } from "vuex";
+
+import MaterialSelector from "@/components/materialSelector.vue";
+import Editor from "@/components/shared/Editor"
+import Switcher from "@/components/shared/Switcher.vue";
+import Audio from "@/components/audio/audioButton.vue";
+
+export default {
+  components:{
+    MaterialSelector,
+    Editor,
+    Switcher,
+    Audio,
+  },
+  data(){
+    return {
+      isShowImageSelect: false,
+      textLength: 0,
+      isShowAudioSelect: false,
+    }
+  },
+  computed: {
+    ...mapGetters({
+      hotspot: 'hotspot',
+    }),
+  },
+  methods:{
+    del(item){
+      let index = this.hotspot.imageTextInfo.imageList.findIndex(i => i.id === item.id)
+      ~index && this.hotspot.imageTextInfo.imageList.splice(index, 1)
+    },
+    onImageSelected(data) {
+      this.hotspot.imageTextInfo.imageList = this.hotspot.imageTextInfo.imageList.concat(data)
+      this.isShowImageSelect = false
+    },
+    onEditorChange(content) {
+      this.textLength = content.textLength
+    },
+    onSwitcherChange(v) {
+      this.hotspot.imageTextInfo.isApplyToAll = v
+    },
+    onClickCurrentMusic() {
+      if (this.$refs['my-audio']) {
+        this.$refs['my-audio'].switchPlayPause()
+      }
+    },
+    onAudioSelected(data){
+      console.log('sadf', data);
+      this.hotspot.imageTextInfo.audio = {...data[0]}
+      this.isShowAudioSelect = false
+    },
+  },
+  watch: {
+    'hotspot.imageTextInfo.imageList': {
+      handler(newVal) {
+        if (newVal.length > 20) {
+          return this.$alert({ content: this.$i18n.t('hotspot.img_size') });
+        }
+      }
+    },
+  }
+}
+</script>
+
+<style lang="less" scoped>
+.image-text-effect-setting {
+  .remark {
+    margin-top: 16px;
+    font-size: 14px;
+    color: #ababab;
+  }
+    
+  > .image-list-wrap {
+    min-height: 242px;
+    background: #1A1B1D;
+    border-radius: 2px;
+    border: 1px solid #404040;
+    position: relative;
+    padding: 8px;
+    > .add-btn {
+      top: 50%;
+      left: 50%;
+      transform: translate(-50%, -50%);
+      position: absolute;
+      background: none;
+      border: none;
+      color: @color;
+      cursor: pointer;
+      > img {
+        width: 30px;
+      }
+      > .name {
+        margin-top: 6px;
+        font-size: 14px;
+      }
+      > .tip {
+        margin-top: 4px;
+        font-size: 12px;
+        color: #FFFFFF;
+        opacity: 0.2;
+      }
+    }
+    > .image-list {
+      margin-right: -4px;
+      margin-bottom: -8px;
+      > .add-btn {
+        background: none;
+        border-radius: 2px;
+        border: 2px solid #0076F6;
+        color: @color;
+        cursor: pointer;
+        display: inline-block;
+        width: 67px;
+        height: 67px;
+        margin-right: 4px;
+        margin-bottom: 8px;
+        position: relative;
+        vertical-align: bottom;
+        > .inner-wrap {
+          position: absolute;
+          top: 50%;
+          left: 50%;
+          transform: translate(-50%, -50%);
+          > img {
+            width: 18px;
+          }
+          > div {
+            margin-top: 4px;
+            font-size: 12px;
+          }
+        }
+      }
+      > li {
+        display: inline-block;
+        width: 67px;
+        height: 67px;
+        margin-right: 4px;
+        margin-bottom: 8px;
+        position: relative;
+        > .thumb {
+          width: 100%;
+          height: 100%;
+          object-fit: cover;
+          border-radius: 2px;
+        }
+        > .delete-btn {
+          position: absolute;
+          top: 0;
+          right: 0;
+          width: 20px;
+          height: 20px;
+          background: none;
+          border: none;
+          padding: 0;
+          cursor: pointer;
+          &:hover {
+            .normal {
+              display: none;
+            }
+            .hover {
+              display: initial;
+            }
+          }
+          > .normal {
+            display: initial;
+            width: 100%;
+            height: 100%;
+          }
+          > .hover {
+            display: none;
+            width: 100%;
+            height: 100%;
+          }
+        }
+      }
+    }
+  }
+
+  .textarea-wrapper {
+    margin-top: 16px;
+    position: relative;
+    border: 1px solid rgba(151, 151, 151, 0.2);
+    background: #1A1B1D;
+    border-radius: 2px;
+    height: 200px;
+    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);
+    }
+  }
+
+  > .switcher-wrap {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    margin-top: 16px;
+    .remark {
+      margin-top: initial;
+    }
+  }
+
+  > .add-btn {
+    margin-top: 16px;
+    width: 100%;
+    height: 40px;
+    background: #1A1B1D;
+    border-radius: 2px;
+    border: 1px solid #404040;
+    display: block;
+    color: #0076F6;
+    font-size: 14px;
+    cursor: pointer;
+    &:hover {
+      border-color: @color;
+    }
+    i {
+      font-size: 14px;
+    }
+  }
+  > .music-display {
+    cursor: pointer;
+    margin-top: 16px;
+    width: 100%;
+    height: 40px;
+    background: #1A1B1D;
+    border-radius: 2px;
+    border: 1px solid #404040;
+    color: #fff;
+    text-align: center;
+    font-size: 14px;
+    position: relative;
+    &:hover {
+      color: #0076F6;
+      border-color: @color;
+      > .audio-control {
+        display: inline-block;
+      }
+      > i {
+        display: inline-block;
+      }
+    }
+    > .audio-control {
+      position: absolute;
+      top: 50%;
+      transform: translateY(-50%);
+      left: 18px;
+      display: none;
+    }
+    > .name {
+      position: absolute;
+      left: 50%;
+      top: 50%;
+      transform: translate(-50%, -50%);
+      width: 65%;
+      text-overflow: ellipsis;
+      overflow: hidden;
+      white-space: nowrap;
+      display: inline-block;
+    }
+    > i {
+      display: none;
+      position: absolute;
+      top: 50%;
+      transform: translateY(-50%);
+      right: 18px;
+      &:hover {
+        color: #FA5555;
+      }
+    }
+  }
+  > .change-btn {
+    margin-top: 16px;
+    width: 100%;
+    height: 40px;
+    background: #1A1B1D;
+    border-radius: 2px;
+    border: 1px solid #404040;
+    display: block;
+    color: #0076F6;
+    font-size: 14px;
+    cursor: pointer;
+    &:hover {
+      border-color: @color;
+    }
+    i {
+      font-size: 14px;
+    }
+  }
+}
+</style>

+ 1 - 1
packages/qjkankan-editor/src/views/hotspot/hotspotTypeList.js

@@ -46,7 +46,7 @@ export default [
   {
     icon: require('@/assets/images/icons/hotspot-type/image-text.png'),
     name: i18n.t('hotspot.image_text'),
-    id: 'imgText',
+    id: 'imageText',
     isExperience: true,
   },
   {