Blame view

pages/minorlocate/minorlocate.vue 2.15 KB
1f3f2378   起风了   我的第一次
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
  <template>

  	<view class="page">

  		<pyh-nv ref="nv" :config="nvConfig"></pyh-nv>

  		<view class="listBox" :style="{'padding-top':(pageTop+'px')}">

  		<view class="content">

  		<view class="map" style="width: 100%;height: 100%;">

  			<map :min-scale="9"  id="customMap" :scale="15" :style="'width: 100%;'+ 'height:'+screenHeight"  :markers="markers" layer-style="1" subkey="PTOBZ-QDQEG-DK3QM-QMYWN-I5WDZ-CCB6S"

  				:latitude="address.latitude" :longitude="address.longitude">

  			</map>

  		</view>

  		

  		</view>

  		</view>

  	</view>

  </template>

  

  <script>

  	export default {

  		data() {

  			return {

  				nvConfig:{

  					title:"儿童定位",

  					bgColor:"#ffffff",

  					color:"#000000",

  					fixedAssist:{

  						hide:true,

  					},

  				},

  				query:{

  					phone: '',

  					userId: ''

  				},

  				childData: [],

  				address: {

  					// 纬度

  					latitude: '',

  					// 经度

  					longitude: ''

  				},

  				screenHeight:'',

  				markers:[],

  				

  				

  			}

  		},

  		onPageScroll(e) {this.$refs.nv.pageScroll(e)},

  		computed:{

  			pageTop(){return parseInt(88*uni.getSystemInfoSync().windowWidth/750) + uni.getSystemInfoSync().statusBarHeight}

  		},

  		onLoad() {

  			var that = this;

  			uni.getSystemInfo({

  				success: function(res) {

  					that.screenHeight = res.safeArea.height + 'px'

  				}

  			})

  			this.getChild();

  		},

  		onReady() {

  			uni.hideTabBar();

  		},

  		methods:{

  			getChild() {

  				this.query.phone = uni.getStorageSync("USERS_KEY").phonenumber;

  				console.log("userinfo",this.query.phone);

  				this.API.getChild(this.query).then(res => {

  					this.childData = res.data.chiStaySosEmergencyCallPos;

  					var index = this.childData[0].sendAddress.indexOf(",");

  					this.address.longitude = this.childData[0].sendAddress.substring(0, index);

  					this.address.latitude = this.childData[0].sendAddress.substring(index + 1, this.childData[0].sendAddress.length);

  					this.address.id = this.childData[0].id;

  					this.address.width = 20;

  					this.address.height = 20;

  					this.markers.push(this.address)

  					console.log(this.markers)

  				})

  			},

  		}

  	}

  </script>

  

  <style scoped lang="scss">

  	@import 'minorlocate.scss';

  </style>