AdvCardParser.ets 2.5 KB
import { CompStyle } from 'wdConstant';
import { CompDTO } from 'wdBean';
import { CardAdvThreeImageComponent } from './CardAdvThreeImageComponent';
import { CardAdvSmallImageComponent } from './CardAdvSmallImageComponent';
import { CardAdvLongImageComponent } from './CardAdvLongImageComponent';
import { CardAdvBigImageComponent } from './CardAdvBigImageComponent';
import { CardAdvVideoComponent } from './CardAdvVideoComponent';
import { CardAdvGanMiComponent } from './CardAdvGanMiComponent';
import { CardAdvVideoExComponent } from './CardAdvVideoExComponent';
import PageModel from '../../viewmodel/PageModel';

/**
 * @Description: 广告稿件解析类
 * @Author:
 * @Email: liyubing@wondertek.com.cn
 * @CreateDate:
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
@Component
export struct AdvCardParser {
  @State compDTO: CompDTO = {} as CompDTO;
  pageModel: PageModel = new PageModel();
  @State compIndex: number = 0;


  build() {
    this.contentBuilder(this.pageModel, this.compDTO);
  }

  @Builder
  contentBuilder(pageModel: PageModel, compDTO: CompDTO) {
    if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_5) { //三图广告
      CardAdvThreeImageComponent({ pageModel, compDTO, loadImg: this.pageModel.loadImg ,compIndex:this.compIndex})
    } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_6) { //小图广告
      CardAdvSmallImageComponent({ pageModel, compDTO, loadImg: this.pageModel.loadImg ,compIndex:this.compIndex})
    } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_7 ||
      compDTO.matInfo.advSubType === CompStyle.Card_Adv_12) { // 长通栏广告 和 顶部长通栏广告
      CardAdvLongImageComponent({  pageModel, compDTO, loadImg: this.pageModel.loadImg ,compIndex:this.compIndex})
    } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_8) { //大图广告
      CardAdvBigImageComponent({ pageModel, compDTO , loadImg: this.pageModel.loadImg,compIndex:this.compIndex})
    } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_9) { //视频广告
      CardAdvVideoComponent({ pageModel, compDTO, loadImg: this.pageModel.loadImg ,compIndex:this.compIndex})
    } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_10) { //展会广告
      CardAdvVideoExComponent({ pageModel, compDTO, loadImg: this.pageModel.loadImg,compIndex:this.compIndex})
    } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_11) { //冠名广告
      CardAdvGanMiComponent({ pageModel, compDTO , loadImg: this.pageModel.loadImg,compIndex:this.compIndex})
    }
  }
}