commit | author | age
|
1c88ba
|
1 |
<!-- |
Z |
2 |
* 微课堂首页 |
|
3 |
* ============================================================================ |
3e6546
|
4 |
* 版权所有 2015-2020 ,并保留所有权利。 |
Z |
5 |
* 网站地址: |
1c88ba
|
6 |
* ---------------------------------------------------------------------------- |
3e6546
|
7 |
|
1c88ba
|
8 |
* ============================================================================ |
Z |
9 |
--> |
|
10 |
{template $template.'/_headerv2'} |
|
11 |
|
|
12 |
{if $op=='display'} |
|
13 |
<link href="{MODULE_URL}template/mobile/{$template}/style/cssv2/search.css?v={$versions}" rel="stylesheet" /> |
|
14 |
|
|
15 |
<!-- 顶部搜索框 --> |
|
16 |
<div class="fix_grid_96"> |
|
17 |
<div class="fix_grid"> |
|
18 |
<div class="search_grid"> |
|
19 |
<div class="search flex0"> |
|
20 |
<i class="icon_search flex_g0"></i> |
|
21 |
<input type="text" name="keyword" value="{$_GPC['keyword']}" placeholder="{php echo $index_page['searchBox'] ? $index_page['searchBox'] : '搜索您感兴趣的课程';}"> |
89c2b9
|
22 |
<button class="search-btn">搜索</button> |
1c88ba
|
23 |
</div> |
Z |
24 |
</div> |
|
25 |
|
|
26 |
<div class="list_menu_grid flex0_1"> |
|
27 |
<div class="list_menu flex-al1 flex9" onclick="showsort()"> |
|
28 |
<span>{$sortname}</span><i class="icon_down"></i> |
|
29 |
</div> |
|
30 |
<div class="list_menu flex-al1 flex9" onclick="showcategory()"> |
|
31 |
<span>{$catname}</span><i class="icon_down"></i> |
|
32 |
</div> |
|
33 |
{if $lesson_attribute['attribute1']} |
|
34 |
<div class="list_menu flex-al1 flex9" onclick="showattribute1()"> |
|
35 |
<span>{$attr1_name}</span><i class="icon_down"></i> |
|
36 |
</div> |
|
37 |
{/if} |
ea7879
|
38 |
{if $_GPC['searchtype']=='2'} |
ec46c1
|
39 |
<div class="list_menu flex-al1 flex9" onclick="showknowledge()"> |
Z |
40 |
<span>{$knowledgename}</span><i class="icon_down"></i> |
|
41 |
</div> |
|
42 |
{elseif $lesson_attribute['attribute2']} |
1c88ba
|
43 |
<div class="list_menu flex-al1 flex9" onclick="showattribute2()"> |
Z |
44 |
<span>{$attr2_name}</span><i class="icon_down"></i> |
|
45 |
</div> |
|
46 |
{/if} |
|
47 |
</div> |
|
48 |
</div> |
|
49 |
</div> |
|
50 |
<!-- /顶部搜索框 --> |
|
51 |
|
|
52 |
<!-- 筛选条件 --> |
|
53 |
<div class="sort_list_grid sort_list hidden"> |
ea7879
|
54 |
<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> |
Z |
55 |
<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> |
|
56 |
<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> |
|
57 |
<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> |
|
58 |
<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> |
|
59 |
<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> |
1c88ba
|
60 |
<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> |
Z |
61 |
<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> |
|
62 |
</div> |
|
63 |
<!-- /筛选条件 --> |
|
64 |
|
|
65 |
<!-- 课程分类 --> |
ea7879
|
66 |
<div id="nav" class="nav hidden" data-active="cate"> |
1c88ba
|
67 |
<div class="nav_panel nav_panel-cate"> |
Z |
68 |
<!-- 顶级分类 --> |
ea7879
|
69 |
<ul id="nav_menu_parent1" class="nav_menu"> |
1c88ba
|
70 |
<a href="javascript:;"> |
Z |
71 |
<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> |
|
72 |
</a> |
|
73 |
{loop $categorylist $key $parent} |
|
74 |
<a href="javascript:;"> |
|
75 |
<li class="nav_menu_item {if $_GPC['pid']==$parent['id']}nav_menu_item_selected{/if}"><img class="nav_menu_item-icon" src="{$_W['attachurl']}{$parent['ico']}">{$parent['name']}</li> |
|
76 |
</a> |
|
77 |
{/loop} |
|
78 |
</ul> |
|
79 |
|
|
80 |
<!-- 推荐二级分类 --> |
ea7879
|
81 |
<ul name="nav_st1" class="nav_menu" {if !$_GPC['pid']}style="display:block;"{/if}"> |
Z |
82 |
<a href="{php echo $this->createMobileUrl('search')}&searchtype={$searchtype}&keyword={$keyword}&sort={$sort}&attr1={$attr1}&attr2={$attr2}"> |
1c88ba
|
83 |
<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> |
Z |
84 |
</a> |
|
85 |
{loop $hot_category $hot} |
ea7879
|
86 |
<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}"> |
1c88ba
|
87 |
<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> |
Z |
88 |
</a> |
|
89 |
{/loop} |
|
90 |
</ul> |
|
91 |
<!-- 二级分类 --> |
|
92 |
{loop $categorylist $category} |
ea7879
|
93 |
<ul name="nav_st1" class="nav_menu" {if $_GPC['pid']==$category['id']}style="display:block;"{/if}> |
Z |
94 |
<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;}"> |
1c88ba
|
95 |
<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> |
Z |
96 |
</a> |
|
97 |
{loop $category['child'] $child} |
ea7879
|
98 |
<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;}"> |
1c88ba
|
99 |
<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> |
Z |
100 |
</a> |
|
101 |
{/loop} |
|
102 |
</ul> |
|
103 |
{/loop} |
|
104 |
</div> |
|
105 |
</div> |
|
106 |
<!-- /课程分类 --> |
|
107 |
|
|
108 |
<!-- 课程属性 --> |
|
109 |
{if $lesson_attribute['attribute1']} |
|
110 |
<div class="sort_list_grid attribute1 hidden"> |
ea7879
|
111 |
<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> |
1c88ba
|
112 |
{loop $attribute1 $item} |
ea7879
|
113 |
<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> |
1c88ba
|
114 |
{/loop} |
Z |
115 |
</div> |
|
116 |
{/if} |
|
117 |
{if $lesson_attribute['attribute2']} |
|
118 |
<div class="sort_list_grid attribute2 hidden"> |
ea7879
|
119 |
<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> |
1c88ba
|
120 |
{loop $attribute2 $item} |
ea7879
|
121 |
<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> |
1c88ba
|
122 |
{/loop} |
Z |
123 |
</div> |
|
124 |
{/if} |
|
125 |
<!-- /课程属性 --> |
ec46c1
|
126 |
|
Z |
127 |
<!-- 知识点课分类 --> |
ea7879
|
128 |
<div id="nav1" class="nav hidden" data-active="cate"> |
Z |
129 |
<div class="nav_panel nav_panel-cate"> |
ec46c1
|
130 |
<!-- 顶级分类 --> |
ea7879
|
131 |
<ul id="nav_menu_parent2" class="nav_menu"> |
ec46c1
|
132 |
<a href="javascript:;"> |
80527f
|
133 |
<li class="nav_menu_item {if !$_GPC['knowledge_pid']}nav_menu_item_selected{/if}">推荐知识点</li> |
ec46c1
|
134 |
</a> |
Z |
135 |
{loop $knowledgelist $key $parent} |
|
136 |
<a href="javascript:;"> |
89c2b9
|
137 |
<li class="nav_menu_item {if $_GPC['knowledge_pid']==$parent['id']}nav_menu_item_selected{/if}">{$parent['name']}</li> |
ec46c1
|
138 |
</a> |
Z |
139 |
{/loop} |
|
140 |
</ul> |
|
141 |
<!-- 推荐二级分类 --> |
ea7879
|
142 |
<ul name="nav_st2" class="nav_menu" {if !$_GPC['knowledge_pid']}style="display:block;"{/if}"> |
Z |
143 |
<a href="{php echo $this->createMobileUrl('search')}}&searchtype={$searchtype}&keyword={$keyword}&sort={$sort}&cat_id={$cat_id}&pid={$pid}&attr1={$attr1}&attr2={$attr2}"> |
80527f
|
144 |
<li class="nav_menu_item {if !$_GPC['knowledge_id']}nav_menu_item_selected{/if}">全部</li> |
ec46c1
|
145 |
</a> |
Z |
146 |
{loop $hot_knowledge $hot} |
ea7879
|
147 |
<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}"> |
80527f
|
148 |
<li class="nav_menu_item {if !$_GPC['knowledge_pid'] && ($_GPC['knowledge_id']==$hot['id'])}nav_menu_item_selected{/if}">{$hot['name']}</li> |
ec46c1
|
149 |
</a> |
Z |
150 |
{/loop} |
|
151 |
</ul> |
|
152 |
<!-- 二级分类 --> |
|
153 |
{loop $knowledgelist $know} |
ea7879
|
154 |
<ul name="nav_st2" class="nav_menu" {if $_GPC['knowledge_pid']==$know['id']}style="display:block;"{/if}> |
Z |
155 |
<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;}"> |
80527f
|
156 |
<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> |
ec46c1
|
157 |
</a> |
Z |
158 |
{loop $know['child'] $child} |
ea7879
|
159 |
<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;}"> |
80527f
|
160 |
<li class="nav_menu_item {if $_GPC['knowledge_id']==$child['id']}nav_menu_item_selected{/if}">{$child['name']}</li> |
ec46c1
|
161 |
</a> |
Z |
162 |
{/loop} |
|
163 |
</ul> |
|
164 |
{/loop} |
ea7879
|
165 |
|
ec46c1
|
166 |
</div> |
Z |
167 |
</div> |
|
168 |
<!-- /知识点课分类 --> |
1c88ba
|
169 |
<div class="mark hidden"></div> |
Z |
170 |
|
|
171 |
<!-- 课程列表 --> |
|
172 |
<div class="section"> |
|
173 |
{if $total} |
|
174 |
<div class="list_grid" id="lesson-list"> |
|
175 |
</div> |
|
176 |
<div id="loading_div" class="loading_div" style="padding:15px 0 30px 0;"> |
|
177 |
<a href="javascript:void(0);" id="btn_Page"><i class="fa fa-arrow-circle-down"></i> 加载更多</a> |
|
178 |
</div> |
|
179 |
{else} |
|
180 |
<div class="my_empty"> |
|
181 |
<div class="empty_bd my_course_empty"> |
|
182 |
<h3>没有找到任何课程~</h3> |
|
183 |
<p><a href="{php echo $this->createMobileUrl('index', array('t'=>1));}">去首页看看...</a></p> |
|
184 |
</div> |
|
185 |
</div> |
|
186 |
{/if} |
|
187 |
</div> |
|
188 |
<!-- /课程列表 --> |
|
189 |
|
|
190 |
<div id="loadingToast"> |
|
191 |
<div class="weui-mask_transparent"></div> |
|
192 |
<div class="weui-toast"> |
|
193 |
<i class="weui-loading weui-icon_toast"></i> |
|
194 |
<p class="weui-toast__content">加载数据中</p> |
|
195 |
</div> |
|
196 |
</div> |
|
197 |
|
|
198 |
<script type="text/javascript"> |
|
199 |
/* 搜索 */ |
|
200 |
$(".search-btn").click(function() { |
|
201 |
var keywords = $.trim($("input[name=keyword]").val()); |
|
202 |
if (keywords == '') { |
|
203 |
searchUrl = "{php echo $this->createMobileUrl('search');}"; |
|
204 |
} else { |
|
205 |
searchUrl = searchUrl = "{php echo $this->createMobileUrl('search');}&keyword=" + encodeURIComponent(keywords); |
|
206 |
} |
|
207 |
document.location.href = searchUrl; |
|
208 |
return false; |
|
209 |
}); |
|
210 |
|
|
211 |
/* 综合排序 */ |
|
212 |
function showsort() { |
|
213 |
closeCondition(); |
|
214 |
$(".sort_list").removeClass("hidden"); |
|
215 |
$(".mark").removeClass("hidden"); |
|
216 |
} |
|
217 |
|
|
218 |
/* 课程分类 */ |
|
219 |
function showcategory(){ |
|
220 |
closeCondition(); |
ea7879
|
221 |
switchnav(1); |
1c88ba
|
222 |
$(".mark").removeClass("hidden"); |
Z |
223 |
} |
ea7879
|
224 |
|
Z |
225 |
$("#nav_menu_parent1").on("click", 'a', function() { |
1c88ba
|
226 |
var $currItem = $(this), |
Z |
227 |
index = $currItem.index(); |
|
228 |
|
|
229 |
$(".nav_panel_cate_mt a li").removeClass('nav_menu_item_selected'); |
|
230 |
$currItem.addClass('nav_menu_item_selected').siblings().removeClass('nav_menu_item_selected'); |
|
231 |
$(".nav_panel-cate_st").hide().eq(index).show(); |
|
232 |
}); |
|
233 |
|
|
234 |
/* 课程属性 */ |
|
235 |
function showattribute1() { |
|
236 |
closeCondition(); |
|
237 |
$(".attribute1").removeClass("hidden"); |
|
238 |
$(".mark").removeClass("hidden"); |
|
239 |
} |
|
240 |
|
|
241 |
function showattribute2() { |
|
242 |
closeCondition(); |
|
243 |
$(".attribute2").removeClass("hidden"); |
|
244 |
$(".mark").removeClass("hidden"); |
|
245 |
} |
|
246 |
|
ec46c1
|
247 |
// /* 知识点分类 */ |
Z |
248 |
function showknowledge(){ |
|
249 |
closeCondition(); |
ea7879
|
250 |
switchnav(2); |
ec46c1
|
251 |
$(".mark").removeClass("hidden"); |
Z |
252 |
} |
ea7879
|
253 |
$("#nav_menu_parent2").on("click", 'a', function() { |
ec46c1
|
254 |
var $currItem = $(this), |
Z |
255 |
index = $currItem.index(); |
|
256 |
|
ea7879
|
257 |
$(".nav_panel_cate_mt a li").removeClass('nav_menu_item_selected'); |
ec46c1
|
258 |
$currItem.addClass('nav_menu_item_selected').siblings().removeClass('nav_menu_item_selected'); |
ea7879
|
259 |
$(".nav_panel-cate_st").hide().eq(index).show(); |
ec46c1
|
260 |
}); |
ea7879
|
261 |
|
Z |
262 |
function switchnav(flag){ |
|
263 |
if(flag==1){ |
|
264 |
$("#nav_menu_parent1").removeClass("nav_panel_cate_mt"); |
|
265 |
$("ul[name='nav_st1']").removeClass("nav_panel_cate_st"); |
|
266 |
|
|
267 |
$("#nav_menu_parent1").addClass("nav_panel_cate_mt"); |
|
268 |
$("ul[name='nav_st1']").addClass("nav_panel-cate_st "); |
|
269 |
|
|
270 |
$("#nav_menu_parent2").removeClass("nav_panel_cate_mt"); |
|
271 |
$("ul[name='nav_st2']").removeClass("nav_panel-cate_st "); |
|
272 |
|
|
273 |
$("#nav1").removeClass("nav"); |
|
274 |
$("#nav").removeClass("nav"); |
|
275 |
$("#nav").removeClass("hidden"); |
|
276 |
$("#nav").addClass("nav"); |
|
277 |
}else{ |
|
278 |
$("#nav_menu_parent2").removeClass("nav_panel_cate_mt"); |
|
279 |
$("ul[name='nav_st2']").removeClass("nav_panel-cate_st "); |
|
280 |
$("#nav_menu_parent2").addClass("nav_panel_cate_mt"); |
|
281 |
$("ul[name='nav_st2']").addClass("nav_panel-cate_st "); |
|
282 |
|
|
283 |
$("#nav_menu_parent1").removeClass("nav_panel_cate_mt"); |
|
284 |
$("ul[name='nav_st1']").removeClass("nav_panel-cate_st "); |
|
285 |
|
|
286 |
$("#nav").removeClass("nav"); |
|
287 |
$("#nav1").removeClass("nav"); |
|
288 |
$("#nav1").removeClass("hidden"); |
|
289 |
$("#nav1").addClass("nav"); |
|
290 |
} |
|
291 |
} |
ec46c1
|
292 |
|
Z |
293 |
|
1c88ba
|
294 |
/* 关闭所有选项 */ |
Z |
295 |
$(".mark, .sort_list_grid").click(function(){ |
|
296 |
closeCondition(); |
|
297 |
}) |
|
298 |
function closeCondition() { |
|
299 |
$(".sort_list_grid").addClass("hidden"); |
|
300 |
$(".nav").addClass("hidden"); |
|
301 |
$(".attribute1").addClass("hidden"); |
ea7879
|
302 |
$(".attribute2").addClass("hidden"); |
1c88ba
|
303 |
$(".mark").addClass("hidden"); |
Z |
304 |
} |
|
305 |
</script> |
|
306 |
|
|
307 |
<script type="text/javascript"> |
|
308 |
var uniacid = "{$uniacid}"; |
|
309 |
//首页检索跳转过来的清掉缓存 |
|
310 |
var clear = "{php echo intval($_GPC['clear']);}"; |
|
311 |
if(clear==1){ |
|
312 |
localStorage.removeItem('lesson_back_'+uniacid); |
|
313 |
} |
|
314 |
|
|
315 |
var localStorage = window.localStorage; |
|
316 |
var ajaxUrl = "{php echo $_W['siteUrl'];}"; |
|
317 |
var attachUrl = "{php echo $_W['attachurl'];}"; |
|
318 |
var lessonUrl = "{php echo $this->createMobileUrl('lesson');}"; |
|
319 |
var loadingToast = document.getElementById("loadingToast"); |
|
320 |
var get_status = true; |
|
321 |
$(function () { |
|
322 |
var nowPage = 1; //设置当前页数,全局变量 |
|
323 |
function getData(page) { |
|
324 |
if(get_status){ |
|
325 |
nowPage++; |
|
326 |
$.get(ajaxUrl, {page: page}, function (data) { |
|
327 |
var jsonObj = JSON.parse(data); |
|
328 |
loadingToast.style.display = 'none'; |
|
329 |
if (jsonObj.length > 0) { |
|
330 |
insertDiv(jsonObj); |
|
331 |
}else{ |
|
332 |
get_status = false; |
ea7879
|
333 |
// document.getElementById("loading_div").innerHTML='<div class="loading_bd">没有了,已经到底了</div>'; |
1c88ba
|
334 |
} |
Z |
335 |
}); |
|
336 |
} |
|
337 |
} |
|
338 |
//初始化加载数据 |
|
339 |
var lesson_back = localStorage.getItem('lesson_back_'+uniacid); |
|
340 |
var lesson_list = localStorage.getItem('lesson_list_'+uniacid); |
|
341 |
|
|
342 |
if(lesson_back==1 && lesson_list){ |
|
343 |
$("#lesson-list").append(lesson_list); |
|
344 |
$(".section").scrollTop(localStorage.getItem('section_top_'+uniacid)); |
|
345 |
nowPage = localStorage.getItem('nowPage_'+uniacid); |
|
346 |
loadingToast.style.display = 'none'; |
|
347 |
localStorage.removeItem('lesson_back_'+uniacid); |
|
348 |
}else{ |
|
349 |
getData(1); |
|
350 |
} |
|
351 |
|
|
352 |
//生成数据html,append到div中 |
|
353 |
function insertDiv(result) { |
|
354 |
var mainDiv =$("#lesson-list"); |
|
355 |
var already_study = "{$already_study}"; |
|
356 |
var lesson_vip_status = {$setting['lesson_vip_status']}; |
|
357 |
var chtml = ''; |
|
358 |
for (var j = 0; j < result.length; j++) { |
|
359 |
chtml += '<a href="' + lessonUrl + '&id=' + result[j].id + '" class="normal_grid flex0_1">'; |
|
360 |
chtml += ' <div class="normal_grid_a flex_g0">'; |
|
361 |
chtml += ' <div class="img-box flex_g0">'; |
c47fd0
|
362 |
chtml += ' <div class="img"><img src="' + (result[j].images.substr(0,4).toLowerCase()=='http'?'':attachUrl) + result[j].images + '"></div>'; |
1c88ba
|
363 |
chtml += ' <div class="icon-live ' + result[j].icon_live_status + '"></div>'; |
Z |
364 |
chtml += ' <div class="learned ' + result[j].learned_hide + '">' + result[j].buyTotal + already_study + '</div>'; |
|
365 |
chtml += ' <i class="ico_common '+ result[j].ico_name +'"></i>'; |
|
366 |
chtml += ' </div>'; |
|
367 |
chtml += ' </div>'; |
|
368 |
chtml += ' <div class="flex-al1 flex10">'; |
|
369 |
chtml += ' <div>'; |
|
370 |
chtml += ' <div class="grid_title2">' + result[j].bookname + '</div>'; |
|
371 |
chtml += ' <div class="grid_info flex0">'; |
|
372 |
if(lesson_vip_status!=1){ |
|
373 |
if(result[j].price>0){ |
|
374 |
chtml += ' <span class="price flex_g0 index_price_lesson ios-system">¥' + result[j].price + '</span>'; |
|
375 |
}else{ |
|
376 |
chtml += ' <span class="free flex_g0 index_free_lesson ios-system">免费课程</span>'; |
|
377 |
} |
|
378 |
} |
|
379 |
if(result[j].soncount>0){ |
|
380 |
chtml += ' <span class="mar5 ios-system">|</span>'; |
|
381 |
chtml += ' <span class="index_section_number">' + result[j].soncount + '节</span>'; |
|
382 |
} |
|
383 |
chtml += ' </div>'; |
|
384 |
chtml += ' </div>'; |
|
385 |
chtml += ' <div class="grid_bottom2 flex1">'; |
|
386 |
chtml += ' <div class="text">'; |
|
387 |
if(result[j].section_status==0){ |
|
388 |
chtml += '已完结'; |
|
389 |
} |
|
390 |
chtml += ' </div>'; |
|
391 |
if(result[j].score>0){ |
|
392 |
chtml += ' <span class="eva index_lesson_evaluation">' + result[j].score_rate + '%好评</span>'; |
|
393 |
} |
|
394 |
chtml += ' </div>'; |
|
395 |
chtml += ' </div>'; |
|
396 |
chtml += '</a>'; |
|
397 |
} |
|
398 |
mainDiv.append(chtml); |
|
399 |
|
|
400 |
//存储当前课程列表信息 |
|
401 |
if($("#lesson-list").html()){ |
|
402 |
localStorage.setItem('lesson_list_'+uniacid, $("#lesson-list").html()); |
|
403 |
localStorage.setItem('nowPage_'+uniacid, nowPage); |
|
404 |
} |
|
405 |
} |
|
406 |
|
|
407 |
//==============核心代码============= |
|
408 |
var msg_list_loading = false; |
|
409 |
$('.section').on('scroll', function(){ |
|
410 |
if (!msg_list_loading){ |
|
411 |
load_more_msg(); |
|
412 |
} |
|
413 |
|
|
414 |
//记录滚动条位置 |
|
415 |
localStorage.setItem('section_top_'+uniacid, $(".section").scrollTop()); |
|
416 |
}) |
|
417 |
function load_more_msg(){ |
|
418 |
var msg_list = $('.section'); |
|
419 |
if (msg_list.height() + msg_list[0].scrollTop >= msg_list[0].scrollHeight) { |
|
420 |
msg_list_loading = true; |
|
421 |
$("#btn_Page").hide(); |
|
422 |
getData(nowPage); |
|
423 |
msg_list_loading = false; |
|
424 |
} |
|
425 |
$("#btn_Page").show(); |
|
426 |
} |
|
427 |
|
|
428 |
//继续加载按钮事件 |
|
429 |
$("#btn_Page").click(function () { |
|
430 |
loadingToast.style.display = 'block'; |
|
431 |
getData(nowPage); |
|
432 |
}); |
|
433 |
}); |
|
434 |
|
|
435 |
var nav_panel_height = parseInt(document.body.clientHeight * 0.7); |
|
436 |
var head = document.head || document.getElementsByTagName('head')[0]; |
|
437 |
var style = document.createElement('style'); |
|
438 |
style.innerHTML = '.nav_panel-cate{height:' + nav_panel_height + 'px !important;}'; |
ea7879
|
439 |
var style1 = document.createElement('style'); |
Z |
440 |
style1.innerHTML = '.nav_panel-know{height:' + nav_panel_height + 'px !important;}'; |
1c88ba
|
441 |
head.appendChild(style); |
ea7879
|
442 |
head.appendChild(style1); |
1c88ba
|
443 |
</script> |
Z |
444 |
|
|
445 |
{elseif $op=='allcategory'} |
|
446 |
<link href="{MODULE_URL}template/mobile/{$template}/style/cssv2/all-category.css?v={$versions}" rel="stylesheet" /> |
|
447 |
|
|
448 |
<div class="header-2 cbox"> |
|
449 |
<a href="javascript:history.go(-1);" class="ico go-back"></a> |
|
450 |
<div class="flex title" style="max-width:80%;">{$title}</div> |
|
451 |
</div> |
|
452 |
|
|
453 |
<!-- 分类 START--> |
|
454 |
<div class="fui-fullHigh-group max-width-640"> |
|
455 |
<div class="category-inner menu"> |
|
456 |
<nav class="category-switch on">推荐分类</nav> |
|
457 |
{loop $categorylist $key $item} |
|
458 |
<nav class="category-switch">{$item['name']}</nav> |
|
459 |
{/loop} |
|
460 |
</div> |
|
461 |
<div class="category-inner container"> |
|
462 |
<div class="all-category-son"> |
|
463 |
<div class="category-right"> |
|
464 |
<a href="{php echo $this->createMobileUrl('search');}" class="category-item"> |
|
465 |
<div class="icon radius"> |
|
466 |
<img src="{$all_category_ico}"> |
|
467 |
</div> |
|
468 |
<div class="text">全部课程</div> |
|
469 |
</a> |
|
470 |
{loop $hot_category $hot} |
|
471 |
<a href="{php echo $hot['link'] ? $hot['link'] : $this->createMobileUrl('search',array('cat_id'=>$hot['id']));}" class="category-item"> |
|
472 |
<div class="icon radius"> |
|
473 |
<img src="{$_W['attachurl']}{$hot['ico']}"> |
|
474 |
</div> |
|
475 |
<div class="text">{$hot['name']}</div> |
|
476 |
</a> |
|
477 |
{/loop} |
|
478 |
</div> |
|
479 |
</div> |
|
480 |
|
|
481 |
{loop $categorylist $key $parent} |
|
482 |
<div class="all-category-son" style="display:none;"> |
|
483 |
<div class="category-right"> |
|
484 |
<a href="{php echo $parent['link'] ? $parent['link'] : $this->createMobileUrl('search', array('cat_id'=>$parent['id'],'pid'=>$parent['id']));}" class="category-item"> |
|
485 |
<div class="icon radius"> |
|
486 |
<img src="{$_W['attachurl']}{$parent['ico']}"> |
|
487 |
</div> |
|
488 |
<div class="text">{$parent['name']}</div> |
|
489 |
</a> |
|
490 |
|
|
491 |
{loop $parent['child'] $son} |
|
492 |
<a href="{php echo $son['link'] ? $son['link'] : $this->createMobileUrl('search', array('cat_id'=>$son['id'],'pid'=>$parent['id']));}" class="category-item"> |
|
493 |
<div class="icon radius"> |
|
494 |
<img src="{$_W['attachurl']}{$son['ico']}"> |
|
495 |
</div> |
|
496 |
<div class="text">{$son['name']}</div> |
|
497 |
</a> |
|
498 |
{/loop} |
|
499 |
</div> |
|
500 |
</div> |
|
501 |
{/loop} |
|
502 |
</div> |
|
503 |
</div> |
|
504 |
<!-- 分类 END--> |
|
505 |
<script type="text/javascript"> |
|
506 |
$(".category-inner").on("click", 'nav', function() { |
|
507 |
var $currItem = $(this), |
|
508 |
index = $currItem.index(); |
|
509 |
|
|
510 |
$currItem.addClass('on').siblings().removeClass('on'); |
|
511 |
$(".all-category-son").hide().eq(index).show(); |
|
512 |
}) |
|
513 |
</script> |
|
514 |
|
|
515 |
{/if} |
|
516 |
|
|
517 |
{template $template.'/_footerv2'} |