陈剑华

Merge remote-tracking branch 'origin/main'

Showing 19 changed files with 397 additions and 243 deletions
@@ -9,6 +9,7 @@ export interface PageInfoDTO { @@ -9,6 +9,7 @@ export interface PageInfoDTO {
9 name: string; // 名称 9 name: string; // 名称
10 hasPopUp: number; 10 hasPopUp: number;
11 baselineShow: number; 11 baselineShow: number;
  12 + baselineCopywriting: string;
12 groups: GroupInfoDTO[]; 13 groups: GroupInfoDTO[];
13 channelInfo: ChannelInfoDTO; 14 channelInfo: ChannelInfoDTO;
14 15
@@ -20,11 +21,11 @@ export interface PageInfoDTO { @@ -20,11 +21,11 @@ export interface PageInfoDTO {
20 /** 21 /**
21 * 挂角广告数据 22 * 挂角广告数据
22 */ 23 */
23 - cornersAdv:AdvRuleBean 24 + cornersAdv: AdvRuleBean
24 /** 25 /**
25 * 广告中心-挂角广告信息 26 * 广告中心-挂角广告信息
26 */ 27 */
27 - cornersAdv2:CompAdvBean[] 28 + cornersAdv2: CompAdvBean[]
28 29
29 } 30 }
30 31
1 -import { AccountManagerUtils, Logger, DateTimeUtils } from 'wdKit'; 1 +import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper } from 'wdKit';
2 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 2 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
3 -import { ContentDetailDTO,batchLikeAndCollectResult,batchLikeAndCollectParams,postBatchAttentionStatusParams, 3 +import { ContentDetailDTO,postBatchAttentionStatusParams,
4 PhotoListBean, 4 PhotoListBean,
5 ContentDTO, 5 ContentDTO,
6 RmhInfoDTO, } from 'wdBean'; 6 RmhInfoDTO, } from 'wdBean';
7 import media from '@ohos.multimedia.media'; 7 import media from '@ohos.multimedia.media';
8 import { OperRowListView } from './view/OperRowListView'; 8 import { OperRowListView } from './view/OperRowListView';
9 import { WDPlayerController } from 'wdPlayer/Index'; 9 import { WDPlayerController } from 'wdPlayer/Index';
  10 +import {
  11 + batchLikeAndCollectParams,
  12 + batchLikeAndCollectResult,
  13 + ContentDetailRequest,
  14 + contentListParams,
  15 + postExecuteCollectRecordParams,
  16 + postExecuteLikeParams,
  17 + postInteractAccentionOperateParams
  18 +} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
10 import { ContentConstants } from '../constants/ContentConstants'; 19 import { ContentConstants } from '../constants/ContentConstants';
11 -import { ProcessUtils } from 'wdRouter'; 20 +import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter';
12 import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; 21 import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils';
13 import display from '@ohos.display'; 22 import display from '@ohos.display';
14 import { BusinessError } from '@ohos.base'; 23 import { BusinessError } from '@ohos.base';
15 -import { CommonConstants } from 'wdConstant/Index'; 24 +import { CommonConstants, SpConstants } from 'wdConstant/Index';
16 import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo' 25 import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo'
17 import router from '@ohos.router'; 26 import router from '@ohos.router';
18 const TAG = 'DynamicDetailComponent' 27 const TAG = 'DynamicDetailComponent'
@@ -24,20 +33,13 @@ export struct DynamicDetailComponent { @@ -24,20 +33,13 @@ export struct DynamicDetailComponent {
24 private contentId: string = '' 33 private contentId: string = ''
25 private relType: string = '' 34 private relType: string = ''
26 //出参 fixme 模拟数据用json转换 35 //出参 fixme 模拟数据用json转换
27 - @State contentDetailData: ContentDetailDTO = {  
28 - publishTime: "2023年03月14日 08:16",  
29 - rmhInfo:{rmhHeadUrl:"",rmhName:"人民号名称",rmhDesc:"人民号描述单行展示"},  
30 - newsContent:"优先展示这个内容",  
31 - newsSummary:"其次展示这个内容",  
32 - newsTitle:"上面两个都没有再展示这个内容",  
33 - newsType:15  
34 - } as ContentDetailDTO 36 + @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
35 //变量 37 //变量
36 scroller: Scroller = new Scroller(); 38 scroller: Scroller = new Scroller();
37 /** 39 /**
38 * 默认未关注 点击去关注 40 * 默认未关注 点击去关注
39 */ 41 */
40 - private followStatus: String = '0'; 42 + @State followStatus: String = '0';
41 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 43 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
42 44
43 //跳转 45 //跳转
@@ -130,7 +132,7 @@ export struct DynamicDetailComponent { @@ -130,7 +132,7 @@ export struct DynamicDetailComponent {
130 .backgroundColor($r('app.color.color_ED2800')) 132 .backgroundColor($r('app.color.color_ED2800'))
131 .fontColor($r('app.color.color_fff')) 133 .fontColor($r('app.color.color_fff'))
132 .onClick(() => { 134 .onClick(() => {
133 - // this.handleAccention(this.item, 1) 135 + this.handleAccention()
134 }) 136 })
135 } else { 137 } else {
136 Text('已关注') 138 Text('已关注')
@@ -143,7 +145,7 @@ export struct DynamicDetailComponent { @@ -143,7 +145,7 @@ export struct DynamicDetailComponent {
143 .borderColor($r('app.color.color_CCCCCC')) 145 .borderColor($r('app.color.color_CCCCCC'))
144 .fontColor($r('app.color.color_CCCCCC')) 146 .fontColor($r('app.color.color_CCCCCC'))
145 .onClick(() => { 147 .onClick(() => {
146 - // this.handleAccention(this.item, 0) 148 + this.handleAccention()
147 }) 149 })
148 } 150 }
149 } 151 }
@@ -224,6 +226,9 @@ export struct DynamicDetailComponent { @@ -224,6 +226,9 @@ export struct DynamicDetailComponent {
224 item.height = callback?.height || 0; 226 item.height = callback?.height || 0;
225 }) 227 })
226 } 228 }
  229 + .onClick((event: ClickEvent) => {
  230 + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList)
  231 + })
227 } 232 }
228 } else if (this.contentDetailData.photoList.length === 4) { 233 } else if (this.contentDetailData.photoList.length === 4) {
229 GridCol({ 234 GridCol({
@@ -233,6 +238,9 @@ export struct DynamicDetailComponent { @@ -233,6 +238,9 @@ export struct DynamicDetailComponent {
233 .aspectRatio(1) 238 .aspectRatio(1)
234 .borderRadius(this.caclImageRadius(index)) 239 .borderRadius(this.caclImageRadius(index))
235 } 240 }
  241 + .onClick((event: ClickEvent) => {
  242 + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList)
  243 + })
236 } else { 244 } else {
237 GridCol({ 245 GridCol({
238 span: { sm: 4, lg: 3 } 246 span: { sm: 4, lg: 3 }
@@ -241,6 +249,9 @@ export struct DynamicDetailComponent { @@ -241,6 +249,9 @@ export struct DynamicDetailComponent {
241 .aspectRatio(1) 249 .aspectRatio(1)
242 .borderRadius(this.caclImageRadius(index)) 250 .borderRadius(this.caclImageRadius(index))
243 } 251 }
  252 + .onClick((event: ClickEvent) => {
  253 + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList)
  254 + })
244 } 255 }
245 }) 256 })
246 } 257 }
@@ -414,7 +425,7 @@ export struct DynamicDetailComponent { @@ -414,7 +425,7 @@ export struct DynamicDetailComponent {
414 console.error(TAG, JSON.stringify(this.contentDetailData)) 425 console.error(TAG, JSON.stringify(this.contentDetailData))
415 let data = await MultiPictureDetailViewModel.getInteractDataStatus(params) 426 let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
416 console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data)) 427 console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data))
417 - this.newsStatusOfUser = data[0]; 428 + // this.newsStatusOfUser = data[0];
418 Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`) 429 Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
419 } catch (exception) { 430 } catch (exception) {
420 console.error(TAG, JSON.stringify(exception)) 431 console.error(TAG, JSON.stringify(exception))
@@ -486,6 +497,33 @@ export struct DynamicDetailComponent { @@ -486,6 +497,33 @@ export struct DynamicDetailComponent {
486 return 3; //普通图 497 return 3; //普通图
487 } 498 }
488 } 499 }
  500 +
  501 + /**
  502 + * 关注号主
  503 + */
  504 + async handleAccention() {
  505 + // 未登录,跳转登录
  506 + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
  507 + if (!user_id) {
  508 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  509 + return
  510 + }
  511 +
  512 + const params2: postInteractAccentionOperateParams = {
  513 + attentionUserType: this.contentDetailData?.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
  514 + attentionUserId: this.contentDetailData?.rmhInfo?.userId || '', // 被关注用户号主id
  515 + attentionCreatorId: this.contentDetailData?.rmhInfo?.rmhId || '', // 被关注用户号主id
  516 + status: this.followStatus == '0'? 1:0,
  517 + }
  518 + ContentDetailRequest.postInteractAccentionOperate(params2).then(res => {
  519 + console.log('关注号主==', JSON.stringify(res.data))
  520 + if (this.followStatus == '1') {
  521 + this.followStatus = '0'
  522 + } else {
  523 + this.followStatus = '1'
  524 + }
  525 + })
  526 + }
489 } 527 }
490 528
491 interface radiusType { 529 interface radiusType {
@@ -12,6 +12,7 @@ import { @@ -12,6 +12,7 @@ import {
12 } from 'wdBean'; 12 } from 'wdBean';
13 import DetailViewModel from '../viewmodel/DetailViewModel'; 13 import DetailViewModel from '../viewmodel/DetailViewModel';
14 import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; 14 import { ImageAndTextWebComponent } from './ImageAndTextWebComponent';
  15 +import { OperRowListView } from './view/OperRowListView';
15 import router from '@ohos.router'; 16 import router from '@ohos.router';
16 import { RecommendList } from '../components/view/RecommendList' 17 import { RecommendList } from '../components/view/RecommendList'
17 import { CommonConstants } from 'wdConstant'; 18 import { CommonConstants } from 'wdConstant';
@@ -91,7 +92,8 @@ export struct ImageAndTextPageComponent { @@ -91,7 +92,8 @@ export struct ImageAndTextPageComponent {
91 } 92 }
92 93
93 //底部交互区 94 //底部交互区
94 - Row() { 95 + OperRowListView({contentDetailData: this.contentDetailData[0]})
  96 + /* Row() {
95 Image($r('app.media.icon_arrow_left')) 97 Image($r('app.media.icon_arrow_left'))
96 .width(24) 98 .width(24)
97 .height(24) 99 .height(24)
@@ -126,7 +128,7 @@ export struct ImageAndTextPageComponent { @@ -126,7 +128,7 @@ export struct ImageAndTextPageComponent {
126 .height(56) 128 .height(56)
127 .padding({ left: 15, right: 15, bottom: 50, top: 20 }) 129 .padding({ left: 15, right: 15, bottom: 50, top: 20 })
128 .justifyContent(FlexAlign.SpaceBetween) 130 .justifyContent(FlexAlign.SpaceBetween)
129 - .backgroundColor(Color.White) 131 + .backgroundColor(Color.White)*/
130 } 132 }
131 133
132 } 134 }
@@ -6,7 +6,8 @@ import { @@ -6,7 +6,8 @@ import {
6 H5ReceiveDetailBean, 6 H5ReceiveDetailBean,
7 ResponseBean 7 ResponseBean
8 } from 'wdBean'; 8 } from 'wdBean';
9 -import { Logger } from 'wdKit'; 9 +import { Logger, SPHelper } from 'wdKit';
  10 +import { SpConstants } from 'wdConstant';
10 import { WdWebLocalComponent } from 'wdWebComponent'; 11 import { WdWebLocalComponent } from 'wdWebComponent';
11 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; 12 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type';
12 import { BridgeWebViewControl } from 'wdJsBridge/Index'; 13 import { BridgeWebViewControl } from 'wdJsBridge/Index';
@@ -22,7 +23,7 @@ export struct ImageAndTextWebComponent { @@ -22,7 +23,7 @@ export struct ImageAndTextWebComponent {
22 private webPrepared = false; 23 private webPrepared = false;
23 private dataPrepared = false; 24 private dataPrepared = false;
24 25
25 - onDetailDataUpdated() { 26 + async onDetailDataUpdated() {
26 if (this.action) { 27 if (this.action) {
27 let contentId: string = '' 28 let contentId: string = ''
28 let contentType: string = '' 29 let contentType: string = ''
@@ -30,6 +31,8 @@ export struct ImageAndTextWebComponent { @@ -30,6 +31,8 @@ export struct ImageAndTextWebComponent {
30 let channelId: string = '' 31 let channelId: string = ''
31 let compId: string = '' 32 let compId: string = ''
32 let sourcePage: string = '5' 33 let sourcePage: string = '5'
  34 + let creatorId = await SPHelper.default.get(SpConstants.USER_CREATOR_ID, '') || ''
  35 + let isLogin = await SPHelper.default.get(SpConstants.USER_STATUS, '') || '0'
33 if (this.action.params) { 36 if (this.action.params) {
34 if (this.action.params.contentID) { 37 if (this.action.params.contentID) {
35 contentId = this.action.params?.contentID 38 contentId = this.action.params?.contentID
@@ -56,8 +59,8 @@ export struct ImageAndTextWebComponent { @@ -56,8 +59,8 @@ export struct ImageAndTextWebComponent {
56 59
57 // TODO 对接user信息、登录情况 60 // TODO 对接user信息、登录情况
58 let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { 61 let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = {
59 - creatorId: '',  
60 - isLogin: '0', 62 + creatorId: creatorId,
  63 + isLogin: isLogin,
61 networkStatus: 1, 64 networkStatus: 1,
62 loadImageOnlyWifiSwitch: '2', 65 loadImageOnlyWifiSwitch: '2',
63 66
  1 +/**
  2 + * 已到底UI,数据bean封装【page接口返回配置信息:文字、文字颜色】
  3 + */
  4 +@Observed
  5 +export class NoMoreBean {
  6 + text: string = '';
  7 + textColor: string = '';
  8 +
  9 + constructor(text: string) {
  10 + this.text = text;
  11 + }
  12 +}
1 import { CommonConstants, ViewType } from 'wdConstant'; 1 import { CommonConstants, ViewType } from 'wdConstant';
2 import { Logger } from 'wdKit'; 2 import { Logger } from 'wdKit';
3 import PageViewModel from '../../viewmodel/PageViewModel'; 3 import PageViewModel from '../../viewmodel/PageViewModel';
4 -import { EmptyComponent } from '../view/EmptyComponent'; 4 +import { EmptyComponent, WDViewDefaultType } from '../view/EmptyComponent';
5 import { ErrorComponent } from '../view/ErrorComponent'; 5 import { ErrorComponent } from '../view/ErrorComponent';
6 import PageModel from '../../viewmodel/PageModel'; 6 import PageModel from '../../viewmodel/PageModel';
7 import { listTouchEvent } from '../../utils/PullDownRefresh'; 7 import { listTouchEvent } from '../../utils/PullDownRefresh';
@@ -16,6 +16,8 @@ import PageHelper from '../../viewmodel/PageHelper'; @@ -16,6 +16,8 @@ import PageHelper from '../../viewmodel/PageHelper';
16 import { channelSkeleton } from '../skeleton/channelSkeleton' 16 import { channelSkeleton } from '../skeleton/channelSkeleton'
17 import { ProcessUtils } from 'wdRouter/Index'; 17 import { ProcessUtils } from 'wdRouter/Index';
18 import PageAdModel from '../../viewmodel/PageAdvModel'; 18 import PageAdModel from '../../viewmodel/PageAdvModel';
  19 +import PageNoMoreLayout from './PageNoMoreLayout';
  20 +import { NoMoreBean } from './NoMoreBean';
19 21
20 const TAG = 'PageComponent'; 22 const TAG = 'PageComponent';
21 23
@@ -31,14 +33,18 @@ export struct PageComponent { @@ -31,14 +33,18 @@ export struct PageComponent {
31 build() { 33 build() {
32 Column() { 34 Column() {
33 if (this.pageModel.viewType == ViewType.LOADING) { 35 if (this.pageModel.viewType == ViewType.LOADING) {
34 - // LoadingComponent()  
35 this.LoadingLayout() 36 this.LoadingLayout()
36 - } else if (this.pageModel.viewType == ViewType.ERROR) {  
37 - ErrorComponent()  
38 - } else if (this.pageModel.viewType == ViewType.EMPTY) {  
39 - EmptyComponent()  
40 - } else { 37 + } else if (this.pageModel.viewType == ViewType.LOADED) {
41 this.ListLayout() 38 this.ListLayout()
  39 + } else if (this.pageModel.viewType == ViewType.EMPTY) {
  40 + //缺省页
  41 + EmptyComponent({
  42 + emptyType: this.pageModel.emptyType,
  43 + emptyButton: true,
  44 + retry: () => {
  45 + this.getData()
  46 + }
  47 + })
42 } 48 }
43 } 49 }
44 .width(CommonConstants.FULL_PARENT) 50 .width(CommonConstants.FULL_PARENT)
@@ -83,7 +89,7 @@ export struct PageComponent { @@ -83,7 +89,7 @@ export struct PageComponent {
83 this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight) 89 this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight)
84 }) 90 })
85 } else if (!this.pageModel.contentNeedScroll) { 91 } else if (!this.pageModel.contentNeedScroll) {
86 - NoMoreLayout() 92 + PageNoMoreLayout({ noMoreBean: new NoMoreBean(this.pageModel.pageInfo.baselineCopywriting) })
87 } 93 }
88 } 94 }
89 } 95 }
  1 +import { RefreshConstants } from '../../utils/RefreshConstants'
  2 +import { NoMoreBean } from './NoMoreBean';
  3 +
  4 +/**
  5 + * The No more data layout component.
  6 + */
  7 +@Component
  8 +export default struct PageNoMoreLayout {
  9 + @ObjectLink noMoreBean: NoMoreBean;
  10 + text: string | Resource = $r('app.string.footer_text')
  11 +
  12 + aboutToAppear(): void {
  13 + if (this.noMoreBean && this.noMoreBean.text.length > 0) {
  14 + this.text = this.noMoreBean.text
  15 + }
  16 + }
  17 +
  18 + build() {
  19 + Row() {
  20 + Text(this.text)
  21 + .margin({ left: RefreshConstants.NoMoreLayoutConstant_NORMAL_PADDING })
  22 + .fontSize(RefreshConstants.NoMoreLayoutConstant_TITLE_FONT)
  23 + .textAlign(TextAlign.Center)
  24 + }
  25 + .width(RefreshConstants.FULL_WIDTH)
  26 + .justifyContent(FlexAlign.Center)
  27 + .height(RefreshConstants.CUSTOM_LAYOUT_HEIGHT)
  28 + }
  29 +}
@@ -12,6 +12,7 @@ import { @@ -12,6 +12,7 @@ import {
12 import router from '@ohos.router'; 12 import router from '@ohos.router';
13 import inputMethod from '@ohos.inputMethod'; 13 import inputMethod from '@ohos.inputMethod';
14 import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'; 14 import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
  15 +import { LikeComponent } from './LikeComponent';
15 import { HttpUrlUtils } from 'wdNetwork/Index'; 16 import { HttpUrlUtils } from 'wdNetwork/Index';
16 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 17 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
17 import { PageRepository } from '../../repository/PageRepository'; 18 import { PageRepository } from '../../repository/PageRepository';
@@ -29,9 +30,11 @@ const TAG = 'OperRowListView'; @@ -29,9 +30,11 @@ const TAG = 'OperRowListView';
29 @Preview 30 @Preview
30 @Component 31 @Component
31 export struct OperRowListView { 32 export struct OperRowListView {
32 - private contentDetailData: ContentDetailDTO = {} as ContentDetailDTO 33 + // private contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
  34 + @Prop contentDetailData: ContentDetailDTO
33 @State interactData: InteractDataDTO = {} as InteractDataDTO 35 @State interactData: InteractDataDTO = {} as InteractDataDTO
34 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 36 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
  37 + @State likeBean: Record<string, string> = {}
35 38
36 @State operationList: OperationItem[] = [ 39 @State operationList: OperationItem[] = [
37 { 40 {
@@ -60,6 +63,20 @@ export struct OperRowListView { @@ -60,6 +63,20 @@ export struct OperRowListView {
60 this.getInteractDataStatus() 63 this.getInteractDataStatus()
61 } 64 }
62 this.queryContentInteractCount() 65 this.queryContentInteractCount()
  66 + // 点赞需要数据
  67 + // this.data['userName'] = '人民日报网友2kD2xW'
  68 + // this.data['contentType'] = '8' //必须
  69 + // this.data['title'] = '开创两校交流先河!克罗地亚教育代表团访问同济大学'
  70 + // this.data['userHeaderUrl'] = ""
  71 + // this.data['channelId'] = "2059" //必须
  72 + // this.data['status'] = "1" //必须
  73 + this.likeBean['contentId'] = this.contentDetailData.newsId + ''
  74 + this.likeBean['userName'] = this.contentDetailData.editorName + ''
  75 + this.likeBean['contentType'] = this.contentDetailData.newsType + ''
  76 + this.likeBean['title'] = this.contentDetailData.newsTitle + ''
  77 + this.likeBean['userHeaderUrl'] = ''
  78 + this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
  79 + this.likeBean['status'] = ''
63 } 80 }
64 81
65 build() { 82 build() {
@@ -83,7 +100,7 @@ export struct OperRowListView { @@ -83,7 +100,7 @@ export struct OperRowListView {
83 .onClick(() => { 100 .onClick(() => {
84 router.back(); 101 router.back();
85 }) 102 })
86 - TextInput({placeholder:'说两句...'}) 103 + TextInput({placeholder:'说两句11...'})
87 .placeholderColor('#999999') 104 .placeholderColor('#999999')
88 .placeholderFont( 105 .placeholderFont(
89 { 106 {
@@ -112,10 +129,9 @@ export struct OperRowListView { @@ -112,10 +129,9 @@ export struct OperRowListView {
112 .width('54.5%') 129 .width('54.5%')
113 } 130 }
114 .width('100%') 131 .width('100%')
115 - .height(56) 132 + .height(126)
116 .backgroundColor(Color.Black) 133 .backgroundColor(Color.Black)
117 } 134 }
118 -  
119 /** 135 /**
120 * 组件项 136 * 组件项
121 * 137 *
@@ -125,7 +141,11 @@ export struct OperRowListView { @@ -125,7 +141,11 @@ export struct OperRowListView {
125 buildOperationItem(item: OperationItem, index: number) { 141 buildOperationItem(item: OperationItem, index: number) {
126 Column() { 142 Column() {
127 if (item.text === '点赞') { 143 if (item.text === '点赞') {
128 - RelativeContainer() { 144 + LikeComponent({
  145 + data: this.likeBean
  146 + })
  147 +
  148 + /* RelativeContainer() {
129 Row() { 149 Row() {
130 Image(this.newsStatusOfUser?.likeStatus == '1' ? item.icon_check : item.icon) 150 Image(this.newsStatusOfUser?.likeStatus == '1' ? item.icon_check : item.icon)
131 .width(24) 151 .width(24)
@@ -134,6 +154,7 @@ export struct OperRowListView { @@ -134,6 +154,7 @@ export struct OperRowListView {
134 .interpolation(ImageInterpolation.High) 154 .interpolation(ImageInterpolation.High)
135 .onClick(() => { 155 .onClick(() => {
136 this.toggleLikeStatus() 156 this.toggleLikeStatus()
  157 + console.log('点赞_111', JSON.stringify(this.contentDetailData))
137 }) 158 })
138 } 159 }
139 .alignRules({ 160 .alignRules({
@@ -168,7 +189,7 @@ export struct OperRowListView { @@ -168,7 +189,7 @@ export struct OperRowListView {
168 .id(`e_row3_${index}`) 189 .id(`e_row3_${index}`)
169 } 190 }
170 } 191 }
171 - .id(`e_icon_${index}`) 192 + .id(`e_icon_${index}`)*/
172 } else if (item.text === '收藏') { 193 } else if (item.text === '收藏') {
173 RelativeContainer() { 194 RelativeContainer() {
174 Row() { 195 Row() {
1 import { PageDTO, CompDTO, PageInfoDTO, ContentDTO } from 'wdBean'; 1 import { PageDTO, CompDTO, PageInfoDTO, ContentDTO } from 'wdBean';
2 import { CompStyle, ViewType } from 'wdConstant/Index'; 2 import { CompStyle, ViewType } from 'wdConstant/Index';
3 -import { CollectionUtils, DateTimeUtils, Logger } from 'wdKit'; 3 +import { CollectionUtils, DateTimeUtils, Logger, NetworkUtil } from 'wdKit';
4 import { closeRefresh } from '../utils/PullDownRefresh'; 4 import { closeRefresh } from '../utils/PullDownRefresh';
5 import PageModel from './PageModel'; 5 import PageModel from './PageModel';
6 import PageViewModel from './PageViewModel'; 6 import PageViewModel from './PageViewModel';
7 import { promptAction } from '@kit.ArkUI'; 7 import { promptAction } from '@kit.ArkUI';
8 import { AdvRuleBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean'; 8 import { AdvRuleBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean';
9 import PageAdModel from './PageAdvModel'; 9 import PageAdModel from './PageAdvModel';
  10 +import { WDViewDefaultType } from '../components/view/EmptyComponent';
10 11
11 const TAG = 'PageHelper'; 12 const TAG = 'PageHelper';
12 13
@@ -14,14 +15,12 @@ const TAG = 'PageHelper'; @@ -14,14 +15,12 @@ const TAG = 'PageHelper';
14 * 处理返回后的数据 15 * 处理返回后的数据
15 */ 16 */
16 export class PageHelper { 17 export class PageHelper {
17 -  
18 -  
19 /** 18 /**
20 * 刷新数据 19 * 刷新数据
21 */ 20 */
22 - async refreshUI(pageModel: PageModel,pageAdvModel:PageAdModel) { 21 + async refreshUI(pageModel: PageModel, pageAdvModel: PageAdModel) {
23 pageModel.loadStrategy = 2 22 pageModel.loadStrategy = 2
24 - this.getPageInfo(pageModel,pageAdvModel) 23 + this.getPageInfo(pageModel, pageAdvModel)
25 } 24 }
26 25
27 /** 26 /**
@@ -36,28 +35,36 @@ export class PageHelper { @@ -36,28 +35,36 @@ export class PageHelper {
36 /** 35 /**
37 * 进页面请求数据 36 * 进页面请求数据
38 */ 37 */
39 - async getInitData(pageModel: PageModel,pageAdvModel:PageAdModel) { 38 + async getInitData(pageModel: PageModel, pageAdvModel: PageAdModel) {
40 pageModel.loadStrategy = 1 39 pageModel.loadStrategy = 1
41 - this.getPageInfo(pageModel,pageAdvModel) 40 + let netStatus = NetworkUtil.isNetConnected()
  41 + if (netStatus) {
  42 + this.getPageInfo(pageModel, pageAdvModel)
  43 + } else {
  44 + pageModel.viewType = ViewType.EMPTY;
  45 + pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork;
  46 + }
42 } 47 }
43 48
44 - async getPageInfo(pageModel: PageModel,pageAdvModel:PageAdModel) { 49 + getPageInfo(pageModel: PageModel, pageAdvModel: PageAdModel) {
45 pageModel.currentPage = 1; 50 pageModel.currentPage = 1;
46 - let pageInfo = await PageViewModel.getPageInfo(pageModel.pageId);  
47 - if (pageInfo == null) { 51 + PageViewModel.getPageInfo(pageModel.pageId).then(pageInfo => {
  52 + if (pageInfo == null) {
  53 + pageModel.viewType = ViewType.EMPTY;
  54 + pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoListContent;
  55 + return;
  56 + }
  57 + pageModel.pageInfo = pageInfo;
  58 + //解析广告资源
  59 + pageAdvModel.analysisAdvSource(pageInfo);
  60 + this.parseGroup(pageModel)
  61 + }).catch(() => {
48 pageModel.viewType = ViewType.EMPTY; 62 pageModel.viewType = ViewType.EMPTY;
49 - return;  
50 - }  
51 - pageModel.pageInfo = pageInfo;  
52 - //解析广告资源  
53 - pageAdvModel.analysisAdvSource(pageInfo)  
54 -  
55 - this.parseGroup(pageModel)  
56 - 63 + pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_ContentFailed;
  64 + })
57 } 65 }
58 66
59 67
60 -  
61 async parseGroup(pageModel: PageModel) { 68 async parseGroup(pageModel: PageModel) {
62 let pageInfo: PageInfoDTO = pageModel.pageInfo 69 let pageInfo: PageInfoDTO = pageModel.pageInfo
63 pageModel.groupList = [] 70 pageModel.groupList = []
@@ -84,6 +91,8 @@ export class PageHelper { @@ -84,6 +91,8 @@ export class PageHelper {
84 // 没数据,展示空页面 91 // 没数据,展示空页面
85 Logger.debug(TAG, 'aboutToAppear, data response page ' + pageModel.pageId + ', comp list is empty.'); 92 Logger.debug(TAG, 'aboutToAppear, data response page ' + pageModel.pageId + ', comp list is empty.');
86 pageModel.viewType = ViewType.EMPTY; 93 pageModel.viewType = ViewType.EMPTY;
  94 + pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoListContent;
  95 +
87 } 96 }
88 } 97 }
89 98
@@ -5,6 +5,7 @@ import { RefreshConstants as Const } from '../utils/RefreshConstants'; @@ -5,6 +5,7 @@ import { RefreshConstants as Const } from '../utils/RefreshConstants';
5 import { PageUIReqBean } from '../components/page/bean/PageUIReqBean'; 5 import { PageUIReqBean } from '../components/page/bean/PageUIReqBean';
6 import { GroupInfoDTO, PageInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO'; 6 import { GroupInfoDTO, PageInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO';
7 import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean'; 7 import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean';
  8 +import { WDViewDefaultType } from '../components/view/EmptyComponent';
8 9
9 /** 10 /**
10 * 页面下拉刷新、上拉加载数据bean。 11 * 页面下拉刷新、上拉加载数据bean。
@@ -38,6 +39,7 @@ export default class PageModel { @@ -38,6 +39,7 @@ export default class PageModel {
38 isVisiblePullUpLoad: boolean = false; 39 isVisiblePullUpLoad: boolean = false;
39 offsetY: number = 0; 40 offsetY: number = 0;
40 viewType: number = ViewType.LOADING; 41 viewType: number = ViewType.LOADING;
  42 + emptyType: WDViewDefaultType = WDViewDefaultType.WDViewDefaultType_Default
41 hasMore: boolean = true; 43 hasMore: boolean = true;
42 startIndex = 0; 44 startIndex = 0;
43 endIndex = 0; 45 endIndex = 0;
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 }, 6 },
7 { 7 {
8 "name": "footer_text", 8 "name": "footer_text",
9 - "value": "已经到底了" 9 + "value": "已显示全部内容"
10 }, 10 },
11 { 11 {
12 "name": "pull_up_load_text", 12 "name": "pull_up_load_text",
@@ -23,12 +23,12 @@ export struct DetailPlayShortVideoPage { @@ -23,12 +23,12 @@ export struct DetailPlayShortVideoPage {
23 @Prop index: number = 0 23 @Prop index: number = 0
24 @Prop @Watch('currentIndexChange') currentIndex: number = 0 24 @Prop @Watch('currentIndexChange') currentIndex: number = 0
25 @State playerController: WDPlayerController = new WDPlayerController(); 25 @State playerController: WDPlayerController = new WDPlayerController();
26 - @Provide contentDetailData: ContentDetailDTO | undefined = undefined  
27 - @Provide interactData: InteractDataDTO | undefined = undefined 26 + @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
  27 + @Provide interactData: InteractDataDTO = {} as InteractDataDTO
28 @Provide isFullScreen: boolean = false; 28 @Provide isFullScreen: boolean = false;
29 @Provide progressVal: number = 0; 29 @Provide progressVal: number = 0;
30 @Provide videoLandScape?: number = 1; // 视频朝向, 横屏视频:1;竖屏视频:2 30 @Provide videoLandScape?: number = 1; // 视频朝向, 横屏视频:1;竖屏视频:2
31 - @Provide newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 31 + @Provide newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult // 点赞、收藏状态
32 @Provide followStatus: string = '0' // 关注状态 32 @Provide followStatus: string = '0' // 关注状态
33 @Provide isOpenDetail: boolean = false // 查看详情按钮点击 33 @Provide isOpenDetail: boolean = false // 查看详情按钮点击
34 @Provide isDragging: boolean = false // 拖动时间进度条 34 @Provide isDragging: boolean = false // 拖动时间进度条
@@ -24,10 +24,8 @@ export struct DetailVideoListPage { @@ -24,10 +24,8 @@ export struct DetailVideoListPage {
24 @Provide pageHide: number = -1 24 @Provide pageHide: number = -1
25 @Provide switchVideoStatus: boolean = false 25 @Provide switchVideoStatus: boolean = false
26 @State data: ContentDetailDTO[] = [] 26 @State data: ContentDetailDTO[] = []
27 - @State testData: string[] = ['111', '222', '333']  
28 @State currentIndex: number = 0 27 @State currentIndex: number = 0
29 @State interactDataList: InteractDataDTO[] = [] 28 @State interactDataList: InteractDataDTO[] = []
30 - @State isFullScreen: boolean = false  
31 29
32 async aboutToAppear(): Promise<void> { 30 async aboutToAppear(): Promise<void> {
33 this.openFullScreen() 31 this.openFullScreen()
@@ -41,10 +39,7 @@ export struct DetailVideoListPage { @@ -41,10 +39,7 @@ export struct DetailVideoListPage {
41 } 39 }
42 await this.getContentDetail(this.contentId, this.relId, this.relType) 40 await this.getContentDetail(this.contentId, this.relId, this.relType)
43 } 41 }
44 -  
45 await this.queryVideoList() 42 await this.queryVideoList()
46 - this.getContentInteract()  
47 -  
48 console.log(TAG, 'aboutToAppear', JSON.stringify(action.params)) 43 console.log(TAG, 'aboutToAppear', JSON.stringify(action.params))
49 } 44 }
50 45
@@ -93,9 +88,22 @@ export struct DetailVideoListPage { @@ -93,9 +88,22 @@ export struct DetailVideoListPage {
93 contentId: contentId, 88 contentId: contentId,
94 relId: relId, 89 relId: relId,
95 relType: relType 90 relType: relType
96 - }).then((resDTO: ResponseDTO<ContentDetailDTO[]>) => {  
97 - console.error('getContentDetail==', JSON.stringify(resDTO.data)) 91 + }).then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => {
  92 + console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data))
98 if (resDTO.data) { 93 if (resDTO.data) {
  94 + const params: contentListParams = {
  95 + contentList: [{
  96 + contentId: resDTO.data[0].newsId + '',
  97 + contentType: resDTO.data[0].newsType
  98 + }]
  99 + }
  100 + // 批量查询内容当前用户点赞、收藏状态
  101 + await ContentDetailRequest.getContentInteract(params).then(res => {
  102 + if (res.data) {
  103 + this.interactDataList = this.interactDataList.concat(res.data)
  104 + }
  105 + console.log('获取互动点赞等数据===', JSON.stringify(res))
  106 + })
99 this.data.push(resDTO.data[0]) 107 this.data.push(resDTO.data[0])
100 } 108 }
101 }) 109 })
@@ -108,8 +116,9 @@ export struct DetailVideoListPage { @@ -108,8 +116,9 @@ export struct DetailVideoListPage {
108 await ContentDetailRequest.postRecommendVideoList({ 116 await ContentDetailRequest.postRecommendVideoList({
109 pageSize: 5, 117 pageSize: 5,
110 refreshCnt: 1 118 refreshCnt: 1
111 - }).then(res => { 119 + }).then(async res => {
112 if (res.data) { 120 if (res.data) {
  121 + await this.getContentInteract(res.data)
113 this.data = this.data.concat(res.data) 122 this.data = this.data.concat(res.data)
114 console.log('视频列表===', JSON.stringify(res.data)) 123 console.log('视频列表===', JSON.stringify(res.data))
115 } 124 }
@@ -119,21 +128,21 @@ export struct DetailVideoListPage { @@ -119,21 +128,21 @@ export struct DetailVideoListPage {
119 /** 128 /**
120 * 批量查询内容当前用户点赞、收藏状态 129 * 批量查询内容当前用户点赞、收藏状态
121 */ 130 */
122 - getContentInteract() {  
123 - if (this.data.length > 0) { 131 + async getContentInteract(data: ContentDetailDTO[]) {
  132 + if (data.length > 0) {
124 const params: contentListParams = { 133 const params: contentListParams = {
125 contentList: [] 134 contentList: []
126 } 135 }
127 - this.data.map(item => { 136 + data.map(item => {
128 params.contentList.push({ 137 params.contentList.push({
129 contentId: item.newsId + '', 138 contentId: item.newsId + '',
130 contentType: item.newsType 139 contentType: item.newsType
131 }) 140 })
132 }) 141 })
133 // 批量查询内容当前用户点赞、收藏状态 142 // 批量查询内容当前用户点赞、收藏状态
134 - ContentDetailRequest.getContentInteract(params).then(res => { 143 + await ContentDetailRequest.getContentInteract(params).then(res => {
135 if (res.data) { 144 if (res.data) {
136 - this.interactDataList = res.data || [] 145 + this.interactDataList = this.interactDataList.concat(res.data)
137 } 146 }
138 console.log('获取互动点赞等数据===', JSON.stringify(res)) 147 console.log('获取互动点赞等数据===', JSON.stringify(res))
139 }) 148 })
@@ -145,7 +145,7 @@ export struct VideoChannelDetail { @@ -145,7 +145,7 @@ export struct VideoChannelDetail {
145 refreshTime: this.refreshTime, 145 refreshTime: this.refreshTime,
146 } 146 }
147 147
148 - await ContentDetailRequest.getRecCompInfo(params).then(res => { 148 + await ContentDetailRequest.getRecCompInfo(params).then(async res => {
149 this.isRequestError = false 149 this.isRequestError = false
150 console.log('根据视频频道传参查询视频楼层信息totalCount', res.data?.totalCount + '') 150 console.log('根据视频频道传参查询视频楼层信息totalCount', res.data?.totalCount + '')
151 151
@@ -174,8 +174,8 @@ export struct VideoChannelDetail { @@ -174,8 +174,8 @@ export struct VideoChannelDetail {
174 }) 174 })
175 } 175 }
176 176
177 - this.batchContentDetail(list1)  
178 - this.getContentInteract(list2) 177 + await this.batchContentDetail(list1, list2)
  178 +
179 setTimeout(() => { 179 setTimeout(() => {
180 this.isMouted = true 180 this.isMouted = true
181 }, 500) 181 }, 500)
@@ -189,11 +189,14 @@ export struct VideoChannelDetail { @@ -189,11 +189,14 @@ export struct VideoChannelDetail {
189 /** 189 /**
190 * 根据视频楼层信息批量查询视频列表 190 * 根据视频楼层信息批量查询视频列表
191 */ 191 */
192 - async batchContentDetail(list: batchContentDetailParams) { 192 + async batchContentDetail(list: batchContentDetailParams, list2: contentListParams) {
193 if (list.contents.length > 0) { 193 if (list.contents.length > 0) {
194 - await ContentDetailRequest.batchContentDetail(list).then(res => { 194 + await ContentDetailRequest.batchContentDetail(list).then(async res => {
  195 + if (res.data) {
  196 + await this.getContentInteract(list2)
  197 + this.data = this.data.concat(res.data)
  198 + }
195 console.log('根据视频楼层信息批量查询视频列表', res.data) 199 console.log('根据视频楼层信息批量查询视频列表', res.data)
196 - this.data = this.data.concat(res.data as [])  
197 }) 200 })
198 } 201 }
199 } 202 }
@@ -204,7 +207,9 @@ export struct VideoChannelDetail { @@ -204,7 +207,9 @@ export struct VideoChannelDetail {
204 async getContentInteract(list: contentListParams) { 207 async getContentInteract(list: contentListParams) {
205 if (list.contentList.length > 0) { 208 if (list.contentList.length > 0) {
206 await ContentDetailRequest.getContentInteract(list).then(res => { 209 await ContentDetailRequest.getContentInteract(list).then(res => {
207 - this.interactDataList = res.data || [] 210 + if (res.data) {
  211 + this.interactDataList = this.interactDataList.concat(res.data)
  212 + }
208 console.log('根据视频信息批量查询点赞、收藏状态', res.data) 213 console.log('根据视频信息批量查询点赞、收藏状态', res.data)
209 }) 214 })
210 } 215 }
1 -import { ContentDetailDTO, InteractDataDTO, Params, RmhInfoDTO, UserInfoDTO } from 'wdBean/Index'; 1 +import { ContentDetailDTO, InteractDataDTO, Params, } from 'wdBean/Index';
2 import { 2 import {
3 - batchLikeAndCollectParams,  
4 batchLikeAndCollectResult, 3 batchLikeAndCollectResult,
5 ContentDetailRequest, 4 ContentDetailRequest,
6 contentListParams, 5 contentListParams,
@@ -8,23 +7,15 @@ import { @@ -8,23 +7,15 @@ import {
8 postExecuteLikeParams, 7 postExecuteLikeParams,
9 postInteractAccentionOperateParams 8 postInteractAccentionOperateParams
10 } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; 9 } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
11 -import { SPHelper, ToastUtils } from 'wdKit';  
12 -import { HttpUrlUtils } from 'wdNetwork/Index'; 10 +import { SPHelper, ToastUtils, NumberFormatterUtils } from 'wdKit';
13 import { WDPlayerController } from 'wdPlayer/Index'; 11 import { WDPlayerController } from 'wdPlayer/Index';
14 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 12 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
15 import { SpConstants } from 'wdConstant/Index' 13 import { SpConstants } from 'wdConstant/Index'
16 14
17 -export interface OperationItem {  
18 - icon: Resource;  
19 - icon_check?: Resource;  
20 -  
21 - // icon_selected: Resource;  
22 - text: string | Resource;  
23 - num?: number; // 个数  
24 -}  
25 15
26 const TAG = 'PlayerRightView'; 16 const TAG = 'PlayerRightView';
27 17
  18 +//视频点播页右侧操作栏:点赞/收藏/评论/分享 竖着排列
28 @Component 19 @Component
29 export struct PlayerRightView { 20 export struct PlayerRightView {
30 private playerController?: WDPlayerController; 21 private playerController?: WDPlayerController;
@@ -34,31 +25,10 @@ export struct PlayerRightView { @@ -34,31 +25,10 @@ export struct PlayerRightView {
34 @Consume followStatus: string 25 @Consume followStatus: string
35 @Consume isOpenDetail: boolean 26 @Consume isOpenDetail: boolean
36 @Consume isDragging: boolean 27 @Consume isDragging: boolean
37 - @State operationList: OperationItem[] = [  
38 - {  
39 - icon: $r('app.media.ic_like_uncheck'),  
40 - icon_check: $r('app.media.ic_like_check'),  
41 - text: "赞",  
42 - // num: 6622  
43 - },  
44 - {  
45 - icon: $r('app.media.ic_collect_uncheck'),  
46 - icon_check: $r('app.media.ic_collect_check'),  
47 - text: "收藏",  
48 - // num: 662,  
49 - },  
50 - {  
51 - icon: $r('app.media.ic_comment'),  
52 - text: "抢首评",  
53 - // num: 500,  
54 - },  
55 - {  
56 - icon: $r('app.media.ic_share'),  
57 - text: "分享"  
58 - }  
59 - ] 28 + @State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
60 29
61 aboutToAppear() { 30 aboutToAppear() {
  31 +
62 } 32 }
63 33
64 /** 34 /**
@@ -82,11 +52,11 @@ export struct PlayerRightView { @@ -82,11 +52,11 @@ export struct PlayerRightView {
82 if (this.newsStatusOfUser) { 52 if (this.newsStatusOfUser) {
83 this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1' 53 this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'
84 if (this.newsStatusOfUser.likeStatus === '1') { 54 if (this.newsStatusOfUser.likeStatus === '1') {
85 - this.interactData.likeNum = Number(this.interactData.likeNum) + 1 55 + this.interactData.likeNum = Number(this.interactData.likeNum || 0) + 1
86 } else { 56 } else {
87 - this.interactData.likeNum = Number(this.interactData.likeNum) - 1 57 + this.interactData.likeNum = Number(this.interactData.likeNum || 0) - 1
88 } 58 }
89 - console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactData?.likeNum) 59 + console.log(TAG, '点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactData?.likeNum)
90 // this.queryContentInteractCount() 60 // this.queryContentInteractCount()
91 } 61 }
92 62
@@ -116,11 +86,11 @@ export struct PlayerRightView { @@ -116,11 +86,11 @@ export struct PlayerRightView {
116 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 86 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
117 // this.queryContentInteractCount() 87 // this.queryContentInteractCount()
118 if (this.newsStatusOfUser.collectStatus === 1) { 88 if (this.newsStatusOfUser.collectStatus === 1) {
119 - this.interactData.collectNum = Number(this.interactData.collectNum) + 1 89 + this.interactData.collectNum = Number(this.interactData.collectNum || 0) + 1
120 } else { 90 } else {
121 - this.interactData.collectNum = Number(this.interactData.collectNum) - 1 91 + this.interactData.collectNum = Number(this.interactData.collectNum || 0) - 1
122 } 92 }
123 - console.log('收藏、取消收藏==', this.newsStatusOfUser?.collectStatus, this.interactData?.collectNum) 93 + console.log(TAG, '收藏、取消收藏==', this.newsStatusOfUser?.collectStatus, this.interactData?.collectNum)
124 } 94 }
125 }) 95 })
126 96
@@ -138,15 +108,15 @@ export struct PlayerRightView { @@ -138,15 +108,15 @@ export struct PlayerRightView {
138 } 108 }
139 ContentDetailRequest.getContentInteract(params).then(res => { 109 ContentDetailRequest.getContentInteract(params).then(res => {
140 if (res.data && this.interactData) { 110 if (res.data && this.interactData) {
141 - this.interactData.likeNum = res.data[0]?.likeNum  
142 - this.interactData.collectNum = res.data[0]?.collectNum  
143 - this.interactData.commentNum = res.data[0]?.commentNum 111 + this.interactData.likeNum = res.data[0]?.likeNum || 0
  112 + this.interactData.collectNum = res.data[0]?.collectNum || 0
  113 + this.interactData.commentNum = res.data[0]?.commentNum || 0
144 } 114 }
145 console.log('获取互动点赞等数据===', JSON.stringify(res)) 115 console.log('获取互动点赞等数据===', JSON.stringify(res))
146 }) 116 })
147 } 117 }
148 118
149 - getImgUrl() { 119 + getHeadUrl() {
150 return this.contentDetailData?.rmhInfo?.rmhHeadUrl || this.contentDetailData?.userInfo?.userHeadUrl 120 return this.contentDetailData?.rmhInfo?.rmhHeadUrl || this.contentDetailData?.userInfo?.userHeadUrl
151 } 121 }
152 122
@@ -170,7 +140,7 @@ export struct PlayerRightView { @@ -170,7 +140,7 @@ export struct PlayerRightView {
170 status: 1, 140 status: 1,
171 } 141 }
172 ContentDetailRequest.postInteractAccentionOperate(params2).then(res => { 142 ContentDetailRequest.postInteractAccentionOperate(params2).then(res => {
173 - console.log('关注号主==', JSON.stringify(res.data)) 143 + console.log(TAG, '关注号主==', JSON.stringify(res.data))
174 if (this.followStatus == '1') { 144 if (this.followStatus == '1') {
175 this.followStatus = '0' 145 this.followStatus = '0'
176 } else { 146 } else {
@@ -179,137 +149,184 @@ export struct PlayerRightView { @@ -179,137 +149,184 @@ export struct PlayerRightView {
179 }) 149 })
180 } 150 }
181 151
182 - @Builder  
183 - buildUserComp() { 152 + build() {
184 Column() { 153 Column() {
185 - if (this.getImgUrl()) {  
186 - RelativeContainer() {  
187 - Image(this.getImgUrl())  
188 - .width('100%')  
189 - .borderRadius(24)  
190 - .aspectRatio(1)  
191 - .border({ width: 1, color: Color.White, style: BorderStyle.Solid })  
192 - .alignRules({  
193 - top: { anchor: "__container__", align: VerticalAlign.Top },  
194 - left: { anchor: "__container__", align: HorizontalAlign.Start }  
195 - })  
196 - .id("row1")  
197 - .onClick(() => {  
198 - if (this.contentDetailData.rmhInfo?.cnMainControl === 1) {  
199 - // 号主页  
200 - const params: Params = {  
201 - creatorId: this.contentDetailData.rmhInfo.rmhId,  
202 - pageID: ''  
203 - }  
204 - WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)  
205 - }  
206 154
207 - })  
208 - if (this.followStatus == '0') {  
209 - Image($r('app.media.ic_add'))  
210 - .width(24)  
211 - .borderRadius(12)  
212 - .alignRules({  
213 - left: { anchor: "__container__", align: HorizontalAlign.Center },  
214 - bottom: { anchor: "__container__", align: VerticalAlign.Bottom },  
215 - })  
216 - .margin({ left: -12 })  
217 - .id("row2")  
218 - .onClick(() => {  
219 - // 关注  
220 - this.handleAccention()  
221 - }) 155 + this.userBuilderView()
  156 + this.likeBuilderView()
  157 + this.collectBuilderView()
  158 + this.commentBuilderView()
  159 + this.shareBuilderView()
  160 +
  161 + }
  162 + // .backgroundColor(Color.Blue)
  163 + // .height('100%')
  164 + .width(58)
  165 + .position({ x: '100%', y: '100%' })
  166 + .markAnchor({ x: '100%', y: '100%' })
  167 + .padding({ bottom: 72, right: 10 })
  168 + .visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible)
  169 +
  170 + }
  171 +
  172 + /**
  173 + * 用户关注、号主页
  174 + */
  175 + @Builder
  176 + userBuilderView() {
  177 + Stack() {
  178 + Image(this.getHeadUrl())
  179 + .width('100%')
  180 + .borderRadius(24)
  181 + .aspectRatio(1)
  182 + .border({ width: 1, color: Color.White, style: BorderStyle.Solid })
  183 + .onClick(() => {
  184 + // 跳转到号主页
  185 + if (this.contentDetailData.rmhInfo?.cnMainControl === 1) {
  186 + const params: Params = {
  187 + creatorId: this.contentDetailData.rmhInfo.rmhId,
  188 + pageID: ''
  189 + }
  190 + WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
222 } 191 }
  192 + })
223 193
224 - }.height(60)  
225 - }  
226 - }.margin({ bottom: 18 }) 194 + Image($r('app.media.ic_add'))
  195 + .width(24)
  196 + .borderRadius(12)
  197 + .position({ x: '50%', y: '100%' })
  198 + .markAnchor({ x: '50%', y: '50%' })
  199 + .onClick(() => {
  200 + // TODO:关注动画
  201 + this.handleAccention()
  202 + })
  203 + }
  204 + .height(48)
  205 + .width('100%')
  206 + .margin({ bottom: 30 })
  207 + .visibility(this.getHeadUrl() ? Visibility.Visible : Visibility.None)
  208 + }
  209 +
  210 + /**
  211 + * 将点赞样式转换为icon
  212 + */
  213 + transLikeStyle2Icon(): Resource {
  214 + if (this.likesStyle === 1) {
  215 + return this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_like_check`) : $r(`app.media.ic_like_uncheck`)
  216 + } else if (this.likesStyle === 2) {
  217 + return this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_thub_check`) : $r(`app.media.ic_thub_uncheck`)
  218 + } else if (this.likesStyle === 3) {
  219 + return this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_candle_check`) : $r(`app.media.ic_candle_uncheck`)
  220 + }
  221 + return $r(`app.media.icon_like_ckeck`)
  222 + }
  223 +
  224 + transNum2String(name: 'likeNum' | 'collectNum' | 'commentNum') {
  225 + console.log(TAG, 'transNum2String', this.interactData.likeNum, this.interactData.collectNum, this.interactData.commentNum)
  226 + if (name === 'likeNum') {
  227 + return this.interactData.likeNum != 0 ? NumberFormatterUtils.formatNumberWithWan(this.interactData.likeNum || '') : ''
  228 + } else if (name === 'collectNum') {
  229 + return this.interactData.collectNum != 0 ? NumberFormatterUtils.formatNumberWithWan(this.interactData.collectNum || '') : ''
  230 + } else {
  231 + return this.interactData.commentNum != 0 ? NumberFormatterUtils.formatNumberWithWan(this.interactData.commentNum || '') : ''
  232 + }
227 } 233 }
228 234
  235 + /**
  236 + * 点赞、默哀、祈福
  237 + */
229 @Builder 238 @Builder
230 - buildOperationItem(item: OperationItem, index: number) { 239 + likeBuilderView() {
231 Column() { 240 Column() {
232 - if (item.text === '赞') {  
233 - Image(this.newsStatusOfUser?.likeStatus == '1' ? item.icon_check : item.icon)  
234 - .width(32)  
235 - .aspectRatio(1)  
236 - .onClick(() => {  
237 - this.toggleLikeStatus()  
238 - })  
239 - Text(this.interactData?.likeNum ? (this.interactData.likeNum + '') : item.text)  
240 - .width('100%')// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown)  
241 - .fontWeight(500)  
242 - .textAlign(TextAlign.Center)  
243 - .fontSize(13)  
244 - .fontColor('#FFFFFF')  
245 - .maxLines(1)  
246 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
247 - } else if (item.text === '收藏') {  
248 - Image(this.newsStatusOfUser?.collectStatus == 1 ? item.icon_check : item.icon)  
249 - .width(32)  
250 - .aspectRatio(1)  
251 - .onClick(() => {  
252 - this.toggleCollectStatus()  
253 - })  
254 - Text(this.interactData?.collectNum ? (this.interactData.collectNum + '') : item.text)  
255 - .width('100%')// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown)  
256 - .fontWeight(500)  
257 - .textAlign(TextAlign.Center)  
258 - .fontSize(13)  
259 - .fontColor('#FFFFFF')  
260 - .maxLines(1)  
261 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
262 - } else if (item.text === '抢首评') {  
263 - Image(item.icon)  
264 - .width(32)  
265 - .aspectRatio(1)  
266 - .onClick((event: ClickEvent) => {  
267 - ToastUtils.showToast('评论为公共方法,待开发', 1000);  
268 - })  
269 - Text(this.interactData?.commentNum ? (this.interactData.commentNum + '') : item.text)  
270 - .width('100%')// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown)  
271 - .fontWeight(500)  
272 - .textAlign(TextAlign.Center)  
273 - .fontSize(13)  
274 - .fontColor('#FFFFFF')  
275 - .maxLines(1)  
276 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
277 - } else {  
278 - Image(item.icon)  
279 - .width(32)  
280 - .aspectRatio(1)  
281 - .onClick((event: ClickEvent) => {  
282 - ToastUtils.showToast('分享为公共方法,待开发', 1000);  
283 - })  
284 - Text(item.text)  
285 - .width('100%')// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown)  
286 - .fontWeight(500)  
287 - .textAlign(TextAlign.Center)  
288 - .fontSize(13)  
289 - .fontColor('#FFFFFF')  
290 - .maxLines(1)  
291 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
292 - } 241 + Image(this.transLikeStyle2Icon())
  242 + .width(32)
  243 + .aspectRatio(1)
  244 + .onClick(() => {
  245 + // TODO:点赞动画
  246 + this.toggleLikeStatus()
  247 + })
  248 + Text(this.transNum2String('likeNum') || '赞')
  249 + .width('100%')
  250 + .fontWeight(500)
  251 + .textAlign(TextAlign.Center)
  252 + .fontSize(13)
  253 + .fontColor('#FFFFFF')
  254 + .maxLines(1)
  255 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  256 + }
  257 + .margin({ bottom: 20 })
  258 + .visibility(this.likesStyle !== 4 ? Visibility.Visible : Visibility.None)
  259 + }
293 260
  261 + /**
  262 + * 收藏、取消收藏、收藏文件夹
  263 + */
  264 + @Builder
  265 + collectBuilderView() {
  266 + Column() {
  267 + Image(this.newsStatusOfUser.collectStatus == 1 ? $r(`app.media.ic_collect_check`) : $r(`app.media.ic_collect_uncheck`))
  268 + .width(32)
  269 + .aspectRatio(1)
  270 + .onClick(() => {
  271 + this.toggleCollectStatus()
  272 + })
  273 + Text(this.transNum2String('collectNum') || '收藏')
  274 + .width('100%')
  275 + .fontWeight(500)
  276 + .textAlign(TextAlign.Center)
  277 + .fontSize(13)
  278 + .fontColor('#FFFFFF')
  279 + .maxLines(1)
  280 + .textOverflow({ overflow: TextOverflow.Ellipsis })
294 } 281 }
295 - // .width(48)  
296 .margin({ bottom: 20 }) 282 .margin({ bottom: 20 })
297 - .alignItems(HorizontalAlign.Center)  
298 - .hoverEffect(HoverEffect.Scale) 283 + }
299 284
  285 + /**
  286 + * 评论
  287 + */
  288 + @Builder
  289 + commentBuilderView() {
  290 + Column() {
  291 + Image($r(`app.media.ic_comment`))
  292 + .width(32)
  293 + .aspectRatio(1)
  294 + .onClick((event: ClickEvent) => {
  295 + ToastUtils.showToast('评论为公共方法,待开发', 1000);
  296 + })
  297 + Text(this.transNum2String('commentNum') || '抢首评')
  298 + .width('100%')
  299 + .fontWeight(500)
  300 + .textAlign(TextAlign.Center)
  301 + .fontSize(13)
  302 + .fontColor('#FFFFFF')
  303 + .maxLines(1)
  304 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  305 + }
  306 + .margin({ bottom: 20 })
300 } 307 }
301 308
302 - build() { 309 + /**
  310 + * 分享
  311 + */
  312 + @Builder
  313 + shareBuilderView() {
303 Column() { 314 Column() {
304 - this.buildUserComp()  
305 - ForEach(this.operationList, (item: OperationItem, index: number) => {  
306 - this.buildOperationItem(item, index)  
307 - }, (item: OperationItem, index: number) => JSON.stringify(item)) 315 + Image($r(`app.media.ic_share`))
  316 + .width(32)
  317 + .aspectRatio(1)
  318 + .onClick((event: ClickEvent) => {
  319 + ToastUtils.showToast('分享为公共方法,待开发', 1000);
  320 + })
  321 + Text('分享')
  322 + .width('100%')
  323 + .fontWeight(500)
  324 + .textAlign(TextAlign.Center)
  325 + .fontSize(13)
  326 + .fontColor('#FFFFFF')
  327 + .maxLines(1)
  328 + .textOverflow({ overflow: TextOverflow.Ellipsis })
308 } 329 }
309 - .width(48)  
310 - .position({ x: '100%', y: '100%' })  
311 - .markAnchor({ x: '100%', y: '100%' })  
312 - .padding({ bottom: 72 })  
313 - .visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible) 330 + .margin({ bottom: 20 })
314 } 331 }
315 } 332 }