Authored by weiqingting

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

... ... @@ -85,4 +85,5 @@
{{/ newArrivls}}
{{/ boys}}
</div>
<script>__custom = {"yopid":"index"};</script>
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -2,14 +2,23 @@
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-W958MG" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>
var _hmt = _hmt || [];
var _gaq = _gaq || [];
(function() {
function async_load(){
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-W958MG');
(function() {
_gaq.push(['_setAccount', 'UA-48997038-32']);
_gaq.push(['_trackPageview']);
var ga = document.createElement('script');
ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
(function() {
var hm = document.createElement("script");
hm.src = "//hm.baidu.com/hm.js?c6ee7218b8321cb65fb2e98f284d8311";
hm.async = 1;
... ... @@ -30,6 +39,17 @@ var _hmt = _hmt || [];
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
(function() {
var hm = document.createElement("script");
hm.src = "http://static.criteo.net/js/ld/ld.js";
hm.async = 1;
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
var u = _ozuid || "";
u = (u == 0) ? "" : u;
window.criteo_q = window.criteo_q || [];
window.criteo_q.push({event: "setAccount", account: 16184 },{event: "setCustomerId", id: u},{event: "setSiteType", type: "d" },{event: "viewHome" });
})();
}
if (window.addEventListener) {
window.addEventListener('load', async_load, false);
... ...
... ... @@ -10,6 +10,8 @@
<title>{{title}}</title>
<link rel="dns-prefetch" href="//cdn.yoho.cn">
<link rel="dns-prefetch" href="//static.yohobuy.com">
<link rel="dns-prefetch" href="//img10.static.yhbimg.com">
<link rel="dns-prefetch" href="//img11.static.yhbimg.com">
<link rel="dns-prefetch" href="//img12.static.yhbimg.com">
<link rel="dns-prefetch" href="//img13.static.yhbimg.com">
{{#if rlsEnv}}
... ...
... ... @@ -273,7 +273,7 @@
\{\{/need_pay_gifts\}\}
</ul>
<ul class="activity-list">
\{{#equalone has_promotion\}\}
\{{#if has_promotion\}\}
<li class="activity-item">
<span class="activity-name">活动</span>
<h3 class="activity-content">
... ... @@ -286,13 +286,13 @@
\{\{/equalone\}\}
</h3>
</li>
\{\{/equalone\}\}
\{\{#equalone fit_free_shipping \}\}
\{\{/if\}\}
\{\{#if fit_free_shipping \}\}
<li class="activity-item">
<span class="activity-name">免运费</span>
<h3 class="activity-content">全场满 499免运费</h3>
</li>
\{\{/equalone\}\}
\{\{/if\}\}
</ul>
</div>
<div class="gobuy-notempty-footer">
... ... @@ -317,7 +317,7 @@
<span class="has">\{\{vip.curYearCost\}\}</span>
<span class="total">\{\{vip.nextVipInfo.needCost\}\}</span>
</div>
<p class="\{\{#equalzero it.vip.curYearCostPer\}\}integrate\{\{/equalzero\}\}" style="width: \{\{vip.curYearCostPer\}\}%;"></p>
<p class="\{\{#unless vip.curYearCostPer\}\}integrate\{\{/unless\}\}" style="width: \{\{vip.curYearCostPer\}\}%;"></p>
</div>
<span class="cardcate float-left">\{\{vip.nextVipInfo.title\}\}</span>
</div>
... ... @@ -360,5 +360,6 @@
</div>
</script>
</div>
<input id="api-domain" type="hidden" value="{{apiDomain}}">
{{/headerdata}}
... ...
... ... @@ -3,145 +3,127 @@
</script>
{{!-- 正常头部 --}}
{{#headerdata}}
<script>
seajs.use('js/header');
</script>
<script>
seajs.use('js/header');
</script>
{{/headerdata}}
{{!-- 简单头部 --}}
{{#simpleHeader}}
<script>
seajs.use('js/simple-header');
</script>
<script>
seajs.use('js/simple-header');
</script>
{{/simpleHeader}}
{{!-- 首页 --}}
{{#if boysHomePage}}
<script>
seajs.use('js/home/home');
</script>
<script>
seajs.use('js/home/home');
</script>
{{/if}}
{{!-- 搜索 --}}
{{#if searchListPage}}
<script>
seajs.use('js/product/brand');
seajs.use(['js/product/list', 'js/product/product'], function (list, product) {
product.init(5);
window.onresize = function () {
setTimeout(function () {
product.init(5);
}, 300);
};
});
</script>
<script>
seajs.use('js/product/brand');
seajs.use(['js/product/list', 'js/product/product'], function (list, product) {
product.init(5);
window.onresize = function () {
setTimeout(function () {
product.init(5);
}, 300);
};
});
</script>
{{/if}}
{{!-- 列表 --}}
{{#if productListPage}}
<script>
seajs.use(['js/product/list', 'js/product/product'], function (list, product) {
<script>
seajs.use(['js/product/list', 'js/product/product'], function (list, product) {
product.init(4);
window.onresize = function () {
setTimeout(function () {
product.init(4);
}, 300);
};
product.init(4);
window.onresize = function () {
setTimeout(function () {
product.init(4);
}, 300);
};
});
</script>
});
</script>
{{/if}}
{{!-- 商品详情页 --}}
{{#if productDetailPage}}
<script>
seajs.use('js/product/item');
</script>
<script>
seajs.use('js/product/item');
</script>
{{/if}}
{{!-- 逛 --}}
{{#if guangIndexPage}}
<script>
seajs.use('js/guang/index');
</script>
<script>
seajs.use('js/guang/index');
</script>
{{/if}}
{{!-- 逛详情页 --}}
{{#if guangDetailPage}}
<script>
seajs.use('js/guang/detail');
</script>
<script>
seajs.use('js/guang/detail');
</script>
{{/if}}
{{!-- 逛列表页 --}}
{{#if guangListPage}}
<script>
seajs.use('js/guang/list');
</script>
<script>
seajs.use('js/guang/list');
</script>
{{/if}}
{{!-- SALE --}}
{{#if saleIndexPage}}
<script>
seajs.use('js/sale/index');
</script>
<script>
seajs.use('js/sale/index');
</script>
{{/if}}
{{!-- sale列表 --}}
{{#if saleListPage}}
<script>
seajs.use(['js/product/list', 'js/product/product', 'js/sale/banner'], function (list, product) {
product.init(4);
window.onresize = function () {
setTimeout(function () {
product.init(4);
}, 300);
};
});
</script>
{{/if}}
{{!-- sale 分类列表 --}}
{{#if saleCatPage}}
<script>
seajs.use(['js/product/list', 'js/product/product', 'js/sale/banner'], function (list, product) {
product.init(4);
window.onresize = function () {
setTimeout(function () {
product.init(4);
}, 300);
};
});
</script>
{{/if}}
{{!-- 登录注册找回密码--}}
{{#if loginPage}}
<script>
seajs.use('js/passport/login');
</script>
<script>
seajs.use('js/passport/login');
</script>
{{/if}}
{{!-- 第三方绑定--}}
{{#if thirdLogin}}
<script>
seajs.use('js/passport/thirdlogin');
</script>
<script>
seajs.use('js/passport/thirdlogin');
</script>
{{/if}}
{{!-- 注册页--}}
{{#if registerPage}}
<script>
seajs.use('js/passport/reg', function (reg) {
reg.init('reg');
});
</script>
<script>
seajs.use('js/passport/reg', function (reg) {
reg.init('reg');
});
</script>
{{/if}}
{{!-- 第三方登录完善信息页--}}
{{#if thirdPage}}
<script>
... ... @@ -150,43 +132,39 @@
});
</script>
{{/if}}
{{!-- 找回密码--}}
{{#if backPage}}
<script>
seajs.use('js/passport/back');
</script>
<script>
seajs.use('js/passport/back');
</script>
{{/if}}
{{!-- 重置密码--}}
{{#if resetPage}}
<script>
seajs.use('js/passport/reset');
</script>
<script>
seajs.use('js/passport/reset');
</script>
{{/if}}
{{!-- 验证手机 --}}
{{#if vertificationPage}}
<script>
seajs.use('js/passport/vertification');
</script>
<script>
seajs.use('js/passport/vertification');
</script>
{{/if}}
{{!-- 热销排行--}}
{{#if hotrankPage}}
<script>
seajs.use('js/product/hotrank');
</script>
<script>
seajs.use('js/product/hotrank');
</script>
{{/if}}
{{!-- 品牌页 --}}
{{#if brandsHomePage}}
<script>
seajs.use('js/brand/index');
</script>
<script>
seajs.use('js/brand/index');
</script>
{{/if}}
{{!-- 订单保存--}}
{{#if orderSavePage}}
<script>
seajs.use('js/order/save');
</script>
<script>
seajs.use('js/order/save');
</script>
{{/if}}
... ...
... ... @@ -8,7 +8,7 @@ var handlebars = require('yoho.handlebars');
var json2 = require('json2');
var vipInfoCombine = null; //用户信息编译模板
var loginInfoCombine = null; //登录信息编译模板
var apiDomain = 'http://test.open.yohobuy.com/'; //获取数据的地址http://api.open.yohobuy.com
var apiDomain = $('#api-domain').val(); //获取数据的地址
var cartTpl = ''; //购物车模板
/**
* 搜寻的时候过滤非法字符(+-/:等非法字符单独出现)
... ... @@ -65,6 +65,8 @@ var bannerMap = {
};
var cookieMap = {};
$('#api-domain').remove(); //删除信息表单
function getSource(column, postition, event) {
try {
dataLayer.push({
... ...
<?php
use Action\WebAction;
use Index\HomeModel;
use Configs\WebCacheConfig;
... ... @@ -16,23 +17,23 @@ class CommonController extends WebAction
public function getIndexResourceBrandAction()
{
$data = array();
do {
if (!$this->isAjax()) {
break;
}
$type = $this->get('type');
if (empty($type)) {
break;
}
// 首页资源品牌,采用内存存储
$key = WebCacheConfig::KEY_WEB_INDEX_BRANDS_LIST_DATA . '_' . $type;
// array('logoBrand'=>'','moreBrand'=>'')
$data = Cache::get($key);
}
while (false);
} while (false);
$this->echoJson($data);
}
... ... @@ -49,7 +50,7 @@ class CommonController extends WebAction
$result = array();
do {
/* 判断是不是AJAX请求 */
if (! $this->isAjax()) {
if (!$this->isAjax()) {
break;
}
$channels = array(
... ... @@ -61,7 +62,7 @@ class CommonController extends WebAction
$channel = $this->post('type', '');
$pageIndex = (int) $this->post('pageIndex', 0);
$pageCount = (int) $this->post('pageCount', 8);
if (! in_array($channel, $channels)) {
if (!in_array($channel, $channels)) {
break;
}
... ... @@ -69,7 +70,7 @@ class CommonController extends WebAction
if (empty($data)) {
break;
}
if ($pageIndex < 0) {
$pageIndex = 0;
}
... ... @@ -87,55 +88,46 @@ class CommonController extends WebAction
$data = array();
} while (false);
$this->echoJson($result);
}
/**
/**
* 获取资源位banner
*
* @return jsonp
*/
public function getbannerAction()
{
$url = 'http://service.api.yohobuy.com/operations/api/v4/resource/get?';
$content_code = $this->get('content_code', '');
$client_type = $this->get('client_type', 'web');
$contentCode = $this->get('content_code', '');
$callback = $this->get('callback', '');
$width = $this->get('width', '');
$height = $this->get('height', '');
$params = array(
'content_code' => $content_code,
'client_type' => $client_type
);
$data = IndexData::getResourceData($content_code);//Yohobuy::get($url.http_build_query($params));
if(empty($data['data']))
{
$data = IndexData::getResourceData($contentCode);
if (empty($data['data'])) {
return $this->helpJsonCallbackResult($callback, 200, '没有数据', '');
}
else
{
} else {
$banner = '';
if(isset($data['data'][0]['data']))
{
if($data['data'][0]['template_name'] == 'single_image') {
if (isset($data['data'][0]['data'])) {
if ($data['data'][0]['template_name'] == 'single_image') {
$banner = current($data['data'][0]['data']);
} else if($data['data'][0]['template_name'] == 'single_name_image') {
} else if ($data['data'][0]['template_name'] == 'single_name_image') {
$banner = $data['data'][0]['data'];
}
if(!empty($banner)) {
if(empty($width) || empty($height) ) {
$width = 2600;//通栏广告
$height = 60;
if (!empty($banner)) {
if (empty($width) || empty($height)) {
$width = 2600; //通栏广告
$height = 60;
}
$banner['src'] = Images::getImageUrl($banner['src'], $width, $height ,2);
//str_replace('?imageView/{mode}/w/{width}/h/{height}', '', $banner['src']);
$banner['src'] = Images::getImageUrl($banner['src'], $width, $height, 2);
//str_replace('?imageView/{mode}/w/{width}/h/{height}', '', $banner['src']);
}
}
return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $banner);
}
return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $banner);
}
/**
* 获取邮件订阅
*
... ... @@ -148,14 +140,14 @@ class CommonController extends WebAction
$uid = intval($this->get('uid', '0'));
$data = array();
//验证邮件
if(Helpers::verifyEmail($email)) {
if (Helpers::verifyEmail($email)) {
$data = IndexData::emailSubscriber($email, $uid);
return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $data['data']);
} else {
return $this->helpJsonCallbackResult($callback, 403, '订阅失败', '');
}
}
/**
* 意见反馈
*
... ... @@ -168,7 +160,7 @@ class CommonController extends WebAction
$question_id = intval($this->get('question_id', 0));
$answer = trim($this->get('answer'));
$solution = intval($this->get('solution', 0));
if(!empty($feedback_id) || !empty($question_id) || !empty($answer) || !empty($solution)) {
if (!empty($feedback_id) || !empty($question_id) || !empty($answer) || !empty($solution)) {
$data = IndexData::suggestFeedback($feedback_id, $question_id, $answer, $solution);
return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $data['data']);
} else {
... ... @@ -179,7 +171,6 @@ class CommonController extends WebAction
/*
* 简单头部
*/
public function getSimpleHeaderAction()
{
$result = array();
... ... @@ -190,12 +181,11 @@ class CommonController extends WebAction
}
//获取用户
$uid = $this->getUid(true);
$uid = $this->getUid(false);
if (!$uid) {
$isLogin = false;
$username = '';
}
else {
} else {
$isLogin = true;
$username = $this->_uname;
}
... ... @@ -212,8 +202,7 @@ class CommonController extends WebAction
'userCenter' => Helpers::url('/home?t=' . time()), //用户中心链接
'logout' => Helpers::url('/logout.html?t=' . time()), //退出
);
}
else {
} else {
$tool+=array(
'login' => Helpers::url('/signin.html'), //登录链接,已登录不传
'register' => Helpers::url('/reg.html'), //注册链接,已登录不传
... ... @@ -233,10 +222,9 @@ class CommonController extends WebAction
'code' => 200,
'data' => $simpleHeader
);
}
while (false);
} while (false);
$this->echoJson($result);
}
}
\ No newline at end of file
}
... ...