function requestQuestionAnswer(t,a){if(t.data("done"))return!1;t.addClass("locked"),t.data("done",!0),Base.Base.post("/question/answer/"+t.attr("data-alias"),{answer:a},function(a){Base.Base.defaultFormCallback(a,{success:function(a){t.find(".answer-result").html(a.data.html);var e=t.closest('[data-question="group"]');if(e.length>0){var s=!0;e.find("[data-question]").each(function(t,a){$(a).data("done")||(s=!1)}),s&&Base.Base.post("/question/answer/"+e.attr("data-alias"),{},function(t){Base.Base.defaultFormCallback(t,{success:function(t){e.find(">.question-analysis>.answer-result").html(t.data.html)}})})}}})})}var Base=require("./base.js");module.exports={init:function(){$("[data-question=singleChoice]").on("click","[data-choice]",function(){var t=$(this).closest("[data-question]");if(t.data("done"))return!1;var a=$(this).attr("data-choice");return $(this).addClass("selected"),requestQuestionAnswer(t,a),!1}),$("[data-question=multiChoices]").on("click","[data-choice]",function(){return!$(this).closest("[data-question]").data("done")&&($(this).hasClass("selected")?$(this).removeClass("selected"):$(this).addClass("selected"),!1)}),$("[data-question=multiChoices]").on("click","[data-choice-confirm]",function(){var t=$(this).closest("[data-question]");if(t.data("done"))return!1;var a=[];return t.find("[data-choice].selected").each(function(t,e){a.push($(e).attr("data-choice"))}),a.length?(requestQuestionAnswer(t,a),!1):(window.api.dialog.tipError("请选择选项"),!1)}),$("[data-question=trueFalse]").on("click","[data-choice]",function(){var t=$(this).closest("[data-question]");if(t.data("done"))return!1;var a=$(this).attr("data-choice");return $(this).addClass("selected"),requestQuestionAnswer(t,a),!1}),$("[data-question=fill]").on("click","[data-answer-show]",function(){var t=$(this).closest("[data-question]");return!t.data("done")&&(requestQuestionAnswer(t,null),!1)}),$("[data-question=text]").on("click","[data-answer-show]",function(){var t=$(this).closest("[data-question]");return!t.data("done")&&(requestQuestionAnswer(t,null),!1)}),$("[data-question]").on("click","*",function(){var t=!0;$("[data-question]").each(function(a,e){$(e).data("done")||(t=!1)}),t&&$("[data-group-analysis]").show()})}};