ソースを参照

Merge branch 'develop5.0-tmd' of http://106.12.23.251:10000/TEAMMODEL/TEAMModelOS into develop5.0-tmd

zhouj1203@hotmail.com 4 年 前
コミット
66c56a4034

+ 9 - 4
TEAMModelOS/ClientApp/src/components/syllabus/DragTree.vue

@@ -139,7 +139,9 @@
 			},
 			/* 禁止一级节点往下级进行拖拽 */
 			allowDrop(draggingNode, dropNode, dropType) {
-				if (draggingNode.level === dropNode.level) {
+				if(dropNode.level === 3){
+					return dropType === 'prev' || dropType === 'after'
+				}else if (draggingNode.level === dropNode.level) {
 					if(draggingNode.level === 1){
 						return dropType === 'prev' || dropType === 'after'
 					}else{
@@ -187,7 +189,7 @@
 						}).then(res => {
 							if(res.status === 200){
 								this.$Message.success('操作成功!')
-								this.$parent.getShareVolumeList()
+								this.$parent.getShareVolumeList(true)
 							}
 						})
 					}
@@ -509,7 +511,10 @@
 			},
 			// 点击添加展开弹窗
 			onAddNode(node,data, e) {
-				e.stopPropagation() // 防止点击事件穿透到父层
+				if(node.level === 3){
+					this.$Message.warning('每个章节最多只能有3级!')
+					return
+				}
 				this.isEditItem = false
 				this.isEditOrAdd = true
 				this.currentParentData = data // 当前点击节点即为父节点
@@ -520,7 +525,6 @@
 			},
 			// 编辑节点操作
 			onEditItem(node, data, e) {
-				e.stopPropagation() // 防止点击事件穿透到父层
 				this.isEditOrAdd = true
 				this.isEditItem = true
 				this.currentEditData = data
@@ -564,6 +568,7 @@
 				}
 				this.isEditOrAdd = false
 				this.$parent.hasModify = true
+				console.log(this.curData.id);
 				this.$emit('addModifyId',this.getChapterIdById(this.curData.id))
 				this.$Message.success(this.isEditItem ? this.$t('syllabus.tree.editSucTip') : this.$t('syllabus.tree.addSucTip'))
 			},

+ 9 - 11
TEAMModelOS/ClientApp/src/components/syllabus/InviteTeacher.vue

@@ -193,20 +193,18 @@
 			/* 分享课纲操作 */
 			doShare(){
 				let val = this.curTeacher
-				if(this.nodeInfo.auth.map(i => i.tmdid).includes(val.id)){
-					this.$Message.warning('该章节已分享给当前教师!请勿重复分享!')
-					return
-				}
 				this.isShareLoading = true
 				this.sendShareApi(val.id,val.name,true,true).then(res => {
 					setTimeout(() => {
 						this.$Message.success('分享成功!')
-						this.nodeInfo.auth.push({
-							tmdid:val.id,
-							tmdname:val.name,
-							aggre:0,
-							type:'share'
-						})
+						if(!this.nodeInfo.auth.map(i => i.tmdid).includes(val.id)){
+							this.nodeInfo.auth.push({
+								tmdid:val.id,
+								tmdname:val.name,
+								aggre:0,
+								type:'share'
+							})
+						}
 						this.isShareLoading = false
 						this.curTeacher = null
 						this.hasSearchResult = false
@@ -272,7 +270,7 @@
 						return false
 					}else{
 						let matchItem = this.nodeInfo.auth.filter(i => i.tmdid === id)
-						if(matchItem.length && matchItem[0].coedit){
+						if(matchItem.length && matchItem[0].type === 'coedit'){
 							return true
 						}else{
 							return false

+ 1 - 1
TEAMModelOS/ClientApp/src/view/answersheet/BaseEditor.vue

@@ -414,7 +414,7 @@
 								document.getElementById(this.ids + 'btn').style.top = (PAPER_H - curEditorY + lastBottomGap + SVG_BORDER_PROP.y + 20) + "px";
 							}
 						} else {
-							document.getElementById(this.ids + 'btn').style.top =  "20px";
+							document.getElementById(this.ids + 'btn') && (document.getElementById(this.ids + 'btn').style.top =  "20px")
 						}
 						this.$root.$children[0].spinShow = false;
 						

+ 14 - 9
TEAMModelOS/ClientApp/src/view/answersheet/SheetObjective.vue

@@ -136,10 +136,10 @@
 				}
 				let blockList = [...new Set(itemsPositionArr.map(i => i.lineIndex))]
 				this.blockList = blockList
-
+				console.log(itemsPositionArr)
 				items.forEach((item, index) => {
 					if (index > 0 && (itemsPositionArr[index].lineIndex !== itemsPositionArr[index - 1]
-						.lineIndex)) {
+							.lineIndex)) {
 						this.leftItems = this.leftItems.slice(index, this.leftItems.length)
 					}
 					let optionX = CONTENT_START_X + MARGIN_LEFT + this.getStartX(number, this.leftItems, item.id);
@@ -181,17 +181,22 @@
 					});
 
 				});
-
-				let diff = this.leftItems.length - this.number
-				let refHeight = this.blockHeight * (blockList.length - 1)
-				let objectiveHeight = diff > 0 ? refHeight : refHeight - 26 * diff * -1
-				this.anchorRectY = startY + GAP * number + objectiveHeight
+				console.log(this.leftItems)
+				// diff代表剩余的数量  是否够排满一列
+				let diff =  this.number - this.leftItems.length
+				let refHeight = this.blockHeight * (blockList.length)
+				// 如果不够排满一列 则最后一块渲染的高度就是 差值的高度
+				let objectiveHeight = this.leftItems.length >= 0 ? refHeight : refHeight - 26 * diff
+				console.log(this.blockHeight,refHeight,this.leftItems.length);
+				console.log(startY,number,objectiveHeight);
+				this.anchorRectY = startY +  objectiveHeight
+				console.log(this.anchorRectY)
 				for (let index = 0; index < 28; index++) {
 					// 渲染选项框横向定位锚点
 					this.objectiveGroup.add(
 						snap.rect(
 							CONTENT_START_X + MARGIN_LEFT + NUMBER_ITEM_ML + optionGap * (index - 1),
-							startY + GAP * number + objectiveHeight,
+							startY +  objectiveHeight,
 							NUMBER_ITEM_W,
 							NUMBER_ITEM_H
 						)
@@ -287,7 +292,7 @@
 				return this.objectiveItems.length ? this.objectiveItems.map(i => i.score).reduce((a, b) => a + b) : 0
 			},
 			// 是否为根据试卷自动生成的答题卡
-			isAutoCreate(){
+			isAutoCreate() {
 				return this.$store.state.answerSheet.isAutoCreate
 			}
 		},

+ 3 - 1
TEAMModelOS/ClientApp/src/view/evaluation/bank/TestPaperList.vue

@@ -32,7 +32,9 @@
 						<span class="info-item">{{$t('evaluation.paperList.itemCount')}}:<span
 								class="info-bold">{{ paper.scoring ? paper.scoring.length : 0 }}</span></span>
 						<span class="info-item">{{$t('evaluation.filter.useCount')}}:<span
-								class="info-bold">{{ paper.useCount || 0 }}</span></span>		
+								class="info-bold">{{ paper.useCount || 0 }}</span></span>
+						<span class="info-item">{{$t('evaluation.updateTime')}}:<span
+								class="info-bold">{{ $tools.formatTime(paper.createTime)  || 0 }} </span></span>
 						<!-- <span class="info-item">难度系数:<span class="info-bold">{{ paper.item ? handleDiffCalc(paper.item) : 0 }}</span></span> -->
 					</div>
 					<div class="paper-item-tools" v-if="!chooseModel">

+ 0 - 1
TEAMModelOS/ClientApp/src/view/evaluation/bank/index.vue

@@ -146,7 +146,6 @@
 		},
 		beforeRouteLeave(to, from, next) {
 			if(to.name === 'newSchoolPaper' || to.name === 'newPrivatePaper'){
-				console.error(to)
 				// 设置下一个路由的 meta
 				to.meta.isKeep = false;  // 让 A 缓存,即不刷新
 			}

+ 9 - 1
TEAMModelOS/ClientApp/src/view/evaluation/index/CreateExercises.vue

@@ -705,12 +705,20 @@
 		// 路由离开生命周期函数
 		beforeRouteLeave(to, from, next) {
 			if (this.isComplete) {
-				next()
+				if(to.name === 'schoolBank' || to.name === 'personalBank'){
+					// 设置下一个路由的 meta
+					to.meta.isKeep = false;  // 让 A 缓存,即不刷新
+				}
+				next();
 			} else {
 				this.$Modal.confirm({
 					title: this.$t('evaluation.newExercise.modalTip'),
 					content: this.$t('evaluation.newExercise.unSaveTip'),
 					onOk: () => {
+						if(to.name === 'schoolBank' || to.name === 'personalBank'){
+							// 设置下一个路由的 meta
+							to.meta.isKeep = false;  // 让 A 缓存,即不刷新
+						}
 						next();
 					}
 				});

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

@@ -123,6 +123,19 @@
 						margin: 10px 0;
 						padding-right: 10px;
 					}
+					
+					.status-idDel{
+						font-size: 12px;
+						display: inline-block;
+						padding: 2px 8px;
+						background-color: #424242;
+						color: #fff;
+						margin-left: 5px;
+						margin-bottom: 3px;
+						vertical-align: bottom;
+						border-radius: 4px;
+						zoom: 0.9;
+					}
 					&-info{
 						span{
 							color: #9f9f9f;

+ 85 - 20
TEAMModelOS/ClientApp/src/view/syllabus/Syllabus.vue

@@ -28,11 +28,11 @@
 					<div v-if="!isSearchVolume">
 						<span>册别清单</span>
 						<span class="syllabus-content-header-tools">
-							<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" />
+							<Icon type="md-search" title="搜索" @click="doSearchVolume" v-if="volumeList.length"/>
+							<!-- <Icon type="md-copy" title="复制副本" @click="doCopyVolume" v-if="hasSyllabusAuth && inShareView" /> -->
+							<Icon type="md-create" title="编辑" @click="doEditVolume" v-if="hasSyllabusAuth && !inShareView && volumeList.length" />
+							<Icon type="md-trash" title="删除" @click="doDeleteVolume" v-if="hasSyllabusAuth && !inShareView && volumeList.length" />
+							<Icon type="md-add" title="新建册别" @click="doAddVolume" v-if="hasSyllabusAuth && !inShareView" />
 						</span>
 					</div>
 					<div style="width: 90%;" v-else>
@@ -46,7 +46,7 @@
 						<div v-for="(volume,volumeIndex) in volumeList" :key="volumeIndex"
 							:class="['volume-item',activeVolumeIndex === volumeIndex ? 'volume-active' : '']"
 							@click="onVolumeClick(volume,volumeIndex)">
-							<p class="volume-item-name">{{ volume.name }}</p>
+							<p class="volume-item-name">{{ volume.name }} <span class="status-idDel" v-if="volume.isDel">已失效</span> </p>
 							<p class="volume-item-info" v-if="isSchool">
 								<span>{{ getGradeName(volume.gradeId) }}</span>
 								<span>|</span>
@@ -74,7 +74,7 @@
 			<div class="syllabus-mid">
 				<div class="syllabus-content-header">
 					<span>课纲目录</span>
-					<span class="syllabus-content-header-tools">
+					<span class="syllabus-content-header-tools" v-if="volumeList.length && curVolume.id && !inShareView">
 						<Icon type="md-add" @click="isAddTreeModal = true" v-if="hasSyllabusAuth" />
 					</span>
 				</div>
@@ -133,7 +133,7 @@
 									<Icon type="md-eye" />
 									<span>查看</span>
 								</div>
-								<div class="node-resource-tool" @click="onDeleteResource(item,index)">
+								<div class="node-resource-tool" @click="onDeleteResource(item,index)" v-if="(hasSyllabusAuth || hasEditAuth(curNode)) && !inShareView">
 									<Icon type="md-trash" />
 									<span>删除</span>
 								</div>
@@ -396,12 +396,12 @@
 				this.gradeList = this.periodList[val].grades;
 				this.semesterList = this.periodList[val].semesters;
 				this.activeSubjectIndex = 0
-				this.getVolumeList()
+				this.getVolumeList(true)
 			},
 			/* 切换科目的操作 */
 			onSubjectChange(subject, index) {
 				this.activeSubjectIndex = index
-				this.getVolumeList()
+				this.getVolumeList(true)
 			},
 			/* 切换个人创建的课纲和他人分享的课纲 */
 			onChangeSyllabusTab(type) {
@@ -467,6 +467,11 @@
 									status: 1
 								}
 							})
+							shareList.forEach(i => {
+								if(i.children.length && !i.children.filter(j => j.agree !== -1).length){
+									i.isDel = true
+								}
+							})
 							this.volumeList = shareList.reverse()
 							this.originVolumeList = JSON.parse(JSON.stringify(this.volumeList))
 							let activeIndex = this.isEditVolume ? this.activeVolumeIndex : 0
@@ -490,6 +495,15 @@
 			/* 点击某个册别 */
 			onVolumeClick(volume, volumeIndex, needRefresh) {
 				console.log(volume)
+				if(volume.isDel){
+					this.$Message.warning('该册别已被创建者移除!')
+					this.treeOrigin = []
+					this.curNode = {
+						id:'',
+						rnodes:[]
+					}
+					return
+				}
 				if (!volume || (volume.id === this.curVolume.id && !this.isEditVolume && !needRefresh)) return
 				this.isLoading = true
 				this.curVolume = volume
@@ -648,13 +662,14 @@
 			},
 			/* 有章节发生变化记录章节ID */
 			addModifyId(id) {
+				console.log(id)
 				this.modifyIdArr.push(id)
 			},
 			/* 存储变更保存最新课纲数据 */
 			onSaveSyllabus() {
 				this.isSaveSyllabus = true
 				// 拿到有修改变动的章节ID集合
-				let modifyIdArr = [...new Set(this.modifyIdArr)].filter(i => i !== this.curVolume.id)
+				let modifyIdArr = [...new Set(this.modifyIdArr)].filter(i => i !== this.curVolume.id && i)
 				console.log(modifyIdArr)
 				let allChapter = this.$refs.treeRef ? this.$refs.treeRef.treeDatas : [];
 				let modifyChapters = modifyIdArr.length ? modifyIdArr.map(id => {
@@ -831,19 +846,21 @@
 				});
 			},
 			/* 校本课纲关联个人试题试卷要进行入库操作 */
-			saveItemToSchoolBlob(pItem) {
+			saveItemToBlob(pItem,privateToSchool) {
 				return new Promise(async (r, j) => {
 					pItem = await this.$editorTools.doRemoveMideaHost(pItem)
 					console.log(pItem)
 					let path = 'item/' + pItem.id + '/'
 					let privateSas = await this.$tools.getPrivateSas()
-					let privareBlobTool = new BlobTool(privateSas.url, privateSas.name, privateSas.sas,'private')
+					let privateBlobTool = new BlobTool(privateSas.url, privateSas.name, privateSas.sas,'private')
+					let toClient = privateToSchool ? this.containerClient : privateBlobTool
+					let fromClient = privateToSchool ?  privateBlobTool : this.containerClient
 					const itemJsonFile = await this.$evTools.createBlobItem(pItem);
 					let file = new File([JSON.stringify(itemJsonFile)], pItem.id + ".json", {type: "",});
 					// 先把对应试题目录下的全部复制到校本BLOB 然后再更新添加学段科目等字段后的题目Json文件
-					this.containerClient.copyFolder(path,path.slice(0,path.length - 1),privareBlobTool).then(async res => {
+					toClient.copyFolder(path,path.slice(0,path.length - 1),fromClient).then(async res => {
 						try{
-							let blobFile = await this.containerClient.upload(file, "item/" + pItem.id);
+							let blobFile = await toClient.upload(file, "item/" + pItem.id);
 							if(blobFile.blob){
 								this.saveExercise(pItem).then(result => {
 									console.log(result)
@@ -867,8 +884,9 @@
 						r(200)
 					}else{
 						let curResourceArr = this.$refs.treeRef.curData.rnodes
-						// 拿到关联的个人试题
+						// 拿到关联的个人试题和校本试题
 						let privateItems = list.filter(i => i.scope === 'private')
+						let schoolItems = list.filter(i => i.scope === 'school')
 						// 如果是在校本课纲关联的个人试题 则需要进行入库操作
 						if (this.isSchool && privateItems.length) {
 							let promiseArr = []
@@ -879,7 +897,7 @@
 								pItem.gradeIds = [this.curVolume.gradeId + '']
 								pItem.scope = 'school'
 								pItem.code = this.$store.state.userInfo.schoolCode
-								promiseArr.push(this.saveItemToSchoolBlob(pItem))
+								promiseArr.push(this.saveItemToBlob(pItem,false))
 							})
 							Promise.all(promiseArr).then(result => {
 								list.forEach(i => {
@@ -900,7 +918,37 @@
 							}).catch(err => {
 								this.$Message.error(err)
 							})
-						} else {
+						}else if(!this.isSchool && schoolItems.length){
+							let promiseArr = []
+							// 个人试题入库前需要补充必要的学段科目年级信息
+							schoolItems.forEach(pItem => {
+								pItem.periodId = null
+								pItem.subjectId = null
+								pItem.gradeIds = null
+								pItem.scope = 'private'
+								pItem.code = this.$store.state.userInfo.TEAMModelId
+								promiseArr.push(this.saveItemToBlob(pItem,true))
+							})
+							Promise.all(promiseArr).then(result => {
+								list.forEach(i => {
+									if (!curResourceArr.filter(j => j.type === 'item').map(k => k.id).includes(i
+											.id)) {
+										curResourceArr.push({
+											type: 'item',
+											title: i.question,
+											id: i.id,
+											code: 'Item-' + this.$store.state.userInfo.TEAMModelId,
+											scope: 'private',
+											cntr: this.$store.state.userInfo.TEAMModelId,
+											link: i.blob
+										})
+									}
+								})
+								r(200)
+							}).catch(err => {
+								this.$Message.error(err)
+							})
+						}else {
 						list.forEach(i => {
 							if (!curResourceArr.filter(j => j.type === 'item').map(k => k.id).includes(i.id)) {
 								curResourceArr.push({
@@ -1269,11 +1317,14 @@
 						"scope": this.curScope,
 						"syllabusIds": []
 					}
-					if ((this.isEditVolume && this.curVolume) || this.isSaveSyllabus) {
+					if ((this.isEditVolume && this.curVolume)) {
 						addVolumeParams.id = this.curVolume.id
-						// addVolumeParams.name = this.curVolume.name
+						addVolumeParams.name = this.addVolumeForm.name
 						addVolumeParams.syllabusIds = this.allChapterIds || []
 						addVolumeParams.creatorId = this.curVolume.creatorId
+					}
+					if(this.isSaveSyllabus){
+						addVolumeParams.name = this.curVolume.name
 						this.isSaveSyllabus = false
 					}
 					// 发送新增或者编辑册别请求
@@ -1383,6 +1434,20 @@
 				return !this.isSchool && this.activeTab === 'fromShare'
 			}
 		},
+		watch:{
+			volumeList:{
+				handler(n,o){
+					if(n.length === 0){
+						this.treeOrigin = []
+						this.curNode = {
+							id:'',
+							rnodes:[]
+						}
+					}
+				},
+				immediate:true
+			}
+		}
 	}
 </script>