import api from '@/utils/http' // ==================== 用户管理 API(遗留,地磅独立用户;门户登录请用 authApi) ==================== export interface User { id: string username: string role: string createdAt?: string } export interface UserCreate { username: string password: string role: string remark?: string } export interface UserUpdate { username?: string password?: string role?: string remark?: string } /** @deprecated 旧地磅用户 CRUD,门户体系下不再使用 */ export const userApi = { list: async (): Promise => { return api.get({ url: '/users' }) }, get: async (id: string): Promise => { return api.get({ url: `/users/${id}` }) }, create: async (payload: UserCreate): Promise => { return api.post({ url: '/users', data: payload }) }, update: async (id: string, payload: UserUpdate): Promise => { return api.put({ url: `/users/${id}`, data: payload }) }, delete: async (id: string): Promise => { return api.del({ url: `/users/${id}` }) } } /** * @deprecated 请使用 `@/api/authApi` 的 `fetchLogin`(门户 RSA + JWT) */ export const UserService = { login: async (_username: string, _password: string): Promise => { throw new Error('请使用 fetchLogin(@/api/authApi)登录门户账号') }, getUserInfo: async (): Promise => { throw new Error('请使用门户 /web/auth/current-user 获取用户信息') } }