Merge remote-tracking branch 'origin/master'

# Conflicts:
#	features/register/src/main/ets/view/LoginComp.ets
This commit is contained in:
XiuYun CHEN
2025-05-29 17:23:15 +08:00
22 changed files with 898 additions and 32 deletions
+4
View File
@@ -8,8 +8,12 @@ export { VideoMore } from './src/main/ets/pages/VideoMore'
export { VideoDetailModel } from './src/main/ets/model/VideoDetailModel'
export { VideoCommentModel,commentModel } from './src/main/ets/model/VideoCommentModel'
export { PastVideo } from './src/main/ets/pages/PastVideo';
export { VideoGandan } from './src/main/ets/pages/VideoGandan';
export { PLVMockMediaResourceData } from './src/main/ets/polyv/PLVMockMediaResourceData'
export { VideoDetailsComment } from './src/main/ets/components/VideoDetailsComment'
@@ -0,0 +1,37 @@
import { BasicConstant, authStore } from '@itcast/basic'
import { commentModel } from '../model/VideoCommentModel'
@Preview
@Component
export struct CommentChildView {
@Prop model:commentModel;
@State isShowMoreComment:boolean = false;
build() {
Column() {
Row() {
Row({ space: 10 }) {
Image(BasicConstant.urlHtml + this.model.photo)
.alt($r('app.media.userPhoto_default'))
.width(34).height(34)
.borderRadius(3.4)
Text(this.model.user_status == 1 ? this.model.name : '账号已注销')
.fontSize(16).fontColor('#333333')
.height('100%')
.alignSelf(ItemAlign.Start)
}
.margin({ left: 10, right: authStore.getUser().uuid == this.model.user_uuid ? 35 : 65 })
.layoutWeight(1)//权重自定义
.justifyContent(FlexAlign.Start)
}.width('100%').height(40).margin({top:15}).alignItems(VerticalAlign.Center)
Column() {
Text(this.model.content)
.fontSize(15).fontColor('#666666')
Text(this.model.create_date)
.margin({top:5})
.fontSize(14)
.fontColor('#999999')
}.margin({left:50}).alignItems(HorizontalAlign.Start).width('calc(100% - 70vp)')
}
}
}
@@ -66,8 +66,7 @@ export struct ItemCompVideo {
this.goPLVMediaPlayerSingleVideoPage(json.video.polyv_uuid,video_uuid)
}).catch((err: BusinessError) => {
this.goPLVMediaPlayerSingleVideoPage('','')
})
}
@@ -0,0 +1,138 @@
import { BasicConstant, authStore } from '@itcast/basic'
import { commentModel } from '../model/VideoCommentModel'
import { CommentChildView } from '../components/CommentChildView'
import { router,promptAction } from '@kit.ArkUI';
import { hdHttp, HdResponse ,logger} from '@itcast/basic/Index'
import HashMap from '@ohos.util.HashMap';
import { BusinessError,emitter } from '@kit.BasicServicesKit';
import { rcp } from '@kit.RemoteCommunicationKit';
@Preview
@Component
export struct VideoDetailsComment {
@Prop model:commentModel;
@Prop videoCommentUuid:string;
@State isShowMoreComment:boolean = false;
deleteComment() {
const updateDataUrl:string = BasicConstant.deleteComment;
const postContent = new rcp.MultipartForm({
'uuid': this.model.comment_uuid
})
const session = rcp.createSession();
session.post(updateDataUrl, postContent)
.then((response) => {
if (response.statusCode == 200) {
emitter.emit({
eventId: 250529,
priority: emitter.EventPriority.HIGH
})
promptAction.showToast({ message: '删除评论成功', duration: 1000 })
}
})
.catch((err: BusinessError) => {
console.error(`Response err: Code is ${JSON.stringify(err.code)}, message is ${JSON.stringify(err)}`);
})
}
build() {
Column() {
Row() {
Row({ space: 10 }) {
Image(BasicConstant.urlHtml + this.model.photo)
.alt($r('app.media.userPhoto_default'))
.width(40).height(40)
.borderRadius(4)
Text(this.model.user_status == 1 ? this.model.name : '账号已注销')
.fontSize(16).fontColor('#333333')
.height('100%')
.alignSelf(ItemAlign.Start)
}
.margin({ left: 10, right: authStore.getUser().uuid == this.model.user_uuid ? 35 : 65 })
.layoutWeight(1)//权重自定义
.justifyContent(FlexAlign.Start)
if (authStore.getUser().uuid == this.model.user_uuid) {
Image($r('app.media.video_comment_delete'))
.width(20).height(20).margin({right:15})
.onClick(()=>{
promptAction.showDialog({ title: '温馨提示', message: '确定要删除评论?',
buttons: [{ text: '取消', color: '#666666' }, { text: '确定', color: $r('app.color.main_color') }],
})
.then(data => {
if (data.index == 1) {
this.deleteComment();
}
})
})
} else {
Text('回复')
.textAlign(TextAlign.Center)
.width(50).height(25).margin({right:15})
.borderRadius(10)
.backgroundColor('#f4f4f4')
.borderWidth(1).borderColor($r('app.color.main_color'))
.fontSize(16).fontColor($r('app.color.main_color'))
.onClick(() => {
if (this.model.user_status === 1) {
router.pushUrl({
params:{'replyName':this.model.name,'comment_id':this.videoCommentUuid,'comment':this.model.content},
url: 'pages/VideoPage/CommentReplyPage'
})
} else {
promptAction.showToast({ message: '该评论无法回复', duration: 1000 })
}
})
}
}.width('100%').height(40).margin({top:15}).alignItems(VerticalAlign.Center)
Column() {
Text(this.model.content)
.fontSize(15).fontColor('#666666')
Text(this.model.create_date)
.margin({top:5})
.fontSize(14)
.fontColor('#999999')
}.margin({left:50}).alignItems(HorizontalAlign.Start).width('calc(100% - 70vp)')
Column() {
if (this.model.childs.length > 3) {
ForEach(this.model.childs.slice(0, this.isShowMoreComment ? this.model.childs.length : 3),
(childModels: commentModel) => {
ListItem() {
CommentChildView({model:childModels});
}
.width('100%')
})
this.dynamicFooter((isShow: boolean) => {
this.isShowMoreComment = isShow;
});
} else {
ForEach(this.model.childs, (childModels: commentModel) => {
CommentChildView({model:childModels});
})
}
}
.margin({left:50}).alignItems(HorizontalAlign.Start).width('calc(100% - 70vp)')
Divider()
.color(Color.White)
.width('100%').strokeWidth(1).margin({top:5})
}
}
// Footer构建器
@Builder
dynamicFooter(onClick: (isShow:boolean) => void ) {
Row({space:5}) {
Text(this.isShowMoreComment ? '--收起' : '--展开更多回复')
.fontColor($r('app.color.main_color'))
.fontSize(13)
Image(this.isShowMoreComment?$r('app.media.closePinglun'):$r('app.media.openPinglun'))
.width(15).height(15)
}
.width(200)
.height(30)
.justifyContent(FlexAlign.Start)
.onClick(()=>onClick(!this.isShowMoreComment))
}
}
@@ -0,0 +1,22 @@
export interface VideoCommentModel{
code:string;
data:commentModel[];
message:string;
msg:string
}
export interface commentModel{
name:string;
id:number;
create_date:string;
user_uuid:string;
parent_id:string;
comment_uuid:string;
status:number;
content:string;
examine_status:number;
childs:commentModel[];
is_parent:boolean;
photo:string;
user_status:number;
}
@@ -114,6 +114,7 @@ export struct PastVideo {
}
}, (item: string) => JSON.stringify(item))
} .width('100%')
.zIndex(2)
.height('100%').backgroundColor(Color.White)
}
if(this.typelistStatus)
@@ -155,6 +156,8 @@ export struct PastVideo {
}
}, (item: string) => JSON.stringify(item))
} .width('100%')
.zIndex(3)
.height('100%').backgroundColor(Color.White)
}
}
@@ -163,7 +163,7 @@ export struct PlayBack {
.height('100%').backgroundColor(Color.White)
}
}
.layoutWeight(1)
}
.width('100%')
.height('100%')