You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
201 lines
7.9 KiB
201 lines
7.9 KiB
1 month ago
|
<!DOCTYPE html>
|
||
|
<html lang="zh-cn">
|
||
|
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<!--#include file="/widget/head.html"-->
|
||
|
<!--#include file="/widget/email-tail.html"-->
|
||
|
<style>
|
||
|
.layui-table-cell {
|
||
|
height: auto;
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body class="layui-layout-body" layadmin-themealias="default">
|
||
|
<div id="wrapper">
|
||
|
<!-- Navigation -->
|
||
|
<!--#include file="/widget/nav.html"-->
|
||
|
<div id="page-wrapper" class="layui-body layadmin-tabsbody-item layui-show layui-fluid layui-row layui-col-space15">
|
||
|
<div class="layui-card" id="card-page-wrapper">
|
||
|
<div class="row">
|
||
|
<div class="col-lg-12">
|
||
|
<h2 class="page-header">公告背景图</h2>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div style="width:1400px;">
|
||
|
<div role="tabpanel" class="tab-pane" id="send">
|
||
|
<div class="layui-form">
|
||
|
|
||
|
<div class="layui-form-item layui-inline" style="width:300px;">
|
||
|
<div class="layui-inline" style="width:100px;">
|
||
|
<button class="layui-btn" type="button" onclick="opennotice(0)">添加背景图</button>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div id="Datatab" style="width:1000px;"></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<script id="btn" type="text/template">
|
||
|
|
||
|
<input type="button" class="layui-btn layui-btn-xs" value="编辑" onclick="opennotice({{d.id}})" />
|
||
|
<input type="button" class="layui-btn layui-btn-xs" value="删除" style="background-color: red;" onclick="delnotice({{d.id}})" />
|
||
|
|
||
|
{{# if(d.state==2){}}
|
||
|
<input type="button" class="layui-btn layui-btn-xs" style="background-color:red;" value="开启" onclick="upstate({{d.id}},1)" />
|
||
|
{{# }else{}}
|
||
|
<input type="button" class="layui-btn layui-btn-xs" style="background-color:green;" value="关闭" onclick="upstate({{d.id}},2)" />
|
||
|
{{# } }}
|
||
|
</script>
|
||
|
<script id="picimgtemp" type="text/template">
|
||
|
<div style="width:100px;height:100px;">
|
||
|
<img style="width:auto; height:100px;cursor:pointer; " src="{{d.pic}}" onclick="openimg(this);" />
|
||
|
</div>
|
||
|
</script>
|
||
|
<script id="iconimgtemp" type="text/template">
|
||
|
<div style="width:100px;height:100px;">
|
||
|
<img style="width: auto; height: 100px;" src="{{d.icon}}" />
|
||
|
</div>
|
||
|
</script>
|
||
|
<script>
|
||
|
function upstate(id,state) {
|
||
|
$.get(Page.SvrIp + "/api/update_notice_backgrounds_state", {
|
||
|
token: cookie.get("token"),
|
||
|
id: id,
|
||
|
state: state
|
||
|
}, function (data) {
|
||
|
if (data.ret == 1) {
|
||
|
alert(data.msg);
|
||
|
location.reload();
|
||
|
}
|
||
|
alert(data.msg);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function openimg(t) {
|
||
|
var src = $(t).attr("src");
|
||
|
|
||
|
layer.open({
|
||
|
content: " <img style='width: auto;max-width:1800px; height: 450px;' src=" + src + " />",
|
||
|
type: 1,
|
||
|
title: false,
|
||
|
shade: false,
|
||
|
closeBtn: 2,
|
||
|
area: ['auto', '450px']
|
||
|
});
|
||
|
$(".layui-layer.layui-layer-page,.layui-layer-content").css("background-color", "transparent");
|
||
|
}
|
||
|
function delnotice(id, text) {
|
||
|
if (confirm("确定删除《" + id + "》背景图吗?")) {
|
||
|
$.get(Page.SvrIp +"/api/del_notice_backgrounds", {
|
||
|
token: cookie.get("token"),
|
||
|
id: id
|
||
|
}, function (data) {
|
||
|
if (data.ret == 1) {
|
||
|
alert(data.msg);
|
||
|
location.reload();
|
||
|
}
|
||
|
alert(data.msg);
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
function opennotice(id) {
|
||
|
|
||
|
layer.open({
|
||
|
content: `/pages/EditNoticeimg.html?id=${id}`,
|
||
|
type: 2,
|
||
|
title: id==0?"添加": "修改",
|
||
|
area: ['850px', '670px']
|
||
|
});
|
||
|
}
|
||
|
|
||
|
$(function () {
|
||
|
var _d = new Date();
|
||
|
layui.laydate.render({
|
||
|
elem: '#stadate',
|
||
|
value: _d.getFullYear() + "-" + (_d.getMonth() + 1) + "-" + _d.getDate()
|
||
|
});
|
||
|
layui.laydate.render({
|
||
|
elem: '#enddate',
|
||
|
value: _d.getFullYear() + "-" + (_d.getMonth() + 1) + "-" + _d.getDate()
|
||
|
});
|
||
|
$("#query").click(function () {
|
||
|
tableIns.reload({
|
||
|
where: {
|
||
|
token: cookie.get("token"),
|
||
|
startDate: $("#stadate").val(),
|
||
|
endDate: $("#enddate").val()
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
var tableIns = layui.table.render({
|
||
|
elem: '#Datatab'
|
||
|
, url: Page.SvrIp +'/api/select_notice_backgrounds' //数据接口
|
||
|
, where: {
|
||
|
token: cookie.get("token")
|
||
|
}
|
||
|
, page: true
|
||
|
, cols: [[
|
||
|
{ field: 'id', title: 'id', width: 90 },
|
||
|
{field: 'pic', title: '图片', width: 180, templet: function (d) {
|
||
|
return '<img style="width: auto; height: 100px; " src="' + d.pic+'" />';
|
||
|
} },
|
||
|
{ field: 'language', title: '语言', width: 90 },
|
||
|
{ field: 'state', title: '状态', width: 90 },
|
||
|
{
|
||
|
field: 'startTime', title: '开始时间', width: 180, templet: function (d) {
|
||
|
return d.startTime == "0001-01-01 00:00:00" ? "不限制" : d.startTime;
|
||
|
} },
|
||
|
{
|
||
|
field: 'endTime', title: '结束时间', width: 180, templet: function (d) {
|
||
|
return d.endTime == "9999-12-31 23:59:59" ? "不限制" : d.endTime;
|
||
|
}
|
||
|
},
|
||
|
, {
|
||
|
field: 'triggertype', title: '触发时间', width: 90, templet: function (d) {
|
||
|
var valstr = "";
|
||
|
|
||
|
switch (d.valid) {
|
||
|
case -1:
|
||
|
valstr = "未开始";
|
||
|
break;
|
||
|
case 0:
|
||
|
valstr = "有效期内";
|
||
|
break;
|
||
|
case 1:
|
||
|
valstr = "<label style='color: red;'>已过期</label>";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
return valstr;
|
||
|
}
|
||
|
},
|
||
|
{ field: '*', title: '编辑', width: 220, templet: "#btn" }
|
||
|
]]
|
||
|
, parseData: function (res) { //res 即为原始返回的数据
|
||
|
if (res.ret == 1) {
|
||
|
location.href = "/pages/login.html";
|
||
|
}
|
||
|
for (var i in res.sysdata) {
|
||
|
var d = res.sysdata[i];
|
||
|
d.issys = 1;
|
||
|
res.data.push(d);
|
||
|
}
|
||
|
return {
|
||
|
"code": res.ret, //解析接口状态
|
||
|
"msg": res.msg, //解析提示文本
|
||
|
"count": res.count, //解析数据长度
|
||
|
"data": res.data //解析数据列表
|
||
|
};
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
</script>
|
||
|
|
||
|
</body>
|
||
|
</html>
|