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.
 
 
 
 
 
 

356 lines
15 KiB

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<!--#include file="/widget/head.html"-->
<!--#include file="/widget/email-tail.html"-->
<link href="../css/sendEmail.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../js/notice/xm-select.js"></script>
<script type="text/javascript" src="../js/load_realmlist.js"></script>
<style>
#realmlistdiv input { width: 20px !important; height: 20px !important; margin-right: 15px; }
#TimeTypediv input { width: 20px !important; height: 20px !important; margin-right: 15px; }
</style>
</head>
<body class="layui-layout-body" layadmin-themealias="default">
<div id="wrapper">
<!--#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-11">
<h2 class="page-header">跑马灯</h2>
</div>
</div>
<ul class="nav nav-tabs" role="tablist">
<li role="presentation"><a href="#send" role="tab" data-toggle="tab" id="titleSend">已发送</a></li>
<li role="presentation" class="active"><a href="#write" role="tab" data-toggle="tab" id="titleWrite">发送跑马灯</a></li>
</ul>
<div>
<div role="tabpanel" class="tab-pane active" id="write">
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="col-sm-2 control-label">服务器</label>
<div class="col-sm-10" id="realmlistdiv">
<div id="realmlistSelect" style="display: inline-block;width: 300px;margin-left: 20px;"></div>
<div id="realmlistRule" style="display: inline-block;margin-left: 20px;"></div>
<!-- <label>全服 <input type="checkbox" checked="checked" onchange="Oncheck(this);" name="Realm" value="0"></label> -->
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">周期类型</label>
<div id="TimeTypediv">
<label> 具体时间 <input type="radio" checked="checked" name="TimeType" value="1" /></label>
<label> 每天 <input type="radio" name="TimeType" value="2" /></label>
<label> 每周 <input type="radio" name="TimeType" value="3" /></label>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">触发时间</label>
<div class="col-sm-2">
<input type="text" class="form-control zero" id="strTriggerTime" placeholder="">
</div>
</div>
<!--<div class="form-group">
<label class="col-sm-2 control-label">广播开始时间</label>
<div class="col-sm-2">
<input type="text" class="form-control zero" id="startTime" placeholder="">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">广播结束时间</label>
<div class="col-sm-2">
<input type="text" class="form-control zero" id="endTime">
</div>
</div>-->
<div class="form-group">
<label class="col-sm-2 control-label">循环次数</label>
<div class="col-sm-2">
<input type="text" class="form-control zero" id="showCount">
</div>
<label class="col-sm-2 control-label">广播间隔(秒)</label>
<div class="col-sm-2">
<input type="text" class="form-control zero" id="showInterval">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">公告内容</label>
<div class="col-sm-10">
<textarea class="form-control" id="content"></textarea>
</div>
</div>
<div class="form-group">
<div class="layui-input-block">
<button type="button" class="layui-btn col-sm-2" data-toggle="modal" data-target="#myModal" id="btn" >发送</button>
<button type="reset" class="layui-btn layui-btn-danger col-sm-2">清空</button>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">是否确定发送?</h4>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" data-dismiss="modal" onclick="send();" id="sure">确定</button>
</div>
</div>
</div>
</div>
<div id="waite-send">
<div class="ajax-loader"></div>
<!--<div id="text"><span>发送中,请稍后。。。</span></div>-->
</div>
</div>
</div>
</form>
</div>
<div role="tabpanel" class="tab-pane" id="send" style="display:none;">
<div id="sendDatatab"></div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$("#btn").click(function () {
return check();
});
$("#titleSend").click(function () {
$("#write").hide(100);
$("#send").show(100);
tableIns.reload();
});
$("#titleWrite").click(function () {
$("#send").hide(100);
$("#write").show(100);
});
layui.laydate.render({
elem: '#startTime',
type: "datetime"
});
layui.laydate.render({
elem: '#endTime',
type: "datetime"
});
layui.laydate.render({
elem: '#strTriggerTime',
type: "datetime"
});
function Oncheck(i) {
var ti = $(i).val();
console.info(ti);
//默认选中全服
if ($("input[name=Realm]:checked").length == 0) {
$("input[name=Realm][value=0]").prop('checked', true);
return;
}
if (ti == 0) {
if ($("input[name=Realm][value=0]").prop('checked')) {
$("input[name=Realm]:not([value=0])").prop('checked', false);
return;
}
} else {
if ($("input[name=Realm][value=0]").prop('checked')) {
$("input[name=Realm][value=0]").prop('checked', false);
return;
}
}
}
//加载服务器列表
// function Load_realmlist() {
// $.get(Page.SvrIp+"/api/select_realmlist",
// { token: cookie.get("token") }
// , function (d) {
// var html = "";
// for (var i in d.data) {
// var _d = d.data[i];
// html += " <label>" + _d.name + " <input onchange='Oncheck(this);' type='checkbox' name='Realm' value=" + _d.id + "></label>";
// }
// $("#realmlistdiv").append(html);
// });
// }
function check() {
var sneddata = {};
sneddata.content = $("#content").val();
sneddata.showCount = $("#showCount").val();
sneddata.cycleTimeType = $("input[name='TimeType']:checked").val();
sneddata.showInterval = $("#showInterval").val();
sneddata.triggerTime = $("#strTriggerTime").val();
if (!sneddata.content) {
alert("请输入跑马灯内容");
return false;
}
if (!sneddata.showCount) {
alert("请输入循环次数");
return false;
}
if (!sneddata.showInterval) {
alert("请输入广播间隔");
return false;
}
if (!sneddata.triggerTime) {
alert("请输入触发时间");
return false;
}
return true;
}
function send() {
var sneddata = {};
// var _realmlist = realmlistSelect?.getValue('value');
// _realmlist.sort((a, b) => a - b);
// sneddata.realmlist = _realmlist.join(',');
//默认全服跑马灯
sneddata.content = $("#content").val();
sneddata.showCount = $("#showCount").val();
sneddata.cycleTimeType = $("input[name='TimeType']:checked").val();
sneddata.showInterval = $("#showInterval").val();
sneddata.triggerTime = $("#strTriggerTime").val();
sneddata.realmlist = "";
$.ajax({
type: "get",
url: Page.SvrIp+"/api/SysNoticeLamp_send?token=" + cookie.get("token"),
data: sneddata,
dataType: "json",
success: function (d) {
if (d.ret == 0) {
alert("发送成功");
}
},
error: function () {
alert("发送失败");
}
});
}
//var args = initPage('已封');
var tableIns = layui.table.render({
elem: '#sendDatatab'
, url: Page.SvrIp+'/api/SysNoticeLamp_Select' //数据接口
, where: {
token: cookie.get("token")
//startDate: $("#stadate").val(),
//endDate: $("#enddate").val()
}
, page: true
, cols: [[
{ field: 'id', title: 'id', width: 60 },
{ field: 'content', title: '内容', width: 600 },
{ field: 'triggerTime', title: '触发时间', width: 180 },
{
field: 'cycleTimeType', title: '周期类型', width: 120, templet: function (d) {
switch (d.cycleTimeType) {
case "1":
return "具体时间";
break;
case "2":
return "每天";
break;
case "3":
return "每周";
break;
}
}
},
{ field: 'showCount', title: '循环次数', width: 120 },
{ field: 'showInterval', title: '广播间隔<br/>(毫秒)', width: 120 },
{ field: 'realms', title: '服务器', width: 120,templet:function(d){
if(d.realms==""){
return "全服"
}
return d.realms;
} }
]]
, parseData: function (res) { //res 即为原始返回的数据
debugger
if (res.ret == 1) {
location.href = "/pages/login.html";
}
return {
"code": res.code, //解析接口状态
"msg": res.msg, //解析提示文本
"count": res.count, //解析数据长度
"data": res.data //解析数据列表
};
}
});
$(function () {
// Load_realmlist();
Load_realmlist();
$("#query").click(function () {
setuptChartTable_new();
});
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()
});
// var args = initPage('已发送');
});
</script>
<script type="text/x-handlebars-template" id="box">
<div class="panel-heading">
<div class="selectbox pull-right" id="{{chartId}}_datepicker">
<i class="fa fa-calendar"></i>
<span>{{startDate}} {{endDate}}</span> <b class="caret"></b>
</div>
<div class="pull-right btn-group" data-toggle="buttons">
<lable class="btn btn-default active" title="图表模式" name="{{chartId}}_mode_chart">
<input type="radio"><i class="fa fa-bar-chart-o" />
</lable>
<lable class="btn btn-default" title="表格模式" name="{{chartId}}_mode_table">
<input type="radio"><i class="fa fa-table" />
</lable>
</div>
<div>
<!-- Nav tabs -->
<ul class="nav nav-pills multibox-tab">
{{#each tabs}}
<li{{#if @first}} class="active" {{/if}}>
<a href="#{{../chartId}}_tab_{{@index}}" data-toggle="tab" desc="{{this}}">{{this}}</a></li>
{{/each}}
</ul>
</div>
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="flot-chart mtss-chart">
<div class="flot-chart-content" id="{{chartId}}_chartZone"></div>
</div>
</div>
</script>
<link href="../bower_components/select2/select2.min.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../bower_components/select2/select2.min.js"></script>
</body>
</html>