Browse Source

词典释义

natasha 3 years ago
parent
commit
5752158ca2
1 changed files with 28 additions and 7 deletions
  1. 28 7
      src/components/Adult/preview/components/Intp.vue

+ 28 - 7
src/components/Adult/preview/components/Intp.vue

@@ -17,14 +17,14 @@
         <!-- 基本释义 -->
         <h1>基本释义</h1>
         <span v-if="word.pinyin" class="pinyin">{{ word.pinyin }}</span>
-        <template v-if="isHasValue2">
+        <template v-if="isHasValue2=='definitionWithSpell'">
             <div
                 v-for="(itemss, indexss) in paraphrase"
                 :key="indexss"
                 class="paraphrase"
                 >
                 <div
-                    v-for="(vItems, key, vIndexs) in itemss['@Value2']"
+                    v-for="(vItems, key, vIndexs) in itemss['@definitionWithSpell']"
                     :key="vIndexs"
                     class="para"
                     >
@@ -41,6 +41,21 @@
                 </div>
             </div>
         </template>
+        <template v-else-if="isHasValue2=='definitions'">
+            <div
+                v-for="(itemss, indexss) in paraphrase"
+                :key="indexss"
+                class="paraphrase"
+                >
+                <ul
+                    v-for="(vItems, key, vIndexs) in itemss['@definitions']"
+                    :key="vIndexs"
+                    class="para"
+                    >
+                    <li>{{ vItems }}</li>
+                </ul>
+            </div>
+        </template>
         <template v-else>
             <ul
                 v-for="(itemss, indexss) in paraphrase"
@@ -116,7 +131,7 @@ export default {
       antonymList: [], // 反义词
       termsList: [], // 组词
       dataDetail: [],
-      isHasValue2: false, // 释义里是否含有value2
+      isHasValue2: '', // 释义里是否含有value2
     };
   },
   computed: {
@@ -178,6 +193,7 @@ export default {
       _this.synonymList = [];
       _this.antonymList = [];
       _this.termsList = [];
+      _this.isHasValue2 = ''
       _this.dataDetail.forEach((item) => {
         if (item.request.queryType == "entity") {
           // 读音
@@ -193,9 +209,11 @@ export default {
                 // 释义
                 _this.paraphrase = itemss.objects;
                 for(let i = 0; i< _this.paraphrase.length; i++){
-                    if(_this.paraphrase[i]['@Value2']){
-                        _this.isHasValue2 = true
+                    if(_this.paraphrase[i]['@definitionWithSpell']){
+                        _this.isHasValue2 = 'definitionWithSpell'
                         return false
+                    }else if(_this.paraphrase[i]['@definitions']){
+                        _this.isHasValue2 = 'definitions'
                     }
                 }
               } else if (itemss.key == "synonym") {
@@ -223,14 +241,17 @@ export default {
       _this.getChineseInfo();
     } else {
       if (_this.word) {
+        _this.isHasValue2 = ''
         _this.mp3Url = _this.word.mp3Url ? _this.word.mp3Url : "";
         _this.paraphrase = _this.word.paraphrase
           ? JSON.parse(JSON.stringify(_this.word.paraphrase))
           : [];
         for(let i = 0; i< _this.paraphrase.length; i++){
-            if(_this.paraphrase[i]['@Value2']){
-                _this.isHasValue2 = true
+            if(_this.paraphrase[i]['@definitionWithSpell']){
+                _this.isHasValue2 = 'definitionWithSpell'
                 return false
+            }else if(_this.paraphrase[i]['@definitions']){
+                _this.isHasValue2 = 'definitions'
             }
         }
         _this.synonymList = _this.word.synonymList