| | |
| | | import request from '@/utils/request'
|
| | |
|
| | | const client_id = 'web'
|
| | | const client_secret = '123456'
|
| | | const grant_type = 'password'
|
| | | const scope = 'server'
|
| | |
|
| | | // 登录方法
|
| | | export function login(username, password, code, uuid) {
|
| | | return request({
|
| | | url: '/auth/oauth/token',
|
| | | url: '/auth/login',
|
| | | headers: {
|
| | | isToken: false,
|
| | | repeatSubmit: false
|
| | | },
|
| | | method: 'post',
|
| | | params: { username, password, code, uuid, client_id, client_secret, grant_type, scope }
|
| | | data: { username, password, code, uuid }
|
| | | })
|
| | | }
|
| | |
|
| | | // 注册方法
|
| | | export function register(data) {
|
| | | return request({
|
| | | url: '/auth/register',
|
| | | headers: {
|
| | | isToken: false
|
| | | },
|
| | | method: 'post',
|
| | | data: data
|
| | | })
|
| | | }
|
| | |
|
| | | // 解锁屏幕
|
| | | export function unlockScreen(password) {
|
| | | return request({
|
| | | url: '/auth/unlockscreen',
|
| | | method: 'post',
|
| | | data: { password }
|
| | | })
|
| | | }
|
| | |
|
| | | // 刷新方法
|
| | | export function refreshToken() {
|
| | | return request({
|
| | | url: '/auth/refresh',
|
| | | method: 'post'
|
| | | })
|
| | | }
|
| | |
|
| | |
| | | // 退出方法
|
| | | export function logout() {
|
| | | return request({
|
| | | url: '/auth/token/logout',
|
| | | url: '/auth/logout',
|
| | | method: 'delete'
|
| | | })
|
| | | }
|
| | |
| | | export function getCodeImg() {
|
| | | return request({
|
| | | url: '/code',
|
| | | method: 'get'
|
| | | headers: {
|
| | | isToken: false
|
| | | },
|
| | | method: 'get',
|
| | | timeout: 20000
|
| | | })
|
| | | } |