|
@@ -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')
|