From 81773ab04fd259e893c2d7f08dbdc9be772d01c4 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Tue, 21 Dec 2021 17:18:45 +0800
Subject: [PATCH] +,请求数据,弹框显示,优化代码长度
---
src/components/mobileCortrolButtom/index.vue | 101 +++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 79 insertions(+), 22 deletions(-)
diff --git a/src/components/mobileCortrolButtom/index.vue b/src/components/mobileCortrolButtom/index.vue
index 1f6020a..417eede 100644
--- a/src/components/mobileCortrolButtom/index.vue
+++ b/src/components/mobileCortrolButtom/index.vue
@@ -1,6 +1,6 @@
<template>
<div class="m-left-mobileCortrolButtom">
- <div class="m-l-inbut"><i class="el-icon-s-help"></i></div>
+ <div class="m-l-inbut" @click="mubiao"><i class="el-icon-s-help"></i></div>
<div class="m-l-inbut">
<!-- <i class="el-icon-s-flag"></i> -->
<el-dropdown trigger="click" @command="handleCommand">
@@ -8,10 +8,12 @@
<i class="el-icon-s-flag icon"></i>
</span>
<el-dropdown-menu slot="dropdown">
- <el-dropdown-item command="西东大街">西东大街</el-dropdown-item>
- <el-dropdown-item command="长江路">长江路</el-dropdown-item>
- <el-dropdown-item command="科技园">科技园</el-dropdown-item>
- <el-dropdown-item command="逸夫楼">逸夫楼</el-dropdown-item>
+ <el-dropdown-item
+ v-for="(item, index) in tabTable"
+ :key="index"
+ :command="item"
+ >{{ item.title }}</el-dropdown-item
+ >
</el-dropdown-menu>
</el-dropdown>
</div>
@@ -25,47 +27,102 @@
<script>
import { mapGetters } from "vuex";
import { getIp, getUsers } from "@/api/mobile/ip/index";
+import { getListarc } from "@/api/mobile/public/arc";
export default {
name: "mobileCortrolButtom",
data() {
- return {};
+ return {
+ DC: "",
+ tabTable: [],
+ ccData: [
+ {
+ lnt: 115.87071885,
+ lat: 28.74382592,
+ },
+ {
+ lnt: 121.50266534548483,
+ lat: 31.24357506330159,
+ },
+ {
+ lnt: 121.56405019,
+ lat: 31.20845211,
+ },
+ {
+ lnt: 121.55500463461836,
+ lat: 31.257934074839717,
+ },
+ ],
+ };
},
computed: {
- ...mapGetters(["mviewer"]),
+ ...mapGetters(["mviewer", "openmobileGoTo"]),
},
created() {
this.DC = global.DC;
+ this.getStreet();
},
mounted() {},
methods: {
+ mubiao() {
+ let that = this;
+ //测试fllyTo
+ },
handleCommand(command) {
+ let that = this;
console.log(command, "定位");
// 定位
- // this.mviewer.zoomToPosition(
- // new DC.Position(
- // e.wgs84Position.lng,
- // e.wgs84Position.lat - 0.016,
- // 1530,
- // 0,
- // -45
- // )
- // );
+ this.$store.dispatch("mapFlyTo", {
+ //飞入
+ lntLat: [command.lnt, command.lat, 2530],
+ heading: 0,
+ pitch: -45,
+ roll: 0,
+ });
},
openBigPopupAfter() {
this.$store.commit("MSET_BIGPOPUPAFTER", true);
},
goOn() {
- console.log(returnCitySN["cip"]);
- let data = {
- ip: returnCitySN["cip"],
- key: "7WKBZ-QDY62-WEEUG-C7KUN-ADAF5-L5BKZ",
- };
- console.log("定位", data.ip);
+ let that = this;
+ this.$store.commit("MSET_OPENMOBILEGOTO", !that.openmobileGoTo);
+ // console.log(returnCitySN["cip"]);
+ // let data = {
+ // ip: returnCitySN["cip"],
+ // key: "7WKBZ-QDY62-WEEUG-C7KUN-ADAF5-L5BKZ",
+ // };
+ // console.log("定位", data.ip);
// getIp(data).then((res) => {
// // getUsers(data).then((res) => {
// console.log(res);
// });
},
+ getStreet() {
+ let that = this;
+ getListarc().then((res) => {
+ let title = [];
+ const data = res.data.data;
+ for (let k = 0; k < data.length; k++) {
+ title.push({
+ title: data[k].dictValue,
+ flag: false,
+ key: data[k].dictKey,
+ child: [],
+ lnt: that.ccData[k].lnt,
+ lat: that.ccData[k].lat,
+ });
+ }
+ // res.data.data.forEach((item) => {
+ // title.push({
+ // title: item.dictValue,
+ // flag: false,
+ // key: item.dictKey,
+ // child: [],
+ // });
+ // });
+ this.tabTable = title;
+ this.$store.commit("MSET_POPUPTABLENAME", title);
+ });
+ },
},
};
</script>
--
Gitblit v1.9.3