Showing
1 changed file
with
31 additions
and
3 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,12 +208,14 @@ export struct FeedBackActivity { | @@ -201,12 +208,14 @@ 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 }) |
| 211 | + Column(){ | ||
| 204 | Text($r('app.string.submit')) | 212 | Text($r('app.string.submit')) |
| 213 | + .align(Alignment.Center) | ||
| 205 | .height(44) | 214 | .height(44) |
| 206 | - .fontColor($r('app.color.color_9E9E9E_40')) | 215 | + .width('90%') |
| 216 | + .fontColor(this.canSubmit?$r('app.color.color_9E9E9E_40'):$r('app.color.color_fff')) | ||
| 207 | .fontSize($r('app.float.font_size_18')) | 217 | .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')) | 218 | + .backgroundColor(this.canSubmit?$r('app.color.color_ED2800_99'):$r('app.color.color_EDEDED')) |
| 210 | .borderRadius(4) | 219 | .borderRadius(4) |
| 211 | .onClick(async (event: ClickEvent) => { | 220 | .onClick(async (event: ClickEvent) => { |
| 212 | if(await FastClickUtil.isMinDelayTime()){ | 221 | if(await FastClickUtil.isMinDelayTime()){ |
| @@ -214,9 +223,28 @@ export struct FeedBackActivity { | @@ -214,9 +223,28 @@ export struct FeedBackActivity { | ||
| 214 | } | 223 | } |
| 215 | this.reportCommit() | 224 | this.reportCommit() |
| 216 | }) | 225 | }) |
| 226 | + Blank().height(15).width('100%') | ||
| 227 | + } | ||
| 228 | + .height(59) | ||
| 229 | + } | ||
| 230 | + } | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + /** | ||
| 234 | + * 校验可提交状态 | ||
| 235 | + * */ | ||
| 236 | + checkSubmit(): boolean { | ||
| 237 | + | ||
| 238 | + if(StringUtils.isEmpty(this.contact) || this.contact.length < 10){ | ||
| 239 | + return false | ||
| 217 | } | 240 | } |
| 241 | + | ||
| 242 | + if(this.feedbackTypeBeans == null || this.feedbackTypeBeans.length == 0){ | ||
| 243 | + return false | ||
| 218 | } | 244 | } |
| 245 | + return true | ||
| 219 | } | 246 | } |
| 247 | + | ||
| 220 | /** | 248 | /** |
| 221 | * 请求接口数据 | 249 | * 请求接口数据 |
| 222 | * */ | 250 | * */ |
-
Please register or login to post a comment