myComment.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view>
  3. <u-navbar title="我的评论" >
  4. </u-navbar>
  5. <view class="main">
  6. <view class="like-box" v-for="(item,i) in list" @click="ckInfo(item.id)" :key="i">
  7. <view class="content">
  8. <view class="title">
  9. {{item.title}}
  10. </view>
  11. <view class="else">
  12. <view class="classify">
  13. {{item.typeName}}
  14. </view>
  15. <view class="date">
  16. {{item.createTime}}
  17. </view>
  18. </view>
  19. </view>
  20. <view class="picture">
  21. <img v-if="item.pic" :src="item.pic" alt="">
  22. <img v-else src="@/assets/img/default_img.png" alt="">
  23. </view>
  24. </view>
  25. </view>
  26. <u-divider v-if="list.length==recordsTotal"
  27. :isnone="list.length==0" nonetext="你还没有参与评论"
  28. bg-color="#F2F4F4" border-color="#CFD2D5">已经到底了</u-divider>
  29. </view>
  30. </template>
  31. <script>
  32. import * as API from '@/apis/pagejs/news.js'
  33. export default {
  34. data() {
  35. return {
  36. list:[],
  37. listForm:{
  38. pageIndex:1,
  39. pageSize:20,
  40. },
  41. recordsTotal:0,
  42. }
  43. },
  44. onLoad(op){
  45. this.getList()
  46. },
  47. onReachBottom() {
  48. if (this.list.length < this.recordsTotal) {
  49. this.myLoadmore();
  50. }
  51. },
  52. methods: {
  53. ckInfo(id){
  54. var url="/pages/news/articleDetails?id="+id;
  55. uni.navigateTo({
  56. url:url
  57. })
  58. },
  59. myLoadmore(){
  60. this.listForm.pageIndex += 1;
  61. this.getList();
  62. },
  63. getList(){
  64. uni.showLoading({
  65. title: "加载中",
  66. mask: true,
  67. })
  68. API.newsCommentspageList(this.listForm).then((res) => {
  69. uni.hideLoading();
  70. this.list = [
  71. ...this.list,
  72. ...res.data.data
  73. ];
  74. this.recordsTotal = res.data.recordsTotal;
  75. }).catch(error => {
  76. uni.showToast({
  77. title: error,
  78. icon: "none"
  79. })
  80. })
  81. }
  82. }
  83. }
  84. </script>
  85. <style scoped lang="scss">
  86. .main{
  87. padding: 24rpx 32rpx;
  88. .like-box{
  89. border-radius: 8px;
  90. background-color: rgba(255, 255, 255, 1);
  91. display: flex;
  92. justify-content: space-between;
  93. padding: 24rpx;
  94. margin-bottom: 24rpx;
  95. .content{
  96. width: 390rpx;
  97. display: flex;
  98. flex-direction:column;
  99. justify-content: space-between;
  100. .title{
  101. color: rgba(51, 51, 51, 1);
  102. font-size: 32rpx;
  103. line-height: 46rpx;
  104. font-weight: bold;
  105. font-family: 'Medium';
  106. }
  107. .else{
  108. display: flex;
  109. justify-content: space-between;
  110. color: rgba(119, 119, 119, 1);
  111. font-size: 24rpx;
  112. font-family: 'Regular';
  113. }
  114. }
  115. .picture{
  116. width: 224rpx;
  117. height: 172rpx;
  118. border-radius: 5px;
  119. overflow: hidden;
  120. img{
  121. width: 100%;
  122. height: 100%;
  123. }
  124. }
  125. }
  126. }
  127. </style>