From a57ed52643ebb16c0e94eca020837bb7225797ed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=A0=E5=93=B2=E9=93=9C?=
<9490856+zhangzhetong@user.noreply.gitee.com>
Date: Mon, 17 Nov 2025 22:54:07 +0800
Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=B8=80=E7=82=B9=E4=BC=98?=
=?UTF-8?q?=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
project.config.json | 25 +++++++++++++++
project.private.config.json | 14 +++++++++
.../class-analysis/AverageScoreChart.vue | 11 +------
src/components/marking/TaskCard.vue | 8 ++---
src/pages/index/index.vue | 31 ++++++++++---------
src/pages/mine/index.vue | 31 ++++++-------------
src/store/home.ts | 21 ++++++-------
7 files changed, 79 insertions(+), 62 deletions(-)
create mode 100644 project.config.json
create mode 100644 project.private.config.json
diff --git a/project.config.json b/project.config.json
new file mode 100644
index 0000000..f43d7bd
--- /dev/null
+++ b/project.config.json
@@ -0,0 +1,25 @@
+{
+ "setting": {
+ "es6": true,
+ "postcss": true,
+ "minified": true,
+ "uglifyFileName": false,
+ "enhance": true,
+ "packNpmRelationList": [],
+ "babelSetting": {
+ "ignore": [],
+ "disablePlugins": [],
+ "outputPath": ""
+ },
+ "useCompilerPlugins": false,
+ "minifyWXML": true
+ },
+ "compileType": "miniprogram",
+ "simulatorPluginLibVersion": {},
+ "packOptions": {
+ "ignore": [],
+ "include": []
+ },
+ "appid": "wxc5e2d4198a20dfdf",
+ "editorSetting": {}
+}
\ No newline at end of file
diff --git a/project.private.config.json b/project.private.config.json
new file mode 100644
index 0000000..9ce701f
--- /dev/null
+++ b/project.private.config.json
@@ -0,0 +1,14 @@
+{
+ "libVersion": "3.11.2",
+ "projectname": "xlx_teacher_app",
+ "setting": {
+ "urlCheck": true,
+ "coverView": true,
+ "lazyloadPlaceholderEnable": false,
+ "skylineRenderEnable": false,
+ "preloadBackgroundData": false,
+ "autoAudits": false,
+ "showShadowRootInWxmlPanel": true,
+ "compileHotReLoad": true
+ }
+}
\ No newline at end of file
diff --git a/src/components/class-analysis/AverageScoreChart.vue b/src/components/class-analysis/AverageScoreChart.vue
index 98ea4ae..160ec8d 100644
--- a/src/components/class-analysis/AverageScoreChart.vue
+++ b/src/components/class-analysis/AverageScoreChart.vue
@@ -62,13 +62,6 @@ const compareClassName = computed(() => {
return cls?.label || '选择对比班级'
})
-// 获取对比班级的 grade_key
-const compareClassGradeKey = computed(() => {
- if (!compareClassId.value)
- return null
- return homeStore.classGradeMap.get(compareClassId.value) || null
-})
-
// 使用 TanStack Query 获取走势数据(包含本班和对比班级)
const {
data: trendData,
@@ -81,7 +74,6 @@ const {
homeStore.selectedClassId,
homeStore.selectedGradeKey,
compareClassId,
- compareClassGradeKey,
props.selectedSubjectId,
topN,
],
@@ -101,8 +93,7 @@ const {
enabled: computed(() =>
!!homeStore.selectedClassId
&& !!homeStore.selectedGradeKey
- && !!compareClassId.value
- && !!compareClassGradeKey.value,
+ && !!compareClassId.value,
),
staleTime: 30000, // 30秒内不重新请求
})
diff --git a/src/components/marking/TaskCard.vue b/src/components/marking/TaskCard.vue
index 04889e0..c3d7164 100644
--- a/src/components/marking/TaskCard.vue
+++ b/src/components/marking/TaskCard.vue
@@ -88,10 +88,6 @@ function navigateToQuality(subjectId: number) {
{{ task.exam_name }}
-
-
- {{ formatDate(task.exam_date) }}
-
@@ -100,6 +96,10 @@ function navigateToQuality(subjectId: number) {
{{ task.exam_type }}
考试ID: {{ task.exam_id }}
+
+
+ {{ formatDate(task.exam_date) }}
+
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index 92d6a7e..bf8f0ea 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -231,7 +231,7 @@ function handleExamChange() {
uni.showActionSheet({
itemList: examNames,
success: (res) => {
- const selectedOption = homeStore.examOptions[res.tapIndex]
+ const selectedOption = homeStore.examOptions[res.tapIndex].filter(item => item.)
homeStore.selectedExamId = selectedOption.value as number
// 选择考试后重新获取统计数据
fetchExamStats()
@@ -449,7 +449,7 @@ onMounted(async () => {
班级/年级人数
- {{ statsData.classCount }}/{{ statsData.totalCount }}
+ {{ statsData.classCount }}/{{ statsData.totalCount }}
@@ -458,7 +458,7 @@ onMounted(async () => {
均分排名
- {{ statsData.ranking }}/{{ statsData.totalRanking }}
+ {{ statsData.ranking }}/{{ statsData.totalRanking }}
@@ -467,7 +467,7 @@ onMounted(async () => {
年级前50名
- {{ statsData.top50Count }}/{{ statsData.top50Total }}
+ {{ statsData.top50Count }}/{{ statsData.top50Total }}
@@ -476,9 +476,12 @@ onMounted(async () => {
最高分/最低分
- {{ statsData.highestScore }}/{{ statsData.lowestScore }}
+ {{ statsData.highestScore }}/{{ statsData.lowestScore }}
+
+
+
@@ -496,15 +499,15 @@ onMounted(async () => {
{{ statsData.goodRate }}%
-
-
-
-
-
- 及格率
+
+
+
+
+ 及格率
+
+ {{ statsData.passRate }}%
- {{ statsData.passRate }}%
@@ -623,11 +626,11 @@ onMounted(async () => {
v-for="classItem in homeStore.classOptions"
:key="classItem.value"
class="flex items-center justify-between rounded-xl bg-gray-50 p-3 active:bg-blue-50"
- @tap="homeStore.selectedClassId = classItem.value"
+ @tap="homeStore.selectedClassId = classItem.value; homeStore.selectedGradeKey = classItem.gradeKey"
>
{{ classItem.label }}
diff --git a/src/pages/mine/index.vue b/src/pages/mine/index.vue
index 0f86571..62dae74 100644
--- a/src/pages/mine/index.vue
+++ b/src/pages/mine/index.vue
@@ -166,7 +166,7 @@ function getIconColorClass(index: number) {
- 角色:{{ getRoleText }}
+ 账号信息:{{ userInfo.phone || "17622222222" }}
@@ -174,28 +174,15 @@ function getIconColorClass(index: number) {
-
-
-
-
-
- 账号信息
-
-
- {{ userInfo.phone || "17622222222" }}
-
-
-
-
-
-
-
- 所属学校
-
-
- {{ userInfo.schools?.[0]?.name || "光谷四小" }}
-
+
+
+
+
+ 所属学校
+
+ {{ userInfo.schools?.[0]?.name || "光谷四小" }}
+
diff --git a/src/store/home.ts b/src/store/home.ts
index 73f4b23..1b91ca2 100644
--- a/src/store/home.ts
+++ b/src/store/home.ts
@@ -10,6 +10,7 @@ export interface SelectOption {
value: number
examSubjectId?: number
subjectId?: number
+ gradeKey?: number
}
// 班级信息类型
@@ -29,14 +30,13 @@ export const useHomeStore = defineStore(
const loading = ref(false)
const examDataMap = ref