btxtgxq-system-city/src/main/resources/static/route/news/save_daily.html
2023-11-04 18:58:24 +08:00

152 lines
6.4 KiB
HTML
Executable File

<!doctype html>
<html lang="en">
<head>
<base href="/servicecity/">
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11,chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-row">
<div class="layui-col-md12 layui-col-xs12">
<div class="layui-form-item">
<label class="layui-form-label">标题</label>
<div class="layui-input-block">
<input type="text" id="newsTitle" name="newsTitle" autocomplete="off"
class="layui-input" value="" placeholder="请填写标题" maxlength="255" lay-verify="required">
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md6 layui-col-xs6">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">类别名称</label>
<div class="layui-input-block">
<input type="text" id="newsTypeName" name="newsTypeName" autocomplete="off"
class="layui-input" value="" placeholder="类别名称" maxlength="255" readonly="readonly" lay-verify="required">
</div>
</div>
</div>
<div class="layui-col-md6 layui-col-xs6">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">发布时间</label>
<div class="layui-input-block">
<input type="text" id="newsTime" name="newsTime" autocomplete="off" style="cursor: pointer"
class="layui-input" value="" placeholder="点击选择发布时间" readonly="readonly" lay-verify="required">
</div>
</div>
</div>
<div class="layui-col-md12 layui-col-xs12" style="width: 100%">
<script id="newsContent" name="newsContent" type="text/plain"></script>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">保存</button>
<button type="button" class="layui-btn layui-btn-primary close">取消</button>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
<script src="assets/js/vendor/ueditor/ueditor.config.js"></script>
<script src="assets/js/vendor/ueditor/ueditor.all.js"></script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script type="text/javascript">
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'form', 'laydate', 'laytpl'], function() {
var $ = layui.$;
var $win = $(window);
var form = layui.form;
var admin = layui.admin;
var laydate = layui.laydate;
var laytpl = layui.laytpl;
var newsType = top.restAjax.params(window.location.href).newsType;
var editor = null;
// 初始化信息类型
function initNewsType() {
top.restAjax.get(top.restAjax.path('api/dict/getdict/{newsType}', [newsType]), {}, null, function(code, data) {
$('#newsTypeName').val(data.dictName);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
initNewsType();
function initDate(){
laydate.render({
elem: '#newsTime'
})
}
initDate();
// 初始化文富文本
function initContentRichText() {
editor = UE.getEditor('newsContent', {autoHeightEnabled: false});
editor.ready(function() {
editor.setHeight($win.height() - 370);
});
}
setTimeout(function(){
initContentRichText();
},200);
form.on('submit(submitForm)', function(formData) {
var loadLayerIndex;
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
formData.field['newsType'] = newsType;
top.restAjax.post(top.restAjax.path('api/news/savenews', []), formData.field, null, function (code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function () {
top.dialog.close(layerIndex);
window.location.reload();
},
btn2: function () {
closeBox();
}
});
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(loadLayerIndex);
});
});
})
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
$('.close').on('click', function() {
closeBox();
});
});
</script>
</body>
</html>