$(function(){ var ti = new Date(); var hour = 23-ti.getHours(); var fen = 59-ti.getMinutes(); var sec = 59-ti.getSeconds(); function showTime(){ if(hour <= 0 && fen <= 0 && sec <= 0){ hour = 23; fen = 59; sec = 59; }else if(fen <= 0 && sec <= 0){ hour--; fen = 59; sec = 59; }else if(sec <= 0 && fen > 0){ fen--; sec = 59; }else{ sec--; }; $(".sh i").text(hour.toString().length==1?'0'+hour:hour); $(".fe i").text(fen.toString().length==1?'0'+fen:fen); $(".mo i").text(sec.toString().length==1?'0'+sec:sec); } showTime(); setInterval(function(){ showTime(); }, 1000); var wxNum = null; if(!wxNum){ $.ajax({ type: 'get', url: 'http://backend-api.qinggan.anslib.com/mingjun/api/getWechatNumbers', dataType: 'json', headers:{ 'Content-Type':'application/x-www-form-urlencoded' }, success: function (data) { if(data && data['content']){ wxNum = data['content']['mingjun123'] || ''; $('.w_txt').text(wxNum); addCopyEvent(); } }, error: function (err) { } }); }else{ $('.w_txt').text(wxNum); addCopyEvent(); } function addCopyEvent(){ $('.wx_click_copy').attr('data-clipboard-text', wxNum); $(".wx_click_copy").on("click", function () { var clipboard3 = new ClipboardJS(".wx_click_copy", {}); clipboard3.on('success', function (e) { window.location.href = "weixin://"; }); clipboard3.on('error', function (e) {}); }) } });