shuishen
2025-10-11 3fc27febccd04e2fcffbd2cdd16d2daafd0b3ca3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import {
  get,
  post,
  request
} from "@/utils/request"
 
import website from '@/config/website'
 
/** 登录 */
export const login = data =>
  post("/user/login", {
    data,
    custom: {
      auth: false
    }
  })
 
/** 验证码登录 */
export const loginByCode = data => post("/user/loginByCode", {
  data
})
 
/** 退出登录 */
export const logout = () => post("/user/logout")
 
// 用户登录接口
export const loginByUsername = (tenantId, deptId, roleId, username, password, type, key, code) => {
  return request({
    url: '/blade-auth/oauth/token',
    method: 'post',
    header: {
      'Tenant-Id': tenantId,
      'Dept-Id': website.switchMode ? deptId : '',
      'Role-Id': website.switchMode ? roleId : '',
      'Captcha-Key': key,
      'Captcha-Code': code,
    },
    params: {
      tenantId,
      username,
      password,
      grant_type: 'password',
      scope: 'all',
      type,
    },
  })
}