update 重构 头像上传改为先上传oss后更新用户数据
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { PageResult } from '@/api/types';
|
||||
import type { AxiosPromise } from '@/utils/api-types';
|
||||
import request from '@/utils/request';
|
||||
import type { OssQuery, OssVO } from './types';
|
||||
import type { OssQuery, OssUploadVO, OssVO } from './types';
|
||||
|
||||
// 查询OSS对象存储列表
|
||||
export function listOss(query: OssQuery): AxiosPromise<PageResult<OssVO>> {
|
||||
@@ -20,6 +20,15 @@ export function listByIds(ossId: string | number): AxiosPromise<OssVO[]> {
|
||||
});
|
||||
}
|
||||
|
||||
// 上传OSS对象存储
|
||||
export function uploadOss(data: FormData): AxiosPromise<OssUploadVO> {
|
||||
return request({
|
||||
url: '/resource/oss/upload',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
// 删除OSS对象存储
|
||||
export function delOss(ossId: string | number | Array<string | number>) {
|
||||
return request({
|
||||
|
||||
@@ -8,6 +8,12 @@ export interface OssVO extends BaseEntity {
|
||||
service: string;
|
||||
}
|
||||
|
||||
export interface OssUploadVO {
|
||||
url: string;
|
||||
fileName: string;
|
||||
ossId: string;
|
||||
}
|
||||
|
||||
export interface OssQuery extends PageQuery {
|
||||
fileName: string;
|
||||
originalName: string;
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { AxiosPromise } from '@/utils/api-types';
|
||||
import request from '@/utils/request';
|
||||
import { parseStrEmpty } from '@/utils/ruoyi';
|
||||
import type { DeptTreeVO } from './../dept/types';
|
||||
import type { UserForm, UserInfoVO, UserQuery, UserVO } from './types';
|
||||
import type { UserForm, UserInfoVO, UserProfileForm, UserQuery, UserVO } from './types';
|
||||
|
||||
/**
|
||||
* 查询用户列表
|
||||
@@ -136,7 +136,7 @@ export const getUserProfile = (): AxiosPromise<UserInfoVO> => {
|
||||
* 修改用户个人信息
|
||||
* @param data 用户信息
|
||||
*/
|
||||
export const updateUserProfile = (data: UserForm) => {
|
||||
export const updateUserProfile = (data: UserProfileForm) => {
|
||||
return request({
|
||||
url: '/system/user/profile',
|
||||
method: 'put',
|
||||
@@ -165,18 +165,6 @@ export const updateUserPwd = (oldPassword: string, newPassword: string) => {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 用户头像上传
|
||||
* @param data 头像文件
|
||||
*/
|
||||
export const uploadAvatar = (data: FormData) => {
|
||||
return request({
|
||||
url: '/system/user/profile/avatar',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询授权角色
|
||||
* @param userId 用户ID
|
||||
@@ -234,7 +222,6 @@ export default {
|
||||
getUserProfile,
|
||||
updateUserProfile,
|
||||
updateUserPwd,
|
||||
uploadAvatar,
|
||||
getAuthRole,
|
||||
updateAuthRole,
|
||||
deptTreeSelect,
|
||||
|
||||
@@ -71,6 +71,17 @@ export interface UserForm {
|
||||
roleIds: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 个人资料表单类型
|
||||
*/
|
||||
export interface UserProfileForm {
|
||||
nickName?: string;
|
||||
phoneNumber?: string;
|
||||
email?: string;
|
||||
gender?: string;
|
||||
avatar?: string | number;
|
||||
}
|
||||
|
||||
export interface UserInfoVO {
|
||||
user: UserVO;
|
||||
roles: RoleVO[];
|
||||
|
||||
Reference in New Issue
Block a user