dashboard.ts 989 字节
Newer Older
1 2 3
import axios from 'axios';
import type { TableData } from '@arco-design/web-vue/es/table/interface';

4 5
const BASE_URL = '/dashboard';

6 7 8 9 10 11 12 13
export interface DashboardTotalRecord {
  pvCount: number;
  ipCount: number;
  todayPvCount: number;
  newPvFromYesterday: number;
}

export interface DashboardAnnouncementRecord {
14 15 16 17 18
  id: string;
  title: string;
  type: number;
}

19 20 21 22
export function getTotal() {
  return axios.get<DashboardTotalRecord>(`${BASE_URL}/total`);
}

23
export function listAnnouncement() {
24
  return axios.get<DashboardAnnouncementRecord[]>(`${BASE_URL}/announcement`);
25 26
}

27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
export interface ContentDataRecord {
  x: string;
  y: number;
}

export function queryContentData() {
  return axios.get<ContentDataRecord[]>('/api/content-data');
}

export interface PopularRecord {
  key: number;
  clickNumber: string;
  title: string;
  increases: number;
}

export function queryPopularList(params: { type: string }) {
  return axios.get<TableData[]>('/api/popular/list', { params });
}