初始化移动端提交
This commit is contained in:
13
sheep/api/system/area.js
Normal file
13
sheep/api/system/area.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import request from '@/sheep/request';
|
||||
|
||||
const AreaApi = {
|
||||
// 获得地区树
|
||||
getAreaTree: () => {
|
||||
return request({
|
||||
url: '/system/area/tree',
|
||||
method: 'GET'
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default AreaApi;
|
||||
166
sheep/api/system/auth.js
Normal file
166
sheep/api/system/auth.js
Normal file
@@ -0,0 +1,166 @@
|
||||
import request from '@/sheep/request';
|
||||
|
||||
const AuthUtil = {
|
||||
// 使用用户名 + 密码登录
|
||||
login: (data) => {
|
||||
return request({
|
||||
url: '/system/auth/login',
|
||||
method: 'POST',
|
||||
data,
|
||||
custom: {
|
||||
showSuccess: true,
|
||||
loadingMsg: '登录中',
|
||||
successMsg: '登录成功',
|
||||
},
|
||||
});
|
||||
},
|
||||
// 使用手机 + 验证码登录
|
||||
smsLogin: (data) => {
|
||||
return request({
|
||||
url: '/system/auth/sms-login',
|
||||
method: 'POST',
|
||||
data,
|
||||
custom: {
|
||||
showSuccess: true,
|
||||
loadingMsg: '登录中',
|
||||
successMsg: '登录成功',
|
||||
},
|
||||
});
|
||||
},
|
||||
// 发送手机验证码
|
||||
sendSmsCode: (mobile, scene) => {
|
||||
return request({
|
||||
url: '/system/auth/send-sms-code',
|
||||
method: 'POST',
|
||||
data: {
|
||||
mobile,
|
||||
scene,
|
||||
},
|
||||
custom: {
|
||||
loadingMsg: '发送中',
|
||||
showSuccess: true,
|
||||
successMsg: '发送成功',
|
||||
},
|
||||
});
|
||||
},
|
||||
// 登出系统
|
||||
logout: () => {
|
||||
return request({
|
||||
url: '/system/auth/logout',
|
||||
method: 'POST',
|
||||
});
|
||||
},
|
||||
// 刷新令牌
|
||||
refreshToken: (refreshToken) => {
|
||||
return request({
|
||||
url: '/system/auth/refresh-token',
|
||||
method: 'POST',
|
||||
params: {
|
||||
refreshToken,
|
||||
},
|
||||
custom: {
|
||||
showLoading: false, // 不用加载中
|
||||
showError: false, // 不展示错误提示
|
||||
},
|
||||
});
|
||||
},
|
||||
// 社交授权的跳转
|
||||
socialAuthRedirect: (type, redirectUri) => {
|
||||
return request({
|
||||
url: '/system/auth/social-auth-redirect',
|
||||
method: 'GET',
|
||||
params: {
|
||||
type,
|
||||
redirectUri,
|
||||
},
|
||||
custom: {
|
||||
showSuccess: true,
|
||||
loadingMsg: '登陆中',
|
||||
},
|
||||
});
|
||||
},
|
||||
// 社交快捷登录
|
||||
socialLogin: (type, code, state) => {
|
||||
return request({
|
||||
url: '/system/auth/social-login',
|
||||
method: 'POST',
|
||||
data: {
|
||||
type,
|
||||
code,
|
||||
state,
|
||||
},
|
||||
custom: {
|
||||
showSuccess: true,
|
||||
loadingMsg: '登陆中',
|
||||
},
|
||||
});
|
||||
},
|
||||
// 微信小程序的一键登录
|
||||
weixinMiniAppLogin: (phoneCode, loginCode, state) => {
|
||||
return request({
|
||||
url: '/system/auth/weixin-mini-app-login',
|
||||
method: 'POST',
|
||||
data: {
|
||||
phoneCode,
|
||||
loginCode,
|
||||
state,
|
||||
},
|
||||
custom: {
|
||||
showSuccess: true,
|
||||
loadingMsg: '登陆中',
|
||||
successMsg: '登录成功',
|
||||
},
|
||||
});
|
||||
},
|
||||
// 创建微信 JS SDK 初始化所需的签名
|
||||
createWeixinMpJsapiSignature: (url) => {
|
||||
return request({
|
||||
url: '/system/auth/create-weixin-jsapi-signature',
|
||||
method: 'POST',
|
||||
params: {
|
||||
url,
|
||||
},
|
||||
custom: {
|
||||
showError: false,
|
||||
showLoading: false,
|
||||
},
|
||||
});
|
||||
},
|
||||
// 获取用户权限信息
|
||||
getInfo: () => {
|
||||
return request({
|
||||
url: '/system/auth/get-permission-info',
|
||||
method: 'GET',
|
||||
custom: {
|
||||
showError: false,
|
||||
showLoading: false,
|
||||
},
|
||||
});
|
||||
},
|
||||
// 获取验证图片以及 token
|
||||
getCaptchaCode: (data) => {
|
||||
return request({
|
||||
url: '/system/captcha/get',
|
||||
method: 'POST',
|
||||
data,
|
||||
custom: {
|
||||
showError: false,
|
||||
showLoading: false,
|
||||
},
|
||||
});
|
||||
},
|
||||
// 滑动或者点选验证
|
||||
verifyCaptcha: (data) => {
|
||||
return request({
|
||||
url: '/system/captcha/check',
|
||||
method: 'POST',
|
||||
data,
|
||||
custom: {
|
||||
showError: false,
|
||||
showLoading: false,
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default AuthUtil;
|
||||
16
sheep/api/system/dict.js
Normal file
16
sheep/api/system/dict.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import request from '@/sheep/request';
|
||||
|
||||
const DictApi = {
|
||||
// 根据字典类型查询字典数据信息
|
||||
getDictDataListByType: (type) => {
|
||||
return request({
|
||||
url: `/system/dict-data/type`,
|
||||
method: 'GET',
|
||||
params: {
|
||||
type,
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default DictApi;
|
||||
76
sheep/api/system/social.js
Normal file
76
sheep/api/system/social.js
Normal file
@@ -0,0 +1,76 @@
|
||||
import request from '@/sheep/request';
|
||||
|
||||
const SocialApi = {
|
||||
// 获得社交用户
|
||||
getSocialUser: (type) => {
|
||||
return request({
|
||||
url: '/system/social-user/get',
|
||||
method: 'GET',
|
||||
params: {
|
||||
type
|
||||
},
|
||||
custom: {
|
||||
showLoading: false,
|
||||
},
|
||||
});
|
||||
},
|
||||
// 社交绑定
|
||||
socialBind: (type, code, state) => {
|
||||
return request({
|
||||
url: '/system/social-user/bind',
|
||||
method: 'POST',
|
||||
data: {
|
||||
type,
|
||||
code,
|
||||
state
|
||||
},
|
||||
custom: {
|
||||
custom: {
|
||||
showSuccess: true,
|
||||
loadingMsg: '绑定中',
|
||||
successMsg: '绑定成功',
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
// 社交解绑
|
||||
socialUnbind: (type, openid) => {
|
||||
return request({
|
||||
url: '/system/social-user/unbind',
|
||||
method: 'DELETE',
|
||||
data: {
|
||||
type,
|
||||
openid
|
||||
},
|
||||
custom: {
|
||||
showLoading: false,
|
||||
loadingMsg: '解除绑定',
|
||||
successMsg: '解绑成功',
|
||||
},
|
||||
});
|
||||
},
|
||||
// 获取订阅消息模板列表
|
||||
getSubscribeTemplateList: () =>
|
||||
request({
|
||||
url: '/system/social-user/get-subscribe-template-list',
|
||||
method: 'GET',
|
||||
custom: {
|
||||
showError: false,
|
||||
showLoading: false,
|
||||
},
|
||||
}),
|
||||
// 获取微信小程序码
|
||||
getWxaQrcode: async (path, query) => {
|
||||
return await request({
|
||||
url: '/system/social-user/wxa-qrcode',
|
||||
method: 'POST',
|
||||
data: {
|
||||
scene: query,
|
||||
path,
|
||||
checkPath: false, // TODO 开发环境暂不检查 path 是否存在
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default SocialApi;
|
||||
97
sheep/api/system/user.js
Normal file
97
sheep/api/system/user.js
Normal file
@@ -0,0 +1,97 @@
|
||||
import request from '@/sheep/request';
|
||||
|
||||
const UserApi = {
|
||||
// 获得基本信息
|
||||
getUserInfo: () => {
|
||||
return request({
|
||||
url: '/system/user/profile/get',
|
||||
method: 'GET',
|
||||
custom: {
|
||||
showLoading: false,
|
||||
auth: true,
|
||||
},
|
||||
});
|
||||
},
|
||||
// 修改基本信息
|
||||
updateUser: (data) => {
|
||||
return request({
|
||||
url: '/system/user/profile/update',
|
||||
method: 'PUT',
|
||||
data,
|
||||
custom: {
|
||||
auth: true,
|
||||
showSuccess: true,
|
||||
successMsg: '更新成功'
|
||||
},
|
||||
});
|
||||
},
|
||||
// 修改用户手机
|
||||
updateUserMobile: (data) => {
|
||||
return request({
|
||||
url: '/system/user/profile/update-mobile',
|
||||
method: 'PUT',
|
||||
data,
|
||||
custom: {
|
||||
loadingMsg: '验证中',
|
||||
showSuccess: true,
|
||||
successMsg: '修改成功'
|
||||
},
|
||||
});
|
||||
},
|
||||
// 基于微信小程序的授权码,修改用户手机
|
||||
updateUserMobileByWeixin: (code) => {
|
||||
return request({
|
||||
url: '/system/user/profile/update-mobile-by-weixin',
|
||||
method: 'PUT',
|
||||
data: {
|
||||
code
|
||||
},
|
||||
custom: {
|
||||
showSuccess: true,
|
||||
loadingMsg: '获取中',
|
||||
successMsg: '修改成功'
|
||||
},
|
||||
});
|
||||
},
|
||||
// 修改密码
|
||||
updateUserPassword: (data) => {
|
||||
return request({
|
||||
url: '/system/user/profile/update-password',
|
||||
method: 'PUT',
|
||||
data,
|
||||
custom: {
|
||||
loadingMsg: '验证中',
|
||||
showSuccess: true,
|
||||
successMsg: '修改成功'
|
||||
},
|
||||
});
|
||||
},
|
||||
// 重置密码
|
||||
resetUserPassword: (data) => {
|
||||
return request({
|
||||
url: '/system/auth/reset-password',
|
||||
method: 'POST',
|
||||
data,
|
||||
custom: {
|
||||
loadingMsg: '验证中',
|
||||
showSuccess: true,
|
||||
successMsg: '修改成功'
|
||||
}
|
||||
});
|
||||
},
|
||||
// 上传用户头像
|
||||
uploadAvatar: (data) => {
|
||||
return request({
|
||||
url: '/system/user/profile/update-avatar',
|
||||
method: 'PUT',
|
||||
data,
|
||||
custom: {
|
||||
loadingMsg: '上传中',
|
||||
showSuccess: true,
|
||||
successMsg: '上传成功'
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default UserApi;
|
||||
Reference in New Issue
Block a user