系统上线运行问题修改
This commit is contained in:
parent
79b9349598
commit
5dcba00915
|
|
@ -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
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue