From 81f54040c2cb65537c6c6e1db8358a39a57dea0d Mon Sep 17 00:00:00 2001
From: mayisheng <admin>
Date: Mon, 15 Aug 2022 16:14:01 +0800
Subject: [PATCH] 1
---
src/components/map/components/campusBuildingSearch.vue | 467 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 439 insertions(+), 28 deletions(-)
diff --git a/src/components/map/components/campusBuildingSearch.vue b/src/components/map/components/campusBuildingSearch.vue
index f10cc0f..2dab424 100644
--- a/src/components/map/components/campusBuildingSearch.vue
+++ b/src/components/map/components/campusBuildingSearch.vue
@@ -1,64 +1,379 @@
<template>
<div>
- <campusNav ref="campusNavRoute"
- v-show="campusNavFlag" />
- <div class="map-campus-serarch">
- <el-input class="search-input"
- placeholder="校园搜索…"
- v-model="input3">
- </el-input>
+ <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 @click="navigationShow" class="deblurring" icon="el-icon-my-path"></el-button>
+ <el-button
+ @click="fuzzyQuery"
+ 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.mechanismname }}</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 { getList } from '@/api/pc/orgnav/index'
+import { getSearchList } from '@/api/pc/public/search'
export default {
name: 'campusBuildingSearch',
data () {
return {
- campusNavFlag: false
+ shortcutList: [
+ {
+ bgimg: '/img/search/org.png',
+ title: '其他机构',
+ type: 'orgnav',
+ path: '/pcLayout/default/orgnav/rest',
+ code: 5
+ },
+ // {
+ // 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/floor.png',
+ title: '主要场馆',
+ type: 'arc',
+ path: '/pcLayout/default/arc/rest',
+ code: 7
+ }
+ // {
+ // 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([
+ // 校区内导航的显示关闭
+ 'campusNavFlag',
+ 'orgNavBarFlag',
+ 'arcNavBarFlag',
+ 'twoOrThree'
+ ])
+ },
+ created () {
+ },
methods: {
- navigationShow () {
- this.campusNavFlag = true
+ coordinate (item) {
+ const arr = item.split(',')
+
+ return {
+ lng: arr[0],
+ lat: arr[1]
+ }
},
- closeCampusNav () {
- this.campusNavFlag = false
+
+ 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)
+ }
+ },
+
+ fuzzyQuery () {
+ if (this.searchInput == '') {
+ this.searchValList = []
+ this.searchValShow = false
+
+ this.$message({
+ message: '请输入关键字',
+ type: 'warning',
+ duration: 1000
+ })
+ return
+ }
+ getSearchList({ mechanismName: this.searchInput }).then((res) => {
+ if (res.data.data.length > 0) {
+ this.$store.commit('SET_SEARCHPOPUPFLAG', true)
+ this.$store.commit('SET_SEARCHPOPUPLIST', res.data.data)
+ this.searchInput = ''
+ this.searchValList = []
+ this.searchValShow = false
+ }
+ })
+ },
+
+ openModelPopup (param) {
+ var list = []
+
+ if (param.type == 'orgnav') {
+ 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') {
+ this.$store.commit('SET_ARCNAVBARTITLE', param.title)
+ this.$store.commit('SET_ARCNAVBARCODE', param.code)
+ this.$store.commit('SET_ARCNAVBARFLAG', true)
+ }
+
+ this.$router.push(param.path)
+ },
+
+ shortcutShow (event) {
+ var sp = document.getElementById('CampusSearchPanel')
+
+ if (sp) {
+ if (!sp.contains(event.target)) {
+ // 这句是说如果我们点击到了id为myPanel以外的区域
+ this.shortcutFlag = false
+ }
+ }
+ },
+
+ loadPopup (param) {
+ var that = this
+
+ let obj = {}
+
+ if (param.x && param.x != '') {
+ const position = this.coordinate(param.x)
+ obj = {
+ lng: position.lng, lat: position.lat
+ }
+ } else {
+ obj = {
+ lng: param.longitude, lat: param.latitude
+ }
+ }
+
+ that.searchInput = ''
+ that.searchValList = []
+ that.searchValShow = false
+
+ this.$store.commit('CLEAR_ALL', null)
+
+ var imgArr = param.tpurl.split(',')
+
+ this.$store.commit('SET_POPUPBGURL', imgArr[0])
+ this.$store.commit('SET_POPUPQRURL', param.codeurl)
+
+ this.$store.commit('SET_STATENAME', param.mechanismname)
+ this.$store.commit('SET_SITENAME', param.address)
+ this.$store.commit('SET_TELEPHONE', param.telephone)
+ this.$store.commit('SET_INTRODUCETEXT', param.introduce)
+ if (param.panoramaurl != '') {
+ this.$store.commit('SET_PANORAMAURL', param.panoramaurl)
+ }
+ if (param.videourl && param.videourl != '') {
+ this.$store.commit('SET_MONITORURL', param.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(param, obj)
+ if (this.twoOrThree == '三 维') {
+ this.$store.commit('SET_POINTPOSITION', [
+ Number(obj.lng),
+ Number(obj.lat),
+ Number(param.gd),
+ Number(param.heading),
+ Number(param.pitch),
+ Number(param.roll)
+ ])
+
+ global.viewer.flyToPosition(
+ new global.DC.Position(
+ Number(obj.lng),
+ Number(obj.lat),
+ 300,
+ Number(param.heading),
+ Number(param.pitch),
+ Number(param.roll)
+ ),
+ () => { },
+ 0.5
+ )
+ } else {
+ this.$store.commit('SET_POINTPOSITION', [
+ Number(param.jd),
+ Number(param.wd),
+ Number(50),
+ Number(param.heading),
+ Number(param.pitch),
+ Number(param.roll)
+ ])
+
+ global.viewer.flyToPosition(
+ new global.DC.Position(
+ Number(param.jd),
+ Number(param.wd),
+ 300,
+ Number(param.heading),
+ Number(param.pitch),
+ Number(param.roll)
+ ),
+ () => { },
+ 0.5
+ )
+ }
+ },
+
+ newPopup (item, obj) {
+ let position
+ if (this.twoOrThree == '三 维') {
+ position = global.DC.Transform.transformWGS84ToCartesian(
+ new global.DC.Position(Number(obj.lng), Number(obj.lat), Number(item.gd))
+ )
+ } else {
+ position = global.DC.Transform.transformWGS84ToCartesian(
+ new global.DC.Position(Number(item.jd), Number(item.wd), Number(50))
+ )
+ }
+
+ // eslint-disable-next-line no-unused-vars
+ var popup = new global.DC.DivForms(global.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>
-.map-campus-serarch {
+<style lang="scss" scope>
+.map-campus-search {
position: fixed;
top: 100px;
left: 0;
right: 0;
bottom: auto;
margin: auto;
- width: 320px;
- height: 40px;
+ 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: 240px;
+ width: 250px;
+ height: 40px;
border-radius: 5px 0 0 5px;
input {
+ box-sizing: border-box;
border-radius: 5px 0 0 5px;
}
}
@@ -69,11 +384,12 @@
.el-button {
margin: 0;
- position: relative;
+ padding: 0;
width: 40px;
- height: 40px;
+ height: 40px !important;
+ position: relative;
border-radius: 0;
- border: none;
+ border: 1px solid #dcdfe6;
i {
margin: auto;
@@ -85,9 +401,104 @@
}
}
+ .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: 40px;
+ width: 100%;
+ // height: 330px;
+ height: auto;
+ background: #fff;
+ border-radius: 5px;
+
+ .shortcut-box {
+ height: auto;
+ ul {
+ display: flex;
+ width: 100%;
+ height: auto;
+ // justify-content: space-around;
+ flex-wrap: wrap;
+
+ li {
+ margin: 22.5px 0 0 22.5px;
+ width: 80px;
+ height: 70px;
+
+ .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;
+
+ img {
+ margin-top: 4px;
+ width: 26px;
+ height: 26px;
+ }
+
+ span {
+ display: block;
+ font-size: 14px;
+ line-height: 28px;
+ }
+ }
+ }
+
+ .el-button:focus {
+ border: 1px solid #000;
+ }
+ }
+
+ li:last-child {
+ margin-bottom: 22.5px;
+ }
+ }
+ }
+ }
}
</style>
--
Gitblit v1.9.3