From 67916c5a9e2d259d76cf2e00ddbebfdc39583fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Sun, 18 Jun 2023 21:56:19 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=20=E7=A7=BB=E9=99=A4md5=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++-- src/store/modules/user.js | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 79679a0..718ba5d 100644 --- a/package.json +++ b/package.json @@ -22,13 +22,13 @@ "@wangeditor/editor-for-vue": "^5.1.11", "axios": "^0.27.2", "countup.js": "^2.1.0", + "crypto-js": "^4.1.1", "echarts": "5.2.2", "element-plus": "^2.3.6", "file-saver": "2.0.5", "fuse.js": "6.4.6", "highlight.js": "^11.5.1", "js-cookie": "3.0.1", - "js-md5": "^0.7.3", "jsencrypt": "3.2.1", "md-editor-v3": "^1.11.11", "nprogress": "0.2.0", @@ -51,4 +51,4 @@ "vite-plugin-svg-icons": "1.0.5", "vite-plugin-vue-setup-extend": "^0.4.0" } -} +} \ No newline at end of file diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 8b04ad1..b215ff6 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,7 +1,9 @@ import { login, logout, getInfo, oauthCallback } from '@/api/system/login' import { getToken, setToken, removeToken } from '@/utils/auth' import defAva from '@/assets/images/profile.jpg' -import md5 from 'js-md5' + +import md5 from 'crypto-js/md5' + const useUserStore = defineStore('user', { state: () => ({ userInfo: '', @@ -21,9 +23,10 @@ const useUserStore = defineStore('user', { // 登录 login(userInfo) { const username = userInfo.username.trim() - const password = md5(userInfo.password) + const password = md5(userInfo.password).toString() const code = userInfo.code const uuid = userInfo.uuid + return new Promise((resolve, reject) => { login(username, password, code, uuid) .then((res) => {