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.

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