feat(app-ui): P1~P6 加建議尺寸提示 + crop 旗標(按鈕類不裁切保留原比例)

P 系列填實際圖檔尺寸(838x155 等)供下拉提示;controller 依 part.crop 決定是否置中裁切;提示文字改中性

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
terrylee 2026-07-16 10:27:05 +08:00
parent 32599b8da7
commit 0f2b5dfe44
4 changed files with 15 additions and 17 deletions

View File

@ -49,14 +49,12 @@ class UiElementController extends Controller
$part = config("ui_parts.parts.{$validated['part_key']}");
// 依部位建議尺寸做居中裁切,存為 webp
$path = $this->storeAsWebp(
$request->file('file'),
'ui_elements',
80,
$part['width'] ?? null,
$part['height'] ?? null
);
// crop=true預設滿版類→ 依部位尺寸置中裁切crop=false按鈕/icon 類)→ 保留原比例不裁切
$crop = $part['crop'] ?? true;
$targetW = $crop ? ($part['width'] ?? null) : null;
$targetH = $crop ? ($part['height'] ?? null) : null;
$path = $this->storeAsWebp($request->file('file'), 'ui_elements', 80, $targetW, $targetH);
UiElement::create([
'part_key' => $validated['part_key'],

View File

@ -29,13 +29,13 @@ return [
// === E 系列:交易結果 ===
'E1' => ['label' => 'E1 - 交易失敗/客服圖', 'group' => 'transaction', 'type' => 'image', 'width' => 720, 'height' => 1280, 'active' => true],
// === P 系列:支付方式按鈕圖(不裁切、保留原比例width/height=null===
'P1' => ['label' => 'P1 - 信用卡支付', 'group' => 'payment', 'type' => 'image', 'width' => null, 'height' => null, 'active' => true],
'P2' => ['label' => 'P2 - 卡片/電子票證', 'group' => 'payment', 'type' => 'image', 'width' => null, 'height' => null, 'active' => true],
'P3' => ['label' => 'P3 - 玉山掃碼支付', 'group' => 'payment', 'type' => 'image', 'width' => null, 'height' => null, 'active' => true],
'P4' => ['label' => 'P4 - 手機支付', 'group' => 'payment', 'type' => 'image', 'width' => null, 'height' => null, 'active' => true],
'P5' => ['label' => 'P5 - 現金支付', 'group' => 'payment', 'type' => 'image', 'width' => null, 'height' => null, 'active' => true],
'P6' => ['label' => 'P6 - TapPay 掃碼', 'group' => 'payment', 'type' => 'image', 'width' => null, 'height' => null, 'active' => true],
// === P 系列:支付方式按鈕圖(width/height=建議尺寸提示crop=false 不裁切、保留原比例===
'P1' => ['label' => 'P1 - 信用卡支付', 'group' => 'payment', 'type' => 'image', 'width' => 838, 'height' => 155, 'crop' => false, 'active' => true],
'P2' => ['label' => 'P2 - 卡片/電子票證', 'group' => 'payment', 'type' => 'image', 'width' => 704, 'height' => 159, 'crop' => false, 'active' => true],
'P3' => ['label' => 'P3 - 玉山掃碼支付', 'group' => 'payment', 'type' => 'image', 'width' => 579, 'height' => 282, 'crop' => false, 'active' => true],
'P4' => ['label' => 'P4 - 手機支付', 'group' => 'payment', 'type' => 'image', 'width' => 684, 'height' => 169, 'crop' => false, 'active' => true],
'P5' => ['label' => 'P5 - 現金支付', 'group' => 'payment', 'type' => 'image', 'width' => 846, 'height' => 266, 'crop' => false, 'active' => true],
'P6' => ['label' => 'P6 - TapPay 掃碼', 'group' => 'payment', 'type' => 'image', 'width' => 579, 'height' => 282, 'crop' => false, 'active' => true],
// --- 以下為舊後台既有部位Phase 2+ 逐步啟用active=false 時後台不顯示、不下發)---
'A4' => ['label' => 'A4 - 對話框標頭', 'group' => 'fullscreen', 'type' => 'image', 'width' => 1080, 'height' => 192, 'active' => false],

View File

@ -2355,7 +2355,7 @@
"No image selected": "No image selected",
"Current Bundle": "Current Bundle",
"Bind UI Bundle": "Bind UI Bundle",
"Image will be center-cropped to the category size.": "Image will be center-cropped to the category size.",
"Image will be center-cropped to the category size.": "Numbers show the recommended size per category (full-screen types are center-cropped; button types keep their aspect ratio).",
"(deleted)": "(deleted)",
"Unable to read the image archive": "Unable to read the image archive",
"Unassigned": "Unassigned",

View File

@ -2356,7 +2356,7 @@
"No image selected": "尚未選擇圖片",
"Current Bundle": "當前組合",
"Bind UI Bundle": "綁定 UI 組合",
"Image will be center-cropped to the category size.": "圖片會依類別建議尺寸置中裁切。",
"Image will be center-cropped to the category size.": "括號內為各類別建議上傳尺寸(滿版類會置中裁切,按鈕類保留原比例)。",
"(deleted)": "(已刪除)",
"Unable to read the image archive": "無法讀取圖片壓縮檔",
"Unassigned": "未指派",