Sfoglia il codice sorgente

热点-编辑器-热点设置合法性影响是否禁用完成按钮

任一存 2 anni fa
parent
commit
6399ec79fc
1 ha cambiato i file con 81 aggiunte e 9 eliminazioni
  1. 81 9
      packages/qjkankan-editor/src/views/hotspot/EditPanel.vue

+ 81 - 9
packages/qjkankan-editor/src/views/hotspot/EditPanel.vue

@@ -285,20 +285,92 @@ export default {
       return () => import(`./hotspotType/${tmp}.vue`);
     },
     canSubmit() {
-      let { img, hotspotTitle } = this.hotspot
-
-      if (!img) {
-        return false
+      // 热点类型相关设置项
+      switch (this.hotspot.hotspotType) {
+        case 'scene':
+          if (!this.hotspot.secne) {
+            return false
+          }
+          break;
+        case 'image':
+          if (!this.hotspot.image || this.hotspot.image.length === 0) {
+            return false
+          }
+          break;
+        case 'video':
+          if (!this.hotspot.video) {
+            return false
+          }
+          break;
+        case 'audio':
+          if (!this.hotspot.audio) {
+            return false
+          }
+          break;
+        case 'link':
+          if (!this.hotspot.hyperlink) {
+            return false
+          }
+          break;
+        case 'textarea':
+          if (!this.hotspot.textarea) {
+            return false
+          }
+          break;
+        case 'tag':
+          break;
+        case 'imageText':
+          if (this.hotspot.imageTextInfo.imageList.length === 0 && !this.hotspot.imageTextInfo.text) {
+            return false
+          }
+          break;
+        case 'article':
+          if (!this.hotspot.articleInfo.html) {
+            return false
+          }
+          break;
+        case 'pdf':
+          if (!this.hotspot.pdfInfo.name || !this.hotspot.pdfInfo.url) {
+            return false
+          }
+          break;
+        case 'phone':
+          if (!this.hotspot.phoneInfo.phone) {
+            return false
+          }
+          break;
+        default:
+          break;
       }
 
-      if (!hotspotTitle.trim()) {
-        return false
+      // 热点图标类型相关设置项
+      switch (this.hotspot.hotspotIconType) {
+        case 'system_icon':
+          break;
+        case 'custom_image':
+          if (!this.hotspot.customIconInfo.img) {
+            return false
+          }
+          break;
+        case 'serial_frame':
+          if (!this.hotspot.serialFrameInfo.url || this.hotspot.serialFrameInfo.frameNumber <= 0 || this.hotspot.serialFrameInfo <= 0) {
+            return false
+          }
+          break;
+        case 'personalized_tag':
+          if (this.hotspot.personalizedTagInfo.isTextWrap && this.hotspot.personalizedTagInfo.textNumPerLine <= 0) {
+            return false
+          }
+          break;
+        default:
+          break;
       }
-
-      if (this.hotspot.hotspotType == 'image' && this.hotspot.image.length <= 0) {
+      
+      // 其他设置项
+      if (!this.hotspot.hotspotTitle) {
         return false
       }
-
+      
       return true
     },
     currentHotspotTypeConfigData() {