| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 | 
							- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
 
-     var Controller = {
 
-         index: function () {
 
-             // Form.api.bindevent($("form[role=form]"), function(data, ret) {
 
-             //     var index =  Layer.load(2, {
 
-             //         shade: [0.5,'#393D49'],
 
-             //         content: '正在检查模拟器并下发故障,请稍后...', // 这里是加载的文字
 
-             //     }); 
 
-             //     Layer.close(index);
 
-             //     if(ret.code==1){
 
-             //         // Backend.api.addtabs( ret.url,'正在练习');
 
-             //     }
 
-             // });
 
-             $(document).on('click', '.btn-startexam', function () {
 
-                 var sim_type = $(".sim_type").val();
 
-                 if(!sim_type){
 
-                     Layer.alert('请先选择模拟器');
 
-                     return;
 
-                 }
 
-                 var index =  Layer.load(2, {
 
-                     shade: [0.5,'#393D49'],
 
-                     content: '正在检查模拟器并下发故障,请稍后...', // 这里是加载的文字
 
-                 });
 
-                 $(this).removeClass('btn-info');
 
-                 $(this).addClass('btn-primary');
 
-                 $.ajax({
 
-                     url: "student/exercise/index",
 
-                     type: 'post',
 
-                     data: {
 
-                         sim_type: $(".sim_type").val(),
 
-                     },
 
-                     success: function (ret) {
 
-                         if(ret.code==1){
 
-                             window.location.href = ret.url;
 
-                         }else{
 
-                             Layer.alert(ret.msg);
 
-                             Layer.close(index);
 
-                             return;
 
-                         }
 
-                     }
 
-                 });
 
-                 
 
-             });
 
-         },
 
-         examing: function () {
 
-             var dingshi = '';
 
-             $(document).ready(function() {
 
-                 var countdownTime = Config.timer; // 倒计时时间,单位为秒
 
-                 var display = $('#timer');
 
-                 var countdownTime1 = 600; // 10分钟倒计时时间,单位为秒
 
-                 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) {
 
-                         $.ajax({
 
-                             url: "student/collection/countdown/ids/"+Config.ids,
 
-                             type: 'post',
 
-                             data: {},
 
-                             success: function (data) {
 
-                                 if(data.code==1){
 
-                                     console.log(data.msg);
 
-                                     $(".djs").html(data.msg);
 
-                                     if(data.msg==0){
 
-                                         $('#update-form').submit();
 
-                                         clearInterval(timer);
 
-                                     }
 
-                                 }
 
-                                 if(data.code==0){
 
-                                     Layer.alert(data.msg);
 
-                                 }
 
-                             }
 
-                         });
 
-                     }
 
-                 }, 1000);
 
-                 //五秒刷新,同步更换件列表数据
 
-                 if(Config.isloading==1 && countdownTime>0){
 
-                     dingshi = setInterval(function() {
 
-                         window.location.reload();
 
-                     }, 30000);
 
-                 }
 
-             });
 
-             $(document).on('click', '.btn-replace', function () {
 
-                 console.log($(".other_replace").val());
 
-                 if($(".other_replace").val()=='[{"fault_id":"","request_status":"0"}]'){
 
-                     Layer.alert('请先填写更换件');
 
-                     return false;
 
-                 }
 
-                 $.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){
 
-                             Layer.alert(data.msg, {
 
-                                 btn: ['确定'], // 或者直接使用默认的确定按钮
 
-                                 yes: function(index, layero){
 
-                                     // 刷新页面
 
-                                     window.location.reload();
 
-                                 }
 
-                             });
 
-                         }
 
-                         if(data.code==0){
 
-                             Layer.alert(data.msg);
 
-                         }
 
-                     }
 
-                 });
 
-             });
 
-             //追加记录
 
-             $(document).on('click', '.btn-addlog', function () {
 
-                 clearTimeout(dingshi);
 
-                 var ids = Config.ids;
 
-                 var other_report_count = Config.other_report_count;
 
-                 if(other_report_count==3){
 
-                     Layer.alert('维修报告最多允许增加三条');
 
-                     return false;
 
-                 }
 
-                 Fast.api.open('student/collection/addreport/ids/'+ids, __("维修报告"), {
 
-                     area: ["95%", "85%"], 
 
-                     callback:function(value){
 
-                         console.log(value+'@@@@');
 
-                     }
 
-                 });
 
-             });
 
-             //编辑记录
 
-             $(document).on('click', '.btnedit', function () {
 
-                 clearTimeout(dingshi);
 
-                 var ids = Config.ids;
 
-                 var xh_id = $(this).attr('xh_id');
 
-                 Fast.api.open('student/collection/editreport/ids/'+ids+'/xh_id/'+xh_id, __("维修报告"), {area: ["95%", "85%"], 
 
-                     callback:function(value){
 
-                         console.log(value+'@@@@');
 
-                     }
 
-                 });
 
-             });
 
-             //移除记录
 
-             $(document).on('click', '.btnmove', function () {
 
-                 var ids = Config.ids;
 
-                 var xh_id = $(this).attr('xh_id');
 
-                 Layer.confirm(
 
-                     __('确定要移除此条记录吗?', ids.length),
 
-                     {icon:3, title: __('Warning'), shadeClose: true, btn: [__('OK'), __('Cancel')]},
 
-                     function (index) {
 
-                         var url = 'student/collection/delreport/ids/'+ids;
 
-                         options = {url: url, data: {xh_id: xh_id}};
 
-                         Fast.api.ajax(options, function (data, ret) {
 
-                             window.location.reload();
 
-                         }, function (data, ret) {
 
-                             var error = $(that).data("error") || $.noop;
 
-                             if (typeof error === 'function') {
 
-                                 if (false === error.call(that, data, ret)) {
 
-                                     return false;
 
-                                 }
 
-                             }
 
-                         });
 
-                         Layer.close(index);
 
-                     }
 
-                 );
 
-             });
 
-             $(document).on('click', '.layui-layer-close1', function () {
 
-                 window.location.reload();
 
-             });
 
-             $(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,'得分分析');
 
-                     Backend.api.closetabs('/admin/student/exercise/index');
 
-                 }
 
-             });
 
-         },
 
-         analysis: function () {
 
-             Form.api.bindevent($("form[role=form]"), function(data, ret) {
 
-                 if(ret.code==1){
 
-                     Backend.api.closetabs('/admin/student/exercise/analysis');
 
-                     // Backend.api.addtabs( ret.url);
 
-                     Backend.api.addtabs('/admin/student/exercise/index');
 
-                 }
 
-             });
 
-         },
 
-         edit: function () {
 
-             Controller.api.bindevent();
 
-         },
 
-         api: {
 
-             bindevent: function () {
 
-                 Form.api.bindevent($("form[role=form]"));
 
-             }
 
-         }
 
-     };
 
-     return Controller;
 
- });
 
 
  |