Showing
5 changed files
with
39 additions
and
52 deletions
| @@ -72,6 +72,11 @@ export class UserDataLocal { | @@ -72,6 +72,11 @@ export class UserDataLocal { | ||
| 72 | SPHelper.default.save(UserDataLocal.USER_HEADER_URL, url) | 72 | SPHelper.default.save(UserDataLocal.USER_HEADER_URL, url) |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | + public static setUser_name(url:string) { | ||
| 76 | + UserDataLocal.userName = url | ||
| 77 | + SPHelper.default.save(UserDataLocal.USER_NAME, url) | ||
| 78 | + } | ||
| 79 | + | ||
| 75 | public static setUserType(type:string) { | 80 | public static setUserType(type:string) { |
| 76 | SPHelper.default.save(UserDataLocal.USER_Type, type) | 81 | SPHelper.default.save(UserDataLocal.USER_Type, type) |
| 77 | } | 82 | } |
| @@ -26,11 +26,11 @@ export default struct MinePageUserSimpleInfoUI { | @@ -26,11 +26,11 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 26 | loginStateChange(){ | 26 | loginStateChange(){ |
| 27 | if(this.isLogin){ | 27 | if(this.isLogin){ |
| 28 | ///已登录状态,先获取本地数据 | 28 | ///已登录状态,先获取本地数据 |
| 29 | - this.userName = SPHelper.default.getSync(SpConstants.USER_NAME,"") as string | ||
| 30 | - this.headPhotoUrl = SPHelper.default.getSync(SpConstants.USER_HEAD_PHOTO_URL,"") as string | 29 | + this.userName = UserDataLocal.getUserName() |
| 30 | + this.headPhotoUrl = UserDataLocal.USER_HEADER_URL | ||
| 31 | 31 | ||
| 32 | ///用户类型1普通用户 | 32 | ///用户类型1普通用户 |
| 33 | - let userType = SPHelper.default.getSync(SpConstants.USER_Type,"") as string | 33 | + let userType = UserDataLocal.getUserType() |
| 34 | if (userType && userType.length > 0) { | 34 | if (userType && userType.length > 0) { |
| 35 | this.userType = userType | 35 | this.userType = userType |
| 36 | } | 36 | } |
| @@ -43,7 +43,7 @@ export default struct MinePageUserSimpleInfoUI { | @@ -43,7 +43,7 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | pageShowForUpdateData(){ | 45 | pageShowForUpdateData(){ |
| 46 | - let name = SPHelper.default.getSync(SpConstants.USER_NAME,"") as string | 46 | + let name = UserDataLocal.getUserName() |
| 47 | if (name != this.userName) { | 47 | if (name != this.userName) { |
| 48 | this.loginStateChange() | 48 | this.loginStateChange() |
| 49 | } | 49 | } |
| @@ -182,6 +182,8 @@ export default struct MinePageUserSimpleInfoUI { | @@ -182,6 +182,8 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 182 | this.headPhotoUrl = value.headPhotoUrl | 182 | this.headPhotoUrl = value.headPhotoUrl |
| 183 | UserDataLocal.setUserHeaderUrl(value.headPhotoUrl) | 183 | UserDataLocal.setUserHeaderUrl(value.headPhotoUrl) |
| 184 | 184 | ||
| 185 | + UserDataLocal.setUser_name(value.userName) | ||
| 186 | + | ||
| 185 | this.userType = value.userType | 187 | this.userType = value.userType |
| 186 | UserDataLocal.setUserType(value.userType) | 188 | UserDataLocal.setUserType(value.userType) |
| 187 | 189 |
| @@ -199,7 +199,7 @@ export struct FollowListDetailUI { | @@ -199,7 +199,7 @@ export struct FollowListDetailUI { | ||
| 199 | this.getMyFollowListDetail() | 199 | this.getMyFollowListDetail() |
| 200 | } else { | 200 | } else { |
| 201 | if (this.hasMore) { | 201 | if (this.hasMore) { |
| 202 | - let object = new FollowListDetailRequestItem(this.creatorDirectoryId, 20, this.curPageNum) | 202 | + let object = new FollowListDetailRequestItem(this.creatorDirectoryId, 10, this.curPageNum) |
| 203 | 203 | ||
| 204 | MinePageDatasModel.getFollowListDetailData(object, getContext(this)).then((value) => { | 204 | MinePageDatasModel.getFollowListDetailData(object, getContext(this)).then((value) => { |
| 205 | if (!this.data || value.list.length == 0) { | 205 | if (!this.data || value.list.length == 0) { |
| @@ -250,30 +250,29 @@ export struct FollowListDetailUI { | @@ -250,30 +250,29 @@ export struct FollowListDetailUI { | ||
| 250 | } | 250 | } |
| 251 | }) | 251 | }) |
| 252 | }) | 252 | }) |
| 253 | + data_temp.forEach((item) => { | ||
| 254 | + let introduction = item.introduction | ||
| 255 | + if(item.introduction.indexOf("\n") != -1){ | ||
| 256 | + let regex:RegExp = new RegExp('\n','g') | ||
| 257 | + introduction = item.introduction.replace(regex,'') | ||
| 258 | + } | ||
| 259 | + this.data.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, introduction, item.creatorId, item.status, item.attentionUserId, item.cnUserType, item.cnUserId, item.mainControl, item.banControl, item.authIcon)) | ||
| 260 | + }) | ||
| 253 | 261 | ||
| 254 | - if(StringUtils.isNotEmpty(userid)) { | ||
| 255 | - this.getFollowStatus(data_temp, result.totalCount) | ||
| 256 | - }else { | ||
| 257 | - data_temp.forEach((item) => { | ||
| 258 | - let introduction = item.introduction | ||
| 259 | - if(item.introduction.indexOf("\n") != -1){ | ||
| 260 | - let regex:RegExp = new RegExp('\n','g') | ||
| 261 | - introduction = item.introduction.replace(regex,'') | ||
| 262 | - } | ||
| 263 | - this.data.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, introduction, item.creatorId, item.status, item.attentionUserId, item.cnUserType, item.cnUserId, item.mainControl, item.banControl, item.authIcon)) | ||
| 264 | - }) | 262 | + this.data.notifyDataReload() |
| 265 | 263 | ||
| 266 | - this.data.notifyDataReload() | 264 | + this.count = this.data.totalCount() |
| 265 | + if (this.data.totalCount() < result.totalCount) { | ||
| 266 | + this.curPageNum++ | ||
| 267 | + } else { | ||
| 268 | + this.hasMore = false | ||
| 269 | + } | ||
| 267 | 270 | ||
| 268 | - this.count = this.data.totalCount() | ||
| 269 | - if (this.data.totalCount() < result.totalCount) { | ||
| 270 | - this.curPageNum++ | ||
| 271 | - } else { | ||
| 272 | - this.hasMore = false | ||
| 273 | - } | 271 | + this.isLoading = false |
| 272 | + this.isGetRequest = true | ||
| 274 | 273 | ||
| 275 | - this.isLoading = false | ||
| 276 | - this.isGetRequest = true | 274 | + if(StringUtils.isNotEmpty(userid)) { |
| 275 | + this.getFollowStatus(this.data, result.totalCount) | ||
| 277 | } | 276 | } |
| 278 | }else{ | 277 | }else{ |
| 279 | this.isGetRequest = true | 278 | this.isGetRequest = true |
| @@ -286,41 +285,20 @@ export struct FollowListDetailUI { | @@ -286,41 +285,20 @@ export struct FollowListDetailUI { | ||
| 286 | }) | 285 | }) |
| 287 | } | 286 | } |
| 288 | 287 | ||
| 289 | - getFollowStatus(result: FollowListDetailItem[], totalCount: number) { | 288 | + getFollowStatus(result: LazyDataSource<FollowListDetailItem>, totalCount: number) { |
| 290 | let status = new FollowListStatusRequestItem() | 289 | let status = new FollowListStatusRequestItem() |
| 291 | - result.forEach((item) => { | 290 | + result.getDataArray().forEach((item) => { |
| 292 | status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId)) | 291 | status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId)) |
| 293 | }) | 292 | }) |
| 294 | 293 | ||
| 295 | MinePageDatasModel.getFollowListStatusData(status, getContext(this)).then((newValue) => { | 294 | MinePageDatasModel.getFollowListStatusData(status, getContext(this)).then((newValue) => { |
| 296 | newValue.forEach((item) => { | 295 | newValue.forEach((item) => { |
| 297 | - result.forEach((list) => { | 296 | + result.getDataArray().forEach((list) => { |
| 298 | if (item.creatorId == list.creatorId) { | 297 | if (item.creatorId == list.creatorId) { |
| 299 | list.status = item.status | 298 | list.status = item.status |
| 300 | } | 299 | } |
| 301 | }) | 300 | }) |
| 302 | }) | 301 | }) |
| 303 | - | ||
| 304 | - result.forEach((item) => { | ||
| 305 | - let introduction = item.introduction | ||
| 306 | - if(item.introduction.indexOf("\n") != -1){ | ||
| 307 | - let regex:RegExp = new RegExp('\n','g') | ||
| 308 | - introduction = item.introduction.replace(regex,'') | ||
| 309 | - } | ||
| 310 | - this.data.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, introduction, item.creatorId, item.status, item.attentionUserId, item.cnUserType, item.cnUserId, item.mainControl, item.banControl, item.authIcon)) | ||
| 311 | - }) | ||
| 312 | - | ||
| 313 | - this.data.notifyDataReload() | ||
| 314 | - | ||
| 315 | - this.count = this.data.totalCount() | ||
| 316 | - if (this.data.totalCount() < totalCount) { | ||
| 317 | - this.curPageNum++ | ||
| 318 | - } else { | ||
| 319 | - this.hasMore = false | ||
| 320 | - } | ||
| 321 | - | ||
| 322 | - this.isLoading = false | ||
| 323 | - this.isGetRequest = true | ||
| 324 | }).catch((err: Error) => { | 302 | }).catch((err: Error) => { |
| 325 | // console.log(TAG, "请求失败") | 303 | // console.log(TAG, "请求失败") |
| 326 | this.isLoading = false | 304 | this.isLoading = false |
| @@ -12,7 +12,7 @@ import router from '@ohos.router'; | @@ -12,7 +12,7 @@ import router from '@ohos.router'; | ||
| 12 | import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils' | 12 | import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils' |
| 13 | import { TrackConstants } from 'wdTracking/Index'; | 13 | import { TrackConstants } from 'wdTracking/Index'; |
| 14 | 14 | ||
| 15 | -import { SPHelper } from 'wdKit/Index'; | 15 | +import { SPHelper, UserDataLocal } from 'wdKit/Index'; |
| 16 | import { SpConstants } from 'wdConstant/Index'; | 16 | import { SpConstants } from 'wdConstant/Index'; |
| 17 | import { photoPickerUtils} from '../../utils/PhotoPickerUtils'; | 17 | import { photoPickerUtils} from '../../utils/PhotoPickerUtils'; |
| 18 | import { cameraPickerUtils } from '../../utils/CameraPickerUtils'; | 18 | import { cameraPickerUtils } from '../../utils/CameraPickerUtils'; |
| @@ -138,6 +138,7 @@ struct EditUserInfoPage { | @@ -138,6 +138,7 @@ struct EditUserInfoPage { | ||
| 138 | let userType = SPHelper.default.getSync(SpConstants.USER_Type,"") as string | 138 | let userType = SPHelper.default.getSync(SpConstants.USER_Type,"") as string |
| 139 | if (userType && userType.length > 0) { | 139 | if (userType && userType.length > 0) { |
| 140 | this.userType = userType | 140 | this.userType = userType |
| 141 | + this.headerImg = UserDataLocal.getUserHeaderUrl() | ||
| 141 | } | 142 | } |
| 142 | 143 | ||
| 143 | this.getAccountOwnerInfo() | 144 | this.getAccountOwnerInfo() |
| @@ -4,7 +4,7 @@ import { editModel, editModelParams, WDEditDataModelType } from '../../model/Edi | @@ -4,7 +4,7 @@ import { editModel, editModelParams, WDEditDataModelType } from '../../model/Edi | ||
| 4 | import EditInfoViewModel from '../../viewmodel/EditInfoViewModel'; | 4 | import EditInfoViewModel from '../../viewmodel/EditInfoViewModel'; |
| 5 | // import { encryptMessage } from '../../../utils/cryptoUtil' | 5 | // import { encryptMessage } from '../../../utils/cryptoUtil' |
| 6 | import { encryptMessage } from 'wdLogin/src/main/ets/utils/cryptoUtil' | 6 | import { encryptMessage } from 'wdLogin/src/main/ets/utils/cryptoUtil' |
| 7 | -import { SPHelper } from 'wdKit'; | 7 | +import { SPHelper, UserDataLocal } from 'wdKit'; |
| 8 | import { SpConstants } from 'wdConstant'; | 8 | import { SpConstants } from 'wdConstant'; |
| 9 | 9 | ||
| 10 | @Entry | 10 | @Entry |
| @@ -91,7 +91,8 @@ struct EditUserNikeNamePage { | @@ -91,7 +91,8 @@ struct EditUserNikeNamePage { | ||
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | goBack(){ | 93 | goBack(){ |
| 94 | - SPHelper.default.saveSync(SpConstants.USER_NAME, this.nikeName) | 94 | + UserDataLocal.setUser_name(this.nikeName) |
| 95 | + | ||
| 95 | let params: editModelParams = { | 96 | let params: editModelParams = { |
| 96 | userName: this.nikeName | 97 | userName: this.nikeName |
| 97 | } | 98 | } |
-
Please register or login to post a comment