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

View File

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

View File

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