From 538fb4630a66702c263f2d4318f4ccf32e230982 Mon Sep 17 00:00:00 2001
From: yuan_yi <1650192445@qq.com>
Date: Thu, 2 Jun 2022 14:26:12 +0800
Subject: [PATCH] import react
---
.../api/app/lib/controllers/camera/index.js | 22 ++++++++++++++-----
.../api/app/lib/routes/camera/index.js | 4 ++--
.../src/components/simpleFileDownButton.jsx | 4 +++-
.../src/sections/auth/containers/login.jsx | 10 +++++++++
.../components/skeletonScreen.jsx | 1 +
code/VideoAccess-VCMP/web/webpack.config.js | 4 +++-
6 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js b/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js
index 4efc107..f1a4370 100644
--- a/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js
+++ b/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js
@@ -221,23 +221,35 @@ async function banned (ctx) {
}
async function del (ctx) {
+ const transaction = await ctx.fs.dc.orm.transaction();
try {
const { models } = ctx.fs.dc;
- const { cameraId } = ctx.query
+ const { cameraId } = ctx.params
const { token } = ctx.fs.api
- await models.cameraId.destroy({
+ await models.CameraAbilityBind.destroy({
+ where: {
+ cameraId: cameraId
+ },
+ transaction
+ })
+
+ await models.Camera.destroy({
where: {
id: cameraId
- }
+ },
+ transaction
})
- if (cameraId.length) {
- await ctx.app.fs.axyRequest.delete('vcmp/camera/project', { query: { token, cameraId: cameraId.join(',') } })
+
+ if (cameraId) {
+ await ctx.app.fs.axyRequest.delete('vcmp/camera/project', { query: { token, cameraId: cameraId } })
}
+ await transaction.commit();
ctx.status = 204;
} catch (error) {
+ await transaction.rollback();
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {}
diff --git a/code/VideoAccess-VCMP/api/app/lib/routes/camera/index.js b/code/VideoAccess-VCMP/api/app/lib/routes/camera/index.js
index 702be70..ba98441 100644
--- a/code/VideoAccess-VCMP/api/app/lib/routes/camera/index.js
+++ b/code/VideoAccess-VCMP/api/app/lib/routes/camera/index.js
@@ -35,8 +35,8 @@ module.exports = function (app, router, opts) {
app.fs.api.logAttr['PUT/camera/banned'] = { content: '禁用摄像头', visible: false };
router.put('/camera/banned', camera.banned);
- app.fs.api.logAttr['DEL/camera'] = { content: '删除摄像头', visible: false };
- router.delete('/camera', camera.del);
+ app.fs.api.logAttr['DEL/camera/:cameraId'] = { content: '删除摄像头', visible: false };
+ router.delete('/camera/:cameraId', camera.del);
app.fs.api.logAttr['GET/camera/export'] = { content: '导出摄像头信息', visible: false };
router.get('/camera/export', camera.cameraExport);
diff --git a/code/VideoAccess-VCMP/web/client/src/components/simpleFileDownButton.jsx b/code/VideoAccess-VCMP/web/client/src/components/simpleFileDownButton.jsx
index 047594a..5ee4eee 100644
--- a/code/VideoAccess-VCMP/web/client/src/components/simpleFileDownButton.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/components/simpleFileDownButton.jsx
@@ -23,7 +23,9 @@ const SimpleFileDownButton = (props) => {
>
导出
-
+ {
+ downloadUrl ? : ''
+ }
>
)
}
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/auth/containers/login.jsx b/code/VideoAccess-VCMP/web/client/src/sections/auth/containers/login.jsx
index 43eb1f7..e4fda28 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/auth/containers/login.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/auth/containers/login.jsx
@@ -20,9 +20,16 @@ const Login = props => {
useEffect(() => {
if (user && user.authorized) {
+
+ const receiver = document.getElementById('iotAuth').contentWindow;
+ // receiver.postMessage(user, "http://localhost:4200/cross");
+ receiver.postMessage('user', "*");
+
dispatch(push('/equipmentWarehouse/nvr'));
localStorage.setItem('vcmp_selected_sider', JSON.stringify(['nvr']))
localStorage.setItem('vcmp_open_sider', JSON.stringify(['equipmentWarehouse']))
+
+
}
}, [user])
@@ -79,6 +86,9 @@ const Login = props => {
+
);
}
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/skeletonScreen.jsx b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/skeletonScreen.jsx
index eb720fa..f0462ae 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/skeletonScreen.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/skeletonScreen.jsx
@@ -1,3 +1,4 @@
+import React, { useState, useEffect } from "react";
import { Table } from "@douyinfe/semi-ui";
export function skeletonScreen(line, columns) {
diff --git a/code/VideoAccess-VCMP/web/webpack.config.js b/code/VideoAccess-VCMP/web/webpack.config.js
index bb23307..7bba81f 100644
--- a/code/VideoAccess-VCMP/web/webpack.config.js
+++ b/code/VideoAccess-VCMP/web/webpack.config.js
@@ -32,7 +32,9 @@ module.exports = {
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
- new BundleAnalyzerPlugin(),
+ new BundleAnalyzerPlugin({
+ analyzerPort: 8000,
+ }),
],
module: {
rules: [{