hot.js 2.2 KB

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