Commit 4e95eaab authored by liujiangnan's avatar liujiangnan

feat: 未转换完的提示

parent 28370039
This source diff could not be displayed because it is too large. You can view the blob instead.
.error-message[data-v-27deeb3e]{display:flex;justify-content:center;align-items:center;height:100%;font-size:16px;color:#666}
......@@ -4,7 +4,8 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="//staging-teach.cdn.ireadabc.com/h5template/h5-static-lib/js/air.js"></script>
<script type="module" crossorigin src="assets/index-CQb5JtTP.js"></script>
<script type="module" crossorigin src="assets/index-DbUpgpuo.js"></script>
<link rel="stylesheet" crossorigin href="assets/index-UTAcNXk5.css">
</head>
<body>
<div id="app"></div>
......
......@@ -4,10 +4,42 @@ import VueOfficePdf from "@vue-office/pdf";
import VueOfficeDocx from "@vue-office/docx";
const url = ref('');
const ppt_html = ref('');
window.courseware.getData((dt) => {
// 添加一个状态来控制错误提示
const showErrorMsg = ref(false);
// 检查 URL 是否可访问
async function checkUrl(url) {
try {
const response = await fetch(url);
const text = await response.text();
// 检查返回内容是否包含错误 XML
if (text.includes('<Error>') && text.includes('<Code>NoSuchKey</Code>')) {
showErrorMsg.value = true;
window.air.hideAirClassLoading('play_office', null);
return false;
}
return true;
} catch (error) {
console.error('检查URL时出错:', error);
showErrorMsg.value = true;
window.air.hideAirClassLoading('play_office', null);
return false;
}
}
window.courseware.getData(async (dt) => {
url.value = dt?.url;
ppt_html.value = dt?.ppt_html;
if (ppt_html.value) {
// 如果是 PPT,先检查 URL 是否可访问
if (url.value.toLowerCase().includes('.ppt')) {
const isAccessible = await checkUrl(ppt_html.value);
if (!isAccessible) {
return;
}
}
window.air.hideAirClassLoading('play_office', null);
}
},'play_office');
......@@ -28,10 +60,21 @@ function errorHandler () {}
</template>
<template v-if="url.indexOf(`.ppt`) > 0 || url.indexOf(`.PPT`) > 0 || url.indexOf(`.pptx`) > 0 || url.indexOf(`.PPTX`) > 0">
<div style="height: 100vh">
<iframe frameborder="0" width="100%" height="100%" :src="ppt_html" ></iframe>
<div v-if="showErrorMsg" class="error-message">
课件正在生成中,请过一会儿再尝试
</div>
<iframe v-else frameborder="0" width="100%" height="100%" :src="ppt_html"></iframe>
</div>
</template>
</template>
<style scoped>
.error-message {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
font-size: 16px;
color: #666;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment