/** 定义弹窗模块 - 自定义弹窗 */ layui.define(['index', 'tpl', 'qrcode'], function (exports) { exports("dialog", { setIframeDialog: function ( title = "", data = { src: "", otherconfigStyle: "" }, iframeArea = { width: "820px", height: "500px" }, dialogArea = ["600px", "500px"] ) { var laytpl = layui.laytpl; var templet = " '; laytpl(templet).render({}, function (html) { layer.open({ type: 1, title: title, content: templet, area: dialogArea, success: function () { }, error: function (e) { console.warn("setIframeDialog error:", e); }, }); }); }, setTextDialog: function ( title = "", data = { text: "" }, dialogArea = ["600px", "500px"] ) { var laytpl = layui.laytpl; var templet = data.text; laytpl(templet).render({}, function (html) { layer.open({ type: 1, title: title, content: templet, area: dialogArea, success: function () { }, }); }); }, showOkMsgDialog({ msg, title = "提示", btnTitle = "好的", dialogArea = ["520px", "270px"] }) { layer.confirm("", { title: title, area: dialogArea, content: `
${msg}
`, btnAlign: 'r', skin: "msg-skin", btn: [btnTitle] }, function (index, layero) { layer.close(index); } ); }, setQrCodeDialog({ id = "qrcode", title = "", data = { value: "" }, showQrcodeUrl = false, qrcodeArea = { width: 400, height: 400 }, dialogArea = ["700px", "500px"] }) { var laytpl = layui.laytpl; var qrcode = layui.qrcode; var templet = '
'; if (showQrcodeUrl) { templet += '
'; } laytpl(templet).render({}, function (html) { layer.open({ type: 1, title: title, content: templet, area: dialogArea, success: function success() { qrcode.qrcode(document.getElementById(id), qrcodeArea); qrcode.makeCode(data.value); if (showQrcodeUrl) { layui.$('.show-qrcode-value').html(layui.$('.qrcode').attr('title')); } } }); }); } }); });