wechat-offiaccount 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG +8 -1
- package/README.md +6 -4
- package/package.json +4 -4
- package/types/wx.d.ts +21 -0
- package/index.html +0 -63
package/CHANGELOG
CHANGED
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# [WeChat-offiaccount](https://github.com/
|
|
1
|
+
# [WeChat-offiaccount](https://github.com/oi-contrib/WeChat-offiaccount)
|
|
2
2
|
微信公众号辅助调试服务器 + 微信官方js-sdk,支持typescript开发
|
|
3
3
|
|
|
4
4
|
<p>
|
|
@@ -8,14 +8,16 @@
|
|
|
8
8
|
<a href="https://www.npmjs.com/package/wechat-offiaccount">
|
|
9
9
|
<img src="https://img.shields.io/npm/v/wechat-offiaccount.svg" alt="Version">
|
|
10
10
|
</a>
|
|
11
|
-
<a href="https://github.com/
|
|
12
|
-
<img alt="GitHub repo stars" src="https://img.shields.io/github/stars/
|
|
11
|
+
<a href="https://github.com/oi-contrib/WeChat-offiaccount" target='_blank'>
|
|
12
|
+
<img alt="GitHub repo stars" src="https://img.shields.io/github/stars/oi-contrib/WeChat-offiaccount?style=social">
|
|
13
13
|
</a>
|
|
14
14
|
</p>
|
|
15
15
|
|
|
16
|
+
<img src="https://nodei.co/npm/wechat-offiaccount.png?downloads=true&downloadRank=true&stars=true" alt="NPM">
|
|
17
|
+
|
|
16
18
|
本项目用于搭建一个微信公众号本地测试环境,同时集成了微信官方js-sdk,支持typescript开发,为了简单,我们基于[测试号](http://mp.weixin.qq.com/debug/cgi-bin/sandboxinfo?action=showinfo&t=sandbox/index)来说明。
|
|
17
19
|
|
|
18
|
-
> 非测试号也可以使用,填入正确字段即可,如果有问题,可以[issue](https://github.com/
|
|
20
|
+
> 非测试号也可以使用,填入正确字段即可,如果有问题,可以[issue](https://github.com/oi-contrib/WeChat-offiaccount/issues)给我们留言!
|
|
19
21
|
|
|
20
22
|
## 如何本地调试?
|
|
21
23
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wechat-offiaccount",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "微信公众号辅助调试服务器 + 微信官方js-sdk,支持typescript开发",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
|
-
"url": "git+https://github.com/
|
|
20
|
+
"url": "git+https://github.com/oi-contrib/WeChat-offiaccount.git"
|
|
21
21
|
},
|
|
22
22
|
"author": {
|
|
23
23
|
"name": "zxl20070701",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
},
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"bugs": {
|
|
28
|
-
"url": "https://github.com/
|
|
28
|
+
"url": "https://github.com/oi-contrib/WeChat-offiaccount/issues"
|
|
29
29
|
},
|
|
30
|
-
"homepage": "https://github.com/
|
|
30
|
+
"homepage": "https://github.com/oi-contrib/WeChat-offiaccount",
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"devby": "^0.4.6",
|
|
33
33
|
"express": "^4.18.2",
|
package/types/wx.d.ts
CHANGED
|
@@ -573,6 +573,27 @@ declare namespace wx {
|
|
|
573
573
|
*/
|
|
574
574
|
function chooseWXPay(params: IchooseWXPay): void;
|
|
575
575
|
/*=============================微信支付================================*/
|
|
576
|
+
/*=============================微信隐私协议================================*/
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* 打开隐私协议内容
|
|
580
|
+
*/
|
|
581
|
+
function openPrivacyContract(params: {
|
|
582
|
+
success?: (res: any) => void
|
|
583
|
+
fail?: (res: any) => void
|
|
584
|
+
complete?: () => void
|
|
585
|
+
}): void
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* 是否需要授权
|
|
589
|
+
*/
|
|
590
|
+
function getPrivacySetting(params: {
|
|
591
|
+
success?: (res: any) => void
|
|
592
|
+
fail?: (res: any) => void
|
|
593
|
+
complete?: () => void
|
|
594
|
+
}): void
|
|
595
|
+
|
|
596
|
+
/*=============================微信隐私协议================================*/
|
|
576
597
|
/*=============================微信小程序==============================*/
|
|
577
598
|
interface miniProgramMethodsParams extends BaseParams {
|
|
578
599
|
url: string;
|
package/index.html
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="zh-cn">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
-
<title>wxConfig 测试页面</title>
|
|
8
|
-
<script src="./node_modules/zdebug.js/dist/Zdebug.js"></script>
|
|
9
|
-
<!-- <script src="https://unpkg.com/zdebug.js"></script> -->
|
|
10
|
-
<script src="./src/jweixin-1.6.0.js"></script>
|
|
11
|
-
<script>
|
|
12
|
-
Zdebug();
|
|
13
|
-
</script>
|
|
14
|
-
</head>
|
|
15
|
-
|
|
16
|
-
<body>
|
|
17
|
-
|
|
18
|
-
<!--
|
|
19
|
-
一定要注意,JS接口安全域名中配置的是域名
|
|
20
|
-
-->
|
|
21
|
-
|
|
22
|
-
<script>
|
|
23
|
-
fetch("/JsApiSignature?url=" + window.location.href.split('#')[0], {
|
|
24
|
-
method: "get"
|
|
25
|
-
}).then(function (response) {
|
|
26
|
-
response.json()
|
|
27
|
-
.then(function (res) {
|
|
28
|
-
|
|
29
|
-
wx.config({
|
|
30
|
-
debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
|
31
|
-
appId: res.appId, // 必填,公众号的唯一标识
|
|
32
|
-
timestamp: res.timestamp, // 必填,生成签名的时间戳
|
|
33
|
-
nonceStr: res.nonceStr, // 必填,生成签名的随机串
|
|
34
|
-
signature: res.signature,// 必填,签名
|
|
35
|
-
jsApiList: ['chooseImage'] // 必填,需要使用的JS接口列表
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
wx.error(function (res) {
|
|
39
|
-
console.error("错误:" + res);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
wx.ready(function () {
|
|
43
|
-
console.log('准备好了!');
|
|
44
|
-
|
|
45
|
-
wx.chooseImage({
|
|
46
|
-
count: 1, // 默认9
|
|
47
|
-
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|
48
|
-
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
|
49
|
-
success: function (res) {
|
|
50
|
-
var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
|
|
51
|
-
console.log(localIds)
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
</script>
|
|
60
|
-
|
|
61
|
-
</body>
|
|
62
|
-
|
|
63
|
-
</html>
|