提交 9c91f8d9 编写于 作者: 雪洛's avatar 雪洛

add: shareWithSystem

上级 6e58ed02
......@@ -187,6 +187,7 @@ const third = [
'checkSession',
'getUserInfo',
'share',
'shareWithSystem',
'showShareMenu',
'hideShareMenu',
'requestPayment',
......
......@@ -195,3 +195,36 @@ export function share (params, callbackId, method = 'share') {
}
)
}
export function shareWithSystem (params, callbackId, method = 'shareWithSystem') {
let {
type,
imageUrl,
summary: content,
href
} = params
type = type || 'text'
const allowedTypes = ['text', 'image']
if (allowedTypes.indexOf(type) < 0) {
invoke(callbackId, {
errMsg: method + ':fail:分享参数 type 不正确'
})
}
if (typeof imageUrl === 'string' && imageUrl) {
imageUrl = getRealPath(imageUrl)
}
plus.share.sendWithSystem({
type,
pictures: imageUrl ? [imageUrl] : [],
content,
href
}, function (res) {
invoke(callbackId, {
errMsg: method + ':ok'
})
}, function (err) {
invoke(callbackId, {
errMsg: method + ':fail:' + err.message
})
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册