From 77cb81752366c38a7b5e0b4c2559a03bb9b1e2e1 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Wed, 20 Nov 2024 20:25:32 +0800 Subject: [PATCH] =?UTF-8?q?feat(AliyunAuthDialog):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=94=AF=E6=8C=81=EF=BC=8C=E5=85=81=E8=AE=B8?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89refreshToken=E5=92=8C=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/cards/StorageCard.vue | 1 + src/components/dialog/AliyunAuthDialog.vue | 28 ++++++++++++++++++++++ src/components/dialog/U115AuthDialog.vue | 5 ++-- src/components/dialog/UserAuthDialog.vue | 22 ++++++++++++++++- 4 files changed, 53 insertions(+), 3 deletions(-) diff --git a/src/components/cards/StorageCard.vue b/src/components/cards/StorageCard.vue index a672582b..004d5c4a 100644 --- a/src/components/cards/StorageCard.vue +++ b/src/components/cards/StorageCard.vue @@ -144,6 +144,7 @@ onMounted(() => { diff --git a/src/components/dialog/AliyunAuthDialog.vue b/src/components/dialog/AliyunAuthDialog.vue index 36a8bc9a..4b1013bd 100644 --- a/src/components/dialog/AliyunAuthDialog.vue +++ b/src/components/dialog/AliyunAuthDialog.vue @@ -2,6 +2,14 @@ import QrcodeVue from 'qrcode.vue' import api from '@/api' +// 定义输入 +const props = defineProps({ + conf: { + type: Object as PropType<{ [key: string]: any }>, + required: true, + }, +}) + // 定义事件 const emit = defineEmits(['done', 'close']) @@ -25,6 +33,10 @@ let timeoutTimer: NodeJS.Timeout | undefined = undefined // 完成 async function handleDone() { + clearTimeout(timeoutTimer) + if (props.conf?.refreshToken) { + await savaAliPanConfig() + } emit('done') } @@ -75,6 +87,15 @@ async function checkQrcode() { } } +// 保存cookie设置 +async function savaAliPanConfig() { + try { + await api.post(`storage/save/alipan`, props.conf) + } catch (e) { + console.error(e) + } +} + onMounted(async () => { await getQrcode() timeoutTimer = setTimeout(checkQrcode, 3000) @@ -97,6 +118,13 @@ onUnmounted(() => {