更新:修复后台内容管理导航面包屑显示错误的bug

virtual
zwesy 2020-11-26 15:45:31 +08:00
parent 2b6ad4fe1f
commit 37f09c42de
3 changed files with 14 additions and 13 deletions

View File

@ -123,22 +123,23 @@ class Category extends Base
$category->save();
}
//递归获取上级栏目名称
//递归获取栏目名称面包屑
public static function getCatesCrumbs($currentId = 0)
{
$crumbs = [];
$category = self::getById($currentId);
if($category['parent_id'] == 0){
$cateCrumbs[] = $category['title'];
}else{
$categoryIds = explode(',', trim($category['path'], ','));
$categories = self::where('id', 'in', $categoryIds)->column('*', 'id');
foreach($categoryIds as $id){
if(isset($categories[$id])){
$crumbs[] = $categories[$id]['title'];
}
}
}
if($category) {
if($category['parent_id'] != 0){
$categoryIds = explode(',', trim($category['path'], ','));
$categories = self::where('id', 'in', $categoryIds)->column('*', 'id');
foreach($categoryIds as $id){
if(isset($categories[$id])){
$crumbs[] = $categories[$id]['title'];
}
}
}
$crumbs[] = $category['title'];
}
return $crumbs;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

View File

@ -137,7 +137,7 @@
'" controls="controls" width="260">您的浏览器不支持 video 标签。</video>' +
'</div><hr />';
$('#'+$(obj).attr('data-box')).html(imTpl);
$('#'+$(obj).attr('data-input')).val($(obj).attr('src'));
$('#'+$(obj).attr('data-input')).val($(obj).attr('data-src'));
parent.layer.close($(obj).attr('data-id'));
$(window).trigger("resize");
}