Authored by shuaiguo

Merge remote-tracking branch 'refs/remotes/origin/feature/coupon' into feature/coupon-capthca

... ... @@ -134,7 +134,7 @@
"whatwg-fetch": "^2.0.4",
"workbox-sw": "^2.1.2",
"workbox-webpack-plugin": "^3.4.1",
"yo-cli": "=2.1.9",
"yo-cli": "^2.1.13",
"yoho-activity-sdk": "^1.1.5",
"yoho-cookie": "^1.2.0",
"yoho-fastclick": "^1.0.6",
... ...
... ... @@ -12,6 +12,7 @@ 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('./feature/yo-sdk');
const { XianyuJSBridge } = require('./xianyu');
require('scss/feature.scss');
... ... @@ -1601,3 +1602,31 @@ $(function() {
couponSendFinished();
}
});
// 1、判断闲鱼环境,加载相关jssdk资源(layout.hbs 已做)
// 2、打开闲鱼导航栏右侧···按钮,并配置分享参数
// 3、绑定相关触发函数
// /* eslint-disable */
$(function() {
// var VConsole = require('vconsole');
// var vConsole = new VConsole();
const webShareData = {
title: $('#shareTitle').val(),
desc: $('#shareImg').val(),
imgUrl: $('#shareDesc').val(),
link: $('#shareLink').val()
};
const parames = {
shareType: 'activity', // 类型,默认activity
image: webShareData.imgUrl,
url: `${webShareData.link}?isNeedRefresh=false`, // 分享链接
link: `${webShareData.link}?isNeedRefresh=false`, // 和url保持
title: `淘口令#${webShareData.title}`, // 分享标题
text: '' // 分享描述
};
// parames.image = $('.feature-page .floor').eq(1).children('img').eq(0).attr('src');
// console.log(parames);
XianyuJSBridge.hideLoadingBox().setNavRightItem(parames);
});
... ...
import $ from 'yoho-jquery';
function XianyuLinkHandle() {
... ... @@ -38,3 +39,86 @@ function XianyuLinkHandle() {
}
export default new XianyuLinkHandle();
/* eslint-disable */
/*
* @ description: js调用闲鱼相关API方法封装
* @ author: huzhiming
* @ date: 2019-12-03 09:45:05
* @ version: v1.0.0
*
*/
export const XianyuJSBridge = {
// 判断是否在闲鱼环境内
get isAliApp () {
return /AliApp/i.test(navigator.userAgent || '');
},
/*
* @ description: 导航栏右侧自定义按钮 设为关闭
* @ author: huzhiming
* @ date: 2019-11-14 16:15:07
* @ version: v1.0.0
*/
closeNavRightItem () {
if (this.isAliApp && window.WindVane) {
window.WindVane.call('WVIdleFishApi', 'setHideNavigatorRightItem', {}, () => { }, () => { })
}
return this;
},
// 导航栏右侧自定义按钮 设为可见
setNavRightItem (shareParam = null) {
window._xianyuShare = () => {
this.setXianyuShare(shareParam);
}
if (this.isAliApp && window.WindVane) {
window.WindVane.call('WVIdleFishApi', 'setNavigatorRightItem', {
title: '∙∙∙', // 按钮名称
func: '_xianyuShare' // func: 'test' //点击调用函数 注意调用的函数必须挂载在window上
}, function(data) {
console.log('setNavigatorRightItem success:', data);
}, function(e) {
console.log('setNavigatorRightItem error:', e);
});
}
return this;
},
/*
* @ description: 配置分享参数进行分享操作
* @ author: huzhiming
* @ date: 2019-11-05 10:38:24
* @ version: v1.0.0
*/
setXianyuShare (param = {
shareType: 'activity', // 类型,默认activity
image: '//img11.static.yhbimg.com/goodsimg/2018/12/24/17/01070adae9791c70ed02593550437cf30e.jpg?imageMogr2/thumbnail/600x600/background/d2hpdGU=/position/center/quality/80',
url: '//xianyu.yohobuy.com/xianyu/index/channel?wxIsAvailable', // 分享链接
link: '//xianyu.yohobuy.com/xianyu/index/channel?wxIsAvailable', // 和url保持
title: '闲鱼潮品首页', // 分享标题
text: '' // 分享描述
}) {
if (this.isAliApp && window.WindVane) {
window.WindVane.call('WVIdleFishApi', 'showShareMenu', param, (data) => {
console.log('success:', JSON.stringify(data), typeof data.isCancel);
// if (data.isCancel === 'false') {}
}, function(e) {
console.log('fail:', JSON.stringify(e));
});
}
return this;
},
// 隐藏 webview loadingBox
hideLoadingBox () {
if (this.isAliApp && window.WindVane) {
window.WindVane.call('WVUI', 'hideLoadingBox', {}, function(e) {
console.log('success: ' + JSON.stringify(e));
}, function(e) {
console.log('failure: ' + JSON.stringify(e));
});
}
return this;
}
};
... ...
This diff could not be displayed because it is too large.