From a22aa1086eeef39a26cc161326ce09cd183185ea Mon Sep 17 00:00:00 2001
From: liuyg <liuyg@qq.com>
Date: Fri, 04 Mar 2022 15:57:47 +0800
Subject: [PATCH] 3.3 1.自定义标签,退出后自动清除 2.自定义标签,转换二维码的数据格式ok,移动端对接二维码ok, 3.自定义标签点击移动到指定位置 ok 4.面板自适应高度 4.更换定位依赖,自定义标签扫码入移动端可以定位并显示路线
---
src/components/map/components/campusBuildingSearch copy.vue | 814 +++++++++++++++++++++++++++++----------------------------
1 files changed, 414 insertions(+), 400 deletions(-)
diff --git a/src/components/map/components/campusBuildingSearch copy.vue b/src/components/map/components/campusBuildingSearch copy.vue
index 6c2dc17..2e2ee60 100644
--- a/src/components/map/components/campusBuildingSearch copy.vue
+++ b/src/components/map/components/campusBuildingSearch copy.vue
@@ -1,440 +1,454 @@
<template>
- <div>
- <div class="map-campus-search"
- id="CampusSearchPanel">
- <el-input class="search-input"
- placeholder="社区搜索…"
- v-model="searchInput"
- @input="searchValueChange"
- @focus="shortcutFlag = true">
- </el-input>
- <el-button-group>
- <el-button @click="navigationShow"
- class="deblurring"
- icon="el-icon-my-path"></el-button>
- <el-button class="deblurring"
- type="primary"
- icon="el-icon-my-search"></el-button>
- </el-button-group>
- <div v-show="searchValShow"
- class="search-value-box">
- <ul>
- <li v-for="(item, index) in searchValList"
- :key="index"
- @click="loadPopup(item)">
- {{item.name}}
- </li>
- </ul>
- </div>
- <div class="map-campus-shortcut"
- v-show="shortcutFlag">
- <div class="shortcut-box">
- <ul>
- <li v-for="(item, index) in shortcutList"
- :key="index">
- <el-button @click="openModelPopup(item)">
- <img :src="item.bgimg"
- alt="">
- <span>{{item.title}}</span>
- </el-button>
- </li>
- </ul>
- </div>
- </div>
+ <div>
+ <div class="map-campus-search" id="CampusSearchPanel">
+ <el-input
+ class="search-input"
+ placeholder="校区搜索…"
+ v-model="searchInput"
+ @input="searchValueChange"
+ @focus="shortcutFlag = true"
+ >
+ </el-input>
+ <el-button-group>
+ <el-button
+ @click="navigationShow"
+ class="deblurring"
+ icon="el-icon-my-path"
+ ></el-button>
+ <el-button
+ class="deblurring"
+ type="primary"
+ icon="el-icon-my-search"
+ ></el-button>
+ </el-button-group>
+ <div v-show="searchValShow" class="search-value-box">
+ <ul>
+ <li
+ v-for="(item, index) in searchValList"
+ :key="index"
+ @click="loadPopup(item)"
+ >
+ {{ item.name }}
+ </li>
+ </ul>
+ </div>
+ <div class="map-campus-shortcut" v-show="shortcutFlag">
+ <div class="shortcut-box">
+ <ul>
+ <li v-for="(item, index) in shortcutList" :key="index">
+ <el-button @click="openModelPopup(item)">
+ <img :src="item.bgimg" alt="" />
+ <span>{{ item.title }}</span>
+ </el-button>
+ </li>
+ </ul>
</div>
+ </div>
</div>
+ </div>
</template>
<script>
+import { mapGetters } from "vuex";
-import { mapGetters } from 'vuex'
-
-import { getList } from '@/api/pc/orgnav/index'
-import { getSearchList } from '@/api/pc/public/search'
+import { getList } from "@/api/pc/orgnav/index";
+import { getSearchList } from "@/api/pc/public/search";
export default {
- name: 'campusBuildingSearch',
- data () {
- return {
- DC: null,
- shortcutList: [
- // {
- // bgimg: '/img/search/org.png',
- // title: '党群机构',
- // type: 'orgnav',
- // path: '/pcLayout/default/orgnav/masses',
- // code: 1
- // },
- // {
- // bgimg: '/img/search/ofc.png',
- // title: '职能部处',
- // type: 'orgnav',
- // path: '/pcLayout/default/orgnav/ofc',
- // code: 2
- // },
- // {
- // bgimg: '/img/search/teach.png',
- // title: '教学科研',
- // type: 'arc',
- // path: '/pcLayout/default/arc/teaching',
- // code: 2
- // },
- {
- bgimg: '/img/search/venue.png',
- title: '社区场馆',
- type: 'arc',
- path: '/pcLayout/default/arc/venue',
- code: 3
- }
- // {
- // bgimg: '/img/search/dorm.png',
- // title: '社区宿舍',
- // type: 'arc',
- // path: '/pcLayout/default/arc/dorm',
- // code: 4
- // },
- // {
- // bgimg: '/img/search/scenery.png',
- // title: '文化风景',
- // type: 'arc',
- // path: '/pcLayout/default/arc/culture',
- // code: 5
- // }
- ],
- shortcutFlag: false,
- searchInput: '',
- searchValShow: false,
- searchValList: []
+ name: "campusBuildingSearch",
+ data() {
+ return {
+ DC: null,
+ shortcutList: [
+ // {
+ // bgimg: '/img/search/org.png',
+ // title: '党群机构',
+ // type: 'orgnav',
+ // path: '/pcLayout/default/orgnav/masses',
+ // code: 1
+ // },
+ // {
+ // bgimg: '/img/search/ofc.png',
+ // title: '职能部处',
+ // type: 'orgnav',
+ // path: '/pcLayout/default/orgnav/ofc',
+ // code: 2
+ // },
+ // {
+ // bgimg: '/img/search/teach.png',
+ // title: '教学科研',
+ // type: 'arc',
+ // path: '/pcLayout/default/arc/teaching',
+ // code: 2
+ // },
+ {
+ bgimg: "/img/search/venue.png",
+ title: "校区场馆",
+ type: "arc",
+ path: "/pcLayout/default/arc/venue",
+ code: 3,
+ },
+ // {
+ // bgimg: '/img/search/dorm.png',
+ // title: '校区宿舍',
+ // type: 'arc',
+ // path: '/pcLayout/default/arc/dorm',
+ // code: 4
+ // },
+ // {
+ // bgimg: '/img/search/scenery.png',
+ // title: '文化风景',
+ // type: 'arc',
+ // path: '/pcLayout/default/arc/culture',
+ // code: 5
+ // }
+ ],
+ shortcutFlag: false,
+ searchInput: "",
+ searchValShow: false,
+ searchValList: [],
+ };
+ },
+ computed: {
+ ...mapGetters([
+ "viewer",
+ // 校区内导航的显示关闭
+ "campusNavFlag",
+ "orgNavBarFlag",
+ "arcNavBarFlag",
+ ]),
+ },
+ created() {
+ this.DC = global.DC;
+ },
+ methods: {
+ searchValueChange() {
+ if (this.searchInput == "") {
+ this.searchValList = [];
+ this.searchValShow = false;
+ return;
+ }
+ getSearchList({ mechanismName: this.searchInput }).then((res) => {
+ if (res.data.data.length > 0) {
+ this.searchValList = res.data.data;
+ this.searchValShow = true;
}
+ });
},
- computed: {
- ...mapGetters([
- 'viewer',
- // 社区内导航的显示关闭
- 'campusNavFlag',
- 'orgNavBarFlag',
- 'arcNavBarFlag'
- ])
+
+ navigationShow() {
+ if (this.campusNavFlag == false) {
+ this.$store.commit("SET_CAMPUSNAVFLAG", true);
+ }
},
- created () {
- this.DC = global.DC
- },
- methods: {
- searchValueChange () {
- if (this.searchInput == '') {
- this.searchValList = []
- this.searchValShow = false
- return
- }
- getSearchList({ mechanismName: this.searchInput }).then(res => {
- if (res.data.data.length > 0) {
- this.searchValList = res.data.data
- this.searchValShow = true
- }
- })
- },
- navigationShow () {
- if (this.campusNavFlag == false) {
- this.$store.commit('SET_CAMPUSNAVFLAG', true)
- }
- },
+ openModelPopup(param) {
+ var list = [];
+ if (this.$route.path.indexOf("/service") != -1) {
+ this.$store.dispatch("delVisitedViews", this.$route);
+ this.$router.push("/pcLayout/default");
+ }
- openModelPopup (param) {
- var list = []
- if (this.$route.path.indexOf('/service') != -1) {
- this.$store.dispatch('delVisitedViews', this.$route)
- this.$router.push('/pcLayout/default')
- }
-
- if (param.type == 'orgnav') {
- var path = this.$route.path
- if (path.indexOf('/arc') != -1) {
- this.$store.dispatch('delVisitedViews', this.$route)
- this.$router.push('/pcLayout/default')
- this.$store.commit('SET_ARCNAVBARTITLE', '')
- this.$store.commit('SET_ARCNAVBARCODE', '')
- this.$store.commit('SET_ARCNAVBARFLAG', false)
- }
-
- if (this.arcNavBarFlag == true) {
- this.$store.commit('SET_ARCNAVBARTITLE', '')
- this.$store.commit('SET_ARCNAVBARCODE', '')
- this.$store.commit('SET_ARCNAVBARFLAG', false)
- }
-
- this.$store.commit('SET_ORGNAVBARTITLE', param.title)
- this.$store.commit('SET_ORGNAVBARLIST', [])
-
- this.$store.commit('SET_ORGNAVBARFLAG', true)
-
- getList({ type: param.code }).then(res => {
- res.data.data.records.forEach(item => {
- list.push({
- navTitle: item.mechanismname,
- icon: '/img/navicon/tag.png',
- longitude: item.jd,
- latitude: item.wd,
- alt: item.gd,
- heading: item.heading,
- pitch: item.pitch,
- roll: item.roll,
- bgImg: item.tpurl,
- QRImg: item.codeurl,
- address: item.address,
- telephone: item.telephone,
- introduce: item.introduce,
- videourl: item.videourl
- })
- })
-
- this.$store.commit('SET_ORGNAVBARLIST', list)
- })
- } else if (param.type == 'arc') {
- if (this.$route.path.indexOf('/orgnav') != -1) {
- this.$store.dispatch('delVisitedViews', this.$route)
- this.$router.push('/pcLayout/default')
- this.$store.commit('SET_ORGNAVBARTITLE', '')
- this.$store.commit('SET_ORGNAVBARLIST', [])
- this.$store.commit('SET_ORGNAVBARFLAG', false)
- }
-
- if (this.orgNavBarFlag == true) {
- this.$store.commit('SET_ORGNAVBARTITLE', '')
- this.$store.commit('SET_ORGNAVBARLIST', [])
- this.$store.commit('SET_ORGNAVBARFLAG', false)
- }
-
- this.$store.commit('SET_ARCNAVBARTITLE', param.title)
- this.$store.commit('SET_ARCNAVBARCODE', param.code)
- this.$store.commit('SET_ARCNAVBARFLAG', true)
- }
- },
-
- shortcutShow (event) {
- var sp = document.getElementById('CampusSearchPanel')
-
- if (sp) {
- if (!sp.contains(event.target)) { // 这句是说如果我们点击到了id为myPanel以外的区域
- this.shortcutFlag = false
- }
- }
- },
-
- loadPopup (param) {
- var that = this
-
- that.searchInput = ''
- that.searchValList = []
- that.searchValShow = false
-
- this.$store.commit('CLEAR_ALL', null)
-
- var result = param.list
-
- var imgArr = result.tpurl.split(',')
-
- this.$store.commit('SET_POPUPBGURL', imgArr[0])
- this.$store.commit('SET_POPUPQRURL', result.codeurl)
- this.$store.commit('SET_POINTPOSITION', [Number(result.jd), Number(result.wd), Number(result.gd), Number(result.heading), Number(result.pitch), Number(result.roll)])
- this.$store.commit('SET_STATENAME', result.mechanismname)
- this.$store.commit('SET_SITENAME', result.address)
- this.$store.commit('SET_TELEPHONE', result.telephone)
- this.$store.commit('SET_INTRODUCETEXT', result.introduce)
- if (result.panoramaurl != '') {
- this.$store.commit('SET_PANORAMAURL', result.panoramaurl)
- }
- if (result.videourl && result.videourl != '') {
- this.$store.commit('SET_MONITORURL', result.videourl)
- }
- this.$store.commit('SET_POPUPIMGATLAS', imgArr)
- if (param.jx != undefined && param.jx != '') {
- var tabOne = param.jx.split(',')
- this.$store.commit('SET_TEACHLIST', tabOne)
- } else {
- this.$store.commit('SET_TEACHLIST', [])
- }
-
- if (param.sh != undefined && param.sh != '') {
- var tabTwo = param.sh.split(',')
- this.$store.commit('SET_LIVELIST', tabTwo)
- } else {
- this.$store.commit('SET_LIVELIST', [])
- }
-
- this.newPopup(result)
- this.viewer.flyToPosition(
- new this.DC.Position(Number(result.jd), Number(result.wd), 300, Number(result.heading), Number(result.pitch), Number(result.roll)),
- () => {
-
- },
- 3
- )
- },
-
- newPopup (item) {
- const position = this.DC.Transform.transformWGS84ToCartesian(new this.DC.Position(Number(item.jd), Number(item.wd), Number(item.gd)))
- // eslint-disable-next-line no-unused-vars
- var popup = new this.DC.DivForms(this.viewer, {
- domId: 'divFormsDomBox',
- position: [
- position
- ]
- })
-
- this.$store.commit('SET_PANORAMAPOPUP', false)
- this.$store.commit('SET_MONITORPOPUP', false)
- this.$store.commit('SET_DETAILSPOPUP', true)
+ if (param.type == "orgnav") {
+ var path = this.$route.path;
+ if (path.indexOf("/arc") != -1) {
+ this.$store.dispatch("delVisitedViews", this.$route);
+ this.$router.push("/pcLayout/default");
+ this.$store.commit("SET_ARCNAVBARTITLE", "");
+ this.$store.commit("SET_ARCNAVBARCODE", "");
+ this.$store.commit("SET_ARCNAVBARFLAG", false);
}
- }
-}
+ if (this.arcNavBarFlag == true) {
+ this.$store.commit("SET_ARCNAVBARTITLE", "");
+ this.$store.commit("SET_ARCNAVBARCODE", "");
+ this.$store.commit("SET_ARCNAVBARFLAG", false);
+ }
+
+ this.$store.commit("SET_ORGNAVBARTITLE", param.title);
+ this.$store.commit("SET_ORGNAVBARLIST", []);
+
+ this.$store.commit("SET_ORGNAVBARFLAG", true);
+
+ getList({ type: param.code }).then((res) => {
+ res.data.data.records.forEach((item) => {
+ list.push({
+ navTitle: item.mechanismname,
+ icon: "/img/navicon/tag.png",
+ longitude: item.jd,
+ latitude: item.wd,
+ alt: item.gd,
+ heading: item.heading,
+ pitch: item.pitch,
+ roll: item.roll,
+ bgImg: item.tpurl,
+ QRImg: item.codeurl,
+ address: item.address,
+ telephone: item.telephone,
+ introduce: item.introduce,
+ videourl: item.videourl,
+ });
+ });
+
+ this.$store.commit("SET_ORGNAVBARLIST", list);
+ });
+ } else if (param.type == "arc") {
+ if (this.$route.path.indexOf("/orgnav") != -1) {
+ this.$store.dispatch("delVisitedViews", this.$route);
+ this.$router.push("/pcLayout/default");
+ this.$store.commit("SET_ORGNAVBARTITLE", "");
+ this.$store.commit("SET_ORGNAVBARLIST", []);
+ this.$store.commit("SET_ORGNAVBARFLAG", false);
+ }
+
+ if (this.orgNavBarFlag == true) {
+ this.$store.commit("SET_ORGNAVBARTITLE", "");
+ this.$store.commit("SET_ORGNAVBARLIST", []);
+ this.$store.commit("SET_ORGNAVBARFLAG", false);
+ }
+
+ this.$store.commit("SET_ARCNAVBARTITLE", param.title);
+ this.$store.commit("SET_ARCNAVBARCODE", param.code);
+ this.$store.commit("SET_ARCNAVBARFLAG", true);
+ }
+ },
+
+ shortcutShow(event) {
+ var sp = document.getElementById("CampusSearchPanel");
+
+ if (sp) {
+ if (!sp.contains(event.target)) {
+ // 这句是说如果我们点击到了id为myPanel以外的区域
+ this.shortcutFlag = false;
+ }
+ }
+ },
+
+ loadPopup(param) {
+ var that = this;
+
+ that.searchInput = "";
+ that.searchValList = [];
+ that.searchValShow = false;
+
+ this.$store.commit("CLEAR_ALL", null);
+
+ var result = param.list;
+
+ var imgArr = result.tpurl.split(",");
+
+ this.$store.commit("SET_POPUPBGURL", imgArr[0]);
+ this.$store.commit("SET_POPUPQRURL", result.codeurl);
+ this.$store.commit("SET_POINTPOSITION", [
+ Number(result.jd),
+ Number(result.wd),
+ Number(result.gd),
+ Number(result.heading),
+ Number(result.pitch),
+ Number(result.roll),
+ ]);
+ this.$store.commit("SET_STATENAME", result.mechanismname);
+ this.$store.commit("SET_SITENAME", result.address);
+ this.$store.commit("SET_TELEPHONE", result.telephone);
+ this.$store.commit("SET_INTRODUCETEXT", result.introduce);
+ if (result.panoramaurl != "") {
+ this.$store.commit("SET_PANORAMAURL", result.panoramaurl);
+ }
+ if (result.videourl && result.videourl != "") {
+ this.$store.commit("SET_MONITORURL", result.videourl);
+ }
+ this.$store.commit("SET_POPUPIMGATLAS", imgArr);
+ if (param.jx != undefined && param.jx != "") {
+ var tabOne = param.jx.split(",");
+ this.$store.commit("SET_TEACHLIST", tabOne);
+ } else {
+ this.$store.commit("SET_TEACHLIST", []);
+ }
+
+ if (param.sh != undefined && param.sh != "") {
+ var tabTwo = param.sh.split(",");
+ this.$store.commit("SET_LIVELIST", tabTwo);
+ } else {
+ this.$store.commit("SET_LIVELIST", []);
+ }
+
+ this.newPopup(result);
+ this.viewer.flyToPosition(
+ new this.DC.Position(
+ Number(result.jd),
+ Number(result.wd),
+ 300,
+ Number(result.heading),
+ Number(result.pitch),
+ Number(result.roll)
+ ),
+ () => {},
+ 3
+ );
+ },
+
+ newPopup(item) {
+ const position = this.DC.Transform.transformWGS84ToCartesian(
+ new this.DC.Position(Number(item.jd), Number(item.wd), Number(item.gd))
+ );
+ // eslint-disable-next-line no-unused-vars
+ var popup = new this.DC.DivForms(this.viewer, {
+ domId: "divFormsDomBox",
+ position: [position],
+ });
+
+ this.$store.commit("SET_PANORAMAPOPUP", false);
+ this.$store.commit("SET_MONITORPOPUP", false);
+ this.$store.commit("SET_DETAILSPOPUP", true);
+ },
+ },
+};
</script>
-<style lang='scss' scope>
+<style lang="scss" scope>
.map-campus-search {
- position: fixed;
- top: 100px;
- left: 0;
- right: 0;
- bottom: auto;
- margin: auto;
- width: 330px;
- min-height: 40px;
- max-height: 360px;
- height: auto;
- z-index: 11;
- border-radius: 5px;
- box-shadow: 0 0 14px 2px rgb(221, 221, 221);
+ position: fixed;
+ top: 100px;
+ left: 0;
+ right: 0;
+ bottom: auto;
+ margin: auto;
+ width: 330px;
+ min-height: 40px;
+ max-height: 360px;
+ height: auto;
+ z-index: 11;
+ border-radius: 5px;
+ box-shadow: 0 0 14px 2px rgb(221, 221, 221);
- .search-input {
- float: left;
- width: 250px;
- height: 40px;
- border-radius: 5px 0 0 5px;
+ .search-input {
+ float: left;
+ width: 250px;
+ height: 40px;
+ border-radius: 5px 0 0 5px;
- input {
- box-sizing: border-box;
- border-radius: 5px 0 0 5px;
- }
+ input {
+ box-sizing: border-box;
+ border-radius: 5px 0 0 5px;
}
+ }
- .el-button-group {
- float: left;
- width: 80px;
+ .el-button-group {
+ float: left;
+ width: 80px;
- .el-button {
- margin: 0;
- padding: 0;
- width: 40px;
- height: 40px !important;
- position: relative;
- border-radius: 0;
- border: 1px solid #dcdfe6;
+ .el-button {
+ margin: 0;
+ padding: 0;
+ width: 40px;
+ height: 40px !important;
+ position: relative;
+ border-radius: 0;
+ border: 1px solid #dcdfe6;
- i {
- margin: auto;
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- }
- }
-
- .el-button:nth-child(1) {
- border-left: none;
- border-right: none;
- }
-
- .el-button:nth-child(2) {
- border-left: none;
- border-right: none;
- border-radius: 0 5px 5px 0;
- }
- }
-
- .search-value-box {
+ i {
+ margin: auto;
position: absolute;
- top: 41px;
+ top: 0;
left: 0;
- width: auto;
- min-width: 250px;
- max-height: 520px;
- background: #fff;
- overflow-y: auto;
- box-shadow: 0 0 14px 2px rgb(221, 221, 221);
- border-radius: 5px;
-
- ul {
- li {
- padding-left: 20px;
- height: 36px;
- line-height: 36px;
- cursor: pointer;
- }
-
- li:hover {
- background: #f5f5f5;
- }
- }
+ right: 0;
+ bottom: 0;
+ }
}
- .map-campus-shortcut {
- margin-top: 20px;
+ .el-button:nth-child(1) {
+ border-left: none;
+ border-right: none;
+ }
+
+ .el-button:nth-child(2) {
+ border-left: none;
+ border-right: none;
+ border-radius: 0 5px 5px 0;
+ }
+ }
+
+ .search-value-box {
+ position: absolute;
+ top: 41px;
+ left: 0;
+ width: auto;
+ min-width: 250px;
+ max-height: 520px;
+ background: #fff;
+ overflow-y: auto;
+ box-shadow: 0 0 14px 2px rgb(221, 221, 221);
+ border-radius: 5px;
+
+ ul {
+ li {
+ padding-left: 20px;
+ height: 36px;
+ line-height: 36px;
+ cursor: pointer;
+ }
+
+ li:hover {
+ background: #f5f5f5;
+ }
+ }
+ }
+
+ .map-campus-shortcut {
+ margin-top: 20px;
+ width: 100%;
+ height: 330px;
+ background: #fff;
+ border-radius: 5px;
+
+ .shortcut-box {
+ padding-top: 36px;
+ ul {
+ display: flex;
width: 100%;
- height: 330px;
- background: #fff;
- border-radius: 5px;
+ height: 120px;
+ justify-content: flex-start;
+ flex-wrap: wrap;
- .shortcut-box {
- padding-top: 36px;
- ul {
- display: flex;
- width: 100%;
- height: 120px;
- justify-content: flex-start;
- flex-wrap: wrap;
+ li {
+ margin: 0 13px;
+ width: 84px;
+ height: 76px;
- li {
- margin: 0 13px;
- width: 84px;
- height: 76px;
+ .el-button {
+ width: 80px;
+ height: 70px;
+ padding: 6px 12px;
+ background: #efefef;
+ border: none;
+ border-radius: 5px;
+ box-sizing: border-box;
+ text-align: center;
- .el-button {
- width: 80px;
- height: 70px;
- padding: 6px 12px;
- background: #efefef;
- border: none;
- border-radius: 5px;
- box-sizing: border-box;
- text-align: center;
+ & > span {
+ width: auto;
+ height: auto;
- & > span {
- width: auto;
- height: auto;
+ img {
+ margin-top: 4px;
+ width: 26px;
+ height: 26px;
+ }
- img {
- margin-top: 4px;
- width: 26px;
- height: 26px;
- }
-
- span {
- display: block;
- font-size: 14px;
- line-height: 28px;
- }
- }
- }
-
- .el-button:focus {
- border: 1px solid #000;
- }
- }
+ span {
+ display: block;
+ font-size: 14px;
+ line-height: 28px;
+ }
}
+ }
+
+ .el-button:focus {
+ border: 1px solid #000;
+ }
}
+ }
}
+ }
}
</style>
--
Gitblit v1.9.3