# wechat-chenyu

> Ionic Native - 微信sdk，包括分享、支付、第三方登录

Latest version **1.0.2** (published 2018-01-10) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install wechat-chenyu
pnpm add wechat-chenyu
yarn add wechat-chenyu
bun add wechat-chenyu
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-01-10 |
| First published | 2017-12-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2452 |
| Author | 陈玉 |
| Maintainers | chenyutoxiaoling |

## Links

- npm: https://www.npmjs.com/package/wechat-chenyu
- Repository: https://github.com/ionic-team/ionic-native
- Homepage: https://github.com/ionic-team/ionic-native#readme
- Issues: https://github.com/ionic-team/ionic-native/issues
- npm.io page: https://npm.io/package/wechat-chenyu

## Recent versions

- 1.0.2 (latest) — 2018-01-10
- 1.0.1 — 2018-01-10
- 1.0.0 — 2017-12-08

## README

![](https://img.shields.io/npm/v/@ionic-native/core.svg)


# wechat Native

Ionic Native - 微信sdk，包括分享、支付、第三方登录

## 安装

Run following command to install Ionic Native in your project.
```bash
安装插件
cordova plugin add cordova-plugin-wechat --variable wechatappid=YOUR_WECHAT_APPID
安装ionic2、3调用
npm install wechat-chenyu --save
```

You also need to install the Ionic Native package for each plugin you want to add. Please see the [Ionic Native documentation](https://ionicframework.com/docs/native/) for complete instructions on how to add and use the plugins.

## Documentation

For the full Ionic Native documentation, please visit [https://ionicframework.com/docs/native/](https://ionicframework.com/docs/native/).

### 调用

To use a plugin, import and add the plugin provider to your `@NgModule`, and then inject it where you wish to use it.

```typescript
// app.module.ts
import {WechatChenyu} from "wechat-chenyu";

...

@NgModule({
  ...

  providers: [
    ...
    WechatChenyu
    ...
  ]
  ...
})
export class AppModule { }
```

```typescript
import {WechatChenyu} from "wechat-chenyu";

@Component({ ... })
export class xxxxPage {
constructor(private wechatChenyu: WechatChenyu){}
   //微信支付
   // obj 是从服务器获取的参数
   WchatPay(obj) {
       console.log(obj);
       let params = {
         partnerid: obj.partnerid, // merchant id
         prepayid: obj.prepayid, // prepay id
         noncestr: obj.noncestr, // nonce
         timestamp: obj.timestamp, // timestamp
         sign: obj.sign
       }
       this.wechatChenyu.sendPaymentRequest(params).then((data) => {
         
         /*let alert = this.alertCtrl.create({
           title: '充值提示！',
           subTitle: JSON.stringify(data),
           buttons: ['确定']
         });
         alert.present();
         */
         }, eoor => {
           
         }
       );
     }
     //判断是否安装微信
     isInstalled(){
       this.wechatChenyu.isInstalled().then();
     }
     //微信登录
     auth(){
        this.wechatChenyu.auth().then(); 
     }
     //分享obj参考 https://www.npmjs.com/package/cordova-plugin-wechat
     share(){
         let obj={
                     message: {
                         title: "Hi, there",
                         description: "This is description.",
                         thumb: "www/img/thumbnail.png",
                         mediaTagName: "TEST-TAG-001",
                         messageExt: "这是第三方带的测试字段",
                         messageAction: "<action>dotalist</action>",
                         media: "YOUR_MEDIA_OBJECT_HERE"
                     },
                     scene: 1   // 代表朋友圈、参数列表
                 };
        this.wechatChenyu.share(obj).then();  
     }
     
}
```
# 参数列表
scene
   0, // 聊天界面
   1, // 朋友圈
   2  // 收藏
## 联系我们
QQ:250187715
<br>
QQ群:390736068

---
_Source: https://npm.io/package/wechat-chenyu · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
