江西小程序管理端
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.

126 lines
2.8 KiB

1 year ago
10 months ago
1 year ago
10 months ago
1 year ago
10 months ago
1 year ago
10 months ago
1 year ago
10 months ago
1 year ago
10 months ago
1 year ago
10 months ago
1 year ago
10 months ago
1 year ago
10 months ago
1 year ago
10 months ago
1 year ago
  1. <template>
  2. <view class="main pageBg">
  3. <view class="topBg">
  4. <topNavbar title="考场信息"></topNavbar>
  5. <view class="pad">
  6. <view class="searchBox">
  7. <searchRow placeholder="搜索考场名称" @searchFn="searchFn"></searchRow>
  8. </view>
  9. <view class="tabs">
  10. <view class="tab" v-for="(item,index) in tabData" :key="index" :class="{active: params.siteType==item.id}" @click="changeTab(item)">{{ item.text }}</view>
  11. </view>
  12. </view>
  13. </view>
  14. <view class="pad" style="margin-top: 20rpx;">
  15. <view class="list">
  16. <view class="card" v-for="(item,index) in list" :key="index">
  17. <examinItem :item="item"/>
  18. </view>
  19. </view>
  20. <view style="padding-bottom: 20rpx;" v-if="list.length">
  21. <u-loadmore :status="status" />
  22. </view>
  23. <nodata v-if="!list.length&&status=='nomore'"></nodata>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import examinItem from './comp/examinItem'
  29. import { businessSitePage } from '@/config/api.js'
  30. export default {
  31. components: { examinItem },
  32. data() {
  33. return {
  34. tabData: [
  35. {text: '全部', id: 0},
  36. {text: '理论', id: 1},
  37. {text: '科目二', id: 2},
  38. {text: '科目三', id: 3},
  39. ],
  40. params: {
  41. pageSize: 20,
  42. pageNo: 1,
  43. schoolId: '',
  44. siteType: '',//1.理论 2.科目二 3.科目三 4.科目二/科目三
  45. },
  46. total: 20,
  47. list: [],
  48. status: 'loading'
  49. }
  50. },
  51. onLoad() {
  52. this.params.schoolId = this.vuex_schoolId
  53. this.businessSitePageFn()
  54. },
  55. onPullDownRefresh() {
  56. this.initList()
  57. },
  58. onReachBottom() {
  59. if(this.total>this.list.length) this.businessSitePageFn()
  60. },
  61. methods: {
  62. initList() {
  63. this.params.pageNo = 1
  64. this.list = []
  65. this.status = 'loading'
  66. this.businessSitePageFn()
  67. },
  68. async businessSitePageFn() {
  69. let obj = Object.assign({},this.params)
  70. const {data: res} = await businessSitePage(obj)
  71. this.params.pageNo ++
  72. this.list.push(...res.list)
  73. this.total = res.total
  74. if(this.list.length>=this.total) {
  75. this.status = 'nomore'
  76. }
  77. },
  78. searchFn(val) {
  79. this.params.name = val
  80. this.initList()
  81. },
  82. changeTab(item) {
  83. this.params.siteType = item.id
  84. this.initList()
  85. }
  86. }
  87. }
  88. </script>
  89. <style lang="scss" scoped>
  90. .topBg {
  91. background: #1989fa;
  92. }
  93. .card {
  94. padding: 32rpx 36rpx 26rpx 24rpx;
  95. margin-bottom: 20rpx;
  96. }
  97. .searchBox {
  98. padding: 20rpx 0 0rpx 0;
  99. }
  100. .tabs {
  101. display: flex;
  102. justify-content: space-between;
  103. height: 120rpx;
  104. align-items: center;
  105. .tab {
  106. font-size: 28rpx;
  107. color: #fff;
  108. line-height: 110rpx;
  109. &.active {
  110. position: relative;
  111. &::before {
  112. content: '';
  113. width: 56rpx;
  114. height: 6rpx;
  115. background: #FFFFFF;
  116. border-radius: 3rpx;
  117. position: absolute;
  118. left: 50%;
  119. transform: translateX(-50%);
  120. bottom: 20rpx;
  121. }
  122. }
  123. }
  124. }
  125. </style>