This commit is contained in:
lyp 2025-03-07 08:45:05 +08:00
parent 01e0891fa8
commit 22b6fa4f8f
5 changed files with 111 additions and 25 deletions

View File

@ -97,7 +97,9 @@ export default function Payment(props: IPaymentProps) {
const [value, setValue] = useState('MATERIAL');//单选 服务包类型 const [value, setValue] = useState('MATERIAL');//单选 服务包类型
const onChange = (e: any) => { const onChange = (e: any) => {
setValue(e.target.value); setValue(e.target.value);
getPackageList(e.target.value, packPage); // getPackageList(e.target.value, packPage);
setPackPage(1);
getPackageList(e.target.value, 1);
// setSelectedRowKeys([]); // setSelectedRowKeys([]);
}; };
const [packList, setPackList] = useState<any[]>([]); const [packList, setPackList] = useState<any[]>([]);

View File

@ -5,19 +5,43 @@ import { useEffect, useState, useContext } from "react";
import { Axios, DevUserId } from "../../util/AjaxUtils.ts"; import { Axios, DevUserId } from "../../util/AjaxUtils.ts";
import { EventSourcePolyfill } from 'event-source-polyfill'; import { EventSourcePolyfill } from 'event-source-polyfill';
import { GlobalContext, GlobalDispatchContext, reloadUser } from "../../context/GlobalContext.ts"; import { GlobalContext, GlobalDispatchContext, reloadUser } from "../../context/GlobalContext.ts";
import {
get,
} from "../../util/AjaxUtils.ts";
import { useDispatch } from 'react-redux'
type SseMsg = { type SseMsg = {
msg: string; msg: string;
type: string; type: string;
} }
export default function RechargeHead() { export default function RechargeHead() {
const dispath = useDispatch()
const [isPaymentModalOpen, setIsPaymentModalOpen] = useState(false); const [isPaymentModalOpen, setIsPaymentModalOpen] = useState(false);
const globalContext = useContext(GlobalContext); const globalContext = useContext(GlobalContext);
const globalDispatchContext = useContext(GlobalDispatchContext); const globalDispatchContext = useContext(GlobalDispatchContext);
const [messageApi] = message.useMessage(); const [messageApi] = message.useMessage();
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() {
}
})
}
// sse // sse
const initSse = () => { const initSse = () => {
let evtSource; let evtSource;
@ -36,6 +60,8 @@ export default function RechargeHead() {
reloadUser(messageApi, globalDispatchContext).then(() => { reloadUser(messageApi, globalDispatchContext).then(() => {
setIsPaymentModalOpen(false); setIsPaymentModalOpen(false);
}); });
getMyPackNum()
} }
}; };
} }

View File

@ -1,6 +1,8 @@
import './head.css' import './head.css'
// import { NodeJS } from 'types/node'; // import { NodeJS } from 'types/node';
import { useDispatch } from 'react-redux' import { useDispatch,
// useSelector
} from 'react-redux'
import BalanceHead from '../../components/balance/BalanceHead.tsx'; import BalanceHead from '../../components/balance/BalanceHead.tsx';
import RechargeHead from '../../components/recharge/RechargeHead.tsx'; import RechargeHead from '../../components/recharge/RechargeHead.tsx';
import { Empty, Dropdown, MenuProps, message, Modal, Space, Spin, Input, Table, Form, Button, InputNumber } from "antd"; import { Empty, Dropdown, MenuProps, message, Modal, Space, Spin, Input, Table, Form, Button, InputNumber } from "antd";
@ -162,7 +164,7 @@ export default function Head() {
const [icModal, setIcModal] = useState(false) //查看邀请码详情弹窗 const [icModal, setIcModal] = useState(false) //查看邀请码详情弹窗
const [selectIc, setSelectIc] = useState('') //选中的邀请码 const [selectIc, setSelectIc] = useState('') //选中的邀请码
// const redxuState: any = useSelector(state => state) // const redxuState: any = useSelector(state => state)
// const couponModal = redxuState.couponModal // const packNum = redxuState.packNum
// 消息通知弹窗 // 消息通知弹窗
const [noticeModal, setNoticeModal] = useState(false) const [noticeModal, setNoticeModal] = useState(false)
// 客服弹窗 // 客服弹窗
@ -763,9 +765,33 @@ export default function Head() {
const reloadUserInterval = async () => { const reloadUserInterval = async () => {
await reloadUser(messageApi, globalDispatchContext); await reloadUser(messageApi, globalDispatchContext);
}; };
// 我的套餐包统计
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() {
}
})
}
useEffect(() => { useEffect(() => {
getUnRead() getUnRead()
setInterval(reloadUserInterval, 5 * 60 * 1000); setInterval(reloadUserInterval, 5 * 60 * 1000);
getMyPackNum()
}, []) }, [])
@ -906,10 +932,11 @@ export default function Head() {
{/* <div className="right" style={{backgroundImage: `url(${headRightBg})`}}> */} {/* <div className="right" style={{backgroundImage: `url(${headRightBg})`}}> */}
<div className="right"> <div className="right">
{/* <div className='kf' onClick={()=>{ {/* <div className='kf' onClick={() => {
setPackageModal(true) setPackageModal(true)
setPackPage(1); setPackPage(1);
getPickList(1) getPickList(1)
}} }}
> >
<div style={{ <div style={{
@ -921,11 +948,11 @@ export default function Head() {
}}> }}>
<div className='kfText '></div> <div className='kfText '></div>
<div style={{ <div style={{
marginTop:10, marginTop: 10,
fontWeight: 700, fontWeight: 700,
}}> }}>
<span>全托管:100</span> <span> : {packNum.ALL}</span>
<span style={{marginLeft:10}}>写材料:100</span> <span style={{ marginLeft: 15 }}> : {packNum.MATERIAL}</span>
</div> </div>
</div> </div>
</div> */} </div> */}

View File

@ -44,8 +44,31 @@ interface DataType {
packageOrderId: string; packageOrderId: string;
} }
import { useDispatch } from 'react-redux'
export default function ProjNew() { export default function ProjNew() {
const dispath = useDispatch()
// 更新redux的套餐包信息
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() {
}
})
}
const [debounceTimer, setDebounceTimer] = useState<any>(null); const [debounceTimer, setDebounceTimer] = useState<any>(null);
// 创建一个 ref 来引用推荐列表容器 // 创建一个 ref 来引用推荐列表容器
const recommendListRef = useRef<HTMLDivElement>(null); const recommendListRef = useRef<HTMLDivElement>(null);
@ -492,7 +515,7 @@ export default function ProjNew() {
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<div className='formItemOne'> <div className='formItemOne'>
<div className='formItem-title oneTitle'><span style={{color:'red'}}>*</span></div> <div className='formItem-title oneTitle'><span style={{ color: 'red' }}>*</span></div>
<Form.Item<ProjInfo> <Form.Item<ProjInfo>
name="projName" name="projName"
rules={[ rules={[
@ -602,7 +625,7 @@ export default function ProjNew() {
// position: 'relative', // position: 'relative',
// background: 'pink', // background: 'pink',
}}> }}>
<span style={{color:'red'}}>*</span> <span style={{ color: 'red' }}>*</span>
</div> </div>
<Form.Item<ProjInfo> <Form.Item<ProjInfo>
@ -625,7 +648,7 @@ export default function ProjNew() {
</div> </div>
<div className='formItemOne' style={{ position: 'relative' }}> <div className='formItemOne' style={{ position: 'relative' }}>
<div className='formItem-title '> <div className='formItem-title '>
<span style={{color:'red'}}>*</span> <span style={{ color: 'red' }}>*</span>
</div> </div>
<Form.Item<ProjInfo> <Form.Item<ProjInfo>
name="contacts" name="contacts"
@ -651,7 +674,7 @@ export default function ProjNew() {
marginTop: 20 marginTop: 20
}}> }}>
<div className='formItemOne' style={{}}> <div className='formItemOne' style={{}}>
<div className='formItem-title oneTitle'><span style={{color:'red'}}>*</span></div> <div className='formItem-title oneTitle'><span style={{ color: 'red' }}>*</span></div>
<Form.Item<ProjInfo> <Form.Item<ProjInfo>
name="projVersion" name="projVersion"
@ -668,7 +691,7 @@ export default function ProjNew() {
</div> </div>
<div className='formItemOne' style={{}}> <div className='formItemOne' style={{}}>
<div className='formItem-title oneTitle'><span style={{color:'red'}}>*</span></div> <div className='formItem-title oneTitle'><span style={{ color: 'red' }}>*</span></div>
<Form.Item<ProjInfo> <Form.Item<ProjInfo>
name="backendCodeLang" name="backendCodeLang"
rules={[ rules={[
@ -1071,6 +1094,7 @@ export default function ProjNew() {
reloadUser(messageApi, globalDispatchContext).then(() => { reloadUser(messageApi, globalDispatchContext).then(() => {
messageApi.success('扣款成功'); messageApi.success('扣款成功');
}); });
getMyPackNum()
}, },
onFinally() { onFinally() {
setLoading(false); setLoading(false);

View File

@ -19,7 +19,11 @@ const baseState = {
projName:'', projName:'',
projStatus:'', projStatus:'',
newRefun:false, newRefun:false,
newCorrection:false newCorrection:false,
packNum:{
ALL:0,
MATERIAL:0,
}
} }
// 创建仓库 // 创建仓库
@ -70,6 +74,9 @@ const reducer = (state = baseState, action: any) => {
if (action.type == 'newCorrection') { if (action.type == 'newCorrection') {
nstate.newCorrection = action.val nstate.newCorrection = action.val
} }
if (action.type == 'upPackNum') {
nstate.packNum = action.val
}
return nstate return nstate
} }
const store = createStore(reducer) const store = createStore(reducer)