对接数据
This commit is contained in:
146
pages/AIHub/components/ListCardItem.vue
Normal file
146
pages/AIHub/components/ListCardItem.vue
Normal file
@ -0,0 +1,146 @@
|
||||
<template>
|
||||
<div class="card" @click="handleClick">
|
||||
<div class="left">
|
||||
<img :src="item.coverImage || ''" alt="" />
|
||||
</div>
|
||||
<div class="right flex-1">
|
||||
<div>
|
||||
<div class="title-text">
|
||||
{{ item.title || '' }}
|
||||
</div>
|
||||
<div class="content-text">
|
||||
{{ item.summary || '' }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bottom-info">
|
||||
<div class="first" style="gap: 50px">
|
||||
<div>
|
||||
<img src="/logo/logo_xs.png" alt="" />
|
||||
<span>{{ item.slug || ''}}</span>
|
||||
</div>
|
||||
<div class="praise flex items-center">
|
||||
<img src="/logo/praise.png" alt="" style="width: 16px; height: 16px" />
|
||||
<span>{{ item.likeCount || 0 }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="time">
|
||||
<img src="/logo/clock.png" alt="" />
|
||||
<span>{{ item.publishTime || '' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: '',
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleClick() {
|
||||
if (!this.item.slug || !this.type){
|
||||
return false;
|
||||
}
|
||||
this.articleClick(this.item.id);
|
||||
this.$router.push('/tools-detail?news_slug=' + this.item.slug + '&type=' + this.type)
|
||||
},
|
||||
// 记录文章点击次数
|
||||
async articleClick(id) {
|
||||
if (id) {
|
||||
await this.$api.article.recordArticleClick(id);
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.card {
|
||||
background: $white;
|
||||
box-shadow: 0 10px 30px 0 rgba(0, 0, 0, 0.05);
|
||||
border-radius: 12px;
|
||||
padding: 40px 30px;
|
||||
display: flex;
|
||||
gap: 30px;
|
||||
border: 1px solid transparent;
|
||||
transition: border 0.3s ease; // 添加过渡效果
|
||||
|
||||
// hover 时添加渐变边框
|
||||
&:hover {
|
||||
@include gradient-border($linear-gradient-start, $linear-gradient-end);
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.left {
|
||||
img {
|
||||
width: 440px;
|
||||
height: 220px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
.bottom-info,
|
||||
.right {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.right {
|
||||
flex-direction: column;
|
||||
|
||||
.title-text {
|
||||
margin-bottom: 14px;
|
||||
font-weight: 600;
|
||||
font-size: $normal-font-size;
|
||||
color: #3A4A65;
|
||||
transition: color 0.3s ease; // 添加颜色过渡效果
|
||||
|
||||
// hover 时改变标题颜色
|
||||
.card:hover & {
|
||||
color: #1890ff;
|
||||
}
|
||||
}
|
||||
|
||||
.content-text {
|
||||
font-weight: 400;
|
||||
font-size: $mid-font-size;
|
||||
color: $grey-color;
|
||||
}
|
||||
}
|
||||
|
||||
.bottom-info {
|
||||
color: #C8CFD7;
|
||||
font-size: 15px;
|
||||
|
||||
.first {
|
||||
display: flex;
|
||||
justify-content: space-between
|
||||
}
|
||||
|
||||
img {
|
||||
margin-right: 8px
|
||||
}
|
||||
|
||||
div {
|
||||
@include display-flex;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user