From 387f61d55a8e20bc772b026cba4f8c34dfce5665 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期三, 07 二月 2024 11:20:28 +0800 Subject: [PATCH] 更新代码 --- ManagementIGOTravel/guns-admin/src/main/webapp/static/modular/system/tAdvertisement/tAdvertisement_info.js | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 237 insertions(+), 1 deletions(-) diff --git a/ManagementIGOTravel/guns-admin/src/main/webapp/static/modular/system/tAdvertisement/tAdvertisement_info.js b/ManagementIGOTravel/guns-admin/src/main/webapp/static/modular/system/tAdvertisement/tAdvertisement_info.js index b2109a2..b1c0a76 100644 --- a/ManagementIGOTravel/guns-admin/src/main/webapp/static/modular/system/tAdvertisement/tAdvertisement_info.js +++ b/ManagementIGOTravel/guns-admin/src/main/webapp/static/modular/system/tAdvertisement/tAdvertisement_info.js @@ -19,7 +19,7 @@ } } }, - provinceCode: { + cityId: { validators: { notEmpty: { message: '请先选择所属城市' @@ -65,6 +65,28 @@ */ TAdvertisementInfoDlg.clearData = function() { this.tAdvertisementInfoData = {}; +} +TAdvertisementInfoDlg.toSelectUserOpt = function() { + var index = layer.open({ + type: 2, + title: '选择用户', + area: ['90%', '80%'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/tAdvertisement/user' + }); + this.layerIndex = index; +} +TAdvertisementInfoDlg.toSelectUserOpt1 = function() { + var index = layer.open({ + type: 2, + title: '选择司机', + area: ['90%', '80%'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/tAdvertisement/driver' + }); + this.layerIndex = index; } /** @@ -127,10 +149,28 @@ if(!this.validate()){ return ; } + var isJump = $('#isJump').val(); var imgUrl = $("#imgUrl").valueOf(); if ("" == imgUrl){ Feng.info("请上传广告图图片"); return; + } + if(1 == isJump){ + var jumpType = $('#jumpType').val(); + if('' == jumpType){ + Feng.info("请选择跳转类型"); + return; + } + var jumpUrl = $('#jumpUrl').val(); + if(1 == jumpType && '' == jumpUrl){ + Feng.info("请输入外部跳转链接"); + return; + } + var editor = TAdvertisementInfoDlg.editor.getContent(); + if(2 == jumpType && ('' == editor || typeof editor == "undefined")){ + Feng.info("请输入内部跳转内容"); + return; + } } //提交信息 var ajax = new $ax(Feng.ctxPath + "/tAdvertisement/add", function(data){ @@ -141,6 +181,131 @@ Feng.error("添加失败!" + data.responseJSON.message + "!"); }); ajax.set(this.tAdvertisementInfoData); + ajax.start(); +} +TAdvertisementInfoDlg.addSubmit1 = function() { + this.clearData(); + this.collectData(); + var name = $("#name").val(); + var editor = TAdvertisementInfoDlg.editor.getContent(); + if ("" == name){ + Feng.info("请输入广告标题"); + return; + } + if ("" == editor){ + Feng.info("请输入发送内容"); + return; + } + var subArr=[]; + $(".timeClass").each(function () { + subArr.push({ + userId:$(this).find("input[name*='userId']").val(), + }) + }); + var subArr1=[]; + $(".timeClass1").each(function () { + subArr1.push({ + //companyName,nickName,phone + userId:$(this).find("input[name*='userId']").val(), + }) + }); + var sendType = $("input[name='sendType']:checked").val(); + var sendType1 = $("input[name='sendType1']:checked").val(); + console.log(sendType) + console.log(sendType1) + if(null == sendType && null == sendType1){ + Feng.error("请选择发送对象"); + return; + } + if(null != sendType && sendType==2 && subArr.length <= 0){ + Feng.error("请选择用户"); + return; + } + if(null != sendType1 && sendType1==2 && subArr1.length <= 0){ + Feng.error("请选择司机"); + return; + } + if(null == sendType){ + subArr = null; + } + if(null == sendType1){ + subArr1 = null; + } + console.log(subArr) + console.log(subArr1) + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/tAdvertisement/addInfo", function(data){ + Feng.success("添加成功!"); + window.parent.TAdvertisement.table.refresh(); + TAdvertisementInfoDlg.close(); + },function(data){ + Feng.error("添加失败!" + data.responseJSON.message + "!"); + }); + ajax.set("userId", null == subArr ? '' : JSON.stringify(subArr)) + ajax.set("driverId", null == subArr1 ? '' : JSON.stringify(subArr1)) + ajax.set("name",name) + ajax.set("content",editor) + ajax.start(); +} +TAdvertisementInfoDlg.addSubmit2 = function() { + this.clearData(); + this.collectData(); + var name = $("#name").val(); + var editor = TAdvertisementInfoDlg.editor.getContent(); + if ("" == name){ + Feng.info("请输入通知标题"); + return; + } + if ("" == editor){ + Feng.info("请输入发送内容"); + return; + } + var subArr=[]; + $(".timeClass").each(function () { + subArr.push({ + userId:$(this).find("input[name*='userId']").val(), + }) + }); + var subArr1=[]; + $(".timeClass1").each(function () { + subArr1.push({ + //companyName,nickName,phone + userId:$(this).find("input[name*='userId']").val(), + }) + }); + var sendType = $("input[name='sendType']:checked").val(); + var sendType1 = $("input[name='sendType1']:checked").val(); + console.log(sendType) + if(null == sendType && null == sendType1){ + Feng.error("请选择发送对象"); + return; + } + if(null != sendType && sendType==2 && subArr.length <= 0){ + Feng.error("请选择用户"); + return; + } + if(null != sendType1 && sendType1==2 && subArr1.length <= 0){ + Feng.error("请选择司机"); + return; + } + if(null == sendType){ + subArr = null; + } + if(null == sendType1){ + subArr1 = null; + } + //提交信息 + var ajax = new $ax(Feng.ctxPath + "/tAdvertisement/addInfo1", function(data){ + Feng.success("添加成功!"); + window.parent.TAdvertisement.table.refresh(); + TAdvertisementInfoDlg.close(); + },function(data){ + Feng.error("添加失败!" + data.responseJSON.message + "!"); + }); + ajax.set("userId", null == subArr ? '' : JSON.stringify(subArr)) + ajax.set("driverId", null == subArr1 ? '' : JSON.stringify(subArr1)) + ajax.set("name",name) + ajax.set("content",editor) ajax.start(); } @@ -154,11 +319,30 @@ if(!this.validate()){ return ; } + var isJump = $('#isJump').val(); var imgUrl = $("#imgUrl").valueOf(); if ("" == imgUrl){ Feng.info("请上传广告图图片"); return; } + if(1 == isJump){ + var jumpType = $('#jumpType').val(); + if('' == jumpType){ + Feng.info("请选择跳转类型"); + return; + } + var jumpUrl = $('#jumpUrl').val(); + if(1 == jumpType && '' == jumpUrl){ + Feng.info("请输入外部跳转链接"); + return; + } + var editor = TAdvertisementInfoDlg.editor.getContent(); + if(2 == jumpType && ('' == editor || typeof editor == "undefined")){ + Feng.info("请输入内部跳转内容"); + return; + } + } + //提交信息 var ajax = new $ax(Feng.ctxPath + "/tAdvertisement/update", function(data){ Feng.success("修改成功!"); @@ -207,4 +391,56 @@ $("#internalDiv").hide(); $("#externalDiv").hide(); } + } + TAdvertisementInfoDlg.selecUserOpt1=function(id,companyName,nickName,phone){ + //获取所有的值 + var subArr=[]; + $(".timeClass").each(function () { + subArr.push({ + userId:$(this).find("input[name*='userId']").val(), + }) + }); + for(var i=0;i<subArr.length;i++){ + var userId = subArr[i].userId; + if (userId == id) { + Feng.info("用户已选择,请重新选择"); + return; + } + } + console.log(subArr); + var str = '<tr class="timeClass">' + + '<td><input type="hidden" id="userId" name="userId" value="'+id+'"><input type="hidden" id="nickName" name="nickName" value="'+nickName+'">' + nickName + '</td>' + + '<td><input type="hidden" id="phone" name="phone" value="'+phone+'">' + phone + '</td>' + + '<td><input type="hidden" id="companyName" name="companyName" value="'+companyName+'">' + companyName + '</td><td><button onclick="deleteSub1(this)">移除</button></td></tr>'; + $("#coun").append(str); + } +function deleteSub1(e) { + $(e).parent().parent().remove(); +} +TAdvertisementInfoDlg.selecUserOpt2=function(id,companyName,nickName,phone){ + //获取所有的值 + var subArr1=[]; + $(".timeClass1").each(function () { + subArr1.push({ + userId:$(this).find("input[name*='userId']").val(), + }) + }); + for(var i=0;i<subArr1.length;i++){ + var userId = subArr1[i].userId; + if (userId == id) { + Feng.info("用户已选择,请重新选择"); + return; + } + } + console.log(subArr1); + var str = '<tr class="timeClass1">' + + '<td><input type="hidden" id="userId" name="userId" value="'+id+'"><input type="hidden" id="nickName" name="nickName" value="'+nickName+'">' + nickName + '</td>' + + '<td><input type="hidden" id="phone" name="phone" value="'+phone+'">' + phone + '</td>' + + '<td><input type="hidden" id="companyName" name="companyName" value="'+companyName+'">' + companyName + '</td><td><button onclick="deleteSub2(this)">移除</button></td></tr>'; + $("#coun1").append(str); +} +function deleteSub2(e) { + $(e).parent().parent().remove(); +} + -- Gitblit v1.7.1