Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
liyubing
2024-05-23 18:14:59 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
775864a58ce41f3b999f7c5e082ae779fd27ab3b
775864a5
2 parents
db47982e
4fa07df3
Merge remote-tracking branch 'origin/main'
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
239 additions
and
138 deletions
sight_harmony/commons/wdKit/Index.ets
sight_harmony/commons/wdKit/src/main/ets/pubComps/dialog/PublicDialogManager.ets
sight_harmony/commons/wdKit/src/main/ets/pubComps/dialog/PublicPopupDialogView.ets
sight_harmony/features/wdComponent/Index.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentListDialog.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/viewmodel/CommentViewModel.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/OperRowListView.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/CommentDialogView.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginPage.ets
sight_harmony/products/phone/src/main/ets/pages/view/MultiPictureDetailPageComponent.ets
sight_harmony/commons/wdKit/Index.ets
View file @
775864a
...
...
@@ -64,4 +64,7 @@ export { MpaasUpgradeCheck, UpgradeTipContent } from './src/main/ets/mpaas/Mpaas
export { TingyunAPM } from './src/main/ets/tingyunAPM/TingyunAPM'
export { FastClickUtil } from './src/main/ets/utils/FastClickUtil';
\ No newline at end of file
export { FastClickUtil } from './src/main/ets/utils/FastClickUtil';
// export { PublicPopupDialogView } from "./src/main/ets/pubComps/dialog/PublicPopupDialogView"
export { PublicDialogManager, CloseAction } from "./src/main/ets/pubComps/dialog/PublicDialogManager"
\ No newline at end of file
...
...
sight_harmony/commons/wdKit/src/main/ets/pubComps/dialog/PublicDialogManager.ets
0 → 100644
View file @
775864a
export type CloseAction = () => void
export class PublicDialogManager {
private dialogControllers: CustomDialogController[] = []
private closeActions: CloseAction[] = []
private constructor() {
}
private static manager: PublicDialogManager
static shareInstance(): PublicDialogManager {
if (!PublicDialogManager.manager) {
PublicDialogManager.manager = new PublicDialogManager()
}
return PublicDialogManager.manager
}
openDialog(dialogController: CustomDialogController, closeAction: CloseAction) {
if (!dialogController) {
return
}
dialogController.open()
this.dialogControllers.push(dialogController)
this.closeActions.push(closeAction)
}
closeDialog(dialogController: CustomDialogController) {
if (!dialogController) {
return
}
dialogController.close()
const index = this.dialogControllers.indexOf(dialogController)
if (index != -1) {
this.dialogControllers.splice(index, 1)
this.closeActions.splice(index, 1)[0]()
}
}
closeLastDialog() {
const count = this.dialogControllers.length
if (count > 0) {
this.closeDialog(this.dialogControllers[count - 1])
}
}
}
\ No newline at end of file
...
...
sight_harmony/commons/wdKit/src/main/ets/pubComps/dialog/PublicPopupDialogView.ets
0 → 100644
View file @
775864a
import { PublicDialogManager } from './PublicDialogManager'
/*
* 公共自定义弹出框,上层赋值showPopup变量,决定是否显示
*
* 当上层需要关闭,调用 PublicDialogManager.shareInstance().closeDialog(dialogController) 关闭
*
* ===> customBuilder 当前传值有问题,用不了
*/
@Component
struct PublicPopupDialogView {
// 决定是否显示变量
@Link @Watch('showPopupAction') showPopup: boolean
// 自定义弹框的 @CustomDialog
private customBuilder: Object | null = null
private autoCancel: boolean = false
dialogController: CustomDialogController = new CustomDialogController({
builder: this.customBuilder,
autoCancel: this.autoCancel,
cancel: () => {
this.showPopup = false
},
customStyle: true,
alignment: DialogAlignment.Bottom,
})
showPopupAction(val: boolean) {
if (this.showPopup) {
PublicDialogManager.shareInstance().openDialog(this.dialogController, this.closeAction)
} else {
PublicDialogManager.shareInstance().closeDialog(this.dialogController)
}
}
@Builder emptyBuild() {
}
closeAction() {
this.showPopup = false
}
build() {
this.emptyBuild()
}
}
...
...
sight_harmony/features/wdComponent/Index.ets
View file @
775864a
...
...
@@ -97,4 +97,6 @@ export { PageRepository } from './src/main/ets/repository/PageRepository';
export { MultiPictureDetailViewModel } from './src/main/ets/viewmodel/MultiPictureDetailViewModel';
export { viewBlogItemInsightIntentShare } from './src/main/ets/utils/InsightIntentShare';
\ No newline at end of file
export { viewBlogItemInsightIntentShare } from './src/main/ets/utils/InsightIntentShare';
export { CommentListDialogView } from './src/main/ets/components/comment/view/CommentListDialog';
...
...
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentComponent.ets
View file @
775864a
import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource, StringUtils } from 'wdKit/Index';
import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource,
PublicDialogManager,
StringUtils } from 'wdKit/Index';
import { commentItemModel, WDPublicUserType } from '../model/CommentModel';
import commentViewModel from '../viewmodel/CommentViewModel';
import { CommentText } from './CommentText';
...
...
@@ -40,6 +42,9 @@ export struct CommentComponent {
@Prop @Watch("parentOnReachEnd") reachEndIncreament: number = 0
reachEndLoadMoreFinish?: () => void
// 是否在弹框中
@Provide inDialog: boolean = false
// 在自定义组件即将析构销毁时将dialogControlle置空
aboutToDisappear() {
this.dialogController = null // 将dialogController置空
...
...
@@ -259,7 +264,7 @@ export struct CommentComponent {
this.publishCommentModel.totalCommentNumer = commentListModel.totalCommentNum + ''
}
if (commentListModel.list.length === 0) {
if (commentListModel.list.length === 0
&& this.allDatas.totalCount() == 0
) {
this.isComments = false
}
...
...
@@ -299,6 +304,8 @@ struct ChildCommentItem {
@ObjectLink item: commentItemModel
@Consume contentDetailData: ContentDetailDTO
@Consume inDialog: boolean
build() {
Column() {
Row() {
...
...
@@ -406,7 +413,12 @@ struct ChildCommentItem {
.margin({ left: 47 })
.alignContent(Alignment.Center)
.onClick(() => {
commentViewModel.jumpToAccountPage(this.item)
commentViewModel.jumpToAccountPage(this.item, () => {
if (this.inDialog) {
PublicDialogManager.shareInstance().closeLastDialog()
}
})
})
}
...
...
@@ -514,6 +526,8 @@ struct commentHeaderView {
@Link dialogController: CustomDialogController | null
@ObjectLink item: commentItemModel
@Consume inDialog: boolean
build() {
Column() {
Row() {
...
...
@@ -607,7 +621,12 @@ struct commentHeaderView {
.margin({ left: 8 })
.alignContent(Alignment.Center)
.onClick(() => {
commentViewModel.jumpToAccountPage(this.item)
commentViewModel.jumpToAccountPage(this.item, () => {
if (this.inDialog) {
PublicDialogManager.shareInstance().closeLastDialog()
}
})
})
}
...
...
@@ -640,6 +659,8 @@ struct commentFooterView {
@Link dialogController: CustomDialogController | null
@ObjectLink item: commentItemModel
@Consume inDialog: boolean
build() {
Row() {
...
...
@@ -710,6 +731,9 @@ struct commentFooterView {
// 未登录,跳转登录
const user_id = HttpUtils.getUserId()
if (!user_id) {
if (this.inDialog) {
PublicDialogManager.shareInstance().closeLastDialog()
}
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentListDialog.ets
View file @
775864a
import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index'
import { PublicDialogManager } from 'wdKit/Index'
import { TrackConstants } from 'wdTracking/Index'
import { OperRowListView } from '../../view/OperRowListView'
import { publishCommentModel } from '../model/PublishCommentModel'
import { CommentComponent } from './CommentComponent'
/// 评论列表弹框
@Component
export struct CommentListDialogView {
@Link @Watch('showCommentListChange') showCommentList: boolean
@Link contentDetailData: ContentDetailDTO // 详情页传
@Link pageInfo: PageInfoDTO // 专题页传
onClose?: () => void
// @Consume pageId: TrackConstants.PageName
// @Consume pageName: TrackConstants.PageName
private dialogController: CustomDialogController = new CustomDialogController({
builder: CommentListDialog({
contentDetailData: this.contentDetailData,
pageInfo: this.pageInfo,
onClose: this.onClose
}),
autoCancel: false,
customStyle: true,
alignment: DialogAlignment.Bottom,
})
showCommentListChange(val: boolean) {
if (this.showCommentList) {
PublicDialogManager.shareInstance().openDialog(this.dialogController, this.closeAction.bind(this))
} else {
PublicDialogManager.shareInstance().closeDialog(this.dialogController)
}
}
closeAction() {
this.showCommentList = false
}
build() {
}
}
@CustomDialog
export
struct CommentListDialog {
struct CommentListDialog {
/// 内部使用
@State private publishCommentModel: publishCommentModel = new publishCommentModel()
...
...
@@ -15,12 +54,12 @@ export struct CommentListDialog {
@State windowHeight: number = AppStorage.get<number>('windowHeight') || 0
/// 外部初始化
@Consume contentDetailData: ContentDetailDTO // 详情页传
@Consume pageInfo: PageInfoDTO // 专题页传
@Link contentDetailData: ContentDetailDTO // 详情页传
@Link pageInfo: PageInfoDTO // 专题页传
onClose?: () => void
aboutToAppear(): void {
if (this.contentDetailData) {
if (this.contentDetailData
.newsId
) {
if (this.contentDetailData?.openComment) {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
...
...
@@ -33,11 +72,17 @@ export struct CommentListDialog {
this.operationButtonList.push('comment')
}
if (this.contentDetailData?.openLikes && this.contentDetailData?.likesStyle != 4) {
this.operationButtonList.push('like')
}
this.operationButtonList.push('collect')
this.operationButtonList.push('share')
}
if (this.pageInfo) {
//TODO: 专题的逻辑判断
}
}
...
...
@@ -52,21 +97,26 @@ export struct CommentListDialog {
if (this.onClose) {
this.onClose()
}
}
},
inDialog: true
}).layoutWeight(1)
OperRowListView({
componentType:
1
,
componentType:
4
,
pageComponentType: 8,
showBackIcon: false,
operationButtonList: this.operationButtonList,
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
showCommentIcon: true,
styleType: 1,
inDialog: true,
dialogBeforeJumpOtherPageAction: () => {
PublicDialogManager.shareInstance().closeLastDialog()
}
})
}
.height(this.windowHeight - this.windowWidth * 9 / 16 + 'px')
.zIndex(1000)
.backgroundColor(Color.White)
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/comment/viewmodel/CommentViewModel.ets
View file @
775864a
...
...
@@ -483,7 +483,7 @@ class CommentViewModel {
return false
}
jumpToAccountPage(commentItem: commentItemModel) {
jumpToAccountPage(commentItem: commentItemModel
, beforeJump: () => void = () => {}
) {
let url = HttpUrlUtils.getOtherUserDetailDataUrl()
let item : Record<string, string >= {}
...
...
@@ -504,6 +504,7 @@ class CommentViewModel {
return
}
beforeJump()
if (result.data.userType === "1") { // 普通用户
let params: Record<string, string> = {'userId': result.data.userId};
WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/OperRowListView.ets
View file @
775864a
...
...
@@ -50,6 +50,10 @@ export struct OperRowListView {
}
private onCommentIconClick: () => void = () => {
}
@Provide inDialog: boolean = false
private dialogBeforeJumpOtherPageAction: () => void = () => {}
@Prop @Watch('onDetailUpdated') contentDetailData: ContentDetailDTO // 稿件详情
/**
* 组件样式类型,根据详情页类型传值,组件内部根据样式展现类型做判断
...
...
@@ -233,23 +237,23 @@ export struct OperRowListView {
left: 16
})
if (this.showCommentIcon) {
if (this.showCommentIcon // 页面控制开关,直播传false
&& this.contentDetailData.openComment == 1 // 内容开关
&& this.publishCommentModel?.targetId) {
Column() {
if (this.publishCommentModel?.targetId) {
CommentIconComponent({
publishCommentModel: this.publishCommentModel,
styleType: this.styleType,
contentDetail: this.contentDetailData
})
.onClick(() => {
this.onCommentIconClick()
CommentIconComponent({
publishCommentModel: this.publishCommentModel,
styleType: this.styleType,
contentDetail: this.contentDetailData
})
.onClick(() => {
this.onCommentIconClick()
console.log(JSON.stringify(this.dialogController?.open))
console.log(JSON.stringify(this.dialogController?.open))
// 评论弹框内部嵌入
!this.showBackIcon && this.dialogController?.open()
})
}
// 评论弹框内部嵌入
!this.showBackIcon && this.dialogController?.open()
})
}
.width(48)
}
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
View file @
775864a
...
...
@@ -185,7 +185,7 @@ export struct DetailPlayShortVideoPage {
index: $index,
currentIndex: $currentIndex,
showCommentList: $showCommentList,
publishCommentModel: $publishCommentModel
//
publishCommentModel: $publishCommentModel
})
this.playerViewBuilder()
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/CommentDialogView.ets
View file @
775864a
import { ContentDetailDTO } from 'wdBean/Index'
import { WindowModel } from 'wdKit/Index'
import {
publishCommentModel
} from '../../../../../wdComponent/src/main/ets/components/comment/model/PublishCommentModel'
import { CommentComponent } from '../../../../../wdComponent/src/main/ets/components/comment/view/CommentComponent'
import { OperRowListView } from '../../../../../wdComponent/src/main/ets/components/view/OperRowListView'
import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index'
import { CommentListDialogView } from 'wdComponent/Index'
@Component
export struct CommentDialogView {
@Link publishCommentModel: publishCommentModel
@Link @Watch('showCommentListChange') showCommentList: boolean
@Link index: number
@Link currentIndex: number
@Consume windowWidth: number
@Consume windowHeight: number
@Consume bottomSafeHeight: number
@Consume topSafeHeight: number
@Consume contentDetailData: ContentDetailDTO
@State fakePageInfo: PageInfoDTO = {} as PageInfoDTO
@State dialogOffsetY: number = 0 // (this.windowHeight - this.windowWidth * 9 / 16)
// @State modifier: DrawModifier = new DrawModifier();
dialogController: CustomDialogController = new CustomDialogController({
builder: DetailDialog({
publishCommentModel: $publishCommentModel,
contentDetailData: $contentDetailData,
dialogOffsetY: $dialogOffsetY,
showCommentList: $showCommentList,
windowWidth: this.windowWidth,
windowHeight: this.windowHeight
}),
autoCancel: false,
customStyle: true,
alignment: DialogAlignment.Bottom,
// onWillDismiss: (dismissDialogAction: DismissDialogAction) => {
// this.showCommentList = false
// dismissDialogAction.dismiss()
// },
// openAnimation: { duration: 0 },
// closeAnimation: { duration: 0 },
})
/**
* 问题:弹窗从底部到上动画无法添加
*/
@State @Watch("innerShowCommentChange") innerShowComment: boolean = false
showCommentListChange(val: boolean) {
if (this.showCommentList && this.index === this.currentIndex) {
this.dialogController.open()
console.log('open')
// animateTo({ duration: 10000, expectedFrameRateRange: { min: 60, max: 60, expected: 60 } }, () => {
// this.dialogOffsetY = 500
// this.modifier.invalidate()
// })
this.innerShowComment = true
} else {
this.dialogController.close()
console.log('close')
this.innerShowComment = false
}
}
build() {
innerShowCommentChange() {
this.showCommentList = this.innerShowComment
}
}
@CustomDialog
export struct DetailDialog {
controller: CustomDialogController
@Link publishCommentModel: publishCommentModel
@Link dialogOffsetY: number
@Link contentDetailData: ContentDetailDTO
@Link showCommentList: boolean
@Prop windowWidth: number
@Prop windowHeight: number
build() {
Column() {
CommentComponent({
publishCommentModel: this.publishCommentModel,
showCloseIcon: true,
fixedHeightMode: true,
onCloseClick: () => {
console.log('onCloseClick')
this.showCommentList = false
this.controller.close()
// setTimeout(() => {
//
// }, 1000)
}
}).layoutWeight(1)
OperRowListView({
componentType: 4,
pageComponentType: 8,
showBackIcon: false,
operationButtonList: ['comment', 'like', 'collect', 'share'],
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
showCommentIcon: true,
styleType: 1,
onBack: () => {
WindowModel.shared.setWindowLayoutFullScreen(false)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
}
})
}
.height(this.windowHeight - this.windowWidth * 9 / 16 + 'px')
// .margin({ top: this.dialogOffsetY + 'px' })
.zIndex(1000)
.backgroundColor(Color.White)
CommentListDialogView({
showCommentList: this.innerShowComment,
contentDetailData: this.contentDetailData,
pageInfo: this.fakePageInfo,
onClose: () => {
this.showCommentList = false
}
})
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginPage.ets
View file @
775864a
...
...
@@ -97,20 +97,16 @@ struct LoginPage {
.margin({ top: 78 })
.align(Alignment.Center)
if (this.checkCodePage) {
LoginInputComponent({
phoneContent: $phoneContent,
codeContent: $codeContent,
isSubmit: $isSubmit,
isCodeSend: $isCodeSend,
codeStateSuccess:$codeStateSuccess,
protocolState:this.protocolState,
isNeedProtocol:true
})
} else {
this.addPassword()
}
LoginInputComponent({
phoneContent: $phoneContent,
codeContent: $codeContent,
isSubmit: $isSubmit,
isCodeSend: $isCodeSend,
codeStateSuccess:$codeStateSuccess,
protocolState:this.protocolState,
isNeedProtocol:true
}).visibility(this.checkCodePage ? Visibility.Visible : Visibility.None)
this.addPassword()
Row() {
Image(this.protocolState ? $r('app.media.login_checkbox_select') : $r('app.media.login_checkbox_unselected'))
...
...
@@ -239,11 +235,7 @@ struct LoginPage {
})
RelativeContainer() {
// if (this.passwordSwitch) {
this.addPasswordInputLayout()
// } else {
// this.addPasswordInputLayout()
// }
Image(this.passwordSwitch ? $r('app.media.login_password_off') : $r('app.media.login_password_on'))
.onClick(() => {
...
...
@@ -262,6 +254,7 @@ struct LoginPage {
.height(48)
.width('100%')
}.padding({ left: 25, right: 25 }).width('100%').margin({ top: 36 })
.visibility(this.checkCodePage ? Visibility.None : Visibility.Visible)
}
...
...
sight_harmony/products/phone/src/main/ets/pages/view/MultiPictureDetailPageComponent.ets
View file @
775864a
...
...
@@ -99,7 +99,7 @@ export struct MultiPictureDetailPageComponent {
index: $index,
currentIndex: $currentIndex,
showCommentList: $showCommentList,
publishCommentModel: $publishCommentModel
//
publishCommentModel: $publishCommentModel
})
}
...
...
Please
register
or
login
to post a comment