chenquansheng

fix |> 优化评论数据显示

@@ -54,24 +54,28 @@ export struct CommentText { @@ -54,24 +54,28 @@ export struct CommentText {
54 wordBreak:WordBreak.BREAK_ALL 54 wordBreak:WordBreak.BREAK_ALL
55 }) 55 })
56 56
57 - // console.log(`>>>>>>>文本宽度为:${this.textWidth}-${this.contentText}`)  
58 this.promise.then((data: Array<display.Display>) => { 57 this.promise.then((data: Array<display.Display>) => {
59 - console.log(`所有的屏幕信息:${JSON.stringify(data)}`)  
60 - //单位为像素 58 + // console.log(`所有的屏幕信息:${JSON.stringify(data)}`)
  59 + //单位为像素px
61 this.screenWidth = data[0]["width"] 60 this.screenWidth = data[0]["width"]
62 // 屏幕宽度 * 最大行数 * 组件宽度比例 和 文字测量宽度3900,,3951 61 // 屏幕宽度 * 最大行数 * 组件宽度比例 和 文字测量宽度3900,,3951
63 this.isExpanded = (this.screenWidth - padding) * this.lines <= this.textWidth 62 this.isExpanded = (this.screenWidth - padding) * this.lines <= this.textWidth
64 // this.expandedStates = this.isExpanded; 63 // this.expandedStates = this.isExpanded;
65 64
  65 + // let size = this.topMeasureText(tempMessage.toString(), (this.screenWidth - padding), 24, this.fontSize, this.fontWeight)
  66 + // let size1 = this.topMeasureText(this.longMessage, (this.screenWidth - padding), 24, this.fontSize, this.fontWeight)
  67 + // let height: number = Number(size.height)
  68 + // let height1: number = Number(size1.height)
  69 + // console.log(`>>>>>>>行高:${height}++${px2vp(height1)}++${tempMessage.toString()}++${this.isExpanded}`)
  70 +
66 let lines = this.getTextLineNum( 71 let lines = this.getTextLineNum(
67 - tempMessage.toString(), 72 + this.longMessage,
68 (this.screenWidth - padding), 73 (this.screenWidth - padding),
69 this.lineHeight, 74 this.lineHeight,
70 this.fontSize, 75 this.fontSize,
71 this.fontWeight 76 this.fontWeight
72 ) 77 )
73 78
74 - console.log(`>>>>>>>行高数:${lines}-${this.screenWidth}-${this.longMessage}`)  
75 if (lines > 3) { 79 if (lines > 3) {
76 this.isExpanded = true 80 this.isExpanded = true
77 } 81 }
@@ -80,11 +84,11 @@ export struct CommentText { @@ -80,11 +84,11 @@ export struct CommentText {
80 if (this.isExpanded) { 84 if (this.isExpanded) {
81 85
82 86
83 - let padding = vp2px(5 + this.marginWidth) 87 + // let padding = vp2px(5 + this.marginWidth)
84 let maxLineTextWidth = (this.screenWidth - padding) * this.maxline; 88 let maxLineTextWidth = (this.screenWidth - padding) * this.maxline;
85 89
86 - for (let index = 0; index < tempMessage.length; index++) {  
87 - const element = tempMessage.substring(0, index) 90 + for (let index = 0; index < this.longMessage.length; index++) {
  91 + const element = tempMessage.toString().substring(0, index)
88 const string = element + this.collapseText; //截取 92 const string = element + this.collapseText; //截取
89 const thisTextWidth = measure.measureText({ 93 const thisTextWidth = measure.measureText({
90 textContent: string, 94 textContent: string,
@@ -207,8 +207,6 @@ export class PageHelper { @@ -207,8 +207,6 @@ export class PageHelper {
207 } else { 207 } else {
208 208
209 pageDto = await PageViewModel.getPageGroupCompData(pageModel.bizCopy()) as PageDTO 209 pageDto = await PageViewModel.getPageGroupCompData(pageModel.bizCopy()) as PageDTO
210 - // PageViewModel.getPageGroupCompData(pageModel.bizCopy()).then(pageDto=>{  
211 - // })  
212 if (pageDto.md5 === undefined){ 210 if (pageDto.md5 === undefined){
213 continue 211 continue
214 } 212 }