diff --git a/components/PostList.vue b/components/PostList.vue index 1ce4dc9..58bcd76 100644 --- a/components/PostList.vue +++ b/components/PostList.vue @@ -2,7 +2,7 @@ .post-list ul(v-if="data.length") li(v-for="item in data", :key="item._id") - .avatar + NuxtLink.avatar(:to="`/user/${item.user._id}`") .content .title {{ item.user.name }} .info diff --git a/components/ThreadList.vue b/components/ThreadList.vue index 3b2e91d..10e309c 100644 --- a/components/ThreadList.vue +++ b/components/ThreadList.vue @@ -2,14 +2,12 @@ .thread-list ul(v-if="data.length") li(v-for="item in data", :key="item._id") - NuxtLink(:to="'/thread/' + item._id") - .avatar - .content - .title {{ item.title }} - .info - span {{ item.user.name }} - span {{ item.createdAt }} - span {{ item.updatedAt }} + NuxtLink.avatar(:to="'/user/' + item.user._id") + NuxtLink.content(:to="'/thread/' + item._id") + .title {{ item.title }} + .info + span {{ item.user.name }} + span {{ rwdate(item.createdAt) }} .thread-none(v-else) 没有内容~ @@ -26,14 +24,13 @@ list-style: none padding: 0 margin: 0 - li a + li display: flex align-items: center border-radius: .5rem height: 48px margin: 0 padding: 8px 0 - color: #222222 .avatar width: 48px height: 48px @@ -41,18 +38,25 @@ border-radius: 50% overflow: hidden .content + flex: 1 .title font-size: 1.1rem font-weight: 600 .info span margin-right: .5rem - li a:hover + li:hover background: rgba(0, 0, 0, .025) \ No newline at end of file diff --git a/layouts/default.vue b/layouts/default.vue index 8fd4306..6a5e367 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -6,7 +6,7 @@ NuxtLink.navbar-item(to="/") 主页 .expnone .navbar-user(v-if="account.online") - span {{ account.name }} + NuxtLink.username(to="/account") {{ account.name }} .navbar-sign(v-else) NuxtLink.button(to="/account/signin") Signin NuxtLink.button(to="/account/create") Login @@ -84,12 +84,21 @@ header.header color: #fff .expnone flex: 1 + .username + color: #ffffff + font-weight: 600 footer.footer text-align: center margin: 4rem a text-decoration: none +a:link // 未访问的 + color: #222222 +a:visited + color: #223388 +a:active // 点击时 + color: #2233cc a.button border: none border-radius: .25rem diff --git a/pages/account/index.vue b/pages/account/index.vue new file mode 100644 index 0000000..b69ae6a --- /dev/null +++ b/pages/account/index.vue @@ -0,0 +1,72 @@ + + + + + diff --git a/pages/account/message.vue b/pages/account/message.vue new file mode 100644 index 0000000..edc42aa --- /dev/null +++ b/pages/account/message.vue @@ -0,0 +1,4 @@ + diff --git a/pages/account/setting.vue b/pages/account/setting.vue new file mode 100644 index 0000000..9de08f1 --- /dev/null +++ b/pages/account/setting.vue @@ -0,0 +1,8 @@ + diff --git a/pages/index.vue b/pages/index.vue index fe5b803..2a9b1a8 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -13,7 +13,6 @@ .expnone nuxt-link.thread-create(to="/thread/create") 发新帖 .content - p {{ data }} ThreadList(:data="data") aside .card diff --git a/pages/thread/_id.vue b/pages/thread/_id.vue index 1ca6190..6619ac3 100644 --- a/pages/thread/_id.vue +++ b/pages/thread/_id.vue @@ -4,8 +4,8 @@ h1.title {{ thread.title }} .info span.user {{ thread.user.name }} - span.date 2021-01-01 - span.view 1933 + span.date {{ rwdate(thread.createdAt) }} + span.view {{ thread.views }} .tags span.tag test span.tag demo @@ -40,6 +40,10 @@ export default { }, }, methods: { + rwdate(utc) { + let t = new Date(utc); + return t.getMonth() + 1 + "月 " + t.getDate() + ", " + t.getFullYear(); + }, loadpostlist() { this.$axios .get(`/api/post?attach=thread&aid=${this.post.aid}`) diff --git a/pages/user/_id.vue b/pages/user/_id.vue new file mode 100644 index 0000000..aaba2db --- /dev/null +++ b/pages/user/_id.vue @@ -0,0 +1,39 @@ + + + + +