王士厅
@@ -142,6 +142,8 @@ export class ContentDTO implements BaseDTO { @@ -142,6 +142,8 @@ export class ContentDTO implements BaseDTO {
142 // 是否国殇 142 // 是否国殇
143 isMourning?: boolean = false; 143 isMourning?: boolean = false;
144 144
  145 + author: string = ""; ///撰稿人
  146 +
145 static clone(old: ContentDTO): ContentDTO { 147 static clone(old: ContentDTO): ContentDTO {
146 let content = new ContentDTO(); 148 let content = new ContentDTO();
147 content.liveType = old.liveType; 149 content.liveType = old.liveType;
@@ -160,61 +160,61 @@ export struct FeedBackActivity { @@ -160,61 +160,61 @@ export struct FeedBackActivity {
160 columns:5, 160 columns:5,
161 }) { 161 }) {
162 162
163 - ForEach(this.pics, (feedbackImageItem: PhotoListBean, index: number) => {  
164 - GridCol({  
165 - }) {  
166 - if(1 == feedbackImageItem.itemType){  
167 - Image($r('app.media.feekback_add'))  
168 - .width(60)  
169 - .height(60)  
170 - .onClick(async (event: ClickEvent) => {  
171 - if(await FastClickUtil.isMinDelayTime()){  
172 - return  
173 - }  
174 - this.callFilePickerSelectImage();  
175 - })  
176 - }else{  
177 - Stack({alignContent: Alignment.TopEnd}) {  
178 - Image(feedbackImageItem.picPath)  
179 - .width(60)  
180 - .height(60)  
181 - .borderRadius($r('app.float.margin_1'))  
182 - .onClick(async (event: ClickEvent) => {  
183 - if(await FastClickUtil.isMinDelayTime()){  
184 - return  
185 - }  
186 - //查看图片 fixme 去除添加按钮  
187 - ProcessUtils.gotoMultiPictureListPage(this.pics, index)  
188 - })  
189 - Image($r('app.media.icon_feekback_delete'))  
190 - .width(24)  
191 - .height(24)  
192 - .borderRadius($r('app.float.margin_1'))  
193 - .onClick(async (event: ClickEvent) => {  
194 - if(await FastClickUtil.isMinDelayTime()){  
195 - return  
196 - }  
197 - let temp: PhotoListBean[] = [] as PhotoListBean[]  
198 - temp.length = this.pics.length - 1;  
199 - let tempIndex = 0;  
200 - for (let index = 0; index < this.pics.length; index++) {  
201 - const element = this.pics[index];  
202 - if(!StringUtils.isEmpty(element.picPath) && element.id != feedbackImageItem.id){  
203 - temp[tempIndex] = element;  
204 - tempIndex = tempIndex+1  
205 - }  
206 - }  
207 - if(tempIndex < 3){  
208 - temp[tempIndex] = this.addPic  
209 - }  
210 - this.pics = temp  
211 - })  
212 - }  
213 - .width(60)  
214 - .height(60)  
215 - }  
216 - }  
217 - }) 163 + // ForEach(this.pics, (feedbackImageItem: PhotoListBean, index: number) => {
  164 + // GridCol({
  165 + // }) {
  166 + // if(1 == feedbackImageItem.itemType){
  167 + // Image($r('app.media.feekback_add'))
  168 + // .width(60)
  169 + // .height(60)
  170 + // .onClick(async (event: ClickEvent) => {
  171 + // if(await FastClickUtil.isMinDelayTime()){
  172 + // return
  173 + // }
  174 + // this.callFilePickerSelectImage();
  175 + // })
  176 + // }else{
  177 + // Stack({alignContent: Alignment.TopEnd}) {
  178 + // Image(feedbackImageItem.picPath)
  179 + // .width(60)
  180 + // .height(60)
  181 + // .borderRadius($r('app.float.margin_1'))
  182 + // .onClick(async (event: ClickEvent) => {
  183 + // if(await FastClickUtil.isMinDelayTime()){
  184 + // return
  185 + // }
  186 + // //查看图片 fixme 去除添加按钮
  187 + // ProcessUtils.gotoMultiPictureListPage(this.pics, index)
  188 + // })
  189 + // Image($r('app.media.icon_feekback_delete'))
  190 + // .width(24)
  191 + // .height(24)
  192 + // .borderRadius($r('app.float.margin_1'))
  193 + // .onClick(async (event: ClickEvent) => {
  194 + // if(await FastClickUtil.isMinDelayTime()){
  195 + // return
  196 + // }
  197 + // let temp: PhotoListBean[] = [] as PhotoListBean[]
  198 + // temp.length = this.pics.length - 1;
  199 + // let tempIndex = 0;
  200 + // for (let index = 0; index < this.pics.length; index++) {
  201 + // const element = this.pics[index];
  202 + // if(!StringUtils.isEmpty(element.picPath) && element.id != feedbackImageItem.id){
  203 + // temp[tempIndex] = element;
  204 + // tempIndex = tempIndex+1
  205 + // }
  206 + // }
  207 + // if(tempIndex < 3){
  208 + // temp[tempIndex] = this.addPic
  209 + // }
  210 + // this.pics = temp
  211 + // })
  212 + // }
  213 + // .width(60)
  214 + // .height(60)
  215 + // }
  216 + // }
  217 + // })
218 } 218 }
219 .margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_12'),left: $r('app.float.vp_12')}) 219 .margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_12'),left: $r('app.float.vp_12')})
220 Text(){ 220 Text(){
@@ -5,6 +5,7 @@ import { @@ -5,6 +5,7 @@ import {
5 EmitterUtils, 5 EmitterUtils,
6 EmitterEventId, 6 EmitterEventId,
7 NetworkUtil, 7 NetworkUtil,
  8 + DisplayUtils
8 } from 'wdKit'; 9 } from 'wdKit';
9 import { 10 import {
10 Action, 11 Action,
@@ -65,6 +66,9 @@ export struct ImageAndTextPageComponent { @@ -65,6 +66,9 @@ export struct ImageAndTextPageComponent {
65 @State isScrollTop: boolean = true 66 @State isScrollTop: boolean = true
66 @State offsetY: number = 0 67 @State offsetY: number = 0
67 @State executedStartTime: number = new Date().getTime() 68 @State executedStartTime: number = new Date().getTime()
  69 + private screenHeight: number = 0
  70 + private topHeight: number = 32
  71 + private bottomHeight: number = 150
68 pageShowTime:number = 0; 72 pageShowTime:number = 0;
69 pageHideTime:number = 0; 73 pageHideTime:number = 0;
70 lastTimeoutId?: number 74 lastTimeoutId?: number
@@ -160,7 +164,7 @@ export struct ImageAndTextPageComponent { @@ -160,7 +164,7 @@ export struct ImageAndTextPageComponent {
160 164
161 .onAreaChange((oldValue: Area, newValue: Area) => { 165 .onAreaChange((oldValue: Area, newValue: Area) => {
162 this.info = newValue 166 this.info = newValue
163 - 167 + console.log(TAG, "总页面滑动偏移量", this.scroller.currentOffset().yOffset)
164 this.checkToScrollCommentArea() 168 this.checkToScrollCommentArea()
165 }) 169 })
166 // .onMeasureSize() 170 // .onMeasureSize()
@@ -206,7 +210,7 @@ export struct ImageAndTextPageComponent { @@ -206,7 +210,7 @@ export struct ImageAndTextPageComponent {
206 styleType: 1, 210 styleType: 1,
207 onCommentIconClick: () => { 211 onCommentIconClick: () => {
208 const info = componentUtils.getRectangleById('comment'); 212 const info = componentUtils.getRectangleById('comment');
209 - console.log(JSON.stringify(info)) 213 + console.log(TAG, "点击滑动页面", JSON.stringify(info))
210 214
211 if (!this.offsetY) { 215 if (!this.offsetY) {
212 this.offsetY = componentUtils.getRectangleById('comment').windowOffset.y 216 this.offsetY = componentUtils.getRectangleById('comment').windowOffset.y
@@ -229,7 +233,7 @@ export struct ImageAndTextPageComponent { @@ -229,7 +233,7 @@ export struct ImageAndTextPageComponent {
229 .position({y:'85%'}) 233 .position({y:'85%'})
230 .width(CommonConstants.FULL_WIDTH) 234 .width(CommonConstants.FULL_WIDTH)
231 .backgroundColor(Color.White) 235 .backgroundColor(Color.White)
232 - .height(150) 236 + .height(this.bottomHeight)
233 237
234 // 发布时间 238 // 发布时间
235 Column() { 239 Column() {
@@ -244,7 +248,7 @@ export struct ImageAndTextPageComponent { @@ -244,7 +248,7 @@ export struct ImageAndTextPageComponent {
244 } 248 }
245 } 249 }
246 .width(CommonConstants.FULL_WIDTH) 250 .width(CommonConstants.FULL_WIDTH)
247 - .height(32) 251 + .height(this.topHeight)
248 .padding({ left: 15, right: 15, }) 252 .padding({ left: 15, right: 15, })
249 .justifyContent(FlexAlign.SpaceBetween) 253 .justifyContent(FlexAlign.SpaceBetween)
250 .alignItems(VerticalAlign.Bottom) 254 .alignItems(VerticalAlign.Bottom)
@@ -444,6 +448,7 @@ export struct ImageAndTextPageComponent { @@ -444,6 +448,7 @@ export struct ImageAndTextPageComponent {
444 448
445 aboutToAppear() { 449 aboutToAppear() {
446 this.getDetail() 450 this.getDetail()
  451 + this.screenHeight = DisplayUtils.getDeviceHeight()
447 //注册通知,来自别的组件的评论成功通知 452 //注册通知,来自别的组件的评论成功通知
448 EmitterUtils.receiveEvent(EmitterEventId.COMMENT_PUBLISH, (targetId?: string) => { 453 EmitterUtils.receiveEvent(EmitterEventId.COMMENT_PUBLISH, (targetId?: string) => {
449 if (targetId) { 454 if (targetId) {
@@ -451,11 +456,22 @@ export struct ImageAndTextPageComponent { @@ -451,11 +456,22 @@ export struct ImageAndTextPageComponent {
451 // 滚动到评论列表 456 // 滚动到评论列表
452 if (this.info) { 457 if (this.info) {
453 // let height = DisplayUtils.getDeviceHeight() / 2 458 // let height = DisplayUtils.getDeviceHeight() / 2
454 - let offSetY = this.info?.globalPosition.y as number  
455 - Logger.debug(TAG, "滚动至yOffset: " + (offSetY - 100)) 459 + //评论区当前位置
  460 + let currentCommonentOffSetY = this.info?.globalPosition.y as number
  461 + //当前页面滚动的位置
  462 + let currentScrollOffSetY = this.scroller.currentOffset().yOffset
  463 + if (currentCommonentOffSetY > 0 && currentCommonentOffSetY < (this.screenHeight-this.bottomHeight)){
  464 + return
  465 + }
  466 + let offSetY = currentScrollOffSetY
  467 + if (currentCommonentOffSetY > (this.screenHeight-this.bottomHeight) ) {
  468 + offSetY = currentCommonentOffSetY-200
  469 + }else {
  470 + offSetY = currentScrollOffSetY + currentCommonentOffSetY-100
  471 + }
456 //头部距离48 472 //头部距离48
457 this.scroller.scrollTo({ 473 this.scroller.scrollTo({
458 - yOffset: offSetY - 100, 474 + yOffset: offSetY,
459 xOffset: 0, 475 xOffset: 0,
460 animation: { duration: 1000, curve: Curve.Ease } 476 animation: { duration: 1000, curve: Curve.Ease }
461 }) 477 })
@@ -2,6 +2,7 @@ import { CompDTO, ContentDTO } from 'wdBean' @@ -2,6 +2,7 @@ import { CompDTO, ContentDTO } from 'wdBean'
2 import { CommonConstants, CompStyle } from 'wdConstant/Index'; 2 import { CommonConstants, CompStyle } from 'wdConstant/Index';
3 import { DateTimeUtils, Logger } from 'wdKit/Index'; 3 import { DateTimeUtils, Logger } from 'wdKit/Index';
4 import router from '@ohos.router' 4 import router from '@ohos.router'
  5 +import { SearchShowRed, textItem, titleInitRes } from '../../utils/searchShowRed';
5 6
6 @Reusable 7 @Reusable
7 @Component 8 @Component
@@ -16,8 +17,21 @@ export struct CardSourceInfo { @@ -16,8 +17,21 @@ export struct CardSourceInfo {
16 @State private isEllipsisActive: boolean = false; 17 @State private isEllipsisActive: boolean = false;
17 @State private displayText: string = ''; 18 @State private displayText: string = '';
18 19
  20 + @State authorMarked: boolean = false;
  21 + @State authorArr: textItem[] = []
  22 +
19 aboutToAppear(): void { 23 aboutToAppear(): void {
20 this.processText(); 24 this.processText();
  25 +
  26 + this.titleInit();
  27 + }
  28 +
  29 + titleInit() {
  30 + if (this.contentDTO?.author&&this.contentDTO?.author.length > 0) {
  31 + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.author);
  32 + this.authorMarked = titleInitRes.titleMarked;
  33 + this.authorArr = titleInitRes.textArr;
  34 + }
21 } 35 }
22 36
23 private isLimited(): boolean { 37 private isLimited(): boolean {
@@ -121,6 +135,7 @@ export struct CardSourceInfo { @@ -121,6 +135,7 @@ export struct CardSourceInfo {
121 } 135 }
122 136
123 build() { 137 build() {
  138 + Column(){
124 Flex({ justifyContent: FlexAlign.Start, direction: FlexDirection.Row }) { 139 Flex({ justifyContent: FlexAlign.Start, direction: FlexDirection.Row }) {
125 // 标签 140 // 标签
126 if (this.contentDTO.cornerMark || this.contentDTO.corner) { 141 if (this.contentDTO.cornerMark || this.contentDTO.corner) {
@@ -192,7 +207,32 @@ export struct CardSourceInfo { @@ -192,7 +207,32 @@ export struct CardSourceInfo {
192 207
193 } 208 }
194 .width(CommonConstants.FULL_WIDTH) 209 .width(CommonConstants.FULL_WIDTH)
  210 +
  211 + if (this.contentDTO?.author&&this.contentDTO?.author.length > 0){
  212 + Text() {
  213 + if (this.authorMarked) {
  214 + ForEach(this.authorArr, (textItem: textItem) => {
  215 + if (textItem.isRed) {
  216 + Span(textItem.content)
  217 + .fontColor(0xED2800)
  218 + } else {
  219 + Span(textItem.content)
  220 + }
  221 + })
  222 + } else {
  223 + Span(this.contentDTO.newsTitle)
  224 + }
  225 + }
  226 + .fontSize($r('app.float.font_size_11'))
  227 + .fontColor($r("app.color.color_B0B0B0"))
  228 + .align(Alignment.Start)
  229 + .width('100%')
  230 + .margin({top:5})
  231 + }
  232 + }
  233 + .width(CommonConstants.FULL_WIDTH)
195 .margin({ top: this.viewShowData ? 8 : 0 }) 234 .margin({ top: this.viewShowData ? 8 : 0 })
  235 +
196 } 236 }
197 237
198 /** 238 /**
@@ -145,30 +145,30 @@ struct EditUserInfoPage { @@ -145,30 +145,30 @@ struct EditUserInfoPage {
145 .height(84) 145 .height(84)
146 .borderRadius(42) 146 .borderRadius(42)
147 147
148 - if (this.headerImg.length === 0){  
149 - Image('')  
150 - .width('84')  
151 - .height('84')  
152 - .backgroundColor(Color.Gray)  
153 - .opacity(0.7)  
154 - .borderRadius(5)  
155 - .borderRadius(42)  
156 -  
157 - Image($r('app.media.seletct_photo'))  
158 - .width('30')  
159 - .height('30')  
160 - } 148 + // if (this.headerImg.length === 0){
  149 + // Image('')
  150 + // .width('84')
  151 + // .height('84')
  152 + // .backgroundColor(Color.Gray)
  153 + // .opacity(0.7)
  154 + // .borderRadius(5)
  155 + // .borderRadius(42)
  156 + //
  157 + // Image($r('app.media.seletct_photo'))
  158 + // .width('30')
  159 + // .height('30')
  160 + // }
161 }.margin({top:20}) 161 }.margin({top:20})
162 .onClick(()=>{ 162 .onClick(()=>{
163 - this.photoDialogController.open() 163 + // this.photoDialogController.open()
164 }) 164 })
165 165
166 ///目前不支持头像上传,暂时屏蔽 166 ///目前不支持头像上传,暂时屏蔽
167 - Button('点击更换头像')  
168 - .fontColor(Color.Gray)  
169 - .fontSize(15)  
170 - .backgroundColor(Color.White)  
171 - .margin({top:10,bottom:20}) 167 + // Button('点击更换头像')
  168 + // .fontColor(Color.Gray)
  169 + // .fontSize(15)
  170 + // .backgroundColor(Color.White)
  171 + // .margin({top:10,bottom:20})
172 172
173 List({}){ 173 List({}){
174 ForEach(this.listData,(item:EditListInfo,index:number) =>{ 174 ForEach(this.listData,(item:EditListInfo,index:number) =>{
@@ -547,6 +547,7 @@ export struct SearchResultContentComponent { @@ -547,6 +547,7 @@ export struct SearchResultContentComponent {
547 contentDTO.rmhInfo = rmhInfo 547 contentDTO.rmhInfo = rmhInfo
548 contentDTO.shareFlag = value.data.shareFlag 548 contentDTO.shareFlag = value.data.shareFlag
549 contentDTO.contentText = value.data.contentText 549 contentDTO.contentText = value.data.contentText
  550 + contentDTO.author = value.data.author
550 return contentDTO; 551 return contentDTO;
551 } 552 }
552 553