n20-common-lib 2.22.64 → 2.22.65-patch
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/nstc-g6/components/NstcDialog/NstcDialog.vue +0 -3
- package/nstc-g6/components/NstcDialogTable/NstcDialogTable.vue +0 -1
- package/nstc-g6/components/NstcElectronicFile/NstcElectronicFile.vue +14 -16
- package/nstc-g6/components/NstcExcelCustomImport/NstcExcelCustomImport.vue +1 -2
- package/nstc-g6/components/NstcExcelImport/NstcExcelImport.vue +1 -2
- package/nstc-g6/components/NstcExcelImportN/NstcExcelImportN.vue +0 -1
- package/nstc-g6/components/NstcFileUpload/NstcFileUpload.vue +18 -19
- package/nstc-g6/components/NstcPagination/NstcPagination.vue +0 -1
- package/nstc-g6/components/NstcScreenFull/NstcScreenFull.vue +1 -3
- package/nstc-g6/components/NstcTableSet/NstcTableSet.vue +3 -4
- package/nstc-g6/components/NstcWorkBench/NstcWorkBench.vue +0 -2
- package/nstc-g6/components/Search/NstcSearch.vue +0 -1
- package/package.json +1 -1
- package/src/components/ApprovalButtons/index.vue +5 -2
- package/src/components/ApprovalButtons/indexApp.vue +6 -3
- package/src/components/ApprovalRecord/index.vue +2 -2
- package/src/components/ApprovalRecord/indexApp.vue +1 -6
- package/src/components/FileUploadTable/FileUploadTableV3.vue +10 -10
- package/src/components/FileUploadTable/index.vue +2 -2
- package/src/utils/serverConfig.js +77 -0
- package/style/index.css +1 -1
- package/theme/blue.css +1 -1
- package/theme/cctcRed.css +1 -1
- package/theme/green.css +1 -1
- package/theme/lightBlue.css +1 -1
- package/theme/orange.css +1 -1
- package/theme/purple.css +1 -1
- package/theme/red.css +1 -1
- package/theme/yellow.css +1 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import axios from './axios'
|
|
2
|
+
import CryptoJS from 'crypto-js'
|
|
3
|
+
|
|
4
|
+
let configPromise = null
|
|
5
|
+
|
|
6
|
+
// 生成密钥
|
|
7
|
+
const generateKey = () => {
|
|
8
|
+
const now = new Date()
|
|
9
|
+
const year = now.getFullYear()
|
|
10
|
+
const month = String(now.getMonth() + 1).padStart(2, '0')
|
|
11
|
+
const day = String(now.getDate()).padStart(2, '0')
|
|
12
|
+
const dateStr = `${year}${month}${day}`
|
|
13
|
+
const keyStr = dateStr.padEnd(32, '0')
|
|
14
|
+
return keyStr
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* AES 解密 - 后端返回 Base64 编码的密文和 IV
|
|
18
|
+
* @param ciphertextBase64 Base64编码的密文
|
|
19
|
+
* @param ivBase64 Base64编码的IV
|
|
20
|
+
*/
|
|
21
|
+
const decrypt = (ciphertextBase64, ivBase64) => {
|
|
22
|
+
const keyStr = generateKey()
|
|
23
|
+
|
|
24
|
+
const key = CryptoJS.enc.Utf8.parse(keyStr)
|
|
25
|
+
// 后端返回的 IV 是 Base64 编码,需要解码
|
|
26
|
+
const iv = CryptoJS.enc.Base64.parse(ivBase64)
|
|
27
|
+
|
|
28
|
+
// 执行解密(CryptoJS.AES.decrypt 可以直接解析 Base64 密文)
|
|
29
|
+
const decrypted = CryptoJS.AES.decrypt(ciphertextBase64, key, {
|
|
30
|
+
iv: iv,
|
|
31
|
+
mode: CryptoJS.mode.CBC,
|
|
32
|
+
padding: CryptoJS.pad.Pkcs7
|
|
33
|
+
})
|
|
34
|
+
return decrypted.toString(CryptoJS.enc.Utf8)
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 获取服务端配置(带缓存)
|
|
38
|
+
* 替代原有的 getJsonc('/server-config.jsonc')
|
|
39
|
+
* 后端接口返回与 server-config.jsonc 一致的 JSON 结构
|
|
40
|
+
* @returns {Promise<Object>} 配置对象
|
|
41
|
+
*/
|
|
42
|
+
export function getServerConfig() {
|
|
43
|
+
if (!configPromise) {
|
|
44
|
+
configPromise = axios
|
|
45
|
+
.get('/bems/getPortalServerConfig', null, {
|
|
46
|
+
loading: false,
|
|
47
|
+
noMsg: true
|
|
48
|
+
})
|
|
49
|
+
.then(({ data, code }) => {
|
|
50
|
+
if (code !== 200) return
|
|
51
|
+
// 检查是否有密文数据需要解密
|
|
52
|
+
if (data.ciphertext && data.iv) {
|
|
53
|
+
const decryptedData = decrypt(data.ciphertext, data.iv)
|
|
54
|
+
|
|
55
|
+
// 如果解密成功,解析JSON并合并到列表
|
|
56
|
+
if (decryptedData) {
|
|
57
|
+
return JSON.parse(decryptedData) || {}
|
|
58
|
+
}
|
|
59
|
+
return {}
|
|
60
|
+
}
|
|
61
|
+
return data || {}
|
|
62
|
+
})
|
|
63
|
+
.catch((err) => {
|
|
64
|
+
console.error('获取服务端配置失败:', err)
|
|
65
|
+
// 返回空对象,避免阻塞应用启动
|
|
66
|
+
return {}
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
return configPromise
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* 清除配置缓存(如需刷新配置时调用)
|
|
74
|
+
*/
|
|
75
|
+
export function clearConfigCache() {
|
|
76
|
+
configPromise = null
|
|
77
|
+
}
|