text: layui.use(['layer', 'form', 'admin', 'ax','helper','qrcode','util'], function () {
      var $ = layui.jquery;
      var $ax = layui.ax;
      var form = layui.form;
      var admin = layui.admin;
      var layer = layui.layer;
      var $qrcode= layui.qrcode;
      var $helper= layui.helper;
      var util = layui.util;
      var laydate = layui.laydate;
      // 让当前iframe弹层高度适应
      admin.iframeAuto();
  
      //获取截止
      var isShow=$('#isShow').val();
      if(isShow==1){
          var qrcodeContext=$('#qrCodeUrl').val();
          $helper.qrcode($('#qrcode'), qrcodeContext,120,120);
          $helper.qrcode($('#qrcodeSee'), qrcodeContext,300,300);
          if($('#phoneNum')){
              $('#phoneNum').focus();
          }
  
         /* var qrcode = new QRCode(document.getElementById("qrcodeSee"), {
              width : 400,
              height : 400
          });*/
          }
  
      var overTimeStr=$('#overTimeStr').val();
      overTimeStr = overTimeStr.replace(/-/g,"/");
      var now=new Date(overTimeStr);
      var year=now.getFullYear();
      var month=now.getMonth();
      var date=now.getDate();
      var hour=now.getHours();
      var minute=now.getMinutes();
      var second=now.getSeconds();
      //倒计时
      var thisTimer, setCountdown = function(y, M, d, H, m, s){
  
          var endTime = new Date(y, M||0, d||1, H||0, m||0, s||0) //结束日期
              ,serverTime = getTime(); //假设为当前服务器时间，这里采用的是本地时间，实际使用一般是取服务端的
          clearTimeout(thisTimer);
          util.countdown(endTime, serverTime, function(date, serverTime, timer){
              var str = date[0] +"天"+ date[1] + '时' +  date[2] + '分' + date[3] + '秒';
              $('#test').html("倒计时："+str);
              thisTimer = timer;
              var overTimeStr=$('#overTimeStr').val();
              var date =new Date(overTimeStr.replace(/-/g,"\/"));
             if(date<serverTime){
                  Feng.error("任务已超时！" );
                  admin.closeThisDialog();
              }
          });
      };
      setCountdown(year,month,date,hour,minute,second);
  
      //获取任务信息
      /*var ajax = new $ax(Feng.ctxPath + "/taskInfo/getTaskInfo?taskId=" + Feng.getUrlParam("taskId"));
      var result = ajax.start();
      form.val('taskInfoForm', result.data);*/
     /* // 表单提交事件
          form.on('submit(btnSubmit)', function (data) {
              var ajax = new $ax(Feng.ctxPath + "/taskInfo/update", function (data) {
                  Feng.success("修改成功！");
  
                  //传给上个页面，刷新table用
                  admin.putTempData('formOk', true);
  
                  //关掉对话框
                  admin.closeThisDialog();
              }, function (data) {
                  Feng.error("修改失败！" + data.responseJSON.message)
              });
              ajax.set(data.field);
              ajax.start();
          });*/
      $('#confirm').click(function () {
          if(isOverTime()){
              var taskId=$('#taskInfoId').val();
              var phoneNum=$('#phoneNum').val();
              var pattern = /^1[3456789]\d{9}$/;
              if(pattern.test(phoneNum)){
                  var ajax = new $ax(Feng.ctxPath + "/taskInfo/updateTaskStatue", function (data) {
                      Feng.success("完成任务成功！");
                      admin.closeThisDialog();
                  }, function (data) {
                      Feng.error("完成任务失败！" + data.responseJSON.message);
                      admin.closeThisDialog();
                  });
                  ajax.set("taskId",taskId);
                  ajax.set("getFlag",0);
                  ajax.set("phoneNum",phoneNum);
                  ajax.start();
              }else{
                  Feng.error("手机号填写错误,请核实" );
              }
          }else{
              Feng.error("任务已超时！" );
              admin.closeThisDialog();
          }
  
      });
  
  
      $('#confirm2').click(function () {
          if(isOverTime()) {
              var taskId = $('#taskInfoId').val();
              var ajax = new $ax(Feng.ctxPath + "/taskInfo/updateTaskStatue", function (data) {
                  Feng.success("领取任务成功！");
                  admin.closeThisDialog();
                  location.reload();
              }, function (data) {
                  Feng.error("领取任务失败！" + data.responseJSON.message);
                  admin.closeThisDialog();
                  location.reload();
              });
              ajax.set("taskId", taskId);
              ajax.set("getFlag", 1);
              ajax.start();
          }else {
              Feng.error("任务已超时！");
              admin.closeThisDialog();
          }
      });
  
      function isOverTime(){
          var overTimeStr=$('#overTimeStr').val();
          var date =new Date(overTimeStr.replace(/-/g,"\/"));
          return date > new Date();
      }
  
  
      function  getTime (option){
          var xhr = null;
          if(window.XMLHttpRequest){
              xhr = new window.XMLHttpRequest();
          }else{ // ie
              xhr = new ActiveObject("Microsoft")
          }
          // 通过get的方式请求当前文件
          xhr.open("get","/");
          xhr.send(null);
          // 监听请求状态变化
          xhr.onreadystatechange = function(){
              var time = null,
                  curDate = null;
              if(xhr.readyState===2){
                  // 获取响应头里的时间戳
                  time = xhr.getResponseHeader("Date");
                  console.log(xhr.getAllResponseHeaders());
                  curDate = new Date(time);
                  /*var localTime = curDate.getTime();//获取的是毫秒级
                  var localOffset=curDate.getTimezoneOffset()*60000; //获得当地时间偏移的毫秒数,时区是以分钟为单位的
                  var utc = localTime + localOffset; //utc即GMT时间,世界时,格林威治时间
                  var wishTime= utc + (3600000*8);
                  console.log(new Date(wishTime));*/
                  return curDate;
                  //document.getElementById("time").innerHTML = "服务器时间是："+curDate.getFullYear()+"-"+(curDate.getMonth()+1)+"-"+curDate.getDate()+" "+curDate.getHours()+":"+curDate.getMinutes()+":"+curDate.getSeconds();
              }
          }
      }
  
  
  
     /* //页面层
  
      $('#openQr').click(function () {
          layer.open({
              type: 1,
              title: false,
              closeBtn: 0,
              skin: 'layui-layer-nobg', //没有背景色
              shadeClose: true,
              content: $('#qrcodeSee')
          });
      });*/
  
  
  
  
  
  });
  