zhenghy

Merge remote-tracking branch 'origin/main'

... ... @@ -245,7 +245,6 @@ export class HttpUrlUtils {
* pageSize=20&pageNum=1&topicId=10000009445
* */
static readonly MORNING_EVENING_PAGE_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/pageInfo";
static readonly MORNING_EVENING_COMP_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo";
/**
* 直播回顾
* */
... ...
... ... @@ -48,7 +48,7 @@ export struct WdWebLocalComponent {
Row() {
RelativeContainer() {
Web({ src: this.webResource, controller: this.webviewControl })
Web({ src: this.webResource, controller: this.webviewControl, renderMode: RenderMode.SYNC_RENDER })
.domStorageAccess(true)
.databaseAccess(true)
.javaScriptAccess(true)
... ... @@ -56,7 +56,9 @@ export struct WdWebLocalComponent {
.mixedMode(MixedMode.All)
.onlineImageAccess(true)
.enableNativeEmbedMode(true)
.height(this.webHeight)
.layoutMode(WebLayoutMode.FIT_CONTENT)
.nestedScroll({ scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.PARENT_FIRST })
// .height(this.webHeight)
.onPageBegin((event) => {
this.onPageBegin(event?.url);
})
... ...
import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper, NumberFormatterUtils, DisplayUtils } from 'wdKit';
import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper, NumberFormatterUtils, DisplayUtils,
NetworkUtil } from 'wdKit';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { ContentDetailDTO,postBatchAttentionStatusParams,
PhotoListBean,
... ... @@ -27,6 +28,8 @@ import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo'
import router from '@ohos.router';
import { publishCommentModel } from './comment/model/PublishCommentModel';
import { CommentComponent } from './comment/view/CommentComponent';
import { EmptyComponent } from './view/EmptyComponent';
import { detailedSkeleton } from './skeleton/detailSkeleton';
const TAG = 'DynamicDetailComponent'
const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
... ... @@ -55,6 +58,8 @@ export struct DynamicDetailComponent {
private mJumpInfo: ContentDTO = {} as ContentDTO;
@State publishTime: string = ''
@State isNetConnected: boolean = true
@State isPageEnd: boolean = false
async aboutToAppear() {
... ... @@ -89,6 +94,18 @@ export struct DynamicDetailComponent {
.height($r('app.float.margin_7'))
.padding({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} )
Stack({ alignContent: Alignment.Bottom }) {
if (!this.isNetConnected) {
EmptyComponent({
emptyType: 1,
emptyButton: true,
retry: () => {
this.getContentDetailData()
}
}).padding({ bottom: 200 })
} else {
if (!this.isPageEnd) {
detailedSkeleton()
}else{
Scroll(this.scroller) {
Column() {
//号主信息
... ... @@ -411,6 +428,8 @@ export struct DynamicDetailComponent {
.padding({ bottom: 76 })
.scrollBar(BarState.Off)
.alignSelf(ItemAlign.Start)
}
}
//底部交互区
OperRowListView({ contentDetailData: this.contentDetailData
,interactData:this.interactDataDTO
... ... @@ -436,8 +455,10 @@ export struct DynamicDetailComponent {
* 请求(动态)详情页数据
* */
private async getContentDetailData() {
this.isNetConnected = NetworkUtil.isNetConnected()
try {
let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType)
this.isPageEnd = true;
this.contentDetailData = data[0];
let dateTime =
DateTimeUtils.parseDate(this.contentDetailData?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
... ... @@ -446,6 +467,7 @@ export struct DynamicDetailComponent {
console.log('动态详情',JSON.stringify(this.contentDetailData))
} catch (exception) {
console.log('请求失败',JSON.stringify(exception))
this.isPageEnd = true;
}
this.getBatchAttentionStatus()
this.getInteractDataStatus()
... ...
... ... @@ -87,6 +87,7 @@ export struct ImageAndTextPageComponent {
action: this.action,
isPageEnd: $isPageEnd
})
.padding({bottom:10})
Column() {
// 点赞
if (this.contentDetailData[0]?.openLikes) {
... ... @@ -114,8 +115,8 @@ export struct ImageAndTextPageComponent {
.fontWeight(500)
}
}
.width(140)
.height(36)
.width(154)
.height(40)
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.borderRadius(20)
... ... @@ -127,7 +128,8 @@ export struct ImageAndTextPageComponent {
this.toggleLikeStatus()
})
}.width(CommonConstants.FULL_WIDTH).height(80)
}.width(CommonConstants.FULL_WIDTH)
.padding({top:14,bottom:24})
.justifyContent(FlexAlign.Center)
}
if (this.recommendList.length > 0) {
... ...
... ... @@ -13,12 +13,9 @@ import { image } from '@kit.ImageKit';
import { getPicture, imageNet2PixelMap } from '../../utils/ImageUtils';
import { effectKit } from '@kit.ArkGraphics2D';
import { window } from '@kit.ArkUI';
import DailyPaperTopicModel from '../../model/DailyPaperTopicModel'
const TAG = 'MorningEveningPaperComponent';
const PATTERN_DATE_CN_RN: string = 'yyyy年\nMM月dd日'; // 日期中包含包含中文年月日
@Entry
@Component
export struct MorningEveningPaperComponent {
... ... @@ -106,17 +103,12 @@ export struct MorningEveningPaperComponent {
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
this.topSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height)
let dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String
const dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String
console.info(TAG, `aboutToAppear = ` + dailyPaperTopicPageId)
const currentTime = new Date().getTime()
Logger.info(TAG, "currentTime = " + currentTime)
Logger.info(TAG, `currentTime = ${currentTime}`)
try {
let dailyPaperTopicBean = await DailyPaperTopicModel.getDailyPaperTopic()
if (dailyPaperTopicBean) {
dailyPaperTopicPageId = '' + dailyPaperTopicBean.id
Logger.info(TAG, "pageID = " + dailyPaperTopicPageId)
}
// let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + this.dailyPaperTopicPageId)
let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + dailyPaperTopicPageId) //"25091"
... ... @@ -157,7 +149,10 @@ export struct MorningEveningPaperComponent {
async setComponentBgColor(imageUrl: string) {
// 图片转换为PixelMap对象
// const pixelMap: image.PixelMap = await image2PixelMap(item.icon);
const imageSource: image.ImageSource | undefined = await getPicture(imageUrl);
Logger.debug(TAG, "compInfoBean compStyle = " + imageUrl)
const imageSource: image.ImageSource | undefined = await getPicture(imageUrl)
if (imageSource) {
this.pickColor(imageSource)
... ... @@ -172,6 +167,8 @@ export struct MorningEveningPaperComponent {
const pixelMap: image.PixelMap = await imageNet2PixelMap(imageSource);
effectKit.createColorPicker(pixelMap, (err, colorPicker) => {
let color = colorPicker.getMainColorSync();
Logger.debug(TAG, "compInfoBean compStyle = " + color)
// 将取色器选取的color示例转换为十六进制颜色代码
this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16);
Logger.debug(TAG, "compInfoBean compStyle = " + this.mixedBgColor)
... ... @@ -212,7 +209,7 @@ export struct MorningEveningPaperComponent {
})
}
}
// .backgroundColor('#FFF1F3F5')
// .backgroundColor('#fff7b348')
// .backgroundColor(Color.Blue)
.height('100%')
... ...
... ... @@ -38,6 +38,7 @@ export struct Card5Component {
]
})
Row() {
if (this.titleShowPolicy === 1) {
Text(this.contentDTO.newsTitle)
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
... ... @@ -47,6 +48,8 @@ export struct Card5Component {
.maxLines(2)
.align(Alignment.Bottom)
}
}
.justifyContent(FlexAlign.Start)
.height(40)
.margin({ left: 12, bottom: 10, right: 12 })
... ...
... ... @@ -200,7 +200,7 @@ export class PageRepository {
* topicId:专题id
* */
static getMorningEveningCompInfoUrl(pageId: number, groupId: number, refreshTime: string, topicId: string, pageNum: number, pageSize: number) {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_COMP_INFO_PATH;
let url = HttpUrlUtils.getHost() + HttpUrlUtils.COMP_PATH;
url = url + "?loadStrategy=first_load&pageNum=" + pageNum + "&refreshTime=" + refreshTime + "&pageId="
+ pageId + "&channelStrategy=2&groupId=" + groupId + "&topicId=" + topicId + "&pageSize=" + pageSize;
Logger.info(TAG, "getMorningEveningCompInfoUrl url = " + url)
... ... @@ -391,7 +391,7 @@ export class PageRepository {
* */
static fetchBroadcastCompInfo(pageId: number, groupId: number, refreshTime: string, topicId:
string, channelId: string) {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_COMP_INFO_PATH;
let url = HttpUrlUtils.getHost() + HttpUrlUtils.COMP_PATH;
url = `${url}?topicId=${topicId}&channelStrategy=2&groupId=${groupId}&refreshTime=${refreshTime}&pageSize=50&recommend=0&pageId=${pageId}&loadStrategy=first_load&pageNum=1&channelId=${channelId}`
Logger.info(TAG, "getMorningEveningCompInfoUrl url = " + url)
return WDHttp.get<ResponseDTO<CompInfoBean>>(url)
... ...
... ... @@ -90,7 +90,7 @@ export async function image2PixelMap(icon: string): Promise<image.PixelMap> {
// 假设http和image是之前正确导入或定义的模块
export async function getPicture(imageUrl: string): Promise<image.ImageSource | undefined> {
// const url: string = 'https://rmrbcmsonline.peopleapp.com/upload/image/202312/rmrb_86691703594454.png';
const url: string = 'https://rmrbcmsonline.peopleapp.com/upload/image/201912/rmrb_24141576767688.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg';
const url: string = imageUrl;
return new Promise((resolve, reject) => {
http.createHttp().request(url, (error: BusinessError, data: http.HttpResponse) => {
... ...
... ... @@ -2,6 +2,7 @@ import { LiveDetailsBean } from 'wdBean/Index';
import { StringUtils } from 'wdKit/Index';
import { WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index';
import { PlayUIComponent } from './PlayUIComponent';
import { Logger } from 'wdKit/Index';
@Component
export struct TopPlayComponent {
... ... @@ -39,6 +40,7 @@ export struct TopPlayComponent {
}
// this.playerController?.firstPlay('https://rmrbcmsonline.peopleapp.com/upload/rmh/video/mp4/202404/1713752415708fb81d0b8f137b.mp4');
if (StringUtils.isNotEmpty(playUrl)) {
Logger.debug('TopPlayComponent', `${playUrl}`)
this.playerController?.firstPlay(playUrl);
}
}
... ...