works.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. import httpRequestApi from '../../../utils/APIClient';
  2. Page({
  3. data: {
  4. fullScreenBtn: false,
  5. playBtn: false,
  6. gesture: true,
  7. user: [{
  8. nickName: '萝莉小猫咪',
  9. image: '../../../static/image/timg.jpg',
  10. },
  11. {
  12. nickName: '萝莉小猫咪',
  13. image: '../../../static/image/timg.jpg',
  14. },
  15. {
  16. nickName: '萝莉小猫咪',
  17. image: '../../../static/image/timg.jpg',
  18. },
  19. {
  20. nickName: '萝莉小猫咪',
  21. image: '../../../static/image/timg.jpg',
  22. },
  23. {
  24. nickName: '萝莉小猫咪',
  25. image: '../../../static/image/timg.jpg',
  26. },
  27. {
  28. nickName: '萝莉小猫咪',
  29. image: '../../../static/image/timg.jpg',
  30. },
  31. {
  32. nickName: '萝莉小猫咪',
  33. image: '../../../static/image/timg.jpg',
  34. },
  35. {
  36. nickName: '萝莉小猫咪',
  37. image: '../../../static/image/timg.jpg',
  38. },
  39. {
  40. nickName: '萝莉小猫咪',
  41. image: '../../../static/image/timg.jpg',
  42. },
  43. {
  44. nickName: '萝莉小猫咪',
  45. image: '../../../static/image/timg.jpg',
  46. },
  47. {
  48. nickName: '萝莉小猫咪',
  49. image: '../../../static/image/timg.jpg',
  50. },
  51. {
  52. nickName: '萝莉小猫咪',
  53. image: '../../../static/image/timg.jpg',
  54. }
  55. ],
  56. inputValue: 'smdx',
  57. text: '总有一天我将实质性操作死去而你我的\xa0\xa0\xa0\xa0\xa0\xa0\xa0儿子自行车在啊实打实大苏打撒旦将加冕为王'
  58. },
  59. onLoad: function (option) {
  60. console.log(option)
  61. if (option.title) {
  62. wx.setNavigationBarTitle({
  63. title: option.title //页面标题为路由参数
  64. })
  65. this.setData({
  66. title: option.title,
  67. id: option.id
  68. })
  69. }
  70. let uid = 1;
  71. httpRequestApi.getWorksDetail(uid, option.id).success((res) => {
  72. console.log(res);
  73. this.getReply();
  74. });
  75. },
  76. goToReading: function () {
  77. let id = this.data.id;
  78. let title = this.data.title;
  79. wx.navigateTo({
  80. url: `../../main/reading/reading?id=${id}&title=${title}`
  81. })
  82. },
  83. onShareAppMessage: function (res) {
  84. if (res.from === 'button') {
  85. // 来自页面内转发按钮
  86. console.log(res.target)
  87. }
  88. return {
  89. title: '测试',
  90. path: '/pages/social/works/works'
  91. }
  92. },
  93. follow: function () {
  94. let uid = 1;
  95. let followUid = 2;
  96. httpRequestApi.followUser(uid, followUid).success((res) => {
  97. console.log(res)
  98. });
  99. },
  100. // 去其他用户的作品页
  101. goToOthers: function (e) {
  102. wx.navigateTo({
  103. url: `../../main/reading/reading?id=${id}&title=${title}`
  104. })
  105. },
  106. // 查询回复
  107. getReply: function () {
  108. let uid = 1;
  109. let columnId = 1001;
  110. let pageNo = 1;
  111. let pageSize = 10;
  112. httpRequestApi.getReply(uid, columnId, pageNo, pageSize).success((res) => {
  113. console.log(res);
  114. });
  115. },
  116. // 打开回复详情页
  117. goToDetail: function (e) {
  118. let id = e.currentTarget.dataset.id;
  119. let num = e.currentTarget.dataset.num;
  120. console.log(e);
  121. wx.navigateTo({
  122. url: `../../social/replyDetail/replyDetail?id=${id}&num=${num}`
  123. })
  124. },
  125. // 绑定输入框内容
  126. inputValue: function (e) {
  127. this.setData({
  128. inputValue: e.detail.value
  129. });
  130. },
  131. // 发布回复
  132. sendHandler: function () {
  133. console.log(this.data.inputValue);
  134. if (this.data.inputValue !== '') {
  135. // let uid = 1;
  136. // let data = {
  137. // "postId": 1,
  138. // "content": this.data.inputValue
  139. // }
  140. // httpRequestApi.postReplyComment(uid, data).success(res => {
  141. // console.log(res);
  142. // });
  143. let uid = 1;
  144. let data = {
  145. "columnId": '1541403885738293',
  146. colunmNames: '金色巴掌',
  147. "detailDesc": this.data.inputValue
  148. }
  149. httpRequestApi.postReply(uid, data).success(res => {
  150. console.log(res);
  151. });
  152. }
  153. }
  154. })