update UI
Some checks failed
Deploy / deploy (push) Has been cancelled

This commit is contained in:
2025-09-24 16:20:48 +08:00
parent de6ac4bd85
commit 0a9d49b526
7 changed files with 211 additions and 119 deletions

View File

@@ -6,7 +6,7 @@
<n-select
style="width: 140px"
:options="options"
v-model:value="query.duration"
v-model:value="aiStore.duration"
/>
<n-flex>
<n-input
@@ -18,20 +18,14 @@
<n-button @click="search">查询</n-button>
</n-flex>
</n-flex>
<Details
:start="start"
:end="end"
:duration="query.duration"
:username="query.username"
/>
<Details :start="start" :end="end" />
</n-flex>
</n-gi>
<n-gi :span="3">
<WeeklyChart
:end="end"
:username="query.username"
:duration="query.duration"
/>
<n-flex vertical size="large">
<WeeklyChart :end="end" />
<AI v-if="aiStore.detailsData.solved.length" />
</n-flex>
</n-gi>
</n-grid>
</template>
@@ -41,17 +35,16 @@ import { formatISO, sub, type Duration } from "date-fns"
import { NButton } from "naive-ui"
import WeeklyChart from "./components/WeeklyChart.vue"
import Details from "./components/Details.vue"
import AI from "./components/AI.vue"
import { useUserStore } from "~/shared/store/user"
import { useAIStore } from "../store/ai"
const userStore = useUserStore()
const aiStore = useAIStore()
const start = ref("")
const end = ref("")
const username = ref("")
const query = reactive({
username: "",
duration: "months:6",
})
const options: SelectOption[] = [
{ label: "一节课内", value: "hours:1" },
@@ -65,7 +58,7 @@ const options: SelectOption[] = [
]
const subOptions = computed<Duration>(() => {
let dur = options.find((it) => it.value === query.duration) ?? options[0]
let dur = options.find((it) => it.value === aiStore.duration) ?? options[0]
const x = dur.value!.toString().split(":")
const unit = x[0]
const n = x[1]
@@ -79,8 +72,8 @@ function updateRange() {
}
function search() {
query.username = username.value
aiStore.username = username.value
}
watch(() => query.duration, updateRange, { immediate: true })
watch(() => aiStore.duration, updateRange, { immediate: true })
</script>