677 lines
22 KiB
HTML
677 lines
22 KiB
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>
|
|||
|
|
<style>
|
|||
|
|
* {
|
|||
|
|
margin: 0;
|
|||
|
|
padding: 0;
|
|||
|
|
box-sizing: border-box;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
body {
|
|||
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|||
|
|
background-color: #f5f5f5;
|
|||
|
|
color: #333;
|
|||
|
|
width: 100%;
|
|||
|
|
height: 100vh;
|
|||
|
|
overflow: hidden;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 头部样式 */
|
|||
|
|
.header {
|
|||
|
|
background-color: rgb(9, 84, 43);
|
|||
|
|
color: #fff;
|
|||
|
|
padding: 20px 30px;
|
|||
|
|
display: flex;
|
|||
|
|
justify-content: space-between;
|
|||
|
|
align-items: center;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.header h1 {
|
|||
|
|
font-size: 24px;
|
|||
|
|
font-weight: 500;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 主内容区域 */
|
|||
|
|
.main-content {
|
|||
|
|
height: calc(100vh - 64px);
|
|||
|
|
overflow-y: auto;
|
|||
|
|
padding: 20px;
|
|||
|
|
max-width: 1600px;
|
|||
|
|
margin: 0 auto;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 页面标题 */
|
|||
|
|
.page-title {
|
|||
|
|
font-size: 24px;
|
|||
|
|
font-weight: 600;
|
|||
|
|
color: #262626;
|
|||
|
|
background: white;
|
|||
|
|
padding: 16px 24px;
|
|||
|
|
margin-bottom: 16px;
|
|||
|
|
border-radius: 8px;
|
|||
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 区块标题 */
|
|||
|
|
.section-title {
|
|||
|
|
font-size: 16px;
|
|||
|
|
font-weight: 600;
|
|||
|
|
color: #262626;
|
|||
|
|
margin-top: 16px;
|
|||
|
|
margin-bottom: 12px;
|
|||
|
|
padding-left: 12px;
|
|||
|
|
border-left: 3px solid #1890ff;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.section-title:first-of-type {
|
|||
|
|
margin-top: 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 内容卡片 */
|
|||
|
|
.info-content {
|
|||
|
|
background: white;
|
|||
|
|
padding: 24px;
|
|||
|
|
margin-bottom: 16px;
|
|||
|
|
border-radius: 8px;
|
|||
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|||
|
|
display: flex;
|
|||
|
|
flex-wrap: wrap;
|
|||
|
|
gap: 16px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.info-item {
|
|||
|
|
width: calc(50% - 8px);
|
|||
|
|
min-width: 250px;
|
|||
|
|
font-size: 14px;
|
|||
|
|
line-height: 1.6;
|
|||
|
|
display: flex;
|
|||
|
|
align-items: flex-start;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.info-item .label {
|
|||
|
|
font-weight: 500;
|
|||
|
|
color: #333;
|
|||
|
|
min-width: 100px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.info-item .value {
|
|||
|
|
flex: 1;
|
|||
|
|
color: #666;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 图片预览 */
|
|||
|
|
.image-preview {
|
|||
|
|
margin-left: 12px;
|
|||
|
|
border: 1px solid #f0f0f0;
|
|||
|
|
border-radius: 4px;
|
|||
|
|
overflow: hidden;
|
|||
|
|
cursor: pointer;
|
|||
|
|
transition: all 0.3s;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.image-preview:hover {
|
|||
|
|
transform: translateY(-2px);
|
|||
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.image-preview img {
|
|||
|
|
width: 100px;
|
|||
|
|
height: 100px;
|
|||
|
|
object-fit: cover;
|
|||
|
|
display: block;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 视频预览 */
|
|||
|
|
.video-preview {
|
|||
|
|
margin-left: 12px;
|
|||
|
|
border: 1px solid #f0f0f0;
|
|||
|
|
border-radius: 4px;
|
|||
|
|
overflow: hidden;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.video-preview video {
|
|||
|
|
width: 200px;
|
|||
|
|
height: 100px;
|
|||
|
|
object-fit: fill;
|
|||
|
|
display: block;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 编辑按钮 */
|
|||
|
|
.edit-btn {
|
|||
|
|
color: #1890ff;
|
|||
|
|
font-size: 14px;
|
|||
|
|
cursor: pointer;
|
|||
|
|
margin-left: 8px;
|
|||
|
|
transition: all 0.3s;
|
|||
|
|
text-decoration: none;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.edit-btn:hover {
|
|||
|
|
color: #40a9ff;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 操作按钮 */
|
|||
|
|
.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-primary {
|
|||
|
|
background: #1890ff;
|
|||
|
|
color: white;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.btn-primary:hover {
|
|||
|
|
background: #40a9ff;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.btn-success {
|
|||
|
|
background: #52c41a;
|
|||
|
|
color: white;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.btn-success:hover {
|
|||
|
|
background: #73d13d;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 模态框 */
|
|||
|
|
.modal {
|
|||
|
|
display: none;
|
|||
|
|
position: fixed;
|
|||
|
|
top: 0;
|
|||
|
|
left: 0;
|
|||
|
|
width: 100%;
|
|||
|
|
height: 100%;
|
|||
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|||
|
|
z-index: 1000;
|
|||
|
|
animation: fadeIn 0.3s ease-in-out;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.modal.active {
|
|||
|
|
display: flex;
|
|||
|
|
justify-content: center;
|
|||
|
|
align-items: center;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@keyframes fadeIn {
|
|||
|
|
from {
|
|||
|
|
opacity: 0;
|
|||
|
|
}
|
|||
|
|
to {
|
|||
|
|
opacity: 1;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.modal-content {
|
|||
|
|
background: white;
|
|||
|
|
border-radius: 8px;
|
|||
|
|
width: 90%;
|
|||
|
|
max-width: 600px;
|
|||
|
|
max-height: 90vh;
|
|||
|
|
overflow-y: auto;
|
|||
|
|
animation: slideIn 0.3s ease-in-out;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@keyframes slideIn {
|
|||
|
|
from {
|
|||
|
|
transform: translateY(-50px);
|
|||
|
|
opacity: 0;
|
|||
|
|
}
|
|||
|
|
to {
|
|||
|
|
transform: translateY(0);
|
|||
|
|
opacity: 1;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.modal-header {
|
|||
|
|
padding: 16px 24px;
|
|||
|
|
border-bottom: 1px solid #f0f0f0;
|
|||
|
|
display: flex;
|
|||
|
|
justify-content: space-between;
|
|||
|
|
align-items: center;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.modal-header h3 {
|
|||
|
|
font-size: 18px;
|
|||
|
|
font-weight: 600;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.modal-close {
|
|||
|
|
font-size: 24px;
|
|||
|
|
cursor: pointer;
|
|||
|
|
color: #999;
|
|||
|
|
transition: color 0.3s ease;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.modal-close:hover {
|
|||
|
|
color: #333;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.modal-body {
|
|||
|
|
padding: 24px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.modal-footer {
|
|||
|
|
padding: 16px 24px;
|
|||
|
|
border-top: 1px solid #f0f0f0;
|
|||
|
|
display: flex;
|
|||
|
|
justify-content: flex-end;
|
|||
|
|
gap: 12px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 表单样式 */
|
|||
|
|
.form-group {
|
|||
|
|
margin-bottom: 16px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.form-group label {
|
|||
|
|
display: block;
|
|||
|
|
font-weight: 500;
|
|||
|
|
margin-bottom: 8px;
|
|||
|
|
color: #333;
|
|||
|
|
font-size: 14px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.form-group input[type="text"],
|
|||
|
|
.form-group textarea {
|
|||
|
|
width: 100%;
|
|||
|
|
padding: 0 12px;
|
|||
|
|
height: 40px;
|
|||
|
|
border: 1px solid #ddd;
|
|||
|
|
border-radius: 6px;
|
|||
|
|
font-size: 14px;
|
|||
|
|
transition: all 0.3s;
|
|||
|
|
background-color: #fafafa;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.form-group input[type="text"]:focus,
|
|||
|
|
.form-group textarea:focus {
|
|||
|
|
outline: none;
|
|||
|
|
border-color: #1890ff;
|
|||
|
|
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
|
|||
|
|
background-color: white;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.form-group textarea {
|
|||
|
|
resize: vertical;
|
|||
|
|
min-height: 80px;
|
|||
|
|
padding-top: 10px;
|
|||
|
|
padding-bottom: 10px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.form-group select {
|
|||
|
|
width: 100%;
|
|||
|
|
height: 40px;
|
|||
|
|
padding: 0 12px;
|
|||
|
|
border: 1px solid #ddd;
|
|||
|
|
border-radius: 6px;
|
|||
|
|
font-size: 14px;
|
|||
|
|
background-color: #fafafa;
|
|||
|
|
cursor: pointer;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.form-group select:focus {
|
|||
|
|
outline: none;
|
|||
|
|
border-color: #1890ff;
|
|||
|
|
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 文件上传 */
|
|||
|
|
.file-upload {
|
|||
|
|
border: 2px dashed #ddd;
|
|||
|
|
border-radius: 6px;
|
|||
|
|
padding: 20px;
|
|||
|
|
text-align: center;
|
|||
|
|
cursor: pointer;
|
|||
|
|
transition: all 0.3s;
|
|||
|
|
background-color: #fafafa;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.file-upload:hover {
|
|||
|
|
border-color: #1890ff;
|
|||
|
|
background-color: #e6f7ff;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.file-upload input[type="file"] {
|
|||
|
|
display: none;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.file-upload-text {
|
|||
|
|
color: #666;
|
|||
|
|
font-size: 14px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.file-preview {
|
|||
|
|
margin-top: 8px;
|
|||
|
|
display: flex;
|
|||
|
|
gap: 8px;
|
|||
|
|
flex-wrap: wrap;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.file-preview img {
|
|||
|
|
width: 80px;
|
|||
|
|
height: 80px;
|
|||
|
|
object-fit: cover;
|
|||
|
|
border-radius: 4px;
|
|||
|
|
border: 1px solid #f0f0f0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 响应式设计 */
|
|||
|
|
@media (max-width: 768px) {
|
|||
|
|
.header {
|
|||
|
|
flex-direction: column;
|
|||
|
|
gap: 8px;
|
|||
|
|
padding: 15px 20px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.main-content {
|
|||
|
|
padding: 16px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.info-item {
|
|||
|
|
width: 100%;
|
|||
|
|
min-width: auto;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.modal-content {
|
|||
|
|
width: 95%;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.modal-body {
|
|||
|
|
padding: 20px;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 状态标签 */
|
|||
|
|
.status-badge {
|
|||
|
|
display: inline-block;
|
|||
|
|
padding: 4px 8px;
|
|||
|
|
border-radius: 4px;
|
|||
|
|
font-size: 12px;
|
|||
|
|
font-weight: 500;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.status-badge.active {
|
|||
|
|
background: #f6ffed;
|
|||
|
|
color: #52c41a;
|
|||
|
|
border: 1px solid #b7eb8f;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.status-badge.inactive {
|
|||
|
|
background: #fff2f0;
|
|||
|
|
color: #ff4d4f;
|
|||
|
|
border: 1px solid #ffb3b3;
|
|||
|
|
}
|
|||
|
|
</style>
|
|||
|
|
</head>
|
|||
|
|
<body>
|
|||
|
|
<!-- 主内容区域 -->
|
|||
|
|
<main class="main-content">
|
|||
|
|
<div class="page-title">品牌管理</div>
|
|||
|
|
|
|||
|
|
<!-- 品牌信息 -->
|
|||
|
|
<div class="section-title">
|
|||
|
|
品牌信息
|
|||
|
|
<span class="edit-btn" onclick="openEditModal()">编辑</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="info-content">
|
|||
|
|
<div class="info-item">
|
|||
|
|
<span class="label">品牌名称:</span>
|
|||
|
|
<span class="value" id="brandName">示例品牌</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="info-item" style="width: 100%;">
|
|||
|
|
<span class="label">品牌LOGO:</span>
|
|||
|
|
<div class="image-preview" id="logoPreview">
|
|||
|
|
<img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Crect fill='%23f0f0f0' width='100' height='100'/%3E%3Ctext fill='%23999' x='50%25' y='50%25' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='14'%3ELOGO%3C/text%3E%3C/svg%3E" alt="品牌LOGO">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="info-item" style="width: 100%;">
|
|||
|
|
<span class="label">品牌背景:</span>
|
|||
|
|
<div class="image-preview" id="backgroundPreview">
|
|||
|
|
<img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Crect fill='%23f0f0f0' width='100' height='100'/%3E%3Ctext fill='%23999' x='50%25' y='50%25' dominant-baseline='middle' text-anchor='middle' font-family='sans-serif' font-size='12'%3E背景图%3C/text%3E%3C/svg%3E" alt="品牌背景">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="info-item">
|
|||
|
|
<span class="label">品牌首页:</span>
|
|||
|
|
<span class="value">
|
|||
|
|
<span class="status-badge active" id="homepageStatus">启用</span>
|
|||
|
|
</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="info-item" style="width: 100%;">
|
|||
|
|
<span class="label">宣传语:</span>
|
|||
|
|
<span class="value" id="tagline">打造优质品牌,服务千家万户</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="info-item" style="width: 100%;">
|
|||
|
|
<span class="label">宣传视频:</span>
|
|||
|
|
<div class="video-preview" id="videoPreview">
|
|||
|
|
<video controls muted loop>
|
|||
|
|
<source src="" type="video/mp4">
|
|||
|
|
暂无宣传视频
|
|||
|
|
</video>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<!-- 品牌展示 -->
|
|||
|
|
<div class="section-title">品牌展示</div>
|
|||
|
|
<div class="info-content">
|
|||
|
|
<div class="info-item">
|
|||
|
|
<span class="label">品牌联系人:</span>
|
|||
|
|
<span class="value" id="contact">张经理</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="info-item">
|
|||
|
|
<span class="label">联系方式:</span>
|
|||
|
|
<span class="value" id="contactPhone">138****8888</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="info-item" style="width: 100%;">
|
|||
|
|
<span class="label">品牌简介:</span>
|
|||
|
|
<span class="value" id="description">这是一个致力于提供优质服务的品牌,专注于用户体验和产品质量的提升。</span>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</main>
|
|||
|
|
|
|||
|
|
<!-- 编辑模态框 -->
|
|||
|
|
<div class="modal" id="editModal">
|
|||
|
|
<div class="modal-content">
|
|||
|
|
<div class="modal-header">
|
|||
|
|
<h3>编辑品牌信息</h3>
|
|||
|
|
<span class="modal-close" onclick="closeEditModal()">×</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal-body">
|
|||
|
|
<form id="editForm">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label for="editBrandName">品牌名称</label>
|
|||
|
|
<input type="text" id="editBrandName" placeholder="请输入品牌名称">
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label for="editTagline">宣传语</label>
|
|||
|
|
<input type="text" id="editTagline" placeholder="请输入宣传语">
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label for="editHomepageStatus">品牌首页</label>
|
|||
|
|
<select id="editHomepageStatus">
|
|||
|
|
<option value="1">启用</option>
|
|||
|
|
<option value="0">禁用</option>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label>品牌LOGO</label>
|
|||
|
|
<div class="file-upload" onclick="document.getElementById('logoInput').click()">
|
|||
|
|
<input type="file" id="logoInput" accept="image/*" onchange="handleFileUpload(event, 'logo')">
|
|||
|
|
<div class="file-upload-text">点击上传LOGO图片</div>
|
|||
|
|
<div class="file-preview" id="logoFilePreview"></div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label>品牌背景</label>
|
|||
|
|
<div class="file-upload" onclick="document.getElementById('backgroundInput').click()">
|
|||
|
|
<input type="file" id="backgroundInput" accept="image/*" onchange="handleFileUpload(event, 'background')">
|
|||
|
|
<div class="file-upload-text">点击上传背景图片</div>
|
|||
|
|
<div class="file-preview" id="backgroundFilePreview"></div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label>宣传视频</label>
|
|||
|
|
<div class="file-upload" onclick="document.getElementById('videoInput').click()">
|
|||
|
|
<input type="file" id="videoInput" accept="video/*" onchange="handleFileUpload(event, 'video')">
|
|||
|
|
<div class="file-upload-text">点击上传宣传视频</div>
|
|||
|
|
<div class="file-preview" id="videoFilePreview"></div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label for="editContact">品牌联系人</label>
|
|||
|
|
<input type="text" id="editContact" placeholder="请输入联系人姓名">
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label for="editContactPhone">联系方式</label>
|
|||
|
|
<input type="text" id="editContactPhone" placeholder="请输入联系电话">
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label for="editDescription">品牌简介</label>
|
|||
|
|
<textarea id="editDescription" placeholder="请输入品牌简介"></textarea>
|
|||
|
|
</div>
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal-footer">
|
|||
|
|
<button class="btn btn-primary" onclick="closeEditModal()">取消</button>
|
|||
|
|
<button class="btn btn-success" onclick="saveBrandInfo()">保存</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<script>
|
|||
|
|
// 品牌数据
|
|||
|
|
let brandData = {
|
|||
|
|
name: '示例品牌',
|
|||
|
|
id: '10001',
|
|||
|
|
logo: '',
|
|||
|
|
background: '',
|
|||
|
|
homepageStatus: 1,
|
|||
|
|
tagline: '打造优质品牌,服务千家万户',
|
|||
|
|
video: '',
|
|||
|
|
contact: '张经理',
|
|||
|
|
contactPhone: '138****8888',
|
|||
|
|
description: '这是一个致力于提供优质服务的品牌,专注于用户体验和产品质量的提升。'
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// 打开编辑模态框
|
|||
|
|
function openEditModal() {
|
|||
|
|
document.getElementById('editModal').classList.add('active');
|
|||
|
|
// 填充当前数据
|
|||
|
|
document.getElementById('editBrandName').value = brandData.name;
|
|||
|
|
document.getElementById('editTagline').value = brandData.tagline;
|
|||
|
|
document.getElementById('editHomepageStatus').value = brandData.homepageStatus;
|
|||
|
|
document.getElementById('editContact').value = brandData.contact;
|
|||
|
|
document.getElementById('editContactPhone').value = brandData.contactPhone;
|
|||
|
|
document.getElementById('editDescription').value = brandData.description;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 关闭编辑模态框
|
|||
|
|
function closeEditModal() {
|
|||
|
|
document.getElementById('editModal').classList.remove('active');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 处理文件上传
|
|||
|
|
function handleFileUpload(event, type) {
|
|||
|
|
const file = event.target.files[0];
|
|||
|
|
if (!file) return;
|
|||
|
|
|
|||
|
|
const reader = new FileReader();
|
|||
|
|
reader.onload = function(e) {
|
|||
|
|
const previewId = type + 'FilePreview';
|
|||
|
|
const preview = document.getElementById(previewId);
|
|||
|
|
|
|||
|
|
if (type === 'video') {
|
|||
|
|
preview.innerHTML = `<video src="${e.target.result}" style="width: 100px; height: 100px; object-fit: cover; border-radius: 4px;" controls></video>`;
|
|||
|
|
} else {
|
|||
|
|
preview.innerHTML = `<img src="${e.target.result}" alt="${type}">`;
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
reader.readAsDataURL(file);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 保存品牌信息
|
|||
|
|
function saveBrandInfo() {
|
|||
|
|
// 获取表单数据
|
|||
|
|
brandData.name = document.getElementById('editBrandName').value;
|
|||
|
|
brandData.tagline = document.getElementById('editTagline').value;
|
|||
|
|
brandData.homepageStatus = parseInt(document.getElementById('editHomepageStatus').value);
|
|||
|
|
brandData.contact = document.getElementById('editContact').value;
|
|||
|
|
brandData.contactPhone = document.getElementById('editContactPhone').value;
|
|||
|
|
brandData.description = document.getElementById('editDescription').value;
|
|||
|
|
|
|||
|
|
// 更新显示
|
|||
|
|
document.getElementById('brandName').textContent = brandData.name;
|
|||
|
|
document.getElementById('tagline').textContent = brandData.tagline;
|
|||
|
|
document.getElementById('contact').textContent = brandData.contact;
|
|||
|
|
document.getElementById('contactPhone').textContent = brandData.contactPhone;
|
|||
|
|
document.getElementById('description').textContent = brandData.description;
|
|||
|
|
|
|||
|
|
// 更新状态标签
|
|||
|
|
const statusBadge = document.getElementById('homepageStatus');
|
|||
|
|
if (brandData.homepageStatus === 1) {
|
|||
|
|
statusBadge.textContent = '启用';
|
|||
|
|
statusBadge.className = 'status-badge active';
|
|||
|
|
} else {
|
|||
|
|
statusBadge.textContent = '禁用';
|
|||
|
|
statusBadge.className = 'status-badge inactive';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 处理文件上传(实际应用中需要上传到服务器)
|
|||
|
|
const logoInput = document.getElementById('logoInput');
|
|||
|
|
if (logoInput.files[0]) {
|
|||
|
|
const reader = new FileReader();
|
|||
|
|
reader.onload = function(e) {
|
|||
|
|
document.querySelector('#logoPreview img').src = e.target.result;
|
|||
|
|
};
|
|||
|
|
reader.readAsDataURL(logoInput.files[0]);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
const backgroundInput = document.getElementById('backgroundInput');
|
|||
|
|
if (backgroundInput.files[0]) {
|
|||
|
|
const reader = new FileReader();
|
|||
|
|
reader.onload = function(e) {
|
|||
|
|
document.querySelector('#backgroundPreview img').src = e.target.result;
|
|||
|
|
};
|
|||
|
|
reader.readAsDataURL(backgroundInput.files[0]);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
const videoInput = document.getElementById('videoInput');
|
|||
|
|
if (videoInput.files[0]) {
|
|||
|
|
const reader = new FileReader();
|
|||
|
|
reader.onload = function(e) {
|
|||
|
|
document.querySelector('#videoPreview video source').src = e.target.result;
|
|||
|
|
document.querySelector('#videoPreview video').load();
|
|||
|
|
};
|
|||
|
|
reader.readAsDataURL(videoInput.files[0]);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 关闭模态框
|
|||
|
|
closeEditModal();
|
|||
|
|
|
|||
|
|
// 显示保存成功提示
|
|||
|
|
alert('品牌信息保存成功!');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 点击模态框背景关闭
|
|||
|
|
document.getElementById('editModal').addEventListener('click', function(e) {
|
|||
|
|
if (e.target === this) {
|
|||
|
|
closeEditModal();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
</script>
|
|||
|
|
</body>
|
|||
|
|
</html>
|