瀏覽代碼

首字母大写词典

natasha 1 天之前
父節點
當前提交
d45eb327be

+ 3 - 1
src/views/bookShelf/components/LexicalType.vue

@@ -1109,6 +1109,7 @@ export default {
   position: fixed;
   top: 200px;
   width: 270px;
+  z-index: 2;
   .search-show-btn {
     cursor: move;
     padding: 6px 0;
@@ -1205,7 +1206,8 @@ export default {
   background: #fff;
   box-shadow: 0px 5px 5px -3px rgba(0, 0, 0, 0.1),
     0px 4px 6px 1px rgba(0, 0, 0, 0.06), 0px 3px 6px 2px rgba(0, 0, 0, 0.05);
-  margin-top: 24px;
+  // margin-top: 24px;
+  z-index: 2;
   .search-show-btn {
     cursor: move;
     padding: 6px 0;

+ 67 - 27
src/views/dictionary/searchDetail.vue

@@ -48,7 +48,7 @@
           v-for="(itemP, indexP) in searchWordinfo.pronunciations"
           :key="indexP"
         >
-          <label v-if="itemP.region && itemP.sound">{{
+          <label v-if="itemP.region || itemP.sound">{{
             itemP.region == "uk" ? "英" : "美"
           }}</label>
           <span v-if="itemP.phonetic">{{ itemP.phonetic }}</span>
@@ -442,32 +442,72 @@ export default {
               }
             } else {
               if (list[i].symbols && list[i].symbols.length > 0) {
-                this.searchWordinfo.pronunciations[0] = {
-                  region: "uk",
-                  phonetic: this.searchWordinfo.pronunciations[0].phonetic
-                    ? this.searchWordinfo.pronunciations[0].phonetic
-                    : list[i].symbols[0].ph_am
-                    ? "/" + list[i].symbols[0].ph_am + "/"
-                    : "",
-                  sound: this.searchWordinfo.pronunciations[0].sound
-                    ? this.searchWordinfo.pronunciations[0].sound
-                    : list[i].symbols[0].ph_am_mp3
-                    ? list[i].symbols[0].ph_am_mp3
-                    : "",
-                };
-                this.searchWordinfo.pronunciations[1] = {
-                  region: "us",
-                  phonetic: this.searchWordinfo.pronunciations[1].phonetic
-                    ? this.searchWordinfo.pronunciations[1].phonetic
-                    : list[i].symbols[0].ph_en
-                    ? "/" + list[i].symbols[0].ph_en + "/"
-                    : "",
-                  sound: this.searchWordinfo.pronunciations[1].sound
-                    ? this.searchWordinfo.pronunciations[1].sound
-                    : list[i].symbols[0].ph_en_mp3
-                    ? list[i].symbols[0].ph_en_mp3
-                    : "",
-                };
+                if (this.searchWordinfo.pronunciations[0]) {
+                  this.searchWordinfo.pronunciations[0] = {
+                    region: "uk",
+                    phonetic: this.searchWordinfo.pronunciations[0].phonetic
+                      ? this.searchWordinfo.pronunciations[0].phonetic
+                      : list[i].symbols[0].ph_am
+                      ? "/" + list[i].symbols[0].ph_am + "/"
+                      : "",
+                    sound: this.searchWordinfo.pronunciations[0].sound
+                      ? this.searchWordinfo.pronunciations[0].sound
+                      : list[i].symbols[0].ph_am_mp3
+                      ? list[i].symbols[0].ph_am_mp3
+                      : "",
+                  };
+                } else {
+                  this.searchWordinfo.pronunciations.push({
+                    region: "uk",
+                    phonetic:
+                      this.searchWordinfo.pronunciations[0] &&
+                      this.searchWordinfo.pronunciations[0].phonetic
+                        ? this.searchWordinfo.pronunciations[0].phonetic
+                        : list[i].symbols[0].ph_am
+                        ? "/" + list[i].symbols[0].ph_am + "/"
+                        : "",
+                    sound:
+                      this.searchWordinfo.pronunciations[0] &&
+                      this.searchWordinfo.pronunciations[0].sound
+                        ? this.searchWordinfo.pronunciations[0].sound
+                        : list[i].symbols[0].ph_am_mp3
+                        ? list[i].symbols[0].ph_am_mp3
+                        : "",
+                  });
+                }
+                if (this.searchWordinfo.pronunciations[1]) {
+                  this.searchWordinfo.pronunciations[1] = {
+                    region: "us",
+                    phonetic: this.searchWordinfo.pronunciations[1].phonetic
+                      ? this.searchWordinfo.pronunciations[1].phonetic
+                      : list[i].symbols[0].ph_en
+                      ? "/" + list[i].symbols[0].ph_en + "/"
+                      : "",
+                    sound: this.searchWordinfo.pronunciations[1].sound
+                      ? this.searchWordinfo.pronunciations[1].sound
+                      : list[i].symbols[0].ph_en_mp3
+                      ? list[i].symbols[0].ph_en_mp3
+                      : "",
+                  };
+                } else {
+                  this.searchWordinfo.pronunciations.push({
+                    region: "us",
+                    phonetic:
+                      this.searchWordinfo.pronunciations[1] &&
+                      this.searchWordinfo.pronunciations[1].phonetic
+                        ? this.searchWordinfo.pronunciations[1].phonetic
+                        : list[i].symbols[0].ph_en
+                        ? "/" + list[i].symbols[0].ph_en + "/"
+                        : "",
+                    sound:
+                      this.searchWordinfo.pronunciations[1] &&
+                      this.searchWordinfo.pronunciations[1].sound
+                        ? this.searchWordinfo.pronunciations[1].sound
+                        : list[i].symbols[0].ph_en_mp3
+                        ? list[i].symbols[0].ph_en_mp3
+                        : "",
+                  });
+                }
               }
             }
           }

+ 67 - 27
src/views/personalCenter/components/WordCard.vue

@@ -139,7 +139,7 @@
             v-for="(itemP, indexP) in searchWordinfo.pronunciations"
             :key="indexP"
           >
-            <label v-if="itemP.region && itemP.sound">{{
+            <label v-if="itemP.region || itemP.sound">{{
               itemP.region == "uk" ? "英" : "美"
             }}</label>
             <span v-if="itemP.phonetic">{{ itemP.phonetic }}</span>
@@ -523,32 +523,72 @@ export default {
                 }
               } else {
                 if (list[i].symbols && list[i].symbols.length > 0) {
-                  this.searchWordinfo.pronunciations[0] = {
-                    region: "uk",
-                    phonetic: this.searchWordinfo.pronunciations[0].phonetic
-                      ? this.searchWordinfo.pronunciations[0].phonetic
-                      : list[i].symbols[0].ph_am
-                      ? "/" + list[i].symbols[0].ph_am + "/"
-                      : "",
-                    sound: this.searchWordinfo.pronunciations[0].sound
-                      ? this.searchWordinfo.pronunciations[0].sound
-                      : list[i].symbols[0].ph_am_mp3
-                      ? list[i].symbols[0].ph_am_mp3
-                      : "",
-                  };
-                  this.searchWordinfo.pronunciations[1] = {
-                    region: "us",
-                    phonetic: this.searchWordinfo.pronunciations[1].phonetic
-                      ? this.searchWordinfo.pronunciations[1].phonetic
-                      : list[i].symbols[0].ph_en
-                      ? "/" + list[i].symbols[0].ph_en + "/"
-                      : "",
-                    sound: this.searchWordinfo.pronunciations[1].sound
-                      ? this.searchWordinfo.pronunciations[1].sound
-                      : list[i].symbols[0].ph_en_mp3
-                      ? list[i].symbols[0].ph_en_mp3
-                      : "",
-                  };
+                  if (this.searchWordinfo.pronunciations[0]) {
+                    this.searchWordinfo.pronunciations[0] = {
+                      region: "uk",
+                      phonetic: this.searchWordinfo.pronunciations[0].phonetic
+                        ? this.searchWordinfo.pronunciations[0].phonetic
+                        : list[i].symbols[0].ph_am
+                        ? "/" + list[i].symbols[0].ph_am + "/"
+                        : "",
+                      sound: this.searchWordinfo.pronunciations[0].sound
+                        ? this.searchWordinfo.pronunciations[0].sound
+                        : list[i].symbols[0].ph_am_mp3
+                        ? list[i].symbols[0].ph_am_mp3
+                        : "",
+                    };
+                  } else {
+                    this.searchWordinfo.pronunciations.push({
+                      region: "uk",
+                      phonetic:
+                        this.searchWordinfo.pronunciations[0] &&
+                        this.searchWordinfo.pronunciations[0].phonetic
+                          ? this.searchWordinfo.pronunciations[0].phonetic
+                          : list[i].symbols[0].ph_am
+                          ? "/" + list[i].symbols[0].ph_am + "/"
+                          : "",
+                      sound:
+                        this.searchWordinfo.pronunciations[0] &&
+                        this.searchWordinfo.pronunciations[0].sound
+                          ? this.searchWordinfo.pronunciations[0].sound
+                          : list[i].symbols[0].ph_am_mp3
+                          ? list[i].symbols[0].ph_am_mp3
+                          : "",
+                    });
+                  }
+                  if (this.searchWordinfo.pronunciations[1]) {
+                    this.searchWordinfo.pronunciations[1] = {
+                      region: "us",
+                      phonetic: this.searchWordinfo.pronunciations[1].phonetic
+                        ? this.searchWordinfo.pronunciations[1].phonetic
+                        : list[i].symbols[0].ph_en
+                        ? "/" + list[i].symbols[0].ph_en + "/"
+                        : "",
+                      sound: this.searchWordinfo.pronunciations[1].sound
+                        ? this.searchWordinfo.pronunciations[1].sound
+                        : list[i].symbols[0].ph_en_mp3
+                        ? list[i].symbols[0].ph_en_mp3
+                        : "",
+                    };
+                  } else {
+                    this.searchWordinfo.pronunciations.push({
+                      region: "us",
+                      phonetic:
+                        this.searchWordinfo.pronunciations[1] &&
+                        this.searchWordinfo.pronunciations[1].phonetic
+                          ? this.searchWordinfo.pronunciations[1].phonetic
+                          : list[i].symbols[0].ph_en
+                          ? "/" + list[i].symbols[0].ph_en + "/"
+                          : "",
+                      sound:
+                        this.searchWordinfo.pronunciations[1] &&
+                        this.searchWordinfo.pronunciations[1].sound
+                          ? this.searchWordinfo.pronunciations[1].sound
+                          : list[i].symbols[0].ph_en_mp3
+                          ? list[i].symbols[0].ph_en_mp3
+                          : "",
+                    });
+                  }
                 }
               }
             }