Merge remote-tracking branch 'origin/main' into main
Showing
15 changed files
with
387 additions
and
58 deletions
| @@ -7,6 +7,7 @@ import { HostEnum, HostManager } from './HttpHostManager'; | @@ -7,6 +7,7 @@ import { HostEnum, HostManager } from './HttpHostManager'; | ||
| 7 | * 网络请求参数工具类,TODO 不对外暴露,收缩权限 | 7 | * 网络请求参数工具类,TODO 不对外暴露,收缩权限 |
| 8 | */ | 8 | */ |
| 9 | export class HttpParams { | 9 | export class HttpParams { |
| 10 | + | ||
| 10 | static buildHeaders(): Record<string, string> { | 11 | static buildHeaders(): Record<string, string> { |
| 11 | let headers: Record<string, string> = {}; | 12 | let headers: Record<string, string> = {}; |
| 12 | // 通用请求头 | 13 | // 通用请求头 |
| @@ -90,8 +91,17 @@ export class HttpParams { | @@ -90,8 +91,17 @@ export class HttpParams { | ||
| 90 | return '10000'; | 91 | return '10000'; |
| 91 | } | 92 | } |
| 92 | 93 | ||
| 93 | - private static getVersionName() { | 94 | + public static getVersionName() { |
| 94 | // TODO 读取配置 | 95 | // TODO 读取配置 |
| 95 | return '1.0.0'; | 96 | return '1.0.0'; |
| 96 | } | 97 | } |
| 98 | + | ||
| 99 | + //获取机型 | ||
| 100 | + static getPhoneModel() { | ||
| 101 | + return 'getPhoneModel' | ||
| 102 | + } | ||
| 103 | + //获取当前手机系统版本号 | ||
| 104 | + static getSystemVersion() { | ||
| 105 | + return 'getSystemVersion' | ||
| 106 | + } | ||
| 97 | } | 107 | } |
| @@ -349,6 +349,11 @@ export class HttpUrlUtils { | @@ -349,6 +349,11 @@ export class HttpUrlUtils { | ||
| 349 | */ | 349 | */ |
| 350 | static readonly HISTORY_PUSH_MESSAGE_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/push"; | 350 | static readonly HISTORY_PUSH_MESSAGE_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/push"; |
| 351 | 351 | ||
| 352 | + /** | ||
| 353 | + * 意见反馈-提交 | ||
| 354 | + */ | ||
| 355 | + static readonly FEEDBACK_COMMIT_PATH: string = "/api/rmrb-interact/interact/zh/c/user/feedBack"; | ||
| 356 | + | ||
| 352 | static getHost(): string { | 357 | static getHost(): string { |
| 353 | return HostManager.getHost(); | 358 | return HostManager.getHost(); |
| 354 | } | 359 | } |
| 1 | import { Action, ContentDTO, Params, PhotoListBean, commentInfo } from 'wdBean'; | 1 | import { Action, ContentDTO, Params, PhotoListBean, commentInfo } from 'wdBean'; |
| 2 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; | 2 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; |
| 3 | -import { Logger } from 'wdKit'; | 3 | +import { Logger, SPHelper } from 'wdKit'; |
| 4 | import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; | 4 | import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; |
| 5 | import { WDRouterRule, WDRouterPage } from '../../../../Index'; | 5 | import { WDRouterRule, WDRouterPage } from '../../../../Index'; |
| 6 | -import { ContentConstants } from 'wdConstant'; | 6 | +import { ContentConstants, SpConstants } from 'wdConstant'; |
| 7 | import { common, Want } from '@kit.AbilityKit'; | 7 | import { common, Want } from '@kit.AbilityKit'; |
| 8 | import { BusinessError } from '@kit.BasicServicesKit'; | 8 | import { BusinessError } from '@kit.BasicServicesKit'; |
| 9 | import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean'; | 9 | import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean'; |
| @@ -462,7 +462,13 @@ export class ProcessUtils { | @@ -462,7 +462,13 @@ export class ProcessUtils { | ||
| 462 | /** | 462 | /** |
| 463 | * 意见反馈 | 463 | * 意见反馈 |
| 464 | */ | 464 | */ |
| 465 | - public static gotoFeedBackActivity() { | 465 | + public static async gotoFeedBackActivity() { |
| 466 | + // 未登录,跳转登录 | ||
| 467 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 468 | + if (!user_id) { | ||
| 469 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 470 | + return | ||
| 471 | + } | ||
| 466 | let taskAction: Action = { | 472 | let taskAction: Action = { |
| 467 | type: 'JUMP_INNER_NEW_PAGE', | 473 | type: 'JUMP_INNER_NEW_PAGE', |
| 468 | params: { | 474 | params: { |
| @@ -122,7 +122,9 @@ function handleJsCallReceiveH5Data(data: Message) { | @@ -122,7 +122,9 @@ function handleJsCallReceiveH5Data(data: Message) { | ||
| 122 | width: item.width, | 122 | width: item.width, |
| 123 | height: item.height, | 123 | height: item.height, |
| 124 | picPath: item.pic, | 124 | picPath: item.pic, |
| 125 | - picDesc: '' | 125 | + picDesc: '', |
| 126 | + itemType:2, | ||
| 127 | + id:0 | ||
| 126 | } | 128 | } |
| 127 | return photo | 129 | return photo |
| 128 | }) | 130 | }) |
| @@ -174,4 +174,4 @@ export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean'; | @@ -174,4 +174,4 @@ export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean'; | ||
| 174 | 174 | ||
| 175 | 175 | ||
| 176 | 176 | ||
| 177 | -export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean'; | ||
| 177 | +export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean'; |
| @@ -4,10 +4,13 @@ | @@ -4,10 +4,13 @@ | ||
| 4 | 4 | ||
| 5 | // 【图文、图集稿件正文图片】图片信息数组 | 5 | // 【图文、图集稿件正文图片】图片信息数组 |
| 6 | export interface PhotoListBean { | 6 | export interface PhotoListBean { |
| 7 | + id: number; | ||
| 7 | height: number; | 8 | height: number; |
| 8 | width: number; | 9 | width: number; |
| 9 | picPath: string; | 10 | picPath: string; |
| 10 | picDesc: string; | 11 | picDesc: string; |
| 12 | + //1添加图片,2图片 | ||
| 13 | + itemType: number; | ||
| 11 | } | 14 | } |
| 12 | 15 | ||
| 13 | export interface InputMethodProperty { | 16 | export interface InputMethodProperty { |
| @@ -45,6 +45,10 @@ import { detailedSkeleton } from './skeleton/detailSkeleton'; | @@ -45,6 +45,10 @@ import { detailedSkeleton } from './skeleton/detailSkeleton'; | ||
| 45 | const TAG = 'DynamicDetailComponent' | 45 | const TAG = 'DynamicDetailComponent' |
| 46 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | 46 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; |
| 47 | 47 | ||
| 48 | + | ||
| 49 | +/** | ||
| 50 | + * @author wd-zsz | ||
| 51 | + * */ | ||
| 48 | // @Preview | 52 | // @Preview |
| 49 | @Component | 53 | @Component |
| 50 | export struct DynamicDetailComponent { | 54 | export struct DynamicDetailComponent { |
| 1 | -import { FeedbackTypeBean } from 'wdBean/Index'; | ||
| 2 | -import { NetworkUtil } from 'wdKit/Index'; | 1 | +import { FeedbackTypeBean, PhotoListBean } from 'wdBean/Index'; |
| 2 | +import { FastClickUtil, Logger, NetworkUtil, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'; | ||
| 3 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 3 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 4 | import { CustomTitleUI } from './reusable/CustomTitleUI' | 4 | import { CustomTitleUI } from './reusable/CustomTitleUI' |
| 5 | -import { ArrayList } from '@kit.ArkTS'; | 5 | +import { picker } from '@kit.CoreFileKit'; |
| 6 | +import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 7 | +import { router } from '@kit.ArkUI'; | ||
| 8 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 9 | +import { ProcessUtils } from 'wdRouter/Index'; | ||
| 10 | +import { HashMap } from '@kit.ArkTS'; | ||
| 11 | +import { HttpParams } from 'wdNetwork/src/main/ets/http/HttpCommonParams'; | ||
| 6 | 12 | ||
| 7 | const TAG = 'FeedBackActivity' | 13 | const TAG = 'FeedBackActivity' |
| 8 | -// 意见反馈页面 | 14 | + |
| 15 | +/** | ||
| 16 | + * 意见反馈页面 | ||
| 17 | + * @author wd-zsz | ||
| 18 | + * */ | ||
| 9 | @Entry | 19 | @Entry |
| 10 | @Component | 20 | @Component |
| 11 | export struct FeedBackActivity { | 21 | export struct FeedBackActivity { |
| 22 | + @State canSubmit: boolean = false; | ||
| 23 | + @State textNumLabel: string = '0/500'; | ||
| 24 | + contact: string = ""; | ||
| 25 | + email: string = ""; | ||
| 12 | //UI | 26 | //UI |
| 13 | scroller: Scroller = new Scroller(); | 27 | scroller: Scroller = new Scroller(); |
| 14 | 28 | ||
| 15 | @State isNetConnected: boolean = true | 29 | @State isNetConnected: boolean = true |
| 16 | 30 | ||
| 17 | @State feedbackTypeBeans: FeedbackTypeBean[] = [] as FeedbackTypeBean[] | 31 | @State feedbackTypeBeans: FeedbackTypeBean[] = [] as FeedbackTypeBean[] |
| 32 | + //添加图片 | ||
| 33 | + addPic: PhotoListBean = {itemType:1} as PhotoListBean | ||
| 34 | + @State pics: PhotoListBean[] = [this.addPic] as PhotoListBean[] | ||
| 35 | + // 选择媒体文件的最大数目 | ||
| 36 | + selectNum = 3; | ||
| 18 | 37 | ||
| 19 | async aboutToAppear() { | 38 | async aboutToAppear() { |
| 20 | await this.getContentDetailData() | 39 | await this.getContentDetailData() |
| @@ -23,97 +42,209 @@ export struct FeedBackActivity { | @@ -23,97 +42,209 @@ export struct FeedBackActivity { | ||
| 23 | build() { | 42 | build() { |
| 24 | Column() { | 43 | Column() { |
| 25 | //标题栏目 | 44 | //标题栏目 |
| 26 | - CustomTitleUI({ titleName: "意见反馈" }) | 45 | + CustomTitleUI({ titleName: $r('app.string.feedback') }) |
| 27 | Stack({ alignContent: Alignment.Bottom }) { | 46 | Stack({ alignContent: Alignment.Bottom }) { |
| 28 | Scroll(this.scroller) { | 47 | Scroll(this.scroller) { |
| 29 | Column() { | 48 | Column() { |
| 30 | - Text('请选择问题类型') | 49 | + Text($r('app.string.feedback_opinion_type')) |
| 31 | .fontColor($r('app.color.color_222222')) | 50 | .fontColor($r('app.color.color_222222')) |
| 32 | .fontSize($r('app.float.font_size_16')) | 51 | .fontSize($r('app.float.font_size_16')) |
| 33 | .fontWeight(FontWeight.Bold) | 52 | .fontWeight(FontWeight.Bold) |
| 53 | + .width('100%') | ||
| 34 | .margin({ left: $r('app.float.vp_15'), top: $r('app.float.vp_14') }) | 54 | .margin({ left: $r('app.float.vp_15'), top: $r('app.float.vp_14') }) |
| 35 | GridRow({ | 55 | GridRow({ |
| 36 | - gutter: { x: 2, y: 2 } | 56 | + columns:3, |
| 37 | }) { | 57 | }) { |
| 38 | - ForEach(this.feedbackTypeBeans, (item: FeedbackTypeBean, index: number) => { | 58 | + ForEach(this.feedbackTypeBeans, (feedbackTypeBean: FeedbackTypeBean, index: number) => { |
| 39 | GridCol({ | 59 | GridCol({ |
| 40 | - span: 12 | ||
| 41 | }) { | 60 | }) { |
| 42 | Row(){ | 61 | Row(){ |
| 43 | Toggle({ type: ToggleType.Checkbox, isOn: false }) | 62 | Toggle({ type: ToggleType.Checkbox, isOn: false }) |
| 44 | - Text(item.classifyName) | 63 | + .onChange((select) => { |
| 64 | + feedbackTypeBean.isselect = select | ||
| 65 | + this.canSubmit = this.checkSubmit() | ||
| 66 | + }) | ||
| 67 | + Text(feedbackTypeBean.classifyName) | ||
| 45 | .fontColor($r('app.color.color_222222')) | 68 | .fontColor($r('app.color.color_222222')) |
| 46 | .fontSize($r('app.float.font_size_14')) | 69 | .fontSize($r('app.float.font_size_14')) |
| 47 | - .fontWeight(FontWeight.Bold) | ||
| 48 | .margin({ left: $r('app.float.vp_4') }) | 70 | .margin({ left: $r('app.float.vp_4') }) |
| 49 | } | 71 | } |
| 50 | - .width(115) | ||
| 51 | - .height(22) | 72 | + .width($r('app.float.margin_115')) |
| 73 | + .height($r('app.float.vp_22')) | ||
| 74 | + .margin({bottom:$r('app.float.margin_16')}) | ||
| 52 | .backgroundColor($r('app.color.color_fff')) | 75 | .backgroundColor($r('app.color.color_fff')) |
| 53 | } | 76 | } |
| 54 | }) | 77 | }) |
| 55 | } | 78 | } |
| 56 | - | 79 | + .width('100%') |
| 80 | + .margin({top:$r('app.float.vp_16')}) | ||
| 57 | Blank() | 81 | Blank() |
| 58 | - .height(0.5) | ||
| 59 | - .margin({ left: $r('app.float.vp_16'), top: $r('app.float.vp_12'), right: $r('app.float.vp_16') }) | ||
| 60 | - .backgroundColor($r('app.color.color_EDEDED')) | ||
| 61 | - Text('描述您的问题') | 82 | + .height($r('app.float.margin_5')) |
| 83 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 84 | + Text($r('app.string.feedback_opinion_tv')) | ||
| 62 | .fontColor($r('app.color.color_222222')) | 85 | .fontColor($r('app.color.color_222222')) |
| 63 | .fontSize($r('app.float.font_size_16')) | 86 | .fontSize($r('app.float.font_size_16')) |
| 64 | .fontWeight(FontWeight.Bold) | 87 | .fontWeight(FontWeight.Bold) |
| 88 | + .width(CommonConstants.FULL_WIDTH) | ||
| 65 | .margin({ left: $r('app.float.vp_16'), top: $r('app.float.vp_12') }) | 89 | .margin({ left: $r('app.float.vp_16'), top: $r('app.float.vp_12') }) |
| 66 | - Stack() { | ||
| 67 | - TextInput({ placeholder: '您的宝贵意见是我们前行的动力' }) | ||
| 68 | - GridRow({ | ||
| 69 | - gutter: { x: 2, y: 2 } | ||
| 70 | - }) { | ||
| 71 | - ForEach(this.feedbackTypeBeans, (item: FeedbackTypeBean, index: number) => { | ||
| 72 | - GridCol({ | ||
| 73 | - span: 12 | ||
| 74 | - }) { | ||
| 75 | - } | ||
| 76 | - }) | 90 | + Stack({ alignContent: Alignment.BottomEnd }) { |
| 91 | + TextArea({ placeholder: $r('app.string.feedback_comments') }) | ||
| 92 | + .width(CommonConstants.FULL_WIDTH) | ||
| 93 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 94 | + .padding({bottom:96}) | ||
| 95 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 96 | + .align(Alignment.TopStart) | ||
| 97 | + .maxLength(500) | ||
| 98 | + .onChange((value) => { | ||
| 99 | + // Logger.debug(TAG, "onChange" + value + "/" + this.passwordContent) | ||
| 100 | + this.contact = value | ||
| 101 | + this.textNumLabel = value.length+"/500" | ||
| 102 | + this.canSubmit = this.checkSubmit() | ||
| 103 | + }) | ||
| 104 | + GridRow({ | ||
| 105 | + columns:5, | ||
| 106 | + }) { | ||
| 107 | + | ||
| 108 | + ForEach(this.pics, (feedbackImageItem: PhotoListBean, index: number) => { | ||
| 109 | + GridCol({ | ||
| 110 | + }) { | ||
| 111 | + if(1 == feedbackImageItem.itemType){ | ||
| 112 | + Image($r('app.media.feekback_add')) | ||
| 113 | + .width(60) | ||
| 114 | + .height(60) | ||
| 115 | + .onClick(async (event: ClickEvent) => { | ||
| 116 | + if(await FastClickUtil.isMinDelayTime()){ | ||
| 117 | + return | ||
| 118 | + } | ||
| 119 | + this.callFilePickerSelectImage(); | ||
| 120 | + }) | ||
| 121 | + }else{ | ||
| 122 | + Stack({alignContent: Alignment.TopEnd}) { | ||
| 123 | + Image(feedbackImageItem.picPath) | ||
| 124 | + .width(60) | ||
| 125 | + .height(60) | ||
| 126 | + .borderRadius($r('app.float.margin_1')) | ||
| 127 | + .onClick(async (event: ClickEvent) => { | ||
| 128 | + if(await FastClickUtil.isMinDelayTime()){ | ||
| 129 | + return | ||
| 130 | + } | ||
| 131 | + //查看图片 fixme 去除添加按钮 | ||
| 132 | + ProcessUtils.gotoMultiPictureListPage(this.pics, index) | ||
| 133 | + }) | ||
| 134 | + Image($r('app.media.icon_feekback_delete')) | ||
| 135 | + .width(24) | ||
| 136 | + .height(24) | ||
| 137 | + .borderRadius($r('app.float.margin_1')) | ||
| 138 | + .onClick(async (event: ClickEvent) => { | ||
| 139 | + if(await FastClickUtil.isMinDelayTime()){ | ||
| 140 | + return | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + let temp: PhotoListBean[] = [] as PhotoListBean[] | ||
| 144 | + temp.length = this.pics.length - 1; | ||
| 145 | + let tempIndex = 0; | ||
| 146 | + for (let index = 0; index < this.pics.length; index++) { | ||
| 147 | + const element = this.pics[index]; | ||
| 148 | + if(!StringUtils.isEmpty(element.picPath) && element.id != feedbackImageItem.id){ | ||
| 149 | + temp[tempIndex] = element; | ||
| 150 | + tempIndex = tempIndex+1 | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + if(tempIndex < 3){ | ||
| 154 | + temp[tempIndex] = this.addPic | ||
| 155 | + } | ||
| 156 | + this.pics = temp | ||
| 157 | + }) | ||
| 158 | + } | ||
| 159 | + .width(60) | ||
| 160 | + .height(60) | ||
| 161 | + } | ||
| 162 | + } | ||
| 163 | + }) | ||
| 164 | + } | ||
| 165 | + .margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_12'),left: $r('app.float.vp_12')}) | ||
| 166 | + Text(this.textNumLabel) | ||
| 167 | + .margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_11')}) | ||
| 77 | } | 168 | } |
| 169 | + .height(200) | ||
| 170 | + .width('90%') | ||
| 171 | + .margin({ top: $r('app.float.vp_12') }) | ||
| 172 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 173 | + .borderRadius(4) | ||
| 174 | + | ||
| 175 | + | ||
| 78 | 176 | ||
| 79 | - Text('0/500') | ||
| 80 | - } | ||
| 81 | - .height(200) | ||
| 82 | - .width('100%') | ||
| 83 | - .margin({ left: $r('app.float.vp_16'), top: $r('app.float.vp_12'), right: $r('app.float.vp_16') }) | ||
| 84 | - .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 85 | - .borderRadius(4) | ||
| 86 | 177 | ||
| 87 | - Text('期待您留下联系方式,我们将提供更好的服务') | 178 | + Text($r('app.string.feedback_email')) |
| 88 | .fontColor($r('app.color.color_222222')) | 179 | .fontColor($r('app.color.color_222222')) |
| 89 | .fontSize($r('app.float.font_size_14')) | 180 | .fontSize($r('app.float.font_size_14')) |
| 90 | .fontWeight(FontWeight.Bold) | 181 | .fontWeight(FontWeight.Bold) |
| 182 | + .width('100%') | ||
| 91 | .margin({ left: $r('app.float.vp_16'), top: $r('app.float.margin_24') }) | 183 | .margin({ left: $r('app.float.vp_16'), top: $r('app.float.margin_24') }) |
| 92 | Row() { | 184 | Row() { |
| 93 | - Text('电话或者邮箱') | 185 | + Text($r('app.string.feedback_mail')) |
| 94 | .fontColor($r('app.color.color_222222')) | 186 | .fontColor($r('app.color.color_222222')) |
| 95 | .fontSize($r('app.float.font_size_14')) | 187 | .fontSize($r('app.float.font_size_14')) |
| 96 | .fontWeight(FontWeight.Bold) | 188 | .fontWeight(FontWeight.Bold) |
| 97 | - .margin({ left: $r('app.float.vp_12') }) | ||
| 98 | - TextInput({ placeholder: '请输入电话或者邮箱' }) | 189 | + TextInput({ placeholder: $r('app.string.feedback_hideemail') }) |
| 190 | + .width(CommonConstants.FULL_WIDTH) | ||
| 191 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 192 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 193 | + .onChange((value) => { | ||
| 194 | + // Logger.debug(TAG, "onChange" + value + "/" + this.passwordContent) | ||
| 195 | + this.email = value | ||
| 196 | + }) | ||
| 99 | } | 197 | } |
| 100 | .height(44) | 198 | .height(44) |
| 101 | - .margin({ left: $r('app.float.vp_16'), right: $r('app.float.vp_12'), top: $r('app.float.margin_16') }) | 199 | + .width('90%') |
| 102 | .backgroundColor($r('app.color.color_F5F5F5')) | 200 | .backgroundColor($r('app.color.color_F5F5F5')) |
| 201 | + .margin({top: $r('app.float.margin_16') }) | ||
| 103 | .borderRadius(4) | 202 | .borderRadius(4) |
| 203 | + Blank().layoutWeight(1) | ||
| 104 | } | 204 | } |
| 105 | } | 205 | } |
| 106 | - | ||
| 107 | - Text($r('app.string.submit')) | ||
| 108 | - .height(44) | ||
| 109 | - .fontColor($r('app.color.color_9E9E9E_40')) | ||
| 110 | - .fontSize($r('app.float.font_size_18')) | ||
| 111 | - .margin({ left: $r('app.float.vp_16'), right: $r('app.float.vp_16'), top: $r('app.float.vp_15') }) | ||
| 112 | - .backgroundColor($r('app.color.color_ED2800_99')) | ||
| 113 | - .borderRadius(4) | 206 | + .width(CommonConstants.FULL_WIDTH) |
| 207 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 208 | + .scrollBar(BarState.Off) | ||
| 209 | + .alignSelf(ItemAlign.Start) | ||
| 210 | + .padding({ bottom: 44 }) | ||
| 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) | ||
| 114 | } | 229 | } |
| 115 | } | 230 | } |
| 116 | } | 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 | + | ||
| 117 | /** | 248 | /** |
| 118 | * 请求接口数据 | 249 | * 请求接口数据 |
| 119 | * */ | 250 | * */ |
| @@ -126,4 +257,117 @@ export struct FeedBackActivity { | @@ -126,4 +257,117 @@ export struct FeedBackActivity { | ||
| 126 | console.log('请求失败',JSON.stringify(exception)) | 257 | console.log('请求失败',JSON.stringify(exception)) |
| 127 | } | 258 | } |
| 128 | } | 259 | } |
| 260 | + | ||
| 261 | + /** | ||
| 262 | + * 拉起picker选择图片/视频 | ||
| 263 | + */ | ||
| 264 | + async callFilePickerSelectImage(): Promise<void> { // async 用于申明一个 function 是异步的 | ||
| 265 | + let array: string[]; | ||
| 266 | + try { | ||
| 267 | + // 设置photoPicker的参数 | ||
| 268 | + let PhotoSelectOptions = new picker.PhotoSelectOptions(); | ||
| 269 | + PhotoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; // 过滤选择媒体文件类型 | ||
| 270 | + PhotoSelectOptions.maxSelectNumber = this.selectNum; // 选择媒体文件的最大数目 | ||
| 271 | + let mediaFlag = false; | ||
| 272 | + let photoPicker = new picker.PhotoViewPicker(); // 使用图库选择器对象前,需要先创建PhotoViewPicker实例 | ||
| 273 | + photoPicker.select(PhotoSelectOptions).then((PhotoSelectResult) => { | ||
| 274 | + Logger.info(TAG, 'PhotoViewPicker.select successfully, PhotoSelectResult uri: ' + JSON.stringify(PhotoSelectResult)); // 日志中记录成功信息 | ||
| 275 | + if (PhotoSelectResult !== null && PhotoSelectResult !== undefined) { // 接口采用callback异步返回形式,返回PhotoSelectResult对象,故进行下一步操作前要先判断是否已经成功返回PhotoSelectResult对象了 | ||
| 276 | + | ||
| 277 | + // PhotoSelectResult为返回的结果集。 | ||
| 278 | + // 其中包含Array<string>类型的photoUris,为返回图库选择后的媒体文件的uri数组;还包含boolean类型的isOriginalPhoto,指示返回图库选择后的媒体文件是否为原图。 | ||
| 279 | + // 声明变量array,其取值为PhotoSelectResult中的数组。 | ||
| 280 | + array = PhotoSelectResult['photoUris']; | ||
| 281 | + let startIndex = this.pics.length-1; | ||
| 282 | + let totalLen = this.pics.length+array.length; | ||
| 283 | + if(totalLen > 3){ | ||
| 284 | + totalLen = 3 | ||
| 285 | + } | ||
| 286 | + this.pics.length = totalLen; | ||
| 287 | + | ||
| 288 | + array.forEach((value) => { | ||
| 289 | + let pic: PhotoListBean = {itemType:2,picPath:value} as PhotoListBean | ||
| 290 | + pic.id = startIndex | ||
| 291 | + this.pics[startIndex] = pic | ||
| 292 | + startIndex = startIndex+1; | ||
| 293 | + mediaFlag = true; | ||
| 294 | + Logger.info(TAG, `select image/video uri: ${value}`); | ||
| 295 | + }) | ||
| 296 | + if(this.pics.length<3){ | ||
| 297 | + this.addPic.id = startIndex | ||
| 298 | + this.pics[this.pics.length-1]=this.addPic; | ||
| 299 | + } | ||
| 300 | + } | ||
| 301 | + if (mediaFlag) { | ||
| 302 | + this.getFilenameByUriForMedia(array); | ||
| 303 | + } | ||
| 304 | + }) | ||
| 305 | + .catch((err: BusinessError) => { | ||
| 306 | + Logger.error(TAG, 'PhotoViewPicker.select failed with err: ' + JSON.stringify(err)); | ||
| 307 | + }); | ||
| 308 | + } catch (err) { | ||
| 309 | + Logger.error(TAG, 'PhotoViewPicker failed with err: ' + err); | ||
| 310 | + } | ||
| 311 | + } | ||
| 312 | + | ||
| 313 | + async getFilenameByUriForMedia(myUris: string[]) { | ||
| 314 | + router.pushUrl({ | ||
| 315 | + url: 'pages/ViewMedia', | ||
| 316 | + params: { | ||
| 317 | + uris: myUris | ||
| 318 | + } | ||
| 319 | + }, router.RouterMode.Standard); | ||
| 320 | + } | ||
| 321 | + | ||
| 322 | + //提交 | ||
| 323 | + async reportCommit(){ | ||
| 324 | + //问题类型必选 | ||
| 325 | + let selectType = "" | ||
| 326 | + this.feedbackTypeBeans.forEach((value) => { | ||
| 327 | + if(value.isselect){ | ||
| 328 | + selectType = selectType+"," | ||
| 329 | + } | ||
| 330 | + }) | ||
| 331 | + if(!StringUtils.isEmpty(selectType)){ | ||
| 332 | + selectType = selectType.substring(0,selectType.length-1) | ||
| 333 | + }else{ | ||
| 334 | + // | ||
| 335 | + ToastUtils.shortToast($r('app.string.feedback_opinion_type')) | ||
| 336 | + return | ||
| 337 | + } | ||
| 338 | + //内容必填 | ||
| 339 | + if(StringUtils.isEmpty(this.contact) || this.contact.length < 10 || this.contact.length>500){ | ||
| 340 | + ToastUtils.shortToast($r('app.string.res_feedback_commentsFail')) | ||
| 341 | + return | ||
| 342 | + } | ||
| 343 | + | ||
| 344 | + try { | ||
| 345 | + let map: HashMap<String,String> = {} as HashMap<String,String> | ||
| 346 | + //反馈内容 | ||
| 347 | + map.set("content", this.contact); | ||
| 348 | + //投诉类型 id | ||
| 349 | + map.set("classifyFlagIds", selectType); | ||
| 350 | + if(!StringUtils.isEmpty(this.email)){ | ||
| 351 | + //邮箱 | ||
| 352 | + map.set("userContact", this.email); | ||
| 353 | + } | ||
| 354 | + //用户名称 | ||
| 355 | + if (!StringUtils.isEmpty(UserDataLocal.getUserName())) { | ||
| 356 | + map.set("userName", UserDataLocal.getUserName()); | ||
| 357 | + } | ||
| 358 | + //设备 | ||
| 359 | + map.set("appVersion", "V" + HttpParams.getVersionName()); | ||
| 360 | + map.set("appDevice", "harmony" + HttpParams.getSystemVersion() + " " + HttpParams.getPhoneModel()); | ||
| 361 | + // //投诉图片 | ||
| 362 | + // if (imageUrl.size() > 0) { | ||
| 363 | + // String[] str = imageUrl.toArray(new String[imageUrl.size()]); | ||
| 364 | + // map.set("imageUrls", str); | ||
| 365 | + // } | ||
| 366 | + await MultiPictureDetailViewModel.feedBackCommit(map) | ||
| 367 | + | ||
| 368 | + } catch (exception) { | ||
| 369 | + console.log('请求失败',JSON.stringify(exception)) | ||
| 370 | + } | ||
| 371 | + } | ||
| 372 | + | ||
| 129 | } | 373 | } |
| @@ -68,7 +68,9 @@ export struct Card19Component { | @@ -68,7 +68,9 @@ export struct Card19Component { | ||
| 68 | width: item.weight, | 68 | width: item.weight, |
| 69 | height: item.height, | 69 | height: item.height, |
| 70 | picPath: item.fullUrl||item.url, | 70 | picPath: item.fullUrl||item.url, |
| 71 | - picDesc: '' | 71 | + picDesc: '', |
| 72 | + itemType:2, | ||
| 73 | + id:0 | ||
| 72 | } | 74 | } |
| 73 | return photo | 75 | return photo |
| 74 | }) | 76 | }) |
| @@ -3,7 +3,7 @@ import router from '@ohos.router' | @@ -3,7 +3,7 @@ import router from '@ohos.router' | ||
| 3 | @Component | 3 | @Component |
| 4 | export struct CustomTitleUI { | 4 | export struct CustomTitleUI { |
| 5 | imgBack:boolean = true | 5 | imgBack:boolean = true |
| 6 | - titleName:string = "默认标题" | 6 | + titleName:ResourceStr = "默认标题" |
| 7 | 7 | ||
| 8 | build() { | 8 | build() { |
| 9 | RelativeContainer() { | 9 | RelativeContainer() { |
| 1 | import { Logger } from 'wdKit'; | 1 | import { Logger } from 'wdKit'; |
| 2 | -import { ResponseDTO } from 'wdNetwork'; | 2 | +import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 3 | +import { HashMap } from '@kit.ArkTS'; | ||
| 3 | import { ContentDetailDTO, | 4 | import { ContentDetailDTO, |
| 4 | batchLikeAndCollectParams, | 5 | batchLikeAndCollectParams, |
| 5 | batchLikeAndCollectResult, | 6 | batchLikeAndCollectResult, |
| @@ -156,4 +157,17 @@ export class MultiPictureDetailViewModel { | @@ -156,4 +157,17 @@ export class MultiPictureDetailViewModel { | ||
| 156 | }) | 157 | }) |
| 157 | }) | 158 | }) |
| 158 | } | 159 | } |
| 160 | + | ||
| 161 | + static async feedBackCommit(params:HashMap<String,String>): Promise<ResponseDTO> { | ||
| 162 | + return new Promise<ResponseDTO>((success, error) => { | ||
| 163 | + Logger.info(TAG, `fetchDetailData start`); | ||
| 164 | + WDHttp.post(HttpUrlUtils.getHost() + HttpUrlUtils.FEEDBACK_COMMIT_PATH,params).then((resDTO: ResponseDTO) => { | ||
| 165 | + | ||
| 166 | + success(resDTO); | ||
| 167 | + }).catch((err: Error) => { | ||
| 168 | + Logger.error(TAG, `fetchDetailData catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 169 | + error(err); | ||
| 170 | + }) | ||
| 171 | + }) | ||
| 172 | + } | ||
| 159 | } | 173 | } |
| @@ -67,5 +67,40 @@ | @@ -67,5 +67,40 @@ | ||
| 67 | "name": "feedback", | 67 | "name": "feedback", |
| 68 | "value": "意见反馈" | 68 | "value": "意见反馈" |
| 69 | } | 69 | } |
| 70 | + , | ||
| 71 | + { | ||
| 72 | + "name": "res_feedback_commentsFail", | ||
| 73 | + "value": "请输入 10-500 个字以内" | ||
| 74 | + } | ||
| 75 | + , | ||
| 76 | + { | ||
| 77 | + "name": "feedback_opinion_type", | ||
| 78 | + "value": "请选择问题类型" | ||
| 79 | + } | ||
| 80 | + , | ||
| 81 | + { | ||
| 82 | + "name": "feedback_comments", | ||
| 83 | + "value": "您的宝贵意见是我们前行的动力" | ||
| 84 | + } | ||
| 85 | + , | ||
| 86 | + { | ||
| 87 | + "name": "feedback_opinion_tv", | ||
| 88 | + "value": "描述您的问题" | ||
| 89 | + } | ||
| 90 | + , | ||
| 91 | + { | ||
| 92 | + "name": "feedback_email", | ||
| 93 | + "value": "期待您留下联系方式,我们将提供更好的服务" | ||
| 94 | + } | ||
| 95 | + , | ||
| 96 | + { | ||
| 97 | + "name": "feedback_mail", | ||
| 98 | + "value": "电话或者邮箱" | ||
| 99 | + } | ||
| 100 | + , | ||
| 101 | + { | ||
| 102 | + "name": "feedback_hideemail", | ||
| 103 | + "value": "请输入电话或者邮箱" | ||
| 104 | + } | ||
| 70 | ] | 105 | ] |
| 71 | } | 106 | } |
1.95 KB
-
Please register or login to post a comment