yangsunyue_wd
Showing 71 changed files with 2255 additions and 639 deletions
... ... @@ -4,7 +4,7 @@ import router from '@ohos.router';
@Entry
@Component
struct OtherNormalUserHomePage {
@State userId: string = "111111111";
@State userId: string = "-1";
onPageShow() {
this.userId = router.getParams()?.["userId"]
... ...
{
"code": "0",
"data": [
"习语",
"党史学习",
"高考倒计时"
],
"message": "Success",
"success": true,
"timestamp": 1712562841885
}
\ No newline at end of file
... ...
import { CommonConstants } from 'wdConstant';
import { ContentDTO } from '../repository/bean/ContentDTO';
import { Card11Component } from './cardview/Card11Component';
import { Card3Component } from './cardview/Card3Component';
import { Card2Component } from './cardview/Card2Component';
import { Card4Component } from './cardview/Card4Component';
/**
* card适配器,卡片样式汇总,依据ContentDTO#appStyle
* 卡片样式,最小单元样式布局
*/
@Component
export struct CardParser {
@State contentDTO: ContentDTO = {} as ContentDTO;
build() {
this.contentBuilder(this.contentDTO);
}
@Builder
contentBuilder(contentDTO: ContentDTO) {
if (contentDTO.appStyle === '11') {
Card11Component({ contentDTO })
} else if (contentDTO.appStyle === '3') {
Card3Component({ contentDTO })
} else if (contentDTO.appStyle === "2") {
Card2Component({ contentDTO })
} else if (contentDTO.appStyle === "4") {
Card4Component({ contentDTO })
}
else {
// todo:组件未实现 / Component Not Implemented
Text(contentDTO.appStyle)
.width(CommonConstants.FULL_PARENT)
.padding(10)
// .backgroundColor(Color.Brown) // 展示本页未实现的compStyle
}
}
}
\ No newline at end of file
... ...
... ... @@ -22,6 +22,7 @@ import { SmallVideoCardHorComponent } from './view/SmallVideoCardHorComponent';
/**
* comp适配器.
* 首页楼层comp解析器
*/
@Component
export struct CompParser {
... ...
//缩略标题
import { CommonConstants } from 'wdConstant'
import { DateTimeUtils } from 'wdKit'
import { ContentDTO } from '../../repository/bean/ContentDTO';
@Component
export struct Card11Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
@State @Watch('isPoint') source: boolean = false; //来源是否为空 publishTime 字段是否为空
@State isPo: number = Visibility.Visible;
isPoint() {
if (this.source) {
this.isPo = Visibility.None
}
}
build() {
Column() {
Text(this.contentDTO.newsTitle)
.fontSize($r("app.float.font_size_17"))
.fontColor($r("app.color.color_222222"))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.width(CommonConstants.FULL_WIDTH)
.fontWeight(400)
Row() {
Text(this.contentDTO.corner)
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_ED2800"))
.fontWeight(400)
Text(this.contentDTO.source)
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
.margin({ left: 6 })
.fontWeight(400)
Image($r("app.media.point"))
.width(16)
.height(16)
.visibility(this.isPo)
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
.fontWeight(400)
}.width(CommonConstants.FULL_WIDTH)
.justifyContent(FlexAlign.Start)
.margin({ top: 8 })
}.width(CommonConstants.FULL_WIDTH)
.padding({
top: 14,
left: 16,
right: 16,
bottom: 14
})
.backgroundColor($r("app.color.white"))
.margin({ bottom: 8 })
}
aboutToAppear() {
if (this.contentDTO.source == "") {
this.source = true;
}
if (this.contentDTO.publishTime == "") {
this.source = true;
}
}
}
\ No newline at end of file
... ...
//全标题 "compStyle":"2",
import { ContentDTO } from '../../repository/bean/ContentDTO';
const TAG: string = 'BigPicCardComponent';
/**
* 大图卡:
* compstyle:2
* 卡片结构:上下结构
* 卡片宽度:充满父窗口
* 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9:
*/
// @Entry
@Component
export struct Card2Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
build() {
Column() {
Column() {
//新闻标题
Text(this.contentDTO.newsTitle)
.fontSize(17)
.fontColor('#222222')
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.align(Alignment.Start)
//大图
Stack() {
Image(this.contentDTO.coverUrl)
.backgroundColor('#888888')
.borderRadius(4)
.width('100%')
.aspectRatio(343 / 192)
//播放状态+时长
Row() {
Image($r('app.media.icon_live'))
.width(22)
.height(18)
Stack() {
Text('直播中')
.fontColor('#FFFFFF')
.fontSize(11)
}
.width(44)
.height(18)
.backgroundColor('#4d000000')
}.margin({ right: 8, bottom: 8 })
}
.width('100%')
.alignContent(Alignment.BottomEnd)
.margin({ top: 8 })
}
.width('100%')
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Start)
.padding({ top: 14 })
//bottom
Row() {
Text(this.contentDTO.source)
.bottomTextStyle()
//间隔点
Image($r('app.media.point'))
.width(12)
.height(12)
Text(this.contentDTO.source)
.bottomTextStyle()
Text(' ')
Text(this.contentDTO.subtitle)
.bottomTextStyle()
}
.width('100%')
.height(18)
.justifyContent(FlexAlign.Start)
// .padding({bottom:14})
.margin({ top: 8 })
}
.width('100%')
.padding({ left: 16, right: 16 })
}
}
@Extend(Text) function bottomTextStyle() {
.fontSize(12)
.fontColor('#B0B0B0')
}
\ No newline at end of file
... ...
//全标题 "compStyle":"3",
import { CommonConstants } from 'wdConstant'
import { DateTimeUtils } from 'wdKit/src/main/ets/utils/DateTimeUtils'
import { ContentDTO } from '../../repository/bean/ContentDTO'
@Component
export struct Card3Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
@State @Watch('isPoint') source: boolean = false; //来源是否为空 publishTime 字段是否为空
@State isPo: number = Visibility.Visible;
isPoint() {
if (this.source) {
this.isPo = Visibility.None
}
}
build() {
Column() {
Text(this.contentDTO.newsTitle)
.fontSize($r("app.float.font_size_17"))
.fontColor($r("app.color.color_222222"))
.width(CommonConstants.FULL_WIDTH)
.fontWeight(400)
Row() {
Text(this.contentDTO.corner)
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_ED2800"))
.fontWeight(400)
Text(this.contentDTO.source)
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
.margin({ left: 6 })
.fontWeight(400)
Image($r("app.media.point"))
.width(16)
.height(16)
.visibility(this.isPo)
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
.fontWeight(400)
}.width(CommonConstants.FULL_WIDTH)
.justifyContent(FlexAlign.Start)
.margin({ top: 8 })
}.width("100%")
.padding({
top: 14,
left: 16,
right: 16,
bottom: 14
})
.backgroundColor($r("app.color.white"))
.margin({ bottom: 8 })
}
aboutToAppear() {
// Logger.info("ssx",JSON.stringify(this.compDTO.operDataList[0]))
if (this.contentDTO.source == "") {
this.source = true;
}
if (this.contentDTO.publishTime == "") {
this.source = true;
}
}
}
\ No newline at end of file
... ...
//全标题 "compStyle":"4",
import { DateTimeUtils } from 'wdKit';
import { ContentDTO } from '../../repository/bean/ContentDTO';
const TAG: string = 'TriPicCardComponent';
/**
* 三图卡:
* compstyle:4
* 卡片结构:上下结构
* 卡片宽度:充满父窗口
* 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9:
*/
@Entry
@Component
export struct Card4Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
build() {
Column() {
//body
Column() {
//新闻标题
Text(this.contentDTO.newsTitle)
.fontSize(17)
.fontColor('#222222')
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
//三图
Row() {
Image(this.contentDTO.fullColumnImgUrls[0]?.url)
.width('32%')
.aspectRatio(113 / 75)
.borderRadius({ topLeft: 4, bottomLeft: 4 })
Image(this.contentDTO.fullColumnImgUrls[1]?.url)
.width('32%')
.aspectRatio(113 / 75)
Image(this.contentDTO.fullColumnImgUrls[2]?.url)
.width('32%')
.aspectRatio(113 / 75)
.borderRadius({ topRight: 4, bottomRight: 4 })
}
.justifyContent(FlexAlign.SpaceBetween)
.width('100%')
.margin({ top: 8 })
.borderRadius(8)
}
.width('100%')
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Start)
.padding({ top: 14 })
//bottom
Row() {
Text(this.contentDTO.source)
.bottomTextStyle()
//间隔点
Image($r('app.media.point'))
.width(12)
.height(12)
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))
.bottomTextStyle()
Text(' ')
Text('518条评论')
.bottomTextStyle()
}
.width('100%')
.justifyContent(FlexAlign.Start)
// .padding({bottom:14})
.margin({ top: 8 })
.padding({ bottom: 14 })
}
.width('100%')
.padding({ top: 8, left: 16, right: 16 })
}
}
@Extend(Text) function bottomTextStyle() {
.fontSize(12)
.fontColor('#B0B0B0')
}
\ No newline at end of file
... ...
... ... @@ -5,6 +5,7 @@ import { BottomNavDTO } from '../../repository/bean/BottomNavDTO';
import { UIUtils } from '../../repository/UIUtils';
import { MinePageComponent } from './MinePageComponent';
import PageViewModel from '../../viewmodel/PageViewModel';
import { FirstTabTopComponent } from './FirstTabTopComponent';
const TAG = 'BottomNavigationComponent';
... ... @@ -51,6 +52,9 @@ export struct BottomNavigationComponent {
// 我的页面组件数据列表
MinePageComponent()
} else {
if(index === 0 ){
FirstTabTopComponent()
}
TopNavigationComponent({ topNavList: navItem.topNavChannelList })
}
}
... ...
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
/**
* 首页顶部搜索导航栏
* 竖向滚动实现方案
* 方案一 使用动画 + 定时器
* 方案二 使用容器组件Swiper(当前)
*/
const TAG = "FirstTabTopComponent"
@Component
export struct FirstTabTopComponent{
@State searchTextData :string[] = []
private swiperController: SwiperController = new SwiperController()
aboutToAppear(){
this.getSearchHint()
}
getSearchHint(){
SearcherAboutDataModel.getSearchHintData(getContext(this)).then((value)=>{
if(value!=null){
this.searchTextData = value
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
})
}
build(){
Column(){
Row(){
Row(){
Image($r('app.media.search_icon'))
.objectFit(ImageFit.Cover)
.height('23lpx')
.width('23lpx')
.margin({right:'13lpx'})
.interpolation(ImageInterpolation.Medium)
if(this.searchTextData!=null && this.searchTextData.length>0){
Swiper(this.swiperController) {
ForEach(this.searchTextData, (item: string, index: number ) => {
Text(item)
.fontWeight('400lpx')
.fontSize('25lpx')
.fontColor($r('app.color.color_666666'))
.lineHeight('35lpx')
.textAlign(TextAlign.Start)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Clip})
})
}
.loop(true)
.autoPlay(true)
.interval(3000)
.indicator(false)
.vertical(true)
}
}.width('257lpx')
.height('61lpx')
.padding({left:'31lpx'})
.backgroundImage($r('app.media.top_search_bg'))
.backgroundImageSize(ImageSize.Cover)
.alignItems(VerticalAlign.Center)
Image($r('app.media.top_title_bg'))
.objectFit(ImageFit.Auto)
.height('58lpx')
.width('152lpx')
.interpolation(ImageInterpolation.Medium)
Row(){
Text("早晚报")
}.backgroundImage($r('app.media.top_right_bg'))
.justifyContent(FlexAlign.Center)
.backgroundImageSize(ImageSize.Cover)
.width('257lpx')
.height('61lpx')
}.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
}.height('73lpx')
.width('100%')
.justifyContent(FlexAlign.End)
.backgroundColor($r('app.color.white'))
}
}
\ No newline at end of file
... ...
import { CommonConstants, ViewType } from 'wdConstant';
import { Logger } from 'wdKit';
import { CollectionUtils, Logger } from 'wdKit';
import { CompDTO } from '../../repository/bean/CompDTO';
import PageViewModel from '../../viewmodel/PageViewModel';
import { EmptyComponent } from '../view/EmptyComponent';
... ... @@ -12,6 +12,7 @@ import NoMoreLayout from './NoMoreLayout';
import LoadMoreLayout from './LoadMoreLayout';
import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
import { CompParser } from '../CompParser';
import { GroupInfoDTO } from '../../repository/bean/PageInfoDTO';
const TAG = 'PageComponent';
... ... @@ -112,8 +113,20 @@ export struct PageComponent {
this.pageModel.groupId = this.pageId;
this.pageModel.channelId = this.channelId;
this.pageModel.currentPage = 1;
let pageDto = await PageViewModel.getPageData(this.pageModel.pageId, this.pageModel.pageId, this.pageModel.channelId
, this.pageModel.currentPage, this.pageModel.pageSize, getContext(this))
let pageInfo = await PageViewModel.getPageInfo(this.pageModel.pageId);
if (pageInfo == null) {
this.pageModel.viewType = ViewType.EMPTY;
return;
}
// TODO group是个列表,可以配多个楼层,需要适配 多个group数据请求,后续优化
let groupInfo: GroupInfoDTO = CollectionUtils.getElement(pageInfo.groups, 0);
if (groupInfo != null) {
this.pageModel.groupStrategy = groupInfo.groupStrategy;
this.pageModel.isRecGroup = groupInfo.groupStrategy === 1;
this.pageModel.groupId = groupInfo.id;
}
let pageDto = await PageViewModel.getPageData(this.pageModel, getContext(this))
if (pageDto && pageDto.compList && pageDto.compList.length > 0) {
this.pageModel.viewType = ViewType.LOADED;
this.pageModel.compList.push(...pageDto.compList)
... ...
... ... @@ -26,16 +26,16 @@ export default struct MinePageUserSimpleInfoUI {
.alt($r('app.media.default_head'))
.width('108lpx')
.height('108lpx')
.objectFit(ImageFit.Cover)
.objectFit(ImageFit.Auto)
.borderRadius(50)
Image(this.levelHead)
.width('120lpx')
.height('120lpx')
.objectFit(ImageFit.Cover)
.width('130lpx')
.height('130lpx')
.objectFit(ImageFit.Auto)
.borderRadius(50)
}.width('120lpx')
.height('120lpx')
}.width('130lpx')
.height('130lpx')
.alignContent(Alignment.Center)
.onClick(()=>{
if(!this.isLogin){
... ...
... ... @@ -14,10 +14,6 @@ export struct FollowFirstTabsComponent{
selectedFontColor: string = '#000000'
aboutToAppear(){
// let res = JSON.parse(`{"code":"0","data":[{"children":[],"directoryName":"阅读","directoryWeight":99,"id":165,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[{"children":[{"directoryName":"三二","directoryWeight":2,"id":120,"isShow":1,"level":3,"parentId":118,"rootId":117},{"directoryName":"三级","directoryWeight":1,"id":119,"isShow":1,"level":3,"parentId":118,"rootId":117}],"directoryName":"二级","directoryWeight":1,"id":118,"isShow":1,"level":2,"parentId":117,"rootId":117}],"directoryName":"幽游白书","directoryWeight":33,"id":117,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[],"directoryName":"推荐","directoryWeight":9,"id":386,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[],"directoryName":"政务","directoryWeight":9,"id":379,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[{"children":[],"directoryName":"推荐","directoryWeight":0,"id":335,"isShow":1,"level":2,"parentId":320,"rootId":320}],"directoryName":"推荐","directoryWeight":9,"id":320,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[],"directoryName":"媒体","directoryWeight":8,"id":390,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[],"directoryName":"媒体","directoryWeight":8,"id":323,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[],"directoryName":"自媒体","directoryWeight":7,"id":329,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[],"directoryName":"名人","directoryWeight":6,"id":389,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[{"children":[],"directoryName":"测试","directoryWeight":0,"id":338,"isShow":1,"level":2,"parentId":324,"rootId":324}],"directoryName":"名人","directoryWeight":6,"id":324,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[{"children":[],"directoryName":"2级目录","directoryWeight":0,"id":340,"isShow":1,"level":2,"parentId":312,"rootId":312},{"children":[{"directoryName":"3级测试","directoryWeight":0,"id":368,"isShow":1,"level":3,"parentId":339,"rootId":312}],"directoryName":"二级目录","directoryWeight":0,"id":339,"isShow":1,"level":2,"parentId":312,"rootId":312},{"children":[{"directoryName":"企业","directoryWeight":1,"id":348,"isShow":1,"level":3,"parentId":336,"rootId":312},{"directoryName":"部委","directoryWeight":0,"id":344,"isShow":1,"level":3,"parentId":336,"rootId":312},{"directoryName":"地方","directoryWeight":0,"id":341,"isShow":1,"level":3,"parentId":336,"rootId":312}],"directoryName":"类型","directoryWeight":0,"id":336,"isShow":1,"level":2,"parentId":312,"rootId":312},{"children":[{"directoryName":"贵州省","directoryWeight":0,"id":378,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"西藏自治区","directoryWeight":0,"id":377,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"四川省","directoryWeight":0,"id":376,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"重庆市","directoryWeight":0,"id":375,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"湖南省","directoryWeight":0,"id":374,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"云南省","directoryWeight":0,"id":373,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"广西壮族自治区","directoryWeight":0,"id":372,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"宁夏回族自治区","directoryWeight":0,"id":371,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"湖北省","directoryWeight":0,"id":370,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"青海省","directoryWeight":0,"id":369,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"陕西省","directoryWeight":0,"id":367,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"甘肃省","directoryWeight":0,"id":366,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"吉林省","directoryWeight":0,"id":365,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"广东省","directoryWeight":0,"id":364,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"海南省","directoryWeight":0,"id":363,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"辽宁省","directoryWeight":0,"id":362,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"江苏省","directoryWeight":0,"id":361,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"新疆维吾尔族自治区","directoryWeight":0,"id":360,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"福建省","directoryWeight":0,"id":359,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"山东省","directoryWeight":0,"id":358,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"河南省","directoryWeight":0,"id":357,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"浙江省","directoryWeight":0,"id":356,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"安徽省","directoryWeight":0,"id":355,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"上海市","directoryWeight":0,"id":354,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"河北省","directoryWeight":0,"id":353,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"黑龙江省","directoryWeight":0,"id":352,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"江西省","directoryWeight":0,"id":351,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"内蒙古自治区","directoryWeight":0,"id":350,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"北京市","directoryWeight":0,"id":349,"isShow":1,"level":3,"parentId":332,"rootId":312},{"directoryName":"山西省","directoryWeight":0,"id":346,"isShow":1,"level":3,"parentId":332,"rootId":312}],"directoryName":"地域","directoryWeight":0,"id":332,"isShow":1,"level":2,"parentId":312,"rootId":312}],"directoryName":"政务","directoryWeight":5,"id":312,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[],"directoryName":"学校","directoryWeight":4,"id":331,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[],"directoryName":"机构","directoryWeight":3,"id":330,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[{"children":[{"directoryName":"新闻联播","directoryWeight":3,"id":79,"isShow":1,"level":3,"parentId":75,"rootId":74},{"directoryName":"第三季","directoryWeight":2,"id":78,"isShow":1,"level":3,"parentId":75,"rootId":74},{"directoryName":"三级","directoryWeight":1,"id":76,"isShow":1,"level":3,"parentId":75,"rootId":74}],"directoryName":"短视频","directoryWeight":1,"id":75,"isShow":1,"level":2,"parentId":74,"rootId":74}],"directoryName":"创作","directoryWeight":3,"id":74,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[{"children":[],"directoryName":"教学","directoryWeight":2,"id":72,"isShow":1,"level":2,"parentId":64,"rootId":64},{"children":[],"directoryName":"热门","directoryWeight":1,"id":73,"isShow":1,"level":2,"parentId":64,"rootId":64},{"children":[],"directoryName":"赛事","directoryWeight":1,"id":71,"isShow":1,"level":2,"parentId":64,"rootId":64}],"directoryName":"游戏","directoryWeight":2,"id":64,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[],"directoryName":"新闻","directoryWeight":1,"id":315,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[{"children":[],"directoryName":"趣闻","directoryWeight":6,"id":70,"isShow":1,"level":2,"parentId":63,"rootId":63},{"children":[],"directoryName":"时政","directoryWeight":5,"id":69,"isShow":1,"level":2,"parentId":63,"rootId":63},{"children":[],"directoryName":"农业","directoryWeight":3,"id":68,"isShow":1,"level":2,"parentId":63,"rootId":63},{"children":[],"directoryName":"娱乐","directoryWeight":3,"id":67,"isShow":1,"level":2,"parentId":63,"rootId":63},{"children":[],"directoryName":"科技","directoryWeight":2,"id":66,"isShow":1,"level":2,"parentId":63,"rootId":63},{"children":[],"directoryName":"国际","directoryWeight":1,"id":65,"isShow":1,"level":2,"parentId":63,"rootId":63}],"directoryName":"新闻","directoryWeight":1,"id":63,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[],"directoryName":"公安","directoryWeight":0,"id":388,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[],"directoryName":"dddd","directoryWeight":0,"id":387,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[],"directoryName":"健康","directoryWeight":0,"id":384,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[],"directoryName":"综合","directoryWeight":0,"id":328,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[],"directoryName":"房产","directoryWeight":0,"id":327,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[],"directoryName":"健康","directoryWeight":0,"id":318,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[],"directoryName":"历史","directoryWeight":0,"id":310,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[],"directoryName":"dddd","directoryWeight":0,"id":309,"isShow":1,"level":1,"parentId":0,"rootId":0},{"children":[{"children":[],"directoryName":"aaaa","directoryWeight":1,"id":333,"isShow":1,"level":2,"parentId":308,"rootId":308},{"children":[],"directoryName":"qqq","directoryWeight":0,"id":334,"isShow":1,"level":2,"parentId":308,"rootId":308}],"directoryName":"dddd","directoryWeight":0,"id":308,"isShow":1,"level":1,"parentId":0,"rootId":0}],"message":"Success","success":true,"timestamp":1710741803593}`) as ResponseDTO<FollowListItem[]>
// res.data.forEach(element => {
// this.data.push(element)
// });
MinePageDatasModel.getFollowListData(getContext(this)).then((value)=>{
this.data.push(new FollowListItem("我的"))
value.forEach((element)=>{
... ... @@ -85,7 +81,7 @@ export struct FollowFirstTabsComponent{
this.currentIndex = index
})
.width('100%')
.height('100%')
.layoutWeight(1)
}.width('100%')
}
}
\ No newline at end of file
... ...
... ... @@ -70,7 +70,7 @@ export struct FollowListDetailUI{
//我的关注列表
if (this.creatorDirectoryId === -1){
if(this.hasMore){
let object = new FollowListDetailRequestItem(20,this.curPageNum)
let object = new FollowListDetailRequestItem(-1,20,this.curPageNum)
MinePageDatasModel.getMineFollowListData(object,getContext(this)).then((value)=>{
if (!this.data || value.list.length == 0){
... ...
... ... @@ -23,14 +23,13 @@ export struct FollowSecondTabsComponent{
if(this.data != null){
if(this.data[this.firstIndex].children == null || this.data[this.firstIndex].children.length == 0){
FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].id})
FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].id}).layoutWeight(1)
}else{
this.FollowSecondUI()
}
}
}
}.layoutWeight(1)
.width('100%')
.height('100%')
}
@Builder FollowSecondUI(){
... ...
import { LazyDataSource, StringUtils } from 'wdKit';
import { DateTimeUtils, LazyDataSource, StringUtils } from 'wdKit';
import MinePageDatasModel from '../../../../model/MinePageDatasModel';
import { HttpUrlUtils } from '../../../../network/HttpUrlUtils';
import RouteManager from '../../../../utils/RouteManager';
... ... @@ -33,8 +33,32 @@ export struct HomePageBottomComponent{
.backgroundColor($r('app.color.color_EDEDED'))
if(this.count === 0){
if(this.style === 1){
Row(){
Text("关注更多人民号")
.fontWeight('400lpx')
.fontColor($r('app.color.color_222222'))
.lineHeight('38lpx')
.fontSize('27lpx')
.textAlign(TextAlign.Center)
.margin({right:'4lpx'})
Image($r('app.media.arrow_icon_right'))
.objectFit(ImageFit.Auto)
.width('27lpx')
.height('27lpx')
}.height('69lpx')
.width('659lpx')
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top:'31lpx',bottom:'4lpx'})
.onClick(()=>{
RouteManager.jumpNewPage("pages/FollowListPage",new RouterObject('',1))
})
}else{
ListHasNoMoreDataUI({style:2})
.height('100%')
.layoutWeight(1)
}
}else{
if(this.style === 1){
List({ space: 3 }) {
... ... @@ -129,6 +153,8 @@ export struct HomePageBottomComponent{
}
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Start)
}
... ... @@ -145,7 +171,7 @@ export struct HomePageBottomComponent{
//我的关注列表
if (this.style === 1){
if(this.hasMore){
let object = new FollowListDetailRequestItem(20,this.curPageNum)
let object = new FollowListDetailRequestItem(-1,20,this.curPageNum)
MinePageDatasModel.getMineFollowListData(object,getContext(this)).then((value)=>{
if (!this.data_follow || value.list.length == 0){
... ... @@ -170,9 +196,11 @@ export struct HomePageBottomComponent{
}
}else if(this.style === 0){
if(this.hasMore){
let object = new FollowListDetailRequestItem(20,this.curPageNum)
let time = encodeURI(DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
let object = new FollowListDetailRequestItem(-1,20,this.curPageNum)
MinePageDatasModel.getMineCommentListData(object,getContext(this)).then((value)=>{
MinePageDatasModel.getMineCommentListData(time,object,getContext(this)).then((value)=>{
if (!this.data_comment || value.list.length == 0){
this.hasMore = false
}else{
... ...
... ... @@ -55,18 +55,20 @@ export struct MyHomeComponent {
Stack(){
Image(this.headPhotoUrl)
.alt($r('app.media.default_head'))
.width('115lpx')
.height('115lpx')
.objectFit(ImageFit.Cover)
.width('100lpx')
.height('100lpx')
.objectFit(ImageFit.Auto)
.borderRadius(50)
Image(this.levelHead)
.width('130lpx')
.height('130lpx')
.objectFit(ImageFit.Cover)
.borderRadius(50)
}.onClick(()=>{
//531267787833221
RouteManager.jumpNewPage("pages/OtherNormalUserHomePage",new RouterObject('512157124138245',0))
})
}).width('135lpx')
.height('135lpx')
Column() {
Row() {
Text(`${this.userName}`)
... ...
... ... @@ -6,6 +6,7 @@ import MinePageDatasModel from '../../../../model/MinePageDatasModel';
import { MineCommentListDetailItem } from '../../../../viewmodel/MineCommentListDetailItem';
import { OtherUserCommentLikeStatusRequestItem } from '../../../../viewmodel/OtherUserCommentLikeStatusRequestItem';
import { CommentLikeOperationRequestItem } from '../../../../viewmodel/CommentLikeOperationRequestItem';
import { HttpUrlUtils } from '../../../../network/HttpUrlUtils';
const TAG = "HomePageBottomComponent"
@Component
... ... @@ -17,6 +18,7 @@ export struct OtherHomePageBottomCommentComponent{
curPageNum:number = 1;
@State count:number = 0;
@Prop levelHead:string
@Link commentNum:number
aboutToAppear(){
this.getNewPageData()
... ... @@ -122,6 +124,7 @@ export struct OtherHomePageBottomCommentComponent{
this.data_comment.notifyDataReload()
this.count = this.data_comment.totalCount()
this.commentNum = value.totalCount
if (this.data_comment.totalCount() < value.totalCount) {
this.curPageNum++
}else {
... ...
... ... @@ -104,7 +104,7 @@ export struct OtherHomePageBottomFollowComponent{
getNewPageData(){
this.isLoading = true
//我的关注列表
//关注列表
if(this.hasMore){
let object = new UserFollowListRequestItem(Number(this.curUserId),20,this.curPageNum,"1")
... ... @@ -164,47 +164,6 @@ struct ChildFollowComponent {
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
if(this.data.status == "1"){
Row(){
Text(`已关注`)
.fontColor($r('app.color.color_CCCCCC'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('35lpx')
}.backgroundColor($r('app.color.color_F5F5F5'))
.borderRadius('6lpx')
.borderColor($r('app.color.color_F5F5F5'))
.borderWidth('2lpx')
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.margin({left:'4lpx',top:'23lpx'})
.onClick(()=>{
this.data.status = "0"
})
}else{
Row(){
Image($r('app.media.follow_icon'))
.margin({right:'4lpx'})
.width('23lpx')
.height('23lpx')
Text(`关注`)
.fontColor($r('app.color.color_ED2800'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('35lpx')
}.borderColor($r('app.color.color_1AED2800'))
.borderRadius('6lpx')
.borderWidth('2lpx')
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.margin({left:'4lpx',top:'23lpx'})
.onClick(()=>{
this.data.status = "1"
})
}
}.alignItems(VerticalAlign.Top)
.width('100%')
.layoutWeight(1)
... ...
... ... @@ -9,7 +9,7 @@ const TAG = "OtherUserHomeComponent"
@Component
export struct OtherUserHomeComponent {
@Prop curUserId: string
@Watch('change') @Prop curUserId: string
@State tileOpacity: number = 0;
firstPositionY:number = 0;
... ... @@ -27,6 +27,12 @@ export struct OtherUserHomeComponent {
@State attentionNum:number = 0//关注数
@State desc:string = ""
change(){
this.getUserInfo()
this.getUserLevel()
}
aboutToAppear(){
this.getUserInfo()
this.getUserLevel()
... ... @@ -52,8 +58,8 @@ export struct OtherUserHomeComponent {
Stack(){
Image(this.headPhotoUrl)
.alt($r('app.media.default_head'))
.width('115lpx')
.height('115lpx')
.width('100lpx')
.height('100lpx')
.objectFit(ImageFit.Cover)
.borderRadius(50)
Image(this.levelHead)
... ... @@ -165,7 +171,7 @@ export struct OtherUserHomeComponent {
//tab 页面
Tabs({controller: this.controller}) {
TabContent() {
OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead})
OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum})
}.tabBar(this.TabBuilder(0,"评论"))
TabContent() {
OtherHomePageBottomFollowComponent({curUserId:this.curUserId})
... ... @@ -295,6 +301,9 @@ export struct OtherUserHomeComponent {
getUserInfo(){
if(this.curUserId === "-1" ){
return
}
let item = new OtherUserDetailRequestItem("","1",this.curUserId)
MinePageDatasModel.getOtherUserDetailData(item,getContext(this)).then((value)=>{
if(value!=null){
... ... @@ -312,6 +321,9 @@ export struct OtherUserHomeComponent {
})
}
getUserLevel(){
if(this.curUserId === "-1" ){
return
}
MinePageDatasModel.getOtherUserLevelData([this.curUserId],getContext(this)).then((value)=>{
if(value!=null){
this.levelHead = value[0].levelHead
... ...
//全标题 "compStyle":"2",
import { CommonConstants } from 'wdConstant'
import { CompDTO } from '../../repository/bean/CompDTO'
import { ContentDTO } from '../../repository/bean/ContentDTO';
import { CardParser } from '../CardParser';
const TAG: string = 'BigPicCardComponent';
/**
... ... @@ -14,8 +17,21 @@ const TAG: string = 'BigPicCardComponent';
@Component
export struct BigPicCardComponent {
@State compDTO: CompDTO = {} as CompDTO
contentDTO: ContentDTO = {} as ContentDTO;
build() {
// this.cardBuild();
this.originalBuild();
}
async aboutToAppear() {
// 取第一个数据
this.contentDTO = this.compDTO.operDataList[0];
this.contentDTO.appStyle = "2";
}
@Builder
originalBuild() {
Column() {
Column() {
... ... @@ -49,18 +65,18 @@ export struct BigPicCardComponent {
.width(44)
.height(18)
.backgroundColor('#4d000000')
}.margin({right:8,bottom:8})
}.margin({ right: 8, bottom: 8 })
}
.width('100%')
.alignContent(Alignment.BottomEnd)
.margin({top:8})
.margin({ top: 8 })
}
.width('100%')
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Start)
.padding({top:14})
.padding({ top: 14 })
//bottom
Row() {
... ... @@ -83,14 +99,16 @@ export struct BigPicCardComponent {
.height(18)
.justifyContent(FlexAlign.Start)
// .padding({bottom:14})
.margin({top:8})
.margin({ top: 8 })
}
.width('100%')
.padding({left:16,right:16})
.padding({ left: 16, right: 16 })
}
@Builder
cardBuild() {
CardParser({ contentDTO: this.contentDTO });
}
}
@Extend(Text) function bottomTextStyle() {
... ...
... ... @@ -324,10 +324,10 @@ class MinePageDatasModel{
* @param context
* @returns
*/
getMineCommentListData(params:FollowListDetailRequestItem,context: Context): Promise<MineCommentListDetailItem> {
getMineCommentListData(time:string,params:FollowListDetailRequestItem,context: Context): Promise<MineCommentListDetailItem> {
return new Promise<MineCommentListDetailItem>((success, error) => {
Logger.info(TAG, `getAppointmentList start`);
this.fetchMineCommentListData(params).then((navResDTO: ResponseDTO<MineCommentListDetailItem>) => {
this.fetchMineCommentListData(time,params).then((navResDTO: ResponseDTO<MineCommentListDetailItem>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getMineCommentListDataLocal(context))
return
... ... @@ -342,8 +342,8 @@ class MinePageDatasModel{
})
}
fetchMineCommentListData(object:FollowListDetailRequestItem) {
let url = HttpUrlUtils.getMineCommentListDataUrl()+`?pageSize=${object.pageSize}&pageNum=${object.pageNum}`
fetchMineCommentListData(time:string,object:FollowListDetailRequestItem) {
let url = HttpUrlUtils.getMineCommentListDataUrl()+`?pageSize=${object.pageSize}&pageNum=${object.pageNum}&time=${time}`
let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders();
return WDHttp.get<ResponseDTO<MineCommentListDetailItem>>(url, headers)
};
... ... @@ -581,7 +581,7 @@ class MinePageDatasModel{
}
fetchOtherUserCommentLikeStatusData(object:OtherUserCommentLikeStatusRequestItem) {
let url = HttpUrlUtils.getFollowListStatusDataUrl()
let url = HttpUrlUtils.getCommentListStatusDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders();
return WDHttp.post<ResponseDTO<QueryCommentListIsLikedItem[]>>(url,object, headers)
};
... ...
import { Logger, ResourcesUtils } from 'wdKit';
import { ResponseDTO, WDHttp } from 'wdNetwork';
import HashMap from '@ohos.util.HashMap';
import { HttpUrlUtils } from '../network/HttpUrlUtils';
const TAG = "SearcherAboutDataModel"
/**
* 我的页面 所有数据 获取封装类
*/
class SearcherAboutDataModel{
private static instance: SearcherAboutDataModel;
private constructor() { }
/**
* 单例模式
* @returns
*/
public static getInstance(): SearcherAboutDataModel {
if (!SearcherAboutDataModel.instance) {
SearcherAboutDataModel.instance = new SearcherAboutDataModel();
}
return SearcherAboutDataModel.instance;
}
/**
* 首页 搜索提示滚动内容
*/
getSearchHintData(context: Context): Promise<string[]> {
return new Promise<string[]>((success, error) => {
Logger.info(TAG, `getSearchHintData start`);
this.fetchSearchHintData().then((navResDTO: ResponseDTO<string[]>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getSearchHintDataLocal(context))
return
}
Logger.info(TAG, "getSearchHintData then,SearchHintDataResDTO.timeStamp:" + navResDTO.timestamp);
let navigationBean = navResDTO.data as string[]
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `fetchSearchHintData catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getSearchHintDataLocal(context))
})
})
}
fetchSearchHintData() {
let url = HttpUrlUtils.getSearchHintDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders();
return WDHttp.get<ResponseDTO<string[]>>(url, headers)
};
async getSearchHintDataLocal(context: Context): Promise<string[]> {
Logger.info(TAG, `getSearchHintDataLocal start`);
let compRes: ResponseDTO<string[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<string[]>>('search_hint_data.json' ,context);
if (!compRes || !compRes.data) {
Logger.info(TAG, `getSearchHintDataLocal compRes is empty`);
return []
}
Logger.info(TAG, `getSearchHintDataLocal compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
}
const searcherAboutDataModel = SearcherAboutDataModel.getInstance()
export default searcherAboutDataModel as SearcherAboutDataModel
\ No newline at end of file
... ...
... ... @@ -28,10 +28,18 @@ export class HttpUrlUtils {
*/
static readonly BOTTOM_NAV_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup";
/**
* 展现page接口
*/
static readonly PAGE_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/pageInfo";
/**
* 展现comp接口
*/
static readonly COMP_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo";
/**
* 推荐内容的展现comp接口
*/
static readonly COMP_REC_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/rec/compInfo";
/**
* 详情页面详情接口
*/
static readonly DETAIL_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail";
... ... @@ -66,6 +74,11 @@ export class HttpUrlUtils {
static readonly FOLLOW_LIST_STATUS_DATA_PATH: string = "/api/rmrb-interact/interact/zh/c/batchAttention/status";
/**
* 个人中心 启用用户 有没有被当前用户点赞状态
*/
static readonly COMMENT_LIST_STATUS_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/batchCommentStatus";
/**
* 个人中心 我的评论列表
*/
static readonly MINE_COMMENT_LIST_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/myCommentList";
... ... @@ -103,6 +116,11 @@ export class HttpUrlUtils {
*/
static readonly APPOINTMENT_OPERATION_STATUS_PATH: string = "/api/live-center-message/zh/c/live/subscribe";
/**
* 首页 搜索提示
*/
static readonly SEARCH_HINT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/hints";
private static hostUrl: string = HttpUrlUtils.HOST_UAT;
static getCommonHeaders(): HashMap<string, string> {
... ... @@ -151,6 +169,10 @@ export class HttpUrlUtils {
return this.hostUrl + this.BOTTOM_NAV_PATH;
}
static getPageUrl(pageId: string) {
return this.hostUrl + this.PAGE_PATH + "?pageId=" + pageId;
}
static getCompInfoUrl(pageId: string, groupId: string, channelId: string, currentPage: number
, pageSize: number) {
let url = this.hostUrl + this.COMP_PATH;
... ... @@ -169,6 +191,24 @@ export class HttpUrlUtils {
return url;
}
static getRecCompInfoUrl(pageId: string, groupId: string, channelId: string, currentPage: number
, pageSize: number) {
let url = this.hostUrl + this.COMP_REC_PATH;
// TODO 暂定只请求第一页,后续对接分页加载,参数再调整 first_load?
url = url + "?channelStrategy=1&loadStrategy=first_load"
+ "&districtCode=" + this.getDistrictCode()
+ "&provinceCode=" + this.getProvinceCode()
+ "&cityCode=" + this.getCityCode()
+ "&refreshTime=" + DateTimeUtils.getCurrentTimeMillis()
+ "&pageId=" + pageId
+ "&groupId=" + groupId
+ "&channelId=" + channelId
+ "&pageSize=" + pageSize
+ "&pageNum=" + currentPage;
// Logger.debug("TAG", 'getCompInfoUrl url: '+url);
return url;
}
static getDetailInfoUrl(relId: string, contentId: string, relType: string) {
let url = this.hostUrl + this.DETAIL_PATH;
url = url + "?relId=" + relId
... ... @@ -208,6 +248,11 @@ export class HttpUrlUtils {
return url
}
static getCommentListStatusDataUrl() {
let url = HttpUrlUtils.hostUrl + HttpUrlUtils.COMMENT_LIST_STATUS_DATA_PATH
return url
}
static getMineCommentListDataUrl() {
let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.MINE_COMMENT_LIST_DATA_PATH
return url
... ... @@ -258,15 +303,20 @@ export class HttpUrlUtils {
return url
}
static getSearchHintDataUrl() {
let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.SEARCH_HINT_DATA_PATH
return url
}
/**
* 预约操作
* 点赞操作
*/
static readonly COMMENT_LIKE_OPERATION_PATH: string = "/api/rmrb-comment/comment/zh/c/commentLike";
/**
* 关注操作
*/
static readonly FOLLOW_OPERATION_PATH: string = "https://pd-apis-sit.pdnews.cn/api/rmrb-interact/interact/zh/c/attention/operation";
static readonly FOLLOW_OPERATION_PATH: string = "/api/rmrb-interact/interact/zh/c/attention/operation";
static getYcgCommonHeaders(): HashMap<string, string> {
let headers: HashMap<string, string> = new HashMap<string, string>()
... ...
... ... @@ -4,6 +4,7 @@ import { PageDTO } from './bean/PageDTO';
import HashMap from '@ohos.util.HashMap';
import { HttpUrlUtils } from '../network/HttpUrlUtils';
import { InteractDataDTO } from './bean/InteractDataDTO';
import { PageInfoDTO } from './bean/PageInfoDTO';
export class PageRepository {
static fetchNavigationDataApi() {
... ... @@ -12,13 +13,26 @@ export class PageRepository {
return WDHttp.get<ResponseDTO<NavigationBodyDTO>>(url, headers)
};
static fetchPageData(pageId: string, groupId: string, channelId: string, currentPage: number
static fetchPageData(pageId: string) {
let url = HttpUrlUtils.getPageUrl(pageId)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<PageInfoDTO>>(url, headers)
};
static fetchCompData(pageId: string, groupId: string, channelId: string, currentPage: number
, pageSize: number) {
let url = HttpUrlUtils.getCompInfoUrl(pageId, groupId, channelId, currentPage, pageSize)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<PageDTO>>(url, headers)
};
static fetchRecCompData(pageId: string, groupId: string, channelId: string, currentPage: number
, pageSize: number) {
let url = HttpUrlUtils.getRecCompInfoUrl(pageId, groupId, channelId, currentPage, pageSize)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<PageDTO>>(url, headers)
};
static fetchDetailData(relId: string, contentId: string, relType: string) {
let url = HttpUrlUtils.getDetailInfoUrl(relId, contentId, relType)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
... ...
import { FullColumnImgUrlsDTO } from './FullColumnImgUrlsDTO';
import { InteractDataDTO } from './InteractDataDTO';
import { LiveInfo } from './LiveInfo'
import { VideoInfo } from './VideoInfo'
import { LiveInfo } from './LiveInfo';
import { VideoInfo } from './VideoInfo';
export interface ContentDTO {
appStyle: string;
cityCode: string;
coverSize: string;
coverType: number;
... ...
import { CompDTO } from './CompDTO';
/**
* Page数据DTO
* compInfo接口返回的Page数据DTO
*/
export interface PageDTO {
pageId: string; // 页面id
... ...
/**
* page接口返回的Page数据DTO
*/
export interface PageInfoDTO {
pageId: string; // 页面id
id: number; // 楼层id
name: string; // 名称
hasAdInfo: number;
hasPopUp: number;
baselineShow: number;
groups: GroupInfoDTO[];
channelInfo: ChannelInfoDTO;
}
export interface ChannelInfoDTO {
channelId: string;
channelLevel: string;
channelName: string;
channelStrategy: string;
channelStyle: string;
pageId: string;
}
export interface GroupInfoDTO {
blockDesc: string;
groupStrategy: number;
id: string;
showType: number;
sortValue: number;
}
\ No newline at end of file
... ...
... ... @@ -71,7 +71,7 @@ export function touchUpPullRefresh(pageModel: PageModel) {
setTimeout(() => {
let self: PageModel = pageModel;
PageViewModel.getPageData(self.pageId, self.groupId, self.channelId, self.currentPage, self.pageSize)
PageViewModel.getPageData(self)
.then((data: PageDTO) => {
if (data == null || data.compList == null || data.compList.length == 0) {
self.hasMore = false;
... ...
... ... @@ -27,7 +27,7 @@ export function touchUpLoadMore(model: PageModel) {
self.isLoading = true;
setTimeout(() => {
closeLoadMore(model);
PageViewModel.getPageData(self.pageId, self.groupId, self.channelId, self.currentPage, self.pageSize)
PageViewModel.getPageData(self)
.then((data: PageDTO) => {
if (data == null || data.compList == null || data.compList.length == 0) {
self.hasMore = false;
... ...
... ... @@ -8,6 +8,8 @@ export default class PageModel {
pageId: string = "";
groupId: string = "";
channelId: string = "";
groupStrategy: number = 0;
isRecGroup: boolean = false;
compList: LazyDataSource<CompDTO> = new LazyDataSource();
// 页面状态,刷新、加载更多等
currentPage: number = 1;
... ...
... ... @@ -7,6 +7,8 @@ import { BaseViewModel } from './BaseViewModel';
import { InteractDataDTO } from '../repository/bean/InteractDataDTO';
import { ContentBean, InteractParam } from '../repository/bean/InteractParam';
import { CompDTO } from '../repository/bean/CompDTO';
import { PageInfoDTO } from '../repository/bean/PageInfoDTO';
import PageModel from './PageModel';
const TAG = 'PageViewModel';
/**
... ... @@ -106,14 +108,34 @@ export class PageViewModel extends BaseViewModel {
return compRes.data
}
async getPageData(pageId: string, groupId: string, channelId: string, currentPage: number
, pageSize: number, context?: Context): Promise<PageDTO> {
Logger.debug(TAG, 'getPageData pageId: ' + pageId);
async getPageInfo(pageId: string): Promise<PageInfoDTO> {
return new Promise<PageInfoDTO>((success, error) => {
PageRepository.fetchPageData(pageId).then((resDTO: ResponseDTO<PageInfoDTO>) => {
if (this.isRespondsInvalid(resDTO, 'getPageInfo')) {
error("getPageInfo data invalid");
return
}
Logger.info(TAG, "getPageInfo then,resDTO.timeStamp:" + resDTO.timestamp);
success(resDTO.data);
});
});
}
async getPageData(pageModel: PageModel, context?: Context): Promise<PageDTO> {
Logger.debug(TAG, 'getPageData pageId: ' + pageModel.pageId);
if (mock_switch) {
return this.getPageData1(currentPage, context);
return this.getPageData1(pageModel.currentPage, context);
}
if (pageModel.isRecGroup) {
return this.parseComp(PageRepository.fetchRecCompData(pageModel.pageId, pageModel.groupId, pageModel.channelId, pageModel.currentPage, pageModel.pageSize))
} else {
return this.parseComp(PageRepository.fetchCompData(pageModel.pageId, pageModel.groupId, pageModel.channelId, pageModel.currentPage, pageModel.pageSize))
}
}
private parseComp(getData: Promise<ResponseDTO<PageDTO>>): Promise<PageDTO> {
return new Promise<PageDTO>((success, error) => {
PageRepository.fetchPageData(pageId, groupId, channelId, currentPage, pageSize)
getData
.then((resDTO: ResponseDTO<PageDTO>) => {
if (this.isRespondsInvalid(resDTO, 'getPageData')) {
error("page data invalid");
... ... @@ -124,6 +146,7 @@ export class PageViewModel extends BaseViewModel {
success(resDTO.data);
return;
}
success(resDTO.data);
// TODO 打开同步请求互动数据,待优化为异步加载
if (CollectionUtils.isEmpty(resDTO.data.compList)) {
success(resDTO.data);
... ... @@ -226,6 +249,7 @@ export class PageViewModel extends BaseViewModel {
}
if (id == content.objectId) {
content.interactData = interactData;
content.interactData.likeNum = 109;
break outer;
}
}
... ...
... ... @@ -33,3 +33,5 @@ export { SystemUtils } from './src/main/ets/utils/SystemUtils'
export { PermissionUtil } from './src/main/ets/utils/PermissionUtil'
export { UserDataLocal } from './src/main/ets/utils/UserDataLocal'
export { NumberFormatterUtils } from './src/main/ets/utils/NumberFormatterUtils'
\ No newline at end of file
... ...
export class NumberFormatterUtils {
/**
* 数据小于一万返回原数据,大于一万保留小数点后一位,加上万字
* @param num
* @returns
*/
static formatNumberWithWan(inputNumber: number | String): string {
const num = typeof inputNumber === 'number' ? inputNumber : Number(inputNumber);
if (isNaN(num) || num < 10000) {
return num.toString();
} else {
const wanUnit = num / 10000;
return `${wanUnit.toFixed(1)}万`;
}
}
}
\ No newline at end of file
... ...
... ... @@ -96,6 +96,14 @@ export class HttpUrlUtils {
*/
static readonly APPOINTMENT_QueryUserDetail_PATH: string = "/api/rmrb-user-center/user/zh/c/queryUserDetail";
/**
* 资料编辑 更新普通用户信息
*/
static readonly APPOINTMENT_editUserDetail_PATH: string = "/api/rmrb-user-center/user/zh/c/editUserDetail";
/**
* 资料编辑 更新普通用户名
*/
static readonly APPOINTMENT_editUserDetail1_PATH: string = "/api/rmrb-user-center/user/zh/c/completeUserInfo";
/**
/**
* 个人中心 关注列表详情
*/
... ...
... ... @@ -33,7 +33,8 @@ export {
batchLikeAndCollectResult,
postExecuteLikeParams,
postExecuteCollectRecordParams,
contentListParams
contentListParams,
postInteractAccentionOperateParams
} from './src/main/ets/bean/detail/MultiPictureDetailPageDTO';
export { InteractParam, ContentBean } from './src/main/ets/bean/content/InteractParam';
... ...
... ... @@ -2,10 +2,11 @@ import { FullColumnImgUrlDTO } from '../detail/FullColumnImgUrlDTO';
import { LiveInfoDTO } from '../detail/LiveInfoDTO';
import { VideoInfoDTO } from '../detail/VideoInfoDTO';
import { InteractDataDTO } from './InteractDataDTO';
import { slideShows } from '../morningevening/slideShows'
import { VoiceInfoDTO } from '../detail/VoiceInfoDTO'
import { slideShows } from '../morningevening/slideShows';
import { VoiceInfoDTO } from '../detail/VoiceInfoDTO';
export interface ContentDTO {
appStyle: string;
cityCode: string;
coverSize: string;
coverType: number;
... ...
... ... @@ -2,11 +2,11 @@
* 批查接口查询互动相关数据,返回数据bean
*/
export interface InteractDataDTO {
collectNum: number;
commentNum: number;
collectNum: number | String;
commentNum: number | String;
contentId: string;
contentType: number;
likeNum: number;
likeNum: number | String;
readNum: number;
shareNum: number;
}
\ No newline at end of file
... ...
... ... @@ -168,3 +168,13 @@ interface contentListItem {
export interface contentListParams {
contentList: contentListItem[];
}
export interface postInteractAccentionOperateParams {
attentionUserType: string;
attentionUserId: string;
attentionCreatorId: string;
// userType: number;
// userId: string;
status: number;
}
\ No newline at end of file
... ...
{
"lockfileVersion": 1,
"meta": {
"stableOrder": true
},
"lockfileVersion": 3,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {},
"packages": {}
"specifiers": {
"@ohos/axios@^2.1.1": "@ohos/axios@2.2.0",
"wdBean@../wdBean": "wdBean@../wdBean",
"wdConstant@../../commons/wdConstant": "wdConstant@../../commons/wdConstant",
"wdJsBridge@../../commons/wdJsBridge": "wdJsBridge@../../commons/wdJsBridge",
"wdKit@../../commons/wdKit": "wdKit@../../commons/wdKit",
"wdLogin@../wdLogin": "wdLogin@../wdLogin",
"wdNetwork@../../commons/wdNetwork": "wdNetwork@../../commons/wdNetwork",
"wdPlayer@../wdPlayer": "wdPlayer@../wdPlayer",
"wdRouter@../../commons/wdRouter": "wdRouter@../../commons/wdRouter",
"wdWebComponent@../../commons/wdWebComponent": "wdWebComponent@../../commons/wdWebComponent"
},
"packages": {
"@ohos/axios@2.2.0": {
"name": "@ohos/axios",
"integrity": "sha512-v1QBWk6DfcN8wUW3D0ieFbHTR1taSI5cOgxp5l6B5cegXuNYhSc8ggKlAIXe6h/14LsfM+NW0ZGfSXcNEIM5yA==",
"resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.2.0.har",
"registryType": "ohpm"
},
"wdBean@../wdBean": {
"name": "wdbean",
"resolved": "../wdBean",
"registryType": "local"
},
"wdConstant@../../commons/wdConstant": {
"name": "wdconstant",
"resolved": "../../commons/wdConstant",
"registryType": "local"
},
"wdJsBridge@../../commons/wdJsBridge": {
"name": "wdjsbridge",
"resolved": "../../commons/wdJsBridge",
"registryType": "local"
},
"wdKit@../../commons/wdKit": {
"name": "wdkit",
"resolved": "../../commons/wdKit",
"registryType": "local"
},
"wdLogin@../wdLogin": {
"name": "wdlogin",
"resolved": "../wdLogin",
"registryType": "local",
"dependencies": {
"wdConstant": "file:../../commons/wdConstant",
"wdKit": "file:../../commons/wdKit",
"wdWebComponent": "file:../../commons/wdWebComponent",
"wdBean": "file:../../features/wdBean",
"wdRouter": "file:../../commons/wdRouter",
"wdNetwork": "file:../../commons/wdNetwork"
}
},
"wdNetwork@../../commons/wdNetwork": {
"name": "wdnetwork",
"resolved": "../../commons/wdNetwork",
"registryType": "local",
"dependencies": {
"wdConstant": "file:../wdConstant",
"wdKit": "file:../wdKit",
"@ohos/axios": "^2.1.1"
}
},
"wdPlayer@../wdPlayer": {
"name": "wdplayer",
"resolved": "../wdPlayer",
"registryType": "local",
"dependencies": {
"wdKit": "file:../../commons/wdKit"
}
},
"wdRouter@../../commons/wdRouter": {
"name": "wdrouter",
"resolved": "../../commons/wdRouter",
"registryType": "local",
"dependencies": {
"wdKit": "file:../wdKit",
"wdBean": "file:../../features/wdBean"
}
},
"wdWebComponent@../../commons/wdWebComponent": {
"name": "wdwebcomponent",
"resolved": "../../commons/wdWebComponent",
"registryType": "local",
"dependencies": {
"wdConstant": "file:../wdConstant",
"wdKit": "file:../wdKit",
"wdJsBridge": "file:../wdJsBridge",
"wdBean": "file:../../features/wdBean",
"wdRouter": "file:../wdRouter"
}
}
}
}
\ No newline at end of file
... ...
import { CommonConstants } from 'wdConstant';
import { Card3Component } from './cardview/Card3Component';
import { Card2Component } from './cardview/Card2Component';
import { Card4Component } from './cardview/Card4Component';
import { ContentDTO } from 'wdBean';
import { Card5Component } from './cardview/Card5Component';
import { Card6Component } from './cardview/Card6Component';
/**
* card适配器,卡片样式汇总,依据ContentDTO#appStyle
* 卡片样式,最小单元样式布局
*/
@Component
export struct CardParser {
@State contentDTO: ContentDTO = {} as ContentDTO;
build() {
this.contentBuilder(this.contentDTO);
}
@Builder
contentBuilder(contentDTO: ContentDTO) {
if (contentDTO.appStyle === '2') {
Card2Component({ contentDTO })
} else if (contentDTO.appStyle === '3') {
Card3Component({ contentDTO })
} else if (contentDTO.appStyle === "4") {
Card4Component({ contentDTO })
} else if (contentDTO.appStyle === "5") {
Card5Component({ contentDTO })
} else if (contentDTO.appStyle === "6") {
Card6Component({ contentDTO })
}
else {
// todo:组件未实现 / Component Not Implemented
Text(contentDTO.appStyle)
.width(CommonConstants.FULL_PARENT)
.padding(10)
// .backgroundColor(Color.Brown) // 展示本页未实现的compStyle
}
}
}
\ No newline at end of file
... ...
... ... @@ -23,6 +23,7 @@ import { CompStyle_10 } from './view/CompStyle_10'
/**
* comp适配器.
* 首页楼层comp解析器.
*/
@Preview
@Component
... ...
... ... @@ -5,9 +5,6 @@ const TAG = 'MultiPictureDetailPageComponent';
@Component
export struct MultiPictureDetailItemComponent {
private photoListLength: number = 1;
private index: number = 1;
private newsTitle: string = '';
private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean
... ... @@ -28,45 +25,6 @@ export struct MultiPictureDetailItemComponent {
.height('100%')
.width('100%')
Row() {
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.Start
}) {
Text() {
Span(`${this.index + 1}`).fontSize(24).fontFamily('PingFang SC-Medium').fontWeight(500).lineHeight(28)
Span(`/${this.photoListLength}`).fontSize(14).fontFamily('PingFang SC-Medium').fontWeight(500).lineHeight(19)
}.fontColor(Color.White).margin(4)
Text(`${this.newsTitle}`).fontColor(Color.White).fontSize(16).fontFamily('PingFang SC-Semibold')
.fontWeight(600).lineHeight(24)
.margin ({
top: 4,
left: 0,
bottom: 4,
right: 0
})
Text(`${this.MultiPictureDetailItem.picDesc}`).fontColor(Color.White)
.fontSize(14).fontFamily('PingFang SC-Regular').fontWeight(400).lineHeight(22)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin ({
top: 4,
left: 0,
bottom: 4,
right: 18
})
}
}
.width('100%')
.height(178)
.margin ({
top: 8,
left: 18,
bottom: 8,
right: 18
})
}
.backgroundColor(Color.Black)
.width('100%')
... ...
import { Logger } from 'wdKit';
import { ContentDetailDTO, PhotoListBean, postInteractBrowsOperateParams, postBatchAttentionStatusParams } from 'wdBean';
import {
ContentDetailDTO,
PhotoListBean,
postInteractBrowsOperateParams,
postBatchAttentionStatusParams,
postInteractAccentionOperateParams
} from 'wdBean';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import display from '@ohos.display';
import font from '@ohos.font';
... ... @@ -7,6 +13,8 @@ import { OperRowListView } from './view/OperRowListView';
import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent';
import { DateTimeUtils } from 'wdKit/Index';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { PageRepository } from '../repository/PageRepository';
const TAG = 'MultiPictureDetailPageComponent';
... ... @@ -19,7 +27,7 @@ export struct MultiPictureDetailPageComponent {
private screenWidth: number = 0
private picWidth: number = 0
@State picHeight: number = 0
@State contentDetailData: ContentDetailDTO[] = [] as ContentDetailDTO[]
@State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01'
private swiperController: SwiperController = new SwiperController()
@State swiperIndex: number = 0;
... ... @@ -58,10 +66,10 @@ export struct MultiPictureDetailPageComponent {
build() {
RelativeContainer() {
if (this.contentDetailData && this.contentDetailData.length > 0 && this.contentDetailData[0].photoList && this.contentDetailData[0].photoList?.length > 0) {
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) {
Swiper(this.swiperController) {
ForEach(this.contentDetailData[0].photoList, (item: PhotoListBean, index: number) => {
MultiPictureDetailItemComponent({ photoListLength: this.contentDetailData[0].photoList?.length , index: index, newsTitle: this.contentDetailData[0].newsTitle, MultiPictureDetailItem: item })
ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => {
MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })
})
}
.index(this.swiperIndex)
... ... @@ -80,9 +88,131 @@ export struct MultiPictureDetailPageComponent {
.onChange((index: number) => {
this.swiperIndex = index
})
if(this.contentDetailData.rmhPlatform == 1) {
Row() {
Row(){
Row({space: 8}) {
Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl)
.borderRadius('50%')
.alt($r('app.media.picture_loading'))
.width(36)
.height(36)
.objectFit(ImageFit.Fill)
.interpolation(ImageInterpolation.High)
}
.width('13%')
.height('100%')
Row() {
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.Start
}) {
Text(`${this.contentDetailData?.rmhInfo?.rmhName}`)
.fontColor(Color.White)
.fontSize(14)
.fontFamily('PingFang PingFang SC-Medium')
.fontWeight(500)
.lineHeight(17)
.margin(0)
Text(`${this.contentDetailData?.rmhInfo?.rmhDesc}`)
.fontColor('#676767')
.fontSize(12)
.fontFamily('PingFang SC-Regular')
.fontWeight(400)
.lineHeight(14)
.textOverflow({ overflow: TextOverflow.Clip })
.margin (0)
}
}
.width('81%')
.height('100%')
}
.width('74.4%')
.height('100%')
.margin({
top: 0,
bottom: 0,
left: 16,
right:0
})
if(this.followStatus == '0') {
Row(){
Button('+关注', { type: ButtonType.Normal, stateEffect: true })
.borderRadius(4)
.backgroundColor('#ED2800')
.width(48)
.height(24)
.onClick(() => {
this.handleAccention()
})
.margin({
top: 10,
bottom: 10,
left: 16,
right:16
})
.fontSize(12)
.fontColor(Color.White)
}
.width('21.6%')
.height('100%')
}
}
.width('100%')
.height(44)
.alignRules({
top: { anchor: "e_swiper_content", align: VerticalAlign.Top },
middle: { anchor: "e_swiper_content", align: HorizontalAlign.Center }
})
.id('e_attention')
}
Row() {
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.Start
}) {
Text() {
Span(`${this.swiperIndex + 1}`).fontSize(24).fontFamily('PingFang SC-Medium').fontWeight(500).lineHeight(28)
Span(`/${this.contentDetailData.photoList.length}`).fontSize(14).fontFamily('PingFang SC-Medium').fontWeight(500).lineHeight(19)
}.fontColor(Color.White).margin(4)
Text(`${this.contentDetailData.newsTitle}`).fontColor(Color.White).fontSize(16).fontFamily('PingFang SC-Semibold')
.fontWeight(600).lineHeight(24)
.margin ({
top: 4,
left: 0,
bottom: 4,
right: 0
})
Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`).fontColor(Color.White)
.fontSize(14).fontFamily('PingFang SC-Regular').fontWeight(400).lineHeight(22)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin ({
top: 4,
left: 0,
bottom: 4,
right: 18
})
.maxLines(3)
}
}
.width('100%')
.height(178)
.margin ({
top: 8,
left: 18,
bottom: 8,
right: 18
})
.id('e_swiper_titles')
.alignRules({
bottom: { anchor: "e_swiper_content", align: VerticalAlign.Bottom },
middle: { anchor: "e_swiper_content", align: HorizontalAlign.Center }
})
OperRowListView({
contentDetailData: this.contentDetailData?.[0],
contentDetailData: this.contentDetailData,
})
.alignRules({
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
... ... @@ -92,6 +222,7 @@ export struct MultiPictureDetailPageComponent {
.border({ width: {top: 0.5}, color: '#FFFFFF' })
.id('e_oper_row')
}
}
.width('100%')
.height('100%')
.backgroundColor(Color.Black)
... ... @@ -101,7 +232,7 @@ export struct MultiPictureDetailPageComponent {
private async getContentDetailData() {
try {
let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType)
this.contentDetailData = data;
this.contentDetailData = data?.[0];
Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`)
} catch (exception) {
... ... @@ -115,12 +246,12 @@ export struct MultiPictureDetailPageComponent {
delStatus: 0,
contentList: [{
browseTime: DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN),
contentId: this.contentDetailData?.[0].newsId + '',
contentType: this.contentDetailData?.[0].newsType || 0,
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType || 0,
}]
}
MultiPictureDetailViewModel.getInteractBrowsOperate(params).then(res => {
console.log('记录浏览历史==', JSON.stringify(res.data))
console.log(TAG, '记录浏览历史==', JSON.stringify(res.data))
})
} catch (exception) {
... ... @@ -131,7 +262,7 @@ export struct MultiPictureDetailPageComponent {
private async getBatchAttentionStatus() {
try {
const params: postBatchAttentionStatusParams = {
creatorIds: [{ creatorId: this.contentDetailData?.[0]?.rmhInfo?.rmhId ?? '' }]
creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }]
}
let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)
this.followStatus = data[0]?.status;
... ... @@ -140,4 +271,31 @@ export struct MultiPictureDetailPageComponent {
}
}
/**
* 关注号主
*/
handleAccention() {
// 未登录,跳转登录
if (!HttpUrlUtils.getUserId()) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
const params: postInteractAccentionOperateParams = {
attentionUserType: this.contentDetailData?.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
attentionUserId: this.contentDetailData?.rmhInfo?.userId || '', // 被关注用户号主id
attentionCreatorId: this.contentDetailData?.rmhInfo?.rmhId || '', // 被关注用户号主id
// userType: 1,
// userId: '1',
status: 1,
}
PageRepository.postInteractAccentionOperate(params).then(res => {
console.log(TAG, '关注号主==', JSON.stringify(res.data))
if (this.followStatus == '1') {
this.followStatus = '0'
} else {
this.followStatus = '1'
}
})
}
}
\ No newline at end of file
... ...
import { CompInfoBean, CompDTO } from 'wdBean'
import { CompInfoBean, CompDTO, CompList } from 'wdBean'
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from '../../utils/ProcessUtils';
/**
* 播报--今日推荐列表
*/
... ... @@ -9,6 +8,12 @@ import { ProcessUtils } from '../../utils/ProcessUtils';
@Component
export struct RecommendLists {
@Prop recommendCompInfoBean: CompInfoBean = {} as CompInfoBean // 推荐-组件信息
recommendDialog: CustomDialogController = new CustomDialogController({
builder: CustomDialogExample({
recommendLists: this.recommendCompInfoBean?.compList
}),
offset: { dx: 0, dy: 0 }
})
build() {
Column(){
... ... @@ -32,7 +37,7 @@ export struct RecommendLists {
.justifyContent(FlexAlign.Center)
.margin({top: 5})
.onClick(() => {
// console.log(1)
this.recommendDialog.open()
})
}
}
... ... @@ -62,9 +67,65 @@ export struct RecommendLists {
ProcessUtils.processPage(item.operDataList[0])
})
}
}
@Builder
recommendListItem() {
@CustomDialog
struct CustomDialogExample {
controller: CustomDialogController
@Prop recommendLists: CompList[]
build() {
Column(){
Text('推荐列表')
.fontSize($r('app.float.selected_text_size'))
.fontWeight(500)
.fontColor($r('app.color.color_323232'))
.height(57)
.width(CommonConstants.FULL_WIDTH)
.padding({left: 16})
Divider()
List(){
ForEach(this.recommendLists, (item: CompDTO, index: number) => {
ListItem(){
this.listItem(item, index)
}
.onClick(() => {
ProcessUtils.processPage(item.operDataList[0])
this.controller.close()
})
})
}.layoutWeight(1)
Divider()
Text('取消')
.fontSize($r('app.float.font_size_16'))
.fontColor($r('app.color.color_323232'))
.width(CommonConstants.FULL_WIDTH)
.height(57)
.textAlign(TextAlign.Center)
.onClick(() => {
this.controller.close()
})
}
.height('80%')
}
@Builder listItem(item: CompDTO,index: number) {
Row(){
Text(String(index+1))
.width(24)
.height(24)
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_48505A'))
Text(item.operDataList[0].newsTitle)
.layoutWeight(1)
.maxLines(1)
.textOverflow({overflow:TextOverflow.Ellipsis})
.margin({left: 16})
.fontSize($r('app.float.font_size_16'))
.fontColor($r('app.color.color_212228'))
}
.width(CommonConstants.FULL_WIDTH)
.height(54)
.padding({left: 16, right: 16})
}
}
\ No newline at end of file
... ...
//全标题 "appStyle":"2",
import { ContentDTO } from 'wdBean';
import { ProcessUtils } from '../../utils/ProcessUtils';
const TAG: string = 'Card2Component';
/**
* 大图卡:
* compstyle:2
* 卡片结构:上下结构
* 卡片宽度:充满父窗口
* 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9:
*/
// @Entry
@Component
export struct Card2Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
build() {
Column() {
Column() {
//新闻标题
Text(this.contentDTO.newsTitle)
.fontSize(17)
.fontColor('#222222')
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
//大图
Stack() {
Image(this.contentDTO.coverUrl)
.borderRadius(4)
//播放状态+时长
Row() {
Image($r('app.media.icon_live'))
.width(22)
.height(18)
Stack() {
Text('直播中')
.fontColor('#FFFFFF')
.fontSize(11)
}
.width(44)
.height(18)
.backgroundColor('#4d000000')
}.margin({ right: 8, bottom: 8 })
}
.width('100%')
.height(192)
.alignContent(Alignment.BottomEnd)
.margin({ top: 8 })
}
.width('100%')
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Start)
.padding({ top: 14 })
//bottom
Row() {
Text(this.contentDTO.source)
.bottomTextStyle()
//间隔点
Image($r('app.media.point'))
.width(12)
.height(12)
Text(this.contentDTO.source)
.bottomTextStyle()
Text(' ')
Text(this.contentDTO.subtitle)
.bottomTextStyle()
}
.width('100%')
.height(18)
.justifyContent(FlexAlign.Start)
// .padding({bottom:14})
.margin({ top: 8 })
}
.width('100%')
.padding({ left: 16, right: 16 })
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
}
}
@Extend(Text)
function bottomTextStyle() {
.fontSize(12)
.fontColor('#B0B0B0')
}
\ No newline at end of file
... ...
import { ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant'
import { DateTimeUtils } from 'wdKit/src/main/ets/utils/DateTimeUtils'
import { ProcessUtils } from '../../utils/ProcessUtils';
/**
* 卡片样式:"appStyle":"3"
*/
@Component
export struct Card3Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
build() {
Column() {
Text(this.contentDTO.newsTitle)
.fontSize($r("app.float.font_size_16"))
.fontColor($r("app.color.color_222222"))
.width(CommonConstants.FULL_WIDTH)
Row() {
Text("锐评")
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_ED2800"))
Text(this.contentDTO.source)
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
.margin({ left: 6 })
Image($r("app.media.point"))
.width(16)
.height(16)
Text(DateTimeUtils.formatDate(Number.parseFloat(this.contentDTO.publishTime)))
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
}.width(CommonConstants.FULL_WIDTH)
.justifyContent(FlexAlign.Start)
.margin({ top: 8 })
}
.width("100%")
.padding({
top: 14,
left: 16,
right: 16,
bottom: 14
})
.backgroundColor($r("app.color.white"))
.margin({ bottom: 8 })
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
}
}
\ No newline at end of file
... ...
//全标题 "appStyle":"4",
import { ContentDTO } from 'wdBean';
import { ProcessUtils } from '../../utils/ProcessUtils';
const TAG: string = 'Card4Component';
/**
* 三图卡:
* compstyle:4
* 卡片结构:上下结构
* 卡片宽度:充满父窗口
* 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9:
*/
@Component
export struct Card4Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
build() {
Column() {
//body
Column() {
//新闻标题
Text(this.contentDTO.newsTitle)
.fontSize(17)
.fontColor('#222222')
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
//三图
Row() {
Image(this.contentDTO.fullColumnImgUrls[0]?.url)
.width('32%')
.height(75)
.borderRadius({ topLeft:4,bottomLeft:4 })
Image(this.contentDTO.fullColumnImgUrls[1]?.url)
.width('32%')
.height(75)
Image(this.contentDTO.fullColumnImgUrls[2]?.url)
.width('32%')
.height(75)
.borderRadius({ topRight:4,bottomRight:4 })
}
.justifyContent(FlexAlign.SpaceBetween)
.width('100%')
.height(75)
.margin({top:8})
.borderRadius(8)
}
.width('100%')
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Start)
.padding({top:14})
.onClick((event: ClickEvent)=>{
ProcessUtils.processPage(this.contentDTO)
})
//bottom
Row() {
Text(this.contentDTO.source)
.bottomTextStyle()
//间隔点
Image($r('app.media.point'))
.width(12)
.height(12)
Text(this.contentDTO.publishTime)
.bottomTextStyle()
Text(' ')
Text('518条评论')
.bottomTextStyle()
}
.width('100%')
.justifyContent(FlexAlign.Start)
// .padding({bottom:14})
.margin({top:8})
.padding({bottom:14})
}
.width('100%')
.padding({top:8,left:16,right:16})
}
}
@Extend(Text) function bottomTextStyle() {
.fontSize(12)
.fontColor('#B0B0B0')
}
\ No newline at end of file
... ...
import { ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from '../../utils/ProcessUtils';
const TAG: string = 'Card5Component';
/**
* 卡片样式:"appStyle":"5"
*/
@Component
export struct Card5Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
build() {
Stack() {
Image(this.contentDTO.coverUrl)
.width(CommonConstants.FULL_WIDTH)
.autoResize(true)
.borderRadius($r('app.float.image_border_radius'))
if (this.contentDTO.newsTitle) {
Row()
.width(CommonConstants.FULL_WIDTH)
.height(59)
.linearGradient({
colors: [
['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]
]
})
Row() {
Text(this.contentDTO.newsTitle)
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.fontColor(Color.White)
.fontSize($r('app.float.normal_text_size'))
.fontWeight(FontWeight.Bold)
.maxLines(2)
.align(Alignment.Bottom)
}
.justifyContent(FlexAlign.Start)
.height(40)
.margin({ left: 12, bottom: 10, right: 12 })
}
}
.alignContent(Alignment.Bottom)
.width(CommonConstants.FULL_WIDTH)
.padding(
{ top: 16, bottom: 16, left: 14, right: 14 })
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
}
}
\ No newline at end of file
... ...
import { ContentDTO } from 'wdBean';
import { CommonConstants, CompStyle } from 'wdConstant';
import { DateTimeUtils } from 'wdKit';
import { ProcessUtils } from '../../utils/ProcessUtils';
const TAG: string = 'Card6Component';
const FULL_PARENT: string = '100%';
/**
* 卡片样式:"appStyle":"6"
*/
@Component
export struct Card6Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
build() {
Row() {
Column() {
Column() {
Text(this.contentDTO.newsTitle)
.fontSize(16)
.fontWeight(FontWeight.Normal)
.maxLines(3)//
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
}.height("80%")
.justifyContent(FlexAlign.Start)
Row() {
if (this.contentDTO.source) {
Text(this.contentDTO.source)
.fontSize($r('app.float.font_size_12'))
.fontColor(Color.Gray)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.width(this.contentDTO.source.length > 8 ? '50%' : '')
Image($r('app.media.point'))
.width(16)
.height(16)
}
if (this.contentDTO.publishTime && this.contentDTO.publishTime.length === 13) {
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))
.fontSize($r('app.float.font_size_12'))
.fontColor(Color.Gray)
}
Text(this.contentDTO.visitorComment + '评')
.fontSize($r('app.float.font_size_12'))
.fontColor(Color.Gray)
.padding({
left: 5
})
}.alignSelf(ItemAlign.Start)
.height("20%")
.justifyContent(FlexAlign.Start)
}
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Start)
.width('58%')
Blank(16)
if (this.contentDTO.coverUrl) {
Stack() {
Image(this.contentDTO.coverUrl)
.borderRadius(5)
.aspectRatio(this.contentDTO.appStyle === CompStyle.Single_ImageCard_03 ? 3 / 2 : 3 / 4)
.height(this.contentDTO.appStyle === CompStyle.Single_ImageCard_03 ? 90 : 180)
if (this.contentDTO.videoInfo) {
Row() {
Image($r('app.media.iv_card_play_yellow_flag'))
.width(22)
.height(18)
Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000))
.fontSize($r('app.float.font_size_13'))
.fontWeight(400)
.fontColor($r('app.color.color_fff'))
}
.alignItems(VerticalAlign.Bottom)
.height(18)
.padding({ right: 4 })
.margin({
right: 4,
bottom: 4
})
.backgroundColor($r('app.color.color_4d000000'))
} else if (this.contentDTO.voiceInfo) {
Row() {
Image($r('app.media.icon_listen'))
.width(22)
.height(18)
Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo
.voiceDuration * 1000))
.fontSize($r('app.float.font_size_13'))
.fontWeight(400)
.fontColor($r('app.color.color_fff'))
}
.alignItems(VerticalAlign.Bottom)
.height(18)
.padding({ right: 4 })
.margin({
right: 4,
bottom: 4
})
.backgroundColor($r('app.color.color_4d000000'))
}
}.alignContent(Alignment.BottomEnd)
}
}
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
.padding(
{ top: 16, bottom: 16, left: 14, right: 14 })
.width(FULL_PARENT)
.height(this.contentDTO.appStyle === CompStyle.Single_ImageCard_03 ? 127 : 217)
.justifyContent(FlexAlign.SpaceBetween)
}
}
\ No newline at end of file
... ...
import { TopNavDTO } from 'wdBean';
import curves from '@ohos.curves';
const INDEX_SETTING_TITLE: string = '首页设置'
const INDEX_SETTING_SUBTITLE: string = '将指定频道设置为首页'
const MY_CHANNEL: string = '我的频道'
const EDIT_TEXT: string = '编辑'
const EDIT_DOWN: string = '完成'
const MY_CHANNEL_TIP1: string = '点击进入频道'
const MY_CHANNEL_TIP2: string = '拖动调整频道顺序'
const MORE_CHANNEL: string = '更多频道'
const LOCAL_CHANNEL: string = '地方频道'
@CustomDialog
struct ChannelDialog {
@State dragItem: number = -1
@State item: number = -1
private dragRefOffsetX: number = 0
private dragRefOffsetY: number = 0
@State offsetX: number = 0
@State offsetY: number = 0
private FIX_VP_X: number = 80
private FIX_VP_Y: number = 48
@State indexSettingTabIndex: number = 0
@State isEditIng: boolean = false
@State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO
@Link currentTopNavSelectedIndex: number
@Link myChannelList: TopNavDTO[]
@Link moreChannelList: TopNavDTO[]
@Link localChannelList: TopNavDTO[]
@Link indexSettingArray: string[]
@Link homeChannelList: TopNavDTO[]
@Link indexSettingChannelId: number
controller?: CustomDialogController
confirm: (index: number) => void = () => {
}
changeChannelIndex : (index1:number, index2:number) => void = ()=>{}
myChannelItemEditHandle = (index: number): void => {
let item = this.myChannelList.splice(index, 1)[0]
if (item.moreChannel === '1') {
this.moreChannelList.unshift(item)
changeChannelIndex: (index1: number, index2: number) => void = () => {
}
if (item.localChannel === '1') {
this.localChannelList.unshift(item)
delChannelItem: (index: number) => void = () => {
}
addChannelItem: (item: TopNavDTO) => void = () => {
}
@Builder
pixelMapBuilder(item: TopNavDTO, index: number) { //拖拽过程样式
Row() {
Row() {
Text(item.name)
.fontSize(14)
.fontColor(this.currentTopNavSelectedIndex === index ? '#ED2800' : (item.homeChannel === '1' || item.movePermitted === 0 ? '#999999' : '#222222'))
aboutToAppear() {
this.currentTopNavSelectedItem = this.myChannelList[this.currentTopNavSelectedIndex]
}
if (this.isEditIng && item.myChannel !== '1') {
Image($r('app.media.icon_audio_close'))
.width(12)
.margin({ left: 1 })
itemMove(index: number, newIndex: number): void {
let targetItem = this.myChannelList[newIndex]
if (!(targetItem?.headlinesOn === 1 || targetItem?.movePermitted === 0 || targetItem?.homeChannel === '1')) {
this.changeChannelIndex(index, newIndex)
}
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
.backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff')
//向下滑
down(index: number): void {
console.info(`向下滑`)
this.offsetY -= this.FIX_VP_Y
this.dragRefOffsetY += this.FIX_VP_Y
this.itemMove(index, index + 4)
}
//向下滑(右下角为空)
down2(index: number): void {
this.offsetY -= this.FIX_VP_Y
this.dragRefOffsetY += this.FIX_VP_Y
this.itemMove(index, index + 4)
}
//向上滑
up(index: number): void {
console.info(`向上滑`)
this.offsetY += this.FIX_VP_Y
this.dragRefOffsetY -= this.FIX_VP_Y
this.itemMove(index, index - 4)
}
//向左滑
left(index: number): void {
console.info(`向左滑`)
this.offsetX += this.FIX_VP_X
this.dragRefOffsetX -= this.FIX_VP_X
this.itemMove(index, index - 1)
}
//向右滑
right(index: number): void {
console.info(`向右滑`)
this.offsetX -= this.FIX_VP_X
this.dragRefOffsetX += this.FIX_VP_X
this.itemMove(index, index + 1)
}
//向右下滑
lowerRight(index: number): void {
console.info(`向右下滑`)
this.offsetX -= this.FIX_VP_X
this.dragRefOffsetX += this.FIX_VP_X
this.offsetY -= this.FIX_VP_Y
this.dragRefOffsetY += this.FIX_VP_Y
this.itemMove(index, index + 5)
}
//向右上滑
upperRight(index: number): void {
console.info(`向右上滑`)
this.offsetX -= this.FIX_VP_X
this.dragRefOffsetX += this.FIX_VP_X
this.offsetY += this.FIX_VP_Y
this.dragRefOffsetY -= this.FIX_VP_Y
this.itemMove(index, index - 3)
}
//向左下滑
lowerLeft(index: number): void {
console.info(`向左下滑`)
this.offsetX += this.FIX_VP_X
this.dragRefOffsetX -= this.FIX_VP_X
this.offsetY -= this.FIX_VP_Y
this.dragRefOffsetY += this.FIX_VP_Y
this.itemMove(index, index + 3)
}
//向左上滑
upperLeft(index: number): void {
console.info(`向左上滑`)
this.offsetX += this.FIX_VP_X
this.dragRefOffsetX -= this.FIX_VP_X
this.offsetY += this.FIX_VP_Y
this.dragRefOffsetY -= this.FIX_VP_Y
this.itemMove(index, index - 5)
}
handleAnimationTo(item: TopNavDTO, event: GestureEvent) {
let index = this.myChannelList.findIndex(ele => ele.num === this.dragItem)
if (!(item.headlinesOn === 1 || item.movePermitted === 0 || item.homeChannel === '1') && this.isEditIng) {
this.offsetY = event.offsetY - this.dragRefOffsetY
this.offsetX = event.offsetX - this.dragRefOffsetX
if (this.offsetY >= this.FIX_VP_Y / 2 && (this.offsetX <= 44 && this.offsetX >= -44)
) {
//向下滑
this.down(index)
} else if (this.offsetY <= -this.FIX_VP_Y / 2 && (this.offsetX <= 44 && this.offsetX >= -44)
) {
//向上滑
this.up(index)
} else if (this.offsetX >= this.FIX_VP_X / 2 && (this.offsetY <= 20 && this.offsetY >= -20)
) {
//向右滑
this.right(index)
} else if (this.offsetX <= -this.FIX_VP_X / 2 && (this.offsetY <= 20 && this.offsetY >= -20)
) {
//向左滑
this.left(index)
} else if (this.offsetX >= this.FIX_VP_X / 2 && this.offsetY >= this.FIX_VP_Y / 2
) {
//向右下滑
this.lowerRight(index)
} else if (this.offsetX >= this.FIX_VP_X / 2 && this.offsetY <= -this.FIX_VP_Y / 2
) {
//向右上滑
this.upperRight(index)
} else if (this.offsetX <= -this.FIX_VP_X / 2 && this.offsetY >= this.FIX_VP_Y / 2
) {
//向左下滑
this.lowerLeft(index)
} else if (this.offsetX <= -this.FIX_VP_X / 2 && this.offsetY <= -this.FIX_VP_Y / 2
) {
//向左上滑
this.upperLeft(index)
} else if (this.offsetX >= this.FIX_VP_X / 2 && this.offsetY >= this.FIX_VP_Y / 2
) {
//向右下滑(右下角为空)
this.down2(index)
}
}
.width('23%')
.height(40)
.border({
width: item.homeChannel === '1' ? 0 : 1,
color: '#EDEDED',
radius: 3
})
}
build() {
Column() {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Image($r('app.media.icon_ren_min_ri_bao'))
.width(72)
... ... @@ -73,7 +189,7 @@ struct ChannelDialog {
})
}
.width('100%')
.padding({ top: 30, bottom: 10 })
.padding({ bottom: 10 })
List() {
... ... @@ -87,6 +203,7 @@ struct ChannelDialog {
Text(INDEX_SETTING_SUBTITLE)
.fontSize(12)
.fontWeight(400)
.fontColor('#222222')
}
.width('100%')
.margin({ top: 22, bottom: 16 })
... ... @@ -95,22 +212,22 @@ struct ChannelDialog {
ListItem() {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
ForEach(this.indexSettingArray, (text: string, index: number) => {
ForEach(this.homeChannelList, (item: TopNavDTO, index: number) => {
Stack() {
Image(this.indexSettingTabIndex === index ? $r('app.media.index_setting_button_active') : $r('app.media.index_setting_button'))
Image(item.channelId === this.indexSettingChannelId ? $r('app.media.index_setting_button_active') : $r('app.media.index_setting_button'))
.objectFit(ImageFit.Auto)
.rotate({
angle: index === 1 ? 180 : 0
})
Row() {
if (index === 0) {
Image(this.indexSettingTabIndex === index ? $r('app.media.recommend_icon') : $r('app.media.recommend_icon_active'))
Image(item.channelId === this.indexSettingChannelId ? $r('app.media.recommend_icon') : $r('app.media.recommend_icon_active'))
.width(20)
}
Text(text)
Text(item.name)
.textAlign(TextAlign.Center)
.fontSize(16)
.fontColor(index === this.indexSettingTabIndex ? '#ffffff' : '#ED2800')
.fontColor(item.channelId === this.indexSettingChannelId ? '#ffffff' : '#ED2800')
}
.width('100%')
.justifyContent(FlexAlign.Center)
... ... @@ -118,7 +235,7 @@ struct ChannelDialog {
.alignContent(Alignment.Start)
.height(36)
.onClick(() => {
this.indexSettingTabIndex = index
AppStorage.set('indexSettingChannelId',item.channelId)
})
})
}
... ... @@ -128,9 +245,17 @@ struct ChannelDialog {
ListItem() {
Row() {
Row() {
Text(MY_CHANNEL)
.fontSize(16)
.fontWeight(600)
.margin({ right: 4 })
Text(!this.isEditIng ? MY_CHANNEL_TIP1 : MY_CHANNEL_TIP2)
.fontSize(12)
.fontWeight(400)
.fontColor('#222222')
}
Text(this.isEditIng ? EDIT_DOWN : EDIT_TEXT)
.fontSize(14)
.fontColor('#ED2800')
... ... @@ -151,9 +276,9 @@ struct ChannelDialog {
Row() {
Text(item.name)
.fontSize(14)
.fontColor(this.currentTopNavSelectedIndex === index ? '#ED2800' : (item.homeChannel === '1' || item.movePermitted === 0 ? '#999999' : '#222222'))
.fontColor(this.currentTopNavSelectedItem.channelId === item.channelId ? '#ED2800' : (item.homeChannel === '1' || item.movePermitted === 0 ? '#999999' : '#222222'))
if (this.isEditIng && item.myChannel !== '1') {
if (this.isEditIng && item.delPermitted === 1) {
Image($r('app.media.icon_audio_close'))
.width(12)
.margin({ left: 1 })
... ... @@ -162,15 +287,14 @@ struct ChannelDialog {
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
.backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '')
.backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff')
.onClick(() => {
if (this.isEditIng) {
if (item.myChannel !== '1') {
this.myChannelItemEditHandle(index)
if (item.delPermitted === 1) {
this.delChannelItem(index)
}
} else {
this.confirm(index)
this.currentTopNavSelectedIndex = index
this.controller?.close()
}
})
... ... @@ -182,6 +306,33 @@ struct ChannelDialog {
color: '#EDEDED',
radius: 3
})
.zIndex(this.dragItem == item.num ? 1 : 0)
.translate(this.dragItem == item.num ? { x: this.offsetX, y: this.offsetY } : { x: 0, y: 0 })
.gesture(
GestureGroup(GestureMode.Sequence,
PanGesture({ fingers: 1, direction: null, distance: 0 })
.onActionStart((event: GestureEvent) => {
this.dragItem = item.num
this.dragRefOffsetX = 0
this.dragRefOffsetY = 0
})
.onActionUpdate((event: GestureEvent) => {
animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {
this.handleAnimationTo(item, event)
})
})
.onActionEnd((event: GestureEvent) => {
animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {
this.dragItem = -1
})
})
)
.onCancel(() => {
animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {
this.dragItem = -1
})
}))
}, (item: TopNavDTO) => JSON.stringify(item))
}
.width('100%')
... ... @@ -189,22 +340,7 @@ struct ChannelDialog {
.columnsTemplate('1fr 1fr 1fr 1fr')
.columnsGap(8)
.rowsGap(8)
.height(Math.ceil(this.myChannelList.length / 4 ) * 48)
.editMode(this.isEditIng)
.supportAnimation(true) //设置Grid是否开启拖拽补位动画
.onItemDragStart((event: ItemDragInfo, itemIndex: number) => {
if(this.myChannelList[itemIndex].headlinesOn===1 || this.myChannelList[itemIndex].movePermitted===0){
return
}else{
return this.pixelMapBuilder(this.myChannelList[itemIndex], itemIndex) //设置拖拽过程中显示的元素。
}
})
.onItemDrop((event: ItemDragInfo, itemIndex: number, insertIndex: number, isSuccess: boolean) => { //绑定此事件的组件可作为拖拽释放目标,当在本组件范围内停止拖拽行为时,触发回调。
if (!isSuccess || insertIndex >= this.myChannelList.length || this.myChannelList[insertIndex].headlinesOn===1 || this.myChannelList[insertIndex].movePermitted===0) {
return
}
this.changeChannelIndex(itemIndex,insertIndex)
})
.height(Math.ceil(this.myChannelList.length / 4) * 48)
}
//更多频道列表
... ... @@ -233,7 +369,7 @@ struct ChannelDialog {
.width('100%').height('100%')
.justifyContent(FlexAlign.Center)
.onClick(() => {
this.myChannelList.push(this.moreChannelList.splice(index, 1)[0])
this.addChannelItem(this.moreChannelList.splice(index, 1)[0])
})
}
.width(80)
... ... @@ -277,7 +413,7 @@ struct ChannelDialog {
.width('100%').height('100%')
.justifyContent(FlexAlign.Center)
.onClick(() => {
this.myChannelList.push(this.localChannelList.splice(index, 1)[0])
this.addChannelItem(this.localChannelList.splice(index, 1)[0])
})
}
.width(80)
... ... @@ -295,9 +431,8 @@ struct ChannelDialog {
}
}.width('100%').height('100%')
}
.padding(15)
.padding({ top: 40, right: 15, bottom: 20, left: 15 })
.backgroundColor('#ffffff')
}
}
... ... @@ -305,18 +440,48 @@ struct ChannelDialog {
// @Entry
@Component
struct ChannelSubscriptionLayout {
changeTab: (index: number) => void = () => {
}
@State indexSettingArray: string [] = ['推荐', '热点']
//当前选中的频道
@Link currentTopNavSelectedIndex: number;
@Prop homeChannelList: TopNavDTO []
@Prop indexSettingChannelId: number
@Link myChannelList: TopNavDTO []
@Link moreChannelList: TopNavDTO []
@Link localChannelList: TopNavDTO []
@Link channelIds: number []
@StorageLink('channelIds') storeChannelIds: string = ''
changeTab: (index: number) => void = () => {
}
//频道弹窗点击切换频道
onAccept = (index: number) => {
console.log(`onAccept${index}`)
this.changeTab(index)
}
//交换我的频道数组中的位置
changeChannelIndex = (index1: number, index2: number) => {
let tmp = this.myChannelList.splice(index1, 1)
let channelIdTmp = this.channelIds.splice(index1, 1)
this.myChannelList.splice(index2, 0, tmp[0])
this.channelIds.splice(index2, 0, channelIdTmp[0])
this.storeChannelIds = this.channelIds.join(',')
}
//删除频道
delChannelItem = (index: number) => {
let item = this.myChannelList.splice(index, 1)[0]
this.channelIds.splice(index, 1)
this.storeChannelIds = this.channelIds.join(',')
if (item.moreChannel === '1') {
this.moreChannelList.unshift(item)
}
if (item.localChannel === '1') {
this.localChannelList.unshift(item)
}
}
// 添加频道
addChannelItem = (item: TopNavDTO) => {
this.channelIds.push(item.channelId)
this.myChannelList.push(item)
this.storeChannelIds = this.channelIds.join(',')
}
// @State currentTopNavSelectedIndex: number = 0
// @State topNavList: TopNavDTO [] = [
// {
... ... @@ -1826,27 +1991,20 @@ struct ChannelSubscriptionLayout {
dialogController: CustomDialogController | null = new CustomDialogController({
builder: ChannelDialog({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
indexSettingArray: $indexSettingArray,
indexSettingChannelId: $indexSettingChannelId,
homeChannelList: $homeChannelList,
myChannelList: $myChannelList,
moreChannelList: $moreChannelList,
localChannelList: $localChannelList,
confirm: this.onAccept,
changeChannelIndex: this.changeChannelIndex
changeChannelIndex: this.changeChannelIndex,
delChannelItem: this.delChannelItem,
addChannelItem: this.addChannelItem
}),
alignment: DialogAlignment.TopEnd,
customStyle: true,
})
changeChannelIndex(index1:number, index2:number) { //交换数组中的位置
const temp = this.myChannelList[index1];
if (index1 > index2) {
this.myChannelList.splice(index2, 0, temp);
this.myChannelList.splice(index1 + 1, 1);
} else {
this.myChannelList.splice(index2 + 1, 0, temp);
this.myChannelList.splice(index1, 1);
}
}
// topNavListHandle() {
// let defaultMyChannelList: TopNavDTO[] = []
// let handledTopNavList = [...this.topNavList]
... ...
import { CustomTitleUI } from '../reusable/CustomTitleUI';
import { EditListInfo, editModel } from '../../model/EditInfoModel';
import { EditListInfo, editModel, editModelParams, WDEditDataModelType } from '../../model/EditInfoModel';
import EditInfoViewModel from '../../viewmodel/EditInfoViewModel';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import {AreaPickerDialog} from '../view/areaPickerDialog/AreaPickerDialog'
import { AreaListModel } from '../../model/AreaListModel';
import router from '@ohos.router';
@Entry
@Component
... ... @@ -18,6 +19,7 @@ struct EditUserInfoPage {
builder: AreaPickerDialog({dataSource:this.dataSource,
confirmCallback:(area:string)=>{
this.currentUserInfo.userExtend.city = area;
this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_region
this.updateEditModel()
}
}),
... ... @@ -31,7 +33,7 @@ struct EditUserInfoPage {
}
onPageShow(){
this.updateUserNameAndIntroduction()
}
build() {
... ... @@ -98,13 +100,15 @@ struct EditUserInfoPage {
.width('100%')
.onClick(()=>{
if (i === 1){
WDRouterRule.jumpWithPage(WDRouterPage.editUserNikeNamePage)
let params: editModelParams = {
editContent: this.currentUserInfo.userName
}
WDRouterRule.jumpWithPage(WDRouterPage.editUserNikeNamePage,params)
}else if (i === 2){
WDRouterRule.jumpWithPage(WDRouterPage.editUserIntroductionPage)
// router.pushUrl({
// url:'pages/EditUserInstoductionPage',
// params:{pageNum:i}
// })
let params: editModelParams = {
editContent: this.currentUserInfo.userExtend.introduction
}
WDRouterRule.jumpWithPage(WDRouterPage.editUserIntroductionPage,params)
}else if (i === 3){
this.dialogController.open()
} else if (i === 4) {
... ... @@ -116,6 +120,7 @@ struct EditUserInfoPage {
onAccept:(value:DatePickerResult) => {
let mon = value.month as number + 1
this.currentUserInfo.userExtend.birthday = value.year+'-'+mon.toString()+'-'+value.day;
this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_birthday
this.updateEditModel()
}
})
... ... @@ -125,6 +130,7 @@ struct EditUserInfoPage {
selected:0,
onAccept:(value:TextPickerResult) => {
this.currentUserInfo.userExtend.sex = value.index.toString();
this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_sex
this.updateEditModel()
}
})
... ... @@ -132,6 +138,28 @@ struct EditUserInfoPage {
})
}
updateUserNameAndIntroduction(){
let backParams:editModelParams = router.getParams() as editModelParams;
if (backParams) {
let userName = backParams.userName as string ///昵称
let introduction = backParams.introduction as string ///简介
if (userName) {
if (userName != this.currentUserInfo.userName) {
this.currentUserInfo.userName = userName;
this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_nickname
this.updateEditModel()
}
} else if (introduction){
if (introduction != this.currentUserInfo.userExtend.introduction ) {
this.currentUserInfo.userExtend.introduction = introduction;
this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_intro
this.updateEditModel()
}
}
}
}
updateEditModel(){
this.listData = []
this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo))
... ...
import { CustomTitleUI } from '../reusable/CustomTitleUI'
import router from '@ohos.router'
import { editModelParams } from '../../model/EditInfoModel'
@Entry
@Component
... ... @@ -7,13 +8,13 @@ struct EditUserIntroductionPage {
@State numCount: number = 0
@State textColor : string = '#222222'
@State introduction: string = ''
@State params:editModelParams = router.getParams() as editModelParams;
build() {
Column(){
CustomTitleUI({titleName:'修改简介'})
Row(){
TextInput({placeholder:'请输入简介'})
TextInput({placeholder:'请输入简介',text:this.params.editContent})
.maxLength(60)
.width('100%')
.height(80)
... ... @@ -50,9 +51,12 @@ struct EditUserIntroductionPage {
.borderRadius(5)
.margin(30)
.onClick(()=>{
let params: editModelParams = {
introduction: this.introduction
}
router.back({
url:'',
params:{nikeName:this.introduction}
params:params
})
})
}
... ...
import { CustomTitleUI } from '../reusable/CustomTitleUI'
import router from '@ohos.router'
import { editModelParams } from '../../model/EditInfoModel'
@Entry
@Component
... ... @@ -8,13 +9,13 @@ struct EditUserNikeNamePage {
@State numCount: number = 0
@State textColor : string = '#222222'
@State nikeName: string = ''
@State params:editModelParams = router.getParams() as editModelParams;
build() {
Column(){
CustomTitleUI({titleName:'修改昵称'})
Row(){
TextInput({placeholder:'请输入昵称'})
TextInput({placeholder:'请输入昵称',text:this.params.editContent})
.width('100%')
.maxLength(16)
.height(50)
... ... @@ -50,9 +51,12 @@ struct EditUserNikeNamePage {
.borderRadius(5)
.margin(30)
.onClick(()=>{
let params: editModelParams = {
userName: this.nikeName
}
router.back({
url:'',
params:{nikeName:this.nikeName}
params:params
})
})
}
... ...
... ... @@ -6,20 +6,27 @@ import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'
const TAG = 'TopNavigationComponent';
PersistentStorage.persistProp('channelIds', '');
PersistentStorage.persistProp('indexSettingChannelId', 0);
/**
* 顶部页签导航栏/顶导
*/
@Component
export struct TopNavigationComponent {
private tabsController: TabsController = new TabsController()
@Prop _currentNavIndex?: number;
@Prop _currentNavIndex: number;
// 顶导当前选中/焦点下标
@State currentTopNavSelectedIndex: number = 0;
// 顶导数据
@State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = []
@State compList: LazyDataSource<CompDTO> = new LazyDataSource();
//我的频道id缓存列表
@StorageProp('indexSettingChannelId') indexSettingChannelId: number = 0
//我的频道id列表
@State channelIds: number[] = []
//本地缓存频道id列表
@StorageProp('channelIds') storageChannelIds: string = ''
@State homeChannelList: TopNavDTO[] = []
// 我的频道列表
@State myChannelList: TopNavDTO[] = []
// 更多频道列表
... ... @@ -28,31 +35,48 @@ export struct TopNavigationComponent {
@State localChannelList: TopNavDTO[] = []
readonly MAX_LINE: number = 1;
//处理接口顶导数据
//处理新闻tab顶导频道数据
topNavListHandle() {
let _channelIds: number [] = []
let _myChannelList: TopNavDTO [] = []
let _storageChannelIds: string [] = [] //list1
let defaultMyChannelList: TopNavDTO[] = []
let handledTopNavList = [...this.topNavList]
handledTopNavList.sort((a, b) => {
let defaultList = [...this.topNavList]
defaultList.sort((a, b) => {
return a.num - b.num;
});
handledTopNavList.forEach(item => {
//defaultMyChannelList
defaultList.forEach(item => {
if (item.defaultPermitted === 1 || item.movePermitted === 0 || item.delPermitted === 0 || item.headlinesOn === 1) {
defaultMyChannelList.push(item);
}
if (item.defaultPermitted === 1) {
this.homeChannelList.push(item)
}
})
//有缓存频道id
if (this.storageChannelIds) {
_storageChannelIds = this.storageChannelIds.split(',')
}
defaultMyChannelList.forEach(item => {
item.myChannel = '1'
if (item.defaultPermitted === 1) {
item.homeChannel = '1'
}
let index = handledTopNavList.findIndex(_item => _item.channelId === item.channelId)
let index = defaultList.findIndex(_item => _item.channelId === item.channelId)
if (index !== -1) {
handledTopNavList.splice(index, 1)
defaultList.splice(index, 1)
}
})
defaultList.unshift(...defaultMyChannelList)
handledTopNavList.unshift(...defaultMyChannelList)
handledTopNavList.forEach((item, index) => {
defaultList.forEach((item, index) => {
if (this.storageChannelIds && _storageChannelIds.includes(String(item.channelId))) {
item.myChannel = '1'
}
if (item.channelType === 2) {
item.localChannel = '1'
}
... ... @@ -66,21 +90,34 @@ export struct TopNavigationComponent {
}
}
//频道分类
if (item.myChannel === '1') {
this.myChannelList.push(item)
}
if (item.moreChannel === '1') {
_myChannelList.push(item)
_channelIds.push(item.channelId)
} else if (item.moreChannel === '1') {
this.moreChannelList.push(item)
}
if (item.localChannel === '1') {
} else if (item.localChannel === '1') {
this.localChannelList.push(item)
}
})
this.channelIds = _channelIds
this.myChannelList = _myChannelList
//缓存首页频道
if (!this.indexSettingChannelId) {
AppStorage.set('indexSettingChannelId', this.homeChannelList[0].channelId)
} else {
let index = this.myChannelList.findIndex(_item => _item.channelId === this.indexSettingChannelId)
this.currentTopNavSelectedIndex = index
}
}
isBroadcast (item: TopNavDTO) {
isBroadcast(item: TopNavDTO) {
return item.name === '播报'
}
build() {
Column() {
// 顶部搜索、日报logo、早晚报
... ... @@ -115,7 +152,7 @@ export struct TopNavigationComponent {
Image($r('app.media.icon_ren_min_ri_bao'))
.width(72)
.height(29)
.onClick((event: ClickEvent) => {
.onClick(() => {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
... ... @@ -154,7 +191,7 @@ export struct TopNavigationComponent {
right: { anchor: "__container__", align: HorizontalAlign.End },
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.onClick((event: ClickEvent) => {
.onClick(() => {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
... ... @@ -168,13 +205,13 @@ export struct TopNavigationComponent {
.width('100%')
.height(40)
.visibility(this._currentNavIndex == 0 ? Visibility.Visible : Visibility.None)
// 频道分类list
Stack({ alignContent: Alignment.TopEnd }) {
Tabs({ controller: this.tabsController }) {
ForEach(this.myChannelList, (navItem: TopNavDTO, index: number) => {
Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) {
ForEach(this._currentNavIndex === 0 ? this.myChannelList : this.topNavList, (navItem: TopNavDTO, index: number) => {
TabContent() {
if(!this.isBroadcast(navItem)) {
if (!this.isBroadcast(navItem)) {
PageComponent({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
navIndex: index,
... ... @@ -191,7 +228,7 @@ export struct TopNavigationComponent {
.vertical(false)
.onChange((index: number) => {
Logger.info(TAG, `onChange index : ${index}`);
if(!this.isBroadcast(this.myChannelList[index])) {
if (!this.isBroadcast(this.myChannelList[index])) {
this.currentTopNavSelectedIndex = index;
} else {
// 跳转到播报页面
... ... @@ -206,17 +243,22 @@ export struct TopNavigationComponent {
this.tabsController.changeIndex(this.currentTopNavSelectedIndex)
}
})
// 分类列表最右侧频道设置
if (this._currentNavIndex === 0) {
ChannelSubscriptionLayout({
changeTab: (index) => {
this.tabsController.changeIndex(index)
},
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
indexSettingChannelId: this.indexSettingChannelId,
homeChannelList: this.homeChannelList,
myChannelList: $myChannelList,
moreChannelList: $moreChannelList,
localChannelList: $localChannelList,
currentTopNavSelectedIndex: $currentTopNavSelectedIndex
channelIds: $channelIds,
changeTab: (index) => {
this.tabsController.changeIndex(index)
}
})
// ChannelSubscriptionLayout()
}
}
}
... ... @@ -255,8 +297,14 @@ export struct TopNavigationComponent {
}
aboutToAppear() {
//处理新闻tab顶导频道数据
if (this._currentNavIndex === 0) {
this.topNavListHandle()
Logger.info(TAG, `aboutToAppear this.topNavList : ${JSON.stringify(this.topNavList)}`);
}
}
aboutToDisappear() {
AppStorage.set('channelIds', this.channelIds.join(','))
}
onTopNavigationDataUpdated() {
... ...
import { CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant'
import { CompDTO, ContentDTO } from 'wdBean';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { CardParser } from '../CardParser';
const TAG: string = 'BigPicCardComponent';
... ... @@ -15,8 +15,22 @@ const TAG: string = 'BigPicCardComponent';
@Component
export struct BigPicCardComponent {
@State compDTO: CompDTO = {} as CompDTO
contentDTO: ContentDTO = {} as ContentDTO;
aboutToAppear() {
// 取第一个数据
this.contentDTO = this.compDTO.operDataList[0];
this.contentDTO.appStyle = "2";
}
build() {
this.cardBuild();
// this.originalBuild();
}
@Builder
originalBuild() {
Column() {
Column() {
... ... @@ -86,10 +100,14 @@ export struct BigPicCardComponent {
}
.width('100%')
.padding({ left: 16, right: 16 })
.onClick((event: ClickEvent) =>{
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.compDTO.operDataList[0])
})
}
@Builder
cardBuild() {
CardParser({ contentDTO: this.contentDTO });
}
}
... ...
import { ToastUtils, Logger } from 'wdKit';
import { ToastUtils, Logger, NumberFormatterUtils } from 'wdKit';
import {
InputMethodProperty,
batchLikeAndCollectResult,
... ... @@ -29,7 +29,7 @@ const TAG = 'OperRowListView';
@Component
export struct OperRowListView {
private contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
private interactData: InteractDataDTO | undefined = undefined
@State interactData: InteractDataDTO = {} as InteractDataDTO
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@State operationList: OperationItem[] = [
... ... @@ -139,7 +139,7 @@ export struct OperRowListView {
middle: { anchor: '__container__', align: HorizontalAlign.Center }
})
.id(`e_row1_${index}`)
if(this.interactData?.likeNum) {
if(this.interactData?.likeNum > 0) {
Row() {
Image($r('app.media.corner_mark'))
.width(25)
... ... @@ -184,7 +184,7 @@ export struct OperRowListView {
middle: { anchor: '__container__', align: HorizontalAlign.Center }
})
.id(`e_row1_${index}`)
if(this.interactData?.collectNum) {
if(this.interactData?.collectNum > 0) {
Row() {
Image($r('app.media.corner_mark'))
.width(25)
... ... @@ -229,7 +229,7 @@ export struct OperRowListView {
middle: { anchor: '__container__', align: HorizontalAlign.Center }
})
.id(`e_row1_${index}`)
if(this.interactData?.commentNum) {
if(this.interactData?.commentNum > 0) {
Row() {
Image($r('app.media.corner_mark'))
.width(25)
... ... @@ -325,12 +325,13 @@ export struct OperRowListView {
}
]
}
console.error(TAG, JSON.stringify(this.contentDetailData))
let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
console.error(TAG, JSON.stringify(data))
console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data))
this.newsStatusOfUser = data[0];
Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
} catch (exception) {
console.error(TAG, JSON.stringify(exception))
}
}
... ... @@ -349,7 +350,7 @@ export struct OperRowListView {
contentType: this.contentDetailData?.newsType + '',
}
PageRepository.postExecuteLike(params).then(res => {
console.log('toggleLikeStatus==',)
console.log(TAG, '点赞、取消点赞', 'toggleLikeStatus==',)
if (this.newsStatusOfUser) {
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'
this.queryContentInteractCount()
... ... @@ -375,7 +376,7 @@ export struct OperRowListView {
}
PageRepository.postExecuteCollectRecord(params).then(res => {
console.log('toggleLikeStatus==',)
console.log(TAG, '收藏、取消收藏','toggleLikeStatus==',)
if (this.newsStatusOfUser) {
this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
this.queryContentInteractCount()
... ... @@ -388,6 +389,7 @@ export struct OperRowListView {
* 查询点赞、收藏数量
*/
queryContentInteractCount() {
console.error(TAG,'contentDetailData2222', JSON.stringify(this.contentDetailData))
const params: contentListParams = {
contentList: [{
contentId: this.contentDetailData?.newsId + '',
... ... @@ -395,12 +397,13 @@ export struct OperRowListView {
}]
}
PageRepository.getContentInteract(params).then(res => {
if (res.data && this.interactData) {
this.interactData.likeNum = res.data[0]?.likeNum
this.interactData.collectNum = res.data[0]?.collectNum
this.interactData.commentNum = res.data[0]?.commentNum
if (res.data) {
this.interactData.likeNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.likeNum)
this.interactData.collectNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.collectNum)
this.interactData.commentNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.commentNum)
}
console.log('获取互动点赞等数据===', JSON.stringify(res))
console.log(TAG, '获取互动点赞等数据===', JSON.stringify(res))
console.log(TAG, 'this.interactData', JSON.stringify(this.interactData))
})
}
}
\ No newline at end of file
... ...
/**
* WDEditDataModelType 更新资料类型
*/
export const enum WDEditDataModelType {
WDEditDataModelType_default, //默认不修改
WDEditDataModelType_head, //头像
WDEditDataModelType_nickname, //昵称
WDEditDataModelType_intro, //简介
WDEditDataModelType_sex, //性别
WDEditDataModelType_birthday, //生日
WDEditDataModelType_region, //地址
}
export class EditListInfo{
//标题
title:string
... ... @@ -42,6 +55,26 @@ export class editModel{
userExtend:EditInfoModel = new EditInfoModel()
constructor(userName?:string , userNameStatus?:string,phone?:string , headPhotoStatus?:string,userExtend?:EditInfoModel) {
editDataType:WDEditDataModelType = 0
constructor(userName?:string , userNameStatus?:string,phone?:string , headPhotoStatus?:string,userExtend?:EditInfoModel,editDataType?:WDEditDataModelType) {
}
}
export interface editModelParams {
editContent?: string;
userName?: string;
introduction?: string;
//地区
city?:string;
county?:string;
province?:string;
//生日
birthday?:string;
//性别
sex?:string;
}
\ No newline at end of file
... ...
... ... @@ -16,7 +16,8 @@ import {
postBatchAttentionStatusResult,
postExecuteLikeParams,
postExecuteCollectRecordParams,
contentListParams
contentListParams,
postInteractAccentionOperateParams
} from 'wdBean';
const TAG = 'HttpRequest';
... ... @@ -104,10 +105,9 @@ export class PageRepository {
}
/**
* 早晚报pageInfo请求 TODO 现网无数据写死测试环境
* 早晚报pageInfo请求
* */
static getMorningEveningPageInfoUrl(pageId: string) {
HttpUrlUtils.hostUrl = HttpUrlUtils.HOST_DEV
let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_PAGE_INFO_PATH;
url = url + "?pageId=" + pageId;
Logger.info(TAG, "getMorningEveningPageInfoUrl url = " + url)
... ... @@ -124,11 +124,10 @@ export class PageRepository {
*
* 可选
* channelId:频道id
* channelStrategy:频道策略 TODO 现网无数据写死测试环境
* channelStrategy:频道策略
* topicId:专题id
* */
static getMorningEveningCompInfoUrl(pageId: number, groupId: number, refreshTime: string, topicId: string, pageNum: number, pageSize: number) {
HttpUrlUtils.hostUrl = HttpUrlUtils.HOST_DEV
let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_COMP_INFO_PATH;
url = url + "?loadStrategy=first_load&pageNum=" + pageNum + "&refreshTime=" + refreshTime + "&pageId="
+ pageId + "&channelStrategy=2&groupId=" + groupId + "&topicId=" + topicId + "&pageSize=" + pageSize;
... ... @@ -231,6 +230,15 @@ export class PageRepository {
return WDHttp.post0(url, params, headers)
}
/**
* 关注号主
*/
static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post0(url, params, headers)
}
static fetchNewspaperInfo(date: string) {
let url = PageRepository.getNewspaperInfoUrl(date)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
... ... @@ -278,7 +286,6 @@ export class PageRepository {
* */
static fetchBroadcastCompInfo(pageId: number, groupId: number, refreshTime: string, topicId:
string, channelId: string) {
HttpUrlUtils.hostUrl = HttpUrlUtils.HOST_DEV
let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_COMP_INFO_PATH;
url = `${url}?topicId=${topicId}&channelStrategy=2&groupId=${groupId}&refreshTime=${refreshTime}&pageSize=50&recommend=0&pageId=${pageId}&loadStrategy=first_load&pageNum=1&channelId=${channelId}`
Logger.info(TAG, "getMorningEveningCompInfoUrl url = " + url)
... ...
import { EditInfoModel, EditListInfo, editModel } from '../model/EditInfoModel';
import { EditInfoModel, EditListInfo, editModel, editModelParams, WDEditDataModelType } from '../model/EditInfoModel';
import HashMap from '@ohos.util.HashMap';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { Logger, ResourcesUtils } from 'wdKit';
... ... @@ -27,6 +27,12 @@ class EditInfoViewModel {
return WDHttp.get<ResponseDTO>(requestUrl,headers)
}
BasePOSTRequest(requestUrl:string){
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders()
requestUrl = HttpUrlUtils.HOST_SIT + requestUrl
return WDHttp.post<ResponseDTO>(requestUrl,headers)
}
getEditListInfo(item?:editModel):EditListInfo[]{
this.editListData = [
... ... @@ -34,8 +40,7 @@ class EditInfoViewModel {
new EditListInfo('简介',item&&item.userExtend.introduction.length > 0?item.userExtend.introduction:'待完善'),
new EditListInfo('地区',item&&item.userExtend.city.length > 0?item.userExtend.city:'待完善'),
new EditListInfo('生日',item&&item.userExtend.birthday.length > 0?item.userExtend.birthday:'待完善'),
new EditListInfo('性别',item&&item.userExtend.sex.length > 0?(item.userExtend.sex=== '1'?'男':'女'):'待完善'),
]
new EditListInfo('性别',item&&item.userExtend.sex.length > 0?(item.userExtend.sex=== '1'?'男':'女'):'待完善'),]
return this.editListData
}
... ... @@ -51,7 +56,6 @@ class EditInfoViewModel {
}).catch((error: Error) => {
Logger.info('EditInfoViewModel','EditInfoViewModel','EditInfoViewModel')
success(this.GetqueryAccountOwnerLocal(context))
})
}))
}
... ... @@ -68,7 +72,7 @@ class EditInfoViewModel {
}
getAreaList(context: Context):PromiseLike<AreaListModel[]>{
return new Promise(((success, error) => {
return new Promise((success, error) => {
success(this.getAreaListLocal(context))
// this.BaseGetRequest(HttpUrlUtils.APPOINTMENT_AccountOwner_PATH).then((navResDTO:ResponseDTO) =>{
// if (navResDTO.code == 200) {
... ... @@ -81,7 +85,7 @@ class EditInfoViewModel {
// success(this.GetqueryAccountOwnerLocal(context))
//
// })
}))
})
}
async getAreaListLocal(context: Context): Promise<AreaListModel[]> {
... ... @@ -99,9 +103,33 @@ class EditInfoViewModel {
return new AreaListManageModel(item.code,item.id,item.label,item.children)
}
updateUserInfo(){
}
// updateUserInfo(item?:editModel):Promise<ResponseDTO> {
// let params: editModelParams = {};
// if (item.editDataType === WDEditDataModelType.WDEditDataModelType_head) {
// // params =
// } else if (item.editDataType === WDEditDataModelType.WDEditDataModelType_nickname) {
// params = { userName: item.userName }
// } else if (item.editDataType === WDEditDataModelType.WDEditDataModelType_intro) {
// params = { introduction: item.userExtend.introduction }
// } else if (item.editDataType === WDEditDataModelType.WDEditDataModelType_sex) {
// params = { sex: item.userExtend.sex }
// } else if (item.editDataType === WDEditDataModelType.WDEditDataModelType_birthday) {
// params = { birthday: item.userExtend.birthday }
// } else if (item.editDataType === WDEditDataModelType.WDEditDataModelType_region) {
// params = { county: item.userExtend.county }
// } else {
// }
// return new Promise((success, error) => {
// this.BasePOSTRequest(HttpUrlUtils.APPOINTMENT_editUserDetail_PATH)
// .then((navResDTO: ResponseDTO) => {
// if (navResDTO.code == 200) {
// }
// })
// .catch((error: Error) => {
//
// })
// })
// }
}
... ...
... ... @@ -127,6 +127,14 @@
{
"name":"color_EEEEEE",
"value": "#EEEEEE"
},
{
"name": "color_323232",
"value": "#323232"
},
{
"name": "color_48505A",
"value": "#48505A"
}
]
}
\ No newline at end of file
... ...
// import router from '@ohos.router';
import mediaquery from '@ohos.mediaquery';
import window from '@ohos.window';
import { ContentDetailDTO, InteractDataDTO, RmhInfoDTO, UserInfoDTO } from 'wdBean';
import { Logger, SPHelper, WindowModel } from 'wdKit';
import { PlayerConstants, WDPlayerController, WDPlayerRenderView } from 'wdPlayer';
import { ContentDetailRequest, devicePLSensorManager } from 'wdDetailPlayApi';
import { PlayControlViewContainer } from '../view/PlayControlViewContainer';
import { PlayerDetailContainer } from '../view/PlayerDetailContainer';
// import { PlayViewModel } from '../viewmodel/PlayViewModel';
import { DetailContainer } from '../view/DetailContainer';
import {
batchLikeAndCollectParams,
batchLikeAndCollectResult,
postBatchAttentionStatusParams
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { HttpUrlUtils } from 'wdNetwork/Index';
const TAG = 'DetailPlayShortVideoPage';
/**
* 详情&短视频播放页面
*/
@Component
export struct DetailPlayShortVideoPage {
// private contentId?: string = undefined
// private relId?: string = undefined
// private relType?: string = undefined
@Provide contentDetailData: ContentDetailDTO | undefined = undefined
@Provide interactData: InteractDataDTO | undefined = undefined
@Prop @Watch('currentIndexChange') currentIndex: number = 0
private index: number = 0
private playerController: WDPlayerController = new WDPlayerController();
// @Watch("urlChanged") @State url?: string = undefined
// @Watch('changeContinue') @Provide nextContId?: string = '';
// @Watch('getPlayHistory') @Provide curContId?: string = undefined;
// @Watch("playVMChanged") @Provide playVM: PlayViewModel = new PlayViewModel();
@Provide isFullScreen: boolean = false;
// @Provide canStart?: boolean = false;
// @Provide status: number = PlayerConstants.STATUS_START;
// @Provide userId: string = '';
// @Provide newsSourceName?: string = ''
// @Provide newsTitle?: string = ''
// @Provide editorName?: string = ''
// @Provide rmhInfo?: RmhInfoDTO | null = null
// @Provide userInfo?: UserInfoDTO | null = null
// @Provide message?: string = ''
// @Provide newsSummary?: string = ''
@Provide progressVal: number = 0;
@Provide videoLandScape?: number = 1; // 视频朝向, 横屏视频:1;竖屏视频:2
@Provide newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@Provide followStatus: string = '0' // 关注状态
// playVMChanged() {
// this.url = this.playVM.url
// this.newsSourceName = this.playVM.newsSourceName
// this.newsTitle = this.playVM.newsTitle
// this.editorName = this.playVM.editorName
// this.newsSummary = this.playVM.newsSummary
// this.videoLandScape = this.playVM.videoLandScape ?? 1
// this.curContId = this.playVM.contentId
// this.nextContId = this.playVM.nextContId
// this.canStart = this.playVM.canStart;
// this.message = this.playVM.message
// this.rmhInfo = this.playVM.rmhInfo
// this.userInfo = this.playVM.userInfo
// console.error('rmhInfo', this.rmhInfo)
// console.error('userInfo', this.userInfo)
// }
currentIndexChange() {
if (this.currentIndex != this.index) {
this.playerController.pause()
if (this.index < this.currentIndex - 5 && this.playerController.getPlayer()) {
this.playerController.release()
}
} else {
console.log('currentIndexChange====1', this.currentIndex)
this.playerController.play()
this.queryNewsInfoOfUser()
}
}
/**
* 查询用户点赞、收藏、关注等状态
*/
queryNewsInfoOfUser() {
if (HttpUrlUtils.getUserId()) {
const params: batchLikeAndCollectParams = {
contentList: [
{
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
}
]
}
// 已登录->查询用户对作品点赞、收藏状态
ContentDetailRequest.postBatchLikeAndCollectStatus(params).then(res => {
console.log('查询点赞、收藏状态==', JSON.stringify(res.data))
if (res.data) {
this.newsStatusOfUser = res.data[0]
}
})
const params1: postBatchAttentionStatusParams = {
creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }]
}
// 已登录->批量查作品是否被号主关注
ContentDetailRequest.postBatchAttentionStatus(params1).then(res => {
console.log('批量查号主是否为用户关注==', JSON.stringify(res.data))
if (res.data) {
this.followStatus = res.data[0]?.status
}
})
}
}
aboutToAppear() {
console.log('开始设置setContentDetailData', JSON.stringify(this.contentDetailData))
// this.playVM.setContentDetailData(this.contentDetailData)
// this.playVMChanged()
this.queryNewsInfoOfUser()
this.playerController.onCanplay = () => {
if (this.index == 0 || this.currentIndex === this.index) {
this.videoLandScape = this.contentDetailData?.videoInfo[0]?.videoLandScape
this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl);
this.playerController.play()
}
}
// 设置播放地址
// this.url = 'https://media.w3.org/2010/05/sintel/trailer.mp4'
let listener = mediaquery.matchMediaSync('(orientation: landscape)');
listener.on("change", (mediaQueryResult) => {
if (mediaQueryResult.matches) {
console.log("横屏 yes")
this.isFullScreen = true
} else {
this.isFullScreen = false
console.log("横屏 no")
}
// WindowModel.shared.setMainWindowFullScreen(this.isFullScreen)
})
}
onPageShow() {
// WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED);
}
aboutToDisappear(): void {
this.playerController?.pause();
}
onPageHide() {
// WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT);
devicePLSensorManager.devicePLSensorOff();
// this.status = PlayerConstants.STATUS_PAUSE;
this.playerController?.pause();
}
@Builder
playerViewContainerBuilder() {
// 播放窗口
WDPlayerRenderView({
playerController: this.playerController,
onLoad: async () => {
console.log('onload==', this.contentId, this.relId, this.relType)
}
})
.height('100%')
.width('100%')
.onClick(() => {
console.error('WDPlayerRenderView=== onClick')
this.playerController?.switchPlayOrPause();
})
}
@Builder
playControlViewContainerBuilder() {
// 播放窗口控制bar
PlayControlViewContainer({
playerController: this.playerController
})
}
@Builder
detailContainerBuilder() {
// DetailTabBarPageComponent({ pageId: this.pageId }).backgroundColor(Color.Black)
DetailContainer({
playerController: this.playerController
})
}
build() {
Row() {
PlayerDetailContainer({
playerView: () => {
this.playerViewContainerBuilder()
}, playControlView: () => {
// this.playControlViewContainerBuilder()
}, detailView: () => {
this.detailContainerBuilder()
}
})
.height('100%')
.width('100%')
.onClick(() => {
console.error('PlayerDetailContainer=== onClick')
this.playerController?.switchPlayOrPause();
})
}
.height('100%')
.width('100%')
.backgroundColor(Color.Black)
}
// 续播判断
// changeContinue() {
// if (this.nextContId) {
// this.playerController.continue = () => {
// this.playerController?.stop();
// // this.playVM.playWithContentId(this.nextContId ?? '');
// }
// return;
// }
// this.playerController.continue = undefined;
// }
// urlChanged() {
// console.error('urlChanged===')
// if (this.url) {
// this.status = PlayerConstants.STATUS_START;
// this.playerController.firstPlay(this.url);
// }
// }
// getPlayHistory() {
// SPHelper.default.get('playHistory', '').then((str) => {
// let result = str.toString();
// let time = 0;
// if (result != null && result != "") {
// let playHistory: Record<string, Record<string, number>> = JSON.parse(result);
// let userData: Record<string, number> = {};
// if (this.userId) {
// userData = playHistory[this.userId] ?? {};
// }
// if (this.curContId) {
// time = userData?.[this.curContId] ?? 0;
// }
// }
// this.playerController?.setStartTime(time);
// }).catch((err: Error) => {
// // Error: Inner error. Error code 15500000
// Logger.error(TAG, 'catch err:' + JSON.stringify(err));
// this.playerController?.setStartTime(0);
// });
// }
}
\ No newline at end of file
@CustomDialog
export struct DetailDialog {
controller: CustomDialogController
@Prop name: string
@Prop title: string
@Prop summary: string
@Link isOpen: boolean
build() {
Column() {
if (this.name + '1222222') {
Text(`@${this.name}` + '1222222')
.fontColor(Color.White)
.fontSize(14)
.fontWeight(600)
.lineHeight(17)
}
if (this.title) {
Text(this.title)
.fontColor(Color.White)
.fontSize(16)
.fontWeight(600)
.margin({ top: 8 })
.lineHeight(24)
}
Text(this.summary)
.fontColor(Color.White)
.fontSize(14)
.fontWeight(400)
.margin({ top: 8 })
.lineHeight(21)
Row() {
Image($r('app.media.ic_close'))
.height(24).margin({ top: 20 }).onClick(() => {
this.controller.close()
if (this.isOpen) {
this.isOpen = !this.isOpen
}
})
}.width('100%').justifyContent(FlexAlign.Center)
}
.width('100%')
.alignItems(HorizontalAlign.Start)
.backgroundColor(Color.Gray)
// .linearGradient({
// direction: GradientDirection.Top, // 渐变方向
// repeating: false, // 渐变颜色是否重复
// colors: [['rgba(0, 0, 0, 0.1)', 0.0], ['rgba(0, 0, 0, 0)', 1.0]] // 数组末尾元素占比小于1时满足重复着色效果
// })
.padding({ top: 20, bottom: 30, left: 16, right: 16 })
}
}
\ No newline at end of file
... ...
... ... @@ -198,7 +198,7 @@ export struct OperationListView {
}.height(60)
}
}.margin({ bottom: 30 })
}.margin({ bottom: 18 })
}
@Builder
... ...
... ... @@ -6,6 +6,7 @@ import { WDPlayerController } from 'wdPlayer';
import { devicePLSensorManager } from 'wdDetailPlayApi';
import { OperationListView } from './OperationListView';
import { ContentDetailDTO, RmhInfoDTO, UserInfoDTO } from 'wdBean/Index';
import { DetailDialog } from './DetailDialog';
@Component
export struct PlayerTitleComment {
... ... @@ -16,8 +17,22 @@ export struct PlayerTitleComment {
@Consume isFullScreen: boolean;
@Consume progressVal: number;
@Consume videoLandScape?: number
@State isOpen: boolean = false
dialogController: CustomDialogController = new CustomDialogController({
builder: DetailDialog({
name: this.getName(),
title: this.getTitle(),
summary: this.getSummary(),
isOpen: this.isOpen
}),
autoCancel: false,
customStyle: true,
alignment: DialogAlignment.Bottom
})
aboutToAppear() {
}
watchSpeed() {
... ... @@ -25,42 +40,50 @@ export struct PlayerTitleComment {
}
getName() {
return this.contentDetailData?.newsSourceName || this.contentDetailData?.editorName
return this.contentDetailData?.newsSourceName || this.contentDetailData?.editorName || ''
}
getTitle() {
return this.contentDetailData?.newsTitle || this.contentDetailData?.newsSummary
return this.contentDetailData?.newsTitle || this.contentDetailData?.newsSummary || ''
}
getSummary() {
return this.contentDetailData?.newsSummary || ''
}
build() {
Column() {
// Column() {
// Row() {
// Image($r('app.media.ic_switch_orientation'))
// .width(34)
// .aspectRatio(1)
// .objectFit(ImageFit.Contain)
// .padding({ left: 10, right: 5 })
// Text("全屏观看")
// .fontColor(Color.White)
// .fontSize('14fp')
// .maxLines(2)
// .layoutWeight(1)
// }
// .width(100)
// .backgroundColor(Color.Gray)
// .borderRadius(10)
// .alignItems(VerticalAlign.Center)
// .visibility(this.videoLandScape == 2 ? Visibility.Hidden : Visibility.Visible)
// .onClick(() => {
// this.isFullScreen = !this.isFullScreen;
// WindowModel.shared.setPreferredOrientation(window.Orientation.LANDSCAPE);
// devicePLSensorManager.devicePLSensorOn(window.Orientation.LANDSCAPE);
// })
// }
// .width('100%')
// // .margin({ bottom: 120 })
// .alignItems(HorizontalAlign.Center)
if (this.contentDetailData?.videoInfo[0]?.videoLandScape === 1) {
Column() {
Row() {
Image($r('app.media.ic_switch_orientation'))
.width(34)
.aspectRatio(1)
.objectFit(ImageFit.Contain)
.padding({ left: 10, right: 5 })
Text("全屏观看")
.fontColor(Color.White)
.fontSize('14fp')
.maxLines(2)
.layoutWeight(1)
}
.width(100)
.backgroundColor(Color.Gray)
.borderRadius(10)
.alignItems(VerticalAlign.Center)
.visibility(this.videoLandScape == 2 ? Visibility.Hidden : Visibility.Visible)
.onClick(() => {
this.isFullScreen = !this.isFullScreen;
WindowModel.shared.setPreferredOrientation(window.Orientation.LANDSCAPE);
devicePLSensorManager.devicePLSensorOn(window.Orientation.LANDSCAPE);
})
}
.width('100%')
// .margin({ bottom: 120 })
.alignItems(HorizontalAlign.Center)
}
Row() {
Column() {
... ... @@ -79,11 +102,22 @@ export struct PlayerTitleComment {
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
if (this.contentDetailData?.newsSummary) {
Text('查看详情 > ')
.margin({ top: 5 })
.margin({ top: 8 })
.padding(6)
.borderRadius(2)
.backgroundColor('#636363')
.fontColor(Color.White)
.fontSize(12)
.maxLines(2)
.onClick(() => {
console.log('click===', this.dialogController?.open)
this.isOpen = true
this.dialogController?.open()
})
}
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
... ... @@ -117,25 +151,7 @@ export struct PlayerTitleComment {
.height(24)
.aspectRatio(1)
.onClick(() => {
if (this.isFullScreen) {
if (deviceInfo.deviceType != "phone") {
WindowModel.shared.getWindowSize().then((size) => {
if (size.width > size.height) {
router.back();
} else {
this.isFullScreen = !this.isFullScreen;
WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT);
devicePLSensorManager.devicePLSensorOn(window.Orientation.PORTRAIT);
}
})
} else {
this.isFullScreen = !this.isFullScreen;
WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT);
devicePLSensorManager.devicePLSensorOn(window.Orientation.PORTRAIT);
}
} else {
router.back();
}
})
TextInput({ placeholder: '说两句...', text: this.comment })
... ... @@ -158,5 +174,8 @@ export struct PlayerTitleComment {
.width('100%')
// .height('40%')
.alignItems(HorizontalAlign.Start)
.opacity(this.isOpen ? 0 : 1)
.animation({ duration: 200 })
}
}
... ...