Showing
1 changed file
with
41 additions
and
13 deletions
| @@ -19,6 +19,7 @@ const TAG = 'FeedBackActivity' | @@ -19,6 +19,7 @@ const TAG = 'FeedBackActivity' | ||
| 19 | @Entry | 19 | @Entry |
| 20 | @Component | 20 | @Component |
| 21 | export struct FeedBackActivity { | 21 | export struct FeedBackActivity { |
| 22 | + @State canSubmit: boolean = false; | ||
| 22 | @State textNumLabel: string = '0/500'; | 23 | @State textNumLabel: string = '0/500'; |
| 23 | contact: string = ""; | 24 | contact: string = ""; |
| 24 | email: string = ""; | 25 | email: string = ""; |
| @@ -59,6 +60,10 @@ export struct FeedBackActivity { | @@ -59,6 +60,10 @@ export struct FeedBackActivity { | ||
| 59 | }) { | 60 | }) { |
| 60 | Row(){ | 61 | Row(){ |
| 61 | Toggle({ type: ToggleType.Checkbox, isOn: false }) | 62 | Toggle({ type: ToggleType.Checkbox, isOn: false }) |
| 63 | + .onChange((select) => { | ||
| 64 | + feedbackTypeBean.isselect = select | ||
| 65 | + this.canSubmit = this.checkSubmit() | ||
| 66 | + }) | ||
| 62 | Text(feedbackTypeBean.classifyName) | 67 | Text(feedbackTypeBean.classifyName) |
| 63 | .fontColor($r('app.color.color_222222')) | 68 | .fontColor($r('app.color.color_222222')) |
| 64 | .fontSize($r('app.float.font_size_14')) | 69 | .fontSize($r('app.float.font_size_14')) |
| @@ -89,10 +94,12 @@ export struct FeedBackActivity { | @@ -89,10 +94,12 @@ export struct FeedBackActivity { | ||
| 89 | .padding({bottom:96}) | 94 | .padding({bottom:96}) |
| 90 | .backgroundColor($r('app.color.color_F5F5F5')) | 95 | .backgroundColor($r('app.color.color_F5F5F5')) |
| 91 | .align(Alignment.TopStart) | 96 | .align(Alignment.TopStart) |
| 97 | + .maxLength(500) | ||
| 92 | .onChange((value) => { | 98 | .onChange((value) => { |
| 93 | // Logger.debug(TAG, "onChange" + value + "/" + this.passwordContent) | 99 | // Logger.debug(TAG, "onChange" + value + "/" + this.passwordContent) |
| 94 | this.contact = value | 100 | this.contact = value |
| 95 | this.textNumLabel = value.length+"/500" | 101 | this.textNumLabel = value.length+"/500" |
| 102 | + this.canSubmit = this.checkSubmit() | ||
| 96 | }) | 103 | }) |
| 97 | GridRow({ | 104 | GridRow({ |
| 98 | columns:5, | 105 | columns:5, |
| @@ -201,22 +208,43 @@ export struct FeedBackActivity { | @@ -201,22 +208,43 @@ export struct FeedBackActivity { | ||
| 201 | .scrollBar(BarState.Off) | 208 | .scrollBar(BarState.Off) |
| 202 | .alignSelf(ItemAlign.Start) | 209 | .alignSelf(ItemAlign.Start) |
| 203 | .padding({ bottom: 44 }) | 210 | .padding({ bottom: 44 }) |
| 204 | - Text($r('app.string.submit')) | ||
| 205 | - .height(44) | ||
| 206 | - .fontColor($r('app.color.color_9E9E9E_40')) | ||
| 207 | - .fontSize($r('app.float.font_size_18')) | ||
| 208 | - .margin({ left: $r('app.float.vp_16'), right: $r('app.float.vp_16'), top: $r('app.float.vp_15') }) | ||
| 209 | - .backgroundColor($r('app.color.color_ED2800_99')) | ||
| 210 | - .borderRadius(4) | ||
| 211 | - .onClick(async (event: ClickEvent) => { | ||
| 212 | - if(await FastClickUtil.isMinDelayTime()){ | ||
| 213 | - return | ||
| 214 | - } | ||
| 215 | - this.reportCommit() | ||
| 216 | - }) | 211 | + Column(){ |
| 212 | + Text($r('app.string.submit')) | ||
| 213 | + .align(Alignment.Center) | ||
| 214 | + .height(44) | ||
| 215 | + .width('90%') | ||
| 216 | + .fontColor(this.canSubmit?$r('app.color.color_9E9E9E_40'):$r('app.color.color_fff')) | ||
| 217 | + .fontSize($r('app.float.font_size_18')) | ||
| 218 | + .backgroundColor(this.canSubmit?$r('app.color.color_ED2800_99'):$r('app.color.color_EDEDED')) | ||
| 219 | + .borderRadius(4) | ||
| 220 | + .onClick(async (event: ClickEvent) => { | ||
| 221 | + if(await FastClickUtil.isMinDelayTime()){ | ||
| 222 | + return | ||
| 223 | + } | ||
| 224 | + this.reportCommit() | ||
| 225 | + }) | ||
| 226 | + Blank().height(15).width('100%') | ||
| 227 | + } | ||
| 228 | + .height(59) | ||
| 217 | } | 229 | } |
| 218 | } | 230 | } |
| 219 | } | 231 | } |
| 232 | + | ||
| 233 | + /** | ||
| 234 | + * 校验可提交状态 | ||
| 235 | + * */ | ||
| 236 | + checkSubmit(): boolean { | ||
| 237 | + | ||
| 238 | + if(StringUtils.isEmpty(this.contact) || this.contact.length < 10){ | ||
| 239 | + return false | ||
| 240 | + } | ||
| 241 | + | ||
| 242 | + if(this.feedbackTypeBeans == null || this.feedbackTypeBeans.length == 0){ | ||
| 243 | + return false | ||
| 244 | + } | ||
| 245 | + return true | ||
| 246 | + } | ||
| 247 | + | ||
| 220 | /** | 248 | /** |
| 221 | * 请求接口数据 | 249 | * 请求接口数据 |
| 222 | * */ | 250 | * */ |
-
Please register or login to post a comment