242 lines
3.9 KiB
Plaintext
242 lines
3.9 KiB
Plaintext
import { http } from '@/utils/http/axios';
|
|
|
|
export interface BasicResponseModel<T = any> {
|
|
code: number;
|
|
msg: string;
|
|
data: T;
|
|
}
|
|
|
|
export interface BasicPageParams {
|
|
pageNo: number;
|
|
pageSize: number;
|
|
total: number;
|
|
}
|
|
|
|
/**
|
|
* @description: 获取用户信息
|
|
*/
|
|
export function getUserInfo() {
|
|
return http.request({
|
|
url: '/index/getUser',
|
|
method: 'get',
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @description: 用户登录
|
|
*/
|
|
export function login(params) {
|
|
return http.request<BasicResponseModel>(
|
|
{
|
|
url: '/login',
|
|
method: 'POST',
|
|
params,
|
|
},
|
|
{
|
|
isTransformResponse: false,
|
|
},
|
|
);
|
|
}
|
|
|
|
/**
|
|
* 统一认证登录
|
|
* @param data 参数
|
|
* @returns 返回结果
|
|
*/
|
|
export function login2(data) {
|
|
const formData = new FormData();
|
|
formData.append('username', data.username);
|
|
formData.append('password', data.password);
|
|
formData.append('code', data.code);
|
|
formData.append('grant_type', data.grant_type);
|
|
return http.request<BasicResponseModel>(
|
|
{
|
|
url: '/auth/oauth2/token',
|
|
method: 'POST',
|
|
data: formData,
|
|
headers: {
|
|
'Content-Type': 'multipart/form-data',
|
|
Authorization: 'Basic YWRtaW46MTIzNDU2',
|
|
},
|
|
},
|
|
{
|
|
isTransformResponse: false,
|
|
},
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @description: 用户登录
|
|
*/
|
|
export function getInfoCaptcha() {
|
|
return http.request({
|
|
url: '/captcha',
|
|
method: 'GET',
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @description: 用户修改密码
|
|
*/
|
|
export function changePassword(data) {
|
|
return http.request({
|
|
url: `/index/updatePassword`,
|
|
method: 'PUT',
|
|
data,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @description: 获取短信验证码
|
|
*/
|
|
export function sendSms(data) {
|
|
return http.request({
|
|
url: `/sms/sendSms`,
|
|
method: 'POST',
|
|
data,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @description: 用户登出
|
|
*/
|
|
export function logout(params) {
|
|
return http.request({
|
|
url: '/login/logout',
|
|
method: 'POST',
|
|
params,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @description: 获取用户列表
|
|
*/
|
|
export function getUserList(params) {
|
|
return http.request({
|
|
url: '/user/page',
|
|
method: 'get',
|
|
params,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @description: 根据ID获取详情
|
|
*/
|
|
export function getUserDetail(userId) {
|
|
return http.request({
|
|
url: '/user/detail/' + userId,
|
|
method: 'get',
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @description: 添加用户
|
|
*/
|
|
export function userAdd(data: any) {
|
|
return http.request({
|
|
url: '/user/add',
|
|
method: 'POST',
|
|
data,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @description: 更新用户
|
|
*/
|
|
export function userUpdate(data: any) {
|
|
return http.request({
|
|
url: '/user/update',
|
|
method: 'PUT',
|
|
data,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @description: 重置密码
|
|
*/
|
|
export function resetPwd(data: any) {
|
|
return http.request({
|
|
url: '/user/resetPwd',
|
|
method: 'PUT',
|
|
data,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @description: 删除用户
|
|
*/
|
|
export function userDelete(userId) {
|
|
return http.request({
|
|
url: '/user/delete/' + userId,
|
|
method: 'DELETE',
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @description: 批量删除用户
|
|
*/
|
|
export function userBatchDelete(data: any) {
|
|
return http.request({
|
|
url: '/user/batchDelete',
|
|
method: 'DELETE',
|
|
data,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @description: 导入用户
|
|
*/
|
|
export function userImport(data) {
|
|
return http.request({
|
|
url: '/user/import',
|
|
method: 'POST',
|
|
data,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @description: 导出用户
|
|
*/
|
|
export function userExport() {
|
|
return http.request(
|
|
{
|
|
url: '/user/export',
|
|
method: 'GET',
|
|
responseType: 'blob',
|
|
},
|
|
{
|
|
isTransformResponse: false,
|
|
},
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @description: 下载模板
|
|
*/
|
|
export function getTemplateByCode(code: any) {
|
|
return http.request({
|
|
url: '/file/template/getTemplateByCode/' + code,
|
|
method: 'GET',
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @description: 获取打印地址
|
|
*/
|
|
export function getUserDocument(userId: any) {
|
|
return http.request({
|
|
url: '/user/document/' + userId,
|
|
method: 'GET',
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @description: 城市列表
|
|
*/
|
|
export function getCityByList(pid: any) {
|
|
return http.request({
|
|
url: '/city/getCityList/' + pid,
|
|
method: 'get',
|
|
});
|
|
}
|