Browse Source

chore: 解除大屏设计器aes接口加密

master
wangxiang 2 years ago
parent
commit
18db49057c
  1. 12
      cloud/bigscreen-design/src/api/db.js
  2. 8
      cloud/bigscreen-design/src/echart/common.js
  3. 13
      cloud/bigscreen-design/src/page/build.vue
  4. 2
      cloud/bigscreen-design/src/page/list/db.vue
  5. 11
      cloud/bigscreen-design/src/page/list/record.vue
  6. 7
      cloud/bigscreen-design/src/utils/crypto.js

12
cloud/bigscreen-design/src/api/db.js

@ -46,10 +46,6 @@ export const dynamicSql = (data) => { @@ -46,10 +46,6 @@ export const dynamicSql = (data) => {
return request({
url: url + '/db/dynamic-query',
method: 'post',
headers: {
'data': data,
'Content-Type': 'application/json'
},
data: data
})
}
@ -58,10 +54,8 @@ export const dbTest = (data) => { @@ -58,10 +54,8 @@ export const dbTest = (data) => {
return request({
url: url + '/db/db-test',
method: 'post',
headers: {
'data': crypto.encrypt(JSON.stringify(data)),
'Content-Type': 'application/json'
},
data: crypto.encrypt(JSON.stringify(data))
// todo 借助spring网关处理解密待重写
//data: crypto.encrypt(JSON.stringify(data))
data: data
})
}

8
cloud/bigscreen-design/src/echart/common.js

@ -368,11 +368,15 @@ export default (() => { @@ -368,11 +368,15 @@ export default (() => {
bindEvent();
}
} else if (isSql) {
let sql = JSON.parse(crypto.decrypt(safe.sql));
// todo 借助spring网关处理解密待重写
//let sql = JSON.parse(crypto.decrypt(safe.sql));
let sql = safe.sql;
let data, result;
try {
sql.sql = funEval(sql.sql)(this.dataParams)
data = crypto.encrypt(JSON.stringify(sql));
// todo 借助spring网关处理解密待重写
//data = crypto.encrypt(JSON.stringify(sql));
data = sql;
} catch (error) {
data = safe.sql;
}

13
cloud/bigscreen-design/src/page/build.vue

@ -914,7 +914,9 @@ export default { @@ -914,7 +914,9 @@ export default {
activeObj: {
handler () {
if (this.activeObj.sql && this.isSql) {
let mode = JSON.parse(crypto.decrypt(this.activeObj.sql));
// todo spring
// let mode = JSON.parse(crypto.decrypt(this.activeObj.sql));
let mode = this.activeObj.sql;
this.db = mode.id;
this.sql = mode.sql;
} else {
@ -1028,10 +1030,15 @@ export default { @@ -1028,10 +1030,15 @@ export default {
},
handleRes (tip = true) {
if (this.isSql) {
this.activeObj.sql = crypto.encrypt(JSON.stringify({
// todo spring
// this.activeObj.sql = crypto.encrypt(JSON.stringify({
// id: this.db,
// sql: this.sql
// }))
this.activeObj.sql = {
id: this.db,
sql: this.sql
}))
}
}
this.handleRefresh().then((res = {}) => {
if (!this.validatenull(res)) {

2
cloud/bigscreen-design/src/page/list/db.vue

@ -200,7 +200,7 @@ export default { @@ -200,7 +200,7 @@ export default {
password: form.password
}).then(res => {
const data = res.data;
if (data.success) {
if (data.data) {
this.$message.success('连接成功')
} else {
this.$message.error('连接失败,请检查相关配置参数')

11
cloud/bigscreen-design/src/page/list/record.vue

@ -206,10 +206,15 @@ export default { @@ -206,10 +206,15 @@ export default {
});
},
getSql (row) {
return crypto.encrypt(JSON.stringify({
// todo spring
/*return crypto.encrypt(JSON.stringify({
id: row.dbId,
sql: row.dbSql
}))
}))*/
return {
id: row.dbId,
sql: row.dbSql
}
},
handleClose () {
this.client.close && this.client.close()
@ -289,7 +294,7 @@ export default { @@ -289,7 +294,7 @@ export default {
const data = res.data.data;
this.form = data
if (this.isSql) {
let mode = JSON.parse(crypto.decrypt(this.form.data));
let mode = JSON.parse(this.form.data);
this.form.dbId = mode.id;
this.form.dbSql = mode.sql;
}

7
cloud/bigscreen-design/src/utils/crypto.js

@ -1,11 +1,8 @@ @@ -1,11 +1,8 @@
import CryptoJS from 'crypto-js'
export default class crypto {
// 使用AesUtil.genAesKey()生成,需和后端配置保持一致
static aesKey = "O2BEeIv399qHQNhD6aGW8R8DEj4bqHXm";
// 使用DesUtil.genDesKey()生成,需和后端配置保持一致
static desKey = "jMVCBsFGDQr1USHo";
static aesKey = "changsha-kanglai";
/**
* aes 加密方法
@ -77,4 +74,4 @@ export default class crypto { @@ -77,4 +74,4 @@ export default class crypto {
});
return decrypted.toString(CryptoJS.enc.Utf8);
}
}
}

Loading…
Cancel
Save