This commit is contained in:
李志鹏
2026-06-01 10:10:22 +08:00
parent b66b8df8a3
commit 88a5618976

View File

@@ -97,7 +97,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { FormatBytes } from '@/utils/tools' import { FormatBytes } from '@/utils/tools'
import { fetchDownloadItemsByGet } from '@/api/user' import { fetchDownloadItemsByGet } from '@/api/user'
import { computed, onMounted, ref } from 'vue' import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
import { CreateOrder, ORDER_STATUS, GetOrderStatus } from '@/api/shoppingCart' import { CreateOrder, ORDER_STATUS, GetOrderStatus } from '@/api/shoppingCart'
import { useRouter, useRoute } from 'vue-router' import { useRouter, useRoute } from 'vue-router'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
@@ -119,6 +119,9 @@
}) })
} }
}) })
onBeforeUnmount(() => {
clearInterval(viewTime.value)
})
const agreement = ref(false) const agreement = ref(false)
const paymentStatus = ref(ORDER_STATUS.PENDING) const paymentStatus = ref(ORDER_STATUS.PENDING)
const onPayWith = () => { const onPayWith = () => {
@@ -150,14 +153,23 @@
} }
}) })
} }
const viewTime = ref(null)
const openView = (url, width = 600, height = 800) => { const openView = (url, width = 600, height = 800) => {
const left = (screen.width - width) / 2 const left = (screen.width - width) / 2
const top = (screen.height - height) / 2 const top = (screen.height - height) / 2
window.open( const view = window.open(
url, url,
'_blank', '_blank',
'width=' + width + ', height=' + height + ', left=' + left + ', top=' + top 'width=' + width + ', height=' + height + ', left=' + left + ', top=' + top
) )
clearInterval(viewTime.value)
viewTime.value = setInterval(() => {
if (view.closed) {
clearInterval(viewTime.value)
getOrderStatus()
}
}, 500)
} }
const DOWNLOAD_STATUS = { const DOWNLOAD_STATUS = {
null: 0, // 未开始 null: 0, // 未开始