myFollow.js 792 B

1234567891011121314151617181920212223242526272829303132333435
  1. Component({
  2. data: {
  3. newMessage: []
  4. },
  5. lifetimes: {
  6. ready: function() {
  7. const db = wx.cloud.database()
  8. db.collection("likeData").where({
  9. type: "publisher"
  10. }).get({
  11. success: function (res) {
  12. this.processData(res.data)
  13. }.bind(this)
  14. })
  15. }
  16. },
  17. methods: {
  18. processData: function (arr) {
  19. const db = wx.cloud.database()
  20. for (let i = 0; i < arr.length; i++) {
  21. db.collection("publisherInfoData").doc(arr[i].id).get({
  22. success: function (res) {
  23. arr[i].publisherAvatar = res.data.publisherAvatar
  24. arr[i].publisherName = res.data.publisherName
  25. this.setData({
  26. newMessage: arr
  27. })
  28. }.bind(this)
  29. })
  30. }
  31. }
  32. }
  33. })