publisherDetail.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. const util = require('../../utils/util.js')
  2. Page({
  3. data: {
  4. publisherInfo: {},
  5. },
  6. // processData: function (start, arr) {
  7. // for (let i = start; i < arr.length; i++) {
  8. // arr[i].time = util.handleDate(arr[i].time)
  9. // }
  10. // this.setData({
  11. // mainDatas: arr
  12. // })
  13. // wx.hideLoading()
  14. // },
  15. // onLoad: function (options) {
  16. // wx.showLoading({
  17. // title: "加载中"
  18. // })
  19. // const db = wx.cloud.database()
  20. // db.collection("publisherInfoData").doc(options.id).get({
  21. // success: function (res) {
  22. // this.setData({
  23. // publisherInfo: res.data
  24. // })
  25. // db.collection("mainData").where({
  26. // publisherName: this.data.publisherInfo.publisherName
  27. // }).orderBy("time", "desc").limit(20).get({
  28. // success: function (res) {
  29. // this.processData(0, res.data)
  30. // }.bind(this)
  31. // })
  32. // }.bind(this)
  33. // })
  34. // db.collection("likeData").where({
  35. // type: "publisher",
  36. // id: options.id
  37. // }).get({
  38. // success: function (res) {
  39. // this.setData({
  40. // like: res.data.length
  41. // })
  42. // }.bind(this)
  43. // })
  44. // },
  45. /**
  46. * 生命周期函数--监听页面加载
  47. */
  48. onLoad: function (options) {
  49. wx.showLoading({
  50. title: "加载中"
  51. })
  52. wx.cloud.callFunction({
  53. name: 'getPublisher',
  54. data: {
  55. pub_id: options.id
  56. }
  57. }).then(res => {
  58. wx.hideLoading()
  59. this.setData({
  60. publisherInfo: res.result.data
  61. })
  62. })
  63. }
  64. })