'use strict'; /** * * * @author Mai * @date 2019/2/27 * @version */ $(document).ready(function () { let timer = null let oldSearchVal = null $('#gr-search').bind('input propertychange', function(e) { oldSearchVal = e.target.value timer && clearTimeout(timer) timer = setTimeout(() => { const newVal = $('#gr-search').val() let html = '' if (newVal && newVal === oldSearchVal) { accountList.filter(item => item && cur_uid !== item.id && (item.name.indexOf(newVal) !== -1 || (item.mobile && item.mobile.indexOf(newVal) !== -1))).forEach(item => { html += `
${item.name}${item.mobile || ''}
${item.role || ''}${item.name}${item.mobile || ''}
${item.role || ''}请选择退回流程
'); } return false; } if ($('#warning-text').length) $('#warning-text').remove() } return true; } /** * 获取成功后的操作 * * @param {Object} btn - 点击的按钮 * @return {void} */ function codeSuccess(btn) { let counter = 60; btn.addClass('disabled').text('重新获取 ' + counter + 'S'); btn.parent().siblings('input').removeAttr('readonly').attr('placeholder', '输入短信中的6位验证码'); const bindBtn = $("#bind-btn"); bindBtn.removeClass('btn-secondary disabled').addClass('btn-primary'); const countDown = setInterval(function() { const countString = counter - 1 <= 0 ? '' : ' ' + (counter - 1) + 'S'; // 倒数结束后 if (countString === '') { clearInterval(countDown); btn.removeClass('disabled'); } const text = '重新获取' + countString; btn.text(text); counter -= 1; }, 1000); }