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.

137 lines
3.0 KiB

8 months ago
  1. <template>
  2. <view class="pageBgImg">
  3. <topNavbar title="驾校教练"></topNavbar>
  4. <view class="pad">
  5. <view class="search_Box">
  6. <searchRow placeholder="搜索教练员" @searchFn="searchFn"></searchRow>
  7. </view>
  8. <view class="ul">
  9. <view class="card" v-for="(item,index) in list" :key="index" @click="$goPage('/pages/userCenter/schoolCoach/coachComment/coachComment?id='+ item.id)">
  10. <view class="avatar">
  11. <image :src="item.photoPath" mode="" @error="handleImageError(item)"></image>
  12. </view>
  13. <view class="rightTxt">
  14. <view class="name">{{item.name}}</view>
  15. <view class="star_row">
  16. <view class="starBox">
  17. <u-rate active-color="#1989FA" inactive-color="#1989FA" gutter="1" :size="16" :value="item.stars" :readonly="true" style="pointer-events: none;"></u-rate>
  18. <view class="num">{{item.stars}}</view>
  19. </view>
  20. <moreRight text="查看详情"/>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view style="padding-bottom: 20rpx;" v-if="list.length">
  27. <u-loadmore :status="status" />
  28. </view>
  29. <nodata v-if="!list.length&&status=='nomore'"></nodata>
  30. </view>
  31. </template>
  32. <script>
  33. import { coachPage } from '@/config/api.js'
  34. export default {
  35. data() {
  36. return {
  37. list: [],
  38. params: {
  39. pageNo: 1,
  40. pageSize: 20
  41. },
  42. total: 20,
  43. status: 'loading'
  44. }
  45. },
  46. onLoad() {
  47. this.params.schoolId = this.vuex_schoolId
  48. this.coachPageFn()
  49. },
  50. onPullDownRefresh() {
  51. this.list = []
  52. this.params.pageNo = 1
  53. this.coachPageFn().then(()=>{uni.stopPullDownRefresh()})
  54. },
  55. onReachBottom() {
  56. if(this.total>this.list.length) {
  57. this.coachPageFn()
  58. }
  59. },
  60. methods: {
  61. async coachPageFn() {
  62. const {data: res} = await coachPage(this.params)
  63. this.params.pageNo ++
  64. this.list.push(...res.list)
  65. this.total = res.total
  66. if(this.list.length>=this.total) {
  67. this.status = 'nomore'
  68. }else {
  69. this.status = 'loading'
  70. }
  71. console.log(res)
  72. },
  73. searchFn(val) {
  74. console.log(val)
  75. this.params.name = val
  76. this.list = []
  77. this.params.pageNo = 1
  78. this.coachPageFn()
  79. },
  80. handleImageError(item) {
  81. item.photoPath = require('@/static/images/index/avatar.png')
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss" scoped>
  87. .pageBgImg {
  88. .search_Box {
  89. margin-bottom: 20rpx;
  90. searchrow {
  91. }
  92. }
  93. .ul {
  94. width: 100%;
  95. .card {
  96. padding: 28rpx 30rpx;
  97. margin-bottom: 20rpx;
  98. display: flex;
  99. align-items: center;
  100. .avatar {
  101. width: 108rpx;
  102. height: 108rpx;
  103. border-radius: 50%;
  104. overflow: hidden;
  105. }
  106. .rightTxt {
  107. padding-left: 20rpx;
  108. flex: 1;
  109. .name {
  110. font-size: 32rpx;
  111. color: #333;
  112. font-weight: 500;
  113. margin-bottom: 10rpx;
  114. }
  115. .star_row {
  116. display: flex;
  117. justify-content: space-between;
  118. .starBox {
  119. display: flex;
  120. padding: 6rpx 0 6rpx 0;
  121. .num {
  122. color: $themC;
  123. }
  124. }
  125. }
  126. }
  127. }
  128. }
  129. }
  130. </style>