Showing
1 changed file
with
44 additions
and
4 deletions
| 1 | // import { FrontLinkObject, MorningEveningPaperDTO, PageInfoBean } from 'wdBean'; | 1 | // import { FrontLinkObject, MorningEveningPaperDTO, PageInfoBean } from 'wdBean'; |
| 2 | -import { CompList, PageInfoBean } from 'wdBean'; | 2 | +import { |
| 3 | + CompList, | ||
| 4 | + PageInfoBean, | ||
| 5 | + ContentDTO, | ||
| 6 | + contentListParams, | ||
| 7 | + InteractDataDTO | ||
| 8 | +} from 'wdBean'; | ||
| 3 | import { DateTimeUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index'; | 9 | import { DateTimeUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index'; |
| 4 | import { PaperReaderSimpleDialog } from '../../dialog/PaperReaderDialog'; | 10 | import { PaperReaderSimpleDialog } from '../../dialog/PaperReaderDialog'; |
| 5 | import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel'; | 11 | import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel'; |
| @@ -13,6 +19,8 @@ import { image } from '@kit.ImageKit'; | @@ -13,6 +19,8 @@ import { image } from '@kit.ImageKit'; | ||
| 13 | import { getPicture, imageNet2PixelMap } from '../../utils/ImageUtils'; | 19 | import { getPicture, imageNet2PixelMap } from '../../utils/ImageUtils'; |
| 14 | import { effectKit } from '@kit.ArkGraphics2D'; | 20 | import { effectKit } from '@kit.ArkGraphics2D'; |
| 15 | import { window } from '@kit.ArkUI'; | 21 | import { window } from '@kit.ArkUI'; |
| 22 | +import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel'; | ||
| 23 | +import { AudioSuspensionModel } from '../../viewmodel/AudioSuspensionModel' | ||
| 16 | 24 | ||
| 17 | const TAG = 'MorningEveningPaperComponent'; | 25 | const TAG = 'MorningEveningPaperComponent'; |
| 18 | 26 | ||
| @@ -22,6 +30,7 @@ export struct MorningEveningPaperComponent { | @@ -22,6 +30,7 @@ export struct MorningEveningPaperComponent { | ||
| 22 | @State pageInfoBean: PageInfoBean = {} as PageInfoBean | 30 | @State pageInfoBean: PageInfoBean = {} as PageInfoBean |
| 23 | // @State compInfoBean: CompInfoBean = {} as CompInfoBean | 31 | // @State compInfoBean: CompInfoBean = {} as CompInfoBean |
| 24 | @State compListItem: CompList = {} as CompList | 32 | @State compListItem: CompList = {} as CompList |
| 33 | + @Provide commentList: InteractDataDTO[] = [] | ||
| 25 | @State audioPlayUrl: string = "" | 34 | @State audioPlayUrl: string = "" |
| 26 | // @Consume dailyPaperTopicPageId: number | 35 | // @Consume dailyPaperTopicPageId: number |
| 27 | // @Provide compListItem: CompList = {} as CompList | 36 | // @Provide compListItem: CompList = {} as CompList |
| @@ -66,6 +75,7 @@ export struct MorningEveningPaperComponent { | @@ -66,6 +75,7 @@ export struct MorningEveningPaperComponent { | ||
| 66 | offset: { dx: 12, dy: -150 }, | 75 | offset: { dx: 12, dy: -150 }, |
| 67 | 76 | ||
| 68 | }) | 77 | }) |
| 78 | + private AudioSuspension = new AudioSuspensionModel() | ||
| 69 | 79 | ||
| 70 | onCancel() { | 80 | onCancel() { |
| 71 | Logger.info(TAG, "cj2024 onCancel = ") | 81 | Logger.info(TAG, "cj2024 onCancel = ") |
| @@ -128,6 +138,10 @@ export struct MorningEveningPaperComponent { | @@ -128,6 +138,10 @@ export struct MorningEveningPaperComponent { | ||
| 128 | // this.compInfoBean = compInfoBean | 138 | // this.compInfoBean = compInfoBean |
| 129 | if (compInfoBean?.compList[0]) { | 139 | if (compInfoBean?.compList[0]) { |
| 130 | this.compListItem = compInfoBean?.compList[0] | 140 | this.compListItem = compInfoBean?.compList[0] |
| 141 | + Logger.debug(TAG, '获取评论数据' + `${this.compListItem.operDataList.length}`) | ||
| 142 | + if (this.compListItem.operDataList && this.compListItem.operDataList.length > 0) { | ||
| 143 | + this.getAllContentInteractData(this.compListItem.operDataList) | ||
| 144 | + } | ||
| 131 | if (compInfoBean?.compList[0].audioDataList) { | 145 | if (compInfoBean?.compList[0].audioDataList) { |
| 132 | this.audioPlayUrl = compInfoBean?.compList[0].audioDataList[0].audioUrl | 146 | this.audioPlayUrl = compInfoBean?.compList[0].audioDataList[0].audioUrl |
| 133 | this.audioTitle = compInfoBean?.compList[0].audioDataList[0].title | 147 | this.audioTitle = compInfoBean?.compList[0].audioDataList[0].title |
| @@ -146,6 +160,29 @@ export struct MorningEveningPaperComponent { | @@ -146,6 +160,29 @@ export struct MorningEveningPaperComponent { | ||
| 146 | 160 | ||
| 147 | } | 161 | } |
| 148 | 162 | ||
| 163 | + // 批量查询内容当前用户点赞、收藏状态评论个数 | ||
| 164 | + private async getAllContentInteractData(list: ContentDTO[]) { | ||
| 165 | + try { | ||
| 166 | + // 获取列表数据 | ||
| 167 | + const params: contentListParams = { | ||
| 168 | + contentList: [] | ||
| 169 | + } | ||
| 170 | + list.forEach((item: ContentDTO) => { | ||
| 171 | + params.contentList.push({ | ||
| 172 | + contentId: item.objectId, | ||
| 173 | + contentType: Number(item.objectType ?? '1') | ||
| 174 | + }) | ||
| 175 | + }) | ||
| 176 | + Logger.debug(TAG, '获取评论数据' + `${JSON.stringify(params)}`) | ||
| 177 | + | ||
| 178 | + this.commentList = await PeopleShipMainViewModel.getContentInteractInfo(params) | ||
| 179 | + Logger.debug(TAG, '获取评论数据' + `${JSON.stringify(this.commentList)}`) | ||
| 180 | + | ||
| 181 | + } catch (exception) { | ||
| 182 | + | ||
| 183 | + } | ||
| 184 | + } | ||
| 185 | + | ||
| 149 | async setComponentBgColor(imageUrl: string) { | 186 | async setComponentBgColor(imageUrl: string) { |
| 150 | // 图片转换为PixelMap对象 | 187 | // 图片转换为PixelMap对象 |
| 151 | // const pixelMap: image.PixelMap = await image2PixelMap(item.icon); | 188 | // const pixelMap: image.PixelMap = await image2PixelMap(item.icon); |
| @@ -203,7 +240,9 @@ export struct MorningEveningPaperComponent { | @@ -203,7 +240,9 @@ export struct MorningEveningPaperComponent { | ||
| 203 | } | 240 | } |
| 204 | 241 | ||
| 205 | ListItem() { | 242 | ListItem() { |
| 206 | - SingleColumn999Component({ compListItem: this.compListItem }) | 243 | + SingleColumn999Component({ |
| 244 | + compListItem: this.compListItem, | ||
| 245 | + }) | ||
| 207 | .margin({ | 246 | .margin({ |
| 208 | top: this.pageInfoBean?.topicInfo?.frontLinkObject ? 10 : 44 | 247 | top: this.pageInfoBean?.topicInfo?.frontLinkObject ? 10 : 44 |
| 209 | }) | 248 | }) |
| @@ -261,8 +300,9 @@ export struct MorningEveningPaperComponent { | @@ -261,8 +300,9 @@ export struct MorningEveningPaperComponent { | ||
| 261 | .objectFit(ImageFit.Contain) | 300 | .objectFit(ImageFit.Contain) |
| 262 | .onClick(() => { | 301 | .onClick(() => { |
| 263 | Logger.info("TAG", "cj compInfoBean onClick1 = " + this.isAudioPlaying) | 302 | Logger.info("TAG", "cj compInfoBean onClick1 = " + this.isAudioPlaying) |
| 264 | - dialog.open() | ||
| 265 | - this.playerController.firstPlay(this.audioPlayUrl) | 303 | + // dialog.open() |
| 304 | + this.AudioSuspension.showWindow() | ||
| 305 | + // this.playerController.firstPlay(this.audioPlayUrl) | ||
| 266 | Logger.info("TAG", "cj compInfoBean onClick2 = " + this.isAudioPlaying) | 306 | Logger.info("TAG", "cj compInfoBean onClick2 = " + this.isAudioPlaying) |
| 267 | }) | 307 | }) |
| 268 | } | 308 | } |
-
Please register or login to post a comment