Explorar el Código

编辑器-热点-添加或编辑热点:删除冗余代码

(cherry picked from commit 629e6da0cb08844f6529eecab0bda8e1e098708a)
任一存 hace 3 años
padre
commit
7ff05ab2b8

+ 2 - 52
packages/qjkankan-editor/src/views/hotspot/hotspotType/audio.vue

@@ -30,8 +30,6 @@
 </template>
 
 <script>
-import { getMaterialList} from "@/api";
-import { changeByteUnit } from '@/utils/file'
 import MaterialSelectorForEditor from "@/components/materialSelectorForEditor.vue";
 import Audio from "@/components/audio/audioForEditor.vue";
 
@@ -44,17 +42,8 @@ export default {
   },
   data() {
     return {
-      type:'audio',
-      tAudio:{...this.audio},
-      isShowSelect:false,
-      list:[],
-      paging: {
-        pageSize: 8,
-        pageNum: 1,
-        total: 0,
-        showSize: 4,
-        current: 1
-      },
+      tAudio: {...this.audio},
+      isShowSelect: false,
     }
   },
   methods:{
@@ -68,52 +57,13 @@ export default {
     },
     selectHandle(){
       this.isShowSelect = true 
-      this.getMaterialList()
-    },
-    changeCurrent(data){
-      this.paging.pageNum = data;
-    },
-    update(data) {
-      this.key = data;
-      this.getMaterialList();
     },
     handleSelect(data){
       this.tAudio = {...data[0]}
       this.isShowSelect = false
-      console.log(this.tAudio);
-    },
-    getMaterialList() {
-      getMaterialList(
-        {
-          pageNum: this.paging.pageNum,
-          pageSize: this.paging.pageSize,
-          searchKey: this.key,
-          type:this.type
-        },
-        (data) => {
-          this.list = [];
-          setTimeout(() => {
-            this.paging.pageNum = data.data.pageNum;
-            this.paging.pageSize = data.data.pageSize;
-            this.paging.total = data.data.total;
-            this.list = data.data.list.map(i=>{
-              i.fileSize = changeByteUnit(Number(i.fileSize))
-              return i
-            })
-          })
-        }
-      );
     },
   },
   watch:{
-    "paging.pageNum": function () {
-      this.isShowSelect && this.getMaterialList();
-    },
-    isShowSelect(newVal){
-      if (!newVal) {
-        this.paging.pageNum = 1
-      }
-    },
     tAudio(newVal){
       this.$emit('audioChange',newVal)
     }

+ 8 - 53
packages/qjkankan-editor/src/views/hotspot/hotspotType/image.vue

@@ -29,6 +29,7 @@
         @cancle="isShowSelect = false"
         @submit="handleSelect"
         :selectableType="['image']"
+        :isMultiSelection="true"
       />
     </div>
 
@@ -36,8 +37,6 @@
 </template>
 
 <script>
-import { getMaterialList} from "@/api";
-import { changeByteUnit } from '@/utils/file'
 import MaterialSelectorForEditor from "@/components/materialSelectorForEditor.vue";
 
 export default {
@@ -47,17 +46,8 @@ export default {
   props:['image'],
   data(){
     return {
-      type:'image',
-      images:[...this.image],
-      isShowSelect:false,
-      list:[],
-      paging: {
-        pageSize: 8,
-        pageNum: 1,
-        total: 0,
-        showSize: 4,
-        current: 1
-      },
+      images: [...this.image],
+      isShowSelect: false,
     }
   },
   methods:{
@@ -65,52 +55,17 @@ export default {
       let index = this.images.findIndex(i => i.id === item.id)
       ~index && this.images.splice(index, 1)
     },
-    selectHandle(){
+    selectHandle() {
       this.isShowSelect = true 
-      this.getMaterialList()
     },
-    changeCurrent(data){
-      this.paging.pageNum = data;
-    },
-    update(data) {
-      this.key = data;
-      this.getMaterialList();
-    },
-    handleSelect(data){
+    handleSelect(data) {
       this.images = this.images.concat(data)
       this.isShowSelect = false
     },
-    getMaterialList() {
-      getMaterialList(
-        {
-          pageNum: this.paging.pageNum,
-          pageSize: this.paging.pageSize,
-          searchKey: this.key,
-          type:this.type
-        },
-        (data) => {
-          this.paging.pageNum = data.data.pageNum;
-          this.paging.pageSize = data.data.pageSize;
-          this.paging.total = data.data.total;
-          this.list = data.data.list.map(i=>{
-            i.fileSize = changeByteUnit(Number(i.fileSize))
-            return i
-          })
-        }
-      );
-    },
   },
-  watch:{
-    "paging.pageNum": function () {
-      this.isShowSelect && this.getMaterialList();
-    },
-    isShowSelect(newVal){
-      if (!newVal) {
-        this.paging.pageNum = 1
-      }
-    },
-    images(newVal){
-      if (newVal.length>20) {
+  watch: {
+    images(newVal) {
+      if (newVal.length > 20) {
         return this.$alert({ content: "最多添加20张图片" });
       }
       this.$emit('imageChange',newVal)

+ 0 - 34
packages/qjkankan-editor/src/views/hotspot/hotspotType/style.less

@@ -1,34 +0,0 @@
-.medias {
-  height: 105px; 
-  width: 210px;
-  position: relative;
-  background: #161A1A;
-  border: 1px solid #555A5A;
-  overflow: hidden;
-  .btn-push{
-      position: absolute;
-      top: 50%;
-      left: 50%;
-      transform: translate(-50%,-50%);
-      text-align: center;
-      font-size: 12px;
-      width: 100%;
-      height: 100%;
-      >span{
-        position: absolute;
-        top: 50%;
-        left: 50%;
-        transform: translate(-50%,-50%);
-      }
-  }
-}
-
-.dialog {
-  position: fixed;
-  z-index: 30;
-  left: 0;
-  top: 0;
-  width: 100%;
-  height: 100%;
-  background-color: rgba(0, 0, 0, 0.5);
-}

+ 15 - 63
packages/qjkankan-editor/src/views/hotspot/hotspotType/video.vue

@@ -35,82 +35,34 @@
 </template>
 
 <script>
-import { getMaterialList} from "@/api";
-import { changeByteUnit } from '@/utils/file'
-import MaterialSelectorForEditor from "@/components/materialSelectorForEditor.vue";
+import MaterialSelectorForEditor from "@/components/materialSelectorForEditor.vue"
 
 export default {
-  components:{
+  components: {
     MaterialSelectorForEditor,
   },
-  props:['video'],
-  data(){
+  props: ['video'],
+  data() {
     return {
-      type:'video',
-      tVideo:{...this.video},
-      isShowSelect:false,
-      list:[],
-      paging: {
-        pageSize: 8,
-        pageNum: 1,
-        total: 0,
-        showSize: 4,
-        current: 1
-      },
+      tVideo: { ...this.video },
+      isShowSelect: false,
     }
   },
-  methods:{
-    del(){
+  methods: {
+    del() {
       this.tVideo = ''
     },
-    selectHandle(){
-      this.isShowSelect = true 
-      this.getMaterialList()
+    selectHandle() {
+      this.isShowSelect = true
     },
-    changeCurrent(data){
-      this.paging.pageNum = data;
-    },
-    update(data) {
-      this.key = data;
-      this.getMaterialList();
-    },
-    handleSelect(data){
-      this.tVideo = {...data[0]}
+    handleSelect(data) {
+      this.tVideo = { ...data[0] }
       this.isShowSelect = false
     },
-    getMaterialList() {
-      getMaterialList(
-        {
-          pageNum: this.paging.pageNum,
-          pageSize: this.paging.pageSize,
-          searchKey: this.key,
-          type:this.type
-        },
-        (data) => {
-          this.paging.pageNum = data.data.pageNum;
-          this.paging.pageSize = data.data.pageSize;
-          this.paging.total = data.data.total;
-       
-          this.list =data.data.list.map(i=>{
-            i.icon = i.ossPath+this.$videoImg
-            i.fileSize = changeByteUnit(Number(i.fileSize))
-            return i
-          })
-        }
-      );
-    },
   },
-  watch:{
-    "paging.pageNum": function () {
-      this.isShowSelect && this.getMaterialList();
-    },
-    isShowSelect(newVal){
-      if (!newVal) {
-        this.paging.pageNum = 1
-      }
-    },
-    tVideo(newVal){
-      this.$emit('videoChange',newVal)
+  watch: {
+    tVideo(newVal) {
+      this.$emit('videoChange', newVal)
     }
   }
 }