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.

81 lines
1.8 KiB

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