master
parent
cf99120dba
commit
ab4f24febe
|
@ -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'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
$whereMap = [];
|
||||
$pageParam = [];
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@
|
|||
<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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -153,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-field="{:json_encode($fields)}" data-append="{$append}" 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){
|
||||
|
|
|
@ -1,10 +1,28 @@
|
|||
{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);
|
||||
$bgImg = $bgImg ?: '/static/web/images/public/header-bg.jpg';
|
||||
{/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>
|
||||
|
|
Loading…
Reference in New Issue