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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
| <template>
| <view class="registerUser">
| <map style="width:100%;height:85vh;" :latitude="latitude" :polyline="polyline" :longitude="longitude"
| :markers="markers"></map>
| </view>
| </template>
|
| <script>
| export default {
| data() {
| return {
| latitude: 40.013305,
| longitude: 118.685713,
| marker: [{
| id: 0,
| latitude: 40.013305, //纬度
| longitude: 118.685713, //经度
| iconPath: '', //显示的图标
| rotate: 0, // 旋转度数
| width: 20, //宽
| height: 20, //高
| title: '你在哪了', //标注点名
| alpha: 0.5, //透明度
| label: { //为标记点旁边增加标签 //因背景颜色H5不支持
| content: '唐山迁安', //文本
| color: 'red', //文本颜色
| // fontSize:24,//文字大小
| // x:5,//label的坐标,原点是 marker 对应的经纬度
| // y:1,//label的坐标,原点是 marker 对应的经纬度
| // borderWidth:12,//边框宽度
| // borderColor:'pink',//边框颜色
| // borderRadius:20,//边框圆角
| // bgColor:'black',//背景色
| // padding:5,//文本边缘留白
| // textAlign:'right'//文本对齐方式。
| },
| callout: { //自定义标记点上方的气泡窗口 点击有效
| content: '幸福花园店A组', //文本
| color: '#ffffff', //文字颜色
| fontSize: 14, //文本大小
| borderRadius: 2, //边框圆角
| bgColor: '#00c16f', //背景颜色
| display: 'ALWAYS', //常显
| },
| // anchor:{//经纬度在标注图标的锚点,默认底边中点
| // x:0, 原点为给出的经纬度
| // y:0,
| // }
|
| }],
| scale: 16,
| polyline: [{ //指定一系列坐标点,从数组第一项连线至最后一项
| points: [{
| latitude: 40.013305,
| longitude: 118.685713
| },
| {
| latitude: 40.013,
| longitude: 118.685
| },
| ],
| color: "#ff8033", //线的颜色
| width: 2, //线的宽度
| dottedLine: false, //是否虚线
| arrowLine: true, //带箭头的线 开发者工具暂不支持该属性
| }], //地图缩放程度
| }
| },
| methods: {
| // 播放标记点
| playMarkars() {
| if (this.polyline.length == 0) {
| uni.showModal({
| content: '当前时间范围内没有轨迹,无法播放!',
| })
| this.isPlay = false // 无
| this.playIndex = 0 // 第一个
| return
| }
| this.playIndex = Math.min(this.points.length - 1, this.playIndex)
| this.markers = [this.formatMarker(this.points[this.playIndex++], 'ALWAYS')]
| this.timer = setInterval(_ => {
| var i = this.playIndex++
| this.nextAdaress(i);
| if (i >= this.points.length) {
| clearInterval(this.timer)
| this.isPlay = false
| this.playIndex = 0
| this.initMarkers()
| return
| }
| this.markers = [this.formatMarker(this.points[i], 'ALWAYS')]
| }, 1000)
| },
|
| formatMarker(point, display = "BYCLICK") {
| let content = [
| "时间:" + parseTime(point.create_time),
| "运动状态:" + (point.sport == 1 ? '运动' : '静止'),
| "地址:" + point.address || ''
| ]
| return {
| id: point.id,
| iconPath: '/static/dada.png',
| width: 35,
| height: 35,
| latitude: point.latitude,
| longitude: point.longitude,
| callout: {
| display: display,
| padding: 10,
| borderRadius: 5,
| content: content.join("\n")
| }
| }
| },
| nextAdaress(index) {
| const len = 10;
| if (this.isGetAddress) {
| return
| }
| for (let i = 0; i < len; i++) {
| if (!this.points[i + index]) {
| break
| }
| if (this.points[i + index].address === undefined) {
| this.isGetAddress = true
| this.getAddress(i + index, len * 2, _ => {
| this.isGetAddress = false
| });
| break
| }
| }
| },
|
| },
| onReady() {},
| watch: {
|
|
| }
| };
| </script>
| </script>
|
| <style lang="scss" scoped>
| .login-map-bc {
| position: fixed;
| top: 0;
| left: 0;
| width: 100%;
| height: 100%;
| z-index: 111;
| background: rgba(0, 0, 0, .3);
| }
|
| .login-map-content {
| position: fixed;
| bottom: 0;
| left: 0;
| width: 100%;
| height: 100%;
| z-index: 222;
| border-radius: 15px 15px 0 0;
| overflow: hidden;
|
| iframe {
| border: none;
| }
| }
|
| .login-map-close {
| position: absolute;
| top: 10px;
| right: 10px;
| width: 20px;
| height: 20px;
| z-index: 11;
| }
|
| .warp {
| display: flex;
| align-items: center;
| justify-content: center;
| height: 100%;
| }
|
| .rect {
| text-align: center;
| width: 120px;
| height: 120px;
| }
|
| .submit {
| margin: 30rpx 50rpx 50rpx;
| border: none;
| width: 572rpx;
| height: 86rpx;
| line-height: 86rpx;
| box-sizing: border-box;
| border-radius: 15rpx;
| background-color: #103289;
| color: #ffffff;
|
| &::after {
| content: none;
| }
|
| &::before {
| content: none;
| }
|
| &[disabled='true'] {
| background: #e4e4e4;
| font-size: 36rpx;
| font-family: Source Han Sans CN;
| font-weight: 500;
| color: #ffffff;
| }
| }
|
| .registerUser {
| padding: 0 1.2rem;
| }
|
| .agree {
| margin: 27rpx 95rpx 0;
| font-size: 22rpx;
| font-family: Adobe Heiti Std;
| font-weight: normal;
| color: #cacaca;
| line-height: 34rpx;
|
| .a {
| color: #000000;
| }
| }
| </style>
|
|