Commit 2d546abe by doszhang

dos

parent 51c0b793
...@@ -50,7 +50,12 @@ preloadimages(preloadImageList, function () { ...@@ -50,7 +50,12 @@ preloadimages(preloadImageList, function () {
$('.loading-page .progress').css('width', (16.6 / 100) * (progress * 100) + 'rem'); $('.loading-page .progress').css('width', (16.6 / 100) * (progress * 100) + 'rem');
}); });
//当前用户题目索引
let nowQuestionIndex = 1;
//当前题目用户选择答案
let nowAnswer = '';
//答案数组
let answerArr = [];
//海报canvas //海报canvas
let posterCanvas; let posterCanvas;
...@@ -65,14 +70,29 @@ $(document).ready(function () { ...@@ -65,14 +70,29 @@ $(document).ready(function () {
$('.home-page .btn-next').on('click', showQuestion); $('.home-page .btn-next').on('click', showQuestion);
//答案选中 //答案选中
$('.answer').on('click', chooseAnswer); $('.answer').on('click', chooseAnswer);
//下一题
$('.btn-nextquestion').on('click', nextQuestion);
}); });
function chooseAnswer(e) { function nextQuestion() {
console.log(e); if (nowAnswer != '') {
answerArr.push(nowAnswer);
nowAnswer = '';
} else {
$('#notification_area').remove();
my_notify('请选择答案');
}
console.log(answerArr);
} }
function chooseAnswer(e) {
let node = $(e.target);
$('.answer-active').hide();
nowAnswer = node.parent('.question-block').find('.answer').index();
node.find('div[class$=-active]').show();
}
function showQuestion() { function showQuestion() {
initQuestion(); initQuestion();
$('.home-page').hide(); $('.home-page').hide();
...@@ -85,6 +105,9 @@ function initQuestion() { ...@@ -85,6 +105,9 @@ function initQuestion() {
$('.question1-block').show(); $('.question1-block').show();
$('.btn-submit').hide(); $('.btn-submit').hide();
$('.btn-nextquestion').show(); $('.btn-nextquestion').show();
nowQuestionIndex = 1;
answerArr = [];
nowAnswer = '';
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment