mirror of
https://gitee.com/hhyykk/ipms-sjy-ui.git
synced 2025-07-24 07:45:07 +08:00
初始化项目,自 v1.7.1 版本开始
This commit is contained in:
91
src/api/system/user/index.ts
Normal file
91
src/api/system/user/index.ts
Normal file
@ -0,0 +1,91 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface 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: Date
|
||||
createTime: Date
|
||||
}
|
||||
|
||||
export interface UserPageReqVO extends PageParam {
|
||||
deptId?: number
|
||||
username?: string
|
||||
mobile?: string
|
||||
status?: number
|
||||
createTime?: Date[]
|
||||
}
|
||||
|
||||
export interface UserExportReqVO {
|
||||
code?: string
|
||||
name?: string
|
||||
status?: number
|
||||
createTime?: Date[]
|
||||
}
|
||||
|
||||
// 查询用户管理列表
|
||||
export const getUserPageApi = (params: UserPageReqVO) => {
|
||||
return request.get({ url: '/system/user/page', params })
|
||||
}
|
||||
|
||||
// 查询用户详情
|
||||
export const getUserApi = (id: number) => {
|
||||
return request.get({ url: '/system/user/get?id=' + id })
|
||||
}
|
||||
|
||||
// 新增用户
|
||||
export const createUserApi = (data: UserVO) => {
|
||||
return request.post({ url: '/system/user/create', data })
|
||||
}
|
||||
|
||||
// 修改用户
|
||||
export const updateUserApi = (data: UserVO) => {
|
||||
return request.put({ url: '/system/user/update', data })
|
||||
}
|
||||
|
||||
// 删除用户
|
||||
export const deleteUserApi = (id: number) => {
|
||||
return request.delete({ url: '/system/user/delete?id=' + id })
|
||||
}
|
||||
|
||||
// 导出用户
|
||||
export const exportUserApi = (params: UserExportReqVO) => {
|
||||
return request.download({ url: '/system/user/export', params })
|
||||
}
|
||||
|
||||
// 下载用户导入模板
|
||||
export const importUserTemplateApi = () => {
|
||||
return request.download({ url: '/system/user/get-import-template' })
|
||||
}
|
||||
|
||||
// 用户密码重置
|
||||
export const resetUserPwdApi = (id: number, password: string) => {
|
||||
const data = {
|
||||
id,
|
||||
password
|
||||
}
|
||||
return request.put({ url: '/system/user/update-password', data: data })
|
||||
}
|
||||
|
||||
// 用户状态修改
|
||||
export const updateUserStatusApi = (id: number, status: number) => {
|
||||
const data = {
|
||||
id,
|
||||
status
|
||||
}
|
||||
return request.put({ url: '/system/user/update-status', data: data })
|
||||
}
|
||||
|
||||
// 获取用户精简信息列表
|
||||
export const getListSimpleUsersApi = () => {
|
||||
return request.get({ url: '/system/user/list-all-simple' })
|
||||
}
|
77
src/api/system/user/profile.ts
Normal file
77
src/api/system/user/profile.ts
Normal file
@ -0,0 +1,77 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface ProfileDept {
|
||||
id: number
|
||||
name: string
|
||||
}
|
||||
export interface ProfileRole {
|
||||
id: number
|
||||
name: string
|
||||
}
|
||||
export interface ProfilePost {
|
||||
id: number
|
||||
name: string
|
||||
}
|
||||
export interface SocialUser {
|
||||
id: number
|
||||
type: number
|
||||
openid: string
|
||||
token: string
|
||||
rawTokenInfo: string
|
||||
nickname: string
|
||||
avatar: string
|
||||
rawUserInfo: string
|
||||
code: string
|
||||
state: string
|
||||
}
|
||||
export interface 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
|
||||
}
|
||||
|
||||
export interface UserProfileUpdateReqVO {
|
||||
nickname: string
|
||||
email: string
|
||||
mobile: string
|
||||
sex: number
|
||||
}
|
||||
|
||||
// 查询用户个人信息
|
||||
export const getUserProfileApi = () => {
|
||||
return request.get({ url: '/system/user/profile/get' })
|
||||
}
|
||||
|
||||
// 修改用户个人信息
|
||||
export const updateUserProfileApi = (data: UserProfileUpdateReqVO) => {
|
||||
return request.put({ url: '/system/user/profile/update', data })
|
||||
}
|
||||
|
||||
// 用户密码重置
|
||||
export const updateUserPwdApi = (oldPassword: string, newPassword: string) => {
|
||||
return request.put({
|
||||
url: '/system/user/profile/update-password',
|
||||
data: {
|
||||
oldPassword: oldPassword,
|
||||
newPassword: newPassword
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 用户头像上传
|
||||
export const uploadAvatarApi = (data) => {
|
||||
return request.upload({ url: '/system/user/profile/update-avatar', data: data })
|
||||
}
|
31
src/api/system/user/socialUser.ts
Normal file
31
src/api/system/user/socialUser.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// 社交绑定,使用 code 授权码
|
||||
export const socialBind = (type, code, state) => {
|
||||
return request.post({
|
||||
url: '/system/social-user/bind',
|
||||
data: {
|
||||
type,
|
||||
code,
|
||||
state
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 取消社交绑定
|
||||
export const socialUnbind = (type, openid) => {
|
||||
return request.delete({
|
||||
url: '/system/social-user/unbind',
|
||||
data: {
|
||||
type,
|
||||
openid
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 社交授权的跳转
|
||||
export const socialAuthRedirect = (type, redirectUri) => {
|
||||
return request.get({
|
||||
url: '/system/auth/social-auth-redirect?type=' + type + '&redirectUri=' + redirectUri
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user