1.layer.open(layUI)
layui.use(["okUtils", "okCountUp", ‘layer‘, ‘jquery‘, "okSweetAlert2", ‘element‘], function () { var countUp = layui.okCountUp; var okUtils = layui.okUtils; var $ = layui.jquery; var element = layui.element; let okSweetAlert2 = layui.okSweetAlert2; $("#TodaysMission").click(function () { var i = 8; layer.open({ type: 1, title: "训练提示", closeBtn: 0, // 无关闭按钮 anim: 5, shade: 0.3, //遮罩透明度 scrollbar: true, //屏蔽浏览器滚动条 skin: ‘yourclass‘, content: ‘<div style="margin-top: 1em; margin-bottom: 1em; margin-left: 3em; margin-right: 3em;" > <div class="txt1">训练时长:5</div>‘ + ‘<div class="txt1">训练得分:100</div>‘ + ‘<div class="txt1">请在休息30秒后开始其他游戏!</div> </div>‘, btn: [i + 1 +‘s后可退出‘], //按钮组 yes: function (index) {//layer.msg(‘yes‘); //点击确定回调 if (i<=0) { layer.close(index); } }, success: function () { $(".layui-layer-btn0").css("backgroundColor", "#92B8B1"); var fn = function () { $(".layui-layer-btn0").text(i + ‘s后可退出‘); i--; }; interval = setInterval(function () { fn(); if (i === 0) { $(".layui-layer-btn0").css("backgroundColor", "#019F95"); $(".layui-layer-btn0").text(‘退出‘); clearInterval(interval); } }, 1000); } }); }); });
2.okSweetAlert2