<template>
    <div class="task_controller_wrapper">
        <titleView>
            <template #icon>
                <img src="@/assets/img/zf_task_controller_icon.svg" alt="">
            </template>
            <template #title>
                <span>任务控制</span>
            </template>
        </titleView>
        <div class="controller">
            <div class="top">
                <!-- 方向按键 -->
                <div class="direction_control_wrapper">
                    <div class="direction_control">
                        <div class="button_group">
                            <div class="direction_button up"></div>
                            <div class="direction_button right"></div>
                        </div>
                        <div class="button_group">
                            <div class="direction_button left"></div>
                            <div class="direction_button down"></div>
                        </div>
                    </div>
                    <div class="zoom_button">
                        <div class="btn zoom_in">
                            <img src="@/assets/img/zf_task_controller_plus_icon.svg" alt="">
                        </div>
                        <div class="btn zoom_out">
                            <img src="@/assets/img/zf_task_controller_zoomout_icon.svg" alt="">
                        </div>
                    </div>
                </div>
                <!-- 状态仪表盘 -->
                <div class="dash_board">
                    <div class="group">
                        <div class="item" v-for="item in dash_board" :class="{ no_splite: item?.no_splite }">
                            <div class="data">
                                <div class="icon">
                                    <img :src="item.icon" alt="">
                                </div>
                                <div class="value" :style="`color:${item.color}`">{{ item.value }}</div>
                            </div>
                            <span class="label">{{ item.label }}</span>
                        </div>

                    </div>
                </div>
            </div>

            <!-- 底部按钮 -->
            <div class="bottom_buttons">
                <div class="btn">
                    <img class="icon" src="@/assets/img/zf_task_controller_start_icon.svg" alt="">
                    <span>开始任务</span>
                </div>
                <div class="btn">
                    <img class="icon" src="@/assets/img/zf_task_controller_pause_icon.svg" alt="">
                    <span>暂停任务</span>
                </div>
                <div class="btn">
                    <img class="icon" src="@/assets/img/zf_task_controller_create_icon.svg" alt="">
                    <span>创建事件</span>
                </div>
                <div class="btn">
                    <img class="icon" src="@/assets/img/zf_task_controller_back_icon.svg" alt="">
                    <span>一键返航</span>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import { ref } from "vue"
import titleView from "@/components/zfControlPlatform/titleView/index.vue"
import powerIcon from "@/assets/img/zf_task_controller_power_icon.svg"
import satelliteIcon from "@/assets/img/zf_task_controller_satellite_icon.svg"
import transferImgIcon from "@/assets/img/zf_task_controller_transfer_icon.svg"
import speedIcon from "@/assets/img/zf_task_controller_speed_icon.svg"
import aircraftIcon from "@/assets/img/zf_task_controller_aircraft_icon.svg"
import heightIcon from "@/assets/img/zf_task_controller_height_icon.svg"
import altitudeIcon from "@/assets/img/zf_task_controller_altitude_icon.svg"

const dash_board = ref([
    {
        label: "电池电量",
        value: "87%",
        icon: powerIcon,
        color: "#42F5AF"
    },
    {
        label: "搜星质量",
        value: "8 ",
        icon: satelliteIcon,
        color: "#42F5AF"
    },
    {
        label: "图传状态",
        value: "正常",
        icon: transferImgIcon,
        color: "#42F5AF"
    },
    {
        label: "水平速度",
        value: "HS-m/s",
        icon: speedIcon,
        color: "#FFF",
        no_splite: true
    },
    {
        label: "相对起飞点高度",
        value: "ATM-m",
        icon: aircraftIcon,
        color: "#FFF"
    },
    {
        label: "相对地形高度",
        value: "12883 m",
        icon: heightIcon,
        color: "#FFF"
    },
    {
        label: "海拔高度",
        value: "12883 m",
        icon: altitudeIcon,
        color: "#FFF",
        no_splite: true
    },

])

</script>

<style lang="less" scoped>
.task_controller_wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;

    .controller {
        flex: 1;
        height: 0;
        background-color: #053b7b;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        align-items: center;

        .direction_control_wrapper {
            display: flex;
            height: 290px;
            justify-content: center;
            align-items: center;
            position: relative;

            //方向按钮
            .direction_control {
                border-radius: 50%;
                width: 206px;
                height: 206px;
                overflow: hidden;
                transform: rotate(45deg);

                .button_group {
                    display: flex;

                    &+.button_group {
                        margin-top: 8px;
                    }

                    .direction_button {
                        height: 99px;
                        width: 99px;
                        background-color: #1e5499;
                        position: relative;
                        display: flex;
                        justify-content: center;
                        align-items: center;
                        cursor: pointer;

                        &:hover {
                            background: linear-gradient(90deg, #0454e6, #1475e2);
                        }

                        &+.direction_button {
                            margin-left: 8px;
                        }

                        &::after {
                            content: '';
                            position: absolute;
                            width: 0;
                            height: 0;
                            border: 10px solid skyblue;
                            border-color: skyblue transparent transparent transparent;
                        }

                        &.up {
                            &::after {
                                border-color: transparent transparent skyblue transparent;
                                transform: rotate(-45deg);
                            }
                        }

                        &.down {
                            &::after {
                                border-color: skyblue transparent transparent transparent;
                                transform: rotate(-45deg);
                            }
                        }

                        &.left {
                            &::after {
                                border-color: transparent skyblue transparent transparent;
                                transform: rotate(-45deg);
                            }
                        }

                        &.right {
                            &::after {
                                border-color: transparent transparent transparent skyblue;
                                transform: rotate(-45deg);
                            }
                        }
                    }
                }

            }

            .zoom_button {
                width: 68px;
                height: 68px;
                overflow: hidden;
                border-radius: 50%;
                position: absolute;
                border: 8px solid #053b7b;
                background-color: #053b7b;
                box-sizing: content-box;

                .btn {
                    height: 32px;
                    background-color: #054295;
                    display: flex;
                    justify-content: center;
                    align-items: center;
                    font-size: 18px;
                    color: #fff;
                    cursor: pointer;

                    &+.btn {
                        margin-top: 4px;
                    }

                    img {
                        width: 13px;
                    }
                }
            }
        }

        //数据仪表盘
        .dash_board {
            width: 340px;

            background-color: #18549b;
            margin: 0 auto;

            .group {
                display: flex;
                flex-wrap: wrap;
                justify-content: space-between;
                padding: 0 8px 16px;

                .item {
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    min-width: 80px;
                    padding-top: 16px;
                    flex: 1;
                    position: relative;

                    &::after {
                        content: "";
                        position: absolute;
                        height: 24px;
                        width: 1px;
                        background-color: #2366b7;
                        right: 0;
                    }

                    &.no_splite {
                        &::after {
                            display: none;
                        }
                    }

                    .data {
                        display: flex;
                        font-size: 14px;
                        font-weight: 700;

                        .icon {
                            width: 16px;
                            height: 16px;
                            flex-shrink: 0;
                            margin-right: 4px;

                            img {
                                display: block;
                                width: 100%;
                                height: 100%;
                            }
                        }


                    }

                    .label {
                        font-size: 12px;
                        color: rgba(255, 255, 255, 0.4);
                    }
                }
            }
        }

        .bottom_buttons {
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            width: 340px;

            .btn {
                width: 164px;
                height: 40px;
                display: flex;
                justify-content: center;
                align-items: center;
                font-size: 16px;
                color: rgba(255, 255, 255, 0.85);
                background: linear-gradient(180deg, #004DE7 0%, #1577E2 100%);
                margin-bottom: 14px;
                cursor: pointer;
                .icon {
                    width: 20px;
                    height: 20px;
                    margin-right: 4px;
                }
            }

        }
    }



}
</style>