<template>
	<view class="box">
		<view class="flex-b" @click="openMap">
			<view class="left_text">
				<view class="adr ">{{ info.schoolName}}</view>
				<view class="distance">{{ info.address }}</view>
			</view>
			<view class="mapEntry">
				<image src="@/static/images/icon/daohuang.png" mode=""></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: ['info'],
		methods: {
			openMap() {
				console.log('怎么回事？')
				// uni.getLocation({
				// 	type: 'wgs84',
				// 	success: function (res) {
				// 		const latitude = res.latitude;
				// 		const longitude = res.longitude;
				// 		console.log(res)
				// 		uni.openLocation({
				// 			latitude: latitude,
				// 			longitude: longitude,
				// 			success: function () {
				// 				console.log('success');
				// 			}
				// 		});
				// 	}
				// });
				 this.$store.dispatch('getCity')
				uni.getLocation({
					type: 'wgs84',
					success: function (res) {
						console.log('当前位置的经度：' + res.longitude);
						console.log('当前位置的纬度：' + res.latitude);
					},
					fail: function(err) {
						console.log(err)
					},
					complete: function(nono) {
						console.log('没有吗？')
						console.log(nono)
					}
				});


				// 121.045332, 31.19884
				uni.openLocation({
					latitude: 30.356038,
					longitude: 120.210342,
					success: function () {
						console.log('success');
					}
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.box {
		padding: 24rpx;
		border-radius: 20rpx;
		background: #fff;
	  .flex-b {
		  align-items: center;
	    .left_text {
			flex: 1;
	      .adr {
			font-size: 28rpx;
			color: #333333;
			font-weight: 500;
	      }
		
	      .distance {
			margin-top: 18rpx;
			color: #999;
			font-size: 24rpx;
	      }
	    }
		
	    .mapEntry {
			width: 55rpx;
			height: 55rpx;
	    }
	  }
	}
</style>