|
@@ -1112,34 +1112,47 @@
|
|
});
|
|
});
|
|
},
|
|
},
|
|
/* 校本课纲关联个人试题试卷要进行入库操作 */
|
|
/* 校本课纲关联个人试题试卷要进行入库操作 */
|
|
- saveItemToBlob(pItem, privateToSchool) {
|
|
|
|
|
|
+ saveItemToBlob(pItem, privateToSchool, isSaveToItem) {
|
|
return new Promise(async (r, j) => {
|
|
return new Promise(async (r, j) => {
|
|
pItem = await this.$editorTools.doRemoveMideaHost(pItem)
|
|
pItem = await this.$editorTools.doRemoveMideaHost(pItem)
|
|
console.log(pItem)
|
|
console.log(pItem)
|
|
- let path = 'item/' + pItem.id + '/'
|
|
|
|
|
|
+ console.log(isSaveToItem)
|
|
|
|
+ let targetPrefix = isSaveToItem ? 'item/' : 'syllabus/'
|
|
|
|
+ let sourcePrefix = 'item/'
|
|
|
|
+ let targetPath = targetPrefix + pItem.id + '/'
|
|
|
|
+ let sourcePath = sourcePrefix + pItem.id
|
|
let privateSas = await this.$tools.getPrivateSas()
|
|
let privateSas = await this.$tools.getPrivateSas()
|
|
let privateBlobTool = new BlobTool(privateSas.url, privateSas.name, privateSas.sas,
|
|
let privateBlobTool = new BlobTool(privateSas.url, privateSas.name, privateSas.sas,
|
|
'private')
|
|
'private')
|
|
let schoolSas = await this.$tools.getSchoolSas()
|
|
let schoolSas = await this.$tools.getSchoolSas()
|
|
let schoolBlobTool = new BlobTool(schoolSas.url, schoolSas.name, schoolSas.sas,
|
|
let schoolBlobTool = new BlobTool(schoolSas.url, schoolSas.name, schoolSas.sas,
|
|
'school')
|
|
'school')
|
|
- let toClient = privateToSchool ? schoolBlobTool : privateBlobTool
|
|
|
|
- let fromClient = privateToSchool ? privateBlobTool : schoolBlobTool
|
|
|
|
|
|
+ let toClient = this.isSchool ? schoolBlobTool : privateBlobTool
|
|
|
|
+ let fromClient = pItem.scope === 'private' ? privateBlobTool : schoolBlobTool
|
|
const itemJsonFile = await this.$evTools.createBlobItem(pItem);
|
|
const itemJsonFile = await this.$evTools.createBlobItem(pItem);
|
|
let file = new File([JSON.stringify(itemJsonFile)], pItem.id + ".json", {
|
|
let file = new File([JSON.stringify(itemJsonFile)], pItem.id + ".json", {
|
|
type: "",
|
|
type: "",
|
|
});
|
|
});
|
|
// 先把对应试题目录下的全部复制到校本BLOB 然后再更新添加学段科目等字段后的题目Json文件
|
|
// 先把对应试题目录下的全部复制到校本BLOB 然后再更新添加学段科目等字段后的题目Json文件
|
|
- toClient.copyFolder(path, path.slice(0, path.length - 1), fromClient).then(async res => {
|
|
|
|
|
|
+ toClient.copyFolder(targetPath, sourcePath, fromClient).then(async res => {
|
|
try {
|
|
try {
|
|
- let blobFile = await toClient.upload(file, "item/" + pItem.id);
|
|
|
|
|
|
+ let blobFile = await toClient.upload(file, targetPrefix + pItem.id);
|
|
if (blobFile.blob) {
|
|
if (blobFile.blob) {
|
|
- this.saveExercise(pItem).then(result => {
|
|
|
|
- console.log(result)
|
|
|
|
- r(result)
|
|
|
|
- })
|
|
|
|
|
|
+ if(isSaveToItem){
|
|
|
|
+ this.saveExercise(pItem).then(result => {
|
|
|
|
+ console.log(result)
|
|
|
|
+ r(result)
|
|
|
|
+ })
|
|
|
|
+ }else{
|
|
|
|
+ r({
|
|
|
|
+ id:pItem.id,
|
|
|
|
+ question:pItem.question,
|
|
|
|
+ blob: '/' + targetPath + pItem.id + '.json'
|
|
|
|
+ })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
|
+ console.log(e)
|
|
j(e)
|
|
j(e)
|
|
}
|
|
}
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
@@ -1148,107 +1161,147 @@
|
|
})
|
|
})
|
|
},
|
|
},
|
|
/* 获取关联的试题数据 */
|
|
/* 获取关联的试题数据 */
|
|
- onSelectQuestion(val) {
|
|
|
|
- return new Promise((r, j) => {
|
|
|
|
|
|
+ async onSelectQuestion(val) {
|
|
|
|
+ return new Promise(async (r, j) => {
|
|
let exRef = this.$refs.chooseContentRef.$refs.exListRef
|
|
let exRef = this.$refs.chooseContentRef.$refs.exListRef
|
|
let list = exRef ? exRef.selectItems : []
|
|
let list = exRef ? exRef.selectItems : []
|
|
- console.log('xxxxx', list)
|
|
|
|
if (!list.length) {
|
|
if (!list.length) {
|
|
r(200)
|
|
r(200)
|
|
} else {
|
|
} else {
|
|
let curResourceArr = this.$refs.treeRef.curData.rnodes
|
|
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 = []
|
|
|
|
- // 个人试题入库前需要补充必要的学段科目年级信息
|
|
|
|
- privateItems.forEach(pItem => {
|
|
|
|
- pItem.periodId = this.periodList[this.currentPeriodIndex].id
|
|
|
|
- pItem.subjectId = this.subjectList[this.activeSubjectIndex].id
|
|
|
|
- pItem.gradeIds = [this.curVolume.gradeId + '']
|
|
|
|
- pItem.scope = 'school'
|
|
|
|
- pItem.code = this.$store.state.userInfo.schoolCode
|
|
|
|
- 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
|
|
|
|
- .schoolCode,
|
|
|
|
- scope: 'school',
|
|
|
|
- cntr: this.$store.state.userInfo.schoolCode,
|
|
|
|
- link: i.blob
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- r(200)
|
|
|
|
- }).catch(err => {
|
|
|
|
- this.$Message.error(err)
|
|
|
|
- })
|
|
|
|
- } 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.curTeammodelId
|
|
|
|
- promiseArr.push(this.saveItemToBlob(pItem, false))
|
|
|
|
- })
|
|
|
|
- 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.curTeammodelId,
|
|
|
|
- link: i.blob
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- r(200)
|
|
|
|
- }).catch(err => {
|
|
|
|
- this.$Message.error(err)
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
|
|
+ let promiseArr = []
|
|
|
|
+ list.forEach(pItem => {
|
|
|
|
+ promiseArr.push(this.saveItemToBlob(pItem, true, false))
|
|
|
|
+ })
|
|
|
|
+ Promise.all(promiseArr).then(result => {
|
|
list.forEach(i => {
|
|
list.forEach(i => {
|
|
- if (!curResourceArr.filter(j => j.type === 'item').map(k => k.id).includes(
|
|
|
|
- i.id)) {
|
|
|
|
|
|
+ if (!curResourceArr.filter(j => j.type === 'item').map(k => k
|
|
|
|
+ .id).includes(i
|
|
|
|
+ .id)) {
|
|
curResourceArr.push({
|
|
curResourceArr.push({
|
|
type: 'item',
|
|
type: 'item',
|
|
title: i.question,
|
|
title: i.question,
|
|
id: i.id,
|
|
id: i.id,
|
|
- code: i.code,
|
|
|
|
- scope: i.scope,
|
|
|
|
- cntr: i.scope === 'school' ? this.$store.state.userInfo
|
|
|
|
- .schoolCode : this
|
|
|
|
- .$store.state
|
|
|
|
- .userInfo.TEAMModelId,
|
|
|
|
- link: i.blob
|
|
|
|
|
|
+ code: 'Item-' + this.curCode,
|
|
|
|
+ scope: this.curScope,
|
|
|
|
+ cntr: this.curCode,
|
|
|
|
+ link: `/syllabus/${i.id}/${i.id}.json`
|
|
})
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
r(200)
|
|
r(200)
|
|
- }
|
|
|
|
|
|
+ }).catch(err => {
|
|
|
|
+ this.$Message.error(err)
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ /* 暂时取消入库操作 全部保存到syllabus目录下*/
|
|
|
|
+ // 拿到关联的个人试题和校本试题
|
|
|
|
+ // let privateItems = list.filter(i => i.scope === 'private')
|
|
|
|
+ // let schoolItems = list.filter(i => i.scope === 'school')
|
|
|
|
+ // // 如果是在校本课纲关联的个人试题 则需要进行入库操作
|
|
|
|
+ // if (this.isSchool && privateItems.length) {
|
|
|
|
+ // let isSaveToItem = await this.doConfirm()
|
|
|
|
+ // let promiseArr = []
|
|
|
|
+ // // 个人试题入库前需要补充必要的学段科目年级信息
|
|
|
|
+ // privateItems.forEach(pItem => {
|
|
|
|
+ // pItem.periodId = this.periodList[this.currentPeriodIndex].id
|
|
|
|
+ // pItem.subjectId = this.subjectList[this.activeSubjectIndex].id
|
|
|
|
+ // pItem.gradeIds = [this.curVolume.gradeId + '']
|
|
|
|
+ // pItem.scope = 'school'
|
|
|
|
+ // pItem.code = this.$store.state.userInfo.schoolCode
|
|
|
|
+ // promiseArr.push(this.saveItemToBlob(pItem, true, isSaveToItem))
|
|
|
|
+ // })
|
|
|
|
+ // 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
|
|
|
|
+ // .schoolCode,
|
|
|
|
+ // scope: 'school',
|
|
|
|
+ // cntr: this.$store.state.userInfo.schoolCode,
|
|
|
|
+ // link: isSaveToItem ? i.blob : `/syllabus/${i.id}/${i.id}.json`
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // r(200)
|
|
|
|
+ // }).catch(err => {
|
|
|
|
+ // this.$Message.error(err)
|
|
|
|
+ // })
|
|
|
|
+ // } else if (!this.isSchool && schoolItems.length) {
|
|
|
|
+ // let promiseArr = []
|
|
|
|
+ // let isSaveToItem = await this.doConfirm()
|
|
|
|
+ // // 个人试题入库前需要补充必要的学段科目年级信息
|
|
|
|
+ // schoolItems.forEach(pItem => {
|
|
|
|
+ // pItem.periodId = null
|
|
|
|
+ // pItem.subjectId = null
|
|
|
|
+ // pItem.gradeIds = null
|
|
|
|
+ // pItem.scope = 'private'
|
|
|
|
+ // pItem.code = this.curTeammodelId
|
|
|
|
+ // promiseArr.push(this.saveItemToBlob(pItem, false, isSaveToItem))
|
|
|
|
+ // })
|
|
|
|
+ // 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.curTeammodelId,
|
|
|
|
+ // link: isSaveToItem ? i.blob : `/syllabus/${i.id}/${i.id}.json`
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // 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({
|
|
|
|
+ // type: 'item',
|
|
|
|
+ // title: i.question,
|
|
|
|
+ // id: i.id,
|
|
|
|
+ // code: i.code,
|
|
|
|
+ // scope: i.scope,
|
|
|
|
+ // cntr: i.scope === 'school' ? this.$store.state.userInfo
|
|
|
|
+ // .schoolCode : this
|
|
|
|
+ // .$store.state
|
|
|
|
+ // .userInfo.TEAMModelId,
|
|
|
|
+ // link: i.blob
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // r(200)
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ },
|
|
|
|
+ /* 入库前的确认操作 */
|
|
|
|
+ doConfirm(){
|
|
|
|
+ return new Promise((r,j) => {
|
|
|
|
+ this.$Modal.confirm({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: `关联的试题试卷是否要同步到您的${this.isSchool ? '校本资源库' : '个人资源库'}?`,
|
|
|
|
+ onOk: async () => {
|
|
|
|
+ r(true)
|
|
|
|
+ },
|
|
|
|
+ onCancel: () => {
|
|
|
|
+ r(false)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ })
|
|
},
|
|
},
|
|
/* 判断试卷名称是否已存在校本库中 */
|
|
/* 判断试卷名称是否已存在校本库中 */
|
|
getSchoolPaperList() {
|
|
getSchoolPaperList() {
|
|
@@ -1295,28 +1348,23 @@
|
|
/* 将个人试卷导入到校本试卷库中 */
|
|
/* 将个人试卷导入到校本试卷库中 */
|
|
savePaperToSchoolBlob(paper, scoring, isUpdate) {
|
|
savePaperToSchoolBlob(paper, scoring, isUpdate) {
|
|
return new Promise(async (r, j) => {
|
|
return new Promise(async (r, j) => {
|
|
- let path = 'paper/' + paper.name + '/'
|
|
|
|
|
|
+ let path = 'syllabus/' + paper.name + '/'
|
|
|
|
+ let sourcePath = 'paper/' + paper.name
|
|
let privateSas = await this.$tools.getPrivateSas()
|
|
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 schoolSas = await this.$tools.getSchoolSas()
|
|
|
|
+ let schoolBlobTool = new BlobTool(schoolSas.url, schoolSas.name, schoolSas.sas,
|
|
|
|
+ 'school')
|
|
|
|
+ let toClient = this.isSchool ? schoolBlobTool : privateBlobTool
|
|
|
|
+ let fromClient = paper.scope === 'private' ? privateBlobTool : schoolBlobTool
|
|
|
|
+
|
|
let file = new File([JSON.stringify(paper)], "index.json", {
|
|
let file = new File([JSON.stringify(paper)], "index.json", {
|
|
type: "",
|
|
type: "",
|
|
});
|
|
});
|
|
// 先把对应试题目录下的全部复制到校本BLOB 然后再更新添加学段科目等字段后的题目Json文件
|
|
// 先把对应试题目录下的全部复制到校本BLOB 然后再更新添加学段科目等字段后的题目Json文件
|
|
- this.containerClient.copyFolder(path, path.slice(0, path.length - 1), privareBlobTool)
|
|
|
|
|
|
+ toClient.copyFolder(path, sourcePath, fromClient)
|
|
.then(async res => {
|
|
.then(async res => {
|
|
- try {
|
|
|
|
- let blobFile = await this.containerClient.upload(file, "paper/" + paper
|
|
|
|
- .name);
|
|
|
|
- if (blobFile.blob) {
|
|
|
|
- this.savePaperToCosmos(paper, scoring, isUpdate).then(result => {
|
|
|
|
- console.log(result)
|
|
|
|
- r(result)
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- } catch (e) {
|
|
|
|
- j(e)
|
|
|
|
- }
|
|
|
|
|
|
+ r(200)
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
j(err)
|
|
j(err)
|
|
})
|
|
})
|
|
@@ -1334,117 +1382,142 @@
|
|
// 拿到关联的个人试卷
|
|
// 拿到关联的个人试卷
|
|
let privatePapers = list.filter(i => i.scope === 'private')
|
|
let privatePapers = list.filter(i => i.scope === 'private')
|
|
let privateSas = await this.$tools.getPrivateSas()
|
|
let privateSas = await this.$tools.getPrivateSas()
|
|
- // 如果是在校本课纲关联的个人试卷 则需要进行入库操作
|
|
|
|
- if (this.isSchool && privatePapers.length) {
|
|
|
|
- let schoolPaperList = await this.getSchoolPaperList()
|
|
|
|
- console.log(privatePapers)
|
|
|
|
- let promiseArr = []
|
|
|
|
- privatePapers.forEach(async paper => {
|
|
|
|
- if (schoolPaperList.map(i => i.name).includes(paper.name)) {
|
|
|
|
- this.$Modal.confirm({
|
|
|
|
- title: '提示',
|
|
|
|
- content: this.$t('syllabus.copyTip1') + paper
|
|
|
|
- .name +
|
|
|
|
- this.$t('syllabus.copyTip2'),
|
|
|
|
- onOk: async () => {
|
|
|
|
- // 继续进行操作完成试卷覆盖
|
|
|
|
- // 拿到试卷的index.json 先完善学段科目年级信息后 去进行上传覆盖操作
|
|
|
|
- let indexJsonFile = await this.$tools
|
|
|
|
- .getFile(this.$evTools.getBlobHost() +
|
|
|
|
- '/' + paper.code.replace('Paper-',
|
|
|
|
- '') + paper.blob +
|
|
|
|
- '/index.json' + privateSas.sas)
|
|
|
|
- let paperIndexJson = JSON.parse(
|
|
|
|
- indexJsonFile)
|
|
|
|
- paperIndexJson.periodId = this.periodList[
|
|
|
|
- this.currentPeriodIndex].id
|
|
|
|
- paperIndexJson.subjectId = this
|
|
|
|
- .subjectList[this.activeSubjectIndex]
|
|
|
|
- .id
|
|
|
|
- paperIndexJson.subjectName = this
|
|
|
|
- .subjectList[this.activeSubjectIndex]
|
|
|
|
- .name
|
|
|
|
- paperIndexJson.gradeIds = [this.curVolume
|
|
|
|
- .gradeId + ''
|
|
|
|
- ]
|
|
|
|
- paperIndexJson.scope = 'school'
|
|
|
|
- paperIndexJson.code = this.$store.state
|
|
|
|
- .userInfo.schoolCode
|
|
|
|
- console.log(paperIndexJson)
|
|
|
|
- promiseArr.push(this.savePaperToSchoolBlob(
|
|
|
|
- paperIndexJson, paper.scoring,
|
|
|
|
- true))
|
|
|
|
- },
|
|
|
|
- onCancel: () => {
|
|
|
|
- // 取消则无法关联当前试卷到节点
|
|
|
|
- curResourceArr.splice(curResourceArr.map(
|
|
|
|
- i => i.id).indexOf(paper.id),
|
|
|
|
- 1)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- // 拿到试卷的index.json 先完善学段科目年级信息后 去进行上传覆盖操作
|
|
|
|
- let indexJsonFile = await this.$tools.getFile(this.$evTools
|
|
|
|
- .getBlobHost() + '/' + paper.code.replace('Paper-',
|
|
|
|
- '') + paper.blob + '/index.json' + privateSas.sas)
|
|
|
|
- let paperIndexJson = JSON.parse(indexJsonFile)
|
|
|
|
- paperIndexJson.periodId = this.periodList[this
|
|
|
|
- .currentPeriodIndex].id
|
|
|
|
- paperIndexJson.subjectId = this.subjectList[this
|
|
|
|
- .activeSubjectIndex].id
|
|
|
|
- paperIndexJson.subjectName = this.subjectList[this
|
|
|
|
- .activeSubjectIndex].name
|
|
|
|
- paperIndexJson.gradeIds = [this.curVolume.gradeId + '']
|
|
|
|
- paperIndexJson.scope = 'school'
|
|
|
|
- paperIndexJson.code = this.$store.state.userInfo.schoolCode
|
|
|
|
- console.log(paperIndexJson)
|
|
|
|
- promiseArr.push(this.savePaperToSchoolBlob(paperIndexJson,
|
|
|
|
- paper.scoring))
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- })
|
|
|
|
- Promise.all(promiseArr).then(result => {
|
|
|
|
- console.log(result)
|
|
|
|
- list.forEach(i => {
|
|
|
|
- if (!curResourceArr.filter(j => j.type === 'paper').map(
|
|
|
|
- k => k.id).includes(i.id)) {
|
|
|
|
- curResourceArr.push({
|
|
|
|
- type: 'paper',
|
|
|
|
- title: i.name,
|
|
|
|
- id: i.id,
|
|
|
|
- code: 'Paper-' + this.$store.state.userInfo
|
|
|
|
- .schoolCode,
|
|
|
|
- scope: 'school',
|
|
|
|
- cntr: this.$store.state.userInfo
|
|
|
|
- .schoolCode,
|
|
|
|
- link: i.blob
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- r(200)
|
|
|
|
- }).catch(err => {
|
|
|
|
- j(err)
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
|
|
+ let promiseArr = []
|
|
|
|
+ list.forEach(paper => {
|
|
|
|
+ promiseArr.push(this.savePaperToSchoolBlob(paper, paper.scoring,true))
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ Promise.all(promiseArr).then(result => {
|
|
|
|
+ console.log(result)
|
|
list.forEach(i => {
|
|
list.forEach(i => {
|
|
- if (!curResourceArr.filter(j => j.type === 'paper').map(k => k.id)
|
|
|
|
- .includes(i.id)) {
|
|
|
|
|
|
+ if (!curResourceArr.filter(j => j.type === 'paper').map(
|
|
|
|
+ k => k.id).includes(i.id)) {
|
|
curResourceArr.push({
|
|
curResourceArr.push({
|
|
type: 'paper',
|
|
type: 'paper',
|
|
title: i.name,
|
|
title: i.name,
|
|
id: i.id,
|
|
id: i.id,
|
|
- code: i.code,
|
|
|
|
- scope: i.scope,
|
|
|
|
- cntr: i.scope === 'school' ? this.$store.state.userInfo
|
|
|
|
- .schoolCode : this
|
|
|
|
- .$store.state
|
|
|
|
- .userInfo.TEAMModelId,
|
|
|
|
- link: i.blob
|
|
|
|
|
|
+ code: 'Paper-' + this.curCode,
|
|
|
|
+ scope: this.curScope,
|
|
|
|
+ cntr: this.curCode,
|
|
|
|
+ link: `/syllabus/${i.name}`
|
|
})
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
r(200)
|
|
r(200)
|
|
- }
|
|
|
|
|
|
+ }).catch(err => {
|
|
|
|
+ j(err)
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ /* =================暂时不做入库操作======================================== */
|
|
|
|
+ // 如果是在校本课纲关联的个人试卷 则需要进行入库操作
|
|
|
|
+ // if (this.isSchool && privatePapers.length) {
|
|
|
|
+ // let schoolPaperList = await this.getSchoolPaperList()
|
|
|
|
+ // console.log(privatePapers)
|
|
|
|
+ // let promiseArr = []
|
|
|
|
+ // privatePapers.forEach(async paper => {
|
|
|
|
+ // if (schoolPaperList.map(i => i.name).includes(paper.name)) {
|
|
|
|
+ // this.$Modal.confirm({
|
|
|
|
+ // title: '提示',
|
|
|
|
+ // content: this.$t('syllabus.copyTip1') + paper
|
|
|
|
+ // .name +
|
|
|
|
+ // this.$t('syllabus.copyTip2'),
|
|
|
|
+ // onOk: async () => {
|
|
|
|
+ // // 继续进行操作完成试卷覆盖
|
|
|
|
+ // // 拿到试卷的index.json 先完善学段科目年级信息后 去进行上传覆盖操作
|
|
|
|
+ // let indexJsonFile = await this.$tools
|
|
|
|
+ // .getFile(this.$evTools.getBlobHost() +
|
|
|
|
+ // '/' + paper.code.replace('Paper-',
|
|
|
|
+ // '') + paper.blob +
|
|
|
|
+ // '/index.json' + privateSas.sas)
|
|
|
|
+ // let paperIndexJson = JSON.parse(
|
|
|
|
+ // indexJsonFile)
|
|
|
|
+ // paperIndexJson.periodId = this.periodList[
|
|
|
|
+ // this.currentPeriodIndex].id
|
|
|
|
+ // paperIndexJson.subjectId = this
|
|
|
|
+ // .subjectList[this.activeSubjectIndex]
|
|
|
|
+ // .id
|
|
|
|
+ // paperIndexJson.subjectName = this
|
|
|
|
+ // .subjectList[this.activeSubjectIndex]
|
|
|
|
+ // .name
|
|
|
|
+ // paperIndexJson.gradeIds = [this.curVolume
|
|
|
|
+ // .gradeId + ''
|
|
|
|
+ // ]
|
|
|
|
+ // paperIndexJson.scope = 'school'
|
|
|
|
+ // paperIndexJson.code = this.$store.state
|
|
|
|
+ // .userInfo.schoolCode
|
|
|
|
+ // console.log(paperIndexJson)
|
|
|
|
+ // promiseArr.push(this.savePaperToSchoolBlob(
|
|
|
|
+ // paperIndexJson, paper.scoring,
|
|
|
|
+ // true))
|
|
|
|
+ // },
|
|
|
|
+ // onCancel: () => {
|
|
|
|
+ // // 取消则无法关联当前试卷到节点
|
|
|
|
+ // curResourceArr.splice(curResourceArr.map(
|
|
|
|
+ // i => i.id).indexOf(paper.id),
|
|
|
|
+ // 1)
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // } else {
|
|
|
|
+ // // 拿到试卷的index.json 先完善学段科目年级信息后 去进行上传覆盖操作
|
|
|
|
+ // let indexJsonFile = await this.$tools.getFile(this.$evTools
|
|
|
|
+ // .getBlobHost() + '/' + paper.code.replace('Paper-',
|
|
|
|
+ // '') + paper.blob + '/index.json' + privateSas.sas)
|
|
|
|
+ // let paperIndexJson = JSON.parse(indexJsonFile)
|
|
|
|
+ // paperIndexJson.periodId = this.periodList[this
|
|
|
|
+ // .currentPeriodIndex].id
|
|
|
|
+ // paperIndexJson.subjectId = this.subjectList[this
|
|
|
|
+ // .activeSubjectIndex].id
|
|
|
|
+ // paperIndexJson.subjectName = this.subjectList[this
|
|
|
|
+ // .activeSubjectIndex].name
|
|
|
|
+ // paperIndexJson.gradeIds = [this.curVolume.gradeId + '']
|
|
|
|
+ // paperIndexJson.scope = 'school'
|
|
|
|
+ // paperIndexJson.code = this.$store.state.userInfo.schoolCode
|
|
|
|
+ // console.log(paperIndexJson)
|
|
|
|
+ // promiseArr.push(this.savePaperToSchoolBlob(paperIndexJson,
|
|
|
|
+ // paper.scoring))
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // })
|
|
|
|
+ // Promise.all(promiseArr).then(result => {
|
|
|
|
+ // console.log(result)
|
|
|
|
+ // list.forEach(i => {
|
|
|
|
+ // if (!curResourceArr.filter(j => j.type === 'paper').map(
|
|
|
|
+ // k => k.id).includes(i.id)) {
|
|
|
|
+ // curResourceArr.push({
|
|
|
|
+ // type: 'paper',
|
|
|
|
+ // title: i.name,
|
|
|
|
+ // id: i.id,
|
|
|
|
+ // code: 'Paper-' + this.curCode,
|
|
|
|
+ // scope: 'school',
|
|
|
|
+ // cntr: this.curCode,
|
|
|
|
+ // link: i.blob
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // r(200)
|
|
|
|
+ // }).catch(err => {
|
|
|
|
+ // j(err)
|
|
|
|
+ // })
|
|
|
|
+ // } else {
|
|
|
|
+ // list.forEach(i => {
|
|
|
|
+ // if (!curResourceArr.filter(j => j.type === 'paper').map(k => k.id)
|
|
|
|
+ // .includes(i.id)) {
|
|
|
|
+ // curResourceArr.push({
|
|
|
|
+ // type: 'paper',
|
|
|
|
+ // title: i.name,
|
|
|
|
+ // id: i.id,
|
|
|
|
+ // code: i.code,
|
|
|
|
+ // scope: i.scope,
|
|
|
|
+ // cntr: i.scope === 'school' ? this.$store.state.userInfo
|
|
|
|
+ // .schoolCode : this
|
|
|
|
+ // .$store.state
|
|
|
|
+ // .userInfo.TEAMModelId,
|
|
|
|
+ // link: i.blob
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // r(200)
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
|
|
|
|
})
|
|
})
|