From b5f8881176bcb44928758e25d7d7a6fc140840c5 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 17 Dec 2021 15:06:23 +0800
Subject: [PATCH] 弹框完善

---
 src/components/map/index.vue |  259 ++++++++-------------------------------------------
 1 files changed, 44 insertions(+), 215 deletions(-)

diff --git a/src/components/map/index.vue b/src/components/map/index.vue
index 7f499cd..a6112c9 100644
--- a/src/components/map/index.vue
+++ b/src/components/map/index.vue
@@ -3,165 +3,24 @@
     <div id="viewer-container"
          style="height: 100%; width: 100%;">
 
-        <div v-show='popupFlag'
-             id="modelPopup"
-             style="width: 366px;
-                height: 240px;
-                background: url(/img/bg/nav-bg.jpeg) no-repeat;
-                background-size: 100% 100%;">
-            <div class="header">
-                <div class="logo">
-                    <img src="/img/navicon/map.png"
-                         alt="">
-                </div>
-                <div class="title">
-                    明德楼
-                </div>
-                <div class="close">
-                    <img src="/img/navicon/close.png"
-                         alt="">
-                </div>
-            </div>
-            <div class="content">
-                <div class="img">
-
-                </div>
-                <div class="meau">
-
-                </div>
-            </div>
-        </div>
-
-        <div id="map_popup_content">
-        </div>
-
-        <div ref="mapContentContent"
-             v-show="false"
-             id="map_content_content">
-            <div id="mapChildContent">
-                <div class="arc-bcg">
-                    <img :src="popupBgUrl"
-                         alt="">
-                </div>
-                <div class="popup-nav">
-                    <ul>
-                        <li class="come-here-fun"
-                            :terminus="terminus">
-                            <i class="popup-icon come-nav deblurring"></i>
-                            到这
-                        </li>
-                        <li class="get-to-fun"
-                            :startingPoint="startingPoint">
-                            <i class="popup-icon start-nav deblurring"></i>
-                            出发
-                        </li>
-                        <li class="qr-code-fun">
-                            <i class="popup-icon qr-code-nav deblurring"></i>
-                            二维码
-                        </li>
-                        <li class="imgs-fun">
-                            <i class="popup-icon atlas-nav deblurring"></i>
-                            图集
-                        </li>
-                        <li>
-                            <i class="popup-icon live-action-nav deblurring"></i>
-                            实景
-                        </li>
-                    </ul>
-                </div>
-                <div class="arc-box">
-                    <ul class="tab-btn">
-                        <li class="on">教学科研行政</li>
-                        <li>生活服务</li>
-                    </ul>
-                    <div class="btm-content">
-                        <div class="on">
-                            <ul>
-                                <li>
-                                    <i class="popup-icon location-icon deblurring"></i>
-                                    教学楼
-                                </li>
-                                <li>
-                                    <i class="popup-icon location-icon deblurring"></i>
-                                    教学楼
-                                </li>
-                            </ul>
-                        </div>
-                        <div>
-                            <ul>
-                                <li>
-                                    <i class="popup-icon location-icon deblurring"></i>
-                                    生活楼
-                                </li>
-                                <li>
-                                    <i class="popup-icon location-icon deblurring"></i>
-                                    生活楼
-                                </li>
-                            </ul>
-                        </div>
-                    </div>
-                </div>
-                <div class="btm-box"></div>
-            </div>
-        </div>
-
-        <!-- 二维码弹框相关 -->
-        <el-dialog title="场景二维码"
-                   :visible.sync="QRCodeFlag"
-                   width='44%'
-                   :before-close="handleClose">
-            <div style="margin: 0; position: relative; width: 100%; height: 352px;">
-                <img width="260"
-                     :src="pupupQRUrl"
-                     alt=""
-                     style="position: absolute;
-                    top: 0;
-                    left: 0;
-                    right: 0;
-                    bottom: 0;
-                    margin: auto">
-                <div style="position: absolute; bottom: 0; width: 100%; line-height: 36px; text-align: center;">
-                    (右键另存为图片)
-                </div>
-            </div>
-        </el-dialog>
-
         <left-nav ref="leftNav"></left-nav>
 
-        <campusNav ref="campusNavRoute"
-                   :comeName="comeName"
-                   :getToName="getToName"
-                   v-show="campusNavFlag" />
-
-        <el-image v-show="false"
-                  style="width: 100px; height: 100px"
-                  :src="url"
-                  :preview-src-list="srcList"
-                  ref="popupImgs">
-        </el-image>
-
+        <mapPopup />
     </div>
 </template>
 <script>
 
 import { mapGetters } from 'vuex'
-
-var $ = window.$
+import mapPopup from './component/mapPopup.vue'
 
 export default {
     name: 'mapBox',
+    components: {
+        mapPopup
+    },
     data () {
         return {
-            popupFlag: false,
-            campusNavFlag: false,
-            comeName: '',
-            getToName: '',
-            QRCodeFlag: false,
-            url: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
-            srcList: [
-                'https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg',
-                'https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg'
-            ]
+            DC: null
         }
     },
     computed: {
@@ -176,51 +35,25 @@
             // 点信息
             'pointPosition',
             // 点名称
-            'stateName'
+            'stateName',
+            // 地址
+            'siteName',
+            // 介绍
+            'introduceText',
+            // 全景地址
+            'panoramaUrl',
+            // 详情弹框显示关闭
+            'detailsPopup',
+            // 全景弹框显示关闭
+            'panoramaPopup'
         ])
     },
     mounted () {
         var that = this
 
-        this.$nextTick(() => {
-            // 动态添加dom元素,并绑定VUE事件(打开pdf)(.pdf-item为动态添加的元素,放置在父元素.pdf-body下)
-            $('#map_popup_content').on('click', '.arc-bcg', function () {
-                alert(1)
-            })
-
-            $('#map_popup_content').on('click', '.tab-btn li', function (e) {
-                $(this).addClass('on').siblings().removeClass('on')
-
-                $(this).parent().siblings().children(`div:eq(${$(this).index()})`).addClass('on').siblings().removeClass('on')
-            })
-
-            // 终点
-            $('#map_popup_content').on('click', '.popup-nav .come-here-fun', function (e) {
-                that.comeName = that.stateName
-                that.$store.commit('SET_TERMINUS', that.pointPosition)
-                if (that.campusNavFlag == false) that.campusNavFlag = true
-            })
-
-            // 起点
-            $('#map_popup_content').on('click', '.popup-nav .get-to-fun', function (e) {
-                that.getToName = that.stateName
-                that.$store.commit('SET_STARTINGPOINT', that.pointPosition)
-                if (that.campusNavFlag == false) that.campusNavFlag = true
-            })
-
-            $('#map_popup_content').on('click', '.popup-nav .qr-code-fun', function (e) {
-                that.QRCodeFlag = true
-            })
-
-            $('#map_popup_content').on('click', '.popup-nav .imgs-fun', function (e) {
-                console.log(that.$refs.popupImgs)
-                that.$refs.popupImgs.clickHandler()
-            })
-        })
-
-        var DC = global.DC
-
         let viewer
+
+        that.DC = global.DC
 
         function distanceSurface () {
             viewer.measure.distanceSurface()
@@ -281,7 +114,7 @@
         }
 
         function initViewer () {
-            viewer = new DC.Viewer('viewer-container', {
+            viewer = new that.DC.Viewer('viewer-container', {
                 contextOptions: {
                     webgl: {
                         stencil: true,
@@ -298,7 +131,7 @@
 
             popup.hide()
 
-            const baselayer = DC.ImageryLayerFactory.createArcGisImageryLayer({
+            const baselayer = that.DC.ImageryLayerFactory.createArcGisImageryLayer({
                 url:
                     'http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
             })
@@ -308,7 +141,7 @@
             })
 
             // eslint-disable-next-line camelcase
-            const baselayer_shaded = DC.ImageryLayerFactory.createArcGisImageryLayer({
+            const baselayer_shaded = that.DC.ImageryLayerFactory.createArcGisImageryLayer({
                 url:
                     'http://services.arcgisonline.com/arcgis/rest/services/World_Shaded_Relief/MapServer'
             })
@@ -318,7 +151,7 @@
             })
 
             // eslint-disable-next-line camelcase
-            const baselayer_street = DC.ImageryLayerFactory.createArcGisImageryLayer({
+            const baselayer_street = that.DC.ImageryLayerFactory.createArcGisImageryLayer({
                 url:
                     'http://services.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer'
             })
@@ -328,7 +161,7 @@
             })
 
             // eslint-disable-next-line camelcase
-            const baselayer_ter = DC.ImageryLayerFactory.createArcGisImageryLayer({
+            const baselayer_ter = that.DC.ImageryLayerFactory.createArcGisImageryLayer({
                 url:
                     'http://services.arcgisonline.com/arcgis/rest/services/World_Terrain_Base/MapServer'
             })
@@ -337,52 +170,55 @@
                 name: '地形'
             })
 
-            const layer = new DC.TilesetLayer('layer')
+            const layer = new that.DC.TilesetLayer('layer')
             viewer.addLayer(layer)
-            const tileset = new DC.Tileset(
+            const tileset = new that.DC.Tileset(
                 'http://resource.dvgis.cn/data/3dtiles/ljz/tileset.json'
             )
-            const style = new DC.TilesetStyle()
+            const style = new that.DC.TilesetStyle()
             style.color = {
                 conditions: [
+                    // eslint-disable-next-line no-template-curly-in-string
                     ['${Height} >= 300', 'rgba(45, 0, 75, 0.5)'],
+                    // eslint-disable-next-line no-template-curly-in-string
                     ['${Height} >= 200', 'rgb(102, 71, 151)'],
+                    // eslint-disable-next-line no-template-curly-in-string
                     ['${Height} >= 100', 'rgb(170, 162, 204)'],
+                    // eslint-disable-next-line no-template-curly-in-string
                     ['${Height} >= 50', 'rgb(224, 226, 238)'],
+                    // eslint-disable-next-line no-template-curly-in-string
                     ['${Height} >= 25', 'rgb(252, 230, 200)'],
+                    // eslint-disable-next-line no-template-curly-in-string
                     ['${Height} >= 10', 'rgb(248, 176, 87)'],
+                    // eslint-disable-next-line no-template-curly-in-string
                     ['${Height} >= 5', 'rgb(198, 106, 11)'],
+                    // eslint-disable-next-line no-template-curly-in-string
                     ['true', 'rgb(127, 59, 8)']
                 ]
             }
 
-            viewer.use(new DC.Measure())
+            viewer.use(new that.DC.Measure())
 
             tileset.setStyle(style)
             layer.addOverlay(tileset)
             viewer.flyTo(tileset)
 
-            tileset.on(DC.MouseEventType.CLICK, e => {
+            tileset.on(that.DC.MouseEventType.CLICK, e => {
                 // that.popupFlag = true
-
-                console.log(e.position)
 
                 viewer.scene.globe.depthTestAgainstTerrain = false
 
                 // 定制化窗体
-                var divForms = new DC.divForms(viewer, {
-                    domId: 'div1',
-                    title: '成教楼  ',
-                    className: 'divForms-dom',
-                    content: document.getElementById('mapChildContent'),
+                // eslint-disable-next-line no-unused-vars
+                var popup = new that.DC.DivForms(that.viewer, {
+                    domId: 'divFormsDomBox',
                     position: [
                         e.position
                     ]
                 })
 
-                // popup.setWrapper('<div></div>')
-
-                // popup.showAt(e.position, document.getElementById('modelPopup'))
+                that.$store.commit('SET_PANORAMAPOPUP', false)
+                that.$store.commit('SET_DETAILSPOPUP', true)
             })
 
             // viewer.zoomToPosition(
@@ -395,17 +231,10 @@
             viewer.distanceLegend.enable = true
         }
 
-        DC.ready(initViewer)
+        that.DC.ready(initViewer)
     },
     methods: {
-        closeCampusNav () {
-            this.campusNavFlag = false
-            this.$refs.campusNavRoute.clearLayer()
-            this.$store.commit('SET_STARTINGPOINT', null)
-            this.$store.commit('SET_TERMINUS', null)
-            this.comeName = ''
-            this.getToName = ''
-        }
+
     }
 }
 </script>

--
Gitblit v1.9.3