广州市综治平台前端
xusd
2025-07-01 ca64ad7b8a5acd07cd8386ddc7bfcca558ec3349
src/views/logAndSign/index.jsx
@@ -16,10 +16,17 @@
import logo1 from '../../assets/images/logo1.png';
import publicDataStatus from '../../status/publicData';
import SlideTest from '../../components/SlideTest';
import CryptoJS from 'crypto-js';
const { TabPane } = Tabs;
const { Link } = Typography;
// 密码加密函数
function encryptPassword(password) {
  // 等价于 Java 的 DigestUtils.md5DigestAsHex(cipher.getBytes())
  const md5Hash = CryptoJS.MD5(password).toString();
  return md5Hash;
}
// 登录接口
function logInApi(data) {
@@ -82,7 +89,14 @@
      return;
    }
    global.setSpinning(true);
    const res = await logInApi(value);
    // 对密码进行MD5加密
    const encryptedData = {
      ...value,
      cipher: encryptPassword(value.cipher)
    };
    const res = await logInApi(encryptedData);
    if (res.type) {
      message.success('您已登入成功,欢迎回来!');
      $$.clearSessionStorage();