183 lines
5.5 KiB
JavaScript
183 lines
5.5 KiB
JavaScript
const jcdt = {
|
|
template: /*language=HTML*/ `
|
|
<div class="jcdt-wrapper">
|
|
<div class="jcdt-container">
|
|
<el-carousel height="360px" :interval="10000" indicator-position="none">
|
|
<el-carousel-item v-for="item,index in list" :key="index">
|
|
<div class="jcdt-title">
|
|
<span>{{ item.label }}</span>
|
|
</div>
|
|
<div class="jcdt-content">
|
|
<div class="jcdt-list">
|
|
<div class="jcdt-item" v-for="o,i in item.value" :key="i" @click="onLink(o)">
|
|
<div class="date" v-if="o.time">
|
|
<i class="el-icon-alarm-clock"></i>
|
|
<span>{{o.time}}</span>
|
|
</div>
|
|
<div style="display: flex; align-items: center">
|
|
<div>
|
|
|
|
</div>
|
|
<div class="title">{{o.text}}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</el-carousel-item>
|
|
</el-carousel>
|
|
</div>
|
|
</div>
|
|
`,
|
|
data() {
|
|
return {}
|
|
},
|
|
props: {
|
|
list: {
|
|
type: Array,
|
|
default: []
|
|
}
|
|
},
|
|
methods: {
|
|
onLink(item) {
|
|
const url = this.isHttpOrHttps(item.href) ? item.href : "https://xgh.cug.edu.cn/" + item.href
|
|
window.open(url)
|
|
},
|
|
isHttpOrHttps(url) {
|
|
return /^(http:\/\/|https:\/\/)/i.test(url)
|
|
}
|
|
},
|
|
style: /*language=CSS*/ `
|
|
.jcdt-wrapper {
|
|
width: 100%;
|
|
background-size: cover;
|
|
background-position: center;
|
|
background-repeat: no-repeat;
|
|
}
|
|
|
|
.jcdt-container {
|
|
width: 80%;
|
|
max-width: 80%;
|
|
margin: 0 auto 10px;
|
|
background-color: #FFFFFF;
|
|
border-radius: 12px;
|
|
padding: 20px;
|
|
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
|
|
}
|
|
|
|
/deep/ .jcdt-title{
|
|
font-size: 30px;
|
|
color: #000000;
|
|
display: block;
|
|
font-weight: bold;
|
|
position: relative;
|
|
text-align: center;
|
|
padding: 20px 0;
|
|
}
|
|
|
|
/deep/ .jcdt-container .jcdt-title span::before {
|
|
content: '';
|
|
width: 24px;
|
|
height: 11px;
|
|
background: url(https://www.ncu.edu.cn/images/titl.svg) no-repeat center;
|
|
background-size: 24px 11px;
|
|
display: inline-block;
|
|
margin-right: 0;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
/deep/ .jcdt-container .jcdt-title span::after {
|
|
content: '';
|
|
width: 24px;
|
|
height: 11px;
|
|
background: url(https://www.ncu.edu.cn/images/titr.svg) no-repeat center;
|
|
background-size: 24px 11px;
|
|
display: inline-block;
|
|
margin-left: 0;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
/deep/ .jcdt-list {
|
|
display: grid;
|
|
grid-template-columns: repeat(4, 1fr);
|
|
gap: 20px;
|
|
}
|
|
|
|
/deep/ .jcdt-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding: 16px;
|
|
border: none;
|
|
border-bottom: 3px solid transparent;
|
|
transition: all 0.3s ease;
|
|
cursor: pointer;
|
|
height: auto;
|
|
border-radius: 12px;
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
|
border-bottom-color: var(--color-primary);
|
|
background: #ffffff;
|
|
}
|
|
|
|
/deep/ .jcdt-item:hover{
|
|
transform: translateY(-4px);
|
|
}
|
|
|
|
/deep/ .jcdt-item .date {
|
|
font-size: 20px;
|
|
font-weight: bold;
|
|
white-space: nowrap;
|
|
text-align: left;
|
|
margin-bottom: 8px;
|
|
transition: opacity 0.3s ease;
|
|
}
|
|
|
|
/deep/ .jcdt-item .title {
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
/*margin-bottom: 12px;*/
|
|
line-height: 1.4;
|
|
display: -webkit-box;
|
|
-webkit-line-clamp: 2;
|
|
-webkit-box-orient: vertical;
|
|
overflow: hidden;
|
|
/*height: 45px;*/
|
|
}
|
|
|
|
/deep/ .jcdt-item .image {
|
|
width: 100%;
|
|
height: 180px;
|
|
margin: 0 0 16px 0;
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
background: #f5f5f5;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
transition: transform 0.3s ease;
|
|
}
|
|
|
|
/deep/ .jcdt-item .image img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
transition: transform 0.3s ease;
|
|
}
|
|
|
|
/deep/ .jcdt-item .summary {
|
|
font-size: 14px;
|
|
color: #666;
|
|
line-height: 1.6;
|
|
display: -webkit-box;
|
|
-webkit-line-clamp: 3;
|
|
-webkit-box-orient: vertical;
|
|
overflow: hidden;
|
|
text-align: justify;
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
/deep/ .jcdt-item i {
|
|
color: #007aff;
|
|
}
|
|
`
|
|
};
|