杂务:新增声明级注释覆盖率

This commit is contained in:
xiaowang
2026-05-23 18:44:57 +08:00
parent 8f038894e7
commit 844516988b
234 changed files with 8356 additions and 0 deletions
+76
View File
@@ -168,13 +168,29 @@
import { computed, onMounted, onUnmounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { message } from 'ant-design-vue'
/**
* Purpose: AnnouncementVO supports HomeView.vue by holding or executing the announcement vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { userApi, type AnnouncementVO, type UserVO } from '../api/user'
/**
* Purpose: ProductVO supports HomeView.vue by holding or executing the product vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { productApi, type ProductVO } from '../api/product'
/**
* Purpose: ShopVO supports HomeView.vue by holding or executing the shop vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { shopApi, type ShopVO } from '../api/shop'
import { fileApi } from '../api/file'
import { DEFAULT_AVATAR, DEFAULT_PRODUCT_IMAGE } from '@/constants'
import type { IdType } from '@/utils/id'
/**
* Purpose: BannerImage supports HomeView.vue by holding or executing the banner image page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
interface BannerImage {
id: string
shopId: IdType
@@ -183,6 +199,10 @@ interface BannerImage {
url: string
}
/**
* Purpose: ProductCardItem supports HomeView.vue by holding or executing the product card item page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
interface ProductCardItem {
id: IdType
name: string
@@ -193,17 +213,61 @@ interface ProductCardItem {
bgColor: string
}
/**
* Purpose: router supports HomeView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/**
* Purpose: userInfo supports HomeView.vue by holding or executing the user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userInfo = ref<UserVO | null>(null)
/**
* Purpose: publicShops supports HomeView.vue by holding or executing the public shops page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const publicShops = ref<ShopVO[]>([])
/**
* Purpose: bannerImages supports HomeView.vue by holding or executing the banner images page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const bannerImages = ref<BannerImage[]>([])
/**
* Purpose: featuredItems supports HomeView.vue by holding or executing the featured items page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const featuredItems = ref<ProductCardItem[]>([])
/**
* Purpose: popularSource supports HomeView.vue by holding or executing the popular source page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const popularSource = ref<ProductCardItem[]>([])
/**
* Purpose: popularItems supports HomeView.vue by holding or executing the popular items page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const popularItems = ref<ProductCardItem[]>([])
/**
* Purpose: announcements supports HomeView.vue by holding or executing the announcements page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const announcements = ref<AnnouncementVO[]>([])
/**
* Purpose: selectedAnnouncement supports HomeView.vue by holding or executing the selected announcement page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedAnnouncement = ref<AnnouncementVO | null>(null)
/**
* Purpose: announcementDetailOpen supports HomeView.vue by holding or executing the announcement detail open page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const announcementDetailOpen = ref(false)
/**
* Purpose: productImageCache supports HomeView.vue by holding or executing the product image cache page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const productImageCache = ref<Record<string, string>>({})
/** searchQuery is a reactive state variable used by the template and event handlers. */
const searchQuery = ref('')
@@ -213,6 +277,10 @@ const loading = ref(false)
const hasMore = ref(true)
/** page is a reactive state variable used by the template and event handlers. */
const page = ref(1)
/**
* Purpose: pageSize supports HomeView.vue by holding or executing the page size page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pageSize = 8
/** isLoggedIn is a reactive state variable used by the template and event handlers. */
@@ -224,11 +292,19 @@ const displayName = computed(() => userInfo.value?.nickname || (isLoggedIn.value
/** announcementLoop is a reactive state variable used by the template and event handlers. */
const announcementLoop = computed(() => [...announcements.value, ...announcements.value].map((item, index) => ({ ...item, loopKey: index })))
/**
* Purpose: openAnnouncementDetail supports HomeView.vue by holding or executing the open announcement detail page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openAnnouncementDetail = (item: AnnouncementVO) => {
selectedAnnouncement.value = item
announcementDetailOpen.value = true
}
/**
* Purpose: formatAnnouncementTime supports HomeView.vue by holding or executing the format announcement time page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formatAnnouncementTime = (value?: string) => {
if (!value) return ''
return value.replace('T', ' ').slice(0, 16)