Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
yangchenggong1_wd
2024-04-19 14:42:48 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8972cb8ee0ec71ccc3350eb1f471898cd9e58070
8972cb8e
1 parent
28ae38d9
desc:人民号主页跳转
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
140 additions
and
186 deletions
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowChildComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowListDetailUI.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/HomePageBottomComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/OtherHomePageBottomFollowComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchCreatorComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultContentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/pages/SearchCreatorPage.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/FollowListDetailItem.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowChildComponent.ets
View file @
8972cb8
import { StringUtils } from 'wdKit/Index'
import { StringUtils
, ToastUtils
} from 'wdKit/Index'
import { HttpUrlUtils } from 'wdNetwork/Index'
import { WDRouterRule, WDRouterPage } from 'wdRouter/Index'
import MinePageDatasModel from '../../../model/MinePageDatasModel'
import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'
import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRequestItem'
...
...
@@ -12,14 +13,18 @@ export struct FollowChildComponent{
build() {
if(this.type == 0 ){
Column(){
Blank().height('27lpx')
Column(){
Row() {
Row(){
Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)
.objectFit(ImageFit.Auto)
.width('92lpx')
.height('92lpx')
.margin({right:'15lpx'})
.borderRadius(50)
.borderWidth('1lpx')
.borderColor($r('app.color.color_0D000000'))
Column(){
Text(this.data.cnUserName)
...
...
@@ -28,17 +33,30 @@ export struct FollowChildComponent{
.lineHeight('38lpx')
.fontColor($r('app.color.color_222222'))
.maxLines(1)
.margin({bottom:'8lpx'})
Text(`粉丝${this.data.cnFansNum}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.maxLines(1)
.fontWeight('400lpx')
.lineHeight('31lpx')
.margin({bottom:'8lpx'})
Text(`${this.data.introduction}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.maxLines(2)
.textAlign(TextAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.layoutWeight(1)
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Start)
}.layoutWeight(1)
.alignItems(VerticalAlign.Top)
.onClick(()=>{
this.jumpCreatorHomePage()
})
if(this.data.status == "1"){
Row(){
...
...
@@ -47,18 +65,13 @@ export struct FollowChildComponent{
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('35lpx')
}.backgroundColor($r('app.color.color_F5F5F5'))
.borderRadius('6lpx')
.borderColor($r('app.color.color_F5F5F5'))
.borderWidth('2lpx')
}
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.margin({left:'4lpx',top:'23lpx'})
.onClick(()=>{
this.followOperation()
// this.data.status = "0"
})
}).margin({top:'29lpx'})
}else{
Row(){
Image($r('app.media.follow_icon'))
...
...
@@ -76,27 +89,27 @@ export struct FollowChildComponent{
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.margin({left:'4lpx',top:'23
lpx'})
.margin({top:'29
lpx'})
.onClick(()=>{
this.followOperation()
// this.data.status = "1"
})
}
}.alignItems(VerticalAlign.Top)
}
.padding({top:'27lpx'})
.width('100%')
.layoutWeight(1)
.justifyContent(FlexAlign.SpaceBetween)
.alignItems(VerticalAlign.Top)
}.height('202lpx')
.justifyContent(FlexAlign.Start)
Divider().width('100%')
.height('
2
lpx')
.height('
1
lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
}.width('100%')
}.height('146lpx')
.justifyContent(FlexAlign.Center)
.onClick(()=>{
//跳转 人民号的 主页
})
}else if(this.type == 1 ){
}else {
Column(){
Column(){
...
...
@@ -140,7 +153,13 @@ export struct FollowChildComponent{
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
}.layoutWeight(1)
.onClick(()=>{
this.jumpCreatorHomePage()
})
if(this.type === 2){
Blank()
}else {
if(this.data.status == "1"){
Row(){
Text(`已关注`)
...
...
@@ -177,6 +196,7 @@ export struct FollowChildComponent{
})
}
}
}
.width('100%')
.height('92lpx')
.justifyContent(FlexAlign.SpaceBetween)
...
...
@@ -206,4 +226,15 @@ export struct FollowChildComponent{
}
})
}
jumpCreatorHomePage() {
if(this.data.mainControl === 0){
ToastUtils.shortToast("无法查看此用户主页")
}else if(this.data.banControl === 1){
ToastUtils.shortToast("该账号已封禁,不予访问")
}else{
let params = {'creatorId': this.data.creatorId} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowListDetailUI.ets
View file @
8972cb8
import { LazyDataSource } from 'wdKit';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel';
import { CreatorDetailRequestItem } from '../../../viewmodel/CreatorDetailRequestItem';
import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'
import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem';
import { FollowListStatusRequestItem } from '../../../viewmodel/FollowListStatusRequestItem';
...
...
@@ -73,8 +75,7 @@ export struct FollowListDetailUI{
this.hasMore = false
}else{
value.list.forEach((value)=>{
this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId))
this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId,value.mainControl,value.banControl))
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
...
...
@@ -109,31 +110,72 @@ export struct FollowListDetailUI{
}
}
getFollowListStatus(value:MineFollowListDetailItem){
getFollowListStatus(result:MineFollowListDetailItem){
let data_temp : FollowListDetailItem[] = []
result.list.forEach((item)=>{
data_temp.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,"0",item.attentionUserId,item.cnUserType,item.cnUserId,item.cnMainControl,-1))
})
let request = new CreatorDetailRequestItem()
data_temp.forEach((data)=>{
request.creatorIdList.push(data.creatorId)
})
SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{
if(value!=null && value.length>0){
data_temp.forEach((data)=>{
value.forEach((item)=>{
if(data.creatorId == item.creatorId){
data.headPhotoUrl = item.headPhotoUrl
if(item.fansNum>10000){
let temp = (item.fansNum/10000)+""
let index = temp.indexOf('.')
if(index != -1){
temp = temp.substring(0,index+2)
}else{
temp = temp
}
data.cnFansNum = temp + "万"
}else{
data.cnFansNum = item.fansNum + ""
}
data.introduction = item.introduction
data.mainControl = item.mainControl
data.banControl = item.banControl
}
})
})
this.getFollowStatus(data_temp,result.totalCount)
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
this.isLoading = false
this.count = this.count===-1?0:this.count
})
}
getFollowStatus(result : FollowListDetailItem[],totalCount:number){
let status = new FollowListStatusRequestItem()
let data : FollowListDetailItem[] = []
value.list.forEach((item)=>{
result.forEach((item)=>{
status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId))
data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,"0",item.attentionUserId,item.cnUserType,item.cnUserId))
})
MinePageDatasModel.getFollowListStatusData(status,getContext(this)).then((newValue)=>{
newValue.forEach((item)=>{
data
.forEach((list)=>{
result
.forEach((list)=>{
if (item.creatorId == list.creatorId) {
list.status = item.status
}
})
})
data.forEach((item)=>{
this.data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,item.status,item.attentionUserId,item.cnUserType,item.cnUserId))
result.forEach((item)=>{
this.data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,item.status,item.attentionUserId,item.cnUserType,item.cnUserId,item.mainControl,item.banControl))
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.data.totalCount() <
value.
totalCount) {
if (this.data.totalCount() < totalCount) {
this.curPageNum++
}else {
this.hasMore = false
...
...
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/HomePageBottomComponent.ets
View file @
8972cb8
...
...
@@ -8,6 +8,7 @@ import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem';
import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem';
import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRequestItem';
import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { FollowChildComponent } from '../follow/FollowChildComponent';
const TAG = "HomePageBottomComponent"
@Component
...
...
@@ -95,7 +96,7 @@ export struct HomePageBottomComponent{
LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => {
ListItem() {
ChildFollowComponent({data: item
})
FollowChildComponent({data: item,type:1
})
}
.onClick(() => {
})
...
...
@@ -184,7 +185,7 @@ export struct HomePageBottomComponent{
this.hasMore = false
}else{
value.list.forEach((value)=>{
this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId))
this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId
,value.mainControl,value.banControl
))
})
this.data_follow.notifyDataReload()
this.count = this.data_follow.totalCount()
...
...
@@ -231,107 +232,6 @@ export struct HomePageBottomComponent{
}
@Component
struct ChildFollowComponent {
@ObjectLink data: FollowListDetailItem
build() {
Column(){
Blank().height('27lpx')
Row() {
Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)
.objectFit(ImageFit.Auto)
.width('92lpx')
.height('92lpx')
.margin({right:'15lpx'})
Column(){
Text(this.data.cnUserName)
.fontWeight('400lpx')
.fontSize('31lpx')
.lineHeight('38lpx')
.fontColor($r('app.color.color_222222'))
Text(`粉丝${this.data.cnFansNum}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.maxLines(1)
Text(`${this.data.introduction}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
if(this.data.status == "1"){
Row(){
Text(`已关注`)
.fontColor($r('app.color.color_CCCCCC'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('35lpx')
}.backgroundColor($r('app.color.color_F5F5F5'))
.borderRadius('6lpx')
.borderColor($r('app.color.color_F5F5F5'))
.borderWidth('2lpx')
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.margin({left:'4lpx',top:'23lpx'})
.onClick(()=>{
// this.data.status = "0"
this.followOperation()
})
}else{
Row(){
Image($r('app.media.follow_icon'))
.margin({right:'4lpx'})
.width('23lpx')
.height('23lpx')
Text(`关注`)
.fontColor($r('app.color.color_ED2800'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('35lpx')
}.borderColor($r('app.color.color_1AED2800'))
.borderRadius('6lpx')
.borderWidth('2lpx')
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.margin({left:'4lpx',top:'23lpx'})
.onClick(()=>{
// this.data.status = "1"
this.followOperation()
})
}
}.alignItems(VerticalAlign.Top)
.width('100%')
.layoutWeight(1)
Divider().width('100%')
.height('2lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
}.height('146lpx')
.justifyContent(FlexAlign.Center)
}
followOperation(){
let item = new FollowOperationRequestItem(this.data.cnUserType,this.data.cnUserId,this.data.creatorId,UserDataLocal.getUserType(),UserDataLocal.getUserId(),this.data.status==="0" ? 1:0)
MinePageDatasModel.getFollowOperation(item,getContext(this)).then((value)=>{
if(value!=null){
if (value.code === 0 || value.code.toString() === "0") {
this.data.status = this.data.status ==="0"?"1":"0"
}
}
})
}
}
@Component
struct ChildCommentComponent {
@ObjectLink data: CommentListItem
isLastItem: boolean = false
...
...
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/OtherHomePageBottomFollowComponent.ets
View file @
8972cb8
...
...
@@ -5,6 +5,7 @@ import MinePageDatasModel from '../../../model/MinePageDatasModel';
import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem';
import { UserFollowListRequestItem } from '../../../viewmodel/UserFollowListRequestItem';
import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { FollowChildComponent } from '../follow/FollowChildComponent';
const TAG = "HomePageBottomComponent"
@Component
...
...
@@ -62,7 +63,7 @@ export struct OtherHomePageBottomFollowComponent{
LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => {
ListItem() {
ChildFollowComponent({data: item
})
FollowChildComponent({data: item,type:2
})
}
.onClick(() => {
})
...
...
@@ -116,7 +117,7 @@ export struct OtherHomePageBottomFollowComponent{
this.hasMore = false
}else{
value.list.forEach((value)=>{
this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.cnUserType,value.cnUserId))
this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.cnUserType,value.cnUserId
,value.mainControl,value.banControl
))
})
this.data_follow.notifyDataReload()
this.count = this.data_follow.totalCount()
...
...
@@ -135,49 +136,3 @@ export struct OtherHomePageBottomFollowComponent{
}
}
}
\ No newline at end of file
@Component
struct ChildFollowComponent {
@ObjectLink data: FollowListDetailItem
build() {
Column(){
Blank().height('27lpx')
Row() {
Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)
.objectFit(ImageFit.Auto)
.width('92lpx')
.height('92lpx')
.margin({right:'15lpx'})
Column(){
Text(this.data.cnUserName)
.fontWeight('400lpx')
.fontSize('31lpx')
.lineHeight('38lpx')
.fontColor($r('app.color.color_222222'))
Text(`粉丝${this.data.cnFansNum}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.maxLines(1)
Text(`${this.data.introduction}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
}.alignItems(VerticalAlign.Top)
.width('100%')
.layoutWeight(1)
Divider().width('100%')
.height('2lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
}.height('146lpx')
.justifyContent(FlexAlign.Center)
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchCreatorComponent.ets
View file @
8972cb8
import { ToastUtils } from 'wdKit/Index'
import { WDRouterRule, WDRouterPage } from 'wdRouter/Index'
import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
@Component
...
...
@@ -21,5 +23,19 @@ export struct SearchCreatorComponent{
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.alignItems(HorizontalAlign.Center)
.justifyContent(FlexAlign.Center)
.onClick(()=>{
this.jumpCreatorHomePage()
})
}
jumpCreatorHomePage() {
if(Number.parseInt(this.item.mainControl) === 0){
ToastUtils.shortToast("无法查看此用户主页")
}else if(Number.parseInt(this.item.banControl) === 1){
ToastUtils.shortToast("该账号已封禁,不予访问")
}else{
let params = {'creatorId': this.item.id} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultContentComponent.ets
View file @
8972cb8
...
...
@@ -72,6 +72,7 @@ export struct SearchResultContentComponent{
value.forEach((item)=>{
if(data.creatorId == item.creatorId){
data.headerPhotoUrl = item.headPhotoUrl.split("?")[0]
data.mainControl = item.mainControl+""
}
})
})
...
...
sight_harmony/features/wdComponent/src/main/ets/pages/SearchCreatorPage.ets
View file @
8972cb8
...
...
@@ -40,8 +40,9 @@ struct SearchCreatorPage {
this.hasMore = false
this.isLoading = false
}else{
this.data_temp = []
result.list.forEach((data)=>{
this.data_temp.push(new FollowListDetailItem("",data.data.creatorName,"0","",data.data.id,"0",data.data.userId,data.data.userType,data.data.userId))
this.data_temp.push(new FollowListDetailItem("",data.data.creatorName,"0","",data.data.id,"0",data.data.userId,data.data.userType,data.data.userId
,Number.parseInt(data.data.mainControl),-1
))
})
let request = new CreatorDetailRequestItem()
...
...
@@ -69,6 +70,8 @@ struct SearchCreatorPage {
data.cnFansNum = item.fansNum + ""
}
data.introduction = item.introduction
data.mainControl = item.mainControl
data.banControl = item.banControl
}
})
})
...
...
@@ -104,7 +107,7 @@ struct SearchCreatorPage {
})
this.data_temp.forEach((item)=>{
this.data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,item.status,item.attentionUserId,item.cnUserType,item.cnUserId))
this.data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,item.status,item.attentionUserId,item.cnUserType,item.cnUserId
,item.mainControl,item.banControl
))
})
this.data.notifyDataReload()
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/FollowListDetailItem.ets
View file @
8972cb8
...
...
@@ -71,16 +71,20 @@ export class FollowListDetailItem{
cnUserType:string = ""
cnUserId:string = ""
mainControl:number = 0
cnMainControl:number = 0
attentionCreatorId:string = ""
attentionUserType:string = ""
attentionHeadPhotoUrl:string = ""
attentionUserName:string = ""
fansNum :number = 0
banControl:number = -1
constructor(headPhotoUrl:string,cnUserName:string,cnFansNum:string,introduction:string,creatorId:string,status:string,attentionUserId:string,cnUserType:string,cnUserId:string) {
constructor(headPhotoUrl:string,cnUserName:string,cnFansNum:string,introduction:string,creatorId:string,status:string,attentionUserId:string,cnUserType:string,cnUserId:string,mainControl:number,banControl:number) {
this.headPhotoUrl = headPhotoUrl
this.cnUserName = cnUserName
this.cnFansNum = cnFansNum
...
...
@@ -90,5 +94,7 @@ export class FollowListDetailItem{
this.attentionUserId = attentionUserId
this.cnUserType = cnUserType
this.cnUserId = cnUserId
this.mainControl = mainControl
this.banControl = banControl
}
}
...
...
Please
register
or
login
to post a comment