130 lines
4.3 KiB
HTML
130 lines
4.3 KiB
HTML
{extend name="public/base" /}
|
|
|
|
{block name="body"}
|
|
<div class="layui-fluid">
|
|
<div class="layui-row layui-col-space15">
|
|
<div class="layui-col-md12">
|
|
<div class="layui-card">
|
|
<div class="layui-card-body">
|
|
|
|
<div class="layui-form layui-form-pane">
|
|
<div class="layui-tab layui-tab-brief" lay-filter="timeline">
|
|
<div class="layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
|
|
<div class="layui-tab-item layui-show">
|
|
|
|
<div class="layui-row layui-col-space15 layui-form-item">
|
|
<div class="layui-col-md3">
|
|
<label class="layui-form-label">发送类型</label>
|
|
<div class="layui-input-block">
|
|
<select lay-verify="required" name="type" lay-filter="type">
|
|
<option value="0">站内通知</option>
|
|
<option value="1">用户通知</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="layui-col-md9">
|
|
<label for="L_title" class="layui-form-label">标题</label>
|
|
<div class="layui-input-block">
|
|
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" >
|
|
</div>
|
|
</div>
|
|
|
|
<div class="layui-form-item layui-form-text">
|
|
<div class="layui-input-block">
|
|
<textarea id="L_content" name="content" required lay-verify="content" autocomplete="off" class="layui-textarea "></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
{if condition="checkRuleButton('notice/add')"}
|
|
<button type="submit" class="layui-btn " lay-filter="notice-add" lay-submit id="notice-add">立即发布</button>
|
|
{else /}<button type="submit" class="layui-btn layui-btn-disabled">立即发布</button>{/if}
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="layui-form-item">
|
|
<table id="notice-list" lay-filter="notice-list"></table>
|
|
<script type="text/html" id="notice-tool">
|
|
{if condition="checkRuleButton('notice/edit')"}
|
|
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
|
|
{else /}<a class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-edit"></i>编辑</a>{/if}
|
|
{if condition="checkRuleButton('notice/delete')"}
|
|
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
|
|
{else /}<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
|
|
</script>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{/block}
|
|
{block name="js"}
|
|
<script>
|
|
var noticeIndex = "{:url('Notice/index')}",
|
|
noticeAdd = "{:url('Notice/add')}",
|
|
noticeDelete = "{:url('Notice/delete')}",
|
|
noticeEdit = "{:url('Notice/edit')}";
|
|
layui.config({
|
|
base: '/static/admin/' //静态资源所在路径
|
|
}).extend({
|
|
index: 'lib/index' //主入口模块
|
|
}).use(['index','notice', 'layedit','form' ,'table'],function(){
|
|
var $ = layui.jquery
|
|
,layedit = layui.layedit
|
|
,table = layui.table
|
|
,form = layui.form;
|
|
/*
|
|
form.on('select(type)', function(data){
|
|
var tpl = '<div class="layui-col-md12">\
|
|
<label for="L_title" class="layui-form-label">收件人</label>\
|
|
<div class="layui-input-block">\
|
|
<input type="text" id="receve_id" name="receve_id" required lay-verify="required" autocomplete="off" class="layui-input" >\
|
|
</div>\
|
|
</div>';
|
|
//如果选择是用户追加收件人
|
|
if(data.value == 1){
|
|
$(this).parents('div .layui-col-md3').next('div').after(tpl);
|
|
}else{
|
|
$(this).parents('div .layui-col-md3').nextAll('div .layui-col-md12').remove();
|
|
}
|
|
});
|
|
|
|
//发布通知
|
|
form.on('submit(notice-add)', function(data){
|
|
var field = data.field;
|
|
console.log(field);
|
|
$.ajax({
|
|
type:"post",
|
|
url:"{:url('Notice/add')}",
|
|
data:field,
|
|
dataType:"json",
|
|
success:function (data){
|
|
if (data.code == 0) {
|
|
layer.msg(data.msg,{
|
|
icon:6,
|
|
time:2000
|
|
});
|
|
} else {
|
|
layer.open({
|
|
content:data.msg,
|
|
icon:5,
|
|
anim:6
|
|
});
|
|
}
|
|
}
|
|
});
|
|
table.reload('notice-list'); //数据刷新
|
|
return false;
|
|
});
|
|
*/
|
|
|
|
});
|
|
</script>
|
|
{/block} |