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-03-26 17:42:59 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
77394450e0ab2d5907b361ec50c4a8702e0f9f36
77394450
1 parent
2757403a
feat:优化个人资料逻辑
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
35 deletions
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/BrowsingHistoryPage.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/EditUserInfoPage.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/MyCollectionListPage.ets
sight_harmony/features/wdComponent/src/main/ets/model/EditInfoModel.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/EditInfoViewModel.ets
sight_harmony/products/phone/src/main/resources/rawfile/userInfo.json
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
View file @
7739445
import HashMap from '@ohos.util.HashMap'
import { ConfigConstants } from 'wdConstant'
import { DateTimeUtils, Logger, SPHelper } from 'wdKit'
import { ConfigConstants, SpConstants } from 'wdConstant'
import { DateTimeUtils, Logger, SPHelper, StringUtils } from 'wdKit'
/**
* 网络请求业务侧工具类
...
...
@@ -58,10 +58,15 @@ export class HttpUrlUtils {
*/
static readonly APPOINTMENT_LIST_DATA_PATH: string = "/api/live-center-message/zh/c/live/subscribe";
/**
* 资料编辑
获取
用户信息
* 资料编辑
特殊
用户信息
*/
static readonly APPOINTMENT_AccountOwner_PATH: string = "/api/rmrb-contact/contact/zh/c/my/detail";
/**
* 资料编辑 普通用户信息
*/
static readonly APPOINTMENT_QueryUserDetail_PATH: string = "/api/rmrb-user-center/user/zh/c/queryUserDetail";
/**
/**
* 个人中心 关注列表详情
*/
static readonly FOLLOW_LIST_DETAIL_DATA_PATH: string = "/api/rmrb-creator-user/c/creatorDirectory/getContactMasterDetaiPage";
...
...
@@ -258,10 +263,14 @@ export class HttpUrlUtils {
private static getUserId() {
// TODO 对接登录
return HttpUrlUtils.userId;
// let userid = await SPHelper.default.get(SpConstants.USER_ID,"")
// if(StringUtils.isNotEmpty(userid)) {
// return userid as string;
// }
return HttpUrlUtils.userId;
}
private static getUserType() {
private static
getUserType() {
return HttpUrlUtils.userType;
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/BrowsingHistoryPage.ets
View file @
7739445
...
...
@@ -19,7 +19,7 @@ struct BrowsingHistoryPage {
@State private browSingModel: PageModel = new PageModel()
aboutToAppear(){
//
this.getData()
this.getData()
}
build() {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/EditUserInfoPage.ets
View file @
7739445
import router from '@ohos.router';
import { CustomTitleUI } from '../reusable/CustomTitleUI';
import { EditInfoModel, EditListInfo } from '../../model/EditInfoModel';
import { EditInfoModel, EditListInfo
, editModel
} from '../../model/EditInfoModel';
import EditInfoViewModel from '../../viewmodel/EditInfoViewModel';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
...
...
@@ -9,10 +9,10 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter';
@Component
struct EditUserInfoPage {
private listData: EditListInfo[] = []
edit
Info: EditInfoModel = new EditInfoModel('','待完善','待完善','待完善','待完善','待完善','待完善')
edit
M: editModel = new editModel
aboutToAppear() {
this.listData = EditInfoViewModel.getEditListInfo(this.edit
Info
)
this.listData = EditInfoViewModel.getEditListInfo(this.edit
M
)
this.getAccountOwnerInfo()
}
...
...
@@ -20,7 +20,7 @@ struct EditUserInfoPage {
Row() {
Column() {
CustomTitleUI({titleName:'资料编辑'})
Image(this.edit
Info.headPhotoUrl?this.editInfo
.headPhotoUrl:'')
Image(this.edit
M.userExtend.headPhotoUrl?this.editM.userExtend
.headPhotoUrl:'')
.backgroundColor(Color.Gray)
.width(100)
.height(100)
...
...
@@ -110,8 +110,8 @@ struct EditUserInfoPage {
}
getAccountOwnerInfo(){
EditInfoViewModel.queryAccountOwnerInfo(1).then((result) => {
this.editInfo = result
EditInfoViewModel.queryAccountOwnerInfo(1,getContext(this)).then((result) => {
this.editM = result
});
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/MyCollectionListPage.ets
View file @
7739445
...
...
@@ -19,7 +19,7 @@ struct MyCollectionListPage {
isloading : boolean = false
aboutToAppear(){
//
this.getData()
this.getData()
}
build() {
...
...
sight_harmony/features/wdComponent/src/main/ets/model/EditInfoModel.ets
View file @
7739445
...
...
@@ -11,11 +11,9 @@ export class EditListInfo{
}
}
export
class EditInfoModel{
export class EditInfoModel{
//头像
headPhotoUrl:string = ''
//昵称
userName:string = ''
//简介
introduction:string = ''
//城市
...
...
@@ -26,15 +24,16 @@ export class EditInfoModel{
birthday:string = ''
//性别
sex:string = ''
}
constructor(headPhotoUrl:string , userName:string , introduction:string , city:string , county:string, birthday:string , sex:string) {
this.headPhotoUrl = headPhotoUrl;
this.userName = userName;
this.introduction = introduction;
this.city = city;
this.county = county;
this.birthday = birthday;
this.sex = sex;
}
export class editModel{
userName:string = ''
userNameStatus:string = ''
phone:string = ''
headPhotoStatus:string = ''
userExtend:EditInfoModel
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/EditInfoViewModel.ets
View file @
7739445
import { EditInfoModel, EditListInfo } from '../model/EditInfoModel';
import { EditInfoModel, EditListInfo
, editModel
} from '../model/EditInfoModel';
import HashMap from '@ohos.util.HashMap';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { Logger, ResourcesUtils } from 'wdKit';
const TAG = "EditInfoViewModel"
class EditInfoViewModel {
private static instance: EditInfoViewModel;
...
...
@@ -20,30 +22,48 @@ class EditInfoViewModel {
BaseGetRequest(requestUrl:string){
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders()
requestUrl = HttpUrlUtils.HOST_SIT + requestUrl
return WDHttp.get<ResponseDTO>(requestUrl,headers)
}
getEditListInfo(item:
EditInfo
Model):EditListInfo[]{
getEditListInfo(item:
edit
Model):EditListInfo[]{
this.editListData = [
new EditListInfo('昵称',item&&item.userName?item.userName:'待完善'),
new EditListInfo('简介',item&&item.introduction?item.introduction:'待完善'),
new EditListInfo('地区',item&&item.city?item.city:'待完善'),
new EditListInfo('生日',item&&item.birthday?item.birthday:'待完善'),
new EditListInfo('性别',item&&item.sex?item.sex:'待完善'),]
new EditListInfo('简介',item&&item.userExtend.introduction?item.userExtend.introduction:'待完善'),
new EditListInfo('地区',item&&item.userExtend.city?item.userExtend.city:'待完善'),
new EditListInfo('生日',item&&item.userExtend.birthday?item.userExtend.birthday:'待完善'),
new EditListInfo('性别',item&&item.userExtend.sex?item.userExtend.sex:'待完善'),]
return this.editListData
}
queryAccountOwnerInfo(userType:number):PromiseLike<EditInfoModel>{
///1普通用户
queryAccountOwnerInfo(userType:number, context: Context):PromiseLike<editModel>{
return new Promise(((success, error) => {
this.BaseGetRequest(
HttpUrlUtils.APPOINTMENT_AccountOwner_PATH).then(navResDTO
=>{
this.BaseGetRequest(
userType == 1?HttpUrlUtils.APPOINTMENT_QueryUserDetail_PATH:HttpUrlUtils.APPOINTMENT_AccountOwner_PATH).then((navResDTO:ResponseDTO)
=>{
if (navResDTO.code == 200) {
// success(JSON.parse(navResDTO.data))
// let editM = navResDTO.data as EditInfoModel
// success(JSON.parse(navResDTO.data)
}
}).catch()
}).catch((error: Error) => {
Logger.info('EditInfoViewModel','EditInfoViewModel','EditInfoViewModel')
return this.GetqueryAccountOwnerLocal(context)
})
}))
}
async GetqueryAccountOwnerLocal(context: Context): Promise<editModel> {
Logger.info(TAG, `getBottomNavDataMock start`);
let compRes: ResponseDTO<editModel> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<editModel>>(context,'userInfo.json');
if (!compRes || !compRes.data) {
Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`);
return {} as editModel
}
Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
updateUserInfo(){
}
...
...
sight_harmony/products/phone/src/main/resources/rawfile/userInfo.json
0 → 100644
View file @
7739445
{
"code"
:
"0"
,
"data"
:
{
"createTime"
:
"2023-12-15 17:19:47"
,
"headPhotoStatus"
:
1
,
"id"
:
490264487281413
,
"modifyNumber"
:
0
,
"phone"
:
"153****3615"
,
"status"
:
1
,
"tenancy"
:
3
,
"userExtend"
:
{
"airec"
:
1
,
"birthday"
:
"1991-08-13"
,
"deviceId"
:
"20065BDF-0E7C-4891-9F4A-85DA50A61F00"
,
"headBucketName"
:
""
,
"headPhotoUrl"
:
"https://uatjdcdnphoto.aikan.pdnews.cn//zhbj/img/user/2024032614/900B80F379D94269AFF29AE815D25422.jpg"
,
"introduction"
:
"唱、跳、rap"
,
"lastLoginTime"
:
"2024-03-26 11:05:03"
,
"city"
:
"安徽省 合肥市"
,
"sex"
:
1
},
"userName"
:
"芒果"
,
"userNameStatus"
:
1
,
"userType"
:
1
},
"message"
:
"Success"
,
"success"
:
true
,
"timestamp"
:
1711434743663
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment