wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool: (24 commits)
  fix:17339 版面>读报纸,点击弹窗顶部常驻区域下滑,需退出弹窗,见视频对比
  人民号-点赞优化
  fix:17433 无网络时-进入电子报,不该展示分享按钮
  fix:17475 我的预约下视频图标模糊
  fix:17352 早晚报触底提示遮挡,到底文案距离底部间距应加大至不遮挡。
  fix:17105 UI还原问题-【生产环境】点击全屏按钮,进入视频全屏。两边间距问题。看图
  fix:17486 17483版面-读报纸,责编展示不全,不应只展示2行
  fix:17072 UI还原问题--【生产环境】进入直播预告页,图片和标题间距问题,看图
  fix:17474 我的预约下的视频图标鸿蒙与安卓不一致
  fix:bug[17172] 取消搜索,退出搜索页的动效不对
  修改视频评论
  修改视频评论
  图文、专题,页面跳转动效修改。
  ref |> 交互评论增加游客评论接口交互
  ref |> 新增设备信息上报接口逻辑
  ref |> 调整评论列表数据加载交互,解决每次进入页面会把所有评论数据都加载一遍
  ref |> 统一处理评论列表点击头像跳转逻辑
  ref |> 对接华为账号登录接口
  feat:意图框架接入
  视频接入评论
  ...
Showing 93 changed files with 966 additions and 229 deletions
... ... @@ -47,4 +47,5 @@ export class SpConstants{
//游客状态下首次评论时间
static FIRSTCOMMENTTIME = 'firstCommentTime'
static TOURIST_NICK_NAME = 'touristNickName'
}
\ No newline at end of file
... ...
... ... @@ -742,4 +742,8 @@ export class HttpUrlUtils {
return url
}
}
\ No newline at end of file
static reportDeviceInfo() {
let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/common/user/c/device/push";
return url;
}
}
... ...
... ... @@ -136,4 +136,9 @@ export class WDRouterPage {
//意见反馈
static feedBackActivity = new WDRouterPage("wdComponent", "ets/components/FeedBackActivity");
// 人民号主页头像显示
static showHomePageHeaderPage = new WDRouterPage("wdComponent", "ets/pages/ShowHomePageHeaderPage");
}
... ...
... ... @@ -55,7 +55,7 @@ export struct WdWebLocalComponent {
.mixedMode(MixedMode.All)
.onlineImageAccess(true)
.enableNativeEmbedMode(true)
.layoutMode(WebLayoutMode.FIT_CONTENT)
// .layoutMode(WebLayoutMode.FIT_CONTENT)
// .nestedScroll({ scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.PARENT_FIRST })
.height(this.webHeight)
.onPageBegin((event) => {
... ...
... ... @@ -69,6 +69,7 @@ export struct DynamicDetailComponent {
@State isNetConnected: boolean = true
@State isPageEnd: boolean = false
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State reachEndIncreament: number = 0
async aboutToAppear() {
await this.getContentDetailData()
... ... @@ -709,4 +710,4 @@ interface radiusType {
topRight: number | Resource;
bottomLeft: number | Resource;
bottomRight: number | Resource;
}
\ No newline at end of file
}
... ...
... ... @@ -148,18 +148,19 @@ export struct ENewspaperPageComponent {
this.calendarDialogController.close()
}
})
Image($r('app.media.icon_share'))
.height($r('app.float.top_arrow_size'))
.width($r('app.float.top_arrow_size'))
.alignRules({
right: { anchor: "__container__", align: HorizontalAlign.End },
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id('e_newspaper_share')
.onClick(() => {
ToastUtils.showToast('分享为公共方法,待开发', 1000);
})
if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
Image($r('app.media.icon_share'))
.height($r('app.float.top_arrow_size'))
.width($r('app.float.top_arrow_size'))
.alignRules({
right: { anchor: "__container__", align: HorizontalAlign.End },
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id('e_newspaper_share')
.onClick(() => {
ToastUtils.showToast('分享为公共方法,待开发', 1000);
})
}
}
.margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') })
.height($r('app.float.top_bar_height'))
... ... @@ -311,6 +312,7 @@ export struct ENewspaperPageComponent {
.width('100%')
.height('100%')
.backgroundColor($r('app.color.color_80000000'))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.id('e_newspaper_container')
if (this.isOpenListDialog) {
... ...
... ... @@ -52,6 +52,7 @@ export struct ImageAndTextPageComponent {
@State isNetConnected: boolean = true
@State info: Area | null = null
@State likeNum: number = 0
@State reachEndIncreament : number = 0
build() {
Column() {
... ... @@ -141,7 +142,12 @@ export struct ImageAndTextPageComponent {
if (this.contentDetailData?.openComment) {
Divider().strokeWidth(6).color('#f5f5f5')
CommentComponent({
publishCommentModel: this.publishCommentModel
publishCommentModel: this.publishCommentModel,
fixedHeightMode: false,
reachEndIncreament: this.reachEndIncreament,
reachEndLoadMoreFinish: () => {
}
}).onAreaChange((oldValue: Area, newValue: Area) => {
this.info = newValue
})
... ... @@ -157,6 +163,9 @@ export struct ImageAndTextPageComponent {
.padding({ bottom: 76 })
.scrollBar(BarState.Off)
.align(Alignment.Top)
.onReachEnd(() => {
this.reachEndIncreament += 1
})
if (!this.isNetConnected) {
EmptyComponent({
... ... @@ -228,6 +237,7 @@ export struct ImageAndTextPageComponent {
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
}
if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length &&
this.contentDetailData?.audioList[0].audioUrl) {
... ... @@ -340,4 +350,4 @@ export struct ImageAndTextPageComponent {
aboutToDisappear() {
}
}
\ No newline at end of file
}
... ...
... ... @@ -61,6 +61,8 @@ export struct MorningEveningPaperComponent {
@State mixedBgColor: string = ''
// 顶部安全高度赋值
@State topSafeHeight: number = 0;
@State bottomSafeHeight: number = 0;
private audioDataList: AudioDataList[] = []
private playerController: WDPlayerController = new WDPlayerController();
simpleAudioDialog: CustomDialogController = new CustomDialogController({
... ... @@ -112,6 +114,7 @@ export struct MorningEveningPaperComponent {
// await windowHight.setWindowLayoutFullScreen(true);
// WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
this.topSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height)
this.bottomSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).bottomRect.height)
const dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String
console.info(TAG, `aboutToAppear = ` + dailyPaperTopicPageId)
... ... @@ -248,14 +251,15 @@ export struct MorningEveningPaperComponent {
})
}
}
.height('100%')
.height(`calc(100% - ${this.bottomSafeHeight + this.topSafeHeight + 'vp'})`)
PaperTitleComponent()
}
.width('100%')
.height('100%')
.padding({
top: this.topSafeHeight
top: this.topSafeHeight,
bottom: this.bottomSafeHeight
})
// .backgroundColor(Color.Black)
// .backgroundColor(this.pageInfoBean?.backgroundColor ?? Color.Black)
... ...
... ... @@ -449,6 +449,7 @@ export struct MultiPictureDetailPageComponent {
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
}
// this.contentDetailData.photoList = []
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
... ...
... ... @@ -72,6 +72,7 @@ export struct SpacialTopicPageComponent {
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
// }
this.trySendData2H5()
}
... ... @@ -113,4 +114,4 @@ export struct SpacialTopicPageComponent {
}
this.getDetail()
}
}
\ No newline at end of file
}
... ...
... ... @@ -20,6 +20,8 @@ export class publishCommentModel {
targetType: string = ''
/*评论总数*/
totalCommentNumer: string = '0'
/// 游客评论开关:visitorComment 1:打开;0:关闭
visitorComment: string = "0"
//评论传参
/*评论图片url,多个逗号隔开*/
... ...
... ... @@ -8,9 +8,11 @@ import { HttpUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import NoMoreLayout from '../../page/NoMoreLayout';
import { EmptyComponent } from '../../view/EmptyComponent';
import { ContentDetailDTO, Params } from 'wdBean/Index';
const TAG = 'CommentComponent';
const testString = '因为读书的人\n是低着头向上看的人\n身处一隅,却能放眼世界\n2,因为读书的人\n总是比不读书的人\n活得有趣一点\n3,因为读书的人\n即使平凡,绝不平庸'
// @Entry
... ... @@ -22,14 +24,20 @@ export struct CommentComponent {
@State isComments: boolean = true
/*必传*/
@ObjectLink publishCommentModel: publishCommentModel
@Consume contentDetailData: ContentDetailDTO
listScroller: ListScroller = new ListScroller(); // scroller控制器
historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset
isloading: boolean = false
@State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
@State dialogController: CustomDialogController | null = null;
// @State private browSingModel: commentListModel = new commentListModel()
// 是否为固定高度模式。true时,里面上拉加载更多生效,外层不能包Scroll。
// false时,外层实现加载更多,并通过reachEndIncreament通知开发加载更多,reachEndLoadMoreFinish 通知上层加载更多完成
fixedHeightMode: boolean = false
@Prop @Watch("parentOnReachEnd") reachEndIncreament : number = 0
reachEndLoadMoreFinish?: () => void
// 在自定义组件即将析构销毁时将dialogControlle置空
aboutToDisappear() {
this.dialogController = null // 将dialogController置空
... ... @@ -180,31 +188,52 @@ export struct CommentComponent {
}
}
}, (item: commentItemModel, index: number) => JSON.stringify(item) + index.toString())
// 加载更多
ListItem() {
if (this.hasMore === false) {
if (this.hasMore == false) {
NoMoreLayout()
}
}
}
}
.margin({bottom: 10})
.onReachEnd(() => {
if (!this.fixedHeightMode) {
return
}
if (this.hasMore) {
this.getData()
}
})
.enableScrollInteraction(false)
.enableScrollInteraction(this.fixedHeightMode ? true: false)
// .nestedScroll({
// scrollForward: NestedScrollMode.PARENT_FIRST,
// scrollBackward: NestedScrollMode.SELF_FIRST
// })
}
}
parentOnReachEnd() {
if (this.fixedHeightMode) {
return
}
if (this.hasMore) {
this.getData()
} else {
if (this.reachEndLoadMoreFinish) {
this.reachEndLoadMoreFinish()
}
}
}
//获取数据
async getData() {
commentViewModel.fetchContentCommentList(this.currentPage + '', this.publishCommentModel.targetId,
this.publishCommentModel.targetType)
.then(commentListModel => {
console.log('评论:', JSON.stringify(commentListModel.list))
this.currentPage++
if (Number.parseInt(commentListModel.totalCommentNum) >
... ... @@ -237,6 +266,9 @@ export struct CommentComponent {
} else {
this.hasMore = false
}
if (!this.fixedHeightMode && this.reachEndLoadMoreFinish) {
this.reachEndLoadMoreFinish()
}
})
}
}
... ... @@ -247,6 +279,7 @@ struct ChildCommentItem {
@Link publishCommentModel: publishCommentModel
@Link dialogController: CustomDialogController | null
@ObjectLink item: commentItemModel
@Consume contentDetailData: ContentDetailDTO
build() {
Column() {
... ... @@ -271,6 +304,14 @@ struct ChildCommentItem {
.alignContent(Alignment.Center)
.onClick(() => {
// TODO 跳转个人详情
// 跳转到号主页
if (this.contentDetailData.rmhInfo?.cnMainControl === 1) {
const params: Params = {
creatorId: this.contentDetailData.rmhInfo.rmhId,
pageID: ''
}
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
})
//昵称
... ... @@ -455,7 +496,7 @@ struct commentHeaderView {
.margin({ left: 8 })
.alignContent(Alignment.Center)
.onClick(() => {
// TODO 跳转个人详情
commentViewModel.jumpToAccountPage(this.item)
})
//昵称
... ...
import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index'
import { publishCommentModel } from '../model/PublishCommentModel'
@CustomDialog
export struct CommentListDialog {
/// 内部使用
private publishCommentModel: publishCommentModel = new publishCommentModel()
controller?: CustomDialogController
/// 外部初始化
contentDetail?: ContentDetailDTO
pageInfo?: PageInfoDTO
build() {
}
}
\ No newline at end of file
... ...
... ... @@ -11,11 +11,12 @@ export struct CommentTabComponent {
}
@ObjectLink publishCommentModel: publishCommentModel
@Prop contentDetail: ContentDetailDTO
@Prop pageComponentType: number = -1 //1:视频详情页
/*展示类型*/
@State type: number = 1
@State placeHolder: string = '说两句...'
@State dialogController: CustomDialogController | null = null;
styleType : number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
/*回调方法*/
dialogControllerConfirm: () => void = () => {
}
... ... @@ -46,16 +47,44 @@ export struct CommentTabComponent {
Row() {
Stack({ alignContent: Alignment.Start }) {
RelativeContainer() {
Image($r('app.media.comment_img_input_hui'))
.objectFit(ImageFit.Fill)
.resizable({ slice: { top: 1, left: 1, right: 20, bottom: 1 } })
if (this.pageComponentType === 1) {
Row() {
}
.width('100%')
.height(30)
.borderRadius(2)
.backgroundColor(this.pageComponentType === 1 ? '#1a1a1a' : Color.Transparent)
.margin({
right: 16,
})
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start },
right: { anchor: "__container__", align: HorizontalAlign.End },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
})
.id("Image")
.id("RowBg")
} else {
Image($r('app.media.comment_img_input_hui'))
.objectFit(ImageFit.Fill)
.resizable({
slice: {
top: 1,
left: 1,
right: 20,
bottom: 1
}
})
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start },
right: { anchor: "__container__", align: HorizontalAlign.End },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
})
.id("Image")
}
Text(this.placeHolder)
.fontSize(12)
.fontColor('#999999')
... ... @@ -91,7 +120,7 @@ export struct CommentIconComponent {
@ObjectLink publishCommentModel: publishCommentModel
/*展示类型*/
@State type: number = 1
styleType : number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
// aboutToAppear(): void {
// setTimeout(() => {
// this.publishCommentModel.totalCommentNumer = '444'
... ...
... ... @@ -412,33 +412,7 @@ struct QualityCommentItem {
jumpToAccountOwner() {
let url = HttpUrlUtils.getOtherUserDetailDataUrl()
let item : Record<string, string >= {
"creatorId": this.item.fromCreatorId || "",
"userType": `${this.item.fromUserType}`,
"userId": this.item.fromUserId || "-1",
}
HttpBizUtil.post<ResponseDTO<MasterDetailRes>>(url, item).then((result) => {
if (!result.data || result.data.mainControl != 1) {
ToastUtils.longToast("暂时无法查看该创作者主页")
return
}
if (result.data.banControl == 1) {
ToastUtils.longToast("该账号已封禁,不予访问")
return
}
if (result.data.userType === "1") { // 普通用户
let params: Record<string, string> = {'userId': result.data.userId};
WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
} else { // 非普通用户
ProcessUtils.gotoPeopleShipHomePage(result.data.creatorId)
}
}).catch(() => {
ToastUtils.longToast("暂时无法查看该创作者主页")
})
commentViewModel.jumpToAccountPage(this.item)
}
jumpToDetail() {
... ...
import { MasterDetailRes } from 'wdBean/Index';
import { SpConstants } from 'wdConstant/Index';
import { DateTimeUtils, Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit/Index';
import {
AccountManagerUtils,
DateTimeUtils, DeviceUtil, Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit/Index';
import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import {
commentItemModel,
commentListModel,
... ... @@ -160,7 +164,9 @@ class CommentViewModel {
publishComment(model: publishCommentModel) {
return new Promise<commentItemModel>((success, fail) => {
let url = HttpUrlUtils.getPublishCommentUrl()
const visitorMode = model.visitorComment == "1" && AccountManagerUtils.isLoginSync() == false
let url = visitorMode ? HttpUrlUtils.getNoUserPublishCommentUrl() : HttpUrlUtils.getPublishCommentUrl()
let bean: Record<string, string> = {};
bean['targetId'] = model.targetId;
... ... @@ -176,6 +182,11 @@ class CommentViewModel {
bean['targetType'] = model.targetType
bean['parentId'] = model.parentId
if (visitorMode) {
bean['deviceId'] = DeviceUtil.clientId()
bean['userName'] = SPHelper.default.getSync(SpConstants.TOURIST_NICK_NAME, "") as string
}
HttpRequest.post<ResponseDTO<commentItemModel>>(url, bean).then((data: ResponseDTO<commentItemModel>) => {
if (data.code != 0) {
ToastUtils.showToast(data.message, 1000);
... ... @@ -185,10 +196,9 @@ class CommentViewModel {
ToastUtils.showToast(data.message, 1000);
let model = data.data as commentItemModel
let userId = HttpUtils.getUserId()
let FIRSTCOMMENTTIME = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, '')
let firstCommentTime = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, '') as string
if (!userId && !FIRSTCOMMENTTIME) {
if (visitorMode && firstCommentTime.length == 0) {
//保存首次评论时间
SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, DateTimeUtils.formatDate(data.timestamp, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
}
... ... @@ -472,6 +482,36 @@ class CommentViewModel {
}
return false
}
jumpToAccountPage(commentItem: commentItemModel) {
let url = HttpUrlUtils.getOtherUserDetailDataUrl()
let item : Record<string, string >= {
"creatorId": commentItem.fromCreatorId || "",
"userType": `${commentItem.fromUserType}`,
"userId": commentItem.fromUserId || "-1",
}
HttpBizUtil.post<ResponseDTO<MasterDetailRes>>(url, item).then((result) => {
if (!result.data || result.data.mainControl != 1) {
ToastUtils.longToast("暂时无法查看该创作者主页")
return
}
if (result.data.banControl == 1) {
ToastUtils.longToast("该账号已封禁,不予访问")
return
}
if (result.data.userType === "1") { // 普通用户
let params: Record<string, string> = {'userId': result.data.userId};
WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
} else { // 非普通用户
ProcessUtils.gotoPeopleShipHomePage(result.data.creatorId)
}
}).catch(() => {
ToastUtils.longToast("暂时无法查看该创作者主页")
})
}
}
... ...
/**
* 直播页面点赞动画
*/
interface animationItem {
x: string | number;
y: string | number;
opacity: number;
name: string;
key: string;
url: Resource
}
@Component
export struct LikeAnimationView {
@State @Watch('countChange') count: number = 0
@State imgList: Resource[] =
[$r('app.media.like_animation_1'), $r('app.media.like_animation_2'), $r('app.media.like_animation_3')]
@State animationList: animationItem[] = []
countChange() {
this.animationList.push({
name: 'xxxx',
x: 0,
y: 0,
opacity: 1,
key: Math.random() + '',
url: this.getRandomUrl()
})
}
getRandomUrl(): Resource {
if (Math.random() >= 0 && Math.random() >= 0.33) {
return this.imgList[0]
} else if (Math.random() >= 0.33 && Math.random() >= 0.66) {
return this.imgList[1]
} else {
return this.imgList[2]
}
}
startAnimation() {
}
stopAnimation() {
}
aboutToAppear(): void {
}
aboutToDisappear(): void {
}
build() {
Stack() {
ForEach(this.animationList, (item: animationItem) => {
Image(item.url)
.width(48)
.height(48)
}, (item: animationItem) => item.key)
}
}
}
\ No newline at end of file
... ...
... ... @@ -21,6 +21,7 @@ const TAG = 'PageComponent';
export struct PageComponent {
@State private pageModel: PageModel = new PageModel();
@State private pageAdvModel: PageAdModel = new PageAdModel();
@State timer: number = -1
navIndex: number = 0;
pageId: string = "";
channelId: string = "";
... ... @@ -29,6 +30,7 @@ export struct PageComponent {
@Prop @Watch('onAutoRefresh') autoRefresh: number = 0
private listScroller: Scroller = new Scroller();
needload: boolean = true;
build() {
Column() {
if (this.pageModel.viewType == ViewType.LOADING) {
... ... @@ -222,9 +224,10 @@ export struct PageComponent {
}
onChange() {
Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`);
Logger.info(TAG,
`onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`);
if (this.navIndex === this.currentTopNavSelectedIndex) {
if(this.needload){
if (this.needload) {
this.getData();
}
this.needload = false;
... ... @@ -242,13 +245,19 @@ export struct PageComponent {
}
async getData() {
Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
this.pageModel.pageId = this.pageId;
this.pageModel.groupId = this.pageId;
this.pageModel.channelId = this.channelId;
this.pageModel.currentPage = 1;
this.pageModel.pageTotalCompSize = 0;
PageHelper.getInitData(this.pageModel, this.pageAdvModel)
if (this.timer) {
clearTimeout(this.timer)
}
this.timer = setTimeout(() => {
Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
this.pageModel.pageId = this.pageId;
this.pageModel.groupId = this.pageId;
this.pageModel.channelId = this.channelId;
this.pageModel.currentPage = 1;
this.pageModel.pageTotalCompSize = 0;
PageHelper.getInitData(this.pageModel, this.pageAdvModel)
}, 100)
}
}
... ...
import { insightIntent } from '@kit.IntentsKit';
import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean';
import { SpConstants } from 'wdConstant';
import { DisplayUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit';
... ... @@ -8,6 +9,7 @@ import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent
import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent';
import { channelSkeleton } from '../skeleton/channelSkeleton';
import { common } from '@kit.AbilityKit';
const TAG = 'TopNavigationComponent';
... ... @@ -37,6 +39,7 @@ export struct TopNavigationComponent {
// 顶导当前选中/焦点下标
@State currentTopNavSelectedIndex: number = 0;
@State currentTopNavName: string = '';
@State currentTopNavItem: TopNavDTO = {} as TopNavDTO
// 顶导数据
@State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = []
@State compList: LazyDataSource<CompDTO> = new LazyDataSource();
... ... @@ -58,6 +61,8 @@ export struct TopNavigationComponent {
@Prop @Watch('onAutoRefresh') autoRefresh: number = 0
// 传递给page的自动刷新通知
@State autoRefresh2Page: number = 0
//保存当前导航选中时的时间戳 意图开始时间
@State executedStartTime: number = new Date().getTime()
// 当前底导index
@State navIndex: number = 0
@State animationDuration: number = 0
... ... @@ -167,6 +172,7 @@ export struct TopNavigationComponent {
this.currentTopNavSelectedIndex = index
this.currentTopNavName = this.myChannelList[index].name
}
this.currentTopNavItem = this.myChannelList[this.currentTopNavSelectedIndex]
}
isBroadcast(item: TopNavDTO) {
... ... @@ -184,6 +190,49 @@ export struct TopNavigationComponent {
return item.channelType === 3
}
//意图共享
topNavInsightIntentShare(item: TopNavDTO){
let tapNavIntent: insightIntent.InsightIntent = {
intentName: 'ViewColumn',
intentVersion: '1.0.1',
identifier: '52dac3b0-6520-4974-81e5-25f0879449b5',
intentActionInfo: {
actionMode: 'EXPECTED',
currentPercentage: 50,
executedTimeSlots: {
executedEndTime: new Date().getTime(),
executedStartTime: this.executedStartTime
}
},
intentEntityInfo: {
entityName: 'ViewColumn',
entityId: String(item.pageId) || '',
displayName: item.name,
logoURL: 'https://www-file.huawei.com/-/media/corporate/images/home/logo/huawei_logo.png',
rankingHint: 99,
isPublicData: true
}
}
try {
let context = getContext(this) as common.UIAbilityContext;
// 共享数据
insightIntent.shareIntent(context, [tapNavIntent], (error) => {
if (error?.code) {
// 处理业务逻辑错误
console.error(`shareIntent failed, error.code: ${error?.code}, error.message: ${error?.message}`);
return;
}
// 执行正常业务
console.log('shareIntent succeed');
});
} catch (error) {
// 处理异常
console.error(`error.code: ${error?.code}, error.message: ${error?.message}`);
}
}
build() {
Column() {
// 顶部搜索、日报logo、早晚报
... ... @@ -278,7 +327,11 @@ export struct TopNavigationComponent {
if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) &&
!this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])
) {
//在 tab 切换之前意图共享
// this.topNavInsightIntentShare(this.currentTopNavItem)
this.currentTopNavSelectedIndex = index;
this.currentTopNavItem = this.myChannelList[index]
}
if (this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) {
// 跳转到播报页面
... ... @@ -416,9 +469,11 @@ export struct TopNavigationComponent {
this.changeByClick = true
this.tabsController.changeIndex(index)
}
})
}
aboutToAppear() {
//处理新闻tab顶导频道数据
this.topNavListHandle()
... ...
... ... @@ -86,7 +86,7 @@ export struct PeopleShipHomeArticleListComponent {
// 加载更多
ListItem() {
if (this.hasMore) {
if (this.hasMore && this.arr && this.arr.length > 0) {
LoadMoreLayout({ isVisible: this.hasMore })
} else if (!this.hasMore && !this.isLoading) {
PeopleShipNoMoreData()
... ...
... ... @@ -43,9 +43,8 @@ export struct PeopleShipHomePageNavComponent {
}).onClick(()=>{
let params = {
'headPhotoUrl': this.detailModel.headPhotoUrl,
'headType': '1'
} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage,params)
WDRouterRule.jumpWithPage(WDRouterPage.showHomePageHeaderPage,params)
}).margin({
left: '10vp',
})
... ...
... ... @@ -56,9 +56,8 @@ export struct PeopleShipHomePageTopComponent {
}).onClick(() => {
let params = {
'headPhotoUrl': this.detailModel.headPhotoUrl,
'headType': '1'
} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage, params)
WDRouterRule.jumpWithPage(WDRouterPage.showHomePageHeaderPage, params)
})
... ... @@ -369,7 +368,11 @@ export struct PeopleShipHomePageTopComponent {
private computeShowNum(count: number) {
if (count >= 10000) {
return `${(count / 10000).toFixed(1)}万`
let num = ( count / 10000).toFixed(1)
if (Number(num.substring(num.length-1)) == 0) {
num = num.substring(0, num.length-2)
}
return num + '万'
}
return `${count}`
}
... ...
... ... @@ -96,7 +96,7 @@ struct ReserveMorePage {
)
// 加载更多
ListItem() {
if (this.hasMore) {
if (this.hasMore && this.data && this.data.totalCount() > 0) {
LoadMoreLayout({ isVisible: this.hasMore })
} else if (!this.hasMore && !this.isLoading) {
PeopleShipNoMoreData()
... ... @@ -127,7 +127,7 @@ struct ReserveMorePage {
buildItem(item: ContentDTO, index: number) {
Column() {
Stack() {
Image(item.fullColumnImgUrls[0].url)
Image(item.fullColumnImgUrls[0]?.url)
.width('100%')
.height(196)
.borderRadius(4)
... ... @@ -139,8 +139,9 @@ struct ReserveMorePage {
Text(item.newsTitle)
.fontSize(17)
.maxLines(2)
.lineHeight(25)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ top: 16, left: 12, right: 12 })
.margin({ top: 4, left: 12, right: 12 })
.alignSelf(ItemAlign.Start)
Row() {
Row() {
... ... @@ -148,6 +149,7 @@ struct ReserveMorePage {
.width(20)
.height(20)
.margin({ left: 10, top: 2, bottom: 2, right: 6 })
// Text(DateTimeUtils.formatDate(item.liveInfo.liveStartTime, "MM月dd日 HH:mm"))
Text(this.getReserveDate(item.liveInfo.liveStartTime, 1))
.fontSize(12)
... ... @@ -256,6 +258,9 @@ struct ReserveMorePage {
.height(24)
.objectFit(ImageFit.Auto)
.id("back_icon")
.margin({
left: '16vp'
})
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
left: { anchor: "__container__", align: HorizontalAlign.Start }
... ... @@ -267,10 +272,10 @@ struct ReserveMorePage {
Text(this.title)// .height('42lpx')
.maxLines(1)
.id("title")
.fontSize('35lpx')
.fontSize('18vp')
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.lineHeight('42lpx')
.lineHeight('22vp')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
... ... @@ -284,11 +289,14 @@ struct ReserveMorePage {
@Builder
LiveImage() {
Row() {
Image($r('app.media.reserve_icon'))
.width(22)
.height(18)
Image($r('app.media.reserve_new_icon'))
.width(14)
.height(14)
.margin({
right: 3
})
Text('预约')
.fontSize('11fp')
.fontSize('12vp')
.fontWeight(400)
.fontColor(Color.White)
}
... ...
... ... @@ -131,10 +131,8 @@ export struct SearchResultComponent {
.barWidth('100%')
.barHeight('84lpx')
.animationDuration(0)
.onChange((index: number) => {
this.currentIndex = index
})
.width('100%')
.scrollable(false)
.layoutWeight(1)
}
}.width('100%')
... ...
... ... @@ -22,7 +22,7 @@ export struct LikeComponent {
@Prop data: Record<string, string>
enableBtn = true
componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口
styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) 3 透明背景
@State likeCount: number = 0 //点赞数
//上层传值 样例
... ... @@ -50,6 +50,7 @@ export struct LikeComponent {
//2: 新闻页中间位置样式
this.likeCompStyle2()
} else if (this.componentType == 3) {
//卡片底部互动样式
this.likeCompStyle3()
} else if (this.componentType == 4) {
// 直播,点赞按钮底测有灰色圆角背景+右上点赞数量
... ... @@ -67,7 +68,7 @@ export struct LikeComponent {
if (this.likesStyle === 1) {
return {
url: this.likeStatus ? $r(`app.media.ic_like_check`) :
this.styleType == 1 ? $r('app.media.icon_like_default') : $r(`app.media.ic_like_uncheck`),
this.styleType == 1 ? this.componentType == 3?$r(`app.media.CarderInteraction_like`):$r('app.media.icon_like_default') : $r(`app.media.ic_like_uncheck`),
name: '赞'
}
} else if (this.likesStyle === 2) {
... ... @@ -133,8 +134,8 @@ export struct LikeComponent {
Image(this.transLikeStyle().url)
.width(18)
.height(18)
// Text(this.likeStatus ? '已赞' : '点赞')
Text(this.likeCount > 0 ? this.likeCount.toString() : '点赞')
Text(this.likeStatus ? '已赞' : '点赞')
// Text(this.likeCount > 0 ? this.likeCount.toString() : '点赞')
.margin({ left: 4 })
.fontSize(14)
.fontColor(this.likeStatus ? '#ED2800' : '#666666')
... ...
... ... @@ -59,6 +59,7 @@ export struct OperRowListView {
* 7:图集详情页
*/
@Prop componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口
@Prop pageComponentType: number = -1 //1:视频详情页
@State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件
@State needLike: boolean = true
... ... @@ -115,6 +116,8 @@ export struct OperRowListView {
}
build() {
// 视频详情页
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
// AudioDialog()
Row() {
... ... @@ -162,6 +165,7 @@ export struct OperRowListView {
bottom: `${this.bottomSafeHeight}px`
// bottom: 50
})
}
/**
... ... @@ -174,12 +178,16 @@ export struct OperRowListView {
CommentTabComponent({
publishCommentModel: this.publishCommentModel,
contentDetail: this.contentDetailData,
onCommentFocus: this.onCommentFocus
onCommentFocus: this.onCommentFocus,
pageComponentType: this.pageComponentType
})
}
}
.flexShrink(1)
.layoutWeight(1)
.margin({
right: this.pageComponentType === 1 ? 16 : 0,
})
if (this.showCommentIcon) {
Column() {
if (this.publishCommentModel?.targetId) {
... ...
... ... @@ -2,6 +2,8 @@ import { Action, NewspaperListBean, NewspaperListItemBean, NewspaperPositionItem
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
import { WDRouterRule } from 'wdRouter/Index'
import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'
import { Logger } from 'wdKit';
import { window } from '@kit.ArkUI';
/**
* 读报纸半屏弹窗
... ... @@ -35,6 +37,12 @@ export struct ENewspaperListDialog {
// listDialogController: CustomDialogController
public closeDialog?: () => void
// 手势滑动相关
private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Up | PanDirection.Down })
private topFixedHeight = 124
@State topHeight: number = 124
private deviceHeight: number = 0
//watch监听报纸页码回调
onCurrentPageNumUpdated(): void {
console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)
... ... @@ -46,7 +54,13 @@ export struct ENewspaperListDialog {
}
}
aboutToAppear(): void {
async aboutToAppear() {
// 屏幕高度 - 滑动高度计算
let windowClass: window.Window = await window.getLastWindow(getContext(this));
let changeHeight = 85 + 44 + px2vp(windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height)
changeHeight += px2vp(windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).bottomRect.height)
this.deviceHeight = px2vp(windowClass.getWindowProperties().windowRect.height) - changeHeight
this.isCurrentViewOpen = true
console.log("ENewspaperListDialog-aboutToAppear", "currentPageNum:", this.currentPageNum)
let _scrollIndex = Number.parseInt(this.currentPageNum)
... ... @@ -56,60 +70,76 @@ export struct ENewspaperListDialog {
}
aboutToDisappear() {
// if (this.pageListDialogController) {
// this.pageListDialogController = null
// }
this.isCurrentViewOpen = false
}
build() {
Stack() {
Column() {
Row()
.width(43)
.height(4)
.backgroundColor('#EDEDED')
.margin({
top: 10,
bottom: 10
})
Column() {
Row()
.width(43)
.height(4)
.backgroundColor('#EDEDED')
.margin({
top: 10,
bottom: 10
})
.onClick(() => {
if (this.closeDialog) {
this.closeDialog()
}
})
Row() {
Text(this.currentPageNum)
.fontSize($r('app.float.font_size_36'))
.fontColor($r('app.color.color_222222'))
.fontFamily('BebasNeueBold')
Text('版')
.fontSize($r('app.float.font_size_16'))
.fontColor($r('app.color.color_222222'))
.margin({ bottom: 6 })
Image($r('app.media.icon_triangle_black'))
.width($r('app.float.border_radius_6'))
.height($r('app.float.border_radius_6'))
.margin({ left: 2, bottom: 6 })
}
.alignItems(VerticalAlign.Bottom)
.margin({ left: 15 })
.alignSelf(ItemAlign.Start)
.onClick(() => {
if (this.closeDialog) {
this.closeDialog()
this.pageDialogShow = !this.pageDialogShow
if (this.pageDialogShow) {
this.pageListDialogController.open()
} else {
this.pageListDialogController.close()
}
})
Row() {
Text(this.currentPageNum)
.fontSize($r('app.float.font_size_36'))
.fontColor($r('app.color.color_222222'))
.fontFamily('BebasNeueBold')
Text('版')
.fontSize($r('app.float.font_size_16'))
.fontColor($r('app.color.color_222222'))
.margin({ bottom: 6 })
Image($r('app.media.icon_triangle_black'))
.width($r('app.float.border_radius_6'))
.height($r('app.float.border_radius_6'))
.margin({ left: 2, bottom: 6 })
Image($r('app.media.line'))
.width('100%')
.height(6)
.margin({ top: 20, left: 16, right: 16 })
.objectFit(ImageFit.Contain)
}
.alignItems(VerticalAlign.Bottom)
.margin({ left: 15 })
.alignSelf(ItemAlign.Start)
.onClick(() => {
this.pageDialogShow = !this.pageDialogShow
if (this.pageDialogShow) {
this.pageListDialogController.open()
} else {
this.pageListDialogController.close()
}
})
.width('100%')
.gesture(
PanGesture(this.panOption)
.onActionStart((event: GestureEvent) => {
Logger.debug('ENewspaperListDialog','Pan start')
})
.onActionUpdate((event: GestureEvent) => {
if (this.topFixedHeight + event.offsetY >= this.topFixedHeight) {
this.topHeight = this.topFixedHeight + event.offsetY
}
Logger.debug('ENewspaperListDialog', 'topHeight:' + this.topHeight)
})
.onActionEnd(() => {
this.onCloseGestureDialog()
})
)
Image($r('app.media.line'))
.width('100%')
.height(6)
.margin({ top: 20, left: 16, right: 16 })
.objectFit(ImageFit.Contain)
List({ scroller: this.listScroller, initialIndex: this.scrollIndex }) {
ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => {
... ... @@ -137,7 +167,7 @@ export struct ENewspaperListDialog {
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.maxLines(2)
// .maxLines(2)
.margin({
bottom: 8
})
... ... @@ -151,7 +181,7 @@ export struct ENewspaperListDialog {
.margin({
bottom: 8
})
.maxLines(2)
// .maxLines(2)
}
if (positionItem.downTitle) {
... ... @@ -162,7 +192,7 @@ export struct ENewspaperListDialog {
.margin({
bottom: 8
})
.maxLines(2)
// .maxLines(2)
}
if (positionItem.newsTxt) {
Text(positionItem.newsTxt)
... ... @@ -251,16 +281,13 @@ export struct ENewspaperListDialog {
this.currentPageNum = `${firstIndex < 9 ? '0' + (firstIndex + 1) : firstIndex + 1}`
// }
})
.onScroll((scrollOffset: number, scrollState: ScrollState) => {
// console.info(`onScroll scrollState = ScrollState` + scrollState + `, scrollOffset = ` + scrollOffset)
// if (this.scrollOffset == 0) {
// this.scrollOffset = 0
// }
})
}
.margin({ top: 124 })
// .margin({ top: 124 })
.margin({ top: this.topHeight })
.width('100%')
.backgroundColor(Color.White)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
.onClick(() => {
})
... ... @@ -272,6 +299,33 @@ export struct ENewspaperListDialog {
this.closeDialog()
}
})
.gesture(
PanGesture(this.panOption)
.onActionStart((event: GestureEvent) => {
Logger.debug('ENewspaperListDialog','Pan start')
})
.onActionUpdate((event: GestureEvent) => {
if (event) {
if (this.topFixedHeight + event.offsetY >= this.topFixedHeight) {
this.topHeight = this.topFixedHeight + event.offsetY
}
Logger.debug('ENewspaperListDialog', 'topHeight:' + this.topHeight)
}
})
.onActionEnd(() => {
this.onCloseGestureDialog()
})
)
}
onCloseGestureDialog() {
if (this.topHeight >= this.deviceHeight ) {
if (this.closeDialog) {
this.closeDialog()
}
} else {
this.topHeight = this.topFixedHeight
}
}
updateRecordsData() {
... ...
... ... @@ -8,5 +8,6 @@ struct SearchPage {
SearchComponent()
}.height('100%')
.width('100%')
.backgroundColor($r('app.color.white'))
}
}
\ No newline at end of file
... ...
import { router } from '@kit.ArkUI';
@Entry
@Component
struct ShowHomePageHeaderPage {
@State headPhotoUrl: string = '';
@State params:Record<string, string> = router.getParams() as Record<string, string>;
onPageShow() {
this.headPhotoUrl = this.params?.['headPhotoUrl'];
}
build() {
Row() {
Image(this.headPhotoUrl)
.alt( $r('app.media.WDAccountOwnerHedaerDefaultIcon') )
.width('100%')
.objectFit(ImageFit.Contain)
}
.width('100%')
.height('100%')
.alignItems(VerticalAlign.Center)
.backgroundColor($r('app.color.color_000000'))
.onClick(()=>{
router.back()
})
}
}
\ No newline at end of file
... ...
... ... @@ -4,18 +4,16 @@ import { router } from '@kit.ArkUI';
@Component
struct ShowUserHeaderPage {
@State headPhotoUrl: string = '';
@State headType: string = ''
@State params:Record<string, string> = router.getParams() as Record<string, string>;
onPageShow() {
this.headPhotoUrl = this.params?.['headPhotoUrl'];
this.headType = this.params?.['headType'] ?? '';
}
build() {
Row() {
Image(this.headPhotoUrl)
.alt(this.headType.length > 0 ? $r('app.media.WDAccountOwnerHedaerDefaultIcon') : $r('app.media.default_head'))
.alt($r('app.media.default_head'))
.width('720lpx')
.height('720lpx')
.objectFit(ImageFit.Auto)
... ...
... ... @@ -24,6 +24,7 @@
"components/page/ThemeListPage",
"pages/ShowUserHeaderPage",
"pages/MineMessagePage",
"components/page/InteractMessagePage"
"components/page/InteractMessagePage",
"pages/ShowHomePageHeaderPage"
]
}
\ No newline at end of file
... ...
... ... @@ -70,6 +70,7 @@ export struct DetailPlayLiveCommon {
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
this.publishCommentModel.commentContent = ''
// }
}
... ...
... ... @@ -121,11 +121,12 @@ export struct PlayUIComponent {
}
}
.width('100%')
// .width(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? 'calc(100% - 80vp)' : 'calc(100% - 32vp)')
.padding({
top: 15,
bottom: 6,
left: 10,
right: 10
left: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp',
right: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp'
})
.alignItems(HorizontalAlign.Start)
.visibility(this.isMenuVisible ? Visibility.Visible : Visibility.None)
... ... @@ -292,8 +293,8 @@ export struct PlayUIComponent {
.linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] })
.width('100%')
.padding({
left: 10,
right: 10,
left: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp',
right: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp',
top: 15,
bottom: 15
})
... ...
... ... @@ -28,11 +28,11 @@ export struct TopPlayComponent {
updateData() {
//直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.previewUrl && this.liveDetailsBean.liveInfo.previewUrl.length > 0) {
if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.previewUrl &&
this.liveDetailsBean.liveInfo.previewUrl.length > 0) {
this.imgUrl = this.liveDetailsBean.liveInfo.previewUrl
Logger.debug(TAG, 'ok+' + `${this.imgUrl}`)
}
else if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) {
} else if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) {
this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url
Logger.debug(TAG, 'ok-' + `${this.imgUrl}`)
}
... ... @@ -81,6 +81,7 @@ export struct TopPlayComponent {
.alignSelf(ItemAlign.Center)
}
aboutToDisappear(): void {
async aboutToDisappear(): Promise<void> {
await this.playerController?.release()
}
}
\ No newline at end of file
... ...
... ... @@ -115,6 +115,7 @@ export struct PlayerCommentComponent {
// 收藏、分享、点赞是否需要根据字段显隐
OperRowListView({
styleType: 3,
componentType: 4,
operationButtonList: ['comment', 'collect', 'share', 'like'],
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
... ...
... ... @@ -37,11 +37,10 @@ export struct PlayerComponent {
}
}
aboutToDisappear(): void {
async aboutToDisappear(): Promise<void> {
this.playerController?.pause()
this.playerController?.stop()
this.playerController?.release()
await this.playerController?.release()
}
updateData() {
... ...
import { ContentDetailDTO } from 'wdBean/Index'
import {
publishCommentModel
} from '../../../../../wdComponent/src/main/ets/components/comment/model/PublishCommentModel'
import { CommentComponent } from '../../../../../wdComponent/src/main/ets/components/comment/view/CommentComponent'
@Component
export struct CommentComponentPage {
scroller: Scroller = new Scroller()
@Consume contentDetailData: ContentDetailDTO
@Consume showCommentList: boolean
@State publishCommentModel: publishCommentModel = new publishCommentModel()
aboutToAppear(): void {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
}
build() {
Scroll(this.scroller) {
Stack() {
CommentComponent({
publishCommentModel: this.publishCommentModel
})
Image($r("app.media.ic_close_black"))
.width(20)
.height(20)
.onClick(() => {
this.showCommentList = false
})
.margin({ top: 10, right: 20 })
.position({ x: '100%' })
.markAnchor({ x: '100%' })
}
}
.zIndex(1000)
.backgroundColor(Color.White)
}
}
\ No newline at end of file
... ...
import { ContentDetailDTO, InteractDataDTO } from 'wdBean';
import { PlayerConstants, WDPlayerController, WDPlayerRenderView } from 'wdPlayer';
import { WDPlayerController, WDPlayerRenderView } from 'wdPlayer';
import { ContentDetailRequest } from 'wdDetailPlayApi';
import {
batchLikeAndCollectParams,
... ... @@ -11,6 +11,7 @@ import { HttpUtils } from 'wdNetwork/Index';
import { DateTimeUtils } from 'wdKit/Index';
import { PlayerBottomView } from '../view/PlayerBottomView';
import { PlayerRightView } from '../view/PlayerRightView';
import { CommentComponentPage } from './CommentComponentPage';
const TAG = 'DetailPlayShortVideoPage';
... ... @@ -32,6 +33,7 @@ export struct DetailPlayShortVideoPage {
@Provide followStatus: string = '0' // 关注状态
@Provide isOpenDetail: boolean = false // 查看详情按钮点击
@Provide isDragging: boolean = false // 拖动时间进度条
@Provide showCommentList: boolean = false
@Consume @Watch('videoStatusChange') switchVideoStatus: boolean
@Consume @Watch('pageShowChange') pageShow: number
@Consume topSafeHeight: number
... ... @@ -148,6 +150,7 @@ export struct DetailPlayShortVideoPage {
this.progressVal = Math.floor(position * 100 / duration);
}
this.queryNewsInfoOfUser()
}
async aboutToDisappear(): Promise<void> {
... ... @@ -163,10 +166,14 @@ export struct DetailPlayShortVideoPage {
PlayerBottomView({
playerController: this.playerController
})
PlayerRightView({
playerController: this.playerController
})
CommentComponentPage({}).visibility(this.showCommentList ? Visibility.Visible : Visibility.None)
.position({ y: '100%' })
.markAnchor({ y: '100%' })
}
.height('100%')
.width('100%')
... ... @@ -192,6 +199,7 @@ export struct DetailPlayShortVideoPage {
@Builder
playerViewBuilder() {
WDPlayerRenderView({
playerController: this.playerController,
onLoad: async () => {
... ... @@ -205,10 +213,13 @@ export struct DetailPlayShortVideoPage {
.padding({
bottom: this.videoLandScape === 1 ? 115 : 0,
})
.layoutWeight(1)
.align(this.videoLandScape === 0 ? Alignment.Top : Alignment.Center)
.onClick(() => {
console.error('WDPlayerRenderView=== onClick')
this.playerController?.switchPlayOrPause();
})
}
}
\ No newline at end of file
... ...
... ... @@ -43,7 +43,7 @@ export struct DetailDialog {
.height(200)
Row() {
Image($r('app.media.ic_close'))
Image($r("app.media.ic_close_white"))
.height(24).margin({ top: 20 }).onClick(() => {
this.controller.close()
if (this.isOpenDetail) {
... ...
... ... @@ -3,20 +3,56 @@ import { PlayerTitleView } from './PlayerTitleView'
import { PlayerProgressView } from './PlayerProgressView'
import { PlayerCommentView } from './PlayerCommentView'
import { PlayerTimeSeekView } from './PlayerTimeSeekView'
import { OperRowListView } from '../../../../../wdComponent/src/main/ets/components/view/OperRowListView'
import {
publishCommentModel
} from '../../../../../wdComponent/src/main/ets/components/comment/model/PublishCommentModel'
import { ContentDetailDTO } from 'wdBean/Index';
import { WindowModel } from 'wdKit/Index';
@Component
export struct PlayerBottomView {
private playerController?: WDPlayerController;
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@Consume showComment?: boolean
@Consume isOpenDetail?: boolean
@Consume isDragging?: boolean
@Consume contentDetailData: ContentDetailDTO
@State publishCommentModel: publishCommentModel = new publishCommentModel()
aboutToAppear(): void {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.commentContent = ''
}
build() {
Column() {
PlayerTitleView()
PlayerProgressView({ playerController: this.playerController })
if (this.showComment) {
PlayerCommentView()
// PlayerCommentView()
OperRowListView({
pageComponentType: 1,
styleType: 3,
componentType: 4,
operationButtonList: ['comment',],
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
showCommentIcon: false,
onBack: () => {
WindowModel.shared.setWindowLayoutFullScreen(false)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
}
})
.padding({
bottom: -this.bottomSafeHeight + 'px'
})
}
}
.alignItems(HorizontalAlign.Start)
... ...
... ... @@ -32,6 +32,7 @@ export struct PlayerRightView {
@Consume isOpenDetail: boolean
@Consume isDragging: boolean
@Consume showComment?: boolean
@Consume showCommentList: boolean
@State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
aboutToAppear() {
... ... @@ -343,7 +344,8 @@ export struct PlayerRightView {
}
.margin({ bottom: 20 })
.onClick((event: ClickEvent) => {
ToastUtils.showToast('评论为公共方法,待开发', 1000);
// ToastUtils.showToast('评论为公共方法,待开发', 1000);
this.showCommentList = true
})
}
... ...
... ... @@ -5,6 +5,14 @@
"value": "#FFFFFF"
},
{
"name": "color_transparent",
"value": "#00000000"
},
{
"name": "color_222222",
"value": "#222222"
},
{
"name": "play_track_color",
"value": "#1AFFFFFF"
},
... ... @@ -29,6 +37,18 @@
"value": "#4DFFFFFF"
},
{
"name": "color_666666",
"value": "#666666"
},
{
"name": "color_B0B0B0",
"value": "#B0B0B0"
},
{
"name": "color_EDEDED",
"value": "#EDEDED"
},
{
"name": "divider_color",
"value": "#D3D3D3"
},
... ...
... ... @@ -3,6 +3,22 @@
{
"name": "shared_desc",
"value": "description"
},
{
"name": "footer_text",
"value": "已显示全部内容"
},
{
"name": "pull_up_load_text",
"value": "加载中..."
},
{
"name": "pull_down_refresh_text",
"value": "下拉刷新"
},
{
"name": "release_refresh_text",
"value": "松开刷新"
}
]
}
\ No newline at end of file
... ...
... ... @@ -2,7 +2,10 @@ import HuaweiAuth from './utils/HuaweiAuth'
import { JumpInterceptorAction, RouterJumpInterceptor, WDRouterPage } from 'wdRouter'
import { BusinessError } from '@kit.BasicServicesKit'
import { router } from '@kit.ArkUI'
import { AccountManagerUtils } from 'wdKit/Index'
import { AccountManagerUtils, SPHelper } from 'wdKit/Index'
import { LoginViewModel } from './pages/login/LoginViewModel'
import { SpConstants } from 'wdConstant/Index'
import { ReportDeviceInfo } from './reportDeviceInfo/ReportDeviceInfo'
class LoginJumpHandler implements JumpInterceptorAction {
... ... @@ -37,4 +40,14 @@ export class LoginModule {
}
}
// 启动进入主页 和 每次登录成功调用
static reportDeviceInfo() {
ReportDeviceInfo.reportDeviceInfo().then((res) => {
let nickName = res.touristNickName
if (res.touristNickName) {
SPHelper.default.save(SpConstants.TOURIST_NICK_NAME, res.touristNickName)
}
})
}
}
\ No newline at end of file
... ...
... ... @@ -82,6 +82,30 @@ export class LoginModel {
})
}
// loginType 0:手机号密码 2:手机号登录 3:QQ 4:微信 5:微博 6:APPLEID 7:手机号一键登录8:账号+密码 9:华为一键登录
thirdPartLogin(loginType: number, otherParams: Record<string, string|number>) {
otherParams['loginType'] = loginType
otherParams['deviceId'] = HttpUtils.getDeviceId()
return new Promise<LoginBean>((success, fail) => {
HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), otherParams).then((data: ResponseDTO<LoginBean>) => {
Logger.debug("LoginViewModel:success2 ", data.message)
if (!data) {
fail("数据为空")
return
}
if (!data.data||data.code != 0) {
fail(data.message)
return
}
success(data.data)
}, (error: Error) => {
fail(error.message)
Logger.debug("LoginViewModel:error2 ", error.toString())
})
})
}
// {"password":"523acd319228efde34e8a30268ee8ca5e4fc421d72affa531676e1765940d22c","phone":"13625644528","loginType":0,"oldPassword":"BA5FD74F827AF9B271FE17CADC489C36","deviceId":"60da5af6-9c59-3566-8622-8c6c00710994"}
appLoginByPassword(phone: string, loginType: number, password: string, oldPassword: string) {
let bean: Record<string, string | number> = {};
... ...
... ... @@ -407,14 +407,9 @@ struct LoginPage {
queryUserDetail(){
this.loginViewModel.queryUserDetail().then(()=>{
router.back({
url: `${WDRouterPage.getBundleInfo()}`
}
)
router.back()
}).catch(()=>{
router.back({
url: `${WDRouterPage.getBundleInfo()}`
})
router.back()
})
}
... ...
... ... @@ -10,6 +10,7 @@ import { encryptMessage } from '../../utils/cryptoUtil'
import { SpConstants } from 'wdConstant/Index'
import { UserDetail } from 'wdBean/Index';
import { HttpUtils } from 'wdNetwork/Index'
import { LoginModule } from '../../LoginModule'
const TAG = "LoginViewModel"
... ... @@ -47,15 +48,7 @@ export class LoginViewModel {
return new Promise<LoginBean>((success, fail) => {
this.loginModel.appLogin(phone, loginType, verificationCode).then((data: LoginBean) => {
SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, data.firstMark)
SPHelper.default.saveSync(SpConstants.USER_ID, data.id)
SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken)
SPHelper.default.saveSync(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, data.longTimeNoLoginMark)
SPHelper.default.saveSync(SpConstants.USER_REFRESH_TOKEN, data.refreshToken)
SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status)
SPHelper.default.saveSync(SpConstants.USER_Type, data.userType)
SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName)
EmitterUtils.sendEmptyEvent(EmitterEventId.LOGIN_SUCCESS)
this.dealWithLoginSuccess(data)
success(data)
}).catch((error:string) => {
fail(error)
... ... @@ -63,6 +56,32 @@ export class LoginViewModel {
})
}
huaweiOneKeyLogin(authCode: string) {
return new Promise<LoginBean>((success, fail) => {
this.loginModel.thirdPartLogin(9, {"idToken": authCode}).then((data: LoginBean) => {
this.dealWithLoginSuccess(data)
success(data)
}).catch((error:string) => {
fail(error)
})
})
}
//TODO: 这里要整体改掉
dealWithLoginSuccess(data: LoginBean) {
SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, data.firstMark)
SPHelper.default.saveSync(SpConstants.USER_ID, data.id)
SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken)
SPHelper.default.saveSync(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, data.longTimeNoLoginMark)
SPHelper.default.saveSync(SpConstants.USER_REFRESH_TOKEN, data.refreshToken)
SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status)
SPHelper.default.saveSync(SpConstants.USER_Type, data.userType)
SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName)
EmitterUtils.sendEmptyEvent(EmitterEventId.LOGIN_SUCCESS)
LoginModule.reportDeviceInfo()
}
async appLoginByPassword(phone: string, loginType: number, password: string, oldPassword: string) {
let newLoginType: number
let isPhone = this.verifyIsPhoneNumber(phone)
... ... @@ -75,15 +94,7 @@ export class LoginViewModel {
let passwordNew = await this.doMd(password)
Logger.debug(TAG, "PASSWORD:" + passwordNew)
this.loginModel.appLoginByPassword(phone, newLoginType, passwordNew, oldPassword).then((data: LoginBean) => {
SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, data.firstMark)
SPHelper.default.saveSync(SpConstants.USER_ID, data.id)
SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken)
SPHelper.default.saveSync(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, data.longTimeNoLoginMark)
SPHelper.default.saveSync(SpConstants.USER_REFRESH_TOKEN, data.refreshToken)
SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status)
SPHelper.default.saveSync(SpConstants.USER_Type, data.userType)
SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName)
EmitterUtils.sendEmptyEvent(EmitterEventId.LOGIN_SUCCESS)
this.dealWithLoginSuccess(data)
success(data)
}).catch((value: string) => {
fail(value)
... ... @@ -219,18 +230,29 @@ export class LoginViewModel {
this.loginModel.queryUserDetail().then((data: UserDetail) => {
//保存sp
if(data){
SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName)
SPHelper.default.saveSync(SpConstants.USER_PHONE, data.phone)
if(data.userName!=undefined){
SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName)
}
if(data.phone!=undefined){
SPHelper.default.saveSync(SpConstants.USER_PHONE, data.phone)
}
}
if(data.userExtend){
SPHelper.default.saveSync(SpConstants.USER_SEX, data.userExtend.sex)
SPHelper.default.saveSync(SpConstants.USER_CREATOR_ID, data.userExtend.creatorId+"")
SPHelper.default.saveSync(SpConstants.USER_HEAD_PHOTO_URL, data.userExtend.headPhotoUrl)
SPHelper.default.saveSync(SpConstants.USER_BIRTHDAY, data.userExtend.birthday)
if(data.userExtend.sex!=undefined){
SPHelper.default.saveSync(SpConstants.USER_SEX, data.userExtend.sex)
}
if(data.userExtend.creatorId!=undefined){
SPHelper.default.saveSync(SpConstants.USER_CREATOR_ID, data.userExtend.creatorId+"")
}
if(data.userExtend.headPhotoUrl!=undefined){
SPHelper.default.saveSync(SpConstants.USER_HEAD_PHOTO_URL, data.userExtend.headPhotoUrl)
}
if(data.userExtend.birthday!=undefined){
SPHelper.default.saveSync(SpConstants.USER_BIRTHDAY, data.userExtend.birthday)
}
}
success(data)
}).catch(() => {
}).catch((error:Error) => {
fail()
})
})
... ...
... ... @@ -3,13 +3,30 @@ import { Params } from 'wdBean/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import HuaweiAuth from '../../utils/HuaweiAuth'
import { BusinessError } from '@kit.BasicServicesKit'
import { ToastUtils } from 'wdKit/Index'
import { Logger, ToastUtils, CustomToast, EmitterUtils, EmitterEventId } from 'wdKit/Index'
import { LoginViewModel } from './LoginViewModel'
import {InterestsHobbiesModel} from '../../../../../../../products/phone/src/main/ets/pages/viewModel/InterestsHobbiesModel'
const TAG = "OneKeyLoginPage"
@Entry
@Component
struct OneKeyLoginPage {
anonymousPhone: string = ''
@State agreeProtocol: boolean = false
viewModel: LoginViewModel = new LoginViewModel()
@State toastText:string = ""
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
msg: this.toastText,
}),
autoCancel: false,
alignment: DialogAlignment.Center,
offset: { dx: 0, dy: -20 },
gridCount: 1,
customStyle: true,
maskColor:"#00000000"
})
aboutToAppear(): void {
this.anonymousPhone = HuaweiAuth.sharedInstance().anonymousPhone||""
... ... @@ -44,17 +61,7 @@ struct OneKeyLoginPage {
if (!this.agreeProtocol) {
return
}
HuaweiAuth.sharedInstance().oneKeyLogin().then((authorizeCode) => {
//TODO: 调用服务端接口登录
ToastUtils.shortToast("获取到授权code: " + authorizeCode + ",由于需要后台接口支持,暂时先跳转其他登录方式")
setTimeout(() => {
router.replaceUrl({url: WDRouterPage.loginPage.url()})
}, 3000)
}).catch((error: BusinessError) => {
})
this.requestLogin()
})
}
.padding({ left: 25, right: 25 })
... ... @@ -113,4 +120,47 @@ struct OneKeyLoginPage {
}.margin({ top: 15, right: 15 })
.width("100%")
}
async requestLogin() {
try {
let authorizeCode = await HuaweiAuth.sharedInstance().oneKeyLogin()
let data = await this.viewModel.huaweiOneKeyLogin(authorizeCode)
Logger.debug(TAG, "requestLogin: " + data.jwtToken)
this.showToastTip('登录成功')
///同步兴趣tag
let interestsModel = new InterestsHobbiesModel()
interestsModel.updateInterests()
this.queryUserDetail()
EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION)
} catch (error) {
if (typeof error == "string") {
this.showToastTip(error)
} else {
(error as BusinessError)
this.showToastTip("登录失败")
}
}
}
showToastTip(msg:string){
this.toastText = msg
this.dialogToast.open()
}
queryUserDetail(){
this.viewModel.queryUserDetail().then(()=>{
router.back({
url: `${WDRouterPage.getBundleInfo()}`
}
)
}).catch(()=>{
router.back({
url: `${WDRouterPage.getBundleInfo()}`
})
})
}
}
\ No newline at end of file
... ...
import { AppUtils, DeviceUtil, Logger, UserDataLocal } from 'wdKit/Index';
import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index';
export class ReportDeviceInfo {
static reportDeviceInfo() {
const userId = UserDataLocal.getUserId() || ""
const url = HttpUrlUtils.reportDeviceInfo()
let bean: Record<string, string | number> = {};
bean['deviceId'] = DeviceUtil.clientId()
bean['appVersion'] = AppUtils.getAppVersionCode()
bean['platform'] = 3 /// 1Android 2iOS
bean['userId'] = userId
bean['brand'] = DeviceUtil.getMarketName()
bean['modelSystemVersion'] = DeviceUtil.getDisplayVersion()
bean['tenancy'] = 3 ///1-视界 2-英文版 3-中文版
return new Promise<ReportDeviceInfoRes>((success, fail) => {
HttpBizUtil.post<ResponseDTO<ReportDeviceInfoRes>>(url,bean).then((data: ResponseDTO<ReportDeviceInfoRes>) => {
if (!data) {
fail("数据为空")
return
}
if (data.code != 0) {
fail(data.message)
return
}
success(data.data!)
}, (error: Error) => {
fail(error.message)
Logger.debug("ReportDeviceInfo", error.toString())
})
})
}
}
export class ReportDeviceInfoRes {
clean : number = 0
touristNickName : string = ""
}
\ No newline at end of file
... ...
... ... @@ -94,10 +94,9 @@ export struct WDPlayerRenderView {
.renderFit(RenderFit.RESIZE_COVER)
}
// .onAreaChange(() => {
// this.updateLayout()
// })
.onAreaChange(() => {
this.updateLayout()
})
.backgroundColor("#000000")
// .height('100%')
... ...
... ... @@ -16,12 +16,15 @@ struct ImageAndTextDetailPage {
}
}
pageTransition(){
// 定义页面进入时的效果,从右边侧滑入
PageTransitionEnter({ type: RouteType.None, duration: 300 })
pageTransition() {
// 为目标页面时,进入:从右边侧滑入,退出:是右侧划出;跳转别的页面:左侧划出,返回:左侧划入。
PageTransitionEnter({ type: RouteType.Push, duration: 300 })
.slide(SlideEffect.Right)
// 定义页面退出时的效果,向右边侧滑出
PageTransitionExit({ type: RouteType.None, duration: 300 })
PageTransitionEnter({ type: RouteType.Pop, duration: 300 })
.slide(SlideEffect.Left)
PageTransitionExit({ type: RouteType.Push, duration: 300 })
.slide(SlideEffect.Left)
PageTransitionExit({ type: RouteType.Pop, duration: 300 })
.slide(SlideEffect.Right)
}
... ...
... ... @@ -8,6 +8,7 @@ import router from '@ohos.router';
import { promptAction } from '@kit.ArkUI';
import { UpgradeTipDialog } from "./upgradePage/UpgradeTipDialog"
import { ProcessUtils } from 'wdRouter/Index';
import { StartupManager } from '../startupmanager/StartupManager';
const TAG = 'MainPage';
... ... @@ -27,6 +28,8 @@ struct MainPage {
aboutToAppear() {
StartupManager.sharedInstance().appReachMainPage()
this.breakpointSystem.register()
let context = getContext(this) as common.UIAbilityContext
... ...
... ... @@ -18,11 +18,14 @@ struct SpacialTopicPage {
}
pageTransition() {
// 定义页面进入时的效果,从右边侧滑入
PageTransitionEnter({ type: RouteType.None, duration: 300 })
// 为目标页面时,进入:从右边侧滑入,退出:是右侧划出;跳转别的页面:左侧划出,返回:左侧划入。
PageTransitionEnter({ type: RouteType.Push, duration: 300 })
.slide(SlideEffect.Right)
// 定义页面退出时的效果,向右边侧滑出
PageTransitionExit({ type: RouteType.None, duration: 300 })
PageTransitionEnter({ type: RouteType.Pop, duration: 300 })
.slide(SlideEffect.Left)
PageTransitionExit({ type: RouteType.Push, duration: 300 })
.slide(SlideEffect.Left)
PageTransitionExit({ type: RouteType.Pop, duration: 300 })
.slide(SlideEffect.Right)
}
... ...
... ... @@ -90,6 +90,9 @@ export class StartupManager {
appReachMainPage() : Promise<void> {
return new Promise((resolve) => {
Logger.debug(TAG, "App 进入首页,开始其他任务初始化")
LoginModule.reportDeviceInfo()
//TODO:
resolve()
... ...
import { insightIntent, InsightIntentExecutor } from '@kit.AbilityKit';
import { window } from '@kit.ArkUI';
import { BusinessError } from '@kit.BasicServicesKit';
/**
* 意图调用
*/
export default class InsightIntentExecutorImpl extends InsightIntentExecutor {
private static readonly ViewColumn = 'ViewColumn';
/**
* override 执行前台UIAbility意图
*
* @param name 意图名称
* @param param 意图参数
* @param pageLoader 窗口
* @returns 意图调用结果
*/
onExecuteInUIAbilityForegroundMode(name: string, param: Record<string, Object>, pageLoader: window.WindowStage):
Promise<insightIntent.ExecuteResult> {
// 根据意图名称分发处理逻辑
switch (name) {
case InsightIntentExecutorImpl.ViewColumn:
return this.jumpToView(param, pageLoader);
default:
break;
}
return Promise.resolve({
code: -1,
result: {
message: 'unknown intent'
}
} as insightIntent.ExecuteResult)
}
/**
* 实现跳转新闻页面功能
*
* @param param 意图参数
* @param pageLoader 窗口
*/
private jumpToView(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> {
return new Promise((resolve, reject) => {
// TODO 实现意图调用,loadContent的入参为歌曲落地页路径,例如:pages/SongPage
pageLoader.loadContent('pages/MainPage')
.then(() => {
let entityId: string = (param.items as Array<object>)?.[0]?.['entityId'];
// TODO 调用成功的情况,此处可以打印日志
resolve({
code: 0,
result: {
message: 'Intent execute success'
}
});
})
.catch((err: BusinessError) => {
// TODO 调用失败的情况
resolve({
code: -1,
result: {
message: 'Intent execute failed'
}
})
});
})
}
}
\ No newline at end of file
... ...
{
"insightIntents": [
{
"intentName": "ViewColumn",
"domain": "",
"intentVersion": "1.0.1",
"srcEntry": "./ets/utils/InsightIntentExecutorImpl.ets",
"uiAbility": {
"ability": "EntryAbility",
"executeMode": [
"background",
"foreground"
]
}
}
]
}
\ No newline at end of file
... ...