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) }} span {{ rwdate(item.updatedAt) }}
div(v-html="markdown(item.data)") div(v-html="markdown(item.data)")
.options .options
i.fas.fa-eraser(v-if="account.gid === 1 || account.uid === item.uid") i.fas.fa-eraser(
i.fas.fa-marker(v-if="account.gid === 1 || account.uid === item.uid") v-if="account.gid === 1 || account.uid === item.uid",
i.fas.fa-heart(:class="{ like: item.like }", @click="like(item._id)") @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) 没有评论~ .post-none(v-else) 没有评论~
</template> </template>
@ -87,9 +96,21 @@ export default {
markdown(data) { markdown(data) {
return marked.parse(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 }; let data = { attach: "post", aid: _id };
console.log(data);
this.$axios.post("/api/like", data).then((res) => { this.$axios.post("/api/like", data).then((res) => {
if (res.status === 200) { if (res.status === 200) {
this.data.forEach((item) => { 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> </script>

View File

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

View File

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

View File

@ -1,4 +1,34 @@
<template lang="pug"> <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 Nuxt
footer.footer
p
b Kana
.github
a(href="https://github.com/InvisibleFuture/kana")
span.fab.fa-github
</template> </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 // i.fas.fa-magic
// | Editor // | Editor
PostList(:data="postlist") PostList(:data.sync="postlist")
.post-create(v-if="account.online") .post-create(v-if="account.online")
img.avatar(:src="account.avatar") img.avatar(:src="account.avatar")
.content .content

View File

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

View File

@ -4,10 +4,12 @@
img.avatar(:src="user.avatar") img.avatar(:src="user.avatar")
h1 h1
span.name {{ user.name }} 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 .content
p USER ModelBoxNone
p {{ user }} p 没有公开的资源..
//p {{ user }}
</template> </template>
<script> <script>
@ -36,4 +38,14 @@ export default {
overflow: hidden overflow: hidden
.name .name
color: #ffffff 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> </style>