소스 검색

添加位置页面

wangchao 3 년 전
부모
커밋
eb36ad5922
3개의 변경된 파일100개의 추가작업 그리고 8개의 파일을 삭제
  1. 9 0
      pages.json
  2. 2 8
      pages/grain_pulse/distribution/distribution.vue
  3. 89 0
      pages/grain_pulse/localtion/localtion.vue

+ 9 - 0
pages.json

@@ -510,6 +510,15 @@
             }
             
         }
+        ,{
+            "path" : "pages/grain_pulse/localtion/localtion",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "位置",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"subpackages": [{
 			"root": "pageA",

+ 2 - 8
pages/grain_pulse/distribution/distribution.vue

@@ -9,14 +9,8 @@
 				<view @click="selectType" class="header-type Regular">{{typeStr}}</view>
 				<u-icon :style="{transform:(showType?'rotate(180deg)':'')}" name="arrow-down-fill" size="8" color="#AFB3BF" class="icon"></u-icon>
 			</view>
-			<u-popup v-model="showType" mode="top">
-			 <view class="">全部类型</view>
-			<view>
-				123123
-			</view>
-			</u-popup>
-	<!-- 		<u-picker mode="selector" v-model="showType" @confirm='typeConfirm' confirm-color='#22C572'
-				:range="typeList" range-key="name" :default-selector="[0]"></u-picker> -->
+			<u-picker mode="selector" v-model="showType" @confirm='typeConfirm' confirm-color='#22C572'
+				:range="typeList" range-key="name" :default-selector="[0]"></u-picker>
 		</view>
 		<view class="uni-common-mt">
 			<view class="content">

+ 89 - 0
pages/grain_pulse/localtion/localtion.vue

@@ -0,0 +1,89 @@
+<template>
+	<view class="container">
+		<view class="content">
+			<map class="map" @markertap="markertap" :latitude="nowLocation.latitude" :longitude="nowLocation.longitude" :markers="covers">
+			</map>
+		</view>
+<!-- 		<view class="bottom">
+			<view class="title">
+				{{dataList.title}}
+			</view>
+			<view class="bottom-content">
+				{{dataList.content}}
+			</view>
+			<view>
+					<u-icon name="map" size="36" class="icon"></u-icon>
+					<view>{{dataList.localtion}}</view>
+					<view>{{dataList.rice}}</view>
+			</view>
+		</view> -->
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				dataList:{
+					title:'中天昊元粮库中天昊元粮库',
+					content:'我是企业介绍我是企业介绍我是企业介绍我是企业介绍我是企业介绍…',
+					localtion:"辽宁省营口市鲅鱼圈区熊岳镇火车站…",
+					rice:'500m'
+					
+				},
+				nowLocation: {
+					longitude: '',
+					latitude: ''
+				},
+				title: 'map',
+				latitude: 39.909,
+				longitude: 116.39742,
+				covers: [{
+					id: 0,
+					latitude: 39.9085,
+					longitude: 116.39747,
+					iconPath: '../../../static/img/location.png',
+				}]
+			}
+		},
+		onLoad() {
+				this.getLocation()
+		},
+		methods: {
+			getLocation() {
+				let that = this;
+				uni.getLocation({
+					type: 'gcj02',
+					geocode:true,
+					success: function(res) {
+						that.nowLocation.longitude = res.longitude
+						that.nowLocation.latitude = res.latitude
+						that.covers[0].longitude = res.longitude
+						that.covers[0].latitude = res.latitude
+						console.log('获取位置数据:',res);
+						console.log('当前位置的经度:' + res.longitude);
+						console.log('当前位置的纬度:' + res.latitude);
+						//拼接当前定位回显地址
+						// let _address = res.address
+						// this.address = _address
+					}
+				});
+			},
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.content{
+		width: 100vw;
+		height: 100vh;
+	}
+	.map {
+			width: 100%;
+			height: 100%;
+		}
+		.bottom{
+			width: 80%;
+			background: white;
+		}
+</style>