diff --git a/code/VideoAccess-VCMP/api/app/lib/controllers/vender/index.js b/code/VideoAccess-VCMP/api/app/lib/controllers/vender/index.js new file mode 100644 index 0000000..d77d4f5 --- /dev/null +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/vender/index.js @@ -0,0 +1,23 @@ +'use strict'; + +async function get (ctx) { + const models = ctx.fs.dc.models; + try { + const res = await models.Vender.findAll({ + order: [ + ['id', 'ASC'] + ] + }) + + ctx.status = 200; + ctx.body = res + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = {} + } +} + +module.exports = { + get, +}; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/app/lib/routes/vender/index.js b/code/VideoAccess-VCMP/api/app/lib/routes/vender/index.js new file mode 100644 index 0000000..3eda838 --- /dev/null +++ b/code/VideoAccess-VCMP/api/app/lib/routes/vender/index.js @@ -0,0 +1,8 @@ +'use strict'; + +const vender = require('../../controllers/vender'); + +module.exports = function (app, router, opts) { + app.fs.api.logAttr['GET/vender'] = { content: '获取设备厂商', visible: false }; + router.get('/vender', vender.get); +}; diff --git a/code/VideoAccess-VCMP/web/client/src/layout/actions/global.js b/code/VideoAccess-VCMP/web/client/src/layout/actions/global.js index 0548a95..b527e18 100644 --- a/code/VideoAccess-VCMP/web/client/src/layout/actions/global.js +++ b/code/VideoAccess-VCMP/web/client/src/layout/actions/global.js @@ -2,6 +2,8 @@ import { RouteRequest } from '@peace/utils'; import { RouteTable } from '$utils' +import io from 'socket.io-client'; + export const INIT_LAYOUT = 'INIT_LAYOUT'; export function initLayout (title, copyright, sections, actions) { return { @@ -33,6 +35,9 @@ export function initApiRoot () { return dispatch => { RouteRequest.get(RouteTable.apiRoot).then(res => { localStorage.setItem('apiRoot', res.root); + + // const socket = io('ws://127.0.0.1:4000', () => { }); + dispatch({ type: INIT_API_ROOT, payload: { diff --git a/code/VideoAccess-VCMP/web/package.json b/code/VideoAccess-VCMP/web/package.json index 9c7e11d..36aeda8 100644 --- a/code/VideoAccess-VCMP/web/package.json +++ b/code/VideoAccess-VCMP/web/package.json @@ -7,7 +7,7 @@ "test": "mocha", "start-vite": "cross-env NODE_ENV=developmentVite npm run start-params", "start": "cross-env NODE_ENV=development npm run start-params", - "start-params": "node server -p 5000 -u http://127.0.0.1:4000 --apiAuthUrl http://10.8.30.82:4200", + "start-params": "node server -p 5000 -u http://10.8.30.82:4000 --apiAuthUrl http://10.8.30.82:4200", "deploy": "export NODE_ENV=production&& npm run build && node server", "build-dev": "export NODE_ENV=development&&webpack --config webpack.config.js", "build": "export NODE_ENV=production&&webpack --config webpack.config.prod.js"