Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
liyubing
2024-06-05 11:27:17 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
fc80b39e70741e85022d78724e390cc4bd645052
fc80b39e
2 parents
360f5285
3068cd41
Merge remote-tracking branch 'origin/main'
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
350 additions
and
111 deletions
sight_harmony/AppScope/resources/base/media/icon_no_net1.png
sight_harmony/commons/wdShareBase/src/main/ets/System/WDSystemShare.ets
sight_harmony/features/wdComponent/src/main/ets/components/CardParser.ets
sight_harmony/features/wdComponent/src/main/ets/components/DynamicDetailComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/EditUserInfoPage.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/EditUserIntroductionPage.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/EditUserNikeNamePage.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/InteractMessagePage.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/MyCollectionListPage.ets
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchCreatorComponent.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/PageHelper.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerProgressView.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/EmptyComponent.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginProtocolWebview.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/OneKeyLoginPage.ets
sight_harmony/features/wdPlayer/src/main/ets/controller/WDPlayerController.ets
sight_harmony/AppScope/resources/base/media/icon_no_net1.png
0 → 100644
View file @
fc80b39
47.6 KB
sight_harmony/commons/wdShareBase/src/main/ets/System/WDSystemShare.ets
View file @
fc80b39
...
...
@@ -79,13 +79,22 @@ export class WDSystemShare implements WDShareInterface {
}
generateShareLink(shareContent: ShareContentLink) {
let link = "https://peopledailychinahosactivity.drcn.agconnect.link/?deeplink=" + encodeURI(shareContent.deeplink)
link += "&harmonyos_deeplink=" + encodeURI(shareContent.deeplink)
let link = "https://peopledailychinahosactivity.drcn.agconnect.link?deeplink=" + encodeURIComponent(shareContent.deeplink)
link += "&harmonyos_deeplink=" + encodeURIComponent(shareContent.deeplink)
link += "&harmonyos_package_name=com.peopledailychina.hosactivity"
link += "&harmonyos_fallback_url=" + encodeURI(shareContent.link)
link += "&harmonyos_fallback_url=" + encodeURIComponent(shareContent.link)
// link += "&android_deeplink=" + encodeURIComponent(shareContent.deeplink)
// link += "&android_fallback_url=" + encodeURIComponent(shareContent.link)
//
// link += "&ios_link=" + encodeURIComponent(shareContent.deeplink)
// link += "&ios_fallback_url=" + encodeURIComponent(shareContent.link)
link += "&preview_type=1"
link += "&landing_page_type=1"
// link += "&social_desc=" + encodeURIComponent(shareContent.desc || " ")
// link += "&social_image=" + encodeURI(shareContent.icon || " ")
// link += "&social_image=" + encodeURI
Component
(shareContent.icon || " ")
// link += "&social_title=" + encodeURIComponent(shareContent.title)
link += "®ion_id=0"
return link
...
...
sight_harmony/features/wdComponent/src/main/ets/components/CardParser.ets
View file @
fc80b39
import { CompStyle } from 'wdConstant';
import { CompDTO, ContentDTO } from 'wdBean';
import { Card2Component } from './cardview/Card2Component';
//
import { Card3Component } from './cardview/Card3Component';
import { Card3Component } from './cardview/Card3Component';
import { Card4Component } from './cardview/Card4Component';
import { Card5Component } from './cardview/Card5Component';
import { Card6Component } from './cardview/Card6Component';
...
...
@@ -60,11 +60,13 @@ export struct CardParser {
} else {
if (contentDTO.appStyle === CompStyle.Card_02) {
Card2Component({ compDTO: this.compDTO, contentDTO, pageId: this.pageId, pageName: this.pageName })
} else if (contentDTO.appStyle === CompStyle.Card_04) {
} else if (contentDTO.appStyle === CompStyle.Card_03) {
Card3Component({ compDTO: this.compDTO, contentDTO, pageId: this.pageId, pageName: this.pageName })
}else if (contentDTO.appStyle === CompStyle.Card_04) {
Card4Component({ compDTO: this.compDTO, contentDTO, pageId: this.pageId, pageName: this.pageName })
} else if (contentDTO.appStyle === CompStyle.Card_05) {
}
else if (contentDTO.appStyle === CompStyle.Card_05) {
Card5Component({ compDTO: this.compDTO, contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy, pageId: this.pageId, pageName: this.pageName})
} else if (contentDTO.appStyle === CompStyle.Card_06 ) {
} else if (contentDTO.appStyle === CompStyle.Card_06
|| contentDTO.appStyle === CompStyle.Card_13
) {
Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO, pageId: this.pageId, pageName: this.pageName })
} else if (contentDTO.appStyle === CompStyle.Card_10) {
Card10Component({ compDTO: this.compDTO, contentDTO, pageId: this.pageId, pageName: this.pageName })
...
...
sight_harmony/features/wdComponent/src/main/ets/components/DynamicDetailComponent.ets
View file @
fc80b39
...
...
@@ -442,7 +442,7 @@ export struct DynamicDetailComponent {
this.contentDetailData.fullColumnImgUrls.length > 0 &&
!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url) ?
this.contentDetailData.fullColumnImgUrls[0].url :
this.contentDetailData.
videoInfo[0].
firstFrameImageUri)
this.contentDetailData.firstFrameImageUri)
.width(DisplayUtils.getDeviceWidth() - 32)
.height((DisplayUtils.getDeviceWidth() - 32) * 9 / 16)
.borderRadius($r('app.float.image_border_radius'))
...
...
@@ -460,7 +460,7 @@ export struct DynamicDetailComponent {
this.contentDetailData.fullColumnImgUrls.length > 0 &&
!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url) ?
this.contentDetailData.fullColumnImgUrls[0].url :
this.contentDetailData.
videoInfo[0].
firstFrameImageUri)
this.contentDetailData.firstFrameImageUri)
.width(DisplayUtils.getDeviceWidth() / 2)
.height(DisplayUtils.getDeviceWidth() / 2 * 4 / 3)
.borderRadius($r('app.float.image_border_radius'))
...
...
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
View file @
fc80b39
...
...
@@ -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)
})
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/EditUserInfoPage.ets
View file @
fc80b39
...
...
@@ -19,7 +19,8 @@ struct EditUserInfoPage {
@State headerImg: string = ''
@State dataSource: AreaListModel[] = []
@State currentUserInfo: editModel = new editModel()
@State bottomSafeHeight: number = 0;
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
dialogController: CustomDialogController = new CustomDialogController({
builder: AreaPickerDialog({dataSource:this.dataSource,
...
...
@@ -34,10 +35,7 @@ struct EditUserInfoPage {
}),
alignment: DialogAlignment.Bottom,
customStyle: true,
offset: {
dx: 0,
dy: -this.bottomSafeHeight
},
closeAnimation:{duration:0}
})
dateDialogController: CustomDialogController = new CustomDialogController({
...
...
@@ -53,10 +51,7 @@ struct EditUserInfoPage {
}),
alignment: DialogAlignment.Bottom,
customStyle: true,
offset: {
dx: 0,
dy: -this.bottomSafeHeight
},
closeAnimation:{duration:0}
})
sexDialogController: CustomDialogController = new CustomDialogController({
...
...
@@ -69,15 +64,10 @@ struct EditUserInfoPage {
}),
alignment: DialogAlignment.Bottom,
customStyle: true,
offset: {
dx: 0,
dy: -this.bottomSafeHeight
},
closeAnimation:{duration:0}
})
async aboutToAppear() {
let windowHight: window.Window = await window.getLastWindow(getContext(this));
this.bottomSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).bottomRect.height)
aboutToAppear() {
this.getAccountOwnerInfo()
this.getAreaList()
}
...
...
@@ -142,6 +132,7 @@ struct EditUserInfoPage {
}
.width('100%')
.height('100%')
.padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
}
@Builder
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/EditUserIntroductionPage.ets
View file @
fc80b39
...
...
@@ -9,6 +9,8 @@ struct EditUserIntroductionPage {
@State textColor : string = '#222222'
@State introduction: string = ''
@State params:editModelParams = router.getParams() as editModelParams;
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
build() {
Column(){
CustomTitleUI({titleName:'修改简介'})
...
...
@@ -63,6 +65,7 @@ struct EditUserIntroductionPage {
this.updateEditModel()
})
}
.padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/EditUserNikeNamePage.ets
View file @
fc80b39
...
...
@@ -12,6 +12,8 @@ struct EditUserNikeNamePage {
@State textColor : string = '#222222'
@State nikeName: string = ''
@State params:editModelParams = router.getParams() as editModelParams;
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
build() {
Column(){
CustomTitleUI({titleName:'修改昵称'})
...
...
@@ -66,7 +68,7 @@ struct EditUserNikeNamePage {
///内部更新
this.updateEditModel()
})
}
}
.padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
}
async updateEditModel(){
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/InteractMessagePage.ets
View file @
fc80b39
...
...
@@ -20,6 +20,8 @@ struct InteractMessagePage {
private scroller: Scroller = new Scroller();
@State likeNum: number = 0
@State currentPage: number = 1;
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
aboutToAppear(){
this.getData()
...
...
@@ -58,6 +60,8 @@ struct InteractMessagePage {
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
}
@Builder ListLayout() {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/MyCollectionListPage.ets
View file @
fc80b39
...
...
@@ -34,6 +34,8 @@ struct MyCollectionListPage {
@State currentPage: number = 1;
private scroller: Scroller = new Scroller();
emptyType: WDViewDefaultType = WDViewDefaultType.WDViewDefaultType_Default
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
dialogController: CustomDialogController = new CustomDialogController({
builder: MyCustomDialog({
...
...
@@ -120,6 +122,8 @@ struct MyCollectionListPage {
.backgroundColor('#FFFFFF')
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
}
@Builder ListLayout() {
...
...
@@ -149,16 +153,14 @@ struct MyCollectionListPage {
selectCallback:(isOn)=>{
this.addCompDTO(isOn,compDTO)
}
})
.margin({left:16})
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 });
}).margin({left:16})
}
Column() {
BigPicCardComponent({compDTO:new CompDTO,contentDTO:compDTO,pageId:TrackConstants.PageName.My_Collect,pageName:TrackConstants.PageName.My_Collect})
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 });
}
}.onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {
if (isVisible) {
if (isVisible
&& !this.isEditState
) {
TrackingContent.common(TrackConstants.EventType.Show, TrackConstants.PageName.My_Collect,TrackConstants.PageName.My_Collect, TrackParamConvert.program(compDTO))
}
})
...
...
@@ -291,6 +293,7 @@ struct MyCollectionListPage {
compDTO.interactData = this.commentList[index]
datas.push(compDTO)
}
this.allDatas = []
this.allDatas.push(...datas)
} catch (exception) {
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchCreatorComponent.ets
View file @
fc80b39
...
...
@@ -30,7 +30,7 @@ export struct SearchCreatorComponent{
.fontSize('25lpx')
.fontWeight('400lpx')
.lineHeight('35lpx')
.constraintSize({maxWidth:'1
50
lpx'})
.constraintSize({maxWidth:'1
25
lpx'})
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.alignItems(HorizontalAlign.Center)
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/PageHelper.ets
View file @
fc80b39
...
...
@@ -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)
}
})
})
}
}
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerProgressView.ets
View file @
fc80b39
...
...
@@ -11,7 +11,9 @@ export struct PlayerProgressView {
@Consume isDragging: boolean
@Consume status: number
@State videoDuration: number = this.contentDetailData?.videoInfo?.[0]?.videoDuration || 1
@State loadingTop: number = 10
@State loadingWidth: number | string = 1
@State showLoading: boolean = false
aboutToAppear() {
if (this.playerController) {
this.playerController.onStatusChange = (status: number) => {
...
...
@@ -20,55 +22,95 @@ export struct PlayerProgressView {
this.playerController.onSeekDone = (status: number) => {
this.playerController?.play()
}
this.playerController.onLoaded = (loaded: number) => {
if(loaded == 1) {
this.loadingWidth = '95%'
this.showLoading = true
} else {
this.loadingWidth = 1
this.showLoading = false
}
}
}
}
build() {
Column() {
Text() {
Span(DateTimeUtils.secondToTime(Math.floor(this.progressVal / 100 * this.videoDuration)))
Span(' / ')
Span(DateTimeUtils.secondToTime(this.videoDuration))
}
.fontSize(24)
.fontColor(Color.White)
.fontWeight(600)
.margin({ bottom: 30 })
.visibility(this.isDragging ? Visibility.Visible : Visibility.None)
/**
*
* loading 动效
*/
@Builder
playerLoadingBuilder() {
Slider({
value: this.progressVal,
step: 0.01,
// style: SliderStyle.OutSet
})
.blockColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? $r('app.color.play_block_color') :
Color.Transparent)
.trackColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ?
$r('app.color.pause_track_color') : $r('app.color.play_track_color'))
.selectedColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ?
$r('app.color.pause_selected_color') : $r('app.color.play_selected_color'))
.trackThickness(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? 4 : 1)
.blockStyle({
type: this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? SliderBlockType.IMAGE :
SliderBlockType.DEFAULT,
image: $r('app.media.ic_player_block')
})
.blockSize({ width: 18, height: 12 })
.width('100%')
.height(19)
.onChange((value: number, mode: SliderChangeMode) => {
this.progressVal = value
if (mode === SliderChangeMode.Moving) {
this.isDragging = true
}
if (mode === SliderChangeMode.End) {
this.isDragging = false
Flex({
direction: FlexDirection.Row,
justifyContent: FlexAlign.Center,
alignItems: ItemAlign.End
}) {
Text('')
.backgroundColor(Color.Gray)
.width(this.loadingWidth)
.height(1)
.animation({ duration: 500, curve: Curve.Ease, iterations: -1, playMode: PlayMode.Normal })
}
.width('100%')
.zIndex(2000)
.visibility(this.showLoading ? Visibility.Visible: Visibility.Hidden)
.margin({ bottom: 10 })
// .markAnchor({ x: 0, y: '100%' })
}
build() {
Stack() {
this.playerLoadingBuilder()
if(!this.showLoading) {
Column() {
Text() {
Span(DateTimeUtils.secondToTime(Math.floor(this.progressVal / 100 * this.videoDuration)))
Span(' / ')
Span(DateTimeUtils.secondToTime(this.videoDuration))
}
this.playerController?.setSeekTime(value, mode);
console.log('slider onChange:', value, mode)
.fontSize(24)
.fontColor(Color.White)
.fontWeight(600)
.margin({ bottom: 30 })
.visibility(this.isDragging ? Visibility.Visible : Visibility.None)
Slider({
value: this.progressVal,
step: 0.01,
// style: SliderStyle.OutSet
})
.blockColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? $r('app.color.play_block_color') :
Color.Transparent)
.trackColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ?
$r('app.color.pause_track_color') : $r('app.color.play_track_color'))
.selectedColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ?
$r('app.color.pause_selected_color') : $r('app.color.play_selected_color'))
.trackThickness(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? 4 : 1)
.blockStyle({
type: this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? SliderBlockType.IMAGE :
SliderBlockType.DEFAULT,
image: $r('app.media.ic_player_block')
})
.blockSize({ width: 18, height: 12 })
.width('100%')
.height(19)
.onChange((value: number, mode: SliderChangeMode) => {
this.progressVal = value
if (mode === SliderChangeMode.Moving) {
this.isDragging = true
}
if (mode === SliderChangeMode.End) {
this.isDragging = false
}
this.playerController?.setSeekTime(value, mode);
console.log('slider onChange:', value, mode)
})
})
}
.visibility(this.isOpenDetail ? Visibility.None : Visibility.Visible)
}
}
.visibility(this.isOpenDetail ? Visibility.None : Visibility.Visible)
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/EmptyComponent.ets
0 → 100644
View file @
fc80b39
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
}
}
}
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginProtocolWebview.ets
View file @
fc80b39
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,20 +70,27 @@ struct LoginProtocolWebview {
.alignItems(VerticalAlign.Center)
.width('100%')
.height(44)
Web({ src: this.webUrl, controller: this.webviewController })
.domStorageAccess(true)
.databaseAccess(true)
.javaScriptAccess(true)
.zoomAccess(false)
.horizontalScrollBarAccess(false)
.verticalScrollBarAccess(false)
.onHttpErrorReceive((event) => {
//TODO 页面加载不成功的时候处理
Logger.info(TAG, 'onHttpErrorReceive event.request.getRequestUrl:' + event?.request.getRequestUrl());
Logger.info(TAG, 'onHttpErrorReceive event.response.getResponseCode:' + event?.response.getResponseCode());
})
.padding({bottom:this.contentID === "2" ? "40lpx" : 0 })
if(this.isConnectNetwork){
Web({ src: this.webUrl, controller: this.webviewController })
.domStorageAccess(true)
.databaseAccess(true)
.javaScriptAccess(true)
.zoomAccess(false)
.horizontalScrollBarAccess(false)
.verticalScrollBarAccess(false)
.onHttpErrorReceive((event) => {
//TODO 页面加载不成功的时候处理
Logger.info(TAG, 'onHttpErrorReceive event.request.getRequestUrl:' + event?.request.getRequestUrl());
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%")
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/OneKeyLoginPage.ets
View file @
fc80b39
...
...
@@ -13,6 +13,7 @@ const TAG = "OneKeyLoginPage"
@Entry
@Component
struct OneKeyLoginPage {
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
anonymousPhone: string = ''
@State agreeProtocol: boolean = false
viewModel: LoginViewModel = new LoginViewModel()
...
...
@@ -121,6 +122,7 @@ struct OneKeyLoginPage {
})
}
.backgroundColor("#FFFFFF")
.padding({top: `${this.topSafeHeight}px`})
}
@Builder ProtocolRow() {
...
...
sight_harmony/features/wdPlayer/src/main/ets/controller/WDPlayerController.ets
View file @
fc80b39
...
...
@@ -27,6 +27,7 @@ export class WDPlayerController {
private prepareTime:number = 0; //加载时间
private currentPlayTime:number = 0; //当前播放时间
public onVideoSizeChange?: (width: number, height: number) => void;
public onLoaded?: (loaded: number) => void;
public onTimeUpdate?: (position: number, duration: number) => void;
public onVolumeUpdate?: (volume: number) => void;
public continue?: () => void;
...
...
@@ -86,6 +87,9 @@ export class WDPlayerController {
if (this.surfaceId) {
this.avPlayer.surfaceId = this.surfaceId;
}
if(this.onLoaded) {
this.onLoaded(1)
}
this.avPlayer?.prepare();
break;
...
...
@@ -101,6 +105,9 @@ export class WDPlayerController {
}
break;
case AVPlayerStatus.PLAYING:
if(this.onLoaded) {
this.onLoaded(2)
}
this.setBright();
this.status = PlayerConstants.STATUS_START;
this.avPlayer!.videoScaleType = media.VideoScaleType.VIDEO_SCALE_TYPE_FIT
...
...
Please
register
or
login
to post a comment