张善主

fix(toast):意见反馈toast样式调整

@@ -3,10 +3,13 @@ export struct CustomToast { @@ -3,10 +3,13 @@ export struct CustomToast {
3 public static LENGTH_LONG = 4000; 3 public static LENGTH_LONG = 4000;
4 public static LENGTH_SHORT = 2000; 4 public static LENGTH_SHORT = 2000;
5 5
6 - @State msg: string = "" 6 + @State msg: ResourceStr = ""
7 @State duration: number = CustomToast.LENGTH_SHORT 7 @State duration: number = CustomToast.LENGTH_SHORT
8 @State bgBorderRadius: number = 10 8 @State bgBorderRadius: number = 10
9 - 9 + opacityValue: number = 0.7
  10 + bgColor: ResourceColor = $r("app.color.black")
  11 + fontSizeValue :number | string | Resource = "27lpx"
  12 + lineHeightValue :number | string | Resource = "38lpx"
10 controller: CustomDialogController 13 controller: CustomDialogController
11 14
12 dismiss: () => void = () => { 15 dismiss: () => void = () => {
@@ -27,13 +30,13 @@ export struct CustomToast { @@ -27,13 +30,13 @@ export struct CustomToast {
27 Text(this.msg) 30 Text(this.msg)
28 .fontWeight(FontWeight.Regular) 31 .fontWeight(FontWeight.Regular)
29 .fontColor($r('app.color.white')) 32 .fontColor($r('app.color.white'))
30 - .fontSize("27lpx")  
31 - .lineHeight("38lpx") 33 + .fontSize(this.fontSizeValue)
  34 + .lineHeight(this.lineHeightValue)
32 .textAlign(TextAlign.Center) 35 .textAlign(TextAlign.Center)
33 }.borderRadius(`${this.bgBorderRadius}lpx`) 36 }.borderRadius(`${this.bgBorderRadius}lpx`)
34 .constraintSize({maxWidth:"86%"}) 37 .constraintSize({maxWidth:"86%"})
35 .padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"}) 38 .padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"})
36 - .backgroundColor($r("app.color.black"))  
37 - .opacity(0.7) 39 + .backgroundColor(this.bgColor)
  40 + .opacity(this.opacityValue)
38 } 41 }
39 } 42 }
1 import { FeedBackParams, FeedbackTypeBean, PhotoListBean } from 'wdBean/Index'; 1 import { FeedBackParams, FeedbackTypeBean, PhotoListBean } from 'wdBean/Index';
2 import { AppUtils, 2 import { AppUtils,
  3 + CustomToast,
3 DateTimeUtils, 4 DateTimeUtils,
4 DeviceUtil, 5 DeviceUtil,
5 - FastClickUtil, Logger, NetworkUtil, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'; 6 + FastClickUtil, Logger, NetworkUtil, StringUtils, UserDataLocal } from 'wdKit/Index';
6 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 7 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
7 import { CustomTitleUI } from './reusable/CustomTitleUI' 8 import { CustomTitleUI } from './reusable/CustomTitleUI'
8 import { picker } from '@kit.CoreFileKit'; 9 import { picker } from '@kit.CoreFileKit';
@@ -38,6 +39,21 @@ export struct FeedBackActivity { @@ -38,6 +39,21 @@ export struct FeedBackActivity {
38 addPic: PhotoListBean = {itemType:1} as PhotoListBean 39 addPic: PhotoListBean = {itemType:1} as PhotoListBean
39 @State pics: PhotoListBean[] = [this.addPic] as PhotoListBean[] 40 @State pics: PhotoListBean[] = [this.addPic] as PhotoListBean[]
40 41
  42 + @State toastText:ResourceStr = ""
  43 + dialogToast: CustomDialogController = new CustomDialogController({
  44 + builder: CustomToast({
  45 + bgColor:$r("app.color.color_B3000000"),
  46 + opacityValue:1,
  47 + fontSizeValue:"25lpx",
  48 + lineHeightValue:"36lpx",
  49 + msg: this.toastText,
  50 + }),
  51 + autoCancel: false,
  52 + alignment: DialogAlignment.Center,
  53 + customStyle: true,
  54 + maskColor:"#00000000"
  55 + })
  56 +
41 async aboutToAppear() { 57 async aboutToAppear() {
42 await this.getContentDetailData() 58 await this.getContentDetailData()
43 } 59 }
@@ -124,7 +140,7 @@ export struct FeedBackActivity { @@ -124,7 +140,7 @@ export struct FeedBackActivity {
124 if(value.length> 500){ 140 if(value.length> 500){
125 //隐藏键盘 141 //隐藏键盘
126 inputMethod.getController().stopInputSession(); 142 inputMethod.getController().stopInputSession();
127 - ToastUtils.shortToast($r('app.string.res_feedback_commentsFail')) 143 + this.showToastTip($r('app.string.res_feedback_commentsFail'))
128 // Logger.debug(TAG, "onChange > 500 " + value) 144 // Logger.debug(TAG, "onChange > 500 " + value)
129 this.editValue = {classifyName:value.substring(0,500)} as FeedbackTypeBean 145 this.editValue = {classifyName:value.substring(0,500)} as FeedbackTypeBean
130 }else{ 146 }else{
@@ -409,13 +425,13 @@ export struct FeedBackActivity { @@ -409,13 +425,13 @@ export struct FeedBackActivity {
409 }) 425 })
410 }else{ 426 }else{
411 // 427 //
412 - ToastUtils.shortToast($r('app.string.feedback_opinion_type')) 428 + this.showToastTip($r('app.string.feedback_opinion_type'))
413 TrackingButton.click('feedbackPageSubmitFeedback',TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage) 429 TrackingButton.click('feedbackPageSubmitFeedback',TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage)
414 return 430 return
415 } 431 }
416 //内容必填 432 //内容必填
417 if(StringUtils.isEmpty(this.editValue.classifyName) || this.editValue.classifyName.length < 10 || this.editValue.classifyName.length>500){ 433 if(StringUtils.isEmpty(this.editValue.classifyName) || this.editValue.classifyName.length < 10 || this.editValue.classifyName.length>500){
418 - ToastUtils.shortToast($r('app.string.res_feedback_commentsFail')) 434 + this.showToastTip($r('app.string.res_feedback_commentsFail'))
419 return 435 return
420 } 436 }
421 437
@@ -458,4 +474,9 @@ export struct FeedBackActivity { @@ -458,4 +474,9 @@ export struct FeedBackActivity {
458 TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000)) 474 TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000))
459 475
460 } 476 }
  477 +
  478 + showToastTip(msg:ResourceStr){
  479 + this.toastText = msg
  480 + this.dialogToast.open()
  481 + }
461 } 482 }
@@ -157,6 +157,10 @@ @@ -157,6 +157,10 @@
157 "value": "#0D000000" 157 "value": "#0D000000"
158 }, 158 },
159 { 159 {
  160 + "name": "color_B3000000",
  161 + "value": "#B3000000"
  162 + },
  163 + {
160 "name": "res_color_general_000000_30", 164 "name": "res_color_general_000000_30",
161 "value": "#4D000000" 165 "value": "#4D000000"
162 } 166 }