refactor(导航): 导航背景 后台修改为统一一个地方设置

master
yin5th 2022-11-14 10:24:20 +08:00
parent df31d2f384
commit d87018d8a1
3 changed files with 28 additions and 14 deletions

View File

@ -2,8 +2,10 @@
return array ( return array (
'company_name' => '鄂尔多斯市中正物业管理有限公司', 'company_name' => '鄂尔多斯市中正物业管理有限公司',
'image' => '', 'image' => '',
'img_logo' => '/storage/20221009/63423cf817221.png', 'img_logo' => '/storage/20221103/6363180ef2e94.png',
'img_logo_m' => '/storage/20221009/63423cf817221.png', 'img_logo_m' => '/storage/20221009/63423cf817221.png',
'img_bg_pc' => '',
'img_bg_mobile' => '',
'tel' => '400-000-00001', 'tel' => '400-000-00001',
'landline' => '400-852-1199', 'landline' => '400-852-1199',
'email' => 'zzwy@bymk.net', 'email' => 'zzwy@bymk.net',

View File

@ -21,6 +21,18 @@
{:widget('manager.upload/image',['append' => '_logo_m','src' => $item.img_logo_m??'', 'imgSize' => '200px x 80px', 'className'=>'uploadImgShow2'])} {:widget('manager.upload/image',['append' => '_logo_m','src' => $item.img_logo_m??'', 'imgSize' => '200px x 80px', 'className'=>'uploadImgShow2'])}
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">PC端导航背景</label>
<div class="layui-input-block">
{:widget('manager.upload/image',['append' => '_bg_pc','src' => $item.img_bg_pc??'', 'imgSize' => '1920px x 90px', 'className'=>'uploadImgShow2'])}
</div>
</div>
<div class="layui-form-item layui-hide">
<label class="layui-form-label">手机端导航背景</label>
<div class="layui-input-block">
{:widget('manager.upload/image',['append' => '_bg_mobile','src' => $item.img_bg_mobile??'', 'imgSize' => '750px x 90px', 'className'=>'uploadImgShow2'])}
</div>
</div>
<div class="layui-form-itemBox2 between-center layui-hide"> <div class="layui-form-itemBox2 between-center layui-hide">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">电话</label> <label class="layui-form-label">电话</label>

View File

@ -1,21 +1,21 @@
{php} {php}
use app\model\Category; //use app\model\Category;
// 一级栏目的banner // 一级栏目的banner
$firstCategoryId = Category::firstGradeId($category['path'], $category['id']); //$firstCategoryId = Category::firstGradeId($category['path'], $category['id']);
if ($firstCategoryId == $category['id']) { //if ($firstCategoryId == $category['id']) {
$bg_pc = $category['bg']; //$bg_pc = $category['bg'];
$bg_mobile = $category['bg_mobile']; //$bg_mobile = $category['bg_mobile'];
} else { //} else {
$firstCategory = Category::where('id', $firstCategoryId)->field('id,title,bg,bg_mobile')->find(); //$firstCategory = Category::where('id', $firstCategoryId)->field('id,title,bg,bg_mobile')->find();
$bg_pc = $firstCategory['bg']; //$bg_pc = $firstCategory['bg'];
$bg_mobile = $firstCategory['bg_mobile']; //$bg_mobile = $firstCategory['bg_mobile'];
} //}
$bgImg = $isMobile? $bg_mobile : $bg_pc; $bgImg = $isMobile? $system['img_bg_mobile'] : $system['img_bg_pc'];
$bgImg = trim($bgImg); $bgImg = trim($bgImg);
$defaultBg = request()->controller() == 'Index' ? '' : '/static/web/images/public/header-bg.jpg'; $defaultBg = '/static/web/images/public/header-bg.jpg';
$bgImg = $bgImg ?: $defaultBg; $bgImg = request()->controller() == 'Index' ? '' : ($bgImg ?: $defaultBg);
{/php} {/php}
<!-- 头部 --> <!-- 头部 -->
<div class="header {$Request.controller == 'Index' ? 'no-background' : ''} w100" style="background-image:url({$bgImg})"> <div class="header {$Request.controller == 'Index' ? 'no-background' : ''} w100" style="background-image:url({$bgImg})">