From 29e68853d4769084c1525df7297677f459754f88 Mon Sep 17 00:00:00 2001 From: Hubert Zhang Date: Thu, 14 Nov 2019 15:04:13 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E5=88=86=E4=BA=AB=20A?= =?UTF-8?q?PI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/api/share.d.ts | 5 +++++ types/page.d.ts | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/types/api/share.d.ts b/types/api/share.d.ts index 56de8c0..baf530f 100644 --- a/types/api/share.d.ts +++ b/types/api/share.d.ts @@ -23,4 +23,9 @@ declare namespace my { * 隐藏分享按钮。 */ function hideShareMenu(options?: IHideShareMenuOptions): void; + + /** + * 唤起分享面板。当通过 `my.showSharePanel` 唤起分享功能时,`page.onShareAppMessage` 入参中 `from` 的值为 `code`。 + */ + function showSharePanel(): void; } diff --git a/types/page.d.ts b/types/page.d.ts index 5d94f03..4e5e826 100644 --- a/types/page.d.ts +++ b/types/page.d.ts @@ -1,6 +1,12 @@ declare namespace tinyapp { type OnShareAppMessageOptions = { - from: 'button'; + /** + * 触发来源: + * + button:页面分享按钮触发; + * + menu:右上角分享按钮触发 + * + code:执行my.showSharePanel 触发。 + */ + from: 'button'|'menu'|'code'; target: Record; webViewUrl?: string; } | { From 8b5d48c72f34a1a60ddbc7c0645c92f466ab60b3 Mon Sep 17 00:00:00 2001 From: Hubert Zhang Date: Thu, 14 Nov 2019 15:04:41 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E5=BC=80=E6=94=BE?= =?UTF-8?q?=E8=83=BD=E5=8A=9B-=E4=BC=9A=E5=91=98=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E4=BF=A1=E6=81=AFAPI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/api/open/getAuthUserInfo.d.ts | 1 + types/api/open/userinfo.d.ts | 36 +++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 types/api/open/userinfo.d.ts diff --git a/types/api/open/getAuthUserInfo.d.ts b/types/api/open/getAuthUserInfo.d.ts index f51ef07..bdc56ac 100644 --- a/types/api/open/getAuthUserInfo.d.ts +++ b/types/api/open/getAuthUserInfo.d.ts @@ -33,6 +33,7 @@ declare namespace my { /** * 客户端获取会员信息。 + * @deprecated 对于 2019 年 5 月 25 日及以后创建的小程序,已不再支持使用此接口。建议查看升级后的 my.getOpenUserInfo 接口文档。 */ function getAuthUserInfo(options: IGetAuthUserInfoOptions): void; } diff --git a/types/api/open/userinfo.d.ts b/types/api/open/userinfo.d.ts new file mode 100644 index 0000000..99d3135 --- /dev/null +++ b/types/api/open/userinfo.d.ts @@ -0,0 +1,36 @@ +declare namespace my { + interface IGetOpenUserInfoSuccessResult { + /** + * 获取用户信息后,应使用 `let userInfo = JSON.parse(res.response).response` 解析数据 + * + * 成功返回 res.response 报文格式示例如下: + * ``` + * `{"response": {"code": "10000","msg": "Success","countryCode": "CN","gender": "f","nickName": "XXX","avatar": "https://tfs.alipayobjects.com/images/partner/XXXXXXXX","city": "南通市","province": "江苏省"}}` + * ``` + * + * 未接入“获取用户基础信息”的功能包,返回 res.response 报文格式示例如下: + * ``` + * `{"response":{"code":"40006","msg":"Insufficient Permissions","subCode":"isv.insufficient-isv-permissions","subMsg":"ISV权限不足,建议在开发者中心检查对应功能是否已经添加"}}` + * ``` + */ + response: string; + } + interface IGetOpenUserInfoOptions { + /** + * 调用成功的回调函数 + */ + success?(res: IGetOpenUserInfoSuccessResult): void; + /** + * 调用失败的回调函数 + */ + fail?(): void; + /** + * 调用结束的回调函数(调用成功、失败都会执行) + */ + complete?(): void; + } + /** + * 获取支付宝会员的基础信息 + */ + function getOpenUserInfo(option?: IGetOpenUserInfoOptions): void; +}