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
890 additions
and
153 deletions
| @@ -742,4 +742,8 @@ export class HttpUrlUtils { | @@ -742,4 +742,8 @@ export class HttpUrlUtils { | ||
| 742 | return url | 742 | return url |
| 743 | } | 743 | } |
| 744 | 744 | ||
| 745 | + static reportDeviceInfo() { | ||
| 746 | + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/common/user/c/device/push"; | ||
| 747 | + return url; | ||
| 748 | + } | ||
| 745 | } | 749 | } |
| @@ -136,4 +136,9 @@ export class WDRouterPage { | @@ -136,4 +136,9 @@ export class WDRouterPage { | ||
| 136 | 136 | ||
| 137 | //意见反馈 | 137 | //意见反馈 |
| 138 | static feedBackActivity = new WDRouterPage("wdComponent", "ets/components/FeedBackActivity"); | 138 | static feedBackActivity = new WDRouterPage("wdComponent", "ets/components/FeedBackActivity"); |
| 139 | + | ||
| 140 | + // 人民号主页头像显示 | ||
| 141 | + static showHomePageHeaderPage = new WDRouterPage("wdComponent", "ets/pages/ShowHomePageHeaderPage"); | ||
| 142 | + | ||
| 143 | + | ||
| 139 | } | 144 | } |
| @@ -55,7 +55,7 @@ export struct WdWebLocalComponent { | @@ -55,7 +55,7 @@ export struct WdWebLocalComponent { | ||
| 55 | .mixedMode(MixedMode.All) | 55 | .mixedMode(MixedMode.All) |
| 56 | .onlineImageAccess(true) | 56 | .onlineImageAccess(true) |
| 57 | .enableNativeEmbedMode(true) | 57 | .enableNativeEmbedMode(true) |
| 58 | - .layoutMode(WebLayoutMode.FIT_CONTENT) | 58 | + // .layoutMode(WebLayoutMode.FIT_CONTENT) |
| 59 | // .nestedScroll({ scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.PARENT_FIRST }) | 59 | // .nestedScroll({ scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.PARENT_FIRST }) |
| 60 | .height(this.webHeight) | 60 | .height(this.webHeight) |
| 61 | .onPageBegin((event) => { | 61 | .onPageBegin((event) => { |
| @@ -69,6 +69,7 @@ export struct DynamicDetailComponent { | @@ -69,6 +69,7 @@ export struct DynamicDetailComponent { | ||
| 69 | @State isNetConnected: boolean = true | 69 | @State isNetConnected: boolean = true |
| 70 | @State isPageEnd: boolean = false | 70 | @State isPageEnd: boolean = false |
| 71 | @State publishCommentModel: publishCommentModel = new publishCommentModel() | 71 | @State publishCommentModel: publishCommentModel = new publishCommentModel() |
| 72 | + @State reachEndIncreament: number = 0 | ||
| 72 | 73 | ||
| 73 | async aboutToAppear() { | 74 | async aboutToAppear() { |
| 74 | await this.getContentDetailData() | 75 | await this.getContentDetailData() |
| @@ -148,7 +148,7 @@ export struct ENewspaperPageComponent { | @@ -148,7 +148,7 @@ export struct ENewspaperPageComponent { | ||
| 148 | this.calendarDialogController.close() | 148 | this.calendarDialogController.close() |
| 149 | } | 149 | } |
| 150 | }) | 150 | }) |
| 151 | - | 151 | + if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { |
| 152 | Image($r('app.media.icon_share')) | 152 | Image($r('app.media.icon_share')) |
| 153 | .height($r('app.float.top_arrow_size')) | 153 | .height($r('app.float.top_arrow_size')) |
| 154 | .width($r('app.float.top_arrow_size')) | 154 | .width($r('app.float.top_arrow_size')) |
| @@ -161,6 +161,7 @@ export struct ENewspaperPageComponent { | @@ -161,6 +161,7 @@ export struct ENewspaperPageComponent { | ||
| 161 | ToastUtils.showToast('分享为公共方法,待开发', 1000); | 161 | ToastUtils.showToast('分享为公共方法,待开发', 1000); |
| 162 | }) | 162 | }) |
| 163 | } | 163 | } |
| 164 | + } | ||
| 164 | .margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) | 165 | .margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) |
| 165 | .height($r('app.float.top_bar_height')) | 166 | .height($r('app.float.top_bar_height')) |
| 166 | .alignRules({ | 167 | .alignRules({ |
| @@ -311,6 +312,7 @@ export struct ENewspaperPageComponent { | @@ -311,6 +312,7 @@ export struct ENewspaperPageComponent { | ||
| 311 | .width('100%') | 312 | .width('100%') |
| 312 | .height('100%') | 313 | .height('100%') |
| 313 | .backgroundColor($r('app.color.color_80000000')) | 314 | .backgroundColor($r('app.color.color_80000000')) |
| 315 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 314 | .id('e_newspaper_container') | 316 | .id('e_newspaper_container') |
| 315 | 317 | ||
| 316 | if (this.isOpenListDialog) { | 318 | if (this.isOpenListDialog) { |
| @@ -52,6 +52,7 @@ export struct ImageAndTextPageComponent { | @@ -52,6 +52,7 @@ export struct ImageAndTextPageComponent { | ||
| 52 | @State isNetConnected: boolean = true | 52 | @State isNetConnected: boolean = true |
| 53 | @State info: Area | null = null | 53 | @State info: Area | null = null |
| 54 | @State likeNum: number = 0 | 54 | @State likeNum: number = 0 |
| 55 | + @State reachEndIncreament : number = 0 | ||
| 55 | 56 | ||
| 56 | build() { | 57 | build() { |
| 57 | Column() { | 58 | Column() { |
| @@ -141,7 +142,12 @@ export struct ImageAndTextPageComponent { | @@ -141,7 +142,12 @@ export struct ImageAndTextPageComponent { | ||
| 141 | if (this.contentDetailData?.openComment) { | 142 | if (this.contentDetailData?.openComment) { |
| 142 | Divider().strokeWidth(6).color('#f5f5f5') | 143 | Divider().strokeWidth(6).color('#f5f5f5') |
| 143 | CommentComponent({ | 144 | CommentComponent({ |
| 144 | - publishCommentModel: this.publishCommentModel | 145 | + publishCommentModel: this.publishCommentModel, |
| 146 | + fixedHeightMode: false, | ||
| 147 | + reachEndIncreament: this.reachEndIncreament, | ||
| 148 | + reachEndLoadMoreFinish: () => { | ||
| 149 | + | ||
| 150 | + } | ||
| 145 | }).onAreaChange((oldValue: Area, newValue: Area) => { | 151 | }).onAreaChange((oldValue: Area, newValue: Area) => { |
| 146 | this.info = newValue | 152 | this.info = newValue |
| 147 | }) | 153 | }) |
| @@ -157,6 +163,9 @@ export struct ImageAndTextPageComponent { | @@ -157,6 +163,9 @@ export struct ImageAndTextPageComponent { | ||
| 157 | .padding({ bottom: 76 }) | 163 | .padding({ bottom: 76 }) |
| 158 | .scrollBar(BarState.Off) | 164 | .scrollBar(BarState.Off) |
| 159 | .align(Alignment.Top) | 165 | .align(Alignment.Top) |
| 166 | + .onReachEnd(() => { | ||
| 167 | + this.reachEndIncreament += 1 | ||
| 168 | + }) | ||
| 160 | 169 | ||
| 161 | if (!this.isNetConnected) { | 170 | if (!this.isNetConnected) { |
| 162 | EmptyComponent({ | 171 | EmptyComponent({ |
| @@ -228,6 +237,7 @@ export struct ImageAndTextPageComponent { | @@ -228,6 +237,7 @@ export struct ImageAndTextPageComponent { | ||
| 228 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | 237 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) |
| 229 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | 238 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) |
| 230 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | 239 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) |
| 240 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | ||
| 231 | } | 241 | } |
| 232 | if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length && | 242 | if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length && |
| 233 | this.contentDetailData?.audioList[0].audioUrl) { | 243 | this.contentDetailData?.audioList[0].audioUrl) { |
| @@ -61,6 +61,8 @@ export struct MorningEveningPaperComponent { | @@ -61,6 +61,8 @@ export struct MorningEveningPaperComponent { | ||
| 61 | @State mixedBgColor: string = '' | 61 | @State mixedBgColor: string = '' |
| 62 | // 顶部安全高度赋值 | 62 | // 顶部安全高度赋值 |
| 63 | @State topSafeHeight: number = 0; | 63 | @State topSafeHeight: number = 0; |
| 64 | + @State bottomSafeHeight: number = 0; | ||
| 65 | + | ||
| 64 | private audioDataList: AudioDataList[] = [] | 66 | private audioDataList: AudioDataList[] = [] |
| 65 | private playerController: WDPlayerController = new WDPlayerController(); | 67 | private playerController: WDPlayerController = new WDPlayerController(); |
| 66 | simpleAudioDialog: CustomDialogController = new CustomDialogController({ | 68 | simpleAudioDialog: CustomDialogController = new CustomDialogController({ |
| @@ -112,6 +114,7 @@ export struct MorningEveningPaperComponent { | @@ -112,6 +114,7 @@ export struct MorningEveningPaperComponent { | ||
| 112 | // await windowHight.setWindowLayoutFullScreen(true); | 114 | // await windowHight.setWindowLayoutFullScreen(true); |
| 113 | // WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) | 115 | // WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) |
| 114 | this.topSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height) | 116 | this.topSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height) |
| 117 | + this.bottomSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).bottomRect.height) | ||
| 115 | 118 | ||
| 116 | const dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String | 119 | const dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String |
| 117 | console.info(TAG, `aboutToAppear = ` + dailyPaperTopicPageId) | 120 | console.info(TAG, `aboutToAppear = ` + dailyPaperTopicPageId) |
| @@ -248,14 +251,15 @@ export struct MorningEveningPaperComponent { | @@ -248,14 +251,15 @@ export struct MorningEveningPaperComponent { | ||
| 248 | }) | 251 | }) |
| 249 | } | 252 | } |
| 250 | } | 253 | } |
| 251 | - .height('100%') | 254 | + .height(`calc(100% - ${this.bottomSafeHeight + this.topSafeHeight + 'vp'})`) |
| 252 | 255 | ||
| 253 | PaperTitleComponent() | 256 | PaperTitleComponent() |
| 254 | } | 257 | } |
| 255 | .width('100%') | 258 | .width('100%') |
| 256 | .height('100%') | 259 | .height('100%') |
| 257 | .padding({ | 260 | .padding({ |
| 258 | - top: this.topSafeHeight | 261 | + top: this.topSafeHeight, |
| 262 | + bottom: this.bottomSafeHeight | ||
| 259 | }) | 263 | }) |
| 260 | // .backgroundColor(Color.Black) | 264 | // .backgroundColor(Color.Black) |
| 261 | // .backgroundColor(this.pageInfoBean?.backgroundColor ?? Color.Black) | 265 | // .backgroundColor(this.pageInfoBean?.backgroundColor ?? Color.Black) |
| @@ -449,6 +449,7 @@ export struct MultiPictureDetailPageComponent { | @@ -449,6 +449,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 449 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | 449 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) |
| 450 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | 450 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) |
| 451 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | 451 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) |
| 452 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | ||
| 452 | } | 453 | } |
| 453 | // this.contentDetailData.photoList = [] | 454 | // this.contentDetailData.photoList = [] |
| 454 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { | 455 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { |
| @@ -72,6 +72,7 @@ export struct SpacialTopicPageComponent { | @@ -72,6 +72,7 @@ export struct SpacialTopicPageComponent { | ||
| 72 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | 72 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) |
| 73 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | 73 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) |
| 74 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | 74 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) |
| 75 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | ||
| 75 | // } | 76 | // } |
| 76 | this.trySendData2H5() | 77 | this.trySendData2H5() |
| 77 | } | 78 | } |
| @@ -20,6 +20,8 @@ export class publishCommentModel { | @@ -20,6 +20,8 @@ export class publishCommentModel { | ||
| 20 | targetType: string = '' | 20 | targetType: string = '' |
| 21 | /*评论总数*/ | 21 | /*评论总数*/ |
| 22 | totalCommentNumer: string = '0' | 22 | totalCommentNumer: string = '0' |
| 23 | + /// 游客评论开关:visitorComment 1:打开;0:关闭 | ||
| 24 | + visitorComment: string = "0" | ||
| 23 | 25 | ||
| 24 | //评论传参 | 26 | //评论传参 |
| 25 | /*评论图片url,多个逗号隔开*/ | 27 | /*评论图片url,多个逗号隔开*/ |
| @@ -8,9 +8,11 @@ import { HttpUtils } from 'wdNetwork/Index'; | @@ -8,9 +8,11 @@ import { HttpUtils } from 'wdNetwork/Index'; | ||
| 8 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 8 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 9 | import NoMoreLayout from '../../page/NoMoreLayout'; | 9 | import NoMoreLayout from '../../page/NoMoreLayout'; |
| 10 | import { EmptyComponent } from '../../view/EmptyComponent'; | 10 | import { EmptyComponent } from '../../view/EmptyComponent'; |
| 11 | +import { ContentDetailDTO, Params } from 'wdBean/Index'; | ||
| 11 | 12 | ||
| 12 | const TAG = 'CommentComponent'; | 13 | const TAG = 'CommentComponent'; |
| 13 | 14 | ||
| 15 | + | ||
| 14 | const testString = '因为读书的人\n是低着头向上看的人\n身处一隅,却能放眼世界\n2,因为读书的人\n总是比不读书的人\n活得有趣一点\n3,因为读书的人\n即使平凡,绝不平庸' | 16 | const testString = '因为读书的人\n是低着头向上看的人\n身处一隅,却能放眼世界\n2,因为读书的人\n总是比不读书的人\n活得有趣一点\n3,因为读书的人\n即使平凡,绝不平庸' |
| 15 | 17 | ||
| 16 | // @Entry | 18 | // @Entry |
| @@ -22,14 +24,20 @@ export struct CommentComponent { | @@ -22,14 +24,20 @@ export struct CommentComponent { | ||
| 22 | @State isComments: boolean = true | 24 | @State isComments: boolean = true |
| 23 | /*必传*/ | 25 | /*必传*/ |
| 24 | @ObjectLink publishCommentModel: publishCommentModel | 26 | @ObjectLink publishCommentModel: publishCommentModel |
| 27 | + @Consume contentDetailData: ContentDetailDTO | ||
| 25 | listScroller: ListScroller = new ListScroller(); // scroller控制器 | 28 | listScroller: ListScroller = new ListScroller(); // scroller控制器 |
| 26 | historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset | 29 | historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset |
| 27 | - isloading: boolean = false | ||
| 28 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); | 30 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); |
| 29 | @State dialogController: CustomDialogController | null = null; | 31 | @State dialogController: CustomDialogController | null = null; |
| 30 | 32 | ||
| 31 | // @State private browSingModel: commentListModel = new commentListModel() | 33 | // @State private browSingModel: commentListModel = new commentListModel() |
| 32 | 34 | ||
| 35 | + // 是否为固定高度模式。true时,里面上拉加载更多生效,外层不能包Scroll。 | ||
| 36 | + // false时,外层实现加载更多,并通过reachEndIncreament通知开发加载更多,reachEndLoadMoreFinish 通知上层加载更多完成 | ||
| 37 | + fixedHeightMode: boolean = false | ||
| 38 | + @Prop @Watch("parentOnReachEnd") reachEndIncreament : number = 0 | ||
| 39 | + reachEndLoadMoreFinish?: () => void | ||
| 40 | + | ||
| 33 | // 在自定义组件即将析构销毁时将dialogControlle置空 | 41 | // 在自定义组件即将析构销毁时将dialogControlle置空 |
| 34 | aboutToDisappear() { | 42 | aboutToDisappear() { |
| 35 | this.dialogController = null // 将dialogController置空 | 43 | this.dialogController = null // 将dialogController置空 |
| @@ -183,28 +191,49 @@ export struct CommentComponent { | @@ -183,28 +191,49 @@ export struct CommentComponent { | ||
| 183 | 191 | ||
| 184 | // 加载更多 | 192 | // 加载更多 |
| 185 | ListItem() { | 193 | ListItem() { |
| 186 | - if (this.hasMore === false) { | 194 | + if (this.hasMore == false) { |
| 187 | NoMoreLayout() | 195 | NoMoreLayout() |
| 188 | } | 196 | } |
| 189 | } | 197 | } |
| 190 | } | 198 | } |
| 191 | - | ||
| 192 | } | 199 | } |
| 200 | + .margin({bottom: 10}) | ||
| 193 | .onReachEnd(() => { | 201 | .onReachEnd(() => { |
| 202 | + if (!this.fixedHeightMode) { | ||
| 203 | + return | ||
| 204 | + } | ||
| 194 | if (this.hasMore) { | 205 | if (this.hasMore) { |
| 195 | this.getData() | 206 | this.getData() |
| 196 | } | 207 | } |
| 197 | }) | 208 | }) |
| 198 | - .enableScrollInteraction(false) | 209 | + .enableScrollInteraction(this.fixedHeightMode ? true: false) |
| 210 | + // .nestedScroll({ | ||
| 211 | + // scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 212 | + // scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 213 | + // }) | ||
| 199 | } | 214 | } |
| 200 | 215 | ||
| 201 | } | 216 | } |
| 202 | 217 | ||
| 218 | + parentOnReachEnd() { | ||
| 219 | + if (this.fixedHeightMode) { | ||
| 220 | + return | ||
| 221 | + } | ||
| 222 | + if (this.hasMore) { | ||
| 223 | + this.getData() | ||
| 224 | + } else { | ||
| 225 | + if (this.reachEndLoadMoreFinish) { | ||
| 226 | + this.reachEndLoadMoreFinish() | ||
| 227 | + } | ||
| 228 | + } | ||
| 229 | + } | ||
| 230 | + | ||
| 203 | //获取数据 | 231 | //获取数据 |
| 204 | async getData() { | 232 | async getData() { |
| 205 | commentViewModel.fetchContentCommentList(this.currentPage + '', this.publishCommentModel.targetId, | 233 | commentViewModel.fetchContentCommentList(this.currentPage + '', this.publishCommentModel.targetId, |
| 206 | this.publishCommentModel.targetType) | 234 | this.publishCommentModel.targetType) |
| 207 | .then(commentListModel => { | 235 | .then(commentListModel => { |
| 236 | + console.log('评论:', JSON.stringify(commentListModel.list)) | ||
| 208 | this.currentPage++ | 237 | this.currentPage++ |
| 209 | 238 | ||
| 210 | if (Number.parseInt(commentListModel.totalCommentNum) > | 239 | if (Number.parseInt(commentListModel.totalCommentNum) > |
| @@ -237,6 +266,9 @@ export struct CommentComponent { | @@ -237,6 +266,9 @@ export struct CommentComponent { | ||
| 237 | } else { | 266 | } else { |
| 238 | this.hasMore = false | 267 | this.hasMore = false |
| 239 | } | 268 | } |
| 269 | + if (!this.fixedHeightMode && this.reachEndLoadMoreFinish) { | ||
| 270 | + this.reachEndLoadMoreFinish() | ||
| 271 | + } | ||
| 240 | }) | 272 | }) |
| 241 | } | 273 | } |
| 242 | } | 274 | } |
| @@ -247,6 +279,7 @@ struct ChildCommentItem { | @@ -247,6 +279,7 @@ struct ChildCommentItem { | ||
| 247 | @Link publishCommentModel: publishCommentModel | 279 | @Link publishCommentModel: publishCommentModel |
| 248 | @Link dialogController: CustomDialogController | null | 280 | @Link dialogController: CustomDialogController | null |
| 249 | @ObjectLink item: commentItemModel | 281 | @ObjectLink item: commentItemModel |
| 282 | + @Consume contentDetailData: ContentDetailDTO | ||
| 250 | 283 | ||
| 251 | build() { | 284 | build() { |
| 252 | Column() { | 285 | Column() { |
| @@ -271,6 +304,14 @@ struct ChildCommentItem { | @@ -271,6 +304,14 @@ struct ChildCommentItem { | ||
| 271 | .alignContent(Alignment.Center) | 304 | .alignContent(Alignment.Center) |
| 272 | .onClick(() => { | 305 | .onClick(() => { |
| 273 | // TODO 跳转个人详情 | 306 | // TODO 跳转个人详情 |
| 307 | + // 跳转到号主页 | ||
| 308 | + if (this.contentDetailData.rmhInfo?.cnMainControl === 1) { | ||
| 309 | + const params: Params = { | ||
| 310 | + creatorId: this.contentDetailData.rmhInfo.rmhId, | ||
| 311 | + pageID: '' | ||
| 312 | + } | ||
| 313 | + WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) | ||
| 314 | + } | ||
| 274 | }) | 315 | }) |
| 275 | 316 | ||
| 276 | //昵称 | 317 | //昵称 |
| @@ -455,7 +496,7 @@ struct commentHeaderView { | @@ -455,7 +496,7 @@ struct commentHeaderView { | ||
| 455 | .margin({ left: 8 }) | 496 | .margin({ left: 8 }) |
| 456 | .alignContent(Alignment.Center) | 497 | .alignContent(Alignment.Center) |
| 457 | .onClick(() => { | 498 | .onClick(() => { |
| 458 | - // TODO 跳转个人详情 | 499 | + commentViewModel.jumpToAccountPage(this.item) |
| 459 | }) | 500 | }) |
| 460 | 501 | ||
| 461 | //昵称 | 502 | //昵称 |
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentListDialog.ets
0 → 100644
| 1 | +import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index' | ||
| 2 | +import { publishCommentModel } from '../model/PublishCommentModel' | ||
| 3 | + | ||
| 4 | +@CustomDialog | ||
| 5 | +export struct CommentListDialog { | ||
| 6 | + | ||
| 7 | + /// 内部使用 | ||
| 8 | + private publishCommentModel: publishCommentModel = new publishCommentModel() | ||
| 9 | + controller?: CustomDialogController | ||
| 10 | + | ||
| 11 | + /// 外部初始化 | ||
| 12 | + contentDetail?: ContentDetailDTO | ||
| 13 | + pageInfo?: PageInfoDTO | ||
| 14 | + | ||
| 15 | + build() { | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + | ||
| 19 | +} |
| @@ -11,11 +11,12 @@ export struct CommentTabComponent { | @@ -11,11 +11,12 @@ export struct CommentTabComponent { | ||
| 11 | } | 11 | } |
| 12 | @ObjectLink publishCommentModel: publishCommentModel | 12 | @ObjectLink publishCommentModel: publishCommentModel |
| 13 | @Prop contentDetail: ContentDetailDTO | 13 | @Prop contentDetail: ContentDetailDTO |
| 14 | + @Prop pageComponentType: number = -1 //1:视频详情页 | ||
| 14 | /*展示类型*/ | 15 | /*展示类型*/ |
| 15 | @State type: number = 1 | 16 | @State type: number = 1 |
| 16 | @State placeHolder: string = '说两句...' | 17 | @State placeHolder: string = '说两句...' |
| 17 | @State dialogController: CustomDialogController | null = null; | 18 | @State dialogController: CustomDialogController | null = null; |
| 18 | - styleType : number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) | 19 | + styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) |
| 19 | /*回调方法*/ | 20 | /*回调方法*/ |
| 20 | dialogControllerConfirm: () => void = () => { | 21 | dialogControllerConfirm: () => void = () => { |
| 21 | } | 22 | } |
| @@ -46,9 +47,36 @@ export struct CommentTabComponent { | @@ -46,9 +47,36 @@ export struct CommentTabComponent { | ||
| 46 | Row() { | 47 | Row() { |
| 47 | Stack({ alignContent: Alignment.Start }) { | 48 | Stack({ alignContent: Alignment.Start }) { |
| 48 | RelativeContainer() { | 49 | RelativeContainer() { |
| 50 | + | ||
| 51 | + if (this.pageComponentType === 1) { | ||
| 52 | + Row() { | ||
| 53 | + | ||
| 54 | + } | ||
| 55 | + .width('100%') | ||
| 56 | + .height(30) | ||
| 57 | + .borderRadius(2) | ||
| 58 | + .backgroundColor(this.pageComponentType === 1 ? '#1a1a1a' : Color.Transparent) | ||
| 59 | + .margin({ | ||
| 60 | + right: 16, | ||
| 61 | + }) | ||
| 62 | + .alignRules({ | ||
| 63 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 64 | + left: { anchor: "__container__", align: HorizontalAlign.Start }, | ||
| 65 | + right: { anchor: "__container__", align: HorizontalAlign.End }, | ||
| 66 | + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | ||
| 67 | + }) | ||
| 68 | + .id("RowBg") | ||
| 69 | + } else { | ||
| 49 | Image($r('app.media.comment_img_input_hui')) | 70 | Image($r('app.media.comment_img_input_hui')) |
| 50 | .objectFit(ImageFit.Fill) | 71 | .objectFit(ImageFit.Fill) |
| 51 | - .resizable({ slice: { top: 1, left: 1, right: 20, bottom: 1 } }) | 72 | + .resizable({ |
| 73 | + slice: { | ||
| 74 | + top: 1, | ||
| 75 | + left: 1, | ||
| 76 | + right: 20, | ||
| 77 | + bottom: 1 | ||
| 78 | + } | ||
| 79 | + }) | ||
| 52 | .alignRules({ | 80 | .alignRules({ |
| 53 | top: { anchor: "__container__", align: VerticalAlign.Top }, | 81 | top: { anchor: "__container__", align: VerticalAlign.Top }, |
| 54 | left: { anchor: "__container__", align: HorizontalAlign.Start }, | 82 | left: { anchor: "__container__", align: HorizontalAlign.Start }, |
| @@ -56,6 +84,7 @@ export struct CommentTabComponent { | @@ -56,6 +84,7 @@ export struct CommentTabComponent { | ||
| 56 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | 84 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, |
| 57 | }) | 85 | }) |
| 58 | .id("Image") | 86 | .id("Image") |
| 87 | + } | ||
| 59 | Text(this.placeHolder) | 88 | Text(this.placeHolder) |
| 60 | .fontSize(12) | 89 | .fontSize(12) |
| 61 | .fontColor('#999999') | 90 | .fontColor('#999999') |
| @@ -91,7 +120,7 @@ export struct CommentIconComponent { | @@ -91,7 +120,7 @@ export struct CommentIconComponent { | ||
| 91 | @ObjectLink publishCommentModel: publishCommentModel | 120 | @ObjectLink publishCommentModel: publishCommentModel |
| 92 | /*展示类型*/ | 121 | /*展示类型*/ |
| 93 | @State type: number = 1 | 122 | @State type: number = 1 |
| 94 | - styleType : number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) | 123 | + styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) |
| 95 | // aboutToAppear(): void { | 124 | // aboutToAppear(): void { |
| 96 | // setTimeout(() => { | 125 | // setTimeout(() => { |
| 97 | // this.publishCommentModel.totalCommentNumer = '444' | 126 | // this.publishCommentModel.totalCommentNumer = '444' |
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/QualityCommentsComponent.ets
| @@ -412,33 +412,7 @@ struct QualityCommentItem { | @@ -412,33 +412,7 @@ struct QualityCommentItem { | ||
| 412 | 412 | ||
| 413 | jumpToAccountOwner() { | 413 | jumpToAccountOwner() { |
| 414 | 414 | ||
| 415 | - let url = HttpUrlUtils.getOtherUserDetailDataUrl() | ||
| 416 | - let item : Record<string, string >= { | ||
| 417 | - "creatorId": this.item.fromCreatorId || "", | ||
| 418 | - "userType": `${this.item.fromUserType}`, | ||
| 419 | - "userId": this.item.fromUserId || "-1", | ||
| 420 | - } | ||
| 421 | - HttpBizUtil.post<ResponseDTO<MasterDetailRes>>(url, item).then((result) => { | ||
| 422 | - if (!result.data || result.data.mainControl != 1) { | ||
| 423 | - ToastUtils.longToast("暂时无法查看该创作者主页") | ||
| 424 | - return | ||
| 425 | - } | ||
| 426 | - | ||
| 427 | - if (result.data.banControl == 1) { | ||
| 428 | - ToastUtils.longToast("该账号已封禁,不予访问") | ||
| 429 | - return | ||
| 430 | - } | ||
| 431 | - | ||
| 432 | - if (result.data.userType === "1") { // 普通用户 | ||
| 433 | - let params: Record<string, string> = {'userId': result.data.userId}; | ||
| 434 | - WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params) | ||
| 435 | - } else { // 非普通用户 | ||
| 436 | - ProcessUtils.gotoPeopleShipHomePage(result.data.creatorId) | ||
| 437 | - } | ||
| 438 | - | ||
| 439 | - }).catch(() => { | ||
| 440 | - ToastUtils.longToast("暂时无法查看该创作者主页") | ||
| 441 | - }) | 415 | + commentViewModel.jumpToAccountPage(this.item) |
| 442 | } | 416 | } |
| 443 | 417 | ||
| 444 | jumpToDetail() { | 418 | jumpToDetail() { |
| 1 | +import { MasterDetailRes } from 'wdBean/Index'; | ||
| 1 | import { SpConstants } from 'wdConstant/Index'; | 2 | import { SpConstants } from 'wdConstant/Index'; |
| 2 | -import { DateTimeUtils, Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit/Index'; | 3 | +import { |
| 4 | + AccountManagerUtils, | ||
| 5 | + DateTimeUtils, DeviceUtil, Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit/Index'; | ||
| 3 | import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index'; | 6 | import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index'; |
| 4 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | 7 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; |
| 8 | +import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 5 | import { | 9 | import { |
| 6 | commentItemModel, | 10 | commentItemModel, |
| 7 | commentListModel, | 11 | commentListModel, |
| @@ -160,7 +164,9 @@ class CommentViewModel { | @@ -160,7 +164,9 @@ class CommentViewModel { | ||
| 160 | publishComment(model: publishCommentModel) { | 164 | publishComment(model: publishCommentModel) { |
| 161 | 165 | ||
| 162 | return new Promise<commentItemModel>((success, fail) => { | 166 | return new Promise<commentItemModel>((success, fail) => { |
| 163 | - let url = HttpUrlUtils.getPublishCommentUrl() | 167 | + const visitorMode = model.visitorComment == "1" && AccountManagerUtils.isLoginSync() == false |
| 168 | + let url = visitorMode ? HttpUrlUtils.getNoUserPublishCommentUrl() : HttpUrlUtils.getPublishCommentUrl() | ||
| 169 | + | ||
| 164 | let bean: Record<string, string> = {}; | 170 | let bean: Record<string, string> = {}; |
| 165 | 171 | ||
| 166 | bean['targetId'] = model.targetId; | 172 | bean['targetId'] = model.targetId; |
| @@ -176,6 +182,11 @@ class CommentViewModel { | @@ -176,6 +182,11 @@ class CommentViewModel { | ||
| 176 | bean['targetType'] = model.targetType | 182 | bean['targetType'] = model.targetType |
| 177 | bean['parentId'] = model.parentId | 183 | bean['parentId'] = model.parentId |
| 178 | 184 | ||
| 185 | + if (visitorMode) { | ||
| 186 | + bean['deviceId'] = DeviceUtil.clientId() | ||
| 187 | + bean['userName'] = SPHelper.default.getSync(SpConstants.TOURIST_NICK_NAME, "") as string | ||
| 188 | + } | ||
| 189 | + | ||
| 179 | HttpRequest.post<ResponseDTO<commentItemModel>>(url, bean).then((data: ResponseDTO<commentItemModel>) => { | 190 | HttpRequest.post<ResponseDTO<commentItemModel>>(url, bean).then((data: ResponseDTO<commentItemModel>) => { |
| 180 | if (data.code != 0) { | 191 | if (data.code != 0) { |
| 181 | ToastUtils.showToast(data.message, 1000); | 192 | ToastUtils.showToast(data.message, 1000); |
| @@ -185,10 +196,9 @@ class CommentViewModel { | @@ -185,10 +196,9 @@ class CommentViewModel { | ||
| 185 | ToastUtils.showToast(data.message, 1000); | 196 | ToastUtils.showToast(data.message, 1000); |
| 186 | let model = data.data as commentItemModel | 197 | let model = data.data as commentItemModel |
| 187 | 198 | ||
| 188 | - let userId = HttpUtils.getUserId() | ||
| 189 | - let FIRSTCOMMENTTIME = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, '') | 199 | + let firstCommentTime = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, '') as string |
| 190 | 200 | ||
| 191 | - if (!userId && !FIRSTCOMMENTTIME) { | 201 | + if (visitorMode && firstCommentTime.length == 0) { |
| 192 | //保存首次评论时间 | 202 | //保存首次评论时间 |
| 193 | SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, DateTimeUtils.formatDate(data.timestamp, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) | 203 | SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, DateTimeUtils.formatDate(data.timestamp, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) |
| 194 | } | 204 | } |
| @@ -472,6 +482,36 @@ class CommentViewModel { | @@ -472,6 +482,36 @@ class CommentViewModel { | ||
| 472 | } | 482 | } |
| 473 | return false | 483 | return false |
| 474 | } | 484 | } |
| 485 | + | ||
| 486 | + jumpToAccountPage(commentItem: commentItemModel) { | ||
| 487 | + let url = HttpUrlUtils.getOtherUserDetailDataUrl() | ||
| 488 | + let item : Record<string, string >= { | ||
| 489 | + "creatorId": commentItem.fromCreatorId || "", | ||
| 490 | + "userType": `${commentItem.fromUserType}`, | ||
| 491 | + "userId": commentItem.fromUserId || "-1", | ||
| 492 | + } | ||
| 493 | + HttpBizUtil.post<ResponseDTO<MasterDetailRes>>(url, item).then((result) => { | ||
| 494 | + if (!result.data || result.data.mainControl != 1) { | ||
| 495 | + ToastUtils.longToast("暂时无法查看该创作者主页") | ||
| 496 | + return | ||
| 497 | + } | ||
| 498 | + | ||
| 499 | + if (result.data.banControl == 1) { | ||
| 500 | + ToastUtils.longToast("该账号已封禁,不予访问") | ||
| 501 | + return | ||
| 502 | + } | ||
| 503 | + | ||
| 504 | + if (result.data.userType === "1") { // 普通用户 | ||
| 505 | + let params: Record<string, string> = {'userId': result.data.userId}; | ||
| 506 | + WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params) | ||
| 507 | + } else { // 非普通用户 | ||
| 508 | + ProcessUtils.gotoPeopleShipHomePage(result.data.creatorId) | ||
| 509 | + } | ||
| 510 | + | ||
| 511 | + }).catch(() => { | ||
| 512 | + ToastUtils.longToast("暂时无法查看该创作者主页") | ||
| 513 | + }) | ||
| 514 | + } | ||
| 475 | } | 515 | } |
| 476 | 516 | ||
| 477 | 517 |
sight_harmony/features/wdComponent/src/main/ets/components/likeAnimation/LikeAnimationView.ets
0 → 100644
| 1 | +/** | ||
| 2 | + * 直播页面点赞动画 | ||
| 3 | + */ | ||
| 4 | + | ||
| 5 | +interface animationItem { | ||
| 6 | + x: string | number; | ||
| 7 | + y: string | number; | ||
| 8 | + opacity: number; | ||
| 9 | + name: string; | ||
| 10 | + key: string; | ||
| 11 | + url: Resource | ||
| 12 | +} | ||
| 13 | + | ||
| 14 | +@Component | ||
| 15 | +export struct LikeAnimationView { | ||
| 16 | + @State @Watch('countChange') count: number = 0 | ||
| 17 | + @State imgList: Resource[] = | ||
| 18 | + [$r('app.media.like_animation_1'), $r('app.media.like_animation_2'), $r('app.media.like_animation_3')] | ||
| 19 | + @State animationList: animationItem[] = [] | ||
| 20 | + | ||
| 21 | + countChange() { | ||
| 22 | + this.animationList.push({ | ||
| 23 | + name: 'xxxx', | ||
| 24 | + x: 0, | ||
| 25 | + y: 0, | ||
| 26 | + opacity: 1, | ||
| 27 | + key: Math.random() + '', | ||
| 28 | + url: this.getRandomUrl() | ||
| 29 | + | ||
| 30 | + }) | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + getRandomUrl(): Resource { | ||
| 34 | + if (Math.random() >= 0 && Math.random() >= 0.33) { | ||
| 35 | + return this.imgList[0] | ||
| 36 | + } else if (Math.random() >= 0.33 && Math.random() >= 0.66) { | ||
| 37 | + return this.imgList[1] | ||
| 38 | + } else { | ||
| 39 | + return this.imgList[2] | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + startAnimation() { | ||
| 44 | + | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + stopAnimation() { | ||
| 48 | + | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + aboutToAppear(): void { | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + aboutToDisappear(): void { | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + build() { | ||
| 58 | + Stack() { | ||
| 59 | + ForEach(this.animationList, (item: animationItem) => { | ||
| 60 | + Image(item.url) | ||
| 61 | + .width(48) | ||
| 62 | + .height(48) | ||
| 63 | + }, (item: animationItem) => item.key) | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + } | ||
| 67 | +} |
| @@ -21,6 +21,7 @@ const TAG = 'PageComponent'; | @@ -21,6 +21,7 @@ const TAG = 'PageComponent'; | ||
| 21 | export struct PageComponent { | 21 | export struct PageComponent { |
| 22 | @State private pageModel: PageModel = new PageModel(); | 22 | @State private pageModel: PageModel = new PageModel(); |
| 23 | @State private pageAdvModel: PageAdModel = new PageAdModel(); | 23 | @State private pageAdvModel: PageAdModel = new PageAdModel(); |
| 24 | + @State timer: number = -1 | ||
| 24 | navIndex: number = 0; | 25 | navIndex: number = 0; |
| 25 | pageId: string = ""; | 26 | pageId: string = ""; |
| 26 | channelId: string = ""; | 27 | channelId: string = ""; |
| @@ -29,6 +30,7 @@ export struct PageComponent { | @@ -29,6 +30,7 @@ export struct PageComponent { | ||
| 29 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 | 30 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 |
| 30 | private listScroller: Scroller = new Scroller(); | 31 | private listScroller: Scroller = new Scroller(); |
| 31 | needload: boolean = true; | 32 | needload: boolean = true; |
| 33 | + | ||
| 32 | build() { | 34 | build() { |
| 33 | Column() { | 35 | Column() { |
| 34 | if (this.pageModel.viewType == ViewType.LOADING) { | 36 | if (this.pageModel.viewType == ViewType.LOADING) { |
| @@ -222,9 +224,10 @@ export struct PageComponent { | @@ -222,9 +224,10 @@ export struct PageComponent { | ||
| 222 | } | 224 | } |
| 223 | 225 | ||
| 224 | onChange() { | 226 | onChange() { |
| 225 | - Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`); | 227 | + Logger.info(TAG, |
| 228 | + `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`); | ||
| 226 | if (this.navIndex === this.currentTopNavSelectedIndex) { | 229 | if (this.navIndex === this.currentTopNavSelectedIndex) { |
| 227 | - if(this.needload){ | 230 | + if (this.needload) { |
| 228 | this.getData(); | 231 | this.getData(); |
| 229 | } | 232 | } |
| 230 | this.needload = false; | 233 | this.needload = false; |
| @@ -242,6 +245,10 @@ export struct PageComponent { | @@ -242,6 +245,10 @@ export struct PageComponent { | ||
| 242 | } | 245 | } |
| 243 | 246 | ||
| 244 | async getData() { | 247 | async getData() { |
| 248 | + if (this.timer) { | ||
| 249 | + clearTimeout(this.timer) | ||
| 250 | + } | ||
| 251 | + this.timer = setTimeout(() => { | ||
| 245 | Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`); | 252 | Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`); |
| 246 | this.pageModel.pageId = this.pageId; | 253 | this.pageModel.pageId = this.pageId; |
| 247 | this.pageModel.groupId = this.pageId; | 254 | this.pageModel.groupId = this.pageId; |
| @@ -249,6 +256,8 @@ export struct PageComponent { | @@ -249,6 +256,8 @@ export struct PageComponent { | ||
| 249 | this.pageModel.currentPage = 1; | 256 | this.pageModel.currentPage = 1; |
| 250 | this.pageModel.pageTotalCompSize = 0; | 257 | this.pageModel.pageTotalCompSize = 0; |
| 251 | PageHelper.getInitData(this.pageModel, this.pageAdvModel) | 258 | PageHelper.getInitData(this.pageModel, this.pageAdvModel) |
| 259 | + }, 100) | ||
| 260 | + | ||
| 252 | } | 261 | } |
| 253 | } | 262 | } |
| 254 | 263 |
| 1 | +import { insightIntent } from '@kit.IntentsKit'; | ||
| 1 | import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean'; | 2 | import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean'; |
| 2 | import { SpConstants } from 'wdConstant'; | 3 | import { SpConstants } from 'wdConstant'; |
| 3 | import { DisplayUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit'; | 4 | import { DisplayUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit'; |
| @@ -8,6 +9,7 @@ import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent | @@ -8,6 +9,7 @@ import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent | ||
| 8 | import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; | 9 | import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; |
| 9 | import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent'; | 10 | import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent'; |
| 10 | import { channelSkeleton } from '../skeleton/channelSkeleton'; | 11 | import { channelSkeleton } from '../skeleton/channelSkeleton'; |
| 12 | +import { common } from '@kit.AbilityKit'; | ||
| 11 | 13 | ||
| 12 | 14 | ||
| 13 | const TAG = 'TopNavigationComponent'; | 15 | const TAG = 'TopNavigationComponent'; |
| @@ -37,6 +39,7 @@ export struct TopNavigationComponent { | @@ -37,6 +39,7 @@ export struct TopNavigationComponent { | ||
| 37 | // 顶导当前选中/焦点下标 | 39 | // 顶导当前选中/焦点下标 |
| 38 | @State currentTopNavSelectedIndex: number = 0; | 40 | @State currentTopNavSelectedIndex: number = 0; |
| 39 | @State currentTopNavName: string = ''; | 41 | @State currentTopNavName: string = ''; |
| 42 | + @State currentTopNavItem: TopNavDTO = {} as TopNavDTO | ||
| 40 | // 顶导数据 | 43 | // 顶导数据 |
| 41 | @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] | 44 | @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] |
| 42 | @State compList: LazyDataSource<CompDTO> = new LazyDataSource(); | 45 | @State compList: LazyDataSource<CompDTO> = new LazyDataSource(); |
| @@ -58,6 +61,8 @@ export struct TopNavigationComponent { | @@ -58,6 +61,8 @@ export struct TopNavigationComponent { | ||
| 58 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 | 61 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 |
| 59 | // 传递给page的自动刷新通知 | 62 | // 传递给page的自动刷新通知 |
| 60 | @State autoRefresh2Page: number = 0 | 63 | @State autoRefresh2Page: number = 0 |
| 64 | + //保存当前导航选中时的时间戳 意图开始时间 | ||
| 65 | + @State executedStartTime: number = new Date().getTime() | ||
| 61 | // 当前底导index | 66 | // 当前底导index |
| 62 | @State navIndex: number = 0 | 67 | @State navIndex: number = 0 |
| 63 | @State animationDuration: number = 0 | 68 | @State animationDuration: number = 0 |
| @@ -167,6 +172,7 @@ export struct TopNavigationComponent { | @@ -167,6 +172,7 @@ export struct TopNavigationComponent { | ||
| 167 | this.currentTopNavSelectedIndex = index | 172 | this.currentTopNavSelectedIndex = index |
| 168 | this.currentTopNavName = this.myChannelList[index].name | 173 | this.currentTopNavName = this.myChannelList[index].name |
| 169 | } | 174 | } |
| 175 | + this.currentTopNavItem = this.myChannelList[this.currentTopNavSelectedIndex] | ||
| 170 | } | 176 | } |
| 171 | 177 | ||
| 172 | isBroadcast(item: TopNavDTO) { | 178 | isBroadcast(item: TopNavDTO) { |
| @@ -184,6 +190,49 @@ export struct TopNavigationComponent { | @@ -184,6 +190,49 @@ export struct TopNavigationComponent { | ||
| 184 | return item.channelType === 3 | 190 | return item.channelType === 3 |
| 185 | } | 191 | } |
| 186 | 192 | ||
| 193 | + //意图共享 | ||
| 194 | + topNavInsightIntentShare(item: TopNavDTO){ | ||
| 195 | + let tapNavIntent: insightIntent.InsightIntent = { | ||
| 196 | + intentName: 'ViewColumn', | ||
| 197 | + intentVersion: '1.0.1', | ||
| 198 | + identifier: '52dac3b0-6520-4974-81e5-25f0879449b5', | ||
| 199 | + intentActionInfo: { | ||
| 200 | + actionMode: 'EXPECTED', | ||
| 201 | + currentPercentage: 50, | ||
| 202 | + executedTimeSlots: { | ||
| 203 | + executedEndTime: new Date().getTime(), | ||
| 204 | + executedStartTime: this.executedStartTime | ||
| 205 | + } | ||
| 206 | + }, | ||
| 207 | + intentEntityInfo: { | ||
| 208 | + entityName: 'ViewColumn', | ||
| 209 | + entityId: String(item.pageId) || '', | ||
| 210 | + displayName: item.name, | ||
| 211 | + logoURL: 'https://www-file.huawei.com/-/media/corporate/images/home/logo/huawei_logo.png', | ||
| 212 | + rankingHint: 99, | ||
| 213 | + isPublicData: true | ||
| 214 | + } | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + try { | ||
| 218 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 219 | + // 共享数据 | ||
| 220 | + insightIntent.shareIntent(context, [tapNavIntent], (error) => { | ||
| 221 | + if (error?.code) { | ||
| 222 | + // 处理业务逻辑错误 | ||
| 223 | + console.error(`shareIntent failed, error.code: ${error?.code}, error.message: ${error?.message}`); | ||
| 224 | + return; | ||
| 225 | + } | ||
| 226 | + // 执行正常业务 | ||
| 227 | + console.log('shareIntent succeed'); | ||
| 228 | + }); | ||
| 229 | + } catch (error) { | ||
| 230 | + // 处理异常 | ||
| 231 | + console.error(`error.code: ${error?.code}, error.message: ${error?.message}`); | ||
| 232 | + } | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + | ||
| 187 | build() { | 236 | build() { |
| 188 | Column() { | 237 | Column() { |
| 189 | // 顶部搜索、日报logo、早晚报 | 238 | // 顶部搜索、日报logo、早晚报 |
| @@ -278,7 +327,11 @@ export struct TopNavigationComponent { | @@ -278,7 +327,11 @@ export struct TopNavigationComponent { | ||
| 278 | if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && | 327 | if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && |
| 279 | !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) | 328 | !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) |
| 280 | ) { | 329 | ) { |
| 330 | + //在 tab 切换之前意图共享 | ||
| 331 | + // this.topNavInsightIntentShare(this.currentTopNavItem) | ||
| 332 | + | ||
| 281 | this.currentTopNavSelectedIndex = index; | 333 | this.currentTopNavSelectedIndex = index; |
| 334 | + this.currentTopNavItem = this.myChannelList[index] | ||
| 282 | } | 335 | } |
| 283 | if (this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) { | 336 | if (this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) { |
| 284 | // 跳转到播报页面 | 337 | // 跳转到播报页面 |
| @@ -416,9 +469,11 @@ export struct TopNavigationComponent { | @@ -416,9 +469,11 @@ export struct TopNavigationComponent { | ||
| 416 | this.changeByClick = true | 469 | this.changeByClick = true |
| 417 | this.tabsController.changeIndex(index) | 470 | this.tabsController.changeIndex(index) |
| 418 | } | 471 | } |
| 472 | + | ||
| 419 | }) | 473 | }) |
| 420 | } | 474 | } |
| 421 | 475 | ||
| 476 | + | ||
| 422 | aboutToAppear() { | 477 | aboutToAppear() { |
| 423 | //处理新闻tab顶导频道数据 | 478 | //处理新闻tab顶导频道数据 |
| 424 | this.topNavListHandle() | 479 | this.topNavListHandle() |
| @@ -86,7 +86,7 @@ export struct PeopleShipHomeArticleListComponent { | @@ -86,7 +86,7 @@ export struct PeopleShipHomeArticleListComponent { | ||
| 86 | 86 | ||
| 87 | // 加载更多 | 87 | // 加载更多 |
| 88 | ListItem() { | 88 | ListItem() { |
| 89 | - if (this.hasMore) { | 89 | + if (this.hasMore && this.arr && this.arr.length > 0) { |
| 90 | LoadMoreLayout({ isVisible: this.hasMore }) | 90 | LoadMoreLayout({ isVisible: this.hasMore }) |
| 91 | } else if (!this.hasMore && !this.isLoading) { | 91 | } else if (!this.hasMore && !this.isLoading) { |
| 92 | PeopleShipNoMoreData() | 92 | PeopleShipNoMoreData() |
| @@ -43,9 +43,8 @@ export struct PeopleShipHomePageNavComponent { | @@ -43,9 +43,8 @@ export struct PeopleShipHomePageNavComponent { | ||
| 43 | }).onClick(()=>{ | 43 | }).onClick(()=>{ |
| 44 | let params = { | 44 | let params = { |
| 45 | 'headPhotoUrl': this.detailModel.headPhotoUrl, | 45 | 'headPhotoUrl': this.detailModel.headPhotoUrl, |
| 46 | - 'headType': '1' | ||
| 47 | } as Record<string, string>; | 46 | } as Record<string, string>; |
| 48 | - WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage,params) | 47 | + WDRouterRule.jumpWithPage(WDRouterPage.showHomePageHeaderPage,params) |
| 49 | }).margin({ | 48 | }).margin({ |
| 50 | left: '10vp', | 49 | left: '10vp', |
| 51 | }) | 50 | }) |
| @@ -56,9 +56,8 @@ export struct PeopleShipHomePageTopComponent { | @@ -56,9 +56,8 @@ export struct PeopleShipHomePageTopComponent { | ||
| 56 | }).onClick(() => { | 56 | }).onClick(() => { |
| 57 | let params = { | 57 | let params = { |
| 58 | 'headPhotoUrl': this.detailModel.headPhotoUrl, | 58 | 'headPhotoUrl': this.detailModel.headPhotoUrl, |
| 59 | - 'headType': '1' | ||
| 60 | } as Record<string, string>; | 59 | } as Record<string, string>; |
| 61 | - WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage, params) | 60 | + WDRouterRule.jumpWithPage(WDRouterPage.showHomePageHeaderPage, params) |
| 62 | }) | 61 | }) |
| 63 | 62 | ||
| 64 | 63 | ||
| @@ -369,7 +368,11 @@ export struct PeopleShipHomePageTopComponent { | @@ -369,7 +368,11 @@ export struct PeopleShipHomePageTopComponent { | ||
| 369 | 368 | ||
| 370 | private computeShowNum(count: number) { | 369 | private computeShowNum(count: number) { |
| 371 | if (count >= 10000) { | 370 | if (count >= 10000) { |
| 372 | - return `${(count / 10000).toFixed(1)}万` | 371 | + let num = ( count / 10000).toFixed(1) |
| 372 | + if (Number(num.substring(num.length-1)) == 0) { | ||
| 373 | + num = num.substring(0, num.length-2) | ||
| 374 | + } | ||
| 375 | + return num + '万' | ||
| 373 | } | 376 | } |
| 374 | return `${count}` | 377 | return `${count}` |
| 375 | } | 378 | } |
| @@ -96,7 +96,7 @@ struct ReserveMorePage { | @@ -96,7 +96,7 @@ struct ReserveMorePage { | ||
| 96 | ) | 96 | ) |
| 97 | // 加载更多 | 97 | // 加载更多 |
| 98 | ListItem() { | 98 | ListItem() { |
| 99 | - if (this.hasMore) { | 99 | + if (this.hasMore && this.data && this.data.totalCount() > 0) { |
| 100 | LoadMoreLayout({ isVisible: this.hasMore }) | 100 | LoadMoreLayout({ isVisible: this.hasMore }) |
| 101 | } else if (!this.hasMore && !this.isLoading) { | 101 | } else if (!this.hasMore && !this.isLoading) { |
| 102 | PeopleShipNoMoreData() | 102 | PeopleShipNoMoreData() |
| @@ -127,7 +127,7 @@ struct ReserveMorePage { | @@ -127,7 +127,7 @@ struct ReserveMorePage { | ||
| 127 | buildItem(item: ContentDTO, index: number) { | 127 | buildItem(item: ContentDTO, index: number) { |
| 128 | Column() { | 128 | Column() { |
| 129 | Stack() { | 129 | Stack() { |
| 130 | - Image(item.fullColumnImgUrls[0].url) | 130 | + Image(item.fullColumnImgUrls[0]?.url) |
| 131 | .width('100%') | 131 | .width('100%') |
| 132 | .height(196) | 132 | .height(196) |
| 133 | .borderRadius(4) | 133 | .borderRadius(4) |
| @@ -139,8 +139,9 @@ struct ReserveMorePage { | @@ -139,8 +139,9 @@ struct ReserveMorePage { | ||
| 139 | Text(item.newsTitle) | 139 | Text(item.newsTitle) |
| 140 | .fontSize(17) | 140 | .fontSize(17) |
| 141 | .maxLines(2) | 141 | .maxLines(2) |
| 142 | + .lineHeight(25) | ||
| 142 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 143 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 143 | - .margin({ top: 16, left: 12, right: 12 }) | 144 | + .margin({ top: 4, left: 12, right: 12 }) |
| 144 | .alignSelf(ItemAlign.Start) | 145 | .alignSelf(ItemAlign.Start) |
| 145 | Row() { | 146 | Row() { |
| 146 | Row() { | 147 | Row() { |
| @@ -148,6 +149,7 @@ struct ReserveMorePage { | @@ -148,6 +149,7 @@ struct ReserveMorePage { | ||
| 148 | .width(20) | 149 | .width(20) |
| 149 | .height(20) | 150 | .height(20) |
| 150 | .margin({ left: 10, top: 2, bottom: 2, right: 6 }) | 151 | .margin({ left: 10, top: 2, bottom: 2, right: 6 }) |
| 152 | + | ||
| 151 | // Text(DateTimeUtils.formatDate(item.liveInfo.liveStartTime, "MM月dd日 HH:mm")) | 153 | // Text(DateTimeUtils.formatDate(item.liveInfo.liveStartTime, "MM月dd日 HH:mm")) |
| 152 | Text(this.getReserveDate(item.liveInfo.liveStartTime, 1)) | 154 | Text(this.getReserveDate(item.liveInfo.liveStartTime, 1)) |
| 153 | .fontSize(12) | 155 | .fontSize(12) |
| @@ -256,6 +258,9 @@ struct ReserveMorePage { | @@ -256,6 +258,9 @@ struct ReserveMorePage { | ||
| 256 | .height(24) | 258 | .height(24) |
| 257 | .objectFit(ImageFit.Auto) | 259 | .objectFit(ImageFit.Auto) |
| 258 | .id("back_icon") | 260 | .id("back_icon") |
| 261 | + .margin({ | ||
| 262 | + left: '16vp' | ||
| 263 | + }) | ||
| 259 | .alignRules({ | 264 | .alignRules({ |
| 260 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 265 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| 261 | left: { anchor: "__container__", align: HorizontalAlign.Start } | 266 | left: { anchor: "__container__", align: HorizontalAlign.Start } |
| @@ -267,10 +272,10 @@ struct ReserveMorePage { | @@ -267,10 +272,10 @@ struct ReserveMorePage { | ||
| 267 | Text(this.title)// .height('42lpx') | 272 | Text(this.title)// .height('42lpx') |
| 268 | .maxLines(1) | 273 | .maxLines(1) |
| 269 | .id("title") | 274 | .id("title") |
| 270 | - .fontSize('35lpx') | 275 | + .fontSize('18vp') |
| 271 | .fontWeight(400) | 276 | .fontWeight(400) |
| 272 | .fontColor($r('app.color.color_222222')) | 277 | .fontColor($r('app.color.color_222222')) |
| 273 | - .lineHeight('42lpx') | 278 | + .lineHeight('22vp') |
| 274 | .alignRules({ | 279 | .alignRules({ |
| 275 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 280 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| 276 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 281 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| @@ -284,11 +289,14 @@ struct ReserveMorePage { | @@ -284,11 +289,14 @@ struct ReserveMorePage { | ||
| 284 | @Builder | 289 | @Builder |
| 285 | LiveImage() { | 290 | LiveImage() { |
| 286 | Row() { | 291 | Row() { |
| 287 | - Image($r('app.media.reserve_icon')) | ||
| 288 | - .width(22) | ||
| 289 | - .height(18) | 292 | + Image($r('app.media.reserve_new_icon')) |
| 293 | + .width(14) | ||
| 294 | + .height(14) | ||
| 295 | + .margin({ | ||
| 296 | + right: 3 | ||
| 297 | + }) | ||
| 290 | Text('预约') | 298 | Text('预约') |
| 291 | - .fontSize('11fp') | 299 | + .fontSize('12vp') |
| 292 | .fontWeight(400) | 300 | .fontWeight(400) |
| 293 | .fontColor(Color.White) | 301 | .fontColor(Color.White) |
| 294 | } | 302 | } |
| @@ -131,10 +131,8 @@ export struct SearchResultComponent { | @@ -131,10 +131,8 @@ export struct SearchResultComponent { | ||
| 131 | .barWidth('100%') | 131 | .barWidth('100%') |
| 132 | .barHeight('84lpx') | 132 | .barHeight('84lpx') |
| 133 | .animationDuration(0) | 133 | .animationDuration(0) |
| 134 | - .onChange((index: number) => { | ||
| 135 | - this.currentIndex = index | ||
| 136 | - }) | ||
| 137 | .width('100%') | 134 | .width('100%') |
| 135 | + .scrollable(false) | ||
| 138 | .layoutWeight(1) | 136 | .layoutWeight(1) |
| 139 | } | 137 | } |
| 140 | }.width('100%') | 138 | }.width('100%') |
| @@ -22,7 +22,7 @@ export struct LikeComponent { | @@ -22,7 +22,7 @@ export struct LikeComponent { | ||
| 22 | @Prop data: Record<string, string> | 22 | @Prop data: Record<string, string> |
| 23 | enableBtn = true | 23 | enableBtn = true |
| 24 | componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口 | 24 | componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口 |
| 25 | - styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) | 25 | + styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) 3 透明背景 |
| 26 | @State likeCount: number = 0 //点赞数 | 26 | @State likeCount: number = 0 //点赞数 |
| 27 | 27 | ||
| 28 | //上层传值 样例 | 28 | //上层传值 样例 |
| @@ -50,6 +50,7 @@ export struct LikeComponent { | @@ -50,6 +50,7 @@ export struct LikeComponent { | ||
| 50 | //2: 新闻页中间位置样式 | 50 | //2: 新闻页中间位置样式 |
| 51 | this.likeCompStyle2() | 51 | this.likeCompStyle2() |
| 52 | } else if (this.componentType == 3) { | 52 | } else if (this.componentType == 3) { |
| 53 | + //卡片底部互动样式 | ||
| 53 | this.likeCompStyle3() | 54 | this.likeCompStyle3() |
| 54 | } else if (this.componentType == 4) { | 55 | } else if (this.componentType == 4) { |
| 55 | // 直播,点赞按钮底测有灰色圆角背景+右上点赞数量 | 56 | // 直播,点赞按钮底测有灰色圆角背景+右上点赞数量 |
| @@ -67,7 +68,7 @@ export struct LikeComponent { | @@ -67,7 +68,7 @@ export struct LikeComponent { | ||
| 67 | if (this.likesStyle === 1) { | 68 | if (this.likesStyle === 1) { |
| 68 | return { | 69 | return { |
| 69 | url: this.likeStatus ? $r(`app.media.ic_like_check`) : | 70 | url: this.likeStatus ? $r(`app.media.ic_like_check`) : |
| 70 | - this.styleType == 1 ? $r('app.media.icon_like_default') : $r(`app.media.ic_like_uncheck`), | 71 | + this.styleType == 1 ? this.componentType == 3?$r(`app.media.CarderInteraction_like`):$r('app.media.icon_like_default') : $r(`app.media.ic_like_uncheck`), |
| 71 | name: '赞' | 72 | name: '赞' |
| 72 | } | 73 | } |
| 73 | } else if (this.likesStyle === 2) { | 74 | } else if (this.likesStyle === 2) { |
| @@ -133,8 +134,8 @@ export struct LikeComponent { | @@ -133,8 +134,8 @@ export struct LikeComponent { | ||
| 133 | Image(this.transLikeStyle().url) | 134 | Image(this.transLikeStyle().url) |
| 134 | .width(18) | 135 | .width(18) |
| 135 | .height(18) | 136 | .height(18) |
| 136 | - // Text(this.likeStatus ? '已赞' : '点赞') | ||
| 137 | - Text(this.likeCount > 0 ? this.likeCount.toString() : '点赞') | 137 | + Text(this.likeStatus ? '已赞' : '点赞') |
| 138 | + // Text(this.likeCount > 0 ? this.likeCount.toString() : '点赞') | ||
| 138 | .margin({ left: 4 }) | 139 | .margin({ left: 4 }) |
| 139 | .fontSize(14) | 140 | .fontSize(14) |
| 140 | .fontColor(this.likeStatus ? '#ED2800' : '#666666') | 141 | .fontColor(this.likeStatus ? '#ED2800' : '#666666') |
| @@ -59,6 +59,7 @@ export struct OperRowListView { | @@ -59,6 +59,7 @@ export struct OperRowListView { | ||
| 59 | * 7:图集详情页 | 59 | * 7:图集详情页 |
| 60 | */ | 60 | */ |
| 61 | @Prop componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口 | 61 | @Prop componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口 |
| 62 | + @Prop pageComponentType: number = -1 //1:视频详情页 | ||
| 62 | @State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 63 | @State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 63 | @State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件 | 64 | @State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件 |
| 64 | @State needLike: boolean = true | 65 | @State needLike: boolean = true |
| @@ -115,6 +116,8 @@ export struct OperRowListView { | @@ -115,6 +116,8 @@ export struct OperRowListView { | ||
| 115 | } | 116 | } |
| 116 | 117 | ||
| 117 | build() { | 118 | build() { |
| 119 | + // 视频详情页 | ||
| 120 | + | ||
| 118 | Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { | 121 | Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { |
| 119 | // AudioDialog() | 122 | // AudioDialog() |
| 120 | Row() { | 123 | Row() { |
| @@ -162,6 +165,7 @@ export struct OperRowListView { | @@ -162,6 +165,7 @@ export struct OperRowListView { | ||
| 162 | bottom: `${this.bottomSafeHeight}px` | 165 | bottom: `${this.bottomSafeHeight}px` |
| 163 | // bottom: 50 | 166 | // bottom: 50 |
| 164 | }) | 167 | }) |
| 168 | + | ||
| 165 | } | 169 | } |
| 166 | 170 | ||
| 167 | /** | 171 | /** |
| @@ -174,11 +178,15 @@ export struct OperRowListView { | @@ -174,11 +178,15 @@ export struct OperRowListView { | ||
| 174 | CommentTabComponent({ | 178 | CommentTabComponent({ |
| 175 | publishCommentModel: this.publishCommentModel, | 179 | publishCommentModel: this.publishCommentModel, |
| 176 | contentDetail: this.contentDetailData, | 180 | contentDetail: this.contentDetailData, |
| 177 | - onCommentFocus: this.onCommentFocus | 181 | + onCommentFocus: this.onCommentFocus, |
| 182 | + pageComponentType: this.pageComponentType | ||
| 178 | }) | 183 | }) |
| 179 | } | 184 | } |
| 180 | } | 185 | } |
| 181 | - .flexShrink(1) | 186 | + .layoutWeight(1) |
| 187 | + .margin({ | ||
| 188 | + right: this.pageComponentType === 1 ? 16 : 0, | ||
| 189 | + }) | ||
| 182 | 190 | ||
| 183 | if (this.showCommentIcon) { | 191 | if (this.showCommentIcon) { |
| 184 | Column() { | 192 | Column() { |
| @@ -2,6 +2,8 @@ import { Action, NewspaperListBean, NewspaperListItemBean, NewspaperPositionItem | @@ -2,6 +2,8 @@ import { Action, NewspaperListBean, NewspaperListItemBean, NewspaperPositionItem | ||
| 2 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' | 2 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' |
| 3 | import { WDRouterRule } from 'wdRouter/Index' | 3 | import { WDRouterRule } from 'wdRouter/Index' |
| 4 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog' | 4 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog' |
| 5 | +import { Logger } from 'wdKit'; | ||
| 6 | +import { window } from '@kit.ArkUI'; | ||
| 5 | 7 | ||
| 6 | /** | 8 | /** |
| 7 | * 读报纸半屏弹窗 | 9 | * 读报纸半屏弹窗 |
| @@ -35,6 +37,12 @@ export struct ENewspaperListDialog { | @@ -35,6 +37,12 @@ export struct ENewspaperListDialog { | ||
| 35 | // listDialogController: CustomDialogController | 37 | // listDialogController: CustomDialogController |
| 36 | public closeDialog?: () => void | 38 | public closeDialog?: () => void |
| 37 | 39 | ||
| 40 | + // 手势滑动相关 | ||
| 41 | + private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Up | PanDirection.Down }) | ||
| 42 | + private topFixedHeight = 124 | ||
| 43 | + @State topHeight: number = 124 | ||
| 44 | + private deviceHeight: number = 0 | ||
| 45 | + | ||
| 38 | //watch监听报纸页码回调 | 46 | //watch监听报纸页码回调 |
| 39 | onCurrentPageNumUpdated(): void { | 47 | onCurrentPageNumUpdated(): void { |
| 40 | console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum) | 48 | console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum) |
| @@ -46,7 +54,13 @@ export struct ENewspaperListDialog { | @@ -46,7 +54,13 @@ export struct ENewspaperListDialog { | ||
| 46 | } | 54 | } |
| 47 | } | 55 | } |
| 48 | 56 | ||
| 49 | - aboutToAppear(): void { | 57 | + async aboutToAppear() { |
| 58 | + // 屏幕高度 - 滑动高度计算 | ||
| 59 | + let windowClass: window.Window = await window.getLastWindow(getContext(this)); | ||
| 60 | + let changeHeight = 85 + 44 + px2vp(windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height) | ||
| 61 | + changeHeight += px2vp(windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).bottomRect.height) | ||
| 62 | + this.deviceHeight = px2vp(windowClass.getWindowProperties().windowRect.height) - changeHeight | ||
| 63 | + | ||
| 50 | this.isCurrentViewOpen = true | 64 | this.isCurrentViewOpen = true |
| 51 | console.log("ENewspaperListDialog-aboutToAppear", "currentPageNum:", this.currentPageNum) | 65 | console.log("ENewspaperListDialog-aboutToAppear", "currentPageNum:", this.currentPageNum) |
| 52 | let _scrollIndex = Number.parseInt(this.currentPageNum) | 66 | let _scrollIndex = Number.parseInt(this.currentPageNum) |
| @@ -56,15 +70,13 @@ export struct ENewspaperListDialog { | @@ -56,15 +70,13 @@ export struct ENewspaperListDialog { | ||
| 56 | } | 70 | } |
| 57 | 71 | ||
| 58 | aboutToDisappear() { | 72 | aboutToDisappear() { |
| 59 | - // if (this.pageListDialogController) { | ||
| 60 | - // this.pageListDialogController = null | ||
| 61 | - // } | ||
| 62 | this.isCurrentViewOpen = false | 73 | this.isCurrentViewOpen = false |
| 63 | } | 74 | } |
| 64 | 75 | ||
| 65 | build() { | 76 | build() { |
| 66 | Stack() { | 77 | Stack() { |
| 67 | Column() { | 78 | Column() { |
| 79 | + Column() { | ||
| 68 | Row() | 80 | Row() |
| 69 | .width(43) | 81 | .width(43) |
| 70 | .height(4) | 82 | .height(4) |
| @@ -110,6 +122,24 @@ export struct ENewspaperListDialog { | @@ -110,6 +122,24 @@ export struct ENewspaperListDialog { | ||
| 110 | .height(6) | 122 | .height(6) |
| 111 | .margin({ top: 20, left: 16, right: 16 }) | 123 | .margin({ top: 20, left: 16, right: 16 }) |
| 112 | .objectFit(ImageFit.Contain) | 124 | .objectFit(ImageFit.Contain) |
| 125 | + } | ||
| 126 | + .width('100%') | ||
| 127 | + .gesture( | ||
| 128 | + PanGesture(this.panOption) | ||
| 129 | + .onActionStart((event: GestureEvent) => { | ||
| 130 | + Logger.debug('ENewspaperListDialog','Pan start') | ||
| 131 | + }) | ||
| 132 | + .onActionUpdate((event: GestureEvent) => { | ||
| 133 | + if (this.topFixedHeight + event.offsetY >= this.topFixedHeight) { | ||
| 134 | + this.topHeight = this.topFixedHeight + event.offsetY | ||
| 135 | + } | ||
| 136 | + Logger.debug('ENewspaperListDialog', 'topHeight:' + this.topHeight) | ||
| 137 | + }) | ||
| 138 | + .onActionEnd(() => { | ||
| 139 | + this.onCloseGestureDialog() | ||
| 140 | + }) | ||
| 141 | + ) | ||
| 142 | + | ||
| 113 | 143 | ||
| 114 | List({ scroller: this.listScroller, initialIndex: this.scrollIndex }) { | 144 | List({ scroller: this.listScroller, initialIndex: this.scrollIndex }) { |
| 115 | ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => { | 145 | ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => { |
| @@ -137,7 +167,7 @@ export struct ENewspaperListDialog { | @@ -137,7 +167,7 @@ export struct ENewspaperListDialog { | ||
| 137 | .fontSize($r('app.float.font_size_14')) | 167 | .fontSize($r('app.float.font_size_14')) |
| 138 | .fontColor($r('app.color.color_222222')) | 168 | .fontColor($r('app.color.color_222222')) |
| 139 | .fontWeight(600) | 169 | .fontWeight(600) |
| 140 | - .maxLines(2) | 170 | + // .maxLines(2) |
| 141 | .margin({ | 171 | .margin({ |
| 142 | bottom: 8 | 172 | bottom: 8 |
| 143 | }) | 173 | }) |
| @@ -151,7 +181,7 @@ export struct ENewspaperListDialog { | @@ -151,7 +181,7 @@ export struct ENewspaperListDialog { | ||
| 151 | .margin({ | 181 | .margin({ |
| 152 | bottom: 8 | 182 | bottom: 8 |
| 153 | }) | 183 | }) |
| 154 | - .maxLines(2) | 184 | + // .maxLines(2) |
| 155 | } | 185 | } |
| 156 | 186 | ||
| 157 | if (positionItem.downTitle) { | 187 | if (positionItem.downTitle) { |
| @@ -162,7 +192,7 @@ export struct ENewspaperListDialog { | @@ -162,7 +192,7 @@ export struct ENewspaperListDialog { | ||
| 162 | .margin({ | 192 | .margin({ |
| 163 | bottom: 8 | 193 | bottom: 8 |
| 164 | }) | 194 | }) |
| 165 | - .maxLines(2) | 195 | + // .maxLines(2) |
| 166 | } | 196 | } |
| 167 | if (positionItem.newsTxt) { | 197 | if (positionItem.newsTxt) { |
| 168 | Text(positionItem.newsTxt) | 198 | Text(positionItem.newsTxt) |
| @@ -251,16 +281,13 @@ export struct ENewspaperListDialog { | @@ -251,16 +281,13 @@ export struct ENewspaperListDialog { | ||
| 251 | this.currentPageNum = `${firstIndex < 9 ? '0' + (firstIndex + 1) : firstIndex + 1}` | 281 | this.currentPageNum = `${firstIndex < 9 ? '0' + (firstIndex + 1) : firstIndex + 1}` |
| 252 | // } | 282 | // } |
| 253 | }) | 283 | }) |
| 254 | - .onScroll((scrollOffset: number, scrollState: ScrollState) => { | ||
| 255 | - // console.info(`onScroll scrollState = ScrollState` + scrollState + `, scrollOffset = ` + scrollOffset) | ||
| 256 | - // if (this.scrollOffset == 0) { | ||
| 257 | - // this.scrollOffset = 0 | ||
| 258 | - // } | ||
| 259 | - }) | ||
| 260 | } | 284 | } |
| 261 | - .margin({ top: 124 }) | 285 | + // .margin({ top: 124 }) |
| 286 | + .margin({ top: this.topHeight }) | ||
| 287 | + | ||
| 262 | .width('100%') | 288 | .width('100%') |
| 263 | .backgroundColor(Color.White) | 289 | .backgroundColor(Color.White) |
| 290 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) | ||
| 264 | .onClick(() => { | 291 | .onClick(() => { |
| 265 | 292 | ||
| 266 | }) | 293 | }) |
| @@ -272,6 +299,33 @@ export struct ENewspaperListDialog { | @@ -272,6 +299,33 @@ export struct ENewspaperListDialog { | ||
| 272 | this.closeDialog() | 299 | this.closeDialog() |
| 273 | } | 300 | } |
| 274 | }) | 301 | }) |
| 302 | + .gesture( | ||
| 303 | + PanGesture(this.panOption) | ||
| 304 | + .onActionStart((event: GestureEvent) => { | ||
| 305 | + Logger.debug('ENewspaperListDialog','Pan start') | ||
| 306 | + }) | ||
| 307 | + .onActionUpdate((event: GestureEvent) => { | ||
| 308 | + if (event) { | ||
| 309 | + if (this.topFixedHeight + event.offsetY >= this.topFixedHeight) { | ||
| 310 | + this.topHeight = this.topFixedHeight + event.offsetY | ||
| 311 | + } | ||
| 312 | + Logger.debug('ENewspaperListDialog', 'topHeight:' + this.topHeight) | ||
| 313 | + } | ||
| 314 | + }) | ||
| 315 | + .onActionEnd(() => { | ||
| 316 | + this.onCloseGestureDialog() | ||
| 317 | + }) | ||
| 318 | + ) | ||
| 319 | + } | ||
| 320 | + | ||
| 321 | + onCloseGestureDialog() { | ||
| 322 | + if (this.topHeight >= this.deviceHeight ) { | ||
| 323 | + if (this.closeDialog) { | ||
| 324 | + this.closeDialog() | ||
| 325 | + } | ||
| 326 | + } else { | ||
| 327 | + this.topHeight = this.topFixedHeight | ||
| 328 | + } | ||
| 275 | } | 329 | } |
| 276 | 330 | ||
| 277 | updateRecordsData() { | 331 | updateRecordsData() { |
| 1 | +import { router } from '@kit.ArkUI'; | ||
| 2 | + | ||
| 3 | +@Entry | ||
| 4 | +@Component | ||
| 5 | +struct ShowHomePageHeaderPage { | ||
| 6 | + @State headPhotoUrl: string = ''; | ||
| 7 | + @State params:Record<string, string> = router.getParams() as Record<string, string>; | ||
| 8 | + | ||
| 9 | + onPageShow() { | ||
| 10 | + this.headPhotoUrl = this.params?.['headPhotoUrl']; | ||
| 11 | + } | ||
| 12 | + | ||
| 13 | + build() { | ||
| 14 | + Row() { | ||
| 15 | + Image(this.headPhotoUrl) | ||
| 16 | + .alt( $r('app.media.WDAccountOwnerHedaerDefaultIcon') ) | ||
| 17 | + .width('100%') | ||
| 18 | + .objectFit(ImageFit.Contain) | ||
| 19 | + } | ||
| 20 | + .width('100%') | ||
| 21 | + .height('100%') | ||
| 22 | + .alignItems(VerticalAlign.Center) | ||
| 23 | + .backgroundColor($r('app.color.color_000000')) | ||
| 24 | + .onClick(()=>{ | ||
| 25 | + router.back() | ||
| 26 | + }) | ||
| 27 | + } | ||
| 28 | +} |
| @@ -4,18 +4,16 @@ import { router } from '@kit.ArkUI'; | @@ -4,18 +4,16 @@ import { router } from '@kit.ArkUI'; | ||
| 4 | @Component | 4 | @Component |
| 5 | struct ShowUserHeaderPage { | 5 | struct ShowUserHeaderPage { |
| 6 | @State headPhotoUrl: string = ''; | 6 | @State headPhotoUrl: string = ''; |
| 7 | - @State headType: string = '' | ||
| 8 | @State params:Record<string, string> = router.getParams() as Record<string, string>; | 7 | @State params:Record<string, string> = router.getParams() as Record<string, string>; |
| 9 | 8 | ||
| 10 | onPageShow() { | 9 | onPageShow() { |
| 11 | this.headPhotoUrl = this.params?.['headPhotoUrl']; | 10 | this.headPhotoUrl = this.params?.['headPhotoUrl']; |
| 12 | - this.headType = this.params?.['headType'] ?? ''; | ||
| 13 | } | 11 | } |
| 14 | 12 | ||
| 15 | build() { | 13 | build() { |
| 16 | Row() { | 14 | Row() { |
| 17 | Image(this.headPhotoUrl) | 15 | Image(this.headPhotoUrl) |
| 18 | - .alt(this.headType.length > 0 ? $r('app.media.WDAccountOwnerHedaerDefaultIcon') : $r('app.media.default_head')) | 16 | + .alt($r('app.media.default_head')) |
| 19 | .width('720lpx') | 17 | .width('720lpx') |
| 20 | .height('720lpx') | 18 | .height('720lpx') |
| 21 | .objectFit(ImageFit.Auto) | 19 | .objectFit(ImageFit.Auto) |
sight_harmony/features/wdComponent/src/main/resources/base/media/comment_img_input_black.png
0 → 100644
2.5 KB
10.1 KB
28.4 KB
13.3 KB
2.09 KB
| @@ -24,6 +24,7 @@ | @@ -24,6 +24,7 @@ | ||
| 24 | "components/page/ThemeListPage", | 24 | "components/page/ThemeListPage", |
| 25 | "pages/ShowUserHeaderPage", | 25 | "pages/ShowUserHeaderPage", |
| 26 | "pages/MineMessagePage", | 26 | "pages/MineMessagePage", |
| 27 | - "components/page/InteractMessagePage" | 27 | + "components/page/InteractMessagePage", |
| 28 | + "pages/ShowHomePageHeaderPage" | ||
| 28 | ] | 29 | ] |
| 29 | } | 30 | } |
| @@ -70,6 +70,7 @@ export struct DetailPlayLiveCommon { | @@ -70,6 +70,7 @@ export struct DetailPlayLiveCommon { | ||
| 70 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | 70 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) |
| 71 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | 71 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) |
| 72 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | 72 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) |
| 73 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | ||
| 73 | this.publishCommentModel.commentContent = '' | 74 | this.publishCommentModel.commentContent = '' |
| 74 | // } | 75 | // } |
| 75 | } | 76 | } |
| @@ -121,11 +121,12 @@ export struct PlayUIComponent { | @@ -121,11 +121,12 @@ export struct PlayUIComponent { | ||
| 121 | } | 121 | } |
| 122 | } | 122 | } |
| 123 | .width('100%') | 123 | .width('100%') |
| 124 | + // .width(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? 'calc(100% - 80vp)' : 'calc(100% - 32vp)') | ||
| 124 | .padding({ | 125 | .padding({ |
| 125 | top: 15, | 126 | top: 15, |
| 126 | bottom: 6, | 127 | bottom: 6, |
| 127 | - left: 10, | ||
| 128 | - right: 10 | 128 | + left: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp', |
| 129 | + right: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp' | ||
| 129 | }) | 130 | }) |
| 130 | .alignItems(HorizontalAlign.Start) | 131 | .alignItems(HorizontalAlign.Start) |
| 131 | .visibility(this.isMenuVisible ? Visibility.Visible : Visibility.None) | 132 | .visibility(this.isMenuVisible ? Visibility.Visible : Visibility.None) |
| @@ -292,8 +293,8 @@ export struct PlayUIComponent { | @@ -292,8 +293,8 @@ export struct PlayUIComponent { | ||
| 292 | .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] }) | 293 | .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] }) |
| 293 | .width('100%') | 294 | .width('100%') |
| 294 | .padding({ | 295 | .padding({ |
| 295 | - left: 10, | ||
| 296 | - right: 10, | 296 | + left: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp', |
| 297 | + right: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp', | ||
| 297 | top: 15, | 298 | top: 15, |
| 298 | bottom: 15 | 299 | bottom: 15 |
| 299 | }) | 300 | }) |
| @@ -28,11 +28,11 @@ export struct TopPlayComponent { | @@ -28,11 +28,11 @@ export struct TopPlayComponent { | ||
| 28 | 28 | ||
| 29 | updateData() { | 29 | updateData() { |
| 30 | //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | 30 | //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 |
| 31 | - if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.previewUrl && this.liveDetailsBean.liveInfo.previewUrl.length > 0) { | 31 | + if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.previewUrl && |
| 32 | + this.liveDetailsBean.liveInfo.previewUrl.length > 0) { | ||
| 32 | this.imgUrl = this.liveDetailsBean.liveInfo.previewUrl | 33 | this.imgUrl = this.liveDetailsBean.liveInfo.previewUrl |
| 33 | Logger.debug(TAG, 'ok+' + `${this.imgUrl}`) | 34 | Logger.debug(TAG, 'ok+' + `${this.imgUrl}`) |
| 34 | - } | ||
| 35 | - else if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) { | 35 | + } else if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) { |
| 36 | this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url | 36 | this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url |
| 37 | Logger.debug(TAG, 'ok-' + `${this.imgUrl}`) | 37 | Logger.debug(TAG, 'ok-' + `${this.imgUrl}`) |
| 38 | } | 38 | } |
| @@ -81,6 +81,7 @@ export struct TopPlayComponent { | @@ -81,6 +81,7 @@ export struct TopPlayComponent { | ||
| 81 | .alignSelf(ItemAlign.Center) | 81 | .alignSelf(ItemAlign.Center) |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | - aboutToDisappear(): void { | 84 | + async aboutToDisappear(): Promise<void> { |
| 85 | + await this.playerController?.release() | ||
| 85 | } | 86 | } |
| 86 | } | 87 | } |
| @@ -115,6 +115,7 @@ export struct PlayerCommentComponent { | @@ -115,6 +115,7 @@ export struct PlayerCommentComponent { | ||
| 115 | // 收藏、分享、点赞是否需要根据字段显隐 | 115 | // 收藏、分享、点赞是否需要根据字段显隐 |
| 116 | OperRowListView({ | 116 | OperRowListView({ |
| 117 | styleType: 3, | 117 | styleType: 3, |
| 118 | + componentType: 4, | ||
| 118 | operationButtonList: ['comment', 'collect', 'share', 'like'], | 119 | operationButtonList: ['comment', 'collect', 'share', 'like'], |
| 119 | contentDetailData: this.contentDetailData, | 120 | contentDetailData: this.contentDetailData, |
| 120 | publishCommentModel: this.publishCommentModel, | 121 | publishCommentModel: this.publishCommentModel, |
| @@ -37,11 +37,10 @@ export struct PlayerComponent { | @@ -37,11 +37,10 @@ export struct PlayerComponent { | ||
| 37 | } | 37 | } |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | - aboutToDisappear(): void { | ||
| 41 | - | 40 | + async aboutToDisappear(): Promise<void> { |
| 42 | this.playerController?.pause() | 41 | this.playerController?.pause() |
| 43 | this.playerController?.stop() | 42 | this.playerController?.stop() |
| 44 | - this.playerController?.release() | 43 | + await this.playerController?.release() |
| 45 | } | 44 | } |
| 46 | 45 | ||
| 47 | updateData() { | 46 | updateData() { |
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/CommentComponentPage.ets
0 → 100644
| 1 | +import { ContentDetailDTO } from 'wdBean/Index' | ||
| 2 | +import { | ||
| 3 | + publishCommentModel | ||
| 4 | +} from '../../../../../wdComponent/src/main/ets/components/comment/model/PublishCommentModel' | ||
| 5 | +import { CommentComponent } from '../../../../../wdComponent/src/main/ets/components/comment/view/CommentComponent' | ||
| 6 | + | ||
| 7 | +@Component | ||
| 8 | +export struct CommentComponentPage { | ||
| 9 | + scroller: Scroller = new Scroller() | ||
| 10 | + @Consume contentDetailData: ContentDetailDTO | ||
| 11 | + @Consume showCommentList: boolean | ||
| 12 | + @State publishCommentModel: publishCommentModel = new publishCommentModel() | ||
| 13 | + | ||
| 14 | + aboutToAppear(): void { | ||
| 15 | + | ||
| 16 | + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | ||
| 17 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | ||
| 18 | + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | ||
| 19 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 20 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 21 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 22 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + build() { | ||
| 26 | + Scroll(this.scroller) { | ||
| 27 | + Stack() { | ||
| 28 | + CommentComponent({ | ||
| 29 | + publishCommentModel: this.publishCommentModel | ||
| 30 | + }) | ||
| 31 | + Image($r("app.media.ic_close_black")) | ||
| 32 | + .width(20) | ||
| 33 | + .height(20) | ||
| 34 | + .onClick(() => { | ||
| 35 | + this.showCommentList = false | ||
| 36 | + }) | ||
| 37 | + .margin({ top: 10, right: 20 }) | ||
| 38 | + .position({ x: '100%' }) | ||
| 39 | + .markAnchor({ x: '100%' }) | ||
| 40 | + | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + .zIndex(1000) | ||
| 44 | + .backgroundColor(Color.White) | ||
| 45 | + | ||
| 46 | + } | ||
| 47 | +} |
| 1 | import { ContentDetailDTO, InteractDataDTO } from 'wdBean'; | 1 | import { ContentDetailDTO, InteractDataDTO } from 'wdBean'; |
| 2 | -import { PlayerConstants, WDPlayerController, WDPlayerRenderView } from 'wdPlayer'; | 2 | +import { WDPlayerController, WDPlayerRenderView } from 'wdPlayer'; |
| 3 | import { ContentDetailRequest } from 'wdDetailPlayApi'; | 3 | import { ContentDetailRequest } from 'wdDetailPlayApi'; |
| 4 | import { | 4 | import { |
| 5 | batchLikeAndCollectParams, | 5 | batchLikeAndCollectParams, |
| @@ -11,6 +11,7 @@ import { HttpUtils } from 'wdNetwork/Index'; | @@ -11,6 +11,7 @@ import { HttpUtils } from 'wdNetwork/Index'; | ||
| 11 | import { DateTimeUtils } from 'wdKit/Index'; | 11 | import { DateTimeUtils } from 'wdKit/Index'; |
| 12 | import { PlayerBottomView } from '../view/PlayerBottomView'; | 12 | import { PlayerBottomView } from '../view/PlayerBottomView'; |
| 13 | import { PlayerRightView } from '../view/PlayerRightView'; | 13 | import { PlayerRightView } from '../view/PlayerRightView'; |
| 14 | +import { CommentComponentPage } from './CommentComponentPage'; | ||
| 14 | 15 | ||
| 15 | const TAG = 'DetailPlayShortVideoPage'; | 16 | const TAG = 'DetailPlayShortVideoPage'; |
| 16 | 17 | ||
| @@ -32,6 +33,7 @@ export struct DetailPlayShortVideoPage { | @@ -32,6 +33,7 @@ export struct DetailPlayShortVideoPage { | ||
| 32 | @Provide followStatus: string = '0' // 关注状态 | 33 | @Provide followStatus: string = '0' // 关注状态 |
| 33 | @Provide isOpenDetail: boolean = false // 查看详情按钮点击 | 34 | @Provide isOpenDetail: boolean = false // 查看详情按钮点击 |
| 34 | @Provide isDragging: boolean = false // 拖动时间进度条 | 35 | @Provide isDragging: boolean = false // 拖动时间进度条 |
| 36 | + @Provide showCommentList: boolean = false | ||
| 35 | @Consume @Watch('videoStatusChange') switchVideoStatus: boolean | 37 | @Consume @Watch('videoStatusChange') switchVideoStatus: boolean |
| 36 | @Consume @Watch('pageShowChange') pageShow: number | 38 | @Consume @Watch('pageShowChange') pageShow: number |
| 37 | @Consume topSafeHeight: number | 39 | @Consume topSafeHeight: number |
| @@ -148,6 +150,7 @@ export struct DetailPlayShortVideoPage { | @@ -148,6 +150,7 @@ export struct DetailPlayShortVideoPage { | ||
| 148 | this.progressVal = Math.floor(position * 100 / duration); | 150 | this.progressVal = Math.floor(position * 100 / duration); |
| 149 | } | 151 | } |
| 150 | this.queryNewsInfoOfUser() | 152 | this.queryNewsInfoOfUser() |
| 153 | + | ||
| 151 | } | 154 | } |
| 152 | 155 | ||
| 153 | async aboutToDisappear(): Promise<void> { | 156 | async aboutToDisappear(): Promise<void> { |
| @@ -163,10 +166,14 @@ export struct DetailPlayShortVideoPage { | @@ -163,10 +166,14 @@ export struct DetailPlayShortVideoPage { | ||
| 163 | PlayerBottomView({ | 166 | PlayerBottomView({ |
| 164 | playerController: this.playerController | 167 | playerController: this.playerController |
| 165 | }) | 168 | }) |
| 169 | + | ||
| 166 | PlayerRightView({ | 170 | PlayerRightView({ |
| 167 | playerController: this.playerController | 171 | playerController: this.playerController |
| 168 | }) | 172 | }) |
| 169 | 173 | ||
| 174 | + CommentComponentPage({}).visibility(this.showCommentList ? Visibility.Visible : Visibility.None) | ||
| 175 | + .position({ y: '100%' }) | ||
| 176 | + .markAnchor({ y: '100%' }) | ||
| 170 | } | 177 | } |
| 171 | .height('100%') | 178 | .height('100%') |
| 172 | .width('100%') | 179 | .width('100%') |
| @@ -192,6 +199,7 @@ export struct DetailPlayShortVideoPage { | @@ -192,6 +199,7 @@ export struct DetailPlayShortVideoPage { | ||
| 192 | 199 | ||
| 193 | @Builder | 200 | @Builder |
| 194 | playerViewBuilder() { | 201 | playerViewBuilder() { |
| 202 | + | ||
| 195 | WDPlayerRenderView({ | 203 | WDPlayerRenderView({ |
| 196 | playerController: this.playerController, | 204 | playerController: this.playerController, |
| 197 | onLoad: async () => { | 205 | onLoad: async () => { |
| @@ -205,10 +213,13 @@ export struct DetailPlayShortVideoPage { | @@ -205,10 +213,13 @@ export struct DetailPlayShortVideoPage { | ||
| 205 | .padding({ | 213 | .padding({ |
| 206 | bottom: this.videoLandScape === 1 ? 115 : 0, | 214 | bottom: this.videoLandScape === 1 ? 115 : 0, |
| 207 | }) | 215 | }) |
| 216 | + .layoutWeight(1) | ||
| 208 | .align(this.videoLandScape === 0 ? Alignment.Top : Alignment.Center) | 217 | .align(this.videoLandScape === 0 ? Alignment.Top : Alignment.Center) |
| 209 | .onClick(() => { | 218 | .onClick(() => { |
| 210 | console.error('WDPlayerRenderView=== onClick') | 219 | console.error('WDPlayerRenderView=== onClick') |
| 211 | this.playerController?.switchPlayOrPause(); | 220 | this.playerController?.switchPlayOrPause(); |
| 212 | }) | 221 | }) |
| 222 | + | ||
| 223 | + | ||
| 213 | } | 224 | } |
| 214 | } | 225 | } |
| @@ -43,7 +43,7 @@ export struct DetailDialog { | @@ -43,7 +43,7 @@ export struct DetailDialog { | ||
| 43 | .height(200) | 43 | .height(200) |
| 44 | 44 | ||
| 45 | Row() { | 45 | Row() { |
| 46 | - Image($r('app.media.ic_close')) | 46 | + Image($r("app.media.ic_close_white")) |
| 47 | .height(24).margin({ top: 20 }).onClick(() => { | 47 | .height(24).margin({ top: 20 }).onClick(() => { |
| 48 | this.controller.close() | 48 | this.controller.close() |
| 49 | if (this.isOpenDetail) { | 49 | if (this.isOpenDetail) { |
| @@ -3,20 +3,56 @@ import { PlayerTitleView } from './PlayerTitleView' | @@ -3,20 +3,56 @@ import { PlayerTitleView } from './PlayerTitleView' | ||
| 3 | import { PlayerProgressView } from './PlayerProgressView' | 3 | import { PlayerProgressView } from './PlayerProgressView' |
| 4 | import { PlayerCommentView } from './PlayerCommentView' | 4 | import { PlayerCommentView } from './PlayerCommentView' |
| 5 | import { PlayerTimeSeekView } from './PlayerTimeSeekView' | 5 | import { PlayerTimeSeekView } from './PlayerTimeSeekView' |
| 6 | +import { OperRowListView } from '../../../../../wdComponent/src/main/ets/components/view/OperRowListView' | ||
| 7 | +import { | ||
| 8 | + publishCommentModel | ||
| 9 | +} from '../../../../../wdComponent/src/main/ets/components/comment/model/PublishCommentModel' | ||
| 10 | +import { ContentDetailDTO } from 'wdBean/Index'; | ||
| 11 | +import { WindowModel } from 'wdKit/Index'; | ||
| 6 | 12 | ||
| 7 | @Component | 13 | @Component |
| 8 | export struct PlayerBottomView { | 14 | export struct PlayerBottomView { |
| 9 | private playerController?: WDPlayerController; | 15 | private playerController?: WDPlayerController; |
| 16 | + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | ||
| 10 | @Consume showComment?: boolean | 17 | @Consume showComment?: boolean |
| 11 | @Consume isOpenDetail?: boolean | 18 | @Consume isOpenDetail?: boolean |
| 12 | @Consume isDragging?: boolean | 19 | @Consume isDragging?: boolean |
| 20 | + @Consume contentDetailData: ContentDetailDTO | ||
| 21 | + @State publishCommentModel: publishCommentModel = new publishCommentModel() | ||
| 22 | + | ||
| 23 | + aboutToAppear(): void { | ||
| 24 | + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | ||
| 25 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | ||
| 26 | + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | ||
| 27 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 28 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 29 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 30 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 31 | + this.publishCommentModel.commentContent = '' | ||
| 32 | + } | ||
| 13 | 33 | ||
| 14 | build() { | 34 | build() { |
| 15 | Column() { | 35 | Column() { |
| 16 | PlayerTitleView() | 36 | PlayerTitleView() |
| 17 | PlayerProgressView({ playerController: this.playerController }) | 37 | PlayerProgressView({ playerController: this.playerController }) |
| 18 | if (this.showComment) { | 38 | if (this.showComment) { |
| 19 | - PlayerCommentView() | 39 | + // PlayerCommentView() |
| 40 | + OperRowListView({ | ||
| 41 | + pageComponentType: 1, | ||
| 42 | + styleType: 3, | ||
| 43 | + componentType: 4, | ||
| 44 | + operationButtonList: ['comment',], | ||
| 45 | + contentDetailData: this.contentDetailData, | ||
| 46 | + publishCommentModel: this.publishCommentModel, | ||
| 47 | + showCommentIcon: false, | ||
| 48 | + onBack: () => { | ||
| 49 | + WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 50 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) | ||
| 51 | + } | ||
| 52 | + }) | ||
| 53 | + .padding({ | ||
| 54 | + bottom: -this.bottomSafeHeight + 'px' | ||
| 55 | + }) | ||
| 20 | } | 56 | } |
| 21 | } | 57 | } |
| 22 | .alignItems(HorizontalAlign.Start) | 58 | .alignItems(HorizontalAlign.Start) |
| @@ -32,6 +32,7 @@ export struct PlayerRightView { | @@ -32,6 +32,7 @@ export struct PlayerRightView { | ||
| 32 | @Consume isOpenDetail: boolean | 32 | @Consume isOpenDetail: boolean |
| 33 | @Consume isDragging: boolean | 33 | @Consume isDragging: boolean |
| 34 | @Consume showComment?: boolean | 34 | @Consume showComment?: boolean |
| 35 | + @Consume showCommentList: boolean | ||
| 35 | @State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 36 | @State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 36 | 37 | ||
| 37 | aboutToAppear() { | 38 | aboutToAppear() { |
| @@ -343,7 +344,8 @@ export struct PlayerRightView { | @@ -343,7 +344,8 @@ export struct PlayerRightView { | ||
| 343 | } | 344 | } |
| 344 | .margin({ bottom: 20 }) | 345 | .margin({ bottom: 20 }) |
| 345 | .onClick((event: ClickEvent) => { | 346 | .onClick((event: ClickEvent) => { |
| 346 | - ToastUtils.showToast('评论为公共方法,待开发', 1000); | 347 | + // ToastUtils.showToast('评论为公共方法,待开发', 1000); |
| 348 | + this.showCommentList = true | ||
| 347 | }) | 349 | }) |
| 348 | } | 350 | } |
| 349 | 351 |
| @@ -5,6 +5,14 @@ | @@ -5,6 +5,14 @@ | ||
| 5 | "value": "#FFFFFF" | 5 | "value": "#FFFFFF" |
| 6 | }, | 6 | }, |
| 7 | { | 7 | { |
| 8 | + "name": "color_transparent", | ||
| 9 | + "value": "#00000000" | ||
| 10 | + }, | ||
| 11 | + { | ||
| 12 | + "name": "color_222222", | ||
| 13 | + "value": "#222222" | ||
| 14 | + }, | ||
| 15 | + { | ||
| 8 | "name": "play_track_color", | 16 | "name": "play_track_color", |
| 9 | "value": "#1AFFFFFF" | 17 | "value": "#1AFFFFFF" |
| 10 | }, | 18 | }, |
| @@ -29,6 +37,18 @@ | @@ -29,6 +37,18 @@ | ||
| 29 | "value": "#4DFFFFFF" | 37 | "value": "#4DFFFFFF" |
| 30 | }, | 38 | }, |
| 31 | { | 39 | { |
| 40 | + "name": "color_666666", | ||
| 41 | + "value": "#666666" | ||
| 42 | + }, | ||
| 43 | + { | ||
| 44 | + "name": "color_B0B0B0", | ||
| 45 | + "value": "#B0B0B0" | ||
| 46 | + }, | ||
| 47 | + { | ||
| 48 | + "name": "color_EDEDED", | ||
| 49 | + "value": "#EDEDED" | ||
| 50 | + }, | ||
| 51 | + { | ||
| 32 | "name": "divider_color", | 52 | "name": "divider_color", |
| 33 | "value": "#D3D3D3" | 53 | "value": "#D3D3D3" |
| 34 | }, | 54 | }, |
| @@ -3,6 +3,22 @@ | @@ -3,6 +3,22 @@ | ||
| 3 | { | 3 | { |
| 4 | "name": "shared_desc", | 4 | "name": "shared_desc", |
| 5 | "value": "description" | 5 | "value": "description" |
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "name": "footer_text", | ||
| 9 | + "value": "已显示全部内容" | ||
| 10 | + }, | ||
| 11 | + { | ||
| 12 | + "name": "pull_up_load_text", | ||
| 13 | + "value": "加载中..." | ||
| 14 | + }, | ||
| 15 | + { | ||
| 16 | + "name": "pull_down_refresh_text", | ||
| 17 | + "value": "下拉刷新" | ||
| 18 | + }, | ||
| 19 | + { | ||
| 20 | + "name": "release_refresh_text", | ||
| 21 | + "value": "松开刷新" | ||
| 6 | } | 22 | } |
| 7 | ] | 23 | ] |
| 8 | } | 24 | } |
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/comment_hyphen.png
0 → 100644
244 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/comment_hyphen_block.png
0 → 100644
242 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/comment_icon.png
0 → 100644
1.05 KB
934 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/comment_icon_white.png
0 → 100644
866 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/comment_icon_zhiding.png
0 → 100644
2.7 KB
2.5 KB
1.75 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/comment_pickUp.png
0 → 100644
354 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/comment_reply.png
0 → 100644
333 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/comment_rmh_tag.png
0 → 100644
2.01 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/comment_unfold.png
0 → 100644
373 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/default_head.png
0 → 100644
4.9 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_close.png
deleted
100644 → 0
908 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_close_black.png
0 → 100644
1.03 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_close_white.png
0 → 100644
980 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_collect_check1.png
0 → 100644
2.19 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_like_back.png
0 → 100644
617 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_pull_down_refresh.png
0 → 100644
1.88 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_pull_up_load.gif
0 → 100644
1.75 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_arrow_left.png
0 → 100644
734 Bytes
570 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_like_default.png
0 → 100644
1.15 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_listen.png
0 → 100644
1.67 KB
3.21 KB
2.41 KB
2.65 KB
1.89 KB
487 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/wdInput_delete.png
0 → 100644
1.58 KB
| @@ -2,7 +2,10 @@ import HuaweiAuth from './utils/HuaweiAuth' | @@ -2,7 +2,10 @@ import HuaweiAuth from './utils/HuaweiAuth' | ||
| 2 | import { JumpInterceptorAction, RouterJumpInterceptor, WDRouterPage } from 'wdRouter' | 2 | import { JumpInterceptorAction, RouterJumpInterceptor, WDRouterPage } from 'wdRouter' |
| 3 | import { BusinessError } from '@kit.BasicServicesKit' | 3 | import { BusinessError } from '@kit.BasicServicesKit' |
| 4 | import { router } from '@kit.ArkUI' | 4 | import { router } from '@kit.ArkUI' |
| 5 | -import { AccountManagerUtils } from 'wdKit/Index' | 5 | +import { AccountManagerUtils, SPHelper } from 'wdKit/Index' |
| 6 | +import { LoginViewModel } from './pages/login/LoginViewModel' | ||
| 7 | +import { SpConstants } from 'wdConstant/Index' | ||
| 8 | +import { ReportDeviceInfo } from './reportDeviceInfo/ReportDeviceInfo' | ||
| 6 | 9 | ||
| 7 | class LoginJumpHandler implements JumpInterceptorAction { | 10 | class LoginJumpHandler implements JumpInterceptorAction { |
| 8 | 11 | ||
| @@ -37,4 +40,14 @@ export class LoginModule { | @@ -37,4 +40,14 @@ export class LoginModule { | ||
| 37 | } | 40 | } |
| 38 | 41 | ||
| 39 | } | 42 | } |
| 43 | + | ||
| 44 | + // 启动进入主页 和 每次登录成功调用 | ||
| 45 | + static reportDeviceInfo() { | ||
| 46 | + ReportDeviceInfo.reportDeviceInfo().then((res) => { | ||
| 47 | + let nickName = res.touristNickName | ||
| 48 | + if (res.touristNickName) { | ||
| 49 | + SPHelper.default.save(SpConstants.TOURIST_NICK_NAME, res.touristNickName) | ||
| 50 | + } | ||
| 51 | + }) | ||
| 52 | + } | ||
| 40 | } | 53 | } |
| @@ -82,6 +82,30 @@ export class LoginModel { | @@ -82,6 +82,30 @@ export class LoginModel { | ||
| 82 | }) | 82 | }) |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | + // loginType 0:手机号密码 2:手机号登录 3:QQ 4:微信 5:微博 6:APPLEID 7:手机号一键登录8:账号+密码 9:华为一键登录 | ||
| 86 | + thirdPartLogin(loginType: number, otherParams: Record<string, string|number>) { | ||
| 87 | + otherParams['loginType'] = loginType | ||
| 88 | + otherParams['deviceId'] = HttpUtils.getDeviceId() | ||
| 89 | + | ||
| 90 | + return new Promise<LoginBean>((success, fail) => { | ||
| 91 | + HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), otherParams).then((data: ResponseDTO<LoginBean>) => { | ||
| 92 | + Logger.debug("LoginViewModel:success2 ", data.message) | ||
| 93 | + if (!data) { | ||
| 94 | + fail("数据为空") | ||
| 95 | + return | ||
| 96 | + } | ||
| 97 | + if (!data.data||data.code != 0) { | ||
| 98 | + fail(data.message) | ||
| 99 | + return | ||
| 100 | + } | ||
| 101 | + success(data.data) | ||
| 102 | + }, (error: Error) => { | ||
| 103 | + fail(error.message) | ||
| 104 | + Logger.debug("LoginViewModel:error2 ", error.toString()) | ||
| 105 | + }) | ||
| 106 | + }) | ||
| 107 | + } | ||
| 108 | + | ||
| 85 | // {"password":"523acd319228efde34e8a30268ee8ca5e4fc421d72affa531676e1765940d22c","phone":"13625644528","loginType":0,"oldPassword":"BA5FD74F827AF9B271FE17CADC489C36","deviceId":"60da5af6-9c59-3566-8622-8c6c00710994"} | 109 | // {"password":"523acd319228efde34e8a30268ee8ca5e4fc421d72affa531676e1765940d22c","phone":"13625644528","loginType":0,"oldPassword":"BA5FD74F827AF9B271FE17CADC489C36","deviceId":"60da5af6-9c59-3566-8622-8c6c00710994"} |
| 86 | appLoginByPassword(phone: string, loginType: number, password: string, oldPassword: string) { | 110 | appLoginByPassword(phone: string, loginType: number, password: string, oldPassword: string) { |
| 87 | let bean: Record<string, string | number> = {}; | 111 | let bean: Record<string, string | number> = {}; |
| @@ -407,14 +407,9 @@ struct LoginPage { | @@ -407,14 +407,9 @@ struct LoginPage { | ||
| 407 | 407 | ||
| 408 | queryUserDetail(){ | 408 | queryUserDetail(){ |
| 409 | this.loginViewModel.queryUserDetail().then(()=>{ | 409 | this.loginViewModel.queryUserDetail().then(()=>{ |
| 410 | - router.back({ | ||
| 411 | - url: `${WDRouterPage.getBundleInfo()}` | ||
| 412 | - } | ||
| 413 | - ) | 410 | + router.back() |
| 414 | }).catch(()=>{ | 411 | }).catch(()=>{ |
| 415 | - router.back({ | ||
| 416 | - url: `${WDRouterPage.getBundleInfo()}` | ||
| 417 | - }) | 412 | + router.back() |
| 418 | }) | 413 | }) |
| 419 | } | 414 | } |
| 420 | 415 |
| @@ -10,6 +10,7 @@ import { encryptMessage } from '../../utils/cryptoUtil' | @@ -10,6 +10,7 @@ import { encryptMessage } from '../../utils/cryptoUtil' | ||
| 10 | import { SpConstants } from 'wdConstant/Index' | 10 | import { SpConstants } from 'wdConstant/Index' |
| 11 | import { UserDetail } from 'wdBean/Index'; | 11 | import { UserDetail } from 'wdBean/Index'; |
| 12 | import { HttpUtils } from 'wdNetwork/Index' | 12 | import { HttpUtils } from 'wdNetwork/Index' |
| 13 | +import { LoginModule } from '../../LoginModule' | ||
| 13 | 14 | ||
| 14 | const TAG = "LoginViewModel" | 15 | const TAG = "LoginViewModel" |
| 15 | 16 | ||
| @@ -47,6 +48,27 @@ export class LoginViewModel { | @@ -47,6 +48,27 @@ export class LoginViewModel { | ||
| 47 | 48 | ||
| 48 | return new Promise<LoginBean>((success, fail) => { | 49 | return new Promise<LoginBean>((success, fail) => { |
| 49 | this.loginModel.appLogin(phone, loginType, verificationCode).then((data: LoginBean) => { | 50 | this.loginModel.appLogin(phone, loginType, verificationCode).then((data: LoginBean) => { |
| 51 | + this.dealWithLoginSuccess(data) | ||
| 52 | + success(data) | ||
| 53 | + }).catch((error:string) => { | ||
| 54 | + fail(error) | ||
| 55 | + }) | ||
| 56 | + }) | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + huaweiOneKeyLogin(authCode: string) { | ||
| 60 | + return new Promise<LoginBean>((success, fail) => { | ||
| 61 | + this.loginModel.thirdPartLogin(9, {"idToken": authCode}).then((data: LoginBean) => { | ||
| 62 | + this.dealWithLoginSuccess(data) | ||
| 63 | + success(data) | ||
| 64 | + }).catch((error:string) => { | ||
| 65 | + fail(error) | ||
| 66 | + }) | ||
| 67 | + }) | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + //TODO: 这里要整体改掉 | ||
| 71 | + dealWithLoginSuccess(data: LoginBean) { | ||
| 50 | SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, data.firstMark) | 72 | SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, data.firstMark) |
| 51 | SPHelper.default.saveSync(SpConstants.USER_ID, data.id) | 73 | SPHelper.default.saveSync(SpConstants.USER_ID, data.id) |
| 52 | SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken) | 74 | SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken) |
| @@ -56,11 +78,8 @@ export class LoginViewModel { | @@ -56,11 +78,8 @@ export class LoginViewModel { | ||
| 56 | SPHelper.default.saveSync(SpConstants.USER_Type, data.userType) | 78 | SPHelper.default.saveSync(SpConstants.USER_Type, data.userType) |
| 57 | SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) | 79 | SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) |
| 58 | EmitterUtils.sendEmptyEvent(EmitterEventId.LOGIN_SUCCESS) | 80 | EmitterUtils.sendEmptyEvent(EmitterEventId.LOGIN_SUCCESS) |
| 59 | - success(data) | ||
| 60 | - }).catch((error:string) => { | ||
| 61 | - fail(error) | ||
| 62 | - }) | ||
| 63 | - }) | 81 | + |
| 82 | + LoginModule.reportDeviceInfo() | ||
| 64 | } | 83 | } |
| 65 | 84 | ||
| 66 | async appLoginByPassword(phone: string, loginType: number, password: string, oldPassword: string) { | 85 | async appLoginByPassword(phone: string, loginType: number, password: string, oldPassword: string) { |
| @@ -75,15 +94,7 @@ export class LoginViewModel { | @@ -75,15 +94,7 @@ export class LoginViewModel { | ||
| 75 | let passwordNew = await this.doMd(password) | 94 | let passwordNew = await this.doMd(password) |
| 76 | Logger.debug(TAG, "PASSWORD:" + passwordNew) | 95 | Logger.debug(TAG, "PASSWORD:" + passwordNew) |
| 77 | this.loginModel.appLoginByPassword(phone, newLoginType, passwordNew, oldPassword).then((data: LoginBean) => { | 96 | this.loginModel.appLoginByPassword(phone, newLoginType, passwordNew, oldPassword).then((data: LoginBean) => { |
| 78 | - SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, data.firstMark) | ||
| 79 | - SPHelper.default.saveSync(SpConstants.USER_ID, data.id) | ||
| 80 | - SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken) | ||
| 81 | - SPHelper.default.saveSync(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, data.longTimeNoLoginMark) | ||
| 82 | - SPHelper.default.saveSync(SpConstants.USER_REFRESH_TOKEN, data.refreshToken) | ||
| 83 | - SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status) | ||
| 84 | - SPHelper.default.saveSync(SpConstants.USER_Type, data.userType) | ||
| 85 | - SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) | ||
| 86 | - EmitterUtils.sendEmptyEvent(EmitterEventId.LOGIN_SUCCESS) | 97 | + this.dealWithLoginSuccess(data) |
| 87 | success(data) | 98 | success(data) |
| 88 | }).catch((value: string) => { | 99 | }).catch((value: string) => { |
| 89 | fail(value) | 100 | fail(value) |
| @@ -219,18 +230,29 @@ export class LoginViewModel { | @@ -219,18 +230,29 @@ export class LoginViewModel { | ||
| 219 | this.loginModel.queryUserDetail().then((data: UserDetail) => { | 230 | this.loginModel.queryUserDetail().then((data: UserDetail) => { |
| 220 | //保存sp | 231 | //保存sp |
| 221 | if(data){ | 232 | if(data){ |
| 233 | + if(data.userName!=undefined){ | ||
| 222 | SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) | 234 | SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) |
| 235 | + } | ||
| 236 | + if(data.phone!=undefined){ | ||
| 223 | SPHelper.default.saveSync(SpConstants.USER_PHONE, data.phone) | 237 | SPHelper.default.saveSync(SpConstants.USER_PHONE, data.phone) |
| 224 | } | 238 | } |
| 239 | + } | ||
| 225 | if(data.userExtend){ | 240 | if(data.userExtend){ |
| 241 | + if(data.userExtend.sex!=undefined){ | ||
| 226 | SPHelper.default.saveSync(SpConstants.USER_SEX, data.userExtend.sex) | 242 | SPHelper.default.saveSync(SpConstants.USER_SEX, data.userExtend.sex) |
| 243 | + } | ||
| 244 | + if(data.userExtend.creatorId!=undefined){ | ||
| 227 | SPHelper.default.saveSync(SpConstants.USER_CREATOR_ID, data.userExtend.creatorId+"") | 245 | SPHelper.default.saveSync(SpConstants.USER_CREATOR_ID, data.userExtend.creatorId+"") |
| 246 | + } | ||
| 247 | + if(data.userExtend.headPhotoUrl!=undefined){ | ||
| 228 | SPHelper.default.saveSync(SpConstants.USER_HEAD_PHOTO_URL, data.userExtend.headPhotoUrl) | 248 | SPHelper.default.saveSync(SpConstants.USER_HEAD_PHOTO_URL, data.userExtend.headPhotoUrl) |
| 249 | + } | ||
| 250 | + if(data.userExtend.birthday!=undefined){ | ||
| 229 | SPHelper.default.saveSync(SpConstants.USER_BIRTHDAY, data.userExtend.birthday) | 251 | SPHelper.default.saveSync(SpConstants.USER_BIRTHDAY, data.userExtend.birthday) |
| 230 | } | 252 | } |
| 231 | - | 253 | + } |
| 232 | success(data) | 254 | success(data) |
| 233 | - }).catch(() => { | 255 | + }).catch((error:Error) => { |
| 234 | fail() | 256 | fail() |
| 235 | }) | 257 | }) |
| 236 | }) | 258 | }) |
| @@ -3,13 +3,30 @@ import { Params } from 'wdBean/Index' | @@ -3,13 +3,30 @@ import { Params } from 'wdBean/Index' | ||
| 3 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | 3 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' |
| 4 | import HuaweiAuth from '../../utils/HuaweiAuth' | 4 | import HuaweiAuth from '../../utils/HuaweiAuth' |
| 5 | import { BusinessError } from '@kit.BasicServicesKit' | 5 | import { BusinessError } from '@kit.BasicServicesKit' |
| 6 | -import { ToastUtils } from 'wdKit/Index' | 6 | +import { Logger, ToastUtils, CustomToast, EmitterUtils, EmitterEventId } from 'wdKit/Index' |
| 7 | +import { LoginViewModel } from './LoginViewModel' | ||
| 8 | +import {InterestsHobbiesModel} from '../../../../../../../products/phone/src/main/ets/pages/viewModel/InterestsHobbiesModel' | ||
| 9 | + | ||
| 10 | +const TAG = "OneKeyLoginPage" | ||
| 7 | 11 | ||
| 8 | @Entry | 12 | @Entry |
| 9 | @Component | 13 | @Component |
| 10 | struct OneKeyLoginPage { | 14 | struct OneKeyLoginPage { |
| 11 | anonymousPhone: string = '' | 15 | anonymousPhone: string = '' |
| 12 | @State agreeProtocol: boolean = false | 16 | @State agreeProtocol: boolean = false |
| 17 | + viewModel: LoginViewModel = new LoginViewModel() | ||
| 18 | + @State toastText:string = "" | ||
| 19 | + dialogToast: CustomDialogController = new CustomDialogController({ | ||
| 20 | + builder: CustomToast({ | ||
| 21 | + msg: this.toastText, | ||
| 22 | + }), | ||
| 23 | + autoCancel: false, | ||
| 24 | + alignment: DialogAlignment.Center, | ||
| 25 | + offset: { dx: 0, dy: -20 }, | ||
| 26 | + gridCount: 1, | ||
| 27 | + customStyle: true, | ||
| 28 | + maskColor:"#00000000" | ||
| 29 | + }) | ||
| 13 | 30 | ||
| 14 | aboutToAppear(): void { | 31 | aboutToAppear(): void { |
| 15 | this.anonymousPhone = HuaweiAuth.sharedInstance().anonymousPhone||"" | 32 | this.anonymousPhone = HuaweiAuth.sharedInstance().anonymousPhone||"" |
| @@ -44,17 +61,7 @@ struct OneKeyLoginPage { | @@ -44,17 +61,7 @@ struct OneKeyLoginPage { | ||
| 44 | if (!this.agreeProtocol) { | 61 | if (!this.agreeProtocol) { |
| 45 | return | 62 | return |
| 46 | } | 63 | } |
| 47 | - HuaweiAuth.sharedInstance().oneKeyLogin().then((authorizeCode) => { | ||
| 48 | - //TODO: 调用服务端接口登录 | ||
| 49 | - | ||
| 50 | - ToastUtils.shortToast("获取到授权code: " + authorizeCode + ",由于需要后台接口支持,暂时先跳转其他登录方式") | ||
| 51 | - setTimeout(() => { | ||
| 52 | - router.replaceUrl({url: WDRouterPage.loginPage.url()}) | ||
| 53 | - }, 3000) | ||
| 54 | - | ||
| 55 | - }).catch((error: BusinessError) => { | ||
| 56 | - | ||
| 57 | - }) | 64 | + this.requestLogin() |
| 58 | }) | 65 | }) |
| 59 | } | 66 | } |
| 60 | .padding({ left: 25, right: 25 }) | 67 | .padding({ left: 25, right: 25 }) |
| @@ -113,4 +120,47 @@ struct OneKeyLoginPage { | @@ -113,4 +120,47 @@ struct OneKeyLoginPage { | ||
| 113 | }.margin({ top: 15, right: 15 }) | 120 | }.margin({ top: 15, right: 15 }) |
| 114 | .width("100%") | 121 | .width("100%") |
| 115 | } | 122 | } |
| 123 | + | ||
| 124 | + async requestLogin() { | ||
| 125 | + try { | ||
| 126 | + let authorizeCode = await HuaweiAuth.sharedInstance().oneKeyLogin() | ||
| 127 | + | ||
| 128 | + let data = await this.viewModel.huaweiOneKeyLogin(authorizeCode) | ||
| 129 | + | ||
| 130 | + Logger.debug(TAG, "requestLogin: " + data.jwtToken) | ||
| 131 | + this.showToastTip('登录成功') | ||
| 132 | + | ||
| 133 | + ///同步兴趣tag | ||
| 134 | + let interestsModel = new InterestsHobbiesModel() | ||
| 135 | + interestsModel.updateInterests() | ||
| 136 | + this.queryUserDetail() | ||
| 137 | + EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION) | ||
| 138 | + | ||
| 139 | + } catch (error) { | ||
| 140 | + if (typeof error == "string") { | ||
| 141 | + this.showToastTip(error) | ||
| 142 | + } else { | ||
| 143 | + (error as BusinessError) | ||
| 144 | + this.showToastTip("登录失败") | ||
| 145 | + } | ||
| 146 | + } | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + showToastTip(msg:string){ | ||
| 150 | + this.toastText = msg | ||
| 151 | + this.dialogToast.open() | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + queryUserDetail(){ | ||
| 155 | + this.viewModel.queryUserDetail().then(()=>{ | ||
| 156 | + router.back({ | ||
| 157 | + url: `${WDRouterPage.getBundleInfo()}` | ||
| 158 | + } | ||
| 159 | + ) | ||
| 160 | + }).catch(()=>{ | ||
| 161 | + router.back({ | ||
| 162 | + url: `${WDRouterPage.getBundleInfo()}` | ||
| 163 | + }) | ||
| 164 | + }) | ||
| 165 | + } | ||
| 116 | } | 166 | } |
| 1 | +import { AppUtils, DeviceUtil, Logger, UserDataLocal } from 'wdKit/Index'; | ||
| 2 | +import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index'; | ||
| 3 | + | ||
| 4 | +export class ReportDeviceInfo { | ||
| 5 | + static reportDeviceInfo() { | ||
| 6 | + const userId = UserDataLocal.getUserId() || "" | ||
| 7 | + const url = HttpUrlUtils.reportDeviceInfo() | ||
| 8 | + | ||
| 9 | + let bean: Record<string, string | number> = {}; | ||
| 10 | + bean['deviceId'] = DeviceUtil.clientId() | ||
| 11 | + bean['appVersion'] = AppUtils.getAppVersionCode() | ||
| 12 | + bean['platform'] = 3 /// 1Android 2iOS | ||
| 13 | + bean['userId'] = userId | ||
| 14 | + bean['brand'] = DeviceUtil.getMarketName() | ||
| 15 | + bean['modelSystemVersion'] = DeviceUtil.getDisplayVersion() | ||
| 16 | + bean['tenancy'] = 3 ///1-视界 2-英文版 3-中文版 | ||
| 17 | + | ||
| 18 | + return new Promise<ReportDeviceInfoRes>((success, fail) => { | ||
| 19 | + HttpBizUtil.post<ResponseDTO<ReportDeviceInfoRes>>(url,bean).then((data: ResponseDTO<ReportDeviceInfoRes>) => { | ||
| 20 | + if (!data) { | ||
| 21 | + fail("数据为空") | ||
| 22 | + return | ||
| 23 | + } | ||
| 24 | + if (data.code != 0) { | ||
| 25 | + fail(data.message) | ||
| 26 | + return | ||
| 27 | + } | ||
| 28 | + success(data.data!) | ||
| 29 | + }, (error: Error) => { | ||
| 30 | + fail(error.message) | ||
| 31 | + Logger.debug("ReportDeviceInfo", error.toString()) | ||
| 32 | + }) | ||
| 33 | + }) | ||
| 34 | + | ||
| 35 | + } | ||
| 36 | +} | ||
| 37 | + | ||
| 38 | +export class ReportDeviceInfoRes { | ||
| 39 | + clean : number = 0 | ||
| 40 | + touristNickName : string = "" | ||
| 41 | +} |
| @@ -94,10 +94,9 @@ export struct WDPlayerRenderView { | @@ -94,10 +94,9 @@ export struct WDPlayerRenderView { | ||
| 94 | .renderFit(RenderFit.RESIZE_COVER) | 94 | .renderFit(RenderFit.RESIZE_COVER) |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | - // .onAreaChange(() => { | ||
| 98 | - // this.updateLayout() | ||
| 99 | - // }) | ||
| 100 | - | 97 | + .onAreaChange(() => { |
| 98 | + this.updateLayout() | ||
| 99 | + }) | ||
| 101 | .backgroundColor("#000000") | 100 | .backgroundColor("#000000") |
| 102 | 101 | ||
| 103 | // .height('100%') | 102 | // .height('100%') |
| @@ -16,12 +16,15 @@ struct ImageAndTextDetailPage { | @@ -16,12 +16,15 @@ struct ImageAndTextDetailPage { | ||
| 16 | } | 16 | } |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | - pageTransition(){ | ||
| 20 | - // 定义页面进入时的效果,从右边侧滑入 | ||
| 21 | - PageTransitionEnter({ type: RouteType.None, duration: 300 }) | 19 | + pageTransition() { |
| 20 | + // 为目标页面时,进入:从右边侧滑入,退出:是右侧划出;跳转别的页面:左侧划出,返回:左侧划入。 | ||
| 21 | + PageTransitionEnter({ type: RouteType.Push, duration: 300 }) | ||
| 22 | .slide(SlideEffect.Right) | 22 | .slide(SlideEffect.Right) |
| 23 | - // 定义页面退出时的效果,向右边侧滑出 | ||
| 24 | - PageTransitionExit({ type: RouteType.None, duration: 300 }) | 23 | + PageTransitionEnter({ type: RouteType.Pop, duration: 300 }) |
| 24 | + .slide(SlideEffect.Left) | ||
| 25 | + PageTransitionExit({ type: RouteType.Push, duration: 300 }) | ||
| 26 | + .slide(SlideEffect.Left) | ||
| 27 | + PageTransitionExit({ type: RouteType.Pop, duration: 300 }) | ||
| 25 | .slide(SlideEffect.Right) | 28 | .slide(SlideEffect.Right) |
| 26 | } | 29 | } |
| 27 | 30 |
| @@ -8,6 +8,7 @@ import router from '@ohos.router'; | @@ -8,6 +8,7 @@ import router from '@ohos.router'; | ||
| 8 | import { promptAction } from '@kit.ArkUI'; | 8 | import { promptAction } from '@kit.ArkUI'; |
| 9 | import { UpgradeTipDialog } from "./upgradePage/UpgradeTipDialog" | 9 | import { UpgradeTipDialog } from "./upgradePage/UpgradeTipDialog" |
| 10 | import { ProcessUtils } from 'wdRouter/Index'; | 10 | import { ProcessUtils } from 'wdRouter/Index'; |
| 11 | +import { StartupManager } from '../startupmanager/StartupManager'; | ||
| 11 | 12 | ||
| 12 | const TAG = 'MainPage'; | 13 | const TAG = 'MainPage'; |
| 13 | 14 | ||
| @@ -27,6 +28,8 @@ struct MainPage { | @@ -27,6 +28,8 @@ struct MainPage { | ||
| 27 | 28 | ||
| 28 | aboutToAppear() { | 29 | aboutToAppear() { |
| 29 | 30 | ||
| 31 | + StartupManager.sharedInstance().appReachMainPage() | ||
| 32 | + | ||
| 30 | this.breakpointSystem.register() | 33 | this.breakpointSystem.register() |
| 31 | 34 | ||
| 32 | let context = getContext(this) as common.UIAbilityContext | 35 | let context = getContext(this) as common.UIAbilityContext |
| @@ -18,11 +18,14 @@ struct SpacialTopicPage { | @@ -18,11 +18,14 @@ struct SpacialTopicPage { | ||
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | pageTransition() { | 20 | pageTransition() { |
| 21 | - // 定义页面进入时的效果,从右边侧滑入 | ||
| 22 | - PageTransitionEnter({ type: RouteType.None, duration: 300 }) | 21 | + // 为目标页面时,进入:从右边侧滑入,退出:是右侧划出;跳转别的页面:左侧划出,返回:左侧划入。 |
| 22 | + PageTransitionEnter({ type: RouteType.Push, duration: 300 }) | ||
| 23 | .slide(SlideEffect.Right) | 23 | .slide(SlideEffect.Right) |
| 24 | - // 定义页面退出时的效果,向右边侧滑出 | ||
| 25 | - PageTransitionExit({ type: RouteType.None, duration: 300 }) | 24 | + PageTransitionEnter({ type: RouteType.Pop, duration: 300 }) |
| 25 | + .slide(SlideEffect.Left) | ||
| 26 | + PageTransitionExit({ type: RouteType.Push, duration: 300 }) | ||
| 27 | + .slide(SlideEffect.Left) | ||
| 28 | + PageTransitionExit({ type: RouteType.Pop, duration: 300 }) | ||
| 26 | .slide(SlideEffect.Right) | 29 | .slide(SlideEffect.Right) |
| 27 | } | 30 | } |
| 28 | 31 |
| @@ -90,6 +90,9 @@ export class StartupManager { | @@ -90,6 +90,9 @@ export class StartupManager { | ||
| 90 | appReachMainPage() : Promise<void> { | 90 | appReachMainPage() : Promise<void> { |
| 91 | return new Promise((resolve) => { | 91 | return new Promise((resolve) => { |
| 92 | Logger.debug(TAG, "App 进入首页,开始其他任务初始化") | 92 | Logger.debug(TAG, "App 进入首页,开始其他任务初始化") |
| 93 | + | ||
| 94 | + LoginModule.reportDeviceInfo() | ||
| 95 | + | ||
| 93 | //TODO: | 96 | //TODO: |
| 94 | 97 | ||
| 95 | resolve() | 98 | resolve() |
| 1 | +import { insightIntent, InsightIntentExecutor } from '@kit.AbilityKit'; | ||
| 2 | +import { window } from '@kit.ArkUI'; | ||
| 3 | +import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 意图调用 | ||
| 7 | + */ | ||
| 8 | +export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | ||
| 9 | + private static readonly ViewColumn = 'ViewColumn'; | ||
| 10 | + /** | ||
| 11 | + * override 执行前台UIAbility意图 | ||
| 12 | + * | ||
| 13 | + * @param name 意图名称 | ||
| 14 | + * @param param 意图参数 | ||
| 15 | + * @param pageLoader 窗口 | ||
| 16 | + * @returns 意图调用结果 | ||
| 17 | + */ | ||
| 18 | + onExecuteInUIAbilityForegroundMode(name: string, param: Record<string, Object>, pageLoader: window.WindowStage): | ||
| 19 | + Promise<insightIntent.ExecuteResult> { | ||
| 20 | + // 根据意图名称分发处理逻辑 | ||
| 21 | + switch (name) { | ||
| 22 | + case InsightIntentExecutorImpl.ViewColumn: | ||
| 23 | + return this.jumpToView(param, pageLoader); | ||
| 24 | + default: | ||
| 25 | + break; | ||
| 26 | + } | ||
| 27 | + return Promise.resolve({ | ||
| 28 | + code: -1, | ||
| 29 | + result: { | ||
| 30 | + message: 'unknown intent' | ||
| 31 | + } | ||
| 32 | + } as insightIntent.ExecuteResult) | ||
| 33 | + } | ||
| 34 | + /** | ||
| 35 | + * 实现跳转新闻页面功能 | ||
| 36 | + * | ||
| 37 | + * @param param 意图参数 | ||
| 38 | + * @param pageLoader 窗口 | ||
| 39 | + */ | ||
| 40 | + private jumpToView(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> { | ||
| 41 | + return new Promise((resolve, reject) => { | ||
| 42 | + // TODO 实现意图调用,loadContent的入参为歌曲落地页路径,例如:pages/SongPage | ||
| 43 | + pageLoader.loadContent('pages/MainPage') | ||
| 44 | + .then(() => { | ||
| 45 | + let entityId: string = (param.items as Array<object>)?.[0]?.['entityId']; | ||
| 46 | + // TODO 调用成功的情况,此处可以打印日志 | ||
| 47 | + resolve({ | ||
| 48 | + code: 0, | ||
| 49 | + result: { | ||
| 50 | + message: 'Intent execute success' | ||
| 51 | + } | ||
| 52 | + }); | ||
| 53 | + }) | ||
| 54 | + .catch((err: BusinessError) => { | ||
| 55 | + // TODO 调用失败的情况 | ||
| 56 | + resolve({ | ||
| 57 | + code: -1, | ||
| 58 | + result: { | ||
| 59 | + message: 'Intent execute failed' | ||
| 60 | + } | ||
| 61 | + }) | ||
| 62 | + }); | ||
| 63 | + }) | ||
| 64 | + } | ||
| 65 | +} |
| 1 | +{ | ||
| 2 | + "insightIntents": [ | ||
| 3 | + { | ||
| 4 | + "intentName": "ViewColumn", | ||
| 5 | + "domain": "", | ||
| 6 | + "intentVersion": "1.0.1", | ||
| 7 | + "srcEntry": "./ets/utils/InsightIntentExecutorImpl.ets", | ||
| 8 | + "uiAbility": { | ||
| 9 | + "ability": "EntryAbility", | ||
| 10 | + "executeMode": [ | ||
| 11 | + "background", | ||
| 12 | + "foreground" | ||
| 13 | + ] | ||
| 14 | + } | ||
| 15 | + } | ||
| 16 | + ] | ||
| 17 | +} |
-
Please register or login to post a comment