mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 20:57:19 +08:00
feat: alova.js替换axios
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
import { request } from '@/utils'
|
||||
import { http } from '@/utils'
|
||||
|
||||
export default {
|
||||
// 获取备份列表
|
||||
list: (type: string, page: number, limit: number): any =>
|
||||
request.get(`/backup/${type}`, { params: { page, limit } }),
|
||||
http.Get(`/backup/${type}`, { params: { page, limit } }),
|
||||
// 创建备份
|
||||
create: (type: string, target: string, path: string): any =>
|
||||
request.post(`/backup/${type}`, { target, path }),
|
||||
http.Post(`/backup/${type}`, { target, path }),
|
||||
// 上传备份
|
||||
upload: (type: string, formData: FormData): any => {
|
||||
return request.post(`/backup/${type}/upload`, formData, {
|
||||
return http.Post(`/backup/${type}/upload`, formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
})
|
||||
},
|
||||
// 删除备份
|
||||
delete: (type: string, file: string): any =>
|
||||
request.delete(`/backup/${type}/delete`, { data: { file } }),
|
||||
http.Delete(`/backup/${type}/delete`, { data: { file } }),
|
||||
// 恢复备份
|
||||
restore: (type: string, file: string, target: string): any =>
|
||||
request.post(`/backup/${type}/restore`, { file, target })
|
||||
http.Post(`/backup/${type}/restore`, { file, target })
|
||||
}
|
||||
|
||||
@@ -1,33 +1,25 @@
|
||||
import { http, request } from '@/utils'
|
||||
|
||||
import type { RequestConfig } from '~/types/axios'
|
||||
import { http } from '@/utils'
|
||||
|
||||
export default {
|
||||
// 面板信息
|
||||
panel: (): Promise<Response> => fetch('/api/dashboard/panel'),
|
||||
// 面板菜单
|
||||
menu: (): any => request.get('/dashboard/menu'),
|
||||
panel: (): any => http.Get('/dashboard/panel'),
|
||||
// 首页应用
|
||||
homeApps: (): any => request.get('/dashboard/homeApps'),
|
||||
homeApps: (): any => http.Get('/dashboard/homeApps'),
|
||||
// 实时信息
|
||||
current: (nets: string[], disks: string[]): any =>
|
||||
request.post('/dashboard/current', { nets, disks }, { noNeedTip: true } as RequestConfig),
|
||||
http.Post('/dashboard/current', { nets, disks }, { meta: { noAlert: true } }),
|
||||
// 系统信息
|
||||
systemInfo: (): any => request.get('/dashboard/systemInfo'),
|
||||
systemInfo: (): any => http.Get('/dashboard/systemInfo'),
|
||||
// 统计信息
|
||||
countInfo: (): any => request.get('/dashboard/countInfo'),
|
||||
countInfo: (): any => http.Get('/dashboard/countInfo'),
|
||||
// 已安装的数据库和PHP
|
||||
installedDbAndPhp: (): any => request.get('/dashboard/installedDbAndPhp'),
|
||||
installedDbAndPhp: (): any => http.Get('/dashboard/installedDbAndPhp'),
|
||||
// 检查更新
|
||||
checkUpdate: (): any => request.get('/dashboard/checkUpdate'),
|
||||
checkUpdate: (): any => http.Get('/dashboard/checkUpdate'),
|
||||
// 更新日志
|
||||
updateInfo: (): any => request.get('/dashboard/updateInfo'),
|
||||
updateInfo: (): any => http.Get('/dashboard/updateInfo'),
|
||||
// 更新面板
|
||||
update: (): any => request.post('/dashboard/update', null),
|
||||
update: (): any => http.Post('/dashboard/update'),
|
||||
// 重启面板
|
||||
restart: (): any => request.post('/dashboard/restart')
|
||||
restart: (): any => http.Post('/dashboard/restart')
|
||||
}
|
||||
|
||||
export const panel = () => http.Get('/dashboard/panel')
|
||||
export const current = (nets: string[], disks: string[]) =>
|
||||
http.Post('/dashboard/current', { nets, disks }, { meta: { noAlert: true } })
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import { request } from '@/utils'
|
||||
import { http } from '@/utils'
|
||||
|
||||
export default {
|
||||
// 开关
|
||||
setting: (): any => request.get('/monitor/setting'),
|
||||
setting: (): any => http.Get('/monitor/setting'),
|
||||
// 保存天数
|
||||
updateSetting: (enabled: boolean, days: number): any =>
|
||||
request.post('/monitor/setting', { enabled, days }),
|
||||
http.Post('/monitor/setting', { enabled, days }),
|
||||
// 清空监控记录
|
||||
clear: (): any => request.post('/monitor/clear'),
|
||||
clear: (): any => http.Post('/monitor/clear'),
|
||||
// 监控记录
|
||||
list: (start: number, end: number): any =>
|
||||
request.get('/monitor/list', { params: { start, end } })
|
||||
list: (start: number, end: number): any => http.Get('/monitor/list', { params: { start, end } })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user