Forráskód Böngészése

生词打点加loading

natasha 6 napja
szülő
commit
b10a5f1ed4
1 módosított fájl, 36 hozzáadás és 16 törlés
  1. 36 16
      src/components/Adult/inputModules/Neword.vue

+ 36 - 16
src/components/Adult/inputModules/Neword.vue

@@ -1,7 +1,11 @@
 <!--  -->
 <template>
   <div class="Big-Book-Single" v-if="curQue">
-    <div class="Big-Book-Single-content" style="margin-top: 20px">
+    <div
+      class="Big-Book-Single-content"
+      style="margin-top: 20px"
+      v-loading="loading"
+    >
       <!-- <div class="adult-book-input-item">
         <span class="adult-book-lable">标题:</span>           
         <el-input
@@ -209,7 +213,8 @@ export default {
             }
           ]
         ]
-      }
+      },
+      loading: false
     };
   },
   computed: {},
@@ -346,10 +351,14 @@ export default {
             matchType: "chinese",
             language: "ch"
           };
-          getWordTime(data).then(res => {
-            this.curQue.wordTime = res.data.result;
-            this.isWordTime = false;
-          });
+          getWordTime(data)
+            .then(res => {
+              this.curQue.wordTime = res.data.result;
+              this.isWordTime = false;
+            })
+            .catch(() => {
+              this.isWordTime = false;
+            });
         }
       } else {
         this.$message.warning("请先上传音频");
@@ -362,17 +371,28 @@ export default {
     // 上传音频文件
     handleChange(file, fileList) {
       let _this = this;
-      _this.getBase64(file.raw).then(res => {
-        let base_res = res.split("base64,");
-        let data = {
-          fileName: file.raw.name,
-          speechBase64: base_res[1],
-          language: "ch"
-        };
-        prepareTranscribe(data).then(reses => {
-          _this.$set(_this.curQue, "taskId", reses.data.taskId);
+      _this.loading = true;
+      _this
+        .getBase64(file.raw)
+        .then(res => {
+          let base_res = res.split("base64,");
+          let data = {
+            fileName: file.raw.name,
+            speechBase64: base_res[1],
+            language: "ch"
+          };
+          prepareTranscribe(data)
+            .then(reses => {
+              _this.loading = false;
+              _this.$set(_this.curQue, "taskId", reses.data.taskId);
+            })
+            .catch(() => {
+              _this.loading = false;
+            });
+        })
+        .catch(() => {
+          _this.loading = false;
         });
-      });
     },
     changeLrc(fileList) {
       let lrc_list = [];