feat(payment): add H5/mobile payment support
Backend: - Parse EasyPay `payurl2` field, prefer H5 link on mobile - Add `device=mobile` to EasyPay submit.php (popup) mode - Expand isMobile detection keywords (add ipad/ipod) Frontend: - Add `isMobileDevice()` utility (userAgentData + UA regex) - Mobile + pay_url: direct redirect instead of QR/popup - Popup blocked fallback: auto-redirect when window.open fails - Stripe WeChat Pay: dynamic client param (mobile_web vs web)
This commit is contained in:
11
frontend/src/utils/device.ts
Normal file
11
frontend/src/utils/device.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Detect whether the current device is mobile.
|
||||
* Uses navigator.userAgentData (modern API) with UA regex fallback.
|
||||
*/
|
||||
export function isMobileDevice(): boolean {
|
||||
const nav = navigator as unknown as Record<string, unknown>
|
||||
if (nav.userAgentData && typeof (nav.userAgentData as Record<string, unknown>).mobile === 'boolean') {
|
||||
return (nav.userAgentData as Record<string, unknown>).mobile as boolean
|
||||
}
|
||||
return /Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent)
|
||||
}
|
||||
Reference in New Issue
Block a user