|
@@ -53,10 +53,10 @@
|
|
|
<span>{{ getSemesterName(volume.semesterId) }}</span>
|
|
|
</p>
|
|
|
<p class="volume-item-info" v-if="inShareView">
|
|
|
- <span style="display: flex;align-items: center;">
|
|
|
+ <!-- <span style="display: flex;align-items: center;">
|
|
|
<Icon type="ios-remove-circle-outline" style="font-weight: bold;margin-right: 5px;"/>
|
|
|
忽略该分享
|
|
|
- </span>
|
|
|
+ </span> -->
|
|
|
<!-- <span class="volume-btn-agree" @click="onAgreeShare(volume,'agree')">
|
|
|
<Icon type="md-checkmark-circle-outline" size="20" color="#27c684" />
|
|
|
<span>接受</span>
|
|
@@ -91,7 +91,7 @@
|
|
|
<span class="syllabus-content-header-tools">
|
|
|
<!-- <Icon type="md-add" @click="onAddResource" v-if="curNode.id"/> -->
|
|
|
<Dropdown @on-click="onAddResource"
|
|
|
- v-if="curNode.id && (hasSyllabusAuth || hasEditAuth(curNode))">
|
|
|
+ v-if="curNode.id && (hasSyllabusAuth || hasEditAuth(curNode)) && !inShareView">
|
|
|
<a href="javascript:void(0)" style="color: #ddd;">
|
|
|
添加资源
|
|
|
<Icon type="ios-arrow-down"></Icon>
|
|
@@ -127,7 +127,7 @@
|
|
|
<img src="../../assets/source/zip.png" v-else-if="item.type === 'res'" />
|
|
|
<img src="../../assets/source/image.png" v-else-if="item.type === 'thum'" />
|
|
|
<img src="../../assets/source/unknow.png" v-else="item.type === 'other'" />
|
|
|
- <span v-html="getSimpleText(item.title)" style="max-width: 70%;"></span>
|
|
|
+ <span v-html="item.title" style="max-width: 70%;"></span>
|
|
|
<div class="node-resource-tools">
|
|
|
<div class="node-resource-tool" @click="onPreview(item)">
|
|
|
<Icon type="md-eye" />
|
|
@@ -242,18 +242,18 @@
|
|
|
<div v-if="previewStatus" class="image-viewer">
|
|
|
<div style="width:fit-content;position:relative;margin:auto;">
|
|
|
<Icon type="md-close" class="close-icon" @click="previewStatus = false" />
|
|
|
- <video v-if="previewFile.type == 'video'" id="previewVideo" :src="previewFile.link[0]" width="870"
|
|
|
+ <video v-if="previewFile.type == 'video'" id="previewVideo" :src="previewFile.link" width="870"
|
|
|
controls="controls" style="max-height: 800px;">
|
|
|
{{$t('teachContent.tips8')}}
|
|
|
</video>
|
|
|
<audio v-else-if="previewFile.type == 'audio'" controls>
|
|
|
- <source :src="previewFile.link[0]">
|
|
|
+ <source :src="previewFile.link">
|
|
|
{{$t('teachContent.notAudio')}}
|
|
|
</audio>
|
|
|
- <img v-else-if="previewFile.type == 'image'" :src="previewFile.link[0]"
|
|
|
+ <img v-else-if="previewFile.type == 'image'" :src="previewFile.link"
|
|
|
style="border-radius: 5px;max-height: 800px;max-width:870px;" />
|
|
|
- <!-- <embed v-else-if="previewFile.type == 'doc'" :src="previewFile.link[0]" width="870" height="720" /> -->
|
|
|
- <iframe v-else :src="'https://view.officeapps.live.com/op/view.aspx?src=' + previewFile.link[0]"
|
|
|
+ <!-- <embed v-else-if="previewFile.type == 'doc'" :src="previewFile.link" width="870" height="720" /> -->
|
|
|
+ <iframe v-else :src="'https://view.officeapps.live.com/op/view.aspx?src=' + previewFile.link"
|
|
|
width='870' height='700' frameborder='1'></iframe>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -307,6 +307,7 @@
|
|
|
semesterList: [],
|
|
|
volumeList: [],
|
|
|
originVolumeList: [],
|
|
|
+ myVolumeList:[],
|
|
|
questionList: [],
|
|
|
allChapterIds: [],
|
|
|
schoolInfo: null,
|
|
@@ -346,7 +347,8 @@
|
|
|
"rnodes": []
|
|
|
},
|
|
|
modifyIdArr: [],
|
|
|
- flatArr: []
|
|
|
+ flatArr: [],
|
|
|
+ isSaveSyllabus:false,
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -378,9 +380,15 @@
|
|
|
});
|
|
|
},
|
|
|
/* 提取富文本内容中的文本 */
|
|
|
- getSimpleText(html) {
|
|
|
- html = html || '';
|
|
|
- return html.replace(/<[^>]+>/g, ""); //去掉所有的html标记
|
|
|
+ async getItemSimpleText(item) {
|
|
|
+ try{
|
|
|
+ let sas = await this.$evTools.getBlobPrivateSas(item.cntr)
|
|
|
+ let indexJsonFile = await this.$tools.getFile(this.$evTools.getBlobHost() + '/' + item.cntr + item.link + sas)
|
|
|
+ let itemJson = JSON.parse(indexJsonFile)
|
|
|
+ return itemJson.item[0].question.replace(/<[^>]+>/g, "") //去掉所有的html标记
|
|
|
+ }catch(e){
|
|
|
+ this.$Message.error(e)
|
|
|
+ }
|
|
|
},
|
|
|
/* 切换学段的操作 */
|
|
|
onPeriodChange(val) {
|
|
@@ -398,12 +406,22 @@
|
|
|
/* 切换个人创建的课纲和他人分享的课纲 */
|
|
|
onChangeSyllabusTab(type) {
|
|
|
this.activeTab = type
|
|
|
- type === 'fromCreate' ? this.getVolumeList() : this.getShareVolumeList()
|
|
|
+ this.treeOrigin = []
|
|
|
+ this.curNode = {
|
|
|
+ id: '',
|
|
|
+ rnodes: []
|
|
|
+ }
|
|
|
+ this.hasModify = false
|
|
|
+ type === 'fromCreate' ? this.getVolumeList(true) : this.getShareVolumeList(true)
|
|
|
},
|
|
|
/* 获取册别列表 */
|
|
|
- getVolumeList() {
|
|
|
+ getVolumeList(needRefresh) {
|
|
|
this.isLoading = true
|
|
|
this.treeOrigin = []
|
|
|
+ this.curNode = {
|
|
|
+ id: '',
|
|
|
+ rnodes: []
|
|
|
+ }
|
|
|
let findParams = {
|
|
|
"periodId": this.isSchool ? this.periodList[this.currentPeriodIndex].id : '',
|
|
|
"subjectId": this.isSchool ? this.subjectList[this.activeSubjectIndex].id : '',
|
|
@@ -417,9 +435,10 @@
|
|
|
this.isLoading = false
|
|
|
this.volumeList = res.volumes.reverse()
|
|
|
this.originVolumeList = JSON.parse(JSON.stringify(this.volumeList))
|
|
|
+ this.myVolumeList = JSON.parse(JSON.stringify(this.volumeList))
|
|
|
let activeIndex = this.isEditVolume ? this.activeVolumeIndex : 0
|
|
|
// this.isEditVolume = false
|
|
|
- res.volumes.length && this.onVolumeClick(res.volumes[activeIndex], activeIndex)
|
|
|
+ res.volumes.length && this.onVolumeClick(res.volumes[activeIndex], activeIndex, needRefresh)
|
|
|
} else {
|
|
|
this.$Message.warning(res.error);
|
|
|
}
|
|
@@ -428,7 +447,7 @@
|
|
|
})
|
|
|
},
|
|
|
/* 获取分享来的册别列表 */
|
|
|
- getShareVolumeList() {
|
|
|
+ getShareVolumeList(needRefresh) {
|
|
|
this.$api.syllabus.FindShare({
|
|
|
"code": this.$store.state.userInfo.TEAMModelId,
|
|
|
"type": "share"
|
|
@@ -448,10 +467,10 @@
|
|
|
status: 1
|
|
|
}
|
|
|
})
|
|
|
- this.volumeList = shareList
|
|
|
+ this.volumeList = shareList.reverse()
|
|
|
this.originVolumeList = JSON.parse(JSON.stringify(this.volumeList))
|
|
|
let activeIndex = this.isEditVolume ? this.activeVolumeIndex : 0
|
|
|
- shareList.length && this.onVolumeClick(shareList[activeIndex], activeIndex)
|
|
|
+ shareList.length && this.onVolumeClick(shareList[activeIndex], activeIndex, needRefresh)
|
|
|
} else {
|
|
|
this.volumeList = []
|
|
|
this.originVolumeList = []
|
|
@@ -466,18 +485,12 @@
|
|
|
},
|
|
|
/* 是否接受分享的课纲 */
|
|
|
onAgreeShare(volume,type){
|
|
|
- // this.$api.syllabus.ShareAgree({
|
|
|
- // code:volume.code,
|
|
|
- // id:volume.id,
|
|
|
- // agree:type === 'agree' ? 3 : 4
|
|
|
- // }).then(res => {
|
|
|
-
|
|
|
- // })
|
|
|
+ console.log(volume)
|
|
|
},
|
|
|
/* 点击某个册别 */
|
|
|
- onVolumeClick(volume, volumeIndex) {
|
|
|
+ onVolumeClick(volume, volumeIndex, needRefresh) {
|
|
|
console.log(volume)
|
|
|
- if (!volume || (volume.id === this.curVolume.id && !this.isEditVolume)) return
|
|
|
+ if (!volume || (volume.id === this.curVolume.id && !this.isEditVolume && !needRefresh)) return
|
|
|
this.isLoading = true
|
|
|
this.curVolume = volume
|
|
|
this.allChapterIds = volume.syllabusIds || []
|
|
@@ -497,7 +510,7 @@
|
|
|
},
|
|
|
/* 复制副本 */
|
|
|
doCopyVolume(){
|
|
|
-
|
|
|
+ console.log('xxx')
|
|
|
},
|
|
|
/* 搜索册别 */
|
|
|
doSearchVolume() {
|
|
@@ -639,7 +652,7 @@
|
|
|
},
|
|
|
/* 存储变更保存最新课纲数据 */
|
|
|
onSaveSyllabus() {
|
|
|
- this.isEditVolume = true
|
|
|
+ this.isSaveSyllabus = true
|
|
|
// 拿到有修改变动的章节ID集合
|
|
|
let modifyIdArr = [...new Set(this.modifyIdArr)].filter(i => i !== this.curVolume.id)
|
|
|
console.log(modifyIdArr)
|
|
@@ -669,8 +682,21 @@
|
|
|
/* 点击某个节点 */
|
|
|
onNodeClick(data) {
|
|
|
this.curChapter = this.getChapterByNode(data.node)
|
|
|
- console.log(this.curChapter)
|
|
|
- this.curNode = data.data
|
|
|
+ // 如果当前节点有关联试题资源 则需要去拿到试题完整信息 来给title赋值 保证为最新数据
|
|
|
+ if(data.data.rnodes.length){
|
|
|
+ let itemNodeArr = data.data.rnodes.filter(i => i.type === 'item')
|
|
|
+ if(itemNodeArr.length){
|
|
|
+ itemNodeArr.forEach(async item => {
|
|
|
+ item.title = await this.getItemSimpleText(item)
|
|
|
+ this.curNode = data.data
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.curNode = data.data
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.curNode = data.data
|
|
|
+ }
|
|
|
+ console.log('当前点击节点数据 ==== ',data.data.title,data.data.rnodes)
|
|
|
},
|
|
|
/* 根据节点获取它所在的章节信息 */
|
|
|
getChapterByNode(node) {
|
|
@@ -696,7 +722,7 @@
|
|
|
code: this.curCode,
|
|
|
scope: this.curScope,
|
|
|
id: this.$tools.guid(),
|
|
|
- link: [this.curLink.url],
|
|
|
+ link: this.curLink.url,
|
|
|
title: this.curLink.name,
|
|
|
type: 'link',
|
|
|
ctnr: ''
|
|
@@ -729,7 +755,7 @@
|
|
|
code: this.curCode,
|
|
|
scope: this.curScope,
|
|
|
id: this.$tools.guid(),
|
|
|
- link: [file.url],
|
|
|
+ link: file.url,
|
|
|
title: file.name,
|
|
|
type: file.type,
|
|
|
cntr: this.curCode
|
|
@@ -763,12 +789,12 @@
|
|
|
title: file.name,
|
|
|
id: this.$tools.guid(),
|
|
|
code: this.curCode,
|
|
|
- scope: file.scope,
|
|
|
- cntr: file.scope === 'school' ? this
|
|
|
+ scope: this.isSchool ? 'school' : 'private',
|
|
|
+ cntr: this.isSchool ? this
|
|
|
.$store.state.userInfo.schoolCode :
|
|
|
this.$store.state
|
|
|
.userInfo.TEAMModelId,
|
|
|
- link: [file.url]
|
|
|
+ link: `/syllabus/${file.name}`
|
|
|
})
|
|
|
r2(200)
|
|
|
|
|
@@ -789,11 +815,13 @@
|
|
|
|
|
|
},
|
|
|
/* 保存单个试题 */
|
|
|
- saveExercise(item) {
|
|
|
+ saveExercise(item,scope) {
|
|
|
+ console.log(item)
|
|
|
+ console.log(scope)
|
|
|
return new Promise(async (r, j) => {
|
|
|
let cosmosItem = await this.$editorTools.transBase64Src(item)
|
|
|
this.$api.newEvaluation.SaveSingleExercise({
|
|
|
- itemInfo: await this.$evTools.createCosmosItem(cosmosItem),
|
|
|
+ itemInfo: await this.$evTools.createCosmosItem(cosmosItem,scope),
|
|
|
option: "insert",
|
|
|
}).then((res) => {
|
|
|
r(res)
|
|
@@ -832,58 +860,67 @@
|
|
|
},
|
|
|
/* 获取关联的试题数据 */
|
|
|
onSelectQuestion(val) {
|
|
|
- let list = this.$refs.chooseContentRef.$refs.exListRef.selectItems
|
|
|
- if (!list.length) return
|
|
|
- let curResourceArr = this.$refs.treeRef.curData.rnodes
|
|
|
- // 拿到关联的个人试题
|
|
|
- let privateItems = list.filter(i => i.scope === 'private')
|
|
|
- // 如果是在校本课纲关联的个人试题 则需要进行入库操作
|
|
|
- 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.saveItemToSchoolBlob(pItem))
|
|
|
- })
|
|
|
- Promise.all(promiseArr).then(result => {
|
|
|
+ return new Promise((r,j) => {
|
|
|
+ let list = this.$refs.chooseContentRef.$refs.exListRef.selectItems
|
|
|
+ console.log('xxxxx',list)
|
|
|
+ if (!list.length) {
|
|
|
+ r(200)
|
|
|
+ }else{
|
|
|
+ let curResourceArr = this.$refs.treeRef.curData.rnodes
|
|
|
+ // 拿到关联的个人试题
|
|
|
+ let privateItems = list.filter(i => i.scope === 'private')
|
|
|
+ // 如果是在校本课纲关联的个人试题 则需要进行入库操作
|
|
|
+ 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.saveItemToSchoolBlob(pItem))
|
|
|
+ })
|
|
|
+ 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 {
|
|
|
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({
|
|
|
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]
|
|
|
+ code: i.code,
|
|
|
+ scope: i.scope,
|
|
|
+ cntr: i.scope === 'school' ? this.$store.state.userInfo.schoolCode : this
|
|
|
+ .$store.state
|
|
|
+ .userInfo.TEAMModelId,
|
|
|
+ link: i.blob
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
- }).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)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
|
|
|
},
|
|
|
/* 判断试卷名称是否已存在校本库中 */
|
|
@@ -957,108 +994,113 @@
|
|
|
onSelectPaper() {
|
|
|
return new Promise(async (r,j) => {
|
|
|
let list = this.$refs.chooseContentRef.$refs.paperListRef.checkedPaperList
|
|
|
- if (!list.length) return
|
|
|
- let curResourceArr = this.$refs.treeRef.curData.rnodes
|
|
|
- // 拿到关联的个人试卷
|
|
|
- let privatePapers = list.filter(i => i.scope === 'private')
|
|
|
- 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: '校本试卷库中已存在名称为' + paper.name + '的试卷,是否继续操作覆盖原试卷?',
|
|
|
- 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)
|
|
|
+ if (!list.length) {
|
|
|
+ r(200)
|
|
|
+ }else{
|
|
|
+ let curResourceArr = this.$refs.treeRef.curData.rnodes
|
|
|
+ // 拿到关联的个人试卷
|
|
|
+ let privatePapers = list.filter(i => i.scope === 'private')
|
|
|
+ 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: '校本试卷库中已存在名称为' + paper.name + '的试卷,是否继续操作覆盖原试卷?',
|
|
|
+ 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
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
- }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)
|
|
|
+ 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: 'Paper-' + this.$store.state.userInfo.schoolCode,
|
|
|
- scope: 'school',
|
|
|
- cntr:this.$store.state.userInfo.schoolCode,
|
|
|
- link: [i.blob]
|
|
|
+ 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)
|
|
|
- })
|
|
|
- }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)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
})
|
|
|
|
|
|
},
|
|
|
/* 点击确认 去获取关联的内容数据、试题试卷数据 */
|
|
|
onRelateContent() {
|
|
|
this.isRelateLoading = true
|
|
|
- let curResourceArr = this.$refs.treeRef.curData.rnodes
|
|
|
- this.onSelectFile().then(res => {
|
|
|
- this.onSelectQuestion()
|
|
|
- this.onSelectPaper().then(result => {
|
|
|
- setTimeout(() => {
|
|
|
- this.isRelateLoading = false
|
|
|
- this.isRelateContentModal = false
|
|
|
- this.hasModify = true
|
|
|
- this.modifyIdArr.push(this.curChapter.data.id)
|
|
|
- },500)
|
|
|
- })
|
|
|
+ Promise.all([this.onSelectFile(),this.onSelectQuestion(),this.onSelectPaper()]).then(result => {
|
|
|
+ console.log(result)
|
|
|
+ setTimeout(() => {
|
|
|
+ this.isRelateLoading = false
|
|
|
+ this.isRelateContentModal = false
|
|
|
+ this.hasModify = true
|
|
|
+ this.modifyIdArr.push(this.curChapter.data.id)
|
|
|
+ },500)
|
|
|
}).catch(err => {
|
|
|
+ console.log(err)
|
|
|
+ this.isRelateLoading = false
|
|
|
this.$Message.error(err)
|
|
|
})
|
|
|
},
|
|
@@ -1075,14 +1117,14 @@
|
|
|
// 如果不是当前用户自己的试题 则需要去获取他人BLOB内部的试题JSON文件
|
|
|
if (tmdId !== this.$store.state.userInfo.TEAMModelId) {
|
|
|
this.isFullList = 'true'
|
|
|
- let fullItemJson = await this.$evTools.getFullItemByTmdId(tmdId, item.link[0])
|
|
|
+ let fullItemJson = await this.$evTools.getFullItemByTmdId(tmdId, item.link)
|
|
|
this.questionList = [fullItemJson]
|
|
|
} else {
|
|
|
this.isFullList = null
|
|
|
this.questionList = [{
|
|
|
code: item.code,
|
|
|
id: item.id,
|
|
|
- blob: item.link[0],
|
|
|
+ blob: item.link,
|
|
|
scope: item.scope
|
|
|
}]
|
|
|
}
|
|
@@ -1097,13 +1139,13 @@
|
|
|
// 如果不是当前用户自己的试题 则需要去获取他人BLOB内部的试卷JSON文件
|
|
|
if (paperTmdId !== this.$store.state.userInfo.TEAMModelId) {
|
|
|
this.isFullList = 'true'
|
|
|
- fullPaper = await this.$evTools.getFullPaperByTmdId(paperTmdId, item.link[0])
|
|
|
+ fullPaper = await this.$evTools.getFullPaperByTmdId(paperTmdId, item.link)
|
|
|
} else {
|
|
|
this.isFullList = null
|
|
|
let paper = {
|
|
|
code: item.code,
|
|
|
id: item.id,
|
|
|
- blob: item.link[0],
|
|
|
+ blob: item.link,
|
|
|
scope: item.scope,
|
|
|
}
|
|
|
fullPaper = await this.$evTools.getFullPaper(paper)
|
|
@@ -1116,22 +1158,35 @@
|
|
|
this.isPreviewPaper = true
|
|
|
break;
|
|
|
case 'link':
|
|
|
- window.open(item.link[0]);
|
|
|
+ window.open(item.link);
|
|
|
break;
|
|
|
case 'doc':
|
|
|
let copyLink = JSON.parse(JSON.stringify(item.link))
|
|
|
-
|
|
|
+ let docSas = ''
|
|
|
+ if (item.code !== this.$store.state.userInfo.TEAMModelId){
|
|
|
+ docSas = await this.$evTools.getBlobPrivateSas(item.code)
|
|
|
+ }else{
|
|
|
+ docSas = sasObj.sas
|
|
|
+ }
|
|
|
+ let fullLink = this.$evTools.getBlobHost() + '/' + item.cntr + item.link + docSas
|
|
|
+ console.log(fullLink)
|
|
|
if (this.getSuffix(item.title) === 'pdf') {
|
|
|
- this.openPdf(item.link[0] + sasObj.sas, item.title)
|
|
|
- // window.open(item.link[0]+ sasObj.sas);
|
|
|
+ this.openPdf(fullLink, item.title)
|
|
|
} else {
|
|
|
this.previewFile = JSON.parse(JSON.stringify(item))
|
|
|
- this.previewFile.link[0] = escape(copyLink[0] + sasObj.sas)
|
|
|
+ this.previewFile.link = escape(fullLink)
|
|
|
this.previewStatus = true
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
- item.link[0] = item.link[0] + sasObj.sas
|
|
|
+ let fileTmdId = item.code.replace('Item-', '')
|
|
|
+ let sas = ''
|
|
|
+ if (fileTmdId !== this.$store.state.userInfo.TEAMModelId){
|
|
|
+ sas = await this.$evTools.getBlobPrivateSas(fileTmdId)
|
|
|
+ }else{
|
|
|
+ sas = sasObj.sas
|
|
|
+ }
|
|
|
+ item.link = item.link + sas
|
|
|
this.previewFile = item
|
|
|
this.previewStatus = true
|
|
|
break;
|
|
@@ -1199,6 +1254,8 @@
|
|
|
handleSubmit() {
|
|
|
return new Promise((r, j) => {
|
|
|
this.isAddLoading = true
|
|
|
+ console.log(this.addVolumeForm)
|
|
|
+ console.log(this.curVolume)
|
|
|
let addVolumeParams = {
|
|
|
"code": this.curCode,
|
|
|
"periodId": this.isSchool ? this.periodList[this.currentPeriodIndex].id : null,
|
|
@@ -1212,11 +1269,12 @@
|
|
|
"scope": this.curScope,
|
|
|
"syllabusIds": []
|
|
|
}
|
|
|
- if (this.isEditVolume && this.curVolume) {
|
|
|
+ if ((this.isEditVolume && this.curVolume) || this.isSaveSyllabus) {
|
|
|
addVolumeParams.id = this.curVolume.id
|
|
|
- addVolumeParams.name = this.curVolume.name
|
|
|
+ // addVolumeParams.name = this.curVolume.name
|
|
|
addVolumeParams.syllabusIds = this.allChapterIds || []
|
|
|
addVolumeParams.creatorId = this.curVolume.creatorId
|
|
|
+ this.isSaveSyllabus = false
|
|
|
}
|
|
|
// 发送新增或者编辑册别请求
|
|
|
this.$api.syllabus.SaveOrUpdateVolume(addVolumeParams).then(res => {
|
|
@@ -1295,7 +1353,6 @@
|
|
|
curScope() {
|
|
|
return this.isSchool ? "school" : "private"
|
|
|
},
|
|
|
-
|
|
|
getSuffix() {
|
|
|
return name => {
|
|
|
return name.substr(name.lastIndexOf(".") + 1)
|