<template>
    <div class="labs">
        <div class="el-dropdown-link" title="实验室" @click="dialogVisible = true">
            <img :src="imgIcon" alt="" class="header_right_icon left">
            <span class="header_right_title_span">实验室</span>
        </div>
        <el-dialog v-model="dialogVisible" title="" width="820px" :show-close="false">
            <template #header="{ close }">
                <div class="my-header">
                    <span class="labs_title">CocoBlockly Pi 实验室</span>
                    <i class="material-icons right" style="margin-top: 5px;cursor: pointer;margin-right:-15px"
                        @click="close">close</i>
                </div>
            </template>
            <el-row class="labs_body">
                <el-col class="labs_class_content" :span="6">
                    <p class="all_class">所有分类：</p>
                    <ul class="labs_class_left">
                        <li :class="calssActive == 1 ? 'active' : ''" @click="getClassData(1, '人工智能')">人工智能</li>
                        <li :class="calssActive == 2 ? 'active' : ''" @click="getClassData(2, '物联网')">物联网</li>
                        <li :class="calssActive == 3 ? 'active' : ''" @click="getClassData(3, '机器人控制')">机器人控制</li>
                        <li :class="calssActive == 4 ? 'active' : ''" @click="getClassData(4, '科学实验')">科学实验</li>
                        <li :class="calssActive == 5 ? 'active' : ''" @click="getClassData(5, '互动游戏')">互动游戏</li>
                        <li :class="calssActive == 6 ? 'active' : ''" @click="getClassData(6, 'AR/VR')">AR/VR</li>
                    </ul>
                </el-col>
                <el-col :span="18" style="padding:0 0.75rem;">
                    <h5>{{ titleNmae }}</h5>
                    <ul class="labs_class_right">
                        <li v-if="calssActive == 1">
                            <AI></AI>
                        </li>
                        <li v-else-if="calssActive == 2">
                            <Iot></Iot>
                        </li>
                        <li v-else-if="calssActive == 3">
                            <RobotContro></RobotContro>
                        </li>
                        <li v-else-if="calssActive == 4">
                            <Science></Science>
                        </li>
                        <li v-else-if="calssActive == 5">
                            <interactiveGames></interactiveGames>
                        </li>
                        <li v-else>
                            <ARVR></ARVR>
                        </li>
                    </ul>
                </el-col>
            </el-row>
        </el-dialog>
    </div>
</template>
<script setup>
import { ref } from 'vue';
import imgIcon from '../../assets/img/cocoblockly-navbar_labs-icon.png'
import AI from '../labs/ai.vue'
import Iot from '../labs/iot.vue'
import RobotContro from '../labs/robotContro.vue';
import Science from '../labs/science.vue'
import interactiveGames from '../labs/interactiveGames.vue'
import ARVR from '../labs/ARVR.vue'

const dialogVisible = ref(false)
const calssActive = ref(1)
const titleNmae = ref("人工智能")

const getClassData = (val, name) => {
    calssActive.value = val
    titleNmae.value = name
}

</script>
<style lang="scss">
.labs {
    color: #000;
    cursor: default;

    .el-dropdown-link {
        cursor: pointer;
    }

    .my-header {
        padding: 20px;
    }

    .labs_title {
        color: #000;
        font-size: 2.28rem;
    }

    .labs_body {
        border-top: 1px solid #ddd;
        margin: 0px 20px;
        padding-bottom: 20px;

        h5 {
            font-size: 1.64rem;
            line-height: 110%;
            margin: 1.0933333333rem 0 0.656rem 0;
        }

        .labs_class_content {
            .all_class {
                font-weight: bold;
                margin: 1rem 0;
            }


            ul.labs_class_left {
                border: 1px solid #dddddd;
                border-bottom: none;
                border-radius: 2px;

                li {
                    background-color: #fff;
                    line-height: 1.5rem;
                    padding: 10px 20px;
                    margin: 0;
                    border-bottom: 1px solid #e0e0e0;
                    font-weight: bold;
                    cursor: pointer;
                }

                .active {
                    background-color: #2196F3;
                    color: white;
                    border-radius: 2px;
                }
            }

            ul.labs_class_right {}
        }
    }
}
</style>