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

feat: 新增公告模块、数据加载hook与多项体验优化

- 新增公告全流程功能:首页公告轮播、公告列表页、公告详情页
- 新增统一数据加载状态hook useDataLoading与配套测试
- 重构配置加载逻辑,新增统一bootstrap静态配置拉取
- 新增维护模式、恋爱模块支持与验证码防刷功能
- 优化投票卡片、联系页、关于页UI样式
- 新增测试页面与全局玻璃卡片样式
- 修复markdown容器内边距与首页生命周期逻辑
This commit is contained in:
小莫唐尼
2026-09-04 02:57:25 +08:00
parent 902faa70e7
commit 5f22f4fa01
39 changed files with 4474 additions and 2244 deletions
@@ -1,10 +1,12 @@
<script lang="ts" setup>
/**
* 相册密码解锁弹窗(源自旧项目 components/album-unlock-modal,新建复刻)
* 输入密码解锁加密相册
* 输入密码解锁加密相册;2026-09-03 接入插件防刷验证码:
* 首次提交若服务端要求验证码(403+附新码)则展示验证码行,携带后重试(验证码一次性)
*/
import { ref, watch } from 'vue'
import { unlockAlbum } from '@/api/uni-halo'
import { computed, ref, watch } from 'vue'
import { getPluginCaptcha, unlockAlbum } from '@/api/uni-halo'
import type { ICaptchaQuery, IPluginCaptcha } from '@/api/uni-halo'
const props = withDefaults(defineProps<{
show: boolean
@@ -24,12 +26,62 @@ const isShow = ref(false)
const password = ref('')
const loading = ref(false)
// 防刷验证码(服务端 403 附新码 / 主动刷新)
const captchaImage = ref('')
const captchaId = ref('')
const captchaCode = ref('')
const captchaLoading = ref(false)
const captchaSrc = computed(() => {
if (!captchaImage.value)
return ''
return captchaImage.value.startsWith('data:')
? captchaImage.value
: `data:image/png;base64,${captchaImage.value}`
})
function resetCaptcha() {
captchaImage.value = ''
captchaId.value = ''
captchaCode.value = ''
}
/** 用服务端返回的验证码(403 响应体附新码)填充展示 */
function applyCaptcha(captcha: IPluginCaptcha) {
captchaImage.value = captcha.imageBase64
captchaId.value = captcha.id
captchaCode.value = ''
}
/** 点击验证码图刷新 */
async function handleRefreshCaptcha() {
if (captchaLoading.value)
return
captchaLoading.value = true
try {
const res = await getPluginCaptcha()
if (res.data)
applyCaptcha(res.data)
}
catch (e) {
console.error('获取验证码失败', e)
}
finally {
captchaLoading.value = false
}
}
watch(() => props.show, (val) => {
isShow.value = val
if (val) {
password.value = ''
resetCaptcha()
}
})
function handleOnCancel() {
password.value = ''
resetCaptcha()
isShow.value = false
emit('update:show', false)
}
@@ -42,9 +94,13 @@ async function handleOnConfirm() {
loading.value = true
try {
const res = await unlockAlbum(props.albumKey, password.value)
const captchaQuery: ICaptchaQuery | undefined = captchaImage.value
? { captchaId: captchaId.value, captchaCode: captchaCode.value }
: undefined
const res = await unlockAlbum(props.albumKey, password.value, captchaQuery)
if (res.data && (res.data as { token?: string }).token) {
password.value = ''
resetCaptcha()
isShow.value = false
emit('update:show', false)
emit('success', {
@@ -57,8 +113,18 @@ async function handleOnConfirm() {
}
catch (e) {
console.error('解锁失败', e)
password.value = ''
uni.showToast({ title: '密码错误,请重试', icon: 'none' })
const err = e as { code?: number, data?: { message?: string, captcha?: IPluginCaptcha } }
if (err.code === 403 && err.data?.captcha) {
// 需要/校验失败:服务端附新验证码(一次性,旧码已作废),展示并要求重试
applyCaptcha(err.data.captcha)
uni.showToast({ title: '请完成验证码后重新解锁', icon: 'none' })
}
else {
// 密码错误等业务失败:清空密码并复位验证码(一次性,需重新获取)
password.value = ''
resetCaptcha()
uni.showToast({ title: '密码错误,请重试', icon: 'none' })
}
}
finally {
loading.value = false
@@ -96,6 +162,26 @@ async function handleOnConfirm() {
clearable
class="password-input mt-9"
/>
<!-- 防刷验证码(首次提交 403 后展示;点击图片可刷新) -->
<view v-if="captchaSrc" class="captcha-box mt-5 flex items-center justify-center gap-4">
<image
:src="captchaSrc"
class="captcha-img h-[76rpx] w-[200rpx] rounded-lg"
mode="widthFix"
@click="handleRefreshCaptcha"
/>
<wd-input
v-model="captchaCode"
placeholder="验证码"
align="center"
clearable
class="captcha-input w-[240rpx]"
/>
</view>
<view v-if="captchaSrc" class="captcha-tip mt-2 text-center text-[22rpx] text-[#aaa]">
点击图片刷新验证码
</view>
</view>
</wd-dialog>
</template>
+16
View File
@@ -0,0 +1,16 @@
<script setup lang="ts">
import { useAttrs } from 'vue';
interface IProps {
customClass ?: string | Array<string>;
}
const props = defineProps<IProps>();
const attrs = useAttrs();
</script>
<template>
<view v-bind="attrs" class="bg-primary uh-shadow-xs text-black text-sm px-4 py-1.5 rounded-lg" :class="props.customClass">
<slot></slot>
</view>
</template>
@@ -1,41 +1,84 @@
<script setup lang="ts">
import { DataLoadingStatusEnum } from '@/hooks/useDataLoadingStatus'
import type { DataLoadingStatus } from '@/hooks/useDataLoading'
interface IProps {
loadingStatus?: DataLoadingStatusEnum
/** 加载状态(取值同 useDataLoading 返回的 status) */
loadingStatus?: DataLoadingStatus
/** 占位区最小高度 */
minHeight?: string
loadingText?: string
errorText?: string
emptyText?: string
}
const props = withDefaults(defineProps<IProps>(), {
loadingStatus: DataLoadingStatusEnum.Loading,
loadingStatus: 'loading',
minHeight: '60vh',
loadingText: '稍等,正在努力加载中哦...',
errorText: '哎呀,加载失败了呢~',
emptyText: '啊偶,暂时没有数据呢~',
})
const emit = defineEmits(['refresh'])
function handleRefresh() {
emit('refresh')
}
const emit = defineEmits<{ (e: 'refresh'): void }>()
</script>
<template>
<view class="min-h-screen w-full flex items-center justify-center">
<view
class="w-full flex flex-col items-center justify-center gap-y-4 text-sm"
:style="{ minHeight: props.minHeight }"
>
<!-- 加载中 -->
<wd-loading v-if="props.loadingStatus === DataLoadingStatusEnum.Loading" :size="60">
<view>加载中...</view>
</wd-loading>
<template v-if="props.loadingStatus === 'loading'">
<!-- 表情上下漂浮动画 -->
<text class="bob-icon">
<wd-icon class-prefix="uhemoji-icon" name="-happy-1" size="100rpx" />
</text>
<view class="text-primary">
{{ props.loadingText }}
</view>
</template>
<!-- 加载错误 -->
<wd-empty v-else-if="props.loadingStatus === DataLoadingStatusEnum.Error" :icon-size="60" icon="no-result">
<view>加载失败</view>
<wd-button @click="handleRefresh">
<!-- 加载错误(可重试) -->
<template v-else-if="props.loadingStatus === 'error'">
<!-- 表情上下漂浮动画 -->
<text class="bob-icon">
<wd-icon class-prefix="uhemoji-icon" name="-injury" size="100rpx" />
</text>
<view class="text-red-400">
{{ props.errorText }}
</view>
<uh-button @click="emit('refresh')">
刷新试试
</wd-button>
</wd-empty>
</uh-button>
</template>
<!-- 加载成功 -->
<wd-empty v-else-if="props.loadingStatus === DataLoadingStatusEnum.Empty" :icon-size="60" icon="success">
<view>无数据</view>
<wd-button @click="handleRefresh">
刷新试试
</wd-button>
</wd-empty>
<!-- 无数据 -->
<template v-else>
<!-- 表情上下漂浮动画 -->
<text class="bob-icon">
<wd-icon class-prefix="uhemoji-icon" name="-confused" size="120rpx" />
</text>
<view class="text-gray-900">
{{ props.emptyText }}
</view>
</template>
</view>
</template>
<style scoped lang="scss">
/* 状态表情上下漂浮动画:@keyframes 无法用 UnoCSS / wot-ui 原子类表达,保留 scoped 样式 */
@keyframes bob-icon-float {
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(-18rpx);
}
}
.bob-icon {
display: inline-block;
animation: bob-icon-float 2s ease-in-out infinite;
}
</style>
@@ -0,0 +1,107 @@
<script lang="ts" setup>
/**
* 首页公告滚动条(plugin-uni-halo 通知公告,2026-09-03 客户端新增)
* 展示最新/置顶公告(公开 GET /notices 服务端默认 priority desc + publishTime desc),
* 取前 6 条标题垂直循环轮播:点击当前标题跳公告详情,右侧「更多」跳公告列表页。
* 无公告(或加载失败)时整条不渲染,不占首页空间。
* UIUX 见 .docs/notice-module-client-design.md
*/
import { computed, onMounted, ref } from 'vue'
import { getNotices } from '@/api/uni-halo'
import type { INoticeListVo } from '@/api/types/uni-halo'
/** 轮播展示条数上限(垂直循环) */
const MAX_SHOW = 6
const list = ref<INoticeListVo[]>([])
const showList = computed(() => list.value.slice(0, MAX_SHOW))
async function fetchNotices() {
try {
const res = await getNotices({ page: 1, size: MAX_SHOW })
list.value = res.data?.items || []
}
catch (err) {
console.error('首页公告获取失败', err)
list.value = []
}
}
/** 点击单条公告标题 → 详情页 */
function handleTap(item: INoticeListVo) {
if (!item.name)
return
uni.navigateTo({ url: `/pages-blog/notice/detail?name=${item.name}` })
}
/** 点击「公告/更多」→ 公告列表页 */
function handleGoList() {
uni.navigateTo({ url: '/pages-blog/notice/notice' })
}
onMounted(() => {
fetchNotices()
})
</script>
<template>
<view
v-if="showList.length > 0"
class="mx-3 mb-2 flex items-center rounded-xl bg-white px-3 py-1.5 shadow-sm"
>
<!-- 左侧公告入口 -->
<view class="flex shrink-0 items-center gap-1 py-2 pr-3" @click="handleGoList">
<text class="text-[28rpx]">
📢
</text>
<text class="text-[24rpx] font-bold text-[#f83856]">
公告
</text>
</view>
<!-- 标题轮播(仅一条时静态展示) -->
<view class="h-[60rpx] min-w-0 flex-1 overflow-hidden">
<swiper
v-if="showList.length > 1"
class="h-full w-full"
vertical
circular
autoplay
:interval="3500"
:duration="400"
>
<swiper-item
v-for="(item, index) in showList"
:key="item.name || index"
class="h-full w-full"
>
<view
class="flex h-full w-full items-center truncate text-[24rpx] text-[#555]"
@click="handleTap(item)"
>
{{ item.title }}
</view>
</swiper-item>
</swiper>
<view
v-else
class="flex h-full w-full items-center truncate text-[24rpx] text-[#555]"
@click="handleTap(showList[0])"
>
{{ showList[0]?.title }}
</view>
</view>
<!-- 右侧更多入口 -->
<view class="flex shrink-0 items-center gap-0.5 py-2 pl-2" @click="handleGoList">
<text class="text-[22rpx] text-[#bbb]">
更多
</text>
<wd-icon name="arrow-right" size="12px" color="#bbb" />
</view>
</view>
</template>
<style scoped lang="scss">
/* 布局由 UnoCSS 原子类实现 */
</style>
@@ -1,10 +1,12 @@
<script lang="ts" setup>
/**
* 小程序链接申请弹窗(源自 mini-program-links-design 申请入口规划)
* 公开提交到 plugin-uni-halo POST /submissions,落库为待审核(受 linkConfig.submissionEnabled 开关控制)
* 公开提交到 plugin-uni-halo POST /submissions,落库为待审核(受 linkConfig.submissionEnabled
* 开关控制);2026-09-03 接入插件防刷验证码(403+附新码 → 展示验证码行携带重试,一次性)
*/
import { ref, watch } from 'vue'
import { submitMiniProgramLinkApplication } from '@/api/uni-halo'
import { computed, ref, watch } from 'vue'
import { getPluginCaptcha, submitMiniProgramLinkApplication } from '@/api/uni-halo'
import type { ICaptchaQuery, IPluginCaptcha } from '@/api/uni-halo'
const props = withDefaults(defineProps<{
show?: boolean
@@ -44,6 +46,49 @@ const form = ref<IApplyForm>({
const submitting = ref(false)
// 防刷验证码(服务端 403 附新码 / 点击图片刷新)
const captchaImage = ref('')
const captchaId = ref('')
const captchaCode = ref('')
const captchaLoading = ref(false)
const captchaSrc = computed(() => {
if (!captchaImage.value)
return ''
return captchaImage.value.startsWith('data:')
? captchaImage.value
: `data:image/png;base64,${captchaImage.value}`
})
function resetCaptcha() {
captchaImage.value = ''
captchaId.value = ''
captchaCode.value = ''
}
function applyCaptcha(captcha: IPluginCaptcha) {
captchaImage.value = captcha.imageBase64
captchaId.value = captcha.id
captchaCode.value = ''
}
async function handleRefreshCaptcha() {
if (captchaLoading.value)
return
captchaLoading.value = true
try {
const res = await getPluginCaptcha()
if (res.data)
applyCaptcha(res.data)
}
catch (e) {
console.error('获取验证码失败', e)
}
finally {
captchaLoading.value = false
}
}
function handleResetForm() {
form.value = {
displayName: '',
@@ -56,6 +101,7 @@ function handleResetForm() {
applyRemark: '',
email: '',
}
resetCaptcha()
}
function checkIsUrl(url: string): boolean {
@@ -107,6 +153,9 @@ async function handleHandle() {
submitting.value = true
uni.showLoading({ title: '正在提交...' })
try {
const captchaQuery: ICaptchaQuery | undefined = captchaImage.value
? { captchaId: captchaId.value, captchaCode: captchaCode.value }
: undefined
await submitMiniProgramLinkApplication({
displayName: form.value.displayName.trim(),
miniProgramCode: form.value.miniProgramCode.trim(),
@@ -117,14 +166,22 @@ async function handleHandle() {
description: form.value.description.trim() || undefined,
applyRemark: form.value.applyRemark.trim() || undefined,
email: form.value.email.trim() || undefined,
})
}, captchaQuery)
uni.showToast({ icon: 'none', title: '申请提交成功,等待审核!' })
handleClose(true)
handleResetForm()
}
catch (err) {
console.error('小程序链接申请提交失败', err)
uni.showToast({ icon: 'none', title: '提交失败,请稍后重试!' })
const e = err as { code?: number, data?: { message?: string, captcha?: IPluginCaptcha } }
if (e.code === 403 && e.data?.captcha) {
// 需要/校验失败:服务端附新验证码(一次性),展示并要求重试
applyCaptcha(e.data.captcha)
uni.showToast({ icon: 'none', title: '请完成验证码后重新提交' })
}
else {
uni.showToast({ icon: 'none', title: '提交失败,请稍后重试!' })
}
}
finally {
submitting.value = false
@@ -207,6 +264,22 @@ watch(() => props.show, (newVal) => {
<input v-model="form.email" class="input h-[72rpx] flex-1 rounded-xl bg-[#f5f5f5] px-5 text-[26rpx]" placeholder="审核结果通知(选填)">
</view>
<!-- 防刷验证码(提交 403 后展示;点击图片可刷新) -->
<view v-if="captchaSrc" class="captcha-box mb-5 flex items-center">
<text class="label w-[140rpx] shrink-0 text-[26rpx] text-[#666]">验证码 *</text>
<image
:src="captchaSrc"
class="captcha-img h-[76rpx] w-[200rpx] shrink-0 rounded-lg"
mode="widthFix"
@click="handleRefreshCaptcha"
/>
<input
v-model="captchaCode"
class="input ml-3 h-[72rpx] flex-1 rounded-xl bg-[#f5f5f5] px-5 text-[26rpx]"
placeholder="输入图中字符"
>
</view>
<view class="submit-btn my-6">
<wd-button type="primary" block size="medium" :loading="submitting" @click="handleHandle">
提交申请
@@ -1,77 +1,144 @@
<script lang="ts" setup>
/**
* 通知弹窗(源自旧项目 components/notify-dialog,新建复刻)
* wd-popup + mp-html 渲染 markdown 内容,可选跳转外链
* 通知/最新公告弹窗(源自旧项目 components/notify-dialog,2026-09-03 改造为
* plugin-uni-halo 最新公告自治宿主):挂载后自动拉取 GET /notices/latest,
* 「今日已看」命中(键 notice_latest_{name}_{yyyyMMdd})则不打扰;
* 「不再提醒/查看全文」写今日键;查看全文跳公告详情页。
* 放置:页面模板中直接 <uh-notify-dialog /> 即可(easycom)。
* UIUX 见 .docs/notice-module-client-design.md
*/
import { ref, watch } from 'vue'
import { checkIsUrl } from '@/utils/url'
import { markdownConfig } from '@/config/markdown'
import { onMounted, ref } from 'vue'
import { getNoticeLatest } from '@/api/uni-halo'
import { getCache, setCache } from '@/utils/storage'
import type { INoticeListVo } from '@/api/types/uni-halo'
const props = defineProps<{
show: boolean
title: string
content: string
url: string
}>()
const HIDDEN_KEY_PREFIX = 'notice_latest_hidden'
const emit = defineEmits<{
(e: 'on-change', show: boolean): void
}>()
const isShow = ref(false)
const notice = ref<INoticeListVo | null>(null)
const checking = ref(false)
const isShow = ref(props.show)
watch(() => props.show, (val) => {
isShow.value = val
})
function handleOnChange(e: unknown) {
isShow.value = false
emit('on-change', Boolean(e))
function todayKey(name: string): string {
const date = new Date()
const pad = (n: number) => String(n).padStart(2, '0')
return `${HIDDEN_KEY_PREFIX}_${name}_${date.getFullYear()}${pad(date.getMonth() + 1)}${pad(date.getDate())}`
}
function handleToWebview() {
if (checkIsUrl(props.url)) {
uni.navigateTo({
url: `/pages-blog/website/website?data=${JSON.stringify({
title: props.title,
url: encodeURIComponent(props.url),
})}`,
success: () => {
handleOnChange(false)
},
})
function formatDate(value?: string): string {
if (!value)
return ''
const date = new Date(value)
if (Number.isNaN(date.getTime()))
return ''
const pad = (n: number) => String(n).padStart(2, '0')
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`
}
async function handleCheckLatest() {
if (checking.value)
return
checking.value = true
try {
const res = await getNoticeLatest()
const latest = res.data
if (!latest?.name || !latest.title)
return
// 今日已看过则不再打扰
if (getCache<string>(todayKey(latest.name)))
return
notice.value = latest
isShow.value = true
}
catch (err) {
console.error('获取最新公告失败', err)
}
finally {
checking.value = false
}
}
/** 仅关闭(不记录,下次进入可再弹) */
function handleClose() {
isShow.value = false
}
/** 今日不再提醒:记录后关闭 */
function handleDismissForever() {
if (notice.value?.name) {
setCache(todayKey(notice.value.name), '1')
}
isShow.value = false
}
/** 查看全文:记录今日已看并跳公告详情页 */
function handleViewAll() {
if (notice.value?.name) {
setCache(todayKey(notice.value.name), '1')
const detailName = notice.value.name
isShow.value = false
uni.navigateTo({ url: `/pages-blog/notice/detail?name=${detailName}` })
}
}
onMounted(() => {
handleCheckLatest()
})
</script>
<template>
<wd-popup v-model="isShow" width="80vw" position="center" custom-style="border-radius:12rpx;" @close="handleOnChange(false)">
<view class="uh-notify-dialog box-border w-[80vw] p-3">
<view class="text-overflow-2 mb-6 text-center font-bold">
{{ title }}
<wd-popup
v-model="isShow"
position="center"
width="80vw"
custom-style="border-radius:16rpx;"
@close="handleClose"
>
<view v-if="notice" class="uh-notify-dialog box-border w-[80vw] p-6">
<!-- 头部:标题 + 关闭 -->
<view class="flex items-center justify-between">
<view class="flex items-center gap-2">
<text class="text-[28rpx]">
📢
</text>
<text class="text-[30rpx] font-bold text-[#333]">
最新公告
</text>
<view
v-if="notice.typeDisplayName"
class="rounded px-1.5 py-0.5 text-[20rpx]"
:style="{
color: notice.typeColor || '#f83856',
backgroundColor: notice.typeColor ? `${notice.typeColor}1a` : '#fdeef1',
}"
>
{{ notice.typeDisplayName }}
</view>
</view>
<view class="flex h-8 w-8 items-center justify-center text-[#bbb]" @click="handleClose">
<wd-icon name="close" size="16px" />
</view>
</view>
<view class="content-box">
<scroll-view scroll-y :style="{ height: url ? '600rpx' : '680rpx' }">
<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="content"
:markdown="true"
:show-line-number="true"
:show-language-name="true"
copy-by-long-press
/>
</scroll-view>
<!-- 内容 -->
<view class="mt-4">
<view class="text-[32rpx] font-bold leading-snug text-[#222]">
{{ notice.title }}
</view>
<view v-if="notice.summary" class="mt-3 text-[26rpx] leading-relaxed text-[#666]">
{{ notice.summary }}
</view>
<view v-if="notice.publishTime" class="mt-3 text-[22rpx] text-[#bbb]">
{{ formatDate(notice.publishTime) }}
</view>
</view>
<view v-if="url" class="mt-6 flex justify-center">
<wd-button size="small" type="primary" @click="handleToWebview">
点击跳转内容链接
<!-- 操作 -->
<view class="mt-6 flex items-center justify-between border-t border-[#f5f5f5] pt-4">
<view class="text-[24rpx] text-[#999]" @click="handleDismissForever">
今日不再提醒
</view>
<wd-button size="small" type="primary" round @click="handleViewAll">
查看全文 →
</wd-button>
</view>
</view>
@@ -80,6 +147,6 @@ function handleToWebview() {
<style scoped lang="scss">
.uh-notify-dialog {
/* 无额外样式,布局全部由 UnoCSS 原子类实现 */
/* 布局全部由 UnoCSS 原子类实现 */
}
</style>
+9 -20
View File
@@ -91,16 +91,16 @@ defineExpose({ refresh: handleGetData })
</script>
<template>
<view class="uh-vote-card box-border w-full rounded-xl bg-white p-3 shadow-sm">
<view class="uh-vote-card uh-global-card-glass box-border w-full rounded-2xl p-4">
<view v-if="loading" class="loading py-6">
<wd-skeleton :row="2" :animated="true" />
</view>
<view v-else-if="voteData" class="vote-body">
<view class="vote-title text-[30rpx] text-[#303133] font-bold">
<view class="vote-title text-[30rpx] text-gray-900 font-bold">
{{ voteData.title }}
</view>
<view class="vote-desc mt-1 text-[24rpx] text-[#909399]">
<view class="vote-desc mt-1 text-[24rpx] text-gray-400">
{{ voteData.description }}
</view>
@@ -108,15 +108,15 @@ defineExpose({ refresh: handleGetData })
<view
v-for="option in voteData.options"
:key="option.name"
class="option mb-4 flex flex-col border-2 border-transparent rounded-xl bg-[#f7f8fa] p-5"
:class="{ active: voteTypes.includes(option.name || '') }"
class="option mb-4 flex flex-col border-2 rounded-xl p-5"
:class="voteTypes.includes(option.name || '') ? 'border-[#b9e424] bg-[#f0f7d9]' : 'border-transparent bg-[#f6f3ee]'"
@click="handleSelectOption(option)"
>
<view class="option-label text-[28rpx] text-[#303133]">
<view class="option-label text-[28rpx] text-gray-700">
<text>{{ option.label }}</text>
</view>
<view v-if="voteState === VOTE_STATES.VOTED" class="option-bar mt-3 h-4 overflow-hidden rounded-lg bg-[#f0f0f0]">
<view class="option-bar-inner h-full rounded-lg" :style="{ width: `${option.count || 0}%`, background: 'linear-gradient(90deg, #03a9f4, #64b5f6)' }" />
<view v-if="voteState === VOTE_STATES.VOTED" class="option-bar mt-3 h-4 overflow-hidden rounded-lg bg-black/5">
<view class="option-bar-inner h-full rounded-lg" :style="{ width: `${option.count || 0}%`, background: 'linear-gradient(90deg, #B9E424, #D7F94C)' }" />
</view>
</view>
</view>
@@ -126,20 +126,9 @@ defineExpose({ refresh: handleGetData })
{{ voteLabel }}
</wd-button>
</view>
<view v-else class="vote-tip mt-4 text-center text-[24rpx] text-[#909399]">
<view v-else class="vote-tip mt-4 text-center text-[24rpx] text-gray-400">
{{ voteLabel }}{{ voteResultLabel }}
</view>
</view>
</view>
</template>
<style scoped lang="scss">
.uh-vote-card {
.option {
&.active {
border-color: #03a9f4;
background-color: rgb(3 169 244 / 8%);
}
}
}
</style>