classification.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. // pages/classification/classification.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. activeIndex:0,
  8. VerticalNavTop: 0,
  9. TabCur: 0,
  10. ificationTitle:[
  11. {title:"有声书"},
  12. {title:"畅销书"},
  13. {title:"儿童"},
  14. {title:"相声评书"},
  15. {title:"情感生活"},
  16. {title:"人文"},
  17. {title:"历史"},
  18. {title:"国学书院"},
  19. {title:"音乐"},
  20. {title:"英语"},
  21. {title:"教育培训"},
  22. {title:"健康养生"},
  23. {title:"广播剧"},
  24. {title:"戏曲"}
  25. ],
  26. ificationContent:[
  27. {
  28. title:"有声书",
  29. content:[
  30. {text:"言情"},
  31. {text:"悬疑"},
  32. {text:"都市"},
  33. {text:"幻想"},
  34. {text:"武侠"},
  35. {text:"历史"}
  36. ]
  37. },
  38. {
  39. title:"畅销书",
  40. content:[
  41. {text:"社科"},
  42. {text:"经管"},
  43. {text:"文学"},
  44. {text:"励志"},
  45. {text:"名著"},
  46. {text:"生活"}
  47. ]
  48. },
  49. {
  50. title:"儿童",
  51. content:[
  52. {text:"故事"},
  53. {text:"儿歌"},
  54. {text:"动画"},
  55. {text:"科普"},
  56. {text:"名著"},
  57. {text:"国学"}
  58. ]
  59. },
  60. {
  61. title:"相声评书",
  62. content:[
  63. {text:"单田芳"},
  64. {text:"郭德纲"},
  65. {text:"热门相声"},
  66. {text:"单口相声"},
  67. {text:"名家评书"},
  68. {text:"新锐笑将"}
  69. ]
  70. },
  71. {
  72. title:"情感生活",
  73. content:[
  74. {text:"恋爱技巧"},
  75. {text:"睡前夜话"},
  76. {text:"情绪压力"},
  77. {text:"婚姻家庭"},
  78. {text:"个人成长"},
  79. {text:"心理健康"}
  80. ]
  81. },
  82. {
  83. title:"人文",
  84. content:[
  85. {text:"言情"},
  86. {text:"悬疑"},
  87. {text:"都市"},
  88. {text:"幻想"},
  89. {text:"武侠"},
  90. {text:"历史"}
  91. ]
  92. },
  93. {
  94. title:"历史",
  95. content:[
  96. {text:"言情"},
  97. {text:"悬疑"},
  98. {text:"都市"},
  99. {text:"幻想"},
  100. {text:"武侠"},
  101. {text:"历史"}
  102. ]
  103. },
  104. {
  105. title:"国学书院",
  106. content:[
  107. {text:"言情"},
  108. {text:"悬疑"},
  109. {text:"都市"},
  110. {text:"幻想"},
  111. {text:"武侠"},
  112. {text:"历史"}
  113. ]
  114. },
  115. {
  116. title:"音乐",
  117. content:[
  118. {text:"言情"},
  119. {text:"悬疑"},
  120. {text:"都市"},
  121. {text:"幻想"},
  122. {text:"武侠"},
  123. {text:"历史"}
  124. ]
  125. },
  126. {
  127. title:"英语",
  128. content:[
  129. {text:"言情"},
  130. {text:"悬疑"},
  131. {text:"都市"},
  132. {text:"幻想"},
  133. {text:"武侠"},
  134. {text:"历史"}
  135. ]
  136. },
  137. {
  138. title:"教育培训",
  139. content:[
  140. {text:"言情"},
  141. {text:"悬疑"},
  142. {text:"都市"},
  143. {text:"幻想"},
  144. {text:"武侠"},
  145. {text:"历史"}
  146. ]
  147. },
  148. {
  149. title:"健康养生",
  150. content:[
  151. {text:"言情"},
  152. {text:"悬疑"},
  153. {text:"都市"},
  154. {text:"幻想"},
  155. {text:"武侠"},
  156. {text:"历史"}
  157. ]
  158. },
  159. {
  160. title:"广播剧",
  161. content:[
  162. {text:"言情"},
  163. {text:"悬疑"},
  164. {text:"都市"},
  165. {text:"幻想"},
  166. {text:"武侠"},
  167. {text:"历史"}
  168. ]
  169. },
  170. {
  171. title:"戏曲",
  172. content:[
  173. {text:"言情"},
  174. {text:"悬疑"},
  175. {text:"都市"},
  176. {text:"幻想"},
  177. {text:"武侠"},
  178. {text:"历史"}
  179. ]
  180. },
  181. ]
  182. },
  183. onLoad: function (options) {
  184. var that = this;
  185. //调用getSystemInfo APi获取到用户的手机屏幕高度,动态设置scroll-view的高度
  186. // 还有缺陷,代改进
  187. wx.getSystemInfo({
  188. success (res) {
  189. // var heightleft = (res.windowHeight*2);
  190. var height = (res.windowHeight*2);
  191. that.setData({
  192. phoneHeight:height,
  193. })
  194. }
  195. })
  196. },
  197. //随着滚动动态设置左侧边栏的选中态
  198. showActive:function (e) {
  199. //方法欠佳,还需改进
  200. var index = parseInt( e.detail.scrollTop/116);
  201. this.setData({
  202. activeIndex: index
  203. })
  204. },
  205. // 侧边栏的点击事件
  206. change:function (e){
  207. var that = this;
  208. that.setData({
  209. VerticalNavTop: (e.currentTarget.dataset.index - 1) * 50,
  210. activeIndex: e.currentTarget.dataset.index,
  211. TabCur: e.currentTarget.dataset.id,
  212. })
  213. },
  214. })