yunsan-pc/src/views/home/components/ModuleNine.vue

293 lines
8.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<div class="module-nine">
<div class="module-body">
<div class="yuqing-container">
<div class="yuqing">
<!-- <div class="time">{{ time }}</div> -->
<div class="content">
<div class="columns">
<div class="column left">
<div v-for="item in leftList" :key="item.id" class="list-item">
<div class="newsNum">{{ item.originalIndex + 1 }}</div>
<div class="newsTitle">{{ item.newsTitle }}</div>
<div class="line"></div>
<div class="meta">时间:{{ item.issuePosttime }}</div>
<div class="meta1"><span>热度</span><span style="font-weight: bold; margin-left: 120px;"> {{
item.simCount }}</span></div>
<div class="zdItem" @click.stop="toggleStatus(item)">{{ item.status === '0' ? '置顶' : '取消' }}</div>
</div>
</div>
<div class="column right">
<div v-for="item in rightList" :key="item.id" class="list-item">
<div class="newsNum">{{ item.originalIndex + 1 }}</div>
<div class="newsTitle">{{ item.newsTitle }}</div>
<div class="line"></div>
<div class="meta">时间:{{ item.issuePosttime }}</div>
<div class="meta1">热度 <span style="font-weight: bold; margin-left: 120px;">{{ item.simCount }}</span>
</div>
<div class="zdItem" @click.stop="toggleStatus(item)">{{ item.status === '0' ? '置顶' : '取消' }}</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup>
import { ref, computed, onMounted } from 'vue'
const list = ref([
{ id: 1, newsTitle: '上海轨道交通22号线跨江而过,崇明自此真正融入上海主城圈', issuePosttime: '2026-11-04 9:28:44', simCount: '117', newsUrl: '', status: '0' },
{ id: 2, newsTitle: '上海地铁一家老小四人瞬间滚落成一团', issuePosttime: '2026-11-04 9:09:42', simCount: '85', newsUrl: '', status: '0' },
{ id: 3, newsTitle: '上海地铁新版纸质票出站不用塞票,你会用吗?', issuePosttime: '2026-11-04 14:02:03', simCount: '44', newsUrl: '', status: '0' },
{ id: 4, newsTitle: '上海市民将价值10万元金项链忘在地铁车厢,警方帮助寻回', issuePosttime: '2026-11-04 7:41:15', simCount: '31', newsUrl: '', status: '0' },
{ id: 5, newsTitle: '车门不是电梯门,不会弹开为你等', issuePosttime: '2026-11-04 12:37:00', simCount: '26', newsUrl: '', status: '0' },
{ id: 6, newsTitle: '世赛叠加中秋!上海地铁临时调整:多线延时运营、定点加开!', issuePosttime: '2026-11-04 8:19:00', simCount: '19', newsUrl: '', status: '0' },
{ id: 7, newsTitle: '地铁2号线是联通两个机场和一个高铁站的远行必走线路,大多数时候在世纪大道站乘客只能手提重重的行李箱上下楼梯,不知道这样安排有什么用意,地铁工作人员都是不坐地铁奔赴机场和高铁站的所以不知道普通人出行的艰难吗?@上海地铁shmetro#上海地铁世纪大道##上海地铁##上海·世纪大道(地铁站)[地点]#', issuePosttime: '2026-11-04 07:36:35', simCount: '17', newsUrl: '', status: '0' },
{ id: 8, newsTitle: '今天早上进上海地铁11号线 突然有点穿越时空隧道的感觉 这个设计的有点东西[good]', issuePosttime: '2026-11-04 07:08:51', simCount: '14', newsUrl: '', status: '0' },
{ id: 9, newsTitle: '上海地铁豫园站近日新设了9幅“诗歌进地铁”系列灯箱,这是上海地铁与上海市翻译家协会合作推出的独属于这座城市的“诗意”。', issuePosttime: '2026-11-04 09:00:00', simCount: '9', newsUrl: '', status: '0' }
])
const processedList = computed(() => list.value.map((item, index) => ({ ...item, originalIndex: index })))
const leftList = computed(() => processedList.value.filter((_, i) => i % 2 === 0))
const rightList = computed(() => processedList.value.filter((_, i) => i % 2 === 1))
const fetchData = () => {
// 模拟数据,不调用接口
console.log('模拟数据加载完成')
}
onMounted(() => {
fetchData()
setTimeout(fetchData, 1000 * 60 * 5)
})
const goUrl = (item) => window.open(item.newsUrl)
const toggleStatus = (item) => {
const newStatus = item.status === '0' ? '1' : '0'
item.status = newStatus
console.log('更新状态:', item.id, newStatus)
}
</script>
<style lang="scss" scoped>
.module-nine {
width: 934px;
height: 893.14px;
position: absolute;
left: 3850px;
top: 610px;
display: flex;
flex-direction: column;
background: url('/imgs/mninebg.png') no-repeat center center;
background-size: cover;
backdrop-filter: blur(10px);
.module-body {
flex: 1;
position: relative;
.yuqing-container {
position: absolute;
// left: 23px;
// top: 52px;
width: 97.48%;
height: 89.82%;
.yuqing {
width: 100%;
height: 100%;
// background-image: url('/imgs/yuqing/yuqingBg.png');
background-size: cover;
position: relative;
// background: yellow;
.time {
position: absolute;
top: 3px;
left: 35px;
color: #fff;
font-size: 16px;
}
.content {
position: absolute;
top: 60px;
left: 20px;
width: 944px;
height: 810px;
overflow-y: auto;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
.columns {
display: flex;
width: 100%;
.column {
flex: 1;
.list-item {
position: relative;
width: 410px;
height: 185px;
margin-bottom: 20px;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
color: #fff;
font-size: 16px;
display: flex;
align-items: center;
cursor: pointer;
// background: linear-gradient(90deg, rgba(36, 186, 255, 0.12) 0%, rgba(36, 186, 255, 0) 100%);
// background-color: yellow;
&:hover {
opacity: 0.9;
}
}
}
}
}
}
}
}
}
.left .list-item {
background-image: url('/imgs/itembg.png');
}
.right .list-item {
background-image: url('/imgs/itembg.png');
}
.newsNum {
padding-top: 6px;
position: absolute;
top: 14px;
left: 20px;
color: red;
font-size: 14px;
width: 27px;
height: 32px;
text-align: center;
background-image: url('/imgs/hot.png');
background-size: contain;
background-repeat: no-repeat;
background-position: center;
line-height: 32px;
}
.newsTitle {
position: absolute;
top: 20px;
left: 60px;
width: 320px;
font-weight: bold;
line-height: 20px;
display: -webkit-box;
line-clamp: 2;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
letter-spacing: 2px;
//
}
.line {
position: absolute;
top: 74px;
left: 20px;
width: 375px;
height: 2px;
// background-color: #415C71;
border: 1px solid #5F83A0;
}
.left .newsTitle {
left: 60px;
}
.right .newsTitle {
left: 60px;
}
.meta {
position: absolute;
color: #A4A4A4;
font-size: 18px;
margin-left: 20px;
line-height: 24px;
margin-top: 15px;
}
.meta1 {
margin-top: 80px;
position: absolute;
color: #E0E0E0;
font-size: 18px;
margin-left: 20px;
font-size: 18px;
font-weight: 500;
line-height: 24px;
}
.left .meta:nth-of-type(1) {
top: 105px;
left: 100px;
}
.left .meta:nth-of-type(2) {
top: 105px;
left: 200px;
}
.right .meta:nth-of-type(1) {
top: 105px;
left: 100px;
}
.right .meta:nth-of-type(2) {
top: 105px;
left: 200px;
}
.zdItem {
position: absolute;
top: 120px;
left: 350px;
width: 60px;
height: 24px;
border: 1px solid #29F0FA;
border-radius: 4px;
font-size: 14px;
font-weight: bold;
line-height: 24px;
text-align: center;
cursor: pointer;
user-select: none;
}
.left .zdItem {
left: 320px;
}
.right .zdItem {
left: 320px;
}
</style>