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
Plain Diff
Browse Files
Authored by
yyq
6 years ago
Commit
0fbcff064e8539b1673b6c261057c8e70dee00fe
2 parents
c7a89212
ecf5876d
Merge branch 'master' of git.yoho.cn:fe/yoho-community-web
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
5 deletions
apps/components/layouts/recycle-list.vue
apps/pages/article/article-share.vue
apps/pages/article/topic.vue
apps/store/article/mutations.js
apps/utils/image-handler.js
apps/components/layouts/recycle-list.vue
View file @
0fbcff0
...
...
@@ -179,6 +179,7 @@ export default {
if (reload) {
this.noMore = false;
this.list = [];
this.items = [];
}
this.loadings.push('pending');
this.onFetch().then((res) => {
...
...
apps/pages/article/article-share.vue
View file @
0fbcff0
...
...
@@ -2,6 +2,7 @@
<Article
ref="article"
type="article"
:thumbs="articleThumbList"
share
:on-fetch="onFetch">
</Article>
...
...
@@ -12,7 +13,7 @@ import {get} from 'lodash';
import Article from './components/article/article';
import ArticleItem from './components/article/article-item';
import {createNamespacedHelpers} from 'vuex';
const {mapActions} = createNamespacedHelpers('article');
const {map
State, map
Actions} = createNamespacedHelpers('article');
export default {
name: 'ArticleSharePage',
...
...
@@ -31,6 +32,21 @@ export default {
this.init();
}
},
async serverPrefetch() {
const articleId = parseInt(this.id, 10);
if (!articleId) {
return;
}
return this.fetchArticleList({
articleId,
limit: 2,
thumb: true
});
},
computed: {
...mapState(['articleThumbList'])
},
methods: {
...mapActions(['fetchArticleList']),
init() {
...
...
apps/pages/article/topic.vue
View file @
0fbcff0
...
...
@@ -21,7 +21,7 @@ export default {
page: 1,
labelId: 0,
reload: true,
labelName: ''
labelName: ''
,
};
},
created() {
...
...
@@ -32,6 +32,7 @@ export default {
if (+this.$route.params.labelId !== this.labelId) {
this.labelId = +this.$route.params.labelId;
this.labelName = this.$route.params.labelName;
this.reload = true;
this.init();
}
},
...
...
@@ -67,10 +68,11 @@ export default {
articles: result.data.detailList
});
return new Promise(resolve => {
if (this.
page === 2
) {
if (this.
reload
) {
setTimeout(() => {
resolve(result.data.detailList);
}, 200);
this.reload = false;
} else {
resolve(result.data.detailList);
}
...
...
apps/store/article/mutations.js
View file @
0fbcff0
...
...
@@ -56,7 +56,7 @@ function setArticleList(state, data, type, thumb) {
let
{
width
,
height
}
=
getArticleImageSize
({
width
:
img
.
width
,
height
:
img
.
height
,
MIN_SCALE
:
inx
===
0
?
(
3
/
4
)
:
void
0
MIN_SCALE
:
inx
===
0
?
(
3
/
4
)
:
0
});
img
.
width
=
parseInt
(
width
,
10
);
...
...
apps/utils/image-handler.js
View file @
0fbcff0
const
MAX_WIDTH
=
750
;
export
function
getArticleImageSize
({
width
,
height
,
MIN_SCALE
})
{
export
function
getArticleImageSize
({
width
,
height
,
MIN_SCALE
=
0.75
})
{
width
=
+
width
;
height
=
+
height
;
if
(
width
>
MAX_WIDTH
)
{
...
...
Please
register
or
login
to post a comment