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

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