系统上线运行问题修改

This commit is contained in:
lSun 2025-09-22 15:04:17 +08:00
parent 79b9349598
commit 5dcba00915
5 changed files with 847 additions and 682 deletions

36
src/utils/aes_new.js Normal file
View File

@ -0,0 +1,36 @@
// src/utils/aesUtil.js
import CryptoJS from 'crypto-js'
/**
* AES解密函数
* @param {string} word - 需要解密的字符串
* @returns {string} 解密后的明文
*/
export function bnsCloudDecrypt(word) {
const key = CryptoJS.enc.Utf8.parse("bonus@cloud@2025")
const decrypt = CryptoJS.AES.decrypt(word, key, {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7
})
return CryptoJS.enc.Utf8.stringify(decrypt).toString()
}
/**
* AES加密函数
* @param {string} word - 需要加密的明文
* @returns {string} 加密后的字符串
*/
export function bnsCloudEncrypt(word) {
const key = CryptoJS.enc.Utf8.parse("bonus@cloud@2025")
const srcs = CryptoJS.enc.Utf8.parse(word)
const encrypted = CryptoJS.AES.encrypt(srcs, key, {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7
})
return encrypted.toString()
}
export default {
bnsCloudDecrypt,
bnsCloudEncrypt
}

View File

@ -114,7 +114,7 @@
<a
target="_blank"
class="link-text"
:href="scope.row[column.prop]"
:href="getEncryptedUrl(scope.row)"
>
{{ scope.row[column.prop] }}
</a>
@ -179,6 +179,7 @@ import {
} from '@/api/dataManage/product-center'
import DialogModel from '@/components/DialogModel'
import AddAndEditForm from './components/addAndEditForm.vue'
import {bnsCloudEncrypt, bnsCloudDecrypt} from '@/utils/aes_new'
export default {
name: 'ProductCenter',
dicts: ['tb_product_type'],
@ -236,6 +237,30 @@ export default {
}
},
methods: {
getEncryptedUrl(row) {
const { linkUrl, linkUser, linkPassword } = row;
//
if (!linkUrl) return '';
// URL
if (linkUser && linkPassword) {
// username=admin&password=123
const authString = `username=${linkUser}&password=${linkPassword}`;
//
const encryptedParams = bnsCloudEncrypt(authString);
// URL
const separator = linkUrl.includes('?') ? '&' : '?';
return `${linkUrl}${separator}params=${encodeURIComponent(encryptedParams)}`;
}
//
return linkUrl;
},
//
async getProductCenterListFun() {
const res = await getProductCenterListAPI(this.queryParams)

View File

@ -195,7 +195,7 @@ export default {
//
getItemWidth() {
this.itemWidth = (this.$refs.servicesGrid?.clientWidth - 120) / 4
this.itemWidth = (this.$refs.servicesGrid?.clientWidth - 280) / 4
},
//
@ -481,6 +481,7 @@ export default {
.services-grid {
height: 240px; /* 给子元素设置固定高度以便测试滚动 */
width: 365px;
display: flex;
flex-direction: column;
align-items: center;

View File

@ -46,7 +46,7 @@
>
访问演示
</div>
<div @click="handleDetail(item)"> 查看详情 </div>
<div @click="handleDetail(item)"> 查看详情</div>
</div>
</div>
</div>
@ -54,7 +54,9 @@
</template>
<script>
import { getProductCenterListAPI } from '@/api/publicService/productCenter'
import {getProductCenterListAPI} from '@/api/publicService/productCenter'
import {bnsCloudEncrypt, bnsCloudDecrypt} from '@/utils/aes_new'
export default {
name: 'ProductCenter',
dicts: ['tb_product_type'],
@ -98,7 +100,7 @@ export default {
methods: {
//
getItemWidth() {
this.itemWidth = (this.$refs.servicesGrid?.clientWidth - 120) / 4
this.itemWidth = (this.$refs.servicesGrid?.clientWidth - 280) / 4
},
//
@ -117,7 +119,8 @@ export default {
})
})
}
} catch (error) {}
} catch (error) {
}
},
// 访
handleDemo(service) {
@ -126,8 +129,48 @@ export default {
return
}
// URL
//
const {linkUser, linkPassword} = service
let url = service.linkUrl
// URL
if (linkUser && linkPassword) {
// username=admin&password=123
const authString = `username=${linkUser}&password=${linkPassword}`
//
const encryptedParams = bnsCloudEncrypt(authString)
// URL
const separator = url.includes('?') ? '&' : '?'
url += `${separator}params=${encodeURIComponent(encryptedParams)}`
} else if (!url.startsWith('http://') && !url.startsWith('https://')) {
// URL http:// https:// https://
if (url.startsWith('www.')) {
url = 'https://' + url
} else {
// https://
url = 'https://' + url
}
}
// URL
/*
const authData = {
username: linkUser,
password: linkPassword
}
// JSON
const authJson = JSON.stringify(authData)
console.log(authJson)
const encryptedParams = bnsCloudEncrypt(authJson)
console.log(encryptedParams)
// URL
const separator = url.includes('?') ? '&' : '?'
url += `${separator}params=${encodeURIComponent(encryptedParams)}`
// URL http:// https:// https://
if (!url.startsWith('http://') && !url.startsWith('https://')) {
// URL www. https://
@ -137,7 +180,7 @@ export default {
// https://
url = 'https://' + url
}
}
}*/
window.open(url, '_blank')
},
@ -145,7 +188,7 @@ export default {
handleDetail(service) {
this.$router.push({
name: 'ProductDetail',
params: { id: service.id },
params: {id: service.id},
})
},
//
@ -245,6 +288,7 @@ export default {
.services-grid {
height: 260px; /* 给子元素设置固定高度以便测试滚动 */
width: 365px;
display: flex;
flex-direction: column;
align-items: center;
@ -457,8 +501,7 @@ export default {
.category-item.active {
// background-color: #4a90e2;
background: url('../../../assets/images/publicService/btn-sel.png')
no-repeat center center;
background: url('../../../assets/images/publicService/btn-sel.png') no-repeat center center;
background-size: 100% 100%;
color: white;
}