From 237d5a60d8052bd0c97342345c5d190698a78ba7 Mon Sep 17 00:00:00 2001 From: JINGYJ <1458671527@qq.com> Date: Wed, 20 Sep 2023 17:51:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A7=86=E9=A2=91=E5=88=86=E6=9E=90?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/serverConfig.json | 2 +- src/api/utils.ts | 4 +- src/api/videoParse.ts | 24 ++ src/router/modules/videoParse.ts | 20 ++ src/views/videoParse/hook.tsx | 77 ++++++ src/views/videoParse/index.vue | 454 +++++++++++++++++++++++++++++++ src/views/welcome/hook.tsx | 55 ++-- src/views/welcome/index.vue | 46 ++-- 8 files changed, 634 insertions(+), 48 deletions(-) create mode 100644 src/api/videoParse.ts create mode 100644 src/router/modules/videoParse.ts create mode 100644 src/views/videoParse/hook.tsx create mode 100644 src/views/videoParse/index.vue diff --git a/public/serverConfig.json b/public/serverConfig.json index aec550f..8bb2c29 100644 --- a/public/serverConfig.json +++ b/public/serverConfig.json @@ -19,5 +19,5 @@ "CachingAsyncRoutes": false, "TooltipEffect": "light", "ResponsiveStorageNameSpace": "responsive-", - "AdminHostUrl": "http://192.168.10.81:8848/" + "AdminHostUrl": "http://192.168.10.13:8000" } diff --git a/src/api/utils.ts b/src/api/utils.ts index 2f0d1a1..98ade66 100644 --- a/src/api/utils.ts +++ b/src/api/utils.ts @@ -1,2 +1,4 @@ const { VITE_APP_BASE_URL } = import.meta.env; -export const baseUrlApi = (url: string) => `${VITE_APP_BASE_URL}/api/${url}`; +import { getConfig } from "@/config"; +export const baseUrlApi = (url: string) => + `${getConfig().AdminHostUrl || VITE_APP_BASE_URL}/api/${url}`; diff --git a/src/api/videoParse.ts b/src/api/videoParse.ts new file mode 100644 index 0000000..07ad0f2 --- /dev/null +++ b/src/api/videoParse.ts @@ -0,0 +1,24 @@ +import { http } from "@/utils/http"; +import { baseUrlApi } from "./utils"; + +type Result = { + msg: any; + success: boolean; + data?: { + person?: Array; + car?: Array; + }; +}; +type Data = { + success: boolean; + msg: any; + count: number; + results?: Array; +}; + +export const getPicList = (params?: object) => { + return http.request("get", baseUrlApi("tps/pics"), { params }); +}; +export const getTPList = (params?: object) => { + return http.request("get", baseUrlApi("tps"), { params }); +}; diff --git a/src/router/modules/videoParse.ts b/src/router/modules/videoParse.ts new file mode 100644 index 0000000..c17e2e3 --- /dev/null +++ b/src/router/modules/videoParse.ts @@ -0,0 +1,20 @@ +export default { + path: "/videoParse", + // redirect: "/error/403", + meta: { + icon: "lollipop", + title: "视频分析", + showLink: true, + rank: 10 + }, + children: [ + { + path: "/videoParse/index", + name: "VideoParsePage", + component: () => import("@/views/videoParse/index.vue"), + meta: { + title: "视频分析" + } + } + ] +} as RouteConfigsTable; diff --git a/src/views/videoParse/hook.tsx b/src/views/videoParse/hook.tsx new file mode 100644 index 0000000..e53dddd --- /dev/null +++ b/src/views/videoParse/hook.tsx @@ -0,0 +1,77 @@ +import { addDialog } from "@/components/ReDialog"; +// import { ref, h } from "vue"; +import OurPlayer from "@/components/VideoPlayer/OurPlayer.vue"; +// import { http } from "@/utils/http"; + +export function videoUtil() { + // const currentPlayingIndex = ref(-1); + const columns: TableColumnList = [ + { + label: "视频内时间", + prop: "relative_time", + minWidth: 100, + sortable: true + }, + { + label: "异常类型", + prop: "exception_type", + minWidth: 100 + }, + { + label: "异常ID", + prop: "abnormal_id", + minWidth: 100 + }, + { + label: "异常行为", + prop: "abnormal_behavior", + minWidth: 100, + slot: "violation" + }, + { + label: "异常关键帧", + slot: "image" + }, + { + label: "异常视频定位", + slot: "video" + } + // { + // label: "视频", + // slot: "video" + // }, + ]; + function openDialog(title = "视频", row) { + const highlights = [ + // 进度条时间点高亮 + { + text: row.event_type, + time: row.relative_time + } + ]; + sessionStorage.setItem("video_url", row.abnormal_video); + sessionStorage.setItem("highlights", JSON.stringify(highlights)); + addDialog({ + title: `${title}用户`, + width: "40%", + draggable: true, + fullscreenIcon: true, + closeOnClickModal: false, + contentRenderer: () => + // return h( + // "video", + // { + // controls: true, + // id: "video-" + index, + // onPlay: () => playVideo(row, index) + // }, + // [h("source", { src: row.video_dir, type: "video/mp4" })] + // ); + }); + } + + return { + columns, + openDialog + }; +} diff --git a/src/views/videoParse/index.vue b/src/views/videoParse/index.vue new file mode 100644 index 0000000..ba98cea --- /dev/null +++ b/src/views/videoParse/index.vue @@ -0,0 +1,454 @@ + + + + diff --git a/src/views/welcome/hook.tsx b/src/views/welcome/hook.tsx index df8554c..d01654c 100644 --- a/src/views/welcome/hook.tsx +++ b/src/views/welcome/hook.tsx @@ -1,10 +1,20 @@ import { addDialog } from "@/components/ReDialog"; -import { ref, h } from "vue"; +// import { ref, h } from "vue"; +import OurPlayer from "@/components/VideoPlayer/OurPlayer.vue"; // import { http } from "@/utils/http"; export function welcomeUtil() { - const currentPlayingIndex = ref(-1); - function openDialog(title = "视频", row, index: number) { + // const currentPlayingIndex = ref(-1); + function openDialog(title = "视频", row) { + const highlights = [ + // 进度条时间点高亮 + { + text: row.event_type, + time: row.relative_time + } + ]; + sessionStorage.setItem("video_url", row.video_dir); + sessionStorage.setItem("highlights", JSON.stringify(highlights)); console.log(row.video_dir, "row.video_dir"); addDialog({ title: `${title}用户`, @@ -12,28 +22,27 @@ export function welcomeUtil() { draggable: true, fullscreenIcon: true, closeOnClickModal: false, - contentRenderer: () => { - return h( - "video", - { - controls: true, - id: "video-" + index, - onPlay: () => playVideo(row, index) - }, - [h("source", { src: row.video_dir, type: "video/mp4" })] - ); - } + contentRenderer: () => + // return h( + // "video", + // { + // controls: true, + // id: "video-" + index, + // onPlay: () => playVideo(row, index) + // }, + // [h("source", { src: row.video_dir, type: "video/mp4" })] + // ); }); } - function playVideo(row, index) { - if (currentPlayingIndex.value !== -1) { - const videoElement = document.getElementById( - "video-" + currentPlayingIndex.value - ); - videoElement.pause(); // 暂停当前正在播放的视频 - } - currentPlayingIndex.value = index; - } + // function playVideo(row, index) { + // if (currentPlayingIndex.value !== -1) { + // const videoElement = document.getElementById( + // "video-" + currentPlayingIndex.value + // ); + // videoElement.pause(); // 暂停当前正在播放的视频 + // } + // currentPlayingIndex.value = index; + // } return { openDialog diff --git a/src/views/welcome/index.vue b/src/views/welcome/index.vue index 507bb54..8886506 100644 --- a/src/views/welcome/index.vue +++ b/src/views/welcome/index.vue @@ -44,26 +44,26 @@ const violationMap = ref({ }); // const currentPlayingIndex = ref(-1); // 当前正在播放的视频索引,默认为没有视频正在播放 -// function playVideo(index) { -// // data = JSON.parse(JSON.stringify(data)); -// // // console.log(AdminHostUrl) -// // dialogVisible.value = true; -// // const highlights = [ -// // // 进度条时间点高亮 -// // { -// // text: data.event_type, -// // time: data.relative_time -// // } -// // ]; -// // sessionStorage.setItem("video_url", data.video_dir); -// // sessionStorage.setItem("highlights", JSON.stringify(highlights)); -// if (currentPlayingIndex.value !== -1) { -// const videoElement = document.getElementById( -// "video-" + currentPlayingIndex.value -// ); -// videoElement.pause(); // 暂停当前正在播放的视频 +// function playVideo(data) { +// data = JSON.parse(JSON.stringify(data)); +// // console.log(AdminHostUrl) +// dialogVisible.value = true; +// const highlights = [ +// // 进度条时间点高亮 +// { +// text: data.event_type, +// time: data.relative_time // } -// currentPlayingIndex.value = index; +// ]; +// sessionStorage.setItem("video_url", data.video_dir); +// sessionStorage.setItem("highlights", JSON.stringify(highlights)); +// if (currentPlayingIndex.value !== -1) { +// const videoElement = document.getElementById( +// "video-" + currentPlayingIndex.value +// ); +// videoElement.pause(); // 暂停当前正在播放的视频 +// } +// currentPlayingIndex.value = index; // } function onSearch() { @@ -254,8 +254,8 @@ const pagination = reactive({ currentPage: currentPage.value, background: true }); -function handleUpdate(row, index) { - openDialog("我的", row, index); +function handleUpdate(row) { + openDialog("我的", row); console.log(row); } // function handleDelete(row) { @@ -398,13 +398,13 @@ onMounted(() => { --> -