Browse Source

合并分支

natasha 3 years ago
parent
commit
2f79252792

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

@@ -121,7 +121,7 @@
           v-if="item.number || item.z_title || item.f_title"
         >
           <b v-if="item.number">{{ item.number }}</b>
-          <div class="title-box-right">
+          <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"
@@ -898,6 +898,9 @@ export default {
           white-space: pre-wrap;
           word-break: break-word;
         }
+        .title-box-right-index{
+            padding-left: 51px;
+        }
       }
     }
     .NNPE-tableList {

+ 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;
+          }
+        }
     }
   }
 }

+ 7 - 1
src/components/Adult/preview/SentenceSortQP.vue

@@ -14,6 +14,7 @@
           :options="{
             group: { name: 'itxst' + index, pull: 'clone' },
           }"
+          class="content-box"
         >
           <transition-group>
             <div
@@ -269,6 +270,11 @@ export default {
       line-height: 32px;
       margin-right: 4px;
     }
+    .content-box{
+        background: #E9E9E9;
+        padding: 8px;
+        border-radius: 8px;
+    }
   }
   .fw {
     height: 100%;
@@ -304,7 +310,7 @@ export default {
         .item {
           // width: 82px;
           // height: 70px;
-          padding: 8px 16px;
+          padding: 0px 16px;
           background: #ffffff;
           border-radius: 8px;
           text-align: center;

+ 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% {

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

@@ -240,7 +240,7 @@ export default {
 
   .close-icon {
     position: absolute;
-    top: 8px;
+    top: 0px;
     right: 8px;
     width: 32px;
     height: 32px;

+ 1 - 1
src/components/TreeView.vue

@@ -9,7 +9,7 @@
               : '0px',
         }"
         class="tree_box"
-        slot-scope="{ node, index, path, tree }"
+        slot-scope="{ node, path, tree }"
       >
         <span
           @click="tree.toggleFold(node, path)"

+ 61 - 56
src/router/index.js

@@ -28,69 +28,74 @@ Vue.use(Router);
  * all roles can be accessed
  */
 export const constantRoutes = [{
-  path: '/404',
-  component: () =>
-    import('@/views/404'),
-  hidden: true
-},
-{
-  path: '/login',
-  component: () =>
-    import('@/views/login'),
-  hidden: true
-},
-{
-  path: '/',
-  redirect: '/EnterSys',
-  hidden: true
-},
-{
-  path: '/EnterSys',
-  component: () =>
-    import('@/views/courseList')
-},
-{
-  path: '/courseView',
-  component: () =>
-    import('@/views/courseView')
-},
-{
-  path: '/bookView',
-  component: () =>
-    import('@/views/bookView')
-},
-{
-  path: '/adultInput',
-  component: () =>
-    import('@/views/adultInput')
-},
-{
-  path: '/adultInput3',
-  component: () =>
-    import('@/views/adultInput3')
-},
-{
-  path: '/JoinLine',
-  component: () =>
-    import('@/components/common/JoinLine')
-},
-// 404 page must be placed at the end !!!
-{ path: '*', redirect: '/', hidden: true }
+        path: '/404',
+        component: () =>
+            import ('@/views/404'),
+        hidden: true
+    },
+    {
+        path: '/login',
+        component: () =>
+            import ('@/views/login'),
+        hidden: true
+    },
+    {
+        path: '/',
+        redirect: '/EnterSys',
+        hidden: true
+    },
+    {
+        path: '/EnterSys',
+        component: () =>
+            import ('@/views/courseList')
+    },
+    {
+        path: '/courseView',
+        component: () =>
+            import ('@/views/courseView')
+    },
+    {
+        path: '/bookView',
+        component: () =>
+            import ('@/views/bookView')
+    },
+    {
+        path: '/adultInput',
+        component: () =>
+            import ('@/views/adultInput')
+    },
+    {
+        path: '/adultInput3',
+        component: () =>
+            import ('@/views/adultInput3')
+    },
+    {
+        path: '/JoinLine',
+        component: () =>
+            import ('@/components/common/JoinLine')
+    },
+    {
+        path: '/discountCodeList',
+        component: () =>
+            import ('@/views/discountCodeList')
+    },
+    // 404 page must be placed at the end !!!
+    { path: '*', redirect: '/', hidden: true }
 ];
 
 const createRouter = () =>
-  new Router({
-    // mode: 'history', // require service support
-    scrollBehavior: () => ({ y: 0 }),
-    routes: constantRoutes
-  });
+    new Router({
+        // mode: 'history', // require service support
+        scrollBehavior: () => ({ y: 0 }),
+        routes: constantRoutes
+    });
 
 const router = createRouter();
 
 // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
 export function resetRouter() {
-  const newRouter = createRouter();
-  router.matcher = newRouter.matcher; // reset router
+    const newRouter = createRouter();
+    router.matcher = newRouter.matcher; // reset router
 }
 
-export default router;
+export default router;

+ 6 - 1
src/views/adultInput.vue

@@ -144,7 +144,11 @@
               @blur="onBlur(topic, 'f_title')"
             />
           </div>
-
+          <div class="Big-Book-top">
+            <span>标题缩进</span>
+            <el-radio v-model="topic.is_textIndex" :label="true">是</el-radio>
+            <el-radio v-model="topic.is_textIndex" :label="false">否</el-radio>
+          </div>
           <div class="Big-Book-top">
             <span>是否有背景色</span>
             <el-radio v-model="topic.is_bg" :label="true">有</el-radio>
@@ -1121,6 +1125,7 @@ export default {
           f_title: "",
           is_bg: false, // 是否有背景色
           is_layout: false, // 是不是按背景图布局
+          is_textIndex: false,
           table_list: [],
         };
         for (let i = 0; i < this.row; i++) {

+ 1 - 1
src/views/courseList.vue

@@ -677,7 +677,7 @@ export default {
     getMyOrgList() {
       let MethodName = "org_manager-GetMyOrgList";
       let data = {
-        audited_status: -1,
+        audited_status: 1,
       };
       getContentFile(MethodName, data).then((res) => {
         if (res && res.org_list.length > 0) {

+ 35 - 4
src/views/courseView.vue

@@ -2,7 +2,7 @@
   <div class="container">
     <Header />
     <div class="content">
-      <div id="content-tree" class="content-tree">
+      <div id="content-tree" :class="[fullTree ? 'content-tree-full' : 'content-tree']">
         <TreeView
           ref="treeView"
           :book-id="bookId"
@@ -18,17 +18,22 @@
         <div v-if="chapterId" class="title-box">
           <img
             v-if="!treeFlag"
-            src="../assets/common/icon-treelist.png"
+            src="../assets/common/icon-view-back.png"
             @click="treeShow"
           />
+          <img
+            v-if="!treeFlag"
+            src="../assets/common/icon-treelist.png"
+            @click="chooseCourseware"
+          />
           <!-- <h2 class="title">{{ chapterName }}</h2> -->
-          <el-switch
+          <!-- <el-switch
             v-if="!treeFlag"
             v-model="switchvalue"
             active-color="#FF9900"
             active-text
             inactive-text="生词模式"
-          />
+          /> -->
         </div>
         <Preview
           :context="context"
@@ -80,6 +85,7 @@ export default {
       FatherTreeData: null,
       themeColor: "",
       loading: false,
+      fullTree: false, // 全屏模式下树是否显示
     };
   },
   created() {
@@ -98,6 +104,10 @@ export default {
       _this.isAnswerShow = false;
 
       _this.onGetData();
+      if (!_this.treeFlag) {
+        _this.fullTree = false;
+        document.getElementById("content-tree").style.display = "none";
+      }
     },
     // 点击全屏展示 隐藏tree
     fullScreen() {
@@ -106,6 +116,7 @@ export default {
     },
     treeShow() {
       this.treeFlag = true;
+      this.fullTree = false;
       document.getElementById("content-tree").style.display = "block";
     },
     // 获取预览数据
@@ -163,6 +174,15 @@ export default {
     handleBookUserAnswer(data) {
       console.log(data);
     },
+    // 悬浮树隐藏显示
+    chooseCourseware() {
+      this.fullTree = !this.fullTree;
+      if (this.fullTree) {
+        document.getElementById("content-tree").style.display = "block";
+      } else {
+        document.getElementById("content-tree").style.display = "none";
+      }
+    },
   },
 };
 </script>
@@ -187,6 +207,17 @@ export default {
       left: 0;
       padding-top: 64px;
     }
+    .content-tree-full {
+      position: fixed;
+      top: 100px;
+      left: 152px;
+      max-height: 588px;
+      overflow: auto;
+      z-index: 999;
+      background: #fff;
+      box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.25);
+      border-radius: 4px;
+    }
     .inner {
       // border-left: 1px solid #d9d9d9;
       width: 1000px;

+ 223 - 0
src/views/discountCodeList.vue

@@ -0,0 +1,223 @@
+<template>
+    <div class="discountCodeList">
+        <Header/>
+        <div class="contentInner">
+            <div class="search-form">
+                <el-form
+                    :inline="true"
+                    ref="form"
+                    style="margin-left: 10px"
+                >
+                    <el-form-item>
+                        <el-form-item class="label-input" label="优惠码" style="margin-right:30px;">
+                            <el-input placeholder="输入生成激活码数量" v-model="discountNumber" type="number" oninput ="value=value.replace(/[^0-9]/g,'')"></el-input>
+                        </el-form-item>
+                        <el-button @click="onSubmit" size="medium" type="primary" :loading="loading">生成</el-button>
+                    </el-form-item>
+                </el-form>
+                <el-form :inline="true">
+                    <el-form-item class="label-input" label="导出选项:" style="margin-right:30px;">
+                        <el-radio v-model="exportRadio" :label="-1">全部</el-radio>
+                        <el-radio v-model="exportRadio" :label="1">已使用</el-radio>
+                        <el-radio v-model="exportRadio" :label="0">未使用</el-radio>
+                    </el-form-item>
+                    <el-button @click="onExport" size="medium" type="primary" :loading="exportLoading">导出 excel</el-button>
+                </el-form>
+            </div>
+            <div class="table-box">
+                <el-table :data="tableData" style="width: 100%" v-loading="tableloading">
+                    <el-table-column class="table-firstC" label="优惠码" prop="discount_code" width="150"></el-table-column>
+                    <el-table-column label="状态" prop="is_used" width="150" :formatter="handleStatus"></el-table-column>
+                    <el-table-column label="使用者" prop="consumer_name" width="150"></el-table-column>
+                    <el-table-column label="使用时间" prop="use_time" width="200"></el-table-column>
+                    <el-table-column label="使用者所属机构" prop="consumer_org_name" width="250"></el-table-column>
+                    <el-table-column label="创建时间" prop="create_time" width="200"></el-table-column>
+                    <el-table-column fixed="right" label="操作" prop width="100">
+                        <template slot-scope="scope">
+                            <el-button @click="handleDel(scope.row)" type="text">删除</el-button>
+                        </template>
+                    </el-table-column>
+                </el-table>
+            </div>
+
+            <el-pagination
+                :current-page="currentPage"
+                :page-size="10"
+                :page-sizes="[1, 10, 20, 30, 40, 50]"
+                :total="courseTotal"
+                @current-change="handleCurrentChange"
+                @size-change="handleSizeChange"
+                layout="total, sizes, prev, pager, next, jumper"
+            ></el-pagination>
+        </div>
+    </div>
+</template>
+<script>
+import Header from "@/components/Header";
+import { getContent } from "@/api/ajax";
+import { getToken } from '@/utils/auth'
+export default {
+    name: "courselist",
+    components: {
+        Header
+    },
+    data () {
+        return {
+            bookId: '',
+            discountNumber:null, // 生成数量
+            loading:false, 
+            tableData: [], // 数据内容
+            currentPage: 1, // 当前页码
+            page_capacity: 10, // 每页条数
+            courseTotal: 0, // 数据总条数
+            tableloading:true,
+            usedStatus:{
+                'true':'已使用',
+                'false':'未使用'
+            },
+            exportRadio:-1,
+            exportLoading:false,
+        }
+    },
+    created() {
+        const _this = this
+        _this.bookId = this.$route.query.bookId
+        this.getList();
+    },
+    methods:{
+        // 切换每页条数
+        handleSizeChange (val) {
+            this.currentPage = 1;
+            this.page_capacity = val;
+            this.getList();
+        },
+        // 切换页码
+        handleCurrentChange (val) {
+            this.currentPage = val;
+            this.getList();
+        },
+        // 生成数量
+        onSubmit () {
+            if(this.discountNumber){
+                this.loading = true;
+                let MethodName = 'book-book_manager-BatchCreateDiscountCodeForBook'
+                let data = {
+                    book_id:this.bookId,
+                    count:Number(this.discountNumber)
+                }
+                getContent(MethodName, data)
+                .then((res) => {
+                    this.$message.success("操作成功");
+                    this.discountNumber = null
+                    this.loading = false;
+                    this.pageIndex = 1
+                    this.getList()
+                })
+                .catch(() => {
+                    this.loading = false;
+                });
+            }else{
+                this.$message(
+                    {
+                        type: "warning",
+                        message: "请输入生成激活码数量!",
+                    },
+                    2000
+                );
+                return false;
+            }
+        },
+        // 查询数据列表
+        getList () {
+            let MethodName = "page_query-PageQueryBookDiscountCodeList";
+            let data = {
+                book_id: this.bookId,
+                page_capacity: this.page_capacity,
+                cur_page: this.currentPage,
+                use_status:-1
+            };
+            getContent(MethodName, data).then(
+                (res) => {
+                    let _this = this;
+                    _this.tableData = res.discount_code_list;
+                    _this.courseTotal = res.total_count;
+                    _this.tableloading = false;
+                }
+            );
+        },
+        // 处理发布状态
+        handleStatus (row) {
+            if (row) {
+                return this.usedStatus[row.is_used];
+            }
+        },
+        // 删除书籍
+        handleDel (row) {
+            this.$confirm("确定要删除此优惠码吗?", "提示", {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning",
+            })
+                .then(() => {
+                    let MethodName = "book-book_manager-DeleteBookDiscountCode";
+                    let data = {
+                        id: row.id,
+                    };
+                    getContent(MethodName, data).then(
+                        (res) => {
+                            this.currentPage = 1;
+                            this.getList()
+                            this.$message({
+                                type: 'success',
+                                message: '删除成功!'
+                            })
+                        }
+                    ).catch(() => {
+                    })
+                })
+                .catch(() => { });
+        },
+        // 导出
+        onExport(){
+            this.exportLoading = true
+            let userInfor = getToken();
+            let UserCode = '',
+                UserType = '',
+                SessionID = ''
+            if (userInfor) {
+                let user = JSON.parse(getToken());
+                UserCode = user.user_code;
+                UserType = user.user_type;
+                SessionID = user.session_id;
+            }
+            let MethodName = "data_export-ExportBookDiscountCodeList"
+            let data = {
+                book_id: this.bookId,
+                use_status:this.exportRadio
+            }
+            window.open(process.env.VUE_APP_BASE_API +
+                    `/GCLSBookWebSI/ServiceInterface?MethodName=${MethodName}&UserCode=${UserCode}&UserType=${UserType}&SessionID=${SessionID}&Parameter=${encodeURIComponent(JSON.stringify(data))}`) 
+            this.exportLoading = false
+        }
+    }
+}
+</script>
+<style lang="scss" scoped>
+.discountCodeList{
+    width: 100%;
+    background: #f5f5f5;
+    .contentInner{
+        width: 100%;
+        max-width: 1200px;
+        margin: 0 auto;
+        height: auto;
+        padding:30px 0;
+    }
+    .search-form{
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+    }
+}
+
+</style>