更新layui库
完成设置Banner和设置活动的页面 redis设置时间为-1时则为永久保存
This commit is contained in:
@@ -1,101 +1,118 @@
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Banner设置</title>
|
||||
</head>
|
||||
<link rel="stylesheet" href="/static/layui/css/layui.css">
|
||||
<script src="/static/layui/layui.all.js"></script>
|
||||
<script src="/static/layui/layui.js"></script>
|
||||
<script src="/static/js/jquery-3.2.1.js"></script>
|
||||
<script src="/static/js/user.js"></script>
|
||||
<body>
|
||||
<table id="banner" lay-filter="banner"></table>
|
||||
</body>
|
||||
<script type="text/html" id="bar">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Banner设置</title>
|
||||
</head>
|
||||
<link rel="stylesheet" href="/static/layui/css/layui.css">
|
||||
<script src="/static/layui/layui.all.js"></script>
|
||||
<script src="/static/layui/layui.js"></script>
|
||||
<script src="/static/js/jquery-3.2.1.js"></script>
|
||||
<script src="/static/js/user.js"></script>
|
||||
|
||||
<body>
|
||||
<table id="banner" lay-filter="banner"></table>
|
||||
</body>
|
||||
<script type="text/html" id="bar">
|
||||
<a class="layui-btn layui-btn-xs" lay-event="url">URL</a>
|
||||
<a class="layui-btn layui-btn-xs" lay-event="click">点击地址</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="state">上/下线</a>
|
||||
</script>
|
||||
<script>
|
||||
layui.use('table', function() {
|
||||
var table = layui.table;
|
||||
table.render({
|
||||
elem: '#banner',
|
||||
height: 312,
|
||||
url: '/android/banner/get.do?all=true',
|
||||
page: false,
|
||||
response: {
|
||||
statusCode: 100
|
||||
<script>
|
||||
layui.use('table', function () {
|
||||
var table = layui.table;
|
||||
table.render({
|
||||
elem: '#banner',
|
||||
height: 312,
|
||||
url: '/android/banner/get.do?all=true',
|
||||
page: false,
|
||||
response: {
|
||||
statusCode: 100
|
||||
},
|
||||
cols: [
|
||||
[{
|
||||
field: 'id',
|
||||
title: 'id',
|
||||
width: 80,
|
||||
sort: true,
|
||||
fixed: 'left'
|
||||
}, {
|
||||
field: 'url',
|
||||
title: '图片链接',
|
||||
width: 300,
|
||||
},
|
||||
cols: [
|
||||
[{
|
||||
field: 'id',
|
||||
title: 'id',
|
||||
width: 80,
|
||||
sort: true,
|
||||
fixed: 'left'
|
||||
}, {
|
||||
field: 'url',
|
||||
title: '图片链接',
|
||||
width: 300,
|
||||
},
|
||||
{
|
||||
field: 'click',
|
||||
title: '跳转地址',
|
||||
width: 300,
|
||||
},
|
||||
{
|
||||
field: 'isshow',
|
||||
title: '是否显示',
|
||||
width: 120,
|
||||
}, {
|
||||
fixed: 'right',
|
||||
width: 200,
|
||||
align: 'center',
|
||||
toolbar: '#bar'
|
||||
}
|
||||
]
|
||||
{
|
||||
field: 'click',
|
||||
title: '跳转地址',
|
||||
width: 300,
|
||||
},
|
||||
{
|
||||
field: 'isshow',
|
||||
title: '是否显示',
|
||||
width: 120,
|
||||
}, {
|
||||
fixed: 'right',
|
||||
width: 200,
|
||||
align: 'center',
|
||||
toolbar: '#bar'
|
||||
}
|
||||
]
|
||||
})
|
||||
table.on('tool(banner)', function(obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'url') {
|
||||
layer.prompt(function(value, index, elem) {
|
||||
layer.close(index);
|
||||
layer.msg(value)
|
||||
active['reload'](this)
|
||||
});
|
||||
} else if (obj.event === 'click') {
|
||||
layer.prompt(function(value, index, elem) {
|
||||
layer.close(index);
|
||||
layer.msg(value)
|
||||
active['reload'](this)
|
||||
});
|
||||
} else if (obj.event == 'state') {
|
||||
layer.prompt(function(value, index, elem) {
|
||||
layer.close(index);
|
||||
layer.msg(value)
|
||||
active['reload'](this)
|
||||
]
|
||||
})
|
||||
table.on('tool(banner)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'url') {
|
||||
layer.prompt(function (value, index, elem) {
|
||||
layer.close(index);
|
||||
console.log(data.state)
|
||||
var that = this;
|
||||
$.post("/admin/magicbox/banner.do", { 'id': data.id, 'url': value, 'click':data.click,'state':data.isshow}, function (data) {
|
||||
var json = JSON.parse(data);
|
||||
layer.alert(json.msg)
|
||||
active['reload'](that)
|
||||
})
|
||||
|
||||
});
|
||||
} else if (obj.event === 'click') {
|
||||
layer.prompt(function (value, index, elem) {
|
||||
layer.close(index);
|
||||
|
||||
var that = this;
|
||||
$.post("/admin/magicbox/banner.do", { 'id': data.id, 'url':data.url,'click': value ,'state':data.isshow}, function (data) {
|
||||
var json = JSON.parse(data);
|
||||
layer.alert(json.msg)
|
||||
active['reload'](that)
|
||||
})
|
||||
});
|
||||
} else if (obj.event == 'state') {
|
||||
layer.prompt(function (value, index, elem) {
|
||||
layer.close(index);
|
||||
|
||||
var that = this;
|
||||
$.post("/admin/magicbox/banner.do", { 'id': data.id,'url': data.url, 'click':data.click, 'state': value }, function (data) {
|
||||
var json = JSON.parse(data);
|
||||
layer.alert(json.msg)
|
||||
active['reload'](that)
|
||||
})
|
||||
});
|
||||
}
|
||||
})
|
||||
var $ = layui.$,
|
||||
active = {
|
||||
reload: function () {
|
||||
//执行重载
|
||||
table.reload('banner', {
|
||||
page: {
|
||||
curr: 1 //重新从第 1 页开始
|
||||
},
|
||||
where: {
|
||||
type: $('#searchType').val(),
|
||||
key: $('#searchKey').val()
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
var $ = layui.$,
|
||||
active = {
|
||||
reload: function() {
|
||||
//执行重载
|
||||
table.reload('banner', {
|
||||
page: {
|
||||
curr: 1 //重新从第 1 页开始
|
||||
},
|
||||
where: {
|
||||
type: $('#searchType').val(),
|
||||
key: $('#searchKey').val()
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
})
|
||||
</script>
|
||||
</html>
|
||||
};
|
||||
})
|
||||
</script>
|
||||
|
||||
</html>
|
||||
@@ -1,58 +1,71 @@
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>盒子倒计时设置</title>
|
||||
</head>
|
||||
<link rel="stylesheet" href="/static/layui/css/layui.css">
|
||||
<script src="/static/layui/layui.all.js"></script>
|
||||
<script src="/static/layui/layui.js"></script>
|
||||
<script src="/static/js/jquery-3.2.1.js"></script>
|
||||
<script src="/static/js/user.js"></script>
|
||||
<body>
|
||||
<form class="layui-form" action="" style="width: 60%;">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">标题</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="title" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>盒子倒计时设置</title>
|
||||
</head>
|
||||
<link rel="stylesheet" href="/static/layui/css/layui.css">
|
||||
<script src="/static/layui/layui.all.js"></script>
|
||||
<script src="/static/layui/layui.js"></script>
|
||||
<script src="/static/js/jquery-3.2.1.js"></script>
|
||||
<script src="/static/js/user.js"></script>
|
||||
|
||||
<body>
|
||||
<form class="layui-form" action="" style="width: 60%;">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">标题</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="title" required lay-verify="required" placeholder="请输入标题" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">开始时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="button" id="start" required lay-verify="required" placeholder="开始时间" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">URL</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="url" required lay-verify="required" placeholder="请输入活动地址" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">结束时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="button" id="end" required lay-verify="required" placeholder="结束时间" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">开始时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="button" id="start" required lay-verify="required" placeholder="开始时间" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-item" style="margin-left: 85%;">
|
||||
<input id="subbutton" type="button" value="提交" class="layui-btn" />
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">结束时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="button" id="end" required lay-verify="required" placeholder="结束时间" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
<script>
|
||||
layui.use('laydate', function() {
|
||||
var laydate = layui.laydate;
|
||||
var form = layui.form;
|
||||
|
||||
laydate.render({
|
||||
elem: '#start' ,
|
||||
type:'datetime',
|
||||
min:0
|
||||
});
|
||||
laydate.render({
|
||||
elem:'#end',
|
||||
type:'datetime',
|
||||
min:0
|
||||
})
|
||||
</div>
|
||||
<div class="layui-form-item" style="margin-left: 85%;">
|
||||
<input id="subbutton" type="button" value="提交" class="layui-btn" />
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
<script>
|
||||
layui.use('laydate', function () {
|
||||
var laydate = layui.laydate;
|
||||
var form = layui.form;
|
||||
|
||||
laydate.render({
|
||||
elem: '#start',
|
||||
type: 'datetime'
|
||||
});
|
||||
$('#subbutton').click(function(event){
|
||||
|
||||
laydate.render({
|
||||
elem: '#end',
|
||||
type: 'datetime',
|
||||
min: 0
|
||||
})
|
||||
});
|
||||
$('#subbutton').click(function (event) {
|
||||
$.post("/admin/magicbox/activity.do", { 'title': $('#title').val(), 'url': $('#url').val(), 'start': $('#start').val(), 'end': $('#end').val() }, function (data) {
|
||||
var json = JSON.parse(data);
|
||||
layer.alert(json.msg)
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</html>
|
||||
</script>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user