chenyao
2025-12-01 08fcc710d0a2acb185b3477d72fe32aff6f2e29a
src/pages/work/index.vue
@@ -1,67 +1,76 @@
<!-- 事件工单 -->
<template>
  <view class="min-h-screen flex flex-col items-center">
    <image
      class="mb-50rpx mt-200rpx h-200rpx w-200rpx"
      src="@/static/images/logo.png"
      width="200rpx"
      height="200rpx"
    />
    <view class="flex justify-center">
      <text class="font-size-36rpx">
        {{ $t("home.intro") }}
      </text>
    </view>
    <view class="mt-100rpx flex gap-30rpx">
      <lang-select />
      <view class="cursor-pointer" @click="toGithub">
        <view class="i-mdi-github text-40rpx" />
      </view>
    </view>
   <view class="eventTickets">
      <WebViewPlus ref="sWebViewRef" :src="`${viewUrl}`" @webMessage="onPostMessage" />
    <!-- #ifdef MP-WEIXIN -->
    <!-- 隐私协议组件 -->
    <agree-privacy
      v-model="showAgreePrivacy"
      :disable-check-privacy="false"
      @agree="handleAgree"
    />
    <!-- #endif -->
  </view>
   </view>
</template>
<script setup>
// #ifdef MP-WEIXIN
import { useShare } from "@/hooks";
// #endif
   import {
      getWebViewUrl
   } from "@/utils/index.js";
   import WebViewPlus from "@/components/WebViewPlus.vue";
   import {
      useTabAddButton
   } from "@/hooks/index.js";
   const sWebViewRef = ref(null);
   // const viewUrl = getWebViewUrl('/work', {})
   const updateKey = ref(0)
   const viewUrl = computed(() => {
      return getWebViewUrl('/work', {
         updateKey: updateKey.value
      })
   })
// #ifdef MP-WEIXIN
// 分享使用示例
const { onShareAppMessage, onShareTimeline } = useShare({
  title: "首页",
  path: "pages/tab/map/index",
  imageUrl: "",
});
onShareAppMessage();
onShareTimeline();
// #endif
   function onPostMessage(data) {
      if (data.type === 'jumpMapNav') {
         uni.navigateTo({
            url: `/subPackages/workDetail/mapWork/index?currentItem=${data.eventNum}`
         });
const title = ref();
title.value = import.meta.env.VITE_APP_TITLE;
      } else if (data.type === 'workid') {
         uni.navigateTo({
            url: `/subPackages/workDetail/index?eventNum=${data.eventNum}&totalNum=${data.totalNum}&keyword=${data.keyword}&aiType=${data.aiType}&status=${data.status}`
         });
      } else if (data.type === 'bigImage') {
         uni.navigateTo({
            url: `/subPackages/workDetail/photoMagnify/index?eventNum=${data.eventNum}`
         });
const showAgreePrivacy = ref(false);
      }
// 同意隐私协议
function handleAgree() {
  console.log("同意隐私政策");
}
   }
   const isApp = ref(false)
   onShow(() => {
      const joinParams = uni.getStorageSync('joinParams');
      if (joinParams) {
         updateKey.value = updateKey.value + 1
         uni.removeStorageSync('joinParams');
      }
      uni.setTabBarItem({
         index: 2, // Tab 的索引(从0开始)
         // text: '新建工单',
         visible: true,
         "pagePath": "subPackages/workDetail/addWork/index"
      });
      uni.setTabBarItem({
         index: 3, // Tab
         visible: false,
      });
      // isApp.value = true
   });
// 打开github
function toGithub() {
  if (window?.open) {
    window.open("https://github.com/oyjt/uniapp-vue3-template");
  } else {
    uni.$u.toast("请使用浏览器打开");
  }
}
   onHide(() => {
      // isApp.value = false
   });
</script>
<style scoped lang="scss">
   .eventTickets {
      width: 100%;
      height: 100%;
   }
</style>