chenjun

单图卡,小视频卡 来源需要控制16个字

大图卡,三图卡,来源可以展示一行的就不需要控制16个字
1 import { CompDTO, ContentDTO } from 'wdBean' 1 import { CompDTO, ContentDTO } from 'wdBean'
2 -import { CommonConstants } from 'wdConstant/Index'; 2 +import { CommonConstants, CompStyle } from 'wdConstant/Index';
3 import { DateTimeUtils, Logger } from 'wdKit/Index'; 3 import { DateTimeUtils, Logger } from 'wdKit/Index';
4 import router from '@ohos.router' 4 import router from '@ohos.router'
5 5
@@ -20,9 +20,16 @@ export struct CardSourceInfo { @@ -20,9 +20,16 @@ export struct CardSourceInfo {
20 this.processText(); 20 this.processText();
21 } 21 }
22 22
  23 + private isLimited(): boolean {
  24 + return this.compDTO.compStyle === CompStyle.Card_13
  25 + || this.compDTO.compStyle === CompStyle.Card_14
  26 + || this.compDTO.compStyle === CompStyle.Card_06
  27 + || this.compDTO.compStyle === CompStyle.Card_21;
  28 + }
  29 +
23 processText() { 30 processText() {
24 const sourceText = this.contentDTO.rmhPlatform === 1 ? this.contentDTO.rmhInfo?.rmhName : this.contentDTO.source; 31 const sourceText = this.contentDTO.rmhPlatform === 1 ? this.contentDTO.rmhInfo?.rmhName : this.contentDTO.source;
25 - if (sourceText.length > this.maxLength) { 32 + if (this.isLimited() && sourceText.length > this.maxLength) {
26 this.displayText = sourceText.substring(0, this.maxLength) + '...'; 33 this.displayText = sourceText.substring(0, this.maxLength) + '...';
27 this.isEllipsisActive = true; 34 this.isEllipsisActive = true;
28 } else { 35 } else {