diff --git a/code/VideoAccess-VCMP/web/client/src/layout/components/header/index.jsx b/code/VideoAccess-VCMP/web/client/src/layout/components/header/index.jsx index b35cfef..2954b53 100644 --- a/code/VideoAccess-VCMP/web/client/src/layout/components/header/index.jsx +++ b/code/VideoAccess-VCMP/web/client/src/layout/components/header/index.jsx @@ -23,7 +23,7 @@ const Header = props => { history.push(`/signin`); } }}> - {user.namePresent}}> + {user && user.namePresent}}> diff --git a/code/VideoAccess-VCMP/web/client/src/sections/auth/actions/auth.js b/code/VideoAccess-VCMP/web/client/src/sections/auth/actions/auth.js index 050ced8..e91b203 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/auth/actions/auth.js +++ b/code/VideoAccess-VCMP/web/client/src/sections/auth/actions/auth.js @@ -28,15 +28,15 @@ export function login (username, password) { return Promise.resolve(); } - return dispatch({ - type: LOGIN_SUCCESS, - payload: { - user: { - authorized: true, - namePresent: 'TEST' - } - }, - }); + // return dispatch({ + // type: LOGIN_SUCCESS, + // payload: { + // user: { + // authorized: true, + // namePresent: 'TEST' + // } + // }, + // }); return AuthRequest.post(ApiTable.login, { username, password }) .then(user => { diff --git a/code/VideoAccess-VCMP/web/config.js b/code/VideoAccess-VCMP/web/config.js index c7964ab..a6a0848 100644 --- a/code/VideoAccess-VCMP/web/config.js +++ b/code/VideoAccess-VCMP/web/config.js @@ -12,10 +12,12 @@ dev && console.log('\x1B[33m%s\x1b[0m', '请遵循并及时更新 readme.md, // // 启动参数 args.option(['p', 'port'], '启动端口'); args.option(['u', 'api-url'], 'webapi的URL'); +args.option('apiAuthUrl', 'apiAuthUrl'); const flags = args.parse(process.argv); const API_URL = process.env.API_URL || flags.apiUrl; +const API_AUTH_URL = process.env.API_AUTH_URL || flags.apiAuthUrl; if (!API_URL) { console.log('缺少启动参数,异常退出'); @@ -35,7 +37,7 @@ const product = { }, { entry: require('./middlewares/proxy').entry, opts: { - host: 'http://localhost:4200', + host: API_AUTH_URL, match: /^\/_auth\//, } }, { diff --git a/code/VideoAccess-VCMP/web/package.json b/code/VideoAccess-VCMP/web/package.json index 3ec2419..9c7e11d 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", + "start-params": "node server -p 5000 -u http://127.0.0.1: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"