From 122fb41690d6e4c1fbd71b505706d940b3893145 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Czouyf=E2=80=9D?= <80906036@qq.com>
Date: Mon, 25 Nov 2024 10:59:27 +0800
Subject: [PATCH] =?UTF-8?q?[=E4=B9=A0=E9=A2=98=E4=B8=8A=E4=BC=A0]=20-=20?=
=?UTF-8?q?=E7=AB=A0=E8=8A=82=E4=B8=8B=E5=A2=9E=E5=8A=A0=E5=AF=B9=E5=BA=94?=
=?UTF-8?q?=E7=9F=A5=E8=AF=86=E7=82=B9=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/api/education/knowledgePoint.js | 21 +++++---
.../questionUpload/index.vue | 2 +
.../questionUpload/quesItem/index.vue | 51 +++++++++++++++----
3 files changed, 58 insertions(+), 16 deletions(-)
diff --git a/src/renderer/src/api/education/knowledgePoint.js b/src/renderer/src/api/education/knowledgePoint.js
index 0db8521..b70941b 100644
--- a/src/renderer/src/api/education/knowledgePoint.js
+++ b/src/renderer/src/api/education/knowledgePoint.js
@@ -2,12 +2,21 @@
import request from '@/utils/request'
// 查询知识点列表
export function listKnowlegepoint(query) {
- return request({
- url: '/point/list',
- method: 'get',
- params: query
- })
- }
+ return request({
+ url: '/point/list',
+ method: 'get',
+ params: query
+ })
+}
+
+// 查询知识点列表
+export function listKnowlegepointFormat(query) {
+ return request({
+ url: '/point/formatList',
+ method: 'get',
+ params: query
+ })
+}
// 查询一级知识点查下级所有层级
diff --git a/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/index.vue b/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/index.vue
index d3a7cae..46b94b8 100644
--- a/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/index.vue
+++ b/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/index.vue
@@ -99,6 +99,8 @@ const router = useRouter()
const { proxy } = getCurrentInstance()
const props = defineProps({
})
+
+const curLessionList = ref([]);
const activeParams = reactive({
version: {},
lession: {},
diff --git a/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue b/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue
index 88147d1..d1a8f5d 100644
--- a/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue
+++ b/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue
@@ -407,7 +407,7 @@ import { ElMessage, ElNotification } from 'element-plus'
import { Search } from '@element-plus/icons-vue'
import { onMounted, ref, watch, reactive, getCurrentInstance,nextTick } from 'vue'
-import { getBindlist, listKnowlegepoint } from '@/api/education/knowledgePoint'
+import { getBindlist, listKnowlegepointFormat } from '@/api/education/knowledgePoint'
import { listEvaluation } from '@/api/subject'
import { listEntpcoursework, getEntpcoursework, delEntpcoursework, addEntpcoursework, updateEntpcoursework, uploadEntpcourseworkFile } from "@/api/education/entpCourseWork";
import { isJson } from "@/hooks/useProcessList";
@@ -1670,24 +1670,44 @@ const myMessageShow=(title, msg, status)=>{
// },
// },
+/**
+ * @desc: 遍历原知识点数据, 将title字段转为knowTitle以供knowledgePointProps进行tree的格式转换显示
+ * @return: {*}
+ * @param {*} list
+ */
+const updateKnowledgePoint = (list) => {
+ list.forEach(item => {
+ if (item.title && item.title != '') {
+ item.knowTitle = item.title;
+ }
+ if (item.children && Array.isArray(item.children)) {
+ updateKnowledgePoint(item.children);
+ }
+ });
+ return list;
+};
+
watch(() => props.bookobj.levelSecondId, async (newVal, oldVal) => {
console.log(props.bookobj,'课程选择')
// props.bookobj.levelSecondId? props.bookobj.levelSecondId : props.bookobj.levelFirstId
lessionid.value = props.bookobj.levelSecondId? props.bookobj.levelSecondId : props.bookobj.levelFirstId;
- //
- console.log('123', props.bookobj.node.edusubject == '语文' );
+ /**
+ * 格式化知识点: 分两种情况
+ * 1. 语文/英语: 获取学科下的所有知识点(该学科对应无章节与知识点绑定, 故只获取全知识点)
+ * 2. 其他: 获取当前章节下的所有知识点
+ */
let id = props.bookobj.levelSecondId;
if(props.bookobj.node.edusubject == '语文' || props.bookobj.node.edusubject == '英语'){
id = props.bookobj.node.rootid;
const res = await listEvaluation({ edusubject: props.bookobj.node.edusubject, edustage: props.bookobj.node.edustage, itemkey: "subject", pageSize: 10 });
id = res.rows[0]?.id;
- listKnowlegepoint({evalId: id}).then(res => {
- curKnowledgePointList.value = res.rows;
- curKnowledgePointList.value.forEach(item => {
- item.knowTitle = item.title;
+ if (id) {
+ listKnowlegepointFormat({evalId: id, pageNum: 1, pageSize: 5000,}).then(res => {
+ //console.log('listKnowlegepointFormat->', res.rows);
+ curKnowledgePointList.value = updateKnowledgePoint(res.rows);
});
- });
+ }
}else{
getBindlist({ eid: id }).then(res => {
if (!res.data || res.data.length < 1) {
@@ -1710,7 +1730,20 @@ defineExpose({
cropperFormItemCallBack,
})
+
+
+
\ No newline at end of file