1
shuishen
2022-11-18 37a4a03e1ddef4f66904dccee54b684e73e9a3b2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<template>
    <div class="m-left-mobileCortrolButtom">
        <!-- 底部按钮
mobileCortrolButtom
        -->
        <!-- <div class="m-l-inbut" @click="mubiao"><i class="el-icon-s-help"></i></div> -->
        <div class="m-l-inbut" v-show="false">
            <!-- <i class="el-icon-s-flag"></i> -->
            <el-dropdown trigger="click" @command="handleCommand">
                <span class="el-dropdown-link icons">
                    <i class="el-icon-s-flag icon"></i>
                </span>
                <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item
                        v-for="(item, index) in tabTable"
                        :key="index"
                        :command="item"
                    >{{ item.title }}</el-dropdown-item>
                </el-dropdown-menu>
            </el-dropdown>
        </div>
        <div class="m-l-inbut" @click="openBigPopupAfter">
            <i class="el-icon-menu"></i>
        </div>
        <!-- <div class="m-l-inbut" @click="openActivity">
      <i class="el-icon-s-opportunity"></i>
        </div>-->
        <div class="m-l-inbut" @click="zoomIns">
            <i class="el-icon-refresh"></i>
        </div>
        <div class="m-l-inbut" @click="goOns">
            <i class="el-icon-location"></i>
        </div>
        <div class="m-l-inbut" @click="openOurSee">
            <i class="el-icon-map-location"></i>
        </div>
    </div>
</template>
 
<script>
import { mapGetters } from 'vuex'
import { getIp, getUsers } from '@/api/mobile/ip/index'
import { getListarc } from '@/api/mobile/public/arc'
import { getActivity } from '@/api/mobile/hd/hd'
 
export default {
    name: 'mobileCortrolButtom',
    data () {
        return {
            tabTable: [],
            ccData: [
                {
                    lnt: 114.03835559,
                    lat: 27.63057034
                },
                {
                    lnt: 114.03971446,
                    lat: 27.62986481
                },
                {
                    lnt: 114.03841654,
                    lat: 27.62919726
                },
                {
                    lnt: 114.039946,
                    lat: 27.62847544
                }
            ]
        }
    },
    props: ['mapCenter', 'frislayertHeight'],
    computed: {
        ...mapGetters([
            'openmobileGoTo',
            'dimensionData',
            // "startPointFn",
            'dimension'
        ])
    },
    created () {
        // this.getStreet();
    },
    mounted () {
        // eslint-disable-next-line no-undef
    },
    methods: {
        openOurSee () {
            this.$store.commit(
                'MSET_OPENMOBILEPANORAMA',
                'https://vr.jxpskj.com/JXSFKZQJ/QJ/' // sd
            )
        },
 
        goOns () {
            const that = this
 
            var options = { timeout: 8000 }// 设置定位超时
 
            window.geolocation.getLocation(showPosition, showErrow, options)
            // this.$store.commit('GET_NOWPOSITION', (res) => {
            //     that.$store.dispatch('pcMoveView', {
            //         jd: res[0],
            //         wd: res[1],
            //         viewer: global.viewer
            //     })
 
            //     const data = [
            //         {
            //             name: '我的位置',
            //             jd: res[0],
            //             wd: res[1]
            //         }
            //     ]
            //     that.$store.dispatch('addLabelLayerIconMobelUse', {
            //         list: data,
            //         clear: true,
            //         mviewer: global.viewer
            //     })
            // })
 
            function showPosition (result) {
                const position = global.DC.CoordTransform.GCJ02ToWGS84(result.lng, result.lat)
 
                const data = {
                    name: '我的位置',
                    jd: position[0],
                    wd: position[1]
                }
 
                // 师大
                if (position[0] > 116.009836 && position[0] < 116.045022 && position[1] > 28.664168 && position[1] < 28.699788) {
                    that.$store.dispatch('pcMoveView', {
                        jd: position[0],
                        wd: position[1],
                        viewer: global.viewer
                    })
                    that.$store.dispatch('addLabelLayerIconMobelUse', {
                        data: data,
                        clear: true,
                        mviewer: global.viewer
                    })
                } else {
                    that.$message({
                        message: '您当前位置超出学校范围',
                        type: 'warning'
                    })
                }
            }
 
            function showErrow (result) {
                if (result.code == 1) {
                    confirm('您拒绝了定位功能')
                } else if (result.code == 3 || result.code == 5) {
                    confirm('请求超时')
                }
            }
        },
 
        zoomIns (val) {
            // this.$store.dispatch("mapFlyTo", {
            //   //飞入
            //   lntLat: [115.87988885, 28.72502592, 2100],
            //   // lntLat: [115.87186406, 28.74449337, 1200],
            //   // lntLat: [121.50492752204283, 31.21567802276832, 2530],
            //   heading: 0,
            //   pitch: -45,
            //   roll: 0,
            //   noOpen: true,
            // });
            //   if (val) {
            //     if (this.dimension != val) {
            //       this.$store.dispatch("MSET_DIMENSIONS", val);
            //     }
            //     return;
            //   }
            var that = this
 
            global.viewer.flyToPosition(
                new global.DC.Position(
                    that.mapCenter[0],
                    that.mapCenter[1],
                    that.frislayertHeight,
                    that.dimensionData.heading,
                    that.dimensionData.pitch,
                    that.dimensionData.roll
                ),
                () => {
 
                },
                0
            )
        },
 
        openActivity () {
            const d = {
                main: [
                    {
                        name: '活动',
                        type: 1,
                        method: getActivity
                    }
                ],
                qurey: '活动'
            }
            this.$store.commit('MSET_POPUPOUROPENDATA', d)
            this.$store.commit('MSET_BIGPOPUP', { name: '活动' })
            // this.$store.commit("set_showActivity", true);
        },
        mubiao () {
            // 测试fllyTo
        },
        handleCommand (command) {
            const that = this
            const position = [+command.lnt + 0.00027, +command.lat + 0.00048, 450]
            // 定位
            // this.$store.commit("MSETCC_SETCC", {
            //   lntLat: position,
            // });
            // this.$store.dispatch("mapFlyTo", {
            //   //飞入
            //   lntLat: [...position, 450],
            //   heading: 0,
            //   pitch: -90,
            //   roll: 0,
            //   noOpen: true,
            // });
            global.viewer.camera.setView({
                // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
                // fromDegrees()方法,将经纬度和高程转换为世界坐标
                // eslint-disable-next-line new-cap
                destination: new global.DC.Namespace.Cesium.Cartesian3.fromDegrees(
                    // 114.0351,
                    // 27.6314,
                    // 200.0
                    position[0],
                    position[1],
                    position[2]
                ),
                orientation: {
                    heading: global.DC.Namespace.Cesium.Math.toRadians(
                        that.dimensionData.heading
                    ),
                    pitch: global.DC.Namespace.Cesium.Math.toRadians(
                        that.dimensionData.pitch
                    ),
                    // heading: data.heading,
                    // pitch: data.pitch,
                    roll: that.dimensionData.roll
                }
            })
        },
        openBigPopupAfter () {
            this.$store.commit('MSET_BIGPOPUPAFTER', true)
        },
        goOn () {
            const that = this
            this.$store.commit('MSET_OPENMOBILEGOTO', !that.openmobileGoTo)
            // let data = {
            //   ip: returnCitySN["cip"],
            //   key: "7WKBZ-QDY62-WEEUG-C7KUN-ADAF5-L5BKZ",
            // };
            // getIp(data).then((res) => {
            //   // getUsers(data).then((res) => {
            // });
        },
        getStreet () {
            const that = this
            getListarc().then((res) => {
                const 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)
            })
        }
    },
    destroyed () {
 
    }
}
</script>
 
<style scoped lang="scss">
.m-left-mobileCortrolButtom {
    position: fixed;
    bottom: 35px;
    left: 20px;
    z-index: 200;
    .m-l-inbut {
        float: left;
        width: 39px;
        height: 39px;
        background-color: rgb(33, 150, 243);
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 32px;
        margin-left: 12px;
        border-radius: 5px;
        .icons {
            display: inline-block;
            width: 100%;
            height: 100%;
        }
        .icon {
            font-size: 32px;
            color: #fff;
            &::before {
                width: 100%;
                height: 100%;
            }
        }
    }
}
</style>