105 lines
3.1 KiB
HTML
105 lines
3.1 KiB
HTML
{extend name="common/base"/}
|
|
{block name="style"}
|
|
<style type="text/css">
|
|
.editormd-code-toolbar select {
|
|
display: inline-block
|
|
}
|
|
|
|
.editormd li {
|
|
list-style: inherit;
|
|
}
|
|
.layui-td-gray{
|
|
width: 110px;
|
|
}
|
|
</style>
|
|
{/block}
|
|
<!-- 主体 -->
|
|
{block name="body"}
|
|
<form class="layui-form p-4">
|
|
<h3 class="pb-3">添加</h3>
|
|
<table class="layui-table layui-table-form">
|
|
|
|
<tr>
|
|
<td class="layui-td-gray">标题<font>*</font></td>
|
|
<td colspan="7">
|
|
<input type="text" name="title" lay-verify="required" lay-reqText="请输入标题"
|
|
autocomplete="off" placeholder="请输入标题" class="layui-input">
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="layui-td-gray">文章内容<font>*</font></td>
|
|
<td colspan="6">
|
|
<textarea class="layui-textarea" id="container_content" name="content"></textarea>
|
|
</td>
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
<td class="layui-td-gray">发表时间<font>*</font></td>
|
|
<td colspan="7">
|
|
<input type="text" name="start_time" id="formDate" lay-verify="required"
|
|
autocomplete="off" placeholder="请输入时间" class="layui-input" lay-key="1">
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="layui-td-gray">结束时间<font>*</font></td>
|
|
<td colspan="7">
|
|
<input type="text" name="end_time" id="formDate" lay-verify="required"
|
|
autocomplete="off" placeholder="请输入时间" class="layui-input" lay-key="1">
|
|
</td>
|
|
</tr>
|
|
|
|
|
|
</table>
|
|
<div class="pt-3">
|
|
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
|
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
</div>
|
|
</form>
|
|
{/block}
|
|
<!-- /主体 -->
|
|
|
|
<!-- 脚本 -->
|
|
{block name="script"}
|
|
<script>
|
|
const editorType = '{$editor}';
|
|
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
|
|
|
|
function gouguInit() {
|
|
var form = layui.form, tool = layui.tool,laydate = layui.laydate;
|
|
var editor = layui.tinymce;
|
|
var edit = editor.render({
|
|
selector: "#container_content",
|
|
height: 500
|
|
});
|
|
//监听提交
|
|
form.on('submit(webform)', function (data) {
|
|
data.field.content = tinyMCE.editors['container_content'].getContent();
|
|
if (data.field.content == '') {
|
|
layer.msg('请先完善文章内容');
|
|
return false;
|
|
}
|
|
let callback = function (e) {
|
|
layer.msg(e.msg);
|
|
if (e.code == 0) {
|
|
setTimeout(function () {
|
|
parent.location.reload();
|
|
}, 1000);
|
|
}
|
|
}
|
|
tool.post('/admin/nk.party.vote/add', data.field, callback);
|
|
return false;
|
|
});
|
|
//日期选择
|
|
laydate.render({
|
|
elem: '#formDate',
|
|
max: 7,
|
|
showBottom: false
|
|
});
|
|
|
|
}
|
|
</script>
|
|
{/block}
|
|
<!-- /脚本 --> |