Procházet zdrojové kódy

refactor(course): 优化课程相关组件逻辑和UI交互

- 移除课程详情页的"批改测试"标签页
- 优化学期表单,移除年度和季度输入项
- 调整作业和章节测验组件,添加paperType参数
- 修改文件下载路径获取方式
- 优化资源上传组件,移除无用代码
- 重构课时添加对话框的标签切换逻辑
tanshanming před 6 měsíci
rodič
revize
8c60b408e5

+ 2 - 3
src/libs/globalFunction/file.js

@@ -1,6 +1,7 @@
 import * as Vue from 'vue'
 import router from '@/router'
 import config from '@/config/reSource'
+import configEdu from '@/config'
 import { message } from 'ant-design-vue'
 import { fileImgMap, unknownImg, fileSuffixCodeModeMap, markdownFileType } from '@/libs/map.js'
 import { officeFileType } from '@/libs/map.js'
@@ -84,9 +85,7 @@ const fileFunction = {
 		}&extractionCode=${row.extractionCode == null ? '' : row.extractionCode}&admin=true`
 	},
 	getDownloadFilePath3(row) {
-		return `${config.baseContext}/resourceFile/downloadfile?userFileId=${row.fileId}&shareBatchNum=${
-			row.shareBatchNum == null ? '' : row.shareBatchNum
-		}&extractionCode=${row.extractionCode == null ? '' : row.extractionCode}&admin=true`
+		return `${configEdu.FILE_URL}${row.fileUrl}`
 	},
 	/**
 	 * 获取 Onlyoffice 文件创建路径

+ 50 - 18
src/views/courseAdd/components/courseProduction/addDialog.vue

@@ -8,16 +8,16 @@
 			class="add-class-hours-modal"
 		>
 			<a-tabs v-model:activeKey="activeKey" type="card" @change="handleChange">
-				<a-tab-pane key="1" tab="课时">
+				<a-tab-pane key="1" tab="课时" forceRender>
 					<addClassHours ref="addClassHoursRef" @handlerSelect="handlerSelect"
 								   @handlerUpSelect="handlerUpSelect" @handlerEx="handlerEx"
 								   @handlerExs="handlerExs"></addClassHours>
 				</a-tab-pane>
-				<a-tab-pane key="2" tab="作业">
-					<exList v-if="activeKey == '2'" ref="exListRef" @handlerEx="handlerEx"></exList>
+				<a-tab-pane key="2" tab="作业" forceRender>
+					<exList ref="exListRef" @handlerEx="handlerEx"></exList>
 				</a-tab-pane>
-				<a-tab-pane key="3" tab="章节测验">
-					<exLists v-if="activeKey == '3'" ref="exListsRef" @handlerExs="handlerExs"></exLists>
+				<a-tab-pane key="3" tab="章节测验" forceRender>
+					<exLists  ref="exListsRef" @handlerExs="handlerExs"></exLists>
 				</a-tab-pane>
 			</a-tabs>
 			<div class="footer-btns">
@@ -51,6 +51,11 @@ const exListRefData = ref(null)
 const exListsRefData = ref(null)
 const exListRefCount = ref(0)
 const exListsRefCount = ref(0)
+
+const item1 = ref(0)
+const item2 = ref(0)
+const item3 = ref(0)
+
 const activeKey = ref('1')
 const modeTag = ref('add')
 
@@ -87,22 +92,38 @@ const open = () => {
 	exListRefCount.value = 0
 	exListsRefCount.value = 0
 	modalVisible.value = true
+	 item1.value = 0
+	 item2.value = 0
+	 item3.value = 0
 	activeKey.value = '1'
 	modeTag.value = 'add'
 	nextTick(() => {
 		addClassHoursRef.value.reset()
 		addClassHoursRef.value.open()
+		item1.value = item1.value+1
+
+
+		exListRef.value.handleReset()
+		exListsRef.value.handleReset()
+
+
+		console.log("有木有 1 ",exListRef.value)
+		console.log("有木有 2 ",exListsRef.value)
 	})
 }
 const handleChange = (activeKey) => {
 	nextTick(() => {
+		console.log('选择activeKey', activeKey)
 		if (activeKey == '1' && addClassHoursRef.value) {
 			if (modeTag.value == 'add') {
 				// addClassHoursRef.value.reset()
 				addClassHoursRef.value.open()
 			}
 			if (modeTag.value == 'edit') {
-				addClassHoursRef.value.edit()
+				if(item1.value == 1){
+					addClassHoursRef.value.edit()
+				}
+
 			}
 		}
 		if (activeKey == '2' && exListRef.value) {
@@ -111,15 +132,20 @@ const handleChange = (activeKey) => {
 				}
 				if (modeTag.value == 'edit') {
 					console.log('走没走1', exListRefData.value)
-					if(exListRefData.value && exListRefData.value[0]&& exListRefData.value[0].relateId){
-						exListRef.value.edit(exListRefData.value[0].relateId)
-					}else if(exListRefData.value && exListRefData.value[0]&& exListRefData.value[0].id){
-						exListRef.value.edit(exListRefData.value[0].id)
+					if(item2.value == 1){
+						if(exListRefData.value && exListRefData.value[0]&& exListRefData.value[0].relateId){
+							exListRef.value.edit(exListRefData.value[0].relateId)
+						}else if(exListRefData.value && exListRefData.value[0]&& exListRefData.value[0].id){
+							exListRef.value.edit(exListRefData.value[0].id)
+						}
 					}
+
+
 					console.log('走没走2', exListRefData.value)
 					if(exListRefData.value  == null){
 						exListRef.value.open()
 					}
+					item2.value = item2.value+1
 				}
 
 		}
@@ -128,17 +154,19 @@ const handleChange = (activeKey) => {
 					exListsRef.value.open()
 				}
 				if (modeTag.value == 'edit') {
-					console.log('走没走3', exListsRefData.value)
-					console.log('走没走33', exListsRefData.value[0])
-					if(exListsRefData.value && exListsRefData.value[0]&& exListsRefData.value[0].relateId){
-						exListsRef.value.edit(exListsRefData.value[0].relateId)
-					}else if(exListsRefData.value && exListsRefData.value[0]&& exListsRefData.value[0].id){
-						exListsRef.value.edit(exListsRefData.value[0].id)
+					if(item3.value == 1){
+						if(exListsRefData.value && exListsRefData.value[0]&& exListsRefData.value[0].relateId){
+							exListsRef.value.edit(exListsRefData.value[0].relateId)
+						}else if(exListsRefData.value && exListsRefData.value[0]&& exListsRefData.value[0].id){
+							exListsRef.value.edit(exListsRefData.value[0].id)
+						}
 					}
-					console.log('走没走4', exListsRefData.value)
+
+
 					if(exListsRefData.value  == null){
 						exListsRef.value.open()
 					}
+					item3.value = item3.value+1
 				}
 		}
 	})
@@ -153,6 +181,9 @@ const edit = (item) => {
 	exListsRefCount.value = 0
 	activeKey.value = '1'
 	modalVisible.value = true
+	item1.value = 0
+	item2.value = 0
+	item3.value = 0
 	console.log('修改进来的', item)
 	form.value.id = item.id
 	form.value.chapterId = item.courseId
@@ -161,6 +192,7 @@ const edit = (item) => {
 	console.log('有没有', addClassHoursRef.value)
 	nextTick(() => {
 		addClassHoursRef.value.edit(item)
+		item1.value = item1.value+1
 	})
 
 }
@@ -208,7 +240,7 @@ const handleOk = () => {
 		if (exlists &&exlists.length == 1) {
 			if(exlists[0].id){
 				data.courseRelates.push({funcType: 5, relateId: exlists[0].id})
-			}else if(exlist[0].relateId){
+			}else if(exlists[0].relateId){
 				data.courseRelates.push({funcType: 5, relateId: exlists[0].relateId})
 			}
 		}

+ 5 - 4
src/views/courseAdd/components/courseProduction/exList.vue

@@ -206,7 +206,7 @@
 	const search = async () => {
 		listLoading.value = true
 		try {
-			const response = await examPaperApi.pageList(queryParam)
+			const response = await examPaperApi.pageList({...queryParam,...{paperType:2}})
 			if (response) {
 				const data = response
 				tableData.value = data.records || []
@@ -305,13 +305,14 @@
 		}
 
 	}
-
+	const editNot = async (id) => {
+	}
 	// 生命周期
 	onMounted(async () => {
-
+		console.log('打开了  2')
 	})
 
-	defineExpose({getItemData,edit,open})
+	defineExpose({getItemData,edit,open,editNot,handleReset})
 </script>
 
 <style lang="less" scoped>

+ 5 - 2
src/views/courseAdd/components/courseProduction/exLists.vue

@@ -204,7 +204,7 @@
 	const search = async () => {
 		listLoading.value = true
 		try {
-			const response = await examPaperApi.pageList(queryParam)
+			const response = await examPaperApi.pageList({...queryParam,...{paperType:3}})
 			if (response) {
 				const data = response
 				tableData.value = data.records || []
@@ -300,14 +300,17 @@
 			listLoading.value = false
 		}
 	}
+	const editNot = async (id) => {
+	}
 	// 生命周期
 	onMounted(async () => {
 		// examStore.initSubject(search)
+		console.log('打开了  3')
 	})
 	const open=() =>{
 		examStore.initSubject(search)
 	}
-	defineExpose({getItemData,edit,open})
+	defineExpose({getItemData,edit,open,editNot,handleReset})
 </script>
 
 <style lang="less" scoped>

+ 1 - 13
src/views/courseAdd/components/courseProduction/resourceUpload.vue

@@ -128,7 +128,7 @@
 		<template v-if="isState == 0">
 			<!-- 资源上传 -->
 			<!-- <UploadModal @success="uploadSuccess"></UploadModal> -->
-			<UpLoadBreakPoint ref="UpLoadBreakPointRef" uploadCount="1" @onSuccess="onSuccess"></UpLoadBreakPoint>
+			<UpLoadBreakPoint ref="UpLoadBreakPointRef" @onSuccess="onSuccess"></UpLoadBreakPoint>
 		</template>
 	</a-modal>
 </template>
@@ -376,17 +376,6 @@ const getOrgTreeSelector = () => {
 		})
 }
 //院系组织查询
-const getCourseAllList = () => {
-	resourceAuditApi
-		.courseAllList()
-		.then((res) => {
-			console.log(res.data, '获取全部课程')
-			courseOptions.value = res.data
-		})
-		.catch((err) => {
-			console.log(err)
-		})
-}
 const changeCollegeMajor = (value, selectedOptions) => {
 	console.log('Selected:', value, selectedOptions)
 	if (!value) {
@@ -616,7 +605,6 @@ const handleChange = ({file, fileList: newFileList}) => {
 }
 onMounted(() => {
 	getOrgTreeSelector()
-	getCourseAllList()
 	getHotKeywords()
 	getResourceTypeTree()
 	if (props.isState == 1) {

+ 1 - 1
src/views/courseDetails/index.vue

@@ -47,7 +47,7 @@
 		<a-tabs v-model:activeKey="activeTab" class="course-tabs">
 			<a-tab-pane key="detail" tab="课程详情" />
 			<a-tab-pane key="homework" tab="批改作业" />
-			<a-tab-pane key="test" tab="批改测试" />
+			<!-- <a-tab-pane key="test" tab="批改测试" /> -->
 			<a-tab-pane key="student" tab="学员详情" />
 			<a-tab-pane key="stat" tab="学习统计" />
 		</a-tabs>

+ 2 - 2
src/views/semester/form.vue

@@ -7,12 +7,12 @@
 		@close="onClose"
 	>
 		<a-form ref="formRef" :model="formData" :rules="formRules" layout="vertical">
-			<a-form-item label="年度:" name="mulityear">
+			<!-- <a-form-item label="年度:" name="mulityear">
 				<a-input v-model:value="formData.mulityear" placeholder="请输入年度" allow-clear />
 			</a-form-item>
 			<a-form-item label="季度:" name="quater">
 				<a-input v-model:value="formData.quater" placeholder="请输入季度" allow-clear />
-			</a-form-item>
+			</a-form-item> -->
 			<a-form-item label="开始时间:" name="startTime">
 				<a-date-picker
 					v-model:value="formData.startTime"