Commit 5e859902 by zhangxw

v1.7.0版本

1 parent 19f9bdf0
......@@ -160,4 +160,13 @@ export const GET_MONITOR_ONLINELIST = params => {
// 获取高德地图的省市区
export const GET_AMAP_PROVINCE = params => {
return request(params, 'https://restapi.amap.com/v3/config/district', 'get')
}
// 历史停留列表
export const GET_HISTORY_LOCATION = params => {
return request(params, '/trialdrive/monitor/stayPointList', 'get')
}
// 常驻地数据
export const GET_RESIDENT_LOCATION = params => {
return request(params, '/trialdrive/monitor/residentList', 'get')
}
\ No newline at end of file
......@@ -16,6 +16,9 @@
margin-left: 20px;
}
}
.map-controll.toleft{
left: 150px;
}
.map-bottom-controll {
position: absolute;
......@@ -34,7 +37,11 @@
font-size: 16px;
}
}
.map-bottom-controll.toleft{
left: 20px;
right: calc(100% - 55px);
bottom: 50px;
}
.controll-wrap {
position: absolute;
top: 40px;
......@@ -44,6 +51,15 @@
max-height: 716px;
}
.controll-warp-floright {
position: absolute;
top: 40px;
right: 20px;
z-index: 101;
width: 320px;
max-height: 716px;
}
.menu-search {
.el-select {
width: 100px;
......@@ -461,7 +477,7 @@
}
}
a.fence_btn_grey {
a.fence_btn_grey,a.history_btn_grey,a.resident_btn_grey {
border: 1px solid #d8d8d8;
color: #999;
background: #f2f2f2;
......
import moment from '@/common/moment';
// 轨迹回放
export const replayShortcuts = [
{
text: "近6小时",
onClick(picker) {
const start = moment().subtract(6, 'hours');
const end = moment();
picker.$emit("pick", [start, end]);
}
},
{
text: "近3天",
onClick(picker) {
const start = moment().subtract(3, 'days');
const end = moment();
picker.$emit("pick", [start, end]);
},
},
{
text: "近7天",
onClick(picker) {
const start = moment().subtract(7, 'days');
const end = moment();
picker.$emit("pick", [start, end]);
},
},
{
text: "近15天",
onClick(picker) {
const start = moment().subtract(15, 'days');
const end = moment();
picker.$emit("pick", [start, end]);
},
}
]
// 历史停留
export const historyShortcuts = [
{
text: "前7天",
onClick(picker) {
const end = moment().subtract(1, 'days');
const start = moment().subtract(7, 'days');
picker.$emit("pick", [start, end]);
}
},
{
text: "前15天",
onClick(picker) {
const end = moment().subtract(1, 'days');
const start = moment().subtract(15, 'days');
picker.$emit("pick", [start, end]);
},
},
{
text: "前30天",
onClick(picker) {
const end = moment().subtract(1, 'days');
const start = moment().subtract(30, 'days');
picker.$emit("pick", [start, end]);
},
}
]
import moment from 'moment';
// 设置moment的语言环境配置
moment.locale('zh-cn', {
week: {
dow: 1,
doy: 4
}
})
export default moment
\ No newline at end of file
<template>
<div>
<div :class="isNewWindowOpenPage ? 'full_wrap_layout' : ''">
<!-- <v-breadcrumb>
<slot name="breadcrumb"></slot>
</v-breadcrumb> -->
......@@ -12,9 +12,17 @@
// import vBreadcrumb from 'components/Breadcrumb.vue'
export default {
data () {
return {
isNewWindowOpenPage: false
}
},
components: {
// vBreadcrumb
},
created() {
if(window.opener) this.isNewWindowOpenPage = true
}
};
</script>
<style lang="scss">
......
<template>
<div>
<div class="map-controll">
<div :class="isTreeToright ? 'map-controll toleft' : 'map-controll'">
<el-button-group>
<el-button :type="isRuler?'primary':''" size="mini" @click="toggleRuler">测距</el-button>
<el-button :type="isMapType?'primary':''" size="mini" @click="toggleMap(true)">地图</el-button>
......@@ -8,7 +8,7 @@
</el-button-group>
<!-- <el-button v-show="isShowFullsize" size="mini" class="fullsize-btn" :type="isFullsize?'primary':''" @click="toggleSize">全屏</el-button> -->
</div>
<div class="map-bottom-controll">
<div :class="isTreeToright ? 'map-bottom-controll toleft' : 'map-bottom-controll'">
<ul>
<li class="ctrl-item" @click="zoomIn"><i class="fa fa-plus"></i></li>
<li class="ctrl-item" @click="zoomOut"><i class="fa fa-minus"></i></li>
......@@ -21,7 +21,7 @@
import store from '../../vuex/store.js'
import mapService from 'utils/mapService.js'
export default{
props: ['isShowFullsize'],
props: ['isShowFullsize', 'isTreeToright'],
data(){
return {
isMapType: true,
......
<template>
<v-full-layout class="full_wrap_layout">
<v-full-layout>
<template slot="breadcrumb">
<el-breadcrumb-item>电子围栏</el-breadcrumb-item>
</template>
......
......@@ -14,27 +14,23 @@
<el-form ref="form" :model="form" :rules="rules" :inline="false" size="mini" class="form">
<el-form-item label="查询范围" prop="dateRange">
<el-date-picker
style="width: 100%;"
v-model="form.dateRange"
type="daterange"
size="small"
:clearable="false"
:editable="false"
:unlink-panels="true"
:picker-options="{
disabledDate(time){
return time.getTime() > ((new Date()).getTime()-24*60*60*1000)
}
}"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
<div class="date-filter">
style="width: 100%;"
v-model="form.dateRange"
type="daterange"
size="small"
:clearable="false"
:editable="false"
:unlink-panels="true"
:picker-options="pickerOptions"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
<!-- <div class="date-filter">
<el-button size="mini" type="text" @click="pickDate(7)">前7天</el-button>
<el-button size="mini" type="text" @click="pickDate(15)">前15天</el-button>
<el-button size="mini" type="text" @click="pickDate(30)">前30天</el-button>
</div>
</div> -->
</el-form-item>
<el-form-item label="查询时段" prop="timerange">
<el-select v-model="form.timerange" placeholder="请选择" size="small" style="width: 280px">
......@@ -76,7 +72,7 @@
<el-button class="" size="mini" type="text" @click="sortByStay">停留时长<i class="fa fa-sort"></i></el-button>
</div>
<ul class="stay-list">
<li class="stay-list-item" v-for="item in resultList" @click="openMapInfoWindow(item.idx)">
<li class="stay-list-item" v-for="(item, index) in resultList" :key="index" @click="openMapInfoWindow(item.idx)">
<p class="addr">{{item.transferAddress}}</p>
<p class="datetime"><span>{{item.begintime}}</span><span class="pull-right">{{item.duration}}</span></p>
</li>
......@@ -109,6 +105,9 @@
const MONITOR_SERVICE = services.monitor;
import {exportExcel} from 'utils';
import MapControll from './MapControll.vue'
import AMapLoader from '@amap/amap-jsapi-loader'
import {historyShortcuts} from '@/common/index'
import {GET_HISTORY_LOCATION} from "@/api/services/monitor"
const BUSINESS_SERVICE = services.business;
export default{
......@@ -175,12 +174,26 @@
name: this.$route.query.name,
standno: this.$route.query.standno,
sortByTimeIsPositive: true,
sortByStayIsPositive: true
sortByStayIsPositive: true,
pickerOptions: {
disabledDate(time){
return time.getTime() > ((new Date()).getTime()-24*60*60*1000)
},
shortcuts: historyShortcuts
}
}
},
mounted(){
store.dispatch('setFullsize', true)
// store.dispatch('setFullsize', true)
let _this = this
AMapLoader.load({
key: CONSTANT.MAP_KEY,
version: '1.4.2',
plugins: CONSTANT.MAP_PLUGINS
}).then((AMap) => {
window.AMap = AMap
_this.initMap()
})
},
methods: {
initMap(){
......@@ -212,23 +225,48 @@
let params = {
sn: this.sn,
sTime: moment(this.form.dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss'),
eTime: moment(this.form.dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss'),
times: this.form.timerange,
startTime: moment(this.form.dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss'),
endTime: moment(this.form.dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss'),
times: this.form.timerange,
}
if(this.form.stayMax !== ''){
params.maxtime = this.form.stayMax;
params.maxTime = this.form.stayMax;
}
if(this.form.stayMin !== ''){
params.mintime = this.form.stayMin;
params.minTime = this.form.stayMin;
}
this.params = params
EventBus.$emit('uiMap.historyLocation.destroy');
MONITOR_SERVICE.getHistoryLocation(params).then((res)=>{
let res = mock.getResidentByRealTime
if (res.returnCode == 0) {
const data = res.data
if (data.length) {
data.forEach((item, idx) => {
item.idx = idx
})
this.resultList = data
EventBus.$emit('uiMap.historyLocation.draw', data)
this.resultBoxHidden = false
} else {
this.$message({
type: 'info',
message: '暂无数据'
})
}
this.isSearching = false
}
GET_HISTORY_LOCATION(params).then((res)=>{
if(res.returnCode == 0){
const data = res.data;
if(data.length){
data.forEach((item, idx)=>{
item.idx = idx;
item.name = item.ownerName
item.standno = item.workOrderNo
item.begintime = item.beginTime
item.endtime = item.endTime
});
this.resultList = data;
......@@ -314,16 +352,25 @@
this.resultList = [].concat(sortArr);
},
exportExcel(){
let arr = [];
this.resultList.forEach((item)=>{
item.address = item.transferAddress;
arr.push(item);
});
// let arr = [];
// this.resultList.forEach((item)=>{
// item.address = item.transferAddress;
// arr.push(item);
// });
exportExcel('track/exportVMData', {
vmExportType: 6,
jsonStr: encodeURI(JSON.stringify(arr))
}, 'post');
// exportExcel('track/exportVMData', {
// vmExportType: 6,
// jsonStr: encodeURI(JSON.stringify(arr))
// }, 'post');
if (this.resultList.length) {
exportExcel('/trialdrive/monitor/exportStayPoint', {...this.params}, 'get');
} else {
this.$message({
type: 'error',
message: '导出数据为空'
});
}
},
openMapInfoWindow(idx){
EventBus.$emit('uiMap.historyLocation.openInfoWindow', idx)
......@@ -344,16 +391,16 @@
}
},
async created () {
if(window.AMap){
this.initMap();
}else{
await remoteLoad(`${CONSTANT.AMAP_URL}`).then(()=>{
remoteLoad(`https://webapi.amap.com/ui/1.0/main.js?v=1.0.11`).then(()=>{
this.initMap();
})
})
// if(window.AMap){
// this.initMap();
// }else{
// await remoteLoad(`${CONSTANT.AMAP_URL}`).then(()=>{
// remoteLoad(`https://webapi.amap.com/ui/1.0/main.js?v=1.0.11`).then(()=>{
// this.initMap();
// })
// })
}
// }
EventBus.$on('uiMap.historyLocation.transferSuccess', (data)=>{
this.resultList = [].concat(data);
});
......
......@@ -6,8 +6,9 @@
<template slot="main">
<div class="map-wrap" v-loading="mapLoading">
<div id="map" class="map-container"></div>
<map-controll isShowFullsize="true"></map-controll>
<div class="controll-wrap">
<!-- v1.7.0版本 组织树右移 地图控件位置调整 isTreeToright-->
<map-controll isShowFullsize="true" isTreeToright="true"></map-controll>
<div class="controll-warp-floright">
<div class="menu-search">
<!-- <el-autocomplete
ref="autocomplete"
......@@ -19,8 +20,8 @@
:trigger-on-focus="false"
:placeholder="'请输入'+['6位以上设备号','6位以上车架号','2位以上姓名'][searchType-1]"
@select="handleSelect"> -->
<el-input placeholder="请输入对应条件值" v-model.trim="searchText" size="small" class="input-with-select" @keyup.enter.native='searchSubmit'>
<el-select v-model="searchType" slot="prepend" placeholder="请选择" size="small">
<el-input :placeholder="placeholderText" v-model.trim="searchText" size="small" class="input-with-select" @keyup.enter.native='searchSubmit'>
<el-select v-model="searchType" @change="selectChange" slot="prepend" placeholder="请选择" size="small">
<el-option label="设备号" value="1"></el-option>
<el-option label="车架号" value="2"></el-option>
<el-option label="姓名" value="3"></el-option>
......@@ -249,6 +250,7 @@ export default {
pageSizeList: {},
pageSize: 10,
loadingMore: false,
placeholderText: '请输入6位以上车架号'
};
},
computed: {
......@@ -326,7 +328,22 @@ export default {
this.isTreeChecked = checked;
//this.expandedKeys = [];
},
// 切换查询类型
selectChange(data) {
let tex = ''
switch(data) {
case '1':
tex = '请输入4位以上设备号'
break
case '2':
tex = '请输入6位以上车架号'
break
case '3':
tex = '请输入1位以上汉字'
break
}
this.placeholderText = tex
},
// 勾选树
handleCheck(data, node) {
let list = this.monitorList.itemArr;
......
<template>
<v-full-layout class="full_wrap_layout">
<v-full-layout>
<template slot="breadcrumb">
<el-breadcrumb-item>车辆监控</el-breadcrumb-item>
</template>
......@@ -13,17 +13,15 @@
<p class="info">{{name||'--'}}/{{standno||'--'}}/{{sn||'--'}}</p>
<el-form ref="form" :model="form" :rules="rules" :inline="false" size="mini" class="form">
<el-form-item label="查询范围" prop="daterange">
<el-date-picker class="pull-left" style="width: 100%;" v-model="form.dateRange" type="datetimerange" range-separator="至" start-placeholder="开始日期" format="yyyy-MM-dd HH:mm" :clearable="false" :editable="false" :picker-options="{
disabledDate(time){
return time.getTime() > (new Date()).getTime()
}
}" end-placeholder="结束日期">
<el-date-picker class="pull-left" style="width: 100%;" v-model="form.dateRange" type="datetimerange" range-separator="至" start-placeholder="开始日期" format="yyyy-MM-dd HH:mm" :clearable="false" :editable="false" :picker-options="pickerOptions" end-placeholder="结束日期">
</el-date-picker>
<div class="pull-left">
<el-button size="mini" type="text" @click="pickDate(-6)">近6小时</el-button>
<el-button size="mini" type="text" @click="pickDate(3)">近3天</el-button>
<el-button size="mini" type="text" @click="pickDate(90)">近90天</el-button>
<el-button size="mini" type="text" @click="pickDate(7)">近7天</el-button>
<el-button size="mini" type="text" @click="pickDate(15)">近15天</el-button>
<!-- <el-button size="mini" type="text" @click="pickDate(90)">近90天</el-button> -->
</div>
</el-form-item>
<el-form-item label="播放速度">
......@@ -98,6 +96,7 @@ import { exportExcel } from "utils";
import { CONSTANT } from "../../constant";
import InfiniteLoading from "vue-infinite-loading";
import MapControll from "./MapControll.vue";
import {replayShortcuts} from '@/common/index'
import { GET_ELECFENCE_INFO } from "@/api/services/fence";
export default {
......@@ -117,8 +116,8 @@ export default {
max = moment(max);
}
if (min.isBefore(moment(max).subtract(90, "days"), "minute")) {
cb(new Error("日期范围不能超过90天"));
if (min.isBefore(moment(max).subtract(30, "days"), "minute")) {
cb(new Error("日期范围不能超过30天"));
}
}
cb();
......@@ -194,6 +193,12 @@ export default {
sortByStayIsPositive: true,
isInitFence: this.$route.query.isInitFence === "1" ? true : false,
fenceId: this.$route.query.fenceId,
pickerOptions: {
disabledDate(time){
return time.getTime() > (new Date()).getTime()
},
shortcuts: replayShortcuts
}
};
},
mounted() {
......
......@@ -42,7 +42,7 @@
</div>
<ul class="stay-list">
<li class="stay-list-item" v-for="item in resultList" @click="openMapInfoWindow(item.idx)">
<li class="stay-list-item" v-for="(item, index) in resultList" :key="index" @click="openMapInfoWindow(item.idx)">
<p class="addr">{{item.transferAddress}}</p>
<p class="datetime">驻留次数:<span>{{item.totalTimes}}次</span> | 驻留时长:<span>{{item.totalDurationString}}</span></p>
</li>
......@@ -74,13 +74,15 @@
import InfiniteLoading from 'vue-infinite-loading';
import {exportExcel} from 'utils';
import MapControll from './MapControll.vue'
import AMapLoader from '@amap/amap-jsapi-loader'
import {GET_RESIDENT_LOCATION} from "@/api/services/monitor"
export default{
data(){
return {
sn: this.$route.query.sn,
name: this.$route.query.name,
standno: this.$route.query.standno,
locationType: this.$route.query.locationType,
AMap: null,
mapObj: null,
mapLoading: false,
......@@ -103,7 +105,16 @@
}
},
mounted(){
store.dispatch('setFullsize', true)
// store.dispatch('setFullsize', true)
let _this = this
AMapLoader.load({
key: CONSTANT.MAP_KEY,
version: '1.4.2',
plugins: CONSTANT.MAP_PLUGINS
}).then((AMap) => {
window.AMap = AMap
_this.initMap()
})
},
methods: {
......@@ -137,15 +148,38 @@
let params = {
sn: this.sn,
timeRange: this.form.daterange,
times: this.form.timerange,
locationType: this.locationType === 'bsLocation' ? 2 : this.locationType === 'gpsLocation' ? 1 : ''
// times: this.form.timerange,
}
MONITOR_SERVICE.getResidentByRealTime(params).then((res)=>{
this.params = params
let res = mock.getResidentByRealTime
if(res.returnCode == 0){
const data = res.data;
if(data.length){
data.forEach((item, idx)=>{
item.idx = idx;
});
this.resultList = data;
EventBus.$emit('uiMap.resident.draw', data);
this.resultBoxHidden = false;
}else{
this.$message({
type: 'info',
message: '暂无数据'
});
EventBus.$emit('uiMap.resident.destroy', data);
}
this.isSearching = false;
}
GET_RESIDENT_LOCATION(params).then((res)=>{
if(res.returnCode == 0){
const data = res.data;
if(data.length){
data.forEach((item, idx)=>{
item.idx = idx;
item.name = item.ownerName
item.standNo = item.workOrderNo
});
this.resultList = data;
EventBus.$emit('uiMap.resident.draw', data);
......@@ -217,42 +251,43 @@
exportExcel(){
if(this.exporting) return;
if(this.resultList.length){
let paramArr = [];
this.resultList.forEach((dataItem)=>{
let paramItem = {};
for(let key in dataItem){
switch(key){
case 'name':
case 'shopName':
case 'sn':
case 'sqbh':
case 'standNo':
case 'totalDurationString':
case 'transferAddress':
paramItem[key] = dataItem[key]?dataItem[key]:'';
break;
case 'totalTimes':
paramItem[key] = dataItem[key]?(dataItem[key]+'次'):'';
break;
/*case 'transferAddress':
paramItem.address = dataItem.transferAddress?dataItem.transferAddress:'';
break;*/
}
}
paramArr.push(paramItem);
});
// let paramArr = [];
// this.resultList.forEach((dataItem)=>{
// let paramItem = {};
// for(let key in dataItem){
// switch(key){
// case 'name':
// case 'shopName':
// case 'sn':
// case 'sqbh':
// case 'standNo':
// case 'totalDurationString':
// case 'transferAddress':
// paramItem[key] = dataItem[key]?dataItem[key]:'';
// break;
// case 'totalTimes':
// paramItem[key] = dataItem[key]?(dataItem[key]+'次'):'';
// break;
// /*case 'transferAddress':
// paramItem.address = dataItem.transferAddress?dataItem.transferAddress:'';
// break;*/
// }
// }
// paramArr.push(paramItem);
// });
exportExcel('track/exportVMData', {
jsonStr: encodeURI(JSON.stringify(paramArr)),
vmExportType: 4
}, 'post');
this.exporting = false;
}else{
this.$message({
type: 'error',
message: '导出数据为空'
});
}
// exportExcel('track/exportVMData', {
// jsonStr: encodeURI(JSON.stringify(paramArr)),
// vmExportType: 4
// }, 'post');
exportExcel('/trialdrive/monitor/exportResident', {...this.params}, 'get');
this.exporting = false;
}else{
this.$message({
type: 'error',
message: '导出数据为空'
});
}
},
openMapInfoWindow(idx){
EventBus.$emit('uiMap.resident.openInfoWindow', idx)
......@@ -273,16 +308,16 @@
}
},
async created () {
if(window.AMap){
this.initMap();
}else{
await remoteLoad(`${CONSTANT.AMAP_URL}`).then(()=>{
remoteLoad(`https://webapi.amap.com/ui/1.0/main.js?v=1.0.11`).then(()=>{
this.initMap();
})
})
// if(window.AMap){
// this.initMap();
// }else{
// await remoteLoad(`${CONSTANT.AMAP_URL}`).then(()=>{
// remoteLoad(`https://webapi.amap.com/ui/1.0/main.js?v=1.0.11`).then(()=>{
// this.initMap();
// })
// })
}
// }
EventBus.$on('uiMap.historyLocation.transferSuccess', (data)=>{
......
......@@ -392,20 +392,30 @@ MapService.prototype = {
}
// 通用参数
let queryCode = `sn=${info.sn}&name=${encodeURI(info.name)}&standno=${info.standNo}`;
// 跳转到历史停留页面
let queryCode = `sn=${info.sn}&name=${encodeURI(info.name)}&standno=${info.standNo}&locationType=${info.eLocateType}`;
// 跳转到历史停留页面 无线设备不能跳转历史停留 isSource:1有线,其他无线
let historyBtn = infoDiv.querySelector('[data-history]');
if (historyBtn) {
if (info.isSource != 1) {
historyBtn.classList.add('history_btn_grey');
}
historyBtn.onclick = function () {
mapService.openPage(`#/monitor/historyLocation?${queryCode}`)
if (info.isSource == 1) {
mapService.openPage(`#/monitor/historyLocation?${queryCode}`)
}
}
}
// 跳转到常住地
// 跳转到常住地 无线设备不能跳转常住地 isSource:1有线,其他无线
let residentBtn = infoDiv.querySelector('[data-resident]');
if (residentBtn) {
if (info.isSource != 1) {
residentBtn.classList.add('resident_btn_grey');
}
residentBtn.onclick = function () {
mapService.openPage(`#/monitor/resident?${queryCode}`)
if (info.isSource == 1) {
mapService.openPage(`#/monitor/resident?${queryCode}`)
}
}
}
......@@ -419,7 +429,6 @@ MapService.prototype = {
// 跳转到电子围栏页面 无线设备不能跳转电子围栏 isSource:1有线,其他无线
let fenceBtn = infoDiv.querySelector('[data-fence]');
if (fenceBtn) {
if (info.isSource != 1) {
fenceBtn.classList.add('fence_btn_grey');
......@@ -623,6 +632,8 @@ MapService.prototype = {
<p class="redirect-row">
<a class="redirect-btn" id="btn_replay" data-replay>轨迹回放</a>
<a class="redirect-btn" id="btn_fence" data-fence>电子围栏</a>
<a class="redirect-btn" id="btn_resident" data-resident>常驻地</a>
<a class="redirect-btn" id="btn_history" data-history>历史停留</a>
</p>
</div>`;
......
......@@ -80,7 +80,7 @@ const replay = {
}
});
replay.dis = AMap.GeometryUtil.distanceOfLine(replayData) / 1000 // 算出轨迹的距离(km)
replay.pathSimplifierIns.setData([{
path: replayData
}]);
......@@ -90,7 +90,7 @@ const replay = {
replay.navg = replay.pathSimplifierIns.createPathNavigator(0, //关联第1条轨迹
{
loop: false, //循环播放
speed: replay.getSpeed(replay.speed),
speed: replay.getSpeed(replay.speed, replay.dis),
pathNavigatorStyle: {
width: 36,
height: 22,
......@@ -222,7 +222,7 @@ const replay = {
//播放轨迹,速度改变
EventBus.$on('uiMap.replay.speedChange', function(data){
let speed = replay.getSpeed(data)
let speed = replay.getSpeed(data, replay.dis)
if(replay.navg){
replay.navg.setSpeed(speed)
......@@ -277,20 +277,24 @@ const replay = {
//mapService.setFitView(MAP);
},
getSpeed(idx){
getSpeed(idx, dis){ // 根据路径距离和回放时间 算出回放的speed
let speed;
switch(idx){
case 1:
speed = 2000;
// speed = 2000
speed = dis >= 100 ? Math.floor((dis / 30) * 3600) : dis > 10 && dis < 100 ? Math.floor((dis / 20) * 3600) : Math.floor((dis / 12) * 3600);
break;
case 2:
speed = 5000;
// speed = 5000;
speed = dis >= 100 ? Math.floor((dis / 20) * 3600) : dis > 10 && dis < 100 ? Math.floor((dis / 12) * 3600) : Math.floor((dis / 8) * 3600);
break;
case 3:
speed = 10000;
// speed = 10000;
speed = dis >= 100 ? Math.floor((dis / 5) * 3600) : dis > 10 && dis < 100 ? Math.floor((dis / 3) * 3600) : Math.floor((dis / 2) * 3600);
break;
default:
speed = 500;
// speed = 500;
speed = dis >= 100 ? Math.floor((dis / 40) * 3600) : dis > 10 && dis < 100 ? Math.floor((dis / 30) * 3600) : Math.floor((dis / 16) * 3600);
break;
}
return speed;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!