浏览代码

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

CrazyIter_Bin 4 年之前
父节点
当前提交
312b4f3e8c

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

@@ -236,7 +236,7 @@
 					codeval: this.curCode,
 					volumeId: targetVolume.id,
 					scope: targetVolume.scope,
-					trees: [this.refreshCopyChapter(this.curChapter)]
+					trees: [this.refreshCopyChapter(this.curChapter,targetVolume.id)]
 				}]
 				this.$api.syllabus.UpsertTree(upsertParams).then((res) => {
 					if (!res.error && res) {
@@ -252,9 +252,10 @@
 				})
 			},
 			/* 将复制的节点内的创建信息、code等更新为当前用户 */
-			refreshCopyChapter(chapterNode){
+			refreshCopyChapter(chapterNode,newVolumeId){
 				console.log(this.flatRNodes);
 				let myId = this.$store.state.userInfo.TEAMModelId
+				chapterNode.pid = newVolumeId
 				const fn = (source)=>{
 					source.creatorId = myId
 					if(source.rnodes.length){
@@ -285,14 +286,15 @@
 						if(copyFile.type === 'item'){
 							promiseArr.push(this.copyItemToBlob(copyFile,needSave))
 							// 如果不入库 则需要修改资源的link地址
-							if(!needSave){
-								this.flatRNodes[fileIndex].link = '/syllabus/' + rnodes[fileIndex].id + '/' + rnodes[fileIndex].id + '.json'
-							}
+							this.flatRNodes[fileIndex].link = (needSave ? '/item/' : '/syllabus/') + rnodes[fileIndex].id + '/' + rnodes[fileIndex].id + '.json'
+							
 						}else if(copyFile.type === 'paper'){
 							promiseArr.push(this.copyPaperToBlob(copyFile,needSave))
 							// 如果不入库 则需要修改资源的link地址
 							if(!needSave){
-								this.flatRNodes[fileIndex].link = rnodes[fileIndex].link.replace('paper','syllabus')
+								this.flatRNodes[fileIndex].link = rnodes[fileIndex].link.replace('paper/','syllabus/')
+							}else{
+								this.flatRNodes[fileIndex].link = rnodes[fileIndex].link.replace('syllabus/','paper/')
 							}
 						}else{
 							promiseArr.push(this.copyFileToBlob(copyFile))
@@ -323,11 +325,12 @@
 			},
 			/* 复制试题到当前用户BLOB */
 			copyItemToBlob(resourceItem,needSave){
+				console.log(resourceItem)
 				// console.log(JSON.stringify(rnodes))
 				return new Promise(async (r, j) => {
 					let toPath = needSave ? `item/${resourceItem.id}/` : `syllabus/${resourceItem.id}/`
 					// 是否入库 来决定保存的路径
-					let fromPath = `item/${resourceItem.id}`
+					let fromPath = resourceItem.link.split('/')[1] + '/' + resourceItem.id
 					// 试题的拥有者也就是复制的来源容器
 					let myId = this.$store.state.userInfo.TEAMModelId
 					let fileOwner = resourceItem.code.replace('Item-','')
@@ -488,6 +491,7 @@
 										if(res.code === 404){
 											this.$parent.modifyIdArr  = this.$parent.modifyIdArr.filter(i => i !== data.id)
 										}
+										this.$parent.treeOrigin = this.$parent.treeOrigin.filter(i => i.id !== data.id)
 										children.splice(index, 1)
 										this.$nextTick().then(() => {
 											const firstNode = document.querySelector('.el-tree-node')
@@ -734,7 +738,6 @@
 							return {}
 						}
 					})
-					console.log(this.treeDatas);
 					this.getAllChild(this.treeDatas)
 					this.$nextTick().then(() => {
 						const firstNode = document.querySelector('.el-tree-node')

+ 7 - 5
TEAMModelOS/ClientApp/src/view/evaluation/bank/index.vue

@@ -147,6 +147,8 @@
 		beforeRouteEnter(to, from, next) {
 			if(from.name !== 'answerSheet'){
 				to.meta.isKeep = false
+			}else{
+				to.meta.isKeep = true
 			}
 			next();
 		},
@@ -166,11 +168,11 @@
 					// console.log(n)
 				}
 			},
-			$route( to , from ){   
-			   if(from.name !== 'answerSheet' && (to.name === 'schoolBank' || to.name === 'personalBank')){
-				  this.onShowPaperList()
-			   }
-			 }
+			// $route( to , from ){   
+			//    if(from.name !== 'answerSheet' && (to.name === 'schoolBank' || to.name === 'personalBank')){
+			// 	  this.onShowPaperList()
+			//    }
+			//  }
 		}
 	}
 </script>

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

@@ -527,6 +527,8 @@
 				console.log(volume)
 				if (volume && volume.isDel) {
 					this.$Message.warning(this.$t('syllabus.isDelTip'))
+					this.activeVolumeIndex = volumeIndex
+					this.curVolume = volume
 					this.treeOrigin = []
 					this.curNode = {
 						id: '',
@@ -746,7 +748,8 @@
 					id: this.nodeInfo.id,
 					scope: this.curVolume.scope,
 					trees: [this.nodeInfo],
-					volumeId: this.curVolume.id
+					volumeId: this.curVolume.id,
+					rnodes:[]
 				})
 				// 只要本地新增的章节 都要记录到修改数据里
 				this.$nextTick(() => {
@@ -758,6 +761,7 @@
 						"title": "",
 						"type": 1,
 						"children": [],
+						"rnodes":[]
 					}
 				})
 				this.hasModify = true;