浏览代码

编辑器-热点-热点编辑界面:不可提交时完成按钮置灰,不需要那些“表单填写不合规则”的提示了。

任一存 2 年之前
父节点
当前提交
e0cbb93ff4
共有 1 个文件被更改,包括 28 次插入21 次删除
  1. 28 21
      packages/qjkankan-editor/src/views/hotspot/EditPanel.vue

+ 28 - 21
packages/qjkankan-editor/src/views/hotspot/EditPanel.vue

@@ -50,7 +50,7 @@
       </div>
       <div class="ui-between footer" app-border dir-top>
         <button class="ui-button deepcancel" :class="{ disable: false }" @click="cancel">{{$i18n.t('hotspot.cancel')}}</button>
-        <button class="ui-button submit" :class="{ disable: false }" @click="save">{{$i18n.t('hotspot.finish')}}</button>
+        <button class="ui-button submit" :class="{ disable: !canSubmit }" @click="save">{{$i18n.t('hotspot.finish')}}</button>
       </div>
     </div>
   </transition>
@@ -235,6 +235,33 @@ export default {
       let tmp = this.hotspot.hotspotType
       return () => import(`./hotspotType/${tmp}.vue`);
     },
+    canSubmit() {
+      let { img, hotspotTitle, hotspotType } = this.hotspot
+      let item = HTMap[hotspotType]
+
+      if (!img) {
+        // return this.$alert({
+        //   content: this.$i18n.t('hotspot.select_hotspot_icon'),
+        // });
+        return false
+      }
+
+      if (!(hotspotTitle.trim()/* && (hotspotTitle.trim() != this.$i18n.t('hotspot.click_to_comfirm'))*/)) {
+        // return this.$alert({
+        //   content: this.$i18n.t('hotspot.input_hotspot_title'),
+        // });
+        return false
+      }
+
+      if (!this.hotspot[item.key] || (item.type == 'Array' && this.hotspot[item.key].length <= 0)) {
+        // return this.$alert({
+        //   content: `${item.errortxt}`,
+        // });
+        return false
+      }
+
+      return true
+    }
   },
   mounted() {
     this.selectItem = {
@@ -339,26 +366,6 @@ export default {
       this.$getKrpano().set(`hotspot[${data.name}].url`, data.img)
     },
     save() {
-      let { img, hotspotTitle, hotspotType } = this.hotspot
-      let item = HTMap[hotspotType]
-
-      if (!img) {
-        return this.$alert({
-          content: this.$i18n.t('hotspot.select_hotspot_icon'),
-        });
-      }
-
-      if (!(hotspotTitle.trim() && (hotspotTitle.trim() != '单击确定热点位置'&&hotspotTitle.trim() != this.$i18n.t('hotspot.click_to_comfirm')))) {
-        return this.$alert({
-          content: this.$i18n.t('hotspot.input_hotspot_title'),
-        });
-      }
-
-      if (!this.hotspot[item.key] || (item.type == 'Array' && this.hotspot[item.key].length <= 0)) {
-        return this.$alert({
-          content: `${item.errortxt}`,
-        });
-      }
       this.$store.commit("SetHotspot", this.hotspot);
       this.$emit("close");
       this.$emit("save", this.hotspot);