mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-09-12 16:40:40 +08:00
refactor: 重构项目页面与组件,优化整体结构与体验
1. 重构分类页面路由与实现,替换旧分类详情页为文章列表页 2. 统一使用自定义导航栏,替换原有原生导航配置 3. 重构加载状态管理,统一使用useDataLoadingStatus hook 4. 优化插件可用性检查逻辑与组件展示 5. 调整数据加载占位与空状态样式 6. 优化文章卡片样式与交互,新增分类跳转功能 7. 重构设置页枚举选择弹窗,使用wd-picker替换自定义实现 8. 删除废弃的IPluginAvailable类型与相关代码
This commit is contained in:
@@ -3,14 +3,15 @@
|
||||
* 联系博主页(源自旧项目 pagesA/contact,新建复刻)
|
||||
* 数字名片式设计:Hero 名片卡(渐变光斑透卡) + 品牌色字母瓦片联系方式列表,点击复制
|
||||
*/
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { computed, ref, watch, watchEffect } from 'vue'
|
||||
import { useAppConfigStore } from '@/store/appConfig'
|
||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||
import { checkAvatarUrl } from '@/utils/url'
|
||||
|
||||
definePage({
|
||||
style: {
|
||||
navigationBarTitleText: '联系博主',
|
||||
navigationStyle: 'custom',
|
||||
},
|
||||
})
|
||||
|
||||
@@ -58,6 +59,12 @@ const platformMeta: Record<string, { color: string, letter: string }> = {
|
||||
|
||||
const calcIsNotEmpty = computed(() => result.value.some(item => item.value !== ''))
|
||||
|
||||
/* ---------------- 加载状态机(本地配置,状态直接推导) ---------------- */
|
||||
const { loadingStatus, updateLoadingStatus } = useDataLoadingStatus()
|
||||
watchEffect(() => {
|
||||
updateLoadingStatus(calcIsNotEmpty.value ? DataLoadingStatusEnum.Success : DataLoadingStatusEnum.Empty)
|
||||
})
|
||||
|
||||
function handleGetData() {
|
||||
for (const key in socialConfig.value) {
|
||||
if (key === 'enabled')
|
||||
@@ -84,14 +91,13 @@ function handleOnClick(item: { value: string, name: string }) {
|
||||
watch(socialConfig, () => {
|
||||
handleGetData()
|
||||
}, { deep: true, immediate: true })
|
||||
|
||||
onLoad(() => {
|
||||
uni.setNavigationBarTitle({ title: '联系博主' })
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="app-page box-border min-h-screen w-screen overflow-hidden bg-page px-4 pb-10 pt-6">
|
||||
<!-- 自定义导航 -->
|
||||
<uh-navbar default-title="联系博主" title-color="text-gray-900" />
|
||||
|
||||
<!-- Hero 名片卡(主题色光斑透过毛玻璃形成柔和渐变) -->
|
||||
<view class="hero-wrap relative">
|
||||
<view class="absolute h-[220rpx] w-[220rpx] rounded-full bg-[rgba(185,228,36,0.32)] -right-8 -top-8" />
|
||||
@@ -113,8 +119,12 @@ onLoad(() => {
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 联系方式 -->
|
||||
<block v-if="calcIsNotEmpty">
|
||||
<!-- 联系方式(状态机:无联系方式 → empty 态) -->
|
||||
<uh-data-loading
|
||||
v-if="loadingStatus !== 'success'" :loading-status="loadingStatus" min-height="30vh"
|
||||
empty-text="暂无联系方式" empty-sub-text="" @refresh="handleGetData"
|
||||
/>
|
||||
<template v-else>
|
||||
<uh-section-title class="mb-3 mt-6 text-[30rpx]">
|
||||
联系方式
|
||||
</uh-section-title>
|
||||
@@ -137,9 +147,6 @@ onLoad(() => {
|
||||
<wd-icon name="copy" size="28rpx" color="#c8c2b4" class="shrink-0" />
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<view v-else class="pt-12">
|
||||
<wd-empty description="暂无联系方式" />
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user