|
@@ -14,7 +14,8 @@
|
|
|
]" @click="onSubjectChange(subject,subjectIndex)">{{ subject.name }}</span>
|
|
|
</div>
|
|
|
<div v-if="!isSchool">
|
|
|
- <span style="color: #F0F0F0;font-size: 18px;font-weight: bolder;">个人课纲</span>
|
|
|
+ <span :class="['syllabus-tab-item',activeTab === 'fromCreate' ? 'syllabus-tab-item-active' : '']" @click="onChangeSyllabusTab('fromCreate')">我创建的课纲</span>
|
|
|
+ <span :class="['syllabus-tab-item',activeTab === 'fromShare' ? 'syllabus-tab-item-active' : '']" @click="onChangeSyllabusTab('fromShare')">他人分享的课纲</span>
|
|
|
</div>
|
|
|
<Button @click="onSaveSyllabus" class="btn-save-modify" icon="md-folder"
|
|
|
v-if="(hasSyllabusAuth || hasEditAuth(curNode)) && hasModify">存储变更</Button>
|
|
@@ -256,6 +257,7 @@
|
|
|
pptType:['ppt','pptx'],
|
|
|
folder: '',
|
|
|
searchVolumeVal:'',
|
|
|
+ activeTab:'fromCreate',
|
|
|
isPreviewPaper: false,
|
|
|
previewStatus: false,
|
|
|
hasModify: false,
|
|
@@ -366,6 +368,10 @@
|
|
|
this.activeSubjectIndex = index
|
|
|
this.getVolumeList()
|
|
|
},
|
|
|
+ onChangeSyllabusTab(type){
|
|
|
+ this.activeTab = type
|
|
|
+ type === 'fromCreate' ? this.getVolumeList() : this.getShareVolumeList()
|
|
|
+ },
|
|
|
/* 获取册别列表 */
|
|
|
getVolumeList() {
|
|
|
this.isLoading = true
|
|
@@ -393,6 +399,44 @@
|
|
|
this.$Message.error(err);
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+ /* 获取分享来的册别列表 */
|
|
|
+ getShareVolumeList(){
|
|
|
+ this.$api.syllabus.FindShare({
|
|
|
+ "code": this.$store.state.userInfo.TEAMModelId,
|
|
|
+ "type":"share"
|
|
|
+ }).then(res => {
|
|
|
+ if (!res.error) {
|
|
|
+ this.isLoading = false
|
|
|
+ if(res.shares.length){
|
|
|
+ let shareList = res.shares.map(i => {
|
|
|
+ return {
|
|
|
+ id:i.id,
|
|
|
+ creatorId:i.code,
|
|
|
+ name:i.list[0].volumeName,
|
|
|
+ children:i.list,
|
|
|
+ pk:'Volume',
|
|
|
+ school:'',
|
|
|
+ scope:'private',
|
|
|
+ status:1
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.volumeList = shareList
|
|
|
+ this.originVolumeList = JSON.parse(JSON.stringify(this.volumeList))
|
|
|
+ let activeIndex = this.isEditVolume ? this.activeVolumeIndex : 0
|
|
|
+ shareList.length && this.onVolumeClick(shareList[activeIndex], activeIndex)
|
|
|
+ }else{
|
|
|
+ this.volumeList = []
|
|
|
+ this.originVolumeList = []
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ this.$Message.warning(res.error);
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.$Message.error(err);
|
|
|
+ })
|
|
|
+ },
|
|
|
/* 点击某个册别 */
|
|
|
onVolumeClick(volume, volumeIndex) {
|
|
|
if (!volume || (volume.id === this.curVolume.id && !this.isEditVolume)) return
|
|
@@ -400,7 +444,7 @@
|
|
|
this.curVolume = volume
|
|
|
this.allChapterIds = volume.syllabusIds || []
|
|
|
this.activeVolumeIndex = volumeIndex
|
|
|
- this.getTreeByVolumeId(volume)
|
|
|
+ this.activeTab === 'fromCreate' ? this.getTreeByVolumeId(volume) : this.getShareTree(volume)
|
|
|
this.hasModify = false
|
|
|
},
|
|
|
/* 添加册别 */
|
|
@@ -493,6 +537,47 @@
|
|
|
this.isLoading = false
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+ /* 获取分享课纲的树形数据 */
|
|
|
+ getShareTree(volume){
|
|
|
+ this.$api.syllabus.ViewShare({
|
|
|
+ "scope": "private",
|
|
|
+ "school": "",
|
|
|
+ "issuer": volume.creatorId,
|
|
|
+ "volumeId": volume.id,
|
|
|
+ "syllabusId": volume.children.map(i => i.id)
|
|
|
+ }).then(res => {
|
|
|
+ if (!res.error) {
|
|
|
+ this.treeOrigin = res.tree
|
|
|
+ this.getAllChild(this.treeOrigin.map(i => {
|
|
|
+ i.trees[0].auth = i.auth
|
|
|
+ return i.trees[0]
|
|
|
+ }))
|
|
|
+ } else {
|
|
|
+ this.$Message.warning(res.error);
|
|
|
+ this.treeOrigin = []
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.treeOrigin = []
|
|
|
+ }).finally(() => {
|
|
|
+ this.isLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 根据醍摩豆ID获取对应BLOB个人容器授权信息 */
|
|
|
+ getBlobPrivateSas(tmdId){
|
|
|
+ return new Promise((r,j) => {
|
|
|
+ this.$api.blob.blobSasR({
|
|
|
+ name:tmdId,
|
|
|
+ role:'teacher'
|
|
|
+ }).then(res => {
|
|
|
+ if(!res.error){
|
|
|
+ r('?' + res.sas)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
/* 添加课纲的第一层节点 */
|
|
|
onAddTreeNode() {
|
|
|
this.nodeInfo.id = this.$tools.guid()
|