接入搜索引擎; 修改控制台配置

This commit is contained in:
2026-07-26 06:54:23 +08:00
parent 0e4184057a
commit 1a8e81bb5b
12 changed files with 229 additions and 16 deletions
+15 -7
View File
@@ -4,7 +4,7 @@ import { ref, computed, nextTick, watch} from "vue";
import cloneDeep from "lodash.clonedeep";
import {doubanCoreApiClient} from "@/api";
import type { DoubanMovie } from "@/api/generated";
import {toDatetimeLocal, toISOString} from "@/utils/date";
import {toDateInput, toISOString} from "@/utils/date";
const props = withDefaults(
defineProps<{
@@ -55,6 +55,8 @@ const saving = ref<boolean>(false);
const formVisible = ref(false);
const createTime = ref<string | undefined>(undefined);
const getToday = () => toDateInput(new Date());
const isUpdateMode = computed(() => {
return !!formState.value.metadata.creationTimestamp;
@@ -73,6 +75,9 @@ const onVisibleChange = (visible: boolean) => {
const handleResetForm = () => {
formState.value = cloneDeep(initialFormState);
const today = getToday();
createTime.value = today;
formState.value.faves.createTime = toISOString(today);
};
watch(
@@ -94,9 +99,9 @@ watch(
(doubanMovie) => {
if (doubanMovie) {
formState.value = cloneDeep(doubanMovie);
createTime.value = toDatetimeLocal(formState.value.faves.createTime);
createTime.value = toDateInput(formState.value.faves.createTime) || getToday();
}else {
createTime.value = undefined;
createTime.value = getToday();
}
},
{
@@ -108,6 +113,9 @@ watch(
() => createTime.value,
(value) => {
formState.value.faves.createTime = value ? toISOString(value) : undefined;
},
{
immediate: true,
}
);
const annotationsFormRef = ref();
@@ -223,6 +231,7 @@ const handleSaveFriend = async () => {
name="type"
label="类型"
placeholder="输入类型 value,例如 movie"
validation="required"
></FormKit>
<FormKit
v-if="formState.spec.dataType=='halo'"
@@ -231,12 +240,10 @@ const handleSaveFriend = async () => {
name="cardSubtitle"
label="描述"
:rows="4"
validation="required|length:0,300"
validation="required|length:0,1000"
></FormKit>
<FormKit
type="datetime-local"
min="0000-01-01T00:00"
max="9999-12-31T23:59"
type="date"
v-model="createTime"
name="createTime"
validation="required"
@@ -252,6 +259,7 @@ const handleSaveFriend = async () => {
v-model="formState.faves.status"
name="status"
type="select"
validation="required"
></FormKit>
<FormKit
type="textarea"
+7 -1
View File
@@ -47,10 +47,16 @@ export function toDatetimeLocal(date: string | Date | undefined | null): string
return dayjs(date).format("YYYY-MM-DDTHH:mm");
}
export function toDateInput(date: string | Date | undefined | null): string {
if (!date) {
return "";
}
return dayjs(date).format("YYYY-MM-DD");
}
export function toISOString(date: string | Date | undefined | null): string {
if (!date) {
return "";
}
return dayjs(date).utc(false).toISOString();
}