diff --git a/app/controller/Info.php b/app/controller/Info.php index 5404e73..989a9a3 100755 --- a/app/controller/Info.php +++ b/app/controller/Info.php @@ -121,8 +121,11 @@ class Info extends Base app('think\App')->bind(Paginator::class, DxtcPageA::class); $list = []; - foreach ($cateList as $cate) { - $list[$cate['id']] = NoticeModel::getList($cate['id'], 2, $keyword, [], 1, $listSort, false); + foreach ($cateList as &$cate) { +// $list[$cate['id']]['total'] = NoticeModel::getList($cate['id'], 2, $keyword, [], 1, $listSort, false); + $cate['total'] = NoticeModel::where('category_id', $cate['id'])->when(!empty($keyword), function ($q) use ($keyword) { + $q->where('title', 'like', '%'.$keyword.'%'); + })->count(); } $downloadList = DownloadModel::where('category_id', Category::CATEGORY_INFO_DOWNLOAD) @@ -170,4 +173,48 @@ class Info extends Base $this->data['categoryId'] = $category['id']; return $this->view(); } + + public function getNotice() + { + $page = input('page/d', 1); + $size = input('size/d', 2); + $cate = input('cate/d', 0); + $keyword = input('keyword/s', ''); + + $page = $page ?: 1; + $size = $size ?: 2; + + $res = [ + 'total' => 0, + 'page' => $page, + 'size' => $size, + 'data' => [], + ]; + + if (empty($cate)) { + return $this->json(0,'success', $res); + } + + $where = []; + if (!empty($keyword)) { + $where[] = ['title', 'like', '%'.$keyword.'%']; + } + + $where[] = ['category_id', '=', $cate]; + $q = NoticeModel::where($where); + $total = $q->count(); + + if ($total > 0) { + $list = $q->page($page)->limit($size)->order('sort desc')->select(); + $list->each(function ($item) { + $item->create_at = date('Y.m.d', $item->create_time); + }); + $res['total'] = $total; + $res['page'] = $page; + $res['size'] = $size; + $res['data'] = $list; + } + + return $this->json(0, 'success', $res); + } } \ No newline at end of file diff --git a/public/static/web/js/style.js b/public/static/web/js/style.js index 3e21329..4267413 100644 --- a/public/static/web/js/style.js +++ b/public/static/web/js/style.js @@ -26,11 +26,11 @@ $(function(){ $(".header .nav .nLi h3").mouseenter(function(event) { $(this).siblings('.listcur').show(); }); - + $(".header .nav .nLi").mouseleave(function(event) { $(this).find(".listcur").hide(); }); - // banner + // banner var swiper1 = new Swiper('.banner .swiper-container', { speed:1000, @@ -49,7 +49,7 @@ $(function(){ clickable: true, }, }); - + //当banner图片大于1张时候运行 var bannerbox = $(".banner").find(".swiper-slide").length; if(bannerbox == 1){ @@ -85,7 +85,7 @@ $(function(){ return false; }); - $(".talent-top").click(function(){ + $("body").on('click','.talent-top',function(){ $(this).siblings(".talent-bottom").slideToggle(); $(this).parents(".boxs").siblings().find(".talent-bottom").slideUp(); }) diff --git a/view/info/platform.html b/view/info/platform.html index ee9b855..1356881 100755 --- a/view/info/platform.html +++ b/view/info/platform.html @@ -45,29 +45,61 @@
{$cate.title}
- {php}$items = $list[$cate['id']];{/php} - {foreach $items as $item} -
-
-

{$item.title}

-
- -
- {:date('Y.m.d', $item.create_time)} -
-
-
{$item.status}
-
-
-
- {$item.content|raw} -
-
-
- {/foreach}
- {$items->render('', 'class="pageing wow fadeIn" data-wow-duration="0.8s" data-wow-delay="0"')|raw} +
+
{/foreach} @@ -93,10 +125,4 @@ 联系地址:{$extraBase['info_address'] ?? ''} - - \ No newline at end of file + \ No newline at end of file