mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-07-27 04:20:43 +08:00
refactor: 重构项目并新增多项功能
1. 新增全局配置管理store,拉取uni-halo插件配置 2. 新增post-card文章卡片组件,简化首页文章列表代码 3. 优化tabbar样式与切换逻辑,调整图标库类型 4. 新增随机图片工具函数,重构首页横幅与分类模块 5. 调整openapi生成配置,新增工具类与样式类 6. 移除废弃的tabbar关于页面配置项
This commit is contained in:
@@ -32,20 +32,19 @@ function isActiveByIndex(index: number) {
|
||||
}
|
||||
|
||||
let timer: ReturnType<typeof setTimeout> | null = null
|
||||
const isActive = ref(true)
|
||||
const isActive = ref(false)
|
||||
|
||||
function activeBgColor() {
|
||||
clearTimeout(timer)
|
||||
isActive.value = false
|
||||
clearTimeout(timer)
|
||||
timer = setTimeout(() => {
|
||||
timer = null
|
||||
isActive.value = true
|
||||
}, 0)
|
||||
}, 30)
|
||||
}
|
||||
|
||||
watch(() => tabbarStore.curIdx, () => {
|
||||
activeBgColor()
|
||||
})
|
||||
}, { immediate: true })
|
||||
|
||||
function handleClick(index: number) {
|
||||
// 点击原来的不做操作
|
||||
@@ -59,6 +58,7 @@ function handleClick(index: number) {
|
||||
|
||||
const url = list[index].pagePath
|
||||
tabbarStore.setCurIdx(index)
|
||||
console.log('handleClick tabbarCacheEnable', tabbarCacheEnable)
|
||||
if (tabbarCacheEnable) {
|
||||
uni.switchTab({ url })
|
||||
}
|
||||
|
||||
+3
-12
@@ -43,9 +43,8 @@ export const customTabbarList: CustomTabBarItem[] = [
|
||||
{
|
||||
text: '%tabbar.home%',
|
||||
pagePath: 'pages/index/index',
|
||||
iconType: 'unocss',
|
||||
icon: 'i-carbon-home',
|
||||
// badge: 'dot',
|
||||
iconType: 'uiLib',
|
||||
icon: 'home',
|
||||
},
|
||||
{
|
||||
pagePath: 'pages/gallery/gallery',
|
||||
@@ -57,16 +56,8 @@ export const customTabbarList: CustomTabBarItem[] = [
|
||||
pagePath: 'pages/moments/moments',
|
||||
text: '%tabbar.moments%',
|
||||
iconType: 'uiLib',
|
||||
icon: 'gift',
|
||||
icon: 'send',
|
||||
},
|
||||
// {
|
||||
// pagePath: 'pages-blog/about/about',
|
||||
// text: '%tabbar.about%',
|
||||
// iconType: 'unocss',
|
||||
// icon: 'i-carbon-menu',
|
||||
// badge: 10,
|
||||
// roles: ['admin'],
|
||||
// },
|
||||
{
|
||||
pagePath: 'pages/me/me',
|
||||
text: '%tabbar.me%',
|
||||
|
||||
+10
-5
@@ -58,6 +58,7 @@ onMounted(() => {
|
||||
|
||||
const backTopActive = reactive({
|
||||
show: false,
|
||||
thresholdValue: 300,
|
||||
beforeScrollTop: 0,
|
||||
currentScrollTop: 0,
|
||||
})
|
||||
@@ -117,9 +118,9 @@ const triggerPageScrollDebounceFn = debounce((scrollTop: number) => {
|
||||
backTopActive.beforeScrollTop = backTopActive.currentScrollTop
|
||||
setTimeout(() => {
|
||||
backTopActive.currentScrollTop = scrollTop
|
||||
backTopActive.show = backTopActive.currentScrollTop > backTopActive.beforeScrollTop
|
||||
}, 60)
|
||||
}, 60)
|
||||
backTopActive.show = scrollTop > backTopActive.thresholdValue && backTopActive.currentScrollTop > backTopActive.beforeScrollTop
|
||||
}, 30)
|
||||
}, 30)
|
||||
|
||||
onPageScroll(({ scrollTop }) => {
|
||||
triggerPageScrollDebounceFn(scrollTop)
|
||||
@@ -137,7 +138,7 @@ function handleScrollToTop() {
|
||||
<view v-if="customTabbarEnable" :class="{ 'h-54px pb-safe': !tabBarConfig.useFloat }">
|
||||
<view class="fixed bottom-6 left-4 right-4 z-100 flex items-center justify-between gap-x-4" @touchmove.stop.prevent>
|
||||
<view
|
||||
class="uh-shadow-sm relative box-border h-54px flex flex-1 items-center overflow-hidden border border-white rounded-full border-solid bg-white/95 p-1 backdrop-blur-[3px]"
|
||||
class="uh-shadow-sm uh-backdrop-blur relative box-border h-54px flex flex-1 items-center overflow-hidden border border-white rounded-full border-solid bg-white/95 p-1"
|
||||
>
|
||||
<TabbarItem
|
||||
v-for="(item, index) in tabbarList" :key="index" :item="item" :count="tabbarList.length"
|
||||
@@ -155,7 +156,7 @@ function handleScrollToTop() {
|
||||
</view>
|
||||
<!-- 右侧搜索框或者菜单 -->
|
||||
<view
|
||||
class="uh-shadow-sm box-border h-54px w-54px flex items-center justify-center border border-white rounded-full border-solid bg-white/95 text-2xl backdrop-blur-[3px]"
|
||||
class="uh-shadow-sm uh-backdrop-blur box-border h-54px w-54px flex items-center justify-center border border-white rounded-full border-solid bg-white/95 text-2xl"
|
||||
>
|
||||
<wd-icon v-if="backTopActive.show" name="arrow-up" :size="22" @click="handleScrollToTop" />
|
||||
<wd-icon v-else name="search-line" :size="22" />
|
||||
@@ -170,4 +171,8 @@ function handleScrollToTop() {
|
||||
.uh-shadow-sm {
|
||||
box-shadow: 0 0 24rpx rgba(0, 0, 0, 0.075);
|
||||
}
|
||||
|
||||
.uh-backdrop-blur {
|
||||
backdrop-filter: blur(3px);
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user