movie.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. // pages/movie/movie.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. guochan: {},
  8. zongyi: {},
  9. meiju: {}
  10. },
  11. //跳转
  12. goListPage(event) {
  13. let _id = event.currentTarget.dataset.id
  14. wx.navigateTo({
  15. url: '/pages/list/list?id=' + _id,
  16. })
  17. },
  18. //获取国产热播剧
  19. getGuochan() {
  20. wx.request({
  21. url: 'https://m.douban.com/rexxar/api/v2/subject_collection/tv_domestic/items?start=0&count=8',
  22. success: (res) => {
  23. console.log(res.data)
  24. this.setData({
  25. guochan: res.data
  26. })
  27. }
  28. })
  29. },
  30. //获取综艺节目
  31. getZongyi() {
  32. wx.request({
  33. url: 'https://m.douban.com/rexxar/api/v2/subject_collection/tv_variety_show/items?start=0&count=8',
  34. success: (res) => {
  35. console.log(res.data)
  36. this.setData({
  37. zongyi: res.data
  38. })
  39. }
  40. })
  41. },
  42. //获取美剧
  43. getMeiju() {
  44. wx.request({
  45. url: 'https://m.douban.com/rexxar/api/v2/subject_collection/tv_american/items?start=0&count=8',
  46. success: (res) => {
  47. this.setData({
  48. meiju: res.data
  49. })
  50. }
  51. })
  52. },
  53. /**
  54. * 生命周期函数--监听页面加载
  55. */
  56. onLoad(options) {
  57. this.getGuochan()
  58. this.getZongyi()
  59. this.getMeiju()
  60. },
  61. /**
  62. * 生命周期函数--监听页面初次渲染完成
  63. */
  64. onReady() {
  65. },
  66. /**
  67. * 生命周期函数--监听页面显示
  68. */
  69. onShow() {
  70. },
  71. /**
  72. * 生命周期函数--监听页面隐藏
  73. */
  74. onHide() {
  75. },
  76. /**
  77. * 生命周期函数--监听页面卸载
  78. */
  79. onUnload() {
  80. },
  81. /**
  82. * 页面相关事件处理函数--监听用户下拉动作
  83. */
  84. onPullDownRefresh() {
  85. },
  86. /**
  87. * 页面上拉触底事件的处理函数
  88. */
  89. onReachBottom() {
  90. console.log(111)
  91. },
  92. /**
  93. * 用户点击右上角分享
  94. */
  95. onShareAppMessage() {
  96. }
  97. })