<template>
	<div class="login-scan-container">
		<div ref="qrcodeRef"></div>
	</div>
</template>

<script setup lang="ts">
import { onMounted, getCurrentInstance } from 'vue';
import QRCode from 'qrcodejs2-fixes';

const { proxy } = getCurrentInstance() as any;
// 初始化生成二维码
const initQrcode = () => {
	proxy.$refs.qrcodeRef.innerHTML = '';
	new QRCode(proxy.$refs.qrcodeRef, {
		text: `https://qr.oa.tencent.com/login?uid=TOF4~eyJpZCI6ImNzYTlqZGgxdXJkdWpoYm43MzhnIiwiaXNzIjoiMTAuOTkuMTUuMzYifQ&host=odc-tai.it.tencentcs.com`,
		width: 150,
		height: 150,
		colorDark: '#000000',
		colorLight: '#ffffff',
		correctLevel: QRCode.CorrectLevel.L,
	});
};
// 页面加载时
onMounted(() => {
	initQrcode();
});
</script>

<style scoped lang="scss">
.login-scan-container {
	padding: 20px;
	display: flex;
	justify-content: center;
	animation: logoAnimation 0.3s ease;
}
</style>
