陈剑华

fix: 17150

Showing 17 changed files with 331 additions and 28 deletions
@@ -17,7 +17,6 @@ import { Card19Component } from './cardview/Card19Component'; @@ -17,7 +17,6 @@ import { Card19Component } from './cardview/Card19Component';
17 import { Card20Component } from './cardview/Card20Component'; 17 import { Card20Component } from './cardview/Card20Component';
18 import { Card21Component } from './cardview/Card21Component'; 18 import { Card21Component } from './cardview/Card21Component';
19 import { SearchContentComponent } from './cardview/SearchContentComponent'; 19 import { SearchContentComponent } from './cardview/SearchContentComponent';
20 -import { Logger } from 'wdKit/Index';  
21 20
22 /** 21 /**
23 * card适配器,卡片样式汇总,依据ContentDTO#appStyle 22 * card适配器,卡片样式汇总,依据ContentDTO#appStyle
@@ -28,10 +27,6 @@ export struct CardParser { @@ -28,10 +27,6 @@ export struct CardParser {
28 @State contentDTO: ContentDTO = new ContentDTO(); 27 @State contentDTO: ContentDTO = new ContentDTO();
29 @State compDTO: CompDTO = {} as CompDTO 28 @State compDTO: CompDTO = {} as CompDTO
30 29
31 - aboutToAppear(): void {  
32 - Logger.info('contentDTO.contentText', JSON.stringify(this.contentDTO))  
33 - }  
34 -  
35 build() { 30 build() {
36 this.contentBuilder(this.contentDTO, this.compDTO); 31 this.contentBuilder(this.contentDTO, this.compDTO);
37 } 32 }
@@ -16,16 +16,39 @@ const TAG: string = 'Card10Component'; @@ -16,16 +16,39 @@ const TAG: string = 'Card10Component';
16 export struct Card10Component { 16 export struct Card10Component {
17 @State contentDTO: ContentDTO = new ContentDTO(); 17 @State contentDTO: ContentDTO = new ContentDTO();
18 @State loadImg: boolean = false; 18 @State loadImg: boolean = false;
  19 + @State titleMarked: boolean = false;
  20 + @State str01: string = '';
  21 + @State str02: string = '';
  22 + @State str03: string = '';
19 23
20 async aboutToAppear(): Promise<void> { 24 async aboutToAppear(): Promise<void> {
  25 + this.titleInit();
21 this.loadImg = await onlyWifiLoadImg(); 26 this.loadImg = await onlyWifiLoadImg();
22 } 27 }
23 28
  29 + titleInit() {
  30 + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
  31 + this.titleMarked = true;
  32 + this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
  33 + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
  34 + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
  35 + }
  36 + }
  37 +
24 build() { 38 build() {
25 Column() { 39 Column() {
26 // 顶部标题,最多两行 40 // 顶部标题,最多两行
27 if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { 41 if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) {
28 - Text(this.contentDTO.newsTitle) 42 + Text() {
  43 + if (this.titleMarked) {
  44 + Span(this.str01)
  45 + Span(this.str02)
  46 + .fontColor(0xED2800)
  47 + Span(this.str03)
  48 + } else {
  49 + Span(this.contentDTO.newsTitle)
  50 + }
  51 + }
29 .width(CommonConstants.FULL_WIDTH) 52 .width(CommonConstants.FULL_WIDTH)
30 .fontSize($r('app.float.font_size_17')) 53 .fontSize($r('app.float.font_size_17'))
31 .fontWeight(600) 54 .fontWeight(600)
@@ -14,6 +14,23 @@ const TAG = 'Card11Component'; @@ -14,6 +14,23 @@ const TAG = 'Card11Component';
14 export struct Card11Component { 14 export struct Card11Component {
15 @State contentDTO: ContentDTO = new ContentDTO(); 15 @State contentDTO: ContentDTO = new ContentDTO();
16 @State clicked: boolean = false; 16 @State clicked: boolean = false;
  17 + @State titleMarked: boolean = false;
  18 + @State str01: string = '';
  19 + @State str02: string = '';
  20 + @State str03: string = '';
  21 +
  22 + async aboutToAppear(): Promise<void> {
  23 + this.titleInit();
  24 + }
  25 +
  26 + titleInit() {
  27 + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
  28 + this.titleMarked = true;
  29 + this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
  30 + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
  31 + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
  32 + }
  33 + }
17 34
18 build() { 35 build() {
19 Column() { 36 Column() {
@@ -21,7 +38,16 @@ export struct Card11Component { @@ -21,7 +38,16 @@ export struct Card11Component {
21 if (this.contentDTO.objectType == '5') { 38 if (this.contentDTO.objectType == '5') {
22 Notes({ objectType: this.contentDTO.objectType }) 39 Notes({ objectType: this.contentDTO.objectType })
23 } 40 }
24 - Text(this.contentDTO.newsTitle) 41 + Text() {
  42 + if (this.titleMarked) {
  43 + Span(this.str01)
  44 + Span(this.str02)
  45 + .fontColor(0xED2800)
  46 + Span(this.str03)
  47 + } else {
  48 + Span(this.contentDTO.newsTitle)
  49 + }
  50 + }
25 .fontSize($r("app.float.font_size_16")) 51 .fontSize($r("app.float.font_size_16"))
26 .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) 52 .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222"))
27 .maxLines(3) 53 .maxLines(3)
@@ -14,8 +14,22 @@ const TAG = 'Card12Component'; @@ -14,8 +14,22 @@ const TAG = 'Card12Component';
14 export struct Card12Component { 14 export struct Card12Component {
15 @State contentDTO: ContentDTO = new ContentDTO(); 15 @State contentDTO: ContentDTO = new ContentDTO();
16 @State clicked: boolean = false; 16 @State clicked: boolean = false;
  17 + @State titleMarked: boolean = false;
  18 + @State str01: string = '';
  19 + @State str02: string = '';
  20 + @State str03: string = '';
17 21
18 aboutToAppear(): void { 22 aboutToAppear(): void {
  23 + this.titleInit();
  24 + }
  25 +
  26 + titleInit() {
  27 + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
  28 + this.titleMarked = true;
  29 + this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
  30 + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
  31 + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
  32 + }
19 } 33 }
20 34
21 build() { 35 build() {
@@ -26,7 +40,16 @@ export struct Card12Component { @@ -26,7 +40,16 @@ export struct Card12Component {
26 } 40 }
27 // 标题 41 // 标题
28 if (this.contentDTO.newsTitle) { 42 if (this.contentDTO.newsTitle) {
29 - Text(this.contentDTO.newsTitle) 43 + Text() {
  44 + if (this.titleMarked) {
  45 + Span(this.str01)
  46 + Span(this.str02)
  47 + .fontColor(0xED2800)
  48 + Span(this.str03)
  49 + } else {
  50 + Span(this.contentDTO.newsTitle)
  51 + }
  52 + }
30 .fontSize($r('app.float.font_size_17')) 53 .fontSize($r('app.float.font_size_17'))
31 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) 54 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
32 .width(CommonConstants.FULL_WIDTH) 55 .width(CommonConstants.FULL_WIDTH)
@@ -37,7 +60,6 @@ export struct Card12Component { @@ -37,7 +60,6 @@ export struct Card12Component {
37 .fontFamily('PingFang SC-Regular') 60 .fontFamily('PingFang SC-Regular')
38 } 61 }
39 CarderInteraction({contentDTO: this.contentDTO}) 62 CarderInteraction({contentDTO: this.contentDTO})
40 - //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件  
41 } 63 }
42 .padding({ 64 .padding({
43 left: $r('app.float.card_comp_pagePadding_lf'), 65 left: $r('app.float.card_comp_pagePadding_lf'),
@@ -16,11 +16,25 @@ export struct Card14Component { @@ -16,11 +16,25 @@ export struct Card14Component {
16 @State contentDTO: ContentDTO = new ContentDTO(); 16 @State contentDTO: ContentDTO = new ContentDTO();
17 @State loadImg: boolean = false; 17 @State loadImg: boolean = false;
18 @State clicked: boolean = false; 18 @State clicked: boolean = false;
  19 + @State titleMarked: boolean = false;
  20 + @State str01: string = '';
  21 + @State str02: string = '';
  22 + @State str03: string = '';
19 23
20 async aboutToAppear(): Promise<void> { 24 async aboutToAppear(): Promise<void> {
  25 + this.titleInit();
21 this.loadImg = await onlyWifiLoadImg(); 26 this.loadImg = await onlyWifiLoadImg();
22 } 27 }
23 28
  29 + titleInit() {
  30 + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
  31 + this.titleMarked = true;
  32 + this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
  33 + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
  34 + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
  35 + }
  36 + }
  37 +
24 build() { 38 build() {
25 Column() { 39 Column() {
26 // rmh信息 40 // rmh信息
@@ -30,7 +44,16 @@ export struct Card14Component { @@ -30,7 +44,16 @@ export struct Card14Component {
30 // 左标题,右图 44 // 左标题,右图
31 Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) { 45 Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) {
32 46
33 - Text(this.contentDTO.newsTitle) 47 + Text() {
  48 + if (this.titleMarked) {
  49 + Span(this.str01)
  50 + Span(this.str02)
  51 + .fontColor(0xED2800)
  52 + Span(this.str03)
  53 + } else {
  54 + Span(this.contentDTO.newsTitle)
  55 + }
  56 + }
34 .fontSize($r('app.float.font_size_17')) 57 .fontSize($r('app.float.font_size_17'))
35 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) 58 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
36 .textOverflowStyle(3) 59 .textOverflowStyle(3)
@@ -20,11 +20,24 @@ export struct Card15Component { @@ -20,11 +20,24 @@ export struct Card15Component {
20 @State contentDTO: ContentDTO = new ContentDTO(); 20 @State contentDTO: ContentDTO = new ContentDTO();
21 @State loadImg: boolean = false; 21 @State loadImg: boolean = false;
22 @State clicked: boolean = false; 22 @State clicked: boolean = false;
  23 + @State titleMarked: boolean = false;
  24 + @State str01: string = '';
  25 + @State str02: string = '';
  26 + @State str03: string = '';
23 27
24 async aboutToAppear(): Promise<void> { 28 async aboutToAppear(): Promise<void> {
  29 + this.titleInit();
25 this.loadImg = await onlyWifiLoadImg(); 30 this.loadImg = await onlyWifiLoadImg();
26 } 31 }
27 32
  33 + titleInit() {
  34 + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
  35 + this.titleMarked = true;
  36 + this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
  37 + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
  38 + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
  39 + }
  40 + }
28 41
29 build() { 42 build() {
30 Column() { 43 Column() {
@@ -32,7 +45,16 @@ export struct Card15Component { @@ -32,7 +45,16 @@ export struct Card15Component {
32 RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime }) 45 RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime })
33 //新闻标题 46 //新闻标题
34 if (this.contentDTO.newsTitle) { 47 if (this.contentDTO.newsTitle) {
35 - Text(this.contentDTO.newsTitle) 48 + Text() {
  49 + if (this.titleMarked) {
  50 + Span(this.str01)
  51 + Span(this.str02)
  52 + .fontColor(0xED2800)
  53 + Span(this.str03)
  54 + } else {
  55 + Span(this.contentDTO.newsTitle)
  56 + }
  57 + }
36 .fontSize($r('app.float.font_size_17')) 58 .fontSize($r('app.float.font_size_17'))
37 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) 59 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
38 .width(CommonConstants.FULL_WIDTH) 60 .width(CommonConstants.FULL_WIDTH)
@@ -21,11 +21,25 @@ export struct Card16Component { @@ -21,11 +21,25 @@ export struct Card16Component {
21 @State contentDTO: ContentDTO = new ContentDTO(); 21 @State contentDTO: ContentDTO = new ContentDTO();
22 @State loadImg: boolean = false; 22 @State loadImg: boolean = false;
23 @State clicked: boolean = false; 23 @State clicked: boolean = false;
  24 + @State titleMarked: boolean = false;
  25 + @State str01: string = '';
  26 + @State str02: string = '';
  27 + @State str03: string = '';
24 28
25 async aboutToAppear(): Promise<void> { 29 async aboutToAppear(): Promise<void> {
  30 + this.titleInit();
26 this.loadImg = await onlyWifiLoadImg(); 31 this.loadImg = await onlyWifiLoadImg();
27 } 32 }
28 33
  34 + titleInit() {
  35 + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
  36 + this.titleMarked = true;
  37 + this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
  38 + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
  39 + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
  40 + }
  41 + }
  42 +
29 build() { 43 build() {
30 Column() { 44 Column() {
31 // rmh信息 45 // rmh信息
@@ -34,7 +48,16 @@ export struct Card16Component { @@ -34,7 +48,16 @@ export struct Card16Component {
34 } 48 }
35 // 标题 49 // 标题
36 if (this.contentDTO.newsTitle) { 50 if (this.contentDTO.newsTitle) {
37 - Text(this.contentDTO.newsTitle) 51 + Text() {
  52 + if (this.titleMarked) {
  53 + Span(this.str01)
  54 + Span(this.str02)
  55 + .fontColor(0xED2800)
  56 + Span(this.str03)
  57 + } else {
  58 + Span(this.contentDTO.newsTitle)
  59 + }
  60 + }
38 .fontSize($r('app.float.font_size_17')) 61 .fontSize($r('app.float.font_size_17'))
39 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) 62 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
40 .width(CommonConstants.FULL_WIDTH) 63 .width(CommonConstants.FULL_WIDTH)
@@ -17,14 +17,37 @@ export struct Card17Component { @@ -17,14 +17,37 @@ export struct Card17Component {
17 @State contentDTO: ContentDTO = new ContentDTO(); 17 @State contentDTO: ContentDTO = new ContentDTO();
18 @State loadImg: boolean = false; 18 @State loadImg: boolean = false;
19 @State clicked: boolean = false; 19 @State clicked: boolean = false;
  20 + @State titleMarked: boolean = false;
  21 + @State str01: string = '';
  22 + @State str02: string = '';
  23 + @State str03: string = '';
20 24
21 async aboutToAppear(): Promise<void> { 25 async aboutToAppear(): Promise<void> {
  26 + this.titleInit();
22 this.loadImg = await onlyWifiLoadImg(); 27 this.loadImg = await onlyWifiLoadImg();
23 } 28 }
24 29
  30 + titleInit() {
  31 + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
  32 + this.titleMarked = true;
  33 + this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
  34 + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
  35 + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
  36 + }
  37 + }
  38 +
25 build() { 39 build() {
26 Column({ space: 8 }) { 40 Column({ space: 8 }) {
27 - Text(this.contentDTO.newsTitle) 41 + Text() {
  42 + if (this.titleMarked) {
  43 + Span(this.str01)
  44 + Span(this.str02)
  45 + .fontColor(0xED2800)
  46 + Span(this.str03)
  47 + } else {
  48 + Span(this.contentDTO.newsTitle)
  49 + }
  50 + }
28 .textOverflow({ overflow: TextOverflow.Ellipsis }) 51 .textOverflow({ overflow: TextOverflow.Ellipsis })
29 .fontSize($r('app.float.font_size_17')) 52 .fontSize($r('app.float.font_size_17'))
30 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) 53 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
@@ -14,6 +14,23 @@ const TAG = 'Card19Component'; @@ -14,6 +14,23 @@ const TAG = 'Card19Component';
14 export struct Card19Component { 14 export struct Card19Component {
15 @State contentDTO: ContentDTO = new ContentDTO() 15 @State contentDTO: ContentDTO = new ContentDTO()
16 @State clicked: boolean = false; 16 @State clicked: boolean = false;
  17 + @State titleMarked: boolean = false;
  18 + @State str01: string = '';
  19 + @State str02: string = '';
  20 + @State str03: string = '';
  21 +
  22 + async aboutToAppear(): Promise<void> {
  23 + this.titleInit();
  24 + }
  25 +
  26 + titleInit() {
  27 + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
  28 + this.titleMarked = true;
  29 + this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
  30 + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
  31 + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
  32 + }
  33 + }
17 34
18 build() { 35 build() {
19 Column() { 36 Column() {
@@ -21,7 +38,16 @@ export struct Card19Component { @@ -21,7 +38,16 @@ export struct Card19Component {
21 RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime }) 38 RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime })
22 // 标题 39 // 标题
23 if (this.contentDTO.newsTitle) { 40 if (this.contentDTO.newsTitle) {
24 - Text(this.contentDTO.newsTitle) 41 + Text() {
  42 + if (this.titleMarked) {
  43 + Span(this.str01)
  44 + Span(this.str02)
  45 + .fontColor(0xED2800)
  46 + Span(this.str03)
  47 + } else {
  48 + Span(this.contentDTO.newsTitle)
  49 + }
  50 + }
25 .fontSize($r('app.float.font_size_17')) 51 .fontSize($r('app.float.font_size_17'))
26 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) 52 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
27 .textOverflowStyle(3) 53 .textOverflowStyle(3)
@@ -15,8 +15,22 @@ const TAG = 'Card20Component'; @@ -15,8 +15,22 @@ const TAG = 'Card20Component';
15 export struct Card20Component { 15 export struct Card20Component {
16 @State contentDTO: ContentDTO = new ContentDTO(); 16 @State contentDTO: ContentDTO = new ContentDTO();
17 @State clicked: boolean = false; 17 @State clicked: boolean = false;
  18 + @State titleMarked: boolean = false;
  19 + @State str01: string = '';
  20 + @State str02: string = '';
  21 + @State str03: string = '';
18 22
19 aboutToAppear(): void { 23 aboutToAppear(): void {
  24 + this.titleInit();
  25 + }
  26 +
  27 + titleInit() {
  28 + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
  29 + this.titleMarked = true;
  30 + this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
  31 + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
  32 + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
  33 + }
20 } 34 }
21 35
22 build() { 36 build() {
@@ -25,7 +39,17 @@ export struct Card20Component { @@ -25,7 +39,17 @@ export struct Card20Component {
25 RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime }) 39 RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime })
26 // 标题 40 // 标题
27 if (this.contentDTO.newsTitle) { 41 if (this.contentDTO.newsTitle) {
28 - Text(this.contentDTO.newsTitle) 42 + Text() {
  43 +
  44 + if (this.titleMarked) {
  45 + Span(this.str01)
  46 + Span(this.str02)
  47 + .fontColor(0xED2800)
  48 + Span(this.str03)
  49 + } else {
  50 + Span(this.contentDTO.newsTitle)
  51 + }
  52 + }
29 .fontSize($r('app.float.font_size_17')) 53 .fontSize($r('app.float.font_size_17'))
30 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) 54 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
31 .width(CommonConstants.FULL_WIDTH) 55 .width(CommonConstants.FULL_WIDTH)
@@ -16,11 +16,25 @@ export struct Card21Component { @@ -16,11 +16,25 @@ export struct Card21Component {
16 @State contentDTO: ContentDTO = new ContentDTO(); 16 @State contentDTO: ContentDTO = new ContentDTO();
17 @State loadImg: boolean = false; 17 @State loadImg: boolean = false;
18 @State clicked: boolean = false; 18 @State clicked: boolean = false;
  19 + @State titleMarked: boolean = false;
  20 + @State str01: string = '';
  21 + @State str02: string = '';
  22 + @State str03: string = '';
19 23
20 async aboutToAppear(): Promise<void> { 24 async aboutToAppear(): Promise<void> {
  25 + this.titleInit();
21 this.loadImg = await onlyWifiLoadImg(); 26 this.loadImg = await onlyWifiLoadImg();
22 } 27 }
23 28
  29 + titleInit() {
  30 + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
  31 + this.titleMarked = true;
  32 + this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
  33 + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
  34 + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
  35 + }
  36 + }
  37 +
24 build() { 38 build() {
25 Column() { 39 Column() {
26 // 顶部 rmh信息 40 // 顶部 rmh信息
@@ -28,7 +42,16 @@ export struct Card21Component { @@ -28,7 +42,16 @@ export struct Card21Component {
28 // 中间内容 42 // 中间内容
29 Grid() { 43 Grid() {
30 GridItem() { 44 GridItem() {
31 - Text(`${this.contentDTO.newsTitle}`) 45 + Text() {
  46 + if (this.titleMarked) {
  47 + Span(this.str01)
  48 + Span(this.str02)
  49 + .fontColor(0xED2800)
  50 + Span(this.str03)
  51 + } else {
  52 + Span(this.contentDTO.newsTitle)
  53 + }
  54 + }
32 .fontSize($r('app.float.selected_text_size')) 55 .fontSize($r('app.float.selected_text_size'))
33 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) 56 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
34 .width(CommonConstants.FULL_WIDTH) 57 .width(CommonConstants.FULL_WIDTH)
@@ -34,11 +34,11 @@ export struct Card2Component { @@ -34,11 +34,11 @@ export struct Card2Component {
34 } 34 }
35 35
36 titleInit() { 36 titleInit() {
37 - if (this.contentDTO.title.includes('<em>') && this.contentDTO.title.includes('</em>')) { 37 + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
38 this.titleMarked = true; 38 this.titleMarked = true;
39 - this.str01 = this.contentDTO.newsTitle?.split('<em>')[0] || '';  
40 - this.str02 = this.contentDTO.newsTitle?.split('<em>')[1].split('</em>')[0] || '';  
41 - this.str03 = this.contentDTO.newsTitle?.split('<em>')[1].split('</em>')[1] || ''; 39 + this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
  40 + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
  41 + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
42 } 42 }
43 } 43 }
44 44
@@ -12,6 +12,24 @@ import { Notes } from './notes'; @@ -12,6 +12,24 @@ import { Notes } from './notes';
12 export struct Card3Component { 12 export struct Card3Component {
13 @State contentDTO: ContentDTO = new ContentDTO(); 13 @State contentDTO: ContentDTO = new ContentDTO();
14 @State clicked: boolean = false; 14 @State clicked: boolean = false;
  15 + @State titleMarked: boolean = false;
  16 + @State str01: string = '';
  17 + @State str02: string = '';
  18 + @State str03: string = '';
  19 +
  20 + async aboutToAppear(): Promise<void> {
  21 + this.titleInit();
  22 + // this.clicked = hasClicked(this.contentDTO.objectId)
  23 + }
  24 +
  25 + titleInit() {
  26 + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
  27 + this.titleMarked = true;
  28 + this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
  29 + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
  30 + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
  31 + }
  32 + }
15 33
16 build() { 34 build() {
17 Column() { 35 Column() {
@@ -19,7 +37,16 @@ export struct Card3Component { @@ -19,7 +37,16 @@ export struct Card3Component {
19 if (this.contentDTO.objectType == '5') { 37 if (this.contentDTO.objectType == '5') {
20 Notes({ objectType: this.contentDTO.objectType }) 38 Notes({ objectType: this.contentDTO.objectType })
21 } 39 }
22 - Text(this.contentDTO.newsTitle) 40 + Text() {
  41 + if (this.titleMarked) {
  42 + Span(this.str01)
  43 + Span(this.str02)
  44 + .fontColor(0xED2800)
  45 + Span(this.str03)
  46 + } else {
  47 + Span(this.contentDTO.newsTitle)
  48 + }
  49 + }
23 .fontSize($r("app.float.font_size_16")) 50 .fontSize($r("app.float.font_size_16"))
24 .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) 51 .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222"))
25 .width(CommonConstants.FULL_WIDTH) 52 .width(CommonConstants.FULL_WIDTH)
@@ -30,11 +30,11 @@ export struct Card4Component { @@ -30,11 +30,11 @@ export struct Card4Component {
30 } 30 }
31 31
32 titleInit() { 32 titleInit() {
33 - if (this.contentDTO.title.includes('<em>') && this.contentDTO.title.includes('</em>')) { 33 + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
34 this.titleMarked = true; 34 this.titleMarked = true;
35 - this.str01 = this.contentDTO.newsTitle?.split('<em>')[0] || '';  
36 - this.str02 = this.contentDTO.newsTitle?.split('<em>')[1].split('</em>')[0] || '';  
37 - this.str03 = this.contentDTO.newsTitle?.split('<em>')[1].split('</em>')[1] || ''; 35 + this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
  36 + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
  37 + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
38 } 38 }
39 } 39 }
40 40
@@ -15,9 +15,24 @@ export struct Card5Component { @@ -15,9 +15,24 @@ export struct Card5Component {
15 @Prop titleShowPolicy: number | string 15 @Prop titleShowPolicy: number | string
16 @State loadImg: boolean = false; 16 @State loadImg: boolean = false;
17 @State clicked: boolean = false; 17 @State clicked: boolean = false;
  18 + @State titleMarked: boolean = false;
  19 + @State str01: string = '';
  20 + @State str02: string = '';
  21 + @State str03: string = '';
18 22
19 async aboutToAppear(): Promise<void> { 23 async aboutToAppear(): Promise<void> {
20 this.loadImg = await onlyWifiLoadImg(); 24 this.loadImg = await onlyWifiLoadImg();
  25 +
  26 + this.titleInit();
  27 + }
  28 +
  29 + titleInit() {
  30 + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
  31 + this.titleMarked = true;
  32 + this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
  33 + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
  34 + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
  35 + }
21 } 36 }
22 37
23 build() { 38 build() {
@@ -42,7 +57,16 @@ export struct Card5Component { @@ -42,7 +57,16 @@ export struct Card5Component {
42 Notes({ objectType: this.contentDTO.objectType }) 57 Notes({ objectType: this.contentDTO.objectType })
43 } 58 }
44 59
45 - Text(this.contentDTO.newsTitle) 60 + Text() {
  61 + if (this.titleMarked) {
  62 + Span(this.str01)
  63 + Span(this.str02)
  64 + .fontColor(0xED2800)
  65 + Span(this.str03)
  66 + } else {
  67 + Span(this.contentDTO.newsTitle)
  68 + }
  69 + }
46 .width(CommonConstants.FULL_WIDTH) 70 .width(CommonConstants.FULL_WIDTH)
47 .fontColor(Color.White) 71 .fontColor(Color.White)
48 .fontSize($r('app.float.normal_text_size')) 72 .fontSize($r('app.float.normal_text_size'))
@@ -24,7 +24,6 @@ export struct Card6Component { @@ -24,7 +24,6 @@ export struct Card6Component {
24 @State str03: string = ''; 24 @State str03: string = '';
25 25
26 async aboutToAppear(): Promise<void> { 26 async aboutToAppear(): Promise<void> {
27 - Logger.info('titleInit', JSON.stringify(this.contentDTO))  
28 this.titleInit(); 27 this.titleInit();
29 this.loadImg = await onlyWifiLoadImg(); 28 this.loadImg = await onlyWifiLoadImg();
30 // this.clicked = hasClicked(this.contentDTO.objectId) 29 // this.clicked = hasClicked(this.contentDTO.objectId)
@@ -15,16 +15,39 @@ export struct Card9Component { @@ -15,16 +15,39 @@ export struct Card9Component {
15 @State contentDTO: ContentDTO = new ContentDTO(); 15 @State contentDTO: ContentDTO = new ContentDTO();
16 @State loadImg: boolean = false; 16 @State loadImg: boolean = false;
17 @State clicked: boolean = false; 17 @State clicked: boolean = false;
  18 + @State titleMarked: boolean = false;
  19 + @State str01: string = '';
  20 + @State str02: string = '';
  21 + @State str03: string = '';
18 22
19 async aboutToAppear(): Promise<void> { 23 async aboutToAppear(): Promise<void> {
  24 + this.titleInit();
20 this.loadImg = await onlyWifiLoadImg(); 25 this.loadImg = await onlyWifiLoadImg();
21 } 26 }
22 27
  28 + titleInit() {
  29 + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
  30 + this.titleMarked = true;
  31 + this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
  32 + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
  33 + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
  34 + }
  35 + }
  36 +
23 build() { 37 build() {
24 Column() { 38 Column() {
25 // 顶部标题,最多两行 39 // 顶部标题,最多两行
26 if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { 40 if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) {
27 - Text(this.contentDTO.newsTitle) 41 + Text() {
  42 + if (this.titleMarked) {
  43 + Span(this.str01)
  44 + Span(this.str02)
  45 + .fontColor(0xED2800)
  46 + Span(this.str03)
  47 + } else {
  48 + Span(this.contentDTO.newsTitle)
  49 + }
  50 + }
28 .fontColor(this.clicked ? 0x848484 : 0x222222) 51 .fontColor(this.clicked ? 0x848484 : 0x222222)
29 .width(CommonConstants.FULL_WIDTH) 52 .width(CommonConstants.FULL_WIDTH)
30 .fontSize($r('app.float.font_size_17')) 53 .fontSize($r('app.float.font_size_17'))