DrawRedRecordItem.js 811 B

12345678910111213141516171819202122232425262728293031323334
  1. const DWTool = require("../utils/DWTool");
  2. cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. titltRicheText: cc.RichText,
  6. },
  7. // LIFE-CYCLE CALLBACKS:
  8. // onLoad () {},
  9. start () {
  10. },
  11. //createTime 获取红包的时间
  12. // 是 [long] 查看hb
  13. init(redData) {
  14. var date = new Date(redData.createTime);
  15. Y = date.getFullYear() + '-';
  16. M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1 ) : date.getMonth() +1 ) + '-';
  17. D = date.getDate() + ' ';
  18. h = date.getHours() + ':';
  19. m = date.getMinutes() + ':';
  20. s = date.getSeconds();
  21. let string = Y+M+D+h+m+s + ' ' + `红包+ ${redData.hb}`;
  22. this.titltRicheText.string = `<b><color=#613f16>string</c></b>`
  23. }
  24. // update (dt) {},
  25. });