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

120 lines
2.6 KiB

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