2022-06-29 16:56:51 +08:00
|
|
|
<template>
|
|
|
|
<div class="application-associated-ability" v-if="flag">
|
2022-07-04 17:15:06 +08:00
|
|
|
<detals-title title="关联组件" type="ASSOCIATED"></detals-title>
|
2022-06-29 16:56:51 +08:00
|
|
|
<div class="application-associated-ability-main">
|
|
|
|
<div
|
|
|
|
class="associated-ability-card"
|
2022-07-04 17:15:06 +08:00
|
|
|
v-for="(dataListitem, dataListindex) in dataFrom[0].dataList"
|
|
|
|
:key="dataListitem.id"
|
|
|
|
@click="switchFunction(dataListitem.id)"
|
|
|
|
:class="cardFunction(dataFrom[0].dataList)"
|
2022-06-29 16:56:51 +08:00
|
|
|
>
|
2022-07-04 17:15:06 +08:00
|
|
|
<div class="icon"></div>
|
|
|
|
<a-tooltip>
|
|
|
|
<template #title>{{ dataListitem.name }}</template>
|
|
|
|
<div class="associated-ability-card-title">
|
2022-06-29 16:56:51 +08:00
|
|
|
{{ dataListitem.name }}
|
|
|
|
</div>
|
2022-07-04 17:15:06 +08:00
|
|
|
</a-tooltip>
|
|
|
|
<div class="associated-ability-card-content">
|
|
|
|
<a-tooltip>
|
|
|
|
<template #title>{{ dataListitem.description || '' }}</template>
|
|
|
|
<div class="associated-ability-card-content-font">
|
|
|
|
{{ dataListitem.description || '' }}
|
|
|
|
</div>
|
|
|
|
</a-tooltip>
|
2022-06-29 16:56:51 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { ref, defineProps, watch } from 'vue'
|
|
|
|
import { useRouter } from 'vue-router'
|
|
|
|
const router = useRouter()
|
|
|
|
import DetalsTitle from '@/views/detailsAll/components/DetalsTitle.vue'
|
|
|
|
const props = defineProps({
|
|
|
|
associatedComponents: { type: Array, default: null },
|
|
|
|
})
|
|
|
|
const dataFrom = ref([])
|
|
|
|
const flag = ref(true)
|
|
|
|
const oldid = router.currentRoute.value.query.id
|
|
|
|
//点击查看详情
|
|
|
|
const switchFunction = (id) => {
|
2022-07-04 17:15:06 +08:00
|
|
|
// router.push({
|
|
|
|
// path: '/details',
|
|
|
|
// query: {
|
|
|
|
// id: id,
|
|
|
|
// },
|
|
|
|
// })
|
|
|
|
window.open(window.SITE_CONFIG.previewUrl + '#/details?id=' + id)
|
|
|
|
// alert(id)
|
2022-06-29 16:56:51 +08:00
|
|
|
}
|
2022-07-04 17:15:06 +08:00
|
|
|
if (props.associatedComponents[0].dataList.length != 0) {
|
|
|
|
console.log('这个是空值', props.associatedComponents)
|
|
|
|
flag.value = true
|
|
|
|
dataFrom.value = props.associatedComponents
|
|
|
|
console.log('dataFrom.value', dataFrom.value)
|
2022-06-29 16:56:51 +08:00
|
|
|
} else {
|
|
|
|
flag.value = false
|
|
|
|
}
|
2022-07-04 17:15:06 +08:00
|
|
|
//根据数据多少决定对齐方式
|
|
|
|
const cardFunction = (item) => {
|
|
|
|
if (item.length < 5) {
|
|
|
|
return 'card-function-class'
|
|
|
|
}
|
|
|
|
}
|
2022-06-29 16:56:51 +08:00
|
|
|
watch(
|
|
|
|
() => props.associatedComponents,
|
|
|
|
(val) => {
|
2022-07-04 17:15:06 +08:00
|
|
|
if (val[0].length != 0) {
|
|
|
|
flag.value = true
|
|
|
|
dataFrom.value = props.associatedComponents
|
|
|
|
console.log('dataFrom.value', dataFrom.value)
|
2022-06-29 16:56:51 +08:00
|
|
|
} else {
|
|
|
|
flag.value = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
watch(
|
|
|
|
() => router.currentRoute.value.query.id,
|
|
|
|
(newValue, oldValue) => {
|
|
|
|
if (oldid != router.currentRoute.value.query.id) {
|
|
|
|
window.location.reload()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ immediate: true }
|
|
|
|
)
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
.application-associated-ability {
|
|
|
|
padding-top: 0.8rem;
|
|
|
|
padding-bottom: 0.8rem;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
align-items: center;
|
|
|
|
.application-associated-ability-main {
|
|
|
|
margin-top: 0.4rem;
|
2022-07-04 17:15:06 +08:00
|
|
|
width: 13.3rem;
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(4, 25%);
|
2022-06-29 16:56:51 +08:00
|
|
|
.associated-ability-card {
|
2022-07-04 17:15:06 +08:00
|
|
|
width: 3.2rem;
|
|
|
|
// height: 2.78rem;
|
2022-06-29 16:56:51 +08:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
align-items: center;
|
|
|
|
border: 1px solid #e4e6f5;
|
|
|
|
border-radius: 0.1rem;
|
|
|
|
padding-bottom: 0.3rem;
|
2022-07-04 17:15:06 +08:00
|
|
|
margin-right: 0.2rem;
|
|
|
|
margin-top: 0.2rem;
|
|
|
|
padding-top: 0.3rem;
|
2022-06-29 16:56:51 +08:00
|
|
|
cursor: pointer;
|
2022-07-04 17:15:06 +08:00
|
|
|
.icon {
|
|
|
|
width: 82px;
|
|
|
|
height: 82px;
|
|
|
|
background: url('~@/assets/detailsAll/sf_icon1.png') no-repeat;
|
|
|
|
background-size: 100%;
|
|
|
|
}
|
2022-06-29 16:56:51 +08:00
|
|
|
.associated-ability-card-title {
|
2022-07-04 17:15:06 +08:00
|
|
|
width: 2.2rem;
|
2022-06-29 16:56:51 +08:00
|
|
|
padding-top: 0.3rem;
|
|
|
|
font-size: 0.22rem;
|
|
|
|
text-align: center;
|
2022-07-04 17:15:06 +08:00
|
|
|
display: -webkit-box;
|
|
|
|
overflow: hidden;
|
|
|
|
-webkit-line-clamp: 2;
|
|
|
|
-webkit-box-orient: vertical;
|
2022-06-29 16:56:51 +08:00
|
|
|
}
|
|
|
|
.associated-ability-card-content {
|
|
|
|
width: 100%;
|
|
|
|
margin-top: 0.25rem;
|
|
|
|
padding-left: 0.3rem;
|
|
|
|
.associated-ability-card-content-font {
|
|
|
|
font-size: 0.18rem;
|
|
|
|
color: #999;
|
|
|
|
margin-right: 0.15rem;
|
|
|
|
margin-top: 0.15rem;
|
2022-07-04 17:15:06 +08:00
|
|
|
text-align: center;
|
|
|
|
display: -webkit-box;
|
|
|
|
overflow: hidden;
|
|
|
|
-webkit-line-clamp: 5;
|
|
|
|
-webkit-box-orient: vertical;
|
2022-06-29 16:56:51 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-07-04 17:15:06 +08:00
|
|
|
.card-function-class {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
2022-06-29 16:56:51 +08:00
|
|
|
.associated-ability-card:hover {
|
|
|
|
border-radius: 0.02rem;
|
|
|
|
border: 0.01rem solid #0058e1;
|
|
|
|
box-shadow: 0rem 0.08rem 0.2rem rgba(0, 88, 225, 0.3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|