|
@@ -12,7 +12,6 @@
|
|
|
<div class="quanguo" @click="getData('china')" v-if="code !== 'china'">
|
|
|
返回
|
|
|
</div>
|
|
|
-
|
|
|
<Echart id="CenterMap" :options="options" ref="CenterMap" />
|
|
|
</dv-border-box-12>
|
|
|
</div>
|
|
@@ -32,15 +31,34 @@ export default {
|
|
|
code: 'china', // china 代表中国 其他地市是行政编码
|
|
|
echartBindClick: false,
|
|
|
isSouthChinaSea: false, // 是否要展示南海群岛 修改此值请刷新页面
|
|
|
- pageflag: true
|
|
|
+ pageflag: true,
|
|
|
+ timer: null
|
|
|
}
|
|
|
},
|
|
|
created () {},
|
|
|
-
|
|
|
mounted () {
|
|
|
this.getData('china')
|
|
|
},
|
|
|
+ beforeDestroy () {
|
|
|
+ this.clearData()
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ clearData () {
|
|
|
+ if (this.timer) {
|
|
|
+ clearInterval(this.timer)
|
|
|
+ this.timer = null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 轮询
|
|
|
+ switper () {
|
|
|
+ if (this.timer) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const looper = (a) => {
|
|
|
+ this.getData('china')
|
|
|
+ }
|
|
|
+ this.timer = setInterval(looper, this.$store.state.setting.echartsAutoTime)
|
|
|
+ },
|
|
|
getData (code) {
|
|
|
queryMapSaleData().then((res) => {
|
|
|
console.log('地图', res)
|
|
@@ -48,6 +66,7 @@ export default {
|
|
|
this.getGeojson('china', res.data.dataList)
|
|
|
// this.mapclick()
|
|
|
this.$emit('onData', res.data)
|
|
|
+ this.switper()
|
|
|
} else {
|
|
|
this.$Message.warning(res.msg)
|
|
|
}
|