1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- function closedg(obj){
- $(obj).parents(".com-dialog").remove();
- }
- function cancel(obj){
- $(obj).parents(".com-dialog").remove();
- WKmsg.msg('您选择了取消本次操作!',2000);
- }
- //function yes(){
- // alert(300);
- //}
- var WKbody = document.getElementById('app');
- var WKtcon = '';
- var WKmsg = {
- msg: function (msg,time){
- WKtcon = '<div id="WKmsg" class="com-wkmsg"><span>' + msg + '</span></div>';
- WKbody.insertAdjacentHTML('beforeend',WKtcon);
- setTimeout(function(){
- document.getElementById("WKmsg").remove();
- },time);
- },
- confirmMsg: function (data){
- WKtcon = '<div class="com-dialog"><div class="dialog-close" onclick="closedg(this)"></div><div class="dialog-con">';
- if(!!data.title){
- WKtcon += '<div class="dialog-tit"><div>' + data.title + '</div><span onclick="closedg(this)" class="dialog-tit-btn mui-icon mui-icon-closeempty"></span></div>';
- }
- WKtcon += '<div class="dialog-intro">' + data.intro + '</div>';
- if(data.btn.length <= 1){
- WKtcon += '<div class="dialog-btn"><button onclick="data.yes" class="dialog-btn-1">' + data.btn[0] + '</button></div>';
- }else if(data.btn.length <= 2){
- WKtcon += '<div class="dialog-btn"><button class="dialog-btn-2 dialog-btn-gray" onclick="cancel(this)">' + data.btn[0] + '</button><button class="dialog-btn-2">' + data.btn[1] + '</button></div>';
- }
- WKtcon += '</div></div>';
- WKbody.insertAdjacentHTML('beforeend',WKtcon);
-
- if(data.title=="" || data.title==null){
- $(".dialog-con").height(110);
- }
- $(".dialog-btn-2").click(function(){
- if($(this).index()==1){
- data.yes();
- }
- });
- },
- inputMsg: function(data){
- WKtcon = '<div class="com-dialog"><div class="dialog-close" onclick="closedg(this)"></div><div class="dialog-con">';
- if(!!data.title){
- WKtcon += '<div class="dialog-tit"><div>' + data.title + '</div><span onclick="closedg(this)" class="dialog-tit-btn mui-icon mui-icon-closeempty"></span></div>';
- }
- WKtcon += '<div class="dialog-inp">' + data.inp + '</div>';
- if(data.btn.length <= 1){
- WKtcon += '<div class="dialog-btn"><button onclick="data.yes" class="dialog-btn-1">' + data.btn[0] + '</button></div>';
- }else if(data.btn.length <= 2){
- WKtcon += '<div class="dialog-btn"><button class="dialog-btn-2 dialog-btn-gray" onclick="cancel(this)">' + data.btn[0] + '</button><button class="dialog-btn-2">' + data.btn[1] + '</button></div>';
- }
- WKtcon += '</div></div>';
- WKbody.insertAdjacentHTML('beforeend',WKtcon);
-
- if(data.title=="" || data.title==null){
- $(".dialog-con").height(110);
- }
- $(".dialog-btn-2").click(function(){
- if($(this).index()==1){
- data.yes();
- }
- });
- },
- picMsg: function(data){
- WKtcon = '<div class="com-dialog"><div class="dialog-close" onclick="closedg(this)"></div><div class="dialog-con">';
- if(!!data.title){
- WKtcon += '<div class="dialog-tit"><div>' + data.title + '</div><span onclick="closedg(this)" class="dialog-tit-btn mui-icon mui-icon-closeempty"></span></div>';
- }
- WKtcon += '<div class="dialog-pic">' + data.pic + '</div>';
- WKtcon += '</div></div>';
- WKbody.insertAdjacentHTML('beforeend',WKtcon);
-
- $(".dialog-con").height(380);
- }
- }
|