|
@@ -22,35 +22,35 @@ const ExpStatisticCardWidget = ({ studioName }: IWidget) => {
|
|
|
const [termPieData, setTermPieData] = useState<IPieData[]>();
|
|
const [termPieData, setTermPieData] = useState<IPieData[]>();
|
|
|
const [dictCount, setDictCount] = useState<number>();
|
|
const [dictCount, setDictCount] = useState<number>();
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
- get<IUserStatisticResponse>(`/v2/user-statistic/${studioName}`).then(
|
|
|
|
|
- (json) => {
|
|
|
|
|
- if (json.ok) {
|
|
|
|
|
- setExpSum(Math.ceil(json.data.exp.sum / 1000 / 60 / 60));
|
|
|
|
|
- setWbwCount(json.data.wbw.count);
|
|
|
|
|
- setLookupCount(json.data.lookup.count);
|
|
|
|
|
- setTranslationCount(json.data.translation.count);
|
|
|
|
|
- setTranslationPieData([
|
|
|
|
|
- { type: "公开", value: json.data.translation.count_pub },
|
|
|
|
|
- {
|
|
|
|
|
- type: "未公开",
|
|
|
|
|
- value:
|
|
|
|
|
- json.data.translation.count - json.data.translation.count_pub,
|
|
|
|
|
- },
|
|
|
|
|
- ]);
|
|
|
|
|
- setTermCount(json.data.term.count);
|
|
|
|
|
- setTermPieData([
|
|
|
|
|
- { type: "百科", value: json.data.term.count_with_note },
|
|
|
|
|
- {
|
|
|
|
|
- type: "仅术语",
|
|
|
|
|
- value: json.data.term.count - json.data.term.count_with_note,
|
|
|
|
|
- },
|
|
|
|
|
- ]);
|
|
|
|
|
- setDictCount(json.data.dict.count);
|
|
|
|
|
- } else {
|
|
|
|
|
- message.error(json.message);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const url = `/v2/user-statistic/${studioName}`;
|
|
|
|
|
+ console.info("api request", url);
|
|
|
|
|
+ get<IUserStatisticResponse>(url).then((json) => {
|
|
|
|
|
+ if (json.ok) {
|
|
|
|
|
+ setExpSum(Math.ceil(json.data.exp.sum / 1000 / 60 / 60));
|
|
|
|
|
+ setWbwCount(json.data.wbw.count);
|
|
|
|
|
+ setLookupCount(json.data.lookup.count);
|
|
|
|
|
+ setTranslationCount(json.data.translation.count);
|
|
|
|
|
+ setTranslationPieData([
|
|
|
|
|
+ { type: "公开", value: json.data.translation.count_pub },
|
|
|
|
|
+ {
|
|
|
|
|
+ type: "未公开",
|
|
|
|
|
+ value:
|
|
|
|
|
+ json.data.translation.count - json.data.translation.count_pub,
|
|
|
|
|
+ },
|
|
|
|
|
+ ]);
|
|
|
|
|
+ setTermCount(json.data.term.count);
|
|
|
|
|
+ setTermPieData([
|
|
|
|
|
+ { type: "百科", value: json.data.term.count_with_note },
|
|
|
|
|
+ {
|
|
|
|
|
+ type: "仅术语",
|
|
|
|
|
+ value: json.data.term.count - json.data.term.count_with_note,
|
|
|
|
|
+ },
|
|
|
|
|
+ ]);
|
|
|
|
|
+ setDictCount(json.data.dict.count);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ message.error(json.message);
|
|
|
}
|
|
}
|
|
|
- );
|
|
|
|
|
|
|
+ });
|
|
|
}, [studioName]);
|
|
}, [studioName]);
|
|
|
|
|
|
|
|
return (
|
|
return (
|