Explorar o código

生词+选择音节

natasha %!s(int64=3) %!d(string=hai) anos
pai
achega
ca22de5f28

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

@@ -111,7 +111,7 @@
 <script>
 import Inputmodule from "../common/Inputmodule.vue";
 import NewordPhraseModule from "../common/NewordPhraseModule.vue";
-import { getWordTime, getContentFile } from "@/api/ajax";
+import { getWordTime, getContentFile, prepareTranscribe } from "@/api/ajax";
 import Upload from "../common/Upload";
 export default {
   name: "Single",

+ 1 - 1
src/components/Adult/preview/AudioLine.vue

@@ -254,7 +254,7 @@ export default {
       }
     },
     onTimeupdateTime(res, playFlag) {
-      if (!res) return;
+      if (!res&&res!=0) return;
       let audioId = this.audioId;
       this.$refs[audioId].currentTime = res;
       this.playValue = (res / this.audio.maxTime) * 100;

+ 90 - 12
src/components/Adult/preview/SelectYinjie.vue

@@ -1,12 +1,40 @@
 <!--  -->
 <template>
   <div class="Big-Book-prev-Textdes SelectYinjie" v-if="curQue">
-    <div class="item-box" v-for="(item, index) in curQue" :key="index">
-      <Audio
+      <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"
+        />
+    </div>
+    <div class="item-box" v-for="(item, index) in curQue.option" :key="index">
+      <!-- <Audio
         :mp3="item.mp3_list.length > 0 ? item.mp3_list[0].url : ''"
         :themeColor="themeColor"
         class="audio-play"
-      />
+      /> -->
+      <a
+        :class="[
+        'play-btn',
+        curTime >= curQue.wordTime[index].bg &&
+        curTime < curQue.wordTime[index].ed &&
+        stopAudio
+            ? 'active'
+            : '',
+        ]"
+        @click="handleChangeTime(curQue.wordTime[index].bg,curQue.wordTime[index].ed)"
+      ></a>
       <b v-if="item.number">{{ item.number }}</b>
       <div class="zijie-box">
         <p
@@ -27,13 +55,17 @@
 </template>
 
 <script>
-import Audio from "../preview/components/AudioRed.vue"; // 音频播放
+import AudioLine from "../preview/AudioLine.vue";
+
 export default {
-  components: { Audio },
+  components: { AudioLine },
   props: ["curQue", "themeColor"],
   data() {
     return {
       userList: [],
+      curTime: 0,
+      stopAudio: false,
+      ed:null,
     };
   },
   computed: {},
@@ -42,7 +74,7 @@ export default {
   methods: {
     handleData() {
       let _this = this;
-      this.curQue.forEach((item) => {
+      this.curQue.option.forEach((item) => {
         _this.userList.push([]);
       });
     },
@@ -57,6 +89,23 @@ export default {
     handleClear(index) {
       this.$set(this.userList, index, []);
     },
+    getCurTime(curTime) {
+      this.curTime = curTime * 1000;
+    },
+    //点击播放某个句子
+    handleChangeTime(time,edTime) {
+      let _this = this;
+      _this.curTime = time;
+      _this.stopAudio = true
+      _this.$refs.audioLine.onTimeupdateTime(time / 1000, true);
+      _this.ed = edTime
+    },
+    handleListenRead(playFlag) {
+      this.stopAudio = playFlag;
+    },
+    emptyEd(){
+        this.ed = null;
+    }
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
@@ -82,6 +131,9 @@ export default {
   box-sizing: border-box;
   border-radius: 8px;
   padding: 24px;
+  .aduioLine-box{
+      margin-bottom: 8px;
+  }
   .item-box {
     display: flex;
     align-items: center;
@@ -105,6 +157,16 @@ export default {
       font-family: "robot";
       line-height: 16px;
     }
+    .play-btn {
+        width: 16px;
+        height: 16px;
+        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;
+        }
+      }
     .zijie-box {
       flex: 1;
       display: flex;
@@ -152,18 +214,34 @@ export default {
 .NPC-Big-Book-preview-green {
   .SelectYinjie {
     .item-box {
-      b {
-        background: #24b99e;
-      }
+        b {
+          background: #24b99e;
+        }
+        .play-btn {
+          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 {
   .SelectYinjie {
     .item-box {
-      b {
-        background: #bd8865;
-      }
+        b {
+          background: #bd8865;
+        }
+        .play-btn {
+          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;
+          }
+        }
     }
   }
 }

+ 106 - 4
src/components/Adult/preview/WordPhrase.vue

@@ -3,10 +3,10 @@
     <div :class="curQue.titleBg == 'white' ? 'topTitleWhite' : 'topTitle'">
       <div class="NPC-top-left">
         <span class="NPC-topTitle-text">{{ curQue.title }}</span>
-        <span
+        <!-- <span
           :class="['NPC-play-all', playClass]"
           @click.stop="playNewwords"
-        ></span>
+        ></span> -->
       </div>
       <div class="NPC-top-right" @click="handleChangeTab">
         <span class="NPC-top-right-text">{{ wordShow ? "收起" : "展开" }}</span>
@@ -31,6 +31,23 @@
         v-if="curQue.option && curQue.option.length > 0"
         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"
+            />
+        </div>
         <ul class="NPC-word-table" cellspacing="0" border="0" cellpadding="0">
           <li
             class="NPC-word-tr"
@@ -41,6 +58,11 @@
               :class="[
                 'NPC-word-row',
                 playClass && mp3_index == sItem.sIndex ? 'active' : '',
+                curTime >= sItem.bg &&
+                    curTime < sItem.ed &&
+                    stopAudioS
+                        ? 'active'
+                        : '',
               ]"
               v-for="(sItem, sIndex) in item"
               :key="'curQue.option.child' + sIndex"
@@ -59,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>
@@ -68,6 +90,19 @@
                   :src="sItem.mp3_list[0].id"
                 ></audio>
               </template>
+              <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)"
+                ></a>
+              </template>
               <template v-else>
                 <span style="width: 16px; height: 16px"></span>
               </template>
@@ -199,11 +234,12 @@
 //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
 //例如:import 《组件名称》from ‘《组件路径》';
 import WordPhraseDetail from "./components/WordPhraseDetail.vue";
-import { getHZChineseInfo } from "@/api/ajax";
+import AudioLine from "../preview/AudioLine.vue";
 export default {
   //import引入的组件需要注入到对象中才能使用
   components: {
     WordPhraseDetail,
+    AudioLine,
   },
   props: ["curQue", "themeColor", "currentTreeID", "indexs", "indexss"],
   data() {
@@ -222,6 +258,9 @@ export default {
       isSuccess: false,
       loading: false,
       mp3: "",
+      curTime: 0,
+      stopAudioS: false,
+      ed:null,
     };
   },
   //计算属性 类似于data概念
@@ -384,10 +423,12 @@ export default {
       this.$refs.newwordAudio.pause();
     },
     initData() {
+        let _this = this
       if (this.curQue.type == "NewWord_chs") {
         let resIndex = 0;
         let optionRes = [];
         let mp3List = [];
+        let itemNumber = 0;
         this.curQue.option.forEach((item, index) => {
           optionRes = optionRes.concat(item);
           item.forEach((sItem, sIndex) => {
@@ -401,6 +442,11 @@ 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
+            }
+            itemNumber++;
           });
         });
         this.optionRes = JSON.parse(JSON.stringify(optionRes));
@@ -410,6 +456,23 @@ export default {
     handleChangeTab() {
       this.wordShow = !this.wordShow;
     },
+    getCurTime(curTime) {
+      this.curTime = curTime * 1000;
+    },
+    //点击播放某个句子
+    handleChangeTime(time,edTime) {
+      let _this = this;
+      _this.curTime = time;
+      _this.stopAudioS = true
+      _this.$refs.audioLine.onTimeupdateTime(time / 1000, true);
+      _this.ed = edTime
+    },
+    handleListenRead(playFlag) {
+      this.stopAudioS = playFlag;
+    },
+    emptyEd(){
+        this.ed = null;
+    }
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
@@ -446,6 +509,9 @@ export default {
 .NPC-zhedie {
   width: 780px;
   margin-bottom: 24px;
+  .aduioLine-box{
+      margin-bottom: 8px;
+  }
   .practiceBox {
     position: fixed;
     left: 0;
@@ -611,6 +677,42 @@ export default {
     display: block;
     cursor: pointer;
   }
+  .play-btn {
+    margin-top: 4px;
+    width: 16px;
+    height: 16px;
+    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;
+    }
+  }
+}
+
+.NPC-Big-Book-preview-green {
+  .NPC-zhedie {
+    .play-btn {
+        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-image: url("../../../assets/NPC/icon-voice-play-brown.png");
+        background-size: cover;
+        }
+    } 
+  }
 }
 @keyframes firstrotate {
   0% {

+ 6 - 7
src/views/discountCodeList.vue

@@ -54,7 +54,7 @@
 </template>
 <script>
 import Header from "@/components/Header";
-import { getContent, LearnWebSI } from "@/api/ajax";
+import { getContent } from "@/api/ajax";
 import { getToken } from '@/utils/auth'
 export default {
     name: "courselist",
@@ -100,13 +100,12 @@ export default {
         onSubmit () {
             if(this.discountNumber){
                 this.loading = true;
-                let MethodName = 'order-discount_manager-BatchCreateDiscountCodeFoGoods'
+                let MethodName = 'book-book_manager-BatchCreateDiscountCodeForBook'
                 let data = {
-                    goods_id:this.bookId,
-                    goods_type: 101,
+                    book_id:this.bookId,
                     count:Number(this.discountNumber)
                 }
-                LearnWebSI(MethodName, data)
+                getContent(MethodName, data)
                 .then((res) => {
                     this.$message.success("操作成功");
                     this.discountNumber = null
@@ -160,11 +159,11 @@ export default {
                 type: "warning",
             })
                 .then(() => {
-                    let MethodName = "order-discount_manager-DeleteGoodsDiscountCode";
+                    let MethodName = "book-book_manager-DeleteBookDiscountCode";
                     let data = {
                         id: row.id,
                     };
-                    LearnWebSI(MethodName, data).then(
+                    getContent(MethodName, data).then(
                         (res) => {
                             this.currentPage = 1;
                             this.getList()