feat: add vue3(element-plus)
This commit is contained in:
68
yudao-ui-admin-vue3/src/api/system/user/index.ts
Normal file
68
yudao-ui-admin-vue3/src/api/system/user/index.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
import { defHttp } from '@/config/axios'
|
||||
import type { UserVO } from './types'
|
||||
|
||||
// 查询用户管理列表
|
||||
export const getUserPageApi = ({ params }) => {
|
||||
return defHttp.get<PageResult<UserVO>>({ url: '/system/user/page', params })
|
||||
}
|
||||
|
||||
// 查询用户详情
|
||||
export const getUserApi = (id: number) => {
|
||||
return defHttp.get<UserVO>({ url: '/system/user/get?id=' + id })
|
||||
}
|
||||
|
||||
// 新增用户
|
||||
export const createUserApi = (params: UserVO) => {
|
||||
return defHttp.post({ url: '/system/user/create', params })
|
||||
}
|
||||
|
||||
// 修改用户
|
||||
export const updateUserApi = (params: UserVO) => {
|
||||
return defHttp.put({ url: '/system/user/update', params })
|
||||
}
|
||||
|
||||
// 删除用户
|
||||
export const deleteUserApi = (id: number) => {
|
||||
return defHttp.delete({ url: '/system/user/delete?id=' + id })
|
||||
}
|
||||
|
||||
// 导出用户
|
||||
export const exportUserApi = (params) => {
|
||||
return defHttp.get({ url: '/system/user/export', params, responseType: 'blob' })
|
||||
}
|
||||
|
||||
// 下载用户导入模板
|
||||
export const importUserTemplateApi = () => {
|
||||
return defHttp.get({ url: '/system/user/get-import-template', responseType: 'blob' })
|
||||
}
|
||||
|
||||
// 用户密码重置
|
||||
export const resetUserPwdApi = (userId: number, password: number) => {
|
||||
const data = {
|
||||
userId,
|
||||
password
|
||||
}
|
||||
return defHttp.put({
|
||||
url: '/system/user/resetPwd',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 用户状态修改
|
||||
export const updateUserStatusApi = (id: number, status: number) => {
|
||||
const data = {
|
||||
id,
|
||||
status
|
||||
}
|
||||
return defHttp.put({ url: '/system/user/update-status', data: data })
|
||||
}
|
||||
|
||||
// 查询授权角色
|
||||
export const getAuthRoleApi = (userId: string) => {
|
||||
return defHttp.get({ url: '/system/user/authRole/' + userId })
|
||||
}
|
||||
|
||||
// 保存授权角色
|
||||
export const updateAuthRoleApi = (data: any) => {
|
||||
return defHttp.put({ url: '/system/user/authRole', params: data })
|
||||
}
|
28
yudao-ui-admin-vue3/src/api/system/user/profile/index.ts
Normal file
28
yudao-ui-admin-vue3/src/api/system/user/profile/index.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { defHttp } from '@/config/axios'
|
||||
import { ProfileVO } from './types'
|
||||
|
||||
// 查询用户个人信息
|
||||
export const getUserProfileApi = () => {
|
||||
return defHttp.get<ProfileVO>({ url: '/system/user/profile/get' })
|
||||
}
|
||||
|
||||
// 修改用户个人信息
|
||||
export const updateUserProfileApi = ({ params }) => {
|
||||
return defHttp.put({ url: '/system/user/profile/update', params })
|
||||
}
|
||||
|
||||
// 用户密码重置
|
||||
export const updateUserPwdApi = (oldPassword: string, newPassword: string) => {
|
||||
return defHttp.put({
|
||||
url: '/system/user/profile/update-password',
|
||||
params: {
|
||||
oldPassword: oldPassword,
|
||||
newPassword: newPassword
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 用户头像上传
|
||||
export const uploadAvatarApi = (data) => {
|
||||
return defHttp.put({ url: '/system/user/profile/update-avatar', data: data })
|
||||
}
|
42
yudao-ui-admin-vue3/src/api/system/user/profile/types.ts
Normal file
42
yudao-ui-admin-vue3/src/api/system/user/profile/types.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
export type ProfileDept = {
|
||||
id: number
|
||||
name: string
|
||||
}
|
||||
export type ProfileRole = {
|
||||
id: number
|
||||
name: string
|
||||
}
|
||||
export type ProfilePost = {
|
||||
id: number
|
||||
name: string
|
||||
}
|
||||
export type SocialUser = {
|
||||
id: number
|
||||
type: number
|
||||
openid: string
|
||||
token: string
|
||||
rawTokenInfo: string
|
||||
nickname: string
|
||||
avatar: string
|
||||
rawUserInfo: string
|
||||
code: string
|
||||
state: string
|
||||
}
|
||||
export type ProfileVO = {
|
||||
id: number
|
||||
username: string
|
||||
nickname: string
|
||||
dept: ProfileDept
|
||||
roles: ProfileRole[]
|
||||
posts: ProfilePost[]
|
||||
socialUsers: SocialUser[]
|
||||
email: string
|
||||
mobile: string
|
||||
sex: number
|
||||
avatar: string
|
||||
status: number
|
||||
remark: string
|
||||
loginIp: string
|
||||
loginDate: Date
|
||||
createTime: Date
|
||||
}
|
16
yudao-ui-admin-vue3/src/api/system/user/types.ts
Normal file
16
yudao-ui-admin-vue3/src/api/system/user/types.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export type UserVO = {
|
||||
id: number
|
||||
username: string
|
||||
nickname: string
|
||||
deptId: number
|
||||
postIds: string[]
|
||||
email: string
|
||||
mobile: string
|
||||
sex: number
|
||||
avatar: string
|
||||
loginIp: string
|
||||
status: number
|
||||
remark: string
|
||||
loginDate: string
|
||||
createTime: string
|
||||
}
|
Reference in New Issue
Block a user