<html lang="zh-cn">
|
|
<head>
|
<meta charset="utf-8">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<title>修改TOP通知</title>
|
<link href="css/bootstrap.min.css" rel="stylesheet">
|
<link href="css/maincontent.css" rel="stylesheet">
|
<link href="css/tablestyle.css" rel="stylesheet">
|
<!--[if lt IE 9]>
|
<script src="js/html5shiv.js"></script>
|
<script src="js/respond.min.js"></script>
|
<![endif]-->
|
<style type="text/css">
|
.datediv {
|
display: flex;
|
flex-direction: row;
|
align-items: center;
|
}
|
|
.show {
|
width: 20px;
|
height: 20px;
|
}
|
</style>
|
</head>
|
|
<body>
|
<nav class="navbar navbar-default navbar-fixed-top">
|
</nav>
|
<div id="mainbody">
|
<div id="sidebar">
|
<dl>
|
</dl>
|
</div>
|
<div id="neirong">
|
<div class="erjidh">
|
<ol class="breadcrumb">
|
<li>
|
<a href="shezhi.html">TOP通知栏</a>
|
</li>
|
<li class="active">修改内容</li>
|
</ol>
|
</div>
|
<table class="table">
|
<tbody>
|
<tr>
|
<td>
|
<form class="form-horizontal" role="form">
|
<div class="form-group">
|
<label for="input7" class="changdu1 control-label">内容</label>
|
<div class="col-sm-7">
|
<textarea class="form-control content" rows="4"></textarea>
|
</div>
|
</div>
|
</form>
|
</td>
|
</tr>
|
</tbody>
|
</table>
|
<table class="table">
|
<tbody>
|
<tr>
|
<td>
|
<form class="form-horizontal" role="form">
|
<div class="form-group">
|
<label for="input2" class="changdu1 control-label">跳转链接</label>
|
<div class="col-sm-7">
|
<input type="text" class="form-control url" placeholder="">
|
</div>
|
</div>
|
</form>
|
</td>
|
</tr>
|
</tbody>
|
</table>
|
<table class="table">
|
<tbody>
|
<tr>
|
<td>
|
<form class="form-horizontal" role="form">
|
<div class="form-group">
|
<label for="input2" class="changdu1 control-label">是否显示</label>
|
<div class="col-sm-7">
|
<input type="checkbox" class="show">
|
</div>
|
</div>
|
</form>
|
</td>
|
</tr>
|
</tbody>
|
</table>
|
<table class="table">
|
<tbody>
|
<tr>
|
<td>
|
<form class="form-horizontal" role="form">
|
<div class="form-group datediv">
|
<label for="input2" class="changdu1 control-label">起始日期</label>
|
<div class="col-sm-2">
|
<input type="text" class="form-control begin" placeholder="">
|
</div>
|
<span>至</span>
|
<div class="col-sm-2">
|
<input type="text" class="form-control end" placeholder="">
|
</div>
|
</div>
|
</form>
|
</td>
|
</tr>
|
</tbody>
|
</table>
|
<table class="table">
|
<tbody>
|
<tr>
|
<td>
|
<form class="form-horizontal" role="form">
|
<div class="form-group">
|
<label for="input1" class="changdu1 control-label">备注</label>
|
<div class="col-sm-7">
|
<textarea class="form-control beizhu" rows="7"></textarea>
|
</div>
|
</div>
|
</form>
|
</td>
|
</tr>
|
</tbody>
|
</table>
|
<div class="button0">
|
<div class="button">
|
<button type="button" class="btn btn-primary save">保存</button>
|
</div>
|
<div class="button">
|
<a href="shezhi.html" class="btn btn-default" role="button">取消</a>
|
</div>
|
</div>
|
</div>
|
</div>
|
<script src="js/jquery.min.js"></script>
|
<script src="js/bootstrap.min.js"></script>
|
<script src="js/nav.js"></script>
|
<script src="laydate/laydate.js"></script>
|
<script src="layer/layer.js"></script>
|
<script>
|
var id;
|
$(function() {
|
laydate.render({
|
elem: '.begin'
|
});
|
laydate.render({
|
elem: '.end'
|
});
|
setData();
|
$(".save").bind("click", function() {
|
save();
|
});
|
|
});
|
|
function setData(){
|
id = getArgsFromHref(location.href,"key");
|
$.post("api/homeNotice/getHomeNotice",{"id":id},function(data){
|
if(data.code==0){
|
var homeNotice = data.homeNotice;
|
$(".content").val(homeNotice.content);
|
$(".url").val(homeNotice.url);
|
$(".begin").val(homeNotice.starttime);
|
$(".end").val(homeNotice.endtime);
|
$(".beizhu").val(homeNotice.beizhu);
|
$(".show").attr("checked",homeNotice.show==1?true:false);
|
}else{
|
alert("请求出错");
|
}
|
},'json')
|
}
|
|
function save() {
|
var content = $(".content").val();
|
var url = $(".url").val();
|
var starttime = $(".begin").val();
|
var endtime = $(".end").val();
|
var beizhu = $(".beizhu").val();
|
var show = $(".show")[0].checked ? "1" : "0";
|
$.post("api/homeNotice/updateHomeNotice", { "content": content, "url": url, "show": show, "starttime": starttime, "endtime": endtime, "beizhu": beizhu,"id":id }, function(data) {
|
if(data.code == 0) {
|
layer.alert('保存成功!', {
|
icon: 1,
|
skin: 'layer-ext-seaing',
|
yes: function() {
|
location.href = "shezhi.html";
|
}
|
});
|
} else {
|
layer.alert('保存失败!', {
|
icon: 2,
|
skin: 'layer-ext-seaing'
|
});
|
}
|
}, 'json');
|
}
|
|
function getArgsFromHref(sHref, sArgName) {
|
var args = sHref.split("?");
|
var retval = "";
|
|
if(args[0] == sHref) /*参数为空*/ {
|
return retval; /*无需做任何处理*/
|
}
|
var str = args[1];
|
args = str.split("&");
|
for(var i = 0; i < args.length; i++) {
|
str = args[i];
|
var arg = str.split("=");
|
if(arg.length <= 1) continue;
|
if(arg[0] == sArgName) retval = arg[1];
|
}
|
return retval;
|
}
|
</script>
|
</body>
|
|
</html>
|