shuishen
2025-12-20 71a2b630990f299b4312bbad1dc63b14b92cae89
feat:部分页面跳转兼容小程序处理
6 files modified
194 ■■■■■ changed files
src/pages/inspectionTask/index.vue 2 ●●● patch | view | raw | blame | history
src/pages/map/index.vue 2 ●●● patch | view | raw | blame | history
src/subPackages/taskDetail/addTask/index.vue 25 ●●●●● patch | view | raw | blame | history
src/subPackages/workDetail/addWork/index.vue 72 ●●●●● patch | view | raw | blame | history
src/subPackages/workDetail/index.vue 91 ●●●●● patch | view | raw | blame | history
src/utils/common/index.js 2 ●●● patch | view | raw | blame | history
src/pages/inspectionTask/index.vue
@@ -66,7 +66,7 @@
    // #endif
  }
}
const isApp = ref(false);
onShow(() => {
  const joinParams = uni.getStorageSync("joinParams");
  if (joinParams) {
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.
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;
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>
<style scoped lang="scss"></style>
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>
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