Compare commits
38 Commits
b57cb8dfd6
...
ozq-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d8e22d270 | ||
|
|
f154f3ddf6 | ||
|
|
2073a27ef7 | ||
|
|
e301fc7e94 | ||
|
|
f9251d944e | ||
|
|
1e6187801d | ||
|
|
346dcebba3 | ||
| ab7b23e5d1 | |||
| 325221bd67 | |||
|
|
721e91dc31 | ||
|
|
12e51c6f46 | ||
|
|
8ba9006173 | ||
|
|
a7d413871b | ||
|
|
ce6a882c17 | ||
|
|
7e7cfeacbc | ||
|
|
e1961d2a83 | ||
|
|
d313617e2b | ||
|
|
f0c82c848f | ||
|
|
f606dc64a5 | ||
|
|
39dc3c4e1a | ||
|
|
52b265f36e | ||
|
|
5f9fb74696 | ||
|
|
b251c78b2f | ||
|
|
2e1c83d46d | ||
|
|
0265cb0629 | ||
|
|
68d66b2925 | ||
|
|
601403bf3e | ||
|
|
bbe2197b38 | ||
|
|
ee955a3674 | ||
|
|
e45df84312 | ||
|
|
4e0891da97 | ||
|
|
f9b895732e | ||
|
|
e72ecd55f4 | ||
|
|
558b418d18 | ||
|
|
78cbc5de6e | ||
|
|
f7b610df72 | ||
|
|
b1522a365b | ||
|
|
48906ec9cd |
@@ -192,6 +192,8 @@ class TopicNas extends Common
|
||||
{
|
||||
// 获取文章分类及文章数据
|
||||
$parent = ArticleCategoryModel::uniqueLabel('CATEGORY_681182e0a4529')->language($this->lang_id)->value('id');
|
||||
$parent_two = ArticleCategoryModel::parent($parent)->language($this->lang_id)->column('id');//二级分类id
|
||||
array_push($parent_two,$parent);
|
||||
$article_categorys = ArticleCategoryModel::with(['article' => function($query) {
|
||||
$query->field(['id', 'title', 'category_id'])
|
||||
->order(['sort' => 'asc', 'id' => 'desc'])
|
||||
@@ -199,15 +201,48 @@ class TopicNas extends Common
|
||||
}])
|
||||
->field([
|
||||
'id',
|
||||
'pid',
|
||||
'name',
|
||||
'icon'
|
||||
])
|
||||
->language($this->lang_id)
|
||||
->parent($parent)
|
||||
// ->parent($parent)
|
||||
->parentChild($parent_two)
|
||||
->isShow(true)
|
||||
->order(['sort' => 'asc', 'id' => 'desc'])
|
||||
->select();
|
||||
View::assign('article_categorys', $article_categorys);
|
||||
//查询三级分类
|
||||
$article_categorys_new = [];
|
||||
$article_categorys_two = [];
|
||||
// dump($article_categorys->toArray());exit;
|
||||
if (!$article_categorys->isEmpty()) {
|
||||
foreach ($article_categorys->toArray() as $kk=>$vv) {
|
||||
if ( $parent == $vv['pid'] ) {
|
||||
array_push($article_categorys_new,$vv);
|
||||
} else {
|
||||
$article_categorys_two[$vv['pid']][] = $vv;
|
||||
}
|
||||
}
|
||||
if ( !empty($article_categorys_two) ) {
|
||||
foreach ($article_categorys_new as &$vvv) {
|
||||
$articles = $vvv['article'];
|
||||
if ( isset($article_categorys_two[$vvv['id']]) ) {
|
||||
foreach ($article_categorys_two[$vvv['id']] as $v) {
|
||||
foreach ($v['article'] as $av) {
|
||||
if ( count($articles) < 3 ) {
|
||||
array_push($articles,$av);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$vvv['article'] = $articles;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
View::assign('article_categorys', $article_categorys_new);
|
||||
// View::assign('article_categorys', $article_categorys);
|
||||
|
||||
$contacts = [];
|
||||
// 获取banner数据
|
||||
@@ -268,20 +303,21 @@ class TopicNas extends Common
|
||||
$article_categorys_new = [];
|
||||
$article_categorys_two = [];
|
||||
if (!$article_categorys->isEmpty()) {
|
||||
foreach ($article_categorys as $kk=>$vv) {
|
||||
if ( $parent == $vv->pid ) {
|
||||
foreach ($article_categorys->toArray() as $kk=>$vv) {
|
||||
if ( $parent == $vv['pid'] ) {
|
||||
$vv['child'] = '';
|
||||
array_push($article_categorys_new,$vv);
|
||||
} else {
|
||||
$article_categorys_two[$vv->pid][] = $vv;
|
||||
$article_categorys_two[$vv['pid']][] = $vv;
|
||||
}
|
||||
}
|
||||
if ( !empty($article_categorys_two) ) {
|
||||
foreach ($article_categorys_new as &$vvv) {
|
||||
$vvv['child'] = isset($article_categorys_two[$vvv->id])?$article_categorys_two[$vvv->id]:'';
|
||||
$vvv['child'] = isset($article_categorys_two[$vvv['id']])?$article_categorys_two[$vvv['id']]:'';
|
||||
}
|
||||
}
|
||||
}
|
||||
// dump($article_categorys_new);
|
||||
// dump($article_categorys_new);exit;
|
||||
// dump($article_categorys_two);exit;
|
||||
|
||||
View::assign('article_categorys', $article_categorys_new);
|
||||
@@ -342,8 +378,18 @@ class TopicNas extends Common
|
||||
->language($this->lang_id)
|
||||
->where('category_id', 'IN', array_column($categorys, 'id'))
|
||||
->select();
|
||||
//查询上级id
|
||||
$parent_two = ArticleCategoryModel::parentColumn(array_column($categorys, 'id'))->language($this->lang_id)->column('pid','id');//二级分类id
|
||||
$articles_data = $articles->toArray();
|
||||
foreach ($articles_data as &$v) {
|
||||
$v['pid'] = 0;
|
||||
if ( $parent_two[$v['category_id']] !== $parent ) {
|
||||
$v['pid'] = $v['category_id'];
|
||||
$v['category_id'] = $parent_two[$v['category_id']];
|
||||
}
|
||||
}
|
||||
|
||||
return success('success', $articles->toArray());
|
||||
return success('success', $articles_data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -56,6 +56,16 @@ class ArticleCategoryModel extends ArticleCategoryBaseModel
|
||||
$query->where('pid', '=', $parent);
|
||||
}
|
||||
|
||||
// 所属上级分类查询
|
||||
public function scopeParentColumn($query, $parent)
|
||||
{
|
||||
if (is_array($parent)) {
|
||||
$query->where('id', 'IN', $parent);
|
||||
return;
|
||||
}
|
||||
$query->where('id', '=', $parent);
|
||||
}
|
||||
|
||||
|
||||
// 所属子分类范围查询
|
||||
public function scopeChild($query, $id, $merge_self = false)
|
||||
|
||||
@@ -58,37 +58,7 @@
|
||||
{notempty name="article_categorys"}
|
||||
<div class="nav-tree">
|
||||
|
||||
<!-- start 三级菜单测试用例 可删-->
|
||||
<div class="categoryhelp">
|
||||
<div class="categoryhelp-title">
|
||||
<div><img src="__IMAGES__/nars-jt.png" class="arrow">
|
||||
</div>
|
||||
<span>初次使用</span>
|
||||
</div>
|
||||
<ul class="sub-list">
|
||||
<li class="two-mues">
|
||||
<a href="/mobile/tops_nas/helper_detail/id/1638.html" class="two-a">
|
||||
<div><img src="__IMAGES__/nars-jt.png"
|
||||
class="arrow">
|
||||
</div>
|
||||
<span>我是2级</span>
|
||||
</a>
|
||||
<ul class="thress-mues">
|
||||
<li>
|
||||
<a href="/mobile/tops_nas/helper_detail/id/1635.html"
|
||||
style="margin-left:18%;padding: 0.4rem;">我是三级</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/mobile/tops_nas/helper_detail/id/1635.html">如何将我的NAS设备分享给他人使用?</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/mobile/tops_nas/helper_detail/id/1639.html">设备安装中常见的问题</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- end 三级菜单测试用例 可删-->
|
||||
|
||||
{volist name="article_categorys" id="ac" key="idx"}
|
||||
<div class="categoryhelp">
|
||||
<div class="categoryhelp-title">
|
||||
@@ -99,6 +69,24 @@
|
||||
<span>{$ac.name}</span>
|
||||
</div>
|
||||
<ul class="sub-list" {if condition='$ac.id == $Request.get.cid' }style="display: block;" {/if}>
|
||||
{volist name="ac.child" id="ad"}
|
||||
<li class="two-mues">
|
||||
<a href="#" class="two-a">
|
||||
<div><img src="__IMAGES__/nars-jt.png"
|
||||
class="arrow {if condition='$ad.id == $Request.get.pid'}rotate{/if}">
|
||||
</div>
|
||||
<span>{$ad.name}</span>
|
||||
</a>
|
||||
<ul class="thress-mues" {if condition='$ad.id == $Request.get.pid' }style="display: block;" {/if}>
|
||||
{volist name="ad.article" id="ae"}
|
||||
<li>
|
||||
<a href="{:url('/index/topic/nas/help_detail', ['cid' => $ac.id ,'pid' => $ad.id, 'id' => $ae.id])}"
|
||||
style="margin-left:18%;padding: 0.4rem;">{$ae.title}</a>
|
||||
</li>
|
||||
{/volist}
|
||||
</ul>
|
||||
</li>
|
||||
{/volist}
|
||||
{volist name="ac.article" id="ar"}
|
||||
<li>
|
||||
<a href="{:url('/index/topic/nas/help_detail', ['cid' => $ac.id , 'id' => $ar.id])}"
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
</div>
|
||||
<div class="nhlp-tx-list">
|
||||
{volist name="vo.article" id="va" key="index"}
|
||||
<a class="txrow" href="{:url('/index/topic/nas/help_detail', ['cid' => $vo.id, 'id' => $va.id])}">
|
||||
<a class="txrow" href="{:url('/index/topic/nas/help_detail', ['pid' => $va.category_id,'cid' => $vo.id, 'id' => $va.id])}">
|
||||
<div class="nhlp-point"></div>
|
||||
<span class="nhlpsp">{$va.title}</span>
|
||||
<span class="narhelpgoimg">
|
||||
@@ -41,7 +41,7 @@
|
||||
</a>
|
||||
{/volist}
|
||||
{if condition="count($vo.article) >= 3"}
|
||||
<a class="ckgdbt" href="{:url('/index/topic/nas/help_detail', ['cid' => $vo.id, 'id' => isset($vo.article[0])?$vo.article[0]['id']:0])}">
|
||||
<a class="ckgdbt" href="{:url('/index/topic/nas/help_detail', ['cid' => $vo.id, 'id' => isset($vo.article[0])?$vo.article[0]['id']:0,'pid' => isset($vo.article[0])?$vo.article[0]['category_id']:0])}">
|
||||
{:lang_i18n('查看更多')} >
|
||||
</a>
|
||||
{/if}
|
||||
|
||||
@@ -33,64 +33,41 @@
|
||||
{notempty name="article_categorys"}
|
||||
<div class="nav-tree">
|
||||
|
||||
<!-- start 三级菜单的测试代码 可删-->
|
||||
<!-- start 三级菜单 -->
|
||||
{volist name="article_categorys" id="ac"}
|
||||
<div class="category">
|
||||
<!-- 一级 -->
|
||||
<div class="category-title">
|
||||
<div class="arrow {if condition='$ac.id == $Request.get.cid'}rotate{/if}"><img src="__IMAGES__/nars-jt.png" class="arrow {if condition='$ac.id == $Request.get.cid'}rotate{/if}" /></div>
|
||||
<div class="arrow {if condition='$ac.id == $Request.get.cid'}rotate{/if}"><img src="__IMAGES__/nas-jt.png" class="arrow {if condition='$ac.id == $Request.get.cid'}rotate{/if}" /></div>
|
||||
<span>{$ac.name}</span>
|
||||
</div>
|
||||
<!-- 二级-->
|
||||
<ul class="sub-list" {if condition='$ac.id == $Request.get.cid' }style="display: block;" {/if}>
|
||||
{volist name="ac.article" id="ar"}
|
||||
{if condition='!empty($ac.child)' }
|
||||
{volist name="ac.child" id="ad"}
|
||||
<li class="two-mues">
|
||||
<a href="#" class="two-a">
|
||||
<div class="arrow"><img src="__IMAGES__/nars-jt.png" class="arrow" /></div>
|
||||
<span>{$ar.title}</span>
|
||||
<div class="arrow {if condition='$ad.id == $Request.get.pid'}rotate{/if}"><img src="__IMAGES__/nas-jt.png" class="arrow {if condition='$ad.id == $Request.get.pid'}rotate{/if}" /></div>
|
||||
<span>{$ad.name}</span>
|
||||
</a>
|
||||
<ul class="thress-mues">
|
||||
{volist name="ar.article" id="ad"}
|
||||
<li><a href="{:url('/index/topic/nas/help_detail', ['cid' => $ad.id, 'id' => $ad.id])}" style="padding-top: 6px;padding-left: 30px;" {eq
|
||||
name="ad.id" value="$Request.get.id" }class="active" {/eq}>{$ad.title}</a></li>
|
||||
<ul class="thress-mues" {if condition='$ad.id == $Request.get.pid' }style="display: block;" {/if}>
|
||||
{volist name="ad.article" id="ae"}
|
||||
<li><a href="{:url('/index/topic/nas/help_detail', ['cid' => $ac.id,'pid' => $ad.id, 'id' => $ae.id])}" style="padding-top: 6px;padding-left: 30px;" {eq
|
||||
name="ae.id" value="$Request.get.id" }class="active" {/eq}>{$ae.title}</a></li>
|
||||
{/volist}
|
||||
</ul>
|
||||
<!-- 三级-->
|
||||
<!-- 三级-->
|
||||
</li>
|
||||
{/if}
|
||||
{if condition='empty($ac.child)' }
|
||||
{/volist}
|
||||
{volist name="ac.article" id="ar"}
|
||||
<li><a href="{:url('/index/topic/nas/help_detail', ['cid' => $ac.id, 'id' => $ar.id])}" style="padding-top: 6px;" {eq
|
||||
name="ar.id" value="$Request.get.id" }class="active" {/eq}>{$ar.title}</a></li>
|
||||
{/if}
|
||||
{/volist}
|
||||
<!-- <li><a href="#">APP无法下载/下载失败怎么办?</a></li>-->
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
{/volist}
|
||||
<!-- end 三级菜单的测试代码 可删-->
|
||||
<!-- end 三级菜单 -->
|
||||
|
||||
<!-- {volist name="article_categorys" id="ac"}-->
|
||||
<!-- <div class="category">-->
|
||||
<!-- <div class="category-title">-->
|
||||
<!-- <div class="arrow {if condition='$ac.id == $Request.get.cid'}rotate{/if}">-->
|
||||
<!-- <img src="__IMAGES__/nas-jt.png"-->
|
||||
<!-- class="arrow {if condition='$ac.id == $Request.get.cid'}rotate{/if}" />-->
|
||||
<!-- </div>-->
|
||||
<!-- <span>{$ac.name}</span>-->
|
||||
<!-- </div>-->
|
||||
<!-- <ul class="sub-list" {if condition='$ac.id == $Request.get.cid' }style="display: block;" {/if}>-->
|
||||
<!-- {volist name="ac.article" id="ar"}-->
|
||||
<!-- <li>-->
|
||||
<!-- <a href="{:url('/index/topic/nas/help_detail', ['cid' => $ac.id, 'id' => $ar.id])}" {eq-->
|
||||
<!-- name="ar.id" value="$Request.get.id" }class="active" {/eq}>-->
|
||||
<!-- {$ar.title}-->
|
||||
<!-- </a>-->
|
||||
<!-- </li>-->
|
||||
<!-- {/volist}-->
|
||||
<!-- </ul>-->
|
||||
<!-- </div>-->
|
||||
<!-- {/volist}-->
|
||||
</div>
|
||||
{/notempty}
|
||||
</div>
|
||||
@@ -158,7 +135,7 @@
|
||||
html = '<ul>'
|
||||
$.each(r.data, function (k, v) {
|
||||
html +=
|
||||
'<li><a href="{:url(\'/index/topic/nas/help_detail\')}?cid=' + v.category_id + '&id=' + v.id + '">' + v.title + '</a></li>'
|
||||
'<li><a href="{:url(\'/index/topic/nas/help_detail\')}?cid=' + v.category_id + '&id=' + v.id + '&pid=' + v.pid + '">' + v.title + '</a></li>'
|
||||
})
|
||||
html += '</ul>'
|
||||
}
|
||||
|
||||
@@ -135,6 +135,7 @@
|
||||
transform: rotate(0deg);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
|
||||
.narshelpdetailPc .nars-help-content .nars-hlpdt-ml .arrow .nars-jt {
|
||||
|
||||
Reference in New Issue
Block a user