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

style: 优化多处UI细节与代码结构

1. 调整多处文字大小与间距样式统一视觉
2. 优化导航栏模糊效果与布局
3. 重构评论项头像加载逻辑,增加昵称首字占位兜底
4. 重写我的页面代码结构与布局样式
5. 清理评论列表冗余代码与格式化模板
This commit is contained in:
小莫唐尼
2026-09-13 01:14:59 +08:00
parent 1cb300f07a
commit 713646fc93
14 changed files with 347 additions and 301 deletions
@@ -68,7 +68,7 @@
pinned: 'right-3 top-3', pinned: 'right-3 top-3',
}, },
image_left: { image_left: {
container: 'flex gap-x-3 !p-2', container: 'flex gap-x-3 !p-3',
cover: 'shrink-0 !w-36 !h-24', cover: 'shrink-0 !w-36 !h-24',
contentWrapper: 'w-0 flex-1 justify-between', contentWrapper: 'w-0 flex-1 justify-between',
footer: 'flex items-center justify-between', footer: 'flex items-center justify-between',
@@ -79,10 +79,10 @@
time: '!hidden', time: '!hidden',
tagCategory: '!hidden', tagCategory: '!hidden',
visits: '', visits: '',
pinned: 'left-3 top-3', pinned: 'left-4 top-4',
}, },
image_right: { image_right: {
container: 'flex gap-x-3 !p-2', container: 'flex gap-x-3 !p-3',
cover: 'order-2 shrink-0 !w-36 !h-24', cover: 'order-2 shrink-0 !w-36 !h-24',
contentWrapper: 'order-1 w-0 flex-1 justify-between', contentWrapper: 'order-1 w-0 flex-1 justify-between',
footer: 'flex items-center justify-between', footer: 'flex items-center justify-between',
@@ -93,7 +93,7 @@
time: '!hidden', time: '!hidden',
tagCategory: '!hidden', tagCategory: '!hidden',
visits: '', visits: '',
pinned: 'right-3 top-3', pinned: 'right-4 top-4',
}, },
}) as Record<CardLayout, CardLayoutClasses>) }) as Record<CardLayout, CardLayoutClasses>)
@@ -1,5 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed } from 'vue' import { computed, ref, watch } from 'vue'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime' import relativeTime from 'dayjs/plugin/relativeTime'
import { checkAvatarUrl } from '@/utils/url' import { checkAvatarUrl } from '@/utils/url'
@@ -40,6 +40,26 @@
const avatar = computed(() => checkAvatarUrl(props.comment.spec.owner.avatar)) const avatar = computed(() => checkAvatarUrl(props.comment.spec.owner.avatar))
/** 用户是否提供了头像(无头像时用昵称首字占位) */
const hasAvatar = computed(() => !!props.comment.spec.owner.avatar?.trim())
/** 昵称首字(头像占位) */
const avatarText = computed(() => {
const name = props.comment.spec.owner.displayName?.trim()
return name ? Array.from(name)[0] : '?'
})
/** 头像加载失败标记(失败后回退首字占位) */
const avatarError = ref(false)
/** 是否渲染图片头像(有头像且未加载失败) */
const showImage = computed(() => hasAvatar.value && !avatarError.value)
/** 头像地址变化时重置加载失败标记(组件复用时) */
watch(() => props.comment.spec.owner.avatar, () => {
avatarError.value = false
})
/** 引用回复标识(被引用人在父级已加载回复映射中可查到时显示) */ /** 引用回复标识(被引用人在父级已加载回复映射中可查到时显示) */
const quoteReplyText = computed(() => { const quoteReplyText = computed(() => {
const quoteName = props.comment.spec.quoteReply const quoteName = props.comment.spec.quoteReply
@@ -61,7 +81,8 @@
}) })
function handleOnImageError() { function handleOnImageError() {
// 头像加载失败时回退默认头像(由 checkAvatarUrl 兜底,此处保持简单) // 头像加载失败时回退昵称首字占位
avatarError.value = true
} }
function handleOnCopy() { function handleOnCopy() {
@@ -82,8 +103,12 @@
'pl-10':props.isChild, 'pl-10':props.isChild,
}"> }">
<view class="flex shrink-0"> <view class="flex shrink-0">
<image class="box-border h-10 w-10 shrink-0 rounded-full border border-white uh-shadow-xs border-solid" :src="avatar" mode="aspectFill" <image v-if="showImage"
@error="handleOnImageError" /> class="box-border h-10 w-10 shrink-0 rounded-full border border-white uh-shadow-xs border-solid" :src="avatar"
mode="aspectFill" @error="handleOnImageError" />
<view v-else class="flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-[#bbe52a6b]">
<text class="text-sm font-bold text-gray-900">{{ avatarText }}</text>
</view>
</view> </view>
<view class="flex-1 box-border pl-2"> <view class="flex-1 box-border pl-2">
<view class="text-sm text-gray-500"> <view class="text-sm text-gray-500">
@@ -1,7 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, onUnmounted, reactive, ref } from 'vue' import { onMounted, onUnmounted, reactive, ref } from 'vue'
import { getPostCommentList, getPostCommentReplyList } from '@/api/halo' import { getPostCommentList, getPostCommentReplyList } from '@/api/halo'
import { checkAvatarUrl } from '@/utils/url'
import type { IComment, ICommentListRes, ICommentReply } from '@/api/types/halo' import type { IComment, ICommentListRes, ICommentReply } from '@/api/types/halo'
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
@@ -54,11 +53,7 @@
try { try {
const res = await getPostCommentList({ ...queryParams.value }) const res = await getPostCommentList({ ...queryParams.value })
result.value = res.data result.value = res.data
dataList.value = res.data.items.map((item) => { dataList.value = res.data.items
// todo:临时
item.spec.owner.avatar = checkAvatarUrl(item.spec.owner.avatar ?? 'https://api.dicebear.com/10.x/adventurer-neutral/svg')
return item
})
// 列表刷新后清空展开缓存,保证回复区展示最新数据 // 列表刷新后清空展开缓存,保证回复区展示最新数据
expanded.clear() expanded.clear()
repliesMap.clear() repliesMap.clear()
@@ -217,10 +212,7 @@
<uh-section-title> <uh-section-title>
评论列表 评论列表
<template #right> <template #right>
<view class="flex items-center gap-1.5 text-xs text-gray-500 font-normal" @click="handleGetData"> <text class="text-xs text-gray-500 font-normal" @click="handleGetData">刷新</text>
<wd-icon name="refresh" size="28rpx" />
<text class="">刷新</text>
</view>
</template> </template>
</uh-section-title> </uh-section-title>
@@ -243,14 +235,14 @@
</view> </view>
<block v-else> <block v-else>
<view v-if="dataList.length === 0" class=" py-12"> <view v-if="dataList.length === 0" class="py-12">
<view class=" flex flex-col items-center"> <view class="flex flex-col items-center">
<wd-icon class-prefix="uhemoji-icon" name="-confused" size="100rpx" class="text-primary" /> <wd-icon class-prefix="uhemoji-icon" name="-confused" size="100rpx" class="text-primary" />
<text class="mt-2 text-sm text-gray-500">暂无评论</text> <text class="mt-2 text-xs text-gray-500">暂无评论</text>
<view v-if="disallowComment" class="mt-2 text-xs text-red-400"> <view v-if="disallowComment" class="mt-2 text-xs text-red-400">
文章已开启禁止评论 文章已开启禁止评论
</view> </view>
<view v-else class="mt-2 bg-primary text-black text-sm px-4 py-1.5 rounded-lg" <view v-else class="mt-2 bg-primary text-black text-xs px-4 py-1.5 rounded-lg"
@click="handleToComment()"> @click="handleToComment()">
抢沙发 抢沙发
</view> </view>
@@ -279,7 +271,8 @@
class="mt-2 ml-10 text-xs text-red-400" @click="loadReplies(comment)"> class="mt-2 ml-10 text-xs text-red-400" @click="loadReplies(comment)">
回复加载失败,点击重试 回复加载失败,点击重试
</view> </view>
<view v-else-if="getRepliesState(comment)?.status === 'loading' && getRepliesState(comment)?.list.length === 0" <view
v-else-if="getRepliesState(comment)?.status === 'loading' && getRepliesState(comment)?.list.length === 0"
class="mt-2 ml-10 text-xs text-gray-400"> class="mt-2 ml-10 text-xs text-gray-400">
回复加载中... 回复加载中...
</view> </view>
@@ -288,8 +281,8 @@
:key="childComment.metadata.name" :use-content-bg="false" :is-child="true" :key="childComment.metadata.name" :use-content-bg="false" :is-child="true"
:comment="childComment" :post-name="postName" :comment="childComment" :post-name="postName"
:disallow-comment="disallowComment" :disallow-comment="disallowComment"
:quote-reply-map="buildQuoteReplyMap(comment)" :quote-reply-map="buildQuoteReplyMap(comment)" @on-copy="handleCopyContent"
@on-copy="handleCopyContent" @on-comment="(d) => handleToComment(d, comment)" @on-comment="(d) => handleToComment(d, comment)"
@on-detail="handleShowCommentDetail" /> @on-detail="handleShowCommentDetail" />
<!-- 加载更多(响应 hasNext) --> <!-- 加载更多(响应 hasNext) -->
@@ -106,7 +106,7 @@
<!-- 文案区 --> <!-- 文案区 -->
<view class="relative z-2 flex flex-col items-center"> <view class="relative z-2 flex flex-col items-center">
<view class="flex items-center justify-center text-sm font-bold" :class="statusScene.mainTextClass"> <view class="flex items-center justify-center text-2xs font-medium" :class="statusScene.mainTextClass">
<text>{{ statusScene.mainText }}</text> <text>{{ statusScene.mainText }}</text>
<view v-if="isLoading" class="ml-1 flex items-end gap-1"> <view v-if="isLoading" class="ml-1 flex items-end gap-1">
<view v-for="n in 3" :key="n" class="typing-dot bg-primary" <view v-for="n in 3" :key="n" class="typing-dot bg-primary"
@@ -117,7 +117,7 @@
{{ statusScene.subText }} {{ statusScene.subText }}
</text> </text>
<view v-if="props.useRefreshButton" class="mt-4"> <view v-if="props.useRefreshButton" class="mt-4">
<uh-button :custom-class="'uh-global-card-glass uh-shadow-xs border' + sizeClasses.button" <uh-button :custom-class="'uh-global-card-glass text-xs py-2 uh-shadow-xs border' + sizeClasses.button"
@click="emit('refresh')"> @click="emit('refresh')">
刷新试试 刷新试试
</uh-button> </uh-button>
@@ -111,7 +111,7 @@
</swiper> </swiper>
<view v-if="currentBanner" <view v-if="currentBanner"
class="pointer-events-none absolute inset-0 z-10 flex flex-col items-center justify-center gap-y-2 bg-white/5 backdrop-blur-[2rpx]"> class="pointer-events-none absolute inset-0 z-10 flex flex-col items-center justify-center gap-y-2 bg-white/5 backdrop-blur-[2rpx]">
<text class="text-sm text-gray-900 font-bold bg-secondary px-3 py-0.5 rounded-xl"> <text class="text-2xs text-gray-900 font-bold bg-secondary px-3 py-1 rounded-xl">
{{ currentBanner.title }} {{ currentBanner.title }}
</text> </text>
<text <text
@@ -122,7 +122,7 @@
<view class="absolute bottom-0 left-0 right-0 h-12 w-full bg-gradient-to-b from-white/0 to-page" /> <view class="absolute bottom-0 left-0 right-0 h-12 w-full bg-gradient-to-b from-white/0 to-page" />
<view class="absolute left-0 right-0 z-10 flex items-center justify-center uh-translate-y-n6"> <view class="absolute left-0 right-0 z-10 flex items-center justify-center uh-translate-y-n6">
<view <view
class="uh-global-card-glass border w-4/5 rounded-full px-4 py-2 text-sm text-gray-600 flex items-center justify-center gap-x-2" class="uh-global-card-glass border w-4/5 rounded-full px-4 py-2.5 text-2xs text-gray-600 flex items-center justify-center gap-x-2"
@click="handleToSearch()"> @click="handleToSearch()">
<wd-icon name="search-line" size="32rpx"></wd-icon> <wd-icon name="search-line" size="32rpx"></wd-icon>
<text>哈喽,想看些什么 <text class="bg-secondary rounded-xl px-1">{ 内容 }</text> 呢~</text> <text>哈喽,想看些什么 <text class="bg-secondary rounded-xl px-1">{ 内容 }</text> 呢~</text>
@@ -100,7 +100,7 @@
<image :src="category.spec.cover" class="w-full h-full" mode="aspectFill" lazy-load /> <image :src="category.spec.cover" class="w-full h-full" mode="aspectFill" lazy-load />
<view class="absolute bottom-0 left-0 h-16 w-full bg-gradient-to-b from-black/0 to-black/30" /> <view class="absolute bottom-0 left-0 h-16 w-full bg-gradient-to-b from-black/0 to-black/30" />
<view class="absolute left-2 bottom-2 flex z-2 flex-col text-left"> <view class="absolute left-2 bottom-2 flex z-2 flex-col text-left">
<text class="text-2xs font-semibold"> <text class="text-xs font-semibold">
{{ category.spec.displayName }} {{ category.spec.displayName }}
</text> </text>
<text class="mt-1 text-xs text-gray-200">共 {{ category.postCount ?? 0 }} 篇</text> <text class="mt-1 text-xs text-gray-200">共 {{ category.postCount ?? 0 }} 篇</text>
+4 -3
View File
@@ -27,10 +27,11 @@
backClass: 'text-gray-900', backClass: 'text-gray-900',
}) })
const maxAlpha = ref(0.65) const maxAlpha = ref(0.75)
const customStyle = computed(() => { const customStyle = computed(() => {
const alpha = Math.min(props.scrollY / 360, maxAlpha.value) const alpha = Math.min(props.scrollY / 360, maxAlpha.value)
return { return {
backdropFilter: 'blur(2rpx)',
backgroundColor: `rgba(255, 255, 255, ${alpha})`, backgroundColor: `rgba(255, 255, 255, ${alpha})`,
} }
}) })
@@ -88,7 +89,7 @@
<template> <template>
<view class="fixed left-0 top-0 z-100 box-border w-full pt-safe" :class="customCalss" :style="[customStyle]"> <view class="fixed left-0 top-0 z-100 box-border w-full pt-safe" :class="customCalss" :style="[customStyle]">
<view class="box-border h-[46px] w-full flex items-center gap-x-4 px-3" style="backdrop-filter: blur(2rpx);"> <view class="box-border h-[46px] w-full flex items-center gap-x-4 px-3">
<!-- 左边 --> <!-- 左边 -->
<view class="min-w-18 shrink-0" @click="handleBack()"> <view class="min-w-18 shrink-0" @click="handleBack()">
<view v-if="props.useBack" <view v-if="props.useBack"
@@ -101,7 +102,7 @@
</view> </view>
<!-- 中间 --> <!-- 中间 -->
<view class="flex-1 truncate text-center font-bold transition-colors duration-300" :class="titleColorClass"> <view class="flex-1 truncate text-center font-bold transition-colors duration-300" :class="titleColorClass">
{{props.scrollY}} <slot> {{ visibleTitle }} </slot> <slot> {{ visibleTitle }} </slot>
</view> </view>
<!-- 右边 --> <!-- 右边 -->
<view class="min-w-18 shrink-0"> <view class="min-w-18 shrink-0">
@@ -106,7 +106,7 @@
<view class="text-sm font-bold leading-snug text-gray-900"> <view class="text-sm font-bold leading-snug text-gray-900">
{{ notice.title }} {{ notice.title }}
</view> </view>
<view v-if="notice.summary" class="mt-3 text-2xs leading-relaxed text-gray-600"> <view v-if="notice.summary" class="mt-3 text-xs leading-relaxed text-gray-900">
{{ notice.summary }} {{ notice.summary }}
</view> </view>
<view v-if="notice.publishTime" class="mt-3 text-xs text-gray-600"> <view v-if="notice.publishTime" class="mt-3 text-xs text-gray-600">
@@ -119,7 +119,7 @@
<view class="text-xs text-gray-600 " @click="handleDismissForever"> <view class="text-xs text-gray-600 " @click="handleDismissForever">
今日不再提醒 今日不再提醒
</view> </view>
<uh-button custom-class="font-semibold text-xs" @click="handleViewAll"> <uh-button custom-class="text-xs" @click="handleViewAll">
查看全文 → 查看全文 →
</uh-button> </uh-button>
</view> </view>
@@ -31,24 +31,24 @@
class="max-w-3/5 mx-auto my-auto box-border flex flex-col items-center justify-center gap-6 text-sm" class="max-w-3/5 mx-auto my-auto box-border flex flex-col items-center justify-center gap-6 text-sm"
:class="props.customClass"> :class="props.customClass">
<wd-icon class-prefix="uhemoji-icon" name="-cry" size="160rpx"></wd-icon> <wd-icon class-prefix="uhemoji-icon" name="-cry" size="140rpx"></wd-icon>
<view class="box-border text-lg text-gray-900 font-bold"> <view class="box-border text-sm text-gray-900 font-bold">
{{ pluginInfo.name }} {{ pluginInfo.name }}
</view> </view>
<view v-if="errorText" class=" text-yellow-500 text-sm"> <view v-if="errorText" class="text-yellow-500 text-2xs">
{{ errorText }} {{ errorText }}
</view> </view>
<view class="w-full flex flex-col gap-y-4"> <view class="w-full flex flex-col gap-y-4">
<uh-button custom-class="!rounded-full py-2 !uh-shadow-xs" @click="handleRefresh()"> <uh-button custom-class="!rounded-full text-xs py-2 !uh-shadow-xs" @click="handleRefresh()">
{{props.checking?'正在刷新':'刷新试试'}} {{props.checking?'正在刷新':'刷新试试'}}
</uh-button> </uh-button>
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
<!-- 微信端客服会话只能由原生 button 的 open-type="contact" 唤起,故此处不用 uh-button(view 实现) --> <!-- 微信端客服会话只能由原生 button 的 open-type="contact" 唤起,故此处不用 uh-button(view 实现) -->
<button <button
class="uh-contact-btn bg-white py-2 px-4 !rounded-full text-black text-sm leading-none flex items-center justify-center" class="uh-contact-btn w-full bg-white py-2.5 px-4 !rounded-full text-black text-xs leading-none flex items-center justify-center"
open-type="contact" hover-class="none">提交反馈</button> open-type="contact" hover-class="none">提交反馈</button>
<!-- #endif --> <!-- #endif -->
</view> </view>
@@ -459,7 +459,7 @@
<uh-data-loading v-if="loadingStatus !== 'success'" :loading-status="loadingStatus" <uh-data-loading v-if="loadingStatus !== 'success'" :loading-status="loadingStatus"
@refresh="handleGetData()" /> @refresh="handleGetData()" />
<view v-else class="box-border pt-72"> <view v-else class="box-border pt-72 pb-4">
<!-- 顶部背景封面区域 --> <!-- 顶部背景封面区域 -->
<view class="fixed left-0 top-0 h-72 w-full"> <view class="fixed left-0 top-0 h-72 w-full">
<image v-if="result?.spec.cover" :src="result.spec.cover" class="h-full w-full" mode="aspectFill" /> <image v-if="result?.spec.cover" :src="result.spec.cover" class="h-full w-full" mode="aspectFill" />
@@ -567,7 +567,7 @@
<view v-if="postDetailConfig?.copyrightEnabled" class="box-border px-2 mb-3"> <view v-if="postDetailConfig?.copyrightEnabled" class="box-border px-2 mb-3">
<view class="uh-global-card-glass uh-shadow-xs rounded-xl p-3"> <view class="uh-global-card-glass uh-shadow-xs rounded-xl p-3">
<uh-section-title>版权声明</uh-section-title> <uh-section-title>版权声明</uh-section-title>
<view class="mt-3 flex flex-col gap-y-2 text-gray-600 text-2xs"> <view class="mt-3 flex flex-col gap-y-2 text-gray-600 text-xs">
<view v-if="postDetailConfig.copyrightAuthor" class="leading-5"> <view v-if="postDetailConfig.copyrightAuthor" class="leading-5">
版权归属:{{ postDetailConfig.copyrightAuthor }} 版权归属:{{ postDetailConfig.copyrightAuthor }}
</view> </view>
@@ -592,26 +592,26 @@
</view> </view>
<!-- 悬浮操作 --> <!-- 悬浮操作 -->
<view class="fixed bottom-2 left-1/2 z-10 flex items-center justify-center pb-safe uh-translate-x-center"> <view class="fixed bottom-0 left-1/2 z-10 flex items-center justify-center pb-safe uh-translate-x-center">
<view <view
class="uh-global-card-glass box-border flex items-center justify-center gap-2 border rounded-full p-1 text-primary"> class="uh-global-card-glass box-border flex items-center justify-center gap-2 border rounded-full p-1 text-primary">
<view <view
class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none" class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none"
:class="[hasUpvoted()?'text-primary':'text-gray-900']" @click="handleDoLikesClick"> :class="[hasUpvoted()?'text-primary':'text-gray-900']" @click="handleDoLikesClick">
<wd-icon class-prefix="uhemoji-icon" name="-kiss-" size="36rpx" /> <wd-icon class-prefix="uhemoji-icon" name="-kiss-" size="36rpx" />
<text class="shrink-0 text-3xs font-semibold">点赞</text> <text class="shrink-0 text-xs font-semibold">点赞</text>
</view> </view>
<view v-if="calcIsShowComment" <view v-if="calcIsShowComment"
class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none" class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none"
@click="handleToComment()"> @click="handleToComment()">
<wd-icon class-prefix="uhemoji-icon" name="-thinking" size="36rpx" /> <wd-icon class-prefix="uhemoji-icon" name="-thinking" size="36rpx" />
<text class="shrink-0 text-3xs text-gray-900 font-semibold">评论</text> <text class="shrink-0 text-xs text-gray-900 font-semibold">评论</text>
</view> </view>
<view <view
class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none" class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none"
@click="handleTogglePostFavorite"> @click="handleTogglePostFavorite">
<wd-icon class-prefix="uhemoji-icon" name="-smile-" size="36rpx" /> <wd-icon class-prefix="uhemoji-icon" name="-smile-" size="36rpx" />
<text class="shrink-0 text-3xs font-semibold" <text class="shrink-0 text-xs font-semibold"
:class="[hasFavorited()?'text-primary':'text-gray-900']"> :class="[hasFavorited()?'text-primary':'text-gray-900']">
{{ hasFavorited() ? '已收藏' : '收藏' }} {{ hasFavorited() ? '已收藏' : '收藏' }}
</text> </text>
@@ -285,7 +285,7 @@
<uh-data-loading v-if="status !== 'success'" :loading-status="status" min-height="60vh" error-text="瞬间内容加载失败" <uh-data-loading v-if="status !== 'success'" :loading-status="status" min-height="60vh" error-text="瞬间内容加载失败"
empty-text="瞬间不存在或已被删除" @refresh="loadMoment" /> empty-text="瞬间不存在或已被删除" @refresh="loadMoment" />
<view v-else-if="moment" class="box-border px-3 pt-2 pb-12"> <view v-else-if="moment" class="box-border px-3 pt-2 pb-14">
<view class="mb-3 uh-global-card-glass uh-shadow-xs overflow-hidden rounded-2xl box-border pb-4"> <view class="mb-3 uh-global-card-glass uh-shadow-xs overflow-hidden rounded-2xl box-border pb-4">
<!-- 刊头:大字日期 --> <!-- 刊头:大字日期 -->
<view v-if="moment.spec.releaseTime" class="px-4 pt-4"> <view v-if="moment.spec.releaseTime" class="px-4 pt-4">
@@ -303,17 +303,17 @@
<image class="h-[80rpx] w-[80rpx] shrink-0 rounded-full" <image class="h-[80rpx] w-[80rpx] shrink-0 rounded-full"
:src="checkAvatarUrl(moment.owner?.avatar || bloggerInfo.avatar)" mode="aspectFill" /> :src="checkAvatarUrl(moment.owner?.avatar || bloggerInfo.avatar)" mode="aspectFill" />
<view class="ml-3 flex flex-col"> <view class="ml-3 flex flex-col">
<view class="text-[30rpx] text-[#5c7c0f] font-bold"> <view class="text-md text-gray-600 font-medium">
{{ moment.owner?.displayName || bloggerInfo.nickname }} {{ moment.owner?.displayName || bloggerInfo.nickname }}
</view> </view>
<view class="mt-0.5 text-[22rpx] text-gray-400"> <view class="mt-0.5 text-xs text-gray-400">
记录了这美好的一刻 记录了这美好的一刻
</view> </view>
</view> </view>
</view> </view>
<!-- 正文 --> <!-- 正文 -->
<view class="content px-4 mt-6 text-gray-900 text-sm"> <view class="content px-4 mt-6 text-gray-900 text-2xs">
<mp-html lazy-load :domain="markdownConfig.domain ?? ''" :loading-img="markdownConfig.loadingGif" <mp-html lazy-load :domain="markdownConfig.domain ?? ''" :loading-img="markdownConfig.loadingGif"
scroll-table selectable :tag-style="markdownConfig.tagStyle" scroll-table selectable :tag-style="markdownConfig.tagStyle"
:container-style="markdownConfig.containStyle" :content="moment.spec.newHtml || ''" :container-style="markdownConfig.containStyle" :content="moment.spec.newHtml || ''"
@@ -368,7 +368,7 @@
<!-- 悬浮操作 --> <!-- 悬浮操作 -->
<view v-if="moment" <view v-if="moment"
class="fixed bottom-8 left-1/2 z-10 flex items-center justify-center pb-safe uh-translate-x-center"> class="fixed bottom-0 left-1/2 z-10 flex items-center justify-center pb-safe uh-translate-x-center">
<view <view
class="uh-global-card-glass box-border flex items-center justify-center gap-2 border rounded-full p-1 text-primary"> class="uh-global-card-glass box-border flex items-center justify-center gap-2 border rounded-full p-1 text-primary">
<!-- 点赞 --> <!-- 点赞 -->
@@ -376,21 +376,21 @@
class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none" class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none"
:class="[hasUpvoted()?'text-primary':'text-gray-900']" @click="handleDoLikesClick"> :class="[hasUpvoted()?'text-primary':'text-gray-900']" @click="handleDoLikesClick">
<wd-icon class-prefix="uhemoji-icon" name="-kiss-" size="36rpx" /> <wd-icon class-prefix="uhemoji-icon" name="-kiss-" size="36rpx" />
<text class="shrink-0 text-sm text-gray-900 font-semibold">点赞</text> <text class="shrink-0 text-xs text-gray-900 font-semibold">点赞</text>
</view> </view>
<!-- 评论 --> <!-- 评论 -->
<view v-if="moment.spec.allowComment" <view v-if="moment.spec.allowComment"
class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none" class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none"
@click="handleToComment()"> @click="handleToComment()">
<wd-icon class-prefix="uhemoji-icon" name="-thinking" size="36rpx" /> <wd-icon class-prefix="uhemoji-icon" name="-thinking" size="36rpx" />
<text class="shrink-0 text-sm text-gray-900 font-semibold">评论</text> <text class="shrink-0 text-xs text-gray-900 font-semibold">评论</text>
</view> </view>
<!-- 收藏 --> <!-- 收藏 -->
<view <view
class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none" class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none"
@click="handleToggleMomentFavorite"> @click="handleToggleMomentFavorite">
<wd-icon class-prefix="uhemoji-icon" name="-smile-" size="36rpx" /> <wd-icon class-prefix="uhemoji-icon" name="-smile-" size="36rpx" />
<text class="shrink-0 text-sm font-semibold" <text class="shrink-0 text-xs font-semibold"
:class="[momentFavorited ? 'text-primary' : 'text-gray-900']">{{ momentFavorited ? '已收藏' : '收藏' }}</text> :class="[momentFavorited ? 'text-primary' : 'text-gray-900']">{{ momentFavorited ? '已收藏' : '收藏' }}</text>
</view> </view>
</view> </view>
+2 -2
View File
@@ -214,12 +214,12 @@
<!-- 自定义导航 --> <!-- 自定义导航 -->
<uh-navbar :scroll-y="scrollY" default-title="内容搜索" title-color="text-gray-900" /> <uh-navbar :scroll-y="scrollY" default-title="内容搜索" title-color="text-gray-900" />
<uh-plugin-unavailable v-if="!uniHaloPluginAvailable" :plugin-id="pluginId" :error-text="tips" <uh-plugin-unavailable v-if="!uniHaloPluginAvailable" custom-class="min-h-[80vh]" :plugin-id="pluginId" :error-text="tips"
:checking="checking" @on-refresh="handlePluginRefresh" /> :checking="checking" @on-refresh="handlePluginRefresh" />
<template v-else> <template v-else>
<!-- 顶部搜索框--> <!-- 顶部搜索框-->
<wd-sticky class=""> <wd-sticky>
<view class="w-screen box-border px-3 py-2"> <view class="w-screen box-border px-3 py-2">
<view class="box-border uh-global-card-glass h-9 flex items-center gap-3 rounded-full pl-1 pr-3"> <view class="box-border uh-global-card-glass h-9 flex items-center gap-3 rounded-full pl-1 pr-3">
<wd-icon name="search" size="16px" /> <wd-icon name="search" size="16px" />
+269 -242
View File
@@ -1,271 +1,298 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref, watch } from 'vue' import { computed, ref, watch } from 'vue'
import { onPullDownRefresh, onShow } from '@dcloudio/uni-app' import { onPullDownRefresh, onShow } from '@dcloudio/uni-app'
import { getBlogStatistics } from '@/api/halo' import { getBlogStatistics } from '@/api/halo'
import { useAppConfigStore } from '@/store/appConfig' import { useAppConfigStore } from '@/store/appConfig'
import { useFavoritesStore } from '@/store/favorites' import { useFavoritesStore } from '@/store/favorites'
import { NeedPluginIds } from '@/hooks/usePluginAvailable' import { checkAvatarUrl, checkImageUrl } from '@/utils/url'
import { checkAvatarUrl, checkImageUrl } from '@/utils/url' import { t } from '@/locale'
import { checkHasAdminLogin } from '@/utils/auth' import type { IBlogStats } from '@/api/types/halo'
import { t } from '@/locale'
import type { IBlogStats } from '@/api/types/halo'
definePage({ definePage({
style: { style: {
navigationBarTitleText: '关于', navigationBarTitleText: '关于',
enablePullDownRefresh: true, enablePullDownRefresh: true,
navigationStyle: 'custom', navigationStyle: 'custom',
}, },
}) })
const appConfigStore = useAppConfigStore() const appConfigStore = useAppConfigStore()
const favoritesStore = useFavoritesStore() const favoritesStore = useFavoritesStore()
const haloConfigs = computed(() => appConfigStore.configs) const haloConfigs = computed(() => appConfigStore.configs)
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled) 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 bloggerInfo = computed(() => {
const blogger = haloConfigs.value.authorConfig?.blogger as const blogger = haloConfigs.value.authorConfig?.blogger as
| { nickname?: string, avatar?: string, description?: string } | { nickname ?: string, avatar ?: string, description ?: string }
| undefined | undefined
return { return {
nickname: blogger?.nickname || '', nickname: blogger?.nickname || '',
avatar: checkAvatarUrl(blogger?.avatar), avatar: checkAvatarUrl(blogger?.avatar),
description: blogger?.description || '', description: blogger?.description || '',
} }
}) })
const pageConfig = computed(() => haloConfigs.value.pageConfig?.aboutConfig as const pageConfig = computed(() => haloConfigs.value.pageConfig?.aboutConfig as
| { bgImageUrl?: string, waveImageUrl?: string} | { bgImageUrl ?: string, waveImageUrl ?: string }
| undefined) | undefined)
const calcProfileStyle = computed(() => ({ const calcProfileStyle = computed(() => ({
backgroundImage: `url(${checkImageUrl(pageConfig.value?.bgImageUrl)})`, backgroundImage: `url(${checkImageUrl(pageConfig.value?.bgImageUrl)})`,
})) }))
const calcWaveUrl = computed(() => checkImageUrl(pageConfig.value?.waveImageUrl)) const calcWaveUrl = computed(() => checkImageUrl(pageConfig.value?.waveImageUrl))
/* ---------------- 状态 ---------------- */ /* ---------------- 状态 ---------------- */
const statistics = ref<IBlogStats>({ post: 0, comment: 0, category: 0, visit: 0, upvote: 0 }) const statistics = ref<IBlogStats>({ post: 0, comment: 0, category: 0, visit: 0, upvote: 0 })
/** 主行统计 */ /** 主行统计 */
const allStats = computed(() => [ const allStats = computed(() => [
{ key: 'post', label: '内容', value: statistics.value.post }, { key: 'post', label: '内容', value: statistics.value.post },
{ key: 'visit', label: '访客', value: statistics.value.visit }, { key: 'visit', label: '访客', value: statistics.value.visit },
{ key: 'category', label: '分类', value: statistics.value.category }, { key: 'category', label: '分类', value: statistics.value.category },
{ key: 'comment', label: '评论', value: statistics.value.comment }, { key: 'comment', label: '评论', value: statistics.value.comment },
{ key: 'upvote', label: '点赞', value: statistics.value.upvote }, { key: 'upvote', label: '点赞', value: statistics.value.upvote },
]) ])
interface INavItem { interface INavItem {
key: string key : string
title: string title : string
iconPrefix?: string iconPrefix ?: string
icon: string icon : string
bgColor: string bgColor : string
color?: string color ?: string
subTitle?: string subTitle ?: string
path: string | null path : string | null
openType?: string openType ?: string
show: boolean show : boolean
group: 'blog' | 'more' group : 'blog' | 'more'
} }
interface IMyPageEntry { interface IMyPageEntry {
key?: string key ?: string
title?: string title ?: string
subTitle?: string subTitle ?: string
color?: string color ?: string
bgColor?: string bgColor ?: string
iconPrefix?: string iconPrefix ?: string
icon?: string icon ?: string
path?: string path ?: string
visible?: boolean visible ?: boolean
} }
const configuredFeatures = computed(() => { const configuredFeatures = computed(() => {
const mp = haloConfigs.value.pageConfig?.myPageConfig as const mp = haloConfigs.value.pageConfig?.myPageConfig as
| { commonFeatures?: IMyPageEntry[], otherFeatures?: IMyPageEntry[] } | { commonFeatures ?: IMyPageEntry[], otherFeatures ?: IMyPageEntry[] }
| undefined | undefined
if (!mp || (!mp.commonFeatures?.length && !mp.otherFeatures?.length)) { if (!mp || (!mp.commonFeatures?.length && !mp.otherFeatures?.length)) {
return null return null
} }
return mp return mp
}) })
const navList = ref<INavItem[]>([]) const navList = ref<INavItem[]>([])
const featureMode = ref<'base' | 'list'>('base')
/** 分组渲染(过滤后空组整组隐藏;组标题对齐插件端:常用功能/其他功能) */
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)
})
/** 分组渲染(过滤后空组整组隐藏;组标题对齐插件端:常用功能/其他功能) */ const commonFeatures = computed(() => {
const calcNavGroups = computed(() => { return navList.value.filter(f => f.show && f.group === 'blog')
const visible = navList.value.filter(n => n.show) })
const groupDefs: { key: 'blog' | 'more', title: string }[] = [ const otherFeatures = computed(() => {
{ key: 'blog', title: '常用功能' }, return navList.value.filter(f => f.show && f.group === 'more')
{ 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() { async function handleGetNavList() {
// 配置模式:插件端 myPageConfig 两组(常用功能→blog、其他功能→more), // 配置模式:插件端 myPageConfig 两组(常用功能→blog、其他功能→more),
// 未配置/为空时回退本地内置默认(保留原显隐推导) // 未配置/为空时回退本地内置默认(保留原显隐推导)
const mp = configuredFeatures.value const mp = configuredFeatures.value
if (mp) { if (mp) {
const mapEntry = (e: IMyPageEntry, group: 'blog' | 'more'): INavItem | null => { const mapEntry = (e : IMyPageEntry, group : 'blog' | 'more') : INavItem | null => {
if (!e.key) { return null } if (!e.key) { return null }
return { return {
key: e.key, key: e.key,
title: e.title || '', title: e.title || '',
iconPrefix: e.iconPrefix, iconPrefix: e.iconPrefix,
icon: e.icon || '', icon: e.icon || '',
bgColor: e.bgColor || '#969696F2', bgColor: e.bgColor || '#969696F2',
color: e.color, color: e.color,
subTitle: e.subTitle || '', subTitle: e.subTitle || '',
path: e.path || null, path: e.path || null,
show: e.visible !== false, show: e.visible !== false,
group, group,
} }
} }
navList.value = [ navList.value = [
...(mp.commonFeatures || []).map(e => mapEntry(e, 'blog')).filter((n): n is INavItem => n !== null), ...(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), ...(mp.otherFeatures || []).map(e => mapEntry(e, 'more')).filter((n) : n is INavItem => n !== null),
] ]
return return
} }
}
const [dataVisualAvailable, voteAvailable, linksAvailable] = await Promise.all([ /* ---------------- 数据加载 ---------------- */
checkDataVisualPlugin(), async function handleGetData() {
checkVotePluginAvailable(), try {
checkLinksPluginAvailable(), const res = await getBlogStatistics()
]) statistics.value = res.data
} }
catch (err) {
console.error('获取统计失败', err)
uni.showToast({ icon: 'none', title: t('common.loadFailedRetry') })
}
finally {
uni.stopPullDownRefresh()
}
}
/* ---------------- 数据加载 ---------------- */ /* ---------------- 交互 ---------------- */
async function handleGetData() { function handleNavGoTo(data : { path : string }) {
try { const { path } = data
const res = await getBlogStatistics() if (!path) { return }
statistics.value = res.data
}
catch (err) {
console.error('获取统计失败', err)
uni.showToast({ icon: 'none', title: t('common.loadFailedRetry') })
}
finally {
uni.stopPullDownRefresh()
}
}
/* ---------------- 交互 ---------------- */ uni.navigateTo({ url: path })
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()
watch(haloConfigs, () => {
handleGetNavList()
}, { deep: true, immediate: true })
handleGetData() onPullDownRefresh(() => {
handleGetData()
onPullDownRefresh(() => { })
handleGetData()
})
</script> </script>
<template> <template>
<view class="box-border min-h-screen w-screen bg-page pb-2"> <view class="box-border min-h-screen w-screen bg-page pb-2">
<!-- 头部:博主信息(背景图 + 遮罩 + wave,内容区做状态栏适配) --> <!-- 头部:博主信息(背景图 + 遮罩 + wave,内容区做状态栏适配) -->
<view class="relative h-88 w-full bg-cover bg-no-repeat" :style="[calcProfileStyle]"> <view class="relative h-96 w-full bg-cover bg-no-repeat" :style="[calcProfileStyle]">
<!-- 背景遮罩 --> <view class="relative z-6 h-full flex flex-col items-center justify-center">
<view class="absolute left-0 top-0 z-0 h-full w-full bg-black/30" style="backdrop-filter:blur(2rpx)"/> <image class="uh-global-card-glass border-3 h-22 w-22 rounded-full" :src="bloggerInfo.avatar"
<view class="relative z-6 h-full flex flex-col items-center justify-center"> mode="aspectFill" />
<image <view class="mt-4 text-lg text-white font-bold text-shadow-[0_2rpx_8rpx_rgba(0,0,0,0.4)]">
class="uh-global-card-glass h-20 w-20 rounded-full" :src="bloggerInfo.avatar" {{ bloggerInfo.nickname }}
mode="aspectFill" </view>
/> <view
<view class="mt-4 text-lg text-white font-bold text-shadow-[0_2rpx_8rpx_rgba(0,0,0,0.4)]"> 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.nickname }} {{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }}
</view> </view>
<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 class="absolute left-0 top-0 z-0 h-full w-full bg-white/5" style="backdrop-filter:blur(4rpx)" />
<view v-for="item in allStats" :key="item.key" class="flex-1 py-4 text-center"> <image v-if="calcWaveUrl" :src="calcWaveUrl" mode="scaleToFill"
<wd-count-to class="gif-wave absolute bottom-0 left-0 z-90 h-18 w-full" style="mix-blend-mode: screen;" />
: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="absolute bottom-0 left-0 z-100 h-18 w-full bg-gradient-to-b from-black/0 to-page" />
/> </view>
<view class="mt-1 text-xs text-gray-500">
{{ item.label }}
</view>
</view>
</view>
<!-- 功能导航 --> <!-- 站点统计 -->
<template v-for="group in calcNavGroups" :key="group.key"> <view v-if="featureMode==='list'"
<view class="box-border px-4"> class="uh-global-card-glass uh-shadow-xs relative z-100 mx-4 flex border rounded-2xl -mt-16">
<uh-section-title class="mb-3 mt-8"> <view v-for="item in allStats" :key="item.key" class="flex-1 py-4 text-center">
{{ group.title }} <wd-count-to :key="`${item.key}-${item.value}`" :start-val="0" :end-val="item.value" :duration="900"
</uh-section-title> separator="" color="#111827" custom-class="text-lg font-bold" />
</view> <view class="mt-1 text-xs text-gray-500">
<view class="uh-global-card-glass mx-4 overflow-hidden rounded-2xl"> {{ item.label }}
<view </view>
v-for="(nav, index) in group.items" :key="nav.key" </view>
class="nav-item flex items-center justify-between px-4" </view>
: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 v-if="featureMode==='base'">
<view v-if="commonFeatures.length!==0" class="relative z-100 -mt-20 box-border overflow-hidden p-4">
<view class="box-border uh-global-card-glass uh-shadow-xs border p-3 grid grid-cols-4 gap-2 rounded-lb-2xl rounded-rb-2xl rounded-lt-3xl rounded-rt-3xl">
<view v-for="(nav) in commonFeatures" :key="nav.key"
class="uh-global-card-glass uh-shadow-xs rounded-2xl flex flex-col items-center justify-between p-2"
@click="handleNavGoTo(nav)">
<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="mt-1 text-xs text-gray-900" :style="{ color: nav.color }">
{{ nav.title }}
</text>
</view>
</view>
</view>
<template v-if="otherFeatures.length!==0">
<view class="box-border px-4 mt-2 mb-3">
<uh-section-title>
其他功能
</uh-section-title>
</view>
<view class="uh-global-card-glass uh-shadow-xs mx-4 overflow-hidden rounded-2xl">
<view v-for="(nav, index) in otherFeatures" :key="nav.key"
class="flex items-center justify-between px-4"
:class="index < otherFeatures.length - 1 ? 'border-b border-b-solid border-black/5' : ''"
@click="handleNavGoTo(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>
</template>
<!-- 功能导航:分组模式 -->
<template v-else-if="featureMode==='list'">
<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="handleNavGoTo(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>
</template>
<uh-page-copyright />
</view>
</template> </template>
+1 -1
View File
@@ -37,7 +37,7 @@ function isActive(index: number) {
<template v-if="item.iconType === 'image'"> <template v-if="item.iconType === 'image'">
<image :src="getImageByIndex(index, item)" mode="scaleToFill" class="shrink-0 h-6 w-6" /> <image :src="getImageByIndex(index, item)" mode="scaleToFill" class="shrink-0 h-6 w-6" />
</template> </template>
<view class="mt-1px text-xs shrink-0"> <view class="mt-1px text-10px shrink-0">
{{ getI18nText(item.text) }} {{ getI18nText(item.text) }}
</view> </view>
<!-- 角标显示 --> <!-- 角标显示 -->