/** 红包码item */ import { RecordTYPE } from "../datas/CommonData"; import AdM from "../manager/AdM"; import GameM, { AUDIO_TYPE } from "../manager/GameM"; const { ccclass, property } = cc._decorator; @ccclass export default class RedCodeItem extends cc.Component { @property(cc.Label) labMoney: cc.Label = null; @property(cc.Label) labTime: cc.Label = null; @property(cc.Label) labRedCode: cc.Label = null; date: number code = '' start() { } /** * * @param money 金额 * @param date 日期 * @param withdrawalCode 红包码 * @param cashType 提现类型,主要区分是否是裂变 */ init(money, date, withdrawalCode, cashType = 0) { this.date = date this.code = withdrawalCode if (cashType == 50) { this.labTime.string = date } else { let tdate = new Date(this.date * 1000) this.labTime.string = tdate.getFullYear() + '-' + (tdate.getMonth() + 1) + '-' + tdate.getDate() } this.labMoney.string = `金额:${money}元` this.labRedCode.string = `红包码:${this.code}` } /** 点击复制红包码 */ clickCopyRedCode() { GameM.audioM.playEffect(AUDIO_TYPE.button) AdM.setClipboard(this.code) } }