Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Commit

Permalink
fix: 修复圈子帖子无法打开的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
mutoe committed Jun 20, 2018
1 parent 7162fbe commit ab27025
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/components/FeedCard/GroupFeedCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export default {
this.$router.push(`/groups/${this.feed.group.id}/posts/${this.feed.id}`);
},
handleLike() {
console.log(3242);
const method = this.liked ? "delete" : "post";
const url = `/plus-group/group-posts/${this.feed.id}/likes`;
if (this.fetching) return;
Expand Down
7 changes: 6 additions & 1 deletion src/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ export const time2tips = date => {
if (offset < 3600) return `${~~(offset / 60)}分钟前`;
if (offset < 3600 * 24) return `${~~(offset / 3600)}小时前`;
// 根据 time 获取到 "16:57"
const timeStr = new Date(time).toTimeString().match(/^\d{2}:\d{2}/)[0];
let timeStr;
try {
timeStr = new Date(time).toTimeString().match(/^\d{2}:\d{2}/)[0];
} catch (e) {
return offset;
}
if (offset < 3600 * 24 * 2) return `昨天 ${timeStr}`;
if (offset < 3600 * 24 * 9) return `${~~(offset / 3600 / 24)}天前 ${timeStr}`;
// 根据 time 获取到 "2018/6/19 16:57:39" 然后正则转化为 6-19 16:57
Expand Down
2 changes: 1 addition & 1 deletion src/page/group/GroupDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export default {
if (this.fetchFeeding) return;
this.fetchFeeding = true;
const offset = more ? this.pinneds.length + this.posts.length : 0;
getGroudFeedsByType(this.groupID, this.screen, 3, offset).then(
getGroudFeedsByType(this.groupID, this.screen, 10, offset).then(
({ pinneds = [], posts = [] }) => {
this.posts = more ? [...this.posts, ...posts] : posts;
this.pinneds = more ? [...this.pinneds, ...pinneds] : pinneds;
Expand Down
4 changes: 4 additions & 0 deletions src/page/group/GroupPostDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ export default {
);
}
},
created() {
this.fetchFeed();
},
methods: {
/**
* 收藏
Expand Down Expand Up @@ -124,6 +127,7 @@ export default {
.get(`/plus-group/groups/${this.groupID}/posts/${this.feedID}`)
.then(({ data = {} }) => {
this.feed = { ...data };
this.user = this.feed.user;
this.oldID = this.feedID;
this.fetching = false;
this.fetchFeedComments();
Expand Down

0 comments on commit ab27025

Please sign in to comment.