diff --git a/src/api/types/uni-halo.ts b/src/api/types/uni-halo.ts
index c26be20..f48c8f9 100644
--- a/src/api/types/uni-halo.ts
+++ b/src/api/types/uni-halo.ts
@@ -64,10 +64,14 @@ export interface IPageConfig {
useQuickNavigation?: boolean
bannerConfig?: IBannerConfig
/** 首页精选分类引用(插件端「通用配置 → 页面设置 → 首页」配置,固定最多 3 个,
- * 数组顺序 = 展示顺序;未配置/为空时客户端回退默认取数) */
+ * 快照含名称/封面/排序权重,数组顺序 = 展示顺序;配置模式下直接映射渲染不发请求,
+ * 未配置/为空时回退默认取数) */
categories?: Array<{
name: string
displayName?: string
+ cover?: string
+ /** 分类排序权重(Halo Category.spec.priority,越大越靠前) */
+ priority?: number
}>
}
categoryConfig?: { type?: string }
diff --git a/src/components/uh-data-loading/uh-data-loading.vue b/src/components/uh-data-loading/uh-data-loading.vue
index e07ad9b..82fba98 100644
--- a/src/components/uh-data-loading/uh-data-loading.vue
+++ b/src/components/uh-data-loading/uh-data-loading.vue
@@ -35,17 +35,20 @@
mini: {
icon: '60rpx',
stage: 'h-16 w-16',
- glow: 'h-12 w-12'
+ glow: 'h-12 w-12',
+ button: '!rounded-lg py-0.5'
},
small: {
icon: '100rpx',
stage: 'h-22 w-22',
- glow: 'h-18 w-18'
+ glow: 'h-18 w-18',
+ button: '!rounded-lg py-1'
},
large: {
icon: '120rpx',
stage: 'h-32 w-32',
- glow: 'h-28 w-28'
+ glow: 'h-28 w-28',
+ button: '!rounded-lg'
},
}
@@ -95,9 +98,9 @@
-
+
-
+
@@ -114,7 +117,7 @@
{{ statusScene.subText }}
-
刷新试试
diff --git a/src/components/uh-home-category/uh-home-category.vue b/src/components/uh-home-category/uh-home-category.vue
index b9b5012..fb3b6f0 100644
--- a/src/components/uh-home-category/uh-home-category.vue
+++ b/src/components/uh-home-category/uh-home-category.vue
@@ -3,8 +3,8 @@
import { getCategoryList } from '@/api/halo'
import { checkThumbnailUrl } from '@/utils/url'
import { useAppConfigStore } from '@/store/appConfig'
- import type { ICategory } from '@/api/types/halo'
import { sleep } from '@/utils/common'
+ import type { ICategory } from '@/api/types/halo'
const appConfigStore = useAppConfigStore()
@@ -18,27 +18,27 @@
const isEnableCategoryModule = computed(() => {
return !!haloConfigs.value.pageConfig?.homeConfig?.useCategory
})
-
+
async function handleGetCategoryList() {
try {
loading.value = 'loading'
const configured = haloConfigs.value.pageConfig?.homeConfig?.categories
+ console.log('configured',configured)
let categoryListRaw : ICategory[] = []
if (configured && configured.length) {
- // 配置模式:按 name 用 in 查询(Halo fieldSelector 数组为 AND 语义,多 name 需 in 语法)
- const names = configured.map(c => c.name)
- const res = await getCategoryList({
- fieldSelector: [`metadata.name in (${names.join(',')})`],
- size: 3,
- })
- // 按配置顺序排列;配置的 name 查不到(分类已删除)则跳过
- const byName = new Map(res.data.items.map(item => [item.metadata.name, item]))
- categoryListRaw = names
- .map(name => byName.get(name))
- .filter((item) : item is ICategory => !!item)
+ // 配置模式
+ categoryListRaw = configured.map(c => ({
+ metadata: { name: c.name },
+ spec: {
+ displayName: c.displayName || '',
+ slug: '',
+ cover: checkThumbnailUrl(c.cover),
+ priority: c.priority,
+ }
+ } as ICategory))
}
else {
- // 默认模式(老部署无配置):保持原有取数与排序
+ // 默认模式
const res = await getCategoryList({ fieldSelector: ['spec.hideFromList=false'], size: 3 })
categoryListRaw = res.data.items
}
@@ -50,13 +50,7 @@
postCount: item.postCount ?? 0
}
})
- .sort((a, b) => {
- if (configured && configured.length) {
- return 0
- }
- return (b.postCount || 0) - (a.postCount || 0)
- })
-
+ .sort((a, b) => b.spec.priority - a.spec.priority)
await sleep(600)
loading.value = 'success'
}
@@ -66,21 +60,17 @@
}
}
-
function handleToCategoryPage() {
uni.switchTab({ url: '/pages/tabbar/category/category' })
}
-
function handleToCategoryBy(category : ICategory) {
uni.navigateTo({
url: `/pages-blog/category-articles/category-articles?name=${category.metadata.name}&title=${category.spec.displayName}`,
})
}
- onMounted(() => {
- handleGetCategoryList()
- })
+ onMounted(handleGetCategoryList)
diff --git a/src/components/uh-maintenance-detail/uh-maintenance-detail.vue b/src/components/uh-maintenance-detail/uh-maintenance-detail.vue
index ffcd485..e22528b 100644
--- a/src/components/uh-maintenance-detail/uh-maintenance-detail.vue
+++ b/src/components/uh-maintenance-detail/uh-maintenance-detail.vue
@@ -20,23 +20,28 @@
emit('update:modelValue', value)
},
})
+
+ function close() {
+ emit('update:modelValue', false)
+ }
-
-
-
-
- 维护详情
-
-
-
-
-
+
+
+
+ 维护详情
+
-
+
+
+
+
+ 关闭
+
+
\ No newline at end of file
diff --git a/src/locale/index.ts b/src/locale/index.ts
index 56e0540..81278f0 100644
--- a/src/locale/index.ts
+++ b/src/locale/index.ts
@@ -9,9 +9,9 @@ const messages = {
}
const i18n = createI18n({
+ legacy: false, // 组合式 API 模式:不再注入每组件 legacy mixin,避免 mounted 阶段访问 $i18n.__composer 报错
locale: uni.getLocale(), // 获取已设置的语言,fallback 语言需要再 manifest.config.ts 中设置
messages,
- allowComposition: true,
})
console.log(uni.getLocale())