wangliang_wd

feat:解决冲突

Showing 17 changed files with 198 additions and 97 deletions
... ... @@ -29,7 +29,9 @@ export struct WdWebLocalComponent {
@State sliderStartTime: string = '';
@State currentTime: number = 0;
@State durationTime: number = 0;
@State progressOpacity: number = 1
@State durationStringTime: string = '';
private progressTimerNumber: number = 0
@State isPause: boolean = true;
controller: VideoController = new VideoController()
@StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm';
... ... @@ -96,12 +98,12 @@ export struct WdWebLocalComponent {
url = url.replace("%(?![0-9a-fA-F]{2})", "%25")
.replace("\\+", "%2B");
url = decodeURIComponent(url)
Logger.debug(TAG, 'Web onLoadIntercept url: ' + 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:'+url);
// this.webviewControl.flushMessageQueue()
this.webviewControl.receiveDataFromH5(url)
return true
... ... @@ -172,7 +174,7 @@ export struct WdWebLocalComponent {
this.positionLeft = Number(data?.data?.positionLeft) || 0
this.positionTop = Number(data?.data?.positionTop) || 0
this.videoLandscape = data?.data?.videoLandscape || '1'
this.controller.start()
this.startPlay()
}
}
/**
... ... @@ -206,6 +208,26 @@ export struct WdWebLocalComponent {
}
}
startPlay() {
this.cancelProgressTimer()
this.controller.start()
this.startProgressTimer()
}
startProgressTimer() {
this.progressTimerNumber = setTimeout(() => {
animateTo({duration: 1000}, () => {
this.progressOpacity = 0
})
}, 3000)
}
cancelProgressTimer() {
if (this.progressTimerNumber > 0) {
clearTimeout(this.progressTimerNumber)
this.progressTimerNumber = 0
}
}
@Builder
videoComp(){
Video({
... ... @@ -221,6 +243,7 @@ export struct WdWebLocalComponent {
.objectFit(ImageFit.Contain)
.onFinish(()=>{
this.isEndPlay = true
this.currentTime = 0
})
.onStart(() => {
this.isPause = false
... ... @@ -248,13 +271,23 @@ export struct WdWebLocalComponent {
WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT)
}
})
.onClick(() => {
animateTo({duration: 1000}, () => {
if (this.progressOpacity <= 0) {
this.progressOpacity = 1
} else {
this.progressOpacity = 0
}
})
})
if (this.isEndPlay){
Column(){
Image($r('app.media.icon_replay')).width(40).height(40)
.onClick(() => {
this.isEndPlay = false
this.controller.start()
this.progressOpacity = 1
this.startPlay()
})
Text('重播').fontColor(Color.White).fontSize(14)
... ... @@ -271,9 +304,10 @@ export struct WdWebLocalComponent {
.height(24)
.onClick(() => {
if (this.isPause) {
this.controller.start()
this.startPlay()
} else {
this.controller.pause()
this.cancelProgressTimer()
}
})
Row() {
... ... @@ -298,6 +332,13 @@ export struct WdWebLocalComponent {
.blockSize({ width: 18, height: 12 })
.onChange((value: number, mode: SliderChangeMode) => {
this.controller.setCurrentTime(value);
if (mode == SliderChangeMode.End) {
if (this.isPause) {
this.startPlay()
} else {
this.startProgressTimer()
}
}
})
Text(DateTimeUtils.getFormattedDuration(this.durationTime * 1000))
.fontSize(12)
... ... @@ -313,7 +354,11 @@ export struct WdWebLocalComponent {
// this.controller.requestFullscreen(true)
// })
}
.opacity(0.8)
.opacity(this.progressOpacity)
.linearGradient({
direction: GradientDirection.Top, // 渐变方向
colors: [[0x20000000, 0.0], [Color.Transparent, 1.0]] // [0x80000000, 0.5],
})
.width("100%")
.justifyContent(FlexAlign.SpaceAround)
}
... ...
... ... @@ -199,6 +199,9 @@ export struct H5NewsWebPageComponent {
// 已登录->查询用户对作品点赞、收藏状态
private async getInteractDataStatus() {
if (!HttpUtils.isLogin()) {
return
}
try {
const params: batchLikeAndCollectParams = {
contentList: [
... ...
... ... @@ -40,7 +40,7 @@ import { LottieView } from '../components/lottie/LottieView';
const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
const TAG: string = 'ImageAndTextPageComponent'
const TAG: string = 'ImageAndTextWebComponent'
/**
* 图文详情页
* */
... ... @@ -410,6 +410,9 @@ export struct ImageAndTextPageComponent {
// 已登录->查询用户对作品点赞、收藏状态
private async getInteractDataStatus() {
if (!HttpUtils.isLogin()) {
return
}
try {
const params: batchLikeAndCollectParams = {
contentList: [
... ... @@ -512,6 +515,7 @@ export struct ImageAndTextPageComponent {
}
aboutToAppear() {
Logger.debug(TAG, '文章详情页 aboutToAppear,开始请求接口数据');
this.getDetail()
this.screenHeight = DisplayUtils.getDeviceHeight()
this.initAnimationConfig();
... ...
... ... @@ -24,6 +24,7 @@ export struct ImageAndTextWebComponent {
private webPrepared = false;
private dataPrepared = false;
async onDetailDataUpdated() {
Logger.debug(TAG, '详情内容已获取接口数据');
if (this.action) {
let contentId: string = ''
let contentType: string = ''
... ... @@ -92,6 +93,10 @@ export struct ImageAndTextWebComponent {
}
aboutToAppear(): void {
Logger.debug(TAG, 'H5模板加载控件 aboutToAppear');
}
build() {
Column() {
WdWebLocalComponent({
... ... @@ -115,15 +120,16 @@ export struct ImageAndTextWebComponent {
}
private onWebPrepared() {
Logger.debug(TAG, 'H5模板已加载,prepared');
this.webPrepared = true
this.trySendData2H5()
}
private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) {
let jsonString = JSON.stringify(h5ReceiveAppData);
Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData',jsonString);
Logger.debug(TAG, '传递html数据至H5 jsCall_receiveAppData',jsonString);
this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData, jsonString, (data: string) => {
Logger.debug('ImageAndTextWebComponent', "from js data = " + data);
Logger.debug(TAG, "from js data = " + data);
})
}
}
\ No newline at end of file
... ...
... ... @@ -578,48 +578,53 @@ struct footerExpandedView {
build() {
Row() {
if (this.item.expanded) {
Row() {
Text().backgroundColor($r('app.color.color_EDEDED')).width(24).height(1)
if (this.item.childsHasMore) {
Row() {
if (this.item.expanded) {
Row() {
Text().backgroundColor($r('app.color.color_EDEDED')).width(24).height(1)
if (this.item.childsHasMore) {
Row() {
Text('查看更多回复').fontColor($r('app.color.color_222222')).fontSize(14)
Image($r('app.media.comment_unfold')).width(12).height(12)
}.margin({ left: 6 })
.onClick(() => {
if (this.item.isLoading) {
return
}
this.item.isLoading = true
fetchChildContentCommentList(this.contentId, this.contentType, this.item)
})
}
Row() {
Text('查看更多回复').fontColor($r('app.color.color_222222')).fontSize(14)
Image($r('app.media.comment_unfold')).width(12).height(12)
Text('收起').fontColor($r('app.color.color_222222')).fontSize(14)
Image($r('app.media.comment_pickUp')).width(12).height(12)
}.margin({ left: 6 })
.onClick(() => {
if (this.item.isLoading) {
return
}
this.item.isLoading = true
fetchChildContentCommentList(this.contentId, this.contentType, this.item)
this.item.pageNum = 1
this.item.expanded = false
this.item.childComments = []
this.item.childCommentsLazyDataSource.clear()
})
}
}.margin({ left: 53 })
} else {
Row() {
Text('收起').fontColor($r('app.color.color_222222')).fontSize(14)
Image($r('app.media.comment_pickUp')).width(12).height(12)
}.margin({ left: 6 })
Text().backgroundColor($r('app.color.color_EDEDED')).width(24).height(1)
Text('查看更多回复').fontColor($r('app.color.color_222222')).fontSize(14).margin({ left: 6 })
Image($r('app.media.comment_unfold')).width(12).height(12)
}.margin({ left: 53 })
.onClick(() => {
this.item.pageNum = 1
this.item.expanded = false
this.item.childComments = []
this.item.childCommentsLazyDataSource.clear()
if (this.item.isLoading) {
return
}
this.item.isLoading = true
fetchChildContentCommentList(this.contentId, this.contentType, this.item)
})
}.margin({ left: 53 })
} else {
Row() {
Text().backgroundColor($r('app.color.color_EDEDED')).width(24).height(1)
Text('查看更多回复').fontColor($r('app.color.color_222222')).fontSize(14).margin({ left: 6 })
Image($r('app.media.comment_unfold')).width(12).height(12)
}.margin({ left: 53 })
.onClick(() => {
if (this.item.isLoading) {
return
}
this.item.isLoading = true
fetchChildContentCommentList(this.contentId, this.contentType, this.item)
})
}
}.height(30)
}
}.height(20)
// .backgroundColor(Color.Green)
}.height(24)
.alignItems(VerticalAlign.Top)
// .backgroundColor(Color.Gray)
}
}
... ...
... ... @@ -599,6 +599,7 @@ struct ChannelSubscriptionLayout {
}
.width(36)
.height(40)
.margin({right: 6})
.justifyContent(FlexAlign.Center)
.onClick(() => {
this.isShow = true
... ...
... ... @@ -16,8 +16,8 @@ export struct PeopleShipHomePageHeadComponent {
.borderRadius(this.diameter/2)
// .borderWidth('0.5vp')
.border({
width: 2,
color: Color.White, // 5% 透明度的黑色
width: 1,
color: $r('app.color.color_0D000000'), // 5% 透明度的黑色
style: BorderStyle.Solid
})
// .borderStyle(BorderStyle.Solid)
... ...
... ... @@ -228,7 +228,7 @@ export struct OperRowListView {
}
router.back();
})
Blank().width(10).visibility(this.showBackIcon ? Visibility.None : Visibility.Visible)
if (this.contentDetailData?.newsId) {
ForEach(this.operationButtonList, (item: string, index: number) => {
... ...
... ... @@ -5,7 +5,7 @@ import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet';
import { DisplayDirection } from 'wdConstant/Index';
import mediaquery from '@ohos.mediaquery';
import { CustomToast, Logger, WindowModel } from 'wdKit/Index';
import { router, window } from '@kit.ArkUI';
import { display, router, window } from '@kit.ArkUI';
import { WDAliPlayerController } from 'wdPlayer/Index';
import { LiveOperRowListView } from 'wdComponent';
import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel';
... ... @@ -49,8 +49,9 @@ export struct DetailPlayLivePage {
@Provide banComment: boolean = true
@State isEnd: boolean = false
@Consume liveDetailPageLogic: LiveDetailPageLogic
@State toastText: ResourceStr = "这是一个非Wi-Fi环境。请注意流量消耗"
@State topPlayHeight:number = this.getTopPlayHeight()
@StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm';
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
bgColor: 0xB3000000,
... ... @@ -162,7 +163,7 @@ export struct DetailPlayLivePage {
build() {
Column() {
TopPlayComponent({ playerController: this.playerController, isEnd: this.isEnd, lastLiveControl: this.lastLiveControl })
.height(this.displayDirection == DisplayDirection.VERTICAL ? 211 : '100%')
.height(this.displayDirection == DisplayDirection.VERTICAL ? this.topPlayHeight : '100%')
.margin({
top: this.displayDirection == DisplayDirection.VERTICAL ? px2vp(this.topSafeHeight) : 0
})
... ... @@ -274,4 +275,14 @@ export struct DetailPlayLivePage {
})
}
getTopPlayHeight() {
let screenWidth = display.getDefaultDisplaySync().width
return px2vp(screenWidth) * 9/16.0
}
currentChanged() {
this.topPlayHeight = this.getTopPlayHeight()
}
}
\ No newline at end of file
... ...
... ... @@ -109,6 +109,7 @@ export struct DetailPlayShortVideoPage {
* 监听下标变化手动创建或销毁视频
*/
async currentIndexChange() {
// console.log(TAG, 'currentIndex:', this.currentIndex,'index:', this.index)
if (this.currentIndex != this.index) {
this.playerController.pause()
if (this.index <= this.currentIndex - 2 && this.playerController.getPlayer()) {
... ... @@ -156,7 +157,7 @@ export struct DetailPlayShortVideoPage {
}
// 已登录->查询用户对作品点赞、收藏状态
ContentDetailRequest.postBatchLikeAndCollectStatus(params).then(res => {
console.log('查询点赞、收藏状态==', JSON.stringify(res.data))
// console.log('查询点赞、收藏状态==', JSON.stringify(res.data))
if (res.data) {
this.newsStatusOfUser = res.data[0]
}
... ... @@ -167,7 +168,7 @@ export struct DetailPlayShortVideoPage {
}
// 已登录->批量查作品是否被号主关注
ContentDetailRequest.postBatchAttentionStatus(params1).then(res => {
console.log('批量查号主是否为用户关注==', JSON.stringify(res.data))
// console.log('批量查号主是否为用户关注==', JSON.stringify(res.data))
if (res.data) {
this.followStatus = res.data[0]?.status
}
... ... @@ -182,10 +183,11 @@ export struct DetailPlayShortVideoPage {
contentType: this.contentDetailData?.newsType || 0,
}]
}
ContentDetailRequest.postInteractBrowsOperate(params2).then(res => {
console.log('记录浏览历史==', JSON.stringify(res.data))
})
ContentDetailRequest.postInteractBrowsOperate(params2)
// .then(res => {
// // console.log('记录浏览历史==', JSON.stringify(res.data))
//
// })
}
}
... ... @@ -195,7 +197,7 @@ export struct DetailPlayShortVideoPage {
if (!this.onlyWifiLoadVideo) {
this.onlyWifiLoadVideo = await onlyWifiLoadVideo()
this.toastTextVisible = this.onlyWifiLoadVideo ? false : true
console.log(TAG, 'this.onlyWifiLoadVideo', this.onlyWifiLoadVideo)
// console.log(TAG, 'this.onlyWifiLoadVideo', this.onlyWifiLoadVideo)
}
this.videoLandScape = this.contentDetailData.videoInfo[0]?.videoLandScape
... ... @@ -241,12 +243,12 @@ export struct DetailPlayShortVideoPage {
} else if (this.contentDetailData.newsType == 14 || this.contentDetailData.newsType == 15) {
this.PageName = TrackConstants.PageName.DynamicDetail // 动态图文/动态视频
}
console.log('视频详情页', JSON.stringify(this.pageParam))
console.log('视频详情页2', JSON.stringify(this.PageName))
// console.log('视频详情页', JSON.stringify(this.pageParam))
// console.log('视频详情页2', JSON.stringify(this.PageName))
}
async aboutToDisappear(): Promise<void> {
console.log(TAG, 'aboutToDisappear', this.index)
// console.log(TAG, 'aboutToDisappear', this.index)
await this.playerController?.pause()
// await this.playerController?.stop()
// await this.playerController?.release();
... ... @@ -310,11 +312,11 @@ export struct DetailPlayShortVideoPage {
}
})
this.playerViewBuilder()
if (this.index === this.currentIndex) {
PlayerBottomView({
playerController: this.playerController
})
}
PlayerBottomView({
playerController: this.playerController,
index: this.index,
currentIndex: this.currentIndex,
})
PlayerRightView({
playerController: this.playerController
... ... @@ -349,6 +351,7 @@ export struct DetailPlayShortVideoPage {
operationButtonList: ['comment',],
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
interactData:this.interactData,
showCommentIcon: false,
onBack: () => {
// WindowModel.shared.setWindowLayoutFullScreen(false)
... ...
... ... @@ -98,7 +98,7 @@ export struct VideoChannelDetail {
this.switchVideoStatus = false
this.closeFullScreen()
console.log(TAG, '一级视频隐藏')
// console.log(TAG, '一级视频隐藏')
this.pageHideTime = DateTimeUtils.getTimeStamp()
let duration = 0
duration = Math.floor((this.pageHideTime - this.pageShowTime) / 1000)
... ... @@ -110,7 +110,7 @@ export struct VideoChannelDetail {
* 监听视频频道激活或失活
*/
navIndexChange() {
console.log('navIndexChange', this.bottomNavIndex, this.topNavIndex)
// console.log('navIndexChange', this.bottomNavIndex, this.topNavIndex)
if (this.bottomNavIndex === 2 && this.topNavIndex === 0) {
// this.barBackgroundColor = Color.Black
this.switchVideoStatus = true
... ... @@ -139,12 +139,12 @@ export struct VideoChannelDetail {
aboutToAppear() {
this.getDetail()
Logger.info(TAG, 'aboutToAppear');
// Logger.info(TAG, 'aboutToAppear');
}
aboutToDisappear(): void {
this.closeFullScreen()
Logger.info(TAG, 'aboutToDisappear');
// Logger.info(TAG, 'aboutToDisappear');
}
/**
... ... @@ -209,7 +209,7 @@ export struct VideoChannelDetail {
await ContentDetailRequest.getRecCompInfo(params).then(async res => {
this.isOffLine = res.data == null ? true : false
console.log('根据视频频道传参查询视频楼层信息totalCount', res.data?.totalCount + '')
// console.log('根据视频频道传参查询视频楼层信息totalCount', res.data?.totalCount + '')
this.totalCount = res.data?.totalCount || 0
const list1: batchContentDetailParams = {
... ... @@ -259,7 +259,7 @@ export struct VideoChannelDetail {
this.data = this.data.concat(res.data)
this.dataContentDetail.addItems(res.data)
}
console.log('根据视频楼层信息批量查询视频列表', JSON.stringify(res.data))
// console.log('根据视频楼层信息批量查询视频列表', JSON.stringify(res.data))
}).finally(() => {
setTimeout(() => {
this.isRequesting = false
... ... @@ -280,7 +280,7 @@ export struct VideoChannelDetail {
if (res.data) {
this.interactDataList = this.interactDataList.concat(res.data)
}
console.log('根据视频信息批量查询点赞、收藏状态', res.data)
// console.log('根据视频信息批量查询点赞、收藏状态', res.data)
})
}
}
... ... @@ -328,7 +328,7 @@ export struct VideoChannelDetail {
.height('100%')
.onChange((index: number) => {
this.currentIndex = index
console.info('onChange==', index.toString())
// console.info('onChange==', index.toString())
if (this.currentIndex === this.data.length - 1) {
this.pageNum++
... ...
... ... @@ -13,15 +13,20 @@ export struct PlayerBottomView {
@Consume isDragging?: boolean
@Consume contentDetailData: ContentDetailDTO
@Consume displayDirection: DisplayDirection
@Prop index: number = 0
@Prop currentIndex: number = 0
aboutToAppear(): void {
}
build() {
Column() {
PlayerTitleView()
PlayerProgressView({ playerController: this.playerController })
PlayerProgressView({
playerController: this.playerController,
index: this.index,
currentIndex: this.currentIndex,
})
}
.width('100%')
.alignItems(HorizontalAlign.Start)
... ...
... ... @@ -16,14 +16,13 @@ export struct PlayerProgressView {
@State loadingWidth: number | string = 1
@State showLoading: boolean = false
@Consume onlyWifiLoadVideo: boolean
@Prop index: number = 0
@Prop @Watch('currentIndexChange') currentIndex: number = 0
timer: number = 0
aboutToAppear() {
if (this.playerController) {
this.playerController.onSeekDone = (status: number) => {
this.playerController?.play()
}
currentIndexChange() {
// console.log('DetailPlayShortVideoPage PlayerProgressView', 'currentIndex:', this.currentIndex,'index:', this.index)
if (this.playerController && this.index == this.currentIndex) {
this.playerController.onLoaded = (loaded: number) => {
if (loaded == 1) {
this.loadingWidth = '95%'
... ... @@ -44,6 +43,14 @@ export struct PlayerProgressView {
}
}
aboutToAppear() {
if (this.playerController) {
this.playerController.onSeekDone = (status: number) => {
this.playerController?.play()
}
}
}
/**
*
* loading 动效
... ... @@ -71,7 +78,7 @@ export struct PlayerProgressView {
.zIndex(2000)
.height(10)
.visibility(this.showLoading ? Visibility.Visible : Visibility.Hidden)
.margin({ bottom: 10 })
.margin({ bottom: 14 })
// .markAnchor({ x: 0, y: '100%' })
}
... ...
import measure from '@ohos.measure'
import { ContentDetailDTO } from 'wdBean/Index'
import { ContentDetailDTO, Params } from 'wdBean/Index'
import { DetailDialog } from './DetailDialog'
import { DateTimeUtils } from 'wdKit'
import { DateTimeUtils, ToastUtils } from 'wdKit'
import { WDRouterPage, WDRouterRule } from 'wdRouter'
const TAG = 'PlayerTitleView';
... ... @@ -174,7 +175,22 @@ export struct PlayerTitleView {
if (this.getIcon()) {
Image(this.getIcon()).height(11).margin({ left: 4, top: 3 })
}
}.margin({ bottom: 8 })
}
.zIndex(100)
.margin({ bottom: 8 })
.onClick(() => {
// console.log(TAG, '点击号主@信息')
// 跳转到号主页
if (this.contentDetailData.rmhInfo?.cnMainControl === 1) {
const params: Params = {
creatorId: this.contentDetailData.rmhInfo.rmhId,
pageID: ''
}
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
} else {
ToastUtils.showToast("暂时无法查看该创作者主页", 2000);
}
})
}
... ...
... ... @@ -97,6 +97,14 @@ struct Index {
build() {
Stack({ alignContent: Alignment.End }) {
Progress({ value: 0, total: 100, type: ProgressType.Linear })
.color("#ED2800")
.backgroundColor($r('app.color.white'))
.width("100%")
.height(3)
.margin({ top: 57 })
.value(this.progressVal)
.visibility(this.isExpand ? Visibility.Visible : Visibility.Hidden)
Stack({ alignContent: Alignment.End }) {
Column() { //标题 时间 进度条
Marquee({
... ... @@ -139,13 +147,6 @@ struct Index {
.width("100%")
.height(16)
.margin({ top: 4})
Progress({ value: this.progressVal, total: 100, type: ProgressType.Capsule })
.color("#ED2800")
.backgroundColor($r('app.color.white'))
.width("100%")
.height(3)
.margin({ top: 7 })
}
.padding({
top: 10,
... ... @@ -241,12 +242,6 @@ struct Index {
)
)
.borderRadius(4)
.padding({
top: 10,
bottom: 10,
left: 10,
right: 0
})
.backgroundColor(Color.White)
}
}
\ No newline at end of file
... ...