import MapUtl from "@/components/map/mapUtil";
import { useEffect, useState } from "react";
import { SettingOutlined } from "@ant-design/icons";
import { useNavigate } from "react-router";
const Weather = () => {
  const [wechaer, setWechaer] = useState<any>();
  const navigate = useNavigate();
  useEffect(() => {
    setTimeout(() => {
      MapUtl.wecherInfo?.getLive("双流区", (err, data) => {
        setWechaer(data);
      });
    }, 2000);
  }, []);
  return (
    <div
      style={{
        flex: "1",
        color: "#fff",
        fontSize: "13px",
      }}
    >
      <div
        style={{
          fontSize: "1rem",
          display: "flex",
          justifyContent: "end",
          alignItems: "center",
          marginTop:"5px"
        }}
      >
        <span>天气:{wechaer?.weather}</span>
        <span>风向:{wechaer?.windDirection}</span>
        <div style={{width:"10px"}}></div>
        <span>风级:{wechaer?.windPower}</span>
        <span>湿度:{wechaer?.humidity}</span>
        <div style={{width:"10px"}}></div>
        <SettingOutlined
        onClick={() => {
          navigate("admin/user");
        }}
        style={{ fontSize: "1rem", color: "#f9f9f9", cursor: "pointer" }}
      />
      </div>
     
    </div>
  );
};

export default Weather;
