TaoLer/view/admin/notice/index.html

126 lines
4.0 KiB
HTML
Raw Normal View History

2020-03-31 23:01:00 +08:00
{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">
2020-04-02 23:41:48 +08:00
{if condition="checkRuleButton('admin/notice/add')"}
<button type="submit" class="layui-btn " lay-filter="notice-add" lay-submit id="notice-add">立即发布</button>
{/if}
2020-03-31 23:01:00 +08:00
</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">
2020-04-02 23:41:48 +08:00
{if condition="checkRuleButton('admin/notice/edit')"}
2020-03-31 23:01:00 +08:00
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
2020-04-02 23:41:48 +08:00
{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('admin/notice/delete')"}
2020-03-31 23:01:00 +08:00
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
2020-04-02 23:41:48 +08:00
{else /}<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
2020-03-31 23:01:00 +08:00
</script>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index','appset', 'layedit','form' ,'table'],function(){
var $ = layui.jquery
,layedit = layui.layedit
,table = layui.table
,form = layui.form;
2020-04-01 12:18:43 +08:00
/*
2020-03-31 23:01:00 +08:00
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}