mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-11-13 22:11:42 +08:00
feat: 添加恋爱故事模块功能
1. 新增uhlove图标字体库与相关样式 2. 新增恋爱故事页面与恋爱主页 3. 修复投票组件多选限制逻辑bug 4. 优化导航栏组件自定义样式能力 5. 更新滚动置顶组件黑名单与样式 6. 开启本地开发调试模式
This commit is contained in:
@@ -104,8 +104,10 @@ function handleSelectCheckboxOption(option: IVoteOption) {
|
||||
return
|
||||
|
||||
const checkedList = (spec.options || []).filter(x => x.checked && x.id !== option.id)
|
||||
if (spec.type === 'multiple' && checkedList.length >= (spec.maxVotes || 0)) {
|
||||
showToast(`最多选择 ${spec.maxVotes} 项`)
|
||||
// maxVotes 缺失(0/undefined)时不限制多选数量,避免 0 >= 0 恒真导致无法选择
|
||||
const maxVotes = spec.maxVotes
|
||||
if (spec.type === 'multiple' && maxVotes && maxVotes > 0 && checkedList.length >= maxVotes) {
|
||||
showToast(`最多选择 ${maxVotes} 项`)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -225,7 +227,7 @@ defineExpose({ refresh: handleGetData })
|
||||
</view>
|
||||
<text class="shrink-0 text-[22rpx] text-gray-400" @click="handleToVoteDetail">查看投票详情 ></text>
|
||||
</view>
|
||||
<view class="title mt-2 text-[30rpx] font-bold text-gray-900">
|
||||
<view class="title mt-2 text-[30rpx] text-gray-900 font-bold">
|
||||
{{ voteData.spec?.title }}
|
||||
</view>
|
||||
</view>
|
||||
@@ -247,8 +249,12 @@ defineExpose({ refresh: handleGetData })
|
||||
>
|
||||
<view class="is-voted-item-content relative z-2 box-border min-h-[72rpx] px-6 py-3">
|
||||
<view class="flex items-center justify-between">
|
||||
<view class="flex-1 text-left">{{ option.title }}</view>
|
||||
<view class="shrink-0">{{ handleCalcPercent(option) }}%</view>
|
||||
<view class="flex-1 text-left">
|
||||
{{ option.title }}
|
||||
</view>
|
||||
<view class="shrink-0">
|
||||
{{ handleCalcPercent(option) }}%
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -278,8 +284,12 @@ defineExpose({ refresh: handleGetData })
|
||||
>
|
||||
<view class="is-voted-item-content relative z-2 box-border min-h-[72rpx] px-6 py-3">
|
||||
<view class="flex items-center justify-between">
|
||||
<view class="flex-1 text-left">{{ option.title }}</view>
|
||||
<view class="shrink-0">{{ handleCalcPercent(option) }}%</view>
|
||||
<view class="flex-1 text-left">
|
||||
{{ option.title }}
|
||||
</view>
|
||||
<view class="shrink-0">
|
||||
{{ handleCalcPercent(option) }}%
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -300,7 +310,7 @@ defineExpose({ refresh: handleGetData })
|
||||
<!-- PK -->
|
||||
<view v-else-if="voteData.spec?.type === 'pk'" class="flex flex-col gap-2">
|
||||
<!-- PK 对抗条 -->
|
||||
<view class="pk-container box-border flex w-full">
|
||||
<view class="pk-container box-border w-full flex">
|
||||
<view
|
||||
v-for="(option, optionIndex) in voteData.spec?.options || []"
|
||||
:key="optionIndex"
|
||||
@@ -324,8 +334,12 @@ defineExpose({ refresh: handleGetData })
|
||||
>
|
||||
<view class="is-voted-item-content relative z-2 box-border min-h-[72rpx] px-6 py-3">
|
||||
<view class="flex items-center justify-between">
|
||||
<view class="flex-1 text-left">选项{{ optionIndex + 1 }}:{{ option.title }}</view>
|
||||
<view class="shrink-0">{{ handleCalcPercent(option) }}%</view>
|
||||
<view class="flex-1 text-left">
|
||||
选项{{ optionIndex + 1 }}:{{ option.title }}
|
||||
</view>
|
||||
<view class="shrink-0">
|
||||
{{ handleCalcPercent(option) }}%
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -10,12 +10,15 @@
|
||||
titleColor ?: string;
|
||||
scrollTitle ?: string;
|
||||
needPlaceholder ?: boolean;
|
||||
backClass ?: string;
|
||||
backStyle ?: string;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<IProps>(), {
|
||||
useBack: true,
|
||||
useTitle: true,
|
||||
needPlaceholder: true,
|
||||
backClass: 'text-gray-900'
|
||||
})
|
||||
|
||||
const slots = useSlots()
|
||||
@@ -35,10 +38,6 @@
|
||||
|
||||
const customCalss = computed(() => {
|
||||
const _class = []
|
||||
if (props.titleColor) {
|
||||
_class.push(props.titleColor)
|
||||
return
|
||||
}
|
||||
if (scrollThreshold.value) {
|
||||
_class.push('text-white')
|
||||
}
|
||||
@@ -48,6 +47,10 @@
|
||||
return _class;
|
||||
})
|
||||
|
||||
const titleColorClass = computed(() => {
|
||||
return [props.titleColor]
|
||||
})
|
||||
|
||||
const visibleTitle = computed(() => {
|
||||
if (!props.scrollTitle) {
|
||||
return props.defaultTitle;
|
||||
@@ -65,7 +68,7 @@
|
||||
return [
|
||||
homePage,
|
||||
'pages/maintenance/maintenance',
|
||||
...tabbarList.map(item => item.pagePath),
|
||||
...tabbarList.map((item : any) => item.pagePath),
|
||||
] as string[];
|
||||
})
|
||||
|
||||
@@ -92,14 +95,16 @@
|
||||
<!-- 左边 -->
|
||||
<view class="shrink-0 min-w-18" @click="handleBack()">
|
||||
<view v-if="props.useBack"
|
||||
class="uh-global-card-glass h-7 px-3 rounded-full border flex items-center gap-x-2 text-gray-900 text-sm">
|
||||
class="uh-global-card-glass h-7 px-3 rounded-full border flex items-center gap-x-2 text-sm"
|
||||
:class="props.backClass" :style="[props.backStyle]">
|
||||
<wd-icon name="arrow-left" size="32rpx"></wd-icon>
|
||||
<view class="w-[1px] h-4 bg-white/60" />
|
||||
<text class="text-xs font-bold">返回</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 中间 -->
|
||||
<view class="flex-1 truncate text-center font-bold transition-colors duration-300">
|
||||
<view class="flex-1 truncate text-center font-bold transition-colors duration-300"
|
||||
:class="titleColorClass">
|
||||
<slot> {{visibleTitle}} </slot>
|
||||
</view>
|
||||
<!-- 右边 -->
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
}
|
||||
|
||||
// 获取当前页面,并且设置黑名单模式,因为有的页面可能不需要滚动到顶部
|
||||
const balckList = ['pages/maintenance/maintenance','pages-blog/setting/setting']
|
||||
const balckList = ['pages/maintenance/maintenance', 'pages-blog/setting/setting', 'pages-blog/love/love']
|
||||
const pages = getCurrentPages()
|
||||
const currentPage = pages[pages.length - 1]
|
||||
const visible = computed(() => {
|
||||
@@ -23,8 +23,7 @@
|
||||
|
||||
<template>
|
||||
<view v-if="visible" class="fixed bottom-22 right-3 z-50 pb-safe">
|
||||
<view
|
||||
class="uh-global-card-glass border h-11 w-11 flex items-center justify-center rounded-full text-primary"
|
||||
<view class="uh-global-card-glass border h-11 w-11 flex items-center justify-center rounded-full text-primary"
|
||||
:class="props.customClass" @click="handleScrollTop">
|
||||
<wd-icon name="arrow-up" size="20px" />
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user