定位调整

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