Browse Source

青涩知夏-增加自定义菜单、修改打赏样式

huanghuijie 4 years ago
parent
commit
d826f35619

+ 1 - 1
src/App.js

@@ -37,7 +37,7 @@ class App extends PureComponent {
 
     getMuisic(){
         axios.get('/music/music/v1/list').then((res) => {
-            if(res.models.length){
+            if(res.models.length > 0){
                 const options = {
                     container: document.getElementById('player'),
                     fixed: true,

+ 1 - 1
src/components/Footer/index.js

@@ -17,7 +17,7 @@ class Footer extends PureComponent {
                                 <a href={domain} rel="noopener noreferrer" target={'_blank'}>{copyright}</a>
                             </span>
                         </p>
-                        <p>© 2019 {title} {icp}</p>
+                        <p>© 2020 {title} <a href="http://www.beian.miit.gov.cn/" target="_blank" rel="noopener noreferrer">{icp}</a></p>
                     </div>
                 </div>
             </Footers>

+ 3 - 0
src/components/Footer/style.js

@@ -25,6 +25,9 @@ export const Footers = styled.footer`
         }
         p{
             margin:15px 0;
+            a{
+                color: #b9b9b9;
+            }
         }
         .name{
             span{

+ 128 - 22
src/components/Header/index.js

@@ -15,7 +15,9 @@ class Header extends PureComponent {
             isVisible: false,
             value: '',
             open: false,
-            isUser: false
+            isUser: false,
+            menuList: [],
+            loading: false
         };
         this.handleClick = this.handleClick.bind(this);
         this.keypress = this.keypress.bind(this);
@@ -26,7 +28,7 @@ class Header extends PureComponent {
     }
 
     render() {
-        const {isVisible, value, open, isUser} = this.state;
+        const {isVisible, value, open, isUser, menuList, loading} = this.state;
         const {category} = this.props;
         const {title, domain} = this.props.confing.toJS();
         const {name, introduction, avatar} = this.props.userInfo.toJS();
@@ -40,7 +42,7 @@ class Header extends PureComponent {
                             <Icon type="menu" onClick={this.openMonav}/>
                         </NavLeft>
                         <NavRight>
-                            <div className='flex-items'>
+                            {loading ? <div className='flex-items'>
                                 <Nav className='flex-items'>
                                     <NavItem>
                                         <Link to={'/'} className='nav-item'>
@@ -50,7 +52,7 @@ class Header extends PureComponent {
                                     </NavItem>
                                     <NavItem id='area'>
                                         <Dropdown
-                                            overlay={this.Category()}
+                                            overlay={this.setCategory(category.toJS(), true)}
                                             placement="bottomCenter"
                                             getPopupContainer={() => document.getElementById('area')}
                                             overlayClassName='NavDropdown'
@@ -79,13 +81,43 @@ class Header extends PureComponent {
                                             <span>标签墙</span>
                                         </Link>
                                     </NavItem>
+                                    {menuList.map((item, index) => {
+                                        if (item.child && item.child.length > 0) {
+                                            return (
+                                                <NavItem id={'area' + index} key={index}>
+                                                    <Dropdown
+                                                        overlay={this.setCategory(item.child, false)}
+                                                        placement="bottomCenter"
+                                                        getPopupContainer={() => document.getElementById('area' + index)}
+                                                        overlayClassName='NavDropdown'
+                                                    >
+                                                        <a href={item.url} target={'_blank'} rel="noopener noreferrer"
+                                                           className='nav-item'>
+                                                            <Icon type={item.icon} theme="filled"/>
+                                                            <span>{item.title}</span>
+                                                        </a>
+                                                    </Dropdown>
+                                                </NavItem>
+                                            )
+                                        } else {
+                                            return (
+                                                <NavItem key={index}>
+                                                    <a href={item.url} target={'_blank'} rel="noopener noreferrer"
+                                                       className='nav-item'>
+                                                        <Icon type={item.icon} theme="filled"/>
+                                                        <span>{item.title}</span>
+                                                    </a>
+                                                </NavItem>
+                                            )
+                                        }
+                                    })}
                                 </Nav>
                                 <IconBox className='flex-items'>
                                     <Icon type="search" onClick={this.handleClick}/>
-                                    {isUser || getAvatar()? <img src={getAvatar()} alt=""/> :
+                                    {isUser || getAvatar() ? <img src={getAvatar()} alt=""/> :
                                         <Icon type="user" onClick={this.login}/>}
                                 </IconBox>
-                            </div>
+                            </div> : null}
                         </NavRight>
                     </NavWrapper>
                 </Affix>
@@ -155,6 +187,41 @@ class Header extends PureComponent {
                                 <span>标签墙</span>
                             </Link>
                         </li>
+                        {menuList.map((item, index) => {
+                            if (item.child && item.child.length > 0) {
+                                return (
+                                    <li key={index}>
+                                        <a href={item.url} target={'_blank'} rel="noopener noreferrer"
+                                           className='item flex-items'>
+                                            <Icon type={item.icon} theme="filled"/>
+                                            <span>{item.title}</span>
+                                        </a>
+                                        <ul className='sub-menu'>
+                                            {item.child.map((item, index) => {
+                                                return (
+                                                    <li key={index}>
+                                                        <a href={item.url} target={'_blank'} rel="noopener noreferrer"
+                                                           className='item flex-items'>
+                                                            <span>{item.title}</span>
+                                                        </a>
+                                                    </li>
+                                                )
+                                            })}
+                                        </ul>
+                                    </li>
+                                )
+                            } else {
+                                return (
+                                    <li key={index}>
+                                        <a href={item.url} target={'_blank'} rel="noopener noreferrer"
+                                           className='item flex-items'>
+                                            <Icon type={item.icon} theme="filled"/>
+                                            <span>{item.title}</span>
+                                        </a>
+                                    </li>
+                                )
+                            }
+                        })}
                     </ul>
                 </MoNav>
             </Headers>
@@ -165,6 +232,27 @@ class Header extends PureComponent {
         this.props.getCategory();
         this.props.getUser();
         this.props.getConfing();
+        this.getMenu();
+    }
+
+    getMenu() {
+        this.setState({loading: false});
+        axios.get('/menu/front/v1/list', {
+            params: {
+                page: 1,
+                size: 10
+            }
+        }).then((res) => {
+            if (res.success === 1) {
+                let Time = setTimeout(() => {
+                    this.setState({
+                        menuList: res.models,
+                        loading: true
+                    });
+                    clearTimeout(Time);
+                }, 10)
+            }
+        });
     }
 
     keypress(e) {
@@ -182,7 +270,7 @@ class Header extends PureComponent {
     login() {
         axios.get('/auth/github/v1/get').then((res) => {
             if (res.success === 1) {
-                openWindow(res.model, "绑定GitHub", 540, 540);
+                openWindow(res.model.authorizeUrl, "绑定GitHub", 540, 540);
                 window.addEventListener("message", this.loginGithubHandel, false);
             }
         });
@@ -218,9 +306,18 @@ class Header extends PureComponent {
     }
 
     openMonav() {
-        this.setState((prevState) => ({
-            open: !prevState.open
-        }))
+        this.setState((prevState) => {
+            if (!prevState.open) {
+                document.body.style.height = '100%';
+                document.body.style.overflow = 'hidden';
+            } else {
+                document.body.style.height = '';
+                document.body.style.overflow = '';
+            }
+            return {
+                open: !prevState.open
+            }
+        })
     }
 
     handleClick() {
@@ -229,24 +326,33 @@ class Header extends PureComponent {
         }))
     }
 
-    Category() {
-        const {category} = this.props;
-        const list = category.toJS();
-        return (
-            <Menu>
-                {
-                    list.map((item, index) => {
+    setCategory(list, isCategory) {
+        if (isCategory) {
+            return (
+                <Menu>
+                    {list.map((item, index) => {
                         return (
                             <Menu.Item key={index}>
                                 <Link to={'/category/' + item.id}>{item.name}</Link>
                             </Menu.Item>
                         )
-                    })
-                }
-            </Menu>
-        )
+                    })}
+                </Menu>
+            )
+        } else {
+            return (
+                <Menu>
+                    {list.map((item, index) => {
+                        return (
+                            <Menu.Item key={index}>
+                                <a href={item.url} target={'_blank'} rel="noopener noreferrer">{item.title}</a>
+                            </Menu.Item>
+                        )
+                    })}
+                </Menu>
+            )
+        }
     }
-
 }
 
 const mapStateToProps = (state) => {

+ 5 - 4
src/components/Header/style.js

@@ -342,19 +342,20 @@ export const MoNav = styled.div`
         font-size: 13px;
         color: #333;
         position: relative;
+    }
+    .menu{
+        position: relative;
         &:after{
             position: absolute;
             right:0px;
-            bottom: 0;
-            left:0px;
+            top: 0;
+            left: 0px;
             height: 1px;
             content: '';
             -webkit-transform: scaleY(.5);
             transform: scaleY(.5);
             background-color:#f1f1f1;   
         }
-    }
-    .menu{
         .item{
             position: relative;
             padding:10px 15px;

+ 1 - 1
src/pages/archives/index.js

@@ -127,7 +127,7 @@ class Archives extends PureComponent {
 
 const mapState = (state) => {
     return {
-        topImg: state.getIn(['image', 'topImg'])
+        topImg: state.getIn(['image', 'bannerList'])
     }
 };
 

+ 1 - 1
src/pages/article/components/Comments.js

@@ -155,7 +155,7 @@ class Comments extends PureComponent {
     login() {
         axios.get('/auth/github/v1/get').then((res) => {
             if (res.success === 1) {
-                openWindow(res.model, "绑定GitHub", 540, 540);
+                openWindow(res.model.authorizeUrl, "绑定GitHub", 540, 540);
                 window.addEventListener("message", loginGithubHandel, false);
             }
         });

+ 9 - 9
src/pages/article/index.js

@@ -94,13 +94,13 @@ class Article extends PureComponent {
                 this.setState({
                     content: res.model
                 })
-            }else {
+            } else {
                 this.props.history.push('/404');
             }
         });
     }
 
-    getSocials(){
+    getSocials() {
         axios.get('/social/social/v1/socials?code=reward').then((res) => {
             if (res.success === 1) {
                 this.setState({
@@ -110,16 +110,16 @@ class Article extends PureComponent {
         });
     }
 
-    setSocials(socialsList){
-        if(socialsList.length){
-            return(
+    setSocials(socialsList) {
+        if (socialsList.length > 0) {
+            return (
                 <div className='single-reward'>
                     <div className='reward-open'>
                         <p>赏</p>
                         <div className='reward-main'>
                             <ul className='reward-row'>
-                                {socialsList.map((item,index)=>{
-                                    return(
+                                {socialsList.map((item, index) => {
+                                    return (
                                         <li key={index}>
                                             <img src={item.content} alt=""/>
                                             <p>{item.remark}</p>
@@ -131,7 +131,7 @@ class Article extends PureComponent {
                     </div>
                 </div>
             )
-        }else {
+        } else {
             return null
         }
     }
@@ -151,7 +151,7 @@ class Article extends PureComponent {
 
 const mapState = (state) => {
     return {
-        topImg: state.getIn(['image', 'topImg']),
+        topImg: state.getIn(['image', 'bannerList']),
         userInfo: state.getIn(['header', 'userInfo']),
     }
 };

+ 2 - 2
src/pages/article/style.js

@@ -400,7 +400,7 @@ export const MainWrapper = styled.div`
         width: 100%;
         margin: 35px auto;
         text-align: center;
-        z-index: 999;
+        z-index: 90;
         .reward-open {
             position: relative;
             width: 40px;
@@ -612,7 +612,7 @@ export const CommentTextarea = styled.div`
         color: #535a63;
         border: 1px solid #ddd;
         background-color: transparent;
-        background-image: url(https://cos.nosum.cn/sakura/comment-bg.png);
+        background-image: url(https://view.moezx.cc/images/2018/03/24/comment-bg.png);
         background-size: contain;
         background-repeat: no-repeat;
         background-position: right;

+ 1 - 1
src/pages/article/tocify.js

@@ -65,7 +65,7 @@ export default class Tocify {
     }
 
     render() {
-        if (this.tocItems.length) {
+        if (this.tocItems.length > 0) {
             return (
                 <Anchor className='toc' affix showInkInFixed onClick={handleClick} offsetTop={100}>
                     <h3>文章目录</h3>

+ 1 - 1
src/pages/category/index.js

@@ -121,7 +121,7 @@ class Category extends PureComponent {
 const mapState = (state) => {
     return {
         category: state.getIn(['header', 'category']),
-        topImg: state.getIn(['image', 'topImg']),
+        topImg: state.getIn(['image', 'bannerList']),
         ListImg: state.getIn(['image', 'ListImg']),
     }
 };

+ 1 - 1
src/pages/home/components/Banner.js

@@ -36,7 +36,7 @@ class Banner extends PureComponent {
                         <div className='header-tou'>
                             <img src={avatar}  alt=''/>
                         </div>
-                        <h1 className='glitch' data-text="NOSUMBLOG!">NOSUMBLOG!</h1>
+                        <h1 className='glitch' data-text="NOSUM!">NOSUM!</h1>
                         <div className='header-info'>
                             <p className='ellipsis'>
                                 <i className='iconfont icon-quote-left'/>

+ 59 - 4
src/pages/home/components/List.js

@@ -1,10 +1,12 @@
 import React, {PureComponent} from "react";
 import {connect} from 'react-redux';
 import {FeatureTitle, HomeList, BlogList} from "../style";
-import {actionCreators} from "../store";
 import {Link} from "react-router-dom";
-import {getTime} from "../../../lib/public";
+import {getrand, getTime} from "../../../lib/public";
 import PagInation from '../../../components/PagInation';
+import * as constants from "../store/constants";
+import axios from "axios";
+import {fromJS} from "immutable";
 
 const List = (props) => {
     const {blogList} = props;
@@ -69,7 +71,12 @@ class ListWrapper extends PureComponent {
                     <h1><i className='iconfont icon-envira'/><span> Discovery</span></h1>
                 </FeatureTitle>
                 {List(this.props)}
-                <PagInation page={page} finished={finished} loading={loading} getList={this.props.getBlogList}/>
+                <PagInation
+                    page={page}
+                    finished={finished}
+                    loading={loading}
+                    getList={this.props.getBlogList.bind(this.props)}
+                />
             </HomeList>
         )
     }
@@ -88,13 +95,61 @@ const mapState = (state) => {
         finished: state.getIn(['home', 'finished']),
         loading: state.getIn(['home', 'loading']),
         isList: state.getIn(['home', 'isList']),
+        ListImg: state.getIn(['image', 'ListImg']),
     }
 };
 
+const setBlogList = (data, nextPage, override) => ({
+    type: constants.GET_BLOGLIST,
+    data: fromJS(data),
+    nextPage,
+    override
+});
+
+const setfinished = () => ({
+    type: constants.SET_FINISHED,
+});
+
+const list = (thumbList, data) => {
+    const list = data;
+    const Img = thumbList;
+    let arr = [];
+    for (let i = 0; i < list.length; i++) {
+        arr.push({
+            id: list[i].id,
+            title: list[i].title,
+            thumbnail: list[i].thumbnail || Img[getrand(0, Img.length - 1)].img,
+            comments: list[i].comments,
+            status: list[i].status,
+            summary: list[i].summary,
+            views: list[i].views,
+            createTime: list[i].createTime,
+            syncStatus: list[i].syncStatus,
+            author: list[i].author,
+            categoryName: list[i].categoryName
+        })
+    }
+    return arr
+};
+
 const mapDispatch = (dispatch) => {
     return {
         getBlogList(page, override) {
-            dispatch(actionCreators.getBlogList(page, override))
+            dispatch({type: constants.LOADING_TRUE});
+            axios.get('/posts/posts/v1/list', {
+                params: {
+                    page: page,
+                    size: 10
+                }
+            }).then((res) => {
+                if (res.success === 1) {
+                    let current = res.pageInfo.page * res.pageInfo.size;
+                    let total = res.pageInfo.total;
+                    let data = list(this.ListImg, res.models);
+                    dispatch(setBlogList(data, page + 1, override));
+                    if (current > total) dispatch(setfinished());
+                }
+            });
         },
     }
 };

+ 5 - 30
src/pages/home/index.js

@@ -12,27 +12,6 @@ class Home extends PureComponent {
         super(props);
         this.state = {
             banner: '',
-            bannerList: [
-                {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(59).jpg'},
-                {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(53).jpg'},
-                {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(70).jpg'},
-                {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(60).jpg'},
-                {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(46).jpg'},
-                {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(73).jpg'},
-                {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(63).jpg'},
-                {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(74).jpg'},
-                {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(72).jpg'},
-                {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(62).jpg'},
-                {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(7).jpg'},
-                {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(23).jpg'},
-                {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(28).jpg'},
-                {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(38).jpg'},
-                {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(43).jpg'},
-                {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(46).jpg'},
-                {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(54).jpg'},
-                {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(62).jpg'},
-                {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(73).jpg'}
-            ],
             innerHeight: window.innerHeight,
         };
         this.getBanner = this.getBanner.bind(this);
@@ -40,10 +19,10 @@ class Home extends PureComponent {
 
     render() {
         const {banner, innerHeight} = this.state;
-        const {userInfo, featureList, ListImg, socialList} = this.props;
+        const {userInfo, featureList, ListImg} = this.props;
         return (
             <HomeWrapper>
-                <Banner banner={banner} innerHeight={innerHeight} getBanner={this.getBanner} userInfo={userInfo} socialList={socialList}/>
+                <Banner banner={banner} innerHeight={innerHeight} getBanner={this.getBanner} userInfo={userInfo}/>
                 <MainWrapper id='content'>
                     <Feature featureList={featureList} ListImg={ListImg}/>
                     <ListWrapper/>
@@ -56,11 +35,10 @@ class Home extends PureComponent {
         this.changeInnerHeight();
         this.getBanner();
         this.props.getFeature();
-        this.props.getSocialList()
     }
 
     getBanner() {
-        const banner = this.state.bannerList;
+        const banner = this.props.bannerList;
         const num = getrand(0, banner.length - 1);
         this.setState({
             banner: `url('${banner[num].img}')`
@@ -81,7 +59,7 @@ const mapState = (state) => {
         userInfo: state.getIn(['header', 'userInfo']),
         featureList: state.getIn(['home', 'featureList']),
         ListImg: state.getIn(['image', 'ListImg']),
-        socialList: state.getIn(['home', 'socialList']),
+        bannerList: state.getIn(['image', 'bannerList'])
     }
 };
 
@@ -89,10 +67,7 @@ const mapDispatch = (dispatch) => {
     return {
         getFeature() {
             dispatch(actionCreators.getFeature());
-        },
-        getSocialList() {
-            dispatch(actionCreators.getSocialList());
-        },
+        }
     }
 };
 

+ 0 - 44
src/pages/home/store/actionCreators.js

@@ -21,47 +21,3 @@ export const getFeature = () => {
         });
     }
 };
-
-const setBlogList = (data, nextPage, override) => ({
-    type: constants.GET_BLOGLIST,
-    data: fromJS(data),
-    nextPage,
-    override
-});
-
-const setfinished = () => ({
-    type: constants.SET_FINISHED,
-});
-
-export const getBlogList = (page, override) => {
-    return (dispatch) => {
-        dispatch({type: constants.LOADING_TRUE});
-        axios.get('/posts/posts/v1/list', {
-            params: {
-                page: page,
-                size: 10
-            }
-        }).then(function (res) {
-            if (res.success === 1) {
-                let current = res.pageInfo.page * res.pageInfo.size;
-                let total = res.pageInfo.total;
-                dispatch(setBlogList(res.models, page + 1, override));
-                if (current > total) dispatch(setfinished());
-            }
-        });
-    }
-};
-
-export const getSocialList = () => {
-    return (dispatch) => {
-        axios.get('/social/social/v1/socials').then((res) => {
-            if (res.success === 1) {
-                dispatch({
-                    type: constants.GET_SOCIAL_LIST,
-                    data: fromJS(res.models)
-                });
-            }
-        })
-    }
-};
-

+ 0 - 1
src/pages/home/store/constants.js

@@ -2,4 +2,3 @@ export const GET_FEATURE = 'home/GET_FEATURE';
 export const GET_BLOGLIST = 'home/GET_BLOGLIST';
 export const SET_FINISHED = 'home/SET_FINISHED';
 export const LOADING_TRUE = 'home/LOADING_TRUE';
-export const GET_SOCIAL_LIST = 'home/GET_SOCIAL_LIST';

+ 3 - 46
src/pages/home/store/reducer.js

@@ -1,29 +1,13 @@
 import {fromJS} from 'immutable';
 import * as constants from './constants';
-import {getrand} from '../../../lib/public'
 
 const defaultState = fromJS({
     featureList: [],
     blogList: [],
     articlePage: 1,
-    thumbList: [
-        {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(44).jpg'},
-        {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(42).jpg'},
-        {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(41).jpg'},
-        {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(3).jpg'},
-        {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(28).jpg'},
-        {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(43).jpg'},
-        {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(47).jpg'},
-        {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(48).jpg'},
-        {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(49).jpg'},
-        {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(55).jpg'},
-        {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(56).jpg'},
-        {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(57).jpg'}
-    ],
     finished: false,
     loading: true,
-    isList: false,
-    socialList:[]
+    isList: false
 });
 
 const setFeature = (state, action) => {
@@ -32,38 +16,15 @@ const setFeature = (state, action) => {
     })
 };
 
-const list = (thumbList, data) => {
-    const list = data.toJS();
-    const Img = thumbList.toJS();
-    let arr = [];
-    for (let i = 0; i < list.length; i++) {
-        arr.push({
-            id: list[i].id,
-            title: list[i].title,
-            thumbnail: list[i].thumbnail || Img[getrand(0, Img.length - 1)].img,
-            comments: list[i].comments,
-            status: list[i].status,
-            summary: list[i].summary,
-            views: list[i].views,
-            createTime: list[i].createTime,
-            syncStatus: list[i].syncStatus,
-            author: list[i].author,
-            categoryName: list[i].categoryName
-        })
-    }
-    return arr
-};
-
 const setBlogList = (state, action) => {
-    const arr = list(state.get('thumbList'), action.data);
     return action.override ? state.merge({
-        blogList: action.override ? fromJS(arr) : state.get('blogList').concat(fromJS(arr)),
+        blogList: action.override ? fromJS(action.data) : state.get('blogList').concat(fromJS(action.data)),
         articlePage: action.nextPage,
         finished: false,
         loading: false,
         isList: true
     }) : state.merge({
-        blogList: action.override ? fromJS(arr) : state.get('blogList').concat(fromJS(arr)),
+        blogList: action.override ? fromJS(action.data) : state.get('blogList').concat(fromJS(action.data)),
         articlePage: action.nextPage,
         loading: false,
         isList: true
@@ -80,10 +41,6 @@ export default (state = defaultState, action) => {
             return state.set('finished', true);
         case constants.LOADING_TRUE:
             return state.set('loading', true);
-        case constants.GET_SOCIAL_LIST:
-            return state.merge({
-                socialList: action.data
-            });
         default:
             return state;
     }

+ 1 - 1
src/pages/home/style.js

@@ -339,7 +339,7 @@ export const Focusinfo = styled.div`
     }
     .header-info {
         position: relative;
-        width: 70%;
+        width: 63%;
         margin: auto;
         font-size: 16px;
         color: #eaeadf;

+ 4 - 4
src/pages/links/index.js

@@ -16,7 +16,7 @@ const LinksList = (props) => {
     } else {
         return (
             <div className='links cell'>
-                {list.length ? <div className='extra'>
+                {list.length > 0 ? <div className='extra'>
                     {list.map((item, index) => {
                         return (
                             <div className='item' key={index}>
@@ -70,13 +70,13 @@ class Links extends PureComponent {
                     <div className='flex-items'>
                         <LinksList list={list} loading={loading}/>
                         <div className='toc-box'>
-                            {list.length?<Anchor className='toc' affix showInkInFixed onClick={this.handleClick} offsetTop={100}>
+                            {list.length > 0 && <Anchor className='toc' affix showInkInFixed onClick={this.handleClick} offsetTop={100}>
                                 {list.map((item)=>{
                                     return(
                                         <Link key={item.title} href={`#${item.title}`} title={item.title}/>
                                     )
                                 })}
-                            </Anchor>:null}
+                            </Anchor>}
                         </div>
                     </div>
                 </MainWrapper>
@@ -126,7 +126,7 @@ class Links extends PureComponent {
 
 const mapState = (state) => {
     return {
-        topImg: state.getIn(['image', 'topImg'])
+        topImg: state.getIn(['image', 'bannerList'])
     }
 };
 

+ 2 - 2
src/pages/tags/index.js

@@ -17,7 +17,7 @@ const TagsList = (props) => {
     } else {
         return (
             <div className='tags-list'>
-                {list.length?list.map((item, index) => {
+                {list.length > 0 ?list.map((item, index) => {
                     return (
                         <Tag color={color[getrand(0, color.length - 1)]} key={index}>
                             <Link to={'/tags/' + item.id}>{item.name}({item.postsTotal})</Link>
@@ -89,7 +89,7 @@ class Tags extends PureComponent {
 
 const mapState = (state) => {
     return {
-        topImg: state.getIn(['image', 'topImg'])
+        topImg: state.getIn(['image', 'bannerList'])
     }
 };
 

+ 1 - 1
src/pages/tags/list.js

@@ -104,7 +104,7 @@ class TagList extends PureComponent {
 
 const mapState = (state) => {
     return {
-        topImg: state.getIn(['image', 'topImg']),
+        topImg: state.getIn(['image', 'bannerList']),
         ListImg: state.getIn(['image', 'ListImg']),
     }
 };

+ 17 - 16
src/store/reducer.js

@@ -4,7 +4,22 @@ import {reducer as homeReducer} from '../pages/home/store';
 
 const image = ()=>{
     return{
-        topImg:[
+        ListImg: [
+            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(44).jpg'},
+            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(42).jpg'},
+            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(41).jpg'},
+            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(3).jpg'},
+            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(4).jpg'},
+            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(43).jpg'},
+            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(47).jpg'},
+            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(48).jpg'},
+            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(49).jpg'},
+            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(55).jpg'},
+            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(56).jpg'},
+            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(57).jpg'}
+        ],
+        //首页banner图和内页顶部头图
+        bannerList: [
             {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(59).jpg'},
             {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(53).jpg'},
             {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(70).jpg'},
@@ -22,21 +37,7 @@ const image = ()=>{
             {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(46).jpg'},
             {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(54).jpg'},
             {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(73).jpg'}
-        ],
-        ListImg: [
-            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(44).jpg'},
-            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(42).jpg'},
-            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(41).jpg'},
-            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(3).jpg'},
-            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(4).jpg'},
-            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(43).jpg'},
-            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(47).jpg'},
-            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(48).jpg'},
-            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(49).jpg'},
-            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(55).jpg'},
-            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(56).jpg'},
-            {img: 'https://cos.nosum.cn/nosum/blog/1/nosum-blog-1%20(57).jpg'}
-        ],
+        ]
     }
 };