initial commit

This commit is contained in:
陈文彬
2020-09-28 20:19:10 +08:00
commit 2f6253cfb6
436 changed files with 26843 additions and 0 deletions

18
src/api/sys/menu.ts Normal file
View File

@@ -0,0 +1,18 @@
import { defHttp } from '/@/utils/http/axios';
import { getMenuListByIdParams, getMenuListByIdParamsResultModel } from './model/menuModel';
enum Api {
GetMenuListById = '/getMenuListById',
}
/**
* @description: 根据id获取用户菜单
*/
export function getMenuListById(params: getMenuListByIdParams) {
return defHttp.request<getMenuListByIdParamsResultModel>({
url: Api.GetMenuListById,
method: 'GET',
params,
});
}

View File

@@ -0,0 +1,23 @@
import { RouteMeta } from '/@/router/types';
export interface RouteItem {
path: string;
component: any;
meta: RouteMeta;
name?: string;
alias?: string | string[];
redirect?: string;
caseSensitive?: boolean;
children?: RouteItem[];
}
/**
* @description: 获取菜单接口
*/
export interface getMenuListByIdParams {
id: number | string;
}
/**
* @description: 获取菜单返回值
*/
export type getMenuListByIdParamsResultModel = RouteItem[];

View File

@@ -0,0 +1,43 @@
/**
* @description: Login interface parameters
*/
export interface LoginParams {
username: string;
password: string;
}
/**
* @description: Get user information
*/
export interface GetUserInfoByUserIdParams {
userId: string | number;
}
export interface RoleInfo {
roleName: string;
value: string;
}
/**
* @description: Login interface return value
*/
export interface LoginResultModel {
userId: string | number;
token: string;
role: RoleInfo;
}
/**
* @description: Get user information return value
*/
export interface GetUserInfoByUserIdModel {
role: RoleInfo;
// 用户id
userId: string | number;
// 用户名
username: string;
// 真实名字
realName: string;
// 介绍
desc?: string;
}

48
src/api/sys/user.ts Normal file
View File

@@ -0,0 +1,48 @@
import { defHttp } from '/@/utils/http/axios';
import {
LoginParams,
LoginResultModel,
GetUserInfoByUserIdParams,
GetUserInfoByUserIdModel,
} from './model/userModel';
enum Api {
Login = '/login',
GetUserInfoById = '/getUserInfoById',
GetPermCodeByUserId = '/getPermCodeByUserId',
}
/**
* @description: user login api
*/
export function loginApi(params: LoginParams) {
return defHttp.request<LoginResultModel>(
{
url: Api.Login,
method: 'POST',
params,
},
{
errorMessageMode: 'modal',
}
);
}
/**
* @description: getUserInfoById
*/
export function getUserInfoById(params: GetUserInfoByUserIdParams) {
return defHttp.request<GetUserInfoByUserIdModel>({
url: Api.GetUserInfoById,
method: 'GET',
params,
});
}
export function getPermCodeByUserId(params: GetUserInfoByUserIdParams) {
return defHttp.request<string[]>({
url: Api.GetPermCodeByUserId,
method: 'GET',
params,
});
}