🐛 web缺失函数
This commit is contained in:
parent
5a8fef00e5
commit
89e6b9fe33
@ -140,6 +140,15 @@ export function renderQuota(quota, digits = 2) {
|
||||
return renderNumber(quota);
|
||||
}
|
||||
|
||||
export const verifyJSON = (str) => {
|
||||
try {
|
||||
JSON.parse(str);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
export function renderNumber(num) {
|
||||
if (num >= 1000000000) {
|
||||
return (num / 1000000000).toFixed(1) + 'B';
|
||||
|
@ -2,7 +2,7 @@ require('dayjs/locale/zh-cn');
|
||||
import { useState, useEffect } from 'react';
|
||||
import SubCard from 'ui-component/cards/SubCard';
|
||||
import { Stack, FormControl, InputLabel, OutlinedInput, Checkbox, Button, FormControlLabel, TextField } from '@mui/material';
|
||||
import { showSuccess, showError } from 'utils/common';
|
||||
import { showSuccess, showError, verifyJSON } from 'utils/common';
|
||||
import { API } from 'utils/api';
|
||||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
||||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
||||
|
Loading…
Reference in New Issue
Block a user