index.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. {extend name="layout/layout" /}
  2. {block name="title"}分类{/block}
  3. {block name="css"}
  4. <!-- 这里引入css -->
  5. <link href="{:asset('/css/frontend/common.css')}" rel="stylesheet" type="text/css">
  6. <link href="{:asset('/css/frontend/classify.css')}" rel="stylesheet" type="text/css">
  7. <link href="{:asset('/css/frontend/swiper/swiper.min.css')}" rel="stylesheet" type="text/css">
  8. <link href="{:asset('/css/frontend/ad/swiper.css')}" rel="stylesheet" type="text/css">
  9. <link href="{:asset('/css/frontend/ad/image.css')}" rel="stylesheet" type="text/css">
  10. <style type="text/css">
  11. .read_popup_box, .custom_popup_box{
  12. position: fixed;
  13. left: 0;
  14. right: 0;
  15. bottom: 0;
  16. top: 0;
  17. z-index: 999;
  18. background-color: rgba(0,0,0,.5);
  19. font-size: 0;
  20. text-align: center;
  21. white-space: nowrap;
  22. }
  23. .rpb_main,
  24. .rpb_jgb{
  25. display: inline-block;
  26. vertical-align: middle;
  27. }
  28. .rpb_jgb{
  29. overflow: hidden;
  30. height: 100%;
  31. margin-left: -1px;
  32. width: 1px;
  33. }
  34. .rpb_main{
  35. overflow: hidden;
  36. width: 100%;
  37. }
  38. .rpbm_box{
  39. padding: .3rem .16rem .1rem;
  40. position: relative;
  41. left: 0;
  42. top: 0;
  43. overflow: hidden;
  44. background-color: #fff;
  45. margin: .14rem .48rem;
  46. border-radius: .16rem;
  47. white-space: normal;
  48. -webkit-box-shadow: 0 .03rem .1rem rgba(0, 0, 0, 1);
  49. box-shadow: 0 .03rem .1rem rgba(0, 0, 0, 1);
  50. }
  51. .rpbm_box a{
  52. display: block;
  53. }
  54. .rpb_img{
  55. overflow: hidden;
  56. margin: 0 auto .16rem;
  57. height: 1.39rem;
  58. width: 1.04rem;
  59. border-radius: .04rem;
  60. -webkit-box-shadow: 0 0 .1rem rgba(0, 0, 0, 0.4);
  61. box-shadow: 0 0 .1rem rgba(0, 0, 0, 0.4);
  62. }
  63. .rpb_img a,
  64. .rpb_img img{
  65. overflow: hidden;
  66. display: block;
  67. width: 100%;
  68. height: 100%;
  69. border-radius: .04rem;
  70. }
  71. .rpb_tit{
  72. overflow: hidden;
  73. margin: 0 0 .16rem;
  74. height: .26rem;
  75. font-size: .18rem;
  76. color: #000;
  77. line-height: .26rem;
  78. }
  79. .rpb_tit a{
  80. overflow: hidden;
  81. display: block;
  82. height: .26rem;
  83. font-size: .18rem;
  84. color: #000;
  85. line-height: .26rem;
  86. display: -webkit-box;
  87. -webkit-box-orient: vertical;
  88. -webkit-line-clamp: 1;
  89. }
  90. .rpb_p{
  91. margin-bottom: .1rem;
  92. overflow: hidden;
  93. max-height: .72rem;
  94. }
  95. .rpb_p a{
  96. overflow: hidden;
  97. display: block;
  98. font-size: .14rem;
  99. color: rgba(0,0,0,.5);
  100. text-align: left;
  101. line-height: .24rem;
  102. display: -webkit-box;
  103. -webkit-box-orient: vertical;
  104. -webkit-line-clamp: 3;
  105. }
  106. .rpb_but{
  107. text-align: center;
  108. height: .3rem;
  109. }
  110. .rpb_but a{
  111. display: block;
  112. height: .3rem;
  113. text-align: center;
  114. font-size: .16rem;
  115. color: #007aff;
  116. line-height: .3rem;
  117. }
  118. .rpbm_close_but{
  119. display: block;
  120. position: absolute;
  121. right: .1rem;
  122. top: .1rem;
  123. height: .2rem;
  124. width: .2rem;
  125. background: url(/assets/img/frontend/icon/cha_icon_2.png) no-repeat center center;
  126. background-size: .14rem .14rem;
  127. border-radius: .2rem;
  128. }
  129. </style>
  130. {/block}
  131. {block name="zepto"}
  132. <!-- 这是zepto插件 -->
  133. {/block}
  134. {block name="menu_title"}分类{/block}
  135. {block name="main"}
  136. <!-- 这是正文 -->
  137. <div class="body_sytle">
  138. <div class="c_list_box">
  139. <div class="c_list_tab_box">
  140. <a href="javascript:;" {neq name="sex" value="2"} class="hover" {/neq} sex="1">男生</a>
  141. <a href="javascript:;" {eq name="sex" value="2"} class="hover" {/eq} sex="2">女生</a>
  142. </div>
  143. <ul class="c_list_ul"></ul>
  144. <!--广告 分类首页-->
  145. <div class="ad_position_15"></div>
  146. </div>
  147. </div>
  148. {/block}
  149. {block name="footer"}
  150. <!-- 这里引入底部footer -->
  151. <!--活动弹框-->
  152. <div {empty name="activityRes"}style="display: none;" {else /}data-type="1"{/empty} class="christmas_popup_box">
  153. <div class="christmas_body">
  154. <div class="christmas_main">
  155. <a href="javascript:;" class="christmas_close_2"></a>
  156. {notempty name="$activityRes"}
  157. <a href="/s/0?rid={$activityRes.id}&aid={$activityRes.aid}" class="christmas_main_but"><img src="{$activityRes.popimage}" /></a>
  158. {/notempty}
  159. </div>
  160. </div>
  161. <div class="christmas_jgb"></div>
  162. </div>
  163. <!--继续阅读弹框-->
  164. {notempty name="$continueData"}
  165. <div class="read_popup_box">
  166. <div class="rpb_main">
  167. <div class="rpbm_box">
  168. <a href="javascript:;" class="rpbm_close_but"></a>
  169. <div class="rpb_img"><a href="{$continueData.url}"><img src="{$continueData.image}" /></a> </div>
  170. <div class="rpb_tit"><a href="{$continueData.url}">{$continueData.book_name}</a></div>
  171. <div class="rpb_p"><a href="{$continueData.url}">{$continueData.description}</a> </div>
  172. <div class="rpb_but"><a href="{$continueData.url}">继续阅读 ></a> </div>
  173. </div>
  174. </div>
  175. <div class="rpb_jgb"></div>
  176. </div>
  177. {/notempty}
  178. <!--客服消息弹框-->
  179. {notempty name="$customData"}
  180. <div class="custom_popup_box" data-resouce_id="{$customData.custom_id}">
  181. <div class="rpb_main">
  182. <div class="rpbm_box">
  183. <a href="javascript:;" class="rpbm_close_but"></a>
  184. <div class="rpb_img"><a href="{$customData.url}"><img src="{$customData.image}" /></a> </div>
  185. <div class="rpb_tit"><a href="{$customData.url}">{$customData.book_name}</a></div>
  186. <div class="rpb_p"><a href="{$customData.url}">{$customData.description}</a> </div>
  187. <div class="rpb_but"><a href="{$customData.url}">继续阅读 ></a> </div>
  188. </div>
  189. </div>
  190. <div class="rpb_jgb"></div>
  191. </div>
  192. {/notempty}
  193. {/block}
  194. {block name="js"}
  195. <!-- 这里引入js -->
  196. <script type="text/javascript">
  197. $(function(){
  198. var sex = {$sex};
  199. loadCategories(sex);
  200. $(".c_list_tab_box > a").click(function(){
  201. $(this).addClass("hover");
  202. $(this).siblings().removeClass("hover");
  203. var sex = $(this).attr("sex");
  204. loadCategories(sex);
  205. });
  206. })
  207. function loadCategories(sex){
  208. var opposite = (sex==1) ? 2 : 1;
  209. $(".sex_"+opposite).hide();
  210. if(!$(".sex_"+sex).length){
  211. makeCategoryHtml(sex);
  212. }
  213. $(".sex_"+sex).show();
  214. }
  215. function makeCategoryHtml(sex){
  216. $.get("/api/category/channelcategoriesapi",{'sex':sex},function(data){
  217. $.each(data,function(key,value){
  218. var imgList = [
  219. "{:asset('/img/frontend/banner/classify_icon_1.png')}",
  220. "{:asset('/img/frontend/banner/classify_icon_2.png')}",
  221. "{:asset('/img/frontend/banner/classify_icon_3.png')}",
  222. "{:asset('/img/frontend/banner/classify_icon_4.png')}",
  223. "{:asset('/img/frontend/banner/classify_icon_5.png')}",
  224. "{:asset('/img/frontend/banner/classify_icon_6.png')}",
  225. "{:asset('/img/frontend/banner/classify_icon_7.png')}"
  226. ];
  227. var simg = imgList[(key % 7)];
  228. if(value.image){
  229. simg = value.image;
  230. }
  231. var item = '<li class="sex_'+sex+'">';
  232. item +='<a href="/index/category/books?book_category_id='+value.id+'&sex='+sex+'" category-id="'+value.id+'">';
  233. item +='<span>' +value.name+ '</span>';
  234. item +='<img src="'+simg+'" />';
  235. item +='</a>';
  236. item +='</li>';
  237. $("ul.c_list_ul").append(item);
  238. });
  239. });
  240. }
  241. </script>
  242. <script type="text/javascript" src="{:asset('/js/frontend/swiper/swiper.min.js')}"></script>
  243. <!-- 多条广告如下脚本只需引入一次 -->
  244. {if condition="$isAdPick"}
  245. {include file="public/ad_common_js"}
  246. {/if}
  247. <script>
  248. window.$isAdPick = '{$isAdPick}'
  249. window.$adLatestVersion = '{$ad_latest_version}'
  250. $(function(){
  251. window.$isAdPick == '1' && window.simpleAD.render(window.AD_PAGE_CODE.CATEGORY_MAIN)
  252. })
  253. </script>
  254. {/block}