fix(float): repair VIP rail entry front and admin
Always open VIP modal for float pay_vip, drop forced admin link, normalize gem icon, harden pay-vip click binding and SPA form UX.
This commit is contained in:
@@ -203,6 +203,10 @@
|
||||
<n-input v-model:value="editingItem.link" placeholder="https://example.com 或 /vip" />
|
||||
</n-form-item>
|
||||
|
||||
<n-alert v-if="isPayVip" type="info" :bordered="false" style="margin-bottom: 12px;">
|
||||
会员入口固定打开站点「开通/升级会员」弹窗,无需填写链接;访客点击会先走登录。
|
||||
</n-alert>
|
||||
|
||||
<n-form-item v-if="editingItem.type === 'service_qq' && editingItem.action_mode !== 'qrcode'" label="QQ 号码">
|
||||
<n-input v-model:value="editingItem.qq" placeholder="仅填写数字" />
|
||||
</n-form-item>
|
||||
@@ -392,9 +396,12 @@ const addPresetOptions = computed(() => {
|
||||
})
|
||||
})
|
||||
|
||||
const needsLink = computed(() => ['custom', 'pay_vip', 'add', 'shop_cart'].includes(editingItem.type) && !editingItem.hover)
|
||||
const supportsHover = computed(() => ['custom', 'pay_vip'].includes(editingItem.type))
|
||||
// pay_vip always opens the site VIP modal on the front-end — no link required.
|
||||
const needsLink = computed(() => ['custom', 'add', 'shop_cart'].includes(editingItem.type) && !editingItem.hover)
|
||||
// Custom hover HTML only; VIP uses modal, not free-form hover content.
|
||||
const supportsHover = computed(() => editingItem.type === 'custom')
|
||||
const supportsActionMode = computed(() => ['service_qq', 'service_wechat'].includes(editingItem.type))
|
||||
const isPayVip = computed(() => editingItem.type === 'pay_vip')
|
||||
const isServiceQrcode = computed(() =>
|
||||
['service_qq', 'service_wechat'].includes(editingItem.type) && editingItem.action_mode === 'qrcode'
|
||||
)
|
||||
@@ -435,7 +442,7 @@ function applyTypeDefaults(type) {
|
||||
qrcode: { icon: 'fas fa-qrcode', icon_dark: '', icon_light: '', text: '二维码', desc: '扫码继续浏览', link: '', hover: '', action_mode: 'qrcode', qr_size: 120 },
|
||||
service_qq: { icon: 'fab fa-qq', icon_dark: '', icon_light: '', text: 'QQ', desc: 'QQ 联系', link: '', hover: '', action_mode: 'link', qr_size: 120 },
|
||||
service_wechat: { icon: 'fab fa-weixin', icon_dark: '', icon_light: '', text: '微信', desc: '扫码添加微信', link: '', hover: '', action_mode: 'link', qr_size: 120 },
|
||||
pay_vip: { icon: 'fas fa-crown', icon_dark: '', icon_light: '', text: '会员', desc: '会员入口', link: '', hover: '', action_mode: 'link', qr_size: 120 },
|
||||
pay_vip: { icon: 'fas fa-gem', icon_dark: '', icon_light: '', text: '会员', desc: '开通/升级会员弹窗', link: '', hover: '', action_mode: 'link', qr_size: 120 },
|
||||
add: { icon: 'fas fa-plus', icon_dark: '', icon_light: '', text: '发布', desc: '发布内容', link: '', hover: '', action_mode: 'link', qr_size: 120 },
|
||||
shop_cart: { icon: 'fas fa-shopping-cart', icon_dark: '', icon_light: '', text: '购物车', desc: '购物车入口', link: '', hover: '', action_mode: 'link', qr_size: 120 },
|
||||
}
|
||||
@@ -456,6 +463,14 @@ function handleTypeChange(type) {
|
||||
if (type === 'service_wechat' && editingItem.action_mode === 'qrcode') editingItem.link = ''
|
||||
if (['service_qq', 'service_wechat'].includes(type) && editingItem.action_mode === 'qrcode') editingItem.desc = ''
|
||||
if (!needsLink.value && !['service_qq', 'service_wechat'].includes(type)) editingItem.link = ''
|
||||
// VIP float always uses modal path; never keep a stale custom link/hover.
|
||||
if (type === 'pay_vip') {
|
||||
editingItem.link = ''
|
||||
editingItem.hover = ''
|
||||
if (!editingItem.icon || editingItem.icon.includes('fa-diamond')) {
|
||||
editingItem.icon = 'fas fa-gem'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addItem() {
|
||||
@@ -551,6 +566,7 @@ function getItemSummary(row) {
|
||||
if (row.type === 'service_qq') return row.action_mode === 'qrcode' ? (row.qrcode_img || '未设置 QQ 二维码') : (row.link || row.qq || '未设置 QQ 号码')
|
||||
if (row.type === 'service_wechat') return row.action_mode === 'qrcode' ? (row.wechat_img || '未设置微信二维码') : (row.link || '未设置跳转链接')
|
||||
if (row.type === 'qrcode') return row.desc || '展示当前页面二维码'
|
||||
if (row.type === 'pay_vip') return '点击打开会员开通弹窗(无需填写链接)'
|
||||
if (row.hover) return '使用 HTML 悬浮层内容'
|
||||
return row.link || row.desc || '未设置说明'
|
||||
}
|
||||
@@ -588,7 +604,7 @@ function saveItem() {
|
||||
const item = {
|
||||
id: editingItem.id || `float_${Date.now()}`,
|
||||
type: editingItem.type,
|
||||
icon: editingItem.type === 'theme_mode' ? 'fas fa-sun' : editingItem.icon,
|
||||
icon: editingItem.type === 'theme_mode' ? 'fas fa-sun' : (editingItem.type === 'pay_vip' ? (editingItem.icon || 'fas fa-gem') : editingItem.icon),
|
||||
icon_dark: '',
|
||||
icon_light: '',
|
||||
text: editingItem.text,
|
||||
@@ -597,14 +613,17 @@ function saveItem() {
|
||||
qq: editingItem.type === 'service_qq' && editingItem.action_mode !== 'qrcode' ? editingItem.qq : '',
|
||||
qrcode_img: editingItem.type === 'service_qq' && editingItem.action_mode === 'qrcode' ? editingItem.qrcode_img : '',
|
||||
wechat_img: editingItem.type === 'service_wechat' && editingItem.action_mode === 'qrcode' ? editingItem.wechat_img : '',
|
||||
link: (needsLink.value || (editingItem.type === 'service_wechat' && editingItem.action_mode !== 'qrcode') || (editingItem.type === 'service_qq' && editingItem.action_mode !== 'qrcode' && !!editingItem.link)) ? editingItem.link : '',
|
||||
// pay_vip never stores a custom link — front-end always opens the VIP modal.
|
||||
link: editingItem.type === 'pay_vip'
|
||||
? ''
|
||||
: ((needsLink.value || (editingItem.type === 'service_wechat' && editingItem.action_mode !== 'qrcode') || (editingItem.type === 'service_qq' && editingItem.action_mode !== 'qrcode' && !!editingItem.link)) ? editingItem.link : ''),
|
||||
add_items: editingItem.type === 'add' ? editingItem.add_items.filter(subItem => subItem.label || subItem.url).map((subItem, idx) => ({
|
||||
id: subItem.id || `add_${idx}`,
|
||||
label: subItem.label || '',
|
||||
icon: subItem.icon || 'fas fa-pen',
|
||||
url: subItem.url || '',
|
||||
})) : [],
|
||||
hover: supportsHover.value ? (editingItem.hover || '') : '',
|
||||
hover: editingItem.type === 'pay_vip' ? '' : (supportsHover.value ? (editingItem.hover || '') : ''),
|
||||
qr_size: editingItem.type === 'qrcode' ? (editingItem.qr_size || 120) : 120,
|
||||
hover_width: supportsHover.value ? (editingItem.hover_width || 200) : 200,
|
||||
pc_s: editingItem.pc_s,
|
||||
|
||||
Reference in New Issue
Block a user