From c3ada923978c82f5efd55611cf2dd5b94d327806 Mon Sep 17 00:00:00 2001 From: TiaStars Date: Thu, 17 Oct 2024 14:33:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E4=BC=81=E4=B8=9A=E6=91=B8?= =?UTF-8?q?=E5=BA=95=E9=97=AE=E5=8D=B7=E6=A8=A1=E6=9D=BF=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E4=B8=8E=E4=BC=97=E4=B8=8D=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 +- package.json | 2 +- src/views/login.vue | 24 +++- .../onlineDeclaration/template/index.vue | 1 + .../templateDetail/index.vue | 110 +++++++++++++++++- 5 files changed, 133 insertions(+), 8 deletions(-) diff --git a/.env.development b/.env.development index 788e928..5f51fbb 100644 --- a/.env.development +++ b/.env.development @@ -5,9 +5,9 @@ VUE_APP_TITLE = 金鸡湖现代服务业品牌管理系统 ENV = 'development' # 金鸡湖现代服务业品牌管理系统/开发环境 -VUE_APP_BASE_API = 'http://192.168.0.108:9031' +# VUE_APP_BASE_API = 'http://192.168.0.108:9031' # 测试环境数据库 -# VUE_APP_BASE_API = 'http://39.101.188.84:9040' +VUE_APP_BASE_API = 'http://39.101.188.84:9040' # 脱敏三方测试用数据库 # VUE_APP_BASE_API = 'http://39.101.188.84:9031' # 正式环境数据库 diff --git a/package.json b/package.json index 224e9b4..870bc9a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ruoyi", - "version": "1.0.202410120906", + "version": "1.0.202410171335", "description": "金鸡湖现代服务业品牌管理系统", "author": "若依", "license": "MIT", diff --git a/src/views/login.vue b/src/views/login.vue index ff20264..317e720 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -129,6 +129,7 @@ import { getCodeImg } from "@/api/login"; import Cookies from "js-cookie"; import { encrypt, decrypt } from "@/utils/jsencrypt"; +import forge from 'node-forge' export default { name: "Login", @@ -158,6 +159,7 @@ export default { register: false, redirect: undefined, userType:"01", + publicKey:`MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl8bS1kYTiMhIS5MZU253bc0ukaxrA1lfCziABFxQrC2c09tMrQGjuH6V1x2ofNBMGhOD9uWN/qkAQy/HwOe/NKUqCw6N0ov6guSrqMDW/BdZ3Bl0rmM1/95jTC1xffFFvej7xWNffIbaPI+bJ4WLX9NViNi9HmT0BRNzJ4d2R86LPPCa+bxLaPjsh2R2tBkbLkUot9769aJaPPiwPCZHMkuQenjHSmpWL0okleqMH8EGX7j6A5A/4IUXPMNKMMzkiSRpsIJ65GJmDAbnR3ZXRfC8MzVBBJB6zr5N0F4N9xZfF+JS/Yx726tCu+rA6GDCyTxtQ/wnKpPdwFP5nUWCWQIDAQAB` }; }, watch: { @@ -216,8 +218,28 @@ export default { Cookies.remove("mima"); Cookies.remove("rememberMe"); } + // 生成一个 2048 位的 RSA 密钥对 + const lines = []; + lines.push('-----BEGIN PUBLIC KEY-----'); + for (let i = 0; i < this.publicKey.length; i += 64) { + lines.push(this.publicKey.slice(i, i + 64)); + } + lines.push('-----END PUBLIC KEY-----'); + lines.join('\n') + const publicKey = forge.pki.publicKeyFromPem(lines.join('\n')); + // 将待加密的字符串转换为字节数组 + var dataBytes = forge.util.encodeUtf8(this.loginForm.mima); + // 加密数据 + var encryptedBytes = publicKey.encrypt(dataBytes, 'RSA-OAEP', { + md: forge.md.sha256.create(), + mgf1: { + md: forge.md.sha1.create() + } + }); + // 将加密后的字节数组转换为 Base64 编码的字符串 + var encryptedBase64 = forge.util.encode64(encryptedBytes); this.$store - .dispatch("Login", {...this.loginForm,userType:this.userType, password: encrypt(this.loginForm.mima)}) + .dispatch("Login", {...this.loginForm,userType:this.userType, password: encryptedBase64}) .then(() => { this.$router.push({ path: this.redirect || "/" }).catch(() => {}); }) diff --git a/src/views/onlineDeclaration/template/index.vue b/src/views/onlineDeclaration/template/index.vue index dd993ad..d254a3a 100644 --- a/src/views/onlineDeclaration/template/index.vue +++ b/src/views/onlineDeclaration/template/index.vue @@ -361,6 +361,7 @@ export default { this.$router.push({name: 'onlineDeclareDetail',query: { templateId: row.id, pageType: "template", + projectSmallType: row.projectSmallType }}) }, /** 导出按钮操作 */ diff --git a/src/views/onlineDeclaration/templateDetail/index.vue b/src/views/onlineDeclaration/templateDetail/index.vue index f3ca6cd..135e730 100644 --- a/src/views/onlineDeclaration/templateDetail/index.vue +++ b/src/views/onlineDeclaration/templateDetail/index.vue @@ -63,8 +63,8 @@ -
- +
+