index.js 1.2 KB

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