UNPKG

@ray-js/smart-ui-typings

Version:

@ray-js/smart-ui 智能小程序 UI 框架的类型声明文件

176 lines (175 loc) 4.63 kB
/// <reference types="wechat-miniprogram" /> export type WechatOpenType = /** * 打开客服会话,如果用户在会话中点击消息卡片后返回小程序 * * 可以从 `bindcontact` 回调中获得具体信息 * * [具体说明](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/customer-message/customer-message.html) * * (*小程序插件中不能使用*) */ 'contact' /** * 触发用户转发 * * 使用前建议先阅读[使用指引](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html#使用指引) */ | 'share' /** * 获取用户手机号 * * 可以从 `bindgetphonenumber` 回调中获取到用户信息 * * [具体说明](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html) * * (*小程序插件中不能使用*) */ | 'getPhoneNumber' /** * 获取用户信息 * * 可以从 `bindgetuserinfo` 回调中获取到用户信息 * * (*小程序插件中不能使用*) */ | 'getUserInfo' /** * 打开 `APP` * * 以通过 `app-parameter` 属性设定向APP传的参数[具体说明](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/launchApp.html) */ | 'launchApp' /** * 打开授权设置页 */ | 'openSetting' /** * 打开“意见反馈”页面 * * 用户可提交反馈内容并上传[日志](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.getLogManager.html) * * 开发者可以登录小程序[管理后台](https://mp.weixin.qq.com)后进入左侧菜单“客服反馈”页面获取到反馈内容 */ | 'feedback' /** * 获取用户头像,可以从 `bindchooseavatar` 回调中获取到头像信息 */ | 'chooseAvatar'; export interface VantOpenTypeProps { /** * 打开 `APP` 时,向 `APP` 传递的参数 * * @requires `'launchApp'` */ appParameter?: string; /** * 指定返回用户信息的语言 * * @requires `'getUserInfo'` * * `zh_CN` 简体中文 * * `zh_TW` 繁体中文 * * `en` 英文 * * @default 'en' */ lang?: 'zh_CN' | 'zh_TW' | 'en'; /** * 会话来源 * * @requires `'contact'` */ sessionFrom?: string; /** * 客服消息子商户 `id` * * @requires `'contact'` */ businessId?: number; /** * 会话内消息卡片标题 * * @requires `'contact'` * * @default 当前标题 */ sendMessageTitle?: string; /** * 会话内消息卡片点击跳转小程序路径 * * @requires `'contact'` * * @default 当前分享路径 */ sendMessagePath?: string; /** * sendMessageImg * * @requires `'contact'` * * @default '截图' */ sendMessageImg?: string; /** * 显示会话内消息卡片 * * @requires `'contact'` * * @default false */ showMessageCard?: string; } export interface VantOpenTypeCamelCaseProps { appParameter?: VantOpenTypeProps['appParameter']; lang?: VantOpenTypeProps['lang']; sessionFrom?: VantOpenTypeProps['sessionFrom']; businessId?: VantOpenTypeProps['businessId']; sendMessageTitle?: VantOpenTypeProps['sendMessageTitle']; sendMessagePath?: VantOpenTypeProps['sendMessagePath']; sendMessageImg?: VantOpenTypeProps['sendMessageImg']; showMessageCard?: VantOpenTypeProps['showMessageCard']; } export interface VantOpenTypeEvents { /** * 用户点击该按钮时,会返回获取到的用户信息, * 从返回参数的`detail`中获取到的值同`wx.getUserInfo` * * @platform WeChat only */ onGetuserinfo?: (event: WechatMiniprogram.ButtonGetUserInfo) => void; /** * 客服消息回调 * * @platform WeChat only */ onContact?: (event: WechatMiniprogram.ButtonContact) => void; /** * 获取用户手机号回调 * * @platform WeChat only */ onGetphonenumber?: (event: WechatMiniprogram.ButtonGetPhoneNumber) => void; /** * 当使用开放能力时,发生错误的回调 * * @platform WeChat only */ onError?: (event: WechatMiniprogram.ButtonError) => void; /** * 在打开授权设置页后回调 * * @platform WeChat only */ onOpensetting?: (event: WechatMiniprogram.ButtonOpenSetting) => void; /** * 打开 APP 成功的回调 * * `openType="launchApp"`时有效 * * @platform WeChat only */ onLaunchapp?: (event: WechatMiniprogram.ButtonLaunchApp) => void; }