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
5f87f3e18d23cf2ee527160d78251f593e8b9647
1 parent
66ea4d24
feat(分享): 添加分享测试代码
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
34 deletions
apps/common/xianyu.js
apps/pages/zhiming/xianyu-js-sdk.vue
apps/common/xianyu.js
View file @
5f87f3e
/* eslint-disable
guard-for-in
*/
/* eslint-disable */
/**
* Xianyu-SDK
*
...
...
@@ -25,48 +25,58 @@ const xianyu = {
},
/*
* @ description:
打开webview右上角自定义按钮并拉起分享弹窗
* @ description:
导航栏右侧自定义按钮 设为可见
* @ author: huzhiming
* @ date: 2019-11-05 1
0:38
:24
* @ date: 2019-11-05 1
1:54
:24
* @ version: V1.0.5
*/
setXianyuShare
()
{
console
.
log
(
'开始调用分享'
);
setNavigatorRightItem
()
{
window
.
_xianyuShare
=
()
=>
{
this
.
setXianyuShare
();
}
if
(
this
.
isAliApp
&&
window
.
WindVane
)
{
window
.
_xianyuShare
=
()
=>
{
var
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保持
title
:
'下载闲鱼App'
,
// 分享标题
text
:
'你可记得家里堆积的闲置物,你可知他们正在黯然神伤。让他们来闲鱼卖身吧,即可'
};
window
.
WindVane
.
call
(
'WVIdleFishApi'
,
'showShareMenu'
,
param
,
(
data
)
=>
{
// alert('success:' + JSON.stringify(data));
console
.
log
(
'success:'
,
JSON
.
stringify
(
data
));
},
function
(
e
)
{
// alert('fail:' , JSON.stringify(e));
console
.
log
(
'fail:'
,
JSON
.
stringify
(
e
));
});
};
return
new
Promise
((
resolve
,
reject
)
=>
{
window
.
WindVane
.
call
(
'WVIdleFishApi'
,
'setNavigatorRightItem'
,
{
title
:
'∙∙∙'
,
// 按钮名称 func:'test' //点击调用函数
func
:
'_xianyuShare'
// func: 'test' //点击调用函数 注意调用的函数必须挂载在window上
},
function
(
data
)
{
console
.
log
(
'setNavigatorRightItem'
,
data
);
resolve
(
data
);
},
function
(
e
)
{
reject
(
e
);
console
.
log
(
'setNavigatorRightItem'
,
e
);
});
});
}
},
/*
* @ description: 配置分享参数进行分享操作
* @ author: huzhiming
* @ date: 2019-11-05 10:38:24
* @ version: V1.0.5
*/
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
:
'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
:
'你可记得家里堆积的闲置物,你可知他们正在黯然神伤。让他们来闲鱼卖身吧,即可'
// 分享描述
})
{
if
(
this
.
isAliApp
&&
window
.
WindVane
)
{
window
.
WindVane
.
call
(
'WVIdleFishApi'
,
'showShareMenu'
,
param
,
(
data
)
=>
{
console
.
log
(
'success:'
,
JSON
.
stringify
(
data
));
},
function
(
e
)
{
console
.
log
(
'fail:'
,
JSON
.
stringify
(
e
));
});
}
},
finishXianyuPage
()
{
if
(
this
.
isAliApp
&&
window
.
WindVane
)
{
window
.
WindVane
.
call
(
'WVIdleFishApi'
,
'finish'
,
{},
()
=>
{
...
...
apps/pages/zhiming/xianyu-js-sdk.vue
View file @
5f87f3e
...
...
@@ -11,9 +11,8 @@
<div class="xianyu-js-sdk-wrap">
<h2>我是一个测试页面</h2>
<ul>
<li @click="share()">
分享
</li>
<li @click="share()">
点击拉出分享弹窗
</li>
</ul>
{{ props }}
</div>
</template>
...
...
@@ -29,21 +28,25 @@ export default {
// },
props: {},
data() {
return {
props: null
}
return {}
},
created() {},
mounted() {
this.$nextTick(async ()=>{
await this.$xianyu.set
XianyuShare()
await this.$xianyu.set
NavigatorRightItem();
})
console.log(window.WindVane)
},
destroyed() {},
methods: {
share() {
this.$xianyu.setXianyuShare()
this.$xianyu.setXianyuShare({
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保持
title: '下载闲鱼App', // 分享标题
text: '你可记得家里堆积的闲置物,你可知他们正在黯然神伤。让他们来闲鱼卖身吧,即可' // 分享描述
})
}
},
computed: {},
...
...
Please
register
or
login
to post a comment