From 957a8e8f5a01de49baa837e30492de511bf407e3 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期一, 27 三月 2023 18:10:06 +0800
Subject: [PATCH] 权限配置,基础信息管理

---
 management/guns-admin/src/main/webapp/static/modular/system/tCommercial/tCommercial_info.js |   90 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 88 insertions(+), 2 deletions(-)

diff --git a/management/guns-admin/src/main/webapp/static/modular/system/tCommercial/tCommercial_info.js b/management/guns-admin/src/main/webapp/static/modular/system/tCommercial/tCommercial_info.js
index 6b62b9a..90a2add 100644
--- a/management/guns-admin/src/main/webapp/static/modular/system/tCommercial/tCommercial_info.js
+++ b/management/guns-admin/src/main/webapp/static/modular/system/tCommercial/tCommercial_info.js
@@ -2,7 +2,74 @@
  * 初始化详情对话框
  */
 var TCommercialInfoDlg = {
-    tCommercialInfoData : {}
+    tCommercialInfoData : {},
+    validateFields: {
+        name: {
+            validators: {
+                notEmpty: {
+                    message: '广告图名称不能为空'
+                }
+            }
+        },
+        device: {
+            validators: {
+                notEmpty: {
+                    message: '请选择端口'
+                }
+            }
+        },
+        type: {
+            validators: {
+                notEmpty: {
+                    message: '请选择广告类型'
+                }
+            }
+        },
+        isJump: {
+            validators: {
+                notEmpty: {
+                    message: '请选择是否跳转'
+                }
+            }
+        },
+        jumpType: {
+            validators: {
+                notEmpty: {
+                    message: '请选择跳转类型'
+                }
+            }
+        },
+        jumpUrl: {
+            validators: {
+                notEmpty: {
+                    message: '跳转链接不能为空'
+                }
+            }
+        },
+        sort: {
+            validators: {
+                notEmpty: {
+                    message: '排序不能为空'
+                }
+            }
+        },
+        html: {
+            validators: {
+                notEmpty: {
+                    message: '详情内容不能为空'
+                }
+            }
+        },
+    }
+};
+
+/**
+ * 验证数据是否为空
+ */
+TCommercialInfoDlg.validate = function () {
+    $('#commercialInfoForm').data("bootstrapValidator").resetForm();
+    $('#commercialInfoForm').bootstrapValidator('validate');
+    return $("#commercialInfoForm").data('bootstrapValidator').isValid();
 };
 
 /**
@@ -44,6 +111,9 @@
  * 收集数据
  */
 TCommercialInfoDlg.collectData = function() {
+    if(UE.getEditor('html').hasContents()){
+        $('#html').val(UE.getEditor('html').getContent());
+    }
     this
     .set('id')
     .set('type')
@@ -56,6 +126,7 @@
     .set('html')
     .set('sort')
     .set('status')
+    .set('onOffLine')
     .set('createTime')
     .set('createUserId')
     .set('updateTime')
@@ -69,6 +140,16 @@
 
     this.clearData();
     this.collectData();
+
+    if(!this.validate()){
+        return ;
+    }
+
+    var url = $("#url").val();
+    if ("" == url){
+        Feng.info("请上传广告图图片");
+        return;
+    }
 
     //提交信息
     var ajax = new $ax(Feng.ctxPath + "/tCommercial/add", function(data){
@@ -90,6 +171,10 @@
     this.clearData();
     this.collectData();
 
+    if(!this.validate()){
+        return ;
+    }
+
     //提交信息
     var ajax = new $ax(Feng.ctxPath + "/tCommercial/update", function(data){
         Feng.success("修改成功!");
@@ -103,5 +188,6 @@
 }
 
 $(function() {
-
+    TCommercialInfoDlg.editor = UE.getEditor('html');
+    Feng.initValidator("commercialInfoForm", TCommercialInfoDlg.validateFields);
 });

--
Gitblit v1.7.1