From 379d64998edf01b19d396a8d364ef9d81f985268 Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Tue, 14 Oct 2025 11:17:05 +0800
Subject: [PATCH] feat:更新代码
---
src/pages.json | 2
src/subPackages/taskDetail/execution/index.vue | 31 ++++++++++++++-
src/pages/inspectionTask/index.vue | 73 ++++--------------------------------
3 files changed, 38 insertions(+), 68 deletions(-)
diff --git a/src/pages.json b/src/pages.json
index 0525cf9..bd3e562 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -77,7 +77,7 @@
{
"path": "taskDetail/execution/index",
"style": {
- "navigationBarTitleText": "已执行"
+ "navigationBarTitleText": "任务详情"
}
},
diff --git a/src/pages/inspectionTask/index.vue b/src/pages/inspectionTask/index.vue
index b31237c..063f3b0 100644
--- a/src/pages/inspectionTask/index.vue
+++ b/src/pages/inspectionTask/index.vue
@@ -1,72 +1,15 @@
<!-- 巡检任务 -->
<template>
- <TaskDetails v-model:active="active" v-if="active"/>
- <view v-else v-for="(item, index) in list" :key="index">
- <view @click="taskClick(item)">{{item.name}} - {{item.status}}</view>
- </view>
+ <web-view ref="sWebViewRef" :src="`${viewUrl}`" />
</template>
<script setup>
-import {onShow} from "@dcloudio/uni-app";
-import {getJobListApi} from "@/api/inspectionTask.js";
-import TaskDetails from "@/pages/inspectionTask/TaskDetails/TaskDetails.vue";
+import { useUserStore } from "@/store/index.js";
-const pagingRef = ref(null);
-
-const dataList = ref([]);
-
-const urls = [
- "https://picsum.photos/100/100?random=1",
- "https://picsum.photos/100/100?random=2",
- "https://picsum.photos/100/100?random=3",
- "https://picsum.photos/100/100?random=4",
- "https://picsum.photos/100/100?random=5",
- "https://picsum.photos/100/100?random=6",
- "https://picsum.photos/100/100?random=7",
- "https://picsum.photos/100/100?random=8",
- "https://picsum.photos/100/100?random=9",
- "https://picsum.photos/100/100?random=10",
-];
-
-function queryList(pageNo, pageSize) {
- console.log("[ pageNo ] >", pageNo);
- console.log("[ pageSize ] >", pageSize);
- // 这里的pageNo和pageSize会自动计算好,直接传给服务器即可
- // 这里的请求只是演示,请替换成自己的项目的网络请求,并在网络请求回调中通过pagingRef.value.complete(请求回来的数组)将请求结果传给z-paging
- setTimeout(() => {
- // 1秒之后停止刷新动画
- const list = [];
- for (let i = 0; i < 30; i++)
- list.push(urls[uni.$u.random(0, urls.length - 1)]);
-
- pagingRef.value?.complete(list);
- }, 1000);
-}
-
-const params = ref({
- device_sn: null,
- order_by_create_time: false,
-})
-const sizeParams = ref({
- current: 1,
- size: 100,
-})
-const list = ref([])
-function getJobList() {
- getJobListApi(params.value,sizeParams.value).then(res =>{
- list.value = res.data.data.records
- })
-}
-
-const active = ref(null)
-function taskClick(row) {
- active.value = row
- // uni.redirectTo({
- // url: '/pages/inspectionTask/taskDetails/index'
- // })
-}
-
-onShow(()=>{
- getJobList()
-})
+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)}`;
</script>
+<style scoped lang="scss">
+
+</style>
diff --git a/src/subPackages/taskDetail/execution/index.vue b/src/subPackages/taskDetail/execution/index.vue
index 6d683e5..034aa96 100644
--- a/src/subPackages/taskDetail/execution/index.vue
+++ b/src/subPackages/taskDetail/execution/index.vue
@@ -1,8 +1,35 @@
<!-- 已执行 -->
<template>
- <view> 基础 </view>
+ <web-view ref="sWebViewRef" :src="`${viewUrl}`" @message="onPostMessage" @onPostMessage="onPostMessage" />
</template>
-<script setup></script>
+<script setup>
+import {onLoad} from "@dcloudio/uni-app";
+import {useUserStore} from "@/store/index.js";
+
+const sWebViewRef = ref(null);
+const userStore = useUserStore();
+let viewUrl = ''
+
+function onPostMessage(event) {
+ if (event.detail.data[0].type === 'back') {
+ // active.value = null
+ }
+}
+
+// onLoad(() => {
+// window.addEventListener('message', function (e) {
+// if (e.data.data.type === 'back') {
+// // active.value = null
+// }
+// });
+// })
+
+onLoad((options) => {
+ // console.log('options1111111', JSON.parse(decodeURIComponent(options)));
+ const id=3333
+ viewUrl = `http://192.168.1.178:5173/drone-app-web-view/#/webViewWrapper/execution?rowItem=${id}`;
+});
+</script>
<style lang="scss" scoped></style>
--
Gitblit v1.9.3