This commit is contained in:
satori 2022-02-24 16:45:45 +08:00
parent db626f019e
commit 53f36433d7
8 changed files with 170 additions and 23 deletions

View File

@ -0,0 +1,65 @@
<template lang="pug">
.model-box-none
.wrap
.cube
.front
.back
.left
.right
.top
.bottom
</template>
<style lang="sass">
.model-box-none
.wrap
height: 200px
margin-top: 80px
perspective: 1000px
perspective-origin: 50% 50%
border-radius: .5rem
.cube
position: relative
width: 8rem
height: 8rem
margin: 0 auto
transform-style: preserve-3d
animation: box 15s linear infinite
transform: rotateX(350deg) rotateY(350deg)
div
position: absolute
top: 0
left: 0
opacity: 0.8
width: 100%
height: 100%
font-size: 1.25rem
color: white
text-align: center
line-height: 200px
transition: transform .75s ease-in
.front
background: rgba(0, 0, 0, .05)
background-size: auto 100%
transform: translateZ(100px)
.back
background: rgba(0, 0, 0, .05)
background-size: auto 100%
transform: translateZ(-100px) rotateY(180deg)
.right
background: rgba(0, 0, 0, .05)
background-size: auto 100%
transform: rotateY(90deg) translateZ(100px)
.left
background: rgba(0, 0, 0, .05)
background-size: auto 100%
transform: rotateY(-90deg) translateZ(100px)
.top
background: rgba(0, 0, 0, .05)
background-size: auto 100%
transform: rotateX(90deg) translateZ(100px)
.bottom
background: rgba(0, 0, 0, .05)
background-size: auto 100%
transform: rotateX(-90deg) translateZ(100px)
</style>

View File

@ -10,9 +10,18 @@
span {{ rwdate(item.updatedAt) }}
div(v-html="markdown(item.data)")
.options
i.fas.fa-eraser(v-if="account.gid === 1 || account.uid === item.uid")
i.fas.fa-marker(v-if="account.gid === 1 || account.uid === item.uid")
i.fas.fa-heart(:class="{ like: item.like }", @click="like(item._id)")
i.fas.fa-eraser(
v-if="account.gid === 1 || account.uid === item.uid",
@click="remove(item._id)"
)
i.fas.fa-marker(
v-if="account.gid === 1 || account.uid === item.uid",
@click="remove(item._id)"
)
i.fas.fa-heart(
:class="{ like: item.like }",
@click="like(item._id, item.like)"
)
.post-none(v-else) 没有评论~
</template>
@ -87,9 +96,21 @@ export default {
markdown(data) {
return marked.parse(data);
},
like(_id) {
like(_id, en) {
if (en) {
return this.$axios
.delete("/api/like?attach=post&aid=" + _id)
.then((res) => {
if (res.status === 200) {
this.data.forEach((item) => {
if (item._id === _id) {
item.like = false;
}
});
}
});
}
let data = { attach: "post", aid: _id };
console.log(data);
this.$axios.post("/api/like", data).then((res) => {
if (res.status === 200) {
this.data.forEach((item) => {
@ -100,6 +121,16 @@ export default {
}
});
},
remove(_id) {
this.$axios.delete("/api/post/" + _id).then((res) => {
if (res.status === 200) {
this.$emit(
"update:data",
this.data.filter((item) => item._id !== _id)
);
}
});
},
},
};
</script>

View File

@ -4,7 +4,7 @@
.circumscription
.logo Kana
nav.navbar
NuxtLink.navbar-item(to="/") 论坛
NuxtLink.navbar-item(:to="{ path: '/' }") 论坛
NuxtLink.navbar-item(to="/docs") 文档
NuxtLink.navbar-item(to="/chat") 聊天室
//NuxtLink.navbar-item(to="/admin") admin
@ -114,14 +114,14 @@ footer.footer
.github
font-size: 2rem
.admin
position: relative
.admin::before
position: absolute
top: 0
right: 0
content: '演示'
width: 4rem
height: 2rem
background: #ff1414
//.admin
// position: relative
//.admin::before
// position: absolute
// top: 0
// right: 0
// content: ''
// width: 4rem
// height: 2rem
// background: #ff1414
</style>

View File

@ -7,6 +7,7 @@
.name {{ account.name }}
input#img_add(type="file", accept="image/*", @change="upload($event)")
// multiple="multiple",
input#bg(type="file", accept="image/*", @change="upload_bg($event)")
.content.main-width
p account
NuxtLink.button(to="/account/setting") 账户设置
@ -23,7 +24,15 @@ export default {
upload(event) {
let data = new FormData();
let option = { headers: { "Content-Type": "multipart/form-data" } };
data.append("img", event.target.files[0]);
data.append("avatar", event.target.files[0]);
this.$axios.post("/api/account", data, option).then((res) => {
console.log(res.data);
});
},
upload_bg(event) {
let data = new FormData();
let option = { headers: { "Content-Type": "multipart/form-data" } };
data.append("background", event.target.files[0]);
this.$axios.post("/api/account", data, option).then((res) => {
console.log(res.data);
});

View File

@ -1,4 +1,34 @@
<template lang="pug">
.thread-wwwwwww
.thread-index
.circumscription
//ModelBox
//p , , ,
.ceremony
.circumscription
ThreadList(:data="data")
ul
li 除去阅览以外, 还可以做一些什么
li 如翻页, 如发表
li
NuxtLink(to="/thread/create")
button 新议题
//NuxtLink(to="/index") NASAS
//NuxtLink(to="/index/hCG7UKzSRgCzyd8Y") |NASAS
Nuxt
footer.footer
p
b Kana
.github
a(href="https://github.com/InvisibleFuture/kana")
span.fab.fa-github
</template>
<script>
export default {
asyncData({ $axios }) {
return $axios.get("/api/thread").then((res) => {
return { data: res.data };
});
},
};
</script>

View File

@ -20,7 +20,7 @@ Drawer
//)
// i.fas.fa-magic
// | Editor
PostList(:data="postlist")
PostList(:data.sync="postlist")
.post-create(v-if="account.online")
img.avatar(:src="account.avatar")
.content

View File

@ -1,3 +1,3 @@
<template lang="pug">
.thread-index
</template>
</template>

View File

@ -4,10 +4,12 @@
img.avatar(:src="user.avatar")
h1
span.name {{ user.name }}
span.admin(v-if="user.gid === 1") Admin
span.admin(v-if="user.gid === 1")
i.fas.fa-user-shield
.content
p USER
p {{ user }}
ModelBoxNone
p 没有公开的资源..
//p {{ user }}
</template>
<script>
@ -36,4 +38,14 @@ export default {
overflow: hidden
.name
color: #ffffff
.admin
margin: 0 .5rem
font-size: 1.2rem
color: #ffffff
background: #ff9988
border-radius: .25rem
//padding: 0 .5rem
>.content
padding: 4rem
text-align: center
</style>