触点数字孪生,揭秘它的独特魅力
460
2024-06-30
当您使用 FinClip SaaS 环境时,可看到来源为平台的插件,此类型插件由 FinClip 自身或合作生态伙伴开发,供您进行调用使用。
// pages/video/video.jsPage({
data: {
recordTime: 30000,
top: 20,
stepList: [
{
audioSrc: 'https://devtest-1252553964.cos.ap-guangzhou.myqcloud.com/1.mp3',
showTime: 0,
textList: [{
text: '第一行文本',
margin: '0 0 6rpx 0'
}, {
text: [{
text: '第二行'
}, {
text: '高亮高亮',
color: '#ee6f2d',
fontWeight: 'bold',
margin: '0 6rpx'
}, {
text: '文本文本文本文本文本'
}]
}, {
text: '第三行文本文本文本文本文本',
color: '#ee6f2d',
margin: '6rpx'
}]
},
{
audioSrc: 'https://devtest-1252553964.cos.ap-guangzhou.myqcloud.com/2.mp3',
showTime: 8000,
textList: [{
text: '第二个文本',
margin: '0 0 6rpx 0'
}, {
text: [{
text: '文本'
}, {
text: '高亮',
color: '#ee6f2d',
fontWeight: 'bold',
margin: '0 6rpx'
}, {
text: '文本文本文本文本文本'
}, {
text: '高亮',
color: '#ee6f2d',
fontWeight: 'bold',
margin: '0 6rpx'
}]
}]
},
{
audioSrc: 'https://devtest-1252553964.cos.ap-guangzhou.myqcloud.com/3.mp3',
showTime: 18000,
textList: [{
text: '3第三个文本',
margin: '0 0 6rpx 0'
}, {
text: [{
text: '3第二行'
}, {
text: '3高亮3',
color: '#ee6f2d',
fontWeight: 'bold',
margin: '0 6rpx'
}, {
text: '333文本文本文本文本文本文本333'
}]
}]
}
],
buttonStyle: {
width: '16vw',
height: '16vw',
bottom: '80rpx'
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.showLoading()
},
onRecordReady() {
wx.hideLoading()
},
onRecordStart() {
wx.showToast({
title: '录制开始',
icon: 'none'
})
},
onRecordEnd(res) {
const { tempVideoPath } = res.detail
wx.showToast({
title: '录制结束,地址:' + tempVideoPath,
icon: 'none'
})
setTimeout(() => {
wx.navigateTo({
url: '/pages/index/index?url=' + encodeURIComponent(tempVideoPath)
})
}, 3500)
},
onRecordError(res) {
const { errMsg } = res.detail
wx.showToast({
title: errMsg,
icon: 'none'
})
}})
已复制代码// pages/video/video.json"usingComponents": {
"video-recognition": "plugin://video/video-recognition"}
已复制代码// pages/video/video.fxml<view style="width: 100vw;height: 100vh;">
<video-recognition recordTime="{{recordTime}}"
top="{{top}}"
stepList="{{stepList}}"
buttonStyle="{{buttonStyle}}"
mask="/assets/img_mask_person@3x.png"
resolution="low"
bind:onRecordReady="onRecordReady"
bind:onRecordStart="onRecordStart"
bind:onRecordEnd="onRecordEnd"
bind:onRecordError="onRecordError">
</video-recognition></view>
已复制代码| 属性 | 类型 | 是否必传 | 默认值 | 说明 |
|---|---|---|---|---|
| resolution | String | 否 | medium | 分辨率,可选值:low、medium、high 只在初始化时有效,不能动态变更 |
| mask | String | 否 | - | 取景区域的遮罩资源路径,建议使用小程序内资源的相对路径,https 地址会有加载耗时, 遮罩会按 width 100% height 100% 的尺寸放在 camera 上,注意和组件尺寸相匹配 |
| recordTime | Number | 否 | 30000 | 录制时间,单位为毫秒 |
| top | Number | 否 | 20 | 单位 rpx 文本提示距顶部的距离, 也可修改 video-recognition 组件内的 wxss,自定义文本的 position |
| stepList | Array[Object] | 否 | - | 见下方 |
| buttonStyle | Object | 否 | - | 控制录制按钮的样式,可对按钮进行位置上的微调目前仅支持以下字段:width、height、left、top、bottom、right 只在初始化时有效,不能动态变更 |
| onRecordReady | EventHandler | 否 | - | 通过 onRecordReady 绑定 ready 前会进行一些异步资源的下载,资源准备好后触发可用于使用组件的 page 页面判断是否准备完毕,从而控制 loading 展示 |
| onRecordStart | EventHandler | 否 | - | 通过 bind:onRecordStart 绑定录制开始时触发 |
| onRecordEnd | EventHandler | 否 | - | 通过 bind:onRecordEnd 绑定录制结束时触发回调方法参数 res:tempVideoPath 录制视频的本地文件地址 |
| onRecordError | EventHandler | 否 | - | 通过 bind:onRecordError 绑定录制报错时触发回调方法参数 res:errMsg 发生错误时的报错信息 |
setpList 每步的语和提示案配置,最大支持长度为 3,数据元素结构如下:
{
"audioSrc": "https://xxxxx.mp3",
"showTime": 0,
"textList": []}
已复制代码audioSrc - 音频链接,建议使用 https 链接,组件 attached 会下载音频资源,若下载失败会执行 error 回调,报资源加载错误(注意:mp3 的域名需在管理后台添加到白名单内,否则会下载失败);
showTime - 文本提示和音频的展示时间,毫秒数,0 表示初始展示,2000 表示录制开始 2s 时展示;
textList - 文本提示,数组类型,参数对象如下;
{
"text": '请用普通话大声朗读'}
已复制代码text - 文本内容 可添加 width|height|padding|margin|color|fontSize|fontWeight|textAlign 等样式属性简单控制文本样式:
{
"text": "文本",
"color": "red",
"fontWeight": "bold",
"margin": "0 20rpx"}
已复制代码注意,一个textList子元素,展示时会以单行不换行展示,可按需拆分成多行多个子元素; 另外,如果单行内容内需要个别词语高亮展示,text属性可以传入数组,属性与上述对象参数一致,如下:
{
"text": [{
"text": "文本"
}, {
"text": "高亮文本",
"color": "red",
"fontWeight": "bold",
"margin": "0 20rpx"
}, {
"text": "文本"
}]}
已复制代码只在初始化时有效,不能动态变更.
// component.json"usingComponents": {
"keyboard": "plugin://virtual-keyboard/keyboard"}
已复制代码// wxml<keyboard show="{{ show }}" closeButtonText="完成" bindinput="changeInput" binddelete="changeDetete" />
已复制代码| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| title | string | 键盘上方显示的标题 | |
| show | boolean | false | 控制键盘是否显示 |
| theme | string | default | default/custom 当为 custom 时右侧增加删除和完成按钮 |
| themeColor | string | #2e7cff | 设置主题色 |
| zIndex | number/string | 999 | 层级 |
| isRandomLetter | boolean | false | 乱序字符 |
| isRandomNumber | boolean | false | 乱序数字 |
| normalType | string | number | number/letter/symbol 控制显示的键盘类型 |
| closeButtonText | string | 关闭按钮的文字 | |
| extraKey | [string] | 额外的按键 | |
| icon | string | 标题栏 icon 的路径 |
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。