Kaynağa Gözat

Merge branch 'develop3.0-tmd' into develop3.0

JAELYS 4 yıl önce
ebeveyn
işleme
bd682868bd

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

@@ -119,7 +119,7 @@ export default {
 						let jsonData = JSON.parse(jsonInfo)
 						// 如果是综合题 那就拿到children里面的小题id集合 去换取小题的blobJSON文件 然后替换children的内容
 						if(jsonData.exercise.children.length && jsonData.exercise.type === 'compose'){
-							let childrenUrls = jsonData.exercise.children.map(i => blobHost + '/item/' + i + '.json' + sasString.sas)
+							let childrenUrls = jsonData.exercise.children.map(i => blobHost + '/item/' + i + '/' + i + '.json' + sasString.sas)
 							jsonData.exercise.children = await this.getFullChildren(childrenUrls,list[i].code)
 						}
 						// 调整渲染试题数据结构
@@ -155,7 +155,7 @@ export default {
 					let file = new File([JSON.stringify(itemJsonFile)], exerciseItem.id + ".json");
 					try{
 						// 等待上传blob的返回结果
-						let blobFile = await containerClient.upload(file, 'item')
+						let blobFile = await containerClient.upload(file, 'item/' + exerciseItem.id)
 						if (blobFile.blob) {
 							// 保存试题JSON文件到试卷文件夹需要
 							itemJsonFiles.push(file)
@@ -187,6 +187,7 @@ export default {
 	
 	/* 获取综合题子题的Blob数据 */
 	getFullChildren(urls,code){
+		console.log(urls)
 		return new Promise((resolve,reject) => {
 			let promiseArr = []
 			urls.forEach(url => {

+ 1 - 1
TEAMModelOS/ClientApp/src/view/evaluation/types/BaseCompletion.vue

@@ -116,6 +116,7 @@
 								}
 							}
 						},
+						this.$editorTools.initSimpleEditor(editor)
 						editor.create()
 					})
 				}
@@ -176,7 +177,6 @@
 				that.isStemFocus = false
 			}
 
-			completionEditor.config.uploadImgShowBase64 = true;
 			this.$editorTools.addVideoUpload(this, completionEditor)
 			this.$editorTools.addAudio(this, completionEditor)
 			this.$editorTools.initMyEditor(completionEditor)

+ 4 - 4
TEAMModelOS/ClientApp/src/view/learnactivity/AutoCreateNew.less

@@ -21,7 +21,7 @@
 		border-radius: 5px;
 		
 		.filter-wrap-item{
-			margin:25px 0;
+			margin:20px 0;
 		}
 		
 		.filter-title{
@@ -38,17 +38,17 @@
 			
 			.ivu-select-selection{
 				min-width: 100px;
-				color:
-				 #fff;
+				color:#fff;
 				border-color: #7d7d7d;
 				background-color: transparent;
 			}
 			
 			.ivu-input-number-input{
 				color: #fff;
-				width: 70px;
+				width: 60px;
 			}
 			
+			
 			&-text{
 				display: inline-table;
 				width: 45px;

+ 72 - 3
TEAMModelOS/ClientApp/src/view/learnactivity/AutoCreateNew.vue

@@ -6,12 +6,19 @@
 				<span class="filter-title">题目来源 : </span>
 				<div class="filter-content">
 					<CheckboxGroup v-model="filterOrigin">
-						<Checkbox label="private">个人题库</Checkbox>
-						<Checkbox label="school">校本题库</Checkbox>
+						<Checkbox label="private" v-if="!isSchoolPaper" :disabled="filterOrigin.length === 1 && filterOrigin[0] === 'private'">个人题库</Checkbox>
+						<Checkbox label="school"  :disabled="filterOrigin.length === 1 && filterOrigin[0] === 'school'">校本题库</Checkbox>
 					</CheckboxGroup>
 				</div>
 			</div>
 			<div class="filter-wrap-item animated fadeIn" v-if="includeSchool">
+				<span class="filter-title">校本占比 : </span>
+				<div class="filter-content">
+					<InputNumber :max="100" :min="0" :step="10" v-model="schoolRate"></InputNumber>
+					<span style="margin-left: 10px;"> %</span>
+				</div>
+			</div>
+				<div class="filter-wrap-item animated fadeIn" v-if="includeSchool">
 				<span class="filter-title">选择学段 : </span>
 				<div class="filter-content">
 					<Select v-model="periodCode" >
@@ -41,7 +48,7 @@
 			</div>
 		</div>
 		<div class="auto-btn-wrap">
-			<Button type="info" @click="doAutoCreate">开始组题</Button>
+			<Button type="info" :loading="isLoading" @click="doAutoCreate">开始组题</Button>
 		</div>
 	</div>
 </template>
@@ -51,11 +58,13 @@
 		name:'AutoCreate',
 		data(){
 			return {
+				isLoading:false,
 				filterOrigin:['private'],
 				periodList:[],
 				periodCode:'',
 				subjectList:[],
 				subjectCode:'',
+				schoolRate:50,
 				quInfos:[{
 					type:'single',
 					label:'单选题',
@@ -156,11 +165,71 @@
 			/* 开始组题 */
 			doAutoCreate(){
 				console.log(this.quInfos)
+				console.log(this.filterOrigin)
+				this.isLoading = true
+				let params = []
+				let copyInfos = JSON.parse(JSON.stringify(this.quInfos))
+				this.filterOrigin.forEach(scope => {
+					if(scope === 'private'){
+						params.push({
+							code:'Item-' + this.$store.state.userInfo.TEAMModelId,
+							scope: scope,
+							period: '',
+							points:[],
+							quInfos: copyInfos.map(i => {
+								i.count = (i.count - Math.round(i.count * this.schoolRate * 0.01))
+								return i
+							})
+						})
+					}else{
+						params.push({
+							code:'Item-' + this.$store.state.userInfo.schoolCode,
+							scope: scope,
+							period: '',
+							points:[],
+							quInfos: this.quInfos.map(i => {
+								i.count = Math.round(i.count * this.schoolRate * 0.01)
+								return i
+							})
+						})
+					}
+				})
+				// 访问API获取随机题目
+				this.$api.learnActivity.Automatic(params).then(
+				    res => {
+				            if (res.length > 0) {
+								console.log('组题成功', res)
+								this.isLoading = false
+				            } else {
+				                this.$Message.error('未能匹配满足条件的题目!')
+				                setTimeout(() => {
+				                    this.isLoading = false
+				                }, 1000)
+				            }
+				    },
+				    err => {
+				        this.$Message.error('API ERROR!')
+				        setTimeout(() => {
+				            this.isLoading = false
+				        }, 1000)
+				    }
+				)
+				
+				console.log(params)
+			}
+		},
+		mounted() {
+			if(this.isSchoolPaper){
+				this.filterOrigin = ['school']
+				this.schoolRate = 100
 			}
 		},
 		computed:{
 			includeSchool(){
 				return this.filterOrigin.indexOf('school') > -1
+			},
+			isSchoolPaper(){
+				return this.$route.name === 'newSchoolPaper'
 			}
 		}
 	}

+ 9 - 1
TEAMModelOS/Controllers/Common/ExamController.cs

@@ -35,14 +35,16 @@ namespace TEAMModelOS.Controllers
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly DingDing _dingDing;
         private readonly Option _option;
+        public readonly AzureStorageFactory _azureStorage;
 
-        public ExamController(AzureCosmosFactory azureCosmos, AzureServiceBusFactory serviceBus, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option)
+        public ExamController(AzureCosmosFactory azureCosmos, AzureServiceBusFactory serviceBus, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage)
         {
             _azureCosmos = azureCosmos;
             _serviceBus = serviceBus;
             _snowflakeId = snowflakeId;
             _dingDing = dingDing;
             _option = option?.Value;
+            _azureStorage = azureStorage;
         }
 
         /// <summary>
@@ -340,6 +342,12 @@ namespace TEAMModelOS.Controllers
                     }
                     for (int i = 0; i < ans.Count; i++)
                     {
+                        if(standard[i].Count == 0 && ans[i].Count > 0)
+                        {
+                            string blob = await _azureStorage.UploadFileByContainer("hbcn", ans[i].ToJsonString(), "exam", studentId+"-"+ result.examId + "-"+ result.subjectId + ".json");
+                            result.studentAnswers[index][i].Add(blob);
+                            continue;
+                        }
                         result.studentAnswers[index][i] = ans[i];
                         //算分处理
                         if (standard[i].Count > 0)