//提示 function alertMsg(msg, time, fn) { var tips = typeof msg == "string" || typeof msg == "number" ? msg : '提示'; var t = typeof time == "number" && time > 100 ? time : 1500; var tempObj = typeof time == "object" ? time : {}; var options = { msgColor: tempObj.msgColor ? tempObj.msgColor : '#666666', bgOpacity: typeof tempObj.bgOpacity == "number" ? tempObj.bgOpacity : 0.2, centerBg: tempObj.centerBg ? tempObj.centerBg : 'rgb(255,255,255)', msgSize: tempObj.msgSize ? tempObj.msgSize : '4vw', t: tempObj.time == "number" && tempObj.time ? tempObj.time : 1500 } var str = $(`
${tips}
`); $("body").append(str); setTimeout(function () { $(".alertMsg").remove(); if (typeof msg == "function") { msg(); } else if (typeof time == "function") { time(); } else if (typeof fn == "function") { fn(); } }, t); } //点击确定就关闭的提示 function alertBtn(msg, obj, fn) { var tempObj = typeof obj == 'object' ? obj : {}; var tips = typeof msg == "string" || typeof msg == "number" ? msg : '提示'; var options = { msgColor: tempObj.msgColor ? tempObj.msgColor : '#333333', btnText: tempObj.btnText ? tempObj.btnText : '确定', btnColor: tempObj.btnColor ? tempObj.btnColor : '#00a0e8', bgOpacity: typeof tempObj.bgOpacity == "number" ? tempObj.bgOpacity : 0.2, centerBg: tempObj.centerBg ? tempObj.centerBg : 'rgba(249,249,249,0.9)', lineColor: tempObj.lineColor ? tempObj.lineColor : '#cccccc', title: tempObj.title ? tempObj.title : '', titleWeight: tempObj.titleWeight ? tempObj.titleWeight : 'bold', titleSize: tempObj.titleSize ? tempObj.titleSize : '5vw', tipsSize: tempObj.tipsSize ? tempObj.tipsSize : '4.5vw', btnSize: tempObj.btnSize ? tempObj.btnSize : '4.5vw', titleColor: tempObj.titleColor ? tempObj.titleColor : '#111111', btnHeight: tempObj.btnHeight ? tempObj.btnHeight : '12vw', }; var str = ''; if (options.title != '') { str = `
${options.title}
`; } var str = $(`
${str}
${tips}
${options.btnText}
`); $("body").append(str); $('.alert_close').click(function () { $(".alertBtn").remove(); if (typeof msg == "function") { msg(); } else if (typeof obj == "function") { obj(); } else if (typeof fn == "function") { fn(); } }) } //确认或取消 function alertSureAndCancel(obj) { var tempObj = typeof obj == 'object' ? obj : {}; var options = { title: tempObj.title ? tempObj.title : '温馨提示', detail: tempObj.detail ? tempObj.detail : '确定进行该操作?', cancelText: tempObj.cancelText ? tempObj.cancelText : '取消', sureText: tempObj.sureText ? tempObj.sureText : '确定', titleColor: tempObj.titleColor ? tempObj.titleColor : '#111111', titleWeight: tempObj.titleWeight ? tempObj.titleWeight : 'bold', detailColor: tempObj.detailColor ? tempObj.detailColor : '#000000', sureColor: tempObj.sureColor ? tempObj.sureColor : '#00a0e8', cancelColor: tempObj.cancelColor ? tempObj.cancelColor : '#666666', bgOpacity: typeof tempObj.bgOpacity == "number" ? tempObj.bgOpacity : 0.6, centerBg: tempObj.centerBg ? tempObj.centerBg : 'rgba(241,241,241,0.9)', lineColor: tempObj.lineColor ? tempObj.lineColor : '#cccccc', titleSize: tempObj.titleSize ? tempObj.titleSize : '5vw', detailSize: tempObj.detailSize ? tempObj.detailSize : '4.5vw', btnSize: tempObj.btnSize ? tempObj.btnSize : '4.5vw', btnHeight: tempObj.btnHeight ? tempObj.btnHeight : '12vw', } var str = $(`
${options.title}
${options.detail}
${options.cancelText}
${options.sureText}
`); $("body").append(str); $('.alert_btn_sure').click(function () { $('.alert_tips_con').remove(); if (typeof obj.sure == "function") { tempObj.sure(); } }) $('.alert_btn_no').click(function () { $('.alert_tips_con').remove(); if (typeof obj.cancel == "function") { tempObj.cancel(); } }) } //关闭提示框 function hideSureAndCancel(fn) { $('.alert_tips_con').remove(); if (typeof fn == "function") { fn(); } } //等待 function alertShowLoading(obj, fn) { var tempObj = typeof obj == "object" ? obj : {}; var options = { title: tempObj.title ? tempObj.title : '', titleColor: tempObj.titleColor ? tempObj.titleColor : '#111111', loadSrc: tempObj.loadSrc ? tempObj.loadSrc : '/Public/vip/images/loading2.gif', bgOpacity: typeof tempObj.bgOpacity == "number" ? tempObj.bgOpacity : 0.6, titleSize: tempObj.titleSize ? tempObj.titleSize : '4vw', centerBg: tempObj.centerBg ? tempObj.centerBg : 'rgba(241,241,241,0.9)' } var str = $(`
${options.title}
gif
`); $('.img').ready(function () { $("body").append(str); if (typeof obj == "function") { obj(); } else if (typeof fn == "function") { fn(); } }) } //关闭等待提示 function alertHideLoading(fn) { $('.alert_loading').remove(); setTimeout(function () { if (typeof fn == "function") { fn(); } }, 10) }