我要开发一个h5的项目。 目标平台是PC浏览器和手机浏览器。 分为前端和后端。 后端采用python 不需要数据库,直接用文件系统,启动的时候读取到内存就可以。

功能
1、是前端能从后端拉起一组图片,分类为“男”,“女”。 这个图片是保存到oss文件系统的,后端需要提供图片的url。
2、前端可以选择一个图片,手动端可以拍摄图片或者选择图片。
3、前端发起更换发型的请求,把选择的图片和对应要更换的发型ID发给后端。
4、前端收到后端更换发型的请求后处理图片返回给前端。
5、后端实际处理更换发型请求的时候会调用另外一个远程的http接口来实现。
先帮我把项目结构,产品文档,系统框架等做出来。
This commit is contained in:
xsl
2026-01-18 18:22:58 +08:00
commit 9a00ac3907
12 changed files with 1694 additions and 0 deletions
+408
View File
@@ -0,0 +1,408 @@
/* 全局样式 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background-color: #f5f5f5;
color: #333;
line-height: 1.6;
}
/* 应用容器 */
#app {
max-width: 1200px;
margin: 0 auto;
min-height: 100vh;
background-color: white;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
/* 导航栏 */
.navbar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 1rem 2rem;
background-color: #4A90E2;
color: white;
position: sticky;
top: 0;
z-index: 100;
}
.navbar h1 {
font-size: 1.5rem;
font-weight: 600;
}
.back-btn {
background: none;
border: none;
color: white;
font-size: 1rem;
cursor: pointer;
padding: 0.5rem;
border-radius: 4px;
transition: background-color 0.3s;
}
.back-btn:hover {
background-color: rgba(255, 255, 255, 0.2);
}
/* 主内容区 */
.main-content {
padding: 2rem;
min-height: calc(100vh - 70px);
}
/* 页面切换 */
.page {
display: none;
}
.page.active {
display: block;
}
/* 图片上传区 */
.upload-area {
margin-bottom: 3rem;
}
.image-preview {
width: 100%;
max-width: 400px;
height: 400px;
margin: 0 auto;
border: 2px dashed #ddd;
border-radius: 8px;
overflow: hidden;
position: relative;
display: flex;
align-items: center;
justify-content: center;
background-color: #fafafa;
}
.upload-placeholder {
text-align: center;
cursor: pointer;
padding: 2rem;
}
.upload-icon {
font-size: 4rem;
margin-bottom: 1rem;
}
.upload-placeholder p {
color: #999;
margin-bottom: 1rem;
}
#imageUpload {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
cursor: pointer;
}
.image-preview img {
width: 100%;
height: 100%;
object-fit: cover;
}
/* 发型分类入口 */
.category-section {
text-align: center;
}
.category-section h2 {
margin-bottom: 2rem;
color: #333;
}
.category-buttons {
display: flex;
justify-content: center;
gap: 2rem;
flex-wrap: wrap;
}
.category-btn {
display: flex;
flex-direction: column;
align-items: center;
padding: 2rem;
border: 2px solid #4A90E2;
border-radius: 12px;
background-color: white;
cursor: pointer;
transition: all 0.3s;
min-width: 150px;
}
.category-btn:hover {
background-color: #4A90E2;
color: white;
transform: translateY(-5px);
box-shadow: 0 5px 15px rgba(74, 144, 226, 0.3);
}
.gender-icon {
font-size: 3rem;
margin-bottom: 1rem;
}
/* 分类导航 */
.category-nav {
display: flex;
margin-bottom: 2rem;
border-bottom: 2px solid #eee;
}
.nav-category-btn {
flex: 1;
padding: 1rem;
background: none;
border: none;
font-size: 1rem;
cursor: pointer;
transition: all 0.3s;
border-bottom: 3px solid transparent;
}
.nav-category-btn.active {
border-bottom-color: #4A90E2;
color: #4A90E2;
font-weight: 600;
}
/* 发型列表 */
.hairstyle-list h2 {
margin-bottom: 2rem;
color: #333;
}
.hairstyle-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
gap: 1.5rem;
margin-bottom: 3rem;
}
.hairstyle-item {
border: 2px solid #eee;
border-radius: 8px;
overflow: hidden;
cursor: pointer;
transition: all 0.3s;
}
.hairstyle-item:hover {
border-color: #4A90E2;
transform: translateY(-5px);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}
.hairstyle-item.selected {
border-color: #4A90E2;
box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}
.hairstyle-item img {
width: 100%;
height: 150px;
object-fit: cover;
}
.hairstyle-item p {
padding: 0.5rem;
text-align: center;
font-size: 0.9rem;
}
/* 确认按钮 */
.confirm-section {
margin-top: 3rem;
text-align: center;
}
.confirm-btn {
padding: 1rem 3rem;
background-color: #50E3C2;
color: white;
border: none;
border-radius: 8px;
font-size: 1.1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
}
.confirm-btn:hover:not(:disabled) {
background-color: #38D1B0;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(80, 227, 194, 0.3);
}
.confirm-btn:disabled {
background-color: #ccc;
cursor: not-allowed;
}
/* 结果预览 */
.result-section {
margin-bottom: 3rem;
}
.result-section h2 {
margin-bottom: 2rem;
color: #333;
}
.result-preview {
width: 100%;
max-width: 500px;
height: 500px;
margin: 0 auto;
border: 2px solid #eee;
border-radius: 8px;
overflow: hidden;
background-color: #fafafa;
display: flex;
align-items: center;
justify-content: center;
}
.result-preview img {
width: 100%;
height: 100%;
object-fit: cover;
}
/* 操作按钮 */
.action-buttons {
display: flex;
flex-direction: column;
gap: 1rem;
max-width: 400px;
margin: 0 auto;
}
.action-btn {
display: flex;
align-items: center;
justify-content: center;
padding: 1rem;
border: 2px solid #4A90E2;
border-radius: 8px;
background-color: white;
color: #4A90E2;
cursor: pointer;
transition: all 0.3s;
}
.action-btn:hover {
background-color: #4A90E2;
color: white;
}
.action-icon {
font-size: 1.2rem;
margin-right: 0.5rem;
}
/* 加载指示器 */
.loading {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.9);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
z-index: 1000;
}
.loading-spinner {
width: 50px;
height: 50px;
border: 5px solid #f3f3f3;
border-top: 5px solid #4A90E2;
border-radius: 50%;
animation: spin 1s linear infinite;
margin-bottom: 1rem;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* 响应式设计 */
@media (max-width: 768px) {
.main-content {
padding: 1rem;
}
.navbar {
padding: 1rem;
}
.navbar h1 {
font-size: 1.2rem;
}
.image-preview {
height: 300px;
}
.category-buttons {
flex-direction: column;
align-items: center;
}
.category-btn {
width: 200px;
}
.hairstyle-grid {
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
gap: 1rem;
}
.hairstyle-item img {
height: 120px;
}
.result-preview {
height: 400px;
}
}
@media (max-width: 480px) {
.image-preview {
height: 250px;
}
.hairstyle-grid {
grid-template-columns: repeat(3, 1fr);
}
.result-preview {
height: 300px;
}
}