From 155bc1e5c6c849635df21f158d7ff304e954e052 Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Sun, 28 Sep 2025 13:23:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E8=A7=A3=E5=AF=86=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/filesTransfer/record.js | 67 +------------------------------- src/api/system/setting.js | 11 ++++++ src/assets/styles/variables.scss | 2 +- src/layout/components/Navbar.vue | 1 + src/main.js | 3 +- src/utils/request.js | 35 +++++++++++++---- src/utils/systemConfig.js | 10 +++++ src/views/login.vue | 9 ++++- 8 files changed, 60 insertions(+), 78 deletions(-) create mode 100644 src/utils/systemConfig.js diff --git a/src/api/filesTransfer/record.js b/src/api/filesTransfer/record.js index 0637887..0a0b19a 100644 --- a/src/api/filesTransfer/record.js +++ b/src/api/filesTransfer/record.js @@ -1,9 +1,9 @@ import request from '@/utils/request' // 档案移交申请列表 -export function getTransferApplyListApi(params) { +export function getTransferRecordListApi(params) { return request({ - url: '/smartArchives/transferApply/getTransferApplyList', + url: '/smartArchives/transferRecord/getTransferRecordList', method: 'GET', params: params, }) @@ -17,66 +17,3 @@ export function saveTransferApplyApi(data) { data }) } - -// 编辑档案移交申请 -export function editTransferApplyApi(data) { - return request({ - url: '/smartArchives/transferApply/editTransferApply', - method: 'POST', - data - }) -} - -// 档案移交申请详情 -export function getTransferApplyApi(params) { - return request({ - url: '/smartArchives/transferApply/getTransferApply', - method: 'GET', - params: params - }) -} - -// 档案移交申请-列表详情 -export function getTransferApplyFilesByApplyIdApi(params) { - return request({ - url: '/smartArchives/transferApply/getTransferApplyFilesByApplyId', - method: 'GET', - params: params - }) -} - -// 删除档案移交申请 -export function delTransferApplyApi(data) { - return request({ - url: '/smartArchives/transferApply/delTransferApply', - method: 'POST', - data - }) -} - -// 已移交确认工程下拉选 -export async function getProSelectApi(data) { - return await request({ - url: '/smartArchives/transferApply/getProSelect', - method: 'GET', - data - }) -} - -// 获取档案目录树 -export function getFileManageTreeApi(params) { - return request({ - url: '/smartArchives/fileManage/getFileManageTree', - method: 'get', - params:params, - }) -} - -// 获取移交档案文件 -export function getTransferApplyFilesApi(params) { - return request({ - url: '/smartArchives/transferApply/getTransferApplyFiles', - method: 'get', - params:params, - }) -} \ No newline at end of file diff --git a/src/api/system/setting.js b/src/api/system/setting.js index 2ffc98c..a6bdf1c 100644 --- a/src/api/system/setting.js +++ b/src/api/system/setting.js @@ -35,3 +35,14 @@ export function getListAPI(data) { params: data, }) } + +export function getNoAuthConfig(data) { + return request({ + url: '/smartArchives/sys/config/getConfig', + method: 'GET', + params: data, + headers: { + skipReplayProtection: true + }, + }) +} diff --git a/src/assets/styles/variables.scss b/src/assets/styles/variables.scss index b007531..8c2358c 100644 --- a/src/assets/styles/variables.scss +++ b/src/assets/styles/variables.scss @@ -36,7 +36,7 @@ $base-sub-menu-background:#000c17; $base-sub-menu-hover:#001528; */ -$base-sidebar-width: 320px; +$base-sidebar-width: 300px; // the :export directive is the magic sauce for webpack // https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 848c5c8..5b98cfb 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -103,6 +103,7 @@ export default { }).then(() => { this.$store.dispatch('LogOut').then(() => { location.href = process.env.VUE_APP_ENV === 'production'? '/smart-archiving/index': '/index' + sessionStorage.removeItem('systemConfig') }) }).catch(() => {}) } diff --git a/src/main.js b/src/main.js index 3efaab5..5d32769 100644 --- a/src/main.js +++ b/src/main.js @@ -17,7 +17,6 @@ import { download } from '@/utils/request' import './assets/icons' // icon import './permission' // permission control import { getDicts } from "@/api/system/dict/data" -import { getConfigKey } from "@/api/system/config" import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/bonus" // 分页组件 import Pagination from "@/components/Pagination" @@ -55,7 +54,7 @@ Vue.component('Editor', Editor) Vue.component('FileUpload', FileUpload) Vue.component('ImageUpload', ImageUpload) Vue.component('ImagePreview', ImagePreview) - +import { getConfigKey } from '@/utils/systemConfig' // 引入get方法 Vue.use(directive) Vue.use(plugins) DictData.install() diff --git a/src/utils/request.js b/src/utils/request.js index 49f5bfe..a218822 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -9,14 +9,34 @@ import { saveAs } from 'file-saver' import { decryptWithSM4, encryptWithSM4, hashWithSM3AndSalt } from '@/utils/sm' import { generateRequestSignature } from '@/utils/crypto-js' +const encryptRequestFlag = getConfig('encryptRequest') +const encryptResponseFlag = getConfig('encryptResponse') +const checkIntegrityFlag = getConfig('checkIntegrity') +const replayAttackFlag = getConfig('replayAttack') +console.error(encryptRequestFlag); +console.error(encryptResponseFlag); +console.error(checkIntegrityFlag); +console.error(replayAttackFlag); + const systemConfig = { requestConfig: { - encryptRequest: process.env.VUE_APP_ENV === 'production' ? true : true, - checkIntegrity: process.env.VUE_APP_ENV === 'production' ? true : true, - encryptResponse: process.env.VUE_APP_ENV === 'production' ? true : true, + encryptRequest: process.env.VUE_APP_ENV === 'production' ? encryptRequestFlag : encryptRequestFlag, + checkIntegrity: process.env.VUE_APP_ENV === 'production' ? checkIntegrityFlag : checkIntegrityFlag, + encryptResponse: process.env.VUE_APP_ENV === 'production' ? encryptResponseFlag : encryptResponseFlag, }, } +function getConfig(value) { + let config = sessionStorage.getItem('systemConfig'); + if(config){ + const decryptArr = JSON.parse(decryptWithSM4(config)); + const result = decryptArr.find(item => item.configCode === value); + return result.useStatus === '0'; + }else{ + return false; + } +} + let downloadLoadingInstance export let isRelogin = { show: false } @@ -41,9 +61,9 @@ service.interceptors.request.use( const headers = config.headers || {} const { isToken = true, - encryptRequest = process.env.NODE_ENV === 'development' ? true : true, - checkIntegrity = process.env.NODE_ENV === 'development' ? true : true, - encryptResponse = process.env.NODE_ENV === 'development' ? true : true, + encryptRequest = process.env.NODE_ENV === 'development' ? encryptRequestFlag : encryptRequestFlag, + checkIntegrity = process.env.NODE_ENV === 'development' ? checkIntegrityFlag : checkIntegrityFlag, + encryptResponse = process.env.NODE_ENV === 'development' ? encryptResponseFlag : encryptResponseFlag, repeatSubmit = false, skipReplayProtection = false } = headers @@ -61,7 +81,7 @@ service.interceptors.request.use( } // 添加防重放签名头(如果不是跳过重放保护的请求) - if (!skipReplayProtection) { + if (!skipReplayProtection && replayAttackFlag) { try { const userId = getUserId() const userSecret = getSecretKey() @@ -243,7 +263,6 @@ service.interceptors.response.use( ) { return res.data } - console.log(msg); // 账号在其他设备登录的安全提示(基于后端返回信息关键词识别) const otherDeviceLogin = /multipleDeviceLogin/.test(String(msg || '')) diff --git a/src/utils/systemConfig.js b/src/utils/systemConfig.js new file mode 100644 index 0000000..1598af4 --- /dev/null +++ b/src/utils/systemConfig.js @@ -0,0 +1,10 @@ +import { getNoAuthConfig } from '@/api/system/setting'; +import {encryptWithSM4} from '@/utils/sm'; + +export function getSystemConfigApi() { + getNoAuthConfig().then(res => { + sessionStorage.setItem('systemConfig', encryptWithSM4(JSON.stringify(res.data))); + }).catch(error => { + console.error('Failed to fetch config:', error); + }); +} \ No newline at end of file diff --git a/src/views/login.vue b/src/views/login.vue index c2e7a57..5bf905d 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -67,6 +67,7 @@ import { getCodeImg } from "@/api/login" import Cookies from "js-cookie" import { encrypt, decrypt } from '@/utils/jsencrypt' +import { getSystemConfigApi } from '@/utils/systemConfig' export default { name: "Login", @@ -107,12 +108,16 @@ export default { } }, created() { + this.getSystemConfig() this.getCode() this.getCookie() }, methods: { - getCode() { - getCodeImg().then(res => { + async getSystemConfig(){ + await getSystemConfigApi(); + }, + async getCode() { + await getCodeImg().then(res => { this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled if (this.captchaEnabled) { this.codeUrl = "data:image/gif;base64," + res.img