From e7e760fe28b605a94f705757611834aae4f6f786 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 14 Oct 2025 17:45:10 +0800
Subject: [PATCH] feat:二维码及地图页面基础调整
---
src/pages/map/index.vue | 52 ++++++++++
src/pages.json | 200 ++++++++++++++++++++-------------------
src/subPackages/qrCode/index.vue | 9 +
3 files changed, 160 insertions(+), 101 deletions(-)
diff --git a/src/pages.json b/src/pages.json
index 7f23559..82d589d 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": "事件工单"
@@ -44,107 +46,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 +156,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 +177,4 @@
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
}
-}
+}
\ No newline at end of file
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>
--
Gitblit v1.9.3