Helius
2021-06-16 5728be2af515b2200e782aa201ca5d4d67d9ea47
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
layui.define([ 'form', 'laydate', 'table'], function(exports) {
    var form = layui.form;
    var index = layui.index;
    var view = {
            init:function(){
                Lib.initGenrealForm($("#addForm"),form);
                this.initSubmit();
            },
            initSubmit:function(){
                $("#addButton").click(function(){
                    if($("#picName").val().length === 0){
                        Common.info("名字不能为空");
                        return false;
                    }
                    if($("#picUrl").attr('dt').length === 0){
                        Common.info("需要上传图片");
                        return false;
                    }
                    if($("#picPath").val().length === 0){
                        Common.info("需要添加链接");
                        return false;
                    }
 
                    Common.post("/admin/setting/banner/insertBanner.json",{
                        "picName":$("#picName").val(),
                        "picUrl":$("#picUrl").attr('dt'),
                        "picPath":$("#picPath").val(),
                        "sort":$("#sort").val()
                    },function(){
                        parent.window.dataReload();
                        Common.info("添加成功");
                        Lib.closeFrame();
                    });
                });
                
                $("#addButton-cancel").click(function(){
                    Lib.closeFrame();
                });
            }
                
    }
     exports('add',view);
    
});