product.min.js 926 Bytes
define(["jquery","underscore","text!../html/templates/product.html"],function($,t,e){var n={initialize:function(t){this.opt=t,this.bindEvents(),this.render()},bindEvents:function(){},render:function(){var n=this,o={data:{modelCode:this.opt.modelCode},success:function(o){200==o.code?(o.wap=n.opt.wap,o.banner=n.opt.banner,o.title=n.opt.title,$(".m-page").html(t.template(e)(o))):alert("请求数据失败,未知错误!")},error:function(){alert("未知错误!")}};this.request(o)},request:function(t){$.ajax({type:"POST",data:JSON.stringify(t.data),url:"http://mobapi.nong12.com/mobsiteApp/topic/getTopicProducts.do",async:!0,timeout:15e3,dataType:"json",contentType:"application/json; charset=utf-8"}).done(function(e){t.success&&t.success(e)}).fail(function(e,n,o){alert("网络连接超时或失败!"),console.log("error code: "+e.status+"\n ajaxOptions:"+n+"\n message: "+o+"\n APIName:"+t.apiName)})}};return n});