<script lang="ts" setup>
import CpmdHeader from '@/components/CpmdHeader.vue';
import { queryScaleDetailApi } from '@/api/plan'
import { ref, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
const route = useRoute()
const router = useRouter()
//测试flag
const flag = ref<string>('')
//测试计划ID
const planId = ref<string>('')
//测试计划名称
const planName = ref<string>('')
//测试任务的类型 
const type = ref<string>('')

//量表描述
const detail = ref<string>('')
//量表理论
const theory = ref<string>('')
//量表参考文献
const reference = ref<string>('')
//量表名称
const scaleName = ref<string>('')
onMounted(() => {
    //修改 flag    
    flag.value = route.params.flag as string;
    planId.value = route.params.planId as string;
    planName.value = route.params.planName as string;
    type.value = route.params.type as string;

    //获取传输过来的测评介绍
    //获取传输过来的类型
    //获取传输过来的flag

    //拿到以后根据根据flag查询
    if (type.value == '0') {
        queryScaleDetail()
    }
})
const queryScaleDetail = async () => {
    //根据flag查询量表详情
    let res: any = await queryScaleDetailApi(flag.value)
    console.log(res)
    scaleName.value = res.data.name;
    detail.value = res.data.description;
    theory.value = res.data.theory;
    //参考文献
    console.log(res.data.reference)
    reference.value = res.data.reference.split('//');
    console.log(reference.value)
    debugger
}
const startText = () => {
    //当；类型是0时、、跳转到量表测试界面
    if (type.value == '0') {
        //开始跳转到scal90测试界面
        router.push({
            name: 'scale',

            params: {
                planId: planId.value,
                planName: planName.value,
                flag: flag.value,
                flagName: scaleName.value
            }
        })

    }
}
//接受来自计划页面的参数
//得到需要测试的类型
//得到需要测试的flag
//查询量表的描述
//查询量表的文献
</script>
<template>

    <div class="home_header_out" ref="homeHeaderOut">
        <div class=" home_header_inner">
            <CpmdHeader />
            <div style="text-align: center;">
                <img class="xlts_img" style="margin-top:20px" src="../assets/home/other_text.png" />
            </div>
        </div>
        <div class="kply">
            <div class="kply_inner">
                <div style="padding :20px 40px">
                    <div class="cognize_title">
                        {{ scaleName }}
                    </div>
                    <div class="cognize_img_out">
                        <img src="../assets/cognize/c1.png" v-show="true" width=" 100px" height="100px"
                            style="margin-right: 20px;" />
                        <div class="cognize_des">
                            <span class="cpjs">测评介绍：</span>{{ detail }}
                        </div>

                    </div>
                    <div class="yl_out"><span class="yl">原理:</span><span class="yl_detail">{{ theory }}</span>
                    </div>
                    <div class="ckwx">
                        <div class="reference_title">参考文献:</div>
                        <div v-for="item, index in reference" :key="index" class='reference_cal'>
                            <div>[{{ index + 1 }}]</div>
                            <div>{{ item }}</div>
                        </div>
                    </div>
                    <div class=" scale_button">
                        <el-row>
                            <el-col :span="12" class="scale_button_inner">

                                <div class="scale_button_self" @click="startText">开始测试</div>
                            </el-col>
                        </el-row>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<style lang="scss">
.cognize_real_out {
    background-color: #b64d4d;
    color: #41348a;
    position: fixed;
    z-index: 100;
    top: 0;
    width: 100vw;
    height: 100vh;
}

.home_header_out {
    padding-bottom: 60px;
    width: 100%;
    min-width: 1200px;
    background-image: url('../assets/home/bg_ty.png');
    background-repeat: no-repeat;
    background-size: contain;
    background-color: #FAFAFA; //估计是需要动态

    .home_header_inner {
        min-height: 1;
        left: 0;
        right: 0;
        margin: auto;
        width: 1200px;

        .xlts_img {
            height: 40px;
        }
    }

    .kply {
        width: 100%;
        margin-top: 20px;

        .kply_inner {
            min-height: 500px;
            left: 0;
            right: 0;
            margin: auto;
            width: 860px;
            // padding: 20px 20px;
            background-color: #ffffff;
            border-radius: 40px;

            .yl_out {
                margin-top: 10px;
                letter-spacing: 3px;

                .yl {
                    color: #48D68E;
                    font-weight: 700;
                }

                .yl_detail {
                    letter-spacing: 2px;
                    line-height: 25px;
                }
            }

            .ckwx {
                margin-top: 10px;

                .reference_title {
                    color: #a9a9a9;
                    font-size: 16px;
                }

                .reference_cal {
                    display: flex;
                    width: 100%;
                    color: #a9a9a9;
                    font-size: 14px;
                    letter-spacing: 2px;
                    line-height: 30px;
                }
            }


            .cognize_title {

                font-size: 20px;
                letter-spacing: 3px;
                font-weight: 700;
                margin-bottom: 10px;
            }

            .cognize_title2 {
                font-size: 20px;
                letter-spacing: 3px;
                // font-weight: 700;
                margin-top: 10px;
                margin-bottom: 20px;
            }

            .cognize_img_out {
                display: flex;
                justify-content: center;
                align-items: center;

                .cognize_des {
                    letter-spacing: 2px;
                    line-height: 20px;
                    font-size: 16px;
                    line-height: 25px;

                    .cpjs {
                        color: #48D68E;
                        font-weight: 700;
                    }
                }
            }

            .cognize_video {
                display: flex;
                justify-content: center;
            }

            .pdf_op {
                margin-top: 20px;
                display: flex;
                justify-content: space-between;
                align-items: center;

                .pdf_sc {
                    display: flex;
                    // justify-content: space-between;
                    align-items: center;
                    cursor: pointer;

                    .view {
                        margin-left: 10px;
                        color: #3E43FF;
                    }
                }
            }

            .scale_button {
                margin-top: 30px;
                margin-bottom: 20px;

                .scale_button_inner {
                    text-align: center;
                    display: flex;
                    justify-content: center;

                    .scale_button_self {

                        border-radius: 12px;
                        border: 3px solid #48D68E;
                        color: #ffffff;
                        background-color: #000000;
                        margin-right: 20px;
                        padding: 10px 40px;
                        cursor: pointer;
                        display: flex;
                        align-items: center;
                        font-size: 16px;
                    }
                }
            }
        }
    }


}



.home_mid {
    // background-color: blanchedalmond;
    width: 1200px;
    left: 0;
    right: 0;
    margin: auto;
    margin-top: 40px;
    // position: relative;




    .kepu_title {
        text-align: center;

        font-size: 50px;
        color: #111111;
        line-height: 95px;

        // width: 100%;
        // left: 0;
        // right: 0;
        // margin: auto
    }

    .kepu_title_sub {
        margin-top: 30px;
        text-align: center;
        font-size: 28px;
        color: #48D68E;
        line-height: 26px;
    }

    .man1_group {
        margin-top: 60px;
        height: 100%;
        display: flex;

        .man1 {
            position: relative;
            width: 327px;
            // height: 100%;

            // height: 100%
            .man1_img {
                position: absolute;
                bottom: 0;
                /* bottom: 0px; */
                /* height: auto; */
                width: 100%;
                left: 100px
            }

        }

        .des {
            border: #48D68E solid 5px;
            border-radius: 40px;
            padding: 20px;
            letter-spacing: 6px;
            flex: 1;

            .des_inner {
                border: 1px dashed #48D68E;
                border-radius: 40px;
                padding-bottom: 40px;
                padding-top: 30px;
                padding-left: 100px;
                padding-right: 20px;
                letter-spacing: 6px;
                font-weight: normal;
                font-size: 24px;
                color: #333333;
                line-height: 40px;
            }
        }
    }

    .man2_group {
        margin-top: 60px;
        height: 100%;
        display: flex;

        .man2 {
            position: relative;
            width: 327px;
            // height: 100%;

            // height: 100%
            .man2_img {
                position: absolute;
                bottom: 0;
                /* bottom: 0px; */
                /* height: auto; */
                width: 100%;
                left: -100px
            }

        }

        .des2 {
            border: #48D68E solid 5px;
            border-radius: 40px;
            padding: 20px;
            letter-spacing: 6px;
            flex: 1;

            .des2_inner {
                border: 1px dashed #48D68E;
                border-radius: 40px;
                padding-bottom: 40px;
                padding-top: 30px;
                padding-left: 20px;
                padding-right: 100px;
                letter-spacing: 6px;
                font-weight: normal;
                font-size: 24px;
                color: #333333;
                line-height: 40px;
            }
        }
    }

    .get_more {
        text-align: center;

        img {
            width: 300px;
            margin-top: 60px;
            margin-bottom: 60px;
        }
    }
}
</style>