This commit is contained in:
lyp 2025-08-07 14:55:42 +08:00
parent b11729e67f
commit b3a2c476e2
3 changed files with 18 additions and 5 deletions

View File

@ -159,6 +159,7 @@ import NoticeModal from '../../components/NoticeModal/NoticeModal.tsx';
// import { log } from 'console';
// import HeadCouponModal from '../../components/CouponModal/HeadCouponModal.tsx'
export default function Head() {
const dispath = useDispatch()
@ -420,6 +421,7 @@ export default function Head() {
const packNum = redxuState.packNum
const phoneModal = redxuState.phoneModal
const activityImgShow = redxuState.activityImgShow //是否显示互动图片
const clickActivity = redxuState.clickActivity //是否点击活动按钮
// const activityModal = redxuState.activityModal
// const packItems: MenuProps['items'] = [
// {
@ -867,7 +869,6 @@ export default function Head() {
// },
// ]
const dispath = useDispatch()
// 更新所属者表格储存至redux
const upBelongArray = () => {
get({
@ -1327,7 +1328,7 @@ export default function Head() {
style={{
marginRight: 20,
cursor: 'pointer',
display:activityImgShow ? 'unset' : 'none',
display: activityImgShow ? 'unset' : 'none',
}}
onClick={() => {
// setActivityModal(true)
@ -1335,6 +1336,10 @@ export default function Head() {
type: 'setActivityModal',
val: true,
})
dispath({
type: 'onClickActivity',
val: !clickActivity,
})
}}
>
<img src={active} alt="" height={36} />

View File

@ -295,7 +295,7 @@ export default function Index() {
const phoneModal = redxuState.phoneModal
const activityModal = redxuState.activityModal
const centerPoint = redxuState.centerPoint
const clickActivity = redxuState.clickActivity //是否点击活动按钮
// 动画状态管理----------------------------------------------
const [isClosing, setIsClosing] = useState(false);
const animationDuration = 300; // 动画持续时间(毫秒)
@ -315,6 +315,10 @@ export default function Index() {
type: 'setActivityModal',
val: false,
});
dispath({
type: 'onClickActivity',
val: false,
})
// 当勾选"近期不再提示"时设置cookie
if (activityChecked) {
@ -4799,7 +4803,7 @@ export default function Index() {
</Modal> */}
<div className='couponMask-box'
style={{
display: activityModal && (location.pathname == '/' || location.pathname.includes('/home')) ? 'unset' : 'none',
display: (activityModal && (location.pathname == '/' || location.pathname.includes('/home'))) || clickActivity ? 'unset' : 'none',
zIndex: 98,
// 动画
@ -4814,7 +4818,7 @@ export default function Index() {
position: 'absolute',
// 初始位置:居中显示(保持不变)
top: isClosing ? centerPoint.y : '50%', // 关闭时top直接设为目标点y坐标
left: isClosing ? centerPoint.x - 80 : '50%', // 关闭时left直接设为目标点x坐标
left: isClosing ? centerPoint.x - 50 : '50%', // 关闭时left直接设为目标点x坐标
// 关键用translate(-50%, -50%)确保元素中心点与目标点对齐
transform: isClosing
? 'translate(-50%, -50%) scale(0.1)' // 关闭时:缩放到目标点(中心点对齐)

View File

@ -30,6 +30,7 @@ const baseState = {
replaceTotal: 0,
newReplace: false,
activityModal: false, //活动弹窗
clickActivity: false, //是否点击活动按钮
activityImgShow: true, //活动图片是否展示
// 坐标
centerPoint: { x: 0, y: 0 },
@ -103,6 +104,9 @@ const reducer = (state = baseState, action: any) => {
}
if (action.type == 'setActivityModal') {
nstate.activityModal = action.val
}
if (action.type == 'onClickActivity') {
nstate.clickActivity = action.val
}
if (action.type == 'upCenterPoint') {
nstate.centerPoint = action.val