作者 jinglong
1 个管道 的构建 通过 耗费 4 秒

增加渲染封面图

... ... @@ -20,6 +20,12 @@ class ActiveController extends HomeBaseController
private $more_limit = 5;//更多列表分页
public function index(){
//星际活动
//封面图
$imgModel = new IndexController();
$coverImg = $imgModel->getCoverImg(CityCategoryModel::activeImg,1);
$this->assign('coverImg',$coverImg);
$position['category_id'] = CityCategoryModel::xjhd_c;
$field = 'id,thumbnail,post_title';
$res = $this->getChildArticlePage($position,$field);
... ...
... ... @@ -20,6 +20,12 @@ class EnjoyController extends HomeBaseController
private $more_limit = 8;//更多列表分页
public function index(){
//按照城市查询
//封面图
$imgModel = new IndexController();
$coverImg = $imgModel->getCoverImg(CityCategoryModel::enjoyImg,1);
$this->assign('coverImg',$coverImg);
//默认澳大利亚
$city_id = $this->request->param('city_id',0,'intval');
$position['city_id'] = $city_id;
... ...
... ... @@ -21,6 +21,11 @@ class IndexController extends HomeBaseController
$serverModel = new ServerController();
//统计访问量
$serverModel->statistics();
//banner轮播图
$coverImg = $this->getCoverImg(CityCategoryModel::indexImg,3);
$this->assign('coverImg',$coverImg);
//星球奇境,城市分类
$res['asia'] = $this->getCity(CityCategoryModel::asia);
$res['europe'] = $this->getCity(CityCategoryModel::europe);
... ... @@ -155,6 +160,18 @@ class IndexController extends HomeBaseController
return $res;
}
//获取封面图
public function getCoverImg($type,$limit){
$res = Db::name('image')
->where(['type'=>$type])
->field('id,image')
->limit($limit)
->order('weigh desc')
->select()
->toArray();
return $res;
}
//根据月份查询文章(星享体验)
private function getMonthArticle($month){
$position = CityCategoryModel::xxty;
... ...
... ... @@ -211,6 +211,11 @@ class RegionController extends HomeBaseController
$res = $this->getChildArticlePage($position,$field,16);
$this->assign('res',$res['data']);
$this->assign('page',$res['page']);
//封面图
$imgModel = new IndexController();
$coverImg = $imgModel->getCoverImg(CityCategoryModel::galleryImg,1);
$this->assign('coverImg',$coverImg);
return $this->fetch();
}
... ...
... ... @@ -18,6 +18,11 @@ class ScoutController extends HomeBaseController
{
private $index_limit = 16;//首页分页
public function index(){
//封面图
$imgModel = new IndexController();
$coverImg = $imgModel->getCoverImg(CityCategoryModel::scoutImg,1);
$this->assign('coverImg',$coverImg);
//旅游路线
$position['category_id'] = CityCategoryModel::lylx;
$field = 'id,thumbnail,post_title';
... ...
... ... @@ -79,4 +79,10 @@ class CityCategoryModel extends Model
const November = 11;//十一月份
const December = 12;//十二月份
//封面图分类
const indexImg = 1;//首页封面图
const galleryImg = 2;//星域秀场-星球画廊
const enjoyImg = 3;//星享体验封面图
const scoutImg = 4;//星探推荐封面图
const activeImg = 5;//星际活动封面图
}
... ...
... ... @@ -22,7 +22,9 @@
<body>
<include file="public@header"/>
<div class="banner">
<img src="__TMPL__/public/assets/starImg/bicon_01.png" alt="">
<volist name="coverImg" id="vo">
<img src="{:cmf_get_image_url($vo.image)}" alt="">
</volist>
</div>
<main>
<div class="container">
... ...
... ... @@ -27,7 +27,9 @@
<body>
<include file="public@header"/>
<div class="banner">
<img src="__TMPL__/public/assets/starImg/enjoy_banner.jpg" alt="">
<volist name="coverImg" id="vo">
<img src="{:cmf_get_image_url($vo.image)}" alt="">
</volist>
</div>
<main>
<div class="container">
... ...
... ... @@ -36,15 +36,11 @@
<!-- banner -->
<div id="banner" class="swiper-container6">
<div class="swiper-wrapper">
<volist name="coverImg" id="vo">
<div class="swiper-slide">
<img src="__TMPL__/public/assets/starImg/banner/1.jpg" alt="">
</div>
<div class="swiper-slide">
<img src="__TMPL__/public/assets/starImg/banner/2.jpg" alt="">
</div>
<div class="swiper-slide">
<img src="__TMPL__/public/assets/starImg/banner/3.jpg" alt="">
<img src="{:cmf_get_image_url($vo.image)}" alt="">
</div>
</volist>
</div>
<div class="swiper-button-nextban"></div>
<div class="swiper-button-prevban"></div>
... ...
... ... @@ -16,7 +16,9 @@
<div class="happy_gallery">
<!-- banner -->
<div class="happy_gallery_banner">
<img src="__TMPL__/public/assets/starImg/aicon_01.png" alt="">
<volist name="coverImg" id="vo">
<img src="{:cmf_get_image_url($vo.image)}" alt="">
</volist>
</div>
<!-- 内容 -->
<div class="happy_gallery_con">
... ...
... ... @@ -12,7 +12,9 @@
<body>
<include file="public@header"/>
<div class="banner">
<img src="__TMPL__/public/assets/starImg/bicon_01.png" alt="">
<volist name="coverImg" id="vo">
<img src="{:cmf_get_image_url($vo.image)}" alt="">
</volist>
</div>
<main>
<div class="container">
... ...
.banner img {
width: 100%;
height: 666px;
height: 100%;
}
main {
padding-top: 142px;
padding-top: 100px;
padding-bottom: 150px;
box-sizing: border-box;
}
... ...