flat: 地图对接

This commit is contained in:
Apcallover
2024-05-15 16:16:35 +08:00
parent 0adca5ebc7
commit 20bcc1cbce
17 changed files with 4192 additions and 1113 deletions

View File

@@ -10,8 +10,12 @@
</view>
</view>
<view class="view-map">
<map style="width: 100%;height: 100%;" scale="16" :latitude="latitude" :longitude="longitude"
:markers="covers" @markertap="clickmark" @regionchange="show = false"></map>
<super-map ref="uMap" style="width: 100%;height: 100%;" :latitude="latitude" :longitude="longitude"
:zoom="14" :min-zoom="10" :max-zoom="20" @markertap="clickmark" @regionchange="show = false"
:MapUrl="$config.supperMap" :flag-tip="false"></super-map>
<!-- <view id="map" ></view> -->
<!-- <map style="width: 100%;height: 100%;" scale="16" :latitude="latitude" :longitude="longitude"
:markers="covers" @markertap="clickmark" @regionchange="show = false"></map> -->
<view class="position-bottom" v-if="show">
<view class="uni-margin-wrap">
<swiper class="swiper" circular :interval="2000" :duration="500">
@@ -68,7 +72,6 @@
covers: [],
rateValue: 2,
productInfo: {},
};
},
computed: {
@@ -87,7 +90,7 @@
return '无'
}
},
onShow() {
mounted() {
const _this = this
uni.getLocation({
type: 'gcj02',
@@ -96,13 +99,10 @@
longitude,
latitude
} = res
// _this.$api.msg('成功获得周边信息')
// console.log('成功获得周边信息', res)
_this.latitude = latitude
_this.longitude = longitude
// _this.$api.msg('获得周边信息')
_this.getList(longitude, latitude).then((covers) => {
_this.covers = covers
_this.$refs.uMap.addFeature(covers)
})
},
fail: function(err) {
@@ -110,12 +110,15 @@
},
complete: function(e) {}
})
},
onShow() {
// const _this = this
// this.mockGetLocation().then((myPoint) => {
// // this.latitude = myPoint.latitude
// // this.longitude = myPoint.longitude
// this.latitude = myPoint.latitude
// this.longitude = myPoint.longitude
// _this.getList(_this.longitude, _this.latitude).then((covers) => {
// _this.$api.msg('成功获得周边信息')
// _this.covers = covers
// _this.$refs.uMap.addFeature(covers)
// })
// })
},
@@ -139,20 +142,32 @@
}
},
search() {
this.getList(this.longitude, this.longitude).then((covers) => {
this.covers = covers
uni.getLocation({
type: 'gcj02',
success: function(res) {
const {
longitude,
latitude
} = res
_this.latitude = latitude
_this.longitude = longitude
_this.getList(longitude, latitude).then((covers) => {
_this.$refs.uMap.addFeature(covers)
})
},
fail: function(err) {
_this.$api.msg('无法获得周边信息')
},
complete: function(e) {}
})
// this.getList(this.longitude, this.longitude).then((covers) => {
// this.covers = covers
// })
},
clickmark(e) {
if (e.detail.markerId === 1) return
clickmark(cover) {
if (cover.markerId === 1) return
this.show = true;
for (var i = 0; i < this.covers.length; i++) {
//遍历集合找出对应的maekerid的数据
if (this.covers[i].id == e.detail.markerId) {
this.productInfo = this.covers[i].info
break;
}
}
this.productInfo = cover.info
},
mockGetLocation() {
return new Promise((resolve) => {
@@ -178,59 +193,6 @@
distanceRange: 20,
taskTitle: this.searchValue
}
// let json = [{
// "id": "1783015444661387266",
// "createUser": "242452735",
// "createDept": "171612561",
// "createTime": "2024-04-24 14:09:43",
// "updateUser": "242452735",
// "updateTime": "2024-04-24 14:09:43",
// "status": 1,
// "isDeleted": 0,
// "missionTitle": "维修人员",
// "skillNames": "市场/品牌推广",
// "companyIndustry": "家政",
// "tradeId": "1754327500065390599",
// "tradeNames": "制造业",
// "wage": "3",
// "wageUnitCategory": 2,
// "lat": 31.131007394902717,
// "lon": 104.40944639490272,
// "type": "post",
// "address": "广告法规定发给对方的反感",
// "cityId": "北京-北京市-东城区 ",
// "missionDesc": "范德萨发大水发发的发的发的方法是否是对方感受感受地方噶 好好放个假非户籍",
// "stime": "2024-04-25 00:00:00",
// "etime": "2024-04-26 00:00:00",
// "etimePub": "",
// "education": 7,
// "experienceDesc": "不限经验",
// "callName": "叶婷婷",
// "callTel": "15196372910"
// }]
// const arr = json.map((item) => ({
// id: item.id,
// longitude: item.lon,
// latitude: item.lat,
// iconPath: item.type === 'post' ? gwpoint : taskpoint,
// width: 20,
// height: 20,
// callout: {
// content: item.missionTitle,
// fontSize: 10,
// borderColor: 'blue',
// },
// info: item
// }))
// arr.push({
// id: 1,
// latitude: lat,
// longitude: lon,
// iconPath: mypoint,
// width: 20,
// height: 20
// })
// resolve(arr)
let resData = await geQueryJobsByNearby(params)
if (resData.data.code === 200) {
const arr = resData.data.data.map((item) => ({
@@ -240,6 +202,7 @@
iconPath: item.type === 'post' ? gwpoint : taskpoint,
width: 20,
height: 20,
title: item.missionTitle,
callout: {
content: item.missionTitle,
fontSize: 10,
@@ -252,6 +215,7 @@
latitude: lat,
longitude: lon,
iconPath: mypoint,
title: '我的位置',
width: 20,
height: 20
})
@@ -377,6 +341,8 @@
top: 0;
right: 0;
bottom: 0;
display: flex;
flex-direction: column;
.app-top {
display: flex;
@@ -427,8 +393,7 @@
}
.view-map {
height: 100%;
width: 100%;
flex: 1;
}
}
</style>