<template>
    <div class="page">
        <div class="box">
            <div class="title">{{helloWord}}</div>
            <div class="tip">{{helloTip}}</div>
            <div class="ask">
                <div class="question">
                    <el-input type="textarea" :rows="2" v-model="question" placeholder="有什么问题，您可以对我提问！" resize="none"></el-input>
                </div>
                <div class="btns">
                    <div class="left">
                        <div class="copy">
                            <img src="@/assets/images/agent/link.png">
                        </div>
                        <div class="think" :class="{'active':deepThink}" @click="toDeepThink">
                            <img src="@/assets/images/agent/think.png">
                            <span>深度思考</span>
                        </div>
                    </div>
                    <div class="right">
                        <img src="@/assets/images/agent/photo.png">
                        <img src="@/assets/images/agent/upload.png">
                        <img src="@/assets/images/agent/input_hou.png" v-if="question" @click="handleQuestion">
                        <img src="@/assets/images/agent/input_qian.png" v-else>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup name="">
    import { getContractList } from '@/api/agent/index.js'
    import { ref, getCurrentInstance } from 'vue'
    const { proxy } = getCurrentInstance();
    
    const helloWord = ref('Hi～，我是PERILL Coach')
    const helloTip = ref('可以为你提供PERILL模型，个人教练、团队教练相关的理论、案例、分析报告等知识的查询和解答')
    const question = ref('')
    const deepThink = ref(false)

    const toDeepThink = () => {
        deepThink.value = !deepThink.value
    }

    const handleQuestion = () => {
        getContractList(question.value).then(res=>{
            console.log(res,'res')
        })

        proxy.$router.push({
            path: '/agentDialogResult',
            query: {
                question: question.value,
                deepThink: deepThink.value
            }
        })
    }
</script>

<style scoped lang="scss">
    ::v-deep .el-textarea__inner{
        background: #FFFFFF;
        border-radius: 10px !important;
        border: none !important;
        padding: 0 !important;
    }

    .page{
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        .box{
            .title{
                font-family: DingTalk, DingTalk;
                font-weight: normal;
                font-size: 24px;
                color: #111111;
                line-height: 29px;
            }
            .tip{
                font-family: PingFangSC, PingFang SC;
                font-weight: 400;
                font-size: 14px;
                color: #9CA3AF;
                line-height: 20px;
                margin-top: 11px;
            }

            .ask{
                width: 980px;
                height: 148px;
                background: #FFFFFF;
                border-radius: 10px;
                border: 1px solid #E5E7EB;
                padding: 20px;
                box-sizing: border-box;
                margin-top: 80px;
                position: relative;
                .btns{
                    width: 940px;
                    position: absolute;
                    left: 20px;
                    bottom: 20px;
                    display: flex;
                    justify-content: space-between;
                    .left{
                        display: flex;
                        .copy{
                            width: 36px;
                            height: 36px;
                            background: #FFFFFF;
                            border-radius: 6px;
                            border: 1px solid #E5E7EB;
                            cursor: pointer;
                            display: flex;
                            align-items: center;
                            justify-content: center;
                            img{
                                width: 14px;
                                height: 16px;
                            }
                        }
                        .think{
                            width: 96px;
                            height: 36px;
                            background: #FFFFFF;
                            border-radius: 6px;
                            border: 1px solid #E5E7EB;
                            margin-left: 8px;
                            display: flex;
                            align-items: center;
                            justify-content: center;
                            cursor: pointer;
                            img{
                                width: 14px;
                                height: 14px;
                            }
                            span{
                                font-family: PingFangSC, PingFang SC;
                                font-weight: 400;
                                font-size: 14px;
                                color: #111111;
                                line-height: 20px;
                                margin-left: 3px;
                            }
                            &.active{
                                border: 1px solid #70b2df;
                                span{
                                    color: #70b2df;
                                }
                            }
                        }
                    }
                    .right{
                        display: flex;
                        img{
                            width: 30px;
                            height: 30px;
                            margin-left: 33px;
                            cursor: pointer;
                        }
                    }
                }
            }
        }
    }
</style>