forked from drone/command-center-dashboard

罗广辉
2025-04-19 f4d175265d2d7dee11af9ef1ad075cd223eb0abd
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
<template>
    <div class="manualControl">
        <div class="manualControlBg">
            <div class="manualControlBorder">
                <div class="manualControlCenter">
                    <img :src="controlCenterImg" alt="" />
                </div>
            </div>
            <div
                v-for="item in list3"
                :key="item.name"
                :style="item.style"
                class="operateBtn"
                :title="item.name"
                :class="item.active ? 'active' : ''"
                @click="item.handle"
            ></div>
            <SvgIcon
                v-for="(item, index) in list3"
                :name="item.svg"
                :class="`${'btnIcon-' + index} btnIcon ${item.active ? 'active' : ''}`"
                :style="item.imgStyle"
            />
        </div>
    </div>
</template>
 
<script setup>
import controlCenterImg from '@/assets/images/taskManagement/taskIntermediateContent/controlCenter.png'
import SvgIcon from '@/components/SvgIcon.vue'
import EventBus from '@/event-bus'
 
const isAutoControl = inject('isAutoControl')
 
const list3 = computed(() => [
    { name: '自动控制', svg: 'autoControl', style: { top: '-70%' }, active: isAutoControl.value, handle: autoControl },
    { name: '继续任务', svg: 'continueTask', style: { left: '70%' }, active: false, handle: autoControl },
    {
        name: '手动控制',
        svg: 'manualControl',
        style: { top: '70%' },
        active: !isAutoControl.value,
        handle: manualControl,
    },
    { name: '返航/取消返航', svg: 'turnBack', style: { left: '-70%' }, active: false, handle: turnBack },
])
 
function autoControl() {
    isAutoControl.value = true
    EventBus.emit('controlPanel-cancelControl')
}
 
function manualControl() {
    EventBus.emit('controlPanel-control')
}
 
function turnBack() {
    isAutoControl.value = true
    EventBus.emit('controlPanel-returnOrCancelReturn')
}
</script>
 
<style scoped lang="scss">
.manualControl {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 188px;
    height: 188px;
    background: rgb(0, 0, 0, 0.4); /* 半透明背景 */
    border-radius: 40px 40px 40px 40px;
 
    .manualControlBg {
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        width: 165px;
        height: 165px;
        border-radius: 50%;
        position: relative;
        background: radial-gradient(circle, #5d5c5e 0%, #514f52 50%, #3d3b3d 100%);
 
        .operateBtn {
            position: absolute;
            width: 100%;
            height: 100%;
            transform: rotate(45deg);
 
            &:hover {
                cursor: pointer;
                //background: radial-gradient(circle, #5d5c5e 0%, #514f52 50%, #3d3b3d 100%);
                box-shadow: 0 0 20px 5px rgba(0, 0, 0, 0.3);
            }
        }
 
        .btnIcon {
            position: absolute;
            font-size: 24px;
            pointer-events: none;
            color: #8e8e8f;
 
            &.active {
                color: #fff;
            }
 
            &-0 {
                left: 50%;
                top: 20px;
                transform: translateX(-50%);
            }
 
            &-1 {
                top: 50%;
                right: 20px;
                transform: translateY(-50%);
            }
 
            &-2 {
                bottom: 20px;
                left: 50%;
                transform: translateX(-50%);
            }
 
            &-3 {
                top: 50%;
                left: 20px;
                transform: translateY(-50%);
            }
        }
 
        .manualControlBorder {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 135px;
            height: 135px;
            border-radius: 50%;
            border: 2px solid #ffffff;
 
            .manualControlCenter {
                z-index: 5;
                width: 50px;
                height: 50px;
                background: #404040;
                border-radius: 50%;
                display: flex;
                align-items: center;
                justify-content: center;
 
                img {
                    width: 18px;
                    height: 18px;
                }
            }
        }
    }
}
</style>