<template>
	<view class="mapbox">
		<map class="map" scale="3" :markers="covers" :enable-zoom="true">
		</map>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				covers:[]
			}
		},
		methods: {
			async getweizhi(id) {
				const res = await this.$myRequest({
					url: '/api/api_gateway?method=device.device_sms_alert.user_device_map_location',
					data: {
						device_ids:id
					}
				})
				console.log(res)
				this.covers = []
				var obj = {
					latitude:Number(res[0].lat),
					longitude:Number(res[0].lng),
					iconPath:"https://webstaticimg.oss-cn-hangzhou.aliyuncs.com/bigdata_app/image/distribution/"+res[0].device_type_id+".png"
				}
				this.covers.push(obj)
			},
		},
		onLoad(data) {
			// console.log(data.device_id)
			this.getweizhi(data.device_id)
			
		}
	}
</script>

<style lang="less">
.mapbox{
	width: 100%;
	height: 100vh;
	.map{
		width: 100%;
		height: 100vh;
	}
}
</style>
