This commit is contained in:
xyc 2025-04-16 17:13:42 +08:00
parent ee27f6bf79
commit e74fc686b0
3 changed files with 1185 additions and 1196 deletions

View File

@ -1,229 +1,211 @@
<template>
<view class="page flex-col">
<view class="top_">
<u-swiper class="lunbo_" :list="swiperList" keyName="swiperPicture" radius="10" height="300" indicator
indicatorMode="line"></u-swiper>
</view>
<view class="section_2 flex-col">
<view class="list_1 flex-row">
<view
class="image-text_1 flex-col align-items-center justify-content-center;"
v-for="(item, index) in loopData0"
:key="index"
@click="handleItemClick(item)"
>
<image
class="label_1"
referrerpolicy="no-referrer"
:src="item.url"
/>
<text class="text-group_1" v-text="item.text"></text>
</view>
</view>
<view class="box_4 flex-row justify-between">
<view class="image-text_2 flex-row justify-between">
<!-- <u-notice-bar direction="column" duration="10000" bgColor="#e9f1ff" color="black" :text="textList.map(item => item.title)" @click="handleNoticeClick" icon="/static/lanhu_shouye2gai/FigmaDDSSlicePNGd2c17b5f24182e597acbfa50481040c1.png"></u-notice-bar> -->
<u-notice-bar
direction="column"
duration="10000"
bgColor="#e9f1ff"
color="black"
:text="textList"
@click="handleNoticeClick"
icon="/static/lanhu_shouye2gai/FigmaDDSSlicePNGd2c17b5f24182e597acbfa50481040c1.png"
/>
</view>
<view class="group_3 flex-col justify-between">
<view class="block_5 flex-col"></view>
<view class="block_6 flex-col"></view>
<view class="block_7 flex-col"></view>
</view>
</view>
<view class="box_5 flex-row justify-between">
<text class="text_2">优质驾校</text>
<view class="image-text_3 flex-row justify-between">
<text class="text-group_3" @click="goSchoolList()">查看更多</text>
<image
class="thumbnail_2"
referrerpolicy="no-referrer"
src="/static/lanhu_shouye2gai/FigmaDDSSlicePNGc8586e4d9e76802e4b93ae8fb3654b38.png"
/>
</view>
</view>
<view class="itemContent">
<!-- 使用 scroll-view 包裹 SchoolInfo 组件 -->
<scroll-view class="school-scroll-view" scroll-y @scrolltolower="onReachBottomCus"
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
<SchoolInfo style="" v-for="(school, index) in schoolList" :key="index" :schoolInfo="school"
@click="goSchoolDetail(school)"/>
</scroll-view>
</view>
<view class="page flex-col">
<view class="top_">
<u-swiper class="lunbo_" :list="swiperList" keyName="swiperPicture" radius="10" height="300" indicator
indicatorMode="line"></u-swiper>
</view>
<view class="section_2 flex-col">
<view class="list_1 flex-row">
<view class="image-text_1 flex-col align-items-center justify-content-center;"
v-for="(item, index) in loopData0" :key="index" @click="handleItemClick(item)">
<image class="label_1" referrerpolicy="no-referrer" :src="item.url" />
<text class="text-group_1" v-text="item.text"></text>
</view>
</view>
<view class="box_4 flex-row justify-between">
</view>
<tabbar :msg='msg'></tabbar>
</view>
<view class="image-text_2 flex-row justify-between">
<!-- <u-notice-bar direction="column" duration="10000" bgColor="#e9f1ff" color="black" :text="textList.map(item => item.title)" @click="handleNoticeClick" icon="/static/lanhu_shouye2gai/FigmaDDSSlicePNGd2c17b5f24182e597acbfa50481040c1.png"></u-notice-bar> -->
<u-notice-bar direction="column" duration="10000" bgColor="#e9f1ff" color="black" :text="textList"
@click="handleNoticeClick"
icon="/static/lanhu_shouye2gai/FigmaDDSSlicePNGd2c17b5f24182e597acbfa50481040c1.png" />
</view>
<view class="group_3 flex-col justify-between">
<view class="block_5 flex-col"></view>
<view class="block_6 flex-col"></view>
<view class="block_7 flex-col"></view>
</view>
</view>
<view class="box_5 flex-row justify-between">
<text class="text_2">优质驾校</text>
<view class="image-text_3 flex-row justify-between">
<text class="text-group_3" @click="goSchoolList()">查看更多</text>
<image class="thumbnail_2" referrerpolicy="no-referrer"
src="/static/lanhu_shouye2gai/FigmaDDSSlicePNGc8586e4d9e76802e4b93ae8fb3654b38.png" />
</view>
</view>
<view class="itemContent">
<!-- 使用 scroll-view 包裹 SchoolInfo 组件 -->
<scroll-view class="school-scroll-view" scroll-y @scrolltolower="onReachBottomCus" refresher-enabled
@refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
<SchoolInfo style="" v-for="(school, index) in schoolList" :key="index" :schoolInfo="school"
@click="goSchoolDetail(school)" />
</scroll-view>
</view>
</view>
<tabbar :msg='msg'></tabbar>
</view>
</template>
<script>
import SchoolInfo from './SchoolInfo.vue';
import request from "@/utils/request";
import {
getCoachId,
getInviteId,
getLocalUserInfo,
getToken,
removeCoachId,
removeInviteId,
removeTenantId,
setCoachId,
setInviteId,
setLocalUserInfo,
setStaffType,
setTenantId
} from '@/utils/auth'
export default {
components: {
SchoolInfo
},
data() {
return {
loopData0: [
{
url: '/static/lanhu_shouye2gai/xcbm.png',
text: '学车报名'
},
{
url: '/static/lanhu_shouye2gai/yyxl.png',
text: '预约训练'
},
{
url: '/static/lanhu_shouye2gai/kslr.png',
text: '考试结果录入'
},
{
url: '/static/lanhu_shouye2gai/pj.png',
text: '评价'
},
],
swiperList: [],
msg: "1",
constants: {},
schoolList: [],
//
isTriggered: false,
pageNo: 1,
pageSize: 10,
total: 0,
imageUrl: this.$imagesUrl,
textList:[],
noticeList: [],
qTenantId: null,
qCoachId: null,
};
},
onLoad(query) {
// setInviteId('JLPXF1')
// this.getTenantIdByInviteId()
this.getSwiperList()
this.getTextList()
const q = decodeURIComponent(query.q) //
let theRequest = this.getUrlValue(q)
if(theRequest.hasOwnProperty("inviteId")){
//code
setInviteId(theRequest['inviteId'])
this.getTenantIdByInviteId()
//
uni.reLaunch({
url: '/pages/login/login'
})
}else{
removeInviteId()
removeCoachId()
removeTenantId()
this.getList()
/* uni.reLaunch({
url: '/pages-home/home/home'
}) */
}
},
methods: {
getTenantIdByInviteId(){
console.log('1122', getInviteId())
if(!getInviteId()){
console.log(1)
this.getList()
return
}
request({
url: '/app-api/dl-drive-school-coach-small/getCoachByUniqueCode',
method: 'GET',
params: {
uniqueCode: getInviteId()
}
}).then(res => {
console.log(123)
if(res.data != null){
this.qTenantId = res.data.tenantId
this.qCoachId = res.data.userId
setTenantId(res.data.tenantId)
import SchoolInfo from './SchoolInfo.vue';
import request from "@/utils/request";
import {
getCoachId,
getInviteId,
getLocalUserInfo,
getToken,
removeCoachId,
removeInviteId,
removeTenantId,
setCoachId,
setInviteId,
setLocalUserInfo,
setStaffType,
setTenantId
} from '@/utils/auth'
export default {
components: {
SchoolInfo
},
data() {
return {
loopData0: [{
url: '/static/lanhu_shouye2gai/xcbm.png',
text: '学车报名'
},
{
url: '/static/lanhu_shouye2gai/yyxl.png',
text: '预约训练'
},
{
url: '/static/lanhu_shouye2gai/kslr.png',
text: '考试结果录入'
},
{
url: '/static/lanhu_shouye2gai/pj.png',
text: '评价'
},
],
swiperList: [],
msg: "1",
constants: {},
schoolList: [],
//
isTriggered: false,
pageNo: 1,
pageSize: 10,
total: 0,
imageUrl: this.$imagesUrl,
textList: [],
noticeList: [],
qTenantId: null,
qCoachId: null,
};
},
onLoad(query) {
// setInviteId('JLPXF1')
// this.getTenantIdByInviteId()
this.getSwiperList()
this.getTextList()
const q = decodeURIComponent(query.q) //
let theRequest = this.getUrlValue(q)
if (theRequest.hasOwnProperty("inviteId")) {
//code
setInviteId(theRequest['inviteId'])
this.getTenantIdByInviteId()
//
// uni.reLaunch({
// url: '/pages/login/login'
// })
} else {
removeInviteId()
removeCoachId()
removeTenantId()
this.getList()
if(res.data.type == 'jl'){
setCoachId(res.data.userId)
setStaffType('02')
}
if(res.data.type == 'yg'){
setCoachId(res.data.userId)
setStaffType('01')
}
/* uni.reLaunch({
url: '/pages-home/home/home'
}) */
}
})
},
getList() {
const params = {
pageNo: this.pageNo,
pageSize: this.pageSize,
serviceCodes: 'jiaxiao',
};
if (this.qTenantId) {
params.tenantId = this.qTenantId;
}
console.log('params', params)
request({
url: '/userClient/base/companySmallProgram/pageNoTenantId',
method: 'GET',
params: params,
tenantIdFlag: false
}).then(res => {
res.data.records.forEach(item => {
item.features = ['有接送', '规模大']
item.imageUrl = this.imageUrl + '/' + item.photo
})
this.schoolList = this.schoolList.concat(res.data.records)
this.isTriggered = false
this.total = res.data.total
console.log(res)
})
},
getUrlValue(url) {
var theRequest = new Object();
if (url.indexOf("?") != -1) {
//
var str = url.split("?")[1];
var strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
}
}
return theRequest
},
/**
* 实时讯息
*/
/* async getTextList() {
},
methods: {
getTenantIdByInviteId() {
console.log('1122', getInviteId())
if (!getInviteId()) {
console.log(1)
this.getList()
return
}
request({
url: '/app-api/dl-drive-school-coach-small/getCoachByUniqueCode',
method: 'GET',
params: {
uniqueCode: getInviteId()
}
}).then(res => {
console.log(123, res.data)
if (res.data != null) {
this.qTenantId = res.data.tenantId
this.qCoachId = res.data.userId
setTenantId(res.data.tenantId)
this.getList()
if (res.data.type == 'jl') {
setCoachId(res.data.userId)
setStaffType('02')
}
if (res.data.type == 'yg') {
setCoachId(res.data.userId)
setStaffType('01')
}
}
})
},
getList() {
const params = {
pageNo: this.pageNo,
pageSize: this.pageSize,
serviceCodes: 'jiaxiao',
};
if (this.qTenantId) {
params.tenantId = this.qTenantId;
}
console.log('params', params)
request({
url: '/userClient/base/companySmallProgram/pageNoTenantId',
method: 'GET',
params: params,
tenantIdFlag: false
}).then(res => {
res.data.records.forEach(item => {
item.features = ['有接送', '规模大']
item.imageUrl = this.imageUrl + '/' + item.photo
})
this.schoolList = this.schoolList.concat(res.data.records)
this.isTriggered = false
this.total = res.data.total
console.log(res)
})
},
getUrlValue(url) {
var theRequest = new Object();
if (url.indexOf("?") != -1) {
//
var str = url.split("?")[1];
var strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
}
}
return theRequest
},
/**
* 实时讯息
*/
/* async getTextList() {
let res = await request({
url: '/app-api/base/notice/pageList',
method: 'get',
@ -239,189 +221,190 @@ export default {
this.textList.push(item.title)
})
}, */
async getTextList() {
let res = await request({
url: '/app-api/base/notice/pageList',
method: 'get',
params: {
pageNum: 1,
pageSize: 10000,
parentServer: 'jiaxiao',
server: 'wx'
}
})
this.noticeList = res.data.records //
this.textList = res.data.records.map(item => item.title) // title
},
handleNoticeClick(index) {
const currentNotice = this.noticeList[index]
if (currentNotice && currentNotice.id) {
uni.navigateTo({
url: `/pagesA/noticeContent/index?id=${currentNotice.id}`
})
}
},
getSwiperList() {
request({
url: '/app-api/drivingSchool/text/swiper/list',
method: 'GET'
}).then(res => {
res.data.forEach(item => {
item.swiperPicture = this.imageUrl + item.swiperPicture
})
this.swiperList = res.data
})
},
/**
* 上滑加载数据
*/
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()
},
goSchoolList() {
uni.navigateTo({
url: '/newPages/schoolList/index',
});
},
goSchoolDetail(data) {
uni.navigateTo({
url: `/newPages/schoolDetail/index?id=${data.id}&tenantId=${data.tenantId}&schoolName=${data.corpName}`,
// url: '/newPages/schoolDetail/index',
});
},
async getTextList() {
let res = await request({
url: '/app-api/base/notice/pageList',
method: 'get',
params: {
pageNum: 1,
pageSize: 10000,
parentServer: 'jiaxiao',
server: 'wx'
}
})
this.noticeList = res.data.records //
this.textList = res.data.records.map(item => item.title) // title
},
handleNoticeClick(index) {
const currentNotice = this.noticeList[index]
if (currentNotice && currentNotice.id) {
uni.navigateTo({
url: `/pagesA/noticeContent/index?id=${currentNotice.id}`
})
}
},
getSwiperList() {
request({
url: '/app-api/drivingSchool/text/swiper/list',
method: 'GET'
}).then(res => {
res.data.forEach(item => {
item.swiperPicture = this.imageUrl + item.swiperPicture
})
this.swiperList = res.data
})
},
/**
* 上滑加载数据
*/
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()
},
goSchoolList() {
uni.navigateTo({
url: '/newPages/schoolList/index',
});
},
goSchoolDetail(data) {
uni.navigateTo({
url: `/newPages/schoolDetail/index?id=${data.id}&tenantId=${data.tenantId}&schoolName=${data.corpName}`,
// url: '/newPages/schoolDetail/index',
});
},
handleItemClick(item) {
// item.text
switch (item.text) {
case '学车报名':
uni.navigateTo({
url: '/newPages/schoolList/index'
});
break;
case '预约训练':
if (!getToken()) {
/* uni.showToast({
handleItemClick(item) {
// item.text
switch (item.text) {
case '学车报名':
uni.navigateTo({
url: '/newPages/schoolList/index'
});
break;
case '预约训练':
if (!getToken()) {
/* uni.showToast({
title: '请先登录',
icon: 'none',
duration: 2000
}); */
uni.showModal({
title: '未登录',
content: '请先登录',
confirmText: '去登录',
success: (res) => {
if (res.confirm) {
uni.navigateTo({
url: '/pages/login/login'
});
uni.showModal({
title: '未登录',
content: '请先登录',
confirmText: '去登录',
success: (res) => {
if (res.confirm) {
uni.navigateTo({
url: '/pages/login/login'
});
}
}
});
return;
}
uni.navigateTo({
url: '/pagesA/appointment/index'
});
break;
case '考试结果录入':
if (!getToken()) {
uni.showModal({
title: '未登录',
content: '请先登录',
confirmText: '去登录',
success: (res) => {
if (res.confirm) {
uni.navigateTo({
url: '/pages/login/login'
});
}
}
});
return;
}
uni.navigateTo({
url: '/pagesA/examinationList/index'
});
break;
case '评价':
if (!getToken()) {
uni.showModal({
title: '未登录',
content: '请先登录',
confirmText: '去登录',
success: (res) => {
if (res.confirm) {
uni.navigateTo({
url: '/pages/login/login'
});
}
}
});
return;
}
uni.navigateTo({
url: '/pagesA/evaluate/index'
});
break;
default:
console.warn('未知的点击项:', item.text);
break;
}
}
});
return;
}
uni.navigateTo({
url: '/pagesA/appointment/index'
});
break;
case '考试结果录入':
if (!getToken()) {
uni.showModal({
title: '未登录',
content: '请先登录',
confirmText: '去登录',
success: (res) => {
if (res.confirm) {
uni.navigateTo({
url: '/pages/login/login'
});
}
}
});
return;
}
uni.navigateTo({
url: '/pagesA/examinationList/index'
});
break;
case '评价':
if (!getToken()) {
uni.showModal({
title: '未登录',
content: '请先登录',
confirmText: '去登录',
success: (res) => {
if (res.confirm) {
uni.navigateTo({
url: '/pages/login/login'
});
}
}
});
return;
}
uni.navigateTo({
url: '/pagesA/evaluate/index'
});
break;
default:
console.warn('未知的点击项:', item.text);
break;
}
}
}
}
};
}
};
</script>
<style lang='scss'>
@import '../common/common.scss';
@import './assets/style/index.rpx.scss';
// 使
.text-group_1 {
text-align: center;
}
@import '../common/common.scss';
@import './assets/style/index.rpx.scss';
// image-text_1 使
.image-text_1 {
display: flex;
flex-direction: column;
align-items: center; // 使
justify-content: center; // 使
}
// 使
.text-group_1 {
text-align: center;
}
// scroll-view
.school-scroll-view {
height: 500rpx; //
overflow-y: auto;
margin-left: 22rpx;
}
// image-text_1 使
.image-text_1 {
display: flex;
flex-direction: column;
align-items: center; // 使
justify-content: center; // 使
}
.itemContent {
padding: 30rpx 0;
display: flex;
flex-direction: column;
row-gap: 20rpx;
}
// scroll-view
.school-scroll-view {
height: 500rpx; //
overflow-y: auto;
margin-left: 22rpx;
}
.top_ {
//padding-top: 200rpx;
}
</style>
.itemContent {
padding: 30rpx 0;
display: flex;
flex-direction: column;
row-gap: 20rpx;
}
.top_ {
//padding-top: 200rpx;
}
</style>

View File

@ -1,305 +1,312 @@
<template>
<view class="page flex-col">
<view style="width: 100%;background: #f4f5f6;box-sizing: border-box;padding-top: 88px;">
<headers titles="驾校">
<uni-icons type="left" color="#000000" size="22px"></uni-icons>
</headers>
</view>
<view class="group_4 flex-col">
<image
style="width: 100%; height: 100%;"
referrerpolicy="no-referrer"
:src="imagesUrl + '/' + schoolInfo.photo"
/>
<!-- src="/static/lanhu_jiaxiaoxiangqing/FigmaDDSSlicePNGcd54efcc9a8c89af0ef99c8275464828.png" -->
</view>
<view class="group_5 flex-col">
<text class="text_3">{{ schoolInfo.corpName }}</text>
<text class="text_3_2">地址{{ schoolInfo.address }}</text>
<view class="text-wrapper_1 flex-row justify-between">
<text class="text_4">营业时间</text>
<text class="text_5" v-if=" schoolInfo.businessStartTime && schoolInfo.businessEndTime ">{{ schoolInfo.businessStartTime }} - {{ schoolInfo.businessEndTime }}</text>
<text class="text_5" v-else>08:00-18:00</text>
</view>
</view>
<view class="page flex-col">
<view style="width: 100%;background: #f4f5f6;box-sizing: border-box;padding-top: 88px;">
<headers titles="驾校">
<uni-icons type="left" color="#000000" size="22px"></uni-icons>
</headers>
</view>
<view class="group_4 flex-col">
<image style="width: 100%; height: 100%;" referrerpolicy="no-referrer"
:src="imagesUrl + '/' + schoolInfo.photo" />
<!-- src="/static/lanhu_jiaxiaoxiangqing/FigmaDDSSlicePNGcd54efcc9a8c89af0ef99c8275464828.png" -->
</view>
<view class="group_5 flex-col">
<text class="text_3">{{ schoolInfo.corpName }}</text>
<text class="text_3_2">地址{{ schoolInfo.address }}</text>
<!-- <view class="text-wrapper_1 flex-row justify-between">
<text class="text_4">营业时间</text>
<text class="text_5"
v-if=" schoolInfo.businessStartTime && schoolInfo.businessEndTime ">{{ schoolInfo.businessStartTime }}
- {{ schoolInfo.businessEndTime }}</text>
<text class="text_5" v-else>08:00-18:00</text>
</view> -->
<view class="group_6 flex-col">
<view class="box_4 flex-row justify-between">
<view class="box_5 flex-col"></view>
<text class="text_8">报名类型</text>
</view>
<view v-if="schoolClassList.length > 0">
<view class="box_6 flex-row" v-for="(item, index) in schoolClassList" :key="index" @click="goToDetail(item.id)">
<view class="image-text_1 flex-row">
<image
class="image_2"
referrerpolicy="no-referrer"
:src="imagesUrl + '/' + item.photo"
/>
<view class="text-group_2 flex-col justify-between">
<text class="text_9">{{ item.name }}</text>
<view class="text-wrapper_2 flex-row justify-between">
<text class="text_10">{{ item.price }}</text>
</view>
</view>
<view class="text-wrapper_4 flex-col">
<view style="display: flex">
<text class="text_13" style="background-color: rgba(223, 235, 255, 1);padding: 5rpx 15rpx">{{
</view>
<view class="group_6 flex-col">
<view class="box_4 flex-row justify-between">
<view class="box_5 flex-col"></view>
<text class="text_8">报名类型</text>
</view>
<view v-if="schoolClassList.length > 0">
<view class="box_6 flex-row" v-for="(item, index) in schoolClassList" :key="index"
@click="goToDetail(item.id)">
<view class="image-text_1 flex-row">
<image class="image_2" referrerpolicy="no-referrer" :src="imagesUrl + '/' + item.photo" />
<view class="text-group_2 flex-col justify-between">
<text class="text_9">{{ item.name }}</text>
<view class="text-wrapper_2 flex-row justify-between">
<text class="text_10">{{ item.price }}</text>
</view>
</view>
<view class="text-wrapper_4 flex-col">
<view style="display: flex">
<text class="text_13"
style="background-color: rgba(223, 235, 255, 1);padding: 5rpx 15rpx">{{
item.tittle
}}
</text>
<text class="text-wrapper_3 text_13" style="color: black;padding: 5rpx 10rpx">{{ item.type }}</text>
</view>
</view>
</view>
</view>
</text>
<text class="text-wrapper_3 text_13"
style="color: black;padding: 5rpx 10rpx">{{ item.type }}</text>
</view>
</view>
</view>
</view>
<view class="box_12 flex-row">
<view class="image-text_2 flex-row justify-between" @click="goClassList()">
<text class="text-group_3">查看全部班型({{ schoolAllClassList.length }})</text>
<image
class="thumbnail_2"
referrerpolicy="no-referrer"
src="/static/lanhu_jiaxiaoxiangqing/FigmaDDSSlicePNGb5045194768d2baa618848ea60e5a9e4.png"
/>
</view>
</view>
</view>
<view v-else>
<u-empty
mode="data"
text="该驾校没有课程..."
>
</u-empty>
</view>
</view>
<view class="box_12 flex-row">
<view class="image-text_2 flex-row justify-between" @click="goClassList()">
<text class="text-group_3">查看全部班型({{ schoolAllClassList.length }})</text>
<image class="thumbnail_2" referrerpolicy="no-referrer"
src="/static/lanhu_jiaxiaoxiangqing/FigmaDDSSlicePNGb5045194768d2baa618848ea60e5a9e4.png" />
</view>
</view>
</view>
<view v-else>
<u-empty mode="data" text="该驾校没有课程...">
</u-empty>
</view>
</view>
<view class="group_8 flex-col">
<view class="group_9 flex-row justify-between">
<view class="block_3 flex-col"></view>
<text class="text_24">团队教练</text>
</view>
<view v-if="schoolCoachList.length > 0">
<view class="group_10 flex-row justify-between" v-for="(item, index) in schoolCoachList" :key="index">
<view class="image-text_3 flex-row justify-between">
<image
class="label_3"
referrerpolicy="no-referrer"
:src="imagesUrl + '/' + item.image"
/>
<view class="text-group_4 flex-col justify-between">
<text class="text_25">{{ item.name }}</text>
<text class="text_27">教龄&nbsp;{{ item.seniority }}</text>
</view>
</view>
</view>
</view>
<view v-else>
<u-empty
mode="list"
text="该驾校没有团队教练..."
>
</u-empty>
</view>
<view class="group_8 flex-col">
<view class="group_9 flex-row justify-between">
<view class="block_3 flex-col"></view>
<text class="text_24">团队教练</text>
</view>
<view v-if="schoolCoachList.length > 0">
<view class="group_10 flex-row justify-between" v-for="(item, index) in schoolCoachList" :key="index">
<view class="image-text_3 flex-row justify-between">
<image class="label_3" referrerpolicy="no-referrer" :src="imagesUrl + '/' + item.image" />
<view class="text-group_4 flex-col justify-between">
<text class="text_25">{{ item.name }}</text>
<text class="text_27">教龄&nbsp;{{ item.seniority }}</text>
</view>
</view>
</view>
</view>
<view v-else>
<u-empty mode="list" text="该驾校没有团队教练...">
</u-empty>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import request from "@/utils/request";
import config from "@/config.js"
import headers from "@/components/header/headers.vue";
import request from "@/utils/request";
import config from "@/config.js"
import headers from "@/components/header/headers.vue";
import * as auth from '@/utils/auth';
export default {
components: {headers},
data() {
return {
imagesUrl: config.imagesUrl,
constants: {},
schoolId: undefined,
tenantId: undefined,
schoolName: undefined,
schoolDetails: {},
schoolInfo: [],
schoolClassList: [],
schoolAllClassList: [],
schoolCoachList: [],
export default {
components: {
headers
},
data() {
return {
imagesUrl: config.imagesUrl,
constants: {},
schoolId: undefined,
tenantId: undefined,
schoolName: undefined,
schoolDetails: {},
schoolInfo: [],
schoolClassList: [],
schoolAllClassList: [],
schoolCoachList: [],
};
},
async onShow() {
// const res = await this.getLocation();
// console.log('',res)
};
},
async onShow() {
// const res = await this.getLocation();
// console.log('',res)
},
onLoad(options) {
this.schoolId = options.id;
this.tenantId = options.tenantId;
this.schoolName = options.schoolName;
// this.getSchoolDetails();
this.getSchoolInfo()
this.getSchoolClass();
this.getSchoolAllClass()
this.getSchoolCoach()
},
methods: {
handleBack() {
uni.navigateBack({
delta: 1
});
},
getSchoolDetails() {
request({
url: '/userClient/base/companySmallProgram/noTenantIdGet',
method: 'GET',
params: {
id: this.schoolId
},
tenantIdFlag: false
}).then(res => {
this.schoolDetails = res.data;
this.tenantId = res.data.tenantId
}).catch(err => {
console.error('获取驾校详情失败', err);
});
},
getSchoolInfo(){
request({
url:'/userClient/base/companySmallProgram/getCompanyByTenantId',
method: 'GET',
params: {
tenantId: this.tenantId,
systemCode: 'jiaxiao',
}
}).then(res => {
this.schoolInfo = res.data
})
},
getSchoolClass() {
request({
url: '/app-api/dl-drive-school-course-small/noTenantIdPage',
method: 'GET',
params: {
pageNo: 1,
pageSize: 3,
tenantId: this.tenantId,
},
tenantIdFlag: false
}).then(res => {
this.schoolClassList = res.data.records;
this.total = res.data.total;
})
},
//
getLocation() {
let location = {
lat: 0,
lng: 0,
}
return new Promise((reserve, reject) => {//使promise
uni.getLocation({
success(res) {
console.log('成功')
location.lat = res.latitude
location.lng = res.longitude,
reserve(location);
},
fail(err) {
console.log('失败', err)
reject(location);//0
}
})
})
},
//
calculateDistance(loc1, loc2) {
const {latitude: lat1, longitude: lng1} = loc1;
const {latitude: lat2, longitude: lng2} = loc2;
},
onLoad(options) {
this.schoolId = options.id;
this.tenantId = options.tenantId;
this.schoolName = options.schoolName;
// this.getSchoolDetails();
this.getSchoolInfo()
this.getSchoolClass();
this.getSchoolAllClass()
this.getSchoolCoach()
},
methods: {
handleBack() {
uni.navigateBack({
delta: 1
});
},
getSchoolDetails() {
request({
url: '/userClient/base/companySmallProgram/noTenantIdGet',
method: 'GET',
params: {
id: this.schoolId
},
tenantIdFlag: false
}).then(res => {
this.schoolDetails = res.data;
this.tenantId = res.data.tenantId
}).catch(err => {
console.error('获取驾校详情失败', err);
});
},
getSchoolInfo() {
request({
url: '/userClient/base/companySmallProgram/getCompanyByTenantId',
method: 'GET',
params: {
tenantId: this.tenantId,
systemCode: 'jiaxiao',
}
}).then(res => {
this.schoolInfo = res.data
})
},
getSchoolClass() {
request({
url: '/app-api/dl-drive-school-course-small/noTenantIdPage',
method: 'GET',
params: {
pageNo: 1,
pageSize: 3,
tenantId: this.tenantId,
},
tenantIdFlag: false
}).then(res => {
this.schoolClassList = res.data.records;
this.total = res.data.total;
})
},
//
getLocation() {
let location = {
lat: 0,
lng: 0,
}
return new Promise((reserve, reject) => { //使promise
uni.getLocation({
success(res) {
console.log('成功')
location.lat = res.latitude
location.lng = res.longitude,
reserve(location);
},
fail(err) {
console.log('失败', err)
reject(location); //0
}
})
})
},
//
calculateDistance(loc1, loc2) {
const {
latitude: lat1,
longitude: lng1
} = loc1;
const {
latitude: lat2,
longitude: lng2
} = loc2;
const rad = (d) => d * Math.PI / 180.0;
const radLat1 = rad(lat1);
const radLat2 = rad(lat2);
const a = radLat1 - radLat2;
const b = rad(lng1) - rad(lng2);
const rad = (d) => d * Math.PI / 180.0;
const radLat1 = rad(lat1);
const radLat2 = rad(lat2);
const a = radLat1 - radLat2;
const b = rad(lng1) - rad(lng2);
const distance = 2 * Math.asin(Math.sqrt(
Math.pow(Math.sin(a / 2), 2) +
Math.cos(radLat1) *
Math.cos(radLat2) *
Math.pow(Math.sin(b / 2), 2)
));
const distance = 2 * Math.asin(Math.sqrt(
Math.pow(Math.sin(a / 2), 2) +
Math.cos(radLat1) *
Math.cos(radLat2) *
Math.pow(Math.sin(b / 2), 2)
));
const EARTH_RADIUS = 6378.137; //
//
const result = (distance * EARTH_RADIUS).toFixed(2); // 2
console.log('距离:', result + 'km');
return result;
},
wxGeocoder(address) {
return new Promise((resolve, reject) => {
// chooseLocation
uni.chooseLocation({
success: (res) => {
resolve({
latitude: res.latitude,
longitude: res.longitude
});
},
fail: (err) => reject(err)
});
});
},
const EARTH_RADIUS = 6378.137; //
//
const result = (distance * EARTH_RADIUS).toFixed(2); // 2
console.log('距离:', result + 'km');
return result;
},
wxGeocoder(address) {
return new Promise((resolve, reject) => {
// chooseLocation
uni.chooseLocation({
success: (res) => {
resolve({
latitude: res.latitude,
longitude: res.longitude
});
},
fail: (err) => reject(err)
});
});
},
getSchoolAllClass() {
request({
url: '/app-api/dl-drive-school-course-small/list',
method: 'GET',
params: {
tenantId: this.tenantId,
},
tenantIdFlag: false
}).then(res => {
this.schoolAllClassList = res.data;
this.total = res.data.total;
})
},
getSchoolAllClass() {
request({
url: '/app-api/dl-drive-school-course-small/list',
method: 'GET',
params: {
tenantId: this.tenantId,
},
tenantIdFlag: false
}).then(res => {
this.schoolAllClassList = res.data;
this.total = res.data.total;
})
},
getSchoolCoach() {
request({
url: '/app-api/dl-drive-school-coach-small/page',
method: 'GET',
params: {
tenantId: this.tenantId,
},
tenantIdFlag: false
}).then(res => {
//
const sortedList = res.data.records.sort((a, b) => b.seniority - a.seniority);
//
this.schoolCoachList = sortedList.slice(0, 3);
this.total = res.data.total;
})
},
getSchoolCoach() {
console.log('执行');
request({
url: '/app-api/dl-drive-school-coach-small/page',
method: 'GET',
params: {
tenantId: this.tenantId,
pageNo: 1,
pageSize: 100000
},
tenantIdFlag: false
}).then(res => {
//
const sortedList = res.data.records.sort((a, b) => b.seniority - a.seniority);
const coachId = auth.getCoachId()
console.log(coachId, 'coachId');
const coach = res.data.records.find(item => item.userId == coachId)
console.log(coach, 'coach');
if (coach) {
this.schoolCoachList.push(coach)
} else {
//
this.schoolCoachList = sortedList.slice(0, 3);
this.total = res.data.total;
}
}).catch(e => {
console.log(e);
})
},
goClassList() {
uni.navigateTo({
url: '/newPages/courseList/index?tenantId=' + this.tenantId,
});
},
//
goToDetail(courseId) {
uni.navigateTo({
url: `/pagesA/courseDetail/index?courseId=${courseId}&tenantId=${this.tenantId}`,
});
},
goClassList() {
uni.navigateTo({
url: '/newPages/courseList/index?tenantId=' + this.tenantId,
});
},
//
goToDetail(courseId) {
uni.navigateTo({
url: `/pagesA/courseDetail/index?courseId=${courseId}&tenantId=${this.tenantId}`,
});
},
}
};
}
};
</script>
<style lang='scss'>
@import '../common/common.scss';
@import './assets/style/index.rpx.scss';
</style>
@import '../common/common.scss';
@import './assets/style/index.rpx.scss';
</style>

File diff suppressed because it is too large Load Diff