feat(player): 充值订单详情与审核记录,优化桌面端交互与记录列表样式
新增充值详情页及单条订单 API,修复桌面充值提交路径;充值/注单记录编号改为中性色,并包含桌面首页与投注相关 UI 改进。
This commit is contained in:
@@ -5,20 +5,45 @@ const visible = ref(false);
|
||||
const anchorX = ref(0);
|
||||
const anchorY = ref(0);
|
||||
const pendingItem = ref<SlipItem | null>(null);
|
||||
const placement = ref<'top' | 'bottom'>('bottom');
|
||||
let closeTimer: number | undefined = undefined;
|
||||
|
||||
export function useDesktopBetPopover() {
|
||||
function openAt(event: MouseEvent, item: SlipItem) {
|
||||
const pad = 12;
|
||||
const popW = 300;
|
||||
const popH = 320;
|
||||
let x = event.clientX + pad;
|
||||
let y = event.clientY + pad;
|
||||
cancelClose();
|
||||
|
||||
const el = (event.currentTarget || event.target) as HTMLElement;
|
||||
const btn = el?.closest?.('button') || el;
|
||||
const rect = btn?.getBoundingClientRect?.();
|
||||
if (!rect) return;
|
||||
|
||||
const popW = 190;
|
||||
const popH = 170;
|
||||
const pad = 12; // increased pad to leave space for the arrow pointer
|
||||
|
||||
// Calculate center X of the button
|
||||
const btnCenterX = rect.left + rect.width / 2;
|
||||
let x = btnCenterX - popW / 2;
|
||||
|
||||
// Default: place below button (center bottom)
|
||||
let y = rect.bottom + pad;
|
||||
placement.value = 'bottom';
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
x = Math.min(x, window.innerWidth - popW - pad);
|
||||
y = Math.min(y, window.innerHeight - popH - pad);
|
||||
const spaceBelow = window.innerHeight - rect.bottom;
|
||||
if (spaceBelow < popH + pad) {
|
||||
// Not enough space below, place above button (center top)
|
||||
y = rect.top - popH - pad;
|
||||
placement.value = 'top';
|
||||
}
|
||||
|
||||
// Keep within viewport boundaries
|
||||
x = Math.max(pad, Math.min(x, window.innerWidth - popW - pad));
|
||||
y = Math.max(pad, Math.min(y, window.innerHeight - popH - pad));
|
||||
}
|
||||
anchorX.value = Math.max(pad, x);
|
||||
anchorY.value = Math.max(pad, y);
|
||||
|
||||
anchorX.value = x;
|
||||
anchorY.value = y;
|
||||
pendingItem.value = item;
|
||||
visible.value = true;
|
||||
}
|
||||
@@ -26,6 +51,28 @@ export function useDesktopBetPopover() {
|
||||
function close() {
|
||||
visible.value = false;
|
||||
pendingItem.value = null;
|
||||
if (closeTimer !== undefined) {
|
||||
window.clearTimeout(closeTimer);
|
||||
closeTimer = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function scheduleClose(delay = 200) {
|
||||
if (closeTimer !== undefined) {
|
||||
window.clearTimeout(closeTimer);
|
||||
}
|
||||
closeTimer = window.setTimeout(() => {
|
||||
visible.value = false;
|
||||
pendingItem.value = null;
|
||||
closeTimer = undefined;
|
||||
}, delay);
|
||||
}
|
||||
|
||||
function cancelClose() {
|
||||
if (closeTimer !== undefined) {
|
||||
window.clearTimeout(closeTimer);
|
||||
closeTimer = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -33,7 +80,10 @@ export function useDesktopBetPopover() {
|
||||
anchorX,
|
||||
anchorY,
|
||||
pendingItem,
|
||||
placement,
|
||||
openAt,
|
||||
close,
|
||||
scheduleClose,
|
||||
cancelClose,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user