1
0
mirror of https://github.com/ialley-workshop-open/uni-halo.git synced 2026-11-13 22:11:42 +08:00

feat&refactor: 完成项目多轮优化与功能迭代

1. 调整开发环境与生产环境接口地址为局域网地址
2. 新增页面滚动监听hook、版权组件与小尺寸阴影工具类
3. 优化多处组件样式、导航栏与tabbar配置
4. 重构恋爱模块配置类型与移除冗余接口
5. 修复多处代码细节与优化用户体验
This commit is contained in:
小莫唐尼
2026-09-12 22:33:50 +08:00
parent 885646ec0c
commit e5e3ad3d8b
74 changed files with 2262 additions and 2238 deletions
-266
View File
@@ -1,266 +0,0 @@
<script lang="ts" setup>
/**
* 关于页
* 功能:博主信息 + 站点统计 + 功能导航 + 版权
* 风格:对齐全站设计语言(bg-page + uh-global-card-glass + uh-section-title + 彩色图标块)
*/
import { computed, ref, watch } from 'vue'
import { onPullDownRefresh, onShow } from '@dcloudio/uni-app'
import { getBlogStatistics } from '@/api/halo'
import { useAppConfigStore } from '@/store/appConfig'
import { useFavoritesStore } from '@/store/favorites'
import { NeedPluginIds } from '@/hooks/usePluginAvailable'
import { checkAvatarUrl, checkImageUrl } from '@/utils/url'
import { checkHasAdminLogin } from '@/utils/auth'
import { t } from '@/locale'
import type { IBlogStats } from '@/api/types/halo'
definePage({
style: {
navigationBarTitleText: '关于',
enablePullDownRefresh: true,
navigationStyle: 'custom',
},
})
const appConfigStore = useAppConfigStore()
const favoritesStore = useFavoritesStore()
const haloConfigs = computed(() => appConfigStore.configs)
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
/** 数据看板插件可用性(供导航项显隐判断,参考 gallery 对象传参模式) */
const { check: checkDataVisualPlugin } = usePluginAvailable({
pluginId: NeedPluginIds.PluginDataStatistics,
})
/** 投票插件可用性(投票中心导航项显隐) */
const { check: checkVotePluginAvailable } = usePluginAvailable({
pluginId: NeedPluginIds.PluginVote,
})
/** 链接插件可用性(友情链接导航项显隐) */
const { check: checkLinksPluginAvailable } = usePluginAvailable({
pluginId: NeedPluginIds.PluginLinks,
})
/* ---------------- 计算属性 ---------------- */
const bloggerInfo = computed(() => {
const blogger = haloConfigs.value.authorConfig?.blogger as
| { nickname ?: string, avatar ?: string, description ?: string }
| undefined
return {
nickname: blogger?.nickname || '',
avatar: checkAvatarUrl(blogger?.avatar),
description: blogger?.description || '',
}
})
const pageConfig = computed(() => haloConfigs.value.pageConfig?.aboutConfig as
| { bgImageUrl ?: string, waveImageUrl ?: string, copyrightConfig ?: { enabled ?: boolean, content ?: string } }
| undefined)
const calcProfileStyle = computed(() => ({
backgroundImage: `url(${checkImageUrl(pageConfig.value?.bgImageUrl)})`,
}))
const calcWaveUrl = computed(() => checkImageUrl(pageConfig.value?.waveImageUrl))
const copyrightConfig = computed(() => pageConfig.value?.copyrightConfig)
/* ---------------- 状态 ---------------- */
const statistics = ref<IBlogStats>({ post: 0, comment: 0, category: 0, visit: 0, upvote: 0 })
/** 主行统计*/
const allStats = computed(() => [
{ key: 'post', label: '内容', value: statistics.value.post },
{ key: 'visit', label: '访客', value: statistics.value.visit },
{ key: 'category', label: '分类', value: statistics.value.category },
{ key: 'comment', label: '评论', value: statistics.value.comment },
{ key: 'upvote', label: '点赞', value: statistics.value.upvote },
])
interface INavItem {
key : string
title : string
iconPrefix ?: string
icon : string
bgColor : string
color ?: string
subTitle ?: string
path : string | null
openType ?: string
show : boolean
group : 'blog' | 'more'
}
interface IMyPageEntry {
key ?: string
title ?: string
subTitle ?: string
color ?: string
bgColor ?: string
iconPrefix ?: string
icon ?: string
path ?: string
visible ?: boolean
}
const configuredFeatures = computed(() => {
const mp = haloConfigs.value.pageConfig?.myPageConfig as
| { commonFeatures ?: IMyPageEntry[], otherFeatures ?: IMyPageEntry[] }
| undefined
if (!mp || (!mp.commonFeatures?.length && !mp.otherFeatures?.length)) {
return null
}
return mp
})
const navList = ref<INavItem[]>([])
/** 分组渲染(过滤后空组整组隐藏;组标题对齐插件端:常用功能/其他功能) */
const calcNavGroups = computed(() => {
const visible = navList.value.filter(n => n.show)
const groupDefs : { key : 'blog' | 'more', title : string }[] = [
{ key: 'blog', title: '常用功能' },
{ key: 'more', title: '其他功能' },
]
return groupDefs
.map(def => ({ ...def, items: visible.filter(n => n.group === def.key) }))
.filter(group => group.items.length > 0)
})
/* ---------------- 功能导航 ---------------- */
async function handleGetNavList() {
// 配置模式:插件端 myPageConfig 两组(常用功能→blog、其他功能→more),
// 未配置/为空时回退本地内置默认(保留原显隐推导)
const mp = configuredFeatures.value
if (mp) {
const mapEntry = (e : IMyPageEntry, group : 'blog' | 'more') : INavItem | null => {
if (!e.key) { return null }
return {
key: e.key,
title: e.title || '',
iconPrefix: e.iconPrefix,
icon: e.icon || '',
bgColor: e.bgColor || '#969696F2',
color: e.color,
subTitle: e.subTitle || '',
path: e.path || null,
show: e.visible !== false,
group,
}
}
navList.value = [
...(mp.commonFeatures || []).map(e => mapEntry(e, 'blog')).filter((n) : n is INavItem => n !== null),
...(mp.otherFeatures || []).map(e => mapEntry(e, 'more')).filter((n) : n is INavItem => n !== null),
]
return
}
const [dataVisualAvailable, voteAvailable, linksAvailable] = await Promise.all([
checkDataVisualPlugin(),
checkVotePluginAvailable(),
checkLinksPluginAvailable(),
])
}
/* ---------------- 数据加载 ---------------- */
async function handleGetData() {
try {
const res = await getBlogStatistics()
statistics.value = res.data
}
catch (err) {
console.error('获取统计失败', err)
uni.showToast({ icon: 'none', title: t('common.loadFailedRetry') })
}
finally {
uni.stopPullDownRefresh()
}
}
/* ---------------- 交互 ---------------- */
function handleOnNav(data : { path : string | null, isAdmin ?: boolean }) {
const { path, isAdmin } = data
if (!path)
return
uni.navigateTo({ url: path })
}
/* ---------------- 生命周期 ---------------- */
watch(haloConfigs, () => {
handleGetNavList()
}, { deep: true, immediate: true })
handleGetData()
onPullDownRefresh(() => {
handleGetData()
})
</script>
<template>
<view class="box-border min-h-screen w-screen bg-page pb-8">
<!-- 头部:博主信息(背景图 + 遮罩 + wave,内容区做状态栏适配) -->
<view class="blogger-info relative h-76 w-full bg-cover bg-no-repeat" :style="[calcProfileStyle]">
<!-- 背景遮罩 -->
<view class="absolute left-0 top-0 z-0 h-full w-full bg-black/30 backdrop-blur-[2rpx]" />
<view class="relative z-6 h-full flex flex-col items-center justify-center pb-[140rpx] pt-safe">
<image class="uh-global-card-glass h-20 w-20 rounded-full" :src="bloggerInfo.avatar"
mode="aspectFill" />
<view class="mt-4 text-lg text-white font-bold text-shadow-[0_2rpx_8rpx_rgba(0,0,0,0.4)]">
{{ bloggerInfo.nickname }}
</view>
<view
class="desc mt-2 px-10 text-center text-[26rpx] text-white/90 leading-relaxed text-shadow-[0_2rpx_8rpx_rgba(0,0,0,0.4)]">
{{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }}
</view>
</view>
<image v-if="calcWaveUrl" :src="calcWaveUrl" mode="scaleToFill"
class="gif-wave absolute bottom-0 left-0 z-99 h-[100rpx] w-full" style="mix-blend-mode: screen;" />
</view>
<!-- 站点统计 -->
<view class="uh-global-card-glass uh-shadow-xs relative z-100 mx-4 flex border rounded-2xl -mt-12">
<view v-for="item in allStats" :key="item.key" class="flex-1 py-4 text-center">
<wd-count-to :key="`${item.key}-${item.value}`" :start-val="0" :end-val="item.value" :duration="900"
separator="" color="#111827" custom-class="text-lg font-bold" />
<view class="mt-1 text-xs text-gray-500">
{{ item.label }}
</view>
</view>
</view>
<!-- 功能导航-->
<template v-for="group in calcNavGroups" :key="group.key">
<uh-section-title class="mx-4 mb-3 mt-8">
{{ group.title }}
</uh-section-title>
<view class="uh-global-card-glass mx-4 overflow-hidden rounded-2xl">
<view v-for="(nav, index) in group.items" :key="nav.key"
class="nav-item flex items-center justify-between px-4"
:class="index < group.items.length - 1 ? 'border-b border-b-solid border-black/5' : ''"
@click="handleOnNav(nav)">
<view class="nav-left flex items-center gap-3 py-3">
<view
class="uh-global-card-glass border uh-shadow-xs h-8 w-8 flex items-center justify-center rounded-xl"
:style="{ backgroundColor: nav.bgColor }">
<wd-icon :class-prefix="nav.iconPrefix" :name="nav.icon" size="36rpx" />
</view>
<text class="nav-title text-sm text-gray-900 font-bold"
:style="{color:nav.color}">{{ nav.title }}</text>
</view>
<view class="nav-right flex items-center gap-2">
<text class="nav-right-text text-xs text-gray-400">{{ nav.subTitle }}</text>
<wd-icon name="arrow-right" size="24rpx" class="text-gray-400" />
</view>
</view>
</view>
</template>
<!-- 版权 -->
<view v-if="copyrightConfig?.enabled" class="mt-6 px-6 text-center text-xs text-gray-400">
<view>{{ copyrightConfig.content }}</view>
</view>
</view>
</template>
+6 -2
View File
@@ -5,6 +5,7 @@
import { useAppConfigStore } from '@/store/appConfig'
import { checkThumbnailUrl } from '@/utils/url'
import { sleep } from '@/utils/common'
import { usePageScroll } from '@/hooks/usePageScroll'
import { t } from '@/locale'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import type { ICategory } from '@/api/types/halo'
@@ -18,7 +19,10 @@
},
})
const { scrollY } = usePageScroll()
const appConfigStore = useAppConfigStore()
const haloConfigs = computed(() => appConfigStore.configs)
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
@@ -158,7 +162,7 @@
<template>
<view class="box-border min-h-screen w-screen flex flex-col bg-page">
<uh-navbar :use-back="false" default-title="分类" title-color="text-gray-900"></uh-navbar>
<uh-navbar :scroll-y="scrollY" :use-back="false" default-title="分类" title-color="text-gray-900"></uh-navbar>
<uh-data-loading v-if="loadingStatus !== DataLoadingStatusEnum.Success" :loading-status="loadingStatus" />
@@ -171,7 +175,7 @@
<view
class="absolute bottom-0 left-0 h-[140rpx] w-full from-black/0 to-black/30 bg-gradient-to-b" />
<view class="absolute bottom-0 left-0 box-border w-full flex flex-col gap-1 p-2.5">
<text class="truncate text-sm text-white font-bold">
<text class="truncate text-2xs text-white font-bold">
{{ item.spec.displayName }}
</text>
<text class="text-xs text-white opacity-80">
+8 -5
View File
@@ -5,8 +5,10 @@
import { useAppConfigStore } from '@/store/appConfig'
import { checkImageUrl } from '@/utils/url'
import { usePluginAvailable } from '@/hooks/usePluginAvailable'
import { usePageScroll } from '@/hooks/usePageScroll'
import { sleep } from '@/utils/common'
import { t } from '@/locale'
import { isWechat } from '@/utils/platform'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import type { IPhoto, IPhotoGroup } from '@/api/types/halo'
@@ -18,6 +20,7 @@
},
})
const { scrollY } = usePageScroll()
const appConfigStore = useAppConfigStore()
const haloConfigs = computed(() => appConfigStore.configs)
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
@@ -207,17 +210,17 @@
</script>
<template>
<view class="box-border min-h-screen w-screen flex flex-col bg-page pb-6">
<uh-navbar :use-back="false" default-title="我的图库" title-color="text-gray-900"></uh-navbar>
<view class="box-border min-h-screen w-screen flex flex-col bg-page">
<uh-navbar :scroll-y="scrollY" :use-back="false" default-title="我的图库" title-color="text-gray-900"></uh-navbar>
<uh-plugin-unavailable v-if="!uniHaloPluginAvailable" :plugin-id="pluginId" :error-text="tips"
:checking="checking" @on-refresh="checkPluginAvailable" />
<template v-else>
<wd-sticky v-if="category.list.length!==0" class="w-full">
<wd-sticky v-if="category.list.length!==0" class="w-full" :offset-top="isWechat?56:0">
<scroll-view :scroll-x="true" class="w-full whitespace-nowrap pt-2">
<view v-for="(cate, index) in category.list" :key="cate.spec.displayName"
class="uh-global-card-glass uh-shadow-xs mb-1 ml-3 inline-flex border rounded-2xl px-4 py-1 text-sm"
class="uh-global-card-glass uh-shadow-xs mb-1 ml-3 inline-flex border rounded-2xl px-4 py-1.5 text-2xs"
:class="{ 'bg-primary text-gray-900 font-bold': index === category.activeIndex }"
@click="handleGetDataByCategory(index, cate)">
{{ cate.spec.displayName }}
@@ -231,7 +234,7 @@
<uh-data-loading v-if="loadingStatus !== DataLoadingStatusEnum.Success" :loading-status="loadingStatus"
@refresh="handleGetCategory" />
<view v-else class="box-border w-full p-3">
<view v-else class="box-border w-full p-3 pb-0">
<view class="grid grid-cols-2 gap-2.5">
<view v-for="(item, index) in dataList" :key="index"
class="relative uh-global-card-glass h-38 w-full overflow-hidden rounded-xl">
+19 -21
View File
@@ -13,7 +13,6 @@
definePage({
style: {
navigationBarTitleText: '首页',
enablePullDownRefresh: true,
navigationStyle: 'custom',
},
@@ -241,29 +240,27 @@
<uh-home-category />
<!-- 最新文章 -->
<uh-section-title class="mb-4 box-border px-3">
最新推荐
<template #right>
<view class="flex items-center gap-2">
<!-- 推荐模式分段器:默认 / 置顶 / 最新 -->
<view class="uh-global-card-glass uh-shadow-xs flex items-center border rounded-lg p-0.5">
<view v-for="tab in recommendTabs" :key="tab.value" class="rounded-md px-2 py-0.5 text-xs"
:class="recommendMode === tab.value ? 'bg-secondary text-gray-900' : 'text-gray-500'"
@click="handleRecommendModeChange(tab.value as 'default' | 'pinned' | 'latest' | 'oldest')">
{{ tab.label }}
<view class="mb-4 box-border px-3">
<uh-section-title>
最新推荐
<template #right>
<view class="flex items-center gap-2">
<view class="uh-global-card-glass uh-shadow-xs flex items-center border rounded-lg p-0.5">
<view v-for="tab in recommendTabs" :key="tab.value" class="rounded-md px-2 py-0.5 text-10px"
:class="recommendMode === tab.value ? 'bg-secondary text-gray-900' : 'text-gray-500'"
@click="handleRecommendModeChange(tab.value as 'default' | 'pinned' | 'latest' | 'oldest')">
{{ tab.label }}
</view>
</view>
<view v-if="false" class="rounded-md px-2 py-0.5 text-xs text-gray-500" @click="handleToArticles()">
更多
<view
class="uh-global-card-glass uh-shadow-xs border flex items-center justify-center rounded-md p-1 text-gray-400"
@click="handleToArticles()">
<wd-icon name="arrow-right" size="14px" />
</view>
</view>
<view
class="uh-global-card-glass uh-shadow-xs border flex items-center justify-center rounded-md p-1 text-gray-400"
@click="handleToArticles()">
<wd-icon name="arrow-right" size="28rpx" />
</view>
</view>
</template>
</uh-section-title>
</template>
</uh-section-title>
</view>
<uh-data-loading v-if="loadingStatus !== DataLoadingStatusEnum.Success" :loading-status="loadingStatus"
min-height="36vh" @refresh="handleQuery" />
@@ -277,5 +274,6 @@
<uh-data-loadmore :status="loadMoreStatus.status" :text="loadMoreStatus.text" />
</block>
</view>
<uh-notify-dialog />
</template>
+271
View File
@@ -0,0 +1,271 @@
<script lang="ts" setup>
import { computed, ref, watch } from 'vue'
import { onPullDownRefresh, onShow } from '@dcloudio/uni-app'
import { getBlogStatistics } from '@/api/halo'
import { useAppConfigStore } from '@/store/appConfig'
import { useFavoritesStore } from '@/store/favorites'
import { NeedPluginIds } from '@/hooks/usePluginAvailable'
import { checkAvatarUrl, checkImageUrl } from '@/utils/url'
import { checkHasAdminLogin } from '@/utils/auth'
import { t } from '@/locale'
import type { IBlogStats } from '@/api/types/halo'
definePage({
style: {
navigationBarTitleText: '关于',
enablePullDownRefresh: true,
navigationStyle: 'custom',
},
})
const appConfigStore = useAppConfigStore()
const favoritesStore = useFavoritesStore()
const haloConfigs = computed(() => appConfigStore.configs)
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
/** 数据看板插件可用性(供导航项显隐判断,参考 gallery 对象传参模式) */
const { check: checkDataVisualPlugin } = usePluginAvailable({
pluginId: NeedPluginIds.PluginDataStatistics,
})
/** 投票插件可用性(投票中心导航项显隐) */
const { check: checkVotePluginAvailable } = usePluginAvailable({
pluginId: NeedPluginIds.PluginVote,
})
/** 链接插件可用性(友情链接导航项显隐) */
const { check: checkLinksPluginAvailable } = usePluginAvailable({
pluginId: NeedPluginIds.PluginLinks,
})
/* ---------------- 计算属性 ---------------- */
const bloggerInfo = computed(() => {
const blogger = haloConfigs.value.authorConfig?.blogger as
| { nickname?: string, avatar?: string, description?: string }
| undefined
return {
nickname: blogger?.nickname || '',
avatar: checkAvatarUrl(blogger?.avatar),
description: blogger?.description || '',
}
})
const pageConfig = computed(() => haloConfigs.value.pageConfig?.aboutConfig as
| { bgImageUrl?: string, waveImageUrl?: string}
| undefined)
const calcProfileStyle = computed(() => ({
backgroundImage: `url(${checkImageUrl(pageConfig.value?.bgImageUrl)})`,
}))
const calcWaveUrl = computed(() => checkImageUrl(pageConfig.value?.waveImageUrl))
/* ---------------- 状态 ---------------- */
const statistics = ref<IBlogStats>({ post: 0, comment: 0, category: 0, visit: 0, upvote: 0 })
/** 主行统计 */
const allStats = computed(() => [
{ key: 'post', label: '内容', value: statistics.value.post },
{ key: 'visit', label: '访客', value: statistics.value.visit },
{ key: 'category', label: '分类', value: statistics.value.category },
{ key: 'comment', label: '评论', value: statistics.value.comment },
{ key: 'upvote', label: '点赞', value: statistics.value.upvote },
])
interface INavItem {
key: string
title: string
iconPrefix?: string
icon: string
bgColor: string
color?: string
subTitle?: string
path: string | null
openType?: string
show: boolean
group: 'blog' | 'more'
}
interface IMyPageEntry {
key?: string
title?: string
subTitle?: string
color?: string
bgColor?: string
iconPrefix?: string
icon?: string
path?: string
visible?: boolean
}
const configuredFeatures = computed(() => {
const mp = haloConfigs.value.pageConfig?.myPageConfig as
| { commonFeatures?: IMyPageEntry[], otherFeatures?: IMyPageEntry[] }
| undefined
if (!mp || (!mp.commonFeatures?.length && !mp.otherFeatures?.length)) {
return null
}
return mp
})
const navList = ref<INavItem[]>([])
/** 分组渲染(过滤后空组整组隐藏;组标题对齐插件端:常用功能/其他功能) */
const calcNavGroups = computed(() => {
const visible = navList.value.filter(n => n.show)
const groupDefs: { key: 'blog' | 'more', title: string }[] = [
{ key: 'blog', title: '常用功能' },
{ key: 'more', title: '其他功能' },
]
return groupDefs
.map(def => ({ ...def, items: visible.filter(n => n.group === def.key) }))
.filter(group => group.items.length > 0)
})
/* ---------------- 功能导航 ---------------- */
async function handleGetNavList() {
// 配置模式:插件端 myPageConfig 两组(常用功能→blog、其他功能→more),
// 未配置/为空时回退本地内置默认(保留原显隐推导)
const mp = configuredFeatures.value
if (mp) {
const mapEntry = (e: IMyPageEntry, group: 'blog' | 'more'): INavItem | null => {
if (!e.key) { return null }
return {
key: e.key,
title: e.title || '',
iconPrefix: e.iconPrefix,
icon: e.icon || '',
bgColor: e.bgColor || '#969696F2',
color: e.color,
subTitle: e.subTitle || '',
path: e.path || null,
show: e.visible !== false,
group,
}
}
navList.value = [
...(mp.commonFeatures || []).map(e => mapEntry(e, 'blog')).filter((n): n is INavItem => n !== null),
...(mp.otherFeatures || []).map(e => mapEntry(e, 'more')).filter((n): n is INavItem => n !== null),
]
return
}
const [dataVisualAvailable, voteAvailable, linksAvailable] = await Promise.all([
checkDataVisualPlugin(),
checkVotePluginAvailable(),
checkLinksPluginAvailable(),
])
}
/* ---------------- 数据加载 ---------------- */
async function handleGetData() {
try {
const res = await getBlogStatistics()
statistics.value = res.data
}
catch (err) {
console.error('获取统计失败', err)
uni.showToast({ icon: 'none', title: t('common.loadFailedRetry') })
}
finally {
uni.stopPullDownRefresh()
}
}
/* ---------------- 交互 ---------------- */
function handleOnNav(data: { path: string | null, isAdmin?: boolean }) {
const { path, isAdmin } = data
if (!path)
return
uni.navigateTo({ url: path })
}
/* ---------------- 生命周期 ---------------- */
watch(haloConfigs, () => {
handleGetNavList()
}, { deep: true, immediate: true })
handleGetData()
onPullDownRefresh(() => {
handleGetData()
})
</script>
<template>
<view class="box-border min-h-screen w-screen bg-page pb-2">
<!-- 头部:博主信息(背景图 + 遮罩 + wave,内容区做状态栏适配) -->
<view class="relative h-88 w-full bg-cover bg-no-repeat" :style="[calcProfileStyle]">
<!-- 背景遮罩 -->
<view class="absolute left-0 top-0 z-0 h-full w-full bg-black/30" style="backdrop-filter:blur(2rpx)"/>
<view class="relative z-6 h-full flex flex-col items-center justify-center">
<image
class="uh-global-card-glass h-20 w-20 rounded-full" :src="bloggerInfo.avatar"
mode="aspectFill"
/>
<view class="mt-4 text-lg text-white font-bold text-shadow-[0_2rpx_8rpx_rgba(0,0,0,0.4)]">
{{ bloggerInfo.nickname }}
</view>
<view
class="desc mt-2 px-10 text-center text-2xs text-white/90 leading-relaxed text-shadow-[0_2rpx_8rpx_rgba(0,0,0,0.4)]"
>
{{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }}
</view>
</view>
<image
v-if="calcWaveUrl" :src="calcWaveUrl" mode="scaleToFill"
class="gif-wave absolute bottom-0 left-0 z-99 h-[100rpx] w-full" style="mix-blend-mode: screen;"
/>
</view>
<!-- 站点统计 -->
<view class="uh-global-card-glass uh-shadow-xs relative z-100 mx-4 flex border rounded-2xl -mt-12">
<view v-for="item in allStats" :key="item.key" class="flex-1 py-4 text-center">
<wd-count-to
:key="`${item.key}-${item.value}`" :start-val="0" :end-val="item.value" :duration="900"
separator="" color="#111827" custom-class="text-lg font-bold"
/>
<view class="mt-1 text-xs text-gray-500">
{{ item.label }}
</view>
</view>
</view>
<!-- 功能导航 -->
<template v-for="group in calcNavGroups" :key="group.key">
<view class="box-border px-4">
<uh-section-title class="mb-3 mt-8">
{{ group.title }}
</uh-section-title>
</view>
<view class="uh-global-card-glass mx-4 overflow-hidden rounded-2xl">
<view
v-for="(nav, index) in group.items" :key="nav.key"
class="nav-item flex items-center justify-between px-4"
:class="index < group.items.length - 1 ? 'border-b border-b-solid border-black/5' : ''"
@click="handleOnNav(nav)"
>
<view class="nav-left flex items-center gap-3 py-3">
<view
class="uh-global-card-glass uh-shadow-xs h-8 w-8 flex items-center justify-center border rounded-xl"
:style="{ backgroundColor: nav.bgColor }"
>
<wd-icon :class-prefix="nav.iconPrefix" :name="nav.icon" size="36rpx" />
</view>
<text
class="nav-title text-sm text-gray-900"
:style="{ color: nav.color }"
>
{{ nav.title }}
</text>
</view>
<view class="nav-right flex items-center gap-2">
<text class="nav-right-text text-xs text-gray-400">{{ nav.subTitle }}</text>
<wd-icon name="arrow-right" size="24rpx" class="text-gray-400" />
</view>
</view>
</view>
</template>
<uh-page-copyright />
</view>
</template>
+13 -10
View File
@@ -5,6 +5,7 @@
import { getMomentList } from '@/api/halo'
import { useAppConfigStore } from '@/store/appConfig'
import { NeedPluginIds } from '@/hooks/usePluginAvailable'
import { usePageScroll } from '@/hooks/usePageScroll'
import { useFavoritesStore } from '@/store/favorites'
import { checkAvatarUrl, checkThumbnailUrl } from '@/utils/url'
import { buildMomentFavoriteItem } from '@/utils/favorite'
@@ -25,6 +26,7 @@
},
})
const { scrollY } = usePageScroll()
const appConfigStore = useAppConfigStore()
const favoritesStore = useFavoritesStore()
const haloConfigs = computed(() => appConfigStore.configs)
@@ -333,7 +335,7 @@
<template>
<view class="box-border min-h-screen w-screen flex flex-col bg-page">
<uh-navbar :use-back="false" default-title="我的日常" title-color="text-gray-900" />
<uh-navbar :scroll-y="scrollY" :use-back="false" default-title="我的日常" title-color="text-gray-900" />
<uh-plugin-unavailable v-if="!uniHaloPluginAvailable" :plugin-id="pluginId" :error-text="tips"
:checking="checking" @on-refresh="handlePluginRefresh" />
@@ -342,7 +344,7 @@
<uh-data-loading v-if="loadingStatus !== DataLoadingStatusEnum.Success" :loading-status="loadingStatus"
min-height="75vh" @refresh="handleGetData" />
<view v-else class="box-border flex flex-col gap-3 p-3 pt-0">
<view v-else class="box-border flex flex-col gap-3 px-3">
<!-- 瞬间卡片 -->
<view v-for="moment in dataList" :key="moment.metadata.name" class="flex gap-x-2">
<view class="shrink-0 flex flex-col gap-y-2 w-13">
@@ -363,8 +365,8 @@
<image class="avatar h-9 w-9 shrink-0 rounded-full"
:src="checkAvatarUrl(moment.owner?.avatar || bloggerInfo.avatar)"
mode="aspectFill" />
<view class="ml-2 flex flex-col">
<view class="text-sm text-gray-900 font-bold">
<view class="ml-2 flex flex-col gap-y-1">
<view class="text-3xs text-gray-900 font-bold">
{{ moment.owner?.displayName || bloggerInfo.nickname }}
</view>
<view class="text-xs text-gray-400">
@@ -373,7 +375,7 @@
</view>
</view>
<view class="shrink-0">
<uh-button custom-class="!py-1 bg-secondary text-xs font-semibold"
<uh-button custom-class="!py-1.5 bg-secondary text-xs"
@click="handleToMomentDetail(moment)">
详情
</uh-button>
@@ -382,7 +384,7 @@
<!-- 正文 -->
<view class="box-border px-4 pt-3">
<view class="relative box-border rounded-lg bg-page p-3 text-gray-900 text-sm">
<view class="relative box-border rounded-lg bg-page p-3 text-gray-900 text-3xs">
<mp-html lazy-load :domain="markdownConfig.domain ?? ''"
:loading-img="markdownConfig.loadingGif" scroll-table selectable
:tag-style="markdownConfig.tagStyle" :container-style="markdownConfig.containStyle"
@@ -412,10 +414,11 @@
<!-- (点赞/评论) -->
<view
class="mb-1 mt-2 box-border w-full flex items-center justify-between border-t border-black/5 px-4 py-3 text-xs text-gray-400">
class="mb-1 mt-2 box-border w-full flex items-center border-t border-black/5 px-4 py-3 text-xs text-gray-400"
:class="[moment.spec.allowComment?'justify-between':'gap-x-6']">
<view class="flex items-center gap-x-1" @click.stop="handleMomentLike(moment)">
<wd-icon class-prefix="uhemoji-icon" name="-kiss-" size="32rpx" />
<text class="text-sm"
<text class="text-3xs"
:class="hasUpvoted(moment.metadata.name) ? 'text-primary' : 'text-gray-600'">
点赞 {{ moment.stats.upvote || 0 }}
</text>
@@ -423,11 +426,11 @@
<view v-if="moment.spec.allowComment" class="flex items-center gap-x-1"
@click.stop="handleMomentComment(moment)">
<wd-icon class-prefix="uhemoji-icon" name="-thinking" size="32rpx" />
<text class="text-sm text-gray-600">评论 {{ moment.stats.totalComment || 0 }}</text>
<text class="text-3xs text-gray-600">评论 {{ moment.stats.totalComment || 0 }}</text>
</view>
<view class="flex items-center gap-x-1" @click.stop="handleToggleMomentFavorite(moment)">
<wd-icon class-prefix="uhemoji-icon" name="-smile-" size="32rpx" />
<text class="text-sm"
<text class="text-3xs"
:class="isMomentFavorite(moment) ? 'text-primary' : 'text-gray-600'">
{{ isMomentFavorite(moment) ? '已收藏' : '收藏' }}
</text>