Showing
37 changed files
with
1214 additions
and
171 deletions
| @@ -15,6 +15,9 @@ export enum EmitterEventId { | @@ -15,6 +15,9 @@ export enum EmitterEventId { | ||
| 15 | /*发布评论*/ | 15 | /*发布评论*/ |
| 16 | COMMENT_PUBLISH = 6, | 16 | COMMENT_PUBLISH = 6, |
| 17 | 17 | ||
| 18 | + // 关注,取消关注 | ||
| 19 | + PEOPLE_SHIP_ATTENTION = 7, | ||
| 20 | + | ||
| 18 | // App回到前台 | 21 | // App回到前台 |
| 19 | APP_ENTER_FOREGROUD = 100, | 22 | APP_ENTER_FOREGROUD = 100, |
| 20 | // App进入后台 | 23 | // App进入后台 |
| @@ -284,6 +284,22 @@ export class HttpUrlUtils { | @@ -284,6 +284,22 @@ export class HttpUrlUtils { | ||
| 284 | */ | 284 | */ |
| 285 | static readonly SEARCH_SUGGEST_DATA_PATH: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list"; | 285 | static readonly SEARCH_SUGGEST_DATA_PATH: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list"; |
| 286 | 286 | ||
| 287 | + /** | ||
| 288 | + * 人民号号主推荐 | ||
| 289 | + */ | ||
| 290 | + static readonly RMH_RECOMMEND_DATA_PATH: string = "/api/rmrb-bff-display-zh/recommend/zh/c/rmh"; | ||
| 291 | + | ||
| 292 | + /** | ||
| 293 | + * 关注号主发布内容接口 | ||
| 294 | + */ | ||
| 295 | + static readonly ATTENTION_CONTENT_LIST_DATA_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/attention/contentList"; | ||
| 296 | + | ||
| 297 | + /** | ||
| 298 | + * 一键关注接口 | ||
| 299 | + */ | ||
| 300 | + static readonly ATTENTION_BATCH_DATA_PATH: string = "/api/rmrb-interact/interact/zh/c/attention/batch"; | ||
| 301 | + | ||
| 302 | + | ||
| 287 | static getHost(): string { | 303 | static getHost(): string { |
| 288 | return HostManager.getHost(); | 304 | return HostManager.getHost(); |
| 289 | } | 305 | } |
| @@ -650,4 +666,23 @@ export class HttpUrlUtils { | @@ -650,4 +666,23 @@ export class HttpUrlUtils { | ||
| 650 | let url = HttpUrlUtils.getHost() + "/api/rmrb-bff-display-zh/display/zh/c/themeList"; | 666 | let url = HttpUrlUtils.getHost() + "/api/rmrb-bff-display-zh/display/zh/c/themeList"; |
| 651 | return url; | 667 | return url; |
| 652 | } | 668 | } |
| 669 | + | ||
| 670 | + // 人民号号主推荐 | ||
| 671 | + static getRmhRecommendUrl() { | ||
| 672 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.RMH_RECOMMEND_DATA_PATH; | ||
| 673 | + return url; | ||
| 674 | + } | ||
| 675 | + | ||
| 676 | + // 关注号主发布内容接口 | ||
| 677 | + static getAttentionContentListUrl() { | ||
| 678 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.ATTENTION_CONTENT_LIST_DATA_PATH; | ||
| 679 | + return url; | ||
| 680 | + } | ||
| 681 | + | ||
| 682 | + // 一键关注接口 | ||
| 683 | + static getAttentionBatchUrl() { | ||
| 684 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.ATTENTION_BATCH_DATA_PATH; | ||
| 685 | + return url; | ||
| 686 | + } | ||
| 687 | + | ||
| 653 | } | 688 | } |
| @@ -153,3 +153,15 @@ export { | @@ -153,3 +153,15 @@ export { | ||
| 153 | UserExtend | 153 | UserExtend |
| 154 | } from './src/main/ets/bean/user/UserDetail'; | 154 | } from './src/main/ets/bean/user/UserDetail'; |
| 155 | 155 | ||
| 156 | +export { | ||
| 157 | + RmhRecommendDTO | ||
| 158 | +} from './src/main/ets/bean/peoples/RmhRecommendDTO'; | ||
| 159 | + | ||
| 160 | +export { | ||
| 161 | + PeopleShipContentListDTO | ||
| 162 | +} from './src/main/ets/bean/peoples/PeopleShipContentListDTO'; | ||
| 163 | + | ||
| 164 | +export { | ||
| 165 | + AttentionBatchDTO, | ||
| 166 | + CreatorDTO | ||
| 167 | +} from './src/main/ets/bean/peoples/AttentionBatchDTO'; |
| 1 | +export class AttentionBatchDTO{ | ||
| 2 | + creators: CreatorDTO[]; | ||
| 3 | + | ||
| 4 | + constructor(creators: CreatorDTO[] = []) { | ||
| 5 | + this.creators = creators | ||
| 6 | + } | ||
| 7 | +} | ||
| 8 | + | ||
| 9 | +export class CreatorDTO { | ||
| 10 | + attentionUserType: string; | ||
| 11 | + attentionUserId: string; | ||
| 12 | + attentionCreatorId: string; | ||
| 13 | + | ||
| 14 | + constructor(attentionUserType: string, attentionUserId: string, attentionCreatorId: string) { | ||
| 15 | + this.attentionUserType = attentionUserType | ||
| 16 | + this.attentionUserId = attentionUserId | ||
| 17 | + this.attentionCreatorId = attentionCreatorId | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | +} |
| 1 | +export interface RmhRecommendDTO { | ||
| 2 | + authIcon: string; | ||
| 3 | + authTitle: string; | ||
| 4 | + authTitle2: string; | ||
| 5 | + cnAttention: number; | ||
| 6 | + cnMainControl: number; | ||
| 7 | + creatorId: string; | ||
| 8 | + fansNum: number; | ||
| 9 | + headPhotoUrl: string; | ||
| 10 | + introduction: string; | ||
| 11 | + itemId: string; | ||
| 12 | + itemType: string; | ||
| 13 | + itemTypeCode: string; | ||
| 14 | + posterShareControl: number; | ||
| 15 | + region: string; | ||
| 16 | + sceneId: string; | ||
| 17 | + subSceneId: string; | ||
| 18 | + traceId: string; | ||
| 19 | + traceInfo: string; | ||
| 20 | + userId: string; | ||
| 21 | + userName: string; | ||
| 22 | + userType: string; | ||
| 23 | +} | ||
| 24 | + |
| @@ -32,6 +32,7 @@ export class commentListModel extends PageModel { | @@ -32,6 +32,7 @@ export class commentListModel extends PageModel { | ||
| 32 | pageNum: number = 1 | 32 | pageNum: number = 1 |
| 33 | pageSize: number = 10 | 33 | pageSize: number = 10 |
| 34 | totalCount: number = 0 | 34 | totalCount: number = 0 |
| 35 | + totalCommentNum: string = '0' | ||
| 35 | hasNext: number = 0 | 36 | hasNext: number = 0 |
| 36 | list: commentItemModel[] = [] | 37 | list: commentItemModel[] = [] |
| 37 | // constructor(pageNum:number, pageSize:number, totalCount: number, hasNext: number, list: commentItemModel[]) { | 38 | // constructor(pageNum:number, pageSize:number, totalCount: number, hasNext: number, list: commentItemModel[]) { |
| @@ -177,6 +177,7 @@ export struct CommentComponent { | @@ -177,6 +177,7 @@ export struct CommentComponent { | ||
| 177 | async getData() { | 177 | async getData() { |
| 178 | commentViewModel.fetchContentCommentList('1', this.publishCommentModel.targetId, this.publishCommentModel.targetType) | 178 | commentViewModel.fetchContentCommentList('1', this.publishCommentModel.targetId, this.publishCommentModel.targetType) |
| 179 | .then(commentListModel => { | 179 | .then(commentListModel => { |
| 180 | + this.publishCommentModel.totalCommentNumer = commentListModel.totalCount + '' | ||
| 180 | if (commentListModel && commentListModel.list && commentListModel.list.length > 0) { | 181 | if (commentListModel && commentListModel.list && commentListModel.list.length > 0) { |
| 181 | commentListModel.list.forEach(element => { | 182 | commentListModel.list.forEach(element => { |
| 182 | element.hasMore = Number.parseInt(element.childCommentNum) ? true : false | 183 | element.hasMore = Number.parseInt(element.childCommentNum) ? true : false |
| 1 | -import { EmitterEventId, EmitterUtils } from 'wdKit/Index' | 1 | +import { DisplayUtils, EmitterEventId, EmitterUtils } from 'wdKit/Index' |
| 2 | import { publishCommentModel } from '../model/PublishCommentModel' | 2 | import { publishCommentModel } from '../model/PublishCommentModel' |
| 3 | import { CommentCustomDialog } from './CommentCustomDialog' | 3 | import { CommentCustomDialog } from './CommentCustomDialog' |
| 4 | - | 4 | +import measure from '@ohos.measure' |
| 5 | 5 | ||
| 6 | @Preview | 6 | @Preview |
| 7 | @Component | 7 | @Component |
| 8 | export struct CommentTabComponent { | 8 | export struct CommentTabComponent { |
| 9 | @ObjectLink publishCommentModel: publishCommentModel | 9 | @ObjectLink publishCommentModel: publishCommentModel |
| 10 | /*展示类型*/ | 10 | /*展示类型*/ |
| 11 | - @State type:number = 1 | 11 | + @State type: number = 1 |
| 12 | @State placeHolder: string = '说两句...' | 12 | @State placeHolder: string = '说两句...' |
| 13 | - | ||
| 14 | @State dialogController: CustomDialogController | null = null; | 13 | @State dialogController: CustomDialogController | null = null; |
| 15 | - | ||
| 16 | /*回调方法*/ | 14 | /*回调方法*/ |
| 17 | - dialogControllerConfirm: () => void = () => {} | ||
| 18 | - | ||
| 19 | - | 15 | + dialogControllerConfirm: () => void = () => { |
| 16 | + } | ||
| 20 | 17 | ||
| 21 | aboutToAppear() { | 18 | aboutToAppear() { |
| 22 | 19 | ||
| @@ -24,9 +21,9 @@ export struct CommentTabComponent { | @@ -24,9 +21,9 @@ export struct CommentTabComponent { | ||
| 24 | builder: CommentCustomDialog({ | 21 | builder: CommentCustomDialog({ |
| 25 | confirm: (value: Record<string, string>) => { | 22 | confirm: (value: Record<string, string>) => { |
| 26 | this.dialogControllerConfirm(); | 23 | this.dialogControllerConfirm(); |
| 27 | - EmitterUtils.sendEvent(EmitterEventId.COMMENT_PUBLISH,this.publishCommentModel.targetId) | 24 | + EmitterUtils.sendEvent(EmitterEventId.COMMENT_PUBLISH, this.publishCommentModel.targetId) |
| 28 | }, | 25 | }, |
| 29 | - publishCommentModel:this.publishCommentModel | 26 | + publishCommentModel: this.publishCommentModel |
| 30 | }), | 27 | }), |
| 31 | autoCancel: true, | 28 | autoCancel: true, |
| 32 | alignment: DialogAlignment.Bottom, | 29 | alignment: DialogAlignment.Bottom, |
| @@ -40,13 +37,13 @@ export struct CommentTabComponent { | @@ -40,13 +37,13 @@ export struct CommentTabComponent { | ||
| 40 | } | 37 | } |
| 41 | 38 | ||
| 42 | build() { | 39 | build() { |
| 43 | - Row(){ | ||
| 44 | - Stack({alignContent:Alignment.Start}){ | 40 | + Row() { |
| 41 | + Stack({ alignContent: Alignment.Start }) { | ||
| 45 | Image($r('app.media.comment_img_input_hui')).width(151).height(30) | 42 | Image($r('app.media.comment_img_input_hui')).width(151).height(30) |
| 46 | - Text(this.placeHolder).fontSize(12).fontColor('#999999').margin({left:10}) | 43 | + Text(this.placeHolder).fontSize(12).fontColor('#999999').margin({ left: 10 }) |
| 47 | } | 44 | } |
| 48 | }.width(151).height(30) | 45 | }.width(151).height(30) |
| 49 | - .onClick(()=>{ | 46 | + .onClick(() => { |
| 50 | this.publishCommentModel.parentId = '-1'; | 47 | this.publishCommentModel.parentId = '-1'; |
| 51 | this.dialogController?.open(); | 48 | this.dialogController?.open(); |
| 52 | }) | 49 | }) |
| @@ -58,54 +55,84 @@ export struct CommentTabComponent { | @@ -58,54 +55,84 @@ export struct CommentTabComponent { | ||
| 58 | export struct CommentIconComponent { | 55 | export struct CommentIconComponent { |
| 59 | @ObjectLink publishCommentModel: publishCommentModel | 56 | @ObjectLink publishCommentModel: publishCommentModel |
| 60 | /*展示类型*/ | 57 | /*展示类型*/ |
| 61 | - @State type:number = 1 | 58 | + @State type: number = 1 |
| 59 | + | ||
| 60 | + // aboutToAppear(): void { | ||
| 61 | + // setTimeout(() => { | ||
| 62 | + // this.publishCommentModel.totalCommentNumer = '444' | ||
| 63 | + // }, 3000); | ||
| 64 | + // | ||
| 65 | + // setTimeout(() => { | ||
| 66 | + // this.publishCommentModel.totalCommentNumer = '2' | ||
| 67 | + // }, 4000); | ||
| 68 | + | ||
| 69 | + // } | ||
| 62 | 70 | ||
| 63 | /*回调方法*/ | 71 | /*回调方法*/ |
| 64 | - onClickItem: () => void = () => {} | 72 | + onClickItem: () => void = () => { |
| 73 | + } | ||
| 65 | 74 | ||
| 66 | build() { | 75 | build() { |
| 67 | - Row(){ | ||
| 68 | - Stack({alignContent:Alignment.TopEnd}){ | 76 | + Row() { |
| 77 | + Stack({ alignContent: Alignment.TopEnd }) { | ||
| 69 | Image($r('app.media.comment_icon')).width(24).height(24) | 78 | Image($r('app.media.comment_icon')).width(24).height(24) |
| 70 | // Stack({alignContent:Alignment.Start}) { | 79 | // Stack({alignContent:Alignment.Start}) { |
| 71 | - RelativeContainer() { | ||
| 72 | - Image($r('app.media.comment_icon_number_bg')) | ||
| 73 | - .objectFit(ImageFit.Fill) | ||
| 74 | - .resizable({ slice: {top:1, left: 20 , right:1, bottom:1} }) | ||
| 75 | - .alignRules({ | ||
| 76 | - top: {anchor: "Text", align: VerticalAlign.Top}, | ||
| 77 | - left: {anchor: "Text", align: HorizontalAlign.Start}, | ||
| 78 | - right: {anchor: "Text", align: HorizontalAlign.End}, | ||
| 79 | - bottom : {anchor: "Text", align: VerticalAlign.Bottom}, | ||
| 80 | - }) | ||
| 81 | - // .offset({ | 80 | + // if(Number.parseInt(this.publishCommentModel.totalCommentNumer) != 0){ |
| 81 | + RelativeContainer() { | ||
| 82 | + Image($r('app.media.comment_icon_number_bg')) | ||
| 83 | + .objectFit(ImageFit.Fill) | ||
| 84 | + .resizable({ slice: { top: 1, left: 20, right: 1, bottom: 1 } }) | ||
| 85 | + .alignRules({ | ||
| 86 | + top: { anchor: "Text", align: VerticalAlign.Top }, | ||
| 87 | + left: { anchor: "Text", align: HorizontalAlign.Start }, | ||
| 88 | + right: { anchor: "Text", align: HorizontalAlign.End }, | ||
| 89 | + bottom: { anchor: "Text", align: VerticalAlign.Bottom }, | ||
| 90 | + })// .offset({ | ||
| 82 | // x:-6 | 91 | // x:-6 |
| 83 | // }) | 92 | // }) |
| 84 | - .id("Image") | ||
| 85 | - | ||
| 86 | - Text('123213123123123') | ||
| 87 | - .fontSize(8) | ||
| 88 | - .fontColor('#ffffff')// .backgroundColor('#ED2800') | ||
| 89 | - .height(12) | ||
| 90 | - .alignRules({ | ||
| 91 | - top: {anchor: "__container__", align: VerticalAlign.Top}, | ||
| 92 | - left: {anchor: "__container__", align: HorizontalAlign.Start} | ||
| 93 | - }) | ||
| 94 | - // .margin({left: 4,right:4 | 93 | + .id("Image") |
| 94 | + | ||
| 95 | + Text(this.publishCommentModel.totalCommentNumer)// Text("44444444") | ||
| 96 | + .fontSize(8) | ||
| 97 | + .fontColor('#ffffff')// .backgroundColor('#ED2800') | ||
| 98 | + .height(12) | ||
| 99 | + .textAlign(TextAlign.Center) | ||
| 100 | + .alignRules({ | ||
| 101 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 102 | + left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 103 | + })// .margin({left: 4,right:4 | ||
| 95 | // }) | 104 | // }) |
| 96 | /*动态计算文字宽度*/ | 105 | /*动态计算文字宽度*/ |
| 97 | - .width(50) | ||
| 98 | - // .backgroundColor(Color.Green) | ||
| 99 | - .id("Text") | 106 | + .width(this.getMeasureText(this.publishCommentModel.totalCommentNumer) + 12)// .backgroundColor(Color.Green) |
| 107 | + .id("Text") | ||
| 108 | + // .offset({ | ||
| 109 | + // x: 3 | ||
| 110 | + // }) | ||
| 100 | 111 | ||
| 101 | - } | 112 | + } |
| 102 | // } | 113 | // } |
| 103 | - | ||
| 104 | .offset({ | 114 | .offset({ |
| 105 | - x:12 | 115 | + x: 12 |
| 106 | }) | 116 | }) |
| 117 | + | ||
| 118 | + // } | ||
| 107 | } | 119 | } |
| 108 | }.width(24).height(24) | 120 | }.width(24).height(24) |
| 121 | + | ||
| 109 | // .backgroundColor(Color.Blue) | 122 | // .backgroundColor(Color.Blue) |
| 110 | } | 123 | } |
| 111 | -} | ||
| 124 | + | ||
| 125 | + private getMeasureText(text: string) { | ||
| 126 | + | ||
| 127 | + | ||
| 128 | + let width = measure.measureText({ | ||
| 129 | + textContent: text, | ||
| 130 | + fontSize: 8, | ||
| 131 | + lineHeight: 12, | ||
| 132 | + constraintWidth: DisplayUtils.getDeviceWidth(), | ||
| 133 | + }) | ||
| 134 | + width = px2vp(width) | ||
| 135 | + return width | ||
| 136 | + } | ||
| 137 | +} | ||
| 138 | + |
| @@ -25,6 +25,41 @@ export struct FollowListDetailUI { | @@ -25,6 +25,41 @@ export struct FollowListDetailUI { | ||
| 25 | curPageNum: number = 1; | 25 | curPageNum: number = 1; |
| 26 | preferences: dataPreferences.Preferences | null = null; | 26 | preferences: dataPreferences.Preferences | null = null; |
| 27 | @State isGetRequest: boolean = false | 27 | @State isGetRequest: boolean = false |
| 28 | + observer = (key: string) => { | ||
| 29 | + if (key == UserDataLocal.USER_FOLLOW_OPERATION) { | ||
| 30 | + if (this.creatorDirectoryId === -1) { | ||
| 31 | + let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION, "") as string | ||
| 32 | + let arr = value.split(',') | ||
| 33 | + if (arr[1] == "0") { | ||
| 34 | + this.data.getDataArray().forEach((element, index) => { | ||
| 35 | + if (element.creatorId === arr[0]) { | ||
| 36 | + this.data.deleteItem(index) | ||
| 37 | + this.count = this.data.size() | ||
| 38 | + } | ||
| 39 | + }); | ||
| 40 | + } else { | ||
| 41 | + if (!this.isLoading) { | ||
| 42 | + this.isLoading = true | ||
| 43 | + this.hasMore = true | ||
| 44 | + this.curPageNum = 1 | ||
| 45 | + this.data.clear() | ||
| 46 | + this.data.notifyDataReload() | ||
| 47 | + this.getMyFollowListDetail() | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + }else{ | ||
| 51 | + let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION, "") as string | ||
| 52 | + let arr = value.split(',') | ||
| 53 | + if (arr[1] == "0"){ | ||
| 54 | + this.data.getDataArray().forEach((element, index) => { | ||
| 55 | + if (element.creatorId === arr[0]) { | ||
| 56 | + this.data.getData(index).status = "0" | ||
| 57 | + } | ||
| 58 | + }) | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + } | ||
| 28 | 63 | ||
| 29 | aboutToAppear() { | 64 | aboutToAppear() { |
| 30 | this.getNewPageData() | 65 | this.getNewPageData() |
| @@ -76,42 +111,13 @@ export struct FollowListDetailUI { | @@ -76,42 +111,13 @@ export struct FollowListDetailUI { | ||
| 76 | 111 | ||
| 77 | async addFollowStatusObserver() { | 112 | async addFollowStatusObserver() { |
| 78 | this.preferences = await SPHelper.default.getPreferences(); | 113 | this.preferences = await SPHelper.default.getPreferences(); |
| 79 | - let observer = (key: string) => { | ||
| 80 | - if (key == UserDataLocal.USER_FOLLOW_OPERATION) { | ||
| 81 | - if (this.creatorDirectoryId === -1) { | ||
| 82 | - let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION, "") as string | ||
| 83 | - let arr = value.split(',') | ||
| 84 | - if (arr[1] == "0") { | ||
| 85 | - this.data.getDataArray().forEach((element, index) => { | ||
| 86 | - if (element.creatorId === arr[0]) { | ||
| 87 | - this.data.deleteItem(index) | ||
| 88 | - this.count = this.data.size() | ||
| 89 | - } | ||
| 90 | - }); | ||
| 91 | - } else { | ||
| 92 | - if (!this.isLoading) { | ||
| 93 | - this.isLoading = true | ||
| 94 | - this.hasMore = true | ||
| 95 | - this.curPageNum = 1 | ||
| 96 | - this.data.clear() | ||
| 97 | - this.data.notifyDataReload() | ||
| 98 | - this.getMyFollowListDetail() | ||
| 99 | - } | ||
| 100 | - } | ||
| 101 | - }else{ | ||
| 102 | - let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION, "") as string | ||
| 103 | - let arr = value.split(',') | ||
| 104 | - if (arr[1] == "0"){ | ||
| 105 | - this.data.getDataArray().forEach((element, index) => { | ||
| 106 | - if (element.creatorId === arr[0]) { | ||
| 107 | - this.data.getData(index).status = "0" | ||
| 108 | - } | ||
| 109 | - }) | ||
| 110 | - } | ||
| 111 | - } | ||
| 112 | - } | 114 | + this.preferences.on('change', this.observer); |
| 115 | + } | ||
| 116 | + | ||
| 117 | + aboutToDisappear(): void { | ||
| 118 | + if(this.preferences){ | ||
| 119 | + this.preferences.off('change', this.observer); | ||
| 113 | } | 120 | } |
| 114 | - this.preferences.on('change', observer); | ||
| 115 | } | 121 | } |
| 116 | 122 | ||
| 117 | getMyFollowListDetail() { | 123 | getMyFollowListDetail() { |
| @@ -28,6 +28,29 @@ export struct HomePageBottomComponent{ | @@ -28,6 +28,29 @@ export struct HomePageBottomComponent{ | ||
| 28 | @Link commentNum:number | 28 | @Link commentNum:number |
| 29 | preferences: dataPreferences.Preferences | null = null; | 29 | preferences: dataPreferences.Preferences | null = null; |
| 30 | @State isGetRequest:boolean = false | 30 | @State isGetRequest:boolean = false |
| 31 | + observer = (key: string) => { | ||
| 32 | + if (key == UserDataLocal.USER_FOLLOW_OPERATION) { | ||
| 33 | + let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION,"") as string | ||
| 34 | + let arr = value.split(',') | ||
| 35 | + if(arr[1] == "0"){ | ||
| 36 | + this.data_follow.getDataArray().forEach((element,index) => { | ||
| 37 | + if (element.creatorId === arr[0]) { | ||
| 38 | + this.data_follow.deleteItem(index) | ||
| 39 | + this.count = this.data_follow.size() | ||
| 40 | + } | ||
| 41 | + }); | ||
| 42 | + }else{ | ||
| 43 | + if(!this.isLoading){ | ||
| 44 | + this.isLoading = true | ||
| 45 | + this.hasMore = true | ||
| 46 | + this.curPageNum = 1 | ||
| 47 | + this.data_follow.clear() | ||
| 48 | + this.data_follow.notifyDataReload() | ||
| 49 | + this.getMyFollowListDetail() | ||
| 50 | + } | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + } | ||
| 31 | 54 | ||
| 32 | aboutToAppear(){ | 55 | aboutToAppear(){ |
| 33 | this.getNewPageData() | 56 | this.getNewPageData() |
| @@ -36,30 +59,13 @@ export struct HomePageBottomComponent{ | @@ -36,30 +59,13 @@ export struct HomePageBottomComponent{ | ||
| 36 | 59 | ||
| 37 | async addFollowStatusObserver() { | 60 | async addFollowStatusObserver() { |
| 38 | this.preferences = await SPHelper.default.getPreferences(); | 61 | this.preferences = await SPHelper.default.getPreferences(); |
| 39 | - let observer = (key: string) => { | ||
| 40 | - if (key == UserDataLocal.USER_FOLLOW_OPERATION) { | ||
| 41 | - let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION,"") as string | ||
| 42 | - let arr = value.split(',') | ||
| 43 | - if(arr[1] == "0"){ | ||
| 44 | - this.data_follow.getDataArray().forEach((element,index) => { | ||
| 45 | - if (element.creatorId === arr[0]) { | ||
| 46 | - this.data_follow.deleteItem(index) | ||
| 47 | - this.count = this.data_follow.size() | ||
| 48 | - } | ||
| 49 | - }); | ||
| 50 | - }else{ | ||
| 51 | - if(!this.isLoading){ | ||
| 52 | - this.isLoading = true | ||
| 53 | - this.hasMore = true | ||
| 54 | - this.curPageNum = 1 | ||
| 55 | - this.data_follow.clear() | ||
| 56 | - this.data_follow.notifyDataReload() | ||
| 57 | - this.getMyFollowListDetail() | ||
| 58 | - } | ||
| 59 | - } | ||
| 60 | - } | 62 | + this.preferences.on('change', this.observer); |
| 63 | + } | ||
| 64 | + | ||
| 65 | + aboutToDisappear(): void { | ||
| 66 | + if(this.preferences){ | ||
| 67 | + this.preferences.off('change', this.observer); | ||
| 61 | } | 68 | } |
| 62 | - this.preferences.on('change', observer); | ||
| 63 | } | 69 | } |
| 64 | 70 | ||
| 65 | build(){ | 71 | build(){ |
| @@ -24,6 +24,15 @@ export struct MinePageComponent { | @@ -24,6 +24,15 @@ export struct MinePageComponent { | ||
| 24 | @State moreData:MinePageMoreFunctionModel[] = [] | 24 | @State moreData:MinePageMoreFunctionModel[] = [] |
| 25 | scroller: Scroller = new Scroller() | 25 | scroller: Scroller = new Scroller() |
| 26 | preferences: dataPreferences.Preferences | null = null; | 26 | preferences: dataPreferences.Preferences | null = null; |
| 27 | + observer = (key: string) => { | ||
| 28 | + if(key == SpConstants.USER_ID){ | ||
| 29 | + if(StringUtils.isEmpty(SPHelper.default.getSync(SpConstants.USER_ID,""))){ | ||
| 30 | + this.isLogin = false | ||
| 31 | + }else { | ||
| 32 | + this.isLogin = true | ||
| 33 | + } | ||
| 34 | + } | ||
| 35 | + } | ||
| 27 | 36 | ||
| 28 | aboutToAppear(){ | 37 | aboutToAppear(){ |
| 29 | this.getUserLogin() | 38 | this.getUserLogin() |
| @@ -33,16 +42,13 @@ export struct MinePageComponent { | @@ -33,16 +42,13 @@ export struct MinePageComponent { | ||
| 33 | 42 | ||
| 34 | async addLoginStatusObserver(){ | 43 | async addLoginStatusObserver(){ |
| 35 | this.preferences = await SPHelper.default.getPreferences(); | 44 | this.preferences = await SPHelper.default.getPreferences(); |
| 36 | - let observer = (key: string) => { | ||
| 37 | - if(key == SpConstants.USER_ID){ | ||
| 38 | - if(StringUtils.isEmpty(SPHelper.default.getSync(SpConstants.USER_ID,""))){ | ||
| 39 | - this.isLogin = false | ||
| 40 | - }else { | ||
| 41 | - this.isLogin = true | ||
| 42 | - } | ||
| 43 | - } | 45 | + this.preferences.on('change', this.observer); |
| 46 | + } | ||
| 47 | + | ||
| 48 | + aboutToDisappear(): void { | ||
| 49 | + if(this.preferences){ | ||
| 50 | + this.preferences.off('change', this.observer); | ||
| 44 | } | 51 | } |
| 45 | - this.preferences.on('change', observer); | ||
| 46 | } | 52 | } |
| 47 | 53 | ||
| 48 | 54 |
| @@ -6,6 +6,8 @@ import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'; | @@ -6,6 +6,8 @@ import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'; | ||
| 6 | import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent'; | 6 | import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent'; |
| 7 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; | 7 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; |
| 8 | import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; | 8 | import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; |
| 9 | +import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent'; | ||
| 10 | + | ||
| 9 | 11 | ||
| 10 | const TAG = 'TopNavigationComponent'; | 12 | const TAG = 'TopNavigationComponent'; |
| 11 | 13 | ||
| @@ -218,7 +220,16 @@ export struct TopNavigationComponent { | @@ -218,7 +220,16 @@ export struct TopNavigationComponent { | ||
| 218 | pageId: navItem.pageId + '', | 220 | pageId: navItem.pageId + '', |
| 219 | channelId: navItem.channelId + '', | 221 | channelId: navItem.channelId + '', |
| 220 | }) | 222 | }) |
| 221 | - } else | 223 | + } |
| 224 | + else if (this.currentBottomNavName === '人民号' && navItem.name === '关注') { | ||
| 225 | + PeopleShipMainComponent({ | ||
| 226 | + currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | ||
| 227 | + navIndex: index, | ||
| 228 | + pageId: navItem.pageId + '', | ||
| 229 | + channelId: navItem.channelId + '', | ||
| 230 | + }) | ||
| 231 | + } | ||
| 232 | + else | ||
| 222 | if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { | 233 | if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { |
| 223 | PageComponent({ | 234 | PageComponent({ |
| 224 | currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | 235 | currentTopNavSelectedIndex: $currentTopNavSelectedIndex, |
| 1 | +import { PeopleShipAttentionContentListTopComponent } from './PeopleShipAttentionContentListTopComponent' | ||
| 2 | +import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'; | ||
| 3 | +import { ContentDTO } from 'wdBean' | ||
| 4 | +import { CardParser } from '../CardParser' | ||
| 5 | + | ||
| 6 | +@Preview | ||
| 7 | +@Component | ||
| 8 | +export struct PeopleShipAttentionContentListComponent { | ||
| 9 | + | ||
| 10 | + @Prop followList: FollowListDetailItem[] | ||
| 11 | + | ||
| 12 | + @Prop attentionList: ContentDTO[] | ||
| 13 | + | ||
| 14 | + build() { | ||
| 15 | + List(){ | ||
| 16 | + // 头部关注列表 | ||
| 17 | + ListItem(){ | ||
| 18 | + PeopleShipAttentionContentListTopComponent({ | ||
| 19 | + followList: this.followList | ||
| 20 | + }) | ||
| 21 | + } | ||
| 22 | + ForEach(this.attentionList, (item: ContentDTO) => { | ||
| 23 | + ListItem() { | ||
| 24 | + CardParser({ contentDTO: item }) | ||
| 25 | + }.width("100%") | ||
| 26 | + .backgroundColor(Color.Transparent) | ||
| 27 | + | ||
| 28 | + }, (item: ContentDTO, index: number) => item.objectId + index.toString()) | ||
| 29 | + } | ||
| 30 | + .scrollBar(BarState.Off) | ||
| 31 | + .width('100%') | ||
| 32 | + .height('100%') | ||
| 33 | + } | ||
| 34 | +} | ||
| 35 | + |
| 1 | +import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'; | ||
| 2 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | ||
| 3 | +import { ProcessUtils } from 'wdRouter'; | ||
| 4 | +import { PeopleShipHomePageHeadComponent } from '../peopleShipHomePage/PeopleShipHomePageHeadComponent' | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +@Component | ||
| 8 | +export struct PeopleShipAttentionContentListTopComponent { | ||
| 9 | + @Prop followList: FollowListDetailItem[] | ||
| 10 | + build() { | ||
| 11 | + Column() { | ||
| 12 | + List(){ | ||
| 13 | + ListItem() { | ||
| 14 | + PeopleShipAttentionContentListHeadComponent({ | ||
| 15 | + index: 0, | ||
| 16 | + item: this.followList[0] | ||
| 17 | + }) | ||
| 18 | + }.onClick(() => { | ||
| 19 | + // 跳转到关注列表-我的 | ||
| 20 | + WDRouterRule.jumpWithPage(WDRouterPage.followListPage) | ||
| 21 | + }) | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + ForEach(this.followList, (item: FollowListDetailItem, index: number) => { | ||
| 25 | + ListItem() { | ||
| 26 | + PeopleShipAttentionContentListHeadComponent({ | ||
| 27 | + index: index + 1, | ||
| 28 | + item: item | ||
| 29 | + }) | ||
| 30 | + }.onClick(() => { | ||
| 31 | + let creatorId = item.attentionCreatorId || '' | ||
| 32 | + ProcessUtils.gotoPeopleShipHomePage(creatorId) | ||
| 33 | + }) | ||
| 34 | + }, (item: FollowListDetailItem) => item.attentionCreatorId) | ||
| 35 | + } | ||
| 36 | + .listDirection(Axis.Horizontal) | ||
| 37 | + .scrollBar(BarState.Off) | ||
| 38 | + .width('100%') | ||
| 39 | + .height('102vp') | ||
| 40 | + Divider().strokeWidth(1).color($r('app.color.color_F5F5F5')) | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | +} | ||
| 44 | + | ||
| 45 | +@Component | ||
| 46 | +struct PeopleShipAttentionContentListHeadComponent { | ||
| 47 | + | ||
| 48 | + @State index: number = 0 | ||
| 49 | + @ObjectLink item: FollowListDetailItem | ||
| 50 | + build() { | ||
| 51 | + Column(){ | ||
| 52 | + // 头像 | ||
| 53 | + PeopleShipHomePageHeadComponent({ | ||
| 54 | + diameter: 48, | ||
| 55 | + iconDiameter: 16, | ||
| 56 | + headPhotoUrl: this.index == 0 ? $r('app.media.attention_mine') : | ||
| 57 | + ((this.item.attentionHeadPhotoUrl && this.item.attentionHeadPhotoUrl.length > 0) ? | ||
| 58 | + this.item.attentionHeadPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon')), | ||
| 59 | + authIcon: this.index == 0 ? '' : this.item.authIcon | ||
| 60 | + }).margin({ | ||
| 61 | + bottom: '8vp' | ||
| 62 | + }) | ||
| 63 | + | ||
| 64 | + Text(this.index == 0 ? '我的关注' : this.item.attentionUserName) | ||
| 65 | + .fontColor($r('app.color.color_666666')) | ||
| 66 | + .fontSize($r('app.float.vp_13')) | ||
| 67 | + .fontWeight(400) | ||
| 68 | + .height('18vp') | ||
| 69 | + .lineHeight('18vp') | ||
| 70 | + .maxLines(1) | ||
| 71 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 72 | + .padding({ | ||
| 73 | + left: '2vp', | ||
| 74 | + right: '2vp' | ||
| 75 | + }) | ||
| 76 | + } | ||
| 77 | + .alignItems(HorizontalAlign.Center) | ||
| 78 | + .width('78vp') | ||
| 79 | + .margin({ | ||
| 80 | + left: this.index == 0 ? '8vp' : '4vp', | ||
| 81 | + top: '14vp', | ||
| 82 | + bottom: '14vp' | ||
| 83 | + }) | ||
| 84 | + } | ||
| 85 | +} |
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipMainComponent.ets
0 → 100644
| 1 | +import { PeopleShipRecommendComponent } from './PeopleShipRecommendComponent'; | ||
| 2 | +import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel'; | ||
| 3 | +import { HttpUtils } from 'wdNetwork/Index'; | ||
| 4 | +import { Logger, DateTimeUtils, EmitterEventId, EmitterUtils } from 'wdKit'; | ||
| 5 | +import { RmhRecommendDTO, ContentDTO, AttentionBatchDTO, CreatorDTO } from 'wdBean'; | ||
| 6 | +import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType'; | ||
| 7 | +import { channelSkeleton } from '../skeleton/channelSkeleton' | ||
| 8 | +import { EmptyComponent } from '../view/EmptyComponent'; | ||
| 9 | +import { ErrorComponent } from '../view/ErrorComponent'; | ||
| 10 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | ||
| 11 | +import MinePageDatasModel from '../../model/MinePageDatasModel'; | ||
| 12 | +import { FollowListDetailRequestItem } from '../../viewmodel/FollowListDetailRequestItem'; | ||
| 13 | +import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'; | ||
| 14 | +import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | ||
| 15 | +import PageModel from '../../viewmodel/PageModel'; | ||
| 16 | +import PageAdModel from '../../viewmodel/PageAdvModel'; | ||
| 17 | +import PageHelper from '../../viewmodel/PageHelper'; | ||
| 18 | +import { PeopleShipAttentionContentListTopComponent } from './PeopleShipAttentionContentListTopComponent' | ||
| 19 | +import { CardParser } from '../CardParser' | ||
| 20 | +import NoMoreLayout from '../page/NoMoreLayout'; | ||
| 21 | + | ||
| 22 | +@Preview | ||
| 23 | +@Component | ||
| 24 | +export struct PeopleShipMainComponent { | ||
| 25 | + @State private pageModel: PageModel = new PageModel(); | ||
| 26 | + @State private pageAdvModel: PageAdModel = new PageAdModel(); | ||
| 27 | + | ||
| 28 | + navIndex: number = 0; | ||
| 29 | + pageId: string = ""; | ||
| 30 | + channelId: string = ""; | ||
| 31 | + @Link @Watch('onChange') currentTopNavSelectedIndex: number | ||
| 32 | + private scroller: Scroller = new Scroller() | ||
| 33 | + private listScroller: Scroller = new Scroller() | ||
| 34 | + | ||
| 35 | + @State rmhList: RmhRecommendDTO[] = [] | ||
| 36 | + @Provide rmhSelectedList: string[] = [] | ||
| 37 | + @State viewType: ViewType = ViewType.LOADING | ||
| 38 | + // 一键关注处理 | ||
| 39 | + @State @Watch('onOneFollowChange') oneKeyFollow: boolean = false | ||
| 40 | + // 已经关注的列表 | ||
| 41 | + @State followList: FollowListDetailItem[] = [] | ||
| 42 | + // 换一换 | ||
| 43 | + @State @Watch('onChangeButtonClick') changeButton: boolean = false | ||
| 44 | + @State attentionList: ContentDTO[] = [] | ||
| 45 | + @State private hasMore: boolean = true | ||
| 46 | + @State private currentPage: number = 1 | ||
| 47 | + @State private isLoading: boolean = false | ||
| 48 | + @State private loadTime: string = '' | ||
| 49 | + | ||
| 50 | + // 页面展示监听 | ||
| 51 | + @Consume @Watch('onPageShowChange') pageShow: number | ||
| 52 | + @State private pageAttentionChange: boolean = false | ||
| 53 | + | ||
| 54 | + build() { | ||
| 55 | + if (this.viewType == ViewType.LOADING) { | ||
| 56 | + this.LoadingLayout() | ||
| 57 | + } else if (this.viewType == ViewType.ERROR) { | ||
| 58 | + ErrorComponent() | ||
| 59 | + } else if (this.viewType == ViewType.EMPTY) { | ||
| 60 | + EmptyComponent() | ||
| 61 | + } else { | ||
| 62 | + if (this.followList.length == 0) { | ||
| 63 | + CustomPullToRefresh({ | ||
| 64 | + alldata: this.rmhList, | ||
| 65 | + scroller: this.scroller, | ||
| 66 | + hasMore: false, | ||
| 67 | + customList: () => { | ||
| 68 | + this.ListLayout() | ||
| 69 | + }, | ||
| 70 | + onRefresh: (resolve) => { | ||
| 71 | + this.currentPage = 1 | ||
| 72 | + this.getData(resolve) | ||
| 73 | + }, | ||
| 74 | + }) | ||
| 75 | + }else { | ||
| 76 | + CustomPullToRefresh({ | ||
| 77 | + alldata: this.attentionList, | ||
| 78 | + scroller: this.listScroller, | ||
| 79 | + hasMore: this.hasMore, | ||
| 80 | + customList: () => { | ||
| 81 | + this.ListAttentionLayout() | ||
| 82 | + }, | ||
| 83 | + onRefresh: (resolve) => { | ||
| 84 | + this.currentPage = 1 | ||
| 85 | + this.getData(resolve) | ||
| 86 | + }, | ||
| 87 | + onLoadMore:(resolve)=> { | ||
| 88 | + if (this.hasMore === false) { | ||
| 89 | + if(resolve) { | ||
| 90 | + resolve('') | ||
| 91 | + } | ||
| 92 | + return | ||
| 93 | + } | ||
| 94 | + if(!this.isLoading && this.hasMore){ | ||
| 95 | + //加载分页数据 | ||
| 96 | + this.currentPage++; | ||
| 97 | + this.getAttentionContentListData(resolve) | ||
| 98 | + }else { | ||
| 99 | + if(resolve) { | ||
| 100 | + resolve('') | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + }, | ||
| 104 | + }) | ||
| 105 | + } | ||
| 106 | + } | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + @Builder | ||
| 110 | + LoadingLayout() { | ||
| 111 | + channelSkeleton() | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + @Builder | ||
| 115 | + ListLayout() { | ||
| 116 | + Scroll(this.scroller) { | ||
| 117 | + // 推荐人民号 | ||
| 118 | + PeopleShipRecommendComponent({ | ||
| 119 | + rmhList: this.rmhList, | ||
| 120 | + oneKeyFollow: this.oneKeyFollow, | ||
| 121 | + changeButton: this.changeButton | ||
| 122 | + }) | ||
| 123 | + } | ||
| 124 | + .edgeEffect(EdgeEffect.None) | ||
| 125 | + .scrollBar(BarState.Off) | ||
| 126 | + .width('100%') | ||
| 127 | + .height('100%') | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + @Builder | ||
| 131 | + ListAttentionLayout() { | ||
| 132 | + List({scroller: this.listScroller}){ | ||
| 133 | + // 头部关注列表 | ||
| 134 | + ListItem(){ | ||
| 135 | + PeopleShipAttentionContentListTopComponent({ | ||
| 136 | + followList: this.followList | ||
| 137 | + }) | ||
| 138 | + } | ||
| 139 | + ForEach(this.attentionList, (item: ContentDTO) => { | ||
| 140 | + ListItem() { | ||
| 141 | + CardParser({ contentDTO: item }) | ||
| 142 | + }.width("100%") | ||
| 143 | + .backgroundColor(Color.Transparent) | ||
| 144 | + | ||
| 145 | + }, (item: ContentDTO, index: number) => item.objectId + index.toString()) | ||
| 146 | + | ||
| 147 | + // 加载更多 | ||
| 148 | + ListItem() { | ||
| 149 | + if (!this.hasMore && !this.isLoading) { | ||
| 150 | + NoMoreLayout() | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + } | ||
| 154 | + .edgeEffect(EdgeEffect.None) | ||
| 155 | + .scrollBar(BarState.Off) | ||
| 156 | + .width('100%') | ||
| 157 | + .height('100%') | ||
| 158 | + | ||
| 159 | + // PeopleShipAttentionContentListComponent({ | ||
| 160 | + // followList: this.followList, | ||
| 161 | + // attentionList: this.attentionList | ||
| 162 | + // }) | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + aboutToAppear() { | ||
| 166 | + if (this.navIndex == this.currentTopNavSelectedIndex && this.viewType == ViewType.LOADING) { | ||
| 167 | + this.getData() | ||
| 168 | + } | ||
| 169 | + // 有登录-退出登录-关注接口等问题 | ||
| 170 | + EmitterUtils.receiveEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION, () => { | ||
| 171 | + Logger.debug('PeopleShipMainComponent', 'PEOPLE_SHIP_ATTENTION') | ||
| 172 | + this.pageAttentionChange = true | ||
| 173 | + }) | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + onChange() { | ||
| 177 | + if (this.navIndex === this.currentTopNavSelectedIndex && (this.viewType == ViewType.LOADING || this.pageAttentionChange)) { | ||
| 178 | + this.getData(); | ||
| 179 | + } | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + private async getData(resolve?: (value: string | PromiseLike<string>) => void) { | ||
| 183 | + if (this.isLoading) { | ||
| 184 | + if (resolve) { | ||
| 185 | + resolve('已更新至最新') | ||
| 186 | + } | ||
| 187 | + return | ||
| 188 | + } | ||
| 189 | + this.pageAttentionChange = false | ||
| 190 | + this.isLoading = true | ||
| 191 | + this.getInitData() | ||
| 192 | + try { | ||
| 193 | + // 登录后获取 | ||
| 194 | + if (HttpUtils.getUserId()) { | ||
| 195 | + // 获取用户关注人数 | ||
| 196 | + let object = new FollowListDetailRequestItem(-1, 20, 1) | ||
| 197 | + let followInfo = await MinePageDatasModel.getMineFollowListData(object, getContext(this)) | ||
| 198 | + Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(followInfo)}`) | ||
| 199 | + | ||
| 200 | + if (followInfo.list.length == 0) { | ||
| 201 | + this.followList = [] | ||
| 202 | + this.getRmhRecommendInfo(resolve) | ||
| 203 | + } else { | ||
| 204 | + this.followList = [] | ||
| 205 | + // this.followList = followInfo.list | ||
| 206 | + this.followList.push(...followInfo.list) | ||
| 207 | + this.attentionList = [] | ||
| 208 | + this.currentPage = 1 | ||
| 209 | + this.loadTime = DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN) | ||
| 210 | + this.getAttentionContentListData(resolve) | ||
| 211 | + } | ||
| 212 | + } else { | ||
| 213 | + this.followList = [] | ||
| 214 | + this.getRmhRecommendInfo(resolve) | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + } catch (exception) { | ||
| 218 | + this.viewType = ViewType.ERROR | ||
| 219 | + this.isLoading = false | ||
| 220 | + } | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + // 获取人民号号主推荐 | ||
| 224 | + private async getRmhRecommendInfo(resolve?: (value: string | PromiseLike<string>) => void) { | ||
| 225 | + try { | ||
| 226 | + // 获取页面信息 | ||
| 227 | + this.rmhList = await PeopleShipMainViewModel.getPeopleRemRecommendInfo() | ||
| 228 | + this.rmhSelectedList = [] | ||
| 229 | + this.rmhList.forEach((item: RmhRecommendDTO) => { | ||
| 230 | + this.rmhSelectedList.push(item.creatorId) | ||
| 231 | + }) | ||
| 232 | + this.viewType = ViewType.LOADED | ||
| 233 | + this.changeButton = false | ||
| 234 | + this.isLoading = false | ||
| 235 | + Logger.debug('PeopleShipMainComponent', 'getRmhRecommendInfo' + `${JSON.stringify(this.rmhList)}`) | ||
| 236 | + if (resolve) { | ||
| 237 | + resolve('已更新至最新') | ||
| 238 | + } | ||
| 239 | + } catch (exception) { | ||
| 240 | + if (resolve) { | ||
| 241 | + resolve('') | ||
| 242 | + } | ||
| 243 | + this.viewType = ViewType.ERROR | ||
| 244 | + this.changeButton = false | ||
| 245 | + this.isLoading = false | ||
| 246 | + } | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + // 获取关注 | ||
| 250 | + private async getAttentionContentListData(resolve?: (value: string | PromiseLike<string>) => void) { | ||
| 251 | + if (this.isLoading && this.currentPage != 1) { | ||
| 252 | + if (resolve) { | ||
| 253 | + resolve('') | ||
| 254 | + } | ||
| 255 | + return | ||
| 256 | + } | ||
| 257 | + this.isLoading = true | ||
| 258 | + try { | ||
| 259 | + // 获取列表数据 | ||
| 260 | + let listData = await PeopleShipMainViewModel.getAttentionContentListInfo(this.currentPage, 20, this.loadTime) | ||
| 261 | + Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(listData)}`) | ||
| 262 | + | ||
| 263 | + if (resolve ) { | ||
| 264 | + if (this.currentPage == 1) { | ||
| 265 | + resolve('已更新至最新') | ||
| 266 | + }else { | ||
| 267 | + resolve('') | ||
| 268 | + } | ||
| 269 | + } | ||
| 270 | + if (listData && listData.list && listData.list.length > 0) { | ||
| 271 | + if (listData.list.length === 20) { | ||
| 272 | + this.hasMore = true; | ||
| 273 | + } else { | ||
| 274 | + this.hasMore = false; | ||
| 275 | + } | ||
| 276 | + if (this.currentPage == 1) { | ||
| 277 | + this.attentionList = [] | ||
| 278 | + } | ||
| 279 | + this.attentionList.push(...listData.list) | ||
| 280 | + } | ||
| 281 | + this.viewType = ViewType.LOADED | ||
| 282 | + this.isLoading = false | ||
| 283 | + } catch (exception) { | ||
| 284 | + this.viewType = ViewType.ERROR | ||
| 285 | + this.isLoading = false | ||
| 286 | + } | ||
| 287 | + } | ||
| 288 | + | ||
| 289 | + // 说是首页必须要调用 | ||
| 290 | + async getInitData() { | ||
| 291 | + Logger.debug('PeopleShipMainComponent', `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`); | ||
| 292 | + this.pageModel.pageId = this.pageId; | ||
| 293 | + this.pageModel.groupId = this.pageId; | ||
| 294 | + this.pageModel.channelId = this.channelId; | ||
| 295 | + this.pageModel.currentPage = 1; | ||
| 296 | + PageHelper.getInitData(this.pageModel, this.pageAdvModel) | ||
| 297 | + } | ||
| 298 | + | ||
| 299 | + // 点击一键关注 | ||
| 300 | + onOneFollowChange() { | ||
| 301 | + if (this.oneKeyFollow) { | ||
| 302 | + if (this.rmhSelectedList.length > 0) { | ||
| 303 | + if (!HttpUtils.getUserId()) { | ||
| 304 | + this.oneKeyFollow = false | ||
| 305 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 306 | + return | ||
| 307 | + } | ||
| 308 | + //调用接口 | ||
| 309 | + this.attentionBatchPort() | ||
| 310 | + } else { | ||
| 311 | + this.oneKeyFollow = false | ||
| 312 | + } | ||
| 313 | + } | ||
| 314 | + } | ||
| 315 | + | ||
| 316 | + // 一键关注接口 | ||
| 317 | + private async attentionBatchPort() { | ||
| 318 | + try { | ||
| 319 | + // 获取列表数据 | ||
| 320 | + let objects = new AttentionBatchDTO() | ||
| 321 | + this.rmhList.forEach((element: RmhRecommendDTO) => { | ||
| 322 | + if ( this.rmhSelectedList.indexOf(element.creatorId) != -1) { | ||
| 323 | + const creator = new CreatorDTO(element.userType, element.userId, element.creatorId) | ||
| 324 | + objects.creators.push(creator) | ||
| 325 | + } | ||
| 326 | + }) | ||
| 327 | + Logger.debug('PeopleShipMainComponent', `一键关注接口参数: ${JSON.stringify(objects)}`); | ||
| 328 | + let batchInfo = await PeopleShipMainViewModel.getAttentionBatchInfo(objects) | ||
| 329 | + if (batchInfo.code === 0 || batchInfo.code.toString() === "0") { | ||
| 330 | + this.getData() | ||
| 331 | + } | ||
| 332 | + } catch (exception) { | ||
| 333 | + | ||
| 334 | + } | ||
| 335 | + } | ||
| 336 | + | ||
| 337 | + // 点击换一换 | ||
| 338 | + onChangeButtonClick() { | ||
| 339 | + if (this.changeButton) { | ||
| 340 | + this.getRmhRecommendInfo() | ||
| 341 | + } | ||
| 342 | + } | ||
| 343 | + | ||
| 344 | + // 页面展示监听 | ||
| 345 | + onPageShowChange() { | ||
| 346 | + if (this.navIndex === this.currentTopNavSelectedIndex && this.pageAttentionChange ) { | ||
| 347 | + this.getData() | ||
| 348 | + } | ||
| 349 | + } | ||
| 350 | + | ||
| 351 | +} |
| 1 | +import { PeopleShipRecommendHeadComponent } from './PeopleShipRecommendHeadComponent' | ||
| 2 | +import { RmhRecommendDTO } from 'wdBean'; | ||
| 3 | +import { Logger } from 'wdKit/Index'; | ||
| 4 | +import NoMoreLayout from '../page/NoMoreLayout'; | ||
| 5 | + | ||
| 6 | +@Component | ||
| 7 | +export struct PeopleShipRecommendComponent { | ||
| 8 | + @Prop rmhList: RmhRecommendDTO[] = [] | ||
| 9 | + @Consume rmhSelectedList: string[] | ||
| 10 | + // 一键关注处理 | ||
| 11 | + @Link oneKeyFollow: boolean | ||
| 12 | + // 换一换 | ||
| 13 | + @Link changeButton: boolean | ||
| 14 | + | ||
| 15 | + | ||
| 16 | + build() { | ||
| 17 | + Column({ space: 0 }) { | ||
| 18 | + Row() { | ||
| 19 | + Image($r('app.media.redLine')) | ||
| 20 | + .width('3vp') | ||
| 21 | + .height('16vp') | ||
| 22 | + .objectFit(ImageFit.Cover) | ||
| 23 | + .margin({ | ||
| 24 | + left: '16vp', | ||
| 25 | + right: '4vp' | ||
| 26 | + }) | ||
| 27 | + Text('为你推荐优质号主') | ||
| 28 | + .height('30vp') | ||
| 29 | + .fontColor($r('app.color.color_222222')) | ||
| 30 | + .fontWeight(600) | ||
| 31 | + .fontSize($r('app.float.vp_18')) | ||
| 32 | + | ||
| 33 | + Blank() | ||
| 34 | + Button({ type: ButtonType.Normal, stateEffect: true }) { | ||
| 35 | + Row() { | ||
| 36 | + Text('换一换') | ||
| 37 | + .height('30vp') | ||
| 38 | + .fontColor($r('app.color.color_999999')) | ||
| 39 | + .fontWeight(400) | ||
| 40 | + .fontSize($r('app.float.vp_14')) | ||
| 41 | + Image($r('app.media.ic_refresh')) | ||
| 42 | + .width('14vp') | ||
| 43 | + .height('14vp') | ||
| 44 | + .objectFit(ImageFit.Cover) | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + .margin({ | ||
| 48 | + right: '16vp' | ||
| 49 | + }) | ||
| 50 | + .backgroundColor(Color.Transparent) | ||
| 51 | + .onClick(() => { | ||
| 52 | + // 点击换一换 | ||
| 53 | + if (!this.changeButton) { | ||
| 54 | + this.changeButton = true | ||
| 55 | + } | ||
| 56 | + }) | ||
| 57 | + } | ||
| 58 | + .width('100%') | ||
| 59 | + .alignSelf(ItemAlign.Start) | ||
| 60 | + .margin({ | ||
| 61 | + top: '10vp', | ||
| 62 | + bottom: '10vp' | ||
| 63 | + }) | ||
| 64 | + | ||
| 65 | + Grid() { | ||
| 66 | + ForEach(this.rmhList, (item: RmhRecommendDTO) => { | ||
| 67 | + GridItem() { | ||
| 68 | + PeopleShipRecommendHeadComponent({ | ||
| 69 | + rmhInfo: item | ||
| 70 | + }) | ||
| 71 | + .onClick(() => { | ||
| 72 | + this.clickRecommendHeadSelected(item) | ||
| 73 | + }) | ||
| 74 | + } | ||
| 75 | + }, (item: RmhRecommendDTO) => item.creatorId) | ||
| 76 | + } | ||
| 77 | + .columnsTemplate('1fr 1fr 1fr') | ||
| 78 | + .columnsGap(20) | ||
| 79 | + .rowsGap(20) | ||
| 80 | + .height(Math.ceil(this.rmhList.length / 3.0) * 136) | ||
| 81 | + .backgroundColor(Color.Transparent) | ||
| 82 | + .margin({ | ||
| 83 | + right: '20vp', | ||
| 84 | + left: '20pv' | ||
| 85 | + }) | ||
| 86 | + | ||
| 87 | + // 为你推荐 | ||
| 88 | + Button(this.rmhSelectedList.length == 0 ? '一键关注' : `一键关注 (${this.rmhSelectedList.length})`, { type: ButtonType.Normal, stateEffect: this.rmhSelectedList.length != 0 }) | ||
| 89 | + .margin({ | ||
| 90 | + top: '24vp' | ||
| 91 | + }) | ||
| 92 | + .width('120vp') | ||
| 93 | + .height('36vp') | ||
| 94 | + .backgroundColor(this.rmhSelectedList.length != 0 ? $r('app.color.color_ED2800') : $r('app.color.color_B0B0B0')) | ||
| 95 | + .borderRadius('3vp') | ||
| 96 | + .fontColor($r('app.color.color_999999')) | ||
| 97 | + .fontWeight(500) | ||
| 98 | + .fontSize($r('app.float.vp_14')) | ||
| 99 | + .fontColor(Color.White) | ||
| 100 | + .onClick(() => { | ||
| 101 | + // 点击一键关注 | ||
| 102 | + if (!this.oneKeyFollow && this.rmhSelectedList.length > 0 ){ | ||
| 103 | + this.oneKeyFollow = true | ||
| 104 | + } | ||
| 105 | + }) | ||
| 106 | + // 没有更多 | ||
| 107 | + NoMoreLayout() | ||
| 108 | + } | ||
| 109 | + .width('100%') | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + // 选中 | ||
| 113 | + private clickRecommendHeadSelected(rmhInfo: RmhRecommendDTO) { | ||
| 114 | + if (this.rmhSelectedList.length > 0 && rmhInfo ) { | ||
| 115 | + const num = this.rmhSelectedList.indexOf(rmhInfo.creatorId) | ||
| 116 | + if ( num != -1) { | ||
| 117 | + this.rmhSelectedList.splice(num, 1) | ||
| 118 | + }else { | ||
| 119 | + this.rmhSelectedList.push(rmhInfo.creatorId) | ||
| 120 | + } | ||
| 121 | + }else { | ||
| 122 | + this.rmhSelectedList.push(rmhInfo.creatorId) | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | +} |
| 1 | +import { RmhRecommendDTO } from 'wdBean'; | ||
| 2 | +import { ToastUtils } from 'wdKit/Index'; | ||
| 3 | + | ||
| 4 | +@Component | ||
| 5 | +export struct PeopleShipRecommendHeadComponent { | ||
| 6 | + @State isSelected: boolean = true | ||
| 7 | + @Consume rmhSelectedList: string[] | ||
| 8 | + @State rmhInfo: RmhRecommendDTO = {} as RmhRecommendDTO | ||
| 9 | + | ||
| 10 | + build() { | ||
| 11 | + Column(){ | ||
| 12 | + Stack({ alignContent: Alignment.BottomEnd }) { | ||
| 13 | + Image(this.rmhInfo.headPhotoUrl.length > 0 ? this.rmhInfo.headPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon')) | ||
| 14 | + .width('44vp') | ||
| 15 | + .height('44vp') | ||
| 16 | + .borderRadius('22vp') | ||
| 17 | + .objectFit(ImageFit.Cover) | ||
| 18 | + | ||
| 19 | + Image( this.isSelectedRmhInfo() ? $r('app.media.rmh_selected') : $r('app.media.rmh_unselected') ) | ||
| 20 | + .width('18vp') | ||
| 21 | + .height('18vp') | ||
| 22 | + .objectFit(ImageFit.Cover) | ||
| 23 | + .margin({ | ||
| 24 | + right: '-3vp' | ||
| 25 | + }) | ||
| 26 | + }.margin({ top: 12, bottom: 8 }) | ||
| 27 | + | ||
| 28 | + Text(this.rmhInfo.userName) | ||
| 29 | + .fontColor($r('app.color.color_222222')) | ||
| 30 | + .fontSize($r('app.float.vp_14')) | ||
| 31 | + .fontWeight(600) | ||
| 32 | + .maxLines(1) | ||
| 33 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 34 | + | ||
| 35 | + Text(this.rmhInfo.introduction) | ||
| 36 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 37 | + .fontSize($r('app.float.vp_12')) | ||
| 38 | + .margin({ top: 8, bottom: 14 }) | ||
| 39 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 40 | + .maxLines(2) | ||
| 41 | + .height(34) | ||
| 42 | + } | ||
| 43 | + .width('100%') | ||
| 44 | + .height('116vp') | ||
| 45 | + | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + private isSelectedRmhInfo() { | ||
| 49 | + if (this.rmhSelectedList.length > 0 && this.rmhInfo ) { | ||
| 50 | + if (this.rmhSelectedList.indexOf(this.rmhInfo.creatorId) != -1) { | ||
| 51 | + return true | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + return false | ||
| 55 | + } | ||
| 56 | +} |
| @@ -20,7 +20,6 @@ import { RefreshLayoutBean } from '../page/RefreshLayoutBean' | @@ -20,7 +20,6 @@ import { RefreshLayoutBean } from '../page/RefreshLayoutBean' | ||
| 20 | import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout' | 20 | import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout' |
| 21 | import { ErrorComponent } from '../view/ErrorComponent'; | 21 | import { ErrorComponent } from '../view/ErrorComponent'; |
| 22 | import NoMoreLayout from '../page/NoMoreLayout'; | 22 | import NoMoreLayout from '../page/NoMoreLayout'; |
| 23 | -// import { LazyDataSource } from 'wdKit'; | ||
| 24 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh' | 23 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh' |
| 25 | 24 | ||
| 26 | const TAG = 'PeopleShipHomeArticleListComponent'; | 25 | const TAG = 'PeopleShipHomeArticleListComponent'; |
| @@ -36,7 +36,7 @@ export struct PeopleShipHomePageNavComponent { | @@ -36,7 +36,7 @@ export struct PeopleShipHomePageNavComponent { | ||
| 36 | PeopleShipHomePageHeadComponent({ | 36 | PeopleShipHomePageHeadComponent({ |
| 37 | diameter: 30, | 37 | diameter: 30, |
| 38 | iconDiameter: 10, | 38 | iconDiameter: 10, |
| 39 | - headPhotoUrl: this.detailModel.headPhotoUrl, | 39 | + headPhotoUrl: (this.detailModel.headPhotoUrl && this.detailModel.headPhotoUrl.length > 0 ) ? this.detailModel.headPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon'), |
| 40 | authIcon: this.detailModel.authIcon | 40 | authIcon: this.detailModel.authIcon |
| 41 | }) | 41 | }) |
| 42 | .margin({ | 42 | .margin({ |
| @@ -2,13 +2,13 @@ | @@ -2,13 +2,13 @@ | ||
| 2 | export struct PeopleShipHomePageHeadComponent { | 2 | export struct PeopleShipHomePageHeadComponent { |
| 3 | @State diameter: number = 30 | 3 | @State diameter: number = 30 |
| 4 | @State iconDiameter: number = 10 | 4 | @State iconDiameter: number = 10 |
| 5 | - @Prop headPhotoUrl: string = '' | 5 | + @Prop headPhotoUrl: string | ResourceStr = '' |
| 6 | @Prop authIcon: string = '' | 6 | @Prop authIcon: string = '' |
| 7 | 7 | ||
| 8 | build() { | 8 | build() { |
| 9 | Stack({ alignContent: Alignment.BottomEnd }) { | 9 | Stack({ alignContent: Alignment.BottomEnd }) { |
| 10 | // 头像 | 10 | // 头像 |
| 11 | - Image( this.headPhotoUrl.length > 0 ? this.headPhotoUrl : $r('app.media.home_page_header_authority') ) | 11 | + Image( this.headPhotoUrl ) |
| 12 | .width(this.diameter) | 12 | .width(this.diameter) |
| 13 | .height(this.diameter) | 13 | .height(this.diameter) |
| 14 | .borderRadius(this.diameter/2) | 14 | .borderRadius(this.diameter/2) |
| @@ -16,6 +16,7 @@ export struct PeopleShipHomePageHeadComponent { | @@ -16,6 +16,7 @@ export struct PeopleShipHomePageHeadComponent { | ||
| 16 | .borderStyle(BorderStyle.Solid) | 16 | .borderStyle(BorderStyle.Solid) |
| 17 | .borderColor(Color.White) | 17 | .borderColor(Color.White) |
| 18 | .objectFit(ImageFit.Cover) | 18 | .objectFit(ImageFit.Cover) |
| 19 | + .backgroundColor(Color.White) | ||
| 19 | if(this.authIcon.length > 0 ) { | 20 | if(this.authIcon.length > 0 ) { |
| 20 | Image( this.authIcon ) | 21 | Image( this.authIcon ) |
| 21 | .width(this.iconDiameter) | 22 | .width(this.iconDiameter) |
| @@ -46,7 +46,7 @@ export struct PeopleShipHomePageTopComponent { | @@ -46,7 +46,7 @@ export struct PeopleShipHomePageTopComponent { | ||
| 46 | PeopleShipHomePageHeadComponent({ | 46 | PeopleShipHomePageHeadComponent({ |
| 47 | diameter: 80, | 47 | diameter: 80, |
| 48 | iconDiameter: 20, | 48 | iconDiameter: 20, |
| 49 | - headPhotoUrl: this.detailModel.headPhotoUrl, | 49 | + headPhotoUrl:(this.detailModel.headPhotoUrl && this.detailModel.headPhotoUrl.length > 0) ? this.detailModel.headPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon') , |
| 50 | authIcon: this.detailModel.authIcon | 50 | authIcon: this.detailModel.authIcon |
| 51 | }).margin({ | 51 | }).margin({ |
| 52 | left: '10vp', | 52 | left: '10vp', |
| 1 | import { Params } from 'wdBean'; | 1 | import { Params } from 'wdBean'; |
| 2 | +import { AppUtils, StringUtils } from 'wdKit/Index'; | ||
| 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 3 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 3 | import { EnvironmentCustomDialog } from './EnvironmentCustomDialog'; | 4 | import { EnvironmentCustomDialog } from './EnvironmentCustomDialog'; |
| 4 | 5 | ||
| @@ -32,6 +33,10 @@ export struct AboutPageUI { | @@ -32,6 +33,10 @@ export struct AboutPageUI { | ||
| 32 | aboutToAppear() { | 33 | aboutToAppear() { |
| 33 | let context = getContext(); | 34 | let context = getContext(); |
| 34 | context.getApplicationContext(); | 35 | context.getApplicationContext(); |
| 36 | + let appVerion = AppUtils.getAppVersionName() | ||
| 37 | + if (StringUtils.isNotEmpty(appVerion)) { | ||
| 38 | + this.version = "版本号:" + appVerion | ||
| 39 | + } | ||
| 35 | } | 40 | } |
| 36 | 41 | ||
| 37 | @Builder | 42 | @Builder |
| 1 | 1 | ||
| 2 | import { BottomNavi, CommonConstants, SpConstants } from 'wdConstant'; | 2 | import { BottomNavi, CommonConstants, SpConstants } from 'wdConstant'; |
| 3 | -import { Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit'; | 3 | +import { Logger, SPHelper, ToastUtils, UserDataLocal, EmitterEventId, EmitterUtils } from 'wdKit'; |
| 4 | import { TopNavigationComponent } from '../page/TopNavigationComponent'; | 4 | import { TopNavigationComponent } from '../page/TopNavigationComponent'; |
| 5 | import PageViewModel from '../../viewmodel/PageViewModel'; | 5 | import PageViewModel from '../../viewmodel/PageViewModel'; |
| 6 | import {MineMainSettingFunctionItem} from '../../viewmodel/MineMainSettingFunctionItem'; | 6 | import {MineMainSettingFunctionItem} from '../../viewmodel/MineMainSettingFunctionItem'; |
| @@ -430,7 +430,7 @@ export struct AccountAndSecurityLayout { | @@ -430,7 +430,7 @@ export struct AccountAndSecurityLayout { | ||
| 430 | let login = new LoginViewModel; | 430 | let login = new LoginViewModel; |
| 431 | login.logOut().then(()=>{ | 431 | login.logOut().then(()=>{ |
| 432 | promptAction.showToast({ message: '退出登录' }) | 432 | promptAction.showToast({ message: '退出登录' }) |
| 433 | - router.back(); | 433 | + EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION) |
| 434 | router.back(); | 434 | router.back(); |
| 435 | }).catch((error:string)=>{ | 435 | }).catch((error:string)=>{ |
| 436 | promptAction.showToast({ message: error }) | 436 | promptAction.showToast({ message: error }) |
| @@ -110,7 +110,7 @@ export struct ENewspaperListDialog { | @@ -110,7 +110,7 @@ export struct ENewspaperListDialog { | ||
| 110 | ListItem() { | 110 | ListItem() { |
| 111 | Column() { | 111 | Column() { |
| 112 | if (itemIndex == 0) { | 112 | if (itemIndex == 0) { |
| 113 | - Text(item.pageNum + item.pageName) | 113 | + Text(item.pageNum + '版:' + item.pageName) |
| 114 | .fontSize($r('app.float.font_size_14')) | 114 | .fontSize($r('app.float.font_size_14')) |
| 115 | .fontColor($r('app.color.color_ED2800')) | 115 | .fontColor($r('app.color.color_ED2800')) |
| 116 | .fontWeight(600) | 116 | .fontWeight(600) |
| @@ -130,6 +130,7 @@ export struct ENewspaperListDialog { | @@ -130,6 +130,7 @@ export struct ENewspaperListDialog { | ||
| 130 | Text(positionItem.title) | 130 | Text(positionItem.title) |
| 131 | .fontSize($r('app.float.font_size_17')) | 131 | .fontSize($r('app.float.font_size_17')) |
| 132 | .fontColor($r('app.color.color_222222')) | 132 | .fontColor($r('app.color.color_222222')) |
| 133 | + .fontWeight(600) | ||
| 133 | .margin({ top: 8 }) | 134 | .margin({ top: 8 }) |
| 134 | .maxLines(2) | 135 | .maxLines(2) |
| 135 | } | 136 | } |
| @@ -172,9 +173,12 @@ export struct ENewspaperListDialog { | @@ -172,9 +173,12 @@ export struct ENewspaperListDialog { | ||
| 172 | // } | 173 | // } |
| 173 | }) | 174 | }) |
| 174 | } | 175 | } |
| 175 | - | ||
| 176 | }) | 176 | }) |
| 177 | } | 177 | } |
| 178 | + .divider({ | ||
| 179 | + strokeWidth: 0.5, | ||
| 180 | + color: '#EDEDED' | ||
| 181 | + }) | ||
| 178 | } | 182 | } |
| 179 | }) | 183 | }) |
| 180 | } | 184 | } |
| @@ -4,7 +4,7 @@ import MinePageCreatorFunctionsItem from '../viewmodel/MinePageCreatorFunctionsI | @@ -4,7 +4,7 @@ import MinePageCreatorFunctionsItem from '../viewmodel/MinePageCreatorFunctionsI | ||
| 4 | import MinePageMoreFunctionModel from '../viewmodel/MinePageMoreFunctionModel'; | 4 | import MinePageMoreFunctionModel from '../viewmodel/MinePageMoreFunctionModel'; |
| 5 | import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | 5 | import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 6 | import { MineAppointmentListItem } from '../viewmodel/MineAppointmentListItem'; | 6 | import { MineAppointmentListItem } from '../viewmodel/MineAppointmentListItem'; |
| 7 | -import { Logger, StringUtils } from 'wdKit'; | 7 | +import { Logger, StringUtils, EmitterUtils, EmitterEventId } from 'wdKit'; |
| 8 | import { MineFollowListDetailItem } from '../viewmodel/MineFollowListDetailItem'; | 8 | import { MineFollowListDetailItem } from '../viewmodel/MineFollowListDetailItem'; |
| 9 | import { FollowListDetailRequestItem } from '../viewmodel/FollowListDetailRequestItem'; | 9 | import { FollowListDetailRequestItem } from '../viewmodel/FollowListDetailRequestItem'; |
| 10 | import { FollowListItem } from '../viewmodel/FollowListItem'; | 10 | import { FollowListItem } from '../viewmodel/FollowListItem'; |
| @@ -545,6 +545,7 @@ class MinePageDatasModel{ | @@ -545,6 +545,7 @@ class MinePageDatasModel{ | ||
| 545 | return | 545 | return |
| 546 | } | 546 | } |
| 547 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | 547 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); |
| 548 | + EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION) | ||
| 548 | success(navResDTO); | 549 | success(navResDTO); |
| 549 | }).catch((err: Error) => { | 550 | }).catch((err: Error) => { |
| 550 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | 551 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); |
| @@ -182,20 +182,47 @@ struct MineHomePage { | @@ -182,20 +182,47 @@ struct MineHomePage { | ||
| 182 | Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') | 182 | Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') |
| 183 | 183 | ||
| 184 | //tab 页面 | 184 | //tab 页面 |
| 185 | - Tabs({controller: this.controller}) { | ||
| 186 | - TabContent() { | ||
| 187 | - HomePageBottomComponent({style:0,commentNum:$commentNum}) | ||
| 188 | - }.tabBar(this.TabBuilder(0,"评论")) | ||
| 189 | - TabContent() { | ||
| 190 | - HomePageBottomComponent({style:1,commentNum:$commentNum}) | ||
| 191 | - }.tabBar(this.TabBuilder(1,"关注")) | 185 | + Stack({ alignContent: Alignment.Top }){ |
| 186 | + Tabs({controller: this.controller}) { | ||
| 187 | + TabContent() { | ||
| 188 | + HomePageBottomComponent({style:0,commentNum:$commentNum}) | ||
| 189 | + } | ||
| 190 | + TabContent() { | ||
| 191 | + HomePageBottomComponent({style:1,commentNum:$commentNum}) | ||
| 192 | + } | ||
| 193 | + } | ||
| 194 | + .backgroundColor($r('app.color.white')) | ||
| 195 | + .animationDuration(0) | ||
| 196 | + .onChange((index: number) => { | ||
| 197 | + this.currentIndex = index | ||
| 198 | + }) | ||
| 199 | + .vertical(false) | ||
| 200 | + .barHeight("77lpx") | ||
| 201 | + | ||
| 202 | + Column() { | ||
| 203 | + // 页签 | ||
| 204 | + Row({ space: 7 }) { | ||
| 205 | + Scroll() { | ||
| 206 | + Row() { | ||
| 207 | + this.TabBuilder(0,"评论") | ||
| 208 | + this.TabBuilder(1,"关注") | ||
| 209 | + } | ||
| 210 | + .justifyContent(FlexAlign.Start) | ||
| 211 | + } | ||
| 212 | + .align(Alignment.Start) | ||
| 213 | + .scrollable(ScrollDirection.Horizontal) | ||
| 214 | + .scrollBar(BarState.Off) | ||
| 215 | + .width('100%') | ||
| 216 | + .padding({left:'31lpx'}) | ||
| 217 | + } | ||
| 218 | + .alignItems(VerticalAlign.Bottom) | ||
| 219 | + .width('100%') | ||
| 220 | + } | ||
| 221 | + .backgroundColor($r('app.color.white')) | ||
| 222 | + .alignItems(HorizontalAlign.Start) | ||
| 223 | + .width('100%') | ||
| 224 | + .height('77lpx') | ||
| 192 | } | 225 | } |
| 193 | - .backgroundColor($r('app.color.white')) | ||
| 194 | - .animationDuration(0) | ||
| 195 | - .onChange((index: number) => { | ||
| 196 | - this.currentIndex = index | ||
| 197 | - }) | ||
| 198 | - .vertical(false) | ||
| 199 | }.width("100%") | 226 | }.width("100%") |
| 200 | } | 227 | } |
| 201 | .edgeEffect(EdgeEffect.None) | 228 | .edgeEffect(EdgeEffect.None) |
| @@ -341,9 +368,9 @@ struct MineHomePage { | @@ -341,9 +368,9 @@ struct MineHomePage { | ||
| 341 | this.currentIndex = index | 368 | this.currentIndex = index |
| 342 | this.controller.changeIndex(this.currentIndex) | 369 | this.controller.changeIndex(this.currentIndex) |
| 343 | }) | 370 | }) |
| 344 | - .height('100%') | ||
| 345 | - .width('100%') | ||
| 346 | - .margin({right:'9lpx'}) | 371 | + .height('77lpx') |
| 372 | + .width('70lpx') | ||
| 373 | + .margin({right:'29lpx'}) | ||
| 347 | } | 374 | } |
| 348 | 375 | ||
| 349 | /** | 376 | /** |
| @@ -176,20 +176,47 @@ struct OtherNormalUserHomePage { | @@ -176,20 +176,47 @@ struct OtherNormalUserHomePage { | ||
| 176 | Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') | 176 | Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') |
| 177 | 177 | ||
| 178 | //tab 页面 | 178 | //tab 页面 |
| 179 | - Tabs({controller: this.controller}) { | ||
| 180 | - TabContent() { | ||
| 181 | - OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum}) | ||
| 182 | - }.tabBar(this.TabBuilder(0,"评论")) | ||
| 183 | - TabContent() { | ||
| 184 | - OtherHomePageBottomFollowComponent({curUserId:this.curUserId}) | ||
| 185 | - }.tabBar(this.TabBuilder(1,"关注")) | 179 | + Stack({ alignContent: Alignment.Top }){ |
| 180 | + Tabs({controller: this.controller}) { | ||
| 181 | + TabContent() { | ||
| 182 | + OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum}) | ||
| 183 | + } | ||
| 184 | + TabContent() { | ||
| 185 | + OtherHomePageBottomFollowComponent({curUserId:this.curUserId}) | ||
| 186 | + } | ||
| 187 | + } | ||
| 188 | + .backgroundColor($r('app.color.white')) | ||
| 189 | + .animationDuration(0) | ||
| 190 | + .onChange((index: number) => { | ||
| 191 | + this.currentIndex = index | ||
| 192 | + }) | ||
| 193 | + .vertical(false) | ||
| 194 | + .barHeight('77lpx') | ||
| 195 | + | ||
| 196 | + Column() { | ||
| 197 | + // 页签 | ||
| 198 | + Row({ space: 7 }) { | ||
| 199 | + Scroll() { | ||
| 200 | + Row() { | ||
| 201 | + this.TabBuilder(0,"评论") | ||
| 202 | + this.TabBuilder(1,"关注") | ||
| 203 | + } | ||
| 204 | + .justifyContent(FlexAlign.Start) | ||
| 205 | + } | ||
| 206 | + .align(Alignment.Start) | ||
| 207 | + .scrollable(ScrollDirection.Horizontal) | ||
| 208 | + .scrollBar(BarState.Off) | ||
| 209 | + .width('90%') | ||
| 210 | + .padding({left:'31lpx'}) | ||
| 211 | + } | ||
| 212 | + .alignItems(VerticalAlign.Bottom) | ||
| 213 | + .width('100%') | ||
| 214 | + } | ||
| 215 | + .backgroundColor($r('app.color.white')) | ||
| 216 | + .alignItems(HorizontalAlign.Start) | ||
| 217 | + .width('100%') | ||
| 218 | + .height('77lpx') | ||
| 186 | } | 219 | } |
| 187 | - .backgroundColor($r('app.color.white')) | ||
| 188 | - .animationDuration(0) | ||
| 189 | - .onChange((index: number) => { | ||
| 190 | - this.currentIndex = index | ||
| 191 | - }) | ||
| 192 | - .vertical(false) | ||
| 193 | }.width("100%") | 220 | }.width("100%") |
| 194 | } | 221 | } |
| 195 | .edgeEffect(EdgeEffect.None) | 222 | .edgeEffect(EdgeEffect.None) |
| @@ -300,9 +327,9 @@ struct OtherNormalUserHomePage { | @@ -300,9 +327,9 @@ struct OtherNormalUserHomePage { | ||
| 300 | this.currentIndex = index | 327 | this.currentIndex = index |
| 301 | this.controller.changeIndex(this.currentIndex) | 328 | this.controller.changeIndex(this.currentIndex) |
| 302 | }) | 329 | }) |
| 303 | - .height('100%') | ||
| 304 | - .width('100%') | ||
| 305 | - .margin({right:'9lpx'}) | 330 | + .height('77lpx') |
| 331 | + .width('70lpx') | ||
| 332 | + .margin({right:'29lpx'}) | ||
| 306 | } | 333 | } |
| 307 | 334 | ||
| 308 | 335 |
| 1 | import { HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | 1 | import { HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 2 | -import { DateTimeUtils, Logger, StringUtils } from 'wdKit'; | 2 | +import { DateTimeUtils, Logger, StringUtils, EmitterUtils, EmitterEventId } from 'wdKit'; |
| 3 | + | ||
| 3 | import { | 4 | import { |
| 4 | batchLikeAndCollectResult, | 5 | batchLikeAndCollectResult, |
| 5 | CompInfoBean, | 6 | CompInfoBean, |
| @@ -313,10 +314,32 @@ export class PageRepository { | @@ -313,10 +314,32 @@ export class PageRepository { | ||
| 313 | /** | 314 | /** |
| 314 | * 关注号主 | 315 | * 关注号主 |
| 315 | */ | 316 | */ |
| 316 | - static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> { | 317 | + private static postInteractAccentionOperateInfo(params: postInteractAccentionOperateParams): Promise<ResponseDTO> { |
| 317 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION | 318 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION |
| 318 | return WDHttp.post(url, params) | 319 | return WDHttp.post(url, params) |
| 319 | } | 320 | } |
| 321 | + /** | ||
| 322 | + * 关注号主 | ||
| 323 | + */ | ||
| 324 | + static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> { | ||
| 325 | + return new Promise<ResponseDTO>((success, error) => { | ||
| 326 | + Logger.debug(TAG, `postInteractAccentionOperate pageInfo start`); | ||
| 327 | + PageRepository.postInteractAccentionOperateInfo(params) | ||
| 328 | + .then((resDTO: ResponseDTO) => { | ||
| 329 | + if (!resDTO || resDTO.code != 0) { | ||
| 330 | + error(null) | ||
| 331 | + return | ||
| 332 | + } | ||
| 333 | + Logger.debug(TAG, "postInteractAccentionOperate then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 334 | + EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION) | ||
| 335 | + success(resDTO); | ||
| 336 | + }) | ||
| 337 | + .catch((err: Error) => { | ||
| 338 | + Logger.error(TAG, `postInteractAccentionOperate catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 339 | + error(err); | ||
| 340 | + }) | ||
| 341 | + }) | ||
| 342 | + } | ||
| 320 | 343 | ||
| 321 | static fetchNewspaperInfo(date: string) { | 344 | static fetchNewspaperInfo(date: string) { |
| 322 | let url = PageRepository.getNewspaperInfoUrl(date) | 345 | let url = PageRepository.getNewspaperInfoUrl(date) |
| 1 | +import { Logger } from 'wdKit'; | ||
| 2 | +import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | ||
| 3 | +import HashMap from '@ohos.util.HashMap'; | ||
| 4 | +import { | ||
| 5 | + RmhRecommendDTO, | ||
| 6 | + PeopleShipContentListDTO, | ||
| 7 | + AttentionBatchDTO | ||
| 8 | +} from 'wdBean'; | ||
| 9 | + | ||
| 10 | +const TAG = 'PeopleShipMainViewModel' | ||
| 11 | + | ||
| 12 | +export class PeopleShipMainViewModel { | ||
| 13 | + | ||
| 14 | + /*人民号号主推荐*/ | ||
| 15 | + static fetchPeopleRemRecommendData() { | ||
| 16 | + let url = HttpUrlUtils.getRmhRecommendUrl() | ||
| 17 | + let bean: Record<string, string> = {}; | ||
| 18 | + return WDHttp.post<ResponseDTO<RmhRecommendDTO[]>>(url, bean) | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + static async getPeopleRemRecommendInfo(): Promise<RmhRecommendDTO[]> { | ||
| 22 | + return new Promise<RmhRecommendDTO[]>((success, error) => { | ||
| 23 | + Logger.debug(TAG, `getMorningEveningCompInfo pageInfo start`); | ||
| 24 | + PeopleShipMainViewModel.fetchPeopleRemRecommendData() | ||
| 25 | + .then((resDTO: ResponseDTO<RmhRecommendDTO[]>) => { | ||
| 26 | + if (!resDTO || !resDTO.data) { | ||
| 27 | + Logger.error(TAG, 'getPeopleRemRecommendInfo then navResDTO is empty'); | ||
| 28 | + error('resDTO is empty'); | ||
| 29 | + return | ||
| 30 | + } | ||
| 31 | + if (resDTO.code != 0) { | ||
| 32 | + Logger.error(TAG, `getPeopleRemRecommendInfo then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 33 | + error('resDTO Response Code is failure'); | ||
| 34 | + return | ||
| 35 | + } | ||
| 36 | + Logger.debug(TAG, "getPeopleRemRecommendInfo then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 37 | + success(resDTO.data); | ||
| 38 | + }) | ||
| 39 | + .catch((err: Error) => { | ||
| 40 | + Logger.error(TAG, `getPeopleRemRecommendInfo catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 41 | + error(err); | ||
| 42 | + }) | ||
| 43 | + }) | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + /*关注号主发布内容接口*/ | ||
| 47 | + static fetchAttentionContentListData(pageNum: number, pageSize: number, time: string) { | ||
| 48 | + let url = HttpUrlUtils.getAttentionContentListUrl() | ||
| 49 | + let params: Record<string, Object> = {}; | ||
| 50 | + params['pageNum'] = pageNum | ||
| 51 | + params['pageSize'] = pageSize | ||
| 52 | + params['time'] = time | ||
| 53 | + return WDHttp.post<ResponseDTO<PeopleShipContentListDTO>>(url, params) | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + static async getAttentionContentListInfo(pageNum:number, pageSize: number, time: string): Promise<PeopleShipContentListDTO> { | ||
| 57 | + return new Promise<PeopleShipContentListDTO>((success, error) => { | ||
| 58 | + Logger.debug(TAG, `getAttentionContentListInfo pageInfo start`); | ||
| 59 | + PeopleShipMainViewModel.fetchAttentionContentListData(pageNum, pageSize, time) | ||
| 60 | + .then((resDTO: ResponseDTO<PeopleShipContentListDTO>) => { | ||
| 61 | + if (!resDTO || !resDTO.data) { | ||
| 62 | + Logger.error(TAG, 'getAttentionContentListInfo then navResDTO is empty'); | ||
| 63 | + error('resDTO is empty'); | ||
| 64 | + return | ||
| 65 | + } | ||
| 66 | + if (resDTO.code != 0) { | ||
| 67 | + Logger.error(TAG, `getAttentionContentListInfo then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 68 | + error('resDTO Response Code is failure'); | ||
| 69 | + return | ||
| 70 | + } | ||
| 71 | + Logger.debug(TAG, "getAttentionContentListInfo then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 72 | + success(resDTO.data); | ||
| 73 | + }) | ||
| 74 | + .catch((err: Error) => { | ||
| 75 | + Logger.error(TAG, `getAttentionContentListInfo catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 76 | + error(err); | ||
| 77 | + }) | ||
| 78 | + }) | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + /*一键关注接口*/ | ||
| 82 | + static fetchAttentionBatchData(params: AttentionBatchDTO) { | ||
| 83 | + let url = HttpUrlUtils.getAttentionBatchUrl() | ||
| 84 | + return WDHttp.post<ResponseDTO>(url, params) | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + static async getAttentionBatchInfo(params: AttentionBatchDTO): Promise<ResponseDTO> { | ||
| 88 | + return new Promise<ResponseDTO>((success, error) => { | ||
| 89 | + Logger.debug(TAG, `getAttentionBatchInfo pageInfo start`); | ||
| 90 | + PeopleShipMainViewModel.fetchAttentionBatchData(params) | ||
| 91 | + .then((resDTO: ResponseDTO) => { | ||
| 92 | + if (!resDTO || resDTO.code != 0) { | ||
| 93 | + error(resDTO.message) | ||
| 94 | + return | ||
| 95 | + } | ||
| 96 | + Logger.debug(TAG, "getAttentionBatchInfo then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 97 | + success(resDTO); | ||
| 98 | + }) | ||
| 99 | + .catch((err: Error) => { | ||
| 100 | + Logger.error(TAG, `getAttentionBatchInfo catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 101 | + error(err); | ||
| 102 | + }) | ||
| 103 | + }) | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + | ||
| 107 | +} |
5.05 KB
| 1 | -import { Logger, ResourcesUtils } from 'wdKit'; | 1 | +import { Logger, ResourcesUtils, EmitterUtils, EmitterEventId } from 'wdKit'; |
| 2 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | 2 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 3 | import { ContentDetailDTO, InteractDataDTO } from 'wdBean'; | 3 | import { ContentDetailDTO, InteractDataDTO } from 'wdBean'; |
| 4 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | 4 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; |
| @@ -321,8 +321,32 @@ export class ContentDetailRequest { | @@ -321,8 +321,32 @@ export class ContentDetailRequest { | ||
| 321 | /** | 321 | /** |
| 322 | * 关注号主 | 322 | * 关注号主 |
| 323 | */ | 323 | */ |
| 324 | - static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> { | 324 | + private static postInteractAccentionOperateInfo(params: postInteractAccentionOperateParams): Promise<ResponseDTO> { |
| 325 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION | 325 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION |
| 326 | return WDHttp.post(url, params) | 326 | return WDHttp.post(url, params) |
| 327 | } | 327 | } |
| 328 | + | ||
| 329 | + /** | ||
| 330 | + * 关注号主 | ||
| 331 | + */ | ||
| 332 | + static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> { | ||
| 333 | + return new Promise<ResponseDTO>((success, error) => { | ||
| 334 | + Logger.debug(TAG, `postInteractAccentionOperate pageInfo start`); | ||
| 335 | + ContentDetailRequest.postInteractAccentionOperateInfo(params) | ||
| 336 | + .then((resDTO: ResponseDTO) => { | ||
| 337 | + if (!resDTO || resDTO.code != 0) { | ||
| 338 | + error(null) | ||
| 339 | + return | ||
| 340 | + } | ||
| 341 | + Logger.debug(TAG, "postInteractAccentionOperate then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 342 | + // 关注号后发送-更新关注页面 | ||
| 343 | + EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION) | ||
| 344 | + success(resDTO); | ||
| 345 | + }) | ||
| 346 | + .catch((err: Error) => { | ||
| 347 | + Logger.error(TAG, `postInteractAccentionOperate catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 348 | + error(err); | ||
| 349 | + }) | ||
| 350 | + }) | ||
| 351 | + } | ||
| 328 | } | 352 | } |
| @@ -37,7 +37,7 @@ export struct LoginInputComponent { | @@ -37,7 +37,7 @@ export struct LoginInputComponent { | ||
| 37 | .type(InputType.PhoneNumber) | 37 | .type(InputType.PhoneNumber) |
| 38 | .onChange((content) => { | 38 | .onChange((content) => { |
| 39 | this.phoneContent = content | 39 | this.phoneContent = content |
| 40 | - this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 6) | 40 | + this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 4) |
| 41 | if (content.length >= 11) { | 41 | if (content.length >= 11) { |
| 42 | this.codeBtnState = true | 42 | this.codeBtnState = true |
| 43 | } else { | 43 | } else { |
| @@ -55,7 +55,7 @@ export struct LoginInputComponent { | @@ -55,7 +55,7 @@ export struct LoginInputComponent { | ||
| 55 | .type(InputType.Number) | 55 | .type(InputType.Number) |
| 56 | .onChange((content) => { | 56 | .onChange((content) => { |
| 57 | this.phoneContent = content | 57 | this.phoneContent = content |
| 58 | - this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 6) | 58 | + this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 4) |
| 59 | if (content.length >= 11) { | 59 | if (content.length >= 11) { |
| 60 | this.codeBtnState = true | 60 | this.codeBtnState = true |
| 61 | } else { | 61 | } else { |
| @@ -78,7 +78,7 @@ export struct LoginInputComponent { | @@ -78,7 +78,7 @@ export struct LoginInputComponent { | ||
| 78 | // .backgroundImageSize(ImageSize.Contain) | 78 | // .backgroundImageSize(ImageSize.Contain) |
| 79 | .onChange((value) => { | 79 | .onChange((value) => { |
| 80 | this.codeContent = value | 80 | this.codeContent = value |
| 81 | - this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 6) | 81 | + this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 4) |
| 82 | }) | 82 | }) |
| 83 | 83 | ||
| 84 | Text(this.isCodeSend ? this.timeCount + "s" : this.isFirst?"发送验证码":'重新发送') | 84 | Text(this.isCodeSend ? this.timeCount + "s" : this.isFirst?"发送验证码":'重新发送') |
| @@ -13,9 +13,9 @@ export class LoginModel { | @@ -13,9 +13,9 @@ export class LoginModel { | ||
| 13 | sendVerifyCode(number: string) { | 13 | sendVerifyCode(number: string) { |
| 14 | let bean: Record<string, string> = {}; | 14 | let bean: Record<string, string> = {}; |
| 15 | bean['phoneNum'] = number | 15 | bean['phoneNum'] = number |
| 16 | - return new Promise<string>((success, fail) => { | ||
| 17 | - HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.getVerifyCodeUrl(), bean).then((data: ResponseDTO<string>) => { | ||
| 18 | - if (!data || !data.data) { | 16 | + return new Promise<object>((success, fail) => { |
| 17 | + HttpRequest.post<ResponseDTO<object>>(HttpUrlUtils.getVerifyCodeUrl(), bean).then((data: ResponseDTO<object>) => { | ||
| 18 | + if (!data) { | ||
| 19 | fail("数据为空") | 19 | fail("数据为空") |
| 20 | return | 20 | return |
| 21 | } | 21 | } |
| @@ -23,7 +23,7 @@ export class LoginModel { | @@ -23,7 +23,7 @@ export class LoginModel { | ||
| 23 | fail(data.message) | 23 | fail(data.message) |
| 24 | return | 24 | return |
| 25 | } | 25 | } |
| 26 | - success(data.data) | 26 | + success(data) |
| 27 | }, (error: Error) => { | 27 | }, (error: Error) => { |
| 28 | fail(error.message) | 28 | fail(error.message) |
| 29 | Logger.debug("LoginViewModel:error ", error.toString()) | 29 | Logger.debug("LoginViewModel:error ", error.toString()) |
| 1 | -import { Logger } from 'wdKit/src/main/ets/utils/Logger' | 1 | +import { Logger, EmitterEventId, EmitterUtils } from 'wdKit' |
| 2 | import { CustomProtocolDialog } from './CustomProtocolDialog' | 2 | import { CustomProtocolDialog } from './CustomProtocolDialog' |
| 3 | import router from '@ohos.router' | 3 | import router from '@ohos.router' |
| 4 | import { LoginViewModel } from './LoginViewModel' | 4 | import { LoginViewModel } from './LoginViewModel' |
| @@ -325,6 +325,7 @@ struct LoginPage { | @@ -325,6 +325,7 @@ struct LoginPage { | ||
| 325 | let interestsModel = new InterestsHobbiesModel() | 325 | let interestsModel = new InterestsHobbiesModel() |
| 326 | interestsModel.updateInterests() | 326 | interestsModel.updateInterests() |
| 327 | this.queryUserDetail() | 327 | this.queryUserDetail() |
| 328 | + EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION) | ||
| 328 | }).catch((error:string)=>{ | 329 | }).catch((error:string)=>{ |
| 329 | promptAction.showToast({ message: error }) | 330 | promptAction.showToast({ message: error }) |
| 330 | }) | 331 | }) |
| @@ -332,11 +333,12 @@ struct LoginPage { | @@ -332,11 +333,12 @@ struct LoginPage { | ||
| 332 | this.loginViewModel.appLoginByPassword(this.accountContent, 0, this.passwordContent, "").then((data) => { | 333 | this.loginViewModel.appLoginByPassword(this.accountContent, 0, this.passwordContent, "").then((data) => { |
| 333 | Logger.debug(TAG, "requestLogin: " + data.jwtToken) | 334 | Logger.debug(TAG, "requestLogin: " + data.jwtToken) |
| 334 | promptAction.showToast({ message: '登录成功' }) | 335 | promptAction.showToast({ message: '登录成功' }) |
| 335 | - | ||
| 336 | ///同步兴趣tag | 336 | ///同步兴趣tag |
| 337 | let interestsModel = new InterestsHobbiesModel() | 337 | let interestsModel = new InterestsHobbiesModel() |
| 338 | interestsModel.updateInterests() | 338 | interestsModel.updateInterests() |
| 339 | this.queryUserDetail() | 339 | this.queryUserDetail() |
| 340 | + EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION) | ||
| 341 | + | ||
| 340 | // router.back({ | 342 | // router.back({ |
| 341 | // params: { userName: data.userName, | 343 | // params: { userName: data.userName, |
| 342 | // userId:data.id}, | 344 | // userId:data.id}, |
| @@ -22,7 +22,7 @@ export class LoginViewModel { | @@ -22,7 +22,7 @@ export class LoginViewModel { | ||
| 22 | 22 | ||
| 23 | //发送验证码 | 23 | //发送验证码 |
| 24 | sendVerifyCode(number: string) { | 24 | sendVerifyCode(number: string) { |
| 25 | - return new Promise<string>((success, fail) => { | 25 | + return new Promise<object>((success, fail) => { |
| 26 | this.loginModel.sendVerifyCode(number).then((data) => { | 26 | this.loginModel.sendVerifyCode(number).then((data) => { |
| 27 | success(data) | 27 | success(data) |
| 28 | }).catch((message: string) => { | 28 | }).catch((message: string) => { |
-
Please register or login to post a comment