Browse Source

Merge branch 'NPC-lhd'

# Conflicts:
#	src/components/Adult/preview/DialogueArticleViewChs/index.vue
natasha 2 years ago
parent
commit
bacaf112ab

File diff suppressed because it is too large
+ 462 - 419
src/components/Adult/Preview.vue


+ 18 - 19
src/components/Adult/preview/DialogueArticleViewChs/index.vue

@@ -14,7 +14,7 @@
           class="left"
           @click="submit"
           :style="{ marginLeft: showPractice ? '97px' : '' }"
-          v-if="tokenData.popedom_code_list.indexOf(2000001) != -1"
+          v-if="tokenData.popedom_code_list.indexOf(2000001) != -1&&1==2"
         >
           <img src="../../../../assets/NPC/wbfx-icon.png" alt="" />
           文本分析
@@ -152,7 +152,7 @@ export default {
     "colorBox",
     "themeColor",
     "currentTreeID",
-    "TaskModel",
+    "TaskModel"
   ],
   components: { NormalModelChs, Practice, WordModel, PhraseModel },
   data() {
@@ -172,23 +172,23 @@ export default {
         isShowEN: false,
         isHasEN: false,
         isShowPY: false,
-        isHasPY: false,
+        isHasPY: false
       },
       userAnswer: {
         normalModel: {
-          recordList: [],
+          recordList: []
         },
         writeModel: {}, //生词/取词模式
         practiceModel: {}, //练习模式
         wordModel: {
-          recordList: [],
-        },
+          recordList: []
+        }
       },
-      tokenData: null,
+      tokenData: null
     };
   },
   computed: {
-    activeColor: function () {
+    activeColor: function() {
       let color = "";
       if (this.themeColor == "red") {
         color = "#DE4444";
@@ -199,7 +199,7 @@ export default {
       }
 
       return color;
-    },
+    }
   },
   watch: {},
   //方法集合
@@ -209,21 +209,21 @@ export default {
         lock: true,
         text: "Loading",
         spinner: "el-icon-loading",
-        background: "rgba(0, 0, 0, 0.7)",
+        background: "rgba(0, 0, 0, 0.7)"
       });
       console.log(this.curQue);
       analysSubmit({
         tenantId: "",
-        text: this.curQue.article,
+        text: this.curQue.article
       })
-        .then((res) => {
+        .then(res => {
           window.open(
             process.env.VUE_APP_BASE_API +
               `/GCLS-TC/#/textanalysis/Result?partitionKey=${res.data.result.partitionKey}&subjectWords=${res.data.result.subjectWords}&wordTextCount=${res.data.result.textCount}&wordCount=${res.data.result.wordCount}&vocabularyTextCount=${res.data.result.vocabularyTextCount}&vocabularyCount=${res.data.result.vocabularyCount}&pinyinCount=${res.data.result.pinyinCount}&pinyinTextCount=${res.data.result.pinyinTextCount}&pinyinDifficulty=${res.data.result.pinyinDifficulty}&wordDifficulty=${res.data.result.wordDifficulty}&vocabularyDifficulty=${res.data.result.vocabularyDifficulty}&type=文本分析`
           );
           loading.close();
         })
-        .catch((res) => {
+        .catch(res => {
           loading.close();
         });
     },
@@ -268,11 +268,11 @@ export default {
     articleFullScreen() {},
     handleObj(list) {
       let pinyin = "";
-      list.forEach((item) => {
+      list.forEach(item => {
         pinyin += item.pinyin;
       });
       return pinyin;
-    },
+    }
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
@@ -288,8 +288,7 @@ export default {
     }
     if (_this.curQue) {
       _this.$nextTick(() => {
-        _this.bodyLeft =
-          _this.$refs.ArticleViewbody.getBoundingClientRect().left;
+        _this.bodyLeft = _this.$refs.ArticleViewbody.getBoundingClientRect().left;
       });
       for (let i = 0; i < _this.curQue.detail.length; i++) {
         let enStr = this.curQue.detail[i].sentencesEn.join("");
@@ -314,10 +313,10 @@ export default {
   updated() {}, //生命周期 - 更新之后
   beforeDestroy() {}, //生命周期 - 销毁之前
   destroyed() {}, //生命周期 - 销毁完成
-  activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
+  activated() {} //如果页面有keep-alive缓存功能,这个函数会触发
 };
 </script>
-<style lang='scss' scoped>
+<style lang="scss" scoped>
 //@import url(); 引入公共css类
 .NPC-ArticleView {
   width: 100%;

+ 125 - 76
src/components/Adult/preview/Ligature.vue

@@ -4,7 +4,11 @@
       <div class="left">
         <ul>
           <div>{{ curQue.conTitle }}</div>
-          <li v-for="(item, index) in curQue.con" :key="'left' + index">
+          <li
+            :class="'left' + index + number"
+            v-for="(item, index) in curQue.con"
+            :key="'left' + index"
+          >
             <!--             :style="{
               background:
                 JSON.stringify(data).indexOf(item.nodeId) != -1
@@ -16,8 +20,13 @@
                 v-if="item.img_list.length > 0"
                 :src="item.img_list[0].id"
                 alt=""
+                @load="conImageload"
               />
-              <div class="text" :class="'left' + index">
+              <div
+                class="text"
+                :class="'left' + index"
+                v-if="item.detail.wordsList.length > 0 || item.detail.sentence"
+              >
                 <!-- 大于0就说明分词了 -->
                 <template v-if="item.detail.wordsList.length > 0">
                   <div
@@ -92,7 +101,11 @@
       <div class="right">
         <ul>
           <div>{{ curQue.optionTitle }}</div>
-          <li v-for="(item, index) in curQue.option" :key="'right' + index">
+          <li
+            :class="'right' + index + number"
+            v-for="(item, index) in curQue.option"
+            :key="'right' + index"
+          >
             <!--             :style="{
               background:
                 JSON.stringify(data).indexOf(item.nodeId) != -1
@@ -119,8 +132,13 @@
                 v-if="item.img_list.length > 0"
                 :src="item.img_list[0].id"
                 alt=""
+                @load="conImageload"
               />
-              <div class="text" :class="'right' + index">
+              <div
+                class="text"
+                :class="'right' + index"
+                v-if="item.detail.wordsList.length > 0 || item.detail.sentence"
+              >
                 <!-- 大于0就说明分词了 -->
                 <template v-if="item.detail.wordsList.length > 0">
                   <div
@@ -179,7 +197,7 @@
       </div>
     </div>
     <!-- 清除所有连线及连线的状态 -->
-    <div class="fuwei" :class="[TaskModel == 'ANSWER'?'notAllow':'']">
+    <div class="fuwei" :class="[TaskModel == 'ANSWER' ? 'notAllow' : '']">
       <div @click="clearLine">
         <img src="../../../assets/adult/fuwei.png" alt="" />
         复位
@@ -194,7 +212,7 @@
 export default {
   //import引入的组件需要注入到对象中才能使用
   components: {},
-  props: ["curQue","TaskModel"],
+  props: ["curQue", "TaskModel", "number"],
   data() {
     //这里存放数据
     return {
@@ -202,32 +220,32 @@ export default {
       leftList: [
         {
           text: "Arrive at the airport ahead of time ______",
-          nodeId: "left_1",
+          nodeId: "left_1"
         },
         {
           text: "Arrive at the airport ahead of time ______",
-          nodeId: "left_2",
+          nodeId: "left_2"
         },
         {
           text: "Arrive at the airport ahead of time ______",
-          nodeId: "left_3",
+          nodeId: "left_3"
         },
         {
           text: "Arrive at the airport ahead of time ______",
-          nodeId: "left_4",
+          nodeId: "left_4"
         },
         {
           text: "Arrive at the airport ahead of time ______",
-          nodeId: "left_5",
+          nodeId: "left_5"
         },
         {
           text: "Arrive at the airport ahead of time ______",
-          nodeId: "left_6",
+          nodeId: "left_6"
         },
         {
           text: "Arrive at the airport ahead of time ______",
-          nodeId: "left_7",
-        },
+          nodeId: "left_7"
+        }
       ],
       rightList: [
         { text: "把来访者直接送到宾馆", en: "a", nodeId: "right_1" },
@@ -236,8 +254,10 @@ export default {
         { text: "把来访者直接送到宾馆", en: "d", nodeId: "right_4" },
         { text: "把来访者直接送到宾馆", en: "e", nodeId: "right_5" },
         { text: "把来访者直接送到宾馆", en: "f", nodeId: "right_6" },
-        { text: "把来访者直接送到宾馆", en: "g", nodeId: "right_7" },
+        { text: "把来访者直接送到宾馆", en: "g", nodeId: "right_7" }
       ],
+      allimgnumber: 0,
+      lodimgnumber: 0
     };
   },
   //计算属性 类似于data概念
@@ -246,17 +266,17 @@ export default {
   watch: {
     curQue(val, oldval) {
       this.$forceUpdate(); //触发更新函数更新高度
-    },
+    }
   },
   //方法集合
   methods: {
     //   清除所有连线
     clearLine() {
-        if(!this.TaskModel||this.TaskModel!='ANSWER'){
-            this.jsPlumb.deleteEveryConnection(); //清除连线方法
-            this.data = [];
-            sessionStorage.removeItem("LineData");
-        }
+      if (!this.TaskModel || this.TaskModel != "ANSWER") {
+        this.jsPlumb.deleteEveryConnection(); //清除连线方法
+        this.data = [];
+        sessionStorage.removeItem("LineData");
+      }
     },
     showPlumb() {
       this.jsPlumb = this.$jsPlumb.getInstance({
@@ -293,7 +313,7 @@ export default {
           //   ],
         ],
         Connector: ["Straight"], // 要使用的默认连接器的类型:直线,折线,曲线等
-        DrapOptions: { cursor: "crosshair", zIndex: 2000 },
+        DrapOptions: { cursor: "crosshair", zIndex: 2000 }
       });
       this.jsPlumb.batch(() => {
         for (let i = 0; i < this.curQue.con.length; i++) {
@@ -302,42 +322,42 @@ export default {
         for (let j = 0; j < this.curQue.option.length; j++) {
           this.initLeaf(this.curQue.option[j].nodeId, "target");
         }
-      });    
+      });
       this.setjsPlumb(true, true);
       //点击连线
       this.jsPlumb.bind("click", (conn, originalEvent) => {
-          if(!this.TaskModel||this.TaskModel!='ANSWER'){
-            // 删除点击的线
-            this.data.forEach((item, i) => {
+        if (!this.TaskModel || this.TaskModel != "ANSWER") {
+          // 删除点击的线
+          this.data.forEach((item, i) => {
             if (item.source == conn.sourceId) {
-                this.data.splice(i, 1);
+              this.data.splice(i, 1);
             }
-            });
-            let node = document.getElementById(conn.sourceId);
-            this.jsPlumb.removeAllEndpoints(node);
-            sessionStorage.setItem("LineData", JSON.stringify(this.data));
-            this.$set(this.curQue, "Bookanswer", JSON.stringify(this.data));
-          }
+          });
+          let node = document.getElementById(conn.sourceId);
+          this.jsPlumb.removeAllEndpoints(node);
+          sessionStorage.setItem("LineData", JSON.stringify(this.data));
+          this.$set(this.curQue, "Bookanswer", JSON.stringify(this.data));
+        }
       });
 
       //连线时触发
       this.jsPlumb.bind("connection", (conn, originalEvent) => {
-          if(!this.TaskModel||this.TaskModel!='ANSWER'){
-            let fig = false;
-            this.data.forEach((item) => {
-                if (item.source == conn.sourceId && item.target == conn.targetId) {
-                    fig = true;
-                }
-            });
-            if (!fig) {
-                this.data.push({
-                    source: conn.sourceId,
-                    target: conn.targetId,
-                });
-                sessionStorage.setItem("LineData", JSON.stringify(this.data));
-                this.$set(this.curQue, "Bookanswer", JSON.stringify(this.data));
+        if (!this.TaskModel || this.TaskModel != "ANSWER") {
+          let fig = false;
+          this.data.forEach(item => {
+            if (item.source == conn.sourceId && item.target == conn.targetId) {
+              fig = true;
             }
+          });
+          if (!fig) {
+            this.data.push({
+              source: conn.sourceId,
+              target: conn.targetId
+            });
+            sessionStorage.setItem("LineData", JSON.stringify(this.data));
+            this.$set(this.curQue, "Bookanswer", JSON.stringify(this.data));
           }
+        }
       });
 
       //右键触发
@@ -353,13 +373,13 @@ export default {
         ins.makeSource(elem, {
           anchor: [1, 0.5, 0.5, 0.5], // 左 上 右 下  数字我调不太准确 可改成left right
           allowLoopback: false, //允许回连
-          maxConnections: 1, //最大连接数(-1表示不限制)
+          maxConnections: 1 //最大连接数(-1表示不限制)
         });
       } else {
         ins.makeTarget(elem, {
           anchor: [0, 0.5, 0, 0],
           allowLoopback: false,
-          maxConnections: 1,
+          maxConnections: 1
         });
       }
     },
@@ -371,15 +391,36 @@ export default {
       this.jsPlumb.setDraggable(source, false); // 是否支持拖拽
       this.jsPlumb.setDraggable(target, false); // 是否支持拖拽
     },
+    conImageload() {
+      this.lodimgnumber++;
+      let _this = this;
+      if (_this.lodimgnumber == _this.allimgnumber) {
+        _this.curQue.option.forEach((item, index) => {
+          for (let i = 0; i < this.curQue.con.length; i++) {
+            let nodeleft = document.getElementsByClassName(
+              `left${i + this.number}`
+            )[0];
+            let noderight = document.getElementsByClassName(
+              `right${index + this.number}`
+            )[0];
+            if (nodeleft.offsetHeight > noderight.offsetHeight) {
+              noderight.style.height = nodeleft.offsetHeight + "px";
+            } else {
+              nodeleft.style.height = noderight.offsetHeight + "px";
+            }
+          }
+        });
+      }
+    }
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
-    let sData = null
+    let sData = null;
     if (!this.curQue.Bookanswer) {
-        // sData = JSON.parse(sessionStorage.getItem("LineData"));
-        sData = []
-    }else{
-        sData = JSON.parse(this.curQue.Bookanswer)
+      // sData = JSON.parse(sessionStorage.getItem("LineData"));
+      sData = [];
+    } else {
+      sData = JSON.parse(this.curQue.Bookanswer);
     }
     this.data = [];
     if (sData) {
@@ -387,35 +428,43 @@ export default {
     }
     this.curQue.con.forEach((item, i) => {
       item.nodeId = "left_" + i;
+      if (item.img_list.length > 0) {
+        this.allimgnumber++;
+      }
     });
     this.curQue.option.forEach((item, i) => {
       item.nodeId = "right_" + i;
+      if (item.img_list.length > 0) {
+        this.allimgnumber++;
+      }
     });
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
     this.showPlumb();
     // 根据记录自动连起来
-    for (let i = 0; i < this.curQue.con.length; i++) {
-      let nodeleft = document.getElementsByClassName(`left${i}`)[0];
-      let noderight = document.getElementsByClassName(`right${i}`)[0];
-      if (nodeleft && noderight) {
-        console.log(nodeleft);
-        console.log(noderight);
-        if (nodeleft.offsetHeight > noderight.offsetHeight) {
-          noderight.style.height = nodeleft.offsetHeight + "px";
-        } else {
-          nodeleft.style.height = noderight.offsetHeight + "px";
+    if (this.allimgnumber == 0) {
+      for (let i = 0; i < this.curQue.con.length; i++) {
+        let nodeleft = document.getElementsByClassName(`left${i}`)[0];
+        let noderight = document.getElementsByClassName(`right${i}`)[0];
+        if (nodeleft && noderight) {
+          console.log(nodeleft);
+          console.log(noderight);
+          if (nodeleft.offsetHeight > noderight.offsetHeight) {
+            noderight.style.height = nodeleft.offsetHeight + "px";
+          } else {
+            nodeleft.style.height = noderight.offsetHeight + "px";
+          }
         }
       }
     }
     setTimeout(() => {
       if (this.data.length > 0) {
-          console.log(this.data)
-        this.data.forEach((item) => {
+        console.log(this.data);
+        this.data.forEach(item => {
           this.jsPlumb.connect({
             source: item.source,
-            target: item.target,
+            target: item.target
           });
         });
       }
@@ -446,7 +495,7 @@ export default {
   //生命周期-销毁完成
   destoryed() {},
   //如果页面有keep-alive缓存功能,这个函数会触发
-  activated() {},
+  activated() {}
 };
 </script>
 <style lang="scss" scoped>
@@ -500,7 +549,7 @@ export default {
             line-height: 150%;
             color: #000000;
             img {
-              width: 238px;
+              max-width: 238px;
               height: 158px;
             }
             .text {
@@ -521,7 +570,7 @@ export default {
           span {
             width: 24px;
             height: 24px;
-            font-family: 'robot';
+            font-family: "robot";
             font-style: normal;
             font-weight: normal;
             font-size: 16px;
@@ -564,7 +613,7 @@ export default {
           > span {
             width: 24px;
             height: 24px;
-            font-family: 'robot';
+            font-family: "robot";
             font-style: normal;
             font-weight: normal;
             font-size: 16px;
@@ -578,7 +627,7 @@ export default {
           }
           div {
             img {
-              width: 238px;
+              max-width: 238px;
               height: 158px;
             }
             .text {
@@ -603,10 +652,10 @@ export default {
   .fuwei {
     margin-top: 16px;
     height: 40px;
-    &.notAllow{
-        >div{
-            cursor: not-allowed;
-        }
+    &.notAllow {
+      > div {
+        cursor: not-allowed;
+      }
     }
     > div {
       float: right;

+ 20 - 20
src/views/TextbookDetail.vue

@@ -172,8 +172,8 @@
     <template
       v-if="
         TextbookData.is_deleted == 'false' &&
-        bookIsBuy == 'false' &&
-        TextbookData.publish_status == 0
+          bookIsBuy == 'false' &&
+          TextbookData.publish_status == 0
       "
     >
       <div class="noview-msg-box">
@@ -183,7 +183,7 @@
     <!-- 商品详情 -->
     <el-dialog
       class="buyWindow"
-      :title="$t('Key52')"
+      title=""
       :visible.sync="NopymentShow"
       width="720px"
       :before-close="closeNoPyment"
@@ -226,7 +226,7 @@ export default {
     Header,
     Confirmorder,
     Payment,
-    BookView,
+    BookView
   },
   props: {},
   data() {
@@ -244,7 +244,7 @@ export default {
       IsDownload: false, //是否可以下载
       detailSHow: true, // 除教材预览外其他内容是否显示
       bookIsBuy: "false", // 教材是否已购买
-      isData: false,
+      isData: false
     };
   },
   //计算属性 类似于data概念
@@ -307,9 +307,9 @@ export default {
           goods_name: this.TextbookData.name,
           goods_person_name_desc: this.TextbookData.author,
           goods_picture_id: this.TextbookData.picture_id,
-          goods_price: this.TextbookData.price,
+          goods_price: this.TextbookData.price
         };
-        LearnWebSI(Mname, data).then((res) => {
+        LearnWebSI(Mname, data).then(res => {
           this.enshrine = "true";
           this.$message.success(this.$t("Key575")); //"收藏成功"
         });
@@ -317,9 +317,9 @@ export default {
         let Mname = "order-collection_manager-CancelMyGoodsCollection";
         let data = {
           goods_type: 101,
-          goods_id_list: [this.TextBookId],
+          goods_id_list: [this.TextBookId]
         };
-        LearnWebSI(Mname, data).then((res) => {
+        LearnWebSI(Mname, data).then(res => {
           this.enshrine = "false";
           this.$message.success(this.$t("Key396")); //"取消收藏成功"
         });
@@ -341,9 +341,9 @@ export default {
       let Mname = "order-order_manager-CheckMyGoodsBuyStatus";
       let data = {
         goods_type: 101,
-        goods_id: this.TextBookId,
+        goods_id: this.TextBookId
       };
-      LearnWebSI(Mname, data).then((res) => {
+      LearnWebSI(Mname, data).then(res => {
         this.bookIsBuy = res.is_buy; //是否已购买 true 是 false 否
       });
     },
@@ -352,9 +352,9 @@ export default {
       let Mname = "order-collection_manager-CheckMyGoodsCollectionStatus";
       let data = {
         goods_type: 101,
-        goods_id: this.TextBookId,
+        goods_id: this.TextBookId
       };
-      LearnWebSI(Mname, data).then((res) => {
+      LearnWebSI(Mname, data).then(res => {
         this.enshrine = res.is_collection;
       });
     },
@@ -364,18 +364,18 @@ export default {
       let Mname = "book-book_manager-GetBook";
       // 获取课程详情
       TextbookAPI(Mname, {
-        id: this.TextBookId,
+        id: this.TextBookId
       })
-        .then((res) => {
+        .then(res => {
           this.TextbookData = res;
           this.loading = false;
         })
-        .catch((res) => {
+        .catch(res => {
           this.loading = false;
         });
       this.handleIsBuy();
       this.handleIsEnshrine();
-    },
+    }
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   async created() {
@@ -401,8 +401,8 @@ export default {
         "Key475",
         "Key575",
         "Key612",
-        "Key613",
-      ],
+        "Key613"
+      ]
     });
     this.isData = true;
     this.getdetail();
@@ -422,7 +422,7 @@ export default {
   //生命周期-销毁完成
   destoryed() {},
   //如果页面有keep-alive缓存功能,这个函数会触发
-  activated() {},
+  activated() {}
 };
 </script>
 <style lang="scss" scoped>

+ 2 - 2
src/views/courseList.vue

@@ -125,7 +125,7 @@
                   >教材信息</el-button
                 >
                 <el-button type="text" @click="handleDiscount(scope.row)"
-                  >授权码</el-button
+                  >激活码</el-button
                 >
                 <el-button type="text" @click="handleDel(scope.row)"
                   >删除</el-button
@@ -744,7 +744,7 @@ export default {
       sessionStorage.setItem("Bookdetail", JSON.stringify(row));
       this.$router.push("/courseview?bookId=" + row.id);
     },
-    // 授权
+    // 激活
     handleDiscount(row) {
       this.$router.push("/discountCodeList?bookId=" + row.id);
     },

+ 3 - 3
src/views/discountCodeList.vue

@@ -9,7 +9,7 @@
                     style="margin-left: 10px"
                 >
                     <el-form-item>
-                        <el-form-item class="label-input" label="授权码" style="margin-right:30px;">
+                        <el-form-item class="label-input" label="激活码" style="margin-right:30px;">
                             <el-input placeholder="输入生成激活码数量" v-model="discountNumber" type="number" :oninput="numberInput"></el-input>
                         </el-form-item>
                         <el-button @click="onSubmit" size="medium" type="primary" :loading="loading">生成</el-button>
@@ -26,7 +26,7 @@
             </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 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>
@@ -158,7 +158,7 @@ export default {
         },
         // 删除书籍
         handleDel (row) {
-            this.$confirm("确定要删除此授权码吗?", "提示", {
+            this.$confirm("确定要删除此激活码吗?", "提示", {
                 confirmButtonText: "确定",
                 cancelButtonText: "取消",
                 type: "warning",

Some files were not shown because too many files changed in this diff