import React, { useCallback, useEffect, useRef, useState } from "react";
import styles from "./index.module.scss";
import { useDispatch } from "react-redux";
import { A1_APIgetList } from "@/store/action/A1wxuser";
function A1wxuser() {
  const dispatch = useDispatch();

  const [fromData, setFromData] = useState({
    pageNum: 1,
    pageSize: 10,
    searchKey: "",
  });

  const getListFu = useCallback(() => {
    dispatch(A1_APIgetList(fromData));
  }, [dispatch, fromData]);

  useEffect(() => {
    getListFu();
  }, [getListFu]);

  const [inputKey, setInputKey] = useState(1);


    // 标题的输入
    const timeRef = useRef(-1);
    const fromKeyChangeFu = useCallback(
      (e: React.ChangeEvent<HTMLInputElement>, key: "searchKey") => {
        clearTimeout(timeRef.current);
        timeRef.current = window.setTimeout(() => {
          setFromData({ ...fromData, [key]: e.target.value, pageNum: 1 });
        }, 500);
      },
      [fromData]
    );
  
    // 点击重置
    const resetSelectFu = useCallback(() => {
      setInputKey(Date.now());
      setFromData({
        pageNum: 1,
        pageSize: 10,
        searchKey: "",
      });
    }, []);

  return (
    <div className={styles.A1wxuser}>
      <div className="pageTitle">用户管理</div>
    </div>
  );
}

const MemoA1wxuser = React.memo(A1wxuser);

export default MemoA1wxuser;
