Compare commits
2 Commits
998de8e951
...
1ebfe3e9aa
Author | SHA1 | Date | |
---|---|---|---|
1ebfe3e9aa | |||
c3a33c3dd5 |
161
manifest.json
161
manifest.json
@ -1,75 +1,88 @@
|
|||||||
{
|
{
|
||||||
"name" : "驾悦同行",
|
"name": "驾悦同行",
|
||||||
"appid" : "__UNI__7A6878C",
|
"appid": "__UNI__7A6878C",
|
||||||
"description" : "",
|
"description": "",
|
||||||
"versionName" : "1.0.0",
|
"versionName": "1.0.0",
|
||||||
"versionCode" : "100",
|
"versionCode": "100",
|
||||||
"transformPx" : false,
|
"transformPx": false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus": {
|
||||||
"usingComponents" : true,
|
"usingComponents": true,
|
||||||
"nvueStyleCompiler" : "uni-app",
|
"nvueStyleCompiler": "uni-app",
|
||||||
"compilerVersion" : 3,
|
"compilerVersion": 3,
|
||||||
"splashscreen" : {
|
"splashscreen": {
|
||||||
"alwaysShowBeforeRender" : true,
|
"alwaysShowBeforeRender": true,
|
||||||
"waiting" : true,
|
"waiting": true,
|
||||||
"autoclose" : true,
|
"autoclose": true,
|
||||||
"delay" : 0
|
"delay": 0
|
||||||
},
|
},
|
||||||
/* 模块配置 */
|
/* 模块配置 */
|
||||||
"modules" : {},
|
"modules": {},
|
||||||
/* 应用发布信息 */
|
/* 应用发布信息 */
|
||||||
"distribute" : {
|
"distribute": {
|
||||||
/* android打包配置 */
|
/* android打包配置 */
|
||||||
"android" : {
|
"android": {
|
||||||
"permissions" : [
|
"permissions": [
|
||||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
/* ios打包配置 */
|
/* ios打包配置 */
|
||||||
"ios" : {},
|
"ios": {},
|
||||||
/* SDK配置 */
|
/* SDK配置 */
|
||||||
"sdkConfigs" : {}
|
"sdkConfigs": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/* 快应用特有相关 */
|
/* 快应用特有相关 */
|
||||||
"quickapp" : {},
|
"quickapp": {},
|
||||||
/* 小程序特有相关 */
|
/* 小程序特有相关 */
|
||||||
"mp-weixin" : {
|
"mp-weixin": {
|
||||||
"appid" : "wx684fc832e96cee65",
|
"appid": "wx684fc832e96cee65",
|
||||||
"setting" : {
|
"setting": {
|
||||||
"urlCheck" : false,
|
"urlCheck": false,
|
||||||
"es6" : true,
|
"es6": true,
|
||||||
"postcss" : true,
|
"postcss": true,
|
||||||
"minified" : true
|
"minified": true
|
||||||
},
|
},
|
||||||
"usingComponents" : true
|
"usingComponents": true,
|
||||||
},
|
"optimization": {
|
||||||
"mp-alipay" : {
|
"subPackages": true
|
||||||
"usingComponents" : true
|
},
|
||||||
},
|
"permission": {
|
||||||
"mp-baidu" : {
|
"scope.userLocation": {
|
||||||
"usingComponents" : true
|
"desc": "用于展示驾校位置"
|
||||||
},
|
}
|
||||||
"mp-toutiao" : {
|
}
|
||||||
"usingComponents" : true
|
},
|
||||||
},
|
"mp-alipay": {
|
||||||
"uniStatistics" : {
|
"usingComponents": true
|
||||||
"enable" : false
|
},
|
||||||
},
|
"mp-baidu": {
|
||||||
"vueVersion" : "2"
|
"usingComponents": true
|
||||||
}
|
},
|
||||||
|
"mp-toutiao": {
|
||||||
|
"usingComponents": true
|
||||||
|
},
|
||||||
|
"uniStatistics": {
|
||||||
|
"enable": false
|
||||||
|
},
|
||||||
|
"vueVersion": "2",
|
||||||
|
"h5": {
|
||||||
|
"sdkConfigs": {
|
||||||
|
"maps": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -146,12 +146,12 @@
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
line-height: 40rpx;
|
line-height: 40rpx;
|
||||||
margin: 30rpx 0 0 32rpx;
|
margin: 10rpx 0 0 32rpx;
|
||||||
}
|
}
|
||||||
.text-wrapper_1 {
|
.text-wrapper_1 {
|
||||||
width: 220rpx;
|
width: 220rpx;
|
||||||
height: 24rpx;
|
height: 24rpx;
|
||||||
margin: 15rpx 0 0 32rpx;
|
margin: 30rpx 0 0 32rpx;
|
||||||
.text_4 {
|
.text_4 {
|
||||||
/* width: 72rpx;
|
/* width: 72rpx;
|
||||||
height: 24rpx; */
|
height: 24rpx; */
|
||||||
@ -166,7 +166,7 @@
|
|||||||
line-height: 24rpx;
|
line-height: 24rpx;
|
||||||
}
|
}
|
||||||
.text_5 {
|
.text_5 {
|
||||||
width: 138rpx;
|
width: 200rpx;
|
||||||
height: 24rpx;
|
height: 24rpx;
|
||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
color: rgba(51, 51, 51, 1);
|
color: rgba(51, 51, 51, 1);
|
||||||
@ -182,9 +182,8 @@
|
|||||||
.block_2 {
|
.block_2 {
|
||||||
width: 686rpx;
|
width: 686rpx;
|
||||||
height: 120rpx;
|
height: 120rpx;
|
||||||
background: url(/static/lanhu_jiaxiaoxiangqing/FigmaDDSSlicePNG1eb894220f6795fd386c751f181ce5e4.png)
|
background-color: #000000;
|
||||||
100% no-repeat;
|
// background-size: 100% 100%;
|
||||||
background-size: 100% 100%;
|
|
||||||
margin: 30rpx 0 30rpx 32rpx;
|
margin: 30rpx 0 30rpx 32rpx;
|
||||||
.text-group_1 {
|
.text-group_1 {
|
||||||
width: 522rpx;
|
width: 522rpx;
|
||||||
|
@ -12,16 +12,33 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="group_5 flex-col">
|
<view class="group_5 flex-col">
|
||||||
<text class="text_3">{{ schoolInfo.corpName }}</text>
|
<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_4">营业时间</text>
|
||||||
<text class="text_5"
|
<text class="text_5" v-if=" schoolInfo.businessStartTime && schoolInfo.businessEndTime ">
|
||||||
v-if=" schoolInfo.businessStartTime && schoolInfo.businessEndTime ">{{ schoolInfo.businessStartTime }}
|
{{ schoolInfo.businessStartTime }} - {{ schoolInfo.businessEndTime }}</text>
|
||||||
- {{ schoolInfo.businessEndTime }}</text>
|
|
||||||
<text class="text_5" v-else>08:00-18:00</text>
|
<text class="text_5" v-else>08:00-18:00</text>
|
||||||
</view> -->
|
</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="group_6 flex-col">
|
||||||
<view class="box_4 flex-row justify-between">
|
<view class="box_4 flex-row justify-between">
|
||||||
@ -114,6 +131,17 @@
|
|||||||
schoolAllClassList: [],
|
schoolAllClassList: [],
|
||||||
schoolCoachList: [],
|
schoolCoachList: [],
|
||||||
|
|
||||||
|
latitude: 0, // 地图中心纬度
|
||||||
|
longitude: 0, // 地图中心经度
|
||||||
|
scale: 16, // 地图缩放级别
|
||||||
|
markers: [], // 地图标记点
|
||||||
|
|
||||||
|
distance: '0.0', // 初始距离
|
||||||
|
|
||||||
|
showDistance: true, // 控制是否显示距离
|
||||||
|
locationPermissionDenied: false // 记录用户是否拒绝了位置权限
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async onShow() {
|
async onShow() {
|
||||||
@ -132,6 +160,19 @@
|
|||||||
this.getSchoolCoach()
|
this.getSchoolCoach()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
bookingInfoClick(lat, lgt, name, address) {
|
||||||
|
// 进行导航
|
||||||
|
uni.openLocation({
|
||||||
|
latitude: lat,
|
||||||
|
longitude: lgt,
|
||||||
|
name: name,
|
||||||
|
address: address,
|
||||||
|
success: function() {
|
||||||
|
console.log('success');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
handleBack() {
|
handleBack() {
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
delta: 1
|
delta: 1
|
||||||
@ -152,18 +193,74 @@
|
|||||||
console.error('获取驾校详情失败', err);
|
console.error('获取驾校详情失败', err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getSchoolInfo() {
|
/* async getSchoolInfo() {
|
||||||
request({
|
try {
|
||||||
url: '/userClient/base/companySmallProgram/getCompanyByTenantId',
|
const res = await request({
|
||||||
method: 'GET',
|
url: '/userClient/base/companySmallProgram/getCompanyByTenantId',
|
||||||
params: {
|
method: 'GET',
|
||||||
tenantId: this.tenantId,
|
params: {
|
||||||
systemCode: 'jiaxiao',
|
tenantId: this.tenantId,
|
||||||
|
systemCode: 'jiaxiao',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
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中
|
||||||
}
|
}
|
||||||
}).then(res => {
|
} catch (error) {
|
||||||
this.schoolInfo = res.data
|
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() {
|
getSchoolClass() {
|
||||||
request({
|
request({
|
||||||
url: '/app-api/dl-drive-school-course-small/noTenantIdPage',
|
url: '/app-api/dl-drive-school-course-small/noTenantIdPage',
|
||||||
@ -181,25 +278,29 @@
|
|||||||
},
|
},
|
||||||
//获取当前位置
|
//获取当前位置
|
||||||
getLocation() {
|
getLocation() {
|
||||||
let location = {
|
return new Promise((resolve, reject) => {
|
||||||
lat: 0,
|
|
||||||
lng: 0,
|
|
||||||
}
|
|
||||||
return new Promise((reserve, reject) => { //因为获取位置是异步接口所以需要使用promise
|
|
||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
success(res) {
|
type: 'gcj02',
|
||||||
console.log('成功')
|
success: (res) => {
|
||||||
location.lat = res.latitude
|
resolve({
|
||||||
location.lng = res.longitude,
|
lat: res.latitude,
|
||||||
reserve(location);
|
lng: res.longitude
|
||||||
|
});
|
||||||
},
|
},
|
||||||
fail(err) {
|
fail: (err) => {
|
||||||
console.log('失败', err)
|
console.error('获取位置失败', err);
|
||||||
reject(location); //获取失败则返回经纬坐标为0
|
// 用户拒绝了位置授权
|
||||||
|
if (err.errMsg.includes('auth deny') || err.errMsg.includes(
|
||||||
|
'fail auth deny')) {
|
||||||
|
this.showDistance = false;
|
||||||
|
this.locationPermissionDenied = true;
|
||||||
|
}
|
||||||
|
reject(err);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// 计算两点间距离(单位:米)
|
// 计算两点间距离(单位:米)
|
||||||
calculateDistance(loc1, loc2) {
|
calculateDistance(loc1, loc2) {
|
||||||
const {
|
const {
|
||||||
@ -211,13 +312,15 @@
|
|||||||
longitude: lng2
|
longitude: lng2
|
||||||
} = loc2;
|
} = loc2;
|
||||||
|
|
||||||
|
// 将经纬度转换为弧度
|
||||||
const rad = (d) => d * Math.PI / 180.0;
|
const rad = (d) => d * Math.PI / 180.0;
|
||||||
const radLat1 = rad(lat1);
|
const radLat1 = rad(lat1);
|
||||||
const radLat2 = rad(lat2);
|
const radLat2 = rad(lat2);
|
||||||
const a = radLat1 - radLat2;
|
const a = radLat1 - radLat2;
|
||||||
const b = rad(lng1) - rad(lng2);
|
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.pow(Math.sin(a / 2), 2) +
|
||||||
Math.cos(radLat1) *
|
Math.cos(radLat1) *
|
||||||
Math.cos(radLat2) *
|
Math.cos(radLat2) *
|
||||||
@ -225,11 +328,16 @@
|
|||||||
));
|
));
|
||||||
|
|
||||||
const EARTH_RADIUS = 6378.137; // 地球半径(千米)
|
const EARTH_RADIUS = 6378.137; // 地球半径(千米)
|
||||||
// 修改计算结果(原米制 → 公里制)
|
const distance = s * EARTH_RADIUS;
|
||||||
const result = (distance * EARTH_RADIUS).toFixed(2); // 直接得到公里,保留2位小数
|
|
||||||
console.log('距离:', result + 'km');
|
// 小于1公里显示米,大于等于1公里显示千米
|
||||||
return result;
|
if (distance < 1) {
|
||||||
|
return (distance * 1000).toFixed(0) + '米';
|
||||||
|
} else {
|
||||||
|
return distance.toFixed(2) + '公里';
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
wxGeocoder(address) {
|
wxGeocoder(address) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// 需要先通过chooseLocation获取坐标(用户交互触发)
|
// 需要先通过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>
|
</script>
|
||||||
<style lang='scss'>
|
<style lang='scss'>
|
||||||
@import '../common/common.scss';
|
@import '../common/common.scss';
|
||||||
@import './assets/style/index.rpx.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>
|
</style>
|
@ -1,15 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="page flex-col">
|
<view class="page flex-col">
|
||||||
<!-- <view class="block_1 flex-row">{{ 123 }}
|
<!-- <view class="block_1 flex-row">{{ 123 }}
|
||||||
</view> -->
|
</view> -->
|
||||||
<view style="width: 100%;background: #f4f5f6;box-sizing: border-box;padding-top: 88px;">
|
<view style="width: 100%;background: #f4f5f6;box-sizing: border-box;padding-top: 88px;">
|
||||||
<headers titles="个人信息">
|
<headers titles="个人信息">
|
||||||
<uni-icons type="left" color="#000000" size="22px"></uni-icons>
|
<uni-icons type="left" color="#000000" size="22px"></uni-icons>
|
||||||
</headers>
|
</headers>
|
||||||
</view>
|
</view>
|
||||||
<view :style="{ height: scrollHeight + 'px' }">
|
<view :style="{ height: scrollHeight + 'px' }">
|
||||||
<view class="block_2 flex-col">
|
<view class="block_2 flex-col">
|
||||||
<!-- <view class="group_1 flex-row">
|
<!-- <view class="group_1 flex-row">
|
||||||
<image
|
<image
|
||||||
class="label_1"
|
class="label_1"
|
||||||
referrerpolicy="no-referrer"
|
referrerpolicy="no-referrer"
|
||||||
@ -19,59 +19,42 @@
|
|||||||
<text class="text_1">个人信息</text>
|
<text class="text_1">个人信息</text>
|
||||||
|
|
||||||
</view> -->
|
</view> -->
|
||||||
|
|
||||||
<view class="group_4 flex-col">
|
<view class="group_4 flex-col">
|
||||||
<view class="block_4 flex-row justify-between">
|
<view class="block_4 flex-row justify-between">
|
||||||
<text class="text_2">头像</text>
|
<text class="text_2">头像</text>
|
||||||
<view class="label_2">
|
<view class="label_2">
|
||||||
<u-upload
|
<u-upload :fileList="avatarList" @afterRead="avatarAfterRead" @delete="avatarDelete"
|
||||||
:fileList="avatarList"
|
:maxCount="1" width="70rpx" height="70rpx">
|
||||||
@afterRead="avatarAfterRead"
|
<!-- <image
|
||||||
@delete="avatarDelete"
|
|
||||||
:maxCount="1"
|
|
||||||
width="70rpx"
|
|
||||||
height="70rpx"
|
|
||||||
|
|
||||||
>
|
|
||||||
<!-- <image
|
|
||||||
class="label_2"
|
class="label_2"
|
||||||
referrerpolicy="no-referrer"
|
referrerpolicy="no-referrer"
|
||||||
:src="(item ? imageUrl + '/' + userDetails.avatar : '/static/lanhu_gerenxinxiweitianxie/FigmaDDSSlicePNG6ea89e46a56641bc7e118ef1d4d789d5.png')"
|
:src="(item ? imageUrl + '/' + userDetails.avatar : '/static/lanhu_gerenxinxiweitianxie/FigmaDDSSlicePNG6ea89e46a56641bc7e118ef1d4d789d5.png')"
|
||||||
/> -->
|
/> -->
|
||||||
|
|
||||||
<image
|
<image class="label_2"
|
||||||
class="label_2"
|
:src="avatarList[0] ? avatarList[0].url : '/static/lanhu_gerenxinxiweitianxie/FigmaDDSSlicePNG6ea89e46a56641bc7e118ef1d4d789d5.png'" />
|
||||||
:src="avatarList[0] ? avatarList[0].url : '/static/lanhu_gerenxinxiweitianxie/FigmaDDSSlicePNG6ea89e46a56641bc7e118ef1d4d789d5.png'"
|
</u-upload>
|
||||||
/>
|
</view>
|
||||||
</u-upload>
|
</view>
|
||||||
</view>
|
<!-- src="/static/lanhu_gerenxinxi/FigmaDDSSlicePNGcc6ee579083c2c921f6c93c250df5d44.png" -->
|
||||||
</view>
|
<view class="text-wrapper_1 flex-row justify-between">
|
||||||
<!-- src="/static/lanhu_gerenxinxi/FigmaDDSSlicePNGcc6ee579083c2c921f6c93c250df5d44.png" -->
|
<text class="text_3">昵称</text>
|
||||||
<view class="text-wrapper_1 flex-row justify-between">
|
<input class="text_4" v-model="userDetails.name" type="text" placeholder="请填写昵称">
|
||||||
<text class="text_3">昵称</text>
|
</view>
|
||||||
<input class="text_4" v-model="userDetails.name" type="text" placeholder="请填写昵称">
|
<view class="text-wrapper_2 flex-row justify-between">
|
||||||
</view>
|
<text class="text_5">联系方式</text>
|
||||||
<view class="text-wrapper_2 flex-row justify-between">
|
<text class="text_6">{{ userDetails.phone }}</text>
|
||||||
<text class="text_5">联系方式</text>
|
</view>
|
||||||
<text class="text_6" >{{ userDetails.phone }}</text>
|
</view>
|
||||||
</view>
|
<view class="group_5 flex-col" v-if="noN">
|
||||||
</view>
|
<view class="text-wrapper_3 flex-row">
|
||||||
<view class="group_5 flex-col" v-if="noN">
|
<text class="text_7">身份证照片</text>
|
||||||
<view class="text-wrapper_3 flex-row">
|
</view>
|
||||||
<text class="text_7">身份证照片</text>
|
<view class="image-wrapper_2 flex-row justify-between">
|
||||||
</view>
|
<u-upload :fileList="idCardfileList" @afterRead="idCardAfterRead" @delete="idCardDelete"
|
||||||
<view class="image-wrapper_2 flex-row justify-between">
|
:maxCount="2" width="300rpx" height="196rpx" margin-right="10rpx" :previewFullImage="true">
|
||||||
<u-upload
|
<!-- <view v-if="idCardList.length > 0" class="flex-row">
|
||||||
: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
|
<image
|
||||||
v-for="(item, index) in idCardList"
|
v-for="(item, index) in idCardList"
|
||||||
:key="index"
|
:key="index"
|
||||||
@ -87,22 +70,17 @@
|
|||||||
src="/static/lanhu_gerenxinxiweitianxie/FigmaDDSSlicePNG613ddce187a71bcc667c56c84cd2d022.png"
|
src="/static/lanhu_gerenxinxiweitianxie/FigmaDDSSlicePNG613ddce187a71bcc667c56c84cd2d022.png"
|
||||||
referrerpolicy="no-referrer"
|
referrerpolicy="no-referrer"
|
||||||
/> -->
|
/> -->
|
||||||
</u-upload>
|
</u-upload>
|
||||||
|
|
||||||
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="group_6 flex-col" v-if="noN">
|
</view>
|
||||||
<text class="text_8">生活照片</text>
|
<view class="group_6 flex-col" v-if="noN">
|
||||||
<view class="list_1 flex-row">
|
<text class="text_8">生活照片</text>
|
||||||
<u-upload
|
<view class="list_1 flex-row">
|
||||||
:fileList="lifePhotoFileList"
|
<u-upload :fileList="lifePhotoFileList" @afterRead="lifePhotoAfterRead"
|
||||||
@afterRead="lifePhotoAfterRead"
|
@delete="lifePhotoDelete" :maxCount="3" :previewFullImage="true">
|
||||||
@delete="lifePhotoDelete"
|
<!-- <view class="flex-row">
|
||||||
:maxCount="3"
|
|
||||||
:previewFullImage="true"
|
|
||||||
>
|
|
||||||
<!-- <view class="flex-row">
|
|
||||||
<view
|
<view
|
||||||
class="list-items_1 flex-col"
|
class="list-items_1 flex-col"
|
||||||
v-for="(item, index) in lifePhotoList"
|
v-for="(item, index) in lifePhotoList"
|
||||||
@ -121,319 +99,339 @@
|
|||||||
src="/static/lanhu_gerenxinxiweitianxie/FigmaDDSSlicePNG6ea89e46a56641bc7e118ef1d4d789d5.png"
|
src="/static/lanhu_gerenxinxiweitianxie/FigmaDDSSlicePNG6ea89e46a56641bc7e118ef1d4d789d5.png"
|
||||||
/>
|
/>
|
||||||
</view> -->
|
</view> -->
|
||||||
</u-upload>
|
</u-upload>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="block_5 flex-col">
|
||||||
|
<view class="text-wrapper_4 flex-col" @click="handleSave">
|
||||||
|
<text class="text_9">保存</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="block_5 flex-col">
|
|
||||||
<view class="text-wrapper_4 flex-col" @click="handleSave">
|
|
||||||
<text class="text_9">保存</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import upload from '@/utils/upload.js'
|
import upload from '@/utils/upload.js'
|
||||||
import request from '@/utils/request.js'
|
import request from '@/utils/request.js'
|
||||||
import { getLocalUserInfo } from '../../utils/auth';
|
import {
|
||||||
import headers from "@/components/header/headers.vue";
|
getLocalUserInfo
|
||||||
|
} from '../../utils/auth';
|
||||||
|
import headers from "@/components/header/headers.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
headers
|
headers
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
usersMsg: {},
|
|
||||||
userId: null,
|
|
||||||
constants: {},
|
|
||||||
avatarList: [],
|
|
||||||
idCardfileList: [],
|
|
||||||
// idCardList: [],
|
|
||||||
// lifePhotoList: [],
|
|
||||||
lifePhotoFileList: [],
|
|
||||||
imageUrl: this.$imagesUrl,
|
|
||||||
userDetails: {
|
|
||||||
userId: null,
|
|
||||||
avatar: '',
|
|
||||||
name: null,
|
|
||||||
phone: null,
|
|
||||||
idCardImg: '',
|
|
||||||
lifeImg: '',
|
|
||||||
},
|
|
||||||
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'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
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/FigmaDDSSlicePNG31e719001bca1c0de203d1dbe975991e.png) 100% no-repeat',
|
|
||||||
lanhuimage0:
|
|
||||||
'https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG5d1a336033ae66a9d731e3524093ecf5.png'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
constants: {}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
onLoad(option) {
|
|
||||||
this.usersMsg = getLocalUserInfo()
|
|
||||||
this.userId = option.userId;
|
|
||||||
this.userDetails.userId = option.userId;
|
|
||||||
this.getUserInfo()
|
|
||||||
},
|
|
||||||
onReady() {
|
|
||||||
// 动态计算滚动区域高度
|
|
||||||
this.calculateScrollHeight();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
handleBack() {
|
|
||||||
uni.navigateBack({
|
|
||||||
delta: 1
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
getUserInfo() {
|
|
||||||
request({
|
|
||||||
url: '/app-api/small/dl-drive-school-student/getByUserId',
|
|
||||||
method: 'GET',
|
|
||||||
params: { userId: this.userId },
|
|
||||||
}).then(res => {
|
|
||||||
if (!res.data) {
|
|
||||||
this.noN = false;
|
|
||||||
this.userDetails = {
|
|
||||||
name: this.usersMsg.nickname,
|
|
||||||
phone: this.usersMsg.username,
|
|
||||||
avatar: this.usersMsg.avatar
|
|
||||||
};
|
|
||||||
// 头像初始化
|
|
||||||
if (this.usersMsg.avatar) {
|
|
||||||
this.avatarList = [{
|
|
||||||
url: `${this.imageUrl}/${this.usersMsg.avatar}`,
|
|
||||||
fileName: this.usersMsg.avatar,
|
|
||||||
status: 'success',
|
|
||||||
response: { url: this.usersMsg.avatar }
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.userDetails = { ...res.data };
|
|
||||||
|
|
||||||
// 头像初始化
|
|
||||||
if (res.data.avatar) {
|
|
||||||
this.avatarList = [{
|
|
||||||
url: `${this.imageUrl}/${res.data.avatar}`,
|
|
||||||
fileName: res.data.avatar,
|
|
||||||
status: 'success',
|
|
||||||
response: { url: res.data.avatar }
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
|
|
||||||
// 身份证照片初始化
|
|
||||||
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()}` }
|
|
||||||
}))
|
|
||||||
: [];
|
|
||||||
|
|
||||||
// 生活照初始化
|
|
||||||
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()}` }
|
|
||||||
}))
|
|
||||||
: [];
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
usersMsg: {},
|
||||||
|
userId: null,
|
||||||
|
constants: {},
|
||||||
|
avatarList: [],
|
||||||
|
idCardfileList: [],
|
||||||
|
// idCardList: [],
|
||||||
|
// lifePhotoList: [],
|
||||||
|
lifePhotoFileList: [],
|
||||||
|
imageUrl: this.$imagesUrl,
|
||||||
|
userDetails: {
|
||||||
|
userId: null,
|
||||||
|
avatar: '',
|
||||||
|
name: null,
|
||||||
|
phone: null,
|
||||||
|
idCardImg: '',
|
||||||
|
lifeImg: '',
|
||||||
|
},
|
||||||
|
noN: true,
|
||||||
|
scrollHeight: 0,
|
||||||
|
|
||||||
// 头像上传
|
loopData0: [{
|
||||||
avatarAfterRead(event) {
|
lanhuBg0: 'url(https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG6c58eb8af40eb273da0485e6cc1d93d1.png) 100% no-repeat',
|
||||||
const file = event.file[0] || event.file
|
lanhuimage0: 'https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG5d1a336033ae66a9d731e3524093ecf5.png'
|
||||||
this.uploadFile(file, 'avatar').then(res => {
|
},
|
||||||
this.avatarList = [{
|
{
|
||||||
url: `${this.imageUrl}/${res.data.url}`,
|
lanhuBg0: 'url(https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNGb51240b007489f1975779de452af0c84.png) 100% no-repeat',
|
||||||
fileName: res.data.url
|
lanhuimage0: 'https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG5d1a336033ae66a9d731e3524093ecf5.png'
|
||||||
}]
|
},
|
||||||
this.userDetails.avatar = res.data.url
|
{
|
||||||
})
|
lanhuBg0: 'url(https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG6096ca91210c53f26481649ad200964b.png) 100% no-repeat',
|
||||||
},
|
lanhuimage0: 'https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG5d1a336033ae66a9d731e3524093ecf5.png'
|
||||||
// 头像删除
|
},
|
||||||
avatarDelete() {
|
{
|
||||||
this.avatarList = []
|
lanhuBg0: 'url(https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG31e719001bca1c0de203d1dbe975991e.png) 100% no-repeat',
|
||||||
this.userDetails.avatar = ''
|
lanhuimage0: 'https://lanhu-oss-2537-2.lanhuapp.com/FigmaDDSSlicePNG5d1a336033ae66a9d731e3524093ecf5.png'
|
||||||
},
|
}
|
||||||
|
],
|
||||||
// 身份证照片上传
|
constants: {}
|
||||||
idCardAfterRead(event) {
|
};
|
||||||
const files = Array.isArray(event.file) ? event.file : [event.file]
|
},
|
||||||
if (this.idCardfileList.length + files.length > 2) {
|
onLoad(option) {
|
||||||
uni.showToast({ title: '最多上传2张身份证照片', icon: 'none' })
|
console.log('option', option)
|
||||||
return
|
this.usersMsg = getLocalUserInfo()
|
||||||
}
|
this.userId = option.userId;
|
||||||
|
this.userDetails.userId = option.userId;
|
||||||
Promise.all(
|
this.getUserInfo()
|
||||||
files.map(file =>
|
},
|
||||||
this.uploadFile(file, 'idCard').then(res => ({
|
onReady() {
|
||||||
url: `${this.imageUrl}/${res.data.url}`,
|
// 动态计算滚动区域高度
|
||||||
fileName: res.data.url
|
this.calculateScrollHeight();
|
||||||
}))
|
},
|
||||||
)
|
methods: {
|
||||||
).then(newFiles => {
|
handleBack() {
|
||||||
this.idCardfileList = [...this.idCardfileList, ...newFiles];
|
uni.navigateBack({
|
||||||
});
|
delta: 1
|
||||||
},
|
});
|
||||||
|
},
|
||||||
// 身份证照片删除
|
|
||||||
idCardDelete(event) {
|
|
||||||
this.idCardfileList.splice(event.index, 1)
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
// 生活照上传
|
|
||||||
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' })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
Promise.all(files.map(file =>
|
|
||||||
this.uploadFile(file, 'lifePhoto').then(res => ({
|
|
||||||
url: `${this.imageUrl}/${res.data.url}`,
|
|
||||||
fileName: res.data.url
|
|
||||||
}))
|
|
||||||
)).then(newFiles => {
|
|
||||||
this.lifePhotoFileList = [...this.lifePhotoFileList, ...newFiles]
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 生活照删除
|
|
||||||
lifePhotoDelete(event) {
|
|
||||||
this.lifePhotoFileList.splice(event.index, 1)
|
|
||||||
},
|
|
||||||
|
|
||||||
// 上传
|
getUserInfo() {
|
||||||
uploadFile(file, type) {
|
request({
|
||||||
return new Promise((resolve, reject) => {
|
url: '/app-api/small/dl-drive-school-student/getByUserId',
|
||||||
upload({
|
method: 'GET',
|
||||||
url: '/app-api/small-upload/common/upload',
|
params: {
|
||||||
filePath: file.url || file.path,
|
userId: this.userId
|
||||||
name: 'file',
|
},
|
||||||
formData: { type }
|
}).then(res => {
|
||||||
}).then(resolve).catch(reject)
|
if (!res.data) {
|
||||||
})
|
this.noN = false;
|
||||||
},
|
this.userDetails = {
|
||||||
|
name: this.usersMsg.nickname,
|
||||||
getUserOrder(){
|
phone: this.usersMsg.username,
|
||||||
request({
|
avatar: this.usersMsg.avatar
|
||||||
url: '/app-api/small/drive/school-course-order/getCourseByLoginUser',
|
};
|
||||||
method: 'GET',
|
// 头像初始化
|
||||||
}).then(res => {
|
if (this.usersMsg.avatar) {
|
||||||
if(res.data === null){
|
this.avatarList = [{
|
||||||
// this.insertSchoolStudent()
|
url: `${this.imageUrl}/${this.usersMsg.avatar}`,
|
||||||
|
fileName: this.usersMsg.avatar,
|
||||||
|
status: 'success',
|
||||||
|
response: {
|
||||||
|
url: this.usersMsg.avatar
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.userDetails = {
|
||||||
|
...res.data
|
||||||
|
};
|
||||||
|
|
||||||
|
// 头像初始化
|
||||||
|
if (res.data.avatar) {
|
||||||
|
this.avatarList = [{
|
||||||
|
url: `${this.imageUrl}/${res.data.avatar}`,
|
||||||
|
fileName: res.data.avatar,
|
||||||
|
status: 'success',
|
||||||
|
response: {
|
||||||
|
url: res.data.avatar
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 身份证照片初始化
|
||||||
|
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()}`
|
||||||
|
}
|
||||||
|
})) :
|
||||||
|
[];
|
||||||
|
|
||||||
|
// 生活照初始化
|
||||||
|
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()}`
|
||||||
|
}
|
||||||
|
})) :
|
||||||
|
[];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 头像上传
|
||||||
|
avatarAfterRead(event) {
|
||||||
|
const file = event.file[0] || event.file
|
||||||
|
this.uploadFile(file, 'avatar').then(res => {
|
||||||
|
this.avatarList = [{
|
||||||
|
url: `${this.imageUrl}/${res.data.url}`,
|
||||||
|
fileName: res.data.url
|
||||||
|
}]
|
||||||
|
this.userDetails.avatar = res.data.url
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 头像删除
|
||||||
|
avatarDelete() {
|
||||||
|
this.avatarList = []
|
||||||
|
this.userDetails.avatar = ''
|
||||||
|
},
|
||||||
|
|
||||||
|
// 身份证照片上传
|
||||||
|
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'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.all(
|
||||||
|
files.map(file =>
|
||||||
|
this.uploadFile(file, 'idCard').then(res => ({
|
||||||
|
url: `${this.imageUrl}/${res.data.url}`,
|
||||||
|
fileName: res.data.url
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
).then(newFiles => {
|
||||||
|
this.idCardfileList = [...this.idCardfileList, ...newFiles];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 身份证照片删除
|
||||||
|
idCardDelete(event) {
|
||||||
|
this.idCardfileList.splice(event.index, 1)
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
// 生活照上传
|
||||||
|
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'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.all(files.map(file =>
|
||||||
|
this.uploadFile(file, 'lifePhoto').then(res => ({
|
||||||
|
url: `${this.imageUrl}/${res.data.url}`,
|
||||||
|
fileName: res.data.url
|
||||||
|
}))
|
||||||
|
)).then(newFiles => {
|
||||||
|
this.lifePhotoFileList = [...this.lifePhotoFileList, ...newFiles]
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 生活照删除
|
||||||
|
lifePhotoDelete(event) {
|
||||||
|
this.lifePhotoFileList.splice(event.index, 1)
|
||||||
|
},
|
||||||
|
|
||||||
|
// 上传
|
||||||
|
uploadFile(file, type) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
upload({
|
||||||
|
url: '/app-api/small-upload/common/upload',
|
||||||
|
filePath: file.url || file.path,
|
||||||
|
name: 'file',
|
||||||
|
formData: {
|
||||||
|
type
|
||||||
|
}
|
||||||
|
}).then(resolve).catch(reject)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
getUserOrder() {
|
||||||
|
request({
|
||||||
|
url: '/app-api/small/drive/school-course-order/getCourseByLoginUser',
|
||||||
|
method: 'GET',
|
||||||
|
}).then(res => {
|
||||||
|
if (res.data === null) {
|
||||||
|
// this.insertSchoolStudent()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
insertSchoolStudent() {
|
||||||
|
request({
|
||||||
|
url: '/app-api/small/dl-drive-school-student/create',
|
||||||
|
method: 'POST',
|
||||||
|
data: this.userDetails
|
||||||
|
})
|
||||||
|
this.updateSysUsersNickName()
|
||||||
|
},
|
||||||
|
updateSysUsersNickName(name, userId, avatar) {
|
||||||
|
request({
|
||||||
|
url: '/app-api/system/user/update',
|
||||||
|
method: 'PUT',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
nickname: name,
|
||||||
|
id: userId,
|
||||||
|
avatar: avatar,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
calculateScrollHeight() {
|
||||||
|
// 获取屏幕高度
|
||||||
|
const screenHeight = uni.getSystemInfoSync().windowHeight;
|
||||||
|
// 获取顶部区域高度
|
||||||
|
const topHeight = 145;
|
||||||
|
// 计算滚动区域高度
|
||||||
|
this.scrollHeight = screenHeight - topHeight;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
handleSave() {
|
||||||
|
if (!this.noN) {
|
||||||
|
const submitData = {
|
||||||
|
...this.userDetails,
|
||||||
|
avatar: this.avatarList[0]?.fileName || '',
|
||||||
|
idPhoto: this.idCardfileList.map(item => item.fileName).join(','),
|
||||||
|
lifePhoto: this.lifePhotoFileList.map(item => item.fileName).join(',')
|
||||||
|
}
|
||||||
|
this.updateSysUsersNickName(submitData.name, submitData.userId, submitData.avatar)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 准备提交数据(只使用fileName)
|
||||||
|
const submitData = {
|
||||||
|
...this.userDetails,
|
||||||
|
avatar: this.avatarList[0]?.fileName || '',
|
||||||
|
idPhoto: this.idCardfileList.map(item => item.fileName).join(','),
|
||||||
|
lifePhoto: this.lifePhotoFileList.map(item => item.fileName).join(',')
|
||||||
|
}
|
||||||
|
this.updateSysUsersNickName(submitData.name, submitData.userId, submitData.avatar)
|
||||||
|
|
||||||
|
request({
|
||||||
|
url: '/app-api/small/dl-drive-school-student/update',
|
||||||
|
method: 'PUT',
|
||||||
|
data: submitData
|
||||||
|
}).then(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '保存成功',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
setTimeout(() => uni.navigateBack(), 1500)
|
||||||
|
}).catch(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '保存失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
insertSchoolStudent() {
|
|
||||||
request({
|
|
||||||
url: '/app-api/small/dl-drive-school-student/create',
|
|
||||||
method: 'POST',
|
|
||||||
data: this.userDetails
|
|
||||||
})
|
|
||||||
this.updateSysUsersNickName()
|
|
||||||
},
|
|
||||||
updateSysUsersNickName(name, userId,avatar) {
|
|
||||||
request({
|
|
||||||
url: '/app-api/system/user/update',
|
|
||||||
method: 'PUT',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
nickname: name,
|
|
||||||
id: userId,
|
|
||||||
avatar: avatar,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
calculateScrollHeight() {
|
|
||||||
// 获取屏幕高度
|
|
||||||
const screenHeight = uni.getSystemInfoSync().windowHeight;
|
|
||||||
// 获取顶部区域高度
|
|
||||||
const topHeight = 145;
|
|
||||||
// 计算滚动区域高度
|
|
||||||
this.scrollHeight = screenHeight - topHeight;
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
handleSave() {
|
|
||||||
if(!this.noN){
|
|
||||||
const submitData = {
|
|
||||||
...this.userDetails,
|
|
||||||
avatar: this.avatarList[0]?.fileName || '',
|
|
||||||
idPhoto: this.idCardfileList.map(item => item.fileName).join(','),
|
|
||||||
lifePhoto: this.lifePhotoFileList.map(item => item.fileName).join(',')
|
|
||||||
}
|
|
||||||
this.updateSysUsersNickName(submitData.name, submitData.userId, submitData.avatar)
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
// 准备提交数据(只使用fileName)
|
};
|
||||||
const submitData = {
|
|
||||||
...this.userDetails,
|
|
||||||
avatar: this.avatarList[0]?.fileName || '',
|
|
||||||
idPhoto: this.idCardfileList.map(item => item.fileName).join(','),
|
|
||||||
lifePhoto: this.lifePhotoFileList.map(item => item.fileName).join(',')
|
|
||||||
}
|
|
||||||
this.updateSysUsersNickName(submitData.name, submitData.userId, submitData.avatar)
|
|
||||||
|
|
||||||
request({
|
|
||||||
url: '/app-api/small/dl-drive-school-student/update',
|
|
||||||
method: 'PUT',
|
|
||||||
data: submitData
|
|
||||||
}).then(() => {
|
|
||||||
uni.showToast({ title: '保存成功', icon: 'success' })
|
|
||||||
setTimeout(() => uni.navigateBack(), 1500)
|
|
||||||
}).catch(() => {
|
|
||||||
uni.showToast({ title: '保存失败', icon: 'none' })
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
<style lang='scss'>
|
<style lang='scss'>
|
||||||
@import '../common/common.scss';
|
@import '../common/common.scss';
|
||||||
@import './assets/style/index.rpx.scss';
|
@import './assets/style/index.rpx.scss';
|
||||||
</style>
|
</style>
|
BIN
static/imgs/mapBackground.png
Normal file
BIN
static/imgs/mapBackground.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 83 KiB |
Loading…
Reference in New Issue
Block a user