import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
@Plugin({
pluginName: 'MSWeChat',
plugin: 'com.mansuo.plugins.wechat',
pluginRef: 'WeChat',
platforms: ['Android', 'iOS']
})
@Injectable()
export class MSWeChat extends IonicNativePlugin {
@Cordova({
observable: true
})
oauth(): Observable<any> {return ;}
/**
** 微信扫码登录
**/
@Cordova({
observable: true,
callbackOrder: 'reverse'
})
scanAuth(oauthUrl: string): Observable<any> {return ;}
/**
* 分享朋友圈
* WeChat.shareTimeline({
* title: '标题',
* description: '描述',
* link: '链接地址',
* image: '封面地址'
* })
*/
@Cordova({
callbackOrder: 'reverse',
observable: true
})
shareTimeline( params: any ): Observable<any> { return; }
/**
* 分享给好友
* WeChat.shareAppMessage({
* title: '标题',
* description: '描述',
* link: '链接地址',
* image: '封面地址'
* })
*/
@Cordova({
callbackOrder: 'reverse',
observable: true
})
shareAppMessage( params: any ): Observable<any> { return; }
/**
* 微信支付
* WeChat.sendPayReq({
* appid: 'appid',
* partnerid: 'partnerid',
* prepayid: 'prepayid',
* package: 'package',
* timestamp: 'timestamp',
* noncestr: 'noncestr',
* sign: sign
* })
*/
@Cordova({
callbackOrder: 'reverse',
observable: true
})
sendPayReq( params: any ): Observable<any> { return; }
}
结果集说明:
I.微信支付:
0: 支付成功
-1: 参数错误
-2: 用户取消支付
-3: 未能成功调起微信支付
II.微信登录
-1:参数错误。
-2:未安装微信。
-3:未能成功调起微信登录。
III.分享微信好友,朋友圈
-1: 参数错误
-3: 未能成功调起微信好友,朋友圈功能。
ionic cordova plugin add com.mansuo.plugins.wechat --variable WECHAT_APP_ID=xxxx
com.mansuo.plugins.wechat
3.0.9 • Public • PublishedPackage Sidebar
Install
npm i com.mansuo.plugins.wechat
Weekly Downloads
1
Version
3.0.9
License
ISC
Unpacked Size
19.3 MB
Total Files
19