| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- /**
- * 登录接口
- */
- import { request } from '../../utils/request'
- import { encryptAES } from '../../utils/crypto'
- import {getStoreIsKey} from '../../utils/storage'
- /**
- * 账号密码登录
- * @returns 返回整个响应对象 { status, msg, success, data }
- */
- export const loginByAccount = async (username: string, password: string): Promise<any> => {
- let dataForm = {
- username: username,
- password: password,
- deviceCode: 'app',
- };
-
- /* const isKey = getStoreIsKey();
- if(isKey == "1"){
- dataForm.username = encryptAES(username);
- dataForm.password = encryptAES(password);
- } */
-
- return request({
- url: '/login',
- method: 'POST',
- header: {
- isToken: false,
- repeatSubmit: false
- },
- data: dataForm,
- })
- }
- /**
- * SSO账号登录
- * @returns 返回整个响应对象 { status, msg, success, data }
- */
- export const loginSSO = async (ticket: string): Promise<any> => {
- return request({
- url: `/callback`,
- method: 'POST',
- header: {
- isToken: false,
- repeatSubmit: false
- },
- data: { ticket: ticket }
- })
- }
- export const getUserInfo = ():Promise<any> =>{
- return request({
- url: '/getInfo',
- method: 'GET'
- })
- }
- export const resetPassword = async (username: string, password: string, newPassword: string): Promise<any> => {
- let dataForm = {
- username: username,
- newPassword: newPassword,
- password: password
- };
- return request({
- url: '/initPassword',
- method: 'PUT',
- header: {
- isToken: false,
- repeatSubmit: false
- },
- data: dataForm,
- })
- }
- export const getIsKey = ():Promise<any> =>{
- return request({
- url: '/crypto/isKey',
- method: 'GET'
- })
- }
|