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