洛阳学员端
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.

162 lines
3.1 KiB

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