f
This commit is contained in:
@@ -3,6 +3,7 @@ import { onLoad, onUnload } from '@dcloudio/uni-app'
|
||||
import { ref } from 'vue'
|
||||
import { getQueryDetailByOrderId, getQueryDetailByOrderNo } from '@/api'
|
||||
import VehicleReportShell from '@/components/report/VehicleReportShell.vue'
|
||||
import ReportShareBar from '@/components/report/ReportShareBar.vue'
|
||||
import { parseEncryptedQueryReport } from '@/utils/queryReportParse'
|
||||
import { normalizeVehicleQueryData } from '@/utils/vehicleReportNormalize'
|
||||
|
||||
@@ -85,7 +86,7 @@ async function load(opts = {}) {
|
||||
if (parsed.ok) {
|
||||
queryParams.value = parsed.queryParams
|
||||
rows.value = parsed.rows
|
||||
errText.value = rows.value.length ? '' : '暂无报告模块数据'
|
||||
errText.value = rows.value.length ? '' : '渲染失败,可复制底部链接在浏览器查看'
|
||||
}
|
||||
else {
|
||||
rows.value = normalizeVehicleQueryData([])
|
||||
@@ -105,7 +106,7 @@ async function load(opts = {}) {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="page-root">
|
||||
<view class="page-root" :class="{ 'has-share-bar': orderId || orderNo }">
|
||||
<view v-if="loading && !pending" class="state">
|
||||
加载中…
|
||||
</view>
|
||||
@@ -124,6 +125,11 @@ async function load(opts = {}) {
|
||||
:rows="rows"
|
||||
/>
|
||||
</view>
|
||||
<ReportShareBar
|
||||
v-if="orderId || orderNo"
|
||||
:order-id="orderId"
|
||||
:order-no="orderNo"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -134,8 +140,12 @@ async function load(opts = {}) {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.page-root.has-share-bar {
|
||||
padding-bottom: calc(128rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.state {
|
||||
padding: 100rpx 32rpx;
|
||||
padding: 48rpx 32rpx 0;
|
||||
text-align: center;
|
||||
font-size: 28rpx;
|
||||
color: #86909c;
|
||||
|
||||
57
src/pages/report/webview.vue
Normal file
57
src/pages/report/webview.vue
Normal file
@@ -0,0 +1,57 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user