tengmingxue 1 month ago
parent
commit
7e05885bd6
3 changed files with 15008 additions and 2 deletions
  1. 1 0
      package.json
  2. 25 2
      src/store/modules/user.js
  3. 14982 0
      yarn.lock

+ 1 - 0
package.json

@@ -24,6 +24,7 @@
     "image-conversion": "^2.1.1",
     "jquery": "^3.5.1",
     "js-cookie": "2.2.0",
+    "jsencrypt": "^3.3.2",
     "jspdf": "^2.3.1",
     "krry-transfer": "^1.7.6",
     "mxgraph": "^4.2.2",

+ 25 - 2
src/store/modules/user.js

@@ -2,6 +2,7 @@ import { login, logout } from '@/api/user'
 import { getToken, setToken, removeToken, setSessionStorage, removeSessionStorage } from '@/utils/auth'
 import { imageByName } from '@/api/ftp'
 import { resetRouter } from '@/router'
+import JSEncrypt from 'jsencrypt';
 const sha1Hex = require('sha1-hex')
 
 const getDefaultState = () => {
@@ -17,8 +18,27 @@ const getDefaultState = () => {
   }
 }
 
+const publicKey =
+  "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCzkMQ3VQcbmpKtqKsuI4EByAz2" +
+  "Il3v8eKb9JMv2UuPqyMpzG8HRD5I/Wu6SqlCeDjMy04dzzec2Hx2Z3ChcYvrA3KZ" +
+  "Wqt8z7e6P6XimA5itNAfXGSEam8ST/ZVVYagAWH8eCbyX07itwTNVug9qVdH1Dy/" +
+  "SBsGNYKrx9Vf2x9wrwIDAQAB" //后端公钥
+const priKey =
+  "MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBALOQxDdVBxuakq2o" +
+  "qy4jgQHIDPYiXe/x4pv0ky/ZS4+rIynMbwdEPkj9a7pKqUJ4OMzLTh3PN5zYfHZn" +
+  "cKFxi+sDcplaq3zPt7o/peKYDmK00B9cZIRqbxJP9lVVhqABYfx4JvJfTuK3BM1W" +
+  "6D2pV0fUPL9IGwY1gqvH1V/bH3CvAgMBAAECgYAIo+slJHTCmcX8EDUoc7Hl9YvW" +
+  "HiI6BQAb9AFPGJwfriLzhHBFP73lgjg4TxZk6ecFx7SbD5kD9ZDLm7+aLR4H3IVr" +
+  "mmj3llMuDv/TyhWwan6nxzo7GgFvq1Lxi+vJVLStbITfSwHA0dIPyOo5qzj7wPgQ" +
+  "P+HL/R7Cp/Ga2HNuPQJBAP3YjibIii7uOhoTu20OUF+mXvgH0IhkBq89n6kTqh23" +
+  "yC3qKLqjWauWYg0E9ATEHVWzY+JKxiG27X8waRbosfUCQQC1Ftjs+GuFfTN/piPt" +
+  "jI2MZmlBVRXtxUHgErUykkaAV0TLSf6fbiMTuKY6GPsv3eTOMEkD021Cso4grs3E" +
+  "Jp2TAkA27nPkhKUSfs7n8bkvYleWO0R13AsOWMbxiR5R0kWP5MNW3EMwEEVJUmOp" +
+  "eZbsqRvH/efxgkjZ5uICEhHLuVM5AkAc00Y0clarKQLJjuipJ3ZgouyeOa0D7CJQ" +
+  "SKoPIrmWNE3/Dgg52I481WegV9mkBO4m5Ai7UyxRMZruGOUoE/2BAkB2BwIwZMWL" +
+  "StiV2dtlsqoYclyCzzCIncy2ljGk7Mcg05v2MiTmiH9Y7lA1eSSAyZRAxSl9BkEs" +
+  "RqE98G16GCrt"
 const state = getDefaultState()
-
 const mutations = {
   RESET_STATE: (state) => {
     Object.assign(state, getDefaultState())
@@ -53,9 +73,12 @@ const actions = {
   // user login
   login({ commit, dispatch }, userInfo) {
     const { username, password, verifyCode } = userInfo
+    const encryptor = new JSEncrypt();
+    encryptor.setPublicKey(publicKey);
+    const encryptedUsername = encryptor.encrypt(username);
     // setSessionStorage('username', username)
     return new Promise((resolve, reject) => {
-      login({ 'username': username, 'password': sha1Hex(password), 'verifyCode': verifyCode }).then(response => {
+      login({ 'username': encryptedUsername, 'password': sha1Hex(password), 'verifyCode': verifyCode }).then(response => {
         // console.log('2222', response)
         // const data = {
         //   accessToken: 1111111,

File diff suppressed because it is too large
+ 14982 - 0
yarn.lock