Authored by 陈峰

Merge branch 'release/318' into 'master'

Release/318



See merge request !1722
... ... @@ -42,7 +42,8 @@ function groupListIndex(req, res, next) {
activityData: result.groupList,
resource: result.readyListResource,
shareInfo: result.shareInfo,
showType: result.showType
showType: result.showType,
unionType: result.unionType
});
}).catch(next);
}
... ... @@ -148,12 +149,16 @@ function goodsDetail(req, res, next) {
navBtn: false
});
let param = req.query;
let uid = 0;
if (typeof req.user.uid !== 'undefined') {
uid = req.user.uid;
}
req.ctx(GroupService).goodsDetail({
activityId: param.activityId,
productSkn: param.productSkn,
groupNo: param.groupNo
}).then((result) => {
}, uid).then((result) => {
if (_.isEmpty(result)) {
return next();
}
... ... @@ -165,6 +170,9 @@ function goodsDetail(req, res, next) {
finalResult.support = result.support;
finalResult.floor = result.floor;
finalResult.storage_sum = result.storage_sum;
if (uid !== 0) {
finalResult.unionType = result.unionType;
}
if (param.groupNo) {
finalResult.groupNo = param.groupNo;
}
... ...
... ... @@ -53,7 +53,9 @@ class GroupService extends global.yoho.BaseModel {
uid
} = {}) {
try {
let [detail, recommend, banner] = await Promise.all([
let unionType = '';
let [unionTypeResult, detail, recommend, banner] = await Promise.all([
this.getUnionType(uid),
this.api.groupDetail({
uid,
groupNo
... ... @@ -89,10 +91,15 @@ class GroupService extends global.yoho.BaseModel {
});
}
if (unionTypeResult.unionType) {
unionType = unionTypeResult.unionType;
}
return {
...detail,
recommend,
bannerResource: banner
bannerResource: banner,
unionType
};
} catch (e) {
... ... @@ -164,6 +171,9 @@ class GroupService extends global.yoho.BaseModel {
// 登录后获取分享信息
if (uid !== 0) {
// let share_id = await this.getShareId(uid);
let unionType = await this.getUnionType(uid);
result.unionType = unionType;
let share_id = isProd ? 5409 : 1124; // 线上:5409 ;测试:1124;
result.shareInfo = await this.getShareInfo({
... ... @@ -171,9 +181,23 @@ class GroupService extends global.yoho.BaseModel {
});
} else {
result.shareInfo = '';
result.unionType = '';
}
return result;
}
async getUnionType(uid) {
try {
const result = await this.api._getShareId({
uid
});
return result.unionType || '';
} catch (e) {
throw new Error('can not get shareId.');
}
}
async getShareId(uid) {
try {
const result = await this.api._getShareId({
... ... @@ -185,6 +209,7 @@ class GroupService extends global.yoho.BaseModel {
throw new Error('can not get shareId.');
}
}
async tabData() {
const result = await this.api._getPromoteCount();
let tabsData = {};
... ... @@ -282,9 +307,14 @@ class GroupService extends global.yoho.BaseModel {
throw new Error('get shareInfo failed.');
}
}
async goodsDetail(params) {
async goodsDetail(params, uid) {
let result = await this.api.getProductData(params);
if (uid !== 0) {
let unionType = await this.getUnionType(uid);
result.unionType = unionType;
}
if (result.shop_id) {
result.storeUrl = `/shop/${_.get(result, 'brand_info.brand_domain')}-${_.get(result, 'shop_id')}.html`;
}
... ...
... ... @@ -115,7 +115,7 @@
<div class="product-container single-item3 {{#isEqualOr position '1'}}right{{^}}left{{/isEqualOr}} shop-wrapper">
<a class="shop-container" href="{{jumpUrl}}" target="_blank">
<div class="feature-shop-info">
<image class="lazy" data-original="{{image2 shopBgImage w=213 h=224 q=80}}"></image>
<image src="{{image2 shopBgImage w=213 h=224 q=80}}"></image>
</div>
</a>
</div>
... ...
... ... @@ -191,7 +191,7 @@
</div>
{{/if}}
</div>
<div class='my-share' id="share">
<div class='my-share' id="share" data-union-type="{{unionType}}">
<img src='//img13.static.yhbimg.com/brandBanner/2019/02/22/11/02b5bf3e1e3e3b66c15b7315bb96277609.png'>
</div>
{{#if introUrl}}
... ...
<div class="container" data-share-img="{{shareInfo.bigImage}}" data-share-title="{{shareInfo.title}}" data-share-content="{{shareInfo.content}}">
<div class="container" data-share-img="{{shareInfo.bigImage}}" data-share-title="{{shareInfo.title}}" data-share-content="{{shareInfo.content}}" data-union-type="{{unionType}}">
{{#if activityData.banner}}
<a href="{{activityData.banner.imageUrl}}" class="img-wrapper">
... ...
... ... @@ -7,7 +7,8 @@
data-product-skn="{{yourJoinItem.productSkn}}"
data-product-name="{{yourJoinItem.productName}}"
data-group-price="{{yourJoinItem.productGroupPrice}}"
data-share-img="{{image2 yourJoinItem.productIcon w=200 h=282}}">
data-share-img="{{image2 yourJoinItem.productIcon w=200 h=282}}"
data-union-type="{{unionType}}">
<div class="card">
<div class="inner-card go-join" data-product-skn="{{yourJoinItem.productSkn}}"
data-activity-id="{{activityId}}" data-group-no="{{groupNo}}" data-page-go="{{pageGo}}">
... ...
... ... @@ -51,7 +51,7 @@
</div>
{{/isEqualOr}}
</div>
<img class="brand-img lazy" data-original="{{image2 brandImg q=85}}">
<img class="brand-img" src="{{image2 brandImg q=85}}">
</a>
{{/if}}
</div>
... ...
... ... @@ -14,6 +14,7 @@ const isTest = process.env.NODE_ENV === 'test3' || process.env.NODE_ENV === 'tes
const domains = {
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
// yoLuck: 'https://action.yoho.cn',
... ...
{
"name": "yohobuywap-node",
"version": "6.8.80-7",
"version": "6.8.89",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -329,8 +329,6 @@ function getShopProductLinks() {
let shopId = $(this).data('shopid');
let id = $(this)[0].id;
console.log(id, shopId);
if (shopId && id) {
shopArr.ids.push(id);
shopArr.shopIds.push(shopId);
... ... @@ -352,7 +350,6 @@ function getShopProductLinks() {
if (index >= 0) {
let divId = shopArr.ids[index];
let shopUrl = `//m.yohobuy.com/product/index/brand?shop_id=${shopInfo.shops_id}&openby:yohobuy={"action":"go.shop","params":{"shop_id":"${shopInfo.shops_id}","shop_template_type":"${shopInfo.shop_template_type}","shop_name":"${shopInfo.shop_name}"${is_red_shop}}}`;// eslint-disable-line
console.log(shopUrl);
$('#' + divId).find('.shop-wrapper a').attr('href', shopUrl);
}
}
... ... @@ -926,57 +923,6 @@ function activityPlan() {
}
}
// 单独改变未完成的楼层的高度
function changeShopAndProductHeightSingle(parent, className) {
let img = $(parent).find('.' + className);
if (img[0] && !img.hasClass('completed')) {
// console.log(img[0].src, /(\.jpg|\.png)/.test(img[0].src));
if (/(\.jpg|\.png)/.test(img[0].src)) {
let image = new Image();
image.src = img[0].src;
image.onload = function() {
img.removeClass(className);
img.addClass('completed');
let height = $(parent).find('.product-wrapper .feature-product-info').height();
$(parent).find('.shop-wrapper .feature-shop-info').height(height);
};
} else {
setTimeout(changeShopAndProductHeightSingle, 300, parent, className);
}
}
}
// 改变店铺+商品组中店铺的高度
function changeShopAndProductHeight() {
$('.shop-product-container').each(function() {
let img = $(this).find('.product-detail-img').eq(0);
let that = this;
if (img[0] && !img.hasClass('completed')) {
// console.log(img[0].src, /(\.jpg|\.png)/.test(img[0].src));
if (/(\.jpg|\.png)/.test(img[0].src)) {
let image = new Image();
image.src = img[0].src;
image.onload = function() {
img.addClass('completed');
let height = $(that).find('.product-wrapper .feature-product-info').height();
$(that).find('.shop-wrapper .feature-shop-info').height(height);
};
} else {
let className = 'no-completed-' + Math.random().toString(16).substr(2, 8);
img.addClass(className);
setTimeout(changeShopAndProductHeightSingle, 300, that, className);
}
}
});
}
$(function() {
if ($('.over').length) {
// 过期/删除 状态的 活动
... ... @@ -1041,8 +987,6 @@ $(function() {
// 定时计划
activityPlan();
changeShopAndProductHeight();
getShopProductLinks();
// 小程序相关处理
... ...
... ... @@ -33,7 +33,7 @@ function hiddenTips($ele) {
}
}
function getUser(title, name, imgUrl, activityId, productSkn, groupNo) {
function getUser(title, name, imgUrl, activityId, productSkn, groupNo, unionType) {
try {
if (user) {
return Promise.resolve();
... ... @@ -41,7 +41,7 @@ function getUser(title, name, imgUrl, activityId, productSkn, groupNo) {
return yoSdk.getUser().then(u => {
user = u;
shareData = makeShareData({title, name, imgUrl, activityId, productSkn, groupNo});
shareData = makeShareData({title, name, imgUrl, activityId, productSkn, groupNo, unionType});
sharePlugin(shareData.h5);
});
... ... @@ -95,7 +95,8 @@ class Detail extends Page {
$hours: $('#hours'),
$minutes: $('#minutes'),
$seconds: $('#seconds'),
$label: $('#label')
$label: $('#label'),
$share: $('#share')
};
this.getIntro();
this.goSwiper();
... ... @@ -285,6 +286,7 @@ class Detail extends Page {
let imgUrl = 'http://static.yohobuy.com/m/v1/img/touch/apple-touch-icon-144x144-precomposed-new.png';
let buynow = document.getElementById('buynow');
let formatCollagePrice = document.getElementById('collagePrice').value;
let unionType = this.selector.$share.data('union-type');
this.getProductData(productSkn);
if (buynow) {
... ... @@ -293,7 +295,7 @@ class Detail extends Page {
let title = `【包邮】${formatCollagePrice}${goodsName}`;
getUser(title, goodsName, imgUrl, activityId, productSkn, groupNo).then(() => {
getUser(title, goodsName, imgUrl, activityId, productSkn, groupNo, unionType).then(() => {
shareDom.onclick = function() {
if (/QQ/i.test(navigator.userAgent) || /MicroMessenger/i.test(navigator.userAgent)) {
dialog.showDialog({hasClass: 'group-guide-mask'});
... ...
... ... @@ -22,7 +22,8 @@ class ProductList extends Page {
};
this.shareData = {
shareImgUrl: this.selector.$pageContainer.data('share-img'),
shareTitle: this.selector.$pageContainer.data('share-title')
shareTitle: this.selector.$pageContainer.data('share-title'),
unionType: this.selector.$pageContainer.data('union-type')
};
this.firstScreen = this.selector.$goodsContainer.children().size() > 0;
if (!this.firstScreen) {
... ... @@ -61,6 +62,10 @@ class ProductList extends Page {
let [link, paramsStr] = location.href.split('?');
let params = querystring.parse(paramsStr);
if (shareData.unionType) {
params.union_type = shareData.unionType;
}
delete params['openby:yohobuy'];
paramsStr = querystring.stringify(params);
link = link + (paramsStr ? '?' + paramsStr : '');
... ...
... ... @@ -71,6 +71,7 @@ class GroupProgress extends Page {
let productSkn = this.selector.$page.data('product-skn');
let groupPrice = this.selector.$page.data('group-price');
let shareImgUrl = this.selector.$page.data('share-img');
let unionType = this.selector.$page.data('union-type');
this.data.groupNo = groupNo;
this.data.lackNum = lackNum;
... ... @@ -79,6 +80,7 @@ class GroupProgress extends Page {
this.data.groupPrice = groupPrice;
this.data.activityId = activityId;
this.data.shareImgUrl = shareImgUrl;
this.data.unionType = unionType;
this.getProductData(productSkn);
}
... ... @@ -93,8 +95,12 @@ class GroupProgress extends Page {
let _this = this;
let link = '';
let [domain] = location.href.split('?');
let unionType = this.data.unionType;
link = `${domain}?activityId=${this.data.activityId}&groupNo=${this.data.groupNo}`;
if (this.data.unionType) {
link = link + `&union_type=${unionType}`;
}
sharePlugin({
title: `【还差${_this.data.lackNum}人】${_this.data.groupPrice} ${_this.data.productName}`,
imgUrl: 'http://static.yohobuy.com/m/v1/img/touch/apple-touch-icon-144x144-precomposed-new.png',
... ...
function h5Path(activityId, productSkn, groupNo) {
function h5Path(activityId, productSkn, groupNo, unionType) {
let params = `${activityId}&productSkn=${productSkn}&groupNo=${groupNo || ''}`;
if (unionType) {
params = params + `&union_type=${unionType}`;
}
return location.protocol + '//m.yohobuy.com/activity/group/detail?activityId=' +
`${activityId}&productSkn=${productSkn}&groupNo=${groupNo || ''}`;
params;
}
function shareData({title, name, imgUrl, activityId, productSkn, groupNo}) {
let link = h5Path(activityId, productSkn, groupNo);
function shareData({title, name, imgUrl, activityId, productSkn, groupNo, unionType}) {
let link = h5Path(activityId, productSkn, groupNo, unionType);
let urls = imgUrl.split('?');
let shareImg = urls[0] || imgUrl;
... ...
... ... @@ -386,29 +386,36 @@
.feature-shop-info {
height: 100%;
margin: 0 !important;
overflow: hidden;
}
}
&.left .shop-wrapper {
margin-top: 10px;
position: absolute;
padding-top: 10px;
padding-bottom: 10px;
}
&.left .product-wrapper {
padding-left: 222px;
.product-source .feature-product-info:nth-child(n+4) {
display: none;
}
}
&.right .shop-wrapper {
position: absolute;
overflow: hidden;
padding-top: 10px;
margin-left: 0 !important;
margin-right: 10px;
right: 10px;
}
&.right .product-wrapper {
overflow: hidden;
padding: 0;
padding-right: 220px;
margin-left: 20px;
.product-source .feature-product-info:nth-child(n+4) {
... ...