liyubing

Merge remote-tracking branch 'origin/main'

1 -import { DateTimeUtils, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index' 1 +import { SpConstants } from 'wdConstant/Index'
  2 +import { DateTimeUtils, SPHelper, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'
2 import { HttpUrlUtils } from 'wdNetwork/Index' 3 import { HttpUrlUtils } from 'wdNetwork/Index'
3 import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' 4 import { WDRouterRule, WDRouterPage } from 'wdRouter/Index'
4 import MinePageDatasModel from '../../../model/MinePageDatasModel' 5 import MinePageDatasModel from '../../../model/MinePageDatasModel'
@@ -17,14 +18,25 @@ export struct FollowChildComponent{ @@ -17,14 +18,25 @@ export struct FollowChildComponent{
17 18
18 Row() { 19 Row() {
19 Row(){ 20 Row(){
20 - Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)  
21 - .objectFit(ImageFit.Auto)  
22 - .width('92lpx')  
23 - .height('92lpx')  
24 - .margin({right:'15lpx'})  
25 - .borderRadius(50)  
26 - .borderWidth('1lpx')  
27 - .borderColor($r('app.color.color_0D000000')) 21 + Stack({alignContent: Alignment.Bottom}){
  22 + Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)
  23 + .objectFit(ImageFit.Auto)
  24 + .width('92lpx')
  25 + .height('92lpx')
  26 + .borderRadius(50)
  27 + .borderWidth('1lpx')
  28 + .borderColor($r('app.color.color_0D000000'))
  29 + Row(){
  30 + Image(this.data.authIcon)
  31 + .width('32lpx')
  32 + .height('32lpx')
  33 + .objectFit(ImageFit.Cover)
  34 + }.width('92lpx')
  35 + .justifyContent(FlexAlign.End)
  36 + }.width('92lpx')
  37 + .height('92lpx')
  38 + .margin({right:'15lpx'})
  39 +
28 40
29 Column(){ 41 Column(){
30 Text(this.data.cnUserName) 42 Text(this.data.cnUserName)
@@ -115,14 +127,24 @@ export struct FollowChildComponent{ @@ -115,14 +127,24 @@ export struct FollowChildComponent{
115 127
116 Row() { 128 Row() {
117 Row(){ 129 Row(){
118 - Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)  
119 - .objectFit(ImageFit.Auto)  
120 - .width('92lpx')  
121 - .height('92lpx')  
122 - .margin({right:'15lpx'})  
123 - .borderRadius(50)  
124 - .borderWidth('1lpx')  
125 - .borderColor($r('app.color.color_0D000000')) 130 + Stack({alignContent: Alignment.Bottom}){
  131 + Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)
  132 + .objectFit(ImageFit.Auto)
  133 + .width('92lpx')
  134 + .height('92lpx')
  135 + .borderRadius(50)
  136 + .borderWidth('1lpx')
  137 + .borderColor($r('app.color.color_0D000000'))
  138 + Row(){
  139 + Image(this.data.authIcon)
  140 + .width('32lpx')
  141 + .height('32lpx')
  142 + .objectFit(ImageFit.Cover)
  143 + }.width('92lpx')
  144 + .justifyContent(FlexAlign.End)
  145 + }.width('92lpx')
  146 + .height('92lpx')
  147 + .margin({right:'15lpx'})
126 148
127 Column(){ 149 Column(){
128 Text(this.data.cnUserName) 150 Text(this.data.cnUserName)
@@ -220,20 +242,31 @@ export struct FollowChildComponent{ @@ -220,20 +242,31 @@ export struct FollowChildComponent{
220 } 242 }
221 243
222 followOperation(){ 244 followOperation(){
223 - let item = new FollowOperationRequestItem(this.data.cnUserType,this.data.cnUserId,this.data.creatorId,HttpUrlUtils.getUserType(),HttpUrlUtils.getUserId(),this.data.status==="0" ? 1:0)  
224 - MinePageDatasModel.getFollowOperation(item,getContext(this)).then((value)=>{  
225 - if(value!=null){  
226 - if (value.code === 0 || value.code.toString() === "0") {  
227 - this.data.status = this.data.status ==="0"?"1":"0"  
228 -  
229 - if(this.data.status === "1"){  
230 - UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+"")  
231 - }else{  
232 - UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+","+this.data.creatorId) 245 + let isLogin = false
  246 + let userid = SPHelper.default.getSync(SpConstants.USER_ID,"") as string
  247 + if(StringUtils.isNotEmpty(userid)){
  248 + isLogin = true
  249 + }else{
  250 + isLogin = false
  251 + }
  252 + if(isLogin){
  253 + let item = new FollowOperationRequestItem(this.data.cnUserType,this.data.cnUserId,this.data.creatorId,HttpUrlUtils.getUserType(),HttpUrlUtils.getUserId(),this.data.status==="0" ? 1:0)
  254 + MinePageDatasModel.getFollowOperation(item,getContext(this)).then((value)=>{
  255 + if(value!=null){
  256 + if (value.code === 0 || value.code.toString() === "0") {
  257 + this.data.status = this.data.status ==="0"?"1":"0"
  258 +
  259 + if(this.data.status === "1"){
  260 + UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+"")
  261 + }else{
  262 + UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+","+this.data.creatorId)
  263 + }
233 } 264 }
234 } 265 }
235 - }  
236 - }) 266 + })
  267 + }else{
  268 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  269 + }
237 } 270 }
238 271
239 jumpCreatorHomePage() { 272 jumpCreatorHomePage() {
@@ -123,7 +123,7 @@ export struct FollowListDetailUI { @@ -123,7 +123,7 @@ export struct FollowListDetailUI {
123 } else { 123 } else {
124 fansNumString = fansNum + "" 124 fansNumString = fansNum + ""
125 } 125 }
126 - this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl, value.attentionUserName, fansNumString, value.introduction, value.attentionCreatorId, "1", value.attentionUserId, value.attentionUserType, value.attentionUserId, value.mainControl, value.banControl)) 126 + this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl, value.attentionUserName, fansNumString, value.introduction, value.attentionCreatorId, "1", value.attentionUserId, value.attentionUserType, value.attentionUserId, value.mainControl, value.banControl,value.authIcon))
127 }) 127 })
128 this.data.notifyDataReload() 128 this.data.notifyDataReload()
129 this.count = this.data.totalCount() 129 this.count = this.data.totalCount()
@@ -169,7 +169,7 @@ export struct FollowListDetailUI { @@ -169,7 +169,7 @@ export struct FollowListDetailUI {
169 getFollowListStatus(result: MineFollowListDetailItem) { 169 getFollowListStatus(result: MineFollowListDetailItem) {
170 let data_temp: FollowListDetailItem[] = [] 170 let data_temp: FollowListDetailItem[] = []
171 result.list.forEach((item) => { 171 result.list.forEach((item) => {
172 - 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)) 172 + 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,item.authIcon))
173 }) 173 })
174 let request = new CreatorDetailRequestItem() 174 let request = new CreatorDetailRequestItem()
175 175
@@ -225,7 +225,7 @@ export struct FollowListDetailUI { @@ -225,7 +225,7 @@ export struct FollowListDetailUI {
225 }) 225 })
226 226
227 result.forEach((item) => { 227 result.forEach((item) => {
228 - 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)) 228 + 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,item.authIcon))
229 }) 229 })
230 230
231 this.data.notifyDataReload() 231 this.data.notifyDataReload()
@@ -233,7 +233,7 @@ export struct HomePageBottomComponent{ @@ -233,7 +233,7 @@ export struct HomePageBottomComponent{
233 } else { 233 } else {
234 fansNumString = fansNum + "" 234 fansNumString = fansNum + ""
235 } 235 }
236 - this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,fansNumString,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId,value.mainControl,value.banControl)) 236 + this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,fansNumString,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId,value.mainControl,value.banControl,value.authIcon))
237 }) 237 })
238 this.data_follow.notifyDataReload() 238 this.data_follow.notifyDataReload()
239 this.count = this.data_follow.totalCount() 239 this.count = this.data_follow.totalCount()
@@ -143,7 +143,7 @@ export struct OtherHomePageBottomFollowComponent{ @@ -143,7 +143,7 @@ export struct OtherHomePageBottomFollowComponent{
143 this.hasMore = false 143 this.hasMore = false
144 }else{ 144 }else{
145 value.list.forEach((value)=>{ 145 value.list.forEach((value)=>{
146 - 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)) 146 + 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,value.authIcon))
147 }) 147 })
148 this.data_follow.notifyDataReload() 148 this.data_follow.notifyDataReload()
149 this.count = this.data_follow.totalCount() 149 this.count = this.data_follow.totalCount()
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 * 搜索活动 展示组件 2 * 搜索活动 展示组件
3 */ 3 */
4 import { ContentDTO } from 'wdBean/Index'; 4 import { ContentDTO } from 'wdBean/Index';
  5 +import { ProcessUtils } from 'wdRouter/Index';
5 6
6 @Component 7 @Component
7 export struct ActivityItemComponent { 8 export struct ActivityItemComponent {
@@ -119,5 +120,8 @@ export struct ActivityItemComponent { @@ -119,5 +120,8 @@ export struct ActivityItemComponent {
119 .justifyContent(FlexAlign.SpaceBetween) 120 .justifyContent(FlexAlign.SpaceBetween)
120 .width('100%') 121 .width('100%')
121 .padding({left:'31lpx',right:'31lpx'}) 122 .padding({left:'31lpx',right:'31lpx'})
  123 + .onClick(()=>{
  124 + ProcessUtils._gotoDefaultWeb(this.contentDTO.linkUrl)
  125 + })
122 } 126 }
123 } 127 }
1 import { ToastUtils } from 'wdKit/Index' 1 import { ToastUtils } from 'wdKit/Index'
2 -import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' 2 +import { WDRouterRule, WDRouterPage, ProcessUtils } from 'wdRouter/Index'
3 import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem' 3 import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
4 4
5 @Component 5 @Component
@@ -8,12 +8,24 @@ export struct SearchCreatorComponent{ @@ -8,12 +8,24 @@ export struct SearchCreatorComponent{
8 8
9 build() { 9 build() {
10 Column(){ 10 Column(){
11 - Image(this.item.headerPhotoUrl)  
12 - .width('92lpx')  
13 - .alt($r('app.media.default_head'))  
14 - .height('92lpx')  
15 - .margin({bottom:'15lpx'})  
16 - .borderRadius(50) 11 + Stack({alignContent: Alignment.Bottom}){
  12 + Image(this.item.headerPhotoUrl)
  13 + .width('92lpx')
  14 + .alt($r('app.media.default_head'))
  15 + .height('92lpx')
  16 + .margin({bottom:'15lpx'})
  17 + .borderRadius(50)
  18 + Row(){
  19 + Image(this.item.authIcon)
  20 + .width('32lpx')
  21 + .height('32lpx')
  22 + .objectFit(ImageFit.Cover)
  23 + }.width('92lpx')
  24 + .justifyContent(FlexAlign.End)
  25 + }.width('92lpx')
  26 + .height('92lpx')
  27 + .margin({bottom:'15lpx'})
  28 +
17 Text(this.item.creatorName) 29 Text(this.item.creatorName)
18 .fontSize('25lpx') 30 .fontSize('25lpx')
19 .fontWeight('400lpx') 31 .fontWeight('400lpx')
@@ -232,7 +232,7 @@ class MinePageDatasModel{ @@ -232,7 +232,7 @@ class MinePageDatasModel{
232 Logger.info(TAG, `getAppointmentList start`); 232 Logger.info(TAG, `getAppointmentList start`);
233 this.fetchFollowListStatusData(params).then((navResDTO: ResponseDTO<QueryListIsFollowedItem[]>) => { 233 this.fetchFollowListStatusData(params).then((navResDTO: ResponseDTO<QueryListIsFollowedItem[]>) => {
234 if (!navResDTO || navResDTO.code != 0) { 234 if (!navResDTO || navResDTO.code != 0) {
235 - error(null) 235 + error(navResDTO)
236 return 236 return
237 } 237 }
238 Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); 238 Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
@@ -2,7 +2,7 @@ import { Params } from 'wdBean/Index'; @@ -2,7 +2,7 @@ import { Params } from 'wdBean/Index';
2 import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; 2 import { CustomTitleUI } from '../components/reusable/CustomTitleUI';
3 import { router } from '@kit.ArkUI'; 3 import { router } from '@kit.ArkUI';
4 import { FollowListDetailItem } from '../viewmodel/FollowListDetailItem'; 4 import { FollowListDetailItem } from '../viewmodel/FollowListDetailItem';
5 -import { LazyDataSource } from 'wdKit/Index'; 5 +import { LazyDataSource, SPHelper, StringUtils } from 'wdKit/Index';
6 import SearcherAboutDataModel from '../model/SearcherAboutDataModel'; 6 import SearcherAboutDataModel from '../model/SearcherAboutDataModel';
7 import { CreatorDetailRequestItem } from '../viewmodel/CreatorDetailRequestItem'; 7 import { CreatorDetailRequestItem } from '../viewmodel/CreatorDetailRequestItem';
8 import { FollowListStatusRequestItem } from '../viewmodel/FollowListStatusRequestItem'; 8 import { FollowListStatusRequestItem } from '../viewmodel/FollowListStatusRequestItem';
@@ -10,6 +10,7 @@ import { QueryListIsFollowedItem } from '../viewmodel/QueryListIsFollowedItem'; @@ -10,6 +10,7 @@ import { QueryListIsFollowedItem } from '../viewmodel/QueryListIsFollowedItem';
10 import MinePageDatasModel from '../model/MinePageDatasModel'; 10 import MinePageDatasModel from '../model/MinePageDatasModel';
11 import { ListHasNoMoreDataUI } from '../components/reusable/ListHasNoMoreDataUI'; 11 import { ListHasNoMoreDataUI } from '../components/reusable/ListHasNoMoreDataUI';
12 import { FollowChildComponent } from '../components/mine/follow/FollowChildComponent'; 12 import { FollowChildComponent } from '../components/mine/follow/FollowChildComponent';
  13 +import { SpConstants } from 'wdConstant/Index';
13 14
14 const TAG = "SearchCreatorPage" 15 const TAG = "SearchCreatorPage"
15 16
@@ -42,7 +43,7 @@ struct SearchCreatorPage { @@ -42,7 +43,7 @@ struct SearchCreatorPage {
42 }else{ 43 }else{
43 this.data_temp = [] 44 this.data_temp = []
44 result.list.forEach((data)=>{ 45 result.list.forEach((data)=>{
45 - 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)) 46 + 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,data.data.authIcon))
46 }) 47 })
47 48
48 let request = new CreatorDetailRequestItem() 49 let request = new CreatorDetailRequestItem()
@@ -92,22 +93,51 @@ struct SearchCreatorPage { @@ -92,22 +93,51 @@ struct SearchCreatorPage {
92 } 93 }
93 94
94 getFollowListStatus(totalCount:number){ 95 getFollowListStatus(totalCount:number){
95 - let status = new FollowListStatusRequestItem()  
96 - this.data_temp.forEach((item)=>{  
97 - status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId))  
98 - })  
99 -  
100 - MinePageDatasModel.getFollowListStatusData(status,getContext(this)).then((newValue)=>{  
101 - newValue.forEach((item)=>{  
102 - this.data_temp.forEach((list)=>{  
103 - if (item.creatorId == list.creatorId) {  
104 - list.status = item.status  
105 - }  
106 - }) 96 + let isLogin = false
  97 + let userid = SPHelper.default.getSync(SpConstants.USER_ID,"") as string
  98 + if(StringUtils.isNotEmpty(userid)){
  99 + isLogin = true
  100 + }else{
  101 + isLogin = false
  102 + }
  103 +
  104 + if(isLogin){
  105 + let status = new FollowListStatusRequestItem()
  106 + this.data_temp.forEach((item)=>{
  107 + status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId))
107 }) 108 })
108 109
  110 + MinePageDatasModel.getFollowListStatusData(status,getContext(this)).then((newValue)=>{
  111 + newValue.forEach((item)=>{
  112 + this.data_temp.forEach((list)=>{
  113 + if (item.creatorId == list.creatorId) {
  114 + list.status = item.status
  115 + }
  116 + })
  117 + })
  118 +
  119 + this.data_temp.forEach((item)=>{
  120 + 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,item.authIcon))
  121 + })
  122 +
  123 + this.data.notifyDataReload()
  124 +
  125 + this.count = this.data.totalCount()
  126 + if (this.data.totalCount() < totalCount) {
  127 + this.curPageNum++
  128 + }else {
  129 + this.hasMore = false
  130 + }
  131 +
  132 + this.isLoading = false
  133 + }).catch((err:Error)=>{
  134 + console.log(TAG,"请求失败")
  135 + this.isLoading = false
  136 + this.count = this.count===-1?0:this.count
  137 + })
  138 + }else{
109 this.data_temp.forEach((item)=>{ 139 this.data_temp.forEach((item)=>{
110 - 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)) 140 + this.data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,"0",item.attentionUserId,item.cnUserType,item.cnUserId,item.mainControl,item.banControl,item.authIcon))
111 }) 141 })
112 142
113 this.data.notifyDataReload() 143 this.data.notifyDataReload()
@@ -120,11 +150,7 @@ struct SearchCreatorPage { @@ -120,11 +150,7 @@ struct SearchCreatorPage {
120 } 150 }
121 151
122 this.isLoading = false 152 this.isLoading = false
123 - }).catch((err:Error)=>{  
124 - console.log(TAG,"请求失败")  
125 - this.isLoading = false  
126 - this.count = this.count===-1?0:this.count  
127 - }) 153 + }
128 } 154 }
129 155
130 build() { 156 build() {
@@ -81,10 +81,9 @@ export class FollowListDetailItem{ @@ -81,10 +81,9 @@ export class FollowListDetailItem{
81 attentionUserName:string = "" 81 attentionUserName:string = ""
82 fansNum :number = 0 82 fansNum :number = 0
83 banControl:number = -1 83 banControl:number = -1
  84 + authIcon:string = ""
84 85
85 -  
86 -  
87 - constructor(headPhotoUrl:string,cnUserName:string,cnFansNum:string,introduction:string,creatorId:string,status:string,attentionUserId:string,cnUserType:string,cnUserId:string,mainControl:number,banControl:number) { 86 + constructor(headPhotoUrl:string,cnUserName:string,cnFansNum:string,introduction:string,creatorId:string,status:string,attentionUserId:string,cnUserType:string,cnUserId:string,mainControl:number,banControl:number,authIcon:string) {
88 this.headPhotoUrl = headPhotoUrl 87 this.headPhotoUrl = headPhotoUrl
89 this.cnUserName = cnUserName 88 this.cnUserName = cnUserName
90 this.cnFansNum = cnFansNum 89 this.cnFansNum = cnFansNum
@@ -96,5 +95,6 @@ export class FollowListDetailItem{ @@ -96,5 +95,6 @@ export class FollowListDetailItem{
96 this.cnUserId = cnUserId 95 this.cnUserId = cnUserId
97 this.mainControl = mainControl 96 this.mainControl = mainControl
98 this.banControl = banControl 97 this.banControl = banControl
  98 + this.authIcon = authIcon
99 } 99 }
100 } 100 }