王士厅
... ... @@ -142,6 +142,8 @@ export class ContentDTO implements BaseDTO {
// 是否国殇
isMourning?: boolean = false;
author: string = ""; ///撰稿人
static clone(old: ContentDTO): ContentDTO {
let content = new ContentDTO();
content.liveType = old.liveType;
... ...
... ... @@ -160,61 +160,61 @@ export struct FeedBackActivity {
columns:5,
}) {
ForEach(this.pics, (feedbackImageItem: PhotoListBean, index: number) => {
GridCol({
}) {
if(1 == feedbackImageItem.itemType){
Image($r('app.media.feekback_add'))
.width(60)
.height(60)
.onClick(async (event: ClickEvent) => {
if(await FastClickUtil.isMinDelayTime()){
return
}
this.callFilePickerSelectImage();
})
}else{
Stack({alignContent: Alignment.TopEnd}) {
Image(feedbackImageItem.picPath)
.width(60)
.height(60)
.borderRadius($r('app.float.margin_1'))
.onClick(async (event: ClickEvent) => {
if(await FastClickUtil.isMinDelayTime()){
return
}
//查看图片 fixme 去除添加按钮
ProcessUtils.gotoMultiPictureListPage(this.pics, index)
})
Image($r('app.media.icon_feekback_delete'))
.width(24)
.height(24)
.borderRadius($r('app.float.margin_1'))
.onClick(async (event: ClickEvent) => {
if(await FastClickUtil.isMinDelayTime()){
return
}
let temp: PhotoListBean[] = [] as PhotoListBean[]
temp.length = this.pics.length - 1;
let tempIndex = 0;
for (let index = 0; index < this.pics.length; index++) {
const element = this.pics[index];
if(!StringUtils.isEmpty(element.picPath) && element.id != feedbackImageItem.id){
temp[tempIndex] = element;
tempIndex = tempIndex+1
}
}
if(tempIndex < 3){
temp[tempIndex] = this.addPic
}
this.pics = temp
})
}
.width(60)
.height(60)
}
}
})
// ForEach(this.pics, (feedbackImageItem: PhotoListBean, index: number) => {
// GridCol({
// }) {
// if(1 == feedbackImageItem.itemType){
// Image($r('app.media.feekback_add'))
// .width(60)
// .height(60)
// .onClick(async (event: ClickEvent) => {
// if(await FastClickUtil.isMinDelayTime()){
// return
// }
// this.callFilePickerSelectImage();
// })
// }else{
// Stack({alignContent: Alignment.TopEnd}) {
// Image(feedbackImageItem.picPath)
// .width(60)
// .height(60)
// .borderRadius($r('app.float.margin_1'))
// .onClick(async (event: ClickEvent) => {
// if(await FastClickUtil.isMinDelayTime()){
// return
// }
// //查看图片 fixme 去除添加按钮
// ProcessUtils.gotoMultiPictureListPage(this.pics, index)
// })
// Image($r('app.media.icon_feekback_delete'))
// .width(24)
// .height(24)
// .borderRadius($r('app.float.margin_1'))
// .onClick(async (event: ClickEvent) => {
// if(await FastClickUtil.isMinDelayTime()){
// return
// }
// let temp: PhotoListBean[] = [] as PhotoListBean[]
// temp.length = this.pics.length - 1;
// let tempIndex = 0;
// for (let index = 0; index < this.pics.length; index++) {
// const element = this.pics[index];
// if(!StringUtils.isEmpty(element.picPath) && element.id != feedbackImageItem.id){
// temp[tempIndex] = element;
// tempIndex = tempIndex+1
// }
// }
// if(tempIndex < 3){
// temp[tempIndex] = this.addPic
// }
// this.pics = temp
// })
// }
// .width(60)
// .height(60)
// }
// }
// })
}
.margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_12'),left: $r('app.float.vp_12')})
Text(){
... ...
... ... @@ -5,6 +5,7 @@ import {
EmitterUtils,
EmitterEventId,
NetworkUtil,
DisplayUtils
} from 'wdKit';
import {
Action,
... ... @@ -65,6 +66,9 @@ export struct ImageAndTextPageComponent {
@State isScrollTop: boolean = true
@State offsetY: number = 0
@State executedStartTime: number = new Date().getTime()
private screenHeight: number = 0
private topHeight: number = 32
private bottomHeight: number = 150
pageShowTime:number = 0;
pageHideTime:number = 0;
lastTimeoutId?: number
... ... @@ -160,7 +164,7 @@ export struct ImageAndTextPageComponent {
.onAreaChange((oldValue: Area, newValue: Area) => {
this.info = newValue
console.log(TAG, "总页面滑动偏移量", this.scroller.currentOffset().yOffset)
this.checkToScrollCommentArea()
})
// .onMeasureSize()
... ... @@ -206,7 +210,7 @@ export struct ImageAndTextPageComponent {
styleType: 1,
onCommentIconClick: () => {
const info = componentUtils.getRectangleById('comment');
console.log(JSON.stringify(info))
console.log(TAG, "点击滑动页面", JSON.stringify(info))
if (!this.offsetY) {
this.offsetY = componentUtils.getRectangleById('comment').windowOffset.y
... ... @@ -229,7 +233,7 @@ export struct ImageAndTextPageComponent {
.position({y:'85%'})
.width(CommonConstants.FULL_WIDTH)
.backgroundColor(Color.White)
.height(150)
.height(this.bottomHeight)
// 发布时间
Column() {
... ... @@ -244,7 +248,7 @@ export struct ImageAndTextPageComponent {
}
}
.width(CommonConstants.FULL_WIDTH)
.height(32)
.height(this.topHeight)
.padding({ left: 15, right: 15, })
.justifyContent(FlexAlign.SpaceBetween)
.alignItems(VerticalAlign.Bottom)
... ... @@ -444,6 +448,7 @@ export struct ImageAndTextPageComponent {
aboutToAppear() {
this.getDetail()
this.screenHeight = DisplayUtils.getDeviceHeight()
//注册通知,来自别的组件的评论成功通知
EmitterUtils.receiveEvent(EmitterEventId.COMMENT_PUBLISH, (targetId?: string) => {
if (targetId) {
... ... @@ -451,11 +456,22 @@ export struct ImageAndTextPageComponent {
// 滚动到评论列表
if (this.info) {
// let height = DisplayUtils.getDeviceHeight() / 2
let offSetY = this.info?.globalPosition.y as number
Logger.debug(TAG, "滚动至yOffset: " + (offSetY - 100))
//评论区当前位置
let currentCommonentOffSetY = this.info?.globalPosition.y as number
//当前页面滚动的位置
let currentScrollOffSetY = this.scroller.currentOffset().yOffset
if (currentCommonentOffSetY > 0 && currentCommonentOffSetY < (this.screenHeight-this.bottomHeight)){
return
}
let offSetY = currentScrollOffSetY
if (currentCommonentOffSetY > (this.screenHeight-this.bottomHeight) ) {
offSetY = currentCommonentOffSetY-200
}else {
offSetY = currentScrollOffSetY + currentCommonentOffSetY-100
}
//头部距离48
this.scroller.scrollTo({
yOffset: offSetY - 100,
yOffset: offSetY,
xOffset: 0,
animation: { duration: 1000, curve: Curve.Ease }
})
... ...
... ... @@ -2,6 +2,7 @@ import { CompDTO, ContentDTO } from 'wdBean'
import { CommonConstants, CompStyle } from 'wdConstant/Index';
import { DateTimeUtils, Logger } from 'wdKit/Index';
import router from '@ohos.router'
import { SearchShowRed, textItem, titleInitRes } from '../../utils/searchShowRed';
@Reusable
@Component
... ... @@ -16,8 +17,21 @@ export struct CardSourceInfo {
@State private isEllipsisActive: boolean = false;
@State private displayText: string = '';
@State authorMarked: boolean = false;
@State authorArr: textItem[] = []
aboutToAppear(): void {
this.processText();
this.titleInit();
}
titleInit() {
if (this.contentDTO?.author&&this.contentDTO?.author.length > 0) {
const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.author);
this.authorMarked = titleInitRes.titleMarked;
this.authorArr = titleInitRes.textArr;
}
}
private isLimited(): boolean {
... ... @@ -121,6 +135,7 @@ export struct CardSourceInfo {
}
build() {
Column(){
Flex({ justifyContent: FlexAlign.Start, direction: FlexDirection.Row }) {
// 标签
if (this.contentDTO.cornerMark || this.contentDTO.corner) {
... ... @@ -192,7 +207,32 @@ export struct CardSourceInfo {
}
.width(CommonConstants.FULL_WIDTH)
.margin({ top: this.viewShowData ? 8 : 0 })
if (this.contentDTO?.author&&this.contentDTO?.author.length > 0){
Text() {
if (this.authorMarked) {
ForEach(this.authorArr, (textItem: textItem) => {
if (textItem.isRed) {
Span(textItem.content)
.fontColor(0xED2800)
} else {
Span(textItem.content)
}
})
} else {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_11'))
.fontColor($r("app.color.color_B0B0B0"))
.align(Alignment.Start)
.width('100%')
.margin({top:5})
}
}
.width(CommonConstants.FULL_WIDTH)
.margin({ top: this.viewShowData ? 8 : 0 })
}
/**
... ...
... ... @@ -145,30 +145,30 @@ struct EditUserInfoPage {
.height(84)
.borderRadius(42)
if (this.headerImg.length === 0){
Image('')
.width('84')
.height('84')
.backgroundColor(Color.Gray)
.opacity(0.7)
.borderRadius(5)
.borderRadius(42)
Image($r('app.media.seletct_photo'))
.width('30')
.height('30')
}
// if (this.headerImg.length === 0){
// Image('')
// .width('84')
// .height('84')
// .backgroundColor(Color.Gray)
// .opacity(0.7)
// .borderRadius(5)
// .borderRadius(42)
//
// Image($r('app.media.seletct_photo'))
// .width('30')
// .height('30')
// }
}.margin({top:20})
.onClick(()=>{
this.photoDialogController.open()
// this.photoDialogController.open()
})
///目前不支持头像上传,暂时屏蔽
Button('点击更换头像')
.fontColor(Color.Gray)
.fontSize(15)
.backgroundColor(Color.White)
.margin({top:10,bottom:20})
// Button('点击更换头像')
// .fontColor(Color.Gray)
// .fontSize(15)
// .backgroundColor(Color.White)
// .margin({top:10,bottom:20})
List({}){
ForEach(this.listData,(item:EditListInfo,index:number) =>{
... ...
... ... @@ -547,6 +547,7 @@ export struct SearchResultContentComponent {
contentDTO.rmhInfo = rmhInfo
contentDTO.shareFlag = value.data.shareFlag
contentDTO.contentText = value.data.contentText
contentDTO.author = value.data.author
return contentDTO;
}
... ...