Compare commits
10 Commits
09a99d5e48
...
718d7c6ccb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
718d7c6ccb | ||
|
|
9078f19194 | ||
|
|
7b9a56b7fe | ||
|
|
66ef28bdeb | ||
|
|
0351c47684 | ||
|
|
9ab7d7c195 | ||
|
|
f72de38fb7 | ||
|
|
99f9f079b3 | ||
|
|
3f9202b315 | ||
|
|
596493a686 |
5
AGENTS.md
Normal file
5
AGENTS.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Repository workflow
|
||||
|
||||
- After completing and validating any requested code change, commit it to `main` and push it to `origin` automatically.
|
||||
- Do not push local-only prototypes, unconfirmed visual experiments, or changes the user explicitly asks to keep local.
|
||||
- Never commit credentials, deploy private keys, environment secrets, or generated dependency/build directories.
|
||||
@@ -64,7 +64,7 @@ export const CATALOG_PRODUCTS: CatalogProduct[] = [
|
||||
},
|
||||
{
|
||||
"id": "p01-5-4-a-05-a0008",
|
||||
"category": "标准舵机",
|
||||
"category": "异形舵机",
|
||||
"name": "1.7g舵机(异形款/塑胶齿/三线)",
|
||||
"code": "4.A.05.A0008",
|
||||
"image": "/catalog-products/p01-4-a-05-a0008.webp",
|
||||
@@ -7170,8 +7170,8 @@ export const CATALOG_PRODUCTS: CatalogProduct[] = [
|
||||
];
|
||||
|
||||
export const CATALOG_COUNTS: Record<string, number> = {
|
||||
"标准舵机": 118,
|
||||
"异形舵机": 13,
|
||||
"标准舵机": 117,
|
||||
"异形舵机": 14,
|
||||
"全金属舵机": 66,
|
||||
"大扭矩舵机": 26,
|
||||
"积木舵机": 20,
|
||||
|
||||
@@ -137,19 +137,28 @@ a { color: inherit; text-decoration: none; }
|
||||
.back-button, .restart-button { padding: 11px 2px; border: 0; color: #798599; background: transparent; cursor: pointer; font-size: 12px; }
|
||||
.next-button { min-width: 150px; padding: 13px 20px; }
|
||||
.next-button:disabled { cursor: not-allowed; opacity: .35; transform: none; box-shadow: none; }
|
||||
.field-stack { padding: 18px 18px 15px; border-radius: 12px; background: #f6f8fc; }
|
||||
.field-label { display: flex; justify-content: space-between; color: #657187; font-size: 12px; }
|
||||
.field-stack { margin-top: 13px; padding: 15px 16px 13px; border-radius: 12px; background: #f6f8fc; }
|
||||
.field-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #657187; font-size: 12px; }
|
||||
.field-label strong { color: var(--blue); font-size: 15px; }
|
||||
.range-input { width: 100%; margin: 24px 0 6px; accent-color: var(--blue); }
|
||||
.torque-entry { display: flex; align-items: center; gap: 6px; }
|
||||
.torque-entry input { width: 86px; height: 34px; padding: 0 9px; text-align: right; font-weight: 750; }
|
||||
.torque-entry strong { font-size: 10px; white-space: nowrap; }
|
||||
.range-input { width: 100%; margin: 16px 0 5px; accent-color: var(--blue); }
|
||||
.range-scale { display: flex; justify-content: space-between; color: #9aa3b1; font-size: 9px; }
|
||||
.torque-presets { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 10px; }
|
||||
.torque-presets button { min-width: 0; padding: 6px 2px; border: 1px solid #d8e0eb; border-radius: 7px; color: #657187; background: white; cursor: pointer; font-size: 9px; }
|
||||
.torque-presets button.active { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); font-weight: 750; }
|
||||
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 15px; }
|
||||
.compact-fields { margin-top: 0; }
|
||||
.parameter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-top: 13px; }
|
||||
.select-field, .text-field { display: grid; gap: 7px; }
|
||||
.select-field span, .text-field span, .field-title, .sample-form label span { color: #68758a; font-size: 11px; font-weight: 650; }
|
||||
select, input, textarea { outline: none; border: 1px solid #dbe2ec; border-radius: 9px; color: var(--ink); background: white; }
|
||||
select:focus, input:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(24,94,232,.1); }
|
||||
.select-field select { height: 46px; padding: 0 12px; }
|
||||
.select-field select, .parameter-input { width: 100%; height: 43px; padding: 0 12px; }
|
||||
.text-field { margin-top: 13px; }
|
||||
.text-field input { height: 44px; padding: 0 13px; }
|
||||
.project-notes textarea { min-height: 78px; padding: 11px 13px; resize: vertical; line-height: 1.55; }
|
||||
.field-group { margin: 17px 0 13px; }
|
||||
.pill-row { display: flex; gap: 7px; margin-top: 8px; }
|
||||
.pill-row button { flex: 1; padding: 10px 7px; border: 1px solid #dce3ed; border-radius: 9px; background: white; cursor: pointer; font-size: 11px; }
|
||||
@@ -159,7 +168,7 @@ select:focus, input:focus, textarea:focus { border-color: var(--blue); box-shado
|
||||
.result-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
|
||||
.best-match { display: grid; grid-template-columns: 180px 1fr; border: 1px solid #cfdaf0; border-radius: 15px; overflow: hidden; box-shadow: 0 8px 24px rgba(38,70,125,.08); }
|
||||
.match-image-wrap { position: relative; min-height: 270px; background: #eff4fb; }
|
||||
.match-image-wrap img { width: 100%; height: 100%; object-fit: cover; }
|
||||
.match-image-wrap img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
|
||||
.match-badge { position: absolute; left: 12px; top: 12px; padding: 6px 9px; border-radius: 7px; color: white; background: var(--orange); font-size: 9px; font-weight: 800; }
|
||||
.match-content { position: relative; padding: 19px 19px 16px; }
|
||||
.match-score { position: absolute; right: 16px; top: 15px; display: grid; text-align: right; color: #7c889a; font-size: 9px; }
|
||||
@@ -176,6 +185,10 @@ select:focus, input:focus, textarea:focus { border-color: var(--blue); box-shado
|
||||
.price-line span { color: #7c8798; font-size: 9px; }
|
||||
.price-line strong { color: #e55726; font-size: 20px; }
|
||||
.price-line small { color: #9aa4b3; font-size: 8px; }
|
||||
.source-line { display: flex; align-items: center; gap: 7px; padding-top: 9px; border-top: 1px solid #edf0f4; }
|
||||
.source-line span { color: #7c8798; font-size: 9px; }
|
||||
.source-line strong { color: var(--blue); font-size: 10px; }
|
||||
.source-line small { margin-left: auto; color: #9aa4b3; font-size: 8px; }
|
||||
.engineer-alert { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 12px; border: 1px solid #f0d29e; border-radius: 9px; background: #fff9ef; }
|
||||
.engineer-alert span { flex: 0 0 auto; padding: 4px 7px; border-radius: 5px; color: #9b5a0a; background: #ffe7bc; font-size: 8px; font-weight: 800; }
|
||||
.engineer-alert p { margin: 0; color: #815e2f; font-size: 9px; }
|
||||
@@ -205,6 +218,22 @@ select:focus, input:focus, textarea:focus { border-color: var(--blue); box-shado
|
||||
.success-card h3 { margin: 0; }
|
||||
.success-card > p:not(.step-kicker) { color: #66776f; font-size: 10px; }
|
||||
.success-card .outline-button { min-height: 38px; }
|
||||
.custom-result-card {
|
||||
padding: 22px;
|
||||
display: grid;
|
||||
grid-template-columns: 58px 1fr;
|
||||
gap: 10px 16px;
|
||||
border: 1px solid #bdd0f2;
|
||||
border-radius: 15px;
|
||||
background: linear-gradient(145deg, #f7faff, #edf4ff);
|
||||
}
|
||||
.custom-result-mark { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 16px; color: white; background: linear-gradient(145deg, #397fff, #1454d0); font-size: 13px; font-weight: 850; box-shadow: 0 10px 22px rgba(24,94,232,.2); }
|
||||
.custom-result-card > div:nth-child(2) > span { color: var(--blue); font-size: 9px; font-weight: 800; letter-spacing: .08em; }
|
||||
.custom-result-card h3 { margin: 4px 0 7px; font-size: 18px; line-height: 1.35; }
|
||||
.custom-result-card > div:nth-child(2) > p { margin: 0; color: #6d7b91; font-size: 10px; line-height: 1.65; }
|
||||
.custom-requirement-grid { grid-column: 1 / -1; margin-top: 8px; }
|
||||
.custom-notes { grid-column: 1 / -1; margin: 2px 0 0; padding: 10px 12px; border-radius: 8px; color: #5d6c82; background: rgba(255,255,255,.8); font-size: 9px; line-height: 1.6; }
|
||||
.custom-contact-form { border-color: #afc8f2; }
|
||||
|
||||
.capability-strip { padding: 28px max(32px, calc((100vw - 1120px) / 2)); display: grid; grid-template-columns: repeat(4, 1fr); background: var(--ink); color: white; }
|
||||
.capability-strip div { display: grid; gap: 4px; text-align: center; border-right: 1px solid rgba(255,255,255,.13); }
|
||||
@@ -237,6 +266,7 @@ select:focus, input:focus, textarea:focus { border-color: var(--blue); box-shado
|
||||
.catalog-summary button.active { border-color: var(--blue); background: var(--blue-soft); }
|
||||
.catalog-summary strong { color: var(--blue); font-size: 19px; }
|
||||
.catalog-summary span { color: #748196; font-size: 10px; }
|
||||
.catalog-category-note { margin: -8px 2px 18px; color: #8792a3; font-size: 10px; line-height: 1.6; }
|
||||
.catalog-toolbar {
|
||||
position: sticky;
|
||||
top: 74px;
|
||||
@@ -282,9 +312,16 @@ select:focus, input:focus, textarea:focus { border-color: var(--blue); box-shado
|
||||
font-size: 10px;
|
||||
}
|
||||
.category-pills button.active { border-color: var(--blue); color: white; background: var(--blue); }
|
||||
.category-pills button.feature-filter:not(.active) { border-color: #f1bf92; color: #a75a19; background: #fff9f3; }
|
||||
.catalog-scale-filter { display: grid; grid-template-columns: minmax(240px, 330px) 1fr; align-items: end; gap: 14px; margin-top: 13px; padding-top: 13px; border-top: 1px solid #e7ebf1; }
|
||||
.catalog-scale-filter label { display: grid; gap: 6px; }
|
||||
.catalog-scale-filter label > span { color: #68758a; font-size: 10px; font-weight: 700; }
|
||||
.catalog-scale-filter select { width: 100%; height: 42px; padding: 0 12px; }
|
||||
.catalog-scale-filter p { margin: 0 0 4px; color: #8792a3; font-size: 9px; line-height: 1.55; }
|
||||
.catalog-scale-filter p strong { color: #657187; }
|
||||
.catalog-result-count { margin: 11px 2px 0; color: #8792a3; font-size: 10px; }
|
||||
.catalog-result-count strong { color: var(--blue); font-size: 12px; }
|
||||
.catalog-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
|
||||
.catalog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
|
||||
.catalog-card {
|
||||
min-width: 0;
|
||||
border: 1px solid #dce3ed;
|
||||
@@ -297,7 +334,7 @@ select:focus, input:focus, textarea:focus { border-color: var(--blue); box-shado
|
||||
.catalog-image-button {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 190px;
|
||||
height: 280px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border: 0;
|
||||
@@ -306,7 +343,8 @@ select:focus, input:focus, textarea:focus { border-color: var(--blue); box-shado
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
}
|
||||
.catalog-image-button img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
|
||||
.catalog-image-button img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; transition: transform .25s ease; }
|
||||
.catalog-image-button:hover img { transform: scale(1.07); }
|
||||
.catalog-image-button small {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
@@ -319,6 +357,18 @@ select:focus, input:focus, textarea:focus { border-color: var(--blue); box-shado
|
||||
font-size: 8px;
|
||||
font-weight: 750;
|
||||
}
|
||||
.catalog-zoom-hint {
|
||||
position: absolute;
|
||||
right: 11px;
|
||||
bottom: 11px;
|
||||
padding: 6px 9px;
|
||||
border-radius: 7px;
|
||||
color: #315686;
|
||||
background: rgba(255,255,255,.92);
|
||||
box-shadow: 0 3px 12px rgba(31,56,93,.1);
|
||||
font-size: 9px;
|
||||
font-weight: 700;
|
||||
}
|
||||
.catalog-placeholder { color: #9eb3d3; font-size: 14px; font-weight: 800; letter-spacing: .12em; }
|
||||
.catalog-card-body { padding: 16px; }
|
||||
.catalog-card-body > p { margin: 0 0 5px; color: #8793a5; font-size: 9px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
|
||||
@@ -369,7 +419,7 @@ select:focus, input:focus, textarea:focus { border-color: var(--blue); box-shado
|
||||
}
|
||||
.catalog-modal {
|
||||
position: relative;
|
||||
width: min(760px, 100%);
|
||||
width: min(900px, 100%);
|
||||
max-height: min(820px, 92vh);
|
||||
padding: 28px;
|
||||
overflow-y: auto;
|
||||
@@ -391,8 +441,8 @@ select:focus, input:focus, textarea:focus { border-color: var(--blue); box-shado
|
||||
cursor: pointer;
|
||||
font-size: 20px;
|
||||
}
|
||||
.catalog-modal-product { display: grid; grid-template-columns: 210px 1fr; align-items: center; gap: 28px; }
|
||||
.catalog-modal-image { height: 180px; display: grid; place-items: center; border-radius: 13px; overflow: hidden; background: #f2f5fa; }
|
||||
.catalog-modal-product { display: grid; grid-template-columns: 360px 1fr; align-items: center; gap: 34px; }
|
||||
.catalog-modal-image { height: 300px; display: grid; place-items: center; border-radius: 13px; overflow: hidden; background: #f2f5fa; }
|
||||
.catalog-modal-image img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
|
||||
.catalog-modal-product h2 { margin: 4px 0 10px; font-size: 27px; line-height: 1.3; letter-spacing: -.025em; }
|
||||
.catalog-modal-product code { color: #5d6b81; font-size: 11px; }
|
||||
@@ -425,6 +475,9 @@ footer > span { color: #9aa4b2; font-size: 10px; }
|
||||
.hero-copy { max-width: 760px; }
|
||||
.selector-shell { width: min(100%, 720px); }
|
||||
.how-section { gap: 45px; }
|
||||
.catalog-summary { grid-template-columns: repeat(4, 1fr); }
|
||||
.catalog-grid { grid-template-columns: repeat(2, 1fr); }
|
||||
.catalog-image-button { height: 260px; }
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
@@ -439,7 +492,8 @@ footer > span { color: #9aa4b2; font-size: 10px; }
|
||||
.selector-shell { border-radius: 16px; }
|
||||
.question-panel, .result-panel { padding: 20px 16px; }
|
||||
.welcome-panel { padding: 55px 20px 35px; }
|
||||
.choice-grid, .two-fields, .form-grid, .alternative-list { grid-template-columns: 1fr; }
|
||||
.choice-grid, .two-fields, .parameter-grid, .form-grid, .alternative-list { grid-template-columns: 1fr; }
|
||||
.torque-presets { grid-template-columns: repeat(4, 1fr); }
|
||||
.best-match { grid-template-columns: 1fr; }
|
||||
.match-image-wrap { height: 240px; }
|
||||
.capability-strip { grid-template-columns: 1fr 1fr; gap: 24px 0; padding: 28px 16px; }
|
||||
@@ -448,15 +502,16 @@ footer > span { color: #9aa4b2; font-size: 10px; }
|
||||
.catalog-summary { grid-template-columns: repeat(2, 1fr); }
|
||||
.catalog-summary button:last-child { grid-column: 1 / -1; }
|
||||
.catalog-toolbar { top: 64px; }
|
||||
.catalog-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
|
||||
.catalog-image-button { height: 150px; }
|
||||
.catalog-card-body { padding: 12px; }
|
||||
.catalog-card-body h3 { height: 60px; font-size: 13px; }
|
||||
.catalog-scale-filter { grid-template-columns: 1fr; align-items: stretch; }
|
||||
.catalog-grid { grid-template-columns: 1fr; gap: 15px; }
|
||||
.catalog-image-button { height: 280px; }
|
||||
.catalog-card-body { padding: 15px; }
|
||||
.catalog-card-body h3 { height: auto; min-height: 42px; font-size: 14px; }
|
||||
.catalog-card-body dl { min-height: 90px; }
|
||||
.catalog-modal-backdrop { padding: 10px; }
|
||||
.catalog-modal { padding: 22px 16px; }
|
||||
.catalog-modal-product { grid-template-columns: 1fr; gap: 16px; }
|
||||
.catalog-modal-image { height: 220px; }
|
||||
.catalog-modal-image { height: 290px; }
|
||||
.catalog-spec-table { grid-template-columns: 1fr; }
|
||||
.catalog-modal-actions { align-items: stretch; flex-direction: column; }
|
||||
.products-section { padding: 75px 16px; }
|
||||
|
||||
829
app/page.tsx
829
app/page.tsx
File diff suppressed because it is too large
Load Diff
@@ -26,6 +26,11 @@ CATEGORY_BY_PAGE = {
|
||||
**{page: "翻盖电机" for page in range(28, 30)},
|
||||
}
|
||||
|
||||
# Business categories can intentionally differ from the source page heading.
|
||||
CATEGORY_BY_CODE = {
|
||||
"4.A.05.A0008": "异形舵机",
|
||||
}
|
||||
|
||||
SPEC_LABELS = {
|
||||
"标准舵机": [
|
||||
"产品尺寸", "最大砝码负载", "堵转扭矩", "空载速度", "可操作角度",
|
||||
@@ -141,7 +146,13 @@ def main() -> None:
|
||||
|
||||
with pdfplumber.open(PDF_PATH) as pdf:
|
||||
for page_number, page in enumerate(pdf.pages, 1):
|
||||
category = CATEGORY_BY_PAGE[page_number]
|
||||
page_category = CATEGORY_BY_PAGE[page_number]
|
||||
page_text = clean(page.extract_text() or "")
|
||||
expected_heading = f"{page_category}产品明细表"
|
||||
if expected_heading not in page_text:
|
||||
raise RuntimeError(
|
||||
f"Category heading mismatch on page {page_number}: expected {expected_heading}"
|
||||
)
|
||||
tables = page.find_tables()
|
||||
if not tables:
|
||||
raise RuntimeError(f"No table found on page {page_number}")
|
||||
@@ -163,6 +174,7 @@ def main() -> None:
|
||||
code = clean_code(row[2])
|
||||
if not code or not re.search(r"[A-Z].*\d", code):
|
||||
continue
|
||||
category = CATEGORY_BY_CODE.get(code, page_category)
|
||||
|
||||
explicit_name = clean(row[1])
|
||||
if explicit_name:
|
||||
@@ -179,10 +191,10 @@ def main() -> None:
|
||||
crop_product_image(rendered, page.width, page.height, cell, IMAGE_DIR / image_name)
|
||||
inherited_image = f"/catalog-products/{image_name}"
|
||||
|
||||
values = normalize_spec_values(category, row, inherited_size)
|
||||
values = normalize_spec_values(page_category, row, inherited_size)
|
||||
specs = {
|
||||
label: value
|
||||
for label, value in zip(SPEC_LABELS[category], values)
|
||||
for label, value in zip(SPEC_LABELS[page_category], values)
|
||||
if value and value != "/"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user