44323
2023-09-23 753145b81710f934c28b29a1feb376ce79d4a965
cloud-server-management/src/main/webapp/static/modular/system/advertisement/advertisement.js
@@ -36,7 +36,7 @@
        },
        {title: '跳转模块', field: 'model', visible: true, align: 'center', valign: 'middle',
        },
        {title: '跳转页面', field: 'jumpPage', visible: true, align: 'center', valign: 'middle',
        {title: '跳转页面', field: 'page', visible: true, align: 'center', valign: 'middle',
        },
        {title: '排序', field: 'sort', visible: true, align: 'center', valign: 'middle',
        },
@@ -130,7 +130,7 @@
TSite.openAddTSite = function () {
    var index = layer.open({
        type: 2,
        title: "添加场地",
        title: "添加广告",
        area: ['100%', '100%'], //宽高
        fix: false, //不固定
        maxmin: true,
@@ -171,7 +171,7 @@
    if (this.check()) {
        var index = layer.open({
            type: 2,
            title: "编辑场地",
            title: "编辑广告",
            area: ['100%', '100%'], //宽高
            fix: false, //不固定
            maxmin: true,
@@ -214,22 +214,37 @@
        id:null,
        position:null,
        img:"",
        jumpPage:"",
        jumpPage:null,
        sort:null,
        state:1,
        name:"",
        type:""
        type:"",
        page:"",
        model:null,
        typeId:null,
        turnId:null,
    };
    let name  =  $("#model").val();
    data1.name = $("#name").val();
    data1.position = $("#position").val();
    data1.img = $("#img").val();
    data1.model = $('#model option:selected').text();
    data1.page =  $('#page option:selected').text();
    data1.jumpPage = $("#page").val();
    data1.typeId = $("#type").val();
    data1.type = $('#type option:selected').text();
    data1.turnId = $("#pageId").val();
    data1.sort = $("#sort").val();
    if ( $("#roleType").val()==1){
        if($("#position").val()==''){
            data1.position = $("#position").val();
            Feng.info("请选择广告类型")
            return;
        }
    }
    if($("#name").val()==''){
        Feng.info("请输入广告名称")
        return;
    }
@@ -243,21 +258,27 @@
            return;
        }
    }
    if(name !='0'){
    if($("#page").val()=='' ){
        Feng.info("请选择跳转页面")
        return;
    }
    }
    if(name !='0') {
    if ( $("#roleType").val()==1) {
        if ($("#type").val() == '') {
            Feng.info("请选择跳转类型")
            return;
        }
    }
    }
    if(name !='0') {
    if ( $("#roleType").val()==1) {
        if ($('#type option:selected').text()=="详情"){
            if($("#pageId").val()=='' ){
                Feng.info("请输入跳转ID")
                return;
                }
            }
        }
    }
@@ -271,8 +292,104 @@
        contentType: "application/json", // 设置请求头的 Content-Type
        data: JSON.stringify(data1), // 将数据转换为 JSON 字符串
        success: function(response) {
            Feng.success("下架成功!");
            TSite.search();
            window.parent.TSite.table.refresh();
            TSite.close();
            Feng.success("添加成功!");
        },
        error: function(xhr, status, error) {
            var errorMessage = xhr.responseText ? xhr.responseText : "下架失败!";
            Feng.error("您的网络异常!");
        }
    });
};
TSite.updateSubmit = function(){
    console.log("kankan")
    console.log($("#img").val())
    var data1 = {
        id:null,
        position:null,
        img:"",
        jumpPage:null,
        sort:null,
        state:1,
        name:"",
        type:"",
        page:"",
        model:null,
        typeId:null,
        turnId:null,
    };
    let name  =  $("#model").val();
    data1.name = $("#name").val();
    data1.id = $("#id").val();
    data1.position = $("#position").val();
    data1.img = $("#img").val();
    data1.model = $('#model option:selected').text();
    data1.page =  $('#page option:selected').text();
    data1.jumpPage = $("#page").val();
    data1.typeId = $("#type").val();
    data1.type = $('#type option:selected').text();
    data1.turnId = $("#pageId").val();
    data1.sort = $("#sort").val();
    if ( $("#roleType").val()==1){
        if($("#position").val()==''){
            data1.position = $("#position").val();
            Feng.info("请选择广告类型")
            return;
        }
    }
    if($("#name").val()==''){
        Feng.info("请输入广告名称")
        return;
    }
    if ( $("#roleType").val()==1) {
        if ($("#model").val() == '') {
            Feng.info("请选择跳转模块")
            return;
        }
    }
    if(name !='0'){
        if($("#page").val()=='' ){
            Feng.info("请选择跳转页面")
            return;
        }
    }
    if(name !='0') {
        if ($("#roleType").val() == 1) {
            if ($("#type").val() == '') {
                Feng.info("请选择跳转类型")
                return;
            }
        }
    }
    if(name !='0') {
        if ($("#roleType").val() == 1) {
            if ($('#type option:selected').text() == "详情") {
                if ($("#pageId").val() == '') {
                    Feng.info("请输入跳转ID")
                    return;
                }
            }
        }
    }
    if($("#sort").val()=='' ){
        Feng.info("请输入排序")
        return;
    }
    $.ajax({
        url: Feng.ctxPath + "/advertisement/updateAdvertisement",
        type: "POST",
        contentType: "application/json", // 设置请求头的 Content-Type
        data: JSON.stringify(data1), // 将数据转换为 JSON 字符串
        success: function(response) {
            window.parent.TSite.table.refresh();
            TSite.close();
            Feng.success("添加成功!");
        },
        error: function(xhr, status, error) {
            var errorMessage = xhr.responseText ? xhr.responseText : "下架失败!";
@@ -309,4 +426,7 @@
    var table = new BSTable(TSite.id, "/advertisement/listAll", defaultColunms);
    table.setPaginationType("client");
    TSite.table = table.init();
    var carPhoto = new $WebUpload("img");
    carPhoto.setUploadBarId("progressBar");
    carPhoto.init();
});