Forráskód Böngészése

Merge branch 'develop3.0-tmd' of http://106.12.23.251:10080/TEAMMODEL/TEAMModelOS into develop3.0-tmd

zhouj1203@hotmail.com 4 éve
szülő
commit
596a403167

+ 11 - 2
TEAMModelOS/ClientApp/src/components/questionnaire/BaseQnForm.vue

@@ -203,7 +203,13 @@
 						code: this.$store.state.userInfo.schoolCode
 					}).then(res => {
 						if (!res.error && res.courses) {
-							r(res.courses)
+							this.$store.dispatch('user/getSchoolProfile').then(schoolProfile => {
+							    let schoolClasses =  schoolProfile.school_classes
+								console.log(schoolClasses)
+								r([...res.courses,...schoolClasses])
+							}).catch(err => {
+								r([])
+							})
 						} else {
 							j(500)
 							this.$Message.error(this.$t('survey.getDataFailTip'))
@@ -255,8 +261,11 @@
 			 * 回显问卷详情
 			 * @param item
 			 */
-			doRender(item) {
+			async doRender(item) {
 				console.log(item)
+				if(!this.classRooms.length){
+					this.classRooms = await this.getClassrooms(this.userInfo.TEAMModelId)
+				}
 				this.qnForm = {
 					name: item.name,
 					classes: item.classes || [],

+ 3 - 5
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/PaperView.vue

@@ -105,18 +105,17 @@
                 this.chooseData = {}
                 this.isTestOver = false
                 //this.selectTab = "test"
-                console.log(this.selectTab)
                 if (this.$store.getters.getItemTitle.name !== undefined) {
                     let paper = this.$store.getters.getItemTitle
                     let codes = this.$store.getters.getItemTitle.code.split('-')
                     let req = {
                         id: paper.id,
                         studentId: this.$store.state.userInfo.sub,
-                        code: codes[1]
+                        code: codes[1],
+                        scode: paper.scode
                     }
                     let isTest = 0
                     this.$api.studentWeb.FindStudentPaper(req).then(res => {
-                        console.log(res)
                         this.stuData = res
                         let resData = res
                         for (let item of resData.papers) {
@@ -172,7 +171,6 @@
                 }
             },
             async getPaper(data) {
-                console.log(data)
                 this.isExamDown = false
                 this.isLoad = true
                 this.selectData = {}
@@ -181,7 +179,7 @@
                     let key = data.code.split('-')
                     let code = {
                         scope: data.scope,
-                        code: key[(key.length - 1)],
+                        code: this.$store.getters.getItemTitle.owner,
                         blob: data.blob
                     }
                     let exam = {}

+ 17 - 3
TEAMModelOS/ClientApp/src/components/vote/BaseVoteForm.vue

@@ -200,7 +200,10 @@
 		},
 		created() {
 			/** 获取可选班级列表 */
-			this.getClassrooms(this.userInfo.TEAMModelId).then(res => this.classRooms = res)
+			this.getClassrooms(this.userInfo.TEAMModelId).then(res => {
+				console.log(res)
+				this.classRooms = res
+			})
 		},
 		methods: {
 			onClassTypeChange(val) {
@@ -419,7 +422,14 @@
 						code: this.$store.state.userInfo.schoolCode
 					}).then(res => {
 						if (!res.error && res.courses) {
-							r(res.courses)
+							this.$store.dispatch('user/getSchoolProfile').then(schoolProfile => {
+							    let schoolClasses =  schoolProfile.school_classes
+								console.log(schoolClasses)
+								r([...res.courses,...schoolClasses])
+							}).catch(err => {
+								r([])
+							})
+							
 						} else {
 							j(500)
 							this.$Message.error(this.$t('vote.form.getDataFailTip'))
@@ -491,8 +501,11 @@
 			 * 回显投票详情
 			 * @param item
 			 */
-			doRender(item) {
+			async doRender(item) {
 				console.log(item)
+				if(!this.classRooms.length){
+					this.classRooms = await this.getClassrooms(this.userInfo.TEAMModelId)
+				}
 				this.voteForm = null
 				this.voteOptionsContent = []
 				this.voteOptions = []
@@ -515,6 +528,7 @@
 				this.descriptionEditor.txt.html(item.description)
 				this.voteOptionsContent = item.options
 				this.voteOptions = item.options.map((item, index) => index)
+				
 				this.$nextTick(() => {
 					this.initEditors()
 					if (item.classes.length) {

+ 2 - 0
TEAMModelOS/ClientApp/src/utils/evTools.js

@@ -385,6 +385,8 @@ export default {
 	/* 获取完整的试卷数据 */
 	getStuPaper(paper,examScope){
 		//console.log('evTools换取学生试卷' , paper)
+		console.log(paper)
+		console.log(examScope)
 		let curScope = examScope || paper.scope
 		return new Promise(async (r,j) => {
 			let blobHost = JSON.parse(decodeURIComponent(localStorage.student_profile, "utf-8")).blob_uri

+ 4 - 4
TEAMModelOS/ClientApp/src/view/evaluation/components/BasePoints.vue

@@ -162,10 +162,10 @@
 					console.log(this.defaultParams.subjectId)
 					if (this.defaultParams.periodId && this.defaultParams.subjectId){
 						this.$api.knowledge.GetSchoolPoints(this.defaultParams).then(res => {
-							if (!res.error && res.knowledges) {
-									this.schoolPointList = res.knowledges
-									this.originSchoolList = res.knowledges
-								    this.originPointList = this.originPointList.concat(res.knowledges)
+							if (!res.error && res) {
+									this.schoolPointList = res
+									this.originSchoolList = res
+								    this.originPointList = this.originPointList.concat(res)
 							} else {
 								this.$Message.warning('获取数据失败')
 							}

+ 4 - 0
TEAMModelOS/ClientApp/src/view/newcourse/NewCusMgt.less

@@ -258,4 +258,8 @@
         color: #a5a5a5;
         margin-right: 5px;
     }
+}
+.list-name-box{
+    color: #a5a5a5;
+    margin-bottom: -30px;
 }

+ 68 - 22
TEAMModelOS/ClientApp/src/view/newcourse/NewCusMgt.vue

@@ -105,10 +105,6 @@
                                     <Icon type="md-trash" size="16" />
                                     <span>移除名单</span>
                                 </span>
-                                <!-- <span v-show="curTab == 1">授课教室:</span>
-                                <Select v-show="curTab == 1" v-model="setCurClass" style="width:200px;margin-right:30px" size="small">
-                                    <Option v-for="(item,index) in schdClassList" :value="item.classId" :key="index">{{ item.classInfo.name }}</Option>
-                                </Select> -->
                             </div>
                         </div>
                         <!-- 教师上课时段设置 -->
@@ -192,10 +188,6 @@
                     <!-- 添加名单UI -->
                     <div slot="right" class="class-setting dark-el-cascader dark-iview-select dark-iview-table" v-show="isAddStuList">
                         <div class="add-list-header">
-                            <!-- <span class="add-list-label">教师:</span>
-                            <Select ref="sltStuList" clearable label-in-value v-model="schedule.teacherId" style="width:200px;margin-right:30px" size="small" @on-change="setTeaName">
-                                <Option v-for="(item,index) in $store.state.teachers.teacherList" :value="item.id" :key="index">{{ item.name }}</Option>
-                            </Select> -->
                             <span class="add-list-label">教室:</span>
                             <el-cascader size="small" placeholder="请设置上课教室" :show-all-levels="false" clearable v-model="schedule.classId" :options="csOptions" :props="props" @change="setClassName($event,'insert')" style="width:180px;">
                             </el-cascader>
@@ -298,12 +290,14 @@
                 </FormItem>
             </Form>
         </Modal>
-        <!-- 添加授课教师 -->
-        <!-- <Modal v-model="addTeaStatus" title="添加教师" class-name="dark-iview-modal dark-iview-select" @on-ok="confirmAddTea">
-            <Select ref="addTea" label-in-value multiple clearable :placeholder="$t('cusMgt.teacherHolder')" :max-tag-count="3" filterable @on-change="seltChange">
-                <Option v-for="(item,index) in $store.state.teachers.teacherList" :value="item.id" :key="index">{{ item.name }}</Option>
-            </Select>
-        </Modal> -->
+        <!-- 创建名单stulist -->
+        <Modal v-model="addStuListStatus" title="创建自定义名单" width="1200" @on-ok="confirmAddStuList" class-name="dark-iview-modal" :loading="modalLoading">
+            <div class="dark-iview-input list-name-box">
+                <span>名称:</span>
+                <Input v-model="listName" placeholder="请输入名单名称..." style="width: 300px" />
+            </div>
+            <StudentList @getSelectInfo="(selction)=>{listSelections = selction}"></StudentList>
+        </Modal>
         <!-- 时段设置 -->
         <Drawer title="时段设置" class-name="dark-iview-drawer" :closable="false" v-model="showTime" :width="450">
             <TimeSetting :periodId="filterPeriod"></TimeSetting>
@@ -333,6 +327,10 @@ export default {
             }
         }
         return {
+            listName:'',
+            addStuListStatus: false,
+            modalLoading:false,
+            listSelections:[],
             isUpd: false,
             props: {
                 value: 'id',
@@ -494,8 +492,8 @@ export default {
                     id: '',
                     name: ''
                 },
-                teacherId:'',
-                teacherName:'',
+                teacherId: '',
+                teacherName: '',
                 stulist: '',
                 time: [],
                 notice: ''
@@ -503,6 +501,51 @@ export default {
         }
     },
     methods: {
+        confirmAddStuList() {
+            if (!this.listName) {
+                this.$Message.warning('请输入名单名称')
+                this.modalLoading = false
+                setTimeout(() => {
+                    this.modalLoading = true
+                }, 0)
+            } else {
+                let stuList = {
+                    name: this.listName,
+                    id: this.$tools.guid(),
+                    code: this.$store.state.userInfo.schoolCode,
+                    students: this.listSelections.map(item => { //这里没有学生名字, 需要先查看id集合再查学生信息?
+                        return {
+                            id: item.id,
+                            code: item.code //学生所在学校的编码,这里先传当前学校编码,暂无未考虑跨校名单
+                        }
+                    }),
+                    tmids: [],
+                    course: null
+                }
+                this.saveStuList(stuList)
+            }
+        },
+        // 保存名单
+        saveStuList(stuList) {
+            let params = {
+                stuList,
+                scope: "school"
+            }
+            this.$api.courseMgmt.upsertStulist(params).then(
+                res => {
+                    this.$Message.success('添加成功')
+                    this.addStuStatus = false
+                    this.stuList.unshift(params.stuList)
+                    this.listName = ''
+                },
+                err => {
+                    this.modalLoading = false
+                    setTimeout(() => {
+                        this.modalLoading = true
+                    }, 0)
+                }
+            )
+        },
         selectCus(index) {
             this.selectClass(0)
             this.selectTea(0)
@@ -728,8 +771,8 @@ export default {
                     id: '',
                     name: ''
                 },
-                teacherId:'',
-                teacherName:'',
+                teacherId: '',
+                teacherName: '',
                 stulist: '',
                 time: [],
                 notice: ''
@@ -782,7 +825,7 @@ export default {
         removeStuList() {
             this.$Modal.confirm({
                 title: '移除名单',
-                content: `是否确认移除${this.schdList[this.curClassIndex].listName || this.schdList[this.curClassIndex].classInfo.name }?`,
+                content: `是否确认移除${this.schdList[this.curClassIndex].listName || this.schdList[this.curClassIndex].classInfo.name}?`,
                 onOk: () => {
                     for (let i in this.courseListShow[this.curCusIndex].schedule) {
                         let curSchd = this.schdList[this.curClassIndex]
@@ -816,9 +859,12 @@ export default {
             })
         },
         goMgtStuList() {
-            this.$router.push({
-                name: 'MgtStuList'
-            })
+            //不用跳转页面进行操作
+            // this.$router.push({
+            //     name: 'MgtStuList'
+            // })
+            // 在当前页面添加stulist
+            this.addStuListStatus = true
         },
         // 切换课表模式和课程模式
         toggleView() {

+ 4 - 4
TEAMModelOS/ClientApp/src/view/questionnaire/ManageQuestionnaire.vue

@@ -404,15 +404,15 @@
 					ids: surveyItem.classes,
 					scope:surveyItem.owner === this.$store.state.userInfo.schoolCode ? 'school' : 'private'
 				}).then(res => {
-					if (!res.error && res.classrooms.length) {
+					if (!res.error && res.stus.length) {
 						let list = []
-						res.classrooms.forEach(classroom => {
-							classroom.students.forEach(i => {
+						res.stus.forEach(classStus => {
+							classStus.forEach(i => {
 								list.push({
 									id: i.id,
 									name: i.name,
 									no: i.no,
-									classroomName: classroom.name
+									classroomName: i.className
 								})
 							})
 						})

+ 39 - 18
TEAMModelOS/ClientApp/src/view/vote/ManageVote.vue

@@ -241,24 +241,46 @@
 			},
 			
 			/* 获取正在进行中的投票活动的投票数据 */
-			getVoteRecord(voteItem){
-				return new Promise((r,j) => {
-					this.$api.learnActivity.FindVoteRecord({
-						id: voteItem.id,
-						code: voteItem.code,
-					}).then(res => {
-						if(!res.error){
-							r(res)
+			async getVoteRecord(voteItem){
+				return new Promise(async (r,j) => {
+					// 如果是进行中的活动 则从cosmos获取实时作答数据
+					if(voteItem.progress === 'going'){
+						this.$api.learnActivity.FindVoteRecord({
+							id: voteItem.id,
+							code: voteItem.code,
+						}).then(res => {
+							if(!res.error){
+								r(res)
+							}
+						}).catch(err => {
+							j(err)
+						})
+					}else{ // 如果是已结束的活动 则从blob读取作答数据 
+						try{
+							let curItemRecord = await this.getBlobJsonFile(voteItem.scope,voteItem.recordUrl)
+							r(curItemRecord)
+						}catch(e){
+							j(e)
 						}
-					}).catch(err => {
-						j(err)
-					})
+					}
+					
 				})
 			},
 			
 			/* 根据已结束的RecordUrl来获取投票结果数据 */
-			getRecordUrlData(){
-				
+			getBlobJsonFile(scope,url){
+				return new Promise(async (resolve,reject) => {
+					let blobHost = scope === 'private' ?  JSON.parse(decodeURIComponent(localStorage.user_profile, "utf-8")).blob_uri : JSON.parse(decodeURIComponent(localStorage.school_profile, "utf-8")).blob_uri
+					// 根据试卷的Blob地址 去读取JSON文件
+					let sasString = scope === 'private' ?  await this.$tools.getPrivateSas() : await this.$tools.getSchoolSas()
+					try{
+						let itemJson = JSON.parse(await this.$tools.getFile(blobHost + url + sasString.sas))
+						resolve(itemJson)
+					}catch(e){
+						this.$Message.error('文件获取失败!')
+						reject(e)
+					}
+				})
 			},
 			
 
@@ -325,7 +347,7 @@
 				this.isLoading = true
 				let records = await this.getVoteRecord(voteItem)
 				//  先查找 投票发布对象关联的学生清单 然后再去判断学生的作答情况
-				console.log(voteItem)
+				console.log('当前投票的作答数据======',records)
 				this.$api.schoolSetting.getClassroomStudent({
 					school_code: this.$store.state.userInfo.schoolCode,
 					ids: voteItem.classes,
@@ -339,7 +361,7 @@
 									id: i.id,
 									name: i.name,
 									no: i.no,
-									classroomName: i.classId
+									classroomName: i.className
 								})
 							})
 						})
@@ -363,16 +385,15 @@
 							console.log(this.studentsTable)
 							this.tableData = arr
 						} else {
+							this.studentsTable = []
 							this.tableData = []
 						}
-						this.isLoading = false
 					} else {
 						this.$Message.error(this.$t('vote.getDataFailTip'))
-						this.isLoading = false
 					}
 				}).catch(err => {
-					console.log(err)
 					this.$Message.error(this.$t('vote.getClassDataFailTip'))
+				}).finally(() => {
 					this.isLoading = false
 				})
 			},

+ 4 - 3
TEAMModelOS/Controllers/Common/ExamController.cs

@@ -835,6 +835,7 @@ namespace TEAMModelOS.Controllers
                 //if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
                 if (!requert.TryGetProperty("studentId", out JsonElement studentId)) return BadRequest();
                 if (!requert.TryGetProperty("code", out JsonElement school)) return BadRequest();
+                if(!requert.TryGetProperty("scode", out JsonElement scode)) return BadRequest();
                 var client = _azureCosmos.GetCosmosClient();
                 var query = $"select c.id,c.code,A0.id paperId,A0.code paperCode,A0.name paperName,A0.multipleRule,A0.scope,A0.blob from c join A0 in c.papers where c.id ='{id}'";
                 List<object> papers = new List<object>();
@@ -873,7 +874,7 @@ namespace TEAMModelOS.Controllers
                     }
                 }
                 var queryClassId = $"select c.targetClassIds id from c where c.id ='{id}'";
-                await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: queryClassId, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Exam-{school}") }))
+                await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: queryClassId, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{scode}") }))
                 {
                     using var json = await JsonDocument.ParseAsync(item.ContentStream);
                     if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
@@ -895,7 +896,7 @@ namespace TEAMModelOS.Controllers
                         infoIds.Add(ids);
                     }
                 }
-                await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Exam-{school}") }))
+                await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{scode}") }))
                 {
                     using var json = await JsonDocument.ParseAsync(item.ContentStream);
                     if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
@@ -908,7 +909,7 @@ namespace TEAMModelOS.Controllers
                 }
                 var querySubject = $"select A0.id,A0.name from c join A0 in c.subjects where c.id ='{id}'";
                 //List<object> props = new List<object>();
-                await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: querySubject, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Exam-{school}") }))
+                await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: querySubject, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{scode}") }))
                 {
                     using var json = await JsonDocument.ParseAsync(item.ContentStream);
                     if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)