瀏覽代碼

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

CrazyIter_Bin 3 年之前
父節點
當前提交
44a7a0c6e1

+ 202 - 25
TEAMModeBI/Controllers/BIHome/HomeStatisController.cs

@@ -9,6 +9,7 @@ using TEAMModelOS.SDK.DI;
 using TEAMModelOS.Models;
 using Azure.Cosmos;
 using Microsoft.Extensions.Options;
+using TEAMModelOS.SDK.Models;
 
 namespace TEAMModeBI.Controllers.BIHome
 {
@@ -35,49 +36,225 @@ namespace TEAMModeBI.Controllers.BIHome
         /// <returns></returns>
         [ProducesDefaultResponseType]
         [HttpPost("get-numberpeople")]
-        public async Task<IActionResult> NumberPeople(JsonElement jsonElement)  
+        public async Task<IActionResult> GetNumberPeople(JsonElement jsonElement)  
         {
-            if (!jsonElement.TryGetProperty("schooolId", out JsonElement schoolId)) return BadRequest();
+            try
+            {
+                jsonElement.TryGetProperty("schooolId", out JsonElement schoolId);
+                var client = _azureCosmos.GetCosmosClient();
 
-            var client = _azureCosmos.GetCosmosClient();
+                //依据学校查询教师人数
+                List<string> teacherCount_list = new();
+                //依据学校查询学生信息
+                List<string> studentCount_List = new();
+                //学校人数
+                List<string> schoolCount_List = new();
+                //学校空间大小
+                int schoolsize = 0;
 
-            //依据学校查询教师人数
-            List<string> teacherCount_list = new();
-            await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryStreamIterator(queryText: $"select c.id from c join S1 in c.schools where S1.schoolId='{schoolId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") })) 
-            {
-                using var json = await JsonDocument.ParseAsync(item.ContentStream);
-                if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0) 
+                if (!string.IsNullOrEmpty($"{schoolId}"))
                 {
-                    var accounts = json.RootElement.GetProperty("Documents").EnumerateArray();
-                    while (accounts.MoveNext()) 
+                    //查询学校教师人数
+                    await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryStreamIterator(queryText: $"select c.id from c join S1 in c.schools where S1.schoolId='{schoolId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
+                    {
+                        using var json = await JsonDocument.ParseAsync(item.ContentStream);
+                        if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
+                        {
+                            var accounts = json.RootElement.GetProperty("Documents").EnumerateArray();
+                            while (accounts.MoveNext())
+                            {
+                                JsonElement account = accounts.Current;
+                                teacherCount_list.Add(account.GetProperty("id").GetString());
+                            }
+                        }
+                    }
+
+                    //查询学校学生人数
+                    await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{schoolId}") }))
+                    {
+                        using var json = await JsonDocument.ParseAsync(item.ContentStream);
+                        if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
+                        {
+                            var accounts = json.RootElement.GetProperty("Documents").EnumerateArray();
+                            while (accounts.MoveNext())
+                            {
+                                JsonElement account = accounts.Current;
+                                studentCount_List.Add(account.GetProperty("id").GetString());
+                            }
+                        }
+                    }
+
+                    return Ok(new { TeacherCount = teacherCount_list.Count, StudentCount = studentCount_List.Count });
+                }
+                else
+                {
+                    //查询全部教师人数
+                    await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryStreamIterator(queryText: $"select * from c ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
+                    {
+                        using var json = await JsonDocument.ParseAsync(item.ContentStream);
+                        if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
+                        {
+                            var accounts = json.RootElement.GetProperty("Documents").EnumerateArray();
+                            while (accounts.MoveNext())
+                            {
+                                JsonElement account = accounts.Current;
+                                teacherCount_list.Add(account.GetProperty("id").GetString());
+                            }
+                        }
+                    }
+
+                    //查询全部学生人数
+                    await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.pk='Base'"))
+                    {
+                        using var json = await JsonDocument.ParseAsync(item.ContentStream);
+                        if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
+                        {
+                            var accounts = json.RootElement.GetProperty("Documents").EnumerateArray();
+                            while (accounts.MoveNext())
+                            {
+                                JsonElement account = accounts.Current;
+                                studentCount_List.Add(account.GetProperty("id").GetString());
+                            }
+                        }
+                    }
+
+                    //查询已创建多少学校
+                    await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: $"select c.id,c.size from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") })) 
                     {
-                        JsonElement account = accounts.Current;
-                        teacherCount_list.Add(account.GetProperty("id").GetString());
+                        using var json = await JsonDocument.ParseAsync(item.ContentStream);
+                        if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
+                        {
+                            var accounts = json.RootElement.GetProperty("Documents").EnumerateArray();
+                            while (accounts.MoveNext())
+                            {
+                                JsonElement account = accounts.Current;
+                                schoolCount_List.Add(account.GetProperty("id").GetString());
+                                schoolsize += int.Parse(account.GetProperty("size").ToString());
+                            }
+                        }
                     }
+
+                    return Ok(new { TeacherCount = teacherCount_list.Count, StudentCount = studentCount_List.Count, schoolCount = schoolCount_List.Count, schoolsize = schoolsize });
                 }
             }
+            catch (Exception ex)
+            {
+                await _dingDing.SendBotMsg($"BI,{_option.Location} /homestatis/get-numberpeople \n {ex.Message}{ex.StackTrace}", GroupNames.醍摩豆服務運維群組);
+                return BadRequest();
+            }
+        }
 
-            //
-            List<string> studentCount_List = new();
-            await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{schoolId}") })) 
+        /// <summary>
+        /// 其它类型的统计
+        /// </summary>
+        /// <param name="jsonElement"></param>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        [HttpPost("get-othertypes")]
+        public async Task<IActionResult> GetOtherTypes(JsonElement jsonElement) 
+        {
+            try
             {
-                using var json = await JsonDocument.ParseAsync(item.ContentStream);
-                if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
+                if (!jsonElement.TryGetProperty("tmdid", out JsonElement _tmdid)) return BadRequest();
+
+                int surveyJoinCount = 0;
+                int surveyDoneCount = 0;
+                int surveyAreaJoinCount = 0;
+                int surveyAreaDoneCount = 0;
+                int examJoinCount = 0;
+                int examDoneCount = 0;
+                int examAreaJoinCount = 0;
+                int examAreaDoneCount = 0;
+                int voteJoinCount = 0;
+                int voteDoneCount = 0;
+                int voteAreaJoinCount = 0;
+                int voteAreaDoneCount = 0;
+
+                //问卷调查
+                await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Teacher")
+                 .GetItemQueryIterator<StuActivity>(queryText: $"select c.owner, c.taskStatus from c where c.type = 'Survey' ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Activity-{_tmdid}") }))
                 {
-                    var accounts = json.RootElement.GetProperty("Documents").EnumerateArray();
-                    while (accounts.MoveNext()) 
+                    if (!string.IsNullOrEmpty(item.owner))
                     {
-                        JsonElement account = accounts.Current;
-                        studentCount_List.Add(account.GetProperty("id").GetString());
+                        if (item.owner.Equals("school"))
+                        {
+                            surveyJoinCount += 1;
+                            if (item.taskStatus > 0)
+                            {
+                                surveyDoneCount += 1;
+                            }
+                        }
+                        else if (item.owner.Equals("area"))
+                        {
+                            surveyAreaJoinCount += 1;
+                            if (item.taskStatus > 0)
+                            {
+                                surveyAreaDoneCount += 1;
+                            }
+                        }
                     }
                 }
-            }
-
 
+                //评量检测
+                await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Teacher")
+                  .GetItemQueryIterator<StuActivity>(queryText: $"select c.owner, c.taskStatus from c where c.type = 'ExamLite' ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Activity-{_tmdid}") }))
+                {
+                    if (!string.IsNullOrEmpty(item.owner))
+                    {
+                        if (item.owner.Equals("school"))
+                        {
+                            examJoinCount += 1;
+                            if (item.taskStatus > 0)
+                            {
+                                examDoneCount += 1;
+                            }
+                        }
+                        else if (item.owner.Equals("area"))
+                        {
+                            examAreaJoinCount += 1;
+                            if (item.taskStatus > 0)
+                            {
+                                examAreaDoneCount += 1;
+                            }
+                        }
+                    }
+                }
 
-            return Ok(new { SchoolTeacherCount = teacherCount_list.Count });
+                //投票活动
+                await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Teacher")
+                 .GetItemQueryIterator<StuActivity>(queryText: $"select c.owner, c.taskStatus from c where c.type = 'Vote' ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Activity-{_tmdid}") }))
+                {
+                    if (!string.IsNullOrEmpty(item.owner))
+                    {
+                        if (item.owner.Equals("school"))
+                        {
+                            voteJoinCount += 1;
+                            if (item.taskStatus > 0)
+                            {
+                                voteDoneCount += 1;
+                            }
+                        }
+                        else if (item.owner.Equals("area"))
+                        {
+                            voteAreaJoinCount += 1;
+                            if (item.taskStatus > 0)
+                            {
+                                voteAreaDoneCount += 1;
+                            }
+                        }
+                    }
+                }
 
 
+                return Ok(new { surveyJoinCount, surveyDoneCount, surveyAreaJoinCount, surveyAreaDoneCount, examJoinCount, examDoneCount, examAreaJoinCount, examAreaDoneCount, voteJoinCount, voteDoneCount, voteAreaJoinCount, voteAreaDoneCount, });
+            }
+            catch (Exception ex)
+            {
+                await _dingDing.SendBotMsg($"BI,{_option.Location} /homestatis/get-othertypes \n {ex.Message}{ex.StackTrace}", GroupNames.醍摩豆服務運維群組);
+                return BadRequest();
+            }
         }
+
+
     }
 }

+ 76 - 32
TEAMModeBI/Controllers/DingDingStruc/DDStructController.cs

@@ -359,38 +359,12 @@ namespace TEAMModeBI.Controllers.DingDingStruc
                         {
                             DDUserInfoAndTMD dDUserInfoAndTMD = new DDUserInfoAndTMD();
                             dDUserInfoAndTMD.Unionid = rspUserInfo.Result.Unionid;
-                            dDUserInfoAndTMD.UnionEmpExt = rspUserInfo.Result.UnionEmpExt;
-                            dDUserInfoAndTMD.Title = rspUserInfo.Result.Title;
-                            dDUserInfoAndTMD.Telephone = rspUserInfo.Result.Telephone;
-                            dDUserInfoAndTMD.StateCode = rspUserInfo.Result.StateCode;
-                            dDUserInfoAndTMD.Senior = rspUserInfo.Result.Senior;
-                            dDUserInfoAndTMD.RoleList = rspUserInfo.Result.RoleList;
-                            dDUserInfoAndTMD.Remark = rspUserInfo.Result.Remark;
-                            dDUserInfoAndTMD.RealAuthed = rspUserInfo.Result.RealAuthed;
-                            dDUserInfoAndTMD.OrgEmailType = rspUserInfo.Result.OrgEmailType;
-                            dDUserInfoAndTMD.OrgEmail = rspUserInfo.Result.OrgEmail;
-                            dDUserInfoAndTMD.Name = rspUserInfo.Result.Name;
-                            dDUserInfoAndTMD.Mobile = rspUserInfo.Result.Mobile;
-                            dDUserInfoAndTMD.ManagerUserid = rspUserInfo.Result.ManagerUserid;
+                            dDUserInfoAndTMD.title = rspUserInfo.Result.Title;
                             dDUserInfoAndTMD.Userid = rspUserInfo.Result.Userid;
-                            dDUserInfoAndTMD.LoginId = rspUserInfo.Result.LoginId;
-                            dDUserInfoAndTMD.JobNumber = rspUserInfo.Result.JobNumber;
-                            dDUserInfoAndTMD.HiredDate = rspUserInfo.Result.HiredDate;
-                            dDUserInfoAndTMD.HideMobile = rspUserInfo.Result.HideMobile;
-                            dDUserInfoAndTMD.Extension = rspUserInfo.Result.Extension;
-                            dDUserInfoAndTMD.ExclusiveAccountType = rspUserInfo.Result.ExclusiveAccountType;
-                            dDUserInfoAndTMD.ExclusiveAccount = rspUserInfo.Result.ExclusiveAccount;
-                            dDUserInfoAndTMD.Email = rspUserInfo.Result.Email;
-                            dDUserInfoAndTMD.DeptPositionList = rspUserInfo.Result.DeptPositionList;
-                            dDUserInfoAndTMD.DeptOrderList = rspUserInfo.Result.DeptOrderList;
-                            dDUserInfoAndTMD.DeptIdList = rspUserInfo.Result.DeptIdList;
-                            dDUserInfoAndTMD.Boss = rspUserInfo.Result.Boss;
-                            dDUserInfoAndTMD.Avatar = rspUserInfo.Result.Avatar;
-                            dDUserInfoAndTMD.Admin = rspUserInfo.Result.Admin;
-                            dDUserInfoAndTMD.Active = rspUserInfo.Result.Active;
-                            dDUserInfoAndTMD.LeaderInDept = rspUserInfo.Result.LeaderInDept;
-                            dDUserInfoAndTMD.WorkPlace = rspUserInfo.Result.WorkPlace;
-                            
+                            dDUserInfoAndTMD.jobNumber = rspUserInfo.Result.JobNumber;
+                            dDUserInfoAndTMD.name = rspUserInfo.Result.Name;
+                            dDUserInfoAndTMD.deptIdList = rspUserInfo.Result.DeptIdList;
+
                             string sqltxt = $"select distinct value(c) from c join A1 in c.ddbinds where A1.userid ='{tempid}'";
                             try
                             {
@@ -398,9 +372,38 @@ namespace TEAMModeBI.Controllers.DingDingStruc
                                 {
                                     dDUserInfoAndTMD.tmdid = item.id;
                                     dDUserInfoAndTMD.isexist = true;
+
+                                    if (!string.IsNullOrEmpty($"{item.defaultSchool}"))
+                                    {
+                                        List<string> roles = new List<string>();//角色列表
+                                        List<string> power = new List<string>();//权限列表
+                                        var schoolRoles = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").ReadItemStreamAsync(item.id, new PartitionKey($"Teacher-{item.defaultSchool}"));
+                                        if (schoolRoles.Status == 200)
+                                        {
+                                            using var json = await JsonDocument.ParseAsync(schoolRoles.ContentStream);
+                                            if (json.RootElement.TryGetProperty("roles", out JsonElement _roles) && _roles.ValueKind != JsonValueKind.Null)
+                                            {
+                                                foreach (var obj in _roles.EnumerateArray())
+                                                {
+                                                    roles.Add(obj.GetString());
+                                                }
+                                            }
+                                            if (json.RootElement.TryGetProperty("permissions", out JsonElement _permissions) && _permissions.ValueKind != JsonValueKind.Null)
+                                            {
+                                                foreach (var obj in _permissions.EnumerateArray())
+                                                {
+                                                    power.Add(obj.GetString());
+                                                }
+                                            }
+                                        }
+
+                                        dDUserInfoAndTMD.tmdroles = roles;
+                                        dDUserInfoAndTMD.tmdpower = power;
+                                    }
                                 }
                             }
                             catch { }
+
                             dDUserInfoAndTMDs.Add(dDUserInfoAndTMD);
                         }
                         else return Ok(new { state = 2, message = "访问失败!" });
@@ -419,7 +422,7 @@ namespace TEAMModeBI.Controllers.DingDingStruc
         /// <summary>
         /// 返回钉钉和能查询到醍摩豆信息
         /// </summary>
-        public class DDUserInfoAndTMD : UserGetResponseDomain
+        public class DDUserInfoAndTMD 
         {
             /// <summary>
             /// 是否存在醍摩豆账户
@@ -430,6 +433,47 @@ namespace TEAMModeBI.Controllers.DingDingStruc
             /// 绑定的醍摩豆账户
             /// </summary>
             public string tmdid { get; set; }
+
+            /// <summary>
+            /// 醍摩豆角色
+            /// </summary>
+            public List<string> tmdroles { get; set; }
+
+            /// <summary>
+            /// 醍摩豆角色权限
+            /// </summary>
+            public List<string> tmdpower { get; set; }
+
+            /// <summary>
+            /// 所属部门id列表
+            /// </summary>
+            public List<long> deptIdList { get; set; }
+
+            /// <summary>
+            /// 员工工号
+            /// </summary>
+            public string jobNumber { get; set; }
+
+            /// <summary>
+            /// 员工名称
+            /// </summary>
+            public string name { get; set; }
+
+            /// <summary>
+            /// 职位
+            /// </summary>
+            public string title { get; set; }
+
+            /// <summary>
+            /// 员工在当前开发者企业账号范围内的唯一标识
+            /// </summary>
+            public string Unionid { get; set; }
+
+            /// <summary>
+            /// 用户ID
+            /// </summary>
+            public string Userid { get; set; }
+
         }
 
         public record DeptInfo 

+ 1 - 1
TEAMModelOS.SDK/Models/Cosmos/Teacher/StudyRecord.cs

@@ -14,7 +14,7 @@ namespace TEAMModelOS.SDK.Models.Cosmos.Teacher
         public string sign { get; set; }
         public long signTime { get; set; }
         //0未审核 1 通过 2 未通过
-        public int status { get; set; }
+        public int status { get; set; } = 0;
         public long aTime { get; set; }
     }
 }

+ 11 - 1
TEAMModelOS/ClientApp/src/view/login/Index.vue

@@ -375,7 +375,8 @@ export default {
             },
             userOauth: {
                 code: '',
-                state: ''
+                state: '',
+                identity: ''
             },
             identityFlag: false,
             lang: localStorage.getItem('local')
@@ -394,6 +395,15 @@ export default {
         // 取得學校設定簡碼
         this.setDefSchool()
 
+        //用户登录身份
+        this.userOauth.identity = this.$route.query.identity // student 或 teacher
+        if (this.userOauth.identity) {
+            console.log('重新设置身份', this.userOauth.identity)
+            localStorage.setItem('identity', this.userOauth.identity)
+        }else{
+            console.log('没有设置身份',this.$route.query)
+        }
+
         //TEAMModelID 社群登入資訊
         this.userOauth.code = this.$route.query.code
         this.userOauth.state = this.$route.query.state

+ 14 - 26
TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.vue

@@ -134,19 +134,16 @@
                         <div v-show="tabName == 'record'" class="animated fadeIn class-record-wrap">
                             <vuescroll>
                                 <List>
-                                    <ListItem v-for="(item,index) in itemNum" :key="index">
+                                    <ListItem v-for="(item,index) in recordList" :key="index">
                                         <ListItemMeta @click.native="toClassRecoerd">
-                                            <p slot="title" class="record-name" style="padding-left:10px">力的组成</p>
-                                            <!-- <span slot="avatar" style="margin-top:4px;display: inline-block;margin-left:10px;">
-                                                <Icon custom="iconfont icon-whiteboard" size="30"/>
-                                            </span> -->
+                                            <p slot="title" class="record-name" style="padding-left:10px">{{item.name}}</p>
                                             <div slot="description" style="padding-left:10px">
-                                                <span class="hiteacher-version">
+                                                <!-- <span class="hiteacher-version">
                                                     V3.0.32
-                                                </span>
-                                                <Time class="record-time" :time="((new Date()).getTime() - 60 * 3 * 1000)" />
+                                                </span> -->
+                                                <Time class="record-time" :time="(new Date(item.updTime)).getTime()" />
                                                 <div class="record-action-wrap">
-                                                    <Icon class="action-icon" type="md-analytics" :title="$t('cusMgt.cusRecord')" @click="toClassRecoerd" />
+                                                    <!-- <Icon class="action-icon" type="md-analytics" :title="$t('cusMgt.cusRecord')" @click="toClassRecoerd" /> -->
                                                     <Icon class="action-icon" type="ios-stats" :title="$t('cusMgt.socrateReport')" @click="toClassRecoerd" />
                                                     <Icon class="action-icon" custom="iconfont icon-video" :title="$t('cusMgt.socrateMv')" @click="toClassRecoerd" />
                                                     <Icon class="action-icon" custom="iconfont icon-hi" :title="$t('cusMgt.elNotes')" @click="toClassRecoerd" />
@@ -157,7 +154,7 @@
                                         </ListItemMeta>
                                     </ListItem>
                                 </List>
-                                <EmptyData v-show="itemNum == 0" :textContent="$t('cusMgt.noRecord')" :top="150"></EmptyData>
+                                <EmptyData v-show="recordList.length == 0" :textContent="$t('cusMgt.noRecord')" :top="150"></EmptyData>
                             </vuescroll>
                         </div>
                         <!-- 活动记录 -->
@@ -201,20 +198,6 @@
                                 <EmptyData v-show="acList.length == 0" :textContent="acTypeLabel + $t('cusMgt.noAc')" :top="150"></EmptyData>
                             </vuescroll>
                         </div>
-                        <!-- 个人课程时段 暂不实做-->
-                        <!-- <div v-show="tabName == 'time'" class="animated fadeIn class-record-wrap">
-                            <vuescroll>
-                                <h2 style="margin-top:120px;color:#ddd;text-align:center"> 
-                                    1、如果教师没有加入学校,拿不到时段设置,不能渲染课表;
-                                </h2>
-                                <h2 style="margin-top:20px;color:#ddd;text-align:center">
-                                    2、个人课程没有关联学段,不能确定使用哪个学段的时间;
-                                </h2>
-                                <h2 style="margin-top:20px;color:#ddd;text-align:center">
-                                    3、如果支持老师个人创建时段管理,会不会变成学校可以用的老师都能用。
-                                </h2>
-                            </vuescroll>
-                        </div>-->
                     </div>
                 </Split>
             </div>
@@ -496,7 +479,13 @@ export default {
                     sortable: true
                 },
             ],
-            itemNum: 0,
+            recordList: [
+                {
+                    name:'智慧B(45)',
+                    url:'https://teammodelstorage.blob.core.chinacloudapi.cn/0-public/testdata/record/246548053887160320',
+                    updTime:1637052534063
+                }
+            ],
             editClassStatus: false,
             showQrStatus: false,
             listLoading: false,
@@ -1511,7 +1500,6 @@ export default {
         }
     },
     created() {
-        this.itemNum = this.$store.state.config.srvAdrType == 'product' ? 0 : 5
         this.getAllStuList()
         //直接读取登录成功拿到得学校基础信息
         this.$store.dispatch('user/getSchoolProfile').then(res => {

+ 0 - 228
TEAMModelOS/ClientApp/src/view/sso/Index copy.vue

@@ -1,228 +0,0 @@
-<template>
-    <div class="sso-container">
-        <img class="tmd-logo" src="/favicon.ico" alt="">
-        <h1 class="title">醍摩豆单点登录</h1>
-    </div>
-</template>
-<script>
-import MD5 from 'js-md5'
-import jwtDecode from 'jwt-decode'
-import { User } from '@/service/User'
-export default {
-    data() {
-        return {
-            routerData: {},
-            iesLoginRes: {}
-        }
-    },
-    methods: {
-        toLoginBanding() {
-            let clientId, accUrl
-            //国际站
-            if (this.$store.state.config.srvAdr == 'Global') {
-                clientId = this.$store.state.config.Global.clientID
-                accUrl = this.$store.state.config.Global.accAPIUrl
-            }
-            // 大陆站
-            else {
-                clientId = this.$store.state.config.China.clientID
-                accUrl = this.$store.state.config.China.accAPIUrl
-            }
-            let callback = decodeURIComponent(window.location.href)
-            let state = this.$jsFn.getBtwRandom(1000, 9999)
-            let nonce = this.$jsFn.uuid()
-            accUrl = process.env.NODE_ENV == 'development' ? 'https://account-rc.teammodel.cn' : accUrl
-            let loginUrl = `${accUrl}/oauth2/authorize?response_type=code&client_id=${clientId}&state=${state}&nonce=${nonce}&redirect_uri=${encodeURIComponent(callback)}`
-            window.location.href = loginUrl
-        },
-        bandingID(idToken) {
-            let params = {
-                "opt": "BindTmdidInfo",
-                "Pxid": this.routerData.Pxid,
-                "Webid": this.routerData.Webid,
-                "time": this.routerData.time,
-                "tid": this.routerData.tid,
-                "Encrypt": this.routerData.Encrypt,
-                "id_token": idToken || localStorage.getItem('id_token')
-            }
-            this.$api.train.provinceLogin(params).then(
-                res => {
-                    //绑定成功
-                    if (res && res.status == 200) {
-                        if (localStorage.getItem('id_token')) {
-                            this.$router.push({
-                                name: 'home'
-                            })
-                        } else {
-                            this.loginProcess(this.iesLoginRes)
-                        }
-                    } else {
-                        this.$Message.error("绑定失败")
-                    }
-                },
-                err => {
-
-                }
-            )
-        },
-        checkIESCode(code) {
-            //获取登录信息
-            let addr = this.$store.state.config.srvAdr
-            let host = addr == 'Global' ? this.$store.state.config.Global.coreAPIUrl : this.$store.state.config.China.coreAPIUrl
-            let clientId = addr == 'Global' ? this.$store.state.config.Global.clientID : this.$store.state.config.China.clientID
-            this.$api.service.getToken(host, {
-                grant_type: "authorization_code",
-                client_id: clientId,
-                code: code
-            }).then(
-                res => {
-                    if (!res.error) {
-                        this.iesLoginRes = res
-                        this.id_token = res.id_token
-                        let tokenData = jwtDecode(res.id_token)
-                        if (tokenData) {
-                            let userId = tokenData.sub
-                            let userName = tokenData.name
-                            this.$Modal.confirm({
-                                title: '账号绑定',
-                                content: `您已登录醍摩豆账号。醍摩豆账号信息如下:</br>昵称:${userName}</br>醍摩豆ID:${userId}</br>请问是否应用此醍摩豆账号绑定省平台账号?`,
-                                okText: '是',
-                                cancelText: '否',
-                                onOk: () => {
-                                    this.bandingID(res.id_token)
-                                }
-                            })
-                        } else {
-                            this.$Message.error(this.$t('cusMgt.join.parseErr'))
-                        }
-                    } else {
-                        this.$Message.error(this.$t('cusMgt.join.getErr'))
-                    }
-                },
-                err => {
-                    this.$Message.error(this.$t('cusMgt.join.getErr'))
-                }
-            )
-        },
-        loginProcess(idRes) { // 登入用function
-            this.$api.login.loginIES(idRes).then(res => {
-                //設定權限並登入
-                User.login(res).then(res => {
-                    if (res) {
-                        this.$store.commit('setUserInfo', {
-                            TEAMModelId: res.id,
-                            name: res.name,
-                            schoolCode: res.defaultschool
-                        })
-                        if (res.toArea) {
-                            localStorage.setItem('platform', 'area')
-                            this.$router.push({ path: '/area' })
-                        } else {
-                            localStorage.setItem('platform', 'school')
-                            this.$router.push({ path: '/home' })
-                        }
-                    }
-                })
-            })
-
-        },
-    },
-    created() {
-        console.log('配置信息', this.$store.state.config)
-        this.routerData = this.$route.query
-        if (this.routerData.Encrypt && this.routerData.Pxid && this.routerData.Webid && this.routerData.tid && this.routerData.time) {
-            let str = `Pxid=${this.routerData.Pxid}&Webid=${this.routerData.Webid}&tid=${this.routerData.tid}&time=${this.routerData.time}`
-            let md5Res = MD5(str)
-            console.log('加密结果', md5Res)
-            if (md5Res != this.routerData.Encrypt) {
-                this.$Message.error({
-                    content: '参数异常,验证失败',
-                    duration: 2
-                })
-            } else if (this.routerData.code) {
-                this.checkIESCode(this.routerData.code)
-            } else {
-                let params = {
-                    "opt": "CheckBindInfo",
-                    "Pxid": this.routerData.Pxid,
-                    "Webid": this.routerData.Webid,
-                    "time": this.routerData.time,
-                    "tid": this.routerData.tid,
-                    "Encrypt": this.routerData.Encrypt,
-                    "id_token": localStorage.getItem('id_token')
-                }
-                this.$api.train.provinceLogin(params).then(
-                    res => {
-                        // 账号未绑定
-                        if (res && res.status == 0) {
-                            //已经登录TMID
-                            if (localStorage.getItem('id_token')) {
-                                let id = '15358245'
-                                let name = 'lqk'
-                                this.$Modal.confirm({
-                                    title: '账号绑定',
-                                    content: `您已登录醍摩豆账号。醍摩豆账号信息如下:</br>昵称:${name}</br>醍摩豆ID:${id}</br>请问是否应用此醍摩豆账号绑定省平台账号?`,
-                                    okText: '是',
-                                    cancelText: '否',
-                                    onOk: () => {
-                                        this.bandingID()
-                                    }
-                                })
-                            }
-                            //前往登录页面
-                            else {
-                                this.$Modal.confirm({
-                                    title: '账号绑定',
-                                    content: `您暂未绑定醍摩豆ID,是否前往登录醍摩豆ID进行绑定?`,
-                                    okText: '是',
-                                    cancelText: '否',
-                                    onOk: () => {
-                                        this.toLoginBanding()
-                                    }
-                                })
-                            }
-                        }
-                        //参数异常
-                        else if (res && res.status == 1) {
-                            this.$Message.error({
-                                content: '参数错误,登录失败',
-                                duration: 2
-                            })
-                        }
-                        // 已绑定,自动登录
-                        else if (res && res.status == 200 && res.implicit_token) {
-                            this.loginProcess(res.implicit_token)
-                        }
-                    },
-                    err => {
-
-                    }
-                )
-            }
-        } else {
-            this.$Message.error({
-                content: '参数错误,登录失败',
-                duration: 2
-            })
-        }
-    }
-}
-</script>
-<style scoped lang="less">
-.sso-container {
-    display: flex;
-    flex-direction: row;
-    justify-content: center;
-    align-items: center;
-    width: 100%;
-    height: 100%;
-    background-image: url("../../assets/image/bak_light.jpg");
-    .title {
-        color: #f0f0f0;
-        margin-left: 30px;
-    }
-    .tmd-logo {
-        width: 40px;
-    }
-}
-</style>

+ 4 - 6
TEAMModelOS/ClientApp/src/view/train/PhoneSign.vue

@@ -72,7 +72,7 @@ export default {
             topic: '',
             code: '',
             userId: '',
-            p:{}
+            p: {}
         }
     },
     methods: {
@@ -86,14 +86,12 @@ export default {
             this.$api.train.signIn(params).then(
                 res => {
                     this.$Message.success('签到成功')
-
+                    this.isSign = true
                 },
                 err => {
-
+                    this.$Message.error('签到失败')
                 }
-            ).finally(() => {
-                this.isSign = true
-            })
+            )
         }
     },
     created() {

+ 13 - 53
TEAMModelOS/ClientApp/src/view/train/TrainDetail.vue

@@ -525,7 +525,8 @@ export default {
                 }
             ],
             examTableData: [],
-            tableData: []
+            tableData: [],
+            checkData: []
         }
     },
     computed: {
@@ -698,7 +699,6 @@ export default {
         getSurveyInfo() {
             let params = {
                 id: this.trainInfo.surveyId,
-                // code: this.$store.state.userInfo.schoolCode
                 code: 'Survey-' + this.$store.state.userInfo.schoolCode
             }
             this.$api.questionnaire.FindSurveysSummary(params).then(
@@ -777,7 +777,6 @@ export default {
                 id: this.trainInfo.workId,
                 code: this.$store.state.userInfo.schoolCode
             }
-            // this.$api.ability.getWorkSummary(params).then(
             // 查询作业详细信息
             this.$api.learnActivity.FindHomeWorkById(params).then(
                 res => {
@@ -800,16 +799,11 @@ export default {
                                             return item.userid == s.id
                                         })
                                         if (t) {
-                                            // let info = this.getExAndType(item.hw)
-                                            // t.fileType = info.type
-                                            // t.extension = info.ex
                                             t.hwTime = item.submitTime
                                             item.content.forEach(c => {
                                                 c.url = `${c.url}${sasData.sas}`
                                             })
                                             t.hwData = item.content
-                                            // t.hw = item.hw
-                                            // t.url = `${sasData.url}/${sasData.name}${item.hw}${sasData.sas}`
                                         }
                                     })
                                     this.hwTableData = JSON.parse(JSON.stringify(this.tableData))
@@ -838,8 +832,6 @@ export default {
             }
         },
         viewHw(index) {
-            // this.$Message.warning('暂未对接API')
-            // return
             this.viewIndex = index
             this.hwViewStatus = true
         },
@@ -961,6 +953,7 @@ export default {
                     res => {
                         if (res && res.study) {
                             this.trainInfo = res.study
+                            this.checkData = res.records
                             if (this.trainInfo.settings.includes('sign')) {
                                 this.columns.push({
                                     title: this.$t('train.detail.signTime'),
@@ -1001,7 +994,6 @@ export default {
                                 align: 'center'
                             })
                             this.getTeachers()
-                            // this.getTeachers(res.teachers)
                         }
                     },
                     err => {
@@ -1020,6 +1012,16 @@ export default {
                 this.$api.common.getGroupListByIds(params).then(
                     res => {
                         if (res && res.members) {
+                            res.members.forEach(teacher => {
+                                let data = this.checkData.find(t => t.tId === teacher.id)
+                                if (data) {
+                                    teacher.signTime = data.signTime
+                                    teacher.sign = data.sign
+                                    teacher.status = data.status
+                                }else{
+                                    teacher.status = 0
+                                }
+                            })
                             this.tableData = res.members
                             if (this.trainInfo.settings.includes('survey')) {
                                 this.getSurveyInfo()
@@ -1039,48 +1041,6 @@ export default {
                     }
                 )
             }
-            //由DB取得該校所有使用者並放入state.schoolUserList
-            // this.$store.dispatch('user/getSchoolTeacher').then(
-            //     async res => {
-            //         if (res.code == 0) {
-            //             this.$Message.error('無法取得使用者資料')
-            //         }
-            //         if (ids) {
-            //             this.tableData = []
-            //             ids.forEach(item => {
-            //                 let t = this.teachers.find(tItem => {
-            //                     return tItem.id == item
-            //                 })
-            //                 if (t) {
-            //                     delete t.status
-            //                     //处理教师研修数据
-            //                     let tData = this.trainInfo.teachers.find(td => {
-            //                         return td.id == item
-            //                     })
-            //                     if (tData) {
-            //                         tData.name = t.name
-            //                         Object.assign(t, tData)
-            //                     }
-            //                     t.status = t.status ? t.status : 0
-            //                     this.tableData.push(t)
-            //                 }
-            //             })
-            //             if (this.trainInfo.settings.includes('survey')) {
-            //                 this.getSurveyInfo()
-            //             }
-            //             if (this.trainInfo.settings.includes('exam')) {
-            //                 this.getExamInfo()
-            //             }
-            //             if (this.trainInfo.settings.includes('hw')) {
-            //                 this.getWorkInfo()
-            //             }
-
-            //         }
-            //     },
-            //     err => {
-            //         this.$Message.error('user/setSchoolTeacher API error!')
-            //     }
-            // )
         },
         //获取文件后缀和类型
         getExAndType(fileName) {

+ 1 - 1
TEAMModelOS/Controllers/Common/StudyController.cs

@@ -439,7 +439,7 @@ namespace TEAMModelOS.Controllers.Common
                 {
                     var json = await JsonDocument.ParseAsync(response.ContentStream);
                     StudyRecord study = json.ToObject<StudyRecord>();
-                    if (study.id.Equals(tId.GetString()))
+                    if (study.tId.Equals(tId.GetString()))
                     {
                         study.status = type.GetInt32();
                         study.aTime = now;