wuyanan

ref |> 调整直播详情预约/取消预约toast样式

1 import font from '@ohos.font' 1 import font from '@ohos.font'
2 import { ContentDetailDTO } from 'wdBean/Index' 2 import { ContentDetailDTO } from 'wdBean/Index'
3 -import { DateTimeUtils, StringUtils, ToastUtils } from 'wdKit/Index' 3 +import { CustomToast, DateTimeUtils, StringUtils, ToastUtils } from 'wdKit/Index'
4 import { LiveViewModel } from '../../viewModel/LiveViewModel' 4 import { LiveViewModel } from '../../viewModel/LiveViewModel'
5 import { HttpUtils } from 'wdNetwork/Index' 5 import { HttpUtils } from 'wdNetwork/Index'
6 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' 6 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
@@ -22,6 +22,24 @@ export struct LiveCountdownComponent { @@ -22,6 +22,24 @@ export struct LiveCountdownComponent {
22 liveViewModel: LiveViewModel = new LiveViewModel() 22 liveViewModel: LiveViewModel = new LiveViewModel()
23 pageParam: ParamType = {} 23 pageParam: ParamType = {}
24 24
  25 + @State toastText: ResourceStr = ""
  26 + dialogToast: CustomDialogController = new CustomDialogController({
  27 + builder: CustomToast({
  28 + bgColor: 0xB3000000,
  29 + opacityValue: 1,
  30 + msg: this.toastText,
  31 + }),
  32 + autoCancel: false,
  33 + alignment: DialogAlignment.Center,
  34 + customStyle: true,
  35 + maskColor: "#00000000"
  36 + })
  37 +
  38 + showToastTip(msg: ResourceStr) {
  39 + this.toastText = msg
  40 + this.dialogToast.open()
  41 + }
  42 +
25 aboutToAppear(): void { 43 aboutToAppear(): void {
26 //注册字体 44 //注册字体
27 font.registerFont({ 45 font.registerFont({
@@ -187,11 +205,13 @@ export struct LiveCountdownComponent { @@ -187,11 +205,13 @@ export struct LiveCountdownComponent {
187 if (data.success) { 205 if (data.success) {
188 this.isAppointmentLive = !this.isAppointmentLive 206 this.isAppointmentLive = !this.isAppointmentLive
189 if (this.isAppointmentLive) { 207 if (this.isAppointmentLive) {
190 - ToastUtils.showToast('预约成功', 1000) 208 + // ToastUtils.showToast('预约成功', 1000)
  209 + this.showToastTip('预约成功')
191 TrackingContent.subscribeClick(true, TrackConstants.PageName.Live_Detail, 210 TrackingContent.subscribeClick(true, TrackConstants.PageName.Live_Detail,
192 TrackConstants.PageName.Live_Detail, this.pageParam) 211 TrackConstants.PageName.Live_Detail, this.pageParam)
193 } else { 212 } else {
194 - ToastUtils.showToast('取消预约成功', 1000) 213 + // ToastUtils.showToast('取消预约成功', 1000)
  214 + this.showToastTip('取消预约成功')
195 TrackingContent.subscribeClick(false, TrackConstants.PageName.Live_Detail, 215 TrackingContent.subscribeClick(false, TrackConstants.PageName.Live_Detail,
196 TrackConstants.PageName.Live_Detail, this.pageParam) 216 TrackConstants.PageName.Live_Detail, this.pageParam)
197 } 217 }