QRCodeViewImpl.ts 1.04 KB
import { SDK } from "simba-sdk";
import { DummyLabel, DummySprite } from "../../../../common/CCDummyObjects";
import { CCPureView } from "../../../../common/classbase/CCViewBase";
import CustomerServiceDataCenter from "../../../../customerService/script/CustomerServiceDataCenter";
import { RegView } from "../../PresenterCCViewFactory";
import { QRCodeViewType, QRCodeViewProps, QRCodeView } from "../type/QRCodeView";

const { ccclass, property } = cc._decorator;

@ccclass
@RegView(QRCodeViewType, "prefab/ui/QRCodeView")
export class QRCodeViewImpl extends CCPureView<QRCodeViewProps> implements QRCodeView {

    @property(cc.Label)
    private tipLabel = DummyLabel;
    @property(cc.Sprite)
    private qrCodeSprite = DummySprite;

    onLoad() {
        this.bindProp("tipLabel", this.tipLabel, "string");
        this.bindProp("qrCodePath", (value) => {
            CustomerServiceDataCenter.getInstance().refreshQRCode(value, this.qrCodeSprite);
        });
    }

    onCloseClickCallBack() {
        this.close();
        SDK.showGameClubButton();
    }
}