广州市综治平台前端
xusd
2025-07-01 ca64ad7b8a5acd07cd8386ddc7bfcca558ec3349
fix:优化登录
2 files modified
20 ■■■■ changed files
package.json 2 ●●● patch | view | raw | blame | history
src/views/logAndSign/index.jsx 18 ●●●● patch | view | raw | blame | history
package.json
@@ -18,7 +18,7 @@
    "antd": "^4.19.5",
    "axios": "^0.26.0",
    "craco-less": "^2.0.0",
    "crypto-js": "^4.1.1",
    "crypto-js": "^4.2.0",
    "docx-preview": "^0.3.5",
    "echarts": "^5.4.2",
    "html2canvas": "^1.4.1",
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();