rebuild(audit): complete entity detail and market preview

This commit is contained in:
leefer
2026-07-30 09:25:52 +08:00
parent d1b3b977d2
commit 4fc8691eee
27 changed files with 946 additions and 35 deletions
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { computed, ref, watch } from "vue";
import { useRoute } from "vue-router";
import { heavenApi, type HeavenReading, type HeavenSetup, type ReadingMode } from "../../shared/api/heaven";
import { useMarketStore } from "../../shared/stores/market";
@@ -11,9 +12,10 @@ import InterpretDialog from "./InterpretDialog.vue";
import TrendPanel from "./TrendPanel.vue";
const market = useMarketStore();
const route = useRoute();
const session = useSessionStore();
const ui = useUiStore();
const mode = ref<ReadingMode>("trend");
const mode = ref<ReadingMode>(["trend", "fortune", "heart"].includes(String(route.query.mode)) ? String(route.query.mode) as ReadingMode : "trend");
const setup = ref<HeavenSetup | null>(null);
const loading = ref(false);
const error = ref("");
@@ -75,7 +77,7 @@ watch([() => market.selectedDate, locked], load, { immediate: true });
<div v-if="loading" class="card workspace-state">正在推演当日基础气机</div>
<div v-else-if="error" class="notice notice-warning">{{ error }}</div>
<div v-else :class="{ 'locked-content': locked }" :aria-disabled="locked">
<TrendPanel v-if="mode === 'trend'" :disabled="locked" @interpret="openInterpret" />
<TrendPanel v-if="mode === 'trend'" :disabled="locked" :initial-query="String(route.query.query || '')" @interpret="openInterpret" />
<FortunePanel v-else-if="mode === 'fortune'" :field="setup?.fortune || null" :daily="setup?.daily_fortune || null" :disabled="locked" @interpret="openInterpret" @saved="saveFortune" />
<HeartPanel v-else :disabled="locked" @interpret="openInterpret" />
</div>
@@ -1,12 +1,12 @@
<script setup lang="ts">
import { computed, ref } from "vue";
import { computed, onMounted, ref } from "vue";
import { heavenApi, type HeavenReading } from "../../shared/api/heaven";
import { useMarketStore } from "../../shared/stores/market";
import { useUiStore } from "../../shared/stores/ui";
import HexagramGraphic from "./HexagramGraphic.vue";
const props = defineProps<{ disabled: boolean }>();
const props = defineProps<{ disabled: boolean; initialQuery?: string }>();
const emit = defineEmits<{ interpret: [reading: HeavenReading] }>();
const market = useMarketStore();
const ui = useUiStore();
@@ -49,6 +49,13 @@ function reading(): HeavenReading {
created_at: "",
};
}
onMounted(() => {
const initial = props.initialQuery?.trim();
if (!initial || props.disabled) return;
query.value = initial;
void load(false);
});
</script>
<template>