show.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <view id="moments" style="width: 100%;">
  3. <view class="moments__post">
  4. <view class="post-left">
  5. <image class="post_header" src="@/static/index/test/header04.jpg"></image>
  6. </view>
  7. <view class="post_right">
  8. <text class="post-username">昵称</text>
  9. <view id="paragraph" class="paragraph">文字内容</view>
  10. <!-- 相册 -->
  11. <view class="thumbnails">
  12. </view>
  13. <!-- 资料条 -->
  14. <view class="toolbar">
  15. <view class="timestamp">2020年9月25日 11:04 <text style="margin-left: 10rpx;color: #36648B;" hover-class="tui-actionsheet-hover">删除</text></view>
  16. <view class="like">
  17. <image src="../../static/index/islike.png"></image>
  18. </view>
  19. <view class="comment" @tap="comment(index)">
  20. <image src="../../static/index/comment.png"></image>
  21. </view>
  22. </view>
  23. </view>
  24. <!-- 结束 post -->
  25. </view>
  26. <!-- 赞/评论区 -->
  27. <view class="moments__post" style="margin-top: 20rpx;">
  28. <view class="post_right" style="padding-left: 0;">
  29. <view class="post-footer" style="margin-top: 0;border-radius:8rpx">
  30. <view class="footer_content tui-flex">
  31. <view class="tui-center tui-col-1">
  32. <tui-icon style="position: absolute;top: 10px;" name="like" :size="16" color="#36648B"></tui-icon>
  33. </view>
  34. <view class="tui-center tui-col-11" style="display: -webkit-box;">
  35. <image class="post_toux" src="@/static/index/test/header01.jpg"></image>
  36. <image class="post_toux" src="@/static/index/test/header01.jpg"></image>
  37. <image class="post_toux" src="@/static/index/test/header01.jpg"></image>
  38. <image class="post_toux" src="@/static/index/test/header01.jpg"></image>
  39. <image class="post_toux" src="@/static/index/test/header01.jpg"></image>
  40. <image class="post_toux" src="@/static/index/test/header01.jpg"></image>
  41. <image class="post_toux" src="@/static/index/test/header01.jpg"></image>
  42. <image class="post_toux" src="@/static/index/test/header01.jpg"></image>
  43. <image class="post_toux" src="@/static/index/test/header01.jpg"></image>
  44. <image class="post_toux" src="@/static/index/test/header01.jpg"></image>
  45. <image class="post_toux" src="@/static/index/test/header01.jpg"></image>
  46. <image class="post_toux" src="@/static/index/test/header01.jpg"></image>
  47. </view>
  48. </view>
  49. <view class="footer_content" style="padding: 10rpx;" @tap="reply">
  50. <view class="moments__huifu" style="width: 100%;">
  51. <view class="post-left">
  52. <image class="post_toux" src="@/static/index/test/header04.jpg"></image>
  53. </view>
  54. <view class="post_right">
  55. <view class="comment-nickname">昵称</view>
  56. <view class="comment-content">文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容</view>
  57. </view>
  58. <!-- 结束 post -->
  59. </view>
  60. <view class="moments__huifu" style="width: 100%;">
  61. <view class="post-left">
  62. <image class="post_toux" src="@/static/index/test/header04.jpg"></image>
  63. </view>
  64. <view class="post_right">
  65. <text class="comment-nickname">昵称</text>
  66. <view class="comment-content"><text>回复<text class="comment-nickname" style="margin-left: 10rpx">王小虎:</text></text>文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容文字内容</view>
  67. </view>
  68. <!-- 结束 post -->
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="foot" v-show="showInput">
  75. <chat-input @send-message="send_comment" @blur="blur" :focus="focus" :placeholder="input_placeholder"></chat-input>
  76. <!-- <chat-input @send-message="send_comment" @blur="blur" :placeholder="input_placeholder"></chat-input> -->
  77. </view>
  78. <view class="uni-loadmore" v-if="showLoadMore">{{loadMoreText}}</view>
  79. </view>
  80. </template>
  81. <script>
  82. import chatInput from '../../components/im-chat/chatinput.vue'; //input框
  83. import postData from '../../common/index/index.post.data.js';//朋友圈数据
  84. import tuiIcon from '@/components/thorui/tui-icon/tui-icon';
  85. export default {
  86. components: {
  87. chatInput,
  88. tuiIcon
  89. },
  90. data() {
  91. return {
  92. posts: postData,//模拟数据
  93. user_id: 4,
  94. username: 'Liuxy',
  95. index: '',
  96. comment_index: '',
  97. input_placeholder: '评论', //占位内容
  98. focus: false, //是否自动聚焦输入框
  99. is_reply: false, //回复还是评论
  100. showInput: false, //评论输入框
  101. screenHeight: '', //屏幕高度(系统)
  102. platform: '',
  103. windowHeight: '' ,//可用窗口高度(不计入软键盘)
  104. loadMoreText: "加载中...",
  105. showLoadMore: false
  106. }
  107. },
  108. computed:{
  109. },
  110. methods: {
  111. comment(index) {
  112. this.showInput = true; //调起input框
  113. this.focus = true;
  114. this.index = index;
  115. },
  116. reply(index, comment_index) {
  117. this.is_reply = true; //回复中
  118. this.showInput = true; //调起input框
  119. let replyTo = this.posts[index].comments.comment[comment_index].username;
  120. this.input_placeholder = '回复' + replyTo;
  121. this.index = index; //post索引
  122. this.comment_index = comment_index; //评论索引
  123. this.focus = true;
  124. },
  125. send_comment: function(message) {
  126. if (this.is_reply) {
  127. var reply_username = this.posts[this.index].comments.comment[this.comment_index].username;
  128. var comment_content = '回复' + reply_username + ':' + message.content;
  129. } else {
  130. var comment_content = message.content;
  131. }
  132. this.posts[this.index].comments.total += 1;
  133. this.posts[this.index].comments.comment.push({
  134. "uid": this.user_id,
  135. "username": this.username,
  136. "content": comment_content //直接获取input中的值
  137. });
  138. this.init_input();
  139. },
  140. blur: function() {
  141. this.init_input();
  142. },
  143. init_input() {
  144. this.showInput = false;
  145. this.focus = false;
  146. this.input_placeholder = '评论';
  147. this.is_reply = false;
  148. },
  149. }
  150. }
  151. </script>
  152. <style scoped>
  153. @import url("../../common/index/index.css");
  154. @import '@/static/style/thorui.css';
  155. .post_toux {
  156. width: 64rpx !important;
  157. height: 64rpx !important;
  158. border-radius: 10rpx;
  159. margin: 8rpx;
  160. }
  161. .moments__huifu {
  162. display: block;
  163. position: relative;
  164. display: -webkit-box;
  165. display: -webkit-flex;
  166. display: flex;
  167. border-top: 1px solid #dddddd;
  168. }
  169. </style>