This commit is contained in:
宇阳
2025-01-12 20:13:10 +08:00
parent 38f171d727
commit 21805d5d4b
3 changed files with 18 additions and 18 deletions

View File

@@ -27,6 +27,8 @@ export default () => {
const { RangePicker } = DatePicker;
const getArticleList = async () => {
setLoading(true);
try {
const { data } = await getArticleListAPI();
setArticleList(data);
@@ -34,8 +36,6 @@ export default () => {
} catch (error) {
setLoading(false);
}
setLoading(false);
};
const delArticleData = async (id: number) => {
@@ -166,11 +166,10 @@ export default () => {
const { data } = await getArticleListAPI({ query });
setArticleList(data);
setLoading(false)
} catch (error) {
setLoading(false)
}
setLoading(false)
}
const [cateList, setCateList] = useState<Cate[]>([])
@@ -187,7 +186,6 @@ export default () => {
}
useEffect(() => {
setLoading(true);
getArticleList()
getCateList()
getTagList()

View File

@@ -19,17 +19,16 @@ const CatePage = () => {
const [form] = Form.useForm();
const getCateList = async () => {
setLoading(true)
try {
setLoading(true)
const { data } = await getCateListAPI();
data.sort((a, b) => a.order - b.order)
setList(data);
setLoading(false)
} catch (error) {
setLoading(false)
}
setLoading(false)
};
useEffect(() => {
@@ -46,20 +45,19 @@ const CatePage = () => {
};
const editCateData = async (id: number) => {
setIsMethod("edit");
setIsModelOpen(true);
setEditLoading(true)
try {
setIsMethod("edit");
setIsModelOpen(true);
setEditLoading(true)
const { data } = await getCateDataAPI(id);
setIsCateShow(data.type === "cate" ? false : true);
setCate(data);
form.setFieldsValue(data);
setEditLoading(false)
} catch (error) {
setEditLoading(false)
}
setEditLoading(false)
};
const delCateData = async (id: number) => {
@@ -67,8 +65,8 @@ const CatePage = () => {
try {
await delCateDataAPI(id);
message.success('🎉 删除分类成功');
await getCateList();
message.success('🎉 删除分类成功');
} catch (error) {
setLoading(false)
}
@@ -98,11 +96,11 @@ const CatePage = () => {
setIsModelOpen(false);
setIsMethod("create")
})
setBtnLoading(false)
} catch (error) {
setBtnLoading(false)
}
setBtnLoading(false)
};
const closeModel = () => {

View File

@@ -102,6 +102,8 @@ export default () => {
}, []);
const enableOssData = async (id: number) => {
setLoading(true)
try {
await enableOssDataAPI(id);
await getOssList();
@@ -112,6 +114,8 @@ export default () => {
};
const disableOssData = async (id: number) => {
setLoading(true)
try {
await disableOssDataAPI(id);
await getOssList();