<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:63:"D:\wwwroot\pay.6gym.com\public/../app/index\view\admin\news.html";i:1609314480;}*/ ?>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title><?php echo $web_config['web_site']; ?> - 6gym.com 6G源码 </title>
    <link rel="stylesheet" href="/static/assets/libs/layui/css/layui.css"/>
    <link rel="stylesheet" href="/static/assets/module/admin.css?v=318" media="all"/>
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        /** 数据表格中的select尺寸调整 */
        .layui-table-view .layui-table-cell .layui-select-title .layui-input {
            height: 28px;
            line-height: 28px;
        }

        .layui-table-view [lay-size="lg"] .layui-table-cell .layui-select-title .layui-input {
            height: 40px;
            line-height: 40px;
        }

        .layui-table-view [lay-size="lg"] .layui-table-cell .layui-select-title .layui-input {
            height: 40px;
            line-height: 40px;
        }

        .layui-table-view [lay-size="sm"] .layui-table-cell .layui-select-title .layui-input {
            height: 20px;
            line-height: 20px;
        }

        .layui-table-view [lay-size="sm"] .layui-table-cell .layui-btn-xs {
            height: 18px;
            line-height: 18px;
        }
        
        #tbImgTable + .layui-table-view .layui-table-body tbody > tr > td {
            padding: 0;
        }

        #tbImgTable + .layui-table-view .layui-table-body tbody > tr > td > .layui-table-cell {
            height: 48px;
            line-height: 48px;
        }

        .tb-img-circle {
            width: 26px;
            height: 26px;
            cursor: zoom-in;
            border-radius: 50%;
            border: 1px solid #dddddd;
        }

    </style>
</head>
<body onscroll="layui.admin.hideFixedEl();">
<!-- 正文开始 -->
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <!-- 表格工具栏 -->
            <form class="layui-form toolbar table-tool-mini">
                <div class="layui-form-item">
                         <div class="layui-inline">
                        <label class="layui-form-label w-auto">公告标题:</label>
                        
                        <div class="layui-input-inline">
                            <input name="title" class="layui-input" type="text" placeholder="请输入公告标题"/>
                            
                        </div></div>
                        
                    <div class="layui-inline" style="padding-right: 110px;">
                        <button class="layui-btn icon-btn" lay-filter="tbBasicTbSearch" lay-submit>
                            <i class="layui-icon">&#xe615;</i>搜索
                        </button>
                        
                          <button id="add" class="layui-btn icon-btn" type="button">
                            <i class="layui-icon">&#xe654;</i>新增
                        </button>
                       
                    </div>
                </div>
            </form>
            <!-- 数据表格 -->
            <table id="tbBasicTable" lay-filter="tbBasicTable"></table>
        </div>
    </div>
  
</div>


<!-- 表格操作列 -->
<script type="text/html" id="tbBasicTbBar">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
   
</script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/html" id="dialogEditDialog1">

   
    
    <form id="dialogEditForm1" lay-filter="dialogEditForm1" class="layui-form model-form no-padding">
        <input name="id" type="hidden"/>
        <div class="model-form-body" style="max-height: 310px;">
             <div class="layui-row">
                 <div class="layui-col-md4">
                 <div class="grid-demo grid-demo-bg1"><div class="layui-form-item">
                <label class="layui-form-label layui-form-required">公告标题:</label>
                <div class="layui-input-block">
                    <input name="title" placeholder="请输入新闻标题" class="layui-input" lay-verify="required" required />
                </div>
              </div> 
              <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">是否置顶:</label>
                <div class="layui-input-block">
                    <select name="zd" lay-verify="required" required>
                        <option value="1">启用</option>
                        <option value="0">不启用</option>
                    </select>
                </div>
            </div>
              
            </div>
                 </div>
                  <div class="layui-col-md8">
                  <div class="grid-demo"> <div class="layui-form-item">
                  <div class="layui-input-block" style="margin-left: 30px;">   
                  <textarea name="text" id="editor" style="height:100%"></textarea>
                  </div>
                  </div> </div>
                 </div>
            </div>
        
        </div>
        <div class="layui-form-item text-right model-form-footer">
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
            <button class="layui-btn" lay-filter="dialogEditSubmit1" lay-submit>保存</button>
        </div>
    </form>
</script>



<!-- js部分 -->
<script type="text/javascript" src="/static/assets/libs/layui/layui.js"></script>
<script type="text/javascript" src="/static/assets/js/common.js?v=318"></script>

<script>
    
    layui.use(['layer', 'form','laytpl','admin','table', 'util', 'dropdown','baseTable','upload'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var util = layui.util;
        var dropdown = layui.dropdown;
        var laytpl = layui.laytpl;
        var admin = layui.admin;
        var upload = layui.upload;

        /* 渲染表格 */
        var insTb = table.render({
            elem: '#tbBasicTable',
            url: "<?php echo url('admin/news_list'); ?>",
            page: true,
            limit: 15,
            cellMinWidth: 100,
            cols: [[
                {type: 'checkbox'},
                {field: 'id', title: '编码', align: 'left',width:100},
               
                {field: 'title', title: '标题', align: 'left',width:800},
               
                {
                    field: 'time', title: '发布时间',minWidth: 190, templet: function (d) {
                        return util.toDateString(d.time*1000);
                    }, align: 'left'
                },
                {
                    field: 'zd', title: '是否置顶', templet: function (d) {
                        var strs = {
                          
                            1:'<span class="layui-badge layui-badge-green">已置顶</span>',
                            0:'<span class="layui-badge layui-badge-gray">未置顶</span>'
                        };
                        return strs[d.zd];
                    }, align: 'left',width:120
                },
                
                
               
                {title: '操作', toolbar: '#tbBasicTbBar', align: 'left', width:150}
            ]]
        });

        /* 表格搜索 */
        form.on('submit(tbBasicTbSearch)', function (data) {
            insTb.reload({where: data.field, page: {curr: 1}});
            return false;
        });
        
        

        /* 表格工具条点击事件 */
        table.on('tool(tbBasicTable)', function (obj) {
            var data = obj.data; // 获得当前行数据
            var layEvent = obj.event;
            if (obj.event === 'edit') { // 修改
                showMode(data);
                ue();
            
            }else if (obj.event === 'del') { // 删除
                del(data);
            } 
            dropdown.hideAll();
        });
        
        function del(data){
            layer.confirm('确认要删除该新闻吗？', {
                shade: .1,
                skin: 'layui-layer-admin'
                }, function (i) {
                layer.close(i);
                    layer.load(2);
                    $.get('<?php echo url("admin/news_del"); ?>', {
                        id: data.id
                    }, function (res) {
                        layer.closeAll('loading');
                        if (res.code == 1) {
                            layer.msg(res.msg, {icon: 1});
                            insTb.reload({page: {curr: 1}});
                           
                        } else {
                            layer.msg(res.msg, {icon: 2});
                        }
                    }, 'json');
                                
           });
        
        }
        
        function showMode(mData){
            
			admin.open({
                type: 1,
                title: mData?"编辑":'添加',
				area: ['90%', '450px'],
                content: $('#dialogEditDialog1').html(),
                zIndex:1000,
                success: function (layero, dIndex) {
                    $(layero).children('.layui-layer-content').css('overflow', 'visible');
                    form.val('dialogEditForm1',mData);
                    form.render(null, 'dialogEditForm1');
                    
                    // 表单提交事件
                    form.on('submit(dialogEditSubmit1)', function (data) {
						var loadIndex = layer.load(2);
                        $.post('<?php echo url("admin/news_save"); ?>', data.field, function (res) {
                            layer.close(loadIndex);
                            if (0 != res.code) {                                
                                layer.msg(res.msg, {icon: 1});
                                insTb.reload({page: {curr: 1}});
                            } else {
                                layer.msg(res.msg, {icon: 2});
                            }
                        }, 'json');
                        return false;
                    });
                    
                }
            });
		}
        
        

        
       // 新增
        $('#add').click(function () {
            showMode()
            ue();
            
                
          
            
        });
        function ue (){
              var ue;
              UE.delEditor('editor'); 
              var ue = UE.getEditor('editor', {
             
});
          
        }

    });
</script>
</body>
</html>