From 89c2b99ab9f7b162b9ce6f42077dbf8692066879 Mon Sep 17 00:00:00 2001
From: zm <zm@iemsoft.cn>
Date: Mon, 14 Sep 2020 13:11:17 +0800
Subject: [PATCH] 按知识点搜索 移动端 开发完成

---
 we254/addons/fy_lessonv2/inc/mobile/search.php                  |   11 ++++++++---
 we254/addons/fy_lessonv2/inc/core/SiteCommon.php                |    2 +-
 we254/addons/fy_lessonv2/template/mobile/default/_footerv2.html |    8 ++++----
 we254/addons/fy_lessonv2/template/mobile/default/search.html    |    6 +++---
 4 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/we254/addons/fy_lessonv2/inc/core/SiteCommon.php b/we254/addons/fy_lessonv2/inc/core/SiteCommon.php
index b5ed273..3bc57d0 100644
--- a/we254/addons/fy_lessonv2/inc/core/SiteCommon.php
+++ b/we254/addons/fy_lessonv2/inc/core/SiteCommon.php
@@ -108,7 +108,7 @@
 					'nav_name'        => '全部课程',
 					'unselected_icon' => MODULE_URL."template/mobile/{$template}/images/unselected_search_icon.png",
 					'selected_icon'   => MODULE_URL."template/mobile/{$template}/images/selected_search_icon.png",
-					'url_link'        => $this->redefineUrl($this->createMobileUrl('search', array('t'=>time()))),
+					'url_link'        => $this->redefineUrl($this->createMobileUrl('search', array('t'=>time(),'searchtype'=>1))),
 				);
 			}
 			if(!$navigation['self']){
diff --git a/we254/addons/fy_lessonv2/inc/mobile/search.php b/we254/addons/fy_lessonv2/inc/mobile/search.php
index 6594cf0..9e648d5 100644
--- a/we254/addons/fy_lessonv2/inc/mobile/search.php
+++ b/we254/addons/fy_lessonv2/inc/mobile/search.php
@@ -33,10 +33,15 @@
 foreach ($categorylist as $k => $v) {
 	$categorylist[$k]['child'] = pdo_fetchall("SELECT * FROM " . tablename($this -> table_category) . " WHERE uniacid=:uniacid AND parentid=:parentid AND search_show=:search_show ORDER BY displayorder DESC", array(':uniacid'=>$uniacid, ':parentid'=>$v['id'],':search_show'=>1));
 }
-
+	
 /* 知识点分类 */
-$hot_knowledge = pdo_fetchall("SELECT * FROM " . tablename("fy_lesson_knowledge_point") . " WHERE uniacid=:uniacid AND is_hot=:is_hot AND search_show=:search_show ORDER BY displayorder DESC", array(':uniacid' => $uniacid, ':is_hot' => 1,':search_show'=>1));
-$knowledgelist = pdo_fetchall("SELECT * FROM " . tablename("fy_lesson_knowledge_point") . " WHERE uniacid=:uniacid AND parentid=:parentid AND search_show=:search_show ORDER BY displayorder DESC", array(':uniacid'=>$uniacid, ':parentid'=>0,':search_show'=>1));
+if($_GPC['cat_id'] > 0){
+	$hot_knowledge = pdo_fetchall("SELECT * FROM " . tablename("fy_lesson_knowledge_point") . " WHERE uniacid=:uniacid AND is_hot=:is_hot AND search_show=:search_show AND catalog_id_2=:catalog_id_2 ORDER BY displayorder DESC", array(':uniacid' => $uniacid, ':is_hot' => 1,':search_show'=>1,'catalog_id_2'=>$_GPC['cat_id']));
+	$knowledgelist = pdo_fetchall("SELECT * FROM " . tablename("fy_lesson_knowledge_point") . " WHERE uniacid=:uniacid AND parentid=:parentid AND search_show=:search_show AND catalog_id_2=:catalog_id_2 ORDER BY displayorder DESC", array(':uniacid'=>$uniacid, ':parentid'=>0,':search_show'=>1,'catalog_id_2'=>$_GPC['cat_id']));
+}else{
+	$hot_knowledge = pdo_fetchall("SELECT * FROM " . tablename("fy_lesson_knowledge_point") . " WHERE uniacid=:uniacid AND is_hot=:is_hot AND search_show=:search_show ORDER BY displayorder DESC", array(':uniacid' => $uniacid, ':is_hot' => 1,':search_show'=>1));
+	$knowledgelist = pdo_fetchall("SELECT * FROM " . tablename("fy_lesson_knowledge_point") . " WHERE uniacid=:uniacid AND parentid=:parentid AND search_show=:search_show ORDER BY displayorder DESC", array(':uniacid'=>$uniacid, ':parentid'=>0,':search_show'=>1));
+}
 
 foreach ($knowledgelist as $k => $v) {
 	$knowledgelist[$k]['child'] = pdo_fetchall("SELECT * FROM " . tablename("fy_lesson_knowledge_point") . " WHERE uniacid=:uniacid AND parentid=:parentid AND search_show=:search_show ORDER BY displayorder DESC", array(':uniacid'=>$uniacid, ':parentid'=>$v['id'],':search_show'=>1));
diff --git a/we254/addons/fy_lessonv2/template/mobile/default/_footerv2.html b/we254/addons/fy_lessonv2/template/mobile/default/_footerv2.html
index 446a949..4e54945 100644
--- a/we254/addons/fy_lessonv2/template/mobile/default/_footerv2.html
+++ b/we254/addons/fy_lessonv2/template/mobile/default/_footerv2.html
@@ -23,8 +23,8 @@
 			{/if}
 			<p class="weui-tabbar__label">{$navigation['index']['nav_name']}</p>
 		</a>
-		<a href="{$navigation['search']['url_link']}" class="weui-tabbar__item {if $foot_params['search']}weui-bar__item_on{/if}">
-			{if $foot_params['search']}
+		<a href="{$navigation['search']['url_link']}" class="weui-tabbar__item {if $foot_params['search']  && $_GPC['searchtype']=='1'}weui-bar__item_on{/if}">
+			{if $foot_params['search'] && $_GPC['searchtype']=='1'}
 				<img src="{$navigation['search']['selected_icon']}" class="weui-tabbar__icon" />
 			{else}
 				<img src="{$navigation['search']['unselected_icon']}" class="weui-tabbar__icon" />
@@ -32,8 +32,8 @@
 			<p class="weui-tabbar__label">{$navigation['search']['nav_name']}</p>
 		</a>
 		{if $navigation['diynav']}
-			<a href="{$navigation['diynav']['url_link']}" class="weui-tabbar__item {if $foot_params['diynav']}weui-bar__item_on{/if}">
-				{if $foot_params['diynav']}
+			<a href="{$navigation['diynav']['url_link']}" class="weui-tabbar__item {if $foot_params['diynav'] && $_GPC['searchtype']=='2'}weui-bar__item_on{/if}">
+				{if $foot_params['diynav'] && $_GPC['searchtype']=='2'}
 					<img src="{$navigation['diynav']['selected_icon']}" class="weui-tabbar__icon" />
 				{else}
 					<img src="{$navigation['diynav']['unselected_icon']}" class="weui-tabbar__icon" />
diff --git a/we254/addons/fy_lessonv2/template/mobile/default/search.html b/we254/addons/fy_lessonv2/template/mobile/default/search.html
index 2847342..5d4b46e 100644
--- a/we254/addons/fy_lessonv2/template/mobile/default/search.html
+++ b/we254/addons/fy_lessonv2/template/mobile/default/search.html
@@ -19,7 +19,7 @@
 			<div class="search flex0">
 				<i class="icon_search flex_g0"></i>
 				<input type="text" name="keyword" value="{$_GPC['keyword']}" placeholder="{php echo $index_page['searchBox'] ? $index_page['searchBox'] : '搜索您感兴趣的课程';}">
-				<button class="search-btn">搜索aa</button>
+				<button class="search-btn">搜索</button>
 			</div>
 		</div>
 
@@ -134,7 +134,7 @@
 			</a>
 			{loop $knowledgelist $key $parent}
 			<a href="javascript:;">
-				<li class="nav_menu_item {if $_GPC['knowledge_pid']==$parent['knowledge_pid']}nav_menu_item_selected{/if}">{$parent['name']}</li>
+				<li class="nav_menu_item {if $_GPC['knowledge_pid']==$parent['id']}nav_menu_item_selected{/if}">{$parent['name']}</li>
 			</a>
 			{/loop}
 		</ul>
@@ -157,7 +157,7 @@
 					<li class="nav_menu_item {if ($_GPC['knowledge_pid']==$_GPC['knowledge_id']) && ($_GPC['knowledge_id']==$know['id'])}nav_menu_item_selected{/if}">{$know['name']}</li>
 				</a>
 				{loop $know['child'] $child}
-				<a href="{php echo $child['link'] ? $child['link'] : $this->createMobileUrl('search', array('knowledge_id'=>$child['id'],'pid'=>$child['parentid'])).'&keyword='.$keyword.'&sort='.$sort.'&attr1='.$attr1.'&attr2='.$attr2;}">
+				<a href="{php echo $child['link'] ? $child['link'] : $this->createMobileUrl('search', array('knowledge_id'=>$child['id'],'knowledge_pid'=>$child['parentid'])).'&keyword='.$keyword.'&sort='.$sort.'&attr1='.$attr1.'&attr2='.$attr2;}">
 					<li class="nav_menu_item {if $_GPC['knowledge_id']==$child['id']}nav_menu_item_selected{/if}">{$child['name']}</li>
 				</a>
 				{/loop}

--
Gitblit v1.8.0