From d5bbc38ddfb40f147d1b66b1782924f81bb4c401 Mon Sep 17 00:00:00 2001 From: yuk255 Date: Wed, 15 Oct 2025 21:11:45 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E8=80=83=E8=AF=95=E3=80=81?= =?UTF-8?q?=E7=BB=83=E4=B9=A0=E6=A8=A1=E5=9D=97=E5=AF=B9=E6=8E=A5=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/profile/ActivityContent.vue | 24 +- src/components/profile/CourseContent.vue | 5 +- src/components/profile/ExamContent.vue | 472 +++++++ src/components/profile/HomeworkContent.vue | 67 +- src/components/profile/PracticeContent.vue | 269 ++-- src/views/Profile.vue | 1480 +------------------- 6 files changed, 686 insertions(+), 1631 deletions(-) create mode 100644 src/components/profile/ExamContent.vue diff --git a/src/components/profile/ActivityContent.vue b/src/components/profile/ActivityContent.vue index 22f9871..4799af6 100644 --- a/src/components/profile/ActivityContent.vue +++ b/src/components/profile/ActivityContent.vue @@ -14,7 +14,12 @@
-
+ +
@@ -70,6 +75,11 @@
+
@@ -82,6 +92,8 @@ import { ActivityListApi } from '@/api/modules/userCenter' const message = useMessage() const router = useRouter() +const loading = ref(false) + // 活动接口 interface Activity { id: string @@ -137,12 +149,15 @@ const viewActivityDetail = (id: string) => { onMounted(async () => { try { + loading.value = true const response = await ActivityListApi.getActivityList() console.log('活动列表:', response.data.result) activities.value = response.data.result.records || [] } catch (error) { message.error('请求活动列表时发生错误') console.error(error) + } finally { + loading.value = false } }) @@ -153,6 +168,13 @@ onMounted(async () => { width: 100%; } +.empty { + margin-top: 10%; + display: flex; + align-items: center; + justify-content: center; +} + /* 课程筛选标签 */ .text-wrapper_1 { width: 100%; diff --git a/src/components/profile/CourseContent.vue b/src/components/profile/CourseContent.vue index 291a1c3..3cdcd02 100644 --- a/src/components/profile/CourseContent.vue +++ b/src/components/profile/CourseContent.vue @@ -29,7 +29,7 @@
- 正在加载课程数据... +
-
- 暂无课程数据 +
diff --git a/src/components/profile/ExamContent.vue b/src/components/profile/ExamContent.vue new file mode 100644 index 0000000..8920590 --- /dev/null +++ b/src/components/profile/ExamContent.vue @@ -0,0 +1,472 @@ + + + + + diff --git a/src/components/profile/HomeworkContent.vue b/src/components/profile/HomeworkContent.vue index f3dd697..e09b732 100644 --- a/src/components/profile/HomeworkContent.vue +++ b/src/components/profile/HomeworkContent.vue @@ -91,6 +91,7 @@ v-for="item in detailAssignment.aiolHomeworkSubmits" :key="item.id" > + 已提交:
- @@ -377,7 +383,7 @@ import { ref, reactive, onMounted } from "vue"; -import { - NFormItem, - NForm, - NUpload, - useMessage, -} from "naive-ui"; +import { NFormItem, NForm, NUpload, useMessage } from "naive-ui"; import { ArrowBack } from "@vicons/ionicons5"; // @ts-ignore import QuillEditor from "@/components/common/QuillEditor.vue"; @@ -417,6 +418,8 @@ const userStore = useUserStore(); const formRef = ref(); const message = useMessage(); +const loading = ref(false); + const tabType = ref([ { label: "全部作业", value: 4 }, { label: "未完成", value: 1 }, @@ -599,7 +602,7 @@ const submitAssignment = async () => { homeworkId: currentAssignment.value?.id, studentId: userStore.user?.id, content: uploadForm.content, - status: 2, + status: 1, attachment: uploadedFiles .map((file) => { return file.url; @@ -623,23 +626,30 @@ const getList = async () => { assignments.value = []; const type = typeof activeHomeworkTab.value === "number" ? activeHomeworkTab.value : 4; - const res = await HomeworkApi.getHomeworkList({ type }); - assignments.value = res.data.result?.map((item: any) => { - return { - id: item.aiolHomework.id, - teacherName: item.realName, - teacherAvatar: item.avatar || "", - submitCount: item.submitCount || 0, - createTime: item.aiolHomework.createTime, - endTime: item.aiolHomework.endTime, - status: item.aiolHomework.status, - title: item.aiolHomework.title, - description: item.aiolHomework.description, - attachments: item.aiolHomework.attachments || [], - mainImage: item.aiolHomework.mainImage || "", - aiolHomeworkSubmits: item.aiolHomeworkSubmits || [], - }; - }); + try { + loading.value = true; + const res = await HomeworkApi.getHomeworkList({ type }); + assignments.value = res.data.result?.map((item: any) => { + return { + id: item.aiolHomework.id, + teacherName: item.realName, + teacherAvatar: item.avatar || "", + submitCount: item.submitCount || 0, + createTime: item.aiolHomework.createTime, + endTime: item.aiolHomework.endTime, + status: item.aiolHomework.status, + title: item.aiolHomework.title, + description: item.aiolHomework.description, + attachments: item.aiolHomework.attachments || [], + mainImage: item.aiolHomework.mainImage || "", + aiolHomeworkSubmits: item.aiolHomeworkSubmits || [], + }; + }); + } catch (error) { + message.error("加载作业数据失败"); + } finally { + loading.value = false; + } }; onMounted(async () => { @@ -821,6 +831,9 @@ onMounted(async () => { .empty { margin-top: 10%; + display: flex; + align-items: center; + justify-content: center; } /* 作业卡片主容器 */ diff --git a/src/components/profile/PracticeContent.vue b/src/components/profile/PracticeContent.vue index bc65aa4..45859aa 100644 --- a/src/components/profile/PracticeContent.vue +++ b/src/components/profile/PracticeContent.vue @@ -2,20 +2,31 @@
- 全部练习 - 练习中 - 已结束 +
-
-
+ +
+
{{ practice.title }}
@@ -34,139 +45,154 @@ 练习时间: {{ practice.duration }}分钟
-
+
-
+ -
+
+
+
\ No newline at end of file + diff --git a/src/views/Profile.vue b/src/views/Profile.vue index f365413..c4c899e 100644 --- a/src/views/Profile.vue +++ b/src/views/Profile.vue @@ -50,168 +50,17 @@
- - - -
- -
- 全部考试 - 未开始 - 进行中 - 已结束 -
- - -
- - -
-
- -
{{ exam.title }}
- - -
- {{ exam.score }} -
- - -
-
- 考试日期: - {{ exam.examDate }} -
-
- 考试时间: - {{ exam.duration }}分钟 -
-
- 考试题量: - {{ exam.questionCount }}题 -
-
- - -
- {{ exam.description }} -
- - - -
-
-
+ - @@ -587,7 +436,6 @@
-