From 535c7264b3e809200bee8bc1660c89aaff8b6b44 Mon Sep 17 00:00:00 2001 From: lyp Date: Tue, 11 Mar 2025 14:06:21 +0800 Subject: [PATCH] =?UTF-8?q?head=E6=98=BE=E7=A4=BA=E5=A5=97=E9=A4=90?= =?UTF-8?q?=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/recharge/RechargeHead.tsx | 50 ++--- src/layout/head/Head.tsx | 229 +++++++++++++++-------- src/route/proj/ProjNew.tsx | 44 ++--- 3 files changed, 200 insertions(+), 123 deletions(-) diff --git a/src/components/recharge/RechargeHead.tsx b/src/components/recharge/RechargeHead.tsx index 5139088..e752ec2 100644 --- a/src/components/recharge/RechargeHead.tsx +++ b/src/components/recharge/RechargeHead.tsx @@ -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({ - // messageApi, - // url: `/api/proj/servicepkg/packageorder/count/self`, - // onBefore() { + const getMyPackNum = () => { + get({ + 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() } }; diff --git a/src/layout/head/Head.tsx b/src/layout/head/Head.tsx index 5a80108..fed36ce 100644 --- a/src/layout/head/Head.tsx +++ b/src/layout/head/Head.tsx @@ -1,15 +1,16 @@ import './head.css' // import { NodeJS } from 'types/node'; -import { useDispatch, - // useSelector - } 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, + Dropdown, MenuProps, message, Modal, Space, Spin, Input, Table, // Form, Button, InputNumber - } from "antd"; +} from "antd"; // import type { TableProps, FormProps } from 'antd'; interface DataType { usericId: string; @@ -112,7 +113,7 @@ import PasswordChange from "../../components/password/PasswordChange.tsx"; // import headRightBg from '../../assets/head-right-bg.png'; import InvoiceList from "../../components/invoice/InvoiceList.tsx"; import logoImg from '../../static/head/logo.png' -import userImg from '../../static/homeimg/userimg.png' +// import userImg from '../../static/homeimg/userimg.png' import kf from '../../static/head/kf.png' import kfImg from '../../static/head/kfImg.png' import { reMenuActive } from '../../util/cache'; @@ -127,11 +128,13 @@ import type { } from 'antd'; // import HeadCouponModal from '../../components/CouponModal/HeadCouponModal.tsx' export default function Head() { + const [packloading, setPackloading] = useState(false) const [packList, setPackList] = useState([]) //服务包列表 const [packPage, setPackPage] = useState(1) //服务包分页 const [packTotal, setPackTotal] = useState(0) //服务包总数 + const [packageType, setPackageType] = useState('') // 获取我得服务包信息 - const getPickList = (page: number) => { + const getPickList = (page: number, packageType: string) => { get({ messageApi, @@ -140,10 +143,11 @@ export default function Head() { params: { page: page, rows: 10, + packageType: packageType } }, onBefore() { - + setPackloading(true) }, onSuccess({ data }) { @@ -152,7 +156,7 @@ export default function Head() { }, onFinally() { - + setPackloading(false) } }) } @@ -171,8 +175,51 @@ export default function Head() { // const [selectIc, setSelectIc] = useState('') //选中的邀请码 - // const redxuState: any = useSelector(state => state) - // const packNum = redxuState.packNum + const redxuState: any = useSelector(state => state) + // const [packageType, setPackageType] = useState('') + const packNum = redxuState.packNum + const packItems: MenuProps['items'] = [ + { + key: '1', + label: ( +
{ + setPackageModal(true) + setPackPage(1); + getPickList(1, 'ALL') + setPackageType('ALL') + + }} + > + 全托管 : {packNum.ALL}件 +
+ + ), + }, + { + key: '2', + label: ( +
{ + setPackageModal(true) + setPackPage(1); + getPickList(1, 'MATERIAL') + setPackageType('MATERIAL') + + }} + > + 写材料 : {packNum.MATERIAL}件 +
+ ), + + }, + + + ] // 消息通知弹窗 const [noticeModal, setNoticeModal] = useState(false) // 客服弹窗 @@ -774,32 +821,32 @@ export default function Head() { await reloadUser(messageApi, globalDispatchContext); }; // 我的套餐包统计 - // const getMyPackNum = () => { - // get({ - // messageApi, - // url: `/api/proj/servicepkg/packageorder/count/self`, - // onBefore() { + const getMyPackNum = () => { + get({ + 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() }, []) @@ -905,7 +952,8 @@ export default function Head() { // setCouponModal(true) setPackageModal(true) setPackPage(1); - getPickList(1) + getPickList(1, '') + setPackageType('') } }, @@ -940,6 +988,32 @@ export default function Head() { {/*
*/}
+ +
{ + setkfModal(true) + }}> +
+ +
+
+ 在线客服 +
+ +
+
+ {/*
{ + window.open('https://www.aimzhu.com/operator/route/agreementportal/view?agreementId=c0c5683a-bef3-40c3-8395-900a362ea234&title=系统操作流程') + }}> + +
*/} + {/*
*/} + + {/*
*/} + + + +
+ {/*
{ setPackageModal(true) setPackPage(1); @@ -964,28 +1038,29 @@ export default function Head() {
*/} - {/*
*/} -
{ - setkfModal(true) - }}> -
- -
-
- 在线客服 -
-
-
- {/*
{ - window.open('https://www.aimzhu.com/operator/route/agreementportal/view?agreementId=c0c5683a-bef3-40c3-8395-900a362ea234&title=系统操作流程') - }}> - -
*/} - {/*
*/} - - {/*
*/} - + + +
{ + // setPackageModal(true) + // setPackPage(1); + // getPickList(1,packageType) + + // }} + >套餐包
+ + +
+
{ setinvitationModal(true) @@ -1013,9 +1088,9 @@ export default function Head() { {/**/}
-
+ {/*
-
+
*/} @@ -1161,23 +1236,25 @@ export default function Head() { setPackageModal(false) setPackPage(1); }}> - { - setPackPage(page); - getPickList(page) - // console.log(page); + +
{ + setPackPage(page); + getPickList(page, packageType) + // console.log(page); - } - }} - rowKey="packageOrderId" - /> + } + }} + rowKey="packageOrderId" + /> + {/*
*/} - {/*
+ {/*
我的邀请码
@@ -1229,7 +1306,7 @@ export default function Head() {
*/} - {/*
+ {/*
@@ -1256,8 +1333,8 @@ export default function Head() {
*/} - - {/*
+ + {/*
{icRebateRatio ? @@ -1273,7 +1350,7 @@ export default function Head() {
*/} - + {/*
*/}
diff --git a/src/route/proj/ProjNew.tsx b/src/route/proj/ProjNew.tsx index 69f0a52..97c95cd 100644 --- a/src/route/proj/ProjNew.tsx +++ b/src/route/proj/ProjNew.tsx @@ -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({ - // messageApi, - // url: `/api/proj/servicepkg/packageorder/count/self`, - // onBefore() { + const getMyPackNum = () => { + get({ + 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(null); // 创建一个 ref 来引用推荐列表容器 const recommendListRef = useRef(null); @@ -1094,7 +1094,7 @@ export default function ProjNew() { reloadUser(messageApi, globalDispatchContext).then(() => { messageApi.success('扣款成功'); }); - // getMyPackNum() + getMyPackNum() }, onFinally() { setLoading(false);