fd-gulp-convert-encoding
Version:
convert file to assigned charset
176 lines (159 loc) • 8.93 kB
JavaScript
// Generated by CoffeeScript 1.6.2
/*
The last 20 offers in maindata area asyn load
AsynOfferImgChild extends from base class AsynOffer
@author dongming.jidm
@date 2012-12-26
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
(function($) {
var AsynImgOffer, Sandbox, defConfig, requestURL, self;
self = null;
requestURL = "http://www.1688.com/chanpin/rpc/query.jsonp?_input_charset=utf-8&_output_charset=gbk";
Sandbox = null;
defConfig = {
url: requestURL,
showStyle: "img"
};
AsynImgOffer = function(sb) {
Sandbox = sb;
return AsynImgOffer;
};
$.extend(AsynImgOffer, {
init: function() {
var AsynOfferImgChild, asynOffer;
self = this;
AsynOfferImgChild = (function(_super) {
__extends(AsynOfferImgChild, _super);
function AsynOfferImgChild() {
this.renderData = __bind(this.renderData, this); AsynOfferImgChild.__super__.constructor.call(this, defConfig);
}
AsynOfferImgChild.prototype.renderData = function(data) {
self.renderHtml(data);
};
return AsynOfferImgChild;
})(Qingguo.Business.AsynOffer);
asynOffer = new AsynOfferImgChild(defConfig);
asynOffer.run();
},
renderHtml: function(data) {
var templateHtml;
// ���
Qingguo.Utility.aliclick(this, "?searchtrace=" + 'w_sale_asyn_load');
if (typeof data === 'undefined' || data.length < 1) {
return 0;
}
if( typeof offerUrls === 'undefined' ){
offerUrls = {};
}
app = {
setUrl: function( oid, p4pClickUrl ) {
offerUrls[0][oid] = p4pClickUrl;
}
};
templateHtml = '<% for ( var i = 0; i < $data.length; i++ ) { %>\
<% if ( $data[i].isP4P ) { %>\
<%= this.setUrl($data[i].oid, $data[i].p4pClickUrl) %>\
<% } %>\
<li class="fd-clr" trace="offerTrace" rank="<%=i+1+20%>" offerId="<%=$data[i].offerId%>">\
<div class="productPic verticalImg">\
<a href="<%= $data[i].detailUrl %>" class="boxImg" click-item="img" target="_blank" t=<%= $data[i].isP4P ? $data[i].clickPrefix + "_offer_img_p4p" : $data[i].clickPrefix + "_offer_img" %> oid=<%= $data[i].isP4P ? $data[i].oid : "" %>>\
<img data-lazyload-src="<%= $data[i].imgUrl.replace("summ","220x220") %>" alt="<%= $data[i].simpleSubject %>">\
</a>\
</div>\
<h2 class="title ms-yh">\
<a href="<%= $data[i].detailUrl %>" title="<%= $data[i].simpleSubject %>" click-item="title" target="_blank" t=<%= $data[i].isP4P ? $data[i].clickPrefix + "_offer_title_p4p" : $data[i].clickPrefix + "_offer_title" %> oid=<%= $data[i].isP4P ? $data[i].oid : "" %>><%= $data[i].subject %></a>\
</h2>\
<div class="leftDes">\
<p class="attribute">\
<% for ( var j = 0; j < $data[i].briefList.length; j++ ) { %>\
<% if (j === $data[i].briefList.length - 1) { %>\
<span class="last">\
<% }else{ %>\
<span>\
<% } %><%= $data[i].briefList[j].name %>:<%= $data[i].briefList[j].value4Asyn %></span>\
<% } %>\
</p>\
<p class="category">\
<% if(typeof $data[i].categoryList !== "undefined" && $data[i].categoryList != null) { %>\
<span>��Ŀ��</span>\
<% for ( var m = 0; m < $data[i].categoryList.length; m++ ) { %>\
<a click-item="cat" href="<%= $data[i].categoryList[m].url %>" t=<%= $data[i].clickPrefix + "_cat" %>><%= $data[i].categoryList[m].name %></a>\
<% } %>\
<% } %>\
</p>\
<p class="relatedProduct">\
<% if(typeof $data[i].relateWordList !== "undefined" && $data[i].relateWordList != null) { %>\
<span>��ز�Ʒ��</span>\
<% for ( var k = 0; k < $data[i].relateWordList.length; k++ ) { %>\
<a click-item="product" href="<%= $data[i].relateWordList[k].url %>" t=<%= $data[i].clickPrefix + "_related" %>><%= $data[i].relateWordList[k].word %></a>\
<% } %>\
<% } %>\
</p>\
<% if($data[i].showBookedCount) { %>\
<p class="dealMount">\
<span>�ɽ�<%= $data[i].bookedCount %>��</span>\
<span>\
<a rel="nofollow" target="_blank" click-item="evaluate" href="<%= $data[i].evaluateUrl %>" t=<%= $data[i].clickPrefix + "_pj" %> oid=<%= $data[i].isP4P ? $data[i].oid : "" %> ><%= $data[i].evaluateCounts %>������</a>\
</span>\
</p>\
<% } %>\
<p class="viewPrice">\
<a href="<%= $data[i].detailUrl %>" click-item="price" target="_blank" t=<%= $data[i].clickPrefix + "_price" %> oid=<%= $data[i].isP4P ? $data[i].oid : "" %>>�鿴�۸�����</a>\
</p>\
</div>\
<div class="rightDes">\
<% if( typeof $data[i].company !== "undefined") { %>\
<h3 class="companyName"><a href="<%= $data[i].company.memberUrl %>" target="_blank" t=<%= $data[i].isP4P ? $data[i].clickPrefix + "_cn_p4p" : $data[i].clickPrefix + "_cn" %> oid=<%= $data[i].isP4P ? $data[i].oid : "" %>><%= $data[i].company.companyName %></a>\
<a class="<%= $data[i].statusStyle %> aliwangwang" href="#" alitalk="<%=$data[i].alitalkValue.replace("---","{").replace("__","}") %>" click-item=="wangwang" target="_self"></a>\
</h3>\
<p class="companyAdress">[<%= $data[i].provinceDesc %> <%= $data[i].cityDesc %>]</p>\
<p class="jingyingMod"><span>��Ӫģʽ��</span><%= $data[i].company.parentTypeName %></p>\
<p class="mainMange">\
<span>��Ӫ��</span>\
<% for ( var q = 0; q < $data[i].company.productionWords.length; q++ ) { %>\
<a rel="nofollow" click-item="priduct" href="<%= $data[i].company.offerListUrl %>" t=<%= $data[i].clickPrefix + "_service" %> oid=<%= $data[i].isP4P ? $data[i].oid : "" %> ><%= $data[i].company.productionWords[q].abbrBusiness %></a>\
<% } %>\
</p>\
<p class="chengxintong">\
<% if(typeof $data[i].trustCreditUrl !== "undefined" && $data[i].trustCreditUrl != null) { %>\
<a rel="nofollow" click-item="tp" class="sw-ui-icon-mincxt" href="<%= $data[i].trustCreditUrl %>" target="_blank">\
��<span class="CreditYear"><%= $data[i].tpServiceYear %></span>��\
</a>\
<% } %>\
<% if(typeof $data[i].shidi !== "undefined" && $data[i].shidi === true) { %>\
<a rel="nofollow" click-item="shidirenzheng" class="sw-ui-icon-trueLocation sm-offerResult-textTop" href="http://view.1688.com/cms/safe/sdrz/buyer/0113/index.html" target="_blank"></a>\
<% } %>\
<% if(typeof $data[i].onlinetrade !== "undefined" && $data[i].onlinetrade === true) { %>\
<a rel="nofollow" click-item="offeralipay" class="sw-ui-icon-alipay sm-offerResult-textTop" href="http://view.1688.com/cms/services/aliguide/bd_zfb.html" target="_blank"></a>\
<% } %>\
<% if(typeof $data[i].buyerensure !== "undefined" && $data[i].buyerensure === true) { %>\
<a rel="nofollow" click-item="paymentprotection" class="sw-ui-icon-payGuarantee sm-offerResult-textTop" href="http://page.1688.com/buyerprotection/buyer.html" target="_blank"></a>\
<% } %>\
<% if(typeof $data[i].goldsupplier !== "undefined" && $data[i].goldsupplier === true) { %>\
<a rel="nofollow" click-item="goldsupplier" class="sw-ui-icon-goldSupplier sm-offerResult-textTop" href="http://page.1688.com/goldsupplier.html" target="_blank"></a>\
<% } %>\
<% if(typeof $data[i].mjdanganurl !== "undefined" && $data[i].mjdanganurl !== null) { %>\
<a rel="nofollow" click-item="maijia" class="sw-ui-icon-mjdangan2" href="<%= $data[i].mjdanganurl %>" target="_blank">���ҵ���</a>\
<% } %>\
</p>\
<% } %>\
</div>\
</li>\
<% } %>';
$.use('web-sweet', function() {
var offers;
offers = FE.util.sweet(templateHtml).applyData(data, app);
$("ul.qg-offerresults", "#content").append(offers);
$("#offers_asyn").remove();
Sandbox.notify(Qingguo.Config.Events.OfferAsyncOffer, {});
});
}
});
Qingguo.Business.AsynImgOffer = AsynImgOffer;
AppCore.lazyRegister("qingguo_mod_asynimgoffer", "Qingguo.Business.AsynImgOffer", "#offers_asyn", "exposure");
})(jQuery);
}).call(this);