37 lines
1006 B
Vue
37 lines
1006 B
Vue
![]() |
import { http } from '@/utils/http'; // @/ 已经映射到 ./src/
|
|||
|
// ts对 HTTP 方法名称的大小写敏感。在 TypeScript 的类型定义中,HTTP 方法通常被定义为全大写的字符串字面量类型,如 "POST",而非"post"。
|
|||
|
interface LoginParams {
|
|||
|
username: string;
|
|||
|
password: string;
|
|||
|
captcha?: string; //非必填字段
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 统一的登录方法
|
|||
|
* @param config 登录参数
|
|||
|
* @returns 登录请求的 Promise
|
|||
|
*/
|
|||
|
export function loginApi(config : LoginParams) {
|
|||
|
// 如果传了 captcha,走本地登录(/sys/login),否则走单点登录(/sys/sinopecLogin)
|
|||
|
const url = config.captcha ? '/sys/login' : '/sys/sinopecLogin';
|
|||
|
return http({
|
|||
|
url,
|
|||
|
method: 'POST',
|
|||
|
data: config,
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 获取是否灰化
|
|||
|
* @param id 登录参数
|
|||
|
* @returns 0正常 1灰化
|
|||
|
*/
|
|||
|
export function jurisdictionApi(id : string) { // 是否灰化
|
|||
|
return http({
|
|||
|
url: '/CxcJurisdiction/cxcJurisdiction/queryById',
|
|||
|
method: 'GET',
|
|||
|
data: {
|
|||
|
id
|
|||
|
}
|
|||
|
})
|
|||
|
}
|