瀏覽代碼

kwic及书架已读

natasha 1 年之前
父節點
當前提交
249d8fd0ac

+ 21 - 1
src/components/common/BookCard.vue

@@ -18,6 +18,8 @@
             class="image"
             :style="{height:height?height:'280px'}"
             ></div> -->
+            <span class="isNew" v-if="item.is_new&&item.is_new==='true'">NEW</span>
+            <span class="isReservation" v-if="item.is_reservation&&item.is_reservation==='true'">订阅</span>
             <el-image
                 class="image"
                 :src="item.cover_image_url?item.cover_image_url:item.course_type==='baozhi'?require('../../assets/baozhi'+(Math.floor(Math.random()*2)+1)+'.png'):require('../../assets/kecheng'+(Math.floor(Math.random()*3)+1)+'.png')"
@@ -51,6 +53,7 @@
 //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
 //例如:import 《组件名称》from ‘《组件路径》';
 import { cutMoneyFiter } from '@/utils/defined';
+import { getLogin } from "@/api/ajax";
 export default {
   name: "BookCard",
   //import引入的组件需要注入到对象中才能使用
@@ -110,8 +113,24 @@ export default {
       })
       return { newarr, timeArr, rateArr }
     },
-    handleLink(){
+    async handleLink(){
         let url  = this.LoginNavIndex +'&&&1&&&2&&&3&&&' + this.previousPage
+        if(this.LoginNavIndex===1){
+            let MethodName = "/ShopServer/Client/BookshelfQuery/SetMyGoodsIsLooked";
+            let data = {
+                goods_id: this.item.id,
+                goods_type: this.item.type
+            }
+            await getLogin(MethodName, data)
+            .then((res) => {
+                if(res.status===1){
+                    
+                }
+            })
+            .catch(() => {
+                
+            }); 
+        }
         this.$router.push({
             path: "/bookItem",
             query: {
@@ -152,6 +171,7 @@ export default {
 .BookCard {
   width: 100%;
   cursor: pointer;
+  position: relative;
   .image {
     width: 100%;
     height: 280px;

+ 13 - 2
src/components/common/BookPeruseCard.vue

@@ -36,6 +36,7 @@
                 </el-rate>
             </template> -->
             <span class="batch">第 {{item.batch}} 期</span>
+            <span class="isNew" v-if="item.is_new&&item.is_new==='true'">NEW</span>
             <p class="author">
                <span>{{item.label}}</span> 
                <label class="xiaoxue" :style="{background:phaseTypeList[item.study_phase]?phaseTypeList[item.study_phase].bg:'',color:phaseTypeList[item.study_phase]?phaseTypeList[item.study_phase].color:''}">{{item.study_phase_name}}</label>
@@ -55,6 +56,7 @@
 //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
 //例如:import 《组件名称》from ‘《组件路径》';
 import { cutMoneyFiter } from '@/utils/defined';
+import { getLogin } from "@/api/ajax";
 export default {
   name: "BookCard",
   //import引入的组件需要注入到对象中才能使用
@@ -132,8 +134,17 @@ export default {
       })
       return { newarr, timeArr, rateArr }
     },
-    handleLink(){
-
+    async handleLink(){
+        if(this.LoginNavIndex===1){
+            let MethodName = "/ShopServer/Client/BookshelfQuery/SetMyGoodsIsLooked";
+            let data = {
+                goods_id: this.item.id,
+                goods_type: this.item.type
+            }
+            await getLogin(MethodName, data)
+            .then((res) => {
+            })
+        }
         let url  = this.LoginNavIndex +'&&&1&&&2&&&3&&&' + this.previousPage
         if(!this.$route.query.from&&this.LoginNavIndex!==1){
             this.$router.push({

+ 21 - 1
src/components/common/BookPeruseListCard.vue

@@ -18,6 +18,8 @@
             class="image"
             :style="{height:height?height:'280px'}"
             ></div> -->
+            <span class="isNew" v-if="item.is_new&&item.is_new==='true'">NEW</span>
+            <span class="isReservation">订阅</span>
             <el-image
                 class="image"
                 :src="require('../../assets/cover-order-jingdu.png')"
@@ -51,6 +53,7 @@
 //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
 //例如:import 《组件名称》from ‘《组件路径》';
 import { cutMoneyFiter } from '@/utils/defined';
+import { getLogin } from "@/api/ajax";
 export default {
   name: "BookCard",
   //import引入的组件需要注入到对象中才能使用
@@ -82,8 +85,24 @@ export default {
   watch: {},
   //方法集合
   methods: {
-    handleLink(){
+    async handleLink(){
         let url  = this.LoginNavIndex +'&&&1&&&2&&&3&&&' + this.previousPage
+        if(this.LoginNavIndex===1){
+            let MethodName = "/ShopServer/Client/BookshelfQuery/SetMyGoodsIsLooked";
+            let data = {
+                goods_id: this.item.id,
+                goods_type: 30
+            }
+            await getLogin(MethodName, data)
+            .then((res) => {
+                if(res.status===1){
+                    
+                }
+            })
+            .catch(() => {
+                
+            }); 
+        }
         this.$router.push({
             path: "/bookStore/all",
             query: {
@@ -123,6 +142,7 @@ export default {
 .BookCard {
   width: 100%;
   cursor: pointer;
+  position: relative;
   .image {
     width: 100%;
     height: 280px;

+ 22 - 0
src/styles/index.scss

@@ -229,4 +229,26 @@ ul {
         line-height: 22px;
         margin: 30px 0;
     }
+}
+
+.isNew,
+.isReservation {
+    position: absolute;
+    right: 6px;
+    top: 6px;
+    border-radius: 3px;
+    background: #EA4747;
+    color: #FFF;
+    font-size: 14px;
+    font-weight: 600;
+    line-height: 20px;
+    padding: 0 6px;
+    z-index: 1;
+}
+
+.isReservation {
+    left: 6px;
+    background: #3F72F6;
+    width: 40px;
+    text-align: center;
 }

文件差異過大導致無法顯示
+ 0 - 79
src/views/bookShelf/components/PhraseCard.vue


+ 3 - 3
src/views/bookShelf/index.vue

@@ -5,12 +5,12 @@
       :headerBorder="'#5C5C5C'"
       :userBg="'rgba(0, 0, 0, 0.24)'"
       :LoginNavIndex="1"
-    />
+    />   
     <ul class="option">
         <li class="option-item" :class="[typeIndex===indexo?'active':'']" v-for="(itemo,indexo) in optionList" :key="indexo" @click="handleClick(itemo,indexo)">
             <svg-icon :icon-class="itemo.img" className="icon-img"></svg-icon>
             <span>{{itemo.label}}</span>
-            <b>{{itemo.value===10?itemo.number+orderPeruseNumber:itemo.number}}</b>
+            <b>{{itemo.value===3?(itemo.number+orderPeruseNumber):itemo.number}}</b>
         </li>
     </ul>
     <div class="main">
@@ -159,7 +159,7 @@ export default {
             label: '精读',
             img: 'jingdu',
             number: 0,
-            value: 10
+            value: 3
         },
         // ,
         // {

+ 1 - 1
src/views/bookStore/Subscribe.vue

@@ -178,7 +178,7 @@
                 </div>
                 <div class="btn-box">
                     <el-button class="el-button" @click="handleChangeWay('wei')" :loading="createOrderLoading">立即购买</el-button>
-                    <el-button class="upgrade" @click="handleChangeWay('dui')">使用兑换码</el-button>
+                    <!-- <el-button class="upgrade" @click="handleChangeWay('dui')">使用兑换码</el-button> -->
                 </div>
             </div>
         </div>

+ 77 - 25
src/views/personalCenter/components/WordCard.vue

@@ -130,7 +130,7 @@
                             <div v-for="(txt, indexs) in item.resArr" :key="indexs">
                             <span
                                 v-for="(txts, indexs) in txt"
-                                v-html="txts"
+                                v-html="txts[0]"
                                 :key="indexs"
                             ></span>
                             </div>
@@ -186,6 +186,20 @@ export default {
       },
       pageNo: 1,
       pageNoNew: 1,
+      enFhList: [
+        ",",
+        ".",
+        ";",
+        "?",
+        "!",
+        ":",
+        ">",
+        "<",
+        "'",
+        "’",
+        ")",
+        "”",
+      ],
     }
   },
   //计算属性 类似于data概念
@@ -362,7 +376,7 @@ export default {
                             str += items[0] + ' '
                         })
                         item.res = str
-                        item.source_courseware_name_path = item.study_phase_name + '版 / ' + item.iss_no + ' / '
+                        item.source_courseware_name_path = item.study_phase_name + '版 / ' + item.iss_no + ' / ' + item.release_date + ' / ' + item.art_title
                     });
                     this.sentKwicData.sentence_list = res.data.results
                 }
@@ -376,7 +390,7 @@ export default {
             word: this.data.word,
             page_size: 30,
             page_no: this.pageNo,
-            only_my_bought: true,
+            only_my_bought: false,
             kwic_type: 1
         })
         .then((res) => {
@@ -384,19 +398,11 @@ export default {
             if(res.status===1){
                 if(res.data&&res.data.results){
                     res.data.results.forEach((item,indexs) => {
-                        let tokenIndexArr = [item.token_idx]
-                        let str = ''
                         item.number = indexs+1
-                        tokenIndexArr.forEach(index=>{
-                            item.tokens[index][0] = '<span style=\"color:#ED5F00;font-weight:600;\">'+ item.tokens[index][0] + '</span>'
-                        })
-                        item.tokens.forEach(items=>{
-                            str += items[0] + ' '
-                        })
-                        item.res = str
-                        item.source_courseware_name_path = item.study_phase_name + '版 / ' + item.iss_no + ' / '
+                        item.source_courseware_name_path = item.study_phase_name + '版 / ' + item.iss_no + ' / ' + item.release_date + ' / ' + item.art_title
                     });
-                    this.sentKwicData.sentence_list = res.data.results
+                    this.sentKwicData.sentence_list_sort_left = this.handleExample(res.data.results,'left')
+                    console.log(this.sentKwicData.sentence_list_sort_left)
                 }
                 
             }
@@ -411,18 +417,17 @@ export default {
           let str = item.source_courseware_name_path;
           item.show_source_courseware_name_path = str.slice(0, 8) + "...";
           if (type == "left") {
-            let sentence = JSON.parse(JSON.stringify(item.sentence));
-            let arr = JSON.parse(JSON.stringify(item.sentence_fc_list));
+            let arr = JSON.parse(JSON.stringify(item.tokens));
             arr.forEach((items, indexs) => {
-              if (indexs == item.sentence_fc_list_word_index) {
+              if (indexs == item.token_idx) {
                 arr[
                   indexs
-                ] = `<span style=color:#DE4444;font-weight:700;>${arr[indexs]}</span>`;
+                ][0] = `<span style=color:#DE4444;font-weight:700;>${arr[indexs][0]}</span>`;
               }
             });
             let data = this.changefiveword(
               arr,
-              item.sentence_fc_list_word_index,
+              item.token_idx,
               type
             );
             item.resArr = data;
@@ -430,15 +435,15 @@ export default {
             let sentence = JSON.parse(JSON.stringify(item.sentence));
             let arr = JSON.parse(JSON.stringify(item.sentence_fc_list));
             arr.forEach((items, indexs) => {
-              if (indexs == item.sentence_fc_list_word_index) {
+              if (indexs == item.token_idx) {
                 arr[
                   indexs
-                ] = `<span style=color:#DE4444;font-weight:700;>${arr[indexs]}</span>`;
+                ][0] = `<span style=color:#DE4444;font-weight:700;>${arr[indexs][0]}</span>`;
               }
             });
             let data = this.changefiveword(
               arr,
-              item.sentence_fc_list_word_index,
+              item.token_idx,
               type
             );
             item.resArr = data;
@@ -446,15 +451,15 @@ export default {
             let sentence = JSON.parse(JSON.stringify(item.sentence));
             let arr = JSON.parse(JSON.stringify(item.sentence_fc_list));
             arr.forEach((items, indexs) => {
-              if (indexs == item.sentence_fc_list_word_index) {
+              if (indexs == item.token_idx) {
                 arr[
                   indexs
-                ] = `<span style=color:#DE4444;font-weight:700;>${arr[indexs]}</span>`;
+                ][0] = `<span style=color:#DE4444;font-weight:700;>${arr[indexs][0]}</span>`;
               }
             });
             let data = this.changefiveword(
               arr,
-              item.sentence_fc_list_word_index,
+              item.token_idx,
               type
             );
             item.resArr = data;
@@ -516,6 +521,53 @@ export default {
         return [];
       }
     },
+    changefiveword(arr, index, type) {
+      let num = 6;
+      let colorIndex = 0;
+      let colorList = ["#4D7EFF", "#A4430F", "#9342C5", "#FF8718", "#1DAA91"];
+      for (let i = 1; i < num; i++) {
+        if (type == "left") {
+          if (index - i >= 0) {
+            if (this.enFhList.indexOf(arr[index - i][0]) == -1) {
+              arr[index - i][0] = `<span style=color:${colorList[colorIndex]};>${
+                arr[index - i][0]
+              }</span>`;
+              colorIndex++;
+            } else {
+              num++;
+            }
+          }
+        } else if (type == "right") {
+          if (index + i <= arr.length - 1) {
+            if (this.enFhList.indexOf(arr[index + i][0]) == -1) {
+              arr[index + i][0] = `<span style=color:${colorList[colorIndex]};>${
+                arr[index + i][0]
+              }</span>`;
+              colorIndex++;
+            } else {
+              num++;
+            }
+          }
+        }
+      }
+      let newarr = [];
+      let arr1 = [];
+      let arr2 = [];
+      let arr3 = [];
+      arr.forEach((item, i) => {
+        if (i < index) {
+          arr1.push(item);
+        } else if (i == index) {
+          arr2.push(item);
+        } else {
+          arr3.push(item);
+        }
+      });
+      newarr.push(arr1);
+      newarr.push(arr2);
+      newarr.push(arr3);
+      return newarr;
+    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {

部分文件因文件數量過多而無法顯示