From b642a20e0cc04ae0b7b1a803439411f49fe0b576 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Wed, 15 Oct 2025 09:08:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/pages/map/index.vue                                            |   52 ++++++
 /dev/null                                                          |   45 -----
 src/pages.json                                                     |  209 +++++++++++++------------
 src/pages/inspectionTask/TaskDetails/DroneConsole/DroneConsole.vue |   30 +++
 src/components/WebViewPlus.vue                                     |   11 +
 package.json                                                       |    6 
 src/pages/inspectionTask/TaskDetails/TaskDetails.vue               |   40 +---
 src/subPackages/qrCode/index.vue                                   |    9 +
 src/pages/inspectionTask/index.vue                                 |    2 
 src/utils/common/index.js                                          |   17 ++
 10 files changed, 239 insertions(+), 182 deletions(-)

diff --git a/package.json b/package.json
index 524a956..064f526 100644
--- a/package.json
+++ b/package.json
@@ -54,7 +54,6 @@
     "stylelint": "stylelint \"src/**/*.{vue,scss,css,sass,less}\"",
     "stylelint:fix": "stylelint \"src/**/*.{vue,scss,css,sass,less}\" --fix",
     "cz": "git add . && npx czg",
-    "postinstall": "simple-git-hooks",
     "clean": "npx rimraf node_modules",
     "clean:cache": "npx rimraf node_modules/.cache"
   },
@@ -110,7 +109,6 @@
     "rollup-plugin-visualizer": "^6.0.3",
     "sass": "1.79.6",
     "sass-loader": "^16.0.4",
-    "simple-git-hooks": "^2.13.1",
     "stylelint": "^16.23.0",
     "stylelint-config-recess-order": "^6.1.0",
     "stylelint-config-standard": "^39.0.0",
@@ -129,10 +127,6 @@
     "overrides": {
       "vue": "3.4.21"
     }
-  },
-  "simple-git-hooks": {
-    "pre-commit": "npx lint-staged",
-    "commit-msg": "node ./scripts/verify-commit.js"
   },
   "lint-staged": {
     "src/**/*.{js,jsx}": "eslint --fix",
diff --git a/scripts/verify-commit.js b/scripts/verify-commit.js
deleted file mode 100644
index 29a52eb..0000000
--- a/scripts/verify-commit.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * 提交信息校验
- * @link https://github.com/toplenboren/simple-git-hooks
- * @see 参考:https://github.com/vuejs/vue-next/blob/master/.github/commit-convention.md
- */
-import { readFileSync } from 'node:fs'
-import path from 'node:path'
-import process from 'node:process'
-import pico from 'picocolors'
-
-const msgPath = path.resolve('.git/COMMIT_EDITMSG')
-const msg = readFileSync(msgPath, 'utf-8').trim()
-
-const commitRE
-  = /^(?:revert: )?(?:feat|fix|docs|dx|style|refactor|perf|test|workflow|build|ci|chore|types|wip|mod|release|strengthen)(?:\(.+\))?: .{1,50}/
-
-if (!commitRE.test(msg)) {
-  console.log(pico.yellow(`\n提交的信息: ${msg}\n`))
-  console.error(
-    `  ${pico.white(pico.bgRed(' 格式错误 '))} ${pico.red(
-      '无效的提交信息格式.',
-    )}\n\n${pico.red('  正确的提交消息格式. 例如:\n\n')
-    }    ${pico.green('feat: add a new feature')}\n`
-    + `    ${pico.green('fix: fixed an bug')}`,
-  )
-  process.exit(1)
-}
diff --git a/src/components/WebViewPlus.vue b/src/components/WebViewPlus.vue
index b3ca12f..775ff39 100644
--- a/src/components/WebViewPlus.vue
+++ b/src/components/WebViewPlus.vue
@@ -8,11 +8,16 @@
 const emit = defineEmits(['webMessage'])
 
 function viewMessage(event) {
-  messageFun({data: {data: {arg: event.detail.data[0]}}})
+  messageFun({
+    data: {data: {arg: event.detail.data[0]}},
+    type: 'WEB_INVOKE_APPSERVICE'
+  })
 }
-
+// WEB_INVOKE_APPSERVICE
 function messageFun(e) {
-  emit('webMessage', e.data.data.arg)
+  if(e.data.type === 'WEB_INVOKE_APPSERVICE'){
+    emit('webMessage', e.data.data.arg)
+  }
 }
 
 onShow(() => {
diff --git a/src/pages.json b/src/pages.json
index bd3e562..1136615 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -7,7 +7,8 @@
       "^(?!z-paging-refresh|z-paging-load-more)z-paging(.*)": "z-paging/components/z-paging$1/z-paging$1.vue"
     }
   },
-  "pages": [{
+  "pages": [
+    {
       "path": "pages/map/index",
       "style": {
         "navigationBarTitleText": "地图"
@@ -18,7 +19,8 @@
       "style": {
         "navigationBarTitleText": "巡检任务"
       }
-    }, {
+    },
+    {
       "path": "pages/work/index",
       "style": {
         "navigationBarTitleText": "事件工单"
@@ -31,7 +33,14 @@
       }
     },
     {
-      "path": "pages/droneConsole/index",
+      "path": "pages/inspectionTask/TaskDetails/TaskDetails",
+      "style": {
+        "navigationBarTitleText": "执行中",
+        "navigationStyle": "custom"
+      }
+    },
+    {
+      "path": "pages/inspectionTask/TaskDetails/DroneConsole/DroneConsole",
       "style": {
         "navigationBarTitleText": "控制台",
         "navigationStyle": "custom"
@@ -44,107 +53,106 @@
       }
     }
   ],
-  "subPackages": [{
-    "root": "subPackages",
-    "pages": [
-      {
-        "path": "404/index",
-        "style": {
-          "navigationBarTitleText": "404",
-          "navigationStyle": "custom"
+  "subPackages": [
+    {
+      "root": "subPackages",
+      "pages": [
+        {
+          "path": "404/index",
+          "style": {
+            "navigationBarTitleText": "404",
+            "navigationStyle": "custom"
+          }
+        },
+        {
+          "path": "theme/index",
+          "style": {
+            "navigationBarTitleText": "主题设置"
+          }
+        },
+        {
+          "path": "taskDetail/index",
+          "style": {
+            "navigationBarTitleText": "任务详情"
+          }
+        },
+        {
+          "path": "taskDetail/addTask/index",
+          "style": {
+            "navigationBarTitleText": "新建任务"
+          }
+        },
+        {
+          "path": "taskDetail/execution/index",
+          "style": {
+            "navigationBarTitleText": "任务详情"
+          }
+        },
+        {
+          "path": "taskDetail/inExecution/index",
+          "style": {
+            "navigationBarTitleText": "执行中"
+          }
+        },
+        {
+          "path": "workDetail/index",
+          "style": {
+            "navigationBarTitleText": "工单详情"
+          }
+        },
+        {
+          "path": "workDetail/addWork/index",
+          "style": {
+            "navigationBarTitleText": "新建工单"
+          }
+        },
+        {
+          "path": "workDetail/mapWork/index",
+          "style": {
+            "navigationBarTitleText": "地图展示"
+          }
+        },
+        {
+          "path": "workDetail/photoMagnify/index",
+          "style": {
+            "navigationBarTitleText": "照片放大"
+          }
+        },
+        {
+          "path": "userDetail/infos/index",
+          "style": {
+            "navigationBarTitleText": "个人资料"
+          }
+        },
+        {
+          "path": "userDetail/password/index",
+          "style": {
+            "navigationBarTitleText": "修改密码"
+          }
+        },
+        {
+          "path": "browser/index",
+          "style": {
+            "navigationBarTitleText": "地图"
+          }
+        },
+        {
+          "path": "qrCode/index",
+          "style": {
+            "navigationBarTitleText": "扫码",
+            "navigationBarTextStyle": "black"
+          }
         }
-      },
-      {
-        "path": "theme/index",
-        "style": {
-          "navigationBarTitleText": "主题设置"
-        }
-      },
-      {
-        "path": "taskDetail/index",
-        "style": {
-          "navigationBarTitleText": "任务详情"
-        }
-      },
-
-      {
-        "path": "taskDetail/addTask/index",
-        "style": {
-          "navigationBarTitleText": "新建任务"
-        }
-      },
-
-      {
-        "path": "taskDetail/execution/index",
-        "style": {
-          "navigationBarTitleText": "任务详情"
-        }
-      },
-
-      {
-        "path": "taskDetail/inExecution/index",
-        "style": {
-          "navigationBarTitleText": "执行中"
-        }
-      },
-
-      {
-        "path": "workDetail/index",
-        "style": {
-          "navigationBarTitleText": "工单详情"
-        }
-      },
-
-      {
-        "path": "workDetail/addWork/index",
-        "style": {
-          "navigationBarTitleText": "新建工单"
-        }
-      },
-
-      {
-        "path": "workDetail/mapWork/index",
-        "style": {
-          "navigationBarTitleText": "地图展示"
-        }
-      },
-
-      {
-        "path": "workDetail/photoMagnify/index",
-        "style": {
-          "navigationBarTitleText": "照片放大"
-        }
-      },
-
-      {
-        "path": "userDetail/infos/index",
-        "style": {
-          "navigationBarTitleText": "个人资料"
-        }
-      },
-
-      {
-        "path": "userDetail/password/index",
-        "style": {
-          "navigationBarTitleText": "修改密码"
-        }
-      },
-
-      {
-        "path": "browser/index",
-        "style": {
-          "navigationBarTitleText": "地图"
-        }
-      }
-    ]
-  }],
-
+      ]
+    }
+  ],
   "tabBar": {
     "color": "#1b233b",
     "selectedColor": "#21d59d",
     "borderStyle": "black",
     "backgroundColor": "#ffffff",
-    "list": [{
+    "list": [
+      {
         "iconPath": "static/images/tabbar/icon_home.png",
         "selectedIconPath": "static/images/tabbar/icon_home_selected.png",
         "pagePath": "pages/map/index",
@@ -155,7 +163,8 @@
         "selectedIconPath": "static/images/tabbar/icon_list_selected.png",
         "pagePath": "pages/inspectionTask/index",
         "text": "巡检任务"
-      }, {
+      },
+      {
         "iconPath": "static/images/tabbar/icon_home.png",
         "selectedIconPath": "static/images/tabbar/icon_home_selected.png",
         "pagePath": "pages/work/index",
@@ -175,4 +184,4 @@
     "navigationBarBackgroundColor": "#F8F8F8",
     "backgroundColor": "#F8F8F8"
   }
-}
+}
\ No newline at end of file
diff --git a/src/pages/droneConsole/index.vue b/src/pages/droneConsole/index.vue
deleted file mode 100644
index 8ac8146..0000000
--- a/src/pages/droneConsole/index.vue
+++ /dev/null
@@ -1,45 +0,0 @@
-<template>
-  <view class="page-wrap">
-    <web-view
-      ref="sWebViewRef"
-      :src='`${viewUrl}?token=${token}&wayLineJodInfoId=${active.id}`'
-      @message="onPostMessage"
-      @onPostMessage="onPostMessage"
-    />
-  </view>
-</template>
-<script setup>
-import {onHide, onShow} from "@dcloudio/uni-app";
-import {useUserStore} from "@/store/index.js";
-const active = defineModel('active')
-const sWebViewRef = ref(null)
-const viewUrl = 'http://192.168.1.15:5173/drone-app-web-view/#/appTaskDetails'
-const userStore = useUserStore()
-const token = computed(() => userStore?.userInfo?.access_token)
-
-function onPostMessage(event) {
-  if (event.detail.data[0].type === 'back') {
-    active.value = null
-  }
-}
-
-
-
-
-
-
-onShow(() => {
-  // #ifdef APP-PLUS
-  plus.screen.lockOrientation("landscape-primary");
-  // #endif
-});
-
-onHide(() => {
-  // #ifdef APP-PLUS
-  plus.screen.lockOrientation("portrait-primary");
-  // #endif
-});
-</script>
-<style scoped lang="scss">
-
-</style>
diff --git a/src/pages/inspectionTask/TaskDetails/DroneConsole/DroneConsole.vue b/src/pages/inspectionTask/TaskDetails/DroneConsole/DroneConsole.vue
new file mode 100644
index 0000000..8c5b7d7
--- /dev/null
+++ b/src/pages/inspectionTask/TaskDetails/DroneConsole/DroneConsole.vue
@@ -0,0 +1,30 @@
+<template>
+  <WebViewPlus :src="`${viewUrl}`" @webMessage="onPostMessage"/>
+</template>
+<script setup>
+import {onHide, onShow} from "@dcloudio/uni-app";
+import WebViewPlus from "@/components/WebViewPlus.vue";
+import {getWebViewUrl} from "@/utils/index.js";
+
+const viewUrl = getWebViewUrl('/droneConsole', {wayLineJodInfoId: 6120})
+
+function onPostMessage(event) {
+
+}
+
+
+onShow(() => {
+  // #ifdef APP-PLUS
+  plus.screen.lockOrientation("landscape-primary");
+  // #endif
+});
+
+onHide(() => {
+  // #ifdef APP-PLUS
+  plus.screen.lockOrientation("portrait-primary");
+  // #endif
+});
+</script>
+<style scoped lang="scss">
+
+</style>
diff --git a/src/pages/inspectionTask/TaskDetails/TaskDetails.vue b/src/pages/inspectionTask/TaskDetails/TaskDetails.vue
index ac3df84..9ccebd5 100644
--- a/src/pages/inspectionTask/TaskDetails/TaskDetails.vue
+++ b/src/pages/inspectionTask/TaskDetails/TaskDetails.vue
@@ -1,38 +1,28 @@
 <template>
-  <view class="page-wrap">
-    <web-view
-      ref="sWebViewRef"
-      :src='`${viewUrl}?token=${token}&wayLineJodInfoId=${active.id}`'
-      @message="onPostMessage"
-      @onPostMessage="onPostMessage"
-    />
-  </view>
+  <WebViewPlus :src="`${viewUrl}`" @webMessage="onPostMessage"/>
 </template>
 
 <script setup>
-import {onLoad} from "@dcloudio/uni-app";
 import {useUserStore} from "@/store/index.js";
+import WebViewPlus from "@/components/WebViewPlus.vue";
+import {getWebViewUrl} from "@/utils/index.js";
 
-const active = defineModel('active')
-const sWebViewRef = ref(null)
-const viewUrl = 'http://192.168.1.15:5173/drone-app-web-view/#/appTaskDetails'
 const userStore = useUserStore()
-const token = computed(() => userStore?.userInfo?.access_token)
 
-function onPostMessage(event) {
-  if (event.detail.data[0].type === 'back') {
-    active.value = null
+const viewUrl = getWebViewUrl('/appTaskDetails', {wayLineJodInfoId: 6120})
+
+
+function onPostMessage(data) {
+  if (data.type === 'back'){
+    uni.switchTab({
+      url: '/pages/inspectionTask/index'
+    });
+  }else if(data.type === 'control'){
+    uni.redirectTo({
+      url: '/pages/inspectionTask/TaskDetails/DroneConsole/DroneConsole'
+    });
   }
 }
-
-onLoad(() => {
-  window.addEventListener('message', function (e) {
-    if (e.data.data.type === 'back') {
-      active.value = null
-    }
-  });
-})
-
 </script>
 
 <style scoped lang="scss">
diff --git a/src/pages/inspectionTask/index.vue b/src/pages/inspectionTask/index.vue
index 2500651..50efff3 100644
--- a/src/pages/inspectionTask/index.vue
+++ b/src/pages/inspectionTask/index.vue
@@ -8,7 +8,7 @@
 
 const sWebViewRef = ref(null);
 const userStore = useUserStore();
-const viewUrl = `http://192.168.1.178:5173/drone-app-web-view/#/webViewWrapper/inspectionTask?params=${JSON.stringify(userStore?.userInfo)}`;
+const viewUrl = `http://192.168.1.15:5174/drone-app-web-view/#/webViewWrapper/inspectionTask?params=${JSON.stringify(userStore?.userInfo)}`;
 </script>
 <style scoped lang="scss">
 
diff --git a/src/pages/map/index.vue b/src/pages/map/index.vue
index c5e9f0e..d16b73d 100644
--- a/src/pages/map/index.vue
+++ b/src/pages/map/index.vue
@@ -1,6 +1,11 @@
 <template>
   <view class="page-wrap">
-    <web-view ref="sWebViewRef" :src="`${viewUrl}`" />
+    <web-view
+      ref="sWebViewRef"
+      :src="`${viewUrl}`"
+      @message="onPostMessage"
+      @onPostMessage="onPostMessage"
+    />
   </view>
 </template>
 
@@ -9,9 +14,52 @@
 
 const sWebViewRef = ref(null);
 const userStore = useUserStore();
-const viewUrl = `http://192.168.1.194:5174/drone-app-web-view/#/webViewWrapper/defaultMap?params=${JSON.stringify(userStore?.userInfo)}`;
+const viewUrl = `https://192.168.1.194:5174/drone-app-web-view/#/webViewWrapper/defaultMap?params=${JSON.stringify(
+  userStore?.userInfo
+)}`;
+
+const onPostMessage = (event) => {
+  // #ifdef APP-PLUS
+  if (event.detail.data[0].type === "scanCode") {
+    scanCode();
+  }
+  // #endif
+};
+
+const scanCode = () => {
+  // 只允许通过相机扫码
+  uni.scanCode({
+    onlyFromCamera: true,
+    success: function (res) {
+      console.log("条码类型:" + res.scanType);
+      console.log("条码内容:" + res.result);
+
+      // 获取扫码结果
+      let url = res.result;
+
+      // 跳转到B页面,并传递URL参数
+      uni.navigateTo({
+        url: "/subPackages/browser/index?url=" + encodeURIComponent(url),
+      });
+    },
+    fail: function (err) {
+      console.log("扫码失败:", err);
+      uni.showToast({
+        title: "扫码失败",
+        icon: "none",
+      });
+    },
+  });
+};
 
 onLoad(() => {
+  // #ifdef H5
+  window.addEventListener("message", function (e) {
+    if (e.data.data.type === "scanCode") {
+      scanCode();
+    }
+  });
+  // #endif
 });
 </script>
 
diff --git a/src/subPackages/qrCode/index.vue b/src/subPackages/qrCode/index.vue
new file mode 100644
index 0000000..ec04f71
--- /dev/null
+++ b/src/subPackages/qrCode/index.vue
@@ -0,0 +1,9 @@
+<template>
+  <web-view ref="sWebViewRef" :src="`${viewUrl}`" />
+</template>
+
+<script setup>
+const viewUrl = `https://192.168.1.194:5174/drone-app-web-view/#/webViewWrapper/QrCodeScanner`;
+</script>
+
+<style lang="scss" scoped></style>
diff --git a/src/utils/common/index.js b/src/utils/common/index.js
index 5a5e601..63a29a5 100644
--- a/src/utils/common/index.js
+++ b/src/utils/common/index.js
@@ -1,4 +1,6 @@
 // 小程序更新检测
+import {useUserStore} from "@/store/index.js";
+
 export function mpUpdate () {
   const updateManager = uni.getUpdateManager()
   updateManager.onCheckForUpdate(res => {
@@ -26,3 +28,18 @@
     })
   })
 }
+
+export function getWebViewUrl(targetUrl,otherParams){
+  const userStore = useUserStore()
+  const url = import.meta.env.VITE_APP_WEBVIEW_URL
+  // 构建查询参数
+  const params = new URLSearchParams()
+  params.append('params', JSON.stringify(userStore?.userInfo))
+  // 处理 otherParams 对象
+  if (otherParams && typeof otherParams === 'object') {
+    Object.keys(otherParams).forEach(key => {
+      params.append(key, otherParams[key])
+    })
+  }
+  return `${url}${targetUrl}?${params.toString()}`
+}

--
Gitblit v1.9.3