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.
121 lines
2.6 KiB
121 lines
2.6 KiB
<template>
|
|
<view class="pageBgImg">
|
|
<topNavbar title="找考场"></topNavbar>
|
|
<view class="pad">
|
|
<view class="search">
|
|
<searchRow placeholder="搜索考场名称" @searchFn="searchFn"/>
|
|
</view>
|
|
<view class="navBox">
|
|
<view class="nav" v-for="(item,index) in navList" :key="index" :class="{active: params.siteType==item.id}" @click="changeNav(item)">{{ item.text }}</view>
|
|
</view>
|
|
<view class="card" v-for="(item,index) in list" :key="index">
|
|
<examineItem :item="item"></examineItem>
|
|
</view>
|
|
</view>
|
|
<view style="padding-bottom: 20rpx;" v-if="list.length">
|
|
<u-loadmore :status="status" />
|
|
</view>
|
|
<nodata v-if="!list.length&&status=='nomore'"></nodata>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import examineItem from '../comp/examineItem.vue'
|
|
import { getexamSite } from '@/config/api.js'
|
|
export default {
|
|
components: {
|
|
examineItem
|
|
},
|
|
data() {
|
|
return {
|
|
navList: [
|
|
{text: '全部', id: 0},
|
|
{text: '理论', id: 1},
|
|
{text: '科目二', id: 2},
|
|
{text: '科目三', id: 3},
|
|
],
|
|
currentNav: 0,
|
|
list: [],
|
|
params: {
|
|
pageNo: 1,
|
|
pageSize: 20,
|
|
siteType: 0
|
|
},
|
|
status: 'loading'
|
|
}
|
|
},
|
|
onLoad() {
|
|
let vuex_cityInfo = this.$store.state.user.vuex_cityInfo
|
|
if(!vuex_cityInfo.lat) {
|
|
this.$store.dispatch('getCity')
|
|
}else {
|
|
this.params.lat = vuex_cityInfo.lat
|
|
this.params.lng = vuex_cityInfo.lng
|
|
}
|
|
this.getexamSiteFn()
|
|
},
|
|
|
|
onReachBottom() {
|
|
if(this.total>this.list.length) {
|
|
this.getexamSiteFn()
|
|
}
|
|
},
|
|
methods: {
|
|
changeNav(item) {
|
|
this.params.siteType = item.id
|
|
this.status = 'loading'
|
|
this.initList()
|
|
},
|
|
searchFn(val) {
|
|
this.params.name = val
|
|
this.initList()
|
|
},
|
|
initList() {
|
|
this.params.pageNo = 1
|
|
this.list = []
|
|
this.getexamSiteFn()
|
|
},
|
|
async getexamSiteFn() {
|
|
const {data: res} = await getexamSite(this.params)
|
|
this.list.push(...res.list)
|
|
this.total = res.total
|
|
if(this.list.length>=this.total) this.status = 'nomore'
|
|
console.log(res)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.pageBgImg {
|
|
min-height: 100vh;
|
|
}
|
|
.navBox {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
padding: 24rpx 42rpx 36rpx 42rpx;
|
|
.nav {
|
|
display: flex;
|
|
font-size: 28rpx;
|
|
color: #fff;
|
|
&.active {
|
|
position: relative;
|
|
&::before {
|
|
content: '';
|
|
position: absolute;
|
|
bottom: -14rpx;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
width: 50rpx;
|
|
height: 4rpx;
|
|
background-color: #fff;
|
|
border-radius: 0 0 2rpx 2rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.card {
|
|
padding: 32rpx 24rpx 28rpx 24rpx;
|
|
margin-bottom: 20rpx;
|
|
}
|
|
</style>
|