<template>
  <div style="position: absolute; bottom: 20px;right:0;display: flex; flex-direction: column;align-items: flex-end;">
    <div style="position: relative;" v-show="showCode">
      <Icon icon="ep:close" style="position: absolute;right: 5px;top: 5px" @click="handleClose"/>
      <!-- <vue-qr bgSrc='https://img2.baidu.com/it/u=1188690822,3145215011&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=1038' logoSrc="https://img1.baidu.com/it/u=605875105,1314303687&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500" text="Hello world!" :size="200"></vue-qr> -->
      <vue-qr :text="apkUrl" :size="200" ></vue-qr>
    </div>
    <el-button type="primary" v-if="pdaUrl" link @click="handleClose">{{ t('ts.PDA安装程序下载链接') }}</el-button>
  </div>
</template>
<script setup lang="ts">
import { downloadApk } from "@/api/login";
import { getPDAUrl,getNeedCode } from '@/utils/systemParam'
const { t } = useI18n() // 国际化

// import logoImg from '@/assets/imgs/logo_white_blue.png'

import vueQr from 'vue-qr/src/packages/vue-qr.vue'
const pdaUrl = ref(getPDAUrl()==true||getPDAUrl()=='true')

const apkUrl = ref('')
const showCode = ref(false)
const handleClose = async ()=>{
  showCode.value = !showCode.value
  let res = await downloadApk({})
  console.log('res',res)
  if(res){
    apkUrl.value = res
  }
  
}

</script>
<style lang="scss" scoped></style>