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

194 lines
3.9 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 year ago
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 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: params.sercheType==item.id}" @click="tabClick(item)">
  10. {{ item.text }}</view>
  11. <view class="screen" @click="goScreen">
  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: 1
  40. },
  41. {
  42. text: '场地优先',
  43. id: 2
  44. },
  45. {
  46. text: '距离优先',
  47. id: 3
  48. },
  49. {
  50. text: '好评优先',
  51. id: 4
  52. },
  53. ],
  54. params: {
  55. pageNo: 1,
  56. pageSize: 20,
  57. lat: '',
  58. lng: '',
  59. sercheType: 1,
  60. businessScope: '',
  61. district: ''
  62. },
  63. total: 20,
  64. listData: [],
  65. status: 'loading'
  66. }
  67. },
  68. onLoad() {
  69. let vuex_cityInfo = this.$store.state.user.vuex_cityInfo
  70. if(!vuex_cityInfo.lat) {
  71. this.$store.dispatch('getCity')
  72. return
  73. }else {
  74. this.params.lat = vuex_cityInfo.lat
  75. this.params.lng = vuex_cityInfo.lng
  76. this.schoolPageFn()
  77. }
  78. uni.$on('screenConfirm',(obj)=>{
  79. this.params = Object.assign(this.params, obj)
  80. this.listInit()
  81. })
  82. },
  83. onPullDownRefresh() {
  84. this.listInit()
  85. },
  86. onReachBottom() {
  87. if(this.total>this.listData.length) {
  88. this.schoolPageFn()
  89. }
  90. },
  91. methods: {
  92. goScreen() {
  93. let url = `/pages/indexEntry/findShcool/screen/screen?businessScope=${this.params.businessScope}&district=${this.params.district}`
  94. this.$goPage(url)
  95. },
  96. goPage(item) {
  97. this.$goPage('/pages/indexEntry/findShcool/shcoolDetail/shcoolDetail?schoolId='+ item.id)
  98. },
  99. tabClick(item) {
  100. this.params.sercheType = item.id
  101. this.listInit()
  102. },
  103. async listInit() {
  104. this.listData = []
  105. this.params.pageNo = 1
  106. await this.schoolPageFn()
  107. uni.stopPullDownRefresh()
  108. },
  109. // 获取驾校列表
  110. async schoolPageFn() {
  111. const {data: res} = await schoolPage(this.params)
  112. this.params.pageNo ++
  113. this.listData.push(...res.list)
  114. this.total = res.total
  115. if(this.listData.length>=this.total) this.status = 'nomore'
  116. console.log(res)
  117. }
  118. }
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. .pageBgImg {
  123. width: 100%;
  124. min-height: 100vh;
  125. .searchCon {
  126. padding: 0 0 24rpx 0;
  127. }
  128. .navBox {
  129. display: flex;
  130. justify-content: space-between;
  131. padding-bottom: 48rpx;
  132. .tab {
  133. display: flex;
  134. font-size: 28rpx;
  135. color: #fff;
  136. &.active {
  137. position: relative;
  138. &::before {
  139. content: '';
  140. position: absolute;
  141. bottom: -14rpx;
  142. left: 50%;
  143. transform: translateX(-50%);
  144. width: 50rpx;
  145. height: 4rpx;
  146. background-color: #fff;
  147. border-radius: 0 0 2rpx 2rpx;
  148. }
  149. }
  150. }
  151. .screen {
  152. width: 150rpx;
  153. display: flex;
  154. justify-content: center;
  155. align-items: center;
  156. position: relative;
  157. &::before {
  158. content: '';
  159. position: absolute;
  160. left: 0;
  161. top: 10rpx;
  162. width: 1px;
  163. background: #fff;
  164. height: 26rpx;
  165. }
  166. .txt {
  167. font-size: 28rpx;
  168. color: #fff;
  169. margin-right: 10rpx;
  170. }
  171. .screenIcon {
  172. width: 32rpx;
  173. height: 32rpx;
  174. }
  175. }
  176. }
  177. .ul {
  178. width: 100%;
  179. .li {
  180. }
  181. }
  182. }
  183. </style>