zhenghy

Merge remote-tracking branch 'origin/main'

@@ -60,4 +60,6 @@ export { MpaasUtils } from './src/main/ets/mpaas/MpaasUtils' @@ -60,4 +60,6 @@ export { MpaasUtils } from './src/main/ets/mpaas/MpaasUtils'
60 60
61 export { MpaasUpgradeCheck, UpgradeTipContent } from './src/main/ets/mpaas/MpaasUpgradeCheck' 61 export { MpaasUpgradeCheck, UpgradeTipContent } from './src/main/ets/mpaas/MpaasUpgradeCheck'
62 62
63 -export { TingyunAPM } from './src/main/ets/tingyunAPM/TingyunAPM'  
  63 +export { TingyunAPM } from './src/main/ets/tingyunAPM/TingyunAPM'
  64 +
  65 +export { FastClickUtil } from './src/main/ets/utils/FastClickUtil';
  1 +import systemDateTime from '@ohos.systemDateTime';
  2 +
  3 +/**
  4 + * 屏蔽快速点击事件,规定时间内只触发一次
  5 + */
  6 +export class FastClickUtil {
  7 +
  8 + static MIN_DELAY_TIME = 500
  9 +
  10 + static minDelayBeforeTime = 0
  11 +
  12 + static async isMinDelayTime(): Promise<boolean> {
  13 + let systime = await systemDateTime.getCurrentTime();
  14 + return new Promise<boolean>((success, error) => {
  15 + let rtnvalue = systime - FastClickUtil.minDelayBeforeTime <= FastClickUtil.MIN_DELAY_TIME;
  16 + this.minDelayBeforeTime = systime;
  17 + success(rtnvalue);
  18 + })
  19 + }
  20 +}
  21 +
@@ -108,7 +108,11 @@ export class ProcessUtils { @@ -108,7 +108,11 @@ export class ProcessUtils {
108 break; 108 break;
109 case ContentConstants.TYPE_TELETEXT: 109 case ContentConstants.TYPE_TELETEXT:
110 // 图文详情,跳转h5 110 // 图文详情,跳转h5
111 - ProcessUtils.gotoWeb(content); 111 + if(content?.linkUrl){ //有 linkUrl 走专题页展示逻辑
  112 + ProcessUtils.gotoSpecialTopic(content)
  113 + }else{
  114 + ProcessUtils.gotoWeb(content);
  115 + }
112 break; 116 break;
113 case ContentConstants.TYPE_LINK: 117 case ContentConstants.TYPE_LINK:
114 ProcessUtils.gotoDefaultWeb(content); 118 ProcessUtils.gotoDefaultWeb(content);
@@ -455,4 +459,10 @@ export class ProcessUtils { @@ -455,4 +459,10 @@ export class ProcessUtils {
455 WDRouterRule.jumpWithAction(taskAction) 459 WDRouterRule.jumpWithAction(taskAction)
456 } 460 }
457 461
  462 + /**
  463 + * 跳转到登录页
  464 + */
  465 + public static gotoLoginPage() {
  466 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  467 + }
458 } 468 }
@@ -39,14 +39,14 @@ class AppLoginAuthInfo { @@ -39,14 +39,14 @@ class AppLoginAuthInfo {
39 } 39 }
40 40
41 interface IDataJson { 41 interface IDataJson {
42 - jumpType:number  
43 - jumpUrl:string  
44 - newsId:string  
45 - newsObjectLevel:string  
46 - newsObjectType:number  
47 - newsRelId:string  
48 - newsTitle:string  
49 - pageId:string 42 + jumpType: number
  43 + jumpUrl: string
  44 + newsId: string
  45 + newsObjectLevel: string
  46 + newsObjectType: number
  47 + newsRelId: string
  48 + newsTitle: string
  49 + pageId: string
50 } 50 }
51 51
52 /** 52 /**
@@ -159,59 +159,64 @@ function handleJsCallAppInnerLinkMethod(data: Message) { @@ -159,59 +159,64 @@ function handleJsCallAppInnerLinkMethod(data: Message) {
159 content.objectType = ''; 159 content.objectType = '';
160 content.linkUrl = encodeURI(urlParams.get('url') || ''); 160 content.linkUrl = encodeURI(urlParams.get('url') || '');
161 switch (urlParams.get('type')) { 161 switch (urlParams.get('type')) {
162 - case 'video':  
163 - content.objectType = ContentConstants.TYPE_VOD  
164 - ProcessUtils.processPage(content)  
165 - break;  
166 - case 'live':  
167 - content.objectType = ContentConstants.TYPE_LIVE  
168 - ProcessUtils.processPage(content)  
169 - break;  
170 - case 'article':  
171 - content.objectType = ContentConstants.TYPE_TELETEXT  
172 - ProcessUtils.processPage(content)  
173 - break;  
174 - case 'picture':  
175 - content.objectType = ContentConstants.TYPE_NINE  
176 - ProcessUtils.processPage(content)  
177 - break;  
178 - case 'audio':  
179 - content.objectType = ContentConstants.TYPE_AUDIO 162 + case 'video':
  163 + content.objectType = ContentConstants.TYPE_VOD
  164 + ProcessUtils.processPage(content)
  165 + break;
  166 + case 'live':
  167 + content.objectType = ContentConstants.TYPE_LIVE
  168 + ProcessUtils.processPage(content)
  169 + break;
  170 + case 'article':
  171 + content.objectType = ContentConstants.TYPE_TELETEXT
  172 + ProcessUtils.processPage(content)
  173 + break;
  174 + case 'picture':
  175 + content.objectType = ContentConstants.TYPE_NINE
  176 + ProcessUtils.processPage(content)
  177 + break;
  178 + case 'audio':
  179 + content.objectType = ContentConstants.TYPE_AUDIO
  180 + ProcessUtils.processPage(content)
  181 + break;
  182 + case 'h5':
  183 + if (urlParams.get('skipType') === '1') {
  184 + content.objectType = ContentConstants.TYPE_LINK
180 ProcessUtils.processPage(content) 185 ProcessUtils.processPage(content)
181 - break;  
182 - case 'h5':  
183 - if (urlParams.get('skipType') === '1') {  
184 - content.objectType = ContentConstants.TYPE_LINK  
185 - ProcessUtils.processPage(content)  
186 - }  
187 - if (urlParams.get('skipType') === '4') {  
188 - content.objectType = ContentConstants.TYPE_LINK  
189 - ProcessUtils.jumpExternalWebPage(content.linkUrl)  
190 - }  
191 - break;  
192 - case 'topic':  
193 - if (urlParams.get('subType') === 'h5') {  
194 - content.objectType = ContentConstants.TYPE_SPECIAL_TOPIC  
195 - ProcessUtils.processPage(content)  
196 - }  
197 - if (urlParams.get('subType') === 'moring_evening_news') {  
198 - ProcessUtils.gotoMorningEveningPaper()  
199 - }  
200 - if (urlParams.get('subType') === 'electronic_newspapers') {  
201 - ProcessUtils.gotoENewsPaper()  
202 - }  
203 - break;  
204 - case 'dynamic':  
205 - content.objectType = ContentConstants.TYPE_FOURTEEN 186 + }
  187 + if (urlParams.get('skipType') === '4') {
  188 + content.objectType = ContentConstants.TYPE_LINK
  189 + ProcessUtils.jumpExternalWebPage(content.linkUrl)
  190 + }
  191 + break;
  192 + case 'topic':
  193 + if (urlParams.get('subType') === 'h5') {
  194 + content.objectType = ContentConstants.TYPE_SPECIAL_TOPIC
206 ProcessUtils.processPage(content) 195 ProcessUtils.processPage(content)
207 - break;  
208 - case 'owner_page':  
209 - let creatorId = urlParams.get('creatorId') || ''  
210 - ProcessUtils.gotoPeopleShipHomePage(creatorId)  
211 - break;  
212 - default:  
213 - break;  
214 - } 196 + }
  197 + if (urlParams.get('subType') === 'moring_evening_news') {
  198 + ProcessUtils.gotoMorningEveningPaper()
  199 + }
  200 + if (urlParams.get('subType') === 'electronic_newspapers') {
  201 + ProcessUtils.gotoENewsPaper()
  202 + }
  203 + break;
  204 + case 'dynamic':
  205 + content.objectType = ContentConstants.TYPE_FOURTEEN
  206 + ProcessUtils.processPage(content)
  207 + break;
  208 + case 'owner_page':
  209 + let creatorId = urlParams.get('creatorId') || ''
  210 + ProcessUtils.gotoPeopleShipHomePage(creatorId)
  211 + break;
  212 + case 'app':
  213 + if (urlParams.get('subType') === 'login') {
  214 + ProcessUtils.gotoLoginPage()
  215 + }
  216 + break;
  217 + default:
  218 + break;
  219 + }
215 220
216 } 221 }
217 222
1 import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; 1 import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
2 -import { H5ReceiveDataJsonBean, postBatchAttentionStatusResult } from 'wdBean';  
3 -import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork'; 2 +import { WDHttp, HttpUrlUtils } from 'wdNetwork';
4 3
5 const TAG = 'JsCallAppService' 4 const TAG = 'JsCallAppService'
6 5
7 6
8 export function handleJsCallAppService(data: Message, callback: (res: string) => void) { 7 export function handleJsCallAppService(data: Message, callback: (res: string) => void) {
9 - let url: string = HttpUrlUtils.getHost() + data?.data?.url 8 + if (data?.data?.method === 'get') {
  9 + let queryString: string = ''
  10 + let parameters = data?.data?.parameters
  11 + if (parameters) {
  12 + queryString = Object.keys(parameters)
  13 + .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(parameters?.[key])}`)
  14 + .join('&');
  15 + }
10 16
11 - let responseMap: ResponseDTO<postBatchAttentionStatusResult> = {} as ResponseDTO<postBatchAttentionStatusResult>  
12 -  
13 - let h5ReceiveDataJson: H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>> = {  
14 - netError: '0',  
15 - responseMap  
16 - } as H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>> 17 + let url: string = HttpUrlUtils.getHost() + data?.data?.url
  18 + if (queryString) {
  19 + url = url + `?${queryString}`
  20 + }
  21 + console.log('yzl', queryString, url)
  22 + WDHttp.get(url).then((res) => {
  23 + callback(JSON.stringify({
  24 + netError: '0',
  25 + responseMap: res
  26 + }))
  27 + })
  28 + }
  29 + if (data?.data?.method === 'post') {
  30 + let url: string = HttpUrlUtils.getHost() + data?.data?.url
17 31
18 - // if (data?.data?.method === 'get') {  
19 - // WDHttp.get<ResponseDTO<postBatchAttentionStatusResult>>(url, headers).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {  
20 - // callback(JSON.stringify(res))  
21 - // })  
22 - // }  
23 - if (data?.data?.method === 'post' && data?.data?.url === '/api/rmrb-interact/interact/zh/c/batchAttention/status') {  
24 - WDHttp.post<ResponseDTO<postBatchAttentionStatusResult>>(url, data?.data?.parameters).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {  
25 - h5ReceiveDataJson.responseMap = res  
26 - callback(JSON.stringify(h5ReceiveDataJson)) 32 + WDHttp.post(url, data?.data?.parameters).then((res) => {
  33 + callback(JSON.stringify({
  34 + netError: '0',
  35 + responseMap: res
  36 + }))
27 }) 37 })
28 } 38 }
29 } 39 }
@@ -9,4 +9,5 @@ export interface commentInfo { @@ -9,4 +9,5 @@ export interface commentInfo {
9 relId: string; 9 relId: string;
10 relType: string; 10 relType: string;
11 userId: string; 11 userId: string;
  12 + newsType?: string
12 } 13 }
@@ -5,7 +5,8 @@ import { @@ -5,7 +5,8 @@ import {
5 SPHelper, 5 SPHelper,
6 NumberFormatterUtils, 6 NumberFormatterUtils,
7 DisplayUtils, 7 DisplayUtils,
8 - NetworkUtil 8 + NetworkUtil,
  9 + FastClickUtil
9 } from 'wdKit'; 10 } from 'wdKit';
10 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 11 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
11 import { 12 import {
@@ -148,7 +149,11 @@ export struct DynamicDetailComponent { @@ -148,7 +149,11 @@ export struct DynamicDetailComponent {
148 .width($r('app.float.margin_48')) 149 .width($r('app.float.margin_48'))
149 .height($r('app.float.margin_48')) 150 .height($r('app.float.margin_48'))
150 .alignContent(Alignment.Center) 151 .alignContent(Alignment.Center)
151 - .onClick(() => { 152 + .onClick(async () => {
  153 + let retvalue = await FastClickUtil.isMinDelayTime()
  154 + if(retvalue){
  155 + return
  156 + }
152 ProcessUtils.gotoPeopleShipHomePage(this.contentDetailData.rmhInfo == null ? "" : 157 ProcessUtils.gotoPeopleShipHomePage(this.contentDetailData.rmhInfo == null ? "" :
153 this.contentDetailData.rmhInfo.rmhId) 158 this.contentDetailData.rmhInfo.rmhId)
154 }) 159 })
@@ -192,7 +197,11 @@ export struct DynamicDetailComponent { @@ -192,7 +197,11 @@ export struct DynamicDetailComponent {
192 .height($r('app.float.margin_24')) 197 .height($r('app.float.margin_24'))
193 .borderRadius($r('app.float.vp_3')) 198 .borderRadius($r('app.float.vp_3'))
194 .backgroundColor($r('app.color.color_ED2800')) 199 .backgroundColor($r('app.color.color_ED2800'))
195 - .onClick(() => { 200 + .onClick(async () => {
  201 + let retvalue = await FastClickUtil.isMinDelayTime()
  202 + if(retvalue){
  203 + return
  204 + }
196 this.handleAccention() 205 this.handleAccention()
197 }) 206 })
198 } else { 207 } else {
@@ -206,7 +215,11 @@ export struct DynamicDetailComponent { @@ -206,7 +215,11 @@ export struct DynamicDetailComponent {
206 .borderColor($r('app.color.color_CCCCCC_1A')) 215 .borderColor($r('app.color.color_CCCCCC_1A'))
207 .backgroundColor($r('app.color.color_CCCCCC_1A')) 216 .backgroundColor($r('app.color.color_CCCCCC_1A'))
208 .fontColor($r('app.color.color_CCCCCC')) 217 .fontColor($r('app.color.color_CCCCCC'))
209 - .onClick(() => { 218 + .onClick(async () => {
  219 + let retvalue = await FastClickUtil.isMinDelayTime()
  220 + if(retvalue){
  221 + return
  222 + }
210 this.handleAccention() 223 this.handleAccention()
211 }) 224 })
212 } 225 }
@@ -275,7 +288,11 @@ export struct DynamicDetailComponent { @@ -275,7 +288,11 @@ export struct DynamicDetailComponent {
275 288
276 } 289 }
277 } 290 }
278 - .onClick((event: ClickEvent) => { 291 + .onClick(async (event: ClickEvent) => {
  292 + let retvalue = await FastClickUtil.isMinDelayTime()
  293 + if(retvalue){
  294 + return
  295 + }
279 ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index) 296 ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
280 }) 297 })
281 } else { 298 } else {
@@ -292,7 +309,11 @@ export struct DynamicDetailComponent { @@ -292,7 +309,11 @@ export struct DynamicDetailComponent {
292 item.height = callback?.height || 0; 309 item.height = callback?.height || 0;
293 }) 310 })
294 } 311 }
295 - .onClick((event: ClickEvent) => { 312 + .onClick(async (event: ClickEvent) => {
  313 + let retvalue = await FastClickUtil.isMinDelayTime()
  314 + if(retvalue){
  315 + return
  316 + }
296 ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index) 317 ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
297 }) 318 })
298 } 319 }
@@ -304,7 +325,11 @@ export struct DynamicDetailComponent { @@ -304,7 +325,11 @@ export struct DynamicDetailComponent {
304 .aspectRatio(1) 325 .aspectRatio(1)
305 .borderRadius(this.caclImageRadius(index)) 326 .borderRadius(this.caclImageRadius(index))
306 } 327 }
307 - .onClick((event: ClickEvent) => { 328 + .onClick(async (event: ClickEvent) => {
  329 + let retvalue = await FastClickUtil.isMinDelayTime()
  330 + if(retvalue){
  331 + return
  332 + }
308 ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index) 333 ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
309 }) 334 })
310 } else { 335 } else {
@@ -315,7 +340,11 @@ export struct DynamicDetailComponent { @@ -315,7 +340,11 @@ export struct DynamicDetailComponent {
315 .aspectRatio(1) 340 .aspectRatio(1)
316 .borderRadius(this.caclImageRadius(index)) 341 .borderRadius(this.caclImageRadius(index))
317 } 342 }
318 - .onClick((event: ClickEvent) => { 343 + .onClick(async (event: ClickEvent) => {
  344 + let retvalue = await FastClickUtil.isMinDelayTime()
  345 + if(retvalue){
  346 + return
  347 + }
319 ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index) 348 ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
320 }) 349 })
321 } 350 }
@@ -372,7 +401,11 @@ export struct DynamicDetailComponent { @@ -372,7 +401,11 @@ export struct DynamicDetailComponent {
372 left: this.contentDetailData.videoInfo[0].videoLandScape === 1 ? 0 : 25, 401 left: this.contentDetailData.videoInfo[0].videoLandScape === 1 ? 0 : 25,
373 top: $r('app.float.margin_8') 402 top: $r('app.float.margin_8')
374 }) 403 })
375 - .onClick((event: ClickEvent) => { 404 + .onClick(async (event: ClickEvent) => {
  405 + let retvalue = await FastClickUtil.isMinDelayTime()
  406 + if(retvalue){
  407 + return
  408 + }
376 ProcessUtils.processPage(this.mJumpInfo) 409 ProcessUtils.processPage(this.mJumpInfo)
377 }) 410 })
378 } 411 }
@@ -430,7 +463,11 @@ export struct DynamicDetailComponent { @@ -430,7 +463,11 @@ export struct DynamicDetailComponent {
430 .borderWidth($r('app.float.margin_1')) 463 .borderWidth($r('app.float.margin_1'))
431 .borderColor($r('app.color.color_EDEDED')) 464 .borderColor($r('app.color.color_EDEDED'))
432 .borderRadius($r('app.float.margin_20')) 465 .borderRadius($r('app.float.margin_20'))
433 - .onClick((event: ClickEvent) => { 466 + .onClick(async (event: ClickEvent) => {
  467 + let retvalue = await FastClickUtil.isMinDelayTime()
  468 + if(retvalue){
  469 + return
  470 + }
434 //点赞操作 471 //点赞操作
435 this.toggleLikeStatus() 472 this.toggleLikeStatus()
436 }) 473 })
@@ -481,6 +518,13 @@ export struct DynamicDetailComponent { @@ -481,6 +518,13 @@ export struct DynamicDetailComponent {
481 * */ 518 * */
482 private async getContentDetailData() { 519 private async getContentDetailData() {
483 this.isNetConnected = NetworkUtil.isNetConnected() 520 this.isNetConnected = NetworkUtil.isNetConnected()
  521 + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
  522 + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
  523 + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
  524 + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
  525 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
  526 + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
  527 + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
484 try { 528 try {
485 let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) 529 let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType)
486 this.isPageEnd = true; 530 this.isPageEnd = true;
1 /** 1 /**
2 * 这里是人民号动态中的顶部信息:人民号logo,名字,描述,关注等 2 * 这里是人民号动态中的顶部信息:人民号logo,名字,描述,关注等
3 */ 3 */
  4 +import {
  5 + ContentDetailRequest,
  6 + postInteractAccentionOperateParams
  7 +} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
4 import { RmhInfoDTO } from 'wdBean' 8 import { RmhInfoDTO } from 'wdBean'
5 import { CommonConstants } from 'wdConstant/Index'; 9 import { CommonConstants } from 'wdConstant/Index';
6 -import { DateTimeUtils, SPHelper } from 'wdKit'; 10 +import { DateTimeUtils, SPHelper, Logger, ToastUtils } from 'wdKit';
7 import { SpConstants } from 'wdConstant/Index' 11 import { SpConstants } from 'wdConstant/Index'
8 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 12 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
9 import router from '@ohos.router' 13 import router from '@ohos.router'
  14 +import { postBatchAttentionStatusParams } from 'wdBean/Index';
  15 +import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'
10 16
11 @Component 17 @Component
12 export struct RmhTitle { 18 export struct RmhTitle {
13 @Prop rmhInfo: RmhInfoDTO 19 @Prop rmhInfo: RmhInfoDTO
14 @Prop publishTime: string | undefined 20 @Prop publishTime: string | undefined
  21 + /**
  22 + * 是否需要隐藏发布时间超过2天的时间展示,默认不隐藏
  23 + */
15 @Prop hideTime: boolean 24 @Prop hideTime: boolean
  25 + /**
  26 + * 默认未关注 点击去关注
  27 + */
  28 + @State followStatus: string = '0';
16 29
17 - async appointReq() { 30 + /**
  31 + * 关注号主
  32 + */
  33 + async handleAccention() {
18 // 未登录,跳转登录 34 // 未登录,跳转登录
19 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') 35 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
20 if (!user_id) { 36 if (!user_id) {
21 WDRouterRule.jumpWithPage(WDRouterPage.loginPage) 37 WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
22 return 38 return
23 } 39 }
  40 +
  41 + const params2: postInteractAccentionOperateParams = {
  42 + attentionUserType: this.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
  43 + attentionUserId: this.rmhInfo?.userId || '', // 被关注用户号主id
  44 + attentionCreatorId: this.rmhInfo?.rmhId || '', // 被关注用户号主id
  45 + status: this.followStatus == '0' ? 1 : 0,
  46 + }
  47 + ContentDetailRequest.postInteractAccentionOperate(params2).then(res => {
  48 + console.log('rmhTitle-data', JSON.stringify(res.data))
  49 + if (this.followStatus == '1') {
  50 + this.followStatus = '0'
  51 + } else {
  52 + this.followStatus = '1'
  53 + // 弹窗样式与何时调用待确认
  54 + ContentDetailRequest.postPointLevelOperate({ operateType: 6 }).then((res) => {
  55 + console.log('关注号主获取积分==', JSON.stringify(res.data))
  56 + if (res.data?.showToast) {
  57 + ToastUtils.showToast(res.data.ruleName + '+' + res.data.rulePoint + '积分', 1000);
  58 + }
  59 + })
  60 + }
  61 + })
  62 + }
  63 + /**
  64 + * 查询当前登录用户是否关注作品号主
  65 + * */
  66 + async getBatchAttentionStatus() {
  67 + try {
  68 + const params: postBatchAttentionStatusParams = {
  69 + creatorIds: [{ creatorId: this.rmhInfo?.rmhId ?? '' }]
  70 + }
  71 + let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)
  72 + this.followStatus = data[0]?.status;
  73 + Logger.info(`rmhTitle-followStatus:${JSON.stringify(this.followStatus)}`)
  74 + } catch (exception) {
  75 + Logger.info(`rmhTitle-followStatus:${JSON.stringify(exception)}`)
  76 + }
24 } 77 }
25 78
26 aboutToAppear(): void { 79 aboutToAppear(): void {
  80 + this.getBatchAttentionStatus()
  81 +
27 let page = router.getState(); 82 let page = router.getState();
28 if (page.path.includes('/page/PeopleShipHomePage') || page.path.includes('/pages/MainPage')) { 83 if (page.path.includes('/page/PeopleShipHomePage') || page.path.includes('/pages/MainPage')) {
29 this.hideTime = true; 84 this.hideTime = true;
@@ -88,17 +143,20 @@ export struct RmhTitle { @@ -88,17 +143,20 @@ export struct RmhTitle {
88 Blank() 143 Blank()
89 if (this.rmhInfo.cnIsAttention) { 144 if (this.rmhInfo.cnIsAttention) {
90 Row() { 145 Row() {
91 - Image($r('app.media.rmh_follow'))  
92 - .width(16)  
93 - .height(16)  
94 - Text('关注') 146 + if (Number(this.followStatus) === 0) {
  147 + Image($r('app.media.rmh_follow'))
  148 + .width(16)
  149 + .height(16)
  150 + }
  151 +
  152 + Text(Number(this.followStatus) === 0 ? '关注' : '已关注')
95 .fontSize($r('app.float.font_size_13')) 153 .fontSize($r('app.float.font_size_13'))
96 .fontColor($r('app.color.color_ED2800')) 154 .fontColor($r('app.color.color_ED2800'))
97 } 155 }
98 .flexShrink(0) 156 .flexShrink(0)
99 .alignSelf(ItemAlign.Center) 157 .alignSelf(ItemAlign.Center)
100 .onClick(() => { 158 .onClick(() => {
101 - this.appointReq(); 159 + this.handleAccention();
102 }) 160 })
103 } 161 }
104 } 162 }
1 -import { commentInfo, CompDTO, ContentDTO, Params } from 'wdBean'; 1 +import { commentInfo, CompDTO, ContentDTO, Params, batchLikeAndCollectResult } from 'wdBean';
2 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 2 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
3 -import { DateTimeUtils, SPHelper } from 'wdKit/Index'; 3 +import { DateTimeUtils, SPHelper, Logger } from 'wdKit/Index';
4 import { ProcessUtils } from 'wdRouter'; 4 import { ProcessUtils } from 'wdRouter';
5 import { SpConstants } from 'wdConstant/Index' 5 import { SpConstants } from 'wdConstant/Index'
  6 +import {
  7 + batchLikeAndCollectParams,
  8 + ContentDetailRequest,
  9 + contentListParams,
  10 + postExecuteCollectRecordParams,
  11 + postExecuteLikeParams,
  12 + postInteractAccentionOperateParams
  13 +} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
  14 +import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
6 15
7 /** 16 /**
8 * 精选评论卡 17 * 精选评论卡
9 * Zh_Single_Row-06 18 * Zh_Single_Row-06
10 */ 19 */
11 const TAG = 'Zh_Single_Row-06' 20 const TAG = 'Zh_Single_Row-06'
12 -  
13 -// interface commentInfo {  
14 -// commentTitle: string,  
15 -// newsTitle: string,  
16 -// userName: string,  
17 -// userHeaderUrl: string,  
18 -// publishTime: number  
19 -// }  
20 -// interface operDataListItem {  
21 -// commentInfo: commentInfo  
22 -// }  
23 -// interface CommentData{  
24 -// operDataList: Array<operDataListItem>  
25 -// }  
26 -  
27 @Entry 21 @Entry
28 @Component 22 @Component
29 export struct ZhSingleRow06 { 23 export struct ZhSingleRow06 {
30 @State compDTO: CompDTO = {} as CompDTO 24 @State compDTO: CompDTO = {} as CompDTO
31 - @State likeBl: boolean = false; 25 + @State newsStatusOfUser: batchLikeAndCollectResult = {
  26 + likeStatus: '0'
  27 + } as batchLikeAndCollectResult // 点赞、收藏状态
  28 +
  29 + aboutToAppear(): void {
  30 + this.getInteractDataStatus()
  31 + }
32 32
33 - async likeAction() { 33 + /**
  34 + * 点赞、取消点赞
  35 + */
  36 + async toggleLikeStatus() {
  37 + // 未登录,跳转登录
34 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') 38 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
35 if (!user_id) { 39 if (!user_id) {
36 WDRouterRule.jumpWithPage(WDRouterPage.loginPage) 40 WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
37 return 41 return
38 } 42 }
  43 + const params: postExecuteLikeParams = {
  44 + status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1',
  45 + contentId: this.compDTO.operDataList[0]?.commentInfo?.newsId + '',
  46 + contentType: this.compDTO.operDataList[0]?.commentInfo?.newsType + '',
  47 + }
  48 + ContentDetailRequest.postExecuteLike(params).then(res => {
  49 + this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'
  50 + })
  51 + }
39 52
40 - if (this.likeBl) {  
41 - this.likeBl = false;  
42 - } else {  
43 - this.likeBl = true; 53 + // 已登录->查询用户对作品点赞、收藏状态
  54 + async getInteractDataStatus() {
  55 + // 未登录,跳转登录
  56 + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
  57 + if (!user_id) {
  58 + return
  59 + }
  60 + try {
  61 + const params: batchLikeAndCollectParams = {
  62 + contentList: [
  63 + {
  64 + contentId: this.compDTO.operDataList[0]?.commentInfo?.newsId + '',
  65 + contentType: this.compDTO.operDataList[0]?.commentInfo?.newsType + '',
  66 + }
  67 + ]
  68 + }
  69 + let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
  70 + console.error(TAG, 'ZhSingleRow06-data', JSON.stringify(data))
  71 + this.newsStatusOfUser = data[0];
  72 + Logger.info(TAG, `ZhSingleRow06-newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
  73 + } catch (exception) {
  74 + console.error(TAG, JSON.stringify(exception))
44 } 75 }
45 } 76 }
46 77
@@ -95,7 +126,7 @@ export struct ZhSingleRow06 { @@ -95,7 +126,7 @@ export struct ZhSingleRow06 {
95 .fontColor(0x999999) 126 .fontColor(0x999999)
96 127
97 Row(){ 128 Row(){
98 - Image(this.likeBl ? $r('app.media.icon_like_select') : $r('app.media.icon_like')) 129 + Image(this.newsStatusOfUser?.likeStatus == '1' ? $r('app.media.icon_like_select') : $r('app.media.icon_like'))
99 .width(16) 130 .width(16)
100 .height(16) 131 .height(16)
101 .margin({right: 3}) 132 .margin({right: 3})
@@ -103,9 +134,11 @@ export struct ZhSingleRow06 { @@ -103,9 +134,11 @@ export struct ZhSingleRow06 {
103 Text('点赞') 134 Text('点赞')
104 .fontSize(15) 135 .fontSize(15)
105 .fontColor(0x999999) 136 .fontColor(0x999999)
  137 + .onClick(() => {
  138 + })
106 } 139 }
107 .onClick(() => { 140 .onClick(() => {
108 - this.likeAction() 141 + this.toggleLikeStatus()
109 }) 142 })
110 } 143 }
111 .justifyContent(FlexAlign.SpaceBetween) 144 .justifyContent(FlexAlign.SpaceBetween)
@@ -42,7 +42,8 @@ export default struct MinePagePersonFunctionUI { @@ -42,7 +42,8 @@ export default struct MinePagePersonFunctionUI {
42 WDRouterRule.jumpWithPage(WDRouterPage.loginPage) 42 WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
43 return 43 return
44 }else { 44 }else {
45 - WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage) 45 + let params: Record<string, string> = {'comment': "1"};
  46 + WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage,params)
46 } 47 }
47 break; 48 break;
48 } 49 }
1 import { SpConstants } from 'wdConstant/Index' 1 import { SpConstants } from 'wdConstant/Index'
2 -import { DateTimeUtils, SPHelper, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index' 2 +import { SPHelper, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'
3 import { HttpUtils } from 'wdNetwork/Index' 3 import { HttpUtils } from 'wdNetwork/Index'
4 import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' 4 import { WDRouterRule, WDRouterPage } from 'wdRouter/Index'
5 import MinePageDatasModel from '../../../model/MinePageDatasModel' 5 import MinePageDatasModel from '../../../model/MinePageDatasModel'
@@ -116,9 +116,14 @@ export struct FollowChildComponent{ @@ -116,9 +116,14 @@ export struct FollowChildComponent{
116 }.height('202lpx') 116 }.height('202lpx')
117 .justifyContent(FlexAlign.Start) 117 .justifyContent(FlexAlign.Start)
118 118
119 - Text().backgroundColor($r('app.color.color_EDEDED')) 119 + // Text().backgroundColor($r('app.color.color_EDEDED'))
  120 + // .width('100%')
  121 + // .height('2lpx')
  122 + Divider()
120 .width('100%') 123 .width('100%')
121 .height('2lpx') 124 .height('2lpx')
  125 + .color($r('app.color.color_F5F5F5'))
  126 + .strokeWidth('1lpx')
122 }.width('100%') 127 }.width('100%')
123 128
124 }else { 129 }else {
@@ -230,9 +235,15 @@ export struct FollowChildComponent{ @@ -230,9 +235,15 @@ export struct FollowChildComponent{
230 }.height('146lpx') 235 }.height('146lpx')
231 .justifyContent(FlexAlign.Center) 236 .justifyContent(FlexAlign.Center)
232 237
233 - Text().backgroundColor($r('app.color.color_EDEDED')) 238 + // Text().backgroundColor($r('app.color.color_EDEDED'))
  239 + // .width('100%')
  240 + // .height('2lpx')
  241 +
  242 + Divider()
234 .width('100%') 243 .width('100%')
235 .height('2lpx') 244 .height('2lpx')
  245 + .color($r('app.color.color_F5F5F5'))
  246 + .strokeWidth('1lpx')
236 }.width('100%') 247 }.width('100%')
237 248
238 } 249 }
@@ -255,12 +266,6 @@ export struct FollowChildComponent{ @@ -255,12 +266,6 @@ export struct FollowChildComponent{
255 this.data.status = this.data.status ==="0"?"1":"0" 266 this.data.status = this.data.status ==="0"?"1":"0"
256 267
257 UserDataLocal.setUserFollowOperation(this.data.creatorId+","+this.data.status) 268 UserDataLocal.setUserFollowOperation(this.data.creatorId+","+this.data.status)
258 -  
259 - // if(this.data.status === "1"){  
260 - // UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+"")  
261 - // }else{  
262 - // UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+","+this.data.creatorId)  
263 - // }  
264 } 269 }
265 } 270 }
266 }) 271 })
1 -import { ContentDTO, 1 +import {
  2 + ContentDTO,
2 contentListParams, 3 contentListParams,
3 - FullColumnImgUrlDTO, InteractDataDTO, 4 + FullColumnImgUrlDTO,
  5 + InteractDataDTO,
4 Params, 6 Params,
5 - RmhInfoDTO, VideoInfoDTO } from 'wdBean/Index' 7 + RmhInfoDTO,
  8 + VideoInfoDTO
  9 +} from 'wdBean/Index'
6 import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO' 10 import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO'
7 import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO' 11 import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO'
8 -import { LazyDataSource, Logger, StringUtils, ToastUtils } from 'wdKit/Index' 12 +import { LazyDataSource, Logger, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'
9 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' 13 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
  14 +import MinePageDatasModel from '../../model/MinePageDatasModel'
10 import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' 15 import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
11 import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem' 16 import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem'
  17 +import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'
  18 +import { FollowListStatusRequestItem } from '../../viewmodel/FollowListStatusRequestItem'
  19 +import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem'
12 import { SearchResultContentData } from '../../viewmodel/SearchResultContentData' 20 import { SearchResultContentData } from '../../viewmodel/SearchResultContentData'
13 import { SearchResultContentItem, SearchRmhDescription } from '../../viewmodel/SearchResultContentItem' 21 import { SearchResultContentItem, SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
14 import { CardParser } from '../CardParser' 22 import { CardParser } from '../CardParser'
  23 +import { FollowChildComponent } from '../mine/follow/FollowChildComponent'
15 import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI' 24 import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI'
16 import { ActivityItemComponent } from './ActivityItemComponent' 25 import { ActivityItemComponent } from './ActivityItemComponent'
17 import { SearchCreatorComponent } from './SearchCreatorComponent' 26 import { SearchCreatorComponent } from './SearchCreatorComponent'
@@ -19,27 +28,28 @@ import { SearchCreatorComponent } from './SearchCreatorComponent' @@ -19,27 +28,28 @@ import { SearchCreatorComponent } from './SearchCreatorComponent'
19 const TAG = "SearchResultContentComponent" 28 const TAG = "SearchResultContentComponent"
20 29
21 @Component 30 @Component
22 -export struct SearchResultContentComponent{  
23 - @State keywords:string = ""  
24 - @State searchType:string = "" 31 +export struct SearchResultContentComponent {
  32 + @State keywords: string = ""
  33 + @State searchType: string = ""
25 @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); 34 @State data: LazyDataSource<ContentDTO> = new LazyDataSource();
26 @State data_rmh: SearchRmhDescription[] = [] 35 @State data_rmh: SearchRmhDescription[] = []
27 - @State count:number = -1;  
28 - @State isLoading:boolean = false  
29 - @State hasMore:boolean = true  
30 - curPageNum:number = 1;  
31 - 36 + @State count: number = -1;
  37 + @State isLoading: boolean = false
  38 + @State hasMore: boolean = true
  39 + curPageNum: number = 1;
  40 + @State bean: FollowListDetailItem = new FollowListDetailItem("", "", "", "", "", "", "", "", "", -1, -1, "")
  41 + scroller: Scroller = new Scroller()
32 42
33 aboutToAppear(): void { 43 aboutToAppear(): void {
34 - if(this.searchType == "全部"){ 44 + if (this.searchType == "全部") {
35 this.searchType = "all" 45 this.searchType = "all"
36 - }else if(this.searchType == "精选"){ 46 + } else if (this.searchType == "精选") {
37 this.searchType = "cms" 47 this.searchType = "cms"
38 - }else if(this.searchType == "人民号"){ 48 + } else if (this.searchType == "人民号") {
39 this.searchType = "rmh" 49 this.searchType = "rmh"
40 - }else if(this.searchType == "视频"){ 50 + } else if (this.searchType == "视频") {
41 this.searchType = "video" 51 this.searchType = "video"
42 - }else if(this.searchType == "活动"){ 52 + } else if (this.searchType == "活动") {
43 this.searchType = "activity" 53 this.searchType = "activity"
44 } 54 }
45 55
@@ -47,93 +57,135 @@ export struct SearchResultContentComponent{ @@ -47,93 +57,135 @@ export struct SearchResultContentComponent{
47 this.getNewSearchResultData() 57 this.getNewSearchResultData()
48 } 58 }
49 59
50 - getNewSearchResultData(){ 60 + getNewSearchResultData() {
51 this.isLoading = true 61 this.isLoading = true
52 - if(this.hasMore){  
53 - SearcherAboutDataModel.getSearchResultListData("20",`${this.curPageNum}`,this.searchType,this.keywords,getContext(this)).then((value)=>{  
54 - if (!this.data || value.list.length == 0){ 62 + if (this.hasMore) {
  63 + SearcherAboutDataModel.getSearchResultListData("15", `${this.curPageNum}`, this.searchType, this.keywords,
  64 + getContext(this)).then((value) => {
  65 + if (!this.data || value.list.length == 0) {
55 this.hasMore = false 66 this.hasMore = false
56 this.isLoading = false 67 this.isLoading = false
57 - this.count = this.count===-1?0:this.count  
58 - }else{  
59 - if(value.list[0].dataList!=null){ 68 + this.count = this.count === -1 ? 0 : this.count
  69 + } else {
  70 + if (value.list[0].dataList != null) {
60 let data_temp: SearchRmhDescription[] = [] 71 let data_temp: SearchRmhDescription[] = []
  72 +
61 data_temp = value.list[0].dataList 73 data_temp = value.list[0].dataList
62 74
63 //TODO 查询创作者详情接口 75 //TODO 查询创作者详情接口
64 let request = new CreatorDetailRequestItem() 76 let request = new CreatorDetailRequestItem()
65 77
66 - data_temp.forEach((data)=>{ 78 + data_temp.forEach((data) => {
67 request.creatorIdList.push(data.creatorId) 79 request.creatorIdList.push(data.creatorId)
68 }) 80 })
69 81
70 - SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{  
71 - if(value!=null && value.length>0){  
72 - data_temp.forEach((data)=>{  
73 - value.forEach((item)=>{  
74 - if(data.creatorId == item.creatorId){ 82 + SearcherAboutDataModel.getCreatorDetailListData(request).then((value) => {
  83 + if (value != null && value.length > 0) {
  84 + data_temp.forEach((data) => {
  85 + value.forEach((item) => {
  86 + if (data.creatorId == item.creatorId) {
75 data.headerPhotoUrl = item.headPhotoUrl.split("?")[0] 87 data.headerPhotoUrl = item.headPhotoUrl.split("?")[0]
76 - data.mainControl = item.mainControl+"" 88 + data.mainControl = item.mainControl + ""
  89 +
  90 + if(data_temp.length === 1){
  91 + this.bean.headPhotoUrl = item.headPhotoUrl.split("?")[0]
  92 + this.bean.cnUserName = item.userName
  93 + this.bean.creatorId = item.creatorId
  94 + this.bean.authIcon = item.authIcon
  95 +
  96 + if (value[0].fansNum > 10000) {
  97 + let temp = (value[0].fansNum / 10000) + ""
  98 + let index = temp.indexOf('.')
  99 + if (index != -1) {
  100 + temp = temp.substring(0, index + 2)
  101 + } else {
  102 + temp = temp
  103 + }
  104 + this.bean.cnFansNum = temp + "万"
  105 + } else {
  106 + this.bean.cnFansNum = item.fansNum + ""
  107 + }
  108 + this.bean.introduction = item.introduction
  109 + this.bean.mainControl = item.mainControl
  110 + this.bean.banControl = item.banControl
  111 + this.bean.cnUserType = item.userType
  112 + this.bean.cnUserId = item.userId
  113 + }
77 } 114 }
78 }) 115 })
79 }) 116 })
80 } 117 }
81 - data_temp.forEach((data)=>{ 118 + data_temp.forEach((data) => {
82 this.data_rmh.push(data) 119 this.data_rmh.push(data)
83 }) 120 })
84 121
85 - }).catch((err:Error)=>{  
86 - console.log(TAG,JSON.stringify(err)) 122 + //只有一条创作者,获取 创作者信息
  123 + if (this.data_rmh.length === 1) {
  124 + if(StringUtils.isNotEmpty(UserDataLocal.getUserId())){
  125 + //查询是否被关注
  126 + let status = new FollowListStatusRequestItem()
  127 + status.creatorIds.push(new QueryListIsFollowedItem(this.data_rmh[0].creatorId))
  128 + MinePageDatasModel.getFollowListStatusData(status, getContext(this)).then((newValue) => {
  129 + this.bean.status = newValue[0].status
  130 + }).catch((err: Error) => {
  131 + console.log(TAG, "请求失败")
  132 + })
  133 + }else{
  134 + this.bean.status = ""
  135 + }
  136 + }
  137 + }).catch((err: Error) => {
  138 + console.log(TAG, JSON.stringify(err))
87 }) 139 })
88 } 140 }
89 this.getInteractData(value) 141 this.getInteractData(value)
90 } 142 }
91 - }).catch((err:Error)=>{  
92 - console.log(TAG,JSON.stringify(err)) 143 + }).catch((err: Error) => {
  144 + console.log(TAG, JSON.stringify(err))
93 this.isLoading = false 145 this.isLoading = false
94 - this.count = this.count===-1?0:this.count 146 + this.count = this.count === -1 ? 0 : this.count
95 }) 147 })
96 } 148 }
97 } 149 }
98 150
99 - getInteractData(resultData:SearchResultContentData){  
100 - if(resultData.list[0].dataList!=null){  
101 - resultData.list.splice(0,1) 151 + getInteractData(resultData: SearchResultContentData) {
  152 + if (resultData.list[0].dataList != null) {
  153 + resultData.list.splice(0, 1)
102 } 154 }
103 155
104 - let data : contentListParams = { 156 + let data: contentListParams = {
105 contentList: [] 157 contentList: []
106 } 158 }
107 - resultData.list.forEach((item)=>{ 159 + resultData.list.forEach((item) => {
108 data.contentList.push({ 160 data.contentList.push({
109 contentId: item.data.id + '', 161 contentId: item.data.id + '',
110 contentType: Number.parseInt(item.data.type) 162 contentType: Number.parseInt(item.data.type)
111 }) 163 })
112 }) 164 })
113 165
114 - SearcherAboutDataModel.getInteractListData(data,getContext(this)).then((newValue)=>{  
115 - newValue.forEach((item)=>{  
116 - resultData.list.forEach((data)=>{ 166 + SearcherAboutDataModel.getInteractListData(data, getContext(this)).then((newValue) => {
  167 + newValue.forEach((item) => {
  168 + resultData.list.forEach((data) => {
117 if (item.contentId == data.data.id) { 169 if (item.contentId == data.data.id) {
118 - data.data.collectNum = item.collectNum+""  
119 - data.data.commentNum = item.commentNum+""  
120 - data.data.likeNum = item.likeNum+""  
121 - data.data.readNum = item.readNum+""  
122 - data.data.shareNum = item.shareNum+"" 170 + data.data.collectNum = item.collectNum + ""
  171 + data.data.commentNum = item.commentNum + ""
  172 + data.data.likeNum = item.likeNum + ""
  173 + data.data.readNum = item.readNum + ""
  174 + data.data.shareNum = item.shareNum + ""
123 } 175 }
124 }) 176 })
125 }) 177 })
126 178
127 - resultData.list.forEach((value)=>{  
128 - let photos:FullColumnImgUrlDTO[] = []  
129 - if(value.data.appStyle === 4){  
130 - value.data.appStyleImages.split("&&").forEach((value)=>{  
131 - photos.push({url:value} as FullColumnImgUrlDTO) 179 + resultData.list.forEach((value) => {
  180 + let photos: FullColumnImgUrlDTO[] = []
  181 + if (value.data.appStyle === 4) {
  182 + value.data.appStyleImages.split("&&").forEach((value) => {
  183 + photos.push({ url: value } as FullColumnImgUrlDTO)
132 }) 184 })
133 } 185 }
134 186
135 - let contentDTO = this.dataTransform(value,photos);  
136 - if(contentDTO.appStyle != "13"){ 187 + let contentDTO = this.dataTransform(value, photos);
  188 + if (contentDTO.appStyle != "13") {
137 this.data.push(contentDTO) 189 this.data.push(contentDTO)
138 } 190 }
139 191
@@ -142,131 +194,189 @@ export struct SearchResultContentComponent{ @@ -142,131 +194,189 @@ export struct SearchResultContentComponent{
142 this.count = this.data.totalCount() 194 this.count = this.data.totalCount()
143 if (this.data.totalCount() < resultData.totalCount) { 195 if (this.data.totalCount() < resultData.totalCount) {
144 this.curPageNum++ 196 this.curPageNum++
145 - }else { 197 + } else {
146 this.hasMore = false 198 this.hasMore = false
147 } 199 }
148 this.isLoading = false 200 this.isLoading = false
149 201
150 - if(this.count === 0 && resultData.list.length > 0){ 202 + if (this.count === 0 && resultData.list.length > 0) {
151 this.count = -1 203 this.count = -1
152 - if(!this.isLoading){ 204 + if (!this.isLoading) {
153 //加载分页数据 205 //加载分页数据
154 this.getNewSearchResultData() 206 this.getNewSearchResultData()
155 } 207 }
156 - }else if(this.count <= 20 && resultData.list.length > 0){  
157 - if(!this.isLoading){ 208 + } else if (this.count <= 10 && resultData.list.length > 0) {
  209 + if (!this.isLoading) {
158 //加载分页数据 210 //加载分页数据
159 this.getNewSearchResultData() 211 this.getNewSearchResultData()
160 } 212 }
161 } 213 }
162 - }).catch((err:Error)=>{  
163 - console.log(TAG,"请求失败") 214 + }).catch((err: Error) => {
  215 + console.log(TAG, "请求失败")
164 this.isLoading = false 216 this.isLoading = false
165 - this.count = this.count===-1?0:this.count 217 + this.count = this.count === -1 ? 0 : this.count
166 }) 218 })
167 } 219 }
168 220
169 build() { 221 build() {
170 Column() { 222 Column() {
171 - if(this.count == 0){  
172 - ListHasNoMoreDataUI({style:2})  
173 - }else{  
174 - Column(){  
175 - if (this.data_rmh!=null && this.data_rmh.length > 0) {  
176 - //List  
177 - List({space:'8lpx'}) {  
178 - ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {  
179 - ListItem() {  
180 - SearchCreatorComponent({item:item})  
181 - }.onClick(()=>{  
182 - //TODO 跳转  
183 - })  
184 - .width('150lpx')  
185 - .height('100%')  
186 - })  
187 - 223 + if (this.count == 0) {
  224 + ListHasNoMoreDataUI({ style: 2 })
  225 + } else {
  226 + List() {
  227 + if (this.data_rmh != null && this.data_rmh.length > 0){
  228 + if (this.data_rmh.length === 1){
  229 + ListItem(){
  230 + FollowChildComponent({ data: this.bean, type: 1 })
  231 + }.padding({left:"31lpx",right:"31lpx"})
  232 + }else{
188 ListItem(){ 233 ListItem(){
189 Column(){ 234 Column(){
190 - Text("查看更多")  
191 - .width('19lpx')  
192 - .fontSize('19lpx')  
193 - .fontWeight('400lpx')  
194 - .lineHeight('27lpx')  
195 - .fontColor($r('app.color.color_9E9E9E'))  
196 - }.borderRadius({topLeft:'4lpx',bottomLeft:'4lpx'})  
197 - .height('180lpx')  
198 - .width('77lpx')  
199 - .backgroundColor($r('app.color.color_EDEDED'))  
200 - .justifyContent(FlexAlign.Center)  
201 -  
202 - }.height('100%')  
203 - .margin({left:'23lpx'})  
204 - .onClick(()=>{  
205 - let params: Params = {  
206 - pageID: this.keywords 235 + this.SearchListUI()
207 } 236 }
208 - WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,params)  
209 - }) 237 + }
210 } 238 }
211 - .cachedCount(6)  
212 - .edgeEffect(EdgeEffect.Spring)  
213 - .scrollBar(BarState.Off)  
214 - .listDirection(Axis.Horizontal)  
215 - .width('100%')  
216 - .height('219lpx')  
217 -  
218 - Divider()  
219 - .width('100%')  
220 - .height('12lpx')  
221 - .color($r('app.color.color_F5F5F5'))  
222 - .strokeWidth('12lpx')  
223 } 239 }
224 - //List  
225 - List({ space: '6lpx' }) {  
226 - LazyForEach(this.data, (item: ContentDTO, index: number) => {  
227 - ListItem() {  
228 - Column(){  
229 - if(this.searchType == "activity"){  
230 - ActivityItemComponent({contentDTO:item})  
231 - }else{  
232 - CardParser({contentDTO:item})  
233 - }  
234 - if(index != this.data.totalCount()-1 ){  
235 - Divider()  
236 - .width('100%')  
237 - .height('1lpx')  
238 - .color($r('app.color.color_F5F5F5'))  
239 - .strokeWidth('1lpx')  
240 - } 240 + LazyForEach(this.data, (item: ContentDTO, index: number) => {
  241 + ListItem() {
  242 + Column() {
  243 + if (this.searchType == "activity") {
  244 + ActivityItemComponent({ contentDTO: item })
  245 + } else {
  246 + CardParser({ contentDTO: item })
  247 + }
  248 + if (index != this.data.totalCount() - 1) {
  249 + Divider()
  250 + .width('100%')
  251 + .height('1lpx')
  252 + .color($r('app.color.color_F5F5F5'))
  253 + .strokeWidth('1lpx')
241 } 254 }
242 - }  
243 - }, (item: ContentDTO, index: number) => index.toString())  
244 -  
245 - //没有更多数据 显示提示  
246 - if(!this.hasMore && this.data.totalCount() > 0){  
247 - ListItem(){  
248 - ListHasNoMoreDataUI()  
249 } 255 }
250 } 256 }
251 - }.cachedCount(6)  
252 - .edgeEffect(EdgeEffect.None)  
253 - .scrollBar(BarState.Off)  
254 - .layoutWeight(1)  
255 - .onReachEnd(()=>{  
256 - console.log(TAG,"触底了");  
257 - if(!this.isLoading){  
258 - //加载分页数据  
259 - this.getNewSearchResultData() 257 + }, (item: ContentDTO, index: number) => index.toString())
  258 +
  259 + //没有更多数据 显示提示
  260 + if (!this.hasMore && this.data.totalCount() > 0) {
  261 + ListItem() {
  262 + ListHasNoMoreDataUI()
260 } 263 }
261 - })  
262 - }.layoutWeight(1) 264 + }
  265 + }.cachedCount(10)
  266 + .edgeEffect(EdgeEffect.None)
  267 + .scrollBar(BarState.Off)
  268 + .onReachEnd(() => {
  269 + console.log(TAG, "触底了");
  270 + if (!this.isLoading) {
  271 + //加载分页数据
  272 + this.getNewSearchResultData()
  273 + }
  274 + })
263 } 275 }
264 } 276 }
265 .backgroundColor($r('app.color.white')) 277 .backgroundColor($r('app.color.white'))
266 - .layoutWeight(1)  
267 .width('100%') 278 .width('100%')
268 } 279 }
269 280
  281 + @Builder
  282 + multiCreatorUI() {
  283 + Column() {
  284 + List() {
  285 + ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
  286 + ListItem() {
  287 + SearchCreatorComponent({ item: item })
  288 + }
  289 + .width('150lpx')
  290 + .height('100%')
  291 + })
  292 +
  293 + ListItem() {
  294 + Column() {
  295 + Text("查看更多")
  296 + .width('19lpx')
  297 + .fontSize('19lpx')
  298 + .fontWeight('400lpx')
  299 + .lineHeight('27lpx')
  300 + .fontColor($r('app.color.color_9E9E9E'))
  301 + }
  302 + .borderRadius({ topLeft: '4lpx', bottomLeft: '4lpx' })
  303 + .height('180lpx')
  304 + .width('77lpx')
  305 + .backgroundColor($r('app.color.color_EDEDED'))
  306 + .justifyContent(FlexAlign.Center)
  307 +
  308 + }.height('100%')
  309 + .margin({ left: '23lpx' })
  310 + .onClick(() => {
  311 + let params: Params = {
  312 + pageID: this.keywords
  313 + }
  314 + WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage, params)
  315 + })
  316 + }
  317 + .cachedCount(6)
  318 + .edgeEffect(EdgeEffect.None)
  319 + .scrollBar(BarState.Off)
  320 + .listDirection(Axis.Horizontal)
  321 + .width('100%')
  322 + .height('219lpx')
  323 +
  324 + Divider()
  325 + .width('100%')
  326 + .height('12lpx')
  327 + .color($r('app.color.color_F5F5F5'))
  328 + .strokeWidth('12lpx')
  329 + }
  330 + }
  331 +
  332 + @Builder
  333 + SearchListUI() {
  334 + List({space:'8lpx'}) {
  335 + ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
  336 + ListItem() {
  337 + SearchCreatorComponent({item:item})
  338 + }
  339 + .width('150lpx')
  340 + .height('100%')
  341 + })
  342 +
  343 + ListItem(){
  344 + Column(){
  345 + Text("查看更多")
  346 + .width('19lpx')
  347 + .fontSize('19lpx')
  348 + .fontWeight('400lpx')
  349 + .lineHeight('27lpx')
  350 + .fontColor($r('app.color.color_9E9E9E'))
  351 + }.borderRadius({topLeft:'4lpx',bottomLeft:'4lpx'})
  352 + .height('180lpx')
  353 + .width('77lpx')
  354 + .backgroundColor($r('app.color.color_EDEDED'))
  355 + .justifyContent(FlexAlign.Center)
  356 +
  357 + }.height('100%')
  358 + .margin({left:'23lpx'})
  359 + .onClick(()=>{
  360 + let params: Params = {
  361 + pageID: this.keywords
  362 + }
  363 + WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,params)
  364 + })
  365 + }
  366 + .cachedCount(6)
  367 + .edgeEffect(EdgeEffect.None)
  368 + .scrollBar(BarState.Off)
  369 + .listDirection(Axis.Horizontal)
  370 + .width('100%')
  371 + .height('219lpx')
  372 +
  373 + Divider()
  374 + .width('100%')
  375 + .height('12lpx')
  376 + .color($r('app.color.color_F5F5F5'))
  377 + .strokeWidth('12lpx')
  378 + }
  379 +
270 private dataTransform(value: SearchResultContentItem, photos: FullColumnImgUrlDTO[]): ContentDTO { 380 private dataTransform(value: SearchResultContentItem, photos: FullColumnImgUrlDTO[]): ContentDTO {
271 let contentDTO = new ContentDTO(); 381 let contentDTO = new ContentDTO();
272 contentDTO.appStyle = value.data.appStyle + "" 382 contentDTO.appStyle = value.data.appStyle + ""
@@ -31,10 +31,19 @@ struct MineHomePage { @@ -31,10 +31,19 @@ struct MineHomePage {
31 registTime:number = 0//账号注册时间 31 registTime:number = 0//账号注册时间
32 @State registerTimeForDay:number = 0 32 @State registerTimeForDay:number = 0
33 scroller: Scroller = new Scroller(); 33 scroller: Scroller = new Scroller();
  34 + @State params:Record<string, string> = router.getParams() as Record<string, string>;
  35 + @State isCommentEnter:string = "";
34 36
35 onPageShow(): void { 37 onPageShow(): void {
36 this.getUserInfo() 38 this.getUserInfo()
37 39
  40 + let intervalID = setInterval(() => {
  41 + this.isCommentEnter = this.params?.['comment'];
  42 + if(StringUtils.isNotEmpty(this.isCommentEnter)){
  43 + this.scroller.scrollEdge(Edge.Bottom)
  44 + }
  45 + clearInterval(intervalID);
  46 + }, 200);
38 } 47 }
39 48
40 build() { 49 build() {