diff --git a/components/admin/sentence/SearchModal.vue b/components/admin/sentence/SearchModal.vue index 1c00e30..d888519 100644 --- a/components/admin/sentence/SearchModal.vue +++ b/components/admin/sentence/SearchModal.vue @@ -3,7 +3,7 @@ import dayjs, { Dayjs } from 'dayjs' import { HitokotoType } from '~/enums/hitokoto' export interface State { - uuid?: string + uuids?: string[] keywords?: string type?: HitokotoType from?: string @@ -42,6 +42,16 @@ const dateRange = reactive({ } }) }) +const uuid = computed({ + get() { + return formState.value.uuids?.join('\n') + }, + set(val) { + formState.value.uuids = val + ? val.split('\n').map((v) => v.replace(/\n|\t|\r/g, '').trim()) + : undefined + } +}) const resetFormState = () => { formState.value = {} @@ -49,7 +59,8 @@ const resetFormState = () => { const sentenceTypeOptions = Object.keys(HitokotoType).reduce( (acc, key) => { - return [...acc, { label: convertHitokotoType(key), value: key }] + const type = HitokotoType[key as keyof typeof HitokotoType] + return [...acc, { label: convertHitokotoType(type), value: type }] }, [] as Array<{ label: string; value: string }> ) @@ -64,6 +75,7 @@ watch( } ) const handleOk = async () => { + console.log(formState.value) emit('update:open', false) emit('ok', formState.value) } @@ -86,8 +98,8 @@ const handleCancel = () => { 确认 - - + + @@ -111,19 +123,19 @@ const handleCancel = () => { placeholder="提交者(UID 或者名字)" /> - -
- - -
+ + + + +
diff --git a/composables/api/reviewer/hitokoto.ts b/composables/api/reviewer/hitokoto.ts index ade1122..f73ec0a 100644 --- a/composables/api/reviewer/hitokoto.ts +++ b/composables/api/reviewer/hitokoto.ts @@ -40,7 +40,7 @@ export type HitokotoAdminListReq = { from_who?: string creator?: string keywords?: string - uuid?: string + uuids?: string[] } export function useAdminHitokotoList( diff --git a/composables/api/reviewer/useHTTP.ts b/composables/api/reviewer/useHTTP.ts index 05856c0..5397233 100644 --- a/composables/api/reviewer/useHTTP.ts +++ b/composables/api/reviewer/useHTTP.ts @@ -4,6 +4,7 @@ import type { Ref } from 'vue' import type { UseFetchOptions } from '#app' import { useUserStore } from '~/stores/user' import IconEmoticonDead from '~icons/mdi/emoticon-dead' +import { cloneDeep } from 'lodash-es' export interface R { code: number @@ -55,7 +56,7 @@ const handleError = ( // get方法传递数组形式参数 const paramsSerializer = (params?: SearchParameters) => { if (!params) return - const query = structuredClone({ ...params }) + const query = cloneDeep({ ...params }) Object.entries(query).forEach(([key, val]) => { if (typeof val === 'object' && Array.isArray(val) && val !== null) { query[`${key}[]`] = toRaw(val).map((v: unknown) => JSON.stringify(v)) diff --git a/pages/admin/sentences.vue b/pages/admin/sentences.vue index 4079f51..6abe391 100644 --- a/pages/admin/sentences.vue +++ b/pages/admin/sentences.vue @@ -90,6 +90,13 @@ const { } = await useAdminHitokotoList(requestParams) const cardData = computed(() => hitokotoListRes.value?.data.collection ?? []) +watch( + () => error.value, + async () => { + console.log(error.value) + } +) + // segments const statusFilterOptions = [ {