diff --git a/env/.env.development b/env/.env.development index 32b178a..c09bd8b 100644 --- a/env/.env.development +++ b/env/.env.development @@ -7,4 +7,5 @@ VITE_SHOW_SOURCEMAP=false # development mode 后台请求地址 # VITE_UNI_HALO_BASEURL='https://www.yijunzhao.cn' -VITE_UNI_HALO_BASEURL='https://www.xhhao.com' +# VITE_UNI_HALO_BASEURL='https://www.xhhao.com' +VITE_UNI_HALO_BASEURL='https://ryanc.cc' diff --git a/src/api/halo-plugin/photo.ts b/src/api/halo-plugin/photo.ts index 116d5a1..b07d605 100644 --- a/src/api/halo-plugin/photo.ts +++ b/src/api/halo-plugin/photo.ts @@ -18,6 +18,27 @@ export interface IQueryPhotosRequest { size?: number } +export interface IPhotoGroup { + metadata: { + creationTimestamp: string + generateName: string + name: string + version: string + } + spec: { + displayName: string + priority: number + } + status: { + photoCount: number + } +} + +export interface IPhotoTag { + name: string + photoCount: number +} + export interface IPhoto { metadata: { creationTimestamp: string @@ -36,12 +57,10 @@ export interface IPhoto { /** * 获取图库分组列表 - * @param params 获取图库分组列表请求参数 * @returns 获取图库分组列表响应参数 */ -export function queryPhotoGroups(params: IQueryPhotoGroupsRequest) { - return http.Get(`/apis/api.photo.halo.run/v1alpha1/photogroups`, { - params, +export function queryPhotoGroups() { + return http.Get>(`/apis/api.photo.halo.run/v1alpha1/photogroups`, { meta: { isHalo: true, }, @@ -51,10 +70,11 @@ export function queryPhotoGroups(params: IQueryPhotoGroupsRequest) { /** * 获取图库标签列表 列出所有不重复的标签名称及对应图片数量,支持可选的 name 参数进行大小写不敏感模糊过滤 * @param params 获取图库标签列表请求参数 + * @param params.name 标签名称 * @returns 获取图库标签列表响应参数 */ -export function queryPhotoTags(params: any) { - return http.Get(`/apis/api.photo.halo.run/v1alpha1/tags`, { +export function queryPhotoTags(params: { name?: string }) { + return http.Get>(`/apis/api.photo.halo.run/v1alpha1/tags`, { params, meta: { isHalo: true, @@ -70,6 +90,7 @@ export function queryPhotoTags(params: any) { export function queryPhotos(params: IQueryPhotosRequest) { return http.Get>(`/apis/api.photo.halo.run/v1alpha1/photos`, { params, + cacheFor: null, meta: { isHalo: true, }, diff --git a/src/components/uh-gallery-panel/uh-gallery-panel.vue b/src/components/uh-gallery-panel/uh-gallery-panel.vue index d3c2f37..9fcbf22 100644 --- a/src/components/uh-gallery-panel/uh-gallery-panel.vue +++ b/src/components/uh-gallery-panel/uh-gallery-panel.vue @@ -3,10 +3,12 @@ import { queryPhotos } from '@/api/halo-plugin/photo' import { completeUrl } from '@/utils/url' import { useHaloScroll } from '@/hooks/useHaloScroll' import { random } from '@/utils/base/random' +import { preview } from '@/utils/imageHelper' import type { IPhoto, IQueryPhotosRequest } from '@/api/halo-plugin/photo' interface IProps { - groupName: string + groupMetadataName: string + groupDisplayName: string } const props = defineProps() @@ -16,6 +18,7 @@ const emits = defineEmits<{ }>() const { + response, // 响应式的原始数据响应 list, // 响应式的数据列表 loading, // 是否加载中 finished, // 是否已全部加载 @@ -27,6 +30,7 @@ const { params: { page: 1, size: 12, + group: props.groupMetadataName.trim() ?? undefined, }, }) @@ -36,61 +40,62 @@ function getImageItemClass() { const randomIndex = random(0, imageItemClass.length - 1) return imageItemClass[randomIndex] } + +function handlePreview(item: IPhoto) { + preview(completeUrl(item.spec.url), list.value.map(item => completeUrl(item.spec.url))) +}