王士厅
Showing 17 changed files with 147 additions and 75 deletions
... ... @@ -49,10 +49,5 @@ export enum EmitterEventId {
// 全屏
FULL_SCREEN = 14,
// app页面显示
APP_PAGE_SHOW = 102,
// app页面隐藏
APP_PAGE_HIDDEN = 103,
}
... ...
... ... @@ -33,7 +33,6 @@ export struct WdWebLocalComponent {
@State progressOpacity: number = 1
@State durationStringTime: string = '';
private progressTimerNumber: number = 0
private webIsLoaded:boolean = false
@State isPause: boolean = true;
controller: VideoController = new VideoController()
@StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm';
... ... @@ -41,6 +40,10 @@ export struct WdWebLocalComponent {
@State isFullScreen: boolean = false;
@State isEndPlay: boolean = false;
@State mode: CacheMode = CacheMode.None;
@Consume @Watch('pageShowForUpdateData') pageShow :number
@Consume @Watch('pageHideForUpdateData') pageHide :number
currentChanged(){
///折叠屏转换 暂停播放器
this.controller.pause()
... ... @@ -51,6 +54,22 @@ export struct WdWebLocalComponent {
this.webviewControl.refresh()
}
pageShowForUpdateData(){
Logger.debug(TAG, 'APP_PAGE_SHOW'+this.isPageEnd);
let params = {'event':NativeCallH5Event.NativeCallH5EventPageWillAppear} as eventParams;
let jsonString = JSON.stringify(params);
if (this.isPageEnd) {
this.webviewControl.callHandle(NativeCallH5Type.jsCall_appNotifyEvent, jsonString, (data: string) => {
Logger.debug(TAG, "from js data = " + data);
})
}
}
pageHideForUpdateData(){
}
build() {
Column() {
Row() {
... ... @@ -198,8 +217,8 @@ export struct WdWebLocalComponent {
Logger.debug(TAG, 'onPageEnd');
this.onWebPrepared()
this.isPageEnd = true
this.webIsLoaded = true
}
onLoadIntercept: (url?: string) => boolean = () => {
Logger.debug(TAG, 'onLoadIntercept return false');
return false
... ... @@ -232,20 +251,6 @@ export struct WdWebLocalComponent {
}
}
aboutToAppear(): void {
this.webIsLoaded = false
EmitterUtils.receiveEvent(EmitterEventId.APP_PAGE_SHOW, () => {
let params = {'event':NativeCallH5Event.NativeCallH5EventPageWillAppear} as eventParams;
let jsonString = JSON.stringify(params);
Logger.debug(TAG, 'APP_PAGE_SHOW'+this.webIsLoaded);
// if (this.webIsLoaded) {
// this.webviewControl.callHandle(NativeCallH5Type.jsCall_appNotifyEvent, jsonString, (data: string) => {
// Logger.debug(TAG, "from js data = " + data);
// })
// }
})
}
@Builder
videoComp(){
Video({
... ...
... ... @@ -63,7 +63,7 @@ export struct LiveFollowComponent {
bottom: 0,
})
//号主名称
Text(this.rmhInfo.rmhName)
Text(this.getRmhName())
.fontColor(Color.White)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.maxLines(1)
... ... @@ -151,4 +151,11 @@ export struct LiveFollowComponent {
}
})
}
getRmhName() {
if (this.rmhInfo.rmhName.length > 7) {
return this.rmhInfo.rmhName.substring(0, 7) + "..."
}
return this.rmhInfo.rmhName
}
}
\ No newline at end of file
... ...
... ... @@ -28,11 +28,11 @@ export struct behindDivider {
Divider().strokeWidth(1).color('#f5f5f5').width(CommonConstants.FULL_WIDTH).padding({ left: 10, right: 10 })
} else if (this.compDTO?.operDataList?.[0]?.appStyle === CompStyle.Card_10) {
// 大专题
if (this.nextCompDTO?.operDataList?.[0]?.appStyle === CompStyle.Card_10) {
Divider().strokeWidth(1).color('#f5f5f5').width(CommonConstants.FULL_WIDTH).padding({ left: 10, right: 10 })
} else {
// if (this.nextCompDTO?.operDataList?.[0]?.appStyle === CompStyle.Card_10) {
// Divider().strokeWidth(1).color('#f5f5f5').width(CommonConstants.FULL_WIDTH).padding({ left: 10, right: 10 })
// } else {
Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6})
}
// }
} else if (this.compDTO.compType === 'appStyle'
|| this.compDTO.compStyle === CompStyle.Zh_Single_Row_01
|| this.compDTO.compStyle === CompStyle.Zh_Single_Row_02
... ...
... ... @@ -246,14 +246,10 @@ export struct Card10ComponentTimelineItem {
Stack() {
Image(this.loadImg ? this.slideItem.fullColumnImgUrls[0].url : '')
.backgroundColor(0xf5f5f5)
.backgroundColor(this.loadImg ? '' : 0xf5f5f5)
.width(117)
.height(78)
.objectFit(ImageFit.Contain)
.borderRadius($r('app.float.image_border_radius'))
.borderStyle(BorderStyle.Solid)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
CardMediaInfo({
contentDTO: this.createMediaInfoContent(this.slideItem)
})
... ... @@ -261,6 +257,10 @@ export struct Card10ComponentTimelineItem {
.margin({ left: 12 })
.alignContent(Alignment.BottomEnd)
.height(78)
.borderRadius($r('app.float.image_border_radius'))
.borderStyle(BorderStyle.Solid)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
} else {
Column() {
Stack() {
... ...
... ... @@ -2,7 +2,7 @@ import { CompDTO, ContentDTO } from 'wdBean';
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { hasClicked, persistentStorage } from '../../utils/persistentStorage';
import { DateTimeUtils } from 'wdKit/Index';
import { DateTimeUtils, NumberFormatterUtils } from 'wdKit/Index';
import { LottieView } from '../lottie/LottieView';
import { router } from '@kit.ArkUI';
... ... @@ -155,13 +155,6 @@ export struct LiveBigImage02Component {
}
private computeShowNum(count: number): string {
if (count >= 10000) {
let num = (count / 10000).toFixed(1)
if (Number(num.substring(num.length - 1)) == 0) {
num = num.substring(0, num.length - 2)
}
return num + '万人参加'
}
return `${count}人参加`
return NumberFormatterUtils.formatNumberWithWan(count) + '人参加'
}
}
\ No newline at end of file
... ...
... ... @@ -832,7 +832,7 @@ struct commentFooterView {
if (this.item.id) { // 审核通过的才显示点赞
Row({ space: 6 }) {
Text(this.item.likeNum)
.fontColor($r('app.color.color_666666'))
.fontColor(this.item.api_status?$r('app.color.color_ED2800') : $r('app.color.color_666666'))
.fontSize(14)
Image(this.item.api_status ? $r('app.media.comment_like_select') : $r('app.media.comment_like_normal'))
... ...
import { CompDTO, ContentDTO, LiveRoomDataBean } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { Logger } from 'wdKit/Index';
import { Logger, NumberFormatterUtils } from 'wdKit/Index';
import { ProcessUtils } from 'wdRouter';
import PageViewModel from '../../viewmodel/PageViewModel';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
... ... @@ -98,15 +98,7 @@ export struct ZhGridLayout02NewsContent {
}
private computeShowNum(bean: LiveRoomDataBean): string {
let count = bean.pv
if (count >= 10000) {
let num = (count / 10000).toFixed(1)
if (Number(num.substring(num.length - 1)) == 0) {
num = num.substring(0, num.length - 2)
}
return num + '万人参加'
}
return `${count}人参加`
return NumberFormatterUtils.formatNumberWithWan(bean.pv) + '人参加'
}
}
... ...
... ... @@ -4,6 +4,7 @@ import { HttpUtils } from 'wdNetwork/Index'
import { WDRouterRule, WDRouterPage } from 'wdRouter/Index'
import { TrackConstants, TrackingContent } from 'wdTracking/Index'
import MinePageDatasModel from '../../../model/MinePageDatasModel'
import { SearchShowRed, titleInitRes, textItem } from '../../../utils/searchShowRed'
import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'
import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRequestItem'
... ... @@ -14,6 +15,7 @@ export struct FollowChildComponent{
@State columnHeight:number = 202
@State isLoadingAttention:boolean = false
@State searchText:string = ""
aboutToAppear(): void {
if(this.type == 0 && StringUtils.isEmpty(this.data.introduction)){
... ... @@ -190,7 +192,20 @@ export struct FollowChildComponent{
.margin({right: 11})
Column(){
Text(this.data.cnUserName)
Text(){
if (StringUtils.isNotEmpty(this.searchText) && this.titleInit(this.data.cnUserName, this.searchText).titleMarked) {
ForEach(this.titleInit(this.data.cnUserName, this.searchText).textArr, (textItem: textItem) => {
if (textItem.isRed) {
Span(textItem.content)
.fontColor("#ED2800")
} else {
Span(textItem.content)
}
})
} else {
Span(this.data.cnUserName)
}
}
.fontWeight(400)
.fontSize(18)
.lineHeight(22)
... ... @@ -351,4 +366,21 @@ export struct FollowChildComponent{
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
}
// 正则过滤检索词
createCaseInsensitiveRegex(str: string, pattern: string) {
let regex = new RegExp(pattern, 'gi');
return str.replace(regex, (match) => `<em>${match}</em>`);
}
checkForPattern(str: string, pattern: string) {
let highlightedStr = this.createCaseInsensitiveRegex(str, pattern);
return highlightedStr;
}
titleInit(str: string, pattern: string) {
const title = this.checkForPattern(str, pattern)
const titleInitRes:titleInitRes = SearchShowRed.titleInit(title)
return titleInitRes
}
}
\ No newline at end of file
... ...
... ... @@ -159,7 +159,7 @@ export struct ChildCommentComponent {
.width('100%')
.height(0.5)
.strokeWidth(0.5)
.backgroundColor($r('app.color.color_EDEDED'))
.color($r('app.color.color_EDEDED'))
.margin({ top: 10, bottom: 10 })
}
... ...
... ... @@ -78,7 +78,9 @@ struct PeopleShipHomePage {
///1-this.topOpacity 联动上滑
.height(this.topOpacity>1?0:120*(1-this.topOpacity))
.objectFit(ImageFit.Cover)
}
Stack({ alignContent: Alignment.Top }){
Row()
.height(px2vp(this.topSafeHeight))
.width("100%")
... ...
import measure from '@ohos.measure'
import { DisplayUtils } from 'wdKit'
import { DisplayUtils, NumberFormatterUtils } from 'wdKit'
import { PeopleShipHomePageHeadComponent } from './PeopleShipHomePageHeadComponent'
import { PeopleShipHomePageAttestationComponent } from './PeopleShipHomePageAttestationComponent'
import { Logger } from 'wdKit'
... ... @@ -66,7 +66,7 @@ export struct PeopleShipHomePageTopComponent {
.layoutWeight(1)
.margin({
left: '12vp',
bottom: '10vp',
bottom: '20vp',
right: '12vp'
})
}
... ... @@ -366,14 +366,7 @@ export struct PeopleShipHomePageTopComponent {
}
private computeShowNum(count: number) {
if (count >= 10000) {
let num = ( count / 10000).toFixed(1)
if (Number(num.substring(num.length-1)) == 0) {
num = num.substring(0, num.length-2)
}
return num + '万'
}
return `${count}`
return NumberFormatterUtils.formatNumberWithWan(count)
}
// 通过省份code获取IP问题
... ...
import { ToastUtils } from 'wdKit/Index'
import { StringUtils, ToastUtils } from 'wdKit/Index'
import { WDRouterRule, WDRouterPage, ProcessUtils } from 'wdRouter/Index'
import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed'
import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
@Component
export struct SearchCreatorComponent{
@ObjectLink item: SearchRmhDescription
userName: string = ''
@State searchText:string = ""
aboutToAppear(): void {
const userNetName: string = this.item.creatorName;
... ... @@ -23,19 +25,35 @@ export struct SearchCreatorComponent{
.alt($r('app.media.icon_default_head_mater'))
.height('92lpx')
.margin({bottom:'15lpx'})
.borderWidth(1)
.borderColor('#EDEDED')
.borderRadius(50)
Row(){
Image(this.item.authIcon)
.width('32lpx')
.height('32lpx')
.objectFit(ImageFit.Cover)
.margin({bottom:5})
}.width('92lpx')
.justifyContent(FlexAlign.End)
}.width('92lpx')
.height('92lpx')
.margin({bottom:'15lpx'})
Text(this.userName)
Text(){
if (StringUtils.isNotEmpty(this.searchText) && this.titleInit(this.userName, this.searchText).titleMarked) {
ForEach(this.titleInit(this.userName, this.searchText).textArr, (textItem: textItem) => {
if (textItem.isRed) {
Span(textItem.content)
.fontColor("#ED2800")
} else {
Span(textItem.content)
}
})
} else {
Span(this.userName)
}
}
.fontSize('25lpx')
.fontWeight('400lpx')
.lineHeight('35lpx')
... ... @@ -59,4 +77,21 @@ export struct SearchCreatorComponent{
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
}
// 正则过滤检索词
createCaseInsensitiveRegex(str: string, pattern: string) {
let regex = new RegExp(pattern, 'gi');
return str.replace(regex, (match) => `<em>${match}</em>`);
}
checkForPattern(str: string, pattern: string) {
let highlightedStr = this.createCaseInsensitiveRegex(str, pattern);
return highlightedStr;
}
titleInit(str: string, pattern: string) {
const title = this.checkForPattern(str, pattern)
const titleInitRes:titleInitRes = SearchShowRed.titleInit(title)
return titleInitRes
}
}
\ No newline at end of file
... ...
... ... @@ -282,7 +282,7 @@ export struct SearchResultContentComponent {
if (this.data_rmh != null && this.data_rmh.length > 0) {
if (this.data_rmh.length === 1) {
ListItem() {
FollowChildComponent({ data: this.bean, type: 1 })
FollowChildComponent({ data: this.bean, type: 1 ,searchText: decodeURI(this.keywords)})
}.padding({ left: "31lpx", right: "31lpx" })
} else {
ListItem() {
... ... @@ -356,7 +356,7 @@ export struct SearchResultContentComponent {
ListItemGroup() {
ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
ListItem() {
SearchCreatorComponent({ item: item })
SearchCreatorComponent({ item: item ,searchText: decodeURI(this.keywords)})
}
.width('150lpx')
.height('100%')
... ...
... ... @@ -106,14 +106,14 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
.aspectRatio(1.5)
.width(this.compDTO.operDataList.length == 2 ? 210 : 150)
.objectFit(ImageFit.Contain)
.borderRadius(4)
.border({width: 0.5, color: 0xf5f5f5})
CardMediaInfo({
livePeopleNum:false,
contentDTO: item
})
}
.align(Alignment.BottomEnd)
.borderRadius(4)
.border({width: 1, color: 0xf5f5f5})
Text(item.newsTitle)
.fontSize($r("app.float.font_size_14"))
... ... @@ -127,13 +127,12 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
.lineHeight(19)
}
.height(this.compDTO.operDataList.length == 2 ? 190 : 148)
.padding({ right: 16 })
.padding({ right: this.compDTO.operDataList.length >= 3 ? 8 : 12, left: index == 0 ? 20: 0 })
// .offset({x:16})
.onClick(() => {
InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)
ProcessUtils.processPage(item)
})
.padding({ right: 16, left: index == 0 ? 20: 0 })
})
}
... ...
import font from '@ohos.font'
import { ContentDetailDTO } from 'wdBean/Index'
import { DateTimeUtils, StringUtils, ToastUtils } from 'wdKit/Index'
import { CustomToast, DateTimeUtils, StringUtils, ToastUtils } from 'wdKit/Index'
import { LiveViewModel } from '../../viewModel/LiveViewModel'
import { HttpUtils } from 'wdNetwork/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
... ... @@ -22,6 +22,24 @@ export struct LiveCountdownComponent {
liveViewModel: LiveViewModel = new LiveViewModel()
pageParam: ParamType = {}
@State toastText: ResourceStr = ""
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
bgColor: 0xB3000000,
opacityValue: 1,
msg: this.toastText,
}),
autoCancel: false,
alignment: DialogAlignment.Center,
customStyle: true,
maskColor: "#00000000"
})
showToastTip(msg: ResourceStr) {
this.toastText = msg
this.dialogToast.open()
}
aboutToAppear(): void {
//注册字体
font.registerFont({
... ... @@ -187,11 +205,13 @@ export struct LiveCountdownComponent {
if (data.success) {
this.isAppointmentLive = !this.isAppointmentLive
if (this.isAppointmentLive) {
ToastUtils.showToast('预约成功', 1000)
// ToastUtils.showToast('预约成功', 1000)
this.showToastTip('预约成功')
TrackingContent.subscribeClick(true, TrackConstants.PageName.Live_Detail,
TrackConstants.PageName.Live_Detail, this.pageParam)
} else {
ToastUtils.showToast('取消预约成功', 1000)
// ToastUtils.showToast('取消预约成功', 1000)
this.showToastTip('取消预约成功')
TrackingContent.subscribeClick(false, TrackConstants.PageName.Live_Detail,
TrackConstants.PageName.Live_Detail, this.pageParam)
}
... ...
... ... @@ -47,7 +47,6 @@ struct ImageAndTextDetailPage {
onPageShow() {
this.pageShow = Math.random()
EmitterUtils.sendEmptyEvent(EmitterEventId.APP_PAGE_SHOW)
Logger.info(TAG, 'onPageShow');
}
... ...