yumaochao
@@ -41,7 +41,7 @@ export struct DynamicDetailComponent { @@ -41,7 +41,7 @@ export struct DynamicDetailComponent {
41 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 41 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
42 42
43 //跳转 43 //跳转
44 - private mJumpInfo: ContentDTO = {} as ContentDTO; 44 + private mJumpInfo: ContentDTO = {} as ContentDTO;
45 45
46 // 获取当前所有的display对象 46 // 获取当前所有的display对象
47 promise: Promise<Array<display.Display>> = display.getAllDisplays() 47 promise: Promise<Array<display.Display>> = display.getAllDisplays()
@@ -65,7 +65,7 @@ export struct DynamicDetailComponent { @@ -65,7 +65,7 @@ export struct DynamicDetailComponent {
65 .height($r('app.float.margin_28')) 65 .height($r('app.float.margin_28'))
66 .margin({ left: $r('app.float.margin_16') }) 66 .margin({ left: $r('app.float.margin_16') })
67 Blank() 67 Blank()
68 - Text(this.contentDetailData.publishTime) 68 + Text(StringUtils.isEmpty(this.contentDetailData.publishTime)?"":this.contentDetailData.publishTime.replace('-','年').replace('-','月').replace(' ','日 ').substring(0,this.contentDetailData.publishTime.length-2))
69 .fontColor($r('app.color.color_B0B0B0')) 69 .fontColor($r('app.color.color_B0B0B0'))
70 .fontSize($r('app.float.font_size_12')) 70 .fontSize($r('app.float.font_size_12'))
71 .lineHeight($r('app.float.margin_28')) 71 .lineHeight($r('app.float.margin_28'))
@@ -284,7 +284,6 @@ export struct DynamicDetailComponent { @@ -284,7 +284,6 @@ export struct DynamicDetailComponent {
284 } 284 }
285 .margin({ left: $r('app.float.margin_16'),right: $r('app.float.margin_16'),top: $r('app.float.margin_8')}) 285 .margin({ left: $r('app.float.margin_16'),right: $r('app.float.margin_16'),top: $r('app.float.margin_8')})
286 .onClick((event: ClickEvent) => { 286 .onClick((event: ClickEvent) => {
287 - this.mJumpInfo.objectType = ContentConstants.TYPE_VOD;  
288 ProcessUtils.processPage(this.mJumpInfo) 287 ProcessUtils.processPage(this.mJumpInfo)
289 }) 288 })
290 } 289 }
@@ -440,12 +439,14 @@ export struct DynamicDetailComponent { @@ -440,12 +439,14 @@ export struct DynamicDetailComponent {
440 439
441 //创建跳转信息 440 //创建跳转信息
442 makeJumpInfo(){ 441 makeJumpInfo(){
443 - this.mJumpInfo.pageId = 'dynamicDetailPage';  
444 - // this.mJumpInfo.from = 'dynamicDetailPage';  
445 - this.mJumpInfo.objectId = this.contentDetailData.newsId+"";  
446 - this.mJumpInfo.relType = this.contentDetailData.reLInfo?.relType+"";  
447 - this.mJumpInfo.relId = this.contentDetailData.reLInfo?.relId+"";  
448 - // this.mJumpInfo.objectType = this.contentDetailData.newsType+""; 442 + this.mJumpInfo.pageId = 'dynamicDetailPage'
  443 + this.mJumpInfo.objectId = this.contentDetailData.newsId+""
  444 + this.mJumpInfo.relType = this.contentDetailData.reLInfo?.relType+""
  445 + this.mJumpInfo.relId = this.contentDetailData.reLInfo?.relId+""
  446 + this.mJumpInfo.objectType = (this.contentDetailData.newsType+"") == ContentConstants.TYPE_FOURTEEN?this.contentDetailData.newsType+"":ContentConstants.TYPE_VOD
  447 + if(this.contentDetailData.videoInfo!= null && this.contentDetailData.videoInfo.length>0){
  448 + this.mJumpInfo.videoInfo = this.contentDetailData.videoInfo[0]
  449 + }
449 } 450 }
450 451
451 452
@@ -21,8 +21,10 @@ export struct CardMediaInfo { @@ -21,8 +21,10 @@ export struct CardMediaInfo {
21 Row() { 21 Row() {
22 Image($r('app.media.card_play')) 22 Image($r('app.media.card_play'))
23 .mediaLogo() 23 .mediaLogo()
24 - Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000))  
25 - .mediaText() 24 + if(this.contentDTO.videoInfo!=null){
  25 + Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000))
  26 + .mediaText()
  27 + }
26 } 28 }
27 } else if (this.contentDTO.objectType === '2') { 29 } else if (this.contentDTO.objectType === '2') {
28 // liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 30 // liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
@@ -121,34 +121,24 @@ export struct PageComponent { @@ -121,34 +121,24 @@ export struct PageComponent {
121 pageHornAd() { 121 pageHornAd() {
122 122
123 if (this.pageModel.isShowAds) { 123 if (this.pageModel.isShowAds) {
124 -  
125 if (this.pageModel.pageCornerAdv.matInfo != null) { 124 if (this.pageModel.pageCornerAdv.matInfo != null) {
126 - if (1 == this.pageModel.isRightAdv) {  
127 - // 页面右边挂角  
128 - this.drawRightCornerAdvView(1)  
129 - } else if (2 == this.pageModel.isRightAdv) {  
130 - // 页面左边挂角  
131 - this.drawLeftCornerAdvView(1)  
132 - } 125 + // 页面右边挂角
  126 + this.drawPageCornerAdvView(1, 1 == this.pageModel.isRightAdv)
133 } else if (this.pageModel.pageCornerContentInfo.advert != null) { 127 } else if (this.pageModel.pageCornerContentInfo.advert != null) {
134 - if (1 == this.pageModel.isRightAdv) {  
135 - // 页面右边挂角  
136 - this.drawRightCornerAdvView(2)  
137 - } else if (2 == this.pageModel.isRightAdv) {  
138 - // 页面左边挂角  
139 - this.drawLeftCornerAdvView(2)  
140 - } 128 + this.drawPageCornerAdvView(2, 1 == this.pageModel.isRightAdv)
141 } 129 }
142 } 130 }
143 131
144 } 132 }
145 133
146 /** 134 /**
  135 + * 绘制页面挂角
147 * 136 *
148 * @param type 1:广告中心的挂角广告;2:展现中心的挂角广告 137 * @param type 1:广告中心的挂角广告;2:展现中心的挂角广告
  138 + * @param isRightCorne true:右挂角;false:左挂角
149 */ 139 */
150 @Builder 140 @Builder
151 - drawLeftCornerAdvView(type: number) { 141 + drawPageCornerAdvView(type: number, isRightCorne: boolean) {
152 // 页面左挂角 142 // 页面左挂角
153 Image(type === 1 ? this.pageModel.pageCornerAdv.matInfo.matImageUrl[0] 143 Image(type === 1 ? this.pageModel.pageCornerAdv.matInfo.matImageUrl[0]
154 : this.pageModel.pageCornerContentInfo.advert.displayUrl) 144 : this.pageModel.pageCornerContentInfo.advert.displayUrl)
@@ -157,97 +147,36 @@ export struct PageComponent { @@ -157,97 +147,36 @@ export struct PageComponent {
157 .id("left_iv") 147 .id("left_iv")
158 .alignRules({ 148 .alignRules({
159 bottom: { anchor: '__container__', align: VerticalAlign.Bottom }, 149 bottom: { anchor: '__container__', align: VerticalAlign.Bottom },
160 - left: { anchor: '__container__', align: HorizontalAlign.Start }, 150 + left: { anchor: isRightCorne ? "" : '__container__', align: HorizontalAlign.Start },
  151 + right: { anchor: isRightCorne ? '__container__' : "", align: HorizontalAlign.End },
161 }) 152 })
162 .margin({ 153 .margin({
163 bottom: "65vp", 154 bottom: "65vp",
164 - left: ('app.float.card_comp_pagePadding_lf')  
165 - })  
166 - .onClick(() => {  
167 - // 广告业务跳转  
168 - ProcessUtils.openAdvDetail(this.pageModel.pageCornerAdv.matInfo);  
169 - }) 155 + left: isRightCorne ? 0 : $r('app.float.card_comp_pagePadding_lf'),
  156 + right: isRightCorne ? $r('app.float.card_comp_pagePadding_lf') : 0,
170 157
171 - Image($r('app.media.icon_adv_horn_close'))  
172 - .id('left_close')  
173 - .width($r('app.float.vp_16'))  
174 - .alignRules({  
175 - top: { anchor: 'left_iv', align: VerticalAlign.Top },  
176 - left: { anchor: 'left_iv', align: HorizontalAlign.Start },  
177 - })  
178 - .offset({  
179 - x: -10,  
180 - y: -10  
181 }) 158 })
182 .onClick(() => { 159 .onClick(() => {
183 - // 关闭挂角广告  
184 - this.pageModel.isShowAds = false;  
185 -  
186 - })  
187 -  
188 - if (type == 1) {  
189 - Text($r('app.string.comp_advertisement'))  
190 - .width($r('app.float.vp_28'))  
191 - .height($r('app.float.vp_16'))  
192 - .fontSize($r('app.float.font_size_10'))  
193 - .fontColor(Color.White)  
194 - .id('left_tag')  
195 - .alignRules({  
196 - bottom: { anchor: 'left_iv', align: VerticalAlign.Bottom },  
197 - left: { anchor: 'left_iv', align: HorizontalAlign.Start },  
198 - })  
199 - .textAlign(TextAlign.Center)  
200 - .backgroundColor($r('app.color.res_color_general_000000_30'))  
201 - .borderRadius({  
202 - topLeft: $r('app.float.vp_2'),  
203 - topRight: $r('app.float.vp_2'),  
204 - bottomLeft: $r('app.float.vp_2'),  
205 - bottomRight: $r('app.float.vp_2')  
206 - })  
207 - }  
208 -  
209 - }  
210 -  
211 - /**  
212 - *  
213 - * @param type 1:广告中心的挂角广告;2:展现中心的挂角广告  
214 - */  
215 - @Builder  
216 - drawRightCornerAdvView(type: number) {  
217 -  
218 - Image(type === 1 ? this.pageModel.pageCornerAdv.matInfo.matImageUrl[0]  
219 - : this.pageModel.pageCornerContentInfo.advert.displayUrl)  
220 - .width($r('app.float.vp_80'))  
221 - .height($r('app.float.vp_80'))  
222 - .id("right_iv")  
223 - .alignRules({  
224 - bottom: { anchor: '__container__', align: VerticalAlign.Bottom },  
225 - right: { anchor: '__container__', align: HorizontalAlign.End },  
226 - })  
227 - .margin({ bottom: "65vp", right: $r('app.float.card_comp_pagePadding_lf') })  
228 - .onClick(() => {  
229 -  
230 if (type === 1) { 160 if (type === 1) {
231 // 广告业务跳转 161 // 广告业务跳转
232 ProcessUtils.openAdvDetail(this.pageModel.pageCornerAdv.matInfo); 162 ProcessUtils.openAdvDetail(this.pageModel.pageCornerAdv.matInfo);
233 } else { 163 } else {
234 // 展现中心的业务跳转 164 // 展现中心的业务跳转
235 ProcessUtils.advJumpMainPage(this.pageModel.pageCornerContentInfo.advert) 165 ProcessUtils.advJumpMainPage(this.pageModel.pageCornerContentInfo.advert)
236 -  
237 } 166 }
238 -  
239 }) 167 })
240 - 168 + // 关闭按钮
241 Image($r('app.media.icon_adv_horn_close')) 169 Image($r('app.media.icon_adv_horn_close'))
242 - .id('right_close') 170 + .id('left_close')
243 .width($r('app.float.vp_16')) 171 .width($r('app.float.vp_16'))
244 .alignRules({ 172 .alignRules({
245 - top: { anchor: 'right_iv', align: VerticalAlign.Top },  
246 - right: { anchor: 'right_iv', align: HorizontalAlign.End }, 173 + top: { anchor: 'left_iv', align: VerticalAlign.Top },
  174 + left: { anchor: isRightCorne ? '' : 'left_iv', align: HorizontalAlign.Start },
  175 + right: { anchor: isRightCorne ? 'left_iv' : '', align: HorizontalAlign.End },
247 }) 176 })
248 .offset({ 177 .offset({
249 - x: 10,  
250 - y: -10 178 + x: isRightCorne ? 10 : -10,
  179 + y: isRightCorne ? -10 : -10
251 }) 180 })
252 .onClick(() => { 181 .onClick(() => {
253 // 关闭挂角广告 182 // 关闭挂角广告
@@ -261,10 +190,11 @@ export struct PageComponent { @@ -261,10 +190,11 @@ export struct PageComponent {
261 .height($r('app.float.vp_16')) 190 .height($r('app.float.vp_16'))
262 .fontSize($r('app.float.font_size_10')) 191 .fontSize($r('app.float.font_size_10'))
263 .fontColor(Color.White) 192 .fontColor(Color.White)
264 - .id('right_tag') 193 + .id('left_tag')
265 .alignRules({ 194 .alignRules({
266 - bottom: { anchor: 'right_iv', align: VerticalAlign.Bottom },  
267 - right: { anchor: 'right_iv', align: HorizontalAlign.End }, 195 + bottom: { anchor: 'left_iv', align: VerticalAlign.Bottom },
  196 + left: { anchor: isRightCorne ? '' : 'left_iv', align: HorizontalAlign.Start },
  197 + right: { anchor: isRightCorne ? 'left_iv' : '', align: HorizontalAlign.End },
268 }) 198 })
269 .textAlign(TextAlign.Center) 199 .textAlign(TextAlign.Center)
270 .backgroundColor($r('app.color.res_color_general_000000_30')) 200 .backgroundColor($r('app.color.res_color_general_000000_30'))
@@ -276,7 +206,6 @@ export struct PageComponent { @@ -276,7 +206,6 @@ export struct PageComponent {
276 }) 206 })
277 } 207 }
278 208
279 -  
280 } 209 }
281 210
282 async aboutToAppear() { 211 async aboutToAppear() {
@@ -71,7 +71,6 @@ export class PageHelper { @@ -71,7 +71,6 @@ export class PageHelper {
71 return 71 return
72 } 72 }
73 73
74 -  
75 if ("left_down" == cornersAdv.pos) { 74 if ("left_down" == cornersAdv.pos) {
76 // 左边挂角广告 75 // 左边挂角广告
77 pageModel.isRightAdv = 2 76 pageModel.isRightAdv = 2