王士厅
Showing 34 changed files with 439 additions and 221 deletions
... ... @@ -98,4 +98,8 @@ export class DeviceUtil {
static isTablet(): boolean {
return deviceInfo.deviceType == 'tablet';
}
static is2in1(): boolean {
return deviceInfo.deviceType == '2in1';
}
}
... ...
... ... @@ -43,6 +43,9 @@ export class WindowModel {
return this.windowClass as window.Window
}
/**
* @deprecated 应用整体全屏,不需要再设置全屏与否了。
*/
setMainWindowFullScreen(fullScreen: boolean) {
if (deviceInfo.deviceType != "phone") {
return
... ... @@ -140,6 +143,9 @@ export class WindowModel {
return this.windowClass?.getWindowProperties()
}
/**
* @deprecated 应用整体全屏,不需要再设置全屏与否了。
*/
setWindowLayoutFullScreen(isFullScreen: boolean) {
this.isFullScreen = isFullScreen
this.windowClass?.setWindowLayoutFullScreen(isFullScreen)
... ...
... ... @@ -60,12 +60,12 @@ export struct CarderInteraction {
})
}
if(this.contentDetailData.rmhInfo != null){
if(this.contentDetailData.shareInfo != null && 1 == this.contentDetailData.shareInfo.shareOpen && 1 == this.contentDetailData.rmhInfo.cnShareControl){
this.shareLayout()
if(this.contentDTO.rmhInfo != null){
if(this.contentDTO.shareInfo != null && 1 == this.contentDTO.shareInfo.shareOpen && 1 == this.contentDTO.rmhInfo.cnShareControl){
this.commentLayout()
}
}else{
this.shareLayout()
this.commentLayout()
}
this.builderLike()
... ... @@ -81,7 +81,7 @@ export struct CarderInteraction {
}
@Builder
shareLayout() {
commentLayout() {
Row() {
Image($r('app.media.CarderInteraction_comment'))
.width(18)
... ...
... ... @@ -82,7 +82,6 @@ export struct CompParser {
if (this.compDTO.operDataList[0]?.objectType !== '3' &&
this.compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
if (this.compDTO.compStyle === CompStyle.Label_03) {
LabelComponent({ compDTO: this.compDTO })
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
... ... @@ -108,7 +107,7 @@ export struct CompParser {
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_03) {
ZhSingleRow03({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { //双列流小视频,一行两图卡 ->标题
//ZhGridLayout02({ compDTO: this.compDTO })
CompNormalTitle({ compDTO: this.compDTO })
... ... @@ -136,7 +135,7 @@ export struct CompParser {
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_03) {
// 大图卡
Card2Component({ compDTO: this.compDTO, contentDTO: this.compDTO.operDataList[0], pageId: this.pageId, pageName: this.pageName })
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (this.compDTO.compStyle === CompStyle.Card_09) {
//时间链卡
Card9Component({ compDTO: this.compDTO, contentDTO:this.compDTO.operDataList[0], pageId: this.pageId, pageName: this.pageName })
... ...
... ... @@ -17,7 +17,7 @@ export struct topicInfoView {
// } as FrontLinkObject
frontLinkObject: FrontLinkObject = {} as FrontLinkObject
@State isExpansion:boolean = false
aboutToAppear() {
}
... ... @@ -32,10 +32,10 @@ export struct topicInfoView {
})
.id('img_cover')
if (this.frontLinkObject.linkUrl.length > 0) {
if (this.frontLinkObject.linkUrl.length > 0 || this.frontLinkObject?.newsId.length > 0) {
Row() {
Text("查看详情")
.fontSize(14)
.fontSize(12)
.fontColor($r('app.color.white'))
.maxLines(1)
.borderRadius(2)
... ... @@ -54,10 +54,12 @@ export struct topicInfoView {
contentDTO.objectType = this.frontLinkObject?.newsType.toString()
contentDTO.objectId = this.frontLinkObject?.newsId
contentDTO.linkUrl = this.frontLinkObject?.linkUrl
contentDTO.relId = this.frontLinkObject?.newsRelId.toString()
contentDTO.relType = this.frontLinkObject?.newsType.toString()
ProcessUtils.processPage(contentDTO)
})
.width(80)
.width(70)
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom }
... ... @@ -65,17 +67,25 @@ export struct topicInfoView {
.id('row_detail')
}
Row(){
Text(this.frontLinkObject?.summary ?? "")
.margin({ top: 10 })
.fontSize(14)
.fontColor($r('app.color.white'))
.maxLines(3)
.fontColor('#CCFFFFFF')
.maxLines(this.isExpansion?999:3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Text(this.isExpansion?'收起':'展开').onClick(()=>{
this.isExpansion = !this.isExpansion
})
.fontSize(14)
.fontColor($r('app.color.white'))
}.alignItems(VerticalAlign.Bottom)
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
bottom: this.frontLinkObject.linkUrl.length > 0?{ anchor: "row_detail", align: VerticalAlign.Top }:{ anchor: "__container__", align: VerticalAlign.Bottom }
bottom: this.frontLinkObject.linkUrl.length > 0 || this.frontLinkObject?.newsId.length > 0 ?{ anchor: "row_detail", align: VerticalAlign.Top }:{ anchor: "__container__", align: VerticalAlign.Bottom }
})
.margin({ left: 16, right: 16, bottom: this.frontLinkObject.linkUrl.length > 0?0:16})
.margin({top: 10 , left: 16, right: 16, bottom: this.frontLinkObject.linkUrl.length > 0 || this.frontLinkObject?.newsId.length > 0 ?10:16})
.id('txt_summary')
Text(this.frontLinkObject?.title ?? "")
... ...
... ... @@ -53,7 +53,7 @@ export struct Card5Component {
}
)
.aspectRatio(343 / 225)
if (this.titleShowPolicy === 1 || this.titleShowPolicy === null || this.titleShowPolicy === '') {
if (!!this.titleShowPolicy) {
Row()
.borderRadius(
{
... ...
... ... @@ -88,7 +88,7 @@ export struct Card6Component {
.fontSize(18)
.lineHeight(27)
.fontWeight(FontWeight.Normal)
.maxLines(this.contentDTO.appStyle === '6' ? 4 : 2)
.maxLines(this.contentDTO.appStyle === '6' ? 4 : 3)
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
... ... @@ -107,7 +107,7 @@ export struct Card6Component {
}
.alignItems(HorizontalAlign.Start)
.height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78 : 156)
.height(this.contentDTO.appStyle === CompStyle.Card_13 ? '' : 156)
.justifyContent(FlexAlign.SpaceBetween)
... ... @@ -138,7 +138,8 @@ export struct Card6Component {
})
.width(CommonConstants.FULL_WIDTH)
.height(this.contentDTO.appStyle === CompStyle.Card_13 ? 106 : 184) .justifyContent(FlexAlign.SpaceBetween)
.height(this.contentDTO.appStyle === CompStyle.Card_13 ? '' : 184)
.justifyContent(FlexAlign.SpaceBetween)
.alignItems(VerticalAlign.Top)
}
}
... ...
... ... @@ -44,10 +44,14 @@ export struct ZhSingleRow04 {
.onClick(() => {
if (this.compDTO?.objectType === '11') {
ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle)
} else if (this.compDTO?.objectType === '5') {
ProcessUtils._gotoSpecialTopic(this.compDTO.linkUrl)
} else if (this.compDTO?.objectType === '6') {
ProcessUtils._gotoDefaultWeb(this.compDTO.linkUrl)
} else {
const contentDTO: ContentDTO = {
objectId: this.compDTO.objectId,
objectType: this.compDTO.objectType,
linkUrl: this.compDTO.linkUrl,
pageId: this.compDTO.pageId
} as ContentDTO
ProcessUtils.processPage(contentDTO)
}
})
}
... ... @@ -84,6 +88,7 @@ export struct ZhSingleRow04 {
.scrollBar(BarState.Off)
.width(CommonConstants.FULL_PARENT)
.height(166)
.edgeEffect(EdgeEffect.None)
}
.width(CommonConstants.FULL_WIDTH)
.backgroundColor($r("app.color.white"))
... ...
... ... @@ -19,6 +19,7 @@ const TAG = 'MinePageComponent';
*/
@Component
export struct MinePageComponent {
private topRectHeight: string = AppStorage.get<number>('topSafeHeight') + 'px';
//是否是创作者
@State isCreator:boolean = false
@State isLogin:boolean = false //默认 false 测试放开
... ... @@ -167,6 +168,8 @@ export struct MinePageComponent {
.backgroundColor($r('app.color.color_F9F9F9'))
.scrollable(ScrollDirection.Vertical)
.scrollBar(BarState.Off)
// 预留状态栏、导航栏高度
.margin({ top: this.topRectHeight})
}
... ...
... ... @@ -22,6 +22,7 @@ const storage = LocalStorage.getShared();
@Entry(storage)
@Component
export struct TopNavigationComponentNew {
private topRectHeight: string = AppStorage.get<number>('topSafeHeight') + 'px';
/**
* @deprecated
*/
... ... @@ -85,6 +86,7 @@ export struct TopNavigationComponentNew {
navIndex: index,
pageId: navItem?.pageId + '',
channelId: navItem?.channelId + '',
autoRefresh: this.autoRefresh2Page
})
} else
if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
... ... @@ -137,6 +139,8 @@ export struct TopNavigationComponentNew {
.width('100%')
.height('100%')
}
// 预留状态栏
.margin({ top: this.topRectHeight })
}
@Builder
... ...
... ... @@ -14,7 +14,6 @@ import {
import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType';
import { channelSkeleton } from '../skeleton/channelSkeleton'
import { EmptyComponent } from '../view/EmptyComponent';
import { ErrorComponent } from '../view/ErrorComponent';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import MinePageDatasModel from '../../model/MinePageDatasModel';
import { FollowListDetailRequestItem } from '../../viewmodel/FollowListDetailRequestItem';
... ... @@ -26,13 +25,14 @@ import PageHelper from '../../viewmodel/PageHelper';
import { PeopleShipAttentionContentListTopComponent } from './PeopleShipAttentionContentListTopComponent'
import { CardParser } from '../CardParser'
import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData';
const TAG = 'PeopleShipMainComponent';
@Preview
@Component
export struct PeopleShipMainComponent {
@State private pageModel: PageModel = new PageModel();
@State private pageAdvModel: PageAdModel = new PageAdModel();
// 自动刷新通知
@Prop @Watch('onAutoRefresh') autoRefresh: number = 0
navIndex: number = 0;
pageId: string = "";
channelId: string = "";
... ... @@ -416,4 +416,13 @@ export struct PeopleShipMainComponent {
}
}
onAutoRefresh(changedPropertyName: string) {
if (this.navIndex != this.currentTopNavSelectedIndex) {
return
}
// 当前页面,自动刷新数据
Logger.debug(TAG, 'page onAutoRefresh ' + this.autoRefresh)
this.currentPage = 1
this.getData()
}
}
\ No newline at end of file
... ...
... ... @@ -133,6 +133,7 @@ struct MineHomePage {
.backgroundImageSize(ImageSize.Cover)
.padding({left:"17lpx",right:"8lpx"})
.height('35lpx')
.borderRadius({topRight:2,bottomRight:2})
}
Blank()
... ...
... ... @@ -40,8 +40,6 @@ export struct DetailPlayLivePage {
@State lastInputedLiveComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的直播间消息
@State lastInputedChatComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的大家聊消息
aboutToAppear(): void {
Logger.info(TAG, `wyj-aboutToAppear`)
... ... @@ -72,7 +70,6 @@ export struct DetailPlayLivePage {
TopPlayComponent({ playerController: this.playerController })
.height(this.displayDirection == DisplayDirection.VERTICAL ? 211 : '100%')
TabComponent({
tabs: this.tabs,
changeToTab: this.changeToTab,
... ...
import { LiveRoomDataBean } from 'wdBean/Index';
import { ContentDetailDTO, LiveRoomDataBean } from 'wdBean/Index';
import { LiveViewModel } from '../viewModel/LiveViewModel';
import { WindowModel } from 'wdKit/Index';
import { PlayerComponent } from '../widgets/vertical/PlayerComponent';
... ... @@ -22,6 +22,7 @@ export struct DetailPlayVLivePage {
private liveViewModel: LiveViewModel = new LiveViewModel()
private playerController: WDAliPlayerController = new WDAliPlayerController();
private swiperController: SwiperController = new SwiperController()
@Consume contentDetailData: ContentDetailDTO
@Provide bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@Provide liveRoomDataBean: LiveRoomDataBean = {} as LiveRoomDataBean
... ... @@ -36,6 +37,9 @@ export struct DetailPlayVLivePage {
@Consume contentId: string
@State swiperIndex: number = 1
@Consume liveDetailPageLogic: LiveDetailPageLogic
//播放错误
@State isPlayerError: boolean = false
@State isCanplay: boolean = false
aboutToAppear(): void {
this.openFullScreen()
... ... @@ -78,28 +82,27 @@ export struct DetailPlayVLivePage {
LiveEmptyComponent({
emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend
})
.height('30%').margin({top:this.topSafeHeight })
.height('40%').margin({ top: this.topSafeHeight })
} else {
if (this.liveDetailPageLogic.showPad) {
// 有垫片
if(this.liveDetailPageLogic.padImageUri.length > 0){
if (this.liveDetailPageLogic.padImageUri.length > 0) {
// 配置了垫片资源
Image(this.liveDetailPageLogic.padImageUri).objectFit(ImageFit.Fill).width('100%').height('100%')
}else {
} else {
// 没有配置垫片资源
LiveEmptyComponent({
emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend
})
.height('30%').margin({top:this.topSafeHeight })
.height('40%').margin({ top: this.topSafeHeight })
}
} else {
// 播放器
PlayerComponent({
playerController: this.playerController
playerController: this.playerController, isPlayerError: this.isPlayerError, isCanplay: this.isCanplay
})
}
}
... ... @@ -110,6 +113,44 @@ export struct DetailPlayVLivePage {
swiperController: this.swiperController,
swiperIndex: $swiperIndex
})
// 直播资源加载失败
Column() {
Text('直播加载中,请稍候重试')
.fontSize('20fp')
.fontWeight(500)
.margin({ top: 16 })
.fontColor(Color.White)
Button('点击重试')
.type(ButtonType.Normal)
.width(80)
.height(28)
.backgroundColor(Color.Transparent)
.fontColor('#ffcccccc')
.border({ width: 1 })
.borderColor('#4dffffff')
.borderRadius(4)
.fontSize($r('app.float.font_size_12'))
.margin({ top: 16 })
.padding(0)
.onClick(() => {
this.isCanplay = false
this.isPlayerError = false
this.playerController?.firstPlay(this.playUrl, TrackConstants.PageName.Live_Detail, {
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
});
})
}
.width('100%')
.margin({ top: 195 })
.justifyContent(FlexAlign.Center)
.visibility(this.isPlayerError ? Visibility.Visible :
Visibility.None)
// 清屏按钮
Image($r('app.media.icon_live_more'))
.width(40)
... ...
... ... @@ -25,7 +25,7 @@ export struct TopPlayComponent {
//已结束直播
@State isEnd: boolean = false
//播放错误
@State isError: boolean = false
@State isPlayerError: boolean = false
// loading 控制字段
@State isHideLoading: boolean = false
// 获取播放资源能播放了
... ... @@ -50,14 +50,14 @@ export struct TopPlayComponent {
this.playSourceState = status
Logger.debug(TAG, 'status==>' + status)
if (status === PlayerConstants.STATUS_ERROR) {
this.isError = true
this.isPlayerError = true
this.isHideLoading = true
this.isCanPlay = false
} else if (status === PlayerConstants.STATUS_COMPLETION) {
// 播放完成
} else {
this.isError = false
this.isPlayerError = false
}
}
... ... @@ -186,7 +186,7 @@ export struct TopPlayComponent {
onLoad: async () => {
if (StringUtils.isNotEmpty(this.playUrl)) {
this.isHideLoading = false
this.isError = false
this.isPlayerError = false
this.xComponentIsLoaded = true
Logger.debug(TAG, `---onLoad------>`)
this.tryToPlay()
... ... @@ -265,12 +265,12 @@ export struct TopPlayComponent {
.padding(0)
.onClick(() => {
this.isHideLoading = false
this.isError = false
this.isPlayerError = false
this.xComponentIsLoaded = true
this.tryToPlay()
})
}.width('100%').visibility(this.isError ? Visibility.Visible :
}.width('100%').visibility(this.isPlayerError ? Visibility.Visible :
Visibility.None)
}
... ...
... ... @@ -14,6 +14,7 @@ import { EmitterEventId, EmitterUtils, Logger, SPHelper, WindowModel } from 'wdK
import { TrackConstants, TrackingContent, TrackParamConvert } from 'wdTracking/Index'
const TAG = "PlayerCommentComponent"
/**
* 沉浸式直播--- 聊天区域
*/
... ... @@ -52,7 +53,7 @@ export struct PlayerCommentComponent {
this.liveViewModel.getLiveCommentList(
1,
this.contentDetailData?.liveInfo?.mlive?.mliveId,
this.contentDetailData?.newsId+'',
this.contentDetailData?.newsId + '',
20,)
.then(
(data) => {
... ... @@ -82,6 +83,7 @@ export struct PlayerCommentComponent {
build() {
Column() {
Stack({ alignContent: Alignment.BottomStart }) {
List({ scroller: this.scroller }) {
// 主持人
if (this.contentDetailData.oldNewsId) {
... ... @@ -93,10 +95,10 @@ export struct PlayerCommentComponent {
}
})
}
.height(280)
.width('80%')
.scrollBar(BarState.Off)
.margin({ bottom: 20 })
}.height(280)
// 收藏、分享、点赞是否需要根据字段显隐
LiveOperRowListView({
... ...
import { ContentDetailDTO } from 'wdBean/Index';
import { AliPlayerRenderView, WDAliPlayerController, WDPlayerRenderVLiveView } from 'wdPlayer/Index';
import { AliPlayerRenderView, PlayerConstants, WDAliPlayerController, WDPlayerRenderVLiveView } from 'wdPlayer/Index';
import { ParamType, TrackConstants } from 'wdTracking/Index';
import { PictureLoading } from './PictureLoading';
... ... @@ -20,8 +20,10 @@ export struct PlayerComponent {
// 0-横屏流画面,1-竖屏幕流画面
@State liveStreamType: number | null = -1
@State playUrl: string = ''
@State isCanplay: boolean = false
pageParam: ParamType = {}
// 播放失败
@Link isPlayerError: boolean
@Link isCanplay: boolean
pageShowChange() {
this.playerController?.play()
... ... @@ -31,10 +33,33 @@ export struct PlayerComponent {
this.playerController?.pause()
}
async aboutToAppear(): Promise<void> {
aboutToAppear(){
if (this.playerController) {
this.playerController.onCanplay = () => {
this.isCanplay = true
this.playerController?.play()
}
this.playerController.onStatusChange = (status: number) => {
if (status === PlayerConstants.STATUS_ERROR) {
this.isPlayerError = true
this.isCanplay = true
} else if (status === PlayerConstants.STATUS_COMPLETION) {
// 播放完成
} else {
//this.isPlayerError = false
}
}
}
setTimeout(() => {
this.updateData()
}, 10)
}
async aboutToDisappear(): Promise<void> {
... ... @@ -65,17 +90,16 @@ export struct PlayerComponent {
this.liveStreamType = liveStreamType
this.playUrl = playUrl
}
console.error("XXXXZZZZ", 'updateData ----liveState==>' + this.playUrl)
}
build() {
Column() {
Stack() {
// TODO:判断横竖屏,liveStreamType=1竖屏铺满屏幕,裁剪不拉伸,liveStreamType=0横屏正常展示
if (this.liveStreamType == null || this.liveStreamType == 1) {
WDPlayerRenderVLiveView({
playerController: this.playerController,
onLoad: () => {
console.error("XXXXZZZZ", '-------------1--------' + this.playUrl)
this.isCanplay = true
this.contentTrackingDict()
this.playerController?.firstPlay(this.playUrl, TrackConstants.PageName.Live_Detail, this.pageParam);
... ... @@ -94,21 +118,14 @@ export struct PlayerComponent {
PictureLoading().visibility(this.isCanplay ? Visibility.None : Visibility.Visible)
}
.height('100%')
.width('100%')
.align(Alignment.Top)
.alignContent(Alignment.Top)
.onClick(() => {
if (this.liveState === 'end') {
this.isShowControl = !this.isShowControl
}
})
}
.height('100%')
.width('100%')
}
contentTrackingDict() {
this.pageParam = {
... ...
... ... @@ -13,6 +13,7 @@ export struct PlayerUIComponent {
build() {
Stack() {
// 标题
PlayerTitleComponent()
PlayerCommentComponent()
... ...
@Entry
@Component
struct Index {
@State message: string = 'Hello World';
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
... ... @@ -24,6 +24,8 @@ struct ChangeBindPhonePage {
lastTime: number = 0
pageShowTime:number = 0;
pageHideTime:number = 0;
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
onPageShow() {
... ... @@ -58,6 +60,7 @@ struct ChangeBindPhonePage {
build() {
Column(){
Column() {
Image($r('app.media.login_back_icon')).width(24).height(24).margin({ left: 15, top: 10 }).onClick(() => {
router.back()
... ... @@ -138,15 +141,16 @@ struct ChangeBindPhonePage {
Row() {
Text("确认")
.layoutWeight(1)
.fontColor(this.isSubmit ?"#FFFFFFFF":"#66FFFFFF")
.fontColor("#FFFFFF")
.borderRadius(4)
.fontSize(18)
.textAlign(TextAlign.Center)
.fontWeight(FontWeight.Medium)
.margin({ top: 26 })
.height(44)
.backgroundColor(this.isSubmit ?"#ED2800":"#99ED2800")
.backgroundColor("#ED2800")
.enabled(this.isSubmit ? true : false)
.opacity(this.isSubmit ? 1: 0.6)
.onClick(() => {
TrackingButton.click("changePhoneNumberPageConfirm",TrackConstants.PageName.Change_PhoneNum,TrackConstants.PageName.Change_PhoneNum)
this.changeBindPhone()
... ... @@ -155,6 +159,10 @@ struct ChangeBindPhonePage {
.padding({ left: 25, right: 25 })
}.width('100%').height('100%').alignItems(HorizontalAlign.Start)
}.width("100%")
.height("100%")
.padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
}
//发送验证码
... ...
... ... @@ -23,6 +23,8 @@ struct ForgetPasswordPage {
@State pageTitle:string = '找回密码';
@State isForgetPassword: number = 0 //是否是登录页忘记密码过来的,标题不一样
@State codeStateSuccess:boolean=false
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
onCodeSend() {
if (this.isCodeSend) {
this.sendVerifyCode()
... ... @@ -43,6 +45,7 @@ struct ForgetPasswordPage {
build() {
Column(){
Column() {
Image($r('app.media.login_back_icon')).width(24).height(24).margin({ left: 15, top: 10 }).onClick(() => {
router.back()
... ... @@ -60,21 +63,30 @@ struct ForgetPasswordPage {
Row() {
Text("确认")
.layoutWeight(1)
.fontColor(this.isSubmit ?"#FFFFFFFF":"#66FFFFFF")
.fontColor("#FFFFFF")
.borderRadius(4)
.fontSize(18)
.textAlign(TextAlign.Center)
.fontWeight(FontWeight.Medium)
.margin({ top: 26 })
.height(44)
.backgroundColor(this.isSubmit ?"#ED2800":"#99ED2800")
.backgroundColor("#ED2800")
.enabled(this.isSubmit ? true : false)
.opacity(this.isSubmit ? 1: 0.6)
.onClick(() => {
this.checkVerifyCode()
})
}.padding({ left: 25, right: 25 }).width('100%')
}.width('100%').height('100%').alignItems(HorizontalAlign.Start)
}.width('100%')
.height('100%')
.alignItems(HorizontalAlign.Start)
.backgroundColor(Color.White)
}.width("100%")
.height("100%")
.padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
}
aboutToAppear() {
... ...
... ... @@ -27,6 +27,8 @@ const TAG = "LoginPage"
@Entry
@Component
struct LoginPage {
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State codeBtnState: boolean = false
@State timeCount: number = 60
phoneController: TextInputController = new TextInputController()
... ... @@ -104,6 +106,7 @@ struct LoginPage {
}
build() {
Column(){
Stack() {
RelativeContainer() {
... ... @@ -161,7 +164,7 @@ struct LoginPage {
Row() {
Text("登录")
.borderRadius(4)
.fontColor(this.isSubmit ? "#FFFFFFFF" : "#66FFFFFF")
.fontColor("#FFFFFF")
.fontSize(`${this.calcHeight(31)}lpx`)
.fontWeight(400)
.margin({ top: `${this.calcHeight(20)}` })
... ... @@ -169,7 +172,8 @@ struct LoginPage {
.height(44)
.textAlign(TextAlign.Center)
.width("100%")
.backgroundColor(this.isSubmit ? "#FFED2800" : "#99ED2800")
.backgroundColor("#ED2800")
.opacity(this.isSubmit ? 1: 0.6)
.onClick(() => {
if (!this.isSubmit) {
return
... ... @@ -241,7 +245,12 @@ struct LoginPage {
.visibility(this.isProtocol ? Visibility.Visible : Visibility.None)
}.width('100%')
.height('100%').backgroundColor(Color.White)
.height("100%")
.backgroundColor(Color.White)
}.width("100%")
.height("100%")
.padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
}
@Builder
... ... @@ -280,6 +289,7 @@ struct LoginPage {
.width('100%')
}.padding({ left: 25, right: 25 }).width('100%').margin({ top: 36 })
.visibility(this.checkCodePage ? Visibility.None : Visibility.Visible)
.backgroundColor(Color.White)
}
... ...
... ... @@ -10,6 +10,8 @@ const TAG = 'LoginProtocolWebview';
@Entry
@Component
struct LoginProtocolWebview {
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
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"
... ... @@ -55,7 +57,7 @@ struct LoginProtocolWebview {
}
build() {
Column(){
Column() {
Row() {
Image($r("app.media.login_back_icon"))
... ... @@ -88,5 +90,9 @@ struct LoginProtocolWebview {
})
.padding({bottom:this.contentID === "2" ? "40lpx" : 0 })
}
}.width("100%")
.height("100%")
.padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
}
}
\ No newline at end of file
... ...
... ... @@ -12,6 +12,8 @@ import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/I
@Entry
@Component
struct ModifyPasswordPage {
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
password_old: string = '';
password_new: string = '';
password_new_repeat: string = '';
... ... @@ -64,9 +66,13 @@ struct ModifyPasswordPage {
build() {
Column(){
Column(){
this.TitleBackComponent('')
this.ModifyPasswordLayout()
}
}.width("100%")
.height("100%")
.padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
}
... ... @@ -189,30 +195,30 @@ struct ModifyPasswordPage {
.height(`${this.calcHeight(85)}lpx`)
.alignItems(HorizontalAlign.Start)
Row() {
Button( { type: ButtonType.Normal, stateEffect: true }){
Text("确认")
.fontColor("#fff")
.fontSize(`${this.calcHeight(35)}lpx`)
.lineHeight(`${this.calcHeight(50)}lpx`)
.opacity(this.btnStatus ?1:0.5)
}
.width('100%')
.height(`${this.calcHeight(80)}lpx`)
.backgroundColor(this.btnStatus ? '#ED2800' : '#99ED2800')
.enabled(this.btnStatus ?true:false)
.borderRadius('4vp')
.layoutWeight(1)
.fontColor("#FFFFFF")
.borderRadius(4)
.fontSize(18)
.textAlign(TextAlign.Center)
.fontWeight(FontWeight.Medium)
.margin({ top: 26 })
.height(44)
.backgroundColor("#ED2800")
.enabled(this.btnStatus ? true : false)
.opacity(this.btnStatus ? 1: 0.6)
.onClick(() => {
if(this.btnStatus){
TrackingButton.click("changePasswordPageConfirm",TrackConstants.PageName.Change_Passwd,TrackConstants.PageName.Change_Passwd)
this.submit()
}
})
}
}.width('100%')
.padding({top:`${this.calcHeight(25)}lpx`})
.alignItems(VerticalAlign.Center)
.width('100%')
.height(`${this.calcHeight(120)}lpx`)
Column() {
Text("忘记密码").fontSize(12).maxLines(3).fontColor(0x999999).padding({top:`${this.calcHeight(10)}lpx`})
... ...
... ... @@ -2,7 +2,7 @@ import ArrayList from '@ohos.util.ArrayList';
import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/Index';
import router from '@ohos.router';
import { LoginViewModel } from './LoginViewModel';
import { CustomToast, DateTimeUtils, Logger, SPHelper, ToastUtils } from 'wdKit';
import { BreakpointSystem, CustomToast, DateTimeUtils, Logger, SPHelper, ToastUtils } from 'wdKit';
import {
SpConstants
} from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants'
... ... @@ -74,6 +74,19 @@ export struct SettingPasswordPage {
pageHideResetTime:number = 0;
pageShowSetTime:number = 0;
pageHideSetTime:number = 0;
@StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm';
private breakpointSystem = new BreakpointSystem();
@State percent:number = 1
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
currentChanged(){
if(this.currentBreakpoint == "md" || this.currentBreakpoint == "lg"){
this.percent = 0.7
}else {
this.percent = 1
}
}
onPageShow(): void {
if (this.pageType === 0){//重置密码
... ... @@ -83,6 +96,10 @@ export struct SettingPasswordPage {
}
}
calcHeight(value:number): number{
return value * this.percent
}
onPageHide(): void {
if (this.pageType === 0){
this.pageHideResetTime = DateTimeUtils.getTimeStamp()
... ... @@ -104,7 +121,13 @@ export struct SettingPasswordPage {
}
}
aboutToDisappear(): void {
this.breakpointSystem.unregister();
}
aboutToAppear() {
this.breakpointSystem.register();
this.currentChanged()
let params:SettingPasswordParams = router.getParams() as SettingPasswordParams;
this.pageId = parseInt(params.pageID);
this.getPageListData(this.pageId)
... ... @@ -147,10 +170,48 @@ export struct SettingPasswordPage {
}
build() {
Navigation() {
Column(){
Column(){
this.TitleBackComponent('')
this.settingList() //滑动区域
}.titleMode(NavigationTitleMode.Mini)
.title('')
}
}.width("100%")
.height("100%")
.padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
}
@Builder TitleBackComponent(title:string){
RelativeContainer() {
Text(title)
.fontColor('#FF333333')
.fontSize(`${this.calcHeight(18)}`)
.textAlign(TextAlign.Center)
.height(`${this.calcHeight(44)}`)
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start },
right: { anchor: "__container__", align: HorizontalAlign.End },
})
.id('titleContent')
Image($r("app.media.login_back_icon"))
.objectFit(ImageFit.Auto)
.height(`${this.calcHeight(24)}`)
.width(`${this.calcHeight(24)}`)
.margin({
left: `${this.calcHeight(16)}`, top: `${this.calcHeight(8)}`
})
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start },
})
.onClick(() => {
router.back()
})
.id('backImage')
}.height(`${this.calcHeight(44)}`)
}
// 页面布局
... ... @@ -176,7 +237,7 @@ export struct SettingPasswordPage {
})
}
}.width('100%')
.padding({ left:"31lpx",right:"31lpx",top:"131lpx" })
.padding({ left:`${this.calcHeight(31)}lpx`,right:`${this.calcHeight(31)}lpx`,top:`${this.calcHeight(131)}lpx` })
.height('100%')
}
... ... @@ -185,10 +246,10 @@ export struct SettingPasswordPage {
// 标题
@Builder getTitleCell(item: AccoutPageDataModel, alignTitle: HorizontalAlign) {
Column() {
Text(item.compTitle).fontWeight(FontWeight.Bold).fontSize(20).maxLines(1)
Text(item.compTitle).fontWeight(FontWeight.Bold).fontSize(`${this.calcHeight(20)}`).maxLines(1)
}
.width('100%')
.height('75lpx')
.height(`${this.calcHeight(75)}lpx`)
.alignItems(alignTitle)
}
... ... @@ -210,12 +271,12 @@ export struct SettingPasswordPage {
})
}
.alignItems(VerticalAlign.Center)
.height('80lpx')
.height(`${this.calcHeight(80)}lpx`)
.backgroundColor('#f5f5f5')
.borderRadius('4vp')
.borderRadius(`${this.calcHeight(4)}`)
}
.width('100%')
.height('110lpx')
.height(`${this.calcHeight(110)}lpx`)
.backgroundColor(0xffffff0)
.alignItems(VerticalAlign.Center)
}
... ... @@ -235,12 +296,12 @@ export struct SettingPasswordPage {
})
}
.alignItems(VerticalAlign.Center)
.height('80lpx')
.height(`${this.calcHeight(80)}lpx`)
.backgroundColor('#f5f5f5')
.borderRadius('4vp')
.borderRadius(`${this.calcHeight(4)}`)
}
.width('100%')
.height('110lpx')
.height(`${this.calcHeight(110)}lpx`)
.backgroundColor(0xffffff0)
.alignItems(VerticalAlign.Center)
}
... ... @@ -249,7 +310,7 @@ export struct SettingPasswordPage {
@Builder getCodeCell(item: AccoutPageDataModel) {
Row() {
Stack() {
Image($r('app.media.get_code_bg')).width('100%').borderRadius('4vp')
Image($r('app.media.get_code_bg')).width('100%').borderRadius(`${this.calcHeight(4)}`)
Row() {
TextInput({ placeholder: item.inputPlacholder })
.placeholderColor("#CCCCCC")
... ... @@ -264,10 +325,10 @@ export struct SettingPasswordPage {
.fontColor('#da3e22')
}
.width('100%')
}.height('80lpx')
}.height(`${this.calcHeight(80)}lpx`)
}
.width('100%')
.height('110lpx')
.height(`${this.calcHeight(110)}lpx`)
.backgroundColor(0xffffff0)
.alignItems(VerticalAlign.Center)
}
... ... @@ -275,7 +336,7 @@ export struct SettingPasswordPage {
// desc
@Builder getDescCell(item: AccoutPageDataModel, alignTitle: HorizontalAlign) {
Column() {
Text(item.compDesc).fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'})
Text(item.compDesc).fontSize(`${this.calcHeight(12)}`).maxLines(3).fontColor(0x999999).padding({top:`${this.calcHeight(10)}lpx`})
.onClick(()=>{
if (item.compDesc == '忘记密码') {
this.showToastTip('密码不符合密码规范')
... ... @@ -283,37 +344,39 @@ export struct SettingPasswordPage {
})
}
.width('100%')
.height('85lpx')
.height(`${this.calcHeight(85)}lpx`)
.alignItems(alignTitle)
}
// 按钮
@Builder getButtonCell(item: AccoutPageDataModel) {
Row() {
Button(item.compButtonTitle, { type: ButtonType.Normal, stateEffect: true })
.width('100%')
.height('80lpx')
.backgroundColor(this.btnStatus ? '#da3e22' : '#e5856d')
.enabled(this.btnStatus ?true:false)
.fontColor('#fff')
.borderRadius('4vp')
Text(item.compButtonTitle)
.layoutWeight(1)
.fontColor("#FFFFFF")
.borderRadius(`${this.calcHeight(4)}`)
.fontSize(`${this.calcHeight(18)}`)
.textAlign(TextAlign.Center)
.fontWeight(FontWeight.Medium)
.margin({ top: `${this.calcHeight(26)}` })
.height(`${this.calcHeight(44)}`)
.backgroundColor("#ED2800")
.enabled(this.btnStatus ? true : false)
.opacity(this.btnStatus ? 1: 0.6)
.onClick(() => {
this.buttonClick()
})
}
.padding({top:'25lpx'})
.alignItems(VerticalAlign.Center)
}.padding({top:`${this.calcHeight(25)}lpx`})
.width('100%')
.height('120lpx')
}
// 标题
@Builder getLogoCell(item: AccoutPageDataModel) {
Column() {
Image(item.compLogo).height('150lpx').width('150lpx')
Image(item.compLogo).height(`${this.calcHeight(150)}lpx`).width(`${this.calcHeight(150)}lpx`)
}
.width('100%')
.height('200lpx')
.height(`${this.calcHeight(200)}lpx`)
}
/***************************** 事件处理 ******************************************/
... ...
... ... @@ -24,6 +24,8 @@ struct VerifyPhoneNumberPage {
isFirst:boolean=true//是否第一次获取验证码
pageShowTime:number = 0;
pageHideTime:number = 0;
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
onCodeSend() {
if (this.isCodeSend) {
... ... @@ -60,6 +62,7 @@ struct VerifyPhoneNumberPage {
build() {
Column(){
Column() {
Image($r('app.media.login_back_icon')).width(24).height(24).margin({ left: 15, top: 10 }).onClick(() => {
router.back()
... ... @@ -155,6 +158,9 @@ struct VerifyPhoneNumberPage {
}.padding({ left: 25, right: 25 }).width('100%')
}.width('100%').height('100%').alignItems(HorizontalAlign.Start)
}.width("100%")
.height("100%")
.padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
}
//发送验证码
... ...
{
"src": [
"pages/Index",
"pages/login/LoginPage",
"pages/login/ForgetPasswordPage",
"pages/login/LoginProtocolWebview",
... ...
import AbilityConstant from '@ohos.app.ability.AbilityConstant';
import app from '@system.app';
import hilog from '@ohos.hilog';
import UIAbility from '@ohos.app.ability.UIAbility';
import Want from '@ohos.app.ability.Want';
import window from '@ohos.window';
import { BusinessError } from '@ohos.base';
import { DeviceUtil, EmitterEventId, EmitterUtils, WindowModel } from 'wdKit';
import { DeviceUtil, EmitterEventId, EmitterUtils, Logger, WindowModel } from 'wdKit';
import { ConfigurationConstant } from '@kit.AbilityKit';
import { StartupManager } from '../startupmanager/StartupManager';
import { UIContext } from '@ohos.arkui.UIContext';
let floatWindowClass: window.Window | null = null;
const TAG = 'EntryAbility'
export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
StartupManager.sharedInstance().appOnCreate(want, launchParam, this.context)
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
Logger.info(TAG, 'Ability onCreate');
// 还没深色模式需求,暂直接不跟随系统。
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT);
... ... @@ -32,13 +31,13 @@ export default class EntryAbility extends UIAbility {
}
onDestroy(): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
Logger.info(TAG, 'Ability onDestroy');
StartupManager.sharedInstance().appOnDestory()
}
onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
Logger.info(TAG, 'Ability onWindowStageCreate');
WindowModel.shared.setWindowStage(windowStage);
// 2. 获取布局避让遮挡的区域
const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
... ... @@ -57,72 +56,50 @@ export default class EntryAbility extends UIAbility {
// 音频悬浮窗初始移动位置604为ui高度
let initMoveY = vp2px(604)
// 在普通phone/折叠屏/tablet设备上以沉浸式(全屏)启动
if (DeviceUtil.isPhone() || DeviceUtil.isTablet()) {
// 设置窗口的布局是否为沉浸式布局
// 沉浸式布局是指布局不避让状态栏与导航栏,组件可能产生与其重叠的情况。
// 非沉浸式布局是指布局避让状态栏与导航栏,组件不会与其重叠。
// windowClass.setWindowLayoutFullScreen(true)
// 设置窗口全屏模式时窗口内导航栏、状态栏的属性
// windowClass.setWindowSystemBarProperties({
// statusBarContentColor: "#FFFFFF"
// })
// 设置启动时窗口的显示方向属性,
// 普通phone以PORTRAIT/竖屏显示模式启动
// 折叠屏和tablet是以AUTO_ROTATION_RESTRICTED/受开关控制的自动旋转模式启动
WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT)
.then(() => {
hilog.info(0x0000, 'testTag', 'setPreferredOrientation Succeeded');
})
.catch((err: Error) => {
hilog.error(0x0000, 'testTag',
`setPreferredOrientation catch, error error.name : ${err.name}, error.message:${err.message}`);
})
}
this.onWindowSetup(windowClass)
//../../../../../../features/wdLogin/src/main/ets/pages/launchPage/LaunchPage
windowStage.loadContent('pages/launchPage/LaunchPage', (err, data) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
Logger.error(TAG, 'Failed to load the content. Cause: ' + JSON.stringify(err) ?? '');
return;
}
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
Logger.info(TAG, 'Succeeded in loading the content. Data: ' + JSON.stringify(data) ?? '');
});
// 1.创建悬浮窗
windowStage.createSubWindow('subWindow', (err: BusinessError, data) => {
let errCode: number = err.code;
if (errCode) {
console.error('floatWindowClass Failed to create the subwindow. Cause: ' + JSON.stringify(err));
Logger.error('floatWindowClass Failed to create the subwindow. Cause: ' + JSON.stringify(err));
return;
}
console.info('floatWindowClass Succeeded in creating the subwindow. Data: ' + JSON.stringify(data));
Logger.info('floatWindowClass Succeeded in creating the subwindow. Data: ' + JSON.stringify(data));
floatWindowClass = data;
AppStorage.setOrCreate('floatWindowClass', floatWindowClass);
// 2.悬浮窗窗口创建成功后,设置悬浮窗的位置、大小及相关属性等。
floatWindowClass.moveWindowTo(0, initMoveY, (err: BusinessError) => {
let errCode: number = err.code;
if (errCode) {
console.error('floatWindowClass Failed to move the window. Cause:' + JSON.stringify(err));
Logger.error('floatWindowClass Failed to move the window. Cause:' + JSON.stringify(err));
return;
}
console.info('floatWindowClass Succeeded in moving the window.');
Logger.info('floatWindowClass Succeeded in moving the window.');
});
// 3.为悬浮窗加载对应的目标页面。
floatWindowClass.setUIContent("pages/view/AudioComponent", (err: BusinessError) => {
let errCode: number = err.code;
if (errCode) {
console.error('floatWindowClass Failed to load the content. Cause:' + JSON.stringify(err));
Logger.error('floatWindowClass Failed to load the content. Cause:' + JSON.stringify(err));
return;
}
console.info('floatWindowClass Succeeded in loading the content.');
Logger.info('floatWindowClass Succeeded in loading the content.');
let color: string = 'rgba(0,0,0,0)';
try {
(floatWindowClass as window.Window).setWindowBackgroundColor(color);
} catch (exception) {
console.error('Failed to set the background color. Cause: ' + JSON.stringify(exception));
};
Logger.error('Failed to set the background color. Cause: ' + JSON.stringify(exception));
}
;
});
floatWindowClass.on('windowEvent', (data) => {
... ... @@ -132,33 +109,68 @@ export default class EntryAbility extends UIAbility {
});
}
public async onWindowSetup(mainWindow: window.Window) {
// 在普通phone/折叠屏/tablet设备上以沉浸式(全屏)启动
if (DeviceUtil.isPhone() || DeviceUtil.isTablet()) {
// 设置窗口的布局是否为沉浸式布局
// 沉浸式布局是指布局不避让状态栏与导航栏,组件可能产生与其重叠的情况。
// 非沉浸式布局是指布局避让状态栏与导航栏,,组件不会与其重叠
mainWindow.setWindowLayoutFullScreen(true)
//设置窗口全屏模式时窗口内导航栏、状态栏的属性
mainWindow.setWindowSystemBarProperties({
//statusBarColor:'#000000'
statusBarContentColor: '#FFFFFF'
})
mainWindow.setSpecificSystemBarEnabled('status', true)
// 设置启动时窗口的显示方向属性,
// 普通phone以PORTRAIT/竖屏显示模式启动
// 折叠屏和tablet是以AUTO_ROTATION_RESTRICTED/受开关控制的自动旋转模式启动
WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT)
.then(() => {
Logger.info(TAG, 'setPreferredOrientation Succeeded');
})
.catch((err: Error) => {
Logger.info(TAG,
`setPreferredOrientation catch, error error.name : ${err.name}, error.message:${err.message}`);
})
} else if (DeviceUtil.is2in1()) {
// 2in1(PC)设备不支持旋转(无横竖屏模式),会以默认窗口(非全屏)显示模式启动Logger.info(TAG,`start at 2in1 window device )
Logger.info(TAG, 'start at 2in1 window device')
} else {
// 轻量级智能穿戴/lite wearable device
Logger.info(TAG, 'start at other type device')
}
}
destroyFloatWindow() {
(floatWindowClass as window.Window).destroyWindow((err: BusinessError) => {
let errCode: number = err.code;
if (errCode) {
console.error('floatWindowClass Failed to destroy the window. Cause: ' + JSON.stringify(err));
Logger.error('floatWindowClass Failed to destroy the window. Cause: ' + JSON.stringify(err));
return;
}
console.info('floatWindowClass Succeeded in destroying the window.');
Logger.info('floatWindowClass Succeeded in destroying the window.');
});
}
onWindowStageDestroy(): void {
// Main window is destroyed, release UI related resources
this.destroyFloatWindow()
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
Logger.info(TAG, 'Ability onWindowStageDestroy');
}
onForeground(): void {
// Ability has brought to foreground
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
Logger.info(TAG, 'Ability onForeground');
EmitterUtils.sendEmptyEvent(EmitterEventId.APP_ENTER_FOREGROUD)
}
onBackground(): void {
// Ability has back to background
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
Logger.info(TAG, 'Ability onBackground');
EmitterUtils.sendEmptyEvent(EmitterEventId.APP_ENTER_BACKGROUD)
}
... ...
... ... @@ -23,7 +23,7 @@ struct MorningEveningPaperPage {
PageTransitionEnter({ type: RouteType.Push, duration: 300 })
.slide(SlideEffect.Bottom).onEnter((type: RouteType, progress: number) => {
if (progress >= 0.99) {
WindowModel.shared.setWindowLayoutFullScreen(true)
// WindowModel.shared.setWindowLayoutFullScreen(true)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
}
})
... ... @@ -43,14 +43,14 @@ struct MorningEveningPaperPage {
onPageShow() {
Logger.info(TAG, 'onPageShow');
if (this.isPageShow) {
WindowModel.shared.setWindowLayoutFullScreen(true)
// WindowModel.shared.setWindowLayoutFullScreen(true)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
}
this.pageShowTime = DateTimeUtils.getTimeStamp()
}
onPageHide() {
WindowModel.shared.setWindowLayoutFullScreen(false)
// WindowModel.shared.setWindowLayoutFullScreen(false)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
this.isPageShow = true
Logger.info(TAG, 'onPageHide');
... ...
... ... @@ -48,7 +48,6 @@ struct MultiPictureDetailPage {
}
aboutToAppear() {
this.openFullScreen()
Logger.info(TAG, 'aboutToDisappear');
... ... @@ -68,13 +67,11 @@ struct MultiPictureDetailPage {
aboutToDisappear(): void {
console.log(TAG, 'aboutToDisappear')
this.closeFullScreen()
}
onPageShow(): void {
console.log(TAG, 'onPageShow')
this.pageShowTime = DateTimeUtils.getTimeStamp()
this.openFullScreen()
}
... ... @@ -84,25 +81,7 @@ struct MultiPictureDetailPage {
let duration = 0
duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000)
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Atlas_Detail,TrackConstants.PageName.Atlas_Detail,duration)
this.closeFullScreen()
}
/**
* 开启沉浸式
* TODO:颜色待根据业务接口修改
*/
openFullScreen() {
WindowModel.shared.setWindowLayoutFullScreen(true)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
}
/**
* 关闭沉浸式
* TODO:颜色待根据业务接口修改
*/
closeFullScreen() {
WindowModel.shared.setWindowLayoutFullScreen(false)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
}
}
\ No newline at end of file
... ...
... ... @@ -7,6 +7,7 @@ import LaunchDataModel, { defaultLaunchModel } from '../viewModel/LaunchDataMode
import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index';
import { ContentDTO } from 'wdBean/Index';
import { Core } from '@ohos/hypium';
@Entry
... ... @@ -62,7 +63,7 @@ struct LaunchAdvertisingPage {
}else {
//显示图片
Image(this.defaultModel.bootScreenUrl)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
// .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.width('100%')
.height('100%')
}
... ... @@ -74,11 +75,10 @@ struct LaunchAdvertisingPage {
bottom: 0
})
Stack(){
Column(){
Row(){
if (this.defaultModel.isAd === '1') {
if (this.defaultModel.isAd == '1') {
Text('广告')
.fontColor(Color.White)
.textAlign(TextAlign.Center)
... ... @@ -108,7 +108,7 @@ struct LaunchAdvertisingPage {
this.trackingLaunchJumpOver()
}).margin({right:16})
}.margin({top:10}).width('100%').height('56lpx')
}.margin({top:50}).width('100%').height('56lpx')
Blank()
... ... @@ -132,18 +132,21 @@ struct LaunchAdvertisingPage {
.margin({
bottom: '51lpx'
})
.borderWidth(1)
.borderColor(Color.White)
.backgroundColor('#80000000')
.onClick(()=>{
this.action()
})
}
if(this.defaultModel.screenType === '1') {
if(this.defaultModel.screenType == '1') {
Column(){
Image($r('app.media.LaunchPage_logo'))
.width('278lpx')
.height('154lpx')
.margin({top:20})
}.width('100%').height('16%').backgroundColor(Color.White).expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
}.width('100%').height('16%').backgroundColor(Color.White)
// .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
}
}
.width('100%')
... ... @@ -157,7 +160,7 @@ struct LaunchAdvertisingPage {
.height('100%')
.margin({top:'0'})
}
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
// .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.width('100%')
.height('100%')
.backgroundColor(Color.White)
... ... @@ -176,7 +179,7 @@ struct LaunchAdvertisingPage {
if (this.defaultModel.openType == '2') {
//端外打开
ProcessUtils.jumpExternalWebPage(this.defaultModel.linkUrl)
}else {
}else if(this.defaultModel.openType == '1'){
//端内打开
ProcessUtils.gotoDefaultWebPage(this.defaultModel.linkUrl)
}
... ... @@ -212,7 +215,7 @@ struct LaunchAdvertisingPage {
this.defaultModel.screenName = dataModel.launchAdInfo[0].matInfo.advTitle
this.defaultModel.durations = dataModel.launchAdInfo[0].displayDuration
this.defaultModel.linkUrl = dataModel.launchAdInfo[0].matInfo.linkUrl
if (dataModel.launchAdInfo[0].matInfo.startStyle === '1') {
if (dataModel.launchAdInfo[0].matInfo.startStyle == '1') {
this.defaultModel.screenType = '2'
}else {
this.defaultModel.screenType = '1'
... ... @@ -222,6 +225,7 @@ struct LaunchAdvertisingPage {
this.defaultModel.bootVideoUrl = dataModel.launchAdInfo[0].matInfo.matVideoUrl
this.defaultModel.showType = dataModel.launchAdInfo[0].matInfo.matType
this.defaultModel.isAd = '1'
this.defaultModel.openType = dataModel.launchAdInfo[0].matInfo.openType
}
}
... ...
... ... @@ -23,6 +23,7 @@ let storage = LocalStorage.getShared();
@Component
export struct BottomNavigationComponent {
@Provide bottomRectHeight: number = 0
private bottomRectHeight1: string = AppStorage.get<number>('bottomSafeHeight') + 'px';
@Provide topRectHeight: number = 0
@Provide isLayoutFullScreen: boolean = false
@Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL
... ... @@ -73,6 +74,7 @@ export struct BottomNavigationComponent {
}
build() {
Column() {
Tabs({ barPosition: BarPosition.End, index: this.currentNavIndex, controller: this.navController }) {
ForEach(this.bottomNavList, (navItem: BottomNavDTO, index: number) => {
TabContent() {
... ... @@ -100,7 +102,7 @@ export struct BottomNavigationComponent {
}
.tabBar(this.tabBarBuilder(navItem, index))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
// .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
});
}
... ... @@ -113,10 +115,10 @@ export struct BottomNavigationComponent {
.barBackgroundColor(this.barBackgroundColor)
// 备注:鸿蒙目前只有修改三线导航背景方法,对于全面屏导航条手机需要设置背景色并使其扩散到导航区域
.backgroundColor(this.barBackgroundColor)
.expandSafeArea([SafeAreaType.SYSTEM])
// .padding({ bottom: this.bottomRectHeight + 'px', top: this.topRectHeight + 'px' }) // 此处margin具体数值在实际中应与导航条区域高度保持一致
.layoutWeight(1)
Blank().width('100%').height(this.bottomRectHeight1).backgroundColor(this.barBackgroundColor)
}.height('100%').width('100%')
}
@Builder
... ...
... ... @@ -214,6 +214,17 @@ export struct MultiPictureDetailPageComponent {
left: 16,
right: 0
})
.onClick(() => {
if (this.contentDetailData.rmhInfo?.cnMainControl === 1) {
// 号主页
const params: Params = {
creatorId: this.contentDetailData.rmhInfo.rmhId,
pageID: ''
}
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
})
Row() {
if (this.followStatus == '0') {
... ...
import { insightIntent, InsightIntentExecutor } from '@kit.AbilityKit';
import { window } from '@kit.ArkUI';
import { BusinessError } from '@kit.BasicServicesKit';
import { NetworkUtil, SPHelper, ToastUtils } from 'wdKit';
import { ProcessUtils } from 'wdRouter';
import DailyPaperTopicModel from 'wdComponent/src/main/ets/model/DailyPaperTopicModel'
/**
* 意图调用
*/
... ... @@ -19,7 +22,7 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor {
*/
onExecuteInUIAbilityForegroundMode(name: string, param: Record<string, Object>, pageLoader: window.WindowStage):
Promise<insightIntent.ExecuteResult> {
console.log('yzl onExecuteInUIAbilityForegroundMode',name,JSON.stringify(param))
console.log('yzl onExecuteInUIAbilityForegroundMode', name, JSON.stringify(param))
// 根据意图名称分发处理逻辑
switch (name) {
case InsightIntentExecutorImpl.ViewBlog:
... ... @@ -36,19 +39,19 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor {
}
} as insightIntent.ExecuteResult)
}
/**
* 实现习惯推荐功能
* @param param 意图参数
* @param pageLoader 窗口
*/
private jumpToViewBlog(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> {
console.log('yzl jumpToView',JSON.stringify(param))
private jumpToViewBlog(param: Record<string, Object>,
pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> {
console.log('yzl jumpToView', JSON.stringify(param))
return new Promise((resolve, reject) => {
// TODO 实现意图调用,loadContent的入参为歌曲落地页路径,例如:pages/SongPage
// TODO 热启动是否切到主页
pageLoader.loadContent('pages/MainPage')
.then(() => {
resolve({
code: 0,
result: {
... ... @@ -72,12 +75,26 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor {
* @param param 意图参数
* @param pageLoader 窗口
*/
private jumpToViewColumnUpdate(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> {
console.log('yzl jumpToViewColum',JSON.stringify(param))
private jumpToViewColumnUpdate(param: Record<string, Object>,
pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> {
return new Promise((resolve, reject) => {
pageLoader.loadContent('pages/MainPage')
.then(() => {
ProcessUtils.gotoMorningEveningPaper()
if (NetworkUtil.isNetConnected()) {
DailyPaperTopicModel.getDailyPaperTopic().then(dailyPaperTopicBean => {
if (dailyPaperTopicBean && dailyPaperTopicBean.id > 0) {
SPHelper.default.saveSync('dailyPaperTopicPageId', dailyPaperTopicBean.id);
ProcessUtils.gotoMorningEveningPaper() //跳转至早晚报页面
} else {
ToastUtils.showToast('暂无早晚报信息', 1000)
}
}).catch((err: string) => {
console.log('yzlerr',JSON.stringify(err))
ToastUtils.showToast('暂无早晚报信息', 1000)
})
} else {
ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000)
}
resolve({
code: 0,
result: {
... ...