From bb2a4a1525938870407b896e3c532544b275e917 Mon Sep 17 00:00:00 2001 From: huxin02 Date: Fri, 14 Feb 2025 16:52:28 +0800 Subject: [PATCH] =?UTF-8?q?=20=E7=94=A8=E6=88=B7=E3=80=81=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E6=9C=BA=E6=9E=84API=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/api/lawenforcement/Agency.js | 24 ++++++++++++++ client/src/api/lawenforcement/Officer.js | 22 +++++++++++++ client/src/api/lawenforcement/User.js | 41 ++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 client/src/api/lawenforcement/Agency.js create mode 100644 client/src/api/lawenforcement/Officer.js create mode 100644 client/src/api/lawenforcement/User.js diff --git a/client/src/api/lawenforcement/Agency.js b/client/src/api/lawenforcement/Agency.js new file mode 100644 index 0000000..88f5393 --- /dev/null +++ b/client/src/api/lawenforcement/Agency.js @@ -0,0 +1,24 @@ +import crud from '../BaseApi' +import { api } from '../../utils/Request' +import { REQUEST_METHOD_TYPES } from '@/utils/Constants' + +const url = '/api/lawenforcement/agencies' + +export const agencies = { + tree: () => api({ + url: `${url}/tree`, + method: REQUEST_METHOD_TYPES.GET + }), + findOneByCode: (code) => api({ + url: `${url}/code/${code}`, + method: REQUEST_METHOD_TYPES.GET + }), + getNextOrderNum: (parentId) => api({ + url: `${url}/nextOrderNum`, + method: REQUEST_METHOD_TYPES.GET, + params: { parentId: parentId || '0' } + }), + ...crud(url) +} + +export default agencies \ No newline at end of file diff --git a/client/src/api/lawenforcement/Officer.js b/client/src/api/lawenforcement/Officer.js new file mode 100644 index 0000000..c9b952d --- /dev/null +++ b/client/src/api/lawenforcement/Officer.js @@ -0,0 +1,22 @@ +import crud from '../BaseApi' +import api from '@/utils/Request.js' +import {REQUEST_METHOD_TYPES} from '@/utils/Constants.js' + +const url = '/api/lawenforcement/officers' + +export const officers = Object.assign({ + getOfficersByAgency(agencyId) { + return api({ + url: `${url}/agency/${agencyId}`, + method: REQUEST_METHOD_TYPES.GET + }) + }, + count() { + return api({ + url: `${url}/count`, + method: REQUEST_METHOD_TYPES.GET + }) + } +}, crud(url)) + +export default officers diff --git a/client/src/api/lawenforcement/User.js b/client/src/api/lawenforcement/User.js new file mode 100644 index 0000000..6431cb2 --- /dev/null +++ b/client/src/api/lawenforcement/User.js @@ -0,0 +1,41 @@ +import { api } from '../../utils/Request' + +const url = '/lawenforcement/v1/auth' +const baseURL = `${import.meta.env.VITE_BASE_URL}/ht` + +export const getUserInfo = () => { + return api.get(`${url}/getSysUser`) +} + +export const login = (params) => { + return api.post(`${url}/login`, undefined, {params: params}) +} + +export const logout = (params) => { + return api.post(`${url}/logout`, undefined, {params: params}) +} + +export const getLoginUrl = () => { + return api.get(`${url}/getLoginUrl`) +} + +// 刷新访问令牌 +export const refreshToken = (refreshToken) => { + return api.post(`${url}/refreshToken`, undefined, { params: { refreshToken } }) +} + +// 新增:客户端退出登录接口 +export const sysLogout = () => { + return api.post(`${baseURL}/uaa/clients/sysLogout`) +} + +export const users = { + getUserInfo, + login, + logout, + getLoginUrl, + refreshToken, + sysLogout +} + +export default users