@@ -87,6 +87,9 @@ export default {
87
87
components: {
88
88
WordHighlighter,
89
89
},
90
+ props : [
91
+ ' alpha'
92
+ ],
90
93
data () {
91
94
return {
92
95
True : true ,
@@ -144,6 +147,7 @@ export default {
144
147
// }]
145
148
},
146
149
dialogTableVisible: false ,
150
+ rawData : null ,
147
151
}
148
152
},
149
153
computed : {
@@ -153,10 +157,14 @@ export default {
153
157
154
158
},
155
159
watch : {
160
+ alpha (val , old ){
161
+ this .preprocess_modal (this .rawData .problem , val)
162
+ this .preprocess_table (this .gridData )
163
+ },
156
164
loading (val , old ){
157
- let data = this .$store .getters .getResult
165
+ this . rawData = this .$store .getters .getResult
158
166
// console.log(data)
159
- this .preprocess_modal (data .problem )
167
+ this .preprocess_modal (this . rawData .problem )
160
168
this .preprocess_table (this .gridData )
161
169
}
162
170
},
@@ -201,8 +209,15 @@ export default {
201
209
this .current_id = row .student_id
202
210
// console.log(this.current_id)
203
211
},
212
+ calTotalScore (key_score , sim_score , alpha ){
213
+
214
+ let a = alpha / 100
215
+ let final_score = ((key_score * a + sim_score * (1 - a)) * 100 ).toFixed (2 )
216
+
217
+ return final_score
204
218
205
- preprocess_modal (data ){
219
+ },
220
+ preprocess_modal (data , alpha = 50 ){
206
221
this .studentResult = {}
207
222
208
223
data .forEach ((v , i ) => {
@@ -221,12 +236,10 @@ export default {
221
236
sim_score : value .sim_score ,
222
237
sim_message : this .checkSimText (value .sim_score ),
223
238
keyword_score : value .keyword_score ,
224
- final_score : Math .round (
225
- (value .keyword_score * 0.5 + value .sim_score * 0.5 ) * 100
226
- )
239
+ final_score : this .calTotalScore (value .keyword_score , value .sim_score , alpha)
227
240
228
241
}
229
- console .log (property)
242
+ // console.log(property)
230
243
if (this .studentResult .hasOwnProperty (student_id)){
231
244
this .studentResult [student_id].push (property)
232
245
}else {
@@ -237,7 +250,7 @@ export default {
237
250
})
238
251
239
252
this .gridData = this .studentResult
240
- console . log ( this . gridData )
253
+
241
254
},
242
255
243
256
preprocess_table (data ){
@@ -249,9 +262,10 @@ export default {
249
262
data[student_id].forEach ((v , i ) => {
250
263
score += v .final_score
251
264
})
265
+ // console.log(score)
252
266
this .tableData .push ({
253
267
student_id : student_id,
254
- score : ` ${ score} / ${ data[student_id].length * 100 } `
268
+ score : ` ${ Number ( score) } / ${ data[student_id].length * 100 } `
255
269
256
270
})
257
271
}
0 commit comments