update loading

This commit is contained in:
ping 2025-09-25 14:55:50 +08:00
parent 95b04e9349
commit 70f2c06839

View File

@ -1,13 +1,15 @@
<template> <template>
<div class="box"> <div class="box">
<!-- 添加全屏加载效果 -->
<iframe v-loading="loading" v-if="url" :src="url" frameborder="0" class="baidu-style"> <div v-loading="loading" class="loading-container">
<iframe v-if="url" :src="url" frameborder="0" class="baidu-style">
</iframe> </iframe>
<div v-else> <div v-else class="login-prompt">
<p>请先登录百度云账号</p> <p>请先登录百度云账号</p>
<button @click="getToken">重试</button> <button @click="getToken">重试</button>
</div> </div>
</div> </div>
</div>
</template> </template>
<script> <script>
@ -22,7 +24,6 @@ export default {
url: '', url: '',
loading: true, loading: true,
userid: '', userid: '',
} }
}, },
async created() { async created() {
@ -62,24 +63,12 @@ export default {
console.log('接收到消息:', event); console.log('接收到消息:', event);
const data = event.data; const data = event.data;
console.log('接收到的 data 是:', data); console.log('接收到的 data 是:', data);
// 1. ()
// const expectedOrigin = 'https://console.vcp.baidu.com';
// if (event.origin !== expectedOrigin) {
// console.warn('Received message from unexpected origin:', event.origin);
// return;
// }
// 2. refundInfo uuidList // 2. refundInfo uuidList
if (data && data.refundInfo && Array.isArray(data.refundInfo.uuidList) && data.refundInfo.uuidList.length > 0) { if (data && data.refundInfo && Array.isArray(data.refundInfo.uuidList) && data.refundInfo.uuidList.length > 0) {
const uuidListArray = data.refundInfo.uuidList; // const uuidListArray = data.refundInfo.uuidList; //
// 3. ID () console.log('提取到的订单ID:', uuidListArray);
// ID退
const orderId = uuidListArray;
// ID
// const orderId = uuidListArray.join(',');
console.log('提取到的订单ID:', orderId);
// 4. ID // 4. ID
this.userid = sessionStorage.getItem('userId'); this.userid = sessionStorage.getItem('userId');
@ -91,7 +80,7 @@ export default {
// 5. // 5.
const payload = { const payload = {
order_id: orderId, order_id: uuidListArray,
userid: this.userid userid: this.userid
}; };
@ -104,9 +93,9 @@ export default {
console.log("调用 reqBaiduJudgePrice 接口返回:", res); console.log("调用 reqBaiduJudgePrice 接口返回:", res);
if (res.status) { // status true if (res.status) { // status true
this.$message.success('退订成功'); this.$message.success('退订成功');
// // - 使 path url
this.$router.push({ this.$router.push({
url: '/BaiduNetdisk', path: '/BaiduNetdisk',
}); });
} else { } else {
// //
@ -124,7 +113,6 @@ export default {
}); });
} else { } else {
console.log('接收到的消息不包含有效的退款信息或 uuidList 为空'); console.log('接收到的消息不包含有效的退款信息或 uuidList 为空');
//
} }
} }
} }
@ -137,11 +125,19 @@ export default {
height: 100%; height: 100%;
} }
.loading-container {
width: 100%;
height: 100%;
position: relative;
}
.login-prompt {
text-align: center;
padding: 50px;
}
.baidu-style { .baidu-style {
width: 100%; width: 100%;
height: calc(100vh - 100px); height: calc(100vh - 100px);
} }
</style> </style>