index.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import {
  2. getNewComment
  3. } from '~/api/message'
  4. import {
  5. ReplyComment
  6. } from '~/api/video'
  7. import event from '~/mixins/event'
  8. import reachBottom from '~/mixins/reachBottom'
  9. Page({
  10. behaviors: [reachBottom,event],
  11. data: {},
  12. onShow(options) {
  13. this.resetData()
  14. },
  15. loadMore() {
  16. this.getData(getNewComment, {
  17. pageSize: 20
  18. })
  19. },
  20. setReply({
  21. currentTarget
  22. }) {
  23. wx.showModal({
  24. title: '回复评论',
  25. editable: true,
  26. confirmText: '发送',
  27. success: async (res) => {
  28. if (res.confirm) {
  29. if (!res.content) {
  30. return
  31. }
  32. let data = {
  33. postsId: currentTarget.dataset.id,
  34. content: res.content,
  35. }
  36. await ReplyComment(data)
  37. wx.showToast({
  38. title: '回复成功',
  39. })
  40. }
  41. }
  42. })
  43. },
  44. jumpUserInfo({
  45. currentTarget
  46. }) {
  47. wx.navigateTo({
  48. url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=user`,
  49. })
  50. },
  51. jumpWork({
  52. currentTarget
  53. }) {
  54. let {
  55. id,
  56. commentlog
  57. } = currentTarget.dataset
  58. wx.navigateTo({
  59. url: `/pages/userWorks/index?id=${id}&onceId=${commentlog}&type=comment`,
  60. })
  61. },
  62. })