124 lines
3.2 KiB
Vue
124 lines
3.2 KiB
Vue
<template>
|
|
<view class="page flex-col">
|
|
<view class="container">
|
|
<headers titles="驾校"><uni-icons @click="goback()" type="left" color="#000000"
|
|
size="22px"></uni-icons></headers>
|
|
</view>
|
|
<view class="itemContent">
|
|
<scroll-view style="height: 100%;" scroll-y="true" class="itemContent" @scrolltolower="onReachBottomCus"
|
|
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
|
|
<!-- 使用 SchoolInfo 组件渲染驾校信息 -->
|
|
<SchoolInfo v-for="(school, index) in schoolList" :key="index" :schoolInfo="school" @click="goSchoolDetail(school)"/>
|
|
</scroll-view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import headers from "@/components/header/headers.vue";
|
|
import SchoolInfo from '../newIndex/SchoolInfo.vue';
|
|
import request from "@/utils/request";
|
|
import { getTenantId } from "../../utils/auth";
|
|
|
|
export default {
|
|
components: {
|
|
headers,
|
|
SchoolInfo // 注册 SchoolInfo 组件
|
|
},
|
|
data() {
|
|
return {
|
|
constants: {},
|
|
schoolList: [],
|
|
imageUrl: this.$imagesUrl,
|
|
isTriggered: false,
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
total: 0,
|
|
};
|
|
},
|
|
onLoad() {
|
|
this.getList()
|
|
},
|
|
methods: {
|
|
goback() {
|
|
uni.navigateBack()
|
|
},
|
|
getList() {
|
|
const params = {
|
|
pageNo: this.pageNo,
|
|
pageSize: this.pageSize,
|
|
serviceCodes: 'jiaxiao',
|
|
};
|
|
if (getTenantId()) {
|
|
console.log(getTenantId())
|
|
params.tenantId = getTenantId();
|
|
}
|
|
|
|
request({
|
|
url: '/userClient/base/companySmallProgram/pageNoTenantId',
|
|
method: 'GET',
|
|
params: params,
|
|
}).then(res => {
|
|
res.data.records.forEach(item => {
|
|
item.features = ['有接送', '规模大']
|
|
item.imageUrl = this.imageUrl + '/' + item.photo
|
|
})
|
|
this.schoolList = this.schoolList.concat(res.data.records)
|
|
this.total = res.data.total
|
|
this.isTriggered = false
|
|
})
|
|
},
|
|
goSchoolDetail(data) {
|
|
uni.navigateTo({
|
|
url: `/newPages/schoolDetail/index?id=${data.id}&tenantId=${data.tenantId}`,
|
|
// url: '/newPages/schoolDetail/index',
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 上滑加载数据
|
|
*/
|
|
onReachBottomCus() {
|
|
//判断 如果页码*页容量大于等于总条数,提示该页数据加载完毕
|
|
if (this.pageNo * this.pageSize >= this.total) {
|
|
uni.$u.toast('没有更多数据了')
|
|
return
|
|
}
|
|
//页码+1,调用获取数据的方法获取第二页数据
|
|
this.pageNo++
|
|
//此处调用自己获取数据列表的方法
|
|
this.getList()
|
|
},
|
|
/**
|
|
* 下拉刷新数据
|
|
*/
|
|
onRefresherrefresh(){
|
|
this.isTriggered = true
|
|
this.pageNo = 1
|
|
this.total = 0
|
|
this.schoolList = []
|
|
this.getList()
|
|
},
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang='scss'>
|
|
@import '../common/common.scss';
|
|
@import './assets/style/index.rpx.scss';
|
|
.container {
|
|
width: 100%;
|
|
background: #f4f5f6;
|
|
box-sizing: border-box;
|
|
padding-top: 88px;
|
|
}
|
|
.itemContent{
|
|
padding: 30rpx 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
row-gap: 20rpx;
|
|
/* height: calc(100% - 65px); */
|
|
height: 100vh;
|
|
}
|
|
</style>
|