Browse Source

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

liqk 4 years ago
parent
commit
f1f719f43d

TEAMModelFunction/TriggerStuActivity.cs → TEAMModelOS.SDK/Models/Service/TriggerStuActivity.cs


+ 2 - 2
TEAMModelOS/ClientApp/src/components/syllabus/DragTree.vue

@@ -720,13 +720,13 @@
 					// 判断是否为一级节点,如果是二级节点则需要拿对应的一级节点去做判断
 					let chapterId = nodeData.pid === this.volume.id ? nodeData.id : this.getChapterIdById(nodeData.id)
 					let chapterNode = this.treeDatas.find(i => i.id === chapterId)
-					return this.$access.can('admin.*|Syllabus_Edit') || this.volume.auth.map(i => i.tmdid).includes(userId) || (chapterNode && chapterNode.auth && chapterNode.auth.length && chapterNode.auth.map(i => i.tmdid).includes(userId))
+					return (!this.isSchool && !this.inShareView) || this.$access.can('admin.*|Syllabus_Edit') || this.volume.auth.map(i => i.tmdid).includes(userId) || (chapterNode && chapterNode.auth && chapterNode.auth.length && chapterNode.auth.map(i => i.tmdid).includes(userId))
 				}
 			},
 			// 判断当前用户是否可以删除当前章节
 			canDeleteChapter(){
 				let userId = this.$store.state.userInfo.TEAMModelId
-				return this.$access.can('admin.*|Syllabus_Edit') || this.volume.auth.map(i => i.tmdid).includes(userId)
+				return this.$access.can('admin.*|Syllabus_Edit') || this.volume.auth.map(i => i.tmdid).includes(userId) || !this.isSchool
 			},
 			curCode() {
 				return this.isSchool ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId

+ 1 - 1
TEAMModelOS/ClientApp/src/components/vote/BaseVoteForm.vue

@@ -90,7 +90,7 @@
 				<CheckboxGroup v-model="voteForm.secret">
 					<Checkbox label="secret">{{ $t('vote.form.openSecret') }}</Checkbox>
 				</CheckboxGroup>
-				<CheckboxGroup v-model="voteForm.repeat">
+				<CheckboxGroup v-model="voteForm.repeat" v-if="voteForm.selectMax > 1">
 					<Checkbox label="repeat">{{ $t('vote.form.openRepeat') }}</Checkbox>
 				</CheckboxGroup>
 			</FormItem>

+ 15 - 7
TEAMModelOS/ClientApp/src/view/answersheet/BaseEditor.vue

@@ -286,6 +286,7 @@
 			// 渲染问答题
 			doInsertSubjective(items) {
 				this.$nextTick(() => {
+					let startPageIndex = 0
 					let scrollDom = this.$parent.$parent.$parent.$parent.$parent.$refs["evScroll"]
 					if (!scrollDom) return
 					let editorDom = this.myEditor.$textElem.elems[0]
@@ -355,7 +356,7 @@
 						let leftHeight = paperH - curEditorY - lastBottomGap - SVG_BORDER_MB;
 						let fixHeight = curEditorH - leftHeight + 20
 						// console.log(itemOrder, '距离第一页顶点的Y', Y);
-						if(itemOrder === 6){
+						// if(itemOrder === 6){
 							console.log(itemOrder, 'rectTop', rectTop);
 							console.log(itemOrder, 'scrollDis', scrollDis);
 							console.log(itemOrder, '距离第一页顶点的Y', Y);
@@ -363,15 +364,18 @@
 							console.log(itemOrder, '高度', curEditorH)
 							console.log(itemOrder, 'LEFT高度', leftHeight)
 							console.log(itemOrder, '需要fix的高度', fixHeight)
-						}
+						// }
+						
+						
 						
 						// 如果 渲染当前富文本的时候 需要渲染的高度超过当前页的剩余高度 则需要进行加页处理
 						if (curEditorY + curEditorH + lastBottomGap + SVG_BORDER_MB > PAPER_H) {
+							startPageIndex++
 							// console.log(itemOrder, Y , curEditorY , curEditorH , '超出了')
+							console.log('++++++++++++',itemOrder, '需要增加页码')
 							// 如果剩余高度满足渲染一部分区域 并且需要补充的区域 则需要进行跨页处理
 							if (leftHeight > 100) {
 								this.$store.commit("addPage");
-								console.log(itemOrder, '需要增加页码')
 								let heightArr = []
 								this.myEditor.config.height = leftHeight + 20;
 								heightArr.push(leftHeight)
@@ -394,7 +398,6 @@
 									splitHtmlArr.forEach((curEditorContent,editorIndex) => {
 										// console.log('富文本的分割高度',heightArr)
 										// console.log('富文本的分割',splitHtmlArr)
-										
 										let editorHeight = curEditorContent.html === '' ? heightArr[editorIndex] : heightArr[editorIndex]
 										// let curEditorContent = this.getSplitHtml(this.pArr,curEditorHeight)
 										if(editorIndex !== 0){
@@ -409,13 +412,18 @@
 							} else {
 								// 跨页处理不需要补充作答区域
 								this.$store.commit("addPage");
-								console.log(itemOrder, '需要增加页码')
-								document.getElementById(this.ids).style.marginTop = (PAPER_H - curEditorY + lastBottomGap + SVG_BORDER_PROP.y) + "px";
-								document.getElementById(this.ids + 'btn').style.top = (PAPER_H - curEditorY + lastBottomGap + SVG_BORDER_PROP.y + 20) + "px";
+								if(this.$parent.subjectiveItems.map(i => i.id).indexOf(this.curItemId) === 0){
+									this.$EventBus.$emit('titleMovePage','subjective')
+								}else{
+									document.getElementById(this.ids).style.marginTop = (PAPER_H - curEditorY + lastBottomGap + SVG_BORDER_PROP.y) + "px";
+									document.getElementById(this.ids + 'btn').style.top = (PAPER_H - curEditorY + lastBottomGap + SVG_BORDER_PROP.y + 20) + "px";
+								}
+								
 							}
 						} else {
 							document.getElementById(this.ids + 'btn') && (document.getElementById(this.ids + 'btn').style.top =  "20px")
 						}
+						console.log(itemOrder, '题目所在页码', this.$store.state.answerSheet.pages)
 						this.$root.$children[0].spinShow = false;
 						
 						

+ 4 - 3
TEAMModelOS/ClientApp/src/view/answersheet/SheetObjective.vue

@@ -101,7 +101,7 @@
 
 			// 渲染客观题目
 			doRenderItems(items, number) {
-				this.blockHeight = 26 * number
+				this.blockHeight = 24 * number
 				this.objectiveGroup && this.objectiveGroup.remove(); // 先清除之前的绘制内容
 				if (this.snap) {
 					this.objectiveGroup = this.snap.paper.g();
@@ -188,7 +188,7 @@
 				// 如果不够排满一列 则最后一块渲染的高度就是 差值的高度
 				let objectiveHeight = this.leftItems.length >= 0 ? refHeight - 26 * diff : refHeight
 				console.log(this.blockHeight,refHeight,this.leftItems.length);
-				console.log(startY,number,objectiveHeight);
+				console.log(startY,number,objectiveHeight); 
 				this.anchorRectY = startY +  objectiveHeight
 				console.log(this.anchorRectY)
 				for (let index = 0; index < 28; index++) {
@@ -205,6 +205,7 @@
 				// 添加纵向定位锚点
 				let anchorCount = this.objectiveItems.length > number ? number : this.objectiveItems.length
 				this.blockList.forEach((blockItem, blockIndex) => {
+					anchorCount = blockIndex === this.blockList.length - 1 ? Math.min(this.number,this.leftItems.length) : anchorCount
 					for (let index = 0; index < anchorCount; index++) {
 						this.objectiveGroup.add(
 							snap.rect(20, startY + GAP * index - 10 + (this.blockHeight * blockIndex),
@@ -306,7 +307,7 @@
 							objectiveArr.includes(item.type)
 						);
 
-						this.blockHeight = 26 * this.number
+						this.blockHeight = 24 * this.number
 						this.leftItems = JSON.parse(JSON.stringify(this.objectiveItems))
 						this.$nextTick(() => {
 							this.doRenderItems(this.objectiveItems, this.number);

+ 10 - 3
TEAMModelOS/ClientApp/src/view/answersheet/index.vue

@@ -12,18 +12,18 @@
 					<div v-for="(group,groupIndex) in groups" :key="groupIndex" class="sheet-group-item">
 						<div v-if="group.type === 'objective'">
 							<BaseTitleEditor :ids="'titleEditor' + groupIndex"
-								:content="titleContent(groupIndex,group)"></BaseTitleEditor>
+								:content="titleContent(groupIndex,group)" ref="objectiveTitleRef"></BaseTitleEditor>
 							<SheetObjective :items="items" v-show="groupItems.objectiveItems.length"
 								@onRendered="onRendered"></SheetObjective>
 						</div>
 						<div v-else-if="group.type === 'complete'">
 							<BaseTitleEditor :ids="'titleEditor' + groupIndex"
-								:content="titleContent(groupIndex,group)"></BaseTitleEditor>
+								:content="titleContent(groupIndex,group)" ref="completeTitleRef"></BaseTitleEditor>
 							<SheetComplete :items="items" v-if="groupItems.completeItems.length"></SheetComplete>
 						</div>
 						<div v-else>
 							<BaseTitleEditor :ids="'titleEditor' + groupIndex"
-								:content="titleContent(groupIndex,group)"></BaseTitleEditor>
+								:content="titleContent(groupIndex,group)" ref="subjectiveTitleRef"></BaseTitleEditor>
 							<SheetSubjective :items="groupItems.subjectiveItems"
 								v-show="groupItems.subjectiveItems.length"></SheetSubjective>
 						</div>
@@ -386,6 +386,13 @@
 				}
 				this.$EventBus.$emit('doRefresh')
 			})
+			this.$EventBus.$off('titleMovePage')
+			this.$EventBus.$on('titleMovePage', val => {
+				this.$nextTick(() => {
+					console.log(this.$refs.subjectiveTitleRef)
+					this.$refs.subjectiveTitleRef[0].$el.style.marginTop = '200px'
+				})
+			})
 		},
 		beforeRouteEnter(to, from, next) {
 			next(vm => {

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

@@ -67,7 +67,7 @@
 									</div>
 								</Tooltip>
 							</p>
-							<p class="volume-item-info" v-if="inShareView && volume.isDel">
+							<p class="volume-item-info" v-if="inShareView">
 								<span style="display: flex;align-items: center;"
 									@click.stop="onDeleteShareVolume(volume)">
 									<Icon type="ios-remove-circle-outline"
@@ -93,7 +93,7 @@
 					<span>{{ $t('syllabus.syllabusMenu') }}</span>
 					<span class="syllabus-content-header-tools"
 						v-if="volumeList.length && curVolume.id && !inShareView">
-						<Icon type="md-add" @click="isAddTreeModal = true" v-if="hasSyllabusAuth || hasVolumeAuth" />
+						<Icon type="md-add" @click="isAddTreeModal = true" v-if="hasSyllabusAuth || hasVolumeAuth(volume.auth)" />
 					</span>
 				</div>
 				<div class="syllabus-tree-box">
@@ -196,7 +196,7 @@
 								:placeholder="$t('syllabus.place2')"></Input>
 							<Input v-else v-model="addVolumeForm.name" :placeholder="$t('syllabus.place3')"></Input>
 						</FormItem>
-						<FormItem :label="$t('syllabus.authors')">
+						<FormItem :label="$t('syllabus.authors')" v-if="isSchool">
 							<Select v-model="addVolumeForm.auth" multiple filterable>
 								<Option v-for="(item,index) in teacherList" :value="item.id" :key="index">{{item.name}}
 								</Option>
@@ -1719,7 +1719,7 @@
 			},
 			hasVolumeAuth(){
 				return auth => {
-					return this.$access.can('admin.*|Syllabus_Edit') || auth.map(i => i.tmdid).includes(this.$store.state.userInfo.TEAMModelId)
+					return (!this.isSchool && !this.inShareView) || this.$access.can('admin.*|Syllabus_Edit') || (auth && auth.length && auth.map(i => i.tmdid).includes(this.$store.state.userInfo.TEAMModelId))
 				}
 			},
 			hasEditAuth() {

+ 43 - 9
TEAMModelOS/Controllers/Client/HiScanController.cs

@@ -30,6 +30,8 @@ using System.Dynamic;
 using Azure.Storage.Blobs.Models;
 using Azure.Storage.Sas;
 using Lib.AspNetCore.ServerSentEvents;
+using TEAMModelFunction;
+using TEAMModelOS.SDK.Models.Cosmos.Common;
 
 namespace TEAMModelOS.Controllers.Core
 {
@@ -121,23 +123,24 @@ namespace TEAMModelOS.Controllers.Core
                                     var schoolPicture = school.RootElement.GetProperty("picture");
                                     //检查学校购买的模组是否包含阅卷模组
                                     int count = 0;
-                                    string sql = $" SELECT value(count(serial))  FROM c join serial in c.serial where c.id ='{schoolId}'  and  c.pk='Product' and serial.prodCode='YMPCVCIM' ";
-                                    await  foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<int>(sql, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Product") })) {
+                                    string sql = $" SELECT value(count(product))  FROM c join product in c.service.product      where c.id ='{schoolId}'  and  c.pk='Product'  and product.prodCode='YMPCVCIM' ";
+                                    await  foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<int>(sql, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Product") })) {
                                         count = item;
                                     }
                                     if (count > 0) {
                                         //生成token
                                         var  token = JwtAuthExtension.CreateAuthToken(_option.HostName, id, name?.ToString(), picture?.ToString(), _option.JwtSecretKey, roles: new[] { "teacher" }, schoolID: $"{schoolId}");
-                                        //获取线下阅卷评测
-
-                                        schools.Add(new ScanSchool { name = $"schoolName", picture = $"{schoolPicture}", code = $"{schoolId}", status = $"{schoolStatus}" ,token=token});
+                                        //获取学校线下阅卷评测
+                                        var sexams= await GetExam($"{schoolId}", "school", client);
+                                        schools.Add(new ScanSchool { name = $"schoolName", picture = $"{schoolPicture}", code = $"{schoolId}", status = $"{schoolStatus}" ,token=token, datas = sexams });
                                     }
                                 }
                             }
                         }
-
+                        //获取个人线下阅卷评测
+                        var datas = await GetExam($"{id}", "private", client);
                         //換取AuthToken,提供給前端
-                        var data = new { name, picture, id, schools };
+                        var data = new { name, picture, id, schools , datas };
                         await sseClient.SendEventAsync(data.ToJsonString());
                         return Ok(data);
                     }
@@ -152,18 +155,49 @@ namespace TEAMModelOS.Controllers.Core
             }
            return Ok();
         }
-        private void GetExam(string code ,string scope)
+        private async Task<List<ExamData>> GetExam(string code ,string scope, CosmosClient client)
         {
+            List<ExamData> corrects = new List<ExamData>();
+            if (scope.Equals("school"))
+            {
+                await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryIterator<Correct>(queryText: "SELECT  * FROM c where c.source='2' and c.progress='going' order by c.createTime  ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Correct-{code}") }))
+                {
+                    ExamInfo exam = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ExamInfo>(item.id, new PartitionKey($"Exam-{code}"));
+                    (List<string> tmdids, List<Students> students)stulist  =await TriggerStuActivity.GetStuList(client, _dingDing, exam.classes, code);
+
+                    corrects.Add(new ExamData { exam = exam, correct = item,tmdids=stulist.tmdids,stulist=stulist.students });
 
+                }
+            }
+            else if(scope.Equals("private")){
+                await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryIterator<Correct>(queryText: "SELECT  * FROM c where c.source='2'  and c.progress='going' order by c.createTime  ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Correct-{code}") }))
+                {
 
+                    ExamInfo exam = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ExamInfo>(item.id, new PartitionKey($"Exam-{code}"));
+                    (List<string> tmdids, List<Students> students) stulist = await TriggerStuActivity.GetStuList(client, _dingDing, exam.classes, code);
+                    corrects.Add(new ExamData { exam = exam, correct = item, tmdids = stulist.tmdids, stulist = stulist.students });
+                }
+            }
+            return corrects;
         }
     }
 
-    public class ScanSchool { 
+    public class ScanSchool 
+    { 
         public string name { get; set; }
         public string picture { get; set; }
         public string code { get; set; }
         public string status { get; set; }
         public string token { get; set; }
+       // public List<(Correct,ExamInfo, (List<string> tmdids, List<Students> stulist))> exams{ get; set; }
+        public List<ExamData> datas { get; set; }
+    }
+
+    public class ExamData
+    {
+        public Correct correct { get; set; }
+        public ExamInfo exam { get; set; }
+        public List<string> tmdids { get; set; }
+        public List<Students> stulist { get; set; }
     }
 }