docs: 完善注释
Former-commit-id: 7a03ecf0ed497da80924b8f6a5117c2e783b6d4d
This commit is contained in:
@@ -3,6 +3,7 @@ import { AxiosPromise } from 'axios';
|
|||||||
import { LoginData, LoginResult } from './types';
|
import { LoginData, LoginResult } from './types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 登录API
|
||||||
*
|
*
|
||||||
* @param data {LoginData}
|
* @param data {LoginData}
|
||||||
* @returns
|
* @returns
|
||||||
@@ -16,7 +17,7 @@ export function loginApi(data: LoginData): AxiosPromise<LoginResult> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注销
|
* 注销API
|
||||||
*/
|
*/
|
||||||
export function logoutApi() {
|
export function logoutApi() {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
/**
|
/**
|
||||||
* 登录请求
|
* 登录请求参数
|
||||||
*/
|
*/
|
||||||
export interface LoginData {
|
export interface LoginData {
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
username: string;
|
username: string;
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
password: string;
|
password: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10,16 +16,20 @@ export interface LoginData {
|
|||||||
* 登录响应
|
* 登录响应
|
||||||
*/
|
*/
|
||||||
export interface LoginResult {
|
export interface LoginResult {
|
||||||
accessToken: string;
|
/**
|
||||||
tokenType: string;
|
* 访问token
|
||||||
refreshToken: string;
|
|
||||||
expires: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 验证码类型
|
|
||||||
*/
|
*/
|
||||||
export interface VerifyCode {
|
accessToken?: string;
|
||||||
verifyCodeImg: string;
|
/**
|
||||||
verifyCodeKey: string;
|
* 过期时间(单位:毫秒)
|
||||||
|
*/
|
||||||
|
expires?: number;
|
||||||
|
/**
|
||||||
|
* 刷新token
|
||||||
|
*/
|
||||||
|
refreshToken?: string;
|
||||||
|
/**
|
||||||
|
* token 类型
|
||||||
|
*/
|
||||||
|
tokenType?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ export const useUserStore = defineStore('user', () => {
|
|||||||
const perms = ref<Array<string>>([]); // 用户权限编码集合 → 判断按钮权限
|
const perms = ref<Array<string>>([]); // 用户权限编码集合 → 判断按钮权限
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录
|
* 登录调用
|
||||||
*
|
*
|
||||||
* @param loginData
|
* @param {LoginData}
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
function login(loginData: LoginData) {
|
function login(loginData: LoginData) {
|
||||||
@@ -29,7 +29,7 @@ export const useUserStore = defineStore('user', () => {
|
|||||||
loginApi(loginData)
|
loginApi(loginData)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
const { tokenType, accessToken } = response.data;
|
const { tokenType, accessToken } = response.data;
|
||||||
token.value = tokenType + ' ' + accessToken;
|
token.value = tokenType + ' ' + accessToken; // Bearer eyJhbGciOiJIUzI1NiJ9.xxx.xxx
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
|||||||
Reference in New Issue
Block a user