123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- // 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 Label1 = this.node.getChildByName("Node").getChildByName("str1").getChildByName("Label1").getComponent(cc.Label)
- let str2 = this.node.getChildByName("Node").getChildByName("str2").getComponent(cc.Label)
- let Label2 = this.node.getChildByName("Node").getChildByName("str2").getChildByName("Label2").getComponent(cc.Label)
- Label1.string = `${this.data.Name}`
- let sss = ''
- if (this.Options.Data.State == 1) {
- //获得
- sss = `亲爱的同事 :
- 由于您昨天旷工,你的职级降级
- 为`
- } else {
- //失去
- sss = `亲爱的同事 :
- 由于您积极工作,你的职级升级
- 为`
- }
- str2.string = sss
- Label2.string = `[ ${this.data.Name} ]`
- }
- // update (dt) {}
- onDestroy(): void {
- NoticeManger.getInstance().Pop()
- HTTPS.Instance.post(NetPost.EditToBenotified,
- { Id: this.Options.Data.Id }).then((resp) => {
- })
- }
- }
|