学员端小程序
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.

172 lines
3.3 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="pageBgImg">
  3. <topNavbar title="找驾校"></topNavbar>
  4. <view class="pad">
  5. <view class="searchCon">
  6. <searchRow placeholder="搜索驾校、教练…"></searchRow>
  7. </view>
  8. <view class="navBox">
  9. <view class="tab" v-for="(item,index) in tabData" :key="index" :class="{active: currentTab==item.id}" @click="tabClick(item)">
  10. {{ item.text }}</view>
  11. <view class="screen" @click="$goPage('/pages/indexEntry/findShcool/screen/screen')">
  12. <view class="txt">筛选</view>
  13. <view class="screenIcon">
  14. <image src="../../../static/images/index/ic_shaixuan.png" mode=""></image>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="ul">
  19. <view class="li" v-for="(item,index) in listData" :key="index" >
  20. <schoolItme :item="item" @click.native="goPage(item)"/>
  21. </view>
  22. </view>
  23. </view>
  24. <view style="padding-bottom: 20rpx;">
  25. <u-loadmore :status="status" />
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import schoolItme from './comp/schoolItem.vue'
  31. import { schoolPage } from '@/config/api.js'
  32. export default {
  33. components: { schoolItme },
  34. data() {
  35. return {
  36. currentTab: 0,
  37. tabData: [{
  38. text: '全部',
  39. id: 0
  40. },
  41. {
  42. text: '场地优先',
  43. id: 1
  44. },
  45. {
  46. text: '距离优先',
  47. id: 2
  48. },
  49. {
  50. text: '好评优先',
  51. id: 3
  52. },
  53. ],
  54. params: {
  55. pageNo: 1,
  56. pageSize: 20,
  57. lat: 30.27419537786047,
  58. lng: 120.20633397715788,
  59. },
  60. total: 20,
  61. listData: [],
  62. status: 'loading'
  63. }
  64. },
  65. onLoad() {
  66. this.schoolPageFn()
  67. },
  68. onPullDownRefresh() {
  69. this.listInit()
  70. },
  71. onReachBottom() {
  72. if(this.total>this.listData.length) {
  73. this.schoolPageFn()
  74. }
  75. },
  76. methods: {
  77. goPage(item) {
  78. this.$goPage('/pages/indexEntry/findShcool/shcoolDetail/shcoolDetail?schoolId='+ item.id)
  79. },
  80. tabClick(item) {
  81. this.currentTab = item.id
  82. },
  83. async listInit() {
  84. await this.schoolPageFn()
  85. uni.stopPullDownRefresh()
  86. },
  87. // 获取驾校列表
  88. async schoolPageFn() {
  89. const {data: res} = await schoolPage(this.params)
  90. this.params.pageNo ++
  91. this.listData.push(...res.list)
  92. this.total = res.total
  93. if(this.listData.length>=this.total) this.status = 'nomore'
  94. console.log(res)
  95. }
  96. }
  97. }
  98. </script>
  99. <style lang="scss" scoped>
  100. .pageBgImg {
  101. width: 100%;
  102. min-height: 100vh;
  103. .searchCon {
  104. padding: 0 0 24rpx 0;
  105. }
  106. .navBox {
  107. display: flex;
  108. justify-content: space-between;
  109. padding-bottom: 48rpx;
  110. .tab {
  111. display: flex;
  112. font-size: 28rpx;
  113. color: #fff;
  114. &.active {
  115. position: relative;
  116. &::before {
  117. content: '';
  118. position: absolute;
  119. bottom: -14rpx;
  120. left: 50%;
  121. transform: translateX(-50%);
  122. width: 50rpx;
  123. height: 4rpx;
  124. background-color: #fff;
  125. border-radius: 0 0 2rpx 2rpx;
  126. }
  127. }
  128. }
  129. .screen {
  130. width: 150rpx;
  131. display: flex;
  132. justify-content: center;
  133. align-items: center;
  134. position: relative;
  135. &::before {
  136. content: '';
  137. position: absolute;
  138. left: 0;
  139. top: 10rpx;
  140. width: 1px;
  141. background: #fff;
  142. height: 26rpx;
  143. }
  144. .txt {
  145. font-size: 28rpx;
  146. color: #fff;
  147. margin-right: 10rpx;
  148. }
  149. .screenIcon {
  150. width: 32rpx;
  151. height: 32rpx;
  152. }
  153. }
  154. }
  155. .ul {
  156. width: 100%;
  157. .li {
  158. }
  159. }
  160. }
  161. </style>