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

176 lines
3.4 KiB

9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
  1. <template>
  2. <view class="pageBg">
  3. <view class="topBg">
  4. <topNavbar title="找教练"></topNavbar>
  5. <view class="searchCon pad">
  6. <searchRow placeholder="搜索教练名称" @searchFn="searchFn" ></searchRow>
  7. </view>
  8. </view>
  9. <view class="pad">
  10. <view class="ul">
  11. <view class="li" v-for="(item,index) in listData" :key="index" >
  12. <coachItem :item="item" @click.native="goPage(item)"/>
  13. </view>
  14. </view>
  15. </view>
  16. <view style="padding-bottom: 20rpx;" v-if="listData.length">
  17. <u-loadmore :status="status" />
  18. </view>
  19. <nodata v-if="!listData.length&&status=='nomore'"></nodata>
  20. </view>
  21. </template>
  22. <script>
  23. import coachItem from './comp/coachItem.vue'
  24. import { coachPage } from '@/config/api.js'
  25. export default {
  26. components: { coachItem },
  27. data() {
  28. return {
  29. currentTab: 0,
  30. tabData: [{
  31. text: '全部',
  32. id: 1
  33. },
  34. {
  35. text: 'C1',
  36. id: 2
  37. },
  38. {
  39. text: 'C2',
  40. id: 3
  41. },
  42. ],
  43. params: {
  44. pageNo: 1,
  45. pageSize: 20,
  46. name: ''
  47. },
  48. total: 20,
  49. listData: [],
  50. status: 'loading'
  51. }
  52. },
  53. onLoad() {
  54. // let vuex_cityInfo = this.$store.state.user.vuex_cityInfo
  55. // if(!vuex_cityInfo.lat) {
  56. // this.$store.dispatch('getCity')
  57. // }else {
  58. // this.params.lat = vuex_cityInfo.lat
  59. // this.params.lng = vuex_cityInfo.lng
  60. // }
  61. this.coachPageFn()
  62. uni.$on('screenConfirm',(obj)=>{
  63. this.params = Object.assign(this.params, obj)
  64. this.listInit()
  65. })
  66. },
  67. onPullDownRefresh() {
  68. this.listInit()
  69. },
  70. onReachBottom() {
  71. if(this.total>this.listData.length) {
  72. this.coachPageFn()
  73. }
  74. },
  75. methods: {
  76. searchFn(val) {
  77. this.params.name = val
  78. this.listInit()
  79. },
  80. goPage(item) {
  81. let objStr = encodeURIComponent(JSON.stringify(item))
  82. this.$goPage('/pages/indexEntry/findShcool/coachComment/coachComment?item='+ objStr)
  83. },
  84. tabClick(item) {
  85. this.params.sercheType = item.id
  86. this.params.businessScope = ''
  87. this.params.district = ''
  88. this.listInit()
  89. },
  90. async listInit() {
  91. this.listData = []
  92. this.params.pageNo = 1
  93. await this.coachPageFn()
  94. uni.stopPullDownRefresh()
  95. },
  96. // 获取驾校列表
  97. async coachPageFn() {
  98. let obj = {}
  99. for(let key in this.params) {
  100. if(this.params[key]) {
  101. obj[key] = this.params[key]
  102. }
  103. }
  104. const {data: res} = await coachPage(obj)
  105. this.params.pageNo ++
  106. this.listData.push(...res.list)
  107. this.total = res.total
  108. if(this.listData.length>=this.total) this.status = 'nomore'
  109. console.log(res)
  110. }
  111. }
  112. }
  113. </script>
  114. <style lang="scss" scoped>
  115. .pageBg {
  116. width: 100%;
  117. .navBox {
  118. display: flex;
  119. // justify-content: space-between;
  120. padding: 20rpx 0;
  121. .tab {
  122. font-size: 28rpx;
  123. color: #999;
  124. line-height: 50rpx;
  125. border-radius: 10rpx;
  126. background: #fff;
  127. text-align: center;
  128. height: 50rpx;
  129. width: 126rpx;
  130. margin-right: 30rpx;
  131. &.active {
  132. background: $themC;
  133. color: #fff;
  134. }
  135. }
  136. .screen {
  137. width: 150rpx;
  138. display: flex;
  139. justify-content: center;
  140. align-items: center;
  141. position: relative;
  142. background: #fff;
  143. color: #999;
  144. border-radius: 10rpx;
  145. &.active {
  146. background: $themC;
  147. color: #fff;
  148. }
  149. .txt {
  150. font-size: 28rpx;
  151. margin-right: 10rpx;
  152. }
  153. .screenIcon {
  154. width: 18rpx;
  155. height: 12rpx;
  156. }
  157. }
  158. }
  159. .ul {
  160. width: 100%;
  161. .li {
  162. }
  163. }
  164. }
  165. .topBg {
  166. padding-bottom: 20rpx;
  167. }
  168. </style>