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