|
|
@@ -32,8 +32,7 @@
|
|
|
style="width: 200px"
|
|
|
/>
|
|
|
</div>
|
|
|
- <span
|
|
|
-v-if="data.property.fun_type === 'input'" class="tips"
|
|
|
+ <span v-if="data.property.fun_type === 'input'" class="tips"
|
|
|
>在需要加空的内容处插入 3 个或以上的下划线“_”。</span
|
|
|
>
|
|
|
<div v-if="data.audio_file_id">
|
|
|
@@ -84,7 +83,7 @@ import UploadAudio from '@/views/book/courseware/create/components/question/fill
|
|
|
import { getPinyinBaseData, funList } from '@/views/book/courseware/data/pinyinBase';
|
|
|
import { addTone, handleToneValue } from '@/views/book/courseware/data/common';
|
|
|
import { getRandomNumber } from '@/utils';
|
|
|
-import { GetStaticResources } from '@/api/app';
|
|
|
+import { GetStaticResources, TextToAudioFile } from '@/api/app';
|
|
|
|
|
|
export default {
|
|
|
name: 'PinyinBasePage',
|
|
|
@@ -118,12 +117,14 @@ export default {
|
|
|
'data.content': 'handleMindMap',
|
|
|
},
|
|
|
methods: {
|
|
|
- uploads(file_id) {
|
|
|
+ uploads(file_id, index, file_url) {
|
|
|
this.data.audio_file_id = file_id;
|
|
|
+ this.data.audio_file_url = file_url;
|
|
|
this.data.file_id_list = [file_id];
|
|
|
},
|
|
|
deleteFiles() {
|
|
|
this.data.audio_file_id = '';
|
|
|
+ this.data.audio_file_url = '';
|
|
|
this.data.file_id_list = [];
|
|
|
},
|
|
|
// 自动生成音频
|
|
|
@@ -133,7 +134,18 @@ export default {
|
|
|
if (this.data.character.trim() || this.data.content_hz) {
|
|
|
data = {
|
|
|
text: this.data.character.trim() || this.data.content_hz,
|
|
|
+ voice_type: this.data.property.voice_type,
|
|
|
+ emotion: this.data.property.emotion,
|
|
|
};
|
|
|
+ TextToAudioFile(data)
|
|
|
+ .then(({ status, file_id, file_url }) => {
|
|
|
+ if (status === 1) {
|
|
|
+ this.data.audio_file_id = file_id;
|
|
|
+ this.data.audio_file_url = file_url;
|
|
|
+ this.data.file_id_list = [file_id];
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
} else if (this.data.content.trim()) {
|
|
|
if (!this.matically_pinyin_obj[this.data.mark]) {
|
|
|
this.handleItemAnswer(this.data);
|
|
|
@@ -142,15 +154,16 @@ export default {
|
|
|
data = {
|
|
|
pinyin: this.matically_pinyin_obj[this.data.mark],
|
|
|
};
|
|
|
+ GetStaticResources(MethodName, data)
|
|
|
+ .then((res) => {
|
|
|
+ if (res.status === 1) {
|
|
|
+ this.data.audio_file_id = res.file_id;
|
|
|
+ this.data.audio_file_url = res.file_url;
|
|
|
+ this.data.file_id_list = [res.file_id];
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
}
|
|
|
- GetStaticResources(MethodName, data)
|
|
|
- .then((res) => {
|
|
|
- if (res.status === 1) {
|
|
|
- this.data.audio_file_id = res.file_id;
|
|
|
- this.data.file_id_list = [res.file_id];
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(() => {});
|
|
|
},
|
|
|
handleReplaceTone(value, mark) {
|
|
|
if (!value) return;
|
|
|
@@ -268,6 +281,7 @@ export default {
|
|
|
changePinyin(item) {
|
|
|
if (this.data.property.audio_generation_method === 'auto') {
|
|
|
item.audio_file_id = '';
|
|
|
+ item.audio_file_url = '';
|
|
|
this.data.file_id_list = [];
|
|
|
}
|
|
|
},
|