فهرست منبع

授課課程與班級關聯表架構更新 (途中)

jeff 4 سال پیش
والد
کامیت
75baf57c52

+ 4 - 3
TEAMModelOS/ClientApp/src/view/newcourse/NewCoursePlan.vue

@@ -320,6 +320,8 @@
             saveCusPlan() {
                 this.isLoading = true
                 this.classListShow[this.curClassIndex].cusSetting.code = this.$store.state.userInfo.schoolCode
+                console.log('this.classListShow[this.curClassIndex].cusSetting:');
+                console.log(this.classListShow[this.curClassIndex].cusSetting);
                 this.$api.courseMgmt.upsertPlanDto(this.classListShow[this.curClassIndex].cusSetting).then(
                     (res) => {
                         if (!res.error) {
@@ -417,9 +419,8 @@
                     }
                     this.$api.courseMgmt.findPlan(requestData).then(
                         (res) => {
-                            console.log('res.courses:');
-                            console.log(res.courses);
-                            console.log('res.courses.length:'+res.courses.length);
+                            console.log('res:');
+                            console.log(res);
                             if (res.error) {
                                 this.$Message.error(res.v)
                             } else {

+ 6 - 3
TEAMModelOS/Controllers/School/CourseController.cs

@@ -19,6 +19,7 @@ using TEAMModelOS.SDK.DI.AzureCosmos.Inner;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Helper.Common.StringHelper;
+using System.Dynamic;
 
 namespace TEAMModelOS.Controllers
 {
@@ -401,13 +402,15 @@ namespace TEAMModelOS.Controllers
                 var response = await client.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(classId.ToString(), new PartitionKey($"Class-{code}"));
                 if (response.Status == 200)
                 {
+                    dynamic courseResult = new ExpandoObject();
                     using var json = await JsonDocument.ParseAsync(response.ContentStream);
+                    courseResult.id = json.RootElement.GetProperty("id").GetString();
+                    courseResult.courses = new List<coursesInClass>();
                     if (json.RootElement.TryGetProperty("courses", out JsonElement coursesJobj))
                     {
-                        Dictionary<string, object> dictc = new Dictionary<string, object>();
-                        dictc["courses"] = coursesJobj.ToObject<object>();
-                        courses.Add(dictc);
+                        courseResult.courses = coursesJobj.ToObject<object>();
                     }
+                    courses.Add(courseResult);
                 }
             }
             ////[Jeff] 取得Class表中課程安排 (Class.courses)