Merge branch 'release/5.5.1' of git.yoho.cn:fe/yohobuywap-node into release/5.5.1
Showing
8 changed files
with
103 additions
and
4 deletions
@@ -12,6 +12,9 @@ const singleAPI = global.yoho.SingleAPI; | @@ -12,6 +12,9 @@ const singleAPI = global.yoho.SingleAPI; | ||
12 | const helpers = global.yoho.helpers; | 12 | const helpers = global.yoho.helpers; |
13 | const _ = require('lodash'); | 13 | const _ = require('lodash'); |
14 | const crypto = global.yoho.crypto; | 14 | const crypto = global.yoho.crypto; |
15 | +const service = global.yoho.ServiceAPI; | ||
16 | +const utils = '../../../utils'; | ||
17 | +const resourcesProcess = require(`${utils}/resources-process`); | ||
15 | 18 | ||
16 | /** | 19 | /** |
17 | * 个人详情数据 | 20 | * 个人详情数据 |
@@ -92,6 +95,24 @@ const _getAddressData = (params) => { | @@ -92,6 +95,24 @@ const _getAddressData = (params) => { | ||
92 | } | 95 | } |
93 | }; | 96 | }; |
94 | 97 | ||
98 | +// 资源位 | ||
99 | +const _getRes = () => { | ||
100 | + return service.get('/operations/api/v5/resource/home', { | ||
101 | + content_code: '5d05d443a557783b1489d328c127e9bf', | ||
102 | + }).then(result => { | ||
103 | + if (result && result.code === 200 && result.data && result.data.list) { | ||
104 | + for (let item of result.data.list) { | ||
105 | + item.template_name === 'single_image' && | ||
106 | + item.data.length === 1 && | ||
107 | + (item.singleOne = true); | ||
108 | + } | ||
109 | + return resourcesProcess(result.data.list); | ||
110 | + } else { | ||
111 | + return result; | ||
112 | + } | ||
113 | + }); | ||
114 | +}; | ||
115 | + | ||
95 | /** | 116 | /** |
96 | * 个人中心首页 | 117 | * 个人中心首页 |
97 | * @param params | 118 | * @param params |
@@ -116,7 +137,8 @@ const index = (params) => { | @@ -116,7 +137,8 @@ const index = (params) => { | ||
116 | _noticeData(), | 137 | _noticeData(), |
117 | _favoriteData(params), | 138 | _favoriteData(params), |
118 | _infoNum(params), | 139 | _infoNum(params), |
119 | - _getAddressData(params) | 140 | + _getAddressData(params), |
141 | + _getRes() | ||
120 | ]).then(result => { | 142 | ]).then(result => { |
121 | if (result[0] && result[0].data) { | 143 | if (result[0] && result[0].data) { |
122 | Object.assign(finalResult, { | 144 | Object.assign(finalResult, { |
@@ -167,6 +189,10 @@ const index = (params) => { | @@ -167,6 +189,10 @@ const index = (params) => { | ||
167 | }); | 189 | }); |
168 | } | 190 | } |
169 | 191 | ||
192 | + if (result[5]) { | ||
193 | + finalResult.content = result[5]; | ||
194 | + } | ||
195 | + | ||
170 | return finalResult; | 196 | return finalResult; |
171 | }); | 197 | }); |
172 | }; | 198 | }; |
@@ -121,6 +121,13 @@ | @@ -121,6 +121,13 @@ | ||
121 | </a> | 121 | </a> |
122 | </div> | 122 | </div> |
123 | 123 | ||
124 | + {{! 资源位}} | ||
125 | + <div class="res-c"> | ||
126 | + <div class="resource-content"> | ||
127 | + {{> content}} | ||
128 | + </div> | ||
129 | + </div> | ||
130 | + | ||
124 | {{!-- | 131 | {{!-- |
125 | <div class="group-list"> | 132 | <div class="group-list"> |
126 | <a class="list-item" href="/home/onlineService"> | 133 | <a class="list-item" href="/home/onlineService"> |
apps/home/views/partial/content.hbs
0 → 100644
1 | +{{#content}} | ||
2 | + {{! 中间banner}} | ||
3 | + {{#if singleImage}} | ||
4 | + <div data-id="{{template_id}}"> | ||
5 | + {{> resources/banner}} | ||
6 | + </div> | ||
7 | + {{/if}} | ||
8 | + {{! 两个小图}} | ||
9 | + {{#if smallPic}} | ||
10 | + {{> resources/thumb-row}} | ||
11 | + {{/if}} | ||
12 | + {{! 分隔楼层}} | ||
13 | + {{#if divideImage}} | ||
14 | + {{> resources/divide-image}} | ||
15 | + {{/if}} | ||
16 | +{{/content}} |
1 | {{#if singleOne}} | 1 | {{#if singleOne}} |
2 | {{#data}} | 2 | {{#data}} |
3 | <div class="banner-list"> | 3 | <div class="banner-list"> |
4 | - <a href="{{url}}"> | 4 | + <a href="{{url}}" id="{{../template_id}}" name="{{../template_intro}}"> |
5 | <img src="{{image2 src w=640 h=200 q=60 mode=3}}" alt=""> | 5 | <img src="{{image2 src w=640 h=200 q=60 mode=3}}" alt=""> |
6 | </a> | 6 | </a> |
7 | </div> | 7 | </div> |
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | <ul class="banner-list swiper-wrapper clearfix"> | 11 | <ul class="banner-list swiper-wrapper clearfix"> |
12 | {{#data}} | 12 | {{#data}} |
13 | <li class="swiper-slide"> | 13 | <li class="swiper-slide"> |
14 | - <a href="{{url}}"> | 14 | + <a href="{{url}}" id="{{../template_id}}" name="{{../template_intro}}"> |
15 | <img src="{{image2 src w=640 h=200 q=60 mode=3}}" alt=""> | 15 | <img src="{{image2 src w=640 h=200 q=60 mode=3}}" alt=""> |
16 | </a> | 16 | </a> |
17 | </li> | 17 | </li> |
1 | <div class="thumb-row"> | 1 | <div class="thumb-row"> |
2 | {{# data}} | 2 | {{# data}} |
3 | - <a href="{{url}}"> | 3 | + <a href="{{url}}" id="{{../template_id}}" name="{{../template_intro}}"> |
4 | <div class="thumb-row-box" style="background-image:url({{image2 src w=275 h=160 q=60}})"></div> | 4 | <div class="thumb-row-box" style="background-image:url({{image2 src w=275 h=160 q=60}})"></div> |
5 | </a> | 5 | </a> |
6 | {{/ data}} | 6 | {{/ data}} |
@@ -12,6 +12,8 @@ var $userAvatar = $('.user-avatar'), | @@ -12,6 +12,8 @@ var $userAvatar = $('.user-avatar'), | ||
12 | var myImage = new Image(), | 12 | var myImage = new Image(), |
13 | avatar; | 13 | avatar; |
14 | 14 | ||
15 | +var Swiper = require('yoho-swiper2'); | ||
16 | + | ||
15 | require('home/index.page.css'); | 17 | require('home/index.page.css'); |
16 | 18 | ||
17 | require('../common'); | 19 | require('../common'); |
@@ -21,6 +23,14 @@ if ($('.recommend-for-you').length) { | @@ -21,6 +23,14 @@ if ($('.recommend-for-you').length) { | ||
21 | require('../common/suspend-cart'); | 23 | require('../common/suspend-cart'); |
22 | require('../common/footer'); | 24 | require('../common/footer'); |
23 | 25 | ||
26 | +new Swiper('.banner-center-swiper', { | ||
27 | + pagination: '.swiper-pagination', | ||
28 | + lazyLoading: true, | ||
29 | + lazyLoadingInPrevNext: true, | ||
30 | + paginationClickable: true, | ||
31 | + autoplay: 3000 | ||
32 | +}); | ||
33 | + | ||
24 | window.reMarginFooter('.footer-tab'); | 34 | window.reMarginFooter('.footer-tab'); |
25 | 35 | ||
26 | // 部分老用户没有头像,显示默认头像 | 36 | // 部分老用户没有头像,显示默认头像 |
@@ -40,3 +50,29 @@ $('.yoho-page').on('touchstart', '.list-item, .type-item, .order-title', functio | @@ -40,3 +50,29 @@ $('.yoho-page').on('touchstart', '.list-item, .type-item, .order-title', functio | ||
40 | }).on('touchend touchcancel', '.list-item, .type-item, .order-title', function() { | 50 | }).on('touchend touchcancel', '.list-item, .type-item, .order-title', function() { |
41 | $(this).removeClass('highlight'); | 51 | $(this).removeClass('highlight'); |
42 | }); | 52 | }); |
53 | + | ||
54 | +// 埋点 | ||
55 | +$('.res-c').on('click', 'a', function() { | ||
56 | + var $this = $(this); | ||
57 | + var index = $this.index() + 1; | ||
58 | + var pIndex = $this.parent('div').index() + 1; | ||
59 | + var url = $this.attr('href'); | ||
60 | + var name = $this.attr('name'); | ||
61 | + var id = $this.attr('id'); | ||
62 | + var status = $this.parent('li').hasClass('swiper-slide'); | ||
63 | + | ||
64 | + if (status) { | ||
65 | + index = $this.parent('li').index() + 1; | ||
66 | + pIndex = 1; | ||
67 | + } | ||
68 | + | ||
69 | + if (window._yas && window._yas.sendCustomInfo) { | ||
70 | + window._yas.sendCustomInfo({ | ||
71 | + I_INDEX: index, | ||
72 | + F_URL: encodeURIComponent(url), | ||
73 | + F_NAME: name, | ||
74 | + F_INDEX: pIndex, | ||
75 | + F_ID: id | ||
76 | + }, true); | ||
77 | + } | ||
78 | +}); |
@@ -2,3 +2,7 @@ | @@ -2,3 +2,7 @@ | ||
2 | @import "product/detail/recommend-for-you"; | 2 | @import "product/detail/recommend-for-you"; |
3 | @import "common/good"; | 3 | @import "common/good"; |
4 | @import "channel/footer-tab"; | 4 | @import "channel/footer-tab"; |
5 | +@import "channel/thumb-row"; | ||
6 | +@import "channel/divide-image"; | ||
7 | +@import "channel/banner-center"; | ||
8 | +@import "layout/swiper"; |
-
Please register or login to post a comment