para-bridge-demo
Version:
a bridge api for js-ios/andriod rest
99 lines (92 loc) • 2.98 kB
Markdown
``` tsx
interface IShareSocialMsgParam {
// QQ : QQ会话
// QQZone : QQ空间 //Android 844前不支持
// SinaWeibo : 新浪微博
// SMS : 短信
// iOSWX : iOS系统调微信分享(仅iOS),与直接微信分享存在差异 since 9.0.8
platform: 'QQ' | 'QQZone' | 'SinaWeibo' | 'SMS' | 'iOSWX'; // "QQ",
// image : 图片
// news : 链接方式(默认)
shareType?: 'image' | 'news';
// 分享标题 | 短信时可配置联系人
title: string; // "标题测试",
// 分享描述 | 短信内容文字与链接
desc: string; // "测试的描述内容 测试的描述内容",
// 分享链接
link: string; // "http://m.fc.com/",
// 分享图标/图片
imgUrl: string;
// 分享的base64格式图片,优先级高于imgUrl
imgBase64?: string;
}
interface IShareSocialMsgResult {
// 0分享成功|1取消分享|2 操作被拒绝| 3 其他
status: '0' | '1' | '2' | '3';
// 分享结果描述
desc: string;
}
// QQ 分享
private share2QQ = (shareType: 'news' | 'image' = 'news') => () => {
shareToSocialMsg({
shareType,
platform: 'QQ',
title: '标题测试QQ',
desc: '测试的描述内容 测试的描述内容',
link: 'http://baidu.com/',
imgUrl: 'http://pic24.photophoto.cn/20120814/0005018348123206_b.jpg',
}).then((result => {
alert(JSON.stringify(result));
}));
}
// QQ空间 分享
private share2QQZone = (shareType: 'news' | 'image' = 'news') => () => {
shareToSocialMsg({
shareType,
platform: 'QQZone',
title: '标题测试QQZone',
desc: '测试的描述内容 测试的描述内容',
link: 'http://baidu.com/',
imgUrl: 'https://dimg04.c-ctrip.com/images/700p12000000rpsgxA70A_1920_340_17.jpg',
}).then((result => {
alert(JSON.stringify(result));
}));
}
// 分享到新浪微博
private share2SinaWeibo = (shareType: 'news' | 'image' = 'news') => () => {
shareToSocialMsg({
shareType,
platform: 'SinaWeibo',
title: '标题测试SinaWeibo',
desc: '测试的描述内容 测试的描述内容',
link: 'http://baidu.com/',
imgUrl: 'http://pic24.photophoto.cn/20120814/0005018348123206_b.jpg',
}).then((result => {
alert(JSON.stringify(result));
}));
}
// 短信分享
private share2Sms = () => {
shareToSocialMsg({
platform: 'SMS',
title: '10086',
desc: '我是短信内容,点击链接http://www.baidu.com',
link: 'http://baidu.com/',
imgUrl: 'http://pic24.photophoto.cn/20120814/0005018348123206_b.jpg',
}).then((result => {
alert(JSON.stringify(result));
}));
}
// 分享到IOS系统掉微信分享
private share2iOSWX = () => {
shareToSocialMsg({
platform: 'iOSWX',
title: '标题测试iOSWX',
desc: '测试的描述内容 测试的描述内容',
link: 'http://baidu.com/',
imgUrl: 'http://pic24.photophoto.cn/20120814/0005018348123206_b.jpg',
}).then((result => {
alert(JSON.stringify(result));
}));
}
```