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

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