import { _decorator, Component, Button, Node } from 'cc'; import { Http } from '../../core/net/Http'; import { WindowManager } from '../../core/ui/window/WindowManager'; import { g } from '../../Data/g'; import { platform } from '../../Data/platform'; const { ccclass, property } = _decorator; @ccclass('ShareAlertWindow') export class ShareAlertWindow extends Component { @property({ type: Http, tooltip: "http组件" }) http: Http; @property({ type: Node, tooltip: "立即邀请按钮" }) inviteButton: Node; @property({ type: Node, tooltip: "邀请文字" }) inviteByte: Node; public async onInviteButton() { let result = await this.http.send("/api/app/share", {}); if (result.code == 0) { platform.wxShare(result.data.url, result.data.title, result.data.descroption); } else { WindowManager.showTips("分享信息获取失败,请稍后再试"); } } update() { if (g.wechatData.shareSuccess) { g.wechatData.shareSuccess = false; this.shareComplete(); } } private async shareComplete() { WindowManager.close(this.node); } }