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

style: 优化多个组件UI细节与归档页代码格式

调整了首页分类、链接操作、横幅、相册查看器、投票详情、评论弹窗等组件的样式、尺寸与文案,统一了文字大小、图标规格,重构归档页代码缩进与格式
This commit is contained in:
小莫唐尼
2026-09-13 03:05:03 +08:00
parent 2177541de3
commit b8887641e1
7 changed files with 331 additions and 348 deletions
@@ -66,7 +66,7 @@
photos.value = []
handleLoadPhotos()
}
})
}, { immediate: true })
function handleClose() {
isShow.value = false
@@ -91,7 +91,6 @@
<uh-glass-popup v-model="isShow" position="bottom" :z-index="100" custom-class="!border rounded-2xl"
safe-area-inset-bottom @close="handleClose">
<view class="box-border h-full w-full flex flex-col gap-y-3 p-4">
<!-- 头部 -->
<view class="w-full flex shrink-0 items-center justify-between">
<view class="flex items-center gap-x-1 font-bold">
{{ albumName }}
@@ -99,12 +98,12 @@
<view
class="uh-global-card-glass uh-shadow-xs h-6 w-6 flex items-center justify-center border rounded-lg"
@click="handleClose">
<wd-icon name="close" size="32rpx" />
<wd-icon name="close" size="28rpx" />
</view>
</view>
<!-- 照片列表 -->
<scroll-view class="box-border max-h-[50vh] flex-1" scroll-y :show-scrollbar="false">
<scroll-view class="w-full box-border max-h-[50vh] flex-1" scroll-y :show-scrollbar="false">
<!-- 加载/错误/空占位(状态机) -->
<uh-data-loading v-if="loadingStatus !== DataLoadingStatusEnum.Success" :use-refresh-button="false"
:loading-status="loadingStatus" error-text="照片加载失败,请点击刷新重试" empty-text="这个相册暂时还没有照片~"
@@ -122,8 +121,7 @@
<view v-if="photo.description" class="mb-1 text-xs text-white leading-5">
{{ photo.description }}
</view>
<view v-if="photo.takenDate || photo.location"
class="flex flex-col gap-y-1">
<view v-if="photo.takenDate || photo.location" class="flex flex-col gap-y-1">
<text v-if="photo.takenDate" class="text-xs text-white">
<wd-icon name="time-line"></wd-icon> {{ photo.takenDate }}
</text>
@@ -139,11 +137,11 @@
<!-- 底部关闭 -->
<view class="w-full shrink-0 flex items-center justify-center gap-x-2">
<uh-button custom-class="py-2 flex-1 uh-global-card-glass border rounded-xl bg-white/90"
<uh-button class="flex-1" custom-class="py-2 flex-1 uh-global-card-glass text-xs border rounded-xl bg-white/90"
@click="handleClose">
关闭
</uh-button>
<uh-button custom-class="flex-1 py-2 uh-global-card-glass rounded-xl !bg-love/90 text-white border"
<uh-button class="flex-1" custom-class="flex-1 py-2 uh-global-card-glass text-xs rounded-xl !bg-love/90 text-white border"
@click="handleLoadPhotos">
刷新
</uh-button>
@@ -176,8 +176,7 @@
}
async function handleHandle() {
if (!validateForm())
return
if (!validateForm()) { return }
uni.showLoading({ title: '正在提交...' })
@@ -269,54 +268,55 @@
</script>
<template>
<uh-glass-popup v-model="isShow" position="bottom" custom-class="!border rounded-2xl"
:z-index="100" @close="handleOnChange(false)">
<uh-glass-popup v-model="isShow" position="bottom" custom-class="!border rounded-2xl" :z-index="100"
@close="handleOnChange(false)">
<view class="box-border p-4">
<view
class="relative w-full flex items-center justify-around box-border px-12 text-md font-bold text-center">
{{ calcTitle }}
<view class="absolute right-0 top-1 w-6 h-6 uh-global-card-glass shadow-none border rounded-lg"
<text>{{ calcTitle }} </text>
<view
class="absolute right-0 top-0 w-6 h-6 uh-global-card-glass shadow-none border rounded-lg flex items-center justify-center"
@click="handleClose">
<wd-icon name="close" size="32rpx" class="text-gray-500"></wd-icon>
<wd-icon name="close" size="28rpx" class="text-gray-500"></wd-icon>
</view>
</view>
<scroll-view :scroll-y="true" class="form mt-6">
<view class="form-item mb-4 flex items-center">
<textarea v-model="form.content"
class="h-22 uh-global-card-glass shadow-none border box-border w-full rounded-xl p-5 text-sm"
class="h-22 uh-global-card-glass shadow-none border box-border w-full rounded-xl px-3 py-2 text-xs"
:placeholder="config.editor?.placeholder || '请输入内容,不超过200字符...'" :maxlength="200" />
</view>
<view class="form-item mb-4 flex items-center">
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">我的昵称</text>
<text class="label w-16 shrink-0 text-xs text-gray-500">我的昵称</text>
<input v-model="form.author"
class="uh-global-card-glass shadow-none border h-9 flex-1 rounded-xl px-5 text-sm"
class="uh-global-card-glass shadow-none border h-9 flex-1 rounded-xl px-3 text-xs"
placeholder="请输入您的昵称...">
</view>
<view class="form-item mb-4 flex items-center">
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">我的邮箱</text>
<text class="label w-16 shrink-0 text-sm text-gray-500">我的邮箱</text>
<input v-model="form.email"
class="uh-global-card-glass shadow-none border h-9 flex-1 rounded-xl px-5 text-sm"
class="uh-global-card-glass shadow-none border h-9 flex-1 rounded-xl px-3 text-xs"
placeholder="请输入您的邮箱...">
</view>
<view class="form-item mb-4 flex items-center">
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">我的网站</text>
<text class="label w-16 shrink-0 text-sm text-gray-500">我的网站</text>
<input v-model="form.authorUrl"
class="uh-global-card-glass shadow-none border h-9 flex-1 rounded-xl px-5 text-sm"
placeholder="请输入您的网址...">
class="uh-global-card-glass shadow-none border h-9 flex-1 rounded-xl px-3 text-xs"
placeholder="[ 可选 ] 请输入您的网址...">
</view>
<!-- 匿名评论验证码 -->
<view v-if="config?.security?.captcha?.anonymousCommentCaptcha"
class="form-item mb-4 flex items-center">
<text class="w-[140rpx] shrink-0 text-sm text-[#666]">验证码</text>
<view class="flex flex-1 items-center gap-4">
<text class="w-16 shrink-0 text-sm text-gray-500">验证码</text>
<view class="flex flex-1 items-center gap-3">
<input v-model="form.captchaCode"
class="uh-global-card-glass shadow-none border h-9 flex-1 rounded-xl px-5 text-sm"
placeholder="请输入验证码结果">
class="uh-global-card-glass shadow-none border h-9 flex-1 rounded-xl px-3 text-xs"
placeholder="请输入验证码">
<view class="h-10 w-29 flex shrink-0 items-center justify-center">
<uh-button v-if="captchaData.status === 'loading'"
class="w-full uh-global-card-glass shadow-none border py-2.5 !rounded-xl text-xs text-gray-900">获取中...</uh-button>
@@ -330,7 +330,8 @@
</view>
<view class="submit-btn my-6">
<uh-button custom-class="py-2 !rounded-xl uh-global-card-glass border" @click="handleHandle">
<uh-button custom-class="py-2.5 !rounded-xl text-xs uh-global-card-glass border"
@click="handleHandle">
提交
</uh-button>
</view>
@@ -101,8 +101,8 @@
<template>
<view v-if="bannerList.length > 0" class="relative w-full mb-6 box-border ">
<view class="box-border relative w-full h-52 overflow-hidden">
<swiper class="w-full h-52" :circular="true" :indicator-dots="false" :autoplay="true" :interval="3000"
<view class="box-border relative w-full h-56 overflow-hidden">
<swiper class="w-full h-56" :circular="true" :indicator-dots="false" :autoplay="true" :interval="3000"
:duration="1000" @change="handleBannerChange">
<swiper-item v-for="(item, index) in bannerList" :key="index" class="relative">
<image :src="item.image || item.src" class="h-full w-full" mode="aspectFill"
@@ -111,9 +111,11 @@
</swiper>
<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]">
<text class="text-2xs text-gray-900 font-bold bg-secondary px-3 py-1 rounded-xl">
<view class="box-border mt-3 flex items-center justify-center bg-secondary px-3 py-1 rounded-xl">
<text class="text-2xs text-gray-900 font-semibold">
{{ currentBanner.title }}
</text>
</view>
<text
class="text-xs text-white text-shadow-[0_2rpx_8rpx_rgba(0,0,0,0.4)]">{{ currentBanner.date }}</text>
</view>
@@ -122,10 +124,10 @@
<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="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"
class="uh-global-card-glass border w-4/5 rounded-full px-4 py-2.5 text-gray-600 flex items-center justify-center gap-x-2"
@click="handleToSearch()">
<wd-icon name="search-line" size="32rpx"></wd-icon>
<text>哈喽,想看些什么 <text class="bg-secondary rounded-xl px-1">{ 内容 }</text> 呢~</text>
<text class="text-2xs">哈喽,想看些什么 <text class="bg-secondary rounded-xl px-1">{ 内容 }</text> 呢~</text>
</view>
</view>
</view>
@@ -81,7 +81,7 @@
<template #right>
<view class="uh-global-card-glass uh-shadow-xs border flex items-center justify-center rounded-md p-1 text-gray-400"
@click="handleToCategoryPage">
<wd-icon name="arrow-right" size="28rpx" />
<wd-icon name="arrow-right" size="14px" />
</view>
</template>
</uh-section-title>
@@ -19,20 +19,20 @@
</script>
<template>
<view class="fixed bottom-8 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
class="uh-global-card-glass box-border flex items-center justify-center gap-2 border rounded-full p-1 text-primary">
<view v-if="actions.includes('apply')"
class="uh-global-card-glass box-border h-9 flex flex-1 items-center justify-center gap-x-1 border rounded-full px-8 shadow-none"
class="uh-global-card-glass box-border py-2 flex flex-1 items-center justify-center gap-x-1 border rounded-full px-8 shadow-none"
@click="emit('apply')">
<wd-icon name="edit" size="36rpx" />
<text class="shrink-0 text-sm text-gray-900 font-semibold">提交申请</text>
<wd-icon name="edit" size="32rpx" />
<text class="shrink-0 text-xs text-gray-900 font-semibold">提交申请</text>
</view>
<view v-if="actions.includes('info')"
class="uh-global-card-glass box-border h-9 flex flex-1 items-center justify-center gap-x-1 border rounded-full px-8 shadow-none"
class="uh-global-card-glass box-border py-2 flex flex-1 items-center justify-center gap-x-1 border rounded-full px-8 shadow-none"
@click="emit('info')">
<wd-icon name="info" size="36rpx" />
<text class="shrink-0 text-sm text-gray-900 font-semibold">友链信息</text>
<wd-icon name="info" size="32rpx" />
<text class="shrink-0 text-xs text-gray-900 font-semibold">友链信息</text>
</view>
</view>
</view>
+22 -40
View File
@@ -257,68 +257,50 @@ onReachBottom(() => {
<template>
<view class="min-h-screen w-screen flex flex-col bg-page">
<!-- 自定义导航 -->
<uh-navbar :scroll-y="scrollY" default-title="内容归档" title-color="text-gray-900" />
<!-- 顶部-->
<wd-sticky>
<scroll-view scroll-x class="w-full whitespace-nowrap">
<view class="box-border flex gap-2 px-3 pb-1 pt-3">
<view
v-for="(tab, index) in archiveTabs" :key="tab.key"
class="uh-global-card-glass uh-shadow-xs inline-block border rounded-2xl px-5 py-1.5 text-sm"
:class="activeTabIndex === index ? 'bg-primary font-bold' : 'text-gray-500'"
@click="handleOnTabChange({ index })"
>
<view class="box-border flex gap-2 px-3 pb-1">
<view v-for="(tab, index) in archiveTabs" :key="tab.key"
class="uh-global-card-glass uh-shadow-xs inline-block border rounded-2xl px-5 py-2 text-2xs"
:class="activeTabIndex === index ? 'bg-primary font-medium' : 'text-gray-500'"
@click="handleOnTabChange({ index })">
{{ tab.label }}
</view>
</view>
</scroll-view>
</wd-sticky>
<uh-data-loading v-if="loadingStatus !== 'success'"
:loading-status="loadingStatus"
:empty-text="calcAuditModeEnabled ? '暂无归档的内容' : '暂无归档的文章'"
@refresh="handleGetData"
/>
<uh-data-loading v-if="loadingStatus !== DataLoadingStatusEnum.Success" :loading-status="loadingStatus"
empty-text="暂无归档的内容" @refresh="handleGetData" />
<!-- 内容区域 -->
<block v-else>
<!-- 时间线 -->
<view class="timeline px-4 pt-3">
<view v-for="item in dataList" :key="item.key" class="timeline-item flex">
<!-- <view class="timeline-left w-[96rpx] flex shrink-0 flex-col items-center">
<view class="timeline-dot mt-2 h-4 w-4 rounded-full bg-secondary shadow-[0_0_0_8rpx_rgba(215,249,76,0.3)]" />
<view v-if="index !== dataList.length - 1" class="timeline-line mt-2 w-[2rpx] flex-1 bg-black/5" />
</view> -->
<!-- <view class="timeline-content min-w-0 flex-1 pb-10 pl-5"> -->
<view class="flex-1 pb-10">
<view class="mb-3 flex items-center gap-2">
<template v-else>
<view class="px-3 pt-3">
<view v-for="item in dataList" :key="item.key" class="flex">
<view class="flex-1 pb-4">
<view class="mb-3 flex items-center gap-1">
<text class="text-md text-gray-900 font-bold">{{ item.year }}年</text>
<text v-if="activeTabIndex === 0" class="text-md text-gray-900 font-bold">{{ item.month }}月</text>
<text class="rounded-full bg-secondary px-2 py-1 text-xs text-gray-500 leading-none">共 {{ item.posts.length }} 篇{{ calcAuditModeEnabled ? '内容' : '文章' }}</text>
<text v-if="activeTabIndex === 0"
class="text-md text-gray-900 font-bold">{{ item.month }}月</text>
<text class="ml-2 rounded-full bg-secondary px-2 py-1 text-xs text-gray-900 leading-none">共
{{ item.posts.length }} 篇{{ calcAuditModeEnabled ? '内容' : '文章' }}</text>
</view>
<view v-if="item.posts.length !== 0"
:class="archivesListLayout === 'double' ? 'grid grid-cols-2 gap-3' : 'flex flex-col gap-y-4'">
<uh-article-card
v-for="post in item.posts"
:key="post.metadata.name"
from="archives"
:variant="archivesListLayout === 'double' ? 'grid' : 'list'"
:article="post"
:audit-mode="calcAuditModeEnabled"
/>
</view>
<view v-else class="post-empty py-6 text-[26rpx] text-gray-400">
该日期下暂无归档文章!
<uh-article-card v-for="post in item.posts" :key="post.metadata.name" from="archives"
:variant="archivesListLayout === 'double' ? 'grid' : 'list'" :article="post"
:audit-mode="calcAuditModeEnabled" />
</view>
<uh-data-loading v-else :loading-status="DataLoadingStatusEnum.Empty" empty-text="该分类下暂无文章"
@refresh="handleGetData" />
</view>
</view>
</view>
<uh-data-loadmore :status="loadMoreStatus.status" :text="loadMoreStatus.text" />
</block>
</template>
</view>
</template>
+9 -9
View File
@@ -275,7 +275,7 @@ onShareTimeline(() => ({
<!-- 投票信息 -->
<view class="uh-global-card-glass box-border flex flex-col gap-y-3 rounded-2xl p-3">
<uh-section-title> 投票信息 </uh-section-title>
<view class="flex flex-col gap-2 rounded-xl bg-gray-100 px-4 py-3 text-sm text-gray-900">
<view class="flex flex-col gap-2 rounded-xl bg-gray-100 px-4 py-3 text-xs text-gray-900">
<view class="info-row">
<text>投票类型:</text>
<text class="tag">{{ vote.spec?._uh_type }}</text>
@@ -328,7 +328,7 @@ onShareTimeline(() => ({
</text>
</view>
<view class="options flex flex-col gap-3 w-full">
<!-- PK 对抗条(样式需顶层定义,勿嵌套在 .vote-card 下) -->
<!-- PK 对抗条 -->
<view v-if="vote.spec?.type === 'pk'" class="pk-container box-border w-full flex">
<view
v-for="(option, optionIndex) in vote.spec?.options" :key="optionIndex"
@@ -336,7 +336,7 @@ onShareTimeline(() => ({
:style="{ width: `${option._uh_percent}%` }"
>
<view
class="option-item box-border w-full rounded-xl px-3 py-3"
class="option-item box-border w-full rounded-xl px-3 py-2"
:class="optionIndex === 0 ? 'option-item-left' : 'option-item-right'"
>
{{ option._uh_percent }}%
@@ -390,34 +390,34 @@ onShareTimeline(() => ({
<view
class="uh-global-card-glass mb-2 w-full flex items-center justify-center gap-x-2 border rounded-xl"
>
<uh-button v-if="isVoted" custom-class="flex-1 py-2 !rounded-xl">
<uh-button v-if="isVoted" class="flex-1" custom-class="flex-1 py-2 !rounded-xl">
您已参与投票
</uh-button>
<uh-button
v-else-if="vote.spec?._uh_state?.state === '未开始'" custom-class="flex-1 py-2 !rounded-xl"
v-else-if="vote.spec?._uh_state?.state === '未开始'" class="flex-1" custom-class="flex-1 py-2 !rounded-xl"
@click="handleSubmitTip('投票未开始')"
>
投票未开始
</uh-button>
<uh-button
v-else-if="vote.spec?._uh_state?.state === '已结束'" custom-class="flex-1 py-2 !rounded-xl"
v-else-if="vote.spec?._uh_state?.state === '已结束'" class="flex-1" custom-class="flex-1 py-2 !rounded-xl"
@click="handleSubmitTip('投票已结束')"
>
投票已结束
</uh-button>
<uh-button
v-else-if="!vote.spec?.canAnonymously" custom-class="flex-1 py-2 !rounded-xl"
v-else-if="!vote.spec?.canAnonymously" class="flex-1" custom-class="flex-1 py-2 !rounded-xl"
@click="handleSubmit()"
>
不支持匿名投票
</uh-button>
<uh-button
v-else-if="submitForm.voteData.length === 0" custom-class="flex-1 py-2 !rounded-xl"
v-else-if="submitForm.voteData.length === 0" class="flex-1" custom-class="flex-1 py-2 !rounded-xl"
@click="handleSubmitTip('请选择选项')"
>
提交投票(请选择选项)
</uh-button>
<uh-button v-else custom-class="flex-1 py-2 !rounded-xl" @click="handleSubmit()">
<uh-button v-else class="flex-1" custom-class="flex-1 py-2 !rounded-xl" @click="handleSubmit()">
提交投票
</uh-button>
</view>