From 9605384edcd6e696f36b88939cf00e49118de4fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=AD=90=E9=BB=98?= <925456043@qq.com> Date: Fri, 20 Mar 2026 12:44:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=90=AD=E5=BB=BA=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=B1=95=E7=A4=BA=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 初始化小程序工程配置与类型声明 - 增加首页、律所、律师列表、详情与历史页面 - 补充公共组件、运行时配置与示例素材 --- frontend_miniprogram/miniprogram/api/open.ts | 147 + frontend_miniprogram/miniprogram/app.json | 26 + frontend_miniprogram/miniprogram/app.less | 201 + frontend_miniprogram/miniprogram/app.ts | 6 + .../miniprogram/assets/images/avatar_1.png | Bin 0 -> 2775 bytes .../miniprogram/assets/images/avatar_2.png | Bin 0 -> 2718 bytes .../miniprogram/assets/images/avatar_3.png | Bin 0 -> 2633 bytes .../miniprogram/assets/images/avatar_4.png | Bin 0 -> 2743 bytes .../miniprogram/assets/images/avatar_5.png | Bin 0 -> 2673 bytes .../miniprogram/assets/images/hero.png | Bin 0 -> 6146 bytes .../miniprogram/assets/images/hero_v2.png | Bin 0 -> 42712 bytes .../miniprogram/assets/images/logo.png | Bin 0 -> 2356 bytes .../miniprogram/assets/qr/qr_1.png | Bin 0 -> 2164 bytes .../miniprogram/assets/qr/qr_2.png | Bin 0 -> 2159 bytes .../miniprogram/assets/qr/qr_3.png | Bin 0 -> 2167 bytes .../miniprogram/assets/qr/qr_4.png | Bin 0 -> 2172 bytes .../miniprogram/assets/qr/qr_5.png | Bin 0 -> 2161 bytes .../components/action-dock/action-dock.json | 3 + .../components/action-dock/action-dock.less | 64 + .../components/action-dock/action-dock.ts | 8 + .../components/action-dock/action-dock.wxml | 14 + .../components/app-header/app-header.json | 6 + .../components/app-header/app-header.less | 3 + .../components/app-header/app-header.ts | 20 + .../components/app-header/app-header.wxml | 6 + .../components/empty-state/empty-state.json | 3 + .../components/empty-state/empty-state.less | 25 + .../components/empty-state/empty-state.ts | 8 + .../components/empty-state/empty-state.wxml | 4 + .../components/filter-bar/filter-bar.json | 3 + .../components/filter-bar/filter-bar.less | 50 + .../components/filter-bar/filter-bar.ts | 34 + .../components/filter-bar/filter-bar.wxml | 16 + .../components/lawyer-card/lawyer-card.json | 3 + .../components/lawyer-card/lawyer-card.less | 97 + .../components/lawyer-card/lawyer-card.ts | 33 + .../components/lawyer-card/lawyer-card.wxml | 21 + .../navigation-bar/navigation-bar.json | 5 + .../navigation-bar/navigation-bar.less | 96 + .../navigation-bar/navigation-bar.ts | 105 + .../navigation-bar/navigation-bar.wxml | 64 + .../miniprogram/config/runtime.ts | 16 + .../miniprogram/constants/storage.ts | 1 + frontend_miniprogram/miniprogram/data/mock.ts | 102 + .../miniprogram/pages/firm/index.json | 5 + .../miniprogram/pages/firm/index.less | 182 + .../miniprogram/pages/firm/index.ts | 71 + .../miniprogram/pages/firm/index.wxml | 60 + .../miniprogram/pages/history/index.json | 7 + .../miniprogram/pages/history/index.less | 39 + .../miniprogram/pages/history/index.ts | 80 + .../miniprogram/pages/history/index.wxml | 22 + .../miniprogram/pages/index/index.json | 5 + .../miniprogram/pages/index/index.less | 61 + .../miniprogram/pages/index/index.ts | 54 + .../miniprogram/pages/index/index.wxml | 28 + .../pages/lawyer-detail/index.json | 8 + .../pages/lawyer-detail/index.less | 245 + .../miniprogram/pages/lawyer-detail/index.ts | 188 + .../pages/lawyer-detail/index.wxml | 79 + .../miniprogram/pages/lawyer-list/index.json | 8 + .../miniprogram/pages/lawyer-list/index.less | 116 + .../miniprogram/pages/lawyer-list/index.ts | 147 + .../miniprogram/pages/lawyer-list/index.wxml | 56 + .../miniprogram/pages/logs/logs.json | 5 + .../miniprogram/pages/logs/logs.less | 16 + .../miniprogram/pages/logs/logs.ts | 21 + .../miniprogram/pages/logs/logs.wxml | 7 + frontend_miniprogram/miniprogram/sitemap.json | 7 + .../miniprogram/types/card.ts | 36 + .../miniprogram/utils/history.ts | 65 + .../miniprogram/utils/http.ts | 75 + .../miniprogram/utils/miniapp.ts | 29 + .../miniprogram/utils/util.ts | 19 + frontend_miniprogram/package.json | 15 + frontend_miniprogram/project.config.json | 51 + frontend_miniprogram/tsconfig.json | 30 + frontend_miniprogram/typings/index.d.ts | 8 + frontend_miniprogram/typings/types/index.d.ts | 1 + .../typings/types/wx/index.d.ts | 74 + .../typings/types/wx/lib.wx.api.d.ts | 19671 ++++++++++++++++ .../typings/types/wx/lib.wx.app.d.ts | 270 + .../typings/types/wx/lib.wx.behavior.d.ts | 68 + .../typings/types/wx/lib.wx.cloud.d.ts | 924 + .../typings/types/wx/lib.wx.component.d.ts | 636 + .../typings/types/wx/lib.wx.event.d.ts | 1435 ++ .../typings/types/wx/lib.wx.page.d.ts | 259 + 87 files changed, 26373 insertions(+) create mode 100644 frontend_miniprogram/miniprogram/api/open.ts create mode 100644 frontend_miniprogram/miniprogram/app.json create mode 100644 frontend_miniprogram/miniprogram/app.less create mode 100644 frontend_miniprogram/miniprogram/app.ts create mode 100644 frontend_miniprogram/miniprogram/assets/images/avatar_1.png create mode 100644 frontend_miniprogram/miniprogram/assets/images/avatar_2.png create mode 100644 frontend_miniprogram/miniprogram/assets/images/avatar_3.png create mode 100644 frontend_miniprogram/miniprogram/assets/images/avatar_4.png create mode 100644 frontend_miniprogram/miniprogram/assets/images/avatar_5.png create mode 100644 frontend_miniprogram/miniprogram/assets/images/hero.png create mode 100644 frontend_miniprogram/miniprogram/assets/images/hero_v2.png create mode 100644 frontend_miniprogram/miniprogram/assets/images/logo.png create mode 100644 frontend_miniprogram/miniprogram/assets/qr/qr_1.png create mode 100644 frontend_miniprogram/miniprogram/assets/qr/qr_2.png create mode 100644 frontend_miniprogram/miniprogram/assets/qr/qr_3.png create mode 100644 frontend_miniprogram/miniprogram/assets/qr/qr_4.png create mode 100644 frontend_miniprogram/miniprogram/assets/qr/qr_5.png create mode 100644 frontend_miniprogram/miniprogram/components/action-dock/action-dock.json create mode 100644 frontend_miniprogram/miniprogram/components/action-dock/action-dock.less create mode 100644 frontend_miniprogram/miniprogram/components/action-dock/action-dock.ts create mode 100644 frontend_miniprogram/miniprogram/components/action-dock/action-dock.wxml create mode 100644 frontend_miniprogram/miniprogram/components/app-header/app-header.json create mode 100644 frontend_miniprogram/miniprogram/components/app-header/app-header.less create mode 100644 frontend_miniprogram/miniprogram/components/app-header/app-header.ts create mode 100644 frontend_miniprogram/miniprogram/components/app-header/app-header.wxml create mode 100644 frontend_miniprogram/miniprogram/components/empty-state/empty-state.json create mode 100644 frontend_miniprogram/miniprogram/components/empty-state/empty-state.less create mode 100644 frontend_miniprogram/miniprogram/components/empty-state/empty-state.ts create mode 100644 frontend_miniprogram/miniprogram/components/empty-state/empty-state.wxml create mode 100644 frontend_miniprogram/miniprogram/components/filter-bar/filter-bar.json create mode 100644 frontend_miniprogram/miniprogram/components/filter-bar/filter-bar.less create mode 100644 frontend_miniprogram/miniprogram/components/filter-bar/filter-bar.ts create mode 100644 frontend_miniprogram/miniprogram/components/filter-bar/filter-bar.wxml create mode 100644 frontend_miniprogram/miniprogram/components/lawyer-card/lawyer-card.json create mode 100644 frontend_miniprogram/miniprogram/components/lawyer-card/lawyer-card.less create mode 100644 frontend_miniprogram/miniprogram/components/lawyer-card/lawyer-card.ts create mode 100644 frontend_miniprogram/miniprogram/components/lawyer-card/lawyer-card.wxml create mode 100644 frontend_miniprogram/miniprogram/components/navigation-bar/navigation-bar.json create mode 100644 frontend_miniprogram/miniprogram/components/navigation-bar/navigation-bar.less create mode 100644 frontend_miniprogram/miniprogram/components/navigation-bar/navigation-bar.ts create mode 100644 frontend_miniprogram/miniprogram/components/navigation-bar/navigation-bar.wxml create mode 100644 frontend_miniprogram/miniprogram/config/runtime.ts create mode 100644 frontend_miniprogram/miniprogram/constants/storage.ts create mode 100644 frontend_miniprogram/miniprogram/data/mock.ts create mode 100644 frontend_miniprogram/miniprogram/pages/firm/index.json create mode 100644 frontend_miniprogram/miniprogram/pages/firm/index.less create mode 100644 frontend_miniprogram/miniprogram/pages/firm/index.ts create mode 100644 frontend_miniprogram/miniprogram/pages/firm/index.wxml create mode 100644 frontend_miniprogram/miniprogram/pages/history/index.json create mode 100644 frontend_miniprogram/miniprogram/pages/history/index.less create mode 100644 frontend_miniprogram/miniprogram/pages/history/index.ts create mode 100644 frontend_miniprogram/miniprogram/pages/history/index.wxml create mode 100644 frontend_miniprogram/miniprogram/pages/index/index.json create mode 100644 frontend_miniprogram/miniprogram/pages/index/index.less create mode 100644 frontend_miniprogram/miniprogram/pages/index/index.ts create mode 100644 frontend_miniprogram/miniprogram/pages/index/index.wxml create mode 100644 frontend_miniprogram/miniprogram/pages/lawyer-detail/index.json create mode 100644 frontend_miniprogram/miniprogram/pages/lawyer-detail/index.less create mode 100644 frontend_miniprogram/miniprogram/pages/lawyer-detail/index.ts create mode 100644 frontend_miniprogram/miniprogram/pages/lawyer-detail/index.wxml create mode 100644 frontend_miniprogram/miniprogram/pages/lawyer-list/index.json create mode 100644 frontend_miniprogram/miniprogram/pages/lawyer-list/index.less create mode 100644 frontend_miniprogram/miniprogram/pages/lawyer-list/index.ts create mode 100644 frontend_miniprogram/miniprogram/pages/lawyer-list/index.wxml create mode 100644 frontend_miniprogram/miniprogram/pages/logs/logs.json create mode 100644 frontend_miniprogram/miniprogram/pages/logs/logs.less create mode 100644 frontend_miniprogram/miniprogram/pages/logs/logs.ts create mode 100644 frontend_miniprogram/miniprogram/pages/logs/logs.wxml create mode 100644 frontend_miniprogram/miniprogram/sitemap.json create mode 100644 frontend_miniprogram/miniprogram/types/card.ts create mode 100644 frontend_miniprogram/miniprogram/utils/history.ts create mode 100644 frontend_miniprogram/miniprogram/utils/http.ts create mode 100644 frontend_miniprogram/miniprogram/utils/miniapp.ts create mode 100644 frontend_miniprogram/miniprogram/utils/util.ts create mode 100644 frontend_miniprogram/package.json create mode 100644 frontend_miniprogram/project.config.json create mode 100644 frontend_miniprogram/tsconfig.json create mode 100644 frontend_miniprogram/typings/index.d.ts create mode 100644 frontend_miniprogram/typings/types/index.d.ts create mode 100644 frontend_miniprogram/typings/types/wx/index.d.ts create mode 100644 frontend_miniprogram/typings/types/wx/lib.wx.api.d.ts create mode 100644 frontend_miniprogram/typings/types/wx/lib.wx.app.d.ts create mode 100644 frontend_miniprogram/typings/types/wx/lib.wx.behavior.d.ts create mode 100644 frontend_miniprogram/typings/types/wx/lib.wx.cloud.d.ts create mode 100644 frontend_miniprogram/typings/types/wx/lib.wx.component.d.ts create mode 100644 frontend_miniprogram/typings/types/wx/lib.wx.event.d.ts create mode 100644 frontend_miniprogram/typings/types/wx/lib.wx.page.d.ts diff --git a/frontend_miniprogram/miniprogram/api/open.ts b/frontend_miniprogram/miniprogram/api/open.ts new file mode 100644 index 0000000..52591bf --- /dev/null +++ b/frontend_miniprogram/miniprogram/api/open.ts @@ -0,0 +1,147 @@ +import type { FirmInfo, Lawyer } from '../types/card'; +import { request } from '../utils/http'; + +interface OpenFirmResponse { + name: string; + logo: string; + heroImage: string; + intro: string; + hotlinePhone: string; + hqAddress: string; + hqLatitude: number; + hqLongitude: number; + officeCount: number; + lawyerCount: number; + officeList: string[]; + practiceAreas: string[]; +} + +interface OpenCardListItem { + id: number; + name: string; + title: string; + office: string; + phone: string; + email: string; + avatar: string; + specialties: string[]; +} + +interface OpenCardDetailResponse { + id: number; + name: string; + title: string; + office: string; + phone: string; + email: string; + address: string; + avatar: string; + coverImage: string; + wechatQrImage: string; + bio: string; + specialties: string[]; + firmName: string; + firmAddress: string; + firmLatitude: number; + firmLongitude: number; +} + +function toFirmInfo(payload: OpenFirmResponse): FirmInfo { + return { + id: payload.name || 'firm', + name: payload.name || '', + logo: payload.logo || '', + intro: payload.intro || '', + hotlinePhone: payload.hotlinePhone || '', + hqAddress: payload.hqAddress || '', + hqLatitude: payload.hqLatitude || 0, + hqLongitude: payload.hqLongitude || 0, + officeCount: payload.officeCount || 0, + lawyerCount: payload.lawyerCount || 0, + heroImage: payload.heroImage || '', + officeList: payload.officeList || [], + practiceAreas: payload.practiceAreas || [], + }; +} + +function toLawyer(payload: OpenCardListItem | OpenCardDetailResponse): Lawyer { + return { + id: String(payload.id), + name: payload.name || '', + title: payload.title || '', + office: payload.office || '', + phone: payload.phone || '', + email: payload.email || '', + address: 'address' in payload ? payload.address || '' : '', + avatar: payload.avatar || '', + coverImage: 'coverImage' in payload ? payload.coverImage || '' : '', + specialties: payload.specialties || [], + bio: 'bio' in payload ? payload.bio || '' : '', + wechatQrImage: 'wechatQrImage' in payload ? payload.wechatQrImage || '' : '', + }; +} + +export async function getFirmProfile(): Promise { + const payload = await request({ + url: '/api/open/firm/profile', + }); + return toFirmInfo(payload); +} + +export async function listLawyers(params: { + keyword?: string; + office?: string; + practiceArea?: string; +}): Promise { + const query = Object.entries(params) + .filter(([, value]) => Boolean(value)) + .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value as string)}`) + .join('&'); + const payload = await request({ + url: `/api/open/cards${query ? `?${query}` : ''}`, + }); + return payload.map((item) => toLawyer(item)); +} + +export async function getLawyerDetail(cardId: string, sourceType = 'DIRECT', shareFromCardId = ''): Promise<{ + firm: FirmInfo; + lawyer: Lawyer; +}> { + const queryParts = [`sourceType=${encodeURIComponent(sourceType)}`]; + if (shareFromCardId) { + queryParts.push(`shareFromCardId=${encodeURIComponent(shareFromCardId)}`); + } + const payload = await request({ + url: `/api/open/cards/${encodeURIComponent(cardId)}?${queryParts.join('&')}`, + }); + + return { + firm: { + id: payload.firmName || 'firm', + name: payload.firmName || '', + logo: '', + intro: '', + hotlinePhone: '', + hqAddress: payload.firmAddress || '', + hqLatitude: payload.firmLatitude || 0, + hqLongitude: payload.firmLongitude || 0, + officeCount: 0, + lawyerCount: 0, + heroImage: '', + officeList: [], + practiceAreas: [], + }, + lawyer: toLawyer(payload), + }; +} + +export async function recordCardShare(cardId: string, sharePath: string): Promise { + await request({ + url: `/api/open/cards/${encodeURIComponent(cardId)}/share`, + method: 'POST', + data: { + shareChannel: 'WECHAT_FRIEND', + sharePath, + }, + }); +} diff --git a/frontend_miniprogram/miniprogram/app.json b/frontend_miniprogram/miniprogram/app.json new file mode 100644 index 0000000..4be7b64 --- /dev/null +++ b/frontend_miniprogram/miniprogram/app.json @@ -0,0 +1,26 @@ +{ + "pages": [ + "pages/firm/index", + "pages/lawyer-list/index", + "pages/lawyer-detail/index", + "pages/history/index" + ], + "window": { + "navigationBarTextStyle": "black", + "navigationStyle": "custom", + "backgroundTextStyle": "light", + "backgroundColor": "#f4f4f4" + }, + "style": "v2", + "rendererOptions": { + "skyline": { + "defaultDisplayBlock": true, + "disableABTest": true, + "sdkVersionBegin": "3.0.0", + "sdkVersionEnd": "15.255.255" + } + }, + "componentFramework": "glass-easel", + "sitemapLocation": "sitemap.json", + "lazyCodeLoading": "requiredComponents" +} diff --git a/frontend_miniprogram/miniprogram/app.less b/frontend_miniprogram/miniprogram/app.less new file mode 100644 index 0000000..a6b6ba7 --- /dev/null +++ b/frontend_miniprogram/miniprogram/app.less @@ -0,0 +1,201 @@ +/** + * Law Firm Digital Card - Design System + * 简约、扁平、现代化风格 + */ + +page { + /* --- 核心色彩系统 (Color Palette) --- */ + + /* 主色调:勃艮第红 - 传递权威、庄重、正义 */ + --primary-color: #8E2230; + --primary-light: #B86A74; + /* 用于 hover 或浅色背景 */ + --primary-dark: #5C0D15; + + /* 强调色:金色 - 传递高端、品质 */ + --accent-color: #D4AF37; + --accent-light: #dfc466; + + /* 中性色系统 */ + --text-main: #1A1A1A; + /* 主要文字,接近纯黑 */ + --text-secondary: #595959; + /* 次要文字,深灰 */ + --text-tertiary: #8C8C8C; + /* 辅助文字,浅灰 */ + --text-placeholder: #BFBFBF; + + /* 背景色 */ + --bg-page: #F5F7FA; + /* 页面底色,极浅的蓝灰 */ + --bg-card: #FFFFFF; + /* 卡片背景,纯白 */ + --bg-surface: #F9FAFC; + /* 次级表面颜色 */ + + /* 分割线与边框 */ + --border-color: #E8E8E8; + --border-radius-base: 12rpx; + --border-radius-lg: 16rpx; + --border-radius-sm: 8rpx; + + /* --- 排版系统 (Typography) --- */ + --font-size-xs: 20rpx; + --font-size-sm: 24rpx; + --font-size-base: 28rpx; + --font-size-lg: 32rpx; + --font-size-xl: 36rpx; + --font-size-xxl: 40rpx; + + --font-weight-regular: 400; + --font-weight-medium: 500; + --font-weight-bold: 600; + + /* --- 间距 (Spacing) --- */ + --spacing-xs: 8rpx; + --spacing-sm: 16rpx; + --spacing-md: 24rpx; + --spacing-lg: 32rpx; + --spacing-xl: 48rpx; + + /* --- 阴影 (Shadows) --- */ + --shadow-sm: 0 2rpx 8rpx rgba(0, 0, 0, 0.04); + --shadow-base: 0 4rpx 16rpx rgba(0, 0, 0, 0.06); + --shadow-lg: 0 8rpx 24rpx rgba(0, 0, 0, 0.08); + + /* 全局设置 */ + font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Segoe UI, Arial, Roboto, 'PingFang SC', 'miui', 'Hiragino Sans GB', 'Microsoft Yahei', sans-serif; + background-color: var(--bg-page); + color: var(--text-main); + box-sizing: border-box; + -webkit-font-smoothing: antialiased; +} + +/* --- 布局工具类 (Layout Utilities) --- */ + +.container-page { + min-height: 100vh; + display: flex; + flex-direction: column; + background-color: var(--bg-page); +} + +.page-content { + flex: 1; + width: 100%; + box-sizing: border-box; +} + +/* Flexbox Helpers */ +.flex-row { + display: flex; + flex-direction: row; + align-items: center; +} + +.flex-col { + display: flex; + flex-direction: column; +} + +.flex-center { + display: flex; + align-items: center; + justify-content: center; +} + +.flex-between { + display: flex; + align-items: center; + justify-content: space-between; +} + +.flex-wrap { + flex-wrap: wrap; +} + +/* Spacing Helpers */ +.mt-sm { + margin-top: var(--spacing-sm); +} + +.mt-md { + margin-top: var(--spacing-md); +} + +.mt-lg { + margin-top: var(--spacing-lg); +} + +.mb-sm { + margin-bottom: var(--spacing-sm); +} + +.mb-md { + margin-bottom: var(--spacing-md); +} + +.mb-lg { + margin-bottom: var(--spacing-lg); +} + +/* Text Utilities */ +.text-center { + text-align: center; +} + +.text-right { + text-align: right; +} + +.text-primary { + color: var(--primary-color); +} + +.text-secondary { + color: var(--text-secondary); +} + +.text-accent { + color: var(--accent-color); +} + +.font-bold { + font-weight: var(--font-weight-bold); +} + +/* Common Components */ +.card { + background: var(--bg-card); + border-radius: var(--border-radius-base); + padding: var(--spacing-md); + box-shadow: var(--shadow-sm); +} + +/* Section Title - Modern Style */ +.section-title { + font-size: 30rpx; + font-weight: var(--font-weight-bold); + color: var(--text-main); + position: relative; + padding-left: 20rpx; + margin-bottom: var(--spacing-md); + line-height: 1.2; +} + +.section-title::before { + content: ''; + position: absolute; + left: 0; + top: 4rpx; + bottom: 4rpx; + width: 6rpx; + background-color: var(--primary-color); + border-radius: 4rpx; +} + +/* Safe Area styling for bottom navigation */ +.safe-area-bottom { + padding-bottom: constant(safe-area-inset-bottom); + padding-bottom: env(safe-area-inset-bottom); +} \ No newline at end of file diff --git a/frontend_miniprogram/miniprogram/app.ts b/frontend_miniprogram/miniprogram/app.ts new file mode 100644 index 0000000..8533785 --- /dev/null +++ b/frontend_miniprogram/miniprogram/app.ts @@ -0,0 +1,6 @@ +App({ + globalData: {}, + onLaunch() { + // 可在此扩展启动逻辑 + }, +}); diff --git a/frontend_miniprogram/miniprogram/assets/images/avatar_1.png b/frontend_miniprogram/miniprogram/assets/images/avatar_1.png new file mode 100644 index 0000000000000000000000000000000000000000..b6920cdd04116d88186f3413bb6c5f3ccb57de43 GIT binary patch literal 2775 zcma)8Yfuwc6pr2LrqzT@%M?O*q$3t*Dvi*j5GCSUL@n6b`WRA(ii#tI?IJk zP_5KjK?ex6Rvo6wKr?C-#I-)Km4}Mu4K7+#L?mD#@(6bC*{sflf$;}(nVWmR^PTTI z=iJR$9uX#-D4EFP@r2=v7ktj+P4Gv5Z@t0n^h-S^^LP_Y;S1(|p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Cv`b9@ literal 0 HcmV?d00001 diff --git a/frontend_miniprogram/miniprogram/assets/images/avatar_2.png b/frontend_miniprogram/miniprogram/assets/images/avatar_2.png new file mode 100644 index 0000000000000000000000000000000000000000..e9de240633fed610a45bacffbba8207ec087b5b4 GIT binary patch literal 2718 zcmb7GdrVVj6z_JE+f6CWW~R_0WSfsT8RCkxVnOF{in?~r=``YCIu&2g$q*FKT$vK% zqcW#}B5D?ODpr`UO0irv(J6=;T|lXD*#cysU6Cneg|dFX+batlasJVqFQ?}_kKg&7 z^WCi5ZeE^-6t@qv7^(XZvkO zRa z3c1B{?CjTNafcX(zi~AAYhJK!{y}p6;@tMD62eoKDnDv^i#E$gN3~f--$W%i>~JaR$gTwnKbSNi;f-5NbG9>%Mi} zlN1Eloz^h;^sRxb*;FlD=r~?2vl~9*V^yJuU#Y7|g=KfcZfR^bakO2MhwIzKW>e~s zu`X2xl?j6{V-FI8nUb{R=IJ~_@xw^cE5({Y1eQjs-Wx72vq_}*;1Jy&a-&jWnMoq= z_0Ahk>`#h!!k%G9!n~3VLgI22+`UcJ*Il&uxNej&38lsElN_e^nS>EIJZ8Q}Qj3J@ z1R#TueFYr^U!%oU2vtt;q5ft*KxXe1YDq>%>GSZ$u}9#ofjwPXa+eQ%2bxZH7A}m{ z9U!H6Nup6gA~ggc?xC9D;5UW`v73GKzk8s9+Q+^gZYsUf(oN{b6}H6CHpe`WAy-eh!Mzc*xj5-CANeyx zw)9tol|aJPiOrUL0!D$4@m-R`yb#@3NTp5z8D?v|5e53M=iG&-fTfjQ50Od{a}wyr za~1oW<%BA#LcsB_p&O%t#+t;9LRRTg3)mFsV;qMl3f*|fP+R$q9dOsku0z!44PDAn z6yl^KO20Djm20C2AFQd*=I#`N?qez-e`E$iUT1Ee*8V?6%>i$ewtE=A9N!ucXEBuw zIgpMpIp_0J^gPPmG@L@nEG8X3#|c;&pgzoK`ALuG0s%<4E)QJwQlqG)^jhRz!)|t? zbgX*AJ)Y!!SZn{QN{yRqnXmMzy`r&`H21`T|jZHe&Ti89)gnO^GRt}|E2+VU3GR-aWafMfz# zsR4FfDkf+VcOJRiX3HTTus0z8U^BD%1>C|2g=5l#6@^IZ3T;4*7a8f8Zg+!)cPJPC zIOKNjE^)?vF3!hRuyn8s(WFhx0^~7{%7$D*1w>n3tQ*U))2stHPBTFuUg3kFtT^Pgep3Mx{N%xg*y6sEmE7SQMt!9=he5^ zpYffLBNtlkhv&_+;dplDjknpl^fK&I;j=(^Q>8ag0sh`9_JK?RDZ${-AW8`7UR=U1 z*MWrv{wfqp)A=y({ZMgZq*irA@g(<8d+I(3Pg~sq+^G=v!+#_8RiNAmUj=?DJkEoq feP2AiQ+loZwasBo;dQR>PEphpO{8IR?52MJm?SA4 literal 0 HcmV?d00001 diff --git a/frontend_miniprogram/miniprogram/assets/images/avatar_3.png b/frontend_miniprogram/miniprogram/assets/images/avatar_3.png new file mode 100644 index 0000000000000000000000000000000000000000..993dc00fac3b903a435b2c04a5f5f75b44a88f9a GIT binary patch literal 2633 zcmeAS@N?(olHy`uVBq!ia0y~yVAKI&4kn<;H+e}V1_mwxPZ!6Kid%0lUqAQli6DbR zys#&S%9ndTtM$K3VtUCa^iEbMa?_tv-!|Vr_-5})G|GV7z`{ll1x!uq33vZYI@7eM7iM*h>{D0dQ#}@B* zjj8`pdt@v7eb(BV|LXwdU<=xr!%J+7DyxMxw zftfc)M#48^K_iOb63VjqPB1R^x9ly{R!j z{(q4XP=_>ooEk`HH+!BCNat7P>n&_j840Hks4i?|le%GA;0Ln6jIRf*Y%*ILSXm|W zaj-#G8k@n&za7{NrVk!C45rT>_zR|Q9+(TJpB~u0uGUZzXjCt=Iauef#%w2MUXu-} z4<-Sv=Y1n(p$>8f&^?MEi)R=b%mRt~NJ)5s9Po@+1}q=U&IfkDP3H4pnw6O!>|;~r z?_fHW`Tn0DpCMsWF%x8hj@%AUkO|lLW56nOnWuxDbp3!O*oPKmTlC|_X1Z8Z4)*C( z=J@{~E<-FN;G+**;2`d4ya@K`r2_$=pf<>VU;z$VtAYujfH@;qF%29*5*0H*^cu+> z^TB-SAGg@&`+!ox;{&I`CVV{L3y!S12jED_k=&sIimcsi=fD;nBio`^zx~xgsi5#d zD%gUG2WlWEM%WjC)Acr<7_i@CnV*B*@%TUn*e96@8epH87t8^<*hkjF0~Ez+{5IYo zT8ziW2OQ-*cl<&0G~PSlBoM||^K`HJWKg=cD3}cPv-}Qlx{hYk1N&rMV=>qrg%3o* z7E3ZO28%CgTnKi+y#s|{2b4Zg06W0;gAUle1|JN-v~htwm^SK_Zw=dr$|aa~>40zdMr$SmPXP zoDSCcsBtz}=idXSpbT-tr~sS;%XsI2E$AgTUlpi>^Oxm^@9Xc)gIGwwqV%Vfx Y{b0EIe~0@VU=xwS)78&qol`;+09b|i^Z)<= literal 0 HcmV?d00001 diff --git a/frontend_miniprogram/miniprogram/assets/images/avatar_4.png b/frontend_miniprogram/miniprogram/assets/images/avatar_4.png new file mode 100644 index 0000000000000000000000000000000000000000..956bc171b68967b13b4699bebcee4c411268b953 GIT binary patch literal 2743 zcmb_edrVVj6z{ytt;3dPBMKC-n@;(|iZ6sR+3Elvgx50Nf)Uyx;Wa?Y5KDQPJDiT7 zqRV(B6C81YYy(!pCMd6qW2lTtkrkLqy^2^SAZ;dH9kuMlzlzAwM|i-Thg&rv}CbJ;q#F z>dUHtkgDAc%ey|?`SO~s*O$FY%EbOv4w=&*7~SFrujgp}bVJHYaZX*{ik4^hJau!k zhJ(pwUAitx(;*0}*l3=Jx!?PnSRnL!UR>;Bnmw6TZ)lpW@cq`3o%VSD{Y{D$o;8-- zgd2q($NrX8h})0lo}NxqNTf3(XAbWBex*g8p=s!B@-1~AG5ne{VYZB{O*TKt*2y(P zL)DUvxtW=oDs4%i)a$M0(IUm*GxHRZoO|?gW5?sBvTEbX{ET$XhJuJqLZ$MWr_Omh z%1@L%z`3t*z14Us&upq|JB^|Ia*=#X6)9b|sVdbw5iZ9qGC1)o4BhQ0bmEhXP9y;| zOjv9H!u8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OO_@O$y_HqMv{RDRl;;+aMv%T5dW0h0KjT)8;+eLTVcaEXZYWc zZURSZMbNwSe34SkD9T(w;0S;4{+-G?lUn{Zar>xhDX*yzd8Z;5C*1ghwg~0R4FEx_ zPzh@kRzr22$T+{Hg=k^&%gAW{A8Pq$`wzRBQkY9^S>dI1AU|R!mSj;tG7B}TP$f&; z0PYqZ+R3Q%EaNm-Pc06nC`*9+sO*s@$_Il(jN5QdpF^duND?S)79Rq8k%f9cO&R5` zcS8L(iLt2Pbs-g;Z<0uS_z}rpf`4*I4XmEzdnKIwhuzb)?=!bZzE@K5lRA2_nSETc z;q+XfllMr?J6ba;baw*S9?E5-Dh)tOSPpM{BVk)0OpJ!GQ6k$z(c=4fjuS^gqAW4S zvP_D3l-!ut|Dcpb03{1+oiPBz=c=9Ah$eqYWLoUHJ4j z0W)jbDmkGhMcAj5BQ*5>G#;nRXaH(+;iP4QvT3&?4V+;iy1AVXN>*0VU3v zp~bcAZ=*hdmT=SKifW9~EI>kkI;e^HW_gWu@$1uq?@?C~p!#9=;Uwxj)EC~b?+ z8(WVs6=!RwV6e7}YcM7naUBC+D|CQFqrl|5`tOZY+NwMAd}ey>Uz|_Hx9fvy?sBG| Pk`mtq0rLyyYCirO(w+rT literal 0 HcmV?d00001 diff --git a/frontend_miniprogram/miniprogram/assets/images/hero.png b/frontend_miniprogram/miniprogram/assets/images/hero.png new file mode 100644 index 0000000000000000000000000000000000000000..a5ead8da348aeecd246bac1af7a91081bc7dca79 GIT binary patch literal 6146 zcmeI0TSyd97{@2mWmsJr=%Q{tY!qQeC2d7iTaIb9LW@QhiqM6kEvyK-VB15RP7kJ0 zWN*=y7ZB1kSi_3K5TYWewMff^>LJ>aEu*!&)pzFXnK?7D7vcC)3y1GPj=%Gr@BF{Z zPF0a(mC0x}avW!}ug+h~amklCF6joJ1b^9E-2IH>((l>x#dYOUp;`(X) zoJMi_bg854>9GUlwJU48rfiprY;Ozv!*j26{Fn*`tAcHzfFJuWS}G1n6wP3`6M7Mr%)`Mh|bXX%Y}6h#c0CS-Rgl8d1q{3Uf+8)XeoKOF6eq{5rS=qLMt1AH#8S%-I-2 zTGzMM(G0h5H#jWZwIp*~4)UFi$;jcG&W^@A$~gk+cJxeq{W7qqu z7Bc)q3JzElj@+2wFiXYhLPnn3{eA)e!JA#U*}wDm6ICPL=b2JORn&M*d17j$_{GwQ zK4KtC8mB%gijC%qu_J~huHdl5!>=1rBY#C~tl?E~Yk@s=aj=s_6@1yZ1hfb)gx536 zg!Xu|3htr!ghU4_QeII`QriHH(~6=2C9;wRC?=YS0ZXefSo^i4_S;Jdo|#*}lPONp!? z6|S9wZDfzW)&>+AhbxoP98fEXQF&4Epi4I#M&mSDfmmv(#8o_6A;OJA!QsUCtB%BK zR!f~i$%9#m(knkDE~_|XxQv56Z0f4sl&HjzA0%ZC-Lfn_zu`>#g~z{|)fvv#Vdd4S zEqZ^pM(sV2G<3ItUZ87UnzXP+?L9IJe2>_?aOqU0FFccw&PZ-dvP_w1!#G{@!Yr^~ z%#y1%QHdd+$nb)OV0UTpqYB55HhG}JlVkq_%LHYz*Q-J|_3A2d42|dq9BNEOX|Aor z_+2Av1hJ@zB!qoe3cI!v$IwWarQk3NY=4>H?O*?oWflBB{(0NdzkD(Lh#j5pDRF$7 zVe?sNL=;2ac)0qA{)NqE)?e9T^E_ezeUgm5k@XgapDN=;Ifd)+=_KCW4EM#Ma@Jee n=yBwf|3XNzG$Ov(;EUm;6*C-F4xg_EQj4<}IPzQboE3inp<8l8 literal 0 HcmV?d00001 diff --git a/frontend_miniprogram/miniprogram/assets/images/hero_v2.png b/frontend_miniprogram/miniprogram/assets/images/hero_v2.png new file mode 100644 index 0000000000000000000000000000000000000000..6eb4491f1287486fcf835825795ba7105f207051 GIT binary patch literal 42712 zcmbTdXH*ky*fkmm5I`h?M2bM@B`Q*t7OJ#}gaks9M`e2pADT#L0Rce}r5?WbJL_BL=Q-zIYi6xkGe2fex$eF9weREc<4M3102c=* z7bgc77bh18#Kp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frontend_miniprogram/miniprogram/assets/qr/qr_3.png new file mode 100644 index 0000000000000000000000000000000000000000..8638f4a975f9def240e90c131bd0cbba8d243eb2 GIT binary patch literal 2167 zcmeAS@N?(olHy`uVBq!ia0y~yV9Wqv4kn<;*YhyfXxLM|=I8!*w)43E*)i|Ge&GGN_iKKbZ@!-#|B+4p(8G!w ztd)9g)RO7el@vDNKKgrtv)Xm!u z)_vWtifaGkL~*`{1vYOEDat?*vfHuCCink;^332y{lk1QnBKnjSc{g!A2)Ef7eG7; z^eYHKOvWc``2D%Tjq*+FE1D_xsdDRKiyJp@-hR))Zf(80Ktce8sBkGOd-$Q_&6_ue z5*;v!hk`e6-VC;|5wNzd{w@13Aw6B3k2wj2=s$5zPeyLy+_|w9JRO*XjS^5RS37%B zdV2nTWf?3Mf$V5Kth{OSX6|;zjhKXcN_x8g!w*2$y?I;S(u~C-pdGslKt3sZXrO>e zfW4_}5eAGaaXw&*0452xBbWpz znb@`-X5P4Y^Y;6Kd{`n36jz79sjl^K!wq1%KqElOWO+daFqXf4Qzthy*$eYM1}0_u ze-x*t?G&3Z2*T0&&_OH_28^p%3sCOGC^NuC2q?RK6XD}Oa_-!{I(JYBgDtMO+d;V( zqs#yoA)sV3@6f|WP~kM6+|=~f$D#*VB>ep$Onz#zVXu2HU9Vi5VY7v zs-F-=97@3sRskwN|BHc=*8X?EN&rz#Vix#_QkbJ1sXBpF3BV*@&eaZb%-`8afeNe8 zkkljc7)mt(Rsk#tzs)_A2+SkJ!198CN@&4}r78xN$nQl!ewq&~{}H7tc9qbu!y0V1 bfA%eY-f7a3`nwj`pkVNH^>bP0l+XkKb?V?6 literal 0 HcmV?d00001 diff --git a/frontend_miniprogram/miniprogram/assets/qr/qr_4.png b/frontend_miniprogram/miniprogram/assets/qr/qr_4.png new file mode 100644 index 0000000000000000000000000000000000000000..f8d87e6d4f43f6721b23c67443b4f34f837f0919 GIT binary patch literal 2172 zcmeAS@N?(olHy`uVBq!ia0y~yV9Wqv4kn<;*YJP?_PuF-frVVzLjk_yhxKHD zMnVwS;KLs`aJLg7`=i{#?ca^5|0m8qoDl!?zK+bHhZQ$koh>jN1T~(pZ1TJ31~dEq{$3p|Yva)aA%3GS}&W*L;=|CZD zl&p6bRJfFtl|3|2z$89&ym|9RQ%0_1?%ch9WgjM_r;GD3C!rAiC(h}~$W6pzHrOhl z1=iJE?d(bE>G}5L8t{8&fdsp?_3w|uK(Ao96y(T54+U@DyxDrV;RYt5ylM01&bSeUa8CgSD=;uoj78W23SryU!^|5uZ{EIN zSq2y_*j(9q801+Dv%yvYElBr&_yOp@H*eo_P#O$mhvWH{!xlGg-t3=GX(-ftgUrE* za$o>(w}bqOky6147Zk$t4n1rHYQ245kkaHd2r^Z@JEg(kPp$!VYBI-wnW63v#YIc> zKxV4PmLK-&|8e_g3-pZLcVJzB$aR>t0-}_JRzJvvI53~R7vX!HkUk$+OdtvoXr+f- zHz5j9G-|>dUGv`yn=*O53J4Oi9VM2ZOQX(>Ko&G3y|HTD02vm`r5I% z7Kg0ILj%6DvTxsnfn?c30|gY~L&uvphaL*vym_QFvzJGW`nH)T9EGl@B>iOo44;d z*sZO17f1-85EU-KPyvMnhS^}NzyTC&VIu(a%WvyL2eCL6=*n0NkY_Q>23rNP;F|~^ z|B-X&?)~edG#KWSYrtP0i=O7Wb8G)|QW^@|TY%;fBufeS_SDer%qQ|6e5zZscgI!%f_ChY+>B^W$i L{an^LB{Ts5l=#*z literal 0 HcmV?d00001 diff --git a/frontend_miniprogram/miniprogram/components/action-dock/action-dock.json b/frontend_miniprogram/miniprogram/components/action-dock/action-dock.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/action-dock/action-dock.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/frontend_miniprogram/miniprogram/components/action-dock/action-dock.less b/frontend_miniprogram/miniprogram/components/action-dock/action-dock.less new file mode 100644 index 0000000..5892206 --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/action-dock/action-dock.less @@ -0,0 +1,64 @@ +.action-dock { + display: flex; + justify-content: space-around; + align-items: center; + padding: 16rpx var(--spacing-lg) calc(16rpx + env(safe-area-inset-bottom)); + background: rgba(255, 255, 255, 0.95); + backdrop-filter: blur(10px); + border-top: 1rpx solid var(--border-color); + position: fixed; + bottom: 0; + left: 0; + width: 100%; + box-sizing: border-box; + z-index: 100; + box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.03); +} + +.action-item { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 6rpx; + color: var(--text-secondary); + font-size: 20rpx; + flex: 1; +} + +.action-btn { + margin: 0; + padding: 0; + border: 0; + background: transparent; + line-height: inherit; + border-radius: 0; + display: flex; + flex-direction: column; + align-items: center; +} + +.action-btn::after { + border: none; +} + +.icon { + width: 48rpx; + height: 48rpx; + display: flex; + align-items: center; + justify-content: center; + font-size: 32rpx; + /* Emoji size */ + margin-bottom: 4rpx; + transition: transform 0.1s; +} + +.action-btn:active .icon { + transform: scale(0.9); +} + +.action-text { + font-size: 20rpx; + color: var(--text-secondary); +} \ No newline at end of file diff --git a/frontend_miniprogram/miniprogram/components/action-dock/action-dock.ts b/frontend_miniprogram/miniprogram/components/action-dock/action-dock.ts new file mode 100644 index 0000000..a555284 --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/action-dock/action-dock.ts @@ -0,0 +1,8 @@ +Component({ + methods: { + handleAction(event: WechatMiniprogram.TouchEvent) { + const action = event.currentTarget.dataset.action as string; + this.triggerEvent('action', { action }); + }, + }, +}); diff --git a/frontend_miniprogram/miniprogram/components/action-dock/action-dock.wxml b/frontend_miniprogram/miniprogram/components/action-dock/action-dock.wxml new file mode 100644 index 0000000..323805d --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/action-dock/action-dock.wxml @@ -0,0 +1,14 @@ + + + + 收下名片 + + + + + 律所导航 + + diff --git a/frontend_miniprogram/miniprogram/components/app-header/app-header.json b/frontend_miniprogram/miniprogram/components/app-header/app-header.json new file mode 100644 index 0000000..6f376cb --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/app-header/app-header.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "navigation-bar": "/components/navigation-bar/navigation-bar" + } +} diff --git a/frontend_miniprogram/miniprogram/components/app-header/app-header.less b/frontend_miniprogram/miniprogram/components/app-header/app-header.less new file mode 100644 index 0000000..5d4e87f --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/app-header/app-header.less @@ -0,0 +1,3 @@ +:host { + display: block; +} diff --git a/frontend_miniprogram/miniprogram/components/app-header/app-header.ts b/frontend_miniprogram/miniprogram/components/app-header/app-header.ts new file mode 100644 index 0000000..70756f7 --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/app-header/app-header.ts @@ -0,0 +1,20 @@ +Component({ + properties: { + title: { + type: String, + value: '', + }, + back: { + type: Boolean, + value: false, + }, + background: { + type: String, + value: '#F4F4F4', + }, + color: { + type: String, + value: '#1f1f1f', + }, + }, +}); diff --git a/frontend_miniprogram/miniprogram/components/app-header/app-header.wxml b/frontend_miniprogram/miniprogram/components/app-header/app-header.wxml new file mode 100644 index 0000000..facbadc --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/app-header/app-header.wxml @@ -0,0 +1,6 @@ + diff --git a/frontend_miniprogram/miniprogram/components/empty-state/empty-state.json b/frontend_miniprogram/miniprogram/components/empty-state/empty-state.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/empty-state/empty-state.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/frontend_miniprogram/miniprogram/components/empty-state/empty-state.less b/frontend_miniprogram/miniprogram/components/empty-state/empty-state.less new file mode 100644 index 0000000..4a37891 --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/empty-state/empty-state.less @@ -0,0 +1,25 @@ +.empty-wrap { + padding: 140rpx 40rpx; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} + +.empty-icon { + width: 80rpx; + height: 80rpx; + border-radius: 24rpx; + background: var(--bg-surface); + display: flex; + align-items: center; + justify-content: center; + font-size: 36rpx; + margin-bottom: var(--spacing-md); + color: var(--text-tertiary); +} + +.empty-text { + font-size: 26rpx; + color: var(--text-secondary); +} \ No newline at end of file diff --git a/frontend_miniprogram/miniprogram/components/empty-state/empty-state.ts b/frontend_miniprogram/miniprogram/components/empty-state/empty-state.ts new file mode 100644 index 0000000..6811a9c --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/empty-state/empty-state.ts @@ -0,0 +1,8 @@ +Component({ + properties: { + text: { + type: String, + value: '暂无数据', + }, + }, +}); diff --git a/frontend_miniprogram/miniprogram/components/empty-state/empty-state.wxml b/frontend_miniprogram/miniprogram/components/empty-state/empty-state.wxml new file mode 100644 index 0000000..cc00cee --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/empty-state/empty-state.wxml @@ -0,0 +1,4 @@ + + + {{text}} + diff --git a/frontend_miniprogram/miniprogram/components/filter-bar/filter-bar.json b/frontend_miniprogram/miniprogram/components/filter-bar/filter-bar.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/filter-bar/filter-bar.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/frontend_miniprogram/miniprogram/components/filter-bar/filter-bar.less b/frontend_miniprogram/miniprogram/components/filter-bar/filter-bar.less new file mode 100644 index 0000000..3c193f1 --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/filter-bar/filter-bar.less @@ -0,0 +1,50 @@ +.filter-wrap { + display: flex; + gap: 16rpx; + padding: 0 24rpx 16rpx; + background: var(--bg-page); + /* Use variable */ +} + +.filter-item { + height: 84rpx; + padding: 0 18rpx; + border-radius: 14rpx; + border: 1rpx solid var(--border-color); + /* Use variable */ + background: #fff; + /* Card bg */ + display: flex; + align-items: center; + gap: 10rpx; +} + +picker { + flex: 1; + min-width: 0; +} + +.label { + font-size: 22rpx; + color: var(--text-tertiary); + /* Use variable */ + flex-shrink: 0; +} + +.value { + flex: 1; + min-width: 0; + font-size: 26rpx; + color: var(--text-main); + /* Use variable */ + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +.arrow { + color: var(--text-placeholder); + /* Use variable */ + font-size: 20rpx; + flex-shrink: 0; +} \ No newline at end of file diff --git a/frontend_miniprogram/miniprogram/components/filter-bar/filter-bar.ts b/frontend_miniprogram/miniprogram/components/filter-bar/filter-bar.ts new file mode 100644 index 0000000..614bc14 --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/filter-bar/filter-bar.ts @@ -0,0 +1,34 @@ +Component({ + properties: { + officeOptions: { + type: Array, + value: [], + }, + areaOptions: { + type: Array, + value: [], + }, + selectedOffice: { + type: String, + value: '所有办公机构', + }, + selectedArea: { + type: String, + value: '全部专业领域', + }, + }, + methods: { + handleOfficeChange(event: WechatMiniprogram.CustomEvent<{ value: string }>) { + const officeOptions = this.properties.officeOptions as string[]; + const index = Number(event.detail.value); + const value = officeOptions[index] || officeOptions[0] || '所有办公机构'; + this.triggerEvent('officechange', { value, index }); + }, + handleAreaChange(event: WechatMiniprogram.CustomEvent<{ value: string }>) { + const areaOptions = this.properties.areaOptions as string[]; + const index = Number(event.detail.value); + const value = areaOptions[index] || areaOptions[0] || '全部专业领域'; + this.triggerEvent('areachange', { value, index }); + }, + }, +}); diff --git a/frontend_miniprogram/miniprogram/components/filter-bar/filter-bar.wxml b/frontend_miniprogram/miniprogram/components/filter-bar/filter-bar.wxml new file mode 100644 index 0000000..0499e1e --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/filter-bar/filter-bar.wxml @@ -0,0 +1,16 @@ + + + + 机构 + {{selectedOffice}} + + + + + + 领域 + {{selectedArea}} + + + + diff --git a/frontend_miniprogram/miniprogram/components/lawyer-card/lawyer-card.json b/frontend_miniprogram/miniprogram/components/lawyer-card/lawyer-card.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/lawyer-card/lawyer-card.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/frontend_miniprogram/miniprogram/components/lawyer-card/lawyer-card.less b/frontend_miniprogram/miniprogram/components/lawyer-card/lawyer-card.less new file mode 100644 index 0000000..72699dc --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/lawyer-card/lawyer-card.less @@ -0,0 +1,97 @@ +.lawyer-card { + display: flex; + align-items: center; + background: var(--bg-card); + border-radius: var(--border-radius-base); + padding: var(--spacing-md); + box-shadow: var(--shadow-sm); + position: relative; + overflow: hidden; + transition: transform 0.1s; +} + +.lawyer-card:active { + transform: scale(0.98); +} + +.avatar { + width: 100rpx; + height: 100rpx; + border-radius: 50%; + border: 4rpx solid var(--bg-page); + flex-shrink: 0; + margin-right: var(--spacing-sm); + background: var(--bg-surface); +} + +.content { + flex: 1; + min-width: 0; + display: flex; + flex-direction: column; + justify-content: center; +} + +.header-row { + display: flex; + align-items: center; + margin-bottom: 6rpx; +} + +.name { + font-size: 32rpx; + font-weight: 600; + color: var(--text-main); + margin-right: 12rpx; +} + +.title { + font-size: 22rpx; + color: var(--primary-color); + background: rgba(142, 34, 48, 0.08); + /* Primary opacity */ + padding: 2rpx 10rpx; + border-radius: 8rpx; + font-weight: 500; +} + +.office { + font-size: 24rpx; + color: var(--text-tertiary); + margin-bottom: 12rpx; +} + +.tags-row { + display: flex; + flex-wrap: wrap; + gap: 8rpx; +} + +.tag { + font-size: 20rpx; + color: var(--text-secondary); + background: var(--bg-page); + padding: 4rpx 12rpx; + border-radius: 6rpx; +} + +.tag-more { + font-size: 20rpx; + color: var(--text-tertiary); + padding: 4rpx 0; +} + +.action-col { + margin-left: var(--spacing-md); + display: flex; + align-items: center; +} + +.consult-btn { + font-size: 24rpx; + color: var(--primary-color); + border: 1rpx solid var(--primary-color); + padding: 6rpx 20rpx; + border-radius: 24rpx; + font-weight: 500; +} \ No newline at end of file diff --git a/frontend_miniprogram/miniprogram/components/lawyer-card/lawyer-card.ts b/frontend_miniprogram/miniprogram/components/lawyer-card/lawyer-card.ts new file mode 100644 index 0000000..60206c0 --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/lawyer-card/lawyer-card.ts @@ -0,0 +1,33 @@ +Component({ + data: { + specialtiesText: '', + }, + properties: { + lawyer: { + type: Object, + value: null, + }, + showOffice: { + type: Boolean, + value: true, + }, + }, + observers: { + lawyer(lawyer: { specialties?: string[] } | null) { + const specialties = + lawyer && Array.isArray(lawyer.specialties) ? lawyer.specialties : []; + this.setData({ + specialties, // Expose array for wx:for + specialtiesText: specialties.join(' | '), + }); + }, + }, + methods: { + handleTap() { + const lawyer = this.properties.lawyer as { id?: string } | null; + this.triggerEvent('select', { + id: lawyer && typeof lawyer.id === 'string' ? lawyer.id : '', + }); + }, + }, +}); diff --git a/frontend_miniprogram/miniprogram/components/lawyer-card/lawyer-card.wxml b/frontend_miniprogram/miniprogram/components/lawyer-card/lawyer-card.wxml new file mode 100644 index 0000000..679925f --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/lawyer-card/lawyer-card.wxml @@ -0,0 +1,21 @@ + + + + + + {{lawyer.name}} + {{lawyer.title}} + + + {{lawyer.office}} + + + {{item}} + ... + + + + + 咨询 + + diff --git a/frontend_miniprogram/miniprogram/components/navigation-bar/navigation-bar.json b/frontend_miniprogram/miniprogram/components/navigation-bar/navigation-bar.json new file mode 100644 index 0000000..4a20f17 --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/navigation-bar/navigation-bar.json @@ -0,0 +1,5 @@ +{ + "component": true, + "styleIsolation": "apply-shared", + "usingComponents": {} +} \ No newline at end of file diff --git a/frontend_miniprogram/miniprogram/components/navigation-bar/navigation-bar.less b/frontend_miniprogram/miniprogram/components/navigation-bar/navigation-bar.less new file mode 100644 index 0000000..8bd379e --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/navigation-bar/navigation-bar.less @@ -0,0 +1,96 @@ +.weui-navigation-bar { + --weui-FG-0:rgba(0,0,0,.9); + --height: 44px; + --left: 16px; +} +.weui-navigation-bar .android { + --height: 48px; +} + +.weui-navigation-bar { + overflow: hidden; + color: var(--weui-FG-0); + flex: none; +} + +.weui-navigation-bar__inner { + position: relative; + top: 0; + left: 0; + height: calc(var(--height) + env(safe-area-inset-top)); + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + padding-top: env(safe-area-inset-top); + width: 100%; + box-sizing: border-box; +} + +.weui-navigation-bar__left { + position: relative; + padding-left: var(--left); + display: flex; + flex-direction: row; + align-items: flex-start; + height: 100%; + box-sizing: border-box; +} + +.weui-navigation-bar__btn_goback_wrapper { + padding: 11px 18px 11px 16px; + margin: -11px -18px -11px -16px; +} + +.weui-navigation-bar__btn_goback_wrapper.weui-active { + opacity: 0.5; +} + +.weui-navigation-bar__btn_goback { + font-size: 12px; + width: 12px; + height: 24px; + -webkit-mask: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='24' viewBox='0 0 12 24'%3E %3Cpath fill-opacity='.9' fill-rule='evenodd' d='M10 19.438L8.955 20.5l-7.666-7.79a1.02 1.02 0 0 1 0-1.42L8.955 3.5 10 4.563 2.682 12 10 19.438z'/%3E%3C/svg%3E") no-repeat 50% 50%; + mask: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='24' viewBox='0 0 12 24'%3E %3Cpath fill-opacity='.9' fill-rule='evenodd' d='M10 19.438L8.955 20.5l-7.666-7.79a1.02 1.02 0 0 1 0-1.42L8.955 3.5 10 4.563 2.682 12 10 19.438z'/%3E%3C/svg%3E") no-repeat 50% 50%; + -webkit-mask-size: cover; + mask-size: cover; + background-color: var(--weui-FG-0); +} + +.weui-navigation-bar__center { + font-size: 17px; + text-align: center; + position: relative; + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + font-weight: bold; + flex: 1; + height: 100%; +} + +.weui-navigation-bar__loading { + margin-right: 4px; + align-items: center; +} + +.weui-loading { + font-size: 16px; + width: 16px; + height: 16px; + display: block; + background: transparent url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='80px' height='80px' viewBox='0 0 80 80' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Ctitle%3Eloading%3C/title%3E%3Cdefs%3E%3ClinearGradient x1='94.0869141%25' y1='0%25' x2='94.0869141%25' y2='90.559082%25' id='linearGradient-1'%3E%3Cstop stop-color='%23606060' stop-opacity='0' offset='0%25'%3E%3C/stop%3E%3Cstop stop-color='%23606060' stop-opacity='0.3' offset='100%25'%3E%3C/stop%3E%3C/linearGradient%3E%3ClinearGradient x1='100%25' y1='8.67370605%25' x2='100%25' y2='90.6286621%25' id='linearGradient-2'%3E%3Cstop stop-color='%23606060' offset='0%25'%3E%3C/stop%3E%3Cstop stop-color='%23606060' stop-opacity='0.3' offset='100%25'%3E%3C/stop%3E%3C/linearGradient%3E%3C/defs%3E%3Cg stroke='none' stroke-width='1' fill='none' fill-rule='evenodd' opacity='0.9'%3E%3Cg%3E%3Cpath d='M40,0 C62.09139,0 80,17.90861 80,40 C80,62.09139 62.09139,80 40,80 L40,73 C58.2253967,73 73,58.2253967 73,40 C73,21.7746033 58.2253967,7 40,7 L40,0 Z' fill='url(%23linearGradient-1)'%3E%3C/path%3E%3Cpath d='M40,0 L40,7 C21.7746033,7 7,21.7746033 7,40 C7,58.2253967 21.7746033,73 40,73 L40,80 C17.90861,80 0,62.09139 0,40 C0,17.90861 17.90861,0 40,0 Z' fill='url(%23linearGradient-2)'%3E%3C/path%3E%3Ccircle id='Oval' fill='%23606060' cx='40.5' cy='3.5' r='3.5'%3E%3C/circle%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A") no-repeat; + background-size: 100%; + margin-left: 0; + animation: loading linear infinite 1s; +} + +@keyframes loading { + from { + transform: rotate(0); + } + to { + transform: rotate(360deg); + } +} diff --git a/frontend_miniprogram/miniprogram/components/navigation-bar/navigation-bar.ts b/frontend_miniprogram/miniprogram/components/navigation-bar/navigation-bar.ts new file mode 100644 index 0000000..4466e8e --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/navigation-bar/navigation-bar.ts @@ -0,0 +1,105 @@ +Component({ + options: { + multipleSlots: true // 在组件定义时的选项中启用多slot支持 + }, + /** + * 组件的属性列表 + */ + properties: { + extClass: { + type: String, + value: '' + }, + title: { + type: String, + value: '' + }, + background: { + type: String, + value: '' + }, + color: { + type: String, + value: '' + }, + back: { + type: Boolean, + value: true + }, + loading: { + type: Boolean, + value: false + }, + homeButton: { + type: Boolean, + value: false, + }, + animated: { + // 显示隐藏的时候opacity动画效果 + type: Boolean, + value: true + }, + show: { + // 显示隐藏导航,隐藏的时候navigation-bar的高度占位还在 + type: Boolean, + value: true, + observer: '_showChange' + }, + // back为true的时候,返回的页面深度 + delta: { + type: Number, + value: 1 + }, + }, + /** + * 组件的初始数据 + */ + data: { + displayStyle: '' + }, + lifetimes: { + attached() { + const rect = wx.getMenuButtonBoundingClientRect() + wx.getSystemInfo({ + success: (res) => { + const isAndroid = res.platform === 'android' + const isDevtools = res.platform === 'devtools' + this.setData({ + ios: !isAndroid, + innerPaddingRight: `padding-right: ${res.windowWidth - rect.left}px`, + leftWidth: `width: ${res.windowWidth - rect.left }px`, + safeAreaTop: isDevtools || isAndroid ? `height: calc(var(--height) + ${res.safeArea.top}px); padding-top: ${res.safeArea.top}px` : `` + }) + } + }) + }, + }, + /** + * 组件的方法列表 + */ + methods: { + _showChange(show: boolean) { + const animated = this.data.animated + let displayStyle = '' + if (animated) { + displayStyle = `opacity: ${ + show ? '1' : '0' + };transition:opacity 0.5s;` + } else { + displayStyle = `display: ${show ? '' : 'none'}` + } + this.setData({ + displayStyle + }) + }, + back() { + const data = this.data + if (data.delta) { + wx.navigateBack({ + delta: data.delta + }) + } + this.triggerEvent('back', { delta: data.delta }, {}) + } + }, +}) diff --git a/frontend_miniprogram/miniprogram/components/navigation-bar/navigation-bar.wxml b/frontend_miniprogram/miniprogram/components/navigation-bar/navigation-bar.wxml new file mode 100644 index 0000000..be9a663 --- /dev/null +++ b/frontend_miniprogram/miniprogram/components/navigation-bar/navigation-bar.wxml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{title}} + + + + + + + + + + + + diff --git a/frontend_miniprogram/miniprogram/config/runtime.ts b/frontend_miniprogram/miniprogram/config/runtime.ts new file mode 100644 index 0000000..46ee6d1 --- /dev/null +++ b/frontend_miniprogram/miniprogram/config/runtime.ts @@ -0,0 +1,16 @@ +export type MiniProgramEnvVersion = 'develop' | 'trial' | 'release'; + +export const API_BASE_URL_OVERRIDE_KEY = 'api_base_url_override'; + +export interface TenantRuntimeConfig { + apiBaseUrlByEnv: Record; +} + +// develop 环境允许本地联调;trial/release 请替换为已备案且已配置到小程序后台“服务器域名”的 HTTPS 域名。 +export const tenantRuntimeConfig: TenantRuntimeConfig = { + apiBaseUrlByEnv: { + develop: 'http://127.0.0.1:8112', + trial: 'https://trial-api.example.com', + release: 'https://api.example.com', + }, +}; diff --git a/frontend_miniprogram/miniprogram/constants/storage.ts b/frontend_miniprogram/miniprogram/constants/storage.ts new file mode 100644 index 0000000..6f6e9ef --- /dev/null +++ b/frontend_miniprogram/miniprogram/constants/storage.ts @@ -0,0 +1 @@ +export const CARD_VIEW_HISTORY_KEY = 'card_view_history_v1'; diff --git a/frontend_miniprogram/miniprogram/data/mock.ts b/frontend_miniprogram/miniprogram/data/mock.ts new file mode 100644 index 0000000..1b0da5e --- /dev/null +++ b/frontend_miniprogram/miniprogram/data/mock.ts @@ -0,0 +1,102 @@ +import type { FirmInfo, Lawyer } from '../types/card'; + +export const firmInfo: FirmInfo = { + id: 'firm_xx', + name: 'XX律师事务所', + logo: '/assets/images/logo.png', // Keep path, but UI uses placeholder + heroImage: '/assets/images/hero_v2.png', + hotlinePhone: '13800138000', + hqAddress: '南京市江宁区紫金研创中心', + hqLatitude: 31.932, // Approximate for Jiangning Zijin + hqLongitude: 118.825, + officeCount: 4, + lawyerCount: 5, + officeList: ['南京总部', '北京分所', '上海分所', '深圳分所'], + practiceAreas: [ + '民商事', + '婚姻家事', + '企业合规', + '公司法务', + '数字经济', + '破产法', + '私人财富管理', + '合同纠纷', + '劳动争议', + '知识产权', + ], + intro: + 'XX律师事务所是一家综合性律师事务所,长期聚焦民商事争议解决、公司治理与合规管理、婚姻家事与私人财富管理等方向。律所总部位于南京,面向企业与个人客户提供规范、专业、可持续的法律服务。\n\n截至目前,本所在多地设有分支办公室,拥有成熟的专业委员会体系与协同办案机制,已为大量企事业单位和个人客户提供法律顾问及专项法律服务。', +}; + +export const lawyers: Lawyer[] = [ + { + id: 'lawyer_zhangsan', + name: '张三', + title: '高级合伙人', + office: '南京总部', + phone: '13800138000', + email: 'zhangsan@xx-law.com', + address: '南京市江宁区紫金研创中心', + avatar: '/assets/images/avatar_1.png', + coverImage: '', + specialties: ['企业合规', '公司法务', '数字经济', '破产法'], + bio: '长期服务于企业客户,擅长企业合规体系建设、股权与治理结构优化、公司争议解决。', + wechatQrImage: '/assets/qr/qr_1.png', + }, + { + id: 'lawyer_lisi', + name: '李四', + title: '资深律师', + office: '南京总部', + phone: '13800138001', + email: 'lisi@xx-law.com', + address: '南京市江宁区紫金研创中心', + avatar: '/assets/images/avatar_2.png', + coverImage: '', + specialties: ['婚姻家事', '私人财富管理'], + bio: '专注婚姻家事和财富管理争议,注重非诉协商与诉讼策略并行。', + wechatQrImage: '/assets/qr/qr_2.png', + }, + { + id: 'lawyer_wangwu', + name: '王五', + title: '律师', + office: '北京分所', + phone: '13800138002', + email: 'wangwu@xx-law.com', + address: '北京市朝阳区国贸CBD', + avatar: '/assets/images/avatar_3.png', + coverImage: '', + specialties: ['民商事', '合同纠纷'], + bio: '擅长民商事纠纷案件办理,兼具庭审攻防与证据组织能力。', + wechatQrImage: '/assets/qr/qr_3.png', + }, + { + id: 'lawyer_zhaoliu', + name: '赵六', + title: '律师', + office: '上海分所', + phone: '13800138003', + email: 'zhaoliu@xx-law.com', + address: '上海市浦东新区陆家嘴', + avatar: '/assets/images/avatar_4.png', + coverImage: '', + specialties: ['劳动争议', '公司法务'], + bio: '长期服务成长型企业,熟悉劳动用工、合同管理和风险治理。', + wechatQrImage: '/assets/qr/qr_4.png', + }, + { + id: 'lawyer_sunqi', + name: '孙七', + title: '律师', + office: '深圳分所', + phone: '13800138004', + email: 'sunqi@xx-law.com', + address: '深圳市福田区中心商务区', + avatar: '/assets/images/avatar_5.png', + coverImage: '', + specialties: ['知识产权', '数字经济'], + bio: '专注数字经济与知识产权争议处理,擅长平台与内容合规。', + wechatQrImage: '/assets/qr/qr_5.png', + }, +]; diff --git a/frontend_miniprogram/miniprogram/pages/firm/index.json b/frontend_miniprogram/miniprogram/pages/firm/index.json new file mode 100644 index 0000000..6730b10 --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/firm/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "app-header": "/components/app-header/app-header" + } +} diff --git a/frontend_miniprogram/miniprogram/pages/firm/index.less b/frontend_miniprogram/miniprogram/pages/firm/index.less new file mode 100644 index 0000000..49a4f18 --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/firm/index.less @@ -0,0 +1,182 @@ +.firm-page { + background: var(--bg-page); +} + +.hero-section { + position: relative; + height: 520rpx; + width: 100%; + display: flex; + flex-direction: column; + justify-content: flex-end; + padding-bottom: 80rpx; + /* Space for overlap */ +} + +.hero-bg { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 0; +} + +.hero-overlay { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + /* Updated gradient to match Burgundy Red */ + background: linear-gradient(to bottom, rgba(142, 34, 48, 0.4), rgba(92, 13, 21, 0.9)); + z-index: 1; +} + +.hero-content { + position: relative; + z-index: 2; + padding: 0 var(--spacing-lg); + display: flex; + flex-direction: column; + margin-bottom: 72rpx; +} + +.firm-stats { + display: inline-flex; + align-items: center; + width: fit-content; + padding: 14rpx 22rpx; + border-radius: 20rpx; + border: 1rpx solid rgba(255, 255, 255, 0.32); + background: linear-gradient(120deg, rgba(10, 21, 34, 0.62), rgba(19, 38, 56, 0.36)); + box-shadow: 0 10rpx 28rpx rgba(7, 15, 27, 0.35), inset 0 1rpx 0 rgba(255, 255, 255, 0.24); + backdrop-filter: blur(10rpx); + -webkit-backdrop-filter: blur(10rpx); +} + +.stat-item { + display: flex; + flex-direction: column; + min-width: 120rpx; +} + +.stat-num { + font-size: 44rpx; + font-weight: 700; + color: #fff; + line-height: 1.2; + text-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.35); +} + +.stat-label { + font-size: 24rpx; + color: rgba(242, 247, 252, 0.92); + margin-top: 4rpx; + text-shadow: 0 1rpx 8rpx rgba(0, 0, 0, 0.28); +} + +.stat-divider { + width: 2rpx; + height: 40rpx; + background: linear-gradient(to bottom, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.12)); + margin: 0 24rpx; +} + +.content-container { + position: relative; + z-index: 3; + margin-top: -60rpx; + background: var(--bg-page); + border-radius: 32rpx 32rpx 0 0; + padding: var(--spacing-lg) var(--spacing-md); + min-height: 50vh; +} + +.address-card { + display: flex; + align-items: center; + justify-content: space-between; + padding: var(--spacing-md); + margin-bottom: var(--spacing-lg); + background: #fff; + box-shadow: var(--shadow-base); +} + +.address-info { + display: flex; + flex-direction: column; + gap: 8rpx; +} + +.address-label { + font-size: 24rpx; + color: var(--text-tertiary); +} + +.address-text { + font-size: 28rpx; + color: var(--text-main); + font-weight: 500; +} + +.address-icon { + font-size: 32rpx; + color: var(--text-tertiary); +} + +.section { + margin-bottom: var(--spacing-xl); +} + +.intro-text { + font-size: 28rpx; + color: var(--text-secondary); + line-height: 1.8; + text-align: justify; +} + +.tags-wrapper { + display: flex; + flex-wrap: wrap; + gap: 16rpx; +} + +.area-tag { + font-size: 26rpx; + color: var(--primary-color); + background: rgba(142, 34, 48, 0.08); + /* Primary color opacity */ + padding: 10rpx 24rpx; + border-radius: 32rpx; + font-weight: 500; +} + +.bottom-bar { + position: fixed; + bottom: 0; + left: 0; + width: 100%; + background: #fff; + padding: 20rpx var(--spacing-md); + box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05); + z-index: 10; + box-sizing: border-box; +} + +.cta-btn { + background: var(--primary-color); + color: #fff; + font-size: 32rpx; + font-weight: 500; + border-radius: 50rpx; + height: 88rpx; + display: flex; + align-items: center; + justify-content: center; + box-shadow: 0 8rpx 20rpx rgba(142, 34, 48, 0.3); +} + +.cta-btn::after { + border: none; +} diff --git a/frontend_miniprogram/miniprogram/pages/firm/index.ts b/frontend_miniprogram/miniprogram/pages/firm/index.ts new file mode 100644 index 0000000..2bb78d7 --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/firm/index.ts @@ -0,0 +1,71 @@ +import { getFirmProfile } from '../../api/open'; +import type { FirmInfo } from '../../types/card'; + +function createEmptyFirm(): FirmInfo { + return { + id: '', + name: '', + logo: '', + intro: '', + hotlinePhone: '', + hqAddress: '', + hqLatitude: 0, + hqLongitude: 0, + officeCount: 0, + lawyerCount: 0, + heroImage: '', + officeList: [], + practiceAreas: [], + }; +} + +Page({ + data: { + firm: createEmptyFirm(), + loading: false, + }, + onLoad() { + this.loadFirmProfile(); + }, + async loadFirmProfile() { + this.setData({ loading: true }); + try { + const firm = await getFirmProfile(); + this.setData({ firm }); + } catch (error) { + const message = error instanceof Error ? error.message : '加载事务所信息失败'; + wx.showToast({ + title: message, + icon: 'none', + }); + } finally { + this.setData({ loading: false }); + } + }, + goLawyerList() { + wx.navigateTo({ + url: '/pages/lawyer-list/index', + }); + }, + openLocation() { + const { firm } = this.data; + if (!firm.hqLatitude || !firm.hqLongitude) { + wx.showToast({ + title: '暂未配置地图位置', + icon: 'none', + }); + return; + } + + wx.openLocation({ + latitude: firm.hqLatitude, + longitude: firm.hqLongitude, + name: firm.name, + address: firm.hqAddress, + scale: 18, + fail: () => { + wx.showToast({ title: '打开地图失败', icon: 'none' }); + }, + }); + }, +}); diff --git a/frontend_miniprogram/miniprogram/pages/firm/index.wxml b/frontend_miniprogram/miniprogram/pages/firm/index.wxml new file mode 100644 index 0000000..786d8bc --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/firm/index.wxml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + {{firm.officeCount}} + 办公机构 + + + + {{firm.lawyerCount}} + 专业律师 + + + + + + + + + + + + 总部地址 + {{firm.hqAddress}} + + > + + + + + 律所简介 + {{firm.intro}} + + + + + 专业领域 + + {{item}} + + + + + + + + + + + + diff --git a/frontend_miniprogram/miniprogram/pages/history/index.json b/frontend_miniprogram/miniprogram/pages/history/index.json new file mode 100644 index 0000000..f6c950c --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/history/index.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "app-header": "/components/app-header/app-header", + "lawyer-card": "/components/lawyer-card/lawyer-card", + "empty-state": "/components/empty-state/empty-state" + } +} diff --git a/frontend_miniprogram/miniprogram/pages/history/index.less b/frontend_miniprogram/miniprogram/pages/history/index.less new file mode 100644 index 0000000..cfb11ca --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/history/index.less @@ -0,0 +1,39 @@ +.history-page { + background: var(--theme-bg); +} + +.actions { + padding: 14rpx 24rpx 0; + display: flex; + justify-content: flex-end; +} + +.clear-btn { + margin: 0; + width: 156rpx; + height: 60rpx; + line-height: 60rpx; + border-radius: 12rpx; + border: 1rpx solid var(--theme-border); + font-size: 24rpx; + color: var(--theme-primary); + background: #fff; +} + +.clear-btn::after { + border: none; +} + +.history-list { + padding: 16rpx 24rpx 30rpx; +} + +.history-item { + margin-bottom: 16rpx; +} + +.history-time { + margin: 10rpx 10rpx 0; + font-size: 22rpx; + color: #8e96a6; +} diff --git a/frontend_miniprogram/miniprogram/pages/history/index.ts b/frontend_miniprogram/miniprogram/pages/history/index.ts new file mode 100644 index 0000000..36fb060 --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/history/index.ts @@ -0,0 +1,80 @@ +import { clearCardViewHistory, getCardViewHistory } from '../../utils/history'; +import { formatTime } from '../../utils/util'; +import type { Lawyer } from '../../types/card'; + +interface HistoryCardItem { + lawyer: Lawyer; + viewedAt: number; + timeText: string; +} + +function createFallbackLawyer(lawyerId: string): Lawyer { + return { + id: lawyerId, + name: '历史浏览名片', + title: '', + office: '', + phone: '', + email: '', + address: '', + avatar: '', + coverImage: '', + specialties: [], + bio: '', + wechatQrImage: '', + }; +} + +Page({ + data: { + items: [] as HistoryCardItem[], + }, + + onShow() { + this.loadHistory(); + }, + + loadHistory() { + const history = getCardViewHistory(); + if (!history.length) { + this.setData({ items: [] }); + return; + } + + const items = history + .map((record) => ({ + lawyer: record.lawyer || createFallbackLawyer(record.lawyerId), + viewedAt: record.viewedAt, + timeText: formatTime(new Date(record.viewedAt)), + })); + + this.setData({ items }); + }, + + handleLawyerSelect(event: WechatMiniprogram.CustomEvent<{ id: string }>) { + const lawyerId = event.detail.id; + if (!lawyerId) { + return; + } + wx.navigateTo({ + url: `/pages/lawyer-detail/index?id=${lawyerId}`, + }); + }, + + clearHistory() { + if (!this.data.items.length) { + return; + } + wx.showModal({ + title: '清空记录', + content: '确定清空所有名片查看记录吗?', + success: (res) => { + if (res.confirm) { + clearCardViewHistory(); + this.setData({ items: [] }); + wx.showToast({ title: '已清空', icon: 'success' }); + } + }, + }); + }, +}); diff --git a/frontend_miniprogram/miniprogram/pages/history/index.wxml b/frontend_miniprogram/miniprogram/pages/history/index.wxml new file mode 100644 index 0000000..008404b --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/history/index.wxml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + 查看时间:{{item.timeText}} + + + + + + + + + diff --git a/frontend_miniprogram/miniprogram/pages/index/index.json b/frontend_miniprogram/miniprogram/pages/index/index.json new file mode 100644 index 0000000..aa3f1b0 --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/index/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "navigation-bar": "/components/navigation-bar/navigation-bar" + } +} \ No newline at end of file diff --git a/frontend_miniprogram/miniprogram/pages/index/index.less b/frontend_miniprogram/miniprogram/pages/index/index.less new file mode 100644 index 0000000..f42417f --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/index/index.less @@ -0,0 +1,61 @@ +/**index.less**/ +page { + height: 100vh; + display: flex; + flex-direction: column; +} +.scrollarea { + flex: 1; + overflow-y: hidden; +} + +.userinfo { + display: flex; + flex-direction: column; + align-items: center; + color: #aaa; + width: 80%; +} + +.userinfo-avatar { + overflow: hidden; + width: 128rpx; + height: 128rpx; + margin: 20rpx; + border-radius: 50%; +} + +.usermotto { + margin-top: 200px; +} +.avatar-wrapper { + padding: 0; + width: 56px !important; + border-radius: 8px; + margin-top: 40px; + margin-bottom: 40px; +} + +.avatar { + display: block; + width: 56px; + height: 56px; +} + +.nickname-wrapper { + display: flex; + width: 100%; + padding: 16px; + box-sizing: border-box; + border-top: .5px solid rgba(0, 0, 0, 0.1); + border-bottom: .5px solid rgba(0, 0, 0, 0.1); + color: black; +} + +.nickname-label { + width: 105px; +} + +.nickname-input { + flex: 1; +} diff --git a/frontend_miniprogram/miniprogram/pages/index/index.ts b/frontend_miniprogram/miniprogram/pages/index/index.ts new file mode 100644 index 0000000..c7aaf97 --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/index/index.ts @@ -0,0 +1,54 @@ +// index.ts +// 获取应用实例 +const app = getApp() +const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0' + +Component({ + data: { + motto: 'Hello World', + userInfo: { + avatarUrl: defaultAvatarUrl, + nickName: '', + }, + hasUserInfo: false, + canIUseGetUserProfile: wx.canIUse('getUserProfile'), + canIUseNicknameComp: wx.canIUse('input.type.nickname'), + }, + methods: { + // 事件处理函数 + bindViewTap() { + wx.navigateTo({ + url: '../logs/logs', + }) + }, + onChooseAvatar(e: any) { + const { avatarUrl } = e.detail + const { nickName } = this.data.userInfo + this.setData({ + "userInfo.avatarUrl": avatarUrl, + hasUserInfo: nickName && avatarUrl && avatarUrl !== defaultAvatarUrl, + }) + }, + onInputChange(e: any) { + const nickName = e.detail.value + const { avatarUrl } = this.data.userInfo + this.setData({ + "userInfo.nickName": nickName, + hasUserInfo: nickName && avatarUrl && avatarUrl !== defaultAvatarUrl, + }) + }, + getUserProfile() { + // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 + wx.getUserProfile({ + desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 + success: (res) => { + console.log(res) + this.setData({ + userInfo: res.userInfo, + hasUserInfo: true + }) + } + }) + }, + }, +}) diff --git a/frontend_miniprogram/miniprogram/pages/index/index.wxml b/frontend_miniprogram/miniprogram/pages/index/index.wxml new file mode 100644 index 0000000..aab521d --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/index/index.wxml @@ -0,0 +1,28 @@ + + + + + + + + + 昵称 + + + + + + 请使用2.10.4及以上版本基础库 + + + + {{userInfo.nickName}} + + + + {{motto}} + + + diff --git a/frontend_miniprogram/miniprogram/pages/lawyer-detail/index.json b/frontend_miniprogram/miniprogram/pages/lawyer-detail/index.json new file mode 100644 index 0000000..afa1cdc --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/lawyer-detail/index.json @@ -0,0 +1,8 @@ +{ + "enableShareAppMessage": true, + "usingComponents": { + "app-header": "/components/app-header/app-header", + "action-dock": "/components/action-dock/action-dock", + "empty-state": "/components/empty-state/empty-state" + } +} diff --git a/frontend_miniprogram/miniprogram/pages/lawyer-detail/index.less b/frontend_miniprogram/miniprogram/pages/lawyer-detail/index.less new file mode 100644 index 0000000..a885526 --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/lawyer-detail/index.less @@ -0,0 +1,245 @@ +.detail-page { + background: var(--bg-page); +} + +.detail-bg { + height: 300rpx; + background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)); + position: absolute; + top: 0; + left: 0; + width: 100%; + z-index: 0; + border-radius: 0 0 40rpx 40rpx; +} + +.profile-card { + position: relative; + z-index: 1; + margin: 160rpx var(--spacing-md) 0; + background: #fff; + border-radius: var(--border-radius-lg); + padding: var(--spacing-lg); + box-shadow: var(--shadow-base); + display: flex; + align-items: flex-start; +} + +.avatar { + width: 140rpx; + height: 140rpx; + border-radius: 50%; + border: 4rpx solid #fff; + box-shadow: var(--shadow-sm); + margin-top: -60rpx; + /* Overlap effect */ + background: #fff; +} + +.profile-info { + flex: 1; + margin-left: var(--spacing-md); + padding-top: var(--spacing-xs); +} + +.name-row { + display: flex; + align-items: baseline; + flex-wrap: wrap; + gap: 12rpx; + margin-bottom: 8rpx; +} + +.name { + font-size: 36rpx; + font-weight: 600; + color: var(--text-main); +} + +.title { + font-size: 24rpx; + color: var(--primary-color); + background: rgba(142, 34, 48, 0.08); + /* Primary opacity */ + padding: 2rpx 12rpx; + border-radius: 8rpx; +} + +.firm-name { + font-size: 24rpx; + color: var(--text-tertiary); + display: block; +} + +.qr-btn { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 10rpx; +} + +.qr-icon-text { + font-size: 32rpx; + color: var(--text-secondary); + margin-bottom: 4rpx; +} + +.qr-btn text { + font-size: 20rpx; + color: var(--text-secondary); +} + +.content-body { + padding: var(--spacing-md); +} + +.section-card { + background: #fff; + border-radius: var(--border-radius-base); + padding: var(--spacing-md); + margin-bottom: var(--spacing-md); + box-shadow: var(--shadow-sm); +} + +.section-header { + font-size: 28rpx; + font-weight: 600; + color: var(--text-secondary); + margin-bottom: var(--spacing-md); + position: relative; + padding-left: 16rpx; +} + +.section-header::before { + content: ''; + position: absolute; + left: 0; + top: 6rpx; + bottom: 6rpx; + width: 6rpx; + background: var(--accent-color); + border-radius: 4rpx; +} + +.contact-item { + display: flex; + align-items: center; + padding: 16rpx 0; +} + +.contact-label { + width: 80rpx; + color: var(--text-tertiary); + font-size: 26rpx; +} + +.contact-value { + flex: 1; + color: var(--text-main); + font-size: 28rpx; + font-weight: 500; +} + +.action-icon { + width: 60rpx; + text-align: center; + font-size: 32rpx; +} + +.divider { + height: 1rpx; + background: var(--bg-page); + margin: 0 0; +} + +.tags-row { + display: flex; + flex-wrap: wrap; + gap: 16rpx; +} + +.tag { + font-size: 24rpx; + color: var(--primary-color); + background: rgba(142, 34, 48, 0.05); + padding: 8rpx 20rpx; + border-radius: 30rpx; +} + +.bio-text { + font-size: 28rpx; + color: var(--text-secondary); + line-height: 1.6; + text-align: justify; + white-space: pre-wrap; +} + +.bio-scroll { + height: 360rpx; + box-sizing: border-box; + padding-right: 8rpx; +} + +.firm-mini-card { + background: #fff; + padding: var(--spacing-md); + border-radius: var(--border-radius-base); + display: flex; + align-items: center; + gap: 20rpx; +} + +.firm-logo-mini-placeholder { + height: 60rpx; + width: 140rpx; + background: var(--bg-surface); + border-radius: 8rpx; + display: flex; + align-items: center; + justify-content: center; +} + +.mini-logo-text { + font-size: 24rpx; + font-weight: 700; + color: var(--primary-color); + font-family: serif; +} + +.firm-mini-info { + flex: 1; + display: flex; + flex-direction: column; +} + +.firm-mini-name { + font-size: 26rpx; + color: var(--text-main); + font-weight: 500; +} + +.firm-mini-address { + font-size: 22rpx; + color: var(--text-tertiary); +} + +.arrow { + color: var(--text-placeholder); +} + +.detail-bottom-space { + height: 160rpx; +} + +.not-found-action { + padding: var(--spacing-lg); + text-align: center; +} + +.back-btn { + background: var(--primary-color); + color: #fff; + font-size: 28rpx; + border-radius: 40rpx; +} diff --git a/frontend_miniprogram/miniprogram/pages/lawyer-detail/index.ts b/frontend_miniprogram/miniprogram/pages/lawyer-detail/index.ts new file mode 100644 index 0000000..75dc02b --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/lawyer-detail/index.ts @@ -0,0 +1,188 @@ +import { getLawyerDetail, recordCardShare } from '../../api/open'; +import type { FirmInfo } from '../../types/card'; +import type { Lawyer } from '../../types/card'; +import { appendCardViewRecord } from '../../utils/history'; + +function createEmptyFirm(): FirmInfo { + return { + id: '', + name: '', + logo: '', + intro: '', + hotlinePhone: '', + hqAddress: '', + hqLatitude: 0, + hqLongitude: 0, + officeCount: 0, + lawyerCount: 0, + heroImage: '', + officeList: [], + practiceAreas: [], + }; +} + +function buildDetailBgStyle(coverImage?: string): string { + const cover = typeof coverImage === 'string' ? coverImage.trim() : ''; + if (!cover) { + return ''; + } + return `background-image: url("${cover}"); background-size: cover; background-position: center;`; +} + +function shouldUseBioScroll(bio?: string): boolean { + const text = typeof bio === 'string' ? bio.trim() : ''; + return text.length > 180; +} + +Page({ + data: { + firm: createEmptyFirm(), + lawyer: null as Lawyer | null, + notFound: false, + specialtiesText: '', + detailBgStyle: '', + bioScrollable: false, + loading: false, + }, + + async onLoad(options: Record) { + const lawyerId = typeof options.id === 'string' ? options.id : ''; + const sourceType = typeof options.sourceType === 'string' ? options.sourceType : 'DIRECT'; + const shareFromCardId = typeof options.shareFromCardId === 'string' ? options.shareFromCardId : ''; + + if (!lawyerId) { + this.setData({ notFound: true, specialtiesText: '', detailBgStyle: '', bioScrollable: false }); + return; + } + + this.setData({ loading: true }); + try { + const payload = await getLawyerDetail(lawyerId, sourceType, shareFromCardId); + this.setData({ + firm: payload.firm, + lawyer: payload.lawyer, + notFound: false, + specialtiesText: payload.lawyer.specialties.join(';'), + detailBgStyle: buildDetailBgStyle(payload.lawyer.coverImage), + bioScrollable: shouldUseBioScroll(payload.lawyer.bio), + }); + appendCardViewRecord(payload.lawyer); + wx.showShareMenu({ menus: ['shareAppMessage'] }); + } catch (error) { + const message = error instanceof Error ? error.message : '律师信息不存在'; + this.setData({ notFound: true, specialtiesText: '', detailBgStyle: '', bioScrollable: false }); + wx.showToast({ + title: message, + icon: 'none', + }); + } finally { + this.setData({ loading: false }); + } + }, + + handleDockAction(event: WechatMiniprogram.CustomEvent<{ action: string }>) { + const action = event.detail.action; + switch (action) { + case 'save': + this.saveContact(); + break; + case 'location': + this.navigateOffice(); + break; + default: + break; + } + }, + + saveContact() { + const lawyer = this.data.lawyer; + if (!lawyer) { + return; + } + + wx.addPhoneContact({ + firstName: lawyer.name, + mobilePhoneNumber: lawyer.phone, + email: lawyer.email, + organization: this.data.firm.name, + title: lawyer.title, + workAddressStreet: lawyer.address, + remark: lawyer.specialties.join('、'), + success: () => { + wx.showToast({ title: '已添加到通讯录', icon: 'success' }); + }, + fail: () => { + wx.showToast({ title: '添加失败', icon: 'none' }); + }, + }); + }, + + callPhone() { + const phone = this.data.lawyer ? this.data.lawyer.phone : ''; + if (!phone) { + wx.showToast({ title: '暂无联系电话', icon: 'none' }); + return; + } + + wx.makePhoneCall({ + phoneNumber: phone, + fail: () => { + wx.showToast({ title: '拨号失败', icon: 'none' }); + }, + }); + }, + + navigateOffice() { + if (!this.data.firm.hqLatitude || !this.data.firm.hqLongitude) { + wx.showToast({ title: '暂未配置地图位置', icon: 'none' }); + return; + } + wx.openLocation({ + latitude: this.data.firm.hqLatitude, + longitude: this.data.firm.hqLongitude, + name: this.data.firm.name, + address: this.data.firm.hqAddress, + scale: 18, + fail: () => { + wx.showToast({ title: '打开地图失败', icon: 'none' }); + }, + }); + }, + + previewWechatQr() { + const url = this.data.lawyer ? this.data.lawyer.wechatQrImage : ''; + if (!url) { + wx.showToast({ title: '二维码未配置', icon: 'none' }); + return; + } + wx.previewImage({ + current: url, + urls: [url], + }); + }, + + goLawyerList() { + wx.navigateTo({ url: '/pages/lawyer-list/index' }); + }, + + onShareAppMessage() { + const lawyer = this.data.lawyer; + if (!lawyer) { + return { + title: `${this.data.firm.name || '电子名片'}电子名片`, + path: '/pages/firm/index', + }; + } + + const sharePath = `/pages/lawyer-detail/index?id=${lawyer.id}&sourceType=SHARE&shareFromCardId=${lawyer.id}`; + recordCardShare(lawyer.id, sharePath).catch(() => { + // 分享埋点失败不阻断分享动作 + }); + + return { + title: `${lawyer.name}律师电子名片`, + path: sharePath, + imageUrl: lawyer.avatar, + }; + }, +}); diff --git a/frontend_miniprogram/miniprogram/pages/lawyer-detail/index.wxml b/frontend_miniprogram/miniprogram/pages/lawyer-detail/index.wxml new file mode 100644 index 0000000..461e199 --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/lawyer-detail/index.wxml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + {{lawyer.name}} + {{lawyer.title}} + + {{firm.name}} | {{lawyer.office}} + + + + + 二维码 + + + + + + + + + 联系方式 + + 电话 + {{lawyer.phone}} + 📞 + + + + 邮箱 + {{lawyer.email}} + + + + + + 执业领域 + + {{item}} + + + + + + 个人简介 + + {{lawyer.bio}} + + {{lawyer.bio}} + + + + + + + + + + + + diff --git a/frontend_miniprogram/miniprogram/pages/lawyer-list/index.json b/frontend_miniprogram/miniprogram/pages/lawyer-list/index.json new file mode 100644 index 0000000..baddcd6 --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/lawyer-list/index.json @@ -0,0 +1,8 @@ +{ + "usingComponents": { + "app-header": "/components/app-header/app-header", + "lawyer-card": "/components/lawyer-card/lawyer-card", + "filter-bar": "/components/filter-bar/filter-bar", + "empty-state": "/components/empty-state/empty-state" + } +} diff --git a/frontend_miniprogram/miniprogram/pages/lawyer-list/index.less b/frontend_miniprogram/miniprogram/pages/lawyer-list/index.less new file mode 100644 index 0000000..8e63214 --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/lawyer-list/index.less @@ -0,0 +1,116 @@ +.lawyer-list-page { + background: var(--bg-page); +} + +.sticky-header { + position: sticky; + top: 0; + z-index: 10; + background: var(--bg-page); + padding-bottom: var(--spacing-sm); +} + +.search-wrap { + padding: var(--spacing-sm) var(--spacing-md); + background: #fff; +} + +.search-box { + height: 80rpx; + border-radius: 40rpx; + background: var(--bg-surface); + display: flex; + align-items: center; + padding: 0 24rpx; + gap: 12rpx; + border: 1rpx solid transparent; + transition: all 0.2s; +} + +.search-box:active { + background: #fff; + border-color: var(--primary-color); +} + +.search-input { + flex: 1; + min-width: 0; + font-size: 28rpx; + color: var(--text-main); + height: 100%; +} + +.search-placeholder { + color: var(--text-placeholder); +} + +.quick-actions { + display: flex; + gap: var(--spacing-md); + padding: 0 var(--spacing-md) var(--spacing-md); +} + +.action-btn { + flex: 1; + height: 80rpx; + border-radius: var(--border-radius-base); + display: flex; + align-items: center; + justify-content: center; + font-size: 28rpx; + font-weight: 500; + transition: opacity 0.2s; +} + +.action-btn:active { + opacity: 0.8; +} + +.hotline-btn { + background: rgba(142, 34, 48, 0.06); + /* Burgundy tint */ + color: var(--primary-color); +} + +.map-btn { + background: #fff; + color: var(--text-secondary); + border: 1rpx solid var(--border-color); +} + +.list-wrap { + padding: 0 var(--spacing-md); +} + +.card-item { + margin-bottom: var(--spacing-md); + background: #fff; + /* Ensure card background is white */ + border-radius: var(--border-radius-base); +} + +.list-bottom-space { + height: 120rpx; +} + +/* History Floating Action Button styling */ +.history-fab { + position: fixed; + right: var(--spacing-md); + bottom: calc(var(--spacing-lg) + env(safe-area-inset-bottom)); + background: rgba(255, 255, 255, 0.9); + backdrop-filter: blur(10px); + padding: 16rpx 32rpx; + border-radius: 40rpx; + box-shadow: var(--shadow-lg); + display: flex; + align-items: center; + z-index: 20; + border: 1rpx solid var(--border-color); +} + +.history-text { + font-size: 26rpx; + color: var(--text-main); + font-weight: 500; +} \ No newline at end of file diff --git a/frontend_miniprogram/miniprogram/pages/lawyer-list/index.ts b/frontend_miniprogram/miniprogram/pages/lawyer-list/index.ts new file mode 100644 index 0000000..d1082da --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/lawyer-list/index.ts @@ -0,0 +1,147 @@ +import { getFirmProfile, listLawyers } from '../../api/open'; +import type { Lawyer } from '../../types/card'; + +const ALL_OFFICES = '所有办公机构'; +const ALL_AREAS = '全部专业领域'; + +let searchDebounceTimer: number | null = null; + +Page({ + data: { + firmName: '', + firmAddress: '', + firmLatitude: 0, + firmLongitude: 0, + keyword: '', + selectedOffice: ALL_OFFICES, + selectedArea: ALL_AREAS, + officeOptions: [ALL_OFFICES], + areaOptions: [ALL_AREAS], + filteredLawyers: [] as Lawyer[], + hotlinePhone: '', + loading: false, + }, + + onLoad() { + this.initializePage(); + }, + + async initializePage() { + this.setData({ loading: true }); + try { + const firm = await getFirmProfile(); + this.setData({ + firmName: firm.name, + firmAddress: firm.hqAddress, + firmLatitude: firm.hqLatitude, + firmLongitude: firm.hqLongitude, + hotlinePhone: firm.hotlinePhone, + officeOptions: [ALL_OFFICES, ...firm.officeList], + areaOptions: [ALL_AREAS, ...firm.practiceAreas], + }); + await this.loadLawyers(); + } catch (error) { + const message = error instanceof Error ? error.message : '加载列表失败'; + wx.showToast({ title: message, icon: 'none' }); + } finally { + this.setData({ loading: false }); + } + }, + + onUnload() { + if (searchDebounceTimer !== null) { + clearTimeout(searchDebounceTimer); + searchDebounceTimer = null; + } + }, + + onSearchInput(event: WechatMiniprogram.CustomEvent<{ value: string }>) { + const keyword = event.detail.value || ''; + this.setData({ keyword }); + + if (searchDebounceTimer !== null) { + clearTimeout(searchDebounceTimer); + } + + searchDebounceTimer = setTimeout(() => { + this.loadLawyers(); + }, 250) as unknown as number; + }, + + handleOfficeChange(event: WechatMiniprogram.CustomEvent<{ value: string }>) { + this.setData({ selectedOffice: event.detail.value }); + this.loadLawyers(); + }, + + handleAreaChange(event: WechatMiniprogram.CustomEvent<{ value: string }>) { + this.setData({ selectedArea: event.detail.value }); + this.loadLawyers(); + }, + + async loadLawyers() { + this.setData({ loading: true }); + try { + const filteredLawyers = await listLawyers({ + keyword: this.data.keyword.trim() || undefined, + office: this.data.selectedOffice === ALL_OFFICES ? undefined : this.data.selectedOffice, + practiceArea: this.data.selectedArea === ALL_AREAS ? undefined : this.data.selectedArea, + }); + this.setData({ filteredLawyers }); + } catch (error) { + const message = error instanceof Error ? error.message : '加载律师列表失败'; + wx.showToast({ title: message, icon: 'none' }); + } finally { + this.setData({ loading: false }); + } + }, + + handleLawyerSelect(event: WechatMiniprogram.CustomEvent<{ id: string }>) { + const lawyerId = event.detail.id; + if (!lawyerId) { + return; + } + wx.navigateTo({ + url: `/pages/lawyer-detail/index?id=${lawyerId}`, + }); + }, + + callHotline() { + if (!this.data.hotlinePhone) { + wx.showToast({ + title: '暂无联系电话', + icon: 'none', + }); + return; + } + + wx.makePhoneCall({ + phoneNumber: this.data.hotlinePhone, + fail: () => { + wx.showToast({ title: '拨号失败', icon: 'none' }); + }, + }); + }, + + openOffice() { + if (!this.data.firmLatitude || !this.data.firmLongitude) { + wx.showToast({ title: '暂未配置地图位置', icon: 'none' }); + return; + } + wx.openLocation({ + latitude: this.data.firmLatitude, + longitude: this.data.firmLongitude, + name: this.data.firmName, + address: this.data.firmAddress, + scale: 18, + fail: () => { + wx.showToast({ title: '打开地图失败', icon: 'none' }); + }, + }); + }, + + goHistory() { + wx.navigateTo({ + url: '/pages/history/index', + }); + }, +}); diff --git a/frontend_miniprogram/miniprogram/pages/lawyer-list/index.wxml b/frontend_miniprogram/miniprogram/pages/lawyer-list/index.wxml new file mode 100644 index 0000000..dd6ec9b --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/lawyer-list/index.wxml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + 联系电话 + + + 总部导航 + + + + + + + + + + + + + + + + + + + 浏览记录 + + diff --git a/frontend_miniprogram/miniprogram/pages/logs/logs.json b/frontend_miniprogram/miniprogram/pages/logs/logs.json new file mode 100644 index 0000000..aa3f1b0 --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/logs/logs.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "navigation-bar": "/components/navigation-bar/navigation-bar" + } +} \ No newline at end of file diff --git a/frontend_miniprogram/miniprogram/pages/logs/logs.less b/frontend_miniprogram/miniprogram/pages/logs/logs.less new file mode 100644 index 0000000..33f9d9e --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/logs/logs.less @@ -0,0 +1,16 @@ +page { + height: 100vh; + display: flex; + flex-direction: column; +} +.scrollarea { + flex: 1; + overflow-y: hidden; +} +.log-item { + margin-top: 20rpx; + text-align: center; +} +.log-item:last-child { + padding-bottom: env(safe-area-inset-bottom); +} diff --git a/frontend_miniprogram/miniprogram/pages/logs/logs.ts b/frontend_miniprogram/miniprogram/pages/logs/logs.ts new file mode 100644 index 0000000..dba5c0a --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/logs/logs.ts @@ -0,0 +1,21 @@ +// logs.ts +// const util = require('../../utils/util.js') +import { formatTime } from '../../utils/util' + +Component({ + data: { + logs: [], + }, + lifetimes: { + attached() { + this.setData({ + logs: (wx.getStorageSync('logs') || []).map((log: string) => { + return { + date: formatTime(new Date(log)), + timeStamp: log + } + }), + }) + } + }, +}) diff --git a/frontend_miniprogram/miniprogram/pages/logs/logs.wxml b/frontend_miniprogram/miniprogram/pages/logs/logs.wxml new file mode 100644 index 0000000..7de3ba3 --- /dev/null +++ b/frontend_miniprogram/miniprogram/pages/logs/logs.wxml @@ -0,0 +1,7 @@ + + + + + {{index + 1}}. {{log.date}} + + diff --git a/frontend_miniprogram/miniprogram/sitemap.json b/frontend_miniprogram/miniprogram/sitemap.json new file mode 100644 index 0000000..ca02add --- /dev/null +++ b/frontend_miniprogram/miniprogram/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file diff --git a/frontend_miniprogram/miniprogram/types/card.ts b/frontend_miniprogram/miniprogram/types/card.ts new file mode 100644 index 0000000..dce0159 --- /dev/null +++ b/frontend_miniprogram/miniprogram/types/card.ts @@ -0,0 +1,36 @@ +export interface FirmInfo { + id: string; + name: string; + logo: string; + intro: string; + hotlinePhone: string; + hqAddress: string; + hqLatitude: number; + hqLongitude: number; + officeCount: number; + lawyerCount: number; + heroImage: string; + officeList: string[]; + practiceAreas: string[]; +} + +export interface Lawyer { + id: string; + name: string; + title: string; + office: string; + phone: string; + email: string; + address: string; + avatar: string; + coverImage: string; + specialties: string[]; + bio: string; + wechatQrImage: string; +} + +export interface CardViewRecord { + lawyerId: string; + viewedAt: number; + lawyer?: Lawyer; +} diff --git a/frontend_miniprogram/miniprogram/utils/history.ts b/frontend_miniprogram/miniprogram/utils/history.ts new file mode 100644 index 0000000..58913fe --- /dev/null +++ b/frontend_miniprogram/miniprogram/utils/history.ts @@ -0,0 +1,65 @@ +import { CARD_VIEW_HISTORY_KEY } from '../constants/storage'; +import type { CardViewRecord, Lawyer } from '../types/card'; + +function normalizeLawyerSnapshot(input: unknown): Lawyer | undefined { + if (!input || typeof input !== 'object') { + return undefined; + } + + const lawyer = input as Partial; + if (typeof lawyer.id !== 'string' || !lawyer.id) { + return undefined; + } + + return { + id: lawyer.id, + name: typeof lawyer.name === 'string' ? lawyer.name : '', + title: typeof lawyer.title === 'string' ? lawyer.title : '', + office: typeof lawyer.office === 'string' ? lawyer.office : '', + phone: typeof lawyer.phone === 'string' ? lawyer.phone : '', + email: typeof lawyer.email === 'string' ? lawyer.email : '', + address: typeof lawyer.address === 'string' ? lawyer.address : '', + avatar: typeof lawyer.avatar === 'string' ? lawyer.avatar : '', + coverImage: typeof lawyer.coverImage === 'string' ? lawyer.coverImage : '', + specialties: Array.isArray(lawyer.specialties) + ? lawyer.specialties.filter((item): item is string => typeof item === 'string') + : [], + bio: typeof lawyer.bio === 'string' ? lawyer.bio : '', + wechatQrImage: typeof lawyer.wechatQrImage === 'string' ? lawyer.wechatQrImage : '', + }; +} + +export function getCardViewHistory(): CardViewRecord[] { + const raw = wx.getStorageSync(CARD_VIEW_HISTORY_KEY); + if (!Array.isArray(raw)) { + return []; + } + return raw + .map((item) => { + const record = item as { lawyerId?: unknown; viewedAt?: unknown; lawyer?: unknown }; + const lawyerId = typeof record.lawyerId === 'string' ? record.lawyerId : ''; + const viewedAt = typeof record.viewedAt === 'number' ? record.viewedAt : 0; + const lawyer = normalizeLawyerSnapshot(record.lawyer); + return { lawyerId, viewedAt, lawyer }; + }) + .filter((item) => Boolean(item.lawyerId) && item.viewedAt > 0) + .sort((a, b) => b.viewedAt - a.viewedAt); +} + +export function appendCardViewRecord(lawyer: Lawyer): void { + if (!lawyer.id) { + return; + } + + const current = getCardViewHistory().filter((item) => item.lawyerId !== lawyer.id); + current.unshift({ + lawyerId: lawyer.id, + viewedAt: Date.now(), + lawyer, + }); + wx.setStorageSync(CARD_VIEW_HISTORY_KEY, current); +} + +export function clearCardViewHistory(): void { + wx.removeStorageSync(CARD_VIEW_HISTORY_KEY); +} diff --git a/frontend_miniprogram/miniprogram/utils/http.ts b/frontend_miniprogram/miniprogram/utils/http.ts new file mode 100644 index 0000000..682a85a --- /dev/null +++ b/frontend_miniprogram/miniprogram/utils/http.ts @@ -0,0 +1,75 @@ +import { API_BASE_URL_OVERRIDE_KEY, tenantRuntimeConfig } from '../config/runtime'; +import { getMiniappAppId, getMiniappEnvVersion } from './miniapp'; + +interface ApiResponse { + code: string; + message: string; + data: T; +} + +interface RequestOptions { + url: string; + method?: 'GET' | 'POST'; + data?: WechatMiniprogram.IAnyObject; +} + +function normalizeBaseUrl(baseUrl: string): string { + return baseUrl.trim().replace(/\/+$/, ''); +} + +function getApiBaseUrl(): string { + const override = wx.getStorageSync(API_BASE_URL_OVERRIDE_KEY); + if (typeof override === 'string' && override.trim()) { + return normalizeBaseUrl(override); + } + + const envVersion = getMiniappEnvVersion(); + const baseUrl = tenantRuntimeConfig.apiBaseUrlByEnv[envVersion]; + if (!baseUrl || !baseUrl.trim()) { + throw new Error(`未配置 ${envVersion} 环境的接口域名`); + } + + const normalizedBaseUrl = normalizeBaseUrl(baseUrl); + if (envVersion !== 'develop' && !normalizedBaseUrl.startsWith('https://')) { + throw new Error(`${envVersion} 环境接口域名必须使用 HTTPS`); + } + + return normalizedBaseUrl; +} + +export function request(options: RequestOptions): Promise { + const appId = getMiniappAppId(); + if (!appId) { + return Promise.reject(new Error('未获取到小程序 AppID')); + } + + let apiBaseUrl = ''; + try { + apiBaseUrl = getApiBaseUrl(); + } catch (error) { + return Promise.reject(error instanceof Error ? error : new Error('接口域名配置无效')); + } + + return new Promise((resolve, reject) => { + wx.request({ + url: `${apiBaseUrl}${options.url}`, + method: options.method || 'GET', + data: options.data, + header: { + 'X-Miniapp-Appid': appId, + }, + success: (response) => { + const payload = response.data as ApiResponse | undefined; + if (response.statusCode >= 200 && response.statusCode < 300 && payload && payload.code === '0') { + resolve(payload.data); + return; + } + const message = payload && payload.message ? payload.message : '请求失败'; + reject(new Error(message)); + }, + fail: () => { + reject(new Error('网络异常,请稍后重试')); + }, + }); + }); +} diff --git a/frontend_miniprogram/miniprogram/utils/miniapp.ts b/frontend_miniprogram/miniprogram/utils/miniapp.ts new file mode 100644 index 0000000..4e0fb86 --- /dev/null +++ b/frontend_miniprogram/miniprogram/utils/miniapp.ts @@ -0,0 +1,29 @@ +import type { MiniProgramEnvVersion } from '../config/runtime'; + +const APPID_OVERRIDE_KEY = 'miniapp_appid_override'; + +export function getMiniappAppId(): string { + const override = wx.getStorageSync(APPID_OVERRIDE_KEY); + if (typeof override === 'string' && override.trim()) { + return override.trim(); + } + + try { + const accountInfo = wx.getAccountInfoSync(); + return accountInfo.miniProgram.appId || ''; + } catch { + return ''; + } +} + +export function getMiniappEnvVersion(): MiniProgramEnvVersion { + try { + const envVersion = wx.getAccountInfoSync().miniProgram.envVersion; + if (envVersion === 'trial' || envVersion === 'release') { + return envVersion; + } + return 'develop'; + } catch { + return 'develop'; + } +} diff --git a/frontend_miniprogram/miniprogram/utils/util.ts b/frontend_miniprogram/miniprogram/utils/util.ts new file mode 100644 index 0000000..69a2e19 --- /dev/null +++ b/frontend_miniprogram/miniprogram/utils/util.ts @@ -0,0 +1,19 @@ +export const formatTime = (date: Date) => { + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + const hour = date.getHours() + const minute = date.getMinutes() + const second = date.getSeconds() + + return ( + [year, month, day].map(formatNumber).join('/') + + ' ' + + [hour, minute, second].map(formatNumber).join(':') + ) +} + +const formatNumber = (n: number) => { + const s = n.toString() + return s[1] ? s : '0' + s +} diff --git a/frontend_miniprogram/package.json b/frontend_miniprogram/package.json new file mode 100644 index 0000000..5f731b7 --- /dev/null +++ b/frontend_miniprogram/package.json @@ -0,0 +1,15 @@ +{ + "name": "miniprogram-ts-less-quickstart", + "version": "1.0.0", + "description": "", + "scripts": { + }, + "keywords": [], + "author": "", + "license": "", + "dependencies": { + }, + "devDependencies": { + "miniprogram-api-typings": "^2.8.3-1" + } +} diff --git a/frontend_miniprogram/project.config.json b/frontend_miniprogram/project.config.json new file mode 100644 index 0000000..405b6e4 --- /dev/null +++ b/frontend_miniprogram/project.config.json @@ -0,0 +1,51 @@ +{ + "description": "项目配置文件", + "miniprogramRoot": "miniprogram/", + "compileType": "miniprogram", + "setting": { + "useCompilerPlugins": [ + "typescript", + "less" + ], + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + }, + "coverView": false, + "postcss": false, + "minified": false, + "enhance": false, + "showShadowRootInWxmlPanel": false, + "packNpmRelationList": [], + "ignoreUploadUnusedFiles": true, + "compileHotReLoad": false, + "skylineRenderEnable": true, + "es6": false, + "compileWorklet": false, + "uglifyFileName": false, + "uploadWithSourceMap": true, + "packNpmManually": false, + "minifyWXSS": true, + "minifyWXML": true, + "localPlugins": false, + "condition": false, + "swc": false, + "disableSWC": true, + "disableUseStrict": false + }, + "simulatorType": "wechat", + "simulatorPluginLibVersion": {}, + "condition": {}, + "srcMiniprogramRoot": "miniprogram/", + "editorSetting": { + "tabIndent": "insertSpaces", + "tabSize": 2 + }, + "libVersion": "2.32.3", + "packOptions": { + "ignore": [], + "include": [] + }, + "appid": "wx790fd3f9448f6e87" +} \ No newline at end of file diff --git a/frontend_miniprogram/tsconfig.json b/frontend_miniprogram/tsconfig.json new file mode 100644 index 0000000..d278c77 --- /dev/null +++ b/frontend_miniprogram/tsconfig.json @@ -0,0 +1,30 @@ +{ + "compilerOptions": { + "strictNullChecks": true, + "noImplicitAny": true, + "module": "CommonJS", + "target": "ES2017", + "allowJs": true, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "noImplicitThis": true, + "noImplicitReturns": true, + "alwaysStrict": true, + "noFallthroughCasesInSwitch": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "strict": true, + "strictPropertyInitialization": true, + "lib": ["ES2017"], + "typeRoots": [ + "./typings" + ] + }, + "include": [ + "./**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} diff --git a/frontend_miniprogram/typings/index.d.ts b/frontend_miniprogram/typings/index.d.ts new file mode 100644 index 0000000..3ee60c8 --- /dev/null +++ b/frontend_miniprogram/typings/index.d.ts @@ -0,0 +1,8 @@ +/// + +interface IAppOption { + globalData: { + userInfo?: WechatMiniprogram.UserInfo, + } + userInfoReadyCallback?: WechatMiniprogram.GetUserInfoSuccessCallback, +} \ No newline at end of file diff --git a/frontend_miniprogram/typings/types/index.d.ts b/frontend_miniprogram/typings/types/index.d.ts new file mode 100644 index 0000000..a5e8a7c --- /dev/null +++ b/frontend_miniprogram/typings/types/index.d.ts @@ -0,0 +1 @@ +/// diff --git a/frontend_miniprogram/typings/types/wx/index.d.ts b/frontend_miniprogram/typings/types/wx/index.d.ts new file mode 100644 index 0000000..db82722 --- /dev/null +++ b/frontend_miniprogram/typings/types/wx/index.d.ts @@ -0,0 +1,74 @@ +/*! ***************************************************************************** +Copyright (c) 2021 Tencent, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +***************************************************************************** */ + +/// +/// +/// +/// +/// +/// +/// + +declare namespace WechatMiniprogram { + type IAnyObject = Record + type Optional = F extends (arg: infer P) => infer R ? (arg?: P) => R : F + type OptionalInterface = { [K in keyof T]: Optional } + interface AsyncMethodOptionLike { + success?: (...args: any[]) => void + } + type PromisifySuccessResult< + P, + T extends AsyncMethodOptionLike + > = P extends { success: any } + ? void + : P extends { fail: any } + ? void + : P extends { complete: any } + ? void + : Promise>[0]> +} + +declare const console: WechatMiniprogram.Console +declare const wx: WechatMiniprogram.Wx +/** 引入模块。返回模块通过 `module.exports` 或 `exports` 暴露的接口。 */ +declare function require( + /** 需要引入模块文件相对于当前文件的相对路径,或 npm 模块名,或 npm 模块路径。不支持绝对路径 */ + module: string +): any +/** 引入插件。返回插件通过 `main` 暴露的接口。 */ +declare function requirePlugin( + /** 需要引入的插件的 alias */ + module: string +): any +/** 插件引入当前使用者小程序。返回使用者小程序通过 [插件配置中 `export` 暴露的接口](https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/using.html#%E5%AF%BC%E5%87%BA%E5%88%B0%E6%8F%92%E4%BB%B6)。 + * + * 该接口只在插件中存在 + * + * 最低基础库: `2.11.1` */ +declare function requireMiniProgram(): any +/** 当前模块对象 */ +declare let module: { + /** 模块向外暴露的对象,使用 `require` 引用该模块时可以获取 */ + exports: any +} +/** `module.exports` 的引用 */ +declare let exports: any diff --git a/frontend_miniprogram/typings/types/wx/lib.wx.api.d.ts b/frontend_miniprogram/typings/types/wx/lib.wx.api.d.ts new file mode 100644 index 0000000..4c6047a --- /dev/null +++ b/frontend_miniprogram/typings/types/wx/lib.wx.api.d.ts @@ -0,0 +1,19671 @@ +/*! ***************************************************************************** +Copyright (c) 2021 Tencent, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +***************************************************************************** */ + +declare namespace WechatMiniprogram { + interface AccessFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail no such file or directory ${path}': 文件/目录不存在; + * - 'fail sdcard not mounted': Android sdcard 挂载失败; */ + errMsg: string + } + interface AccessOption { + /** 要判断是否存在的文件/目录路径 (本地路径) */ + path: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AccessCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: AccessFailCallback + /** 接口调用成功的回调函数 */ + success?: AccessSuccessCallback + } + /** 帐号信息 */ + interface AccountInfo { + /** 小程序帐号信息 */ + miniProgram: MiniProgram + /** 插件帐号信息(仅在插件中调用时包含这一项) */ + plugin: Plugin + } + interface AddCardOption { + /** 需要添加的卡券列表 */ + cardList: AddCardRequestInfo[] + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AddCardCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: AddCardFailCallback + /** 接口调用成功的回调函数 */ + success?: AddCardSuccessCallback + } + /** 需要添加的卡券列表 */ + interface AddCardRequestInfo { + /** 卡券的扩展参数。需将 CardExt 对象 JSON 序列化为**字符串**传入 */ + cardExt: string + /** 卡券 ID */ + cardId: string + } + /** 卡券添加结果列表 */ + interface AddCardResponseInfo { + /** 卡券的扩展参数,结构请参考下文 */ + cardExt: string + /** 用户领取到卡券的 ID */ + cardId: string + /** 加密 code,为用户领取到卡券的code加密后的字符串,解密请参照:[code 解码接口](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1499332673_Unm7V) */ + code: string + /** 是否成功 */ + isSuccess: boolean + } + interface AddCardSuccessCallbackResult { + /** 卡券添加结果列表 */ + cardList: AddCardResponseInfo[] + errMsg: string + } + interface AddCustomLayerOption { + /** 个性化图层id */ + layerId: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AddCustomLayerCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: AddCustomLayerFailCallback + /** 接口调用成功的回调函数 */ + success?: AddCustomLayerSuccessCallback + } + interface AddGroundOverlayOption { + /** 图片覆盖的经纬度范围 */ + bounds: MapBounds + /** 图片图层 id */ + id: string + /** 图片路径,支持网络图片、临时路径、代码包路径 */ + src: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AddGroundOverlayCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: AddGroundOverlayFailCallback + /** 图层透明度 */ + opacity?: number + /** 接口调用成功的回调函数 */ + success?: AddGroundOverlaySuccessCallback + /** 是否可见 */ + visible?: boolean + /** 图层绘制顺序 */ + zIndex?: number + } + interface AddMarkersOption { + /** 同传入 map 组件的 marker 属性 */ + markers: any[] + /** 是否先清空地图上所有 marker */ + clear?: boolean + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AddMarkersCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: AddMarkersFailCallback + /** 接口调用成功的回调函数 */ + success?: AddMarkersSuccessCallback + } + interface AddPhoneCalendarOption { + /** 开始时间的 unix 时间戳 */ + startTime: number + /** 日历事件标题 */ + title: string + /** 是否提醒,默认 true */ + alarm?: boolean + /** 提醒提前量,单位秒,默认 0 表示开始时提醒 */ + alarmOffset?: number + /** 是否全天事件,默认 false */ + allDay?: boolean + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AddPhoneCalendarCompleteCallback + /** 事件说明 */ + description?: string + /** 结束时间的 unix 时间戳,默认与开始时间相同 */ + endTime?: string + /** 接口调用失败的回调函数 */ + fail?: AddPhoneCalendarFailCallback + /** 事件位置 */ + location?: string + /** 接口调用成功的回调函数 */ + success?: AddPhoneCalendarSuccessCallback + } + interface AddPhoneContactOption { + /** 名字 */ + firstName: string + /** 联系地址城市 */ + addressCity?: string + /** 联系地址国家 */ + addressCountry?: string + /** 联系地址邮政编码 */ + addressPostalCode?: string + /** 联系地址省份 */ + addressState?: string + /** 联系地址街道 */ + addressStreet?: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AddPhoneContactCompleteCallback + /** 电子邮件 */ + email?: string + /** 接口调用失败的回调函数 */ + fail?: AddPhoneContactFailCallback + /** 住宅地址城市 */ + homeAddressCity?: string + /** 住宅地址国家 */ + homeAddressCountry?: string + /** 住宅地址邮政编码 */ + homeAddressPostalCode?: string + /** 住宅地址省份 */ + homeAddressState?: string + /** 住宅地址街道 */ + homeAddressStreet?: string + /** 住宅传真 */ + homeFaxNumber?: string + /** 住宅电话 */ + homePhoneNumber?: string + /** 公司电话 */ + hostNumber?: string + /** 姓氏 */ + lastName?: string + /** 中间名 */ + middleName?: string + /** 手机号 */ + mobilePhoneNumber?: string + /** 昵称 */ + nickName?: string + /** 公司 */ + organization?: string + /** 头像本地文件路径 */ + photoFilePath?: string + /** 备注 */ + remark?: string + /** 接口调用成功的回调函数 */ + success?: AddPhoneContactSuccessCallback + /** 职位 */ + title?: string + /** 网站 */ + url?: string + /** 微信号 */ + weChatNumber?: string + /** 工作地址城市 */ + workAddressCity?: string + /** 工作地址国家 */ + workAddressCountry?: string + /** 工作地址邮政编码 */ + workAddressPostalCode?: string + /** 工作地址省份 */ + workAddressState?: string + /** 工作地址街道 */ + workAddressStreet?: string + /** 工作传真 */ + workFaxNumber?: string + /** 工作电话 */ + workPhoneNumber?: string + } + interface AddPhoneRepeatCalendarOption { + /** 开始时间的 unix 时间戳 (1970年1月1日开始所经过的秒数) */ + startTime: number + /** 日历事件标题 */ + title: string + /** 是否提醒,默认 true */ + alarm?: boolean + /** 提醒提前量,单位秒,默认 0 表示开始时提醒 */ + alarmOffset?: number + /** 是否全天事件,默认 false */ + allDay?: boolean + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AddPhoneRepeatCalendarCompleteCallback + /** 事件说明 */ + description?: string + /** 结束时间的 unix 时间戳,默认与开始时间相同 */ + endTime?: string + /** 接口调用失败的回调函数 */ + fail?: AddPhoneRepeatCalendarFailCallback + /** 事件位置 */ + location?: string + /** 重复周期结束时间的 unix 时间戳,不填表示一直重复 */ + repeatEndTime?: number + /** 重复周期,默认 month 每月重复 */ + repeatInterval?: string + /** 接口调用成功的回调函数 */ + success?: AddPhoneRepeatCalendarSuccessCallback + } + interface AddServiceOption { + /** 描述service的Object */ + service: BLEPeripheralService + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AddServiceCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: AddServiceFailCallback + /** 接口调用成功的回调函数 */ + success?: AddServiceSuccessCallback + } + /** 广播自定义参数 */ + interface AdvertiseReqObj { + /** 当前Service是否可连接 */ + connectable?: boolean + /** 广播中deviceName字段,默认为空 */ + deviceName?: string + /** 广播的制造商信息, 仅安卓支持 */ + manufacturerData?: ManufacturerData[] + /** 要广播的serviceUuid列表 */ + serviceUuids?: string[] + } + /** animationData */ + interface AnimationExportResult { + actions: IAnyObject[] + } + /** 动画效果 */ + interface AnimationOption { + /** 动画变化时间,单位 ms */ + duration?: number + /** 动画变化方式 + * + * 可选值: + * - 'linear': 动画从头到尾的速度是相同的; + * - 'easeIn': 动画以低速开始; + * - 'easeOut': 动画以低速结束; + * - 'easeInOut': 动画以低速开始和结束; */ + timingFunc?: 'linear' | 'easeIn' | 'easeOut' | 'easeInOut' + } + interface AppendFileFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 文件不存在; + * - 'fail illegal operation on a directory, open "${filePath}"': 指定的 filePath 是一个已经存在的目录; + * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限; + * - 'fail sdcard not mounted': Android sdcard 挂载失败; */ + errMsg: string + } + interface AppendFileOption { + /** 要追加的文本或二进制数据 */ + data: string | ArrayBuffer + /** 要追加内容的文件路径 (本地路径) */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AppendFileCompleteCallback + /** 指定写入文件的字符编码 + * + * 可选值: + * - 'ascii': ; + * - 'base64': ; + * - 'binary': ; + * - 'hex': ; + * - 'ucs2': 以小端序读取; + * - 'ucs-2': 以小端序读取; + * - 'utf16le': 以小端序读取; + * - 'utf-16le': 以小端序读取; + * - 'utf-8': ; + * - 'utf8': ; + * - 'latin1': ; */ + encoding?: + | 'ascii' + | 'base64' + | 'binary' + | 'hex' + | 'ucs2' + | 'ucs-2' + | 'utf16le' + | 'utf-16le' + | 'utf-8' + | 'utf8' + | 'latin1' + /** 接口调用失败的回调函数 */ + fail?: AppendFileFailCallback + /** 接口调用成功的回调函数 */ + success?: AppendFileSuccessCallback + } + interface AuthPrivateMessageOption { + /** shareTicket。可以从 wx.onShow 中获取。详情 [shareTicket](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */ + shareTicket: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AuthPrivateMessageCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: AuthPrivateMessageFailCallback + /** 接口调用成功的回调函数 */ + success?: AuthPrivateMessageSuccessCallback + } + interface AuthPrivateMessageSuccessCallbackResult { + /** 经过加密的activityId,解密后可得到原始的activityId。若解密后得到的activityId可以与开发者后台的活动id对应上则验证通过,否则表明valid字段不可靠(被篡改) 详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */ + encryptedData: string + /** 错误信息 */ + errMsg: string + /** 加密算法的初始向量,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */ + iv: string + /** 验证是否通过 */ + valid: boolean + } + /** 用户授权设置信息,详情参考[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) */ + interface AuthSetting { + /** 是否授权通讯地址,已取消此项授权,会默认返回true */ + 'scope.address'?: boolean + /** 是否授权摄像头,对应[[camera](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html)](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html) 组件 */ + 'scope.camera'?: boolean + /** 是否授权获取发票,已取消此项授权,会默认返回true */ + 'scope.invoice'?: boolean + /** 是否授权发票抬头,已取消此项授权,会默认返回true */ + 'scope.invoiceTitle'?: boolean + /** 是否授权录音功能,对应接口 [wx.startRecord](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.startRecord.html) */ + 'scope.record'?: boolean + /** 是否授权用户信息,对应接口 [wx.getUserInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html) */ + 'scope.userInfo'?: boolean + /** 是否授权地理位置,对应接口 [wx.getLocation](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html), [wx.chooseLocation](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.chooseLocation.html) */ + 'scope.userLocation'?: boolean + /** 是否授权微信运动步数,对应接口 [wx.getWeRunData](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.getWeRunData.html) */ + 'scope.werun'?: boolean + /** 是否授权保存到相册 [wx.saveImageToPhotosAlbum](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html), [wx.saveVideoToPhotosAlbum](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.saveVideoToPhotosAlbum.html) */ + 'scope.writePhotosAlbum'?: boolean + } + interface AuthorizeForMiniProgramOption { + /** 需要获取权限的 scope,详见 [scope 列表]((authorize#scope-列表)) + * + * 可选值: + * - 'scope.record': ; + * - 'scope.writePhotosAlbum': ; + * - 'scope.camera': ; */ + scope: 'scope.record' | 'scope.writePhotosAlbum' | 'scope.camera' + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AuthorizeForMiniProgramCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: AuthorizeForMiniProgramFailCallback + /** 接口调用成功的回调函数 */ + success?: AuthorizeForMiniProgramSuccessCallback + } + interface AuthorizeOption { + /** 需要获取权限的 scope,详见 [scope 列表]((authorize#scope-列表)) */ + scope: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AuthorizeCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: AuthorizeFailCallback + /** 接口调用成功的回调函数 */ + success?: AuthorizeSuccessCallback + } + /** 设备特征值列表 */ + interface BLECharacteristic { + /** 该特征值支持的操作类型 */ + properties: BLECharacteristicProperties + /** 蓝牙设备特征值的 uuid */ + uuid: string + } + /** 该特征值支持的操作类型 */ + interface BLECharacteristicProperties { + /** 该特征值是否支持 indicate 操作 */ + indicate: boolean + /** 该特征值是否支持 notify 操作 */ + notify: boolean + /** 该特征值是否支持 read 操作 */ + read: boolean + /** 该特征值是否支持 write 操作 */ + write: boolean + } + interface BLEPeripheralServerCloseOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SocketTaskCloseCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SocketTaskCloseFailCallback + /** 接口调用成功的回调函数 */ + success?: SocketTaskCloseSuccessCallback + } + /** 描述service的Object */ + interface BLEPeripheralService { + /** characteristics列表 */ + characteristics: Characteristic[] + /** service 的 uuid */ + uuid: string + } + /** 设备服务列表 */ + interface BLEService { + /** 该服务是否为主服务 */ + isPrimary: boolean + /** 蓝牙设备服务的 uuid */ + uuid: string + } + /** BackgroundAudioManager 实例,可通过 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 获取。 +* +* **示例代码** +* +* +* ```js +const backgroundAudioManager = wx.getBackgroundAudioManager() + +backgroundAudioManager.title = '此时此刻' +backgroundAudioManager.epname = '此时此刻' +backgroundAudioManager.singer = '许巍' +backgroundAudioManager.coverImgUrl = 'http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000' +// 设置了 src 之后会自动播放 +backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46' +``` */ + interface BackgroundAudioManager { + /** 音频已缓冲的时间,仅保证当前播放时间点到此时间点内容已缓冲。(只读) */ + buffered: number + /** 封面图 URL,用于做原生音频播放器背景图。原生音频播放器中的分享功能,分享出去的卡片配图及背景也将使用该图。 */ + coverImgUrl: string + /** 当前音频的播放位置(单位:s),只有在有合法 src 时返回。(只读) */ + currentTime: number + /** 当前音频的长度(单位:s),只有在有合法 src 时返回。(只读) */ + duration: number + /** 专辑名,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */ + epname: string + /** 当前是否暂停或停止。(只读) */ + paused: boolean + /** 播放速度。范围 0.5-2.0,默认为 1。(Android 需要 6 及以上版本) + * + * 最低基础库: `2.11.0` */ + playbackRate: number + /** 音频协议。默认值为 'http',设置 'hls' 可以支持播放 HLS 协议的直播音频。 + * + * 最低基础库: `1.9.94` */ + protocol: string + /** 歌手名,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */ + singer: string + /** 音频的数据源([2.2.3](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 开始支持云文件ID)。默认为空字符串,**当设置了新的 src 时,会自动开始播放**,目前支持的格式有 m4a, aac, mp3, wav。 */ + src: string + /** 音频开始播放的位置(单位:s)。 */ + startTime: number + /** 音频标题,用于原生音频播放器音频标题(必填)。原生音频播放器中的分享功能,分享出去的卡片标题,也将使用该值。 */ + title: string + /** 页面链接,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */ + webUrl: string + } + interface BlueToothDevice { + /** 当前蓝牙设备的信号强度 */ + RSSI: number + /** 当前蓝牙设备的广播数据段中的 ManufacturerData 数据段。 */ + advertisData: ArrayBuffer + /** 当前蓝牙设备的广播数据段中的 ServiceUUIDs 数据段 */ + advertisServiceUUIDs: string[] + /** 用于区分设备的 id */ + deviceId: string + /** 当前蓝牙设备的广播数据段中的 LocalName 数据段 */ + localName: string + /** 蓝牙设备名称,某些设备可能没有 */ + name: string + /** 当前蓝牙设备的广播数据段中的 ServiceData 数据段 */ + serviceData: IAnyObject + } + /** 搜索到的设备列表 */ + interface BluetoothDeviceInfo { + /** 用于区分设备的 id */ + deviceId: string + /** 蓝牙设备名称,某些设备可能没有 */ + name: string + } + interface BlurOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: BlurCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: BlurFailCallback + /** 接口调用成功的回调函数 */ + success?: BlurSuccessCallback + } + interface BoundingClientRectCallbackResult { + /** 节点的下边界坐标 */ + bottom: number + /** 节点的 dataset */ + dataset: IAnyObject + /** 节点的高度 */ + height: number + /** 节点的 ID */ + id: string + /** 节点的左边界坐标 */ + left: number + /** 节点的右边界坐标 */ + right: number + /** 节点的上边界坐标 */ + top: number + /** 节点的宽度 */ + width: number + } + /** 目标边界 */ + interface BoundingClientRectResult { + /** 下边界 */ + bottom: number + /** 高度 */ + height: number + /** 左边界 */ + left: number + /** 右边界 */ + right: number + /** 上边界 */ + top: number + /** 宽度 */ + width: number + } + interface CameraContextStartRecordOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartRecordCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartRecordFailCallback + /** 接口调用成功的回调函数 */ + success?: CameraContextStartRecordSuccessCallback + /** 超过30s或页面 `onHide` 时会结束录像 */ + timeoutCallback?: StartRecordTimeoutCallback + } + interface CameraContextStopRecordOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopRecordCompleteCallback + /** 启动视频压缩,压缩效果同`chooseVideo` */ + compressed?: boolean + /** 接口调用失败的回调函数 */ + fail?: StopRecordFailCallback + /** 接口调用成功的回调函数 */ + success?: CameraContextStopRecordSuccessCallback + } + interface CameraFrameListenerStartOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartFailCallback + /** 接口调用成功的回调函数 */ + success?: StartSuccessCallback + } + /** Canvas 实例,可通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取。 + * + * **示例代码** + * + * + * + * 2D Canvas 示例 + * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/SHfgCmmq7UcM) + * + * WebGL 示例 + * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/qEGUOqmf7T8z) + * + * 最低基础库: `2.7.0` */ + interface Canvas { + /** 画布高度 */ + height: number + /** 画布宽度 */ + width: number + } + /** canvas 组件的绘图上下文。CanvasContext 是旧版的接口, 新版 Canvas 2D 接口与 Web 一致。 */ + interface CanvasContext { + /** 填充颜色。用法同 [CanvasContext.setFillStyle()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html)。 + * + * 最低基础库: `1.9.90` */ + fillStyle: string | CanvasGradient + /** 当前字体样式的属性。符合 [CSS font 语法](https://developer.mozilla.org/zh-CN/docs/Web/CSS/font) 的 DOMString 字符串,至少需要提供字体大小和字体族名。默认值为 10px sans-serif。 + * + * 最低基础库: `1.9.90` */ + font: string + /** 全局画笔透明度。范围 0-1,0 表示完全透明,1 表示完全不透明。 */ + globalAlpha: number + /** 在绘制新形状时应用的合成操作的类型。目前安卓版本只适用于 `fill` 填充块的合成,用于 `stroke` 线段的合成效果都是 `source-over`。 + * + * 目前支持的操作有 + * - 安卓:xor, source-over, source-atop, destination-out, lighter, overlay, darken, lighten, hard-light + * - iOS:xor, source-over, source-atop, destination-over, destination-out, lighter, multiply, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, saturation, luminosity + * + * 最低基础库: `1.9.90` */ + globalCompositeOperation: string + /** 线条的端点样式。用法同 [CanvasContext.setLineCap()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineCap.html)。 + * + * 最低基础库: `1.9.90` */ + lineCap: string + /** 虚线偏移量,初始值为0 + * + * 最低基础库: `1.9.90` */ + lineDashOffset: number + /** 线条的交点样式。用法同 [CanvasContext.setLineJoin()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html)。 + * + * 可选值: + * - 'bevel': 斜角; + * - 'round': 圆角; + * - 'miter': 尖角; + * + * 最低基础库: `1.9.90` */ + lineJoin: 'bevel' | 'round' | 'miter' + /** 线条的宽度。用法同 [CanvasContext.setLineWidth()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineWidth.html)。 + * + * 最低基础库: `1.9.90` */ + lineWidth: number + /** 最大斜接长度。用法同 [CanvasContext.setMiterLimit()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setMiterLimit.html)。 + * + * 最低基础库: `1.9.90` */ + miterLimit: number + /** 阴影的模糊级别 + * + * 最低基础库: `1.9.90` */ + shadowBlur: number + /** 阴影的颜色 + * + * 最低基础库: `1.9.90` */ + shadowColor: number + /** 阴影相对于形状在水平方向的偏移 + * + * 最低基础库: `1.9.90` */ + shadowOffsetX: number + /** 阴影相对于形状在竖直方向的偏移 + * + * 最低基础库: `1.9.90` */ + shadowOffsetY: number + /** 边框颜色。用法同 [CanvasContext.setStrokeStyle()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html)。 + * + * 最低基础库: `1.9.90` */ + strokeStyle: string | CanvasGradient + } + interface CanvasGetImageDataOption { + /** 画布标识,传入 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件的 `canvas-id` 属性。 */ + canvasId: string + /** 将要被提取的图像数据矩形区域的高度 */ + height: number + /** 将要被提取的图像数据矩形区域的宽度 */ + width: number + /** 将要被提取的图像数据矩形区域的左上角横坐标 */ + x: number + /** 将要被提取的图像数据矩形区域的左上角纵坐标 */ + y: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CanvasGetImageDataCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: CanvasGetImageDataFailCallback + /** 接口调用成功的回调函数 */ + success?: CanvasGetImageDataSuccessCallback + } + interface CanvasGetImageDataSuccessCallbackResult { + /** 图像像素点数据,一维数组,每四项表示一个像素点的 rgba */ + data: Uint8ClampedArray + /** 图像数据矩形的高度 */ + height: number + /** 图像数据矩形的宽度 */ + width: number + errMsg: string + } + interface CanvasPutImageDataOption { + /** 画布标识,传入 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件的 canvas-id 属性。 */ + canvasId: string + /** 图像像素点数据,一维数组,每四项表示一个像素点的 rgba */ + data: Uint8ClampedArray + /** 源图像数据矩形区域的高度 */ + height: number + /** 源图像数据矩形区域的宽度 */ + width: number + /** 源图像数据在目标画布中的位置偏移量(x 轴方向的偏移量) */ + x: number + /** 源图像数据在目标画布中的位置偏移量(y 轴方向的偏移量) */ + y: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CanvasPutImageDataCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: CanvasPutImageDataFailCallback + /** 接口调用成功的回调函数 */ + success?: CanvasPutImageDataSuccessCallback + } + interface CanvasToTempFilePathOption { + /** 画布标识,传入 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件实例 (canvas type="2d" 时使用该属性)。 */ + canvas?: IAnyObject + /** 画布标识,传入 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件的 canvas-id */ + canvasId?: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CanvasToTempFilePathCompleteCallback + /** 输出的图片的高度 + * + * 最低基础库: `1.2.0` */ + destHeight?: number + /** 输出的图片的宽度 + * + * 最低基础库: `1.2.0` */ + destWidth?: number + /** 接口调用失败的回调函数 */ + fail?: CanvasToTempFilePathFailCallback + /** 目标文件的类型 + * + * 可选值: + * - 'jpg': jpg 图片; + * - 'png': png 图片; + * + * 最低基础库: `1.7.0` */ + fileType?: 'jpg' | 'png' + /** 指定的画布区域的高度 + * + * 最低基础库: `1.2.0` */ + height?: number + /** 图片的质量,目前仅对 jpg 有效。取值范围为 (0, 1],不在范围内时当作 1.0 处理。 + * + * 最低基础库: `1.7.0` */ + quality?: number + /** 接口调用成功的回调函数 */ + success?: CanvasToTempFilePathSuccessCallback + /** 指定的画布区域的宽度 + * + * 最低基础库: `1.2.0` */ + width?: number + /** 指定的画布区域的左上角横坐标 + * + * 最低基础库: `1.2.0` */ + x?: number + /** 指定的画布区域的左上角纵坐标 + * + * 最低基础库: `1.2.0` */ + y?: number + } + interface CanvasToTempFilePathSuccessCallbackResult { + /** 生成文件的临时路径 (本地路径) */ + tempFilePath: string + errMsg: string + } + /** characteristics列表 */ + interface Characteristic { + /** Characteristic 的 uuid */ + uuid: string + /** 描述符数据 */ + descriptors?: CharacteristicDescriptor[] + /** 特征值权限 */ + permission?: CharacteristicPermission + /** 特征值支持的操作 */ + properties?: CharacteristicProperties + /** 特征值对应的二进制值 */ + value?: ArrayBuffer + } + /** 描述符数据 */ + interface CharacteristicDescriptor { + /** Descriptor 的 uuid */ + uuid: string + /** 描述符的权限 */ + permission?: DescriptorPermission + /** 描述符数据 */ + value?: ArrayBuffer + } + /** 特征值权限 */ + interface CharacteristicPermission { + /** 加密读请求 */ + readEncryptionRequired?: boolean + /** 可读 */ + readable?: boolean + /** 加密写请求 */ + writeEncryptionRequired?: boolean + /** 可写 */ + writeable?: boolean + } + /** 特征值支持的操作 */ + interface CharacteristicProperties { + /** 回包 */ + indicate?: boolean + /** 订阅 */ + notify?: boolean + /** 读 */ + read?: boolean + /** 写 */ + write?: boolean + } + interface CheckIsOpenAccessibilityOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CheckIsOpenAccessibilityCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: CheckIsOpenAccessibilityFailCallback + /** 接口调用成功的回调函数 */ + success?: CheckIsOpenAccessibilitySuccessCallback + } + interface CheckIsOpenAccessibilitySuccessCallbackOption { + /** iOS 上开启辅助功能旁白,安卓开启 talkback 时返回 true */ + open: boolean + } + interface CheckIsSoterEnrolledInDeviceOption { + /** 认证方式 + * + * 可选值: + * - 'fingerPrint': 指纹识别; + * - 'facial': 人脸识别; + * - 'speech': 声纹识别(暂未支持); */ + checkAuthMode: 'fingerPrint' | 'facial' | 'speech' + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CheckIsSoterEnrolledInDeviceCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: CheckIsSoterEnrolledInDeviceFailCallback + /** 接口调用成功的回调函数 */ + success?: CheckIsSoterEnrolledInDeviceSuccessCallback + } + interface CheckIsSoterEnrolledInDeviceSuccessCallbackResult { + /** 错误信息 */ + errMsg: string + /** 是否已录入信息 */ + isEnrolled: boolean + } + interface CheckIsSupportSoterAuthenticationOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CheckIsSupportSoterAuthenticationCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: CheckIsSupportSoterAuthenticationFailCallback + /** 接口调用成功的回调函数 */ + success?: CheckIsSupportSoterAuthenticationSuccessCallback + } + interface CheckIsSupportSoterAuthenticationSuccessCallbackResult { + /** 该设备支持的可被SOTER识别的生物识别方式 + * + * 可选值: + * - 'fingerPrint': 指纹识别; + * - 'facial': 人脸识别; + * - 'speech': 声纹识别(暂未支持); */ + supportMode: Array<'fingerPrint' | 'facial' | 'speech'> + errMsg: string + } + interface CheckSessionOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CheckSessionCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: CheckSessionFailCallback + /** 接口调用成功的回调函数 */ + success?: CheckSessionSuccessCallback + } + interface ChooseAddressOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ChooseAddressCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ChooseAddressFailCallback + /** 接口调用成功的回调函数 */ + success?: ChooseAddressSuccessCallback + } + interface ChooseAddressSuccessCallbackResult { + /** 国标收货地址第二级地址 */ + cityName: string + /** 国标收货地址第三级地址 */ + countyName: string + /** 详细收货地址信息 */ + detailInfo: string + /** 错误信息 */ + errMsg: string + /** 收货地址国家码 */ + nationalCode: string + /** 邮编 */ + postalCode: string + /** 国标收货地址第一级地址 */ + provinceName: string + /** 收货人手机号码 */ + telNumber: string + /** 收货人姓名 */ + userName: string + } + /** 返回选择的文件的本地临时文件对象数组 */ + interface ChooseFile { + /** 选择的文件名称 */ + name: string + /** 本地临时文件路径 (本地路径) */ + path: string + /** 本地临时文件大小,单位 B */ + size: number + /** 选择的文件的会话发送时间,Unix时间戳,工具暂不支持此属性 */ + time: number + /** 选择的文件类型 + * + * 可选值: + * - 'video': 选择了视频文件; + * - 'image': 选择了图片文件; + * - 'file': 选择了除图片和视频的文件; */ + type: 'video' | 'image' | 'file' + } + interface ChooseImageOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ChooseImageCompleteCallback + /** 最多可以选择的图片张数 */ + count?: number + /** 接口调用失败的回调函数 */ + fail?: ChooseImageFailCallback + /** 所选的图片的尺寸 + * + * 可选值: + * - 'original': 原图; + * - 'compressed': 压缩图; */ + sizeType?: Array<'original' | 'compressed'> + /** 选择图片的来源 + * + * 可选值: + * - 'album': 从相册选图; + * - 'camera': 使用相机; */ + sourceType?: Array<'album' | 'camera'> + /** 接口调用成功的回调函数 */ + success?: ChooseImageSuccessCallback + } + interface ChooseImageSuccessCallbackResult { + /** 图片的本地临时文件路径列表 (本地路径) */ + tempFilePaths: string[] + /** 图片的本地临时文件列表 + * + * 最低基础库: `1.2.0` */ + tempFiles: ImageFile[] + errMsg: string + } + interface ChooseInvoiceOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ChooseInvoiceCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ChooseInvoiceFailCallback + /** 接口调用成功的回调函数 */ + success?: ChooseInvoiceSuccessCallback + } + interface ChooseInvoiceSuccessCallbackResult { + /** 用户选中的发票信息,格式为一个 JSON 字符串,包含三个字段: card_id:所选发票卡券的 cardId,encrypt_code:所选发票卡券的加密 code,报销方可以通过 cardId 和 encryptCode 获得报销发票的信息,app_id: 发票方的 appId。 */ + invoiceInfo: string + errMsg: string + } + interface ChooseInvoiceTitleOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ChooseInvoiceTitleCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ChooseInvoiceTitleFailCallback + /** 接口调用成功的回调函数 */ + success?: ChooseInvoiceTitleSuccessCallback + } + interface ChooseInvoiceTitleSuccessCallbackResult { + /** 银行账号 */ + bankAccount: string + /** 银行名称 */ + bankName: string + /** 单位地址 */ + companyAddress: string + /** 错误信息 */ + errMsg: string + /** 抬头税号 */ + taxNumber: string + /** 手机号码 */ + telephone: string + /** 抬头名称 */ + title: string + /** 抬头类型 + * + * 可选值: + * - 0: 单位; + * - 1: 个人; */ + type: 0 | 1 + } + interface ChooseLocationOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ChooseLocationCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ChooseLocationFailCallback + /** 目标地纬度 + * + * 最低基础库: `2.9.0` */ + latitude?: number + /** 目标地经度 + * + * 最低基础库: `2.9.0` */ + longitude?: number + /** 接口调用成功的回调函数 */ + success?: ChooseLocationSuccessCallback + } + interface ChooseLocationSuccessCallbackResult { + /** 详细地址 */ + address: string + /** 纬度,浮点数,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */ + latitude: string + /** 经度,浮点数,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */ + longitude: string + /** 位置名称 */ + name: string + errMsg: string + } + interface ChooseMediaOption { + /** 仅在 sourceType 为 camera 时生效,使用前置或后置摄像头 + * + * 可选值: + * - 'back': 使用后置摄像头; + * - 'front': 使用前置摄像头; */ + camera?: 'back' | 'front' + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ChooseMediaCompleteCallback + /** 最多可以选择的文件个数 */ + count?: number + /** 接口调用失败的回调函数 */ + fail?: ChooseMediaFailCallback + /** 拍摄视频最长拍摄时间,单位秒。时间范围为 3s 至 30s 之间 */ + maxDuration?: number + /** 文件类型 + * + * 可选值: + * - 'image': 只能拍摄图片或从相册选择图片; + * - 'video': 只能拍摄视频或从相册选择视频; */ + mediaType?: Array<'image' | 'video'> + /** 仅对 mediaType 为 image 时有效,是否压缩所选文件 */ + sizeType?: string[] + /** 图片和视频选择的来源 + * + * 可选值: + * - 'album': 从相册选择; + * - 'camera': 使用相机拍摄; */ + sourceType?: Array<'album' | 'camera'> + /** 接口调用成功的回调函数 */ + success?: ChooseMediaSuccessCallback + } + interface ChooseMediaSuccessCallbackResult { + /** 本地临时文件列表 */ + tempFiles: MediaFile[] + /** 文件类型,有效值有 image 、video */ + type: string + errMsg: string + } + interface ChooseMessageFileOption { + /** 最多可以选择的文件个数,可以 0~100 */ + count: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ChooseMessageFileCompleteCallback + /** 根据文件拓展名过滤,仅 type==file 时有效。每一项都不能是空字符串。默认不过滤。 + * + * 最低基础库: `2.6.0` */ + extension?: string[] + /** 接口调用失败的回调函数 */ + fail?: ChooseMessageFileFailCallback + /** 接口调用成功的回调函数 */ + success?: ChooseMessageFileSuccessCallback + /** 所选的文件的类型 + * + * 可选值: + * - 'all': 从所有文件选择; + * - 'video': 只能选择视频文件; + * - 'image': 只能选择图片文件; + * - 'file': 可以选择除了图片和视频之外的其它的文件; */ + type?: 'all' | 'video' | 'image' | 'file' + } + interface ChooseMessageFileSuccessCallbackResult { + /** 返回选择的文件的本地临时文件对象数组 */ + tempFiles: ChooseFile[] + errMsg: string + } + interface ChooseVideoOption { + /** 默认拉起的是前置或者后置摄像头。部分 Android 手机下由于系统 ROM 不支持无法生效 + * + * 可选值: + * - 'back': 默认拉起后置摄像头; + * - 'front': 默认拉起前置摄像头; */ + camera?: 'back' | 'front' + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ChooseVideoCompleteCallback + /** 是否压缩所选择的视频文件 + * + * 最低基础库: `1.6.0` */ + compressed?: boolean + /** 接口调用失败的回调函数 */ + fail?: ChooseVideoFailCallback + /** 拍摄视频最长拍摄时间,单位秒 */ + maxDuration?: number + /** 视频选择的来源 + * + * 可选值: + * - 'album': 从相册选择视频; + * - 'camera': 使用相机拍摄视频; */ + sourceType?: Array<'album' | 'camera'> + /** 接口调用成功的回调函数 */ + success?: ChooseVideoSuccessCallback + } + interface ChooseVideoSuccessCallbackResult { + /** 选定视频的时间长度 */ + duration: number + /** 返回选定视频的高度 */ + height: number + /** 选定视频的数据量大小 */ + size: number + /** 选定视频的临时文件路径 (本地路径) */ + tempFilePath: string + /** 返回选定视频的宽度 */ + width: number + errMsg: string + } + interface ClearOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ClearCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ClearFailCallback + /** 接口调用成功的回调函数 */ + success?: ClearSuccessCallback + } + interface ClearStorageOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ClearStorageCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ClearStorageFailCallback + /** 接口调用成功的回调函数 */ + success?: ClearStorageSuccessCallback + } + interface CloseBLEConnectionOption { + /** 用于区分设备的 id */ + deviceId: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CloseBLEConnectionCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: CloseBLEConnectionFailCallback + /** 接口调用成功的回调函数 */ + success?: CloseBLEConnectionSuccessCallback + } + interface CloseBluetoothAdapterOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CloseBluetoothAdapterCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: CloseBluetoothAdapterFailCallback + /** 接口调用成功的回调函数 */ + success?: CloseBluetoothAdapterSuccessCallback + } + interface CloseSocketOption { + /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ + code?: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CloseSocketCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: CloseSocketFailCallback + /** 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于 123 字节的 UTF-8 文本(不是字符)。 */ + reason?: string + /** 接口调用成功的回调函数 */ + success?: CloseSocketSuccessCallback + } + /** 颜色。可以用以下几种方式来表示 canvas 中使用的颜色: + * + * - RGB 颜色: 如 `'rgb(255, 0, 0)'` + * - RGBA 颜色:如 `'rgba(255, 0, 0, 0.3)'` + * - 16 进制颜色: 如 `'#FF0000'` + * - 预定义的颜色: 如 `'red'` + * + * 其中预定义颜色有以下148个: + * *注意**: Color Name 大小写不敏感 + * + * | Color Name | HEX | + * | -------------------- | ------- | + * | AliceBlue | #F0F8FF | + * | AntiqueWhite | #FAEBD7 | + * | Aqua | #00FFFF | + * | Aquamarine | #7FFFD4 | + * | Azure | #F0FFFF | + * | Beige | #F5F5DC | + * | Bisque | #FFE4C4 | + * | Black | #000000 | + * | BlanchedAlmond | #FFEBCD | + * | Blue | #0000FF | + * | BlueViolet | #8A2BE2 | + * | Brown | #A52A2A | + * | BurlyWood | #DEB887 | + * | CadetBlue | #5F9EA0 | + * | Chartreuse | #7FFF00 | + * | Chocolate | #D2691E | + * | Coral | #FF7F50 | + * | CornflowerBlue | #6495ED | + * | Cornsilk | #FFF8DC | + * | Crimson | #DC143C | + * | Cyan | #00FFFF | + * | DarkBlue | #00008B | + * | DarkCyan | #008B8B | + * | DarkGoldenRod | #B8860B | + * | DarkGray | #A9A9A9 | + * | DarkGrey | #A9A9A9 | + * | DarkGreen | #006400 | + * | DarkKhaki | #BDB76B | + * | DarkMagenta | #8B008B | + * | DarkOliveGreen | #556B2F | + * | DarkOrange | #FF8C00 | + * | DarkOrchid | #9932CC | + * | DarkRed | #8B0000 | + * | DarkSalmon | #E9967A | + * | DarkSeaGreen | #8FBC8F | + * | DarkSlateBlue | #483D8B | + * | DarkSlateGray | #2F4F4F | + * | DarkSlateGrey | #2F4F4F | + * | DarkTurquoise | #00CED1 | + * | DarkViolet | #9400D3 | + * | DeepPink | #FF1493 | + * | DeepSkyBlue | #00BFFF | + * | DimGray | #696969 | + * | DimGrey | #696969 | + * | DodgerBlue | #1E90FF | + * | FireBrick | #B22222 | + * | FloralWhite | #FFFAF0 | + * | ForestGreen | #228B22 | + * | Fuchsia | #FF00FF | + * | Gainsboro | #DCDCDC | + * | GhostWhite | #F8F8FF | + * | Gold | #FFD700 | + * | GoldenRod | #DAA520 | + * | Gray | #808080 | + * | Grey | #808080 | + * | Green | #008000 | + * | GreenYellow | #ADFF2F | + * | HoneyDew | #F0FFF0 | + * | HotPink | #FF69B4 | + * | IndianRed | #CD5C5C | + * | Indigo | #4B0082 | + * | Ivory | #FFFFF0 | + * | Khaki | #F0E68C | + * | Lavender | #E6E6FA | + * | LavenderBlush | #FFF0F5 | + * | LawnGreen | #7CFC00 | + * | LemonChiffon | #FFFACD | + * | LightBlue | #ADD8E6 | + * | LightCoral | #F08080 | + * | LightCyan | #E0FFFF | + * | LightGoldenRodYellow | #FAFAD2 | + * | LightGray | #D3D3D3 | + * | LightGrey | #D3D3D3 | + * | LightGreen | #90EE90 | + * | LightPink | #FFB6C1 | + * | LightSalmon | #FFA07A | + * | LightSeaGreen | #20B2AA | + * | LightSkyBlue | #87CEFA | + * | LightSlateGray | #778899 | + * | LightSlateGrey | #778899 | + * | LightSteelBlue | #B0C4DE | + * | LightYellow | #FFFFE0 | + * | Lime | #00FF00 | + * | LimeGreen | #32CD32 | + * | Linen | #FAF0E6 | + * | Magenta | #FF00FF | + * | Maroon | #800000 | + * | MediumAquaMarine | #66CDAA | + * | MediumBlue | #0000CD | + * | MediumOrchid | #BA55D3 | + * | MediumPurple | #9370DB | + * | MediumSeaGreen | #3CB371 | + * | MediumSlateBlue | #7B68EE | + * | MediumSpringGreen | #00FA9A | + * | MediumTurquoise | #48D1CC | + * | MediumVioletRed | #C71585 | + * | MidnightBlue | #191970 | + * | MintCream | #F5FFFA | + * | MistyRose | #FFE4E1 | + * | Moccasin | #FFE4B5 | + * | NavajoWhite | #FFDEAD | + * | Navy | #000080 | + * | OldLace | #FDF5E6 | + * | Olive | #808000 | + * | OliveDrab | #6B8E23 | + * | Orange | #FFA500 | + * | OrangeRed | #FF4500 | + * | Orchid | #DA70D6 | + * | PaleGoldenRod | #EEE8AA | + * | PaleGreen | #98FB98 | + * | PaleTurquoise | #AFEEEE | + * | PaleVioletRed | #DB7093 | + * | PapayaWhip | #FFEFD5 | + * | PeachPuff | #FFDAB9 | + * | Peru | #CD853F | + * | Pink | #FFC0CB | + * | Plum | #DDA0DD | + * | PowderBlue | #B0E0E6 | + * | Purple | #800080 | + * | RebeccaPurple | #663399 | + * | Red | #FF0000 | + * | RosyBrown | #BC8F8F | + * | RoyalBlue | #4169E1 | + * | SaddleBrown | #8B4513 | + * | Salmon | #FA8072 | + * | SandyBrown | #F4A460 | + * | SeaGreen | #2E8B57 | + * | SeaShell | #FFF5EE | + * | Sienna | #A0522D | + * | Silver | #C0C0C0 | + * | SkyBlue | #87CEEB | + * | SlateBlue | #6A5ACD | + * | SlateGray | #708090 | + * | SlateGrey | #708090 | + * | Snow | #FFFAFA | + * | SpringGreen | #00FF7F | + * | SteelBlue | #4682B4 | + * | Tan | #D2B48C | + * | Teal | #008080 | + * | Thistle | #D8BFD8 | + * | Tomato | #FF6347 | + * | Turquoise | #40E0D0 | + * | Violet | #EE82EE | + * | Wheat | #F5DEB3 | + * | White | #FFFFFF | + * | WhiteSmoke | #F5F5F5 | + * | Yellow | #FFFF00 | + * | YellowGreen | #9ACD32 | */ + interface Color {} + interface CompressImageOption { + /** 图片路径,图片的路径,支持本地路径、代码包路径 */ + src: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CompressImageCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: CompressImageFailCallback + /** 压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效)。 */ + quality?: number + /** 接口调用成功的回调函数 */ + success?: CompressImageSuccessCallback + } + interface CompressImageSuccessCallbackResult { + /** 压缩后图片的临时文件路径 (本地路径) */ + tempFilePath: string + errMsg: string + } + interface CompressVideoOption { + /** 码率,单位 kbps */ + bitrate: number + /** 帧率 */ + fps: number + /** 压缩质量 + * + * 可选值: + * - 'low': 低; + * - 'medium': 中; + * - 'high': 高; */ + quality: 'low' | 'medium' | 'high' + /** 相对于原视频的分辨率比例,取值范围(0, 1] */ + resolution: number + /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */ + src: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CompressVideoCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: CompressVideoFailCallback + /** 接口调用成功的回调函数 */ + success?: CompressVideoSuccessCallback + } + interface CompressVideoSuccessCallbackResult { + /** 压缩后的大小,单位 kB */ + size: string + /** 压缩后的临时文件地址 */ + tempFilePath: string + errMsg: string + } + interface ConnectOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ConnectCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ConnectFailCallback + /** 接口调用成功的回调函数 */ + success?: ConnectSuccessCallback + } + interface ConnectSocketOption { + /** 开发者服务器 wss 接口地址 */ + url: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ConnectSocketCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ConnectSocketFailCallback + /** HTTP Header,Header 中不能设置 Referer */ + header?: IAnyObject + /** 是否开启压缩扩展 + * + * 最低基础库: `2.8.0` */ + perMessageDeflate?: boolean + /** 子协议数组 + * + * 最低基础库: `1.4.0` */ + protocols?: string[] + /** 接口调用成功的回调函数 */ + success?: ConnectSocketSuccessCallback + /** 建立 TCP 连接的时候的 TCP_NODELAY 设置 + * + * 最低基础库: `2.4.0` */ + tcpNoDelay?: boolean + /** 超时时间,单位为毫秒 + * + * 最低基础库: `2.10.0` */ + timeout?: number + } + interface ConnectWifiOption { + /** Wi-Fi 设备 SSID */ + SSID: string + /** Wi-Fi 设备密码 */ + password: string + /** Wi-Fi 设备 BSSID */ + BSSID?: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ConnectWifiCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ConnectWifiFailCallback + /** 跳转到系统设置页进行连接,仅安卓生效 + * + * 最低基础库: `2.12.0` */ + maunal?: boolean + /** 接口调用成功的回调函数 */ + success?: ConnectWifiSuccessCallback + } + interface ContextCallbackResult { + /** 节点对应的 Context 对象 */ + context: IAnyObject + } + interface CopyFileFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail permission denied, copyFile ${srcPath} -> ${destPath}': 指定目标文件路径没有写权限; + * - 'fail no such file or directory, copyFile ${srcPath} -> ${destPath}': 源文件不存在,或目标文件路径的上层目录不存在; + * - 'fail the maximum size of the file storage limit is exceeded': 存储空间不足; + * - 'fail sdcard not mounted': Android sdcard 挂载失败; */ + errMsg: string + } + interface CopyFileOption { + /** 目标文件路径,支持本地路径 */ + destPath: string + /** 源文件路径,支持本地路径 */ + srcPath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CopyFileCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: CopyFileFailCallback + /** 接口调用成功的回调函数 */ + success?: CopyFileSuccessCallback + } + interface CreateBLEConnectionOption { + /** 用于区分设备的 id */ + deviceId: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CreateBLEConnectionCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: CreateBLEConnectionFailCallback + /** 接口调用成功的回调函数 */ + success?: CreateBLEConnectionSuccessCallback + /** 超时时间,单位ms,不填表示不会超时 */ + timeout?: number + } + interface CreateBLEPeripheralServerOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CreateBLEPeripheralServerCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: CreateBLEPeripheralServerFailCallback + /** 接口调用成功的回调函数 */ + success?: CreateBLEPeripheralServerSuccessCallback + } + interface CreateBLEPeripheralServerSuccessCallbackResult { + /** [BLEPeripheralServer](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.html) + * + * 外围设备的服务端。 */ + server: BLEPeripheralServer + errMsg: string + } + /** 选项 */ + interface CreateIntersectionObserverOption { + /** 初始的相交比例,如果调用时检测到的相交比例与这个值不相等且达到阈值,则会触发一次监听器的回调函数。 */ + initialRatio?: number + /** 是否同时观测多个目标节点(而非一个),如果设为 true ,observe 的 targetSelector 将选中多个节点(注意:同时选中过多节点将影响渲染性能) + * + * 最低基础库: `2.0.0` */ + observeAll?: boolean + /** 一个数值数组,包含所有阈值。 */ + thresholds?: number[] + } + interface CreateInterstitialAdOption { + /** 广告单元 id */ + adUnitId: string + } + interface CreateMediaRecorderOption { + /** 指定录制的时长(s),到达自动停止。最大 7200,最小 5 */ + duration?: number + /** 视频 fps */ + fps?: number + /** 视频关键帧间隔 */ + gop?: number + /** 视频比特率(kbps),最小值 600,最大值 3000 */ + videoBitsPerSecond?: number + } + interface CreateRewardedVideoAdOption { + /** 广告单元 id */ + adUnitId: string + /** 是否启用多例模式,默认为false + * + * 最低基础库: `2.8.0` */ + multiton?: boolean + } + /** 可选参数 */ + interface CreateWorkerOption { + /** 是否使用实验worker。在iOS下,实验worker的JS运行效率比非实验worker提升近十倍,如需在worker内进行重度计算的建议开启此选项。 + * + * 最低基础库: `2.13.0` */ + useExperimentalWorker?: boolean + } + /** 弹幕内容 */ + interface Danmu { + /** 弹幕文字 */ + text: string + /** 弹幕颜色 */ + color?: string + } + /** 可选的字体描述符 */ + interface DescOption { + /** 字体样式,可选值为 normal / italic / oblique */ + style?: string + /** 设置小型大写字母的字体显示文本,可选值为 normal / small-caps / inherit */ + variant?: string + /** 字体粗细,可选值为 normal / bold / 100 / 200../ 900 */ + weight?: string + } + /** 描述符的权限 */ + interface DescriptorPermission { + /** 读 */ + read?: boolean + /** 写 */ + write?: boolean + } + /** 指定 marker 移动到的目标点 */ + interface DestinationOption { + /** 纬度 */ + latitude: number + /** 经度 */ + longitude: number + } + interface DisableAlertBeforeUnloadOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: DisableAlertBeforeUnloadCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: DisableAlertBeforeUnloadFailCallback + /** 接口调用成功的回调函数 */ + success?: DisableAlertBeforeUnloadSuccessCallback + } + interface DownloadFileOption { + /** 下载资源的 url */ + url: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: DownloadFileCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: DownloadFileFailCallback + /** 指定文件下载后存储的路径 (本地路径) + * + * 最低基础库: `1.8.0` */ + filePath?: string + /** HTTP 请求的 Header,Header 中不能设置 Referer */ + header?: IAnyObject + /** 接口调用成功的回调函数 */ + success?: DownloadFileSuccessCallback + /** 超时时间,单位为毫秒 + * + * 最低基础库: `2.10.0` */ + timeout?: number + } + interface DownloadFileSuccessCallbackResult { + /** 用户文件路径 (本地路径)。传入 filePath 时会返回,跟传入的 filePath 一致 */ + filePath: string + /** 网络请求过程中一些调试信息 + * + * 最低基础库: `2.10.4` */ + profile: DownloadProfile + /** 开发者服务器返回的 HTTP 状态码 */ + statusCode: number + /** 临时文件路径 (本地路径)。没传入 filePath 指定文件存储路径时会返回,下载后的文件会存储到一个临时文件 */ + tempFilePath: string + errMsg: string + } + /** 网络请求过程中一些调试信息 + * + * 最低基础库: `2.10.4` */ + interface DownloadProfile { + /** SSL建立完成的时间,如果不是安全连接,则值为 0 */ + SSLconnectionEnd: number + /** SSL建立连接的时间,如果不是安全连接,则值为 0 */ + SSLconnectionStart: number + /** HTTP(TCP) 完成建立连接的时间(完成握手),如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接完成的时间。注意这里握手结束,包括安全连接建立完成、SOCKS 授权通过 */ + connectEnd: number + /** HTTP(TCP) 开始建立连接的时间,如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接开始的时间 */ + connectStart: number + /** DNS 域名查询完成的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */ + domainLookupEnd: number + /** DNS 域名查询开始的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */ + domainLookupStart: number + /** 评估当前网络下载的kbps */ + downstreamThroughputKbpsEstimate: number + /** 评估的网络状态 slow 2g/2g/3g/4g */ + estimate_nettype: string + /** 组件准备好使用 HTTP 请求抓取资源的时间,这发生在检查本地缓存之前 */ + fetchStart: number + /** 协议层根据多个请求评估当前网络的 rtt(仅供参考) */ + httpRttEstimate: number + /** 当前请求的IP */ + peerIP: string + /** 当前请求的端口 */ + port: number + /** 收到字节数 */ + receivedBytedCount: number + /** 最后一个 HTTP 重定向完成时的时间。有跳转且是同域名内部的重定向才算,否则值为 0 */ + redirectEnd: number + /** 第一个 HTTP 重定向发生时的时间。有跳转且是同域名内的重定向才算,否则值为 0 */ + redirectStart: number + /** HTTP请求读取真实文档结束的时间 */ + requestEnd: number + /** HTTP请求读取真实文档开始的时间(完成建立连接),包括从本地读取缓存。连接错误重连时,这里显示的也是新建立连接的时间 */ + requestStart: number + /** HTTP 响应全部接收完成的时间(获取到最后一个字节),包括从本地读取缓存 */ + responseEnd: number + /** HTTP 开始接收响应的时间(获取到第一个字节),包括从本地读取缓存 */ + responseStart: number + /** 当次请求连接过程中实时 rtt */ + rtt: number + /** 发送的字节数 */ + sendBytesCount: number + /** 是否复用连接 */ + socketReused: boolean + /** 当前网络的实际下载kbps */ + throughputKbps: number + /** 传输层根据多个请求评估的当前网络的 rtt(仅供参考) */ + transportRttEstimate: number + } + interface DownloadTaskOnProgressUpdateCallbackResult { + /** 下载进度百分比 */ + progress: number + /** 预期需要下载的数据总长度,单位 Bytes */ + totalBytesExpectedToWrite: number + /** 已经下载的数据长度,单位 Bytes */ + totalBytesWritten: number + } + interface EnableAlertBeforeUnloadOption { + /** 询问对话框内容 */ + message: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: EnableAlertBeforeUnloadCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: EnableAlertBeforeUnloadFailCallback + /** 接口调用成功的回调函数 */ + success?: EnableAlertBeforeUnloadSuccessCallback + } + interface ExitFullScreenOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ExitFullScreenCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ExitFullScreenFailCallback + /** 接口调用成功的回调函数 */ + success?: ExitFullScreenSuccessCallback + } + interface ExitPictureInPictureOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ExitPictureInPictureCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ExitPictureInPictureFailCallback + /** 接口调用成功的回调函数 */ + success?: ExitPictureInPictureSuccessCallback + } + interface ExitVoIPChatOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ExitVoIPChatCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ExitVoIPChatFailCallback + /** 接口调用成功的回调函数 */ + success?: ExitVoIPChatSuccessCallback + } + interface ExtractDataSourceOption { + /** 视频源地址,只支持本地文件 */ + source: string + } + interface Fields { + /** 指定样式名列表,返回节点对应样式名的当前值 + * + * 最低基础库: `2.1.0` */ + computedStyle?: string[] + /** 是否返回节点对应的 Context 对象 + * + * 最低基础库: `2.4.2` */ + context?: boolean + /** 是否返回节点 dataset */ + dataset?: boolean + /** 是否返回节点 id */ + id?: boolean + /** 是否返回节点 mark */ + mark?: boolean + /** 是否返回节点对应的 Node 实例 + * + * 最低基础库: `2.7.0` */ + node?: boolean + /** 指定属性名列表,返回节点对应属性名的当前属性值(只能获得组件文档中标注的常规属性值,id class style 和事件绑定的属性值不可获取) */ + properties?: string[] + /** 是否返回节点布局位置(`left` `right` `top` `bottom`) */ + rect?: boolean + /** 否 是否返回节点的 `scrollLeft` `scrollTop`,节点必须是 `scroll-view` 或者 `viewport` */ + scrollOffset?: boolean + /** 是否返回节点尺寸(`width` `height`) */ + size?: boolean + } + interface FileItem { + /** 文件保存时的时间戳,从1970/01/01 08:00:00 到当前时间的秒数 */ + createTime: number + /** 文件路径 (本地路径) */ + filePath: string + /** 本地文件大小,以字节为单位 */ + size: number + } + interface FileSystemManagerGetFileInfoOption { + /** 要读取的文件路径 (本地路径) */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetFileInfoCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: FileSystemManagerGetFileInfoFailCallback + /** 接口调用成功的回调函数 */ + success?: FileSystemManagerGetFileInfoSuccessCallback + } + interface FileSystemManagerGetFileInfoSuccessCallbackResult { + /** 文件大小,以字节为单位 */ + size: number + errMsg: string + } + interface FileSystemManagerGetSavedFileListOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetSavedFileListCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetSavedFileListFailCallback + /** 接口调用成功的回调函数 */ + success?: FileSystemManagerGetSavedFileListSuccessCallback + } + interface FileSystemManagerGetSavedFileListSuccessCallbackResult { + /** 文件数组 */ + fileList: FileItem[] + errMsg: string + } + interface FileSystemManagerRemoveSavedFileOption { + /** 需要删除的文件路径 (本地路径) */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RemoveSavedFileCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: FileSystemManagerRemoveSavedFileFailCallback + /** 接口调用成功的回调函数 */ + success?: RemoveSavedFileSuccessCallback + } + interface FileSystemManagerSaveFileOption { + /** 临时存储文件路径 (本地路径) */ + tempFilePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SaveFileCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: FileSystemManagerSaveFileFailCallback + /** 要存储的文件路径 (本地路径) */ + filePath?: string + /** 接口调用成功的回调函数 */ + success?: SaveFileSuccessCallback + } + /** 打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数 */ + interface ForwardMaterials { + /** 文件名 */ + name: string + /** 文件路径(如果是webview则是url) */ + path: string + /** 文件大小 */ + size: number + /** 文件的mimetype类型 */ + type: string + } + /** 视频帧数据,若取不到则返回 null。当缓冲区为空的时候可能暂停取不到数据。 */ + interface FrameDataOptions { + /** 帧数据 */ + data: ArrayBuffer + /** 帧数据高度 */ + height: number + /** 帧原始 dts */ + pkDts: number + /** 帧原始 pts */ + pkPts: number + /** 帧数据宽度 */ + width: number + } + interface FromScreenLocationOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: FromScreenLocationCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: FromScreenLocationFailCallback + /** 接口调用成功的回调函数 */ + success?: FromScreenLocationSuccessCallback + } + interface GetAtqaOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetAtqaCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetAtqaFailCallback + /** 接口调用成功的回调函数 */ + success?: GetAtqaSuccessCallback + } + interface GetAtqaSuccessCallbackResult { + /** 返回 ATQA/SENS_RES 数据 */ + atqa: ArrayBuffer + errMsg: string + } + interface GetAvailableAudioSourcesOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetAvailableAudioSourcesCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetAvailableAudioSourcesFailCallback + /** 接口调用成功的回调函数 */ + success?: GetAvailableAudioSourcesSuccessCallback + } + interface GetAvailableAudioSourcesSuccessCallbackResult { + /** 支持的音频输入源列表,可在 [RecorderManager.start()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.start.html) 接口中使用。返回值定义参考 https://developer.android.com/reference/kotlin/android/media/MediaRecorder.AudioSource + * + * 可选值: + * - 'auto': 自动设置,默认使用手机麦克风,插上耳麦后自动切换使用耳机麦克风,所有平台适用; + * - 'buildInMic': 手机麦克风,仅限 iOS; + * - 'headsetMic': 耳机麦克风,仅限 iOS; + * - 'mic': 麦克风(没插耳麦时是手机麦克风,插耳麦时是耳机麦克风),仅限 Android; + * - 'camcorder': 同 mic,适用于录制音视频内容,仅限 Android; + * - 'voice_communication': 同 mic,适用于实时沟通,仅限 Android; + * - 'voice_recognition': 同 mic,适用于语音识别,仅限 Android; */ + audioSources: Array< + | 'auto' + | 'buildInMic' + | 'headsetMic' + | 'mic' + | 'camcorder' + | 'voice_communication' + | 'voice_recognition' + > + errMsg: string + } + interface GetBLEDeviceCharacteristicsOption { + /** 蓝牙设备 id */ + deviceId: string + /** 蓝牙服务 uuid,需要使用 `getBLEDeviceServices` 获取 */ + serviceId: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetBLEDeviceCharacteristicsCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetBLEDeviceCharacteristicsFailCallback + /** 接口调用成功的回调函数 */ + success?: GetBLEDeviceCharacteristicsSuccessCallback + } + interface GetBLEDeviceCharacteristicsSuccessCallbackResult { + /** 设备特征值列表 */ + characteristics: BLECharacteristic[] + errMsg: string + } + interface GetBLEDeviceRSSIOption { + /** 蓝牙设备 id */ + deviceId: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetBLEDeviceRSSICompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetBLEDeviceRSSIFailCallback + /** 接口调用成功的回调函数 */ + success?: GetBLEDeviceRSSISuccessCallback + } + interface GetBLEDeviceRSSISuccessCallbackResult { + /** 信号强度 */ + RSSI: number + errMsg: string + } + interface GetBLEDeviceServicesOption { + /** 蓝牙设备 id */ + deviceId: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetBLEDeviceServicesCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetBLEDeviceServicesFailCallback + /** 接口调用成功的回调函数 */ + success?: GetBLEDeviceServicesSuccessCallback + } + interface GetBLEDeviceServicesSuccessCallbackResult { + /** 设备服务列表 */ + services: BLEService[] + errMsg: string + } + interface GetBackgroundAudioPlayerStateOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetBackgroundAudioPlayerStateCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetBackgroundAudioPlayerStateFailCallback + /** 接口调用成功的回调函数 */ + success?: GetBackgroundAudioPlayerStateSuccessCallback + } + interface GetBackgroundAudioPlayerStateSuccessCallbackResult { + /** 选定音频的播放位置(单位:s),只有在音乐播放中时返回 */ + currentPosition: number + /** 歌曲数据链接,只有在音乐播放中时返回 */ + dataUrl: string + /** 音频的下载进度百分比,只有在音乐播放中时返回 */ + downloadPercent: number + /** 选定音频的长度(单位:s),只有在音乐播放中时返回 */ + duration: number + /** 播放状态 + * + * 可选值: + * - 0: 暂停中; + * - 1: 播放中; + * - 2: 没有音乐播放; */ + status: 0 | 1 | 2 + errMsg: string + } + interface GetBackgroundFetchDataOption { + /** 取值为 periodic */ + fetchType: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetBackgroundFetchDataCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetBackgroundFetchDataFailCallback + /** 接口调用成功的回调函数 */ + success?: GetBackgroundFetchDataSuccessCallback + } + interface GetBackgroundFetchTokenOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetBackgroundFetchTokenCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetBackgroundFetchTokenFailCallback + /** 接口调用成功的回调函数 */ + success?: GetBackgroundFetchTokenSuccessCallback + } + interface GetBatteryInfoOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetBatteryInfoCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetBatteryInfoFailCallback + /** 接口调用成功的回调函数 */ + success?: GetBatteryInfoSuccessCallback + } + interface GetBatteryInfoSuccessCallbackResult { + /** 是否正在充电中 */ + isCharging: boolean + /** 设备电量,范围 1 - 100 */ + level: string + errMsg: string + } + interface GetBatteryInfoSyncResult { + /** 是否正在充电中 */ + isCharging: boolean + /** 设备电量,范围 1 - 100 */ + level: string + } + interface GetBeaconsOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetBeaconsCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetBeaconsFailCallback + /** 接口调用成功的回调函数 */ + success?: GetBeaconsSuccessCallback + } + interface GetBeaconsSuccessCallbackResult { + /** iBeacon 设备列表 */ + beacons: IBeaconInfo[] + errMsg: string + } + interface GetBluetoothAdapterStateOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetBluetoothAdapterStateCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetBluetoothAdapterStateFailCallback + /** 接口调用成功的回调函数 */ + success?: GetBluetoothAdapterStateSuccessCallback + } + interface GetBluetoothAdapterStateSuccessCallbackResult { + /** 蓝牙适配器是否可用 */ + available: boolean + /** 是否正在搜索设备 */ + discovering: boolean + errMsg: string + } + interface GetBluetoothDevicesOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetBluetoothDevicesCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetBluetoothDevicesFailCallback + /** 接口调用成功的回调函数 */ + success?: GetBluetoothDevicesSuccessCallback + } + interface GetBluetoothDevicesSuccessCallbackResult { + /** uuid 对应的的已连接设备列表 */ + devices: BlueToothDevice[] + errMsg: string + } + interface GetCenterLocationOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetCenterLocationCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetCenterLocationFailCallback + /** 接口调用成功的回调函数 */ + success?: GetCenterLocationSuccessCallback + } + interface GetCenterLocationSuccessCallbackResult { + /** 纬度 */ + latitude: number + /** 经度 */ + longitude: number + errMsg: string + } + interface GetClipboardDataOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetClipboardDataCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetClipboardDataFailCallback + /** 接口调用成功的回调函数 */ + success?: GetClipboardDataSuccessCallback + } + interface GetClipboardDataSuccessCallbackOption { + /** 剪贴板的内容 */ + data: string + } + interface GetConnectedBluetoothDevicesOption { + /** 蓝牙设备主 service 的 uuid 列表 */ + services: string[] + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetConnectedBluetoothDevicesCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetConnectedBluetoothDevicesFailCallback + /** 接口调用成功的回调函数 */ + success?: GetConnectedBluetoothDevicesSuccessCallback + } + interface GetConnectedBluetoothDevicesSuccessCallbackResult { + /** 搜索到的设备列表 */ + devices: BluetoothDeviceInfo[] + errMsg: string + } + interface GetConnectedWifiOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetConnectedWifiCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetConnectedWifiFailCallback + /** 接口调用成功的回调函数 */ + success?: GetConnectedWifiSuccessCallback + } + interface GetConnectedWifiSuccessCallbackResult { + /** [WifiInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/WifiInfo.html) + * + * Wi-Fi 信息 */ + wifi: WifiInfo + errMsg: string + } + interface GetContentsOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetContentsCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetContentsFailCallback + /** 接口调用成功的回调函数 */ + success?: GetContentsSuccessCallback + } + interface GetContentsSuccessCallbackResult { + /** 表示内容的delta对象 */ + delta: IAnyObject + /** 带标签的HTML内容 */ + html: string + /** 纯文本内容 */ + text: string + errMsg: string + } + interface GetExtConfigOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetExtConfigCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetExtConfigFailCallback + /** 接口调用成功的回调函数 */ + success?: GetExtConfigSuccessCallback + } + interface GetExtConfigSuccessCallbackResult { + /** 第三方平台自定义的数据 */ + extConfig: IAnyObject + errMsg: string + } + interface GetFileInfoFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail file not exist': 指定的 filePath 找不到文件; */ + errMsg: string + } + interface GetGroupEnterInfoOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetGroupEnterInfoCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetGroupEnterInfoFailCallback + /** 接口调用成功的回调函数 */ + success?: GetGroupEnterInfoSuccessCallback + } + interface GetGroupEnterInfoSuccessCallbackResult { + /** 敏感数据对应的云 ID,开通[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) + * + * 最低基础库: `2.7.0` */ + cloudID: string + /** 包括敏感数据在内的完整转发信息的加密数据,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */ + encryptedData: string + /** 错误信息 */ + errMsg: string + /** 加密算法的初始向量,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */ + iv: string + } + interface GetHCEStateOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetHCEStateCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetHCEStateFailCallback + /** 接口调用成功的回调函数 */ + success?: GetHCEStateSuccessCallback + } + interface GetHistoricalBytesOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetHistoricalBytesCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetHistoricalBytesFailCallback + /** 接口调用成功的回调函数 */ + success?: GetHistoricalBytesSuccessCallback + } + interface GetHistoricalBytesSuccessCallbackResult { + /** 返回历史二进制数据 */ + histBytes: ArrayBuffer + errMsg: string + } + interface GetImageInfoOption { + /** 图片的路径,支持网络路径、本地路径、代码包路径 */ + src: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetImageInfoCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetImageInfoFailCallback + /** 接口调用成功的回调函数 */ + success?: GetImageInfoSuccessCallback + } + interface GetImageInfoSuccessCallbackResult { + /** 图片原始高度,单位px。不考虑旋转。 */ + height: number + /** [拍照时设备方向](http://sylvana.net/jpegcrop/exif_orientation.html) + * + * 可选值: + * - 'up': 默认方向(手机横持拍照),对应 Exif 中的 1。或无 orientation 信息。; + * - 'up-mirrored': 同 up,但镜像翻转,对应 Exif 中的 2; + * - 'down': 旋转180度,对应 Exif 中的 3; + * - 'down-mirrored': 同 down,但镜像翻转,对应 Exif 中的 4; + * - 'left-mirrored': 同 left,但镜像翻转,对应 Exif 中的 5; + * - 'right': 顺时针旋转90度,对应 Exif 中的 6; + * - 'right-mirrored': 同 right,但镜像翻转,对应 Exif 中的 7; + * - 'left': 逆时针旋转90度,对应 Exif 中的 8; + * + * 最低基础库: `1.9.90` */ + orientation: + | 'up' + | 'up-mirrored' + | 'down' + | 'down-mirrored' + | 'left-mirrored' + | 'right' + | 'right-mirrored' + | 'left' + /** 图片的本地路径 */ + path: string + /** 图片格式 + * + * 最低基础库: `1.9.90` */ + type: string + /** 图片原始宽度,单位px。不考虑旋转。 */ + width: number + errMsg: string + } + interface GetLocationOption { + /** 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度 + * + * 最低基础库: `1.6.0` */ + altitude?: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetLocationCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetLocationFailCallback + /** 高精度定位超时时间(ms),指定时间内返回最高精度,该值3000ms以上高精度定位才有效果 + * + * 最低基础库: `2.9.0` */ + highAccuracyExpireTime?: number + /** 开启高精度定位 + * + * 最低基础库: `2.9.0` */ + isHighAccuracy?: boolean + /** 接口调用成功的回调函数 */ + success?: GetLocationSuccessCallback + /** wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标 */ + type?: string + } + interface GetLocationSuccessCallbackResult { + /** 位置的精确度 */ + accuracy: number + /** 高度,单位 m + * + * 最低基础库: `1.2.0` */ + altitude: number + /** 水平精度,单位 m + * + * 最低基础库: `1.2.0` */ + horizontalAccuracy: number + /** 纬度,范围为 -90~90,负数表示南纬 */ + latitude: number + /** 经度,范围为 -180~180,负数表示西经 */ + longitude: number + /** 速度,单位 m/s */ + speed: number + /** 垂直精度,单位 m(Android 无法获取,返回 0) + * + * 最低基础库: `1.2.0` */ + verticalAccuracy: number + errMsg: string + } + interface GetLogManagerOption { + /** 取值为0/1,取值为0表示是否会把 `App`、`Page` 的生命周期函数和 `wx` 命名空间下的函数调用写入日志,取值为1则不会。默认值是 0 + * + * 最低基础库: `2.3.2` */ + level?: number + } + interface GetMaxTransceiveLengthOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetMaxTransceiveLengthCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetMaxTransceiveLengthFailCallback + /** 接口调用成功的回调函数 */ + success?: GetMaxTransceiveLengthSuccessCallback + } + interface GetMaxTransceiveLengthSuccessCallbackResult { + /** 最大传输长度 */ + length: number + errMsg: string + } + interface GetNetworkTypeOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetNetworkTypeCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetNetworkTypeFailCallback + /** 接口调用成功的回调函数 */ + success?: GetNetworkTypeSuccessCallback + } + interface GetNetworkTypeSuccessCallbackResult { + /** 网络类型 + * + * 可选值: + * - 'wifi': wifi 网络; + * - '2g': 2g 网络; + * - '3g': 3g 网络; + * - '4g': 4g 网络; + * - '5g': 5g 网络; + * - 'unknown': Android 下不常见的网络类型; + * - 'none': 无网络; */ + networkType: 'wifi' | '2g' | '3g' | '4g' | '5g' | 'unknown' | 'none' + errMsg: string + } + interface GetRandomValuesOption { + /** 整数,生成随机数的字节数,最大 1048576 */ + length: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetRandomValuesCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetRandomValuesFailCallback + /** 接口调用成功的回调函数 */ + success?: GetRandomValuesSuccessCallback + } + interface GetRandomValuesSuccessCallbackResult { + /** 随机数内容,长度为传入的字节数 */ + randomValues: ArrayBuffer + errMsg: string + } + interface GetRegionOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetRegionCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetRegionFailCallback + /** 接口调用成功的回调函数 */ + success?: GetRegionSuccessCallback + } + interface GetRegionSuccessCallbackResult { + /** 东北角经纬度 */ + northeast: MapPostion + /** 西南角经纬度 */ + southwest: MapPostion + errMsg: string + } + interface GetRotateOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetRotateCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetRotateFailCallback + /** 接口调用成功的回调函数 */ + success?: GetRotateSuccessCallback + } + interface GetRotateSuccessCallbackResult { + /** 旋转角 */ + rotate: number + errMsg: string + } + interface GetSakOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetSakCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetSakFailCallback + /** 接口调用成功的回调函数 */ + success?: GetSakSuccessCallback + } + interface GetSakSuccessCallbackResult { + /** 返回 SAK/SEL_RES 数据 */ + sak: number + errMsg: string + } + interface GetSavedFileInfoOption { + /** 文件路径 (本地路径) */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetSavedFileInfoCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetSavedFileInfoFailCallback + /** 接口调用成功的回调函数 */ + success?: GetSavedFileInfoSuccessCallback + } + interface GetSavedFileInfoSuccessCallbackResult { + /** 文件保存时的时间戳,从1970/01/01 08:00:00 到该时刻的秒数 */ + createTime: number + /** 文件大小,单位 B */ + size: number + errMsg: string + } + interface GetScaleOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetScaleCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetScaleFailCallback + /** 接口调用成功的回调函数 */ + success?: GetScaleSuccessCallback + } + interface GetScaleSuccessCallbackResult { + /** 缩放值 */ + scale: number + errMsg: string + } + interface GetScreenBrightnessOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetScreenBrightnessCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetScreenBrightnessFailCallback + /** 接口调用成功的回调函数 */ + success?: GetScreenBrightnessSuccessCallback + } + interface GetScreenBrightnessSuccessCallbackOption { + /** 屏幕亮度值,范围 0 ~ 1,0 最暗,1 最亮 */ + value: number + } + interface GetSelectedTextRangeOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetSelectedTextRangeCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetSelectedTextRangeFailCallback + /** 接口调用成功的回调函数 */ + success?: GetSelectedTextRangeSuccessCallback + } + interface GetSelectedTextRangeSuccessCallbackResult { + /** 输入框光标结束位置 */ + end: number + /** 输入框光标起始位置 */ + start: number + errMsg: string + } + interface GetSelectionTextOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetSelectionTextCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetSelectionTextFailCallback + /** 接口调用成功的回调函数 */ + success?: GetSelectionTextSuccessCallback + } + interface GetSelectionTextSuccessCallbackResult { + /** 纯文本内容 */ + text: string + errMsg: string + } + interface GetSettingOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetSettingCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetSettingFailCallback + /** 接口调用成功的回调函数 */ + success?: GetSettingSuccessCallback + /** 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。 + * + * 最低基础库: `2.10.1` */ + withSubscriptions?: boolean + } + interface GetSettingSuccessCallbackResult { + /** [AuthSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/AuthSetting.html) + * + * 用户授权结果 */ + authSetting: AuthSetting + /** [SubscriptionsSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/SubscriptionsSetting.html) + * + * 用户订阅消息设置,接口参数`withSubscriptions`值为`true`时才会返回。 + * + * 最低基础库: `2.10.1` */ + subscriptionsSetting: SubscriptionsSetting + /** [AuthSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/AuthSetting.html) + * + * 在插件中调用时,当前宿主小程序的用户授权结果 */ + miniprogramAuthSetting?: AuthSetting + errMsg: string + } + interface GetShareInfoOption { + /** shareTicket */ + shareTicket: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetShareInfoCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetShareInfoFailCallback + /** 接口调用成功的回调函数 */ + success?: GetShareInfoSuccessCallback + /** 超时时间,单位 ms + * + * 最低基础库: `1.9.90` */ + timeout?: number + } + interface GetSkewOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetSkewCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetSkewFailCallback + /** 接口调用成功的回调函数 */ + success?: GetSkewSuccessCallback + } + interface GetSkewSuccessCallbackResult { + /** 倾斜角 */ + skew: number + errMsg: string + } + interface GetStorageInfoOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetStorageInfoCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetStorageInfoFailCallback + /** 接口调用成功的回调函数 */ + success?: GetStorageInfoSuccessCallback + } + interface GetStorageInfoSuccessCallbackOption { + /** 当前占用的空间大小, 单位 KB */ + currentSize: number + /** 当前 storage 中所有的 key */ + keys: string[] + /** 限制的空间大小,单位 KB */ + limitSize: number + } + interface GetStorageInfoSyncOption { + /** 当前占用的空间大小, 单位 KB */ + currentSize: number + /** 当前 storage 中所有的 key */ + keys: string[] + /** 限制的空间大小,单位 KB */ + limitSize: number + } + interface GetStorageOption { + /** 本地缓存中指定的 key */ + key: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetStorageCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetStorageFailCallback + /** 接口调用成功的回调函数 */ + success?: GetStorageSuccessCallback + } + interface GetStorageSuccessCallbackResult { + /** key对应的内容 */ + data: T + errMsg: string + } + interface GetSystemInfoAsyncOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetSystemInfoAsyncCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetSystemInfoAsyncFailCallback + /** 接口调用成功的回调函数 */ + success?: GetSystemInfoAsyncSuccessCallback + } + interface GetSystemInfoOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetSystemInfoCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetSystemInfoFailCallback + /** 接口调用成功的回调函数 */ + success?: GetSystemInfoSuccessCallback + } + interface GetUserInfoOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetUserInfoCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetUserInfoFailCallback + /** 显示用户信息的语言 + * + * 可选值: + * - 'en': 英文; + * - 'zh_CN': 简体中文; + * - 'zh_TW': 繁体中文; */ + lang?: 'en' | 'zh_CN' | 'zh_TW' + /** 接口调用成功的回调函数 */ + success?: GetUserInfoSuccessCallback + /** 是否带上登录态信息。当 withCredentials 为 true 时,要求此前有调用过 wx.login 且登录态尚未过期,此时返回的数据会包含 encryptedData, iv 等敏感信息;当 withCredentials 为 false 时,不要求有登录态,返回的数据不包含 encryptedData, iv 等敏感信息。 */ + withCredentials?: boolean + } + interface GetUserInfoSuccessCallbackResult { + /** 敏感数据对应的云 ID,开通[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) + * + * 最低基础库: `2.7.0` */ + cloudID: string + /** 包括敏感数据在内的完整用户信息的加密数据,详见 [用户数据的签名验证和加解密]((signature#加密数据解密算法)) */ + encryptedData: string + /** 加密算法的初始向量,详见 [用户数据的签名验证和加解密]((signature#加密数据解密算法)) */ + iv: string + /** 不包括敏感信息的原始数据字符串,用于计算签名 */ + rawData: string + /** 使用 sha1( rawData + sessionkey ) 得到字符串,用于校验用户信息,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */ + signature: string + /** [UserInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/UserInfo.html) + * + * 用户信息对象,不包含 openid 等敏感信息 */ + userInfo: UserInfo + errMsg: string + } + interface GetUserProfileOption { + /** 声明获取用户个人信息后的用途,不超过30个字符 */ + desc: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetUserProfileCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetUserProfileFailCallback + /** 显示用户信息的语言 + * + * 可选值: + * - 'en': 英文; + * - 'zh_CN': 简体中文; + * - 'zh_TW': 繁体中文; */ + lang?: 'en' | 'zh_CN' | 'zh_TW' + /** 接口调用成功的回调函数 */ + success?: GetUserProfileSuccessCallback + } + interface GetUserProfileSuccessCallbackResult { + /** [UserInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/UserInfo.html) + * + * 用户信息对象 */ + userInfo: UserInfo + errMsg: string + } + interface GetVideoInfoOption { + /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */ + src: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetVideoInfoCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetVideoInfoFailCallback + /** 接口调用成功的回调函数 */ + success?: GetVideoInfoSuccessCallback + } + interface GetVideoInfoSuccessCallbackResult { + /** 视频码率,单位 kbps */ + bitrate: number + /** 视频长度 */ + duration: number + /** 视频帧率 */ + fps: number + /** 视频的长,单位 px */ + height: number + /** 画面方向 + * + * 可选值: + * - 'up': 默认; + * - 'down': 180度旋转; + * - 'left': 逆时针旋转90度; + * - 'right': 顺时针旋转90度; + * - 'up-mirrored': 同up,但水平翻转; + * - 'down-mirrored': 同down,但水平翻转; + * - 'left-mirrored': 同left,但垂直翻转; + * - 'right-mirrored': 同right,但垂直翻转; */ + orientation: + | 'up' + | 'down' + | 'left' + | 'right' + | 'up-mirrored' + | 'down-mirrored' + | 'left-mirrored' + | 'right-mirrored' + /** 视频大小,单位 kB */ + size: number + /** 视频格式 */ + type: string + /** 视频的宽,单位 px */ + width: number + errMsg: string + } + interface GetWeRunDataOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetWeRunDataCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetWeRunDataFailCallback + /** 接口调用成功的回调函数 */ + success?: GetWeRunDataSuccessCallback + } + interface GetWeRunDataSuccessCallbackResult { + /** 敏感数据对应的云 ID,开通云开发的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) + * + * 最低基础库: `2.7.0` */ + cloudID: string + /** 包括敏感数据在内的完整用户信息的加密数据,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html)。解密后得到的数据结构见后文 */ + encryptedData: string + /** 加密算法的初始向量,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */ + iv: string + errMsg: string + } + interface GetWifiListOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetWifiListCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetWifiListFailCallback + /** 接口调用成功的回调函数 */ + success?: GetWifiListSuccessCallback + } + interface HideHomeButtonOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: HideHomeButtonCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: HideHomeButtonFailCallback + /** 接口调用成功的回调函数 */ + success?: HideHomeButtonSuccessCallback + } + interface HideKeyboardOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: HideKeyboardCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: HideKeyboardFailCallback + /** 接口调用成功的回调函数 */ + success?: HideKeyboardSuccessCallback + } + interface HideLoadingOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: HideLoadingCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: HideLoadingFailCallback + /** 接口调用成功的回调函数 */ + success?: HideLoadingSuccessCallback + } + interface HideNavigationBarLoadingOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: HideNavigationBarLoadingCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: HideNavigationBarLoadingFailCallback + /** 接口调用成功的回调函数 */ + success?: HideNavigationBarLoadingSuccessCallback + } + interface HideShareMenuOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: HideShareMenuCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: HideShareMenuFailCallback + /** 本接口为 Beta 版本,暂只在 Android 平台支持。需要隐藏的转发按钮名称列表,默认['shareAppMessage', 'shareTimeline']。按钮名称合法值包含 "shareAppMessage"、"shareTimeline" 两种 + * + * 最低基础库: `2.11.3` */ + menus?: string[] + /** 接口调用成功的回调函数 */ + success?: HideShareMenuSuccessCallback + } + interface HideTabBarOption { + /** 是否需要动画效果 */ + animation?: boolean + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: HideTabBarCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: HideTabBarFailCallback + /** 接口调用成功的回调函数 */ + success?: HideTabBarSuccessCallback + } + interface HideTabBarRedDotOption { + /** tabBar 的哪一项,从左边算起 */ + index: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: HideTabBarRedDotCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: HideTabBarRedDotFailCallback + /** 接口调用成功的回调函数 */ + success?: HideTabBarRedDotSuccessCallback + } + interface HideToastOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: HideToastCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: HideToastFailCallback + /** 接口调用成功的回调函数 */ + success?: HideToastSuccessCallback + } + interface IBeaconInfo { + /** iBeacon 设备的距离 */ + accuracy: number + /** iBeacon 设备的主 id */ + major: string + /** iBeacon 设备的次 id */ + minor: string + /** 表示设备距离的枚举值 */ + proximity: number + /** 表示设备的信号强度 */ + rssi: number + /** iBeacon 设备广播的 uuid */ + uuid: string + } + /** 图片对象 + * + * 最低基础库: `2.7.0` */ + interface Image { + /** 图片的真实高度 */ + height: number + /** 图片加载发生错误后触发的回调函数 */ + onerror: (...args: any[]) => any + /** 图片加载完成后触发的回调函数 */ + onload: (...args: any[]) => any + /** 图片的 URL。v2.11.0 起支持传递 base64 Data URI */ + src: string + /** 图片的真实宽度 */ + width: number + } + /** ImageData 对象 + * + * 最低基础库: `2.9.0` */ + interface ImageData { + /** 一维数组,包含以 RGBA 顺序的数据,数据使用 0 至 255(包含)的整数表示 */ + data: Uint8ClampedArray + /** 使用像素描述 ImageData 的实际高度 */ + height: number + /** 使用像素描述 ImageData 的实际宽度 */ + width: number + } + /** 图片的本地临时文件列表 + * + * 最低基础库: `1.2.0` */ + interface ImageFile { + /** 本地临时文件路径 (本地路径) */ + path: string + /** 本地临时文件大小,单位 B */ + size: number + } + interface IncludePointsOption { + /** 要显示在可视区域内的坐标点列表 */ + points: MapPostion[] + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: IncludePointsCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: IncludePointsFailCallback + /** 坐标点形成的矩形边缘到地图边缘的距离,单位像素。格式为[上,右,下,左],安卓上只能识别数组第一项,上下左右的padding一致。开发者工具暂不支持padding参数。 */ + padding?: number[] + /** 接口调用成功的回调函数 */ + success?: IncludePointsSuccessCallback + } + interface InitMarkerClusterOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: InitMarkerClusterCompleteCallback + /** 启用默认的聚合样式 */ + enableDefaultStyle?: boolean + /** 接口调用失败的回调函数 */ + fail?: InitMarkerClusterFailCallback + /** 聚合算法的可聚合距离,即距离小于该值的点会聚合至一起,以像素为单位 */ + gridSize?: boolean + /** 接口调用成功的回调函数 */ + success?: InitMarkerClusterSuccessCallback + /** 点击已经聚合的标记点时是否实现聚合分离 */ + zoomOnClick?: boolean + } + /** InnerAudioContext 实例,可通过 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 接口获取实例。注意,音频播放过程中,可能被系统中断,可通过 [wx.onAudioInterruptionBegin](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAudioInterruptionBegin.html)、[wx.onAudioInterruptionEnd](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAudioInterruptionEnd.html)事件来处理这种情况。 +* +* **支持格式** +* +* +* | 格式 | iOS | Android | +* | ---- | ---- | ------- | +* | flac | x | √ | +* | m4a | √ | √ | +* | ogg | x | √ | +* | ape | x | √ | +* | amr | x | √ | +* | wma | x | √ | +* | wav | √ | √ | +* | mp3 | √ | √ | +* | mp4 | x | √ | +* | aac | √ | √ | +* | aiff | √ | x | +* | caf | √ | x | +* +* **示例代码** +* +* +* ```js +const innerAudioContext = wx.createInnerAudioContext() +innerAudioContext.autoplay = true +innerAudioContext.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46' +innerAudioContext.onPlay(() => { + console.log('开始播放') +}) +innerAudioContext.onError((res) => { + console.log(res.errMsg) + console.log(res.errCode) +}) +``` */ + interface InnerAudioContext { + /** 是否自动开始播放,默认为 `false` */ + autoplay: boolean + /** 音频缓冲的时间点,仅保证当前播放时间点到此时间点内容已缓冲(只读) */ + buffered: number + /** 当前音频的播放位置(单位 s)。只有在当前有合法的 src 时返回,时间保留小数点后 6 位(只读) */ + currentTime: number + /** 当前音频的长度(单位 s)。只有在当前有合法的 src 时返回(只读) */ + duration: number + /** 是否循环播放,默认为 `false` */ + loop: boolean + /** 是否遵循系统静音开关,默认为 `true`。当此参数为 `false` 时,即使用户打开了静音开关,也能继续发出声音。从 2.3.0 版本开始此参数不生效,使用 [wx.setInnerAudioOption](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.setInnerAudioOption.html) 接口统一设置。 */ + obeyMuteSwitch: boolean + /** 当前是是否暂停或停止状态(只读) */ + paused: boolean + /** 播放速度。范围 0.5-2.0,默认为 1。(Android 需要 6 及以上版本) + * + * 最低基础库: `2.11.0` */ + playbackRate: number + /** 音频资源的地址,用于直接播放。[2.2.3](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 开始支持云文件ID */ + src: string + /** 开始播放的位置(单位:s),默认为 0 */ + startTime: number + /** 音量。范围 0~1。默认为 1 + * + * 最低基础库: `1.9.90` */ + volume: number + } + interface InnerAudioContextOnErrorCallbackResult { + /** + * + * 可选值: + * - 10001: 系统错误; + * - 10002: 网络错误; + * - 10003: 文件错误; + * - 10004: 格式错误; + * - -1: 未知错误; */ + errCode: 10001 | 10002 | 10003 | 10004 | -1 + errMsg: string + } + interface InsertDividerOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: InsertDividerCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: InsertDividerFailCallback + /** 接口调用成功的回调函数 */ + success?: InsertDividerSuccessCallback + } + interface InsertImageOption { + /** 图片地址,仅支持 http(s)、base64、云图片(2.8.0)、临时文件(2.8.3)。 */ + src: string + /** 图像无法显示时的替代文本 */ + alt?: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: InsertImageCompleteCallback + /** data 被序列化为 name=value;name1=value2 的格式挂在属性 data-custom 上 */ + data?: IAnyObject + /** 添加到图片 img 标签上的类名 */ + extClass?: string + /** 接口调用失败的回调函数 */ + fail?: InsertImageFailCallback + /** 图片高度 (pixels/百分比) */ + height?: string + /** 接口调用成功的回调函数 */ + success?: InsertImageSuccessCallback + /** 图片宽度(pixels/百分比) */ + width?: string + } + interface InsertTextOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: InsertTextCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: InsertTextFailCallback + /** 接口调用成功的回调函数 */ + success?: InsertTextSuccessCallback + /** 文本内容 */ + text?: string + } + interface IntersectionObserverObserveCallbackResult { + /** 目标边界 */ + boundingClientRect: BoundingClientRectResult + /** 相交比例 */ + intersectionRatio: number + /** 相交区域的边界 */ + intersectionRect: IntersectionRectResult + /** 参照区域的边界 */ + relativeRect: RelativeRectResult + /** 相交检测时的时间戳 */ + time: number + } + /** 相交区域的边界 */ + interface IntersectionRectResult { + /** 下边界 */ + bottom: number + /** 高度 */ + height: number + /** 左边界 */ + left: number + /** 右边界 */ + right: number + /** 上边界 */ + top: number + /** 宽度 */ + width: number + } + interface InterstitialAdOnErrorCallbackResult { + /** 错误码 + * + * 可选值: + * - 1000: 后端接口调用失败; + * - 1001: 参数错误; + * - 1002: 广告单元无效; + * - 1003: 内部错误; + * - 1004: 无合适的广告; + * - 1005: 广告组件审核中; + * - 1006: 广告组件被驳回; + * - 1007: 广告组件被封禁; + * - 1008: 广告单元已关闭; */ + errCode: 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 + /** 错误信息 */ + errMsg: string + } + interface IsConnectedOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: IsConnectedCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: IsConnectedFailCallback + /** 接口调用成功的回调函数 */ + success?: IsConnectedSuccessCallback + } + interface JoinVoIPChatOption { + /** 小游戏内此房间/群聊的 ID。同一时刻传入相同 groupId 的用户会进入到同个实时语音房间。 */ + groupId: string + /** 验证所需的随机字符串 */ + nonceStr: string + /** 签名,用于验证小游戏的身份 */ + signature: string + /** 验证所需的时间戳 */ + timeStamp: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: JoinVoIPChatCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: JoinVoIPChatFailCallback + /** 静音设置 */ + muteConfig?: MuteConfig + /** 房间类型 + * + * 可选值: + * - 'voice': 音频房间,用于语音通话; + * - 'video': 视频房间,结合 [voip-room](https://developers.weixin.qq.com/miniprogram/dev/component/voip-room.html) 组件可显示成员画面; */ + roomType?: 'voice' | 'video' + /** 接口调用成功的回调函数 */ + success?: JoinVoIPChatSuccessCallback + } + interface JoinVoIPChatSuccessCallbackResult { + /** 错误码 */ + errCode: number + /** 调用结果 */ + errMsg: string + /** 在此通话中的成员 openId 名单 */ + openIdList: string[] + } + /** 启动参数 */ + interface LaunchOptionsApp { + /** 打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数 */ + forwardMaterials: ForwardMaterials[] + /** 启动小程序的路径 (代码包路径) */ + path: string + /** 启动小程序的 query 参数 */ + query: IAnyObject + /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */ + referrerInfo: ReferrerInfo + /** 启动小程序的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */ + scene: number + /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */ + shareTicket?: string + } + interface LivePlayerContextRequestFullScreenOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RequestFullScreenCompleteCallback + /** 设置全屏时的方向 + * + * 可选值: + * - 0: 正常竖向; + * - 90: 屏幕逆时针90度; + * - -90: 屏幕顺时针90度; */ + direction?: 0 | 90 | -90 + /** 接口调用失败的回调函数 */ + fail?: RequestFullScreenFailCallback + /** 接口调用成功的回调函数 */ + success?: RequestFullScreenSuccessCallback + } + interface LivePlayerContextSnapshotOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SnapshotCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SnapshotFailCallback + /** 图片的质量,默认原图。有效值为 raw、compressed + * + * 最低基础库: `2.10.0` */ + quality?: string + /** 接口调用成功的回调函数 */ + success?: LivePlayerContextSnapshotSuccessCallback + } + interface LivePlayerContextSnapshotSuccessCallbackResult { + /** 图片的高度 */ + height: string + /** 图片文件的临时路径 (本地路径) */ + tempImagePath: string + /** 图片的宽度 */ + width: string + errMsg: string + } + interface LivePusherContextSnapshotOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SnapshotCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SnapshotFailCallback + /** 图片的质量,默认原图。有效值为 raw、compressed + * + * 最低基础库: `2.10.0` */ + quality?: string + /** 接口调用成功的回调函数 */ + success?: LivePusherContextSnapshotSuccessCallback + } + interface LivePusherContextSnapshotSuccessCallbackResult { + /** 图片的高度 */ + height: string + /** 图片文件的临时路径 */ + tempImagePath: string + /** 图片的宽度 */ + width: string + errMsg: string + } + interface LoadFontFaceCompleteCallbackResult { + /** 加载字体结果 */ + status: string + } + interface LoadFontFaceOption { + /** 定义的字体名称 */ + family: string + /** 字体资源的地址。建议格式为 TTF 和 WOFF,WOFF2 在低版本的iOS上会不兼容。 */ + source: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: LoadFontFaceCompleteCallback + /** 可选的字体描述符 */ + desc?: DescOption + /** 接口调用失败的回调函数 */ + fail?: LoadFontFaceFailCallback + /** 是否全局生效 + * + * 最低基础库: `2.10.0` */ + global?: boolean + /** 字体作用范围,可选值为 webview / native,默认 webview,设置 native 可在 Canvas 2D 下使用 */ + scopes?: any[] + /** 接口调用成功的回调函数 */ + success?: LoadFontFaceSuccessCallback + } + interface LoginOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: LoginCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: LoginFailCallback + /** 接口调用成功的回调函数 */ + success?: LoginSuccessCallback + /** 超时时间,单位ms + * + * 最低基础库: `1.9.90` */ + timeout?: number + } + interface LoginSuccessCallbackResult { + /** 用户登录凭证(有效期五分钟)。开发者需要在开发者服务器后台调用 [auth.code2Session](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html),使用 code 换取 openid 和 session_key 等信息 */ + code: string + errMsg: string + } + interface MakeBluetoothPairOption { + /** 蓝牙设备 id */ + deviceId: string + /** pin 码,Base64 格式。 */ + pin: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: MakeBluetoothPairCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: MakeBluetoothPairFailCallback + /** 接口调用成功的回调函数 */ + success?: MakeBluetoothPairSuccessCallback + /** 超时时间 */ + timeout?: number + } + interface MakePhoneCallOption { + /** 需要拨打的电话号码 */ + phoneNumber: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: MakePhoneCallCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: MakePhoneCallFailCallback + /** 接口调用成功的回调函数 */ + success?: MakePhoneCallSuccessCallback + } + /** 广播的制造商信息, 仅安卓支持 */ + interface ManufacturerData { + /** 制造商ID,0x 开头的十六进制 */ + manufacturerId: string + /** 制造商信息 */ + manufacturerSpecificData?: ArrayBuffer + } + /** 图片覆盖的经纬度范围 */ + interface MapBounds { + /** 东北角经纬度 */ + northeast: MapPostion + /** 西南角经纬度 */ + southwest: MapPostion + } + interface MapPostion { + /** 纬度 */ + latitude: number + /** 经度 */ + longitude: number + } + /** 用来扩展(或收缩)参照节点布局区域的边界 */ + interface Margins { + /** 节点布局区域的下边界 */ + bottom?: number + /** 节点布局区域的左边界 */ + left?: number + /** 节点布局区域的右边界 */ + right?: number + /** 节点布局区域的上边界 */ + top?: number + } + /** MediaAudioPlayer 实例,可通过 [wx.createMediaAudioPlayer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createMediaAudioPlayer.html) 接口获取实例。 */ + interface MediaAudioPlayer { + /** 音量。范围 0~1。默认为 1 */ + volume: number + } + /** 本地临时文件列表 */ + interface MediaFile { + /** 视频的时间长度 */ + duration: number + /** 视频的高度 */ + height: number + /** 本地临时文件大小,单位 B */ + size: number + /** 本地临时文件路径 (本地路径) */ + tempFilePath: string + /** 视频缩略图临时文件路径 */ + thumbTempFilePath: string + /** 视频的宽度 */ + width: number + } + interface MediaQueryObserverObserveCallbackResult { + /** 页面的当前状态是否满足所指定的 media query */ + matches: boolean + } + /** 需要预览的资源列表 */ + interface MediaSource { + /** 图片或视频的地址 */ + url: string + /** 视频的封面图片 */ + poster?: string + /** 资源的类型,默认为图片 + * + * 可选值: + * - 'image': 图片; + * - 'video': 视频; */ + type?: 'image' | 'video' + } + /** 可通过 [MediaContainer.extractDataSource](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.extractDataSource.html) 返回。 + * + * [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) 音频或视频轨道,可以对轨道进行一些操作 + * + * 最低基础库: `2.9.0` */ + interface MediaTrack { + /** 轨道长度,只读 */ + duration: number + /** 轨道类型,只读 + * + * 可选值: + * - 'audio': 音频轨道; + * - 'video': 视频轨道; */ + kind: 'audio' | 'video' + /** 音量,音频轨道下有效,可写 */ + volume: number + } + /** 小程序帐号信息 */ + interface MiniProgram { + /** 小程序 appId */ + appId: string + /** 小程序版本 + * + * 可选值: + * - 'develop': 开发版; + * - 'trial': 体验版; + * - 'release': 正式版; + * + * 最低基础库: `2.10.0` */ + envVersion: 'develop' | 'trial' | 'release' + /** 线上小程序版本号 + * + * 最低基础库: `2.10.2` */ + version: string + } + interface MkdirFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail no such file or directory ${dirPath}': 上级目录不存在; + * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限; + * - 'fail file already exists ${dirPath}': 有同名文件或目录; + * - 'fail sdcard not mounted': Android sdcard 挂载失败; */ + errMsg: string + } + interface MkdirOption { + /** 创建的目录路径 (本地路径) */ + dirPath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: MkdirCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: MkdirFailCallback + /** 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。 + * + * 最低基础库: `2.3.0` */ + recursive?: boolean + /** 接口调用成功的回调函数 */ + success?: MkdirSuccessCallback + } + interface MoveAlongOption { + /** 平滑移动的时间 */ + duration: number + /** 指定 marker */ + markerId: number + /** 移动路径的坐标串,坐标点格式 `{longitude, latitude}` */ + path: any[] + /** 根据路径方向自动改变 marker 的旋转角度 */ + autoRotate?: boolean + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: MoveAlongCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: MoveAlongFailCallback + /** 接口调用成功的回调函数 */ + success?: MoveAlongSuccessCallback + } + interface MoveToLocationOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: MoveToLocationCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: MoveToLocationFailCallback + /** 纬度 + * + * 最低基础库: `2.8.0` */ + latitude?: number + /** 经度 + * + * 最低基础库: `2.8.0` */ + longitude?: number + /** 接口调用成功的回调函数 */ + success?: MoveToLocationSuccessCallback + } + /** 静音设置 */ + interface MuteConfig { + /** 是否静音耳机 */ + muteEarphone?: boolean + /** 是否静音麦克风 */ + muteMicrophone?: boolean + } + interface MuteOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: MuteCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: MuteFailCallback + /** 接口调用成功的回调函数 */ + success?: MuteSuccessCallback + } + /** + * + * 最低基础库: `2.11.2` */ + interface NFCAdapter { + /** 标签类型枚举 */ + tech: TechType + } + interface NavigateBackMiniProgramOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: NavigateBackMiniProgramCompleteCallback + /** 需要返回给上一个小程序的数据,上一个小程序可在 `App.onShow` 中获取到这份数据。 [详情](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html)。 */ + extraData?: IAnyObject + /** 接口调用失败的回调函数 */ + fail?: NavigateBackMiniProgramFailCallback + /** 接口调用成功的回调函数 */ + success?: NavigateBackMiniProgramSuccessCallback + } + interface NavigateBackOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: NavigateBackCompleteCallback + /** 返回的页面数,如果 delta 大于现有页面数,则返回到首页。 */ + delta?: number + /** 接口调用失败的回调函数 */ + fail?: NavigateBackFailCallback + /** 接口调用成功的回调函数 */ + success?: NavigateBackSuccessCallback + } + interface NavigateToMiniProgramOption { + /** 要打开的小程序 appId */ + appId: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: NavigateToMiniProgramCompleteCallback + /** 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版。 + * + * 可选值: + * - 'develop': 开发版; + * - 'trial': 体验版; + * - 'release': 正式版; */ + envVersion?: 'develop' | 'trial' | 'release' + /** 需要传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据。如果跳转的是小游戏,可以在 [wx.onShow](#)、[wx.getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html) 中可以获取到这份数据数据。 */ + extraData?: IAnyObject + /** 接口调用失败的回调函数 */ + fail?: NavigateToMiniProgramFailCallback + /** 打开的页面路径,如果为空则打开首页。path 中 ? 后面的部分会成为 query,在小程序的 `App.onLaunch`、`App.onShow` 和 `Page.onLoad` 的回调函数或小游戏的 [wx.onShow](#) 回调函数、[wx.getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html) 中可以获取到 query 数据。对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。 */ + path?: string + /** 接口调用成功的回调函数 */ + success?: NavigateToMiniProgramSuccessCallback + } + interface NavigateToOption { + /** 需要跳转的应用内非 tabBar 的页面的路径 (代码包路径), 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 'path?key=value&key2=value2' */ + url: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: NavigateToCompleteCallback + /** 页面间通信接口,用于监听被打开页面发送到当前页面的数据。基础库 2.7.3 开始支持。 */ + events?: IAnyObject + /** 接口调用失败的回调函数 */ + fail?: NavigateToFailCallback + /** 接口调用成功的回调函数 */ + success?: NavigateToSuccessCallback + } + interface NavigateToSuccessCallbackResult { + /** [EventChannel](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.html) + * + * 和被打开页面进行通信 */ + eventChannel: EventChannel + errMsg: string + } + interface NdefCloseOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: NdefCloseCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: NdefCloseFailCallback + /** 接口调用成功的回调函数 */ + success?: NdefCloseSuccessCallback + } + interface NodeCallbackResult { + /** 节点对应的 Node 实例 */ + node: IAnyObject + } + interface NotifyBLECharacteristicValueChangeOption { + /** 蓝牙特征值的 uuid */ + characteristicId: string + /** 蓝牙设备 id */ + deviceId: string + /** 蓝牙特征值对应服务的 uuid */ + serviceId: string + /** 是否启用 notify */ + state: boolean + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: NotifyBLECharacteristicValueChangeCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: NotifyBLECharacteristicValueChangeFailCallback + /** 接口调用成功的回调函数 */ + success?: NotifyBLECharacteristicValueChangeSuccessCallback + } + /** media query 描述符 */ + interface ObserveDescriptor { + /** 页面高度( px 为单位) */ + height: number + /** 页面最大高度( px 为单位) */ + maxHeight: number + /** 页面最大宽度( px 为单位) */ + maxWidth: number + /** 页面最小高度( px 为单位) */ + minHeight: number + /** 页面最小宽度( px 为单位) */ + minWidth: number + /** 屏幕方向( `landscape` 或 `portrait` ) */ + orientation: string + /** 页面宽度( px 为单位) */ + width: number + } + interface OnAccelerometerChangeCallbackResult { + /** X 轴 */ + x: number + /** Y 轴 */ + y: number + /** Z 轴 */ + z: number + } + interface OnAppShowCallbackResult { + /** 打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数 */ + forwardMaterials: ForwardMaterials[] + /** 小程序切前台的路径 (代码包路径) */ + path: string + /** 小程序切前台的 query 参数 */ + query: IAnyObject + /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */ + referrerInfo: ReferrerInfo + /** 小程序切前台的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */ + scene: number + /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */ + shareTicket?: string + } + interface OnBLECharacteristicValueChangeCallbackResult { + /** 蓝牙特征值的 uuid */ + characteristicId: string + /** 蓝牙设备 id */ + deviceId: string + /** 蓝牙特征值对应服务的 uuid */ + serviceId: string + /** 特征值最新的值 */ + value: ArrayBuffer + } + interface OnBLEConnectionStateChangeCallbackResult { + /** 是否处于已连接状态 */ + connected: boolean + /** 蓝牙设备ID */ + deviceId: string + } + interface OnBLEPeripheralConnectionStateChangedCallbackResult { + /** 连接目前状态 */ + connected: boolean + /** 连接状态变化的设备 id */ + deviceId: string + /** server 的 uuid */ + serverId: string + } + interface OnBackgroundFetchDataCallbackResult { + /** 缓存数据类别 (periodic) */ + fetchType: string + /** 缓存数据 */ + fetchedData: string + /** 客户端拿到缓存数据的时间戳 */ + timeStamp: number + } + interface OnBeaconServiceChangeCallbackResult { + /** 服务目前是否可用 */ + available: boolean + /** 目前是否处于搜索状态 */ + discovering: boolean + } + interface OnBeaconUpdateCallbackResult { + /** 当前搜寻到的所有 iBeacon 设备列表 */ + beacons: IBeaconInfo[] + } + interface OnBluetoothAdapterStateChangeCallbackResult { + /** 蓝牙适配器是否可用 */ + available: boolean + /** 蓝牙适配器是否处于搜索状态 */ + discovering: boolean + } + interface OnBluetoothDeviceFoundCallbackResult { + /** 新搜索到的设备列表 */ + devices: BlueToothDevice[] + } + interface OnCameraFrameCallbackResult { + /** 图像像素点数据,一维数组,每四项表示一个像素点的 rgba */ + data: ArrayBuffer + /** 图像数据矩形的高度 */ + height: number + /** 图像数据矩形的宽度 */ + width: number + } + interface OnCharacteristicReadRequestCallbackResult { + /** 唯一标识码,调用 writeCharacteristicValue 时使用 */ + callbackId: number + /** characteristic对应的uuid */ + characteristicId: string + /** service对应的uuid */ + serviceId: string + } + interface OnCharacteristicSubscribedCallbackResult { + /** characteristic对应的uuid */ + characteristicId: string + /** service对应的uuid */ + serviceId: string + } + interface OnCharacteristicWriteRequestCallbackResult { + /** 唯一标识码,调用 writeCharacteristicValue 时使用 */ + callbackId: number + /** characteristic对应的uuid */ + characteristicId: string + /** service对应的uuid */ + serviceId: string + /** 请求写入的特征值数据 */ + value: ArrayBuffer + } + interface OnCheckForUpdateCallbackResult { + /** 是否有新版本 */ + hasUpdate: boolean + } + interface OnCompassChangeCallbackResult { + /** 精度 + * + * 最低基础库: `2.4.0` */ + accuracy: number | string + /** 面对的方向度数 */ + direction: number + } + interface OnCopyUrlCallbackResult { + /** 用短链打开小程序时当前页面携带的查询字符串。小程序中使用时,应在进入页面时调用 `wx.onCopyUrl` 自定义 `query`,退出页面时调用 `wx.offCopyUrl`,防止影响其它页面。 */ + query: string + } + interface OnDeviceMotionChangeCallbackResult { + /** 当 手机坐标 X/Y 和 地球 X/Y 重合时,绕着 Z 轴转动的夹角为 alpha,范围值为 [0, 2*PI)。逆时针转动为正。 */ + alpha: number + /** 当手机坐标 Y/Z 和地球 Y/Z 重合时,绕着 X 轴转动的夹角为 beta。范围值为 [-1*PI, PI) 。顶部朝着地球表面转动为正。也有可能朝着用户为正。 */ + beta: number + /** 当手机 X/Z 和地球 X/Z 重合时,绕着 Y 轴转动的夹角为 gamma。范围值为 [-1*PI/2, PI/2)。右边朝着地球表面转动为正。 */ + gamma: number + } + interface OnDiscoveredCallbackResult { + /** NdefMessage 数组,消息格式为 {id: ArrayBuffer, type: ArrayBuffer, payload: ArrayBuffer} */ + messages: any[] + /** tech 数组,用于匹配NFC卡片具体可以使用什么标准(NfcA等实例)处理 */ + techs: any[] + } + interface OnFrameRecordedCallbackResult { + /** 录音分片数据 */ + frameBuffer: ArrayBuffer + /** 当前帧是否正常录音结束前的最后一帧 */ + isLastFrame: boolean + } + interface OnGetWifiListCallbackResult { + /** Wi-Fi 列表数据 */ + wifiList: WifiInfo[] + } + interface OnGyroscopeChangeCallbackResult { + /** x 轴的角速度 */ + x: number + /** y 轴的角速度 */ + y: number + /** z 轴的角速度 */ + z: number + } + interface OnHCEMessageCallbackResult { + /** `messageType=1` 时 ,客户端接收到 NFC 设备的指令 */ + data: ArrayBuffer + /** 消息类型 + * + * 可选值: + * - 1: HCE APDU Command类型,小程序需对此指令进行处理,并调用 sendHCEMessage 接口返回处理指令; + * - 2: 设备离场事件类型; */ + messageType: 1 | 2 + /** `messageType=2` 时,原因 */ + reason: number + } + interface OnHeadersReceivedCallbackResult { + /** 开发者服务器返回的 HTTP Response Header */ + header: IAnyObject + } + interface OnKeyboardHeightChangeCallbackResult { + /** 键盘高度 */ + height: number + } + interface OnLocalServiceFoundCallbackResult { + /** 服务的 ip 地址 */ + ip: string + /** 服务的端口 */ + port: number + /** 服务的名称 */ + serviceName: string + /** 服务的类型 */ + serviceType: string + } + interface OnLocalServiceLostCallbackResult { + /** 服务的名称 */ + serviceName: string + /** 服务的类型 */ + serviceType: string + } + interface OnLocationChangeCallbackResult { + /** 位置的精确度 */ + accuracy: number + /** 高度,单位 m + * + * 最低基础库: `1.2.0` */ + altitude: number + /** 水平精度,单位 m + * + * 最低基础库: `1.2.0` */ + horizontalAccuracy: number + /** 纬度,范围为 -90~90,负数表示南纬 */ + latitude: number + /** 经度,范围为 -180~180,负数表示西经 */ + longitude: number + /** 速度,单位 m/s */ + speed: number + /** 垂直精度,单位 m(Android 无法获取,返回 0) + * + * 最低基础库: `1.2.0` */ + verticalAccuracy: number + } + interface OnMemoryWarningCallbackResult { + /** 内存告警等级,只有 Android 才有,对应系统宏定义 + * + * 可选值: + * - 5: TRIM_MEMORY_RUNNING_MODERATE; + * - 10: TRIM_MEMORY_RUNNING_LOW; + * - 15: TRIM_MEMORY_RUNNING_CRITICAL; */ + level: 5 | 10 | 15 + } + interface OnNetworkStatusChangeCallbackResult { + /** 当前是否有网络连接 */ + isConnected: boolean + /** 网络类型 + * + * 可选值: + * - 'wifi': wifi 网络; + * - '2g': 2g 网络; + * - '3g': 3g 网络; + * - '4g': 4g 网络; + * - 'unknown': Android 下不常见的网络类型; + * - 'none': 无网络; */ + networkType: 'wifi' | '2g' | '3g' | '4g' | 'unknown' | 'none' + } + interface OnOpenCallbackResult { + /** 连接成功的 HTTP 响应 Header + * + * 最低基础库: `2.0.0` */ + header: IAnyObject + /** 网络请求过程中一些调试信息 + * + * 最低基础库: `2.10.4` */ + profile: SocketProfile + } + interface OnPageNotFoundCallbackResult { + /** 是否本次启动的首个页面(例如从分享等入口进来,首个页面是开发者配置的分享页面) */ + isEntryPage: boolean + /** 不存在页面的路径 (代码包路径) */ + path: string + /** 打开不存在页面的 query 参数 */ + query: IAnyObject + } + interface OnSocketOpenCallbackResult { + /** 连接成功的 HTTP 响应 Header + * + * 最低基础库: `2.0.0` */ + header: IAnyObject + } + interface OnStopCallbackResult { + /** 录音总时长,单位:ms */ + duration: number + /** 录音文件大小,单位:Byte */ + fileSize: number + /** 录音文件的临时路径 (本地路径) */ + tempFilePath: string + } + interface OnThemeChangeCallbackResult { + /** 系统当前的主题,取值为`light`或`dark` + * + * 可选值: + * - 'dark': 深色主题; + * - 'light': 浅色主题; */ + theme: 'dark' | 'light' + } + interface OnUnhandledRejectionCallbackResult { + /** 被拒绝的 Promise 对象 */ + promise: Promise + /** 拒绝原因,一般是一个 Error 对象 */ + reason: string + } + interface OnVoIPChatInterruptedCallbackResult { + /** 错误码 */ + errCode: number + /** 调用结果(错误原因) */ + errMsg: string + } + interface OnVoIPChatMembersChangedCallbackResult { + /** 错误码 */ + errCode: number + /** 调用结果 */ + errMsg: string + /** 还在实时语音通话中的成员 openId 名单 */ + openIdList: string[] + } + interface OnVoIPChatSpeakersChangedCallbackResult { + /** 错误码 */ + errCode: number + /** 调用结果(错误原因) */ + errMsg: string + /** 还在实时语音通话中的成员 openId 名单 */ + openIdList: string[] + } + interface OnVoIPVideoMembersChangedCallbackResult { + /** 错误码 */ + errCode: number + /** 调用结果 */ + errMsg: string + /** 开启视频的成员名单 */ + openIdList: string[] + } + interface OnWifiConnectedCallbackResult { + /** [WifiInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/WifiInfo.html) + * + * Wi-Fi 信息 */ + wifi: WifiInfo + } + interface OnWindowResizeCallbackResult { + size: Size + } + interface OpenBluetoothAdapterOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: OpenBluetoothAdapterCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: OpenBluetoothAdapterFailCallback + /** 蓝牙模式,可作为主/从设备,仅 iOS 需要。 + * + * 可选值: + * - 'central': 主机模式; + * - 'peripheral': 从机模式; + * + * 最低基础库: `2.10.0` */ + mode?: 'central' | 'peripheral' + /** 接口调用成功的回调函数 */ + success?: OpenBluetoothAdapterSuccessCallback + } + interface OpenCardOption { + /** 需要打开的卡券列表 */ + cardList: OpenCardRequestInfo[] + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: OpenCardCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: OpenCardFailCallback + /** 接口调用成功的回调函数 */ + success?: OpenCardSuccessCallback + } + /** 需要打开的卡券列表 */ + interface OpenCardRequestInfo { + /** 卡券 ID */ + cardId: string + /** 由 [wx.addCard](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/card/wx.addCard.html) 的返回对象中的加密 code 通过解密后得到,解密请参照:[code 解码接口](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1499332673_Unm7V) */ + code: string + } + interface OpenDocumentOption { + /** 文件路径 (本地路径) ,可通过 downloadFile 获得 */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: OpenDocumentCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: OpenDocumentFailCallback + /** 文件类型,指定文件类型打开文件 + * + * 可选值: + * - 'doc': doc 格式; + * - 'docx': docx 格式; + * - 'xls': xls 格式; + * - 'xlsx': xlsx 格式; + * - 'ppt': ppt 格式; + * - 'pptx': pptx 格式; + * - 'pdf': pdf 格式; + * + * 最低基础库: `1.4.0` */ + fileType?: 'doc' | 'docx' | 'xls' | 'xlsx' | 'ppt' | 'pptx' | 'pdf' + /** 是否显示右上角菜单 + * + * 最低基础库: `2.11.0` */ + showMenu?: boolean + /** 接口调用成功的回调函数 */ + success?: OpenDocumentSuccessCallback + } + interface OpenLocationOption { + /** 纬度,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */ + latitude: number + /** 经度,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */ + longitude: number + /** 地址的详细说明 */ + address?: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: OpenLocationCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: OpenLocationFailCallback + /** 位置名 */ + name?: string + /** 缩放比例,范围5~18 */ + scale?: number + /** 接口调用成功的回调函数 */ + success?: OpenLocationSuccessCallback + } + interface OpenMapAppOption { + /** 目的地名称 */ + destination: string + /** 目的地纬度 */ + latitude: number + /** 目的地经度 */ + longitude: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: OpenMapAppCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: OpenMapAppFailCallback + /** 接口调用成功的回调函数 */ + success?: OpenMapAppSuccessCallback + } + interface OpenSettingOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: OpenSettingCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: OpenSettingFailCallback + /** 接口调用成功的回调函数 */ + success?: OpenSettingSuccessCallback + /** 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。 + * + * 最低基础库: `2.10.3` */ + withSubscriptions?: boolean + } + interface OpenSettingSuccessCallbackResult { + /** [AuthSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/AuthSetting.html) + * + * 用户授权结果 */ + authSetting: AuthSetting + /** [SubscriptionsSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/SubscriptionsSetting.html) + * + * 用户订阅消息设置,接口参数`withSubscriptions`值为`true`时才会返回。 + * + * 最低基础库: `2.10.3` */ + subscriptionsSetting: SubscriptionsSetting + errMsg: string + } + interface OpenVideoEditorOption { + /** 视频源的路径,只支持本地路径 */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: OpenVideoEditorCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: OpenVideoEditorFailCallback + /** 接口调用成功的回调函数 */ + success?: OpenVideoEditorSuccessCallback + } + interface OpenVideoEditorSuccessCallbackResult { + /** 剪辑后生成的视频文件的时长,单位毫秒(ms) */ + duration: number + /** 剪辑后生成的视频文件大小,单位字节数(byte) */ + size: number + /** 编辑后生成的视频文件的临时路径 */ + tempFilePath: string + /** 编辑后生成的缩略图文件的临时路径 */ + tempThumbPath: string + errMsg: string + } + interface PageScrollToOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PageScrollToCompleteCallback + /** 滚动动画的时长,单位 ms */ + duration?: number + /** 接口调用失败的回调函数 */ + fail?: PageScrollToFailCallback + /** 滚动到页面的目标位置,单位 px */ + scrollTop?: number + /** 选择器 + * + * 最低基础库: `2.7.3` */ + selector?: string + /** 接口调用成功的回调函数 */ + success?: PageScrollToSuccessCallback + } + /** Canvas 2D API 的接口 Path2D 用来声明路径,此路径稍后会被CanvasRenderingContext2D 对象使用。CanvasRenderingContext2D 接口的 路径方法 也存在于 Path2D 这个接口中,允许你在 canvas 中根据需要创建可以保留并重用的路径。 + * + * 最低基础库: `2.11.0` */ + interface Path2D {} + interface PauseBGMOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PauseBGMCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: PauseBGMFailCallback + /** 接口调用成功的回调函数 */ + success?: PauseBGMSuccessCallback + } + interface PauseBackgroundAudioOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PauseBackgroundAudioCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: PauseBackgroundAudioFailCallback + /** 接口调用成功的回调函数 */ + success?: PauseBackgroundAudioSuccessCallback + } + interface PauseOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PauseCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: PauseFailCallback + /** 接口调用成功的回调函数 */ + success?: PauseSuccessCallback + } + interface PauseVoiceOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PauseVoiceCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: PauseVoiceFailCallback + /** 接口调用成功的回调函数 */ + success?: PauseVoiceSuccessCallback + } + /** PerformanceObserver 对象, 用于监听性能相关事件 + * + * 最低基础库: `2.11.0` */ + interface PerformanceObserver { + /** 获取当前支持的所有性能指标类型 */ + supportedEntryTypes: any[] + } + interface PlayBGMOption { + /** 加入背景混音的资源地址 */ + url: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PlayBGMCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: PlayBGMFailCallback + /** 接口调用成功的回调函数 */ + success?: PlayBGMSuccessCallback + } + interface PlayBackgroundAudioOption { + /** 音乐链接,目前支持的格式有 m4a, aac, mp3, wav */ + dataUrl: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PlayBackgroundAudioCompleteCallback + /** 封面URL */ + coverImgUrl?: string + /** 接口调用失败的回调函数 */ + fail?: PlayBackgroundAudioFailCallback + /** 接口调用成功的回调函数 */ + success?: PlayBackgroundAudioSuccessCallback + /** 音乐标题 */ + title?: string + } + interface PlayOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PlayCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: PlayFailCallback + /** 接口调用成功的回调函数 */ + success?: PlaySuccessCallback + } + interface PlayVoiceOption { + /** 需要播放的语音文件的文件路径 (本地路径) */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PlayVoiceCompleteCallback + /** 指定播放时长,到达指定的播放时长后会自动停止播放,单位:秒 + * + * 最低基础库: `1.6.0` */ + duration?: number + /** 接口调用失败的回调函数 */ + fail?: PlayVoiceFailCallback + /** 接口调用成功的回调函数 */ + success?: PlayVoiceSuccessCallback + } + /** 插件帐号信息(仅在插件中调用时包含这一项) */ + interface Plugin { + /** 插件 appId */ + appId: string + /** 插件版本号 */ + version: string + } + interface PreviewImageOption { + /** 需要预览的图片链接列表。[2.2.3](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起支持云文件ID。 */ + urls: string[] + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PreviewImageCompleteCallback + /** 当前显示图片的链接 */ + current?: string + /** 接口调用失败的回调函数 */ + fail?: PreviewImageFailCallback + /** 是否显示长按菜单 + * + * 最低基础库: `2.13.0` */ + showmenu?: boolean + /** 接口调用成功的回调函数 */ + success?: PreviewImageSuccessCallback + } + interface PreviewMediaOption { + /** 需要预览的资源列表 */ + sources: MediaSource[] + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PreviewMediaCompleteCallback + /** 当前显示的资源序号 */ + current?: number + /** 接口调用失败的回调函数 */ + fail?: PreviewMediaFailCallback + /** 是否显示长按菜单 + * + * 最低基础库: `2.13.0` */ + showmenu?: boolean + /** 接口调用成功的回调函数 */ + success?: PreviewMediaSuccessCallback + } + interface ReLaunchOption { + /** 需要跳转的应用内页面路径 (代码包路径),路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2' */ + url: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ReLaunchCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ReLaunchFailCallback + /** 接口调用成功的回调函数 */ + success?: ReLaunchSuccessCallback + } + interface ReadBLECharacteristicValueOption { + /** 蓝牙特征值的 uuid */ + characteristicId: string + /** 蓝牙设备 id */ + deviceId: string + /** 蓝牙特征值对应服务的 uuid */ + serviceId: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ReadBLECharacteristicValueCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ReadBLECharacteristicValueFailCallback + /** 接口调用成功的回调函数 */ + success?: ReadBLECharacteristicValueSuccessCallback + } + interface ReadFileFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 所在目录不存在; + * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有读权限; + * - 'fail sdcard not mounted': Android sdcard 挂载失败; */ + errMsg: string + } + interface ReadFileOption { + /** 要读取的文件的路径 (本地路径) */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ReadFileCompleteCallback + /** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容 + * + * 可选值: + * - 'ascii': ; + * - 'base64': ; + * - 'binary': ; + * - 'hex': ; + * - 'ucs2': 以小端序读取; + * - 'ucs-2': 以小端序读取; + * - 'utf16le': 以小端序读取; + * - 'utf-16le': 以小端序读取; + * - 'utf-8': ; + * - 'utf8': ; + * - 'latin1': ; */ + encoding?: + | 'ascii' + | 'base64' + | 'binary' + | 'hex' + | 'ucs2' + | 'ucs-2' + | 'utf16le' + | 'utf-16le' + | 'utf-8' + | 'utf8' + | 'latin1' + /** 接口调用失败的回调函数 */ + fail?: ReadFileFailCallback + /** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte + * + * 最低基础库: `2.10.0` */ + length?: number + /** 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte + * + * 最低基础库: `2.10.0` */ + position?: number + /** 接口调用成功的回调函数 */ + success?: ReadFileSuccessCallback + } + interface ReadFileSuccessCallbackResult { + /** 文件内容 */ + data: string | ArrayBuffer + errMsg: string + } + interface ReaddirFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail no such file or directory ${dirPath}': 目录不存在; + * - 'fail not a directory ${dirPath}': dirPath 不是目录; + * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有读权限; + * - 'fail sdcard not mounted': Android sdcard 挂载失败; */ + errMsg: string + } + interface ReaddirOption { + /** 要读取的目录路径 (本地路径) */ + dirPath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ReaddirCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ReaddirFailCallback + /** 接口调用成功的回调函数 */ + success?: ReaddirSuccessCallback + } + interface ReaddirSuccessCallbackResult { + /** 指定目录下的文件名数组。 */ + files: string[] + errMsg: string + } + interface RecorderManagerStartOption { + /** 指定录音的音频输入源,可通过 [wx.getAvailableAudioSources()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.getAvailableAudioSources.html) 获取当前可用的音频源 + * + * 可选值: + * - 'auto': 自动设置,默认使用手机麦克风,插上耳麦后自动切换使用耳机麦克风,所有平台适用; + * - 'buildInMic': 手机麦克风,仅限 iOS; + * - 'headsetMic': 有线耳机麦克风,仅限 iOS; + * - 'mic': 麦克风(没插耳麦时是手机麦克风,插耳麦时是耳机麦克风),仅限 Android; + * - 'camcorder': 同 mic,适用于录制音视频内容,仅限 Android; + * - 'voice_communication': 同 mic,适用于实时沟通,仅限 Android; + * - 'voice_recognition': 同 mic,适用于语音识别,仅限 Android; + * + * 最低基础库: `2.1.0` */ + audioSource?: + | 'auto' + | 'buildInMic' + | 'headsetMic' + | 'mic' + | 'camcorder' + | 'voice_communication' + | 'voice_recognition' + /** 录音的时长,单位 ms,最大值 600000(10 分钟) */ + duration?: number + /** 编码码率,有效值见下表格 */ + encodeBitRate?: number + /** 音频格式 + * + * 可选值: + * - 'mp3': mp3 格式; + * - 'aac': aac 格式; + * - 'wav': wav 格式; + * - 'PCM': pcm 格式; */ + format?: 'mp3' | 'aac' | 'wav' | 'PCM' + /** 指定帧大小,单位 KB。传入 frameSize 后,每录制指定帧大小的内容后,会回调录制的文件内容,不指定则不会回调。暂仅支持 mp3 格式。 */ + frameSize?: number + /** 录音通道数 + * + * 可选值: + * - 1: 1 个通道; + * - 2: 2 个通道; */ + numberOfChannels?: 1 | 2 + /** 采样率 + * + * 可选值: + * - 8000: 8000 采样率; + * - 11025: 11025 采样率; + * - 12000: 12000 采样率; + * - 16000: 16000 采样率; + * - 22050: 22050 采样率; + * - 24000: 24000 采样率; + * - 32000: 32000 采样率; + * - 44100: 44100 采样率; + * - 48000: 48000 采样率; */ + sampleRate?: + | 8000 + | 11025 + | 12000 + | 16000 + | 22050 + | 24000 + | 32000 + | 44100 + | 48000 + } + /** 菜单按钮的布局位置信息 */ + interface Rect { + /** 下边界坐标,单位:px */ + bottom: number + /** 高度,单位:px */ + height: number + /** 左边界坐标,单位:px */ + left: number + /** 右边界坐标,单位:px */ + right: number + /** 上边界坐标,单位:px */ + top: number + /** 宽度,单位:px */ + width: number + } + interface RedirectToOption { + /** 需要跳转的应用内非 tabBar 的页面的路径 (代码包路径), 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 'path?key=value&key2=value2' */ + url: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RedirectToCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: RedirectToFailCallback + /** 接口调用成功的回调函数 */ + success?: RedirectToSuccessCallback + } + interface RedoOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RedoCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: RedoFailCallback + /** 接口调用成功的回调函数 */ + success?: RedoSuccessCallback + } + /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */ + interface ReferrerInfo { + /** 来源小程序、公众号或 App 的 appId */ + appId: string + /** 来源小程序传过来的数据,scene=1037或1038时支持 */ + extraData: IAnyObject + } + /** 参照区域的边界 */ + interface RelativeRectResult { + /** 下边界 */ + bottom: number + /** 左边界 */ + left: number + /** 右边界 */ + right: number + /** 上边界 */ + top: number + } + /** 消息来源的结构化信息 */ + interface RemoteInfo { + /** 发送消息的 socket 的地址 */ + address: string + /** 使用的协议族,为 IPv4 或者 IPv6 */ + family: string + /** 端口号 */ + port: number + /** message 的大小,单位:字节 */ + size: number + } + interface RemoveCustomLayerOption { + /** 个性化图层id */ + layerId: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RemoveCustomLayerCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: RemoveCustomLayerFailCallback + /** 接口调用成功的回调函数 */ + success?: RemoveCustomLayerSuccessCallback + } + interface RemoveFormatOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RemoveFormatCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: RemoveFormatFailCallback + /** 接口调用成功的回调函数 */ + success?: RemoveFormatSuccessCallback + } + interface RemoveGroundOverlayOption { + /** 图片图层 id */ + id: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RemoveGroundOverlayCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: RemoveGroundOverlayFailCallback + /** 接口调用成功的回调函数 */ + success?: RemoveGroundOverlaySuccessCallback + } + interface RemoveMarkersOption { + /** marker 的 id 集合。 */ + markerIds: any[] + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RemoveMarkersCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: RemoveMarkersFailCallback + /** 接口调用成功的回调函数 */ + success?: RemoveMarkersSuccessCallback + } + interface RemoveSavedFileFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail file not exist': 指定的 tempFilePath 找不到文件; */ + errMsg: string + } + interface RemoveServiceOption { + /** service 的 uuid */ + serviceId: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RemoveServiceCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: RemoveServiceFailCallback + /** 接口调用成功的回调函数 */ + success?: RemoveServiceSuccessCallback + } + interface RemoveStorageOption { + /** 本地缓存中指定的 key */ + key: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RemoveStorageCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: RemoveStorageFailCallback + /** 接口调用成功的回调函数 */ + success?: RemoveStorageSuccessCallback + } + interface RemoveTabBarBadgeOption { + /** tabBar 的哪一项,从左边算起 */ + index: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RemoveTabBarBadgeCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: RemoveTabBarBadgeFailCallback + /** 接口调用成功的回调函数 */ + success?: RemoveTabBarBadgeSuccessCallback + } + interface RenameFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail permission denied, rename ${oldPath} -> ${newPath}': 指定源文件或目标文件没有写权限; + * - 'fail no such file or directory, rename ${oldPath} -> ${newPath}': 源文件不存在,或目标文件路径的上层目录不存在; */ + errMsg: string + } + interface RenameOption { + /** 新文件路径,支持本地路径 */ + newPath: string + /** 源文件路径,支持本地路径 */ + oldPath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RenameCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: RenameFailCallback + /** 接口调用成功的回调函数 */ + success?: RenameSuccessCallback + } + /** Canvas 绘图上下文。 + * + * **** + * + * - 通过 Canvas.getContext('2d') 接口可以获取 CanvasRenderingContext2D 对象,实现了 [HTML Canvas 2D Context](https://www.w3.org/TR/2dcontext/) 定义的属性、方法。 + * - 通过 Canvas.getContext('webgl') 或 OffscreenCanvas.getContext('webgl') 接口可以获取 WebGLRenderingContext 对象,实现了 [WebGL 1.0](https://www.khronos.org/registry/webgl/specs/latest/1.0/) 定义的所有属性、方法、常量。 + * - CanvasRenderingContext2D 的 drawImage 方法 2.10.0 起支持传入通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取的 video 对象 + * + * **示例代码** + * + * + * + * video 画到 2D Canvas 示例 + * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/tJTak7mU7sfX) */ + interface RenderingContext {} + interface RequestOption< + T extends string | IAnyObject | ArrayBuffer = + | string + | IAnyObject + | ArrayBuffer + > { + /** 开发者服务器接口地址 */ + url: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RequestCompleteCallback + /** 请求的参数 */ + data?: string | IAnyObject | ArrayBuffer + /** 返回的数据格式 + * + * 可选值: + * - 'json': 返回的数据为 JSON,返回后会对返回的数据进行一次 JSON.parse; + * - '其他': 不对返回的内容进行 JSON.parse; */ + dataType?: 'json' | '其他' + /** 开启 cache + * + * 最低基础库: `2.10.4` */ + enableCache?: boolean + /** 开启 http2 + * + * 最低基础库: `2.10.4` */ + enableHttp2?: boolean + /** 开启 quic + * + * 最低基础库: `2.10.4` */ + enableQuic?: boolean + /** 接口调用失败的回调函数 */ + fail?: RequestFailCallback + /** 设置请求的 header,header 中不能设置 Referer。 + * + * `content-type` 默认为 `application/json` */ + header?: IAnyObject + /** HTTP 请求方法 + * + * 可选值: + * - 'OPTIONS': HTTP 请求 OPTIONS; + * - 'GET': HTTP 请求 GET; + * - 'HEAD': HTTP 请求 HEAD; + * - 'POST': HTTP 请求 POST; + * - 'PUT': HTTP 请求 PUT; + * - 'DELETE': HTTP 请求 DELETE; + * - 'TRACE': HTTP 请求 TRACE; + * - 'CONNECT': HTTP 请求 CONNECT; */ + method?: + | 'OPTIONS' + | 'GET' + | 'HEAD' + | 'POST' + | 'PUT' + | 'DELETE' + | 'TRACE' + | 'CONNECT' + /** 响应的数据类型 + * + * 可选值: + * - 'text': 响应的数据为文本; + * - 'arraybuffer': 响应的数据为 ArrayBuffer; + * + * 最低基础库: `1.7.0` */ + responseType?: 'text' | 'arraybuffer' + /** 接口调用成功的回调函数 */ + success?: RequestSuccessCallback + /** 超时时间,单位为毫秒 + * + * 最低基础库: `2.10.0` */ + timeout?: number + } + interface RequestPaymentOption { + /** 随机字符串,长度为32个字符以下 */ + nonceStr: string + /** 统一下单接口返回的 prepay_id 参数值,提交格式如:prepay_id=*** */ + package: string + /** 签名,具体见微信支付文档 */ + paySign: string + /** 时间戳,从 1970 年 1 月 1 日 00:00:00 至今的秒数,即当前的时间 */ + timeStamp: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RequestPaymentCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: RequestPaymentFailCallback + /** 签名算法,应与后台下单时的值一致 + * + * 可选值: + * - 'MD5': 仅在 v2 版本接口适用; + * - 'HMAC-SHA256': 仅在 v2 版本接口适用; + * - 'RSA': 仅在 v3 版本接口适用; */ + signType?: 'MD5' | 'HMAC-SHA256' | 'RSA' + /** 接口调用成功的回调函数 */ + success?: RequestPaymentSuccessCallback + } + interface RequestPictureInPictureOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RequestPictureInPictureCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: RequestPictureInPictureFailCallback + /** 接口调用成功的回调函数 */ + success?: RequestPictureInPictureSuccessCallback + } + /** 网络请求过程中一些调试信息 + * + * 最低基础库: `2.10.4` */ + interface RequestProfile { + /** SSL建立完成的时间,如果不是安全连接,则值为 0 */ + SSLconnectionEnd: number + /** SSL建立连接的时间,如果不是安全连接,则值为 0 */ + SSLconnectionStart: number + /** HTTP(TCP) 完成建立连接的时间(完成握手),如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接完成的时间。注意这里握手结束,包括安全连接建立完成、SOCKS 授权通过 */ + connectEnd: number + /** HTTP(TCP) 开始建立连接的时间,如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接开始的时间 */ + connectStart: number + /** DNS 域名查询完成的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */ + domainLookupEnd: number + /** DNS 域名查询开始的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */ + domainLookupStart: number + /** 评估当前网络下载的kbps */ + downstreamThroughputKbpsEstimate: number + /** 评估的网络状态 slow 2g/2g/3g/4g */ + estimate_nettype: string + /** 组件准备好使用 HTTP 请求抓取资源的时间,这发生在检查本地缓存之前 */ + fetchStart: number + /** 协议层根据多个请求评估当前网络的 rtt(仅供参考) */ + httpRttEstimate: number + /** 当前请求的IP */ + peerIP: string + /** 当前请求的端口 */ + port: number + /** 收到字节数 */ + receivedBytedCount: number + /** 最后一个 HTTP 重定向完成时的时间。有跳转且是同域名内部的重定向才算,否则值为 0 */ + redirectEnd: number + /** 第一个 HTTP 重定向发生时的时间。有跳转且是同域名内的重定向才算,否则值为 0 */ + redirectStart: number + /** HTTP请求读取真实文档结束的时间 */ + requestEnd: number + /** HTTP请求读取真实文档开始的时间(完成建立连接),包括从本地读取缓存。连接错误重连时,这里显示的也是新建立连接的时间 */ + requestStart: number + /** HTTP 响应全部接收完成的时间(获取到最后一个字节),包括从本地读取缓存 */ + responseEnd: number + /** HTTP 开始接收响应的时间(获取到第一个字节),包括从本地读取缓存 */ + responseStart: number + /** 当次请求连接过程中实时 rtt */ + rtt: number + /** 发送的字节数 */ + sendBytesCount: number + /** 是否复用连接 */ + socketReused: boolean + /** 当前网络的实际下载kbps */ + throughputKbps: number + /** 传输层根据多个请求评估的当前网络的 rtt(仅供参考) */ + transportRttEstimate: number + } + interface RequestSubscribeMessageFailCallbackResult { + /** 接口调用失败错误码 */ + errCode: number + /** 接口调用失败错误信息 */ + errMsg: string + } + interface RequestSubscribeMessageOption { + /** 需要订阅的消息模板的id的集合,一次调用最多可订阅3条消息(注意:iOS客户端7.0.6版本、Android客户端7.0.7版本之后的一次性订阅/长期订阅才支持多个模板消息,iOS客户端7.0.5版本、Android客户端7.0.6版本之前的一次订阅只支持一个模板消息)消息模板id在[微信公众平台(mp.weixin.qq.com)-功能-订阅消息]中配置。每个tmplId对应的模板标题需要不相同,否则会被过滤。 */ + tmplIds: any[] + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RequestSubscribeMessageCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: RequestSubscribeMessageFailCallback + /** 接口调用成功的回调函数 */ + success?: RequestSubscribeMessageSuccessCallback + } + interface RequestSubscribeMessageSuccessCallbackResult { + /** [TEMPLATE_ID]是动态的键,即模板id,值包括'accept'、'reject'、'ban'、'filter'。'accept'表示用户同意订阅该条id对应的模板消息,'reject'表示用户拒绝订阅该条id对应的模板消息,'ban'表示已被后台封禁,'filter'表示该模板因为模板标题同名被后台过滤。例如 { errMsg: "requestSubscribeMessage:ok", zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: "accept"} 表示用户同意订阅zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE这条消息 */ + [TEMPLATE_ID: string]: string + /** 接口调用成功时errMsg值为'requestSubscribeMessage:ok' */ + errMsg: string + } + interface RequestSuccessCallbackResult< + T extends string | IAnyObject | ArrayBuffer = + | string + | IAnyObject + | ArrayBuffer + > { + /** 开发者服务器返回的 cookies,格式为字符串数组 + * + * 最低基础库: `2.10.0` */ + cookies: string[] + /** 开发者服务器返回的数据 */ + data: T + /** 开发者服务器返回的 HTTP Response Header + * + * 最低基础库: `1.2.0` */ + header: IAnyObject + /** 网络请求过程中一些调试信息 + * + * 最低基础库: `2.10.4` */ + profile: RequestProfile + /** 开发者服务器返回的 HTTP 状态码 */ + statusCode: number + errMsg: string + } + interface ResumeBGMOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResumeBGMCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ResumeBGMFailCallback + /** 接口调用成功的回调函数 */ + success?: ResumeBGMSuccessCallback + } + interface ResumeOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResumeCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ResumeFailCallback + /** 接口调用成功的回调函数 */ + success?: ResumeSuccessCallback + } + interface RewardedVideoAdOnCloseCallbackResult { + /** 视频是否是在用户完整观看的情况下被关闭的 + * + * 最低基础库: `2.1.0` */ + isEnded: boolean + } + interface RewardedVideoAdOnErrorCallbackResult { + /** 错误码 + * + * 可选值: + * - 1000: 后端接口调用失败; + * - 1001: 参数错误; + * - 1002: 广告单元无效; + * - 1003: 内部错误; + * - 1004: 无合适的广告; + * - 1005: 广告组件审核中; + * - 1006: 广告组件被驳回; + * - 1007: 广告组件被封禁; + * - 1008: 广告单元已关闭; + * + * 最低基础库: `2.2.2` */ + errCode: 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 + /** 错误信息 */ + errMsg: string + } + interface RmdirFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail no such file or directory ${dirPath}': 目录不存在; + * - 'fail directory not empty': 目录不为空; + * - 'fail permission denied, open ${dirPath}': 指定的 dirPath 路径没有写权限; + * - 'fail sdcard not mounted': Android sdcard 挂载失败; */ + errMsg: string + } + interface RmdirOption { + /** 要删除的目录路径 (本地路径) */ + dirPath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RmdirCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: RmdirFailCallback + /** 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。 + * + * 最低基础库: `2.3.0` */ + recursive?: boolean + /** 接口调用成功的回调函数 */ + success?: RmdirSuccessCallback + } + /** 在竖屏正方向下的安全区域 + * + * 最低基础库: `2.7.0` */ + interface SafeArea { + /** 安全区域右下角纵坐标 */ + bottom: number + /** 安全区域的高度,单位逻辑像素 */ + height: number + /** 安全区域左上角横坐标 */ + left: number + /** 安全区域右下角横坐标 */ + right: number + /** 安全区域左上角纵坐标 */ + top: number + /** 安全区域的宽度,单位逻辑像素 */ + width: number + } + interface SaveFileFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail tempFilePath file not exist': 指定的 tempFilePath 找不到文件; + * - 'fail permission denied, open "${filePath}"': 指定的 filePath 路径没有写权限; + * - 'fail no such file or directory "${dirPath}"': 上级目录不存在; + * - 'fail the maximum size of the file storage limit is exceeded': 存储空间不足; + * - 'fail sdcard not mounted': Android sdcard 挂载失败; */ + errMsg: string + } + interface SaveFileSuccessCallbackResult { + /** 存储后的文件路径 (本地路径) */ + savedFilePath: string + errMsg: string + } + interface SaveFileToDiskOption { + /** 待保存文件路径 */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SaveFileToDiskCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SaveFileToDiskFailCallback + /** 接口调用成功的回调函数 */ + success?: SaveFileToDiskSuccessCallback + } + interface SaveImageToPhotosAlbumOption { + /** 图片文件路径,可以是临时文件路径或永久文件路径 (本地路径) ,不支持网络路径 */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SaveImageToPhotosAlbumCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SaveImageToPhotosAlbumFailCallback + /** 接口调用成功的回调函数 */ + success?: SaveImageToPhotosAlbumSuccessCallback + } + interface SaveVideoToPhotosAlbumOption { + /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 (本地路径) */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SaveVideoToPhotosAlbumCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SaveVideoToPhotosAlbumFailCallback + /** 接口调用成功的回调函数 */ + success?: SaveVideoToPhotosAlbumSuccessCallback + } + interface ScanCodeOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ScanCodeCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ScanCodeFailCallback + /** 是否只能从相机扫码,不允许从相册选择图片 + * + * 最低基础库: `1.2.0` */ + onlyFromCamera?: boolean + /** 扫码类型 + * + * 可选值: + * - 'barCode': 一维码; + * - 'qrCode': 二维码; + * - 'datamatrix': Data Matrix 码; + * - 'pdf417': PDF417 条码; + * + * 最低基础库: `1.7.0` */ + scanType?: Array<'barCode' | 'qrCode' | 'datamatrix' | 'pdf417'> + /** 接口调用成功的回调函数 */ + success?: ScanCodeSuccessCallback + } + interface ScanCodeSuccessCallbackResult { + /** 所扫码的字符集 */ + charSet: string + /** 当所扫的码为当前小程序二维码时,会返回此字段,内容为二维码携带的 path */ + path: string + /** 原始数据,base64编码 */ + rawData: string + /** 所扫码的内容 */ + result: string + /** 所扫码的类型 + * + * 可选值: + * - 'QR_CODE': 二维码; + * - 'AZTEC': 一维码; + * - 'CODABAR': 一维码; + * - 'CODE_39': 一维码; + * - 'CODE_93': 一维码; + * - 'CODE_128': 一维码; + * - 'DATA_MATRIX': 二维码; + * - 'EAN_8': 一维码; + * - 'EAN_13': 一维码; + * - 'ITF': 一维码; + * - 'MAXICODE': 一维码; + * - 'PDF_417': 二维码; + * - 'RSS_14': 一维码; + * - 'RSS_EXPANDED': 一维码; + * - 'UPC_A': 一维码; + * - 'UPC_E': 一维码; + * - 'UPC_EAN_EXTENSION': 一维码; + * - 'WX_CODE': 二维码; + * - 'CODE_25': 一维码; */ + scanType: + | 'QR_CODE' + | 'AZTEC' + | 'CODABAR' + | 'CODE_39' + | 'CODE_93' + | 'CODE_128' + | 'DATA_MATRIX' + | 'EAN_8' + | 'EAN_13' + | 'ITF' + | 'MAXICODE' + | 'PDF_417' + | 'RSS_14' + | 'RSS_EXPANDED' + | 'UPC_A' + | 'UPC_E' + | 'UPC_EAN_EXTENSION' + | 'WX_CODE' + | 'CODE_25' + errMsg: string + } + interface ScrollOffsetCallbackResult { + /** 节点的 dataset */ + dataset: IAnyObject + /** 节点的 ID */ + id: string + /** 节点的水平滚动位置 */ + scrollLeft: number + /** 节点的竖直滚动位置 */ + scrollTop: number + } + interface ScrollToOption { + /** 是否启用滚动动画 */ + animated?: boolean + /** 滚动动画时长 */ + duration?: number + /** 左边界距离 */ + left?: number + /** 顶部距离 */ + top?: number + /** 初始速度 */ + velocity?: number + } + /** 增强 ScrollView 实例 + * + * 最低基础库: `2.14.4` */ + interface ScrollViewContext { + /** 设置滚动边界弹性 (仅在 iOS 下生效) */ + bounces: boolean + /** 取消滚动惯性 (仅在 iOS 下生效) */ + decelerationDisabled: boolean + /** 设置滚动减速速率 */ + fastDeceleration: boolean + /** 分页滑动开关 */ + pagingEnabled: boolean + /** 滚动开关 */ + scrollEnabled: boolean + /** 设置是否显示滚动条 */ + showScrollbar: boolean + } + interface SeekBackgroundAudioOption { + /** 音乐位置,单位:秒 */ + position: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SeekBackgroundAudioCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SeekBackgroundAudioFailCallback + /** 接口调用成功的回调函数 */ + success?: SeekBackgroundAudioSuccessCallback + } + interface SendHCEMessageOption { + /** 二进制数据 */ + data: ArrayBuffer + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SendHCEMessageCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SendHCEMessageFailCallback + /** 接口调用成功的回调函数 */ + success?: SendHCEMessageSuccessCallback + } + interface SendMessageOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SendMessageCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SendMessageFailCallback + /** 接口调用成功的回调函数 */ + success?: SendMessageSuccessCallback + } + interface SendSocketMessageOption { + /** 需要发送的内容 */ + data: string | ArrayBuffer + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SendSocketMessageCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SendSocketMessageFailCallback + /** 接口调用成功的回调函数 */ + success?: SendSocketMessageSuccessCallback + } + interface SetBGMVolumeOption { + /** 音量大小,范围是 0-1 */ + volume: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetBGMVolumeCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetBGMVolumeFailCallback + /** 接口调用成功的回调函数 */ + success?: SetBGMVolumeSuccessCallback + } + interface SetBLEMTUOption { + /** 用于区分设备的 id */ + deviceId: string + /** 最大传输单元(22,512) 区间内,单位 bytes */ + mtu: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetBLEMTUCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetBLEMTUFailCallback + /** 接口调用成功的回调函数 */ + success?: SetBLEMTUSuccessCallback + } + interface SetBackgroundColorOption { + /** 窗口的背景色,必须为十六进制颜色值 */ + backgroundColor?: string + /** 底部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持 */ + backgroundColorBottom?: string + /** 顶部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持 */ + backgroundColorTop?: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetBackgroundColorCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetBackgroundColorFailCallback + /** 接口调用成功的回调函数 */ + success?: SetBackgroundColorSuccessCallback + } + interface SetBackgroundFetchTokenOption { + /** 自定义的登录态 */ + token: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetBackgroundFetchTokenCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetBackgroundFetchTokenFailCallback + /** 接口调用成功的回调函数 */ + success?: SetBackgroundFetchTokenSuccessCallback + } + interface SetBackgroundTextStyleOption { + /** 下拉背景字体、loading 图的样式。 + * + * 可选值: + * - 'dark': dark 样式; + * - 'light': light 样式; */ + textStyle: 'dark' | 'light' + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetBackgroundTextStyleCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetBackgroundTextStyleFailCallback + /** 接口调用成功的回调函数 */ + success?: SetBackgroundTextStyleSuccessCallback + } + interface SetCenterOffsetOption { + /** 偏移量,两位数组 */ + offset: number[] + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetCenterOffsetCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetCenterOffsetFailCallback + /** 接口调用成功的回调函数 */ + success?: SetCenterOffsetSuccessCallback + } + interface SetClipboardDataOption { + /** 剪贴板的内容 */ + data: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetClipboardDataCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetClipboardDataFailCallback + /** 接口调用成功的回调函数 */ + success?: SetClipboardDataSuccessCallback + } + interface SetContentsOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetContentsCompleteCallback + /** 表示内容的delta对象 */ + delta?: IAnyObject + /** 接口调用失败的回调函数 */ + fail?: SetContentsFailCallback + /** 带标签的HTML内容 */ + html?: string + /** 接口调用成功的回调函数 */ + success?: SetContentsSuccessCallback + } + interface SetEnableDebugOption { + /** 是否打开调试 */ + enableDebug: boolean + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetEnableDebugCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetEnableDebugFailCallback + /** 接口调用成功的回调函数 */ + success?: SetEnableDebugSuccessCallback + } + interface SetInnerAudioOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetInnerAudioOptionCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetInnerAudioOptionFailCallback + /** 是否与其他音频混播,设置为 true 之后,不会终止其他应用或微信内的音乐 */ + mixWithOther?: boolean + /** (仅在 iOS 生效)是否遵循静音开关,设置为 false 之后,即使是在静音模式下,也能播放声音 */ + obeyMuteSwitch?: boolean + /** true 代表用扬声器播放,false 代表听筒播放,默认值为 true。 */ + speakerOn?: boolean + /** 接口调用成功的回调函数 */ + success?: SetInnerAudioOptionSuccessCallback + } + interface SetKeepScreenOnOption { + /** 是否保持屏幕常亮 */ + keepScreenOn: boolean + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetKeepScreenOnCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetKeepScreenOnFailCallback + /** 接口调用成功的回调函数 */ + success?: SetKeepScreenOnSuccessCallback + } + interface SetMICVolumeOption { + /** 音量大小,范围是 0.0-1.0 */ + volume: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetMICVolumeCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetMICVolumeFailCallback + /** 接口调用成功的回调函数 */ + success?: SetMICVolumeSuccessCallback + } + interface SetNavigationBarColorOption { + /** 背景颜色值,有效值为十六进制颜色 */ + backgroundColor: string + /** 前景颜色值,包括按钮、标题、状态栏的颜色,仅支持 #ffffff 和 #000000 */ + frontColor: string + /** 动画效果 */ + animation?: AnimationOption + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetNavigationBarColorCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetNavigationBarColorFailCallback + /** 接口调用成功的回调函数 */ + success?: SetNavigationBarColorSuccessCallback + } + interface SetNavigationBarTitleOption { + /** 页面标题 */ + title: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetNavigationBarTitleCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetNavigationBarTitleFailCallback + /** 接口调用成功的回调函数 */ + success?: SetNavigationBarTitleSuccessCallback + } + interface SetScreenBrightnessOption { + /** 屏幕亮度值,范围 0 ~ 1。0 最暗,1 最亮 */ + value: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetScreenBrightnessCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetScreenBrightnessFailCallback + /** 接口调用成功的回调函数 */ + success?: SetScreenBrightnessSuccessCallback + } + interface SetStorageOption { + /** 需要存储的内容。只支持原生类型、Date、及能够通过`JSON.stringify`序列化的对象。 */ + data: T + /** 本地缓存中指定的 key */ + key: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetStorageCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetStorageFailCallback + /** 接口调用成功的回调函数 */ + success?: SetStorageSuccessCallback + } + interface SetTabBarBadgeOption { + /** tabBar 的哪一项,从左边算起 */ + index: number + /** 显示的文本,超过 4 个字符则显示成 ... */ + text: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetTabBarBadgeCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetTabBarBadgeFailCallback + /** 接口调用成功的回调函数 */ + success?: SetTabBarBadgeSuccessCallback + } + interface SetTabBarItemOption { + /** tabBar 的哪一项,从左边算起 */ + index: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetTabBarItemCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetTabBarItemFailCallback + /** 图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,当 postion 为 top 时,此参数无效 */ + iconPath?: string + /** 选中时的图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px ,当 postion 为 top 时,此参数无效 */ + selectedIconPath?: string + /** 接口调用成功的回调函数 */ + success?: SetTabBarItemSuccessCallback + /** tab 上的按钮文字 */ + text?: string + } + interface SetTabBarStyleOption { + /** tab 的背景色,HexColor */ + backgroundColor?: string + /** tabBar上边框的颜色, 仅支持 black/white */ + borderStyle?: string + /** tab 上的文字默认颜色,HexColor */ + color?: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetTabBarStyleCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetTabBarStyleFailCallback + /** tab 上的文字选中时的颜色,HexColor */ + selectedColor?: string + /** 接口调用成功的回调函数 */ + success?: SetTabBarStyleSuccessCallback + } + interface SetTimeoutOption { + /** 设置超时时间 (ms) */ + timeout: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetTimeoutCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetTimeoutFailCallback + /** 接口调用成功的回调函数 */ + success?: SetTimeoutSuccessCallback + } + interface SetTopBarTextOption { + /** 置顶栏文字 */ + text: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetTopBarTextCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetTopBarTextFailCallback + /** 接口调用成功的回调函数 */ + success?: SetTopBarTextSuccessCallback + } + interface SetWifiListOption { + /** 提供预设的 Wi-Fi 信息列表 */ + wifiList: WifiData[] + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetWifiListCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetWifiListFailCallback + /** 接口调用成功的回调函数 */ + success?: SetWifiListSuccessCallback + } + interface SetWindowSizeOption { + /** 窗口高度,以像素为单位 */ + height: number + /** 窗口宽度,以像素为单位 */ + width: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetWindowSizeCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetWindowSizeFailCallback + /** 接口调用成功的回调函数 */ + success?: SetWindowSizeSuccessCallback + } + interface SetZoomOption { + /** 缩放级别,范围[1, maxZoom]。zoom 可取小数,精确到小数后一位。maxZoom 可在 bindinitdone 返回值中获取。 */ + zoom: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetZoomCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SetZoomFailCallback + /** 接口调用成功的回调函数 */ + success?: SetZoomSuccessCallback + } + interface SetZoomSuccessCallbackResult { + /** 实际设置的缩放级别。由于系统限制,某些机型可能无法设置成指定值,会改用最接近的可设值。 */ + zoom: number + errMsg: string + } + interface ShowActionSheetOption { + /** 按钮的文字数组,数组长度最大为 6 */ + itemList: string[] + /** 警示文案 + * + * 最低基础库: `2.14.0` */ + alertText?: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShowActionSheetCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ShowActionSheetFailCallback + /** 按钮的文字颜色 */ + itemColor?: string + /** 接口调用成功的回调函数 */ + success?: ShowActionSheetSuccessCallback + } + interface ShowActionSheetSuccessCallbackResult { + /** 用户点击的按钮序号,从上到下的顺序,从0开始 */ + tapIndex: number + errMsg: string + } + interface ShowLoadingOption { + /** 提示的内容 */ + title: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShowLoadingCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ShowLoadingFailCallback + /** 是否显示透明蒙层,防止触摸穿透 */ + mask?: boolean + /** 接口调用成功的回调函数 */ + success?: ShowLoadingSuccessCallback + } + interface ShowModalOption { + /** 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串 */ + cancelColor?: string + /** 取消按钮的文字,最多 4 个字符 */ + cancelText?: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShowModalCompleteCallback + /** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */ + confirmColor?: string + /** 确认按钮的文字,最多 4 个字符 */ + confirmText?: string + /** 提示的内容,editable 为 true 时,会输入框默认文本 */ + content?: string + /** 是否显示输入框 + * + * 最低基础库: `2.15.0` */ + editable?: boolean + /** 接口调用失败的回调函数 */ + fail?: ShowModalFailCallback + /** 输入框提示文本 + * + * 最低基础库: `2.15.0` */ + placeholderText?: string + /** 是否显示取消按钮 */ + showCancel?: boolean + /** 接口调用成功的回调函数 */ + success?: ShowModalSuccessCallback + /** 提示的标题 */ + title?: string + } + interface ShowModalSuccessCallbackResult { + /** 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) + * + * 最低基础库: `1.1.0` */ + cancel: boolean + /** 为 true 时,表示用户点击了确定按钮 */ + confirm: boolean + /** editable 为 true 时,用户输入的文本 */ + content: string + errMsg: string + } + interface ShowNavigationBarLoadingOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShowNavigationBarLoadingCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ShowNavigationBarLoadingFailCallback + /** 接口调用成功的回调函数 */ + success?: ShowNavigationBarLoadingSuccessCallback + } + interface ShowRedPackageOption { + /** 封面地址 */ + url: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShowRedPackageCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ShowRedPackageFailCallback + /** 接口调用成功的回调函数 */ + success?: ShowRedPackageSuccessCallback + } + interface ShowShareImageMenuOption { + /** 要分享的图片地址,必须为本地路径或临时路径 */ + path: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShowShareImageMenuCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ShowShareImageMenuFailCallback + /** 接口调用成功的回调函数 */ + success?: ShowShareImageMenuSuccessCallback + } + interface ShowShareMenuOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShowShareMenuCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ShowShareMenuFailCallback + /** 本接口为 Beta 版本,暂只在 Android 平台支持。需要显示的转发按钮名称列表,默认['shareAppMessage']。按钮名称合法值包含 "shareAppMessage"、"shareTimeline" 两种 + * + * 最低基础库: `2.11.3` */ + menus?: string[] + /** 接口调用成功的回调函数 */ + success?: ShowShareMenuSuccessCallback + /** 是否使用带 shareTicket 的转发[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */ + withShareTicket?: boolean + } + interface ShowTabBarOption { + /** 是否需要动画效果 */ + animation?: boolean + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShowTabBarCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ShowTabBarFailCallback + /** 接口调用成功的回调函数 */ + success?: ShowTabBarSuccessCallback + } + interface ShowTabBarRedDotOption { + /** tabBar 的哪一项,从左边算起 */ + index: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShowTabBarRedDotCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ShowTabBarRedDotFailCallback + /** 接口调用成功的回调函数 */ + success?: ShowTabBarRedDotSuccessCallback + } + interface ShowToastOption { + /** 提示的内容 */ + title: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShowToastCompleteCallback + /** 提示的延迟时间 */ + duration?: number + /** 接口调用失败的回调函数 */ + fail?: ShowToastFailCallback + /** 图标 + * + * 可选值: + * - 'success': 显示成功图标,此时 title 文本最多显示 7 个汉字长度; + * - 'error': 显示失败图标,此时 title 文本最多显示 7 个汉字长度; + * - 'loading': 显示加载图标,此时 title 文本最多显示 7 个汉字长度; + * - 'none': 不显示图标,此时 title 文本最多可显示两行,[1.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)及以上版本支持; */ + icon?: 'success' | 'error' | 'loading' | 'none' + /** 自定义图标的本地路径,image 的优先级高于 icon + * + * 最低基础库: `1.1.0` */ + image?: string + /** 是否显示透明蒙层,防止触摸穿透 */ + mask?: boolean + /** 接口调用成功的回调函数 */ + success?: ShowToastSuccessCallback + } + interface Size { + /** 变化后的窗口高度,单位 px */ + windowHeight: number + /** 变化后的窗口宽度,单位 px */ + windowWidth: number + } + /** 网络请求过程中一些调试信息 + * + * 最低基础库: `2.10.4` */ + interface SocketProfile { + /** 完成建立连接的时间(完成握手),如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接完成的时间。注意这里握手结束,包括安全连接建立完成、SOCKS 授权通过 */ + connectEnd: number + /** 开始建立连接的时间,如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接开始的时间 */ + connectStart: number + /** 上层请求到返回的耗时 */ + cost: number + /** DNS 域名查询完成的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */ + domainLookupEnd: number + /** DNS 域名查询开始的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */ + domainLookupStart: number + /** 组件准备好使用 SOCKET 建立请求的时间,这发生在检查本地缓存之前 */ + fetchStart: number + /** 握手耗时 */ + handshakeCost: number + /** 单次连接的耗时,包括 connect ,tls */ + rtt: number + } + interface SocketTaskCloseOption { + /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ + code?: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SocketTaskCloseCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SocketTaskCloseFailCallback + /** 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于 123 字节的 UTF-8 文本(不是字符)。 */ + reason?: string + /** 接口调用成功的回调函数 */ + success?: SocketTaskCloseSuccessCallback + } + interface SocketTaskOnCloseCallbackResult { + /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ + code: number + /** 一个可读的字符串,表示连接被关闭的原因。 */ + reason: string + } + interface SocketTaskOnMessageCallbackResult { + /** 服务器返回的消息 */ + data: string | ArrayBuffer + } + interface SocketTaskSendOption { + /** 需要发送的内容 */ + data: string | ArrayBuffer + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SendCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SendFailCallback + /** 接口调用成功的回调函数 */ + success?: SendSuccessCallback + } + interface StartAccelerometerOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartAccelerometerCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartAccelerometerFailCallback + /** 监听加速度数据回调函数的执行频率 + * + * 可选值: + * - 'game': 适用于更新游戏的回调频率,在 20ms/次 左右; + * - 'ui': 适用于更新 UI 的回调频率,在 60ms/次 左右; + * - 'normal': 普通的回调频率,在 200ms/次 左右; + * + * 最低基础库: `2.1.0` */ + interval?: 'game' | 'ui' | 'normal' + /** 接口调用成功的回调函数 */ + success?: StartAccelerometerSuccessCallback + } + interface StartAdvertisingObject { + /** 广播自定义参数 */ + advertiseRequest: AdvertiseReqObj + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartAdvertisingCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartAdvertisingFailCallback + /** 广播功率 + * + * 可选值: + * - 'low': 功率低; + * - 'medium': 功率适中; + * - 'high': 功率高; */ + powerLevel?: 'low' | 'medium' | 'high' + /** 接口调用成功的回调函数 */ + success?: StartAdvertisingSuccessCallback + } + interface StartBeaconDiscoveryOption { + /** iBeacon 设备广播的 uuid 列表 */ + uuids: string[] + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartBeaconDiscoveryCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartBeaconDiscoveryFailCallback + /** 是否校验蓝牙开关,仅在 iOS 下有效 */ + ignoreBluetoothAvailable?: boolean + /** 接口调用成功的回调函数 */ + success?: StartBeaconDiscoverySuccessCallback + } + interface StartBluetoothDevicesDiscoveryOption { + /** 是否允许重复上报同一设备。如果允许重复上报,则 [wx.onBlueToothDeviceFound](#) 方法会多次上报同一设备,但是 RSSI 值会有不同。 */ + allowDuplicatesKey?: boolean + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartBluetoothDevicesDiscoveryCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartBluetoothDevicesDiscoveryFailCallback + /** 上报设备的间隔。0 表示找到新设备立即上报,其他数值根据传入的间隔上报。 */ + interval?: number + /** 扫描模式,越高扫描越快,也越耗电, 仅安卓 7.0.12 及以上支持。 + * + * 可选值: + * - 'low': 低; + * - 'medium': 中; + * - 'high': 高; */ + powerLevel?: 'low' | 'medium' | 'high' + /** 要搜索的蓝牙设备主 service 的 uuid 列表。某些蓝牙设备会广播自己的主 service 的 uuid。如果设置此参数,则只搜索广播包有对应 uuid 的主服务的蓝牙设备。建议主要通过该参数过滤掉周边不需要处理的其他蓝牙设备。 */ + services?: string[] + /** 接口调用成功的回调函数 */ + success?: StartBluetoothDevicesDiscoverySuccessCallback + } + interface StartCompassOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartCompassCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartCompassFailCallback + /** 接口调用成功的回调函数 */ + success?: StartCompassSuccessCallback + } + interface StartDeviceMotionListeningOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartDeviceMotionListeningCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartDeviceMotionListeningFailCallback + /** 监听设备方向的变化回调函数的执行频率 + * + * 可选值: + * - 'game': 适用于更新游戏的回调频率,在 20ms/次 左右; + * - 'ui': 适用于更新 UI 的回调频率,在 60ms/次 左右; + * - 'normal': 普通的回调频率,在 200ms/次 左右; */ + interval?: 'game' | 'ui' | 'normal' + /** 接口调用成功的回调函数 */ + success?: StartDeviceMotionListeningSuccessCallback + } + interface StartDiscoveryOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartDiscoveryCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartDiscoveryFailCallback + /** 接口调用成功的回调函数 */ + success?: StartDiscoverySuccessCallback + } + interface StartGyroscopeOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartGyroscopeCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartGyroscopeFailCallback + /** 监听陀螺仪数据回调函数的执行频率 + * + * 可选值: + * - 'game': 适用于更新游戏的回调频率,在 20ms/次 左右; + * - 'ui': 适用于更新 UI 的回调频率,在 60ms/次 左右; + * - 'normal': 普通的回调频率,在 200ms/次 左右; */ + interval?: 'game' | 'ui' | 'normal' + /** 接口调用成功的回调函数 */ + success?: StartGyroscopeSuccessCallback + } + interface StartHCEOption { + /** 需要注册到系统的 AID 列表 */ + aid_list: string[] + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartHCECompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartHCEFailCallback + /** 接口调用成功的回调函数 */ + success?: StartHCESuccessCallback + } + interface StartLocalServiceDiscoveryFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'invalid param': serviceType 为空; + * - 'scan task already exist': 在当前 startLocalServiceDiscovery 发起的搜索未停止的情况下,再次调用 startLocalServiceDiscovery; */ + errMsg: string + } + interface StartLocalServiceDiscoveryOption { + /** 要搜索的服务类型 */ + serviceType: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartLocalServiceDiscoveryCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartLocalServiceDiscoveryFailCallback + /** 接口调用成功的回调函数 */ + success?: StartLocalServiceDiscoverySuccessCallback + } + interface StartLocationUpdateBackgroundOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartLocationUpdateBackgroundCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartLocationUpdateBackgroundFailCallback + /** 接口调用成功的回调函数 */ + success?: StartLocationUpdateBackgroundSuccessCallback + } + interface StartLocationUpdateOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartLocationUpdateCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartLocationUpdateFailCallback + /** 接口调用成功的回调函数 */ + success?: StartLocationUpdateSuccessCallback + } + interface StartPreviewOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartPreviewCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartPreviewFailCallback + /** 接口调用成功的回调函数 */ + success?: StartPreviewSuccessCallback + } + interface StartPullDownRefreshOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartPullDownRefreshCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartPullDownRefreshFailCallback + /** 接口调用成功的回调函数 */ + success?: StartPullDownRefreshSuccessCallback + } + interface StartRecordSuccessCallbackResult { + /** 录音文件的临时路径 (本地路径) */ + tempFilePath: string + errMsg: string + } + interface StartRecordTimeoutCallbackResult { + /** 封面图片文件的临时路径 (本地路径) */ + tempThumbPath: string + /** 视频的文件的临时路径 (本地路径) */ + tempVideoPath: string + } + interface StartSoterAuthenticationOption { + /** 挑战因子。挑战因子为调用者为此次生物鉴权准备的用于签名的字符串关键识别信息,将作为 `resultJSON` 的一部分,供调用者识别本次请求。例如:如果场景为请求用户对某订单进行授权确认,则可以将订单号填入此参数。 */ + challenge: string + /** 请求使用的可接受的生物认证方式 + * + * 可选值: + * - 'fingerPrint': 指纹识别; + * - 'facial': 人脸识别; + * - 'speech': 声纹识别(暂未支持); */ + requestAuthModes: Array<'fingerPrint' | 'facial' | 'speech'> + /** 验证描述,即识别过程中显示在界面上的对话框提示内容 */ + authContent?: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartSoterAuthenticationCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartSoterAuthenticationFailCallback + /** 接口调用成功的回调函数 */ + success?: StartSoterAuthenticationSuccessCallback + } + interface StartSoterAuthenticationSuccessCallbackResult { + /** 生物认证方式 */ + authMode: string + /** 错误码 */ + errCode: number + /** 错误信息 */ + errMsg: string + /** 在设备安全区域(TEE)内获得的本机安全信息(如TEE名称版本号等以及防重放参数)以及本次认证信息(仅Android支持,本次认证的指纹ID)。具体说明见下文 */ + resultJSON: string + /** 用SOTER安全密钥对 `resultJSON` 的签名(SHA256 with RSA/PSS, saltlen=20) */ + resultJSONSignature: string + } + interface StartWifiOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartWifiCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartWifiFailCallback + /** 接口调用成功的回调函数 */ + success?: StartWifiSuccessCallback + } + interface StatFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail permission denied, open ${path}': 指定的 path 路径没有读权限; + * - 'fail no such file or directory ${path}': 文件不存在; + * - 'fail sdcard not mounted': Android sdcard 挂载失败; */ + errMsg: string + } + interface StatOption { + /** 文件/目录路径 (本地路径) */ + path: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StatCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StatFailCallback + /** 是否递归获取目录下的每个文件的 Stats 信息 + * + * 最低基础库: `2.3.0` */ + recursive?: boolean + /** 接口调用成功的回调函数 */ + success?: StatSuccessCallback + } + interface StatSuccessCallbackResult { + /** [Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)|Object + * + * 当 recursive 为 false 时,res.stats 是一个 Stats 对象。当 recursive 为 true 且 path 是一个目录的路径时,res.stats 是一个 Object,key 以 path 为根路径的相对路径,value 是该路径对应的 Stats 对象。 */ + stats: Stats | IAnyObject + errMsg: string + } + /** 描述文件状态的对象 */ + interface Stats { + /** 文件最近一次被存取或被执行的时间,UNIX 时间戳,对应 POSIX stat.st_atime */ + lastAccessedTime: number + /** 文件最后一次被修改的时间,UNIX 时间戳,对应 POSIX stat.st_mtime */ + lastModifiedTime: number + /** 文件的类型和存取的权限,对应 POSIX stat.st_mode */ + mode: string + /** 文件大小,单位:B,对应 POSIX stat.st_size */ + size: number + } + interface StepOption { + /** 动画延迟时间,单位 ms */ + delay?: number + /** 动画持续时间,单位 ms */ + duration?: number + /** 动画的效果 + * + * 可选值: + * - 'linear': 动画从头到尾的速度是相同的; + * - 'ease': 动画以低速开始,然后加快,在结束前变慢; + * - 'ease-in': 动画以低速开始; + * - 'ease-in-out': 动画以低速开始和结束; + * - 'ease-out': 动画以低速结束; + * - 'step-start': 动画第一帧就跳至结束状态直到结束; + * - 'step-end': 动画一直保持开始状态,最后一帧跳到结束状态; */ + timingFunction?: + | 'linear' + | 'ease' + | 'ease-in' + | 'ease-in-out' + | 'ease-out' + | 'step-start' + | 'step-end' + transformOrigin?: string + } + interface StopAccelerometerOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopAccelerometerCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopAccelerometerFailCallback + /** 接口调用成功的回调函数 */ + success?: StopAccelerometerSuccessCallback + } + interface StopAdvertisingOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopAdvertisingCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopAdvertisingFailCallback + /** 接口调用成功的回调函数 */ + success?: StopAdvertisingSuccessCallback + } + interface StopBGMOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopBGMCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopBGMFailCallback + /** 接口调用成功的回调函数 */ + success?: StopBGMSuccessCallback + } + interface StopBackgroundAudioOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopBackgroundAudioCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopBackgroundAudioFailCallback + /** 接口调用成功的回调函数 */ + success?: StopBackgroundAudioSuccessCallback + } + interface StopBeaconDiscoveryOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopBeaconDiscoveryCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopBeaconDiscoveryFailCallback + /** 接口调用成功的回调函数 */ + success?: StopBeaconDiscoverySuccessCallback + } + interface StopBluetoothDevicesDiscoveryOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopBluetoothDevicesDiscoveryCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopBluetoothDevicesDiscoveryFailCallback + /** 接口调用成功的回调函数 */ + success?: StopBluetoothDevicesDiscoverySuccessCallback + } + interface StopCompassOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopCompassCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopCompassFailCallback + /** 接口调用成功的回调函数 */ + success?: StopCompassSuccessCallback + } + interface StopDeviceMotionListeningOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopDeviceMotionListeningCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopDeviceMotionListeningFailCallback + /** 接口调用成功的回调函数 */ + success?: StopDeviceMotionListeningSuccessCallback + } + interface StopDiscoveryOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopDiscoveryCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopDiscoveryFailCallback + /** 接口调用成功的回调函数 */ + success?: StopDiscoverySuccessCallback + } + interface StopGyroscopeOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopGyroscopeCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopGyroscopeFailCallback + /** 接口调用成功的回调函数 */ + success?: StopGyroscopeSuccessCallback + } + interface StopHCEOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopHCECompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopHCEFailCallback + /** 接口调用成功的回调函数 */ + success?: StopHCESuccessCallback + } + interface StopLocalServiceDiscoveryFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'task not found': 在当前没有处在搜索服务中的情况下调用 stopLocalServiceDiscovery; */ + errMsg: string + } + interface StopLocalServiceDiscoveryOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopLocalServiceDiscoveryCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopLocalServiceDiscoveryFailCallback + /** 接口调用成功的回调函数 */ + success?: StopLocalServiceDiscoverySuccessCallback + } + interface StopLocationUpdateOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopLocationUpdateCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopLocationUpdateFailCallback + /** 接口调用成功的回调函数 */ + success?: StopLocationUpdateSuccessCallback + } + interface StopOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopFailCallback + /** 接口调用成功的回调函数 */ + success?: StopSuccessCallback + } + interface StopPreviewOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopPreviewCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopPreviewFailCallback + /** 接口调用成功的回调函数 */ + success?: StopPreviewSuccessCallback + } + interface StopPullDownRefreshOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopPullDownRefreshCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopPullDownRefreshFailCallback + /** 接口调用成功的回调函数 */ + success?: StopPullDownRefreshSuccessCallback + } + interface StopRecordSuccessCallbackResult { + /** 封面图片文件的临时路径 (本地路径) */ + tempThumbPath: string + /** 视频的文件的临时路径 (本地路径) */ + tempVideoPath: string + errMsg: string + } + interface StopVoiceOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopVoiceCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopVoiceFailCallback + /** 接口调用成功的回调函数 */ + success?: StopVoiceSuccessCallback + } + interface StopWifiOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopWifiCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopWifiFailCallback + /** 接口调用成功的回调函数 */ + success?: StopWifiSuccessCallback + } + interface SubscribeVoIPVideoMembersOption { + /** 订阅的成员列表 */ + openIdList: string[] + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SubscribeVoIPVideoMembersCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SubscribeVoIPVideoMembersFailCallback + /** 接口调用成功的回调函数 */ + success?: SubscribeVoIPVideoMembersSuccessCallback + } + /** 订阅消息设置 +* +* **示例代码** +* +* +* ```javascript +wx.getSetting({ + withSubscriptions: true, + success (res) { + console.log(res.authSetting) + // res.authSetting = { + // "scope.userInfo": true, + // "scope.userLocation": true + // } + console.log(res.subscriptionsSetting) + // res.subscriptionsSetting = { + // mainSwitch: true, // 订阅消息总开关 + // itemSettings: { // 每一项开关 + // SYS_MSG_TYPE_INTERACTIVE: 'accept', // 小游戏系统订阅消息 + // SYS_MSG_TYPE_RANK: 'accept' + // zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: 'reject', // 普通一次性订阅消息 + // ke_OZC_66gZxALLcsuI7ilCJSP2OJ2vWo2ooUPpkWrw: 'ban', + // } + // } + } +}) +``` */ + interface SubscriptionsSetting { + /** 订阅消息总开关,true为开启,false为关闭 */ + mainSwitch: boolean + /** 每一项订阅消息的订阅状态。itemSettings对象的键为**一次性订阅消息的模板id**或**系统订阅消息的类型**,值为'accept'、'reject'、'ban'中的其中一种。'accept'表示用户同意订阅这条消息,'reject'表示用户拒绝订阅这条消息,'ban'表示已被后台封禁。一次性订阅消息使用方法详见 [wx.requestSubscribeMessage](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html),永久订阅消息(仅小游戏可用)使用方法详见[wx.requestSubscribeSystemMessage](/minigame/dev/api/open-api/subscribe-message/wx.requestSubscribeSystemMessage.html) + * ## 注意事项 + * - itemSettings 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。 */ + itemSettings?: IAnyObject + } + interface SwitchCameraOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SwitchCameraCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SwitchCameraFailCallback + /** 接口调用成功的回调函数 */ + success?: SwitchCameraSuccessCallback + } + interface SwitchTabOption { + /** 需要跳转的 tabBar 页面的路径 (代码包路径)(需在 app.json 的 [tabBar](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#tabbar) 字段定义的页面),路径后不能带参数。 */ + url: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SwitchTabCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: SwitchTabFailCallback + /** 接口调用成功的回调函数 */ + success?: SwitchTabSuccessCallback + } + interface SystemInfo { + /** 客户端基础库版本 + * + * 最低基础库: `1.1.0` */ + SDKVersion: string + /** 允许微信使用相册的开关(仅 iOS 有效) + * + * 最低基础库: `2.6.0` */ + albumAuthorized: boolean + /** 设备性能等级(仅 Android)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) + * + * 最低基础库: `1.8.0` */ + benchmarkLevel: number + /** 蓝牙的系统开关 + * + * 最低基础库: `2.6.0` */ + bluetoothEnabled: boolean + /** 设备品牌 + * + * 最低基础库: `1.5.0` */ + brand: string + /** 允许微信使用摄像头的开关 + * + * 最低基础库: `2.6.0` */ + cameraAuthorized: boolean + /** 设备方向 + * + * 可选值: + * - 'portrait': 竖屏; + * - 'landscape': 横屏; */ + deviceOrientation: 'portrait' | 'landscape' + /** 是否已打开调试。可通过右上角菜单或 [wx.setEnableDebug](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html) 打开调试。 + * + * 最低基础库: `2.15.0` */ + enableDebug: boolean + /** 用户字体大小(单位px)。以微信客户端「我-设置-通用-字体大小」中的设置为准 + * + * 最低基础库: `1.5.0` */ + fontSizeSetting: number + /** 微信设置的语言 */ + language: string + /** 允许微信使用定位的开关 + * + * 最低基础库: `2.6.0` */ + locationAuthorized: boolean + /** 地理位置的系统开关 + * + * 最低基础库: `2.6.0` */ + locationEnabled: boolean + /** `true` 表示模糊定位,`false` 表示精确定位,仅 iOS 支持 */ + locationReducedAccuracy: boolean + /** 允许微信使用麦克风的开关 + * + * 最低基础库: `2.6.0` */ + microphoneAuthorized: boolean + /** 设备型号。新机型刚推出一段时间会显示unknown,微信会尽快进行适配。 */ + model: string + /** 允许微信通知带有提醒的开关(仅 iOS 有效) + * + * 最低基础库: `2.6.0` */ + notificationAlertAuthorized: boolean + /** 允许微信通知的开关 + * + * 最低基础库: `2.6.0` */ + notificationAuthorized: boolean + /** 允许微信通知带有标记的开关(仅 iOS 有效) + * + * 最低基础库: `2.6.0` */ + notificationBadgeAuthorized: boolean + /** 允许微信通知带有声音的开关(仅 iOS 有效) + * + * 最低基础库: `2.6.0` */ + notificationSoundAuthorized: boolean + /** 设备像素比 */ + pixelRatio: number + /** 客户端平台 */ + platform: string + /** 在竖屏正方向下的安全区域 + * + * 最低基础库: `2.7.0` */ + safeArea: SafeArea + /** 屏幕高度,单位px + * + * 最低基础库: `1.1.0` */ + screenHeight: number + /** 屏幕宽度,单位px + * + * 最低基础库: `1.1.0` */ + screenWidth: number + /** 状态栏的高度,单位px + * + * 最低基础库: `1.9.0` */ + statusBarHeight: number + /** 操作系统及版本 */ + system: string + /** 微信版本号 */ + version: string + /** Wi-Fi 的系统开关 + * + * 最低基础库: `2.6.0` */ + wifiEnabled: boolean + /** 可使用窗口高度,单位px */ + windowHeight: number + /** 可使用窗口宽度,单位px */ + windowWidth: number + /** 系统当前主题,取值为`light`或`dark`,全局配置`"darkmode":true`时才能获取,否则为 undefined (不支持小游戏) + * + * 可选值: + * - 'dark': 深色主题; + * - 'light': 浅色主题; + * + * 最低基础库: `2.11.0` */ + theme?: 'dark' | 'light' + } + interface TakePhotoOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: TakePhotoCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: TakePhotoFailCallback + /** 成像质量 + * + * 可选值: + * - 'high': 高质量; + * - 'normal': 普通质量; + * - 'low': 低质量; */ + quality?: 'high' | 'normal' | 'low' + /** 接口调用成功的回调函数 */ + success?: TakePhotoSuccessCallback + } + interface TakePhotoSuccessCallbackResult { + /** 照片文件的临时路径 (本地路径),安卓是jpg图片格式,ios是png */ + tempImagePath: string + errMsg: string + } + /** 标签类型枚举 */ + interface TechType { + /** 对应IsoDep实例,实例支持ISO-DEP (ISO 14443-4)标准的读写 */ + isoDep: string + /** 对应MifareClassic实例,实例支持MIFARE Classic标签的读写 */ + mifareClassic: string + /** 对应MifareUltralight实例,实例支持MIFARE Ultralight标签的读写 */ + mifareUltralight: string + /** 对应Ndef实例,实例支持对NDEF格式的NFC标签上的NDEF数据的读写 */ + ndef: string + /** 对应NfcA实例,实例支持NFC-A (ISO 14443-3A)标准的读写 */ + nfcA: string + /** 对应NfcB实例,实例支持NFC-B (ISO 14443-3B)标准的读写 */ + nfcB: string + /** 对应NfcF实例,实例支持NFC-F (JIS 6319-4)标准的读写 */ + nfcF: string + /** 对应NfcV实例,实例支持NFC-V (ISO 15693)标准的读写 */ + nfcV: string + } + interface TextMetrics { + /** 文本的宽度 */ + width: number + } + interface ToScreenLocationOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ToScreenLocationCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ToScreenLocationFailCallback + /** 接口调用成功的回调函数 */ + success?: ToScreenLocationSuccessCallback + } + interface ToScreenLocationSuccessCallbackResult { + /** x 坐标值 */ + x: number + /** y 坐标值 */ + y: number + errMsg: string + } + interface ToggleTorchOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ToggleTorchCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: ToggleTorchFailCallback + /** 接口调用成功的回调函数 */ + success?: ToggleTorchSuccessCallback + } + interface TransceiveOption { + /** 需要传递的二进制数据 */ + data: ArrayBuffer + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: TransceiveCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: TransceiveFailCallback + /** 接口调用成功的回调函数 */ + success?: TransceiveSuccessCallback + } + interface TransceiveSuccessCallbackResult { + data: ArrayBuffer + errMsg: string + } + interface TranslateMarkerOption { + /** 移动过程中是否自动旋转 marker */ + autoRotate: boolean + /** 指定 marker 移动到的目标点 */ + destination: DestinationOption + /** 指定 marker */ + markerId: number + /** marker 的旋转角度 */ + rotate: number + /** 动画结束回调函数 */ + animationEnd?: (...args: any[]) => any + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: TranslateMarkerCompleteCallback + /** 动画持续时长,平移与旋转分别计算 */ + duration?: number + /** 接口调用失败的回调函数 */ + fail?: TranslateMarkerFailCallback + /** 平移和旋转同时进行 + * + * 最低基础库: `2.13.0` */ + moveWithRotate?: boolean + /** 接口调用成功的回调函数 */ + success?: TranslateMarkerSuccessCallback + } + interface UDPSocketOnErrorCallbackResult { + /** 错误信息 */ + errMsg: string + } + interface UDPSocketOnMessageCallbackResult { + /** 收到的消息 */ + message: ArrayBuffer + /** 消息来源的结构化信息 */ + remoteInfo: RemoteInfo + } + interface UDPSocketSendOption { + /** 要发消息的地址。在基础库 2.9.3 及之前版本可以是一个和本机同网段的 IP 地址,也可以是在安全域名列表内的域名地址;在基础库 2.9.4 及之后版本,可以是任意 IP 和域名 */ + address: string + /** 要发送的数据 */ + message: string | ArrayBuffer + /** 要发送消息的端口号 */ + port: number + /** 发送数据的长度,仅当 message 为 ArrayBuffer 类型时有效 */ + length?: number + /** 发送数据的偏移量,仅当 message 为 ArrayBuffer 类型时有效 */ + offset?: number + } + interface UndoOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: UndoCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: UndoFailCallback + /** 接口调用成功的回调函数 */ + success?: UndoSuccessCallback + } + interface UnlinkFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail permission denied, open ${path}': 指定的 path 路径没有读权限; + * - 'fail no such file or directory ${path}': 文件不存在; + * - 'fail operation not permitted, unlink ${filePath}': 传入的 filePath 是一个目录; + * - 'fail sdcard not mounted': Android sdcard 挂载失败; */ + errMsg: string + } + interface UnlinkOption { + /** 要删除的文件路径 (本地路径) */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: UnlinkCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: UnlinkFailCallback + /** 接口调用成功的回调函数 */ + success?: UnlinkSuccessCallback + } + interface UnzipFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail permission denied, unzip ${zipFilePath} -> ${destPath}': 指定目标文件路径没有写权限; + * - 'fail no such file or directory, unzip ${zipFilePath} -> "${destPath}': 源文件不存在,或目标文件路径的上层目录不存在; */ + errMsg: string + } + interface UnzipOption { + /** 目标目录路径, 支持本地路径 */ + targetPath: string + /** 源文件路径,支持本地路径, 只可以是 zip 压缩文件 */ + zipFilePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: UnzipCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: UnzipFailCallback + /** 接口调用成功的回调函数 */ + success?: UnzipSuccessCallback + } + /** 参数列表 */ + interface UpdatableMessageFrontEndParameter { + /** 参数名 */ + name: string + /** 参数值 */ + value: string + } + /** 动态消息的模板信息 + * + * 最低基础库: `2.4.0` */ + interface UpdatableMessageFrontEndTemplateInfo { + /** 参数列表 */ + parameterList: UpdatableMessageFrontEndParameter[] + } + interface UpdateGroundOverlayOption { + /** 图片覆盖的经纬度范围 */ + bounds: MapBounds + /** 图片图层 id */ + id: string + /** 图片路径,支持网络图片、临时路径、代码包路径 */ + src: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: UpdateGroundOverlayCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: UpdateGroundOverlayFailCallback + /** 图层透明度 */ + opacity?: number + /** 接口调用成功的回调函数 */ + success?: UpdateGroundOverlaySuccessCallback + /** 是否可见 */ + visible?: boolean + /** 图层绘制顺序 */ + zIndex?: number + } + interface UpdateShareMenuOption { + /** 动态消息的 activityId。通过 [updatableMessage.createActivityId](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/updatable-message/updatableMessage.createActivityId.html) 接口获取 + * + * 最低基础库: `2.4.0` */ + activityId?: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: UpdateShareMenuCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: UpdateShareMenuFailCallback + /** 是否是私密消息。详见 [小程序私密消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share/private-message.html) + * + * 最低基础库: `2.13.0` */ + isPrivateMessage?: boolean + /** 是否是动态消息,详见[动态消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share/updatable-message.html) + * + * 最低基础库: `2.4.0` */ + isUpdatableMessage?: boolean + /** 接口调用成功的回调函数 */ + success?: UpdateShareMenuSuccessCallback + /** 动态消息的模板信息 + * + * 最低基础库: `2.4.0` */ + templateInfo?: UpdatableMessageFrontEndTemplateInfo + /** 群待办消息的id,通过toDoActivityId可以把多个群待办消息聚合为同一个。通过 [updatableMessage.createActivityId](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/updatable-message/updatableMessage.createActivityId.html) 接口获取。详见[群待办消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) + * + * 最低基础库: `2.11.0` */ + toDoActivityId?: string + /** 是否使用带 shareTicket 的转发[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */ + withShareTicket?: boolean + } + interface UpdateVoIPChatMuteConfigOption { + /** 静音设置 */ + muteConfig: MuteConfig + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: UpdateVoIPChatMuteConfigCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: UpdateVoIPChatMuteConfigFailCallback + /** 接口调用成功的回调函数 */ + success?: UpdateVoIPChatMuteConfigSuccessCallback + } + interface UpdateWeChatAppOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: UpdateWeChatAppCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: UpdateWeChatAppFailCallback + /** 接口调用成功的回调函数 */ + success?: UpdateWeChatAppSuccessCallback + } + interface UploadFileOption { + /** 要上传文件资源的路径 (本地路径) */ + filePath: string + /** 文件对应的 key,开发者在服务端可以通过这个 key 获取文件的二进制内容 */ + name: string + /** 开发者服务器地址 */ + url: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: UploadFileCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: UploadFileFailCallback + /** HTTP 请求中其他额外的 form data */ + formData?: IAnyObject + /** HTTP 请求 Header,Header 中不能设置 Referer */ + header?: IAnyObject + /** 接口调用成功的回调函数 */ + success?: UploadFileSuccessCallback + /** 超时时间,单位为毫秒 + * + * 最低基础库: `2.10.0` */ + timeout?: number + } + interface UploadFileSuccessCallbackResult { + /** 开发者服务器返回的数据 */ + data: string + /** 开发者服务器返回的 HTTP 状态码 */ + statusCode: number + errMsg: string + } + interface UploadTaskOnProgressUpdateCallbackResult { + /** 上传进度百分比 */ + progress: number + /** 预期需要上传的数据总长度,单位 Bytes */ + totalBytesExpectedToSend: number + /** 已经上传的数据长度,单位 Bytes */ + totalBytesSent: number + } + /** 用户信息 */ + interface UserInfo { + /** 用户头像图片的 URL。URL 最后一个数值代表正方形头像大小(有 0、46、64、96、132 数值可选,0 代表 640x640 的正方形头像,46 表示 46x46 的正方形头像,剩余数值以此类推。默认132),用户没有头像时该项为空。若用户更换头像,原有头像 URL 将失效。 */ + avatarUrl: string + /** 用户所在城市 */ + city: string + /** 用户所在国家 */ + country: string + /** 用户性别 + * + * 可选值: + * - 0: 未知; + * - 1: 男性; + * - 2: 女性; */ + gender: 0 | 1 | 2 + /** 显示 country,province,city 所用的语言 + * + * 可选值: + * - 'en': 英文; + * - 'zh_CN': 简体中文; + * - 'zh_TW': 繁体中文; */ + language: 'en' | 'zh_CN' | 'zh_TW' + /** 用户昵称 */ + nickName: string + /** 用户所在省份 */ + province: string + } + interface VibrateLongOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: VibrateLongCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: VibrateLongFailCallback + /** 接口调用成功的回调函数 */ + success?: VibrateLongSuccessCallback + } + interface VibrateShortOption { + /** 震动强度类型,有效值为:heavy、medium、light + * + * 最低基础库: `2.13.0` */ + type: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: VibrateShortCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: VibrateShortFailCallback + /** 接口调用成功的回调函数 */ + success?: VibrateShortSuccessCallback + } + interface VideoContextRequestFullScreenOption { + /** 设置全屏时视频的方向,不指定则根据宽高比自动判断。 + * + * 可选值: + * - 0: 正常竖向; + * - 90: 屏幕逆时针90度; + * - -90: 屏幕顺时针90度; + * + * 最低基础库: `1.7.0` */ + direction?: 0 | 90 | -90 + } + interface VideoDecoderStartOption { + /** 需要解码的视频源文件。基础库 2.13.0 以下的版本只支持本地路径。 2.13.0 开始支持 http:// 和 https:// 协议的远程路径。 */ + source: string + /** 解码模式。0:按 pts 解码;1:以最快速度解码 */ + mode?: number + } + /** 提供预设的 Wi-Fi 信息列表 */ + interface WifiData { + /** Wi-Fi 的 BSSID */ + BSSID?: string + /** Wi-Fi 的 SSID */ + SSID?: string + /** Wi-Fi 设备密码 */ + password?: string + } + /** Wifi 信息 */ + interface WifiInfo { + /** Wi-Fi 的 BSSID */ + BSSID: string + /** Wi-Fi 的 SSID */ + SSID: string + /** Wi-Fi 频段单位 MHz + * + * 最低基础库: `2.12.0` */ + frequency: number + /** Wi-Fi 是否安全 */ + secure: boolean + /** Wi-Fi 信号强度 */ + signalStrength: number + } + interface WorkerOnMessageCallbackResult { + /** 主线程/Worker 线程向当前线程发送的消息 */ + message: IAnyObject + } + interface WriteBLECharacteristicValueOption { + /** 蓝牙特征值的 uuid */ + characteristicId: string + /** 蓝牙设备 id */ + deviceId: string + /** 蓝牙特征值对应服务的 uuid */ + serviceId: string + /** 蓝牙设备特征值对应的二进制值 */ + value: ArrayBuffer + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: WriteBLECharacteristicValueCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: WriteBLECharacteristicValueFailCallback + /** 接口调用成功的回调函数 */ + success?: WriteBLECharacteristicValueSuccessCallback + } + interface WriteCharacteristicValueObject { + /** characteristic对应的uuid */ + characteristicId: string + /** 是否需要通知主机value已更新 */ + needNotify: boolean + /** service 的 uuid */ + serviceId: string + /** 特征值对应的二进制值 */ + value: ArrayBuffer + /** 可选,处理回包时使用 */ + callbackId?: number + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: WriteCharacteristicValueCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: WriteCharacteristicValueFailCallback + /** 接口调用成功的回调函数 */ + success?: WriteCharacteristicValueSuccessCallback + } + interface WriteFileFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 所在目录不存在; + * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限; + * - 'fail the maximum size of the file storage limit is exceeded': 存储空间不足; + * - 'fail sdcard not mounted': Android sdcard 挂载失败; */ + errMsg: string + } + interface WriteFileOption { + /** 要写入的文本或二进制数据 */ + data: string | ArrayBuffer + /** 要写入的文件路径 (本地路径) */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: WriteFileCompleteCallback + /** 指定写入文件的字符编码 + * + * 可选值: + * - 'ascii': ; + * - 'base64': ; + * - 'binary': ; + * - 'hex': ; + * - 'ucs2': 以小端序读取; + * - 'ucs-2': 以小端序读取; + * - 'utf16le': 以小端序读取; + * - 'utf-16le': 以小端序读取; + * - 'utf-8': ; + * - 'utf8': ; + * - 'latin1': ; */ + encoding?: + | 'ascii' + | 'base64' + | 'binary' + | 'hex' + | 'ucs2' + | 'ucs-2' + | 'utf16le' + | 'utf-16le' + | 'utf-8' + | 'utf8' + | 'latin1' + /** 接口调用失败的回调函数 */ + fail?: WriteFileFailCallback + /** 接口调用成功的回调函数 */ + success?: WriteFileSuccessCallback + } + interface WriteNdefMessageOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: WriteNdefMessageCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: WriteNdefMessageFailCallback + /** 二进制对象数组, 需要指明 id, type 以及 payload (均为 ArrayBuffer 类型) */ + records?: any[] + /** 接口调用成功的回调函数 */ + success?: WriteNdefMessageSuccessCallback + /** text 数组 */ + texts?: any[] + /** uri 数组 */ + uris?: any[] + } + interface WxGetFileInfoOption { + /** 本地文件路径 (本地路径) */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetFileInfoCompleteCallback + /** 计算文件摘要的算法 + * + * 可选值: + * - 'md5': md5 算法; + * - 'sha1': sha1 算法; */ + digestAlgorithm?: 'md5' | 'sha1' + /** 接口调用失败的回调函数 */ + fail?: WxGetFileInfoFailCallback + /** 接口调用成功的回调函数 */ + success?: WxGetFileInfoSuccessCallback + } + interface WxGetFileInfoSuccessCallbackResult { + /** 按照传入的 digestAlgorithm 计算得出的的文件摘要 */ + digest: string + /** 文件大小,以字节为单位 */ + size: number + errMsg: string + } + interface WxGetSavedFileListOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetSavedFileListCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: GetSavedFileListFailCallback + /** 接口调用成功的回调函数 */ + success?: WxGetSavedFileListSuccessCallback + } + interface WxGetSavedFileListSuccessCallbackResult { + /** 文件数组,每一项是一个 FileItem */ + fileList: FileItem[] + errMsg: string + } + interface WxRemoveSavedFileOption { + /** 需要删除的文件路径 (本地路径) */ + filePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RemoveSavedFileCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: WxRemoveSavedFileFailCallback + /** 接口调用成功的回调函数 */ + success?: RemoveSavedFileSuccessCallback + } + interface WxSaveFileOption { + /** 需要保存的文件的临时路径 (本地路径) */ + tempFilePath: string + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SaveFileCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: WxSaveFileFailCallback + /** 接口调用成功的回调函数 */ + success?: SaveFileSuccessCallback + } + interface WxStartRecordOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartRecordCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StartRecordFailCallback + /** 接口调用成功的回调函数 */ + success?: WxStartRecordSuccessCallback + } + interface WxStopRecordOption { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopRecordCompleteCallback + /** 接口调用失败的回调函数 */ + fail?: StopRecordFailCallback + /** 接口调用成功的回调函数 */ + success?: WxStopRecordSuccessCallback + } + interface Animation { + /** [Object Animation.export()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.export.html) + * + * 导出动画队列。**export 方法每次调用后会清掉之前的动画操作。** */ + export(): AnimationExportResult + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.backgroundColor(string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.backgroundColor.html) + * + * 设置背景色 */ + backgroundColor( + /** 颜色值 */ + value: string + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.bottom(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.bottom.html) + * + * 设置 bottom 值 */ + bottom( + /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */ + value: number | string + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.height(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.height.html) + * + * 设置高度 */ + height( + /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */ + value: number | string + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.left(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.left.html) + * + * 设置 left 值 */ + left( + /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */ + value: number | string + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.matrix()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.matrix.html) + * + * 同 [transform-function matrix](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix) */ + matrix(): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.matrix3d()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.matrix3d.html) + * + * 同 [transform-function matrix3d](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix3d) */ + matrix3d(): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.opacity(number value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.opacity.html) + * + * 设置透明度 */ + opacity( + /** 透明度,范围 0-1 */ + value: number + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.right(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.right.html) + * + * 设置 right 值 */ + right( + /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */ + value: number | string + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotate(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotate.html) + * + * 从原点顺时针旋转一个角度 */ + rotate( + /** 旋转的角度。范围 [-180, 180] */ + angle: number + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotate3d(number x, number y, number z, number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotate3d.html) + * + * 从 固定 轴顺时针旋转一个角度 */ + rotate3d( + /** 旋转轴的 x 坐标 */ + x: number, + /** 旋转轴的 y 坐标 */ + y: number, + /** 旋转轴的 z 坐标 */ + z: number, + /** 旋转的角度。范围 [-180, 180] */ + angle: number + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotateX(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotateX.html) + * + * 从 X 轴顺时针旋转一个角度 */ + rotateX( + /** 旋转的角度。范围 [-180, 180] */ + angle: number + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotateY(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotateY.html) + * + * 从 Y 轴顺时针旋转一个角度 */ + rotateY( + /** 旋转的角度。范围 [-180, 180] */ + angle: number + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotateZ(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotateZ.html) + * + * 从 Z 轴顺时针旋转一个角度 */ + rotateZ( + /** 旋转的角度。范围 [-180, 180] */ + angle: number + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scale(number sx, number sy)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scale.html) + * + * 缩放 */ + scale( + /** 当仅有 sx 参数时,表示在 X 轴、Y 轴同时缩放sx倍数 */ + sx: number, + /** 在 Y 轴缩放 sy 倍数 */ + sy?: number + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scale3d(number sx, number sy, number sz)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scale3d.html) + * + * 缩放 */ + scale3d( + /** x 轴的缩放倍数 */ + sx: number, + /** y 轴的缩放倍数 */ + sy: number, + /** z 轴的缩放倍数 */ + sz: number + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scaleX(number scale)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scaleX.html) + * + * 缩放 X 轴 */ + scaleX( + /** X 轴的缩放倍数 */ + scale: number + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scaleY(number scale)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scaleY.html) + * + * 缩放 Y 轴 */ + scaleY( + /** Y 轴的缩放倍数 */ + scale: number + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scaleZ(number scale)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scaleZ.html) + * + * 缩放 Z 轴 */ + scaleZ( + /** Z 轴的缩放倍数 */ + scale: number + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.skew(number ax, number ay)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.skew.html) + * + * 对 X、Y 轴坐标进行倾斜 */ + skew( + /** 对 X 轴坐标倾斜的角度,范围 [-180, 180] */ + ax: number, + /** 对 Y 轴坐标倾斜的角度,范围 [-180, 180] */ + ay: number + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.skewX(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.skewX.html) + * + * 对 X 轴坐标进行倾斜 */ + skewX( + /** 倾斜的角度,范围 [-180, 180] */ + angle: number + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.skewY(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.skewY.html) + * + * 对 Y 轴坐标进行倾斜 */ + skewY( + /** 倾斜的角度,范围 [-180, 180] */ + angle: number + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.step(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.step.html) + * + * 表示一组动画完成。可以在一组动画中调用任意多个动画方法,一组动画中的所有动画会同时开始,一组动画完成后才会进行下一组动画。 */ + step(option?: StepOption): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.top(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.top.html) + * + * 设置 top 值 */ + top( + /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */ + value: number | string + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translate(number tx, number ty)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translate.html) + * + * 平移变换 */ + translate( + /** 当仅有该参数时表示在 X 轴偏移 tx,单位 px */ + tx?: number, + /** 在 Y 轴平移的距离,单位为 px */ + ty?: number + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translate3d(number tx, number ty, number tz)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translate3d.html) + * + * 对 xyz 坐标进行平移变换 */ + translate3d( + /** 在 X 轴平移的距离,单位为 px */ + tx?: number, + /** 在 Y 轴平移的距离,单位为 px */ + ty?: number, + /** 在 Z 轴平移的距离,单位为 px */ + tz?: number + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translateX(number translation)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translateX.html) + * + * 对 X 轴平移 */ + translateX( + /** 在 X 轴平移的距离,单位为 px */ + translation: number + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translateY(number translation)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translateY.html) + * + * 对 Y 轴平移 */ + translateY( + /** 在 Y 轴平移的距离,单位为 px */ + translation: number + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translateZ(number translation)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translateZ.html) + * + * 对 Z 轴平移 */ + translateZ( + /** 在 Z 轴平移的距离,单位为 px */ + translation: number + ): Animation + /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.width(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.width.html) + * + * 设置宽度 */ + width( + /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */ + value: number | string + ): Animation + } + interface AudioContext { + /** [AudioContext.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.pause.html) + * + * 暂停音频。 */ + pause(): void + /** [AudioContext.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.play.html) + * + * 播放音频。 */ + play(): void + /** [AudioContext.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.seek.html) + * + * 跳转到指定位置。 */ + seek( + /** 跳转位置,单位 s */ + position: number + ): void + /** [AudioContext.setSrc(string src)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.setSrc.html) + * + * 设置音频地址 */ + setSrc( + /** 音频地址 */ + src: string + ): void + } + interface BLEPeripheralServer { + /** [BLEPeripheralServer.addService(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.addService.html) + * + * 添加服务。 + * + * 最低基础库: `2.10.3` */ + addService(option: AddServiceOption): void + /** [BLEPeripheralServer.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.close.html) + * + * 关闭当前服务端。 + * + * 最低基础库: `2.10.3` */ + close(option?: BLEPeripheralServerCloseOption): void + /** [BLEPeripheralServer.offCharacteristicReadRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicReadRequest.html) + * + * 取消监听已连接的设备请求读当前外围设备的特征值事件 + * + * 最低基础库: `2.10.3` */ + offCharacteristicReadRequest( + /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ + callback?: OffCharacteristicReadRequestCallback + ): void + /** [BLEPeripheralServer.offCharacteristicSubscribed(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicSubscribed.html) + * + * 取消监听特征值订阅事件 + * + * 最低基础库: `2.13.0` */ + offCharacteristicSubscribed( + /** 特征值订阅事件的回调函数 */ + callback?: OffCharacteristicSubscribedCallback + ): void + /** [BLEPeripheralServer.offCharacteristicUnsubscribed(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicUnsubscribed.html) + * + * 取消监听取消特征值订阅事件 + * + * 最低基础库: `2.13.0` */ + offCharacteristicUnsubscribed( + /** 取消特征值订阅事件的回调函数 */ + callback?: OffCharacteristicUnsubscribedCallback + ): void + /** [BLEPeripheralServer.offCharacteristicWriteRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicWriteRequest.html) + * + * 取消监听已连接的设备请求写当前外围设备的特征值事件 + * + * 最低基础库: `2.10.3` */ + offCharacteristicWriteRequest( + /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */ + callback?: OffCharacteristicWriteRequestCallback + ): void + /** [BLEPeripheralServer.onCharacteristicReadRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicReadRequest.html) + * + * 监听已连接的设备请求读当前外围设备的特征值事件。收到该消息后需要立刻调用 `writeCharacteristicValue` 写回数据,否则主机不会收到响应。 + * + * 最低基础库: `2.10.3` */ + onCharacteristicReadRequest( + /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */ + callback: OnCharacteristicReadRequestCallback + ): void + /** [BLEPeripheralServer.onCharacteristicSubscribed(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicSubscribed.html) + * + * 监听特征值订阅事件,仅 iOS 支持。 + * + * 最低基础库: `2.13.0` */ + onCharacteristicSubscribed( + /** 特征值订阅事件的回调函数 */ + callback: OnCharacteristicSubscribedCallback + ): void + /** [BLEPeripheralServer.onCharacteristicUnsubscribed(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicUnsubscribed.html) + * + * 监听取消特征值订阅事件,仅 iOS 支持。 + * + * 最低基础库: `2.13.0` */ + onCharacteristicUnsubscribed( + /** 取消特征值订阅事件的回调函数 */ + callback: OnCharacteristicUnsubscribedCallback + ): void + /** [BLEPeripheralServer.onCharacteristicWriteRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicWriteRequest.html) + * + * 监听已连接的设备请求写当前外围设备的特征值事件。收到该消息后需要立刻调用 `writeCharacteristicValue` 写回数据,否则主机不会收到响应。 + * + * 最低基础库: `2.10.3` */ + onCharacteristicWriteRequest( + /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */ + callback: OnCharacteristicWriteRequestCallback + ): void + /** [BLEPeripheralServer.removeService(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.removeService.html) + * + * 移除服务。 + * + * 最低基础库: `2.10.3` */ + removeService(option: RemoveServiceOption): void + /** [BLEPeripheralServer.startAdvertising(Object Object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.startAdvertising.html) + * + * 开始广播本地创建的外围设备。 + * + * 最低基础库: `2.10.3` */ + startAdvertising(Object: StartAdvertisingObject): void + /** [BLEPeripheralServer.stopAdvertising(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.stopAdvertising.html) + * + * 停止广播。 + * + * 最低基础库: `2.10.3` */ + stopAdvertising(option?: StopAdvertisingOption): void + /** [BLEPeripheralServer.writeCharacteristicValue(Object Object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html) + * + * 往指定特征值写入数据,并通知已连接的主机,从机的特征值已发生变化,该接口会处理是走回包还是走订阅。 + * + * 最低基础库: `2.10.3` */ + writeCharacteristicValue(Object: WriteCharacteristicValueObject): void + } + interface BackgroundAudioError { + /** 错误信息 + * + * | 错误码 | 错误信息 | 说明 | + * | - | - | - | + * | 10001 | | 系统错误 | + * | 10002 | | 网络错误 | + * | 10003 | | 文件错误,请检查是否responseheader是否缺少Content-Length | + * | 10004 | | 格式错误 | + * | -1 | | 未知错误 | */ errMsg: string + /** 错误码 + * + * | 错误码 | 错误信息 | 说明 | + * | - | - | - | + * | 10001 | | 系统错误 | + * | 10002 | | 网络错误 | + * | 10003 | | 文件错误,请检查是否responseheader是否缺少Content-Length | + * | 10004 | | 格式错误 | + * | -1 | | 未知错误 | */ errCode: number + } + interface BackgroundAudioManager { + /** [BackgroundAudioManager.onCanplay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onCanplay.html) + * + * 监听背景音频进入可播放状态事件。 但不保证后面可以流畅播放 */ + onCanplay( + /** 背景音频进入可播放状态事件的回调函数 */ + callback: OnCanplayCallback + ): void + /** [BackgroundAudioManager.onEnded(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onEnded.html) + * + * 监听背景音频自然播放结束事件 */ + onEnded( + /** 背景音频自然播放结束事件的回调函数 */ + callback: OnEndedCallback + ): void + /** [BackgroundAudioManager.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onError.html) + * + * 监听背景音频播放错误事件 */ + onError( + /** 背景音频播放错误事件的回调函数 */ + callback: BackgroundAudioManagerOnErrorCallback + ): void + /** [BackgroundAudioManager.onNext(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onNext.html) + * + * 监听用户在系统音乐播放面板点击下一曲事件(仅iOS) */ + onNext( + /** 用户在系统音乐播放面板点击下一曲事件的回调函数 */ + callback: OnNextCallback + ): void + /** [BackgroundAudioManager.onPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPause.html) + * + * 监听背景音频暂停事件 */ + onPause( + /** 背景音频暂停事件的回调函数 */ + callback: OnPauseCallback + ): void + /** [BackgroundAudioManager.onPlay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPlay.html) + * + * 监听背景音频播放事件 */ + onPlay( + /** 背景音频播放事件的回调函数 */ + callback: OnPlayCallback + ): void + /** [BackgroundAudioManager.onPrev(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPrev.html) + * + * 监听用户在系统音乐播放面板点击上一曲事件(仅iOS) */ + onPrev( + /** 用户在系统音乐播放面板点击上一曲事件的回调函数 */ + callback: OnPrevCallback + ): void + /** [BackgroundAudioManager.onSeeked(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onSeeked.html) + * + * 监听背景音频完成跳转操作事件 */ + onSeeked( + /** 背景音频完成跳转操作事件的回调函数 */ + callback: OnSeekedCallback + ): void + /** [BackgroundAudioManager.onSeeking(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onSeeking.html) + * + * 监听背景音频开始跳转操作事件 */ + onSeeking( + /** 背景音频开始跳转操作事件的回调函数 */ + callback: OnSeekingCallback + ): void + /** [BackgroundAudioManager.onStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onStop.html) + * + * 监听背景音频停止事件 */ + onStop( + /** 背景音频停止事件的回调函数 */ + callback: InnerAudioContextOnStopCallback + ): void + /** [BackgroundAudioManager.onTimeUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onTimeUpdate.html) + * + * 监听背景音频播放进度更新事件,只有小程序在前台时会回调。 */ + onTimeUpdate( + /** 背景音频播放进度更新事件的回调函数 */ + callback: OnTimeUpdateCallback + ): void + /** [BackgroundAudioManager.onWaiting(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onWaiting.html) + * + * 监听音频加载中事件。当音频因为数据不足,需要停下来加载时会触发 */ + onWaiting( + /** 音频加载中事件的回调函数 */ + callback: OnWaitingCallback + ): void + /** [BackgroundAudioManager.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.pause.html) + * + * 暂停音乐 */ + pause(): void + /** [BackgroundAudioManager.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.play.html) + * + * 播放音乐 */ + play(): void + /** [BackgroundAudioManager.seek(number currentTime)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.seek.html) + * + * 跳转到指定位置 */ + seek( + /** 跳转的位置,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */ + currentTime: number + ): void + /** [BackgroundAudioManager.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.stop.html) + * + * 停止音乐 */ + stop(): void + } + interface BluetoothError { + /** 错误信息 + * + * | 错误码 | 错误信息 | 说明 | + * | - | - | - | + * | 0 | ok | 正常 | + * | -1 | already connet | 已连接 | + * | 10000 | not init | 未初始化蓝牙适配器 | + * | 10001 | not available | 当前蓝牙适配器不可用 | + * | 10002 | no device | 没有找到指定设备 | + * | 10003 | connection fail | 连接失败 | + * | 10004 | no service | 没有找到指定服务 | + * | 10005 | no characteristic | 没有找到指定特征值 | + * | 10006 | no connection | 当前连接已断开 | + * | 10007 | property not support | 当前特征值不支持此操作 | + * | 10008 | system error | 其余所有系统上报的异常 | + * | 10009 | system not support | Android 系统特有,系统版本低于 4.3 不支持 BLE | + * | 10012 | operate time out | 连接超时 | + * | 10013 | invalid_data | 连接 deviceId 为空或者是格式不正确 | */ errMsg: string + /** 错误码 + * + * | 错误码 | 错误信息 | 说明 | + * | - | - | - | + * | 0 | ok | 正常 | + * | -1 | already connet | 已连接 | + * | 10000 | not init | 未初始化蓝牙适配器 | + * | 10001 | not available | 当前蓝牙适配器不可用 | + * | 10002 | no device | 没有找到指定设备 | + * | 10003 | connection fail | 连接失败 | + * | 10004 | no service | 没有找到指定服务 | + * | 10005 | no characteristic | 没有找到指定特征值 | + * | 10006 | no connection | 当前连接已断开 | + * | 10007 | property not support | 当前特征值不支持此操作 | + * | 10008 | system error | 其余所有系统上报的异常 | + * | 10009 | system not support | Android 系统特有,系统版本低于 4.3 不支持 BLE | + * | 10012 | operate time out | 连接超时 | + * | 10013 | invalid_data | 连接 deviceId 为空或者是格式不正确 | */ errCode: number + } + interface CameraContext { + /** [CameraContext.setZoom(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.setZoom.html) + * + * 设置缩放级别 + * + * 最低基础库: `2.10.0` */ + setZoom(option: SetZoomOption): void + /** [CameraContext.startRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.startRecord.html) + * + * 开始录像 */ + startRecord(option: CameraContextStartRecordOption): void + /** [CameraContext.stopRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.stopRecord.html) + * + * 结束录像 */ + stopRecord(option: CameraContextStopRecordOption): void + /** [CameraContext.takePhoto(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.takePhoto.html) + * + * 拍摄照片 */ + takePhoto(option: TakePhotoOption): void + /** [[CameraFrameListener](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.html) CameraContext.onCameraFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.onCameraFrame.html) +* +* 获取 Camera 实时帧数据 +* +* **** +* +* 注: 使用该接口需同时在 [camera](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html) 组件属性中指定 frame-size。 +* +* **示例代码** +* +* +* ```js +const context = wx.createCameraContext() +const listener = context.onCameraFrame((frame) => { + console.log(frame.data instanceof ArrayBuffer, frame.width, frame.height) +}) +listener.start() +``` +* +* 最低基础库: `2.7.0` */ + onCameraFrame( + /** 回调函数 */ + callback: OnCameraFrameCallback + ): CameraFrameListener + } + interface CameraFrameListener { + /** [CameraFrameListener.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.start.html) + * + * 开始监听帧数据 */ + start(option?: CameraFrameListenerStartOption): void + /** [CameraFrameListener.stop(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.stop.html) + * + * 停止监听帧数据 */ + stop(option?: StopOption): void + } + interface Canvas { + /** [Canvas.cancelAnimationFrame(number requestID)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.cancelAnimationFrame.html) + * + * 取消由 requestAnimationFrame 添加到计划中的动画帧请求。支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。 + * + * 最低基础库: `2.7.0` */ + cancelAnimationFrame(requestID: number): void + /** [[ImageData](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/ImageData.html) Canvas.createImageData()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createImageData.html) + * + * 创建一个 ImageData 对象。仅支持在 2D Canvas 中使用。 + * + * 最低基础库: `2.9.0` */ + createImageData(): ImageData + /** [[Image](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Image.html) Canvas.createImage()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createImage.html) + * + * 创建一个图片对象。 支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。 + * + * 最低基础库: `2.7.0` */ + createImage(): Image + /** [[Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html) Canvas.createPath2D([Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html) path)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createPath2D.html) + * + * 创建 Path2D 对象 + * + * 最低基础库: `2.11.0` */ + createPath2D( + /** [Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html) + * + * */ + path: Path2D + ): Path2D + /** [[RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) Canvas.getContext(string contextType)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.getContext.html) + * + * 该方法返回 Canvas 的绘图上下文 + * + * **** + * + * 支持获取 2D 和 WebGL 绘图上下文 + * + * 最低基础库: `2.7.0` */ + getContext(contextType: string): any + /** [number Canvas.requestAnimationFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.requestAnimationFrame.html) + * + * 在下次进行重绘时执行。 支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。 + * + * 最低基础库: `2.7.0` */ + requestAnimationFrame( + /** 执行的 callback */ + callback: (...args: any[]) => any + ): number + /** [string Canvas.toDataURL(string type, number encoderOptions)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.toDataURL.html) + * + * 返回一个包含图片展示的 data URI 。可以使用 type 参数其类型,默认为 PNG 格式。 + * + * 最低基础库: `2.11.0` */ + toDataURL( + /** 图片格式,默认为 image/png */ + type: string, + /** 在指定图片格式为 image/jpeg 或 image/webp的情况下,可以从 0 到 1 的区间内选择图片的质量。如果超出取值范围,将会使用默认值 0.92。其他参数会被忽略。 */ + encoderOptions: number + ): string + } + interface CanvasContext { + /** [CanvasContext.arc(number x, number y, number r, number sAngle, number eAngle, boolean counterclockwise)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.arc.html) +* +* 创建一条弧线。 +* +* - 创建一个圆可以指定起始弧度为 0,终止弧度为 2 * Math.PI。 +* - 用 `stroke` 或者 `fill` 方法来在 `canvas` 中画弧线。 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +// Draw coordinates +ctx.arc(100, 75, 50, 0, 2 * Math.PI) +ctx.setFillStyle('#EEEEEE') +ctx.fill() + +ctx.beginPath() +ctx.moveTo(40, 75) +ctx.lineTo(160, 75) +ctx.moveTo(100, 15) +ctx.lineTo(100, 135) +ctx.setStrokeStyle('#AAAAAA') +ctx.stroke() + +ctx.setFontSize(12) +ctx.setFillStyle('black') +ctx.fillText('0', 165, 78) +ctx.fillText('0.5*PI', 83, 145) +ctx.fillText('1*PI', 15, 78) +ctx.fillText('1.5*PI', 83, 10) + +// Draw points +ctx.beginPath() +ctx.arc(100, 75, 2, 0, 2 * Math.PI) +ctx.setFillStyle('lightgreen') +ctx.fill() + +ctx.beginPath() +ctx.arc(100, 25, 2, 0, 2 * Math.PI) +ctx.setFillStyle('blue') +ctx.fill() + +ctx.beginPath() +ctx.arc(150, 75, 2, 0, 2 * Math.PI) +ctx.setFillStyle('red') +ctx.fill() + +// Draw arc +ctx.beginPath() +ctx.arc(100, 75, 50, 0, 1.5 * Math.PI) +ctx.setStrokeStyle('#333333') +ctx.stroke() + +ctx.draw() +``` +* +* ![](@program/dev/image/canvas/arc.png) +* +* 针对 arc(100, 75, 50, 0, 1.5 * Math.PI)的三个关键坐标如下: +* +* - 绿色: 圆心 (100, 75) +* - 红色: 起始弧度 (0) +* - 蓝色: 终止弧度 (1.5 * Math.PI) */ + arc( + /** 圆心的 x 坐标 */ + x: number, + /** 圆心的 y 坐标 */ + y: number, + /** 圆的半径 */ + r: number, + /** 起始弧度,单位弧度(在3点钟方向) */ + sAngle: number, + /** 终止弧度 */ + eAngle: number, + /** 弧度的方向是否是逆时针 */ + counterclockwise?: boolean + ): void + /** [CanvasContext.arcTo(number x1, number y1, number x2, number y2, number radius)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.arcTo.html) + * + * 根据控制点和半径绘制圆弧路径。 + * + * 最低基础库: `1.9.90` */ + arcTo( + /** 第一个控制点的 x 轴坐标 */ + x1: number, + /** 第一个控制点的 y 轴坐标 */ + y1: number, + /** 第二个控制点的 x 轴坐标 */ + x2: number, + /** 第二个控制点的 y 轴坐标 */ + y2: number, + /** 圆弧的半径 */ + radius: number + ): void + /** [CanvasContext.beginPath()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.beginPath.html) +* +* 开始创建一个路径。需要调用 `fill` 或者 `stroke` 才会使用路径进行填充或描边 +* +* - 在最开始的时候相当于调用了一次 `beginPath`。 +* - 同一个路径内的多次 `setFillStyle`、`setStrokeStyle`、`setLineWidth`等设置,以最后一次设置为准。 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') +// begin path +ctx.rect(10, 10, 100, 30) +ctx.setFillStyle('yellow') +ctx.fill() + +// begin another path +ctx.beginPath() +ctx.rect(10, 40, 100, 30) + +// only fill this rect, not in current path +ctx.setFillStyle('blue') +ctx.fillRect(10, 70, 100, 30) + +ctx.rect(10, 100, 100, 30) + +// it will fill current path +ctx.setFillStyle('red') +ctx.fill() +ctx.draw() +``` +* +* ![](@program/dev/image/canvas/fill-path.png) */ + beginPath(): void + /** [CanvasContext.bezierCurveTo(number cp1x, number cp1y, number cp2x, number cp2y, number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.bezierCurveTo.html) +* +* 创建三次方贝塞尔曲线路径。曲线的起始点为路径中前一个点。 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +// Draw points +ctx.beginPath() +ctx.arc(20, 20, 2, 0, 2 * Math.PI) +ctx.setFillStyle('red') +ctx.fill() + +ctx.beginPath() +ctx.arc(200, 20, 2, 0, 2 * Math.PI) +ctx.setFillStyle('lightgreen') +ctx.fill() + +ctx.beginPath() +ctx.arc(20, 100, 2, 0, 2 * Math.PI) +ctx.arc(200, 100, 2, 0, 2 * Math.PI) +ctx.setFillStyle('blue') +ctx.fill() + +ctx.setFillStyle('black') +ctx.setFontSize(12) + +// Draw guides +ctx.beginPath() +ctx.moveTo(20, 20) +ctx.lineTo(20, 100) +ctx.lineTo(150, 75) + +ctx.moveTo(200, 20) +ctx.lineTo(200, 100) +ctx.lineTo(70, 75) +ctx.setStrokeStyle('#AAAAAA') +ctx.stroke() + +// Draw quadratic curve +ctx.beginPath() +ctx.moveTo(20, 20) +ctx.bezierCurveTo(20, 100, 200, 100, 200, 20) +ctx.setStrokeStyle('black') +ctx.stroke() + +ctx.draw() +``` +* +* ![](@program/dev/image/canvas/bezier-curve.png) +* +* 针对 moveTo(20, 20) bezierCurveTo(20, 100, 200, 100, 200, 20) 的三个关键坐标如下: +* +* - 红色:起始点(20, 20) +* - 蓝色:两个控制点(20, 100) (200, 100) +* - 绿色:终止点(200, 20) */ + bezierCurveTo( + /** 第一个贝塞尔控制点的 x 坐标 */ + cp1x: number, + /** 第一个贝塞尔控制点的 y 坐标 */ + cp1y: number, + /** 第二个贝塞尔控制点的 x 坐标 */ + cp2x: number, + /** 第二个贝塞尔控制点的 y 坐标 */ + cp2y: number, + /** 结束点的 x 坐标 */ + x: number, + /** 结束点的 y 坐标 */ + y: number + ): void + /** [CanvasContext.clearRect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.clearRect.html) +* +* 清除画布上在该矩形区域内的内容 +* +* **示例代码** +* +* +* clearRect 并非画一个白色的矩形在地址区域,而是清空,为了有直观感受,对 canvas 加了一层背景色。 +* ```html +* +* ``` +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') +ctx.setFillStyle('red') +ctx.fillRect(0, 0, 150, 200) +ctx.setFillStyle('blue') +ctx.fillRect(150, 0, 150, 200) +ctx.clearRect(10, 10, 150, 75) +ctx.draw() +``` +* ![](@program/dev/image/canvas/clear-rect.png) */ + clearRect( + /** 矩形路径左上角的横坐标 */ + x: number, + /** 矩形路径左上角的纵坐标 */ + y: number, + /** 矩形路径的宽度 */ + width: number, + /** 矩形路径的高度 */ + height: number + ): void + /** [CanvasContext.clip()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.clip.html) +* +* 从原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内(不能访问画布上的其他区域)。可以在使用 `clip` 方法前通过使用 `save` 方法对当前画布区域进行保存,并在以后的任意时间通过`restore`方法对其进行恢复。 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +wx.downloadFile({ + url: 'http://is5.mzstatic.com/image/thumb/Purple128/v4/75/3b/90/753b907c-b7fb-5877-215a-759bd73691a4/source/50x50bb.jpg', + success: function(res) { + ctx.save() + ctx.beginPath() + ctx.arc(50, 50, 25, 0, 2*Math.PI) + ctx.clip() + ctx.drawImage(res.tempFilePath, 25, 25) + ctx.restore() + ctx.draw() + } +}) +``` +* ![](@program/dev/image/canvas/clip.png) +* +* 最低基础库: `1.6.0` */ + clip(): void + /** [CanvasContext.closePath()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.closePath.html) +* +* 关闭一个路径。会连接起点和终点。如果关闭路径后没有调用 `fill` 或者 `stroke` 并开启了新的路径,那之前的路径将不会被渲染。 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') +ctx.moveTo(10, 10) +ctx.lineTo(100, 10) +ctx.lineTo(100, 100) +ctx.closePath() +ctx.stroke() +ctx.draw() +``` +* ![](@program/dev/image/canvas/close-line.png) +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') +// begin path +ctx.rect(10, 10, 100, 30) +ctx.closePath() + +// begin another path +ctx.beginPath() +ctx.rect(10, 40, 100, 30) + +// only fill this rect, not in current path +ctx.setFillStyle('blue') +ctx.fillRect(10, 70, 100, 30) + +ctx.rect(10, 100, 100, 30) + +// it will fill current path +ctx.setFillStyle('red') +ctx.fill() +ctx.draw() +``` +* +* ![](@program/dev/image/canvas/close-path.png) */ + closePath(): void + /** [CanvasContext.createPattern(string image, string repetition)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createPattern.html) + * + * 对指定的图像创建模式的方法,可在指定的方向上重复元图像 + * + * 最低基础库: `1.9.90` */ + createPattern( + /** 重复的图像源,支持代码包路径和本地临时路径 (本地路径) */ + image: string, + /** 如何重复图像 + * + * 参数 repetition 可选值: + * - 'repeat': 水平竖直方向都重复; + * - 'repeat-x': 水平方向重复; + * - 'repeat-y': 竖直方向重复; + * - 'no-repeat': 不重复; */ + repetition: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat' + ): void + /** [CanvasContext.draw(boolean reserve, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.draw.html) +* +* 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。 +* +* **示例代码** +* +* +* 第二次 draw() reserve 为 true。所以保留了上一次的绘制结果,在上下文设置的 fillStyle 'red' 也变成了默认的 'black'。 +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +ctx.setFillStyle('red') +ctx.fillRect(10, 10, 150, 100) +ctx.draw() +ctx.fillRect(50, 50, 150, 100) +ctx.draw(true) +``` +* ![](@program/dev/image/canvas/reserve.png) +* +* **示例代码** +* +* +* 第二次 draw() reserve 为 false。所以没有保留了上一次的绘制结果和在上下文设置的 fillStyle 'red'。 +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +ctx.setFillStyle('red') +ctx.fillRect(10, 10, 150, 100) +ctx.draw() +ctx.fillRect(50, 50, 150, 100) +ctx.draw() +``` +* ![](@program/dev/image/canvas/un-reserve.png) */ + draw( + /** 本次绘制是否接着上一次绘制。即 reserve 参数为 false,则在本次调用绘制之前 native 层会先清空画布再继续绘制;若 reserve 参数为 true,则保留当前画布上的内容,本次调用 drawCanvas 绘制的内容覆盖在上面,默认 false。 */ + reserve?: boolean, + /** 绘制完成后执行的回调函数 */ + callback?: (...args: any[]) => any + ): void + /** [CanvasContext.drawImage(string imageResource, number sx, number sy, number sWidth, number sHeight, number dx, number dy, number dWidth, number dHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html) +* +* 绘制图像到画布 +* +* **示例代码** +* +* +* +* 有三个版本的写法: +* +* - drawImage(imageResource, dx, dy) +* - drawImage(imageResource, dx, dy, dWidth, dHeight) +* - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持 +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +wx.chooseImage({ + success: function(res){ + ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100) + ctx.draw() + } +}) + +``` +* ![](@program/dev/image/canvas/draw-image.png) */ + drawImage( + /** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */ + imageResource: string, + /** imageResource的左上角在目标 canvas 上 x 轴的位置 */ + dx: number, + /** imageResource的左上角在目标 canvas 上 y 轴的位置 */ + dy: number + ): void + /** [CanvasContext.drawImage(string imageResource, number sx, number sy, number sWidth, number sHeight, number dx, number dy, number dWidth, number dHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html) +* +* 绘制图像到画布 +* +* **示例代码** +* +* +* +* 有三个版本的写法: +* +* - drawImage(imageResource, dx, dy) +* - drawImage(imageResource, dx, dy, dWidth, dHeight) +* - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持 +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +wx.chooseImage({ + success: function(res){ + ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100) + ctx.draw() + } +}) + +``` +* ![](@program/dev/image/canvas/draw-image.png) */ + drawImage( + /** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */ + imageResource: string, + /** imageResource的左上角在目标 canvas 上 x 轴的位置 */ + dx: number, + /** imageResource的左上角在目标 canvas 上 y 轴的位置 */ + dy: number, + /** 在目标画布上绘制imageResource的宽度,允许对绘制的imageResource进行缩放 */ + dWidth: number, + /** 在目标画布上绘制imageResource的高度,允许对绘制的imageResource进行缩放 */ + dHeight: number + ): void + /** [CanvasContext.drawImage(string imageResource, number sx, number sy, number sWidth, number sHeight, number dx, number dy, number dWidth, number dHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html) +* +* 绘制图像到画布 +* +* **示例代码** +* +* +* +* 有三个版本的写法: +* +* - drawImage(imageResource, dx, dy) +* - drawImage(imageResource, dx, dy, dWidth, dHeight) +* - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持 +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +wx.chooseImage({ + success: function(res){ + ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100) + ctx.draw() + } +}) + +``` +* ![](@program/dev/image/canvas/draw-image.png) */ + drawImage( + /** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */ + imageResource: string, + /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的左上角 x 坐标 */ + sx: number, + /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的左上角 y 坐标 */ + sy: number, + /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的宽度 */ + sWidth: number, + /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的高度 */ + sHeight: number, + /** imageResource的左上角在目标 canvas 上 x 轴的位置 */ + dx: number, + /** imageResource的左上角在目标 canvas 上 y 轴的位置 */ + dy: number, + /** 在目标画布上绘制imageResource的宽度,允许对绘制的imageResource进行缩放 */ + dWidth: number, + /** 在目标画布上绘制imageResource的高度,允许对绘制的imageResource进行缩放 */ + dHeight: number + ): void + /** [CanvasContext.fill()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fill.html) +* +* 对当前路径中的内容进行填充。默认的填充色为黑色。 +* +* **示例代码** +* +* +* +* 如果当前路径没有闭合,fill() 方法会将起点和终点进行连接,然后填充。 +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') +ctx.moveTo(10, 10) +ctx.lineTo(100, 10) +ctx.lineTo(100, 100) +ctx.fill() +ctx.draw() +``` +* +* fill() 填充的的路径是从 beginPath() 开始计算,但是不会将 fillRect() 包含进去。 +* +* ![](@program/dev/image/canvas/fill-line.png) +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') +// begin path +ctx.rect(10, 10, 100, 30) +ctx.setFillStyle('yellow') +ctx.fill() + +// begin another path +ctx.beginPath() +ctx.rect(10, 40, 100, 30) + +// only fill this rect, not in current path +ctx.setFillStyle('blue') +ctx.fillRect(10, 70, 100, 30) + +ctx.rect(10, 100, 100, 30) + +// it will fill current path +ctx.setFillStyle('red') +ctx.fill() +ctx.draw() +``` +* +* ![](@program/dev/image/canvas/fill-path.png) */ + fill(): void + /** [CanvasContext.fillRect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fillRect.html) +* +* 填充一个矩形。用 [`setFillStyle`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html) 设置矩形的填充色,如果没设置默认是黑色。 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') +ctx.setFillStyle('red') +ctx.fillRect(10, 10, 150, 75) +ctx.draw() +``` +* ![](@program/dev/image/canvas/fill-rect.png) */ + fillRect( + /** 矩形路径左上角的横坐标 */ + x: number, + /** 矩形路径左上角的纵坐标 */ + y: number, + /** 矩形路径的宽度 */ + width: number, + /** 矩形路径的高度 */ + height: number + ): void + /** [CanvasContext.fillText(string text, number x, number y, number maxWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fillText.html) +* +* 在画布上绘制被填充的文本 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +ctx.setFontSize(20) +ctx.fillText('Hello', 20, 20) +ctx.fillText('MINA', 100, 100) + +ctx.draw() +``` +* ![](@program/dev/image/canvas/text.png) */ + fillText( + /** 在画布上输出的文本 */ + text: string, + /** 绘制文本的左上角 x 坐标位置 */ + x: number, + /** 绘制文本的左上角 y 坐标位置 */ + y: number, + /** 需要绘制的最大宽度,可选 */ + maxWidth?: number + ): void + /** [CanvasContext.lineTo(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.lineTo.html) +* +* 增加一个新点,然后创建一条从上次指定点到目标点的线。用 `stroke` 方法来画线条 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') +ctx.moveTo(10, 10) +ctx.rect(10, 10, 100, 50) +ctx.lineTo(110, 60) +ctx.stroke() +ctx.draw() +``` +* ![](@program/dev/image/canvas/line-to.png) */ + lineTo( + /** 目标位置的 x 坐标 */ + x: number, + /** 目标位置的 y 坐标 */ + y: number + ): void + /** [CanvasContext.moveTo(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.moveTo.html) +* +* 把路径移动到画布中的指定点,不创建线条。用 `stroke` 方法来画线条 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') +ctx.moveTo(10, 10) +ctx.lineTo(100, 10) + +ctx.moveTo(10, 50) +ctx.lineTo(100, 50) +ctx.stroke() +ctx.draw() +``` +* ![](@program/dev/image/canvas/move-to.png) */ + moveTo( + /** 目标位置的 x 坐标 */ + x: number, + /** 目标位置的 y 坐标 */ + y: number + ): void + /** [CanvasContext.quadraticCurveTo(number cpx, number cpy, number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.quadraticCurveTo.html) +* +* 创建二次贝塞尔曲线路径。曲线的起始点为路径中前一个点。 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +// Draw points +ctx.beginPath() +ctx.arc(20, 20, 2, 0, 2 * Math.PI) +ctx.setFillStyle('red') +ctx.fill() + +ctx.beginPath() +ctx.arc(200, 20, 2, 0, 2 * Math.PI) +ctx.setFillStyle('lightgreen') +ctx.fill() + +ctx.beginPath() +ctx.arc(20, 100, 2, 0, 2 * Math.PI) +ctx.setFillStyle('blue') +ctx.fill() + +ctx.setFillStyle('black') +ctx.setFontSize(12) + +// Draw guides +ctx.beginPath() +ctx.moveTo(20, 20) +ctx.lineTo(20, 100) +ctx.lineTo(200, 20) +ctx.setStrokeStyle('#AAAAAA') +ctx.stroke() + +// Draw quadratic curve +ctx.beginPath() +ctx.moveTo(20, 20) +ctx.quadraticCurveTo(20, 100, 200, 20) +ctx.setStrokeStyle('black') +ctx.stroke() + +ctx.draw() +``` +* +* ![](@program/dev/image/canvas/quadratic-curve-to.png) +* +* 针对 moveTo(20, 20) quadraticCurveTo(20, 100, 200, 20) 的三个关键坐标如下: +* +* - 红色:起始点(20, 20) +* - 蓝色:控制点(20, 100) +* - 绿色:终止点(200, 20) */ + quadraticCurveTo( + /** 贝塞尔控制点的 x 坐标 */ + cpx: number, + /** 贝塞尔控制点的 y 坐标 */ + cpy: number, + /** 结束点的 x 坐标 */ + x: number, + /** 结束点的 y 坐标 */ + y: number + ): void + /** [CanvasContext.rect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.rect.html) +* +* 创建一个矩形路径。需要用 [`fill`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fill.html) 或者 [`stroke`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.stroke.html) 方法将矩形真正的画到 `canvas` 中 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') +ctx.rect(10, 10, 150, 75) +ctx.setFillStyle('red') +ctx.fill() +ctx.draw() +``` +* ![](@program/dev/image/canvas/fill-rect.png) */ + rect( + /** 矩形路径左上角的横坐标 */ + x: number, + /** 矩形路径左上角的纵坐标 */ + y: number, + /** 矩形路径的宽度 */ + width: number, + /** 矩形路径的高度 */ + height: number + ): void + /** [CanvasContext.restore()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.restore.html) +* +* 恢复之前保存的绘图上下文。 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +// save the default fill style +ctx.save() +ctx.setFillStyle('red') +ctx.fillRect(10, 10, 150, 100) + +// restore to the previous saved state +ctx.restore() +ctx.fillRect(50, 50, 150, 100) + +ctx.draw() +``` +* ![](@program/dev/image/canvas/save-restore.png) */ + restore(): void + /** [CanvasContext.rotate(number rotate)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.rotate.html) +* +* 以原点为中心顺时针旋转当前坐标轴。多次调用旋转的角度会叠加。原点可以用 `translate` 方法修改。 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +ctx.strokeRect(100, 10, 150, 100) +ctx.rotate(20 * Math.PI / 180) +ctx.strokeRect(100, 10, 150, 100) +ctx.rotate(20 * Math.PI / 180) +ctx.strokeRect(100, 10, 150, 100) + +ctx.draw() +``` +* ![](@program/dev/image/canvas/rotate.png) */ + rotate( + /** 旋转角度,以弧度计 degrees * Math.PI/180;degrees 范围为 0-360 */ + rotate: number + ): void + /** [CanvasContext.save()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.save.html) +* +* 保存绘图上下文。 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +// save the default fill style +ctx.save() +ctx.setFillStyle('red') +ctx.fillRect(10, 10, 150, 100) + +// restore to the previous saved state +ctx.restore() +ctx.fillRect(50, 50, 150, 100) + +ctx.draw() +``` +* ![](@program/dev/image/canvas/save-restore.png) */ + save(): void + /** [CanvasContext.scale(number scaleWidth, number scaleHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.scale.html) +* +* 在调用后,之后创建的路径其横纵坐标会被缩放。多次调用倍数会相乘。 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +ctx.strokeRect(10, 10, 25, 15) +ctx.scale(2, 2) +ctx.strokeRect(10, 10, 25, 15) +ctx.scale(2, 2) +ctx.strokeRect(10, 10, 25, 15) + +ctx.draw() +``` +* ![](@program/dev/image/canvas/scale.png) */ + scale( + /** 横坐标缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%) */ + scaleWidth: number, + /** 纵坐标轴缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%) */ + scaleHeight: number + ): void + /** [CanvasContext.setFillStyle(string|[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html) +* +* 设置填充色。 +* +* **代码示例** +* +* +* ```js +const ctx = wx.createCanvasContext('myCanvas') +ctx.setFillStyle('red') +ctx.fillRect(10, 10, 150, 75) +ctx.draw() +``` +* ![](@program/dev/image/canvas/fill-rect.png) +* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.fillStyle](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换 +* */ + setFillStyle( + /** 填充的颜色,默认颜色为 black。 */ + color: string | CanvasGradient + ): void + /** [CanvasContext.setFontSize(number fontSize)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFontSize.html) +* +* 设置字体的字号 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +ctx.setFontSize(20) +ctx.fillText('20', 20, 20) +ctx.setFontSize(30) +ctx.fillText('30', 40, 40) +ctx.setFontSize(40) +ctx.fillText('40', 60, 60) +ctx.setFontSize(50) +ctx.fillText('50', 90, 90) + +ctx.draw() +``` +* ![](@program/dev/image/canvas/font-size.png) +* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.font](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换 +* */ + setFontSize( + /** 字体的字号 */ + fontSize: number + ): void + /** [CanvasContext.setGlobalAlpha(number alpha)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setGlobalAlpha.html) +* +* 设置全局画笔透明度。 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +ctx.setFillStyle('red') +ctx.fillRect(10, 10, 150, 100) +ctx.setGlobalAlpha(0.2) +ctx.setFillStyle('blue') +ctx.fillRect(50, 50, 150, 100) +ctx.setFillStyle('yellow') +ctx.fillRect(100, 100, 150, 100) + +ctx.draw() +``` +* ![](@program/dev/image/canvas/global-alpha.png) +* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.globalAlpha](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换 +* */ + setGlobalAlpha( + /** 透明度。范围 0-1,0 表示完全透明,1 表示完全不透明。 */ + alpha: number + ): void + /** [CanvasContext.setLineCap(string lineCap)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineCap.html) +* +* 设置线条的端点样式 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') +ctx.beginPath() +ctx.moveTo(10, 10) +ctx.lineTo(150, 10) +ctx.stroke() + +ctx.beginPath() +ctx.setLineCap('butt') +ctx.setLineWidth(10) +ctx.moveTo(10, 30) +ctx.lineTo(150, 30) +ctx.stroke() + +ctx.beginPath() +ctx.setLineCap('round') +ctx.setLineWidth(10) +ctx.moveTo(10, 50) +ctx.lineTo(150, 50) +ctx.stroke() + +ctx.beginPath() +ctx.setLineCap('square') +ctx.setLineWidth(10) +ctx.moveTo(10, 70) +ctx.lineTo(150, 70) +ctx.stroke() + +ctx.draw() +``` +* ![](@program/dev/image/canvas/line-cap.png) +* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineCap](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换 +* */ + setLineCap( + /** 线条的结束端点样式 + * + * 参数 lineCap 可选值: + * - 'butt': 向线条的每个末端添加平直的边缘。; + * - 'round': 向线条的每个末端添加圆形线帽。; + * - 'square': 向线条的每个末端添加正方形线帽。; */ + lineCap: 'butt' | 'round' | 'square' + ): void + /** [CanvasContext.setLineDash(Array.<number> pattern, number offset)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineDash.html) +* +* 设置虚线样式。 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +ctx.setLineDash([10, 20], 5); + +ctx.beginPath(); +ctx.moveTo(0,100); +ctx.lineTo(400, 100); +ctx.stroke(); + +ctx.draw() +``` +* ![](@program/dev/image/canvas/set-line-dash.png) +* +* 最低基础库: `1.6.0` +* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineDashOffset](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换 +* */ + setLineDash( + /** 一组描述交替绘制线段和间距(坐标空间单位)长度的数字 */ + pattern: number[], + /** 虚线偏移量 */ + offset: number + ): void + /** [CanvasContext.setLineJoin(string lineJoin)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html) +* +* 设置线条的交点样式 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') +ctx.beginPath() +ctx.moveTo(10, 10) +ctx.lineTo(100, 50) +ctx.lineTo(10, 90) +ctx.stroke() + +ctx.beginPath() +ctx.setLineJoin('bevel') +ctx.setLineWidth(10) +ctx.moveTo(50, 10) +ctx.lineTo(140, 50) +ctx.lineTo(50, 90) +ctx.stroke() + +ctx.beginPath() +ctx.setLineJoin('round') +ctx.setLineWidth(10) +ctx.moveTo(90, 10) +ctx.lineTo(180, 50) +ctx.lineTo(90, 90) +ctx.stroke() + +ctx.beginPath() +ctx.setLineJoin('miter') +ctx.setLineWidth(10) +ctx.moveTo(130, 10) +ctx.lineTo(220, 50) +ctx.lineTo(130, 90) +ctx.stroke() + +ctx.draw() +``` +* ![](@program/dev/image/canvas/line-join.png) +* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineJoin](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换 +* */ + setLineJoin( + /** 线条的结束交点样式 + * + * 参数 lineJoin 可选值: + * - 'bevel': 斜角; + * - 'round': 圆角; + * - 'miter': 尖角; */ + lineJoin: 'bevel' | 'round' | 'miter' + ): void + /** [CanvasContext.setLineWidth(number lineWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineWidth.html) +* +* 设置线条的宽度 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') +ctx.beginPath() +ctx.moveTo(10, 10) +ctx.lineTo(150, 10) +ctx.stroke() + +ctx.beginPath() +ctx.setLineWidth(5) +ctx.moveTo(10, 30) +ctx.lineTo(150, 30) +ctx.stroke() + +ctx.beginPath() +ctx.setLineWidth(10) +ctx.moveTo(10, 50) +ctx.lineTo(150, 50) +ctx.stroke() + +ctx.beginPath() +ctx.setLineWidth(15) +ctx.moveTo(10, 70) +ctx.lineTo(150, 70) +ctx.stroke() + +ctx.draw() +``` +* +* ![](@program/dev/image/canvas/line-width.png) +* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineWidth](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换 +* */ + setLineWidth( + /** 线条的宽度,单位px */ + lineWidth: number + ): void + /** [CanvasContext.setMiterLimit(number miterLimit)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setMiterLimit.html) +* +* 设置最大斜接长度。斜接长度指的是在两条线交汇处内角和外角之间的距离。当 [CanvasContext.setLineJoin()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html) 为 miter 时才有效。超过最大倾斜长度的,连接处将以 lineJoin 为 bevel 来显示。 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') +ctx.beginPath() +ctx.setLineWidth(10) +ctx.setLineJoin('miter') +ctx.setMiterLimit(1) +ctx.moveTo(10, 10) +ctx.lineTo(100, 50) +ctx.lineTo(10, 90) +ctx.stroke() + +ctx.beginPath() +ctx.setLineWidth(10) +ctx.setLineJoin('miter') +ctx.setMiterLimit(2) +ctx.moveTo(50, 10) +ctx.lineTo(140, 50) +ctx.lineTo(50, 90) +ctx.stroke() + +ctx.beginPath() +ctx.setLineWidth(10) +ctx.setLineJoin('miter') +ctx.setMiterLimit(3) +ctx.moveTo(90, 10) +ctx.lineTo(180, 50) +ctx.lineTo(90, 90) +ctx.stroke() + +ctx.beginPath() +ctx.setLineWidth(10) +ctx.setLineJoin('miter') +ctx.setMiterLimit(4) +ctx.moveTo(130, 10) +ctx.lineTo(220, 50) +ctx.lineTo(130, 90) +ctx.stroke() + +ctx.draw() +``` +* ![](@program/dev/image/canvas/miter-limit.png) +* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.miterLimit](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换 +* */ + setMiterLimit( + /** 最大斜接长度 */ + miterLimit: number + ): void + /** [CanvasContext.setShadow(number offsetX, number offsetY, number blur, string color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setShadow.html) +* +* 设定阴影样式。 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') +ctx.setFillStyle('red') +ctx.setShadow(10, 50, 50, 'blue') +ctx.fillRect(10, 10, 150, 75) +ctx.draw() +``` +* ![](@program/dev/image/canvas/shadow.png) +* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.shadowOffsetX|CanvasContext.shadowOffsetY|CanvasContext.shadowColor|CanvasContext.shadowBlur](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换 +* */ + setShadow( + /** 阴影相对于形状在水平方向的偏移,默认值为 0。 */ + offsetX: number, + /** 阴影相对于形状在竖直方向的偏移,默认值为 0。 */ + offsetY: number, + /** 阴影的模糊级别,数值越大越模糊。范围 0- 100。,默认值为 0。 */ + blur: number, + /** 阴影的颜色。默认值为 black。 */ + color: string + ): void + /** [CanvasContext.setStrokeStyle(string|[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html) +* +* 设置描边颜色。 +* +* **代码示例** +* +* +* ```js +const ctx = wx.createCanvasContext('myCanvas') +ctx.setStrokeStyle('red') +ctx.strokeRect(10, 10, 150, 75) +ctx.draw() +``` +* ![](@program/dev/image/canvas/stroke-rect.png) +* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.strokeStyle](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换 +* */ + setStrokeStyle( + /** 描边的颜色,默认颜色为 black。 */ + color: string | CanvasGradient + ): void + /** [CanvasContext.setTextAlign(string align)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextAlign.html) +* +* 设置文字的对齐 +* +* **示例代码** +* +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +ctx.setStrokeStyle('red') +ctx.moveTo(150, 20) +ctx.lineTo(150, 170) +ctx.stroke() + +ctx.setFontSize(15) +ctx.setTextAlign('left') +ctx.fillText('textAlign=left', 150, 60) + +ctx.setTextAlign('center') +ctx.fillText('textAlign=center', 150, 80) + +ctx.setTextAlign('right') +ctx.fillText('textAlign=right', 150, 100) + +ctx.draw() +``` +* +* ![](@program/dev/image/canvas/set-text-align.png) +* +* 最低基础库: `1.1.0` */ + setTextAlign( + /** 文字的对齐方式 + * + * 参数 align 可选值: + * - 'left': 左对齐; + * - 'center': 居中对齐; + * - 'right': 右对齐; */ + align: 'left' | 'center' | 'right' + ): void + /** [CanvasContext.setTextBaseline(string textBaseline)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextBaseline.html) +* +* 设置文字的竖直对齐 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +ctx.setStrokeStyle('red') +ctx.moveTo(5, 75) +ctx.lineTo(295, 75) +ctx.stroke() + +ctx.setFontSize(20) + +ctx.setTextBaseline('top') +ctx.fillText('top', 5, 75) + +ctx.setTextBaseline('middle') +ctx.fillText('middle', 50, 75) + +ctx.setTextBaseline('bottom') +ctx.fillText('bottom', 120, 75) + +ctx.setTextBaseline('normal') +ctx.fillText('normal', 200, 75) + +ctx.draw() +``` +* ![](@program/dev/image/canvas/set-text-baseline.png) +* +* 最低基础库: `1.4.0` */ + setTextBaseline( + /** 文字的竖直对齐方式 + * + * 参数 textBaseline 可选值: + * - 'top': 顶部对齐; + * - 'bottom': 底部对齐; + * - 'middle': 居中对齐; + * - 'normal': ; */ + textBaseline: 'top' | 'bottom' | 'middle' | 'normal' + ): void + /** [CanvasContext.setTransform(number scaleX, number skewX, number skewY, number scaleY, number translateX, number translateY)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTransform.html) + * + * 使用矩阵重新设置(覆盖)当前变换的方法 + * + * 最低基础库: `1.9.90` */ + setTransform( + /** 水平缩放 */ + scaleX: number, + /** 水平倾斜 */ + skewX: number, + /** 垂直倾斜 */ + skewY: number, + /** 垂直缩放 */ + scaleY: number, + /** 水平移动 */ + translateX: number, + /** 垂直移动 */ + translateY: number + ): void + /** [CanvasContext.stroke()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.stroke.html) +* +* 画出当前路径的边框。默认颜色色为黑色。 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') +ctx.moveTo(10, 10) +ctx.lineTo(100, 10) +ctx.lineTo(100, 100) +ctx.stroke() +ctx.draw() +``` +* ![](@program/dev/image/canvas/stroke-line.png) +* +* stroke() 描绘的的路径是从 beginPath() 开始计算,但是不会将 strokeRect() 包含进去。 +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') +// begin path +ctx.rect(10, 10, 100, 30) +ctx.setStrokeStyle('yellow') +ctx.stroke() + +// begin another path +ctx.beginPath() +ctx.rect(10, 40, 100, 30) + +// only stoke this rect, not in current path +ctx.setStrokeStyle('blue') +ctx.strokeRect(10, 70, 100, 30) + +ctx.rect(10, 100, 100, 30) + +// it will stroke current path +ctx.setStrokeStyle('red') +ctx.stroke() +ctx.draw() +``` +* +* ![](@program/dev/image/canvas/stroke-path.png) */ + stroke(): void + /** [CanvasContext.strokeRect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.strokeRect.html) +* +* 画一个矩形(非填充)。 用 [`setStrokeStyle`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html) 设置矩形线条的颜色,如果没设置默认是黑色。 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') +ctx.setStrokeStyle('red') +ctx.strokeRect(10, 10, 150, 75) +ctx.draw() +``` +* ![](@program/dev/image/canvas/stroke-rect.png) */ + strokeRect( + /** 矩形路径左上角的横坐标 */ + x: number, + /** 矩形路径左上角的纵坐标 */ + y: number, + /** 矩形路径的宽度 */ + width: number, + /** 矩形路径的高度 */ + height: number + ): void + /** [CanvasContext.strokeText(string text, number x, number y, number maxWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.strokeText.html) + * + * 给定的 (x, y) 位置绘制文本描边的方法 + * + * 最低基础库: `1.9.90` */ + strokeText( + /** 要绘制的文本 */ + text: string, + /** 文本起始点的 x 轴坐标 */ + x: number, + /** 文本起始点的 y 轴坐标 */ + y: number, + /** 需要绘制的最大宽度,可选 */ + maxWidth?: number + ): void + /** [CanvasContext.transform(number scaleX, number skewX, number skewY, number scaleY, number translateX, number translateY)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.transform.html) + * + * 使用矩阵多次叠加当前变换的方法 + * + * 最低基础库: `1.9.90` */ + transform( + /** 水平缩放 */ + scaleX: number, + /** 水平倾斜 */ + skewX: number, + /** 垂直倾斜 */ + skewY: number, + /** 垂直缩放 */ + scaleY: number, + /** 水平移动 */ + translateX: number, + /** 垂直移动 */ + translateY: number + ): void + /** [CanvasContext.translate(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.translate.html) +* +* 对当前坐标系的原点 (0, 0) 进行变换。默认的坐标系原点为页面左上角。 +* +* **示例代码** +* +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +ctx.strokeRect(10, 10, 150, 100) +ctx.translate(20, 20) +ctx.strokeRect(10, 10, 150, 100) +ctx.translate(20, 20) +ctx.strokeRect(10, 10, 150, 100) + +ctx.draw() +``` +* +* ![](@program/dev/image/canvas/translate.png) */ + translate( + /** 水平坐标平移量 */ + x: number, + /** 竖直坐标平移量 */ + y: number + ): void + /** [Object CanvasContext.measureText(string text)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.measureText.html) + * + * 测量文本尺寸信息。目前仅返回文本宽度。同步接口。 + * + * 最低基础库: `1.9.90` */ + measureText( + /** 要测量的文本 */ + text: string + ): TextMetrics + /** [[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) CanvasContext.createCircularGradient(number x, number y, number r)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createCircularGradient.html) +* +* 创建一个圆形的渐变颜色。起点在圆心,终点在圆环。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html) 来指定渐变点,至少要两个。 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +// Create circular gradient +const grd = ctx.createCircularGradient(75, 50, 50) +grd.addColorStop(0, 'red') +grd.addColorStop(1, 'white') + +// Fill with gradient +ctx.setFillStyle(grd) +ctx.fillRect(10, 10, 150, 80) +ctx.draw() +``` +* ![](@program/dev/image/canvas/circular-gradient.png) */ + createCircularGradient( + /** 圆心的 x 坐标 */ + x: number, + /** 圆心的 y 坐标 */ + y: number, + /** 圆的半径 */ + r: number + ): CanvasGradient + /** [[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) CanvasContext.createLinearGradient(number x0, number y0, number x1, number y1)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createLinearGradient.html) +* +* 创建一个线性的渐变颜色。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html) 来指定渐变点,至少要两个。 +* +* **示例代码** +* +* +* ```javascript +const ctx = wx.createCanvasContext('myCanvas') + +// Create linear gradient +const grd = ctx.createLinearGradient(0, 0, 200, 0) +grd.addColorStop(0, 'red') +grd.addColorStop(1, 'white') + +// Fill with gradient +ctx.setFillStyle(grd) +ctx.fillRect(10, 10, 150, 80) +ctx.draw() +``` +* ![](@program/dev/image/canvas/linear-gradient.png) */ + createLinearGradient( + /** 起点的 x 坐标 */ + x0: number, + /** 起点的 y 坐标 */ + y0: number, + /** 终点的 x 坐标 */ + x1: number, + /** 终点的 y 坐标 */ + y1: number + ): CanvasGradient + } + interface CanvasGradient { + /** [CanvasGradient.addColorStop(number stop, string color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html) +* +* 添加颜色的渐变点。小于最小 stop 的部分会按最小 stop 的 color 来渲染,大于最大 stop 的部分会按最大 stop 的 color 来渲染 +* +* **示例代码** +* +* +* ```js +const ctx = wx.createCanvasContext('myCanvas') + +// Create circular gradient +const grd = ctx.createLinearGradient(30, 10, 120, 10) +grd.addColorStop(0, 'red') +grd.addColorStop(0.16, 'orange') +grd.addColorStop(0.33, 'yellow') +grd.addColorStop(0.5, 'green') +grd.addColorStop(0.66, 'cyan') +grd.addColorStop(0.83, 'blue') +grd.addColorStop(1, 'purple') + +// Fill with gradient +ctx.setFillStyle(grd) +ctx.fillRect(10, 10, 150, 80) +ctx.draw() +``` +* ![](@program/dev/image/canvas/color-stop.png) */ + addColorStop( + /** 表示渐变中开始与结束之间的位置,范围 0-1。 */ + stop: number, + /** 渐变点的颜色。 */ + color: string + ): void + } + interface Console { + /** [console.debug()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.debug.html) + * + * 向调试面板中打印 debug 日志 */ + debug( + /** 日志内容,可以有任意多个。 */ + ...args: any[] + ): void + /** [console.error()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.error.html) + * + * 向调试面板中打印 error 日志 */ + error( + /** 日志内容,可以有任意多个。 */ + ...args: any[] + ): void + /** [console.group(string label)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.group.html) + * + * 在调试面板中创建一个新的分组。随后输出的内容都会被添加一个缩进,表示该内容属于当前分组。调用 [console.groupEnd](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.groupEnd.html)之后分组结束。 + * + * **注意** + * + * + * 仅在工具中有效,在 vConsole 中为空函数实现。 */ + group( + /** 分组标记,可选。 */ + label?: string + ): void + /** [console.groupEnd()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.groupEnd.html) + * + * 结束由 [console.group](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.group.html) 创建的分组 + * + * **注意** + * + * + * 仅在工具中有效,在 vConsole 中为空函数实现。 */ + groupEnd(): void + /** [console.info()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.info.html) + * + * 向调试面板中打印 info 日志 */ + info( + /** 日志内容,可以有任意多个。 */ + ...args: any[] + ): void + /** [console.log()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.log.html) + * + * 向调试面板中打印 log 日志 */ + log( + /** 日志内容,可以有任意多个。 */ + ...args: any[] + ): void + /** [console.warn()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.warn.html) + * + * 向调试面板中打印 warn 日志 */ + warn( + /** 日志内容,可以有任意多个。 */ + ...args: any[] + ): void + } + interface DownloadTask { + /** [DownloadTask.abort()](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.abort.html) + * + * 中断下载任务 + * + * 最低基础库: `1.4.0` */ + abort(): void + /** [DownloadTask.offHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offHeadersReceived.html) + * + * 取消监听 HTTP Response Header 事件 + * + * 最低基础库: `2.1.0` */ + offHeadersReceived( + /** HTTP Response Header 事件的回调函数 */ + callback?: OffHeadersReceivedCallback + ): void + /** [DownloadTask.offProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offProgressUpdate.html) + * + * 取消监听下载进度变化事件 + * + * 最低基础库: `2.1.0` */ + offProgressUpdate( + /** 下载进度变化事件的回调函数 */ + callback?: DownloadTaskOffProgressUpdateCallback + ): void + /** [DownloadTask.onHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onHeadersReceived.html) + * + * 监听 HTTP Response Header 事件。会比请求完成事件更早 + * + * 最低基础库: `2.1.0` */ + onHeadersReceived( + /** HTTP Response Header 事件的回调函数 */ + callback: OnHeadersReceivedCallback + ): void + /** [DownloadTask.onProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onProgressUpdate.html) + * + * 监听下载进度变化事件 + * + * 最低基础库: `1.4.0` */ + onProgressUpdate( + /** 下载进度变化事件的回调函数 */ + callback: DownloadTaskOnProgressUpdateCallback + ): void + } + interface EditorContext { + /** [EditorContext.blur(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.blur.html) + * + * 编辑器失焦,同时收起键盘。 + * + * 最低基础库: `2.8.3` */ + blur(option?: BlurOption): void + /** [EditorContext.clear(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.clear.html) + * + * 清空编辑器内容 + * + * 最低基础库: `2.7.0` */ + clear(option?: ClearOption): void + /** [EditorContext.format(string name, string value)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.format.html) + * + * 修改样式 + * + * **** + * + * ## 支持设置的样式列表 + * | name | value | verson | + * | --------------------------------------------------------- | ------------------------------- | ------ | + * | bold | | 2.7.0 | + * | italic | | 2.7.0 | + * | underline | | 2.7.0 | + * | strike | | 2.7.0 | + * | ins | | 2.7.0 | + * | script | sub / super | 2.7.0 | + * | header | H1 / H2 / h3 / H4 / h5 / H6 | 2.7.0 | + * | align | left / center / right / justify | 2.7.0 | + * | direction | rtl | 2.7.0 | + * | indent | -1 / +1 | 2.7.0 | + * | list | ordered / bullet / check | 2.7.0 | + * | color | hex color | 2.7.0 | + * | backgroundColor | hex color | 2.7.0 | + * | margin/marginTop/marginBottom/marginLeft/marginRight | css style | 2.7.0 | + * | padding/paddingTop/paddingBottom/paddingLeft/paddingRight | css style | 2.7.0 | + * | font/fontSize/fontStyle/fontVariant/fontWeight/fontFamily | css style | 2.7.0 | + * | lineHeight | css style | 2.7.0 | + * | letterSpacing | css style | 2.7.0 | + * | textDecoration | css style | 2.7.0 | + * | textIndent | css style | 2.8.0 | + * | wordWrap | css style | 2.10.2 | + * | wordBreak | css style | 2.10.2 | + * | whiteSpace | css style | 2.10.2 | + * + * 对已经应用样式的选区设置会取消样式。css style 表示 css 中规定的允许值。 + * + * 最低基础库: `2.7.0` */ + format( + /** 属性 */ + name: string, + /** 值 */ + value?: string + ): void + /** [EditorContext.getContents(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getContents.html) + * + * 获取编辑器内容 + * + * 最低基础库: `2.7.0` */ + getContents(option?: GetContentsOption): void + /** [EditorContext.getSelectionText(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getSelectionText.html) + * + * 获取编辑器已选区域内的纯文本内容。当编辑器失焦或未选中一段区间时,返回内容为空。 + * + * 最低基础库: `2.10.2` */ + getSelectionText(option?: GetSelectionTextOption): void + /** [EditorContext.insertDivider(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertDivider.html) + * + * 插入分割线 + * + * 最低基础库: `2.7.0` */ + insertDivider(option?: InsertDividerOption): void + /** [EditorContext.insertImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertImage.html) +* +* 插入图片。 +* +* 地址为临时文件时,获取的编辑器html格式内容中 标签增加属性 data-local,delta 格式内容中图片 attributes 属性增加 data-local 字段,该值为传入的临时文件地址。 +* +* 开发者可选择在提交阶段上传图片到服务器,获取到网络地址后进行替换。替换时对于html内容应替换掉 的 src 值,对于 delta 内容应替换掉 `insert { image: abc }` 值。 +* +* **示例代码** +* +* +* ```javascript +this.editorCtx.insertImage({ + src: 'xx', + width: '100px', + height: '50px', + extClass: className +}) +``` +* +* 最低基础库: `2.7.0` */ + insertImage(option: InsertImageOption): void + /** [EditorContext.insertText(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertText.html) + * + * 覆盖当前选区,设置一段文本 + * + * 最低基础库: `2.7.0` */ + insertText(option: InsertTextOption): void + /** [EditorContext.redo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.redo.html) + * + * 恢复 + * + * 最低基础库: `2.7.0` */ + redo(option?: RedoOption): void + /** [EditorContext.removeFormat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.removeFormat.html) + * + * 清除当前选区的样式 + * + * 最低基础库: `2.7.0` */ + removeFormat(option?: RemoveFormatOption): void + /** [EditorContext.scrollIntoView()](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.scrollIntoView.html) + * + * 使得编辑器光标处滚动到窗口可视区域内。 + * + * 最低基础库: `2.8.3` */ + scrollIntoView(): void + /** [EditorContext.setContents(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.setContents.html) + * + * 初始化编辑器内容,html和delta同时存在时仅delta生效 + * + * 最低基础库: `2.7.0` */ + setContents(option: SetContentsOption): void + /** [EditorContext.undo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.undo.html) + * + * 撤销 + * + * 最低基础库: `2.7.0` */ + undo(option?: UndoOption): void + } + interface EntryList { + /** [Array EntryList.getEntries()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/EntryList.getEntries.html) + * + * 该方法返回当前列表中的所有性能数据 + * + * 最低基础库: `2.11.0` */ + getEntries(): any[] + /** [Array EntryList.getEntriesByName(string name, string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/EntryList.getEntriesByName.html) + * + * 获取当前列表中所有名称为 [name] 且类型为 [entryType] 的性能数据 + * + * 最低基础库: `2.11.0` */ + getEntriesByName(name: string, entryType?: string): any[] + /** [Array EntryList.getEntriesByType(string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/EntryList.getEntriesByType.html) + * + * 获取当前列表中所有类型为 [entryType] 的性能数据 + * + * 最低基础库: `2.11.0` */ + getEntriesByType(entryType: string): any[] + } + interface EventChannel { + /** [EventChannel.emit(string eventName, any args)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.emit.html) + * + * 触发一个事件 + * + * 最低基础库: `2.7.3` */ + emit( + /** 事件名称 */ + eventName: string, + /** 事件参数 */ + ...args: any + ): void + /** [EventChannel.off(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.off.html) + * + * 取消监听一个事件。给出第二个参数时,只取消给出的监听函数,否则取消所有监听函数 + * + * 最低基础库: `2.7.3` */ + off( + /** 事件名称 */ + eventName: string, + /** 事件监听函数 */ + fn: EventCallback + ): void + /** [EventChannel.on(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.on.html) + * + * 持续监听一个事件 + * + * 最低基础库: `2.7.3` */ + on( + /** 事件名称 */ + eventName: string, + /** 事件监听函数 */ + fn: EventCallback + ): void + /** [EventChannel.once(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.once.html) + * + * 监听一个事件一次,触发后失效 + * + * 最低基础库: `2.7.3` */ + once( + /** 事件名称 */ + eventName: string, + /** 事件监听函数 */ + fn: EventCallback + ): void + } + interface FileSystemManager { + /** [Array.<string> FileSystemManager.readdirSync(string dirPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdirSync.html) + * + * [FileSystemManager.readdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdir.html) 的同步版本 */ + readdirSync( + /** 要读取的目录路径 (本地路径) */ + dirPath: string + ): string[] + /** [FileSystemManager.access(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.access.html) + * + * 判断文件/目录是否存在 */ + access(option: AccessOption): void + /** [FileSystemManager.accessSync(string path)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.accessSync.html) + * + * [FileSystemManager.access](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.access.html) 的同步版本 */ + accessSync( + /** 要判断是否存在的文件/目录路径 (本地路径) */ + path: string + ): void + /** [FileSystemManager.appendFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFile.html) + * + * 在文件结尾追加内容 + * + * 最低基础库: `2.1.0` */ + appendFile(option: AppendFileOption): void + /** [FileSystemManager.appendFileSync(string filePath, string|ArrayBuffer data, string encoding)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFileSync.html) + * + * [FileSystemManager.appendFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFile.html) 的同步版本 + * + * 最低基础库: `2.1.0` */ + appendFileSync( + /** 要追加内容的文件路径 (本地路径) */ + filePath: string, + /** 要追加的文本或二进制数据 */ + data: string | ArrayBuffer, + /** 指定写入文件的字符编码 + * + * 参数 encoding 可选值: + * - 'ascii': ; + * - 'base64': ; + * - 'binary': ; + * - 'hex': ; + * - 'ucs2': 以小端序读取; + * - 'ucs-2': 以小端序读取; + * - 'utf16le': 以小端序读取; + * - 'utf-16le': 以小端序读取; + * - 'utf-8': ; + * - 'utf8': ; + * - 'latin1': ; */ + encoding?: + | 'ascii' + | 'base64' + | 'binary' + | 'hex' + | 'ucs2' + | 'ucs-2' + | 'utf16le' + | 'utf-16le' + | 'utf-8' + | 'utf8' + | 'latin1' + ): void + /** [FileSystemManager.copyFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFile.html) + * + * 复制文件 */ + copyFile(option: CopyFileOption): void + /** [FileSystemManager.copyFileSync(string srcPath, string destPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFileSync.html) + * + * [FileSystemManager.copyFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFile.html) 的同步版本 */ + copyFileSync( + /** 源文件路径,支持本地路径 */ + srcPath: string, + /** 目标文件路径,支持本地路径 */ + destPath: string + ): void + /** [FileSystemManager.getFileInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.getFileInfo.html) + * + * 获取该小程序下的 本地临时文件 或 本地缓存文件 信息 */ + getFileInfo(option: FileSystemManagerGetFileInfoOption): void + /** [FileSystemManager.getSavedFileList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.getSavedFileList.html) + * + * 获取该小程序下已保存的本地缓存文件列表 */ + getSavedFileList(option?: FileSystemManagerGetSavedFileListOption): void + /** [FileSystemManager.mkdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdir.html) + * + * 创建目录 */ + mkdir(option: MkdirOption): void + /** [FileSystemManager.mkdirSync(string dirPath, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdirSync.html) + * + * [FileSystemManager.mkdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdir.html) 的同步版本 */ + mkdirSync( + /** 创建的目录路径 (本地路径) */ + dirPath: string, + /** 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。 + * + * 最低基础库: `2.3.0` */ + recursive?: boolean + ): void + /** [FileSystemManager.readFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html) + * + * 读取本地文件内容 */ + readFile(option: ReadFileOption): void + /** [FileSystemManager.readdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdir.html) + * + * 读取目录内文件列表 */ + readdir(option: ReaddirOption): void + /** [FileSystemManager.removeSavedFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.removeSavedFile.html) + * + * 删除该小程序下已保存的本地缓存文件 */ + removeSavedFile(option: FileSystemManagerRemoveSavedFileOption): void + /** [FileSystemManager.rename(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rename.html) + * + * 重命名文件。可以把文件从 oldPath 移动到 newPath */ + rename(option: RenameOption): void + /** [FileSystemManager.renameSync(string oldPath, string newPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.renameSync.html) + * + * [FileSystemManager.rename](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rename.html) 的同步版本 */ + renameSync( + /** 源文件路径,支持本地路径 */ + oldPath: string, + /** 新文件路径,支持本地路径 */ + newPath: string + ): void + /** [FileSystemManager.rmdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdir.html) + * + * 删除目录 */ + rmdir(option: RmdirOption): void + /** [FileSystemManager.rmdirSync(string dirPath, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdirSync.html) + * + * [FileSystemManager.rmdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdir.html) 的同步版本 */ + rmdirSync( + /** 要删除的目录路径 (本地路径) */ + dirPath: string, + /** 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。 + * + * 最低基础库: `2.3.0` */ + recursive?: boolean + ): void + /** [FileSystemManager.saveFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFile.html) + * + * 保存临时文件到本地。此接口会移动临时文件,因此调用成功后,tempFilePath 将不可用。 */ + saveFile(option: FileSystemManagerSaveFileOption): void + /** [FileSystemManager.stat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.stat.html) + * + * 获取文件 Stats 对象 */ + stat(option: StatOption): void + /** [FileSystemManager.unlink(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlink.html) + * + * 删除文件 */ + unlink(option: UnlinkOption): void + /** [FileSystemManager.unlinkSync(string filePath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlinkSync.html) + * + * [FileSystemManager.unlink](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlink.html) 的同步版本 */ + unlinkSync( + /** 要删除的文件路径 (本地路径) */ + filePath: string + ): void + /** [FileSystemManager.unzip(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unzip.html) + * + * 解压文件 */ + unzip(option: UnzipOption): void + /** [FileSystemManager.writeFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFile.html) + * + * 写文件 */ + writeFile(option: WriteFileOption): void + /** [FileSystemManager.writeFileSync(string filePath, string|ArrayBuffer data, string encoding)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFileSync.html) + * + * [FileSystemManager.writeFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFile.html) 的同步版本 */ + writeFileSync( + /** 要写入的文件路径 (本地路径) */ + filePath: string, + /** 要写入的文本或二进制数据 */ + data: string | ArrayBuffer, + /** 指定写入文件的字符编码 + * + * 参数 encoding 可选值: + * - 'ascii': ; + * - 'base64': ; + * - 'binary': ; + * - 'hex': ; + * - 'ucs2': 以小端序读取; + * - 'ucs-2': 以小端序读取; + * - 'utf16le': 以小端序读取; + * - 'utf-16le': 以小端序读取; + * - 'utf-8': ; + * - 'utf8': ; + * - 'latin1': ; */ + encoding?: + | 'ascii' + | 'base64' + | 'binary' + | 'hex' + | 'ucs2' + | 'ucs-2' + | 'utf16le' + | 'utf-16le' + | 'utf-8' + | 'utf8' + | 'latin1' + ): void + /** [[Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)|Object FileSystemManager.statSync(string path, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.statSync.html) + * + * [FileSystemManager.stat](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.stat.html) 的同步版本 */ + statSync( + /** 文件/目录路径 (本地路径) */ + path: string, + /** 是否递归获取目录下的每个文件的 Stats 信息 + * + * 最低基础库: `2.3.0` */ + recursive?: boolean + ): Stats | IAnyObject + /** [string FileSystemManager.saveFileSync(string tempFilePath, string filePath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFileSync.html) + * + * [FileSystemManager.saveFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFile.html) 的同步版本 */ + saveFileSync( + /** 临时存储文件路径 (本地路径) */ + tempFilePath: string, + /** 要存储的文件路径 (本地路径) */ + filePath?: string + ): string + /** [string|ArrayBuffer FileSystemManager.readFileSync(string filePath, string encoding, number position, number length)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFileSync.html) + * + * [FileSystemManager.readFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html) 的同步版本 */ + readFileSync( + /** 要读取的文件的路径 (本地路径) */ + filePath: string, + /** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容 + * + * 参数 encoding 可选值: + * - 'ascii': ; + * - 'base64': ; + * - 'binary': ; + * - 'hex': ; + * - 'ucs2': 以小端序读取; + * - 'ucs-2': 以小端序读取; + * - 'utf16le': 以小端序读取; + * - 'utf-16le': 以小端序读取; + * - 'utf-8': ; + * - 'utf8': ; + * - 'latin1': ; */ + encoding?: + | 'ascii' + | 'base64' + | 'binary' + | 'hex' + | 'ucs2' + | 'ucs-2' + | 'utf16le' + | 'utf-16le' + | 'utf-8' + | 'utf8' + | 'latin1', + /** 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte + * + * 最低基础库: `2.10.0` */ + position?: number, + /** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte + * + * 最低基础库: `2.10.0` */ + length?: number + ): string | ArrayBuffer + } + interface GeneralCallbackResult { + errMsg: string + } + interface IBeaconError { + /** 错误信息 + * + * | 错误码 | 错误信息 | 说明 | + * | - | - | - | + * | 0 | ok | 正常 | + * | 11000 | unsupport | 系统或设备不支持 | + * | 11001 | bluetooth service unavailable | 蓝牙服务不可用 | + * | 11002 | location service unavailable | 位置服务不可用 | + * | 11003 | already start | 已经开始搜索 | + * | 11004 | not startBeaconDiscovery | 还未开始搜索 | + * | 11005 | system error | 系统错误 | + * | 11006 | invalid data | 参数不正确 | */ errMsg: string + /** 错误码 + * + * | 错误码 | 错误信息 | 说明 | + * | - | - | - | + * | 0 | ok | 正常 | + * | 11000 | unsupport | 系统或设备不支持 | + * | 11001 | bluetooth service unavailable | 蓝牙服务不可用 | + * | 11002 | location service unavailable | 位置服务不可用 | + * | 11003 | already start | 已经开始搜索 | + * | 11004 | not startBeaconDiscovery | 还未开始搜索 | + * | 11005 | system error | 系统错误 | + * | 11006 | invalid data | 参数不正确 | */ errCode: number + } + interface InnerAudioContext { + /** [InnerAudioContext.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.destroy.html) + * + * 销毁当前实例 */ + destroy(): void + /** [InnerAudioContext.offCanplay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offCanplay.html) + * + * 取消监听音频进入可以播放状态的事件 + * + * 最低基础库: `1.9.0` */ + offCanplay( + /** 音频进入可以播放状态的事件的回调函数 */ + callback?: OffCanplayCallback + ): void + /** [InnerAudioContext.offEnded(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offEnded.html) + * + * 取消监听音频自然播放至结束的事件 + * + * 最低基础库: `1.9.0` */ + offEnded( + /** 音频自然播放至结束的事件的回调函数 */ + callback?: OffEndedCallback + ): void + /** [InnerAudioContext.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offError.html) + * + * 取消监听音频播放错误事件 + * + * 最低基础库: `1.9.0` */ + offError( + /** 音频播放错误事件的回调函数 */ + callback?: InnerAudioContextOffErrorCallback + ): void + /** [InnerAudioContext.offPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offPause.html) + * + * 取消监听音频暂停事件 + * + * 最低基础库: `1.9.0` */ + offPause( + /** 音频暂停事件的回调函数 */ + callback?: OffPauseCallback + ): void + /** [InnerAudioContext.offPlay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offPlay.html) + * + * 取消监听音频播放事件 + * + * 最低基础库: `1.9.0` */ + offPlay( + /** 音频播放事件的回调函数 */ + callback?: OffPlayCallback + ): void + /** [InnerAudioContext.offSeeked(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offSeeked.html) + * + * 取消监听音频完成跳转操作的事件 + * + * 最低基础库: `1.9.0` */ + offSeeked( + /** 音频完成跳转操作的事件的回调函数 */ + callback?: OffSeekedCallback + ): void + /** [InnerAudioContext.offSeeking(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offSeeking.html) + * + * 取消监听音频进行跳转操作的事件 + * + * 最低基础库: `1.9.0` */ + offSeeking( + /** 音频进行跳转操作的事件的回调函数 */ + callback?: OffSeekingCallback + ): void + /** [InnerAudioContext.offStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offStop.html) + * + * 取消监听音频停止事件 + * + * 最低基础库: `1.9.0` */ + offStop( + /** 音频停止事件的回调函数 */ + callback?: OffStopCallback + ): void + /** [InnerAudioContext.offTimeUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offTimeUpdate.html) + * + * 取消监听音频播放进度更新事件 + * + * 最低基础库: `1.9.0` */ + offTimeUpdate( + /** 音频播放进度更新事件的回调函数 */ + callback?: OffTimeUpdateCallback + ): void + /** [InnerAudioContext.offWaiting(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offWaiting.html) + * + * 取消监听音频加载中事件 + * + * 最低基础库: `1.9.0` */ + offWaiting( + /** 音频加载中事件的回调函数 */ + callback?: OffWaitingCallback + ): void + /** [InnerAudioContext.onCanplay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onCanplay.html) + * + * 监听音频进入可以播放状态的事件。但不保证后面可以流畅播放 */ + onCanplay( + /** 音频进入可以播放状态的事件的回调函数 */ + callback: OnCanplayCallback + ): void + /** [InnerAudioContext.onEnded(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onEnded.html) + * + * 监听音频自然播放至结束的事件 */ + onEnded( + /** 音频自然播放至结束的事件的回调函数 */ + callback: OnEndedCallback + ): void + /** [InnerAudioContext.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onError.html) + * + * 监听音频播放错误事件 + * + * **Tips** + * + * + * 1. errCode=100001 时,如若 errMsg 中有 INNERCODE -11828 ,请先检查 response header 是否缺少 Content-Length + * 2. errCode=100001 时,如若 errMsg 中有 systemErrCode:200333420,请检查文件编码格式和 fileExtension 是否一致 */ + onError( + /** 音频播放错误事件的回调函数 */ + callback: InnerAudioContextOnErrorCallback + ): void + /** [InnerAudioContext.onPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onPause.html) + * + * 监听音频暂停事件 */ + onPause( + /** 音频暂停事件的回调函数 */ + callback: OnPauseCallback + ): void + /** [InnerAudioContext.onPlay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onPlay.html) + * + * 监听音频播放事件 */ + onPlay( + /** 音频播放事件的回调函数 */ + callback: OnPlayCallback + ): void + /** [InnerAudioContext.onSeeked(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onSeeked.html) + * + * 监听音频完成跳转操作的事件 */ + onSeeked( + /** 音频完成跳转操作的事件的回调函数 */ + callback: OnSeekedCallback + ): void + /** [InnerAudioContext.onSeeking(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onSeeking.html) + * + * 监听音频进行跳转操作的事件 */ + onSeeking( + /** 音频进行跳转操作的事件的回调函数 */ + callback: OnSeekingCallback + ): void + /** [InnerAudioContext.onStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onStop.html) + * + * 监听音频停止事件 */ + onStop( + /** 音频停止事件的回调函数 */ + callback: InnerAudioContextOnStopCallback + ): void + /** [InnerAudioContext.onTimeUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onTimeUpdate.html) + * + * 监听音频播放进度更新事件 */ + onTimeUpdate( + /** 音频播放进度更新事件的回调函数 */ + callback: OnTimeUpdateCallback + ): void + /** [InnerAudioContext.onWaiting(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onWaiting.html) + * + * 监听音频加载中事件。当音频因为数据不足,需要停下来加载时会触发 */ + onWaiting( + /** 音频加载中事件的回调函数 */ + callback: OnWaitingCallback + ): void + /** [InnerAudioContext.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.pause.html) + * + * 暂停。暂停后的音频再播放会从暂停处开始播放 */ + pause(): void + /** [InnerAudioContext.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.play.html) + * + * 播放 */ + play(): void + /** [InnerAudioContext.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.seek.html) + * + * 跳转到指定位置 */ + seek( + /** 跳转的时间,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */ + position: number + ): void + /** [InnerAudioContext.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.stop.html) + * + * 停止。停止后的音频再播放会从头开始播放。 */ + stop(): void + } + interface IntersectionObserver { + /** [IntersectionObserver.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.disconnect.html) + * + * 停止监听。回调函数将不再触发 */ + disconnect(): void + /** [IntersectionObserver.observe(string targetSelector, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.observe.html) + * + * 指定目标节点并开始监听相交状态变化情况 */ + observe( + /** 选择器 */ + targetSelector: string, + /** 监听相交状态变化的回调函数 */ + callback: IntersectionObserverObserveCallback + ): void + /** [[IntersectionObserver](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.html) IntersectionObserver.relativeTo(string selector, Object margins)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.relativeTo.html) + * + * 使用选择器指定一个节点,作为参照区域之一。 */ + relativeTo( + /** 选择器 */ + selector: string, + /** 用来扩展(或收缩)参照节点布局区域的边界 */ + margins?: Margins + ): IntersectionObserver + /** [[IntersectionObserver](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.html) IntersectionObserver.relativeToViewport(Object margins)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.relativeToViewport.html) +* +* 指定页面显示区域作为参照区域之一 +* +* **示例代码** +* +* +* 下面的示例代码中,如果目标节点(用选择器 .target-class 指定)进入显示区域以下 100px 时,就会触发回调函数。 +* ```javascript +Page({ + onLoad: function(){ + wx.createIntersectionObserver().relativeToViewport({bottom: 100}).observe('.target-class', (res) => { + res.intersectionRatio // 相交区域占目标节点的布局区域的比例 + res.intersectionRect // 相交区域 + res.intersectionRect.left // 相交区域的左边界坐标 + res.intersectionRect.top // 相交区域的上边界坐标 + res.intersectionRect.width // 相交区域的宽度 + res.intersectionRect.height // 相交区域的高度 + }) + } +}) +``` */ + relativeToViewport( + /** 用来扩展(或收缩)参照节点布局区域的边界 */ + margins?: Margins + ): IntersectionObserver + } + interface InterstitialAd { + /** [InterstitialAd.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.destroy.html) + * + * 销毁插屏广告实例。 + * + * 最低基础库: `2.8.0` */ + destroy(): void + /** [InterstitialAd.offClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offClose.html) + * + * 取消监听插屏广告关闭事件 */ + offClose( + /** 插屏广告关闭事件的回调函数 */ + callback?: UDPSocketOffCloseCallback + ): void + /** [InterstitialAd.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offError.html) + * + * 取消监听插屏错误事件 */ + offError( + /** 插屏错误事件的回调函数 */ + callback?: InterstitialAdOffErrorCallback + ): void + /** [InterstitialAd.offLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offLoad.html) + * + * 取消监听插屏广告加载事件 */ + offLoad( + /** 插屏广告加载事件的回调函数 */ + callback?: OffLoadCallback + ): void + /** [InterstitialAd.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onClose.html) + * + * 监听插屏广告关闭事件。 */ + onClose( + /** 插屏广告关闭事件的回调函数 */ + callback: UDPSocketOnCloseCallback + ): void + /** [InterstitialAd.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onError.html) + * + * 监听插屏错误事件。 + * + * **错误码信息与解决方案表** + * + * + * 错误码是通过onError获取到的错误信息。调试期间,可以通过异常返回来捕获信息。 + * 在小程序发布上线之后,如果遇到异常问题,可以在[“运维中心“](https://mp.weixin.qq.com/)里面搜寻错误日志,还可以针对异常返回加上适当的监控信息。 + * + * | 代码 | 异常情况 | 理由 | 解决方案 | + * | ------ | -------------- | --------------- | -------------------------- | + * | 1000 | 后端错误调用失败 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。 | + * | 1001 | 参数错误 | 使用方法错误 | 可以前往developers.weixin.qq.com确认具体教程(小程序和小游戏分别有各自的教程,可以在顶部选项中,“设计”一栏的右侧进行切换。| + * | 1002 | 广告单元无效 | 可能是拼写错误、或者误用了其他APP的广告ID | 请重新前往mp.weixin.qq.com确认广告位ID。 | + * | 1003 | 内部错误 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。| + * | 1004 | 无适合的广告 | 广告不是每一次都会出现,这次没有出现可能是由于该用户不适合浏览广告 | 属于正常情况,且开发者需要针对这种情况做形态上的兼容。 | + * | 1005 | 广告组件审核中 | 你的广告正在被审核,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。| + * | 1006 | 广告组件被驳回 | 你的广告审核失败,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。| + * | 1007 | 广告组件被驳回 | 你的广告能力已经被封禁,封禁期间无法展现广告 | 请前往mp.weixin.qq.com确认小程序广告封禁状态。 | + * | 1008 | 广告单元已关闭 | 该广告位的广告能力已经被关闭 | 请前往mp.weixin.qq.com重新打开对应广告位的展现。| */ + onError( + /** 插屏错误事件的回调函数 */ + callback: InterstitialAdOnErrorCallback + ): void + /** [InterstitialAd.onLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onLoad.html) + * + * 监听插屏广告加载事件。 */ + onLoad( + /** 插屏广告加载事件的回调函数 */ + callback: OnLoadCallback + ): void + /** [Promise InterstitialAd.load()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.load.html) + * + * 加载插屏广告。 + * + * 最低基础库: `2.8.0` */ + load(): Promise + /** [Promise InterstitialAd.show()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.show.html) + * + * 显示插屏广告。 + * + * **错误码信息表** + * + * + * 如果插屏广告显示失败,InterstitialAd.show() 方法会返回一个rejected Promise,开发者可以获取到错误码及对应的错误信息。 + * + * | 代码 | 异常情况 | 理由 | + * | ------ | -------------- | -------------------------- | + * | 2001 | 触发频率限制 | 小程序启动一定时间内不允许展示插屏广告 | + * | 2002 | 触发频率限制 | 距离小程序插屏广告或者激励视频广告上次播放时间间隔不足,不允许展示插屏广告 | + * | 2003 | 触发频率限制 | 当前正在播放激励视频广告或者插屏广告,不允许再次展示插屏广告 | + * | 2004 | 广告渲染失败 | 该项错误不是开发者的异常情况,或因小程序页面切换导致广告渲染失败 | + * | 2005 | 广告调用异常 | 插屏广告实例不允许跨页面调用 | */ + show(): Promise + } + interface IsoDep { + /** [IsoDep.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.close.html) + * + * 断开连接 + * + * 最低基础库: `2.11.2` */ + close(option?: NdefCloseOption): void + /** [IsoDep.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.connect.html) + * + * 连接 NFC 标签 + * + * 最低基础库: `2.11.2` */ + connect(option?: ConnectOption): void + /** [IsoDep.getHistoricalBytes(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.getHistoricalBytes.html) + * + * 获取复位信息 + * + * 最低基础库: `2.11.2` */ + getHistoricalBytes(option?: GetHistoricalBytesOption): void + /** [IsoDep.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.getMaxTransceiveLength.html) + * + * 获取最大传输长度 + * + * 最低基础库: `2.11.2` */ + getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void + /** [IsoDep.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.isConnected.html) + * + * 检查是否已连接 + * + * 最低基础库: `2.11.2` */ + isConnected(option?: IsConnectedOption): void + /** [IsoDep.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.setTimeout.html) + * + * 设置超时时间 + * + * 最低基础库: `2.11.2` */ + setTimeout(option: SetTimeoutOption): void + /** [IsoDep.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.transceive.html) + * + * 发送数据 + * + * 最低基础库: `2.11.2` */ + transceive(option: TransceiveOption): void + } + interface JoinVoIPChatError { + /** 错误信息 + * + * | 错误码 | 错误信息 | 说明 | + * | - | - | - | + * | -1 | 当前已在房间内 | | + * | -2 | 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 | | + * | -3 | 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 | | + * | -1000 | 系统错误 | | */ errMsg: string + /** 错误码 + * + * | 错误码 | 错误信息 | 说明 | + * | - | - | - | + * | -1 | 当前已在房间内 | | + * | -2 | 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 | | + * | -3 | 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 | | + * | -1000 | 系统错误 | | */ errCode: number + } + interface LivePlayerContext { + /** [LivePlayerContext.exitFullScreen(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitFullScreen.html) + * + * 退出全屏 */ + exitFullScreen(option?: ExitFullScreenOption): void + /** [LivePlayerContext.exitPictureInPicture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitPictureInPicture.html) + * + * 退出小窗,该方法可在任意页面调用 */ + exitPictureInPicture(option?: ExitPictureInPictureOption): void + /** [LivePlayerContext.mute(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.mute.html) + * + * 静音 */ + mute(option?: MuteOption): void + /** [LivePlayerContext.pause(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.pause.html) + * + * 暂停 + * + * 最低基础库: `1.9.90` */ + pause(option?: PauseOption): void + /** [LivePlayerContext.play(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.play.html) + * + * 播放 */ + play(option?: PlayOption): void + /** [LivePlayerContext.requestFullScreen(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.requestFullScreen.html) + * + * 进入全屏 */ + requestFullScreen( + option: LivePlayerContextRequestFullScreenOption + ): void + /** [LivePlayerContext.requestPictureInPicture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.requestPictureInPicture.html) + * + * 进入小窗 + * + * 最低基础库: `2.15.0` */ + requestPictureInPicture(option?: RequestPictureInPictureOption): void + /** [LivePlayerContext.resume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.resume.html) + * + * 恢复 + * + * 最低基础库: `1.9.90` */ + resume(option?: ResumeOption): void + /** [LivePlayerContext.snapshot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.snapshot.html) + * + * 截图 + * + * 最低基础库: `2.7.1` */ + snapshot(option: LivePlayerContextSnapshotOption): void + /** [LivePlayerContext.stop(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.stop.html) + * + * 停止 */ + stop(option?: StopOption): void + } + interface LivePusherContext { + /** [LivePusherContext.pause(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.pause.html) + * + * 暂停推流 */ + pause(option?: PauseOption): void + /** [LivePusherContext.pauseBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.pauseBGM.html) + * + * 暂停背景音 + * + * 最低基础库: `2.4.0` */ + pauseBGM(option?: PauseBGMOption): void + /** [LivePusherContext.playBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.playBGM.html) + * + * 播放背景音 + * + * 最低基础库: `2.4.0` */ + playBGM(option: PlayBGMOption): void + /** [LivePusherContext.resume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.resume.html) + * + * 恢复推流 */ + resume(option?: ResumeOption): void + /** [LivePusherContext.resumeBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.resumeBGM.html) + * + * 恢复背景音 + * + * 最低基础库: `2.4.0` */ + resumeBGM(option?: ResumeBGMOption): void + /** [LivePusherContext.sendMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.sendMessage.html) + * + * 发送SEI消息 + * + * 最低基础库: `2.10.0` */ + sendMessage(option?: SendMessageOption): void + /** [LivePusherContext.setBGMVolume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.setBGMVolume.html) + * + * 设置背景音音量 + * + * 最低基础库: `2.4.0` */ + setBGMVolume(option: SetBGMVolumeOption): void + /** [LivePusherContext.setMICVolume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.setMICVolume.html) + * + * 设置麦克风音量 + * + * 最低基础库: `2.10.0` */ + setMICVolume(option: SetMICVolumeOption): void + /** [LivePusherContext.snapshot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.snapshot.html) + * + * 快照 + * + * 最低基础库: `1.9.90` */ + snapshot(option: LivePusherContextSnapshotOption): void + /** [LivePusherContext.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.start.html) + * + * 开始推流,同时开启摄像头预览 */ + start(option?: CameraFrameListenerStartOption): void + /** [LivePusherContext.startPreview(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.startPreview.html) + * + * 开启摄像头预览 + * + * 最低基础库: `2.7.0` */ + startPreview(option?: StartPreviewOption): void + /** [LivePusherContext.stop(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.stop.html) + * + * 停止推流,同时停止摄像头预览 */ + stop(option?: StopOption): void + /** [LivePusherContext.stopBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.stopBGM.html) + * + * 停止背景音 + * + * 最低基础库: `2.4.0` */ + stopBGM(option?: StopBGMOption): void + /** [LivePusherContext.stopPreview(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.stopPreview.html) + * + * 关闭摄像头预览 + * + * 最低基础库: `2.7.0` */ + stopPreview(option?: StopPreviewOption): void + /** [LivePusherContext.switchCamera(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.switchCamera.html) + * + * 切换前后摄像头 */ + switchCamera(option?: SwitchCameraOption): void + /** [LivePusherContext.toggleTorch(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.toggleTorch.html) + * + * 切换手电筒 + * + * 最低基础库: `2.1.0` */ + toggleTorch(option?: ToggleTorchOption): void + } + interface LogManager { + /** [LogManager.debug()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.debug.html) + * + * 写 debug 日志 */ + debug( + /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */ + ...args: any[] + ): void + /** [LogManager.info()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.info.html) + * + * 写 info 日志 */ + info( + /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */ + ...args: any[] + ): void + /** [LogManager.log()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.log.html) + * + * 写 log 日志 */ + log( + /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */ + ...args: any[] + ): void + /** [LogManager.warn()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.warn.html) + * + * 写 warn 日志 */ + warn( + /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */ + ...args: any[] + ): void + } + interface MapContext { + /** [MapContext.addCustomLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addCustomLayer.html) + * + * 添加个性化图层。 + * + * 最低基础库: `2.12.0` */ + addCustomLayer(option: AddCustomLayerOption): void + /** [MapContext.addGroundOverlay(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addGroundOverlay.html) + * + * 创建自定义图片图层,图片会随着地图缩放而缩放。 + * + * 最低基础库: `2.14.0` */ + addGroundOverlay(option: AddGroundOverlayOption): void + /** [MapContext.addMarkers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addMarkers.html) + * + * 添加 marker。 + * + * 最低基础库: `2.13.0` */ + addMarkers(option: AddMarkersOption): void + /** [MapContext.fromScreenLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.fromScreenLocation.html) + * + * 获取屏幕上的点对应的经纬度,坐标原点为地图左上角。 + * + * 最低基础库: `2.14.0` */ + fromScreenLocation(option: FromScreenLocationOption): void + /** [MapContext.getCenterLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getCenterLocation.html) + * + * 获取当前地图中心的经纬度。返回的是 gcj02 坐标系,可以用于 [wx.openLocation()](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.openLocation.html) */ + getCenterLocation(option?: GetCenterLocationOption): void + /** [MapContext.getRegion(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getRegion.html) + * + * 获取当前地图的视野范围 + * + * 最低基础库: `1.4.0` */ + getRegion(option?: GetRegionOption): void + /** [MapContext.getRotate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getRotate.html) + * + * 获取当前地图的旋转角 + * + * 最低基础库: `2.8.0` */ + getRotate(option?: GetRotateOption): void + /** [MapContext.getScale(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getScale.html) + * + * 获取当前地图的缩放级别 + * + * 最低基础库: `1.4.0` */ + getScale(option?: GetScaleOption): void + /** [MapContext.getSkew(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getSkew.html) + * + * 获取当前地图的倾斜角 + * + * 最低基础库: `2.8.0` */ + getSkew(option?: GetSkewOption): void + /** [MapContext.includePoints(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.includePoints.html) + * + * 缩放视野展示所有经纬度 + * + * 最低基础库: `1.2.0` */ + includePoints(option: IncludePointsOption): void + /** [MapContext.initMarkerCluster(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.initMarkerCluster.html) + * + * 初始化点聚合的配置,未调用时采用默认配置。 + * + * 最低基础库: `2.13.0` */ + initMarkerCluster(option: InitMarkerClusterOption): void + /** [MapContext.moveAlong(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.moveAlong.html) + * + * 沿指定路径移动 `marker`,用于轨迹回放等场景。动画完成时触发回调事件,若动画进行中,对同一 `marker` 再次调用 `moveAlong` 方法,前一次的动画将被打断。 + * + * 最低基础库: `2.13.0` */ + moveAlong(option: MoveAlongOption): void + /** [MapContext.moveToLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.moveToLocation.html) + * + * 将地图中心移置当前定位点,此时需设置地图组件 show-location 为true。[2.8.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起支持将地图中心移动到指定位置。 + * + * 最低基础库: `1.2.0` */ + moveToLocation(option?: MoveToLocationOption): void + /** [MapContext.on(string event, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.on.html) +* +* 监听地图事件。 +* +* ### markerClusterCreate +* +* 缩放或拖动导致新的聚合簇产生时触发,仅返回新创建的聚合簇信息。 +* +* #### 返回参数 +* +* | 参数 | 类型 | 说明 | +* | --------- | ------ | --------- | +* | clusters | `Array<ClusterInfo>` | 聚合簇数据 | +* +* ### markerClusterClick +* +* 聚合簇的点击事件。 +* +* #### 返回参数 +* +* | 参数 | 类型 | 说明 | +* | --------- | ------------- | --------- | +* | cluster | ClusterInfo | 聚合簇 | +* +* +* #### ClusterInfo 结构 +* +* | 参数 | 类型 | 说明 | +* | ---------- | -------------------- | -------------------------- | +* | clusterId | Number | 聚合簇的 id | +* | center | LatLng | 聚合簇的坐标 | +* | markerIds | `Array<Number>` | 该聚合簇内的点标记数据数组 | +* +* **示例代码** +* +* +* +* ```js + MapContext.on('markerClusterCreate', (res) => {}) + MapContext.on('markerClusterClick', (res) => {}) +``` +* +* 最低基础库: `2.13.0` */ + on( + /** 事件名 + * + * 参数 event 可选值: + * - 'markerClusterCreate': ; + * - 'markerClusterClick': ; */ + event: 'markerClusterCreate' | 'markerClusterClick', + /** 事件的回调函数 */ + callback: (...args: any[]) => any + ): void + /** [MapContext.openMapApp(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.openMapApp.html) + * + * 拉起地图APP选择导航。 + * + * 最低基础库: `2.14.0` */ + openMapApp(option: OpenMapAppOption): void + /** [MapContext.removeCustomLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeCustomLayer.html) + * + * 移除个性化图层。 + * + * 最低基础库: `2.12.0` */ + removeCustomLayer(option: RemoveCustomLayerOption): void + /** [MapContext.removeGroundOverlay(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeGroundOverlay.html) + * + * 移除自定义图片图层。 + * + * 最低基础库: `2.14.0` */ + removeGroundOverlay(option: RemoveGroundOverlayOption): void + /** [MapContext.removeMarkers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeMarkers.html) + * + * 移除 marker。 + * + * 最低基础库: `2.13.0` */ + removeMarkers(option: RemoveMarkersOption): void + /** [MapContext.setCenterOffset(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.setCenterOffset.html) + * + * 设置地图中心点偏移,向后向下为增长,屏幕比例范围(0.25~0.75),默认偏移为[0.5, 0.5] + * + * 最低基础库: `2.10.0` */ + setCenterOffset(option: SetCenterOffsetOption): void + /** [MapContext.toScreenLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.toScreenLocation.html) + * + * 获取经纬度对应的屏幕坐标,坐标原点为地图左上角。 + * + * 最低基础库: `2.14.0` */ + toScreenLocation(option: ToScreenLocationOption): void + /** [MapContext.translateMarker(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.translateMarker.html) + * + * 平移marker,带动画。 + * + * 最低基础库: `1.2.0` */ + translateMarker(option: TranslateMarkerOption): void + /** [MapContext.updateGroundOverlay(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.updateGroundOverlay.html) + * + * 更新自定义图片图层。 + * + * 最低基础库: `2.14.0` */ + updateGroundOverlay(option: UpdateGroundOverlayOption): void + } + interface MediaAudioPlayer { + /** [Promise MediaAudioPlayer.addAudioSource([VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html) source)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.addAudioSource.html) + * + * 添加音频源 */ + addAudioSource( + /** [VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html) + * + * 视频解码器实例。作为音频源添加到音频播放器中 */ + source: VideoDecoder + ): Promise + /** [Promise MediaAudioPlayer.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.destroy.html) + * + * 销毁播放器 */ + destroy(): Promise + /** [Promise MediaAudioPlayer.removeAudioSource([VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html) source)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.removeAudioSource.html) + * + * 移除音频源 */ + removeAudioSource( + /** [VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html) + * + * 视频解码器实例 */ + source: VideoDecoder + ): Promise + /** [Promise MediaAudioPlayer.start()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.start.html) + * + * 启动播放器 */ + start(): Promise + /** [Promise MediaAudioPlayer.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.stop.html) + * + * 停止播放器 */ + stop(): Promise + } + interface MediaContainer { + /** [MediaContainer.addTrack([MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) track)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.addTrack.html) + * + * 将音频或视频轨道添加到容器 + * + * 最低基础库: `2.9.0` */ + addTrack( + /** [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) + * + * 要添加的音频或视频轨道 */ + track: MediaTrack + ): void + /** [MediaContainer.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.destroy.html) + * + * 将容器销毁,释放资源 + * + * 最低基础库: `2.9.0` */ + destroy(): void + /** [MediaContainer.export()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.export.html) + * + * 将容器内的轨道合并并导出视频文件 + * + * 最低基础库: `2.9.0` */ + export(): void + /** [MediaContainer.extractDataSource(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.extractDataSource.html) + * + * 将传入的视频源分离轨道。不会自动将轨道添加到待合成的容器里。 + * + * 最低基础库: `2.9.0` */ + extractDataSource(option: ExtractDataSourceOption): void + /** [MediaContainer.removeTrack([MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) track)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.removeTrack.html) + * + * 将音频或视频轨道从容器中移除 + * + * 最低基础库: `2.9.0` */ + removeTrack( + /** [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) + * + * 要移除的音频或视频轨道 */ + track: MediaTrack + ): void + } + interface MediaQueryObserver { + /** [MediaQueryObserver.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/MediaQueryObserver.disconnect.html) + * + * 停止监听。回调函数将不再触发 */ + disconnect(): void + /** [MediaQueryObserver.observe(Object descriptor, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/MediaQueryObserver.observe.html) + * + * 开始监听页面 media query 变化情况 */ + observe( + /** media query 描述符 */ + descriptor: ObserveDescriptor, + /** 监听 media query 状态变化的回调函数 */ + callback: MediaQueryObserverObserveCallback + ): void + } + interface MediaRecorder { + /** [MediaRecorder.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.destroy.html) + * + * 销毁录制器 + * + * 最低基础库: `2.11.0` */ + destroy(): void + /** [MediaRecorder.off(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.off.html) + * + * 取消监听录制事件。当对应事件触发时,该回调函数不再执行。 + * + * 最低基础库: `2.11.0` */ + off( + /** 事件名 */ + eventName: string, + /** 事件触发时执行的回调函数 */ + callback: (...args: any[]) => any + ): void + /** [MediaRecorder.on(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.on.html) + * + * 注册监听录制事件的回调函数。当对应事件触发时,回调函数会被执行。 + * + * 最低基础库: `2.11.0` */ + on( + /** 事件名 + * + * 参数 eventName 可选值: + * - 'start': 录制开始事件。; + * - 'stop': 录制结束事件。返回 {tempFilePath, duration, fileSize}; */ + eventName: 'start' | 'stop', + /** 事件触发时执行的回调函数 */ + callback: (...args: any[]) => any + ): void + /** [MediaRecorder.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.pause.html) + * + * 暂停录制 + * + * 最低基础库: `2.11.0` */ + pause(): void + /** [MediaRecorder.requestFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.requestFrame.html) + * + * 请求下一帧录制,在 callback 里完成一帧渲染后开始录制当前帧 + * + * 最低基础库: `2.11.0` */ + requestFrame(callback: (...args: any[]) => any): void + /** [MediaRecorder.resume()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.resume.html) + * + * 恢复录制 + * + * 最低基础库: `2.11.0` */ + resume(): void + /** [MediaRecorder.start()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.start.html) + * + * 开始录制 + * + * 最低基础库: `2.11.0` */ + start(): void + /** [MediaRecorder.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.stop.html) + * + * 结束录制 + * + * 最低基础库: `2.11.0` */ + stop(): void + } + interface MifareClassic { + /** [MifareClassic.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.close.html) + * + * 断开连接 + * + * 最低基础库: `2.11.2` */ + close(option?: NdefCloseOption): void + /** [MifareClassic.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.connect.html) + * + * 连接 NFC 标签 + * + * 最低基础库: `2.11.2` */ + connect(option?: ConnectOption): void + /** [MifareClassic.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.getMaxTransceiveLength.html) + * + * 获取最大传输长度 + * + * 最低基础库: `2.11.2` */ + getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void + /** [MifareClassic.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.isConnected.html) + * + * 检查是否已连接 + * + * 最低基础库: `2.11.2` */ + isConnected(option?: IsConnectedOption): void + /** [MifareClassic.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.setTimeout.html) + * + * 设置超时时间 + * + * 最低基础库: `2.11.2` */ + setTimeout(option: SetTimeoutOption): void + /** [MifareClassic.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.transceive.html) + * + * 发送数据 + * + * 最低基础库: `2.11.2` */ + transceive(option: TransceiveOption): void + } + interface MifareUltralight { + /** [MifareUltralight.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.close.html) + * + * 断开连接 + * + * 最低基础库: `2.11.2` */ + close(option?: NdefCloseOption): void + /** [MifareUltralight.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.connect.html) + * + * 连接 NFC 标签 + * + * 最低基础库: `2.11.2` */ + connect(option?: ConnectOption): void + /** [MifareUltralight.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.getMaxTransceiveLength.html) + * + * 获取最大传输长度 + * + * 最低基础库: `2.11.2` */ + getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void + /** [MifareUltralight.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.isConnected.html) + * + * 检查是否已连接 + * + * 最低基础库: `2.11.2` */ + isConnected(option?: IsConnectedOption): void + /** [MifareUltralight.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.setTimeout.html) + * + * 设置超时时间 + * + * 最低基础库: `2.11.2` */ + setTimeout(option: SetTimeoutOption): void + /** [MifareUltralight.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.transceive.html) + * + * 发送数据 + * + * 最低基础库: `2.11.2` */ + transceive(option: TransceiveOption): void + } + interface NFCAdapter { + /** [NFCAdapter.offDiscovered(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.offDiscovered.html) + * + * 取消监听 NFC Tag + * + * 最低基础库: `2.11.2` */ + offDiscovered( + /** 的回调函数 */ + callback?: OffDiscoveredCallback + ): void + /** [NFCAdapter.onDiscovered(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.onDiscovered.html) + * + * 监听 NFC Tag + * + * 最低基础库: `2.11.2` */ + onDiscovered( + /** 的回调函数 */ + callback: OnDiscoveredCallback + ): void + /** [NFCAdapter.startDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.startDiscovery.html) + * + * + * + * 最低基础库: `2.11.2` */ + startDiscovery(option?: StartDiscoveryOption): void + /** [NFCAdapter.stopDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.stopDiscovery.html) + * + * + * + * 最低基础库: `2.11.2` */ + stopDiscovery(option?: StopDiscoveryOption): void + /** [[IsoDep](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.html) NFCAdapter.getIsoDep()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getIsoDep.html) + * + * 获取IsoDep实例,实例支持ISO-DEP (ISO 14443-4)标准的读写 + * + * 最低基础库: `2.11.2` */ + getIsoDep(): IsoDep + /** [[MifareClassic](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.html) NFCAdapter.getMifareClassic()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getMifareClassic.html) + * + * 获取MifareClassic实例,实例支持MIFARE Classic标签的读写 + * + * 最低基础库: `2.11.2` */ + getMifareClassic(): MifareClassic + /** [[MifareUltralight](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.html) NFCAdapter.getMifareUltralight()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getMifareUltralight.html) + * + * 获取MifareUltralight实例,实例支持MIFARE Ultralight标签的读写 + * + * 最低基础库: `2.11.2` */ + getMifareUltralight(): MifareUltralight + /** [[Ndef](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.html) NFCAdapter.getNdef()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNdef.html) + * + * 获取Ndef实例,实例支持对NDEF格式的NFC标签上的NDEF数据的读写 + * + * 最低基础库: `2.11.2` */ + getNdef(): Ndef + /** [[NfcA](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.html) NFCAdapter.getNfcA()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcA.html) + * + * 获取NfcA实例,实例支持NFC-A (ISO 14443-3A)标准的读写 + * + * 最低基础库: `2.11.2` */ + getNfcA(): NfcA + /** [[NfcB](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.html) NFCAdapter.getNfcB()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcB.html) + * + * 获取NfcB实例,实例支持NFC-B (ISO 14443-3B)标准的读写 + * + * 最低基础库: `2.11.2` */ + getNfcB(): NfcB + /** [[NfcF](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.html) NFCAdapter.getNfcF()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcF.html) + * + * 获取NfcF实例,实例支持NFC-F (JIS 6319-4)标准的读写 + * + * 最低基础库: `2.11.2` */ + getNfcF(): NfcF + /** [[NfcV](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.html) NFCAdapter.getNfcV()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcV.html) + * + * 获取NfcV实例,实例支持NFC-V (ISO 15693)标准的读写 + * + * 最低基础库: `2.11.2` */ + getNfcV(): NfcV + } + interface NFCError { + /** 错误信息 + * + * | 错误码 | 错误信息 | 说明 | + * | - | - | - | + * | 0 | ok | 正常 | + * | 13000 | | 当前设备不支持NFC | + * | 13001 | | 当前设备支持NFC,但系统NFC开关未开启 | + * | 13002 | | 当前设备支持NFC,但不支持HCE | + * | 13003 | | AID列表参数格式错误 | + * | 13004 | | 未设置微信为默认NFC支付应用 | + * | 13005 | | 返回的指令不合法 | + * | 13006 | | 注册AID失败 | */ errMsg: string + /** 错误码 + * + * | 错误码 | 错误信息 | 说明 | + * | - | - | - | + * | 0 | ok | 正常 | + * | 13000 | | 当前设备不支持NFC | + * | 13001 | | 当前设备支持NFC,但系统NFC开关未开启 | + * | 13002 | | 当前设备支持NFC,但不支持HCE | + * | 13003 | | AID列表参数格式错误 | + * | 13004 | | 未设置微信为默认NFC支付应用 | + * | 13005 | | 返回的指令不合法 | + * | 13006 | | 注册AID失败 | */ errCode: number + } + interface Ndef { + /** [Ndef.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.close.html) + * + * 断开连接 + * + * 最低基础库: `2.11.2` */ + close(option?: NdefCloseOption): void + /** [Ndef.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.connect.html) + * + * 连接 NFC 标签 + * + * 最低基础库: `2.11.2` */ + connect(option?: ConnectOption): void + /** [Ndef.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.isConnected.html) + * + * 检查是否已连接 + * + * 最低基础库: `2.11.2` */ + isConnected(option?: IsConnectedOption): void + /** [Ndef.offNdefMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.offNdefMessage.html) + * + * 取消监听 Ndef 消息 + * + * 最低基础库: `2.11.2` */ + offNdefMessage(callback: (...args: any[]) => any): void + /** [Ndef.onNdefMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.onNdefMessage.html) + * + * 监听 Ndef 消息 + * + * 最低基础库: `2.11.2` */ + onNdefMessage(callback: (...args: any[]) => any): void + /** [Ndef.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.setTimeout.html) + * + * 设置超时时间 + * + * 最低基础库: `2.11.2` */ + setTimeout(option: SetTimeoutOption): void + /** [Ndef.writeNdefMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.writeNdefMessage.html) + * + * 重写 Ndef 标签内容 + * + * 最低基础库: `2.11.2` */ + writeNdefMessage(option: WriteNdefMessageOption): void + } + interface NfcA { + /** [NfcA.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.close.html) + * + * 断开连接 + * + * 最低基础库: `2.11.2` */ + close(option?: NdefCloseOption): void + /** [NfcA.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.connect.html) + * + * 连接 NFC 标签 + * + * 最低基础库: `2.11.2` */ + connect(option?: ConnectOption): void + /** [NfcA.getAtqa(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getAtqa.html) + * + * 获取ATQA信息 + * + * 最低基础库: `2.11.2` */ + getAtqa(option?: GetAtqaOption): void + /** [NfcA.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getMaxTransceiveLength.html) + * + * 获取最大传输长度 + * + * 最低基础库: `2.11.2` */ + getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void + /** [NfcA.getSak(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getSak.html) + * + * 获取SAK信息 + * + * 最低基础库: `2.11.2` */ + getSak(option?: GetSakOption): void + /** [NfcA.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.isConnected.html) + * + * 检查是否已连接 + * + * 最低基础库: `2.11.2` */ + isConnected(option?: IsConnectedOption): void + /** [NfcA.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.setTimeout.html) + * + * 设置超时时间 + * + * 最低基础库: `2.11.2` */ + setTimeout(option: SetTimeoutOption): void + /** [NfcA.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.transceive.html) + * + * 发送数据 + * + * 最低基础库: `2.11.2` */ + transceive(option: TransceiveOption): void + } + interface NfcB { + /** [NfcB.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.close.html) + * + * 断开连接 + * + * 最低基础库: `2.11.2` */ + close(option?: NdefCloseOption): void + /** [NfcB.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.connect.html) + * + * 连接 NFC 标签 + * + * 最低基础库: `2.11.2` */ + connect(option?: ConnectOption): void + /** [NfcB.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.getMaxTransceiveLength.html) + * + * 获取最大传输长度 + * + * 最低基础库: `2.11.2` */ + getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void + /** [NfcB.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.isConnected.html) + * + * 检查是否已连接 + * + * 最低基础库: `2.11.2` */ + isConnected(option?: IsConnectedOption): void + /** [NfcB.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.setTimeout.html) + * + * 设置超时时间 + * + * 最低基础库: `2.11.2` */ + setTimeout(option: SetTimeoutOption): void + /** [NfcB.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.transceive.html) + * + * 发送数据 + * + * 最低基础库: `2.11.2` */ + transceive(option: TransceiveOption): void + } + interface NfcF { + /** [NfcF.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.close.html) + * + * 断开连接 + * + * 最低基础库: `2.11.2` */ + close(option?: NdefCloseOption): void + /** [NfcF.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.connect.html) + * + * 连接 NFC 标签 + * + * 最低基础库: `2.11.2` */ + connect(option?: ConnectOption): void + /** [NfcF.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.getMaxTransceiveLength.html) + * + * 获取最大传输长度 + * + * 最低基础库: `2.11.2` */ + getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void + /** [NfcF.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.isConnected.html) + * + * 检查是否已连接 + * + * 最低基础库: `2.11.2` */ + isConnected(option?: IsConnectedOption): void + /** [NfcF.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.setTimeout.html) + * + * 设置超时时间 + * + * 最低基础库: `2.11.2` */ + setTimeout(option: SetTimeoutOption): void + /** [NfcF.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.transceive.html) + * + * 发送数据 + * + * 最低基础库: `2.11.2` */ + transceive(option: TransceiveOption): void + } + interface NfcV { + /** [NfcV.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.close.html) + * + * 断开连接 + * + * 最低基础库: `2.11.2` */ + close(option?: NdefCloseOption): void + /** [NfcV.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.connect.html) + * + * 连接 NFC 标签 + * + * 最低基础库: `2.11.2` */ + connect(option?: ConnectOption): void + /** [NfcV.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.getMaxTransceiveLength.html) + * + * 获取最大传输长度 + * + * 最低基础库: `2.11.2` */ + getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void + /** [NfcV.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.isConnected.html) + * + * 检查是否已连接 + * + * 最低基础库: `2.11.2` */ + isConnected(option?: IsConnectedOption): void + /** [NfcV.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.setTimeout.html) + * + * 设置超时时间 + * + * 最低基础库: `2.11.2` */ + setTimeout(option: SetTimeoutOption): void + /** [NfcV.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.transceive.html) + * + * 发送数据 + * + * 最低基础库: `2.11.2` */ + transceive(option: TransceiveOption): void + } + interface Nfcrwerror { + /** 错误信息 + * + * | 错误码 | 错误信息 | 说明 | + * | - | - | - | + * | 13000 | 设备不支持NFC | | + * | 13001 | 系统NFC开关未打开 | | + * | 13010 | 未知错误 | | + * | 13019 | user is not authorized | 用户未授权 | + * | 13011 | invalid parameter | 参数无效 | + * | 13012 | parse NdefMessage failed | 将参数解析为NdefMessage失败 | + * | 13021 | NFC discovery already started | 已经开始NFC扫描 | + * | 13018 | NFC discovery has not started | 尝试在未开始NFC扫描时停止NFC扫描 | + * | 13022 | Tech already connected | 标签已经连接 | + * | 13023 | Tech has not connected | 尝试在未连接标签时断开连接 | + * | 13013 | NFC tag has not been discovered | 未扫描到NFC标签 | + * | 13014 | invalid tech | 无效的标签技术 | + * | 13015 | unavailable tech | 从标签上获取对应技术失败 | + * | 13024 | function not support | 当前标签技术不支持该功能 | + * | 13017 | system internal error | 相关读写操作失败 | + * | 13016 | connect fail | 连接失败 | */ errMsg: string + /** 错误码 + * + * | 错误码 | 错误信息 | 说明 | + * | - | - | - | + * | 13000 | 设备不支持NFC | | + * | 13001 | 系统NFC开关未打开 | | + * | 13010 | 未知错误 | | + * | 13019 | user is not authorized | 用户未授权 | + * | 13011 | invalid parameter | 参数无效 | + * | 13012 | parse NdefMessage failed | 将参数解析为NdefMessage失败 | + * | 13021 | NFC discovery already started | 已经开始NFC扫描 | + * | 13018 | NFC discovery has not started | 尝试在未开始NFC扫描时停止NFC扫描 | + * | 13022 | Tech already connected | 标签已经连接 | + * | 13023 | Tech has not connected | 尝试在未连接标签时断开连接 | + * | 13013 | NFC tag has not been discovered | 未扫描到NFC标签 | + * | 13014 | invalid tech | 无效的标签技术 | + * | 13015 | unavailable tech | 从标签上获取对应技术失败 | + * | 13024 | function not support | 当前标签技术不支持该功能 | + * | 13017 | system internal error | 相关读写操作失败 | + * | 13016 | connect fail | 连接失败 | */ errCode: number + } + interface NodesRef { + /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.boundingClientRect(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.boundingClientRect.html) +* +* 添加节点的布局位置的查询请求。相对于显示区域,以像素为单位。其功能类似于 DOM 的 `getBoundingClientRect`。返回 `NodesRef` 对应的 `SelectorQuery`。 +* +* **示例代码** +* +* +* ```js +Page({ + getRect () { + wx.createSelectorQuery().select('#the-id').boundingClientRect(function(rect){ + rect.id // 节点的ID + rect.dataset // 节点的dataset + rect.left // 节点的左边界坐标 + rect.right // 节点的右边界坐标 + rect.top // 节点的上边界坐标 + rect.bottom // 节点的下边界坐标 + rect.width // 节点的宽度 + rect.height // 节点的高度 + }).exec() + }, + getAllRects () { + wx.createSelectorQuery().selectAll('.a-class').boundingClientRect(function(rects){ + rects.forEach(function(rect){ + rect.id // 节点的ID + rect.dataset // 节点的dataset + rect.left // 节点的左边界坐标 + rect.right // 节点的右边界坐标 + rect.top // 节点的上边界坐标 + rect.bottom // 节点的下边界坐标 + rect.width // 节点的宽度 + rect.height // 节点的高度 + }) + }).exec() + } +}) +``` */ + boundingClientRect( + /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */ + callback?: BoundingClientRectCallback + ): SelectorQuery + /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.context(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.context.html) +* +* 添加节点的 Context 对象查询请求。目前支持 [VideoContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html)、[CanvasContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html)、[LivePlayerContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html)、[EditorContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.html)和 [MapContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.html) 的获取。 +* +* **示例代码** +* +* +* ```js +Page({ + getContext () { + wx.createSelectorQuery().select('.the-video-class').context(function(res){ + console.log(res.context) // 节点对应的 Context 对象。如:选中的节点是

= Component.Property

+ type Method = Component.Method + + type DefinitionFilter = Component.DefinitionFilter + type Lifetimes = Component.Lifetimes + + type OtherOption = Omit +} +/** 注册一个 `behavior`,接受一个 `Object` 类型的参数。*/ +declare let Behavior: WechatMiniprogram.Behavior.Constructor diff --git a/frontend_miniprogram/typings/types/wx/lib.wx.cloud.d.ts b/frontend_miniprogram/typings/types/wx/lib.wx.cloud.d.ts new file mode 100644 index 0000000..de0ce09 --- /dev/null +++ b/frontend_miniprogram/typings/types/wx/lib.wx.cloud.d.ts @@ -0,0 +1,924 @@ +/*! ***************************************************************************** +Copyright (c) 2021 Tencent, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +***************************************************************************** */ + +interface IAPIError { + errMsg: string +} + +interface IAPIParam { + config?: ICloudConfig + success?: (res: T) => void + fail?: (err: IAPIError) => void + complete?: (val: T | IAPIError) => void +} + +interface IAPISuccessParam { + errMsg: string +} + +type IAPICompleteParam = IAPISuccessParam | IAPIError + +type IAPIFunction> = (param?: P) => Promise + +interface IInitCloudConfig { + env?: + | string + | { + database?: string + functions?: string + storage?: string + } + traceUser?: boolean +} + +interface ICloudConfig { + env?: string + traceUser?: boolean +} + +interface IICloudAPI { + init: (config?: IInitCloudConfig) => void + [api: string]: AnyFunction | IAPIFunction +} + +interface ICloudService { + name: string + + getAPIs: () => { [name: string]: IAPIFunction } +} + +interface ICloudServices { + [serviceName: string]: ICloudService +} + +interface ICloudMetaData { + session_id: string +} + +declare class InternalSymbol {} + +interface AnyObject { + [x: string]: any +} + +type AnyArray = any[] + +type AnyFunction = (...args: any[]) => any + +/** + * extend wx with cloud + */ +interface WxCloud { + init: (config?: ICloudConfig) => void + + callFunction(param: OQ): void + callFunction( + param: RQ + ): Promise + + uploadFile(param: OQ): WechatMiniprogram.UploadTask + uploadFile( + param: RQ + ): Promise + + downloadFile( + param: OQ + ): WechatMiniprogram.DownloadTask + downloadFile( + param: RQ + ): Promise + + getTempFileURL(param: OQ): void + getTempFileURL( + param: RQ + ): Promise + + deleteFile(param: OQ): void + deleteFile( + param: RQ + ): Promise + + database: (config?: ICloudConfig) => DB.Database + + CloudID: ICloud.ICloudIDConstructor + CDN: ICloud.ICDNConstructor +} + +declare namespace ICloud { + interface ICloudAPIParam extends IAPIParam { + config?: ICloudConfig + } + + // === API: callFunction === + type CallFunctionData = AnyObject + + interface CallFunctionResult extends IAPISuccessParam { + result: AnyObject | string | undefined + } + + interface CallFunctionParam extends ICloudAPIParam { + name: string + data?: CallFunctionData + slow?: boolean + } + // === end === + + // === API: uploadFile === + interface UploadFileResult extends IAPISuccessParam { + fileID: string + statusCode: number + } + + interface UploadFileParam extends ICloudAPIParam { + cloudPath: string + filePath: string + header?: AnyObject + } + // === end === + + // === API: downloadFile === + interface DownloadFileResult extends IAPISuccessParam { + tempFilePath: string + statusCode: number + } + + interface DownloadFileParam extends ICloudAPIParam { + fileID: string + cloudPath?: string + } + // === end === + + // === API: getTempFileURL === + interface GetTempFileURLResult extends IAPISuccessParam { + fileList: GetTempFileURLResultItem[] + } + + interface GetTempFileURLResultItem { + fileID: string + tempFileURL: string + maxAge: number + status: number + errMsg: string + } + + interface GetTempFileURLParam extends ICloudAPIParam { + fileList: string[] + } + // === end === + + // === API: deleteFile === + interface DeleteFileResult extends IAPISuccessParam { + fileList: DeleteFileResultItem[] + } + + interface DeleteFileResultItem { + fileID: string + status: number + errMsg: string + } + + interface DeleteFileParam extends ICloudAPIParam { + fileList: string[] + } + // === end === + + // === API: CloudID === + abstract class CloudID { + constructor(cloudID: string) + } + + interface ICloudIDConstructor { + new (cloudId: string): CloudID + (cloudId: string): CloudID + } + // === end === + + // === API: CDN === + abstract class CDN { + target: string | ArrayBuffer | ICDNFilePathSpec + constructor(target: string | ArrayBuffer | ICDNFilePathSpec) + } + + interface ICDNFilePathSpec { + type: 'filePath' + filePath: string + } + + interface ICDNConstructor { + new (options: string | ArrayBuffer | ICDNFilePathSpec): CDN + (options: string | ArrayBuffer | ICDNFilePathSpec): CDN + } + // === end === +} + +// === Database === +declare namespace DB { + /** + * The class of all exposed cloud database instances + */ + class Database { + readonly config: ICloudConfig + readonly command: DatabaseCommand + readonly Geo: IGeo + readonly serverDate: () => ServerDate + readonly RegExp: IRegExpConstructor + + private constructor() + + collection(collectionName: string): CollectionReference + } + + class CollectionReference extends Query { + readonly collectionName: string + + private constructor(name: string, database: Database) + + doc(docId: string | number): DocumentReference + + add(options: OQ): void + add(options: RQ): Promise + } + + class DocumentReference { + private constructor(docId: string | number, database: Database) + + field(object: Record): this + + get(options: OQ): void + get(options?: RQ): Promise + + set(options: OQ): void + set(options?: RQ): Promise + + update(options: OQ): void + update( + options?: RQ + ): Promise + + remove(options: OQ): void + remove( + options?: RQ + ): Promise + + watch(options: IWatchOptions): RealtimeListener + } + + class RealtimeListener { + // "And Now His Watch Is Ended" + close: () => Promise + } + + class Query { + where(condition: IQueryCondition): Query + + orderBy(fieldPath: string, order: string): Query + + limit(max: number): Query + + skip(offset: number): Query + + field(object: Record): Query + + get(options: OQ): void + get(options?: RQ): Promise + + count(options: OQ): void + count(options?: RQ): Promise + + watch(options: IWatchOptions): RealtimeListener + } + + interface DatabaseCommand { + eq(val: any): DatabaseQueryCommand + neq(val: any): DatabaseQueryCommand + gt(val: any): DatabaseQueryCommand + gte(val: any): DatabaseQueryCommand + lt(val: any): DatabaseQueryCommand + lte(val: any): DatabaseQueryCommand + in(val: any[]): DatabaseQueryCommand + nin(val: any[]): DatabaseQueryCommand + + geoNear(options: IGeoNearCommandOptions): DatabaseQueryCommand + geoWithin(options: IGeoWithinCommandOptions): DatabaseQueryCommand + geoIntersects( + options: IGeoIntersectsCommandOptions + ): DatabaseQueryCommand + + and( + ...expressions: Array + ): DatabaseLogicCommand + or( + ...expressions: Array + ): DatabaseLogicCommand + nor( + ...expressions: Array + ): DatabaseLogicCommand + not(expression: DatabaseLogicCommand): DatabaseLogicCommand + + exists(val: boolean): DatabaseQueryCommand + + mod(divisor: number, remainder: number): DatabaseQueryCommand + + all(val: any[]): DatabaseQueryCommand + elemMatch(val: any): DatabaseQueryCommand + size(val: number): DatabaseQueryCommand + + set(val: any): DatabaseUpdateCommand + remove(): DatabaseUpdateCommand + inc(val: number): DatabaseUpdateCommand + mul(val: number): DatabaseUpdateCommand + min(val: number): DatabaseUpdateCommand + max(val: number): DatabaseUpdateCommand + rename(val: string): DatabaseUpdateCommand + bit(val: number): DatabaseUpdateCommand + + push(...values: any[]): DatabaseUpdateCommand + pop(): DatabaseUpdateCommand + shift(): DatabaseUpdateCommand + unshift(...values: any[]): DatabaseUpdateCommand + addToSet(val: any): DatabaseUpdateCommand + pull(val: any): DatabaseUpdateCommand + pullAll(val: any): DatabaseUpdateCommand + + project: { + slice(val: number | [number, number]): DatabaseProjectionCommand + } + + aggregate: { + __safe_props__?: Set + + abs(val: any): DatabaseAggregateCommand + add(val: any): DatabaseAggregateCommand + addToSet(val: any): DatabaseAggregateCommand + allElementsTrue(val: any): DatabaseAggregateCommand + and(val: any): DatabaseAggregateCommand + anyElementTrue(val: any): DatabaseAggregateCommand + arrayElemAt(val: any): DatabaseAggregateCommand + arrayToObject(val: any): DatabaseAggregateCommand + avg(val: any): DatabaseAggregateCommand + ceil(val: any): DatabaseAggregateCommand + cmp(val: any): DatabaseAggregateCommand + concat(val: any): DatabaseAggregateCommand + concatArrays(val: any): DatabaseAggregateCommand + cond(val: any): DatabaseAggregateCommand + convert(val: any): DatabaseAggregateCommand + dateFromParts(val: any): DatabaseAggregateCommand + dateToParts(val: any): DatabaseAggregateCommand + dateFromString(val: any): DatabaseAggregateCommand + dateToString(val: any): DatabaseAggregateCommand + dayOfMonth(val: any): DatabaseAggregateCommand + dayOfWeek(val: any): DatabaseAggregateCommand + dayOfYear(val: any): DatabaseAggregateCommand + divide(val: any): DatabaseAggregateCommand + eq(val: any): DatabaseAggregateCommand + exp(val: any): DatabaseAggregateCommand + filter(val: any): DatabaseAggregateCommand + first(val: any): DatabaseAggregateCommand + floor(val: any): DatabaseAggregateCommand + gt(val: any): DatabaseAggregateCommand + gte(val: any): DatabaseAggregateCommand + hour(val: any): DatabaseAggregateCommand + ifNull(val: any): DatabaseAggregateCommand + in(val: any): DatabaseAggregateCommand + indexOfArray(val: any): DatabaseAggregateCommand + indexOfBytes(val: any): DatabaseAggregateCommand + indexOfCP(val: any): DatabaseAggregateCommand + isArray(val: any): DatabaseAggregateCommand + isoDayOfWeek(val: any): DatabaseAggregateCommand + isoWeek(val: any): DatabaseAggregateCommand + isoWeekYear(val: any): DatabaseAggregateCommand + last(val: any): DatabaseAggregateCommand + let(val: any): DatabaseAggregateCommand + literal(val: any): DatabaseAggregateCommand + ln(val: any): DatabaseAggregateCommand + log(val: any): DatabaseAggregateCommand + log10(val: any): DatabaseAggregateCommand + lt(val: any): DatabaseAggregateCommand + lte(val: any): DatabaseAggregateCommand + ltrim(val: any): DatabaseAggregateCommand + map(val: any): DatabaseAggregateCommand + max(val: any): DatabaseAggregateCommand + mergeObjects(val: any): DatabaseAggregateCommand + meta(val: any): DatabaseAggregateCommand + min(val: any): DatabaseAggregateCommand + millisecond(val: any): DatabaseAggregateCommand + minute(val: any): DatabaseAggregateCommand + mod(val: any): DatabaseAggregateCommand + month(val: any): DatabaseAggregateCommand + multiply(val: any): DatabaseAggregateCommand + neq(val: any): DatabaseAggregateCommand + not(val: any): DatabaseAggregateCommand + objectToArray(val: any): DatabaseAggregateCommand + or(val: any): DatabaseAggregateCommand + pow(val: any): DatabaseAggregateCommand + push(val: any): DatabaseAggregateCommand + range(val: any): DatabaseAggregateCommand + reduce(val: any): DatabaseAggregateCommand + reverseArray(val: any): DatabaseAggregateCommand + rtrim(val: any): DatabaseAggregateCommand + second(val: any): DatabaseAggregateCommand + setDifference(val: any): DatabaseAggregateCommand + setEquals(val: any): DatabaseAggregateCommand + setIntersection(val: any): DatabaseAggregateCommand + setIsSubset(val: any): DatabaseAggregateCommand + setUnion(val: any): DatabaseAggregateCommand + size(val: any): DatabaseAggregateCommand + slice(val: any): DatabaseAggregateCommand + split(val: any): DatabaseAggregateCommand + sqrt(val: any): DatabaseAggregateCommand + stdDevPop(val: any): DatabaseAggregateCommand + stdDevSamp(val: any): DatabaseAggregateCommand + strcasecmp(val: any): DatabaseAggregateCommand + strLenBytes(val: any): DatabaseAggregateCommand + strLenCP(val: any): DatabaseAggregateCommand + substr(val: any): DatabaseAggregateCommand + substrBytes(val: any): DatabaseAggregateCommand + substrCP(val: any): DatabaseAggregateCommand + subtract(val: any): DatabaseAggregateCommand + sum(val: any): DatabaseAggregateCommand + switch(val: any): DatabaseAggregateCommand + toBool(val: any): DatabaseAggregateCommand + toDate(val: any): DatabaseAggregateCommand + toDecimal(val: any): DatabaseAggregateCommand + toDouble(val: any): DatabaseAggregateCommand + toInt(val: any): DatabaseAggregateCommand + toLong(val: any): DatabaseAggregateCommand + toObjectId(val: any): DatabaseAggregateCommand + toString(val: any): DatabaseAggregateCommand + toLower(val: any): DatabaseAggregateCommand + toUpper(val: any): DatabaseAggregateCommand + trim(val: any): DatabaseAggregateCommand + trunc(val: any): DatabaseAggregateCommand + type(val: any): DatabaseAggregateCommand + week(val: any): DatabaseAggregateCommand + year(val: any): DatabaseAggregateCommand + zip(val: any): DatabaseAggregateCommand + } + } + + class DatabaseAggregateCommand {} + + enum LOGIC_COMMANDS_LITERAL { + AND = 'and', + OR = 'or', + NOT = 'not', + NOR = 'nor' + } + + class DatabaseLogicCommand { + and(...expressions: DatabaseLogicCommand[]): DatabaseLogicCommand + or(...expressions: DatabaseLogicCommand[]): DatabaseLogicCommand + nor(...expressions: DatabaseLogicCommand[]): DatabaseLogicCommand + not(expression: DatabaseLogicCommand): DatabaseLogicCommand + } + + enum QUERY_COMMANDS_LITERAL { + // comparison + EQ = 'eq', + NEQ = 'neq', + GT = 'gt', + GTE = 'gte', + LT = 'lt', + LTE = 'lte', + IN = 'in', + NIN = 'nin', + // geo + GEO_NEAR = 'geoNear', + GEO_WITHIN = 'geoWithin', + GEO_INTERSECTS = 'geoIntersects', + // element + EXISTS = 'exists', + // evaluation + MOD = 'mod', + // array + ALL = 'all', + ELEM_MATCH = 'elemMatch', + SIZE = 'size' + } + + class DatabaseQueryCommand extends DatabaseLogicCommand { + eq(val: any): DatabaseLogicCommand + neq(val: any): DatabaseLogicCommand + gt(val: any): DatabaseLogicCommand + gte(val: any): DatabaseLogicCommand + lt(val: any): DatabaseLogicCommand + lte(val: any): DatabaseLogicCommand + in(val: any[]): DatabaseLogicCommand + nin(val: any[]): DatabaseLogicCommand + + exists(val: boolean): DatabaseLogicCommand + + mod(divisor: number, remainder: number): DatabaseLogicCommand + + all(val: any[]): DatabaseLogicCommand + elemMatch(val: any): DatabaseLogicCommand + size(val: number): DatabaseLogicCommand + + geoNear(options: IGeoNearCommandOptions): DatabaseLogicCommand + geoWithin(options: IGeoWithinCommandOptions): DatabaseLogicCommand + geoIntersects( + options: IGeoIntersectsCommandOptions + ): DatabaseLogicCommand + } + + enum PROJECTION_COMMANDS_LITERAL { + SLICE = 'slice' + } + + class DatabaseProjectionCommand {} + + enum UPDATE_COMMANDS_LITERAL { + // field + SET = 'set', + REMOVE = 'remove', + INC = 'inc', + MUL = 'mul', + MIN = 'min', + MAX = 'max', + RENAME = 'rename', + // bitwise + BIT = 'bit', + // array + PUSH = 'push', + POP = 'pop', + SHIFT = 'shift', + UNSHIFT = 'unshift', + ADD_TO_SET = 'addToSet', + PULL = 'pull', + PULL_ALL = 'pullAll' + } + + class DatabaseUpdateCommand {} + + class Batch {} + + /** + * A contract that all API provider must adhere to + */ + class APIBaseContract< + PromiseReturn, + CallbackReturn, + Param extends IAPIParam, + Context = any + > { + getContext(param: Param): Context + + /** + * In case of callback-style invocation, this function will be called + */ + getCallbackReturn(param: Param, context: Context): CallbackReturn + + getFinalParam(param: Param, context: Context): T + + run(param: T): Promise + } + + interface IGeoPointConstructor { + new (longitude: number, latitide: number): GeoPoint + new (geojson: IGeoJSONPoint): GeoPoint + (longitude: number, latitide: number): GeoPoint + (geojson: IGeoJSONPoint): GeoPoint + } + + interface IGeoMultiPointConstructor { + new (points: GeoPoint[] | IGeoJSONMultiPoint): GeoMultiPoint + (points: GeoPoint[] | IGeoJSONMultiPoint): GeoMultiPoint + } + + interface IGeoLineStringConstructor { + new (points: GeoPoint[] | IGeoJSONLineString): GeoLineString + (points: GeoPoint[] | IGeoJSONLineString): GeoLineString + } + + interface IGeoMultiLineStringConstructor { + new ( + lineStrings: GeoLineString[] | IGeoJSONMultiLineString + ): GeoMultiLineString + ( + lineStrings: GeoLineString[] | IGeoJSONMultiLineString + ): GeoMultiLineString + } + + interface IGeoPolygonConstructor { + new (lineStrings: GeoLineString[] | IGeoJSONPolygon): GeoPolygon + (lineStrings: GeoLineString[] | IGeoJSONPolygon): GeoPolygon + } + + interface IGeoMultiPolygonConstructor { + new (polygons: GeoPolygon[] | IGeoJSONMultiPolygon): GeoMultiPolygon + (polygons: GeoPolygon[] | IGeoJSONMultiPolygon): GeoMultiPolygon + } + + interface IGeo { + Point: IGeoPointConstructor + MultiPoint: IGeoMultiPointConstructor + LineString: IGeoLineStringConstructor + MultiLineString: IGeoMultiLineStringConstructor + Polygon: IGeoPolygonConstructor + MultiPolygon: IGeoMultiPolygonConstructor + } + + interface IGeoJSONPoint { + type: 'Point' + coordinates: [number, number] + } + + interface IGeoJSONMultiPoint { + type: 'MultiPoint' + coordinates: Array<[number, number]> + } + + interface IGeoJSONLineString { + type: 'LineString' + coordinates: Array<[number, number]> + } + + interface IGeoJSONMultiLineString { + type: 'MultiLineString' + coordinates: Array> + } + + interface IGeoJSONPolygon { + type: 'Polygon' + coordinates: Array> + } + + interface IGeoJSONMultiPolygon { + type: 'MultiPolygon' + coordinates: Array>> + } + + type IGeoJSONObject = + | IGeoJSONPoint + | IGeoJSONMultiPoint + | IGeoJSONLineString + | IGeoJSONMultiLineString + | IGeoJSONPolygon + | IGeoJSONMultiPolygon + + abstract class GeoPoint { + longitude: number + latitude: number + + constructor(longitude: number, latitude: number) + + toJSON(): Record + toString(): string + } + + abstract class GeoMultiPoint { + points: GeoPoint[] + + constructor(points: GeoPoint[]) + + toJSON(): IGeoJSONMultiPoint + toString(): string + } + + abstract class GeoLineString { + points: GeoPoint[] + + constructor(points: GeoPoint[]) + + toJSON(): IGeoJSONLineString + toString(): string + } + + abstract class GeoMultiLineString { + lines: GeoLineString[] + + constructor(lines: GeoLineString[]) + + toJSON(): IGeoJSONMultiLineString + toString(): string + } + + abstract class GeoPolygon { + lines: GeoLineString[] + + constructor(lines: GeoLineString[]) + + toJSON(): IGeoJSONPolygon + toString(): string + } + + abstract class GeoMultiPolygon { + polygons: GeoPolygon[] + + constructor(polygons: GeoPolygon[]) + + toJSON(): IGeoJSONMultiPolygon + toString(): string + } + + type GeoInstance = + | GeoPoint + | GeoMultiPoint + | GeoLineString + | GeoMultiLineString + | GeoPolygon + | GeoMultiPolygon + + interface IGeoNearCommandOptions { + geometry: GeoPoint + maxDistance?: number + minDistance?: number + } + + interface IGeoWithinCommandOptions { + geometry: GeoPolygon | GeoMultiPolygon + } + + interface IGeoIntersectsCommandOptions { + geometry: + | GeoPoint + | GeoMultiPoint + | GeoLineString + | GeoMultiLineString + | GeoPolygon + | GeoMultiPolygon + } + + interface IServerDateOptions { + offset: number + } + + abstract class ServerDate { + readonly options: IServerDateOptions + constructor(options?: IServerDateOptions) + } + + interface IRegExpOptions { + regexp: string + options?: string + } + + interface IRegExpConstructor { + new (options: IRegExpOptions): RegExp + (options: IRegExpOptions): RegExp + } + + abstract class RegExp { + readonly regexp: string + readonly options: string + constructor(options: IRegExpOptions) + } + + type DocumentId = string | number + + interface IDocumentData { + _id?: DocumentId + [key: string]: any + } + + type IDBAPIParam = IAPIParam + + interface IAddDocumentOptions extends IDBAPIParam { + data: IDocumentData + } + + type IGetDocumentOptions = IDBAPIParam + + type ICountDocumentOptions = IDBAPIParam + + interface IUpdateDocumentOptions extends IDBAPIParam { + data: IUpdateCondition + } + + interface IUpdateSingleDocumentOptions extends IDBAPIParam { + data: IUpdateCondition + } + + interface ISetDocumentOptions extends IDBAPIParam { + data: IUpdateCondition + } + + interface ISetSingleDocumentOptions extends IDBAPIParam { + data: IUpdateCondition + } + + interface IRemoveDocumentOptions extends IDBAPIParam { + query: IQueryCondition + } + + type IRemoveSingleDocumentOptions = IDBAPIParam + + interface IWatchOptions { + // server realtime data init & change event + onChange: (snapshot: ISnapshot) => void + // error while connecting / listening + onError: (error: any) => void + } + + interface ISnapshot { + id: number + docChanges: ISingleDBEvent[] + docs: Record + type?: SnapshotType + } + + type SnapshotType = 'init' + + interface ISingleDBEvent { + id: number + dataType: DataType + queueType: QueueType + docId: string + doc: Record + updatedFields?: Record + removedFields?: string[] + } + + type DataType = 'init' | 'update' | 'replace' | 'add' | 'remove' | 'limit' + + type QueueType = 'init' | 'enqueue' | 'dequeue' | 'update' + + interface IQueryCondition { + [key: string]: any + } + + type IStringQueryCondition = string + + interface IQueryResult extends IAPISuccessParam { + data: IDocumentData[] + } + + interface IQuerySingleResult extends IAPISuccessParam { + data: IDocumentData + } + + interface IUpdateCondition { + [key: string]: any + } + + type IStringUpdateCondition = string + + interface IAddResult extends IAPISuccessParam { + _id: DocumentId + } + + interface IUpdateResult extends IAPISuccessParam { + stats: { + updated: number + // created: number, + } + } + + interface ISetResult extends IAPISuccessParam { + _id: DocumentId + stats: { + updated: number + created: number + } + } + + interface IRemoveResult extends IAPISuccessParam { + stats: { + removed: number + } + } + + interface ICountResult extends IAPISuccessParam { + total: number + } +} + +type Optional = { [K in keyof T]+?: T[K] } + +type OQ< + T extends Optional< + Record<'complete' | 'success' | 'fail', (...args: any[]) => any> + > +> = + | (RQ & Required>) + | (RQ & Required>) + | (RQ & Required>) + | (RQ & Required>) + | (RQ & Required>) + | (RQ & Required>) + | (RQ & Required>) + +type RQ< + T extends Optional< + Record<'complete' | 'success' | 'fail', (...args: any[]) => any> + > +> = Pick> diff --git a/frontend_miniprogram/typings/types/wx/lib.wx.component.d.ts b/frontend_miniprogram/typings/types/wx/lib.wx.component.d.ts new file mode 100644 index 0000000..36f055c --- /dev/null +++ b/frontend_miniprogram/typings/types/wx/lib.wx.component.d.ts @@ -0,0 +1,636 @@ +/*! ***************************************************************************** +Copyright (c) 2021 Tencent, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +***************************************************************************** */ + +declare namespace WechatMiniprogram.Component { + type Instance< + TData extends DataOption, + TProperty extends PropertyOption, + TMethod extends Partial, + TCustomInstanceProperty extends IAnyObject = {}, + TIsPage extends boolean = false + > = InstanceProperties & + InstanceMethods & + TMethod & + (TIsPage extends true ? Page.ILifetime : {}) & + TCustomInstanceProperty & { + /** 组件数据,**包括内部数据和属性值** */ + data: TData & PropertyOptionToData + /** 组件数据,**包括内部数据和属性值**(与 `data` 一致) */ + properties: TData & PropertyOptionToData + } + type TrivialInstance = Instance< + IAnyObject, + IAnyObject, + IAnyObject, + IAnyObject + > + type TrivialOption = Options + type Options< + TData extends DataOption, + TProperty extends PropertyOption, + TMethod extends MethodOption, + TCustomInstanceProperty extends IAnyObject = {}, + TIsPage extends boolean = false + > = Partial> & + Partial> & + Partial> & + Partial & + Partial & + ThisType< + Instance< + TData, + TProperty, + TMethod, + TCustomInstanceProperty, + TIsPage + > + > + interface Constructor { + < + TData extends DataOption, + TProperty extends PropertyOption, + TMethod extends MethodOption, + TCustomInstanceProperty extends IAnyObject = {}, + TIsPage extends boolean = false + >( + options: Options< + TData, + TProperty, + TMethod, + TCustomInstanceProperty, + TIsPage + > + ): string + } + type DataOption = Record + type PropertyOption = Record + type MethodOption = Record + + interface Data { + /** 组件的内部数据,和 `properties` 一同用于组件的模板渲染 */ + data?: D + } + interface Property

{ + /** 组件的对外属性,是属性名到属性设置的映射表 */ + properties: P + } + interface Method { + /** 组件的方法,包括事件响应函数和任意的自定义方法,关于事件响应函数的使用,参见 [组件间通信与事件](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/events.html) */ + methods: M & (TIsPage extends true ? Partial : {}) + } + type PropertyType = + | StringConstructor + | NumberConstructor + | BooleanConstructor + | ArrayConstructor + | ObjectConstructor + | null + type ValueType = T extends null + ? any + : T extends StringConstructor + ? string + : T extends NumberConstructor + ? number + : T extends BooleanConstructor + ? boolean + : T extends ArrayConstructor + ? any[] + : T extends ObjectConstructor + ? IAnyObject + : never + type FullProperty = { + /** 属性类型 */ + type: T + /** 属性初始值 */ + value?: ValueType + /** 属性值被更改时的响应函数 */ + observer?: + | string + | (( + newVal: ValueType, + oldVal: ValueType, + changedPath: Array + ) => void) + /** 属性的类型(可以指定多个) */ + optionalTypes?: ShortProperty[] + } + type AllFullProperty = + | FullProperty + | FullProperty + | FullProperty + | FullProperty + | FullProperty + | FullProperty + type ShortProperty = + | StringConstructor + | NumberConstructor + | BooleanConstructor + | ArrayConstructor + | ObjectConstructor + | null + type AllProperty = AllFullProperty | ShortProperty + type PropertyToData = T extends ShortProperty + ? ValueType + : FullPropertyToData> + type FullPropertyToData = ValueType + type PropertyOptionToData

= { + [name in keyof P]: PropertyToData + } + + interface InstanceProperties { + /** 组件的文件路径 */ + is: string + /** 节点id */ + id: string + /** 节点dataset */ + dataset: Record + } + + interface InstanceMethods { + /** `setData` 函数用于将数据从逻辑层发送到视图层 + *(异步),同时改变对应的 `this.data` 的值(同步)。 + * + * **注意:** + * + * 1. **直接修改 this.data 而不调用 this.setData 是无法改变页面的状态的,还会造成数据不一致**。 + * 1. 仅支持设置可 JSON 化的数据。 + * 1. 单次设置的数据不能超过1024kB,请尽量避免一次设置过多的数据。 + * 1. 请不要把 data 中任何一项的 value 设为 `undefined` ,否则这一项将不被设置并可能遗留一些潜在问题。 + */ + setData( + /** 这次要改变的数据 + * + * 以 `key: value` 的形式表示,将 `this.data` 中的 `key` 对应的值改变成 `value`。 + * + * 其中 `key` 可以以数据路径的形式给出,支持改变数组中的某一项或对象的某个属性,如 `array[2].message`,`a.b.c.d`,并且不需要在 this.data 中预先定义。 + */ + data: Partial & IAnyObject, + /** setData引起的界面更新渲染完毕后的回调函数,最低基础库: `1.5.0` */ + callback?: () => void + ): void + + /** 检查组件是否具有 `behavior` (检查时会递归检查被直接或间接引入的所有behavior) */ + hasBehavior(behavior: Behavior.BehaviorIdentifier): void + /** 触发事件,参见组件事件 */ + triggerEvent( + name: string, + detail?: DetailType, + options?: TriggerEventOption + ): void + /** 创建一个 SelectorQuery 对象,选择器选取范围为这个组件实例内 */ + createSelectorQuery(): SelectorQuery + /** 创建一个 IntersectionObserver 对象,选择器选取范围为这个组件实例内 */ + createIntersectionObserver( + options: CreateIntersectionObserverOption + ): IntersectionObserver + /** 使用选择器选择组件实例节点,返回匹配到的第一个组件实例对象(会被 `wx://component-export` 影响) */ + selectComponent(selector: string): TrivialInstance + /** 使用选择器选择组件实例节点,返回匹配到的全部组件实例对象组成的数组 */ + selectAllComponents(selector: string): TrivialInstance[] + /** + * 选取当前组件节点所在的组件实例(即组件的引用者),返回它的组件实例对象(会被 `wx://component-export` 影响) + * + * 最低基础库版本:[`2.8.2`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + **/ + selectOwnerComponent(): TrivialInstance + /** 获取这个关系所对应的所有关联节点,参见 组件间关系 */ + getRelationNodes(relationKey: string): TrivialInstance[] + /** + * 立刻执行 callback ,其中的多个 setData 之间不会触发界面绘制(只有某些特殊场景中需要,如用于在不同组件同时 setData 时进行界面绘制同步) + * + * 最低基础库版本:[`2.4.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + **/ + groupSetData(callback?: () => void): void + /** + * 返回当前页面的 custom-tab-bar 的组件实例 + * + * 最低基础库版本:[`2.6.2`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + **/ + getTabBar(): TrivialInstance + /** + * 返回页面标识符(一个字符串),可以用来判断几个自定义组件实例是不是在同一个页面内 + * + * 最低基础库版本:[`2.7.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + **/ + getPageId(): string + /** + * 执行关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) + * + * 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + **/ + animate( + selector: string, + keyFrames: KeyFrame[], + duration: number, + callback?: () => void + ): void + /** + * 执行关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) + * + * 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + **/ + animate( + selector: string, + keyFrames: ScrollTimelineKeyframe[], + duration: number, + scrollTimeline: ScrollTimelineOption + ): void + /** + * 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) + * + * 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + **/ + clearAnimation(selector: string, callback: () => void): void + /** + * 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) + * + * 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + **/ + clearAnimation( + selector: string, + options?: ClearAnimationOptions, + callback?: () => void + ): void + getOpenerEventChannel(): EventChannel + } + + interface ComponentOptions { + /** + * [启用多slot支持](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html#组件wxml的slot) + */ + multipleSlots?: boolean + /** + * [组件样式隔离](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html#组件样式隔离) + */ + addGlobalClass?: boolean + /** + * [组件样式隔离](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html#组件样式隔离) + */ + styleIsolation?: + | 'isolated' + | 'apply-shared' + | 'shared' + | 'page-isolated' + | 'page-apply-shared' + | 'page-shared' + /** + * [纯数据字段](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/pure-data.html) 是一些不用于界面渲染的 data 字段,可以用于提升页面更新性能。从小程序基础库版本 2.8.2 开始支持。 + */ + pureDataPattern?: RegExp + /** + * [虚拟化组件节点](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html#%E8%99%9A%E6%8B%9F%E5%8C%96%E7%BB%84%E4%BB%B6%E8%8A%82%E7%82%B9) 使自定义组件内部的第一层节点由自定义组件本身完全决定。从小程序基础库版本 [`2.11.2`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 开始支持 */ + virtualHost?: boolean + } + + interface TriggerEventOption { + /** 事件是否冒泡 + * + * 默认值: `false` + */ + bubbles?: boolean + /** 事件是否可以穿越组件边界,为false时,事件将只能在引用组件的节点树上触发,不进入其他任何组件内部 + * + * 默认值: `false` + */ + composed?: boolean + /** 事件是否拥有捕获阶段 + * + * 默认值: `false` + */ + capturePhase?: boolean + } + + interface RelationOption { + /** 目标组件的相对关系 */ + type: 'parent' | 'child' | 'ancestor' | 'descendant' + /** 关系生命周期函数,当关系被建立在页面节点树中时触发,触发时机在组件attached生命周期之后 */ + linked?(target: TrivialInstance): void + /** 关系生命周期函数,当关系在页面节点树中发生改变时触发,触发时机在组件moved生命周期之后 */ + linkChanged?(target: TrivialInstance): void + /** 关系生命周期函数,当关系脱离页面节点树时触发,触发时机在组件detached生命周期之后 */ + unlinked?(target: TrivialInstance): void + /** 如果这一项被设置,则它表示关联的目标节点所应具有的behavior,所有拥有这一behavior的组件节点都会被关联 */ + target?: string + } + + interface PageLifetimes { + /** 页面生命周期回调—监听页面显示 + * + * 页面显示/切入前台时触发。 + */ + show(): void + /** 页面生命周期回调—监听页面隐藏 + * + * 页面隐藏/切入后台时触发。 如 `navigateTo` 或底部 `tab` 切换到其他页面,小程序切入后台等。 + */ + hide(): void + /** 页面生命周期回调—监听页面尺寸变化 + * + * 所在页面尺寸变化时执行 + */ + resize(size: Page.IResizeOption): void + } + + type DefinitionFilter = ( + /** 使用该 behavior 的 component/behavior 的定义对象 */ + defFields: T, + /** 该 behavior 所使用的 behavior 的 definitionFilter 函数列表 */ + definitionFilterArr?: DefinitionFilter[] + ) => void + + interface Lifetimes { + /** 组件生命周期声明对象,组件的生命周期:`created`、`attached`、`ready`、`moved`、`detached` 将收归到 `lifetimes` 字段内进行声明,原有声明方式仍旧有效,如同时存在两种声明方式,则 `lifetimes` 字段内声明方式优先级最高 + * + * 最低基础库: `2.2.3` */ + lifetimes: Partial<{ + /** + * 在组件实例刚刚被创建时执行,注意此时不能调用 `setData` + * + * 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + */ + created(): void + /** + * 在组件实例进入页面节点树时执行 + * + * 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + */ + attached(): void + /** + * 在组件在视图层布局完成后执行 + * + * 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + */ + ready(): void + /** + * 在组件实例被移动到节点树另一个位置时执行 + * + * 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + */ + moved(): void + /** + * 在组件实例被从页面节点树移除时执行 + * + * 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + */ + detached(): void + /** + * 每当组件方法抛出错误时执行 + * + * 最低基础库版本:[`2.4.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + */ + error(err: Error): void + }> + /** + * @deprecated 旧式的定义方式,基础库 `2.2.3` 起请在 lifetimes 中定义 + * + * 在组件实例刚刚被创建时执行 + * + * 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + */ + created(): void + /** + * @deprecated 旧式的定义方式,基础库 `2.2.3` 起请在 lifetimes 中定义 + * + * 在组件实例进入页面节点树时执行 + * + * 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + */ + attached(): void + /** + * @deprecated 旧式的定义方式,基础库 `2.2.3` 起请在 lifetimes 中定义 + * + * 在组件在视图层布局完成后执行 + * + * 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + */ + ready(): void + /** + * @deprecated 旧式的定义方式,基础库 `2.2.3` 起请在 lifetimes 中定义 + * + * 在组件实例被移动到节点树另一个位置时执行 + * + * 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + */ + moved(): void + /** + * @deprecated 旧式的定义方式,基础库 `2.2.3` 起请在 lifetimes 中定义 + * + * 在组件实例被从页面节点树移除时执行 + * + * 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + */ + detached(): void + /** + * @deprecated 旧式的定义方式,基础库 `2.2.3` 起请在 lifetimes 中定义 + * + * 每当组件方法抛出错误时执行 + * + * 最低基础库版本:[`2.4.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + */ + error(err: Error): void + } + + interface OtherOption { + /** 类似于mixins和traits的组件间代码复用机制,参见 [behaviors](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/behaviors.html) */ + behaviors: Behavior.BehaviorIdentifier[] + /** + * 组件数据字段监听器,用于监听 properties 和 data 的变化,参见 [数据监听器](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/observer.html) + * + * 最低基础库版本:[`2.6.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) + */ + observers: Record any> + /** 组件间关系定义,参见 [组件间关系](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/lifetimes.html) */ + relations: { + [componentName: string]: RelationOption + } + /** 组件接受的外部样式类,参见 [外部样式类](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html) */ + externalClasses?: string[] + /** 组件所在页面的生命周期声明对象,参见 [组件生命周期](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/lifetimes.html) + * + * 最低基础库版本: [`2.2.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) */ + pageLifetimes?: Partial + /** 一些选项(文档中介绍相关特性时会涉及具体的选项设置,这里暂不列举) */ + options: ComponentOptions + + /** 定义段过滤器,用于自定义组件扩展,参见 [自定义组件扩展](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/extend.html) + * + * 最低基础库版本: [`2.2.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) */ + definitionFilter?: DefinitionFilter + /** + * 组件自定义导出,当使用 `behavior: wx://component-export` 时,这个定义段可以用于指定组件被 selectComponent 调用时的返回值,参见 [组件间通信与事件](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/events.html) + * 最低基础库版本: [`2.2.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) */ + export: () => IAnyObject + } + + interface KeyFrame { + /** 关键帧的偏移,范围[0-1] */ + offset?: number + /** 动画缓动函数 */ + ease?: string + /** 基点位置,即 CSS transform-origin */ + transformOrigin?: string + /** 背景颜色,即 CSS background-color */ + backgroundColor?: string + /** 底边位置,即 CSS bottom */ + bottom?: number | string + /** 高度,即 CSS height */ + height?: number | string + /** 左边位置,即 CSS left */ + left?: number | string + /** 宽度,即 CSS width */ + width?: number | string + /** 不透明度,即 CSS opacity */ + opacity?: number | string + /** 右边位置,即 CSS right */ + right?: number | string + /** 顶边位置,即 CSS top */ + top?: number | string + /** 变换矩阵,即 CSS transform matrix */ + matrix?: number[] + /** 三维变换矩阵,即 CSS transform matrix3d */ + matrix3d?: number[] + /** 旋转,即 CSS transform rotate */ + rotate?: number + /** 三维旋转,即 CSS transform rotate3d */ + rotate3d?: number[] + /** X 方向旋转,即 CSS transform rotateX */ + rotateX?: number + /** Y 方向旋转,即 CSS transform rotateY */ + rotateY?: number + /** Z 方向旋转,即 CSS transform rotateZ */ + rotateZ?: number + /** 缩放,即 CSS transform scale */ + scale?: number[] + /** 三维缩放,即 CSS transform scale3d */ + scale3d?: number[] + /** X 方向缩放,即 CSS transform scaleX */ + scaleX?: number + /** Y 方向缩放,即 CSS transform scaleY */ + scaleY?: number + /** Z 方向缩放,即 CSS transform scaleZ */ + scaleZ?: number + /** 倾斜,即 CSS transform skew */ + skew?: number[] + /** X 方向倾斜,即 CSS transform skewX */ + skewX?: number + /** Y 方向倾斜,即 CSS transform skewY */ + skewY?: number + /** 位移,即 CSS transform translate */ + translate?: Array + /** 三维位移,即 CSS transform translate3d */ + translate3d?: Array + /** X 方向位移,即 CSS transform translateX */ + translateX?: number | string + /** Y 方向位移,即 CSS transform translateY */ + translateY?: number | string + /** Z 方向位移,即 CSS transform translateZ */ + translateZ?: number | string + } + interface ClearAnimationOptions { + /** 基点位置,即 CSS transform-origin */ + transformOrigin?: boolean + /** 背景颜色,即 CSS background-color */ + backgroundColor?: boolean + /** 底边位置,即 CSS bottom */ + bottom?: boolean + /** 高度,即 CSS height */ + height?: boolean + /** 左边位置,即 CSS left */ + left?: boolean + /** 宽度,即 CSS width */ + width?: boolean + /** 不透明度,即 CSS opacity */ + opacity?: boolean + /** 右边位置,即 CSS right */ + right?: boolean + /** 顶边位置,即 CSS top */ + top?: boolean + /** 变换矩阵,即 CSS transform matrix */ + matrix?: boolean + /** 三维变换矩阵,即 CSS transform matrix3d */ + matrix3d?: boolean + /** 旋转,即 CSS transform rotate */ + rotate?: boolean + /** 三维旋转,即 CSS transform rotate3d */ + rotate3d?: boolean + /** X 方向旋转,即 CSS transform rotateX */ + rotateX?: boolean + /** Y 方向旋转,即 CSS transform rotateY */ + rotateY?: boolean + /** Z 方向旋转,即 CSS transform rotateZ */ + rotateZ?: boolean + /** 缩放,即 CSS transform scale */ + scale?: boolean + /** 三维缩放,即 CSS transform scale3d */ + scale3d?: boolean + /** X 方向缩放,即 CSS transform scaleX */ + scaleX?: boolean + /** Y 方向缩放,即 CSS transform scaleY */ + scaleY?: boolean + /** Z 方向缩放,即 CSS transform scaleZ */ + scaleZ?: boolean + /** 倾斜,即 CSS transform skew */ + skew?: boolean + /** X 方向倾斜,即 CSS transform skewX */ + skewX?: boolean + /** Y 方向倾斜,即 CSS transform skewY */ + skewY?: boolean + /** 位移,即 CSS transform translate */ + translate?: boolean + /** 三维位移,即 CSS transform translate3d */ + translate3d?: boolean + /** X 方向位移,即 CSS transform translateX */ + translateX?: boolean + /** Y 方向位移,即 CSS transform translateY */ + translateY?: boolean + /** Z 方向位移,即 CSS transform translateZ */ + translateZ?: boolean + } + interface ScrollTimelineKeyframe { + composite?: 'replace' | 'add' | 'accumulate' | 'auto' + easing?: string + offset?: number | null + [property: string]: string | number | null | undefined + } + interface ScrollTimelineOption { + /** 指定滚动元素的选择器(只支持 scroll-view),该元素滚动时会驱动动画的进度 */ + scrollSource: string + /** 指定滚动的方向。有效值为 horizontal 或 vertical */ + orientation?: string + /** 指定开始驱动动画进度的滚动偏移量,单位 px */ + startScrollOffset: number + /** 指定停止驱动动画进度的滚动偏移量,单位 px */ + endScrollOffset: number + /** 起始和结束的滚动范围映射的时间长度,该时间可用于与关键帧动画里的时间 (duration) 相匹配,单位 ms */ + timeRange: number + } +} +/** Component构造器可用于定义组件,调用Component构造器时可以指定组件的属性、数据、方法等。 + * + * * 使用 `this.data` 可以获取内部数据和属性值,但不要直接修改它们,应使用 `setData` 修改。 + * * 生命周期函数无法在组件方法中通过 `this` 访问到。 + * * 属性名应避免以 data 开头,即不要命名成 `dataXyz` 这样的形式,因为在 WXML 中, `data-xyz=""` 会被作为节点 dataset 来处理,而不是组件属性。 + * * 在一个组件的定义和使用时,组件的属性名和 data 字段相互间都不能冲突(尽管它们位于不同的定义段中)。 + * * 从基础库 `2.0.9` 开始,对象类型的属性和 data 字段中可以包含函数类型的子字段,即可以通过对象类型的属性字段来传递函数。低于这一版本的基础库不支持这一特性。 + * * `bug` : 对于 type 为 Object 或 Array 的属性,如果通过该组件自身的 `this.setData` 来改变属性值的一个子字段,则依旧会触发属性 observer ,且 observer 接收到的 `newVal` 是变化的那个子字段的值, `oldVal` 为空, `changedPath` 包含子字段的字段名相关信息。 + */ +declare let Component: WechatMiniprogram.Component.Constructor diff --git a/frontend_miniprogram/typings/types/wx/lib.wx.event.d.ts b/frontend_miniprogram/typings/types/wx/lib.wx.event.d.ts new file mode 100644 index 0000000..e091d1c --- /dev/null +++ b/frontend_miniprogram/typings/types/wx/lib.wx.event.d.ts @@ -0,0 +1,1435 @@ +/*! ***************************************************************************** +Copyright (c) 2021 Tencent, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +***************************************************************************** */ + +declare namespace WechatMiniprogram { + interface Target { + /** 事件组件的 id */ + id: string + /** 当前组件的类型 */ + tagName?: string + /** 事件组件上由 `data-` 开头的自定义属性组成的集合 */ + dataset: DataSet + /** 距离页面顶部的偏移量 */ + offsetTop: number + /** 距离页面左边的偏移量 */ + offsetLeft: number + } + + /** 基础事件参数 */ + interface BaseEvent< + Mark extends IAnyObject = IAnyObject, + CurrentTargetDataset extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = CurrentTargetDataset + > { + /** 事件类型 */ + type: string + /** 页面打开到触发事件所经过的毫秒数 */ + timeStamp: number + /** 事件冒泡路径上所有由 `mark:` 开头的自定义属性组成的集合 */ + mark?: Mark + /** 触发事件的源组件 */ + target: Target + /** 事件绑定的当前组件 */ + currentTarget: Target + } + + /** 自定义事件 */ + interface CustomEvent< + Detail extends IAnyObject = IAnyObject, + Mark extends IAnyObject = IAnyObject, + CurrentTargetDataset extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = CurrentTargetDataset + > extends BaseEvent { + /** 额外的信息 */ + detail: Detail + } + + /** Touch 对象 */ + interface TouchDetail { + /** 距离页面可显示区域 (屏幕除去导航条) 左上角距离,横向为 X 轴 */ + clientX: number + /** 距离页面可显示区域 (屏幕除去导航条) 左上角距离,纵向为 Y 轴 */ + clientY: number + /** 触摸点的标识符 */ + identifier: number + /** 距离文档左上角的距离,文档的左上角为原点,横向为 X 轴 */ + pageX: number + /** 距离文档左上角的距离,文档的左上角为原点,纵向为 Y 轴 */ + pageY: number + } + + /** canvas Touch 对象 */ + interface TouchCanvasDetail { + /** 触摸点的标识符 */ + identifier: number + /** 距离 Canvas 左上角的距离,Canvas 的左上角为原点 ,横向为X轴 */ + x: number + /** 距离 Canvas 左上角的距离,Canvas 的左上角为原点 纵向为Y轴 */ + y: number + } + + /** 触摸事件 */ + interface Touch< + Detail extends IAnyObject = IAnyObject, + T extends TouchDetail | TouchCanvasDetail = TouchDetail, + Mark extends IAnyObject = IAnyObject, + CurrentTargetDataset extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = CurrentTargetDataset + > extends CustomEvent { + /** 触摸事件,当前停留在屏幕中的触摸点信息的数组 */ + touches: T[] + /** 触摸事件,当前变化的触摸点信息的数组 */ + changedTouches: T[] + } + + /** 触摸事件响应 */ + type TouchEvent< + Detail extends IAnyObject = IAnyObject, + Mark extends IAnyObject = IAnyObject, + CurrentTargetDataset extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = CurrentTargetDataset + > = Touch + + /** canvas 触摸事件响应 */ + interface TouchCanvas< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > extends Touch { + // canvas 中的触摸事件不可冒泡,所以没有 currentTarget。 + currentTarget: never + } + + /** + * 图片加载成功时触发 + * + * 最低基础库: 2.1.0 + */ + type CoverImageLoad< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + /** 图片宽度 */ + width: number + /** 图片高度 */ + height: number + }, + Mark, + TargetDataset + > + + /** + * 图片加载失败时触发 + * + * 最低基础库: 2.1.0 + */ + type CoverImageError = CustomEvent + + /** + * 拖动过程中触发的事件,event.detail = {x, y, source} + * + * 最低基础库: 1.9.90 + */ + type MovableViewChange< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + x: number + y: number + /** + * 产生移动的原因 + * + * - `touch` 拖动 + * - `touch-out-of-bounds` 超出移动范围 + * - `out-of-bounds` 超出移动范围后的回弹 + * - `friction` 惯性 + * - `空字符串` setData + */ + source: + | 'touch' + | 'touch-out-of-bounds' + | 'out-of-bounds' + | 'friction' + | '' + }, + Mark, + TargetDataset + > + + /** + * 缩放过程中触发的事件 + * + * event.detail = {x, y, scale} + * + * x 和 y 字段在 2.1.0 之后支持 + * + * 最低基础库: 1.9.90 + */ + type MovableViewScale< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + /** 最低基础库: 2.1.0 */ + x: number + /** 最低基础库: 2.1.0 */ + y: number + scale: number + }, + Mark, + TargetDataset + > + + /** + * 滑动开始事件 (同时开启 enhanced 属性后生效) + * + * detail { scrollTop, scrollLeft } + * + * 最低基础库: 2.12.0 + */ + type ScrollViewDragStart< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + scrollTop: number + scrollLeft: number + }, + Mark, + TargetDataset + > + + /** + * 滑动事件 (同时开启 enhanced 属性后生效) + * + * detail { scrollTop, scrollLeft } + * + * 最低基础库: 2.12.0 + */ + type ScrollViewDragging< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + scrollTop: number + scrollLeft: number + }, + Mark, + TargetDataset + > + + /** + * 滑动结束事件 (同时开启 enhanced 属性后生效) + * + * detail { scrollTop, scrollLeft } + * + * 最低基础库: 2.12.0 + */ + type ScrollViewDragEnd< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + scrollTop: number + scrollLeft: number + }, + Mark, + TargetDataset + > + + /** 滚动到顶部/左边时触发 */ + type ScrollViewScrollToUpper< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + direction: 'top' | 'left' + }, + Mark, + TargetDataset + > + + /** 滚动到底部/右边时触发 */ + type ScrollViewScrollToLower< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + direction: 'bottom' | 'right' + }, + Mark, + TargetDataset + > + + /** + * 滚动时触发 + * + * event.detail = {scrollLeft, scrollTop, scrollHeight, scrollWidth, deltaX, deltaY} + */ + type ScrollViewScroll< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + scrollLeft: number + scrollTop: number + scrollHeight: number + scrollWidth: number + deltaX: number + deltaY: number + }, + Mark, + TargetDataset + > + + type ScrollViewRefresherPulling< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent + + type ScrollViewRefresherRefresh< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent + + type ScrollViewRefresherRestore< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent + + type ScrollViewRefresherAbort< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent + + /** + * current 改变时会触发 change 事件 + * + * event.detail = {current, source} + * + * **Tip**: 如果在 bindchange 的事件回调函数中使用 setData 改变 current 值,则有可能导致 setData 被不停地调用,因而通常情况下请在改变 current 值前检测 source 字段来判断是否是由于用户触摸引起。 + */ + type SwiperChange< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + current: number + /** + * 表示导致变更的原因 + * + * - `autoplay` 自动播放导致 swiper 变化; + * - `touch` 用户划动引起 swiper 变化; + * - 其它原因将用空字符串表示。 + * + * 最低基础库: 1.4.0 + */ + source: '' | 'autoplay' | 'touch' + /** 该 swiper-item 的标识符 */ + currentItemId: string + }, + Mark, + TargetDataset + > + + /** + * swiper-item 的位置发生改变时会触发 transition 事件 + * + * event.detail = {dx: dx, dy: dy} + * + * 最低基础库: 2.4.3 + */ + type SwiperTransition< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + dx: number + dy: number + }, + Mark, + TargetDataset + > + + /** + * 动画结束时会触发 animationfinish 事件 + * + * 最低基础库: 1.9.0 + */ + type SwiperAnimationFinish< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = SwiperChange + + /** + * progress 动画完成事件 + * + * 最低基础库 2.4.1 + */ + type ProgressActiveEnd< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + curPercent: number + }, + Mark, + TargetDataset + > + + /** + * 用户点击该按钮时,会返回获取到的用户信息,回调的 detail 数据与 `wx. getUserInfo` 返回的一致,`open-type="getUserInfo"` 时有效 + * + * 最低基础库: 1.3.0 + */ + type ButtonGetUserInfo = CustomEvent< + GeneralCallbackResult & GetUserInfoSuccessCallbackResult + > + + /** + * 客服消息回调,`open-type="contact"` 时有效 + * + * 最低基础库: 1.5.0 + */ + type ButtonContact = CustomEvent + + /** + * 获取用户手机号回调,`open-type=getPhoneNumber` 时有效 + * + * 最低基础库: 1.2.0 + */ + type ButtonGetPhoneNumber = CustomEvent< + GeneralCallbackResult & Partial + > + + /** + * 当使用开放能力时,发生错误的回调,`open-type=launchApp` 时有效 + * + * 最低基础库: 1.9.5 + */ + type ButtonError = CustomEvent + + /** + * 在打开授权设置页后回调,`open-type=openSetting` 时有效 + * + * 最低基础库: 2.0.7 + */ + type ButtonOpenSetting = CustomEvent< + GeneralCallbackResult & OpenSettingSuccessCallbackResult + > + + /** + * 打开 APP 成功的回调,`open-type=launchApp` 时有效 + * + * 最低基础库: 2.4.4 + */ + type ButtonLaunchApp = CustomEvent + + /** + * checkbox-group 中选中项发生改变时触发 change 事件 + * + * detail = { value: ['选中的checkbox 的 value 的数组'] } + */ + type CheckboxGroupChange< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + /** 选中的 checkbox 的 value 的数组 */ + value: string[] + }, + Mark, + TargetDataset + > + + /** + * 编辑器初始化完成时触发 + * + * 最低基础库: 2.7.0 + */ + type EditorReady< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent + + /** + * 编辑器聚焦时触发 + * + * event.detail = {html, text, delta} + * + * 最低基础库: 2.7.0 + */ + type EditorFocus< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + html: string + text: string + // eslint-disable-next-line @typescript-eslint/no-explicit-any + delta: any[] + }, + Mark, + TargetDataset + > + + /** + * 编辑器失去焦点时触发 + * + * detail = {html, text, delta} + * + * 最低基础库: 2.7.0 + */ + type EditorBlur< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = EditorFocus + + /** + * 编辑器内容改变时触发 + * + * detail = {html, text, delta} + * + * 最低基础库: 2.7.0 + */ + type EditorInput< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = EditorFocus + + /** + * 通过 Context 方法改变编辑器内样式时触发,返回选区已设置的样式 + * + * 最低基础库: 2.7.0 + */ + type EditorStatusChange< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + Partial<{ + align: 'left' | 'center' | 'right' | 'justify' + bold: 'strong' + italic: 'em' + underline: true + strike: 'del' + lineHeight: string + letterSpacing: string + marginTop: string + marginBottom: string + fontFamily: string + fontSize: string + color: string + backgroundColor: string + list: 'checked' | 'unchecked' | 'ordered' | 'bullet' + indent: number + header: number + script: 'sub' | 'super' + direction: 'rtl' + }>, + Mark, + TargetDataset + > + + /** + * 携带 form 中的数据触发 submit 事件 + * + * event.detail = {value : {'name': 'value'} , formId: ''} + */ + type FormSubmit< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + formId?: unknown + target: Target + /** 表单中的数据,需要在表单组件中加上 name 来作为 key。 */ + value: IAnyObject + }, + Mark, + TargetDataset + > + + /** 表单重置时会触发 reset 事件 */ + type FormReset< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + target: Target + }, + Mark, + TargetDataset + > + + /** 键盘输入时触发 + * + * event.detail = {value, cursor, keyCode} + * + * 处理函数可以直接 return 一个字符串,将替换输入框的内容。 + */ + type Input< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + /** 输入框内容 */ + value: string + /** 光标位置 */ + cursor: number + /** keyCode 为键值 (目前工具还不支持返回keyCode参数) `2.1.0` 起支持 */ + keyCode?: number + }, + Mark, + TargetDataset + > + + /** + * 输入框聚焦时触发 + * + * event.detail = { value, height } + */ + type InputFocus< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + /** 输入框内容 */ + value: string + /** 键盘高度, 在基础库 `1.9.90` 起支持 */ + height: number + }, + Mark, + TargetDataset + > + + /** + * 输入框失去焦点时触发 + * + * event.detail = {value: value} + */ + type InputBlur< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + /** 输入框内容 */ + value: string + }, + Mark, + TargetDataset + > + + /** + * 点击完成按钮时触发 + * + * event.detail = {value: value} + */ + type InputConfirm< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + /** 输入框内容 */ + value: string + }, + Mark, + TargetDataset + > + + /** + * 键盘高度发生变化的时候触发此事件 + * + * event.detail = {height: height, duration: duration} + * + * **tip**: 键盘高度发生变化,keyboardheightchange 事件可能会多次触发,开发者对于相同的 height 值应该忽略掉 + * + * 最低基础库: `2.7.0` + */ + type InputKeyboardHeightChange< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + /** 键盘高度 */ + height: number + duration: number + }, + Mark, + TargetDataset + > + + /** + * 取消选择时触发 + * + * 最低基础库: 1.9.90 + */ + type PickerCancel< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent + + /** + * value 改变时触发 change 事件 + * + * event.detail = {value} + * + * 当 mode = region 时 (最低基础库: 1.4.0) + * + * value 改变时触发 change 事件,event.detail = {value, code, postcode},其中字段 code 是统计用区划代码,postcode 是邮政编码 + */ + type PickerChange< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + /** + * 当 mode = selector 时, 返回当前选择的 value + * + * 当 mode = multiSelector 时, 返回一个索引数组 + * + * 当 mode = time | date 时, 返回 `"12:01"` | `"2016-09-01"` + * + * 当 mode = region 时, 返回 `["广东省", "广州市", "海珠区"]` + */ + value: string | number[] | [string, string, string] + /** 统计用区划代码 当 mode = region 时有效 (最低基础库: 1.4.0) */ + code: [string, string, string] + /** 邮政编码 当 mode = region 时有效 (最低基础库: 1.4.0) */ + postcode: string + }, + Mark, + TargetDataset + > + + /** 列改变时触发 当 `mode = multiSelector` 时有效 */ + type PickerColumnChange< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + /** 修改的列 */ + column: number + value: number + }, + Mark, + TargetDataset + > + + /** + * 滚动选择时触发 change 事件 + * + * event.detail = {value} + */ + type PickerViewChange< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + /** value 为数组,表示 picker-view 内的 picker-view-column 当前选择的是第几项 (下标从 0 开始) */ + value: number[] + }, + Mark, + TargetDataset + > + + /** + * 当滚动选择开始时候触发事件 + * + * 最低基础库: 2.3.1 + */ + type PickerViewPickStart< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent + + /** + * 当滚动选择结束时候触发事件 + * + * 最低基础库: 2.3.1 + */ + type PickerViewPickEnd< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent + + /** radio-group 切换事件 */ + type RadioGroupChange< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + /** radio-group 中选中项的 value */ + { + value: string + }, + Mark, + TargetDataset + > + + /** + * 完成一次拖动后触发的事件 + * + * event.detail = {value} + */ + type SliderChange< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + /** slider 的数值 0 - 100 */ + value: number + }, + Mark, + TargetDataset + > + + /** + * 拖动过程中触发的事件 + * + * event.detail = {value} + * + * 最低基础库: 1.7.0 + */ + type SliderChanging< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = SliderChange + + /** + * checked 改变时触发 change 事件 + * + * event.detail={ value} + */ + type SwitchChange< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + value: boolean + }, + Mark, + TargetDataset + > + + /** + * 输入框聚焦时触发 + * + * event.detail = { value, height },height 为键盘高度 + * + * 在基础库 1.9.90 起支持 + */ + type TextareaFocus< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = InputFocus + + /** + * 输入框失去焦点时触发 + * + * event.detail = {value, cursor} + * + * **tip**: textarea 的 blur 事件会晚于页面上的 tap 事件,如果需要在 button 的点击事件获取 textarea,可以使用 form 的 bindsubmit。 + */ + type TextareaBlur< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = InputBlur + + /** + * 输入框行数变化时调用 + * + * event.detail = {height: 0, heightRpx: 0, lineCount: 0} + */ + type TextareaLineChange< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = CustomEvent< + { + /** 输入框高度(px) */ + height: number + /** 输入框高度(rpx) */ + heightRpx: number + /** 行数 */ + lineCount: number + /** 行高 */ + lineHeight: number + }, + Mark, + TargetDataset + > + + /** + * 当键盘输入时,触发 input 事件 + * + * event.detail = {value, cursor, keyCode} + * + * keyCode 为键值,目前工具还不支持返回 keyCode 参数。 + * + * **tip**: 不建议在多行文本上对用户的输入进行修改,所以 **bindinput 处理函数的返回值并不会反映到 textarea 上** + */ + type TextareaInput< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = Input + + /** + * 点击完成时, 触发 confirm 事件 + * + * event.detail = {value: value} + */ + type TextareaConfirm< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = InputConfirm + + /** + * 键盘高度发生变化的时候触发此事件 + * + * event.detail = {height: height, duration: duration} + * + * **tip**: 键盘高度发生变化,keyboardheightchange事件可能会多次触发,开发者对于相同的height值应该忽略掉 + * + * 最低基础库: 2.7.0 + */ + type TextareaKeyboardHeightChange< + Mark extends IAnyObject = IAnyObject, + TargetDataset extends IAnyObject = IAnyObject + > = InputKeyboardHeightChange + + /** + * 功能页返回,且操作成功时触发, detail 格式与具体功能页相关 + * + * 最低基础库: 2.1.0 + */ + type FunctionalNavigatorSuccess< + Detail extends IAnyObject = IAnyObject + > = CustomEvent + + /** + * 功能页返回,且操作失败时触发, detail 格式与具体功能页相关 + * + * 最低基础库: 2.1.0 + */ + type FunctionalNavigatorFail< + Detail extends IAnyObject = IAnyObject + > = CustomEvent + + /** + * 当 `target="miniProgram"` 时有效,跳转小程序成功 + * + * 最低基础库: 2.0.7 + */ + type NavigatorSuccess = CustomEvent + /** + * 当 `target="miniProgram"` 时有效,跳转小程序失败 + * + * `tips`: 需要用户确认跳转 从 2.3.0 版本开始,在跳转至其他小程序前,将统一增加弹窗,询问是否跳转,用户确认后才可以跳转其他小程序。如果用户点击取消,则回调 fail cancel。 + * + * 最低基础库: 2.0.7 + */ + type NavigatorFail = CustomEvent + /** + * 当 `target="miniProgram"` 时有效,跳转小程序完成 + * + * 最低基础库: 2.0.7 + */ + type NavigatorComplete = CustomEvent + + /** + * 当发生错误时触发 error 事件 + * + * detail = {errMsg:MediaError.code} + */ + type AudioError = CustomEvent<{ + /** + * MediaError.code + * + * - 1 获取资源被用户禁止 + * - 2 网络错误 + * - 3 解码错误 + * - 4 不合适资源 + */ + errMsg: 1 | 2 | 3 | 4 + }> + + /** 当开始/继续播放时触发play事件 */ + type AudioPlay = CustomEvent + + /** 当暂停播放时触发 pause 事件 */ + type AudioPause = CustomEvent + + /** + * 当播放进度改变时触发 timeupdate 事件 + * + * detail = {currentTime, duration} + */ + type AudioTimeUpdate = CustomEvent<{ + currentTime: number + duration: number + }> + + /** 当播放到末尾时触发 ended 事件 */ + type AudioEnded = CustomEvent + + /** 摄像头在非正常终止时触发,如退出后台等情况 */ + type CameraStop = CustomEvent + + /** 用户不允许使用摄像头时触发 */ + type CameraError = CustomEvent + + /** + * 相机初始化完成时触发 + * + * 最低基础库: 2.7.0 + */ + type CameraInitDone = CustomEvent + + /** + * 在扫码识别成功时触发,仅在 mode="scanCode" 时生效 + * + * 最低基础库: 2.1.0 + */ + type CameraScanCode = CustomEvent + + /** 当错误发生时触发,event.detail = {errMsg} */ + type ImageError = CoverImageError + /** 当图片载入完毕时触发,event.detail = {height, width} */ + type ImageLoad = CoverImageLoad + + /** + * 播放状态变化事件,detail = {code} + * + * 最低基础库 1.7.0 + */ + type LivePlayerStateChange = CustomEvent<{ + /** + * 状态码 + * + * - `2001` 已经连接服务器 + * - `2002` 已经连接服务器,开始拉流 + * - `2003` 网络接收到首个视频数据包(IDR) + * - `2004` 视频播放开始 + * - `2005` 视频播放进度 + * - `2006` 视频播放结束 + * - `2007` 视频播放Loading + * - `2008` 解码器启动 + * - `2009` 视频分辨率改变 + * - `-2301` 网络断连,且经多次重连抢救无效,更多重试请自行重启播放 + * - `-2302` 获取加速拉流地址失败 + * - `2101` 当前视频帧解码失败 + * - `2102` 当前音频帧解码失败 + * - `2103` 网络断连, 已启动自动重连 + * - `2104` 网络来包不稳: 可能是下行带宽不足,或由于主播端出流不均匀 + * - `2105` 当前视频播放出现卡顿 + * - `2106` 硬解启动失败,采用软解 + * - `2107` 当前视频帧不连续,可能丢帧 + * - `2108` 当前流硬解第一个I帧失败,SDK自动切软解 + * - `3001` RTMP -DNS解析失败 + * - `3002` RTMP服务器连接失败 + * - `3003` RTMP服务器握手失败 + * - `3005` RTMP 读/写失败 + */ + code: number + }> + + /** + * 全屏变化事件,detail = {direction, fullScreen} + * + * 最低基础库 1.7.0 + */ + type LivePlayerFullScreenChange = CustomEvent<{ + direction: 'vertical' | 'horizontal' + fullScreen: boolean + }> + + /** + * 网络状态通知,detail = {info} + * + * 最低基础库 1.9.0 + */ + type LivePlayerNetStatus = CustomEvent<{ + /** + * 网络状态数据 + * + * + * - `videoBitrate` 当前视频编/码器输出的比特率,单位 kbps + * - `audioBitrate` 当前音频编/码器输出的比特率,单位 kbps + * - `videoFPS` 当前视频帧率 + * - `videoGOP` 当前视频 GOP,也就是每两个关键帧(I帧)间隔时长,单位 s + * - `netSpeed` 当前的发送/接收速度 + * - `netJitter` 网络抖动情况,抖动越大,网络越不稳定 + * - `videoWidth` 视频画面的宽度 + * - `videoHeight` 视频画面的高度 + */ + info: + | 'videoBitrate' + | 'audioBitrate' + | 'videoFPS' + | 'videoGOP' + | 'netSpeed' + | 'netJitter' + | 'videoWidth' + | 'videoHeight' + }> + + /** + * 状态变化事件,detail = {code} + * + * 最低基础库: 1.7.0 + */ + type LivePusherStateChange = CustomEvent<{ + /** + * 状态码 + * + * - `1001` 已经连接推流服务器 + * - `1002` 已经与服务器握手完毕,开始推流 + * - `1003` 打开摄像头成功 + * - `1004` 录屏启动成功 + * - `1005` 推流动态调整分辨率 + * - `1006` 推流动态调整码率 + * - `1007` 首帧画面采集完成 + * - `1008` 编码器启动 + * - `-1301` 打开摄像头失败 + * - `-1302` 打开麦克风失败 + * - `-1303` 视频编码失败 + * - `-1304` 音频编码失败 + * - `-1305` 不支持的视频分辨率 + * - `-1306` 不支持的音频采样率 + * - `-1307` 网络断连,且经多次重连抢救无效,更多重试请自行重启推流 + * - `-1308` 开始录屏失败,可能是被用户拒绝 + * - `-1309` 录屏失败,不支持的Android系统版本,需要5.0以上的系统 + * - `-1310` 录屏被其他应用打断了 + * - `-1311` Android Mic打开成功,但是录不到音频数据 + * - `-1312` 录屏动态切横竖屏失败 + * - `1101` 网络状况不佳: 上行带宽太小,上传数据受阻 + * - `1102` 网络断连, 已启动自动重连 + * - `1103` 硬编码启动失败,采用软编码 + * - `1104` 视频编码失败 + * - `1105` 新美颜软编码启动失败,采用老的软编码 + * - `1106` 新美颜软编码启动失败,采用老的软编码 + * - `3001` RTMP -DNS解析失败 + * - `3002` RTMP服务器连接失败 + * - `3003` RTMP服务器握手失败 + * - `3004` RTMP服务器主动断开,请检查推流地址的合法性或防盗链有效期 + * - `3005` RTMP 读/写失败 + */ + code: number + }> + + /** + * 网络状态通知,detail = {info} + * + * 最低基础库: 1.9.0 + */ + type LivePusherNetStatus = CustomEvent<{ + /** + * 网络状态数据 + * + * -`videoBitrate` 当前视频编/码器输出的比特率,单位 kbps + * -`audioBitrate` 当前音频编/码器输出的比特率,单位 kbps + * -`videoFPS` 当前视频帧率 + * -`videoGOP` 当前视频 GOP,也就是每两个关键帧(I帧)间隔时长,单位 s + * -`netSpeed` 当前的发送/接收速度 + * -`netJitter` 网络抖动情况,抖动越大,网络越不稳定 + * -`videoWidth` 视频画面的宽度 + * -`videoHeight` 视频画面的高度 + */ + info: + | 'videoBitrate' + | 'audioBitrate' + | 'videoFPS' + | 'videoGOP' + | 'netSpeed' + | 'netJitter' + | 'videoWidth' + | 'videoHeight' + }> + + /** + * 渲染错误事件,detail = {errMsg, errCode} + * + * `tip`: 开发者工具上暂不支持 live-pusher + * + * 最低基础库: 1.7.4 + */ + type LivePusherError = CustomEvent<{ + errMsg: string + /** + * 错误码 + * + * - `10001` 用户禁止使用摄像头 + * - `10002` 用户禁止使用录音 + * - `10003` 背景音资源 (BGM) 加载失败 + * - `10004` 等待画面资源 (waiting-image) 加载失败 + */ + errCode: number + }> + + /** + * 背景音开始播放时触发 + * + * 最低基础库: 2.4.0 + */ + type LivePusherBgmStart = CustomEvent + + /** + * 背景音进度变化时触发,detail = {progress, duration} + * + * 最低基础库: 2.4.0 + */ + type LivePusherBgmProgress = CustomEvent<{ + progress: number + duration: number + }> + + /** + * 背景音播放完成时触发 + * + * 最低基础库: 2.4.0 + */ + type LivePusherBgmComplete = CustomEvent + + /** 当开始/继续播放时触发play事件 */ + type VideoPlay = CustomEvent + + /** 当暂停播放时触发 pause 事件 */ + type VideoPause = CustomEvent + + /** 当播放到末尾时触发 ended 事件 */ + type VideoEnded = CustomEvent + + /** 播放进度变化时触发,event.detail = {currentTime, duration} 。触发频率 250ms 一次 */ + type VideoTimeUpdate = CustomEvent<{ + currentTime: number + duration: number + }> + + /** + * 视频进入和退出全屏时触发,event.detail = {fullScreen, direction} + * + * 最低基础库: 1.4.0 + */ + type VideoFullScreenChange = CustomEvent<{ + fullScreen: boolean + direction: 'vertical' | 'horizontal' + }> + + /** + * 视频出现缓冲时触发 + * + * 最低基础库: 1.7.0 + */ + type VideoWaiting = CustomEvent + + /** + * 视频播放出错时触发 + * + * 最低基础库: 1.7.0 + */ + type VideoError = CustomEvent + + /** + * 加载进度变化时触发,只支持一段加载。 + * + * 最低基础库: 2.4.0 + */ + type VideoPregress = CustomEvent<{ + /** 百分比 */ + buffered: number + }> + + /** + * 加载进度变化时触发,只支持一段加载。 + * + * 最低基础库: 2.4.0 + */ + type VoipRoomError = CustomEvent + + /** + * 点击地图时触发 + * + * 2.9.0 起返回经纬度信息 + */ + type MapTap = CustomEvent<{ + /** 经度,最低基础库 2.9.0 */ + longitude: number + /** 纬度,最低基础库 2.9.0 */ + latitude: number + }> + + /** + * 点击标记点时触发 + * + * e.detail = {markerId} + */ + type MarkerTap = CustomEvent<{ + /** 标记点 ID */ + markerId: number + }> + + /** + * 点击 label 时触发 + * + * e.detail = {markerId} + * + * 最低基础库: 2.9.0 + */ + type LabelTap = MarkerTap + + /** + * 点击控件时触发 + * + * e.detail = {controlId} + */ + type ControlTap = CustomEvent<{ + /** 控件 ID */ + controlId: number + }> + + /** + * 点击 label 时触发 + * + * e.detail = {markerId} + * + * 最低基础库: 1.2.0 + */ + type CalloutTap = MarkerTap + + /** + * 在地图渲染更新完成时触发 + * + * 最低基础库: 1.6.0 + */ + type MapUpdated = CustomEvent + + /** + * 在地图渲染更新完成时触发 + * + * 最低基础库: 1.6.0 + */ + type RegionChange = CustomEvent<{ + /** 旋转程度,最低基础库 2.3.0 */ + rotate: number + /** 缩放程度,最低基础库 2.3.0 */ + skew: number + }> & + ( + | { + /** + * 视野变化开始、结束时触发 + * + * 视野变化开始为 `begin` + */ + type: 'begin' + /** + * 导致视野变化的原因 + * + * - gesture: 用户手势 + * - update: 调用接口导致 + */ + causedBy: 'gesture' | 'update' + } + | { + /** + * 视野变化结束时触发 + * + * 视野变化结束为 `end` + */ + type: 'end' + /** + * 导致视野变化的原因 + * + * - drag: 拖动地图导致 + * - scale: 缩放导致 + * - update: 调用接口导致 + */ + causedBy: 'drag' | 'scale' | 'update' + } + ) + + /** + * 广告加载成功的回调 + * + * 最低基础库: 2.2.1 + */ + type AdLoad = CustomEvent + + /** + * 广告加载失败的回调,event.detail = {errCode: 1002} + * + * `tip`: 监听到error回调后,开发者可以针对性的处理,比如隐藏广告组件的父容器,以保证用户体验,但不要移除广告组件,否则将无法收到bindload的回调。 + * + * 最低基础库: 2.2.1 + */ + type AdError = CustomEvent<{ + /** + * 错误码 + * + * - `1000` 后端错误调用失败 该项错误不是开发者的异常情况 一般情况下忽略一段时间即可恢复。 + * - `1001` 参数错误 使用方法错误 可以前往developers.weixin.qq.com 确认具体教程 (小程序和小游戏分别有各自的教程,可以在顶部选项中,“设计”一栏的右侧进行切换)。 + * - `1002` 广告单元无效 可能是拼写错误、或者误用了其他APP的广告ID 请重新前往mp.weixin.qq.com确认广告位ID。 + * - `1003` 内部错误 该项错误不是开发者的异常情况 一般情况下忽略一段时间即可恢复。 + * - `1004` 无适合的广告 广告不是每一次都会出现,这次没有出现可能是由于该用户不适合浏览广告 属于正常情况,且开发者需要针对这种情况做形态上的兼容。 + * - `1005` 广告组件审核中 你的广告正在被审核,无法展现广告 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。 + * - `1006` 广告组件被驳回 你的广告审核失败,无法展现广告 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。 + * - `1007` 广告组件被驳回 你的广告能力已经被封禁,封禁期间无法展现广告 请前往mp.weixin.qq.com确认小程序广告封禁状态。 + * - `1008` 广告单元已关闭 该广告位的广告能力已经被关闭 请前往mp.weixin.qq.com重新打开对应广告位的展现。 + */ + errCode: number + }> + + /** + * 广告关闭的回调 + * + * 最低基础库: 2.6.5 + */ + type AdClose = CustomEvent + + /** + * 网页向小程序 postMessage 时,会在特定时机 (小程序后退、组件销毁、分享) 触发并收到消息。e.detail = { data } + * + * 最低基础库: 1.6.4 + */ + type WebviewMessage = CustomEvent<{ + /** 多次 postMessage 的参数组成的数组 */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + data: any[] + }> + + /** + * 网页加载成功时候触发此事件。e.detail = { src } + * + * 最低基础库: 1.6.4 + */ + type WebviewLoad = CustomEvent<{ + src: string + }> + + /** + * 网页加载失败的时候触发此事件。e.detail = { src } + * + * 最低基础库: 1.6.4 + */ + type WebviewError = CustomEvent<{ + src: string + }> +} diff --git a/frontend_miniprogram/typings/types/wx/lib.wx.page.d.ts b/frontend_miniprogram/typings/types/wx/lib.wx.page.d.ts new file mode 100644 index 0000000..1cc37fc --- /dev/null +++ b/frontend_miniprogram/typings/types/wx/lib.wx.page.d.ts @@ -0,0 +1,259 @@ +/*! ***************************************************************************** +Copyright (c) 2021 Tencent, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +***************************************************************************** */ + +declare namespace WechatMiniprogram.Page { + type Instance< + TData extends DataOption, + TCustom extends CustomOption + > = OptionalInterface & + InstanceProperties & + InstanceMethods & + Data & + TCustom + type Options< + TData extends DataOption, + TCustom extends CustomOption + > = (TCustom & Partial> & Partial) & + ThisType> + type TrivialInstance = Instance + interface Constructor { + ( + options: Options + ): void + } + interface ILifetime { + /** 生命周期回调—监听页面加载 + * + * 页面加载时触发。一个页面只会调用一次,可以在 onLoad 的参数中获取打开当前页面路径中的参数。 + */ + onLoad( + /** 打开当前页面路径中的参数 */ + query: Record + ): void | Promise + /** 生命周期回调—监听页面显示 + * + * 页面显示/切入前台时触发。 + */ + onShow(): void | Promise + /** 生命周期回调—监听页面初次渲染完成 + * + * 页面初次渲染完成时触发。一个页面只会调用一次,代表页面已经准备妥当,可以和视图层进行交互。 + * + + * 注意:对界面内容进行设置的 API 如`wx.setNavigationBarTitle`,请在`onReady`之后进行。 + */ + onReady(): void | Promise + /** 生命周期回调—监听页面隐藏 + * + * 页面隐藏/切入后台时触发。 如 `navigateTo` 或底部 `tab` 切换到其他页面,小程序切入后台等。 + */ + onHide(): void | Promise + /** 生命周期回调—监听页面卸载 + * + * 页面卸载时触发。如`redirectTo`或`navigateBack`到其他页面时。 + */ + onUnload(): void | Promise + /** 监听用户下拉动作 + * + * 监听用户下拉刷新事件。 + * - 需要在`app.json`的`window`选项中或页面配置中开启`enablePullDownRefresh`。 + * - 可以通过`wx.startPullDownRefresh`触发下拉刷新,调用后触发下拉刷新动画,效果与用户手动下拉刷新一致。 + * - 当处理完数据刷新后,`wx.stopPullDownRefresh`可以停止当前页面的下拉刷新。 + */ + onPullDownRefresh(): void | Promise + /** 页面上拉触底事件的处理函数 + * + * 监听用户上拉触底事件。 + * - 可以在`app.json`的`window`选项中或页面配置中设置触发距离`onReachBottomDistance`。 + * - 在触发距离内滑动期间,本事件只会被触发一次。 + */ + onReachBottom(): void | Promise + /** 用户点击右上角转发 + * + * 监听用户点击页面内转发按钮(`