diff --git a/yudao-ui-admin-vue3/src/api/system/user/profile.ts b/yudao-ui-admin-vue3/src/api/system/user/profile.ts new file mode 100644 index 000000000..e78424cc4 --- /dev/null +++ b/yudao-ui-admin-vue3/src/api/system/user/profile.ts @@ -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 }) +} diff --git a/yudao-ui-admin-vue3/src/api/system/user/profile/index.ts b/yudao-ui-admin-vue3/src/api/system/user/profile/index.ts deleted file mode 100644 index 2863452b4..000000000 --- a/yudao-ui-admin-vue3/src/api/system/user/profile/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -import request from '@/config/axios' - -// 查询用户个人信息 -export const getUserProfileApi = () => { - return request.get({ url: '/system/user/profile/get' }) -} - -// 修改用户个人信息 -export const updateUserProfileApi = (params) => { - return request.put({ url: '/system/user/profile/update', params }) -} - -// 用户密码重置 -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 }) -} diff --git a/yudao-ui-admin-vue3/src/api/system/user/profile/types.ts b/yudao-ui-admin-vue3/src/api/system/user/profile/types.ts deleted file mode 100644 index f4d748301..000000000 --- a/yudao-ui-admin-vue3/src/api/system/user/profile/types.ts +++ /dev/null @@ -1,42 +0,0 @@ -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 -} diff --git a/yudao-ui-admin-vue3/src/api/system/user/socialUser.ts b/yudao-ui-admin-vue3/src/api/system/user/socialUser.ts new file mode 100644 index 000000000..79f4d4027 --- /dev/null +++ b/yudao-ui-admin-vue3/src/api/system/user/socialUser.ts @@ -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 + }) +} diff --git a/yudao-ui-admin-vue3/src/views/Profile/Index.vue b/yudao-ui-admin-vue3/src/views/Profile/Index.vue index 5f4fdfa13..4bcc81818 100644 --- a/yudao-ui-admin-vue3/src/views/Profile/Index.vue +++ b/yudao-ui-admin-vue3/src/views/Profile/Index.vue @@ -1,11 +1,3 @@ - +