htt-jsbridge
v3.1.0
Published
htt-jsbridge
Downloads
3
Readme
HTT JSBridge
使用方法
添加依赖包
yarn add htt-jsbridge
yarn add @foxone/passport
方法调用
import { getSignInfo } from 'htt-jsbridge';
import { Passport } from "@foxone/passport";
getSignInfo(function (responseData) {
const { key, secret, merchant_id } = responseData;
let passport = new Passport({ host: "https://dev-cloud.fox.one", merchantId: merchant_id});
passport.getUserDetail({ key, secret}).then( res => {
});
});
方法约定
getSignInfo
返回的结果为
{
"session": {
"expired_at": 1550488057,
"key": "7e988acf936c1e291a629f9dbef013e9-dac6a5334c3e43788f5e99532f9052f7",
"secret": "38d27ad0d6db5971f343abf591f61939"
},
"user": {
"avatar": "",
"phone_code": "86",
"created_at": 1548728004,
"email": "",
"is_password_set": true,
"id": 31,
"member_id": "dac6a5334c3e43788f5e99532f9052f7",
"merchant_id": "5c8a9491dca25af694004d5e1711b217",
"name": "aa",
"phone_number": "12312341234",
"push_id": "1b0f7baf560f8e1a28b01c9170a2253d"
},
"code": 0
}
shareInfo 调起分享面板
必须传入对象
{
url: 'xxxx'
}
方法调用
const shareData = {
url: 'https://raw.githubusercontent.com/httproject/demojson/master/ads/ad.png'
}
shareInfo(JSON.stringify(shareData), (data) => {
console.log(data)
})
返回结果
{
status: '0'
message: '分享成功'
}
{
status: '-1'
message: '分享失败'
}