陈剑华

Merge remote-tracking branch 'origin/main'

... ... @@ -20,14 +20,27 @@
"name": "default",
"type": "HarmonyOS",
"material": {
"storePassword": "0000001EF28F8A628911F4F52B75E452C814EE4370854DD8DFCE186496B6AD88F8DE5AD3E10F24C1079F2EDD1FFF",
"certpath": "./singing_config/manual_com.peopledailychina.hosactivity_sign/鸿蒙中文版客户端证书.cer",
"storePassword": "0000001E857CAD6D7E7172B6C87426344CEF8CC3281AB0461B4FA467DA64A1E11BD35929D150343E5D8E1EEE2740",
"keyAlias": "peopledailyhosalias",
"keyPassword": "0000001E2E8A50EFF2E6D2023242B432388B2748F8299D8BB319C0B06CFF7DCEA7482C5E3CDF1398CCE095BDC68B",
"keyPassword": "0000001E383EA87F51D8B158D5D1FC9ACC10179A0C93E81FD01B2E24D5B449EF1E50789BCEBC4FA09E3E5445C12A",
"profile": "./singing_config/manual_com.peopledailychina.hosactivity_sign/peopledaiychina-hos-profile-debugDebug.p7b",
"signAlg": "SHA256withECDSA",
"storeFile": "./singing_config/manual_com.peopledailychina.hosactivity_sign/keystorefile.p12"
}
},
{
"name": "release",
"type": "HarmonyOS",
"material": {
"storePassword": "0000001E423C7B1ED6AA1EC296F8E9D84C03F7D2E2BD770655E9EABA798E457E15B4D993CCA36416B0200E92DED7",
"certpath": "./singing_config/manual_com.peopledailychina.hosactivity_sign/鸿蒙中文版客户端证书正式.cer",
"keyAlias": "peopledailyhosalias",
"keyPassword": "0000001E9C2E794B52FC032F4C6ED037D72ADAAC76F3F0F001342A7D79ABE3A45E01FA86911A0510DB2B532847E2",
"profile": "./singing_config/manual_com.peopledailychina.hosactivity_sign/peopledailychina-hos-profile-releaseRelease.p7b",
"signAlg": "SHA256withECDSA",
"storeFile": "./singing_config/manual_com.peopledailychina.hosactivity_sign/keystorefile.p12"
}
}
],
"products": [
... ... @@ -37,6 +50,13 @@
"compileSdkVersion": "5.0.0(12)",
"compatibleSdkVersion": "5.0.0(12)",
"runtimeOS": "HarmonyOS",
},
{
"name": "productRELEASE",
"signingConfig": "release",
"compileSdkVersion": "5.0.0(12)",
"compatibleSdkVersion": "5.0.0(12)",
"runtimeOS": "HarmonyOS",
}
],
"buildModeSet": [
... ... @@ -56,7 +76,8 @@
{
"name": "default",
"applyToProducts": [
"default"
"default",
"productRELEASE"
]
}
]
... ... @@ -68,7 +89,8 @@
{
"name": "default",
"applyToProducts": [
"default"
"default",
"productRELEASE"
]
}
]
... ... @@ -80,7 +102,8 @@
{
"name": "default",
"applyToProducts": [
"default"
"default",
"productRELEASE"
]
}
]
... ... @@ -92,7 +115,8 @@
{
"name": "default",
"applyToProducts": [
"default"
"default",
"productRELEASE"
]
}
]
... ... @@ -104,7 +128,8 @@
{
"name": "default",
"applyToProducts": [
"default"
"default",
"productRELEASE"
]
}
]
... ... @@ -116,7 +141,8 @@
{
"name": "default",
"applyToProducts": [
"default"
"default",
"productRELEASE"
]
}
]
... ... @@ -128,7 +154,8 @@
{
"name": "default",
"applyToProducts": [
"default"
"default",
"productRELEASE"
]
}
]
... ... @@ -144,7 +171,8 @@
{
"name": "default",
"applyToProducts": [
"default"
"default",
"productRELEASE"
]
}
]
... ... @@ -168,7 +196,8 @@
{
"name": "default",
"applyToProducts": [
"default"
"default",
"productRELEASE"
]
}
]
... ... @@ -180,7 +209,8 @@
{
"name": "default",
"applyToProducts": [
"default"
"default",
"productRELEASE"
]
}
]
... ... @@ -192,7 +222,8 @@
{
"name": "default",
"applyToProducts": [
"default"
"default",
"productRELEASE"
]
}
]
... ... @@ -204,7 +235,8 @@
{
"name": "default",
"applyToProducts": [
"default"
"default",
"productRELEASE"
]
}
]
... ... @@ -216,7 +248,8 @@
{
"name": "default",
"applyToProducts": [
"default"
"default",
"productRELEASE"
]
}
]
... ... @@ -228,7 +261,8 @@
{
"name": "default",
"applyToProducts": [
"default"
"default",
"productRELEASE"
]
}
]
... ... @@ -240,7 +274,8 @@
{
"name": "default",
"applyToProducts": [
"default"
"default",
"productRELEASE"
]
}
]
... ... @@ -252,7 +287,8 @@
{
"name": "default",
"applyToProducts": [
"default"
"default",
"productRELEASE"
]
}
]
... ... @@ -264,7 +300,8 @@
{
"name": "default",
"applyToProducts": [
"default"
"default",
"productRELEASE"
]
}
]
... ... @@ -276,7 +313,8 @@
{
"name": "default",
"applyToProducts": [
"default"
"default",
"productRELEASE"
]
}
]
... ...
... ... @@ -5,6 +5,7 @@ export class BridgeUtil {
static readonly YY_OVERRIDE_SCHEMA = "yy://";
static readonly YY_RETURN_DATA = BridgeUtil.YY_OVERRIDE_SCHEMA + "return/";
static readonly YY_FETCH_QUEUE = BridgeUtil.YY_RETURN_DATA + "_fetchQueue/";
static readonly BRIDGE_LOADED_MSG = "__bridge_loaded__";
static readonly EMPTY_STR = "";
static readonly UNDERLINE_STR = "_";
static readonly SPLIT_MARK = "/";
... ...
... ... @@ -12,6 +12,7 @@ export class H5CallNativeType {
static jsCall_receiveH5Data = 'jsCall_receiveH5Data'
static jsCall_getAppLoginAuthInfo = 'jsCall_getAppLoginAuthInfo'
static jsCall_appNotifyEvent = 'jsCall_appNotifyEvent'
static jsCall_receiveSubjectData = 'jsCall_receiveSubjectData'
// TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。
... ... @@ -24,6 +25,7 @@ export class H5CallNativeType {
H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_receiveH5Data)
H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppLoginAuthInfo)
H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_appNotifyEvent)
H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_receiveSubjectData)
}
}
... ...
... ... @@ -17,6 +17,7 @@ export struct WdWebComponent {
@Prop webUrl: string = ''
@Prop @Watch('onReloadStateChanged') reload: number = 0
@Link isPageEnd: boolean
@State subjectData : string = ''
build() {
Column() {
... ... @@ -36,19 +37,7 @@ export struct WdWebComponent {
})
.onLoadIntercept((event) => {
let url: string = event.data.getRequestUrl().toString()
url = url.replace("%(?![0-9a-fA-F]{2})", "%25")
.replace("\\+", "%2B");
url = decodeURIComponent(url)
if (url.startsWith(BridgeUtil.YY_RETURN_DATA)) {
this.webviewControl.handlerReturnData(url)
return true
}
if (url.startsWith(BridgeUtil.YY_OVERRIDE_SCHEMA)) {
Logger.debug(TAG, 'flushMessageQueue');
this.webviewControl.flushMessageQueue()
return true
}
return this.onLoadIntercept(event.data.getRequestUrl().toString());
return this.onLoadIntercept(url);
})
}
}
... ... @@ -60,6 +49,7 @@ export struct WdWebComponent {
let handle = (data: Message, f: Callback) => {
Logger.debug('registerHandlers handlerName: ' + JSON.stringify(data))
this.defaultPerformJSCallNative(data, f)
this.defaultGetReceiveSubjectData(data, f)
};
this.webviewControl.registerHandler(handleName, { handle: handle });
}
... ... @@ -71,21 +61,42 @@ export struct WdWebComponent {
private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => {
performJSCallNative(data, f)
}
/**
*/
private defaultGetReceiveSubjectData: (data: Message, f: Callback) => void = (data: Message, f: Callback) => {
if(data.handlerName === H5CallNativeType.jsCall_receiveSubjectData) {
f('')
}
}
onPageBegin: (url?: string) => void = () => {
Logger.debug(TAG, 'onPageBegin');
this.registerHandlers();
//有时序问题 必须延时执行
setTimeout(() => {
BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)
}, 200)
}
onPageEnd: (url?: string) => void = () => {
Logger.debug(TAG, 'onPageEnd');
this.onWebPrepared()
this.isPageEnd = true
}
onLoadIntercept: (url?: string) => boolean = () => {
Logger.debug(TAG, 'onLoadIntercept return false');
onLoadIntercept: (url: string) => boolean = (url: string) => {
Logger.debug(TAG, 'onLoadIntercept');
url = url.replace("%(?![0-9a-fA-F]{2})", "%25")
.replace("\\+", "%2B");
url = decodeURIComponent(url)
if (url.startsWith(BridgeUtil.YY_RETURN_DATA)) {
this.webviewControl.handlerReturnData(url)
return true
}
if (url.startsWith(BridgeUtil.YY_OVERRIDE_SCHEMA)) {
Logger.debug(TAG, 'flushMessageQueue');
this.webviewControl.flushMessageQueue()
return true
}
if (url.includes(BridgeUtil.BRIDGE_LOADED_MSG)) {
// jsBridge load通知,注入js
BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)
return true
}
return false
}
onReloadStateChanged() {
... ...
... ... @@ -22,6 +22,7 @@ export struct SpacialTopicPageComponent {
scroller: Scroller = new Scroller();
action: Action = {} as Action
@State webUrl: string = '';
@State subjectData: string = '';
@State isPageEnd: boolean = false
@Prop reload: number = 0;
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
... ... @@ -57,6 +58,36 @@ export struct SpacialTopicPageComponent {
let context = getContext(this) as common.UIAbilityContext;
viewBlogItemInsightIntentShare(context,this.contentDetailData)
}
async getWebviewPageData (){
let pageId = this.action.params?.extra?.pageId
let relId: string = ''
let relType: string = ''
let contentId: string = ''
if (this.action && this.action.params) {
if (this.action.params.contentID) {
contentId = this.action.params.contentID;
}
if (this.action && this.action.params && this.action.params.extra) {
if (this.action.params.extra.relId) {
relId = this.action.params.extra.relId;
}
if (this.action.params.extra.relType) {
relType = this.action.params.extra.relType
}
}
}
if(pageId){
// let pageInfoMsg = await PageRepository.fetchMorningEveningPageInfo(pageId)
// let pageCompInfoMsg = await PageRepository.fetchMorningEveningCompInfo(Number(pageId), groupId, refreshTime, topicId, 1, 20)
// let res = {
// dataJson: {
// pageInfoResponseMap: pageInfoMsg,
// compInfoResponseMap: pageCompInfoMsg,
// },
// }
}
}
private async getDetail() {
this.isNetConnected = NetworkUtil.isNetConnected()
... ... @@ -93,12 +124,17 @@ export struct SpacialTopicPageComponent {
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
// }
this.trySendData2H5()
this.subjectData = 'dasdasdadas'
//TODO
// this.trySendData2H5()
}
if(pageInfoMsg && pageInfoMsg.data){
this.contentDetailData.openComment = Number(pageInfoMsg.data.topicInfo.commentFlag)
this.contentDetailData.commentDisplay = Number(pageInfoMsg.data.topicInfo.commentShowFlag)
}
console.log('contentDetailData',this.contentDetailData)
}
}
}
... ... @@ -115,14 +151,16 @@ export struct SpacialTopicPageComponent {
.textAlign(TextAlign.Center)
.fontWeight(500)
.visibility(this.action?.params?.backVisibility && this.isPageEnd ? Visibility.Visible : Visibility.None)
WdWebComponent({
webviewControl: this.webviewControl,
webUrl: this.webUrl,
reload: this.reload,
onWebPrepared: this.onWebPrepared.bind(this),
isPageEnd: $isPageEnd,
})
if(this.subjectData.length > 0){
WdWebComponent({
webviewControl: this.webviewControl,
webUrl: this.webUrl,
reload: this.reload,
onWebPrepared: this.onWebPrepared.bind(this),
isPageEnd: $isPageEnd,
subjectData: this.subjectData
})
}
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
... ...
... ... @@ -11,6 +11,7 @@ import font from '@ohos.font';
* 视频:点播图标+时长;直播图标+'直播中'
*/
@Component
@Reusable
export struct CardMediaInfo {
@State livePeopleNum :boolean = true
... ... @@ -33,6 +34,16 @@ export struct CardMediaInfo {
})
}
aboutToReuse(params: Record<string, object>): void {
this.contentDTO = params.contentDTO as ContentDTO
}
aboutToRecycle(): void {
}
aboutToDisappear(): void {
}
/**
* 全域数字显示规则
* 1、当数量为千位以內时,显示数字,不保留小数点,比如 4585
... ...
import { CompDTO, ContentDTO } from 'wdBean'
import { CommonConstants } from 'wdConstant/Index';
import { DateTimeUtils } from 'wdKit/Index';
import { JSON } from '@kit.ArkTS';
import router from '@ohos.router'
@Reusable
@Component
export struct CardSourceInfo {
@State contentDTO: ContentDTO = new ContentDTO();
@ObjectLink compDTO: CompDTO
aboutToAppear(): void {
}
aboutToReuse(params: Record<string, object>): void {
this.contentDTO = params.contentDTO as ContentDTO
}
aboutToRecycle(): void {
}
aboutToDisappear(): void {
}
handleTimeStr() {
return DateTimeUtils.getCommentTime(
this.contentDTO.publishTime.includes(' ')
... ...
... ... @@ -4,7 +4,7 @@ import PageModel from '../../viewmodel/PageModel';
import { CommonConstants, ViewType } from 'wdConstant'
import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent'
import { ErrorComponent } from '../view/ErrorComponent'
import { CompDTO, ContentDTO } from 'wdBean'
import { CompDTO, ContentDTO, contentListParams,contentListItem } from 'wdBean'
import NoMoreLayout from './NoMoreLayout'
import { CustomSelectUI } from '../view/CustomSelectUI';
import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI';
... ... @@ -149,16 +149,13 @@ struct MyCollectionListPage {
.margin({left:16})
}
Column() {
BigPicCardComponent({compDTO:new CompDTO,contentDTO:compDTO})
BigPicCardComponent({compDTO:new CompDTO,contentDTO:compDTO,pageId:TrackConstants.PageName.My_Collect,pageName:TrackConstants.PageName.My_Collect})
}
}.onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {
if (isVisible) {
TrackingContent.common(TrackConstants.EventType.Show, TrackConstants.PageName.My_Collect,TrackConstants.PageName.My_Collect, TrackParamConvert.program(compDTO))
}
})
// .onClick(()=>{
// TrackingContent.common(TrackConstants.EventType.Click, TrackConstants.PageName.My_Collect,TrackConstants.PageName.My_Collect, TrackParamConvert.program(compDTO))
// })
}
... ... @@ -262,4 +259,12 @@ struct MyCollectionListPage {
}
}
getContentData(){
for (let index = 0; index < this.allDatas.length; index++) {
const compDTO = this.allDatas[index];
compDTO.isCollection = true ///用于时间展示
this.allDatas.push(compDTO)
}
}
}
\ No newline at end of file
... ...
... ... @@ -76,6 +76,7 @@ export struct PageComponent {
onActionEnd(this.pageModel, this.pageAdvModel)
})
)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
}
... ...
... ... @@ -15,6 +15,8 @@ const TAG: string = 'BigPicCardComponent';
@Component
export struct BigPicCardComponent {
@ObjectLink compDTO: CompDTO
@State pageId: string = '';
@State pageName: string = '';
contentDTO: ContentDTO = new ContentDTO();
aboutToAppear() {
... ... @@ -110,7 +112,7 @@ export struct BigPicCardComponent {
@Builder
cardBuild() {
CardParser({ compDTO: this.compDTO, contentDTO: this.contentDTO });
CardParser({ compDTO: this.compDTO, contentDTO: this.contentDTO,pageId:this.pageId,pageName:this.pageName});
}
}
... ...
import { ContentDetailDTO, LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index'
import { EmptyComponent, ErrorComponent, WDViewDefaultType } from 'wdComponent/Index'
import { CustomPullToRefresh, EmptyComponent, ErrorComponent, WDViewDefaultType } from 'wdComponent/Index'
import CustomRefreshLoadLayout from 'wdComponent/src/main/ets/components/page/CustomRefreshLoadLayout'
import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout'
import { RefreshLayoutBean } from 'wdComponent/src/main/ets/components/page/RefreshLayoutBean'
... ... @@ -7,8 +7,10 @@ import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel'
import { ViewType } from 'wdConstant/Index'
import { LiveViewModel } from '../../viewModel/LiveViewModel'
import { TabChatItemComponent } from './TabChatItemComponent'
import { EmitterEventId, EmitterUtils, Logger } from 'wdKit';
import { EmitterEventId, EmitterUtils, LazyDataSource, Logger } from 'wdKit';
import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'
import { PeopleShipNoMoreData } from 'wdComponent/src/main/ets/components/reusable/PeopleShipNoMoreData'
import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout'
const TAG: string = 'TabChatComponent';
... ... @@ -20,13 +22,15 @@ const TAG: string = 'TabChatComponent';
export struct TabChatComponent {
@State private pageModel: PageModel = new PageModel()
liveViewModel: LiveViewModel = new LiveViewModel()
@State liveChatList: Array<LiveRoomItemBean> = []
@State liveChatList: LazyDataSource<LiveRoomItemBean> = new LazyDataSource();
// @State liveList: LazyDataSource<LiveRoomItemBean> = new LazyDataSource();
@Consume contentDetailData: ContentDetailDTO
@Consume publishCommentModel: publishCommentModel
@Prop @Watch("lastInputedCommentChanged") lastInputedComment: LiveRoomItemBean
private scroller: Scroller = new Scroller()
aboutToAppear(): void {
this.getLiveChatList()
this.getLiveList()
//注册通知
EmitterUtils.receiveEvent(EmitterEventId.COMMENT_PUBLISH, async (targetId?: string) => {
... ... @@ -62,7 +66,20 @@ export struct TabChatComponent {
} else if (this.pageModel.viewType == ViewType.EMPTY) {
EmptyComponent({ emptyType: WDViewDefaultType.WDViewDefaultType_NoComment1 })
} else {
this.ListLayout()
// this.ListLayout()
CustomPullToRefresh({
alldata: this.liveChatList,
scroller: this.scroller,
hasMore: false,
customList: () => {
this.ListLayout()
},
onRefresh: (resolve) => {
this.pageModel.currentPage = 1
this.getLiveList(resolve)
},
})
}
}
.align(Alignment.Top)
... ... @@ -73,32 +90,33 @@ export struct TabChatComponent {
@Builder
ListLayout() {
List() {
ListItem() {
// 下拉刷新 TODO 待对接新的下拉刷新组件
// RefreshLayout({
// refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage,
// this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
// })
}
List({ scroller: this.scroller }) {
ForEach(this.liveChatList, (item: LiveRoomItemBean) => {
LazyForEach(this.liveChatList, (item: LiveRoomItemBean) => {
ListItem() {
TabChatItemComponent({ item: item })
}
})
},
(item: LiveRoomItemBean, contentIndex: number) => JSON.stringify(item)
)
// 加载更多
// ListItem() {
// if (this.pageModel.hasMore) {
// LoadMoreLayout({
// refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage,
// this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight)
// })
// } else {
// ListHasNoMoreDataUI()
// }
// }
}
ListItem() {
if (this.pageModel.hasMore && this.liveChatList && this.liveChatList.totalCount() > 0) {
LoadMoreLayout({ isVisible: this.pageModel.hasMore })
} else if (!this.pageModel.hasMore && !this.pageModel.isLoading) {
PeopleShipNoMoreData()
}
}
} .edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.onReachEnd(() => {
Logger.debug(TAG, "触底了");
if (!this.pageModel.isLoading && this.pageModel.hasMore) {
//加载分页数据
//this.currentPage++;
this.getLiveList()
}
})
}
@Builder
... ... @@ -109,7 +127,16 @@ export struct TabChatComponent {
})
}
getLiveChatList() {
async getLiveList(resolve?: (value: string | PromiseLike<string>) => void) {
if (this.pageModel.isLoading) {
if (resolve) {
resolve('已更新至最新')
}
return
}
this.pageModel.isLoading = true
this.pageModel.currentPage = 1
this.liveViewModel.getLiveChatList(
this.pageModel.currentPage,
... ... @@ -118,6 +145,17 @@ export struct TabChatComponent {
20,)
.then(
(data) => {
this.pageModel.isLoading = false
if (resolve) {
if (this.pageModel.currentPage == 1) {
resolve('已更新至最新')
} else {
resolve('')
}
}
if(this.pageModel.currentPage ===1){
this.liveChatList.clear()
}
Logger.debug(TAG, `${JSON.stringify(data)}`)
if (data.barrageResponses && data.barrageResponses.length > 0) {
this.pageModel.viewType = ViewType.LOADED;
... ...
... ... @@ -135,6 +135,9 @@ export struct TabLiveComponent {
resolve('')
}
}
if(this.pageModel.currentPage ===1){
this.liveList.clear()
}
Logger.debug(TAG, '直播间数据:' + `${JSON.stringify(data)}`)
if (data.barrageResponses && data.barrageResponses.length > 0) {
/**
... ... @@ -146,9 +149,6 @@ export struct TabLiveComponent {
3.内容:详情接口的简介,newIntroduction
*/
this.pageModel.viewType = ViewType.LOADED;
if(this.pageModel.currentPage ===1){
this.liveList.clear()
}
this.liveList.push(...data.barrageResponses)
if (data.barrageResponses.length === this.pageModel.pageSize) {
... ...
import { ContentDetailDTO, LiveDetailsBean } from 'wdBean/Index';
import { ContentDetailDTO } from 'wdBean/Index';
import { Logger, StringUtils } from 'wdKit/Index';
import { PlayerConstants, WDAliPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index';
import { PlayUIComponent } from './PlayUIComponent';
import { PictureLoading } from '../../vertical/PictureLoading';
import { ParamType, TrackConstants } from 'wdTracking/Index';
import { TrackConstants } from 'wdTracking/Index';
const TAG: string = 'TopPlayComponent'
... ... @@ -25,7 +25,7 @@ export struct TopPlayComponent {
//播放错误
@State isError: boolean = false
// loading 控制字段
@State isLoading: boolean = false
@State isHideLoading: boolean = false
// 获取播放资源能播放了
@State isCanPlay: boolean = false
// 当前播放资源的状态
... ... @@ -38,7 +38,7 @@ export struct TopPlayComponent {
this.playerController.onCanplay = () => {
this.isCanPlay = true
this.isLoading = true
this.isHideLoading = true
this.playerController?.play()
}
... ... @@ -48,7 +48,7 @@ export struct TopPlayComponent {
Logger.debug(TAG, 'status==>' + status)
if (status === PlayerConstants.STATUS_ERROR) {
this.isError = true
this.isLoading = true
this.isHideLoading = true
this.isCanPlay = false
} else if (status === PlayerConstants.STATUS_COMPLETION) {
// 播放完成
... ... @@ -66,8 +66,9 @@ export struct TopPlayComponent {
* 更新直播播放数据
*/
updateData() {
// 检测等待中的直播预告是否视频资源
// 检测直播等待状态的直播预告是否视频资源
if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewType === 1
&& this.contentDetailData?.liveInfo?.liveState == 'wait'
&& this.contentDetailData.liveInfo.previewUrl &&
this.contentDetailData.liveInfo.previewUrl.length > 0) {
// 预告资源是视频
... ... @@ -78,7 +79,6 @@ export struct TopPlayComponent {
if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewUrl &&
this.contentDetailData.liveInfo.previewUrl.length > 0) {
this.previewUrl = this.contentDetailData.liveInfo.previewUrl
} else if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) {
this.previewUrl = this.contentDetailData.fullColumnImgUrls[0].url
}
... ... @@ -87,18 +87,17 @@ export struct TopPlayComponent {
if (this.isVideoSource) {
this.isWait = false
this.isLoading = false
this.isHideLoading = false
} else {
this.isWait = this.contentDetailData?.liveInfo?.liveState == 'wait'
if (this.isWait) {
this.isLoading = true
this.isHideLoading = true
}
}
this.isEnd = this.contentDetailData?.liveInfo?.liveState === 'end' &&
StringUtils.isEmpty(this.contentDetailData?.liveInfo?.vlive[0]?.replayUri)
// Logger.debug(TAG, `---0------>` + this.isWait + ' ->' + this.isLoading + ' ->' + this.isEnd)
if (!this.isWait) {
if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.vlive.length > 0) {
let playUrl = ''
... ... @@ -114,31 +113,38 @@ export struct TopPlayComponent {
} else {
Logger.debug(TAG, `---0------>${playUrl}`)
if (StringUtils.isNotEmpty(playUrl)) {
Logger.debug(TAG, `---isNotEmpty------>`)
this.playUrl = playUrl
this.tryToPlay()
}
}
} else {
this.isWait = true
this.isLoading = true
this.isHideLoading = true
}
}
// 直播结束
if (this.contentDetailData?.liveInfo?.liveState === 'end') {
this.isHideLoading = !StringUtils.isNotEmpty(this.playUrl)
this.isWait = !StringUtils.isNotEmpty(this.playUrl)
}
// 文字直播 running 状态
if (this.contentDetailData?.liveInfo?.liveWay === 1 && this.contentDetailData?.liveInfo?.liveState === 'running') {
this.isWait = true
this.isLoading = true
this.isHideLoading = true
if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) {
this.previewUrl = this.contentDetailData.fullColumnImgUrls[0].url
} else {
this.previewUrl = ''
}
}
// Logger.debug(TAG, `---0------>` + this.isWait + ' ->' + this.isHideLoading + ' ->' + this.isEnd+' -->'+this.isVideoSource)
}
tryToPlay() {
Logger.debug(TAG, `---1------>`)
if (!this.xComponentIsLoaded) {
Logger.debug(TAG, "需要xComponent加载完成")
return
... ... @@ -161,11 +167,13 @@ export struct TopPlayComponent {
WDPlayerRenderLiveView({
playerController: this.playerController,
onLoad: async () => {
this.isLoading = false
this.isError = false
this.xComponentIsLoaded = true
Logger.debug(TAG, `---onLoad------>`)
this.tryToPlay()
if (StringUtils.isNotEmpty(this.playUrl)) {
this.isHideLoading = false
this.isError = false
this.xComponentIsLoaded = true
Logger.debug(TAG, `---onLoad------>`)
this.tryToPlay()
}
}
})
.height('100%')
... ... @@ -180,12 +188,13 @@ export struct TopPlayComponent {
.objectFit(ImageFit.Cover)
.alt($r('app.media.live_room_image_fail'))
.visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None)
.contrast(this.isEnd ? 0.2 : 1)
// .contrast(this.isEnd ? 0.4 : 1)
.blur(this.isEnd ? 20 : 0)
.width('100%')
}
// loading
PictureLoading().visibility(this.isLoading ? Visibility.None : Visibility.Visible)
PictureLoading().visibility(this.isHideLoading ? Visibility.None : Visibility.Visible)
// 视频播放器上的控制面板和信息
PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay, liveUrl: this.playUrl })
... ... @@ -221,7 +230,7 @@ export struct TopPlayComponent {
.margin({ top: 16 })
.padding(0)
.onClick(() => {
this.isLoading = false
this.isHideLoading = false
this.isError = false
this.xComponentIsLoaded = true
this.tryToPlay()
... ...
import { Action } from 'wdBean';
import { SpacialTopicPageComponent } from 'wdComponent'
import { CommonConstants } from 'wdConstant'
import { Logger } from 'wdKit'
import { CommonConstants, SpConstants } from 'wdConstant'
import { Logger, SPHelper, StringUtils } from 'wdKit'
import router from '@ohos.router';
import dataPreferences from '@ohos.data.preferences';
import { TrackConstants } from 'wdTracking/Index';
const TAG = 'SpacialTopicPage';
... ... @@ -13,6 +14,18 @@ struct SpacialTopicPage {
@State action: Action = {} as Action
@State reload: number = 0
@State count: number = 0
preferences: dataPreferences.Preferences | null = null;
observer = (key: string) => {
if(key == SpConstants.USER_ID){
if(StringUtils.isEmpty(SPHelper.default.getSync(SpConstants.USER_ID,""))){
// 未登录
}else {
// 登录
this.reload = this.reload + 1
}
}
}
@Provide pageName: string = TrackConstants.PageName.Summary_Detail
@Provide pageId: string = TrackConstants.PageName.Summary_Detail
... ... @@ -39,9 +52,16 @@ struct SpacialTopicPage {
Logger.info(TAG, `aboutToAppearcount:${this.reload}`);
let action: Action = router.getParams() as Action
this.action = action
this.addLoginStatusObserver()
}
async addLoginStatusObserver(){
this.preferences = await SPHelper.default.getPreferences();
this.preferences.on('change', this.observer);
}
onPageShow() {
this.reload = this.reload + 1
// this.reload = this.reload + 1
Logger.info(TAG, `onPageShowcount:${this.reload}`);
}
}
\ No newline at end of file
... ...
... ... @@ -74,6 +74,22 @@ struct LaunchAdvertisingPage {
bottom: 0
})
if (this.defaultModel.isAd === '1'){
Stack({alignContent:Alignment.TopStart}){
Text('广告')
.fontColor(Color.White)
.textAlign(TextAlign.Center)
.fontSize('24lpx')
.width('72lpx')
.height('36lpx')
.borderRadius(2)
.margin({top:'15lpx',left:'19lpx'})
.backgroundColor('#80000000')
}
.width('100%')
.height('100%')
}
Stack({alignContent:Alignment.TopEnd}){
Button(){
Text(this.time + 's 跳过')
... ... @@ -95,22 +111,6 @@ struct LaunchAdvertisingPage {
.width('100%')
.height('100%')
if (this.defaultModel.isAd === '1'){
Stack({alignContent:Alignment.TopStart}){
Text('广告')
.fontColor(Color.White)
.textAlign(TextAlign.Center)
.fontSize('24lpx')
.width('72lpx')
.height('36lpx')
.borderRadius(2)
.margin({top:'15lpx',left:'19lpx'})
.backgroundColor('#80000000')
}
.width('100%')
.height('100%')
}
if(this.defaultModel.screenType != '2'){
//底部logo样式 按钮加载在背景展示图上
Button(){
... ...
... ... @@ -126,7 +126,6 @@ export struct VideoChannelPage {
.width('100%')
.justifyContent(FlexAlign.Center)
.backgroundColor(this.currentTopNavSelectedIndex === 0 ? Color.Transparent : Color.White)
// 搜索按钮
Row() {
... ... @@ -180,7 +179,7 @@ export struct VideoChannelPage {
channelId: item.channelId + '',
autoRefresh: this.autoRefresh
})
.margin({ top: 40 })
.padding({ top: 55 })
.backgroundColor(Color.White)
}
}, (item: TopNavDTO) => item.channelId + '')
... ...