Jelajahi Sumber

社区服务,提交内容

lizhen 1 bulan lalu
induk
melakukan
aa6f77a42b
1 mengubah file dengan 3 tambahan dan 155 penghapusan
  1. 3 155
      application/admin/view/servicegrade/detail.html

+ 3 - 155
application/admin/view/servicegrade/detail.html

@@ -46,7 +46,7 @@
 
 
                             <th colspan="1" class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label th-fix-width">用户答案</th>
-                            <td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content" v-if="question.kind == 'JUDGE' || question.kind == 'SINGLE' || question.kind == 'MULTI'" :class="getUserAnswer(index) == question.answer ? ['answer-right'] : ['answer-fail']">
+                            <td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content" v-if="question.kind == 'JUDGE' || question.kind == 'SINGLE' || question.kind == 'MULTI'" :class="['answer-right']">
                                 <div>{{getUserAnswer(index) || '未答'}}</div>
                             </td>
 
@@ -63,45 +63,14 @@
 
 <script>
     var row = {:html_entity_decode(str_replace('&quot;', "'", json_encode($row)))};
-    console.log(row);
+    //console.log(row);
     var app = new Vue({
         el: '#app',
         data: {
             row: row,
         },
         computed: {
-            /**
-             * 获取填空题正确答案
-             * @returns {(function(*): (string|string))|*}
-             */
-            getRightFillAnswer() {
-                return function (question) {
-                    if (question && question.answer) {
-                        let html = '';
-                        question.answer.forEach(function (item, index) {
-                            html += '<span class="fill-answer-item">填空位' + (index + 1) + '答案:<b>' + item.answers.join(',') + '</b></span>';
-                        });
-                        return html;
-                    }
-                    return '';
-                }
-            },
-            /**
-             * 获取简答题正确答案
-             * @returns {(function(*): (string|string))|*}
-             */
-            getRightShortAnswer() {
-                return function (question) {
-                    if (question && question.answer) {
-                        let html = '正确答案:<b>' + question.answer.answer + '</b></br>';
-                        question.answer.config.forEach(function (item, index) {
-                            html += '<p class="fill-answer-item">关键词' + (index + 1) + ':<b>' + item.answer + '(' + item.score + '分)' + '</b></p>';
-                        });
-                        return html;
-                    }
-                    return '';
-                }
-            },
+
             /**
              * 获取用户答案
              * @returns {function(*): string|*}
@@ -111,134 +80,13 @@
                     return this.row.user_answers && this.row.user_answers[questionIndex] ? this.row.user_answers[questionIndex].answer : '';
                 }
             },
-            /**
-             * 获取用户填空题答案
-             * @returns {(function(*): (string|string))|*}
-             */
-            getUserFillAnswer() {
-                return function (questionIndex) {
-                    if (this.row.user_answers && this.row.user_answers[questionIndex]) {
-                        return this.row.user_answers[questionIndex].answer.join(',');
-                    }
-                    return '';
-                }
-            },
-            /**
-             * 获取用户简答题答案
-             * @returns {(function(*): (string|string))|*}
-             */
-            getUserShortAnswer() {
-                return function (questionIndex) {
-                    if (this.row.user_answers && this.row.user_answers[questionIndex]) {
-                        let html = '';
-                        if (this.row.user_answers[questionIndex].answer_score) {
-                            for (let i = 0; i < this.row.user_answers[questionIndex].answer_score.length; i++) {
-                                let short_user_answer = this.row.user_answers[questionIndex].answer_score[i];
-                                html += '<p class="fill-answer-item">' + short_user_answer.answer + '</p>';
-                            }
-                        }
-                        return html
-                        // return this.row.user_answers[questionIndex].answer.join(',');
-                    }
-                    return '';
-                }
-            },
-            /**
-             * 获取用户简答题得分
-             * @returns {(function(*): (string|string))|*}
-             */
-            // getUserShortAnswerScore() {
-            //     return function (questionIndex) {
-            //         let score = 0;
-            //         if (this.row.user_answers && this.row.user_answers[questionIndex]) {
-            //             if (this.row.user_answers[questionIndex].answer_score) {
-            //                 for (let i = 0; i < this.row.user_answers[questionIndex].answer_score.length; i++) {
-            //                     let short_user_answer = this.row.user_answers[questionIndex].answer_score[i];
-            //                     score += short_user_answer.score;
-            //                 }
-            //             }
-            //             // return this.row.user_answers[questionIndex].answer.join(',');
-            //         }
-            //         return score;
-            //     }
-            // },
-            /**
-             * 获取单个题目得分数
-             * @returns {function(*): string|*}
-             */
-            getSingleScore() {
-                return function (question, questionIndex) {
-                    var score = 0;
-                    if (this.row.mode == 'FIX') {
-                        score = question.score;
-                    } else {
-                        score = this.getConfigsScore(question.kind, question.difficulty);
-                    }
 
-                    if (this.row.user_answers && this.row.user_answers[questionIndex]) {
-                        if (question.kind === 'FILL') {
-                            if (this.row.user_answers[questionIndex].is_right) {
-                                return score;
-                            }
-                        } else if (question.kind === 'SHORT') {
-                            let score = 0;
-                            if (this.row.user_answers && this.row.user_answers[questionIndex]) {
-
-                                if (this.row.user_answers[questionIndex].answer_score) {
-                                    for (let i = 0; i < this.row.user_answers[questionIndex].answer_score.length; i++) {
-                                        let short_user_answer = this.row.user_answers[questionIndex].answer_score[i];
-                                        score += parseInt(short_user_answer.score);
-                                    }
-                                }
-                                // return this.row.user_answers[questionIndex].answer.join(',');
-                            }
-                            return score;
-                        } else {
-                            if (this.row.user_answers[questionIndex].answer === question.answer) {
-                                return score;
-                            }
-                        }
-                    }
-
-                    return 0;
-                }
-            },
         },
         created() {
 
         },
         methods: {
-            /**
-             * 获取单个题目得分数
-             * @returns {function(*): string|*}
-             */
-            getConfigsScore(kind, difficulty) {
-                const configs = this.row.configs[kind.toLowerCase()];
-                if (configs && configs['use_difficulty']) {
-                    return configs['difficulty'][difficulty.toLowerCase()]['score'];
-                }
-                return configs['score'];
-            },
-
-            /**
-             * 格式化秒数
-             * @param second
-             * @returns {string}
-             */
-            formatSecond: function (second) {
-                if (second == 0) return '不限时'
-
-                let result = parseInt(second)
-                let h = Math.floor(result / 3600) < 10 ? '0' + Math.floor(result / 3600) : Math.floor(result / 3600);
-                let m = Math.floor((result / 60 % 60)) < 10 ? '0' + Math.floor((result / 60 % 60)) : Math.floor((result / 60 % 60));
-                let s = Math.floor((result % 60)) < 10 ? '0' + Math.floor((result % 60)) : Math.floor((result % 60));
 
-                let res = '';
-                if (h !== '00') res += `${h}时`;
-                if (m !== '00') res += `${m}分`;
-                res += `${s}秒`;
-                return res;
-            }
         }
     })
 </script>