// 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 { PopName } from "../EventName/EventName"; import Sdk from "../SDK/SDK"; import HTTPS, { NetPost } from "../Template/HTTPS"; import PopComponet from "../Template/PopComponet"; import CollectManger from "./CollectManger"; import PopManger from "./PopManger"; export enum IDcardType { My = 0, Firend = 1, } interface UserData { Name: string | null; Tel: string | null; Picture: string | null; CollectId: number; Collect: string; PositionLevelId: number; PositionLevelName: string; Area: string | null; Day: number; } const { ccclass, property } = cc._decorator; @ccclass export default class IDcard extends PopComponet { TitleArray = ['我的工卡', '大鹅公司'] @property(cc.Label) Title: cc.Label = null @property(cc.Sprite) image: cc.Sprite = null @property(cc.Label) name1: cc.Label = null @property(cc.Label) level: cc.Label = null @property(cc.Label) succeedWork: cc.Label = null start(): void { let res = this.Options.Data.resp //title this.Title.string = this.TitleArray[this.Options.Data.IDcardType] let UserINfo = this.node.getChildByName("Node").getChildByName("UserINfo") if (res.Name || res.Picture) { //授权了 this.name1.string = res.Name UserINfo.active = false } else { UserINfo.active = true //没授权 this.name1.string = '待授权' } this.level.string = res.PositionLevelName this.succeedWork.string = `累计成功上班 ${res.Day}次` if (res.Collect) { cc.assetManager.loadRemote(res.Collect, (err, res: cc.Texture2D) => { if (!err) { this.image.spriteFrame = new cc.SpriteFrame(res) } }) } } click() { HTTPS.Instance.post(NetPost.GetUserCollectList, {}).then((resp) => { CollectManger.getInstance().init(resp) PopManger.getInstance().Pop(PopName.Collect) }) } shouquan() { Sdk.getInstance().ShouQuan() } }