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.

147 lines
3.0 KiB

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