Files
oil-formula-calculator/frontend/src/assets/styles.css
Hera Zhao a8e91dc384
All checks were successful
Deploy Production / test (push) Successful in 4s
Test / unit-test (push) Successful in 4s
Test / build-check (push) Successful in 4s
PR Preview / deploy-preview (pull_request) Has been skipped
PR Preview / test (pull_request) Has been skipped
PR Preview / teardown-preview (pull_request) Successful in 13s
Deploy Production / deploy (push) Successful in 7s
Test / e2e-test (push) Successful in 52s
feat: 权限修复、搜索改进、滑动切换、通知badge
权限:
- viewer 不能编辑公共配方(前端+后端双重限制)
- viewer 管理配方页只显示"我的配方"
- 取消 token 链接登录,改为自注册+管理员分配角色
- 用户管理页去掉创建用户和复制链接,禁止设管理员
- 修复改权限 API 路径错误

搜索:
- 模糊匹配+同义词扩展(37组),精确/相似分层
- 精确匹配不搜精油成分(避免"西班牙牛至"污染)
- 所有搜索结果底部加"通知编辑添加"按钮

UI:
- 顶部 tab 栏按用户角色显示,切换时居中滚动
- 左右滑动按 visibleTabs 顺序切换 tab
- 用户名旁红色通知数 badge

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 21:31:17 +00:00

520 lines
18 KiB
CSS

:root {
--cream: #faf6f0;
--warm-white: #fffdf9;
--sage: #7a9e7e;
--sage-dark: #5a7d5e;
--sage-light: #c8ddc9;
--sage-mist: #eef4ee;
--gold: #c9a84c;
--gold-light: #f0e4c0;
--brown: #6b4f3a;
--brown-light: #c4a882;
--text-dark: #2c2416;
--text-mid: #5a4a35;
--text-light: #9a8570;
--border: #e0d4c0;
--shadow: 0 4px 20px rgba(90,60,30,0.08);
--shadow-hover: 0 8px 32px rgba(90,60,30,0.15);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Noto Sans SC', sans-serif;
background: var(--cream);
color: var(--text-dark);
min-height: 100vh;
}
/* Header */
.app-header {
background: linear-gradient(135deg, #3d6b41 0%, #5a7d5e 50%, #7a9e7e 100%);
padding: 28px 32px 24px;
position: relative;
overflow: hidden;
}
.app-header::before {
content: '';
position: absolute; inset: 0;
background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.header-inner { position: relative; z-index: 1; display: flex; align-items: center; gap: 16px; }
.header-icon { font-size: 40px; }
.header-title { color: white; }
.header-title h1 { font-family: 'Noto Serif SC', serif; font-size: 24px; font-weight: 600; letter-spacing: 2px; }
.header-title p { font-size: 13px; opacity: 0.8; margin-top: 4px; letter-spacing: 1px; }
/* Nav tabs */
.nav-tabs {
display: flex;
background: white;
border-bottom: 1px solid var(--border);
padding: 0 24px;
gap: 0;
overflow-x: auto;
position: sticky;
top: 0;
z-index: 50;
}
.nav-tab {
padding: 14px 20px;
font-size: 14px;
font-weight: 500;
color: var(--text-light);
cursor: pointer;
border-bottom: 3px solid transparent;
white-space: nowrap;
transition: all 0.2s;
}
.nav-tab:hover { color: var(--sage-dark); }
.nav-tab.active { color: var(--sage-dark); border-bottom-color: var(--sage); }
.section-title-bar {
display: flex;
justify-content: center;
align-items: center;
background: white;
padding: 12px 0;
position: sticky;
top: 0;
z-index: 50;
}
.section-title-text {
font-size: 15px;
font-weight: 600;
color: var(--sage-dark);
border-bottom: 2px solid var(--sage);
padding-bottom: 4px;
}
/* Main content */
.main { padding: 24px; max-width: 960px; margin: 0 auto; }
/* Section */
.section { max-width: 800px; margin-left: auto; margin-right: auto; }
/* Search box */
.search-box {
background: white;
border-radius: 16px;
padding: 20px 24px;
box-shadow: var(--shadow);
margin-bottom: 20px;
}
.search-label { font-size: 13px; color: var(--text-light); margin-bottom: 10px; letter-spacing: 0.5px; }
.search-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.search-input {
flex: 1; min-width: 200px;
padding: 11px 16px;
border: 1.5px solid var(--border);
border-radius: 10px;
font-size: 15px;
font-family: inherit;
color: var(--text-dark);
background: var(--cream);
transition: border-color 0.2s;
outline: none;
}
.search-input:focus { border-color: var(--sage); background: white; }
.btn {
padding: 11px 22px;
border-radius: 10px;
border: none;
font-size: 14px;
font-family: inherit;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
white-space: nowrap;
}
.btn-primary { background: var(--sage); color: white; }
.btn-primary:hover { background: var(--sage-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(90,125,94,0.3); }
.btn-gold { background: var(--gold); color: white; }
.btn-gold:hover { background: #b8973e; transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--sage-dark); border: 1.5px solid var(--sage); }
.btn-outline:hover { background: var(--sage-mist); }
.btn-danger { background: transparent; color: #c0392b; border: 1.5px solid #e8b4b0; }
.btn-danger:hover { background: #fdf0ee; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
/* Recipe grid */
.recipe-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
gap: 16px;
margin-bottom: 24px;
}
.recipe-card {
background: white;
border-radius: 14px;
padding: 18px;
cursor: pointer;
box-shadow: var(--shadow);
border: 2px solid transparent;
transition: all 0.2s;
position: relative;
}
.recipe-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--sage-light); }
.recipe-card.selected { border-color: var(--sage); background: var(--sage-mist); }
.recipe-card-name {
font-family: 'Noto Serif SC', serif;
font-size: 16px;
font-weight: 600;
color: var(--text-dark);
margin-bottom: 8px;
}
.recipe-card-oils { font-size: 12px; color: var(--text-light); line-height: 1.7; }
.recipe-card-price {
margin-top: 12px;
font-size: 13px;
color: var(--sage-dark);
font-weight: 600;
display: flex; align-items: center; gap: 6px;
}
/* Detail panel */
.detail-panel {
background: white;
border-radius: 16px;
padding: 28px;
box-shadow: var(--shadow);
margin-bottom: 24px;
}
.detail-header {
display: flex; justify-content: space-between; align-items: flex-start;
margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.detail-title {
font-family: 'Noto Serif SC', serif;
font-size: 22px; font-weight: 700; color: var(--text-dark);
}
.detail-note {
font-size: 13px; color: var(--text-light);
background: var(--gold-light); border-radius: 8px;
padding: 6px 12px; margin-top: 6px;
display: inline-block;
}
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }
/* Ingredients table */
.ingredients-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.ingredients-table th {
text-align: center; padding: 10px 14px;
font-size: 12px; font-weight: 600;
color: var(--text-light); letter-spacing: 0.5px;
border-bottom: 2px solid var(--border);
text-transform: uppercase;
}
.ingredients-table td {
padding: 12px 14px;
border-bottom: 1px solid var(--border);
font-size: 14px; vertical-align: middle;
text-align: center;
}
.ingredients-table tr:last-child td { border-bottom: none; }
.ingredients-table tr:hover td { background: var(--sage-mist); }
.drops-input {
width: 70px; padding: 6px 10px;
border: 1.5px solid var(--border); border-radius: 8px;
font-size: 14px; font-family: inherit; text-align: center;
outline: none; transition: border-color 0.2s;
}
.drops-input:focus { border-color: var(--sage); }
.oil-select {
padding: 6px 10px;
border: 1.5px solid var(--border); border-radius: 8px;
font-size: 13px; font-family: inherit;
background: white; outline: none;
max-width: 160px;
}
.oil-select:focus { border-color: var(--sage); }
.remove-btn {
background: none; border: none; cursor: pointer;
color: #c0392b; font-size: 18px; padding: 4px 8px;
border-radius: 6px; transition: background 0.2s;
}
.remove-btn:hover { background: #fdf0ee; }
.total-row {
background: var(--sage-mist);
border-radius: 12px; padding: 16px 20px;
display: flex; justify-content: space-between; align-items: center;
margin-top: 16px;
}
.total-label { font-size: 14px; color: var(--text-mid); font-weight: 500; }
.total-price { font-size: 22px; font-weight: 700; color: var(--sage-dark); }
/* Add ingredient */
.add-ingredient-row {
display: flex; gap: 10px; align-items: center;
margin-top: 12px; flex-wrap: wrap;
}
.add-ingredient-row select, .add-ingredient-row input {
padding: 8px 12px; border: 1.5px solid var(--border);
border-radius: 8px; font-size: 13px; font-family: inherit;
outline: none;
}
.add-ingredient-row select:focus, .add-ingredient-row input:focus { border-color: var(--sage); }
/* Card preview for export */
.card-preview-wrapper { margin-top: 20px; }
.card-brand {
font-size: 11px; letter-spacing: 3px; color: var(--sage);
margin-bottom: 8px;
}
.card-title {
font-size: 26px; font-weight: 700; color: var(--text-dark);
margin-bottom: 6px; line-height: 1.3;
}
.card-divider {
width: 48px; height: 2px;
background: linear-gradient(90deg, var(--sage), var(--gold));
border-radius: 2px; margin: 14px 0;
}
.card-note { font-size: 12px; color: var(--brown-light); margin-bottom: 18px; }
.card-ingredients { list-style: none; margin-bottom: 20px; }
.card-ingredients li {
display: flex; align-items: center;
padding: 9px 0; border-bottom: 1px solid rgba(180,150,100,0.15);
font-size: 14px;
}
.card-ingredients li:last-child { border-bottom: none; }
.card-oil-name { flex: 1; color: var(--text-dark); font-weight: 500; }
.card-oil-drops { width: 60px; text-align: right; color: var(--sage-dark); font-size: 13px; }
.card-oil-cost { width: 70px; text-align: right; color: var(--text-light); font-size: 12px; }
.card-total {
background: linear-gradient(135deg, var(--sage), #5a7d5e);
border-radius: 12px; padding: 14px 20px;
display: flex; justify-content: space-between; align-items: center;
margin-top: 8px;
}
.card-total-label { color: rgba(255,255,255,0.85); font-size: 13px; letter-spacing: 1px; }
.card-total-price { color: white; font-size: 20px; font-weight: 700; }
.card-footer {
margin-top: 16px; text-align: center;
font-size: 11px; color: var(--text-light); letter-spacing: 1px;
}
/* Manage section */
.manage-list { display: flex; flex-direction: column; gap: 12px; }
.manage-item {
background: white; border-radius: 14px; padding: 18px 22px;
box-shadow: var(--shadow); display: flex;
justify-content: space-between; align-items: center;
gap: 12px; flex-wrap: wrap;
}
.manage-item-left { flex: 1; }
.manage-item-name { font-weight: 600; font-size: 16px; color: var(--text-dark); }
.manage-item-oils { font-size: 13px; color: var(--text-light); margin-top: 4px; }
.manage-item-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
/* Add recipe form */
.form-card {
background: white; border-radius: 16px;
padding: 28px; box-shadow: var(--shadow); margin-bottom: 24px;
}
.form-title { font-family: 'Noto Serif SC', serif; font-size: 18px; font-weight: 600; margin-bottom: 20px; color: var(--text-dark); }
.form-group { margin-bottom: 16px; }
.form-label { font-size: 13px; color: var(--text-mid); margin-bottom: 6px; display: block; font-weight: 500; }
.form-control {
width: 100%; padding: 10px 14px;
border: 1.5px solid var(--border); border-radius: 10px;
font-size: 14px; font-family: inherit; outline: none;
transition: border-color 0.2s; background: white;
}
.form-control:focus { border-color: var(--sage); }
.new-ing-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.new-ing-row { display: flex; gap: 8px; align-items: center; }
.new-ing-row select { flex: 1; }
.new-ing-row input { width: 80px; }
/* Oils section */
.oils-search { margin-bottom: 16px; }
.oils-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 10px;
}
.oil-chip {
background: white; border-radius: 10px; padding: 12px 16px;
box-shadow: 0 2px 8px rgba(90,60,30,0.06);
display: flex; justify-content: space-between; align-items: center;
gap: 8px;
}
.oil-chip-name { font-size: 14px; color: var(--text-dark); font-weight: 500; }
.oil-chip-price { font-size: 13px; color: var(--sage-dark); font-weight: 600; }
.oil-chip-actions { display: flex; gap: 4px; }
.oil-chip-btn {
background: none; border: none; cursor: pointer;
font-size: 13px; padding: 3px 6px; border-radius: 6px;
transition: background 0.2s; color: var(--text-light);
}
.oil-chip-btn:hover { background: var(--sage-mist); color: var(--sage-dark); }
.oil-chip-btn.del:hover { background: #fdf0ee; color: #c0392b; }
.oil-edit-input {
width: 90px; padding: 4px 8px; border: 1.5px solid var(--sage);
border-radius: 6px; font-size: 13px; font-family: inherit;
text-align: center; outline: none;
}
.add-oil-form {
background: white; border-radius: 14px; padding: 16px 20px;
box-shadow: var(--shadow); margin-bottom: 16px;
display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.add-oil-form input {
padding: 9px 14px; border: 1.5px solid var(--border);
border-radius: 8px; font-size: 14px; font-family: inherit; outline: none;
}
.add-oil-form input:focus { border-color: var(--sage); }
/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-light); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 15px; }
/* Tag */
.tag {
display: inline-block; padding: 3px 10px;
border-radius: 20px; font-size: 12px;
background: var(--sage-mist); color: var(--sage-dark);
margin: 2px;
}
.tag-btn {
display: inline-flex; align-items: center; gap: 3px;
padding: 4px 10px; border-radius: 16px; font-size: 12px;
background: var(--sage-mist); color: var(--sage-dark);
border: 1.5px solid transparent; cursor: pointer;
transition: all 0.2s;
}
.tag-btn:hover { border-color: var(--sage); }
.tag-btn.active { background: var(--sage); color: white; border-color: var(--sage); }
.tag-btn .tag-del {
font-size: 14px; margin-left: 2px; opacity: 0.5;
cursor: pointer; border: none; background: none;
color: inherit; padding: 0 2px;
}
.tag-btn .tag-del:hover { opacity: 1; }
/* Tag picker overlay */
.tag-picker {
position: fixed; top: 0; left: 0; right: 0; bottom: 0;
background: rgba(0,0,0,0.3); z-index: 999;
display: flex; align-items: center; justify-content: center;
}
.tag-picker-card {
background: white; border-radius: 16px; padding: 24px;
box-shadow: 0 8px 40px rgba(0,0,0,0.2); max-width: 400px; width: 90%;
}
.tag-picker-title { font-family: 'Noto Serif SC', serif; font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.tag-picker-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tag-pick {
padding: 6px 14px; border-radius: 20px; font-size: 13px;
border: 1.5px solid var(--border); background: white;
color: var(--text-mid); cursor: pointer; transition: all 0.15s;
}
.tag-pick:hover { border-color: var(--sage); }
.tag-pick.selected { background: var(--sage); color: white; border-color: var(--sage); }
/* Hint */
.hint { font-size: 12px; color: var(--text-light); margin-top: 6px; }
.section-title {
font-family: 'Noto Serif SC', serif;
font-size: 18px; font-weight: 600; color: var(--text-dark);
margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}
/* Category carousel */
.cat-wrap { position: relative; margin: 0 -24px 20px; overflow: hidden; }
.cat-track { display: flex; transition: transform 0.4s ease; will-change: transform; }
.cat-card {
flex: 0 0 100%; min-height: 200px; position: relative; overflow: hidden; cursor: pointer;
background-size: cover; background-position: center;
}
.cat-card::after {
content: ''; position: absolute; inset: 0;
background: linear-gradient(135deg, rgba(0,0,0,0.45), rgba(0,0,0,0.25));
}
.cat-inner {
position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column;
justify-content: center; align-items: center; padding: 36px 24px; color: white; text-align: center;
}
.cat-icon { font-size: 48px; margin-bottom: 10px; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3)); }
.cat-name { font-family: 'Noto Serif SC', serif; font-size: 24px; font-weight: 700; letter-spacing: 3px; text-shadow: 0 2px 8px rgba(0,0,0,0.5); }
.cat-sub { font-size: 13px; margin-top: 6px; opacity: 0.9; letter-spacing: 1px; }
.cat-arrow {
position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.25);
border: none; color: white; font-size: 18px; cursor: pointer; backdrop-filter: blur(4px);
display: flex; align-items: center; justify-content: center; transition: background 0.2s;
}
.cat-arrow:hover { background: rgba(255,255,255,0.45); }
.cat-arrow.left { left: 12px; }
.cat-arrow.right { right: 12px; }
.cat-dots { display: flex; justify-content: center; gap: 8px; margin-bottom: 14px; }
.cat-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); cursor: pointer; transition: all 0.25s; }
.cat-dot.active { background: var(--sage); width: 22px; border-radius: 4px; }
/* Toast */
.toast {
position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
background: rgba(0,0,0,0.8); color: white; padding: 10px 24px;
border-radius: 20px; font-size: 14px; z-index: 9000;
pointer-events: none; transition: opacity 0.3s;
}
/* Custom dialog overlay */
.dialog-overlay {
position: fixed; inset: 0; z-index: 9999;
background: rgba(0,0,0,0.45);
display: flex; align-items: center; justify-content: center; padding: 20px;
}
.dialog-box {
background: white; border-radius: 16px; padding: 28px 24px 20px;
max-width: 340px; width: 100%;
box-shadow: 0 12px 40px rgba(0,0,0,0.2); font-family: inherit;
}
.dialog-msg {
font-size: 14px; color: #333; line-height: 1.6;
white-space: pre-line; word-break: break-word;
margin-bottom: 20px; text-align: center;
}
.dialog-btn-row { display: flex; gap: 10px; justify-content: center; }
.dialog-btn-primary {
flex: 1; max-width: 140px; padding: 10px 0; border: none; border-radius: 10px;
font-size: 14px; font-weight: 600; cursor: pointer;
background: linear-gradient(135deg, #7a9e7e, #5a7d5e); color: white;
}
.dialog-btn-outline {
flex: 1; max-width: 140px; padding: 10px 0;
border: 1.5px solid #d4cfc7; border-radius: 10px;
font-size: 14px; cursor: pointer; background: white; color: #666;
}
/* Responsive */
@media (max-width: 600px) {
.main { padding: 8px; }
.section { max-width: 100%; }
.detail-panel { padding: 12px; }
.recipe-grid { grid-template-columns: 1fr; }
.ingredients-table { font-size: 12px; }
.ingredients-table td, .ingredients-table th { padding: 6px 4px; }
.oil-select { max-width: 100px; font-size: 11px; }
.drops-input { width: 50px; font-size: 12px; }
.search-input { padding: 8px 10px; font-size: 14px; }
.search-box { padding: 12px; }
.search-label { font-size: 12px; margin-bottom: 6px; }
.form-card { padding: 16px; }
.section-title { font-size: 16px; }
.manage-item { padding: 10px 12px; }
.nav-tab { padding: 10px 12px; font-size: 13px; }
.oil-chip { padding: 10px 12px; }
.oils-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.app-header { padding: 20px 16px 18px; }
.header-title h1 { font-size: 20px; }
}