You've already forked template-MP
新增:全量优化
This commit is contained in:
85
api/modules/user.js
Normal file
85
api/modules/user.js
Normal file
@@ -0,0 +1,85 @@
|
||||
import http from '@/api/request.js'
|
||||
|
||||
/**
|
||||
* 用户相关API模块
|
||||
*/
|
||||
export default {
|
||||
/**
|
||||
* 用户登录
|
||||
* @param {Object} data 登录数据
|
||||
* @returns {Promise}
|
||||
*/
|
||||
login(data) {
|
||||
return http.post('/user/login', data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户注册
|
||||
* @param {Object} data 注册数据
|
||||
* @returns {Promise}
|
||||
*/
|
||||
register(data) {
|
||||
return http.post('/user/register', data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @returns {Promise}
|
||||
*/
|
||||
getUserInfo() {
|
||||
return http.get('/user/info')
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新用户信息
|
||||
* @param {Object} data 用户信息数据
|
||||
* @returns {Promise}
|
||||
*/
|
||||
updateUserInfo(data) {
|
||||
return http.put('/user/info', data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
* @param {Object} data 密码数据
|
||||
* @returns {Promise}
|
||||
*/
|
||||
changePassword(data) {
|
||||
return http.post('/user/change-password', data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
* @returns {Promise}
|
||||
*/
|
||||
logout() {
|
||||
return http.post('/user/logout')
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
* @param {Object} params 查询参数
|
||||
* @returns {Promise}
|
||||
*/
|
||||
getUserList(params) {
|
||||
return http.get('/user/list', { params })
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取用户详情
|
||||
* @param {number} userId 用户ID
|
||||
* @returns {Promise}
|
||||
*/
|
||||
getUserDetail(userId) {
|
||||
return http.get(`/user/${userId}`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
* @param {number} userId 用户ID
|
||||
* @returns {Promise}
|
||||
*/
|
||||
deleteUser(userId) {
|
||||
return http.delete(`/user/${userId}`)
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user