Authored by huzhiming

fix(闲鱼分享):修复分享在打开分享按钮丢失的问题

... ... @@ -18,35 +18,44 @@ const xianyu = {
setXianyuWebview() {
if (this.isAliApp && window.WindVane) {
window.WindVane.call('WVIdleFishApi', 'setNavigationBarVisible', { visible: false }, () => {
console.log('set ok');
console.log('setNavigationBarVisible ok');
}, () => {
});
}
},
/*
* @ description: 导航栏右侧自定义按钮 设为关闭
* @ author: huzhiming
* @ date: 2019-11-14 16:15:07
* @ version: V1.0.5
*/
closeNavRightItem() {
if (this.isAliApp && window.WindVane) {
window.WindVane.call('WVIdleFishApi', 'setHideNavigatorRightItem', {},()=>{},()=>{})
}
},
/*
* @ description: 导航栏右侧自定义按钮 设为可见
* @ author: huzhiming
* @ date: 2019-11-05 11:54:24
* @ version: V1.0.5
*/
setNavigatorRightItem (shareParam = null, handler) {
console.log('setNavigatorRightItem start!');
setNavRightItem (shareParam = null, handler) {
window._xianyuShare = () => {
this.setXianyuShare(shareParam, handler);
}
console.log('this.isAliApp && window.WindVane', this.isAliApp , window.WindVane);
// console.log('this.isAliApp && window.WindVane', this.isAliApp , window.WindVane);
if (this.isAliApp && window.WindVane) {
console.log('window.WindVane.call() ok!!!')
window.WindVane.call('WVIdleFishApi', 'setNavigatorRightItem', {
title: '∙∙∙', // 按钮名称
func: '_xianyuShare' // func: 'test' //点击调用函数 注意调用的函数必须挂载在window上
}, function(data) {
console.log('11111=====',data);
console.log('setNavigatorRightItem success:',data);
}, function(e) {
console.log('2222===',e);
console.log('setNavigatorRightItem error:',e);
});
}
},
... ... @@ -59,9 +68,6 @@ const xianyu = {
*/
setXianyuShare (param = {
shareType: 'activity', // 类型,默认activity
// image: 'http://gw.alicdn.com/tps/i1/TB1Nep5FVXXXXXDaXXXE799_VXX-800-800.jpg',
// url: 'http://h5.xianyu.tb.cn/xianyu/maishen.html?wxIsAvailable', // 分享链接
// link: 'http://h5.xianyu.tb.cn/xianyu/maishen.html?wxIsAvailable', // 和url保持
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保持
... ... @@ -69,7 +75,7 @@ const xianyu = {
text: '' // 分享描述
}, { XY_SHARE_PRODUCT, XY_SHARE_TYPE }) {
if (this.isAliApp && window.WindVane) {
XY_SHARE_PRODUCT.call(this)
XY_SHARE_PRODUCT.call(this);
window.WindVane.call('WVIdleFishApi', 'showShareMenu', param, (data)=>{
console.log('success:', JSON.stringify(data),typeof data.isCancel);
if (data.isCancel==='false') {
... ...
... ... @@ -32,10 +32,10 @@ import 'video.js/dist/video-js.css';
import sdk from 'yoho-activity-sdk';
// if (process.env.NODE_ENV === 'development') {
if (process.env.NODE_ENV === 'development') {
const VConsole = require('vconsole');
const vConsole = new VConsole();
// }
}
import {
initClient,
... ...
... ... @@ -193,7 +193,6 @@ export default {
},
},
mounted() {
console.log('mounted ok!!!!111');
this.$store.dispatch('getSysConfigQiugou');
// 在action-sheet显示控制与对应关闭方法
... ... @@ -213,22 +212,8 @@ export default {
}
}));
});
console.log('mounted ok!!!!222');
this.$nextTick(() => {
/*
* @ description: 配置打开闲鱼导航栏右上角分享按钮 && 配置分享信息 && 上报数据埋点
* @ author: huzhiming
* @ date: 2019-11-13 19:58:50
* @ version: V1.0.5
*/
console.log('settingShareHandler start!!');
this.settingShareHandler();
});
},
beforeDestroy() {
console.log('beforeDestroy ok!!');
if (this.watchList) {
this.watchList.forEach(item => {
item && item();
... ... @@ -255,8 +240,6 @@ export default {
return store.dispatch('product/fetchProductInfo', {productId});
},
activated() {
console.log('activated ok!!!!');
if (this.$refs.pageScroll) {
this.$refs.pageScroll.scrollTop = 0;
}
... ... @@ -315,17 +298,23 @@ export default {
param,
}
});
console.log();
this.$nextTick(() => {
/*
* @ description: 配置打开闲鱼导航栏右上角分享按钮 && 配置分享信息 && 上报数据埋点
* @ author: huzhiming
* @ date: 2019-11-13 19:58:50
* @ version: V1.0.5
*/
this.settingShareHandler();
});
},
deactivated() {
console.log('deactivated!!');
if (this._resourceImgWatcher) {
this._resourceImgWatcher();
this._resourceImgWatcher = null;
}
this.$xianyu.closeNavRightItem(); // 触发 关闭导航右侧分享按钮
},
beforeRouteUpdate(to, from, next) {
if (this.historyBackGuard() === false) {
... ... @@ -727,13 +716,12 @@ export default {
this.$xianyu.goXianyuNewPage({url});
},
/*
* @ description: 配置分享信息
* @ description: 配置打开闲鱼导航栏右上角分享按钮 && 配置分享信息 && 上报数据埋点
* @ author: huzhiming
* @ date: 2019-11-13 20:00:55
* @ version: V1.0.5
*/
async settingShareHandler() {
// console.log(this.$route.query);
/*
* @ description: [数据上报]@hooks: 分享链接进入pv,查看闲鱼淘口令,地址栏会附带shareUserId参数,目前淘口令查看事件未知,后期若知道淘口令打开事件可调整此数据埋点
* @ author: huzhiming
... ... @@ -774,11 +762,11 @@ export default {
}
}
await this.$xianyu.setNavigatorRightItem({
await this.$xianyu.setNavRightItem({
shareType: 'activity', // 类型,默认activity
image,
url: location.href, // 分享链接
link: location.href, // 和url保持
url: `${location.href}?isNeedRefresh=false`, // 分享链接
link: `${location.href}?isNeedRefresh=false`, // 和url保持
title: `淘口令#${this.productDetail.product_name}`, // 分享标题
text: '' // 分享描述
}, yasReportHandler);
... ...
... ... @@ -62,7 +62,7 @@ const webpackConfig = merge(baseConfig, {
terserOptions: {
safari10: true,
compress: {
drop_console: false,
drop_console: true
}
}
})]
... ...