fix: parse bigint to number
This commit is contained in:
@@ -20,25 +20,11 @@ import { useLockFn } from "ahooks";
|
|||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { updateProxyProvider } from "tauri-plugin-mihomo-api";
|
||||||
|
|
||||||
import { useAppData } from "@/providers/app-data-provider";
|
import { useAppData } from "@/providers/app-data-provider";
|
||||||
import { showNotice } from "@/services/noticeService";
|
import { showNotice } from "@/services/noticeService";
|
||||||
import parseTraffic from "@/utils/parse-traffic";
|
import parseTraffic from "@/utils/parse-traffic";
|
||||||
import { updateProxyProvider } from "tauri-plugin-mihomo-api";
|
|
||||||
|
|
||||||
// 定义代理提供者类型
|
|
||||||
interface ProxyProviderItem {
|
|
||||||
name?: string;
|
|
||||||
proxies: any[];
|
|
||||||
updatedAt: number;
|
|
||||||
vehicleType: string;
|
|
||||||
subscriptionInfo?: {
|
|
||||||
Upload: number;
|
|
||||||
Download: number;
|
|
||||||
Total: number;
|
|
||||||
Expire: number;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// 样式化组件 - 类型框
|
// 样式化组件 - 类型框
|
||||||
const TypeBox = styled(Box)<{ component?: React.ElementType }>(({ theme }) => ({
|
const TypeBox = styled(Box)<{ component?: React.ElementType }>(({ theme }) => ({
|
||||||
@@ -180,17 +166,17 @@ export const ProviderButton = () => {
|
|||||||
{Object.entries(proxyProviders || {})
|
{Object.entries(proxyProviders || {})
|
||||||
.sort()
|
.sort()
|
||||||
.map(([key, item]) => {
|
.map(([key, item]) => {
|
||||||
const provider = item as ProxyProviderItem;
|
const provider = item;
|
||||||
const time = dayjs(provider.updatedAt);
|
const time = dayjs(provider.updatedAt);
|
||||||
const isUpdating = updating[key];
|
const isUpdating = updating[key];
|
||||||
|
|
||||||
// 订阅信息
|
// 订阅信息
|
||||||
const sub = provider.subscriptionInfo;
|
const sub = provider.subscriptionInfo;
|
||||||
const hasSubInfo = !!sub;
|
const hasSubInfo = !!sub;
|
||||||
const upload = sub?.Upload || 0;
|
const upload = parseInt(sub?.Upload.toString() || "0");
|
||||||
const download = sub?.Download || 0;
|
const download = parseInt(sub?.Download.toString() || "0");
|
||||||
const total = sub?.Total || 0;
|
const total = parseInt(sub?.Total.toString() || "0");
|
||||||
const expire = sub?.Expire || 0;
|
const expire = parseInt(sub?.Expire.toString() || "0");
|
||||||
|
|
||||||
// 流量使用进度
|
// 流量使用进度
|
||||||
const progress =
|
const progress =
|
||||||
|
|||||||
@@ -19,18 +19,10 @@ import { useLockFn } from "ahooks";
|
|||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
import { showNotice } from "@/services/noticeService";
|
|
||||||
import { updateRuleProvider } from "tauri-plugin-mihomo-api";
|
import { updateRuleProvider } from "tauri-plugin-mihomo-api";
|
||||||
import { useAppData } from "@/providers/app-data-provider";
|
|
||||||
|
|
||||||
// 定义规则提供者类型
|
import { useAppData } from "@/providers/app-data-provider";
|
||||||
interface RuleProviderItem {
|
import { showNotice } from "@/services/noticeService";
|
||||||
behavior: string;
|
|
||||||
ruleCount: number;
|
|
||||||
updatedAt: number;
|
|
||||||
vehicleType: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 辅助组件 - 类型框
|
// 辅助组件 - 类型框
|
||||||
const TypeBox = styled(Box)<{ component?: React.ElementType }>(({ theme }) => ({
|
const TypeBox = styled(Box)<{ component?: React.ElementType }>(({ theme }) => ({
|
||||||
@@ -163,7 +155,7 @@ export const ProviderButton = () => {
|
|||||||
{Object.entries(ruleProviders || {})
|
{Object.entries(ruleProviders || {})
|
||||||
.sort()
|
.sort()
|
||||||
.map(([key, item]) => {
|
.map(([key, item]) => {
|
||||||
const provider = item as RuleProviderItem;
|
const provider = item;
|
||||||
const time = dayjs(provider.updatedAt);
|
const time = dayjs(provider.updatedAt);
|
||||||
const isUpdating = updating[key];
|
const isUpdating = updating[key];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user