Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
wangliang_wd
2024-04-09 17:41:55 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c90d1fb084cdc6a9c8b2e43809110530d3677aa9
c90d1fb0
1 parent
7f8a5006
feat:优化个人信息更新
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
39 deletions
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/EditUserInfoPage.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/areaPickerDialog/AreaPickerDialog.ets
sight_harmony/features/wdComponent/src/main/ets/model/EditInfoModel.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/EditInfoViewModel.ets
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
View file @
c90d1fb
...
...
@@ -104,6 +104,10 @@ export class HttpUrlUtils {
*/
static readonly APPOINTMENT_editUserDetail1_PATH: string = "/api/rmrb-user-center/user/zh/c/completeUserInfo";
/**
* 资料编辑 地区拉取
*/
static readonly APPOINTMENT_userArea_PATH: string = "/api/rmrb-content-center/c/service/sys-area/treeselect";
/**
/**
* 个人中心 关注列表详情
*/
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/EditUserInfoPage.ets
View file @
c90d1fb
...
...
@@ -17,8 +17,11 @@ struct EditUserInfoPage {
dialogController: CustomDialogController = new CustomDialogController({
builder: AreaPickerDialog({dataSource:this.dataSource,
confirmCallback:(area:string)=>{
this.currentUserInfo.userExtend.city = area;
confirmCallback:(province:string,city:string,county:string,address:string)=>{
this.currentUserInfo.userExtend.province = province;
this.currentUserInfo.userExtend.city = city;
this.currentUserInfo.userExtend.county = county;
this.currentUserInfo.userExtend.address = address;
this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_region
this.updateEditModel()
}
...
...
@@ -100,6 +103,8 @@ struct EditUserInfoPage {
.width('100%')
.onClick(()=>{
if (i === 1){
let params: editModelParams = {
editContent: this.currentUserInfo.userName
}
...
...
@@ -163,7 +168,7 @@ struct EditUserInfoPage {
updateEditModel(){
this.listData = []
this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo))
this
.updateUserInfo(this.currentUserInfo)
EditInfoViewModel
.updateUserInfo(this.currentUserInfo)
}
getAccountOwnerInfo(){
EditInfoViewModel.queryAccountOwnerInfo(1,getContext(this)).then((editModel) => {
...
...
@@ -178,25 +183,4 @@ struct EditUserInfoPage {
this.dataSource.push(...value)
})
}
updateUserInfo(item?:editModel){
// if (item.editDataType == WDEditDataModelType.WDEditDataModelType_head) {
// } else if (item.editDataType == WDEditDataModelType.WDEditDataModelType_nickname) {
// let params: editModelParams = { userName: item.userName }
// EditInfoViewModel.updateUserInfo(params)
// }
// else if (item.editDataType == WDEditDataModelType.WDEditDataModelType_intro) {
// let params: editModelParams = { introduction: item.userExtend.introduction }
// EditInfoViewModel.updateUserInfo(params)
// } else if (item.editDataType == WDEditDataModelType.WDEditDataModelType_sex) {
// let params: editModelParams = { sex: item.userExtend.sex.toString() }
// EditInfoViewModel.updateUserInfo(params)
// } else if (item.editDataType == WDEditDataModelType.WDEditDataModelType_birthday) {
// let params: editModelParams = { birthday: item.userExtend.birthday }
// EditInfoViewModel.updateUserInfo(params)
// } else if (item.editDataType == WDEditDataModelType.WDEditDataModelType_region) {
// let params: editModelParams = { county: item.userExtend.county }
// EditInfoViewModel.updateUserInfo(params)
// }
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/areaPickerDialog/AreaPickerDialog.ets
View file @
c90d1fb
...
...
@@ -13,7 +13,7 @@ export struct AreaPickerDialog {
title: string = '地区选择'
@Provide dataSource: AreaListModel[] = []
result: JSON[] = [];
confirmCallback: (
area
:string) => void = () => {
confirmCallback: (
province:string,city:string,county:string,address
:string) => void = () => {
}
build() {
...
...
@@ -37,7 +37,7 @@ export struct AreaPickerDialog {
Button('确定',{type:ButtonType.Normal})
.onClick(()=> {
this.controller.close()
this.confirmCallback(this.currentFirst.label+this.currentSecondBean.label+this.currentThirdBean.label);
this.confirmCallback(this.currentFirst.label
,this.currentSecondBean.label,this.currentThirdBean.label,this.currentFirst.label
+this.currentSecondBean.label+this.currentThirdBean.label);
})
.backgroundColor(0xffffff)
.fontColor(Color.Blue)
...
...
sight_harmony/features/wdComponent/src/main/ets/model/EditInfoModel.ets
View file @
c90d1fb
...
...
@@ -29,10 +29,14 @@ export class EditInfoModel{
headPhotoUrl:string = ''
//简介
introduction:string = ''
//
城市
//
省
city:string = ''
//地区
//市
province:string = ''
//区
county:string = ''
//地址
address:string = ''
//生日
birthday:string = ''
//性别
...
...
@@ -55,9 +59,9 @@ export class editModel{
userExtend:EditInfoModel = new EditInfoModel()
editDataType:
WDEditDataModelType
= WDEditDataModelType.WDEditDataModelType_default
editDataType:
number
= WDEditDataModelType.WDEditDataModelType_default
constructor(userName?:string , userNameStatus?:string,phone?:string , headPhotoStatus?:string,userExtend?:EditInfoModel,editDataType?:
WDEditDataModelType
) {
constructor(userName?:string , userNameStatus?:string,phone?:string , headPhotoStatus?:string,userExtend?:EditInfoModel,editDataType?:
number
) {
}
}
...
...
@@ -72,6 +76,7 @@ export interface editModelParams {
city?:string;
county?:string;
province?:string;
address?:string;
//生日
birthday?:string;
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/EditInfoViewModel.ets
View file @
c90d1fb
import {
editItem,
EditListInfo, editModel } from '../model/EditInfoModel';
EditListInfo, editModel
, editModelParams, WDEditDataModelType
} from '../model/EditInfoModel';
import HashMap from '@ohos.util.HashMap';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { Logger, ResourcesUtils } from 'wdKit';
import { AreaListManageModel, AreaListModel } from '../model/AreaListModel';
import promptAction from '@ohos.promptAction';
const TAG = "EditInfoViewModel"
class EditInfoViewModel {
private static instance: EditInfoViewModel;
editListData:EditListInfo[] = []
params: editModelParams = {}
/**
* 单例模式
* @returns
...
...
@@ -40,7 +42,7 @@ class EditInfoViewModel {
this.editListData = [
new EditListInfo('昵称',item&&item.userName.length > 0?item.userName:'待完善'),
new EditListInfo('简介',item&&item.userExtend.introduction?item.userExtend.introduction:'待完善'),
new EditListInfo('地区',item&&item.userExtend.
city?item.userExtend.city
:'待完善'),
new EditListInfo('地区',item&&item.userExtend.
address?item.userExtend.address
:'待完善'),
new EditListInfo('生日',item&&item.userExtend.birthday?item.userExtend.birthday:'待完善'),
new EditListInfo('性别',item?(item.userExtend.sex === 1?'男':'女'):'待完善'),]
return this.editListData
...
...
@@ -76,15 +78,14 @@ class EditInfoViewModel {
getAreaList(context: Context):PromiseLike<AreaListModel[]>{
return new Promise((success, error) => {
success(this.getAreaListLocal(context))
//
this.BaseGetReque
st(HttpUrlUtils.APPOINTMENT_AccountOwner_PATH).then((navResDTO:ResponseDTO) =>{
//
HttpRequest.po
st(HttpUrlUtils.APPOINTMENT_AccountOwner_PATH).then((navResDTO:ResponseDTO) =>{
// if (navResDTO.code == 200) {
// // let editM = navResDTO.data as EditInfoModel
// // success(JSON.parse(navResDTO.data)
// }
//
// }).catch((error: Error) => {
// Logger.info('EditInfoViewModel','EditInfoViewModel','EditInfoViewModel')
// success(this.GetqueryAccountOwnerLocal(context))
// Logger.info(TAG,'getAreaList','EditInfoViewModel')
// success(this.getAreaListLocal(context))
//
// })
})
...
...
@@ -105,11 +106,28 @@ class EditInfoViewModel {
return new AreaListManageModel(item.code,item.id,item.label,item.children)
}
updateUserInfo(params:object):Promise<ResponseDTO> {
updateUserInfo(item:editModel):Promise<ResponseDTO> {
if (item.editDataType == WDEditDataModelType.WDEditDataModelType_head) {
} else if (item.editDataType == WDEditDataModelType.WDEditDataModelType_nickname) {
this.params = { userName: item.userName }
}
else if (item.editDataType == WDEditDataModelType.WDEditDataModelType_intro) {
this.params = { introduction: item.userExtend.introduction }
} else if (item.editDataType == WDEditDataModelType.WDEditDataModelType_sex) {
this.params = { sex: item.userExtend.sex.toString() }
} else if (item.editDataType == WDEditDataModelType.WDEditDataModelType_birthday) {
this.params = { birthday: item.userExtend.birthday }
} else if (item.editDataType == WDEditDataModelType.WDEditDataModelType_region) {
this.params = {province:item.userExtend.province,city:item.userExtend.city, county: item.userExtend.county ,address:item.userExtend.address}
}
return new Promise((success, error) => {
this.BasePostRequest(HttpUrlUtils.APPOINTMENT_editUserDetail_PATH,params)
this.BasePostRequest(HttpUrlUtils.APPOINTMENT_editUserDetail_PATH,
this.
params)
.then((navResDTO: ResponseDTO) => {
if (navResDTO.code == 200) {
if (navResDTO.code == 0) {
promptAction.showToast({ message: '修改成功' })
}
})
.catch((error: Error) => {
...
...
Please
register
or
login
to post a comment