Files
laws-sinotruk-client/src/views/dashboard/modules/FriendLinkCard.vue
T
2023-12-27 14:56:05 +08:00

92 lines
2.0 KiB
Vue

<template>
<a-card :bordered="false">
<a-spin :spinning="loading">
<div class="top-wrapper">
<span class="left-p"><i class="iconfont icon-link left-icon"></i>友情链接</span>
<span class="right-p" @click="moreLink">更多链接<i class="iconfont icon-right"></i></span>
</div>
<div class="content-wrapper">
<div class="content-div" v-for="item in dataSource" :key="item.id" @click="clickLink(item)">
{{ item.name }}
</div>
</div>
</a-spin>
</a-card>
</template>
<script>
import { getAction } from '@/api/manage'
export default {
name: 'FriendLinkCard',
data () {
return {
loading: true,
dataSource: [],
url: {
list: '/sys/lawsFriendlyLinks/list'
}
}
},
mounted () {
this.loadData()
},
methods: {
loadData () {
this.loading = true
getAction(this.url.list, {}).then((res) => {
if (res.success) {
this.dataSource = res.result
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
// 点击更多链接
moreLink () {
this.$router.push({
path: '/isystem/friendshipLink'
})
},
// 点击链接
clickLink (record) {
const href = record.link
window.open(href)
}
}
}
</script>
<style scoped lang="less">
.content-wrapper {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
grid-gap: 20px;
margin-top: 12px;
}
.content-div {
height: 62px;
line-height: 62px;
box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.1);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 16px;
font-family: PingFang SC-Regular, PingFang SC, sans-serif;
font-weight: 400;
color: @primary-color;
text-align: center;
background-image: url('../../../assets/image/dashboardLinkBack.png');
cursor: pointer;
}
@media screen and (max-width: 1366px) {
.content-div {
height: 40px;
line-height: 40px;
}
}
</style>