moments.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. export const publishMoments = (workMoment) =>
  2. uni.$u?.http.post(
  3. "/office/work_moment/add",
  4. JSON.stringify({
  5. ...workMoment,
  6. }),
  7. {
  8. header: {
  9. token: uni.getStorageSync("BusinessToken"),
  10. },
  11. },
  12. );
  13. export const deleteMoments = (workMomentID) =>
  14. uni.$u?.http.post(
  15. "/office/work_moment/del",
  16. JSON.stringify({
  17. workMomentID,
  18. }),
  19. {
  20. header: {
  21. token: uni.getStorageSync("BusinessToken"),
  22. },
  23. },
  24. );
  25. export const getMomentsByID = (workMomentID) =>
  26. uni.$u?.http.post(
  27. "/office/work_moment/get",
  28. JSON.stringify({
  29. workMomentID,
  30. }),
  31. {
  32. header: {
  33. token: uni.getStorageSync("BusinessToken"),
  34. },
  35. },
  36. );
  37. export const getUserMomentsSplit = (userID, pageNumber, showNumber = 20) =>
  38. uni.$u?.http.post(
  39. "/office/work_moment/find/send",
  40. JSON.stringify({
  41. userID,
  42. pagination: {
  43. showNumber,
  44. pageNumber,
  45. },
  46. }),
  47. {
  48. header: {
  49. token: uni.getStorageSync("BusinessToken"),
  50. },
  51. },
  52. );
  53. export const getSelfMomentsSplit = (pageNumber, showNumber = 20) =>
  54. uni.$u?.http.post(
  55. "/office/work_moment/find/recv",
  56. JSON.stringify({
  57. pagination: {
  58. showNumber,
  59. pageNumber,
  60. },
  61. }),
  62. {
  63. header: {
  64. token: uni.getStorageSync("BusinessToken"),
  65. },
  66. },
  67. );
  68. export const likeMoments = (workMomentID, like) =>
  69. uni.$u?.http.post(
  70. "/office/work_moment/like",
  71. JSON.stringify({
  72. workMomentID,
  73. like,
  74. }),
  75. {
  76. header: {
  77. token: uni.getStorageSync("BusinessToken"),
  78. },
  79. },
  80. );
  81. export const commentMoments = (workMomentID, content, replyUserID) =>
  82. uni.$u?.http.post(
  83. "/office/work_moment/comment/add",
  84. JSON.stringify({
  85. workMomentID,
  86. content,
  87. replyUserID,
  88. }),
  89. {
  90. header: {
  91. token: uni.getStorageSync("BusinessToken"),
  92. },
  93. },
  94. );
  95. export const deleteComment = (workMomentID, commentID) =>
  96. uni.$u?.http.post(
  97. "/office/work_moment/comment/del",
  98. JSON.stringify({
  99. workMomentID,
  100. commentID,
  101. }),
  102. {
  103. header: {
  104. token: uni.getStorageSync("BusinessToken"),
  105. },
  106. },
  107. );
  108. export const getMomentUnreadCount = () =>
  109. uni.$u?.http.post(
  110. "/office/work_moment/unread/count",
  111. {},
  112. {
  113. header: {
  114. token: uni.getStorageSync("BusinessToken"),
  115. },
  116. },
  117. );
  118. // 1:未读数 2:消息列表 3:全部
  119. export const clearMomentUnreadCount = (type) =>
  120. uni.$u?.http.post(
  121. "/office/work_moment/unread/clear",
  122. JSON.stringify({
  123. type,
  124. }),
  125. {
  126. header: {
  127. token: uni.getStorageSync("BusinessToken"),
  128. },
  129. },
  130. );
  131. export const getMomentLogs = (pageNumber, showNumber = 20) =>
  132. uni.$u?.http.post(
  133. "/office/work_moment/logs",
  134. JSON.stringify({
  135. pagination: {
  136. showNumber,
  137. pageNumber,
  138. },
  139. }),
  140. {
  141. header: {
  142. token: uni.getStorageSync("BusinessToken"),
  143. },
  144. },
  145. );