功能(任务与复习): 增加材料地址与复习总览表格

This commit is contained in:
2026-04-12 10:37:26 +08:00
parent 0f2f0460df
commit 82c06d29fe
2 changed files with 61 additions and 3 deletions
+52 -2
View File
@@ -1,11 +1,61 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from "vue";
import request from "@/utils/request";
interface ReviewTask {
taskNum: string;
taskName: string;
reportCount: number | string;
fragmentCount: number | string;
effectiveTime: number | string;
}
const loading = ref(false);
const tasks = ref<ReviewTask[]>([]);
const loadTasks = async () => {
loading.value = true;
try {
const res = await request.get("/tasks", { pageSize: 100, pageNum: 1 });
tasks.value = (res?.data?.records || []).map((item: any) => ({
taskNum: item.taskNum,
taskName: item.taskName,
reportCount: item.reportCount ?? "-",
fragmentCount: item.fragmentCount ?? "-",
effectiveTime: item.effectiveTime ?? "-",
}));
} finally {
loading.value = false;
}
};
onMounted(() => {
loadTasks();
});
</script> </script>
<template> <template>
复习页面 <el-card>
<template #header>
<div class="header">
<span>复习任务总览</span>
<el-button type="primary" plain @click="loadTasks">刷新</el-button>
</div>
</template>
<el-table v-loading="loading" :data="tasks" stripe>
<el-table-column prop="taskName" label="任务名" min-width="180" />
<el-table-column prop="effectiveTime" label="累计有效学习时长" min-width="140" />
<el-table-column prop="reportCount" label="学习报告数" min-width="120" />
<el-table-column prop="fragmentCount" label="学习残片数" min-width="120" />
</el-table>
</el-card>
</template> </template>
<style scoped> <style scoped>
.header {
display: flex;
align-items: center;
justify-content: space-between;
}
</style> </style>
+8
View File
@@ -13,6 +13,7 @@ const buttonName = route.meta.buttonText;
const taskName = ref(''); const taskName = ref('');
const taskDescription = ref(''); const taskDescription = ref('');
const materialURL = ref('');
const priority = ref({ const priority = ref({
urgency: 0, urgency: 0,
importance: 0, importance: 0,
@@ -33,6 +34,7 @@ const createTask = () => {
request.post("/tasks", { request.post("/tasks", {
taskName: taskName.value, taskName: taskName.value,
taskDescription: taskDescription.value, taskDescription: taskDescription.value,
materialURL: materialURL.value,
...priority.value ...priority.value
}).then(result => { }).then(result => {
if (result.code == 200) { if (result.code == 200) {
@@ -52,6 +54,7 @@ const loadTask = () => {
const data = result.data; const data = result.data;
taskName.value = data.taskName; taskName.value = data.taskName;
taskDescription.value = data.taskDescription; taskDescription.value = data.taskDescription;
materialURL.value = data.materialURL || data.materialUrl || "";
priority.value = { priority.value = {
urgency: data.urgency, urgency: data.urgency,
importance: data.importance, importance: data.importance,
@@ -77,6 +80,7 @@ const updateTask = () => {
id: taskId, id: taskId,
taskName: taskName.value, taskName: taskName.value,
taskDescription: taskDescription.value, taskDescription: taskDescription.value,
materialURL: materialURL.value,
...priority.value ...priority.value
}).then(result => { }).then(result => {
if (result.code == 200) { if (result.code == 200) {
@@ -142,6 +146,10 @@ const columnSpan = computed(() => {
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="材料地址:">
<el-input v-model="materialURL" placeholder="请输入学习材料URL"></el-input>
</el-form-item>
<el-form-item label="优先级:"> <el-form-item label="优先级:">
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="columnSpan"> <el-col :span="columnSpan">