Parcourir la source

add question_answer

huanggang il y a 7 ans
Parent
commit
900e3885a3

Fichier diff supprimé car celui-ci est trop grand
+ 37 - 34
data/resource/mobile/ugc/css/main.css


BIN
data/resource/mobile/ugc/images/loading.gif


BIN
data/resource/mobile/ugc/images/question_error.png


BIN
data/resource/mobile/ugc/images/question_right.png


+ 18 - 33
data/resource/mobile/ugc/js/main.js

@@ -1,37 +1,17 @@
 $('html').css('height', '100%');
 
-// $.fn.autoTextarea = function (options) {
-//     var defaults = {
-//         maxHeight: null,
-//         minHeight: 24
-//     };
-//     var opts = $.extend({}, defaults, options);
-//     return $(this).each(function () {
-//         $(this).bind("paste cut keydown keyup focus blur", function () {
-//             var height, style = this.style;
-//             this.style.height = opts.minHeight + 'px';
-//             if (this.scrollHeight > opts.minHeight) {
-//                 if (opts.maxHeight && this.scrollHeight > opts.maxHeight) {
-//                     height = opts.maxHeight;
-//                     style.overflowY = 'scroll';
-//                 } else {
-//                     height = this.scrollHeight;
-//                     style.overflowY = 'hidden';
-//                 }
-//                 style.height = height + 'px';
-//             }
-//         });
-//     });
-// };
-//
-// $("#comments").autoTextarea({
-//     maxHeight: 300
-// });
 
 var host = (function () {
     return window.location.protocol + "//" + window.location.host;
 })();
 
+(function(){
+    if($('#submit_btn').length < 0) {
+        $('input[type="radio"]').attr('disabled', 'disabled');
+        $('input[type="checkbox"]').attr('disabled', 'disabled');
+    }
+})();
+
 $('.thumbnail img').picLazyLoad();
 
 var specialId = (function () {
@@ -481,10 +461,6 @@ var ReplyList = function () {
                 }
             }
         });
-        // , function () {
-        //     $('.loader').hide();
-        //     $('.comment_list').append(new ReplyItem().empty());
-        // })
     };
     var loadEvent = function () {
         var scrollTop = $(this).scrollTop();
@@ -519,7 +495,7 @@ var CommentsBox = function () {
     // var inputFocus = function () {
     //     $('#comments').focus(function () {
     //         interval = setInterval(function () {
-    //             document.body.scrollTop = document.body.scrollHeight-80;
+    //             document.body.scrollTop = document.body.scrollHeight;
     //         }, 400);
     //     }).blur(function () {
     //         clearInterval(interval);
@@ -868,10 +844,19 @@ $('#submit_btn').on('click', function () {
             var error = 0;
             var result_msg = '';
             for (var i = 0; i < answerDiff.length; i++) {
+                var diff_correct = answerDiff[i]['origin'];
+                var correct_answers = [];
+                for(var j=0;j<diff_correct.length;j++) {
+                    var answer_num = String.fromCharCode(diff_correct[j]+65);
+                    correct_answers.push(answer_num);
+                }
+                $('.question_options').eq(i).after('<div class="right_answer">正确答案:'+correct_answers.join('')+'</div>');
                 if (answerDiff[i]['correct']) {
+                    $('.question_options').eq(i).addClass('state_right');
                     correct++;
                 }
                 else {
+                    $('.question_options').eq(i).addClass('state_error');
                     error++;
                 }
             }
@@ -888,7 +873,7 @@ $('#submit_btn').on('click', function () {
                 $('.question_result p').html(result_msg);
             }
             $('.question_result').addClass('show');
-            event($('.question_result .close'), 'click', function () {
+            $('.question_result .close').on('click',function(){
                 $('.question_result').removeClass('show');
                 if (data.datas['bonus_url'] !== "") {
                     $('.pop').show();