58 lines
1.0 KiB
Vue
58 lines
1.0 KiB
Vue
<script setup>
|
|
import { onLoad } from '@dcloudio/uni-app'
|
|
import { ref } from 'vue'
|
|
|
|
definePage({
|
|
style: {
|
|
navigationBarTitleText: '完整版报告',
|
|
navigationStyle: 'default',
|
|
navigationBarBackgroundColor: '#ffffff',
|
|
navigationBarTextStyle: 'black',
|
|
},
|
|
})
|
|
|
|
const pageUrl = ref('')
|
|
const loadError = ref('')
|
|
|
|
onLoad((options) => {
|
|
const raw = options?.url || ''
|
|
if (!raw) {
|
|
loadError.value = '缺少报告地址'
|
|
return
|
|
}
|
|
try {
|
|
pageUrl.value = decodeURIComponent(raw)
|
|
}
|
|
catch {
|
|
pageUrl.value = raw
|
|
}
|
|
if (!/^https:\/\//i.test(pageUrl.value)) {
|
|
loadError.value = '报告链接无效'
|
|
pageUrl.value = ''
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<view class="page">
|
|
<web-view v-if="pageUrl" :src="pageUrl" />
|
|
<view v-else class="err">
|
|
<text>{{ loadError || '无法加载报告' }}</text>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<style scoped lang="scss">
|
|
.page {
|
|
width: 100%;
|
|
height: 100vh;
|
|
}
|
|
|
|
.err {
|
|
padding: 80rpx 32rpx;
|
|
text-align: center;
|
|
font-size: 28rpx;
|
|
color: #86909c;
|
|
}
|
|
</style>
|