支付页面

qrcode生成,剪贴板sdk
This commit is contained in:
2025-09-18 23:33:06 +08:00
parent 85c8b51316
commit de0c97fc05
29 changed files with 3202 additions and 1852 deletions
@@ -7,6 +7,9 @@ import { OrderData } from "../../data/OrderData";
import proto from "db://assets/Scripts/proto/proto.pb.js";
import ResManager from "../../../Main/Manager/ResManager";
import { PurchasePanel } from "./PurchasePanel";
import { QRCodeGenerator } from "db://assets/utils/qrcodeGenerator";
import { TipsPanel } from "./TipsPanel";
import { SDKManager } from "../../../Main/Channel/SDKManager";
const { ccclass, property } = _decorator;
@@ -21,6 +24,7 @@ export class Web3PopPanel extends li_BaseView {
private expireTimeText: Label;
private selection: Node;
private qrCode: Sprite;
private curType: proto.cs.EnmNetworkType;
private orderId;
@@ -43,6 +47,7 @@ export class Web3PopPanel extends li_BaseView {
this.coinText = this._nodeTab.SelectedCoinText.getComponent(Label);
this.address = this._nodeTab.addressText.getComponent(Label);
this.expireTimeText = this._nodeTab.expireTimeText.getComponent(Label);
this.qrCode = this._nodeTab.qrCode.getComponent(Sprite);
this.registerListener();
this.selection.setScale(new Vec3(1, 0, 1));
@@ -107,6 +112,7 @@ export class Web3PopPanel extends li_BaseView {
const expireTime = OrderData.getExpireById(this.orderId);
const retCode = OrderData.getRetCodeById(this.orderId);
this.expireTimeText.string = expireTime.toString();
this.amount.string = amount;
this.address.string = walletUrl;
switch (this.networkType) {
@@ -139,6 +145,21 @@ export class Web3PopPanel extends li_BaseView {
this.coinText.string = "ENT_BEP";
break;
}
//this.address.string = "asdasdasd";
//refreshQRcode
QRCodeGenerator.generateQRCodeSpriteFrame(
this.address.string,
320,
4,
(spriteframe) => {
if (spriteframe) {
this.qrCode.spriteFrame = spriteframe;
} else {
TipsPanel.show("qrcode generation fail, please copy url");
}
}
);
}
updateSelectNetwork() {}
@@ -166,7 +187,15 @@ export class Web3PopPanel extends li_BaseView {
}
onClickCopy() {
//todo:copy 功能
const stringToCopy = this.address.string;
SDKManager.copyToClipboard(stringToCopy, (success: boolean) => {
if (success) {
TipsPanel.show("地址已复制到剪贴板");
} else {
TipsPanel.show("复制失败,请手动复制地址");
}
});
}
onClickClose() {