define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { Form.api.bindevent($("form[role=form]"), function(data, ret) { if(ret.code==1){ Backend.api.addtabs( ret.url,'正在练习'); } }); }, examing: function () { $(document).ready(function() { var countdownTime = Config.timer; // 倒计时时间,单位为秒 var display = $('#timer'); var timer = setInterval(function() { var minutes = parseInt(countdownTime / 60, 10); var seconds = parseInt(countdownTime % 60, 10); minutes = minutes < 10 ? "0" + minutes : minutes; seconds = seconds < 10 ? "0" + seconds : seconds; display.text(minutes + "分" + seconds+'秒'); if (--countdownTime < 0) { clearInterval(timer); display.text("时间到!"); } }, 1000); }); Form.api.bindevent($("form[role=form]"), function(data, ret) { if(ret.code==1){ Backend.api.addtabs( ret.url,'得分分析'); } }); }, analysis: function () { Form.api.bindevent($("form[role=form]"), function(data, ret) { if(ret.code==1){ Backend.api.addtabs( ret.url); } }); }, edit: function () { Controller.api.bindevent(); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); } } }; return Controller; });