feat: CustomMobileBackgroundImage

This commit is contained in:
hamster1963
2024-12-19 14:46:21 +08:00
parent e0bf568965
commit ae8e3ea144
48 changed files with 320 additions and 1054 deletions

View File

@@ -1,10 +1,4 @@
import {
LoginUserResponse,
MonitorResponse,
ServerGroupResponse,
ServiceResponse,
SettingResponse,
} from "@/types/nezha-api"
import { LoginUserResponse, MonitorResponse, ServerGroupResponse, ServiceResponse, SettingResponse } from "@/types/nezha-api"
export const fetchServerGroup = async (): Promise<ServerGroupResponse> => {
const response = await fetch("/api/v1/server-group")

View File

@@ -8,9 +8,7 @@ export function cn(...inputs: ClassValue[]) {
}
export function formatNezhaInfo(now: number, serverInfo: NezhaServer) {
const lastActiveTime = serverInfo.last_active.startsWith("000")
? 0
: parseISOTimestamp(serverInfo.last_active)
const lastActiveTime = serverInfo.last_active.startsWith("000") ? 0 : parseISOTimestamp(serverInfo.last_active)
return {
...serverInfo,
cpu: serverInfo.state.cpu || 0,
@@ -47,12 +45,11 @@ export function formatNezhaInfo(now: number, serverInfo: NezhaServer) {
}
}
export function getDaysBetweenDatesWithAutoRenewal({
autoRenewal,
cycle,
startDate,
endDate,
}: BillingData): { days: number; cycleLabel: string; remainingPercentage: number } {
export function getDaysBetweenDatesWithAutoRenewal({ autoRenewal, cycle, startDate, endDate }: BillingData): {
days: number
cycleLabel: string
remainingPercentage: number
} {
let months = 1
// 套餐资费
let cycleLabel = cycle
@@ -100,12 +97,9 @@ export function getDaysBetweenDatesWithAutoRenewal({
days: getDaysBetweenDates(endDate, new Date(nowTime).toISOString()),
cycleLabel: cycleLabel,
remainingPercentage:
getDaysBetweenDates(endDate, new Date(nowTime).toISOString()) /
dayjs(endDate).diff(startDate, "day") >
1
getDaysBetweenDates(endDate, new Date(nowTime).toISOString()) / dayjs(endDate).diff(startDate, "day") > 1
? 1
: getDaysBetweenDates(endDate, new Date(nowTime).toISOString()) /
dayjs(endDate).diff(startDate, "day"),
: getDaysBetweenDates(endDate, new Date(nowTime).toISOString()) / dayjs(endDate).diff(startDate, "day"),
}
}