فهرست منبع

fix -> 修改列表内容

Young 1 سال پیش
والد
کامیت
02b6780dcd

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

@@ -238,7 +238,7 @@ class Header extends PureComponent {
 
     getMenu() {
         this.setState({loading: false});
-        axios.get('api/v1/menu/list', {
+        axios.get('/api/v1/menu/list', {
             params: {
                 page: 1,
                 size: 10

+ 2 - 2
src/components/Header/store/actionCreators.js

@@ -10,7 +10,7 @@ const changeCategory = (data) => ({
 
 export const getCategory = () => {
     return (dispatch) => {
-        axios.get('api/v1/category/list').then((res) => {
+        axios.get('/api/v1/category/list').then((res) => {
             if (res.code === 0) {
                 dispatch(changeCategory(res.data));
             }
@@ -33,7 +33,7 @@ export const getUser = () => {
 
 export const getConfing = () => {
     return (dispatch) => {
-        axios.get('api/v1/config/list').then((res) => {
+        axios.get('/api/v1/config/list').then((res) => {
             if (res.code === 0) {
                 const {data} = res;
                 data.forEach(item => {

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

@@ -104,7 +104,7 @@ class Archives extends PureComponent {
 
     getArchives() {
         this.setState({loading: true});
-        axios.get('api/v1/post/archive/list').then((res) => {
+        axios.get('/api/v1/post/archive/list').then((res) => {
             if (res.code === 0) {
                 this.setState({
                     list: res.data,

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

@@ -101,7 +101,7 @@ class Article extends PureComponent {
     }
 
     getSocials() {
-        axios.get('/social/social/v1/socials?code=reward').then((res) => {
+        axios.get('/api/v1/social/list?code=reward').then((res) => {
             if (res.code === 0) {
                 this.setState({
                     socialsList: res.data

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

@@ -51,7 +51,7 @@ class Category extends PureComponent {
 
     getList(current, id, override) {
         this.setState({loading: true});
-        axios.get('api/v1/post/list', {
+        axios.get('/api/v1/post/list', {
             params: {
                 current: current,
                 size: 10,

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

@@ -136,7 +136,7 @@ const mapDispatch = (dispatch) => {
     return {
         getBlogList(current, override) {
             dispatch({type: constants.LOADING_TRUE});
-            axios.get('api/v1/post/list', {
+            axios.get('/api/v1/post/list', {
                 params: {
                     current: current,
                     size: 10

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

@@ -95,7 +95,7 @@ class Links extends PureComponent {
 
     getLinks() {
         this.setState({loading: true});
-        axios.get('api/v1/link/map').then((res) => {
+        axios.get('/api/v1/link/map').then((res) => {
             let extra = res.data;
             let arrar = [];
             for (let i in extra) {

+ 16 - 9
src/pages/search/index.js

@@ -12,14 +12,14 @@ class Search extends PureComponent {
             key: props.match.params.key,
             finished: false,
             loading: true,
-            page: 1,
+            current: 1,
             list: []
         };
         this.getList = this.getList.bind(this);
     }
 
     render() {
-        const {list, page, finished, loading, key} = this.state;
+        const {list, current, finished, loading, key} = this.state;
         return (
             <SearchWrapper>
                 <div className='pattern-center-blank'/>
@@ -28,7 +28,7 @@ class Search extends PureComponent {
                         <h1 className="page-title">{`搜索结果:${key}`}</h1>
                     </header>
                     <CatList list={list}/>
-                    <PagInation page={page} id={key} finished={finished} loading={loading} getList={this.getList}/>
+                    <PagInation page={current} id={key} finished={finished} loading={loading} getList={this.getList}/>
                 </MainWrapper>
             </SearchWrapper>
         )
@@ -40,20 +40,27 @@ class Search extends PureComponent {
 
     getList(current, key, override) {
         this.setState({loading: true});
-        axios.get('api/v1/post/list', {
+        axios.get('/api/v1/post/list', {
             params: {
                 current: current,
                 size: 10,
-                keywords: key
+                keyword: key
             }
         }).then((res) => {
             if (res.code === 0) {
-                let current = res.data.current * res.data.size;
                 let total = res.data.total;
-                const data = res.data.records;
                 const Img = this.props.ListImg;
                 let arr = [];
-                data.forEach((item) => {
+
+                const {records = []} = res.data;
+                if (records == null) {
+                    this.setState({
+                        finished: true
+                    })
+                    return
+                }
+
+                records.forEach((item) => {
                     arr.push({
                         id: item.id,
                         title: item.title,
@@ -77,7 +84,7 @@ class Search extends PureComponent {
                     }
                 });
 
-                if (current > total) {
+                if ((res.data.current * res.data.size) > total) {
                     this.setState({
                         finished: true
                     })

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

@@ -70,7 +70,7 @@ class Tags extends PureComponent {
 
     getTags() {
         this.setState({loading: true});
-        axios.get('/tags/tags-article-quantity/v1/list').then((res) => {
+        axios.get('/api/v1/tag/stat/list').then((res) => {
             if (res.code === 0) {
                 this.setState({
                     list: res.data,

+ 7 - 8
src/pages/tags/list.js

@@ -17,14 +17,14 @@ class TagList extends PureComponent {
             timg: '',
             finished: false,
             loading: true,
-            page: 1,
+            current: 1,
             list: []
         };
         this.getList = this.getList.bind(this);
     }
 
     render() {
-        const {timg, list, page, finished, loading, id} = this.state;
+        const {timg, list, current, finished, loading, id} = this.state;
         return (
             <TagsWrapper>
                 <div className='pattern-center-blank'/>
@@ -38,7 +38,7 @@ class TagList extends PureComponent {
                 </TagsTop>
                 <MainWrapper>
                     <CatList list={list}/>
-                    <PagInation page={page} id={id} finished={finished} loading={loading} getList={this.getList}/>
+                    <PagInation page={current} id={id} finished={finished} loading={loading} getList={this.getList}/>
                 </MainWrapper>
             </TagsWrapper>
         )
@@ -51,21 +51,20 @@ class TagList extends PureComponent {
 
     getList(current, id, override) {
         this.setState({loading: true});
-        axios.get('api/v1/post/list', {
+        axios.get('/api/v1/post/list', {
             params: {
                 current: current,
                 size: 10,
-                postsTagsId: id
+                tagId: id
             }
         }).then((res) => {
             if (res.code === 0) {
-                let current = res.data.current * res.data.size;
+                let current = res.data.current;
                 let total = res.data.total;
                 const data = res.data.records;
                 const Img = this.props.ListImg;
                 let arr = [];
                 data.forEach((item) => {
-                    console.log(item)
                     arr.push({
                         id: item.id,
                         title: item.title,
@@ -89,7 +88,7 @@ class TagList extends PureComponent {
                     }
                 });
 
-                if (current > total) {
+                if ((current * res.data.size) > total){
                     this.setState({
                         finished: true
                     })