<template>
    <div style="display: flex;width: 100%;margin-bottom: 20px;padding-bottom: 15px;align-items: center;justify-content: space-between;border-bottom: 2px dashed #98c3ef;">
        <el-icon v-if="showjt" color="#98c3ef" @click="handleClose" style="cursor: pointer;">
            <ArrowLeftBold />
        </el-icon>
        <div style="font-size: 20px;color:#0d8ed7;font-weight: bold;text-align: center;">
            {{name}}
        </div>
        <div style="display: flex;">
            <a v-if="showcode" :href="url" style="display: flex;align-items: center;padding-right: 30px;color: #80aedd;">
                <div style="padding-right: 6px;">下载小程序码</div><el-icon><Download /></el-icon>
            </a>
            <el-icon v-if="showcls" color="#ccc" @click="handleClose" style="cursor: pointer;">
                <CloseBold />
            </el-icon>
        </div>
    </div>
</template>
<script setup lang="ts">
    //import { ref } from 'vue'
    // import{ getqrcode } from '@/api/swapstation/hdz'
    const props = withDefaults(defineProps<{
        name?:string
        showjt?:boolean
        showcls?:boolean
        showcode?:boolean,
        hdzcode?:string
    }>(), {
        name:'',
        showjt:true,
        showcls:true,
        showcode:false
    })
    //${import.meta.env.VITE_APP_BASE_API} http://192.168.5.200:9103
    let url = `${import.meta.env.VITE_APP_BASE_API}/cloud/batterystation/xcx/qrcode/get?path=pages/home/index?code=${props.hdzcode}&width=400&env_version=trial`

    const emit = defineEmits<{
        close: []
    }>()

    function handleClose() {
        emit('close')
    }

    //获取小程序码
    // function xcxcode(){
    //     getqrcode({
    //         path:'pages/home/index',
    //         width:'400',
    //         env_version:'trial'    //要打开的小程序版本。正式版为"release"，体验版为"trial"，开发版为"develop"。默认是正式版。
    //     }).then((rps:any) => {
    //         console.log(rps)
    //     })
    // }
    
</script>