下载地址:https://pan38.com/share.php?code=d759U 提取码:8888
抖音评论截图生成器的完整实现代码,包含HTML、CSS和JavaScript,可以模拟生成抖音风格的评论截图。
index.html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>抖音评论生成器</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="screenshot-container" id="screenshotArea">
<div class="douyin-header">
<div class="back-btn">←</div>
<div class="title">评论</div>
</div>
<div class="comment-list" id="commentList">
<!-- 评论将在这里动态生成 -->
</div>
<div class="comment-input-area">
<input type="text" placeholder="说点什么..." id="commentInput">
<button id="addCommentBtn">发送</button>
</div>
</div>
<div class="control-panel">
<h2>评论生成器</h2>
<div class="form-group">
<label>昵称:</label>
<input type="text" id="nicknameInput" placeholder="输入昵称">
</div>
<div class="form-group">
<label>评论内容:</label>
<textarea id="contentInput" placeholder="输入评论内容"></textarea>
</div>
<div class="form-group">
<label>点赞数:</label>
<input type="number" id="likeCountInput" value="0" min="0">
</div>
<button id="generateBtn">生成评论</button>
<button id="randomBtn">随机生成</button>
<button id="downloadBtn">下载截图</button>
<button id="clearBtn">清空评论</button>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
style.css
```body {
font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
margin: 0;
padding: 0;
background-color: #f5f5f5;
}
.container {
display: flex;
max-width: 1200px;
margin: 20px auto;
gap: 20px;
}
.screenshot-container {
width: 375px;
height: 667px;
background-color: #fff;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
position: relative;
}
.douyin-header {
height: 44px;
background-color: #fff;
display: flex;
align-items: center;
padding: 0 15px;
border-bottom: 1px solid #eee;
position: relative;
}
.back-btn {
font-size: 20px;
font-weight: bold;
}
.title {
position: absolute;
left: 50%;
transform: translateX(-50%);
font-weight: bold;
}
.comment-list {
height: calc(100% - 104px);
overflow-y: auto;
padding: 10px;
}
.comment-item {
margin-bottom: 15px;
display: flex;
}
.avatar {
width: 36px;
height: 36px;
border-radius: 50%;
background-color: #eee;
margin-right: 10px;
flex-shrink: 0;
}
.comment-content {
flex-grow: 1;
}
.nickname {
font-weight: bold;
font-size: 14px;
margin-bottom: 5px;
}
.content {
font-size: 15px;
line-height: 1.4;
margin-bottom: 5px;
}
.like-count {
font-size: 12px;
color: #999;
display: flex;
align-items: center;
}
.like-count::before {
content: "♥";
margin-right: 3px;
color: #999;
}
.comment-input-area {
position: absolute;
bottom: 0;
width: 100%;
height: 60px;
background-color: #fff;
border-top: 1px solid #eee;
display: flex;
align-items: center;
padding: 0 15px;
box-sizing: border-box;
}
.comment-input-area input {
flex-grow: 1;
height: 36px;
border: 1px solid #eee;
border-radius: 18px;
padding: 0 15px;
outline: none;
}
.comment-input-area button {
margin-left: 10px;
background-color: #fe2c55;
color: white;
border: none;
border-radius: 4px;
padding: 8px 12px;
cursor: pointer;
}
.control-panel {
flex-grow: 1;
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.control-panel h2 {
margin-top: 0;
color: #333;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
.form-group input,
.form-group textarea {
width: 100%;
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
box-sizing: border-box;
}
.form-group textarea {
height: 100px;
resize: vertical;
}
button {
background-color: #fe2c55;
color: white;
border: none;
border-radius: 4px;
padding: 10px 15px;
cursor: pointer;
margin-right: 10px;
margin-bottom: 10px;
}
button:hover {
background-color: #e61e4d;
}
```