洛阳学员端
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.

98 lines
2.0 KiB

10 months ago
  1. <template>
  2. <view class="main">
  3. <u-sticky>
  4. <view class="searchBox">
  5. <u-search placeholder="请输入教练姓名" v-model="params.name" :show-action="false" @search="searchFn"> </u-search>
  6. </view>
  7. </u-sticky>
  8. <view class="ul">
  9. <view class="li" v-for="(item,index) in list" :key="index" @click="chooseClick(item)">
  10. <view class="leftT">{{item.name}}</view>
  11. <view class="rigthT">{{item.mobile}}</view>
  12. </view>
  13. </view>
  14. <u-loadmore :status="status" v-if="list.length>30" :icon-type="'flower'" />
  15. </view>
  16. </template>
  17. <script>
  18. import { coachPage } from '@/config/api.js'
  19. export default {
  20. data() {
  21. return {
  22. keyword: '',
  23. trainingSchoolId: '',
  24. list: [],
  25. params: {
  26. pageNo: 1,
  27. pageSize: 20,
  28. schoolId: '',
  29. name: ''
  30. },
  31. status: 'loading',
  32. }
  33. },
  34. onLoad(options) {
  35. this.params.schoolId = options.schoolId
  36. this.coachPageFn()
  37. },
  38. onReachBottom() {
  39. if(status=='nomore') return
  40. this.coachPageFn()
  41. },
  42. methods: {
  43. chooseClick(item) {
  44. uni.$emit('upDateCoachItem', item)
  45. uni.navigateBack()
  46. },
  47. searchFn() {
  48. this.list = []
  49. this.params.pageNo = 1
  50. this.status = 'loading'
  51. this.coachPageFn()
  52. },
  53. // 获取教练
  54. async coachPageFn() {
  55. const {data:res} = await coachPage(this.params)
  56. this.list.push(...res.list)
  57. this.params.pageNo ++
  58. this.total = res.total
  59. if(this.list.length>=this.total) {
  60. this.status = 'nomore'
  61. }
  62. console.log('获取教练')
  63. console.log(this.list)
  64. },
  65. }
  66. }
  67. </script>
  68. <style lang="scss" scoped>
  69. .main {
  70. background-color: #f8f8f8;
  71. .searchBox {
  72. background-color: #fff;
  73. padding: 16rpx 32rpx;
  74. }
  75. }
  76. .ul {
  77. width: 100%;
  78. border-bottom: 10rpx solid #f8f8f8;
  79. font-size: 30rpx;
  80. padding: 0 32rpx;
  81. color: #333333;
  82. background-color: #fff;
  83. .li {
  84. width: 100%;
  85. height: 98rpx;
  86. line-height: 98rpx;
  87. display: flex;
  88. font-size: 30rpx;
  89. justify-content: space-between;
  90. align-center: center;
  91. border-bottom: 1px solid #F5F7FA;
  92. }
  93. }
  94. </style>