UNPKG

para-bridge-demo

Version:

a bridge api for js-ios/andriod rest

163 lines (153 loc) 5.71 kB
```tsx interface IShareWeixinMsgParam { // 分享场景 // timeline (默认)发送到朋友圈 // session 发送到聊天界面 // favorite 添加到微信收藏 scene?: 'timeline' | 'session' | 'favorite'; // 分享标题 title: string; // 分享描述 desc: string; // 分享图标 imgUrl?: string; // 分享的base64格式图片,优先级高于imgUrl imgBase64?: string; // 分享链接 link: string; // "http://m.fc.com/", // 分享类型 // video-视频, music-音频 img-图片, text-文字, webpage-网页 (不填默认) type?: 'video' | 'music'| 'img' | 'text' | 'webpage' | 'wxapp'; // 分享的数据内容。如果type是video,则要提供数据链接,默认为空 dataUrl?: string; } interface INtvShareWeixinMsgParam extends IShareWeixinMsgParam { // 微信小程序分享信息 wxAppInfo?: INtvShareWeixinAppParam; } interface IShareWeixinMsgResult { // 0分享成功, 1取消分享, 2操作被拒绝, 3 其他 status: '0' | '1' | '2' | '3'; // 分享结果描述 desc: string; } // 微信分享 webpage timeline -朋友圈 private shareTimeline = () => { shareToWeixin({ scene: 'timeline', title: '标题测试 分享标题分享标题分享标题分享标题分享标题分享标题分享标题', desc: '测试的描述内容测试的描述内容测试的描述内容测试的描述内容测试的描述内容', imgUrl: this.shareIcon, link: 'http://baidu.com/', type: 'webpage', }).then((result => { alert(JSON.stringify(result)); })); } // 微信分享 img timeline -朋友圈 private shareImageTimeline = () => { shareToWeixin({ scene: 'timeline', title: '标题测试 分享标题分享标题分享标题分享标题分享标题分享标题分享标题', desc: '测试的描述内容测试的描述内容测试的描述内容测试的描述内容测试的描述内容', imgUrl: 'https://dimg04.c-ctrip.com/images/700p12000000rpsgxA70A_1920_340_17.jpg', link: 'http://baidu.com/', type: 'img', }).then((result => { alert(JSON.stringify(result)); })); } // 微信收藏 webpage favorite private shareWebpageFavorite = () => { shareToWeixin({ scene: 'favorite', title: '标题测试 分享标题分享标题分享标题分享标题分享标题分享标题分享标题', desc: '测试的描述内容测试的描述内容测试的描述内容测试的描述内容测试的描述内容', imgUrl: this.shareIcon, link: 'http://baidu.com/', type: 'webpage', }).then((result => { alert(JSON.stringify(result)); })); } // 微信收藏 img favorite private shareImgFavorite = () => { shareToWeixin({ scene: 'favorite', title: '标题测试 分享标题分享标题分享标题分享标题分享标题分享标题分享标题', desc: '测试的描述内容测试的描述内容测试的描述内容测试的描述内容测试的描述内容', imgUrl: 'https://dimg04.c-ctrip.com/images/700p12000000rpsgxA70A_1920_340_17.jpg', link: 'http://baidu.com/', type: 'img', }).then((result => { alert(JSON.stringify(result)); })); } // 微信分享-文本 text session private shareText = () => { shareToWeixin({ scene: 'session', title: '标题测试 分享标题分享标题分享标题分享标题分享标题分享标题分享标题', desc: '测试的描述内容测试的描述内容测试的描述内容测试的描述内容测试的描述内容', imgUrl: this.shareIcon, link: '', type: 'text', }).then((result => { alert(JSON.stringify(result)); })); } // 微信分享-图片 img | session private shareImage = () => { shareToWeixin({ scene: 'session', title: '标题测试 分享标题分享标题分享标题分享标题分享标题分享标题分享标题', desc: '测试的描述内容测试的描述内容测试的描述内容测试的描述内容测试的描述内容', imgUrl: 'https://dimg04.c-ctrip.com/images/700p12000000rpsgxA70A_1920_340_17.jpg', link: '', type: 'img', }).then((result => { alert(JSON.stringify(result)); })); } // 微信分享-音乐 music session private shareMusic = () => { shareToWeixin({ scene: 'session', title: '标题测试 分享标题分享标题分享标题分享标题分享标题分享标题分享标题', desc: '测试的描述内容测试的描述内容测试的描述内容测试的描述内容测试的描述内容', imgUrl: this.shareIcon, link: 'http://baidu.com/', dataUrl: 'http://www.170hi.com/kw/sd.sycdn.kuwo.cn/resource/n2/4/14/2814596013.mp3', type: 'music', }).then((result => { alert(JSON.stringify(result)); })); } // 微信分享-视频 video session private shareVideo = () => { shareToWeixin({ scene: 'session', title: '标题测试 分享标题分享标题分享标题分享标题分享标题分享标题分享标题', desc: '测试的描述内容测试的描述内容测试的描述内容测试的描述内容测试的描述内容', imgUrl: this.shareIcon, link: '', dataUrl: 'https://app.fc.com/fed/webapp/jsp/test.mp4', type: 'video', }).then((result => { alert(JSON.stringify(result)); })); } // 微信分享-网页 webpage session private shareWebpage = () => { shareToWeixin({ scene: 'session', title: '标题测试 分享标题分享标题分享标题分享标题分享标题分享标题分享标题', desc: '测试的描述内容测试的描述内容测试的描述内容测试的描述内容测试的描述内容', imgUrl: this.shareIcon, link: 'http://baidu.com/', type: 'webpage', }).then((result => { alert(JSON.stringify(result)); })); } ```