From 399a115e33dfb070bb74540bad0ca66f799d53a7 Mon Sep 17 00:00:00 2001
From: luofl <1442745593@qq.com>
Date: 星期四, 03 四月 2025 15:19:53 +0800
Subject: [PATCH] 1
---
cloud-server-management/src/main/webapp/static/modular/system/advertisement/advertisement.js | 232 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 209 insertions(+), 23 deletions(-)
diff --git a/cloud-server-management/src/main/webapp/static/modular/system/advertisement/advertisement.js b/cloud-server-management/src/main/webapp/static/modular/system/advertisement/advertisement.js
index d2bf4f0..d042a33 100644
--- a/cloud-server-management/src/main/webapp/static/modular/system/advertisement/advertisement.js
+++ b/cloud-server-management/src/main/webapp/static/modular/system/advertisement/advertisement.js
@@ -21,10 +21,10 @@
TSite.initColumn = function () {
return [
{field: 'selectItem', checkbox: true},
- {title: '主键ID', field: 'id', visible: false, align: 'center', valign: 'middle'},
+ {title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'},
{title: '广告类型', field: 'position', visible: true, align: 'center', valign: 'middle',width:'20%',
formatter:function (data) {
- return {1:"首页banner",2:"线上课得积分",3:"看视频得奖励",4:"常见问题"}[data]
+ return {1:"首页banner",2:"线上课得积分",3:"看视频得奖励",4:"常见问题",6:"社区世界杯顶部",7:"社区世界杯底部"}[data]
}
},
{title: '广告名称', field: 'name', visible: true, align: 'center', valign: 'middle'},
@@ -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,11 +130,39 @@
TSite.openAddTSite = function () {
var index = layer.open({
type: 2,
- title: "添加场地",
+ title: "添加广告",
area: ['100%', '100%'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/advertisement/add'
+ });
+ this.layerIndex = index;
+};
+/**
+ * 跳转基础页面配置
+ */
+TSite.basic = function () {
+ var index = layer.open({
+ type: 2,
+ title: "基础页面配置",
+ area: ['100%', '100%'], //宽高
+ fix: false, //不固定
+ maxmin: true,
+ content: Feng.ctxPath + '/advertisement/config'
+ });
+ this.layerIndex = index;
+};
+/**
+ * 跳转福利页面配置
+ */
+TSite.benefits = function () {
+ var index = layer.open({
+ type: 2,
+ title: "福利页面配置",
+ area: ['100%', '100%'], //宽高
+ fix: false, //不固定
+ maxmin: true,
+ content: Feng.ctxPath + '/advertisement/benefits'
});
this.layerIndex = index;
};
@@ -171,7 +199,7 @@
if (this.check()) {
var index = layer.open({
type: 2,
- title: "编辑场地",
+ title: "编辑广告",
area: ['100%', '100%'], //宽高
fix: false, //不固定
maxmin: true,
@@ -207,29 +235,69 @@
ajax.set("province",province);
ajax.start();
};
-
+TSite.addConfig = function(){
+ $("#cover1").val();
+ $("#cover2").val();
+ $("#cover7").val();
+ var ajax = new $ax(Feng.ctxPath + "/advertisement/updateConfig", function (data) {
+ Feng.success("基础页面设置成功")
+ });
+ ajax.set("p1",$("#cover1").val())
+ ajax.set("p2",$("#cover2").val())
+ ajax.set("p7",$("#cover7").val())
+ ajax.start();
+}
+TSite.addBenefits = function(){
+ $("#cover3").val();
+ $("#cover4").val();
+ $("#cover5").val();
+ $("#cover6").val();
+ var ajax = new $ax(Feng.ctxPath + "/advertisement/updateBenefits", function (data) {
+ Feng.success("基础页面设置成功")
+ });
+ ajax.set("p3",$("#cover3").val())
+ ajax.set("p4",$("#cover4").val())
+ ajax.set("p5",$("#cover5").val())
+ ajax.set("p6",$("#cover6").val())
+ ajax.start();
+}
TSite.addSubmit = function(){
var data1 = {
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 +311,27 @@
return;
}
}
- if($("#page").val()=='' ){
- Feng.info("请选择跳转页面")
- return;
- }
- if ( $("#roleType").val()==1) {
- if ($("#type").val() == '') {
- Feng.info("请选择跳转类型")
+ if(name !='0'){
+ if($("#page").val()=='' ){
+ Feng.info("请选择跳转页面")
return;
}
}
- if ( $("#roleType").val()==1) {
- if ($('#type option:selected').text()=="详情"){
- if($("#pageId").val()=='' ){
- Feng.info("请输入跳转ID")
+ console.log("====pagepagepage==============="+$("#page").val())
+ if(name !='0'){
+ if ($("#type").val() == ''&&$("#page").val()!=2&&$("#page").val()!=25&&$("#page").val()!=27&&$("#page").val()!=37&&$("#page").val()!=28) {
+ Feng.info("请选择跳转类型")
return;
+ }
+
+ }
+ if(name !='0') {
+ if ($("#roleType").val() == 1) {
+ if ($('#type option:selected').text() == "详情"&&$('#type option:selected').text() == "指定商品"&&$('#type option:selected').text() == "指定折扣") {
+ if ($("#pageId").val() == '') {
+ Feng.info("请输入跳转ID")
+ return;
+ }
}
}
}
@@ -271,8 +345,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() == ''&&$("#page").val()!=2&&$("#page").val()!=25&&$("#page").val()!=27&&$("#page").val()!=37&&$("#page").val()!=28) {
+ Feng.info("请选择跳转类型")
+ return;
+ }
+ }
+ }
+ if(name !='0') {
+ if ($("#roleType").val() == 1) {
+ if ($('#type option:selected').text() == "详情"&&$('#type option:selected').text() == "指定商品"&&$('#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 : "下架失败!";
@@ -305,8 +475,24 @@
}
$(function () {
+ var carPhoto1 = new $WebUpload("cover1");
+ carPhoto1.setUploadBarId("progressBar");
+ carPhoto1.init();
+
+ var carPhoto2 = new $WebUpload("cover2");
+ carPhoto2.setUploadBarId("progressBar");
+ carPhoto2.init();
+
+ var carPhoto7 = new $WebUpload("cover7");
+ carPhoto7.setUploadBarId("progressBar");
+ carPhoto7.init();
+ var carPhoto = new $WebUpload("img");
+ carPhoto.setUploadBarId("progressBar");
+ carPhoto.init();
+
var defaultColunms = TSite.initColumn();
var table = new BSTable(TSite.id, "/advertisement/listAll", defaultColunms);
table.setPaginationType("client");
TSite.table = table.init();
+
});
--
Gitblit v1.7.1