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/mapPopup.vue |  587 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 532 insertions(+), 55 deletions(-)

diff --git a/src/components/map/components/mapPopup.vue b/src/components/map/components/mapPopup.vue
index 1553ac3..94c2391 100644
--- a/src/components/map/components/mapPopup.vue
+++ b/src/components/map/components/mapPopup.vue
@@ -19,7 +19,7 @@
                                             v-show="introduceText != null && introduceText != ''"
                                             @click="audioPlay"
                                             class="audio-control"
-                                            src="/img/navicon/audio.png"
+                                            :src="audioImgUrl"
                                             alt
                                         />
                                         <img
@@ -66,7 +66,7 @@
                                                     <i class="popup-icon start-nav deblurring"></i>
                                                     出发
                                                 </li>
-                                                <li v-show="false" @click="qrCodeClick">
+                                                <li v-show="pupupQRUrl != ''" @click="qrCodeClick">
                                                     <i class="popup-icon qr-code-nav deblurring"></i>
                                                     二维码
                                                 </li>
@@ -164,6 +164,12 @@
                                 id="FullScreenBox"
                             >
                                 <div class="title">
+                                    <img
+                                        @click="returnDetailsPopup"
+                                        class="return-btn"
+                                        src="/img/icon/return.png"
+                                        alt
+                                    />
                                     {{ stateName }}
                                     <img
                                         @click="screen"
@@ -198,6 +204,12 @@
                         <div class="monitor-wrap">
                             <div class="content-wrap">
                                 <div class="title">
+                                    <img
+                                        @click="returnDetailsPopup"
+                                        class="return-btn"
+                                        src="/img/icon/return.png"
+                                        alt
+                                    />
                                     {{ stateName }}
                                     <img
                                         @click="closeMonitorPopupBox"
@@ -207,7 +219,10 @@
                                     />
                                 </div>
                                 <div class="content">
-                                    <video :src="monitorUrl" controls autoplay></video>
+                                    <play-video
+                                        :sourceUrl="monitorUrl"
+                                        @playStatus="changePlayStatus"
+                                    ></play-video>
                                 </div>
                             </div>
                         </div>
@@ -268,7 +283,7 @@
                                 <div class="arrow-rb"></div>
                                 <div class="label-wrap">
                                     <div class="title">
-                                        {{ nowlabelLayerData.name }} &nbsp; 二维码分享
+                                        {{ nowlabelLayerData.name }}
                                         <img
                                             @click="closelabelLayerid"
                                             class="close-box"
@@ -292,6 +307,110 @@
                         </div>
                         <div class="arrow"></div>
                     </div>
+                </div>
+            </div>
+        </div>
+
+        <!-- 新增编辑标签 -->
+        <div v-if="addIconsLayerIconPopup" class="monitor-dom add-sign-box-style" id="leftNavsAdd">
+            <div style="width: 100%; height: 100%">
+                <div class="divForms divForms-theme">
+                    <div class="divForms-wrap">
+                        <div class="area">
+                            <div class="arrow-lt"></div>
+                            <div class="b-t"></div>
+                            <div class="b-r"></div>
+                            <div class="b-b"></div>
+                            <div class="b-l"></div>
+                            <div class="arrow-rb"></div>
+                            <div class="label-wrap">
+                                <div class="title">
+                                    <el-input
+                                        v-model="addIconFromcolumn[0].value"
+                                        placeholder="请输入标签名称"
+                                        class="addIconFromInput"
+                                    >
+                                        <template slot="prepend">标题:</template>
+                                    </el-input>
+                                    <img
+                                        @click="closeaddIconsLayerIconPopup"
+                                        class="close-box"
+                                        src="/img/navicon/close.png"
+                                        alt
+                                    />
+                                </div>
+                                <div class="add-tag-content">
+                                    <div class="addIconsLayer">
+                                        <div
+                                            :class="[
+                        'addIconsLayerinimgs',
+                        ourImages.length > 3 ? 'isOverImgs' : '',
+                      ]"
+                                        >
+                                            <!-- action="https://jsonplaceholder.typicode.com/posts/" -->
+                                            <el-upload
+                                                :action="
+                          apiUrls +
+                          '/blade-resource/oss/endpoint/put-files-talk'
+                        "
+                                                list-type="picture-card"
+                                                :on-preview="handlePictureCardPreview"
+                                                :on-remove="handleRemove"
+                                                :on-success="onsuccess"
+                                            >
+                                                <i class="el-icon-plus"></i>
+                                            </el-upload>
+                                            <el-dialog
+                                                :visible.sync="dialogVisible"
+                                                :modal-append-to-body="false"
+                                                :append-to-body="true"
+                                            >
+                                                <img width="100%" :src="dialogImageUrl" alt />
+                                            </el-dialog>
+                                        </div>
+                                        <div
+                                            class="addIconsLayerin"
+                                            v-for="(item, index) in addIconFromcolumn"
+                                            :key="index"
+                                            v-show="index != 0"
+                                        >
+                                            <el-input
+                                                v-model="item.value"
+                                                :placeholder="'请输入' + item.label"
+                                                class="addIconFromInput"
+                                                :disabled="index == 2 || index == 3"
+                                            >
+                                                <template slot="prepend">{{ item.label }}:</template>
+                                            </el-input>
+
+                                            <el-dropdown
+                                                v-show="index == 2 || index == 3"
+                                                @command="chouseAddicon"
+                                            >
+                                                <span class="el-dropdown-link">
+                                                    <i class="el-icon-arrow-down el-icon--right"></i>
+                                                </span>
+                                                <el-dropdown-menu slot="dropdown">
+                                                    <el-dropdown-item
+                                                        v-for="(itemc, indexc) in item.chouse"
+                                                        :key="indexc"
+                                                        :command="{ index: index, indexc: indexc }"
+                                                    >{{ itemc.value }}</el-dropdown-item>
+                                                    <!-- @click="chouseAddicon(index, indexc)" -->
+                                                </el-dropdown-menu>
+                                            </el-dropdown>
+                                        </div>
+                                    </div>
+                                    <div class="addIconsLayerBut">
+                                        <el-button type="primary" @click="saveIconsLayer">保存标签</el-button>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                        <div class="b-t-l"></div>
+                        <div class="b-b-r"></div>
+                    </div>
+                    <div class="arrow"></div>
                 </div>
             </div>
         </div>
@@ -344,14 +463,20 @@
 import { mapGetters } from 'vuex'
 import { getMechanismDetail } from '@/api/pc/public/arc'
 import { setlabel } from '@/api/pc/label'
+import { add } from '@/api/pc/leftNav/index'
 
 export default {
     name: 'mapPopup',
+
     data () {
         return {
-            DC: null,
+            ourImages: [],
+            dialogImageUrl: '',
+            dialogVisible: false,
+            apiUrls: null,
             tabBtnFlag: '教学科研行政',
             QRCodeFlag: false,
+            audioImgUrl: '/img/icon/close-video.png',
             audioSource: '',
             audioFlag: false,
             audioCourse: false,
@@ -360,12 +485,216 @@
             fullscreen: false,
             fullScreenUrl: '/img/icon/bigScreen.png',
             addTagName: '',
-            addTagLayer: null
+            addIconFromcolumn: [
+                // 顺序不要随便换
+                {
+                    label: '名称',
+                    prop: 'mechanismname',
+                    value: ''
+                },
+                {
+                    label: '电话',
+                    prop: 'telephone',
+                    value: ''
+                },
+                {
+                    label: '所属建筑',
+                    prop: 'type',
+                    dicUrl: '/api/blade-system/dict-biz/dictionary?code=building',
+                    props: {
+                        label: 'dictValue',
+                        value: 'dictKey'
+                    },
+                    value: '红旗校区',
+                    valueid: '1',
+                    chouse: [
+                        {
+                            id: '1',
+                            value: '红旗校区'
+                        },
+                        {
+                            id: '2',
+                            value: '黄河路'
+                        },
+                        {
+                            id: '3',
+                            value: '科学园'
+                        },
+                        {
+                            id: '4',
+                            value: '土木楼'
+                        },
+                        {
+                            id: '5',
+                            value: '三江校区'
+                        }
+                    ]
+                },
+                {
+                    label: '所属社区',
+                    searchLabelWidth: '110',
+                    value: '行政办公',
+                    valueid: '1',
+                    prop: 'campus',
+                    dicUrl: '/api/blade-system/dict-biz/dictionary?code=campus',
+                    chouse: [
+                        {
+                            id: '1',
+                            value: '行政办公'
+                        },
+                        {
+                            id: '2',
+                            value: '教学科研'
+                        },
+                        {
+                            id: '3',
+                            value: '社区场馆'
+                        },
+                        {
+                            id: '4',
+                            value: '学生宿舍'
+                        },
+                        {
+                            id: '5',
+                            value: '文化风景'
+                        },
+                        {
+                            id: '6',
+                            value: '家属住宅'
+                        },
+                        {
+                            id: '7',
+                            value: '主要楼宇'
+                        }
+                    ]
+                },
+
+                {
+                    label: '介绍',
+                    prop: 'introduce',
+                    value: '',
+                    component: 'AvueUeditor',
+                    options: {
+                        action: '/api/blade-resource/oss/endpoint/put-file',
+                        props: {
+                            res: 'data',
+                            url: 'link'
+                        }
+                    },
+                    hide: true,
+                    minRows: 5,
+                    span: 24
+                },
+                {
+                    label: '地址',
+                    hide: true,
+                    prop: 'address',
+                    value: ''
+                },
+                {
+                    label: '全景地址',
+                    prop: 'panoramaurl',
+                    value: ''
+                },
+                {
+                    label: '监控地址',
+                    hide: true,
+                    prop: 'videourl',
+                    value: ''
+                },
+                {
+                    label: '网站地址',
+                    prop: 'websiteurl',
+                    value: ''
+                },
+                {
+                    label: '经度',
+                    prop: 'jd',
+                    value: '',
+                    rules: [
+                        {
+                            required: true,
+                            message: '请输入经度',
+                            trigger: 'blur'
+                        }
+                    ]
+                },
+                {
+                    label: '纬度',
+                    prop: 'wd',
+                    value: '',
+                    rules: [
+                        {
+                            required: true,
+                            message: '请输入纬度',
+                            trigger: 'blur'
+                        }
+                    ]
+                },
+                {
+                    label: '偏航角',
+                    addDisplay: false,
+                    hide: true,
+                    prop: 'heading',
+                    value: 0
+                },
+                {
+                    label: '俯仰角',
+                    addDisplay: false,
+                    hide: true,
+                    prop: 'pitch',
+                    value: -90
+                },
+                {
+                    label: '翻转角',
+                    addDisplay: false,
+                    hide: true,
+                    prop: 'roll',
+                    value: 0
+                },
+
+                {
+                    label: '高度',
+                    hide: true,
+                    addDisplay: false,
+                    prop: 'gd',
+                    value: 0
+                }
+
+                // {
+                //   label: "图片",
+                //   prop: "tpurl",
+                //   value: "",
+                //   // dataType: 'string',
+                //   type: "upload",
+                //   propsHttp: {
+                //     res: "data",
+                //     url: "link",
+                //   },
+                //   span: 10,
+                //   listType: "picture-card",
+                //   tip: "只能上传jpg/png文件,且不超过500kb",
+                //   action: "/api/blade-resource/oss/endpoint/put-file",
+                // },
+                // {
+                //   label: "二维码",
+                //   prop: "codeurl",
+                //   value: "",
+                //   type: "upload",
+                //   listType: "picture-card",
+                //   //dataType: 'string',
+                //   action: "/api/blade-resource/oss/endpoint/put-file",
+                //   propsHttp: {
+                //     res: "data",
+                //     url: "link",
+                //   },
+                //   span: 10,
+                // },
+            ]
         }
     },
     computed: {
         ...mapGetters([
-            'viewer',
             'popupBgUrl',
             'pupupQRUrl',
             // 终点
@@ -404,23 +733,50 @@
             'addTagPosition',
             // 自定义标签弹窗
             'labelLayerDataShow',
-            'nowlabelLayerData'
+            'nowlabelLayerData',
+            'addIconsLayerIconPopup', // 自定义标签编辑窗口
+            'addIconsLayerIconPosition' // 自定义标签坐标
         ])
     },
     created () {
-        this.DC = global.DC
+        var that = this
+        this.apiUrls = window.$apiUrls
 
         this.audioSynth = window.speechSynthesis
         this.audioMsg = new window.SpeechSynthesisUtterance()
 
-        this.audioMsg.onend = function () {
-            this.audioSynth.cancel()
-            this.audioFlag = false
-            this.audioCourse = false
-        }
+        this.$nextTick(() => {
+            this.audioMsg.onend = function () {
+                that.audioSynth.cancel()
+                that.audioFlag = false
+                that.audioCourse = false
+                that.audioImgUrl = '/img/icon/close-video.png'
+            }
+        })
     },
-    mounted () { },
     watch: {
+        addIconsLayerIconPopup () {
+            if (this.addIconsLayerIconPopup) {
+                this.addIconFromcolumn[9].value = this.addIconsLayerIconPosition[0]
+                this.addIconFromcolumn[10].value = this.addIconsLayerIconPosition[1]
+            } else {
+                for (const k in this.addIconFromcolumn) {
+                    if (k == 2) {
+                        this.addIconFromcolumn[k].value = '红旗校区'
+                        this.addIconFromcolumn[k].valueid = '1'
+                        continue
+                    }
+                    if (k == 3) {
+                        this.addIconFromcolumn[k].value = '行政办公'
+                        this.addIconFromcolumn[k].valueid = '1'
+                        continue
+                    }
+                    this.addIconFromcolumn[k].value = ''
+                }
+                this.ourImages = []
+                this.$store.commit('set_closeMapClick', false) // 开启其他操作
+            }
+        },
         addTagPopup () {
             if (!this.addTagPopup) {
                 // console.log("取消", "see");
@@ -435,6 +791,7 @@
                     this.audioSynth.cancel()
                     this.audioFlag = false
                     this.audioCourse = false
+                    this.audioImgUrl = '/img/icon/close-video.png'
                 }
             }
         },
@@ -458,20 +815,94 @@
             immediate: true,
             handler (newCode, oldCode) {
                 if (newCode == false) {
-                    this.audioSynth.cancel()
+                    if (this.audioSynth != null) {
+                        this.audioSynth.cancel()
+                    }
                     this.audioFlag = false
                     this.audioCourse = false
                 } else {
                     if (this.audioFlag == true) {
-                        this.audioSynth.cancel()
+                        if (this.audioSynth != null) {
+                            this.audioSynth.cancel()
+                        }
                         this.audioFlag = false
                         this.audioCourse = false
+                        this.audioImgUrl = '/img/icon/close-video.png'
                     }
                 }
             }
         }
     },
     methods: {
+        onsuccess (response, file, fileList) {
+            this.ourImages = fileList
+        },
+        handleRemove (file, fileList) {
+            this.ourImages = fileList
+        },
+        handlePictureCardPreview (file) {
+            this.dialogImageUrl = file.url
+            this.dialogVisible = true
+        },
+        chouseAddicon (item) {
+            this.addIconFromcolumn[item.index].value =
+                this.addIconFromcolumn[item.index].chouse[item.indexc].value
+            this.addIconFromcolumn[item.index].valueid =
+                this.addIconFromcolumn[item.index].chouse[item.indexc].id
+        },
+        closeaddIconsLayerIconPopup () {
+            this.$store.commit('SET_addIconsLayerIconPopup', false)
+        },
+        saveIconsLayer () {
+            var imgs = []
+            // console.log("see", this.ourImages);
+            // return;
+            for (var k in this.ourImages) {
+                imgs.push(this.ourImages[k].response)
+            }
+            const d = {
+                tpurl: imgs.join(','),
+                mechanismname: this.addIconFromcolumn[0].value,
+                telephone: this.addIconFromcolumn[1].value,
+                type: this.addIconFromcolumn[2].valueid,
+                campus: this.addIconFromcolumn[3].valueid,
+                introduce: this.addIconFromcolumn[4].value,
+                address: this.addIconFromcolumn[5].value,
+                panoramaurl: this.addIconFromcolumn[6].value,
+                videourl: this.addIconFromcolumn[7].value,
+                websiteurl: this.addIconFromcolumn[8].value,
+                jd: this.addIconFromcolumn[9].value,
+                wd: this.addIconFromcolumn[10].value,
+                heading: this.addIconFromcolumn[11].value,
+                pitch: this.addIconFromcolumn[12].value,
+                roll: this.addIconFromcolumn[13].value,
+                gd: this.addIconFromcolumn[14].value
+            }
+            // console.log(d, "see3");
+            // return;
+            // this.$store.commit("set_closeMapClick", false); //开启其他操作
+            add(d).then(
+                (res) => {
+                    // console.log(res);
+                    if (res.data.code == 200) {
+                        this.$message({
+                            type: 'success',
+                            message: '操作成功!'
+                        })
+                    } else {
+                        this.$message({
+                            type: 'error',
+                            message: '新增失败!'
+                        })
+                    }
+
+                    this.closeaddIconsLayerIconPopup()
+                },
+                (error) => {
+                    window.console.log(error)
+                }
+            )
+        },
         screen () {
             if (this.fullscreen) {
                 this.fullScreenUrl = '/img/icon/bigScreen.png'
@@ -519,16 +950,17 @@
                 this.audioSynth.cancel()
                 this.audioFlag = false
                 this.audioCourse = false
+                this.audioImgUrl = '/img/icon/close-video.png'
             }
 
             // eslint-disable-next-line new-cap
-            var positions = this.DC.Transform.transformWGS84ToCartesian(
+            var positions = global.DC.Transform.transformWGS84ToCartesian(
                 // eslint-disable-next-line new-cap
-                new this.DC.Position.fromArray(this.pointPosition)
+                new global.DC.Position.fromArray(this.pointPosition)
             )
-            this.viewer.scene.globe.depthTestAgainstTerrain = false
+
             // eslint-disable-next-line no-unused-vars
-            var panorama = new this.DC.PanoramaBox(this.viewer, {
+            var panorama = new global.DC.PanoramaBox(global.viewer, {
                 domId: 'PanoramaBox',
                 position: [positions]
             })
@@ -543,15 +975,15 @@
                 this.audioSynth.cancel()
                 this.audioFlag = false
                 this.audioCourse = false
+                this.audioImgUrl = '/img/icon/close-video.png'
             }
             // eslint-disable-next-line new-cap
-            var positions = this.DC.Transform.transformWGS84ToCartesian(
+            var positions = global.DC.Transform.transformWGS84ToCartesian(
                 // eslint-disable-next-line new-cap
-                new this.DC.Position.fromArray(this.pointPosition)
+                new global.DC.Position.fromArray(this.pointPosition)
             )
-            this.viewer.scene.globe.depthTestAgainstTerrain = false
             // eslint-disable-next-line no-unused-vars
-            var monitor = new this.DC.PanoramaBox(this.viewer, {
+            var monitor = new global.DC.PanoramaBox(global.viewer, {
                 domId: 'MonitorBox',
                 position: [positions]
             })
@@ -560,11 +992,34 @@
             this.$store.commit('SET_MONITORPOPUP', true)
         },
 
+        returnDetailsPopup () {
+            var positions = global.DC.Transform.transformWGS84ToCartesian(
+                // eslint-disable-next-line new-cap
+                new global.DC.Position.fromArray(this.pointPosition)
+            )
+
+            // eslint-disable-next-line no-unused-vars
+            var divBox = new global.DC.PanoramaBox(global.viewer, {
+                domId: 'divFormsDomBox',
+                position: [positions]
+            })
+
+            global.viewer.zoomToPosition(
+                // eslint-disable-next-line new-cap
+                new global.DC.Position.fromArray(this.pointPosition)
+            )
+
+            this.$store.commit('SET_DETAILSPOPUP', true)
+            this.$store.commit('SET_MONITORPOPUP', false)
+            this.$store.commit('SET_PANORAMAPOPUP', false)
+        },
+
         closeMapPopupBox () {
             if (this.audioFlag == true) {
                 this.audioSynth.cancel()
                 this.audioFlag = false
                 this.audioCourse = false
+                this.audioImgUrl = '/img/icon/close-video.png'
             }
             this.$store.commit('SET_DETAILSPOPUP', false)
         },
@@ -590,11 +1045,6 @@
 
             this.$store.commit('SET_ADDTAGPOPUP', false)
 
-            //   if (this.addTagLayer == null) {
-            //     this.addTagLayer = new this.DC.HtmlLayer("addTagLayer");
-            //     this.viewer.addLayer(this.addTagLayer);
-            //   }
-
             // 2022.3.2对接接口
             // 新增标签
             const data = {
@@ -603,8 +1053,14 @@
                 wd: this.addTagPosition.lat
             }
             //   console.log(data);
+            const oks = setTimeout(() => {
+                that.$message({
+                    message: '新增标签失败',
+                    type: 'warning'
+                })
+            }, 5000)
             setlabel(data).then((res) => {
-                console.log(res)
+                clearTimeout(oks)
                 if (res.data.code == 200) {
                     doit()
                     that.$message({
@@ -624,24 +1080,6 @@
                     // list: [data],
                     add: true
                 })
-                // const divIcon = new this.DC.DivIcon(
-                //   new that.DC.Position(
-                //     Number(that.addTagPosition.lng),
-                //     Number(that.addTagPosition.lat),
-                //     0
-                //   ),
-                //   `
-                //                 <div class="tag-entitys-box">
-                //                     <div class="tag-content">
-                //                         ${that.addTagName}
-                //                     </div>
-                //                     <div class="tag-angle-content">
-                //                         <img src="https://map.hit.edu.cn/images/tarrow_xq.png">
-                //                     </div>
-                //                 </div>
-                //             `
-                // );
-                // this.addTagLayer.addOverlay(divIcon);
             }
         },
 
@@ -655,19 +1093,26 @@
             this.$store.commit('SET_MONITORPOPUP', false)
         },
 
+        changePlayStatus (status) { // 获取子组件的播放状态
+            console.log(status)
+        },
+
         audioPlay () {
             if (this.audioFlag == false) {
                 this.audioMsg.text = this.audioSource
                 this.audioSynth.speak(this.audioMsg)
                 this.audioFlag = true
                 this.audioCourse = true
+                this.audioImgUrl = '/img/icon/start-video.png'
             } else {
                 if (this.audioCourse == true) {
                     this.audioSynth.pause()
                     this.audioCourse = false
+                    this.audioImgUrl = '/img/icon/close-video.png'
                 } else {
                     this.audioSynth.resume()
                     this.audioCourse = true
+                    this.audioImgUrl = '/img/icon/start-video.png'
                 }
             }
         },
@@ -700,8 +1145,8 @@
                 }
 
                 this.newPopup(result)
-                this.viewer.flyToPosition(
-                    new this.DC.Position(
+                global.viewer.flyToPosition(
+                    new global.DC.Position(
                         Number(result.jd),
                         Number(result.wd),
                         300,
@@ -716,11 +1161,15 @@
         },
 
         newPopup (item) {
-            const position = this.DC.Transform.transformWGS84ToCartesian(
-                new this.DC.Position(Number(item.jd), Number(item.wd), Number(item.gd))
+            const position = global.DC.Transform.transformWGS84ToCartesian(
+                new global.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, {
+            var popup = new global.DC.DivForms(global.viewer, {
                 domId: 'divFormsDomBox',
                 position: [position]
             })
@@ -740,9 +1189,37 @@
 }
 </script>
 
-<style>
+<style lang="scss">
 .labelLayeridewm {
     width: 250px !important;
     height: 250px !important;
 }
+
+.add-sign-box-style {
+    input:-moz-placeholder,
+    textarea:-moz-placeholder {
+        color: #fff;
+    }
+    input:-ms-input-placeholder,
+    textarea:-ms-input-placeholder {
+        color: #fff;
+    }
+    input::-webkit-input-placeholder,
+    textarea::-webkit-input-placeholder {
+        color: #fff;
+    }
+
+    .addIconsLayerinimgs {
+        margin-top: 4px;
+    }
+
+    .addIconsLayerin {
+        padding: 0 10px;
+    }
+}
+.introduce p {
+    padding: 0px;
+    height: 300px;
+    overflow-y: scroll;
+}
 </style>

--
Gitblit v1.9.3