store_ready.js 2.79 KB
/*! dili 2016-01-06 */
define(function(require,exports,module){require("fancybox");var Alert=function(arges){var config={type:"",headTitle:"",headColse:!0,tipText:"",contText:"",contClass:"#alert-view",btnsType:0,btns:["确认","取消"],succeedFun:function(){},cancelFun:function(){},isremove:!1,OverlayClick:!1},methods={init:function(){$.extend(config,arges),this.foundUrl(),$(".popup-btn").fancybox({padding:30,afterClose:function(){config.isremove&&methods.remove()},afterShow:function(){config.headColse&&$(".fancybox-item").hide(),$(".fancybox-overlay-fixed").click(function(){return!1})},helpers:{overlay:{closeClick:config.OverlayClick}}}).trigger("click"),this.events()},foundUrl:function(){var view='<a href="'+config.contClass+'" class="popup-btn" style="display:none;">popup btn</a>';$("body").append(view),this.foundView()},foundView:function(){var view='<div class="cancel-ensure" id="alert-view"><div class="head">'+config.headTitle+'</div><div class="content"><div class="tip '+config.type+'"><span class="alert-icon"></span><span class="title">'+config.tipText+'</span></div><div class="text">'+config.contText+'</div></div><div class="btns"><button class="submitBtn alert-save">确认</button><button class="submitBtn grayBtn alert-close" style="display:none;">取消</button></div></div>';$("body").append(view),""==config.headTitle&&$("#alert-view .head").hide(),""==config.tipText&&$("#alert-view .tip").hide(),""==config.contText?$("#alert-view .text").hide():$("#alert-view .tip").css("padding","0px"),$("#alert-view .btns button").each(function(i,elem){$("#alert-view .btns button").size()>2?i>=2&&$(elem).html(config.btns[i-2]):$(elem).html(config.btns[i])}),config.btnsType?$("#alert-view .grayBtn").show():$("#alert-view .alert-save").addClass("a-save-show"),config.isremove=!0},events:function(){$("#alert-view .alert-save").click(function(){config.succeedFun(),$(".fancybox-close").trigger("click")}),$("#alert-view .alert-close").click(function(){config.cancelFun(),$(".fancybox-close").trigger("click")})},remove:function(){$(".popup-btn").remove(),$("#alert-view").remove(),$(".fancybox-placeholder").remove(),config.isremove=!1}};this.get=function(key){if(!key)return!1;for(i in config)if(i===key)return config[i];return!1},this.set=function(Object){if("object"!=typeof Object)return!1;var isSucceed=!1;for(i in config)for(k in Object)i===k&&(config[i]=Object[k],isSucceed=!0);return isSucceed},methods.init()};return Alert}),define(function(require,exports,module){var Alert=require("alert");$(function(){$(".m-form .btn-big-r").click(function(){$(".m-form").submit()}),$(".m-form").validate(),$(".show-compile").fancybox({padding:30}),$("#confirm-amend").click(function(){Alert({tipText:"您上次修改店铺名称是XXX-XX-XX,请在XXX-XX-XX后再次修改,若有疑问请联系{HotLine}!",type:"warning"})})})});