thread create

This commit is contained in:
satori 2022-01-31 02:34:36 +08:00
parent 3686e682f6
commit 3c261aa690
5 changed files with 70 additions and 16 deletions

View File

@ -2,7 +2,8 @@
.post-list .post-list
ul(v-if="data.length") ul(v-if="data.length")
li(v-for="item in data", :key="item._id") li(v-for="item in data", :key="item._id")
NuxtLink.avatar(:to="`/user/${item.user._id}`") NuxtLink(:to="`/user/${item.user._id}`")
img.avatar(:src="item.user.avatar")
.content .content
.title {{ item.user.name }} .title {{ item.user.name }}
.info .info

View File

@ -2,7 +2,8 @@
.thread-list .thread-list
ul(v-if="data.length") ul(v-if="data.length")
li(v-for="item in data", :key="item._id") li(v-for="item in data", :key="item._id")
NuxtLink.avatar(:to="'/user/' + item.user._id") NuxtLink(:to="'/user/' + item.user._id")
img.avatar(:src="item.user.avatar")
NuxtLink.content(:to="'/thread/' + item._id") NuxtLink.content(:to="'/thread/' + item._id")
.title {{ item.title }} .title {{ item.title }}
.info .info

View File

@ -11,7 +11,7 @@
span 最新 span 最新
span 精华 span 精华
.expnone .expnone
nuxt-link.thread-create(to="/thread/create") 发新帖 nuxt-link.create-thread(to="/thread/create") 新议题
.content .content
ThreadList(:data="data") ThreadList(:data="data")
aside aside
@ -58,12 +58,12 @@ export default {
.content .content
padding: 1rem padding: 1rem
.thread-create a.create-thread
border: none border: none
border-radius: .25rem border-radius: .25rem
padding: .5rem 1rem padding: .5rem 1rem
background-color: #007bff background-color: #007bff
color: #ffffff color: #ffffff !important
display: block display: block
.bbs-title .bbs-title

View File

@ -13,7 +13,7 @@
p {{ thread.data }} p {{ thread.data }}
PostList(:data="postlist") PostList(:data="postlist")
.post-create(v-if="account.online") .post-create(v-if="account.online")
.avatar img.avatar(:src="account.avatar")
.content .content
textarea(v-model="post.data", rows="12") textarea(v-model="post.data", rows="12")
button.submit(@click="createpost") 发表 button.submit(@click="createpost") 发表
@ -112,4 +112,5 @@ export default {
background-color: #cc1414 background-color: #cc1414
font-weight: 600 font-weight: 600
min-width: 6rem min-width: 6rem
cursor: pointer
</style> </style>

View File

@ -1,19 +1,28 @@
<template lang="pug"> <template lang="pug">
.thread-create .thread-create
.header .header
.background h1.title {{ thread.title }}
.info info
//span.user {{ thread.user.name }}
//span.date {{ rwdate(thread.createdAt) }}
//span.view {{ thread.views }}
.tags
span.tag test
span.tag demo
.content.main-width .content.main-width
input.title(v-model="thread.title") p {{ thread.data }}
textarea.data(v-model="thread.data") .content.main-width
button.submit(@click="submit") 发表x input.title(v-model="thread.title")
textarea.data(v-model="thread.data", rows="32")
button.submit(@click="submit") 发表
</template> </template>
<script> <script>
export default { export default {
data: () => ({ data: () => ({
thread: { thread: {
title: "", title: "Default Name",
data: "", data: "Default Data",
}, },
}), }),
methods: { methods: {
@ -30,9 +39,51 @@ export default {
</script> </script>
<style lang="sass"> <style lang="sass">
.card
margin: 1rem .5rem
border-radius: .5rem
overflow: hidden
background-color: #ffffff
box-shadow: 0 6px 22px 0 rgba(0,0,0,.08)
.thread-create .thread-create
.title .header
display: block padding: 1rem
.data border-bottom: 1px solid #ccc
display: block background-color: rgba(0, 0, 0, .5)
text-align: center
height: 200px
.title
display: block
.content
padding: 1rem
background: #ffffff
position: relative
top: -4rem
border-radius: .5rem
textarea.data
display: block
width: 100%
padding: 1rem
border: 1px solid #eee
box-sizing: border-box
input.title
display: block
width: 100%
padding: 1rem
border: 1px solid #eee
box-sizing: border-box
margin-bottom: .5rem
font-weight: 600
font-size: 1.2rem
button.submit
background: #14cc22
color: #ffffff
border-radius: .25rem
border: none
padding: .5rem 2rem
margin: 1rem 0
.bbs-title
font-size: 1.2rem
font-weight: 600
</style> </style>