master
Lee 2022-11-07 13:42:04 +08:00
commit 8e8da67bab
16 changed files with 300 additions and 79 deletions

View File

@ -125,7 +125,7 @@ class Base extends BaseController
return $list;
}
// 获取所在一级栏目背景
// 获取所在一级栏目banner
protected function firstBanner($category): array
{
// 一级栏目的banner
@ -143,4 +143,20 @@ class Base extends BaseController
return $bgImg;
}
// 获取所在一级栏目背景图
protected function firstBg($category)
{
// 一级栏目的banner
$firstCategoryId = Category::firstGradeId($category['path'], $category['id']);
if ($firstCategoryId == $category['id']) {
$this->data['bg_pc'] = $category['bg'];
$this->data['bg_mobile'] = $category['bg_mobile'];
} else {
$firstCategory = Category::where('id', $firstCategoryId)->field('id,title,bg,bg_mobile')->find();
$this->data['bg_pc'] = $firstCategory['bg'];
$this->data['bg_mobile'] = $firstCategory['bg_mobile'];
}
}
}

View File

@ -162,6 +162,10 @@ class Category extends Base
$id = input('post.id');
$img = input('post.img');
$img_mobile = input('post.img_mobile');
$bg_img = input('post.img_bg');
$bg_img_mobile = input('post.img_bg_mobile');
$icon = input('post.imgicon');
if (count($item) > 0 && (is_numeric($id) === true && $id > 0)) {
Db::startTrans();
@ -169,6 +173,8 @@ class Category extends Base
validate(VCategory::class)->scene("edit")->check($item);
$item['src'] = empty($img) ? '' : $img;
$item['src_mobile'] = empty($img_mobile) ? '' : $img_mobile;
$item['bg'] = empty($bg_img) ? '' : $bg_img;
$item['bg_mobile'] = empty($bg_img_mobile) ? '' : $bg_img_mobile;
$item['icon_img'] = empty($icon) ? '' : $icon;
// 只允许文章类栏目可以设置汇总查看
@ -239,13 +245,26 @@ class Category extends Base
$item = input('post.item/a');
$img = input('post.img');
$img_mobile = input('post.img_mobile');
$bg_img = input('post.img_bg');
$bg_img_mobile = input('post.img_bg_mobile');
$icon = input('post.imgicon');
if (is_array($item) === true && count($item) > 0) {
if (!empty($img)) {
$item['src'] = $img;
}if (!empty($img_mobile)) {
}
if (!empty($img_mobile)) {
$item['src_mobile'] = $img_mobile;
}
if (!empty($bg_img)) {
$item['bg'] = $bg_img;
}
if (!empty($bg_img_mobile)) {
$item['bg_mobile'] = $bg_img_mobile;
}
if(!empty($icon)){
$item['icon_img'] = $icon;
}

View File

@ -17,8 +17,9 @@ class Content extends Base
return $this->error('无此栏目');
}
$isPrev = input('is_prev', '');
$order = ['top' => 'desc', 'sort' => 'desc'];
$list = Article::getList($categoryId, 20, $keyword, $param, -1, $order);
$list = Article::getList($categoryId, 20, $keyword, $param, -1, $order, true, $isPrev);
$list = Article::convertRecommendOther([$categoryId], $list, true);
$this->data['list'] = $list;

View File

@ -165,7 +165,7 @@ class Article extends Base
* @param bool $onlyChild 仅获取下级 默认true false=获取所有后代分类
* @return Paginator
*/
public static function getList($categoryId, $per = 20, $keyword = '', $param = [], $status = -1, $orderList = ['sort' => 'desc'], bool $onlyChild = true)
public static function getList($categoryId, $per = 20, $keyword = '', $param = [], $status = -1, $orderList = ['top' => 'desc','sort' => 'desc'], bool $onlyChild = true, $prev = '')
{
$whereMap = [];
$pageParam = [];
@ -196,6 +196,12 @@ class Article extends Base
}
}
}
if (!empty($prev) || $prev == '0') {
$whereMap[] = ['is_prev', '=', $prev];
$pageParam['is_prev'] = $prev;
}
$paginate = [
'list_rows' => $per,
'query' => $pageParam

View File

@ -111,6 +111,7 @@ class Upload
$this->data['imgSize'] = $imgSize;
$this->data['num'] = $num;
$this->data['fields'] = $fields;
$this->data['fieldsJson'] = json_encode($fields, JSON_UNESCAPED_UNICODE);
return $this->showView('manager/widget/multi');
}

View File

@ -42,6 +42,13 @@ $childrenMenu = Category::getChildrenByParentId($topCategoryId);
{$item.content|raw}
</div>
</div>
<div class="resource-advantage wow fadeInUp" data-wow-duration="0.8s" data-wow-delay="0">
{if !empty($resource)}
{foreach $resource as $res}
<img src="{$res.src ?? ''}" alt="{$res.alt}" style="width: 100%;padding-top: 5px;">
{/foreach}
{/if}
</div>
<!-- 上下篇 -->
<div class="part-list flex">
{if !empty($prev)}

View File

@ -45,14 +45,27 @@
-->
{if !(in_array($category['id'],[4,5,7,9,10]))}
<div class="layui-form-item">
<label class="layui-form-label">副标题</label>
{php}
$subtitle = '副标题';
$titleNotice = '';
$titleValue = '';
switch ($category['id']) {
case 37:
$subtitle = '月份';
$titleValue = 1;
$titleNotice = '月份必填 不填则默认为1月';
break;
}
{/php}
<label class="layui-form-label">{$subtitle ??''}</label>
<div class="layui-input-block">
<input class="layui-input" type="text" name="item[sub_title]" maxlength="60" />
<input class="layui-input" type="text" name="item[sub_title]" value="{$titleValue??''}" maxlength="60" />
<div class="layui-form-mid layui-word-aux">{$titleNotice}</div>
</div>
</div>
{/if}
{if !(in_array($category['id'],[5]))}
{if !(in_array($category['id'],[5,37]))}
<div class="layui-form-item">
<label class="layui-form-label">封面图</label>
<div class="layui-input-block">
@ -61,7 +74,7 @@
</div>
{/if}
{if !(in_array($category['id'],[5,42]))}
{if !(in_array($category['id'],[5,37,42]))}
<div class="layui-form-item">
<label class="layui-form-label">手机封面图</label>
<div class="layui-input-block">
@ -78,14 +91,27 @@
</div>
</div>
{if in_array($category['id'], [39,9,10,23,24,25])}
{if in_array($category['id'], [39,9,10,23,24,25,37])}
<div class="layui-form-item">
<label class="layui-form-label">组图</label>
{php}
$imgName = 'PC组图';
$pcImgSize = '';
switch ($category['id']) {
case 37:
$imgName = '大事记';
$pcImgSize = '645*385';
break;
}
{/php}
<label class="layui-form-label">{$imgName}</label>
<div class="layui-input-block">
{:widget('manager.upload/multi',['append' => '_imgs','imgs' => $item.imgs??'', 'num' => $item.num??10, 'imgSize' => $pcImgSize, $item['id']??''])}
</div>
</div>
{/if}
{if in_array($category['id'], [39,9,10,23,24,25])}
<div class="layui-form-item">
<label class="layui-form-label">组图-手机端</label>
<div class="layui-input-block">
@ -94,7 +120,7 @@
</div>
{/if}
{if in_array($category['id'], [24])}
{if in_array($category['id'], [9,10,23,24,42])}
<div class="layui-form-item">
<label class="layui-form-label">资源优势PC组图</label>
<div class="layui-input-block">
@ -154,20 +180,17 @@
-->
{if !isset($allowSummary) || $allowSummary}
{if !(in_array($category['id'],[4,5,9,10,6,35,36,42]))}
{if !(in_array($category['id'],[4,5,9,10,6,35,36,37,42]))}
<div class="layui-form-itemBox2 between">
<div class="layui-form-item">
{if $category['id'] == 37}
<label class="layui-form-label">大事记列表</label>
{elseif $category['id'] == 38}
{if $category['id'] == 38}
<label class="layui-form-label">荣誉列表</label>
{else /}
<label class="layui-form-label">摘要</label>
{/if}
<div class="layui-input-block">
<textarea name="item[summary]" class="layui-textarea" {if in_array($category['id'],[37,38])}rows="10"{/if}></textarea>
<div class="layui-form-mid layui-word-aux">建议200字以内{if $category['id'] == 37} 大事记月份后需使用空格分割 如1月
中正物业正式入驻鑫苑小区、光明A区、巴音孟克商业综合体办公楼。{/if}</div>
<textarea name="item[summary]" class="layui-textarea" {if in_array($category['id'],[38])}rows="10"{/if}></textarea>
<div class="layui-form-mid layui-word-aux">建议200字以内</div>
</div>
</div>
</div>

View File

@ -5,10 +5,19 @@
<hr style="margin: 20px 0;">
<div class="layui-form-itemBox3 between">
<div class="layui-form-item">
<label class="layui-form-label">标题<em>*</em></label>
{php}
$title = '标题';
$titleNotice = '注建议60个字符长度以内';
switch ($category['id']) {
case 37:
$title = '年份';
break;
}
{/php}
<label class="layui-form-label">{$title}<em>*</em></label>
<div class="layui-input-block">
<input type="text" class="layui-input" name="item[title]" value="{$item.title??''}" maxlength="60"/>
<div class="layui-form-mid layui-word-aux">建议60个字符长度以内</div>
<div class="layui-form-mid layui-word-aux">{$titleNotice}</div>
</div>
</div>
</div>
@ -49,14 +58,27 @@
-->
{if !(in_array($category['id'],[4,5,7]))}
<div class="layui-form-item">
<label class="layui-form-label">副标题</label>
{php}
$subtitle = '副标题';
$titleNotice = '';
$titleValue = $item['sub_title'];
switch ($category['id']) {
case 37:
$subtitle = '月份';
$titleNotice = '月份必填 不填则默认为1月';
$titleValue = $item['sub_title'] ?: 1;
break;
}
{/php}
<label class="layui-form-label">{$subtitle ??''}</label>
<div class="layui-input-block">
<input class="layui-input" type="text" name="item[sub_title]" value="{$item.sub_title??''}" maxlength="60" />
<input class="layui-input" type="text" name="item[sub_title]" value="{$titleValue}" maxlength="60" />
<div class="layui-form-mid layui-word-aux">{$titleNotice}</div>
</div>
</div>
{/if}
{if !(in_array($category['id'],[5]))}
{if !(in_array($category['id'],[5,37]))}
<div class="layui-form-item">
<label class="layui-form-label">封面图</label>
<div class="layui-input-block">
@ -72,7 +94,7 @@
</div>
{/if}
{if !(in_array($category['id'],[5,42]))}
{if !(in_array($category['id'],[5,37,42]))}
<div class="layui-form-item">
<label class="layui-form-label">手机封面图</label>
<div class="layui-input-block">
@ -89,14 +111,28 @@
</div>
</div>
{if in_array($category['id'], [39,9,10,23,24,25])}
{if in_array($category['id'], [39,9,10,23,24,25,37])}
<div class="layui-form-item">
<label class="layui-form-label">PC组图</label>
{php}
$imgName = 'PC组图';
$pcImgSize = '';
switch ($category['id']) {
case 37:
$imgName = '大事记';
$pcImgSize = '645*385';
break;
}
{/php}
<label class="layui-form-label">{$imgName}</label>
<div class="layui-input-block">
{:widget('manager.upload/multi',['append' => '_imgs', 'imgs' => $item.imgs??'', 'num' => $item.num??10, 'imgSize' => $pcImgSize, $item['id']??''])}
</div>
</div>
{/if}
{if in_array($category['id'], [39,9,10,23,24,25])}
<div class="layui-form-item">
<label class="layui-form-label">组图-手机端</label>
<div class="layui-input-block">
@ -105,11 +141,11 @@
</div>
{/if}
{if in_array($category['id'], [24])}
{if in_array($category['id'], [9,10,23,24,42])}
<div class="layui-form-item">
<label class="layui-form-label">资源优势PC组图</label>
<div class="layui-input-block">
{:widget('manager.upload/multi',['append' => '_resource', 'imgs' => $item.other_text1??'', 'num' => 50, 'imgSize' => '1360*0px', $item['id']??''])}
{:widget('manager.upload/multi',['fields' => false,'append' => '_resource', 'imgs' => $item.other_text1??'', 'num' => 50, 'imgSize' => '1360*0px', $item['id']??''])}
</div>
</div>

View File

@ -63,15 +63,30 @@
{:widget('manager.upload/image',['append'=>'icon', 'imgSize' => $iconImgSize])}
</div>
</div>
<div class="layui-form-item layui-hide">
<label class="layui-form-label">栏目封面图</label>
<div class="layui-form-item">
<label class="layui-form-label" >导航背景PC[一级类目上传]</label>
<div class="layui-input-block">
{:widget('manager.upload/image')}
{:widget('manager.upload/image',['append' => '_bg','src' => $item['bg']??'', 'imgSize' => '1920*90'])}
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">手机端栏目封面图</label>
<label class="layui-form-label">导航背景手机端[一级类目上传]</label>
<div class="layui-input-block">
{:widget('manager.upload/image',["append"=>"_bg_mobile",'src' => $item['bg_mobile']??'', "imgSize" => "750*90"])}
</div>
</div>
<div class="layui-form-item layui-hide">
<label class="layui-form-label">栏目banner</label>
<div class="layui-input-block">
{:widget('manager.upload/image', ["imgSize" => "750*230"])}
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">手机端栏目banner</label>
<div class="layui-input-block">
{:widget('manager.upload/image',["append"=>"_mobile", "imgSize" => "750*230"])}
</div>

View File

@ -78,15 +78,29 @@ if(!empty($item['width']) && is_int($item['width']) && $item['width'] > 0 && !em
</div>
</div>
<div class="layui-form-item {if $item['parent_id'] != 0}layui-hide{/if}">
<label class="layui-form-label" >导航背景PC</label>
<div class="layui-input-block">
{:widget('manager.upload/image',['append' => '_bg','src' => $item['bg']?:'', 'imgSize' => '1920*90'])}
</div>
</div>
<div class="layui-form-item {if $item['parent_id'] != 0}layui-hide{/if}">
<label class="layui-form-label">导航背景手机端</label>
<div class="layui-input-block">
{:widget('manager.upload/image',["append"=>"_bg_mobile",'src' => $item['bg_mobile']?:'', "imgSize" => "750*90"])}
</div>
</div>
<div class="layui-form-item layui-hide">
<label class="layui-form-label" >栏目封面图</label>
<label class="layui-form-label" >PC栏目banner</label>
<div class="layui-input-block">
{:widget('manager.upload/image',['src' => $item['src']??'', 'imgSize' => $imgSize])}
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">手机端栏目封面图</label>
<label class="layui-form-label">手机端栏目banner</label>
<div class="layui-input-block">
{:widget('manager.upload/image',["append"=>"_mobile",'src' => $item['src_mobile']??'', "imgSize" => "750*230"])}
</div>

View File

@ -37,6 +37,15 @@ use app\model\Category as VCategory;
<!-- </div>-->
<!-- </div>-->
<div class="layui-inline">
<div class="layui-inline" >
<div class="layui-input-inline">
<select name="is_prev">
<option value="" >全部</option>
<option value="1" {if $Request.param.is_prev == 1}selected{/if}>活动预告</option>
<option value="0" {if $Request.param.is_prev == 0}selected{/if}>非活动预告</option>
</select>
</div>
</div>
<div class="layui-inline" >
<div class="layui-input-inline">
<input type="text" name="keyword" value="{$keyword??''}" class="layui-input search-input" placeholder="请输入关键字"/>
@ -56,14 +65,17 @@ use app\model\Category as VCategory;
<table class="layui-table layui-form layui-table-nobrder" id="check_box">
<colgroup>
<col width="15px" >
{if $category.id!=5}
{if !in_array($category.id, [5, 37])}
<col width="75px">
{/if}
{if $category.id!=42}
{if !in_array($category.id, [42, 37])}
<col width="75px">
{/if}
<col >
<!-- <col width="75px">-->
{if in_array($category.id, [37])}
<col width="">
{/if}
<col width="145px">
<col width="75px">
{if !empty($attributeList)}
@ -75,13 +87,19 @@ use app\model\Category as VCategory;
</colgroup>
<thead>
<td><input type="checkbox" lay-skin="primary" lay-filter="parents-table" title=""/></td>
{if $category.id!=5}
{if !in_array($category.id, [5, 37])}
<td>封面</td>
{/if}
{if $category.id!=42}
{if !in_array($category.id, [42, 37])}
<td>手机封面</td>
{/if}
<td>标题</td>
{switch $category.id}
{case 37}<td>年份</td>{/case}
{default /}<td>标题</td>
{/switch}
{if in_array($category.id, [37])}
<td>月份</td>
{/if}
<!-- <td>点击量</td>-->
<td>创建日期</td>
<td>排序</td>
@ -97,14 +115,14 @@ use app\model\Category as VCategory;
{foreach name="list" item="item"}
<tr class="select_box table-lv1" data-id="{$item.id}" data-category-id="{$category.id}" data-url="{:url('manager.article/sort', ['category_id'=>$category['id']])}">
<td><input type="checkbox" name="checkbox" value="{$item.id}" lay-skin="primary" lay-filter="childrens-table"/></td>
{if $category.id!=5}
{if !in_array($category.id, [5, 37])}
<td class="layer-photos">
{if !empty($item['src']) && file_exists('.' . $item['src'])}
<img src="{:CImage::getThumb($item.src, 50, 50)}" layer-src="{$item.src}" width="50" />
{/if}
</td>
{/if}
{if $category.id!=42}
{if !in_array($category.id, [42, 37])}
<td class="layer-photos">
{if !empty($item['src_mobile']) && file_exists('.' . $item['src_mobile'])}
<img src="{:CImage::getThumb($item.src_mobile, 50, 50)}" layer-src="{$item.src_mobile}" width="50" />
@ -112,7 +130,10 @@ use app\model\Category as VCategory;
</td>
{/if}
<td><a class="layui-btn layui-btn-title" data-state="edit" data-href="{:url('manager.article/edit',['id' => $item['id']])}" title="编辑">{$item.title}</a></td>
<!-- <td>{$item.views}</td>-->
{if in_array($category.id, [37])}
<td>{$item.sub_title}</td>
{/if}
<!-- <td>{$item.views}</td>-->
<td>{$item.create_time|date='Y-m-d'}</td>
<td>{$item.sort}</td>
{if !empty($attributeList)}

View File

@ -35,7 +35,7 @@
<script type="text/javascript">
var _token = $('#token').attr('content');
var page = 1;
$(document).on("click",".layer-photos",function(e){
layer.photos({
photos: { "data": [{"src": e.target.src}] }
@ -65,7 +65,7 @@
});
}
,before: function(obj){
layer.load();
layer.load();
}
,done: function(res, index, upload){
var imgInput = "#picker{$append}";
@ -130,11 +130,11 @@
}
},
error:function(xhr,type,errorThrown){
}
});
})
});
});
function imgUrl(obj){
@ -181,10 +181,10 @@
}
},
error:function(xhr,type,errorThrown){
}
});
}
function imgdel(obj){
$(obj).closest('.upload-image-box').find('.picker-file-value').val('');

View File

@ -1,7 +1,7 @@
{php}
use app\service\Image as WImage;
{/php}
<div class="upload-image-box">
<div class="upload-image-box" xmlns="http://www.w3.org/1999/html">
<input type="hidden" class="append-val" value="{$append}">
<div id="upload_img_list{$append}" class="upload_img_list">
{if !empty($imgs)}
@ -26,7 +26,11 @@ use app\service\Image as WImage;
</div>
<div class="info">
{foreach $fields as $name => $desc}
{if $name == 'desc'}
<textarea class="layui-textarea" name="img{$append}[{$k}][{$name}]" placeholder="{$desc}">{$img[$name] ?? ''}</textarea>
{else}
<input type="text" class="layui-input" name="img{$append}[{$k}][{$name}]" value="{$img[$name] ?? ''}" placeholder="{$desc}" />
{/if}
{/foreach}
</div>
</dd>
@ -149,7 +153,7 @@ use app\service\Image as WImage;
if(data.data.length > 0){
html += '<div class="layui-card-body"><div class="serverImgsList"><ul id="selectable">'
$.each(data.data,function(i,item){
html += '<li><img src="'+item.src+'" data-box="upload_img_list{$append}" data-append="{$append}" data-field="{:json_encode($fields)}" onclick="imgListUrl(this, ' + numid + ')"></li>'
html += '<li><img src="'+item.src+'" data-box="upload_img_list{$append}" data-field="{$fieldsJson}" data-append="{$append}" onclick="imgListUrl(this, ' + numid + ')"></li>'
})
html += '</ul></div>';
if(data.data.length >= 30){
@ -187,11 +191,15 @@ use app\service\Image as WImage;
});
function imgListUrl(obj, numid){
let append = $(obj).data('append');
let fields = $(obj).data('fields');
let fields = {:json_encode($fields, 256)};
let fieldsHtml = '';
$.each(fields, function (index, item) {
fieldsHtml += `<input type="text" class="layui-input" name="img${append}[${numid}][${item.name}]" value="${item.name}" placeholder="${item.desc}" />`;
})
for (let key in fields) {
if (key == 'desc') {
fieldsHtml += `<textarea class="layui-textarea" name="img${append}[${numid}][${key}]" placeholder="${fields[key]}" ></textarea>`;
} else {
fieldsHtml += `<input type="text" class="layui-input" name="img${append}[${numid}][${key}]" value="" placeholder="${fields[key]}" />`;
}
}
var imTpl = '<dd class="item_img" id="img_' + numid +'">'+
'<div class="imgs"><div class="operate"><i onclick="UPLOAD_IMG_DEL(this)" class="close layui-icon"></i></div>'+
'<img src="' + $(obj).attr('src') +'"></div>'+

View File

@ -4,6 +4,27 @@ use app\model\Article;
use app\model\Category;
$childrenMenu = Category::getChildrenByParentId(Category::CATEGORY_COMPANY);
$items = Article::getList(Category::CATEGORY_COMPANY_EVENT, 1000);
$items = $items->toArray();
$items = $items['data'];
$years = array_unique(array_column($items, 'title'));
rsort($years);
$yearList = [];
foreach ($items as $item) {
foreach($years as $year) {
if (!isset($yearList[$item['title']])) {
$yearList[$item['title']] = [];
}
if (!isset($yearList[$item['title']][$item['sub_title']])) {
$yearList[$item['title']][$item['sub_title']] = [];
}
$yearList[$item['title']][$item['sub_title']] = $item;
}
}
//dd($yearList[2022]);exit;
{/php}
{include file="public/about_second" /}
@ -25,25 +46,27 @@ $items = Article::getList(Category::CATEGORY_COMPANY_EVENT, 1000);
</div>
<div class="history-swiper swiper">
<div class="swiper-wrapper">
{foreach $items as $item}
<div class="swiper-slide flex">
{foreach $yearList as $year => $months}
<div class="swiper-slide1 flex">
<div class="history-time">
<p class="bg-col-blue color-white">{$item.title ?? ''}</p>
<p class="bg-col-blue color-white">{$year ?? ''}</p>
<span><em></em></span>
</div>
<div class="history-txt">
{php}
$list = nl2br($item['summary']);
$list = explode('<br />', $list);
{/php}
{foreach $list as $val}
{php}
$strExplode = explode(' ', $val, 2);
$month = count($strExplode) > 1 ? $strExplode[0] : '';
$content = count($strExplode) > 1 ? $strExplode[1] : $val;
{/php}
<p><strong>{$month}</strong><span>{$content}</span></p>
{foreach $months as $month => $info}
<p>
<strong>{$month ?? ''}月</strong>
<span>
{php}
$eventList = json_decode($info['imgs'], true);
{/php}
{foreach $eventList as $event}
<span style="cursor: pointer" data-src="{$event.src ?? ''}" class="show-event-img">
{$event.title ??''}
</span><br>
{/foreach}
</span>
</p>
{/foreach}
</div>
</div>
@ -57,13 +80,25 @@ $items = Article::getList(Category::CATEGORY_COMPANY_EVENT, 1000);
</div>
</div>
<div class="img">
{foreach $items as $item}
{if $isMobile}
<span><img src="{$item.src_mobile ?? ''}" alt="{$item.title ?? ''}"></span>
{else /}
<span><img src="{$item.src ?? ''}" alt="{$item.title ?? ''}"></span>
{foreach $yearList as $year => $months}
{foreach $months as $month => $info}
{php}
$eventList = json_decode($info['imgs'], true);
{/php}
{foreach $eventList as $k => $event}
{if ($k == 0) }
<span><img id="event-img" src="{$event.src ?? ''}" alt="{$event.title ?? ''}"></span>
{php}break;{/php}
{/if}
{/foreach}
{/foreach}
{/foreach}
</div>
</div>
</div>
</div>
<script>
$('body').on('click', '.show-event-img',function () {
let src = $(this).attr('data-src');
$('#event-img').attr('src', src);
})
</script>

View File

@ -1,7 +1,7 @@
<div class="pull-banner w100 wap-show"><img src="{$categoryPath[0]['src_mobile'] ?: ''}" alt="{$categoryPath[0]['title'] ?? ''}"></div>
<!-- 当前位置&二级导航 -->
<div class="position-nav-bg pull-margin bg-col-f5"><!-- position-nav-bg01 -->
<div class="position-nav-bg pull-margin bg-col-f5 {if $category['parent_id'] == 8} position-nav-bg01 {/if}"><!-- position-nav-bg01 -->
<div class="position-sub-nav w1360 flex">
<!-- 当前位置 -->
<div class="position flex pc-show">

View File

@ -1,10 +1,29 @@
{php}
use app\model\Category;
// 一级栏目的banner
$firstCategoryId = Category::firstGradeId($category['path'], $category['id']);
if ($firstCategoryId == $category['id']) {
$bg_pc = $category['bg'];
$bg_mobile = $category['bg_mobile'];
} else {
$firstCategory = Category::where('id', $firstCategoryId)->field('id,title,bg,bg_mobile')->find();
$bg_pc = $firstCategory['bg'];
$bg_mobile = $firstCategory['bg_mobile'];
}
$bgImg = $isMobile? $bg_mobile : $bg_pc;
$bgImg = trim($bgImg);
$defaultBg = request()->controller() == 'Index' ? '' : '/static/web/images/public/header-bg.jpg';
$bgImg = $bgImg ?: $defaultBg;
{/php}
<!-- 头部 -->
<div class="header {$Request.controller == 'Index' ? 'no-background' : ''} w100">
<div class="header {$Request.controller == 'Index' ? 'no-background' : ''} w100" style="background-image:url({$bgImg})">
<!-- logo&导航 -->
<div class="head flex w1360">
<div class="logo"><a href="/"><img src="http://zzwy2.scdxtc.cn{$system['img_logo']}" alt="{$system['company_name']}"></a></div>
<div class="logo"><a href="/"><img src="{$system['img_logo']}" alt="{$system['company_name']}"></a></div>
<div class="nav flex">
<span><img src="http://zzwy2.scdxtc.cn{$system['img_logo']}" alt="{$system['company_name']}"></span>
<span><img src="{$system['img_logo']}" alt="{$system['company_name']}"></span>
{foreach $menus as $menusitem}
<div class="nav-item {if $topCategoryId == $menusitem['id']} active {/if}">
<a href="{:getUri($menusitem)}">{$menusitem['title']}</a>