Namespace: YmtApi

YmtApi

YmtApi是h5与原生native交互的协议及工具
Since:
  • 2015-06-25 10:48
Author:
  • haiyang5210
Source:

Namespaces

utils

Methods

(static) diaryOpenComment(options, ObjectId, ObjectType, replyCommentId)

[社区]唤出原生评论
Parameters:
Name Type Description
options Object 新加评论初始参数
ObjectId String
ObjectType Number
replyCommentId String
Source:
Example
YmtApi.diaryOpenComment({
ObjectId:'209--99232',
ObjectType:4,
replyCommentId: 209
});

(static) diaryPublishNote(options)

[社区]发表日记
Parameters:
Name Type Description
options Object 发表日记初始参数
Source:
Example
YmtApi.diaryPublishNote({});

(static) diaryPublishReply(options, ObjectId, ObjectType)

[社区]唤出原生回复
Parameters:
Name Type Description
options Object 新加评论初始参数
ObjectId String
ObjectType Number
Source:
Example
YmtApi.diaryPublishReply({ObjectId:'209--99232',ObjectType:4});

(static) open(options)

打开Webview
Parameters:
Name Type Description
options object
Source:
Example
YmtApi.open({
url: 'http://matouapp.ymatou.com/forYmatouApp/home',
shareFlag: 1,
backFlag: 1,
backType: 0,
backFlag: 1,
msgFlag: 1,
showWeiboFlag: 0,
needJumpFlag: 1,
title: '商品详情',
shareTitle: '分享标题',
shareContent: '分享内容',
sharePicUrl: 'http://分享图片',
shareLinkUrl: 'http://分享链接地址'
});

(static) openChatDetail(options)

打开聊天详情
Parameters:
Name Type Description
options object 对话参数
Source:
Example
YmtApi.openChatDetail({
'SessionId': '1618229_1097476',
'ToId': 1097476,
'ToLoginId': 'foreverprince',
'ToLogoUrl': 'http://p5.img.ymatou.com/upload/userlogo/big/1097476_cce6d77caa524c1f86b1e6dc5696a89a_b.jpg',
'param': {
'ProductModel': {
'ProductId': '2b14bb1c-b734-4b52-b909-9c497365f12d',
'Price': 92,
'replayTag': 0,
'ProductDesc': '美国进口Childlife钙镁锌补充液 婴儿幼儿童液体钙 474ml 现货',
'ProductPics': ['http://p9.img.ymatou.com/G02/upload/product/big/M0A/39/63/CgvUBFXvLNCAFN3_AAD_TXljT4s321_b.jpg']
}
}
}

(static) openChatList(options)

打开聊天列表
Parameters:
Name Type Description
options object
Source:
Example
YmtApi.openChatList();

(static) openConfirmOrder(查考open参数)

打开确认订单页
Parameters:
Name Type Description
查考open参数
Source:

(static) openPay()

打开支付面板 trandingIds 交易号(微信下trandingId支付不管成功失败,只一次有效) isIncludeBonded 是否包含杭保订单 orderId 订单号
Source:
Example
YmtApi.openPay({
trandingIds: 208340912,
orderId: 106960422,
isIncludeBonded: 1,
param: {
AccessToken: '855A2FC3EDC3D10831518774E90FB853CA1EF15E4E1686DDCBCD5505C0E09AA44B133A574D0BA115D9A2A038A72124C61365CB4414AED5FC'
}
});

(static) openProductDetail()

打开C的商品详情(原生)
Source:
Example
YmtApi.openProductDetail({
SellerName: 'bighero',
param: {
SellerModel: {
Logo: 'http://static.ymatou.com/images/sprites/logo.png'
Seller: 'bighero'
SellerId: 100066
},
ProductModel: {
ProductId: '66a92b97-2903-4927-a931-8a5045058742'
}
}
});

(static) openShare(options)

打开聊天列表
Parameters:
Name Type Description
options Object 分享标题文案图标等参数
Source:
Example
YmtApi.openShare({
title: 'hy test share title',
shareTitle: 'hy test shareTitle',
sharePicUrl: 'http://static.ymatou.com/images/sprites/logo.png',
shareUrl: 'http://static.ymatou.com/images/sprites/logo.png',
shareTip: 'hy test shareTip'
});

(static) previewImage(options)

预览图片接口
Parameters:
Name Type Description
options object urls {array} 图片地址 current {number} 当前图片的索引值,对应urls中的数组坐标
Source:
Example
YmtApi.previewImage({
urls: [
'http://p9.img.ymatou.com/G02/upload/product/big/M0A/39/63/CgvUBFXvLNCAFN3_AAD_TXljT4s321_b.jpg',
'http://p5.img.ymatou.com/upload/userlogo/big/1097476_cce6d77caa524c1f86b1e6dc5696a89a_b.jpg'
],
current: 1
});

(static) sendEvent()

触发事件
Source:
Example
// 刷新页面
YmtApi.sendEvent('refreshPageEvent', {
'PageType': 1,
'Status': 1
});
// 用户登录态变更
YmtApi.sendEvent('userStatusChange', {
'UserId': '1',
'AccessToken ': 'AFEEEAAA'
});
// 用户点我喜欢
YmtApi.sendEvent('clickFavoriteEvent', {
'Status': 1
});

// 监听页面刷新事件
YmtApi.on('refreshPageEvent', function (res) {
// res => {
// 'PageType': 1,
// 'Status': 1
// };
// Todo
});
// 监听用户登录态变更
YmtApi.on('userStatusChange', function (res) {
// res => {
// 'UserId': '1',
// 'AccessToken ': 'AFEEEAAA'
// };
// Todo
});
// 监听用户点我喜欢
YmtApi.on('clickFavoriteEvent', function (res) {
// res => {
// 'Status': 1
// };
// Todo
});

(static) toLogin()

唤出原生登录
Source:
Example
YmtApi.toLogin();