|
@@ -0,0 +1,72 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="wh-full bg-white">
|
|
|
|
+ <div class="flex-col-center" style="width: 70%; margin: 0 auto; margin-top: 5%">
|
|
|
|
+ <n-calendar v-if="show" style="width: 100%" #="{ year, month, date }" @update:value="handleUpdateValue">
|
|
|
|
+ {{ year }}年{{ month }}月{{ date }}日 <br />
|
|
|
|
+ <n-tag v-if="dataList[`${year}-${doubleMonth(month)}-${date}`]" type="success">
|
|
|
|
+ 共有课时:
|
|
|
|
+ {{ dataList[`${year}-${doubleMonth(month)}-${date}`] }}
|
|
|
|
+ 节
|
|
|
|
+ </n-tag>
|
|
|
|
+ <n-tag v-else> 共有课时:0 节 </n-tag>
|
|
|
|
+ </n-calendar>
|
|
|
|
+
|
|
|
|
+ <n-modal v-model:show="showModal" preset="dialog" title="Dialog">
|
|
|
|
+ <template #header>
|
|
|
|
+ <div>当日课程详情</div>
|
|
|
|
+ </template>
|
|
|
|
+ <div style="margin-top: 2rem">
|
|
|
|
+ <n-timeline v-if="list.length > 0">
|
|
|
|
+ <n-timeline-item
|
|
|
|
+ v-for="item in list"
|
|
|
|
+ :key="item.id"
|
|
|
|
+ type="success"
|
|
|
|
+ :title="item.teacherName"
|
|
|
|
+ :content="item.category + '--' + item.subjects"
|
|
|
|
+ :time="item.startTime + ' - ' + item.endTime"
|
|
|
|
+ />
|
|
|
|
+ </n-timeline>
|
|
|
|
+ </div>
|
|
|
|
+ <template #action>
|
|
|
|
+ <n-button @click="showModal = false">关闭</n-button>
|
|
|
|
+ </template>
|
|
|
|
+ </n-modal>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+<script setup lang="ts">
|
|
|
|
+import { ref, reactive } from 'vue';
|
|
|
|
+import { querySchedule } from './api';
|
|
|
|
+const show = ref(false);
|
|
|
|
+const showModal = ref(false);
|
|
|
|
+const list = ref<any>([]);
|
|
|
|
+const allList = ref<any>({});
|
|
|
|
+const dataList = reactive<{ [index: string]: any }>({});
|
|
|
|
+function handleUpdateValue(_: number, { year, month, date }: { year: number; month: number; date: number }) {
|
|
|
|
+ if (dataList[`${year}-${doubleMonth(month)}-${date}`]) {
|
|
|
|
+ list.value = allList[`${year}-${doubleMonth(month)}-${date}`];
|
|
|
|
+ showModal.value = true;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+function doubleMonth(month: number) {
|
|
|
|
+ return month < 10 ? `0${month}` : month;
|
|
|
|
+}
|
|
|
|
+querySchedule({}).then(response => {
|
|
|
|
+ response.data?.forEach(result => {
|
|
|
|
+ if (result.createTime) {
|
|
|
|
+ const key = result.createTime.split(' ')[0].toString();
|
|
|
|
+ if (!allList[key]) {
|
|
|
|
+ allList[key] = [];
|
|
|
|
+ }
|
|
|
|
+ allList[key].push(result);
|
|
|
|
+ if (dataList[key]) {
|
|
|
|
+ dataList[key] += dataList[key];
|
|
|
|
+ } else {
|
|
|
|
+ dataList[key] = 1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ show.value = true;
|
|
|
|
+});
|
|
|
|
+</script>
|
|
|
|
+<style scoped></style>
|