Compare commits

...

2 Commits

Author SHA1 Message Date
Lx
1ebfe3e9aa 0418 2025-04-18 18:05:01 +08:00
Lx
c3a33c3dd5 0418 2025-04-18 18:04:54 +08:00
5 changed files with 742 additions and 492 deletions

View File

@ -57,7 +57,15 @@
"postcss": true,
"minified": true
},
"usingComponents" : true
"usingComponents": true,
"optimization": {
"subPackages": true
},
"permission": {
"scope.userLocation": {
"desc": "用于展示驾校位置"
}
}
},
"mp-alipay": {
"usingComponents": true
@ -71,5 +79,10 @@
"uniStatistics": {
"enable": false
},
"vueVersion" : "2"
"vueVersion": "2",
"h5": {
"sdkConfigs": {
"maps": {}
}
}
}

View File

@ -146,12 +146,12 @@
text-align: left;
white-space: normal;
line-height: 40rpx;
margin: 30rpx 0 0 32rpx;
margin: 10rpx 0 0 32rpx;
}
.text-wrapper_1 {
width: 220rpx;
height: 24rpx;
margin: 15rpx 0 0 32rpx;
margin: 30rpx 0 0 32rpx;
.text_4 {
/* width: 72rpx;
height: 24rpx; */
@ -166,7 +166,7 @@
line-height: 24rpx;
}
.text_5 {
width: 138rpx;
width: 200rpx;
height: 24rpx;
overflow-wrap: break-word;
color: rgba(51, 51, 51, 1);
@ -182,9 +182,8 @@
.block_2 {
width: 686rpx;
height: 120rpx;
background: url(/static/lanhu_jiaxiaoxiangqing/FigmaDDSSlicePNG1eb894220f6795fd386c751f181ce5e4.png)
100% no-repeat;
background-size: 100% 100%;
background-color: #000000;
// background-size: 100% 100%;
margin: 30rpx 0 30rpx 32rpx;
.text-group_1 {
width: 522rpx;

View File

@ -12,16 +12,33 @@
</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">
<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-if=" schoolInfo.businessStartTime && schoolInfo.businessEndTime ">
{{ schoolInfo.businessStartTime }} - {{ schoolInfo.businessEndTime }}</text>
<text class="text_5" v-else>08:00-18:00</text>
</view> -->
</view>
</view>
<!-- 地图 -->
<view class="map_whole flex-row">
<!-- <view class="map_body flex-col" @click="bookingInfoClick(schoolInfo.lat, schoolInfo.lgt)"> -->
<view class="map_body flex-col">
<view class="map_container"
@click="bookingInfoClick(schoolInfo.lat, schoolInfo.lgt, schoolInfo.corpName, schoolInfo.address)">
<image class="bg-img" src="/static/imgs/mapBackground.png" mode="scaleToFill" />
<view class="map-text-1">{{ schoolInfo.address }}</view>
<!-- <view class="map-text-2">距离 {{ distance }}</view> -->
<view class="map-text-2" v-if="showDistance">距离 {{ distance }} </view>
<view class="get-distance-btn" v-else @click.stop="requestLocationPermission">
<text>获取距离</text>
</view>
</view>
</view>
</view>
<view class="group_6 flex-col">
<view class="box_4 flex-row justify-between">
@ -114,6 +131,17 @@
schoolAllClassList: [],
schoolCoachList: [],
latitude: 0, //
longitude: 0, //
scale: 16, //
markers: [], //
distance: '0.0', //
showDistance: true, //
locationPermissionDenied: false //
};
},
async onShow() {
@ -132,6 +160,19 @@
this.getSchoolCoach()
},
methods: {
bookingInfoClick(lat, lgt, name, address) {
//
uni.openLocation({
latitude: lat,
longitude: lgt,
name: name,
address: address,
success: function() {
console.log('success');
}
});
},
handleBack() {
uni.navigateBack({
delta: 1
@ -152,18 +193,74 @@
console.error('获取驾校详情失败', err);
});
},
getSchoolInfo() {
request({
/* async getSchoolInfo() {
try {
const res = await request({
url: '/userClient/base/companySmallProgram/getCompanyByTenantId',
method: 'GET',
params: {
tenantId: this.tenantId,
systemCode: 'jiaxiao',
}
}).then(res => {
this.schoolInfo = res.data
})
});
this.schoolInfo = res.data;
//
const userLocation = await this.getLocation();
if (userLocation.lat && userLocation.lng && this.schoolInfo.lat && this.schoolInfo.lgt) {
const distance = this.calculateDistance({
latitude: userLocation.lat,
longitude: userLocation.lng
}, {
latitude: parseFloat(this.schoolInfo.lat),
longitude: parseFloat(this.schoolInfo.lgt)
});
this.distance = distance; // data
}
} catch (error) {
console.error('获取驾校信息失败', error);
}
}, */
async getSchoolInfo() {
try {
const res = await request({
url: '/userClient/base/companySmallProgram/getCompanyByTenantId',
method: 'GET',
params: {
tenantId: this.tenantId,
systemCode: 'jiaxiao',
}
});
this.schoolInfo = res.data;
//
try {
const userLocation = await this.getLocation();
if (userLocation.lat && userLocation.lng && this.schoolInfo.lat && this.schoolInfo.lgt) {
const distance = this.calculateDistance({
latitude: userLocation.lat,
longitude: userLocation.lng
}, {
latitude: parseFloat(this.schoolInfo.lat),
longitude: parseFloat(this.schoolInfo.lgt)
});
this.distance = distance;
this.showDistance = true;
this.locationPermissionDenied = false;
}
} catch (error) {
console.error('获取位置失败', error);
this.showDistance = false;
this.locationPermissionDenied = true;
}
} catch (error) {
console.error('获取驾校信息失败', error);
}
},
getSchoolClass() {
request({
url: '/app-api/dl-drive-school-course-small/noTenantIdPage',
@ -181,25 +278,29 @@
},
//
getLocation() {
let location = {
lat: 0,
lng: 0,
}
return new Promise((reserve, reject) => { //使promise
return new Promise((resolve, reject) => {
uni.getLocation({
success(res) {
console.log('成功')
location.lat = res.latitude
location.lng = res.longitude,
reserve(location);
type: 'gcj02',
success: (res) => {
resolve({
lat: res.latitude,
lng: res.longitude
});
},
fail(err) {
console.log('失败', err)
reject(location); //0
fail: (err) => {
console.error('获取位置失败', err);
//
if (err.errMsg.includes('auth deny') || err.errMsg.includes(
'fail auth deny')) {
this.showDistance = false;
this.locationPermissionDenied = true;
}
})
})
reject(err);
}
});
});
},
//
calculateDistance(loc1, loc2) {
const {
@ -211,13 +312,15 @@
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 distance = 2 * Math.asin(Math.sqrt(
// 使Haversine
const s = 2 * Math.asin(Math.sqrt(
Math.pow(Math.sin(a / 2), 2) +
Math.cos(radLat1) *
Math.cos(radLat2) *
@ -225,11 +328,16 @@
));
const EARTH_RADIUS = 6378.137; //
//
const result = (distance * EARTH_RADIUS).toFixed(2); // 2
console.log('距离:', result + 'km');
return result;
const distance = s * EARTH_RADIUS;
// 11
if (distance < 1) {
return (distance * 1000).toFixed(0) + '米';
} else {
return distance.toFixed(2) + '公里';
}
},
wxGeocoder(address) {
return new Promise((resolve, reject) => {
// chooseLocation
@ -309,10 +417,142 @@
});
},
//
requestLocationPermission() {
uni.showModal({
title: '提示',
content: '需要获取您的位置信息才能计算距离,是否前往设置开启权限?',
success: (res) => {
if (res.confirm) {
//
uni.openSetting({
success: (res) => {
if (res.authSetting['scope.userLocation']) {
//
this.getSchoolInfo();
}
}
});
}
}
});
},
//
/* initMap() {
//
if (this.schoolInfo.lat && this.schoolInfo.lgt) {
this.latitude = parseFloat(this.schoolInfo.lat);
this.longitude = parseFloat(this.schoolInfo.lgt);
this.markers = [{
id: 1,
latitude: this.latitude,
longitude: this.longitude,
title: this.schoolInfo.corpName,
iconPath: '/static/location.png', //
width: 30,
height: 30
}];
}
}, */
//
/* handleMapTap() {
// APP
uni.openLocation({
latitude: this.latitude,
longitude: this.longitude,
name: this.schoolInfo.corpName,
address: this.schoolInfo.address
});
}, */
}
};
</script>
<style lang='scss'>
@import '../common/common.scss';
@import './assets/style/index.rpx.scss';
.map_whole {
width: 100%;
height: 180rpx;
/* background-color: #000000; */
margin: 0 0 10rpx 0;
display: flex;
justify-content: center;
align-items: center;
}
.map_body {
width: 92%;
height: 95%;
/* background-color: #00aaff; */
border-radius: 16rpx;
}
.map_container {
position: relative;
width: 100%;
height: 300rpx;
overflow: hidden;
}
.bg-img {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 0;
}
.map-text-1 {
width: 70%;
position: absolute;
top: 30rpx;
left: 20rpx;
z-index: 1;
color: #000;
font-size: 26rpx;
right: 20rpx;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
word-break: break-word;
}
.map-text-2 {
margin-top: 30rpx;
position: absolute;
top: 80rpx;
left: 20rpx;
z-index: 1;
color: #5f5f5f;
font-size: 26rpx;
}
.get-distance-btn {
margin-top: 30rpx;
position: absolute;
top: 80rpx;
left: 20rpx;
z-index: 1;
color: #007AFF;
font-size: 26rpx;
padding: 5rpx 15rpx;
background-color: rgba(223, 235, 255, 1);
border-radius: 8rpx;
}
.get-distance-btn text {
color: #007AFF;
}
</style>

View File

@ -24,25 +24,16 @@
<view class="block_4 flex-row justify-between">
<text class="text_2">头像</text>
<view class="label_2">
<u-upload
:fileList="avatarList"
@afterRead="avatarAfterRead"
@delete="avatarDelete"
:maxCount="1"
width="70rpx"
height="70rpx"
>
<u-upload :fileList="avatarList" @afterRead="avatarAfterRead" @delete="avatarDelete"
:maxCount="1" width="70rpx" height="70rpx">
<!-- <image
class="label_2"
referrerpolicy="no-referrer"
:src="(item ? imageUrl + '/' + userDetails.avatar : '/static/lanhu_gerenxinxiweitianxie/FigmaDDSSlicePNG6ea89e46a56641bc7e118ef1d4d789d5.png')"
/> -->
<image
class="label_2"
:src="avatarList[0] ? avatarList[0].url : '/static/lanhu_gerenxinxiweitianxie/FigmaDDSSlicePNG6ea89e46a56641bc7e118ef1d4d789d5.png'"
/>
<image class="label_2"
:src="avatarList[0] ? avatarList[0].url : '/static/lanhu_gerenxinxiweitianxie/FigmaDDSSlicePNG6ea89e46a56641bc7e118ef1d4d789d5.png'" />
</u-upload>
</view>
</view>
@ -61,16 +52,8 @@
<text class="text_7">身份证照片</text>
</view>
<view class="image-wrapper_2 flex-row justify-between">
<u-upload
:fileList="idCardfileList"
@afterRead="idCardAfterRead"
@delete="idCardDelete"
:maxCount="2"
width="300rpx"
height="196rpx"
margin-right="10rpx"
:previewFullImage="true"
>
<u-upload :fileList="idCardfileList" @afterRead="idCardAfterRead" @delete="idCardDelete"
:maxCount="2" width="300rpx" height="196rpx" margin-right="10rpx" :previewFullImage="true">
<!-- <view v-if="idCardList.length > 0" class="flex-row">
<image
v-for="(item, index) in idCardList"
@ -95,13 +78,8 @@
<view class="group_6 flex-col" v-if="noN">
<text class="text_8">生活照片</text>
<view class="list_1 flex-row">
<u-upload
:fileList="lifePhotoFileList"
@afterRead="lifePhotoAfterRead"
@delete="lifePhotoDelete"
:maxCount="3"
:previewFullImage="true"
>
<u-upload :fileList="lifePhotoFileList" @afterRead="lifePhotoAfterRead"
@delete="lifePhotoDelete" :maxCount="3" :previewFullImage="true">
<!-- <view class="flex-row">
<view
class="list-items_1 flex-col"
@ -137,7 +115,9 @@
<script>
import upload from '@/utils/upload.js'
import request from '@/utils/request.js'
import { getLocalUserInfo } from '../../utils/auth';
import {
getLocalUserInfo
} from '../../utils/auth';
import headers from "@/components/header/headers.vue";
export default {
@ -166,36 +146,28 @@ export default {
noN: true,
scrollHeight: 0,
loopData0: [
{
lanhuBg0:
'url(https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG6c58eb8af40eb273da0485e6cc1d93d1.png) 100% no-repeat',
lanhuimage0:
'https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG5d1a336033ae66a9d731e3524093ecf5.png'
loopData0: [{
lanhuBg0: 'url(https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG6c58eb8af40eb273da0485e6cc1d93d1.png) 100% no-repeat',
lanhuimage0: 'https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG5d1a336033ae66a9d731e3524093ecf5.png'
},
{
lanhuBg0:
'url(https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNGb51240b007489f1975779de452af0c84.png) 100% no-repeat',
lanhuimage0:
'https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG5d1a336033ae66a9d731e3524093ecf5.png'
lanhuBg0: 'url(https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNGb51240b007489f1975779de452af0c84.png) 100% no-repeat',
lanhuimage0: 'https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG5d1a336033ae66a9d731e3524093ecf5.png'
},
{
lanhuBg0:
'url(https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG6096ca91210c53f26481649ad200964b.png) 100% no-repeat',
lanhuimage0:
'https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG5d1a336033ae66a9d731e3524093ecf5.png'
lanhuBg0: 'url(https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG6096ca91210c53f26481649ad200964b.png) 100% no-repeat',
lanhuimage0: 'https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG5d1a336033ae66a9d731e3524093ecf5.png'
},
{
lanhuBg0:
'url(https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG31e719001bca1c0de203d1dbe975991e.png) 100% no-repeat',
lanhuimage0:
'https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG5d1a336033ae66a9d731e3524093ecf5.png'
lanhuBg0: 'url(https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG31e719001bca1c0de203d1dbe975991e.png) 100% no-repeat',
lanhuimage0: 'https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG5d1a336033ae66a9d731e3524093ecf5.png'
}
],
constants: {}
};
},
onLoad(option) {
console.log('option', option)
this.usersMsg = getLocalUserInfo()
this.userId = option.userId;
this.userDetails.userId = option.userId;
@ -218,7 +190,9 @@ export default {
request({
url: '/app-api/small/dl-drive-school-student/getByUserId',
method: 'GET',
params: { userId: this.userId },
params: {
userId: this.userId
},
}).then(res => {
if (!res.data) {
this.noN = false;
@ -233,13 +207,17 @@ export default {
url: `${this.imageUrl}/${this.usersMsg.avatar}`,
fileName: this.usersMsg.avatar,
status: 'success',
response: { url: this.usersMsg.avatar }
response: {
url: this.usersMsg.avatar
}
}];
}
return;
}
this.userDetails = { ...res.data };
this.userDetails = {
...res.data
};
//
if (res.data.avatar) {
@ -247,33 +225,39 @@ export default {
url: `${this.imageUrl}/${res.data.avatar}`,
fileName: res.data.avatar,
status: 'success',
response: { url: res.data.avatar }
response: {
url: res.data.avatar
}
}];
}
//
this.idCardfileList = res.data.idPhoto
? res.data.idPhoto.split(',')
this.idCardfileList = res.data.idPhoto ?
res.data.idPhoto.split(',')
.filter(url => url.trim())
.map(url => ({
url: `${this.imageUrl}/${url.trim()}`,
fileName: url.trim(),
status: 'success',
response: { url:`${this.imageUrl}/${url.trim()}` }
}))
: [];
response: {
url: `${this.imageUrl}/${url.trim()}`
}
})) :
[];
//
this.lifePhotoFileList = res.data.lifePhoto
? res.data.lifePhoto.split(',')
this.lifePhotoFileList = res.data.lifePhoto ?
res.data.lifePhoto.split(',')
.filter(url => url.trim())
.map(url => ({
url: `${this.imageUrl}/${url.trim()}`,
fileName: url.trim(),
status: 'success',
response: { url: `${this.imageUrl}/${url.trim()}` }
}))
: [];
response: {
url: `${this.imageUrl}/${url.trim()}`
}
})) :
[];
});
},
@ -298,7 +282,10 @@ export default {
idCardAfterRead(event) {
const files = Array.isArray(event.file) ? event.file : [event.file]
if (this.idCardfileList.length + files.length > 2) {
uni.showToast({ title: '最多上传2张身份证照片', icon: 'none' })
uni.showToast({
title: '最多上传2张身份证照片',
icon: 'none'
})
return
}
@ -324,7 +311,10 @@ export default {
lifePhotoAfterRead(event) {
const files = Array.isArray(event.file) ? event.file : [event.file]
if (this.lifePhotoFileList.length + files.length > 3) {
uni.showToast({ title: '最多上传3张生活照片', icon: 'none' })
uni.showToast({
title: '最多上传3张生活照片',
icon: 'none'
})
return
}
@ -349,7 +339,9 @@ export default {
url: '/app-api/small-upload/common/upload',
filePath: file.url || file.path,
name: 'file',
formData: { type }
formData: {
type
}
}).then(resolve).catch(reject)
})
},
@ -422,10 +414,16 @@ export default {
method: 'PUT',
data: submitData
}).then(() => {
uni.showToast({ title: '保存成功', icon: 'success' })
uni.showToast({
title: '保存成功',
icon: 'success'
})
setTimeout(() => uni.navigateBack(), 1500)
}).catch(() => {
uni.showToast({ title: '保存失败', icon: 'none' })
uni.showToast({
title: '保存失败',
icon: 'none'
})
})
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB