123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2017/3/17 0017
- * Time: 上午 10:52
- */
- use yii\helpers\Url;
- use yii\widgets\LinkPager;
- ?>
- <style>
- .color{
- color: red;
- }
- </style>
- <div class="row">
- <div class="col-sm-12">
- <div class="ibox float-e-margins">
- <div class="ibox-content">
- <div class="row">
- <div class="col-sm-5 m-b-xs">
- <a class="btn btn-sm btn-primary addhotsearch" href="<?=Url::toRoute(['webconfig/addnotice'])?>"> 新增公告</a>
- </div>
- </div>
- <div class="table-responsive">
- <table class="table table-striped">
- <thead>
- <tr>
- <th>ID</th>
- <th>标题</th>
- <th>发布时间</th>
- <th>结束时间</th>
- <th>操作</th>
- </tr>
- </thead>
- <tbody>
- <form id="checkForm" method="post">
- <?php if(!empty($datas)):?>
- <?php $i=0; foreach($datas as $data):?>
- <tr class="hotsearch_<?=$data->id?>">
- <td><?php $i++;echo $i;?></td>
- <td class="keyword">
- <?php $information = empty($data->information)?'':$data->information?>
- <?=empty( $information->title)?'': $information->title?>
- </td>
- <td><?=date('Y-m-d :H:i:s',$data->release_time)?></td>
- <td><?=date('Y-m-d :H:i:s',$data->over_time)?></td>
- <td>
- <a href="<?=Url::toRoute(['webconfig/addnotice','id'=>$data->id])?>" class="btn btn-sm btn-primary edit_advert">修改</a>
- <a class="btn btn-sm btn-danger del_advert"data="<?= $data->id?>">删除</a>
- </td>
- </tr>
- <?php endforeach;?>
- <?php endif?>
- <input type="hidden" name="_csrf-backend" value="<?=Yii::$app->request->csrfToken;?>" />
- <input type="hidden" value="" name="key" class="shelves-key">
- </form>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script>
- $('.table-responsive').on('click','.del_advert',function(){
- var id = $(this).attr('data');
- var text = $(this);
- swal({
- title: "确定删除该公告?",
- type: "warning",
- showCancelButton: true,
- confirmButtonColor: "#DD6B55",
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- closeOnConfirm: true,
- closeOnCancel: true },
- function(isConfirm){
- if (isConfirm) {
- $.ajax({
- url:'<?=Url::toRoute(['webconfig/del_notice']);?>',
- type:'POST',
- dataType:'json',
- data:{id:id,'_csrf-backend':'<?=Yii::$app->request->csrfToken;?>'},
- success:function(data){
- if(data.sign==1){
- text.parents('tr').remove();
- }else{
- swal("", data.msg, "error");
- }
- }
- })
- }
- });
- })
- </script>
|