洛阳学员端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.6 KiB

10 months ago
  1. <template>
  2. <view class="pageBgImg ">
  3. <topNavbar title="我的评价"></topNavbar>
  4. <view class="pad">
  5. <view class="card" v-for="(item,index) in list" :key="index">
  6. <commentItem :item="item"/>
  7. </view>
  8. <view class="card" v-if="!list.length">
  9. <nodata>暂无评价</nodata>
  10. </view>
  11. </view>
  12. <view style="padding-bottom: 20rpx;" v-if="list.length>4">
  13. <u-loadmore :status="status" />
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import { getUsersCommentById } from '@/config/api.js'
  19. import commentItem from './comp/commentItem.vue'
  20. export default {
  21. components: { commentItem },
  22. data() {
  23. return {
  24. params: {
  25. userId: '', pageNo: 1,pageSize: 20
  26. },
  27. total: 20,
  28. status: 'loading',
  29. list: []
  30. }
  31. },
  32. onLoad() {
  33. this.getUsersCommentByIdFn()
  34. this.params.userId = this.userId
  35. },
  36. onPullDownRefresh() {
  37. this.params.pageNo = 1
  38. this.list = []
  39. this.getUsersCommentByIdFn().then(()=>{
  40. uni.stopPullDownRefresh()
  41. })
  42. },
  43. onReachBottom() {
  44. if(this.total>this.list.length) {
  45. this.getUsersCommentByIdFn()
  46. }
  47. },
  48. methods: {
  49. async getUsersCommentByIdFn() {
  50. const {data: res} = await getUsersCommentById(this.params)
  51. this.params.pageNo ++
  52. let arr = res.list.map(item=>{
  53. if(item.images) {
  54. item.images = item.images.split(',')
  55. }
  56. return item
  57. })
  58. this.list.push(...res.list)
  59. this.total = res.total
  60. if(this.list.length>=this.total) this.status = 'nomore'
  61. }
  62. }
  63. }
  64. </script>
  65. <style lang="scss" scoped>
  66. .card {
  67. width: 100%;
  68. padding: 24rpx 28rpx;
  69. margin-bottom: 20rpx;
  70. }
  71. </style>