智能算法详情增加说明文字

This commit is contained in:
guoyue 2022-11-02 16:52:46 +08:00
parent 65026d0e65
commit 91b2f229ee
1 changed files with 287 additions and 253 deletions

View File

@ -54,284 +54,318 @@
</div> </div>
<div class="bottom" v-if="props.dataList.id"> <div class="bottom" v-if="props.dataList.id">
<a-button type="primary" @click="toView()"> <a-button type="primary" @click="toView()">
<template #icon><form-outlined /></template> <template #icon>
<form-outlined />
</template>
申请使用 申请使用
</a-button> </a-button>
<a-button type="primary" @click="addShoppingCart()"> <a-button type="primary" @click="addShoppingCart()">
<template #icon><shopping-cart-outlined /></template> <template #icon>
<shopping-cart-outlined />
</template>
加入申购车 加入申购车
</a-button> </a-button>
<a-button type="primary" @click="goTOCollection()"> <a-button type="primary" @click="goTOCollection()">
{{ props.dataList.isCollect == 'true' ? '已' : '' }}收藏 {{ props.dataList.isCollect == 'true' ? '已' : '' }}收藏
</a-button> </a-button>
</div> </div>
<div class="text-tip">
使用声明算法的场景适应性和结果准确性需申请部门根据场景建设要求先行试用进而判断是否满足应用需求除特殊声明算法结果仅为参考
</div>
</div> </div>
<div class="right"></div> <div class="right"></div>
</div> </div>
</template> </template>
<script setup> <script setup>
import { FormOutlined, ShoppingCartOutlined } from '@ant-design/icons-vue' import { FormOutlined, ShoppingCartOutlined } from '@ant-design/icons-vue'
import { defineProps, ref, watch } from 'vue' import { defineProps, ref, watch } from 'vue'
import { scInsert, scDel } from '@/api/personalCenter' import { scInsert, scDel } from '@/api/personalCenter'
import { sgcInsert } from '@/api/home' import { sgcInsert } from '@/api/home'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import mybus from '@/myplugins/mybus' import mybus from '@/myplugins/mybus'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
const props = defineProps({ const props = defineProps({
dataList: { type: Object, default: null }, dataList: { type: Object, default: null },
})
const classOfAlgorithm = ref('')
// console.log('==================>', props.dataList.isCollect)
const router = useRouter()
const applicationArea = ref('')
const deploymentLocation = ref('') //
//
const addShoppingCart = () => {
if (props.dataList.isInShoppingCart) {
message.error('已经加入申购车了')
} else {
console.log('加入申购车==================>', props.dataList)
sgcInsert({
delFlag: '0',
resourceId: props.dataList.id,
// userId: userId.value,
}).then((res) => {
console.log(res)
message.success('添加申购车成功!')
mybus.emit('getSgcNum')
props.dataList.isInShoppingCart = true
console.log(
props.dataList.isInShoppingCart,
'props.dataList.isInShoppingCart'
)
})
}
}
//
function toView() {
// window.open(newpage.href, '_blank')
console.log('一键申请===================>', props.dataList)
localStorage.setItem(
'applyList',
JSON.stringify([
{
arr: [
{
delFlag: props.dataList.delFlag,
description: props.dataList.description,
resourceId: props.dataList.id,
resourceName: props.dataList.name,
time: props.dataList.createDate,
type: props.dataList.type,
componentType: '智能算法',
},
],
deptId: props.dataList.deptId,
deptName: props.dataList.deptName,
},
])
)
router.push({
path: '/apply',
}) })
const classOfAlgorithm = ref('') }
// console.log('==================>', props.dataList.isCollect) const componentType = ref('')
const router = useRouter() if (props.dataList.infoList) {
const applicationArea = ref('') applicationArea.value = props.dataList.infoList.filter(
const deploymentLocation = ref('') // (val) => val.attrType === '应用领域'
// )[0].attrValue
const addShoppingCart = () => { let obj = props.dataList.infoList.filter(
if (props.dataList.isInShoppingCart) { (val) => val.attrType === '组件类型'
message.error('已经加入申购车了') )[0]
if (
props.dataList.infoList.filter((val) => val.attrType === '算法类别')[0]
) {
classOfAlgorithm.value = props.dataList.infoList.filter(
(val) => val.attrType === '算法类别'
)[0]
}
if (
props.dataList.infoList.filter((val) => val.attrType === '部署位置')[0]
) {
deploymentLocation.value = props.dataList.infoList.filter(
(val) => val.attrType === '部署位置'
)[0].attrValue
}
if (obj) {
componentType.value = obj.attrValue
}
}
watch(
() => props.dataList,
(val) => {
if (val) {
applicationArea.value = props.dataList.infoList.filter(
(val) => val.attrType === '应用领域'
)[0].attrValue
let obj = props.dataList.infoList.filter(
(val) => val.attrType === '组件类型'
)[0]
if (
props.dataList.infoList.filter(
(val) => val.attrType === '算法类别'
)[0]
) {
classOfAlgorithm.value = props.dataList.infoList.filter(
(val) => val.attrType === '算法类别'
)[0]
}
if (
props.dataList.infoList.filter(
(val) => val.attrType === '部署位置'
)[0]
) {
deploymentLocation.value = props.dataList.infoList.filter(
(val) => val.attrType === '部署位置'
)[0].attrValue
}
if (obj) {
componentType.value = obj.attrValue
}
}
}
)
//
const scFlag2 = ref(true)
const goTOCollection = () => {
console.log('收藏===================》', props.dataList)
if (scFlag2.value) {
scFlag2.value = false
if (props.dataList.isCollect == 'true') {
scDel([props.dataList.id]).then((res) => {
if (res.data.msg === 'success') {
message.success('取消成功')
// eslint-disable-next-line vue/no-mutating-props
props.dataList.isCollect = 'false'
scFlag2.value = true
}
})
} else { } else {
console.log('加入申购车==================>', props.dataList) scInsert([
sgcInsert({ {
delFlag: '0', resourceId: props.dataList.id,
resourceId: props.dataList.id, },
// userId: userId.value, ]).then((res) => {
}).then((res) => { if (res.data.msg === 'success') {
console.log(res) message.success('添加收藏成功!')
message.success('添加申购车成功!') // eslint-disable-next-line vue/no-mutating-props
mybus.emit('getSgcNum') props.dataList.isCollect = 'true'
props.dataList.isInShoppingCart = true scFlag2.value = true
console.log( }
props.dataList.isInShoppingCart,
'props.dataList.isInShoppingCart'
)
}) })
} }
} }
// // scInsert([{ resourceId: props.dataList.id }]).then((res) => {
function toView() { // console.log(res)
// window.open(newpage.href, '_blank') // message.success('')
console.log('一键申请===================>', props.dataList) // })
localStorage.setItem( }
'applyList',
JSON.stringify([
{
arr: [
{
delFlag: props.dataList.delFlag,
description: props.dataList.description,
resourceId: props.dataList.id,
resourceName: props.dataList.name,
time: props.dataList.createDate,
type: props.dataList.type,
componentType: '智能算法',
},
],
deptId: props.dataList.deptId,
deptName: props.dataList.deptName,
},
])
)
router.push({
path: '/apply',
})
}
const componentType = ref('')
if (props.dataList.infoList) {
applicationArea.value = props.dataList.infoList.filter(
(val) => val.attrType === '应用领域'
)[0].attrValue
let obj = props.dataList.infoList.filter(
(val) => val.attrType === '组件类型'
)[0]
if (
props.dataList.infoList.filter((val) => val.attrType === '算法类别')[0]
) {
classOfAlgorithm.value = props.dataList.infoList.filter(
(val) => val.attrType === '算法类别'
)[0]
}
if (
props.dataList.infoList.filter((val) => val.attrType === '部署位置')[0]
) {
deploymentLocation.value = props.dataList.infoList.filter(
(val) => val.attrType === '部署位置'
)[0].attrValue
}
if (obj) {
componentType.value = obj.attrValue
}
}
watch(
() => props.dataList,
(val) => {
if (val) {
applicationArea.value = props.dataList.infoList.filter(
(val) => val.attrType === '应用领域'
)[0].attrValue
let obj = props.dataList.infoList.filter(
(val) => val.attrType === '组件类型'
)[0]
if (
props.dataList.infoList.filter(
(val) => val.attrType === '算法类别'
)[0]
) {
classOfAlgorithm.value = props.dataList.infoList.filter(
(val) => val.attrType === '算法类别'
)[0]
}
if (
props.dataList.infoList.filter(
(val) => val.attrType === '部署位置'
)[0]
) {
deploymentLocation.value = props.dataList.infoList.filter(
(val) => val.attrType === '部署位置'
)[0].attrValue
}
if (obj) {
componentType.value = obj.attrValue
}
}
}
)
//
const scFlag2 = ref(true)
const goTOCollection = () => {
console.log('收藏===================》', props.dataList)
if (scFlag2.value) {
scFlag2.value = false
if (props.dataList.isCollect == 'true') {
scDel([props.dataList.id]).then((res) => {
if (res.data.msg === 'success') {
message.success('取消成功')
// eslint-disable-next-line vue/no-mutating-props
props.dataList.isCollect = 'false'
scFlag2.value = true
}
})
} else {
scInsert([
{
resourceId: props.dataList.id,
},
]).then((res) => {
if (res.data.msg === 'success') {
message.success('添加收藏成功!')
// eslint-disable-next-line vue/no-mutating-props
props.dataList.isCollect = 'true'
scFlag2.value = true
}
})
}
}
// scInsert([{ resourceId: props.dataList.id }]).then((res) => {
// console.log(res)
// message.success('')
// })
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.algorithm-top-details { .algorithm-top-details {
height: 600px; height: 600px;
padding: 180px 0 0; padding: 180px 0 0;
background: url('~@/assets/detailsAll/sf_top_bg.png') no-repeat; background: url('~@/assets/detailsAll/sf_top_bg.png') no-repeat;
background-size: 100%; background-size: 100%;
display: flex; display: flex;
justify-content: center; justify-content: center;
.left {
width: 7.2rem; .left {
color: #fff; width: 7.2rem;
margin-right: 0.8rem; color: #fff;
margin-top: -0.3rem; margin-right: 0.8rem;
.top { margin-top: -0.3rem;
display: flex; position: relative;
align-items: center;
span { .top {
font-size: 14px; display: flex;
} align-items: center;
.name {
display: inline-block; span {
// width: 10.2rem; font-size: 14px;
// overflow: hidden;
// text-overflow: ellipsis;
// white-space: nowrap;
font-size: 40px;
margin-right: 20px;
max-width: 6rem;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
word-break: break-all;
}
.label-content {
position: relative;
}
.lable-father {
position: absolute;
min-width: 5.5rem;
right: -5.5rem;
top: 0;
}
.label {
padding: 1px 10px;
margin-right: 10px;
border-radius: 13px;
background: rgba(255, 255, 255, 0.4);
}
} }
.main {
margin-top: 20px; .name {
font-size: 18px; display: inline-block;
line-height: 34px; // width: 10.2rem;
& > div:nth-of-type(1) { // overflow: hidden;
overflow: hidden; // text-overflow: ellipsis;
text-overflow: ellipsis; // white-space: nowrap;
white-space: nowrap; font-size: 40px;
} margin-right: 20px;
& > div:nth-of-type(2) { max-width: 6rem;
max-height: 100px; text-overflow: -o-ellipsis-lastline;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 3; -webkit-line-clamp: 1;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
word-break: break-all; word-break: break-all;
}
} }
.bottom {
margin-top: 40px; .label-content {
display: flex; position: relative;
.ant-btn { }
height: 50px;
margin-right: 20px; .lable-father {
background: #ff8b55; position: absolute;
border-radius: 6px; min-width: 5.5rem;
font-size: 20px; right: -5.5rem;
display: flex; top: 0;
justify-content: center; }
align-items: center;
} .label {
.ant-btn:nth-of-type(1) { padding: 1px 10px;
width: 180px; margin-right: 10px;
} border-radius: 13px;
.ant-btn:nth-of-type(2) { background: rgba(255, 255, 255, 0.4);
width: 220px;
}
.ant-btn:nth-of-type(3) {
width: 145px;
}
} }
} }
.right {
width: 580px; .main {
height: 400px; margin-top: 20px;
background: url('~@/assets/detailsAll/sf_right_bg.png') no-repeat; font-size: 18px;
background-size: 100%; line-height: 34px;
margin-top: -40px;
&>div:nth-of-type(1) {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
&>div:nth-of-type(2) {
max-height: 100px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
word-break: break-all;
}
}
.bottom {
margin-top: 40px;
display: flex;
.ant-btn {
height: 50px;
margin-right: 20px;
background: #ff8b55;
border-radius: 6px;
font-size: 20px;
display: flex;
justify-content: center;
align-items: center;
}
.ant-btn:nth-of-type(1) {
width: 180px;
}
.ant-btn:nth-of-type(2) {
width: 220px;
}
.ant-btn:nth-of-type(3) {
width: 145px;
}
} }
} }
.right {
width: 580px;
height: 400px;
background: url('~@/assets/detailsAll/sf_right_bg.png') no-repeat;
background-size: 100%;
margin-top: -40px;
}
}
.text-tip {
font-size: 14px;
color: #fff;
position: absolute;
bottom: 20px;
width: 140%;
}
</style> </style>