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

View File

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

View File

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