|
@@ -58,7 +58,7 @@
|
|
|
<div v-for="(volume,volumeIndex) in volumeList" :key="volume.id"
|
|
|
:class="['volume-item',activeVolumeIndex === volumeIndex ? 'volume-active' : '']"
|
|
|
@click="onVolumeClick(volume,volumeIndex)">
|
|
|
- <p class="volume-item-name">{{ volume.name }} <span
|
|
|
+ <p class="volume-item-name">{{ volume.name }}<span
|
|
|
class="status-idDel status-coedit"
|
|
|
v-if="hasVolumeAuth(volume.auth) && isSchool">{{ $t('syllabus.canEdit') }}</span>
|
|
|
</p>
|
|
@@ -547,7 +547,7 @@
|
|
|
"data": this.volumeList.map((i, index) => {
|
|
|
return {
|
|
|
key: i.id,
|
|
|
- value: index
|
|
|
+ value: this.volumeList.length - index
|
|
|
}
|
|
|
})
|
|
|
}).then(res => {
|
|
@@ -664,7 +664,7 @@
|
|
|
this.$api.syllabus.FindVolumes(findParams).then(res => {
|
|
|
if (!res.error) {
|
|
|
this.isLoading = false
|
|
|
- this.volumeList = res.volumes
|
|
|
+ this.volumeList = this.sortByOrderAndTime(res.volumes)
|
|
|
this.originVolumeList = JSON.parse(JSON.stringify(this.volumeList))
|
|
|
this.myVolumeList = JSON.parse(JSON.stringify(this.volumeList))
|
|
|
let activeIndex = this.activeVolumeIndex || 0
|
|
@@ -677,6 +677,25 @@
|
|
|
this.$Message.error(err);
|
|
|
})
|
|
|
},
|
|
|
+ /* 先按照order排序再按照新建时间排序 */
|
|
|
+ sortByOrderAndTime(arr){
|
|
|
+ arr.sort((a,b) => {
|
|
|
+ if(b.order > a.order){
|
|
|
+ return 1
|
|
|
+ }
|
|
|
+ if(b.order < a.order){
|
|
|
+ return -1
|
|
|
+ }
|
|
|
+ if(b.order === a.order){
|
|
|
+ if(b.createTime > a.createTime){
|
|
|
+ return 1
|
|
|
+ }else{
|
|
|
+ return -1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return arr
|
|
|
+ },
|
|
|
/* 获取分享来的册别列表 */
|
|
|
getShareVolumeList(needRefresh) {
|
|
|
this.$api.syllabus.FindShare({
|
|
@@ -1555,50 +1574,73 @@
|
|
|
console.log(isSaveToItem)
|
|
|
let targetPrefix = isSaveToItem ? 'item/' : `syllabus/${this.curNode.id}/`
|
|
|
let sourcePrefix = 'item/'
|
|
|
-
|
|
|
- let fn = async (pItem) => {
|
|
|
- let targetPath = targetPrefix + pItem.id + '/'
|
|
|
- let sourcePath = sourcePrefix + pItem.id
|
|
|
- let privateSas = await this.$tools.getPrivateSas()
|
|
|
- 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 = pItem.scope === 'private' ? privateBlobTool : schoolBlobTool
|
|
|
- const itemJsonFile = await this.$evTools.createBlobItem(pItem);
|
|
|
- let file = new File([JSON.stringify(itemJsonFile)], pItem.id + ".json", {
|
|
|
- type: "",
|
|
|
- });
|
|
|
- // 先把对应试题目录下的全部复制到校本BLOB 然后再更新添加学段科目等字段后的题目Json文件
|
|
|
- toClient.copyFolder(targetPath, sourcePath, fromClient).then(async res => {
|
|
|
- try {
|
|
|
- let blobFile = await toClient.upload(file, targetPrefix + pItem.id);
|
|
|
- if (blobFile.blob) {
|
|
|
- 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'
|
|
|
- })
|
|
|
+ // 可能是综合题 则需要对小题进行批量处理
|
|
|
+ let fn = async (pItem,pId) => {
|
|
|
+ return new Promise(async (r2,j2) => {
|
|
|
+ console.log(pItem)
|
|
|
+ // 判断是否是小题 如果是小题 则保存在大题的目录下
|
|
|
+ let targetPath = pId ? `syllabus/${this.curNode.id}/${pId}/` : targetPrefix + pItem.id + '/'
|
|
|
+ let sourcePath = sourcePrefix + pItem.id
|
|
|
+ let privateSas = await this.$tools.getPrivateSas()
|
|
|
+ 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 = pItem.scope === 'private' ? privateBlobTool : schoolBlobTool
|
|
|
+ const itemJsonFile = await this.$evTools.createBlobItem(pItem);
|
|
|
+ let file = new File([JSON.stringify(itemJsonFile)], pItem.id + ".json", {
|
|
|
+ type: "",
|
|
|
+ });
|
|
|
+ // 先把对应试题目录下的全部复制到校本BLOB 然后再更新添加学段科目等字段后的题目Json文件
|
|
|
+ toClient.copyFolder(targetPath, sourcePath, fromClient).then(async res => {
|
|
|
+ try {
|
|
|
+ let blobFile = await toClient.upload(file, pId ? `syllabus/${this.curNode.id}/${pId}` : targetPrefix + pItem.id);
|
|
|
+ if (blobFile.blob) {
|
|
|
+ if (isSaveToItem) {
|
|
|
+ this.saveExercise(pItem).then(result => {
|
|
|
+ console.log(result)
|
|
|
+ r2(result)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ r2({
|
|
|
+ id: pItem.id,
|
|
|
+ question: pItem.question,
|
|
|
+ blob: '/' + targetPath + pItem.id + '.json'
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ j2(e)
|
|
|
}
|
|
|
- } catch (e) {
|
|
|
- console.log(e)
|
|
|
- j(e)
|
|
|
- }
|
|
|
- }).catch(err => {
|
|
|
- j(err)
|
|
|
+ }).catch(err => {
|
|
|
+ j2(err)
|
|
|
+ })
|
|
|
})
|
|
|
}
|
|
|
- fn(exerciseItem)
|
|
|
|
|
|
+ let promiseArr = []
|
|
|
+ if(exerciseItem.children.length){
|
|
|
+ console.log(exerciseItem.children.map(i => i.id))
|
|
|
+ exerciseItem.children.forEach(i => {
|
|
|
+ promiseArr.push(fn(i,exerciseItem.id))
|
|
|
+ })
|
|
|
+ }
|
|
|
+ promiseArr.push(fn(exerciseItem))
|
|
|
+
|
|
|
+ Promise.all(promiseArr).then(result => {
|
|
|
+ console.log(result)
|
|
|
+ r({
|
|
|
+ id: exerciseItem.id,
|
|
|
+ question: exerciseItem.question,
|
|
|
+ blob: '/' + targetPrefix + exerciseItem.id + '/' + exerciseItem.id + '.json'
|
|
|
+ })
|
|
|
+ }).catch(e => {
|
|
|
+ console.log(e)
|
|
|
+ j(e)
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
/* 获取关联的试题数据 */
|
|
@@ -1998,7 +2040,7 @@
|
|
|
// 如果不是当前用户自己的试题 则需要去获取他人BLOB内部的试题JSON文件
|
|
|
if (tmdId !== this.curTeammodelId) {
|
|
|
this.isFullList = 'true'
|
|
|
- let fullItemJson = await this.$evTools.getFullItemByTmdId(tmdId, item.link)
|
|
|
+ let fullItemJson = await this.$evTools.getFullItemByTmdId(tmdId, item.link, true)
|
|
|
console.log(fullItemJson);
|
|
|
this.questionList = [fullItemJson]
|
|
|
} else {
|
|
@@ -2204,6 +2246,8 @@
|
|
|
addVolumeParams.syllabusIds = this.allChapterIds || []
|
|
|
addVolumeParams.creatorId = this.curVolume.creatorId
|
|
|
addVolumeParams.creatorName = this.curVolume.creatorName
|
|
|
+ }else{
|
|
|
+ addVolumeParams.order = this.volumeList.length + 1
|
|
|
}
|
|
|
if (this.isSaveSyllabus) {
|
|
|
addVolumeParams = this.curVolume
|