Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-community-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
陈峰
6 years ago
Commit
488146c55c1e03c514243c14ce470086ee4fb24c
1 parent
3caaa71b
commit
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
77 additions
and
26 deletions
apps/components/layouts/recycle-list.vue
apps/pages/article/article.vue
apps/pages/article/components/article/article-item-intro.vue
apps/pages/article/index.js
apps/pages/article/topic.vue
apps/store/article/actions.js
apps/store/article/mutations.js
apps/store/article/types.js
apps/store/user/types.js
config/api-map.js
apps/components/layouts/recycle-list.vue
View file @
488146c
...
...
@@ -158,13 +158,14 @@ export default {
getItems(reload) {
this.loadings.push('pending');
this.onFetch().then((res) => {
if (reload) {
this.list = [];
this.items = [];
}
/* istanbul ignore if */
if (!res) {
this.noMore = true;
this.loadings.pop();
} else if (reload) {
this.list = res;
this.items = [];
} else {
this.list = this.list.concat(res);
}
...
...
apps/pages/article/article.vue
View file @
488146c
...
...
@@ -14,18 +14,26 @@ export default {
data() {
return {
page: 1,
id: 0
id: 0,
authorUid: 0,
authorType: 0,
type: ''
};
},
created() {
this.id = this.$route.params.id;
this.authorUid = this.$route.query.authorUid;
this.authorType = this.$route.query.authorType;
this.type = this.$route.query.type;
},
beforeRouteUpdate(to, from, next) {
if (this.$route.params.id !== to.params.id) {
this.id = to.params.id;
activated() {
if (this.$route.params.id !== this.id) {
this.id = this.$route.params.id;
this.authorUid = this.$route.query.authorUid;
this.authorType = this.$route.query.authorType;
this.type = this.$route.query.type;
this.init();
}
next();
},
computed: {
...mapState(['articleList']),
...
...
@@ -51,7 +59,10 @@ export default {
}
const result = await this.fetchArticleList({
articleId,
page: this.page
page: this.page,
authorUid: this.authorUid,
authorType: this.authorType,
type: this.type
});
if (result.code === 200) {
...
...
apps/pages/article/components/article/article-item-intro.vue
View file @
488146c
<template>
<div class="article-item-intro">
<div ref="intro" class="intro hover-opacity" :class="introClass" :style="introStyle" @click="onExpand">
<div ref="intro"
v-if="intro"
class="intro hover-opacity" :class="introClass" :style="introStyle" @click="onExpand">
{{intro}}
<span class="expand" v-if="!isExpand && isEllipsis">…展开</span>
<span class="expand collapse" v-if="isExpand && isEllipsis">收起</span>
...
...
apps/pages/article/index.js
View file @
488146c
...
...
@@ -9,6 +9,9 @@ export default [{
path
:
'/topic/:labelId'
,
name
:
'topic'
,
component
:
()
=>
import
(
/* webpackChunkName: "article" */
'./topic'
),
meta
:
{
keepAlive
:
true
}
},
{
path
:
'/article/:articleId/comment'
,
name
:
'article.comment'
,
...
...
apps/pages/article/topic.vue
View file @
488146c
...
...
@@ -23,7 +23,6 @@ export default {
},
activated() {
if (this.$route.params.labelId !== this.labelId) {
console.log('activated init');
this.labelId = this.$route.params.labelId;
this.init();
}
...
...
apps/store/article/actions.js
View file @
488146c
...
...
@@ -3,12 +3,23 @@ import { get } from 'lodash';
import
*
as
guangProcess
from
'./guangProcess'
;
export
default
{
async
fetchArticleList
({
commit
},
{
articleId
,
limit
=
5
,
page
=
1
})
{
commit
(
Types
.
FETCH_ARTICLE_DETAIL_REQUEST
);
const
result
=
await
this
.
$api
.
get
(
'/api/grass/columnArticleDetail'
,
{
async
fetchArticleList
({
commit
},
{
articleId
,
authorUid
,
authorType
,
type
,
limit
=
5
,
page
=
1
})
{
commit
(
Types
.
FETCH_ARTICLE_LIST_REQUEST
);
let
api
;
if
(
type
===
'fav'
)
{
api
=
'/api/grass/userFavouriteArticleDetail'
;
}
else
if
(
type
===
'publish'
)
{
api
=
'/api/grass/userPublishedArticleDetail'
;
}
else
{
api
=
'/api/grass/columnArticleDetail'
;
}
const
result
=
await
this
.
$api
.
get
(
api
,
{
articleId
,
limit
,
page
,
authorUid
,
authorType
,
columnType
:
1001
});
...
...
@@ -16,12 +27,12 @@ export default {
if
(
!
result
.
data
.
detailList
)
{
result
.
data
.
detailList
=
[];
}
commit
(
Types
.
FETCH_ARTICLE_
DETAIL
_SUCCESS
,
{
commit
(
Types
.
FETCH_ARTICLE_
LIST
_SUCCESS
,
{
data
:
result
.
data
.
detailList
,
page
});
}
else
{
commit
(
Types
.
FETCH_ARTICLE_
DETAIL
_FAILD
);
commit
(
Types
.
FETCH_ARTICLE_
LIST
_FAILD
);
}
return
result
;
},
...
...
apps/store/article/mutations.js
View file @
488146c
...
...
@@ -3,10 +3,10 @@ import {getArticleImageSize} from 'utils/image-handler';
import
{
get
,
first
}
from
'lodash'
;
export
default
{
[
Types
.
FETCH_ARTICLE_
DETAIL
_REQUEST
](
state
)
{
[
Types
.
FETCH_ARTICLE_
LIST
_REQUEST
](
state
)
{
state
.
fetchArticleList
=
true
;
},
[
Types
.
FETCH_ARTICLE_
DETAIL
_SUCCESS
](
state
,
{
data
,
page
})
{
[
Types
.
FETCH_ARTICLE_
LIST
_SUCCESS
](
state
,
{
data
,
page
})
{
state
.
fetchArticleList
=
false
;
if
(
page
===
1
)
{
state
.
articleList
=
[];
...
...
@@ -31,7 +31,7 @@ export default {
});
});
},
[
Types
.
FETCH_ARTICLE_
DETAIL
_FAILD
](
state
)
{
[
Types
.
FETCH_ARTICLE_
LIST
_FAILD
](
state
)
{
state
.
fetchArticleList
=
false
;
},
[
Types
.
FETCH_ARTICLE_PRODUCT_SUCCESS
](
state
,
{
articles
,
favs
,
articleProductType
})
{
...
...
apps/store/article/types.js
View file @
488146c
export
const
FETCH_ARTICLE_DETAIL_REQUEST
=
'FETCH_ARTICLE_DETAIL_REQUEST'
;
export
const
FETCH_ARTICLE_DETAIL_FAILD
=
'FETCH_ARTICLE_DETAIL_FAILD'
;
export
const
FETCH_ARTICLE_DETAIL_SUCCESS
=
'FETCH_ARTICLE_DETAIL_SUCCESS'
;
export
const
FETCH_ARTICLE_LIST_REQUEST
=
'FETCH_ARTICLE_LIST_REQUEST'
;
export
const
FETCH_ARTICLE_LIST_FAILD
=
'FETCH_ARTICLE_LIST_FAILD'
;
export
const
FETCH_ARTICLE_LIST_SUCCESS
=
'FETCH_ARTICLE_LIST_SUCCESS'
;
export
const
FETCH_ARTICLE_MINE_LIST_REQUEST
=
'FETCH_ARTICLE_MINE_LIST_REQUEST'
;
export
const
FETCH_ARTICLE_MINE_LIST_FAILD
=
'FETCH_ARTICLE_MINE_LIST_FAILD'
;
export
const
FETCH_ARTICLE_MINE_LIST_SUCCESS
=
'FETCH_ARTICLE_MINE_LIST_SUCCESS'
;
export
const
FETCH_ARTICLE_PRODUCT_SUCCESS
=
'FETCH_ARTICLE_PRODUCT_SUCCESS'
;
...
...
apps/store/user/types.js
View file @
488146c
export
const
FETCH_ARTICLE_DETAIL_REQUEST
=
'FETCH_ARTICLE_DETAIL_REQUEST'
;
export
const
FETCH_ARTICLE_DETAIL_FAILD
=
'FETCH_ARTICLE_DETAIL_FAILD'
;
export
const
FETCH_ARTICLE_DETAIL_SUCCESS
=
'FETCH_ARTICLE_DETAIL_SUCCESS'
;
\ No newline at end of file
export
const
FETCH_ARTICLE_LIST_REQUEST
=
'FETCH_ARTICLE_LIST_REQUEST'
;
export
const
FETCH_ARTICLE_LIST_FAILD
=
'FETCH_ARTICLE_LIST_FAILD'
;
export
const
FETCH_ARTICLE_LIST_SUCCESS
=
'FETCH_ARTICLE_LIST_SUCCESS'
;
\ No newline at end of file
...
...
config/api-map.js
View file @
488146c
...
...
@@ -194,5 +194,27 @@ module.exports = {
params
:
{
productIds
:
{
type
:
String
},
}
}
},
'/api/grass/userPublishedArticleDetail'
:
{
api
:
'app.grass.userPublishedArticleDetail'
,
auth
:
true
,
params
:
{
page
:
{
type
:
Number
,
require
:
false
},
limit
:
{
type
:
Number
,
require
:
false
},
articleId
:
{
type
:
Number
},
authorUid
:
{
type
:
Number
},
authorType
:
{
type
:
Number
},
}
},
'/api/grass/userFavouriteArticleDetail'
:
{
api
:
'app.grass.userFavouriteArticleDetail'
,
auth
:
true
,
params
:
{
page
:
{
type
:
Number
,
require
:
false
},
limit
:
{
type
:
Number
,
require
:
false
},
articleId
:
{
type
:
Number
},
authorUid
:
{
type
:
Number
},
authorType
:
{
type
:
Number
},
}
},
};
...
...
Please
register
or
login
to post a comment