<template>
    <iframe id="iframe" style="width:100%;height: 100%" :src="url" frameborder="0"></iframe>
</template>
<style lang="scss" scoped>

</style>
<script lang="ts">
import { getliveinfo, luzhi } from '@/api';
import store from '@/store';
import { useI18n } from '@/utils/i18n';
import { defineComponent, onMounted, ref, watch } from 'vue';
import { useRoute } from 'vue-router';


export default defineComponent({
    setup(){
        const id = useRoute().query.id;
        const url = ref<string>()
        const lan: any = useI18n()
        if(id && typeof id == 'string'){
            getliveinfo(parseInt(id)).then((res: any)=>{
                // luzhi(res.roomid)
                const yuyan = lan.$s();
                url.value = yuyan == "zh" ? `/teacher/zhibo.html?roomid=${res.roomid}&memberid=${res.memberid}&name=${escape(store.state.userinfo.name)}&liveid=${res.liveid}` : `/teacher/zhiboen.html?roomid=${res.roomid}&memberid=${res.memberid}&name=${escape(store.state.userinfo.name)}&liveid=${res.liveid}`
            })

        }
     
        return {
            url
        }
    }
})

</script>