王士厅
@@ -25,6 +25,7 @@ import { channelSkeleton } from './skeleton/channelSkeleton'; @@ -25,6 +25,7 @@ import { channelSkeleton } from './skeleton/channelSkeleton';
25 import PageAdModel from '../viewmodel/PageAdvModel'; 25 import PageAdModel from '../viewmodel/PageAdvModel';
26 import { ProcessUtils } from 'wdRouter/Index'; 26 import { ProcessUtils } from 'wdRouter/Index';
27 import { GrayManageModel } from '../viewmodel/GrayManageModel'; 27 import { GrayManageModel } from '../viewmodel/GrayManageModel';
  28 +import router from '@ohos.router';
28 29
29 const TAG: string = 'SpacialTopicPageComponent' 30 const TAG: string = 'SpacialTopicPageComponent'
30 31
@@ -173,14 +174,39 @@ export struct SpacialTopicPageComponent { @@ -173,14 +174,39 @@ export struct SpacialTopicPageComponent {
173 } 174 }
174 175
175 if (!this.isNetConnected) { 176 if (!this.isNetConnected) {
  177 + Column() {
  178 + Image($r('app.media.line'))
  179 + .width('calc(100% - 36vp)')
  180 + .height(7)
  181 + .position({
  182 + top: 92,
  183 + left: 18
  184 + })
176 EmptyComponent({ 185 EmptyComponent({
  186 + emptyHeight: 'calc(100% - 55vp)',
177 emptyType: 1, 187 emptyType: 1,
178 emptyButton: true, 188 emptyButton: true,
179 retry: () => { 189 retry: () => {
180 // this.getDetail() 190 // this.getDetail()
181 this.reload++ 191 this.reload++
182 } 192 }
183 - }).padding({ bottom: 200 }) 193 + }).padding({ bottom: 200, top: 48 })
  194 +
  195 + Image($r("app.media.back_icon"))
  196 + .width(24)
  197 + .height(24)
  198 + .onClick(() => {
  199 + router.back();
  200 + })
  201 + .position({
  202 + bottom: 15,
  203 + left: 16
  204 + })
  205 + }
  206 + .width('100%')
  207 + .height('100%')
  208 + .layoutWeight(1)
  209 + .backgroundColor(0xffffff)
184 } else { 210 } else {
185 if (!this.isPageEnd) { 211 if (!this.isPageEnd) {
186 channelSkeleton().padding({ top: `${this.topSafeHeight}px`, bottom: this.bottomSafeHeight }) 212 channelSkeleton().padding({ top: `${this.topSafeHeight}px`, bottom: this.bottomSafeHeight })
@@ -94,7 +94,8 @@ export struct PlayerTitleView { @@ -94,7 +94,8 @@ export struct PlayerTitleView {
94 } 94 }
95 clipStr += strArr[i] 95 clipStr += strArr[i]
96 } 96 }
97 - console.log(TAG, 'clipStr:', clipStr) 97 + clipStr += this.isOverLines ? '...' : '';
  98 + console.log(TAG, 'clipStr2:', clipStr)
98 return clipStr 99 return clipStr
99 } 100 }
100 101
@@ -130,7 +131,8 @@ export struct PlayerTitleView { @@ -130,7 +131,8 @@ export struct PlayerTitleView {
130 } 131 }
131 clipStr += strArr[i] 132 clipStr += strArr[i]
132 } 133 }
133 - console.log(TAG, 'clipTitleText clipStr:', clipStr) 134 + console.log(TAG, 'clipTitleText clipStr1:', clipStr)
  135 + clipStr += this.isTitleOverLines ? '...' : '';
134 return clipStr 136 return clipStr
135 } 137 }
136 138
@@ -217,7 +219,54 @@ export struct PlayerTitleView { @@ -217,7 +219,54 @@ export struct PlayerTitleView {
217 // }) 219 // })
218 // } 220 // }
219 // } else { 221 // } else {
  222 + this.detailDesc()
  223 + // }
  224 + Text(DateTimeUtils.formatDate(new Date(this.contentDetailData?.publishTime).getTime(),
  225 + DateTimeUtils.PATTERN_DATE_TIME_HYPHEN_MM))
  226 + .fontSize(12)
  227 + .fontColor(Color.White)
  228 + .opacity(0.7)
  229 + .lineHeight(16)
  230 + .fontWeight(400)
  231 + .fontFamily('PingFang SC-Regular')
  232 + .margin({ top: 8, bottom: 8 })
  233 +
  234 + }
  235 + .width(this.windowWidth - 150 + 'px')
  236 + .padding({ left: 16, right: 22 })
  237 + .alignItems(HorizontalAlign.Start)
  238 + .visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible)
  239 + }
  240 +
  241 + @Builder
  242 + detailDesc() {
  243 + /**
  244 + * 标题大于三行或存在简介显示查看详情按钮
  245 + */
  246 + // if (this.rmhPlatform == 1) {
  247 + // if (this.titleHeight > 200 || this.summary) {
  248 + // Text('查看详情 > ')
  249 + // .padding({
  250 + // left: 6,
  251 + // right: 6,
  252 + // top: 4,
  253 + // bottom: 4
  254 + // })
  255 + // .borderRadius(2)
  256 + // .backgroundColor('#99636363')
  257 + // .fontFamily('PingFang SC-Regular')
  258 + // .fontColor(Color.White)
  259 + // .fontSize(12)
  260 + // .lineHeight(14)
  261 + // .fontWeight(400)
  262 + // .onClick(() => {
  263 + // this.isOpenDetail = true
  264 + // this.dialogController?.open()
  265 + // })
  266 + // }
  267 + // } else {
220 if (this.summary && this.titleLines < 4) { 268 if (this.summary && this.titleLines < 4) {
  269 + Stack({ alignContent: Alignment.TopStart }) {
221 Text() { 270 Text() {
222 Span(this.clipText(this.summary, 14, this.summaryLines, this.windowWidth - 150 - vp2px(50))) 271 Span(this.clipText(this.summary, 14, this.summaryLines, this.windowWidth - 150 - vp2px(50)))
223 .fontSize(14) 272 .fontSize(14)
@@ -229,9 +278,18 @@ export struct PlayerTitleView { @@ -229,9 +278,18 @@ export struct PlayerTitleView {
229 this.isOpenDetail = true 278 this.isOpenDetail = true
230 this.dialogController?.open() 279 this.dialogController?.open()
231 }) 280 })
  281 + }
  282 + // .position({ x: 0, y: 0 })
  283 + .padding({
  284 + left: 0,
  285 + right: 6,
  286 + top: 0,
  287 + bottom: 8
  288 + })
232 if (this.isOverLines) { 289 if (this.isOverLines) {
233 - Span('... 全文')  
234 - .fontColor('#888888') 290 + Text() {
  291 + Span('全文')
  292 + .fontColor('#99FFFFFF')
235 .fontWeight(400) 293 .fontWeight(400)
236 .fontFamily('PingFang SC-Regular') 294 .fontFamily('PingFang SC-Regular')
237 .fontSize(12) 295 .fontSize(12)
@@ -251,37 +309,31 @@ export struct PlayerTitleView { @@ -251,37 +309,31 @@ export struct PlayerTitleView {
251 this.isOpenDetail = true 309 this.isOpenDetail = true
252 this.dialogController?.open() 310 this.dialogController?.open()
253 }) 311 })
254 -  
255 - }  
256 } 312 }
  313 + .textAlign(TextAlign.Center)
  314 + // .width('100%')
  315 + .position({ x: '100%', y: this.summaryLines*23 }) //行高+margin
  316 + .translate({ x: '-100%', y: '-100%' })
  317 + // .markAnchor({ x: '100%', y: '100%' })
257 .padding({ 318 .padding({
258 - left: 0, //6 319 + left: 0,
259 right: 6, 320 right: 6,
260 - top: 0, //4  
261 - bottom: 8 321 + top: 0,
  322 + bottom: 6
262 }) 323 })
263 -  
264 } 324 }
265 - // }  
266 - Text(DateTimeUtils.formatDate(new Date(this.contentDetailData?.publishTime).getTime(),  
267 - DateTimeUtils.PATTERN_DATE_TIME_HYPHEN_MM))  
268 - .fontSize(12)  
269 - .fontColor(Color.White)  
270 - .opacity(0.7)  
271 - .lineHeight(16)  
272 - .fontWeight(400)  
273 - .fontFamily('PingFang SC-Regular')  
274 - .margin({ top: 8, bottom: 8 })  
275 -  
276 } 325 }
277 - .width(this.windowWidth - 150 + 'px')  
278 - .padding({ left: 16, right: 22 })  
279 - .alignItems(HorizontalAlign.Start)  
280 - .visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible) 326 + .width('100%')
  327 + }
281 } 328 }
282 329
  330 + /**
  331 + * 标题
  332 + * */
283 @Builder 333 @Builder
284 titleBuilder() { 334 titleBuilder() {
  335 + // Stack({ alignContent: this.isTitleOverLines ? Alignment.BottomEnd : Alignment.Start }) {
  336 + Stack({ alignContent: Alignment.TopStart }) {
285 Text() { 337 Text() {
286 Span(this.clipTitleText(this.getTitle(), 16, 4, this.windowWidth - 234 - vp2px(50))) 338 Span(this.clipTitleText(this.getTitle(), 16, 4, this.windowWidth - 234 - vp2px(50)))
287 .fontSize(16) 339 .fontSize(16)
@@ -289,9 +341,28 @@ export struct PlayerTitleView { @@ -289,9 +341,28 @@ export struct PlayerTitleView {
289 .lineHeight(22) 341 .lineHeight(22)
290 .fontWeight(600) 342 .fontWeight(600)
291 .fontFamily('PingFang SC-Regular') 343 .fontFamily('PingFang SC-Regular')
  344 +
  345 + }
  346 + // .position({ x: 0, y: 0 })
  347 + .onAreaChange((oldArea: Area, newArea: Area) => {
  348 + //console.info(`cj2024 titleLines = ${newArea.height as number} line = ${(newArea.height as number) / 20}`)
  349 + this.titleLines = Math.floor((newArea.height as number) / 22) // 22是行高
  350 + //console.info(`cj2024 titleLines = ${this.titleLines}`)
  351 + this.updateSummaryLines()
  352 + })
  353 + .maxLines(4)
  354 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  355 + .padding({
  356 + left: 0, //6
  357 + right: 6,
  358 + top: 0, //4
  359 + bottom: 8
  360 + })
  361 +
  362 + Text() {
292 if (this.isTitleOverLines) { 363 if (this.isTitleOverLines) {
293 - Span('... 全文')  
294 - .fontColor(Color.White) 364 + Span('全文')
  365 + .fontColor('#99FFFFFF')
295 .fontWeight(600) 366 .fontWeight(600)
296 .fontFamily('PingFang SC-Regular') 367 .fontFamily('PingFang SC-Regular')
297 .fontSize(12) 368 .fontSize(12)
@@ -311,15 +382,14 @@ export struct PlayerTitleView { @@ -311,15 +382,14 @@ export struct PlayerTitleView {
311 this.isOpenDetail = true 382 this.isOpenDetail = true
312 this.dialogController?.open() 383 this.dialogController?.open()
313 }) 384 })
314 -  
315 } 385 }
316 } 386 }
317 - .onAreaChange((oldArea: Area, newArea: Area) => {  
318 - //console.info(`cj2024 titleLines = ${newArea.height as number} line = ${(newArea.height as number) / 20}`)  
319 - this.titleLines = Math.floor((newArea.height as number) / 22) // 22是行高  
320 - //console.info(`cj2024 titleLines = ${this.titleLines}`)  
321 - this.updateSummaryLines()  
322 - }) 387 + .textAlign(TextAlign.Center)
  388 + // .width('100%')
  389 + .position({ x: '100%', y: this.titleLines*23 }) //行高+margin
  390 + .translate({ x: '-100%', y: '-100%' })
  391 + // .position({ x: '100%', y: '100%' })
  392 + // .markAnchor({ x: '100%', y: '100%' })
323 .padding({ 393 .padding({
324 left: 0, //6 394 left: 0, //6
325 right: 6, 395 right: 6,
@@ -327,4 +397,6 @@ export struct PlayerTitleView { @@ -327,4 +397,6 @@ export struct PlayerTitleView {
327 bottom: 8 397 bottom: 8
328 }) 398 })
329 } 399 }
  400 + .width('100%')
  401 + }
330 } 402 }
1 -<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="16" height="16" viewBox="0 0 16 16"><g transform="matrix(0,-1,1,0,-16,16)"><g><path d="M10.303455641479491,17.960819560243227L4.363755241479492,23.900515460243227Q4.324434578479492,23.939835460243224,4.324704443879492,23.995445460243225Q4.324434578479492,24.051055460243226,4.363755241479492,24.090375460243223L10.303455641479491,30.030075460243225Q10.342505641479491,30.069075460243226,10.397735641479493,30.069075460243226Q10.452965641479492,30.069075460243226,10.492015641479492,30.030075460243225L11.387685641479493,29.134375460243227Q11.406435641479492,29.115675460243224,11.416585641479493,29.091175460243225Q11.426735641479493,29.066675460243225,11.426735641479493,29.040075460243223Q11.426735641479493,29.013575460243224,11.416585641479493,28.989075460243225Q11.406435641479492,28.964575460243225,11.387685641479493,28.945875460243226L6.437285641479493,23.995445460243225L11.387685641479493,19.045045460243227Q11.406435641479492,19.026295460243226,11.416585641479493,19.001795460243226Q11.426735641479493,18.977295460243226,11.426735641479493,18.950765460243225Q11.426735641479493,18.924245460243224,11.416585641479493,18.899744460243227Q11.406435641479492,18.875241460243224,11.387685641479493,18.856488460243224L10.492015641479492,17.960819560243227Q10.452965641479492,17.921767119783226,10.397735641479493,17.921767119783226Q10.342505641479491,17.921767119783226,10.303455641479491,17.960819560243227Z" fill-rule="evenodd" fill="#888888" fill-opacity="1"/></g></g></svg>  
  1 +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="16" height="16" viewBox="0 0 16 16"><g transform="matrix(0,-1,1,0,-16,16)"><g><path d="M10.303455641479491,17.960819560243227L4.363755241479492,23.900515460243227Q4.324434578479492,23.939835460243224,4.324704443879492,23.995445460243225Q4.324434578479492,24.051055460243226,4.363755241479492,24.090375460243223L10.303455641479491,30.030075460243225Q10.342505641479491,30.069075460243226,10.397735641479493,30.069075460243226Q10.452965641479492,30.069075460243226,10.492015641479492,30.030075460243225L11.387685641479493,29.134375460243227Q11.406435641479492,29.115675460243224,11.416585641479493,29.091175460243225Q11.426735641479493,29.066675460243225,11.426735641479493,29.040075460243223Q11.426735641479493,29.013575460243224,11.416585641479493,28.989075460243225Q11.406435641479492,28.964575460243225,11.387685641479493,28.945875460243226L6.437285641479493,23.995445460243225L11.387685641479493,19.045045460243227Q11.406435641479492,19.026295460243226,11.416585641479493,19.001795460243226Q11.426735641479493,18.977295460243226,11.426735641479493,18.950765460243225Q11.426735641479493,18.924245460243224,11.416585641479493,18.899744460243227Q11.406435641479492,18.875241460243224,11.387685641479493,18.856488460243224L10.492015641479492,17.960819560243227Q10.452965641479492,17.921767119783226,10.397735641479493,17.921767119783226Q10.342505641479491,17.921767119783226,10.303455641479491,17.960819560243227Z" fill-rule="evenodd" fill="#FFFFFF" fill-opacity="0.6"/></g></g></svg>