This commit is contained in:
lyp 2025-03-07 09:04:36 +08:00
parent 22b6fa4f8f
commit 890ef56f53
3 changed files with 68 additions and 68 deletions

View File

@ -5,43 +5,43 @@ import { useEffect, useState, useContext } from "react";
import { Axios, DevUserId } from "../../util/AjaxUtils.ts";
import { EventSourcePolyfill } from 'event-source-polyfill';
import { GlobalContext, GlobalDispatchContext, reloadUser } from "../../context/GlobalContext.ts";
import {
get,
// import {
// get,
} from "../../util/AjaxUtils.ts";
import { useDispatch } from 'react-redux'
// } from "../../util/AjaxUtils.ts";
// import { useDispatch } from 'react-redux'
type SseMsg = {
msg: string;
type: string;
}
export default function RechargeHead() {
const dispath = useDispatch()
// const dispath = useDispatch()
const [isPaymentModalOpen, setIsPaymentModalOpen] = useState(false);
const globalContext = useContext(GlobalContext);
const globalDispatchContext = useContext(GlobalDispatchContext);
const [messageApi] = message.useMessage();
const getMyPackNum = () => {
get<any>({
messageApi,
url: `/api/proj/servicepkg/packageorder/count/self`,
onBefore() {
// const getMyPackNum = () => {
// get<any>({
// messageApi,
// url: `/api/proj/servicepkg/packageorder/count/self`,
// onBefore() {
},
onSuccess({ data }) {
dispath({
type: 'upPackNum',
val: {
ALL: data.ALL,
MATERIAL: data.MATERIAL,
}
})
},
onFinally() {
// },
// onSuccess({ data }) {
// dispath({
// type: 'upPackNum',
// val: {
// ALL: data.ALL,
// MATERIAL: data.MATERIAL,
// }
// })
// },
// onFinally() {
}
})
}
// }
// })
// }
// sse
const initSse = () => {
let evtSource;
@ -60,7 +60,7 @@ export default function RechargeHead() {
reloadUser(messageApi, globalDispatchContext).then(() => {
setIsPaymentModalOpen(false);
});
getMyPackNum()
// getMyPackNum()
}
};

View File

@ -766,32 +766,32 @@ export default function Head() {
await reloadUser(messageApi, globalDispatchContext);
};
// 我的套餐包统计
const getMyPackNum = () => {
get<any>({
messageApi,
url: `/api/proj/servicepkg/packageorder/count/self`,
onBefore() {
// const getMyPackNum = () => {
// get<any>({
// messageApi,
// url: `/api/proj/servicepkg/packageorder/count/self`,
// onBefore() {
},
onSuccess({ data }) {
// console.log(data);
dispath({
type: 'upPackNum',
val: {
ALL:data.ALL,
MATERIAL:data.MATERIAL,
}
})
},
onFinally() {
// },
// onSuccess({ data }) {
// // console.log(data);
// dispath({
// type: 'upPackNum',
// val: {
// ALL:data.ALL,
// MATERIAL:data.MATERIAL,
// }
// })
// },
// onFinally() {
}
})
}
// }
// })
// }
useEffect(() => {
getUnRead()
setInterval(reloadUserInterval, 5 * 60 * 1000);
getMyPackNum()
// getMyPackNum()
}, [])

View File

@ -44,31 +44,31 @@ interface DataType {
packageOrderId: string;
}
import { useDispatch } from 'react-redux'
// import { useDispatch } from 'react-redux'
export default function ProjNew() {
const dispath = useDispatch()
// const dispath = useDispatch()
// 更新redux的套餐包信息
const getMyPackNum = () => {
get<any>({
messageApi,
url: `/api/proj/servicepkg/packageorder/count/self`,
onBefore() {
// const getMyPackNum = () => {
// get<any>({
// messageApi,
// url: `/api/proj/servicepkg/packageorder/count/self`,
// onBefore() {
},
onSuccess({ data }) {
dispath({
type: 'upPackNum',
val: {
ALL: data.ALL,
MATERIAL: data.MATERIAL,
}
})
},
onFinally() {
// },
// onSuccess({ data }) {
// dispath({
// type: 'upPackNum',
// val: {
// ALL: data.ALL,
// MATERIAL: data.MATERIAL,
// }
// })
// },
// onFinally() {
}
})
}
// }
// })
// }
const [debounceTimer, setDebounceTimer] = useState<any>(null);
// 创建一个 ref 来引用推荐列表容器
const recommendListRef = useRef<HTMLDivElement>(null);
@ -1094,7 +1094,7 @@ export default function ProjNew() {
reloadUser(messageApi, globalDispatchContext).then(() => {
messageApi.success('扣款成功');
});
getMyPackNum()
// getMyPackNum()
},
onFinally() {
setLoading(false);