const tempTip={ fadingDuration:4500, inputType:'input', setDuration:function(milliSec){ this.fadingDuration=milliSec; }, setInputType:function(type){ this.inputType=type; }, showSuccess:function(text){ let tiper=$("
" + "
" + text + "
"); tiper.animate({opacity:'0'},this.fadingDuration,'swing',function () { tiper.remove(); }); $('body').append(tiper) }, show:function(text){ let tiper=$("
" + "
" + text + "
"); tiper.animate({opacity:'0'},this.fadingDuration,'swing',function () { tiper.remove(); }); $('body').append(tiper) }, okWindow:function(text,okText){ let bg=$("
" ); if(typeof(okText)=='undefined')okText='确定'; let tiper=$("
" + "
" + text + "

" + "
"); tiper.find('.okWindow').on('click',function () { tiper.off('click'); tiper.remove(); bg.remove(); }); $('html').css('height', '100%').append(bg); $('body').append(tiper) }, waitingTip:function(text){ let bg=$("
" ); let tipper=$("
" + "
" + text + "
"); tipper.animate({opacity:'0'},this.fadingDuration,'swing',function () { tipper.remove(); bg.remove(); }); $('html').css('height', '100%').append(bg); $('body').append(tipper); }, cancelWaitingTip:function(){ let bg=$(".tipperBg"); let tipper=$(".tipper"); tipper.remove(); bg.remove(); }, confirm:function(text,yesFunc,noFunc){ let bg=$("
" ); let tiper=$("
" + "
" + text + "
" + "
" + "
"); let $ok = tiper.find('.ok'); let $cancel = tiper.find('.cancel'); $ok.on('click',function () { $ok.off('click'); $cancel.off('click'); tiper.remove(); bg.remove(); yesFunc(); }); $cancel.on('click',function () { $ok.off('click'); $cancel.off('click'); tiper.remove(); bg.remove(); if(typeof noFunc!='undefined') noFunc(); }); $('html').css('height', '100%').append(bg); $('body').append(tiper); }, inputVal:function(tipText,resultFunc){ let bg=$("
" ); let tiper=$("
" + "
" + tipText + "
" + "
" + "
"); let $ok = tiper.find('.ok'); let $input = tiper.find('.input'); $ok.on('click',function () { $ok.off('click'); tiper.remove(); bg.remove(); resultFunc($input.val()) }); $('html').css('height', '100%').append(bg); $('body').append(tiper); $input.focus() }, }; module.exports=tempTip;