Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
xianyu-ufo-app-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
huzhiming
5 years ago
Commit
8680ee31c612af9bea67ca2d2ae70dfb7d93d22b
1 parent
5f87f3e1
feat(商品详情): 添加初稿闲鱼分享代码
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
17 deletions
apps/common/xianyu.js
apps/pages/product/product-detail.vue
apps/pages/zhiming/index.js
apps/pages/zhiming/xianyu-js-sdk.vue
apps/common/xianyu.js
View file @
8680ee3
...
...
@@ -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
)
=>
{
...
...
apps/pages/product/product-detail.vue
View file @
8680ee3
...
...
@@ -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">•</span>
<span class="cube-dot" :class="{active: props.current === index}" v-for="(item, index) in props.dots"
:key="item"
>•</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) {
...
...
apps/pages/zhiming/index.js
View file @
8680ee3
export
default
[{
name
:
'zhiming'
,
path
:
'/xianyu/zhiming'
,
component
:
()
=>
import
(
/* webpackChunkName: "
list
" */
'./xianyu-js-sdk.vue'
)
component
:
()
=>
import
(
/* webpackChunkName: "
zhiming
" */
'./xianyu-js-sdk.vue'
)
}];
...
...
apps/pages/zhiming/xianyu-js-sdk.vue
View file @
8680ee3
...
...
@@ -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>
...
...
Please
register
or
login
to post a comment