Showing
12 changed files
with
245 additions
and
17 deletions
| @@ -136,6 +136,14 @@ export class HttpUrlUtils { | @@ -136,6 +136,14 @@ export class HttpUrlUtils { | ||
| 136 | static readonly APPOINTMENT_OPERATION_STATUS_PATH: string = "/api/live-center-message/zh/c/live/subscribe"; | 136 | static readonly APPOINTMENT_OPERATION_STATUS_PATH: string = "/api/live-center-message/zh/c/live/subscribe"; |
| 137 | 137 | ||
| 138 | /** | 138 | /** |
| 139 | + * 预约操作 | ||
| 140 | + */ | ||
| 141 | + static readonly COMMENT_LIKE_OPERATION_PATH: string = "/api/rmrb-comment/comment/zh/c/commentLike"; | ||
| 142 | + /** | ||
| 143 | + * 关注操作 | ||
| 144 | + */ | ||
| 145 | + static readonly FOLLOW_OPERATION_PATH: string = "https://pd-apis-sit.pdnews.cn/api/rmrb-interact/interact/zh/c/attention/operation"; | ||
| 146 | + /** | ||
| 139 | * 早晚报列表 | 147 | * 早晚报列表 |
| 140 | * 根据页面id获取页面楼层列表 | 148 | * 根据页面id获取页面楼层列表 |
| 141 | * https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/pageInfo?pageId=28927 | 149 | * https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/pageInfo?pageId=28927 |
| @@ -318,7 +326,7 @@ export class HttpUrlUtils { | @@ -318,7 +326,7 @@ export class HttpUrlUtils { | ||
| 318 | return HttpUrlUtils.userId; | 326 | return HttpUrlUtils.userId; |
| 319 | } | 327 | } |
| 320 | 328 | ||
| 321 | - private static getUserType() { | 329 | + public static getUserType() { |
| 322 | let userType = SPHelper.default.getSync(SpConstants.USER_Type,"") | 330 | let userType = SPHelper.default.getSync(SpConstants.USER_Type,"") |
| 323 | if(StringUtils.isNotEmpty(userType)) { | 331 | if(StringUtils.isNotEmpty(userType)) { |
| 324 | return userType as string; | 332 | return userType as string; |
| @@ -443,6 +451,16 @@ export class HttpUrlUtils { | @@ -443,6 +451,16 @@ export class HttpUrlUtils { | ||
| 443 | return url | 451 | return url |
| 444 | } | 452 | } |
| 445 | 453 | ||
| 454 | + static getCommentLikeOperationUrl() { | ||
| 455 | + let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.COMMENT_LIKE_OPERATION_PATH | ||
| 456 | + return url | ||
| 457 | + } | ||
| 458 | + | ||
| 459 | + static getFollowOperationUrl() { | ||
| 460 | + let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.FOLLOW_OPERATION_PATH | ||
| 461 | + return url | ||
| 462 | + } | ||
| 463 | + | ||
| 446 | 464 | ||
| 447 | static getYcgCommonHeaders(): HashMap<string, string> { | 465 | static getYcgCommonHeaders(): HashMap<string, string> { |
| 448 | let headers: HashMap<string, string> = new HashMap<string, string>() | 466 | let headers: HashMap<string, string> = new HashMap<string, string>() |
| 1 | import { Params } from 'wdBean'; | 1 | import { Params } from 'wdBean'; |
| 2 | import { LazyDataSource, StringUtils } from 'wdKit'; | 2 | import { LazyDataSource, StringUtils } from 'wdKit'; |
| 3 | +import { HttpUrlUtils } from 'wdNetwork'; | ||
| 3 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 4 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 4 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; | 5 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; |
| 5 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem' | 6 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem' |
| 6 | import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem'; | 7 | import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem'; |
| 7 | import { FollowListStatusRequestItem } from '../../../viewmodel/FollowListStatusRequestItem'; | 8 | import { FollowListStatusRequestItem } from '../../../viewmodel/FollowListStatusRequestItem'; |
| 9 | +import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRequestItem'; | ||
| 8 | import { MineFollowListDetailItem } from '../../../viewmodel/MineFollowListDetailItem'; | 10 | import { MineFollowListDetailItem } from '../../../viewmodel/MineFollowListDetailItem'; |
| 9 | import { QueryListIsFollowedItem } from '../../../viewmodel/QueryListIsFollowedItem'; | 11 | import { QueryListIsFollowedItem } from '../../../viewmodel/QueryListIsFollowedItem'; |
| 10 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | 12 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; |
| @@ -74,7 +76,7 @@ export struct FollowListDetailUI{ | @@ -74,7 +76,7 @@ export struct FollowListDetailUI{ | ||
| 74 | this.hasMore = false | 76 | this.hasMore = false |
| 75 | }else{ | 77 | }else{ |
| 76 | value.list.forEach((value)=>{ | 78 | value.list.forEach((value)=>{ |
| 77 | - this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1",value.attentionUserId)) | 79 | + this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId)) |
| 78 | }) | 80 | }) |
| 79 | this.data.notifyDataReload() | 81 | this.data.notifyDataReload() |
| 80 | this.count = this.data.totalCount() | 82 | this.count = this.data.totalCount() |
| @@ -114,7 +116,7 @@ export struct FollowListDetailUI{ | @@ -114,7 +116,7 @@ export struct FollowListDetailUI{ | ||
| 114 | let data : FollowListDetailItem[] = [] | 116 | let data : FollowListDetailItem[] = [] |
| 115 | value.list.forEach((item)=>{ | 117 | value.list.forEach((item)=>{ |
| 116 | status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId)) | 118 | status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId)) |
| 117 | - data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,"0",item.attentionUserId)) | 119 | + data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,"0",item.attentionUserId,item.cnUserType,item.cnUserId)) |
| 118 | }) | 120 | }) |
| 119 | 121 | ||
| 120 | MinePageDatasModel.getFollowListStatusData(status,getContext(this)).then((newValue)=>{ | 122 | MinePageDatasModel.getFollowListStatusData(status,getContext(this)).then((newValue)=>{ |
| @@ -127,7 +129,7 @@ export struct FollowListDetailUI{ | @@ -127,7 +129,7 @@ export struct FollowListDetailUI{ | ||
| 127 | }) | 129 | }) |
| 128 | 130 | ||
| 129 | data.forEach((item)=>{ | 131 | data.forEach((item)=>{ |
| 130 | - this.data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,item.status,item.attentionUserId)) | 132 | + this.data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,item.status,item.attentionUserId,item.cnUserType,item.cnUserId)) |
| 131 | }) | 133 | }) |
| 132 | 134 | ||
| 133 | this.data.notifyDataReload() | 135 | this.data.notifyDataReload() |
| @@ -197,7 +199,8 @@ struct ChildComponent { | @@ -197,7 +199,8 @@ struct ChildComponent { | ||
| 197 | .height('46lpx') | 199 | .height('46lpx') |
| 198 | .margin({left:'4lpx',top:'23lpx'}) | 200 | .margin({left:'4lpx',top:'23lpx'}) |
| 199 | .onClick(()=>{ | 201 | .onClick(()=>{ |
| 200 | - this.data.status = "0" | 202 | + this.followOperation() |
| 203 | + // this.data.status = "0" | ||
| 201 | }) | 204 | }) |
| 202 | }else{ | 205 | }else{ |
| 203 | Row(){ | 206 | Row(){ |
| @@ -218,7 +221,8 @@ struct ChildComponent { | @@ -218,7 +221,8 @@ struct ChildComponent { | ||
| 218 | .height('46lpx') | 221 | .height('46lpx') |
| 219 | .margin({left:'4lpx',top:'23lpx'}) | 222 | .margin({left:'4lpx',top:'23lpx'}) |
| 220 | .onClick(()=>{ | 223 | .onClick(()=>{ |
| 221 | - this.data.status = "1" | 224 | + this.followOperation() |
| 225 | + // this.data.status = "1" | ||
| 222 | }) | 226 | }) |
| 223 | } | 227 | } |
| 224 | }.alignItems(VerticalAlign.Top) | 228 | }.alignItems(VerticalAlign.Top) |
| @@ -240,4 +244,15 @@ struct ChildComponent { | @@ -240,4 +244,15 @@ struct ChildComponent { | ||
| 240 | // WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params) | 244 | // WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params) |
| 241 | }) | 245 | }) |
| 242 | } | 246 | } |
| 247 | + | ||
| 248 | + followOperation(){ | ||
| 249 | + let item = new FollowOperationRequestItem(this.data.cnUserType,this.data.cnUserId,this.data.creatorId,HttpUrlUtils.getUserType(),HttpUrlUtils.getUserId(),this.data.status==="0" ? 1:0) | ||
| 250 | + MinePageDatasModel.getFollowOperation(item,getContext(this)).then((value)=>{ | ||
| 251 | + if(value!=null){ | ||
| 252 | + if (value.code === 0 || value.code.toString() === "0") { | ||
| 253 | + this.data.status = this.data.status ==="0"?"1":"0" | ||
| 254 | + } | ||
| 255 | + } | ||
| 256 | + }) | ||
| 257 | + } | ||
| 243 | } | 258 | } |
| 1 | import { Params } from 'wdBean'; | 1 | import { Params } from 'wdBean'; |
| 2 | import { LazyDataSource, StringUtils } from 'wdKit'; | 2 | import { LazyDataSource, StringUtils } from 'wdKit'; |
| 3 | +import { HttpUrlUtils } from 'wdNetwork'; | ||
| 3 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 4 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 4 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; | 5 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; |
| 5 | import { CommentListItem } from '../../../viewmodel/CommentListItem'; | 6 | import { CommentListItem } from '../../../viewmodel/CommentListItem'; |
| 6 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; | 7 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; |
| 7 | import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem'; | 8 | import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem'; |
| 9 | +import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRequestItem'; | ||
| 8 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | 10 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; |
| 9 | 11 | ||
| 10 | const TAG = "HomePageBottomComponent" | 12 | const TAG = "HomePageBottomComponent" |
| @@ -155,7 +157,7 @@ export struct HomePageBottomComponent{ | @@ -155,7 +157,7 @@ export struct HomePageBottomComponent{ | ||
| 155 | this.hasMore = false | 157 | this.hasMore = false |
| 156 | }else{ | 158 | }else{ |
| 157 | value.list.forEach((value)=>{ | 159 | value.list.forEach((value)=>{ |
| 158 | - this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1",value.attentionUserId)) | 160 | + this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId)) |
| 159 | }) | 161 | }) |
| 160 | this.data_follow.notifyDataReload() | 162 | this.data_follow.notifyDataReload() |
| 161 | this.count = this.data_follow.totalCount() | 163 | this.count = this.data_follow.totalCount() |
| @@ -180,7 +182,7 @@ export struct HomePageBottomComponent{ | @@ -180,7 +182,7 @@ export struct HomePageBottomComponent{ | ||
| 180 | this.hasMore = false | 182 | this.hasMore = false |
| 181 | }else{ | 183 | }else{ |
| 182 | value.list.forEach((value)=>{ | 184 | value.list.forEach((value)=>{ |
| 183 | - this.data_comment.push(new CommentListItem(value.fromUserHeader,value.fromUserName,value.targetTitle,value.createTime,value.commentContent,value.likeNum,0,value.id)) | 185 | + this.data_comment.push(new CommentListItem(value.fromUserHeader,value.fromUserName,value.targetTitle,value.createTime,value.commentContent,value.likeNum,0,value.id,value.targetId,value.targetType)) |
| 184 | }) | 186 | }) |
| 185 | this.data_comment.notifyDataReload() | 187 | this.data_comment.notifyDataReload() |
| 186 | this.count = this.data_comment.totalCount() | 188 | this.count = this.data_comment.totalCount() |
| @@ -249,7 +251,8 @@ struct ChildFollowComponent { | @@ -249,7 +251,8 @@ struct ChildFollowComponent { | ||
| 249 | .height('46lpx') | 251 | .height('46lpx') |
| 250 | .margin({left:'4lpx',top:'23lpx'}) | 252 | .margin({left:'4lpx',top:'23lpx'}) |
| 251 | .onClick(()=>{ | 253 | .onClick(()=>{ |
| 252 | - this.data.status = "0" | 254 | + // this.data.status = "0" |
| 255 | + this.followOperation() | ||
| 253 | }) | 256 | }) |
| 254 | }else{ | 257 | }else{ |
| 255 | Row(){ | 258 | Row(){ |
| @@ -270,7 +273,8 @@ struct ChildFollowComponent { | @@ -270,7 +273,8 @@ struct ChildFollowComponent { | ||
| 270 | .height('46lpx') | 273 | .height('46lpx') |
| 271 | .margin({left:'4lpx',top:'23lpx'}) | 274 | .margin({left:'4lpx',top:'23lpx'}) |
| 272 | .onClick(()=>{ | 275 | .onClick(()=>{ |
| 273 | - this.data.status = "1" | 276 | + // this.data.status = "1" |
| 277 | + this.followOperation() | ||
| 274 | }) | 278 | }) |
| 275 | } | 279 | } |
| 276 | }.alignItems(VerticalAlign.Top) | 280 | }.alignItems(VerticalAlign.Top) |
| @@ -285,6 +289,18 @@ struct ChildFollowComponent { | @@ -285,6 +289,18 @@ struct ChildFollowComponent { | ||
| 285 | }.height('146lpx') | 289 | }.height('146lpx') |
| 286 | .justifyContent(FlexAlign.Center) | 290 | .justifyContent(FlexAlign.Center) |
| 287 | } | 291 | } |
| 292 | + | ||
| 293 | + followOperation(){ | ||
| 294 | + let item = new FollowOperationRequestItem(this.data.cnUserType,this.data.cnUserId,this.data.creatorId,HttpUrlUtils.getUserType(),HttpUrlUtils.getUserId(),this.data.status==="0" ? 1:0) | ||
| 295 | + MinePageDatasModel.getFollowOperation(item,getContext(this)).then((value)=>{ | ||
| 296 | + if(value!=null){ | ||
| 297 | + if (value.code === 0 || value.code.toString() === "0") { | ||
| 298 | + this.data.status = this.data.status ==="0"?"1":"0" | ||
| 299 | + } | ||
| 300 | + } | ||
| 301 | + }) | ||
| 302 | + } | ||
| 303 | + | ||
| 288 | } | 304 | } |
| 289 | 305 | ||
| 290 | @Component | 306 | @Component |
| @@ -5,6 +5,7 @@ import { OtherUserCommentListRequestItem } from '../../../viewmodel/OtherUserCom | @@ -5,6 +5,7 @@ import { OtherUserCommentListRequestItem } from '../../../viewmodel/OtherUserCom | ||
| 5 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | 5 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; |
| 6 | import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem'; | 6 | import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem'; |
| 7 | import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; | 7 | import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; |
| 8 | +import { CommentLikeOperationRequestItem } from '../../../viewmodel/CommentLikeOperationRequestItem'; | ||
| 8 | 9 | ||
| 9 | const TAG = "HomePageBottomComponent" | 10 | const TAG = "HomePageBottomComponent" |
| 10 | @Component | 11 | @Component |
| @@ -102,7 +103,7 @@ export struct OtherHomePageBottomCommentComponent{ | @@ -102,7 +103,7 @@ export struct OtherHomePageBottomCommentComponent{ | ||
| 102 | let data : CommentListItem[] = [] | 103 | let data : CommentListItem[] = [] |
| 103 | value.list.forEach((item)=>{ | 104 | value.list.forEach((item)=>{ |
| 104 | status.commentIdList.push(item.id) | 105 | status.commentIdList.push(item.id) |
| 105 | - data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,0,item.id)) | 106 | + data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,0,item.id,item.targetId,item.targetType)) |
| 106 | }) | 107 | }) |
| 107 | 108 | ||
| 108 | MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{ | 109 | MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{ |
| @@ -115,7 +116,7 @@ export struct OtherHomePageBottomCommentComponent{ | @@ -115,7 +116,7 @@ export struct OtherHomePageBottomCommentComponent{ | ||
| 115 | }) | 116 | }) |
| 116 | 117 | ||
| 117 | data.forEach((item)=>{ | 118 | data.forEach((item)=>{ |
| 118 | - this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,item.like_status,item.id)) | 119 | + this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,item.like_status,item.id,item.targetId,item.targetType)) |
| 119 | }) | 120 | }) |
| 120 | 121 | ||
| 121 | this.data_comment.notifyDataReload() | 122 | this.data_comment.notifyDataReload() |
| @@ -190,8 +191,9 @@ struct ChildCommentComponent { | @@ -190,8 +191,9 @@ struct ChildCommentComponent { | ||
| 190 | .objectFit(ImageFit.Auto) | 191 | .objectFit(ImageFit.Auto) |
| 191 | .interpolation(ImageInterpolation.Medium) | 192 | .interpolation(ImageInterpolation.Medium) |
| 192 | .borderRadius(50) | 193 | .borderRadius(50) |
| 193 | - } | ||
| 194 | - | 194 | + }.onClick(()=>{ |
| 195 | + this.commentLikeOperation() | ||
| 196 | + }) | ||
| 195 | } | 197 | } |
| 196 | .margin({bottom:'10lpx'}) | 198 | .margin({bottom:'10lpx'}) |
| 197 | .width('100%') | 199 | .width('100%') |
| @@ -238,4 +240,16 @@ struct ChildCommentComponent { | @@ -238,4 +240,16 @@ struct ChildCommentComponent { | ||
| 238 | } | 240 | } |
| 239 | .justifyContent(FlexAlign.Center) | 241 | .justifyContent(FlexAlign.Center) |
| 240 | } | 242 | } |
| 243 | + | ||
| 244 | + commentLikeOperation(){ | ||
| 245 | + let item = new CommentLikeOperationRequestItem(this.data.targetId,this.data.id+"",this.data.targetType+"",this.data.fromUserName,this.data.fromUserHeader,this.data.like_status===0?1:0) | ||
| 246 | + MinePageDatasModel.getCommentLikeOperation(item,getContext(this)).then((value)=>{ | ||
| 247 | + if(value!=null){ | ||
| 248 | + if (value.code === 0 || value.code.toString() === "0") { | ||
| 249 | + this.data.like_status = this.data.like_status===0?1:0 | ||
| 250 | + this.data.likeNum = this.data.like_status===0?this.data.likeNum-1:this.data.likeNum+1 | ||
| 251 | + } | ||
| 252 | + } | ||
| 253 | + }) | ||
| 254 | + } | ||
| 241 | } | 255 | } |
| @@ -116,7 +116,7 @@ export struct OtherHomePageBottomFollowComponent{ | @@ -116,7 +116,7 @@ export struct OtherHomePageBottomFollowComponent{ | ||
| 116 | this.hasMore = false | 116 | this.hasMore = false |
| 117 | }else{ | 117 | }else{ |
| 118 | value.list.forEach((value)=>{ | 118 | value.list.forEach((value)=>{ |
| 119 | - this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1",value.attentionUserId)) | 119 | + this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.cnUserType,value.cnUserId)) |
| 120 | }) | 120 | }) |
| 121 | this.data_follow.notifyDataReload() | 121 | this.data_follow.notifyDataReload() |
| 122 | this.count = this.data_follow.totalCount() | 122 | this.count = this.data_follow.totalCount() |
| @@ -21,6 +21,8 @@ import { OtherUserCommentLikeStatusRequestItem } from '../viewmodel/OtherUserCom | @@ -21,6 +21,8 @@ import { OtherUserCommentLikeStatusRequestItem } from '../viewmodel/OtherUserCom | ||
| 21 | import { QueryCommentListIsLikedItem } from '../viewmodel/QueryCommentListIsLikedItem'; | 21 | import { QueryCommentListIsLikedItem } from '../viewmodel/QueryCommentListIsLikedItem'; |
| 22 | import { UserFollowListRequestItem } from '../viewmodel/UserFollowListRequestItem'; | 22 | import { UserFollowListRequestItem } from '../viewmodel/UserFollowListRequestItem'; |
| 23 | import { AppointmentOperationRequestItem } from '../viewmodel/AppointmentOperationRequestItem'; | 23 | import { AppointmentOperationRequestItem } from '../viewmodel/AppointmentOperationRequestItem'; |
| 24 | +import { CommentLikeOperationRequestItem } from '../viewmodel/CommentLikeOperationRequestItem'; | ||
| 25 | +import { FollowOperationRequestItem } from '../viewmodel/FollowOperationRequestItem'; | ||
| 24 | 26 | ||
| 25 | const TAG = "MinePageDatasModel" | 27 | const TAG = "MinePageDatasModel" |
| 26 | 28 | ||
| @@ -664,6 +666,86 @@ class MinePageDatasModel{ | @@ -664,6 +666,86 @@ class MinePageDatasModel{ | ||
| 664 | } | 666 | } |
| 665 | 667 | ||
| 666 | 668 | ||
| 669 | + /** | ||
| 670 | + * 评论点赞操作 | ||
| 671 | + * @param params | ||
| 672 | + * @param context | ||
| 673 | + * @returns | ||
| 674 | + */ | ||
| 675 | + getCommentLikeOperation(params:CommentLikeOperationRequestItem,context: Context): Promise<ResponseDTO> { | ||
| 676 | + return new Promise((success, error) => { | ||
| 677 | + Logger.info(TAG, `getAppointmentList start`); | ||
| 678 | + this.fetchCommentLikeOperation(params).then((navResDTO: ResponseDTO) => { | ||
| 679 | + if (!navResDTO || navResDTO.code != 0) { | ||
| 680 | + success(this.getCommentLikeOperationLocal(context)) | ||
| 681 | + return | ||
| 682 | + } | ||
| 683 | + Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | ||
| 684 | + success(navResDTO); | ||
| 685 | + }).catch((err: Error) => { | ||
| 686 | + Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 687 | + success(this.getCommentLikeOperationLocal(context)) | ||
| 688 | + }) | ||
| 689 | + }) | ||
| 690 | + } | ||
| 691 | + | ||
| 692 | + fetchCommentLikeOperation(object:CommentLikeOperationRequestItem) { | ||
| 693 | + let url = HttpUrlUtils.getCommentLikeOperationUrl() | ||
| 694 | + let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders(); | ||
| 695 | + return WDHttp.post<ResponseDTO>(url,object, headers) | ||
| 696 | + }; | ||
| 697 | + | ||
| 698 | + async getCommentLikeOperationLocal(context: Context): Promise<ResponseDTO> { | ||
| 699 | + Logger.info(TAG, `getMineFollowListDataLocal start`); | ||
| 700 | + let compRes: ResponseDTO | null = await ResourcesUtils.getResourcesJson<ResponseDTO>(context,'comment_like_operation_data.json'); | ||
| 701 | + if (!compRes ) { | ||
| 702 | + Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`); | ||
| 703 | + return compRes | ||
| 704 | + } | ||
| 705 | + Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 706 | + return compRes | ||
| 707 | + } | ||
| 708 | + | ||
| 709 | + /** | ||
| 710 | + * 关注 取消关注 操作 | ||
| 711 | + * @param params | ||
| 712 | + * @param context | ||
| 713 | + * @returns | ||
| 714 | + */ | ||
| 715 | + getFollowOperation(params:FollowOperationRequestItem,context: Context): Promise<ResponseDTO> { | ||
| 716 | + return new Promise((success, error) => { | ||
| 717 | + Logger.info(TAG, `getAppointmentList start`); | ||
| 718 | + this.fetchFollowOperation(params).then((navResDTO: ResponseDTO) => { | ||
| 719 | + if (!navResDTO || navResDTO.code != 0) { | ||
| 720 | + success(this.getFollowOperationLocal(context)) | ||
| 721 | + return | ||
| 722 | + } | ||
| 723 | + Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | ||
| 724 | + success(navResDTO); | ||
| 725 | + }).catch((err: Error) => { | ||
| 726 | + Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 727 | + success(this.getFollowOperationLocal(context)) | ||
| 728 | + }) | ||
| 729 | + }) | ||
| 730 | + } | ||
| 731 | + | ||
| 732 | + fetchFollowOperation(object:FollowOperationRequestItem) { | ||
| 733 | + let url = HttpUrlUtils.getFollowOperationUrl() | ||
| 734 | + let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders(); | ||
| 735 | + return WDHttp.post<ResponseDTO>(url,object, headers) | ||
| 736 | + }; | ||
| 737 | + | ||
| 738 | + async getFollowOperationLocal(context: Context): Promise<ResponseDTO> { | ||
| 739 | + Logger.info(TAG, `getMineFollowListDataLocal start`); | ||
| 740 | + let compRes: ResponseDTO | null = await ResourcesUtils.getResourcesJson<ResponseDTO>(context,'follow_operation_data.json'); | ||
| 741 | + if (!compRes ) { | ||
| 742 | + Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`); | ||
| 743 | + return compRes | ||
| 744 | + } | ||
| 745 | + Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 746 | + return compRes | ||
| 747 | + } | ||
| 748 | + | ||
| 667 | 749 | ||
| 668 | } | 750 | } |
| 669 | 751 |
sight_harmony/features/wdComponent/src/main/ets/viewmodel/CommentLikeOperationRequestItem.ets
0 → 100644
| 1 | +// { | ||
| 2 | +// "targetId":"30000627490", | ||
| 3 | +// "commentId":"303318", | ||
| 4 | +// "targetType":"13", | ||
| 5 | +// "userName":"人民日报网友aPrtq5", | ||
| 6 | +// "userHeaderUrl":"https://sitcontentjdcdn.aikan.pdnews.cn//img/user/2024031215/48d5bd53227d436b9faa937b3ac14600.png", | ||
| 7 | +// "status":1 | ||
| 8 | +// } | ||
| 9 | +export class CommentLikeOperationRequestItem{ | ||
| 10 | + targetId:string = "" | ||
| 11 | + commentId:string = "" | ||
| 12 | + targetType:string = "" | ||
| 13 | + userName:string = "" | ||
| 14 | + userHeaderUrl:string = "" | ||
| 15 | + status:number = 1 | ||
| 16 | + | ||
| 17 | + constructor(targetId: string, commentId: string, targetType: string , userName: string, | ||
| 18 | + userHeaderUrl: string , status:number) { | ||
| 19 | + this.targetId = targetId | ||
| 20 | + this.commentId = commentId | ||
| 21 | + this.targetId = targetId | ||
| 22 | + this.userName = userName | ||
| 23 | + this.userHeaderUrl = userHeaderUrl | ||
| 24 | + this.status = status | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +} |
| @@ -10,8 +10,11 @@ export class CommentListItem{ | @@ -10,8 +10,11 @@ export class CommentListItem{ | ||
| 10 | likeNum:number = 0 | 10 | likeNum:number = 0 |
| 11 | like_status:number = 0 | 11 | like_status:number = 0 |
| 12 | id:number = 0 | 12 | id:number = 0 |
| 13 | + targetId:string = "" | ||
| 14 | + targetType:number = 0 | ||
| 13 | 15 | ||
| 14 | - constructor(fromUserHeader:string,fromUserName:string,targetTitle:string,createTime:string,commentContent:string,likeNum:number,like_status:number,id:number) { | 16 | + |
| 17 | + constructor(fromUserHeader:string,fromUserName:string,targetTitle:string,createTime:string,commentContent:string,likeNum:number,like_status:number,id:number,targetId:string,targetType:number) { | ||
| 15 | this.fromUserHeader = fromUserHeader | 18 | this.fromUserHeader = fromUserHeader |
| 16 | this.fromUserName = fromUserName | 19 | this.fromUserName = fromUserName |
| 17 | this.commentContent = commentContent | 20 | this.commentContent = commentContent |
| @@ -20,5 +23,7 @@ export class CommentListItem{ | @@ -20,5 +23,7 @@ export class CommentListItem{ | ||
| 20 | this.likeNum = likeNum | 23 | this.likeNum = likeNum |
| 21 | this.like_status = like_status | 24 | this.like_status = like_status |
| 22 | this.id = id | 25 | this.id = id |
| 26 | + this.targetId = targetId | ||
| 27 | + this.targetType = targetType | ||
| 23 | } | 28 | } |
| 24 | } | 29 | } |
| @@ -69,13 +69,18 @@ export class FollowListDetailItem{ | @@ -69,13 +69,18 @@ export class FollowListDetailItem{ | ||
| 69 | creatorId:string = "" | 69 | creatorId:string = "" |
| 70 | attentionUserId:string = "" | 70 | attentionUserId:string = "" |
| 71 | 71 | ||
| 72 | + cnUserType:string = "" | ||
| 73 | + cnUserId:string = "" | ||
| 74 | + | ||
| 72 | attentionCreatorId:string = "" | 75 | attentionCreatorId:string = "" |
| 76 | + attentionUserType:string = "" | ||
| 77 | + | ||
| 73 | attentionHeadPhotoUrl:string = "" | 78 | attentionHeadPhotoUrl:string = "" |
| 74 | attentionUserName:string = "" | 79 | attentionUserName:string = "" |
| 75 | fansNum :number = 0 | 80 | fansNum :number = 0 |
| 76 | 81 | ||
| 77 | 82 | ||
| 78 | - constructor(headPhotoUrl:string,cnUserName:string,cnFansNum:number,introduction:string,creatorId:string,status:string,attentionUserId:string) { | 83 | + constructor(headPhotoUrl:string,cnUserName:string,cnFansNum:number,introduction:string,creatorId:string,status:string,attentionUserId:string,cnUserType:string,cnUserId:string) { |
| 79 | this.headPhotoUrl = headPhotoUrl | 84 | this.headPhotoUrl = headPhotoUrl |
| 80 | this.cnUserName = cnUserName | 85 | this.cnUserName = cnUserName |
| 81 | this.cnFansNum = cnFansNum | 86 | this.cnFansNum = cnFansNum |
| @@ -83,5 +88,7 @@ export class FollowListDetailItem{ | @@ -83,5 +88,7 @@ export class FollowListDetailItem{ | ||
| 83 | this.creatorId = creatorId | 88 | this.creatorId = creatorId |
| 84 | this.status = status | 89 | this.status = status |
| 85 | this.attentionUserId = attentionUserId | 90 | this.attentionUserId = attentionUserId |
| 91 | + this.cnUserType = cnUserType | ||
| 92 | + this.cnUserId = cnUserId | ||
| 86 | } | 93 | } |
| 87 | } | 94 | } |
| 1 | +// { | ||
| 2 | +// "attentionUserType":"2", | ||
| 3 | +// "attentionUserId":"444911718724933", | ||
| 4 | +// "attentionCreatorId":"3004861", | ||
| 5 | +// "userType":1, | ||
| 6 | +// "userId":"567387477063621", | ||
| 7 | +// "status":1 | ||
| 8 | +// } | ||
| 9 | +export class FollowOperationRequestItem{ | ||
| 10 | + attentionUserType:string = "" | ||
| 11 | + attentionUserId:string = "" | ||
| 12 | + attentionCreatorId:string = "" | ||
| 13 | + userType:string = "" | ||
| 14 | + userId:string = "" | ||
| 15 | + status:number = 1 | ||
| 16 | + | ||
| 17 | + constructor(attentionUserType:string, attentionUserId:string, attentionCreatorId:string, userType:string, userId:string, status:number) { | ||
| 18 | + this.attentionUserType = attentionUserType | ||
| 19 | + this.attentionUserId = attentionUserId | ||
| 20 | + this.attentionCreatorId = attentionCreatorId | ||
| 21 | + this.userType = userType | ||
| 22 | + this.userId = userId | ||
| 23 | + this.status = status | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | +} |
-
Please register or login to post a comment