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); }); $(document).on('click', '.btn-replace', function () { console.log($(".other_replace").val()); $.ajax({ url: "student/collection/replace/ids/"+Config.ids, type: 'post', data: { other_replace: $(".other_replace").val(), other_report: $(".other_report").val(), }, success: function (data) { if(data.code==1){ window.location.reload(); } if(data.code==0){ Layer.alert(data.msg); } } }); }); $(document).on("fa.event.appendfieldlist", "#second-fieldlist .btn-append", function (e, obj) { //绑定动态下拉组件 Form.events.selectpage(obj); }); 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; });