index.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // pages/videoDetail/index.js
  2. import { httpCloud } from "../../utils/httpFunc";
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. media: {},
  9. indexItem: {}
  10. },
  11. toNext(e){
  12. wx.redirectTo({
  13. url: "/pages/videoDetail/index?id=" + this.data.media.id + '&index=' + e.currentTarget.dataset.index
  14. })
  15. },
  16. /**
  17. * 生命周期函数--监听页面加载
  18. */
  19. onLoad(options) {
  20. const _this = this;
  21. console.log(options)
  22. httpCloud({
  23. name: "server",
  24. type: "getMediaControllerOnce",
  25. data: {
  26. typeMedia: 'video',
  27. id: options.id
  28. },
  29. call(res) {
  30. const ori = res || {child: []};
  31. _this.setData({
  32. media: ori,
  33. indexItem: ori.child[options.index]
  34. })
  35. console.log(res)
  36. wx.setNavigationBarTitle({
  37. title: ori.child[options.index].title
  38. })
  39. }
  40. })
  41. },
  42. /**
  43. * 生命周期函数--监听页面初次渲染完成
  44. */
  45. onReady() {
  46. },
  47. /**
  48. * 生命周期函数--监听页面显示
  49. */
  50. onShow() {
  51. },
  52. /**
  53. * 生命周期函数--监听页面隐藏
  54. */
  55. onHide() {
  56. },
  57. /**
  58. * 生命周期函数--监听页面卸载
  59. */
  60. onUnload() {
  61. },
  62. /**
  63. * 页面相关事件处理函数--监听用户下拉动作
  64. */
  65. onPullDownRefresh() {
  66. },
  67. /**
  68. * 页面上拉触底事件的处理函数
  69. */
  70. onReachBottom() {
  71. },
  72. /**
  73. * 用户点击右上角分享
  74. */
  75. onShareAppMessage() {
  76. }
  77. })