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.
 
 
 
 
 
 

500 lines
27 KiB

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<!--#include file="/widget/head.html"-->
<script type="text/javascript" src="../js/notice/xm-select.js"></script>
<script type="text/javascript" src="../js/load_realmlist.js"></script>
<script type="text/javascript" src="../js/notice/Load_notice.js"></script>
<script type="text/javascript" src="../js/notice/Add_notice.js"></script>
<style>
.layui-form-label {
width: 120px !important;
}
#mdiv .layui-form-item {
margin-bottom: 5px !important;
}
.layui-tab-card > .layui-tab-title {
background-color: #009688 !important;
}
.layui-tab {
padding-left: 100px;
}
#realmlistdiv {
height: 100px;
max-height: 150px;
overflow-y: auto;
}
.label-content{
max-height: 150px;
overflow-y: auto;
}
.label-content::-webkit-scrollbar-thumb {
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
-ms-border-radius: 10px;
border-radius: 10px;
background-color: #C2C2C2;
}
/*定义滚动条轨道 内阴影+圆角*/
.label-content::-webkit-scrollbar-track {
border-radius: 10px;
}
/*定义滚动条高宽及背景*/
.label-content::-webkit-scrollbar {
width: 10px;
}
</style>
</head>
<body>
<div id="wrapper">
<input type="file" id="imgfile" method="post" onchange="ToBase64()" enctype="multipart/form-data" style="display:none;">
<!-- Navigation -->
<form class="layui-form" lay-filter="mform" action="">
<div style="width:100%;height:700px;">
<div style="height:440px;border: solid 1px #a3a3a3;" id="mdiv">
<div style="float:left;width:33%;">
<div class="layui-form-item">
<label class="layui-form-label">公告id</label>
<div class="layui-input-inline" style="width:200px">
<input type="text" name="noticeId" id="noticeId" required lay-verify="required" placeholder="请输入id" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">
排序
</label>
<div class="layui-input-inline">
<input type="text" name="sort" id="sort" required lay-verify="number" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">状态</label>
<div class="layui-input-inline">
<input type="radio" name="state" value="1" title="启用">
<input type="radio" name="state" value="0" title="禁用" checked="checked">
</div>
</div>
<div class="layui-form-item" data-popUp="1" style="display:none;">
<label class="layui-form-label">显示时间文本</label>
<div class="layui-input-inline">
<input type="radio" name="isshowtimetext" value="1" title="显示" checked="checked">
<input type="radio" name="isshowtimetext" value="0" title="不显示">
</div>
</div>
<div class="layui-form-item" data-popUp="0" style="display:none;">
<label class="layui-form-label">登录界面主动弹出</label>
<div class="layui-input-inline">
<input type="radio" name="aotupop" value="1" title="是" checked="checked">
<input type="radio" name="aotupop" value="0" title="否">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">服务器</label>
<div class="layui-tab layui-input-block">
<div id="realmlistSelect" style="width: 300px;margin-left: 20px;"></div>
<div id="realmlistRule" style="display: inline-block;margin-left: 20px;"></div>
</div>
</div>
<div class="layui-form-item" data-popUp="0" style="display:none; ">
<label class="layui-form-label">显示界面</label>
<div class="layui-input-inline">
<select name="type" >
<option value="0">游戏内</option>
<option value="1">主界面</option>
</select>
</div>
</div>
<div class="layui-form-item" style="margin-top:30px">
<label class="layui-form-label">
内容所属页签
</label>
<div class="layui-input-inline" style="width: 300px;">
<select name="pageType" id="pageType">
<option value="1">活动通知</option>
<option value="2">版本更新</option>
<option value="3">问题修复</option>
<option value="4">客诉</option>
</select>
<!-- <input type="text" name="pageType" id="pageType" required lay-verify="number" autocomplete="off" class="layui-input">-->
</div>
</div>
<!--<div class="layui-form-item" style="display:none;">
<label class="layui-form-label">公告类型</label>
<div class="layui-input-inline">
<input type="radio" name="popUp" lay-filter="mform" value="1" title="拍脸图" checked="checked">
<input type="radio" name="popUp" lay-filter="mform" value="0" title="点击弹出公告">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">服务器</label>
<div class="layui-input-block" id="realmlistdiv" style="color:red;">
</div>
<button class="layui-btn layui-bg-red" onclick="selectrealmlist()" type="button">选择服务器</button>
</div>-->
</div>
<div style="float:right;width:33%;">
<!--<div class="layui-form-item">
<label class="layui-form-label">服务器</label>
<div class="layui-input-block" id="realmlistdiv">
<input type="checkbox" value="0" name="realmlist" lay-filter='realmlist' title="全服">
</div>
</div>-->
<div class="layui-form-item" data-id="popUpdiv">
<label class="layui-form-label">触发类型</label>
<div class="layui-input-inline">
<select name="triggertype" lay-filter="triggertype">
<option value="0">固定时间</option>
<option value="1">根据开服时间</option>
<option value="2">定时触发</option>
</select>
</div>
</div>
<div class="layui-form-item" data-trigger="3">
<label class="layui-form-label" style="width:120px;">开始时间</label>
<div class="layui-input-inline" style="width:200px">
<input type="text" name="startTime" id="startTime" value="" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item" data-trigger="0">
<label class="layui-form-label" style="width:120px;">
结束时间
</label>
<div class="layui-input-inline" style="width:200px">
<input type="text" name="endTime" id="endTime" value="" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item" data-trigger="1" style="display:none;">
<label class="layui-form-label" style="width:120px;">开服后<br />多久开始</label>
<input type="text" style="width:40px" name="startTimeDay" value="0" id="startTimeDay" data-id="openserverstartday" autocomplete="off" class="layui-input layui-input-inline">
<span style="width:40px" class="layui-input-inline"></span>
<input type="text" style="width:120px" name="startTimefine" value="00:00:00" id="startTimefine" data-id="openserverstarttime" autocomplete="off" class="layui-input layui-input-inline">
</div>
<div class="layui-form-item" data-trigger="1" style="display:none;">
<label class="layui-form-label" style="width:120px;">
公告持续
</label>
<input style="width:40px" type="text" name="endTimeDay1" value="0" id="endTimeDay1" data-id="openserverendday" autocomplete="off" class="layui-input layui-input-inline">
<span style="width:40px" class="layui-input-inline"></span>
<input type="text" style="width:120px" name="endTimefine" value="00:00:00" id="endTimefine" data-id="openserverendtime" autocomplete="off" class="layui-input layui-input-inline">
</div>
<div class="layui-form-item" data-trigger="1" style="display:none;">
<label class="layui-form-label" style="width:120px;">
公告循环间隔天数(0为不循环)
</label>
<input style="width:40px" type="text" name="Intervaldays1" value="0" id="Intervaldays1" data-id="intervaldays" autocomplete="off" class="layui-input layui-input-inline">
</div>
<div class="layui-form-item" data-trigger="2" style="display:none;">
<label class="layui-form-label" style="width:120px;">
持续天数
</label>
<input style="width:160px" type="text" name="endTimeDay2" value="0" id="endTimeDay2" data-id="openserverendday" autocomplete="off" class="layui-input layui-input-inline">
<span style="width:40px" class="layui-input-inline"></span>
</div>
<div class="layui-form-item" data-trigger="2" style="display:none;">
<label class="layui-form-label" style="width:120px;">
间隔天数(0为不循环)
</label>
<input style="width:160px" type="text" name="Intervaldays2" value="0" id="Intervaldays2" data-id="intervaldays" autocomplete="off" class="layui-input layui-input-inline">
<span style="width:40px" class="layui-input-inline"></span>
</div>
<div class="layui-form-item" data-popUp="1" style="display: none;">
<label class="layui-form-label">
拍脸图模板
</label>
<div class="layui-input-inline" style="width:150px; margin-bottom: 20px;">
<select id="select_popType" lay-filter="select_popType" name="popType">
<option value="0">默认</option>
<option value="1">模板一</option>
<option value="2">黑五专用</option>
</select>
</div>
<div data-popType style="display: none;" id="popType">
<button type="button" class="layui-btn" onclick="addPopType()">
增加文本栏
</button>
<div class="layui-input-inline" style="width:200px">
文本栏1<input type="text" value="" class="layui-input" data-popTypeVal>
</div>
<div class="layui-input-inline" style="width:200px">
文本栏2<input type="text" value="" class="layui-input" data-popTypeVal>
</div>
</div>
</div>
</div>
<div style="float:right;width:33%;">
<div style="border: solid 1px #808080;width: 90%;display: none;" data-popUp="1">
<label>关卡触发 </label>
<div class="layui-form-item" style="display: none;" data-popUp="1">
<label class="layui-form-label">
通关特定关卡 <br /> 0为不启用
</label>
<div class="layui-input-inline">
<input type="text" name="dungeonid" id="dungeonid" value="0" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item" data-popUp="1" style="display: none;">
<label class="layui-form-label">
领取礼包后通关关卡数<br />0为不启用
</label>
<div class="layui-input-inline">
<input type="text" name="giftbagcustoms" id="giftbagcustoms" value="0" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item" data-popUp="1" style="display:none;width:220px;display:inline-block;float:left;">
<label class="layui-form-label">
跳转类型
</label>
<div class="layui-input-inline" style="width:90px;">
<select id="jump" name="jump" lay-filter="select_jump">
<option value="0">请选择</option>
<option value="1">抽卡</option>
<option value="2">商城</option>
<option value="3">活动</option>
<option value="4">巅峰预告</option>
</select>
</div>
</div>
<div class="layui-form-item" style="display:none;" data-jump="0">
<label class="layui-form-label">
UP池ID
</label>
<div class="layui-input-inline" style="width:200px">
<!-- <select id="link" name="link">
<option value="">请选择</option>
</select> -->
<input type="text" name="link" placeholder="请输入UP池ID" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item" style="display: none; width: 400px;" data-jump="1">
<label class="layui-form-label" id="jumpLabel">
跳转id
</label>
<div class="layui-input-inline" style="width:200px;">
<!-- <select id="jumpParam" name="jumpParam">
<option value="0">请选择</option>
</select> -->
<input id="jumpInput" type="text" name="jumpParam" placeholder="请输入跳转id" autocomplete="off" class="layui-input">
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">添加语言</label>
<div class="layui-input-inline" style="width:200px">
<select id="select_language" name="select_language"> </select>
</div>
<button class="layui-btn layui-bg-red layui-btn-sm" onclick="addlanguage()" type="button" style="user-select: initial;">添加语言</button>
</div>
<div class="layui-tab layui-tab-card" lay-allowClose="true" lay-filter="demo">
<ul class="layui-tab-title"></ul>
<div class="layui-tab-content" id="tab-content"></div>
</div>
</div>
<div class="layui-input-inline" style="text-align: center;float: none;margin: 0px auto;display: block;user-select:initial;">
<div class="layui-input-inline">
<button class="layui-btn layui-bg-red" lay-submit lay-filter="formDemo">保存</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</div>
</form>
<script type="text/template" id="languagetemp">
<div class="layui-form-item" data-popUp="0">
<label class="layui-form-label">
标题
</label>
<div class="layui-input-inline" style="width:500px">
<input type="hidden" name="language" data-id="language" value="{{language}}" />
<input type="hidden" name="id" data-id="id" value="{{id}}" />
<input type="text" name="title" style="width:500px" data-id="title" value="{{title}}" placeholder="请输入标题" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-text" data-popUp="0">
<label class="layui-form-label">显示内容</label>
<div class="layui-input-inline" style="width: 550px; height: 300px; ">
<textarea name="content" data-id="content" style="width: 550px; height: 300px;" placeholder="请输入内容" class="layui-textarea">{{content}}</textarea>
</div>
</div>
<div class="layui-form-item" style="display:none;">
<label class="layui-form-label">
图标
</label>
<div class="layui-input-inline" style="width:200px">
<input type="hidden" data-id="icon" name="icon" id="{{language}}_icon" value="{{icon}}" />
<button type="button" class="layui-btn" onclick="selectimg('{{language}}_icon');">
<i class="layui-icon">&#xe67c;</i>
</button>
</div>
<img id="{{language}}_icon_img" style="width:50%;height:auto;max-width:300px;" src="{{icon}}" />
</div>
<div class="layui-form-item" data-popUp="1">
<label class="layui-form-label">
图片
</label>
<div class="layui-input-inline">
<input type="hidden" data-id="pic" id="{{language}}_pic" name="pic" value="{{pic}}"/>
<button type="button" class="layui-btn" onclick="selectimg('{{language}}_pic');" >
<i class="layui-icon">&#xe67c;</i>
</button>
</div>
<img id="{{language}}_pic_img" e style="width: 50%; height: auto; max-width: 300px; " src="{{pic}}" />
</div>
</script>
<script type="text/template" id="selectrealmlist">
<div id='test7' style="height:720px;">
<input type="checkbox" name="realm_0" id="realm_0" value="{{v.id}}" title="{{v.name}}" />
{{each t v k}}
<input type="checkbox" name="realm_{{v.id}}" id="realm_{{v.id}}" value="{{v.id}}" title="{{v.name}}" />
{{/each}}
</div>
<div class="layui-input-inline" style="text-align:center;float: none;margin: 0px auto;display: block;user-select:initial;">
<div class="layui-input-inline">
<button class="layui-btn layui-bg-red" lay-submit lay-filter="formDemo">保存</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</div>
</script>
<script>
///图片转Base64
function ToBase64() {
var img = document.getElementById('imgfile')
var imgFile = new FileReader();
imgFile.readAsDataURL(img.files[0]);
imgFile.onload = function () {
$("#" + imgflieid).val(this.result);
$("#" + imgflieid + "_img").attr("src", this.result);
}
}
function selectimg(id) {
imgflieid = id;
$("#imgfile").click();
}
</script>
<script>
$("*").css("user-select", "initial");
//公告id 0表示新增 非0编辑
var dataid = Page.GetQueryString("id");
//1 拍脸图 0 公告
var popUp = Page.GetQueryString("t");
//加载的公告数据
var noticedata;
$('input:radio[name="popUp"][value="' + popUp + '"]').prop("checked", true);
var imgflieid = "";
function selectrealmlist() {
layer.open({
content: template("selectrealmlist", { t: realmlist }),
type: 1,
title: false,
area: ['1050px', '770px']
});
}
//触发类型 切换
layui.form.on('select(select_popType)', function (data) {
if(data.value == 0) {
$("div[data-popType]").hide(100);
}
else if(data.value == 1) {
$("div[data-popType]").show(100);
}
else if(data.value == 2) {
$("div[data-popType]").hide(100);
}
});
// function get_notice_jumplist(type) {
// $.get(Page.SvrIp + "/api/get_notice_jumplist",
// { token: cookie.get("token"), type }
// , function (d) {
// jumplist = d.data;
// var html = "";
// for (var _i in jumplist) {
// var _d = jumplist[_i];
// html += ` <option value='${_d.id}'>${_d.id}</option>`;
// }
// console.log(d)
// if(type == 1) {
// $('#link').append(html);
// } else $("#jumpParam").append(html);
// layui.form.render('select');
// });
// }
//触发类型 切换
// var firstIn = [true, true, true];
layui.form.on('select(select_jump)', function (data) {
if(data.value == 0) {
$("div[data-jump=0]").hide(100);
$("div[data-jump=1]").hide(100);
return;
}
if(data.value == 4) {
$('#jumpLabel').text('巅峰跳转');
$('#jumpInput').attr('placeholder', '请输入巅峰跳转')
} else {
$('#jumpLabel').text('跳转id');
$('#jumpInput').attr('placeholder', '请输入跳转id')
}
var flag1 = data.value == 1 ? 0 : 1;
var flag2 = data.value == 1 ? 1 : 0;
$(`div[data-jump=${flag1}]`).show(100);
$(`div[data-jump=${flag2}]`).hide(100);
});
layui.form.on('select(triggertype)', function (data) {
$("div[data-trigger=0]").hide(100);
$("div[data-trigger=1]").hide(100);
$("div[data-trigger=2]").hide(100);
$("div[data-trigger=3]").hide(100);
if(data.value == 0 || data.value == 2) {
$(`div[data-trigger=3]`).show(100);
}
if(data.value == 2) {
$("#startTime2").val(Page.formatDate(new Date()));
}
$(`div[data-trigger=${data.value}]`).show(100);
});
function addPopType() {
var length = $('input[data-popTypeVal]').length + 1;
if(length <= 6) {
var html = `<div class="layui-input-inline" style="width:200px">
文本栏${length}<input type="text" value="" class="layui-input" data-popTypeVal>
</div>`
$('#popType').append(html);
} else {
layer.msg('文本栏不能超过6个');
}
}
$(function () {
async function load() {
await Load_realmlist();
await Load_languagelist(Load_noticedata);
await Load_element();
await Sub_notice();
}
load();
});
</script>
</div>
</body>
</html>
<script type="text/javascript" src="../js/template-web.js"></script>