This commit is contained in:
toom1996
2025-07-30 18:54:36 +08:00
parent 66b8fe65c0
commit d01035d9f2
3 changed files with 87 additions and 34 deletions

View File

@ -25,7 +25,7 @@ const {
breadcrumb = Astro.locals?.column_data?.item || [{ title: "资讯", link: "/news" }], // 面包屑导航
filter = Astro.locals?.column_data?.filter || [], // 文章筛选条件
} = Astro.props;
const { code, data, total = 0, hot } = await newsIndex(config.id, limit, page, filter);
const { code, data, total = 0, hot, guess } = await newsIndex(config.id, limit, page, filter);
if (data.length == 0 || code !== 0) {
return Astro.redirect("/404");
}
@ -116,44 +116,86 @@ if (data.length == 0 || code !== 0) {
/>
</div>
</div>
<div class="slide-container">
<div class="widget widget-tie divPrevious">
<h3>热门文章</h3>
<ul>
{
hot?.map((item, index) => {
return (
<li class={`previous-${index + 1}`}>
<div class="previous-one-img">
<a
href={`/news/${item.id}`}
title={item.title}
>
<Image
loading="eager"
src={item.cover}
alt={item.title}
height={100}
width={100}
/>
</a>
</div>
<div class="previous-recent-title">
<h4 class="title">
<div>
<div class="slide-container" style="padding-bottom:unset">
<div class="widget widget-tie divPrevious">
<h3>热门文章</h3>
<ul>
{
hot?.map((item, index) => {
return (
<li class={`previous-${index + 1}`}>
<div class="previous-one-img">
<a
href={`/news/${item.id}`}
title={item.title}
>
{item.title}
<Image
loading="eager"
src={item.cover}
alt={item.title}
height={100}
width={100}
/>
</a>
</h4>
<span class="info">{item.created_at}</span>
</div>
</li>
);
})
}
</ul>
</div>
<div class="previous-recent-title">
<h4 class="title">
<a
href={`/news/${item.id}`}
title={item.title}
>
{item.title}
</a>
</h4>
<span class="info">{item.created_at}</span>
</div>
</li>
);
})
}
</ul>
</div>
</div>
<div class="slide-container" style="padding-top:unset">
<div class="widget widget-tie divPrevious">
<h3>猜你喜欢</h3>
<ul>
{
guess?.map((item, index) => {
return (
<li class={`previous-${index + 1}`}>
<div class="previous-one-img">
<a
href={`/news/${item.id}`}
title={item.title}
>
<Image
loading="eager"
src={item.cover}
alt={item.title}
height={100}
width={100}
/>
</a>
</div>
<div class="previous-recent-title">
<h4 class="title">
<a
href={`/news/${item.id}`}
title={item.title}
>
{item.title}
</a>
</h4>
<span class="info">{item.created_at}</span>
</div>
</li>
);
})
}
</ul>
</div>
</div>
</div>
</main>

View File

@ -155,6 +155,11 @@ const bytedanceData = formatDate(data.created_at)
})(window)
</script>
<style is:inline>
.image-wrapper {
text-align: center;
}
@media (min-width: 1200px) and (max-width: 1500px) {
.header_full_banner {
padding-left: 125px;

View File

@ -41,6 +41,12 @@ export async function newsIndex(websiteId:number = 0, limit:number = 10, page:nu
title: string
created_at: string
}[]
guess: {
cover: string
id: string
title: string
created_at: string
}[]
}>{
const client = getRpcClient()
const result = await client.call('news/index', {