Initial commit
This commit is contained in:
56
src/api/dashboard/analysis/index.ts
Normal file
56
src/api/dashboard/analysis/index.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult } from '@/api';
|
||||
import type { PayNumData, SaleroomResult, VisitData, CloudData } from './model';
|
||||
|
||||
/**
|
||||
* 获取支付笔数数据
|
||||
*/
|
||||
export async function getPayNumList() {
|
||||
const res = await request.get<ApiResult<PayNumData[]>>(
|
||||
'https://www.gxwebsoft.com/20200610/analysis-pay-num.json'
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取销售量数据
|
||||
*/
|
||||
export async function getSaleroomList() {
|
||||
const res = await request.get<ApiResult<SaleroomResult>>(
|
||||
'https://www.gxwebsoft.com/20200610/analysis-saleroom.json'
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最近 1 小时访问情况数据
|
||||
* @returns {Promise<Object>}
|
||||
*/
|
||||
export async function getVisitHourList() {
|
||||
const res = await request.get<ApiResult<VisitData[]>>(
|
||||
'https://www.gxwebsoft.com/20200610/analysis-visits.json'
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取词云数据
|
||||
*/
|
||||
export async function getWordCloudList() {
|
||||
const res = await request.get<ApiResult<CloudData[]>>(
|
||||
'https://www.gxwebsoft.com/20200610/analysis-hot-search.json'
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
46
src/api/dashboard/analysis/model/index.ts
Normal file
46
src/api/dashboard/analysis/model/index.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* 支付笔数数据格式
|
||||
*/
|
||||
export interface PayNumData {
|
||||
// 日期
|
||||
date?: string;
|
||||
// 支付笔数
|
||||
value?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 销售量数据格式
|
||||
*/
|
||||
export interface SaleroomData {
|
||||
// 月份
|
||||
month?: string;
|
||||
// 销售量
|
||||
value?: number;
|
||||
}
|
||||
|
||||
export interface SaleroomResult {
|
||||
list1: SaleroomData[];
|
||||
list2: SaleroomData[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 访问情况数据格式
|
||||
*/
|
||||
export interface VisitData {
|
||||
// 时间
|
||||
time?: string;
|
||||
// 访问量
|
||||
visits?: number;
|
||||
// 浏览量
|
||||
views?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 词云数据格式
|
||||
*/
|
||||
export interface CloudData {
|
||||
// 标题
|
||||
name: string;
|
||||
// 数量
|
||||
value: number;
|
||||
}
|
||||
114
src/api/dashboard/appstore/index.ts
Normal file
114
src/api/dashboard/appstore/index.ts
Normal file
@@ -0,0 +1,114 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { App, AppParam } from './model';
|
||||
import { Menu } from '@/api/system/menu/model';
|
||||
|
||||
/**
|
||||
* 分页查询应用
|
||||
*/
|
||||
export async function pageApp(params: AppParam) {
|
||||
const res = await request.get<ApiResult<PageResult<App>>>('/oa/app/page', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询应用列表
|
||||
*/
|
||||
export async function listApp(params?: AppParam) {
|
||||
const res = await request.get<ApiResult<App[]>>('/oa/app', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加应用
|
||||
*/
|
||||
export async function addApp(data: App) {
|
||||
const res = await request.post<ApiResult<unknown>>('/oa/app', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改应用
|
||||
*/
|
||||
export async function updateApp(data: App) {
|
||||
const res = await request.put<ApiResult<unknown>>('/oa/app', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除应用
|
||||
*/
|
||||
export async function removeApp(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>('/oa/app/' + id);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除应用
|
||||
*/
|
||||
export async function removeBatchApp(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>('/oa/app/batch', {
|
||||
data
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查IP是否存在
|
||||
*/
|
||||
export async function checkExistence(
|
||||
field: string,
|
||||
value: string,
|
||||
id?: number
|
||||
) {
|
||||
const res = await request.get<ApiResult<unknown>>('/oa/app/existence', {
|
||||
params: { field, value, id }
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
// 添加菜单
|
||||
export async function saveMenu(data: App) {
|
||||
const res = await request.post<ApiResult<unknown>>('/oa/app/saveMenu', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
// 添加菜单按钮
|
||||
export async function saveAuthority(data: Menu[]) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/oa/app/saveAuthority',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
95
src/api/dashboard/appstore/model/index.ts
Normal file
95
src/api/dashboard/appstore/model/index.ts
Normal file
@@ -0,0 +1,95 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 应用
|
||||
*/
|
||||
export interface App {
|
||||
// 应用id
|
||||
appId?: number;
|
||||
// 应用名称
|
||||
appName?: string;
|
||||
// 上级id, 0是顶级
|
||||
parentId?: number;
|
||||
// 应用编号
|
||||
appCode?: string;
|
||||
// 应用图标
|
||||
appIcon?: string;
|
||||
// 应用类型
|
||||
appType?: string;
|
||||
// 菜单类型
|
||||
menuType?: number;
|
||||
// 应用地址
|
||||
appUrl?: string;
|
||||
// 下载地址
|
||||
downUrl?: string;
|
||||
// 应用包名
|
||||
packageName?: string;
|
||||
// 点击次数
|
||||
clicks?: string;
|
||||
// 安装次数
|
||||
installs?: string;
|
||||
// 项目介绍
|
||||
content?: string;
|
||||
// 开发者(个人)
|
||||
developer?: string;
|
||||
// 软件定价
|
||||
price?: string;
|
||||
// 评分
|
||||
score?: string;
|
||||
// 星级
|
||||
star?: string;
|
||||
// 菜单组件地址
|
||||
component?: string;
|
||||
// 菜单路由地址
|
||||
path?: string;
|
||||
// 权限标识
|
||||
authority?: string;
|
||||
// 打开位置
|
||||
target?: string;
|
||||
// 是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)
|
||||
hide?: number;
|
||||
// 菜单侧栏选中的path
|
||||
active?: string;
|
||||
// 其它路由元信息
|
||||
meta?: string;
|
||||
// 版本
|
||||
edition?: string;
|
||||
// 版本号
|
||||
version?: string;
|
||||
// 是否已安装
|
||||
isUse?: number;
|
||||
// 排序
|
||||
sortNumber?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 状态
|
||||
status?: number;
|
||||
// 发布者
|
||||
userId?: any;
|
||||
// 发布者昵称
|
||||
nickname?: string;
|
||||
// 子菜单
|
||||
children?: App[];
|
||||
// 权限树回显选中状态, 0未选中, 1选中
|
||||
checked?: boolean;
|
||||
//
|
||||
key?: number;
|
||||
//
|
||||
value?: number;
|
||||
//
|
||||
parentIds?: number[];
|
||||
//
|
||||
openType?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用搜索条件
|
||||
*/
|
||||
export interface AppParam extends PageParam {
|
||||
appName?: string;
|
||||
appCode?: string;
|
||||
developer?: string;
|
||||
parentId?: number;
|
||||
}
|
||||
44
src/api/dashboard/monitor/index.ts
Normal file
44
src/api/dashboard/monitor/index.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult } from '@/api';
|
||||
import type { UserCount, BrowserCount } from './model';
|
||||
const BASE_URL = import.meta.env.BASE_URL;
|
||||
|
||||
/**
|
||||
* 获取中国地图geo数据
|
||||
*/
|
||||
export async function getChinaMapData() {
|
||||
const res = await request.get<any>(
|
||||
BASE_URL + 'json/china-provinces.geo.json',
|
||||
{ baseURL: '' }
|
||||
);
|
||||
if (res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error('获取地图数据失败'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户分布数据
|
||||
*/
|
||||
export async function getUserCountList() {
|
||||
const res = await request.get<ApiResult<UserCount[]>>(
|
||||
'https://www.gxwebsoft.com/20200610/monitor-user-count.json'
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户浏览器分布数据
|
||||
*/
|
||||
export async function getBrowserCountList() {
|
||||
const res = await request.get<ApiResult<BrowserCount[]>>(
|
||||
'https://www.gxwebsoft.com/20200610/monitor-browser-count.json'
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
21
src/api/dashboard/monitor/model/index.ts
Normal file
21
src/api/dashboard/monitor/model/index.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* 用户分布数据格式
|
||||
*/
|
||||
export interface UserCount {
|
||||
// 省份
|
||||
name: string;
|
||||
// 用户数量
|
||||
value: number;
|
||||
// 百分比
|
||||
percent?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 浏览器分布数据格式
|
||||
*/
|
||||
export interface BrowserCount {
|
||||
// 浏览器
|
||||
name: string;
|
||||
// 用户数量
|
||||
value: number;
|
||||
}
|
||||
Reference in New Issue
Block a user