...
|
...
|
@@ -7,7 +7,10 @@ function XianyuLinkHandle() { |
|
|
event => {
|
|
|
let currentTarget = $(event.currentTarget);
|
|
|
let href = currentTarget.attr('href') ?
|
|
|
currentTarget.attr('href').replace(/[?|&]openby:yohobuy=.*/, '') : 'javascript:void(0)';
|
|
|
currentTarget.attr('href').replace(/[?|&]openby:yohobuy=.*/, '').repalce(/\n/, '') :
|
|
|
// eslint-disable-next-line no-script-url
|
|
|
'javascript:void(0)';
|
|
|
|
|
|
let tag = href.indexOf('?') >= 0 ? '&' : '?';
|
|
|
|
|
|
href = href + tag + 'isNeedRefresh=false';
|
...
|
...
|
@@ -35,86 +38,3 @@ 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;
|
|
|
}
|
|
|
};
|
|
|
|
...
|
...
|
|