import React, { useEffect, useState } from 'react' import { connect } from 'react-redux'; import { Box, YSIframePlayer } from '$components'; import { Select } from 'antd'; import PerfectScrollbar from "perfect-scrollbar"; import { ArrowDownOutlined, ArrowUpOutlined } from '@ant-design/icons'; import './style.less'; let roadScrollbar let describeScrollbar const DataTop5 = ({ dispatch, actions, longitudeLatitude }) => { const [videoList, setVideoList] = useState([]) const [roadData, setRoadData] = useState({}) const [traffic, setTraffic] = useState({}) let weeks = { 1: '周一', 2: '周二', 3: '周三', 4: '周四', 5: '周五', 6: '周六', 7: '周日' } useEffect(() => { dispatch(actions.firecontrol.getDetails()).then(res => { if (res.success) { setTraffic(res.payload.data?.data?.detail || {}); } }) const dom1 = document.getElementById("road"); if (dom1) { roadScrollbar = new PerfectScrollbar("#road", { suppressScrollX: true, }); } const dom2 = document.getElementById("describe"); if (dom2) { describeScrollbar = new PerfectScrollbar("#describe", { suppressScrollX: true, }); } }, []) useEffect(() => { const dom1 = document.getElementById("road"); if (dom1) { roadScrollbar = new PerfectScrollbar("#road", { suppressScrollX: true, }); } const dom2 = document.getElementById("describe"); if (dom2) { describeScrollbar = new PerfectScrollbar("#describe", { suppressScrollX: true, }); } }, [roadData]) useEffect(() => { const dom1 = document.getElementById("road"); if (dom1 && roadScrollbar) { roadScrollbar.update(); } const dom2 = document.getElementById("describe"); if (dom2 && describeScrollbar) { describeScrollbar.update(); } }) useEffect(() => { if (longitudeLatitude?.latitude && longitudeLatitude?.longitude) { dispatch(actions.firecontrol.getSurroundingConditions({ // center: `30.576279,104.071216` center: `${longitudeLatitude?.latitude},${longitudeLatitude?.longitude}` })).then(res => { if (res.success) { setRoadData(res.payload.data || {}) } }) } }, [longitudeLatitude]) let evaluation = { 0: '未知路况', 1: '畅通', 2: '缓行', 3: '拥堵', 4: '严重拥堵' } let evaluationColor = { 0: 'rgb(151 175 164)', 1: '#00FF87', 2: '#FFCC00', 3: '#DE0102', 4: '#8E0E0B' } let trend = { SAME: '持平', BETTER: '缓解', WORSE: '加重' } return