Authored by yyq

Merge remote-tracking branch 'origin/feature/group-6.9.17' into release/6.9.17

... ... @@ -31,7 +31,15 @@ function goodsTab(req, res, next) {
return res.json({filterList: result.filterGroupList});
}).catch(next);
}
function getResources(req, res, next) {
let query = req.query || {};
req.ctx(GroupService).newIndex(query.code).then(result => {
return res.json({
floors: result
});
}).catch(next);
}
function newIndex(req, res, next) {
req.ctx(GroupService).newGroupIndex().then(result => {
return res.render('group/newIndex', {
... ... @@ -41,7 +49,8 @@ function newIndex(req, res, next) {
nodownload: true,
width750: true,
wechatShare: true,
floors: result.index,
tabfloors: result.index,
floors: result.floors,
tabs: result.tabData,
filterList: result.filterGroupList,
shareInfo: result.shareInfo,
... ... @@ -435,5 +444,6 @@ module.exports = {
searchList,
delOrder,
cancelOrder,
goodsTab
goodsTab,
getResources
};
... ...
... ... @@ -20,12 +20,14 @@ const contentCodes = {
const newContentCodes = {
test: {
homeTab: 'cbdd29c609017c2803d46d99bd17a33a',
home: '7744d415ea1a9da42398b27a1376a879',
ready: '89141506b9926010f28915a82b3db61d',
result: '3c3a94fd6c6e19508b6921acd7f6cbad',
detail: 'cea0efae77f4e04c935beb1e87181247'
},
production: {
homeTab: 'cbdd29c609017c2803d46d99bd17a33a',
home: '7744d415ea1a9da42398b27a1376a879',
ready: '89141506b9926010f28915a82b3db61d',
result: '3c3a94fd6c6e19508b6921acd7f6cbad',
... ... @@ -39,10 +41,10 @@ class GroupService extends global.yoho.BaseModel {
this.api = new GroupApi(ctx);
}
async newIndex() {
async newIndex(content_code) {
try {
const result = await this.api._getResourceCode({
contentCode: newContentCodes.home
contentCode: content_code || newContentCodes.homeTab
});
return result;
... ... @@ -199,6 +201,9 @@ class GroupService extends global.yoho.BaseModel {
let tabCurrentIndex = tabIndex || 0;
result.index = await this.newIndex() || [];
result.shareInfo = await this.getShareInfo({
share_id: 6737
});
let filters = [];
result.index.forEach(item => {
... ... @@ -217,7 +222,9 @@ class GroupService extends global.yoho.BaseModel {
indexFilter.query.forEach(item => {
query = Object.assign(query, item);
});
let code = indexFilter.resources_code;
result.floors = code && await this.newIndex(code);
result.filterGroupList = await this.filterGroupList({
...query
});
... ... @@ -334,6 +341,8 @@ class GroupService extends global.yoho.BaseModel {
val.market_price = val.market_price ? val.market_price.toFixed(2) : '';
val.collagePrice = val.collagePrice ? val.collagePrice.toFixed(2) : '';
val.joinLimitStr = val.join_limit === 1 ? '邀新团' : '普通团';
// eslint-disable-next-line max-len
val.joinPeopleNum = val.joinPeopleNum > 10000 ? (val.joinPeopleNum / 10000).toFixed(1) + '万' : val.joinPeopleNum;
});
}
return finalResult;
... ...
... ... @@ -390,6 +390,7 @@ router.post('/yoluck/detail/mylist.html', swtichYoLuck(yoluck.getActivityCodeLis
router.get('/group', group.newIndex); // 拼团首页
router.get('/group/list', group.groupListIndex); // 拼团列表页
router.get('/group/goods-list', group.groupList); // 拼团列表
router.get('/group/resources', group.getResources); // tab切换获取资源位
router.get('/group/goods-tab', group.goodsTab);
router.get('/group/filter', group.filter); // 首页筛选结果页
router.get('/group/search', group.searchList); // 首页筛选列表
... ...
<div class="group" data-share-img="{{shareInfo.bigImage}}" data-share-title="{{shareInfo.title}}" data-share-content="{{shareInfo.content}}" data-is-App="{{isApp}}">
<div class="resources good-info" id="resources">
{{#each tabfloors}}
{{#ifcond template_name "==" 'guessLike'}}
{{> group/resources/guess-like}}
{{/ifcond}}
{{/each}}
<div class="resources good-info tab-content" id="resources">
<div class="floors">
{{#each floors}}
{{#ifcond template_name "==" 'focus'}}
{{> group/resources/focus}}
{{/ifcond}}
{{#ifcond template_name "==" 'newSingleImage'}}
{{> group/resources/new-single-image}}
{{/ifcond}}
{{#ifcond template_name "==" 'twoPicture'}}
{{> group/resources/two-image}}
{{/ifcond}}
{{#ifcond template_name "==" 'image_list'}}
{{> group/resources/four-image}}
{{/ifcond}}
{{#ifcond template_name "==" 'splitJointImg'}}
{{> group/resources/split-image}}
{{/ifcond}}
{{#ifcond template_name "==" 'collageBuyPrdList'}}
{{> group/resources/collage-buy-prd-list}}
{{/ifcond}}
{{#ifcond template_name "==" 'guessLike'}}
{{> group/resources/guess-like}}
{{/ifcond}}
{{/each}}
{{> group/resources/resources}}
</div>
{{!-- <div id='fixedTab' class="tab-filter" data-group="{{#if tabs.joinLimit}}{{tabs.joinLimit}}{{/if}}">
{{#if tabs.showTab}}
... ... @@ -38,6 +21,7 @@
{{/if}}
{{> group/resources/filter-tab}}
</div> --}}
<div class="goods-list-title">猜你喜欢</div>
<div id="goodsContainer" class="goods-container">
{{#if filterList.length}}
<div class="new-goods-list">
... ...
... ... @@ -8,7 +8,7 @@
<div class="product-image-bg">
<img src="{{image2 defaultImages w=188 h=250 q=60 mode=3}}"></img>
</div>
<div class="product-name">{{brandName}}</div>
{{!-- <div class="product-name">{{brandName}}</div> --}}
<div class='product-price-wrap'>
<span class='product-price'>{{formatCollagePrice}}</span>
<span class='product-market-price'>{{marketPrice}}</span>
... ... @@ -23,8 +23,13 @@
{{#if data.prdList}}
<div class="resource-collage-buy-prd-list-c templates" data-f-name="{{../template_name}}" data-f-id="{{../template_id}}" data-id="{{@index}}" data-prd-list-length="{{data.prdList.length}}" data-prd-speed="{{speed}}">
{{!-- <div class="collage-buy-title">{{../template_intro}}</div> --}}
<div class="collage-buy-title">今日必拼</div>
<div class="collage-buy-header">
<div class="collage-buy-title">今日必拼</div>
<div class="swiper-pagination1"></div>
</div>
<div class="swiper-container1 swiper-container">
<div class="swiper-wrapper">
{{#each data.prdList}}
<div class="swiper-slide swiper-slide-1" data-product-skn="{{productSkn}}"
... ... @@ -32,7 +37,7 @@
<div class="product-image-bg">
<img src="{{image2 defaultImages w=210 h=280 q=60 mode=3}}"></img>
</div>
<div class="product-name">{{productName}}</div>
{{!-- <div class="product-name">{{productName}}</div> --}}
{{#if formatCollagePrice}}
<div class='product-price-wrap'>
<span class='product-people-number'>{{joinPeopleNum}}人团</span>
... ... @@ -47,7 +52,7 @@
</div>
{{/each}}
</div>
<div class="swiper-pagination"></div>
</div>
</div>
{{/if}}
... ...
<div id='fixedTab' class="guess-like templates" data-template-name="{{template_name}}" data-template-id="{{template_id}}" data-id="{{@index}}">
<div id='fixedTab' class="guess-like templates float" data-template-name="{{template_name}}" data-template-id="{{template_id}}" data-id="{{@index}}">
<div class="wapper">
<div class="guess-scroll">
{{#each data}}
{{#ifcond @index '==' 0}}
<div id="tab-{{@index}}" data-template-name="{{../template_name}}" data-tab-name="{{tab_name}}" data-template-id="{{../template_id}}" data-index="{{@index}}" data-index-idx="{{@../index}}" data-item-idx="{{@index}}" class="guess-tab first" data-query="{{queryString}}">
<div id="tab-{{@index}}" data-template-name="{{../template_name}}" data-tab-name="{{tab_name}}" data-template-id="{{../template_id}}" data-index="{{@index}}" data-index-idx="{{@../index}}" data-item-idx="{{@index}}" class="guess-tab first" data-query="{{queryString}}" data-code="{{resources_code}}">
{{#if src}}
<img class="guess-img" src="{{image2 src w=200 h=160 q=60 mode=3}}" />
<div class=""></div>
{{else}}
<span class="guess-like-tab">{{tab_name}}</span>
{{/if}}
</div>
{{^}}
<div id="tab-{{@index}}" data-template-name="{{../template_name}}" data-tab-name="{{tab_name}}" data-template-id="{{../template_id}}" data-index="{{@index}}" data-index-idx="{{@../index}}" data-item-idx="{{@index}}" class="guess-tab" data-query="{{queryString}}">
<div id="tab-{{@index}}" data-template-name="{{../template_name}}" data-tab-name="{{tab_name}}" data-template-id="{{../template_id}}" data-index="{{@index}}" data-index-idx="{{@../index}}" data-item-idx="{{@index}}" class="guess-tab" data-query="{{queryString}}" data-code="{{resources_code}}">
{{#if src}}
<img class="guess-img" src="{{image2 src w=200 h=160 q=60 mode=3}}" />
<div></div>
{{else}}
<span class="guess-like-tab">{{tab_name}}</span>
{{/if}}
</div>
{{/ifcond}}
{{/each}}
... ...
<div class="new-index-filter-list-item" data-item-idx="{{@index}}" data-activity-id="{{activity_id}}" data-product-skn="{{product_skn}}">
<div class="group-product-header">
{{#ifcond joinLimitStr "==" "邀新团"}}
{{!-- {{#ifcond joinLimitStr "==" "邀新团"}}
<div class="new-group-product-left-icon">
<span class="new-group-product-left-icon-number"></span>
</div>
{{/ifcond}}
{{/ifcond}} --}}
{{#if icon}}
<img src="{{icon}}" class="list-bg-icon" alt="list_icon">
{{/if}}
{{#if @root.lazyLoad}}
<img class="lazy new-group-product-image" data-original="{{image2 default_images w=400 h=390 q=60 mode=3}}" />
{{else}}
... ... @@ -15,7 +18,10 @@
<div class="new-group-product-name">{{product_name}}</div>
<div class="new-group-price">
<div class="group-free-number">
<div class="new-group-free-post"></div>
{{#ifcond joinLimitStr "==" "邀新团"}}
<div class="new-group-invite">邀新团</div>
{{/ifcond}}
{{!-- <div class="new-group-free-post1">包邮</div> --}}
<div class="new-group-number forcefontsize10">已拼{{joinPeopleNum}}</div>
</div>
<div class="new-group-prict-bg">
... ...
{{#each floors}}
{{#ifcond template_name "==" 'focus'}}
{{> group/resources/focus}}
{{/ifcond}}
{{#ifcond template_name "==" 'newSingleImage'}}
{{> group/resources/new-single-image}}
{{/ifcond}}
{{#ifcond template_name "==" 'twoPicture'}}
{{> group/resources/two-image}}
{{/ifcond}}
{{#ifcond template_name "==" 'image_list'}}
{{> group/resources/four-image}}
{{/ifcond}}
{{#ifcond template_name "==" 'splitJointImg'}}
{{> group/resources/split-image}}
{{/ifcond}}
{{#ifcond template_name "==" 'collageBuyPrdList'}}
{{> group/resources/collage-buy-prd-list}}
{{/ifcond}}
{{#ifcond template_name "==" 'guessLike'}}
{{> group/resources/guess-like}}
{{/ifcond}}
{{/each}}
... ...
<div class="new-index-filter-list-item" data-item-idx="{{@index}}" data-activity-id="{{activity_id}}" data-product-skn="{{product_skn}}">
<div class="group-product-header">
{{#ifcond joinLimitStr "==" "邀新团"}}
<div class="new-group-product-left-icon">
<span class="new-group-product-left-icon-number"></span>
</div>
{{/ifcond}}
{{!-- {{#ifcond joinLimitStr "==" "邀新团"}}
<div class="new-group-product-left-icon">
<span class="new-group-product-left-icon-number"></span>
</div>
{{/ifcond}} --}}
{{#if cover_info}}
<img src="{{cover_info.list_bg_img}}" class="list-bg-icon" alt="list_icon">
{{/if}}
{{#if @root.lazyLoad}}
<img class="lazy new-group-product-image" data-original="{{image2 default_images w=400 h=390 q=60 mode=3}}" />
{{else}}
... ... @@ -15,7 +18,10 @@
<div class="new-group-product-name">{{product_name}}</div>
<div class="new-group-price">
<div class="group-free-number">
<div class="new-group-free-post"></div>
{{#ifcond joinLimitStr "==" "邀新团"}}
<div class="new-group-invite">邀新团</div>
{{/ifcond}}
{{!-- <div class="new-group-free-post1">包邮</div> --}}
<div class="new-group-number forcefontsize10">已拼{{joinPeopleNum}}</div>
</div>
<div class="new-group-prict-bg">
... ...
{{#each floors}}
{{#ifcond template_name "==" 'focus'}}
{{> ../../../../apps/activity/views/partial/group/resources/focus}}
{{/ifcond}}
{{#ifcond template_name "==" 'newSingleImage'}}
{{> ../../../../apps/activity/views/partial/group/resources/new-single-image}}
{{/ifcond}}
{{#ifcond template_name "==" 'twoPicture'}}
{{> ../../../../apps/activity/views/partial/group/resources/two-image}}
{{/ifcond}}
{{#ifcond template_name "==" 'image_list'}}
{{> ../../../../apps/activity/views/partial/group/resources/four-image}}
{{/ifcond}}
{{#ifcond template_name "==" 'splitJointImg'}}
{{> ../../../../apps/activity/views/partial/group/resources/split-image}}
{{/ifcond}}
{{#ifcond template_name "==" 'collageBuyPrdList'}}
{{> ../../../../apps/activity/views/partial/group/resources/collage-buy-prd-list}}
{{/ifcond}}
{{#ifcond template_name "==" 'guessLike'}}
{{> ../../../../apps/activity/views/partial/group/resources/guess-like}}
{{/ifcond}}
{{/each}}
... ...

4.78 KB | W: | H:

3.39 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
... ... @@ -9,6 +9,7 @@ import innerScroll from 'js/plugin/inner-scroll';
import sharePlugin from 'js/common/share';
const querystring = require('querystring');
let groupListItem = require('hbs/activity/group/group-list-product.hbs');
let resources = require('hbs/activity/group/resources.hbs');
const yoho = require('js/yoho-app');
class Group extends Page {
... ... @@ -106,7 +107,7 @@ class Group extends Page {
$(window).scroll(() => {
window.requestAnimationFrame(() => {
self.scrollHandler();
// self.scrollHandler();
});
setTimeout(() => {
let afterScroll = window.scrollY;
... ... @@ -261,9 +262,11 @@ class Group extends Page {
}
}
guessLikeTabChange(e) {
async guessLikeTabChange(e) {
let that = this;
let $this = $(e.currentTarget);
let query = $this.data('query');
let code = $this.data('code');
let index = $this.data('index');
let tabName = $this.data('tab-name');
let templateName = $this.data('template-name');
... ... @@ -298,26 +301,33 @@ class Group extends Page {
let lastDom = document.getElementById(`tab-${index - 2}`);
$('.wapper').animate({scrollLeft: lastDom && lastDom.offsetLeft || 0});
if (document.getElementById('fixedTab').offsetTop) {
this.scrollSmoothTo(document.getElementById('fixedTab').offsetTop);
this.scrollSmoothTo(document.getElementById('resources').offsetTop);
// if (document.getElementById('fixedTab').offsetTop) {
// this.scrollSmoothTo(document.getElementById('fixedTab').offsetTop);
// } else {
// this.scrollSmoothTo(document.getElementById('goodsContainer').offsetTop);
// }
if (code) {
this.fetchResources({
code: code
}).then(res => {
that.renderFloor(res);
$('.guess-tab').children('div').removeClass('guess-tab-active');
$this.children('div').addClass('guess-tab-active');
$('.guess-tab').children('.guess-like-tab').removeClass('guess-like-tab-active');
$this.children('.guess-like-tab').addClass('guess-like-tab-active');
});
} else {
this.scrollSmoothTo(document.getElementById('goodsContainer').offsetTop);
$('.floors').html('');
}
$.ajax({
type: 'GET',
url: '/activity/group/goods-tab',
data: queryObject,
success: (data) => {
// $('.filter-mask').remove();
// $('.group').append(data);
// $('.guess-scroll').find('')
$('.guess-tab').children('div').removeClass('guess-tab-active');
$this.children('div').addClass('guess-tab-active');
this.renderMoreData(data.filterList || []);
}
this.fetchGoodsList(queryObject).then(data => {
that.renderMoreData(data.filterList || []);
});
}
scrollSmoothTo(position) {
... ... @@ -376,6 +386,7 @@ class Group extends Page {
}
loadMoreData() {
let that = this;
let newNavType = this.judgeNavType(this.newFilterTab);
let newNav = this.newNavInfo[newNavType];
... ... @@ -388,17 +399,41 @@ class Group extends Page {
newNav.end = true;
$.ajax({
type: 'GET',
url: '/activity/group/goods-tab',
data: newQueryObject,
success: (data) => {
this.renderMoreData(data.filterList || [], true);
newNav.end = false;
},
error: () => {
newNav.end = false;
}
this.fetchGoodsList(newQueryObject).then(data => {
that.renderMoreData(data.filterList || [], true);
newNav.end = false;
}).catch(() => {
newNav.end = false;
});
}
fetchResources(query) {
return new Promise((resolve, reject) => {
$.ajax({
type: 'GET',
url: '/activity/group/resources',
data: query,
success: (data) => {
resolve(data);
},
error: () => {
reject();
}
});
});
}
fetchGoodsList(query) {
return new Promise((resolve, reject) => {
$.ajax({
type: 'GET',
url: '/activity/group/goods-tab',
data: query,
success: (data) => {
resolve(data);
},
error: () => {
reject();
}
});
});
}
... ... @@ -526,7 +561,8 @@ class Group extends Page {
slidesPerGroup: 3,
autoplay: speed,
autoplayDisableOnInteraction: false,
pagination: '.swiper-pagination',
pagination: '.swiper-pagination1',
paginationType: 'fraction',
paginationClickable: true,
loop: true
});
... ... @@ -692,7 +728,13 @@ class Group extends Page {
lazyLoad(groupListContent.find('img.lazy'));
}
}
renderFloor(data) {
let resourceHtml = resources(data);
$('.floors').html(resourceHtml);
this.swiperTop();
this.swiperGroup();
}
renderMoreData(list, isLoad) {
let appendHtml = '';
... ... @@ -709,6 +751,7 @@ class Group extends Page {
// 筛选初始化
filterInit() {
$('.guess-scroll').find('div:first-child').children('div').addClass('guess-tab-active');
$('.guess-scroll').find('div:first-child').children('.guess-like-tab').addClass('guess-like-tab-active');
let first = $('.guess-scroll').find('div:first-child');
this.tabName = first.data('tab-name');
... ...
... ... @@ -4,26 +4,29 @@
.swiper-pagination {
position: absolute;
left: 0;
right: 0;
left: 50%;
transform: translateX(-50%);
bottom: 20px;
text-align: center;
z-index: 1;
.pagination-inner {
display: inline-block;
padding: 0 8px 4px;
display: flex;
padding: 5px;
background: rgba(0, 0, 0, 0.2);
border-radius: 50px;
line-height: 1.2;
height: 20px;
box-sizing: border-box;
justify-content: center;
align-items: center;
span {
display: inline-block;
width: 14px;
height: 14px;
width: 10px;
height: 10px;
background: #fff;
opacity: 0.5;
margin: 0 9px;
margin: 0 6px;
border-radius: 50%;
&.swiper-pagination-bullet-active {
... ...
.resource-collage-buy-prd-list-c {
margin-left: 20px;
margin-right: 20px;
margin-top: 20px;
margin-bottom: 10px;
margin: 20px;
background: white;
border-radius: 10px;
.collage-buy-header {
padding: 20px 20px 0;
display: flex;
justify-content: space-between;
align-items: center;
}
.collage-buy-title {
font-family: PingFang-SC-Semibold, sans-serif;
font-size: 32px;
color: #444;
padding-top: 20px;
padding-left: 20px;
// padding-top: 20px;
// padding-left: 20px;
}
.swiper-pagination-fraction {
.swiper-pagination-current {
color: #444;
font-size: 32px;
}
.swiper-pagination-total {
color: #444;
font-size: 24px;
}
}
.swiper-container1 {
margin-left: 20px;
margin-right: 20px;
padding-top: 20px;
padding-bottom: 60px;
padding: 20px 0;
}
.swiper-slide-1 {
... ... @@ -109,6 +124,7 @@
width: 188px;
overflow: hidden;
height: 250px;
margin-bottom: 20px;
}
.product-name {
... ...
.guess-like {
overflow: hidden;
height: 80px;
height: 88px;
box-sizing: initial;
.wapper {
... ... @@ -42,6 +42,19 @@
background-color: #444;
}
.guess-like-tab {
width: 160px;
line-height: 88px;
text-align: center;
font-size: 28px;
color: #b0b0b0;
}
.guess-like-tab-active {
font-size: 32px;
color: #222;
}
.wapper::-webkit-scrollbar {
width: 0 !important;
display: none;
... ... @@ -54,5 +67,5 @@
left: 0;
right: 0;
z-index: 998;
background-color: #f0f0f0;
background-color: #fff;
}
... ...
... ... @@ -508,7 +508,7 @@
.block-list,
.num {
position: relative;
padding-left: 80px;
// padding-left: 80px;
font-size: 28px;
overflow: hidden;
... ... @@ -521,9 +521,12 @@
}
> span {
position: absolute;
top: 10px;
left: 0;
float: left;
line-height: 60px;
margin-right: 20px;
// position: absolute;
// top: 10px;
// left: 0;
}
> span.left-num {
... ...
... ... @@ -17,6 +17,10 @@
margin-bottom: 90px;
}
.tab-content {
padding-top: 80px;
}
.bottom {
position: fixed;
right: 0;
... ...
... ... @@ -2,10 +2,21 @@
background: #f0f0f0;
}
.goods-list-title {
height: 80px;
line-height: 80px;
text-align: center;
font-size: 32px;
color: #444;
letter-spacing: 1px;
background-color: #f0f0f0;
}
.new-goods-list {
display: flex;
flex-direction: column;
margin: 0 20px;
padding: 10px 0;
}
.new-index-filter-list-item:first-child {
... ... @@ -55,9 +66,22 @@
-webkit-box-orient: vertical;
}
.new-group-invite,
.new-group-free-post1 {
padding: 0 10px;
height: 30px;
font-size: 18px;
color: #fff;
background-color: #ff575c;
text-align: center;
line-height: 30px;
border-radius: 30px;
margin-right: 10px;
}
.new-group-free-post {
width: 60px;
height: 38px;
width: 80px;
height: 30px;
background: url("img/activity/group/group/new-free-post@3x.png") no-repeat;
background-size: contain;
margin-right: 10px;
... ... @@ -162,4 +186,11 @@
margin-left: 12px;
margin-top: 5px;
}
.list-bg-icon {
position: absolute;
top: 40px;
left: 30px;
height: 26px;
}
}
... ...