|
@@ -19,12 +19,19 @@
|
|
|
<div class="syllabus-content">
|
|
|
<div class="syllabus-left">
|
|
|
<div class="syllabus-content-header">
|
|
|
- <span>册别清单</span>
|
|
|
- <span class="syllabus-content-header-tools">
|
|
|
- <Icon type="md-create" @click="doEditVolume" />
|
|
|
- <Icon type="md-trash" @click="doDeleteVolume" />
|
|
|
- <Icon type="md-add" @click="doAddVolume" />
|
|
|
- </span>
|
|
|
+ <div v-if="!isSearchVolume">
|
|
|
+ <span>册别清单</span>
|
|
|
+ <span class="syllabus-content-header-tools">
|
|
|
+ <Icon type="md-search" @click="doSearchVolume" />
|
|
|
+ <Icon type="md-create" @click="doEditVolume" />
|
|
|
+ <Icon type="md-trash" @click="doDeleteVolume" />
|
|
|
+ <Icon type="md-add" @click="doAddVolume" />
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div style="width: 90%;" v-else>
|
|
|
+ <Input v-model="searchVolumeVal" placeholder="输入册别名称..."
|
|
|
+ icon="ios-close-circle-outline" @on-click="onCloseSearch" @on-change="onSearchChange"/>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<vuescroll>
|
|
|
<EmptyData :top="100" v-if="!volumeList.length"></EmptyData>
|
|
@@ -60,7 +67,7 @@
|
|
|
<span>关联资源</span>
|
|
|
<span class="syllabus-content-header-tools">
|
|
|
<!-- <Icon type="md-add" @click="onAddResource" v-if="curNode.id"/> -->
|
|
|
- <Dropdown @on-click="onAddResource">
|
|
|
+ <Dropdown @on-click="onAddResource" v-if="curNode.id">
|
|
|
<a href="javascript:void(0)" style="color: #ddd;">
|
|
|
添加资源
|
|
|
<Icon type="ios-arrow-down"></Icon>
|
|
@@ -182,7 +189,7 @@
|
|
|
<Button slot="footer" @click="onRelateContent" style="margin-bottom: 20px;" class="modal-btn">确认</Button>
|
|
|
</Modal>
|
|
|
|
|
|
- <!-- 新增课纲节点弹窗 -->
|
|
|
+ <!-- 预览试题试卷弹窗 -->
|
|
|
<Modal v-model="isPreviewPaper" width="900" footer-hide class="tree-modal tree-paper-modal">
|
|
|
<div class="paper-box" v-if="previewPaper">
|
|
|
<p class="paper-title">{{ previewPaper.name }}</p>
|
|
@@ -194,7 +201,6 @@
|
|
|
<ExerciseList :propsList="questionList" ref="exList" isAnalysis></ExerciseList>
|
|
|
</Modal>
|
|
|
|
|
|
-
|
|
|
<!--文件预览-->
|
|
|
<div v-if="previewStatus" class="image-viewer">
|
|
|
<div style="width:fit-content;position:relative;margin:auto;">
|
|
@@ -218,6 +224,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import BlobTool from '@/utils/blobTool.js'
|
|
|
import Tree from "@/components/syllabus/DragTree";
|
|
|
import ChooseContent from '@/components/selflearn/NewChooseContent'
|
|
|
import ExerciseList from '@/components/evaluation/ExerciseList.vue'
|
|
@@ -229,14 +236,17 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ containerClient:null,
|
|
|
docType:['doc','docx'],
|
|
|
excelType:['xls','csv','xlsx'],
|
|
|
pptType:['ppt','pptx'],
|
|
|
folder: '',
|
|
|
+ searchVolumeVal:'',
|
|
|
isPreviewPaper: false,
|
|
|
previewStatus: false,
|
|
|
hasModify: false,
|
|
|
isLoading: false,
|
|
|
+ isSearchVolume: false,
|
|
|
isAddLoading: false,
|
|
|
isShowLinkModal: false,
|
|
|
isUploadModal: false,
|
|
@@ -253,6 +263,7 @@
|
|
|
subjectList: [],
|
|
|
semesterList: [],
|
|
|
volumeList: [],
|
|
|
+ originVolumeList:[],
|
|
|
questionList: [],
|
|
|
schoolInfo: null,
|
|
|
previewFile: {},
|
|
@@ -292,8 +303,13 @@
|
|
|
created() {
|
|
|
this.isSchool = this.$route.name === 'syllabus'
|
|
|
this.getSchoolInfo()
|
|
|
+ this.initBlobTool()
|
|
|
},
|
|
|
methods: {
|
|
|
+ async initBlobTool(){
|
|
|
+ let n = this.$route.name === 'syllabus' ? await this.$tools.getSchoolSas() : await this.$tools.getPrivateSas()
|
|
|
+ this.containerClient = new BlobTool(n.url, n.name, n.sas, this.curScope)
|
|
|
+ },
|
|
|
/* 获取学校基础信息 */
|
|
|
getSchoolInfo() {
|
|
|
this.$store.dispatch("user/getSchoolProfile").then((res) => {
|
|
@@ -339,6 +355,7 @@
|
|
|
if (!res.error) {
|
|
|
this.isLoading = false
|
|
|
this.volumeList = res.volumes.reverse()
|
|
|
+ this.originVolumeList = JSON.parse(JSON.stringify(this.volumeList))
|
|
|
res.volumes.length && this.onVolumeClick(res.volumes[0], 0)
|
|
|
} else {
|
|
|
this.$Message.warning(res.error);
|
|
@@ -366,6 +383,22 @@
|
|
|
this.isEditVolume = false
|
|
|
this.isAddVolumeModal = true
|
|
|
},
|
|
|
+ /* 搜索册别 */
|
|
|
+ doSearchVolume(){
|
|
|
+ this.isSearchVolume = true
|
|
|
+ },
|
|
|
+ /* 搜索词汇发生变化 */
|
|
|
+ onSearchChange(){
|
|
|
+ this.volumeList = this.originVolumeList.filter(i => i.name.indexOf(this.searchVolumeVal) > -1)
|
|
|
+ this.volumeList.length && this.onVolumeClick(this.volumeList[0], 0)
|
|
|
+ },
|
|
|
+ /* 关闭搜索 */
|
|
|
+ onCloseSearch(){
|
|
|
+ this.isSearchVolume = false
|
|
|
+ this.searchVolumeVal = ''
|
|
|
+ this.volumeList = JSON.parse(JSON.stringify(this.originVolumeList))
|
|
|
+ this.volumeList.length && this.onVolumeClick(this.volumeList[0], 0)
|
|
|
+ },
|
|
|
/* 编辑当前册别 */
|
|
|
doEditVolume() {
|
|
|
this.addVolumeForm = {
|
|
@@ -505,7 +538,7 @@
|
|
|
link: [file.url],
|
|
|
title: file.name,
|
|
|
type: file.type,
|
|
|
- cntr: 'syllabus'
|
|
|
+ cntr: this.curCode
|
|
|
})
|
|
|
})
|
|
|
this.hasModify = true
|
|
@@ -513,29 +546,51 @@
|
|
|
this.$Message.success('上传成功')
|
|
|
console.log(result)
|
|
|
},
|
|
|
- getFileUrl(val) {
|
|
|
- console.log(val)
|
|
|
+ /* 获取关联的内容数据,需要进行相应的文件拷贝 */
|
|
|
+ async onSelectFile() {
|
|
|
+ return new Promise(async (r,j) => {
|
|
|
+ let list = this.$refs.chooseContentRef.selectedFiles
|
|
|
+ if(!list.length){
|
|
|
+ r(200)
|
|
|
+ }else{
|
|
|
+ let promiseArr = []
|
|
|
+ let privateSas = await this.$tools.getPrivateSas()
|
|
|
+ let schoolSas = await this.$tools.getSchoolSas()
|
|
|
+ let curResourceArr = this.$refs.treeRef.curNode.rnodes
|
|
|
+ for(let i = 0 ; i < list.length ; i++){
|
|
|
+ promiseArr.push(new Promise((r2,j2) => {
|
|
|
+ let file = list[i]
|
|
|
+ let sas = file.scope === 'school' ? schoolSas.sas : privateSas.sas
|
|
|
+ this.containerClient.copyBlob('syllabus/' + file.name,file.url,sas).then(res => {
|
|
|
+ curResourceArr.push({
|
|
|
+ type: file.type,
|
|
|
+ title: file.name,
|
|
|
+ id: this.$tools.guid(),
|
|
|
+ code: this.curCode,
|
|
|
+ scope: file.scope,
|
|
|
+ cntr: file.scope === 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state
|
|
|
+ .userInfo.TEAMModelId,
|
|
|
+ link: [file.url]
|
|
|
+ })
|
|
|
+ r2(200)
|
|
|
+
|
|
|
+ }).catch(err => {
|
|
|
+ console.log(err)
|
|
|
+ j2(err)
|
|
|
+ })
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ Promise.all(promiseArr).then(result => {
|
|
|
+ r(200)
|
|
|
+ }).catch(err => {
|
|
|
+ console.log(err)
|
|
|
+ j(err)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
},
|
|
|
- /* 关联内容 */
|
|
|
- onSelectFile() {
|
|
|
- let list = this.$refs.chooseContentRef.selectedFiles
|
|
|
- console.log('关联的内容文件',list)
|
|
|
- if(!list.length) return
|
|
|
- // let curResourceArr = this.$refs.treeRef.curNode.rnodes
|
|
|
- // list.forEach(i => {
|
|
|
- // 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]
|
|
|
- // })
|
|
|
- // })
|
|
|
- },
|
|
|
- /* 关联题目 */
|
|
|
+ /* 获取关联的试题数据 */
|
|
|
onSelectQuestion(val) {
|
|
|
let list = this.$refs.chooseContentRef.$refs.exListRef.selectItems
|
|
|
if(!list.length) return
|
|
@@ -555,6 +610,7 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ /* 获取关联的试卷数据 */
|
|
|
onSelectPaper(){
|
|
|
let list = this.$refs.chooseContentRef.$refs.paperListRef.checkedPaperList
|
|
|
if(!list.length) return
|
|
@@ -573,20 +629,20 @@
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
- console.log(curResourceArr)
|
|
|
},
|
|
|
- // 拿到当前选择的资源内容 进行节点关联
|
|
|
+ /* 点击确认 去获取关联的内容数据、试题试卷数据 */
|
|
|
onRelateContent() {
|
|
|
let curResourceArr = this.$refs.treeRef.curNode.rnodes
|
|
|
- console.log(this.relateFiles)
|
|
|
- console.log(this.$refs.treeRef.curNode)
|
|
|
- this.onSelectFile()
|
|
|
- this.onSelectQuestion()
|
|
|
- this.onSelectPaper()
|
|
|
- // this.$refs.treeRef.curNode.rnodes = this.relateFiles
|
|
|
- console.log(curResourceArr)
|
|
|
- this.isRelateContentModal = false
|
|
|
- this.hasModify = true
|
|
|
+ this.onSelectFile().then(res => {
|
|
|
+ this.onSelectQuestion()
|
|
|
+ this.onSelectPaper()
|
|
|
+ // this.$refs.treeRef.curNode.rnodes = this.relateFiles
|
|
|
+ console.log(curResourceArr)
|
|
|
+ this.isRelateContentModal = false
|
|
|
+ this.hasModify = true
|
|
|
+ }).catch(err=> {
|
|
|
+ this.$Message.error(err)
|
|
|
+ })
|
|
|
},
|
|
|
/* 预览关联资源 */
|
|
|
async onPreview(item) {
|
|
@@ -602,6 +658,9 @@
|
|
|
blob: item.link[0],
|
|
|
scope: item.scope
|
|
|
}]
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.exList.collapseList = [0]
|
|
|
+ })
|
|
|
this.isPreviewPaper = true
|
|
|
break;
|
|
|
case 'paper':
|
|
@@ -614,6 +673,9 @@
|
|
|
let fullPaper = await this.$evTools.getFullPaper(paper)
|
|
|
this.previewPaper = fullPaper
|
|
|
this.questionList = fullPaper.item
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.exList.collapseList = [...this.questionList.keys()]
|
|
|
+ })
|
|
|
this.isPreviewPaper = true
|
|
|
break;
|
|
|
case 'link':
|
|
@@ -638,7 +700,7 @@
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+ /* 点击试卷列表预览试卷 */
|
|
|
async onPreviewPaper(paper){
|
|
|
let fullPaper = await this.$evTools.getFullPaper(paper)
|
|
|
this.previewPaper = fullPaper
|
|
@@ -647,14 +709,7 @@
|
|
|
},
|
|
|
/* 打开PDF文件进行预览 */
|
|
|
async openPdf(url,name){
|
|
|
- // let pdfFile = await this.$tools.getFile(url)
|
|
|
- // window.open(pdfFile,'PDF','width:50%;height:50%;top:100;left:100;');
|
|
|
- // let ele=document.createElement('a')//创建a标签
|
|
|
- // ele.download=name//下载名称
|
|
|
- // ele.target="_blank"//新标签
|
|
|
- // ele.href=url//地址
|
|
|
- // ele.click()//点击a标签实现跳转
|
|
|
- // ele.remove()//移除a标签
|
|
|
+ return
|
|
|
},
|
|
|
/* 删除关联资源 */
|
|
|
onDeleteResource(item, index) {
|
|
@@ -662,11 +717,45 @@
|
|
|
title: this.$t('settings.modalTip4'),
|
|
|
content: '确定要移除该资源吗?',
|
|
|
onOk: () => {
|
|
|
- this.$refs.treeRef.curNode.rnodes.splice(index, 1)
|
|
|
- this.hasModify = true
|
|
|
+ // 需要删除blob对应目录下的文件
|
|
|
+ if(this.needDeleteFile(item)){
|
|
|
+ this.isLoading = true
|
|
|
+ this.deleteBlobPrefix(item).then(r => {
|
|
|
+ this.$Message.success(this.$t('evaluation.deleteSuc'))
|
|
|
+ this.$refs.treeRef.curNode.rnodes.splice(index, 1)
|
|
|
+ this.hasModify = true
|
|
|
+ }).catch(err => {
|
|
|
+ this.$Message.error(err)
|
|
|
+ }).finally(() => {
|
|
|
+ this.isLoading = false
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.$refs.treeRef.curNode.rnodes.splice(index, 1)
|
|
|
+ this.hasModify = true
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
+ },
|
|
|
+ /* 删除blob指定试题目录下所有 */
|
|
|
+ deleteBlobPrefix(item) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ this.$api.blob.deletePrefix({
|
|
|
+ "cntr": item.cntr,
|
|
|
+ "prefix": "syllabus/" + item.title
|
|
|
+ }).then(
|
|
|
+ (res) => {
|
|
|
+ if (!res.error) {
|
|
|
+ resolve(200)
|
|
|
+ } else {
|
|
|
+ resolve(500)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ reject(err)
|
|
|
+ }
|
|
|
+ )
|
|
|
+ })
|
|
|
},
|
|
|
/* 提交新增册别 */
|
|
|
handleSubmit() {
|
|
@@ -728,27 +817,13 @@
|
|
|
return name => {
|
|
|
return name.substr(name.lastIndexOf(".") + 1)
|
|
|
}
|
|
|
+ },
|
|
|
+ needDeleteFile(){
|
|
|
+ return item => {
|
|
|
+ return item.type !== 'item' && item.type !== 'paper' && item.type !== 'link'
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
- mounted() {
|
|
|
- // this.$EventBus.$on('onCheckPaper',list => {
|
|
|
- // let curResourceArr = this.$refs.treeRef.curNode.rnodes
|
|
|
- // 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]
|
|
|
- // })
|
|
|
- // }
|
|
|
- // })
|
|
|
- // })
|
|
|
- }
|
|
|
}
|
|
|
</script>
|
|
|
|
|
@@ -779,7 +854,16 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ .syllabus-content-header{
|
|
|
+ .ivu-input{
|
|
|
+ background-color: #262626;
|
|
|
+ border-color: #333;
|
|
|
+ font-size: 12px;
|
|
|
+ color: #ddd;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
.tree-upload-modal {
|
|
|
.ivu-modal-body {
|
|
|
padding: 10px 40px;
|