|
|
|
@ -2,39 +2,41 @@ |
|
|
|
|
<div class="container"> |
|
|
|
|
<div class="news-list"> |
|
|
|
|
<div class="item" v-for="i in newList" :key="i"> |
|
|
|
|
<div class="left"><div class="year">{{ i.publishTime.split('-')[0] }}-{{ i.publishTime.split('-')[1] }}</div><div class="day">{{ i.publishTime.split(' ')[0].split('-')[2] }}</div></div> |
|
|
|
|
<div class="left" |
|
|
|
|
><div class="year">{{ i.publishTime.split('-')[0] }}-{{ i.publishTime.split('-')[1] }}</div |
|
|
|
|
><div class="day">{{ i.publishTime.split(' ')[0].split('-')[2] }}</div></div |
|
|
|
|
> |
|
|
|
|
<div class="right"> |
|
|
|
|
<div class="title">{{ i.title }}</div> |
|
|
|
|
<div class="editor">{{ i.source }}</div> |
|
|
|
|
<div class="description" |
|
|
|
|
><div v-html="i.info"></div></div |
|
|
|
|
> |
|
|
|
|
<div class="get-info">查看详情</div> |
|
|
|
|
<div class="description"><div v-html="i.info"></div></div> |
|
|
|
|
<div class="get-info" @click="onGetInfo(i)">查看详情</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<!-- 分页 --> |
|
|
|
|
<div class="pagination"> <Pagination :current="current" :pageSize="page.pageSize" :total="total" show-less-items @change="onChange" /></div> |
|
|
|
|
<!-- 分页 --> |
|
|
|
|
<div class="pagination"> <Pagination :current="current" :pageSize="page.pageSize" :total="total" show-less-items @change="onChange" /></div> |
|
|
|
|
</div> |
|
|
|
|
<!-- 栏目 --> |
|
|
|
|
<div class="column-list"> |
|
|
|
|
<div class="title">栏目列表</div> |
|
|
|
|
<div class="list"> |
|
|
|
|
<div class="item">全部</div> |
|
|
|
|
<div class="item" @click="getindexallarticleEvent">全部</div> |
|
|
|
|
<div class="item" v-for="i in newColumnList" :key="i.id" @click="getMyNewsList(i)">{{ i.name }}</div> |
|
|
|
|
<!-- <div class="item">项目申报</div> |
|
|
|
|
<div class="item">新闻列表</div> --> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script setup> |
|
|
|
|
import { Pagination } from 'ant-design-vue'; |
|
|
|
|
|
|
|
|
|
import { getindexcolumn, getindexarticle } from '@/api/mainHome'; |
|
|
|
|
import { getindexcolumn, getindexarticle, getindexallarticle } from '@/api/mainHome'; |
|
|
|
|
import { ref } from 'vue'; |
|
|
|
|
import { useRouter } from 'vue-router'; |
|
|
|
|
|
|
|
|
|
const router = useRouter(); |
|
|
|
|
const current = ref(1); |
|
|
|
|
const total = ref(0); |
|
|
|
|
const page = ref({ |
|
|
|
@ -55,15 +57,39 @@ |
|
|
|
|
}; |
|
|
|
|
const newList = ref([]); |
|
|
|
|
const getindexarticleEvent = async (id) => { |
|
|
|
|
columnId.value = id; |
|
|
|
|
const res = await getindexarticle({ columnId: id, ...page.value }); |
|
|
|
|
console.log(res); |
|
|
|
|
newList.value = res.records; |
|
|
|
|
total.value = res.total; |
|
|
|
|
}; |
|
|
|
|
const columnId = ref(''); |
|
|
|
|
const onChange = (page) => { |
|
|
|
|
console.log(page); |
|
|
|
|
page.pageNo = page; |
|
|
|
|
getindexarticleEvent(); |
|
|
|
|
if (columnId.value) { |
|
|
|
|
getindexarticleEvent(columnId.value); |
|
|
|
|
} else { |
|
|
|
|
getindexallarticleEvent(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
const getindexallarticleEvent = async () => { |
|
|
|
|
const res = await getindexallarticle(); |
|
|
|
|
console.log(res); |
|
|
|
|
newList.value = res.records; |
|
|
|
|
total.value = res.total; |
|
|
|
|
}; |
|
|
|
|
getindexallarticleEvent(); |
|
|
|
|
|
|
|
|
|
// 查看详情 |
|
|
|
|
const onGetInfo = (item) => { |
|
|
|
|
console.log(item); |
|
|
|
|
router.push({ |
|
|
|
|
path: '/main-home/newsInfo', |
|
|
|
|
query: { |
|
|
|
|
id: item.id, |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
@ -79,6 +105,7 @@ |
|
|
|
|
width: calc(1200px - 415px); |
|
|
|
|
margin-right: 30px; |
|
|
|
|
min-height: 755px; |
|
|
|
|
padding-bottom: 80px; |
|
|
|
|
.item { |
|
|
|
|
display: flex; |
|
|
|
|
width: 100%; |
|
|
|
@ -168,14 +195,14 @@ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.pagination { |
|
|
|
|
// background-color: #fff; |
|
|
|
|
position: absolute; |
|
|
|
|
bottom: 0; |
|
|
|
|
left: 50%; |
|
|
|
|
transform: translateX(-50%); |
|
|
|
|
margin-top: 20px; |
|
|
|
|
height: 70px; |
|
|
|
|
display: flex; |
|
|
|
|
justify-content: center; |
|
|
|
|
} |
|
|
|
|
// background-color: #fff; |
|
|
|
|
position: absolute; |
|
|
|
|
bottom: -20px; |
|
|
|
|
left: 50%; |
|
|
|
|
transform: translateX(-50%); |
|
|
|
|
margin-top: 20px; |
|
|
|
|
height: 70px; |
|
|
|
|
display: flex; |
|
|
|
|
justify-content: center; |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|