定位调整

This commit is contained in:
ChuShiZ 2024-09-29 19:39:08 +08:00
parent 8d84ef8a5f
commit a51c86649b

View File

@ -32,7 +32,7 @@
<view @click="getmap1()" style="width: 100%; overflow: hidden; ">
<view class="text1" v-show="four1 == ''">请选择终点地址</view>
<view class="text1" v-show="four1 != ''">{{province1}}{{city1}}{{area1}}</view>
<view class="hong1" v-show="four1 == ''">*必填请填写详细地址</view>
<!--<view class="hong1" v-show="four1 == ''">*必填请填写详细地址</view>-->
<view class="hong2" v-show="four1 != ''">
<input type="text" :placeholder="four1">
</view>
@ -43,7 +43,8 @@
</view> -->
</view>
</view>
<image v-if="rescueType == 1" class="start-end" src="@/static/icons/initiate/qiehuan.png" mode="aspectFit">
<image v-if="rescueType == 1" class="start-end" src="@/static/icons/initiate/qiehuan.png"
mode="aspectFit">
</image>
</view>
<view style="color: #000;font-size: 34rpx;font-weight: bold;padding: 24rpx 0;">救援信息</view>
@ -56,7 +57,7 @@
</view>
</view>
<view class="jyxx-tinput">
<view class="text1"><text class="hong1">*</text> 联系人</view>
<view class="text1">联系人</view>
<view class="you">
<input type="text" placeholder-style="color: #929292;font-size:24rpx" placeholder="请输入联系人"
v-model="connectionName">
@ -70,7 +71,7 @@
</view>
</view>
<view class="jyxx-tinput">
<view class="text1"><text class="hong1">*</text> 车牌号</view>
<view class="text1">车牌号</view>
<view class="you">
<input type="text" placeholder-style="color: #929292;font-size:24rpx" placeholder="请输入车牌号"
v-model="licenseNum">
@ -83,15 +84,15 @@
</view>
</view>
</view>
<view class="xinput">
<view class="text1"> <text class="hong1">*</text> 路段选择</view>
<view class="xz" style="flex-wrap: wrap;row-gap: 20rpx">
<view :class="{'xlan': seletedRoad.includes(item.id)}" class="kuang" v-for="(item,index) in roadOptions" :key="index"
@click="chooseRoad(index,item.id)">
<view class="">{{item.label}}</view>
</view>
</view>
</view>
<view class="xinput">
<view class="text1"> <text class="hong1">*</text> 路段选择</view>
<view class="xz" style="flex-wrap: wrap;row-gap: 20rpx">
<view :class="{'xlan': seletedRoad.includes(item.id)}" class="kuang"
v-for="(item,index) in roadOptions" :key="index" @click="chooseRoad(index,item.id)">
<view class="">{{item.label}}</view>
</view>
</view>
</view>
<view class="xinput">
<view class="text1"> <text class="hong1">*</text> 车辆类型</view>
<view class="xz">
@ -116,7 +117,8 @@
<view class="you">
<!-- <input type="text" placeholder="请输入现场图片"> -->
<!-- 上传图片 -->
<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple :maxCount="10">
<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
:maxCount="10">
<view style="display: flex;align-items: center;justify-content: center;height: 100%;">
<text style="color: #929292;font-size: 24rpx">上传图片</text>
</view>
@ -143,7 +145,8 @@
<u-picker :show="shows" :columns="columns" @confirm="confirmm" @cancel="cancelm" keyName="label"></u-picker>
</view>
<view class="">
<u-picker :show="roadVisible" :columns="roadOptions" @confirm="roadConfirm" @cancel="roadCancel" keyName="dictValue"></u-picker>
<u-picker :show="roadVisible" :columns="roadOptions" @confirm="roadConfirm" @cancel="roadCancel"
keyName="dictValue"></u-picker>
</view>
<tabBar msg="1"></tabBar>
</view>
@ -155,7 +158,10 @@
import request from '../../utils/request'
import config from '@/config'
import upload from '@/utils/upload.js'
import {getTenantId, hasRole} from "@/utils/auth";
import {
getTenantId,
hasRole
} from "@/utils/auth";
export default {
data() {
return {
@ -217,7 +223,7 @@
],
title: '救援',
roadOptions: [],
seletedRoad: [],
seletedRoad: [],
roadVisible: false
}
},
@ -313,7 +319,7 @@
this.shows = false
},
roadConfirm(e) {
console.log('e: ',e);
console.log('e: ', e);
this.roadVisible = false
},
roadCancel() {
@ -340,8 +346,7 @@
},
postadd() {
this.rescueSceneImage = this.imageList.join(",")
if (typeof this.rescueTime === "number") {
} else {
if (typeof this.rescueTime === "number") {} else {
this.rescueTime = ''
}
if (this.isAppointment == 'undefined') {
@ -369,21 +374,21 @@
// })
// return
// }
// if (!this.licenseNum) {
// uni.showToast({
// title: '',
// icon: 'none'
// })
// return
// }
// if (this.seletedRoad.length === 0) {
// uni.showToast({
// title: '',
// icon: 'none'
// })
// return
// }
console.log('this.seletedRoad: ',this.seletedRoad);
// if (!this.licenseNum) {
// uni.showToast({
// title: '',
// icon: 'none'
// })
// return
// }
// if (this.seletedRoad.length === 0) {
// uni.showToast({
// title: '',
// icon: 'none'
// })
// return
// }
console.log('this.seletedRoad: ', this.seletedRoad);
let data = {
rescueLongitude: this.rescueLongitude,
@ -395,7 +400,7 @@
rescuePosition: this.rescuePosition,
destinationInfo: this.destinationInfo,
licenseNum: this.licenseNum,
roadIds: this.seletedRoad,
roadIds: this.seletedRoad,
isAppointment: this.isAppointment,
rescueTime: this.rescueTime,
rescueDetail: this.rescueDetail,
@ -461,9 +466,9 @@
url: '/common/upload',
filePath: res.tempFilePath,
}).then((res) => {
console.log('res.fileName', res.data.url)
console.log('res.fileName', res.data.url)
this.imageList.push(this.$baseImageUrl + res.data.url)
console.log('this.imageList', this.imageList)
console.log('this.imageList', this.imageList)
console.log(res);
})
@ -477,88 +482,113 @@
getmap() {
let that = this
console.log('选择位置')
uni.chooseLocation({
success: function(res) {
console.log(res)
console.log('位置名称:' + res.name);
console.log('详细地址:' + res.address);
console.log('纬度:' + res.latitude);
console.log('经度:' + res.longitude);
that.rescueLongitude = res.longitude
that.rescueLatitude = res.latitude
that.rescuePosition = res.address
var address = res.address;
var reg = /.+?(省|市|自治区|自治州|县|区)/g;
let addressList = address.match(reg).toString().split(",");
if (addressList[0] == '重庆市' || addressList[0] == '北京市' || addressList[0] == '天津市' ||
addressList[0] == '上海市') {
that.province = addressList[0];
that.city = '市辖区';
that.area = addressList[1];
that.four = address.replace(that.province, '').replace(that.city, '').replace(that
.area, '');
} else {
that.province = addressList[0];
that.city = addressList[1];
that.area = addressList[2];
that.four = address.replace(that.province, '').replace(that.city, '').replace(that
.area, '');
};
console.log(that.four.indexOf(res.name));
if (that.four.indexOf(res.name) < 0) {
that.four = that.four + res.name
that.rescuePosition = that.rescuePosition + res.name
}
},
fail: (err) => {
console.log(err, 'err')
},
complete(res) {
console.log(res, 'cpmplete')
uni.getLocation({
type: 'wgs84',
success: function(getres) {
console.log('当前位置的经度:' + getres.longitude);
console.log('当前位置的纬度:' + getres.latitude);
uni.chooseLocation({
latitude: getres.latitude,
longitude: getres.longitude,
success: function(res) {
console.log(res)
console.log('位置名称:' + res.name);
console.log('详细地址:' + res.address);
console.log('纬度:' + res.latitude);
console.log('经度:' + res.longitude);
that.rescueLongitude = res.longitude
that.rescueLatitude = res.latitude
that.rescuePosition = res.address
var address = res.address;
var reg = /.+?(省|市|自治区|自治州|县|区)/g;
let addressList = address.match(reg).toString().split(",");
if (addressList[0] == '重庆市' || addressList[0] == '北京市' || addressList[0] == '天津市' ||
addressList[0] == '上海市') {
that.province = addressList[0];
that.city = '市辖区';
that.area = addressList[1];
that.four = address.replace(that.province, '').replace(that.city, '').replace(that
.area, '');
} else {
that.province = addressList[0];
that.city = addressList[1];
that.area = addressList[2];
that.four = address.replace(that.province, '').replace(that.city, '').replace(that
.area, '');
};
console.log(that.four.indexOf(res.name));
if (that.four.indexOf(res.name) < 0) {
that.four = that.four + res.name
that.rescuePosition = that.rescuePosition + res.name
}
},
fail: (err) => {
console.log(err, 'err')
},
complete(res) {
console.log(res, 'cpmplete')
}
});
}
});
},
getmap1() {
let that = this
uni.chooseLocation({
success: function(res) {
console.log('位置名称:' + res.name);
console.log('详细地址:' + res.address);
console.log('纬度:' + res.latitude);
console.log('经度:' + res.longitude);
console.log(res)
that.destinationLongitude = res.longitude
that.destinationLatitude = res.latitude
that.destinationInfo = res.address
var address = res.address;
var reg = /.+?(省|市|自治区|自治州|县|区)/g;
let addressList = address.match(reg).toString().split(",");
if (addressList[0] == '重庆市' || addressList[0] == '北京市' || addressList[0] ==
'天津市' ||
addressList[0] == '上海市') {
that.province1 = addressList[0];
that.city1 = '市辖区';
that.area1 = addressList[1];
that.four1 = address.replace(that.province, '').replace(that.city, '')
.replace(that
.area, '');
} else {
that.province1 = addressList[0];
that.city1 = addressList[1];
that.area1 = addressList[2];
that.four1 = address.replace(that.province, '').replace(that.city, '')
.replace(that
.area, '');
};
console.log(that.four1);
uni.getLocation({
type: 'wgs84',
success: function(getres) {
console.log('当前位置的经度:' + getres.longitude);
console.log('当前位置的纬度:' + getres.latitude);
uni.chooseLocation({
latitude: getres.latitude,
longitude: getres.longitude,
success: function(res) {
console.log('位置名称:' + res.name);
console.log('详细地址:' + res.address);
console.log('纬度:' + res.latitude);
console.log('经度:' + res.longitude);
console.log(res)
that.destinationLongitude = res.longitude
that.destinationLatitude = res.latitude
that.destinationInfo = res.address
var address = res.address;
var reg = /.+?(省|市|自治区|自治州|县|区)/g;
let addressList = address.match(reg).toString().split(",");
if (addressList[0] == '重庆市' || addressList[0] == '北京市' ||
addressList[0] ==
'天津市' ||
addressList[0] == '上海市') {
that.province1 = addressList[0];
that.city1 = '市辖区';
that.area1 = addressList[1];
that.four1 = address.replace(that.province, '').replace(that
.city, '')
.replace(that
.area, '');
} else {
that.province1 = addressList[0];
that.city1 = addressList[1];
that.area1 = addressList[2];
that.four1 = address.replace(that.province, '').replace(that
.city, '')
.replace(that
.area, '');
};
console.log(that.four1);
}
});
}
});
},
getback() {
uni.navigateBack({
@ -573,19 +603,19 @@
this.feeType = id
this.maneizhi = index
},
/**
* 路段选择事件
* @param index
* @param id
*/
chooseRoad(index, id) {
if (this.seletedRoad.includes(id)) {
const findIndex = this.seletedRoad.indexOf(id)
this.seletedRoad.splice(findIndex, 1)
} else {
this.seletedRoad.push(id)
}
}
/**
* 路段选择事件
* @param index
* @param id
*/
chooseRoad(index, id) {
if (this.seletedRoad.includes(id)) {
const findIndex = this.seletedRoad.indexOf(id)
this.seletedRoad.splice(findIndex, 1)
} else {
this.seletedRoad.push(id)
}
}
}
@ -779,4 +809,4 @@
background: #327DFB;
border-radius: 12rpx;
}
</style>
</style>