import { AccountBookOutlined, AppstoreOutlined, BuildOutlined, LeftOutlined, MoneyCollectOutlined, RightOutlined, TransactionOutlined, UsergroupAddOutlined } from "@ant-design/icons"; import { useHover, useScroll, useSize } from "ahooks"; import { Button, Card, Space, Spin, Statistic } from "antd" import React, { useEffect, useRef, useState } from "react" import style from './index.less' import LineC from "./lineC"; import { AllSurveyTotalDataProps, getAllSurveyTotalDataApi } from "@/services/gameData/allSurvey"; import { useAjax } from "@/Hook/useAjax"; import QueryForm from "@/components/QueryForm"; import moment from "moment"; const AllSurvey: React.FC = () => { /* ==================== */ const ref = useRef(null); const ref1 = useRef(null); const ref2 = useRef(null); const ref3 = useRef(null); const isHovering = useHover(ref); // 是否hover const isHovering1 = useHover(ref1); // 是否hover const isHovering2 = useHover(ref2); // 是否hover const size = useSize(ref); // div大小 const size3 = useSize(ref3); // div大小 const scroll = useScroll(ref); const [scrollDivWidth, setScrollDivWidth] = useState(2000) const [badWidth, setBadWidth] = useState(0) const [leftShow, setLeftShow] = useState(false) const [rightShow, setRightShow] = useState(false) const [queryForm, setQueryForm] = useState({ sourceSystem: 'ZX_ONE' }) const [totalData, setTotalData] = useState({}) /* ==================== */ const getAllSurveyTotalData = useAjax((params) => getAllSurveyTotalDataApi(params)) useEffect(() => { if (size?.width) { let buguWidth = 0 if (queryForm?.sourceSystem && (queryForm?.sourceSystem === 'BG_OLD' || queryForm?.sourceSystem === 'BG_NEW')) { buguWidth = 200 } let width = 2042 let b = 6 if (queryForm?.gameId) { b = 5 width = 1712 } else { b = 6 width = 2042 } let w = size?.width || 0 if (w > width) { let badW = w - width width = w setBadWidth(badW / b) } setScrollDivWidth(width + buguWidth) } }, [queryForm?.gameId, size, queryForm?.sourceSystem]) // 处理左右按钮隐藏 显示 useEffect(() => { // console.log('isHovering---->', isHovering, 'size---->', size, 'scroll--->', scroll); if (isHovering || isHovering1 || isHovering2) { let width = size.width || 0 let left = scroll.left || 0 if (width >= scrollDivWidth) { // 容器大于内容宽度 兼容 setLeftShow(false) setRightShow(false) } else { if (left === 0) { setLeftShow(false) } else { setLeftShow(true) } if (width < scrollDivWidth) { setRightShow(true) } if (width + left === scrollDivWidth) { setRightShow(false) } } } else { setLeftShow(false) setRightShow(false) } }, [isHovering, isHovering1, isHovering2, size, scroll, ref, scrollDivWidth]) // 左右移动 const aboutHandle = (about: 'left' | 'right') => { let left = scroll.left || 0 if (about === 'left') { (ref?.current as any)?.scrollTo(left - 100, 0) } else { (ref?.current as any)?.scrollTo(left + 100, 0) } } useEffect(() => { getAllSurveyTotalData.run(queryForm).then((res) => { setTotalData(res) }) }, [queryForm]) const isBg = () => { return queryForm?.sourceSystem && (queryForm?.sourceSystem === 'BG_OLD' || queryForm?.sourceSystem === 'BG_NEW') } return
{ console.log(data) const { beginDay, ...par } = data let newQueryForm = JSON.parse(JSON.stringify(queryForm)) if (beginDay && beginDay?.length === 2) { newQueryForm['beginDate'] = moment(beginDay[0]).format('YYYY-MM-DD') newQueryForm['endDate'] = moment(beginDay[1]).format('YYYY-MM-DD') } else { delete newQueryForm['beginDate'] delete newQueryForm['endDate'] } setQueryForm({ ...newQueryForm, ...par }) }} isSource isAccountId isGameId isSysUserId isAgentId />
玩家
总计:
昨日:
今日:
消耗
总计:
昨日:
今日:
充值
总计:
昨账:
昨新:
{isBg() &&
BG自累充:
}
今账:
今新:
{isBg() &&
BG自今账:
}
{isBg() &&
BG自昨账:
}
渠道
总计:
昨日:
今日:
{!queryForm?.gameId &&
游戏
总投游戏数:
昨日在投:
今日在投:
}
回本
总回:
首日:
今日:
{/*
近7天:
近30天:
*/}
} export default AllSurvey