zhangmeng
2020-09-15 ea787992a46d890dc019b39ff18a0e16d9bc236a
修改手机端按知识点搜索,在部分手机微信上显示不出来的bug
3 files modified
228 ■■■■■ changed files
we254/addons/fy_lessonv2/inc/mobile/search.php 2 ●●● patch | view | raw | blame | history
we254/addons/fy_lessonv2/template/mobile/default/search.html 110 ●●●●● patch | view | raw | blame | history
we254/addons/fy_lessonv2/template/mobile/default/style/cssv2/search.css 116 ●●●●● patch | view | raw | blame | history
we254/addons/fy_lessonv2/inc/mobile/search.php
@@ -48,7 +48,7 @@
}
if ($op == 'display') {
    $searchtype = $_GPC['searchtype'];
    $keyword = trim($_GPC['keyword']);
    $pid = $_GPC['pid'];
    $cat_id = $_GPC['cat_id'];
we254/addons/fy_lessonv2/template/mobile/default/search.html
@@ -35,7 +35,7 @@
                <span>{$attr1_name}</span><i class="icon_down"></i>
            </div>
            {/if}
            {if $_GPC['sort']=='knowledge'}
            {if $_GPC['searchtype']=='2'}
            <div class="list_menu flex-al1 flex9" onclick="showknowledge()">
                <span>{$knowledgename}</span><i class="icon_down"></i>
            </div>
@@ -51,22 +51,22 @@
<!-- 筛选条件 -->
<div class="sort_list_grid sort_list hidden">
    <a href="{php echo $this->createMobileUrl('search')}" {if !$_GPC['sort']}class="curr"{/if}>综合排序</a>
    <a href="{php echo $this->createMobileUrl('search', array('sort'=>'price'))}&keyword={$keyword}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}&attr2={$attr2}" {if $_GPC['sort']=='price'}class="curr"{/if}>价格优先</a>
    <a href="{php echo $this->createMobileUrl('search', array('sort'=>'hot'))}&keyword={$keyword}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}&attr2={$attr2}" {if $_GPC['sort']=='hot'}class="curr"{/if}>人气优先</a>
    <a href="{php echo $this->createMobileUrl('search', array('sort'=>'score'))}&keyword={$keyword}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}&attr2={$attr2}" {if $_GPC['sort']=='score'}class="curr"{/if}>好评优先</a>
    <a href="{php echo $this->createMobileUrl('search', array('sort'=>'general'))}&keyword={$keyword}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}&attr2={$attr2}" {if $_GPC['sort']=='general'}class="curr"{/if}>普通课程</a>
    <a href="{php echo $this->createMobileUrl('search', array('sort'=>'knowledge'))}&keyword={$keyword}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}&attr2={$attr2}" {if $_GPC['sort']=='knowledge'}class="curr"{/if}>知识点课</a>
    <a href="{php echo $this->createMobileUrl('search', array('sort'=>'hot'))}&searchtype={$searchtype}&keyword={$keyword}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}&attr2={$attr2}&knowledge_id={$know_id}" {if !$_GPC['sort']}class="curr"{/if}>综合排序</a>
    <a href="{php echo $this->createMobileUrl('search', array('sort'=>'price'))}&searchtype={$searchtype}&keyword={$keyword}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}&attr2={$attr2}&knowledge_id={$know_id}" {if $_GPC['sort']=='price'}class="curr"{/if}>价格优先</a>
    <a href="{php echo $this->createMobileUrl('search', array('sort'=>'hot'))}&searchtype={$searchtype}&keyword={$keyword}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}&attr2={$attr2}&knowledge_id={$know_id}" {if $_GPC['sort']=='hot'}class="curr"{/if}>人气优先</a>
    <a href="{php echo $this->createMobileUrl('search', array('sort'=>'score'))}&searchtype={$searchtype}&keyword={$keyword}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}&attr2={$attr2}&knowledge_id={$know_id}" {if $_GPC['sort']=='score'}class="curr"{/if}>好评优先</a>
    <a href="{php echo $this->createMobileUrl('search', array('sort'=>'general'))}&searchtype=1&keyword={$keyword}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}&attr2={$attr2}" {if $_GPC['sort']=='general'}class="curr"{/if}>普通课程</a>
    <a href="{php echo $this->createMobileUrl('search', array('sort'=>'knowledge'))}&searchtype=2&keyword={$keyword}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}&attr2={$attr2}" {if $_GPC['sort']=='knowledge'}class="curr"{/if}>知识点课</a>
    <a href="{php echo $this->createMobileUrl('search', array('sort'=>'live'))}&keyword={$keyword}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}&attr2={$attr2}" {if $_GPC['sort']=='live'}class="curr"{/if}>直播课程</a>
    <a href="{php echo $this->createMobileUrl('search', array('sort'=>'apply'))}&keyword={$keyword}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}&attr2={$attr2}" {if $_GPC['sort']=='apply'}class="curr"{/if}>报名课程</a>
</div>
<!-- /筛选条件 -->
<!-- 课程分类 -->
<div class="nav hidden" data-active="cate">
<div id="nav" class="nav hidden" data-active="cate">
    <div class="nav_panel nav_panel-cate">
        <!-- 顶级分类 -->
        <ul class="nav_menu nav_panel_cate_mt">
        <ul id="nav_menu_parent1" class="nav_menu">
            <a href="javascript:;">
                <li class="nav_menu_item {if !$_GPC['pid']}nav_menu_item_selected{/if}"><img class="nav_menu_item-icon" src="{MODULE_URL}template/mobile/{$template}/images/ico-allcategory.png">推荐分类</li>
            </a>
@@ -78,24 +78,24 @@
        </ul>
        <!-- 推荐二级分类 -->
        <ul class="nav_menu nav_panel-cate_st" {if !$_GPC['pid']}style="display:block;"{/if}">
            <a href="{php echo $this->createMobileUrl('search')}&keyword={$keyword}&sort={$sort}&attr1={$attr1}&attr2={$attr2}">
        <ul name="nav_st1" class="nav_menu" {if !$_GPC['pid']}style="display:block;"{/if}">
            <a href="{php echo $this->createMobileUrl('search')}&searchtype={$searchtype}&keyword={$keyword}&sort={$sort}&attr1={$attr1}&attr2={$attr2}">
                <li class="nav_menu_item {if !$_GPC['cat_id']}nav_menu_item_selected{/if}"><img class="nav_menu_item-icon" src="{$all_category_ico}">全部</li>
            </a>
            {loop $hot_category $hot}
            <a href="{php echo $hot['link'] ? $hot['link'] : $this->createMobileUrl('search', array('cat_id'=>$hot['id']))}&keyword={$keyword}&sort={$sort}&attr1={$attr1}&attr2={$attr2}">
            <a href="{php echo $hot['link'] ? $hot['link'] : $this->createMobileUrl('search', array('cat_id'=>$hot['id']))}&searchtype={$searchtype}&keyword={$keyword}&sort={$sort}&attr1={$attr1}&attr2={$attr2}">
                <li class="nav_menu_item {if !$_GPC['pid'] && ($_GPC['cat_id']==$hot['id'])}nav_menu_item_selected{/if}"><img class="nav_menu_item-icon" src="{$_W['attachurl']}{$hot['ico']}">{$hot['name']}</li>
            </a>
            {/loop}
        </ul>
        <!-- 二级分类 -->
        {loop $categorylist $category}
            <ul class="nav_menu nav_panel-cate_st" {if $_GPC['pid']==$category['id']}style="display:block;"{/if}>
                <a href="{php echo $category['link'] ? $category['link'] : $this->createMobileUrl('search', array('cat_id'=>$category['id'],'pid'=>$category['id'])).'&keyword='.$keyword.'&sort='.$sort.'&attr1='.$attr1.'&attr2='.$attr2;}">
            <ul name="nav_st1" class="nav_menu" {if $_GPC['pid']==$category['id']}style="display:block;"{/if}>
                <a href="{php echo $category['link'] ? $category['link'] : $this->createMobileUrl('search', array('cat_id'=>$category['id'],'pid'=>$category['id'])).'&searchtype='.$searchtype.'&keyword='.$keyword.'&sort='.$sort.'&attr1='.$attr1.'&attr2='.$attr2;}">
                    <li class="nav_menu_item {if ($_GPC['pid']==$_GPC['cat_id']) && ($_GPC['cat_id']==$category['id'])}nav_menu_item_selected{/if}"><img class="nav_menu_item-icon" src="{$_W['attachurl']}{$category['ico']}">{$category['name']}</li>
                </a>
                {loop $category['child'] $child}
                <a href="{php echo $child['link'] ? $child['link'] : $this->createMobileUrl('search', array('cat_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('cat_id'=>$child['id'],'pid'=>$child['parentid'])).'&searchtype='.$searchtype.'&keyword='.$keyword.'&sort='.$sort.'&attr1='.$attr1.'&attr2='.$attr2;}">
                    <li class="nav_menu_item {if $_GPC['cat_id']==$child['id']}nav_menu_item_selected{/if}"><img class="nav_menu_item-icon" src="{$_W['attachurl']}{$child['ico']}">{$child['name']}</li>
                </a>
                {/loop}
@@ -108,27 +108,27 @@
<!-- 课程属性 -->
{if $lesson_attribute['attribute1']}
<div class="sort_list_grid attribute1 hidden">
    <a href="{php echo $this->createMobileUrl('search')}&keyword={$keyword}&sort={$sort}&cat_id={$cat_id}&pid={$pid}&attr2={$attr2}" {if !$_GPC['attr1']}class="curr"{/if}>不限</a>
    <a href="{php echo $this->createMobileUrl('search')}&searchtype={$searchtype}&keyword={$keyword}&sort={$sort}&cat_id={$cat_id}&pid={$pid}&attr2={$attr2}&knowledge_id={$know_id}" {if !$_GPC['attr1']}class="curr"{/if}>不限</a>
    {loop $attribute1 $item}
    <a href="{php echo $this->createMobileUrl('search', array('attr1'=>$item['id']))}&keyword={$keyword}&sort={$sort}&cat_id={$cat_id}&pid={$pid}&attr2={$attr2}" {if $_GPC['attr1']==$item['id']}class="curr"{/if}>{$item['name']}</a>
    <a href="{php echo $this->createMobileUrl('search', array('attr1'=>$item['id']))}&searchtype={$searchtype}&keyword={$keyword}&sort={$sort}&cat_id={$cat_id}&pid={$pid}&attr2={$attr2}&knowledge_id={$know_id})" {if $_GPC['attr1']==$item['id']}class="curr"{/if}>{$item['name']}</a>
    {/loop}
</div>
{/if}
{if $lesson_attribute['attribute2']}
<div class="sort_list_grid attribute2 hidden">
    <a href="{php echo $this->createMobileUrl('search')}&keyword={$keyword}&sort={$sort}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}" {if !$_GPC['attr2']}class="curr"{/if}>不限</a>
    <a href="{php echo $this->createMobileUrl('search')}&searchtype={$searchtype}&keyword={$keyword}&sort={$sort}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}&knowledge_id={$know_id}" {if !$_GPC['attr2']}class="curr"{/if}>不限</a>
    {loop $attribute2 $item}
    <a href="{php echo $this->createMobileUrl('search', array('attr2'=>$item['id']))}&keyword={$keyword}&sort={$sort}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}" {if $_GPC['attr2']==$item['id']}class="curr"{/if}>{$item['name']}</a>
    <a href="{php echo $this->createMobileUrl('search', array('attr2'=>$item['id']))}&searchtype={$searchtype}&keyword={$keyword}&sort={$sort}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}&knowledge_id={$know_id}" {if $_GPC['attr2']==$item['id']}class="curr"{/if}>{$item['name']}</a>
    {/loop}
</div>
{/if}
<!-- /课程属性 -->
<!-- 知识点课分类 -->
<div class="nav1 hidden" data-active="knowledge">
    <div class="nav_panel nav_panel-know">
<div id="nav1" class="nav hidden" data-active="cate">
    <div class="nav_panel nav_panel-cate">
        <!-- 顶级分类 -->
        <ul class="nav_menu nav_panel_know_mt">
        <ul id="nav_menu_parent2" class="nav_menu">
            <a href="javascript:;">
                <li class="nav_menu_item {if !$_GPC['knowledge_pid']}nav_menu_item_selected{/if}">推荐知识点</li>
            </a>
@@ -138,31 +138,31 @@
            </a>
            {/loop}
        </ul>
        <!-- 推荐二级分类 -->
        <ul class="nav_menu nav_panel-know_st" {if !$_GPC['knowledge_pid']}style="display:block;"{/if}">
            <a href="{php echo $this->createMobileUrl('search')}&keyword={$keyword}&sort={$sort}&attr1={$attr1}&attr2={$attr2}">
        <ul name="nav_st2" class="nav_menu" {if !$_GPC['knowledge_pid']}style="display:block;"{/if}">
            <a href="{php echo $this->createMobileUrl('search')}}&searchtype={$searchtype}&keyword={$keyword}&sort={$sort}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}&attr2={$attr2}">
                <li class="nav_menu_item {if !$_GPC['knowledge_id']}nav_menu_item_selected{/if}">全部</li>
            </a>
            {loop $hot_knowledge $hot}
            <a href="{php echo $hot['link'] ? $hot['link'] : $this->createMobileUrl('search', array('knowledge_id'=>$hot['id']))}&keyword={$keyword}&sort={$sort}&attr1={$attr1}&attr2={$attr2}">
            <a href="{php echo $hot['link'] ? $hot['link'] : $this->createMobileUrl('search', array('knowledge_id'=>$hot['id']))}}&searchtype={$searchtype}&keyword={$keyword}&sort={$sort}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}&attr2={$attr2}">
                <li class="nav_menu_item {if !$_GPC['knowledge_pid'] && ($_GPC['knowledge_id']==$hot['id'])}nav_menu_item_selected{/if}">{$hot['name']}</li>
            </a>
            {/loop}
        </ul>
        <!-- 二级分类 -->
        {loop $knowledgelist $know}
            <ul class="nav_menu nav_panel-know_st" {if $_GPC['knowledge_pid']==$know['id']}style="display:block;"{/if}>
                <a href="{php echo $know['link'] ? $know['link'] : $this->createMobileUrl('search', array('knowledge_id'=>$know['id'],'pid'=>$know['id'])).'&keyword='.$keyword.'&sort='.$sort.'&attr1='.$attr1.'&attr2='.$attr2;}">
            <ul name="nav_st2" class="nav_menu" {if $_GPC['knowledge_pid']==$know['id']}style="display:block;"{/if}>
                <a href="{php echo $know['link'] ? $know['link'] : $this->createMobileUrl('search', array('knowledge_id'=>$know['id'])).'&searchtype='.$searchtype.'&keyword='.$keyword.'&sort='.$sort.'&cat_id='.$cat_id.'&pid='.$pid.'&attr1='.$attr1.'&attr2='.$attr2;}">
                    <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'],'knowledge_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'])).'&searchtype='.$searchtype.'&keyword='.$keyword.'&sort='.$sort.'&cat_id='.$cat_id.'&pid='.$pid.'&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}
            </ul>
        {/loop}
    </div>
</div>
<!-- /知识点课分类 -->
@@ -218,10 +218,11 @@
/* 课程分类 */
function showcategory(){
    closeCondition();
    $(".nav").removeClass("hidden");
    switchnav(1);
    $(".mark").removeClass("hidden");
}
$(".nav_panel_cate_mt").on("click", 'a', function() {
$("#nav_menu_parent1").on("click", 'a', function() {
    var $currItem = $(this),
    index = $currItem.index();
@@ -246,17 +247,48 @@
// /* 知识点分类 */
function showknowledge(){
    closeCondition();
    $(".nav1").removeClass("hidden");
    switchnav(2);
    $(".mark").removeClass("hidden");
}
$(".nav_panel_know_mt").on("click", 'a', function() {
$("#nav_menu_parent2").on("click", 'a', function() {
    var $currItem = $(this),
    index = $currItem.index();
    $(".nav_panel_know_mt a li").removeClass('nav_menu_item_selected');
    $(".nav_panel_cate_mt a li").removeClass('nav_menu_item_selected');
    $currItem.addClass('nav_menu_item_selected').siblings().removeClass('nav_menu_item_selected');
    $(".nav_panel-know_st").hide().eq(index).show();
    $(".nav_panel-cate_st").hide().eq(index).show();
});
function switchnav(flag){
    if(flag==1){
        $("#nav_menu_parent1").removeClass("nav_panel_cate_mt");
        $("ul[name='nav_st1']").removeClass("nav_panel_cate_st");
        $("#nav_menu_parent1").addClass("nav_panel_cate_mt");
        $("ul[name='nav_st1']").addClass("nav_panel-cate_st ");
        $("#nav_menu_parent2").removeClass("nav_panel_cate_mt");
        $("ul[name='nav_st2']").removeClass("nav_panel-cate_st ");
        $("#nav1").removeClass("nav");
        $("#nav").removeClass("nav");
        $("#nav").removeClass("hidden");
        $("#nav").addClass("nav");
    }else{
        $("#nav_menu_parent2").removeClass("nav_panel_cate_mt");
        $("ul[name='nav_st2']").removeClass("nav_panel-cate_st ");
        $("#nav_menu_parent2").addClass("nav_panel_cate_mt");
        $("ul[name='nav_st2']").addClass("nav_panel-cate_st ");
        $("#nav_menu_parent1").removeClass("nav_panel_cate_mt");
        $("ul[name='nav_st1']").removeClass("nav_panel-cate_st ");
        $("#nav").removeClass("nav");
        $("#nav1").removeClass("nav");
        $("#nav1").removeClass("hidden");
        $("#nav1").addClass("nav");
    }
}
/* 关闭所有选项 */
@@ -267,8 +299,7 @@
  $(".sort_list_grid").addClass("hidden");
  $(".nav").addClass("hidden");
  $(".attribute1").addClass("hidden");
  $(".attribute2").addClass("hidden");
  $(".nav1").addClass("hidden");
  $(".attribute2").addClass("hidden");
  $(".mark").addClass("hidden");
}
</script>
@@ -299,7 +330,7 @@
                    insertDiv(jsonObj);
                }else{
                    get_status = false;
                    document.getElementById("loading_div").innerHTML='<div class="loading_bd">没有了,已经到底了</div>';
                    // document.getElementById("loading_div").innerHTML='<div class="loading_bd">没有了,已经到底了</div>';
                }
            });
        }
@@ -405,7 +436,10 @@
var head = document.head || document.getElementsByTagName('head')[0];
var style = document.createElement('style');
style.innerHTML = '.nav_panel-cate{height:' + nav_panel_height + 'px !important;}';
var style1 = document.createElement('style');
style1.innerHTML = '.nav_panel-know{height:' + nav_panel_height + 'px !important;}';
head.appendChild(style);
head.appendChild(style1);
</script>
{elseif $op=='allcategory'}
we254/addons/fy_lessonv2/template/mobile/default/style/cssv2/search.css
@@ -206,15 +206,6 @@
    background-color: rgba(0, 0, 0, 0.5);
}
.mark1 {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 102;
    background-color: rgba(0, 0, 0, 0.5);
}
.sort_list_grid a + a {
    border-top: 1px solid #e4e5ea;
}
@@ -364,113 +355,6 @@
    top: 96px;
    width: 100%;
    max-width: 640px;
}
.nav1[data-active=filter] .nav_panel-filter,.nav1[data-active=sort] .nav_panel-sort {
    display: block;
    -webkit-transform: translateZ(0);
    transform: translateZ(0)
}
.nav1[data-active=knowledge] .nav_panel-know {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-transform: translateZ(0);
    transform: translateZ(0)
}
.nav1_panel {
    width: 100%;
    top: 0;
    background: #fff;
    background: var(--white);
    -webkit-transition: -webkit-transform .2s ease;
    transition: -webkit-transform .2s ease;
    transition: transform .2s ease;
    transition: transform .2s ease,-webkit-transform .2s ease;
    -webkit-transform: translate3d(0,-250%,0);
    transform: translate3d(0,-250%,0);
    overflow-y: auto
}
.nav1 .nav_panel-sort,.nav1_panel {
    position: absolute
}
.nav_panel-know {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    height: 25rem;
}
@media (device-height:568px) and (-webkit-min-device-pixel-ratio:2){
    .nav_panel-know {
        height:400px;
    }
}
@media (min-device-width : 375px) and (max-device-width : 667px) and (-webkit-min-device-pixel-ratio : 2){
    .nav_panel-know {
        height:455px;
    }
}
@media (min-device-width : 414px) and (max-device-width : 736px) and (-webkit-min-device-pixel-ratio : 3){
    .nav_panel-know {
        height: 550px;
    }
}
.nav_panel-know .nav_menu_item {
    overflow: hidden;
    position: relative;
    font-size: 14px;
    white-space: nowrap;
    text-overflow: ellipsis;
    word-break: break-all;
    padding-left: 25px;
    height: 50px;
    max-height: 50px;
    line-height: 50px;
}
.nav_panel-know .nav_menu_item_selected {
    color: #DC3528;
}
.nav_panel-know .nav_menu_item-icon {
    display: block;
    position: absolute;
    top: 50%;
    left: 10px;
    margin-top: -10px;
    width: 18px;
    height: 18px;
}
.nav_panel_know_mt {
    width: 45%;
    min-height: 105px;
    background: #f2f2f4;
}
.nav_panel_know_mt .nav_menu_item {
    padding-left: 10px;
    background: #f2f2f2;
}
.nav_panel_know_mt .nav_menu_item_selected {
    background: #e8e8e9;
}
.nav_panel-know_st {
    display: none;
    background: #f8f8f9;
}
.nav_panel-know_st .nav_menu_item {
    padding-left: 10px;
    background: #f8f8f9;
}
.nav_panel-know_st .nav_menu_item_selected {
    background: #fff;
}
/* 课程列表 */