diff --git a/src/components/uh-home-category/uh-home-category.vue b/src/components/uh-home-category/uh-home-category.vue
index ec8ca42..c08ab49 100644
--- a/src/components/uh-home-category/uh-home-category.vue
+++ b/src/components/uh-home-category/uh-home-category.vue
@@ -75,7 +75,7 @@
-
+
精选分类
diff --git a/src/components/uh-vote-card/uh-vote-card.vue b/src/components/uh-vote-card/uh-vote-card.vue
index 06c7cc9..6a123ff 100644
--- a/src/components/uh-vote-card/uh-vote-card.vue
+++ b/src/components/uh-vote-card/uh-vote-card.vue
@@ -1,95 +1,91 @@
-
-
-
-
-
- {{ vote.spec._uh_type }}
-
-
- {{ vote.spec._uh_state.state }}
-
-
- 已投票
-
-
-
-
+
+
+
+
+
+ {{ vote.spec._uh_type }}
+
+
+ {{ vote.spec._uh_state.state }}
+
+
+ 已投票
+
+
+
+
-
-
- {{ vote.spec?.title }}
-
-
- {{ vote.spec.remark }}
-
+
+
+ {{ vote.spec?.title }}
+
+
+ {{ vote.spec.remark }}
+
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/src/hooks/useCustomNavbarPlaceholder.ts b/src/hooks/useCustomNavbarPlaceholder.ts
new file mode 100644
index 0000000..89a716f
--- /dev/null
+++ b/src/hooks/useCustomNavbarPlaceholder.ts
@@ -0,0 +1,24 @@
+import { ref } from 'vue';
+
+/**
+ * 自定义导航顶部位置
+ */
+export function useCustomNavbarPlaceholder(customNavbarHeight?: number) {
+ const height = ref(0);
+
+ function init() {
+ const winInfo = uni.getWindowInfo();
+ const safeAreaTop = winInfo.safeArea.top;
+
+ height.value += safeAreaTop + 10;
+ // #ifndef H5
+ height.value += customNavbarHeight ?? 46;
+ // #endif
+
+ console.log('最终高度', height.value);
+ }
+
+ onMounted(init);
+
+ return { height };
+}
diff --git a/src/hooks/useDataLoading.ts b/src/hooks/useDataLoading.ts
index d2ce703..13a8f71 100644
--- a/src/hooks/useDataLoading.ts
+++ b/src/hooks/useDataLoading.ts
@@ -1,22 +1,20 @@
-import type { Ref } from 'vue'
-import { ref } from 'vue'
-
-/** 数据加载四态(取值与 DataLoadingStatusEnum 一致,二者可互相兼容) */
-export type DataLoadingStatus = 'loading' | 'error' | 'empty' | 'success' | 'noNetwork'
+import { ref } from 'vue';
+import type { Ref } from 'vue';
+import type { DataLoadingStatus } from './useDataLoadingStatus';
export interface IUseDataLoadingOptions {
- /** 自定义判空;默认:数组看长度、对象看键数、空值视为空 */
- isEmpty?: (data: T) => boolean
- /** 成功回调(数据就绪) */
- onSuccess?: (data: T) => void
- /** 失败回调(run 已捕获异常,不会向外抛出) */
- onError?: (err: unknown) => void
+ /** 自定义判空;默认:数组看长度、对象看键数、空值视为空 */
+ isEmpty?: (data: T) => boolean;
+ /** 成功回调(数据就绪) */
+ onSuccess?: (data: T) => void;
+ /** 失败回调(run 已捕获异常,不会向外抛出) */
+ onError?: (err: unknown) => void;
}
export interface IUseDataLoadingReturn {
- data: Ref
- status: Ref
- run: (...args: P) => Promise
+ data: Ref;
+ status: Ref;
+ run: (...args: P) => Promise;
}
/**
@@ -29,41 +27,34 @@ export interface IUseDataLoadingReturn {
* onLoad(() => run())
* onPullDownRefresh(async () => { await run(); uni.stopPullDownRefresh() })
*/
-export function useDataLoading(
- fetcher: (...args: P) => Promise,
- options: IUseDataLoadingOptions = {},
-): IUseDataLoadingReturn {
- const { isEmpty, onSuccess, onError } = options
+export function useDataLoading(fetcher: (...args: P) => Promise, options: IUseDataLoadingOptions = {}): IUseDataLoadingReturn {
+ const { isEmpty, onSuccess, onError } = options;
- const data = ref(undefined) as Ref
- const status = ref('loading')
+ const data = ref(undefined) as Ref;
+ const status = ref('loading');
- function calcEmpty(value: T): boolean {
- if (isEmpty)
- return isEmpty(value)
- if (Array.isArray(value))
- return value.length === 0
- if (value !== null && typeof value === 'object')
- return Object.keys(value).length === 0
- return value === undefined || value === null || value === ''
- }
+ function calcEmpty(value: T): boolean {
+ if (isEmpty) return isEmpty(value);
+ if (Array.isArray(value)) return value.length === 0;
+ if (value !== null && typeof value === 'object') return Object.keys(value).length === 0;
+ return value === undefined || value === null || value === '';
+ }
- async function run(...args: P): Promise {
- status.value = 'loading'
- try {
- const res = await fetcher(...args)
- data.value = res
- status.value = calcEmpty(res) ? 'empty' : 'success'
- onSuccess?.(res)
- return res
- }
- catch (err) {
- console.error('[useDataLoading] 请求失败', err)
- status.value = 'error'
- onError?.(err)
- return undefined
- }
- }
+ async function run(...args: P): Promise {
+ status.value = 'loading';
+ try {
+ const res = await fetcher(...args);
+ data.value = res;
+ status.value = calcEmpty(res) ? 'empty' : 'success';
+ onSuccess?.(res);
+ return res;
+ } catch (err) {
+ console.error('[useDataLoading] 请求失败', err);
+ status.value = 'error';
+ onError?.(err);
+ return undefined;
+ }
+ }
- return { data, status, run }
+ return { data, status, run };
}
diff --git a/src/pages-blog/about/about.vue b/src/pages-blog/about/about.vue
index 3bbdd08..a55cb58 100644
--- a/src/pages-blog/about/about.vue
+++ b/src/pages-blog/about/about.vue
@@ -11,8 +11,8 @@
},
})
-const { scrollY, updatePageScrollValue } = usePageScroll()
-const appConfigStore = useAppConfigStore()
+ const { scrollY, updatePageScrollValue } = usePageScroll()
+ const appConfigStore = useAppConfigStore()
const appInfo = computed(() => {
return {
@@ -53,8 +53,8 @@ const appConfigStore = useAppConfigStore()
-
-
+
+
@@ -79,12 +79,12 @@ const appConfigStore = useAppConfigStore()
{{ link.tileLetter }}
- {{ link.title }}
+ {{ link.title }}
{{ link.value }}
@@ -95,4 +95,11 @@ const appConfigStore = useAppConfigStore()
-
\ No newline at end of file
+
+
+
+
\ No newline at end of file
diff --git a/src/pages-blog/contact/contact.vue b/src/pages-blog/contact/contact.vue
index c998f4b..43e5e72 100644
--- a/src/pages-blog/contact/contact.vue
+++ b/src/pages-blog/contact/contact.vue
@@ -1,184 +1,179 @@
-
-
-
+
+
+
-
-
+
+
-
-
-
- TO · 收
-
-
- 素未谋面的朋友
-
-
- 展信安,见字如面。
-
-
- 自 · {{ bloggerInfo.nickname }}
-
-
-
-
- {{ bloggerInfo.nickname }}
-
-
+
+
+
+ TO · 收
+
+
+ 素未谋面的朋友
+
+
+ 展信安,见字如面。
+
+
+ 自 · {{ bloggerInfo.nickname }}
+
+
+
+
+ {{ bloggerInfo.nickname }}
+
+
-
-
-
-
-
- 展信安:
-
-
-
-
-
- 祝你早安,午安,晚安。每天都有好心情,生活愉快!
-
-
- {{ bloggerInfo.nickname }}
- {{ nowText }}
-
-
+
+
+
+
+
+ 展信安:
+
+
+
+
+
+ 祝你早安,午安,晚安。每天都有好心情,生活愉快!
+
+
+ {{ bloggerInfo.nickname }}
+ {{ nowText }}
+
+
-
-
- 若有意,可依此觅:
-
-
-
-
- {{ item.name ? item.name.charAt(0) : '' }}
-
-
-
- {{ item.name }}
-
- {{ item.content }}
-
-
-
-
-
-
-
-
+
+
+ 若有意,可依此觅:
+
+
+
+
+ {{ item.name ? item.name.charAt(0) : '' }}
+
+
+
+ {{ item.name }}
+
+ {{ item.content }}
+
+
+
+
+
+
+
+
+ .uh-rotate-3 {
+ transform: rotate(3deg);
+ }
+
+ .uh-blur-xl {
+ filter: blur(20rpx);
+ }
+
\ No newline at end of file
diff --git a/src/pages-blog/setting/setting.vue b/src/pages-blog/setting/setting.vue
index 1e4a21a..6e608d3 100644
--- a/src/pages-blog/setting/setting.vue
+++ b/src/pages-blog/setting/setting.vue
@@ -127,9 +127,9 @@
-
-
+
{{ tab.label }}
@@ -139,24 +139,24 @@
{{ group.label }}
-
+
- {{ row.label }}
+ {{ row.label }}
- 跟随站点默认
+ 跟随站点默认
+ class="rounded-full bg-secondary px-2 py-0.5 text-xs text-[#4d7c0f] leading-none">
已自定义
-
- {{ row.displayValue }}
-
+
+ {{ row.displayValue }}
+
@@ -172,15 +172,15 @@
一些常用的功能性设置
-
+
- {{ row.label }}
+ {{ row.label }}
- 默认
+ 默认
已自定义
@@ -225,9 +225,9 @@
-
- {{ row.displayValue }}
-
+
+ {{ row.displayValue }}
+
@@ -236,7 +236,7 @@
-
+
恢复默认
@@ -275,7 +275,8 @@
.wd-picker-view__mask {
background: transparent !important;
}
- .wd-picker-view__roller{
+
+ .wd-picker-view__roller {
border-radius: 16rpx !important;
}
}
diff --git a/src/pages-blog/votes/votes.vue b/src/pages-blog/votes/votes.vue
index 5d0df8f..5d6d0b2 100644
--- a/src/pages-blog/votes/votes.vue
+++ b/src/pages-blog/votes/votes.vue
@@ -357,7 +357,7 @@
{{ opt.label }}
diff --git a/src/pages/tabbar/gallery/gallery.vue b/src/pages/tabbar/gallery/gallery.vue
index 4f7722f..1d3843d 100644
--- a/src/pages/tabbar/gallery/gallery.vue
+++ b/src/pages/tabbar/gallery/gallery.vue
@@ -8,8 +8,8 @@
import { usePageScroll } from '@/hooks/usePageScroll'
import { sleep } from '@/utils/common'
import { t } from '@/locale'
- import { isWechat } from '@/utils/platform'
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
+ import { useCustomNavbarPlaceholder } from '@/hooks/useCustomNavbarPlaceholder'
import type { IPhoto, IPhotoGroup } from '@/api/types/halo'
definePage({
@@ -20,6 +20,7 @@
},
})
+ const { height: offsetTop } = useCustomNavbarPlaceholder()
const { scrollY, updatePageScrollValue } = usePageScroll()
const appConfigStore = useAppConfigStore()
const haloConfigs = computed(() => appConfigStore.configs)
@@ -221,11 +222,11 @@
:checking="checking" @on-refresh="checkPluginAvailable" />
-
-
+
+
{{ cate.spec.displayName }}
diff --git a/src/utils/favorite.ts b/src/utils/favorite.ts
index b4abe67..95a73cc 100644
--- a/src/utils/favorite.ts
+++ b/src/utils/favorite.ts
@@ -38,9 +38,11 @@ const POST_EXCERPT_MAX = 120
/** 瞬间正文截断字数 */
const MOMENT_EXCERPT_MAX = 200
-/** 取文章摘要文本(excerpt 优先,兜底从正文抽取) */
+/** 取文章摘要文本(excerpt 优先,兜底从正文抽取;候选字段可能被接口返回非字符串,逐个过滤) */
function getPostExcerptText(post: IPost): string {
- return extractPlainExcerpt(post.spec.excerpt || post.content?.content || post.content?.raw, POST_EXCERPT_MAX)
+ const candidates = [post.spec.excerpt, post.content?.content, post.content?.raw]
+ const source = candidates.find((item): item is string => typeof item === 'string' && item.trim() !== '')
+ return extractPlainExcerpt(source, POST_EXCERPT_MAX)
}
/** 文章 → 收藏快照 */
diff --git a/src/utils/text.ts b/src/utils/text.ts
index 0a03322..85394b5 100644
--- a/src/utils/text.ts
+++ b/src/utils/text.ts
@@ -21,7 +21,7 @@ const MD_PREFIX_REG = /^\s{0,3}(#{1,6}[ \t]|>|[+*-][ \t]|\d+[.、)][ \t]|```|~~~
* @param source 原文(可为空)
*/
export function htmlToPlainText(source?: string): string {
- if (!source)
+ if (typeof source !== 'string' || !source)
return ''
let text = source
// 剥离脚本/样式块