Showing
8 changed files
with
239 additions
and
41 deletions
| @@ -245,11 +245,11 @@ export struct MorningEveningPaperComponent { | @@ -245,11 +245,11 @@ export struct MorningEveningPaperComponent { | ||
| 245 | // rgb = ColorUtils.hsv2rgb(hsv); | 245 | // rgb = ColorUtils.hsv2rgb(hsv); |
| 246 | // this.mixedBgColor = "#" + rgb.red.toString(16) + rgb.green.toString(16) + rgb.blue.toString(16); | 246 | // this.mixedBgColor = "#" + rgb.red.toString(16) + rgb.green.toString(16) + rgb.blue.toString(16); |
| 247 | effectKit.createColorPicker(pixelMap, (err, colorPicker) => { | 247 | effectKit.createColorPicker(pixelMap, (err, colorPicker) => { |
| 248 | - let color = colorPicker.getMainColorSync(); | 248 | + let color = colorPicker.getLargestProportionColor(); |
| 249 | console.log(TAG, "compInfoBean compStyle = " + color) | 249 | console.log(TAG, "compInfoBean compStyle = " + color) |
| 250 | // color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha}) | 250 | // color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha}) |
| 251 | // 将取色器选取的color示例转换为十六进制颜色代码 | 251 | // 将取色器选取的color示例转换为十六进制颜色代码 |
| 252 | - this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16); | 252 | + this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16).padStart(2,'0') + color.green.toString(16).padStart(2,'0') + color.blue.toString(16).padStart(2,'0'); |
| 253 | console.log(TAG, "compInfoBean compStyle = " + this.mixedBgColor) | 253 | console.log(TAG, "compInfoBean compStyle = " + this.mixedBgColor) |
| 254 | }); | 254 | }); |
| 255 | } | 255 | } |
| @@ -484,7 +484,8 @@ class CommentViewModel { | @@ -484,7 +484,8 @@ class CommentViewModel { | ||
| 484 | return false | 484 | return false |
| 485 | } | 485 | } |
| 486 | 486 | ||
| 487 | - jumpToAccountPage(commentItem: commentItemModel, beforeJump: () => void = () => {}) { | 487 | + async jumpToAccountPage(commentItem: commentItemModel, beforeJump: () => void = () => {}) { |
| 488 | + let userid = await SPHelper.default.get(SpConstants.USER_ID,"") | ||
| 488 | let url = HttpUrlUtils.getOtherUserDetailDataUrl() | 489 | let url = HttpUrlUtils.getOtherUserDetailDataUrl() |
| 489 | let item : Record<string, string >= {} | 490 | let item : Record<string, string >= {} |
| 490 | 491 | ||
| @@ -510,7 +511,11 @@ class CommentViewModel { | @@ -510,7 +511,11 @@ class CommentViewModel { | ||
| 510 | beforeJump() | 511 | beforeJump() |
| 511 | if (result.data.userType === "1") { // 普通用户 | 512 | if (result.data.userType === "1") { // 普通用户 |
| 512 | let params: Record<string, string> = {'userId': result.data.userId}; | 513 | let params: Record<string, string> = {'userId': result.data.userId}; |
| 513 | - WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params) | 514 | + if (userid && userid == result.data.userId) { |
| 515 | + WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage,params) | ||
| 516 | + }else { | ||
| 517 | + WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params) | ||
| 518 | + } | ||
| 514 | } else { // 非普通用户 | 519 | } else { // 非普通用户 |
| 515 | ProcessUtils.gotoPeopleShipHomePage(result.data.creatorId) | 520 | ProcessUtils.gotoPeopleShipHomePage(result.data.creatorId) |
| 516 | } | 521 | } |
| @@ -6,22 +6,38 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter'; | @@ -6,22 +6,38 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter'; | ||
| 6 | import {AreaPickerDialog} from '../view/areaPickerDialog/AreaPickerDialog' | 6 | import {AreaPickerDialog} from '../view/areaPickerDialog/AreaPickerDialog' |
| 7 | import {EditUserInfoCustomDialog} from '../view/areaPickerDialog/EditUserInfoCustomDialog' | 7 | import {EditUserInfoCustomDialog} from '../view/areaPickerDialog/EditUserInfoCustomDialog' |
| 8 | import {EditUserSexCustomDialog} from '../view/areaPickerDialog/EditUserSexCustomDialog' | 8 | import {EditUserSexCustomDialog} from '../view/areaPickerDialog/EditUserSexCustomDialog' |
| 9 | -import { AreaListManageModel, AreaListModel } from '../../model/AreaListModel'; | 9 | +import {CustomDialogUI} from '../view/areaPickerDialog/CustomDialogUI' |
| 10 | +import {AreaListModel } from '../../model/AreaListModel'; | ||
| 10 | import router from '@ohos.router'; | 11 | import router from '@ohos.router'; |
| 11 | import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils' | 12 | import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils' |
| 12 | import { TrackConstants } from 'wdTracking/Index'; | 13 | import { TrackConstants } from 'wdTracking/Index'; |
| 13 | -import { window } from '@kit.ArkUI'; | ||
| 14 | 14 | ||
| 15 | +import { SPHelper } from 'wdKit/Index'; | ||
| 16 | +import { SpConstants } from 'wdConstant/Index'; | ||
| 17 | + | ||
| 18 | +import { abilityAccessCtrl, common, Permissions } from '@kit.AbilityKit'; | ||
| 19 | +import { picker } from '@kit.CoreFileKit'; | ||
| 20 | +import { camera, cameraPicker } from '@kit.CameraKit'; | ||
| 21 | +import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 22 | + | ||
| 23 | +let mContext = getContext(this) as common.Context; | ||
| 24 | + | ||
| 25 | +const PERMISSIONS: Array<Permissions> = [ | ||
| 26 | + 'ohos.permission.READ_IMAGEVIDEO', | ||
| 27 | + 'ohos.permission.WRITE_IMAGEVIDEO' | ||
| 28 | +]; | ||
| 15 | @Entry | 29 | @Entry |
| 16 | @Component | 30 | @Component |
| 17 | struct EditUserInfoPage { | 31 | struct EditUserInfoPage { |
| 18 | @State listData: EditListInfo[] = [] | 32 | @State listData: EditListInfo[] = [] |
| 19 | @State headerImg: string = '' | 33 | @State headerImg: string = '' |
| 20 | @State dataSource: AreaListModel[] = [] | 34 | @State dataSource: AreaListModel[] = [] |
| 21 | - @State currentUserInfo: editModel = new editModel() | 35 | + @State currentUserInfo: editModel = {} as editModel |
| 22 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 36 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 23 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | 37 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 24 | 38 | ||
| 39 | + userType:string = "1" | ||
| 40 | + | ||
| 25 | @State firstSelect:number = 0 | 41 | @State firstSelect:number = 0 |
| 26 | @State secondSelect:number = 0 | 42 | @State secondSelect:number = 0 |
| 27 | @State thirdSelect:number = 0 | 43 | @State thirdSelect:number = 0 |
| @@ -47,8 +63,8 @@ struct EditUserInfoPage { | @@ -47,8 +63,8 @@ struct EditUserInfoPage { | ||
| 47 | builder: EditUserInfoCustomDialog({ | 63 | builder: EditUserInfoCustomDialog({ |
| 48 | confirmCallback:(selectDate:Date)=>{ | 64 | confirmCallback:(selectDate:Date)=>{ |
| 49 | let mon = selectDate.getUTCMonth() as number + 1 | 65 | let mon = selectDate.getUTCMonth() as number + 1 |
| 50 | - let monStr = mon < 10? '0'+mon.toString():mon.toString(); | ||
| 51 | - let dayStr = selectDate.getUTCDate() as number < 10? '0'+selectDate.getUTCDate():selectDate.getUTCDate(); | 66 | + let monStr = mon.toString().padStart(2,'0') |
| 67 | + let dayStr = selectDate.getUTCDate().toString().padStart(2,'0') | ||
| 52 | this.currentUserInfo.userExtend.birthday = selectDate.getUTCFullYear()+'-'+monStr+'-'+dayStr; | 68 | this.currentUserInfo.userExtend.birthday = selectDate.getUTCFullYear()+'-'+monStr+'-'+dayStr; |
| 53 | this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_birthday | 69 | this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_birthday |
| 54 | this.updateEditModel() | 70 | this.updateEditModel() |
| @@ -73,7 +89,64 @@ struct EditUserInfoPage { | @@ -73,7 +89,64 @@ struct EditUserInfoPage { | ||
| 73 | closeAnimation:{duration:0} | 89 | closeAnimation:{duration:0} |
| 74 | }) | 90 | }) |
| 75 | 91 | ||
| 92 | + photoDialogController: CustomDialogController = new CustomDialogController({ | ||
| 93 | + builder: CustomDialogUI({ | ||
| 94 | + itemData:['相册','拍照'], | ||
| 95 | + confirmCallback:(index)=>{ | ||
| 96 | + if (index === 0) { | ||
| 97 | + this.getPhotoPicker() | ||
| 98 | + }else { | ||
| 99 | + this.getCamera() | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + }), | ||
| 103 | + alignment: DialogAlignment.Bottom, | ||
| 104 | + customStyle: true, | ||
| 105 | + closeAnimation:{duration:0} | ||
| 106 | + }) | ||
| 107 | + | ||
| 108 | + async getPhotoPicker(){ | ||
| 109 | + ///权限查询 | ||
| 110 | + const context = getContext(this) as common.UIAbilityContext; | ||
| 111 | + const atManager = abilityAccessCtrl.createAtManager(); | ||
| 112 | + await atManager.requestPermissionsFromUser(context, PERMISSIONS); | ||
| 113 | + | ||
| 114 | + let PhotoSelectOptions = new picker.PhotoSelectOptions(); | ||
| 115 | + PhotoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; // 过滤选择媒体文件类型 | ||
| 116 | + PhotoSelectOptions.maxSelectNumber = 1; // 选择媒体文件的最大数目 | ||
| 117 | + let photoPicker = new picker.PhotoViewPicker(); // 使用图库选择器对象前,需要先创建PhotoViewPicker实例 | ||
| 118 | + photoPicker.select(PhotoSelectOptions).then((PhotoSelectResult) => { | ||
| 119 | + if (PhotoSelectResult !== null && PhotoSelectResult !== | ||
| 120 | + undefined) { | ||
| 121 | + // 接口采用callback异步返回形式,返回PhotoSelectResult对象,故进行下一步操作前要先判断是否已经成功返回PhotoSelectResult对象了 | ||
| 122 | + this.headerImg = PhotoSelectResult['photoUris'][0] | ||
| 123 | + } | ||
| 124 | + }) | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + async getCamera(){ | ||
| 128 | + try { | ||
| 129 | + let pickerProfile: cameraPicker.PickerProfile = { | ||
| 130 | + cameraPosition: camera.CameraPosition.CAMERA_POSITION_BACK | ||
| 131 | + }; | ||
| 132 | + let pickerResult: cameraPicker.PickerResult = await cameraPicker.pick(mContext, | ||
| 133 | + [cameraPicker.PickerMediaType.PHOTO, cameraPicker.PickerMediaType.VIDEO], pickerProfile); | ||
| 134 | + if (pickerResult['resultCode'] === 0) { | ||
| 135 | + this.headerImg = pickerResult['resultUri'] | ||
| 136 | + } | ||
| 137 | + console.log("the pick pickerResult is:" + JSON.stringify(pickerResult)); | ||
| 138 | + } catch (error) { | ||
| 139 | + let err = error as BusinessError; | ||
| 140 | + console.error(`the pick call failed. error code: ${err.code}`); | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + | ||
| 76 | aboutToAppear() { | 144 | aboutToAppear() { |
| 145 | + let userType = SPHelper.default.getSync(SpConstants.USER_Type,"") as string | ||
| 146 | + if (userType && userType.length > 0) { | ||
| 147 | + this.userType = userType | ||
| 148 | + } | ||
| 149 | + | ||
| 77 | this.getAccountOwnerInfo() | 150 | this.getAccountOwnerInfo() |
| 78 | this.getAreaList() | 151 | this.getAreaList() |
| 79 | } | 152 | } |
| @@ -100,7 +173,6 @@ struct EditUserInfoPage { | @@ -100,7 +173,6 @@ struct EditUserInfoPage { | ||
| 100 | .height(84) | 173 | .height(84) |
| 101 | .borderRadius(42) | 174 | .borderRadius(42) |
| 102 | 175 | ||
| 103 | - | ||
| 104 | if (this.headerImg.length === 0){ | 176 | if (this.headerImg.length === 0){ |
| 105 | Image('') | 177 | Image('') |
| 106 | .width('84') | 178 | .width('84') |
| @@ -114,14 +186,17 @@ struct EditUserInfoPage { | @@ -114,14 +186,17 @@ struct EditUserInfoPage { | ||
| 114 | .width('30') | 186 | .width('30') |
| 115 | .height('30') | 187 | .height('30') |
| 116 | } | 188 | } |
| 117 | - }.margin({top:20,bottom:40}) | 189 | + }.margin({top:20}) |
| 190 | + .onClick(()=>{ | ||
| 191 | + this.photoDialogController.open() | ||
| 192 | + }) | ||
| 118 | 193 | ||
| 119 | ///目前不支持头像上传,暂时屏蔽 | 194 | ///目前不支持头像上传,暂时屏蔽 |
| 120 | - // Button('点击更换头像') | ||
| 121 | - // .fontColor(Color.Gray) | ||
| 122 | - // .fontSize(15) | ||
| 123 | - // .backgroundColor(Color.White) | ||
| 124 | - // .margin(20) | 195 | + Button('点击更换头像') |
| 196 | + .fontColor(Color.Gray) | ||
| 197 | + .fontSize(15) | ||
| 198 | + .backgroundColor(Color.White) | ||
| 199 | + .margin({top:10,bottom:20}) | ||
| 125 | 200 | ||
| 126 | List({}){ | 201 | List({}){ |
| 127 | ForEach(this.listData,(item:EditListInfo,index:number) =>{ | 202 | ForEach(this.listData,(item:EditListInfo,index:number) =>{ |
| @@ -226,16 +301,32 @@ struct EditUserInfoPage { | @@ -226,16 +301,32 @@ struct EditUserInfoPage { | ||
| 226 | this.getAccountOwnerInfo() | 301 | this.getAccountOwnerInfo() |
| 227 | }) | 302 | }) |
| 228 | } | 303 | } |
| 229 | - getAccountOwnerInfo(){ | ||
| 230 | - EditInfoViewModel.queryAccountOwnerInfo(1,getContext(this)).then((editModel) => { | ||
| 231 | - this.listData = [] | ||
| 232 | - if (editModel.userExtend.headPhotoUrl) { | ||
| 233 | - this.headerImg = editModel.userExtend.headPhotoUrl | ||
| 234 | - } | ||
| 235 | - this.currentUserInfo = editModel as editModel; | ||
| 236 | - this.listData.push(...EditInfoViewModel.getEditListInfo(editModel)) | ||
| 237 | - }); | 304 | + |
| 305 | + async getAccountOwnerInfo(){ | ||
| 306 | + | ||
| 307 | + if (this.userType === '1') { | ||
| 308 | + EditInfoViewModel.queryAccountOwnerInfo(getContext(this)).then((editModel) => { | ||
| 309 | + this.listData = [] | ||
| 310 | + if (editModel.userExtend?.headPhotoUrl) { | ||
| 311 | + this.headerImg = editModel.userExtend.headPhotoUrl | ||
| 312 | + } | ||
| 313 | + this.currentUserInfo = editModel as editModel; | ||
| 314 | + this.listData.push(...EditInfoViewModel.getEditListInfo(editModel)) | ||
| 315 | + }); | ||
| 316 | + }else { | ||
| 317 | + EditInfoViewModel.queryPeopleAccountOwnerInfo(getContext(this)).then((peopleItem) => { | ||
| 318 | + EditInfoViewModel.queryAccountOwnerInfo(getContext(this)).then((editM) => { | ||
| 319 | + this.listData = [] | ||
| 320 | + editM.userExtend.introduction = peopleItem.introduction | ||
| 321 | + editM.userName = peopleItem.userName | ||
| 322 | + this.headerImg = peopleItem.headPhotoUrl | ||
| 323 | + this.currentUserInfo = editM as editModel; | ||
| 324 | + this.listData.push(...EditInfoViewModel.getEditListInfo(editM)) | ||
| 325 | + }); | ||
| 326 | + }); | ||
| 327 | + } | ||
| 238 | } | 328 | } |
| 329 | + | ||
| 239 | getAreaList(){ | 330 | getAreaList(){ |
| 240 | EditInfoViewModel.getAreaList(getContext(this)).then((value) =>{ | 331 | EditInfoViewModel.getAreaList(getContext(this)).then((value) =>{ |
| 241 | this.dataSource.push(...value) | 332 | this.dataSource.push(...value) |
| @@ -68,7 +68,7 @@ struct PeopleShipHomePage { | @@ -68,7 +68,7 @@ struct PeopleShipHomePage { | ||
| 68 | Image($r('app.media.home_page_bg')) | 68 | Image($r('app.media.home_page_bg')) |
| 69 | .width('100%') | 69 | .width('100%') |
| 70 | .height('120vp') | 70 | .height('120vp') |
| 71 | - .objectFit(ImageFit.Auto) | 71 | + .objectFit(ImageFit.Fill) |
| 72 | .objectRepeat(ImageRepeat.NoRepeat) | 72 | .objectRepeat(ImageRepeat.NoRepeat) |
| 73 | .backgroundColor(Color.White) | 73 | .backgroundColor(Color.White) |
| 74 | .visibility(this.isLoading ? Visibility.None : Visibility.Visible) | 74 | .visibility(this.isLoading ? Visibility.None : Visibility.Visible) |
sight_harmony/features/wdComponent/src/main/ets/components/view/areaPickerDialog/CustomDialogUI.ets
0 → 100644
| 1 | +@CustomDialog | ||
| 2 | + | ||
| 3 | +export struct CustomDialogUI { | ||
| 4 | + itemData:string[] = [] | ||
| 5 | + controller: CustomDialogController | ||
| 6 | + confirmCallback: (selectIndex:number) => void = () => { | ||
| 7 | + } | ||
| 8 | + build() { | ||
| 9 | + Column(){ | ||
| 10 | + List({}){ | ||
| 11 | + ForEach(this.itemData,(item:string,index:number) =>{ | ||
| 12 | + ListItem(){ | ||
| 13 | + Column(){ | ||
| 14 | + Button(item,{type:ButtonType.Normal}).height(45).width('100%').fontSize(14).fontColor('#222222').backgroundColor(0xffffff) | ||
| 15 | + .onClick(()=>{ | ||
| 16 | + this.confirmCallback(index) | ||
| 17 | + this.controller.close() | ||
| 18 | + }) | ||
| 19 | + Divider() | ||
| 20 | + .color('#f5f5f5') | ||
| 21 | + .width('100%') | ||
| 22 | + .strokeWidth(1) | ||
| 23 | + } | ||
| 24 | + } | ||
| 25 | + } | ||
| 26 | + ) | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + Divider() | ||
| 30 | + .color('#f5f5f5') | ||
| 31 | + .width('100%') | ||
| 32 | + .strokeWidth(4) | ||
| 33 | + Button('取消',{type:ButtonType.Normal}).height(80).width('100%').fontSize(14).fontColor('#222222').backgroundColor(0xffffff) | ||
| 34 | + .onClick(()=>{ | ||
| 35 | + this.controller.close() | ||
| 36 | + }) | ||
| 37 | + }.height(176).width('100%').backgroundColor(Color.White) | ||
| 38 | + } | ||
| 39 | +} |
| @@ -44,8 +44,6 @@ export class EditInfoModel{ | @@ -44,8 +44,6 @@ export class EditInfoModel{ | ||
| 44 | 44 | ||
| 45 | airec:number = 0 | 45 | airec:number = 0 |
| 46 | 46 | ||
| 47 | - constructor(headPhotoUrl?:string , introduction?:string,city?:string , county?:string,birthday?:string , sex?:number,airec?:number) { | ||
| 48 | - } | ||
| 49 | } | 47 | } |
| 50 | 48 | ||
| 51 | export class editModel{ | 49 | export class editModel{ |
| @@ -53,16 +51,20 @@ export class editModel{ | @@ -53,16 +51,20 @@ export class editModel{ | ||
| 53 | 51 | ||
| 54 | userNameStatus:string = '' | 52 | userNameStatus:string = '' |
| 55 | 53 | ||
| 54 | + userType:number = 1 | ||
| 55 | + | ||
| 56 | phone:string = '' | 56 | phone:string = '' |
| 57 | 57 | ||
| 58 | + introduction:string = '' | ||
| 59 | + | ||
| 60 | + headPhotoUrl:string = '' | ||
| 61 | + | ||
| 58 | headPhotoStatus:string = '' | 62 | headPhotoStatus:string = '' |
| 59 | 63 | ||
| 60 | userExtend:EditInfoModel = new EditInfoModel() | 64 | userExtend:EditInfoModel = new EditInfoModel() |
| 61 | 65 | ||
| 62 | editDataType:number = WDEditDataModelType.WDEditDataModelType_default | 66 | editDataType:number = WDEditDataModelType.WDEditDataModelType_default |
| 63 | 67 | ||
| 64 | - constructor(userName?:string , userNameStatus?:string,phone?:string , headPhotoStatus?:string,userExtend?:EditInfoModel,editDataType?:number) { | ||
| 65 | - } | ||
| 66 | } | 68 | } |
| 67 | 69 | ||
| 68 | export interface editModelParams { | 70 | export interface editModelParams { |
| @@ -96,4 +98,29 @@ export interface editItem{ | @@ -96,4 +98,29 @@ export interface editItem{ | ||
| 96 | 98 | ||
| 97 | timestamp:number | 99 | timestamp:number |
| 98 | 100 | ||
| 101 | +} | ||
| 102 | + | ||
| 103 | + | ||
| 104 | + | ||
| 105 | +export interface peopleItem{ | ||
| 106 | + code:number | ||
| 107 | + | ||
| 108 | + data:peopleItemModel | ||
| 109 | + | ||
| 110 | + message:string | ||
| 111 | + | ||
| 112 | + success:boolean | ||
| 113 | + | ||
| 114 | + timestamp:number | ||
| 115 | + | ||
| 116 | +} | ||
| 117 | + | ||
| 118 | +export class peopleItemModel{ | ||
| 119 | + userName:string = '' | ||
| 120 | + | ||
| 121 | + introduction:string = '' | ||
| 122 | + | ||
| 123 | + headPhotoUrl:string = '' | ||
| 124 | + | ||
| 125 | + userType:number = 1 | ||
| 99 | } | 126 | } |
| @@ -21,8 +21,8 @@ import { BusinessError } from '@kit.BasicServicesKit'; | @@ -21,8 +21,8 @@ import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 21 | import ResponseCode from '@ohos.net.http'; | 21 | import ResponseCode from '@ohos.net.http'; |
| 22 | 22 | ||
| 23 | // const resourceMgs: resourceManager.ResourceManager = getContext(this).resourceManager; | 23 | // const resourceMgs: resourceManager.ResourceManager = getContext(this).resourceManager; |
| 24 | -const PIXEL_MAP_SIZE_WIDTH: number = 40; | ||
| 25 | -const PIXEL_MAP_SIZE_HEIGHT: number = 40; | 24 | +const PIXEL_MAP_SIZE_WIDTH: number = 80; |
| 25 | +const PIXEL_MAP_SIZE_HEIGHT: number = 80; | ||
| 26 | 26 | ||
| 27 | /** | 27 | /** |
| 28 | * 图片转换为PixelMap对象 | 28 | * 图片转换为PixelMap对象 |
| 1 | 1 | ||
| 2 | import { | 2 | import { |
| 3 | editItem, | 3 | editItem, |
| 4 | - EditListInfo, editModel, editModelParams, WDEditDataModelType } from '../model/EditInfoModel'; | 4 | + EditListInfo, editModel, editModelParams, |
| 5 | + peopleItem, | ||
| 6 | + peopleItemModel, | ||
| 7 | + WDEditDataModelType } from '../model/EditInfoModel'; | ||
| 5 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | 8 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 6 | import { Logger, ResourcesUtils } from 'wdKit'; | 9 | import { Logger, ResourcesUtils } from 'wdKit'; |
| 7 | import { AreaListManageModel, AreaListModel,AreaListData } from '../model/AreaListModel'; | 10 | import { AreaListManageModel, AreaListModel,AreaListData } from '../model/AreaListModel'; |
| @@ -36,19 +39,46 @@ class EditInfoViewModel { | @@ -36,19 +39,46 @@ class EditInfoViewModel { | ||
| 36 | 39 | ||
| 37 | 40 | ||
| 38 | getEditListInfo(item?:editModel):EditListInfo[]{ | 41 | getEditListInfo(item?:editModel):EditListInfo[]{ |
| 39 | - this.editListData = [ | ||
| 40 | - new EditListInfo('昵称',item&&item.userName.length > 0?item.userName:'待完善'), | ||
| 41 | - new EditListInfo('简介',item&&item.userExtend.introduction?item.userExtend.introduction:'待完善'), | ||
| 42 | - new EditListInfo('地区',item&&item.userExtend.address?item.userExtend.address:'待完善'), | ||
| 43 | - new EditListInfo('生日',item&&item.userExtend.birthday?item.userExtend.birthday:'待完善'), | ||
| 44 | - new EditListInfo('性别',item?(item.userExtend.sex === 0?'待完善':(item.userExtend.sex === 1?'男':'女')):'待完善'),] | 42 | + if (item?.userType === 1) { |
| 43 | + this.editListData = [ | ||
| 44 | + new EditListInfo('昵称',item&&item.userName.length > 0?item.userName:'待完善'), | ||
| 45 | + new EditListInfo('简介',item&&item.userExtend.introduction?item.userExtend.introduction:'待完善'), | ||
| 46 | + new EditListInfo('地区',item&&item.userExtend.address?item.userExtend.address:'待完善'), | ||
| 47 | + new EditListInfo('生日',item&&item.userExtend.birthday?item.userExtend.birthday:'待完善'), | ||
| 48 | + new EditListInfo('性别',item?(item.userExtend.sex === 0?'待完善':(item.userExtend.sex === 1?'男':'女')):'待完善'),] | ||
| 49 | + }else { | ||
| 50 | + this.editListData = [ | ||
| 51 | + new EditListInfo('昵称',item&&item.userName.length > 0?item.userName:'待完善'), | ||
| 52 | + new EditListInfo('简介',item&&item.userExtend.introduction?item.userExtend.introduction:'待完善'), | ||
| 53 | + new EditListInfo('地区',item&&item.userExtend.address?item.userExtend.address:'待完善')] | ||
| 54 | + } | ||
| 45 | return this.editListData | 55 | return this.editListData |
| 46 | } | 56 | } |
| 47 | 57 | ||
| 48 | ///1普通用户 | 58 | ///1普通用户 |
| 49 | - queryAccountOwnerInfo(userType:number, context: Context):PromiseLike<editModel>{ | 59 | + queryAccountOwnerInfo(context: Context):PromiseLike<editModel>{ |
| 50 | return new Promise(((success, error) => { | 60 | return new Promise(((success, error) => { |
| 51 | - this.BaseGetRequest(userType == 1?HttpUrlUtils.APPOINTMENT_QueryUserDetail_PATH:HttpUrlUtils.APPOINTMENT_AccountOwner_PATH).then((editDTO:editItem) =>{ | 61 | + this.BaseGetRequest(HttpUrlUtils.APPOINTMENT_QueryUserDetail_PATH).then((editDTO:editItem) =>{ |
| 62 | + if (editDTO.code == 0) { | ||
| 63 | + success(editDTO.data) | ||
| 64 | + }else { | ||
| 65 | + // success(this.GetqueryAccountOwnerLocal(context)) | ||
| 66 | + } | ||
| 67 | + }).catch((error: Error) => { | ||
| 68 | + Logger.info(TAG,'queryAccountOwnerInfo','EditInfoViewModel') | ||
| 69 | + // success(this.GetqueryAccountOwnerLocal(context)) | ||
| 70 | + }) | ||
| 71 | + })) | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + BasePeopleGetRequest(requestUrl:string){ | ||
| 75 | + requestUrl = HttpUrlUtils.getHost() + requestUrl | ||
| 76 | + return WDHttp.get<peopleItem>(requestUrl) | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + queryPeopleAccountOwnerInfo(context: Context):PromiseLike<peopleItemModel>{ | ||
| 80 | + return new Promise(((success, error) => { | ||
| 81 | + this.BasePeopleGetRequest(HttpUrlUtils.APPOINTMENT_AccountOwner_PATH).then((editDTO:peopleItem) =>{ | ||
| 52 | if (editDTO.code == 0) { | 82 | if (editDTO.code == 0) { |
| 53 | success(editDTO.data) | 83 | success(editDTO.data) |
| 54 | }else { | 84 | }else { |
| @@ -87,6 +117,12 @@ class EditInfoViewModel { | @@ -87,6 +117,12 @@ class EditInfoViewModel { | ||
| 87 | }) | 117 | }) |
| 88 | } | 118 | } |
| 89 | 119 | ||
| 120 | + getLocalAreaList(context: Context):PromiseLike<AreaListModel[]>{ | ||
| 121 | + return new Promise((success, error) => { | ||
| 122 | + success(this.getAreaListLocal(context)) | ||
| 123 | + }) | ||
| 124 | + } | ||
| 125 | + | ||
| 90 | async getAreaListLocal(context: Context): Promise<AreaListModel[]> { | 126 | async getAreaListLocal(context: Context): Promise<AreaListModel[]> { |
| 91 | Logger.info(TAG, `getBottomNavDataMock start`); | 127 | Logger.info(TAG, `getBottomNavDataMock start`); |
| 92 | let compRes: ResponseDTO<AreaListModel[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<AreaListModel[]>>(context,'areaList_data.json'); | 128 | let compRes: ResponseDTO<AreaListModel[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<AreaListModel[]>>(context,'areaList_data.json'); |
-
Please register or login to post a comment