综述: 添加内容管理模块

- 新增内容管理目录及相应功能文件
This commit is contained in:
linbin 2025-09-25 00:58:05 +08:00
parent fc8265d202
commit bad1727fad
3 changed files with 1965 additions and 0 deletions

View File

@ -0,0 +1,713 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>公告管理</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;
width: 100%;
height: 100vh;
background-color: #f5f5f5;
}
.header {
background-color: rgb(9, 84, 43);
color: white;
padding: 15px 30px;
display: flex;
align-items: center;
font-size: 18px;
font-weight: 500;
}
.main-content {
padding: 30px;
height: calc(100vh - 60px);
overflow-y: auto;
}
.control-panel {
background: white;
padding: 20px;
border-radius: 5px;
margin-bottom: 20px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.search-form {
display: flex;
gap: 20px;
align-items: center;
flex-wrap: wrap;
margin-bottom: 20px;
}
.form-group {
display: flex;
align-items: center;
gap: 10px;
}
.form-group label {
font-weight: 500;
color: #333;
white-space: nowrap;
}
.form-control {
padding: 8px 12px;
border: 1px solid #d9d9d9;
border-radius: 4px;
font-size: 14px;
transition: all 0.3s ease;
}
.form-control:focus {
outline: none;
border-color: #1890ff;
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}
.btn {
padding: 8px 16px;
border-radius: 4px;
font-size: 14px;
font-weight: 500;
transition: all 0.3s ease;
display: inline-flex;
align-items: center;
gap: 5px;
cursor: pointer;
border: none;
}
.btn:hover {
transform: translateY(-1px);
}
.btn-primary {
background-color: #1890ff;
color: white;
}
.btn-primary:hover {
background-color: #40a9ff;
}
.btn-success {
background-color: #52c41a;
color: white;
}
.btn-success:hover {
background-color: #73d13d;
}
.btn-danger {
background-color: #ff4d4f;
color: white;
}
.btn-danger:hover {
background-color: #ff7875;
}
.action-buttons {
display: flex;
gap: 10px;
}
.data-table {
background: white;
border-radius: 5px;
overflow: hidden;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
table {
width: 100%;
border-collapse: collapse;
}
th {
background-color: #fafafa;
padding: 15px;
text-align: left;
font-weight: 500;
color: #333;
border-bottom: 1px solid #e8e8e8;
}
td {
padding: 15px;
border-bottom: 1px solid #e8e8e8;
color: #333;
}
tr:hover {
background-color: #f5f5f5;
}
.pagination {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
background: white;
margin-top: 20px;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.page-info {
color: #666;
font-size: 14px;
}
.page-controls {
display: flex;
align-items: center;
gap: 10px;
}
.page-select {
padding: 5px 10px;
border: 1px solid #d9d9d9;
border-radius: 4px;
}
.status-badge {
padding: 4px 8px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
}
.status-enabled {
background-color: #f6ffed;
color: #52c41a;
}
.status-disabled {
background-color: #fff2f0;
color: #ff4d4f;
}
/* 弹窗样式 */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: none;
z-index: 1000;
}
.modal {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: white;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
min-width: 500px;
max-width: 90vw;
max-height: 90vh;
overflow-y: auto;
z-index: 1001;
}
.modal-header {
padding: 20px 24px 0;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: none;
}
.modal-title {
font-size: 18px;
font-weight: 500;
color: #333;
margin: 0;
}
.modal-close {
background: none;
border: none;
font-size: 24px;
color: #999;
cursor: pointer;
padding: 0;
line-height: 1;
}
.modal-close:hover {
color: #666;
}
.modal-body {
padding: 24px;
}
.modal-form-group {
margin-bottom: 24px;
}
.modal-form-group label {
display: flex;
align-items: center;
font-weight: 500;
color: #333;
margin-bottom: 8px;
}
.required {
color: #ff4d4f;
margin-right: 4px;
}
.modal-textarea {
width: 100%;
min-height: 120px;
padding: 12px;
border: 1px solid #d9d9d9;
border-radius: 6px;
font-size: 14px;
font-family: inherit;
resize: vertical;
transition: all 0.3s ease;
}
.modal-textarea:focus {
outline: none;
border-color: #1890ff;
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}
.modal-textarea::placeholder {
color: #bfbfbf;
}
.switch-group {
display: flex;
align-items: center;
gap: 12px;
}
.switch {
position: relative;
display: inline-block;
width: 44px;
height: 24px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
transition: .3s;
border-radius: 24px;
}
.slider:before {
position: absolute;
content: "";
height: 18px;
width: 18px;
left: 3px;
bottom: 3px;
background-color: white;
transition: .3s;
border-radius: 50%;
}
input:checked + .slider {
background-color: #1890ff;
}
input:checked + .slider:before {
transform: translateX(20px);
}
.switch-label {
font-size: 14px;
color: #333;
}
.modal-select {
width: 100%;
padding: 8px 12px;
border: 1px solid #d9d9d9;
border-radius: 6px;
font-size: 14px;
background-color: white;
cursor: pointer;
transition: all 0.3s ease;
}
.modal-select:focus {
outline: none;
border-color: #1890ff;
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}
.dropdown-container {
position: relative;
}
.dropdown-list {
position: absolute;
top: 100%;
left: 0;
right: 0;
background: white;
border: 1px solid #d9d9d9;
border-top: none;
border-radius: 0 0 6px 6px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
display: none;
z-index: 1002;
}
.dropdown-item {
padding: 12px;
cursor: pointer;
transition: background-color 0.2s;
color: #333;
}
.dropdown-item:hover {
background-color: #f5f5f5;
}
.dropdown-item.selected {
background-color: #e6f7ff;
color: #1890ff;
}
.modal-footer {
padding: 16px 24px 24px;
display: flex;
justify-content: flex-end;
gap: 12px;
}
.btn-cancel {
background-color: #fff;
color: #333;
border: 1px solid #d9d9d9;
}
.btn-cancel:hover {
background-color: #f5f5f5;
border-color: #40a9ff;
color: #40a9ff;
}
@media (max-width: 768px) {
.main-content {
padding: 15px;
}
.search-form {
flex-direction: column;
align-items: stretch;
}
.form-group {
justify-content: space-between;
}
.action-buttons {
flex-direction: column;
}
table {
font-size: 12px;
}
th, td {
padding: 10px 5px;
}
.modal {
min-width: 300px;
margin: 20px;
max-width: calc(100vw - 40px);
}
.modal-body {
padding: 16px;
}
.modal-footer {
padding: 12px 16px 16px;
}
}
</style>
</head>
<body>
<div class="header">
公告管理
</div>
<div class="main-content">
<div class="control-panel">
<div class="search-form">
<div class="form-group">
<label>应用</label>
<select class="form-control">
<option>用户端</option>
<option>商家端</option>
<option>管理端</option>
</select>
</div>
<div class="action-buttons">
<button class="btn btn-primary">查询</button>
<button class="btn btn-primary">重置</button>
</div>
</div>
<div class="action-buttons">
<button class="btn btn-success">新增公告</button>
<button class="btn btn-primary">排序</button>
</div>
</div>
<div class="data-table">
<table>
<thead>
<tr>
<th>序号</th>
<th>公告通知</th>
<th>位置</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2312312</td>
<td>菜市场详情页</td>
<td><span class="status-badge status-enabled">已启用</span></td>
<td>
<button class="btn btn-primary" style="margin-right: 5px;">编辑</button>
<button class="btn btn-danger">删除</button>
</td>
</tr>
<tr>
<td>2</td>
<td>春节菜市场关闭您</td>
<td>菜市场详情页</td>
<td><span class="status-badge status-enabled">已启用</span></td>
<td>
<button class="btn btn-primary" style="margin-right: 5px;">编辑</button>
<button class="btn btn-danger">删除</button>
</td>
</tr>
</tbody>
</table>
</div>
<div class="pagination">
<div class="page-info">
前往 1 页 共 2 条记录
</div>
<div class="page-controls">
<select class="page-select">
<option>10条/页</option>
<option>20条/页</option>
<option>50条/页</option>
</select>
</div>
</div>
</div>
<!-- 添加公告弹窗 -->
<div id="modal-overlay" class="modal-overlay">
<div class="modal">
<div class="modal-header">
<h3 class="modal-title">添加公告</h3>
<button class="modal-close" onclick="closeModal()">&times;</button>
</div>
<div class="modal-body">
<form id="announcement-form">
<div class="modal-form-group">
<label>
<span class="required">*</span>公告内容
</label>
<textarea
class="modal-textarea"
id="announcement-content"
placeholder="请输入公告内容"
required
></textarea>
</div>
<div class="modal-form-group">
<label>状态</label>
<div class="switch-group">
<span class="switch-label">禁用</span>
<label class="switch">
<input type="checkbox" id="status-switch">
<span class="slider"></span>
</label>
<span class="switch-label">启用</span>
</div>
</div>
<div class="modal-form-group">
<label>
<span class="required">*</span>应用
</label>
<div class="dropdown-container">
<div class="modal-select" onclick="toggleDropdown()">
<span id="selected-app">用户</span>
<span style="float: right;"></span>
</div>
<div id="app-dropdown" class="dropdown-list">
<div class="dropdown-item selected" data-value="用户">用户</div>
<div class="dropdown-item" data-value="商家">商家</div>
<div class="dropdown-item" data-value="专员">专员</div>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-cancel" onclick="closeModal()">取消</button>
<button class="btn btn-primary" onclick="confirmAdd()">确认</button>
</div>
</div>
</div>
<script>
// 弹窗控制函数
function openModal() {
document.getElementById('modal-overlay').style.display = 'block';
// 重置表单
document.getElementById('announcement-form').reset();
document.getElementById('selected-app').textContent = '用户';
updateDropdownSelection('用户');
}
function closeModal() {
document.getElementById('modal-overlay').style.display = 'none';
}
// 下拉菜单控制
function toggleDropdown() {
const dropdown = document.getElementById('app-dropdown');
dropdown.style.display = dropdown.style.display === 'block' ? 'none' : 'block';
}
function updateDropdownSelection(value) {
const items = document.querySelectorAll('.dropdown-item');
items.forEach(item => {
item.classList.remove('selected');
if (item.dataset.value === value) {
item.classList.add('selected');
}
});
}
// 确认添加
function confirmAdd() {
const content = document.getElementById('announcement-content').value.trim();
const isEnabled = document.getElementById('status-switch').checked;
const app = document.getElementById('selected-app').textContent;
if (!content) {
alert('请输入公告内容');
return;
}
// 模拟添加成功
alert(`公告添加成功!\n内容${content}\n状态${isEnabled ? '启用' : '禁用'}\n应用${app}`);
closeModal();
}
// 点击空白区域关闭弹窗
document.getElementById('modal-overlay').addEventListener('click', function(e) {
if (e.target === this) {
closeModal();
}
});
// 下拉菜单项点击事件
document.addEventListener('click', function(e) {
if (e.target.classList.contains('dropdown-item')) {
const value = e.target.dataset.value;
document.getElementById('selected-app').textContent = value;
updateDropdownSelection(value);
document.getElementById('app-dropdown').style.display = 'none';
}
// 点击其他地方关闭下拉菜单
else if (!e.target.closest('.dropdown-container')) {
document.getElementById('app-dropdown').style.display = 'none';
}
});
// 查询功能
document.querySelector('.btn-primary').addEventListener('click', function() {
alert('查询功能待实现');
});
// 重置功能
document.querySelectorAll('.btn-primary')[1].addEventListener('click', function() {
document.querySelector('select').selectedIndex = 0;
});
// 新增公告 - 打开弹窗
document.querySelector('.btn-success').addEventListener('click', function() {
openModal();
});
// 排序功能
document.querySelectorAll('.btn-primary')[2].addEventListener('click', function() {
alert('排序功能待实现');
});
// 编辑功能
document.querySelectorAll('.btn-primary').forEach(function(btn, index) {
if(btn.textContent.trim() === '编辑') {
btn.addEventListener('click', function() {
alert('编辑功能待实现');
});
}
});
// 删除功能
document.querySelectorAll('.btn-danger').forEach(function(btn) {
btn.addEventListener('click', function() {
if(confirm('确定要删除这条公告吗?')) {
alert('删除功能待实现');
}
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,453 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>购物须知管理</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;
background-color: #f5f5f5;
color: #333;
width: 100%;
height: 100vh;
overflow-y: auto;
}
.header {
background-color: rgb(9, 84, 43);
color: white;
padding: 20px 30px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.header h1 {
font-size: 24px;
font-weight: 500;
}
.container {
max-width: 1200px;
margin: 30px auto;
padding: 0 30px;
}
.form-card {
background: #fff;
border-radius: 8px;
padding: 30px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.form-row {
display: flex;
gap: 30px;
margin-bottom: 20px;
align-items: center;
}
.form-group {
flex: 1;
}
.form-group.narrow {
flex: 0 0 200px;
}
.form-label {
display: block;
font-weight: 500;
color: #333;
margin-bottom: 8px;
font-size: 14px;
}
.form-label.required::after {
content: "*";
color: #ff4d4f;
margin-left: 4px;
}
.form-input {
width: 100%;
padding: 10px 12px;
border: 1px solid #d9d9d9;
border-radius: 4px;
font-size: 14px;
transition: all 0.3s ease;
background-color: #fafafa;
}
.form-input:focus {
border-color: #1890ff;
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
outline: none;
background-color: #fff;
}
.form-input.placeholder {
color: #bfbfbf;
}
.text-editor-container {
margin-bottom: 30px;
}
.text-editor {
width: 100%;
min-height: 400px;
border: 1px solid #d9d9d9;
border-radius: 4px;
padding: 15px;
font-size: 14px;
line-height: 1.6;
resize: vertical;
transition: all 0.3s ease;
background-color: #fafafa;
}
.text-editor:focus {
border-color: #1890ff;
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
outline: none;
background-color: #fff;
}
.toolbar {
background: #fafafa;
border: 1px solid #d9d9d9;
border-bottom: none;
border-radius: 4px 4px 0 0;
padding: 10px;
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.toolbar-btn {
padding: 6px 10px;
border: 1px solid #d9d9d9;
border-radius: 3px;
background: #fff;
cursor: pointer;
font-size: 12px;
transition: all 0.3s ease;
}
.toolbar-btn:hover {
border-color: #1890ff;
color: #1890ff;
}
.toolbar-btn.active {
background: #1890ff;
color: #fff;
border-color: #1890ff;
}
.btn {
padding: 10px 20px;
border-radius: 5px;
font-size: 14px;
font-weight: 500;
transition: all 0.3s ease;
display: inline-flex;
align-items: center;
gap: 5px;
border: none;
cursor: pointer;
}
.btn-primary {
background-color: #1890ff;
color: white;
}
.btn-primary:hover {
background-color: #40a9ff;
transform: translateY(-2px);
}
.btn-success {
background-color: #52c41a;
color: white;
}
.btn-success:hover {
background-color: #73d13d;
transform: translateY(-2px);
}
.btn-warning {
background-color: #faad14;
color: white;
}
.btn-warning:hover {
background-color: #ffc53d;
transform: translateY(-2px);
}
.action-buttons {
display: flex;
gap: 10px;
justify-content: flex-end;
margin-top: 30px;
padding-top: 20px;
border-top: 1px solid #e8e8e8;
}
.content-section {
background: #fff;
border-radius: 8px;
padding: 20px;
margin-bottom: 20px;
border-left: 4px solid #1890ff;
}
.section-title {
font-weight: 600;
color: #333;
margin-bottom: 15px;
font-size: 16px;
}
.rule-item {
margin-bottom: 15px;
padding-left: 15px;
}
.rule-item:before {
content: counter(rule-counter);
counter-increment: rule-counter;
font-weight: 600;
color: #1890ff;
margin-right: 8px;
}
.sales-rules {
counter-reset: rule-counter;
}
.presale-rules {
counter-reset: rule-counter;
}
@media (max-width: 768px) {
.form-row {
flex-direction: column;
gap: 15px;
}
.form-group.narrow {
flex: 1;
}
.container {
padding: 0 15px;
}
.form-card {
padding: 20px;
}
.toolbar {
padding: 8px;
gap: 5px;
}
.action-buttons {
flex-direction: column;
}
}
</style>
</head>
<body>
<div class="header">
<h1>购物须知管理</h1>
</div>
<div class="container">
<div class="form-card">
<form id="shoppingNoticeForm">
<div class="form-row">
<div class="form-group narrow">
<label class="form-label required">菜市场:</label>
<input type="text" class="form-input" value="春申菜市场" readonly>
<div style="color: #ff4d4f; font-size: 12px; margin-top: 5px;">请选择菜市场</div>
</div>
</div>
<div class="form-row">
<div class="form-group narrow">
<label class="form-label required">标题:</label>
<input type="text" class="form-input" value="购物须知">
</div>
</div>
<div class="text-editor-container">
<label class="form-label required">内容:</label>
<div class="toolbar">
<button type="button" class="toolbar-btn" onclick="execCommand('undo')"></button>
<button type="button" class="toolbar-btn" onclick="execCommand('redo')"></button>
<button type="button" class="toolbar-btn" onclick="formatText('bold')"><strong>B</strong></button>
<button type="button" class="toolbar-btn" onclick="formatText('italic')"><em>I</em></button>
<button type="button" class="toolbar-btn" onclick="formatText('underline')"><u>U</u></button>
<button type="button" class="toolbar-btn" onclick="formatText('strikethrough')"><s>S</s></button>
<button type="button" class="toolbar-btn" onclick="formatText('subscript')">X₂</button>
<button type="button" class="toolbar-btn" onclick="formatText('superscript')"></button>
<button type="button" class="toolbar-btn" onclick="insertText('quote')">"</button>
<button type="button" class="toolbar-btn" onclick="formatText('justifyLeft')"></button>
<button type="button" class="toolbar-btn" onclick="formatText('justifyCenter')"></button>
<button type="button" class="toolbar-btn" onclick="formatText('justifyRight')"></button>
<button type="button" class="toolbar-btn" onclick="formatText('justifyFull')"></button>
<button type="button" class="toolbar-btn" onclick="formatText('insertOrderedList')">1.</button>
<button type="button" class="toolbar-btn" onclick="formatText('insertUnorderedList')"></button>
<button type="button" class="toolbar-btn" onclick="formatText('outdent')"></button>
<button type="button" class="toolbar-btn" onclick="formatText('indent')"></button>
<button type="button" class="toolbar-btn"></button>
<button type="button" class="toolbar-btn"></button>
<button type="button" class="toolbar-btn"></button>
<button type="button" class="toolbar-btn">🔗</button>
<button type="button" class="toolbar-btn">🖼</button>
<button type="button" class="toolbar-btn">📊</button>
<button type="button" class="toolbar-btn">😊</button>
<button type="button" class="toolbar-btn">👁</button>
<button type="button" class="toolbar-btn">🖨</button>
<button type="button" class="toolbar-btn">🗑</button>
</div>
<div class="text-editor" contenteditable="true" id="contentEditor">
<div class="content-section sales-rules">
<div class="section-title">售后规则:</div>
<div class="rule-item">如有卖家原因(商品或配送问题)造成的退货产生的配送费用实家承担,其他原因引起的退货产生的配送费用实家承担。</div>
<div class="rule-item">收到货物请核对包装和商品的完整,确认收货后如需售后请联系店铺客服。</div>
</div>
<div class="content-section presale-rules">
<div class="section-title">预售规则:</div>
<div class="rule-item">商品定金支付成功后,订单即生效,定金不可退。</div>
<div class="rule-item">补尾款时支付包装费、调度费和配送费,补尾款期内未补尾款视为自动放弃此订单。</div>
</div>
</div>
</div>
<div class="action-buttons">
<button type="button" class="btn btn-warning">预览</button>
<button type="button" class="btn btn-primary">保存</button>
<button type="button" class="btn btn-success">发布</button>
</div>
</form>
</div>
</div>
<script>
// 文本编辑器功能
function execCommand(command) {
document.execCommand(command, false, null);
}
function formatText(command) {
document.execCommand(command, false, null);
}
function insertText(type) {
const editor = document.getElementById('contentEditor');
const selection = window.getSelection();
if (type === 'quote') {
document.execCommand('insertHTML', false, '"');
}
}
// 表单验证
function validateForm() {
const market = document.querySelector('input[value="春申菜市场"]');
const title = document.querySelector('input[value="购物须知"]');
const content = document.getElementById('contentEditor');
if (!market.value.trim()) {
alert('请选择菜市场');
return false;
}
if (!title.value.trim()) {
alert('请填写标题');
return false;
}
if (!content.textContent.trim()) {
alert('请填写内容');
return false;
}
return true;
}
// 按钮事件处理
document.addEventListener('DOMContentLoaded', function() {
const buttons = document.querySelectorAll('.action-buttons .btn');
buttons.forEach(button => {
button.addEventListener('click', function() {
const action = this.textContent.trim();
switch(action) {
case '预览':
if (validateForm()) {
alert('预览功能开发中...');
}
break;
case '保存':
if (validateForm()) {
alert('保存成功!');
}
break;
case '发布':
if (validateForm()) {
if (confirm('确认发布购物须知吗?发布后将对用户可见。')) {
alert('发布成功!');
}
}
break;
}
});
});
// 工具栏按钮状态切换
document.querySelectorAll('.toolbar-btn').forEach(btn => {
btn.addEventListener('click', function(e) {
e.preventDefault();
// 可以添加激活状态的切换逻辑
});
});
// 编辑器焦点处理
const editor = document.getElementById('contentEditor');
editor.addEventListener('focus', function() {
this.style.borderColor = '#1890ff';
});
editor.addEventListener('blur', function() {
this.style.borderColor = '#d9d9d9';
});
});
// 菜市场选择功能(模拟)
document.querySelector('input[value="春申菜市场"]').addEventListener('click', function() {
const markets = ['春申菜市场', '虹桥菜市场', '浦东菜市场', '徐汇菜市场'];
const selected = prompt('请选择菜市场:\n' + markets.map((m, i) => `${i + 1}. ${m}`).join('\n'));
if (selected && !isNaN(selected) && selected >= 1 && selected <= markets.length) {
this.value = markets[selected - 1];
this.nextElementSibling.style.display = 'none';
}
});
</script>
</body>
</html>

View File

@ -0,0 +1,799 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>轮播图管理 - 大妈集市商户端</title>
<style>
/* 重置样式 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;
background-color: #f5f5f5;
color: #333;
}
.container {
max-width: 1400px;
margin: 0 auto;
padding: 20px;
}
.page-header {
background: white;
padding: 16px 24px;
margin-bottom: 16px;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.page-title {
font-size: 24px;
font-weight: 600;
color: #262626;
}
/* 主要内容区域 */
.content {
display: flex;
flex-direction: column;
gap: 20px;
}
/* 搜索过滤区域 */
.filter-section {
background: white;
padding: 24px;
margin-bottom: 16px;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.search-form {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 16px;
margin-bottom: 16px;
}
.form-item {
display: flex;
flex-direction: column;
gap: 8px;
}
.form-label {
font-size: 14px;
color: #666;
font-weight: 500;
}
.form-input {
height: 40px;
padding: 0 12px;
border: 1px solid #ddd;
border-radius: 6px;
font-size: 14px;
}
.form-input:focus {
outline: none;
border-color: #1890ff;
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}
.button-group {
display: flex;
gap: 12px;
}
/* 按钮样式 */
.btn {
height: 40px;
padding: 0 16px;
border: none;
border-radius: 6px;
font-size: 14px;
cursor: pointer;
display: inline-flex;
align-items: center;
justify-content: center;
transition: all 0.3s;
}
.btn:disabled {
opacity: 0.6;
cursor: not-allowed;
}
.btn-primary {
background: #1890ff;
color: white;
}
.btn-primary:hover:not(:disabled) {
background: #40a9ff;
}
.btn-secondary {
background: white;
color: #666;
border: 1px solid #ddd;
}
.btn-secondary:hover:not(:disabled) {
border-color: #1890ff;
color: #1890ff;
}
.btn-link {
background: none;
border: none;
color: #1890ff;
padding: 4px 8px;
text-decoration: none;
}
.btn-link:hover {
color: #40a9ff;
text-decoration: underline;
}
/* 操作按钮区域 */
.action-section {
display: flex;
gap: 8px;
}
/* 表格区域 */
.table-section {
background: white;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
overflow: hidden;
margin-bottom: 16px;
}
.table-wrapper {
overflow-x: auto;
}
.data-table {
width: 100%;
border-collapse: collapse;
font-size: 14px;
}
.data-table th {
background: #fafafa;
padding: 12px 8px;
text-align: left;
font-weight: 600;
color: #666;
border-bottom: 1px solid #f0f0f0;
white-space: nowrap;
}
.data-table td {
padding: 12px 8px;
border-bottom: 1px solid #f9f9f9;
vertical-align: middle;
}
.data-table tbody tr:hover {
background: #f8f9fa;
}
.banner-preview {
width: 60px;
height: 40px;
object-fit: cover;
border-radius: 4px;
cursor: pointer;
}
.status {
padding: 2px 8px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
}
.status-enabled {
background: #f6ffed;
color: #52c41a;
border: 1px solid #b7eb8f;
}
.status-disabled {
background: #fff2f0;
color: #ff4d4f;
border: 1px solid #ffb3b3;
}
.actions {
display: flex;
gap: 8px;
}
/* 分页区域 */
.pagination {
padding: 20px 24px;
display: flex;
justify-content: space-between;
align-items: center;
background: white;
border-top: 1px solid #f0f0f0;
}
.pagination-info {
color: #666;
font-size: 14px;
}
.pagination-controls {
display: flex;
align-items: center;
gap: 16px;
}
.page-size-selector {
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
color: #666;
}
.page-size-select {
height: 32px;
padding: 0 8px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 14px;
background: white;
}
.page-list {
display: flex;
align-items: center;
gap: 4px;
list-style: none;
}
.page-item {
min-width: 32px;
height: 32px;
padding: 0 8px;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid #ddd;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
transition: all 0.3s;
background: white;
color: #666;
}
.page-item:hover:not(.disabled):not(.active) {
border-color: #1890ff;
color: #1890ff;
}
.page-item.active {
background: #1890ff;
border-color: #1890ff;
color: white;
}
.page-item.disabled {
opacity: 0.5;
cursor: not-allowed;
color: #ccc;
}
.page-item.ellipsis {
border: none;
cursor: default;
color: #999;
}
.page-item.ellipsis:hover {
border: none;
color: #999;
}
.page-jump {
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
color: #666;
}
.page-jump input {
width: 50px;
height: 32px;
padding: 0 8px;
border: 1px solid #ddd;
border-radius: 4px;
text-align: center;
font-size: 14px;
}
.total-info {
color: #666;
}
/* 弹窗样式 */
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
z-index: 1000;
}
.modal.show {
display: flex;
align-items: center;
justify-content: center;
}
.modal-content {
background: #fff;
border-radius: 8px;
width: 500px;
max-width: 90vw;
max-height: 90vh;
overflow: auto;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.modal-header {
padding: 16px 24px;
border-bottom: 1px solid #e8e8e8;
display: flex;
justify-content: space-between;
align-items: center;
}
.modal-header h3 {
margin: 0;
font-size: 16px;
font-weight: 600;
}
.modal-close {
background: none;
border: none;
font-size: 20px;
cursor: pointer;
color: #999;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
}
.modal-close:hover {
color: #333;
}
.modal-body {
padding: 24px;
}
.modal-footer {
padding: 16px 24px;
border-top: 1px solid #e8e8e8;
display: flex;
gap: 8px;
justify-content: flex-end;
}
/* 表单样式 */
.form-group.form-item {
margin-bottom: 20px;
display: block;
}
.form-group.form-item label {
display: block;
margin-bottom: 8px;
font-weight: 500;
color: #333;
}
.form-group.form-item label.required::before {
content: '*';
color: #ff4d4f;
margin-right: 4px;
}
.form-group.form-item input[type="text"],
.form-group.form-item select {
width: 100%;
padding: 8px 12px;
border: 1px solid #d9d9d9;
border-radius: 4px;
font-size: 14px;
}
.form-group.form-item input[type="text"]:focus,
.form-group.form-item select:focus {
outline: none;
border-color: #40a9ff;
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}
.error-message {
color: #ff4d4f;
font-size: 12px;
margin-top: 4px;
}
/* 开关样式 */
.switch-wrapper {
display: flex;
align-items: center;
}
.switch {
position: relative;
display: inline-block;
width: 180px;
height: 32px;
cursor: pointer;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.switch-slider {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #f0f0f0;
border-radius: 16px;
transition: all 0.3s;
display: flex;
align-items: center;
justify-content: space-between;
padding: 4px;
border: 1px solid #d9d9d9;
}
.switch input:checked + .switch-slider {
background: #1890ff;
border-color: #1890ff;
}
.switch-slider::before {
content: '';
position: absolute;
height: 24px;
width: 80px;
left: 4px;
background: #fff;
border-radius: 12px;
transition: all 0.3s;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.switch input:checked + .switch-slider::before {
transform: translateX(92px);
}
.switch-option {
font-size: 12px;
font-weight: 500;
z-index: 1;
padding: 0 12px;
transition: color 0.3s;
}
.switch-option.disabled {
color: #999;
}
.switch-option.enabled {
color: #fff;
}
.switch input:checked ~ .switch-slider .disabled {
color: #fff;
}
.switch input:checked ~ .switch-slider .enabled {
color: #1890ff;
}
/* 上传区域样式 */
.upload-area {
border: 2px dashed #d9d9d9;
border-radius: 6px;
padding: 40px 20px;
text-align: center;
cursor: pointer;
transition: border-color 0.3s;
background: #fafafa;
}
.upload-icon {
font-size: 32px;
margin-bottom: 12px;
opacity: 0.6;
}
.upload-text {
color: #666;
font-size: 14px;
}
.upload-link {
color: #1890ff;
cursor: pointer;
}
.upload-tips {
color: #999;
font-size: 12px;
margin-top: 8px;
}
/* 响应式设计 */
@media (max-width: 768px) {
.container {
padding: 10px;
}
.form-row {
flex-direction: column;
align-items: stretch;
gap: 12px;
}
.form-actions {
margin-left: 0;
}
.pagination-section {
flex-direction: column;
gap: 12px;
}
.pagination-info {
justify-content: center;
}
.modal-content {
width: 95vw;
}
}
</style>
</head>
<body>
<div class="container">
<!-- 页面标题 -->
<div class="page-header">
<h1 class="page-title">轮播图管理</h1>
</div>
<!-- 搜索过滤区域 -->
<div class="filter-section">
<div class="search-form">
<div class="form-item">
<label class="form-label">应用</label>
<select id="applicationSelect" class="form-input">
<option value="用户端">用户端</option>
<option value="商户端">商户端</option>
</select>
</div>
</div>
<div class="button-group">
<button class="btn btn-primary" id="searchBtn">查询</button>
<button class="btn btn-secondary" id="resetBtn">重置</button>
</div>
</div>
<!-- 操作按钮区域 -->
<div class="action-section">
<button class="btn btn-primary" id="addBannerBtn">新增轮播图</button>
<button class="btn btn-secondary" id="sortBtn">排序</button>
</div>
<!-- 表格区域 -->
<div class="table-section">
<div class="table-wrapper">
<table class="data-table">
<thead>
<tr>
<th>序号</th>
<th>名称</th>
<th>轮播图</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>春申菜市场主页1</td>
<td>
<img src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA2MCA0MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjYwIiBoZWlnaHQ9IjQwIiBmaWxsPSIjRjVGNUY1IiBzdHJva2U9IiNEREREREQiLz4KPHN2ZyB4PSIyMCIgeT0iMTAiIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJtMTQgMTAgOS0xMC02LjMgOS0xLjciIHN0cm9rZT0iIzk5OTk5OSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPHN2ZyB4PSIyIiB5PSIyIiB3aWR0aD0iOCIgaGVpZ2h0PSI4IiB2aWV3Qm94PSIwIDAgMjQgMjQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxjaXJjbGUgY3g9IjkiIGN5PSI5IiByPSIyIiBzdHJva2U9IiM5OTk5OTkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+Cjwvc3ZnPgo8L3N2Zz4K" alt="轮播图" class="banner-preview">
</td>
<td><span class="status status-enabled">已启用</span></td>
<td class="actions">
<button class="btn btn-link">编辑</button>
<button class="btn btn-link">删除</button>
</td>
</tr>
<tr>
<td>2</td>
<td>春申菜市场主页2</td>
<td>
<img src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA2MCA0MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjYwIiBoZWlnaHQ9IjQwIiBmaWxsPSIjRjVGNUY1IiBzdHJva2U9IiNEREREREQiLz4KPHN2ZyB4PSIyMCIgeT0iMTAiIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJtMTQgMTAgOS0xMC02LjMgOS0xLjciIHN0cm9rZT0iIzk5OTk5OSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPHN2ZyB4PSIyIiB5PSIyIiB3aWR0aD0iOCIgaGVpZ2h0PSI4IiB2aWV3Qm94PSIwIDAgMjQgMjQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxjaXJjbGUgY3g9IjkiIGN5PSI5IiByPSIyIiBzdHJva2U9IiM5OTk5OTkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+Cjwvc3ZnPgo8L3N2Zz4K" alt="轮播图" class="banner-preview">
</td>
<td><span class="status status-enabled">已启用</span></td>
<td class="actions">
<button class="btn btn-link">编辑</button>
<button class="btn btn-link">删除</button>
</td>
</tr>
</tbody>
</table>
</div>
<!-- 分页区域 -->
<div class="pagination">
<div class="pagination-info">共 177 条</div>
<div class="pagination-controls">
<div class="page-size-selector">
<select class="page-size-select">
<option value="10" selected>10条/页</option>
<option value="20">20条/页</option>
<option value="50">50条/页</option>
</select>
</div>
<div class="page-item disabled">«</div>
<div class="page-list">
<div class="page-item active">1</div>
<div class="page-item">2</div>
<div class="page-item">3</div>
<div class="page-item">4</div>
<div class="page-item">5</div>
<div class="page-item">6</div>
<div class="page-item ellipsis"></div>
<div class="page-item">18</div>
</div>
<div class="page-item">»</div>
<div class="page-jump">
前往 <input type="number" value="1" min="1">
</div>
</div>
</div>
</div>
</div>
<!-- 新增轮播图弹窗 -->
<div id="addBannerModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>添加轮播图</h3>
<button class="modal-close" id="closeModal">&times;</button>
</div>
<div class="modal-body">
<form id="bannerForm">
<div class="form-group form-item">
<label class="required">轮播图名称</label>
<input type="text" id="bannerName" placeholder="请输入轮播图名称">
<div class="error-message">不能为空。</div>
</div>
<div class="form-group form-item">
<label>状态</label>
<div class="switch-wrapper">
<label class="switch">
<input type="checkbox" id="bannerStatus" checked>
<span class="switch-slider">
<span class="switch-option disabled">禁用</span>
<span class="switch-option enabled">启用</span>
</span>
</label>
</div>
</div>
<div class="form-group form-item">
<label class="required">应用</label>
<div class="select-wrapper">
<select id="bannerApplication">
<option value="">请选择应用</option>
<option value="用户端">用户端</option>
<option value="商户端">商户端</option>
</select>
</div>
</div>
<div class="form-group form-item">
<label class="required">轮播图</label>
<div class="upload-area" id="uploadArea">
<div class="upload-icon">📁</div>
<div class="upload-text">
将文件拖到此处,或<span class="upload-link">点击上传</span>
</div>
</div>
<div class="upload-tips">只能上传jpg/png文件且不超过500kb</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" id="cancelBtn">取消</button>
<button class="btn btn-primary" id="confirmBtn">确认</button>
</div>
</div>
</div>
<script>
// 简化的JavaScript仅用于UI交互演示
document.addEventListener('DOMContentLoaded', function() {
// 新增轮播图按钮
document.getElementById('addBannerBtn').addEventListener('click', function() {
document.getElementById('addBannerModal').classList.add('show');
});
// 关闭弹窗
function closeModal() {
document.getElementById('addBannerModal').classList.remove('show');
}
document.getElementById('closeModal').addEventListener('click', closeModal);
document.getElementById('cancelBtn').addEventListener('click', closeModal);
// 点击弹窗背景关闭
document.getElementById('addBannerModal').addEventListener('click', function(e) {
if (e.target.id === 'addBannerModal') {
closeModal();
}
});
// 确认按钮
document.getElementById('confirmBtn').addEventListener('click', function() {
// 这里只是演示,不做实际处理
alert('这是演示页面,确认按钮已点击');
closeModal();
});
// 搜索和重置按钮(仅演示)
document.getElementById('searchBtn').addEventListener('click', function() {
alert('这是演示页面,查询功能已触发');
});
document.getElementById('resetBtn').addEventListener('click', function() {
alert('这是演示页面,重置功能已触发');
});
// 排序按钮(仅演示)
document.getElementById('sortBtn').addEventListener('click', function() {
alert('这是演示页面,排序功能已触发');
});
});
</script>
</body>
</html>