|
@@ -2,14 +2,22 @@ import styles from "./index.module.scss";
|
|
|
|
|
|
import { Input, Button, message } from "antd";
|
|
import { Input, Button, message } from "antd";
|
|
import { UserOutlined, LockOutlined } from "@ant-design/icons";
|
|
import { UserOutlined, LockOutlined } from "@ant-design/icons";
|
|
-import { useState } from "react";
|
|
|
|
|
|
+import { useEffect, useState } from "react";
|
|
import { Base64 } from "js-base64";
|
|
import { Base64 } from "js-base64";
|
|
import encodeStr from "@/utils/pass";
|
|
import encodeStr from "@/utils/pass";
|
|
import { userLoginAPI } from "@/store/action/login";
|
|
import { userLoginAPI } from "@/store/action/login";
|
|
import { setTokenInfo } from "@/utils/storage";
|
|
import { setTokenInfo } from "@/utils/storage";
|
|
import history from "@/utils/history";
|
|
import history from "@/utils/history";
|
|
|
|
+import { useDispatch } from "react-redux";
|
|
|
|
|
|
export default function Login() {
|
|
export default function Login() {
|
|
|
|
+ const dispatch = useDispatch();
|
|
|
|
+
|
|
|
|
+ // 进登录页面把权限的信息初始化,防止登录成功之后进到首页,数据渲染问题
|
|
|
|
+ useEffect(() => {
|
|
|
|
+ dispatch({ type: "login/setAuthPageArr", payload: [] });
|
|
|
|
+ }, [dispatch]);
|
|
|
|
+
|
|
// 账号密码
|
|
// 账号密码
|
|
const [userName, setUserName] = useState("");
|
|
const [userName, setUserName] = useState("");
|
|
const [passWord, setPassWord] = useState("");
|
|
const [passWord, setPassWord] = useState("");
|