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

200 lines
4.2 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
11 months 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. background-size: 100% 392rpx;
  131. .searchCon {
  132. padding: 0 0 24rpx 0;
  133. }
  134. .navBox {
  135. display: flex;
  136. justify-content: space-between;
  137. padding-bottom: 48rpx;
  138. .tab {
  139. display: flex;
  140. font-size: 28rpx;
  141. color: #fff;
  142. &.active {
  143. position: relative;
  144. &::before {
  145. content: '';
  146. position: absolute;
  147. bottom: -14rpx;
  148. left: 50%;
  149. transform: translateX(-50%);
  150. width: 50rpx;
  151. height: 4rpx;
  152. background-color: #fff;
  153. border-radius: 0 0 2rpx 2rpx;
  154. }
  155. }
  156. }
  157. .screen {
  158. width: 150rpx;
  159. display: flex;
  160. justify-content: center;
  161. align-items: center;
  162. position: relative;
  163. &::before {
  164. content: '';
  165. position: absolute;
  166. left: 0;
  167. top: 10rpx;
  168. width: 1px;
  169. background: #fff;
  170. height: 26rpx;
  171. }
  172. .txt {
  173. font-size: 28rpx;
  174. color: #fff;
  175. margin-right: 10rpx;
  176. }
  177. .screenIcon {
  178. width: 32rpx;
  179. height: 32rpx;
  180. }
  181. }
  182. }
  183. .ul {
  184. width: 100%;
  185. .li {
  186. }
  187. }
  188. }
  189. </style>