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.

79 lines
1.8 KiB

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