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.

150 lines
3.0 KiB

9 months ago
9 months ago
9 months ago
  1. <template>
  2. <view class="pageBg">
  3. <view class="pageBgImg">
  4. <topNavbar title="驾校场地"></topNavbar>
  5. <view class="pad">
  6. <view class="search_Box">
  7. <searchRow placeholder="搜索场地名称" @searchFn="searchFn"></searchRow>
  8. </view>
  9. <view class="ul">
  10. <view class="card" v-for="(item,index) in list" :key="index">
  11. <view class="name_row">
  12. <view class="icon">
  13. <image src="@/static/images/userCenter/siteIcon.png" mode=""></image>
  14. </view>
  15. <view class="name">{{item.name}}</view>
  16. </view>
  17. <view class="addres_row">
  18. <view class="icon">
  19. <image src="@/static/images/userCenter/adsIcon.png" mode=""></image>
  20. </view>
  21. <view class="ads">{{item.address}}</view>
  22. </view>
  23. <view class="status_row">
  24. 使用状态<text v-if="item.siteStatus==1">正常</text> <text v-if="item.siteStatus==0" class="orange">停用</text>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <view style="padding-bottom: 20rpx;" v-if="list.length>6">
  30. <u-loadmore :status="status" />
  31. </view>
  32. <nodata v-if="!list.length&&status=='nomore'"></nodata>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import { sitePage } from '@/config/api.js'
  38. export default {
  39. data() {
  40. return {
  41. list: [],
  42. params: {
  43. pageNo: 1,
  44. pageSize: 20
  45. },
  46. total: 20,
  47. status: 'loading'
  48. }
  49. },
  50. onLoad() {
  51. this.params.schoolId = this.vuex_schoolId
  52. this.sitePageFn()
  53. },
  54. onPullDownRefresh() {
  55. this.list = []
  56. this.params.pageNo = 1
  57. this.sitePageFn().then(()=>{uni.stopPullDownRefresh()})
  58. },
  59. onReachBottom() {
  60. if(this.total>this.list.length) {
  61. this.sitePageFn()
  62. }
  63. },
  64. methods: {
  65. async sitePageFn() {
  66. const {data: res} = await sitePage(this.params)
  67. this.params.pageNo ++
  68. this.list.push(...res.list)
  69. this.total = res.total
  70. if(this.list.length>=this.total) {
  71. this.status = 'nomore'
  72. }else {
  73. this.status = 'loading'
  74. }
  75. console.log(res)
  76. },
  77. searchFn(val) {
  78. console.log(val)
  79. this.params.name = val
  80. this.list = []
  81. this.params.pageNo = 1
  82. this.sitePageFn()
  83. }
  84. }
  85. }
  86. </script>
  87. <style lang="scss" scoped>
  88. .pageBgImg {
  89. .search_Box {
  90. margin-bottom: 20rpx;
  91. searchrow {
  92. }
  93. }
  94. .ul {
  95. width: 100%;
  96. .card {
  97. padding: 28rpx 30rpx;
  98. margin-bottom: 20rpx;
  99. .name_row {
  100. display: flex;
  101. align-items: center;
  102. .icon {
  103. width: 30rpx;
  104. height: 32rpx;
  105. }
  106. .name {
  107. font-size: 32rpx;
  108. font-weight: 600;
  109. color: #333333;
  110. margin-left: 10rpx;
  111. }
  112. }
  113. .addres_row {
  114. padding: 16rpx 0 36rpx 0;
  115. display: flex;
  116. align-items: center;
  117. .icon {
  118. width: 30rpx;
  119. height: 32rpx;
  120. }
  121. .ads {
  122. font-size: 24rpx;
  123. color: #333333;
  124. margin-left: 10rpx;
  125. }
  126. }
  127. .status_row {
  128. font-size: 24rpx;
  129. color: #686B73;
  130. text {
  131. color: #1989FA;
  132. &.orange {
  133. color: #FF6A2A;
  134. }
  135. }
  136. }
  137. }
  138. }
  139. }
  140. </style>