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

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

CrazyIter_Bin 3 éve
szülő
commit
899df50dae

+ 1 - 1
TEAMModelBI/ClientApp/src/router/index.js

@@ -1,4 +1,4 @@
-import { createWebHashHistory, createRouter } from "vue-router";
+import { createRouter, createWebHashHistory } from "vue-router";
 // import store from '@/store/index.js'
 const routes = [{
         path: "/",

+ 1 - 1
TEAMModelBI/ClientApp/src/view/ddlogin.vue

@@ -12,7 +12,7 @@ export default {
     data() {
         return {
             appid: 'dingrucgsnt8p13rfbgd',
-            redirectUrl: 'https://bitest.teammodel.cn/login',
+            redirectUrl: 'https://' + JSON.parse(localStorage.getItem('Host')) + '/login',
             apiUrl: '/common/login/DingLogin',
             dingCodeConfig: {
                 id: 'login_container',

+ 68 - 48
TEAMModelBI/ClientApp/src/view/login.vue

@@ -37,7 +37,7 @@
             </div> -->
         </div>
         <!-- <div id="login_container" style="transform: scale(.8);">123456</div> -->
-        <bind :callbackStatus=callbackStatus v-if="callbackStatus.state ===200" ref="comRef"></bind>
+        <bind :callbackStatus=callbackStatus v-if="callbackStatus.state ===201" ref="comRef"></bind>
     </div>
 </template>
 <script>
@@ -84,6 +84,7 @@ export default {
             }
             var types = navigator.language
             localStorage.setItem('language', JSON.stringify(types))
+            localStorage.setItem('Host', JSON.stringify(window.location.host))
         })
         //处理登录icon变化
         watch(loginModel, () => {
@@ -105,61 +106,80 @@ export default {
                     callbackStatus.value.state = res.state
                     callbackStatus.value.partitionKey = res.ddUserId.partitionKey
                     callbackStatus.value.rowKey = res.ddUserId.rowKey
-                    res.state === 200 ? (store.commit('BindStatus', true), loading.close(), (callbackStatus.value.phoneNum = res.ddUserId.mobile)) : res.state === 0 ? ElMessage.error(res.message) : ''
+                    res.state === 201
+                        ? (store.commit('BindStatus', true), loading.close(), (callbackStatus.value.phoneNum = res.ddUserId.mobile))
+                        : res.state === 200
+                        ? (loading.close(), getOrganization(), Allpermission(), ElMessage.success('登录成功'), router.push({ path: '/dashboard' }))
+                        : (loading.close(), ElMessage.error(res.message))
                 })
             }
             return {
                 editState,
             }
         }
-        //钉钉账号或扫码登录
-        function userlogin(proxy) {
-            loading = ElLoading.service({
-                lock: true,
-                text: 'Loading',
-                background: 'rgba(0, 0, 0, 0.7)',
+        //获取组织架构
+        function getOrganization() {
+            console.log(proxy, '检查proxy')
+            proxy.$api.getorganization().then((res) => {
+                console.log(res, '组织架构返回的内容')
+                res.state === 200 ? (store.commit('ChangOrganization', res.deptlist), localStorage.setItem('organization', JSON.stringify(res.deptlist))) : ''
             })
-            let nonceNum = Math.floor(Math.random() * 10000)
-            console.log(nonceNum, '随机数')
-            let params = {
-                grant_type: 'account',
-                client_id: 'c7317f88-7cea-4e48-ac57-a16071f7b884',
-                nonce: 'habook',
-                account: user.value,
-                password: pwd.value,
-            }
-            // proxy.$api.loginUser(params).then(async (res) => {
-            //     console.log(res, '登录接口返回成功!')
-            //     res.error
-            //         ? (ElMessage.error('密码错误'), loading.close())
-            //         : res.id_token
-            //         ? (getTeachinfo(proxy, res.id_token), Allpermission(proxy), getOrganization(proxy))
-            //         : (loading.close(), ElMessage.error('登录失败'))
-            //     // router.push("/home");
-            // })
         }
-        //获取教师个人信息
-        function getTeachinfo(proxy, param) {
-            let parameter = { id_token: param }
-            proxy.$api.teacherinfo(parameter).then((res) => {
-                if (res.state === 1) {
-                    ElMessage.warning('该账户未绑定钉钉信息!请扫码绑定信息!')
-                    loginModel.value = false
-                } else {
-                    localStorage.setItem('userData', JSON.stringify(res))
-                    console.log(res, '教室个人信息')
-                    let jwt_authtoken = {
-                        jwt_user: jwt_decode(res.auth_token),
-                    }
-                    res = Object.assign(res, jwt_authtoken)
-                    res.state === 200 ? store.commit('getTeachdata', res) : []
-                    loading.close()
-                    ElMessage.success('登录成功')
-                    store.commit('getBlobsas', { host: res.osblob_uri, sas: res.osblob_sas })
-                    // router.push('/home')
-                }
+        //获取所有权限表
+        function Allpermission() {
+            proxy.$api.getAllpermission().then((res) => {
+                console.log(res, '权限列表')
+                res.authorityBIList ? (store.commit('getPermission', res.authorityBIList), localStorage.setItem('management', JSON.stringify(res.authorityBIList))) : []
             })
         }
+        // //钉钉账号或扫码登录
+        // function userlogin(proxy) {
+        //     loading = ElLoading.service({
+        //         lock: true,
+        //         text: 'Loading',
+        //         background: 'rgba(0, 0, 0, 0.7)',
+        //     })
+        //     let nonceNum = Math.floor(Math.random() * 10000)
+        //     console.log(nonceNum, '随机数')
+        //     let params = {
+        //         grant_type: 'account',
+        //         client_id: 'c7317f88-7cea-4e48-ac57-a16071f7b884',
+        //         nonce: 'habook',
+        //         account: user.value,
+        //         password: pwd.value,
+        //     }
+        //     // proxy.$api.loginUser(params).then(async (res) => {
+        //     //     console.log(res, '登录接口返回成功!')
+        //     //     res.error
+        //     //         ? (ElMessage.error('密码错误'), loading.close())
+        //     //         : res.id_token
+        //     //         ? (getTeachinfo(proxy, res.id_token), Allpermission(proxy), getOrganization(proxy))
+        //     //         : (loading.close(), ElMessage.error('登录失败'))
+        //     //     // router.push("/home");
+        //     // })
+        // }
+        // //获取教师个人信息
+        // function getTeachinfo(proxy, param) {
+        //     let parameter = { id_token: param }
+        //     proxy.$api.teacherinfo(parameter).then((res) => {
+        //         if (res.state === 1) {
+        //             ElMessage.warning('该账户未绑定钉钉信息!请扫码绑定信息!')
+        //             loginModel.value = false
+        //         } else {
+        //             localStorage.setItem('userData', JSON.stringify(res))
+        //             console.log(res, '教室个人信息')
+        //             let jwt_authtoken = {
+        //                 jwt_user: jwt_decode(res.auth_token),
+        //             }
+        //             res = Object.assign(res, jwt_authtoken)
+        //             res.state === 200 ? store.commit('getTeachdata', res) : []
+        //             loading.close()
+        //             ElMessage.success('登录成功')
+        //             store.commit('getBlobsas', { host: res.osblob_uri, sas: res.osblob_sas })
+        //             // router.push('/home')
+        //         }
+        //     })
+        // }
         return {
             comRef,
             store,
@@ -171,11 +191,11 @@ export default {
             userCode,
             editState,
             callbackStatus,
-            userlogin,
             router,
-            getTeachinfo,
             loading,
             msgText,
+            getOrganization,
+            Allpermission,
         }
     },
 }

+ 2 - 73
TEAMModelBI/Controllers/BISchool/BatchSchoolController.cs

@@ -15,7 +15,6 @@ using TEAMModelOS.SDK.DI;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models.Cosmos.BI;
-using static TEAMModelOS.SDK.Models.Teacher;
 using Microsoft.AspNetCore.Hosting;  //引用读取文件
 using TEAMModelOS.SDK.Models.Service;
 using System.IO;
@@ -327,7 +326,7 @@ namespace TEAMModeBI.Controllers.BISchool
                                     //创建账号并第一次登录IES5则默认赠送1G
                                     size = 1,
                                     defaultSchool = createSchoolInfo.id,
-                                    schools = new List<Teacher.TeacherSchool>() { new TeacherSchool { schoolId = createSchoolInfo.id, name = bischool.name, status = "join", time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() } }
+                                    schools = new List<Teacher.TeacherSchool>() { new Teacher.TeacherSchool { schoolId = createSchoolInfo.id, name = bischool.name, status = "join", time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() } }
                                 };
 
                                 stringBuilder.Append($"没有该教师信息创建的教师信息:{addteacher.name}【{addteacher.id}】");
@@ -544,59 +543,6 @@ namespace TEAMModeBI.Controllers.BISchool
             }
         }
 
-        /// <summary>
-        /// 修改学校信息
-        /// </summary>
-        /// <param name="school"></param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [AuthToken(Roles = "assist")]
-        [HttpPost("upd-school")]
-        public async Task<IActionResult> UpdSchool(ReplaceSchool replaceSchool)
-        {
-            try
-            {
-                School schoolInfo = new School();
-                var cosmosClient = _azureCosmos.GetCosmosClient();
-
-                School tempShool = await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<School>(replaceSchool.school.id, new PartitionKey("Base"));
-                if (tempShool != null)
-                {
-                    List<Teacher> teachers = new List<Teacher>();
-                    string sqltxt = $"select distinct value(c) from c join a1 in c.schools where a1.schoolId='{replaceSchool.school.id}'";
-                    await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<Teacher>(queryText: sqltxt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
-                    {
-                        teachers.Add(item);
-                    }
-
-                    foreach (var item in teachers)
-                    {
-                        TeacherSchool teacherSchool = item.schools.Find(x => x.schoolId.Equals(replaceSchool.school.id));
-                        if (teacherSchool != null)
-                        {
-                            teacherSchool.name = replaceSchool.school.name;
-                            teacherSchool.picture = replaceSchool.school.picture;
-                            teacherSchool.areaId = replaceSchool.school.areaId;
-                        }
-                        await cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync(item, item.id, new PartitionKey("Base"));
-                    }
-
-                    schoolInfo = await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync<School>(replaceSchool.school, replaceSchool.school.id, new PartitionKey("Base"));
-
-                    //保存操作记录
-                    await _azureStorage.SaveLog("school-update", $"{replaceSchool.tmdName}【{replaceSchool.tmdId}】修改学校信息,学校和ID:{replaceSchool.school.name}【{replaceSchool.school.id}】", _dingDing, httpContext: HttpContext);
-
-                    return Ok(new { state = 200, schoolInfo });
-                }
-                else return Ok(new { state = 400, message = "请求错误!" });
-            }
-            catch (Exception ex)
-            {
-                await _dingDing.SendBotMsg($"BI,{_option.Location}  /batchschool/upd-school \n {ex.Message}{ex.StackTrace}", GroupNames.成都开发測試群組);
-                return BadRequest();
-            }
-        }
-
         /// <summary>
         /// 修改学校信息和顾问信息
         /// </summary>
@@ -685,7 +631,7 @@ namespace TEAMModeBI.Controllers.BISchool
                                 }
                                 else
                                 {
-                                    TeacherSchool teacherSchool = new TeacherSchool
+                                    Teacher.TeacherSchool teacherSchool = new Teacher.TeacherSchool
                                     {
                                         schoolId = tempShool.id,
                                         name = tempShool.name,
@@ -1170,23 +1116,6 @@ namespace TEAMModeBI.Controllers.BISchool
             public string tmdName { get; set; }
         }
 
-        public record ReplaceSchool()
-        {
-            /// <summary>
-            /// 醍摩豆账户ID
-            /// </summary>
-            public string tmdId { get; set; }
-
-            /// <summary>
-            /// 醍摩豆账户名称
-            /// </summary>
-            public string tmdName { get; set; }
-
-            /// <summary>
-            /// 学校
-            /// </summary>
-            public School school { get; set; }
-        }
 
         /// <summary>
         /// 创建多个学校实体

+ 100 - 1
TEAMModelBI/Controllers/BISchool/SchoolController.cs

@@ -24,7 +24,6 @@ namespace TEAMModeBI.Controllers.BISchool
         private readonly DingDing _dingDing;
         private readonly Option _option;
         private readonly AzureStorageFactory _azureStorage;
-        public readonly string mobel = "学校";
 
         public SchoolController(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option) 
         {
@@ -165,6 +164,106 @@ namespace TEAMModeBI.Controllers.BISchool
             return Ok(new { state = 200, schools });
         }
 
+        /// <summary>
+        /// 依据学校编号查询学校信息
+        /// </summary>
+        /// <param name="jsonElement"></param>
+        /// <returns></returns>
+        [HttpPost("get-schoolid")]
+        public async Task<IActionResult> GetSchoolId(JsonElement jsonElement) 
+        {
+            try
+            {
+                if (!jsonElement.TryGetProperty("schoolId", out JsonElement schoolId)) return BadRequest();
+
+                var cosmosClient = _azureCosmos.GetCosmosClient();
+
+                School school = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemAsync<School>($"{schoolId}", new PartitionKey("Base"));
+
+                return Ok(new { state = 200, school });
+
+            }
+            catch (Exception ex)
+            {
+                await _dingDing.SendBotMsg($"BI,{_option.Location}   /schoolcheck/get-schoolid   {ex.Message}{ex.StackTrace}", GroupNames.成都开发測試群組);
+                return BadRequest();
+            }
+        }
+
+        /// <summary>
+        /// 修改学校信息
+        /// </summary>
+        /// <param name="school"></param>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        [AuthToken(Roles = "assist")]
+        [HttpPost("upd-school")]
+        public async Task<IActionResult> UpdSchool(ReplaceSchool replaceSchool)
+        {
+            try
+            {
+                School schoolInfo = new School();
+                var cosmosClient = _azureCosmos.GetCosmosClient();
+
+                School tempShool = await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<School>(replaceSchool.school.id, new PartitionKey("Base"));
+                if (tempShool != null)
+                {
+                    List<Teacher> teachers = new List<Teacher>();
+                    string sqltxt = $"select distinct value(c) from c join a1 in c.schools where a1.schoolId='{replaceSchool.school.id}'";
+                    await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<Teacher>(queryText: sqltxt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
+                    {
+                        teachers.Add(item);
+                    }
+
+                    foreach (var item in teachers)
+                    {
+                        Teacher.TeacherSchool teacherSchool = item.schools.Find(x => x.schoolId.Equals(replaceSchool.school.id));
+                        if (teacherSchool != null)
+                        {
+                            teacherSchool.name = replaceSchool.school.name;
+                            teacherSchool.picture = replaceSchool.school.picture;
+                            teacherSchool.areaId = replaceSchool.school.areaId;
+                        }
+                        await cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync(item, item.id, new PartitionKey("Base"));
+                    }
+
+                    schoolInfo = await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync<School>(replaceSchool.school, replaceSchool.school.id, new PartitionKey("Base"));
+
+                    //保存操作记录
+                    await _azureStorage.SaveLog("school-update", $"{replaceSchool.tmdName}【{replaceSchool.tmdId}】修改学校信息,学校和ID:{replaceSchool.school.name}【{replaceSchool.school.id}】", _dingDing, httpContext: HttpContext);
+
+                    return Ok(new { state = 200, schoolInfo });
+                }
+                else return Ok(new { state = 400, message = "请求错误!" });
+            }
+            catch (Exception ex)
+            {
+                await _dingDing.SendBotMsg($"BI,{_option.Location}  /batchschool/upd-school \n {ex.Message}{ex.StackTrace}", GroupNames.成都开发測試群組);
+                return BadRequest();
+            }
+        }
+
+        /// <summary>
+        /// 修改学校的结构
+        /// </summary>
+        public record ReplaceSchool()
+        {
+            /// <summary>
+            /// 醍摩豆账户ID
+            /// </summary>
+            public string tmdId { get; set; }
+
+            /// <summary>
+            /// 醍摩豆账户名称
+            /// </summary>
+            public string tmdName { get; set; }
+
+            /// <summary>
+            /// 学校
+            /// </summary>
+            public School school { get; set; }
+        }
+
         /// <summary>
         /// 未加入区域的学校
         /// </summary>

+ 3 - 3
TEAMModelOS.FunctionV4/CosmosDB/TriggerCorrect.cs

@@ -248,7 +248,7 @@ namespace TEAMModelOS.FunctionV4
                                             classResults.Add(item);
                                         }
                                     }
-                                    List<Task<ItemResponse<Scoring>>> tasks = new List<Task<ItemResponse<Scoring>>>();
+                                    List<Task<ItemResponse<SDK.Models.Cosmos.Common.Scoring>>> tasks = new List<Task<ItemResponse<SDK.Models.Cosmos.Common.Scoring>>>();
                                     //初始化老师阅卷记录
                                     //List<string> tmds = new List<string>();
                                     /*                                List<string> marks = new List<string>();
@@ -305,7 +305,7 @@ namespace TEAMModelOS.FunctionV4
                                                     }
                                                     n++;
                                                 }
-                                                Scoring sc = new Scoring
+                                                SDK.Models.Cosmos.Common.Scoring sc = new SDK.Models.Cosmos.Common.Scoring
                                                 {
                                                     id = Guid.NewGuid().ToString(),
                                                     code = "Scoring-" + info.school,
@@ -322,7 +322,7 @@ namespace TEAMModelOS.FunctionV4
                                                     model = sub.model
 
                                                 };
-                                                tasks.Add(client.GetContainer(Constant.TEAMModelOS, "Teacher").CreateItemAsync<Scoring>(sc, new Azure.Cosmos.PartitionKey(sc.code)));
+                                                tasks.Add(client.GetContainer(Constant.TEAMModelOS, "Teacher").CreateItemAsync<SDK.Models.Cosmos.Common.Scoring>(sc, new Azure.Cosmos.PartitionKey(sc.code)));
                                             }
                                             //tasks.Add(redisClient.HashSetAsync($"Exam:Scoring:{eid}-{subjectId}", stuId, new { tmdId = tmds, ans = examClass.studentAnswers[index].Count > 0 ? examClass.studentAnswers[index][0] : "", score = examClass.studentScores[index] }.ToJsonString()));
                                         }

+ 2 - 2
TEAMModelOS/ClientApp/src/common/AbilityUpload.vue

@@ -217,7 +217,7 @@
 						console.log('getFileMD5 > convertFileMD5ToString >', blobFile)
 						result.push(blobFile)
 					} catch (e) {
-						this.$Message.error(e.spaceError)
+						this.$Message.error(e.spaceError ? e.spaceError : 'upload Fail')
 						return
 					}
 				}
@@ -237,7 +237,7 @@
 						let blobFile = await containerClient.upload(f, { path:path,checkSize:false });
 						r(blobFile)
 					} catch (e) {
-						this.$Message.error(e.spaceError)
+						this.$Message.error('当前视频可能无法播放,请检查视频编码格式')
 						r(e)
 					}
 				})

+ 1 - 1
TEAMModelOS/ClientApp/src/utils/js-fn.js

@@ -149,7 +149,6 @@ function createVideoPoster(url, name, quality) {
     return new Promise(
         (r, j) => {
             try {
-                console.error(...arguments)
                 let video = document.createElement('video')
                 video.setAttribute('crossOrigin', 'Anonymous')
                 video.setAttribute('width', '300')
@@ -183,6 +182,7 @@ function createVideoPoster(url, name, quality) {
  *dataUrl转文件 
  */
 function dataURLtoFile(dataurl, filename) {
+	console.log(...arguments);
     let arr = dataurl.split(',')
     let mime = arr[0].match(/:(.*?);/)[1]
     let bstr = atob(arr[1])

+ 3 - 0
TEAMModelOS/ClientApp/src/view/areaMgmt/AreaBase.vue

@@ -38,6 +38,9 @@ export default {
         }
     },
     created() {
+		this.$Message.config({
+		    duration: 3
+		});
 		// 检查超时操作页面,清空缓存数据
 		let webEndTime = localStorage.getItem('webEndTime')
 		let time_now = new Date().getTime()