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

118 lines
2.3 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. <template>
  2. <!-- 选择驾校弹出框 -->
  3. <view class="box">
  4. <view class="schoolTit">
  5. 选择驾校
  6. </view>
  7. <view class="searchBox">
  8. <u-search placeholder="请输入驾校名称" v-model.trim="keyword" @search="searchSchool" @custom="searchSchool">
  9. </u-search>
  10. </view>
  11. <scroll-view scroll-y="true" style="height: 700rpx" @scrolltolower="loadMore">
  12. <view class="ul">
  13. <view class="li" v-for="(item,index) in listData" :key="index" @click="chooseSchool(item)">
  14. <view class="name">
  15. {{ $u.utils.truncateText(item.name, 18) }}
  16. </view>
  17. <view class="starText">
  18. {{item.stars}}
  19. </view>
  20. <!-- <view class="distance">
  21. {{ $u.utils.distanceFn(item.distance)}}
  22. </view> -->
  23. </view>
  24. </view>
  25. <u-loadmore :status="status" icon-type="circle" />
  26. </scroll-view>
  27. </view>
  28. </template>
  29. <script>
  30. import { schoolPage } from '@/config/api.js'
  31. export default {
  32. data() {
  33. return {
  34. keyword: '',
  35. status: 'loadmore',
  36. listData: [],
  37. total: 10,
  38. params: {
  39. pageNo: 1,
  40. pageSize: 20,
  41. lat: 30.27419537786047,
  42. lng: 120.20633397715788,
  43. }
  44. }
  45. },
  46. created() {
  47. this.schoolPageFn()
  48. },
  49. methods: {
  50. // 选择驾校
  51. chooseSchool(item) {
  52. this.$emit('chooseSchool', item)
  53. },
  54. // 获取驾校列表
  55. async schoolPageFn() {
  56. const {data: res} = await schoolPage(this.params)
  57. this.params.pageNo ++
  58. this.listData.push(...res.list)
  59. this.total = res.total
  60. if(this.listData.length>=this.total) this.status = 'nomore'
  61. console.log(res)
  62. }
  63. }
  64. }
  65. </script>
  66. <style lang="scss" scoped>
  67. .schoolTit {
  68. line-height: 90rpx;
  69. text-align: center;
  70. font-size: 28rpx;
  71. }
  72. .searchBox {
  73. width: 100%;
  74. padding: 0 20rpx 20rpx 20rpx;
  75. border-bottom: 1rpx solid #ededed;
  76. }
  77. .ul {
  78. width: 100%;
  79. padding: 0 20rpx;
  80. .li {
  81. width: 100%;
  82. display: flex;
  83. align-items: center;
  84. height: 90rpx;
  85. font-size: 24rpx;
  86. border-bottom: 1rpx solid #ededed;
  87. &:last-child {
  88. border: none;
  89. }
  90. .name {
  91. width: 0;
  92. flex: 1;
  93. font-size: 28rpx;
  94. }
  95. .starText {
  96. color: red;
  97. width: 100rpx;
  98. text-align: right;
  99. flex-shrink: 0;
  100. white-space: nowrap;
  101. }
  102. .distance {
  103. width: 120rpx;
  104. text-align: right;
  105. flex-shrink: 0;
  106. white-space: nowrap;
  107. }
  108. }
  109. }
  110. </style>