Ver código fonte

完善自动组卷和手动组卷的总分自动分配功能

OnePsycho 4 anos atrás
pai
commit
3102ef0ee5

+ 3 - 0
TEAMModelOS/ClientApp/src/api/syllabus.js

@@ -28,6 +28,9 @@ export default {
 	ViewShare:function(data) {
 	    return post('/teacher/share/view-share', data)
 	},
+	ShareAgree:function(data) {
+	    return post('/teacher/share/agree', data)
+	},
 	// 查找知识块数量
 	FindBlockCount: function (data) {
 		return post('/knowledges/find-count', data)

+ 8 - 1
TEAMModelOS/ClientApp/src/components/syllabus/DragTree.vue

@@ -11,7 +11,11 @@
 						<Icon type="md-cube" color="#00c38d" :title="$t('syllabus.tree.hasResource')" v-if="data.rnodes && data.rnodes.length" />
 						<Icon type="md-git-compare" color="#00c38d" :title="$t('syllabus.tree.hasCoEdit')" v-if="hasEditAuth(data) && isSchool" />
 					</span>
-					<span class="custom-tree-tools" v-if="(hasEditAuth(data) || $access.can('admin.*|Syllabus_Edit'))">
+					<span class="custom-tree-tools" v-if="inShareView && isFirstLevel(data)">
+						<Icon type="ios-remove-circle-outline" style="margin-right: 5px;" size="16" />
+						<span style="color: #9f9f9f;font-size: 12px;margin-right: 20px;">忽略该章节</span>
+					</span>
+					<span class="custom-tree-tools" v-if="((hasEditAuth(data) || $access.can('admin.*|Syllabus_Edit')) && !inShareView)">
 						<Icon type="md-create" size="16" :title="$t('syllabus.tree.edit')" @click="onEditItem(node,data,$event)" />
 						<Icon type="md-add" size="16" :title="$t('syllabus.tree.add')" @click="onAddNode(node,data,$event)" />
 						<Icon type="md-remove" size="16" :title="$t('syllabus.tree.remove')" @click="remove(node,data)" v-if="!isFirstLevel(data) ||  (canDeleteChapter(data) && isFirstLevel(data))"/>
@@ -310,6 +314,9 @@
 				return nodeData => {
 					return nodeData.creatorId === this.$store.state.userInfo.TEAMModelId
 				}
+			},
+			inShareView(){
+				return !this.isSchool && this.$parent.activeTab === 'fromShare'
 			}
 		},
 		watch: {

+ 1 - 0
TEAMModelOS/ClientApp/src/view/evaluation/components/BaseExerciseList.vue

@@ -720,6 +720,7 @@
 						this.pageScrollTo(0)
 						this.$nextTick(() => {
 							// this.$MathJax.MathQueue(this.$refs.mathJaxContainer);
+							// this.onConfirmTypeScore()
 						})
 					}
 				},

+ 20 - 3
TEAMModelOS/ClientApp/src/view/evaluation/index/CreatePaper.vue

@@ -320,6 +320,17 @@
 			 */
 			async getAutoQuestions(questions) {
 				let autoQuestions = await this.$evTools.getFullItem(questions)
+				let arr = autoQuestions
+				let scoreArr = this.averageTotalScore(this.evaluationInfo.score, arr.length)
+				arr.forEach((i, index) => {
+					i.score = scoreArr[index] || 0
+					if(i.type === 'compose' && i.children.length){
+						let childrenScoreArr = this.averageTotalScore(i.score, i.children.length)
+						i.children.forEach((child,childIndex) => {
+							child.score = childrenScoreArr[childIndex]
+						})
+					}
+				})
 				this.evaluationInfo.item = []
 				this.evaluationInfo.item = this.evaluationInfo.item.concat([...autoQuestions])
 				this.activeTab = 'preview'
@@ -335,8 +346,13 @@
 				let scoreArr = this.averageTotalScore(this.evaluationInfo.score, arr.length)
 				arr.forEach((i, index) => {
 					i.score = scoreArr[index] || 0
+					if(i.type === 'compose' && i.children.length){
+						let childrenScoreArr = this.averageTotalScore(i.score, i.children.length)
+						i.children.forEach((child,childIndex) => {
+							child.score = childrenScoreArr[childIndex]
+						})
+					}
 				})
-				console.log()
 				// 如果是编辑试卷 则往原试卷添加不包含的新题目进入
 				if (this.isEditPaper) {
 					let list = this.evaluationInfo.item
@@ -351,14 +367,15 @@
 				console.log('手动挑题返回')
 				console.log(arr)
 			},
-
+			
+			/* 根据总分给出固定长度的平均分配数组 */
 			averageTotalScore(total, length) {
 				let result = new Array(length).fill(0)
 				// 先判断是否总分除以题目数量能否除尽
 				let remainder = total % length
 				// 如果可以整除 则直接计算
 				if (remainder === 0) {
-					result = result.map(i => total % length)
+					result = result.map(i => total / length)
 				} else {
 					// 如果不能整除 则前面所有取整 最后一题加上余数 即可完成配分
 					let integerScore = parseInt(total / length)

+ 27 - 0
TEAMModelOS/ClientApp/src/view/syllabus/Syllabus.less

@@ -131,6 +131,33 @@
 								margin: 0 8px;
 							}
 						}
+						
+						.volume-btn-agree{
+							display: inline-flex;
+							justify-content: center;
+							align-items: center;
+							padding: 3px 8px;
+							color: #fff;
+							border-radius: 4px;
+							vertical-align: middle;
+							span{
+								display: inline-block;
+								margin: 2px 5px 0 5px;
+							}
+						}
+						
+						.volume-btn-refuse{
+							display: inline-flex;
+							justify-content: center;
+							align-items: center;
+							padding: 3px 8px;
+							vertical-align: middle;
+							color: #fff;
+							span{
+								display: inline-block;
+								margin: 2px 5px 0 5px;
+							}
+						}
 					}
 					&:hover{
 						.volume-active;

+ 39 - 5
TEAMModelOS/ClientApp/src/view/syllabus/Syllabus.vue

@@ -28,10 +28,11 @@
 					<div v-if="!isSearchVolume">
 						<span>册别清单</span>
 						<span class="syllabus-content-header-tools">
-							<Icon type="md-search" @click="doSearchVolume" />
-							<Icon type="md-create" @click="doEditVolume" v-if="hasSyllabusAuth" />
-							<Icon type="md-trash" @click="doDeleteVolume" v-if="hasSyllabusAuth" />
-							<Icon type="md-add" @click="doAddVolume" v-if="hasSyllabusAuth" />
+							<Icon type="md-search" title="搜索" @click="doSearchVolume" />
+							<Icon type="md-copy" title="复制副本" @click="doCopyVolume" v-if="hasSyllabusAuth && inShareView" />
+							<Icon type="md-create" title="编辑" @click="doEditVolume" v-if="hasSyllabusAuth" />
+							<Icon type="md-trash" title="删除" @click="doDeleteVolume" v-if="hasSyllabusAuth && !inShareView" />
+							<Icon type="md-add" title="新建册别" @click="doAddVolume" v-if="hasSyllabusAuth" />
 						</span>
 					</div>
 					<div style="width: 90%;" v-else>
@@ -51,6 +52,21 @@
 								<span>|</span>
 								<span>{{ getSemesterName(volume.semesterId) }}</span>
 							</p>
+							<p class="volume-item-info" v-if="inShareView">
+								<span  style="display: flex;align-items: center;">
+									<Icon type="ios-remove-circle-outline" style="font-weight: bold;margin-right: 5px;"/>
+									忽略该分享
+								</span>
+								<!-- <span class="volume-btn-agree" @click="onAgreeShare(volume,'agree')">
+									<Icon type="md-checkmark-circle-outline" size="20" color="#27c684" />
+									<span>接受</span>
+								</span>
+								<span class="volume-btn-refuse" @click="onAgreeShare(volume,'refuse')">
+									<Icon type="ios-close-circle-outline" size="20" color="#d02a4e"
+										style="font-weight: bold;" />
+										<span>拒绝</span>
+									</span> -->
+							</p>
 						</div>
 					</div>
 				</vuescroll>
@@ -448,8 +464,19 @@
 					this.$Message.error(err);
 				})
 			},
+			/* 是否接受分享的课纲 */
+			onAgreeShare(volume,type){
+				// this.$api.syllabus.ShareAgree({
+				// 	code:volume.code,
+				// 	id:volume.id,
+				// 	agree:type === 'agree' ? 3 : 4
+				// }).then(res => {
+					
+				// })
+			},
 			/* 点击某个册别 */
 			onVolumeClick(volume, volumeIndex) {
+				console.log(volume)
 				if (!volume || (volume.id === this.curVolume.id && !this.isEditVolume)) return
 				this.isLoading = true
 				this.curVolume = volume
@@ -467,6 +494,10 @@
 				}
 				this.isEditVolume = false
 				this.isAddVolumeModal = true
+			},
+			/* 复制副本 */
+			doCopyVolume(){
+				
 			},
 			/* 搜索册别 */
 			doSearchVolume() {
@@ -499,7 +530,7 @@
 				let curVolume = this.curVolume
 				this.$Modal.confirm({
 					title: "删除册别",
-					content: "<p>确认除该册别?</p>",
+					content: "<p>确认除该册别?</p>",
 					onOk: () => {
 						this.isLoading = true;
 						this.$api.syllabus.DeleteVolume({
@@ -1290,6 +1321,9 @@
 			// 是否可以操作课纲模块(个人课纲或者管理员或者有课纲权限)
 			hasSyllabusAuth() {
 				return !this.isSchool || this.$access.can('admin.*|Syllabus_Edit')
+			},
+			inShareView(){
+				return !this.isSchool && this.activeTab === 'fromShare'
 			}
 		},
 	}