瀏覽代碼

Merge branch 'develop6.0-tmd' of http://52.130.252.100:10000/TEAMMODEL/TEAMModelOS into develop6.0-tmd

XW 3 年之前
父節點
當前提交
71f1036f10
共有 25 個文件被更改,包括 1212 次插入710 次删除
  1. 1 0
      TEAMModelOS.SDK/Models/Cosmos/School/TeacherImport.cs
  2. 二進制
      TEAMModelOS/ClientApp/src/assets/image/no-poster-cn.png
  3. 二進制
      TEAMModelOS/ClientApp/src/assets/image/no-poster-en.png
  4. 二進制
      TEAMModelOS/ClientApp/src/assets/image/no-poster-tw.png
  5. 10 4
      TEAMModelOS/ClientApp/src/common/AbilityUpload.vue
  6. 1 1
      TEAMModelOS/ClientApp/src/common/BaseNotification.vue
  7. 1 1
      TEAMModelOS/ClientApp/src/locale/lang/en-US/home.js
  8. 1 1
      TEAMModelOS/ClientApp/src/locale/lang/zh-CN/home.js
  9. 1 1
      TEAMModelOS/ClientApp/src/locale/lang/zh-TW/home.js
  10. 600 560
      TEAMModelOS/ClientApp/src/view/ability/Review.vue
  11. 110 0
      TEAMModelOS/ClientApp/src/view/evaluation/components/BaseHiteachPaper.vue
  12. 1 0
      TEAMModelOS/ClientApp/src/view/evaluation/index/CommonExercise.less
  13. 7 2
      TEAMModelOS/ClientApp/src/view/evaluation/index/TestPaper.vue
  14. 18 0
      TEAMModelOS/ClientApp/src/view/homepage/HomePage.less
  15. 47 3
      TEAMModelOS/ClientApp/src/view/homepage/HomePage.vue
  16. 47 0
      TEAMModelOS/ClientApp/src/view/homepage/RcdPoster.vue
  17. 2 2
      TEAMModelOS/ClientApp/src/view/learnactivity/CreateSchoolEva.vue
  18. 6 2
      TEAMModelOS/ClientApp/src/view/learnactivity/ExamMgt.vue
  19. 4 2
      TEAMModelOS/ClientApp/src/view/learnactivity/markpaper/MarkSetting.vue
  20. 9 1
      TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.less
  21. 71 69
      TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.vue
  22. 1 1
      TEAMModelOS/Controllers/Both/LessonRecordController.cs
  23. 1 1
      TEAMModelOS/Controllers/Client/HiTeachController.cs
  24. 55 4
      TEAMModelOS/Controllers/School/SchoolController.cs
  25. 218 55
      TEAMModelOS/Controllers/School/SchoolTeacherController.cs

+ 1 - 0
TEAMModelOS.SDK/Models/Cosmos/School/TeacherImport.cs

@@ -17,6 +17,7 @@ namespace TEAMModelOS.SDK.Models
         // 手机号或者醍摩豆id,可以为空,则没正式加入学校的教师 
         // 手机号或者醍摩豆id,可以为空,则没正式加入学校的教师 
         public string id { get; set; }
         public string id { get; set; }
         public string name { get; set; }
         public string name { get; set; }
+        public string picture { get; set; }
         public string status { get; set; }
         public string status { get; set; }
         public long time { get; set; }
         public long time { get; set; }
         public string tmdid { get; set; }
         public string tmdid { get; set; }

二進制
TEAMModelOS/ClientApp/src/assets/image/no-poster-cn.png


二進制
TEAMModelOS/ClientApp/src/assets/image/no-poster-en.png


二進制
TEAMModelOS/ClientApp/src/assets/image/no-poster-tw.png


+ 10 - 4
TEAMModelOS/ClientApp/src/common/AbilityUpload.vue

@@ -210,15 +210,22 @@
 				for (let i = 0; i < list.length; i++) {
 				for (let i = 0; i < list.length; i++) {
 					let file = list[i]
 					let file = list[i]
 					try {
 					try {
-						let blobFile = await containerClient.upload(file, { path:path,checkSize:true }, {
+						let blobFile = await containerClient.upload(file, { path:path,checkSize:this.auth.name !== 'teammodelos' }, {
 							onProgress: function(e) {
 							onProgress: function(e) {
 								that.$set(that.progressArr, i, parseInt(e.loadedBytes * 100 / file.size))
 								that.$set(that.progressArr, i, parseInt(e.loadedBytes * 100 / file.size))
 							}
 							}
 						});
 						});
+						console.log(blobFile)
 						// 如果上传的是视频文件 则需要获取视频的时长信息和MD5信息
 						// 如果上传的是视频文件 则需要获取视频的时长信息和MD5信息
 						if (blobFile.type === 'video') {
 						if (blobFile.type === 'video') {
-							await this.uploadVideoPoster(blobFile, path, containerClient)
-							blobFile.duration = await this.$tools.getVideoDuration(file)
+							if(blobFile.extension === 'MP4'){
+								await this.uploadVideoPoster(blobFile, path, containerClient)
+								blobFile.duration = await this.$tools.getVideoDuration(file)
+							}else{
+								this.$Message.warning('当前视频可能无法播放,请检查视频编码格式')
+								blobFile.duration = 0
+							}
+							
 						}
 						}
 						let fileMD5 = await this.$tools.getFileMD5(file)
 						let fileMD5 = await this.$tools.getFileMD5(file)
 						blobFile.hash = this.$tools.convertFileMD5ToString(fileMD5)
 						blobFile.hash = this.$tools.convertFileMD5ToString(fileMD5)
@@ -245,7 +252,6 @@
 						let blobFile = await containerClient.upload(f, { path:path,checkSize:false });
 						let blobFile = await containerClient.upload(f, { path:path,checkSize:false });
 						r(blobFile)
 						r(blobFile)
 					} catch (e) {
 					} catch (e) {
-						this.$Message.error('当前视频可能无法播放,请检查视频编码格式')
 						r(e)
 						r(e)
 					}
 					}
 				})
 				})

+ 1 - 1
TEAMModelOS/ClientApp/src/common/BaseNotification.vue

@@ -3,7 +3,7 @@
 		<Badge :count="msgArr.length">
 		<Badge :count="msgArr.length">
 			<Icon type="md-notifications" size="20"  @click="openDrawer"/>
 			<Icon type="md-notifications" size="20"  @click="openDrawer"/>
 		</Badge>
 		</Badge>
-		<Drawer :title="$t('utils.newNotice')" v-model="isOpen" width="400" class-name="base-notification" transfer>
+		<Drawer :title="$t('utils.newNotice')" v-model="isOpen" width="400" class-name="base-notification" transfer :closable="false">
 			<div class="notice-header" slot="header">
 			<div class="notice-header" slot="header">
 				<span style="font-size: 18px;font-weight: bold;">{{ $t('utils.newNotice') }}</span>
 				<span style="font-size: 18px;font-weight: bold;">{{ $t('utils.newNotice') }}</span>
 				<span style="color:red;font-size: 12px;cursor: pointer;" v-if="msgArr.length"
 				<span style="color:red;font-size: 12px;cursor: pointer;" v-if="msgArr.length"

+ 1 - 1
TEAMModelOS/ClientApp/src/locale/lang/en-US/home.js

@@ -1,7 +1,7 @@
 export default{
 export default{
     previewStudy:'Previews before class',
     previewStudy:'Previews before class',
     classData:'Lesson Data',
     classData:'Lesson Data',
-    recentRecord:'Recent Lesson Record',
+    recentRecord:'近期7日課堂記錄',
     acCount:'Activities Overview',
     acCount:'Activities Overview',
     goingList:'List Of Ongoing Activities',
     goingList:'List Of Ongoing Activities',
     scNotice:'School Announcement',
     scNotice:'School Announcement',

+ 1 - 1
TEAMModelOS/ClientApp/src/locale/lang/zh-CN/home.js

@@ -1,7 +1,7 @@
 export default{
 export default{
     previewStudy:'课前预习',
     previewStudy:'课前预习',
     classData:'课堂数据',
     classData:'课堂数据',
-    recentRecord:'近期课堂记录',
+    recentRecord:'近期7日课堂记录',
     acCount:'活动概览',
     acCount:'活动概览',
     goingList:'进行中的活动列表',
     goingList:'进行中的活动列表',
     scNotice:'学校公告',
     scNotice:'学校公告',

+ 1 - 1
TEAMModelOS/ClientApp/src/locale/lang/zh-TW/home.js

@@ -1,7 +1,7 @@
 export default {
 export default {
     previewStudy: '課前預習',
     previewStudy: '課前預習',
     classData: '課堂數據',
     classData: '課堂數據',
-    recentRecord: '近期課堂記錄',
+    recentRecord: '近期7日課堂記錄',
     acCount: '活動概覽',
     acCount: '活動概覽',
     goingList: '進行中',
     goingList: '進行中',
     scNotice: '學校公告',
     scNotice: '學校公告',

文件差異過大導致無法顯示
+ 600 - 560
TEAMModelOS/ClientApp/src/view/ability/Review.vue


+ 110 - 0
TEAMModelOS/ClientApp/src/view/evaluation/components/BaseHiteachPaper.vue

@@ -0,0 +1,110 @@
+<template>
+	<!-- 纸本测验 图片轮播 -->
+	<div class="hiteach-test-container" v-if="isRender">
+		<div v-if="fullImgArr.length">
+			<Carousel v-model="curImgIndex">
+				<CarouselItem v-for="(item,index) in fullImgArr" v-if="isRender">
+					<div class="demo-carousel">
+						<img v-lazy="item">
+					</div>
+				</CarouselItem>
+			</Carousel>
+			<p class="page-footer">{{ $t('answerSheet.tip2') }} {{ curImgIndex + 1 }} {{ $t('answerSheet.tip21') }} / {{ $t('answerSheet.tip9') }} {{ fullImgArr.length }} {{ $t('answerSheet.tip21') }}</p>
+		</div>
+		<div v-else class="empty-box">
+			<img src="@/assets/image/none.png" >
+			<p>{{ $t('vote.noData') }}</p>
+		</div>
+	</div>
+</template>
+
+<script>
+	export default {
+		props:{
+			paper:{
+				type:Object,
+				default:() => {}
+			}
+		},
+		data(){
+			return {
+				isRender:false,
+				curImgIndex:0,
+				fullImgArr:[]
+			}
+		},
+		methods:{
+			async doRender(paper){
+				let curScope = paper.examScope
+				let blobHost = curScope === 'school' ?  JSON.parse(decodeURIComponent(localStorage.school_profile, "utf-8")).blob_uri :  JSON.parse(decodeURIComponent(localStorage.user_profile, "utf-8")).blob_uri
+				let sasString = curScope === 'school' ?  await this.$tools.getSchoolSas() : await this.$tools.getPrivateSas()
+				this.fullImgArr = paper.attachments.map(imgName => blobHost + paper.blob + '/' + imgName + sasString.sas)
+			}
+		},
+		mounted() {
+			this.$EventBus.$off('EvBarChange')
+			this.$EventBus.$on('EvBarChange',index => {
+				if(index === 1){
+					this.isRender = true
+					this.doRender(this.paper)
+				}else{
+					this.isRender = false
+				}
+			})
+			
+		},
+		watch: {
+			paper: {
+				handler(newValue, oldValue) {
+					if (newValue.attachments && newValue.attachments.length) {
+						console.error('HiteachPaper > paper', newValue)
+						if(this.isRender){
+							this.doRender(newValue)
+						}
+					}
+				},
+				immediate: true
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.hiteach-test-container{
+		width: 100%;
+		
+		// .ivu-carousel-track,.ivu-carousel-item{
+		// 	width: 100% !important;
+		// }
+		
+		.demo-carousel{
+			img{
+				margin-left: 4%;
+				width: 92%;
+			}
+			img[lazy=loading] {
+				width: 40px !important;
+				height: 40px !important;
+			}
+		}
+		
+		.page-footer{
+			text-align: center;
+			padding: 10px 0;
+		}
+		
+		.empty-box{
+			width: 100%;
+			display: flex;
+			flex-direction: column;
+			justify-content: center;
+			align-items: center;
+			font-size: 20px;
+			color: #C0C0C0;
+			font-weight: bold;
+			img{
+				width: 400px;
+			}
+		}
+	}
+</style>

+ 1 - 0
TEAMModelOS/ClientApp/src/view/evaluation/index/CommonExercise.less

@@ -153,6 +153,7 @@
   }
   }
   img {
   img {
     vertical-align: middle;
     vertical-align: middle;
+	max-width: 100%;
   }
   }
   .item-btn-toggle {
   .item-btn-toggle {
     position: absolute;
     position: absolute;

+ 7 - 2
TEAMModelOS/ClientApp/src/view/evaluation/index/TestPaper.vue

@@ -7,7 +7,7 @@
 		<div class="paper-main-wrap">
 		<div class="paper-main-wrap">
 			<!-- 试卷内容 -->
 			<!-- 试卷内容 -->
 			<div class="paper-content">
 			<div class="paper-content">
-				<div class="paper-body">
+				<div class="paper-body" v-show="!isHiteachPaper">
 					<!-- 试卷基础信息 -->
 					<!-- 试卷基础信息 -->
 					<div class="paper-base-info" v-show="!isPreview &&  !isPreviewItems">
 					<div class="paper-base-info" v-show="!isPreview &&  !isPreviewItems">
 						<div style="display: flex;">
 						<div style="display: flex;">
@@ -71,6 +71,7 @@
 						ref="exList" :isShowTools="!isPreview" :canFix="canFix" :isExamPaper="isExamPaper || isPreviewItems" @toggleChange="onToggleChange"
 						ref="exList" :isShowTools="!isPreview" :canFix="canFix" :isExamPaper="isExamPaper || isPreviewItems" @toggleChange="onToggleChange"
 						@scoreUpdate="scoreUpdate"></BaseExerciseList>
 						@scoreUpdate="scoreUpdate"></BaseExerciseList>
 				</div>
 				</div>
+				<BaseHiteachPaper v-show="isHiteachPaper" :paper="paperInfo"></BaseHiteachPaper>
 			</div>
 			</div>
 		</div>
 		</div>
 
 
@@ -166,6 +167,7 @@
 		},
 		},
 		data() {
 		data() {
 			return {
 			return {
+				isHiteachPaper:true,
 				editLoading:false,
 				editLoading:false,
 				hasModify:false,
 				hasModify:false,
 				curOrderTempIndex:0,
 				curOrderTempIndex:0,
@@ -443,8 +445,11 @@
 				handler(newValue, oldValue) {
 				handler(newValue, oldValue) {
 					if (newValue.item && newValue.item.length) {
 					if (newValue.item && newValue.item.length) {
 						this.$nextTick(() => {
 						this.$nextTick(() => {
+							this.isHiteachPaper = newValue.qamode === 1
+							if(!this.isHiteachPaper){
+								this.$EventBus.$emit('getNewPaper', newValue)
+							}
 							console.log('TestPaper > paper', newValue)
 							console.log('TestPaper > paper', newValue)
-							this.$EventBus.$emit('getNewPaper', newValue)
 						})
 						})
 						this.curOrderTempIndex = newValue.orderTemp || 0
 						this.curOrderTempIndex = newValue.orderTemp || 0
 						this.paperInfo = newValue
 						this.paperInfo = newValue

+ 18 - 0
TEAMModelOS/ClientApp/src/view/homepage/HomePage.less

@@ -422,4 +422,22 @@
     font-size: 16px;
     font-size: 16px;
     margin-left: 10px;
     margin-left: 10px;
     color: #2d8cf0;
     color: #2d8cf0;
+}
+.rcd-item{
+    display: flex;
+    align-items: center;
+    border-bottom: 1px solid #f3f3f3;
+    padding: 5px 5px 5px 0px;
+    cursor: pointer;
+    &:hover{
+        background: #f3f3f3;
+    }
+}
+.rcd-poster{
+    margin-right: 5px;
+    width: 80px;
+}
+.rcd-time{
+    font-size: 12px;
+    color: #cccccc;
 }
 }

+ 47 - 3
TEAMModelOS/ClientApp/src/view/homepage/HomePage.vue

@@ -223,11 +223,23 @@
                     </div>
                     </div>
                 </div> -->
                 </div> -->
                 <!-- 最近课堂记录-->
                 <!-- 最近课堂记录-->
-                <div class="recent-box">
+                <div class="recent-box" style="padding-right:5px">
                     <p class="text-title">{{$t('home.recentRecord')}}</p>
                     <p class="text-title">{{$t('home.recentRecord')}}</p>
                     <div class="recent-list-wrap">
                     <div class="recent-list-wrap">
                         <vuescroll>
                         <vuescroll>
-                            <EmptyData :textContent="$t('home.noRecord')"></EmptyData>
+                            <EmptyData :textContent="$t('home.noRecord')" v-if="!recentRcdList.length"></EmptyData>
+                            <template v-else>
+                                <div class="rcd-item" v-for="item in recentRcdList" :key="item.id">
+                                    <RcdPoster class="rcd-poster" :poster="item.poster"></RcdPoster>
+                                    <div>
+                                        <p>{{item.name}}</p>
+                                        <p class="rcd-time">
+                                            <Icon type="md-time" color="#70B1E7" />
+                                            {{$jsFn.timeFormat(item.startTime)}}
+                                        </p>
+                                    </div>
+                                </div>
+                            </template>
                         </vuescroll>
                         </vuescroll>
                     </div>
                     </div>
                 </div>
                 </div>
@@ -245,6 +257,7 @@
 import { mapGetters } from 'vuex'
 import { mapGetters } from 'vuex'
 import countTo from 'vue-count-to'
 import countTo from 'vue-count-to'
 import AcCountPie from "./AcCountPie.vue"
 import AcCountPie from "./AcCountPie.vue"
+import RcdPoster from "./RcdPoster.vue"
 import HourDetail from "./HourDetail.vue"
 import HourDetail from "./HourDetail.vue"
 import TechScore from "./TechScore.vue"
 import TechScore from "./TechScore.vue"
 import TeachScore from "./TeachScore.vue"
 import TeachScore from "./TeachScore.vue"
@@ -255,11 +268,12 @@ import SpaceInfo from "./SpaceInfo.vue"
 import BlobTool from '@/utils/blobTool.js'
 import BlobTool from '@/utils/blobTool.js'
 export default {
 export default {
     components: {
     components: {
-        AcCountPie, TechScore, TeachScore, MinTable, HourDetail, countTo, ScoreCount, WeekCount, SpaceInfo
+        AcCountPie, TechScore, TeachScore, MinTable, HourDetail, countTo, ScoreCount, WeekCount, SpaceInfo, RcdPoster
     },
     },
     inject: ['reload'],
     inject: ['reload'],
     data() {
     data() {
         return {
         return {
+            recentRcdList: [],
             sizeLoading: false,
             sizeLoading: false,
             countData: {},
             countData: {},
             platformList: [],
             platformList: [],
@@ -370,6 +384,35 @@ export default {
         }
         }
     },
     },
     methods: {
     methods: {
+        //查询近期课堂记录
+        getRecordList() {
+            let listType = 'school'
+            let params = {
+                "tmdid": this.$store.state.userInfo.TEAMModelId,
+                "scope": listType,
+                "school": this.$store.state.userInfo.schoolCode,
+                "DESC": "startTime",
+                "pageCount": 50,
+                "week": true
+            }
+            this.$api.lessonRecord.getLessonList(params).then(
+                res => {
+                    this.recentRcdList = res.lessonRecords
+                    let sasInfo = {}
+                    let blobInfo = listType === 'school' ? this.$store.state.user.schoolProfile : this.$store.state.user.userProfile
+                    sasInfo.sas = '?' + blobInfo.blob_sas
+                    sasInfo.name = listType === 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId
+                    sasInfo.url = blobInfo.blob_uri.slice(0, blobInfo.blob_uri.lastIndexOf(sasInfo.name) - 1)
+                    this.recentRcdList.forEach(item => {
+                        item.poster = `${sasInfo.url}/${sasInfo.name}/records/${item.id}/Record/CoverImage.jpg${sasInfo.sas}`
+                    })
+                    console.log(this.recentRcdList)
+                },
+                err => {
+                    this.$Message.error(this.$t('cusMgt.rcdErr'))
+                }
+            )
+        },
         // 获取容器空间情况 
         // 获取容器空间情况 
         getBlobSize() {
         getBlobSize() {
             this.sizeLoading = true
             this.sizeLoading = true
@@ -678,6 +721,7 @@ export default {
         this.getSchoolSetting()
         this.getSchoolSetting()
         this.getAcCount()
         this.getAcCount()
         this.getBlobSize()
         this.getBlobSize()
+        this.getRecordList()
         if (this.$store.state.userInfo.hasSchool) {
         if (this.$store.state.userInfo.hasSchool) {
             this.findNotice()
             this.findNotice()
             if (this.$store.state.config.srvAdr == 'China') {
             if (this.$store.state.config.srvAdr == 'China') {

+ 47 - 0
TEAMModelOS/ClientApp/src/view/homepage/RcdPoster.vue

@@ -0,0 +1,47 @@
+<template>
+    <div>
+        <img class="rcd-poster-img" :src="poster" @error="imgError">
+    </div>
+</template>
+<script>
+export default {
+    props: {
+        poster: {
+            type: String,
+            default: ''
+        }
+    },
+    data() {
+        return {
+
+        }
+    },
+    methods: {
+        imgError(event) {
+            let img = event.srcElement;
+            let local = localStorage.getItem('local')
+            switch (local) {
+                case 'zh-cn':
+                    img.src = require('@/assets/image/no-poster-cn.png')
+                    break
+                case 'zh-tw':
+                    img.src = require('@/assets/image/no-poster-tw.png')
+                    break
+                case 'en':
+                    img.src = require('@/assets/image/no-poster-en.png')
+                    break
+                default:
+                    img.src = require('@/assets/image/no-poster-en.png')
+                    break
+            }
+
+            img.onerror = null; //防止闪图
+        },
+    }
+}
+</script>
+<style scoped lang="less">
+.rcd-poster-img {
+    width: 100%;
+}
+</style>

+ 2 - 2
TEAMModelOS/ClientApp/src/view/learnactivity/CreateSchoolEva.vue

@@ -26,8 +26,8 @@
                                     </Tooltip>
                                     </Tooltip>
                                 </label>
                                 </label>
                                 <Select v-model="evaluationInfo.source">
                                 <Select v-model="evaluationInfo.source">
-                                    <!-- 暂时取消创建课中评量 -->
-                                    <Option v-for="(item,index) in $GLOBAL.EV_MODE()" v-show="index != 1" :label="item.label" :value="item.value" :key="index" :disabled="index > 1 && !$store.state.user.schoolProfile.svcStatus.VABAJ6NV">
+                                    <!-- 校本评测开放创建课中评量 -->
+                                    <Option v-for="(item,index) in $GLOBAL.EV_MODE()" :label="item.label" :value="item.value" :key="index" :disabled="index > 1 && !$store.state.user.schoolProfile.svcStatus.VABAJ6NV">
                                         <div>
                                         <div>
                                             <span>
                                             <span>
                                                 {{ item.label }}
                                                 {{ item.label }}

+ 6 - 2
TEAMModelOS/ClientApp/src/view/learnactivity/ExamMgt.vue

@@ -129,7 +129,8 @@
                 <!-- 评测试卷 -->
                 <!-- 评测试卷 -->
                 <ExamPaper v-show="curBarIndex == 1" :examInfo="examDetaiInfo" class="evaluation-base-info"></ExamPaper>
                 <ExamPaper v-show="curBarIndex == 1" :examInfo="examDetaiInfo" class="evaluation-base-info"></ExamPaper>
                 <!-- 阅卷任务 -->
                 <!-- 阅卷任务 -->
-                <ExamTask v-show="curBarIndex == 2" class="evaluation-base-info"></ExamTask>
+                <!-- <ExamTask v-show="curBarIndex == 2" class="evaluation-base-info"></ExamTask> -->
+                <MarkSetting v-show="curBarIndex == 2" ref="markSetting" v-if="examDetaiInfo" :evInfo="examDetaiInfo" v-model="isSetting"></MarkSetting>
             </div>
             </div>
         </Split>
         </Split>
         <!-- 修改评测名称 -->
         <!-- 修改评测名称 -->
@@ -167,12 +168,14 @@ import DataView from "./tabs/DataView.vue"
 import AnswerTable from "./tabs/AnswerTable.vue"
 import AnswerTable from "./tabs/AnswerTable.vue"
 import ExamPaper from "./tabs/ExamPaper.vue"
 import ExamPaper from "./tabs/ExamPaper.vue"
 import ExamTask from "./tabs/ExamTask.vue"
 import ExamTask from "./tabs/ExamTask.vue"
+import MarkSetting from "./markpaper/MarkSetting.vue"
 export default {
 export default {
     components: {
     components: {
-        DataView, AnswerTable, ExamPaper, ExamTask
+        DataView, AnswerTable, ExamPaper, ExamTask, MarkSetting
     },
     },
     data() {
     data() {
         return {
         return {
+            isSetting: false,
             examTargets: [],
             examTargets: [],
             correctData: [],//各科错题分析数据
             correctData: [],//各科错题分析数据
             paperQuInfo: [],
             paperQuInfo: [],
@@ -359,6 +362,7 @@ export default {
             })
             })
         },
         },
         selectBar(index) {
         selectBar(index) {
+			this.$EventBus.$emit('EvBarChange',index)
             this.checkScoreSave(this.handleSelectBar, index)
             this.checkScoreSave(this.handleSelectBar, index)
         },
         },
         handleSelectBar(index) {
         handleSelectBar(index) {

+ 4 - 2
TEAMModelOS/ClientApp/src/view/learnactivity/markpaper/MarkSetting.vue

@@ -17,7 +17,7 @@
             <p class="status-text">
             <p class="status-text">
                 <span style="font-size:16px;color:#ed4014">{{$t('learnActivity.mark.noPublish')}}</span>
                 <span style="font-size:16px;color:#ed4014">{{$t('learnActivity.mark.noPublish')}}</span>
             </p>
             </p>
-            
+
             <span class="setting-btn" @click="isSetting = !isSetting">{{$t('learnActivity.mark.publish')}}</span>
             <span class="setting-btn" @click="isSetting = !isSetting">{{$t('learnActivity.mark.publish')}}</span>
         </div>
         </div>
         <vuescroll v-show="isSetting">
         <vuescroll v-show="isSetting">
@@ -1046,7 +1046,7 @@ export default {
 }
 }
 </script>
 </script>
 <style scoped lang="less">
 <style scoped lang="less">
-.task-tips{
+.task-tips {
     width: 70%;
     width: 70%;
     margin: auto;
     margin: auto;
 }
 }
@@ -1237,5 +1237,7 @@ export default {
     float: right;
     float: right;
     margin-top: -42px;
     margin-top: -42px;
     margin-right: 30px;
     margin-right: 30px;
+    z-index: 999;
+    position: relative;
 }
 }
 </style>
 </style>

+ 9 - 1
TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.less

@@ -418,7 +418,6 @@
 }
 }
 .record-poster-wrap{
 .record-poster-wrap{
     width: 120px;
     width: 120px;
-    background: #f3f3f3;
     height: 65px;
     height: 65px;
     background-size: contain;
     background-size: contain;
     background-repeat: no-repeat;
     background-repeat: no-repeat;
@@ -458,4 +457,13 @@
 .heart-active{
 .heart-active{
     display: inline-block;
     display: inline-block;
     color: #ed4014;
     color: #ed4014;
+}
+.rcd-item{
+    cursor: pointer;
+    display: flex;
+    border-bottom: 1px solid #e8eaec;
+    padding: 15px 0px;
+    &:hover{
+        background: var(--active-item-start);
+    }
 }
 }

+ 71 - 69
TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.vue

@@ -154,79 +154,76 @@
                         <!-- 课堂记录 -->
                         <!-- 课堂记录 -->
                         <div v-show="tabName == 'record'" class="animated fadeIn class-record-wrap">
                         <div v-show="tabName == 'record'" class="animated fadeIn class-record-wrap">
                             <vuescroll>
                             <vuescroll>
-                                <List>
-                                    <ListItem v-for="(item,index) in curRecordList" :key="index">
-                                        <ListItemMeta @click.native="toClassRecoerd(index)" style="cursor: pointer;">
-                                            <div slot="avatar" class="record-poster-wrap" :style="{backgroundImage:`url(${item.poster})`}">
-                                            </div>
-                                            <p slot="title" class="record-name" style="padding-left:10px">
-                                                {{item.name}}
-                                                <span style="float:right;margin-right:20px">
-                                                    <Icon type="md-create" class="edit-ev-name" @click.stop="editRecordName(index)" :title="$t('cusMgt.edRdName')" />
-                                                    <Icon type="md-trash" class="edit-ev-name" @click.stop="delRecord(item.id)" :title="$t('cusMgt.delRcd')" />
-                                                    <Icon :type="isFavorite(item.id) ? 'md-heart':'md-heart-outline'" :class="['edit-ev-name',isFavorite(item.id) ? 'heart-active':'']" @click.stop="toggleFavorite(item)" :title="isFavorite(item.id) ? $t('cusMgt.unfvt') : $t('cusMgt.fvt')" />
-                                                </span>
-                                            </p>
-                                            <div slot="description" style="padding-left:10px;margin-top:10px">
-                                                <!-- 出席人数 -->
-                                                <span class="record-info">
-                                                    <span>{{$t('cusMgt.rcd.attendCount')}}:</span>
-                                                    <span class="record-info-value"> {{item.attendCount}}{{$t('unit.text7')}}</span>
-                                                </span>
-                                                <!-- 总计分 -->
-                                                <span class="record-info">
-                                                    <span>{{$t('cusMgt.rcdScore')}}</span>
-                                                    <span class="record-info-value">
-                                                        {{item.totalPoint}}
-                                                    </span>
+                                <div class="rcd-item" v-for="(item,index) in curRecordList" :key="index" @click="toClassRecoerd(index)">
+                                    <RcdPoster class="record-poster-wrap" :poster="item.poster"></RcdPoster>
+                                    <div style="flex:1">
+                                        <p class="record-name" style="padding-left:10px">
+                                            {{item.name}}
+                                            <span style="float:right;margin-right:20px">
+                                                <Icon type="md-create" class="edit-ev-name" @click.stop="editRecordName(index)" :title="$t('cusMgt.edRdName')" />
+                                                <Icon type="md-trash" class="edit-ev-name" @click.stop="delRecord(item.id)" :title="$t('cusMgt.delRcd')" />
+                                                <Icon :type="isFavorite(item.id) ? 'md-heart':'md-heart-outline'" :class="['edit-ev-name',isFavorite(item.id) ? 'heart-active':'']" @click.stop="toggleFavorite(item)" :title="isFavorite(item.id) ? $t('cusMgt.unfvt') : $t('cusMgt.fvt')" />
+                                            </span>
+                                        </p>
+                                        <div style="padding-left:10px;margin-top:10px">
+                                            <!-- 出席人数 -->
+                                            <span class="record-info">
+                                                <span>{{$t('cusMgt.rcd.attendCount')}}:</span>
+                                                <span class="record-info-value"> {{item.attendCount}}{{$t('unit.text7')}}</span>
+                                            </span>
+                                            <!-- 总计分 -->
+                                            <span class="record-info">
+                                                <span>{{$t('cusMgt.rcdScore')}}</span>
+                                                <span class="record-info-value">
+                                                    {{item.totalPoint}}
                                                 </span>
                                                 </span>
-                                                <!-- 作品总数 -->
-                                                <span class="record-info">
-                                                    <span>{{$t('cusMgt.rcd.colctCount')}}: </span>
-                                                    <span class="record-info-value">
-                                                        {{item.collateCount}}
-                                                    </span>
+                                            </span>
+                                            <!-- 作品总数 -->
+                                            <span class="record-info">
+                                                <span>{{$t('cusMgt.rcd.colctCount')}}: </span>
+                                                <span class="record-info-value">
+                                                    {{item.collateCount}}
                                                 </span>
                                                 </span>
-                                                <!-- 测验得分率 -->
-                                                <span class="record-info">
-                                                    <span>{{$t('cusMgt.rcd.scoreRate')}}: </span>
-                                                    <span class="record-info-value">
-                                                        {{item.examPointRate}}
-                                                    </span>
+                                            </span>
+                                            <!-- 测验得分率 -->
+                                            <span class="record-info">
+                                                <span>{{$t('cusMgt.rcd.scoreRate')}}: </span>
+                                                <span class="record-info-value">
+                                                    {{item.examPointRate}}
                                                 </span>
                                                 </span>
-                                                <!-- 互动总数 -->
-                                                <span class="record-info">
-                                                    <span>{{$t('cusMgt.rcd.interactionCount')}}: </span>
-                                                    <span class="record-info-value">
-                                                        {{item.clientInteractionCount}}
-                                                    </span>
+                                            </span>
+                                            <!-- 互动总数 -->
+                                            <span class="record-info">
+                                                <span>{{$t('cusMgt.rcd.interactionCount')}}: </span>
+                                                <span class="record-info-value">
+                                                    {{item.clientInteractionCount}}
                                                 </span>
                                                 </span>
-                                                <!-- 时长 -->
-                                                <span class="record-info">
-                                                    <span>{{$t('cusMgt.duration')}}</span>
-                                                    <span class="record-info-value">{{handleDuration(item.duration)}}</span>
+                                            </span>
+                                            <!-- 时长 -->
+                                            <span class="record-info">
+                                                <span>{{$t('cusMgt.duration')}}</span>
+                                                <span class="record-info-value">{{handleDuration(item.duration)}}</span>
+                                            </span>
+                                            <!-- 时间 -->
+                                            <span class="record-info" style="float:right">
+                                                <span>
+                                                    <Icon type="md-time" color="#70B1E7" />
                                                 </span>
                                                 </span>
-                                                <!-- 时间 -->
-                                                <span class="record-info" style="float:right">
-                                                    <span>
-                                                        <Icon type="md-time" color="#70B1E7" />
-                                                    </span>
-                                                    <span class="record-info-value">
-                                                        {{$jsFn.timeFormat(item.startTime)}}
-                                                    </span>
+                                                <span class="record-info-value">
+                                                    {{$jsFn.timeFormat(item.startTime)}}
                                                 </span>
                                                 </span>
-                                                <div class="record-action-wrap">
-                                                    <!-- <Icon class="action-icon" custom="iconfont icon-video" :title="$t('cusMgt.socrateMv')" @click.stop="viewVideo(item)" />
+                                            </span>
+                                            <div class="record-action-wrap">
+                                                <!-- <Icon class="action-icon" custom="iconfont icon-video" :title="$t('cusMgt.socrateMv')" @click.stop="viewVideo(item)" />
                                                     <Icon class="action-icon" type="md-share" :title="$t('cusMgt.share')" v-show="$store.state.config.srvAdrType != 'product'" @click.stop="shareRecord" /> -->
                                                     <Icon class="action-icon" type="md-share" :title="$t('cusMgt.share')" v-show="$store.state.config.srvAdrType != 'product'" @click.stop="shareRecord" /> -->
-                                                    <!-- <Icon class="action-icon" type="md-trash" :size="15" :title="$t('cusMgt.delRcd')" @click.stop="delRecord(item.id)" /> -->
-                                                    <!-- <span class="action-text" @click.stop="delRecord(item.id)">
+                                                <!-- <Icon class="action-icon" type="md-trash" :size="15" :title="$t('cusMgt.delRcd')" @click.stop="delRecord(item.id)" /> -->
+                                                <!-- <span class="action-text" @click.stop="delRecord(item.id)">
                                                         <Icon type="md-trash" :size="15" :title="$t('cusMgt.delRcd')"/>
                                                         <Icon type="md-trash" :size="15" :title="$t('cusMgt.delRcd')"/>
                                                     </span> -->
                                                     </span> -->
-                                                </div>
                                             </div>
                                             </div>
-                                        </ListItemMeta>
-                                    </ListItem>
-                                </List>
+                                        </div>
+                                    </div>
+                                </div>
                                 <EmptyData v-show="curRecordList.length == 0" :textContent="$t('cusMgt.noRecord')" :top="150"></EmptyData>
                                 <EmptyData v-show="curRecordList.length == 0" :textContent="$t('cusMgt.noRecord')" :top="150"></EmptyData>
                             </vuescroll>
                             </vuescroll>
                         </div>
                         </div>
@@ -475,6 +472,7 @@
 </template>
 </template>
 <script>
 <script>
 import { mapGetters } from 'vuex'
 import { mapGetters } from 'vuex'
+import RcdPoster from "../homepage/RcdPoster.vue"
 import PersonalPhoto from '@/components/public/personalPhoto/Index.vue'
 import PersonalPhoto from '@/components/public/personalPhoto/Index.vue'
 import StudentList from '@/components/coursemgt/StudentList.vue'
 import StudentList from '@/components/coursemgt/StudentList.vue'
 import TeaTable from './TeaTable.vue'
 import TeaTable from './TeaTable.vue'
@@ -482,8 +480,7 @@ import Video from '../video/Video.vue'
 import excel from '@/utils/excel.js'
 import excel from '@/utils/excel.js'
 export default {
 export default {
     components: {
     components: {
-        StudentList, PersonalPhoto, TeaTable,
-        Video
+        StudentList, PersonalPhoto, TeaTable, RcdPoster, Video
     },
     },
     inject: ['reload'],
     inject: ['reload'],
     data() {
     data() {
@@ -1836,7 +1833,7 @@ export default {
                     this.$router.push({
                     this.$router.push({
                         name: owner == 'school' ? 'manageVote' : 'personalVote',
                         name: owner == 'school' ? 'manageVote' : 'personalVote',
                         params: {
                         params: {
-                            ac:this.acList[index]
+                            ac: this.acList[index]
                         }
                         }
                     })
                     })
                     break
                     break
@@ -1844,7 +1841,7 @@ export default {
                     this.$router.push({
                     this.$router.push({
                         name: owner == 'school' ? 'manageQuestionnaire' : 'personalSurvey',
                         name: owner == 'school' ? 'manageQuestionnaire' : 'personalSurvey',
                         params: {
                         params: {
-                            ac:this.acList[index]
+                            ac: this.acList[index]
                         }
                         }
                     })
                     })
                     break
                     break
@@ -1852,7 +1849,7 @@ export default {
                     this.$router.push({
                     this.$router.push({
                         name: 'manageHomeWork',
                         name: 'manageHomeWork',
                         params: {
                         params: {
-                            ac:this.acList[index]
+                            ac: this.acList[index]
                         }
                         }
                     })
                     })
                     break
                     break
@@ -2153,7 +2150,7 @@ export default {
                     "school": this.$store.state.userInfo.schoolCode,
                     "school": this.$store.state.userInfo.schoolCode,
                     "DESC": "startTime",
                     "DESC": "startTime",
                     "pageCount": 50,
                     "pageCount": 50,
-                    "courseId": this.courseListShow[this.curCusIndex].id //现在后端模拟数据,暂时不加课程id
+                    "courseId": this.courseListShow[this.curCusIndex].id
                 }
                 }
                 this.$api.lessonRecord.getLessonList(params).then(
                 this.$api.lessonRecord.getLessonList(params).then(
                     res => {
                     res => {
@@ -2405,4 +2402,9 @@ export default {
         display: inline-block;
         display: inline-block;
     }
     }
 }
 }
+.rcd-item:hover{
+    .edit-ev-name {
+        display: inline-block;
+    }
+}
 </style>
 </style>

+ 1 - 1
TEAMModelOS/Controllers/Both/LessonRecordController.cs

@@ -155,7 +155,7 @@ namespace TEAMModelOS.Controllers
          */
          */
 
 
         /// <summary>
         /// <summary>
-        /// 获取开课记录
+        /// 删除课堂记录
         /// </summary>
         /// </summary>
         /// <param name="request"></param>
         /// <param name="request"></param>
         /// <returns></returns>
         /// <returns></returns>

+ 1 - 1
TEAMModelOS/Controllers/Client/HiTeachController.cs

@@ -116,7 +116,7 @@ namespace TEAMModelOS.Controllers.Client
                 msg = new { lesson_id = $"{_lessonId}", tmdid = $"{_tmdid}", grant_types = updates, school = $"{_school}", scope = $"{_scope}" }.ToJsonString();
                 msg = new { lesson_id = $"{_lessonId}", tmdid = $"{_tmdid}", grant_types = updates, school = $"{_school}", scope = $"{_scope}" }.ToJsonString();
                 var messageChange = new ServiceBusMessage(msg);
                 var messageChange = new ServiceBusMessage(msg);
                 messageChange.ApplicationProperties.Add("name", "LessonRecordEvent");
                 messageChange.ApplicationProperties.Add("name", "LessonRecordEvent");
-               // await _dingDing.SendBotMsg($"{_option.Location},课堂id:{_lessonId} 更新事件,{msg}", GroupNames.醍摩豆服務運維群組);
+                await _dingDing.SendBotMsg($"{_option.Location},课堂id:{_lessonId} 更新事件,{msg}", GroupNames.醍摩豆服務運維群組);
                 await _serviceBus.GetServiceBusClient().SendMessageAsync(ActiveTask, messageChange);
                 await _serviceBus.GetServiceBusClient().SendMessageAsync(ActiveTask, messageChange);
                 return Ok(new { status = 200 });
                 return Ok(new { status = 200 });
             }
             }

+ 55 - 4
TEAMModelOS/Controllers/School/SchoolController.cs

@@ -25,6 +25,7 @@ using TEAMModelOS.Filter;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Authorization;
 using System.Net.Http.Headers;
 using System.Net.Http.Headers;
 using System.Net.Http.Json;
 using System.Net.Http.Json;
+using HTEXLib.COMM.Helpers;
 
 
 namespace TEAMModelOS.Controllers
 namespace TEAMModelOS.Controllers
 {
 {
@@ -1543,7 +1544,7 @@ namespace TEAMModelOS.Controllers
         public async Task<IActionResult> TeacherImportManage(JsonElement request) {
         public async Task<IActionResult> TeacherImportManage(JsonElement request) {
             if (!request.TryGetProperty("opt", out JsonElement _opt)) { return BadRequest(); }
             if (!request.TryGetProperty("opt", out JsonElement _opt)) { return BadRequest(); }
             if (!request.TryGetProperty("schoolId", out JsonElement _schoolId)) { return BadRequest(); }
             if (!request.TryGetProperty("schoolId", out JsonElement _schoolId)) { return BadRequest(); }
-            
+            long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
             TeacherImport teacherImport = null;
             TeacherImport teacherImport = null;
             List<SchoolTeacher> idsInSchool = new List<SchoolTeacher>();
             List<SchoolTeacher> idsInSchool = new List<SchoolTeacher>();
             List<CoreUser> coreUsers = new List<CoreUser>();
             List<CoreUser> coreUsers = new List<CoreUser>();
@@ -1566,8 +1567,8 @@ namespace TEAMModelOS.Controllers
                     {
                     {
                         keys.AddRange(emails);
                         keys.AddRange(emails);
                     }
                     }
-                    long time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
-                    teachers.ForEach(x => { x.status = "import";x.time = time; });
+                   
+                    teachers.ForEach(x => { x.status = "import";x.time = now; });
                     if (keys.Any()) {
                     if (keys.Any()) {
                         try
                         try
                         {
                         {
@@ -1594,6 +1595,7 @@ namespace TEAMModelOS.Controllers
                     }
                     }
                     if (coreUsers.Any())
                     if (coreUsers.Any())
                     {
                     {
+                        School schoolBase = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemAsync<School>($"{_schoolId}", new PartitionKey("Base"));
                         foreach (var t in teachers) {
                         foreach (var t in teachers) {
                             if (!string.IsNullOrWhiteSpace(t.tmdid))
                             if (!string.IsNullOrWhiteSpace(t.tmdid))
                             {
                             {
@@ -1601,6 +1603,7 @@ namespace TEAMModelOS.Controllers
                                 if (coreUser != null)
                                 if (coreUser != null)
                                 {
                                 {
                                     t.id = coreUser.id; 
                                     t.id = coreUser.id; 
+                                    t.picture=coreUser.picture;
                                 }
                                 }
                             }
                             }
                             if (string.IsNullOrWhiteSpace(t.id))
                             if (string.IsNullOrWhiteSpace(t.id))
@@ -1610,7 +1613,8 @@ namespace TEAMModelOS.Controllers
                                     CoreUser coreUser = coreUsers.Find(x => x.mobile.Equals(t.phone));
                                     CoreUser coreUser = coreUsers.Find(x => x.mobile.Equals(t.phone));
                                     if (coreUser != null)
                                     if (coreUser != null)
                                     {
                                     {
-                                        t.id = coreUser.id;
+                                        t.id = coreUser.id; 
+                                        t.picture = coreUser.picture;
                                     }
                                     }
                                 }
                                 }
                             }
                             }
@@ -1622,6 +1626,7 @@ namespace TEAMModelOS.Controllers
                                     if (coreUser != null)
                                     if (coreUser != null)
                                     {
                                     {
                                         t.id = coreUser.id;
                                         t.id = coreUser.id;
+                                        t.picture = coreUser.picture;
                                     }
                                     }
                                 }
                                 }
                             }
                             }
@@ -1632,12 +1637,53 @@ namespace TEAMModelOS.Controllers
                                 {
                                 {
                                     t.status = teacher.status;
                                     t.status = teacher.status;
                                 }
                                 }
+                                else {
+                                    t.status = "invite";
+                                    teacher = new SchoolTeacher {
+                                        id = t.id,
+                                        name = t.name,
+                                        permissions = new List<string>(),
+                                        picture = t.picture,
+                                        job = null,
+                                        roles = new List<string> { "teacher" },
+                                        status = "invite",
+                                        createTime= now,
+                                        size = 0,
+                                        subjectIds= new List<string>(),
+                                        pk= "Teacher",
+                                        code=$"Teacher-{_schoolId}"
+                                    };
+                                    await  _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).CreateItemAsync(teacher, new PartitionKey (teacher.code));
+                                    Azure.Response responseTeacher = await  _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemStreamAsync(t.id, new PartitionKey("Base"));
+                                    if (responseTeacher.Status == 200)
+                                    {
+                                        Teacher teacherBase= JsonDocument.Parse(responseTeacher.Content).RootElement.Deserialize<Teacher>();
+                                        var school= teacherBase.schools?.Find(x => x.schoolId.Equals($"{_schoolId}"));
+                                        if (teacherBase.schools.IsNotEmpty())
+                                        {
+                                            if (school == null) {
+                                                teacherBase.schools.Add(new TeacherSchool { schoolId = schoolBase.id, name = schoolBase.name, picture = schoolBase.picture, areaId = schoolBase.areaId, time = now, status = "invite" });
+                                            }
+                                        }
+                                        else {
+                                            teacherBase.schools = new List<TeacherSchool> { new TeacherSchool {schoolId= schoolBase.id,name= schoolBase.name,picture= schoolBase.picture, areaId= schoolBase.areaId,time=now,status= "invite" } };
+                                        }
+                                        await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReplaceItemAsync(teacherBase, teacherBase.id, new PartitionKey("Base"));
+                                    }
+                                    else {
+                                        Teacher teacherBase = new Teacher { id = t.id, name = t.name, picture = t.picture, size = 2,code="Base",pk="Base", schools = new List<TeacherSchool> {
+                                            new TeacherSchool {schoolId= schoolBase.id,name= schoolBase.name,picture= schoolBase.picture, areaId= schoolBase.areaId,time=now,status= "invite" },
+                                        } };
+                                        await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).CreateItemAsync(teacherBase, new PartitionKey("Base"));
+                                    }
+                                }
                             }
                             }
                         }
                         }
                     }
                     }
                     teacherImport = new TeacherImport {id = $"{_schoolId}", code = "TeacherImport", pk = "TeacherImport", teachers=teachers};
                     teacherImport = new TeacherImport {id = $"{_schoolId}", code = "TeacherImport", pk = "TeacherImport", teachers=teachers};
                     await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).UpsertItemAsync(teacherImport, new PartitionKey("TeacherImport"));
                     await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).UpsertItemAsync(teacherImport, new PartitionKey("TeacherImport"));
                     break;
                     break;
+                    /*
                 case "find":
                 case "find":
                     Azure.Response response = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemStreamAsync($"{_schoolId}", new PartitionKey("TeacherImport"));
                     Azure.Response response = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemStreamAsync($"{_schoolId}", new PartitionKey("TeacherImport"));
                     if (response.Status == 200)
                     if (response.Status == 200)
@@ -1692,6 +1738,7 @@ namespace TEAMModelOS.Controllers
                                     if (coreUser != null)
                                     if (coreUser != null)
                                     {
                                     {
                                         t.id = coreUser.id;
                                         t.id = coreUser.id;
+                                        t.picture = coreUser.picture;
                                     }
                                     }
                                     else
                                     else
                                     {
                                     {
@@ -1705,6 +1752,7 @@ namespace TEAMModelOS.Controllers
                                         if (coreUser != null)
                                         if (coreUser != null)
                                         {
                                         {
                                             t.id = coreUser.id;
                                             t.id = coreUser.id;
+                                            t.picture = coreUser.picture;
                                         }
                                         }
                                     }
                                     }
                                     if (string.IsNullOrWhiteSpace(t.id))
                                     if (string.IsNullOrWhiteSpace(t.id))
@@ -1715,6 +1763,7 @@ namespace TEAMModelOS.Controllers
                                             if (coreUser != null)
                                             if (coreUser != null)
                                             {
                                             {
                                                 t.id = coreUser.id;
                                                 t.id = coreUser.id;
+                                                t.picture = coreUser.picture;
                                             }
                                             }
                                         }
                                         }
                                     }
                                     }
@@ -1726,6 +1775,7 @@ namespace TEAMModelOS.Controllers
                                             if (coreUser != null)
                                             if (coreUser != null)
                                             {
                                             {
                                                 t.id = coreUser.id;
                                                 t.id = coreUser.id;
+                                                t.picture = coreUser.picture;
                                             }
                                             }
                                         }
                                         }
                                     }
                                     }
@@ -1750,6 +1800,7 @@ namespace TEAMModelOS.Controllers
                         teacherImport= new TeacherImport { id=$"{_schoolId}",code= "TeacherImport",pk= "TeacherImport",teachers= new List<ImportTeacher>() };
                         teacherImport= new TeacherImport { id=$"{_schoolId}",code= "TeacherImport",pk= "TeacherImport",teachers= new List<ImportTeacher>() };
                     }
                     }
                     break;
                     break;
+                    */
             }
             }
             return Ok(new { teacherImport });
             return Ok(new { teacherImport });
         
         

+ 218 - 55
TEAMModelOS/Controllers/School/SchoolTeacherController.cs

@@ -67,7 +67,9 @@ namespace TEAMModelOS.Controllers
             //string status_str = (request.TryGetProperty("join_status", out JsonElement status_json)) ? status_json.ToString() : "join";
             //string status_str = (request.TryGetProperty("join_status", out JsonElement status_json)) ? status_json.ToString() : "join";
             //資料取得
             //資料取得
             List<ScTeacher> teachers = new List<ScTeacher>();
             List<ScTeacher> teachers = new List<ScTeacher>();
-            await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ScTeacher>(queryText: $"SELECT c.subjectIds, c.id, c.name,   c.picture ,c.status, c.job, c.createTime, ARRAY_LENGTH(c.permissions) as permissionCount,c.permissions,c.roles , c.size FROM c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Teacher-{school_code}") }))
+            await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ScTeacher>
+                (queryText: $"SELECT c.subjectIds, c.id, c.name,   c.picture ,c.status, c.job, c.createTime, ARRAY_LENGTH(c.permissions) as permissionCount,c.permissions,c.roles , c.size FROM c", 
+                requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Teacher-{school_code}") }))
             {
             {
                 if ($"{item.createTime}".Length > 10) {
                 if ($"{item.createTime}".Length > 10) {
                     item.createTime = item.createTime / 1000;
                     item.createTime = item.createTime / 1000;
@@ -93,6 +95,141 @@ namespace TEAMModelOS.Controllers
                     });
                     });
                 }
                 }
             }
             }
+            Azure.Response response = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemStreamAsync($"{school_code}", new PartitionKey("TeacherImport"));
+            if (response.Status == 200) {
+                List<CoreUser> coreUsers = new List<CoreUser>();
+                TeacherImport teacherImport = JsonDocument.Parse(response.Content).RootElement.ToObject<TeacherImport>();
+                var idsIn = teacherImport.teachers.Where(x => !string.IsNullOrWhiteSpace(x.id));
+                //id是空 其他不是空的
+                var tmdidsi = teacherImport.teachers.Where(x => string.IsNullOrWhiteSpace(x.id) && !string.IsNullOrWhiteSpace(x.tmdid)).Select(z => z.tmdid);
+                var phonesi = teacherImport.teachers.Where(x => string.IsNullOrWhiteSpace(x.id) && !string.IsNullOrWhiteSpace(x.phone)).Select(z => z.phone);
+                var emailsi = teacherImport.teachers.Where(x => string.IsNullOrWhiteSpace(x.id) && !string.IsNullOrWhiteSpace(x.email)).Select(z => z.email);
+                List<string> skeys = new List<string>();
+                if (idsIn.Any()) {
+                    skeys.AddRange(idsIn.Select(x=>x.id));
+                }
+                if (tmdidsi.Any())
+                {
+                    skeys.AddRange(tmdidsi);
+                }
+                if (phonesi.Any())
+                {
+                    skeys.AddRange(phonesi);
+                }
+                if (emailsi.Any())
+                {
+                    skeys.AddRange(emailsi);
+                }
+                if (skeys.Any())
+                {
+                    try
+                    {
+                        var content = new StringContent(skeys.ToJsonString(), Encoding.UTF8, "application/json");
+                        string json = await _coreAPIHttpService.GetUserInfos(content);
+                        if (!string.IsNullOrWhiteSpace(json))
+                        {
+                            coreUsers = json.ToObject<List<CoreUser>>();
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        //await _dingDing.SendBotMsg($"{_option.Location},导入名单时,查验key信息错误{ex.Message}\n{ex.StackTrace}\n{skeys.ToJsonString()}", GroupNames.醍摩豆服務運維群組);
+                    }
+                }
+                if (coreUsers.Any())
+                {
+                    teacherImport.teachers.ForEach(t => {
+                        if (!string.IsNullOrWhiteSpace(t.id))
+                        {
+                            CoreUser coreUser = coreUsers.Find(x => x.searchKey.Equals(t.id) || x.id.Equals(t.id));
+                            if (coreUser != null)
+                            {
+                                t.id = coreUser.id;
+                                t.picture = coreUser.picture;
+                            }
+                            else
+                            {
+                                t.id = null;
+                            }
+                        }
+                        if (string.IsNullOrWhiteSpace(t.id))
+                        {
+                            if (!string.IsNullOrWhiteSpace(t.tmdid))
+                            {
+                                CoreUser coreUser = coreUsers.Find(x => x.id.Equals(t.tmdid));
+                                if (coreUser != null)
+                                {
+                                    t.id = coreUser.id;
+                                }
+                            }
+                            if (string.IsNullOrWhiteSpace(t.id))
+                            {
+                                if (!string.IsNullOrWhiteSpace(t.phone))
+                                {
+                                    CoreUser coreUser = coreUsers.Find(x => x.mobile.Equals(t.phone));
+                                    if (coreUser != null)
+                                    {
+                                        t.id = coreUser.id;
+                                        t.picture = coreUser.picture;
+                                    }
+                                }
+                            }
+                            if (string.IsNullOrWhiteSpace(t.id))
+                            {
+                                if (!string.IsNullOrWhiteSpace(t.email))
+                                {
+                                    CoreUser coreUser = coreUsers.Find(x => x.mail.Equals(t.email));
+                                    if (coreUser != null)
+                                    {
+                                        t.id = coreUser.id;
+                                        t.picture = coreUser.picture;
+                                    }
+                                }
+                            }
+                        }
+                        if (!string.IsNullOrWhiteSpace(t.id))
+                        {
+                            var tch= teachers.Find(x => x.id.Equals(t.id));
+                            if (tch == null) {
+                                tch=  new ScTeacher
+                                {
+                                    id = t.id,
+                                    name = t.name,
+                                    picture = t.picture,
+                                    status = "import",
+                                    createTime = t.time,
+                                    permissionCount = 0,
+                                    size = 0,
+                                    permissions = new List<string>(),
+                                    roles = new List<string>(),
+                                    subjectIds = new List<string>(),
+                                    groups = new List<IdNameCode>(),
+                                };
+                                teachers.Add(tch);
+                            }
+                        }
+                        else {
+                            //teachers.Add();
+                            var tch=  new ScTeacher
+                            {
+                                id=t.id,
+                                picture=t.picture,
+                                name=t.name,
+                                status="import",
+                                createTime=t.time,
+                                permissionCount=0,
+                                size=0,
+                                permissions= new List<string>(),
+                                roles=new List<string>(),
+                                subjectIds=new List<string>(),
+                                groups= new List<IdNameCode>(),
+                            };
+                            teachers.Add(tch);
+                        }
+                    });
+                    
+                }
+            }
             return Ok(new { teachers });
             return Ok(new { teachers });
         }
         }
         public class ScTeacher
         public class ScTeacher
@@ -110,7 +247,7 @@ namespace TEAMModelOS.Controllers
             public List<string> subjectIds { get; set; }
             public List<string> subjectIds { get; set; }
             public List<IdNameCode> groups { get; set; } = new List<IdNameCode>();
             public List<IdNameCode> groups { get; set; } = new List<IdNameCode>();
 
 
-    }
+        }
         /// <summary>
         /// <summary>
         /// 取得某位老師的權限
         /// 取得某位老師的權限
         /// </summary>
         /// </summary>
@@ -565,66 +702,92 @@ namespace TEAMModelOS.Controllers
             {
             {
                 var (tid, tname, _, tschool) = HttpContext.GetAuthTokenInfo();
                 var (tid, tname, _, tschool) = HttpContext.GetAuthTokenInfo();
                 if (!request.TryGetProperty("school_code", out JsonElement school_code)) return BadRequest();
                 if (!request.TryGetProperty("school_code", out JsonElement school_code)) return BadRequest();
-                if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
-
+                request.TryGetProperty("id", out JsonElement id);
+                request.TryGetProperty("name", out JsonElement name); 
                 var client = _azureCosmos.GetCosmosClient();
                 var client = _azureCosmos.GetCosmosClient();
                 //在老師表找出老師,刪除該學校 (老師基本資料應該要存在)
                 //在老師表找出老師,刪除該學校 (老師基本資料應該要存在)
-                Teacher teacher = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<Teacher>(id.ToString(), new PartitionKey("Base"));
-                var school = teacher.schools.RemoveAll(x => x.schoolId.Equals(school_code.GetString(), StringComparison.OrdinalIgnoreCase));
-                if (!string.IsNullOrEmpty(teacher.defaultSchool) && teacher.defaultSchool.Equals($"{school_code}")) {
-                    if (teacher.schools.IsNotEmpty())
-                    {
-                        teacher.defaultSchool = teacher.schools[0].schoolId;
-                    }
-                    else {
-                        teacher.defaultSchool = null;
-                    }
-                }
-                await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<Teacher>(teacher, id.ToString(), new PartitionKey("Base"));
-                //移除學校表中的老師document
-                var sresponse = await client.GetContainer(Constant.TEAMModelOS, "School").DeleteItemStreamAsync(id.GetString(), new PartitionKey($"Teacher-{school_code}"));
-                //将教师移除学校,同时也移除研修名单,教研组。
-                StringBuilder queryText = new StringBuilder($"SELECT distinct value(c) FROM c where c.type='yxtrain' or  c.type='research' ");
-                await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<GroupList>(queryText: queryText.ToString(),
-                requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"GroupList-{school_code.GetString()}") }))
+                Azure.Response response = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemStreamAsync($"{school_code}", new PartitionKey("TeacherImport"));
+                TeacherImport teacherImport = null;
+                if (response.Status == 200)
                 {
                 {
-                    bool exists = item.members.Exists(x => x.id.Equals(id.ToString()));
-                    if (exists) {
-                        item.members.RemoveAll(x => x.id.Equals(id.ToString()));
-                        await  GroupListService.UpsertList(item, _azureCosmos, _configuration, _azureServiceBus);
-                        //await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync(item,item.id,new PartitionKey(item.code));
+                    teacherImport= JsonDocument.Parse(response.Content).RootElement.Deserialize<TeacherImport>();
+                }
+                if (!string.IsNullOrWhiteSpace($"{name}")  && teacherImport!= null) {
+                    //移除同名的、其中一个
+                    var ts=  teacherImport.teachers.FindAll(x => !string.IsNullOrWhiteSpace(x.name ) &&  x.name.Equals($"{name}"));
+                    if (ts.IsNotEmpty()) {
+                        teacherImport.teachers.Remove(ts.First());
+                        await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync(teacherImport, $"{school_code}", new PartitionKey("TeacherImport"));
                     }
                     }
                 }
                 }
+                if (!string.IsNullOrWhiteSpace($"{id}")) {
 
 
-                //await TmdUserService.LeaveSchool(client, $"{teacher.id}",  $"{school_code}" );
-                //取得學校資訊
-                var schresponse = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemStreamAsync(school_code.ToString(), new PartitionKey("Base"));
-                string schname = string.Empty;
-                if (schresponse.Status == 200)
-                {
-                    using var schjson = await JsonDocument.ParseAsync(schresponse.ContentStream);
-                    schjson.RootElement.TryGetProperty("name", out JsonElement jsonschname);
-                    schname = jsonschname.ToString();
-                }
-                else
-                {
-                    return BadRequest();
+                    if (teacherImport != null) {
+                        int count= teacherImport.teachers.RemoveAll(x => !string.IsNullOrWhiteSpace(x.id)  &&  x.id.Equals($"{id}"));
+                        if (count > 0) {
+                            await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync(teacherImport, $"{school_code}", new PartitionKey("TeacherImport"));
+                        }
+                    }
+                    Teacher teacher = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<Teacher>(id.ToString(), new PartitionKey("Base"));
+                    var school = teacher.schools.RemoveAll(x => x.schoolId.Equals(school_code.GetString(), StringComparison.OrdinalIgnoreCase));
+                    if (!string.IsNullOrEmpty(teacher.defaultSchool) && teacher.defaultSchool.Equals($"{school_code}"))
+                    {
+                        if (teacher.schools.IsNotEmpty())
+                        {
+                            teacher.defaultSchool = teacher.schools[0].schoolId;
+                        }
+                        else
+                        {
+                            teacher.defaultSchool = null;
+                        }
+                    }
+                    await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<Teacher>(teacher, id.ToString(), new PartitionKey("Base"));
+                    //移除學校表中的老師document
+                    var sresponse = await client.GetContainer(Constant.TEAMModelOS, "School").DeleteItemStreamAsync(id.GetString(), new PartitionKey($"Teacher-{school_code}"));
+                    //将教师移除学校,同时也移除研修名单,教研组。
+                    StringBuilder queryText = new StringBuilder($"SELECT distinct value(c) FROM c where c.type='yxtrain' or  c.type='research' ");
+                    await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<GroupList>(queryText: queryText.ToString(),
+                    requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"GroupList-{school_code.GetString()}") }))
+                    {
+                        bool exists = item.members.Exists(x => x.id.Equals(id.ToString()));
+                        if (exists)
+                        {
+                            item.members.RemoveAll(x => x.id.Equals(id.ToString()));
+                            await GroupListService.UpsertList(item, _azureCosmos, _configuration, _azureServiceBus);
+                            //await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync(item,item.id,new PartitionKey(item.code));
+                        }
+                    }
+
+                    //await TmdUserService.LeaveSchool(client, $"{teacher.id}",  $"{school_code}" );
+                    //取得學校資訊
+                    var schresponse = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemStreamAsync(school_code.ToString(), new PartitionKey("Base"));
+                    string schname = string.Empty;
+                    if (schresponse.Status == 200)
+                    {
+                        using var schjson = await JsonDocument.ParseAsync(schresponse.ContentStream);
+                        schjson.RootElement.TryGetProperty("name", out JsonElement jsonschname);
+                        schname = jsonschname.ToString();
+                    }
+                    else
+                    {
+                        return BadRequest();
+                    }
+                    Notification notification = new Notification
+                    {
+                        hubName = "hita",
+                        type = "msg",
+                        from = $"ies5:{_option.Location}:private",
+                        to = new List<string> { teacher.id },
+                        label = $"remove_school",
+                        body = new { location = _option.Location, biz = "remove", tmdid = tid, tmdname = tname, schoolcode = $"{school_code}", schoolname = $"{schname}", status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
+                        expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
+                    };
+                    var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
+                    var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
+                    var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
+                    var location = _option.Location;
+                    var code = await _notificationService.SendNotification(clientID, clientSecret, location, url, notification);
                 }
                 }
-                Notification notification = new Notification
-                {
-                    hubName = "hita",
-                    type = "msg",
-                    from = $"ies5:{_option.Location}:private",
-                    to = new List<string> { teacher.id },
-                    label = $"remove_school",
-                    body = new { location = _option.Location, biz = "remove", tmdid = tid, tmdname = tname, schoolcode = $"{school_code}", schoolname = $"{schname}", status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
-                    expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
-                };
-                var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
-                var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
-                var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
-                var location = _option.Location;
-                var code = await _notificationService.SendNotification(clientID, clientSecret, location, url, notification);
                 return Ok(new { });
                 return Ok(new { });
             }
             }
             catch (Exception ex)
             catch (Exception ex)