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 onChange = (e: any) => {
setValue(e.target.value);
getPackageList(e.target.value, packPage);
// getPackageList(e.target.value, packPage);
setPackPage(1);
getPackageList(e.target.value, 1);
// setSelectedRowKeys([]);
};
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 { EventSourcePolyfill } from 'event-source-polyfill';
import { GlobalContext, GlobalDispatchContext, reloadUser } from "../../context/GlobalContext.ts";
import {
get,
} from "../../util/AjaxUtils.ts";
import { useDispatch } from 'react-redux'
type SseMsg = {
msg: string;
type: string;
}
export default function RechargeHead() {
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() {
},
onSuccess({ data }) {
dispath({
type: 'upPackNum',
val: {
ALL: data.ALL,
MATERIAL: data.MATERIAL,
}
})
},
onFinally() {
}
})
}
// sse
const initSse = () => {
let evtSource;
@ -36,6 +60,8 @@ export default function RechargeHead() {
reloadUser(messageApi, globalDispatchContext).then(() => {
setIsPaymentModalOpen(false);
});
getMyPackNum()
}
};
}

View File

@ -1,6 +1,8 @@
import './head.css'
// import { NodeJS } from 'types/node';
import { useDispatch } from 'react-redux'
import { useDispatch,
// useSelector
} from 'react-redux'
import BalanceHead from '../../components/balance/BalanceHead.tsx';
import RechargeHead from '../../components/recharge/RechargeHead.tsx';
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 [selectIc, setSelectIc] = useState('') //选中的邀请码
// const redxuState: any = useSelector(state => state)
// const couponModal = redxuState.couponModal
// const packNum = redxuState.packNum
// 消息通知弹窗
const [noticeModal, setNoticeModal] = useState(false)
// 客服弹窗
@ -763,9 +765,33 @@ export default function Head() {
const reloadUserInterval = async () => {
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(() => {
getUnRead()
setInterval(reloadUserInterval, 5 * 60 * 1000);
getMyPackNum()
}, [])
@ -906,26 +932,27 @@ export default function Head() {
{/* <div className="right" style={{backgroundImage: `url(${headRightBg})`}}> */}
<div className="right">
{/* <div className='kf' onClick={()=>{
{/* <div className='kf' onClick={() => {
setPackageModal(true)
setPackPage(1);
getPickList(1)
}}
>
<div style={{
display: 'flex',
flexDirection: 'column',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
}}>
<div className='kfText '></div>
<div style={{
marginTop:10,
marginTop: 10,
fontWeight: 700,
}}>
<span>全托管:100</span>
<span style={{marginLeft:10}}>写材料:100</span>
<span> : {packNum.ALL}</span>
<span style={{ marginLeft: 15 }}> : {packNum.MATERIAL}</span>
</div>
</div>
</div> */}

View File

@ -44,8 +44,31 @@ interface DataType {
packageOrderId: string;
}
import { useDispatch } from 'react-redux'
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);
// 创建一个 ref 来引用推荐列表容器
const recommendListRef = useRef<HTMLDivElement>(null);
@ -492,7 +515,7 @@ export default function ProjNew() {
<div style={{ position: 'relative' }}>
<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>
name="projName"
rules={[
@ -602,7 +625,7 @@ export default function ProjNew() {
// position: 'relative',
// background: 'pink',
}}>
<span style={{color:'red'}}>*</span>
<span style={{ color: 'red' }}>*</span>
</div>
<Form.Item<ProjInfo>
@ -615,7 +638,7 @@ export default function ProjNew() {
<div style={{
position: 'absolute', right: 20,
// fontSize: 16,
color: " #1F79FF", cursor: 'pointer',
color: " #1F79FF", cursor: 'pointer',
// background:'pink',
width: 290,
textAlign: 'right',
@ -625,7 +648,7 @@ export default function ProjNew() {
</div>
<div className='formItemOne' style={{ position: 'relative' }}>
<div className='formItem-title '>
<span style={{color:'red'}}>*</span>
<span style={{ color: 'red' }}>*</span>
</div>
<Form.Item<ProjInfo>
name="contacts"
@ -637,7 +660,7 @@ export default function ProjNew() {
<div style={{
position: 'absolute', right: 20,
// fontSize: 16,
color: " #1F79FF", cursor: 'pointer',
color: " #1F79FF", cursor: 'pointer',
width: 290,
textAlign: 'right',
@ -651,7 +674,7 @@ export default function ProjNew() {
marginTop: 20
}}>
<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>
name="projVersion"
@ -668,7 +691,7 @@ export default function ProjNew() {
</div>
<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>
name="backendCodeLang"
rules={[
@ -796,7 +819,7 @@ export default function ProjNew() {
style={{
display: selectPack ? 'none' : 'unset', position: 'absolute', right: 23,
// fontSize: 16,
color: packList.length ? '#1F79FF' : '#676767', cursor: 'pointer',
color: packList.length ? '#1F79FF' : '#676767', cursor: 'pointer',
// background:'pink',
width: 290,
textAlign: 'right',
@ -853,7 +876,7 @@ export default function ProjNew() {
<div style={{
display: couponId ? 'none' : 'unset', position: 'absolute', right: 23,
// fontSize: 16,
color: hasCoupon ? '#1F79FF' : '#676767', cursor: 'pointer',
color: hasCoupon ? '#1F79FF' : '#676767', cursor: 'pointer',
width: 290,
textAlign: 'right',
}} onClick={() => {
@ -1071,6 +1094,7 @@ export default function ProjNew() {
reloadUser(messageApi, globalDispatchContext).then(() => {
messageApi.success('扣款成功');
});
getMyPackNum()
},
onFinally() {
setLoading(false);

View File

@ -19,7 +19,11 @@ const baseState = {
projName:'',
projStatus:'',
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') {
nstate.newCorrection = action.val
}
if (action.type == 'upPackNum') {
nstate.packNum = action.val
}
return nstate
}
const store = createStore(reducer)