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

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