diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..63c690e
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,18 @@
+# http://editorconfig.org
+root = true
+
+[*]
+charset = utf-8 # 编码格式
+end_of_line = lf # 换行符
+indent_size = 2 # 缩进大小
+indent_style = space # 缩进风格
+insert_final_newline = true # 是否使文件以一个空白行结尾
+max_line_length = 80 # 单行最大字符数
+trim_trailing_whitespace = true # 是否将行尾空格自动删除
+
+[*.md]
+max_line_length = 0
+trim_trailing_whitespace = false
+
+[COMMIT_EDITMSG]
+max_line_length = 0
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..1bd5bfd
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,8 @@
+# Auto detect text files and perform LF normalization
+* text=auto
+
+# JS files must always use LF for tools to work
+*.js eol=lf
+
+*.ts eol=lf
+*.tsx eol=lf
\ No newline at end of file
diff --git a/src/App.tsx b/src/App.tsx
index 45b3e9d..8cd0652 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
-import {LocaleProvider} from 'antd';
+import { LocaleProvider } from 'antd';
import zhCN from 'antd/lib/locale-provider/zh_CN';
import moment from 'moment';
import 'moment/locale/zh-cn';
diff --git a/src/api/index.ts b/src/api/index.ts
index 7d1d1be..07af572 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -4,50 +4,50 @@ const BASE_URL = "/api/movie";
const API_KEY = "0b2bdeda43b5688921839c8ecb20399b";
let instance = axios.create({
- baseURL: BASE_URL,
- timeout: 3e4,
- params: {
- "apikey": API_KEY,
- }
+ baseURL: BASE_URL,
+ timeout: 3e4,
+ params: {
+ "apikey": API_KEY,
+ }
});
// 热映
export function getHotShowing(params?: any) {
- return instance.get("/in_theaters", {
- params
- });
+ return instance.get("/in_theaters", {
+ params
+ });
}
// top250
-export function getTop250(params?:any) {
- return instance.get("/top250",{
- params,
- });
+export function getTop250(params?: any) {
+ return instance.get("/top250", {
+ params,
+ });
}
// 新片
export function getNew() {
- return instance.get("/new_movies");
+ return instance.get("/new_movies");
}
// 电影详情
export function getDetail(id: string) {
- return instance.get(`/subject/${id}`);
+ return instance.get(`/subject/${id}`);
}
// 北美票房榜
export function getGoodbox() {
- return instance.get("/us_box");
+ return instance.get("/us_box");
}
// 搜索条目
export function getContentBySearch(str: string, params?: any) {
- return instance.get(`/search?q=${str}`, {
- params
- });
+ return instance.get(`/search?q=${str}`, {
+ params
+ });
}
// 口碑榜
export function getWeeklyMovie() {
- return instance.get("/weekly");
-}
\ No newline at end of file
+ return instance.get("/weekly");
+}
diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx
index 8cec2e9..2234b9c 100644
--- a/src/components/Layout.tsx
+++ b/src/components/Layout.tsx
@@ -1 +1 @@
-export {};
\ No newline at end of file
+export { };
diff --git a/src/config/index.ts b/src/config/index.ts
index 8cec2e9..2234b9c 100644
--- a/src/config/index.ts
+++ b/src/config/index.ts
@@ -1 +1 @@
-export {};
\ No newline at end of file
+export { };
diff --git a/src/css/Detail.css b/src/css/Detail.css
index 1d25415..1ca4a2a 100644
--- a/src/css/Detail.css
+++ b/src/css/Detail.css
@@ -143,9 +143,6 @@
overflow-y: auto;
}
-.box-list .list {
-}
-
.box-list .list .list-item {
cursor: pointer;
}
diff --git a/src/css/Home.css b/src/css/Home.css
index 2c076b7..bcbbb65 100644
--- a/src/css/Home.css
+++ b/src/css/Home.css
@@ -48,7 +48,7 @@
border-radius: 20px;
background-color: rgba(255,255,255,.2);
box-shadow: 0 4px 18px rgba(17,18,38,.07);
- border: 1px solid transparent;
+ border: 1px solid transparent;
overflow: hidden;
}
.header .head-bar--fixed .search-box{
@@ -284,7 +284,7 @@
margin: 0;
}
-.loading-img-box,
+.loading-img-box,
.movie-card img {
width: 100%;
height: 300px;
@@ -387,4 +387,4 @@
.footer-block a:hover{
color: var(--themeHoverColor);
-}
\ No newline at end of file
+}
diff --git a/src/pages/Box.tsx b/src/pages/Box.tsx
index 35bafe4..d8d64cb 100644
--- a/src/pages/Box.tsx
+++ b/src/pages/Box.tsx
@@ -1,11 +1,11 @@
import React from "react";
-class Box extends React.Component{
- render() {
- return (
-
-
-
-
-
- {detailData.$units}
- {
- detailData.$units > 0 &&
- .{detailData.$decimal}
- }
-
-
-
{detailData.original_title}
-
-
-

-
-
-
{detailData.title}
-
- {
- detailData.tags.map((tag: string, index: number) => {
- return {tag}
- })
- }
-
-
-
- {
- detailData.directors.map((item: any, index: number) => {
- return
{item.name}
- })
- }
-
-
-
- {
- detailData.casts.map((item: any, index: number) => {
- let split = "";
- if (index !== 0) {
- split = "/";
- }
- return (
-
- {split}
- {item.name}
-
- );
- })
- }
-
-
-
- {detailData.summary}
-
-
-
-
-
剧照({detailData.photos_count})
-
-
this.galleryBox = current}>
- {
- detailData.photos.map((item: any, index: number) => {
- let { image, alt } = item;
+ if (!detailData.id) return '';
+ return (
+ <>
+
+
+
+
+
+ {detailData.$units}
+ {
+ detailData.$units > 0 &&
+ .{detailData.$decimal}
+ }
+
+
+
{detailData.original_title}
+
+
+

+
+
+
{detailData.title}
+
+ {
+ detailData.tags.map((tag: string, index: number) => {
+ return {tag}
+ })
+ }
+
+
+
+ {
+ detailData.directors.map((item: any, index: number) => {
+ return
{item.name}
+ })
+ }
+
+
+
+ {
+ detailData.casts.map((item: any, index: number) => {
+ let split = "";
+ if (index !== 0) {
+ split = "/";
+ }
+ return (
+
+ {split}
+ {item.name}
+
+ );
+ })
+ }
+
+
+
+ {detailData.summary}
+
+
+
+
+
剧照({detailData.photos_count})
+
+
this.galleryBox = current}>
+ {
+ detailData.photos.map((item: any, index: number) => {
+ let { image, alt } = item;
- return (
-
- {index === 0 && detailData.trailer_urls.length > 0 && (
- <>
-
预告片
-
{ this.openPlayBox(detailData.trailer_urls[currentPlayData.index]) }} />
- >
- )}
-
-
- );
- })
- }
-
-
-
-
-
-
影评({detailData.reviews_count})
- {
- detailData.popular_reviews.map((item: any, index: number) => {
- let {
- author,
- rating,
- title,
- summary,
- created_at,
- } = item;
+ return (
+
+ {index === 0 && detailData.trailer_urls.length > 0 && (
+ <>
+
预告片
+
{ this.openPlayBox(detailData.trailer_urls[currentPlayData.index]) }} />
+ >
+ )}
+
+
+ );
+ })
+ }
+
+
+
+
+
+
影评({detailData.reviews_count})
+ {
+ detailData.popular_reviews.map((item: any, index: number) => {
+ let {
+ author,
+ rating,
+ title,
+ summary,
+ created_at,
+ } = item;
- return (
-
- {author.name}
-
- >
- )}
- avatar={(
-
- )}
- content={(
- <>
- {title}
- {summary}
- >
- )}
- datetime={(
-
- {moment(created_at).fromNow()}
-
- )}
- />
- );
- })
- }
-
-
-
热评({detailData.comments_count})
- {
- detailData.popular_comments.map((item: any, index: number) => {
- let {
- author,
- rating,
- content,
- created_at,
- useful_count,
- useless_count,
- } = item;
+ return (
+
+ {author.name}
+
+ >
+ )}
+ avatar={(
+
+ )}
+ content={(
+ <>
+ {title}
+ {summary}
+ >
+ )}
+ datetime={(
+
+ {moment(created_at).fromNow()}
+
+ )}
+ />
+ );
+ })
+ }
+
+
+
热评({detailData.comments_count})
+ {
+ detailData.popular_comments.map((item: any, index: number) => {
+ let {
+ author,
+ rating,
+ content,
+ created_at,
+ useful_count,
+ useless_count,
+ } = item;
- const actions = [
-
-
-
-
-
- {useful_count || 0}
-
- ,
-
-
-
-
-
- {useless_count || 0}
-
-
- ];
+ const actions = [
+
+
+
+
+
+ {useful_count || 0}
+
+ ,
+
+
+
+
+
+ {useless_count || 0}
+
+
+ ];
- return (
-
- {author.name}
-
- >
- )}
- avatar={(
-
- )}
- content={(
- {content}
- )}
- datetime={(
-
- {moment(created_at).fromNow()}
-
- )}
- />
- );
- })
- }
-
-
-
-
+ return (
+
+ {author.name}
+
+ >
+ )}
+ avatar={(
+
+ )}
+ content={(
+ {content}
+ )}
+ datetime={(
+
+ {moment(created_at).fromNow()}
+
+ )}
+ />
+ );
+ })
+ }
- {/* 抽屉 */}
-
-
-
-
-
- (
- }
- onClick={(ev) => { this.playThisVideo(item.resource_url,index) }} >
-
-
- )}
- />
-
-
-
-
- >
- );
- }
+
+
+
+
+ {/* 抽屉 */}
+
+
+
+
+
+ (
+ }
+ onClick={(ev) => { this.playThisVideo(item.resource_url, index) }} >
+
+
+ )}
+ />
+
+
+
+
+ >
+ );
+ }
}
-export default Detail;
\ No newline at end of file
+export default Detail;
diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx
index 2e02aa7..0984b08 100644
--- a/src/pages/Home.tsx
+++ b/src/pages/Home.tsx
@@ -1,25 +1,25 @@
import React from "react";
import {
- Card,
- Tag,
- Carousel,
- Icon,
- Affix,
- Divider,
+ Card,
+ Tag,
+ Carousel,
+ Icon,
+ Affix,
+ Divider,
} from 'antd';
import {
- getHotShowing,
- getNew,
- getGoodbox,
- getContentBySearch,
- getWeeklyMovie,
- getTop250,
+ getHotShowing,
+ getNew,
+ getGoodbox,
+ getContentBySearch,
+ getWeeklyMovie,
+ getTop250,
} from "../api";
import { Link } from 'react-router-dom';
import {
- CardListTop250Skeleton,
- CardListSkeleton,
- ListSkeleton,
+ CardListTop250Skeleton,
+ CardListSkeleton,
+ ListSkeleton,
} from "../skeletons/Home";
import '../css/Home.css';
import * as _ from "lodash";
@@ -34,535 +34,535 @@ import imgBanner005 from '../assets/banner-005.jpg';
class Home extends React.Component {
- getSuggestionBySearch: (value: string) => any
- constructor(props: any) {
- super(props);
- this.state = {
- hotShowList: [], // 热映
- newMovieList: [], // 新片
- goodBoxList: [], // 票房榜
- suggestList: [], // 搜索建议
- weeklyBox: [], // 口碑榜
- top250List: [], // top250
- searchHistory: this.getSearchHistory().slice(0),
- boxLastDate: "",
- searchStr: "",
- isLoadingHotShow: true,
- isLoadingNewMovie: true,
- isLoadingGoodBox: true,
- isLoadingWeeklyBox: true,
- isLoadingTop250: true,
- isShowSuggestBox: false,
- isShowTipsPanel: true,
- isTopNavFixed: false,
- };
+ getSuggestionBySearch: (value: string) => any
+ constructor(props: any) {
+ super(props);
+ this.state = {
+ hotShowList: [], // 热映
+ newMovieList: [], // 新片
+ goodBoxList: [], // 票房榜
+ suggestList: [], // 搜索建议
+ weeklyBox: [], // 口碑榜
+ top250List: [], // top250
+ searchHistory: this.getSearchHistory().slice(0),
+ boxLastDate: "",
+ searchStr: "",
+ isLoadingHotShow: true,
+ isLoadingNewMovie: true,
+ isLoadingGoodBox: true,
+ isLoadingWeeklyBox: true,
+ isLoadingTop250: true,
+ isShowSuggestBox: false,
+ isShowTipsPanel: true,
+ isTopNavFixed: false,
+ };
- getHotShowing({
- start: 0,
- count: 12,
- })
- .then(({ data }: any) => {
- let { subjects } = data;
+ getHotShowing({
+ start: 0,
+ count: 12,
+ })
+ .then(({ data }: any) => {
+ let { subjects } = data;
- this.setState({
- hotShowList: subjects,
- isLoadingHotShow: false,
- });
- });
-
- getNew()
- .then(({ data }: any) => {
- let { subjects } = data;
-
- this.setState({
- newMovieList: subjects,
- isLoadingNewMovie: false,
- });
- });
+ this.setState({
+ hotShowList: subjects,
+ isLoadingHotShow: false,
+ });
+ });
- getGoodbox()
- .then(({ data }: any) => {
- let { subjects, date } = data;
+ getNew()
+ .then(({ data }: any) => {
+ let { subjects } = data;
- this.setState({
- boxLastDate: date,
- goodBoxList: subjects,
- isLoadingGoodBox: false,
- });
- });
+ this.setState({
+ newMovieList: subjects,
+ isLoadingNewMovie: false,
+ });
+ });
- getWeeklyMovie()
- .then(({ data }: any) => {
- let { subjects } = data;
+ getGoodbox()
+ .then(({ data }: any) => {
+ let { subjects, date } = data;
- this.setState({
- weeklyBox: subjects,
- isLoadingWeeklyBox: false,
- });
- });
+ this.setState({
+ boxLastDate: date,
+ goodBoxList: subjects,
+ isLoadingGoodBox: false,
+ });
+ });
- getTop250({
- count: 36,
- })
- .then(({ data }: any) => {
- let { subjects } = data;
+ getWeeklyMovie()
+ .then(({ data }: any) => {
+ let { subjects } = data;
- this.setState({
- top250List: subjects,
- isLoadingTop250: false,
- });
- });
+ this.setState({
+ weeklyBox: subjects,
+ isLoadingWeeklyBox: false,
+ });
+ });
- this.getSuggestionBySearch = this.getContentBySearchDebounce();
- }
- changeTopNavStyle = () => {
+ getTop250({
+ count: 36,
+ })
+ .then(({ data }: any) => {
+ let { subjects } = data;
- }
- toggleSuggestList = (isShow: boolean) => {
this.setState({
- isShowSuggestBox: isShow,
+ top250List: subjects,
+ isLoadingTop250: false,
});
- }
- getSearchHistory() {
- const KEY = "SEARCH_H";
- let cache = JSON.parse(localStorage.getItem(KEY) || "[]");
- return cache;
- }
- addSearchHistory(item: any) {
- const MAX_LEN_CACHE_SEARCH = 5;
- const KEY = "SEARCH_H";
- let cache = this.getSearchHistory().slice(0);
+ });
- let isExist = cache.some((c: any) => {
- return c.id === item.id;
- });
+ this.getSuggestionBySearch = this.getContentBySearchDebounce();
+ }
+ changeTopNavStyle = () => {
- if (!isExist) {
- cache.unshift(item);
- if (cache.length > MAX_LEN_CACHE_SEARCH) {
- cache.pop();
- }
- localStorage.setItem(KEY, JSON.stringify(cache));
- }
- }
- getContentBySearchDebounce() {
- let comp = this;
- return _.debounce(function (value) {
- getContentBySearch(value, {
- count: 5,
- })
- .then(({ data }: any) => {
- let { subjects } = data;
- comp.setState({
- suggestList: subjects,
- });
- });
- }, 5e2);
+ }
+ toggleSuggestList = (isShow: boolean) => {
+ this.setState({
+ isShowSuggestBox: isShow,
+ });
+ }
+ getSearchHistory() {
+ const KEY = "SEARCH_H";
+ let cache = JSON.parse(localStorage.getItem(KEY) || "[]");
+ return cache;
+ }
+ addSearchHistory(item: any) {
+ const MAX_LEN_CACHE_SEARCH = 5;
+ const KEY = "SEARCH_H";
+ let cache = this.getSearchHistory().slice(0);
+
+ let isExist = cache.some((c: any) => {
+ return c.id === item.id;
+ });
+
+ if (!isExist) {
+ cache.unshift(item);
+ if (cache.length > MAX_LEN_CACHE_SEARCH) {
+ cache.pop();
+ }
+ localStorage.setItem(KEY, JSON.stringify(cache));
}
- getSearch = (ev: any) => {
- let value = ev.target.value;
- let str = value.trim();
- let isValid = str.length > 0;
- this.setState({
- searchStr: value,
- isShowTipsPanel: !isValid,
+ }
+ getContentBySearchDebounce() {
+ let comp = this;
+ return _.debounce(function (value) {
+ getContentBySearch(value, {
+ count: 5,
+ })
+ .then(({ data }: any) => {
+ let { subjects } = data;
+ comp.setState({
+ suggestList: subjects,
+ });
});
+ }, 5e2);
+ }
+ getSearch = (ev: any) => {
+ let value = ev.target.value;
+ let str = value.trim();
+ let isValid = str.length > 0;
+ this.setState({
+ searchStr: value,
+ isShowTipsPanel: !isValid,
+ });
- // close showlist
- isValid && this.getSuggestionBySearch(str);
+ // close showlist
+ isValid && this.getSuggestionBySearch(str);
- }
- renderTop250() {
- let { top250List } = this.state as any;
- let len = top250List.length;
- let count = len / 9 | 0;
- let groupList = new Array(count).fill(0);
+ }
+ renderTop250() {
+ let { top250List } = this.state as any;
+ let len = top250List.length;
+ let count = len / 9 | 0;
+ let groupList = new Array(count).fill(0);
- groupList = groupList.map((item: any, index: number) => {
- let s = 9 * index;
- let e = s + 9;
- return top250List.slice(s, e);
- });
+ groupList = groupList.map((item: any, index: number) => {
+ let s = 9 * index;
+ let e = s + 9;
+ return top250List.slice(s, e);
+ });
+ return (
+ groupList.map((g: any, n: number) => {
return (
- groupList.map((g: any, n: number) => {
+
+ {
+ g.map((item: any, index: number) => {
+ let isFirst = index === 0;
return (
-
- {
- g.map((item: any, index: number) => {
- let isFirst = index === 0;
- return (
-
-
-
-
-
-
- }
- >
- {item.rating.average}
-
-
-
- );
- })
- }
-
+
+
+
+
+
+
+ }
+ >
+ {item.rating.average}
+
+
+
);
- })
+ })
+ }
+
);
+ })
+ );
- }
- render() {
- let {
- hotShowList,
- newMovieList,
- goodBoxList,
- boxLastDate,
- suggestList,
- weeklyBox,
- searchHistory,
- searchStr,
- isLoadingHotShow,
- isLoadingNewMovie,
- isLoadingGoodBox,
- isLoadingWeeklyBox,
- isLoadingTop250,
- isShowTipsPanel,
- isShowSuggestBox,
- isTopNavFixed,
- }: any = this.state;
+ }
+ render() {
+ let {
+ hotShowList,
+ newMovieList,
+ goodBoxList,
+ boxLastDate,
+ suggestList,
+ weeklyBox,
+ searchHistory,
+ searchStr,
+ isLoadingHotShow,
+ isLoadingNewMovie,
+ isLoadingGoodBox,
+ isLoadingWeeklyBox,
+ isLoadingTop250,
+ isShowTipsPanel,
+ isShowSuggestBox,
+ isTopNavFixed,
+ }: any = this.state;
- // temp
- let bannerList = [
- imgBanner001,
- imgBanner002,
- imgBanner003,
- imgBanner004,
- imgBanner005
- ];
+ // temp
+ let bannerList = [
+ imgBanner001,
+ imgBanner002,
+ imgBanner003,
+ imgBanner004,
+ imgBanner005
+ ];
- return (
-
{ this.toggleSuggestList(false) }}>
-
-
{
- this.setState({
- isTopNavFixed: !!isFixed,
- });
- }}>
-
-
-
-
-
-
-
- 全网搜
-
-
ev.stopPropagation()}
- onFocus={this.toggleSuggestList.bind(this, true)} />
-
-
- {
- isShowTipsPanel ?
-
-
0 ? "block" : "none",
- }
- }>
-
历史记录
-
- {
- searchHistory.map((item: any, index: number) => {
- return (
- -
-
-
{item.title}
-
-
- );
- })
- }
-
-
-
-
热映
-
- {
- hotShowList.slice(0, 8).map((item: any, index: number) => {
- return (
- -
- {
- this.addSearchHistory({
- id: item.id,
- title: item.title,
- });
- }}>
- {+index + 1}
- {item.title}
-
-
- );
- })
- }
-
-
-
- :
-
-
- {
- suggestList.map((item: any, index: number) => {
- return (
- -
- {
- this.addSearchHistory({
- id: item.id,
- title: item.title,
- });
- }}>
-
{item.title}
- {item.original_title}
-
-
- );
- })
- }
-
-
- }
-
-
-
-
-
-
-
- {bannerList.map((item: any, index: number) => {
- return (
-
-

-
- );
- })}
-
+ return (
+
{ this.toggleSuggestList(false) }}>
+
+
{
+ this.setState({
+ isTopNavFixed: !!isFixed,
+ });
+ }}>
+
+
+
+
+
-
-
-
-
正在热映
-
-
+ ev.stopPropagation()}
+ onFocus={this.toggleSuggestList.bind(this, true)} />
+
+
+ {
+ isShowTipsPanel ?
+
+
:
- hotShowList.map((item: any, index: number) => {
- return (
-
-
-
-
-
-
- }
- >
- {item.rating.average}
-
-
-
- );
- })}
-
-
-
-
-
新片榜
+ "display": searchHistory.length > 0 ? "block" : "none",
+ }
+ }>
+
历史记录
+
+ {
+ searchHistory.map((item: any, index: number) => {
+ return (
+ -
+
+
{item.title}
+
+
+ );
+ })
+ }
+
+
+
+
热映
+
+ {
+ hotShowList.slice(0, 8).map((item: any, index: number) => {
+ return (
+ -
+ {
+ this.addSearchHistory({
+ id: item.id,
+ title: item.title,
+ });
+ }}>
+ {+index + 1}
+ {item.title}
+
+
+ );
+ })
+ }
+
+
-
+ :
+
+
{
- isLoadingNewMovie ?
- :
- newMovieList.map((item: any, index: number) => {
- return (
-
-
-
-
-
-
- }
- >
- {item.rating.average}
-
-
-
- );
- })}
+ suggestList.map((item: any, index: number) => {
+ return (
+ -
+ {
+ this.addSearchHistory({
+ id: item.id,
+ title: item.title,
+ });
+ }}>
+
{item.title}
+ {item.original_title}
+
+
+ );
+ })
+ }
+
-
-
-
北美票房榜
-
{boxLastDate} 更新/美元
-
-
- {
- isLoadingGoodBox ?
- :
- goodBoxList.map((item: any, index: number) => {
- let { rank, box, subject } = item;
- let { title, id, rating, collect_count } = subject;
- let { average } = rating;
+ }
+
+
+
+
+
+
+
+ {bannerList.map((item: any, index: number) => {
+ return (
+
+

+
+ );
+ })}
+
+
+
+
+
+
+
正在热映
+
+
+ {
+ isLoadingHotShow ?
+
:
+ hotShowList.map((item: any, index: number) => {
+ return (
+
+
+
+
+
+
+ }
+ >
+ {item.rating.average}
+
+
+
+ );
+ })}
+
+
+
+
+
新片榜
+
+
+ {
+ isLoadingNewMovie ?
+
:
+ newMovieList.map((item: any, index: number) => {
+ return (
+
+
+
+
+
+
+ }
+ >
+ {item.rating.average}
+
+
+
+ );
+ })}
+
+
+
+
北美票房榜
+
{boxLastDate} 更新/美元
+
+
+ {
+ isLoadingGoodBox ?
+ :
+ goodBoxList.map((item: any, index: number) => {
+ let { rank, box, subject } = item;
+ let { title, id, rating, collect_count } = subject;
+ let { average } = rating;
- let isNew = item.new;
+ let isNew = item.new;
- let summaryList = [];
- let summary = "";
+ let summaryList = [];
+ let summary = "";
- if (isNew) {
- summaryList.push("新上榜");
- }
+ if (isNew) {
+ summaryList.push("新上榜");
+ }
- summaryList.push(`${average || 0} 分`);
- summaryList.push(`${collect_count} 收藏`);
- summary = summaryList.join(" / ");
+ summaryList.push(`${average || 0} 分`);
+ summaryList.push(`${collect_count} 收藏`);
+ summary = summaryList.join(" / ");
- return (
- -
-
-
{title}
-
- {rank}
- {box / 1e4} 万
-
-
- );
- })
- }
-
-
-
-
-
-
一周口碑榜
-
-
- {
- weeklyBox.slice(0, 6).map((item: any, index: number) => {
- let { subject } = item;
- let { rating, title } = subject;
- let { average } = rating;
- return (
-
-
{average} 分
-
{title}
-
-
- );
- })
- }
-
-
- {
- isLoadingWeeklyBox ?
-
:
- weeklyBox.slice(0, 6).map((item: any, index: number) => {
- let { subject } = item;
- let { rating, title, id, images, genres } = subject;
- let { average } = rating;
- return (
-
-
-
-
-
-
- }
- >
- {average}
-
-
-
- );
- })}
-
-
-
-
-
Top 250
-
- {
- isLoadingTop250 ?
-
:
- this.renderTop250()
- }
-
-
-
-
-
免责声明:内容来源于 豆瓣电影 ,接口来源于网络,侵删,禁止商业用途使用
-
-
-
-
关于我
-
-
About me
-
-
Github
-
-
掘金
-
-
博客
+ return (
+
+
+ {title}
+
+ {rank}
+ {box / 1e4} 万
+
+
+ );
+ })
+ }
+
+
+
+
+
+
一周口碑榜
+
+
+ {
+ weeklyBox.slice(0, 6).map((item: any, index: number) => {
+ let { subject } = item;
+ let { rating, title } = subject;
+ let { average } = rating;
+ return (
+
+
{average} 分
+
{title}
+
-
+ );
+ })
+ }
- );
- }
+
+ {
+ isLoadingWeeklyBox ?
+
:
+ weeklyBox.slice(0, 6).map((item: any, index: number) => {
+ let { subject } = item;
+ let { rating, title, id, images, genres } = subject;
+ let { average } = rating;
+ return (
+
+
+
+
+
+
+ }
+ >
+ {average}
+
+
+
+ );
+ })}
+
+
+
+
+
Top 250
+
+ {
+ isLoadingTop250 ?
+
:
+ this.renderTop250()
+ }
+
+
+
+
+
免责声明:内容来源于 豆瓣电影 ,接口来源于网络,侵删,禁止商业用途使用
+
+
+
+
+
+ );
+ }
}
-export default Home;
\ No newline at end of file
+export default Home;
diff --git a/src/router/RouterView.tsx b/src/router/RouterView.tsx
index 59e47f7..6247363 100644
--- a/src/router/RouterView.tsx
+++ b/src/router/RouterView.tsx
@@ -1,26 +1,26 @@
import React from 'react';
-import { BrowserRouter, Switch, Route,Redirect } from 'react-router-dom';
+import { BrowserRouter, Switch, Route, Redirect } from 'react-router-dom';
import Home from '../pages/Home';
import Detail from '../pages/Detail';
import Box from '../pages/Box';
function NotFound() {
- return '404';
+ return '404';
}
export default function () {
- return (
-
-
-
-
-
-
-
-
-
- );
+ return (
+
+
+
+
+
+
+
+
+
+ );
}
diff --git a/src/skeletons/Detail.tsx b/src/skeletons/Detail.tsx
index f73f59d..5a31bd7 100644
--- a/src/skeletons/Detail.tsx
+++ b/src/skeletons/Detail.tsx
@@ -2,28 +2,28 @@ import React from 'react';
import { Statistic, Skeleton } from 'antd';
export default function () {
- return (
-
-
-
+ return (
+
+
+
- );
-}
\ No newline at end of file
+
+
+ );
+}
diff --git a/src/skeletons/Home.tsx b/src/skeletons/Home.tsx
index d75d5d5..721cd9a 100644
--- a/src/skeletons/Home.tsx
+++ b/src/skeletons/Home.tsx
@@ -3,83 +3,83 @@ import { Card, Skeleton } from 'antd';
import loadingSvg from '../assets/loading.svg';
interface ICardList {
- column: number,
+ column: number,
}
export function CardListSkeleton(props: ICardList) {
- let { column } = props;
- let list = new Array(column || 6).fill(1);
- return (
- <>
- {
- list.map((item: any, index: number) => {
- return (
-
-
-
-
- }
- />
-
- );
- })
- }
- >
- );
+ let { column } = props;
+ let list = new Array(column || 6).fill(1);
+ return (
+ <>
+ {
+ list.map((item: any, index: number) => {
+ return (
+
+
+
+
+ }
+ />
+
+ );
+ })
+ }
+ >
+ );
}
export function CardListTop250Skeleton() {
- let list = new Array(9).fill(1);
- return (
-
- {
- list.map((item: any, index: number) => {
- return (
-
-
-
-
- }
- />
-
- );
- })
- }
-
- );
+ let list = new Array(9).fill(1);
+ return (
+
+ {
+ list.map((item: any, index: number) => {
+ return (
+
+
+
+
+ }
+ />
+
+ );
+ })
+ }
+
+ );
}
interface IList {
- row: number,
+ row: number,
}
export function ListSkeleton(props: IList) {
- let { row } = props;
- let list = new Array(row || 4).fill(1);
- return (
- <>
- {
- list.map((item: any, index: number) => {
- return (
-
-
-
- 0
- 0 万
-
- );
- })
- }
- >
- );
-}
\ No newline at end of file
+ let { row } = props;
+ let list = new Array(row || 4).fill(1);
+ return (
+ <>
+ {
+ list.map((item: any, index: number) => {
+ return (
+
+
+
+ 0
+ 0 万
+
+ );
+ })
+ }
+ >
+ );
+}
diff --git a/src/store/index.ts b/src/store/index.ts
index 8cec2e9..3200236 100644
--- a/src/store/index.ts
+++ b/src/store/index.ts
@@ -1 +1 @@
-export {};
\ No newline at end of file
+export { };
\ No newline at end of file
diff --git a/src/utils/index.ts b/src/utils/index.ts
index 8cec2e9..2234b9c 100644
--- a/src/utils/index.ts
+++ b/src/utils/index.ts
@@ -1 +1 @@
-export {};
\ No newline at end of file
+export { };