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 [leftShow, setLeftShow] = useState(false) const [rightShow, setRightShow] = useState(false) const [isPass, setIsPass] = useState(false) // 容器是否大于内容宽度 const [queryForm, setQueryForm] = useState({}) const [totalData, setTotalData] = useState({}) /* ==================== */ const getAllSurveyTotalData = useAjax((params) => getAllSurveyTotalDataApi(params)) // 处理左右按钮隐藏 显示 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 >= 1960) { // 容器大于内容宽度 兼容 setLeftShow(false) setRightShow(false) setIsPass(true) } else { setIsPass(false) if (left === 0) { setLeftShow(false) } else { setLeftShow(true) } if (width < 1960) { setRightShow(true) } if (width + left === 1960) { setRightShow(false) } } } else { setLeftShow(false) setRightShow(false) } }, [isHovering, isHovering1, isHovering2, size, scroll]) // 左右移动 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]) 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 }) }} isAccountId isGameId isSysUserId isAgentId isBeginDay />
玩家
总计:
昨日:
今日:
消耗
总计:
昨日:
今日:
充值
总计:
昨账:
昨新:
今账:
今新:
渠道
总计:
昨日:
今日:
游戏
总计:
昨日:
今日:
回本
总回:
首日:
7天:
30天:
} export default AllSurvey