自定义警告弹窗

This commit is contained in:
xiaoxiao
2025-06-13 17:32:06 +08:00
parent 8300766e5c
commit c4a3b21499
5 changed files with 147 additions and 54 deletions
@@ -1,4 +1,4 @@
import { BasicConstant, authStore } from '@itcast/basic'
import { BasicConstant, authStore,DefaultHintProWindows } from '@itcast/basic'
import { commentModel } from '../model/VideoCommentModel'
import { CommentChildView } from '../components/CommentChildView'
import { router,promptAction } from '@kit.ArkUI';
@@ -13,6 +13,31 @@ export struct VideoDetailsComment {
@Prop model:commentModel;
@Prop videoCommentUuid:string;
@State isShowMoreComment:boolean = false;
private hintWindowDialog!: CustomDialogController;
aboutToAppear(): void {
this.hintPopWindowDialog();
}
private hintPopWindowDialog() {
this.hintWindowDialog = new CustomDialogController({
builder:DefaultHintProWindows({
controller:this.hintWindowDialog,
message:'确定要删除评论?',
cancleTitleColor: '#666666',
confirmTitleColor: $r('app.color.main_color'),
selectedButton: (index:number)=>{
if (index === 1) {
this.deleteComment();
}
this.hintWindowDialog.close();
}
}),
alignment: DialogAlignment.Center,
cornerRadius:24,
backgroundColor: ('rgba(0,0,0,0.5)'),
})
}
deleteComment() {
const updateDataUrl:string = BasicConstant.deleteComment;
@@ -56,14 +81,7 @@ export struct VideoDetailsComment {
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();
}
})
this.hintWindowDialog.open()
})
} else {
Text('回复')
@@ -1,5 +1,5 @@
import { BasicConstant,ExpertData,perfactAuth,ChangeUtil,authStore,preferenceStore,LoginInfo,
logger } from '@itcast/basic'
logger,DefaultHintProWindows } from '@itcast/basic'
import { LengthMetrics, promptAction, router } from '@kit.ArkUI'
import { EditUserDataItem } from '@itcast/basic/src/main/ets/Views/EditUserDataItem'
import { PerfactInputSheet } from '@itcast/basic/src/main/ets/Views/PerfactInputSheet'
@@ -85,6 +85,7 @@ export struct PerfectUserDataComp {
private diseaseSheetDialog!:CustomDialogController;
private sexSheetDilog!:CustomDialogController;
private perfactInputSheet!:CustomDialogController;
private hintWindowDialog!: CustomDialogController;
aboutToAppear() {
this.initSexDialog();
@@ -95,6 +96,7 @@ export struct PerfectUserDataComp {
this.initCerficatePhotoDialog();
this.initDiseaseSheetDIalog();
this.handleState()
this.hintPopWindowDialog();
// logger.info("Response this.photoPath "+this.photoPath)
// 收到eventId为1的事件后执行回调函数
@@ -126,14 +128,7 @@ export struct PerfectUserDataComp {
if(this.checkInfo!=''||this.checkInfo!=null)
{
this.info=this.checkInfo
promptAction.showDialog({ title: '温馨提示', message: this.checkInfo,
buttons: [{ text: '确定', color: $r('app.color.main_color') }],
})
.then(data => {
if (data.index == 1) {
}
})
this.hintWindowDialog.open();
}
}
@@ -475,6 +470,21 @@ export struct PerfectUserDataComp {
})
}
private hintPopWindowDialog() {
this.hintWindowDialog = new CustomDialogController({
builder:DefaultHintProWindows({
controller:this.hintWindowDialog,
message:this.checkInfo,
confirmTitleColor: $r('app.color.main_color'),
selectedButton: (index:number)=>{
this.hintWindowDialog.close();
}
}),
alignment: DialogAlignment.Center,
cornerRadius:24,
backgroundColor: ('rgba(0,0,0,0.5)'),
})
}
build() {