...
|
...
|
@@ -8,12 +8,12 @@ |
|
|
*
|
|
|
* 希望能与 微信 JS-SDK 一样方便
|
|
|
*/
|
|
|
const $ = require('yoho-jquery');
|
|
|
|
|
|
const tip = require('common/tip');
|
|
|
const native = window.yohoInterface;
|
|
|
|
|
|
window.yohoWapInterface = {
|
|
|
headerRightTopBtn: $.loop()
|
|
|
headerRightTopBtn: function() {}
|
|
|
};
|
|
|
|
|
|
const yoho = {
|
...
|
...
|
@@ -35,7 +35,7 @@ const yoho = { |
|
|
*/
|
|
|
goTap(args, success, fail) {
|
|
|
if (this.isApp) {
|
|
|
native.triggerEvent(success || $.loop(), fail || $.loop(), {
|
|
|
native.triggerEvent(success || function() {}, fail || function() {}, {
|
|
|
method: 'go.tab',
|
|
|
arguments: args
|
|
|
});
|
...
|
...
|
@@ -52,7 +52,7 @@ const yoho = { |
|
|
*/
|
|
|
goLogin(args, success, fail) {
|
|
|
if (this.isApp) {
|
|
|
native.triggerEvent(success || $.loop(), fail || $.loop(), {
|
|
|
native.triggerEvent(success || function() {}, fail || function() {}, {
|
|
|
method: 'go.login',
|
|
|
arguments: args
|
|
|
});
|
...
|
...
|
@@ -69,7 +69,7 @@ const yoho = { |
|
|
*/
|
|
|
goShopingCart(args, success, fail) {
|
|
|
if (this.isApp) {
|
|
|
native.triggerEvent(success || $.loop(), fail || $.loop(), {
|
|
|
native.triggerEvent(success || function() {}, fail || function() {}, {
|
|
|
method: 'go.shopingCart',
|
|
|
arguments: args
|
|
|
});
|
...
|
...
|
@@ -86,7 +86,7 @@ const yoho = { |
|
|
*/
|
|
|
goAddress(args, success, fail) {
|
|
|
if (this.isApp) {
|
|
|
native.triggerEvent(success || $.loop(), fail || $.loop(), {
|
|
|
native.triggerEvent(success || function() {}, fail || function() {}, {
|
|
|
method: 'go.address',
|
|
|
arguments: args
|
|
|
});
|
...
|
...
|
@@ -103,7 +103,7 @@ const yoho = { |
|
|
*/
|
|
|
goImageBrowser(args, success, fail) {
|
|
|
if (this.isApp) {
|
|
|
native.triggerEvent(success || $.loop(), fail || $.loop(), {
|
|
|
native.triggerEvent(success || function() {}, fail || function() {}, {
|
|
|
method: 'go.imageBrowser',
|
|
|
arguments: args
|
|
|
});
|
...
|
...
|
@@ -120,7 +120,7 @@ const yoho = { |
|
|
*/
|
|
|
goNewPage(args, success, fail) {
|
|
|
if (this.isApp) {
|
|
|
native.triggerEvent(success || $.loop(), fail || $.loop(), {
|
|
|
native.triggerEvent(success || function() {}, fail || function() {}, {
|
|
|
method: 'go.newPage',
|
|
|
arguments: args
|
|
|
});
|
...
|
...
|
@@ -137,7 +137,7 @@ const yoho = { |
|
|
*/
|
|
|
goPay(args, success, fail) {
|
|
|
if (this.isApp) {
|
|
|
native.triggerEvent(success || $.loop(), fail || $.loop(), {
|
|
|
native.triggerEvent(success || function() {}, fail || function() {}, {
|
|
|
method: 'go.pay',
|
|
|
arguments: args
|
|
|
});
|
...
|
...
|
@@ -147,6 +147,40 @@ const yoho = { |
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 回到上一个原生界面
|
|
|
* @param args
|
|
|
* @param success
|
|
|
* @param fail
|
|
|
*/
|
|
|
goBack(args, success, fail) {
|
|
|
if (this.isApp) {
|
|
|
native.triggerEvent(success || function() {}, fail || function() {}, {
|
|
|
method: 'go.back',
|
|
|
arguments: args
|
|
|
});
|
|
|
} else {
|
|
|
tip('暂不支持,请在BLK应用中打开');
|
|
|
}
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 分享
|
|
|
* @param args
|
|
|
* @param success
|
|
|
* @param fail
|
|
|
*/
|
|
|
goShare(args, success, fail) {
|
|
|
if (this.isApp) {
|
|
|
native.triggerEvent(success || function() {}, fail || function() {}, {
|
|
|
method: 'go.share',
|
|
|
arguments: args
|
|
|
});
|
|
|
} else {
|
|
|
tip('暂不支持,请在BLK应用中打开');
|
|
|
}
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 原生调用 JS 方法
|
|
|
* @param name 方法名
|
|
|
* @param callback 回调
|
...
|
...
|
|