forked from drone/command-center-dashboard

罗广辉
2025-04-21 2800fa4f32f3900509cb4d6eefaf2bfaf54efdd7
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
<template>
    <div class="ai-chat" v-show="isHideBottomIcon">
        <el-popover placement="bottom" :visible="visible" :width="200" trigger="click">
            <template #reference>
                <div class="chat" id="chatID" v-drag:chatID @mousedown="handleMouseDown" @mouseup="handleMouseUp" />
            </template>
            <div>
                快和我对话吧
                <el-input />
            </div>
        </el-popover>
        <img class="chat-bottom" src="../../assets/images/chat-bottom.png" alt="" />
    </div>
    <div class="r-side" v-show="isHideBottomIcon">
        <img
            v-for="(item, index) in images"
            :key="index"
            :class="item.class"
            :src="activeIndex === index ? item.activeSrc : item.src"
            alt=""
            @click="activeChange(index)"
            @mouseenter="enterHover(index)"
            @mouseleave="logIndex = 3"
        />
    </div>
    <div v-if="logIndex === 0" class="r-side-positioning">返回当前位置</div>
    <div v-if="logIndex === 1" class="r-side-measuring">量尺</div>
    <div v-if="logIndex === 2" class="r-side-layer">切换地图模式</div>
    <MeasuringDistance v-if="activeIndex === 1" />
 
</template>
 
<script setup>
import vDrag from '@/directive/drag'
import MeasuringDistance from '@/components/MeasuringDistance.vue'
import dw from '@/assets/images/rSide/dw.png'
import dw1 from '@/assets/images/rSide/dw1.png'
import lc from '@/assets/images/rSide/lc.png'
import lc1 from '@/assets/images/rSide/lc1.png'
import tc from '@/assets/images/rSide/tc.png'
import tc1 from '@/assets/images/rSide/tc1.png'
import cesiumOperation from '@/utils/cesium-tsa'
import { ElMessage } from 'element-plus'
 
let logIndex = ref(3)
const enterHover = value => {
    logIndex.value = value
}
const { flyTo } = cesiumOperation()
 
const store = useStore()
const currentAreaPosition = computed(() => store.state.home.currentAreaPosition)
// 事件概况 展开隐藏
const isHideBottomIcon = computed(() => store.state.common.isHideBottomIcon)
 
let activeIndex = ref(null)
const activeChange = value => {
    if (value === 0) {
        flyTo(currentAreaPosition.value, 0, currentAreaPosition.value.height)
    }
    if (value === 1) {
        activeIndex.value = activeIndex.value === 1 ? null : value
    }
    if (value === 2) {
        ElMessage.warning('加急开发中...')
        activeIndex.value = activeIndex.value === 2 ? null : value
    }
}
const visible = ref(false)
let pressStart = 0
 
const handleMouseDown = () => {
    pressStart = Date.now() // 记录按下时间
}
 
const handleMouseUp = () => {
    const pressDuration = Date.now() - pressStart // 计算按下时长
    if (pressDuration < 150) {
        // 如果按下时间小于200ms,认为是点击
        visible.value = !visible.value
    }
}
 
// 添加: 定义图片数组
const images = [
    { class: 'positioning', src: dw, activeSrc: dw1 },
    { class: 'measuring-scale', src: lc, activeSrc: lc1 },
    { class: 'layer', src: tc, activeSrc: tc1 },
]
</script>
 
<style scoped lang="scss">
.ai-chat {
  position: absolute;
  bottom: 309px;
  right: 440px;
  cursor: pointer;
  img {
    width: 100px;
    height: 68px;
    display: block;
  };
  .chat {
    position: fixed;
    top: 638px;
    height: 124px;
    width: 100px;
    user-select: none;
    z-index: 999;
    background: url('@/assets/images/chat.png') no-repeat center / 100% 100%;
  }
}
.r-side {
    position: absolute;
    bottom: 122px;
    right: 463px;
    cursor: pointer;
    img {
        display: block;
        width: 48px;
        height: 48px;
    }
    .positioning {
        position: relative;
        bottom: 24px;
    }
    .measuring-scale {
        position: relative;
        bottom: 12px;
    }
}
.r-side-positioning,
.r-side-measuring,
.r-side-layer {
    position: absolute;
    right: 514px;
    width: 130px;
    height: 48px;
    font-family: Source Han Sans CN, Source Han Sans CN;
    font-weight: 400;
    font-size: 18px;
    color: #ffffff;
    line-height: 48px;
    text-align: center;
    background: url('@/assets/images/cursor.png');
}
.r-side-positioning {
    bottom: 242px;
}
.r-side-measuring {
    bottom: 182px;
}
.r-side-layer {
    bottom: 122px;
}
</style>