detail.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. const _Http = getApp().globalData.http;
  2. const MFT = require("../../utils/matchingFeilType");
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. active: 0,
  9. detailData: {},
  10. currentVideo: {},
  11. },
  12. tabChange({
  13. detail
  14. }) {
  15. this.setData({
  16. active: detail.index
  17. })
  18. },
  19. /**
  20. * 生命周期函数--监听页面加载
  21. */
  22. onLoad(options) {
  23. console.log(options)
  24. if (options.viewData) this.setData({
  25. viewData: options.viewData
  26. });
  27. _Http.basic({
  28. "classname": "saletool.courseware.courseware",
  29. "method": "selectDetail",
  30. "content": {
  31. "sat_coursewareid": options.id
  32. }
  33. }, false).then(res => {
  34. if (res.msg != '成功') return wx.showToast({
  35. title: res.data,
  36. icon: "none"
  37. });
  38. let list = MFT.fileList(res.data.attinfos);
  39. this.setData({
  40. detailData: res.data,
  41. flieList: list,
  42. currentVideo: list.find(v => v.fileType == 'video')
  43. })
  44. });
  45. },
  46. callBack({
  47. detail
  48. }) {
  49. this.setData({
  50. currentVideo: detail
  51. })
  52. },
  53. /**
  54. * 生命周期函数--监听页面初次渲染完成
  55. */
  56. onReady() {
  57. },
  58. /**
  59. * 生命周期函数--监听页面显示
  60. */
  61. onShow() {
  62. },
  63. /**
  64. * 生命周期函数--监听页面隐藏
  65. */
  66. onHide() {
  67. },
  68. /**
  69. * 生命周期函数--监听页面卸载
  70. */
  71. onUnload() {
  72. },
  73. /**
  74. * 页面相关事件处理函数--监听用户下拉动作
  75. */
  76. onPullDownRefresh() {
  77. },
  78. /**
  79. * 页面上拉触底事件的处理函数
  80. */
  81. onReachBottom() {
  82. },
  83. /**
  84. * 用户点击右上角分享
  85. */
  86. onShareAppMessage() {
  87. }
  88. })