diff --git a/assets/admin/src/components/floating/FloatBtnItemPanel.vue b/assets/admin/src/components/floating/FloatBtnItemPanel.vue index 794f510f..2ace262d 100644 --- a/assets/admin/src/components/floating/FloatBtnItemPanel.vue +++ b/assets/admin/src/components/floating/FloatBtnItemPanel.vue @@ -5,6 +5,9 @@ {{ meta.title }} + + {{ meta.warn }} + PC 移动 @@ -14,10 +17,6 @@ - - {{ meta.warn }} - - {{ meta.panel }} @@ -35,23 +34,9 @@ - - - - - 选择并排序按钮,未开启的功能不会显示 - - - - - - + + + @@ -76,7 +61,7 @@ import FaIconPicker from '@/components/form/FaIconPicker.vue' import AksMediaField from '@/components/form/AksMediaField.vue' import FloatBtnCommonFields from './FloatBtnCommonFields.vue' import FloatMoreButtonsEditor from './FloatMoreButtonsEditor.vue' -import { ADD_BTN_OPTIONS, FLOAT_BTN_META } from './floating-defaults.js' +import { FLOAT_BTN_META } from './floating-defaults.js' const props = defineProps({ modelValue: { type: Object, required: true }, @@ -135,9 +120,12 @@ function patch(partial) { } .float-btn-panel__warn { - padding: 0 14px 10px 48px; font-size: 12px; color: #f0a020; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + min-width: 0; } .float-btn-panel__body { diff --git a/assets/admin/src/components/floating/floating-defaults.js b/assets/admin/src/components/floating/floating-defaults.js index e50da506..56f6b6a6 100644 --- a/assets/admin/src/components/floating/floating-defaults.js +++ b/assets/admin/src/components/floating/floating-defaults.js @@ -16,9 +16,32 @@ export const FLOAT_BTN_META = { more: { title: '更多按钮', panel: '添加更多自定义按钮' }, } -/** 发布按钮可选项。 */ -export const ADD_BTN_OPTIONS = [{ label: '文章投稿', value: 'post' }] +const themeUri = (window.aksrtAdminData?.themeUri || '').replace(/\/$/, '') +/** 「更多按钮」出厂默认项(对齐参考主题 float_btn.more 默认值)。 */ +export function giftMoreButton() { + return { + desc: '本站同款主题模板', + icon: 'zibsvg-gift-color', + link: { url: '', target: '' }, + hover: ` + + + + 本站同款主题模板 + zibll子比主题是一款漂亮优雅的网站主题模板,功能强大,配置简单。 + 查看详情 + + +`, + hover_width: 240, + pc_s: true, + m_s: true, + color: { color: '', bg: 'rgba(255, 111, 6, 0.2)' }, + } +} + +/** 「添加按钮」新增项默认值(参考主题 group 字段默认值)。 */ export function defaultMoreButton() { return { desc: '', @@ -26,17 +49,17 @@ export function defaultMoreButton() { link: { url: '', target: '' }, hover: '', hover_width: 200, - pc_s: false, - m_s: false, - color: { color: '', bg: 'rgba(255, 111, 6, 0.2)' }, + pc_s: true, + m_s: true, + color: { color: '', bg: '' }, } } export function defaultItems() { return [ - { type: 'more', buttons: [defaultMoreButton()] }, + { type: 'more', buttons: [giftMoreButton()] }, { type: 'pay_vip', pc_s: true, m_s: true, color: { color: '#f2c97d', bg: 'rgba(62,62,67,0.9)' } }, - { type: 'add', pc_s: true, m_s: false, color: emptyColor(), btns: ['post'], icon: 'fa fas fa-pencil-alt' }, + { type: 'add', pc_s: true, m_s: false, color: emptyColor(), icon: 'fa fas fa-pencil-alt' }, { type: 'service_qq', pc_s: false, m_s: false, color: emptyColor(), qq: '' }, { type: 'service_wechat', pc_s: true, m_s: true, color: emptyColor(), wechat_img: '' }, { type: 'theme_mode', pc_s: false, m_s: false, color: emptyColor() }, diff --git a/inc/helpers/aksrt-float-buttons.php b/inc/helpers/aksrt-float-buttons.php index 231ba309..2de2b4a3 100644 --- a/inc/helpers/aksrt-float-buttons.php +++ b/inc/helpers/aksrt-float-buttons.php @@ -71,41 +71,27 @@ endif; if (!function_exists('aksrt_get_float_add_html')) : /** - * 发布按钮:单项直接链接;多项 hover 下拉 .drop-newadd。 - * - * @param string[] $types + * 发布按钮:当前仅文章投稿,对应参考主题单按钮分支(直接链接)。 */ - function aksrt_get_float_add_html(array $types, string $icon, string $style): string { - if (!$types || !function_exists('aksrt_get_new_add_actions')) { + function aksrt_get_float_add_html(string $icon, string $style, bool $is_mobile): string { + if (!function_exists('aksrt_get_new_add_actions')) { return ''; } if (class_exists('\AKSRT\Settings\Settings') && \AKSRT\Settings\Settings::close_sign()) { return ''; } - $actions = aksrt_get_new_add_actions($types); + $actions = aksrt_get_new_add_actions(['post']); if (!$actions) { return ''; } + $a = $actions[0]; $icon_html = $icon !== '' ? aksrt_icon_markup($icon) : ''; if ($icon_html === '') { $icon_html = ''; } - if (count($actions) === 1) { - $a = $actions[0]; - return '' . $icon_html . ''; - } - - $btns = ''; - foreach ($actions as $a) { - $btns .= '' - . '' . aksrt_icon_markup((string) $a['icon']) . '' - . '' . esc_html($a['label']) . ''; - } - - return '' . $icon_html - . '' . $btns . ''; + return '' . $icon_html . ''; } endif; @@ -185,7 +171,7 @@ if (!function_exists('aksrt_float_right')) : switch ($type) { case 'theme_mode': - $btn .= ''; + $btn .= ''; break; case 'back_top': @@ -224,7 +210,8 @@ if (!function_exists('aksrt_float_right')) : break; case 'add': - $btn .= aksrt_get_float_add_html((array) ($opt['btns'] ?? []), (string) ($opt['icon'] ?? ''), $style); + // 当前仅支持文章投稿,发布类型固定为 post。 + $btn .= aksrt_get_float_add_html((string) ($opt['icon'] ?? ''), $style, $is_mobile); break; case 'more': diff --git a/src/Settings/FloatButtons.php b/src/Settings/FloatButtons.php index 3818b093..bfa96eb9 100644 --- a/src/Settings/FloatButtons.php +++ b/src/Settings/FloatButtons.php @@ -18,9 +18,6 @@ class FloatButtons { /** 固定按钮类型(默认显示顺序)。 */ public const TYPES = ['more', 'pay_vip', 'add', 'service_qq', 'service_wechat', 'theme_mode', 'qrcode', 'back_top']; - /** 发布按钮可选类型。 */ - public const ADD_BTNS = ['post']; - /** * 默认配置。 */ @@ -35,10 +32,10 @@ class FloatButtons { 'items' => [ [ 'type' => 'more', - 'buttons' => [self::default_more_button()], + 'buttons' => [self::gift_more_button()], ], ['type' => 'pay_vip', 'pc_s' => true, 'm_s' => true, 'color' => ['color' => '#f2c97d', 'bg' => 'rgba(62,62,67,0.9)']], - ['type' => 'add', 'pc_s' => true, 'm_s' => false, 'color' => $empty_color, 'btns' => ['post'], 'icon' => 'fa fas fa-pencil-alt'], + ['type' => 'add', 'pc_s' => true, 'm_s' => false, 'color' => $empty_color, 'icon' => 'fa fas fa-pencil-alt'], ['type' => 'service_qq', 'pc_s' => false, 'm_s' => false, 'color' => $empty_color, 'qq' => ''], ['type' => 'service_wechat', 'pc_s' => true, 'm_s' => true, 'color' => $empty_color, 'wechat_img' => ''], ['type' => 'theme_mode', 'pc_s' => false, 'm_s' => false, 'color' => $empty_color], @@ -49,18 +46,44 @@ class FloatButtons { } /** - * 默认「更多按钮」子项。 + * 「更多按钮」出厂默认项(对齐参考主题 float_btn.more 默认值)。 */ - public static function default_more_button(): array { + public static function gift_more_button(): array { + $img = get_template_directory_uri() . '/assets/img/logo.png'; + return [ + 'desc' => '本站同款主题模板', + 'icon' => 'zibsvg-gift-color', + 'link' => ['url' => '', 'target' => ''], + 'hover' => ' + + + + 本站同款主题模板 + zibll子比主题是一款漂亮优雅的网站主题模板,功能强大,配置简单。 + 查看详情 + + +', + 'hover_width' => 240, + 'pc_s' => true, + 'm_s' => true, + 'color' => ['color' => '', 'bg' => 'rgba(255, 111, 6, 0.2)'], + ]; + } + + /** + * 「添加按钮」新增项默认值(参考主题 group 字段默认值)。 + */ + public static function new_more_button(): array { return [ 'desc' => '', 'icon' => 'fa fas fa-heart', 'link' => ['url' => '', 'target' => ''], 'hover' => '', 'hover_width' => 200, - 'pc_s' => false, - 'm_s' => false, - 'color' => ['color' => '', 'bg' => 'rgba(255, 111, 6, 0.2)'], + 'pc_s' => true, + 'm_s' => true, + 'color' => ['color' => '', 'bg' => ''], ]; } @@ -139,7 +162,7 @@ class FloatButtons { } // 参考主题:至少保留一个。 if ($buttons === []) { - $buttons[] = self::default_more_button(); + $buttons[] = self::new_more_button(); } return ['type' => 'more', 'buttons' => $buttons]; } @@ -153,14 +176,6 @@ class FloatButtons { switch ($type) { case 'add': - $btns = []; - foreach ((array) ($item['btns'] ?? []) as $btn) { - $btn = (string) $btn; - if (in_array($btn, self::ADD_BTNS, true) && !in_array($btn, $btns, true)) { - $btns[] = $btn; - } - } - $out['btns'] = $btns; $out['icon'] = aksrt_sanitize_icon_value((string) ($item['icon'] ?? '')); break; case 'service_qq': diff --git a/tools/admin-contract-report.json b/tools/admin-contract-report.json index de7faccb..9cb43866 100644 --- a/tools/admin-contract-report.json +++ b/tools/admin-contract-report.json @@ -1,5 +1,5 @@ { - "generated_at": "2026-09-26T12:42:35+00:00", + "generated_at": "2026-09-26T12:59:57+00:00", "errors": [], "warnings": [ "customPage tools-update section 'tools/update' not in PHP schema (ok if pure operational page)", @@ -62,7 +62,7 @@ "info": [ "PHP schema domains: global, page_display, post_list, permissions, users, payment, extensions, tools, ExtensionsAudit, ExtensionsIP, ExtensionsPush, ToolsBackup, ToolsHealth, ToolsImportExport", "Menu pages discovered: 60", - "admin build ok; chunks=30" + "admin build ok; chunks=31" ], "domains": { "global": { @@ -232,36 +232,37 @@ "entry": true, "missing_chunks": [], "chunks": [ - "SchemaPage.DXZIPvzD.js", + "SchemaPage.raPtoAxi.js", "vendor-vue.BYzo-2I-.js", "FaIcon.B3OOcphx.js", - "FaIconPicker.DHrC0Y72.js", - "shared-api.BvxssbgC.js", + "FaIconPicker.ZNRF6_J7.js", + "shared-api.D5VInyXf.js", + "AksMediaField.DTi5-IR5.js", "vendor-misc.buu8cFA9.js", "level.E3ANSDAX.js", "badge.CKTsmH1z.js", "vendor-naive.D3KCxD1U.js", "DeferredPage.BR2FUrUF.js", "NativeOpsRedirect.DMOc4MZt.js", - "FloatingButtonsSettings.ChAj9F5j.js", + "FloatingButtonsSettings.CbTzuMvj.js", "vendor-draggable.YNevSrwY.js", "PageHeader.jmNZVzHG.js", - "FooterTabbarSettings.CwSsjNlJ.js", - "PostPageSettings.D7aU7Dv6.js", - "CommentSettings.CyFC7ABH.js", - "PermissionsCapabilities.BeLUij9c.js", - "CmsCredits.CTDJTkG-.js", - "ThemeInfoPage.CbJKzVFa.js", + "FooterTabbarSettings.BFZnXJRS.js", + "PostPageSettings.CV4lCwlK.js", + "CommentSettings.DINI9YV7.js", + "PermissionsCapabilities.Dwo7ED9D.js", + "CmsCredits.BeYe9Q4u.js", + "ThemeInfoPage.BEUFF9-H.js", "ThemeAuthorizationPage.DqXs-wcM.js", - "DocsPage.0VHAQOLD.js", - "UsersVerify.BwpKCOcv.js", - "UsersLevel.BOBrM4ao.js", - "UsersBadge.BoxXBYpU.js", - "UsersWechatTemplate.CEr5O4Ax.js", - "ToolsImportExport.CAIX07JQ.js", - "ToolsHealth.DAW9Zcoi.js", - "ToolsUpdate.DlvVMvXs.js", - "ExtensionAI.CJ_ZQ8Tr.js" + "DocsPage.C9brbZ0-.js", + "UsersVerify.DF6GIMJm.js", + "UsersLevel.r4FMbDJx.js", + "UsersBadge.DQwTkMyA.js", + "UsersWechatTemplate.-k8FkSa8.js", + "ToolsImportExport.BcC8WeEX.js", + "ToolsHealth.pQpCqHX1.js", + "ToolsUpdate.Dl-oC250.js", + "ExtensionAI.B5qc_0CR.js" ] } } \ No newline at end of file