张善主

Merge remote-tracking branch 'origin/main'

... ... @@ -86,7 +86,7 @@ export struct MorningEveningPaperComponent {
offset: { dx: 12, dy: -150 },
})
// private AudioSuspension = new AudioSuspensionModel()
private AudioSuspension = new AudioSuspensionModel()
onCancel() {
Logger.info(TAG, "cj2024 onCancel = ")
... ... @@ -149,19 +149,22 @@ export struct MorningEveningPaperComponent {
Logger.info(TAG, "pageInfoBean dateTime = " + dateTime)
Logger.info(TAG, "pageInfoBean subTitle = " + this.subTitle)
Logger.info(TAG, "this.pageInfoBean = " + JSON.stringify(this.pageInfoBean))
this.isHasTopView = this.pageInfoBean?.topicInfo?.frontLinkObject?true:false
let coverUrl = this.isHasTopView?this.pageInfoBean?.topicInfo?.frontLinkObject?.coverUrl as string :''
this.setComponentBgColor(coverUrl)
let compInfoBean = await MorningEveningViewModel.getMorningEveningCompInfo(pageInfoBean?.id, pageInfoBean?.groups[0]?.id, currentTime + "", pageInfoBean?.topicInfo?.topicId)
// this.compInfoBean = compInfoBean
Logger.info(TAG, "compInfoBean = " + JSON.stringify(compInfoBean))
if (compInfoBean?.compList[0]) {
this.compListItem = compInfoBean?.compList[0]
Logger.debug(TAG, '获取评论数据' + `${this.compListItem.operDataList.length}`)
if (this.compListItem.operDataList && this.compListItem.operDataList.length > 0) {
this.getAllContentInteractData(this.compListItem.operDataList)
}
Logger.debug('compInfoBean?.compList[0].audioDataList', JSON.stringify(compInfoBean?.compList[0].audioDataList))
Logger.debug(TAG, 'compInfoBean?.compList[0].audioDataList', JSON.stringify(compInfoBean?.compList[0].audioDataList))
if (compInfoBean?.compList[0].audioDataList) {
this.audioPlayUrl = compInfoBean?.compList[0].audioDataList[0].audioUrl
this.audioTitle = compInfoBean?.compList[0].audioDataList[0].title
... ... @@ -258,12 +261,11 @@ export struct MorningEveningPaperComponent {
topicInfoView({ frontLinkObject: this.pageInfoBean?.topicInfo?.frontLinkObject })
}
//暂时不展示音频播报
// if (this.audioPlayUrl.length > 0){
// ListItem() {
// this.AudioBarView(this.simpleAudioDialog)
// }
// }
if (this.audioPlayUrl !== ""){
ListItem() {
this.AudioBarView()
}
}
}
ListItem() {
... ... @@ -307,7 +309,7 @@ export struct MorningEveningPaperComponent {
}
@Builder
AudioBarView(dialog: CustomDialogController) {
AudioBarView() {
Row() {
Stack({ alignContent: Alignment.Start }) {
Image($r('app.media.listen_left_bg'))
... ... @@ -320,7 +322,7 @@ export struct MorningEveningPaperComponent {
.margin({ left: 10 })
.alignSelf(ItemAlign.Start)
Text('晚上好, 请收听今日新闻播报')
Text(`${this.pageInfoBean.topicInfo.topicPattern === 1 ? '早上好' : this.pageInfoBean.topicInfo.topicPattern === 2 ? '中午好' : '晚上好'}, 请收听今日新闻播报`)
.fontSize(14)
.margin({ left: 50 })
.fontColor(Color.Black)
... ... @@ -345,7 +347,7 @@ export struct MorningEveningPaperComponent {
Logger.info("TAG", "cj compInfoBean onClick1 = " + this.isAudioPlaying)
// dialog.open()
// this.playerController.firstPlay(this.audioPlayUrl, this.audioTitle)
// this.AudioSuspension.setPlayerUrl(this.audioPlayUrl, this.audioTitle)
this.AudioSuspension.setPlayerUrl(this.audioPlayUrl, this.audioTitle)
Logger.info(TAG, "this.audioPlayUrl = " + this.audioPlayUrl)
Logger.info("TAG", "cj compInfoBean onClick2 = " + this.isAudioPlaying)
})
... ...
... ... @@ -221,6 +221,8 @@ export class PageHelper {
// let pageDto = page
let index = pageInfo.groups.indexOf(group)
Logger.debug(TAG, 'yyyy parseGroup print')
this.printComp(pageDto)
// 解析楼层组件
this.analysisPageGroupCompData(pageDto, pageInfo)
... ... @@ -293,7 +295,8 @@ export class PageHelper {
if (pageDto.compAdList != null) {
pageInfo.pageAdList.push(...pageDto.compAdList)
}
// TODO 待删除
Logger.debug(TAG, 'yyyy analysisPageGroupCompData size, '+pageInfo?.oneRequestPageGroupCompList?.length)
}
}
... ... @@ -340,6 +343,8 @@ export class PageHelper {
pageModel.currentPage++;
pageModel.hasMore = true;
Logger.debug(TAG, 'yyyy compLoadMore print')
this.printComp(data)
//移除音频 和 活动
this.loadMorePageComp(pageModel, data)
// 参与批查
... ... @@ -366,6 +371,8 @@ export class PageHelper {
pageCompList.forEach((comp: CompDTO) => {
pageModel.pageInfo.oneRequestPageGroupCompList.add(comp)
})
// TODO 待删除
Logger.debug(TAG, 'yyyy loadMorePageComp size, ' + pageModel.pageInfo.oneRequestPageGroupCompList?.length)
// 记录
pageModel.pageTotalCompSize = pageCompList.length + pageModel.pageTotalCompSize
... ... @@ -843,6 +850,31 @@ export class PageHelper {
// 从第二页开始删
pageModel.compList.deleteItems(pageModel.firstPageEndIndex + 1)
}
/**
* 临时打印comp相关信息,用于问题定位。TODO 待删除
*/
private printComp(pageDto: PageDTO) {
Logger.debug(TAG, 'yyyy printComp pageDto.compList.size: ' + pageDto?.compList?.length)
new Promise<void>(() => {
let tmpCompList: CompDTO[] = Array.from(pageDto.compList)
tmpCompList.forEach((v, k) => {
if (v && v.operDataList) {
Logger.warn(TAG, 'yyyy printComp comp forEach, ' + v.compStyle)
v.operDataList.forEach((cv, ci) => {
if (cv) {
Logger.debug(TAG, 'yyyy printComp ContentDTO print, ' + v.compStyle)
Logger.debug(TAG, 'yyyy printComp ContentDTO xxxx newsTitle, ' + cv.newsTitle)
} else {
Logger.warn(TAG, 'yyyy printComp ContentDTO is null, ' + v.compStyle)
}
})
} else {
Logger.warn(TAG, 'yyyy printComp comp is null or operDataList is empty, ' + v?.compStyle)
}
})
})
}
}
... ...
import { CommonConstants } from 'wdConstant';
import { Logger } from 'wdKit';
const TAG = 'EmptyComponent';
/**
* WDViewDefaultType 缺省页 无网络
*/
export const enum WDViewDefaultType {
/// 0.默认
WDViewDefaultType_Default,
/// 1.无网
WDViewDefaultType_NoNetwork,
}
/**
* 空数据/无数据
*/
@Preview
@Component
export struct EmptyComponent {
@State emptyWidth: string | number = CommonConstants.FULL_PARENT;
@State emptyHeight: string | number = CommonConstants.FULL_PARENT;
@State emptyType: number = WDViewDefaultType.WDViewDefaultType_NoNetwork; // 缺省图类型,传枚举
@State emptyButton: boolean = false
@State timeNum: number = 10
/**
* The empty image width percentage setting.
*/
readonly EMPTY_IMAGE_WIDTH: string = '15%';
/**
* The empty image height percentage setting.
*/
readonly EMPTY_IMAGE_HEIGHT: string = '15%';
/**
* The empty data text component margin top.
*/
readonly EMPTY_TIP_TEXT_MARGIN_TOP: string = '10';
/**
* The empty data text opacity.
*/
readonly TEXT_OPACITY: number = 0.4;
private timer: number = -1
retry: () => void = () => {
}
build() {
this.noProgrammeData();
}
/**
* 无数据,空白view组件
*/
@Builder
noProgrammeData() {
Column() {
Image(this.buildNoDataTipImage())
.width(160)
.height(112)
.objectFit(ImageFit.Contain)
Text(this.emptyType !== 8 ? this.buildNoDataTip() : `${this.buildNoDataTip()}(${this.timeNum}s)`)
.fontSize($r('app.float.font_size_14'))// .fontColor('#FF999999')
.fontWeight(FontWeight.Normal)
.opacity(this.TEXT_OPACITY)
.margin({ top: this.EMPTY_TIP_TEXT_MARGIN_TOP })
.onClick((event: ClickEvent) => {
Logger.info(TAG, `noProgrammeData onClick event?.source: ${event.source}`);
})
if (this.isShowButton()) {
if (this.emptyType !== 15) {
Button('点击重试')
.type(ButtonType.Normal)
.width(80)
.height(28)
.backgroundColor('#fffffff')
.fontColor('#FF666666')
.border({ width: 1 })
.borderColor('#FFEDEDED')
.borderRadius(4)
.fontSize($r('app.float.font_size_12'))
.margin({ top: 16 })
.padding(0)
.onClick(() => {
this.retry()
})
} else {
Button('点击重试')
.type(ButtonType.Normal)
.width(80)
.height(28)
.backgroundColor(Color.Black)
.fontColor('#FFCCCCCC')
.border({ width: 1 })
.borderColor('#4DFFFFFF')
.borderRadius(4)
.fontSize($r('app.float.font_size_12'))
.margin({ top: 16 })
.padding(0)
.onClick(() => {
this.retry()
})
}
}
}
.justifyContent(FlexAlign.Center)
.width(this.emptyWidth)
.height(this.emptyHeight)
}
buildNoDataTip(): string {
Logger.info(TAG, "buildNoDataTip");
let contentString: string = '暂无内容'
if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) {
contentString = '网络出小差了,请检查网络后重试'
}
return contentString
}
buildNoDataTipImage(): Resource | string {
Logger.info(TAG, "buildNoDataTip");
let imageString: Resource | string = ""
if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) {
imageString = $r('app.media.icon_no_net1')
}
return imageString
}
isShowButton() {
if (this.emptyType === 1 || this.emptyType === 9 || this.emptyType === 15) {
return true
} else {
return false
}
}
}
... ...
import router from '@ohos.router';
import webview from '@ohos.web.webview';
import { SpConstants } from 'wdConstant/Index';
import { Logger, SPHelper } from 'wdKit';
import { Logger, NetworkUtil, SPHelper } from 'wdKit';
import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/src/main/ets/bean/content/Params';
import { EmptyComponent } from './EmptyComponent';
const TAG = 'LoginProtocolWebview';
... ... @@ -12,7 +13,7 @@ const TAG = 'LoginProtocolWebview';
struct LoginProtocolWebview {
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
webUrl: string = ''
@State webUrl: string = ''
webviewController: webview.WebviewController = new webview.WebviewController()
userProtocol = "https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1005.html"
privateProtocol = 'https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1001.html'
... ... @@ -22,6 +23,7 @@ struct LoginProtocolWebview {
collectionProtocol = 'https://cdnpeoplefront.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1002.html'//收集个人信息明示清单
thirdVendorProtocol = 'https://cdnpeoplefront.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1004.html'//第三方信息共享清单
@State contentID:string = "0"
@State isConnectNetwork : boolean = NetworkUtil.isNetConnected()
async aboutToAppear() {
if (router.getParams()) {
... ... @@ -33,24 +35,17 @@ struct LoginProtocolWebview {
if (params.contentID == "1") { //"人民日报客户端网络服务使用协议"
this.webUrl = this.userProtocol
this.webUrl = await SPHelper.default.get(SpConstants.NET_SERVICE_PROTOCOL, this.userProtocol) as string
this.webviewController.loadUrl(this.webUrl)
} else if(params.contentID == "2"){ //"人民日报客户端用户隐私协议"
this.webUrl = this.privateProtocol
this.webUrl = await SPHelper.default.get(SpConstants.PRIVATE_PROTOCOL, this.privateProtocol) as string
this.webviewController.loadUrl(this.webUrl)
}else if(params.contentID == "3"){ //注销协议
this.webUrl = await SPHelper.default.get(SpConstants.LOGOUT_PROTOCOL, this.logoutProtocol) as string
this.webviewController.loadUrl(this.webUrl)
} else if(params.contentID == "4"){ //华为用户认证协议
this.webUrl = this.huaweiAuthProtocol
this.webviewController.loadUrl(this.webUrl)
} else if(params.contentID == "5"){ //收集个人信息明示清单
this.webUrl = this.collectionProtocol
this.webviewController.loadUrl(this.webUrl)
} else if(params.contentID == "6"){ //第三方信息共享清单
this.webUrl = this.thirdVendorProtocol
this.webviewController.loadUrl(this.webUrl)
}
}
... ... @@ -75,7 +70,7 @@ struct LoginProtocolWebview {
.alignItems(VerticalAlign.Center)
.width('100%')
.height(44)
if(this.isConnectNetwork){
Web({ src: this.webUrl, controller: this.webviewController })
.domStorageAccess(true)
.databaseAccess(true)
... ... @@ -89,6 +84,13 @@ struct LoginProtocolWebview {
Logger.info(TAG, 'onHttpErrorReceive event.response.getResponseCode:' + event?.response.getResponseCode());
})
.padding({bottom:this.contentID === "2" ? "40lpx" : 0 })
}else{
EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => {
this.isConnectNetwork = NetworkUtil.isNetConnected()
}})
.layoutWeight(1)
.width('100%')
}
}
}.width("100%")
.height("100%")
... ...