瀏覽代碼

修改拼音后读音更新

natasha 11 月之前
父節點
當前提交
1cbe230062
共有 1 個文件被更改,包括 21 次插入1 次删除
  1. 21 1
      src/views/wordcard/writeTableNew.vue

+ 21 - 1
src/views/wordcard/writeTableNew.vue

@@ -29,7 +29,12 @@
             </div>
             <div class="item-con">
               <label>拼音</label>
-              <el-input class="pinyin" v-model="data.right.pinyin" placeholder="输入"></el-input>
+              <el-input
+                class="pinyin"
+                v-model="data.right.pinyin"
+                placeholder="输入"
+                @change="handleChangePinyin"
+              ></el-input>
             </div>
             <div class="item-con">
               <label>词性</label>
@@ -337,6 +342,21 @@ export default {
           this.loading = false;
         });
     },
+    // 更改拼音
+    handleChangePinyin() {
+      let pinyin = this.data.right.pinyin.trim().split(' ').join(',');
+      let MethodName = 'tool-PinyinToVoiceFile';
+      if (this.data.right.pinyin.trim()) {
+        let datas = {
+          pinyin: pinyin,
+        };
+        getLogin(MethodName, datas).then((res) => {
+          if (res.status === 1) {
+            this.data.right.audio_file = res.file_id;
+          }
+        });
+      }
+    },
     // 翻面
     changeShowLeft() {
       this.$emit('changeShowLeft');