张善主

fix(toast):电子报toast样式调整

... ... @@ -9,7 +9,7 @@ import font from '@ohos.font';
import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog';
import { RMCalendarBean } from './calendar/RMCalendarBean';
import { newsSkeleton } from './skeleton/newsSkeleton';
import { Logger, ToastUtils, NetworkUtil } from 'wdKit/Index';
import { Logger, ToastUtils, NetworkUtil, CustomToast } from 'wdKit/Index';
import { TrackingContent,TrackConstants, TrackingButton } from 'wdTracking/Index';
import { WDShare } from 'wdShare/Index';
import { window } from '@kit.ArkUI';
... ... @@ -36,6 +36,25 @@ export struct ENewspaperPageComponent {
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State ratio: string = '100%'
@State toastText:ResourceStr = ""
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
bgColor:$r("app.color.color_B3000000"),
opacityValue:1,
fontSizeValue:"25lpx",
lineHeightValue:"36lpx",
msg: this.toastText,
}),
autoCancel: false,
alignment: DialogAlignment.Center,
customStyle: true,
maskColor:"#00000000"
})
showToastTip(msg:ResourceStr){
this.toastText = msg
this.dialogToast.open()
}
//watch监听报纸页码回调
onCurrentPageNumUpdated(): void {
console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)
... ... @@ -323,7 +342,7 @@ export struct ENewspaperPageComponent {
.id('e_newspaper_page_num')
.onClick((event: ClickEvent) => {
if(!NetworkUtil.isNetConnected()){
ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000)
this.showToastTip('网络出小差了,请检查网络后重试')
return
}
if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
... ... @@ -334,7 +353,7 @@ export struct ENewspaperPageComponent {
this.pageDialogController.close()
}
}else {
ToastUtils.showToast('暂无数据', 1000)
this.showToastTip('暂无数据')
}
})
... ... @@ -362,7 +381,7 @@ export struct ENewspaperPageComponent {
.id('e_newspaper_read')
.onClick((event: ClickEvent) => {
if(!NetworkUtil.isNetConnected()){
ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000)
this.showToastTip('网络出小差了,请检查网络后重试')
return
}
if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
... ... @@ -376,7 +395,7 @@ export struct ENewspaperPageComponent {
'currentNumber':this.swiperIndex,
})
}else {
ToastUtils.showToast('暂无数据', 1000)
this.showToastTip('暂无数据')
}
})
}
... ... @@ -414,7 +433,7 @@ export struct ENewspaperPageComponent {
let listBean = await NewspaperViewModel.getNewspaperList(this.calendarDate, this.picWidth + 'x' + this.picHeight)
this.newspaperListBean = listBean;
} else {
ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000)
this.showToastTip('网络出小差了,请检查网络后重试')
}
} catch (exception) {
... ...