diff --git a/assets/admin/src/pages/users/UsersLevel.vue b/assets/admin/src/pages/users/UsersLevel.vue
index b9cfbbde..93f66f2a 100644
--- a/assets/admin/src/pages/users/UsersLevel.vue
+++ b/assets/admin/src/pages/users/UsersLevel.vue
@@ -140,7 +140,7 @@ const levelColumns = [
h(NInput, {
value: form.user_level_opt['icon_img_' + row.level] ?? '',
size: 'small',
- placeholder: row.level <= 10 ? '留空使用主题内置图标' : '请输入图片 URL',
+ placeholder: row.level <= 10 ? '默认使用主题自带等级图标' : '请输入图片 URL',
onUpdateValue: (v) => {
form.user_level_opt['icon_img_' + row.level] = v
},
diff --git a/assets/admin/src/schema/sections/payment/vip.js b/assets/admin/src/schema/sections/payment/vip.js
index 34cc0e99..1f457242 100644
--- a/assets/admin/src/schema/sections/payment/vip.js
+++ b/assets/admin/src/schema/sections/payment/vip.js
@@ -10,6 +10,12 @@
const VIP_EQUITY_DEFAULT = '
全站资源折扣购买部分内容免费阅读一对一技术指导VIP用户专属QQ群';
+// 主题自带会员图标(assets/img/user/vip/vip-N.svg)。
+const themeRoot = typeof window !== 'undefined' && window.jioAdminData?.themeUri
+ ? String(window.jioAdminData.themeUri).replace(/\/$/, '')
+ : ''
+const vipIconDefault = (level) => `${themeRoot}/assets/img/user/vip/vip-${level}.svg`
+
const vipTagPalette = [
{ label: '#f74b3d', value: 'b-red' },
{ label: '#f3920a', value: 'b-yellow' },
@@ -84,7 +90,7 @@ function vipLevelTabFields(level) {
help: '会员购买价格配置:执行价、原价、促销标签、标签颜色与会员有效时间',
fields: vipProductFields(),
},
- { key: `vip_${level}_img_icon`, label: '会员图标', type: 'upload', default: '', dependsOn: dep, help: `留空使用内置 vip-${level}.svg 图标;建议尺寸300x300` },
+ { key: `vip_${level}_img_icon`, label: '会员图标', type: 'upload', default: vipIconDefault(level), dependsOn: dep, help: '默认使用主题自带会员图标;建议尺寸300x300' },
];
}
@@ -105,7 +111,7 @@ export const vipSchema = {
{ price: 99, show_price: 199, tag: ' 限时特惠', time: 3, unit: 'month' },
{ price: 199, show_price: 299, tag: ' 站长推荐', time: 6, unit: 'month' },
],
- vip_1_img_icon: '',
+ vip_1_img_icon: vipIconDefault(1),
pay_user_vip_2_s: true,
pay_user_vip_2_name: '钻石会员',
pay_user_vip_2_desc: '尊享专属特权',
@@ -115,7 +121,7 @@ export const vipSchema = {
{ price: 99, show_price: 199, tag: ' 限时特惠', time: 3, unit: 'month' },
{ price: 199, show_price: 299, tag: ' 站长推荐', time: 6, unit: 'month' },
],
- vip_2_img_icon: '',
+ vip_2_img_icon: vipIconDefault(2),
pay_user_vip_desc: '开通VIP会员,享受会员专属折扣以及多项特权',
pay_user_vip_more: '购买后不支持退款
VIP权益仅适用于本站
欢迎与站长联系
',
pay_download_limit: 0,
diff --git a/assets/admin/src/schema/sections/users/level.js b/assets/admin/src/schema/sections/users/level.js
index 12c953da..e389d942 100644
--- a/assets/admin/src/schema/sections/users/level.js
+++ b/assets/admin/src/schema/sections/users/level.js
@@ -2,6 +2,13 @@
* User level + integral XP (legacy user_level_s / user_level_opt / user_integral_opt).
*/
+const themeRoot = typeof window !== 'undefined' && window.jioAdminData?.themeUri
+ ? String(window.jioAdminData.themeUri).replace(/\/$/, '')
+ : ''
+
+/** 主题自带等级图标 URL(assets/img/user-level-N.png,1..10)。 */
+export const levelIcon = (n) => `${themeRoot}/assets/img/user-level-${n}.png`
+
export const INTEGRAL_CATALOG = [
{ key: 'sign_up', label: '首次注册', default: 20, group: '用户' },
{ key: 'sign_in', label: '每日登录', default: 5, group: '用户' },
@@ -18,7 +25,9 @@ export function defaultLevelOpt(max = 10) {
for (let i = 1; i <= max; i++) {
opt['upgrade_integral_' + i] = i === 1 ? 0 : (i - 1) * 500 * i
opt['name_' + i] = 'LV' + i
- opt['icon_img_' + i] = ''
+ // 与 PHP default_level_options() 一致:默认写入主题自带图标 URL,
+ // 后台展示的就是前台真正渲染的等级图标。
+ opt['icon_img_' + i] = i <= 10 ? levelIcon(i) : ''
}
return opt
}
diff --git a/src/Admin/Schema/SchemaPayment.php b/src/Admin/Schema/SchemaPayment.php
index a09387b5..2957880f 100644
--- a/src/Admin/Schema/SchemaPayment.php
+++ b/src/Admin/Schema/SchemaPayment.php
@@ -640,6 +640,19 @@ class SchemaPayment {
];
}
+ /**
+ * 会员图标默认值:主题自带 vip-N.svg。
+ *
+ * 与 PaymentRuntime::get_vip_icon_url() 的回退链一致——后台展示的就是前台
+ * 真正使用的图标,而不是一个空白上传框。主题缺图时返回空串,前端回退 FA 图标。
+ */
+ private static function vip_icon_default(int $level): string {
+ $level = max(1, min(2, $level));
+ $path = 'assets/img/user/vip/vip-' . $level . '.svg';
+ $file = get_theme_file_path($path);
+ return is_file($file) ? get_theme_file_uri($path) : '';
+ }
+
/**
* 会员等级 Tab 的字段集(参考主题 CFS_Module::vip_tab 1:1,显示名称并入 Tab)。
*
@@ -661,7 +674,7 @@ class SchemaPayment {
'help' => '会员购买价格配置:执行价、原价、促销标签、标签颜色与会员有效时间',
'fields' => self::vip_product_fields(),
],
- ['key' => 'vip_' . $level . '_img_icon', 'label' => '会员图标', 'type' => 'upload', 'default' => '', 'dependsOn' => $dep, 'help' => '留空使用内置 vip-' . $level . '.svg 图标;建议尺寸300x300'],
+ ['key' => 'vip_' . $level . '_img_icon', 'label' => '会员图标', 'type' => 'upload', 'default' => self::vip_icon_default($level), 'dependsOn' => $dep, 'help' => '默认使用主题自带 vip-' . $level . '.svg 图标;建议尺寸300x300'],
];
}
diff --git a/src/Admin/Schema/SchemaUsers.php b/src/Admin/Schema/SchemaUsers.php
index 7e809f61..6b53182c 100644
--- a/src/Admin/Schema/SchemaUsers.php
+++ b/src/Admin/Schema/SchemaUsers.php
@@ -9,16 +9,33 @@ defined('ABSPATH') || exit;
class SchemaUsers {
+ /**
+ * 等级参数默认值:名称、内置图标 URL、升级经验。
+ *
+ * icon_img_N 直接写入主题自带图标(assets/img/user-level-N.png)的 URL,
+ * 与 Jio\User\Level::get_level_icon_url() 的回退链一致——后台展示的就是
+ * 前台真正使用的图标,而不是一个空白输入框。
+ *
+ * @return array
+ */
private static function default_level_options(): array {
$options = [];
for ($level = 1; $level <= 10; $level++) {
$options['name_' . $level] = 'LV' . $level;
- $options['icon_img_' . $level] = '';
+ $options['icon_img_' . $level] = self::default_level_icon_url($level);
$options['upgrade_integral_' . $level] = $level === 1 ? 0 : ($level - 1) * 500 * $level;
}
return $options;
}
+ /** 主题自带等级图标 URL;缺图时返回空串(前台回退 LV 文本角标)。 */
+ private static function default_level_icon_url(int $level): string {
+ $level = max(1, min(30, $level));
+ $path = 'assets/img/user-level-' . $level . '.png';
+ $file = get_theme_file_path($path);
+ return is_file($file) ? get_theme_file_uri($path) : '';
+ }
+
private static function default_integral_options(): array {
return [
'day_max' => 100, 'sign_up' => 20, 'sign_in' => 5, 'followed' => 5,
@@ -534,7 +551,7 @@ class SchemaUsers {
['key' => 'user_level_notify', 'label' => '升级通知', 'type' => 'switch', 'default' => true],
]],
['key' => 'level_opt', 'title' => '升级阈值', 'fields' => [
- ['key' => 'user_level_opt', 'label' => '等级参数', 'type' => 'json', 'sanitize_type' => 'array', 'default' => self::default_level_options(), 'help' => 'name_N / icon_img_N / upgrade_integral_N'],
+ ['key' => 'user_level_opt', 'label' => '等级参数', 'type' => 'json', 'sanitize_type' => 'array', 'default' => self::default_level_options(), 'help' => 'name_N / icon_img_N / upgrade_integral_N;icon_img_N 默认为主题自带等级图标,清空则前台显示 LV 文本角标'],
]],
['key' => 'integral', 'title' => '经验值得分', 'fields' => [
['key' => 'user_integral_opt', 'label' => '经验值配置', 'type' => 'json', 'sanitize_type' => 'array', 'default' => self::default_integral_options(), 'help' => 'day_max + 行为得分键'],
diff --git a/tests/widget-system/page-display-save-harness.php b/tests/widget-system/page-display-save-harness.php
index bfe3de2c..d823d5ea 100644
--- a/tests/widget-system/page-display-save-harness.php
+++ b/tests/widget-system/page-display-save-harness.php
@@ -65,6 +65,14 @@ namespace {
return 'https://example.test/wp-content/themes/jio';
}
+ function get_theme_file_uri(string $path = ''): string {
+ return 'https://example.test/wp-content/themes/jio/' . ltrim($path, '/');
+ }
+
+ function get_theme_file_path(string $path = ''): string {
+ return dirname(__DIR__, 2) . '/' . ltrim($path, '/');
+ }
+
function home_url($path = ''): string {
return 'https://example.test' . ($path ? '/' . ltrim((string) $path, '/') : '');
}
diff --git a/tests/widget-system/vip-settings-structured-harness.php b/tests/widget-system/vip-settings-structured-harness.php
index b00ff50d..b93bb54e 100644
--- a/tests/widget-system/vip-settings-structured-harness.php
+++ b/tests/widget-system/vip-settings-structured-harness.php
@@ -27,6 +27,8 @@ namespace {
function wp_kses($value, $allowed = null): string { return (string) $value; }
function trailingslashit($value): string { return rtrim((string) $value, '/\\') . '/'; }
function get_template_directory_uri(): string { return 'https://example.test/wp-content/themes/jio'; }
+ function get_theme_file_uri(string $path = ''): string { return 'https://example.test/wp-content/themes/jio/' . ltrim($path, '/'); }
+ function get_theme_file_path(string $path = ''): string { return dirname(__DIR__, 2) . '/' . ltrim($path, '/'); }
function absint($value): int { return max(0, (int) $value); }
function wp_json_encode($value, int $flags = 0): string { return json_encode($value, $flags | JSON_UNESCAPED_SLASHES); }
function is_multisite(): bool { return false; }
diff --git a/tools/admin-contract-report.json b/tools/admin-contract-report.json
index f31e1204..5753ebd0 100644
--- a/tools/admin-contract-report.json
+++ b/tools/admin-contract-report.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-11-01T15:59:01+00:00",
+ "generated_at": "2026-11-02T06:04:33+00:00",
"errors": [],
"warnings": [
"customPage tools-update section 'tools/update' not in PHP schema (ok if pure operational page)",
@@ -258,36 +258,36 @@
"entry": true,
"missing_chunks": [],
"chunks": [
- "SchemaPage.D4P-9DC7.js",
+ "SchemaPage.D9mbKGcx.js",
"vendor-vue.CibbKclz.js",
"FaIcon.DB-L86Cm.js",
"useCollapsibleItems.DZpGrxDC.js",
"vendor-draggable.CJPlJ2VA.js",
- "FaIconPicker.DNtVCp22.js",
+ "FaIconPicker.BAwAiMfQ.js",
"shared-api.CBZ9FiMu.js",
"vendor-misc.DkFG_sHo.js",
"JioColorPicker.QfaAsnV3.js",
"sortable-options.CCWOkUQx.js",
- "level.E3ANSDAX.js",
+ "level.BzX407It.js",
"badge.on0sWygn.js",
"vendor-naive.Dfu2WQKq.js",
"DeferredPage._-8ZQ7kA.js",
- "NativeOpsRedirect.B2wZEyUo.js",
- "FloatingButtonsSettings.DVBbYPoJ.js",
+ "NativeOpsRedirect.zFnHF1SN.js",
+ "FloatingButtonsSettings.DOwK-RTG.js",
"PageHeader.nyzEkEki.js",
- "FooterTabbarSettings.DlI0p5W6.js",
- "PostPageSettings.Bz4V1oqX.js",
- "CommentSettings.By49_Xcw.js",
+ "FooterTabbarSettings.tb4NL7kN.js",
+ "PostPageSettings.BIi2DEZC.js",
+ "CommentSettings.B-GZllSB.js",
"PermissionsCapabilities.DqpqZWmL.js",
"CmsCredits.B6Gorymm.js",
"ThemeInfoPage.D4pAf5Wr.js",
"ThemeAuthorizationPage.dha7vRbS.js",
"DocsPage.Vq5ivh2L.js",
"UsersVerify.DQdIZBGv.js",
- "UsersLevel.DGq7yorC.js",
+ "UsersLevel.9dYF2o-O.js",
"UsersBadge.CDPcEJ-D.js",
"UsersWechatTemplate.CCecYMLT.js",
- "UsersTicket.BFOcGa-7.js",
+ "UsersTicket.DnG1wULZ.js",
"ToolsImportExport.BxHqqdz0.js",
"ToolsHealth.DrJqHumh.js",
"ToolsUpdate.rL8TduLs.js"