fix(profile): restore route styles and hidden modals

This commit is contained in:
2026-08-19 14:08:42 +08:00
parent a5ed4bbb6f
commit 886ea8732c
6 changed files with 74 additions and 20 deletions
+45 -17
View File
@@ -333,14 +333,22 @@ trait ScriptsPart1b {
);
}
// 共享基础 profile 样式(兼容层)
$profile_css_path = get_template_directory() . '/assets/css/routes/profile.css';
wp_enqueue_style(
'aksrt-route-profile',
$base_uri . '/assets/css/routes/profile.css',
['aksrt-tokens'],
file_exists($profile_css_path) ? (string) filemtime($profile_css_path) : $version
);
// Enqueue every profile leaf directly. Nested @imports are not versioned,
// so browsers can otherwise retain stale layout/modal rules after deploys.
$profile_parts = ['layout', 'lists', 'modals'];
$profile_deps = [$core_dep];
foreach ($profile_parts as $part_index => $part) {
$part_path = get_template_directory() . '/assets/css/routes/profile/' . $part . '.css';
$is_last_part = $part_index === count($profile_parts) - 1;
$part_handle = $is_last_part ? 'aksrt-route-profile' : 'aksrt-route-profile-' . $part;
wp_enqueue_style(
$part_handle,
$base_uri . '/assets/css/routes/profile/' . $part . '.css',
$profile_deps,
file_exists($part_path) ? (string) filemtime($part_path) : $version
);
$profile_deps = [$part_handle];
}
// 本人中心 vs 公开主页拆分加载
$is_public_user_home = $is_profile_route
@@ -356,14 +364,34 @@ trait ScriptsPart1b {
file_exists($user_home_css_path) ? (string) filemtime($user_home_css_path) : $version
);
} else {
// 本人中心(page template)
$user_center_css_path = get_template_directory() . '/assets/css/routes/user-center.css';
wp_enqueue_style(
'aksrt-route-user-center',
$base_uri . '/assets/css/routes/user-center.css',
['aksrt-route-profile'],
file_exists($user_center_css_path) ? (string) filemtime($user_center_css_path) : $version
);
// Keep the legacy aggregate's cascade order, but give every leaf its
// own cache version. The final leaf retains the public aggregate handle.
$user_center_parts = [
'user-center/shell',
'user-center/credits',
'user-center/vip',
'user-center/level',
'user-center/settings',
'revenue',
'user-center/revenue',
'user-center/revenue-earnings',
'user-center/responsive',
];
$user_center_deps = ['aksrt-route-profile'];
foreach ($user_center_parts as $part_index => $part) {
$part_path = get_template_directory() . '/assets/css/routes/' . $part . '.css';
$is_last_part = $part_index === count($user_center_parts) - 1;
$part_handle = $is_last_part
? 'aksrt-route-user-center'
: 'aksrt-route-' . str_replace('/', '-', $part);
wp_enqueue_style(
$part_handle,
$base_uri . '/assets/css/routes/' . $part . '.css',
$user_center_deps,
file_exists($part_path) ? (string) filemtime($part_path) : $version
);
$user_center_deps = [$part_handle];
}
// Orders is a lazy user-center panel, so its independent assets must
// be ready before client-side panel replacement can insert its markup.
$has_orders_panel = false;
@@ -377,7 +405,7 @@ trait ScriptsPart1b {
wp_enqueue_style(
'aksrt-orders',
$base_uri . '/assets/css/routes/orders.css',
['aksrt-tokens'],
[$core_dep],
(string) filemtime($orders_css)
);
}