|
|
@@ -1,6 +1,7 @@
|
|
|
// import L from 'leaflet'
|
|
|
import config from '@/utils/map/sub/config'
|
|
|
import global from '@/utils/map/sub/global'
|
|
|
+import tools from '@/utils/tools'
|
|
|
import store from '@/store/index'
|
|
|
|
|
|
import {
|
|
|
@@ -45,7 +46,7 @@ export default {
|
|
|
if (flag != null) {
|
|
|
togglePlayerFlag = !flag
|
|
|
}
|
|
|
- // console.log("[togglePlayer]", togglePlayerFlag)
|
|
|
+ console.log("[togglePlayer]", togglePlayerFlag)
|
|
|
|
|
|
if (togglePlayerFlag) {
|
|
|
this.playerLayerGroup.removeFrom(global.map)
|
|
|
@@ -98,7 +99,12 @@ export default {
|
|
|
},
|
|
|
|
|
|
drawAllPlayers() {
|
|
|
- // console.log('[drawAllPlayers]', global.players)
|
|
|
+ if (global.players == null) {
|
|
|
+ console.log('[drawAllPlayers] 玩家列表为空')
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ console.log('[drawAllPlayers]', global.players)
|
|
|
+ }
|
|
|
// if (this.playerLayerGroup != null)
|
|
|
// this.playerLayerGroup.clearLayers()
|
|
|
|
|
|
@@ -123,7 +129,7 @@ export default {
|
|
|
if (storePlayer == null || storePlayer.marker == null) {
|
|
|
// 在地图上创建 marker 并存储用户信息
|
|
|
var playerIcon = L.icon({
|
|
|
- iconUrl: 'static/image/marker-icon.png',
|
|
|
+ iconUrl: 'static/map/marker-icon.png',
|
|
|
iconSize: [20, 32.8],
|
|
|
iconAnchor: [10, 30]
|
|
|
});
|
|
|
@@ -223,20 +229,19 @@ export default {
|
|
|
return interval_creatCircleMarker
|
|
|
},
|
|
|
getPopupContent(player) {
|
|
|
- var popupContent = '<div style="line-height: 20px;">'
|
|
|
- popupContent += '<div>' + ' <span style="color: blue; font-weight: bold;" onClick="uni.makePhoneCall({phoneNumber: \'' + player
|
|
|
- .phone + '\'});">' + player.name + '</span>'
|
|
|
- if (player.nextcontrolpoint.sn != '') {
|
|
|
- popupContent += ' <span style="font-weight: bold;">=> ' + player.nextcontrolpoint.sn + '</span>'
|
|
|
- }
|
|
|
- popupContent += ' 百味豆 ' + player.syspoint + ' </div>'
|
|
|
- popupContent += '<div>打点 ' + player.effectivenum + '/' + player.totalcontrolnum +
|
|
|
- ' 距离 ' + player.distance + '米 配速 ' + formatTime(player.pace, false) + '</div>'
|
|
|
- popupContent += '<div>' + '心率 ' + player.lasthr + ' 平均 ' + player.avghr + ' 最大 ' + player.maxhr + '</div>'
|
|
|
- popupContent += '<div>Cal ' + Math.round(player.calorie / 1000) + ' Ck ' + player.ck +
|
|
|
- ' Ei ' + Math.round(player.ei * 100) / 100 + '</div>'
|
|
|
+ var popupContent = '<div style="line-height: 20px; text-wrap: nowrap;">'
|
|
|
+ popupContent += '<div><span style="color: #ff8d1a; font-weight: bold;" onClick="uni.makePhoneCall({phoneNumber: \''
|
|
|
+ + player.phone + '\'});">' + player.name + ' ( ' + player.phone + ' )' + '</span></div>'
|
|
|
+
|
|
|
+ // popupContent += ' <span style="font-weight: bold;">=> ' + player.nextControlPoint.sn + '</span>'
|
|
|
+ popupContent += '<div>百味豆:' + player.sysPoint + ' 下一点位:' + player.nextControlPoint.orderNO
|
|
|
+ + ' 打点进度:' + player.EffectiveNum + '/' + player.TotalControlNum + '</div>'
|
|
|
+ popupContent += '<div>距离:' + tools.fmtDistanctKm(player.distance) + 'km 配速:' + tools.convertSecondsToHMS(player.pace, 2) + '</div>'
|
|
|
+ popupContent += '<div>心率:' + player.lastHr + ' 平均:' + player.avgHr + ' 最大:' + player.maxHr + '</div>'
|
|
|
+ popupContent += '<div>Cal:' + Math.round(player.Calorie / 1000) + ' Ck:' + player.Ck
|
|
|
+ + ' Ei:' + Math.round(player.Ei * 100) / 100 + '</div>'
|
|
|
popupContent += '</div>'
|
|
|
-
|
|
|
+
|
|
|
return popupContent
|
|
|
},
|
|
|
drawOnePlayer(playerId, animate = true) {
|
|
|
@@ -244,18 +249,18 @@ export default {
|
|
|
var player = global.getPlayerById(playerId)
|
|
|
var player_position = global.getPlayerPositionById(playerId)
|
|
|
var storePlayer = global.getStorePlayersById(playerId)
|
|
|
- // console.log('[drawOnePlayer]', player, player_position)
|
|
|
+ console.log('[drawOnePlayer]', player, player_position)
|
|
|
|
|
|
if (player == null) {
|
|
|
console.warn('[drawOnePlayer] 玩家数据为空', player)
|
|
|
return
|
|
|
}
|
|
|
if (player_position == null) {
|
|
|
- // console.log('[drawOnePlayer] 玩家位置数据为空', player_position)
|
|
|
+ console.log('[drawOnePlayer] 玩家位置数据为空', player_position)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- var popupContent = this.getPopupContent(player)
|
|
|
+ // var popupContent = this.getPopupContent(player)
|
|
|
|
|
|
// 首次创建
|
|
|
if (storePlayer == null || storePlayer.marker == null) {
|
|
|
@@ -269,7 +274,7 @@ export default {
|
|
|
|
|
|
var marker = L.circleMarker([player_position.latitude, player_position.longitude], options)
|
|
|
.addTo(this.playerLayerGroup)
|
|
|
- .bindPopup(popupContent)
|
|
|
+ // .bindPopup(popupContent)
|
|
|
.bindTooltip(`${player.name}`, config.gStyle.marker.tooltip)
|
|
|
|
|
|
marker.type = 'circleMarker'
|
|
|
@@ -326,7 +331,7 @@ export default {
|
|
|
// console.log('[drawOnePlayer] 更新玩家的标记位置', storePlayer.marker, curPoint)
|
|
|
marker.setLatLng(curPoint)
|
|
|
marker.bringToFront()
|
|
|
- marker.setPopupContent(popupContent)
|
|
|
+ // marker.setPopupContent(popupContent)
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
@@ -370,11 +375,15 @@ export default {
|
|
|
options.color = config.gStyle.common.color
|
|
|
|
|
|
focusPlayer.marker.setStyle(options)
|
|
|
- focusPlayer.marker.openPopup()
|
|
|
+ // focusPlayer.marker.openPopup()
|
|
|
focusPlayer.marker.bringToFront()
|
|
|
}
|
|
|
},
|
|
|
drawAllTrails(duration) {
|
|
|
+ if (global.players == null) {
|
|
|
+ console.log('[drawAllTrails] 玩家列表为空')
|
|
|
+ return
|
|
|
+ }
|
|
|
// if (this.trailLayerGroup != null)
|
|
|
// this.trailLayerGroup.clearLayers()
|
|
|
|
|
|
@@ -387,19 +396,19 @@ export default {
|
|
|
var player = global.getPlayerById(playerId)
|
|
|
var player_position = global.getPlayerPositionById(playerId)
|
|
|
var storePlayer = global.getStorePlayersById(playerId)
|
|
|
- // console.log('[drawOneTrail] param', player, player_position, storePlayer)
|
|
|
+ console.log('[drawOneTrail] param', player, player_position, storePlayer)
|
|
|
|
|
|
if (player == null) {
|
|
|
console.warn('[drawOneTrail] 玩家数据为空', player)
|
|
|
return
|
|
|
}
|
|
|
if (player_position == null) {
|
|
|
- // console.log('[drawOneTrail] 玩家位置数据为空', player_position)
|
|
|
+ console.log('[drawOneTrail] 玩家位置数据为空', player_position)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
if (storePlayer == null || storePlayer.trail == null) {
|
|
|
- // console.warn('[drawOneTrail] 轨迹数据为空', player, storePlayer)
|
|
|
+ console.warn('[drawOneTrail] 轨迹数据为空', player, storePlayer)
|
|
|
|
|
|
var trail = null
|
|
|
var trail2 = null
|
|
|
@@ -499,7 +508,7 @@ export default {
|
|
|
storePlayer.marker.setLatLng(curPoint.slice(0, 2)) // 更新玩家的标记位置
|
|
|
storePlayer.marker.bringToFront()
|
|
|
var popupContent = that.getPopupContent(player)
|
|
|
- storePlayer.marker.setPopupContent(popupContent)
|
|
|
+ // storePlayer.marker.setPopupContent(popupContent)
|
|
|
}
|
|
|
}
|
|
|
// global.map.setView(point.slice(0, 2), 18); //地图中心跟踪最新位置
|