Commit 3abcda5b by chenwq1 Committed by 岑成威

feat(inspection-report): add inspection report page and update navigation

- Updated env.js to change the environment index from 3 to 1.
- Added new inspection report page to pages.json and Entrance.vue.
- Implemented the inspection report component with web-view functionality.
- Enhanced tool navigation to support direct page transitions.
1 parent 2a3ce639
...@@ -100,6 +100,13 @@ export default { ...@@ -100,6 +100,13 @@ export default {
name: 'ReportManagement', name: 'ReportManagement',
page: '/pages/usedCar/reportManagement/index', page: '/pages/usedCar/reportManagement/index',
sceneType: [7] sceneType: [7]
},
{
icon: 'report-management',
label: '检测报告管理',
name: 'InspectionReport',
page: '/pages/usedCar/inspectionReport/index',
sceneType: [7]
} }
] ]
// 先根据场景过滤 // 先根据场景过滤
......
...@@ -323,6 +323,12 @@ ...@@ -323,6 +323,12 @@
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
},
{
"path": "pages/usedCar/inspectionReport/index",
"style": {
"navigationStyle": "custom"
}
} }
], ],
"globalStyle": { "globalStyle": {
......
<template>
<view class="inspection-report-webview">
<web-view v-if="url" :src="url" @message="handleMessage"></web-view>
</view>
</template>
<script>
export default {
name: 'InspectionReport',
data() {
return {
url: ''
}
},
onLoad() {
const baseUrl = 'http://192.168.1.139:8082/home'
const userInfo = uni.$storage.get('userInfo') || {}
const token = userInfo.token || ''
this.url = token ? `${baseUrl}?token=${encodeURIComponent(token)}` : baseUrl
},
methods: {
// 监听 H5 推送的消息(AUTH_TOKEN / LOGOUT)
handleMessage(e) {
// UniApp 里 e.detail.data 是数组,取第一项
const data = (e.detail && e.detail.data && e.detail.data[0]) || {}
if (data.type === 'AUTH_TOKEN') {
// H5 登录后通知宿主同步 token,保存到 userInfo
const userInfo = uni.$storage.get('userInfo') || {}
userInfo.token = data.token
uni.$storage.set('userInfo', userInfo)
} else if (data.type === 'LOGOUT') {
// H5 退出后清除本地登录态
const userInfo = uni.$storage.get('userInfo') || {}
userInfo.token = ''
uni.$storage.set('userInfo', userInfo)
}
}
}
}
</script>
<style scoped lang="scss">
.inspection-report-webview {
width: 100%;
height: 100%;
}
</style>
...@@ -75,6 +75,11 @@ export default { ...@@ -75,6 +75,11 @@ export default {
this.currentMonth = dayjs(currentDate).format('YYYY-MM') this.currentMonth = dayjs(currentDate).format('YYYY-MM')
}, },
async entranceClick(item) { async entranceClick(item) {
// 带 page 字段的入口直接跳转到对应页面
if (item.page) {
uni.navigateTo({ url: item.page })
return
}
if (this.toolComponentName == item.name) return if (this.toolComponentName == item.name) return
const noInterceptPage = ['DailyReport'] const noInterceptPage = ['DailyReport']
if (!noInterceptPage.includes(item.name) && (await this.checkDailyReport())) return if (!noInterceptPage.includes(item.name) && (await this.checkDailyReport())) return
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!