Authored by huzhiming

feat(分享): 添加分享测试代码

... ... @@ -74,6 +74,8 @@ jspm_packages
# IntelliJ
/out/
# vscode
.history
# mpeltonen/sbt-idea plugin
.idea_modules/
... ...
/* eslint-disable guard-for-in */
/**
* Xianyu-SDK
*
... ... @@ -23,6 +24,42 @@ const xianyu = {
}
},
/*
* @ description: 打开webview右上角自定义按钮并拉起分享弹窗
* @ author: huzhiming
* @ date: 2019-11-05 10:38:24
* @ version: V1.0.5
*/
setXianyuShare() {
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));
}, function (e) {
// alert('fail:' + JSON.stringify(e));
});
};
return new Promise((resolve, reject) => {
window.WindVane.call('WVIdleFishApi', 'setNavigatorRightItem', {
title: '∙∙∙', // 按钮名称 func:'test' //点击调用函数
func: '_xianyuShare' // func: 'test' //点击调用函数 注意调用的函数必须挂载在window上
}, function(data) {
resolve(data);
}, function(e) {
reject(e);
});
});
},
finishXianyuPage() {
if (this.isAliApp && window.WindVane) {
window.WindVane.call('WVIdleFishApi', 'finish', {}, () => {
... ... @@ -95,6 +132,7 @@ const xianyu = {
}
let arr = [];
if (Object.keys(pageParams)[0] === 'openby:yohobuy') {
for (let key in pageParams) {
arr.push(pageParams[key]);
... ... @@ -129,6 +167,7 @@ const xianyu = {
if (pageName) {
let paramsV = {};
if (pageName === 'List') {
paramsV.query = pageParams;
} else {
... ...
... ... @@ -8,6 +8,7 @@ import Address from './address';
import Notice from './notice';
import Category from './category';
import Activitys from './activitys';
import Zhiming from './zhiming';
export default [
{
... ... @@ -23,5 +24,6 @@ export default [
...Address,
...Notice,
...Category,
...Activitys
...Activitys,
...Zhiming
];
... ...
export default [{
name: 'zhiming',
path: '/xianyu/zhiming',
component: () => import(/* webpackChunkName: "list" */ './xianyu-js-sdk.vue')
}];
... ...
<!--
* @description:
* @fileName: xianyu-js-sdk.vue
* @author: huzhiming
* @date: 2019-11-04 18:02:07
* @后台人员:
* @version: V1.0.5
* @path: 页面访问路径及参数说明
!-->
<template>
<div class="xianyu-js-sdk-wrap">
<h2>我是一个测试页面</h2>
<ul>
<li @click="share()">分享</li>
</ul>
{{ props }}
</div>
</template>
<script>
export default {
// head() {
// return {
// title: '',
// meta: [{ hid: 'keywords', name: 'keywords', content: '' },{ hid: 'hid', name: 'description', content: '' }],
// // link: [{ rel: 'stylesheet', href: '' }],
// // script: [{ src: '' }]
// }
// },
props: {},
data() {
return {
props: null
}
},
created() {},
mounted() {
this.$nextTick(async ()=>{
await this.$xianyu.setXianyuShare()
})
// this.props = window
// console.log(window.AlipayJSBridgeReady);
console.log(window.WindVane)
},
destroyed() {},
methods: {
share() {
this.$xianyu.setXianyuShare()
}
},
computed: {},
watch: {},
components: {}
};
</script>
/* 定义局部样式,添加外围容器,scss嵌套尽量不要超过三层,会影响查找器性能 */
<style rel='stylesheet/scss' lang='scss' scoped>
.xianyu-js-sdk-wrap {}
//@import "./style.scss";
</style>
... ...