导航添加支持选择页面设计

This commit is contained in:
gongfuxiang 2022-04-19 20:37:55 +08:00
parent 2b58cb510d
commit 0f98fe4b06
4 changed files with 88 additions and 0 deletions

View File

@ -14,6 +14,7 @@ use app\service\ArticleService;
use app\service\NavigationService; use app\service\NavigationService;
use app\service\GoodsService; use app\service\GoodsService;
use app\service\CustomViewService; use app\service\CustomViewService;
use app\service\DesignService;
/** /**
* 导航管理 * 导航管理
@ -80,6 +81,10 @@ class Navigation extends Common
$custom_view = CustomViewService::CustomViewList(['where'=>['is_enable'=>1], 'field'=>'id,title', 'n'=>0]); $custom_view = CustomViewService::CustomViewList(['where'=>['is_enable'=>1], 'field'=>'id,title', 'n'=>0]);
MyViewAssign('customview_list', $custom_view['data']); MyViewAssign('customview_list', $custom_view['data']);
// 页面设计
$design_view = DesignService::DesignList(['where'=>['is_enable'=>1], 'field'=>'id,name', 'n'=>0]);
MyViewAssign('design_list', $design_view['data']);
MyViewAssign('nav_type', $this->nav_type); MyViewAssign('nav_type', $this->nav_type);
return MyView(); return MyView();
} }

View File

@ -24,6 +24,9 @@
<li> <li>
<button type="button" class="am-btn am-btn-link am-btn-xs am-btn-block am-text-left am-padding-horizontal-sm am-icon-plus submit-add" data-am-modal="{target: '#nav-goods_category-save-win'}" data-tag="nav-goods_category-save-win"> 商品分类</button> <button type="button" class="am-btn am-btn-link am-btn-xs am-btn-block am-text-left am-padding-horizontal-sm am-icon-plus submit-add" data-am-modal="{target: '#nav-goods_category-save-win'}" data-tag="nav-goods_category-save-win"> 商品分类</button>
</li> </li>
<li>
<button type="button" class="am-btn am-btn-link am-btn-xs am-btn-block am-text-left am-padding-horizontal-sm am-icon-plus submit-add" data-am-modal="{target: '#nav-design-save-win'}" data-tag="nav-design-save-win"> 页面设计</button>
</li>
</ul> </ul>
</div> </div>
@ -248,4 +251,55 @@
</div> </div>
</div> </div>
<!-- goods_category save win end --> <!-- goods_category save win end -->
<!-- design save win start -->
<div class="am-popup am-radius" id="nav-design-save-win">
<div class="am-popup-inner">
<div class="am-popup-hd">
<h4 class="am-popup-title" data-add-title="页面设计导航添加" data-edit-title="页面设计导航编辑">页面设计导航添加</h4>
<span data-am-modal-close class="am-close">&times;</span>
</div>
<div class="am-popup-bd">
<!-- form start -->
<form class="am-form form-validation-design" action="{{:MyUrl('admin/navigation/save')}}" method="POST" request-type="ajax-reload" request-value="">
<div class="am-form-group">
<label>导航级别</label>
<select class="am-radius chosen-select" name="pid" data-placeholder="一级栏目..." data-placeholder="一级栏目..." data-validation-message="导航级别选择错误">
<option value="">一级栏目...</option>
{{foreach $nav_header_pid_list as $v}}
<option value="{{$v.id}}">{{$v.name}}</option>
{{/foreach}}
</select>
</div>
<div class="am-form-group">
<label>页面设计</label>
<select class="am-radius chosen-select" name="value" data-placeholder="请选择..." data-validation-message="页面设计选择有误" required>
<option value="">请选择...</option>
{{foreach $design_list as $v}}
<option value="{{$v.id}}">{{$v.name}}</option>
{{/foreach}}
</select>
</div>
<div class="am-form-group">
<label>导航名称<span class="am-form-group-label-tips">默认页面设计名称</span></label>
<input type="text" placeholder="导航名称" name="name" maxlength="16" data-validation-message="导航名称格式 2~16 个字符" class="am-radius" />
</div>
<div class="am-form-group">
<label>顺序</label>
<input type="number" placeholder="顺序" name="sort" min="0" max="255" data-validation-message="顺序 0~255 之间的数值" class="am-radius" value="0" required />
</div>
{{include file="lib/is_show" /}}
{{include file="lib/is_new_window_open" /}}
<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-horizontal-0">
<input type="hidden" name="id" />
<input type="hidden" name="data_type" value="design" />
<input type="hidden" name="nav_type" value="{{$nav_type}}" />
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
</div>
</form>
<!-- form end -->
</div>
</div>
</div>
<!-- design save win end -->
{{/block}} {{/block}}

View File

@ -193,6 +193,11 @@ class NavigationService
case 'goods_category': case 'goods_category':
$v['url'] = MyUrl('index/search/index', ['category_id'=>$v['value']]); $v['url'] = MyUrl('index/search/index', ['category_id'=>$v['value']]);
break; break;
// 页面设计
case 'design':
$v['url'] = MyUrl('index/design/index', ['id'=>$v['value']]);
break;
} }
$data[$k] = $v; $data[$k] = $v;
} }
@ -420,6 +425,24 @@ class NavigationService
]; ];
break; break;
// 页面设计导航
case 'design':
$p = [
[
'checked_type' => 'length',
'key_name' => 'name',
'checked_data' => '2,16',
'is_checked' => 1,
'error_msg' => '导航名称格式 2~16 个字符',
],
[
'checked_type' => 'empty',
'key_name' => 'value',
'error_msg' => '页面设计选择有误',
],
];
break;
// 没找到 // 没找到
default : default :
return DataReturn('操作类型有误', -1); return DataReturn('操作类型有误', -1);
@ -468,6 +491,11 @@ class NavigationService
case 'goods_category': case 'goods_category':
$temp_name = Db::name('GoodsCategory')->where(['id'=>$params['value']])->value('name'); $temp_name = Db::name('GoodsCategory')->where(['id'=>$params['value']])->value('name');
break; break;
// 页面设计导航
case 'design':
$temp_name = Db::name('Design')->where(['id'=>$params['value']])->value('name');
break;
} }
// 只截取16个字符 // 只截取16个字符
$params['name'] = mb_substr($temp_name, 0, 16, MyConfig('shopxo.default_charset')); $params['name'] = mb_substr($temp_name, 0, 16, MyConfig('shopxo.default_charset'));

View File

@ -4,6 +4,7 @@ $(function()
FromInit('form.form-validation-article'); FromInit('form.form-validation-article');
FromInit('form.form-validation-customview'); FromInit('form.form-validation-customview');
FromInit('form.form-validation-goods_category'); FromInit('form.form-validation-goods_category');
FromInit('form.form-validation-design');
/** /**
* 添加 * 添加