wangliang_wd

feat:优化昵称修改,简介修改逻辑

@@ -156,22 +156,23 @@ struct EditUserInfoPage { @@ -156,22 +156,23 @@ struct EditUserInfoPage {
156 156
157 if (userName) { 157 if (userName) {
158 if (userName != this.currentUserInfo.userName) { 158 if (userName != this.currentUserInfo.userName) {
159 - this.currentUserInfo.userName = userName;  
160 - this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_nickname  
161 - this.updateEditModel() 159 + // this.currentUserInfo.userName = userName;
  160 + // this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_nickname
  161 + // this.updateEditModel()
  162 + this.getAccountOwnerInfo()
162 } 163 }
163 } else if (introduction){ 164 } else if (introduction){
164 if (introduction != this.currentUserInfo.userExtend.introduction ) { 165 if (introduction != this.currentUserInfo.userExtend.introduction ) {
165 - this.currentUserInfo.userExtend.introduction = introduction;  
166 - this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_intro  
167 - this.updateEditModel() 166 + // this.currentUserInfo.userExtend.introduction = introduction;
  167 + // this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_intro
  168 + // this.updateEditModel()
  169 + this.getAccountOwnerInfo()
168 } 170 }
169 } 171 }
170 } 172 }
171 } 173 }
172 174
173 updateEditModel(){ 175 updateEditModel(){
174 - this.listData = []  
175 // this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo)) 176 // this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo))
176 EditInfoViewModel.updateUserInfo(this.currentUserInfo).then(()=>{ 177 EditInfoViewModel.updateUserInfo(this.currentUserInfo).then(()=>{
177 this.getAccountOwnerInfo() 178 this.getAccountOwnerInfo()
@@ -179,6 +180,7 @@ struct EditUserInfoPage { @@ -179,6 +180,7 @@ struct EditUserInfoPage {
179 } 180 }
180 getAccountOwnerInfo(){ 181 getAccountOwnerInfo(){
181 EditInfoViewModel.queryAccountOwnerInfo(1,getContext(this)).then((editModel) => { 182 EditInfoViewModel.queryAccountOwnerInfo(1,getContext(this)).then((editModel) => {
  183 + this.listData = []
182 this.headerImg = editModel.userExtend.headPhotoUrl 184 this.headerImg = editModel.userExtend.headPhotoUrl
183 this.currentUserInfo = editModel as editModel; 185 this.currentUserInfo = editModel as editModel;
184 this.listData.push(...EditInfoViewModel.getEditListInfo(editModel)) 186 this.listData.push(...EditInfoViewModel.getEditListInfo(editModel))
1 import { CustomTitleUI } from '../reusable/CustomTitleUI' 1 import { CustomTitleUI } from '../reusable/CustomTitleUI'
2 import router from '@ohos.router' 2 import router from '@ohos.router'
3 -import { editModelParams } from '../../model/EditInfoModel'  
4 - 3 +import { editModel, editModelParams, WDEditDataModelType } from '../../model/EditInfoModel'
  4 +import EditInfoViewModel from '../../viewmodel/EditInfoViewModel';
5 @Entry 5 @Entry
6 @Component 6 @Component
7 struct EditUserIntroductionPage { 7 struct EditUserIntroductionPage {
@@ -51,6 +51,11 @@ struct EditUserIntroductionPage { @@ -51,6 +51,11 @@ struct EditUserIntroductionPage {
51 .borderRadius(5) 51 .borderRadius(5)
52 .margin(30) 52 .margin(30)
53 .onClick(()=>{ 53 .onClick(()=>{
  54 + let currentUserInfo:editModel = new editModel()
  55 + currentUserInfo.userExtend.introduction = this.introduction
  56 + currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_intro
  57 + this.updateEditModel(currentUserInfo)
  58 +
54 let params: editModelParams = { 59 let params: editModelParams = {
55 introduction: this.introduction 60 introduction: this.introduction
56 } 61 }
@@ -61,4 +66,9 @@ struct EditUserIntroductionPage { @@ -61,4 +66,9 @@ struct EditUserIntroductionPage {
61 }) 66 })
62 } 67 }
63 } 68 }
  69 +
  70 +
  71 + updateEditModel(Info:editModel){
  72 + EditInfoViewModel.updateUserInfo(Info)
  73 + }
64 } 74 }
1 import { CustomTitleUI } from '../reusable/CustomTitleUI' 1 import { CustomTitleUI } from '../reusable/CustomTitleUI'
2 import router from '@ohos.router' 2 import router from '@ohos.router'
3 -import { editModelParams } from '../../model/EditInfoModel'  
4 - 3 +import { editModel, editModelParams, WDEditDataModelType } from '../../model/EditInfoModel'
  4 +import EditInfoViewModel from '../../viewmodel/EditInfoViewModel';
5 @Entry 5 @Entry
6 @Component 6 @Component
7 struct EditUserNikeNamePage { 7 struct EditUserNikeNamePage {
@@ -51,6 +51,13 @@ struct EditUserNikeNamePage { @@ -51,6 +51,13 @@ struct EditUserNikeNamePage {
51 .borderRadius(5) 51 .borderRadius(5)
52 .margin(30) 52 .margin(30)
53 .onClick(()=>{ 53 .onClick(()=>{
  54 +
  55 + ///内部更新
  56 + let currentUserInfo:editModel = new editModel()
  57 + currentUserInfo.userExtend.introduction = this.nikeName
  58 + currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_nickname
  59 + this.updateEditModel(currentUserInfo)
  60 +
54 let params: editModelParams = { 61 let params: editModelParams = {
55 userName: this.nikeName 62 userName: this.nikeName
56 } 63 }
@@ -61,4 +68,8 @@ struct EditUserNikeNamePage { @@ -61,4 +68,8 @@ struct EditUserNikeNamePage {
61 }) 68 })
62 } 69 }
63 } 70 }
  71 +
  72 + updateEditModel(Info:editModel){
  73 + EditInfoViewModel.updateUserInfo(Info)
  74 + }
64 } 75 }