Authored by huzhiming

feat(商品详情): 添加初稿闲鱼分享代码

... ... @@ -30,14 +30,15 @@ const xianyu = {
* @ date: 2019-11-05 11:54:24
* @ version: V1.0.5
*/
setNavigatorRightItem() {
window._xianyuShare = () =>{
this.setXianyuShare();
setNavigatorRightItem (shareParam = null) {
window._xianyuShare = () => {
this.setXianyuShare(shareParam);
}
if (this.isAliApp && window.WindVane) {
return new Promise((resolve, reject) => {
window.WindVane.call('WVIdleFishApi', 'setNavigatorRightItem', {
title: '∙∙∙', // 按钮名称 func:'test' //点击调用函数
// title: '∙∙∙', // 按钮名称 func:'test' //点击调用函数
title: '分享', // 按钮名称 func:'test' //点击调用函数
func: '_xianyuShare' // func: 'test' //点击调用函数 注意调用的函数必须挂载在window上
}, function(data) {
resolve(data);
... ... @@ -59,14 +60,11 @@ const xianyu = {
// 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: 'http://img11.static.yhbimg.com/goodsimg/2018/12/24/17/01070adae9791c70ed02593550437cf30e.jpg?imageMogr2/thumbnail/600x600/background/d2hpdGU=/position/center/quality/80',
url: 'http://xianyu.yohobuy.com/xianyu/product/10014937.html?wxIsAvailable', // 分享链接
link: 'http://xianyu.yohobuy.com/xianyu/product/10014937.html?wxIsAvailable', // 和url保持
// image: 'http://img11.static.yhbimg.com/goodsimg/2019/07/15/10/01ed8e7b5051c543f7a15c06e1efa8e211.jpg?imageMogr2/thumbnail/600x600/background/d2hpdGU=/position/center/quality/80',
// url: 'http://xianyu.yohobuy.com/xianyu/product/10014937.html?wxIsAvailable', // 分享链接
// link: 'http://xianyu.yohobuy.com/xianyu/product/10014937.html?wxIsAvailable', // 和url保持
title: '下载闲鱼App', // 分享标题
text: '你可记得家里堆积的闲置物,你可知他们正在黯然神伤。让他们来闲鱼卖身吧,即可' // 分享描述
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) => {
... ...
... ... @@ -16,7 +16,7 @@
</cube-slide-item>
<template slot="dots" slot-scope="props">
<div class="dot-wrap">
<span class="cube-dot" :class="{active: props.current === index}" v-for="(item, index) in props.dots">&bull;</span>
<span class="cube-dot" :class="{active: props.current === index}" v-for="(item, index) in props.dots" :key="item">&bull;</span>
</div>
</template>
</cube-slide>
... ... @@ -212,6 +212,23 @@ export default {
}
}));
});
/*
* @ description: 打开闲鱼导航栏右上角分享按钮,并配置分享信息
* @ author: huzhiming
* @ date: 2019-11-11 15:20:38
* @ version: V1.0.5
*/
this.$nextTick(async () => {
await this.$xianyu.setNavigatorRightItem({
shareType: 'activity', // 类型,默认activity
image: this.sizeImg(this.imageList[0].image_url,200,200),
url: location.href, // 分享链接
link: location.href, // 和url保持
title: this.productDetail.product_name, // 分享标题
text: '你可记得家里堆积的闲置物,你可知他们正在黯然神伤。让他们来闲鱼卖身吧,即可' // 分享描述
});
})
},
beforeDestroy() {
if (this.watchList) {
... ...
export default [{
name: 'zhiming',
path: '/xianyu/zhiming',
component: () => import(/* webpackChunkName: "list" */ './xianyu-js-sdk.vue')
component: () => import(/* webpackChunkName: "zhiming" */ './xianyu-js-sdk.vue')
}];
... ...
... ... @@ -13,10 +13,13 @@
<ul>
<li @click="share()">点击拉出分享弹窗</li>
</ul>
{{ searchWord }}
</div>
</template>
<script>
import { createNamespacedHelpers } from 'vuex'
const { mapState, mapActions } = createNamespacedHelpers('list')
export default {
// head() {
// return {
... ... @@ -26,18 +29,25 @@ export default {
// // script: [{ src: '' }]
// }
// },
asyncData({store, router}) {
return store.dispatch('list/fetchSearchWords');
},
props: {},
data() {
return {}
},
created() {},
mounted() {
// this.fetchSearchWords()
this.$nextTick(async ()=>{
await this.$xianyu.setNavigatorRightItem();
})
},
destroyed() {},
methods: {
...mapActions([
'fetchSearchWords'
]),
share() {
this.$xianyu.setXianyuShare({
shareType: 'activity', // 类型,默认activity
... ... @@ -49,7 +59,12 @@ export default {
})
}
},
computed: {},
computed: {
...mapState([
'filterVisible',
'searchWord'
])
},
watch: {},
components: {}
};
... ... @@ -57,6 +72,6 @@ export default {
/* 定义局部样式,添加外围容器,scss嵌套尽量不要超过三层,会影响查找器性能 */
<style rel='stylesheet/scss' lang='scss' scoped>
.xianyu-js-sdk-wrap {}
//@import "./style.scss";
// .xianyu-js-sdk-wrap {}
// @import "./style.scss";
</style>
... ...