// Learn TypeScript: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html // Learn Attribute: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html import HTTPS, { NetPost } from "../../Template/HTTPS"; import PopComponet from "../../Template/PopComponet"; import NoticeManger from "../NoticeManger"; const { ccclass, property } = cc._decorator; @ccclass export default class HrNotice extends PopComponet { data: { Id: number; Name: string; Picture: string; } protected start(): void { try { this.data = JSON.parse(this.Options.Data.Data) } catch (error) { } this.Loadimage() } Loadimage() { if (!this.data) { return } cc.assetManager.loadRemote(this.data.Picture, (err, res: cc.Texture2D) => { if (!err) { let image = this.node.getChildByName("Node").getChildByName("mask").getChildByName("image").getComponent(cc.Sprite) image.spriteFrame = new cc.SpriteFrame(res); } }) let label = this.node.getChildByName("Node").getChildByName("2").getChildByName("str").getComponent(cc.Label) label.string = `恭喜荣获${this.data.Name}` let name = this.node.getChildByName("Node").getChildByName("name").getComponent(cc.Label) name.string = `${this.data.Name}` } // update (dt) {} onDestroy(): void { NoticeManger.getInstance().Pop() HTTPS.Instance.post(NetPost.EditToBenotified, { Id: this.Options.Data.Id }).then((resp) => { }) } }