This commit is contained in:
cansnow
2026-01-01 04:15:30 +08:00
parent 09c7889525
commit 78386d4cc1
75 changed files with 1995 additions and 1715 deletions
+46 -12
View File
@@ -1,16 +1,12 @@
<template>
<view class="map_page">
<u-navbar left-icon="arrow-left" @leftClick="back" placeholder bgColor="transparent">
<template slot="right">
<u-button type="primary" class="confirm_btn" size="mini" @click="confirm">确定</u-button>
</template>
</u-navbar>
<view style="display: flex; flex-direction: column; height: 100%;">
<!-- 使用web-view嵌入天地图 -->
<ly-map class="ly-map"
v-if="lng && lat"
@onUserEvent="onUserEvent"
ref="map"
:type="type"
:lonlat=[lng,lat]
:map-key="apikey" />
<view class="search_container" v-if="1==2">
@@ -24,10 +20,20 @@
</u-cell-group>
</view>
</view>
<view class="map_info" v-if="type == 'viewlocation'">
<view class="left">
<u-text wordWrap="anywhere" size="16" :text="address"></u-text>
</view>
<u-button @click="gotoMap" class="right">
<uni-icons size="36" color="#07c160" type="paperplane-filled"></uni-icons>
</u-button>
</view>
</view>
</template>
<script>
import util from "@/util/index.js"
export default {
data() {
return {
@@ -53,6 +59,7 @@
if(opt.address){
this.address = opt.address;
}
console.log(this.type)
this.init();
},
methods: {
@@ -72,10 +79,12 @@
})
}
},
gotoMap(){
util.toMapAPP(this.lng,this.lat,this.address);
},
onUserEvent(e) {
//console.log(e)
if(this.type=='chooselocation'){
if(e.type == "move"){
if(e.type == "move"){
if(this.type=='chooselocation'){
this.lng = e.lng;
this.lat = e.lat;
this.$refs.map.setMarkers([
@@ -84,10 +93,22 @@
lat: Number(e.lat)
}
]);
return ;
}
if(this.type=='viewlocation'){
return ;
}
return ;
}
if(this.type=='viewlocation'){
if(e.type=='back'){
uni.navigateBack();
return ;
}
if(e.type=='confirm'){
this.confirm();
return ;
}
//console.log(e)
},
/**
* 确定位置按钮点击
@@ -153,8 +174,21 @@
flex: 1;
width: 100%;
}
}
.confirm_btn{
padding: 30rpx 10rpx;
.map_info{
height: 100rpx;
padding: 50rpx 30rpx;
display: flex;
align-items: center;
justify-content: space-between;
.left{
flex:1;
}
.right{
width: 100rpx;
.u-button{
background-color: #ccc;
}
}
}
}
</style>