248 lines
11 KiB
HTML
248 lines
11 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>自有人员-用户公告</title>
|
|
<link rel="stylesheet" type="text/css" media="screen" href="../../../../js/jquery/jquery-confirm.css">
|
|
<link rel="stylesheet" type="text/css" media="screen" href="../../../../layui/css/layui.css">
|
|
</head>
|
|
<style>
|
|
p{
|
|
font-size: 1.5em;
|
|
}
|
|
.layui-timeline-axis {
|
|
position: absolute;
|
|
left: -10px;
|
|
top: 0px;
|
|
z-index: 10;
|
|
width: 30px !important;
|
|
height: 32px !important;
|
|
line-height: 32px;
|
|
background-color: rgb(255, 255, 255);
|
|
color: rgb(95, 184, 120);
|
|
text-align: center;
|
|
cursor: pointer;
|
|
border-radius: 50%;
|
|
}
|
|
::-webkit-scrollbar {
|
|
/* !*滚动条整体样式*!*/
|
|
width: 0px;
|
|
/* !*高宽分别对应横竖滚动条的尺寸*!*/
|
|
height: 7px;
|
|
}
|
|
|
|
::-webkit-scrollbar-thumb {
|
|
/* !*滚动条里面小方块*!*/
|
|
border-radius: 10px;
|
|
-webkit-box-shadow: inset 0 0 5px #39658b;
|
|
background: #116A96;
|
|
}
|
|
|
|
::-webkit-scrollbar-track {
|
|
/* !*滚动条里面轨道*!*/
|
|
-webkit-box-shadow: inset 0 0 5px #39658b;
|
|
border-radius: 10px;
|
|
background: #11828B;
|
|
}
|
|
</style>
|
|
<body>
|
|
<button id="add" style="float:right;margin-right: 20px;" onclick="add()" type="button" permission="sys:announcementOwn:add"
|
|
class="layui-btn">添加
|
|
</button>
|
|
<div style="width: 95%;height:95%;margin-top: 50px; " id="group">
|
|
|
|
<div style="width: 16%;height:730px;float: left;overflow-y: scroll" id="title" >
|
|
<ul class="layui-timeline" style="margin-left: 15px;" id="scrolling">
|
|
|
|
</ul>
|
|
</div>
|
|
<div style="width: 3px;height: 730px;border-right: solid #b4b0b0 1px;float: left;margin-left: 50px;" id="line">
|
|
|
|
</div>
|
|
<div style="width: 80%;height:730px;float: right;overflow-y: scroll" id="mainContent">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
</body>
|
|
</html>
|
|
<!--<script type="text/javascript" src="../../../../js/libs/jquery-2.1.1.min.js"></script>-->
|
|
<script type="text/javascript" src="../../../../js/libs/jquery-3.7.1.min.js"></script>
|
|
<script type="text/javascript" src="../../../../js/jq.js"></script>
|
|
<script type="text/javascript" src="../../../../js/my/permission.js"></script>
|
|
<script type="text/javascript" src="../../../../layui/layui.js"></script>
|
|
<script type="text/javascript" src="../../../../js/publicJs.js"></script>
|
|
<script type="text/javascript" src="../../../../js/jquery/jquery-confirm.js"></script>
|
|
<script>
|
|
var username;
|
|
var layer;
|
|
var listLength = 0;
|
|
var idArray;
|
|
var pers = null;
|
|
layui.use(['layer', 'laydate', 'form'], function () {
|
|
layer = layui.layer;
|
|
pers = checkPermission();
|
|
var form = layui.form;
|
|
form.render();
|
|
form.verify();
|
|
});
|
|
var idList = [];
|
|
var titleList = [];
|
|
var contentList = [];
|
|
var timeList = [];
|
|
$(function () {
|
|
idList = [];
|
|
titleList = [];
|
|
contentList = [];
|
|
timeList = [];
|
|
init();
|
|
});
|
|
|
|
function init() {
|
|
$.ajax({
|
|
type: 'POST',
|
|
async: false, // 默认异步true,false表示同步
|
|
url: ctxPath + '/users/getOwnVersionList',// 请求地址
|
|
dataType: 'json', // 服务器返回数据类型
|
|
data: {}, //获取提交的表单字段
|
|
success: function (data) {
|
|
listLength = data.length;
|
|
for (let i = 0; i < data.length; i++) {
|
|
idList.push(data[i].id);
|
|
titleList.push(data[i].version);
|
|
contentList.push(data[i].content);
|
|
timeList.push(data[i].updateTime);
|
|
}
|
|
if (idList.length == 0) {
|
|
document.getElementById("title").style.display = "none";
|
|
document.getElementById("line").style.display = "none";
|
|
document.getElementById("mainContent").style.display = "none";
|
|
} else {
|
|
for (let i = 0; i < idList.length; i++) {
|
|
var html = '';
|
|
html += '<li class="layui-timeline-item">';
|
|
html += ' <i class="layui-icon layui-timeline-axis" id="'+idList[i]+'"></i>';
|
|
html += ' <div class="layui-timeline-content layui-text">';
|
|
html += ' <h2 class="layui-timeline-title" id="h_'+idList[i]+'" style="cursor: pointer;padding: 5px;" onClick="changeContent(\'' + idList[i] + '\')">'+titleList[i]+'</h2>';
|
|
html += ' </div>';
|
|
html += ' </li>';
|
|
|
|
$("#scrolling").append(html);
|
|
document.getElementById(idList[0]).style.color = '#de0e0e';
|
|
document.getElementById('h_'+idList[0]).style.background = '#80808026';
|
|
}
|
|
var html = '';
|
|
html += ' <div style="margin-left: 140px;">';
|
|
html += ' <span style="font-size:2.5rem;font-weight:bold">' + titleList[0] + '</span><br/>';
|
|
html += ' <span style="font-size:1rem;margin-top: 10px;">发布时间:'+timeList[0]+'</span>';
|
|
html += ' <div style="width: 100%;height: 1px;border-top: 1px solid rgb(183 175 175);margin-top: 10px;"></div>';
|
|
//if ((username != null || username !== '') && username === "管理员") {
|
|
html += ' <button id="edit" style = "float:left;margin-right: 20px;margin-top: -7%;margin-left: 40%" onClick="edit(\'' + idList[0] + '\',\'' + titleList[0] + '\',\'' + 0 + '\')" type="button" class="layui-btn" >修改</button>';
|
|
html += ' <button id="del" style = "float:left;margin-right: 20px;margin-top: -7%;margin-left: 47%" onClick="del(\'' + idList[0] + '\')" type="button" class="layui-btn" >删除</button>';
|
|
//}
|
|
html += ' </div>';
|
|
html += ' <div style="text-align: left;margin-left: 140px;margin-top: 10px;">' + contentList[0] + ' </div>';
|
|
$("#mainContent").append(html);
|
|
}
|
|
},
|
|
error: function (XMLHttpRequest, textStatus, e) {
|
|
layer.msg('数据请求发生异常,请稍后重试', {icon: 16, scrollbar: false});
|
|
}
|
|
});
|
|
}
|
|
|
|
function changeEditionVersion(id) {
|
|
$("#mainContent").html('');
|
|
for (let i = 0; i < idList.length; i++) {
|
|
if (id == idList[i]) {
|
|
var html = '';
|
|
html += ' <div style="margin-left: 140px;">';
|
|
html += ' <span style="font-size:2.5rem;font-weight:bold">' + titleList[i] + '</span><br/>';
|
|
html += ' <span style="font-size:1rem;margin-top: 10px;">发布时间:'+timeList[i]+'</span>';
|
|
html += ' <div style="width: 100%;height: 1px;border-top: 1px solid rgb(183 175 175);margin-top: 10px;"></div>';
|
|
// if ((username != null || username !== '') && username === "管理员") {
|
|
html += ' <button id="edit" style = "float:left;margin-right: 20px;margin-top: -7%;margin-left: 40%" onClick="edit(\'' + idList[i] + '\',\'' + titleList[i] + '\',\'' + i + '\')" type="button" class="layui-btn" >修改</button>';
|
|
html += ' <button id="del" style = "float:left;margin-right: 20px;margin-top: -7%;margin-left: 47%" onClick="del(\'' + idList[i] + '\')" type="button" class="layui-btn" >删除</button>';
|
|
// }
|
|
html += ' </div>';
|
|
html += ' <div style="text-align: left;margin-left: 140px;margin-top: 10px;">' + contentList[i] + ' </div>';
|
|
|
|
$("#mainContent").append(html);
|
|
}
|
|
}
|
|
}
|
|
|
|
function add() {
|
|
localStorage.setItem('type',"1");
|
|
var height = '90%';
|
|
var width = '95%';
|
|
let layerIndex = layer.open({
|
|
title: ['添加版本说明', 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
|
type: 2,
|
|
content: 'announcementForm.html',
|
|
area: [width, height],
|
|
maxmin: false
|
|
});
|
|
}
|
|
function edit(id,title,num) {
|
|
localStorage.setItem('type',"2");
|
|
localStorage.setItem('id',id);
|
|
localStorage.setItem('title',title);
|
|
localStorage.setItem('content',contentList[num]);
|
|
var height = '90%';
|
|
var width = '95%';
|
|
let layerIndex = layer.open({
|
|
title: ['修改版本说明', 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
|
type: 2,
|
|
content: 'announcementForm.html',
|
|
area: [width, height],
|
|
maxmin: false
|
|
});
|
|
}
|
|
|
|
|
|
function del(id) {
|
|
$.ajax({
|
|
type: 'POST',
|
|
async: false, // 默认异步true,false表示同步
|
|
url: ctxPath + '/users/delOwn', // 请求地址
|
|
contentType: "application/json; charset=utf-8",
|
|
dataType: 'text', // 服务器返回数据类型
|
|
data: JSON.stringify({'id': id}), //获取提交的表单字段
|
|
success: function (data) {
|
|
data = JSON.parse(data);
|
|
if (data.resMsg == '删除成功') {
|
|
layer.alert(data.resMsg, {icon: 1}, function () {
|
|
let index = layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
|
|
layer.close(index); //再执行关闭
|
|
location.reload();//刷新父页面
|
|
});
|
|
} else {
|
|
layer.alert(data.resMsg, {icon: 2}, function () {
|
|
let index = layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
|
|
layer.close(index); //再执行关闭
|
|
location.reload();//刷新父页面
|
|
});
|
|
}
|
|
},
|
|
error: function (XMLHttpRequest, textStatus, e) {
|
|
layer.msg('数据请求发生异常,请稍后重试', {icon: 16, scrollbar: false});
|
|
}
|
|
});
|
|
}
|
|
|
|
function changeContent(id){
|
|
for (let i = 0; i < idList.length; i++) {
|
|
if (idList[i] === id){
|
|
document.getElementById(idList[i]).style.color = '#de0e0e';
|
|
document.getElementById('h_'+idList[i]).style.background = '#80808026';
|
|
}else {
|
|
document.getElementById(idList[i]).style.color = '#5fb878';
|
|
document.getElementById('h_'+idList[i]).style.background = 'transparent';
|
|
}
|
|
}
|
|
changeEditionVersion(id);
|
|
}
|
|
</script> |