Authored by hongyong.zhao

Merge branch 'hotfix/fix-timeplan-share' into 'master'

Hotfix/修复定时模板分享领券错误



See merge request !6
... ... @@ -136,7 +136,6 @@ exports.webShareCouponSend = (req, res, next) => {
data: ''
};
if (req.yoho.isApp || app.client_type === 'miniapp') {
if (app.app_version && app.client_type && app.session_key && app.uid) {
// 小程序调接口获取 session 的方式不同,H5 嵌小程序,client_type 标记为 h5
... ...
... ... @@ -541,6 +541,30 @@ class featureModel extends global.yoho.BaseModel {
});
}
/**
* 领取活动模板分享的优惠券
* @param activityId
* @param templateId
* @param uid
*/
couponSendWebShare(activityId, templateId, uid) {
let data = {
method: 'app.coupons.sendNewUserShareCoupon',
uid: uid,
activityId: activityId,
templateId: templateId
};
return this.get({data}).then(result => {
if (!result) {
result.code = 404;
result.message = '出错啦~';
}
return result;
});
}
getProductBySkns(skns) {
let obj = {defaultSkns: skns};
... ...
... ... @@ -262,5 +262,6 @@
{{/content.floors}}
<input type="hidden" value="{{content.atlBo}}" class="activity-plan">
<input type="hidden" value="{{content.templateId}}" class="template-id">
<input type="hidden" value="{{content.id}}" class="activity-id">
{{/unless}}
</div>
... ...
... ... @@ -45,7 +45,7 @@
<a class="new-brand-name {{#isEqualOr conf.showBrandUrl
'1'}}product-brand{{else}}product-detail{{/isEqualOr}}"
style="position: relative; background-color: unset;padding-bottom: 0;padding-top:0;display: flex;align-items: center;" href="{{brandurl}}">
<div class="brand-name add-padding5"
<div class="brand-name add-padding5"
style="position: absolute;{{#if conf.fontColor}}color:{{conf.fontColor}};{{/if}}padding-left: 0.3rem;" >{{brandname}}</div>
... ...
{
"name": "yohobuywap-node-activity",
"version": "6.9.8-5",
"version": "6.9.9-5",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ... @@ -134,7 +134,7 @@
"workbox-sw": "^2.1.2",
"workbox-webpack-plugin": "^3.4.1",
"yo-cli": "=2.1.9",
"yoho-activity-sdk": "1.1.3",
"yoho-activity-sdk": "^1.1.5",
"yoho-cookie": "^1.2.0",
"yoho-fastclick": "^1.0.6",
"yoho-hammer": "^2.0.8",
... ...
... ... @@ -8,7 +8,7 @@ const cookie = require('yoho-cookie');
const shopTmpl = require('hbs/activity/feature/shop-group.hbs');
const seckillTabTpl = require('hbs/activity/feature/seckill-tab.hbs');
const seckillProductTpl = require('hbs/activity/feature/seckill-product.hbs');
const yo_sdk = require('yoho-activity-sdk');
const yo_sdk = require('./feature/yo-sdk');
require('scss/feature.scss');
... ... @@ -111,11 +111,12 @@ function getParams() { // 获取登录相关信息
function getCoupon() { // 分享成功后领券
if (parseInt(app_info.uid, 10)) {
let activityInfo = JSON.parse($('.activity-plan').val());
let activityId = JSON.parse($('.activity-id').val());
let templateId = JSON.parse($('.template-id').val());
let data = {
activityId: activityInfo[0].activityId,
templateId: activityInfo[0].templateId,
activityId: activityId,
templateId: templateId,
app: app_info
};
... ... @@ -237,10 +238,6 @@ function initWxShare(data) {
});
}
}
// yo_sdk.wxShare(shareData);
}
function initWebShareButtons(env = '') { // 初始化分享按钮事件
... ... @@ -404,6 +401,7 @@ function ceXuanFuInit() {
$('#sidebar').load(href + pageid + '.html', function() {
$('.sidebar-img').click(function() {
$('.sidebar').show();
$('.sidebar').show();
});
$('.sidebar').click(function(e) {
var $cur = $(e.target);
... ...
/**
* Created by qiujun on 2019/7/19.
*/
/* global wx */
let enviroment = '';
let parseUrl = function(url) {
let query = {},
hashs,
hash,
i;
url = (url || '').split('?');
hashs = (url[1] || '').split('&');
if (hashs && hashs.length) {
for (i = 0; i < hashs.length; i++) {
hash = hashs[i].split('=');
query[hash[0]] = hash[1];
}
}
return {
path: url[0],
query: query
};
};
let createLinkButton = function(url, id) {
let a = document.createElement('a');
a.style.position = 'fixed';
a.style.top = 0;
a.style.left = 0;
a.style.border = 'none';
a.style.outline = 'none';
a.style.resize = 'none';
a.style.background = 'transparent';
a.style.color = 'transparent';
a.setAttribute('id', id);
a.setAttribute('href', url);
document.body.appendChild(a);
return a;
};
let env = function() {
let envFlag = window.__wxjs_environment;
if (!envFlag && navigator.userAgent.match(/yohobuy/i)) {
enviroment = 'app';
document.addEventListener('deviceready', function() {
});
} else if ((!envFlag && navigator.userAgent.match(/miniProgram/i)) || (envFlag === 'miniprogram')) {
enviroment = 'miniprogram';
} else if (location.origin === 'https://www.yohobuy.com') {
enviroment = 'pc';
} else {
enviroment = 'h5';
}
return enviroment;
};
let loginUrl = function() {
let url, refer = location.href;
enviroment = env();
if (enviroment === 'app') {
url = 'http://m.yohobuy.com/signin.html?refer=' + encodeURIComponent(refer);
refer = parseUrl(refer);
if (/Android/i.test(navigator.userAgent || '')) {
if (url.indexOf('?') < 0) {
url += '?appLogin=1';
}
if (location.href.indexOf('&openby') >= 0) {
url = url.substring(0, url.indexOf('&openby'));
}
url += '&';
} else {
if (location.href.indexOf('#openby') >= 0) {
url = url.substring(0, url.indexOf('#openby'));
}
url += '#';
}
url += 'openby:yohobuy=' + JSON.stringify({
action: 'go.weblogin',
params: {
priority: 'N',
jumpurl: {
url: refer.path,
param: refer.query
},
needlogout: 'Y'
}
});
} else if (enviroment === 'pc') {
url = 'https://www.yoho/signin.html?refer=' + encodeURIComponent(location.href);
} else if (enviroment === 'miniprogram') {
url = '/pages/userCenter/userCenter';
} else {
if (refer.indexOf('?') < 0) {
refer += '?skcall=1';
} else {
refer += '&skcall=1';
}
url = 'http://m.yohobuy.com/signin.html?refer=' + encodeURIComponent(refer);
}
return url;
};
let Login = function(obj) {
let _this = this;
_this.env = obj.env;
_this.url = obj.loginUrl;
_this.goLogin = function(url) {
url = url || _this.url;
if (_this.env === 'miniprogram') {
wx.miniProgram.switchTab({url: url});
} else if (_this.env === 'app') {
let loginButton = document.getElementById('yosdk-login');
if (!loginButton) {
loginButton = createLinkButton(url, 'yosdk-login');
}
loginButton.click();
} else {
window.location.href = url;
}
return false;
};
_this.auth = function(nodeList, user) {
if (!user.uid) {
[].forEach.call(nodeList, function(value) {
value.onclick = function(event) {
event.preventDefault();
_this.goLogin();
};
});
return true;
}
};
};
let login = new Login({loginUrl: loginUrl(), env: env()});
module.exports = {
goLogin: login.goLogin.bind(login)
};
... ...
... ... @@ -11056,9 +11056,10 @@ yo-cli@=2.1.9:
webpack-merge "^4.1.1"
yargs "^10.0.3"
yoho-activity-sdk@1.1.3:
version "1.1.3"
resolved "http://npm.yohops.com/yoho-activity-sdk/-/yoho-activity-sdk-1.1.3.tgz#14a8a952e1fd68cc7c167f1e6336d67262d55ba6"
yoho-activity-sdk@^1.1.5:
version "1.1.5"
resolved "http://npm.yohops.com/yoho-activity-sdk/-/yoho-activity-sdk-1.1.5.tgz#5ba73406bb87bca49878dc60ff3095bb1b8d7e9d"
integrity sha512-V3hbtEJLlckOfFxoFfc+L3MqwZml1hSzh8564gTxP6G6265Q8gCekZh1OCDrPN6/2XElQQ2b+qUZC0xp+JcD8g==
yoho-cookie@^1.2.0:
version "1.2.0"
... ...