sodajs
Version:
Light weight but powerful template engine for JavaScript.
229 lines (219 loc) • 20.2 kB
JavaScript
var tpl = `<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class="first_use">
<div class="fist_use_wrap">
<span class="first_user_close"></span>
<h4>买车从来不是一件简单的事!</h4>
<p>亲,欢迎来到好买车!每天,我们的团队为众多和您一样的会员提供专业服务,这让我们很幸福!</p>
<p>我们做得事情很有意义:尽我们所能,帮您找到真车源,真价格;帮您买到称心的车。</p>
<p>通过我们,您可以:</p>
<ul class="select_use_info">
<li class="first">
<i class="use_ico1"></i>
<span>真行情</span>
<p>参考其他购车者的历史成交价,了解最</p>
<p>真实的价格行情走势</p>
</li>
<li>
<i class="use_ico2"></i>
<span>真车源 真车价</span>
<p>
让{{HMC.currCity=='sh' ? '300':'200'}}家4S店为您在线PK,得到当前实时的
</p>
<p>库存情况和成交价格</p>
</li>
<li>
<i class="use_ico3"></i>
<span>真服务</span>
<p>直接预订好买车的自营直销车,享受</p>
<p>“现车底价+上门服务”</p>
</li>
</ul>
<a href="javascript:;" class="select_car_btn choose_car">选择车型去试试吧!</a>
</div>
</div>
<div class="home_banner">
<img class="home_price_curve" src="images/index/home_price_curve.png" />
<h3>真车实价 比出来</h3>
<p class="home_main_title">
{{HMC.currCity=='sh' ? '上海3':'杭州2'}}00家4S店在线比价,让你买车不花冤枉钱
</p>
<ul class="banner_btns">
<li class="active choose_car"><a href="javascript:;">选车去比价</a></li>
<li id="first_open"><a href="javascript:;">初次使用?</a></li>
</ul>
<!--<% include modules/carModel/carModel.ejs %>-->
</div>
<div class="wrap brand_list">
<a href="javascript:;" class="brand_prev"></a>
<div class="brand_list_wrap">
<ul class="brand_list_menu">
<li class="brandLogo_item" ng-repeat="item in brandLogo" data-brandid="{{item.topBrandId}}">
<img src="{{item.brandLogo}}" />
</li>
</ul>
</div>
<a href="javascript:;" class="brand_next"></a>
</div>
<div class="wrap hot_carList">
<div class="home_title">
<h5>看看350款热销车的历史成交价</h5>
<p>所有数据来自网站会员的真实成交价,我们努力让您看到最真实的市场行情!</p>
<a href="javascript:;" class="home_title_more choose_car">更多></a>
</div>
<ul class="hot_carList_menu">
<li ng-repeat="item in hotCarList">
<a href="{{HMC.currCity}}/car_parity_detail/{{item.typeId}}">
<img src="{{item.tpicPath}}" />
<p>{{item.brandName + " " +item.typeName}}</p>
<span>厂商指导价 ¥{{(item.typeMinPrice/10000)|toFixed:2}}万~¥{{(item.typeMaxPrice/10000)|toFixed:2}}万</span>
</a>
</li>
</ul>
</div>
<div class="static_map">
<div class="home_title">
<h5>选择{{HMC.currCity == 'sh'?'300':'200'}}家4S店PK当前成交价</h5>
<p ng-if="HMC.currCity == 'sh'">我们在上海300家4S店内有1500名认证销售员,确保随时能为您提供实时的库存及价格反馈!</p>
<p ng-if="HMC.currCity != 'sh'">我们对杭州200家4S店进行认证,确保1000名销售员随时为您在线PK报价!</p>
</div>
<div class="btn_wrap {{HMC.currCity}}">
<div class="wrap">
<span class="choose_car"></span>
</div>
</div>
</div>
<div class="wrap member_info">
<div class="home_title">
<h5>和35300名会员一起,深入了解好买车的服务</h5>
<p>看看粉丝们是如何评价好买车,希望您在享受会员服务后,也晒出中肯的评价!</p>
</div>
<div class="member_list">
<img class="loading" src="images/index/loading.jpg" />
</div>
</div>
<div class="friend_linkWrap">
<div class="wrap friend_link">
<h4>携手10大知名服务商,每周为会员提供400余款自营直销车</h4>
<p>好买车买断车源,提供“现车底价+上门服务”,在线预订,买车全流程(签订、贷款、保险、上牌等)</p>
<p>上门办理,4S店提车,线上线下一个价,所见即所得</p>
<ul class="friend_link_menu">
<li><img src="images/index/friend_link_01.png" /></li>
<li><img src="images/index/friend_link_02.png" /></li>
<li><img src="images/index/friend_link_03.png" /></li>
<li><img src="images/index/friend_link_04.png" /></li>
<li><img src="images/index/friend_link_05.png" /></li>
<li><img src="images/index/friend_link_06.png" /></li>
<li><img src="images/index/friend_link_07.png" /></li>
<li><img src="images/index/friend_link_08.png" /></li>
<li><img src="images/index/friend_link_09.png" /></li>
<li><img src="images/index/friend_link_10.png" /></li>
<li ng-if="HMC.currCity == 'sh'"><img src="images/index/friend_link_13.png" /></li>
<li ng-if="HMC.currCity == 'sh'"><img src="images/index/friend_link_14.png" /></li>
<li ng-if="HMC.currCity != 'sh'"><img src="images/index/friend_link_11.png" /></li>
<li ng-if="HMC.currCity != 'sh'"><img src="images/index/friend_link_12.png" /></li>
</ul>
<a href="{{HMC.currCity}}/direct_sale_list/carBrand/carType/minPrice/maxPrice/descType" class="friend_link_more">更多自营直销车</a>
<div class="friend_link_popup">
<ul class="friend_link_service">
<li>
<i class="service_ico1"></i>
<p>现车底价</p>
<span>4S店提车,全网保养</span>
</li>
<li>
<i class="service_ico2"></i>
<p>上门服务</p>
<span>上门接送看车,签单</span>
</li>
<li>
<i class="service_ico3"></i>
<p>代拍牌照</p>
<span>代拍沪牌,代办外牌</span>
</li>
<li>
<i class="service_ico4"></i>
<p>受理贷款</p>
<span>受理贷款</span>
</li>
<li class="no_margin">
<i class="service_ico5"></i>
<p>代办保险</p>
<span>超10家合作保险公司</span>
</li>
</ul>
</div>
</div>
</div>
<div class="wrap evaluate">
<div class="home_title">
<h5>更多的媒体评价供您参考</h5>
<p>更多的媒体评价,让您对我们的产品有更加深入的认识,打消您的疑虑</p>
</div>
<ul class="evaluate_list">
<li>
<img src="images/index/wyxw.png" />
<h5>网易新闻</h5>
<p>好买车作为4S店新车比价平台,至今已为数十万的购车者提供实时购车比价服务,“买车之前,先去好买车比比价格...</p>
<a href="http://news.163.com/16/1227/16/C9AC3C1600018AOP.html" class="evaluate_more" target="_black">更多></a>
</li>
<li>
<img src="images/index/fhzx.png" />
<h5>凤凰资讯</h5>
<p>“首先,好买车作为平台,联合了上海300家,杭州200家品牌授权4S店,并对其2500名销售员进行了认证,可对50个热销...</p>
<a href="http://news.ifeng.com/a/20161226/50477599_0.shtml" class="evaluate_more" target="_black">更多></a>
</li>
<li>
<img src="images/index/xhw.png" />
<h5>新华网</h5>
<p>“抹平4S店和购车者之间的信息不对等,降低双方的交易成本。让老百姓更轻松得买到好车,让4S店高效地把车卖出去。...</p>
<a href="http://news.xinhuanet.com/itown/2016-12/27/c_135935405.htm" class="evaluate_more" target="_black">更多></a>
</li>
<li>
<img src="images/index/hqw.png" />
<h5>环球网</h5>
<p>据记者了解,正是海量真实成交价的积累,奠定了好买车业内领先的大数据地位,也因此,好买车敢于在新版本上线之际,...</p>
<a href="http://china.huanqiu.com/hot/2016-12/9870141.html" class="evaluate_more" target="_black">更多></a>
</li>
</ul>
</div>
</body>
</html>`;
var scope = {"HMC":{"isDev":false,"baseUrl":"/api","currCity":"sh","currCityCode":310000,"currCityName":"上海","cityList":[{"city":"sh","cityName":"上海","cityCode":310000,"lonLat":[121.449312,31.286035,"请选择您住址区域"]},{"city":"hz","cityName":"杭州","cityCode":330100,"lonLat":[120.216699,30.2517,"请选择您住址区域"]}],"currPage":"index","jsRev":"index-1369301cff.min.js","cssRev":"index-1b38674aa7.min.css","pointList":[{"selector":"","eventType":"click","opcode":"visit","code":"PA00"},{"selector":"#header .logo.fl","eventType":"click","opcode":"click","code":"PA01"},{"selector":"#header .city_select","eventType":"click","opcode":"click","code":"PA0W"},{"selector":"#header .city[data-city='sh']","eventType":"click","opcode":"click","code":"PAW1"},{"selector":"#header .city[data-city='hz']","eventType":"click","opcode":"click","code":"PAW2"},{"selector":"#header .search input","eventType":"focus","opcode":"click","code":"PA0X"},{"selector":"#header i.user","eventType":"click","opcode":"click","code":"PA0Y"},{"selector":".home_banner .banner_btns .choose_car","eventType":"click","opcode":"click","code":"PA10"},{"selector":".home_banner .banner_btns #first_open","eventType":"click","opcode":"click","code":"PA11"},{"selector":".brand_list .brand_list_wrap","eventType":"click","opcode":"click","code":"PA12"},{"selector":".hot_carList .hot_carList_menu","eventType":"click","opcode":"click","code":"PA13"},{"selector":".hot_carList .home_title_more","eventType":"click","opcode":"click","code":"PA14"},{"selector":".evaluate .evaluate_more","eventType":"click","opcode":"click","code":"PA17"},{"selector":"#footer .footer_list_menu a","eventType":"click","opcode":"click","code":"PA18"},{"selector":".friend_linkWrap .friend_link_more","eventType":"click","opcode":"click","code":"PA0Z"},{"selector":".static_map .choose_car","eventType":"click","opcode":"click","code":"PA22"}]},"hotCarList":[],"brandLogo":[{"brandKeyword":"dazhong","brandLogo":"http://static.haomaiche.com/common/images/brand/8b65694548814ebab6a9e4350f610f92.png","brandName":"大众","topBrandId":"04af02a3c0cf4e91a23d9097d88c3f29"},{"brandKeyword":"aodi","brandLogo":"http://static.haomaiche.com/common/images/brand/4aefadf9e52048cea3de63ecc62c2b55.png","brandName":"奥迪","topBrandId":"6f52db5b494a47728af8d244da92d4a6"},{"brandKeyword":"bieke","brandLogo":"http://static.haomaiche.com/common/images/brand/7a5bb1b38576419e89417c81c994a605.png","brandName":"别克","topBrandId":"43855c5c790d47be9c2a88d46d7ca0fb"},{"brandKeyword":"baoma","brandLogo":"http://static.haomaiche.com/common/images/brand/d5092878425b48069e452d18d97530a5.png","brandName":"宝马","topBrandId":"c74216cf2f4441c1b870b060c6ae97c1"},{"brandKeyword":"bentian","brandLogo":"http://static.haomaiche.com/common/images/brand/0f638c0980fb49f4bbc776af8f7f6b66.png","brandName":"本田","topBrandId":"eb6748d5bf0b46a0aa924271d4f14e85"},{"brandKeyword":"fute","brandLogo":"http://static.haomaiche.com/common/images/brand/0bd10ec1d2a047b281879be430c7481a.png","brandName":"福特","topBrandId":"dbd6e28ebac44511b25d5b8fbca48a86"},{"brandKeyword":"xuefolan","brandLogo":"http://static.haomaiche.com/common/images/brand/f3fbc0d411954d6a82d05781c53e38f5.png","brandName":"雪佛兰","topBrandId":"8cd87f71b1fd48a2b4fe85e509f612fe"},{"brandKeyword":"fengtian","brandLogo":"http://static.haomaiche.com/common/images/brand/1d9b3220fcc24fffac2ae824459f13de.png","brandName":"丰田","topBrandId":"4d7ac871b3b54f7a8f3b44d700f8b7f1"},{"brandKeyword":"benchi","brandLogo":"http://static.haomaiche.com/common/images/brand/2d771097e94147d8af261ed67c0f1015.png","brandName":"奔驰","topBrandId":"8a9143f2c8f145e2818aa00dd98b7d85"},{"brandKeyword":"xiandai","brandLogo":"http://static.haomaiche.com/common/images/brand/508565c452b34553960ca667af2fc128.png","brandName":"现代","topBrandId":"fbd60c16d20d45409000689d3d114834"},{"brandKeyword":"sikeda","brandLogo":"http://static.haomaiche.com/common/images/brand/ce95fa40ba954cc0b92b350636fd40be.png","brandName":"斯柯达","topBrandId":"4dc01359b42345808d30daa139a009da"},{"brandKeyword":"shqcrw","brandLogo":"http://static.haomaiche.com/common/images/brand/7659b2ba4da54c359e98900438aca02f.png","brandName":"荣威","topBrandId":"ff3000ea17104a2cb0caf3f7e7274e25"},{"brandKeyword":"mazida","brandLogo":"http://static.haomaiche.com/common/images/brand/6adfdf4e77cf4d2cb1924333500e4d55.png","brandName":"马自达","topBrandId":"36e8ba9b278b409da990b3b99002199a"},{"brandKeyword":"qiya","brandLogo":"http://static.haomaiche.com/common/images/brand/a533d430b5804b3286a05302f1decfa5.png","brandName":"起亚","topBrandId":"049b9cabacbc4302bb5508ee73ecb24a"},{"brandKeyword":"richan","brandLogo":"http://static.haomaiche.com/common/images/brand/a2be1fd973bf42b5808b8342e3cf4906.png","brandName":"日产","topBrandId":"43e7f40e735b441b8ab9f44907633b8e"},{"brandKeyword":"biaozhi","brandLogo":"http://static.haomaiche.com/common/images/brand/db6274e80e2545a0be1b440de183f102.png","brandName":"标致","topBrandId":"be2e0c5da9bc4b37a0e55fb7d3d014d9"},{"brandKeyword":"leikesasi","brandLogo":"http://static.haomaiche.com/common/images/brand/ce04a23614c8408280e2f023beac7015.png","brandName":"雷克萨斯","topBrandId":"3b66588d4bdd4860869a9d424e3a0223"},{"brandKeyword":"woerwo","brandLogo":"http://static.haomaiche.com/common/images/brand/79f68840fa86450abdd55a279c9a9481.png","brandName":"沃尔沃","topBrandId":"8d915aaffa58464e8e4fbb27ac8e1585"},{"brandKeyword":"jeep","brandLogo":"http://static.haomaiche.com/common/images/brand/aa79f81e12cd44eb9b1c3f5c4962bdb7.png","brandName":"JEEP","topBrandId":"5683cedd7d8e4f95870ec1fe62598226"},{"brandKeyword":"cadillac","brandLogo":"http://static.haomaiche.com/common/images/brand/baa6ec18ee624fc798551a3b9b0f3658.png","brandName":"凯迪拉克","topBrandId":"da2bbbda2792442b9df6b5a21e1337a1"},{"brandKeyword":"hafu","brandLogo":"http://static.haomaiche.com/common/images/brand/632e34aa18e0484baa8d5e3c7339287d.jpg","brandName":"哈弗","topBrandId":"bb9df56cfc594241979e74a9e6918804"},{"brandKeyword":"xuetielong","brandLogo":"http://static.haomaiche.com/common/images/brand/ea3e90ab5701447c8ce400edc2d1aa21.png","brandName":"雪铁龙","topBrandId":"495fc3fa394d47789e49c0cf92863583"},{"brandKeyword":"yingfeinidi","brandLogo":"http://static.haomaiche.com/common/images/brand/d29b44a5f9c848a8ab43fe6faec07843.png","brandName":"英菲尼迪","topBrandId":"a0adc075a8984872a706ce54bb83a6d0"},{"brandKeyword":"luhu","brandLogo":"http://static.haomaiche.com/common/images/brand/b7af03eb51184020aebc0e7ec7f5c52c.png","brandName":"路虎","topBrandId":"839bc3d4b8ee4337ab3e268565b1f43e"},{"brandKeyword":"shqcmg","brandLogo":"http://static.haomaiche.com/common/images/brand/5b34e785967f4a44ac77eefeae6d3a31.png","brandName":"MG","topBrandId":"8e2249aa32f94afb9d91ff5ccea1f9f9"},{"brandKeyword":"sibalu","brandLogo":"http://static.haomaiche.com/common/images/brand/9ce6c702b174446b9304a43526e80432.png","brandName":"斯巴鲁","topBrandId":"a53637f25f5241279259188f3716699f"},{"brandKeyword":"ds","brandLogo":"http://static.haomaiche.com/common/images/brand/8d45e02e25084a6ca62e22304f7cb5ab.png","brandName":"DS","topBrandId":"5ed3ffd2067c4b22b97d5b1a573ce70c"},{"brandKeyword":"dodge","brandLogo":"http://static.haomaiche.com/common/images/brand/6fc00cdb035443d1a0a3495120cb4fa2.png","brandName":"道奇","topBrandId":"33c4cd9f05b14f3e8ddefd88f6013c6a"},{"brandKeyword":"byd","brandLogo":"http://static.haomaiche.com/common/images/brand/4ca2d543e65f4e71bd89354086c7a655.png","brandName":"比亚迪","topBrandId":"69895635235e427a8b71364dd976a847"},{"brandKeyword":"jiebao","brandLogo":"http://static.haomaiche.com/common/images/brand/a161b0ebe2734da6a5acc16d1fc0b185.png","brandName":"捷豹","topBrandId":"ef5226cb6c604b248a07da95189a63a0"},{"brandKeyword":"leinuo","brandLogo":"http://static.haomaiche.com/common/images/brand/3c466e80c8de46c688d67a33616f18e1.png","brandName":"雷诺","topBrandId":"c9cd31367c5c44a1b70914354958f0b3"},{"brandKeyword":"beijingqiche","brandLogo":"http://static.haomaiche.com/common/images/brand/47b5343cdb584bfe80ec0417ef238cf6.png","brandName":"北汽","topBrandId":"fcc35a673f3c42c88a0c267699e5642f"},{"brandKeyword":"linken","brandLogo":"http://static.haomaiche.com/common/images/brand/8f95aeda446d4a0389e1b29bb2146aba.png","brandName":"林肯","topBrandId":"58fb32efd9214136a1d8abbb6b8d6fc0"},{"brandKeyword":"feiyate","brandLogo":"http://static.haomaiche.com/common/images/brand/3eb4d6243ca84fab9855657d489b9ee9.png","brandName":"菲亚特","topBrandId":"cee203c4e79d4e4586ac78a0307be2c1"},{"brandKeyword":"mini","brandLogo":"http://static.haomaiche.com/common/images/brand/0587a69d1db94b35a85213497c30c74e.png","brandName":"MINI","topBrandId":"b2543e6343d041f896051e9c6d9a8f4a"},{"brandKeyword":"kelaisile","brandLogo":"http://static.haomaiche.com/common/images/brand/8d9e6255e5fe4d5b8c47d569776ff4fc.png","brandName":"克莱斯勒","topBrandId":"6b058d6249a94c0783c1b16125dc2923"},{"brandKeyword":"smart","brandLogo":"http://static.haomaiche.com/common/images/brand/b0b680a88f484ce681df1ca4c64fb82f.png","brandName":"smart","topBrandId":"0538827a25c24f7386b10e582d3fba93"},{"brandKeyword":"baowo","brandLogo":"http://static.haomaiche.com/common/images/brand/a981ead628844943b5668f1e3061b498.png","brandName":"宝沃","topBrandId":"6b746e9b1f104875ba8d977bf9001e38"}],"templates":{}};
var soda = require('../dist/soda.node');
//var soda = require('../src/soda.old');
var filters = {
toFixed: function(input, number) {
input = Number(input)
if (isNaN(input)) {
return 0;
}
return input.toFixed(number)
},
date: function(input, fmt) {
var type = typeof input
if (type == 'number' || (type == 'string' && new Date(input))) {
return new Date(input).Format(fmt)
} else if (type == 'object' && input.getTime) {
return input.Format(fmt)
} else {
return '无效的日期参数'
}
}
};
function init(soda, filters) {
filters = filters || {};
soda.prefix('ng-');
for (var key in filters) {
soda.filter(key, filters[key])
}
return soda;
}
var soda = init(soda,filters)
var t1 = Date.now()
var template = soda(tpl, scope)
var t2 = Date.now()
console.log('time:' + (t2 - t1))