yumaochao
Showing 17 changed files with 367 additions and 302 deletions
... ... @@ -95,6 +95,7 @@ export class ContentDTO implements BaseDTO {
extra: string = ''
sameContentList:ContentDTO[] = []
sameContentListJson:string = ""
sameContentListSize:number = 0
/*
本地辅助字段
*/
... ...
... ... @@ -20,6 +20,8 @@ export struct CarderInteraction {
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult // 点赞、收藏状态
@State likeBean: Record<string, string> = {}
@State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以
async aboutToAppear() {
await this.getContentDetailData()
... ... @@ -32,6 +34,9 @@ export struct CarderInteraction {
this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
this.contentDTO.shareFlag = this.contentDTO.shareFlag?this.contentDTO.shareFlag:'1'
console.log('是否显示分享',this.contentDTO.shareFlag)
// 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
this.likesStyle = this.contentDetailData.likesStyle
this.openLikes = this.contentDetailData.openLikes == 1 ? true : false
}
build() {
... ... @@ -92,7 +97,7 @@ export struct CarderInteraction {
})
}
}
.width(42)
.visibility(this.likesStyle == 4 || !this.openLikes ? Visibility.None : Visibility.Visible)
}
/**
... ...
... ... @@ -78,9 +78,14 @@ export struct DynamicDetailComponent {
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State reachEndIncreament: number = 0
@State operationButtonList: string[] = []
@State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以
async aboutToAppear() {
await this.getContentDetailData()
// 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
this.likesStyle = this.contentDetailData.likesStyle
this.openLikes = this.contentDetailData.openLikes == 1 ? true : false
}
onPageHide() {
... ... @@ -537,6 +542,7 @@ export struct DynamicDetailComponent {
//内容点赞/取消点赞埋点
})
.visibility(this.likesStyle == 4 || !this.openLikes ? Visibility.None : Visibility.Visible)
// 评论
if (this.contentDetailData?.openComment) {
... ...
... ... @@ -68,6 +68,7 @@ export struct MorningEveningPaperComponent {
@State topSafeHeight: number = 0;
@State bottomSafeHeight: number = 0;
@State isHasTopView: boolean = false;
@State scrollOffset: number = 0
private audioDataList: AudioDataList[] = []
private playerController: WDPlayerController = new WDPlayerController();
... ... @@ -267,24 +268,22 @@ export struct MorningEveningPaperComponent {
compListItem: this.compListItem,
})
.margin({
top: this.pageInfoBean?.topicInfo?.frontLinkObject ? 10 : 44
top: this.isHasTopView ? 10 : 44+this.topSafeHeight
})
}
}
.height(`calc(100% - ${this.bottomSafeHeight + this.topSafeHeight + 'vp'})`).scrollBar(BarState.Off)
.onAreaChange((oldValue: Area, newValue: Area) => {
let persent = Math.abs(Number(newValue.globalPosition.y)) / 150
if (persent > 1) {
persent = 1
}
// .height(`calc(100% - ${this.bottomSafeHeight + this.topSafeHeight + 'vp'})`)
.scrollBar(BarState.Off)
.onWillScroll(scrollOffset =>{
this.scrollOffset = this.scrollOffset + scrollOffset as number
})
PaperTitleComponent().margin({top:this.isHasTopView?this.topSafeHeight:0}).backgroundColor(this.mixedBgColor).opacity(this.isHasTopView?0:1)
this.topPaperTitle()
}
.width('100%')
.height('100%')
.padding({
top: this.isHasTopView?0:this.topSafeHeight,
top: 0,
// bottom: this.bottomSafeHeight
})
// .backgroundColor(Color.Black)
... ... @@ -293,6 +292,13 @@ export struct MorningEveningPaperComponent {
}
@Builder
topPaperTitle(){
Column(){
PaperTitleComponent().margin({top:this.topSafeHeight})
}.height(44+this.topSafeHeight).backgroundColor(this.scrollOffset > 100?this.mixedBgColor:'')
}
@Builder
AudioBarView(dialog: CustomDialogController) {
Row() {
Stack({ alignContent: Alignment.Start }) {
... ...
... ... @@ -200,13 +200,13 @@ struct createImg {
}
} else {
GridCol({
span: { xs: 8 }
span: item.landscape === 1 ? 12 : 8
}) {
Image(this.loadImg ? item.fullUrl : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.borderRadius(this.caclImageRadius(index))
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
.opacity(!this.picWidth && !this.picHeight ? 0 : 1)
.onComplete(callback => {
this.picWidth = callback?.width || 0;
... ...
/**
* More_Comp
*/
import { ContentDTO } from 'wdBean/Index';
import { ContentDTO , contentListParams, FullColumnImgUrlDTO,
} from 'wdBean/Index';
import MinePageDatasModel from '../../model/MinePageDatasModel';
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel';
import { SearchDescription } from '../../viewmodel/SearchResultContentItem';
const TAG: string = 'More_Comp';
... ... @@ -10,17 +14,89 @@ const TAG: string = 'More_Comp';
export struct MoreComponent {
@State contentDTO: ContentDTO = new ContentDTO();
aboutToAppear(): void {
this.dealSearchSameList()
}
build() {
Row() {
Text('点击展开更多相似')
.fontSize(16)
Text(`(${this.contentDTO.sameContentListSize})`)
.fontSize(16)
Image($r('app.media.comment_unfold'))
.width(16)
.height(16)
}
.justifyContent(FlexAlign.Center)
.width('100%')
.height(48)
.backgroundColor(0xffffff)
}
}
\ No newline at end of file
dealSearchSameList() {
let resultData : SearchDescription[] = JSON.parse(this.contentDTO.sameContentListJson) as SearchDescription[]
let data: contentListParams = {
contentList: []
}
resultData.forEach((item) => {
data.contentList.push({
contentId: item.id + '',
contentType: Number.parseInt(item.type)
})
})
SearcherAboutDataModel.getInteractListData(data, getContext(this)).then((newValue) => {
newValue.forEach((item) => {
resultData.forEach((data) => {
if (item.contentId == data.id) {
data.collectNum = item.collectNum + ""
data.commentNum = item.commentNum + ""
data.likeNum = item.likeNum + ""
data.readNum = item.readNum + ""
data.shareNum = item.shareNum + ""
}
})
})
// 批量号主信息
let creatorIdList: string[] = []
resultData.forEach((value:SearchDescription) => {
creatorIdList.push(value.creatorId)
})
SearcherAboutDataModel.getCreatorDetailListData({creatorIdList:creatorIdList}).then((rem) => {
resultData.forEach((value: SearchDescription) => {
const landscape = value.landscape
let photos: FullColumnImgUrlDTO[] = []
value.appStyleImages.split("&&").forEach((value) => {
let resizeParams = MinePageDatasModel.extractResizeParams(value)
if(resizeParams && resizeParams.length === 2){
photos.push(
{
fullUrl: value,
weight:resizeParams[0],
height:resizeParams[1],
landscape: Number(landscape),
} as FullColumnImgUrlDTO
)
}
})
let contentDTO = MinePageDatasModel.dataTransform(rem,value, photos);
if(value.type != "13"){
this.contentDTO.sameContentList.push(contentDTO)
console.log("ycg","123")
}
})
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
})
}).catch((err: Error) => {
console.log(TAG, "请求失败")
})
}
}
... ...
... ... @@ -37,21 +37,21 @@ export struct QualityCommentsComponent {
aboutToDisappear(): void {
// windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' })
this.dialogController = null // 将dialogController置空
WindowModel.shared.setWindowLayoutFullScreen(false)
// WindowModel.shared.setWindowLayoutFullScreen(false)
}
onPageShow(): void {
WindowModel.shared.setWindowLayoutFullScreen(true)
// WindowModel.shared.setWindowLayoutFullScreen(true)
}
onPageHide(): void {
WindowModel.shared.setWindowLayoutFullScreen(false)
// WindowModel.shared.setWindowLayoutFullScreen(false)
}
aboutToAppear(): void {
this.getData();
this.showAlert()
WindowModel.shared.setWindowLayoutFullScreen(true)
// WindowModel.shared.setWindowLayoutFullScreen(true)
}
showAlert() {
... ... @@ -106,6 +106,7 @@ export struct QualityCommentsComponent {
Image($r('app.media.comment_img_banner')).width('100%')
.height(283)
// .aspectRatio(375 / 283);
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
}
.onAreaChange((oldValue: Area, newValue: Area) => {
if (Number(oldValue.globalPosition.y) == 0 && Number(newValue.globalPosition.y) > 30) {
... ... @@ -156,13 +157,15 @@ export struct QualityCommentsComponent {
/*导航栏*/
@Builder
TabbarNormal() {
Column() {
Stack({ alignContent: Alignment.Top }) {
Row() {
}
.width('100%')
.height(px2vp(this.topSafeHeight))
.backgroundColor($r('app.color.white'))
.opacity(this.tileOpacity)
.visibility(this.tileOpacity > 0 ? 0 : 1)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
Stack({ alignContent: Alignment.Start }) {
Row() {
... ... @@ -218,6 +221,7 @@ export struct QualityCommentsComponent {
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.clip(false)
// this.TabbarTransparent()
this.TabbarNormal()
}
... ... @@ -253,7 +257,7 @@ export struct QualityCommentsComponent {
this.currentPage++
this.getData()
})
.margin({ top: 196 })
.margin({ top: 196 - px2vp(this.topSafeHeight) })
.height("100%")
.width("100%")
.edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
... ...
... ... @@ -438,7 +438,7 @@ export struct PaperSingleColumn999CardView {
Stack({ alignContent: Alignment.BottomEnd }) {
Image(this.item?.coverUrl)
.borderRadius(5)
.aspectRatio(16 / 9)
.aspectRatio(319 / 179) ///图片设计比例
.padding({ top: 10 })
if (this.item?.videoInfo) {
Row() {
... ...
... ... @@ -5,11 +5,11 @@ import { QualityCommentsComponent } from '../comment/view/QualityCommentsCompone
@Component
struct QualityCommentsPage {
onPageShow(): void {
WindowModel.shared.setWindowLayoutFullScreen(true)
// WindowModel.shared.setWindowLayoutFullScreen(true)
}
onPageHide(): void {
WindowModel.shared.setWindowLayoutFullScreen(false)
// WindowModel.shared.setWindowLayoutFullScreen(false)
}
build() {
... ...
... ... @@ -9,6 +9,7 @@ import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils
import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent';
import { channelSkeleton } from '../skeleton/channelSkeleton';
import { TrackConstants, TrackingButton } from 'wdTracking/Index';
import DailyPaperTopicModel from '../../model/DailyPaperTopicModel'
const TAG = 'TopNavigationComponent';
... ... @@ -170,13 +171,7 @@ export struct TopNavigationComponentNew {
.height(30)
.width(124)
.onClick(() => {
if (NetworkUtil.isNetConnected()) {
ProcessUtils.gotoMorningEveningPaper()
TrackingButton.click('morning_evening_news_click', TrackConstants.SummaryType.MorningAndEveningNews,
TrackConstants.SummaryType.MorningAndEveningNews)
} else {
ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000)
}
this.clickMorningEveningPaper()
})
}.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
... ... @@ -621,4 +616,21 @@ export struct TopNavigationComponentNew {
this.indicatorWidth = width
})
}
clickMorningEveningPaper(){
if (NetworkUtil.isNetConnected()) {
DailyPaperTopicModel.getDailyPaperTopic().then(dailyPaperTopicBean =>{
if (dailyPaperTopicBean && dailyPaperTopicBean.id > 0) {
SPHelper.default.saveSync('dailyPaperTopicPageId', dailyPaperTopicBean.id);
ProcessUtils.gotoMorningEveningPaper()
TrackingButton.click('morning_evening_news_click',TrackConstants.SummaryType.MorningAndEveningNews,TrackConstants.SummaryType.MorningAndEveningNews)
}else {
ToastUtils.showToast('暂无早晚报信息', 1000)
}
}).catch()
} else {
ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000)
}
}
}
\ No newline at end of file
... ...
... ... @@ -7,7 +7,6 @@
import { SPHelper } from 'wdKit/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter'
import { TrackingButton, TrackConstants } from 'wdTracking/Index'
import DailyPaperTopicModel from '../../model/DailyPaperTopicModel'
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
const TAG = "FirstTabTopSearchComponent"
... ... @@ -19,10 +18,6 @@ export struct FirstTabTopSearchComponent {
async aboutToAppear() {
this.getSearchHint()
let dailyPaperTopicBean = await DailyPaperTopicModel.getDailyPaperTopic()
if (dailyPaperTopicBean) {
SPHelper.default.saveSync('dailyPaperTopicPageId', dailyPaperTopicBean.id);
}
}
getSearchHint() {
... ...
... ... @@ -188,39 +188,37 @@ export struct SearchResultContentComponent {
resultData.list.forEach((value:SearchResultContentItem) => {
creatorIdList.push(value.data.creatorId)
})
let isRemain : boolean = false
SearcherAboutDataModel.getCreatorDetailListData({creatorIdList:creatorIdList}).then((rem) => {
resultData.list.forEach((value: SearchResultContentItem) => {
const landscape = value.data.landscape
let photos: FullColumnImgUrlDTO[] = []
// if (value.data.appStyle === 4) {
value.data.appStyleImages.split("&&").forEach((value) => {
const resizeParams = this.extractResizeParams(value)
photos.push(
{
fullUrl: value,
weight:resizeParams.width,
height:resizeParams.height,
landscape: Number(landscape),
} as FullColumnImgUrlDTO
)
let resizeParams = MinePageDatasModel.extractResizeParams(value)
if(resizeParams && resizeParams.length === 2){
photos.push(
{
fullUrl: value,
weight:resizeParams[0],
height:resizeParams[1],
landscape: Number(landscape),
} as FullColumnImgUrlDTO
)
}
})
// }
let contentDTO = this.dataTransform(rem,value, photos);
if(value.data.type != "13"){
this.tempList.push(contentDTO)
this.data.push(contentDTO)
if(value.data.sameContentList != null && value.data.sameContentList.length > 0) {
let contentDTO2 = new ContentDTO();
contentDTO2.sameContentListJson = JSON.stringify(value.data.sameContentList)
isRemain = true
this.tempList.push(contentDTO2)
contentDTO2.sameContentListSize = value.data.sameContentList.length
this.data.push(contentDTO2)
}
}
})
if(!isRemain){
this.tempList.forEach((value) => {
this.data.push(value)
})
this.tempList = []
this.data.notifyDataReload()
this.count = this.data.totalCount()
... ... @@ -230,9 +228,6 @@ export struct SearchResultContentComponent {
this.hasMore = false
}
this.isLoading = false
}else{
this.dealSameContent(resultData.totalCount)
}
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
})
... ... @@ -243,65 +238,6 @@ export struct SearchResultContentComponent {
})
}
async dealSameContent(count:number){
this.tempList.forEach(async (tempValue) => {
if(StringUtils.isNotEmpty(tempValue.sameContentListJson)){
let data: contentListParams = {
contentList: []
}
let resultData : SearchDescription[] = JSON.parse(tempValue.sameContentListJson) as SearchDescription[]
if(resultData!=null){
resultData.forEach((item) => {
data.contentList.push({
contentId: item.id + '',
contentType: Number.parseInt(item.type)
})
})
let newValue = await SearcherAboutDataModel.getInteractListData(data, getContext(this))
newValue.forEach((item) => {
resultData.forEach((data) => {
if (item.contentId == data.id) {
data.collectNum = item.collectNum + ""
data.commentNum = item.commentNum + ""
data.likeNum = item.likeNum + ""
data.readNum = item.readNum + ""
data.shareNum = item.shareNum + ""
}
})
})
let creatorIdList: string[] = []
resultData.forEach((value:SearchDescription) => {
creatorIdList.push(value.creatorId)
})
let rem = await SearcherAboutDataModel.getCreatorDetailListData({creatorIdList:creatorIdList})
resultData.forEach((value) => {
let photos: FullColumnImgUrlDTO[] = []
value.appStyleImages.split("&&").forEach((value) => {
const resizeParams = this.extractResizeParams(value)
photos.push({ fullUrl: value,weight:resizeParams.width,height:resizeParams.height, } as FullColumnImgUrlDTO)
})
let contentDTO = this.dataTransform2(rem,value, photos);
tempValue.sameContentList.push(contentDTO)
})
}
}
})
this.tempList.forEach((value) => {
this.data.push(value)
})
this.tempList = []
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.count < count) {
this.curPageNum++
} else {
this.hasMore = false
}
this.isLoading = false
}
build() {
Column() {
if (this.count == 0) {
... ... @@ -326,7 +262,7 @@ export struct SearchResultContentComponent {
Column() {
if (this.searchType == "activity") {
ActivityItemComponent({ contentDTO: item })
}else if(item.sameContentList != null && item.sameContentList.length > 0){
}else if(item.sameContentListSize > 0){
MoreComponent({ contentDTO: item })
} else {
CardParser({compDTO:new CompDTO, contentDTO: item })
... ... @@ -553,92 +489,6 @@ export struct SearchResultContentComponent {
return contentDTO;
}
private dataTransform2(rem:CreatorDetailResponseItem[],value: SearchDescription, photos: FullColumnImgUrlDTO[]): ContentDTO {
let rmhInfo = this.getRmhInfo2(rem,value)
console.log('获取photos',JSON.stringify(photos))
console.log('获取value2',JSON.stringify(value))
let contentDTO = new ContentDTO();
contentDTO.appStyle = value.appStyle + ""
contentDTO.cityCode = value.cityCode
contentDTO.coverSize = ""
contentDTO.coverType = value.type == "5" ? 1 : -1
contentDTO.coverUrl =
this.searchType == "activity" ? value.zhChannelPageImg : value.appStyleImages.split("&&")[0];
contentDTO.description = value.description
contentDTO.districtCode = value.districtCode
contentDTO.endTime = value.endTime
contentDTO.hImageUrl = ""
contentDTO.heatValue = ""
contentDTO.innerUrl = ""
contentDTO.landscape = Number.parseInt(value.landscape)
contentDTO.linkUrl = value.linkUrl
contentDTO.openLikes = Number.parseInt(value.openLikes)
contentDTO.openUrl = ""
contentDTO.pageId = value.pageId
contentDTO.programAuth = ""
contentDTO.programId = ""
contentDTO.programName = ""
contentDTO.programSource = -1
contentDTO.programType = Number.parseInt(value.status)
contentDTO.provinceCode = value.provinceCode
contentDTO.showTitleEd = value.showTitleEd
contentDTO.showTitleIng = value.showTitleIng
contentDTO.showTitleNo = value.showTitleNo
contentDTO.startTime = value.startTime
contentDTO.subType = ""
contentDTO.subtitle = ""
contentDTO.title = value.title
contentDTO.vImageUrl = ""
contentDTO.screenType = ""
contentDTO.source = StringUtils.isEmpty(value.creatorName) ? value.sourceName : value.creatorName
contentDTO.objectId = value.id
contentDTO.objectType = value.type
contentDTO.channelId = value.channelId
contentDTO.relId = value.relId
contentDTO.relType = value.relType
contentDTO.newsTitle = value.titleLiteral;
contentDTO.publishTime =
StringUtils.isNotEmpty(value.firstPublishTime) ? value.firstPublishTime : value.publishTime
contentDTO.visitorComment = -1
contentDTO.fullColumnImgUrls = photos
contentDTO.newsSummary = ""
contentDTO.hasMore = -1
contentDTO.slideShows = []
contentDTO.voiceInfo = {} as VoiceInfoDTO
contentDTO.tagWord = -1
contentDTO.isSelect = true
contentDTO.rmhInfo = {} as RmhInfoDTO
contentDTO.photoNum = -1
contentDTO.liveInfo = {} as LiveInfoDTO;
contentDTO.videoInfo = {
videoDuration: Number.parseInt(value.duration)
} as VideoInfoDTO;
let interact = new InteractDataDTO()
interact.collectNum = value.collectNum
interact.commentNum = value.commentNum
interact.contentId = value.id
interact.contentType = Number.parseInt(value.type)
interact.likeNum = value.likeNum
interact.readNum = Number.parseInt(value.readNum)
interact.shareNum = Number.parseInt(value.shareNum)
contentDTO.interactData = interact
contentDTO.corner = ''
contentDTO.rmhPlatform = 0
contentDTO.newTags = ''
contentDTO.isSearch = true
contentDTO.publishTimestamp = ""
contentDTO.bottomNavId = '';
contentDTO.openType = '';
contentDTO.extra = '';
contentDTO.titleShow = value.type == "5" ? 1 : 0;
contentDTO.rmhInfo = rmhInfo
contentDTO.shareFlag = value.shareFlag
contentDTO.contentText = value.contentText
return contentDTO;
}
// 搜索数据转化rmhInfo
private getRmhInfo(rem:CreatorDetailResponseItem[],value:SearchResultContentItem){
let obj = value.data
... ... @@ -695,88 +545,4 @@ export struct SearchResultContentComponent {
return rmhInfo
}
// 搜索数据转化rmhInfo
private getRmhInfo2(rem:CreatorDetailResponseItem[],value:SearchDescription){
let obj = value
let rmhInfo:RmhInfoDTO = {
rmhHeadUrl:obj.headerPhotoUrl,
rmhName:obj.creatorName,
rmhId:obj.creatorId,
authIcon:obj.authIcon,
authTitle: obj.authTitle,
authTitle2: '',
banControl: 0,
cnIsAttention: 0,
cnAttention: 0,
cnlsComment: 0,
cnlsLike: 0,
cnMainControl: 0,
cnShareControl: 0,
cnIsComment: 0,
cnIsLike:0,
posterShareControl: 0,
rmhDesc: obj.introduction,
userId: obj.userId,
userType: obj.userType,
honoraryIcon:''
}
if(rem.length>0){
rem.forEach(item=>{
if(item.creatorId === obj.creatorId){
rmhInfo = {
rmhHeadUrl:item.headPhotoUrl,
rmhName:item.userName,
rmhId:item.creatorId,
authIcon:item.authIcon,
authTitle: item.authTitle,
authTitle2: '',
banControl: 0,
cnIsAttention:item.isAttention,
cnAttention: 0,
cnlsComment: 0,
cnlsLike: 0,
cnMainControl: 0,
cnShareControl: 0,
cnIsComment: 0,
cnIsLike:0,
posterShareControl: 0,
rmhDesc: item.introduction,
userId: item.userId,
userType: item.userType,
honoraryIcon:''
}
}
})
}
return rmhInfo
}
private extractResizeParams(url: string) {
const heightRegex = /h_(\d+)/; // 匹配高度参数,如h_450
const widthRegex = /w_(\d+)/; // 匹配宽度参数,如w_800
const heightMatch = url.match(heightRegex);
const widthMatch = url.match(widthRegex);
let height = heightMatch ? `h_${heightMatch[1]}` : undefined
let width = widthMatch ? `w_${widthMatch[1]}` : undefined
let h:number =0
let w:number =0
if(height){
h = Number(height.split('_')[1])
}
if(width){
w = Number(width.split('_')[1])
}
interface Obj{
width:number;
height:number
}
let obj:Obj = {
width:w,
height:h
}
return obj
}
}
\ No newline at end of file
... ...
... ... @@ -25,6 +25,7 @@ export struct LikeComponent {
@Prop pageComponentType: number
@State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@State likeStatus: boolean = false
@State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以
viewModel: LikeViewModel = new LikeViewModel()
@Prop @Watch('onDataUpdated') data: Record<string, string>
enableBtn = true
... ... @@ -41,17 +42,23 @@ export struct LikeComponent {
// this.data['title'] = '开创两校交流先河!克罗地亚教育代表团访问同济大学'
// this.data['userHeaderUrl'] = ""
// this.data['channelId'] = "2059" //必须
// this.data['status'] = "1"
// this.data['status'] = "1"
// 内容用 是否开启点赞 1是 0否;
// this.contentDetailData.openLikes == 1
aboutToAppear() {
// 2:竖屏直播页 3:图集 4:横屏直播页
if(this.pageComponentType == 2 || this.pageComponentType == 4) {
// 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福
this.likesStyle = this.contentDetailData?.liveInfo?.likesStyle
this.openLikes = this.contentDetailData?.liveInfo?.likeEnable == 1 ? true : false
} else {
// 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
this.likesStyle = this.contentDetailData.likesStyle
this.openLikes = this.contentDetailData.openLikes == 1 ? true : false
}
console.log(TAG, 'this.contentDetailData', JSON.stringify(this.contentDetailData))
console.log(TAG, 'this.likesStyle', this.likesStyle)
console.log(TAG, 'this.openLikes', this.openLikes)
this.onDataUpdated()
this.contentTrackingDict()
}
... ... @@ -176,7 +183,7 @@ export struct LikeComponent {
}
.width(154)
.height(40)
.visibility(this.likesStyle == 4 || this.likesStyle == 'empty' ? Visibility.None : Visibility.Visible)
.visibility(this.likesStyle == 4 || this.likesStyle == 'empty' || !this.openLikes ? Visibility.None : Visibility.Visible)
}
@Builder
... ... @@ -194,7 +201,7 @@ export struct LikeComponent {
.onClick(() => {
this.clickButtonEvent()
})
.visibility(this.likesStyle == 4 || this.likesStyle == 'empty' ? Visibility.None : Visibility.Visible)
.visibility(this.likesStyle == 4 || this.likesStyle == 'empty' || !this.openLikes ? Visibility.None : Visibility.Visible)
}
@Builder
... ... @@ -211,7 +218,7 @@ export struct LikeComponent {
}
.width(24)
.height(24)
.visibility(this.likesStyle == 4 || this.likesStyle == 'empty' ? Visibility.None : Visibility.Visible)
.visibility(this.likesStyle == 4 || this.likesStyle == 'empty' || !this.openLikes ? Visibility.None : Visibility.Visible)
}
@Builder
... ... @@ -286,7 +293,7 @@ export struct LikeComponent {
}.width(24).height(24).onClick(() => {
this.clickButtonEvent()
})
.visibility(this.likesStyle == 4 || this.likesStyle == 'empty' ? Visibility.None : Visibility.Visible)
.visibility(this.likesStyle == 4 || this.likesStyle == 'empty' || !this.openLikes ? Visibility.None : Visibility.Visible)
}
@Builder
... ... @@ -323,7 +330,7 @@ export struct LikeComponent {
}
.width(36)
.height(42)
.visibility(this.likesStyle == 4 || this.likesStyle == 'empty' ? Visibility.None : Visibility.Visible)
.visibility(this.likesStyle == 4 || this.likesStyle == 'empty' || !this.openLikes ? Visibility.None : Visibility.Visible)
}
... ...
... ... @@ -75,7 +75,6 @@ export struct OperRowListView {
*/
@Prop pageComponentType?: number = -1
@Prop showBackIcon?: boolean = true
@State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@Prop operationButtonList?: string[] = ['comment', 'collect', 'share'] // 组件展示条件
@State needLike: boolean = true
@ObjectLink publishCommentModel: publishCommentModel
... ... @@ -94,6 +93,8 @@ export struct OperRowListView {
@State dialogController: CustomDialogController | null = null;
pageParam: ParamType = {}
PageName: string = ''
@State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以
async aboutToAppear() {
console.info(TAG, 'this.needLike', this.needLike)
... ... @@ -113,6 +114,17 @@ export struct OperRowListView {
}
})
this.contentTrackingDict()
// 2:竖屏直播页 3:图集 4:横屏直播页
if(this.pageComponentType == 2 || this.pageComponentType == 4) {
// 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福
this.likesStyle = this.contentDetailData?.liveInfo?.likesStyle
this.openLikes = this.contentDetailData?.liveInfo?.likeEnable == 1 ? true : false
} else {
// 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
this.likesStyle = this.contentDetailData.likesStyle
this.openLikes = this.contentDetailData.openLikes == 1 ? true : false
}
}
contentTrackingDict(){
... ... @@ -170,6 +182,7 @@ export struct OperRowListView {
}
console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData))
console.info(TAG, 'likeBean----', JSON.stringify(this.likeBean))
console.info(TAG, 'this.operationButtonList', JSON.stringify(this.operationButtonList))
// 评论需要数据
/* this.publishCommentModel.targetId = this.contentDetailData.newsId + ''
this.publishCommentModel.targetRelId = this.contentDetailData.reLInfo?.relId + ''
... ... @@ -305,19 +318,16 @@ export struct OperRowListView {
*/
@Builder
builderLike() {
// 点赞根据字段判断是否显示待添加
Column() {
// if (this.likeBean?.contentId) {
LikeComponent({
data: this.likeBean,
styleType: this.styleType,
componentType: this.componentType,
pageComponentType: this.pageComponentType
})
// }
}
.width(48)
.visibility(this.likesStyle !== 4 ? Visibility.Visible : Visibility.None)
.visibility(this.likesStyle == 4 || this.likesStyle == 'empty' || !this.openLikes ? Visibility.None : Visibility.Visible)
}
/**
... ...
... ... @@ -28,6 +28,10 @@ import { MessageUnReadItem } from '../viewmodel/MessageUnReadItem';
import { HistoryPushDataItem } from '../viewmodel/HistoryPushDataItem';
import { HashMap } from '@kit.ArkTS';
import { InteractMessageMItem } from './InteractMessageModel';
import { FullColumnImgUrlDTO, ContentDTO, RmhInfoDTO, LiveInfoDTO, VideoInfoDTO, InteractDataDTO } from 'wdBean/Index';
import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO';
import { CreatorDetailResponseItem } from '../viewmodel/CreatorDetailResponseItem';
import { SearchDescription } from '../viewmodel/SearchResultContentItem';
const TAG = "MinePageDatasModel"
... ... @@ -749,6 +753,169 @@ class MinePageDatasModel{
return WDHttp.get<ResponseDTO<String>>(url)
};
extractResizeParams(url: string) :number[]{
const heightRegex = /h_(\d+)/; // 匹配高度参数,如h_450
const widthRegex = /w_(\d+)/; // 匹配宽度参数,如w_800
const heightMatch = url.match(heightRegex);
const widthMatch = url.match(widthRegex);
let height = heightMatch ? `h_${heightMatch[1]}` : undefined
let width = widthMatch ? `w_${widthMatch[1]}` : undefined
let h:number =0
let w:number =0
if(height){
h = Number(height.split('_')[1])
}
if(width){
w = Number(width.split('_')[1])
}
let arr:number[] = []
arr.push(w)
arr.push(h)
return arr
}
dataTransform(rem:CreatorDetailResponseItem[],value: SearchDescription, photos: FullColumnImgUrlDTO[]): ContentDTO {
let rmhInfo = this.getRmhInfo(rem,value)
console.log('获取photos',JSON.stringify(photos))
console.log('获取value2',JSON.stringify(value))
let contentDTO = new ContentDTO();
contentDTO.appStyle = value.appStyle + ""
contentDTO.cityCode = value.cityCode
contentDTO.coverSize = ""
contentDTO.coverType = value.type == "5" ? 1 : -1
contentDTO.coverUrl = value.appStyleImages.split("&&")[0];
contentDTO.description = value.description
contentDTO.districtCode = value.districtCode
contentDTO.endTime = value.endTime
contentDTO.hImageUrl = ""
contentDTO.heatValue = ""
contentDTO.innerUrl = ""
contentDTO.landscape = Number.parseInt(value.landscape)
contentDTO.linkUrl = value.linkUrl
contentDTO.openLikes = Number.parseInt(value.openLikes)
contentDTO.openUrl = ""
contentDTO.pageId = value.pageId
contentDTO.programAuth = ""
contentDTO.programId = ""
contentDTO.programName = ""
contentDTO.programSource = -1
contentDTO.programType = Number.parseInt(value.status)
contentDTO.provinceCode = value.provinceCode
contentDTO.showTitleEd = value.showTitleEd
contentDTO.showTitleIng = value.showTitleIng
contentDTO.showTitleNo = value.showTitleNo
contentDTO.startTime = value.startTime
contentDTO.subType = ""
contentDTO.subtitle = ""
contentDTO.title = value.title
contentDTO.vImageUrl = ""
contentDTO.screenType = ""
contentDTO.source = StringUtils.isEmpty(value.creatorName) ? value.sourceName : value.creatorName
contentDTO.objectId = value.id
contentDTO.objectType = value.type
contentDTO.channelId = value.channelId
contentDTO.relId = value.relId
contentDTO.relType = value.relType
contentDTO.newsTitle = value.titleLiteral;
contentDTO.publishTime =
StringUtils.isNotEmpty(value.firstPublishTime) ? value.firstPublishTime : value.publishTime
contentDTO.visitorComment = -1
contentDTO.fullColumnImgUrls = photos
contentDTO.newsSummary = ""
contentDTO.hasMore = -1
contentDTO.slideShows = []
contentDTO.voiceInfo = {} as VoiceInfoDTO
contentDTO.tagWord = -1
contentDTO.isSelect = true
contentDTO.rmhInfo = {} as RmhInfoDTO
contentDTO.photoNum = -1
contentDTO.liveInfo = {} as LiveInfoDTO;
contentDTO.videoInfo = {
videoDuration: Number.parseInt(value.duration)
} as VideoInfoDTO;
let interact = new InteractDataDTO()
interact.collectNum = value.collectNum
interact.commentNum = value.commentNum
interact.contentId = value.id
interact.contentType = Number.parseInt(value.type)
interact.likeNum = value.likeNum
interact.readNum = Number.parseInt(value.readNum)
interact.shareNum = Number.parseInt(value.shareNum)
contentDTO.interactData = interact
contentDTO.corner = ''
contentDTO.rmhPlatform = 0
contentDTO.newTags = ''
contentDTO.isSearch = true
contentDTO.publishTimestamp = ""
contentDTO.bottomNavId = '';
contentDTO.openType = '';
contentDTO.extra = '';
contentDTO.titleShow = value.type == "5" ? 1 : 0;
contentDTO.rmhInfo = rmhInfo
contentDTO.shareFlag = value.shareFlag
contentDTO.contentText = value.contentText
return contentDTO;
}
// 搜索数据转化rmhInfo
getRmhInfo(rem:CreatorDetailResponseItem[],value:SearchDescription){
let obj = value
let rmhInfo:RmhInfoDTO = {
rmhHeadUrl:obj.headerPhotoUrl,
rmhName:obj.creatorName,
rmhId:obj.creatorId,
authIcon:obj.authIcon,
authTitle: obj.authTitle,
authTitle2: '',
banControl: 0,
cnIsAttention: 0,
cnAttention: 0,
cnlsComment: 0,
cnlsLike: 0,
cnMainControl: 0,
cnShareControl: 0,
cnIsComment: 0,
cnIsLike:0,
posterShareControl: 0,
rmhDesc: obj.introduction,
userId: obj.userId,
userType: obj.userType,
honoraryIcon:''
}
if(rem.length>0){
rem.forEach(item=>{
if(item.creatorId === obj.creatorId){
rmhInfo = {
rmhHeadUrl:item.headPhotoUrl,
rmhName:item.userName,
rmhId:item.creatorId,
authIcon:item.authIcon,
authTitle: item.authTitle,
authTitle2: '',
banControl: 0,
cnIsAttention:item.isAttention,
cnAttention: 0,
cnlsComment: 0,
cnlsLike: 0,
cnMainControl: 0,
cnShareControl: 0,
cnIsComment: 0,
cnIsLike:0,
posterShareControl: 0,
rmhDesc: item.introduction,
userId: item.userId,
userType: item.userType,
honoraryIcon:''
}
}
})
}
return rmhInfo
}
}
const minePageDatasModel = MinePageDatasModel.getInstance()
... ...
... ... @@ -49,6 +49,7 @@ export struct MultiPictureListPage {
left: { anchor: "__container__", align: HorizontalAlign.Start }
})
.onClick(() => {
this.onBack();
router.back();
})
.id("backImg")
... ... @@ -134,7 +135,7 @@ export struct MultiPictureListPage {
}
.width('100%')
.height('100%')
.padding({top:$r('app.float.margin_44')})
// .padding({top:$r('app.float.margin_44')})
.backgroundColor(Color.Black)
.id('e_picture_container')
// 设置顶部绘制延伸到状态栏
... ... @@ -148,7 +149,7 @@ export struct MultiPictureListPage {
*/
openFullScreen() {
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
WindowModel.shared.setWindowLayoutFullScreen(true)
// WindowModel.shared.setWindowLayoutFullScreen(true)
// WindowModel.shared.setWindowSystemBarEnable([])
}
... ... @@ -163,7 +164,16 @@ export struct MultiPictureListPage {
*/
closeFullScreen() {
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
WindowModel.shared.setWindowLayoutFullScreen(false)
// WindowModel.shared.setWindowLayoutFullScreen(false)
// WindowModel.shared.setWindowSystemBarEnable(['status', 'navigation'])
}
onBackPress(): boolean | void {
this.onBack()
}
private onBack() {
// 提前设置,否则返回的页面展示有问题(有时延)
this.closeFullScreen()
}
}
\ No newline at end of file
... ...
... ... @@ -91,7 +91,7 @@ struct MultiPictureDetailPage {
*/
openFullScreen() {
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
WindowModel.shared.setWindowLayoutFullScreen(true)
// WindowModel.shared.setWindowLayoutFullScreen(true)
// WindowModel.shared.setWindowSystemBarEnable([])
}
... ... @@ -101,7 +101,7 @@ struct MultiPictureDetailPage {
*/
closeFullScreen() {
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
WindowModel.shared.setWindowLayoutFullScreen(false)
// WindowModel.shared.setWindowLayoutFullScreen(false)
// WindowModel.shared.setWindowSystemBarEnable(['status', 'navigation'])
}
... ...