yfs/common/platform/AppPlatform.js
2025-05-03 03:58:13 +08:00

29 lines
873 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import BasePlatform from './BasePlatform';
class AppPlatform extends BasePlatform {
constructor() {
super();
this.code = 'APP_ANDROID';
this.env = 'app';
}
getPayData(url,data) {
return data;
}
pay({ data }) {
return new Promise((resolve) => {
console.log(`App支付${data.amount}分,订单号:${data.orderId}`);
// 模拟调用H5支付SDK
// window.H5PaySDK?.pay(data.amount, data.orderId, resolve);
});
}
share({ title, desc, image, url }) {
console.log(`H5分享${title} - ${desc}`);
// 调用浏览器原生分享(如果可用)
if (navigator.share) {
return navigator.share({ title, text: desc, url });
}
// 降级方案
alert(`请手动分享:${url}`);
}
}
export default AppPlatform;