首页调整

master
yin5th 2022-10-14 16:14:35 +08:00
parent 782bdbb7db
commit e3499f09be
6 changed files with 94 additions and 130 deletions

View File

@ -2,9 +2,10 @@
namespace app\controller;
use app\model\{Article as MArticle, Category, Block, Message, Article, Slide};
use app\model\{Article as MArticle, CasesModel, Category, Block, Message, Article, Slide};
use Exception;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
use app\service\Tool;
@ -16,34 +17,66 @@ class Index extends Base
$categoryId = $category['id'] ?? 0;
$blocks = Block::getByCategoryId($categoryId);
$this->news(5);
$this->news();
$this->cases();
$this->companyHistory($blocks['company_history_list']['value']);
$this->data['categoryId'] = $categoryId;
$this->data['blocks'] = Block::convertValue($blocks);
$this->data['category'] = $category;
$this->data['topCategoryId'] = Category::firstGradeById($category['id']) ;
$this->data['isIndex'] = true;
$this->data['slide'] = Slide::getList();
$this->data['categoryId'] = $categoryId;
$this->data['blocks'] = Block::convertValue($blocks);
$this->data['category'] = $category;
$this->data['topCategoryId'] = Category::firstGradeById($category['id']);
$this->data['isIndex'] = true;
$this->data['slide'] = Slide::getList();
$this->setSeo($this->system['seo_title'], $this->system['seo_keywords'], $this->system['seo_description']);
return $this->view();
}
// 新闻动态
private function news($num)
// 新闻
private function news()
{
$this->data['newsList'] = MArticle::getIndexList(Category::CATEGORY_NEWS, $num);
$topNews = MArticle::getIndexTop(Category::CATEGORY_NEWS);
$this->data['topNews'] = $topNews;
$newsCategory = Category::where('parent_id', Category::CATEGORY_NEWS)
->order('sort', 'asc')
->column('id,title,route,url');
$sql = '';
foreach ($newsCategory as $cate) {
$sql .= empty($sql) ? '' : ' union ';
$sql .= '(select `id`,`title`,`summary`,`category_id`,`src`,`src_mobile`,`create_time` from bee_article where `category_id` = '.$cate['id'].' order by `top` desc, `sort` desc limit 5)';
}
$res = Db::query($sql);
$list = [];
foreach (array_column($newsCategory, 'id') as $categoryId) {
if (!isset($list[$categoryId])) {
$list[$categoryId] = [];
}
foreach ($res as $re) {
if ($re['category_id'] == $categoryId) {
$list[$categoryId][] = $re;
}
}
}
$this->data['newsCategory'] = $newsCategory;
$this->data['newsList'] = $list;
}
// 案例
private function cases()
{
$casesList = CasesModel::where('home', 1)->order('sort', 'desc')->order('id', 'desc')->select();
$this->data['casesList'] = $casesList;
}
private function companyHistory(string $companyHistory)
{
$companyHistory = nl2br($companyHistory);
$companyHistory = explode('<br />', $companyHistory);
$companyHistory = nl2br($companyHistory);
$companyHistory = explode('<br />', $companyHistory);
$companyHistoryList = [];
foreach ($companyHistory as $v) {
$arr = explode(';', $v);
$arr = explode(';', $v);
$companyHistoryList[] = [
'year' => $arr[0] ?? '',
'desc' => $arr[1] ?? ''
@ -62,10 +95,10 @@ class Index extends Base
if ($this->request->isPost()) {
$item = input('item/a', [], 'strip_tags');
$validate = $this->validateByApi($item, [
'code|验证码' => 'require',
'name|姓名' => 'require',
'email|邮箱' => 'email',
'tel|联系方式' => 'require|mobile',
'code|验证码' => 'require',
'name|姓名' => 'require',
'email|邮箱' => 'email',
'tel|联系方式' => 'require|mobile',
'content|留言内容' => 'require',
]);
if ($validate !== true) {

View File

@ -466,6 +466,10 @@
flex-wrap: wrap;
}
.project-case-list {
flex-wrap: wrap;
}
.project-case-list>a {
width: calc(25% - 19.5px);
margin: 24px 26px 0 0;

View File

@ -56,104 +56,31 @@
<div class="index-news-title pc-show"><img src="__STATIC__/web/images/public/news-title.png" alt="project case"></div>
<!-- navTab -->
<div class="index-news-nav flex">
<span data-url="news.html">总部新闻</span>
<span data-url="news.html">区域动态</span>
{foreach $newsCategory as $c}
<span data-url="{$c.url ?: $c.route}">{$c.title}</span>
{/foreach}
</div>
<a href="news.html" class="news-more uppercase color-66 font-helvetica wap-show">News ></a>
<a href="{$blocks['news_more_mobile']['link'] ?? 'javascript:;'}" class="news-more uppercase color-66 font-helvetica wap-show">{$blocks['news_more_mobile']['value']}</a>
<!-- 资讯列表 -->
<div class="new-list">
<!-- 新闻列表 -->
{foreach $newsList as $news}
<div class="swiper">
<div class="swiper-wrapper">
{foreach $news as $n}
<div class="swiper-slide">
<div class="wap-show"><img src="__STATIC__/web/images/news-wap.jpg" alt="还山川秀丽 建绿色矿山"></div>
<a href="newsDetail.html">
<em class="color-blue wap-show">2022.09.12</em>
<div class="title color-blue clips1">还山川秀丽 建绿色矿山</div>
<p class="info color-66 clips4">为现固提升矿山企业综合整治成果,提升矿产资源开发利用平,进一步改善矿山自然生态环境,促进我市进我市矿业经济与生态环境和谐发展全市召开推进绿色矿山建设现场观摩会,并在我集团纳源煤矿设观摩点...</p>
</a>
</div>
<div class="swiper-slide">
<div class="wap-show"><img src="__STATIC__/web/images/news-wap.jpg" alt="还山川秀丽 建绿色矿山"></div>
<a href="newsDetail.html">
<em class="color-blue wap-show">2022.09.12</em>
<div class="title color-blue clips1">还山川秀丽 建绿色矿山</div>
<p class="info color-66 clips4">为现固提升矿山企业综合整治成果,提升矿产资源开发利用平,进一步改善矿山自然生态环境,促进我市进我市矿业经济与生态环境和谐发展全市召开推进绿色矿山建设现场观摩会,并在我集团纳源煤矿设观摩点...</p>
</a>
</div>
<div class="swiper-slide">
<div class="wap-show"><img src="__STATIC__/web/images/news-wap.jpg" alt="还山川秀丽 建绿色矿山"></div>
<a href="newsDetail.html">
<em class="color-blue wap-show">2022.09.12</em>
<div class="title color-blue clips1">还山川秀丽 建绿色矿山</div>
<p class="info color-66 clips4">为现固提升矿山企业综合整治成果,提升矿产资源开发利用平,进一步改善矿山自然生态环境,促进我市进我市矿业经济与生态环境和谐发展全市召开推进绿色矿山建设现场观摩会,并在我集团纳源煤矿设观摩点...</p>
</a>
</div>
<div class="swiper-slide">
<div class="wap-show"><img src="__STATIC__/web/images/news-wap.jpg" alt="还山川秀丽 建绿色矿山"></div>
<a href="newsDetail.html">
<em class="color-blue wap-show">2022.09.12</em>
<div class="title color-blue clips1">还山川秀丽 建绿色矿山</div>
<p class="info color-66 clips4">为现固提升矿山企业综合整治成果,提升矿产资源开发利用平,进一步改善矿山自然生态环境,促进我市进我市矿业经济与生态环境和谐发展全市召开推进绿色矿山建设现场观摩会,并在我集团纳源煤矿设观摩点...</p>
</a>
</div>
<div class="swiper-slide">
<div class="wap-show"><img src="__STATIC__/web/images/news-wap.jpg" alt="还山川秀丽 建绿色矿山"></div>
<a href="newsDetail.html">
<em class="color-blue wap-show">2022.09.12</em>
<div class="title color-blue clips1">还山川秀丽 建绿色矿山</div>
<p class="info color-66 clips4">为现固提升矿山企业综合整治成果,提升矿产资源开发利用平,进一步改善矿山自然生态环境,促进我市进我市矿业经济与生态环境和谐发展全市召开推进绿色矿山建设现场观摩会,并在我集团纳源煤矿设观摩点...</p>
</a>
</div>
</div>
<div class="swiper-pagination"></div>
</div>
<!-- 动态列表 -->
<div class="swiper">
<div class="swiper-wrapper">
<div class="swiper-slide">
<div class="color-blue wap-show"><img src="__STATIC__/web/images/news-wap.jpg" alt="还山川秀丽 建绿色矿山"></div>
<a href="newsDetail.html">
<em class="wap-show">2022.09.12</em>
<div class="title color-blue clips1">还山川秀丽 建绿色矿山</div>
<p class="info color-66 clips4">为现固提升矿山企业综合整治成果,提升矿产资源开发利用平,进一步改善矿山自然生态环境,促进我市进我市矿业经济与生态环境和谐发展全市召开推进绿色矿山建设现场观摩会,并在我集团纳源煤矿设观摩点...</p>
</a>
</div>
<div class="swiper-slide">
<div class="color-blue wap-show"><img src="__STATIC__/web/images/news-wap.jpg" alt="还山川秀丽 建绿色矿山"></div>
<a href="newsDetail.html">
<em class="wap-show">2022.09.12</em>
<div class="title color-blue clips1">还山川秀丽 建绿色矿山</div>
<p class="info color-66 clips4">为现固提升矿山企业综合整治成果,提升矿产资源开发利用平,进一步改善矿山自然生态环境,促进我市进我市矿业经济与生态环境和谐发展全市召开推进绿色矿山建设现场观摩会,并在我集团纳源煤矿设观摩点...</p>
</a>
</div>
<div class="swiper-slide">
<div class="color-blue wap-show"><img src="__STATIC__/web/images/news-wap.jpg" alt="还山川秀丽 建绿色矿山"></div>
<a href="newsDetail.html">
<em class="wap-show">2022.09.12</em>
<div class="title color-blue clips1">还山川秀丽 建绿色矿山</div>
<p class="info color-66 clips4">为现固提升矿山企业综合整治成果,提升矿产资源开发利用平,进一步改善矿山自然生态环境,促进我市进我市矿业经济与生态环境和谐发展全市召开推进绿色矿山建设现场观摩会,并在我集团纳源煤矿设观摩点...</p>
</a>
</div>
<div class="swiper-slide">
<div class="color-blue wap-show"><img src="__STATIC__/web/images/news-wap.jpg" alt="还山川秀丽 建绿色矿山"></div>
<a href="newsDetail.html">
<em class="wap-show">2022.09.12</em>
<div class="title color-blue clips1">还山川秀丽 建绿色矿山</div>
<p class="info color-66 clips4">为现固提升矿山企业综合整治成果,提升矿产资源开发利用平,进一步改善矿山自然生态环境,促进我市进我市矿业经济与生态环境和谐发展全市召开推进绿色矿山建设现场观摩会,并在我集团纳源煤矿设观摩点...</p>
</a>
</div>
<div class="swiper-slide">
<div class="color-blue wap-show"><img src="__STATIC__/web/images/news-wap.jpg" alt="还山川秀丽 建绿色矿山"></div>
<a href="newsDetail.html">
<em class="wap-show">2022.09.12</em>
<div class="title color-blue clips1">还山川秀丽 建绿色矿山</div>
<p class="info color-66 clips4">为现固提升矿山企业综合整治成果,提升矿产资源开发利用平,进一步改善矿山自然生态环境,促进我市进我市矿业经济与生态环境和谐发展全市召开推进绿色矿山建设现场观摩会,并在我集团纳源煤矿设观摩点...</p>
<div class="wap-show"><img src="{$n.src_mobile ?? ''}" alt="{$n.title ?? ''}"></div>
<a href="/news/{$n.id}.html">
<em class="color-blue wap-show">{:date('Y.m.d', $n.create_time)}</em>
<div class="title color-blue clips3">{$n.title}</div>
<p class="info color-66 clips4">{$n.summary}</p>
</a>
</div>
{/foreach}
</div>
<div class="swiper-pagination"></div>
</div>
{/foreach}
</div>
</div>
<!-- 物业服务 -->
@ -199,34 +126,15 @@
<a href="{$blocks['project_case_more']['link'] ?: 'javascript:;'}" class="more color-66">{$blocks['project_case_more']['value'] ?? ''}</a>
</div>
<div class="project-case-list flex">
<a href="redPropertDetail.html" class="wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0">
<div class="img"><img src="__STATIC__/web/images/case-01.jpg" alt="成都领地环金广场"></div>
{foreach $casesList as $case}
<a href="/cases/{$case.id}.html" class="wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0">
<div class="img"><img src="{$isMobile ? $case.image_mobile : $case.image}" alt="{$case.title}"></div>
<div class="txt bg-col-white flex">
<p class="clips1">成都领地环金广场</p>
<span>+</span>
</div>
</a>
<a href="topQualityDetail.html" class="wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0">
<div class="img"><img src="__STATIC__/web/images/case-02.jpg" alt="成都领地环金广场"></div>
<div class="txt bg-col-white flex">
<p class="clips1">成都领地环金广场</p>
<span>+</span>
</div>
</a>
<a href="redPropertDetail.html" class="wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0">
<div class="img"><img src="__STATIC__/web/images/case-03.jpg" alt="成都领地环金广场"></div>
<div class="txt bg-col-white flex">
<p class="clips1">成都领地环金广场</p>
<span>+</span>
</div>
</a>
<a href="topQualityDetail.html" class="wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0">
<div class="img"><img src="__STATIC__/web/images/case-04.jpg" alt="成都领地环金广场"></div>
<div class="txt bg-col-white flex">
<p class="clips1">成都领地环金广场</p>
<p class="clips1">{$case.title}</p>
<span>+</span>
</div>
</a>
{/foreach}
</div>
</div>
</div>

View File

@ -81,6 +81,14 @@
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">展示到首页</label>
<div class="layui-inline new-inline">
<input type="radio" name="item[home]" value="0" title="否" checked/>
<input type="radio" name="item[home]" value="1" title="是" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">状态</label>
<div class="layui-inline new-inline">

View File

@ -80,6 +80,14 @@
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">展示到首页</label>
<div class="layui-inline new-inline">
<input type="radio" name="item[home]" value="0" title="否" {if $item.home == 0} checked {/if} />
<input type="radio" name="item[home]" value="1" title="是" {if $item.home == 1} checked {/if} />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">状态</label>
<div class="layui-inline new-inline">

View File

@ -25,6 +25,7 @@ use app\model\Category as VCategory;
<col width="75px">
<col width="75px">
<col width="75px">
<col width="75px">
<col width="410px">
</colgroup>
<thead>
@ -34,6 +35,7 @@ use app\model\Category as VCategory;
<td>封面图-手机</td>
<td>状态</td>
<td>推荐</td>
<td>首页展示</td>
<td>操作</td>
</tr>
</thead>
@ -53,6 +55,7 @@ use app\model\Category as VCategory;
</td>
<td>{:$item.visible == 0 ? '<span class="text-warning">隐藏</span>' : '<span class="text-green">正常</span>'}</td>
<td>{$item.recommend == 0 ? '否' : '是'}</td>
<td>{$item.home == 0 ? '否' : '是'}</td>
<td >
<a class="sort layui-btn layui-btn-primary layui-btn-xs" data-id="{$item.id}" data-sort="up" data-url="{:url('manager.cases/sort')}" href="javascript:void(0);">
<i class=""></i>向上