xugenyuan

ref |> 统一处理评论列表点击头像跳转逻辑

Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
@@ -455,7 +455,7 @@ struct commentHeaderView { @@ -455,7 +455,7 @@ struct commentHeaderView {
455 .margin({ left: 8 }) 455 .margin({ left: 8 })
456 .alignContent(Alignment.Center) 456 .alignContent(Alignment.Center)
457 .onClick(() => { 457 .onClick(() => {
458 - // TODO 跳转个人详情 458 + commentViewModel.jumpToAccountPage(this.item)
459 }) 459 })
460 460
461 //昵称 461 //昵称
@@ -412,33 +412,7 @@ struct QualityCommentItem { @@ -412,33 +412,7 @@ struct QualityCommentItem {
412 412
413 jumpToAccountOwner() { 413 jumpToAccountOwner() {
414 414
415 - let url = HttpUrlUtils.getOtherUserDetailDataUrl()  
416 - let item : Record<string, string >= {  
417 - "creatorId": this.item.fromCreatorId || "",  
418 - "userType": `${this.item.fromUserType}`,  
419 - "userId": this.item.fromUserId || "-1",  
420 - }  
421 - HttpBizUtil.post<ResponseDTO<MasterDetailRes>>(url, item).then((result) => {  
422 - if (!result.data || result.data.mainControl != 1) {  
423 - ToastUtils.longToast("暂时无法查看该创作者主页")  
424 - return  
425 - }  
426 -  
427 - if (result.data.banControl == 1) {  
428 - ToastUtils.longToast("该账号已封禁,不予访问")  
429 - return  
430 - }  
431 -  
432 - if (result.data.userType === "1") { // 普通用户  
433 - let params: Record<string, string> = {'userId': result.data.userId};  
434 - WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)  
435 - } else { // 非普通用户  
436 - ProcessUtils.gotoPeopleShipHomePage(result.data.creatorId)  
437 - }  
438 -  
439 - }).catch(() => {  
440 - ToastUtils.longToast("暂时无法查看该创作者主页")  
441 - }) 415 + commentViewModel.jumpToAccountPage(this.item)
442 } 416 }
443 417
444 jumpToDetail() { 418 jumpToDetail() {
  1 +import { MasterDetailRes } from 'wdBean/Index';
1 import { SpConstants } from 'wdConstant/Index'; 2 import { SpConstants } from 'wdConstant/Index';
2 import { DateTimeUtils, Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit/Index'; 3 import { DateTimeUtils, Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit/Index';
3 import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index'; 4 import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index';
4 import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; 5 import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
  6 +import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index';
5 import { 7 import {
6 commentItemModel, 8 commentItemModel,
7 commentListModel, 9 commentListModel,
@@ -472,6 +474,36 @@ class CommentViewModel { @@ -472,6 +474,36 @@ class CommentViewModel {
472 } 474 }
473 return false 475 return false
474 } 476 }
  477 +
  478 + jumpToAccountPage(commentItem: commentItemModel) {
  479 + let url = HttpUrlUtils.getOtherUserDetailDataUrl()
  480 + let item : Record<string, string >= {
  481 + "creatorId": commentItem.fromCreatorId || "",
  482 + "userType": `${commentItem.fromUserType}`,
  483 + "userId": commentItem.fromUserId || "-1",
  484 + }
  485 + HttpBizUtil.post<ResponseDTO<MasterDetailRes>>(url, item).then((result) => {
  486 + if (!result.data || result.data.mainControl != 1) {
  487 + ToastUtils.longToast("暂时无法查看该创作者主页")
  488 + return
  489 + }
  490 +
  491 + if (result.data.banControl == 1) {
  492 + ToastUtils.longToast("该账号已封禁,不予访问")
  493 + return
  494 + }
  495 +
  496 + if (result.data.userType === "1") { // 普通用户
  497 + let params: Record<string, string> = {'userId': result.data.userId};
  498 + WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
  499 + } else { // 非普通用户
  500 + ProcessUtils.gotoPeopleShipHomePage(result.data.creatorId)
  501 + }
  502 +
  503 + }).catch(() => {
  504 + ToastUtils.longToast("暂时无法查看该创作者主页")
  505 + })
  506 + }
475 } 507 }
476 508
477 509