From 71a2b630990f299b4312bbad1dc63b14b92cae89 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Sat, 20 Dec 2025 17:05:45 +0800
Subject: [PATCH] feat:部分页面跳转兼容小程序处理
---
src/pages/map/index.vue | 2
src/subPackages/workDetail/index.vue | 91 +++++++++++++---------
src/subPackages/workDetail/addWork/index.vue | 72 +++++++++++------
src/subPackages/taskDetail/addTask/index.vue | 25 +++++
src/pages/inspectionTask/index.vue | 2
src/utils/common/index.js | 2
6 files changed, 126 insertions(+), 68 deletions(-)
diff --git a/src/pages/inspectionTask/index.vue b/src/pages/inspectionTask/index.vue
index be56b1d..4aeeb55 100644
--- a/src/pages/inspectionTask/index.vue
+++ b/src/pages/inspectionTask/index.vue
@@ -66,7 +66,7 @@
// #endif
}
}
-const isApp = ref(false);
+
onShow(() => {
const joinParams = uni.getStorageSync("joinParams");
if (joinParams) {
diff --git a/src/pages/map/index.vue b/src/pages/map/index.vue
index a24c644..b92167f 100644
--- a/src/pages/map/index.vue
+++ b/src/pages/map/index.vue
@@ -2,7 +2,7 @@
* @Author : yuan
* @Date : 2025-12-03 14:20:57
* @LastEditors : yuan
- * @LastEditTime : 2025-12-19 15:32:31
+ * @LastEditTime : 2025-12-20 16:49:02
* @FilePath : \src\pages\map\index.vue
* @Description :
* Copyright 2025 OBKoro1, All Rights Reserved.
diff --git a/src/subPackages/taskDetail/addTask/index.vue b/src/subPackages/taskDetail/addTask/index.vue
index b679b3e..f175785 100644
--- a/src/subPackages/taskDetail/addTask/index.vue
+++ b/src/subPackages/taskDetail/addTask/index.vue
@@ -16,6 +16,11 @@
function onPostMessage(data) {
if (data.type === "submitSuccess") {
// #ifdef MP-WEIXIN
+ if ("fun" in data && data.fun === "add") {
+ uni.setStorageSync("joinParams", {
+ type: "add",
+ });
+ }
// #endif
// #ifndef MP-WEIXIN
@@ -39,8 +44,24 @@
// const sns = options.device_sn
//
// });
-
const isApp = ref(false);
+
+// #ifdef MP-WEIXIN
+onLoad((options) => {
+ isApp.value = true;
+ let params = {};
+ if ("data" in options) {
+ try {
+ params = JSON.parse(options.data);
+ } catch (e) {
+ console.error(e);
+ }
+ }
+ viewUrl.value = getWebViewUrl("/addTask", params);
+});
+// #endif
+
+// #ifndef MP-WEIXIN
onShow(() => {
isApp.value = true;
let params = {};
@@ -52,9 +73,9 @@
console.error(e);
}
}
-
viewUrl.value = getWebViewUrl("/addTask", params);
});
+// #endif
onHide(() => {
isApp.value = false;
diff --git a/src/subPackages/workDetail/addWork/index.vue b/src/subPackages/workDetail/addWork/index.vue
index bdce9ca..6d9b4a0 100644
--- a/src/subPackages/workDetail/addWork/index.vue
+++ b/src/subPackages/workDetail/addWork/index.vue
@@ -1,34 +1,52 @@
+<!--
+ * @Author : yuan
+ * @Date : 2025-11-13 18:14:52
+ * @LastEditors : yuan
+ * @LastEditTime : 2025-12-20 16:56:27
+ * @FilePath : \src\subPackages\workDetail\addWork\index.vue
+ * @Description :
+ * Copyright 2025 OBKoro1, All Rights Reserved.
+ * 2025-11-13 18:14:52
+-->
<template>
- <view>
- <WebViewPlus @webMessage="onPostMessage" ref="sWebViewRef" :src="`${viewUrl}`" />
-
- </view>
-
+ <view>
+ <WebViewPlus
+ @webMessage="onPostMessage"
+ ref="sWebViewRef"
+ :src="`${viewUrl}`"
+ />
+ </view>
</template>
<script setup>
- import {
- getWebViewUrl
- } from "@/utils/index.js";
- import WebViewPlus from "@/components/WebViewPlus.vue";
- const sWebViewRef = ref(null);
- const viewUrl = getWebViewUrl('/addWork')
+import { getWebViewUrl } from "@/utils/index.js";
+import WebViewPlus from "@/components/WebViewPlus.vue";
+const sWebViewRef = ref(null);
+const viewUrl = getWebViewUrl("/addWork");
- function onPostMessage(data) {
- if (data.type === 'submitSuccess') {
- uni.setStorageSync('joinParams', {
- type: 'add'
- });
- // uni.switchTab({
- // url: '/pages/work/index'
- // });
- uni.switchTab({
- url: `/pages/work/index?addLog=111`
- });
- }
- }
+function onPostMessage(data) {
+ if (data.type === "submitSuccess") {
+ // #ifdef MP-WEIXIN
+ if ("fun" in data && data.fun === "add") {
+ uni.setStorageSync("joinParams", {
+ type: "add",
+ });
+ }
+ // #endif
+
+ // #ifndef MP-WEIXIN
+ uni.setStorageSync("joinParams", {
+ type: "add",
+ });
+ // uni.switchTab({
+ // url: '/pages/work/index'
+ // });
+ uni.switchTab({
+ url: `/pages/work/index?addLog=111`,
+ });
+ // #endif
+ }
+}
</script>
-<style scoped lang="scss">
-
-</style>
\ No newline at end of file
+<style scoped lang="scss"></style>
diff --git a/src/subPackages/workDetail/index.vue b/src/subPackages/workDetail/index.vue
index 6fc8a4c..e4b497b 100644
--- a/src/subPackages/workDetail/index.vue
+++ b/src/subPackages/workDetail/index.vue
@@ -1,48 +1,67 @@
<!-- 工单详情 - 包含待审核、待处理、处理中、已完成 -->
<template>
- <div class="workDetailContainer">
- <WebViewPlus ref="sWebViewRef" :src="`${viewUrl}`" @webMessage="onPostMessage"/>
- </div>
+ <div class="workDetailContainer">
+ <WebViewPlus
+ ref="sWebViewRef"
+ :src="`${viewUrl}`"
+ @webMessage="onPostMessage"
+ />
+ </div>
</template>
<script setup>
- import {getWebViewUrl} from "@/utils/index.js";
- import { onLoad } from '@dcloudio/uni-app';
- import { useUserStore } from '@/store/index.js'
- const userStore = useUserStore()
- const userInfo = userStore.userInfo
- const sWebViewRef = ref(null);
- const viewUrl = ref('')
- onLoad( (options) => {
- const eventNum= options.eventNum;
- viewUrl.value = getWebViewUrl('/workDetail', {eventNum:eventNum,totalNum:options.totalNum,keyword:options.keyword,aiType:options.aiType,wLJobInfoId:options.wLJobInfoId,status:options.status})
- });
+import { getWebViewUrl } from "@/utils/index.js";
+import { onLoad } from "@dcloudio/uni-app";
+import { useUserStore } from "@/store/index.js";
+const userStore = useUserStore();
+const userInfo = userStore.userInfo;
+const sWebViewRef = ref(null);
+const viewUrl = ref("");
+onLoad((options) => {
+ const eventNum = options.eventNum;
+ viewUrl.value = getWebViewUrl("/workDetail", {
+ eventNum: eventNum,
+ totalNum: options.totalNum,
+ keyword: options.keyword,
+ aiType: options.aiType,
+ wLJobInfoId: options.wLJobInfoId,
+ status: options.status,
+ });
+});
- function onPostMessage(data) {
+function onPostMessage(data) {
+ if (data.type === "workback") {
+ // #ifdef MP-WEIXIN
+ if ("fun" in data && data.fun === "add") {
+ uni.setStorageSync("joinParams", {
+ type: "add",
+ });
+ }
+ // #endif
- if (data.type === 'workback'){
- uni.setStorageSync('joinParams', {
- type: 'add'
- });
- uni.switchTab({
- url: `/pages/work/index?addLog=111`
- // url: '/pages/work/index'
- });
- }else if(data.type === 'jumpMapNav'){
- uni.navigateTo({
- url:`/subPackages/workDetail/mapWork/index?currentItem=${data.eventNum}`
- });
- }
- }
-
+ // #ifndef MP-WEIXIN
+ uni.setStorageSync("joinParams", {
+ type: "add",
+ });
+ uni.switchTab({
+ url: `/pages/work/index?addLog=111`,
+ // url: '/pages/work/index'
+ });
+ // #endif
+ } else if (data.type === "jumpMapNav") {
+ // #ifndef MP-WEIXIN
+ uni.navigateTo({
+ url: `/subPackages/workDetail/mapWork/index?currentItem=${data.eventNum}`,
+ });
+ // #endif
+ }
+}
</script>
<style lang="scss" scoped>
- .workDetailContainer {
+.workDetailContainer {
width: 100%;
- height: 100%;
- background-size: cover;
-
-
- }
+ height: 100%;
+ background-size: cover;
+}
</style>
diff --git a/src/utils/common/index.js b/src/utils/common/index.js
index 4de0465..a2bb1d8 100644
--- a/src/utils/common/index.js
+++ b/src/utils/common/index.js
@@ -42,7 +42,7 @@
}
export function getStatusBarHeight () {
try {
- const systemInfo = uni.getSystemInfoSync()
+ const systemInfo = uni.getWindowInfo()
// #ifdef APP-PLUS
return systemInfo.statusBarHeight || 0
--
Gitblit v1.9.3