index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <view @touchmove.stop.prevent="moveHandle">
  3. <u-popup :show="show" :round="10">
  4. <view class="content">
  5. <view class="title">
  6. <text>共{{total}}条回复</text>
  7. <u-icon name="close" @click="close"></u-icon>
  8. </view>
  9. <!-- 楼主评论 -->
  10. <view class="commentBox">
  11. <view class="left">
  12. <!-- 圆形标记 -->
  13. <view class="comment_round"></view>
  14. <!-- 头像 -->
  15. <u-avatar :src="avatarSrc" shape="square"></u-avatar>
  16. </view>
  17. <!-- 名称、内容等 -->
  18. <view class="comment_detail">
  19. <view class="comment_info">
  20. <view>
  21. <text class="name">开心小市民</text>
  22. <text class="landlord">楼主</text>
  23. </view>
  24. <view class="likeNum">
  25. <i class="custom-icon custom-icon-thumb-up"></i>
  26. 543
  27. </view>
  28. </view>
  29. <view class="comment_content">我还在用果6</view>
  30. <view class="time">2分钟前</view>
  31. </view>
  32. </view>
  33. <!-- 分割线 -->
  34. <u-divider text="全部回复"></u-divider>
  35. <!-- 其他回复 -->
  36. <scroll-view style="maxHeight:50vh" :scroll-y="true" :refresher-enabled="true"
  37. :refresher-triggered="triggered" @scrolltolower="scrolltolower" @refresherrefresh="onRefresh"
  38. refresher-default-style="black">
  39. <!-- 需要滚动的区域 -->
  40. <view class="commentBox" v-for="item in 10" :key="item">
  41. <view class="left">
  42. <!-- 圆形标记 -->
  43. <view class="comment_round"></view>
  44. <!-- 头像 -->
  45. <u-avatar :src="avatarSrc" shape="square"></u-avatar>
  46. </view>
  47. <!-- 名称、内容等 -->
  48. <view class="comment_detail">
  49. <view class="comment_info">
  50. <view class="name">开心小市民</view>
  51. <view class="likeNum">
  52. <i class="custom-icon custom-icon-thumb-up"></i>
  53. 543
  54. </view>
  55. </view>
  56. <view class="comment_content">我还在用果6</view>
  57. <view class="comment_func">
  58. <view>
  59. <text class="reply" @click="handleApply">回复></text>
  60. <text class="time">2分钟前</text>
  61. </view>
  62. <view class="delete">删除</view>
  63. </view>
  64. </view>
  65. </view>
  66. </scroll-view>
  67. <!-- 评论框 -->
  68. <u--input placeholder="写评论" prefixIcon="edit-pen"
  69. prefixIconStyle="font-size: 22px;color: #909399;margin-left:10px" border="none"
  70. :customStyle="{height:'80rpx',marginTop: '50rpx',backgroundColor: '#eee'}"></u--input>
  71. </view>
  72. </u-popup>
  73. <!-- 回复弹出组件 -->
  74. <!-- <Reply :show="replyShow" @close="closeReply" /> -->
  75. </view>
  76. </template>
  77. <script>
  78. import Reply from '@/components/Reply/index.vue'
  79. export default {
  80. components: {
  81. Reply
  82. },
  83. props: {
  84. // 弹出层是否展示
  85. show: {
  86. type: Boolean,
  87. default: false
  88. },
  89. },
  90. data() {
  91. return {
  92. total: 0, // 总评论量
  93. triggered: false, // 下拉是否激活
  94. list: [], // 列表数据
  95. pageNum: 1,
  96. pageSize: 10,
  97. isRequesting: false, // 是否正在请求,如果是则返回,用于节流
  98. replyShow: false,
  99. avatarSrc: "http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg",
  100. };
  101. },
  102. methods: {
  103. closeReply() {
  104. this.replyShow = false
  105. },
  106. // 点击弹出回复框
  107. handleApply() {
  108. this.replyShow = true
  109. },
  110. // 关闭弹出框
  111. close() {
  112. this.$emit('close')
  113. },
  114. // 禁止外层容器滚动
  115. moveHandle() {},
  116. // 上拉加载
  117. scrolltolower() {
  118. if (this.list.length < this.total) {
  119. this.pageNum += 1;
  120. // 继续请求下一页,记得保留原先数组
  121. this.loadmore();
  122. } else {
  123. uni.showToast({
  124. title: "没有更多了",
  125. icon: "none",
  126. duration: 2000,
  127. });
  128. return;
  129. }
  130. },
  131. // 自定义下拉刷新被触发
  132. onRefresh() {
  133. // 开启下拉自定义样式
  134. this.triggered = true;
  135. // 重新调用
  136. this.loadmore();
  137. // 1秒之后复位
  138. setTimeout(() => {
  139. this.triggered = false;
  140. }, 1000);
  141. },
  142. scrolltolower() {
  143. this.loadmore();
  144. },
  145. loadmore() {
  146. this.request('/info/InfoContent/list', 'GET').then(res => {
  147. console.log("res:", res)
  148. if (res) {}
  149. })
  150. },
  151. }
  152. }
  153. </script>
  154. <style lang="scss" scoped>
  155. .u-popup {
  156. .content {
  157. // min-height: 600rpx;
  158. padding: 40rpx;
  159. max-height: 80%;
  160. }
  161. .title {
  162. display: flex;
  163. justify-content: space-between;
  164. font-size: 50rpx;
  165. font-weight: 900;
  166. margin-bottom: 60rpx;
  167. }
  168. .commentBox {
  169. width: 100%;
  170. display: flex;
  171. color: #000;
  172. font-size: 32rpx;
  173. margin-bottom: 20rpx;
  174. .left {
  175. height: 80rpx;
  176. // background-color: red;
  177. display: flex;
  178. align-items: center;
  179. margin-right: 30rpx;
  180. .comment_round {
  181. width: 20rpx;
  182. height: 20rpx;
  183. background-color: #ff2950;
  184. border-radius: 50%;
  185. margin-right: 20rpx;
  186. }
  187. }
  188. .comment_detail {
  189. width: 100%;
  190. .comment_info {
  191. display: flex;
  192. justify-content: space-between;
  193. .name {
  194. font-weight: 600;
  195. }
  196. .landlord {
  197. display: inline-block;
  198. margin-left: 10rpx;
  199. font-size: 28rpx;
  200. width: 100rpx;
  201. height: 50rpx;
  202. line-height: 50rpx;
  203. color: #f87f2d;
  204. background-color: #fef2e9;
  205. text-align: center;
  206. border-radius: 50rpx;
  207. }
  208. .likeNum {
  209. font-size: 28rpx;
  210. }
  211. .custom-icon {
  212. margin-right: 10rpx;
  213. font-size: 40rpx;
  214. &::before {
  215. background: -webkit-linear-gradient(top, #f84a1a, #ffa53e);
  216. -webkit-background-clip: text;
  217. -webkit-text-fill-color: transparent;
  218. font-weight: bold;
  219. }
  220. }
  221. }
  222. .comment_content {
  223. margin: 20rpx 0;
  224. color: #333;
  225. }
  226. .time {
  227. color: #999;
  228. font-size: 28rpx;
  229. }
  230. .comment_func {
  231. display: flex;
  232. justify-content: space-between;
  233. align-items: center;
  234. .reply {
  235. color: #f87f2d;
  236. font-size: 28rpx;
  237. margin-right: 10rpx;
  238. font-weight: 600;
  239. }
  240. .time {
  241. color: #999;
  242. font-size: 28rpx;
  243. }
  244. .delete {
  245. font-size: 28rpx;
  246. ;
  247. width: 100rpx;
  248. height: 50rpx;
  249. line-height: 50rpx;
  250. background-color: #eae8e7;
  251. text-align: center;
  252. border-radius: 50rpx;
  253. }
  254. }
  255. }
  256. }
  257. }
  258. </style>