hot.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import httpRequestApi from '../../utils/APIClient';
  2. export const hotInit = (that) => {
  3. that.setData({
  4. hotData: {
  5. title: '热门',
  6. imgUrls: [
  7. 'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
  8. 'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg',
  9. 'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
  10. ],
  11. indicatorDots: true,
  12. autoplay: true,
  13. interval: 5000,
  14. duration: 700,
  15. circular: true,
  16. hotWareCardFirst: 'hotWareCardFirst',
  17. hotWareCard : 'hotWareCard',
  18. hotSearch: '鹅鹅鹅',
  19. wareCards:[
  20. {
  21. title:"铺满色巴掌的水泥道",
  22. grade:"一年级 上学期",
  23. img: "../../static/image/timg.jpg",
  24. plays: "1",
  25. likes: "2",
  26. classId: "1"
  27. },
  28. {
  29. title:"铺满金色巴掌的水泥道",
  30. grade:"一年级 上学期",
  31. img: "../../static/image/timg.jpg",
  32. plays: "12345",
  33. likes: "54321",
  34. classId: "2"
  35. },
  36. {
  37. title:"铺满金色巴掌的水泥道",
  38. grade:"一年级 上学期",
  39. img: "../../static/image/timg.jpg",
  40. plays: "12345",
  41. likes: "54321",
  42. classId: "2"
  43. },
  44. ]
  45. }
  46. }),
  47. // 搜索方法
  48. that.searchHandler = () => {
  49. console.log('搜索按钮')
  50. console.log(that.data.hotInput);
  51. },
  52. // 输入框输入
  53. that.inputHandler = (e) => {
  54. that.setData({
  55. hotInput: e.detail.value
  56. });
  57. console.log(that.data.hotInput)
  58. }
  59. // 打开课程页面
  60. that.openBooks = (e) =>{
  61. wx.navigateTo({
  62. url: `../main/books/books`
  63. })
  64. }
  65. // 打开课程页面
  66. that.openClass = (e) =>{
  67. let classId = e.currentTarget.dataset.classid;
  68. let title = e.currentTarget.dataset.title;
  69. wx.navigateTo({
  70. url: `../main/class/class?id=${classId}&title=${title}`
  71. })
  72. }
  73. // 打开用户作品页面
  74. that.openWorks = (e) =>{
  75. let classId = e.currentTarget.dataset.classid;
  76. let title = e.currentTarget.dataset.title;
  77. wx.navigateTo({
  78. url: `../social/works/works?id=${classId}&title=${title}`
  79. })
  80. }
  81. that.getIndex = (uid)=>{
  82. httpRequestApi.getIndex({
  83. uid
  84. }).success((res)=>{
  85. console.log(res);
  86. })
  87. }
  88. that.getHotRecommend = (uid,pageNo,pageSize)=>{
  89. console.log(pageNo)
  90. httpRequestApi.getHotRecommend(
  91. uid,
  92. pageNo,
  93. pageSize
  94. ).success((res)=>{
  95. console.log(res);
  96. })
  97. }
  98. that.getIndex(1);
  99. that.getHotRecommend(1,1,3)
  100. }