From d1f700c3d1a02ea4fe3da6d933691be433408458 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 19 Aug 2026 16:15:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(user):=20rebuild=20badge=20=EF=BC=88?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=92=99=E7=89=88=E8=A2=AB=E8=A3=81=E6=88=90?= =?UTF-8?q?=E4=B8=AD=E9=97=B4=E6=A0=8F=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/css/frontend/medal.css | 10 ++++++++++ inc/helpers/aksrt-identity.php | 5 ++++- src/User/Badges.php | 6 +++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/assets/css/frontend/medal.css b/assets/css/frontend/medal.css index ed2cb382..899bb2f4 100644 --- a/assets/css/frontend/medal.css +++ b/assets/css/frontend/medal.css @@ -242,6 +242,16 @@ } /* ---------- 弹窗骨架(远程弹窗 .medal-modal) ---------- */ +.aksrt-modal-runtime.aksrt-badge-modal:not(.aksrt-modal-runtime--bottom) .aksrt-modal-runtime__dialog { + width: min(620px, calc(100vw - 32px)); +} +.aksrt-modal-runtime.aksrt-badge-modal--single:not(.aksrt-modal-runtime--bottom) .aksrt-modal-runtime__dialog { + width: min(400px, calc(100vw - 32px)); +} +.aksrt-modal-runtime.aksrt-badge-modal--grant:not(.aksrt-modal-runtime--bottom) .aksrt-modal-runtime__dialog { + width: min(520px, calc(100vw - 32px)); +} + .medal-modal { position: relative; padding: 6px 4px 12px; } .medal-modal__empty { padding: 24px 0; diff --git a/inc/helpers/aksrt-identity.php b/inc/helpers/aksrt-identity.php index 178d1a17..9e5954cd 100644 --- a/inc/helpers/aksrt-identity.php +++ b/inc/helpers/aksrt-identity.php @@ -275,6 +275,9 @@ if (!function_exists('aksrt_render_user_medal_entry')) { return ''; } $action = $is_manager && $context === 'user-home' && $count === 0 ? 'aksrt_user_medal_manually_add_modal' : 'aksrt_user_medal_info_modal'; + $modal_class = $action === 'aksrt_user_medal_manually_add_modal' + ? 'aksrt-badge-modal aksrt-badge-modal--grant' + : 'aksrt-badge-modal aksrt-badge-modal--overview'; $query = ['action' => $action, 'id' => $user_id]; $url = add_query_arg($query, admin_url('admin-ajax.php')); @@ -303,7 +306,7 @@ if (!function_exists('aksrt_render_user_medal_entry')) { $icons_html = ''; } $classes = 'aksrt-medal-entry aksrt-medal-entry--' . sanitize_html_class($context); - return '' . $icons_html . '' . esc_html($label) . ''; + return '' . $icons_html . '' . esc_html($label) . ''; } } diff --git a/src/User/Badges.php b/src/User/Badges.php index f95cf79f..66d37b72 100644 --- a/src/User/Badges.php +++ b/src/User/Badges.php @@ -494,7 +494,7 @@ class Badges { $has = true; $card = '
' . self::icon_html($item) . '
' . esc_html((string) $item['label']) . '
'; $url = add_query_arg(['action' => 'aksrt_single_medal_info_modal', 'name' => $item['slug'], 'user_id' => $user_id], admin_url('admin-ajax.php')); - $cards .= '
' . $card . '
'; + $cards .= '
' . $card . '
'; } if ($cards) $html .= '
' . esc_html((string) $category['cat_name']) . '
' . $cards . '
'; } @@ -504,8 +504,8 @@ class Badges { $mine = add_query_arg(['action' => 'aksrt_user_medal_info_modal', 'id' => get_current_user_id()], admin_url('admin-ajax.php')); $grant = add_query_arg(['action' => 'aksrt_user_medal_manually_add_modal', 'id' => $user_id], admin_url('admin-ajax.php')); $buttons = ''; - if (get_current_user_id()) $buttons .= '' . esc_html__('查看我的徽章', 'aksrt') . ''; - if (self::can_manually_set()) $buttons .= '' . esc_html__('授予徽章', 'aksrt') . ''; + if (get_current_user_id()) $buttons .= '' . esc_html__('查看我的徽章', 'aksrt') . ''; + if (self::can_manually_set()) $buttons .= '' . esc_html__('授予徽章', 'aksrt') . ''; if ($buttons !== '') $html .= '
' . $buttons . '
'; } $html .= '';