Skip to content

Commit

Permalink
调整样式,修复BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbbbbbbbbbbba committed Sep 12, 2019
1 parent 7ed3fb8 commit dedb9d2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 20 deletions.
4 changes: 2 additions & 2 deletions site/assets/styles/topic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
line-height: 24px;
color: #bbb;
margin-top: 3px;
display: flex;
// display: flex;

.meta-item {
span.meta-item {
font-size: 12px;

&:not(:last-child) {
Expand Down
12 changes: 6 additions & 6 deletions site/components/TopicList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@
</a>

<div class="topic-meta">
<div class="meta-item">
<span class="meta-item">
<a :href="'/user/' + topic.user.id">{{ topic.user.nickname }}</a>
</div>
<div class="meta-item">
</span>
<span class="meta-item">
{{ topic.lastCommentTime | prettyDate }}
</div>
<div class="meta-item">
</span>
<span class="meta-item">
<span v-for="tag in topic.tags" :key="tag.tagId" class="tag">
<a :href="'/topics/tag/' + tag.tagId + '/1'">{{ tag.tagName }}</a>
</span>
</div>
</span>
</div>
</div>
<div class="right">
Expand Down
44 changes: 32 additions & 12 deletions site/pages/topic/_id.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,32 @@
</a>

<div class="topic-meta">
<div class="meta-item">
<span class="meta-item">
<a :href="'/user/' + topic.user.id">{{ topic.user.nickname }}</a>
</div>
<div class="meta-item">
</span>
<span class="meta-item">
{{ topic.lastCommentTime | prettyDate }}
</div>
<div class="meta-item">
</span>
<span class="meta-item">
<span v-for="tag in topic.tags" :key="tag.tagId" class="tag">
<a :href="'/topics/tag/' + tag.tagId + '/1'">{{ tag.tagName }}</a>
</span>
</div>
<div class="meta-item act">
</span>
<span class="meta-item act">
<a @click="addFavorite(topic.topicId)">
<i class="iconfont icon-favorite" />&nbsp;{{ favorited ? '已收藏' : '收藏' }}
</a>
</div>
<div v-if="isOwner" class="meta-item act">
</span>
<span v-if="isOwner" class="meta-item act">
<a @click="deleteTopic(topic.topicId)">
<i class="iconfont icon-delete" />&nbsp;删除
</a>
</div>
<div v-if="isOwner" class="meta-item act">
</span>
<span v-if="isOwner" class="meta-item act">
<a :href="'/topic/edit/' + topic.topicId">
<i class="iconfont icon-edit" />&nbsp;修改
</a>
</div>
</span>
</div>
</div>
<div class="right">
Expand Down Expand Up @@ -196,6 +196,26 @@ export default {
console.error(e)
this.$toast.error('删除失败:' + (e.message || e))
}
},
async like(topic) {
try {
await this.$axios.get('/api/topic/like/' + topic.topicId)
topic.liked = true
topic.likeCount++
} catch (e) {
if (e.errorCode === 1) {
this.$toast.info('请登录后点赞!!!', {
action: {
text: '去登录',
onClick: (e, toastObject) => {
utils.toSignin()
}
}
})
} else {
this.$toast.error(e.message || e)
}
}
}
}
}
Expand Down

0 comments on commit dedb9d2

Please sign in to comment.