mirror of
https://github.com/PlayEdu/backend
synced 2025-07-19 19:19:43 +08:00
fixed: 资源分类的数量
This commit is contained in:
parent
45321a5918
commit
fc90ddf2cc
@ -1,4 +1,4 @@
|
|||||||
import { Button, Input, message, Tree } from "antd";
|
import { Tree } from "antd";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { resourceCategory } from "../../api/index";
|
import { resourceCategory } from "../../api/index";
|
||||||
|
|
||||||
@ -11,6 +11,7 @@ interface Option {
|
|||||||
interface PropInterface {
|
interface PropInterface {
|
||||||
text: string;
|
text: string;
|
||||||
categoryCount: any;
|
categoryCount: any;
|
||||||
|
resourceTotal: number;
|
||||||
onUpdate: (keys: any, title: any) => void;
|
onUpdate: (keys: any, title: any) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,9 +97,7 @@ export const TreeCategory = (props: PropInterface) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
全部{props.text}
|
全部{props.text}
|
||||||
{JSON.stringify(props.categoryCount) !== "{}" && (
|
<span className="tree-num">({props.resourceTotal})</span>
|
||||||
<span className="tree-num">({props.categoryCount["0"]})</span>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<Tree
|
<Tree
|
||||||
onSelect={onSelect}
|
onSelect={onSelect}
|
||||||
|
@ -98,6 +98,7 @@ export const UploadImageButton = (props: PropsInterface) => {
|
|||||||
<Row gutter={16}>
|
<Row gutter={16}>
|
||||||
<Col span={4}>
|
<Col span={4}>
|
||||||
<TreeCategory
|
<TreeCategory
|
||||||
|
resourceTotal={0}
|
||||||
categoryCount={{}}
|
categoryCount={{}}
|
||||||
text={"图片"}
|
text={"图片"}
|
||||||
onUpdate={(keys: any) => setCategoryIds(keys)}
|
onUpdate={(keys: any) => setCategoryIds(keys)}
|
||||||
|
@ -45,6 +45,7 @@ export const CoursePage = () => {
|
|||||||
const [dep_ids, setDepIds] = useState<any>([]);
|
const [dep_ids, setDepIds] = useState<any>([]);
|
||||||
const [selLabel, setLabel] = useState<string>("全部课程");
|
const [selLabel, setLabel] = useState<string>("全部课程");
|
||||||
const [categoryCount, setCategoryCount] = useState<any>({});
|
const [categoryCount, setCategoryCount] = useState<any>({});
|
||||||
|
const [pureTotal, setPureTotal] = useState(0);
|
||||||
|
|
||||||
const items: TabsProps["items"] = [
|
const items: TabsProps["items"] = [
|
||||||
{
|
{
|
||||||
@ -53,6 +54,7 @@ export const CoursePage = () => {
|
|||||||
children: (
|
children: (
|
||||||
<div className="float-left">
|
<div className="float-left">
|
||||||
<TreeCategory
|
<TreeCategory
|
||||||
|
resourceTotal={pureTotal}
|
||||||
text={"课程"}
|
text={"课程"}
|
||||||
categoryCount={categoryCount}
|
categoryCount={categoryCount}
|
||||||
onUpdate={(keys: any, title: any) => {
|
onUpdate={(keys: any, title: any) => {
|
||||||
@ -179,6 +181,7 @@ export const CoursePage = () => {
|
|||||||
setTotal(res.data.total);
|
setTotal(res.data.total);
|
||||||
setList(res.data.data);
|
setList(res.data.data);
|
||||||
setCategoryCount(res.data.category_count);
|
setCategoryCount(res.data.category_count);
|
||||||
|
setPureTotal(res.data.pure_total);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
})
|
})
|
||||||
.catch((err: any) => {
|
.catch((err: any) => {
|
||||||
|
@ -44,6 +44,7 @@ export const ResourceImagesPage = () => {
|
|||||||
const [selLabel, setLabel] = useState<string>("全部图片");
|
const [selLabel, setLabel] = useState<string>("全部图片");
|
||||||
const [loading, setLoading] = useState<boolean>(false);
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
const [categoryCount, setCategoryCount] = useState<any>({});
|
const [categoryCount, setCategoryCount] = useState<any>({});
|
||||||
|
const [pureTotal, setPureTotal] = useState(0);
|
||||||
|
|
||||||
// 删除图片
|
// 删除图片
|
||||||
const removeResource = () => {
|
const removeResource = () => {
|
||||||
@ -89,6 +90,7 @@ export const ResourceImagesPage = () => {
|
|||||||
setVisibleArr(arr);
|
setVisibleArr(arr);
|
||||||
setHoverArr(arr);
|
setHoverArr(arr);
|
||||||
setCategoryCount(res.data.category_count);
|
setCategoryCount(res.data.category_count);
|
||||||
|
setPureTotal(res.data.pure_total);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
})
|
})
|
||||||
.catch((err: any) => {
|
.catch((err: any) => {
|
||||||
@ -154,6 +156,7 @@ export const ResourceImagesPage = () => {
|
|||||||
<TreeCategory
|
<TreeCategory
|
||||||
text={"图片"}
|
text={"图片"}
|
||||||
categoryCount={categoryCount}
|
categoryCount={categoryCount}
|
||||||
|
resourceTotal={pureTotal}
|
||||||
onUpdate={(keys: any, title: any) => {
|
onUpdate={(keys: any, title: any) => {
|
||||||
setCategoryIds(keys);
|
setCategoryIds(keys);
|
||||||
if (typeof title == "string") {
|
if (typeof title == "string") {
|
||||||
|
@ -30,6 +30,7 @@ export const ResourceVideosPage = () => {
|
|||||||
const [category_ids, setCategoryIds] = useState<any>([]);
|
const [category_ids, setCategoryIds] = useState<any>([]);
|
||||||
const [selLabel, setLabel] = useState<string>("全部视频");
|
const [selLabel, setLabel] = useState<string>("全部视频");
|
||||||
const [categoryCount, setCategoryCount] = useState<any>({});
|
const [categoryCount, setCategoryCount] = useState<any>({});
|
||||||
|
const [pureTotal, setPureTotal] = useState(0);
|
||||||
|
|
||||||
const columns: ColumnsType<DataType> = [
|
const columns: ColumnsType<DataType> = [
|
||||||
// {
|
// {
|
||||||
@ -129,6 +130,7 @@ export const ResourceVideosPage = () => {
|
|||||||
setVideoExtra(res.data.videos_extra);
|
setVideoExtra(res.data.videos_extra);
|
||||||
setAdminUsers(res.data.admin_users);
|
setAdminUsers(res.data.admin_users);
|
||||||
setCategoryCount(res.data.category_count);
|
setCategoryCount(res.data.category_count);
|
||||||
|
setPureTotal(res.data.pure_total);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
})
|
})
|
||||||
.catch((err: any) => {
|
.catch((err: any) => {
|
||||||
@ -167,6 +169,7 @@ export const ResourceVideosPage = () => {
|
|||||||
<div className="tree-main-body">
|
<div className="tree-main-body">
|
||||||
<div className="left-box">
|
<div className="left-box">
|
||||||
<TreeCategory
|
<TreeCategory
|
||||||
|
resourceTotal={pureTotal}
|
||||||
text={"视频"}
|
text={"视频"}
|
||||||
categoryCount={categoryCount}
|
categoryCount={categoryCount}
|
||||||
onUpdate={(keys: any, title: any) => {
|
onUpdate={(keys: any, title: any) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user