فهرست منبع

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

OnePsycho 3 سال پیش
والد
کامیت
b9c4e9d103

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

@@ -188,6 +188,7 @@ export default{
         stStuWarning: '请先选择学生!',
         lastQu: '上一题',
         nextQu: '下一题',
+        view:'查看'
     },
 
     //SimpleAnalysis.vue

+ 9 - 1
TEAMModelOS/ClientApp/src/view/learnactivity/PaperScore.less

@@ -98,7 +98,7 @@
     display: none;
     color: white;
     padding: 2px 5px;
-    background: #1cc0f3;
+    // background: red;
     cursor: pointer;
 }
 .scoring-exercise-wrap .exercise-item {
@@ -383,4 +383,12 @@
 
     .paper-score-container .item-option-content, .item-question-flex, .child-item-question-flex {
         display: flex;
+    }
+
+    .mark-action-item{
+        padding: 5px 12px;
+    }
+    .mark-label{
+        color: #2d8cf0;
+        margin-bottom: 5px;
     }

+ 51 - 34
TEAMModelOS/ClientApp/src/view/learnactivity/PaperScore.vue

@@ -48,7 +48,6 @@
             </div>
         </div>
         <div class="qu-list-wrap scoring-exercise-wrap" ref="mathJaxContainer" v-show="!dataLoading">
-            <!-- <vuescroll ref="question-scrool" > -->
             <!-- 按题型排序 -->
             <div v-show="!isComplete" class="list-view" :key="'group'+ typeIndex" v-for="(typeItem,typeIndex) in groupList">
                 <p class="type-name">
@@ -79,15 +78,6 @@
                                     <Icon type="md-remove" />
                                 </span>
                             </div>
-                            <!-- 滚动上下题目去掉 -->
-                            <!-- <div style="display:flex;justify-content: space-evenly;margin-top:5px;display:none;" v-show="showQu">
-                                <span class="fast-score-tag" :title="$t('learnActivity.score.lastQu')" :style="{'background':'#aeaeae','cursor':(typeIndex + index) == 0 ? 'not-allowed':''}" @click="goToQuestion(getQuIndex(typeIndex,index) - 1)">
-                                    <Icon type="md-arrow-round-back" />
-                                </span>
-                                <span class="fast-score-tag" :title="$t('learnActivity.score.nextQu')" :style="{'background':'#aeaeae','cursor':(typeIndex + index + 1) == studentAnswer.scores.legnth ? 'not-allowed':''}" @click="goToQuestion(getQuIndex(typeIndex,index) + 1)">
-                                    <Icon type="md-arrow-round-forward" />
-                                </span>
-                            </div> -->
                         </div>
                         <div class="qu-info-box">
                             <!-- 题干部分 -->
@@ -106,16 +96,23 @@
                                 <p class="answer-title">
                                     <span v-show="!showQu" class="item-question-order">{{$t('learnActivity.score.quIndex1')}} {{ getQuIndex(typeIndex,index)}} .</span>
                                     {{$t('learnActivity.score.stuAns')}}
-                                    <Icon type="md-checkmark" v-show="studentAnswer.scores[item.index] == item.score" />
+                                    <!-- <Icon type="md-checkmark" v-show="studentAnswer.scores[item.index] == item.score" />
                                     <Icon type="md-close" color="#ed4014" v-show="studentAnswer.scores[item.index] == 0" />
-                                    <Icon custom="iconfont icon-half-right" color="#ff9900" v-show="studentAnswer.scores[item.index] > 0 && studentAnswer.scores[item.index] < item.score" />
+                                    <Icon custom="iconfont icon-half-right" color="#ff9900" v-show="studentAnswer.scores[item.index] > 0 && studentAnswer.scores[item.index] < item.score" /> -->
+                                    <Icon custom="iconfont icon-mark" color="#1cc0f3" @click="viewMark(item.index)" v-show="studentAnswer.mark && studentAnswer.mark[item.index].length" style="margin-left:10px" />
                                 </p>
                                 <!--学生作答答案显示区域-->
                                 <div class="stu-answer-box item-explain-details" v-if="studentAnswer.answers && studentAnswer.answers.length">
                                     <!-- 批注 主观题才会有批注功能 -->
-                                    <div class="mark-btn-box" @click="markStuAnswer(item.index)" v-if="item.type !== 'single' && item.type !== 'multiple' && item.type !== 'judge'">
-                                        <Icon type="md-create" />
-                                        <span style="margin-left:5px;">{{$t('learnActivity.score.mark')}}</span>
+                                    <div class="mark-btn-box" v-if="item.type !== 'single' && item.type !== 'multiple' && item.type !== 'judge'">
+                                        <span class="mark-action-item" v-show="studentAnswer.mark && studentAnswer.mark[item.index].length" style="background:#19be6b" @click="viewMark(item.index)">
+                                            <Icon type="md-eye" />
+                                            <span style="margin-left:5px;">{{$t('learnActivity.score.view')}}</span>
+                                        </span>
+                                        <span class="mark-action-item" style="background:#ed4014" @click="markStuAnswer(item.index)">
+                                            <Icon type="md-create" />
+                                            <span style="margin-left:5px;">{{$t('learnActivity.score.mark')}}</span>
+                                        </span>
                                     </div>
                                     <!--多选题答案-->
                                     <div v-if="item.type === 'multiple'" :id="'answer'+ getScoreIndex(typeIndex,index)">
@@ -205,15 +202,6 @@
                                         <Icon type="md-remove" />
                                     </span>
                                 </div>
-                                <!-- 滚动上下题目去掉 -->
-                                <!-- <div style="display:flex;justify-content: space-evenly;margin-top:5px;display:none;" v-show="showQu">
-                                        <span class="fast-score-tag" :title="$t('learnActivity.score.lastQu')" :style="{'background':'#aeaeae','cursor':(typeIndex + index + childIndex) == 0 ? 'not-allowed':''}" @click="goToQuestion((getQuIndex(typeIndex,index) + childIndex) - 1)">
-                                            <Icon type="md-arrow-round-back" />
-                                        </span>
-                                        <span class="fast-score-tag" :title="$t('learnActivity.score.nextQu')" :style="{'background':'#aeaeae','cursor':(typeIndex + index + childIndex + 1) == studentAnswer.scores.length ? 'not-allowed':''}" @click="goToQuestion((getQuIndex(typeIndex,index) + childIndex) + 1)">
-                                            <Icon type="md-arrow-round-forward" />
-                                        </span>
-                                    </div> -->
                             </div>
                             <div class="qu-info-box">
                                 <div class="child-item-question child-item-question-flex" v-show="showQu">
@@ -231,16 +219,23 @@
                                     <p class="answer-title">
                                         <span class="child-item-question-order" v-show="!showQu">{{$t('learnActivity.score.quIndexLabel')}} {{getQuIndex(typeIndex,index)+'-'+ (childIndex + 1) }}{{$t('learnActivity.score.sQuLabel2')}}</span>
                                         {{$t('learnActivity.score.stuAns')}}
-                                        <Icon type="md-checkmark" v-show="studentAnswer.scores[childItem.index] == childItem.score" />
+                                        <!-- <Icon type="md-checkmark" v-show="studentAnswer.scores[childItem.index] == childItem.score" />
                                         <Icon type="md-close" color="#ed4014" v-show="studentAnswer.scores[childItem.index] == 0" />
-                                        <Icon custom="iconfont icon-half-right" color="#ff9900" v-show="studentAnswer.scores[childItem.index] > 0 && studentAnswer.scores[childItem.index] < childItem.score" />
+                                        <Icon custom="iconfont icon-half-right" color="#ff9900" v-show="studentAnswer.scores[childItem.index] > 0 && studentAnswer.scores[childItem.index] < childItem.score" /> -->
+                                        <Icon custom="iconfont icon-mark" color="#1cc0f3" @click="viewMark(childItem.index)" v-show="studentAnswer.mark && studentAnswer.mark[childItem.index].length" style="margin-left:10px" />
                                     </p>
                                     <!--学生作答答案显示区域-->
                                     <div class="stu-answer-box item-explain-details" v-if="studentAnswer.answers && studentAnswer.answers.length">
                                         <!-- 批注 主观题才会有批注功能 -->
-                                        <div class="mark-btn-box" @click="markStuAnswer(childItem.index)" v-if="childItem.type !== 'single' && childItem.type !== 'multiple' && childItem.type !== 'judge'">
-                                            <Icon type="md-create" />
-                                            <span style="margin-left:5px;">{{$t('learnActivity.score.mark')}}</span>
+                                        <div class="mark-btn-box" v-if="childItem.type !== 'single' && childItem.type !== 'multiple' && childItem.type !== 'judge'">
+                                            <span v-show="studentAnswer.mark && studentAnswer.mark[childItem.index].length" class="mark-action-item" style="background:#19be6b" @click="viewMark(childItem.index)">
+                                                <Icon type="md-eye" />
+                                                <span style="margin-left:5px;">{{$t('learnActivity.score.view')}}</span>
+                                            </span>
+                                            <span class="mark-action-item" style="background:#ed4014" @click="markStuAnswer(childItem.index)">
+                                                <Icon type="md-create" />
+                                                <span style="margin-left:5px;">{{$t('learnActivity.score.mark')}}</span>
+                                            </span>
                                         </div>
                                         <!--多选题答案-->
                                         <div v-if="childItem.type === 'multiple'" :id="'answer'+ getScoreIndex(typeIndex,index,childIndex)">
@@ -296,9 +291,6 @@
                     </div>
                 </div>
             </div>
-            <!-- 默认排序 -->
-
-            <!-- </vuescroll> -->
             <div v-show="isComplete" class="complete-score-box">
                 <Icon class="complete-icon" type="md-checkmark-circle" />
                 <p class="complete-stu-info">{{studentAnswer.name}} ({{scoreTotal}}{{$t('learnActivity.score.scoreUnit')}})</p>
@@ -310,7 +302,12 @@
         </Modal>
         <!-- 用来单独渲染学生作答数据,提高tocanvas 的效率 -->
         <iframe id="answerIframe" :srcdoc="studentAnswer.answers[curAnIndex]" v-if="studentAnswer.answers"></iframe>
-
+        <Modal v-model="viewStatus" title="查看批注" width='600'>
+            <div v-for="(item,index) in viewMarks" :key="index">
+                <p class="mark-label" v-show="viewMarks.length > 1">批注{{index + 1}}:</p>
+                <img :src="item.url" style="width:100%;margin-bottom:20px">
+            </div>
+        </Modal>
     </div>
 </template>
 <script>
@@ -356,6 +353,8 @@ export default {
     },
     data() {
         return {
+            viewIndex: 0,
+            viewStatus: false,
             isDefOrder: false, //是否默认排序  默认/题型
             activeIndex: 0,
             curAnIndex: -1,
@@ -373,10 +372,28 @@ export default {
             showQu: false,
             showOption: false,
             scope: '',
-            markBg: undefined
+            markBg: undefined,
+            viewMarks: []
         }
     },
     methods: {
+        viewMark(index) {
+            this.viewIndex = index
+            this.viewStatus = true
+            if (this.studentAnswer.mark && this.studentAnswer.mark[this.viewIndex]) {
+                let sas = this.examScope == 'school' ? this.$store.state.user.schoolProfile.blob_sas : this.$store.state.user.userProfile.blob_sas
+                let blobUrl = this.examScope == 'school' ? JSON.parse(decodeURIComponent(localStorage.school_profile, "utf-8")).blob_uri : JSON.parse(decodeURIComponent(localStorage.user_profile, "utf-8")).blob_uri
+                let d = this._.cloneDeep(this.studentAnswer.mark[this.viewIndex])
+                d.forEach(item => {
+                    item.url = blobUrl + '/' + item.mark + '?' + sas
+                })
+                this.viewMarks = d
+            } else {
+                this.viewMarks = []
+            }
+
+            console.log('学生作答数据', this.studentAnswer)
+        },
         closeModal() {
             this.markStatus = false
             this.curAnIndex = -1

+ 45 - 52
TEAMModelOS/Controllers/School/StudentController.cs

@@ -2112,76 +2112,69 @@ namespace TEAMModelOS.Controllers
         [AuthToken(Roles = "student")]
         [HttpPost("get-school-info")]
 
-        public async Task<IActionResult> GetSchoolInfo(JsonElement requert)
+        public async Task<IActionResult> GetSchoolInfo(JsonElement request)
         {
             try
             {
                 var (id, _, _, school) = HttpContext.GetAuthTokenInfo();
                 var client = _azureCosmos.GetCosmosClient();
-                List<string> roles = new List<string>();
-                List<string> permissions = new List<string>();
-                int size = 0;
-                var response = await client.GetContainer("TEAMModelOS", "Student").ReadItemStreamAsync(id, new PartitionKey($"Base-{school}"));
-                if (response.Status == 200)
+                /// tmdid, schoolid
+                var userType = "schoolid";
+                if (request.TryGetProperty("userType", out JsonElement usertype))
                 {
-                    using var json = await JsonDocument.ParseAsync(response.ContentStream);
-                    if (json.RootElement.TryGetProperty("size", out JsonElement _size) && _size.ValueKind == JsonValueKind.Number)
+                    if (!usertype.ValueKind.Equals(JsonValueKind.Undefined) && !usertype.ValueKind.Equals(JsonValueKind.Null) && usertype.ValueKind.Equals(JsonValueKind.String))
                     {
-                        size = _size.GetInt32();
+                        userType = usertype.GetString();
                     }
-                    if (json.RootElement.TryGetProperty("roles", out JsonElement _roles) && _roles.ValueKind != JsonValueKind.Null)
-                    {
-                        foreach (var obj in _roles.EnumerateArray())
-                        {
-                            roles.Add(obj.GetString());
+                }
+                if (string.IsNullOrEmpty(school)) {
+                    if (userType.Equals("tmdid")) {
+                        Teacher teacher = await client.GetContainer("TEAMModelOS", "School").ReadItemAsync<Teacher>(id, new PartitionKey("Base"));
+                        if (teacher.schools.IsNotEmpty()) {
+                           var tech= teacher.schools.Find(x => x.status.Equals("join"));
+                            if (tech == null)
+                            {
+                                school = teacher.schools[0].schoolId;
+                            }
+                            else { 
+                                school = tech.schoolId; 
+                            }
                         }
                     }
-                    if (json.RootElement.TryGetProperty("permissions", out JsonElement _permissions) && _permissions.ValueKind != JsonValueKind.Null)
+                }
+                if (!string.IsNullOrEmpty(school))
+                {
+                    object school_base = null;
+                    var response = await client.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(school, new PartitionKey("Base"));
+                    if (response.Status == 200)
                     {
-                        foreach (var obj in _permissions.EnumerateArray())
+                        using var json = await JsonDocument.ParseAsync(response.ContentStream);
+                        school_base = json.RootElement.ToObject<object>();
+                    }
+
+                    //取得班级
+                    List<object> school_classes = new List<object>();
+                    await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: $"SELECT c.id,c.x,c.y,c.name,c.year,c.teacher,c.periodId,c.gradeId,c.room,c.sn,c.no,c.style,c.status,c.openType,c.scope, ARRAY_LENGTH(c.students) AS studCount FROM c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Class-{school}") }))
+                    {
+                        var jsonc = await JsonDocument.ParseAsync(item.ContentStream);
+                        foreach (var classeinfo in jsonc.RootElement.GetProperty("Documents").EnumerateArray())
                         {
-                            permissions.Add(obj.GetString());
+                            school_classes.Add(classeinfo.ToObject<object>());
                         }
                     }
-                }
-                else //無此學校資料
-                {
-                    return Ok(new { status = 404 });
-                }
-                if (roles.Count == 0)
-                {
-
-                    roles.Add("student");
-                }
-
-                //TODO JJ,调整为取得学校基础设置数据,取代下方學校學制、年級
-                object school_base = null;
-                response = await client.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(school, new PartitionKey("Base"));
-                if (response.Status == 200)
-                {
-                    using var json = await JsonDocument.ParseAsync(response.ContentStream);
-                    school_base = json.RootElement.ToObject<object>();
-                }
-
-                //取得班级
-                List<object> school_classes = new List<object>();
-                await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: $"SELECT c.id,c.x,c.y,c.name,c.year,c.teacher,c.periodId,c.gradeId,c.room,c.sn,c.no,c.style,c.status,c.openType,c.scope, ARRAY_LENGTH(c.students) AS studCount FROM c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Class-{school}") }))
-                {
-                    var jsonc = await JsonDocument.ParseAsync(item.ContentStream);
-                    foreach (var classeinfo in jsonc.RootElement.GetProperty("Documents").EnumerateArray())
+                    //取得教室
+                    List<Room> school_rooms = new List<Room>();
+                    await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<Room>(queryText: $"select value(c) from c ",
+                    requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Room-{school}") }))
                     {
-                        school_classes.Add(classeinfo.ToObject<object>());
+                        school_rooms.Add(item);
                     }
+
+                    return Ok(new { school_base, school_classes, school_rooms, status = 200 });
                 }
-                //取得教室
-                List<Room> school_rooms = new List<Room>();
-                await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<Room>(queryText: $"select value(c) from c ",
-                requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Room-{school}") }))
-                {
-                    school_rooms.Add(item);
+                else {
+                    return Ok(new { status = 404 }); ;
                 }
-
-                return Ok(new { school_base, school_classes, school_rooms, status = 200 });
             }
             catch (CosmosException ex)
             {