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

74 lines
1.7 KiB

1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="pageBg">
  3. <view class="infoBox pad">
  4. <info :showSign="true" :coachList="coachList"></info>
  5. </view>
  6. <comments :list="list" @changeNav="changeNav"></comments>
  7. <view style="padding-bottom: 20rpx;" v-if="list.length">
  8. <u-loadmore :status="status" />
  9. </view>
  10. <nodata v-if="!list.length&&status=='nomore'"></nodata>
  11. </view>
  12. </template>
  13. <script>
  14. import comments from '../comments/comments.vue'
  15. import info from '../shcoolDetail/comp/tab3.vue'
  16. import { getListCoachComment } from '@/config/api.js'
  17. export default {
  18. components: { comments, info},
  19. data() {
  20. return {
  21. params: {
  22. pageNo: 1,
  23. pageSize: 20,
  24. coachId: '',
  25. condition: 0
  26. },
  27. total: 20,
  28. list: [],
  29. coachList: [],
  30. status: 'loading'
  31. }
  32. },
  33. onLoad(options) {
  34. if(!options.item) return
  35. let coachInfo = JSON.parse(decodeURIComponent(options.item))
  36. console.log(JSON.parse(options.item))
  37. this.coachList = [coachInfo]
  38. this.params.coachId = coachInfo.coachId
  39. this.getListCoachCommentFn()
  40. },
  41. methods: {
  42. changeNav(val) {
  43. this.params.condition = val
  44. this.initList()
  45. },
  46. initList() {
  47. this.params.pageNo = 1
  48. this.status = 'loading'
  49. this.list = []
  50. this.getListCoachCommentFn()
  51. },
  52. async getListCoachCommentFn() {
  53. const {data: res} = await getListCoachComment(this.params)
  54. this.params.pageNo ++
  55. this.total = res.total
  56. let arr = res.list.map(item=>{
  57. if(item.images) {
  58. item.images = item.images.split(',')
  59. }
  60. return item
  61. })
  62. this.list.push(...arr)
  63. if(this.list.length>=this.list.length) this.status = 'nomore'
  64. }
  65. }
  66. }
  67. </script>
  68. <style lang="scss" scoped>
  69. .infoBox {
  70. background: #F6F6F6;
  71. overflow: hidden;
  72. }
  73. </style>