diff --git a/src/options/components/MovieInfoCard.vue b/src/options/components/MovieInfoCard.vue index 6c6c3ff36..31cfff2d8 100644 --- a/src/options/components/MovieInfoCard.vue +++ b/src/options/components/MovieInfoCard.vue @@ -3,11 +3,16 @@ -
+
{{ info.title }} ({{ info.year || info.attrs.year[0] }}) + :class="[ + 'ml-1', + 'grey--text', + $vuetify.breakpoint.mdAndUp ? 'title' : 'caption', + ]" + >({{ info.year || info.attrs.year[0] }})
- + @@ -51,7 +56,10 @@ -
+
@@ -61,7 +69,9 @@ {{ $t("movieInfoCard.director") }} - {{ formatArray(info.attrs.director) }} + {{ + formatArray(info.attrs.director) + }} {{ $t("movieInfoCard.writer") }} @@ -73,7 +83,9 @@ {{ $t("movieInfoCard.type") }} - {{ formatArray(info.attrs.movie_type) }} + {{ + formatArray(info.attrs.movie_type) + }} {{ $t("movieInfoCard.pubdate") }} @@ -81,7 +93,9 @@ {{ $t("movieInfoCard.duration") }} - {{ formatArray(info.attrs.movie_duration) }} + {{ + formatArray(info.attrs.movie_duration) + }} @@ -120,19 +134,27 @@
- + - {{ info.original_title || info.alt_title }} + {{ + info.original_title || info.alt_title + }} - {{ formatArray(info.genres || info.attrs.movie_type) }} + {{ + formatArray(info.genres || info.attrs.movie_type) + }} - {{ formatArray(info.pubdate || info.attrs.pubdate) }} + {{ + formatArray(info.pubdate || info.attrs.pubdate) + }} - {{ formatArray(info.durations || info.attrs.movie_duration) }} + {{ + formatArray(info.durations || info.attrs.movie_duration) + }} @@ -145,7 +167,9 @@ :href="info.link || info.url || info.mobile_link" target="_blank" rel="noopener noreferrer nofollow" - >豆瓣 {{ info.average || info.rating.value || info.rating.average }} + >豆瓣 + {{ info.average || info.rating.value || info.rating.average }} IMDb {{ ratings.imdbRating }} + >IMDb {{ ratings.imdbRating }} - + {{ tomatoRating }}% @@ -172,22 +197,26 @@ - + {{ metascore }} - + - {{ $t("movieInfoCard.ratings.douban", {average: info.average || info.rating.value || info.rating.average, numRaters: info.votes || info.rating.count || info.rating.numRaters}) }} + {{ + $t("movieInfoCard.ratings.douban", { + average: + info.average || info.rating.value || info.rating.average, + numRaters: + info.votes || info.rating.count || info.rating.numRaters, + }) + }} - + - {{ $t("movieInfoCard.ratings.imdb", {average: ratings.imdbRating, numRaters: ratings.imdbVotes.replace(/,/g, "")}) }} + {{ + $t("movieInfoCard.ratings.imdb", { + average: ratings.imdbRating, + numRaters: ratings.imdbVotes.replace(/,/g, ""), + }) + }} @@ -292,11 +329,22 @@ export default Vue.extend({ .then(result => { console.log(result); this.visible = true; + let r = null; if (Array.isArray(result)) { - this.info = result[0]; + r = result[0]; } else { - this.info = result; + r = result; } + + if (!r.average && !r.rating) { + r.rating = { + average: "", + numRaters: 0, + value: "" + } + } + + this.info = r; }) .catch(error => { console.log(error); diff --git a/src/options/components/SearchBox.vue b/src/options/components/SearchBox.vue index 78a227c61..b14aa76b9 100644 --- a/src/options/components/SearchBox.vue +++ b/src/options/components/SearchBox.vue @@ -36,8 +36,10 @@ " > -
{{ $t('common.loading') }}
- +
+ {{ $t("common.loading") }} +
+ {{ parseFloat(item.doubanRating).toFixed(1) }}{{ + item.doubanRating + ? parseFloat(item.doubanRating).toFixed(1) + : "--" + }}
{{ - $t("searchBox.default") - }} + $t("searchBox.default") + }} {{ - $t("searchBox.noSearchSolution") - }} + $t("searchBox.noSearchSolution") + }} @@ -181,7 +186,8 @@ {{ parseFloat( - item.average ?item.average : item.rating? (item.rating.average || item.rating.value) : null + item.average + ? item.average + : item.rating + ? item.rating.average || item.rating.value + : null ).toFixed(1) }} @@ -228,9 +238,11 @@ :value=" item.average ? parseFloat(item.average) / 2 - : item.rating? (item.rating.stars - ? parseInt(item.rating.stars) / 10 - : item.rating.star_count): 0 + : item.rating + ? item.rating.stars + ? parseInt(item.rating.stars) / 10 + : item.rating.star_count + : 0 " background-color="grey lighten-2" color="yellow accent-4" @@ -268,7 +280,7 @@ import { } from "@/interface/common"; import Extension from "@/service/extension"; -import {eventBus} from "@/options/plugins/EventBus"; +import { eventBus } from "@/options/plugins/EventBus"; import dayjs from "dayjs"; const extension = new Extension(); @@ -405,13 +417,13 @@ export default Vue.extend({ if (!key) { return; } - const targetRoute = {name: "search-torrent", params: {key,},} + const targetRoute = { name: "search-torrent", params: { key, }, } // fix: NavigationDuplicated: Avoided redundant navigation to current location if (this.$route.params.key === key && this.$route.name === targetRoute.name) { console.log(`skip router.push same searchTorrent: key: ${key}`, this.$route) // 这种情况下只能是用户手动触发的, 不能再次触发路由跳转, 使用 eventBus 触发搜索 console.log(`using eventBus.$emit searchTorrent: key: ${key}`) - eventBus.$emit("searchTorrent", {key}) + eventBus.$emit("searchTorrent", { key }) return; }