gcj 3 years ago
parent
commit
cb7183abc9

+ 7 - 4
src/components/Adult/Preview.vue

@@ -121,7 +121,10 @@
           v-if="item.number || item.z_title || item.f_title"
         >
           <b v-if="item.number">{{ item.number }}</b>
-          <div class="title-box-right" :class="[item.is_textIndex?'title-box-right-index':'']">
+          <div
+            class="title-box-right"
+            :class="[item.is_textIndex ? 'title-box-right-index' : '']"
+          >
             <h2 v-if="item.z_title" v-html="item.z_title"></h2>
             <h3
               v-if="item.f_title"
@@ -617,7 +620,7 @@ export default {
       _this.queIndex = 0;
       _this.NNPENewWordList = [];
       _this.NNPENewPhraseList = [];
-      _this.NNPEAnnotationList =[]
+      _this.NNPEAnnotationList = [];
       _this.watchIndex = _this.queIndex + new Date().getTime();
       if (_this.contextData) {
         // const list = _this.contextData;
@@ -898,8 +901,8 @@ export default {
           white-space: pre-wrap;
           word-break: break-word;
         }
-        .title-box-right-index{
-            padding-left: 51px;
+        .title-box-right-index {
+          padding-left: 51px;
         }
       }
     }

+ 25 - 1
src/components/Adult/common/NewordPhraseModule.vue

@@ -16,6 +16,30 @@
             >删除</el-button
           >
         </div>
+
+        <div
+          class="adult-book-input-item"
+          v-if="
+            curQue.wordTime &&
+            curQue.wordTime.length > 0 &&
+            curQue.wordTime[curQueItem.index]
+          "
+        >
+          <span class="adult-book-lable">字幕时间:</span>
+          <div style="display: flex; align-items: center">
+            <el-input
+              class="adult-book-input"
+              style="width: 200px"
+              v-model="curQue.wordTime[curQueItem.index].bg"
+            ></el-input>
+            ~
+            <el-input
+              class="adult-book-input"
+              style="width: 200px"
+              v-model="curQue.wordTime[curQueItem.index].ed"
+            ></el-input>
+          </div>
+        </div>
         <div class="adult-book-input-item">
           <span class="adult-book-lable">拼音:</span>
           <el-input
@@ -104,7 +128,7 @@ export default {
   components: {
     Upload,
   },
-  props: ["curQueItem", "index", "sIndex", "type", "deleteGroup"],
+  props: ["curQue", "curQueItem", "index", "sIndex", "type", "deleteGroup"],
   data() {
     return {
       mp3Number: 1,

+ 45 - 45
src/components/Adult/inputModules/Neword.vue

@@ -51,17 +51,6 @@
           :uploadType="'lrc'"
         />
       </div>
-      <div class="adult-book-input-item">
-        <span class="adult-book-lable"></span>
-        <el-button
-          type="primary"
-          size="small"
-          class="distribution"
-          @click="parseLrcFile"
-        >
-          分配lrc
-        </el-button>
-      </div>
       <div class="lrc-box">
         <div
           v-if="this.curQue.wordTime && this.curQue.wordTime.length > 0"
@@ -77,6 +66,18 @@
           <p v-else>字幕节点生成中...请等待</p>
         </template>
       </div>
+      <div class="adult-book-input-item">
+        <span class="adult-book-lable"></span>
+        <el-button
+          type="primary"
+          size="small"
+          class="distribution"
+          @click="parseLrcFile"
+        >
+          分配lrc
+        </el-button>
+      </div>
+
       <div
         class="Big-Book-main"
         v-for="(item, index) in curQue.option"
@@ -89,6 +90,7 @@
           :key="'newWord_' + sIndex"
         >
           <NewordPhraseModule
+            :curQue="curQue"
             :curQueItem="sItem"
             :index="index"
             :sIndex="sIndex"
@@ -207,22 +209,41 @@ export default {
     parseLrcFile() {
       let lrcList = this.curQue.lrc_list;
       if (lrcList.length === 0) {
-        return this.$message.warning("请先上传lrc文件");
+        if (this.curQue.wordTime.length > 0) {
+          this.handleNewwordList();
+        } else {
+          this.$message.warning("请先上传lrc文件或自动生成字幕节点");
+        }
+      } else {
+        getContentFile("tool-ParseLRCFile", {
+          content_type: "FILE",
+          file_id: this.curQue.lrc_list[0].file_id,
+        }).then(({ lrc_list }) => {
+          let lrc_list_res = [];
+          lrc_list.forEach((item) => {
+            let obj = {
+              bg: item.begin_time,
+              ed: item.end_time,
+            };
+            lrc_list_res.push(obj);
+          });
+          this.handleNewwordList();
+          this.curQue.wordTime = lrc_list_res;
+        });
       }
-      getContentFile("tool-ParseLRCFile", {
-        content_type: "FILE",
-        file_id: this.curQue.lrc_list[0].file_id,
-      }).then(({ lrc_list }) => {
-        let lrc_list_res = [];
-        lrc_list.forEach((item) => {
-          let obj = {
-            bg: item.begin_time,
-            ed: item.end_time,
-          };
-          lrc_list_res.push(obj);
+    },
+    handleNewwordList() {
+      let index = 0;
+      // let option = JSO
+      this.curQue.option.map((item) => {
+        item.map((sItem) => {
+          this.$set(sItem, "index", index);
+          index++;
+          return sItem;
         });
-        this.curQue.wordTime = lrc_list_res;
+        return item;
       });
+      console.log(this.curQue.option);
     },
     getBase64(file) {
       return new Promise(function (resolve, reject) {
@@ -300,27 +321,6 @@ export default {
       });
       this.curQue.lrc_list = lrc_list;
     },
-    // 根据lrc文件id 获取内容和起始和结束时间
-    parseLrcFile() {
-      let lrcList = this.curQue.lrc_list;
-      if (lrcList.length === 0) {
-        return this.$message.warning("请先上传lrc文件");
-      }
-      getContentFile("tool-ParseLRCFile", {
-        content_type: "FILE",
-        file_id: this.curQue.lrc_list[0].file_id,
-      }).then(({ lrc_list }) => {
-        let lrc_list_res = [];
-        lrc_list.forEach((item) => {
-          let obj = {
-            bg: item.begin_time,
-            ed: item.end_time,
-          };
-          lrc_list_res.push(obj);
-        });
-        this.curQue.wordTime = lrc_list_res;
-      });
-    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {},

+ 53 - 55
src/components/Adult/preview/WordPhrase.vue

@@ -32,21 +32,23 @@
         v-show="wordShow"
       >
         <div
-            class="aduioLine-box"
-            v-if="
-                curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].url
-            "
-            >
-            <AudioLine
-                audioId="SelectYinjieAudio"
-                :mp3="curQue.mp3_list[0].url"
-                :getCurTime="getCurTime"
-                :themeColor="themeColor"
-                :ed="ed"
-                type="audioLine"
-                ref="audioLine"
-                @handleListenRead="handleListenRead"
-            />
+          class="aduioLine-box"
+          v-if="
+            curQue.mp3_list &&
+            curQue.mp3_list.length > 0 &&
+            curQue.mp3_list[0].url
+          "
+        >
+          <AudioLine
+            audioId="SelectYinjieAudio"
+            :mp3="curQue.mp3_list[0].url"
+            :getCurTime="getCurTime"
+            :themeColor="themeColor"
+            :ed="ed"
+            type="audioLine"
+            ref="audioLine"
+            @handleListenRead="handleListenRead"
+          />
         </div>
         <ul class="NPC-word-table" cellspacing="0" border="0" cellpadding="0">
           <li
@@ -58,11 +60,9 @@
               :class="[
                 'NPC-word-row',
                 playClass && mp3_index == sItem.sIndex ? 'active' : '',
-                curTime >= sItem.bg &&
-                    curTime < sItem.ed &&
-                    stopAudioS
-                        ? 'active'
-                        : '',
+                curTime >= sItem.bg && curTime < sItem.ed && stopAudioS
+                  ? 'active'
+                  : '',
               ]"
               v-for="(sItem, sIndex) in item"
               :key="'curQue.option.child' + sIndex"
@@ -81,7 +81,7 @@
                       : themeColor == 'red'
                       ? 'NPC-play-btn-red'
                       : 'NPC-play-btn-brown',
-                    playClass && mp3_index == sItem.sIndex  ? 'active' : '',
+                    playClass && mp3_index == sItem.sIndex ? 'active' : '',
                   ]"
                   @click="palyAudio(sItem.sIndex)"
                 ></span>
@@ -90,17 +90,15 @@
                   :src="sItem.mp3_list[0].id"
                 ></audio>
               </template>
-              <template v-else-if="sItem.bg||sItem.ed">
-                  <a
-                    :class="[
+              <template v-else-if="sItem.bg || sItem.ed">
+                <a
+                  :class="[
                     'play-btn',
-                    curTime >= sItem.bg &&
-                    curTime < sItem.ed &&
-                    stopAudioS
-                        ? 'active'
-                        : '',
-                    ]"
-                    @click="handleChangeTime(sItem.bg,sItem.ed)"
+                    curTime >= sItem.bg && curTime < sItem.ed && stopAudioS
+                      ? 'active'
+                      : '',
+                  ]"
+                  @click="handleChangeTime(sItem.bg, sItem.ed)"
                 ></a>
               </template>
               <template v-else>
@@ -260,7 +258,7 @@ export default {
       mp3: "",
       curTime: 0,
       stopAudioS: false,
-      ed:null,
+      ed: null,
     };
   },
   //计算属性 类似于data概念
@@ -423,7 +421,7 @@ export default {
       this.$refs.newwordAudio.pause();
     },
     initData() {
-        let _this = this
+      let _this = this;
       if (this.curQue.type == "NewWord_chs") {
         let resIndex = 0;
         let optionRes = [];
@@ -442,9 +440,9 @@ export default {
             if (sItem.mp3_list[0]) {
               mp3List.push(sItem);
             }
-            if(_this.curQue.wordTime&&_this.curQue.wordTime[itemNumber]){
-                sItem.bg = _this.curQue.wordTime[itemNumber].bg
-                sItem.ed = _this.curQue.wordTime[itemNumber].ed
+            if (_this.curQue.wordTime && _this.curQue.wordTime[itemNumber]) {
+              sItem.bg = _this.curQue.wordTime[itemNumber].bg;
+              sItem.ed = _this.curQue.wordTime[itemNumber].ed;
             }
             itemNumber++;
           });
@@ -460,19 +458,19 @@ export default {
       this.curTime = curTime * 1000;
     },
     //点击播放某个句子
-    handleChangeTime(time,edTime) {
+    handleChangeTime(time, edTime) {
       let _this = this;
       _this.curTime = time;
-      _this.stopAudioS = true
+      _this.stopAudioS = true;
       _this.$refs.audioLine.onTimeupdateTime(time / 1000, true);
-      _this.ed = edTime
+      _this.ed = edTime;
     },
     handleListenRead(playFlag) {
       this.stopAudioS = playFlag;
     },
-    emptyEd(){
-        this.ed = null;
-    }
+    emptyEd() {
+      this.ed = null;
+    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
@@ -509,8 +507,8 @@ export default {
 .NPC-zhedie {
   width: 780px;
   margin-bottom: 24px;
-  .aduioLine-box{
-      margin-bottom: 8px;
+  .aduioLine-box {
+    margin-bottom: 8px;
   }
   .practiceBox {
     position: fixed;
@@ -684,8 +682,8 @@ export default {
     background: url("../../../assets/NPC/play-red.png") center no-repeat;
     background-size: cover;
     &.active {
-        background-image: url("../../../assets/NPC/icon-voice-play-red.png");
-        background-size: cover;
+      background-image: url("../../../assets/NPC/icon-voice-play-red.png");
+      background-size: cover;
     }
   }
 }
@@ -693,25 +691,25 @@ export default {
 .NPC-Big-Book-preview-green {
   .NPC-zhedie {
     .play-btn {
-        background: url("../../../assets/NPC/play-green.png") center no-repeat;
-        background-size: cover;
-        &.active {
+      background: url("../../../assets/NPC/play-green.png") center no-repeat;
+      background-size: cover;
+      &.active {
         background-image: url("../../../assets/NPC/icon-voice-play-green.png");
         background-size: cover;
-        }
+      }
     }
   }
 }
 .NPC-Big-Book-preview-brown {
   .NPC-zhedie {
     .play-btn {
-        background: url("../../../assets/NPC/play-brown.png") center no-repeat;
-        background-size: cover;
-        &.active {
+      background: url("../../../assets/NPC/play-brown.png") center no-repeat;
+      background-size: cover;
+      &.active {
         background-image: url("../../../assets/NPC/icon-voice-play-brown.png");
         background-size: cover;
-        }
-    } 
+      }
+    }
   }
 }
 @keyframes firstrotate {

+ 2 - 2
vue.config.js

@@ -43,8 +43,8 @@ module.exports = {
       // change xxx-api/login => mock/login
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
-        // target: `http://gcls.utschool.cn/`,
-        target: `http://gcls.helxsoft.cn/`,
+        target: `http://gcls.utschool.cn/`,
+        //target: `http://gcls.helxsoft.cn/`,
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''