瀏覽代碼

个人课纲调整

OnePsycho 4 年之前
父節點
當前提交
4e93421504

+ 6 - 0
TEAMModelOS/ClientApp/src/api/syllabus.js

@@ -22,6 +22,12 @@ export default {
 	ShareTree:function(data) {
 	    return post('/teacher/share/to', data)
 	},
+	FindShare:function(data) {
+	    return post('/teacher/share/find', data)
+	},
+	ViewShare:function(data) {
+	    return post('/teacher/share/view-share', data)
+	},
 	// 查找知识块数量
 	FindBlockCount: function (data) {
 		return post('/knowledges/find-count', data)

+ 16 - 1
TEAMModelOS/ClientApp/src/view/syllabus/Syllabus.less

@@ -1,6 +1,6 @@
 @primaryColor: #1CC0F3;
 @borderColor: #323232;
-@second-textColor: #5b5b5b; //文本副级颜色
+@second-textColor: #9e9e9e; //文本副级颜色
 .syllabus-container{
 	width: 100%;
 	height: 100%;
@@ -17,6 +17,21 @@
 		padding-left: 15px;
 		z-index: 10;
 		
+		.syllabus-tab-item{
+			margin-right: 40px;
+			font-size: 14px;
+			color: @second-textColor;
+			cursor: pointer;
+			
+			&-active{
+				font-size: 16px;
+				font-weight: bold;
+				color: #fff;
+				padding-bottom: 3px;
+				border-bottom: 1px solid #fff;
+			}
+		}
+		
 		.subject-select{
 			&-item{
 				margin-left: 10px;

+ 87 - 2
TEAMModelOS/ClientApp/src/view/syllabus/Syllabus.vue

@@ -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()