mirror of
https://github.com/woodchen-ink/nezha-dash-v1.git
synced 2025-07-18 09:31:55 +08:00
fix: public note display
This commit is contained in:
parent
84974f0e78
commit
9afded7e21
@ -79,9 +79,9 @@ export default function ServerCard({ now, serverInfo }: { now: number; serverInf
|
||||
</p>
|
||||
) : parsedData.billingDataMod.amount === "0" ? (
|
||||
<p className={cn("text-[10px] text-green-600 ")}>免费</p>
|
||||
) : (
|
||||
) : parsedData.billingDataMod.amount === "-1" ? (
|
||||
<p className={cn("text-[10px] text-pink-600 ")}>按量收费</p>
|
||||
)}
|
||||
) : null}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
@ -95,9 +95,9 @@ export default function ServerCard({ now, serverInfo }: { now: number; serverInf
|
||||
</p>
|
||||
) : parsedData.billingDataMod.amount === "0" ? (
|
||||
<p className={cn("text-[10px] text-green-600 ")}>免费</p>
|
||||
) : (
|
||||
) : parsedData.billingDataMod.amount === "-1" ? (
|
||||
<p className={cn("text-[10px] text-pink-600 ")}>按量收费</p>
|
||||
)}
|
||||
) : null}
|
||||
</>
|
||||
))}
|
||||
{parsedData?.planDataMod && (
|
||||
@ -215,9 +215,9 @@ export default function ServerCard({ now, serverInfo }: { now: number; serverInf
|
||||
</p>
|
||||
) : parsedData.billingDataMod.amount === "0" ? (
|
||||
<p className={cn("text-[10px] text-green-600 ")}>免费</p>
|
||||
) : (
|
||||
) : parsedData.billingDataMod.amount === "-1" ? (
|
||||
<p className={cn("text-[10px] text-pink-600 ")}>按量收费</p>
|
||||
)}
|
||||
) : null}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
@ -231,9 +231,9 @@ export default function ServerCard({ now, serverInfo }: { now: number; serverInf
|
||||
</p>
|
||||
) : parsedData.billingDataMod.amount === "0" ? (
|
||||
<p className={cn("text-[10px] text-green-600 ")}>免费</p>
|
||||
) : (
|
||||
) : parsedData.billingDataMod.amount === "-1" ? (
|
||||
<p className={cn("text-[10px] text-pink-600 ")}>按量收费</p>
|
||||
)}
|
||||
) : null}
|
||||
</>
|
||||
))}
|
||||
{parsedData?.planDataMod && (
|
||||
|
@ -93,9 +93,9 @@ export default function ServerCardInline({
|
||||
</p>
|
||||
) : parsedData.billingDataMod.amount === "0" ? (
|
||||
<p className={cn("text-[10px] text-green-600 ")}>免费</p>
|
||||
) : (
|
||||
) : parsedData.billingDataMod.amount === "-1" ? (
|
||||
<p className={cn("text-[10px] text-pink-600 ")}>按量收费</p>
|
||||
)}
|
||||
) : null}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
@ -109,9 +109,9 @@ export default function ServerCardInline({
|
||||
</p>
|
||||
) : parsedData.billingDataMod.amount === "0" ? (
|
||||
<p className={cn("text-[10px] text-green-600 ")}>免费</p>
|
||||
) : (
|
||||
) : parsedData.billingDataMod.amount === "-1" ? (
|
||||
<p className={cn("text-[10px] text-pink-600 ")}>按量收费</p>
|
||||
)}
|
||||
) : null}
|
||||
</>
|
||||
))}
|
||||
{parsedData?.planDataMod && (
|
||||
@ -254,9 +254,9 @@ export default function ServerCardInline({
|
||||
</p>
|
||||
) : parsedData.billingDataMod.amount === "0" ? (
|
||||
<p className={cn("text-[10px] text-green-600 ")}>免费</p>
|
||||
) : (
|
||||
) : parsedData.billingDataMod.amount === "-1" ? (
|
||||
<p className={cn("text-[10px] text-pink-600 ")}>按量收费</p>
|
||||
)}
|
||||
) : null}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
@ -270,9 +270,9 @@ export default function ServerCardInline({
|
||||
</p>
|
||||
) : parsedData.billingDataMod.amount === "0" ? (
|
||||
<p className={cn("text-[10px] text-green-600 ")}>免费</p>
|
||||
) : (
|
||||
) : parsedData.billingDataMod.amount === "-1" ? (
|
||||
<p className={cn("text-[10px] text-pink-600 ")}>按量收费</p>
|
||||
)}
|
||||
) : null}
|
||||
</>
|
||||
))}
|
||||
{parsedData?.planDataMod && (
|
||||
|
@ -138,8 +138,8 @@ interface PlanData {
|
||||
}
|
||||
|
||||
interface PublicNoteData {
|
||||
billingDataMod: BillingData
|
||||
planDataMod: PlanData
|
||||
billingDataMod?: BillingData
|
||||
planDataMod?: PlanData
|
||||
}
|
||||
|
||||
export function parsePublicNote(publicNote: string): PublicNoteData | null {
|
||||
@ -148,6 +148,34 @@ export function parsePublicNote(publicNote: string): PublicNoteData | null {
|
||||
return null
|
||||
}
|
||||
const data = JSON.parse(publicNote)
|
||||
if (!data.billingDataMod && !data.planDataMod) {
|
||||
return null
|
||||
}
|
||||
if (data.billingDataMod && !data.planDataMod) {
|
||||
return {
|
||||
billingDataMod: {
|
||||
startDate: data.billingDataMod.startDate || "",
|
||||
endDate: data.billingDataMod.endDate,
|
||||
autoRenewal: data.billingDataMod.autoRenewal || "",
|
||||
cycle: data.billingDataMod.cycle || "",
|
||||
amount: data.billingDataMod.amount || "",
|
||||
},
|
||||
}
|
||||
}
|
||||
if (!data.billingDataMod && data.planDataMod) {
|
||||
return {
|
||||
planDataMod: {
|
||||
bandwidth: data.planDataMod.bandwidth || "",
|
||||
trafficVol: data.planDataMod.trafficVol || "",
|
||||
trafficType: data.planDataMod.trafficType || "",
|
||||
IPv4: data.planDataMod.IPv4 || "",
|
||||
IPv6: data.planDataMod.IPv6 || "",
|
||||
networkRoute: data.planDataMod.networkRoute || "",
|
||||
extra: data.planDataMod.extra || "",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
billingDataMod: {
|
||||
startDate: data.billingDataMod.startDate || "",
|
||||
|
Loading…
x
Reference in New Issue
Block a user