index.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import {
  2. getNewComment
  3. } from '~/api/message'
  4. import {
  5. ReplyComment
  6. } from '~/api/video'
  7. Page({
  8. data: {
  9. list: []
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad(options) {
  15. this.getNewComment()
  16. },
  17. async getNewComment() {
  18. let list = await getNewComment()
  19. console.log(list);
  20. this.setData({
  21. list
  22. })
  23. },
  24. setReply({
  25. currentTarget
  26. }) {
  27. console.log(currentTarget);
  28. wx.showModal({
  29. title: '回复评论',
  30. editable: true,
  31. confirmText: '发送',
  32. success: async (res) => {
  33. if (res.confirm) {
  34. if (!res.content) {
  35. return
  36. }
  37. let data = {
  38. postsId: currentTarget.dataset.id,
  39. content: res.content,
  40. }
  41. await ReplyComment(data)
  42. wx.showToast({
  43. title: '回复成功',
  44. })
  45. }
  46. }
  47. })
  48. },
  49. jumpUserInfo({
  50. currentTarget
  51. }) {
  52. wx.navigateTo({
  53. url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=user`,
  54. })
  55. },
  56. })