Showing
1 changed file
with
25 additions
and
6 deletions
| @@ -9,7 +9,7 @@ import font from '@ohos.font'; | @@ -9,7 +9,7 @@ import font from '@ohos.font'; | ||
| 9 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'; | 9 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'; |
| 10 | import { RMCalendarBean } from './calendar/RMCalendarBean'; | 10 | import { RMCalendarBean } from './calendar/RMCalendarBean'; |
| 11 | import { newsSkeleton } from './skeleton/newsSkeleton'; | 11 | import { newsSkeleton } from './skeleton/newsSkeleton'; |
| 12 | -import { Logger, ToastUtils, NetworkUtil } from 'wdKit/Index'; | 12 | +import { Logger, ToastUtils, NetworkUtil, CustomToast } from 'wdKit/Index'; |
| 13 | import { TrackingContent,TrackConstants, TrackingButton } from 'wdTracking/Index'; | 13 | import { TrackingContent,TrackConstants, TrackingButton } from 'wdTracking/Index'; |
| 14 | import { WDShare } from 'wdShare/Index'; | 14 | import { WDShare } from 'wdShare/Index'; |
| 15 | import { window } from '@kit.ArkUI'; | 15 | import { window } from '@kit.ArkUI'; |
| @@ -36,6 +36,25 @@ export struct ENewspaperPageComponent { | @@ -36,6 +36,25 @@ export struct ENewspaperPageComponent { | ||
| 36 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 36 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 37 | @State ratio: string = '100%' | 37 | @State ratio: string = '100%' |
| 38 | 38 | ||
| 39 | + @State toastText:ResourceStr = "" | ||
| 40 | + dialogToast: CustomDialogController = new CustomDialogController({ | ||
| 41 | + builder: CustomToast({ | ||
| 42 | + bgColor:$r("app.color.color_B3000000"), | ||
| 43 | + opacityValue:1, | ||
| 44 | + fontSizeValue:"25lpx", | ||
| 45 | + lineHeightValue:"36lpx", | ||
| 46 | + msg: this.toastText, | ||
| 47 | + }), | ||
| 48 | + autoCancel: false, | ||
| 49 | + alignment: DialogAlignment.Center, | ||
| 50 | + customStyle: true, | ||
| 51 | + maskColor:"#00000000" | ||
| 52 | + }) | ||
| 53 | + | ||
| 54 | + showToastTip(msg:ResourceStr){ | ||
| 55 | + this.toastText = msg | ||
| 56 | + this.dialogToast.open() | ||
| 57 | + } | ||
| 39 | //watch监听报纸页码回调 | 58 | //watch监听报纸页码回调 |
| 40 | onCurrentPageNumUpdated(): void { | 59 | onCurrentPageNumUpdated(): void { |
| 41 | console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum) | 60 | console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum) |
| @@ -323,7 +342,7 @@ export struct ENewspaperPageComponent { | @@ -323,7 +342,7 @@ export struct ENewspaperPageComponent { | ||
| 323 | .id('e_newspaper_page_num') | 342 | .id('e_newspaper_page_num') |
| 324 | .onClick((event: ClickEvent) => { | 343 | .onClick((event: ClickEvent) => { |
| 325 | if(!NetworkUtil.isNetConnected()){ | 344 | if(!NetworkUtil.isNetConnected()){ |
| 326 | - ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | 345 | + this.showToastTip('网络出小差了,请检查网络后重试') |
| 327 | return | 346 | return |
| 328 | } | 347 | } |
| 329 | if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { | 348 | if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { |
| @@ -334,7 +353,7 @@ export struct ENewspaperPageComponent { | @@ -334,7 +353,7 @@ export struct ENewspaperPageComponent { | ||
| 334 | this.pageDialogController.close() | 353 | this.pageDialogController.close() |
| 335 | } | 354 | } |
| 336 | }else { | 355 | }else { |
| 337 | - ToastUtils.showToast('暂无数据', 1000) | 356 | + this.showToastTip('暂无数据') |
| 338 | } | 357 | } |
| 339 | }) | 358 | }) |
| 340 | 359 | ||
| @@ -362,7 +381,7 @@ export struct ENewspaperPageComponent { | @@ -362,7 +381,7 @@ export struct ENewspaperPageComponent { | ||
| 362 | .id('e_newspaper_read') | 381 | .id('e_newspaper_read') |
| 363 | .onClick((event: ClickEvent) => { | 382 | .onClick((event: ClickEvent) => { |
| 364 | if(!NetworkUtil.isNetConnected()){ | 383 | if(!NetworkUtil.isNetConnected()){ |
| 365 | - ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | 384 | + this.showToastTip('网络出小差了,请检查网络后重试') |
| 366 | return | 385 | return |
| 367 | } | 386 | } |
| 368 | if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { | 387 | if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { |
| @@ -376,7 +395,7 @@ export struct ENewspaperPageComponent { | @@ -376,7 +395,7 @@ export struct ENewspaperPageComponent { | ||
| 376 | 'currentNumber':this.swiperIndex, | 395 | 'currentNumber':this.swiperIndex, |
| 377 | }) | 396 | }) |
| 378 | }else { | 397 | }else { |
| 379 | - ToastUtils.showToast('暂无数据', 1000) | 398 | + this.showToastTip('暂无数据') |
| 380 | } | 399 | } |
| 381 | }) | 400 | }) |
| 382 | } | 401 | } |
| @@ -414,7 +433,7 @@ export struct ENewspaperPageComponent { | @@ -414,7 +433,7 @@ export struct ENewspaperPageComponent { | ||
| 414 | let listBean = await NewspaperViewModel.getNewspaperList(this.calendarDate, this.picWidth + 'x' + this.picHeight) | 433 | let listBean = await NewspaperViewModel.getNewspaperList(this.calendarDate, this.picWidth + 'x' + this.picHeight) |
| 415 | this.newspaperListBean = listBean; | 434 | this.newspaperListBean = listBean; |
| 416 | } else { | 435 | } else { |
| 417 | - ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | 436 | + this.showToastTip('网络出小差了,请检查网络后重试') |
| 418 | } | 437 | } |
| 419 | } catch (exception) { | 438 | } catch (exception) { |
| 420 | 439 |
-
Please register or login to post a comment