产品模块的增删改查

原创 2019-01-04 16:58:23 220
摘要:<!--产品模块的代码基本与前面新闻列表页代码一样,但在写ADD页面的监听提交方法时发现可能会发生内存溢出的问题,具体问题来源还在查找中-->{include file="/public/head"}<body><div class="x-nav">      <span class=&

<!--产品模块的代码基本与前面新闻列表页代码一样,但在写ADD页面的监听提交方法时发现可能会发生内存溢出的问题,

具体问题来源还在查找中-


->

{include file="/public/head"}
<body>
<div class="x-nav">
     <span class="layui-breadcrumb">
       <a href="">首页</a>
       <a href="">演示</a>
       <a>
         <cite>导航元素</cite></a>
     </span>
   <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
       <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
   <xblock>
       <button class="layui-btn" onclick="x_admin_show('添加产品','{:url(\'Product/add\')}')"><i class="layui-icon"></i>添加</button>
       <span class="x-right" style="line-height:40px">共有数据:88 条</span>
   </xblock>
   <table class="layui-table">
       <thead>
       <tr>
           <th>产品ID</th>
           <th>产品标题</th>
           <th>产品分类</th>
           <th>产品图片</th>
           <th>产品简介</th>
           <th>发布管理员</th>
           <th>发布日期</th>
           <th >操作</th>
       </tr>
       </thead>
       <tbody>
       {volist name="products" id="product"}
       <tr>
           <td>{$product.id}</td>
           <td>{$product.title}</td>
           <td>{$product.sort}</td>
           <td><img src="#"></td>
           <td>{$product.desc}</td>
           <td>{$product.username}</td>
           <td>{$product.time|date="Y-m-d"}</td>
           <td class="td-manage">
               <a title="查看"  onclick="x_admin_show('编辑','{:url(\'Product/edit\')}?id={$product.id}')" href="javascript:;">
                   <i class="layui-icon">&#xe63c;</i>
               </a>
               <a title="删除" onclick="member_del(this,'{$product.id}')" href="javascript:;">
                   <i class="layui-icon">&#xe640;</i>
               </a>
           </td>
       </tr>
       {/volist}
       </tbody>
   </table>
   <div class="page">
       <div>
           {$products|raw}
       </div>
   </div>

</div>
<script>
   layui.use('laydate', function(){
       var laydate = layui.laydate;

       //执行一个laydate实例
       laydate.render({
           elem: '#start' //指定元素
       });

       //执行一个laydate实例
       laydate.render({
           elem: '#end' //指定元素
       });
   });


   /*用户-删除*/
   function member_del(obj,id){
       layer.confirm('确认要删除吗?',function(index){
           //发异步删除数据
           $.get('{:url(\'del\')}','id='+id,function (data) {
               if (data.res ==1){
                   $(obj).parents("tr").remove();
                   layer.msg('已删除!',{icon:1,time:1000});
               }
           })

       });
   }

</script>
</body>

</html>

批改老师:天蓬老师批改时间:2019-01-04 17:55:53
老师总结:共有数据:88 条, 这里不应该写死

发布手记

热门词条