|
@@ -39,9 +39,13 @@
|
|
|
</el-button>
|
|
|
</div>
|
|
|
<UploadDrag v-else ref="uploadDrag" :item-index="i" :limit="1" @fileUploadSuccess="fileUploadSuccess" />
|
|
|
- <div v-loading="item.loadings" class="word-card-item">
|
|
|
+ <div v-loading="loading_list[i] ? loading_list[i].loadings : false" class="word-card-item">
|
|
|
<div class="word-card">
|
|
|
- <el-input v-model="item.content" :placeholder="'输入汉字或词汇'" @blur="handleChineseStrokes(item)" />
|
|
|
+ <el-input
|
|
|
+ v-model="item.content"
|
|
|
+ :placeholder="'输入汉字或词汇'"
|
|
|
+ @blur="handleChineseStrokes(item, i)"
|
|
|
+ />
|
|
|
<el-input v-model="item.pinyin" :placeholder="'拼音间用空格隔开'" />
|
|
|
<UploadAudio
|
|
|
v-if="data.other.audio_generation_method === 'upload'"
|
|
@@ -54,9 +58,12 @@
|
|
|
/>
|
|
|
<div v-else-if="data.other.audio_generation_method === 'auto'" class="auto-matically">
|
|
|
<AudioPlay v-if="item.audio_file_id" :file-id="item.audio_file_id" theme-color="gray" />
|
|
|
- <span v-loading="item.loading" class="auto-btn" @click="handleMatically(item)">{{
|
|
|
- item.audio_file_id ? '已生成' : '自动生成'
|
|
|
- }}</span>
|
|
|
+ <span
|
|
|
+ v-loading="loading_list[i] ? loading_list[i].loading : false"
|
|
|
+ class="auto-btn"
|
|
|
+ @click="handleMatically(item, i)"
|
|
|
+ >{{ item.audio_file_id ? '已生成' : '自动生成' }}</span
|
|
|
+ >
|
|
|
</div>
|
|
|
<SoundRecord v-else :wav-blob.sync="item.audio_file_id" />
|
|
|
<span class="rate-box"><el-rate v-model="item.rate" /></span>
|
|
@@ -186,6 +193,20 @@ export default {
|
|
|
handleInputNumber,
|
|
|
pic_list: {},
|
|
|
is_first: true,
|
|
|
+ loading_list: [
|
|
|
+ {
|
|
|
+ loading: false,
|
|
|
+ loadings: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ loading: false,
|
|
|
+ loadings: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ loading: false,
|
|
|
+ loadings: false,
|
|
|
+ },
|
|
|
+ ],
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -197,6 +218,20 @@ export default {
|
|
|
},
|
|
|
deep: true,
|
|
|
},
|
|
|
+ 'data.option_list.length': {
|
|
|
+ handler(val) {
|
|
|
+ this.loading_list = [];
|
|
|
+ for (let i = 0; i < val; i++) {
|
|
|
+ let obj = {
|
|
|
+ loading: false,
|
|
|
+ loadings: false,
|
|
|
+ };
|
|
|
+ this.loading_list.push(obj);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ immediate: true,
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
// 初始化数据
|
|
@@ -230,6 +265,7 @@ export default {
|
|
|
this.data.option_list.splice(i, 1);
|
|
|
this.data.file_id_list.splice(this.data.file_id_list.indexOf(file_id), 1);
|
|
|
this.data.file_id_list.splice(this.data.file_id_list.indexOf(pic_id), 1);
|
|
|
+ this.loading_list.splice(i, 1);
|
|
|
})
|
|
|
.catch(() => {});
|
|
|
},
|
|
@@ -249,23 +285,23 @@ export default {
|
|
|
.catch(() => {});
|
|
|
},
|
|
|
// 自动生成音频
|
|
|
- handleMatically(item) {
|
|
|
+ handleMatically(item, i) {
|
|
|
if (item.pinyin.trim()) {
|
|
|
- this.$set(item, 'loading', true);
|
|
|
+ this.loading_list[i].loading = true;
|
|
|
let MethodName = 'tool-PinyinToVoiceFile';
|
|
|
let data = {
|
|
|
pinyin: item.pinyin.trim().split(' ').join(','),
|
|
|
};
|
|
|
GetStaticResources(MethodName, data)
|
|
|
.then((res) => {
|
|
|
- item.loading = false;
|
|
|
+ this.loading_list[i].loading = false;
|
|
|
if (res.status === 1) {
|
|
|
item.audio_file_id = res.file_id;
|
|
|
this.data.file_id_list.push(res.file_id);
|
|
|
}
|
|
|
})
|
|
|
.catch(() => {
|
|
|
- item.loading = false;
|
|
|
+ this.loading_list[i].loading = false;
|
|
|
});
|
|
|
}
|
|
|
},
|
|
@@ -275,9 +311,9 @@ export default {
|
|
|
this.$set(this.pic_list, file_id, file_url);
|
|
|
},
|
|
|
// 生成汉字
|
|
|
- handleChineseStrokes(item) {
|
|
|
+ handleChineseStrokes(item, i) {
|
|
|
if (item.content.trim()) {
|
|
|
- this.$set(item, 'loadings', true);
|
|
|
+ this.loading_list[i].loadings = true;
|
|
|
let content_arr = item.content.trim().split('');
|
|
|
let content_arrs = [];
|
|
|
let content_arr_strokes = [];
|
|
@@ -300,7 +336,7 @@ export default {
|
|
|
content_arr_strokes[indexc] = obj;
|
|
|
});
|
|
|
});
|
|
|
- item.loadings = false;
|
|
|
+ this.loading_list[i].loadings = false;
|
|
|
|
|
|
item.hz_strokes_list = content_arr_strokes;
|
|
|
}
|