Browse Source

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

zhouj1203@hotmail.com 3 years ago
parent
commit
134107d62b

+ 1 - 1
TEAMModelFunction/MonitorServicesBus.cs

@@ -273,7 +273,7 @@ namespace TEAMModelFunction
             var client = _azureCosmos.GetCosmosClient();
             try
             {
-                await _dingDing.SendBotMsg($"ServiceBus,StuList:{msg}", GroupNames.醍摩豆服務運維群組);
+              
                 var jsonMsg = JsonDocument.Parse(msg);
                 StuListChange stuListChange = msg.ToObject<StuListChange>();
                 //名单变动修改学生课程关联信息

+ 4 - 2
TEAMModelOS.SDK/Models/Service/StuListService.cs

@@ -178,7 +178,8 @@ namespace TEAMModelFunction
                         scope = course.scope,
                         school = course.school,
                         creatorId = course.creatorId,
-                        pk = "StuCourse"
+                        pk = "StuCourse",
+                        stulist = new List<string> { stuListChange.listid }
                     };
                     await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-StuListService-FixStuCourse\n名单发生变更 新建课程中间表\n{stucourse.ToJsonString()}", GroupNames.醍摩豆服務運維群組);
                     await client.GetContainer("TEAMModelOS", "Student").UpsertItemAsync(stucourse, new PartitionKey(stucourse.code));
@@ -195,7 +196,8 @@ namespace TEAMModelFunction
                         scope = course.scope,
                         school = course.school,
                         creatorId = course.creatorId,
-                        pk = "StuCourse"
+                        pk = "StuCourse",
+                        stulist= new List<string> { stuListChange .listid}
                     };
                     await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-StuListService-FixStuCourse\n名单发生变更 新建课程中间表\n{stucourse.ToJsonString()}", GroupNames.醍摩豆服務運維群組);
                     await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync(stucourse, new PartitionKey(stucourse.code));

+ 4 - 0
TEAMModelOS/ClientApp/src/api/courseMgmt.js

@@ -102,4 +102,8 @@ export default {
     delStuList: function (data) {
         return post('/school/course/delete-list', data)
     },
+    // 加入课程
+    qrCodeJoinList: function (data) {
+        return post('/school/course/scan-code-join-list', data)
+    },
 }

+ 21 - 4
TEAMModelOS/ClientApp/src/common/BaseClassSelectPri.vue

@@ -14,7 +14,11 @@ export default {
         scope: {
             type: String,
             default: 'school'
-        }
+        },
+		classes:{
+			type:Array,
+			default:() => []
+		}
     },
     data() {
         const _this = this
@@ -24,8 +28,8 @@ export default {
             },
             courseList: [],
             stuList: [],
+			classIds:[],
             schoolClassList: [],
-            classes: [],
             evaluationInfo: {
                 scope: 'private'
             },
@@ -173,7 +177,7 @@ export default {
     methods: {
         treeChange(data) {
             let classIds = data.map(i => i[i.length - 1])
-            this.classes = classIds
+            this.classIds = classIds
             this.$emit('onChange', classIds)
         },
         onClassTypeChange(val) {
@@ -222,7 +226,20 @@ export default {
 		    user.schools.filter((i) => i.status === "join").length > 0
 		  );
 		},
-    }
+    },
+	watch:{
+		classes:{
+			handler(n,o){
+				if(n.length){
+					// let curYear = new Date().getFullYear()
+					// this.defaultArr = n.map(i => [i.periodId,'class',curYear - i.year - 1,i.id])
+					console.log(n);
+				}
+			},
+			immediate:true,
+			deep:true
+		}
+	}
 };
 </script>
 <style lang="less">

+ 2 - 2
TEAMModelOS/ClientApp/src/components/questionnaire/BaseProgress.vue

@@ -21,7 +21,7 @@
 				let option = {
 					// backgroundColor: 'rgba(255,255,255,0.05)',
 					title: {
-						text: (((this.total - this.noAnswerdCount) / this.total) * 100).toFixed(2)+ '%',
+						text: this.total > 0 ? (((this.total - this.noAnswerdCount) / this.total) * 100).toFixed(2)+ '%' : '0.00%',
 						textStyle: {
 							color: color[2],
 							fontSize: 20
@@ -105,7 +105,7 @@
 						}, {
 							type: 'bar',
 							z: 10,
-							data: [((this.total - this.noAnswerdCount) / this.total).toFixed(2) * 100 ],
+							data: this.total > 0 ? [((this.total - this.noAnswerdCount) / this.total).toFixed(2) * 100 ] : [0],
 							showBackground: false,
 							backgroundStyle: {
 								color: "blue",

+ 19 - 10
TEAMModelOS/ClientApp/src/components/questionnaire/BaseQnForm.vue

@@ -12,7 +12,7 @@
 					<Radio label="school">{{ $t('survey.form.schoolClass') }}</Radio>
 				</RadioGroup> -->
 				<div v-if="!qnFormEdit && curQnItem" class="vote-class">
-					<span v-for="item in curQnItem.classes" class="vote-class-item">{{ getTargetName(item) }}</span>
+					<span v-for="item in classIds" class="vote-class-item">{{ getTargetName(item) }}</span>
 				</div>
 				<!-- <Select multiple v-model="qnForm.classes" :class="!qnFormEdit ? 'qn-form-disabled':''"
 					:placeholder="$t('survey.form.targetPlace')" v-else>
@@ -20,8 +20,8 @@
 						:key="index">{{ item.name }}</Option>
 				</Select> -->
 				<div v-else>
-					<BaseClassSelect :classes="classNameArr" @onChange="onTargetChange" v-if="getCurScope === 'school'"></BaseClassSelect>
-					<BaseClassSelectPri ref="classSelectRef" @onChange="onTargetChange" v-else></BaseClassSelectPri>
+					<BaseClassSelect :classes="classNameArr" @onChange="onTargetChange" ref="classSelectRef" v-if="getCurScope === 'school'"></BaseClassSelect>
+					<BaseClassSelectPri :classes="classNameArr" ref="classSelectRef" @onChange="onTargetChange" v-else></BaseClassSelectPri>
 				</div>
 			</FormItem>
 
@@ -122,6 +122,7 @@
 					code: "",
 					name: "",
 					classes: [],
+					stuLists:[],
 					startTime: 0,
 					endTime: 0,
 					resource: []
@@ -166,7 +167,8 @@
 						let data = _this.qnForm.startTime ? _this.qnForm.startTime : Date.now()
 					    return data && data > date.valueOf() + 86400000
 					}
-				}
+				},
+				classIds:[]
 			}
 		},
 		methods: {
@@ -207,9 +209,11 @@
 				return new Promise((resolve, reject) => {
 					this.$refs[name].validate((valid) => {
 						if (valid && this.getSimpleText(this.qnForm.description) && this.qnForm.classes.length) {
+							console.log('1111111111')
 							let params = JSON.parse(JSON.stringify(this.defaultParams))
 							let target = []
-							let isPersonal = this.$route.name === 'personalVote' && this.$refs.classSelectRef.evaluationInfo.scope  === 'private'
+							let classSelectScope = this.$refs.classSelectRef.evaluationInfo.scope
+							let isPersonal = this.$route.name === 'personalVote' && classSelectScope  === 'private'
 							params.code = this.getCurCode
 							// 如果个人问卷的班级是校本班级 那么也要把scope置为school
 							params.scope = isPersonal ? 'private' : 'school'
@@ -223,7 +227,6 @@
 							params.creatorId = this.$store.state.userInfo.TEAMModelId
 							params.school = params.scope === 'school' ? this.$store.state.userInfo
 								.schoolCode : null
-
 							// 如果是编辑状态 则直接复制ID 如果是新增 则直接赋值新ID
 							if (this.isEdit && this.editInfo.id && this.editInfo.code) {
 								params.id = this.editInfo.id
@@ -231,7 +234,11 @@
 							} else {
 								params.id = this.$tools.guid()
 							}
-							params.classes = this.qnForm.classes
+							if(classSelectScope === 'school'){
+								params.classes = this.qnForm.classes
+							}else{
+								params.stuLists = this.qnForm.classes
+							}
 							console.log(params)
 							resolve(params)
 						} else {
@@ -311,12 +318,14 @@
 				// if (!this.classRooms.length) {
 				// 	this.classRooms = await this.getClassrooms(this.userInfo.TEAMModelId)
 				// }
-				if(item.classes.length){
-					this.classNameArr = await this.getClassNameByIds(item.classes)
+				if(item.id){
+					this.classNameArr = item.classes.length ? await this.getClassNameByIds(item.classes) : await this.getClassNameByIds(item.stuLists)
+					this.classIds = item.classes.length ? item.classes : item.stuLists
 				}
+				
 				this.qnForm = {
 					name: item.name,
-					classes: item.classes || [],
+					classes: this.classIds || [],
 					startTime: item.startTime ? new Date(item.startTime) : '',
 					endTime: item.endTime ? new Date(item.endTime) : '',
 					description: item.description,

+ 1 - 1
TEAMModelOS/ClientApp/src/components/questionnaire/BaseQuestionnaire.less

@@ -14,7 +14,7 @@
     background: #fff;
     padding: 30px 6%;
 	padding-bottom: 100px;
-	
+	font-family: 'NotoSerif', '微软正黑体', 'Microsoft JhengHei UI', 'Microsoft JhengHei', Sans-serif;
 
 	
 	.tools-bar{

+ 4 - 0
TEAMModelOS/ClientApp/src/components/questionnaire/BaseQuestionnaire.vue

@@ -260,6 +260,7 @@
 			// 获取blob里的试题数据
 			getBlobItems(qnItem){
 				return new Promise(async (resolve,reject) => {
+					console.log(qnItem);
 					let blobHost = qnItem.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 = qnItem.scope === 'private' ?  await this.$tools.getPrivateSas() : await this.$tools.getSchoolSas()
@@ -306,7 +307,9 @@
 			
 			/* 根据学生的作答记录 处理成 图表需要的记录 */
 			makeItemResult(result,items) {
+				console.log(result,items)
 				let arr = [];
+				if(result.records.length === 0) return
 				items.forEach((item, index) => {
 					let obj = {};
 					let resultArr = [];
@@ -358,6 +361,7 @@
 			
 			async getQnRecord(item) {
 				return new Promise(async (r, j) => {
+					console.log(item)
 					if(item.progress === 'finish' && item.recordUrl){
 						try{
 							let finishRecord = await this.getBlobJsonFile(item.scope,item.recordUrl)

+ 1 - 24
TEAMModelOS/ClientApp/src/components/student-web/HomeView/CourseList.vue

@@ -377,29 +377,6 @@ export default {
             })
             
         },
-        /* getNewClass(nowCourse, j) {
-            if(nowCourse.course.schedule[j].time.length > 0) {
-                var list = []
-                for (let m = 0; m < nowCourse.course.schedule[j].time.length; m++) {
-                    var data = this._.cloneDeep(nowCourse.course)
-                    delete data.schedule
-                    data.school = nowCourse.stuCourse.school
-                    data.scope = nowCourse.stuCourse.scope
-                    // 拼接得到一个唯一的标识
-                    data.unique = nowCourse.course.no + nowCourse.course.schedule[j].time[m].week + nowCourse.course.schedule[j].time[m].id
-                    data.classId = nowCourse.course.schedule[j].classId
-                    data.room = nowCourse.course.schedule[j].room
-                    data.teacherId = nowCourse.course.schedule[j].teacherId
-                    data.notice = nowCourse.course.schedule[j].notice
-                    data.stuList = nowCourse.course.schedule[j].stulist
-                    data.timeId = nowCourse.course.schedule[j].time[m].id
-                    data.timeWeek = nowCourse.course.schedule[j].time[m].week
-                    list.push(data)
-                }
-                console.log(list);
-                return list
-            }
-        }, */
         // 新增数组
         getNewClass(data, schedule, m) {
             data.classId = schedule.classId
@@ -422,7 +399,7 @@ export default {
         },
         // 处理上课时间
         getClassTime() {
-            if(this.period != undefined) {
+            if(this.period != undefined && this.fixList.length) {
                 // 选出该年级的上课时间
                 var grades = this._.cloneDeep(this.period)
                 for (let i = 0; i < grades.length; i++) {

+ 7 - 4
TEAMModelOS/ClientApp/src/components/vote/BaseVoteForm.vue

@@ -11,7 +11,7 @@
 					<Radio label="school">{{ $t('vote.form.schoolClass') }}</Radio>
 				</RadioGroup> -->
 				<div v-if="!voteFormEdit && curVoteItem" class="vote-class">
-					<span v-for="item in curVoteItem.classes" class="vote-class-item">{{ getTargetName(item) }}</span>
+					<span v-for="item in classIds" class="vote-class-item">{{ getTargetName(item) }}</span>
 				</div>
 				<!-- <Select multiple v-model="voteForm.classes" :class="!voteFormEdit ? 'vote-form-disabled':''" :placeholder="$t('vote.form.targetPlace')"
 				 :not-found-text="$t('vote.form.noFoundText')" v-else>
@@ -19,7 +19,7 @@
 				</Select> -->
 				<div v-else>
 					<BaseClassSelect :classes="classNameArr" @onChange="onTargetChange" v-if="getCurScope === 'school'"></BaseClassSelect>
-					<BaseClassSelectPri ref="classSelectRef" @onChange="onTargetChange" v-else></BaseClassSelectPri>
+					<BaseClassSelectPri :classes="classNameArr" ref="classSelectRef" @onChange="onTargetChange" v-else></BaseClassSelectPri>
 				</div>
 				
 				<!-- <el-cascader size="small" :show-all-levels="false" clearable filterable v-model="voteForm.classes" :options="csOptions" :props="props" @change="treeChange" style="width:100%;">
@@ -212,7 +212,8 @@
 						let data = _this.voteForm.startTime ? _this.voteForm.startTime : Date.now()
 					    return data && data > date.valueOf() + 86400000
 					}
-				}
+				},
+				classIds:[]
 			}
 		},
 		created() {
@@ -531,6 +532,7 @@
 				// }
 				if(item.id){
 					this.classNameArr = item.classes.length ? await this.getClassNameByIds(item.classes) : await this.getClassNameByIds(item.stuLists)
+					this.classIds = item.classes.length ? item.classes : item.stuLists
 				}
 				console.log(this.classNameArr)
 				this.voteForm = null
@@ -540,7 +542,7 @@
 				this.voteForm = {
 					name: item.name,
 					code: item.code,
-					classes: item.classes || [],
+					classes: this.classIds,
 					startTime: item.startTime ? new Date(item.startTime) : '',
 					endTime: item.endTime ? new Date(item.endTime) : '',
 					description: item.description,
@@ -594,6 +596,7 @@
 				// 		return res.filter(i => i.id === classId)[0].name
 				// 	})
 				// }
+				console.log(classId);
 				return this.classNameArr.find(i => i.id === classId) ? this.classNameArr.find(i => i.id === classId).name : this.$t('vote.form.noMatchDataTip')
 			}
 		},

+ 17 - 47
TEAMModelOS/ClientApp/src/view/joinclass/JoinClass.vue

@@ -26,7 +26,7 @@
                 </p>
             </div>
 
-            <div class="join-btn" @click="findList()">
+            <div class="join-btn" @click="joinList()">
                 {{$t('cusMgt.join.joinBtn')}}
             </div>
         </div>
@@ -36,7 +36,7 @@
                     {{$t('cusMgt.join.title')}}
                 </span>
             </p>
-            <Icon type="md-checkmark-circle-outline" color="#19be6b" size="120"/>
+            <Icon type="md-checkmark-circle-outline" color="#19be6b" size="120" />
             <p class="success-tips">{{$t('cusMgt.join.hasJoin')}}</p>
         </div>
     </div>
@@ -49,7 +49,7 @@ export default {
             isJoin: false,
             tId: '',
             tName: '',
-            listId: '',
+            listNo: '',
             listName: '',
             cusName: '',
             code: '',
@@ -57,52 +57,22 @@ export default {
         }
     },
     methods: {
-        joinList(stulist) {
-            if (stulist) {
-                stulist.tmids.push(this.userId)
-                this.$api.courseMgmt.upsertStulist({
-                    scope: 'private',
-                    stuList: stulist
-                }).then(
-                    res => {
-                        if (!res.error) {
-                            this.$Message.success(this.$t('cusMgt.join.joinOk'))
-                            this.isJoin = true
-                        } else {
-                            this.$Message.error(this.$t('cusMgt.join.joinErr'))
-                        }
-                    },
-                    err => {
-                        this.$Message.error(this.$t('cusMgt.join.joinErr'))
-                    }
-                )
-            } else {
-                this.$Message.error(this.$t('cusMgt.join.getListErr'))
-            }
-        },
-        //查询名单详细信息
-        findList() {
-            let params = {
-                code: this.tId,
-                ids: [this.listId],
-                scope: 'private'
-            }
-            this.$api.courseMgmt.findListSummary(params).then(
+        joinList() {
+            this.$api.courseMgmt.qrCodeJoinList({
+                stuListNo: this.listNo,
+                tmdId: this.userId,
+                school: undefined //加入行政班时需要传对应编码,个人名单不用传
+            }).then(
                 res => {
-                    if (!res.error && res.stuList && res.stuList.length) {
-                        if (res.stuList[0].tmids.includes(this.userId)) {
-                            this.isJoin = true
-                        } else if(this.userId){
-                            this.joinList(res.stuList[0])
-                        }else{
-                            this.$Message.error(this.$t('cusMgt.join.getErr'))
-                        }
+                    if (!res.error) {
+                        this.$Message.success(this.$t('cusMgt.join.joinOk'))
+                        this.isJoin = true
                     } else {
-                        this.$Message.error(this.$t('cusMgt.join.getListErr'))
+                        this.$Message.error(this.$t('cusMgt.join.joinErr'))
                     }
                 },
                 err => {
-                    this.$Message.error(this.$t('cusMgt.join.getListErr'))
+                    this.$Message.error(this.$t('cusMgt.join.joinErr'))
                 }
             )
         }
@@ -110,11 +80,11 @@ export default {
     created() {
         this.tId = this.$route.query.tId //教师id
         this.tName = this.$route.query.tName //教师姓名
-        this.listId = this.$route.query.listId   //名单id
+        this.listNo = this.$route.query.listNo   //名单id
         this.listName = this.$route.query.listName //名单
         this.cusName = this.$route.query.cusName  //课程名称
         this.code = this.$route.query.code  //登录成功返回的code
-        if (!this.listId || !this.tId || !this.code) {
+        if (!this.listNo || !this.code) {
             this.$Modal.error({
                 title: this.$t('cusMgt.join.errorTile'),
                 content: this.$t('cusMgt.join.errorContent')
@@ -152,7 +122,7 @@ export default {
 }
 </script>
 <style scoped lang="less">
-.success-tips{
+.success-tips {
     color: white;
     font-size: 16px;
     margin-top: 20px;

+ 1 - 1
TEAMModelOS/ClientApp/src/view/learnactivity/Scoring.vue

@@ -303,7 +303,7 @@ export default {
                     this.paperInfo[this.chooseClass] = {}
                 }
                 let classStu = {
-                    students: this.examInfo.scope == 'private' ? stuRes.stus || [] : stuRes.stus[0] || [],
+                    students: this.examInfo.scope == 'private' ? stuRes.stus.concat(stuRes.tmdinfos) || [] : stuRes.stus[0] || [],
                     id: this.chooseClass
                 }
                 this.$set(this.paperInfo[this.chooseClass], "students", classStu)

+ 1 - 2
TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.vue

@@ -975,7 +975,6 @@ export default {
         showQrCode(index) {
             console.log(this.teaClassList)
             this.showQrStatus = true
-            let tId = this.$store.state.userInfo.TEAMModelId
             let tName = this.$store.state.userInfo.name
             let listId = this.teaClassList[index].stulist
             let listName = this.teaClassList[index].listName
@@ -1013,7 +1012,7 @@ export default {
             let idToken = localStorage.getItem('id_token')
             let tokenData = jwtDecode(idToken)
             let nonce = tokenData ? tokenData.nonce : ''
-            let callbackUrl = `${host}/joinclass?tId=${tId}&listName=${listName}&tName=${tName}&listId=${listId}&cusName=${cusName}`
+            let callbackUrl = `${host}/joinclass?listName=${listName}&tName=${tName}&listNo=${this.stuListNo}&cusName=${cusName}`
             let dcUrl = encodeURIComponent(callbackUrl)
             let loginUrl = `https://account.teammodel.cn?response_type=code&client_id=${clientId}&state=${state}&nonce=${nonce}&redirect_uri=${dcUrl}`
             this.inviteUrl = loginUrl

+ 1 - 0
TEAMModelOS/ClientApp/src/view/questionnaire/ManageQuestionnaire.less

@@ -14,6 +14,7 @@
     height: 100%;
     display: flex;
     flex-direction: column;
+	font-family: 'NotoSerif', '微软正黑体', 'Microsoft JhengHei UI', 'Microsoft JhengHei', Sans-serif;
 	
 	.qn-header{
 		height: 50px;

+ 2 - 1
TEAMModelOS/ClientApp/src/view/questionnaire/ManageQuestionnaire.vue

@@ -214,6 +214,7 @@
 					let defaultQn = {
 						name: this.$t('survey.defaultName'),
 						classes: [],
+						stuLists: [],
 						endTime: new Date(new Date().toLocaleDateString()).getTime() + 2 * 24 * 60 * 60 * 1000 - 1,
 						startTime:new Date().getTime(),
 						description: "",
@@ -449,7 +450,7 @@
 					//  先查找 投票发布对象关联的学生清单 然后再去判断学生的作答情况
 					this.$api.schoolSetting.getClassroomStudent({
 						school_code: this.$store.state.userInfo.schoolCode,
-						ids: surveyItem.classes,
+						ids: surveyItem.classes.length ? surveyItem.classes : surveyItem.stuLists,
 						scope:surveyItem.scope
 					}).then(res => {
 						if (!res.error) {

+ 8 - 3
TEAMModelOS/ClientApp/src/view/teachcontent/index.vue

@@ -90,6 +90,9 @@
                             <b class="title">{{ filterPeriodName }}</b>
                             <Icon type="ios-arrow-down" style="margin-left:8px;"></Icon>
                         </span>
+                        <DropdownMenu slot="list" value="all">
+                            <DropdownItem name="all">全部</DropdownItem>
+                        </DropdownMenu>
                         <DropdownMenu slot="list" v-for="(item,index) in schoolBase.period" :value="item.id" :key="index">
                             <DropdownItem :name="item.id">{{ item.name }}</DropdownItem>
                         </DropdownMenu>
@@ -392,7 +395,7 @@ export default {
                     // 更新源数据
                     let type = this.fileListShow[editIndex].type
                     for (let index = 0; index < this.fileList[type].length; index++) {
-                        if(this.fileList[type][index].id == this.fileListShow[editIndex].id){
+                        if (this.fileList[type][index].id == this.fileListShow[editIndex].id) {
                             this.fileList[type].splice(index, 1, this.fileListShow[editIndex])
                             break
                         }
@@ -1183,7 +1186,7 @@ export default {
                     "name": this.routerScope == 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId,
                     "type": this.activeType,
                     "scope": this.routerScope,
-                    "periodId": this.routerScope == 'school' ? this.filterPeriod : ''
+                    "periodId": this.routerScope == 'school' ? this.filterPeriod == 'all' ? '' : this.filterPeriod : ''
                 }
                 this.$api.blob.listBlobInfo(rd, this.urlString, this.containerName).then(
                     res => {
@@ -1358,7 +1361,9 @@ export default {
                 let data = this.schoolBase.period
                 let pId = this.filterPeriod
                 let name = ''
-                if (pId !== '') {
+                if (pId == 'all') {
+                    return '全部'
+                } else {
                     let temp = data.filter(item => {
                         return pId == item.id
                     })

+ 1 - 1
TEAMModelOS/ClientApp/src/view/vote/ManageVote.vue

@@ -411,7 +411,7 @@
 					console.log('当前投票的作答数据======', records)
 					this.$api.schoolSetting.getClassroomStudent({
 						school_code: this.$store.state.userInfo.schoolCode,
-						ids: voteItem.classes,
+						ids: voteItem.classes.length ? voteItem.classes : voteItem.stuLists,
 						scope: voteItem.scope
 					}).then(res => {
 						if (!res.error && res.stus.length) {

+ 0 - 41
TEAMModelOS/Controllers/Client/Models/Class.cs

@@ -1,41 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace TEAMModelOS.Controllers.Client.Models
-{
-    public class ChannelRequest
-    {  
-        /// <summary>
-        /// 請填Client Name (HiTeach、HiTeachCC)
-        /// </summary>
-        [Required]
-        public string id_token { get; set; }
-
-       
-        
-
-        /// <summary>
-        /// 教室PIN碼
-        /// </summary>
-        [Required]
-        public string pin { get; set; }
-
-        /// <summary>
-        /// 區網IP,動態申請可不填
-        /// </summary>
-        public string local_ip { get; set; }
-
-        /// <summary>
-        /// 教室評道號碼,如無傳入為動態頻道號碼,一天過期
-        /// </summary>
-        public string channel { get; set; }
-
-        /// <summary>
-        /// 如有學校簡碼請輸入
-        /// </summary>
-        public string school_code { get; set; }
-    }
-}

+ 73 - 0
TEAMModelOS/Controllers/School/CourseController.cs

@@ -238,6 +238,79 @@ namespace TEAMModelOS.Controllers
         }
             
          */
+        /// <summary>
+        /// 扫码加入名单
+        /// </summary>
+        /// <param name="json"></param>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        [HttpPost("scan-code-join-list")]
+        public async Task<IActionResult> ScanCodeJoinList(JsonElement json)
+        {
+            try
+            {
+
+                if (!json.TryGetProperty("stuListNo", out JsonElement _stuListNo)) return BadRequest();
+               
+                json.TryGetProperty("school", out JsonElement _school);
+                string school = $"{_school}";
+                var client = _azureCosmos.GetCosmosClient();
+                var queryNo = $"SELECT  *  FROM c where  c.no ='{_stuListNo}'";
+                StuList stuList = null;
+                json.TryGetProperty("studentId", out JsonElement _studentId);
+                json.TryGetProperty("tmdId", out JsonElement _tmdId);
+                if (!string.IsNullOrEmpty(school)&&!string.IsNullOrEmpty($"{_studentId}") )
+                {
+                    await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: queryNo,
+                          requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList-{school}") }))
+                    {
+                        using var jsonNo = await JsonDocument.ParseAsync(item.ContentStream);
+                        if (jsonNo.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
+                        {
+                            var stuDoc = jsonNo.RootElement.GetProperty("Documents").EnumerateArray();
+                            while (stuDoc.MoveNext())
+                            {
+                                JsonElement data = stuDoc.Current;
+                                stuList = data.ToObject<StuList>();
+                                if (stuList != null)
+                                {
+                                    (int status, StuList stuLis) = JoinList(stuList, $"{_studentId}", $"{_tmdId}", school);
+                                    stuLis = await upsertList(stuList, "school");
+                                    return Ok(new { status, stuLis });
+                                }
+                            }
+                        }
+                    }
+                }
+                await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryStreamIterator(queryText: queryNo,
+                    requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList") }))
+                {
+                    using var jsonNo = await JsonDocument.ParseAsync(item.ContentStream);
+                    if (jsonNo.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
+                    {
+                        var stuDoc = jsonNo.RootElement.GetProperty("Documents").EnumerateArray();
+                        while (stuDoc.MoveNext())
+                        {
+                            JsonElement data = stuDoc.Current;
+                            stuList = data.ToObject<StuList>();
+                            if (stuList != null)
+                            {
+                                (int status, StuList stuLis) = JoinList(stuList, $"{_studentId}", $"{_tmdId}", school);
+                                stuLis = await upsertList(stuList, "private");
+                                return Ok(new { status, stuLis });
+                            }
+                        }
+                    }
+                }
+                return Ok(new { status = -1 });
+            }
+            catch (Exception ex)
+            {
+                await _dingDing.SendBotMsg($"OS,{_option.Location},course/get-list-by-no()\n{ex.Message}", GroupNames.醍摩豆服務運維群組);
+                return BadRequest();
+            }
+        }
+
 
         /// <summary>
         /// 根据邀请码加入名单

+ 4 - 5
TEAMModelOS/TEAMModelOS.csproj

@@ -37,11 +37,10 @@
     <SpaRoot>ClientApp\</SpaRoot>
     <DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
     <UserSecretsId>078b5d89-7d90-4f6a-88fc-7d96025990a8</UserSecretsId>
-    <Version>5.2107.21</Version>
-    <AssemblyVersion>5.2107.21.1</AssemblyVersion>
-    <FileVersion>5.2107.20.3</FileVersion>
-    <Description>1.HiTeach API :掃碼加入學生相關處理
-2.字串檔變更</Description>
+    <Version>5.2107.26</Version>
+    <AssemblyVersion>5.2107.26.1</AssemblyVersion>
+    <FileVersion>5.2107.26.1</FileVersion>
+    <Description>修复学生端扫码加入课程名单,联动触发相关课程和活动。</Description>
     <PackageReleaseNotes>版本说明</PackageReleaseNotes>
   </PropertyGroup>
   <Target Name="DebugEnsureNodeEnv" BeforeTargets="Build">