提交 4b423865 authored 作者: lidongxu's avatar lidongxu

Merge branch 'zhijian_app' into dev

...@@ -38,6 +38,19 @@ ...@@ -38,6 +38,19 @@
</van-cell-group> </van-cell-group>
</van-list> </van-list>
</van-pull-refresh> </van-pull-refresh>
<!-- 移动端特殊,覆盖一个 iframe 在当前页顶层显示 pdf -->
<div class="iframe-wrap"
v-if="showPdfIframe">
<iframe :src="pdfUrl"
width="100%"
height="100%"
frameborder="0"
allow="fullscreen" />
<!-- 覆盖一层 div,透明的,用于接收点击交互关闭 -->
<div class="click-cover"
@click="closeIframe"></div>
</div>
</div> </div>
</template> </template>
...@@ -86,6 +99,8 @@ const getPlanListFn = async () => { ...@@ -86,6 +99,8 @@ const getPlanListFn = async () => {
getPlanListFn() getPlanListFn()
/*************** 附件类型/预览 ***************/ /*************** 附件类型/预览 ***************/
const showPdfIframe = ref(false)
const pdfUrl = ref('')
// 判断文件类型 // 判断文件类型
const isImageFile = (url) => { const isImageFile = (url) => {
if (!url) return false if (!url) return false
...@@ -124,12 +139,19 @@ const handleReportClick = (url) => { ...@@ -124,12 +139,19 @@ const handleReportClick = (url) => {
const originDomain = import.meta.env.VITE_APP_OSS_ORIGIN_DOMAIN const originDomain = import.meta.env.VITE_APP_OSS_ORIGIN_DOMAIN
const customDomain = import.meta.env.VITE_APP_OSS_CUSTOM_DOMAIN const customDomain = import.meta.env.VITE_APP_OSS_CUSTOM_DOMAIN
url = url.replace(originDomain, customDomain) url = url.replace(originDomain, customDomain)
window.open(url, '_blank') pdfUrl.value = url
showPdfIframe.value = true
} else { } else {
// 其他文件类型:默认打开新链接 // 其他文件类型:默认打开新链接
window.open(url, '_blank') window.open(url, '_blank')
} }
} }
// 关闭 iframe
const closeIframe = () => {
showPdfIframe.value = false
}
</script> </script>
<style scoped <style scoped
...@@ -155,7 +177,25 @@ const handleReportClick = (url) => { ...@@ -155,7 +177,25 @@ const handleReportClick = (url) => {
} }
} }
/* ::v-deep(.zebra-row) { /* iframe 样式 */
background-color: #f9f9f9; .iframe-wrap {
} */ position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
z-index: 9998;
display: flex;
align-items: center;
justify-content: center;
}
.click-cover{
position: absolute;
top: 56px;
left: 0;
width: 100%;
height: 100%;
z-index: 9999;
}
</style> </style>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论