diff --git a/code/VideoAccess-VCMP/web/client/index.html b/code/VideoAccess-VCMP/web/client/index.html index d7a7b3a..bcacb38 100644 --- a/code/VideoAccess-VCMP/web/client/index.html +++ b/code/VideoAccess-VCMP/web/client/index.html @@ -26,18 +26,19 @@ diff --git a/code/VideoAccess-VCMP/web/client/src/app.jsx b/code/VideoAccess-VCMP/web/client/src/app.jsx index fbdf2dd..dfd09e7 100644 --- a/code/VideoAccess-VCMP/web/client/src/app.jsx +++ b/code/VideoAccess-VCMP/web/client/src/app.jsx @@ -16,7 +16,7 @@ const App = props => { return ( ) } 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 a70b5aa..916f966 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 @@ -1,7 +1,6 @@ 'use strict'; -import { ApiTable } from '$utils' -import { Request } from '@peace/utils' +import { ApiTable, AuthRequest } from '$utils' export const INIT_AUTH = 'INIT_AUTH'; export function initAuth () { @@ -29,18 +28,17 @@ export function login (username, password) { return Promise.resolve(); } - return dispatch({ - type: LOGIN_SUCCESS, - payload: { - user: { - authorized: true, - displayName: 'TEST' - } - }, - }); + // return dispatch({ + // type: LOGIN_SUCCESS, + // payload: { + // user: { + // authorized: true, + // displayName: 'TEST' + // } + // }, + // }); - const url = ApiTable.login; - return Request.post(url, { username, password, p: '456' }) + return AuthRequest.post(ApiTable.login, { username, password }) .then(user => { sessionStorage.setItem('user', JSON.stringify(user)); dispatch({ @@ -61,11 +59,9 @@ export function login (username, password) { export const LOGOUT = 'LOGOUT'; export function logout (user) { - const token = user.token; - const url = ApiTable.logout; sessionStorage.removeItem('user'); - Request.put(url, { - token: token + AuthRequest.put(ApiTable.logout, { + token: user.token }); return { type: LOGOUT diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/style.less b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/style.less index f9e54b1..4ed565a 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/style.less +++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/style.less @@ -1,5 +1,5 @@ .NvrHeader{ - background-image: url(../../../assets/images/background/nvr_banner.png); + background-image: url(/assets/images/background/nvr_banner.png); height: 171px; background-size:100% 100%; } \ No newline at end of file diff --git a/code/VideoAccess-VCMP/web/client/src/utils/index.js b/code/VideoAccess-VCMP/web/client/src/utils/index.js index 9a588fe..d3348a4 100644 --- a/code/VideoAccess-VCMP/web/client/src/utils/index.js +++ b/code/VideoAccess-VCMP/web/client/src/utils/index.js @@ -1,7 +1,7 @@ 'use strict'; import { isAuthorized } from './func'; import { AuthorizationCode } from './authCode'; -import { ApiTable, RouteTable } from './webapi' +import { ApiTable, RouteTable, AuthRequest } from './webapi' export { isAuthorized, @@ -10,4 +10,5 @@ export { ApiTable, RouteTable, + AuthRequest, } \ No newline at end of file diff --git a/code/VideoAccess-VCMP/web/client/src/utils/webapi.js b/code/VideoAccess-VCMP/web/client/src/utils/webapi.js index 5e33127..e05f516 100644 --- a/code/VideoAccess-VCMP/web/client/src/utils/webapi.js +++ b/code/VideoAccess-VCMP/web/client/src/utils/webapi.js @@ -1,4 +1,7 @@ 'use strict'; +import { ProxyRequest } from '@peace/utils' + +export const AuthRequest = new ProxyRequest('_auth') export const ApiTable = { login: 'login', diff --git a/code/VideoAccess-VCMP/web/config.js b/code/VideoAccess-VCMP/web/config.js index 56b2ffa..c7964ab 100644 --- a/code/VideoAccess-VCMP/web/config.js +++ b/code/VideoAccess-VCMP/web/config.js @@ -32,6 +32,12 @@ const product = { host: API_URL, match: /^\/_api\//, } + }, { + entry: require('./middlewares/proxy').entry, + opts: { + host: 'http://localhost:4200', + match: /^\/_auth\//, + } }, { entry: require('./routes').entry, opts: { diff --git a/code/VideoAccess-VCMP/web/package.json b/code/VideoAccess-VCMP/web/package.json index d1ab4a0..3ec2419 100644 --- a/code/VideoAccess-VCMP/web/package.json +++ b/code/VideoAccess-VCMP/web/package.json @@ -54,7 +54,7 @@ "@douyinfe/semi-ui": "^2.8.0", "@fs/attachment": "^1.0.0", "@peace/components": "0.0.35", - "@peace/utils": "^0.0.44", + "@peace/utils": "^0.0.48", "@vitejs/plugin-react": "^1.3.1", "@vitejs/plugin-react-refresh": "^1.3.6", "args": "^5.0.1",