Files
x-forend/src/pages-sub/hot-news/index.vue
T
2025-01-14 12:10:43 +08:00

51 lines
1.3 KiB
Vue

<route lang="json5" type="page">
{
style: {
navigationBarTitleText: '热点新闻',
navigationStyle: 'custom',
},
}
</route>
<template>
<view class="hot-news-page min-h-screen px-15 pb-100">
<NavBar title-color="#333" />
<view class="bg-#fff rounded-10 px-15 py-15 mt-15" v-if="newsList.length > 0">
<view
class="flex mb-15"
v-for="item in newsList"
:key="item.id"
@click="handleNewsDetail(item.id)"
>
<image class="w-85 h-85 rounded-10" :src="item.image" mode="aspectFill" />
<view class="ml-15 flex-1 flex flex-col justify-between">
<view text-14>{{ item.name }}</view>
<view class="text-12 text-#999">{{ formatTime(item.createtime) }}</view>
</view>
</view>
</view>
<wd-status-tip v-else image="content" tip="暂无内容" />
</view>
</template>
<script setup lang="ts">
import NavBar from '@/components/NavBar.vue'
import { getIntroductionAPI } from '@/service'
import { formatTime } from '@/utils'
const { list: newsList } = useListPageRequest((params) =>
getIntroductionAPI({ type: 1, ...params }),
)
const handleNewsDetail = (id: number) => {
uni.navigateTo({
url: `/pages-sub/news-detail/index?id=${id}`,
})
}
</script>
<style scoped>
.hot-news-page {
background: linear-gradient(180deg, #fff3eb 0%, #ffffff 100%);
}
</style>