ui库和web端产品库合并版本(还需修复细节)
This commit is contained in:
44
ui/packages/basic/AiTransSpeech.vue
Normal file
44
ui/packages/basic/AiTransSpeech.vue
Normal file
@@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<el-row type="flex" align="middle">
|
||||
<el-button type="text" size="small" :loading="loading" icon="iconfont iconClock" title="语音播报"
|
||||
@click="getSpeechByContent"/>
|
||||
<ai-audio v-if="speech" :src="speech" skin="flat"/>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "AiTransSpeech",
|
||||
props: {
|
||||
instance: {type: Function, required: true},
|
||||
content: String
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
speech: "",
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getSpeechByContent() {
|
||||
this.loading = true
|
||||
this.instance.post("/app/msc/transToSpeech", null, {
|
||||
params: {
|
||||
fileName: "demo",
|
||||
words: this.content
|
||||
}
|
||||
}).then(res => {
|
||||
this.loading = false
|
||||
if (res && res.data) {
|
||||
let url = res.data.join("")
|
||||
this.speech = url.substring(0, url.indexOf(";"))
|
||||
}
|
||||
}).catch(() => this.loading = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user