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
+9 -10
View File
@@ -2,6 +2,7 @@
import { onLoad } from '@dcloudio/uni-app'
import { useAppConfigStore } from '@/store/appConfig'
import { checkUrl } from '@/utils/url'
import { usePageScroll } from '@/hooks/usePageScroll'
definePage({
style: {
@@ -10,7 +11,8 @@
},
})
const appConfigStore = useAppConfigStore()
const { scrollY } = usePageScroll()
const appConfigStore = useAppConfigStore()
const appInfo = computed(() => {
return {
@@ -20,8 +22,7 @@
})
const links = [
{ title: '开源组织', value: '巷子工坊', copy: 'https://www.ialley.cn', tip: '巷子工坊官网已复制成功!', tileColor: '#5c6bc0', tileLetter: '组' },
{ title: '开源作者', value: '小莫唐尼', copy: 'https://www.xiaoxiaomo.cn', tip: '作者主页地址已复制', tileColor: '#26a69a', tileLetter: '作' },
{ title: '小莫唐尼', value: 'https://www.xiaoxiaomo.cn', copy: 'https://www.xiaoxiaomo.cn', tip: '作者主页地址已复制', tileColor: '#26a69a', tileLetter: '作' },
{ title: '作者博客', value: 'https://blog.xiaoxiaomo.cn', copy: 'https://blog.xiaoxiaomo.cn', tip: '作者博客地址已复制', tileColor: '#7e57c2', tileLetter: '博' },
{ title: '文档地址', value: 'https://uni-halo.925i.cn', copy: 'https://uni-halo.925i.cn', tip: '项目码云仓库已复制', tileColor: '#039be5', tileLetter: '文' },
{ title: '码云仓库', value: 'https://gitee.com/ialley-workshop-open/uni-halo', copy: 'https://gitee.com/ialley-workshop-open/uni-halo', tip: '码云仓库地址已复制', tileColor: '#c71d23', tileLetter: '码' },
@@ -46,14 +47,15 @@
<template>
<view class="box-border min-h-screen w-screen flex flex-col overflow-hidden bg-page px-4 pb-8 pt-2">
<!-- 自定义导航 -->
<uh-navbar default-title="关于项目" title-color="text-gray-900" />
<uh-navbar :scroll-y="scrollY" default-title="关于项目" title-color="text-gray-900" />
<view class="fixed -right-8 top-8 h-28 w-28 rounded-full bg-[rgba(185,228,36,0.32)] blur-xl" />
<view class="fixed -left-10 top-36 h-24 w-24 rounded-full bg-[rgba(215,249,76,0.45)] blur-xl" />
<view class="relative">
<view class="uh-global-card-glass relative flex flex-col items-center rounded-2xl px-6 pb-7 pt-10">
<image class="uh-global-card-glass uh-shadow-xs border h-18 w-18 rounded-2xl" :src="appInfo.logo" mode="aspectFill" />
<image class="uh-global-card-glass uh-shadow-xs border h-18 w-18 rounded-2xl" :src="appInfo.logo"
mode="aspectFill" />
<view class="mt-4 text-xl text- font-bold">
{{appInfo.name}}
</view>
@@ -68,7 +70,7 @@
</view>
<uh-section-title class="mb-3 mt-6"> 相关链接 </uh-section-title>
<view class="box-border uh-global-card-glass flex flex-col gap-y-6 rounded-2xl py-4">
<view v-for="(link) in links" :key="link.title" class="flex items-center gap-3 px-4"
@click="copyText(link.copy, link.tip)">
@@ -87,9 +89,6 @@
</view>
</view>
<!-- 版权 -->
<view class="copyright mt-auto pt-8 text-center text-[22rpx] text-gray-400">
<view>「 2022 uni-halo 丨 开源项目丨巷子工坊@小莫唐尼 」</view>
</view>
<uh-page-copyright />
</view>
</template>
+3 -1
View File
@@ -4,6 +4,7 @@ import { onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
import { getPostList } from '@/api/halo'
import { useAppConfigStore } from '@/store/appConfig'
import { useSettingStore } from '@/store/setting'
import { usePageScroll } from '@/hooks/usePageScroll'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import { sleep } from '@/utils/common'
import type { IPost } from '@/api/types/halo'
@@ -16,6 +17,7 @@ definePage({
},
})
const { scrollY } = usePageScroll()
const appConfigStore = useAppConfigStore()
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
@@ -252,7 +254,7 @@ onReachBottom(() => {
<template>
<view class="min-h-screen w-screen flex flex-col bg-page">
<!-- 自定义导航 -->
<uh-navbar default-title="内容归档" title-color="text-gray-900" />
<uh-navbar :scroll-y="scrollY" default-title="内容归档" title-color="text-gray-900" />
<!-- 顶部-->
<wd-sticky>
@@ -3,6 +3,7 @@
import { onLoad, onPullDownRefresh, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
import { getPostByName, getPostCommentReplyList, postTrackersCounter } from '@/api/halo'
import { useUpvote } from '@/hooks/useUpvote'
import { usePageScroll } from '@/hooks/usePageScroll'
import { createVerificationCode, requestRestrictReadCheck } from '@/api/uni-halo'
import { formatTime } from '@/utils/formatTime'
import { useAppConfigStore } from '@/store/appConfig'
@@ -25,6 +26,7 @@
},
})
const { scrollY } = usePageScroll()
const appConfigStore = useAppConfigStore()
const favoritesStore = useFavoritesStore()
const settingStore = useSettingStore()
@@ -297,8 +299,6 @@
/* ---------------- 评论 ---------------- */
function handleToComment() {
console.log('calcIsShowComment.value', calcIsShowComment.value)
console.log('result.value', result.value)
if (!result.value) {
return
}
@@ -442,17 +442,17 @@
})
const globalAppSettings = computed(() => settingStore.settings)
onMounted(() => {
console.log('获取当前所有的页面')
console.log(getCurrentPages())
onPageScroll((e : any) => {
console.log('滚动', e)
})
</script>
<template>
<view class="box-border min-h-screen w-screen flex flex-col bg-page pb-safe">
<!-- 顶部导航 -->
<uh-navbar default-title="内容详情" :need-placeholder="false" :scroll-title="result?.spec?.title" />
<uh-navbar :scroll-y="scrollY" default-title="内容详情" :need-placeholder="false"
:scroll-title="result?.spec?.title" />
<uh-data-loading v-if="loadingStatus !== 'success'" :loading-status="loadingStatus"
@refresh="handleGetData()" />
@@ -465,12 +465,12 @@
</view>
<view
class="uh-global-card-glass box-border overflow-hidden border rounded-lt-3xl rounded-rt-3xl border-b-none -translate-y-12"
class="uh-global-card-glass box-border overflow-hidden border rounded-lt-3xl rounded-rt-3xl border-b-none uh-content-lift"
:style="{
boxShadow: '0 -16rpx 12rpx rgba(0, 0, 0, 0.035)',
}">
<!-- 顶部信息 -->
<view class="box-border flex flex-col gap-3 p-3 pb-2">
<view class="box-border flex flex-col gap-3 p-4 pb-2">
<view class="flex items-center gap-x-2">
<image :src="result.owner.avatar" class="uh-global-card-glass block h-6 w-6 rounded-full"
mode="aspectFill" />
@@ -525,7 +525,7 @@
</view>
<!-- 内容区域 -->
<view class="box-border flex flex-col gap-y-3 p-3 text-gray-900 text-sm">
<view class="box-border flex flex-col gap-y-3 p-4 pt-2 text-gray-900 text-3xs">
<!-- 受限阅读 -->
<template v-if="checkPostRestrictRead(result!)">
<view v-if="showContentArr.length === 0">
@@ -565,14 +565,14 @@
<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">
<uh-section-title>版权声明</uh-section-title>
<view class="mt-3 flex flex-col gap-y-2 text-gray-600">
<view v-if="postDetailConfig.copyrightAuthor" class="text-sm leading-5">
<view class="mt-3 flex flex-col gap-y-2 text-gray-600 text-2xs">
<view v-if="postDetailConfig.copyrightAuthor" class="leading-5">
版权归属:{{ postDetailConfig.copyrightAuthor }}
</view>
<view v-if="postDetailConfig.copyrightDesc" class="text-sm leading-5">
<view v-if="postDetailConfig.copyrightDesc" class="leading-5">
版权说明:{{ postDetailConfig.copyrightDesc }}
</view>
<view v-if="postDetailConfig.copyrightViolation" class="text-sm text-red-400 leading-5">
<view v-if="postDetailConfig.copyrightViolation" class="text-red-400 leading-5">
侵权处理:{{ postDetailConfig.copyrightViolation }}
</view>
</view>
@@ -581,36 +581,38 @@
<!-- 评论区域 -->
<view class="box-border px-2">
<uh-comment-list v-if="calcIsShowComment && result" :disallow-comment="!result.spec.allowComment"
:post-name="result.metadata.name" :post="result" @on-comment="handleOnComment"
@on-comment-detail="handleOnShowCommentDetail" @on-loaded="handleCommentLoaded" />
<uh-comment-list v-if="calcIsShowComment && result"
:disallow-comment="!result.spec.allowComment" :post-name="result.metadata.name"
:post="result" @on-comment="handleOnComment" @on-comment-detail="handleOnShowCommentDetail"
@on-loaded="handleCommentLoaded" />
</view>
</view>
</view>
<!-- 悬浮操作 -->
<view class="fixed bottom-8 left-1/2 z-10 flex items-center justify-center pb-safe -translate-x-1/2">
<!-- #7BE200 -->
<view class="fixed bottom-4 left-1/2 z-10 flex items-center justify-center pb-safe uh-translate-x-center">
<view
class="uh-global-card-glass box-border flex items-center justify-center gap-2 border rounded-full p-1 text-primary">
<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="{ active: hasUpvoted() }" @click="handleDoLikesClick">
:class="[hasUpvoted()?'text-primary':'text-gray-900']" @click="handleDoLikesClick">
<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-3xs font-semibold">点赞</text>
</view>
<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"
@click="handleToComment()">
<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-3xs text-gray-900 font-semibold">评论</text>
</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"
@click="handleTogglePostFavorite">
<wd-icon class-prefix="uhemoji-icon" name="-smile-" size="36rpx" />
<text class="shrink-0 text-sm text-gray-900 font-semibold"
:style="hasFavorited() ? { color: '#ffb300' } : ''">{{ hasFavorited() ? '已收藏' : '收藏' }}</text>
<text class="shrink-0 text-3xs font-semibold"
:class="[hasFavorited()?'text-primary':'text-gray-900']">
{{ hasFavorited() ? '已收藏' : '收藏' }}
</text>
</view>
</view>
</view>
@@ -638,4 +640,16 @@
<uh-comment-modal v-if="commentModal.show" :show="commentModal.show" :is-comment="commentModal.isComment"
:title="commentModal.title" :post-name="commentModal.postName" @on-close="handleOnCommentModalClose" />
</view>
</template>
</template>
<style scoped lang="scss">
/* 内容区域上移 */
.uh-content-lift {
transform: translateY(-3rem);
}
/* 水平居中定位 */
.uh-translate-x-center {
transform: translateX(-50%);
}
</style>
+3 -1
View File
@@ -4,6 +4,7 @@ import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
import { getCategoryList, getCategoryPostList, getPostList } from '@/api/halo'
import { useAppConfigStore } from '@/store/appConfig'
import { useSettingStore } from '@/store/setting'
import { usePageScroll } from '@/hooks/usePageScroll'
import { checkAvatarUrl } from '@/utils/url'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import { sleep } from '@/utils/common'
@@ -17,6 +18,7 @@ definePage({
},
})
const { scrollY } = usePageScroll()
const appConfigStore = useAppConfigStore()
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
@@ -200,7 +202,7 @@ onReachBottom(() => {
<template>
<view class="min-h-screen w-screen flex flex-col bg-page">
<uh-navbar default-title="文章列表" title-color="text-gray-900" />
<uh-navbar :scroll-y="scrollY" default-title="文章列表" title-color="text-gray-900" />
<wd-sticky v-if="categoryOptions.length > 1" class="w-full">
<scroll-view :scroll-x="true" :show-scrollbar="false" class="w-full whitespace-nowrap pt-2">
@@ -13,6 +13,7 @@ import { copyToClipboard } from '@/utils/restrictRead'
import { sleep } from '@/utils/common'
import { markdownConfig } from '@/config/markdown'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import { usePageScroll } from '@/hooks/usePageScroll'
import type { IBannerPublicDetail } from '@/api/types/uni-halo'
definePage({
@@ -22,6 +23,7 @@ definePage({
},
})
const { scrollY } = usePageScroll()
const { loadingStatus, updateLoadingStatus } = useDataLoadingStatus()
const name = ref('')
const detail = ref<IBannerPublicDetail | null>(null)
@@ -106,7 +108,7 @@ function handleOpenLink() {
<template>
<view class="box-border min-h-screen w-screen bg-page pb-safe">
<!-- 自定义导航 -->
<uh-navbar default-title="轮播详情" title-color="text-gray-900" :scroll-title="detail?.title" />
<uh-navbar :scroll-y="scrollY" default-title="轮播详情" title-color="text-gray-900" :scroll-title="detail?.title" />
<!-- 加载/错误/空态(状态机) -->
<uh-data-loading v-if="loadingStatus !== 'success'" :loading-status="loadingStatus" min-height="75vh"
@@ -4,6 +4,7 @@ import { onLoad, onPullDownRefresh, onReachBottom, onShareAppMessage, onShareTim
import { getCategoryPostList } from '@/api/halo'
import { sleep } from '@/utils/common'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import { usePageScroll } from '@/hooks/usePageScroll'
import type { IPost, IPostListReq } from '@/api/types/halo'
definePage({
@@ -14,6 +15,7 @@ definePage({
},
})
const { scrollY } = usePageScroll()
const { loadingStatus, loadMoreStatus, updateLoadingStatus, updateLoadMoreStatus, resetLoadMoreStatus } = useDataLoadingStatus()
const queryParams = ref({ size: 10, page: 0 })
const name = ref('')
@@ -137,7 +139,7 @@ onShareTimeline(() => ({
<template>
<view class="app-page min-h-screen w-screen flex flex-col" style="background-color: #fafafd;">
<!-- 自定义导航 -->
<uh-navbar :default-title="navbarTitle" title-color="text-gray-900" />
<uh-navbar :scroll-y="scrollY" :default-title="navbarTitle" title-color="text-gray-900" />
<!-- 排序切换:默认 / 按置顶 / 按最新 / 按最旧 -->
<view class="box-border flex items-center gap-2 px-3 py-2">
+161 -144
View File
@@ -1,162 +1,179 @@
<script lang="ts" setup>
import { computed, onUnmounted, ref, watch, watchEffect } from 'vue'
import { useAppConfigStore } from '@/store/appConfig'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import { checkAvatarUrl } from '@/utils/url'
import { formatTime } from '@/utils/formatTime'
import { markdownConfig } from '@/config/markdown'
import { computed, onUnmounted, ref, watch, watchEffect } from 'vue'
import { useAppConfigStore } from '@/store/appConfig'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import { usePageScroll } from '@/hooks/usePageScroll'
import { checkAvatarUrl } from '@/utils/url'
import { formatTime } from '@/utils/formatTime'
import { markdownConfig } from '@/config/markdown'
definePage({
style: {
navigationBarTitleText: '联系博主',
navigationStyle: 'custom',
},
})
definePage({
style: {
navigationBarTitleText: '联系博主',
navigationStyle: 'custom',
},
})
interface ISoical {
name : string
content : string
color : string,
bgColor : string,
priority ?: number,
visible ?: boolean,
}
interface ISoical {
name: string
content: string
color: string
bgColor: string
priority?: number
visible?: boolean
}
const appConfigStore = useAppConfigStore()
const authorConfig = computed(() => appConfigStore.configs.authorConfig)
const { scrollY } = usePageScroll()
const appConfigStore = useAppConfigStore()
const authorConfig = computed(() => appConfigStore.configs.authorConfig)
const bloggerInfo = computed(() => {
const blogger = authorConfig.value?.blogger as { nickname ?: string, avatar ?: string, description ?: string, intro ?: string } | undefined
return {
nickname: blogger?.nickname || '',
avatar: checkAvatarUrl(blogger?.avatar),
description: blogger?.description || '',
intro: blogger?.intro || '',
}
})
const bloggerInfo = computed(() => {
const blogger = authorConfig.value?.blogger as { nickname?: string, avatar?: string, description?: string, intro?: string } | undefined
return {
nickname: blogger?.nickname || '',
avatar: checkAvatarUrl(blogger?.avatar),
description: blogger?.description || '',
intro: blogger?.intro || '',
}
})
const socialConfig = computed(() => (authorConfig.value?.social as { items ?: ISoical[] } | undefined) || {})
const socialConfig = computed(() => (authorConfig.value?.social as { items?: ISoical[] } | undefined) || {})
const socialList = computed<Array<ISoical>>(() => {
const configured = socialConfig.value.items
if (!configured || !configured.length) {
return []
}
return [...configured]
.filter(item => item.visible && item.content.trim())
.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0))
})
const socialList = computed<Array<ISoical>>(() => {
const configured = socialConfig.value.items
if (!configured || !configured.length) {
return []
}
return [...configured]
.filter(item => item.visible && item.content.trim())
.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0))
})
const isNotEmpty = computed(() => socialList.value.some(item => item.visible && item.content.trim()))
const isNotEmpty = computed(() => socialList.value.some(item => item.visible && item.content.trim()))
const { loadingStatus, updateLoadingStatus } = useDataLoadingStatus()
watchEffect(() => {
updateLoadingStatus(isNotEmpty.value ? DataLoadingStatusEnum.Success : DataLoadingStatusEnum.Empty)
})
const { loadingStatus, updateLoadingStatus } = useDataLoadingStatus()
watchEffect(() => {
updateLoadingStatus(isNotEmpty.value ? DataLoadingStatusEnum.Success : DataLoadingStatusEnum.Empty)
})
function handleOnClick(item : ISoical) {
if (!item.content) { return }
uni.setClipboardData({
data: item.content,
showToast: false,
success: () => {
uni.showToast({ icon: 'none', title: `${item.name} 已复制!` })
},
})
}
function handleOnClick(item: ISoical) {
if (!item.content) { return }
uni.setClipboardData({
data: item.content,
showToast: false,
success: () => {
uni.showToast({ icon: 'none', title: `${item.name} 已复制!` })
},
})
}
const nowText = ref('')
let clock : ReturnType<typeof setInterval> | null = null
function refreshNowText() {
nowText.value = formatTime({ d: Date.now(), f: 'yyyy年MM月dd日' })
}
refreshNowText()
clock = setInterval(refreshNowText, 1000)
onUnmounted(() => {
if (clock) {
clearInterval(clock)
}
})
const nowText = ref('')
let clock: ReturnType<typeof setInterval> | null = null
function refreshNowText() {
nowText.value = formatTime({ d: Date.now(), f: 'yyyy年MM月dd日' })
}
refreshNowText()
clock = setInterval(refreshNowText, 1000)
onUnmounted(() => {
if (clock) {
clearInterval(clock)
}
})
</script>
<template>
<view class="box-border min-h-screen w-screen overflow-hidden bg-page px-4 pb-10 pt-2">
<!-- 自定义导航 -->
<uh-navbar default-title="联系博主" title-color="text-gray-900" />
<view class="box-border min-h-screen w-screen overflow-hidden bg-page px-4 pb-10 pt-2">
<!-- 自定义导航 -->
<uh-navbar :scroll-y="scrollY" default-title="联系博主" title-color="text-gray-900" />
<view class="fixed -right-8 top-8 h-28 w-28 rounded-full bg-[rgba(185,228,36,0.32)] blur-xl" />
<view class="fixed -left-10 top-36 h-24 w-24 rounded-full bg-[rgba(215,249,76,0.45)] blur-xl" />
<view class="fixed top-8 h-28 w-28 rounded-full bg-[rgba(185,228,36,0.32)] blur-xl -right-8" />
<view class="fixed top-36 h-24 w-24 rounded-full bg-[rgba(215,249,76,0.45)] blur-xl -left-10" />
<view
class="box-border relative flex items-center justify-between uh-global-card-glass uh-shadow-xs rounded-xl p-4">
<view class="flex-1 relative flex flex-col rounded-2xl">
<view class="flex items-center gap-x-2 text-xs text-primary">
TO <text class="text-sm">·</text> 收
</view>
<view class="mt-2 text-md text-gray-900 tracking-wider">
素未谋面的朋友
</view>
<view class="mt-2 text-xs text-black/60">
展信安,见字如面。
</view>
<view class="mt-3 text-xs text-black/60">
自 · {{ bloggerInfo.nickname }}
</view>
</view>
<view
class="shrink-0 uh-global-card-glass uh-shadow-xs border relative rotate-3 box-border w-22 overflow-hidden flex flex-col gap-y-1 items-center justify-center p-2">
<image class="h-18 w-full" :src="bloggerInfo.avatar" mode="aspectFill" />
<text class="text-xs font-normal truncate">{{ bloggerInfo.nickname }}</text>
</view>
</view>
<view
class="uh-global-card-glass uh-shadow-xs relative box-border flex items-center justify-between rounded-xl p-4"
>
<view class="relative flex flex-1 flex-col rounded-2xl">
<view class="flex items-center gap-x-2 text-xs text-primary">
TO <text class="text-sm">·</text> 收
</view>
<view class="text-md mt-2 text-gray-900 tracking-wider">
素未谋面的朋友
</view>
<view class="mt-2 text-xs text-black/60">
展信安,见字如面。
</view>
<view class="mt-3 text-xs text-black/60">
自 · {{ bloggerInfo.nickname }}
</view>
</view>
<view
class="uh-global-card-glass uh-shadow-xs uh-rotate-3 relative box-border w-22 flex shrink-0 flex-col items-center justify-center gap-y-1 overflow-hidden border p-2"
>
<image class="h-18 w-full" :src="bloggerInfo.avatar" mode="aspectFill" />
<text class="truncate text-xs font-normal">{{ bloggerInfo.nickname }}</text>
</view>
</view>
<view class="mt-4 flex flex-col gap-y-6 box-border uh-global-card-glass uh-shadow-xs rounded-xl px-4 py-3">
<uh-data-loading v-if="loadingStatus !== 'success'" :loading-status="loadingStatus" min-height="65vh"
empty-text="暂无联系方式" empty-sub-text="" />
<template v-else>
<view class="w-full flex flex-col gap-y-3">
<view class="text-md text-gray-900">
展信安:
</view>
<view v-if="bloggerInfo.intro" class="text-gray-900 text-sm">
<mp-html lazy-load :domain="markdownConfig.domain ?? ''"
:loading-img="markdownConfig.loadingGif" scroll-table selectable
:tag-style="markdownConfig.tagStyle" :container-style="markdownConfig.containStyle"
:content="bloggerInfo.intro" :markdown="true" :show-line-number="true"
:show-language-name="true" copy-by-long-press />
</view>
<view v-else class="text-gray-600 text-sm py-4">
祝你早安,午安,晚安。每天都有好心情,生活愉快!
</view>
<view class="mt-2 w-full flex items-end flex-col gap-y-3">
<text class="text-md font-semibold text-gray-900">{{ bloggerInfo.nickname }}</text>
<text class="text-xs text-black/60">{{ nowText }}</text>
</view>
</view>
<view class="uh-global-card-glass uh-shadow-xs mt-4 box-border flex flex-col gap-y-6 rounded-xl px-4 py-3">
<uh-data-loading
v-if="loadingStatus !== 'success'" :loading-status="loadingStatus" min-height="65vh"
empty-text="暂无联系方式" empty-sub-text=""
/>
<template v-else>
<view class="w-full flex flex-col gap-y-3">
<view class="text-md text-gray-900">
展信安:
</view>
<view v-if="bloggerInfo.intro" class="text-sm text-gray-900">
<mp-html
lazy-load :domain="markdownConfig.domain ?? ''"
:loading-img="markdownConfig.loadingGif" scroll-table selectable
:tag-style="markdownConfig.tagStyle" :container-style="markdownConfig.containStyle"
:content="bloggerInfo.intro" :markdown="true" :show-line-number="true"
:show-language-name="true" copy-by-long-press
/>
</view>
<view v-else class="py-4 text-sm text-gray-600">
祝你早安,午安,晚安。每天都有好心情,生活愉快!
</view>
<view class="mt-2 w-full flex flex-col items-end gap-y-3">
<text class="text-md text-gray-900 font-semibold">{{ bloggerInfo.nickname }}</text>
<text class="text-xs text-black/60">{{ nowText }}</text>
</view>
</view>
<view class="box-border pt-4 w-full flex flex-col gap-y-2 border-t border-t-dashed border-gray-200">
<view class="mb-2 text-md text-gray-900">
若有意,可依此觅:
</view>
<view v-for="item in socialList" :key="item.name" class="flex items-center gap-3"
@click="handleOnClick(item)">
<view
class="uh-global-card-glass uh-shadow-xs border h-11 w-11 flex shrink-0 items-center justify-center rounded-xl"
:style="{ backgroundColor: item.bgColor ,color:item.color }">
<text class="text-sm font-bold" :style="{ color:item.color }">
{{ item.name ? item.name.charAt(0) : '' }}
</text>
</view>
<view class="min-w-0 flex flex-1 flex-col">
<text class="text-xs text-gray-500" >{{ item.name }}</text>
<view class="mt-1 break-all text-xs text-gray-900">
{{ item.content }}
</view>
</view>
<wd-icon name="copy" size="28rpx" class="shrink-0 text-primary" />
</view>
</view>
</template>
</view>
</view>
</template>
<view class="box-border w-full flex flex-col gap-y-2 border-t border-gray-200 border-t-dashed pt-4">
<view class="text-md mb-2 text-gray-900">
若有意,可依此觅:
</view>
<view
v-for="item in socialList" :key="item.name" class="flex items-center gap-3"
@click="handleOnClick(item)"
>
<view
class="uh-global-card-glass uh-shadow-xs h-11 w-11 flex shrink-0 items-center justify-center border rounded-xl"
:style="{ backgroundColor: item.bgColor, color: item.color }"
>
<text class="text-sm font-bold" :style="{ color: item.color }">
{{ item.name ? item.name.charAt(0) : '' }}
</text>
</view>
<view class="min-w-0 flex flex-1 flex-col">
<text class="text-xs text-gray-500">{{ item.name }}</text>
<view class="mt-1 break-all text-xs text-gray-900">
{{ item.content }}
</view>
</view>
<wd-icon name="copy" size="28rpx" class="shrink-0 text-primary" />
</view>
</view>
</template>
</view>
</view>
</template>
<style scoped lang="scss">
.uh-rotate-3 {
transform: rotate(3deg);
}
</style>
+3 -1
View File
@@ -3,6 +3,7 @@
import { onPullDownRefresh } from '@dcloudio/uni-app'
import { getChartData } from '@/api/uni-halo'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import { usePageScroll } from '@/hooks/usePageScroll'
import { NeedPluginIds } from '@/hooks/usePluginAvailable'
import type { IDataStatistics } from '@/api/uni-halo'
import { sleep } from '@/utils/common'
@@ -16,6 +17,7 @@
})
/** 依赖插件(plugin-data-statistics,参考 gallery 对象传参模式) */
const { scrollY } = usePageScroll()
const { pluginId, checking, tips, available: uniHaloPluginAvailable, check: checkPluginAvailable } = usePluginAvailable({
pluginId: NeedPluginIds.PluginDataStatistics,
tips: '阿偶,检测到当前插件没有安装或者启用,无法使用功能哦,请联系管理员',
@@ -171,7 +173,7 @@
<template>
<view class="bg-page box-border min-h-screen w-screen p-3">
<!-- 自定义导航 -->
<uh-navbar 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"
:checking="checking" @on-refresh="handlePluginRefresh" />
+3 -1
View File
@@ -4,6 +4,7 @@
*/
import { computed } from 'vue'
import { useAppConfigStore } from '@/store/appConfig'
import { usePageScroll } from '@/hooks/usePageScroll'
definePage({
style: {
@@ -12,6 +13,7 @@
},
})
const { scrollY } = usePageScroll()
const appConfigStore = useAppConfigStore()
const haloConfigs = computed(() => appConfigStore.configs)
@@ -42,7 +44,7 @@
<template>
<view class="box-border min-h-screen bg-page p-3 pt-2">
<!-- 自定义导航 -->
<uh-navbar default-title="免责声明" title-color="text-gray-900" />
<uh-navbar :scroll-y="scrollY" default-title="免责声明" title-color="text-gray-900" />
<view class="w-full h-full uh-global-card-glass uh-shadow-xs rounded-xl">
<!-- 通过配置 -->
+3 -1
View File
@@ -3,6 +3,7 @@ import { computed, ref, watchEffect } from 'vue'
import { formatTime } from '@/utils/formatTime'
import { useFavoritesStore } from '@/store/favorites'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import { usePageScroll } from '@/hooks/usePageScroll'
import type { FavoriteKind, IFavoriteItem } from '@/utils/favorite'
definePage({
@@ -12,6 +13,7 @@ definePage({
},
})
const { scrollY } = usePageScroll()
const favoritesStore = useFavoritesStore()
/* ---------------- Tab(文章/瞬间) ---------------- */
@@ -70,7 +72,7 @@ const emptyText = computed(() => (activeKind.value === 'post' ? '还没有收藏
<template>
<view class="box-border min-h-screen w-screen bg-page pb-10">
<!-- 自定义导航 -->
<uh-navbar default-title="我的收藏" title-color="text-gray-900"></uh-navbar>
<uh-navbar :scroll-y="scrollY" default-title="我的收藏" title-color="text-gray-900"></uh-navbar>
<!-- 顶部类型 Tab(与图库页同款:吸顶玻璃胶囊 chip) -->
<wd-sticky>
+3 -1
View File
@@ -7,6 +7,7 @@ import { useAppConfigStore } from '@/store/appConfig'
import { useSettingStore } from '@/store/setting'
import { sleep } from '@/utils/common'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import { usePageScroll } from '@/hooks/usePageScroll'
import { checkAvatarUrl, checkImageUrl } from '@/utils/url'
import { NeedPluginIds } from '@/hooks/usePluginAvailable'
import type { ILink, ILinkGroup } from '@/api/types/halo'
@@ -20,6 +21,7 @@ definePage({
},
})
const { scrollY } = usePageScroll()
const appConfigStore = useAppConfigStore()
const settingStore = useSettingStore()
@@ -407,7 +409,7 @@ onReachBottom(() => {
<template>
<view class="app-page min-h-screen w-screen flex flex-col bg-page">
<!-- 自定义导航 -->
<uh-navbar default-title="友情链接" title-color="text-gray-900" />
<uh-navbar :scroll-y="scrollY" default-title="友情链接" title-color="text-gray-900" />
<!-- 顶部 -->
<wd-sticky>
+3 -1
View File
@@ -9,6 +9,7 @@ import { getCache, setCache } from '@/utils/storage'
import { handleLoveModuleLocked } from '@/utils/loveModuleToken'
import { sleep } from '@/utils/common'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import { usePageScroll } from '@/hooks/usePageScroll'
import type { ILoveAlbum, ILovePhoto } from '@/api/types/uni-halo'
definePage({
@@ -19,6 +20,7 @@ definePage({
},
})
const { scrollY } = usePageScroll()
const appConfigStore = useAppConfigStore()
const loveConfig = computed(() => appConfigStore.configs.loveConfig)
@@ -240,7 +242,7 @@ onReachBottom(() => {
<template>
<view class="app-page box-border min-h-screen w-screen flex flex-col pb-safe">
<!-- 自定义导航 -->
<uh-navbar default-title="恋爱相册" title-color="text-love" back-class="text-love" />
<uh-navbar :scroll-y="scrollY" default-title="恋爱相册" title-color="text-love" back-class="text-love" />
<!-- 加载/错误/空占位(状态机) -->
<uh-data-loading
+4 -1
View File
@@ -6,6 +6,7 @@
import { checkImageUrl } from '@/utils/url'
import { sleep } from '@/utils/common'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import { usePageScroll } from '@/hooks/usePageScroll'
import type { ILoveDailyItem } from '@/api/types/uni-halo'
definePage({
@@ -16,6 +17,8 @@
},
})
const { scrollY } = usePageScroll()
/* ---------------- 展示层类型 ---------------- */
/** 清单展示卡片(script 预处理后的干净展示数据) */
interface ILoveItemCard {
@@ -278,7 +281,7 @@
<template>
<view class="uh-global-love-page box-border min-h-screen w-screen flex flex-col">
<uh-navbar default-title="恋爱清单" title-color="text-love" back-class="text-love"/>
<uh-navbar :scroll-y="scrollY" default-title="恋爱清单" title-color="text-love" back-class="text-love"/>
<wd-sticky>
<view class="box-border px-3 pb-1 pt-2">
+111 -151
View File
@@ -5,6 +5,8 @@
import { checkAvatarUrl, checkImageUrl } from '@/utils/url'
import { getPluginCaptcha, unlockLoveModule, type ICaptchaQuery, type IPluginCaptcha } from '@/api/uni-halo'
import { getLoveModuleToken, setLoveModuleToken, type LoveModuleKey } from '@/utils/loveModuleToken'
import { usePageScroll } from '@/hooks/usePageScroll'
import type { ILoveConfigGroup, ILoveModuleConfig } from '@/api/types/uni-halo'
definePage({
style: {
@@ -13,127 +15,72 @@
},
})
const { scrollY } = usePageScroll()
const appConfigStore = useAppConfigStore()
/* ---------------- 恋爱配置 ---------------- */
interface ILoveConfigPage {
/** 恋爱配置(数据源为 getConfigs.loveConfig 组:恋爱日记仅密码状态;
* 三模块入口即 app 端入口列表数据,2026-09-12 起 /love-config 已下线) */
interface ILoveConfigPage extends Partial<ILoveConfigGroup> {
enabled : boolean
loveDateTitle : string
loveDate : string
loveInfo : {
boyNickname : string
boyAvatar : string
girlNickname : string
girlAvatar : string
}
pageImages : {
bgImageUrl : string
waveImageUrl : string
heartImageUrl : string
}
loveDiary : { enabled : boolean, passwordEnabled ?: boolean }
ourStory : { enabled : boolean, passwordEnabled ?: boolean }
lovePhoto : { enabled : boolean, passwordEnabled ?: boolean }
loveDaily : { enabled : boolean, passwordEnabled ?: boolean }
navList ?: ILoveNavItem[]
[key : string] : unknown
}
interface ILoveNavItem {
key : string
title ?: string
subTitle ?: string
priority ?: number
visible ?: boolean
}
const loveConfig = ref<ILoveConfigPage>({
enabled: false,
loveDateTitle: '',
loveDate: '',
loveInfo: {
boyNickname: '',
boyAvatar: '',
girlNickname: '',
girlAvatar: '',
},
pageImages: {
bgImageUrl: '',
waveImageUrl: '',
heartImageUrl: '',
},
loveDiary: { enabled: false, passwordEnabled: false },
loveDiary: { passwordEnabled: false },
ourStory: { enabled: false, passwordEnabled: false },
lovePhoto: { enabled: false, passwordEnabled: false },
loveDaily: { enabled: false, passwordEnabled: false },
})
/** 恋爱页背景图 */
const loveBgImage = ref('')
const loveDayCount = ref({ d: 0, h: 0, m: 0, s: 0 })
let loveDayTimer : ReturnType<typeof setTimeout> | null = null
interface ILoveNavRenderItem {
key : string
moduleKey : LoveModuleKey
use : boolean
locked: boolean
locked : boolean
iconPrefix : string
icon : string
/** 跳转路径(插件下发,直接 navigateTo) */
path : string
title : string
subTitle : string
}
const useLocalNav = false
const DEFAULT_NAV_LIST : ILoveNavItem[] = [
{ key: 'stories', title: '恋爱故事', subTitle: '我们一起度过的那些经历', priority: 1, visible: true },
{ key: 'album', title: '恋爱相册', subTitle: '定格了我们的那些小美好', priority: 2, visible: true },
{ key: 'list', title: '恋爱清单', subTitle: '你我之间的约定我们都在努力实现', priority: 3, visible: true },
]
const NAV_META: Record<string, { iconPrefix: string, icon: string, page: string }> = {
stories: { iconPrefix: 'uhlove-icon', icon: 'gushi', page: 'stories' },
album: { iconPrefix: 'uhlove-icon', icon: 'xiangce', page: 'album' },
list: { iconPrefix: 'uhlove-icon', icon: 'liebiao', page: 'list' },
titleColor : string
subTitleColor : string
iconBgColor : string
}
const navList = ref<ILoveNavRenderItem[]>([])
/* ---------------- 数据加载 ---------------- */
function syncLoveConfigFromStore() {
const storeLove = appConfigStore.loveConfig
const appConfigs = appConfigStore.configs
const loveConfigs = appConfigStore.configs.loveConfig
loveConfig.value = {
...loveConfig.value,
...(storeLove.loveDateTitle ? { loveDateTitle: storeLove.loveDateTitle } : {}),
...(storeLove.loveDate ? { loveDate: storeLove.loveDate } : {}),
...(storeLove.enabled !== undefined ? { enabled: storeLove.enabled } : {}),
loveInfo: {
...loveConfig.value.loveInfo,
...(storeLove.loveInfo || {}),
},
...(loveConfigs?.loveInfo?.loveDateTitle ? { loveDateTitle: loveConfigs.loveInfo.loveDateTitle } : {}),
...(loveConfigs?.loveInfo?.loveDate ? { loveDate: loveConfigs.loveInfo.loveDate } : {}),
}
const loveModuleConfig = appConfigs.loveConfig as Partial<ILoveConfigPage> | undefined
// 恋爱页背景图:2026-09-11 起插件端由 loveConfig.pageImages 迁至
// pageConfig.loveDiaryConfig.bgImageUrl,优先读新位置、兼容回退旧值
const loveDiaryPageConfig = appConfigs.pageConfig?.loveDiaryConfig as
// 恋爱页背景图:读自 pageConfig.loveDiaryConfig.bgImageUrl
const loveDiaryPageConfig = appConfigStore.configs.pageConfig?.loveDiaryConfig as
{ bgImageUrl ?: string } | undefined
const pageImagesBg =
loveDiaryPageConfig?.bgImageUrl
|| loveModuleConfig?.pageImages?.bgImageUrl
|| loveConfig.value.pageImages.bgImageUrl
if (loveModuleConfig || loveDiaryPageConfig) {
loveBgImage.value = loveDiaryPageConfig?.bgImageUrl || ''
if (loveConfigs) {
loveConfig.value = {
...loveConfig.value,
pageImages: {
...loveConfig.value.pageImages,
bgImageUrl: pageImagesBg,
},
loveDiary: loveModuleConfig?.loveDiary || loveConfig.value.loveDiary,
ourStory: loveModuleConfig?.ourStory || loveConfig.value.ourStory,
lovePhoto: loveModuleConfig?.lovePhoto || loveConfig.value.lovePhoto,
loveDaily: loveModuleConfig?.loveDaily || loveConfig.value.loveDaily,
navList: loveModuleConfig?.navList || loveConfig.value.navList,
loveDiary: loveConfigs.loveDiary || loveConfig.value.loveDiary,
ourStory: loveConfigs.ourStory || loveConfig.value.ourStory,
lovePhoto: loveConfigs.lovePhoto || loveConfig.value.lovePhoto,
loveDaily: loveConfigs.loveDaily || loveConfig.value.loveDaily,
}
}
@@ -143,37 +90,36 @@
}
}
/** 入口列表:由三模块配置构建(模块 key 即唯一标识,图标/跳转路径均用插件下发字段) */
function initList() {
const configs = loveConfig.value
const configured = configs.navList
let source : ILoveNavItem[]
if (!useLocalNav && configured && configured.length) {
source = configured
} else {
source = DEFAULT_NAV_LIST;
}
const sorted = [...source].sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0))
navList.value = sorted.map((item) => {
const meta = NAV_META[item.key]
if (!meta) {
const moduleKeys : LoveModuleKey[] = ['ourStory', 'lovePhoto', 'loveDaily']
// 插件端已按 priority 降序输出,此处仍按 priority 排序兜底(缺失视为 0)
const sorted = [...moduleKeys].sort((a, b) =>
((configs[b] as ILoveModuleConfig | undefined)?.priority ?? 0) -
((configs[a] as ILoveModuleConfig | undefined)?.priority ?? 0))
navList.value = sorted.map((moduleKey) => {
const moduleCfg = configs[moduleKey] as ILoveModuleConfig | undefined
if (!moduleCfg) {
return null
}
const moduleKey = MODULE_KEY_MAP[item.key]
const moduleCfg = moduleKey
? (configs[moduleKey] as { enabled ?: boolean, passwordEnabled ?: boolean } | undefined)
: undefined
const fallback = DEFAULT_NAV_LIST.find((d) => d.key === item.key)
return {
key: item.key,
use: !!moduleCfg?.enabled && item.visible !== false,
// 模块设了密码且本地无有效 token → 显示 lock;解锁后恢复箭头
locked: !!moduleCfg?.passwordEnabled && !(moduleKey && getLoveModuleToken(moduleKey)),
iconPrefix: meta.iconPrefix,
icon: meta.icon,
title: item.title || fallback?.title || '',
subTitle: item.subTitle || fallback?.subTitle || '',
moduleKey,
use: !!moduleCfg.enabled,
// 模块设了密码且本地无有效 token → 锁定态;解锁后恢复箭头
locked: !!moduleCfg.passwordEnabled && !getLoveModuleToken(moduleKey),
// 图标/跳转路径直接消费插件下发字段(不再本地映射)
iconPrefix: moduleCfg.iconPrefix || 'uhlove-icon',
icon: moduleCfg.icon || '',
path: moduleCfg.path || '',
title: moduleCfg.title || '',
subTitle: moduleCfg.subTitle || '',
// 颜色直接消费插件下发的 hex8(#rrggbbaa),缺失回退内置默认
titleColor: moduleCfg.titleColor || '#f83856',
subTitleColor: moduleCfg.subTitleColor || '#f8385699',
iconBgColor: moduleCfg.iconBgColor || '#fce7f3',
}
}).filter((item): item is ILoveNavRenderItem => item !== null)
}).filter((item) : item is ILoveNavRenderItem => item !== null)
}
/* ---------------- 恋爱计时 ---------------- */
@@ -202,36 +148,37 @@
}
/* ---------------- 跳转(模块密码拦截) ---------------- */
const MODULE_KEY_MAP: Record<string, LoveModuleKey> = {
stories: 'ourStory',
album: 'lovePhoto',
list: 'loveDaily',
}
/** 模块密码弹窗状态 */
const unlockModalVisible = ref(false)
const pendingPage = ref('')
/** 待跳转路径(模块下发的完整 path,解锁成功后 navigateTo) */
const pendingPath = ref('')
const pendingModule = ref<LoveModuleKey>('ourStory')
/** 恋爱日记入口(love 页本身)是否锁定:设了密码且本地无有效 token */
const loveDiaryLocked = computed(() =>
!!loveConfig.value.loveDiary?.passwordEnabled && !getLoveModuleToken('loveDiary'))
function handleToPage(pageName : string) {
const module = MODULE_KEY_MAP[pageName]
const moduleCfg = module
? (loveConfig.value[module] as { enabled ?: boolean, passwordEnabled ?: boolean })
: undefined
const unlockTip = computed(() => {
const moduleCfg = loveConfig.value[pendingModule.value] as ILoveModuleConfig | undefined
const tip = moduleCfg?.title || ''
return `${tip}已设置访问密码,输入后进入`
})
function handleToPage(moduleKey : LoveModuleKey) {
const moduleCfg = loveConfig.value[moduleKey] as ILoveModuleConfig | undefined
// 模块设了密码且本地无有效 token → 先弹密码框验证
if (moduleCfg?.passwordEnabled && !getLoveModuleToken(module)) {
pendingPage.value = pageName
pendingModule.value = module
if (moduleCfg?.passwordEnabled && !getLoveModuleToken(moduleKey)) {
pendingPath.value = moduleCfg.path || ''
pendingModule.value = moduleKey
unlockModalVisible.value = true
return
}
uni.navigateTo({
url: `/pages-blog/love/${pageName}`,
})
// 跳转直接使用插件下发的 path
if (moduleCfg?.path) {
uni.navigateTo({
url: moduleCfg.path,
})
}
}
/** 通用解锁弹窗请求:unlock 签发 token(插件端要求验证码,403 附新码由弹窗展示重试) */
@@ -240,16 +187,16 @@
return res.data as { token ?: string, [key : string] : unknown } | null | undefined
}
/** 解锁成功:存 token;恋爱日记入口(loveDiary)重新拉取恋爱信息,其余进入模块 */
/** 解锁成功:存 token;恋爱日记入口(loveDiary)重新拉取配置,其余进入模块 */
function handleUnlockSuccess(data : { token ?: string }) {
if (data.token) {
setLoveModuleToken(pendingModule.value, data.token)
if (pendingModule.value === 'loveDiary') {
// 恋爱日记入口解锁:重新拉取 /love-config 并刷新页面状态
appConfigStore.fetchLoveConfig().then(() => syncLoveConfigFromStore())
// 恋爱日记入口解锁:恋爱配置已并入 getConfigs loveConfig 组,刷新后重读
appConfigStore.refreshStatic().then(() => syncLoveConfigFromStore())
}
else {
uni.navigateTo({ url: `/pages-blog/love/${pendingPage.value}` })
else if (pendingPath.value) {
uni.navigateTo({ url: pendingPath.value })
}
}
else {
@@ -267,7 +214,7 @@
syncLoveConfigFromStore()
// 恋爱日记入口(love 页本身)设了密码且本地无 token → 先弹密码框验证
if (loveDiaryLocked.value) {
pendingPage.value = ''
pendingPath.value = ''
pendingModule.value = 'loveDiary'
unlockModalVisible.value = true
}
@@ -282,32 +229,33 @@
<template>
<view class="bg-pink-50 min-h-screen w-screen">
<uh-navbar default-title="恋爱日记" :need-placeholder="false" back-class="text-love"
<uh-navbar :scroll-y="scrollY" default-title="恋爱日记" :need-placeholder="false" back-class="text-love"
title-color="!text-love"></uh-navbar>
<!-- 情侣信息 -->
<view class="box-border pt-12 relative z-10 h-92 w-screen flex flex-col items-center justify-center">
<view class="relative z-10 w-full h-full flex items-center justify-center rounded-xl">
<view class="boy flex flex-col items-center justify-center translate-x-0.5">
<view class="boy flex flex-col items-center justify-center uh-boy-offset">
<image class="uh-global-card-glass border-3 box-border border-blue-400 h-26 w-26 rounded-full"
:src="checkAvatarUrl(loveConfig.loveInfo.boyAvatar)" mode="aspectFill" />
:src="checkAvatarUrl(loveConfig.loveInfo?.boyAvatar)" mode="aspectFill" />
<view class="bg-blue-500 mt-2 text-center text-xs text-white font-bold px-2 py-1 rounded-lg">
{{ loveConfig.loveInfo.boyNickname }}
{{ loveConfig.loveInfo?.boyNickname }}
</view>
</view>
<!-- 心动呼吸动画 -->
<text class="heart-beat absolute z-10"><wd-icon class-prefix="uhlove-icon" name="aixin" size="72rpx"></wd-icon></text>
<view class="girl flex flex-col items-center justify-center -translate-x-0.5">
<text class="heart-beat absolute z-10"><wd-icon class-prefix="uhlove-icon" name="aixin"
size="72rpx"></wd-icon></text>
<view class="girl flex flex-col items-center justify-center uh-girl-offset">
<image class="uh-global-card-glass border-3 box-border border-love h-26 w-26 rounded-full"
:src="checkAvatarUrl(loveConfig.loveInfo.girlAvatar)" mode="aspectFill" />
:src="checkAvatarUrl(loveConfig.loveInfo?.girlAvatar)" mode="aspectFill" />
<view class="bg-love mt-2 text-center text-xs text-white font-bold px-2 py-1 rounded-lg">
{{ loveConfig.loveInfo.girlNickname }}
{{ loveConfig.loveInfo?.girlNickname }}
</view>
</view>
</view>
<image :src="checkImageUrl(loveConfig.pageImages.bgImageUrl)" class="absolute z-0 inset-0 w-full h-full"
mode="aspectFill" />
<view class="absolute z-2 left-0 bottom-0 w-full h-36 bg-gradient-to-b from-white/0 via-pink-50/50 to-pink-50" />
<image :src="checkImageUrl(loveBgImage)" class="absolute z-0 inset-0 w-full h-full" mode="aspectFill" />
<view
class="absolute z-2 left-0 bottom-0 w-full h-36 bg-gradient-to-b from-white/0 via-pink-50/50 to-pink-50" />
</view>
<!-- 恋爱记时 -->
@@ -338,33 +286,34 @@
<!-- 功能导航 -->
<view class="mt-6 box-border flex flex-col items-center justify-center gap-y-4 px-4">
<block v-for="(nav, index) in navList" :key="index">
<block v-for="(nav, index) in navList" :key="nav.moduleKey">
<view v-if="nav.use"
class="box-border list-item uh-global-card-glass bg-white/60 p-3 w-full flex items-center justify-around gap-x-4 rounded-2xl"
:class="`list-item-${index + 1}`" @click="handleToPage(nav.key)">
<view class="flex items-center justify-center h-12 w-12 rounded-xl opacity-70" :class="[index%2===0?'bg-pink-100':'bg-blue-100']">
:class="`list-item-${index + 1}`" @click="handleToPage(nav.moduleKey)">
<view class="flex items-center justify-center h-12 w-12 rounded-xl opacity-70"
:style="{ backgroundColor: nav.iconBgColor }">
<wd-icon :class-prefix="nav.iconPrefix" :name="nav.icon" size="66rpx" />
</view>
<view class="box-border flex flex-1 flex-col justify-center gap-y-1">
<view class="name text-md font-bold" :class="[index%2===0?'text-love':'text-blue-400']">
<view class="name text-md font-bold" :style="{ color: nav.titleColor }">
{{ nav.title }}
</view>
<view class="text-xs truncate" :class="[index%2===0?'text-love/60':'text-blue-300']">
<view class="text-xs truncate" :style="{ color: nav.subTitleColor }">
{{ nav.subTitle }}
</view>
</view>
<view class="shrink-0">
<wd-icon :name="nav.locked ? 'lock' : 'arrow-right'" :class="[index%2===0?'text-love':'text-blue-400']"
size="32rpx"></wd-icon>
<wd-icon :name="nav.locked ? 'lock' : 'arrow-right'"
:style="{ color: nav.titleColor }" size="32rpx"></wd-icon>
</view>
</view>
</block>
</view>
</view>
<!-- 模块密码验证弹窗(通用解锁弹窗;恋爱日记入口与模块共用;插件端要求验证码,403 附新码) -->
<!-- 模块密码验证弹窗-->
<uh-unlock-popup v-model:show="unlockModalVisible" title="请输入访问密码" captcha-enabled
:tip="`${pendingModule === 'loveDiary' ? '恋爱日记' : pendingModule === 'ourStory' ? '恋爱故事' : pendingModule === 'lovePhoto' ? '恋爱相册' : '恋爱清单'}已设置访问密码,输入后进入`"
:tip="unlockTip"
placeholder="请输入密码" confirm-text="进入" :request="handleUnlockRequest" @success="handleUnlockSuccess" />
</template>
@@ -375,6 +324,7 @@
}
@keyframes heartBeat {
0%,
100% {
transform: translateY(-1rem) scale(1);
@@ -446,4 +396,14 @@
transform: translateY(0);
}
}
</style>
/* 男孩头像微偏右 */
.uh-boy-offset {
transform: translateX(0.125rem);
}
/* 女孩头像微偏左 */
.uh-girl-offset {
transform: translateX(-0.125rem);
}
</style>
+3 -1
View File
@@ -8,6 +8,7 @@
import { checkImageUrl } from '@/utils/url'
import { sleep } from '@/utils/common'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import { usePageScroll } from '@/hooks/usePageScroll'
import type { ILoveStory } from '@/api/types/uni-halo'
definePage({
@@ -18,6 +19,7 @@
},
})
const { scrollY } = usePageScroll()
const appConfigStore = useAppConfigStore()
/* ---------------- 展示层类型 ---------------- */
@@ -254,7 +256,7 @@
<template>
<view class="app-page box-border min-h-screen w-screen flex flex-col">
<!-- 自定义导航 -->
<uh-navbar default-title="恋爱故事" title-color="text-love" back-class="text-love" />
<uh-navbar :scroll-y="scrollY" default-title="恋爱故事" title-color="text-love" back-class="text-love" />
<!-- 加载/错误/空占位(状态机) -->
<uh-data-loading v-if="loadingStatus !== DataLoadingStatusEnum.Success" :loading-status="loadingStatus"
+26 -15
View File
@@ -12,6 +12,7 @@
import { randomTagColor } from '@/utils/random'
import { markdownConfig } from '@/config/markdown'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import { usePageScroll } from '@/hooks/usePageScroll'
import type { IMoment } from '@/api/types/halo'
definePage({
@@ -22,6 +23,7 @@
},
})
const { scrollY } = usePageScroll()
const appConfigStore = useAppConfigStore()
const favoritesStore = useFavoritesStore()
const haloConfigs = computed(() => appConfigStore.configs)
@@ -268,18 +270,19 @@
title: moment.value?.owner?.displayName || '',
query: moment.value ? `name=${moment.value.metadata.name}` : '',
}))
onPageScroll((e : any) => {
console.log('滚动', e)
})
</script>
<template>
<view class="app-page box-border min-h-screen w-screen bg-page pb-safe">
<!-- 自定义导航 -->
<uh-navbar default-title="瞬间详情" title-color="text-gray-900" />
<uh-navbar :scroll-y="scrollY" default-title="瞬间详情" title-color="text-gray-900" />
<!-- 状态区(加载中/失败可重试/空) -->
<uh-data-loading v-if="status !== 'success'" :loading-status="status" min-height="60vh" error-text="瞬间内容加载失败"
empty-text="瞬间不存在或已被删除" @refresh="loadMoment" />
<!-- 瞬间内页(日记式:大字日期刊头 + 阅读正文 + 媒体 + 互动脚注) -->
<view v-else-if="moment" class="box-border px-3 pt-2 pb-12">
<view class="mb-3 uh-global-card-glass uh-shadow-xs overflow-hidden rounded-2xl box-border pb-4">
<!-- 刊头:大字日期 -->
@@ -309,11 +312,10 @@
<!-- 正文 -->
<view class="content px-4 mt-6 text-gray-900 text-sm">
<mp-html lazy-load :domain="markdownConfig.domain ?? ''"
:loading-img="markdownConfig.loadingGif" scroll-table selectable
:tag-style="markdownConfig.tagStyle" :container-style="markdownConfig.containStyle"
:content="moment.spec.newHtml || ''" :markdown="true" :show-line-number="true"
:show-language-name="true" copy-by-long-press />
<mp-html lazy-load :domain="markdownConfig.domain ?? ''" :loading-img="markdownConfig.loadingGif"
scroll-table selectable :tag-style="markdownConfig.tagStyle"
:container-style="markdownConfig.containStyle" :content="moment.spec.newHtml || ''"
:markdown="true" :show-line-number="true" :show-language-name="true" copy-by-long-press />
</view>
<!-- 图片附件 -->
@@ -351,7 +353,7 @@
<view v-if="moment.spec.tags && moment.spec.tags.length !== 0"
class="tags flex flex-wrap gap-2 px-4 pt-6">
<view v-for="(tag, tagIndex) in moment.spec.tags" :key="tagIndex"
class="rounded-full bg-primary px-3 py-1 text-xs font-bold" >
class="rounded-full bg-primary px-3 py-1 text-xs font-bold">
# {{ tag }}
</view>
</view>
@@ -361,14 +363,16 @@
<uh-comment-list v-if="moment" ref="commentListRef" :post-name="moment.metadata.name" :post="moment"
kind="Moment" :disallow-comment="!moment.spec.allowComment" @on-comment="handleOnComment" />
</view>
<!-- 悬浮操作(与文章详情一致:点赞/评论/收藏) -->
<view v-if="moment" class="fixed bottom-8 left-1/2 z-10 flex items-center justify-center pb-safe -translate-x-1/2">
<!-- 悬浮操作 -->
<view v-if="moment"
class="fixed bottom-8 left-1/2 z-10 flex items-center justify-center pb-safe uh-translate-x-center">
<view
class="uh-global-card-glass box-border flex items-center justify-center gap-2 border rounded-full p-1 text-primary">
<!-- 点赞 -->
<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="{ active: hasUpvoted() }" @click="handleDoLikesClick">
:class="[hasUpvoted()?'text-primary':'text-gray-900']" @click="handleDoLikesClick">
<wd-icon class-prefix="uhemoji-icon" name="-kiss-" size="36rpx" />
<text class="shrink-0 text-sm text-gray-900 font-semibold">点赞</text>
</view>
@@ -385,7 +389,7 @@
@click="handleToggleMomentFavorite">
<wd-icon class-prefix="uhemoji-icon" name="-smile-" size="36rpx" />
<text class="shrink-0 text-sm font-semibold"
:class="momentFavorited ? 'text-primary' : 'text-gray-900'">{{ momentFavorited ? '已收藏' : '收藏' }}</text>
:class="[momentFavorited ? 'text-primary' : 'text-gray-900']">{{ momentFavorited ? '已收藏' : '收藏' }}</text>
</view>
</view>
</view>
@@ -395,4 +399,11 @@
:title="commentModal.title" :post-name="commentModal.postName" subject-kind="Moment"
@on-close="handleOnCommentModalClose" />
</view>
</template>
</template>
<style scoped lang="scss">
/* 水平居中定位 */
.uh-translate-x-center {
transform: translateX(-50%);
}
</style>
@@ -1,337 +0,0 @@
<script lang="ts" setup>
/**
* 瞬间详情页(源自旧项目 pagesA/moment-detail,新建复刻)
* 展示瞬间内容(mp-html) + 图片/音频/视频附件
* 试点:useDataLoading 状态机接管加载四态 + 壁纸光斑玻璃卡设计
*/
import { computed, ref } from 'vue'
import { onLoad, onPullDownRefresh, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
import { getMomentByName } from '@/api/halo'
import { useAppConfigStore } from '@/store/appConfig'
import { checkAvatarUrl, checkThumbnailUrl } from '@/utils/url'
import { generateUUID } from '@/utils/uuid'
import { formatTime as formatTimeUtil } from '@/utils/formatTime'
import { randomTagColor } from '@/utils/random'
import { markdownConfig } from '@/config/markdown'
import { useDataLoading } from '@/hooks/useDataLoading'
import type { IMoment } from '@/api/types/halo'
definePage({
style: {
navigationBarTitleText: '瞬间详情',
enablePullDownRefresh: true,
// 下拉/回弹露出的窗口底色对齐页面底色,壁纸光斑由页面内提供
backgroundColor: '#f6f3ee',
},
})
const appConfigStore = useAppConfigStore()
const haloConfigs = computed(() => appConfigStore.configs)
const bloggerInfo = computed(() => {
const blogger = haloConfigs.value.authorConfig?.blogger as { nickname?: string, avatar?: string } | undefined
return {
nickname: blogger?.nickname || '',
avatar: checkAvatarUrl(blogger?.avatar),
}
})
const calcUseTagRandomColor = computed(() => !!haloConfigs.value.pageConfig?.momentConfig?.useTagRandomColor)
/** 站点名称(原 startConfig.title 已随启动页下线,改读 appConfig.appInfo.name) */
const siteName = computed(() => {
const appInfo = haloConfigs.value.appConfig?.appInfo as { name?: string } | undefined
return appInfo?.name || bloggerInfo.value.nickname || 'uni-halo'
})
/* ---------------- 状态 ---------------- */
const queryName = ref('')
const videoContexts = ref<Record<string, UniApp.VideoContext | undefined>>({})
const currentVideoId = ref<string | null>(null)
/** 瞬间卡片(medium 按类型拆为 images/videos/audios + 正文 tag 清理) */
type MomentCard = IMoment & {
images?: { type?: string, url: string }[]
videos?: { id?: string, url: string }[]
audios?: { type?: string, url: string }[]
spec: IMoment['spec'] & { newHtml?: string }
}
/** 移除 tag 链接 */
function removeTagLinksCompletely(htmlString: string): string {
const regex = /<a\b[^>]+class=(['"])[^'"]*\btag\b[^'"]*\1[^>]*>[\s\S]*?<\/a>/gi
return htmlString.replace(regex, '')
}
/** 瞬间详情 → 展示卡片(作者兜底 + medium 拆分 + tag 清理) */
function buildMomentCard(res: IMoment): MomentCard {
const medium = (res.spec.content?.medium || [])
.map(x => ({ ...x, url: x.url || '' }))
const owner = res.owner
return {
...res,
// 无顶层 owner(如个别历史接口)时兜底为博主信息
owner: owner?.displayName
? owner
: { displayName: bloggerInfo.value.nickname || '', name: bloggerInfo.value.nickname || '', avatar: bloggerInfo.value.avatar },
spec: {
...res.spec,
newHtml: removeTagLinksCompletely(res.spec.content?.html || ''),
},
images: medium.filter(x => x.type === 'PHOTO').map(x => ({ ...x, url: checkThumbnailUrl(x.url, true) })),
videos: medium.filter(x => x.type === 'VIDEO').map(x => ({ ...x, id: generateUUID() })),
audios: medium.filter(x => x.type === 'AUDIO'),
}
}
/* ---------------- 数据加载(useDataLoading 试点:状态由 hook 接管) ---------------- */
const { data: moment, status, run: loadMoment } = useDataLoading(
async (): Promise<MomentCard> => {
const res = await getMomentByName(queryName.value)
uni.setNavigationBarTitle({ title: '瞬间详情' })
return buildMomentCard(res.data)
},
{
onSuccess: (card) => {
nextTick(() => {
createVideoContexts(card.videos || [])
})
},
onError: () => {
uni.setNavigationBarTitle({ title: '瞬间详情' })
},
},
)
/** 标签颜色(随机模式下按数据稳定,避免每次渲染重新随机变色) */
const calcTagColors = computed(() => {
const tags = moment.value?.spec.tags || []
return tags.map(() => (calcUseTagRandomColor.value ? randomTagColor() : '#4d7c0f'))
})
function formatTime(time?: string): string {
// 与旧项目一致:yyyy年MM月dd日 星期w
return time ? formatTimeUtil({ d: time, f: 'yyyy年MM月dd日 星期w' }) : ''
}
/* ---------------- 视频互斥 ---------------- */
function createVideoContexts(videos: { id?: string }[]) {
stopAllVideos()
videos.forEach((item) => {
if (item.id) {
videoContexts.value[item.id] = uni.createVideoContext(`video_${item.id}`)
}
})
}
function stopAllVideos(excludesVideoId: string | null = null) {
Object.keys(videoContexts.value).forEach((videoId) => {
if (!excludesVideoId || excludesVideoId !== videoId) {
videoContexts.value[videoId]?.pause()
}
})
}
function onVideoPlay(videoId: string) {
currentVideoId.value = videoId
stopAllVideos(videoId)
}
function onVideoPause(videoId: string) {
if (currentVideoId.value === videoId) {
currentVideoId.value = null
}
}
function onVideoEnded() {
currentVideoId.value = null
}
/* ---------------- 交互 ---------------- */
function handlePreview(index: number, list: { url: string }[]) {
uni.previewImage({
current: index,
urls: list.map(item => item.url),
})
}
function handleToTopPage(duration = 500) {
uni.pageScrollTo({
scrollTop: 0,
duration,
fail: (err) => {
console.error('回顶失败', err)
},
})
}
/* ---------------- 生命周期 ---------------- */
onLoad((options) => {
uni.setNavigationBarTitle({ title: '瞬间加载中...' })
queryName.value = options?.name || ''
loadMoment()
})
onPullDownRefresh(async () => {
videoContexts.value = {}
currentVideoId.value = null
await loadMoment()
uni.stopPullDownRefresh()
})
onShareAppMessage(() => ({
path: `/pages-blog/moment-detail/moment-detail?name=${moment.value?.metadata.name}`,
title: moment.value?.owner?.displayName || '',
}))
onShareTimeline(() => ({
title: moment.value?.owner?.displayName || '',
query: moment.value ? `name=${moment.value.metadata.name}` : '',
}))
</script>
<template>
<view class="app-page relative box-border min-h-screen w-screen bg-page pb-8">
<!-- 壁纸(柔和光斑为卡片毛玻璃取色,固定不随滚动) -->
<view class="pointer-events-none fixed inset-0 z-0 overflow-hidden">
<view class="absolute h-[420rpx] w-[420rpx] rounded-full bg-[rgba(103,164,242,0.16)] -left-[120rpx] -top-[60rpx]" />
<view class="absolute top-[240rpx] h-[360rpx] w-[360rpx] rounded-full bg-[rgba(244,143,177,0.15)] -right-[130rpx]" />
<view class="absolute top-[760rpx] h-[400rpx] w-[400rpx] rounded-full bg-[rgba(179,157,219,0.14)] -left-[150rpx]" />
<view class="absolute top-[1220rpx] h-[380rpx] w-[380rpx] rounded-full bg-[rgba(185,228,36,0.15)] -right-[120rpx]" />
</view>
<!-- 状态区(加载中/失败可重试/空) -->
<uh-data-loading
v-if="status !== 'success'"
class="relative z-1"
:loading-status="status"
min-height="60vh"
error-text="瞬间内容加载失败"
empty-text="瞬间不存在或已被删除"
@refresh="loadMoment"
/>
<!-- 瞬间内容(悬浮玻璃卡) -->
<view v-else-if="moment" class="moment-card uh-global-card-glass relative z-1 mx-4 mt-5 flex flex-col rounded-[32rpx] p-5">
<!-- 用户区 -->
<view class="user flex items-center gap-3">
<image class="h-[96rpx] w-[96rpx] shrink-0 border-4 border-white/90 rounded-full shadow-lg" :src="moment.owner?.avatar || bloggerInfo.avatar" mode="aspectFill" />
<view class="nickname min-w-0 flex flex-1 flex-col">
<view class="nickname-text text-[32rpx] text-gray-900 font-bold">
{{ moment.owner?.displayName || bloggerInfo.nickname }}
</view>
<view class="release-time mt-1 text-[24rpx] text-gray-400">
{{ formatTime(moment.spec.releaseTime) }}
</view>
</view>
<!-- 互动数据(点赞/评论) -->
<view v-if="moment.stats && ((moment.stats.totalComment ?? 0) > 0 || (moment.stats.upvote ?? 0) > 0)" class="stats flex shrink-0 items-center gap-2">
<view class="flex items-center gap-1 rounded-full bg-black/5 px-2.5 py-1 text-[22rpx] text-gray-500">
<wd-icon name="heart" size="12px" color="#f08585" />
<text>{{ moment.stats.upvote || 0 }}</text>
</view>
<view class="flex items-center gap-1 rounded-full bg-black/5 px-2.5 py-1 text-[22rpx] text-gray-500">
<wd-icon name="message" size="12px" color="#7f8ea3" />
<text>{{ moment.stats.totalComment || 0 }}</text>
</view>
</view>
</view>
<!-- 标签 -->
<view v-if="moment.spec.tags && moment.spec.tags.length !== 0" class="tags mt-4 flex flex-wrap gap-2">
<view v-for="(tag, tagIndex) in moment.spec.tags" :key="tagIndex" class="rounded-full bg-black/5 px-3 py-1 text-[22rpx] font-bold" :style="{ color: calcTagColors[tagIndex] }">
# {{ tag }}
</view>
</view>
<!-- 内容 -->
<view class="content mt-4">
<mp-html
class="evan-markdown"
lazy-load
:domain="markdownConfig.domain ?? ''"
:loading-img="markdownConfig.loadingGif"
scroll-table
selectable
:tag-style="markdownConfig.tagStyle"
:container-style="markdownConfig.containStyle"
:content="moment.spec.newHtml || ''"
:markdown="true"
:show-line-number="true"
:show-language-name="true"
copy-by-long-press
/>
</view>
<!-- 图片附件 -->
<view v-if="moment.images && moment.images.length !== 0" class="mt-5">
<view class="mb-3 flex items-center gap-2">
<view class="h-[24rpx] w-[6rpx] rounded-full bg-secondary" />
<text class="text-[26rpx] text-gray-500 font-bold">图片附件</text>
</view>
<view class="images flex flex-wrap items-start">
<view
v-for="(image, mediumIndex) in moment.images"
:key="mediumIndex"
class="image-item box-border p-1.5"
:class="moment.images && moment.images.length === 1 ? 'h-[350rpx] w-full' : (moment.images && moment.images.length === 2 ? 'h-[250rpx] w-1/2' : 'h-[200rpx] w-1/3')"
>
<image
mode="aspectFill"
class="image-src h-full w-full rounded-lg"
:src="image.url"
@click="handlePreview(mediumIndex, moment.images || [])"
/>
</view>
</view>
</view>
<!-- 音频附件 -->
<view v-if="moment.audios && moment.audios.length !== 0" class="mt-5">
<view class="mb-3 flex items-center gap-2">
<view class="h-[24rpx] w-[6rpx] rounded-full bg-secondary" />
<text class="text-[26rpx] text-gray-500 font-bold">音频附件</text>
</view>
<view class="audio-list flex flex-col gap-3">
<uh-audio-player
v-for="audio in moment.audios"
:key="audio.url"
:src="audio.url"
:poster="bloggerInfo.avatar"
:name="`来自${siteName}的声音`"
:author="bloggerInfo.nickname"
/>
</view>
</view>
<!-- 视频附件 -->
<view v-if="moment.videos && moment.videos.length !== 0" class="mt-5">
<view class="mb-3 flex items-center gap-2">
<view class="h-[24rpx] w-[6rpx] rounded-full bg-secondary" />
<text class="text-[26rpx] text-gray-500 font-bold">视频附件</text>
</view>
<view class="video-list w-full flex flex-col gap-3">
<video
v-for="(video, index) in moment.videos"
:id="`video_${video.id}`"
:key="index"
class="video-src h-[400rpx] w-full rounded-xl"
:src="video.url"
:show-mute-btn="true"
:controls="true"
:show-center-play-btn="true"
:enable-progress-gesture="true"
@play="onVideoPlay(video.id || '')"
@pause="onVideoPause(video.id || '')"
@ended="onVideoEnded"
/>
</view>
</view>
</view>
<!-- 回顶 -->
<view class="to-top-btn uh-global-card-glass fixed bottom-[100rpx] right-6 z-6 h-[72rpx] w-[72rpx] flex items-center justify-center rounded-full" @click="handleToTopPage()">
<wd-icon name="arrow-up" size="20px" color="#6b7280" />
</view>
</view>
</template>
+3 -1
View File
@@ -3,6 +3,7 @@
import { onLoad } from '@dcloudio/uni-app'
import { getNoticeDetail } from '@/api/uni-halo'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import { usePageScroll } from '@/hooks/usePageScroll'
import { checkImageUrl, checkIsUrl } from '@/utils/url'
import { sleep } from '@/utils/common'
import { markdownConfig } from '@/config/markdown'
@@ -15,6 +16,7 @@
},
})
const { scrollY } = usePageScroll()
const { loadingStatus, updateLoadingStatus } = useDataLoadingStatus()
const name = ref('')
const detail = ref<INoticeDetail | null>(null)
@@ -90,7 +92,7 @@
<template>
<view class="box-border min-h-screen w-screen bg-page pb-safe">
<!-- 自定义导航 -->
<uh-navbar default-title="公告详情" title-color="text-gray-900" />
<uh-navbar :scroll-y="scrollY" default-title="公告详情" title-color="text-gray-900" />
<!-- 加载/错误/空态(状态机) -->
<uh-data-loading v-if="loadingStatus !== 'success'" :loading-status="loadingStatus" min-height="75vh"
+3 -1
View File
@@ -3,6 +3,7 @@
import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
import { getNotices } from '@/api/uni-halo'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import { usePageScroll } from '@/hooks/usePageScroll'
import { checkImageUrl } from '@/utils/url'
import { sleep } from '@/utils/common'
import type { INoticeListVo } from '@/api/types/uni-halo'
@@ -15,6 +16,7 @@
},
})
const { scrollY } = usePageScroll()
const PAGE_SIZE = 100
/** 状态机:首屏/下拉刷新 loading、empty、error;触底加载失败仅提示,不切整页错误态 */
@@ -180,7 +182,7 @@
<template>
<view class="app-page min-h-screen w-screen flex flex-col bg-page">
<!-- 自定义导航 -->
<uh-navbar default-title="公告中心" title-color="text-gray-900" />
<uh-navbar :scroll-y="scrollY" default-title="公告中心" title-color="text-gray-900" />
<wd-sticky>
<scroll-view scroll-x class="w-full whitespace-nowrap" :show-scrollbar="false">
+3 -1
View File
@@ -5,6 +5,7 @@
import { sleep } from '@/utils/common'
import { useAppConfigStore } from '@/store/appConfig'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import { usePageScroll } from '@/hooks/usePageScroll'
import { NeedPluginIds } from '@/hooks/usePluginAvailable'
import { markdownConfig } from '@/config/markdown'
import { debounce } from '@/utils/debounce'
@@ -17,6 +18,7 @@
},
})
const { scrollY } = usePageScroll()
const appConfigStore = useAppConfigStore()
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
@@ -206,7 +208,7 @@
<template>
<view class="box-border min-h-screen w-screen flex flex-col bg-page pb-6">
<!-- 自定义导航 -->
<uh-navbar 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"
:checking="checking" @on-refresh="handlePluginRefresh" />
+3 -1
View File
@@ -3,6 +3,7 @@
import { onLoad } from '@dcloudio/uni-app'
import { useAppConfigStore } from '@/store/appConfig'
import { useSettingStore } from '@/store/setting'
import { usePageScroll } from '@/hooks/usePageScroll'
import { collectSiteDefaults } from '@/utils/preference'
import { usePreferenceRows } from '@/hooks/usePreferenceRows'
import type { PrefDef } from '@/hooks/usePreferenceRows'
@@ -14,6 +15,7 @@
},
})
const { scrollY } = usePageScroll()
const settingStore = useSettingStore()
const appConfigStore = useAppConfigStore()
@@ -116,7 +118,7 @@
<template>
<view class="box-border min-h-screen bg-page">
<!-- 自定义标题 -->
<uh-navbar default-title="偏好设置" title-color="text-gray-900" :need-placeholder="true" />
<uh-navbar :scroll-y="scrollY" default-title="偏好设置" title-color="text-gray-900" :need-placeholder="true" />
<!-- 内容区域 -->
<view class="box-border flex flex-col gap-y-6 p-3">
+3 -1
View File
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import { usePageScroll } from '@/hooks/usePageScroll'
definePage({
style: {
@@ -7,6 +8,7 @@
navigationStyle: 'custom',
},
})
const { scrollY } = usePageScroll()
const { loadingStatus, updateLoadingStatus } = useDataLoadingStatus()
setTimeout(() => {
@@ -16,7 +18,7 @@
<template>
<view class="w-full min-h-screen bg-page">
<uh-navbar default-title="测试页面" :need-placeholder="true" title-color="text-gray-900"></uh-navbar>
<uh-navbar :scroll-y="scrollY" default-title="测试页面" :need-placeholder="true" title-color="text-gray-900"></uh-navbar>
<!-- 内容区:由于 uh-navbar 内置有占位,所以我们的页面的主要内容应该从这里开始,比如这里就可以设置内边距或者其他样式,最外层的 <view class="w-full min-h-screen bg-page"> 仅作为容器-->
<view class="box-border px-3">
+3 -1
View File
@@ -3,6 +3,7 @@ import { computed, ref } from 'vue'
import { onLoad, onPullDownRefresh, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
import { getVoteDetail, submitVote } from '@/api/uni-halo'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import { usePageScroll } from '@/hooks/usePageScroll'
import { calcVotePercent, calcVoteState, VOTE_TYPES, voteCacheUtil } from '@/utils/vote'
import { formatTime as formatTimeUtil } from '@/utils/formatTime'
import type { IVote, IVoteDetail, IVoteOption } from '@/api/types/uni-halo'
@@ -16,6 +17,7 @@ definePage({
})
/* ---------------- 状态 ---------------- */
const { scrollY } = usePageScroll()
const { loadingStatus, updateLoadingStatus } = useDataLoadingStatus()
const submitLoading = ref(false)
const pageTitle = ref('加载中...')
@@ -262,7 +264,7 @@ onShareTimeline(() => ({
<template>
<view class="box-border min-h-screen w-screen flex flex-col bg-page pb-safe">
<!-- 自定义导航 -->
<uh-navbar :default-title="pageTitle" title-color="text-gray-900" />
<uh-navbar :scroll-y="scrollY" :default-title="pageTitle" title-color="text-gray-900" />
<!-- 加载/错误/空占位(状态机) -->
<uh-data-loading
+3 -1
View File
@@ -3,6 +3,7 @@
import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
import { getVoteList } from '@/api/uni-halo'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
import { usePageScroll } from '@/hooks/usePageScroll'
import { NeedPluginIds } from '@/hooks/usePluginAvailable'
import { useAppConfigStore } from '@/store/appConfig'
import { debounce } from '@/utils/debounce'
@@ -18,6 +19,7 @@
},
})
const { scrollY } = usePageScroll()
const appConfigStore = useAppConfigStore()
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
@@ -300,7 +302,7 @@
<template>
<view class="app-page min-h-screen w-screen flex flex-col bg-page">
<uh-navbar 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"
:checking="checking" @on-refresh="handlePluginRefresh" />