提交 ea72b4c4 authored 作者: JarvanMo's avatar JarvanMo

update doc

上级 fbbb5a6a
......@@ -22,6 +22,7 @@ QQ Group:892398530。
* Pay.
* Launch Mini-Program.
* Subscribe Message.
* Auth By QRCode
## Sample
[See sample here](./example)
......
......@@ -21,6 +21,7 @@ QQ群:892398530。
* 支付。
* 打开小程序。
* 一次性订阅消息。
* 二维码登录。
## 示例
......
## AUTH BY QR CODE
When WeChat not installed on devices, user can login with WeChat-QRCode.
### Flutter
Request QRCode by the following codes:
```dart
fluwx.authByQRCode(
appId: "wxd930ea5d5a258f4f",
scope: "noncestr",
nonceStr: "nonceStr",
timeStamp: "1417508194",
signature: "429eaaa13fd71efbc3fd344d0a9a9126835e7303");
}
```
[What do the params mean?](https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=215238808828h4XN&token=&lang=zh_CN)
You can receive the data from WeChat through these ways:
```dart
//listening your auth status
fluwx.onAuthByQRCodeFinished.listen((data){
setState(() {
_status =
"errorCode=>${data.errorCode}\nauthCode=>${data.authCode}";
});
});
//show your qrcode after this
fluwx.onAuthGotQRCode.listen((image) {
setState(() {
_image = image;
});
});
//qrcode was scanned
fluwx.onQRCodeScanned.listen((scanned) {
setState(() {
_status = "scanned";
});
});
```
### Android
WeChatSDK will crash due to `HttpClient` when running on Android P,see this [solution](https://cloud.tencent.com/developer/ask/146536) for help .
## 二维码登录
如果用户没有安装微信,我们可以通过扫描二维码登录.
### Flutter
请求一个二维码:
```dart
fluwx.authByQRCode(
appId: "wxd930ea5d5a258f4f",
scope: "noncestr",
nonceStr: "nonceStr",
timeStamp: "1417508194",
signature: "429eaaa13fd71efbc3fd344d0a9a9126835e7303");
}
```
[这些参数都是什么意思?](https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=215238808828h4XN&token=&lang=zh_CN)
通过以下方式监听扫描过程:
```dart
//当扫码完成
fluwx.onAuthByQRCodeFinished.listen((data){
setState(() {
_status =
"errorCode=>${data.errorCode}\nauthCode=>${data.authCode}";
});
});
//这个时候可以显示你的二维码了
fluwx.onAuthGotQRCode.listen((image) {
setState(() {
_image = image;
});
});
//二维码被扫描了
fluwx.onQRCodeScanned.listen((scanned) {
setState(() {
_status = "scanned";
});
});
```
### Android
在Android P上,微信SDK会闪退, 查看[该文章](https://cloud.tencent.com/developer/ask/146536)以寻求帮助.
......@@ -17,7 +17,6 @@ class _AuthByQRCodePageState extends State<AuthByQRCodePage> {
super.initState();
fluwx.onAuthByQRCodeFinished.listen((data){
print("----finished");
setState(() {
_status =
"errorCode=>${data.errorCode}\nauthCode=>${data.authCode}";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论