罗广辉
2026-04-24 297a9312da294d8069e4e79ae97346786164b523
feat: 更新文档,删除无用注释
13 files modified
215 ■■■■ changed files
README.md 102 ●●●●● patch | view | raw | blame | history
src/pages/map/index.vue 12 ●●●●● patch | view | raw | blame | history
src/pages/user/index.vue 2 ●●●●● patch | view | raw | blame | history
src/pages/work/index.vue 15 ●●●●● patch | view | raw | blame | history
src/subPackages/droneConsole/index.vue 5 ●●●●● patch | view | raw | blame | history
src/subPackages/inspectionTask/taskDetails.vue 3 ●●●●● patch | view | raw | blame | history
src/subPackages/qrCode/index.vue 14 ●●●●● patch | view | raw | blame | history
src/subPackages/taskDetail/addTask/index.vue 11 ●●●●● patch | view | raw | blame | history
src/subPackages/taskDetail/execution/index.vue 13 ●●●●● patch | view | raw | blame | history
src/subPackages/taskDetail/inProgress/index.vue 2 ●●●●● patch | view | raw | blame | history
src/subPackages/userDetail/password/index.vue 6 ●●●●● patch | view | raw | blame | history
src/subPackages/workDetail/addWork/index.vue 14 ●●●●● patch | view | raw | blame | history
src/subPackages/workDetail/mapWork/index.vue 16 ●●●●● patch | view | raw | blame | history
README.md
@@ -19,10 +19,112 @@
/software/service/drone/web/drone-app
正式
/app/service/drone/web/drone-app
# app更新步骤
修改 /src/config 里面的development的参数,改为对应环境的对应变量
# 小程序app更新步骤
1. 修改 /src/config 里面的development的参数,改为对应环境的对应变量
2. hbuild里面点击运行 =》到小程序 =》自动打开了小程序 =》
3. 调试好=》上传 =》[微信公众号](https://mp.weixin.qq.com/) =》 提交审核
# 开发者文档
- 本项目大量采用webview方式开发,只有登录页是原生的uniapp,其他的都是webview
- 登录了之后在userStore里面存了用户信息(包括token)
- 每个页面都会走WebViewPlus组件
- WebViewPlus里面有个属性src都会走getWebViewUrl方法
- WebViewPlus会监听webview发送给app的消息,统一处理
- getWebViewUrl方法里面 会把 路径自动拼接上userInfo(包括token)和一些其他参数
- 然后到webview这里的 permission.js会去自动接收这些参数并存储到stroe里面
webview跟app通信
h5或app的webview
```
webview
const transmitData = { data: { type: 'submitSuccess', fun: 'add' } }
uni.postMessage(transmitData)
app 接收到了
 uni.setStorageSync("joinParams", {
      type: "add",
    });
uni.switchTab({
      url: `/pages/work/index?addLog=111`,
});
```
微信小程序的webview
```
webview
const transmitData = { data: { type: 'submitSuccess', fun: 'add' } }
wx.miniProgram.switchTab({ url: `/pages/work/index?addLog=111` })
wx.miniProgram.postMessage(transmitData)
app 接收到了
uni.setStorageSync("joinParams", {
        type: "add",
      });
```
src/pages/map/index.vue
@@ -1,13 +1,4 @@
<!--
 * @Author       : yuan
 * @Date         : 2025-12-03 14:20:57
 * @LastEditors  : yuan
 * @LastEditTime : 2025-12-20 16:49:02
 * @FilePath     : \src\pages\map\index.vue
 * @Description  :
 * Copyright 2025 OBKoro1, All Rights Reserved.
 * 2025-12-03 14:20:57
-->
<template>
  <view class="page-wrap">
    <WebViewPlus :src="`${viewUrl}`" @webMessage="onPostMessage" />
@@ -19,7 +10,6 @@
import WebViewPlus from "@/components/WebViewPlus.vue";
import { onHide, onShow } from "@dcloudio/uni-app";
import {getUserInfo} from "@/api/user/index.js";
// const viewUrl = getWebViewUrl("/defaultMap");
let envParam = "";
// #ifdef WEB
src/pages/user/index.vue
@@ -53,12 +53,10 @@
<script setup>
import { getAssetsImage } from "@/utils/index.js";
import { getUserInfo } from "@/api/user/index.js";
import { useClipboard } from "@/hooks";
import { useUserStore } from "@/store/index.js";
import { onShow } from "@dcloudio/uni-app";
import { getDeviceRegionApi } from "@/api/map.js";
const { setClipboardData, getClipboardData } = useClipboard();
const rightImage = getAssetsImage("/images/user/rightBtn.png");
const logoImage = getAssetsImage("/images/user/logo1.png");
src/pages/work/index.vue
@@ -1,13 +1,3 @@
<!--
 * @Author       : yuan
 * @Date         : 2025-12-18 10:06:30
 * @LastEditors  : yuan
 * @LastEditTime : 2025-12-20 14:18:42
 * @FilePath     : \src\pages\work\index.vue
 * @Description  :
 * Copyright 2025 OBKoro1, All Rights Reserved.
 * 2025-12-18 10:06:30
-->
<template>
  <view class="eventTickets">
    <WebViewPlus
@@ -21,11 +11,9 @@
<script setup>
import { getWebViewUrl } from "@/utils/index.js";
import WebViewPlus from "@/components/WebViewPlus.vue";
import { useTabAddButton } from "@/hooks/index.js";
import { onShow, onHide } from "@dcloudio/uni-app";
const sWebViewRef = ref(null);
// const viewUrl = getWebViewUrl('/work', {})
const updateKey = ref(0);
const viewUrl = computed(() => {
  // #ifdef MP-WEIXIN
@@ -65,7 +53,6 @@
  }
  // #endif
}
const isApp = ref(false);
onShow(() => {
  const joinParams = uni.getStorageSync("joinParams");
  if (joinParams) {
@@ -86,11 +73,9 @@
  });
  // #endif
  // isApp.value = true
});
onHide(() => {
  // isApp.value = false
});
</script>
src/subPackages/droneConsole/index.vue
@@ -6,8 +6,6 @@
import {onHide, onLoad, onShow} from "@dcloudio/uni-app";
import WebViewPlus from "@/components/WebViewPlus.vue";
import {getEnvObj, getWebViewUrl} from "@/utils/index.js";
import Recorder from "js-audio-recorder";
import dayjs from "dayjs";
import {useUserStore} from "@/store/index.js";
const queryParams = ref({})
@@ -18,9 +16,6 @@
function onPostMessage(data) {
  if (data.type === 'back'){
    // uni.navigateTo({
    //   url: `/subPackages/inProgress/index?wayLineJobInfoId=${data.taskDetails.id}`
    // });
    // #ifdef H5
    window.history.back()
    // #endif
src/subPackages/inspectionTask/taskDetails.vue
@@ -26,7 +26,6 @@
<script setup>
import {onHide, onShow} from "@dcloudio/uni-app";
import {useUserStore} from "@/store/index.js";
const active = defineModel('active')
const sWebViewRef = ref(null)
@@ -36,8 +35,6 @@
import {onLoad} from "@dcloudio/uni-app";
// const active = defineModel('active')
// console.log(active.value, '555')
function onPostMessage(event) {
  if (event.detail.data[0].type === 'back'){
    active.value = null
src/subPackages/qrCode/index.vue
@@ -1,13 +1,3 @@
<!--
 * @Author       : yuan
 * @Date         : 2025-10-14 17:43:52
 * @LastEditors  : yuan
 * @LastEditTime : 2025-12-19 15:33:48
 * @FilePath     : \src\subPackages\qrCode\index.vue
 * @Description  :
 * Copyright 2025 OBKoro1, All Rights Reserved.
 * 2025-10-14 17:43:52
-->
<template>
  <view class="page-wrap">
    <WebViewPlus :src="`${viewUrl}`" @webMessage="onPostMessage" />
@@ -22,10 +12,6 @@
const onPostMessage = (data) => {
  if (data.type === "browser") {
    // #ifdef MP-WEIXIN
    // #endif
    // #ifndef MP-WEIXIN
    uni.navigateTo({
      url:
src/subPackages/taskDetail/addTask/index.vue
@@ -9,8 +9,6 @@
import { getWebViewUrl } from "@/utils/index.js";
import { onHide, onLoad, onShow } from "@dcloudio/uni-app";
// const viewUrl = ref(getWebViewUrl('/addTask'))
const sWebViewRef = ref(null);
const viewUrl = ref("");
function onPostMessage(data) {
@@ -27,23 +25,14 @@
    uni.setStorageSync("joinParams", {
      type: "add",
    });
    // console.log('打印新增成功')
    uni.switchTab({
      url: "/pages/inspectionTask/index",
    });
    // #endif
    // uni.redirectTo({
    //   url: `/pages/inspectionTask/index?addLog=1111`
    // });
  }
}
// onLoad( (options) => {
//   console.log(options, '8888')
//   const sns = options.device_sn
//
// });
const isApp = ref(false);
// #ifdef MP-WEIXIN
src/subPackages/taskDetail/execution/index.vue
@@ -10,17 +10,7 @@
const wayLineJobInfoId = ref(null)
const viewUrl = ref('')
// const viewUrl = ref(getWebViewUrl('/execution'))
// function onPostMessage(data) {
//   console.log(data, '9999')
//   if (data.type === 'taskDetails'){
//     console.log('4444')
//     uni.switchTab({
//       url: '/subPackages/taskDetail/execution/index'
//     });
//   }
// }
function onPostMessage(data) {
  if (data.type === 'back') {
    uni.switchTab({
@@ -47,8 +37,7 @@
});
onHide(() => {
  // 如果工单详情返回任务详情,那么tab栏对应的是关联事件一项
  // isApp.value = false
});
</script>
src/subPackages/taskDetail/inProgress/index.vue
@@ -16,8 +16,6 @@
const viewUrl = ref("");
const showComponent = ref(false);
function onPostMessage(data) {
  // #ifdef MP-WEIXIN
  // #endif
  // #ifndef MP-WEIXIN
  if (data.type === "back") {
src/subPackages/userDetail/password/index.vue
@@ -71,12 +71,6 @@
            });
            return false;
        }
        // const hasLetter = /[a-zA-Z]/.test(password);
        // const hasNumber = /\d/.test(password);
        // if (!hasLetter || !hasNumber) {
        //   ElMessage.error('密码需同时包含字母和数字');
        //   return false;
        // }
        return true;
    };
    const clearForm = () => {
src/subPackages/workDetail/addWork/index.vue
@@ -1,13 +1,4 @@
<!--
 * @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
@@ -38,9 +29,6 @@
    uni.setStorageSync("joinParams", {
      type: "add",
    });
    // uni.switchTab({
    //   url: '/pages/work/index'
    // });
    uni.switchTab({
      url: `/pages/work/index?addLog=111`,
    });
src/subPackages/workDetail/mapWork/index.vue
@@ -1,13 +1,4 @@
<!--
 * @Author       : yuan
 * @Date         : 2025-10-22 14:59:10
 * @LastEditors  : yuan
 * @LastEditTime : 2025-12-19 14:52:54
 * @FilePath     : \src\subPackages\workDetail\mapWork\index.vue
 * @Description  :
 * Copyright 2025 OBKoro1, All Rights Reserved.
 * 2025-10-22 14:59:10
-->
<!-- 地图展示 -->
<template>
  <WebViewPlus
@@ -29,14 +20,9 @@
  viewUrl.value = getWebViewUrl("/mapWork", { currentItem: currentItem });
});
function onPostMessage(data) {
  // #ifdef MP-WEIXIN
  // #endif
  // #ifndef MP-WEIXIN
  if (data.type === "workDetailback") {
    // uni.navigateTo({
    //   url: '/subPackages/workDetail/index'
    // });
    uni.navigateBack({
      delta: 1,
    });