13 changed files with 130 additions and 18 deletions
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
{ |
||||
"component": true, |
||||
"usingComponents": { |
||||
"van-popup": "@vant/weapp/popup/index" |
||||
} |
||||
} |
@ -0,0 +1,27 @@
@@ -0,0 +1,27 @@
|
||||
.audio-text { |
||||
width: 580rpx; |
||||
background-color: #f6f6f6; |
||||
padding: 0 32rpx; |
||||
box-sizing: border-box; |
||||
.title { |
||||
padding: 32rpx 0; |
||||
text-align: center; |
||||
font-size: 36rpx; |
||||
color: #1d2129; |
||||
font-weight: bold; |
||||
} |
||||
.container { |
||||
padding: 32rpx; |
||||
background-color: #fff; |
||||
border-radius: 16rpx; |
||||
font-size: 28rpx; |
||||
color: #858585; |
||||
line-height: 44rpx; |
||||
} |
||||
.copy { |
||||
padding: 32rpx; |
||||
font-size: 32rpx; |
||||
color: #00b4c5; |
||||
text-align: center; |
||||
} |
||||
} |
@ -0,0 +1,72 @@
@@ -0,0 +1,72 @@
|
||||
Component({ |
||||
// 组件选项
|
||||
options: { |
||||
multipleSlots: true, |
||||
}, |
||||
behaviors: [], |
||||
properties: { |
||||
url: { |
||||
type: String, |
||||
value: "", |
||||
}, |
||||
}, |
||||
// 组件数据
|
||||
data: { |
||||
isPageHidden: false, // 页面是否处于隐藏状态
|
||||
show: false, |
||||
text: "", |
||||
}, |
||||
// 数据监听器
|
||||
observers: {}, |
||||
// 组件方法
|
||||
methods: { |
||||
init() {}, |
||||
handleAudioText() { |
||||
this.setData({ |
||||
show: true, |
||||
}); |
||||
wx.ajax({ |
||||
method: "GET", |
||||
url: "?r=takeda/common/audio-url-to-text", |
||||
data: { |
||||
AudioUrl: this.data.url, |
||||
}, |
||||
}).then((res) => { |
||||
this.setData({ |
||||
show: true, |
||||
text: res.text, |
||||
}); |
||||
}); |
||||
}, |
||||
onClose() { |
||||
this.setData({ |
||||
show: false, |
||||
}); |
||||
}, |
||||
onCopy() { |
||||
this.setData({ |
||||
show: false, |
||||
}); |
||||
wx.setClipboardData({ |
||||
data: this.data.text, |
||||
success() { |
||||
wx.showToast({ |
||||
title: "复制成功", |
||||
icon: "success", |
||||
}); |
||||
}, |
||||
}); |
||||
}, |
||||
}, |
||||
// 组件生命周期
|
||||
lifetimes: { |
||||
created() {}, |
||||
attached() { |
||||
this.init(); |
||||
}, |
||||
ready() {}, |
||||
moved() {}, |
||||
detached() {}, |
||||
}, |
||||
definitionFilter() {}, |
||||
}); |
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
<view wx:if="{{url}}" bind:tap="handleAudioText"> |
||||
<slot></slot> |
||||
</view> |
||||
|
||||
<van-popup show="{{ show }}" bind:close="onClose" round closeable> |
||||
<view class="audio-text"> |
||||
<view class="title">语音转化内容</view> |
||||
<view class="container">{{text}}</view> |
||||
<view class="copy" bind:tap="onCopy">复制</view> |
||||
</view> |
||||
</van-popup> |
Loading…
Reference in new issue