1
0
mirror of https://github.com/ialley-workshop-open/uni-halo.git synced 2026-07-27 04:20:43 +08:00
Files
uni-halo/src/pages/moments/moments.vue
T
小莫唐尼 7d74a40f51 style: 调整多处UI样式与布局细节
1. 修改项目概览文档标题
2. 将详情按钮文字大小从11px改为text-xs
3. 移除分类标签右侧的多余内边距
4. 关闭首页列表加载loading弹窗
5. 调整友链项的间距与头像尺寸
2026-06-13 00:37:17 +08:00

157 lines
5.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script lang="ts" setup>
import { cover } from '@/utils/imageHelper'
import { copy } from '@/utils/base/clipboard'
import { queryMoments } from '@/api/halo-plugin/moment'
import { timeFrom } from '@/utils/base/timeFrom'
import { timeFormat } from '@/utils/base/timeFormat'
defineOptions({
name: 'Moments',
})
definePage({
style: {
navigationBarTitleText: '瞬间',
navigationBarBackgroundColor: '#ffffff',
enablePullDownRefresh: true,
},
})
const { loading, error, data, run } = useRequest<any, IPaginationParams>(queryMoments, { loadingToast: false, loadingToastContent: '加载中...', loadingToastMask: true })
const { list: moments, refresh } = useListData<any>({
params: {
page: 1,
size: 10,
},
loading: toRef(loading),
onPullDownRefresh: async (params, updateData) => {
await run({ ...params })
updateData({
error: error.value,
hasNext: data.value?.hasNext,
items: data.value?.items ?? [],
})
},
onReachBottom: async (params, updateData) => {
await run({ ...params })
updateData({
error: error.value,
hasNext: data.value?.hasNext,
items: data.value?.items ?? [],
})
},
})
onLoad(() => {
refresh()
})
onMounted(() => {
})
onPageScroll(() => { })
</script>
<template>
<view class="min-h-screen w-full flex flex-col bg-page2">
<!-- 瞬间列表 -->
<view v-if="moments.length !== 0" class="box-border w-full flex flex-col gap-y-4 overflow-hidden p-4 pb-0">
<view v-for="moment in moments" :key="moment.metadata.name" class="flex">
<!-- 左边区域 -->
<view class="relative h-auto w-4 flex shrink-0 items-center justify-center">
<view class="uh-shadow-md h-full w-2px bg-white" />
<view
class="uh-shadow-md absolute left-1/2 top-0 box-border h-4 w-4 border-2 border-white rounded-full border-solid bg-[#1A1A1A]"
:style="{
transform: 'translateX(-50%)',
}"
/>
</view>
<!-- 瞬间卡片 -->
<view class="box-border flex-1 pl-2">
<view class="mb-2 text-sm text-gray-900 font-semibold">
{{ timeFormat(moment.spec.releaseTime) }}
</view>
<view
class="uh-shadow-card box-border w-full flex flex-1 flex-col items-center justify-center gap-y-2 overflow-hidden border-2 border-white rounded-xl border-solid bg-white p-4"
>
<!-- 用户信息 -->
<view class="box-border w-full flex items-center justify-between gap-x-4">
<view
class="uh-shadow-md box-border h-8 w-8 shrink-0 overflow-hidden border-2 border-white rounded-xl border-solid bg-white"
>
<image :src="cover(moment.owner.avatar)" mode="aspectFill" class="h-full w-full" />
</view>
<view class="flex flex-1 flex-col gap-y-1">
<view class="text-sm text-gray-900 font-bold">
{{ moment.owner.displayName }}
</view>
<view v-if="false" class="text-xs text-gray-400">
{{ timeFrom(moment.spec.releaseTime) }}
</view>
</view>
<view class="shrink-0">
<view
class="uh-shadow-md rounded-3xl bg-[#1A1A1A] px-4 py-1.5 text-xs text-white"
>
详情
</view>
</view>
</view>
<!-- 瞬间内容 -->
<view class="line-clamp-6 w-full text-xs text-gray-900 leading-relaxed">
<rich-text :nodes="moment.spec.content.raw" />
</view>
<!-- 瞬间附件 -->
<view class="w-full">
<!-- 如果有附件 -->
</view>
<!-- 分割线 -->
<view class="h-1px w-full bg-gray-50" />
<!-- 底部信息标签时间点赞数评论数 -->
<view class="w-full flex items-center justify-between gap-x-2 text-xs text-gray-500 leading-relaxed">
<template v-if="moment.spec.tags.length !== 0">
<view class="shrink-0">
<view
v-for="tag in moment.spec.tags" :key="tag"
class="text-xs text-gray-600"
>
{{ tag }}
</view>
</view>
<view class="shrink-0 text-xs text-gray-600">
·
</view>
</template>
<view class="text-[11px] text-gray-600">
点赞 {{ moment.stats.upvote }}
</view>
<view class="shrink-0 text-xs text-gray-600">
·
</view>
<view class="text-[11px] text-gray-600">
评论 {{ moment.stats.totalComment }}
</view>
</view>
</view>
</view>
</view>
</view>
<view v-else class="w-full flex flex-1 items-center justify-center">
<wd-empty icon="no-content" tip="暂无瞬间">
<template #image>
<wd-icon name="empty" color="#1A1A1A" :size="52" />
</template>
</wd-empty>
</view>
<!-- 底部导航占位 -->
<view class="w-full shrink-0">
<uh-tabbar-page-placeholder />
</view>
</view>
</template>