newsPaper.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // pages/newsPaper/newsPaper.js
  2. import {getNewsPaper, getVideoRecommend}from '../api/newPaper-api'
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. pageData:[]
  9. },
  10. /**
  11. * 生命周期函数--监听页面加载
  12. */
  13. onLoad(options) {
  14. this.setPaper();
  15. },
  16. /**
  17. * 生命周期函数--监听页面初次渲染完成
  18. */
  19. onReady() {
  20. },
  21. /**
  22. * 生命周期函数--监听页面显示
  23. */
  24. onShow() {
  25. },
  26. /**
  27. * 生命周期函数--监听页面隐藏
  28. */
  29. onHide() {
  30. },
  31. /**
  32. * 生命周期函数--监听页面卸载
  33. */
  34. onUnload() {
  35. },
  36. /**
  37. * 页面相关事件处理函数--监听用户下拉动作
  38. */
  39. onPullDownRefresh() {
  40. },
  41. /**
  42. * 页面上拉触底事件的处理函数
  43. */
  44. onReachBottom() {
  45. },
  46. /**
  47. * 用户点击右上角分享
  48. */
  49. onShareAppMessage() {
  50. return {
  51. title: '直播南岸'
  52. }
  53. },
  54. setPaper(){
  55. // getNewsPaper().then(res=>{
  56. // console.log(res);
  57. // if(res.result){
  58. // this.setData({
  59. // pageData:res.data
  60. // })
  61. // }
  62. // })
  63. getVideoRecommend().then(res=>{
  64. // console.log(res);
  65. if(res.result){
  66. this.setData({
  67. pageData:res.data
  68. })
  69. }
  70. })
  71. },
  72. gotoWeb:function (data) {
  73. // console.log(data.currentTarget.dataset.contenturl);
  74. let url = data.currentTarget.dataset.contenturl
  75. wx.navigateTo({
  76. url: '/pages/web/web?url='+url,
  77. })
  78. }
  79. })