CalendarContent.ts 992 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { CommonContentApi, GetContentListItem, GetContentListParams } from '../CommonContent';
  2. export class CalendarListItem extends GetContentListItem {
  3. constructor() {
  4. super();
  5. this._nameMapperServer = {
  6. lunar: 'date',
  7. lunar_date: 'dateString',
  8. }
  9. const old = this._afterSolveServer;
  10. this._afterSolveServer = (data) => {
  11. old?.(data);
  12. const date = new Date(this.date);
  13. this.dateObj = date;
  14. this.dateYear = date.getFullYear();
  15. this.dateMonth = date.getMonth() + 1;
  16. }
  17. }
  18. date = '';
  19. dateString = '';
  20. dateObj = new Date();
  21. dateYear = 0;
  22. dateMonth = 0;
  23. }
  24. export class CalendarContentApi extends CommonContentApi {
  25. constructor() {
  26. super(undefined, 18, "闽南节庆日历", 272);
  27. }
  28. getCalendarList(params: GetContentListParams, page: number, pageSize?: number) {
  29. return super.getContentList<CalendarListItem>(params, page, pageSize, CalendarListItem);
  30. }
  31. }
  32. export default new CalendarContentApi();