瀏覽代碼

Merge branch 'develop5.0-tmd' of http://106.12.23.251:10000/TEAMMODEL/TEAMModelOS into develop5.0-tmd

CrazyIter_Bin 4 年之前
父節點
當前提交
d3a6838d4d

+ 1 - 0
TEAMModelOS/ClientApp/package.json

@@ -33,6 +33,7 @@
 		"firebase": "^7.19.0",
 		"firestore": "^1.1.6",
 		"html2canvas": "^1.0.0-rc.7",
+		"html2pdf.js": "^0.9.3",
 		"imports-loader": "^0.8.0",
 		"increase-memory-limit": "^1.0.7",
 		"js-sha1": "^0.6.0",

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

@@ -19,6 +19,9 @@ export default {
 	DeleteTree:function(data) {
 	    return post('/common/syllabus/delete', data)
 	},
+	ShareTree:function(data) {
+	    return post('/teacher/share/to', data)
+	},
 	// 查找知识块数量
 	FindBlockCount: function (data) {
 		return post('/knowledges/find-count', data)

+ 19 - 0
TEAMModelOS/ClientApp/src/common/BaseNotification.vue

@@ -5,6 +5,10 @@
 				<Icon type="md-notifications" />
 			</Badge>
 			<div slot="content" class="notice-wrap">
+				<div v-if="!msgArr.length" class="notice-empty">
+					<Icon type="md-text" />
+					暂无通知
+				</div>
 				<div class="notice-item" v-for="(item,index) in msgArr" :key="index" @click="doClickMsg(item)">
 					<p class="item-name">{{ getMsgType(item) }}</p>
 					<p class="item-content">{{ getMsgContent(item) }}</p>
@@ -123,6 +127,21 @@
 			box-shadow: none;
 			padding: 0;
 		}
+		
+		.notice-empty{
+			display: flex;
+			flex-direction: column;
+			justify-content: center;
+			align-items: center;
+			margin: 20px 0;
+			color: #b3b3b3;
+			
+			.ivu-icon{
+				font-size: 44px;
+				margin-bottom: 20px;
+				color: #6c6c6c;
+			}
+		}
 
 		.notice-wrap {
 			display: flex;

+ 4 - 1
TEAMModelOS/ClientApp/src/components/syllabus/DragTree.vue

@@ -297,7 +297,10 @@
 			treeData: {
 				handler: function(n, o) {
 					// 以下为拼接树形数据以及册别数据
-					this.treeDatas = n.map(i => i.trees[0])
+					this.treeDatas = n.map(i => {
+						i.trees[0].auth = i.auth
+						return i.trees[0]
+					})
 					this.getAllChild(this.treeDatas)
 					this.$nextTick().then(() => {
 						const firstNode = document.querySelector('.el-tree-node')

+ 65 - 3
TEAMModelOS/ClientApp/src/components/syllabus/InviteTeacher.vue

@@ -18,7 +18,7 @@
 				</template>
 				<template slot-scope="{ row }" slot="action">
 					<div style="display: flex;align-items: center;">
-						<i-switch true-color="#13ce66"></i-switch>
+						<i-switch true-color="#13ce66" :value="hasAuth(row.id)" :before-change="handleBeforeChange"  @on-change="onSwitchChange(row,$event)"></i-switch>
 					</div>
 				</template>
 			</Table>
@@ -34,6 +34,7 @@
 					</div>
 					<p v-if="!curTeacher && hasSearchResult" class="search-none">暂未查询到相关结果</p>
 					<p v-if="hasSearchResult" class="re-search" @click="onReSearch">重新搜索</p>
+					<Button type="success" v-if="hasSearchResult"  @click="doShare">确认分享</Button>
 				</div>
 			</div>
 		</div>
@@ -112,7 +113,7 @@
 						if (res.code == 0) {
 							this.$Message.error('無法取得使用者資料')
 						} else {
-							this.teacherList = this.$store.state.user.schoolUserList.filter(i => i.status === 'join')
+							this.teacherList = this.$store.state.user.schoolUserList.filter(i => i.status === 'join' && i.id !== this.$store.state.userInfo.TEAMModelId)
 							this.originList = JSON.parse(JSON.stringify(this.teacherList))
 						}
 					},
@@ -151,11 +152,72 @@
 				this.searchIdVal = ''
 				this.curTeacher = null
 				this.hasSearchResult = false
+			},
+			/* 修改共编权限前回调 */
+			handleBeforeChange(){
+				return new Promise((resolve) => {
+					this.$Modal.confirm({
+						title: '修改确认',
+						content: '确认修改当前用户的共编状态?',
+						onOk: () => {
+							resolve();
+						}
+					});
+				});
+			},
+			/* 修改共编权限 */
+			onSwitchChange(val,e){
+				let curVolume = this.$parent.$parent.curVolume
+				this.$api.syllabus.ShareTree({
+					"school": curVolume.school,
+					"scope": curVolume.scope,
+					"tmdInfo": [
+						{
+							"tmdid": val.id,
+							"tmdname": val.name
+						}
+					],
+					"coedit": true,
+					"share": false,
+					"issuer": this.$store.state.userInfo.TEAMModelId,
+					"opt": e ? 'add' : 'del',
+					"syllabusId": this.nodeInfo.id,
+					"syllabusName": this.nodeInfo.title,
+					"volumeId": curVolume.id,
+					"volumeName": curVolume.name
+				}).then(res => {
+					if(res.code === 200){
+						this.$Message.success('操作成功!')
+					}
+				}).catch(err => {
+					this.$Message.error(err)
+				})
+			},
+			/* 分享课纲操作 */
+			doShare(){
+				console.log(this.curTeacher);
 			}
 		},
 		mounted() {
 			this.isSchool && this.getAllTeacher()
 		},
+		computed:{
+			hasAuth(){
+				return id => {
+					if(!this.nodeInfo.auth){
+						return false
+					}else{
+						let matchItem = this.nodeInfo.auth.filter(i => i.tmdid === id)
+						console.log(matchItem)
+						if(matchItem.length && matchItem[0].coedit){
+							return true
+						}else{
+							return false
+						}
+					}
+				}
+			}
+		},
 		watch: {
 			node: {
 				handler(n, o) {
@@ -211,7 +273,7 @@
 			}
 			
 			.id-search{
-				height: 400px;
+				min-height: 400px;
 				width: 100%;
 				display: flex;
 				flex-direction: column;

+ 2 - 2
TEAMModelOS/ClientApp/src/utils/dom_to_image.js

@@ -155,7 +155,7 @@
             .then(util.makeImage)
             .then(util.delay(100))
             .then(function (image) {
-                console.log(image)
+                // console.log(image)
                 var canvas = newCanvas(domNode);
                 canvas.getContext('2d').drawImage(image, 0, 0);
                 return canvas;
@@ -674,7 +674,7 @@
                         return rule.type === CSSRule.FONT_FACE_RULE;
                     })
                     .filter(function (rule) {
-                        console.log(rule.style.getPropertyValue('href'))
+                        // console.log(rule.style.getPropertyValue('href'))
                         return inliner.shouldProcess(rule.style.getPropertyValue('href'));
                     });
             }

+ 4 - 3
TEAMModelOS/ClientApp/src/view/syllabus/Syllabus.vue

@@ -193,12 +193,12 @@
 		</Modal>
 		
 		<!-- 选择共编、分享弹窗 -->
-		<Modal v-model="isInviteModal" width="750" class="tree-modal add-volume-modal choose-content-modal">
+		<Modal v-model="isInviteModal" width="750" footer-hide class="tree-modal add-volume-modal choose-content-modal">
 			<div class="modal-header" slot="header">
 				选择{{ isSchool ? '共编' : '分享' }}教师
 			</div>
-			<InviteTeacher :node="curShareNode" ref="inviteRef"></InviteTeacher>
-			<Button slot="footer" @click="doInviteTeacher" style="margin-bottom: 20px;" class="modal-btn">确认</Button>
+			<InviteTeacher :node="curShareNode" ref="inviteRef" v-if="isInviteModal"></InviteTeacher>
+			<!-- <Button slot="footer" @click="doInviteTeacher" style="margin-bottom: 20px;" class="modal-btn">确认</Button> -->
 		</Modal>
 
 		<!-- 预览试题试卷弹窗 -->
@@ -852,6 +852,7 @@
 					}
 					if (this.isEditVolume && this.curVolume) {
 						addVolumeParams.id = this.curVolume.id
+						addVolumeParams.name = this.curVolume.name
 						addVolumeParams.syllabusIds = this.allChapterIds || []
 					}
 					// 发送新增或者编辑册别请求

+ 2 - 2
TEAMModelOS/Controllers/Syllabus/ShareController.cs

@@ -96,7 +96,7 @@ namespace TEAMModelOS.Controllers
                     {
                         (Syllabus syllabus, List<Share> shares) = DoAuth(request, syllabusD);
                         shares.ForEach(async x=> {
-                            await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync<Share>(x, new PartitionKey($"Share-{x.code}"));
+                            await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync<Share>(x, new PartitionKey($"{x.code}"));
                         });
                        
                         await client.GetContainer("TEAMModelOS", "School").UpsertItemAsync<Syllabus>(syllabus, new PartitionKey($"Syllabus-{request.volumeId}"));
@@ -129,7 +129,7 @@ namespace TEAMModelOS.Controllers
                     {
                         (Syllabus vlm, List<Share> shares) = DoAuth(request, syllabusD);
                         shares.ForEach(async x => {
-                            await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync<Share>(x, new PartitionKey($"Share-{x.code}"));
+                            await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync<Share>(x, new PartitionKey($"{x.code}"));
                         });
                         await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync<Syllabus>(syllabusD, new PartitionKey($"Syllabus-{request.volumeId}"));
                     }