You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1363 lines
51 KiB
1363 lines
51 KiB
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
<title>青核 Youthome - 发布动态</title>
|
|
<link rel="stylesheet" href="../colors_and_type.css">
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
-webkit-tap-highlight-color: transparent;
|
|
}
|
|
|
|
body {
|
|
font-family: var(--youth-font-base);
|
|
background: var(--youth-bg-page);
|
|
color: var(--youth-text-primary);
|
|
margin: 0;
|
|
padding: 0;
|
|
overflow: hidden;
|
|
overflow-x: hidden;}
|
|
|
|
/* ===== 手机容器 ===== */
|
|
.phone-container {
|
|
width: 375px;
|
|
height: 812px;
|
|
margin: 0 auto;
|
|
background: var(--youth-bg-page);
|
|
position: relative;
|
|
overflow: hidden;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
/* ===== 状态栏 ===== */
|
|
.status-bar {
|
|
height: 36px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 0 16px;
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
color: var(--youth-text-primary);
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.status-bar .right-icons {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 5px;
|
|
}
|
|
|
|
/* ===== 顶部导航 ===== */
|
|
.nav-bar {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
height: 44px;
|
|
padding: 0 10px;
|
|
position: relative;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.nav-btn {
|
|
width: 28px;
|
|
height: 28px;
|
|
border-radius: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: var(--youth-bg-card);
|
|
border: 1px solid var(--youth-border-light);
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
color: var(--youth-text-primary);
|
|
box-shadow: 0 2px 6px rgba(0,0,0,0.04);
|
|
}
|
|
|
|
.nav-btn:active {
|
|
transform: scale(0.95);
|
|
}
|
|
|
|
.nav-btn svg {
|
|
width: 16px;
|
|
height: 16px;
|
|
}
|
|
|
|
.nav-title {
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
color: var(--youth-text-primary);
|
|
position: absolute;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
}
|
|
|
|
/* ===== 发布按钮 ===== */
|
|
.publish-btn {
|
|
padding: 5px 12px;
|
|
border-radius: 999px;
|
|
background: var(--youth-gradient-primary);
|
|
color: white;
|
|
font-size: 12px;
|
|
font-weight: 600;
|
|
border: none;
|
|
cursor: pointer;
|
|
position: relative;
|
|
overflow: hidden;
|
|
box-shadow: 0 2px 8px rgba(38, 194, 187, 0.3);
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.publish-btn::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
height: 50%;
|
|
background: linear-gradient(180deg, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0) 100%);
|
|
pointer-events: none;
|
|
}
|
|
|
|
.publish-btn:active {
|
|
transform: scale(0.96);
|
|
box-shadow: 0 2px 6px rgba(38, 194, 187, 0.25);
|
|
}
|
|
|
|
/* ===== 内容区 ===== */
|
|
.scroll-content {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
padding: 4px 16px 8px;
|
|
}
|
|
|
|
.scroll-content::-webkit-scrollbar { display: none; }
|
|
|
|
/* ===== 分段控件 - 实名/匿名 ===== */
|
|
.segmented-control {
|
|
position: relative;
|
|
display: flex;
|
|
background: var(--youth-secondary);
|
|
border-radius: 10px;
|
|
padding: 2px;
|
|
margin: 6px 0 3px;
|
|
box-shadow: var(--youth-inset-soft);
|
|
border: 1px solid var(--youth-border-light);
|
|
}
|
|
|
|
.segmented-control .segment {
|
|
flex: 1;
|
|
text-align: center;
|
|
padding: 5px 0;
|
|
font-size: 12px;
|
|
font-weight: 500;
|
|
color: var(--youth-muted-foreground);
|
|
cursor: pointer;
|
|
position: relative;
|
|
z-index: 1;
|
|
transition: color 0.3s ease;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
.segmented-control .segment.active {
|
|
color: white;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.segmented-control .segment-slider {
|
|
position: absolute;
|
|
top: 2px;
|
|
bottom: 2px;
|
|
width: calc(50% - 2px);
|
|
left: 2px;
|
|
background: var(--youth-gradient-primary);
|
|
border-radius: 8px;
|
|
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
box-shadow: 0 2px 6px rgba(38, 194, 187, 0.3);
|
|
}
|
|
|
|
.segmented-control .segment-slider::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
height: 50%;
|
|
background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
|
|
border-radius: 9px 9px 0 0;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.segmented-control.anonymous .segment-slider {
|
|
transform: translateX(100%);
|
|
}
|
|
|
|
/* ===== 匿名提示 ===== */
|
|
.anonymous-hint {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 3px;
|
|
font-size: 10px;
|
|
color: var(--youth-muted-foreground);
|
|
padding: 0 3px 4px;
|
|
opacity: 0;
|
|
max-height: 0;
|
|
overflow: hidden;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.anonymous-hint.show {
|
|
opacity: 1;
|
|
max-height: 20px;
|
|
padding-bottom: 4px;
|
|
}
|
|
|
|
/* ===== 正文输入区 ===== */
|
|
.content-input-area {
|
|
background: var(--youth-bg-card);
|
|
border-radius: 12px;
|
|
padding: 8px 10px;
|
|
margin-bottom: 8px;
|
|
box-shadow: var(--youth-inset-soft);
|
|
border: 1px solid var(--youth-border-light);
|
|
position: relative;
|
|
min-height: 75px;
|
|
}
|
|
|
|
.content-input-area textarea {
|
|
width: 100%;
|
|
min-height: 58px;
|
|
border: none;
|
|
outline: none;
|
|
background: transparent;
|
|
font-size: 13px;
|
|
line-height: 1.45;
|
|
color: var(--youth-text-primary);
|
|
resize: none;
|
|
font-family: inherit;
|
|
}
|
|
|
|
.content-input-area textarea::placeholder {
|
|
color: var(--youth-gray-400);
|
|
}
|
|
|
|
.word-count {
|
|
position: absolute;
|
|
bottom: 6px;
|
|
right: 10px;
|
|
font-size: 10px;
|
|
color: var(--youth-gray-400);
|
|
}
|
|
|
|
.word-count.near-limit {
|
|
color: var(--youth-state-warning);
|
|
}
|
|
|
|
.word-count.over-limit {
|
|
color: var(--youth-state-error);
|
|
}
|
|
|
|
/* ===== 区块标题 ===== */
|
|
.section-title {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
.section-title h3 {
|
|
font-size: 12px;
|
|
font-weight: 600;
|
|
color: var(--youth-text-primary);
|
|
margin: 0;
|
|
}
|
|
|
|
.section-title .sub-text {
|
|
font-size: 10px;
|
|
color: var(--youth-muted-foreground);
|
|
}
|
|
|
|
/* ===== 图片上传区 ===== */
|
|
.image-upload-section {
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.image-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(4, 1fr);
|
|
gap: 5px;
|
|
}
|
|
|
|
.image-item {
|
|
aspect-ratio: 1;
|
|
border-radius: 8px;
|
|
position: relative;
|
|
overflow: hidden;
|
|
box-shadow: 0 2px 6px rgba(0,0,0,0.05);
|
|
}
|
|
|
|
.image-item .image-placeholder {
|
|
width: 100%;
|
|
height: 100%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.image-item.img-1 .image-placeholder {
|
|
background: linear-gradient(135deg, #A5E3E0 0%, #54CAC5 100%);
|
|
}
|
|
|
|
.image-item.img-2 .image-placeholder {
|
|
background: linear-gradient(135deg, #FFD4A3 0%, #FFB980 100%);
|
|
}
|
|
|
|
.image-item.img-3 .image-placeholder {
|
|
background: linear-gradient(135deg, #D4C8F0 0%, #A89BD6 100%);
|
|
}
|
|
|
|
.image-item .delete-btn {
|
|
position: absolute;
|
|
top: 3px;
|
|
right: 3px;
|
|
width: 16px;
|
|
height: 16px;
|
|
border-radius: 50%;
|
|
background: rgba(0, 0, 0, 0.5);
|
|
backdrop-filter: blur(4px);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
cursor: pointer;
|
|
color: white;
|
|
font-size: 10px;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.image-item .delete-btn:active {
|
|
transform: scale(0.9);
|
|
}
|
|
|
|
.image-item .delete-btn svg {
|
|
width: 9px;
|
|
height: 9px;
|
|
}
|
|
|
|
.add-image-btn {
|
|
aspect-ratio: 1;
|
|
border-radius: 8px;
|
|
border: 2px dashed var(--youth-gray-300);
|
|
background: var(--youth-secondary);
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
box-shadow: var(--youth-inset-soft);
|
|
color: var(--youth-gray-400);
|
|
gap: 1px;
|
|
}
|
|
|
|
.add-image-btn:active {
|
|
transform: scale(0.96);
|
|
background: var(--youth-gray-200);
|
|
}
|
|
|
|
.add-image-btn svg {
|
|
width: 18px;
|
|
height: 18px;
|
|
}
|
|
|
|
.add-image-btn span {
|
|
font-size: 9px;
|
|
}
|
|
|
|
/* ===== 话题标签区 ===== */
|
|
.topic-section {
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.selected-topics {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 5px;
|
|
margin-bottom: 6px;
|
|
}
|
|
|
|
.topic-tag {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 2px;
|
|
padding: 3px 8px 3px 10px;
|
|
border-radius: 999px;
|
|
font-size: 11px;
|
|
font-weight: 500;
|
|
background: var(--youth-gradient-primary);
|
|
color: white;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
box-shadow: 0 2px 6px rgba(38, 194, 187, 0.25);
|
|
}
|
|
|
|
.topic-tag .remove-icon {
|
|
width: 12px;
|
|
height: 12px;
|
|
border-radius: 50%;
|
|
background: rgba(255, 255, 255, 0.25);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 8px;
|
|
margin-left: 1px;
|
|
}
|
|
|
|
.add-topic-btn {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 2px;
|
|
padding: 3px 8px;
|
|
border-radius: 999px;
|
|
font-size: 11px;
|
|
font-weight: 500;
|
|
background: var(--youth-secondary);
|
|
color: var(--youth-muted-foreground);
|
|
border: 1px solid var(--youth-border-light);
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.add-topic-btn:active {
|
|
transform: scale(0.96);
|
|
}
|
|
|
|
/* ===== 推荐话题横向滚动 ===== */
|
|
.recommended-topics {
|
|
display: flex;
|
|
gap: 5px;
|
|
overflow-x: auto;
|
|
padding-bottom: 2px;
|
|
-webkit-overflow-scrolling: touch;
|
|
}
|
|
|
|
.recommended-topics::-webkit-scrollbar {
|
|
display: none;
|
|
}
|
|
|
|
.rec-topic {
|
|
flex-shrink: 0;
|
|
padding: 3px 8px;
|
|
border-radius: 999px;
|
|
font-size: 11px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
border: 1px solid var(--youth-border-light);
|
|
background: var(--youth-bg-card);
|
|
color: var(--youth-secondary-foreground);
|
|
}
|
|
|
|
.rec-topic:active {
|
|
transform: scale(0.96);
|
|
}
|
|
|
|
.rec-topic.topic-daily {
|
|
background: linear-gradient(135deg, #E5F7F5 0%, #D4F0ED 100%);
|
|
color: #26C2BB;
|
|
border-color: transparent;
|
|
}
|
|
.rec-topic.topic-exam {
|
|
background: linear-gradient(135deg, #FFF5E0 0%, #FFEBC8 100%);
|
|
color: #D4A04A;
|
|
border-color: transparent;
|
|
}
|
|
.rec-topic.topic-food {
|
|
background: linear-gradient(135deg, #FFF0E5 0%, #FFE5D4 100%);
|
|
color: #D4906B;
|
|
border-color: transparent;
|
|
}
|
|
.rec-topic.topic-sport {
|
|
background: linear-gradient(135deg, #E5F0FF 0%, #D4E5FF 100%);
|
|
color: #7095D0;
|
|
border-color: transparent;
|
|
}
|
|
.rec-topic.topic-study {
|
|
background: linear-gradient(135deg, #E5EBFF 0%, #D4DFFF 100%);
|
|
color: #7085D0;
|
|
border-color: transparent;
|
|
}
|
|
.rec-topic.topic-music {
|
|
background: linear-gradient(135deg, #FFE5F0 0%, #FFD4E5 100%);
|
|
color: #D470A0;
|
|
border-color: transparent;
|
|
}
|
|
/* ===== 可见范围 ===== */
|
|
.visibility-section {
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.visibility-cards {
|
|
display: grid;
|
|
grid-template-columns: repeat(3, 1fr);
|
|
gap: 6px;
|
|
}
|
|
|
|
.visibility-card {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 4px;
|
|
padding: 8px 4px;
|
|
border-radius: 10px;
|
|
background: var(--youth-bg-card);
|
|
border: 1.5px solid var(--youth-border-light);
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
position: relative;
|
|
}
|
|
|
|
.visibility-card:active {
|
|
transform: scale(0.97);
|
|
}
|
|
|
|
.visibility-card.selected {
|
|
border-color: transparent;
|
|
background: linear-gradient(135deg, rgba(84, 202, 197, 0.12) 0%, rgba(38, 194, 187, 0.08) 100%);
|
|
box-shadow: 0 2px 8px rgba(38, 194, 187, 0.15);
|
|
}
|
|
|
|
.visibility-card.selected::before {
|
|
content: '';
|
|
position: absolute;
|
|
inset: 0;
|
|
border-radius: 10px;
|
|
padding: 1.5px;
|
|
background: var(--youth-gradient-primary);
|
|
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
|
|
mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
|
|
-webkit-mask-composite: xor;
|
|
mask-composite: exclude;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.visibility-card .icon-box {
|
|
width: 28px;
|
|
height: 28px;
|
|
border-radius: 8px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: var(--youth-secondary);
|
|
color: var(--youth-muted-foreground);
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.visibility-card .icon-box svg {
|
|
width: 14px;
|
|
height: 14px;
|
|
}
|
|
|
|
.visibility-card.selected .icon-box {
|
|
background: var(--youth-gradient-primary);
|
|
color: white;
|
|
box-shadow: 0 2px 6px rgba(38, 194, 187, 0.3);
|
|
}
|
|
|
|
.visibility-card .label {
|
|
font-size: 10px;
|
|
font-weight: 500;
|
|
color: var(--youth-muted-foreground);
|
|
transition: color 0.2s ease;
|
|
}
|
|
|
|
.visibility-card.selected .label {
|
|
color: var(--youth-primary-700);
|
|
font-weight: 600;
|
|
}
|
|
|
|
/* ===== 位置信息 ===== */
|
|
.location-section {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 8px 10px;
|
|
background: var(--youth-bg-card);
|
|
border-radius: 10px;
|
|
margin-bottom: 8px;
|
|
border: 1px solid var(--youth-border-light);
|
|
box-shadow: var(--shadow-card);
|
|
}
|
|
|
|
.location-left {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
}
|
|
|
|
.location-icon {
|
|
width: 26px;
|
|
height: 26px;
|
|
border-radius: 7px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: var(--youth-accent);
|
|
color: var(--youth-primary);
|
|
}
|
|
|
|
.location-icon svg {
|
|
width: 14px;
|
|
height: 14px;
|
|
}
|
|
|
|
.location-text {
|
|
font-size: 12px;
|
|
font-weight: 500;
|
|
color: var(--youth-text-primary);
|
|
}
|
|
|
|
/* ===== 立体开关 ===== */
|
|
.youth-switch {
|
|
position: relative;
|
|
width: 38px;
|
|
height: 22px;
|
|
background: var(--youth-gray-200);
|
|
border-radius: 999px;
|
|
box-shadow: var(--youth-inset-soft);
|
|
cursor: pointer;
|
|
transition: background 0.3s ease;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.youth-switch.active {
|
|
background: var(--youth-gradient-primary);
|
|
}
|
|
|
|
.youth-switch-thumb {
|
|
position: absolute;
|
|
top: 2px;
|
|
left: 2px;
|
|
width: 18px;
|
|
height: 18px;
|
|
background: white;
|
|
border-radius: 50%;
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
}
|
|
|
|
.youth-switch-thumb::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 2px;
|
|
left: 3px;
|
|
right: 3px;
|
|
height: 4px;
|
|
background: linear-gradient(180deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 100%);
|
|
border-radius: 50%;
|
|
}
|
|
|
|
.youth-switch.active .youth-switch-thumb {
|
|
transform: translateX(16px);
|
|
}
|
|
|
|
/* ===== 底部工具栏 ===== */
|
|
.bottom-toolbar {
|
|
flex-shrink: 0;
|
|
height: 56px;
|
|
background: var(--youth-bg-card);
|
|
border-top: 1px solid var(--youth-border-light);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-around;
|
|
padding: 0 16px;
|
|
z-index: 10;
|
|
}
|
|
|
|
.tool-btn {
|
|
width: 30px;
|
|
height: 30px;
|
|
border-radius: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: var(--youth-bg-card);
|
|
border: 1px solid var(--youth-border-light);
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
color: var(--youth-muted-foreground);
|
|
box-shadow: 0 2px 6px rgba(0,0,0,0.04), var(--youth-inset-soft);
|
|
}
|
|
|
|
.tool-btn:active {
|
|
transform: scale(0.92);
|
|
color: var(--youth-primary);
|
|
}
|
|
|
|
.tool-btn svg {
|
|
width: 16px;
|
|
height: 16px;
|
|
}
|
|
|
|
.tool-btn.primary {
|
|
background: var(--youth-gradient-primary);
|
|
color: white;
|
|
border: none;
|
|
box-shadow: 0 2px 8px rgba(38, 194, 187, 0.3);
|
|
}
|
|
|
|
/* ===== 底部安全区域 ===== */
|
|
.safe-area-bottom {
|
|
position: absolute;
|
|
bottom: 0;
|
|
left: 0;
|
|
right: 0;
|
|
height: 24px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
z-index: 20;
|
|
}
|
|
|
|
.safe-area-indicator {
|
|
width: 100px;
|
|
height: 3px;
|
|
border-radius: 999px;
|
|
background: var(--youth-text-primary);
|
|
opacity: 0.3;
|
|
}
|
|
|
|
/* ===== 图片占位图标 ===== */
|
|
.image-placeholder svg {
|
|
width: 20px;
|
|
height: 20px;
|
|
opacity: 0.6;
|
|
color: white;
|
|
}
|
|
|
|
/* SVG 图标统一尺寸 */
|
|
.icon-svg {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 1em;
|
|
height: 1em;
|
|
vertical-align: middle;
|
|
line-height: 1;
|
|
}
|
|
.icon-svg svg {
|
|
width: 100%;
|
|
height: 100%;
|
|
stroke: currentColor;
|
|
}
|
|
/* 侧栏图标 */
|
|
.sidebar-icon .icon-svg { width: 22px; height: 22px; font-size: 22px; }
|
|
/* 社团logo图标 */
|
|
.club-logo .icon-svg { width: 28px; height: 28px; font-size: 28px; color: #fff; }
|
|
/* 头图大图标 */
|
|
.hero-icon .icon-svg { width: 56px; height: 56px; font-size: 56px; opacity: 0.3; }
|
|
/* meta 小图标 */
|
|
.club-meta .icon-svg { width: 12px; height: 12px; font-size: 12px; }
|
|
/* 分类选择网格图标 */
|
|
.cat-option .icon-svg { width: 26px; height: 26px; font-size: 26px; }
|
|
/* logo预览图标 */
|
|
.logo-preview .icon-svg { width: 40px; height: 40px; font-size: 40px; color: #fff; }
|
|
/* 提示图标 */
|
|
.notice-icon .icon-svg { width: 18px; height: 18px; font-size: 18px; }
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="phone-container">
|
|
<!-- ===== 状态栏 ===== -->
|
|
<div class="status-bar">
|
|
<span>9:41</span>
|
|
<div class="right-icons">
|
|
<svg width="16" height="10" viewBox="0 0 18 12" fill="currentColor">
|
|
<path d="M1 8C2.5 8 3.5 6.5 3.5 5C3.5 3.5 2.5 2 1 2" stroke="currentColor" stroke-width="1.5" fill="none"></path>
|
|
<path d="M5.5 9C7 9 8 7.5 8 6C8 4.5 7 3 5.5 3" stroke="currentColor" stroke-width="1.5" fill="none"></path>
|
|
<path d="M10 10C11.5 10 12.5 8.5 12.5 7C12.5 5.5 11.5 4 10 4" stroke="currentColor" stroke-width="1.5" fill="none"></path>
|
|
<path d="M14.5 11C16 11 17 9.5 17 8C17 6.5 16 5 14.5 5" stroke="currentColor" stroke-width="1.5" fill="none"></path>
|
|
</svg>
|
|
<svg width="14" height="10" viewBox="0 0 16 12" fill="currentColor">
|
|
<rect x="0.5" y="2.5" width="13" height="7" rx="1.5" stroke="currentColor" fill="none"></rect>
|
|
<rect x="2" y="4" width="10" height="4" rx="1" fill="currentColor"></rect>
|
|
<rect x="14.5" y="4.5" width="1" height="3" rx="0.5" fill="currentColor"></rect>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- ===== 顶部导航 ===== -->
|
|
<div class="nav-bar">
|
|
<div class="nav-btn" data-dom-id="btn-back" onclick="goBack()">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<polyline points="15 18 9 12 15 6"></polyline>
|
|
</svg>
|
|
</div>
|
|
<div class="nav-title">发布动态</div>
|
|
<div style="display: flex; align-items: center; gap: 6px;">
|
|
|
|
<button class="publish-btn" data-dom-id="btn-publish" onclick="publishPost()">发布</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- ===== 内容区 ===== -->
|
|
<div class="scroll-content">
|
|
<!-- 身份切换 -->
|
|
<div class="segmented-control" id="identity-toggle">
|
|
<div class="segment-slider"></div>
|
|
<div class="segment active" data-dom-id="tab-realname" onclick="switchIdentity('realname')">实名发布</div>
|
|
<div class="segment" data-dom-id="tab-anonymous" onclick="switchIdentity('anonymous')">匿名发布</div>
|
|
</div>
|
|
|
|
<div class="anonymous-hint" id="anonymous-hint">
|
|
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<circle cx="12" cy="12" r="10"></circle>
|
|
<line x1="12" y1="16" x2="12" y2="12"></line>
|
|
<line x1="12" y1="8" x2="12.01" y2="8"></line>
|
|
</svg>
|
|
<span>匿名发布将隐藏你的个人信息</span>
|
|
</div>
|
|
|
|
<!-- 正文输入区 -->
|
|
<div class="content-input-area">
|
|
<textarea id="content-textarea"
|
|
data-dom-id="input-content"
|
|
placeholder="分享你的校园趣事吧~"
|
|
maxlength="500"
|
|
oninput="updateWordCount()"
|
|
></textarea>
|
|
<div class="word-count" id="word-count">0/500</div>
|
|
</div>
|
|
|
|
<!-- 图片/视频上传区 -->
|
|
<div class="image-upload-section">
|
|
<div class="section-title">
|
|
<h3>添加图片/视频</h3>
|
|
<span class="sub-text">最多9张</span>
|
|
</div>
|
|
<div class="image-grid" id="image-grid">
|
|
<div class="image-item img-1" data-dom-id="image-1">
|
|
<div class="image-placeholder">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
|
|
<circle cx="8.5" cy="8.5" r="1.5"></circle>
|
|
<polyline points="21 15 16 10 5 21"></polyline>
|
|
</svg>
|
|
</div>
|
|
<div class="delete-btn" onclick="deleteImage(1)">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
<div class="image-item img-2">
|
|
<div class="image-placeholder">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
|
|
<circle cx="8.5" cy="8.5" r="1.5"></circle>
|
|
<polyline points="21 15 16 10 5 21"></polyline>
|
|
</svg>
|
|
</div>
|
|
<div class="delete-btn" onclick="deleteImage(2)">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
<div class="image-item img-3">
|
|
<div class="image-placeholder">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
|
|
<circle cx="8.5" cy="8.5" r="1.5"></circle>
|
|
<polyline points="21 15 16 10 5 21"></polyline>
|
|
</svg>
|
|
</div>
|
|
<div class="delete-btn" onclick="deleteImage(3)">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
<div class="add-image-btn" data-dom-id="btn-image-add" onclick="addImage()">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
<line x1="12" y1="5" x2="12" y2="19"></line>
|
|
<line x1="5" y1="12" x2="19" y2="12"></line>
|
|
</svg>
|
|
<span>添加</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 话题标签区 -->
|
|
<div class="topic-section">
|
|
<div class="section-title">
|
|
<h3>添加话题</h3>
|
|
</div>
|
|
<div class="selected-topics" id="selected-topics">
|
|
<div class="topic-tag" data-dom-id="topic-1" onclick="removeTopic(1)">
|
|
#校园日常
|
|
<span class="remove-icon">
|
|
<svg width="9" height="9" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
|
|
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
</svg>
|
|
</span>
|
|
</div>
|
|
<div class="topic-tag" onclick="removeTopic(2)">
|
|
#期末加油
|
|
<span class="remove-icon">
|
|
<svg width="9" height="9" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
|
|
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
</svg>
|
|
</span>
|
|
</div>
|
|
<div class="topic-tag" onclick="removeTopic(3)">
|
|
#美食探店
|
|
<span class="remove-icon">
|
|
<svg width="9" height="9" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
|
|
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
</svg>
|
|
</span>
|
|
</div>
|
|
<div class="add-topic-btn" data-dom-id="btn-topic-add" onclick="addTopic()">
|
|
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<line x1="12" y1="5" x2="12" y2="19"></line>
|
|
<line x1="5" y1="12" x2="19" y2="12"></line>
|
|
</svg>
|
|
添加
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 推荐话题 -->
|
|
<div class="recommended-topics">
|
|
<div class="rec-topic topic-daily" onclick="addRecTopic('#校园日常')">#校园日常</div>
|
|
<div class="rec-topic topic-exam" onclick="addRecTopic('#期末加油')">#期末加油</div>
|
|
<div class="rec-topic topic-food" onclick="addRecTopic('#美食探店')">#美食探店</div>
|
|
<div class="rec-topic topic-sport" onclick="addRecTopic('#运动打卡')">#运动打卡</div>
|
|
<div class="rec-topic topic-study" onclick="addRecTopic('#图书馆自习')">#图书馆自习</div>
|
|
<div class="rec-topic topic-music" onclick="addRecTopic('#音乐节')">#音乐节</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 可见范围设置 -->
|
|
<div class="visibility-section">
|
|
<div class="section-title">
|
|
<h3>谁可以看</h3>
|
|
</div>
|
|
<div class="visibility-cards">
|
|
<div class="visibility-card selected" data-dom-id="visibility-public" onclick="setVisibility('public')">
|
|
<div class="icon-box">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<circle cx="12" cy="12" r="10"></circle>
|
|
<line x1="2" y1="12" x2="22" y2="12"></line>
|
|
<path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path>
|
|
</svg>
|
|
</div>
|
|
<span class="label">全校可见</span>
|
|
</div>
|
|
<div class="visibility-card" data-dom-id="visibility-friends" onclick="setVisibility('friends')">
|
|
<div class="icon-box">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
|
|
<circle cx="9" cy="7" r="4"></circle>
|
|
<path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>
|
|
<path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
|
|
</svg>
|
|
</div>
|
|
<span class="label">好友可见</span>
|
|
</div>
|
|
<div class="visibility-card" data-dom-id="visibility-private" onclick="setVisibility('private')">
|
|
<div class="icon-box">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect>
|
|
<path d="M7 11V7a5 5 0 0 1 10 0v4"></path>
|
|
</svg>
|
|
</div>
|
|
<span class="label">仅自己可见</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 位置信息 -->
|
|
<div class="location-section">
|
|
<div class="location-left">
|
|
<div class="location-icon">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path>
|
|
<circle cx="12" cy="10" r="3"></circle>
|
|
</svg>
|
|
</div>
|
|
<span class="location-text">添加位置</span>
|
|
</div>
|
|
<div class="youth-switch" data-dom-id="switch-location" onclick="toggleLocation()">
|
|
<div class="youth-switch-thumb"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- ===== 底部工具栏 ===== -->
|
|
<div class="bottom-toolbar">
|
|
<div class="tool-btn" data-dom-id="tool-emoji" onclick="toolAction('emoji')">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
|
<circle cx="12" cy="12" r="10"></circle>
|
|
<path d="M8 14s1.5 2 4 2 4-2 4-2"></path>
|
|
<line x1="9" y1="9" x2="9.01" y2="9"></line>
|
|
<line x1="15" y1="9" x2="15.01" y2="9"></line>
|
|
</svg>
|
|
</div>
|
|
<div class="tool-btn" data-dom-id="tool-mention" onclick="toolAction('mention')">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
|
<circle cx="12" cy="12" r="4"></circle>
|
|
<path d="M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-3.92 7.94"></path>
|
|
</svg>
|
|
</div>
|
|
<div class="tool-btn" data-dom-id="tool-topic" onclick="toolAction('topic')">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
|
<line x1="4" y1="9" x2="20" y2="9"></line>
|
|
<line x1="4" y1="15" x2="20" y2="15"></line>
|
|
<line x1="10" y1="3" x2="8" y2="21"></line>
|
|
<line x1="16" y1="3" x2="14" y2="21"></line>
|
|
</svg>
|
|
</div>
|
|
<div class="tool-btn" data-dom-id="tool-image" onclick="toolAction('image')">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
|
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
|
|
<circle cx="8.5" cy="8.5" r="1.5"></circle>
|
|
<polyline points="21 15 16 10 5 21"></polyline>
|
|
</svg>
|
|
</div>
|
|
<div class="tool-btn primary" data-dom-id="tool-vote" onclick="toolAction('vote')">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<polyline points="9 11 12 14 22 4"></polyline>
|
|
<path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"></path>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- ===== 底部安全区域 ===== -->
|
|
<div class="safe-area-bottom">
|
|
<div class="safe-area-indicator"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>// ===== 主题切换 =====
|
|
|
|
// 初始化主题
|
|
})();
|
|
|
|
// ===== 返回按钮 =====
|
|
function goBack() {
|
|
window.location.href = 'feed-home.html';
|
|
}
|
|
|
|
// ===== 实名/匿名切换 =====
|
|
let currentIdentity = 'realname';
|
|
|
|
function switchIdentity(type) {
|
|
if (currentIdentity === type) return;
|
|
currentIdentity = type;
|
|
|
|
const toggle = document.getElementById('identity-toggle');
|
|
const segments = toggle.querySelectorAll('.segment');
|
|
const hint = document.getElementById('anonymous-hint');
|
|
|
|
segments.forEach((seg, index) => {
|
|
if ((type === 'realname' && index === 0) || (type === 'anonymous' && index === 1)) {
|
|
seg.classList.add('active');
|
|
} else {
|
|
seg.classList.remove('active');
|
|
}
|
|
});
|
|
|
|
if (type === 'anonymous') {
|
|
toggle.classList.add('anonymous');
|
|
hint.classList.add('show');
|
|
} else {
|
|
toggle.classList.remove('anonymous');
|
|
hint.classList.remove('show');
|
|
}
|
|
}
|
|
|
|
// ===== 字数统计 =====
|
|
function updateWordCount() {
|
|
const textarea = document.getElementById('content-textarea');
|
|
const countEl = document.getElementById('word-count');
|
|
const len = textarea.value.length;
|
|
countEl.textContent = len + '/500';
|
|
|
|
countEl.classList.remove('near-limit', 'over-limit');
|
|
if (len >= 500) {
|
|
countEl.classList.add('over-limit');
|
|
} else if (len >= 450) {
|
|
countEl.classList.add('near-limit');
|
|
}
|
|
}
|
|
|
|
// ===== 图片管理 =====
|
|
let imageCount = 3;
|
|
const maxImages = 9;
|
|
const imageColors = [
|
|
'linear-gradient(135deg, #A5E3E0 0%, #54CAC5 100%)',
|
|
'linear-gradient(135deg, #FFD4A3 0%, #FFB980 100%)',
|
|
'linear-gradient(135deg, #C8B6FF 0%, #9B8AE5 100%)',
|
|
'linear-gradient(135deg, #FFB3D1 0%, #FF80B3 100%)',
|
|
'linear-gradient(135deg, #B3E5C8 0%, #80D4A0 100%)',
|
|
'linear-gradient(135deg, #FFE5B3 0%, #FFD480 100%)',
|
|
'linear-gradient(135deg, #B3D9FF 0%, #80BFFF 100%)',
|
|
'linear-gradient(135deg, #E5B3FF 0%, #D480FF 100%)',
|
|
'linear-gradient(135deg, #FFB3B3 0%, #FF8080 100%)',
|
|
];
|
|
|
|
function deleteImage(index) {
|
|
const grid = document.getElementById('image-grid');
|
|
const items = grid.querySelectorAll('.image-item');
|
|
const addBtn = grid.querySelector('.add-image-btn');
|
|
|
|
// 找到对应图片并删除
|
|
items.forEach(item => {
|
|
if (item.classList.contains('img-' + index)) {
|
|
item.remove();
|
|
imageCount--;
|
|
}
|
|
});
|
|
|
|
// 重新排序图片类名
|
|
const remainingItems = grid.querySelectorAll('.image-item');
|
|
remainingItems.forEach((item, i) => {
|
|
item.className = 'image-item img-' + (i + 1);
|
|
const delBtn = item.querySelector('.delete-btn');
|
|
if (delBtn) {
|
|
delBtn.setAttribute('onclick', 'deleteImage(' + (i + 1) + ')');
|
|
}
|
|
// 更新背景色
|
|
const placeholder = item.querySelector('.image-placeholder');
|
|
if (placeholder) {
|
|
placeholder.style.background = imageColors[i % imageColors.length];
|
|
}
|
|
});
|
|
|
|
// 确保添加按钮在最后
|
|
if (addBtn) {
|
|
addBtn.remove();
|
|
if (imageCount < maxImages) {
|
|
grid.appendChild(addBtn);
|
|
}
|
|
} else if (imageCount < maxImages) {
|
|
addImageButton();
|
|
}
|
|
}
|
|
|
|
function addImage() {
|
|
if (imageCount >= maxImages) return;
|
|
imageCount++;
|
|
|
|
const grid = document.getElementById('image-grid');
|
|
const addBtn = grid.querySelector('.add-image-btn');
|
|
|
|
const newImg = document.createElement('div');
|
|
newImg.className = 'image-item img-' + imageCount;
|
|
newImg.innerHTML = `
|
|
<div class="image-placeholder" style="background: ${imageColors[(imageCount - 1) % imageColors.length]}">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" style="width:24px;height:24px;opacity:0.6;color:white;">
|
|
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
|
|
<circle cx="8.5" cy="8.5" r="1.5"></circle>
|
|
<polyline points="21 15 16 10 5 21"></polyline>
|
|
</svg>
|
|
</div>
|
|
<div class="delete-btn" onclick="deleteImage(${imageCount})">
|
|
<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
</svg>
|
|
</div>
|
|
`;
|
|
|
|
// 插入到添加按钮之前
|
|
if (addBtn) {
|
|
grid.insertBefore(newImg, addBtn);
|
|
} else {
|
|
grid.appendChild(newImg);
|
|
}
|
|
|
|
// 如果达到最大数量,移除添加按钮
|
|
if (imageCount >= maxImages && addBtn) {
|
|
addBtn.remove();
|
|
}
|
|
}
|
|
|
|
function addImageButton() {
|
|
const grid = document.getElementById('image-grid');
|
|
const btn = document.createElement('div');
|
|
btn.className = 'add-image-btn';
|
|
btn.setAttribute('data-dom-id', 'btn-image-add');
|
|
btn.setAttribute('onclick', 'addImage()');
|
|
btn.innerHTML = `
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" style="width:22px;height:22px;">
|
|
<line x1="12" y1="5" x2="12" y2="19"></line>
|
|
<line x1="5" y1="12" x2="19" y2="12"></line>
|
|
</svg>
|
|
<span style="font-size:10px;">添加</span>
|
|
`;
|
|
grid.appendChild(btn);
|
|
}
|
|
|
|
// ===== 话题标签管理 =====
|
|
let topicCounter = 3;
|
|
const selectedTopics = ['#校园日常', '#期末加油', '#美食探店'];
|
|
|
|
function removeTopic(index) {
|
|
const container = document.getElementById('selected-topics');
|
|
const tags = container.querySelectorAll('.topic-tag');
|
|
if (tags[index - 1]) {
|
|
tags[index - 1].remove();
|
|
selectedTopics.splice(index - 1, 1);
|
|
// 重新编号
|
|
const remainingTags = container.querySelectorAll('.topic-tag');
|
|
remainingTags.forEach((tag, i) => {
|
|
tag.setAttribute('onclick', 'removeTopic(' + (i + 1) + ')');
|
|
});
|
|
topicCounter = remainingTags.length;
|
|
}
|
|
}
|
|
|
|
function addTopic() {
|
|
const topicName = prompt('请输入话题名称:');
|
|
if (topicName && topicName.trim()) {
|
|
addTopicTag(topicName.trim().startsWith('#') ? topicName.trim() : '#' + topicName.trim());
|
|
}
|
|
}
|
|
|
|
function addRecTopic(topic) {
|
|
if (selectedTopics.includes(topic)) {
|
|
alert('该话题已添加');
|
|
return;
|
|
}
|
|
addTopicTag(topic);
|
|
}
|
|
|
|
function addTopicTag(topic) {
|
|
if (selectedTopics.length >= 10) {
|
|
alert('最多添加10个话题');
|
|
return;
|
|
}
|
|
selectedTopics.push(topic);
|
|
topicCounter++;
|
|
|
|
const container = document.getElementById('selected-topics');
|
|
const addBtn = container.querySelector('.add-topic-btn');
|
|
|
|
const tag = document.createElement('div');
|
|
tag.className = 'topic-tag';
|
|
tag.setAttribute('onclick', 'removeTopic(' + topicCounter + ')');
|
|
tag.innerHTML = `
|
|
${topic}
|
|
<span class="remove-icon">
|
|
<svg width="9" height="9" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
|
|
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
</svg>
|
|
</span>
|
|
`;
|
|
|
|
if (addBtn) {
|
|
container.insertBefore(tag, addBtn);
|
|
} else {
|
|
container.appendChild(tag);
|
|
}
|
|
}
|
|
|
|
// ===== 可见范围切换 =====
|
|
let currentVisibility = 'public';
|
|
|
|
function setVisibility(type) {
|
|
currentVisibility = type;
|
|
const cards = document.querySelectorAll('.visibility-card');
|
|
const types = ['public', 'friends', 'private'];
|
|
|
|
cards.forEach((card, index) => {
|
|
if (types[index] === type) {
|
|
card.classList.add('selected');
|
|
} else {
|
|
card.classList.remove('selected');
|
|
}
|
|
});
|
|
}
|
|
|
|
// ===== 位置开关 =====
|
|
let locationEnabled = false;
|
|
|
|
function toggleLocation() {
|
|
locationEnabled = !locationEnabled;
|
|
const switchEl = document.querySelector('[data-dom-id="switch-location"]');
|
|
if (locationEnabled) {
|
|
switchEl.classList.add('active');
|
|
} else {
|
|
switchEl.classList.remove('active');
|
|
}
|
|
}
|
|
|
|
// ===== 工具栏操作 =====
|
|
function toolAction(tool) {
|
|
const textarea = document.getElementById('content-textarea');
|
|
textarea.focus();
|
|
|
|
switch (tool) {
|
|
case 'emoji':
|
|
insertAtCursor(textarea, '😊');
|
|
break;
|
|
case 'mention':
|
|
insertAtCursor(textarea, '@');
|
|
break;
|
|
case 'topic':
|
|
insertAtCursor(textarea, '#');
|
|
break;
|
|
case 'image':
|
|
addImage();
|
|
break;
|
|
case 'vote':
|
|
alert('添加投票功能开发中...');
|
|
break;
|
|
}
|
|
}
|
|
|
|
function insertAtCursor(textarea, text) {
|
|
const start = textarea.selectionStart;
|
|
const end = textarea.selectionEnd;
|
|
const value = textarea.value;
|
|
textarea.value = value.substring(0, start) + text + value.substring(end);
|
|
textarea.selectionStart = textarea.selectionEnd = start + text.length;
|
|
updateWordCount();
|
|
}
|
|
|
|
// ===== 发布动态 =====
|
|
function publishPost() {
|
|
const content = document.getElementById('content-textarea').value.trim();
|
|
if (!content && imageCount === 0) {
|
|
alert('请输入内容或添加图片');
|
|
return;
|
|
}
|
|
|
|
// 模拟发布 - 跳转到 my-posts.html 待审核状态
|
|
const publishBtn = document.querySelector('[data-dom-id="btn-publish"]');
|
|
publishBtn.textContent = '发布中...';
|
|
publishBtn.style.opacity = '0.7';
|
|
publishBtn.disabled = true;
|
|
|
|
setTimeout(() => {
|
|
window.location.href = 'my-posts.html?status=pending';
|
|
}, 800);
|
|
}</script>
|
|
</body>
|
|
</html>
|
|
|