diff --git a/package-lock.json b/package-lock.json index b6e9f4e..d1d1566 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2807,7 +2807,7 @@ }, "node_modules/@vueuse/core": { "version": "10.11.1", - "resolved": "https://mirrors.huaweicloud.com/repository/npm/@vueuse/core/-/core-10.11.1.tgz", + "resolved": "https://registry.npmmirror.com/@vueuse/core/-/core-10.11.1.tgz", "integrity": "sha512-guoy26JQktXPcz+0n3GukWIy/JDNKti9v6VEMu6kV2sYBsWuGiTU8OWdg+ADfUbHg3/3DlqySDe7JmdHrktiww==", "license": "MIT", "dependencies": { @@ -7739,7 +7739,7 @@ }, "node_modules/pinia-plugin-persistedstate": { "version": "3.2.3", - "resolved": "https://mirrors.huaweicloud.com/repository/npm/pinia-plugin-persistedstate/-/pinia-plugin-persistedstate-3.2.3.tgz", + "resolved": "https://registry.npmmirror.com/pinia-plugin-persistedstate/-/pinia-plugin-persistedstate-3.2.3.tgz", "integrity": "sha512-Cm819WBj/s5K5DGw55EwbXDtx+EZzM0YR5AZbq9XE3u0xvXwvX2JnWoFpWIcdzISBHqy9H1UiSIUmXyXqWsQRQ==", "license": "MIT", "peerDependencies": { diff --git a/package.json b/package.json index 911d034..4340bfc 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,6 @@ "@vue/eslint-config-prettier": "^8.0.0", "@vue/eslint-config-typescript": "^12.0.0", "@vue/tsconfig": "^0.5.1", - "vite-plugin-dts": "^4.5.0", "eslint": "8.57.0", "eslint-plugin-vue": "9.4.0", "less": "^4.6.3", @@ -67,6 +66,7 @@ "unocss": "^66.6.6", "vite": "6.3.4", "vite-plugin-compression": "^0.5.1", + "vite-plugin-dts": "^4.5.0", "vite-plugin-vue-devtools": "^7.7.9", "vue-tsc": "^2.2.12" } diff --git a/src/main.ts b/src/main.ts index 04c7c10..34d8779 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,7 +3,6 @@ import { createApp } from 'vue'; import pinia from '@/stores'; import '@/styles/index.scss'; - // element plus import ElementPlus from 'element-plus'; // element css @@ -50,7 +49,6 @@ app.use(pinia); app.use(router); app.use(directives); app.use(I18n); - // app.use(router) app.use(hljsVuePlugin); diff --git a/src/stores/modules/cameraBind.ts b/src/stores/modules/cameraBind.ts new file mode 100644 index 0000000..1526e1f --- /dev/null +++ b/src/stores/modules/cameraBind.ts @@ -0,0 +1,69 @@ +import {defineStore} from "pinia"; +import {computed, ref} from "vue"; + +export const useCameraBindStore=defineStore('cameraBind',()=>{ + // 存储已绑定的摄像头id及其绑定的组件信息 + const boundCameras=ref>(new Map()); + // 检查摄像头是否已被绑定 + const isCameraBound = (cameraId: number ) => { + return boundCameras.value.has(cameraId); + }; + // 获取摄像头的绑定信息 + const getCameraBindsInfo=(cameraId:number )=>{ + return boundCameras.value.get(cameraId); + } + // 绑定摄像头 + const bingCamera=(cameraId:number,obj:any)=>{ + if(isCameraBound(cameraId)) + { + return false; + } + boundCameras.value.set(cameraId,{ + val:cameraId, + type:obj.type, + title:obj.title + }); + return true; + } + // 解绑摄像头 + const unbindCamera=(cameraId:number)=>{ + boundCameras.value.delete(cameraId); + } + // 获取所有已经绑定的摄像头ID列表 + const getBoundCameraIds=computed(()=>{ + return Array.from(boundCameras.value.keys()); + }) + return { + boundCameras, + isCameraBound, + getCameraBindsInfo, + bingCamera, + unbindCamera, + getBoundCameraIds + } +},{ + // 第三个参数:配置持久化 + persist: { + key: 'camera-bind-store', // 存储在 localStorage 中的键名,可自定义 + storage: sessionStorage, // 默认是 localStorage,如果想关闭页面失效可改为 sessionStorage + serializer: { + // 序列化:将 Mp 转换为 [[key, value], [key, value]] 的二维数组存入 JSON + serialize: (state) => { + return JSON.stringify({ + boundCameras: Array.from(state.boundCameras.entries()) + }); + }, + // 反序列化:将 JSON 中的二维数组解析并重新构建为 Map 对象 + deserialize: (value) => { + const parsed = JSON.parse(value); + return { + boundCameras: new Map(parsed.boundCameras) + }; + } + } + } +}) \ No newline at end of file diff --git a/src/views/teacher/teacherPreview/index.vue b/src/views/teacher/teacherPreview/index.vue new file mode 100644 index 0000000..207d90f --- /dev/null +++ b/src/views/teacher/teacherPreview/index.vue @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/src/views/teacher/teacherStatistics/components/custom-componet/myEditor.vue b/src/views/teacher/teacherStatistics/components/custom-componet/myEditor.vue index 5209f5f..a5b2331 100644 --- a/src/views/teacher/teacherStatistics/components/custom-componet/myEditor.vue +++ b/src/views/teacher/teacherStatistics/components/custom-componet/myEditor.vue @@ -92,9 +92,10 @@ leftAsideStore.registerConfig('工作组件', [ thumbnail: '/svgs/image.svg', props: { moduleId: { - type: 'upload', - val: '--', - title: '绑定' + type: 'treeSelectModel', + val: '', + name: '', + title: '绑定摄像头', } } } diff --git a/src/views/teacher/teacherStatistics/components/custom-componet/treeSelectModel.vue b/src/views/teacher/teacherStatistics/components/custom-componet/treeSelectModel.vue new file mode 100644 index 0000000..0915c2b --- /dev/null +++ b/src/views/teacher/teacherStatistics/components/custom-componet/treeSelectModel.vue @@ -0,0 +1,127 @@ + + + + + \ No newline at end of file diff --git a/src/views/teacher/teacherStatistics/components/mt-edit/components/layout/base-panel/imageModel.vue b/src/views/teacher/teacherStatistics/components/mt-edit/components/layout/base-panel/imageModel.vue index c4568a2..8b97871 100644 --- a/src/views/teacher/teacherStatistics/components/mt-edit/components/layout/base-panel/imageModel.vue +++ b/src/views/teacher/teacherStatistics/components/mt-edit/components/layout/base-panel/imageModel.vue @@ -269,24 +269,29 @@ async function loadFileList() { endTime: form.fileDate ? new Date(form.fileDate[1]).getTime() : undefined }; // const response = await modelApi.fileStorage_file_list_post(endJson); - const response = await fileStorageFileListApi(endJson); - tableData.value = []; - if (!response.data) { - elDialogLoading.value = false; - return; - } - pageTotal.value = response.data.total; - currentPage.value = response.data.current; - pageSize.value = response.data.limit; - - response.data.rows.forEach((value: FileEntityDTO) => { - let date = formatTimestamp(value.addTime); - let id = value.id; - let name = value.fileName; - let imgUrl = getFileObj(value.filePath); - tableData.value.push({ date, id, name, imgUrl }); - }); - elDialogLoading.value = false; + try { + const response = await fileStorageFileListApi(endJson); + tableData.value = []; + if (!response.data) { + elDialogLoading.value = false; + return; + } + pageTotal.value = response.data.total; + currentPage.value = response.data.current; + pageSize.value = response.data.limit; + + response.data.rows.forEach((value: FileEntityDTO) => { + let date = formatTimestamp(value.addTime); + let id = value.id; + let name = value.fileName; + let imgUrl = getFileObj(value.filePath); + tableData.value.push({ date, id, name, imgUrl }); + }); + elDialogLoading.value = false; + }catch (error) { + console.log('error:', error); + elDialogLoading.value = false; + } } onMounted(() => { loadFileList(); diff --git a/src/views/teacher/teacherStatistics/components/mt-edit/components/layout/right-aside/index.vue b/src/views/teacher/teacherStatistics/components/mt-edit/components/layout/right-aside/index.vue index 5ea2f2f..65781ce 100644 --- a/src/views/teacher/teacherStatistics/components/mt-edit/components/layout/right-aside/index.vue +++ b/src/views/teacher/teacherStatistics/components/mt-edit/components/layout/right-aside/index.vue @@ -9,7 +9,8 @@ > + > + + > + + diff --git a/src/views/teacher/teacherStatistics/components/vue-xq-test/vue-img.vue b/src/views/teacher/teacherStatistics/components/vue-xq-test/vue-img.vue index 4165e2e..bc4eff7 100644 --- a/src/views/teacher/teacherStatistics/components/vue-xq-test/vue-img.vue +++ b/src/views/teacher/teacherStatistics/components/vue-xq-test/vue-img.vue @@ -42,7 +42,7 @@ console.log('父传子1:', props.definitionItemJson.id); watch( () => props.moduleId, (newVal, oldVal) => { - console.log('moduleId:', newVal, oldVal); + console.log(`moduleId:新值:${newVal},旧值:${oldVal}`); loadFileList(newVal); } ); @@ -51,24 +51,29 @@ let imgUrl = ref(); // 获取文件列表 async function loadFileList(fileId: string) { + console.log('loadFileList:', fileId); let endJson = { id: fileId }; + if(fileId==='--') + return; // const response = await modelApi.fileStorage_file_list_post(endJson); const response = await fileStorageFileListApi(endJson); if (!response.data) { return; } - response.data.rows.forEach((value: any) => { - imgUrl.value = formatFilePath(File_Url+'/admin', value.filePath); - }); - console.log('imgUrl:', imgUrl); + if(response.data.rows) + { + response.data.rows.forEach((value: any) => { + imgUrl.value = formatFilePath(File_Url+'/admin', value.filePath); + }); + } } -emitter.on('imgUpload:' + props.definitionItemJson.id, (uploadFile) => { - console.log('imgUpload:', uploadFile); - displayImageUrl.value = uploadFile as string; -}); +// emitter.on('imgUpload:' + props.definitionItemJson.id, (uploadFile) => { +// console.log('imgUpload:', uploadFile); +// displayImageUrl.value = uploadFile as string; +// }); onUnmounted(() => { console.log('组件卸载');