Commit 47cae3e9 authored by ni1o1's avatar ni1o1
Browse files

修复nikebus改为vue版本后的一些bug

1.引入MarkPointComponent,确保能够显示到站时间
2.0.5秒刷新一次位置,每10次刷新中,9次为推测的位置,1次为抓取的位置
parent 83c6a7ac
Loading
Loading
Loading
Loading
+170 −169
Original line number Diff line number Diff line
<template>
  <v-chart class="chart" :option="echartsOption" :autoresize="true" />
  <img src="https://visitor-badge.laobi.icu/badge?page_id=nikebus" alt="visitor badge"
       class="visitor-badge"/>
  <img src="https://visitor-badge.laobi.icu/badge?page_id=nikebus" alt="visitor badge" class="visitor-badge" />
</template>

<script>
@@ -18,7 +17,8 @@ import {
import {
  TitleComponent,
  TooltipComponent,
  // LegendComponent,
  MarkPointComponent,
  // MarkPointComponent,
  GridComponent,
} from "echarts/components";

@@ -27,6 +27,7 @@ use([
  SVGRenderer,
  TitleComponent,
  TooltipComponent,
  MarkPointComponent,
  // LegendComponent,
  GridComponent,
  ScatterChart,
@@ -150,7 +151,7 @@ export default {
  }),
  methods: {
    setEchartsOption(appendOption) {
      this.echartsOption = Object.assign({}, this.echartsOption, appendOption)
      this.echartsOption = appendOption
    },
    //加载线路与站点信息
    load_data() {
@@ -342,6 +343,7 @@ export default {
          navigator.geolocation.getCurrentPosition(pos => {
            let lat = pos.coords.latitude,
              lng = pos.coords.longitude;

            //标记出最近的站点
            const p = point([lng, lat])
            const nearest_line1 = nearestPoint(p, this.stops1);
@@ -390,7 +392,6 @@ export default {
              coord: [2, line2_pos_dir2]
            }
            ]

            this.setEchartsOption({
              series: [{
                markPoint: {
@@ -423,7 +424,7 @@ export default {
    this.load_data();
    this.timer = setInterval(() => {
      this.refresh();
    }, 5000);
    }, 500);//0.5秒刷新一次位置,每10次刷新中,9次为推测的位置,1次为抓取的位置
  },
  unmounted() {
    clearInterval(this.timer);