From f6ebd154059e4031188084b567c9695f5c8a06c9 Mon Sep 17 00:00:00 2001 From: ximouzhao Date: Wed, 10 Mar 2021 22:44:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4app=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App/App.css | 177 ------------ src/App/App.js | 103 ------- src/App/Article/ArticleContent.js | 39 --- src/App/Article/ArticleList.js | 95 ------- src/App/Article/details/ArticleDetails.js | 49 ---- src/App/Document/DocumentContent.css | 66 ----- src/App/Document/DocumentContent.js | 30 -- src/App/Document/DocumentList.css | 5 - src/App/Document/DocumentList.js | 37 --- src/App/Document/data/code.js | 29 -- src/App/Document/data/images.js | 43 --- src/App/Document/data/links.js | 40 --- src/App/Header/Header.css | 13 - src/App/Header/Header.js | 18 -- src/App/Home/Home.css | 19 -- src/App/Home/Home.js | 107 ------- src/App/Menu/MainLeftMenu.css | 0 src/App/Menu/MainLeftMenu.js | 88 ------ src/App/MessageBoard/MessageBoard.css | 34 --- src/App/MessageBoard/MessageBoard.js | 327 ---------------------- src/App/MessageBoard/MessageContent.css | 67 ----- src/App/MessageBoard/MessageContent.js | 46 --- src/App/MessageBoard/MessageList.css | 3 - src/App/MessageBoard/MessageList.js | 20 -- src/App/MySearch/MySearch.css | 25 -- src/App/MySearch/MySearch.js | 65 ----- src/App/MySearch/SearchResult.js | 31 -- src/App/Think/ThinkContent.js | 34 --- src/App/Think/ThinkList.js | 86 ------ src/index.js | 5 +- 30 files changed, 1 insertion(+), 1700 deletions(-) delete mode 100644 src/App/App.css delete mode 100644 src/App/App.js delete mode 100644 src/App/Article/ArticleContent.js delete mode 100644 src/App/Article/ArticleList.js delete mode 100644 src/App/Article/details/ArticleDetails.js delete mode 100644 src/App/Document/DocumentContent.css delete mode 100644 src/App/Document/DocumentContent.js delete mode 100644 src/App/Document/DocumentList.css delete mode 100644 src/App/Document/DocumentList.js delete mode 100644 src/App/Document/data/code.js delete mode 100644 src/App/Document/data/images.js delete mode 100644 src/App/Document/data/links.js delete mode 100644 src/App/Header/Header.css delete mode 100644 src/App/Header/Header.js delete mode 100644 src/App/Home/Home.css delete mode 100644 src/App/Home/Home.js delete mode 100644 src/App/Menu/MainLeftMenu.css delete mode 100644 src/App/Menu/MainLeftMenu.js delete mode 100644 src/App/MessageBoard/MessageBoard.css delete mode 100644 src/App/MessageBoard/MessageBoard.js delete mode 100644 src/App/MessageBoard/MessageContent.css delete mode 100644 src/App/MessageBoard/MessageContent.js delete mode 100644 src/App/MessageBoard/MessageList.css delete mode 100644 src/App/MessageBoard/MessageList.js delete mode 100644 src/App/MySearch/MySearch.css delete mode 100644 src/App/MySearch/MySearch.js delete mode 100644 src/App/MySearch/SearchResult.js delete mode 100644 src/App/Think/ThinkContent.js delete mode 100644 src/App/Think/ThinkList.js diff --git a/src/App/App.css b/src/App/App.css deleted file mode 100644 index 2ac8e40..0000000 --- a/src/App/App.css +++ /dev/null @@ -1,177 +0,0 @@ -@import '~antd/dist/antd.css'; - -@keyframes myfirst -{ -from {background: red;} -to {background: yellow;} -} -#root{ - height: 100%; -} -/* 使图片自适应浏览器的宽度 */ -.background{ - background-color:#fff; - margin: 0; - width: 100%; - height: 100%; -} - -.App { - text-align: center; - margin: 24px 0 30px 0; - background-color:#f2f4f5; - display: inline-block; - width: 100%; -} -.App-header { - min-height: 40px; - width: 100%; - font-size: calc(10px + 2vmin); - background:#ff4d4f; - color: white; - box-shadow: 0 2px 8px #ffa39e; - position: fixed; - top: 0px; - z-index: 15; - vertical-align:center; -} - -.main-left{ - width: 256px; - min-height: 100%; - margin: 0 0 0 0; - background: #fff; - float: left; - position: fixed; - z-index: 14; - box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12) -} -.main-right{ - background: #f6f6f6; - margin: 40px 0px 0px 256px; - padding-left: 20px; - padding-right: 20px; - padding-top: 20px; - min-height: 100%; -} -.App-logo { - animation: App-logo-spin infinite 20s linear; - height: 40vmin; - pointer-events: none; -} - - -.App-link { - color: #61dafb; -} - -@keyframes App-logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} - -body { - margin: 0; - padding: 0; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", - "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", - sans-serif; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -code { - font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", - monospace; -} -.appSider{ - overflow:auto; - height: 100%; - position: fixed; - left: 0; - z-index:6; - margin-top:64px; - background:#fff; - border-right:1px solid #e8e8e8; -} -.appTrigger { - display: inline; - font-size: 18px; - line-height: 64px; - padding: 0 24px; - cursor: pointer; - transition: color 0.3s; - color: #fff; -} - -.appTrigger:hover { - color: #cf1322; -} -.logoPic{ - width:200px; - display: inline; - margin: -3px 0 -4px 0; -} -.logoDiv{ - display: inline; - width:200px; - overflow: hidden; -} -.layoutContent{ - padding: 20px 50px 0 50px; - margin-top: 64px; - overflow:hidden; -} -.loader{ - text-align: center; -} -.end-text{ - text-align: center; -} -@media (max-width: 576px) { - .layoutContent{ - padding: 20px 0 0 0; - } -} -@media (min-width: 576px) and (max-width: 768px){ - .layoutContent{ - padding: 20px 10px 0 10px; - } -} -@media (min-width: 768px) and (max-width: 992px){ - .layoutContent{ - padding: 20px 20px 0 20px; - } -} -@media (min-width: 992px) and (max-width: 1200px ){ - .layoutContent{ - padding: 20px 30px 0 30px; - } -} -@media (min-width: 1200px) and (max-width: 1600px){ - .layoutContent{ - padding: 20px 40px 0 40px; - } -} - -.appContentMask{ - position:fixed; - width:100%; - left:0; - background-color:rgba(0,0,0,0.45); - opacity:0; - height: 0%; - transition:height 0s ease 0.3s,opacity .3s linear; - -webkit-transition:height 0s ease 0.3s,opacity .3s linear; - z-index: 5; -} -.appContentMask.appContentMaskOpen{ - transition:height 0s ease, opacity .3s linear; - -webkit-transition:height 0s ease, opacity .3s linear; - height: 100%; - opacity:1; -} \ No newline at end of file diff --git a/src/App/App.js b/src/App/App.js deleted file mode 100644 index b487114..0000000 --- a/src/App/App.js +++ /dev/null @@ -1,103 +0,0 @@ -import React, { Component } from 'react'; -import './App.css'; -import { BackTop,Layout,Icon,Row, Col} from 'antd'; -import MainLeftMenu from './Menu/MainLeftMenu'; -import MessageBoard from './MessageBoard/MessageBoard'; -//import Header from './Header/Header'; -import { BrowserRouter,Route,withRouter } from 'react-router-dom'; -import Home from './Home/Home'; -import MySearch from './MySearch/MySearch'; -import ArticleList from './Article/ArticleList'; -import ArticleDetails from './Article/details/ArticleDetails'; -import ThinkList from './Think/ThinkList'; -import logopng from '../resource/logo.486a892c.png'; -import { PhotoProvider } from 'react-photo-view'; -import 'react-photo-view/dist/index.css'; - -const {Header,Content,Footer,Sider} =Layout; -const minMarginLeft=0; -const maxMarginLeft=200; -class App extends Component { - - state={ - collapsed:false, - rightLayoutStyle:{}, - padding:"", - appContentMaskClassName:"appContentMask", - }; - onCollapse = collapsed => { - console.log(collapsed); - let animation=( collapsed)?'rightAreaCollapsed 0.2s':'rightAreaUnCollapsed 0.2s' ; - let marginLeft=( collapsed)?minMarginLeft:maxMarginLeft ; - console.log(animation); - this.setState({ - collapsed, - rightLayoutStyle:{marginLeft:marginLeft} - }); - }; - toggle = () => { - let isPhone=window.innerWidth<=768; - let collapsed=!this.state.collapsed; - let animation=( collapsed)?'rightAreaCollapsed 0.2s':'rightAreaUnCollapsed 0.2s' ; - if(isPhone){ - if(collapsed){ - this.setState({ - collapsed: collapsed, - appContentMaskClassName:"appContentMask", - }); - }else{ - this.setState({ - collapsed: collapsed, - appContentMaskClassName:"appContentMask appContentMaskOpen", - }); - } - }else{ - let marginLeft=( collapsed)?minMarginLeft:maxMarginLeft ; - this.setState({ - collapsed: collapsed, - rightLayoutStyle:{animation:animation,marginLeft:marginLeft,animationTimingTunction:'linear'}, - appContentMaskClassName:"appContentMask", - }); - } - }; - render() { - return ( - - -
- -
- -
-
- - - - -
- - - - - - - - - - - -
Ximou Zhao ©2019 Created by Ximou Zhao 京ICP备19037635号-1
-
-
- ); - } -} - -export default withRouter(App); diff --git a/src/App/Article/ArticleContent.js b/src/App/Article/ArticleContent.js deleted file mode 100644 index 377362d..0000000 --- a/src/App/Article/ArticleContent.js +++ /dev/null @@ -1,39 +0,0 @@ -import React, { Component } from 'react'; -import { Link } from 'react-router-dom'; -import { Skeleton, Switch, Card, Icon, Avatar } from 'antd'; -import ReactMarkdown from 'react-markdown'; -import CodeBlock from '../../Tools/CodeBlock'; -import ImageBlock from '../../Tools/ImageBlock'; - -const { Meta } = Card; - -class ArticleContent extends Component{ - render(){ - console.log(this.props); - return ( -
- - -
-

{this.props.element.name}

-

{this.props.element.ts}

-
-

- - 阅读全文 -

-
-
-
-
- ); - } -} - -export default ArticleContent; \ No newline at end of file diff --git a/src/App/Article/ArticleList.js b/src/App/Article/ArticleList.js deleted file mode 100644 index 40d6a4c..0000000 --- a/src/App/Article/ArticleList.js +++ /dev/null @@ -1,95 +0,0 @@ -import React, { Component } from 'react'; -import WrapFetch from '../../Tools/WrapFetch'; -import ArticleContent from './ArticleContent'; -import DocumentType from '../../Constant/DocumentType'; -import { message } from 'antd'; -import InfiniteScroll from 'react-infinite-scroller'; - - -class Article extends Component { - state = { - list: [{ title: '1', content: '1' }, { title: '2', content: '2' }, { title: '3', content: '3' }, { title: '4', content: '4' }], - loading: true, - // start 滚动加载 - hasMore: true, - pageNum: 0, - pageSize: 20, - total: 0 - // end - }; - componentDidMount() { - this.getFirstData(); - } - getFirstData = () => { - this.setState({ loading: { tip: '正在加载...', spinning: true } }); - WrapFetch.get( - { - url: `/api/document/findByPageAndType`, - queryParam: { type: DocumentType.ARTICLE, page: 0, pageSize: this.state.pageSize } - } - ).then( - (data) => { - this.setState({ loading: false, list: data.content, total: data.totalElements, hasMore: data.totalPages > 1, loading: false }); - } - ); - - }; - onChange = checked => { - this.setState({ loading: !checked }); - }; - // 获取下一页信息 - getMore = (page) => { - console.log("getmore",page) - if (this.state.total === this.state.list.length) { - return; - } - this.setState({ - pageNum: page - }, () => { - this.getMoreData(page); //请求数据接口 - }); - } - getMoreData = (page) => { - WrapFetch.get( - { - url: `/api/document/findByPageAndType`, - queryParam: { type: DocumentType.ARTICLE, page: page, pageSize: this.state.pageSize } - } - ).then( - (data) => { - this.setState({ list: this.state.list.concat(data.content), total: data.totalElements, hasMore: data.totalPages > page+1, scrollLoading: false }); - } - ); - }; - render() { - console.log(this.props.location) - let ArticleContents = []; - this.state.list.forEach((element, index, array) => { - try { - ArticleContents.push(); - } catch (err) { - message.error(err + ''); - } - }); - return ( -
- Loading ...
} - > - {ArticleContents} - {/* Tip:内部元素不要加高度以及overflow:auto等属性!!!! */} - {!this.state.hasMore ?
-------- 你已经看完所有的文章啦 --------
: ""} - - - ); - }; -} - -export default Article; \ No newline at end of file diff --git a/src/App/Article/details/ArticleDetails.js b/src/App/Article/details/ArticleDetails.js deleted file mode 100644 index 002b29f..0000000 --- a/src/App/Article/details/ArticleDetails.js +++ /dev/null @@ -1,49 +0,0 @@ -import React, { Component } from 'react'; -import Article from '../ArticleList'; -import WrapFetch from '../../../Tools/WrapFetch'; -import { Skeleton, Switch, Card, Icon, Avatar } from 'antd'; -import ReactMarkdown from 'react-markdown'; -import CodeBlock from '../../../Tools/CodeBlock'; - -class ArticleDetail extends Component{ - state = { - loading: true, - data:{} - }; - componentDidMount(){ - console.log(this.props); - let patharr=this.props.location.pathname.split('/'); - let id=patharr[patharr.length-1]; - console.log(id); - WrapFetch.get( - { - url:`/api/document/findById`, - queryParam:{id:id} - } - ).then( - (data)=>{ - this.setState({loading:false,data:data}); - } - ); - }; - render(){ - return (
- - -
-

{this.state.data.name}

-

{this.state.data.ts}

-
-

- -

-
-
-
-
); - } -} -export default ArticleDetail; \ No newline at end of file diff --git a/src/App/Document/DocumentContent.css b/src/App/Document/DocumentContent.css deleted file mode 100644 index dfd564c..0000000 --- a/src/App/Document/DocumentContent.css +++ /dev/null @@ -1,66 +0,0 @@ -.articleContent{ - background-color: #fff; - margin: 10px 0 10px 0; - padding: 20px 20px 0 20px; - /*border:1px solid #ebedf0;*/ - box-shadow: 0 0 2px rgba(0,0,0,0.2); - border-radius:2px; - display:block; - text-align: left; - position: relative; -} - - -.articleContent .headPhoto{ - height: 50px; - width: 50px; - border-radius:50%; - overflow: hidden; - display: inline-block; - position:relative; - margin-top: 0; - /*重要*/ - float:left; -} -.articleContent .content{ - margin-left: 60px; -} -.articleContent .header{ -} -.articleContent .markdown{ - padding-top: 1px; -} -.articleContent .handle{ - border-top-width:1px; - border-top-style:solid; - border-color:#f2f2f5; - line-height:22px; - font-size: 14px; -} -.articleContent .name{ - color:#333; - text-decoration:none; - font-size:14px; - font-weight:700; - margin: 5px 0 7px 0; -} -.articleContent .time{ - margin-bottom:2px; - color:#808080; - font-size: 12px; -} -.articleContent .comment{ - width: 50%; - display: inline-block; - text-align: center; - margin:7px 0; -} -.articleContent .like{ - width: 50%; - display: inline-block; - text-align: center; - margin:7px 0; - border-left-width:1px; - border-left-style:solid; - border-color:#d9d9d9; -} \ No newline at end of file diff --git a/src/App/Document/DocumentContent.js b/src/App/Document/DocumentContent.js deleted file mode 100644 index 561513f..0000000 --- a/src/App/Document/DocumentContent.js +++ /dev/null @@ -1,30 +0,0 @@ -import React,{Component} from 'react'; -import ReactMarkdown from 'react-markdown'; -import CodeBlock from '../CodeBlock'; -import { Icon } from 'antd'; -import './ArticleContent.css'; -import headPtoto from './../resource/head_photo.png'; - -class ArticleContent extends Component{ - - - render(){ - return ( -
-
-
-
-
{this.props.element.id}
-
{this.props.element.ts}
-
- -
-
-
评论
-
点赞
-
-
- ); - } -} -export default ArticleContent; \ No newline at end of file diff --git a/src/App/Document/DocumentList.css b/src/App/Document/DocumentList.css deleted file mode 100644 index 11e0800..0000000 --- a/src/App/Document/DocumentList.css +++ /dev/null @@ -1,5 +0,0 @@ -.articleList{ - display:inline-block; - margin:0; - width: 80%; -} \ No newline at end of file diff --git a/src/App/Document/DocumentList.js b/src/App/Document/DocumentList.js deleted file mode 100644 index 9689574..0000000 --- a/src/App/Document/DocumentList.js +++ /dev/null @@ -1,37 +0,0 @@ -import React,{Component} from 'react'; -import DocumentContent from './DocumentContent' -import { message} from 'antd'; -import './DocumentList.css'; - -class Article extends Component{ - componentDidMount(){ - this.getListData(); - - }; - state={list:[]}; - getListData=()=>{ - fetch('/api/article/list').then(response=>{ - if(response.ok){ - return response.json(); - }else{ - message.error(response.statusText); - } - }).then(result=>{ - try{ - if(result.data){ - this.setState({list:result.data}); - } - }catch(err){ - console.log(err); - } - }) - }; - render(){ - let articleContents=[]; - this.state.list.forEach((element,index,array)=>{ - articleContents.push() - }); - return (
{articleContents}
) - } -} -export default Article; \ No newline at end of file diff --git a/src/App/Document/data/code.js b/src/App/Document/data/code.js deleted file mode 100644 index abbbd96..0000000 --- a/src/App/Document/data/code.js +++ /dev/null @@ -1,29 +0,0 @@ -export default ` -## Custom code renderer - -This example shows how you can make react-markdown syntax-highlight code blocks. -By default, react-markdown will simply wrap code blocks in
.
-
-\`\`\`js
-const React = require('react')
-const ReactDOM = require('react-dom')
-const Markdown = require('react-markdown')
-const CodeRenderer = require('./code-renderer')
-
-ReactDOM.render(
-  React.createElement(Markdown, {
-    source: 'your markdown here',
-    renderers: {
-      CodeBlock: CodeRenderer
-      Code: CodeRenderer
-    }
-  }),
-  document.body
-)
-\`\`\`
-
-By checking the \`inline\` property, we can reuse the same renderer for both inline and blocks of code!
-For instance, we could highlight \`const React = require('react')\` inline.
-
-See \`examples/custom-renderers\` for the code behind this.
-`;
diff --git a/src/App/Document/data/images.js b/src/App/Document/data/images.js
deleted file mode 100644
index d596b2b..0000000
--- a/src/App/Document/data/images.js
+++ /dev/null
@@ -1,43 +0,0 @@
-export default `
-## Custom image renderer
-
-This example uses a custom image renderer in order to lazy-load and fade in images while rendering the title as an element instead of an attribute.
-
-* ![beer (255)](beer.jpg "Beer!")
-* ![plant (453)](plant.jpg "Plant details")
-* ![ego (302)](ego.jpg "Beer from Ego Brygghus")
-* ![coast (252)](coast.jpg "Coast of California")
-* ![sunrise (252)](sunrise.jpg "Sunrise... Somewhere")
-* ![tree (459)](tree.jpg "Grown people playing")
-* ![sluser (255)](sluser.jpg "Storstraumen")
-* ![chania (453)](chania.jpg "Chania, Crete")
-* ![legs (453)](legs.jpg "Relaxing")
-* ![building (453)](building.jpg "San Francisco?")
-* ![moss (453)](moss.jpg "Mossy rock")
-* ![bird (255)](bird.jpg "Bird, in Egypt")
-* ![alexandria (255)](alexandria.jpg "Library of Alexandria")
-* ![spiral (575)](spiral.jpg "Where?")
-* ![jordan (453)](jordan.jpg "Petra, Jordan")
-* ![56k (276)](56k.jpg "Fastest of 56k modems")
-* ![spices (309)](spices.jpg "Spices in Luxor")
-* ![crete (510)](crete.jpg "Knossos, Crete")
-* ![santorini (510)](santorini.jpg "Santorini")
-* ![android (427)](android.jpg "Dat Android")
-* ![rabbit (375)](rabbit.jpg "Lunte the Rabbit")
-* ![ce (420)](ce.jpg "Codename Eagle")
-* ![dragon (227)](dragon.jpg "Butterfly")
-* ![parrot (574)](parrot.jpg "Parrot in Malaysia")
-* ![hovlandsdal (255)](hovlandsdal.jpg "River in Hovlandsdal")
-* ![tulum (453)](tulum.jpg "Tulum, Mexico")
-* ![shells (422)](shells.jpg "Seashells")
-* ![unicode (236)](unicode.jpg "Aqaba, Jordan")
-* ![beach (546)](beach.jpg "Beach near Krabi, Thailand")
-* ![meercat (637)](meercat.jpg "Meercat")
-* ![towers (423)](towers.jpg "Petronas Towers")
-* ![bridges (226)](bridges.jpg "Grimstad, Norway")
-* ![paris (178)](paris.jpg "Paris, France")
-* ![panda (441)](red-panda.jpg "Red Panda <3")
-* ![sea (436)](sea.jpg "Thailand")
-* ![rome (405)](rome.jpg "Rome")
-* ![keg (226)](keg.jpg "Beer keg")
-`;
diff --git a/src/App/Document/data/links.js b/src/App/Document/data/links.js
deleted file mode 100644
index 5904993..0000000
--- a/src/App/Document/data/links.js
+++ /dev/null
@@ -1,40 +0,0 @@
-export default `
-## React router link renderer
-
-This example renders [links](https://en.wikipedia.org/wiki/Hyperlink) without
-a protocol as [react router](https://github.com/reactjs/react-router) links,
-while "external" links are handled with regular links. External links also get
-a nice little cloud icon thrown in to symbolize they are... well, external.
-The \`target\` attribute is also set to \`_blank\` on the external ones.
-
-In much the same way as the [syntax highlighting](/code) example,
-there really is very little you can't do with this flexibility.
-
-Hard to come up with some dummy text here, so let me just throw in another
-[relative link](/image) to be handled by react-router.
-
-In it's bare essentials, to simply render a link using React Router:
-
-\`\`\`js
-const React = require('react')
-const ReactDOM = require('react-dom')
-const Markdown = require('react-markdown')
-const Link = require('react-router').Link
-
-function RouterLink(props) {
-  return (
-    props.href.match(/^(https?:)?\\/\\//)
-      ? {props.children}
-      : {props.children}
-  );
-}
-
-ReactDOM.render(
-  ,
-  document.body
-)
-\`\`\`
-`;
diff --git a/src/App/Header/Header.css b/src/App/Header/Header.css
deleted file mode 100644
index b37f696..0000000
--- a/src/App/Header/Header.css
+++ /dev/null
@@ -1,13 +0,0 @@
-.search{
-    width: 500px;
-    margin:5px 200px 0 ;
-    float: right;
-}
-
-.headerPic{
-    margin-left: 50px;
-    float: left;
-    height: 40px;
-    display: block;
-    max-width: 100%;  
-}
\ No newline at end of file
diff --git a/src/App/Header/Header.js b/src/App/Header/Header.js
deleted file mode 100644
index 276df6a..0000000
--- a/src/App/Header/Header.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import React,{Component} from 'react';
-import { Input } from 'antd';
-import './Header.css';
-import logopng from '../../resource/logo.png';
-
-const { Search } = Input;
-
-
-class Header extends Component{
-    render(){
-        return (
- console.log(value)} /> -
); - } - -} - -export default Header; \ No newline at end of file diff --git a/src/App/Home/Home.css b/src/App/Home/Home.css deleted file mode 100644 index afb51e8..0000000 --- a/src/App/Home/Home.css +++ /dev/null @@ -1,19 +0,0 @@ -.home{ - text-align: center; - font-size: 50px; -} -.homePic{ - display: block; - height: auto; - max-width: 100%; -} -.ant-descriptions-item-label{ - color:rgba(240, 52, 52, 1) -} -.homeH3{ - color:rgba(0, 0, 0, 0.85); - line-height:1.5; - font-size: 16px; - margin-bottom: 20px; - font-weight: bold; -} \ No newline at end of file diff --git a/src/App/Home/Home.js b/src/App/Home/Home.js deleted file mode 100644 index c7bae6f..0000000 --- a/src/App/Home/Home.js +++ /dev/null @@ -1,107 +0,0 @@ -import React, { Component } from 'react'; -import './Home.css'; -import { Timeline, Icon,Card,List ,Descriptions,Typography } from 'antd'; -import world_pic from '../../resource/world.jpg'; - -const { Text,Title,Paragraph } = Typography; -const data = [ - { - title: '随想', - description: -
- :当浏览网页查找资料的时候,通过自己编写的插件,将网址和title保存到这里,方便之后查找,搜索,将各种随便化的信息集中起来,类似于软件 - Pocket的功能 - -
- - }, - { - title: '文章', - description: ':会不时总结自己认为有价值的问题。' - }, - { - title: 'Github', - description: ':欢迎一次合作完成项目,或对项目提出建议' - }, - { - title: '微博', - description: ':欢迎互粉,点赞,评论,@' - }, - { - title: '留言', - description: ':有什么话想说都可以写在这里' - } - ]; -class Home extends Component{ - render(){ - return ( -
- -

欢迎来到我的个人网站

- - 就职于格尔软件西安分公司 - 西北农林科技大学 16年毕业 (985院校) - 陕西 西安 高新区 - ximouzhao@foxmail.com - - 各种球类运动,打游戏,写代码,探讨人生... - - -
- -

本站相关技术:

- 本站技术栈:React + antd + springboot + mysql - - 前台代码同步Github:knowme_front - - 后台代码同步Github:knowme_background - - 全部使用markdown语法来进行文章的编写,包括留言,致谢react-markdown项目 - - -

功能介绍:

- ( -
- - {item.title} - {item.description} - -
- )} - /> -
- -

开发进度:

- - }> - 待办事项: -
1.登录管理,需要支持Github登录 -
2.文章支持锚点 -
3.显示文章阅读数 -
4.点赞评论功能 -
- 前台搜索功能 - 实现后台逻辑删除 - 实现滚动热加载 - 优化在移动端设备显示 - 实现后台新增文章的功能 - - 确定前台页面,增加后台管理页面 - - 编写前台页面 - 实现图片上传 - - 熟悉Ant Design 搭建前后台工程 - -
-
-
- ); - } -} - -export default Home; \ No newline at end of file diff --git a/src/App/Menu/MainLeftMenu.css b/src/App/Menu/MainLeftMenu.css deleted file mode 100644 index e69de29..0000000 diff --git a/src/App/Menu/MainLeftMenu.js b/src/App/Menu/MainLeftMenu.js deleted file mode 100644 index 930bba0..0000000 --- a/src/App/Menu/MainLeftMenu.js +++ /dev/null @@ -1,88 +0,0 @@ -import React,{Component} from 'react' -import { Menu, Icon ,Layout} from 'antd'; -import { BrowserRouter,Route,Link } from 'react-router-dom'; -import './MainLeftMenu.css'; - -const { SubMenu } = Menu; -class MainLeftMenu extends Component{ - // submenu keys of first level - rootSubmenuKeys = ['sub1', 'sub2', 'sub4']; - - state = { - openKeys: ['sub1'], - }; - - onOpenChange = openKeys => { - const latestOpenKey = openKeys.find(key => this.state.openKeys.indexOf(key) === -1); - if (this.rootSubmenuKeys.indexOf(latestOpenKey) === -1) { - this.setState({ openKeys }); - } else { - this.setState({ - openKeys: latestOpenKey ? [latestOpenKey] : [], - }); - } - }; - render(){ - return ( - - - - - - 主页 - - - - - - - - 随想 - - - - - - - - 文章 - - - - - - - - Github - - - - - - - - Weibo - - - - - - 留言 - - - - - - Search - - - - - ); - } -} -export default MainLeftMenu; \ No newline at end of file diff --git a/src/App/MessageBoard/MessageBoard.css b/src/App/MessageBoard/MessageBoard.css deleted file mode 100644 index e028bcf..0000000 --- a/src/App/MessageBoard/MessageBoard.css +++ /dev/null @@ -1,34 +0,0 @@ -@import '~antd/dist/antd.css'; - -.messageBoard{ - /* background:url("resource/body_bg.jpg") no-repeat top center; */ - display: block; - text-align: center; - top:40px; -} -.messageBoard img { - display: block; - height: auto; - max-width: 100%; -} - -.editArea{ - background-color: #fff; - padding:30px; - box-shadow: 0 0 2px rgba(0,0,0,0.2); - border-radius:2px; -} - -code { - font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", - monospace; -} -.ant-upload-select-picture-card i { - font-size: 32px; - color: #999; -} - -.ant-upload-select-picture-card .ant-upload-text { - margin-top: 8px; - color: #666; -} \ No newline at end of file diff --git a/src/App/MessageBoard/MessageBoard.js b/src/App/MessageBoard/MessageBoard.js deleted file mode 100644 index 595fc17..0000000 --- a/src/App/MessageBoard/MessageBoard.js +++ /dev/null @@ -1,327 +0,0 @@ -import React, { Component } from 'react'; -import './MessageBoard.css'; -import { Input , Modal,Upload, message, Button, Icon,Alert ,Spin} from 'antd'; -import MessageList from './MessageList'; -import WrapFetch from '../../Tools/WrapFetch'; -import DocumentType from '../../Constant/DocumentType'; -import SparkMD5 from 'spark-md5'; -import InfiniteScroll from 'react-infinite-scroller'; - -function getBase64(file) { - return new Promise((resolve, reject) => { - const reader = new FileReader(); - reader.readAsDataURL(file); - reader.onload = () => resolve(reader.result); - reader.onerror = error => reject(error); - }); -} -class MessageBoard extends Component { - - //state状态 value值得是 - state ={ - txtValue:'', - list:[], - loading: false, - tip:'', - fileList: [], - uploading: false, - previewVisible: false, - previewImage: '', - picAddDisabled:false, - btnPublishDisabled:true, - modelVisible:false, - // start 滚动加载 - hasMore: true, - pageNum: 0, - pageSize: 20, - total: 0 - // end - }; - onRemove=(file)=>{ - this.setState(state => { - const index = state.fileList.indexOf(file); - const newFileList = state.fileList.slice(); - newFileList.splice(index, 1); - return { - fileList: newFileList, - }; - }); - } - isEmpty=(str)=>{ - if(str!== undefined&&str!==null && str.length!=0){ - return false; - }else{ - return true; - } - } - handleCancel = () => this.setState({ previewVisible: false }); - - handlePreview = async file => { - console.log(file); - //这里也是包装后的File类型,file.originFileObj是原生类型 - if (!file.url && !file.preview) { - file.preview = await getBase64(file.originFileObj); - } - this.setState({ - previewImage: file.url || file.preview, - previewVisible: true, - }); - }; - handleChange = ({ fileList }) =>{ - //这里的fileList是对File进行包装之后的类型,file.originFileObj是原生类型 - if(fileList.length>=9){ - this.setState({ fileList:fileList,picAddDisabled:true }); - }else{ - this.setState({ fileList:fileList,picAddDisabled:false }); - } - if(this.isEmpty(fileList)&&this.isEmpty(this.state.txtValue)){ - this.setState({btnPublishDisabled:true}); - }else{ - this.setState({btnPublishDisabled:false}); - } - } - beforeUpload=(file)=>{ - //这里的fileList是原生File类型 - const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'|| file.type === 'image/jpg'; - if (!isJpgOrPng) { - message.error('文件类型必须是 JPG或者PNG !'); - } - const isLt2M = file.size / 1024 / 1024 < 10; - if (!isLt2M) { - message.error('图像大小必须小于10MB!'); - } - let filename=file.name; - let markdownUseFileName=filename; - //markdwown需要转义一些字符 - let parseArr={ - "\\\\":"\\","\\`":"`", - "\\*":"*","\\_":"_", - "\\{":"{","\\}":"}", - "\\[":"[","\\]":"]", - "\\(":"(","\\)":")", - "\\#":"#","\\+":"+", - "\\-":"-","\\!":"!" - }; - for(let key in parseArr){ - let reg=new RegExp(key,"g"); - markdownUseFileName=markdownUseFileName.replace(reg,"\\"+parseArr[key]); - } - file.markdownUseFileName=markdownUseFileName; - //let fileList=this.state.fileList; - if (!file.url ){ - //let spark = new SparkMD5(); - const reader = new FileReader(); - reader.readAsBinaryString(file); - reader.onload = function(e){ - file.fileMd5=SparkMD5.hashBinary(e.target.result); - } - } - - return false; - } - handleUpload = async (fileList) => { - const formData = new FormData(); - //formData.append('file', fileList[0].originFileObj); - fileList.forEach(file => { - formData.append('files', file.originFileObj); - }); - - this.setState({ - uploading: true, - }); - await fetch('/api/file/upload', { - method: 'post', - body: formData, - }).then(response => response.json()) - .then((data) => { - this.setState({ - fileList: [], - uploading: false, - btnPublishDisabled:true, - }); - //message.success('图片上传成功'); - return "success"; - }).catch((err)=>{ - this.setState({ - uploading: false, - }); - // message.error('上传图片失败'); - return "fail"; - }); - }; - saveDocument=async (fileList,txtValue)=>{ - console.log(DocumentType.MESSAGE); - let markdownPic=''; - fileList.forEach(file => { - markdownPic+="\n![" + file.markdownUseFileName + "](/api/files/" + file.originFileObj.fileMd5+file.name.substr(file.name.lastIndexOf('.')) + ")"; - }); - txtValue+=markdownPic; - let url=`/api/document/addDocument?type=${DocumentType.MESSAGE}&`+this.changeJSON2QueryString({content:txtValue}); - await fetch(url).then(res=>{ - //message.success('成功发表留言'); - this.setState({txtValue:''}); - }) - - }; - publishMessage=async ()=>{ - this.setState({btnPublishDisabled:true}); - const { fileList ,txtValue} = this.state; - this.setState({loading:true,tip:'正在上传图片...'}) - await this.handleUpload(fileList); - this.setState({tip:'正在保存留言...'}) - await this.saveDocument(fileList,txtValue); - this.setState({tip:'正在重新加载...'}) - await this.getFirstData(); - this.setState({loading:false}) - } - showModal =() => { - this.setState({ - modelVisible: true, - }); - }; - closeModal = () => { - this.setState({ - modelVisible: false, - }); - }; - - - changeJSON2QueryString(JSON){ - var temp = []; - for(var k in JSON){ - temp.push(k + "=" + encodeURIComponent(JSON[k])); - } - return temp.join("&"); - } - hanldleTextAreaChange=(event)=>{ - if(event && event.target){ - let txtValue=event.target.value; - this.setState(()=>({txtValue:txtValue})); - } - console.log(this.fileList); - console.log(this.state.txtValue); - if(this.isEmpty(this.fileList)&&this.isEmpty(event.target.value)){ - this.setState({btnPublishDisabled:true}); - }else{ - this.setState({btnPublishDisabled:false}); - } - }; - handleSaveButtonClick=(event)=>{ - console.log('button click'); - if(event && event.target ){ - this.publishMessage(); - } - }; - - async componentDidMount(){ - this.getFirstData(); - }; - getFirstData= ()=>{ - this.setState({loading:true,tip:'正在加载留言...'}) - WrapFetch.get( - { - url: `/api/document/findByPageAndType`, - queryParam: { type: DocumentType.MESSAGE, page: 0, pageSize: this.state.pageSize } - } - ).then( - (data) => { - this.setState({ list: data.content, total: data.totalElements, hasMore: data.totalPages > 1, loading: false }); - } - ); - } - // 获取下一页信息 - getMore = (page) => { - console.log("getmore",page) - if (this.state.total === this.state.list.length) { - return; - } - this.setState({ - pageNum: page - }, () => { - this.getMoreData(page); //请求数据接口 - }); - } - getMoreData = (page) => { - WrapFetch.get( - { - url: `/api/document/findByPageAndType`, - queryParam: { type: DocumentType.MESSAGE, page: page, pageSize: this.state.pageSize } - } - ).then( - (data) => { - this.setState({ list: this.state.list.concat(data.content), total: data.totalElements, hasMore: data.totalPages > page+1}); - } - ); - }; - render() { - const { TextArea } = Input; - - const uploadButton = ( -
- -
添加图片
-
- ); - const tip = ( -
- -
- ); - //const { imageUrl } = this.state; - const { previewVisible, previewImage, fileList,picAddDisabled, btnPublishDisabled} = this.state; - return ( - -
-
-