学员端小程序
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.

70 lines
1.5 KiB

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