1
0
mirror of https://github.com/ialley-workshop-open/uni-halo.git synced 2026-09-12 16:40:40 +08:00

chore: 批量新增项目依赖、工具函数、页面与组件资源

1. 新增mp-html、qs等生产依赖,补全项目基础库
2. 新增平台判断、缓存、工具函数等通用工具集
3. 新增标签页、网站浏览页、关于页等业务页面
4. 新增分类卡片、通知弹窗等业务组件
5. 新增uts-progressNotification、liu-poster、uhalo-upgrade等uni模块
6. 补充audio/video组件样式补件,修复uni-components路径缺失问题
7. 新增环境变量Halo个人令牌配置项
8. 重构store导出结构,新增appConfig/halo/setting三个状态模块
9. 新增tsconfig编译目标配置,适配更高版本ES语法
This commit is contained in:
小莫唐尼
2026-08-31 19:56:16 +08:00
parent ba5b77568b
commit 067f3ed98a
147 changed files with 20866 additions and 325 deletions
+132
View File
@@ -0,0 +1,132 @@
<script lang="ts" setup>
/**
* 标签详情页(源自旧项目 pagesA/tag-detail,新建复刻)
* 展示某标签下的文章列表,分页加载
*/
import { ref } from 'vue'
import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
import { getPostByTagName } from '@/api/halo'
import type { IPost } from '@/api/types/halo'
definePage({
style: {
navigationBarTitleText: '标签详情',
enablePullDownRefresh: true,
},
})
const loading = ref<'loading' | 'success' | 'error'>('loading')
const queryParams = ref({ size: 10, page: 0 })
const name = ref('')
const pageTitle = ref('加载中...')
const dataList = ref<IPost[]>([])
const hasNext = ref(false)
const isLoadMore = ref(false)
const loadMoreText = ref('')
async function handleGetData() {
if (!isLoadMore.value) {
loading.value = 'loading'
}
loadMoreText.value = '加载中...'
try {
const res = await getPostByTagName(name.value, { ...queryParams.value })
uni.setNavigationBarTitle({ title: `${pageTitle.value} (共${res.data.total}篇)` })
hasNext.value = res.data.hasNext
dataList.value = isLoadMore.value
? dataList.value.concat(res.data.items)
: res.data.items
loadMoreText.value = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~'
setTimeout(() => {
loading.value = 'success'
}, 500)
}
catch (err) {
console.error(err)
loading.value = 'error'
loadMoreText.value = '加载失败,请下拉刷新!'
}
finally {
setTimeout(() => {
uni.stopPullDownRefresh()
}, 500)
}
}
function handleToArticleDetail(article: IPost) {
uni.navigateTo({
url: `/pages-blog/article-detail/article-detail?name=${article.metadata.name}`,
animationType: 'slide-in-right',
})
}
function handleToTopPage(duration = 500) {
uni.pageScrollTo({
scrollTop: 0,
duration,
fail: (err) => {
console.error('回顶失败', err)
},
})
}
onLoad((options) => {
name.value = options?.name || ''
pageTitle.value = options?.title || '标签详情'
handleGetData()
})
onPullDownRefresh(() => {
isLoadMore.value = false
queryParams.value.page = 0
handleGetData()
})
onReachBottom(() => {
if (hasNext.value) {
queryParams.value.page += 1
isLoadMore.value = true
handleGetData()
}
else {
uni.showToast({ icon: 'none', title: '没有更多数据了' })
}
})
</script>
<template>
<view class="app-page min-h-screen w-screen flex flex-col py-6" style="background-color: #fafafd;">
<view v-if="loading !== 'success'" class="loading-wrap min-h-screen px-6">
<wd-skeleton :row="4" :animated="true" />
</view>
<block v-else>
<view v-if="dataList.length === 0" class="empty h-[60vh] flex items-center justify-center">
<wd-empty description="该标签下暂无文章" />
</view>
<block v-else>
<uh-article-card
v-for="(article, index) in dataList"
:key="index"
:article="article"
@on-click="handleToArticleDetail"
/>
<view class="load-text py-5 text-center text-[24rpx] text-[#999]">
{{ loadMoreText }}
</view>
</block>
<view class="to-top-btn fixed bottom-[100rpx] right-6 z-6 h-[72rpx] w-[72rpx] flex items-center justify-center rounded-full bg-white shadow-sm" @click="handleToTopPage()">
<wd-icon name="arrow-up" size="20px" color="#03a9f4" />
</view>
</block>
</view>
</template>
<style scoped>
.app-page {
/* 布局全部由 UnoCSS 原子类实现 */
}
</style>