Skip to content

Commit

Permalink
日常提交
Browse files Browse the repository at this point in the history
  • Loading branch information
yisar committed May 12, 2024
1 parent 1340df0 commit 2b8d1c2
Show file tree
Hide file tree
Showing 4 changed files with 272 additions and 269 deletions.
27 changes: 14 additions & 13 deletions fre/src/danmaku/danmaku.css
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
.comment {
.danmaku {
width: 420px;
position: relative;
margin-bottom: 80px;
}

.comment-item {
.danmaku-item {
box-sizing: border-box;
padding: 10px;
display: flex;
}

.comment-block{
.danmaku-block{
flex: 1;
}

.comment-item .avatar{
.danmaku-item .avatar{
margin: 0;
display: block;
padding: 5px 10px;
}

.comment-item p{
.danmaku-item p{
padding: 5px;
}

.comment-item p:nth-child(1){
.danmaku-item p:nth-child(1){
color: #ddd;
}

.comment-item p:nth-child(3){
.danmaku-item p:nth-child(3){
color: #888;
font-size: 12px;
}

.comment h1 {
.danmaku h1 {
font-weight: normal;
font-size: 12px!important;
color: #ddd!important;
padding: 10px;
}

.comment-item li {
.danmaku-item li {
display: flex;
align-items: center;
}

.comment-input {
.danmaku-input {
display: flex;
align-items: center;
padding: 20px;
Expand All @@ -57,7 +57,7 @@
box-sizing: border-box;
}

.comment-input input {
.danmaku-input input {
background: var(--primary-bg);
color: #fff;
height: 30px;
Expand All @@ -67,7 +67,8 @@
flex: 1;
}

.comment-input button {
.danmaku-input button {
background: var(--secondary);
position: absolute;
right: 20px;
height: 30px;
Expand All @@ -79,6 +80,6 @@
justify-content: center;
}

.comment-item ul {
.danmaku-item ul {
display: flex;
}
18 changes: 8 additions & 10 deletions fre/src/danmaku/danmaku.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { push } from '../use-route'
import { addDanmaku, getDanmakus, getUser } from '../util/api'
import './danmaku.css'

export default function Danmaku({ post,p }) {
export default function Danmaku({ post, p }) {
const [danmaku, setDanmaku] = useState('')
const [danmakus, setDanmakus] = useState([])
useEffect(() => {
Expand All @@ -21,9 +21,9 @@ export default function Danmaku({ post,p }) {
}
addDanmaku({
pid: post.id,
p: 0,
pos:0,
color:'#fffff',
p,
pos: 0,
color: '#fffff',
content: danmaku,
} as any).then((res: any) => {
alert(res.msg)
Expand All @@ -39,18 +39,16 @@ export default function Danmaku({ post,p }) {
{user.id ? <button onClick={submit}>发送</button> : <button onclick={() => push('/login')}>登录</button>}
</div>

<h1>共有{danmakus ? danmakus.length : 0}条讨论</h1>
<h1>共有{danmakus ? danmakus.length : 0}条弹幕</h1>


{danmakus && danmakus.map(item => {
//@ts-ignore
const time = dayjs(item.time).format('MM-DD-YYYY')
return <div className="danmaku-item">
<div className="danmaku-block">
<p><a href={`https://www.clicli.cc/danmaku/delete/${item.id}?token=${window.localStorage.getItem('token')}`} target="_blank"><del>#{item.id}</del></a></p>
<p>{item.content}</p>
<p>{time}</p>
</div>
<p><a href={`https://www.clicli.cc/danmaku/delete/${item.id}?token=${window.localStorage.getItem('token')}`} target="_blank"><del>#{item.id}</del></a></p>
<p className="danmaku-block">{item.content}</p>
<p>{time}</p>

</div>
})}
Expand Down

0 comments on commit 2b8d1c2

Please sign in to comment.