This commit is contained in:
weiwei committed 2025-05-15 18:03:56 +08:00
1 parent 8f53f256f7
commit 4ff4812875
16 files changed
+162 -427

No files matched your search

+10 -50
View File
@@ -4,65 +4,40 @@ import { encryption } from "@/sheep/utils/encryption"
// 将 Basic Auth 字符串提取为常量
const BASIC_AUTH = "Basic " + window.btoa(import.meta.env.VITE_OAUTH2_APP_CLIENT)
// 定义接口类型
interface LoginParams {
username: string
password: string
randomStr: string
code: string
grant_type: string
scope: string
}
export default {
// 获取用户信息
userInfo: (): Promise<any> =>
request({
url: "/admin/user/info",
method: "GET",
custom: {
showLoading: false,
loadingMsg: "登录中",
},
}),
// 浙政钉授权
// 浙政钉授权登录
auth: (token: string): Promise<any> =>
request({
url: "/thirdparty/thirdPartyOAth2/zzdsso",
method: "POST",
data: { token },
custom: {
showLoading: false,
loadingMsg: "授权中",
},
}),
// 诗画授权
// 诗画授权登录
authsh: (data: { accountId: string; sessionId: string }): Promise<any> =>
request({
url: "/thirdparty/thirdPartyOAth2/shjnsso",
method: "POST",
custom: {
showLoading: false,
loadingMsg: "授权中",
},
data,
}),
// 刷新token
refreshToken: (params: { refreshToken: string }) =>
request({
url: `/sys/auth/refresh-token`,
method: "POST",
params,
custom: {
showLoading: false,
},
}),
// refreshToken: (params: { refreshToken: string }) =>
// request({
// url: `/sys/auth/refresh-token`,
// method: "POST",
// params,
// }),
// 登录
login: (params: LoginParams) => {
// 账号密码登录
login: (params: any) => {
const { username, password, randomStr, code, grant_type, scope } = params
const encPassword = encryption(password, import.meta.env.VITE_PWD_ENC_KEY)
@@ -83,9 +58,6 @@ export default {
Authorization: BASIC_AUTH,
"content-type": "application/x-www-form-urlencoded",
},
custom: {
showLoading: false,
},
})
},
// 判断是否是商户角色
@@ -93,27 +65,18 @@ export default {
request({
url: "/admin/role/isMchUser",
method: "GET",
custom: {
showLoading: false,
},
}),
// 判断用户移动端角色
userRole: () =>
request({
url: "/admin/role/app/user-role",
method: "GET",
custom: {
showLoading: false,
},
}),
// 根据手机号发送验证码
getMobilePhoneCode: (mobilePhone: string) =>
request({
url: `/thirdparty/thirdPartyOAth2/loginSms?mobilePhone=${mobilePhone}`,
method: "POST",
custom: {
showLoading: false,
},
}),
// 设备认证
verifyDevice: (data: { mobilePhone: string; code: string }) =>
@@ -121,8 +84,5 @@ export default {
url: "/thirdparty/thirdPartyOAth2/verify-device",
method: "POST",
data,
custom: {
showLoading: false,
},
}),
}