Selaa lähdekoodia

修改对接数据

zhousheng 4 vuotta sitten
vanhempi
commit
aaecfcd0dc

+ 3 - 5
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/PaperView.vue

@@ -105,18 +105,17 @@
                 this.chooseData = {}
                 this.isTestOver = false
                 //this.selectTab = "test"
-                console.log(this.selectTab)
                 if (this.$store.getters.getItemTitle.name !== undefined) {
                     let paper = this.$store.getters.getItemTitle
                     let codes = this.$store.getters.getItemTitle.code.split('-')
                     let req = {
                         id: paper.id,
                         studentId: this.$store.state.userInfo.sub,
-                        code: codes[1]
+                        code: codes[1],
+                        scode: paper.scode
                     }
                     let isTest = 0
                     this.$api.studentWeb.FindStudentPaper(req).then(res => {
-                        console.log(res)
                         this.stuData = res
                         let resData = res
                         for (let item of resData.papers) {
@@ -172,7 +171,6 @@
                 }
             },
             async getPaper(data) {
-                console.log(data)
                 this.isExamDown = false
                 this.isLoad = true
                 this.selectData = {}
@@ -181,7 +179,7 @@
                     let key = data.code.split('-')
                     let code = {
                         scope: data.scope,
-                        code: key[(key.length - 1)],
+                        code: this.$store.getters.getItemTitle.owner,
                         blob: data.blob
                     }
                     let exam = {}

+ 2 - 0
TEAMModelOS/ClientApp/src/utils/evTools.js

@@ -385,6 +385,8 @@ export default {
 	/* 获取完整的试卷数据 */
 	getStuPaper(paper,examScope){
 		//console.log('evTools换取学生试卷' , paper)
+		console.log(paper)
+		console.log(examScope)
 		let curScope = examScope || paper.scope
 		return new Promise(async (r,j) => {
 			let blobHost = JSON.parse(decodeURIComponent(localStorage.student_profile, "utf-8")).blob_uri

+ 4 - 3
TEAMModelOS/Controllers/Common/ExamController.cs

@@ -835,6 +835,7 @@ namespace TEAMModelOS.Controllers
                 //if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
                 if (!requert.TryGetProperty("studentId", out JsonElement studentId)) return BadRequest();
                 if (!requert.TryGetProperty("code", out JsonElement school)) return BadRequest();
+                if(!requert.TryGetProperty("scode", out JsonElement scode)) return BadRequest();
                 var client = _azureCosmos.GetCosmosClient();
                 var query = $"select c.id,c.code,A0.id paperId,A0.code paperCode,A0.name paperName,A0.multipleRule,A0.scope,A0.blob from c join A0 in c.papers where c.id ='{id}'";
                 List<object> papers = new List<object>();
@@ -873,7 +874,7 @@ namespace TEAMModelOS.Controllers
                     }
                 }
                 var queryClassId = $"select c.targetClassIds id from c where c.id ='{id}'";
-                await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: queryClassId, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Exam-{school}") }))
+                await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: queryClassId, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{scode}") }))
                 {
                     using var json = await JsonDocument.ParseAsync(item.ContentStream);
                     if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
@@ -895,7 +896,7 @@ namespace TEAMModelOS.Controllers
                         infoIds.Add(ids);
                     }
                 }
-                await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Exam-{school}") }))
+                await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{scode}") }))
                 {
                     using var json = await JsonDocument.ParseAsync(item.ContentStream);
                     if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
@@ -908,7 +909,7 @@ namespace TEAMModelOS.Controllers
                 }
                 var querySubject = $"select A0.id,A0.name from c join A0 in c.subjects where c.id ='{id}'";
                 //List<object> props = new List<object>();
-                await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: querySubject, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Exam-{school}") }))
+                await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: querySubject, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{scode}") }))
                 {
                     using var json = await JsonDocument.ParseAsync(item.ContentStream);
                     if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)