yumaochao
Showing 35 changed files with 437 additions and 315 deletions
@@ -32,6 +32,12 @@ export struct CardParser { @@ -32,6 +32,12 @@ export struct CardParser {
32 pageShowTime:number = 0; 32 pageShowTime:number = 0;
33 pageHideTime:number = 0; 33 pageHideTime:number = 0;
34 34
  35 + aboutToAppear(): void {
  36 +
  37 + console.log('CardParser-contentDTO', JSON.stringify(this.contentDTO))
  38 + console.log('CardParser-compDTO', JSON.stringify(this.compDTO))
  39 + }
  40 +
35 onPageShow() { 41 onPageShow() {
36 this.pageShowTime = DateTimeUtils.getTimeStamp() 42 this.pageShowTime = DateTimeUtils.getTimeStamp()
37 } 43 }
@@ -6,6 +6,7 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; @@ -6,6 +6,7 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
6 import { Notes } from './notes'; 6 import { Notes } from './notes';
7 import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; 7 import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
8 import { InfomationCardClick } from '../../utils/infomationCardClick' 8 import { InfomationCardClick } from '../../utils/infomationCardClick'
  9 +import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
9 10
10 /** 11 /**
11 * 大专题卡--CompStyle: 10 12 * 大专题卡--CompStyle: 10
@@ -21,9 +22,7 @@ export struct Card10Component { @@ -21,9 +22,7 @@ export struct Card10Component {
21 @State loadImg: boolean = false; 22 @State loadImg: boolean = false;
22 @ObjectLink compDTO: CompDTO 23 @ObjectLink compDTO: CompDTO
23 @State titleMarked: boolean = false; 24 @State titleMarked: boolean = false;
24 - @State str01: string = '';  
25 - @State str02: string = '';  
26 - @State str03: string = ''; 25 + @State textArr: textItem[] = []
27 26
28 async aboutToAppear(): Promise<void> { 27 async aboutToAppear(): Promise<void> {
29 this.titleInit(); 28 this.titleInit();
@@ -31,12 +30,9 @@ export struct Card10Component { @@ -31,12 +30,9 @@ export struct Card10Component {
31 } 30 }
32 31
33 titleInit() { 32 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 - } 33 + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
  34 + this.titleMarked = titleInitRes.titleMarked;
  35 + this.textArr = titleInitRes.textArr;
40 } 36 }
41 37
42 build() { 38 build() {
@@ -45,10 +41,14 @@ export struct Card10Component { @@ -45,10 +41,14 @@ export struct Card10Component {
45 if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { 41 if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) {
46 Text() { 42 Text() {
47 if (this.titleMarked) { 43 if (this.titleMarked) {
48 - Span(this.str01)  
49 - Span(this.str02) 44 + ForEach(this.textArr, (textItem: textItem) => {
  45 + if (textItem.isRed) {
  46 + Span(textItem.content)
50 .fontColor(0xED2800) 47 .fontColor(0xED2800)
51 - Span(this.str03) 48 + } else {
  49 + Span(textItem.content)
  50 + }
  51 + })
52 } else { 52 } else {
53 Span(this.contentDTO.newsTitle) 53 Span(this.contentDTO.newsTitle)
54 } 54 }
@@ -77,8 +77,15 @@ export struct Card10Component { @@ -77,8 +77,15 @@ export struct Card10Component {
77 InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName) 77 InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
78 ProcessUtils.processPage(this.contentDTO) 78 ProcessUtils.processPage(this.contentDTO)
79 }) 79 })
80 - if (this.contentDTO.objectType == '5') {  
81 - Notes({ objectType: 5 }).margin({ left: 5, bottom: 5 }) 80 + if(this.contentDTO.objectType == '5'){
  81 + Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center).margin({ left: 5, bottom: 5 })
  82 + } else {
  83 + if (this.contentDTO.seoTags) {
  84 + Notes({ newTags: this.contentDTO.seoTags }).height(30).align(Alignment.Center)
  85 + }
  86 + if (this.contentDTO.newTags) {
  87 + Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)
  88 + }
82 } 89 }
83 }.alignContent(Alignment.BottomStart) 90 }.alignContent(Alignment.BottomStart)
84 91
@@ -128,8 +135,15 @@ export struct Card10Component { @@ -128,8 +135,15 @@ export struct Card10Component {
128 Row() { 135 Row() {
129 Column() { 136 Column() {
130 Stack() { 137 Stack() {
131 - if (item.objectType == '5') {  
132 - Notes({ objectType: 5 }) 138 + if(this.contentDTO.objectType == '5'){
  139 + Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center)
  140 + } else {
  141 + if (this.contentDTO.seoTags) {
  142 + Notes({ newTags: this.contentDTO.seoTags }).height(30).align(Alignment.Center)
  143 + }
  144 + if (this.contentDTO.newTags) {
  145 + Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)
  146 + }
133 } 147 }
134 Text(item.newsTitle) 148 Text(item.newsTitle)
135 .fontSize($r('app.float.font_size_17')) 149 .fontSize($r('app.float.font_size_17'))
@@ -137,7 +151,10 @@ export struct Card10Component { @@ -137,7 +151,10 @@ export struct Card10Component {
137 .fontColor($r('app.color.color_222222')) 151 .fontColor($r('app.color.color_222222'))
138 .maxLines(2) 152 .maxLines(2)
139 .textOverflow({ overflow: TextOverflow.Ellipsis }) 153 .textOverflow({ overflow: TextOverflow.Ellipsis })
140 - .textIndent(item.objectType == '5' ? 38 : 0) 154 + .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
  155 + (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 :
  156 + ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
  157 + 0 )
141 }.alignContent(Alignment.TopStart) 158 }.alignContent(Alignment.TopStart)
142 159
143 //bottom 评论等信息 160 //bottom 评论等信息
@@ -7,6 +7,7 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; @@ -7,6 +7,7 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
7 import { Notes } from './notes'; 7 import { Notes } from './notes';
8 import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; 8 import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
9 import { InfomationCardClick } from '../../utils/infomationCardClick' 9 import { InfomationCardClick } from '../../utils/infomationCardClick'
  10 +import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
10 11
11 const TAG = 'Card11Component'; 12 const TAG = 'Card11Component';
12 13
@@ -21,9 +22,7 @@ export struct Card11Component { @@ -21,9 +22,7 @@ export struct Card11Component {
21 @State clicked: boolean = false; 22 @State clicked: boolean = false;
22 @ObjectLink compDTO: CompDTO 23 @ObjectLink compDTO: CompDTO
23 @State titleMarked: boolean = false; 24 @State titleMarked: boolean = false;
24 - @State str01: string = '';  
25 - @State str02: string = '';  
26 - @State str03: string = ''; 25 + @State textArr: textItem[] = []
27 26
28 async aboutToAppear(): Promise<void> { 27 async aboutToAppear(): Promise<void> {
29 this.titleInit(); 28 this.titleInit();
@@ -31,28 +30,34 @@ export struct Card11Component { @@ -31,28 +30,34 @@ export struct Card11Component {
31 } 30 }
32 31
33 titleInit() { 32 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 - } 33 + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
  34 + this.titleMarked = titleInitRes.titleMarked;
  35 + this.textArr = titleInitRes.textArr;
40 } 36 }
41 37
42 build() { 38 build() {
43 Column() { 39 Column() {
44 Stack() { 40 Stack() {
  41 + if(this.contentDTO.objectType == '5'){
  42 + Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center)
  43 + } else {
  44 + if (this.contentDTO.seoTags) {
  45 + Notes({ newTags: this.contentDTO.seoTags }).height(30).align(Alignment.Center)
  46 + }
45 if (this.contentDTO.newTags) { 47 if (this.contentDTO.newTags) {
46 Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center) 48 Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)
47 - } else if (this.contentDTO.objectType == '5') {  
48 - Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center) 49 + }
49 } 50 }
50 Text() { 51 Text() {
51 if (this.titleMarked) { 52 if (this.titleMarked) {
52 - Span(this.str01)  
53 - Span(this.str02) 53 + ForEach(this.textArr, (textItem: textItem) => {
  54 + if (textItem.isRed) {
  55 + Span(textItem.content)
54 .fontColor(0xED2800) 56 .fontColor(0xED2800)
55 - Span(this.str03) 57 + } else {
  58 + Span(textItem.content)
  59 + }
  60 + })
56 } else { 61 } else {
57 Span(this.contentDTO.newsTitle) 62 Span(this.contentDTO.newsTitle)
58 } 63 }
@@ -63,9 +68,10 @@ export struct Card11Component { @@ -63,9 +68,10 @@ export struct Card11Component {
63 .maxLines(3) 68 .maxLines(3)
64 .textOverflow({ overflow: TextOverflow.Ellipsis }) 69 .textOverflow({ overflow: TextOverflow.Ellipsis })
65 .width(CommonConstants.FULL_WIDTH) 70 .width(CommonConstants.FULL_WIDTH)
66 - .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :  
67 - (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||  
68 - this.contentDTO.objectType == '5' ? 35 : 0) 71 + .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
  72 + (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 :
  73 + ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
  74 + 0 )
69 75
70 }.alignContent(Alignment.TopStart) 76 }.alignContent(Alignment.TopStart)
71 77
@@ -6,6 +6,7 @@ import { ProcessUtils } from 'wdRouter'; @@ -6,6 +6,7 @@ import { ProcessUtils } from 'wdRouter';
6 import {CarderInteraction} from '../CarderInteraction' 6 import {CarderInteraction} from '../CarderInteraction'
7 import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; 7 import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
8 import { InfomationCardClick } from '../../utils/infomationCardClick' 8 import { InfomationCardClick } from '../../utils/infomationCardClick'
  9 +import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
9 10
10 const TAG = 'Card12Component'; 11 const TAG = 'Card12Component';
11 12
@@ -20,9 +21,7 @@ export struct Card12Component { @@ -20,9 +21,7 @@ export struct Card12Component {
20 @State contentDTO: ContentDTO = new ContentDTO(); 21 @State contentDTO: ContentDTO = new ContentDTO();
21 @State clicked: boolean = false; 22 @State clicked: boolean = false;
22 @State titleMarked: boolean = false; 23 @State titleMarked: boolean = false;
23 - @State str01: string = '';  
24 - @State str02: string = '';  
25 - @State str03: string = ''; 24 + @State textArr: textItem[] = []
26 25
27 aboutToAppear(): void { 26 aboutToAppear(): void {
28 this.titleInit(); 27 this.titleInit();
@@ -30,12 +29,9 @@ export struct Card12Component { @@ -30,12 +29,9 @@ export struct Card12Component {
30 } 29 }
31 30
32 titleInit() { 31 titleInit() {
33 - if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {  
34 - this.titleMarked = true;  
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 - } 32 + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
  33 + this.titleMarked = titleInitRes.titleMarked;
  34 + this.textArr = titleInitRes.textArr;
39 } 35 }
40 36
41 build() { 37 build() {
@@ -48,10 +44,14 @@ export struct Card12Component { @@ -48,10 +44,14 @@ export struct Card12Component {
48 if (this.contentDTO.newsTitle) { 44 if (this.contentDTO.newsTitle) {
49 Text() { 45 Text() {
50 if (this.titleMarked) { 46 if (this.titleMarked) {
51 - Span(this.str01)  
52 - Span(this.str02) 47 + ForEach(this.textArr, (textItem: textItem) => {
  48 + if (textItem.isRed) {
  49 + Span(textItem.content)
53 .fontColor(0xED2800) 50 .fontColor(0xED2800)
54 - Span(this.str03) 51 + } else {
  52 + Span(textItem.content)
  53 + }
  54 + })
55 } else { 55 } else {
56 Span(this.contentDTO.newsTitle) 56 Span(this.contentDTO.newsTitle)
57 } 57 }
@@ -7,6 +7,7 @@ import {CarderInteraction} from '../CarderInteraction' @@ -7,6 +7,7 @@ import {CarderInteraction} from '../CarderInteraction'
7 import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; 7 import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
8 import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; 8 import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
9 import { InfomationCardClick } from '../../utils/infomationCardClick' 9 import { InfomationCardClick } from '../../utils/infomationCardClick'
  10 +import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
10 11
11 const TAG = 'Card14Component'; 12 const TAG = 'Card14Component';
12 13
@@ -22,9 +23,7 @@ export struct Card14Component { @@ -22,9 +23,7 @@ export struct Card14Component {
22 @State loadImg: boolean = false; 23 @State loadImg: boolean = false;
23 @State clicked: boolean = false; 24 @State clicked: boolean = false;
24 @State titleMarked: boolean = false; 25 @State titleMarked: boolean = false;
25 - @State str01: string = '';  
26 - @State str02: string = '';  
27 - @State str03: string = ''; 26 + @State textArr: textItem[] = []
28 27
29 async aboutToAppear(): Promise<void> { 28 async aboutToAppear(): Promise<void> {
30 this.titleInit(); 29 this.titleInit();
@@ -33,12 +32,9 @@ export struct Card14Component { @@ -33,12 +32,9 @@ export struct Card14Component {
33 } 32 }
34 33
35 titleInit() { 34 titleInit() {
36 - if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {  
37 - this.titleMarked = true;  
38 - this.str01 = this.contentDTO.title?.split('<em>')[0] || '';  
39 - this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';  
40 - this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';  
41 - } 35 + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
  36 + this.titleMarked = titleInitRes.titleMarked;
  37 + this.textArr = titleInitRes.textArr;
42 } 38 }
43 39
44 build() { 40 build() {
@@ -52,10 +48,14 @@ export struct Card14Component { @@ -52,10 +48,14 @@ export struct Card14Component {
52 48
53 Text() { 49 Text() {
54 if (this.titleMarked) { 50 if (this.titleMarked) {
55 - Span(this.str01)  
56 - Span(this.str02) 51 + ForEach(this.textArr, (textItem: textItem) => {
  52 + if (textItem.isRed) {
  53 + Span(textItem.content)
57 .fontColor(0xED2800) 54 .fontColor(0xED2800)
58 - Span(this.str03) 55 + } else {
  56 + Span(textItem.content)
  57 + }
  58 + })
59 } else { 59 } else {
60 Span(this.contentDTO.newsTitle) 60 Span(this.contentDTO.newsTitle)
61 } 61 }
@@ -7,6 +7,7 @@ import {CarderInteraction} from '../CarderInteraction' @@ -7,6 +7,7 @@ import {CarderInteraction} from '../CarderInteraction'
7 import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; 7 import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
8 import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; 8 import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
9 import { InfomationCardClick } from '../../utils/infomationCardClick' 9 import { InfomationCardClick } from '../../utils/infomationCardClick'
  10 +import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
10 11
11 const TAG: string = 'Card15Component'; 12 const TAG: string = 'Card15Component';
12 13
@@ -26,9 +27,7 @@ export struct Card15Component { @@ -26,9 +27,7 @@ export struct Card15Component {
26 @State loadImg: boolean = false; 27 @State loadImg: boolean = false;
27 @State clicked: boolean = false; 28 @State clicked: boolean = false;
28 @State titleMarked: boolean = false; 29 @State titleMarked: boolean = false;
29 - @State str01: string = '';  
30 - @State str02: string = '';  
31 - @State str03: string = ''; 30 + @State textArr: textItem[] = []
32 31
33 async aboutToAppear(): Promise<void> { 32 async aboutToAppear(): Promise<void> {
34 this.titleInit(); 33 this.titleInit();
@@ -37,12 +36,9 @@ export struct Card15Component { @@ -37,12 +36,9 @@ export struct Card15Component {
37 } 36 }
38 37
39 titleInit() { 38 titleInit() {
40 - if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {  
41 - this.titleMarked = true;  
42 - this.str01 = this.contentDTO.title?.split('<em>')[0] || '';  
43 - this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';  
44 - this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';  
45 - } 39 + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
  40 + this.titleMarked = titleInitRes.titleMarked;
  41 + this.textArr = titleInitRes.textArr;
46 } 42 }
47 43
48 build() { 44 build() {
@@ -53,10 +49,14 @@ export struct Card15Component { @@ -53,10 +49,14 @@ export struct Card15Component {
53 if (this.contentDTO.newsTitle) { 49 if (this.contentDTO.newsTitle) {
54 Text() { 50 Text() {
55 if (this.titleMarked) { 51 if (this.titleMarked) {
56 - Span(this.str01)  
57 - Span(this.str02) 52 + ForEach(this.textArr, (textItem: textItem) => {
  53 + if (textItem.isRed) {
  54 + Span(textItem.content)
58 .fontColor(0xED2800) 55 .fontColor(0xED2800)
59 - Span(this.str03) 56 + } else {
  57 + Span(textItem.content)
  58 + }
  59 + })
60 } else { 60 } else {
61 Span(this.contentDTO.newsTitle) 61 Span(this.contentDTO.newsTitle)
62 } 62 }
@@ -7,6 +7,7 @@ import {CarderInteraction} from '../CarderInteraction' @@ -7,6 +7,7 @@ import {CarderInteraction} from '../CarderInteraction'
7 import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; 7 import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
8 import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; 8 import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
9 import { InfomationCardClick } from '../../utils/infomationCardClick' 9 import { InfomationCardClick } from '../../utils/infomationCardClick'
  10 +import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
10 11
11 const TAG = 'Card16Component'; 12 const TAG = 'Card16Component';
12 13
@@ -27,9 +28,7 @@ export struct Card16Component { @@ -27,9 +28,7 @@ export struct Card16Component {
27 @State loadImg: boolean = false; 28 @State loadImg: boolean = false;
28 @State clicked: boolean = false; 29 @State clicked: boolean = false;
29 @State titleMarked: boolean = false; 30 @State titleMarked: boolean = false;
30 - @State str01: string = '';  
31 - @State str02: string = '';  
32 - @State str03: string = ''; 31 + @State textArr: textItem[] = []
33 32
34 async aboutToAppear(): Promise<void> { 33 async aboutToAppear(): Promise<void> {
35 this.titleInit(); 34 this.titleInit();
@@ -38,12 +37,9 @@ export struct Card16Component { @@ -38,12 +37,9 @@ export struct Card16Component {
38 } 37 }
39 38
40 titleInit() { 39 titleInit() {
41 - if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {  
42 - this.titleMarked = true;  
43 - this.str01 = this.contentDTO.title?.split('<em>')[0] || '';  
44 - this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';  
45 - this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';  
46 - } 40 + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
  41 + this.titleMarked = titleInitRes.titleMarked;
  42 + this.textArr = titleInitRes.textArr;
47 } 43 }
48 44
49 build() { 45 build() {
@@ -56,10 +52,14 @@ export struct Card16Component { @@ -56,10 +52,14 @@ export struct Card16Component {
56 if (this.contentDTO.newsTitle) { 52 if (this.contentDTO.newsTitle) {
57 Text() { 53 Text() {
58 if (this.titleMarked) { 54 if (this.titleMarked) {
59 - Span(this.str01)  
60 - Span(this.str02) 55 + ForEach(this.textArr, (textItem: textItem) => {
  56 + if (textItem.isRed) {
  57 + Span(textItem.content)
61 .fontColor(0xED2800) 58 .fontColor(0xED2800)
62 - Span(this.str03) 59 + } else {
  60 + Span(textItem.content)
  61 + }
  62 + })
63 } else { 63 } else {
64 Span(this.contentDTO.newsTitle) 64 Span(this.contentDTO.newsTitle)
65 } 65 }
@@ -7,6 +7,7 @@ import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; @@ -7,6 +7,7 @@ import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
7 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; 7 import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
8 import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; 8 import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
9 import { InfomationCardClick } from '../../utils/infomationCardClick' 9 import { InfomationCardClick } from '../../utils/infomationCardClick'
  10 +import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
10 11
11 const TAG = 'Card17Component'; 12 const TAG = 'Card17Component';
12 13
@@ -22,9 +23,7 @@ export struct Card17Component { @@ -22,9 +23,7 @@ export struct Card17Component {
22 @State clicked: boolean = false; 23 @State clicked: boolean = false;
23 @ObjectLink compDTO: CompDTO 24 @ObjectLink compDTO: CompDTO
24 @State titleMarked: boolean = false; 25 @State titleMarked: boolean = false;
25 - @State str01: string = '';  
26 - @State str02: string = '';  
27 - @State str03: string = ''; 26 + @State textArr: textItem[] = []
28 27
29 async aboutToAppear(): Promise<void> { 28 async aboutToAppear(): Promise<void> {
30 console.log('Card17Component', JSON.stringify(this.contentDTO)) 29 console.log('Card17Component', JSON.stringify(this.contentDTO))
@@ -34,22 +33,23 @@ export struct Card17Component { @@ -34,22 +33,23 @@ export struct Card17Component {
34 } 33 }
35 34
36 titleInit() { 35 titleInit() {
37 - if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {  
38 - this.titleMarked = true;  
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 - } 36 + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
  37 + this.titleMarked = titleInitRes.titleMarked;
  38 + this.textArr = titleInitRes.textArr;
43 } 39 }
44 40
45 build() { 41 build() {
46 Column({ space: 8 }) { 42 Column({ space: 8 }) {
47 Text() { 43 Text() {
48 if (this.titleMarked) { 44 if (this.titleMarked) {
49 - Span(this.str01)  
50 - Span(this.str02) 45 + ForEach(this.textArr, (textItem: textItem) => {
  46 + if (textItem.isRed) {
  47 + Span(textItem.content)
51 .fontColor(0xED2800) 48 .fontColor(0xED2800)
52 - Span(this.str03) 49 + } else {
  50 + Span(textItem.content)
  51 + }
  52 + })
53 } else { 53 } else {
54 Span(this.contentDTO.newsTitle) 54 Span(this.contentDTO.newsTitle)
55 } 55 }
@@ -6,6 +6,7 @@ import { CarderInteraction } from '../CarderInteraction' @@ -6,6 +6,7 @@ import { CarderInteraction } from '../CarderInteraction'
6 import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; 6 import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
7 import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; 7 import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
8 import { InfomationCardClick } from '../../utils/infomationCardClick' 8 import { InfomationCardClick } from '../../utils/infomationCardClick'
  9 +import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
9 10
10 const TAG = 'Card19Component'; 11 const TAG = 'Card19Component';
11 12
@@ -20,9 +21,7 @@ export struct Card19Component { @@ -20,9 +21,7 @@ export struct Card19Component {
20 @State contentDTO: ContentDTO = new ContentDTO() 21 @State contentDTO: ContentDTO = new ContentDTO()
21 @State clicked: boolean = false; 22 @State clicked: boolean = false;
22 @State titleMarked: boolean = false; 23 @State titleMarked: boolean = false;
23 - @State str01: string = '';  
24 - @State str02: string = '';  
25 - @State str03: string = ''; 24 + @State textArr: textItem[] = []
26 25
27 async aboutToAppear(): Promise<void> { 26 async aboutToAppear(): Promise<void> {
28 this.titleInit(); 27 this.titleInit();
@@ -31,12 +30,9 @@ export struct Card19Component { @@ -31,12 +30,9 @@ export struct Card19Component {
31 } 30 }
32 31
33 titleInit() { 32 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 - } 33 + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
  34 + this.titleMarked = titleInitRes.titleMarked;
  35 + this.textArr = titleInitRes.textArr;
40 } 36 }
41 37
42 build() { 38 build() {
@@ -47,10 +43,14 @@ export struct Card19Component { @@ -47,10 +43,14 @@ export struct Card19Component {
47 if (this.contentDTO.newsTitle) { 43 if (this.contentDTO.newsTitle) {
48 Text() { 44 Text() {
49 if (this.titleMarked) { 45 if (this.titleMarked) {
50 - Span(this.str01)  
51 - Span(this.str02) 46 + ForEach(this.textArr, (textItem: textItem) => {
  47 + if (textItem.isRed) {
  48 + Span(textItem.content)
52 .fontColor(0xED2800) 49 .fontColor(0xED2800)
53 - Span(this.str03) 50 + } else {
  51 + Span(textItem.content)
  52 + }
  53 + })
54 } else { 54 } else {
55 Span(this.contentDTO.newsTitle=='null'?"":this.contentDTO.newsTitle) 55 Span(this.contentDTO.newsTitle=='null'?"":this.contentDTO.newsTitle)
56 } 56 }
@@ -7,6 +7,7 @@ import {CarderInteraction} from '../CarderInteraction' @@ -7,6 +7,7 @@ import {CarderInteraction} from '../CarderInteraction'
7 import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; 7 import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
8 import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; 8 import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
9 import { InfomationCardClick } from '../../utils/infomationCardClick' 9 import { InfomationCardClick } from '../../utils/infomationCardClick'
  10 +import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
10 11
11 const TAG = 'Card20Component'; 12 const TAG = 'Card20Component';
12 13
@@ -21,9 +22,7 @@ export struct Card20Component { @@ -21,9 +22,7 @@ export struct Card20Component {
21 @State contentDTO: ContentDTO = new ContentDTO(); 22 @State contentDTO: ContentDTO = new ContentDTO();
22 @State clicked: boolean = false; 23 @State clicked: boolean = false;
23 @State titleMarked: boolean = false; 24 @State titleMarked: boolean = false;
24 - @State str01: string = '';  
25 - @State str02: string = '';  
26 - @State str03: string = ''; 25 + @State textArr: textItem[] = []
27 26
28 aboutToAppear(): void { 27 aboutToAppear(): void {
29 this.titleInit(); 28 this.titleInit();
@@ -31,12 +30,9 @@ export struct Card20Component { @@ -31,12 +30,9 @@ export struct Card20Component {
31 } 30 }
32 31
33 titleInit() { 32 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 - } 33 + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
  34 + this.titleMarked = titleInitRes.titleMarked;
  35 + this.textArr = titleInitRes.textArr;
40 } 36 }
41 37
42 build() { 38 build() {
@@ -48,10 +44,14 @@ export struct Card20Component { @@ -48,10 +44,14 @@ export struct Card20Component {
48 Text() { 44 Text() {
49 45
50 if (this.titleMarked) { 46 if (this.titleMarked) {
51 - Span(this.str01)  
52 - Span(this.str02) 47 + ForEach(this.textArr, (textItem: textItem) => {
  48 + if (textItem.isRed) {
  49 + Span(textItem.content)
53 .fontColor(0xED2800) 50 .fontColor(0xED2800)
54 - Span(this.str03) 51 + } else {
  52 + Span(textItem.content)
  53 + }
  54 + })
55 } else { 55 } else {
56 Span(this.contentDTO.newsTitle) 56 Span(this.contentDTO.newsTitle)
57 } 57 }
@@ -7,6 +7,7 @@ import {CarderInteraction} from '../CarderInteraction' @@ -7,6 +7,7 @@ import {CarderInteraction} from '../CarderInteraction'
7 import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; 7 import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
8 import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; 8 import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
9 import { InfomationCardClick } from '../../utils/infomationCardClick' 9 import { InfomationCardClick } from '../../utils/infomationCardClick'
  10 +import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
10 11
11 const TAG: string = 'Card6Component-Card13Component'; 12 const TAG: string = 'Card6Component-Card13Component';
12 13
@@ -22,9 +23,7 @@ export struct Card21Component { @@ -22,9 +23,7 @@ export struct Card21Component {
22 @State loadImg: boolean = false; 23 @State loadImg: boolean = false;
23 @State clicked: boolean = false; 24 @State clicked: boolean = false;
24 @State titleMarked: boolean = false; 25 @State titleMarked: boolean = false;
25 - @State str01: string = '';  
26 - @State str02: string = '';  
27 - @State str03: string = ''; 26 + @State textArr: textItem[] = []
28 27
29 async aboutToAppear(): Promise<void> { 28 async aboutToAppear(): Promise<void> {
30 this.titleInit(); 29 this.titleInit();
@@ -33,12 +32,9 @@ export struct Card21Component { @@ -33,12 +32,9 @@ export struct Card21Component {
33 } 32 }
34 33
35 titleInit() { 34 titleInit() {
36 - if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {  
37 - this.titleMarked = true;  
38 - this.str01 = this.contentDTO.title?.split('<em>')[0] || '';  
39 - this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';  
40 - this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';  
41 - } 35 + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
  36 + this.titleMarked = titleInitRes.titleMarked;
  37 + this.textArr = titleInitRes.textArr;
42 } 38 }
43 39
44 build() { 40 build() {
@@ -50,10 +46,14 @@ export struct Card21Component { @@ -50,10 +46,14 @@ export struct Card21Component {
50 GridItem() { 46 GridItem() {
51 Text() { 47 Text() {
52 if (this.titleMarked) { 48 if (this.titleMarked) {
53 - Span(this.str01)  
54 - Span(this.str02) 49 + ForEach(this.textArr, (textItem: textItem) => {
  50 + if (textItem.isRed) {
  51 + Span(textItem.content)
55 .fontColor(0xED2800) 52 .fontColor(0xED2800)
56 - Span(this.str03) 53 + } else {
  54 + Span(textItem.content)
  55 + }
  56 + })
57 } else { 57 } else {
58 Span(this.contentDTO.newsTitle) 58 Span(this.contentDTO.newsTitle)
59 } 59 }
@@ -8,12 +8,9 @@ import { Notes } from './notes'; @@ -8,12 +8,9 @@ import { Notes } from './notes';
8 import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; 8 import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
9 import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; 9 import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
10 import { InfomationCardClick } from '../../utils/infomationCardClick'; 10 import { InfomationCardClick } from '../../utils/infomationCardClick';
  11 +import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
11 12
12 const TAG: string = 'Card2Component' 13 const TAG: string = 'Card2Component'
13 -interface textItem {  
14 - content: string,  
15 - isRed: boolean  
16 -}  
17 /** 14 /**
18 * 大图卡: 15 * 大图卡:
19 * compstyle:2 16 * compstyle:2
@@ -33,52 +30,17 @@ export struct Card2Component { @@ -33,52 +30,17 @@ export struct Card2Component {
33 @State textArr: textItem[] = [] 30 @State textArr: textItem[] = []
34 31
35 async aboutToAppear(): Promise<void> { 32 async aboutToAppear(): Promise<void> {
36 - this.clicked = hasClicked(this.contentDTO.objectId)  
37 this.titleInit(); 33 this.titleInit();
  34 + this.clicked = hasClicked(this.contentDTO.objectId)
38 this.loadImg = await onlyWifiLoadImg(); 35 this.loadImg = await onlyWifiLoadImg();
39 } 36 }
40 37
41 titleInit() { 38 titleInit() {
42 - if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {  
43 - this.titleMarked = true;  
44 - // this.str01 = this.contentDTO.title?.split('<em>')[0] || '';  
45 - // this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';  
46 - // this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';  
47 -  
48 - const html: string = this.contentDTO.title;  
49 - const pattern = /<[a-z]+[1-6]?\b[^>]*>(.*?)<\/[a-z]+[1-6]?>/g;  
50 - const res: string[] = [];  
51 - let match: RegExpExecArray | null;  
52 -  
53 - while ((match = pattern.exec(html)) !== null) {  
54 - const content: string = match[1].trim();  
55 - res.push(content);  
56 - }  
57 -  
58 - let textArr: textItem[] = [];  
59 - this.formatTitle(html, res, 0, textArr);  
60 - this.textArr = textArr;  
61 - } 39 + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
  40 + this.titleMarked = titleInitRes.titleMarked;
  41 + this.textArr = titleInitRes.textArr;
62 } 42 }
63 43
64 - formatTitle(textStr: string, matchArr: string[], index: number, textArr: textItem[]) {  
65 - const item: string = matchArr[index];  
66 - const arr = textStr.split(item);  
67 - arr.forEach((str: string, ind: number) => {  
68 - if (ind === 0) {  
69 - textArr.push({  
70 - content: str.replaceAll('<em>', '').replaceAll('</em>', ''),  
71 - isRed: false  
72 - } as textItem)  
73 - textArr.push({  
74 - content: item,  
75 - isRed: true  
76 - })  
77 - } else if (ind === 1) {  
78 - this.formatTitle(str, matchArr, index + 1, textArr)  
79 - }  
80 - })  
81 - }  
82 44
83 build() { 45 build() {
84 Column() { 46 Column() {
@@ -119,10 +81,6 @@ export struct Card2Component { @@ -119,10 +81,6 @@ export struct Card2Component {
119 81
120 Text() { 82 Text() {
121 if (this.titleMarked) { 83 if (this.titleMarked) {
122 - // Span(this.str01)  
123 - // Span(this.str02)  
124 - // .fontColor(0xED2800)  
125 - // Span(this.str03)  
126 ForEach(this.textArr, (textItem: textItem) => { 84 ForEach(this.textArr, (textItem: textItem) => {
127 if (textItem.isRed) { 85 if (textItem.isRed) {
128 Span(textItem.content) 86 Span(textItem.content)
@@ -5,6 +5,7 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; @@ -5,6 +5,7 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
5 import { Notes } from './notes'; 5 import { Notes } from './notes';
6 import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; 6 import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
7 import { InfomationCardClick } from '../../utils/infomationCardClick' 7 import { InfomationCardClick } from '../../utils/infomationCardClick'
  8 +import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
8 9
9 10
10 /** 11 /**
@@ -19,9 +20,7 @@ export struct Card3Component { @@ -19,9 +20,7 @@ export struct Card3Component {
19 @State clicked: boolean = false; 20 @State clicked: boolean = false;
20 @ObjectLink compDTO: CompDTO 21 @ObjectLink compDTO: CompDTO
21 @State titleMarked: boolean = false; 22 @State titleMarked: boolean = false;
22 - @State str01: string = '';  
23 - @State str02: string = '';  
24 - @State str03: string = ''; 23 + @State textArr: textItem[] = []
25 24
26 async aboutToAppear(): Promise<void> { 25 async aboutToAppear(): Promise<void> {
27 this.titleInit(); 26 this.titleInit();
@@ -29,28 +28,39 @@ export struct Card3Component { @@ -29,28 +28,39 @@ export struct Card3Component {
29 } 28 }
30 29
31 titleInit() { 30 titleInit() {
32 - if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {  
33 - this.titleMarked = true;  
34 - this.str01 = this.contentDTO.title?.split('<em>')[0] || '';  
35 - this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';  
36 - this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';  
37 - } 31 + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
  32 + this.titleMarked = titleInitRes.titleMarked;
  33 + this.textArr = titleInitRes.textArr;
38 } 34 }
39 35
40 build() { 36 build() {
41 Column() { 37 Column() {
42 Stack() { 38 Stack() {
  39 + // if (this.contentDTO.newTags) {
  40 + // Notes({ newTags: this.contentDTO.newTags }).height(27).align(Alignment.Center)
  41 + // } else if (this.contentDTO.objectType == '5') {
  42 + // Notes({ objectType: this.contentDTO.objectType }).height(27).align(Alignment.Center)
  43 + // }
  44 + if(this.contentDTO.objectType == '5'){
  45 + Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center)
  46 + } else {
  47 + if (this.contentDTO.seoTags) {
  48 + Notes({ newTags: this.contentDTO.seoTags }).height(30).align(Alignment.Center)
  49 + }
43 if (this.contentDTO.newTags) { 50 if (this.contentDTO.newTags) {
44 - Notes({ newTags: this.contentDTO.newTags }).height(27).align(Alignment.Center)  
45 - } else if (this.contentDTO.objectType == '5') {  
46 - Notes({ objectType: this.contentDTO.objectType }).height(27).align(Alignment.Center) 51 + Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)
  52 + }
47 } 53 }
48 Text() { 54 Text() {
49 if (this.titleMarked) { 55 if (this.titleMarked) {
50 - Span(this.str01)  
51 - Span(this.str02) 56 + ForEach(this.textArr, (textItem: textItem) => {
  57 + if (textItem.isRed) {
  58 + Span(textItem.content)
52 .fontColor(0xED2800) 59 .fontColor(0xED2800)
53 - Span(this.str03) 60 + } else {
  61 + Span(textItem.content)
  62 + }
  63 + })
54 } else { 64 } else {
55 Span(this.contentDTO.newsTitle) 65 Span(this.contentDTO.newsTitle)
56 } 66 }
@@ -59,9 +69,10 @@ export struct Card3Component { @@ -59,9 +69,10 @@ export struct Card3Component {
59 .fontSize($r("app.float.font_size_18")) 69 .fontSize($r("app.float.font_size_18"))
60 .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) 70 .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222"))
61 .width(CommonConstants.FULL_WIDTH) 71 .width(CommonConstants.FULL_WIDTH)
62 - .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :  
63 - (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||  
64 - this.contentDTO.objectType == '5' ? 35 : 0) 72 + .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
  73 + (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 :
  74 + ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
  75 + 0 )
65 }.alignContent(Alignment.TopStart) 76 }.alignContent(Alignment.TopStart)
66 77
67 // 评论等信息 78 // 评论等信息
@@ -7,6 +7,7 @@ import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; @@ -7,6 +7,7 @@ import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
7 import { Notes } from './notes'; 7 import { Notes } from './notes';
8 import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; 8 import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
9 import { InfomationCardClick } from '../../utils/infomationCardClick' 9 import { InfomationCardClick } from '../../utils/infomationCardClick'
  10 +import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
10 11
11 const TAG: string = 'Card4Component'; 12 const TAG: string = 'Card4Component';
12 13
@@ -25,9 +26,7 @@ export struct Card4Component { @@ -25,9 +26,7 @@ export struct Card4Component {
25 @State loadImg: boolean = false; 26 @State loadImg: boolean = false;
26 @State clicked: boolean = false; 27 @State clicked: boolean = false;
27 @State titleMarked: boolean = false; 28 @State titleMarked: boolean = false;
28 - @State str01: string = '';  
29 - @State str02: string = '';  
30 - @State str03: string = ''; 29 + @State textArr: textItem[] = []
31 @ObjectLink compDTO: CompDTO 30 @ObjectLink compDTO: CompDTO
32 31
33 async aboutToAppear(): Promise<void> { 32 async aboutToAppear(): Promise<void> {
@@ -37,12 +36,9 @@ export struct Card4Component { @@ -37,12 +36,9 @@ export struct Card4Component {
37 } 36 }
38 37
39 titleInit() { 38 titleInit() {
40 - if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {  
41 - this.titleMarked = true;  
42 - this.str01 = this.contentDTO.title?.split('<em>')[0] || '';  
43 - this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';  
44 - this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';  
45 - } 39 + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
  40 + this.titleMarked = titleInitRes.titleMarked;
  41 + this.textArr = titleInitRes.textArr;
46 } 42 }
47 43
48 build() { 44 build() {
@@ -50,17 +46,26 @@ export struct Card4Component { @@ -50,17 +46,26 @@ export struct Card4Component {
50 //body 46 //body
51 Column() { 47 Column() {
52 Stack() { 48 Stack() {
  49 + if(this.contentDTO.objectType == '5'){
  50 + Notes({ objectType: this.contentDTO.objectType }).height(19).align(Alignment.Center)
  51 + } else {
  52 + if (this.contentDTO.seoTags) {
  53 + Notes({ newTags: this.contentDTO.seoTags }).height(19).align(Alignment.Center)
  54 + }
53 if (this.contentDTO.newTags) { 55 if (this.contentDTO.newTags) {
54 Notes({ newTags: this.contentDTO.newTags }).height(19).align(Alignment.Center) 56 Notes({ newTags: this.contentDTO.newTags }).height(19).align(Alignment.Center)
55 - } else if (this.contentDTO.objectType == '5') {  
56 - Notes({ objectType: this.contentDTO.objectType }).height(19).align(Alignment.Center) 57 + }
57 } 58 }
58 Text() { 59 Text() {
59 if (this.titleMarked) { 60 if (this.titleMarked) {
60 - Span(this.str01)  
61 - Span(this.str02) 61 + ForEach(this.textArr, (textItem: textItem) => {
  62 + if (textItem.isRed) {
  63 + Span(textItem.content)
62 .fontColor(0xED2800) 64 .fontColor(0xED2800)
63 - Span(this.str03) 65 + } else {
  66 + Span(textItem.content)
  67 + }
  68 + })
64 } else { 69 } else {
65 Span(this.contentDTO.newsTitle) 70 Span(this.contentDTO.newsTitle)
66 } 71 }
@@ -69,9 +74,10 @@ export struct Card4Component { @@ -69,9 +74,10 @@ export struct Card4Component {
69 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) 74 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
70 .maxLines(3) 75 .maxLines(3)
71 .textOverflow({ overflow: TextOverflow.Ellipsis }) 76 .textOverflow({ overflow: TextOverflow.Ellipsis })
72 - .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :  
73 - (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||  
74 - this.contentDTO.objectType == '5' ? 30 : 0) 77 + .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
  78 + (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 :
  79 + ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
  80 + 0 )
75 }.alignContent(Alignment.TopStart) 81 }.alignContent(Alignment.TopStart)
76 //新闻标题 82 //新闻标题
77 83
@@ -5,6 +5,7 @@ import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; @@ -5,6 +5,7 @@ import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
5 import { Notes } from './notes'; 5 import { Notes } from './notes';
6 import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; 6 import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
7 import { InfomationCardClick } from '../../utils/infomationCardClick' 7 import { InfomationCardClick } from '../../utils/infomationCardClick'
  8 +import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
8 9
9 10
10 const TAG: string = 'Card5Component'; 11 const TAG: string = 'Card5Component';
@@ -22,9 +23,7 @@ export struct Card5Component { @@ -22,9 +23,7 @@ export struct Card5Component {
22 @State loadImg: boolean = false; 23 @State loadImg: boolean = false;
23 @State clicked: boolean = false; 24 @State clicked: boolean = false;
24 @State titleMarked: boolean = false; 25 @State titleMarked: boolean = false;
25 - @State str01: string = '';  
26 - @State str02: string = '';  
27 - @State str03: string = ''; 26 + @State textArr: textItem[] = []
28 27
29 async aboutToAppear(): Promise<void> { 28 async aboutToAppear(): Promise<void> {
30 console.log('Card2Component', JSON.stringify(this.compDTO)) 29 console.log('Card2Component', JSON.stringify(this.compDTO))
@@ -35,12 +34,9 @@ export struct Card5Component { @@ -35,12 +34,9 @@ export struct Card5Component {
35 } 34 }
36 35
37 titleInit() { 36 titleInit() {
38 - if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {  
39 - this.titleMarked = true;  
40 - this.str01 = this.contentDTO.title?.split('<em>')[0] || '';  
41 - this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';  
42 - this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';  
43 - } 37 + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
  38 + this.titleMarked = titleInitRes.titleMarked;
  39 + this.textArr = titleInitRes.textArr;
44 } 40 }
45 41
46 build() { 42 build() {
@@ -61,18 +57,27 @@ export struct Card5Component { @@ -61,18 +57,27 @@ export struct Card5Component {
61 }) 57 })
62 Row() { 58 Row() {
63 Stack() { 59 Stack() {
  60 + if(this.contentDTO.objectType == '5'){
  61 + Notes({ objectType: this.contentDTO.objectType }).align(Alignment.Center)
  62 + } else {
  63 + if (this.contentDTO.seoTags) {
  64 + Notes({ newTags: this.contentDTO.seoTags }).align(Alignment.Center)
  65 + }
64 if (this.contentDTO.newTags) { 66 if (this.contentDTO.newTags) {
65 - Notes({ newTags: this.contentDTO.newTags })  
66 - } else if (this.contentDTO.objectType == '5') {  
67 - Notes({ objectType: this.contentDTO.objectType }) 67 + Notes({ newTags: this.contentDTO.newTags }).align(Alignment.Center)
  68 + }
68 } 69 }
69 70
70 Text() { 71 Text() {
71 if (this.titleMarked) { 72 if (this.titleMarked) {
72 - Span(this.str01)  
73 - Span(this.str02) 73 + ForEach(this.textArr, (textItem: textItem) => {
  74 + if (textItem.isRed) {
  75 + Span(textItem.content)
74 .fontColor(0xED2800) 76 .fontColor(0xED2800)
75 - Span(this.str03) 77 + } else {
  78 + Span(textItem.content)
  79 + }
  80 + })
76 } else { 81 } else {
77 Span(this.contentDTO.newsTitle) 82 Span(this.contentDTO.newsTitle)
78 } 83 }
@@ -83,9 +88,10 @@ export struct Card5Component { @@ -83,9 +88,10 @@ export struct Card5Component {
83 .maxLines(2) 88 .maxLines(2)
84 .align(Alignment.TopStart) 89 .align(Alignment.TopStart)
85 .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 90 .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
86 - .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :  
87 - (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||  
88 - this.contentDTO.objectType == '5' ? 35 : 0) 91 + .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
  92 + (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 :
  93 + ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
  94 + 0 )
89 }.alignContent(Alignment.TopStart) 95 }.alignContent(Alignment.TopStart)
90 } 96 }
91 .justifyContent(FlexAlign.Start) 97 .justifyContent(FlexAlign.Start)
@@ -8,6 +8,7 @@ import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; @@ -8,6 +8,7 @@ import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
8 import { Logger } from 'wdKit/Index'; 8 import { Logger } from 'wdKit/Index';
9 import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; 9 import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
10 import { InfomationCardClick } from '../../utils/infomationCardClick' 10 import { InfomationCardClick } from '../../utils/infomationCardClick'
  11 +import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
11 12
12 const TAG: string = 'Card6Component-Card13Component'; 13 const TAG: string = 'Card6Component-Card13Component';
13 14
@@ -21,9 +22,7 @@ export struct Card6Component { @@ -21,9 +22,7 @@ export struct Card6Component {
21 @State loadImg: boolean = false; 22 @State loadImg: boolean = false;
22 @State clicked: boolean = false; 23 @State clicked: boolean = false;
23 @State titleMarked: boolean = false; 24 @State titleMarked: boolean = false;
24 - @State str01: string = '';  
25 - @State str02: string = '';  
26 - @State str03: string = ''; 25 + @State textArr: textItem[] = []
27 @ObjectLink compDTO: CompDTO 26 @ObjectLink compDTO: CompDTO
28 @State contentDTO: ContentDTO = new ContentDTO(); 27 @State contentDTO: ContentDTO = new ContentDTO();
29 28
@@ -33,12 +32,9 @@ export struct Card6Component { @@ -33,12 +32,9 @@ export struct Card6Component {
33 this.clicked = hasClicked(this.contentDTO.objectId) 32 this.clicked = hasClicked(this.contentDTO.objectId)
34 } 33 }
35 titleInit() { 34 titleInit() {
36 - if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {  
37 - this.titleMarked = true;  
38 - this.str01 = this.contentDTO.title?.split('<em>')[0] || '';  
39 - this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';  
40 - this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';  
41 - } 35 + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
  36 + this.titleMarked = titleInitRes.titleMarked;
  37 + this.textArr = titleInitRes.textArr;
42 } 38 }
43 39
44 build() { 40 build() {
@@ -70,10 +66,14 @@ export struct Card6Component { @@ -70,10 +66,14 @@ export struct Card6Component {
70 66
71 Text() { 67 Text() {
72 if (this.titleMarked) { 68 if (this.titleMarked) {
73 - Span(this.str01)  
74 - Span(this.str02) 69 + ForEach(this.textArr, (textItem: textItem) => {
  70 + if (textItem.isRed) {
  71 + Span(textItem.content)
75 .fontColor(0xED2800) 72 .fontColor(0xED2800)
76 - Span(this.str03) 73 + } else {
  74 + Span(textItem.content)
  75 + }
  76 + })
77 } else { 77 } else {
78 Span(this.contentDTO.newsTitle) 78 Span(this.contentDTO.newsTitle)
79 } 79 }
@@ -103,8 +103,8 @@ export struct Card6Component { @@ -103,8 +103,8 @@ export struct Card6Component {
103 .width('64%') 103 .width('64%')
104 .height(this.contentDTO.appStyle === CompStyle.Card_13 ? '' : 156) 104 .height(this.contentDTO.appStyle === CompStyle.Card_13 ? '' : 156)
105 105
106 - Stack() {  
107 - Image(this.loadImg ? this.contentDTO.coverUrl : '') 106 + Stack({alignContent: Alignment.BottomEnd}) {
  107 + Image(this.loadImg ? this.contentDTO.coverUrl || this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '')
108 .backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5) 108 .backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
109 .borderRadius(5) 109 .borderRadius(5)
110 .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) 110 .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4)
@@ -7,6 +7,7 @@ import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; @@ -7,6 +7,7 @@ import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
7 import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; 7 import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
8 import { InfomationCardClick } from '../../utils/infomationCardClick' 8 import { InfomationCardClick } from '../../utils/infomationCardClick'
9 import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index'; 9 import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index';
  10 +import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
10 11
11 /** 12 /**
12 * 时间链卡--CompStyle: 09 13 * 时间链卡--CompStyle: 09
@@ -22,9 +23,7 @@ export struct Card9Component { @@ -22,9 +23,7 @@ export struct Card9Component {
22 // @State loadImg: boolean = true; 23 // @State loadImg: boolean = true;
23 @State clicked: boolean = false; 24 @State clicked: boolean = false;
24 @State titleMarked: boolean = false; 25 @State titleMarked: boolean = false;
25 - @State str01: string = '';  
26 - @State str02: string = '';  
27 - @State str03: string = ''; 26 + @State textArr: textItem[] = []
28 pageShowTime:number = 0; 27 pageShowTime:number = 0;
29 pageHideTime:number = 0; 28 pageHideTime:number = 0;
30 29
@@ -48,12 +47,9 @@ export struct Card9Component { @@ -48,12 +47,9 @@ export struct Card9Component {
48 } 47 }
49 48
50 titleInit() { 49 titleInit() {
51 - if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {  
52 - this.titleMarked = true;  
53 - this.str01 = this.contentDTO.title?.split('<em>')[0] || '';  
54 - this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';  
55 - this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';  
56 - } 50 + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
  51 + this.titleMarked = titleInitRes.titleMarked;
  52 + this.textArr = titleInitRes.textArr;
57 } 53 }
58 54
59 build() { 55 build() {
@@ -62,10 +58,14 @@ export struct Card9Component { @@ -62,10 +58,14 @@ export struct Card9Component {
62 if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { 58 if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) {
63 Text() { 59 Text() {
64 if (this.titleMarked) { 60 if (this.titleMarked) {
65 - Span(this.str01)  
66 - Span(this.str02) 61 + ForEach(this.textArr, (textItem: textItem) => {
  62 + if (textItem.isRed) {
  63 + Span(textItem.content)
67 .fontColor(0xED2800) 64 .fontColor(0xED2800)
68 - Span(this.str03) 65 + } else {
  66 + Span(textItem.content)
  67 + }
  68 + })
69 } else { 69 } else {
70 Span(this.contentDTO.newsTitle) 70 Span(this.contentDTO.newsTitle)
71 } 71 }
@@ -88,10 +88,16 @@ export struct Card9Component { @@ -88,10 +88,16 @@ export struct Card9Component {
88 topLeft: $r('app.float.image_border_radius'), 88 topLeft: $r('app.float.image_border_radius'),
89 topRight: $r('app.float.image_border_radius') 89 topRight: $r('app.float.image_border_radius')
90 }) 90 })
91 -  
92 - if (this.contentDTO.objectType == '5') {  
93 - Notes({ objectType: 5 }) 91 + if(this.contentDTO.objectType == '5'){
  92 + Notes({ objectType: this.contentDTO.objectType }).align(Alignment.Center)
94 .margin({ left: 5, bottom: 5 }) 93 .margin({ left: 5, bottom: 5 })
  94 + } else {
  95 + if (this.contentDTO.seoTags) {
  96 + Notes({ newTags: this.contentDTO.seoTags }).align(Alignment.Center)
  97 + }
  98 + if (this.contentDTO.newTags) {
  99 + Notes({ newTags: this.contentDTO.newTags }).align(Alignment.Center)
  100 + }
95 } 101 }
96 102
97 }.alignContent(Alignment.BottomStart) 103 }.alignContent(Alignment.BottomStart)
@@ -5,6 +5,7 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo' @@ -5,6 +5,7 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
6 import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; 6 import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
7 import { InfomationCardClick } from '../../utils/infomationCardClick' 7 import { InfomationCardClick } from '../../utils/infomationCardClick'
  8 +import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
8 9
9 const TAG: string = 'Card4Component'; 10 const TAG: string = 'Card4Component';
10 11
@@ -19,9 +20,7 @@ export struct SearchContentComponent { @@ -19,9 +20,7 @@ export struct SearchContentComponent {
19 @State contentDTO: ContentDTO = new ContentDTO(); 20 @State contentDTO: ContentDTO = new ContentDTO();
20 @State loadImg: boolean = false; 21 @State loadImg: boolean = false;
21 @State clicked: boolean = false; 22 @State clicked: boolean = false;
22 - @State str01: string = '';  
23 - @State str02: string = '';  
24 - @State str03: string = ''; 23 + @State textArr: textItem[] = []
25 24
26 25
27 async aboutToAppear(): Promise<void> { 26 async aboutToAppear(): Promise<void> {
@@ -30,9 +29,9 @@ export struct SearchContentComponent { @@ -30,9 +29,9 @@ export struct SearchContentComponent {
30 } 29 }
31 30
32 titleInit() { 31 titleInit() {
33 - this.str01 = this.contentDTO.contentText?.split('<em>')[0] || '';  
34 - this.str02 = this.contentDTO.contentText?.split('<em>')[1].split('</em>')[0] || '';  
35 - this.str03 = this.contentDTO.contentText?.split('<em>')[1].split('</em>')[1] || ''; 32 + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
  33 + // this.titleMarked = titleInitRes.titleMarked;
  34 + this.textArr = titleInitRes.textArr;
36 } 35 }
37 36
38 build() { 37 build() {
@@ -47,11 +46,15 @@ export struct SearchContentComponent { @@ -47,11 +46,15 @@ export struct SearchContentComponent {
47 .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 46 .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
48 47
49 // 命中内容 48 // 命中内容
50 - Text(this.contentDTO.contentText) {  
51 - Span(this.str01)  
52 - Span(this.str02) 49 + Text() {
  50 + ForEach(this.textArr, (textItem: textItem) => {
  51 + if (textItem.isRed) {
  52 + Span(textItem.content)
53 .fontColor(0xED2800) 53 .fontColor(0xED2800)
54 - Span(this.str03) 54 + } else {
  55 + Span(textItem.content)
  56 + }
  57 + })
55 } 58 }
56 .fontSize(13) 59 .fontSize(13)
57 .width(CommonConstants.FULL_PARENT) 60 .width(CommonConstants.FULL_PARENT)
@@ -15,6 +15,7 @@ export struct CommentCustomDialog { @@ -15,6 +15,7 @@ export struct CommentCustomDialog {
15 @State private emojiSwitch: boolean = false 15 @State private emojiSwitch: boolean = false
16 textInputController: TextAreaController = new TextAreaController() 16 textInputController: TextAreaController = new TextAreaController()
17 @State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 } 17 @State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 }
  18 + @State publishButtonOpacity: number = 0.5
18 19
19 aboutToAppear(): void { 20 aboutToAppear(): void {
20 } 21 }
@@ -55,8 +56,15 @@ export struct CommentCustomDialog { @@ -55,8 +56,15 @@ export struct CommentCustomDialog {
55 .height('100%') 56 .height('100%')
56 .width('100%') 57 .width('100%')
57 .backgroundColor($r('app.color.color_transparent')) 58 .backgroundColor($r('app.color.color_transparent'))
  59 + .caretColor("#ED2800")
58 .onChange(value => { 60 .onChange(value => {
59 this.publishCommentModel.commentContent = value; 61 this.publishCommentModel.commentContent = value;
  62 +
  63 + if (value.length > 0) {
  64 + this.publishButtonOpacity = 1.0
  65 + } else {
  66 + this.publishButtonOpacity = 0.5
  67 + }
60 }) 68 })
61 .onFocus(() => { 69 .onFocus(() => {
62 if (this.emojiSwitch) { 70 if (this.emojiSwitch) {
@@ -98,13 +106,14 @@ export struct CommentCustomDialog { @@ -98,13 +106,14 @@ export struct CommentCustomDialog {
98 106
99 Row() { 107 Row() {
100 Text('发布') 108 Text('发布')
101 - .backgroundColor('#F89381') 109 + .backgroundColor("#ED2800")
102 .width(80) 110 .width(80)
103 .height(30) 111 .height(30)
104 .fontSize(15) 112 .fontSize(15)
105 .fontColor(Color.White) 113 .fontColor(Color.White)
106 .textAlign(TextAlign.Center) 114 .textAlign(TextAlign.Center)
107 .borderRadius(4) 115 .borderRadius(4)
  116 + .opacity(this.publishButtonOpacity)
108 .onClick(() => { 117 .onClick(() => {
109 if (this.publishCommentModel.commentContent.length > 0) { 118 if (this.publishCommentModel.commentContent.length > 0) {
110 //请求评论接口 119 //请求评论接口
@@ -257,6 +257,7 @@ export struct QualityCommentsComponent { @@ -257,6 +257,7 @@ export struct QualityCommentsComponent {
257 .height("100%") 257 .height("100%")
258 .width("100%") 258 .width("100%")
259 .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果 259 .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
  260 + .scrollBar(BarState.Off)
260 .nestedScroll({ 261 .nestedScroll({
261 scrollForward: NestedScrollMode.PARENT_FIRST, 262 scrollForward: NestedScrollMode.PARENT_FIRST,
262 scrollBackward: NestedScrollMode.SELF_FIRST 263 scrollBackward: NestedScrollMode.SELF_FIRST
@@ -405,7 +406,7 @@ struct QualityCommentItem { @@ -405,7 +406,7 @@ struct QualityCommentItem {
405 406
406 if (this.item.api_authIcon && this.item.api_authIcon.length > 0) { 407 if (this.item.api_authIcon && this.item.api_authIcon.length > 0) {
407 Image(this.item.api_authIcon) // 加v 408 Image(this.item.api_authIcon) // 加v
408 - .width(12).height(12) 409 + .width(14).height(14)
409 .objectFit(ImageFit.Cover) 410 .objectFit(ImageFit.Cover)
410 } 411 }
411 }.width(50).height(50) 412 }.width(50).height(50)
1 import { ContentDTO } from 'wdBean/Index' 1 import { ContentDTO } from 'wdBean/Index'
2 import { StringUtils, UserDataLocal } from 'wdKit/Index' 2 import { StringUtils, UserDataLocal } from 'wdKit/Index'
3 -import { ProcessUtils } from 'wdRouter/Index'  
4 import MinePageDatasModel from '../../../model/MinePageDatasModel' 3 import MinePageDatasModel from '../../../model/MinePageDatasModel'
5 import { CommentLikeOperationRequestItem } from '../../../viewmodel/CommentLikeOperationRequestItem' 4 import { CommentLikeOperationRequestItem } from '../../../viewmodel/CommentLikeOperationRequestItem'
6 import { CommentListItem } from '../../../viewmodel/CommentListItem' 5 import { CommentListItem } from '../../../viewmodel/CommentListItem'
7 import measure from '@ohos.measure' 6 import measure from '@ohos.measure'
8 -import { TrackingContent, TrackConstants, TrackParamConvert } from 'wdTracking/Index'  
9 7
10 @Component 8 @Component
11 export struct ChildCommentComponent { 9 export struct ChildCommentComponent {
@@ -16,8 +14,6 @@ export struct ChildCommentComponent { @@ -16,8 +14,6 @@ export struct ChildCommentComponent {
16 @State isExpandParent: boolean = false; 14 @State isExpandParent: boolean = false;
17 @State isOverLines: boolean = false 15 @State isOverLines: boolean = false
18 @State isOverLinesParent: boolean = false 16 @State isOverLinesParent: boolean = false
19 - testText:string = "1,因为读书的人\n是低着头向上看的人\n身处一隅,却能放眼世界\n2,因为读书的人\n总是比不读书的人\n活得有趣一点\n3,因为读书的人\n即使平凡,绝不平庸"  
20 - @Link fromPage:number  
21 17
22 build() { 18 build() {
23 Column() { 19 Column() {
@@ -196,15 +192,6 @@ export struct ChildCommentComponent { @@ -196,15 +192,6 @@ export struct ChildCommentComponent {
196 192
197 }.height('69lpx') 193 }.height('69lpx')
198 .justifyContent(FlexAlign.Center) 194 .justifyContent(FlexAlign.Center)
199 - .onClick(() => {  
200 - let content = getParams(this.data)  
201 - if(this.fromPage === 0 ){  
202 - TrackingContent.common(TrackConstants.EventType.Click,TrackConstants.PageName.Main_Personal,TrackConstants.PageName.Main_Personal,TrackParamConvert.program(content))  
203 - }else{  
204 - TrackingContent.common(TrackConstants.EventType.Click,TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal,TrackParamConvert.program(content))  
205 - }  
206 - ProcessUtils.processPage(content)  
207 - })  
208 } 195 }
209 .margin({ top: '19lpx', bottom: '31lpx', left: '31lpx', right: '31lpx' }) 196 .margin({ top: '19lpx', bottom: '31lpx', left: '31lpx', right: '31lpx' })
210 .padding({ left: '23lpx' }) 197 .padding({ left: '23lpx' })
@@ -10,6 +10,7 @@ import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherU @@ -10,6 +10,7 @@ import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherU
10 import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'; 10 import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
11 import { ContentDTO } from 'wdBean/Index'; 11 import { ContentDTO } from 'wdBean/Index';
12 import { TrackingContent, TrackConstants, TrackParamConvert } from 'wdTracking/Index'; 12 import { TrackingContent, TrackConstants, TrackParamConvert } from 'wdTracking/Index';
  13 +import { ProcessUtils } from 'wdRouter/Index';
13 14
14 const TAG = "HomePageBottomCommentComponent" 15 const TAG = "HomePageBottomCommentComponent"
15 16
@@ -85,10 +86,15 @@ export struct HomePageBottomCommentComponent { @@ -85,10 +86,15 @@ export struct HomePageBottomCommentComponent {
85 ChildCommentComponent({ 86 ChildCommentComponent({
86 data: item, 87 data: item,
87 levelHead: UserDataLocal.getUserLevelHeaderUrl(), 88 levelHead: UserDataLocal.getUserLevelHeaderUrl(),
88 - isLastItem: index === this.data_comment.totalCount() - 1,  
89 - fromPage:0 89 + isLastItem: index === this.data_comment.totalCount() - 1
90 }) 90 })
91 - }.onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => { 91 + }
  92 + .onClick(()=>{
  93 + let content = getParams(item)
  94 + TrackingContent.common(TrackConstants.EventType.Click,TrackConstants.PageName.Main_Personal,TrackConstants.PageName.Main_Personal,TrackParamConvert.program(content))
  95 + ProcessUtils.processPage(content)
  96 + })
  97 + .onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {
92 if (isVisible) { 98 if (isVisible) {
93 let contentDTO = getParams(item) 99 let contentDTO = getParams(item)
94 TrackingContent.common(TrackConstants.EventType.Show, TrackConstants.PageName.Main_Personal,TrackConstants.PageName.Main_Personal, TrackParamConvert.program(contentDTO)) 100 TrackingContent.common(TrackConstants.EventType.Show, TrackConstants.PageName.Main_Personal,TrackConstants.PageName.Main_Personal, TrackParamConvert.program(contentDTO))
@@ -10,6 +10,7 @@ import { EmptyComponent } from '../../view/EmptyComponent'; @@ -10,6 +10,7 @@ import { EmptyComponent } from '../../view/EmptyComponent';
10 import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'; 10 import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
11 import { ContentDTO } from 'wdBean/Index'; 11 import { ContentDTO } from 'wdBean/Index';
12 import { TrackingContent, TrackConstants, TrackParamConvert } from 'wdTracking/Index'; 12 import { TrackingContent, TrackConstants, TrackParamConvert } from 'wdTracking/Index';
  13 +import { ProcessUtils } from 'wdRouter/Index';
13 14
14 const TAG = "HomePageBottomComponent" 15 const TAG = "HomePageBottomComponent"
15 /** 16 /**
@@ -87,9 +88,13 @@ export struct OtherHomePageBottomCommentComponent { @@ -87,9 +88,13 @@ export struct OtherHomePageBottomCommentComponent {
87 data: item, 88 data: item,
88 levelHead: this.levelHead, 89 levelHead: this.levelHead,
89 isLastItem: index === this.data_comment.totalCount() - 1, 90 isLastItem: index === this.data_comment.totalCount() - 1,
90 - fromPage:1  
91 }) 91 })
92 - }.onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => { 92 + }
  93 + .onClick(()=>{
  94 + let content = getParams(item)
  95 + TrackingContent.common(TrackConstants.EventType.Click,TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal,TrackParamConvert.program(content))
  96 + ProcessUtils.processPage(content)
  97 + }).onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {
93 if (isVisible) { 98 if (isVisible) {
94 let contentDTO = getParams(item) 99 let contentDTO = getParams(item)
95 TrackingContent.common(TrackConstants.EventType.Show, TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal, TrackParamConvert.program(contentDTO)) 100 TrackingContent.common(TrackConstants.EventType.Show, TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal, TrackParamConvert.program(contentDTO))
@@ -80,7 +80,7 @@ export struct OperRowListView { @@ -80,7 +80,7 @@ export struct OperRowListView {
80 @State needLike: boolean = true 80 @State needLike: boolean = true
81 @ObjectLink publishCommentModel: publishCommentModel 81 @ObjectLink publishCommentModel: publishCommentModel
82 @State styleType: number = -1 82 @State styleType: number = -1
83 - @State showCommentIcon: boolean = true 83 + @State showCommentIcon: boolean = true // 评论图标
84 @State bgColor: ResourceColor = Color.White 84 @State bgColor: ResourceColor = Color.White
85 @State interactData: InteractDataDTO = {} as InteractDataDTO 85 @State interactData: InteractDataDTO = {} as InteractDataDTO
86 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 86 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@@ -375,6 +375,7 @@ export struct OperRowListView { @@ -375,6 +375,7 @@ export struct OperRowListView {
375 .height(36) 375 .height(36)
376 .width(48) 376 .width(48)
377 .justifyContent(FlexAlign.Center) 377 .justifyContent(FlexAlign.Center)
  378 + .visibility(this.contentDetailData.openAudio == 1 ? Visibility.Visible : Visibility.None) // 【图文稿件】语音播报开关 0不播报 1播报
378 } 379 }
379 380
380 /** 381 /**
  1 +export interface textItem {
  2 + content: string,
  3 + isRed: boolean
  4 +}
  5 +
  6 +export interface titleInitRes {
  7 + titleMarked: boolean,
  8 + textArr: textItem[]
  9 +}
  10 +
  11 +export class SearchShowRed {
  12 + // title: this.contentDTO.title
  13 + static titleInit(title: string) {
  14 + let titleMarked: boolean = false;
  15 + let textArr: textItem[] = [];
  16 +
  17 + if (title?.includes('<em>') && title?.includes('</em>')) {
  18 + titleMarked = true;
  19 +
  20 + const html: string = title;
  21 + const pattern = /<[a-z]+[1-6]?\b[^>]*>(.*?)<\/[a-z]+[1-6]?>/g;
  22 + const res: string[] = [];
  23 + let match: RegExpExecArray | null;
  24 +
  25 + while ((match = pattern.exec(html)) !== null) {
  26 + const content: string = match[1].trim();
  27 + res.push(content);
  28 + }
  29 +
  30 + SearchShowRed.formatTitle(html, res, 0, textArr);
  31 + }
  32 +
  33 + const titleInitRes: titleInitRes = {
  34 + titleMarked,
  35 + textArr
  36 + }
  37 + return titleInitRes
  38 + }
  39 +
  40 + private static formatTitle(textStr: string, matchArr: string[], index: number, textArr: textItem[]) {
  41 + const item: string = matchArr[index];
  42 + const arr = textStr.split(item);
  43 + arr.forEach((str: string, ind: number) => {
  44 + if (ind === 0) {
  45 + textArr.push({
  46 + content: str.replaceAll('<em>', '').replaceAll('</em>', ''),
  47 + isRed: false
  48 + } as textItem)
  49 + textArr.push({
  50 + content: item,
  51 + isRed: true
  52 + })
  53 + } else if (ind === 1) {
  54 + SearchShowRed.formatTitle(str, matchArr, index + 1, textArr)
  55 + }
  56 + })
  57 + }
  58 +}
@@ -9,6 +9,14 @@ import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment @@ -9,6 +9,14 @@ import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment
9 9
10 const TAG = 'DetailPlayLiveCommon' 10 const TAG = 'DetailPlayLiveCommon'
11 11
  12 +/**
  13 + * @Description: 沉浸式和非沉浸式直播页面
  14 + * @Author:
  15 + * @Email:
  16 + * @CreateDate:
  17 + * @UpdateRemark: 更新说明
  18 + * @Version: 1.0
  19 + */
12 @Entry 20 @Entry
13 @Component 21 @Component
14 export struct DetailPlayLiveCommon { 22 export struct DetailPlayLiveCommon {
@@ -41,8 +49,10 @@ export struct DetailPlayLiveCommon { @@ -41,8 +49,10 @@ export struct DetailPlayLiveCommon {
41 Column() { 49 Column() {
42 // 直播预约或横屏直播统一进横屏直播 50 // 直播预约或横屏直播统一进横屏直播
43 if (this.liveState === 'wait' || this.liveStyle === 0) { 51 if (this.liveState === 'wait' || this.liveStyle === 0) {
  52 + // 非沉浸式
44 DetailPlayLivePage({ contentId: this.contentId, relId: this.relId, relType: this.relType }) 53 DetailPlayLivePage({ contentId: this.contentId, relId: this.relId, relType: this.relType })
45 } else if (this.liveStyle === 1) { 54 } else if (this.liveStyle === 1) {
  55 + // 沉浸式
46 DetailPlayVLivePage() 56 DetailPlayVLivePage()
47 } 57 }
48 } 58 }
@@ -61,6 +71,7 @@ export struct DetailPlayLiveCommon { @@ -61,6 +71,7 @@ export struct DetailPlayLiveCommon {
61 console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data)) 71 console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data))
62 if (data) { 72 if (data) {
63 this.contentDetailData = data[0]; 73 this.contentDetailData = data[0];
  74 +
64 // if (this.contentDetailData.openComment === 1) { 75 // if (this.contentDetailData.openComment === 1) {
65 console.log(TAG, '查询视频详情用于评论展示 openComment:', this.contentDetailData.openComment) 76 console.log(TAG, '查询视频详情用于评论展示 openComment:', this.contentDetailData.openComment)
66 this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') 77 this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
@@ -15,6 +15,9 @@ import { ResponseDTO } from 'wdNetwork/Index'; @@ -15,6 +15,9 @@ import { ResponseDTO } from 'wdNetwork/Index';
15 15
16 let TAG: string = 'DetailPlayLivePage'; 16 let TAG: string = 'DetailPlayLivePage';
17 17
  18 +/**
  19 + * 非沉浸式房间直播组件
  20 + */
18 @Component 21 @Component
19 export struct DetailPlayLivePage { 22 export struct DetailPlayLivePage {
20 //横竖屏,默认竖屏 23 //横竖屏,默认竖屏
@@ -63,7 +66,7 @@ export struct DetailPlayLivePage { @@ -63,7 +66,7 @@ export struct DetailPlayLivePage {
63 build() { 66 build() {
64 Column() { 67 Column() {
65 TopPlayComponent({ playerController: this.playerController }) 68 TopPlayComponent({ playerController: this.playerController })
66 - .height(211) 69 + .height(this.displayDirection == DisplayDirection.VERTICAL ?211:'100%')
67 TabComponent({ tabs: this.tabs, changeToTab: this.changeToTab }) 70 TabComponent({ tabs: this.tabs, changeToTab: this.changeToTab })
68 .layoutWeight(1) 71 .layoutWeight(1)
69 .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) 72 .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
@@ -12,6 +12,9 @@ import { PlayerEndView } from '../widgets/vertical/PlayerEndView'; @@ -12,6 +12,9 @@ import { PlayerEndView } from '../widgets/vertical/PlayerEndView';
12 const storage = LocalStorage.getShared(); 12 const storage = LocalStorage.getShared();
13 const TAG = 'DetailPlayVLivePage' 13 const TAG = 'DetailPlayVLivePage'
14 14
  15 +/**
  16 + * 沉浸式房间直播组件
  17 + */
15 @Entry(storage) 18 @Entry(storage)
16 @Component 19 @Component
17 export struct DetailPlayVLivePage { 20 export struct DetailPlayVLivePage {
@@ -2,6 +2,9 @@ import { TabChatComponent } from './TabChatComponent' @@ -2,6 +2,9 @@ import { TabChatComponent } from './TabChatComponent'
2 import { TabInfoComponent } from './TabInfoComponent' 2 import { TabInfoComponent } from './TabInfoComponent'
3 import { TabLiveComponent } from './TabLiveComponent' 3 import { TabLiveComponent } from './TabLiveComponent'
4 4
  5 +/**
  6 + * 非沉浸式直播 tab 组件
  7 + */
5 @Component 8 @Component
6 export struct TabComponent { 9 export struct TabComponent {
7 @Prop @Watch('changeToChart') changeToTab: number 10 @Prop @Watch('changeToChart') changeToTab: number
1 import { LiveDetailsBean } from 'wdBean/Index'; 1 import { LiveDetailsBean } from 'wdBean/Index';
2 -import { StringUtils } from 'wdKit/Index';  
3 -import { PlayerConstants, WDAliPlayerController, WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; 2 +import { Logger, StringUtils } from 'wdKit/Index';
  3 +import { PlayerConstants, WDAliPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index';
4 import { PlayUIComponent } from './PlayUIComponent'; 4 import { PlayUIComponent } from './PlayUIComponent';
5 -import { Logger } from 'wdKit/Index';  
6 import { PictureLoading } from '../../vertical/PictureLoading'; 5 import { PictureLoading } from '../../vertical/PictureLoading';
7 6
8 const TAG: string = 'TopPlayComponent' 7 const TAG: string = 'TopPlayComponent'
@@ -23,6 +22,7 @@ export struct TopPlayComponent { @@ -23,6 +22,7 @@ export struct TopPlayComponent {
23 @State isLoading: boolean = false 22 @State isLoading: boolean = false
24 // 获取播放资源能播放了 23 // 获取播放资源能播放了
25 @State isCanPlay: boolean = false 24 @State isCanPlay: boolean = false
  25 +
26 private playUrl: string = "" 26 private playUrl: string = ""
27 private xComponentIsLoaded: boolean = false 27 private xComponentIsLoaded: boolean = false
28 28
@@ -99,6 +99,7 @@ export struct TopPlayComponent { @@ -99,6 +99,7 @@ export struct TopPlayComponent {
99 99
100 build() { 100 build() {
101 Stack() { 101 Stack() {
  102 + // 视频资源播放
102 WDPlayerRenderLiveView({ 103 WDPlayerRenderLiveView({
103 playerController: this.playerController, 104 playerController: this.playerController,
104 onLoad: async () => { 105 onLoad: async () => {
@@ -112,17 +113,20 @@ export struct TopPlayComponent { @@ -112,17 +113,20 @@ export struct TopPlayComponent {
112 .width('100%') 113 .width('100%')
113 .visibility(this.isWait ? Visibility.None : Visibility.Visible) 114 .visibility(this.isWait ? Visibility.None : Visibility.Visible)
114 115
  116 + // 直播房间图
115 Image(this.imgUrl) 117 Image(this.imgUrl)
116 .objectFit(ImageFit.Cover) 118 .objectFit(ImageFit.Cover)
117 .visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None) 119 .visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None)
118 .contrast(this.isEnd ? 0.2 : 1) 120 .contrast(this.isEnd ? 0.2 : 1)
119 .width('100%') 121 .width('100%')
120 122
  123 + // loading
121 PictureLoading().visibility(this.isLoading ? Visibility.None : Visibility.Visible) 124 PictureLoading().visibility(this.isLoading ? Visibility.None : Visibility.Visible)
122 125
123 // 视频播放器上的控制面板和信息 126 // 视频播放器上的控制面板和信息
124 PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay }) 127 PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay })
125 128
  129 + // 直播结束
126 Text('直播已结束') 130 Text('直播已结束')
127 .fontSize('20fp') 131 .fontSize('20fp')
128 .fontWeight(500) 132 .fontWeight(500)
@@ -131,6 +135,7 @@ export struct TopPlayComponent { @@ -131,6 +135,7 @@ export struct TopPlayComponent {
131 Visibility.None) 135 Visibility.None)
132 136
133 137
  138 + // 直播资源加载失败
134 Column() { 139 Column() {
135 140
136 Text('直播加载中,请稍候重试') 141 Text('直播加载中,请稍候重试')
@@ -22,6 +22,7 @@ export struct PlayerInfoComponent { @@ -22,6 +22,7 @@ export struct PlayerInfoComponent {
22 } 22 }
23 .cachedCount(2) 23 .cachedCount(2)
24 .indicator(false) 24 .indicator(false)
  25 + .effectMode(EdgeEffect.None)
25 .loop(false) 26 .loop(false)
26 .width('100%') 27 .width('100%')
27 .height('100%') 28 .height('100%')
@@ -4,10 +4,7 @@ import { LoginViewModel } from './LoginViewModel' @@ -4,10 +4,7 @@ import { LoginViewModel } from './LoginViewModel'
4 import router from '@ohos.router' 4 import router from '@ohos.router'
5 import { WDRouterRule, WDRouterPage } from 'wdRouter'; 5 import { WDRouterRule, WDRouterPage } from 'wdRouter';
6 import { SettingPasswordParams } from './SettingPasswordPage' 6 import { SettingPasswordParams } from './SettingPasswordPage'
7 -import { Router } from '@ohos.arkui.UIContext'  
8 -import { CustomToast, EmitterEventId, EmitterUtils, NetworkUtil, SPHelper, StringUtils, ToastUtils } from 'wdKit/Index'  
9 -import { SpConstants } from 'wdConstant/Index'  
10 -import { emitter } from '@kit.BasicServicesKit' 7 +import { CustomToast, NetworkUtil,StringUtils } from 'wdKit/Index'
11 8
12 9
13 const TAG = 'ForgetPasswordPage' 10 const TAG = 'ForgetPasswordPage'
@@ -22,8 +19,9 @@ struct ForgetPasswordPage { @@ -22,8 +19,9 @@ struct ForgetPasswordPage {
22 @State isSubmit: boolean = false //是否可以提交 默认不可以 19 @State isSubmit: boolean = false //是否可以提交 默认不可以
23 loginViewModel: LoginViewModel = new LoginViewModel() 20 loginViewModel: LoginViewModel = new LoginViewModel()
24 @State @Watch('onCodeSend') isCodeSend: boolean = false //验证码点击发送事件 21 @State @Watch('onCodeSend') isCodeSend: boolean = false //验证码点击发送事件
25 - phone:string = (router.getParams() as Record<string, number>)['phone'] + ""; //登录 密码登录 填写手机号 点击忘记密码 带过来手机号 22 + @State params:Record<string, number> = router.getParams() as Record<string, number>;//登录 密码登录 填写手机号 点击忘记密码 带过来手机号
26 @State pageTitle:string = '找回密码'; 23 @State pageTitle:string = '找回密码';
  24 + @State isForgetPassword: number = 0 //是否是登录页忘记密码过来的,标题不一样
27 @State codeStateSuccess:boolean=false 25 @State codeStateSuccess:boolean=false
28 onCodeSend() { 26 onCodeSend() {
29 if (this.isCodeSend) { 27 if (this.isCodeSend) {
@@ -80,9 +78,15 @@ struct ForgetPasswordPage { @@ -80,9 +78,15 @@ struct ForgetPasswordPage {
80 } 78 }
81 79
82 aboutToAppear() { 80 aboutToAppear() {
83 - if(StringUtils.isNotEmpty(this.phone) && this.phone.indexOf("****") === -1){  
84 - this.phoneContent = this.phone 81 + let phone = ""
  82 + if(this.params){
  83 + phone = this.params['phone']+ ""
  84 + this.isForgetPassword = this.params['isForgetPassword']
85 } 85 }
  86 + if(StringUtils.isNotEmpty(phone) && phone.indexOf("****") === -1){
  87 + this.phoneContent = phone
  88 + }
  89 +
86 } 90 }
87 91
88 //发送验证码 92 //发送验证码
@@ -148,7 +152,8 @@ struct ForgetPasswordPage { @@ -148,7 +152,8 @@ struct ForgetPasswordPage {
148 pageID:'1', 152 pageID:'1',
149 phoneContent:this.phoneContent, 153 phoneContent:this.phoneContent,
150 codeContent:this.codeContent, 154 codeContent:this.codeContent,
151 - pageType:1 155 + pageType:1,
  156 + isForgetPassword:this.isForgetPassword
152 } 157 }
153 WDRouterRule.jumpWithPage(WDRouterPage.settingPasswordPage, params) 158 WDRouterRule.jumpWithPage(WDRouterPage.settingPasswordPage, params)
154 }).catch((message: string)=>{ 159 }).catch((message: string)=>{
@@ -162,7 +167,8 @@ struct ForgetPasswordPage { @@ -162,7 +167,8 @@ struct ForgetPasswordPage {
162 pageID:'1', 167 pageID:'1',
163 phoneContent:this.phoneContent, 168 phoneContent:this.phoneContent,
164 codeContent:this.codeContent, 169 codeContent:this.codeContent,
165 - pageType:0 170 + pageType:0,
  171 + isForgetPassword:this.isForgetPassword
166 } 172 }
167 WDRouterRule.jumpWithReplacePage(WDRouterPage.settingPasswordPage, params) 173 WDRouterRule.jumpWithReplacePage(WDRouterPage.settingPasswordPage, params)
168 174
@@ -177,10 +177,11 @@ struct LoginPage { @@ -177,10 +177,11 @@ struct LoginPage {
177 .onClick(() => { 177 .onClick(() => {
178 TrackingButton.click("loginPageForgotPassword",TrackConstants.PageName.Login_Page,TrackConstants.PageName.Login_Page) 178 TrackingButton.click("loginPageForgotPassword",TrackConstants.PageName.Login_Page,TrackConstants.PageName.Login_Page)
179 if(StringUtils.isNotEmpty(this.accountContent) && StringUtils.photoMatch(this.accountContent)){ 179 if(StringUtils.isNotEmpty(this.accountContent) && StringUtils.photoMatch(this.accountContent)){
180 - let pageType = { 'phone': Number(this.accountContent) } as Record<string, number>; 180 + let pageType = { 'phone': Number(this.accountContent),'isForgetPassword':1 } as Record<string, number>;
181 WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType) 181 WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType)
182 }else{ 182 }else{
183 - WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage) 183 + let pageType = {'isForgetPassword':1 } as Record<string, number>;
  184 + WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage,pageType)
184 } 185 }
185 }) 186 })
186 } 187 }
@@ -18,6 +18,7 @@ export interface SettingPasswordParams { @@ -18,6 +18,7 @@ export interface SettingPasswordParams {
18 codeContent?: string; 18 codeContent?: string;
19 tempToken?:string; 19 tempToken?:string;
20 pageType?:number; //0、登录->忘记密码 1、设置->重置密码 20 pageType?:number; //0、登录->忘记密码 1、设置->重置密码
  21 + isForgetPassword?:number
21 } 22 }
22 23
23 export default class AccoutPageDataModel { 24 export default class AccoutPageDataModel {
@@ -107,6 +108,17 @@ export struct SettingPasswordPage { @@ -107,6 +108,17 @@ export struct SettingPasswordPage {
107 let params:SettingPasswordParams = router.getParams() as SettingPasswordParams; 108 let params:SettingPasswordParams = router.getParams() as SettingPasswordParams;
108 this.pageId = parseInt(params.pageID); 109 this.pageId = parseInt(params.pageID);
109 this.getPageListData(this.pageId) 110 this.getPageListData(this.pageId)
  111 + if(params){
  112 + if(params.isForgetPassword === 1){
  113 + this.listData.forEach((item) => {
  114 + if (item.compType === 0) {
  115 + item.compTitle = "重置密码"
  116 + }
  117 + })
  118 + }
  119 + }
  120 +
  121 +
110 122
111 this.phoneContent = params.phoneContent!; 123 this.phoneContent = params.phoneContent!;
112 this.codeContent = params.codeContent!; 124 this.codeContent = params.codeContent!;
@@ -151,8 +163,6 @@ export struct SettingPasswordPage { @@ -151,8 +163,6 @@ export struct SettingPasswordPage {
151 this.getTitleCell(item, HorizontalAlign.Start) 163 this.getTitleCell(item, HorizontalAlign.Start)
152 } else if (item.compType == 1) { 164 } else if (item.compType == 1) {
153 this.getPasswordCell(item) 165 this.getPasswordCell(item)
154 - } else if (item.compType == 2) {  
155 - this.getCodeCell(item)  
156 } else if (item.compType == 3) { 166 } else if (item.compType == 3) {
157 if (index == this.listData.length - 1) { 167 if (index == this.listData.length - 1) {
158 this.getDescCell(item, HorizontalAlign.Center) 168 this.getDescCell(item, HorizontalAlign.Center)
@@ -161,18 +171,12 @@ export struct SettingPasswordPage { @@ -161,18 +171,12 @@ export struct SettingPasswordPage {
161 } 171 }
162 } else if (item.compType == 4) { 172 } else if (item.compType == 4) {
163 this.getButtonCell(item) 173 this.getButtonCell(item)
164 - } else if (item.compType == 5) {  
165 - this.getLogoCell(item)  
166 - } else if (item.compType == 7) {  
167 - this.getPhoneCell(item)  
168 - } else {  
169 - Text('' + item.compType)  
170 } 174 }
171 } 175 }
172 }) 176 })
173 } 177 }
174 }.width('100%') 178 }.width('100%')
175 - .padding('30lpx') 179 + .padding({ left:"31lpx",right:"31lpx",top:"131lpx" })
176 .height('100%') 180 .height('100%')
177 } 181 }
178 182
1 import componentUtils from '@ohos.arkui.componentUtils'; 1 import componentUtils from '@ohos.arkui.componentUtils';
2 -import { WDPlayerController } from '../controller/WDPlayerController'  
3 import { WindowModel } from 'wdKit'; 2 import { WindowModel } from 'wdKit';
4 import { Logger } from '../utils/Logger'; 3 import { Logger } from '../utils/Logger';
5 import { enableAliPlayer } from '../utils/GlobalSetting'; 4 import { enableAliPlayer } from '../utils/GlobalSetting';