定位调整

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">
@ -86,8 +87,8 @@
<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="{'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>
@ -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 {
@ -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') {
@ -477,7 +482,15 @@
getmap() {
let that = this
console.log('选择位置')
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);
@ -519,12 +532,23 @@
console.log(res, 'cpmplete')
}
});
}
});
},
getmap1() {
let that = this
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);
@ -537,20 +561,23 @@
var address = res.address;
var reg = /.+?(省|市|自治区|自治州|县|区)/g;
let addressList = address.match(reg).toString().split(",");
if (addressList[0] == '重庆市' || addressList[0] == '北京市' || addressList[0] ==
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, '')
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, '')
that.four1 = address.replace(that.province, '').replace(that
.city, '')
.replace(that
.area, '');
};
@ -558,6 +585,9 @@
}
});
}
});
},
getback() {