Browse Source

import react

release_0.0.2
yuan_yi 2 years ago
parent
commit
538fb4630a
  1. 22
      code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js
  2. 4
      code/VideoAccess-VCMP/api/app/lib/routes/camera/index.js
  3. 4
      code/VideoAccess-VCMP/web/client/src/components/simpleFileDownButton.jsx
  4. 10
      code/VideoAccess-VCMP/web/client/src/sections/auth/containers/login.jsx
  5. 1
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/skeletonScreen.jsx
  6. 4
      code/VideoAccess-VCMP/web/webpack.config.js

22
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 = {}

4
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);

4
code/VideoAccess-VCMP/web/client/src/components/simpleFileDownButton.jsx

@ -23,7 +23,9 @@ const SimpleFileDownButton = (props) => {
>
导出
</Button>
<iframe src={`/_api/${downloadUrl}`} style={{ display: 'none' }} />
{
downloadUrl ? <iframe src={`/_api/${downloadUrl}`} style={{ display: 'none' }} /> : ''
}
</>
)
}

10
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 => {
<Button htmlType='submit' block theme="solid" style={{ marginTop: 17, height: 40, backgroundColor: '#1859C1' }}>立即登录</Button>
</Form>
</div>
<iframe loading="lazy" id="iotAuth" src="http://localhost:5200/cross" frameBorder={0}>
<p>你的浏览器不支持 iframe</p>
</iframe>
</div>
);
}

1
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) {

4
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: [{

Loading…
Cancel
Save