function MyRecharge(){ Common.call(this) } MyRecharge.prototype = new Common() MyRecharge.prototype.constructor = MyRecharge MyRecharge.prototype.renderPage = function(obj){ if(obj.type == 1){ // 挑战为空 $('.recharge_null').show() }else if(obj.type == 2){ $('.recharge_main').show() } } MyRecharge.prototype.init = function(){ var that = this if(code == 0 ){ this.renderPage({ type: 2 }) }else{ this.renderPage({ type: 1 }) } this.renderList() $('.null_btn').click(function(){ try{ window.history.go(-1) }catch(err){ alert(err) } // that.goUrl({ // url: '/php/readchange' // }) }) } // 渲染页面 MyRecharge.prototype.renderList = function(){ $('.recharge_common').forEach(function(val){ if($(val).find('.recharge_item').length == 0){ $(val).hide() } }); } var myRechargeObj = new MyRecharge() myRechargeObj.init()