Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
# Conflicts: # sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
Showing
99 changed files
with
2878 additions
and
724 deletions
Too many changes to show.
To preserve performance only 99 of 99+ files are displayed.
| @@ -14,6 +14,7 @@ | @@ -14,6 +14,7 @@ | ||
| 14 | "pages/LaunchPage", | 14 | "pages/LaunchPage", |
| 15 | "pages/LaunchAdvertisingPage", | 15 | "pages/LaunchAdvertisingPage", |
| 16 | "pages/PrivacyPage", | 16 | "pages/PrivacyPage", |
| 17 | - "pages/OtherNormalUserHomePage" | 17 | + "pages/OtherNormalUserHomePage", |
| 18 | + "pages/SearchPage" | ||
| 18 | ] | 19 | ] |
| 19 | -} | 20 | +} |
| 1 | +{ | ||
| 2 | + "code": "0", | ||
| 3 | + "data": [ | ||
| 4 | + { | ||
| 5 | + "hotEntry": "习语", | ||
| 6 | + "mark": 1, | ||
| 7 | + "sequence": 1 | ||
| 8 | + }, | ||
| 9 | + { | ||
| 10 | + "hotEntry": "党史学习教育工作", | ||
| 11 | + "mark": 1, | ||
| 12 | + "sequence": 2 | ||
| 13 | + }, | ||
| 14 | + { | ||
| 15 | + "hotEntry": "2024年全国两会新闻中心启用", | ||
| 16 | + "mark": 1, | ||
| 17 | + "sequence": 3 | ||
| 18 | + }, | ||
| 19 | + { | ||
| 20 | + "hotEntry": "第二艘国产大型邮轮后年底交付", | ||
| 21 | + "mark": 0, | ||
| 22 | + "sequence": 4 | ||
| 23 | + }, | ||
| 24 | + { | ||
| 25 | + "hotEntry": "268名跨境电诈犯罪嫌疑人移交", | ||
| 26 | + "mark": 0, | ||
| 27 | + "sequence": 5 | ||
| 28 | + }, | ||
| 29 | + { | ||
| 30 | + "hotEntry": "高考倒计时100天", | ||
| 31 | + "mark": 2, | ||
| 32 | + "sequence": 6 | ||
| 33 | + }, | ||
| 34 | + { | ||
| 35 | + "hotEntry": "日本开始第四轮核污染水排放", | ||
| 36 | + "mark": 0, | ||
| 37 | + "sequence": 7 | ||
| 38 | + }, | ||
| 39 | + { | ||
| 40 | + "hotEntry": "国台办点名管碧玲", | ||
| 41 | + "mark": 0, | ||
| 42 | + "sequence": 8 | ||
| 43 | + }, | ||
| 44 | + { | ||
| 45 | + "hotEntry": "美方称不会向乌克兰派兵", | ||
| 46 | + "mark": 2, | ||
| 47 | + "sequence": 9 | ||
| 48 | + }, | ||
| 49 | + { | ||
| 50 | + "hotEntry": "电动车乱停乱充电", | ||
| 51 | + "mark": 2, | ||
| 52 | + "sequence": 10 | ||
| 53 | + } | ||
| 54 | + ], | ||
| 55 | + "message": "Success", | ||
| 56 | + "success": true, | ||
| 57 | + "timestamp": 1712631086296 | ||
| 58 | +} |
| @@ -44,4 +44,6 @@ export { FollowFirstTabsComponent } from "./components/page/mine/follow/FollowFi | @@ -44,4 +44,6 @@ export { FollowFirstTabsComponent } from "./components/page/mine/follow/FollowFi | ||
| 44 | 44 | ||
| 45 | export { MyHomeComponent } from "./components/page/mine/home/MyHomeComponent" | 45 | export { MyHomeComponent } from "./components/page/mine/home/MyHomeComponent" |
| 46 | 46 | ||
| 47 | -export { OtherUserHomeComponent } from "./components/page/mine/home/OtherUserHomeComponent" | ||
| 47 | +export { OtherUserHomeComponent } from "./components/page/mine/home/OtherUserHomeComponent" | ||
| 48 | + | ||
| 49 | +export { SearchComponent } from "./components/page/search/SearchComponent" |
| 1 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' | 1 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' |
| 2 | +import RouteManager from '../../utils/RouteManager' | ||
| 2 | /** | 3 | /** |
| 3 | * 首页顶部搜索导航栏 | 4 | * 首页顶部搜索导航栏 |
| 4 | * 竖向滚动实现方案 | 5 | * 竖向滚动实现方案 |
| @@ -61,6 +62,9 @@ export struct FirstTabTopComponent{ | @@ -61,6 +62,9 @@ export struct FirstTabTopComponent{ | ||
| 61 | .backgroundImage($r('app.media.top_search_bg')) | 62 | .backgroundImage($r('app.media.top_search_bg')) |
| 62 | .backgroundImageSize(ImageSize.Cover) | 63 | .backgroundImageSize(ImageSize.Cover) |
| 63 | .alignItems(VerticalAlign.Center) | 64 | .alignItems(VerticalAlign.Center) |
| 65 | + .onClick(()=>{ | ||
| 66 | + RouteManager.jumpNewPage("pages/SearchPage") | ||
| 67 | + }) | ||
| 64 | 68 | ||
| 65 | Image($r('app.media.top_title_bg')) | 69 | Image($r('app.media.top_title_bg')) |
| 66 | .objectFit(ImageFit.Auto) | 70 | .objectFit(ImageFit.Auto) |
| @@ -62,13 +62,15 @@ export struct MinePageComponent { | @@ -62,13 +62,15 @@ export struct MinePageComponent { | ||
| 62 | //Grid 区域 | 62 | //Grid 区域 |
| 63 | MinePagePersonFunctionUI({personalData:$personalData}) | 63 | MinePagePersonFunctionUI({personalData:$personalData}) |
| 64 | //Card | 64 | //Card |
| 65 | - MinePageCardUI() | 65 | + // MinePageCardUI() |
| 66 | //创作者区域 | 66 | //创作者区域 |
| 67 | 67 | ||
| 68 | - MinePageCreatorFunctionUI({creatorData:$creatorData}) | 68 | + // MinePageCreatorFunctionUI({creatorData:$creatorData}) |
| 69 | //更多功能 | 69 | //更多功能 |
| 70 | MinePageMoreFunctionUI({moreData:$moreData}) | 70 | MinePageMoreFunctionUI({moreData:$moreData}) |
| 71 | }.width('100%') | 71 | }.width('100%') |
| 72 | + .height('100%') | ||
| 73 | + .justifyContent(FlexAlign.Start) | ||
| 72 | } | 74 | } |
| 73 | 75 | ||
| 74 | @Styles setFullWidthAndHeight(){ | 76 | @Styles setFullWidthAndHeight(){ |
| 1 | import { CommonConstants, ViewType } from 'wdConstant'; | 1 | import { CommonConstants, ViewType } from 'wdConstant'; |
| 2 | -import { CollectionUtils, Logger } from 'wdKit'; | 2 | +import { CollectionUtils, DateTimeUtils, 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'; |
| @@ -65,7 +65,9 @@ export struct PageComponent { | @@ -65,7 +65,9 @@ export struct PageComponent { | ||
| 65 | CompParser({ compDTO: compDTO, compIndex: compIndex }); | 65 | CompParser({ compDTO: compDTO, compIndex: compIndex }); |
| 66 | } | 66 | } |
| 67 | } | 67 | } |
| 68 | - }) | 68 | + }, |
| 69 | + (compDTO: CompDTO, compIndex: number) => compDTO.id + compIndex.toString() + this.pageModel.timestamp | ||
| 70 | + ) | ||
| 69 | 71 | ||
| 70 | // 加载更多 | 72 | // 加载更多 |
| 71 | ListItem() { | 73 | ListItem() { |
| @@ -136,6 +138,11 @@ export struct PageComponent { | @@ -136,6 +138,11 @@ export struct PageComponent { | ||
| 136 | } else { | 138 | } else { |
| 137 | this.pageModel.hasMore = false; | 139 | this.pageModel.hasMore = false; |
| 138 | } | 140 | } |
| 141 | + PageViewModel.getInteractData(pageDto.compList).then((data: CompDTO[]) => { | ||
| 142 | + // 刷新,替换所有数据 | ||
| 143 | + this.pageModel.compList.replaceAll(...data) | ||
| 144 | + this.pageModel.timestamp = DateTimeUtils.getCurrentTimeMillis().toString() | ||
| 145 | + }) | ||
| 139 | } else { | 146 | } else { |
| 140 | Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.'); | 147 | Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.'); |
| 141 | this.pageModel.viewType = ViewType.EMPTY; | 148 | this.pageModel.viewType = ViewType.EMPTY; |
| 1 | +import router from '@ohos.router' | ||
| 2 | +import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils' | ||
| 3 | +import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel' | ||
| 4 | +import { SearchHistoryItem } from '../../../viewmodel/SearchHistoryItem' | ||
| 5 | +import { SearchHistoryComponent } from './SearchHistoryComponent' | ||
| 6 | +import { SearchHotsComponent } from './SearchHotsComponent' | ||
| 7 | + | ||
| 8 | +const TAG = "SearchComponent" | ||
| 9 | + | ||
| 10 | +@Component | ||
| 11 | +export struct SearchComponent { | ||
| 12 | + @State searchTextData: string[] = [] | ||
| 13 | + @State hasInputContent: boolean = false | ||
| 14 | + @State hasChooseSearch: boolean = false | ||
| 15 | + private swiperController: SwiperController = new SwiperController() | ||
| 16 | + @State searchText: string = '' | ||
| 17 | + controller: TextInputController = new TextInputController() | ||
| 18 | + @State searchHistoryData: SearchHistoryItem[] = [] | ||
| 19 | + scroller: Scroller = new Scroller() | ||
| 20 | + | ||
| 21 | + aboutToAppear() { | ||
| 22 | + //获取提示滚动 | ||
| 23 | + this.getSearchHint() | ||
| 24 | + //获取搜索历史 | ||
| 25 | + this.getSearchHistoryData() | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + getSearchHint() { | ||
| 29 | + SearcherAboutDataModel.getSearchHintData(getContext(this)).then((value) => { | ||
| 30 | + if (value != null) { | ||
| 31 | + this.searchTextData = value | ||
| 32 | + } | ||
| 33 | + }).catch((err: Error) => { | ||
| 34 | + console.log(TAG, JSON.stringify(err)) | ||
| 35 | + }) | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + getSearchHistoryData() { | ||
| 39 | + this.searchHistoryData = SearcherAboutDataModel.getSearchHistoryData() | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + build() { | ||
| 43 | + Column() { | ||
| 44 | + this.searchInputComponent() | ||
| 45 | + if (!this.hasInputContent) { | ||
| 46 | + Scroll(this.scroller) { | ||
| 47 | + Column() { | ||
| 48 | + SearchHistoryComponent({ searchHistoryData: $searchHistoryData }) | ||
| 49 | + | ||
| 50 | + //分隔符 | ||
| 51 | + Divider() | ||
| 52 | + .width('100%') | ||
| 53 | + .height('1lpx') | ||
| 54 | + .color($r('app.color.color_EDEDED')) | ||
| 55 | + .strokeWidth('1lpx') | ||
| 56 | + | ||
| 57 | + SearchHotsComponent() | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + .scrollable(ScrollDirection.Vertical) | ||
| 61 | + .scrollBar(BarState.Off) | ||
| 62 | + .width('100%') | ||
| 63 | + .height('100%') | ||
| 64 | + .padding({ left: '31lpx', right: '31lpx' }) | ||
| 65 | + } else { | ||
| 66 | + if (this.hasChooseSearch) { | ||
| 67 | + //搜索结果 | ||
| 68 | + | ||
| 69 | + //搜索结果为null(空布局 + 为你推荐) | ||
| 70 | + } else { | ||
| 71 | + //联想搜索 | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + }.height('100%') | ||
| 75 | + .width('100%') | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + //搜索框 | ||
| 79 | + @Builder searchInputComponent() { | ||
| 80 | + Row() { | ||
| 81 | + //左 | ||
| 82 | + Stack({ alignContent: Alignment.Start }) { | ||
| 83 | + if (this.searchTextData != null && this.searchTextData.length > 0 && !this.hasInputContent) { | ||
| 84 | + Swiper(this.swiperController) { | ||
| 85 | + ForEach(this.searchTextData, (item: string, index: number) => { | ||
| 86 | + Text(item) | ||
| 87 | + .fontWeight('400lpx') | ||
| 88 | + .fontSize('25lpx') | ||
| 89 | + .fontColor($r('app.color.color_666666')) | ||
| 90 | + .lineHeight('35lpx') | ||
| 91 | + .textAlign(TextAlign.Start) | ||
| 92 | + .maxLines(1) | ||
| 93 | + .textOverflow({ overflow: TextOverflow.Clip }) | ||
| 94 | + .margin({ left: '40lpx' }) | ||
| 95 | + }) | ||
| 96 | + } | ||
| 97 | + .loop(true) | ||
| 98 | + .autoPlay(true) | ||
| 99 | + .interval(3000) | ||
| 100 | + .indicator(false) | ||
| 101 | + .vertical(true) | ||
| 102 | + .enabled(false) | ||
| 103 | + .focusable(false) | ||
| 104 | + } | ||
| 105 | + TextInput({ text: this.searchText, placeholder: '', controller: this.controller }) | ||
| 106 | + .caretColor(Color.Pink) | ||
| 107 | + .fontSize('27lpx') | ||
| 108 | + .fontColor(Color.Black) | ||
| 109 | + .onChange((value: string) => { | ||
| 110 | + this.searchText = value | ||
| 111 | + if (this.searchText.length > 0) { | ||
| 112 | + this.hasInputContent = false | ||
| 113 | + } else { | ||
| 114 | + this.hasInputContent = true | ||
| 115 | + } | ||
| 116 | + }) | ||
| 117 | + .backgroundColor($r('app.color.color_transparent')) | ||
| 118 | + } | ||
| 119 | + .backgroundImage($r('app.media.search_page_input_bg')) | ||
| 120 | + .backgroundImageSize(ImageSize.Cover) | ||
| 121 | + .layoutWeight(1) | ||
| 122 | + .height('69lpx') | ||
| 123 | + | ||
| 124 | + //右 | ||
| 125 | + Text("取消") | ||
| 126 | + .textAlign(TextAlign.Center) | ||
| 127 | + .fontWeight('400lpx') | ||
| 128 | + .fontSize('31lpx') | ||
| 129 | + .lineHeight('58lpx') | ||
| 130 | + .fontColor($r('app.color.color_222222')) | ||
| 131 | + .width('125lpx') | ||
| 132 | + .height('58lpx') | ||
| 133 | + .onClick(() => { | ||
| 134 | + router.back() | ||
| 135 | + // SearcherAboutDataModel.putSearchHistoryData(this.searchText) | ||
| 136 | + // if(StringUtils.isNotEmpty(this.searchText)){ | ||
| 137 | + // if(this.searchHistoryData.length===10){ | ||
| 138 | + // this.searchHistoryData.pop() | ||
| 139 | + // } | ||
| 140 | + // this.searchHistoryData.push(new SearchHistoryItem(this.searchText)) | ||
| 141 | + // } | ||
| 142 | + }) | ||
| 143 | + } | ||
| 144 | + .height('85lpx') | ||
| 145 | + .padding({ left: '31lpx' }) | ||
| 146 | + .alignItems(VerticalAlign.Center) | ||
| 147 | + .margin({ bottom: '36lpx' }) | ||
| 148 | + } | ||
| 149 | +} |
PeopleDaily_Harmony/wdComponent/src/main/ets/components/page/search/SearchHistoryComponent.ets
0 → 100644
| 1 | +import { SearchHistoryItem } from '../../../viewmodel/SearchHistoryItem' | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +/** | ||
| 5 | + * 搜索历史 | ||
| 6 | + */ | ||
| 7 | +@Component | ||
| 8 | +export struct SearchHistoryComponent{ | ||
| 9 | + @Link searchHistoryData:SearchHistoryItem[] | ||
| 10 | + | ||
| 11 | + build(){ | ||
| 12 | + Column(){ | ||
| 13 | + Row(){ | ||
| 14 | + Text("搜索历史") | ||
| 15 | + .textAlign(TextAlign.Center) | ||
| 16 | + .fontWeight('400lpx') | ||
| 17 | + .fontSize('27lpx') | ||
| 18 | + .lineHeight('38lpx') | ||
| 19 | + .fontColor($r('app.color.color_999999')) | ||
| 20 | + .height('38lpx') | ||
| 21 | + | ||
| 22 | + Image($r('app.media.search_delete_icon')) | ||
| 23 | + .height('31lpx') | ||
| 24 | + .width('31lpx') | ||
| 25 | + .objectFit(ImageFit.Auto) | ||
| 26 | + .onClick(()=>{ | ||
| 27 | + //清空记录 | ||
| 28 | + }) | ||
| 29 | + }.justifyContent(FlexAlign.SpaceBetween) | ||
| 30 | + .margin({bottom:'17lpx'}) | ||
| 31 | + .width('100%') | ||
| 32 | + | ||
| 33 | + Grid(){ | ||
| 34 | + ForEach(this.searchHistoryData,(item:SearchHistoryItem,index:number)=>{ | ||
| 35 | + GridItem(){ | ||
| 36 | + Row(){ | ||
| 37 | + Text(`${item.searchContent}`) | ||
| 38 | + .height('23lpx') | ||
| 39 | + .fontColor($r('app.color.color_222222')) | ||
| 40 | + .fontSize('23lpx') | ||
| 41 | + .maxLines(1) | ||
| 42 | + .constraintSize({maxWidth:index%2 === 0?'270lpx':'250lpx'}) | ||
| 43 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 44 | + .textAlign(TextAlign.Start) | ||
| 45 | + | ||
| 46 | + Image($r('app.media.search_item_delete_icon')) | ||
| 47 | + .width('46lpx') | ||
| 48 | + .height('46lpx') | ||
| 49 | + .margin({right:'31lpx',left:'4lpx'}) | ||
| 50 | + .interpolation(ImageInterpolation.Medium) | ||
| 51 | + .objectFit(ImageFit.Auto) | ||
| 52 | + | ||
| 53 | + Blank() | ||
| 54 | + | ||
| 55 | + if(index%2 === 0 && index != this.searchHistoryData.length-1 ){ | ||
| 56 | + Divider() | ||
| 57 | + .width('2lpx') | ||
| 58 | + .height('23lpx') | ||
| 59 | + .color($r('app.color.color_CCCCCC')) | ||
| 60 | + .strokeWidth('2lpx') | ||
| 61 | + .vertical(true) | ||
| 62 | + } | ||
| 63 | + }.height('100%') | ||
| 64 | + .alignItems(VerticalAlign.Center) | ||
| 65 | + .width('100%') | ||
| 66 | + .margin({left:index%2 === 1?'23lpx':'0lpx'}) | ||
| 67 | + }.onClick(()=>{ | ||
| 68 | + }) | ||
| 69 | + .height('46lpx') | ||
| 70 | + }) | ||
| 71 | + } | ||
| 72 | + .height(this.getCategoryViewHeight()) | ||
| 73 | + .rowsTemplate(this.getCategoryRowTmpl()) | ||
| 74 | + .columnsTemplate('1fr 1fr') | ||
| 75 | + .rowsGap('23lpx') | ||
| 76 | + } | ||
| 77 | + .margin({bottom:'46lpx'}) | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + getCategoryRowCount() { | ||
| 81 | + return Math.ceil(this.searchHistoryData.length / 2); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + getCategoryRowTmpl() { | ||
| 85 | + const count = this.getCategoryRowCount(); | ||
| 86 | + const arr: string[] = new Array(count || 1).fill('1fr'); | ||
| 87 | + console.log('tmpl ', arr.join(' ')) | ||
| 88 | + return arr.join(' '); | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + getCategoryViewHeight() { | ||
| 92 | + return `${46 * this.getCategoryRowCount()}lpx`; | ||
| 93 | + } | ||
| 94 | +} |
PeopleDaily_Harmony/wdComponent/src/main/ets/components/page/search/SearchHotsComponent.ets
0 → 100644
| 1 | +import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel' | ||
| 2 | +import { SearchHotContentItem } from '../../../viewmodel/SearchHotContentItem' | ||
| 3 | + | ||
| 4 | +const TAG = "SearchHotsComponent" | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 热门搜索 | ||
| 8 | + */ | ||
| 9 | +@Component | ||
| 10 | +export struct SearchHotsComponent{ | ||
| 11 | + @State searchHotsData:SearchHotContentItem[] = [] | ||
| 12 | + | ||
| 13 | + aboutToAppear(){ | ||
| 14 | + //获取搜索热词 | ||
| 15 | + this.getSearchHotsData() | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + getSearchHotsData(){ | ||
| 19 | + SearcherAboutDataModel.getSearchHotsData(getContext(this)).then((value)=>{ | ||
| 20 | + if(value!=null){ | ||
| 21 | + this.searchHotsData = value | ||
| 22 | + } | ||
| 23 | + }).catch((err:Error)=>{ | ||
| 24 | + console.log(TAG,JSON.stringify(err)) | ||
| 25 | + }) | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + build(){ | ||
| 29 | + Column(){ | ||
| 30 | + Row() { | ||
| 31 | + Image($r('app.media.search_hot_icon')) | ||
| 32 | + .width('46lpx') | ||
| 33 | + .height('46lpx') | ||
| 34 | + .objectFit(ImageFit.Auto) | ||
| 35 | + .margin({right:'8lpx'}) | ||
| 36 | + .interpolation(ImageInterpolation.Medium) | ||
| 37 | + | ||
| 38 | + Text("热门搜索") | ||
| 39 | + .textAlign(TextAlign.Center) | ||
| 40 | + .fontWeight('600lpx') | ||
| 41 | + .fontSize('33lpx') | ||
| 42 | + .lineHeight('46lpx') | ||
| 43 | + .fontColor($r('app.color.color_222222')) | ||
| 44 | + .height('38lpx') | ||
| 45 | + } | ||
| 46 | + .width('100%') | ||
| 47 | + | ||
| 48 | + List(){ | ||
| 49 | + ForEach(this.searchHotsData,(item:SearchHotContentItem,index:number)=>{ | ||
| 50 | + ListItem(){ | ||
| 51 | + Column(){ | ||
| 52 | + Column(){ | ||
| 53 | + Row(){ | ||
| 54 | + Row(){ | ||
| 55 | + if(item.sequence <=3){ | ||
| 56 | + Image(item.sequence===1?$r('app.media.search_hot_num1'):item.sequence===2?$r('app.media.search_hot_num2'):$r('app.media.search_hot_num3')) | ||
| 57 | + .width('27lpx') | ||
| 58 | + .height('35lpx') | ||
| 59 | + .objectFit(ImageFit.Auto) | ||
| 60 | + .margin({right:'12lpx'}) | ||
| 61 | + }else { | ||
| 62 | + Text(`${item.sequence}`) | ||
| 63 | + .height('31lpx') | ||
| 64 | + .fontColor($r('app.color.color_666666')) | ||
| 65 | + .fontSize('27lpx') | ||
| 66 | + .fontWeight('400lpx') | ||
| 67 | + .lineHeight('31lpx') | ||
| 68 | + .margin({right:'12lpx'}) | ||
| 69 | + } | ||
| 70 | + Text(`${item.hotEntry}`) | ||
| 71 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 72 | + .fontColor($r('app.color.color_222222')) | ||
| 73 | + .fontSize('31lpx') | ||
| 74 | + .maxLines(1) | ||
| 75 | + .fontWeight('400lpx') | ||
| 76 | + .lineHeight('42lpx') | ||
| 77 | + }.layoutWeight(1) | ||
| 78 | + if(item.mark!=0){ | ||
| 79 | + Image(item.mark===1?$r('app.media.search_hots_mark1'):$r('app.media.search_hots_mark2')) | ||
| 80 | + .width('42lpx') | ||
| 81 | + .height('31lpx') | ||
| 82 | + .objectFit(ImageFit.Auto) | ||
| 83 | + .interpolation(ImageInterpolation.Medium) | ||
| 84 | + } | ||
| 85 | + }.alignItems(VerticalAlign.Center) | ||
| 86 | + .height('84lpx') | ||
| 87 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 88 | + | ||
| 89 | + if(index != this.searchHotsData.length-1 ){ | ||
| 90 | + Divider() | ||
| 91 | + .width('100%') | ||
| 92 | + .height('1lpx') | ||
| 93 | + .color($r('app.color.color_F5F5F5')) | ||
| 94 | + .strokeWidth('1lpx') | ||
| 95 | + } | ||
| 96 | + }.height('108lpx') | ||
| 97 | + .justifyContent(FlexAlign.Center) | ||
| 98 | + .alignItems(HorizontalAlign.Start) | ||
| 99 | + .padding({left:'27lpx'}) | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + .onClick(()=>{ | ||
| 103 | + }) | ||
| 104 | + .height('117lpx') | ||
| 105 | + }) | ||
| 106 | + }.onScrollFrameBegin((offset, state) => { | ||
| 107 | + return { offsetRemain: 0 } | ||
| 108 | + }).layoutWeight(1) | ||
| 109 | + }.width('100%') | ||
| 110 | + .height('100%') | ||
| 111 | + .margin({top:'46lpx'}) | ||
| 112 | + } | ||
| 113 | +} |
| @@ -35,6 +35,8 @@ export struct BigPicCardComponent { | @@ -35,6 +35,8 @@ export struct BigPicCardComponent { | ||
| 35 | Column() { | 35 | Column() { |
| 36 | 36 | ||
| 37 | Column() { | 37 | Column() { |
| 38 | + // TODO 测试代码 | ||
| 39 | + Text("likeNum " + this.contentDTO?.interactData?.likeNum) | ||
| 38 | //新闻标题 | 40 | //新闻标题 |
| 39 | Text(this.compDTO.operDataList[0].newsTitle) | 41 | Text(this.compDTO.operDataList[0].newsTitle) |
| 40 | .fontSize(17) | 42 | .fontSize(17) |
| @@ -3,6 +3,8 @@ import { Logger, ResourcesUtils } from 'wdKit'; | @@ -3,6 +3,8 @@ import { Logger, ResourcesUtils } from 'wdKit'; | ||
| 3 | import { ResponseDTO, WDHttp } from 'wdNetwork'; | 3 | import { ResponseDTO, WDHttp } from 'wdNetwork'; |
| 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 { SearchHistoryItem } from '../viewmodel/SearchHistoryItem'; | ||
| 7 | +import { SearchHotContentItem } from '../viewmodel/SearchHotContentItem'; | ||
| 6 | const TAG = "SearcherAboutDataModel" | 8 | const TAG = "SearcherAboutDataModel" |
| 7 | 9 | ||
| 8 | /** | 10 | /** |
| @@ -10,6 +12,7 @@ const TAG = "SearcherAboutDataModel" | @@ -10,6 +12,7 @@ const TAG = "SearcherAboutDataModel" | ||
| 10 | */ | 12 | */ |
| 11 | class SearcherAboutDataModel{ | 13 | class SearcherAboutDataModel{ |
| 12 | private static instance: SearcherAboutDataModel; | 14 | private static instance: SearcherAboutDataModel; |
| 15 | + searchHistoryData:SearchHistoryItem[] = [] | ||
| 13 | 16 | ||
| 14 | private constructor() { } | 17 | private constructor() { } |
| 15 | 18 | ||
| @@ -25,6 +28,53 @@ class SearcherAboutDataModel{ | @@ -25,6 +28,53 @@ class SearcherAboutDataModel{ | ||
| 25 | } | 28 | } |
| 26 | 29 | ||
| 27 | /** | 30 | /** |
| 31 | + * 静态搜索历史记录 | ||
| 32 | + */ | ||
| 33 | + getSearchHistoryData():SearchHistoryItem[]{ | ||
| 34 | + if(this.searchHistoryData.length > 0){ | ||
| 35 | + return this.searchHistoryData | ||
| 36 | + } | ||
| 37 | + this.searchHistoryData.push(new SearchHistoryItem("评论")) | ||
| 38 | + this.searchHistoryData.push(new SearchHistoryItem("关注关注")) | ||
| 39 | + this.searchHistoryData.push(new SearchHistoryItem("收藏收藏收藏")) | ||
| 40 | + this.searchHistoryData.push(new SearchHistoryItem("历史")) | ||
| 41 | + this.searchHistoryData.push(new SearchHistoryItem("消息消息消息消息消息")) | ||
| 42 | + this.searchHistoryData.push(new SearchHistoryItem("留言板留言板留言板留言板留言板")) | ||
| 43 | + this.searchHistoryData.push(new SearchHistoryItem("预约")) | ||
| 44 | + return this.searchHistoryData | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + // async putSearchHistoryData(content:string){ | ||
| 48 | + // let history = await SPHelper.default.get(SearcherAboutDataModel.SEARCH_HISTORY_KEY, '[]') as string; | ||
| 49 | + // this.searchHistoryData = JSON.parse(history) | ||
| 50 | + // this.searchHistoryData.push(new SearchHistoryItem(content)) | ||
| 51 | + // await SPHelper.default.save(SearcherAboutDataModel.SEARCH_HISTORY_KEY, JSON.stringify(this.searchHistoryData)); | ||
| 52 | + // } | ||
| 53 | + | ||
| 54 | + // getSearchHistoryData():Promise<SearchHistoryItem[]>{ | ||
| 55 | + // return new Promise<SearchHistoryItem[]>(async (success, error) => { | ||
| 56 | + // if(this.searchHistoryData!=null && this.searchHistoryData.length>0){ | ||
| 57 | + // success(this.searchHistoryData) | ||
| 58 | + // return | ||
| 59 | + // } | ||
| 60 | + // try { | ||
| 61 | + // let history = await SPHelper.default.get(SearcherAboutDataModel.SEARCH_HISTORY_KEY, '') as string; | ||
| 62 | + // console.log('ycg',history); | ||
| 63 | + // }catch (error){ | ||
| 64 | + // console.log('ycg',"1111"); | ||
| 65 | + // } | ||
| 66 | + // | ||
| 67 | + // this.searchHistoryData = JSON.parse(history) | ||
| 68 | + // this.searchHistoryData.push(new SearchHistoryItem("评论")) | ||
| 69 | + // this.searchHistoryData.push(new SearchHistoryItem("关注关注")) | ||
| 70 | + // this.searchHistoryData.push(new SearchHistoryItem("收藏收藏收藏")) | ||
| 71 | + // | ||
| 72 | + // success(this.searchHistoryData) | ||
| 73 | + // }) | ||
| 74 | + // } | ||
| 75 | + | ||
| 76 | + | ||
| 77 | + /** | ||
| 28 | * 首页 搜索提示滚动内容 | 78 | * 首页 搜索提示滚动内容 |
| 29 | */ | 79 | */ |
| 30 | getSearchHintData(context: Context): Promise<string[]> { | 80 | getSearchHintData(context: Context): Promise<string[]> { |
| @@ -62,6 +112,45 @@ class SearcherAboutDataModel{ | @@ -62,6 +112,45 @@ class SearcherAboutDataModel{ | ||
| 62 | return compRes.data | 112 | return compRes.data |
| 63 | } | 113 | } |
| 64 | 114 | ||
| 115 | + /** | ||
| 116 | + * 搜索主页 热词 | ||
| 117 | + */ | ||
| 118 | + getSearchHotsData(context: Context): Promise<SearchHotContentItem[]> { | ||
| 119 | + return new Promise<SearchHotContentItem[]>((success, error) => { | ||
| 120 | + Logger.info(TAG, `getSearchHintData start`); | ||
| 121 | + this.fetchSearchHotsData().then((navResDTO: ResponseDTO<SearchHotContentItem[]>) => { | ||
| 122 | + if (!navResDTO || navResDTO.code != 0) { | ||
| 123 | + success(this.getSearchHotsDataLocal(context)) | ||
| 124 | + return | ||
| 125 | + } | ||
| 126 | + Logger.info(TAG, "getSearchHotsData then,getSearchHotsData.timeStamp:" + navResDTO.timestamp); | ||
| 127 | + let navigationBean = navResDTO.data as SearchHotContentItem[] | ||
| 128 | + success(navigationBean); | ||
| 129 | + }).catch((err: Error) => { | ||
| 130 | + Logger.error(TAG, `getSearchHotsData catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 131 | + success(this.getSearchHotsDataLocal(context)) | ||
| 132 | + }) | ||
| 133 | + }) | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + fetchSearchHotsData() { | ||
| 137 | + let url = HttpUrlUtils.getSearchHotsDataUrl() | ||
| 138 | + let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders(); | ||
| 139 | + return WDHttp.get<ResponseDTO<SearchHotContentItem[]>>(url, headers) | ||
| 140 | + }; | ||
| 141 | + | ||
| 142 | + async getSearchHotsDataLocal(context: Context): Promise<SearchHotContentItem[]> { | ||
| 143 | + Logger.info(TAG, `getSearchHotsDataLocal start`); | ||
| 144 | + let compRes: ResponseDTO<SearchHotContentItem[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<SearchHotContentItem[]>>('search_hots_data.json' ,context); | ||
| 145 | + if (!compRes || !compRes.data) { | ||
| 146 | + Logger.info(TAG, `getSearchHotsDataLocal compRes is empty`); | ||
| 147 | + return [] | ||
| 148 | + } | ||
| 149 | + Logger.info(TAG, `getSearchHotsDataLocal compRes : ${JSON.stringify(compRes)}`); | ||
| 150 | + return compRes.data | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + | ||
| 65 | 154 | ||
| 66 | 155 | ||
| 67 | } | 156 | } |
| @@ -121,6 +121,11 @@ export class HttpUrlUtils { | @@ -121,6 +121,11 @@ export class HttpUrlUtils { | ||
| 121 | */ | 121 | */ |
| 122 | static readonly SEARCH_HINT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/hints"; | 122 | static readonly SEARCH_HINT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/hints"; |
| 123 | 123 | ||
| 124 | + /** | ||
| 125 | + * 搜索主页 热词 | ||
| 126 | + */ | ||
| 127 | + static readonly SEARCH_HOTS_DATA_PATH: string = "/api/rmrb-search-api/zh/c/hots"; | ||
| 128 | + | ||
| 124 | private static hostUrl: string = HttpUrlUtils.HOST_UAT; | 129 | private static hostUrl: string = HttpUrlUtils.HOST_UAT; |
| 125 | 130 | ||
| 126 | static getCommonHeaders(): HashMap<string, string> { | 131 | static getCommonHeaders(): HashMap<string, string> { |
| @@ -308,6 +313,10 @@ export class HttpUrlUtils { | @@ -308,6 +313,10 @@ export class HttpUrlUtils { | ||
| 308 | return url | 313 | return url |
| 309 | } | 314 | } |
| 310 | 315 | ||
| 316 | + static getSearchHotsDataUrl() { | ||
| 317 | + let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.SEARCH_HOTS_DATA_PATH | ||
| 318 | + return url | ||
| 319 | + } | ||
| 311 | 320 | ||
| 312 | /** | 321 | /** |
| 313 | * 点赞操作 | 322 | * 点赞操作 |
| @@ -4,6 +4,8 @@ import { RefreshConstants as Const, RefreshState } from './RefreshConstants'; | @@ -4,6 +4,8 @@ import { RefreshConstants as Const, RefreshState } from './RefreshConstants'; | ||
| 4 | import PageViewModel from '../viewmodel/PageViewModel'; | 4 | import PageViewModel from '../viewmodel/PageViewModel'; |
| 5 | import { PageDTO } from '../repository/bean/PageDTO'; | 5 | import { PageDTO } from '../repository/bean/PageDTO'; |
| 6 | import { touchMoveLoadMore, touchUpLoadMore } from './PullUpLoadMore'; | 6 | import { touchMoveLoadMore, touchUpLoadMore } from './PullUpLoadMore'; |
| 7 | +import { CompDTO } from '../repository/bean/CompDTO'; | ||
| 8 | +import { DateTimeUtils } from 'wdKit/src/main/ets/utils/DateTimeUtils'; | ||
| 7 | 9 | ||
| 8 | export function listTouchEvent(pageModel: PageModel, event: TouchEvent) { | 10 | export function listTouchEvent(pageModel: PageModel, event: TouchEvent) { |
| 9 | switch (event.type) { | 11 | switch (event.type) { |
| @@ -73,6 +75,7 @@ export function touchUpPullRefresh(pageModel: PageModel) { | @@ -73,6 +75,7 @@ export function touchUpPullRefresh(pageModel: PageModel) { | ||
| 73 | 75 | ||
| 74 | PageViewModel.getPageData(self) | 76 | PageViewModel.getPageData(self) |
| 75 | .then((data: PageDTO) => { | 77 | .then((data: PageDTO) => { |
| 78 | + self.timestamp = DateTimeUtils.getCurrentTimeMillis().toString() | ||
| 76 | if (data == null || data.compList == null || data.compList.length == 0) { | 79 | if (data == null || data.compList == null || data.compList.length == 0) { |
| 77 | self.hasMore = false; | 80 | self.hasMore = false; |
| 78 | } else { | 81 | } else { |
| @@ -84,6 +87,11 @@ export function touchUpPullRefresh(pageModel: PageModel) { | @@ -84,6 +87,11 @@ export function touchUpPullRefresh(pageModel: PageModel) { | ||
| 84 | } | 87 | } |
| 85 | // 刷新,替换所有数据 | 88 | // 刷新,替换所有数据 |
| 86 | self.compList.replaceAll(...data.compList) | 89 | self.compList.replaceAll(...data.compList) |
| 90 | + PageViewModel.getInteractData(data.compList).then((data: CompDTO[]) => { | ||
| 91 | + // 刷新,替换所有数据 | ||
| 92 | + self.compList.replaceAll(...data) | ||
| 93 | + self.timestamp = DateTimeUtils.getCurrentTimeMillis().toString() | ||
| 94 | + }) | ||
| 87 | } | 95 | } |
| 88 | closeRefresh(self, true); | 96 | closeRefresh(self, true); |
| 89 | }).catch((err: string | Resource) => { | 97 | }).catch((err: string | Resource) => { |
| @@ -3,6 +3,8 @@ import PageModel from '../viewmodel/PageModel'; | @@ -3,6 +3,8 @@ import PageModel from '../viewmodel/PageModel'; | ||
| 3 | import { RefreshConstants as Const } from './RefreshConstants'; | 3 | import { RefreshConstants as Const } from './RefreshConstants'; |
| 4 | import PageViewModel from '../viewmodel/PageViewModel'; | 4 | import PageViewModel from '../viewmodel/PageViewModel'; |
| 5 | import { PageDTO } from '../repository/bean/PageDTO'; | 5 | import { PageDTO } from '../repository/bean/PageDTO'; |
| 6 | +import { CompDTO } from '../repository/bean/CompDTO'; | ||
| 7 | +import { DateTimeUtils } from 'wdKit'; | ||
| 6 | 8 | ||
| 7 | export function touchMoveLoadMore(model: PageModel, event: TouchEvent) { | 9 | export function touchMoveLoadMore(model: PageModel, event: TouchEvent) { |
| 8 | // list size +1 | 10 | // list size +1 |
| @@ -38,7 +40,13 @@ export function touchUpLoadMore(model: PageModel) { | @@ -38,7 +40,13 @@ export function touchUpLoadMore(model: PageModel) { | ||
| 38 | } else { | 40 | } else { |
| 39 | self.hasMore = false; | 41 | self.hasMore = false; |
| 40 | } | 42 | } |
| 43 | + let sizeBefore = self.compList.size(); | ||
| 41 | self.compList.push(...data.compList) | 44 | self.compList.push(...data.compList) |
| 45 | + PageViewModel.getInteractData(data.compList).then((data: CompDTO[]) => { | ||
| 46 | + // 刷新,替换所有数据 | ||
| 47 | + self.compList.updateItems(sizeBefore, data) | ||
| 48 | + self.timestamp = DateTimeUtils.getCurrentTimeMillis().toString() | ||
| 49 | + }) | ||
| 42 | } | 50 | } |
| 43 | }).catch((err: string | Resource) => { | 51 | }).catch((err: string | Resource) => { |
| 44 | promptAction.showToast({ message: err }); | 52 | promptAction.showToast({ message: err }); |
| @@ -34,4 +34,6 @@ export default class PageModel { | @@ -34,4 +34,6 @@ export default class PageModel { | ||
| 34 | isPullRefreshOperation = false; | 34 | isPullRefreshOperation = false; |
| 35 | isLoading: boolean = false; | 35 | isLoading: boolean = false; |
| 36 | isCanLoadMore: boolean = false; | 36 | isCanLoadMore: boolean = false; |
| 37 | + // keyGenerator相关字符串,用于刷新list布局 | ||
| 38 | + timestamp: String = '1'; | ||
| 37 | } | 39 | } |
| @@ -40,7 +40,7 @@ export class PageViewModel extends BaseViewModel { | @@ -40,7 +40,7 @@ export class PageViewModel extends BaseViewModel { | ||
| 40 | if (mock_switch) { | 40 | if (mock_switch) { |
| 41 | return this.getBottomNavDataMock(context); | 41 | return this.getBottomNavDataMock(context); |
| 42 | } | 42 | } |
| 43 | - return this.getNavData(); | 43 | + return this.getNavData(context); |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | async getBottomNavDataMock(context?: Context): Promise<NavigationBodyDTO> { | 46 | async getBottomNavDataMock(context?: Context): Promise<NavigationBodyDTO> { |
| @@ -54,12 +54,13 @@ export class PageViewModel extends BaseViewModel { | @@ -54,12 +54,13 @@ export class PageViewModel extends BaseViewModel { | ||
| 54 | return compRes.data | 54 | return compRes.data |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | - private getNavData(): Promise<NavigationBodyDTO> { | 57 | + private getNavData(context?: Context): Promise<NavigationBodyDTO> { |
| 58 | return new Promise<NavigationBodyDTO>((success, error) => { | 58 | return new Promise<NavigationBodyDTO>((success, error) => { |
| 59 | Logger.info(TAG, `getNavData start`); | 59 | Logger.info(TAG, `getNavData start`); |
| 60 | PageRepository.fetchNavigationDataApi().then((navResDTO: ResponseDTO<NavigationBodyDTO>) => { | 60 | PageRepository.fetchNavigationDataApi().then((navResDTO: ResponseDTO<NavigationBodyDTO>) => { |
| 61 | if (this.isRespondsInvalid(navResDTO, 'getNavData')) { | 61 | if (this.isRespondsInvalid(navResDTO, 'getNavData')) { |
| 62 | - error("page data invalid"); | 62 | + // error("page data invalid"); |
| 63 | + success(this.getBottomNavDataMock(context)) | ||
| 63 | return | 64 | return |
| 64 | } | 65 | } |
| 65 | Logger.info(TAG, "getNavData then,navResDTO.timeStamp:" + navResDTO.timestamp); | 66 | Logger.info(TAG, "getNavData then,navResDTO.timeStamp:" + navResDTO.timestamp); |
| @@ -147,14 +148,6 @@ export class PageViewModel extends BaseViewModel { | @@ -147,14 +148,6 @@ export class PageViewModel extends BaseViewModel { | ||
| 147 | return; | 148 | return; |
| 148 | } | 149 | } |
| 149 | success(resDTO.data); | 150 | success(resDTO.data); |
| 150 | - // TODO 打开同步请求互动数据,待优化为异步加载 | ||
| 151 | - if (CollectionUtils.isEmpty(resDTO.data.compList)) { | ||
| 152 | - success(resDTO.data); | ||
| 153 | - } else { | ||
| 154 | - this.getInteractData(resDTO.data.compList).then(() => { | ||
| 155 | - success(resDTO.data); | ||
| 156 | - }) | ||
| 157 | - } | ||
| 158 | }) | 151 | }) |
| 159 | .catch((err: Error) => { | 152 | .catch((err: Error) => { |
| 160 | Logger.error(TAG, `getPageData catch, error.name : ${err.name}, error.message:${err.message}`); | 153 | Logger.error(TAG, `getPageData catch, error.name : ${err.name}, error.message:${err.message}`); |
| @@ -249,7 +242,8 @@ export class PageViewModel extends BaseViewModel { | @@ -249,7 +242,8 @@ export class PageViewModel extends BaseViewModel { | ||
| 249 | } | 242 | } |
| 250 | if (id == content.objectId) { | 243 | if (id == content.objectId) { |
| 251 | content.interactData = interactData; | 244 | content.interactData = interactData; |
| 252 | - content.interactData.likeNum = 109; | 245 | + // TODO 测试代码,待删除 |
| 246 | + // content.interactData.likeNum = Math.floor(Math.random() * Math.floor(999));; | ||
| 253 | break outer; | 247 | break outer; |
| 254 | } | 248 | } |
| 255 | } | 249 | } |
| 1 | +export class SearchHistoryItem{ | ||
| 2 | + searchContent:string = "" | ||
| 3 | + searchUserId:string = "" | ||
| 4 | + searchTime:string = "" | ||
| 5 | + | ||
| 6 | + constructor(searchContent: string,searchUserId?:string,searchTime?:string) { | ||
| 7 | + this.searchContent = searchContent | ||
| 8 | + this.searchUserId = searchUserId | ||
| 9 | + this.searchTime = searchTime | ||
| 10 | + } | ||
| 11 | +} |
239 Bytes
627 Bytes
348 Bytes
379 Bytes
408 Bytes
902 Bytes
863 Bytes
PeopleDaily_Harmony/wdComponent/src/main/resources/base/media/search_item_delete_icon.png
0 → 100644
270 Bytes
727 Bytes
| @@ -254,4 +254,10 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | @@ -254,4 +254,10 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | ||
| 254 | sort(comparator: (firstValue: T, secondValue: T) => number): void { | 254 | sort(comparator: (firstValue: T, secondValue: T) => number): void { |
| 255 | this.dataArray.sort(comparator) | 255 | this.dataArray.sort(comparator) |
| 256 | } | 256 | } |
| 257 | + | ||
| 258 | + public updateItems(start: number, data: T[]): void { | ||
| 259 | + // 从数组中的start位置开始删除dataArray.length个元素,并在同一位置插入((1个或多个))新元素。 | ||
| 260 | + this.dataArray.splice(start, this.dataArray.length, ...data); | ||
| 261 | + this.notifyDataReload() | ||
| 262 | + } | ||
| 257 | } | 263 | } |
| @@ -19,8 +19,8 @@ | @@ -19,8 +19,8 @@ | ||
| 19 | { | 19 | { |
| 20 | "name": "default", | 20 | "name": "default", |
| 21 | "signingConfig": "default", | 21 | "signingConfig": "default", |
| 22 | - "compileSdkVersion": "4.0.0(10)", | ||
| 23 | - "compatibleSdkVersion": "4.0.0(10)", | 22 | + "compileSdkVersion": "4.1.0(11)", |
| 23 | + "compatibleSdkVersion": "4.1.0(11)", | ||
| 24 | "runtimeOS": "HarmonyOS", | 24 | "runtimeOS": "HarmonyOS", |
| 25 | } | 25 | } |
| 26 | ], | 26 | ], |
| @@ -9,5 +9,14 @@ export class SpConstants{ | @@ -9,5 +9,14 @@ export class SpConstants{ | ||
| 9 | static USER_LONG_TIME_NO_LOGIN_MARK="longTimeNoLoginMark" | 9 | static USER_LONG_TIME_NO_LOGIN_MARK="longTimeNoLoginMark" |
| 10 | static USER_STATUS="user_status" | 10 | static USER_STATUS="user_status" |
| 11 | static USER_TEMP_TOKEN="tempToken" | 11 | static USER_TEMP_TOKEN="tempToken" |
| 12 | + static USER_PHONE = "user_phone" | ||
| 13 | + //协议相关 | ||
| 14 | + static USER_PROTOCOL = "user_protocol" //用户协议 | ||
| 15 | + static PRIVATE_PROTOCOL = "private_protocol" //隐私协议 | ||
| 16 | + //设置页面 | ||
| 17 | + static SETTING_WIFI_IMAGE_SWITCH = "setting_wifi_switch" //wifi 图片开关 | ||
| 18 | + static SETTING_WIFI_VIDEO_SWITCH = "setting_wifi_switch" //wifi 视频开关 | ||
| 19 | + static SETTING_SUSPENSION_SWITCH = "setting_suspension_switch" //悬浮窗 开关 | ||
| 20 | + static SETTING_PUSH_SWITCH = "setting_push_switch" //推送 开关 | ||
| 12 | 21 | ||
| 13 | } | 22 | } |
| 1 | /** | 1 | /** |
| 2 | * 组件Style/展示样式 | 2 | * 组件Style/展示样式 |
| 3 | */ | 3 | */ |
| 4 | + | ||
| 4 | export const enum CompStyle { | 5 | export const enum CompStyle { |
| 5 | Label_03 = 'Label-03', // 标题卡:icon+文字 | 6 | Label_03 = 'Label-03', // 标题卡:icon+文字 |
| 6 | - Carousel_Layout_01 = 'Zh_Carousel_Layout-01', // 通用轮播卡:视频、直播、活动、专题、榜单、外链 | ||
| 7 | Carousel_Layout_02 = 'Carousel_Layout-02', // 直播轮播卡:直播 | 7 | Carousel_Layout_02 = 'Carousel_Layout-02', // 直播轮播卡:直播 |
| 8 | - Single_Row_01 = 'Zh_Single_Row-01', // 三格方形小卡(排名):专题、活动 | ||
| 9 | - Zh_Single_Row_01 = 'Zh_Single_Row-01', // 横划卡 imageScale-封面图比例 1-4:3, 2-16:9, 3-3:2 | ||
| 10 | Single_Row_02 = 'Zh_Single_Row-02', // 通用横划卡:视频、直播、专题 | 8 | Single_Row_02 = 'Zh_Single_Row-02', // 通用横划卡:视频、直播、专题 |
| 11 | Single_Row_03 = 'Single_Row-03', // 直播横划卡:直播 | 9 | Single_Row_03 = 'Single_Row-03', // 直播横划卡:直播 |
| 12 | Single_Row_04 = 'Single_Row-04', // 三格方形小卡:专题、活动 | 10 | Single_Row_04 = 'Single_Row-04', // 三格方形小卡:专题、活动 |
| @@ -17,17 +15,52 @@ export const enum CompStyle { | @@ -17,17 +15,52 @@ export const enum CompStyle { | ||
| 17 | Single_Column_04 = 'Single_Column-04', // 大卡横屏(带背景):视频、直播 | 15 | Single_Column_04 = 'Single_Column-04', // 大卡横屏(带背景):视频、直播 |
| 18 | Single_Column_05 = 'Single_Column-05', // 海报图卡:/ | 16 | Single_Column_05 = 'Single_Column-05', // 海报图卡:/ |
| 19 | Single_Column_06 = 'Single_Column-06', // 留言板卡:/ | 17 | Single_Column_06 = 'Single_Column-06', // 留言板卡:/ |
| 20 | - Zh_Single_Column_02 = 'Zh_Single_Column-02', // 头图卡 | ||
| 21 | Grid_Layout_01 = 'Grid_Layout-01', // 横屏宫格卡:视频、直播 | 18 | Grid_Layout_01 = 'Grid_Layout-01', // 横屏宫格卡:视频、直播 |
| 22 | Grid_Layout_02 = 'Grid_Layout-02', // 竖屏宫格卡:视频、直播、榜单 | 19 | Grid_Layout_02 = 'Grid_Layout-02', // 竖屏宫格卡:视频、直播、榜单 |
| 23 | Masonry_Layout_01 = 'Masonry_Layout-01', // 双列瀑布流/瀑布流卡:视频、直播、专题、活动 | 20 | Masonry_Layout_01 = 'Masonry_Layout-01', // 双列瀑布流/瀑布流卡:视频、直播、专题、活动 |
| 24 | - Title_Abbr_01 = '11', // 标题缩略 | ||
| 25 | - Title_All_01 = '3', // 全标题 | ||
| 26 | - Single_ImageCard_03 = '13',//单图卡:3行标题 | ||
| 27 | - Single_ImageCard_01 = '6',//单图卡,竖图 | ||
| 28 | - ZhGrid_Layout_03 = 'Zh_Grid_Layout-03', //金刚位卡 | ||
| 29 | - Album_Card_01 = '17', //图卡集 | 21 | + |
| 22 | + | ||
| 23 | + Zh_Carousel_Layout_01 = 'Zh_Carousel_Layout-01', //1 轮播图卡 | ||
| 24 | + Zh_Single_Row_01 = 'Zh_Single_Row-01', //2 横划卡 imageScale-封面图比例 1-4:3, 2-16:9, 3-3:2 | ||
| 25 | + Zh_Single_Row_02 = 'Zh_Single_Row-02', //3 小视频横划卡 | ||
| 26 | + Zh_Single_Row_03 = 'Zh_Single_Row-03', //6 直播预约卡 | ||
| 30 | Zh_Single_Row_04 = 'Zh_Single_Row-04', // 地方精选卡 | 27 | Zh_Single_Row_04 = 'Zh_Single_Row-04', // 地方精选卡 |
| 31 | - CompStyle_09 = '9', // 时间链卡 | ||
| 32 | - CompStyle_10 = '10', // 大专题卡 | 28 | + Zh_Single_Row_05 = 'Zh_Single_Row-05', //15 人民号横划卡 |
| 29 | + Zh_Single_Row_06 = 'Zh_Single_Row-06', //20 热门评论卡--精选评论卡 | ||
| 30 | + Zh_Single_Column_01 = 'Zh_Single_Column-01', //5 专题时间链卡 | ||
| 31 | + Zh_Single_Column_02 = 'Zh_Single_Column-02', //10 头图卡 | ||
| 32 | + Zh_Single_Column_03 = 'Zh_Single_Column-03', //9 直播大图卡 | ||
| 33 | + Zh_Single_Column_04 = 'Zh_Single_Column-04', //17 人民号主题卡 | ||
| 34 | + Zh_Single_Column_05 = 'Zh_Single_Column-05', //16 人民号入驻卡 | ||
| 35 | + Zh_Single_Column_06 = 'Zh_Single_Column-06', //12 本地问政卡 | ||
| 36 | + Zh_Single_Column_07 = 'Zh_Single_Column-07', //14 热门留言卡 | ||
| 37 | + Zh_Single_Column_08 = 'Zh_Single_Column-08', //12 问政提问卡 | ||
| 38 | + Zh_Single_Column_10 = 'Zh_Single_Column-10', //18 服务组合卡 | ||
| 39 | + Zh_Single_Column_11 = 'Zh_Single_Column-11', //19 问政组合卡 | ||
| 40 | + Zh_Grid_Layout_01 = 'Zh_Grid_Layout-01', //4 信息流组合卡 | ||
| 41 | + Zh_Grid_Layout_02 = 'Zh_Grid_Layout-02', //7 双列流小视频,一行两图卡 | ||
| 42 | + Zh_Grid_Layout_03 = 'Zh_Grid_Layout-03', //11 金刚位卡 | ||
| 43 | + Card_01 = '1', // 小图卡 | ||
| 44 | + Card_02 = '2', // 大图卡 | ||
| 45 | + Card_03 = '3', // 无图卡(全标题) | ||
| 46 | + Card_04 = '4', // 三图卡 | ||
| 47 | + Card_05 = '5', // 头图卡 | ||
| 48 | + Card_06 = '6', // 小视频卡 | ||
| 49 | + Card_07 = '7', // 作者卡 | ||
| 50 | + Card_08 = '8', // 财经快讯卡 | ||
| 51 | + Card_09 = '9', // 时间轴卡 | ||
| 52 | + Card_10 = '10', // 大专题卡 | ||
| 53 | + Card_11 = '11', // 无图卡(标题省略) | ||
| 54 | + Card_12 = '12', // 无图卡人民号 | ||
| 55 | + Card_13 = '13', // 单图卡--同6 | ||
| 56 | + Card_14 = '14', // 单图卡人民号 | ||
| 57 | + Card_15 = '15', // 大图卡人民号 | ||
| 58 | + Card_16 = '16', // 三图卡人民号 | ||
| 59 | + Card_17 = '17', // 图卡集 | ||
| 60 | + Card_18 = '18', // 图卡集人民号 | ||
| 61 | + Card_19 = '19', // 动态图文卡人民号 | ||
| 62 | + Card_20 = '20', // 动态视频卡人民号 | ||
| 63 | + Card_21 = '21', // 小视频卡人民号 | ||
| 64 | + Card_22 = '22', // 时间链 | ||
| 65 | + Card_23 = '23', // 问政卡 | ||
| 33 | } | 66 | } |
| @@ -7,7 +7,7 @@ export class Message { | @@ -7,7 +7,7 @@ export class Message { | ||
| 7 | callbackId: string = ""; //callbackId | 7 | callbackId: string = ""; //callbackId |
| 8 | responseId: string = ""; //responseId | 8 | responseId: string = ""; //responseId |
| 9 | responseData: string = ""; //responseData | 9 | responseData: string = ""; //responseData |
| 10 | - data?: Action; //data of message | 10 | + data?: object; //data of message |
| 11 | handlerName: string = ""; //name of handler | 11 | handlerName: string = ""; //name of handler |
| 12 | 12 | ||
| 13 | /** | 13 | /** |
| 1 | import { Action } from '../bean/Action' | 1 | import { Action } from '../bean/Action' |
| 2 | +import { Message } from '../bean/Message' | ||
| 2 | 3 | ||
| 3 | /** | 4 | /** |
| 4 | * 注册回调接口 | 5 | * 注册回调接口 |
| 5 | */ | 6 | */ |
| 6 | export type Callback = (data: string) => void | 7 | export type Callback = (data: string) => void |
| 7 | 8 | ||
| 8 | -export interface BridgeHandler { | ||
| 9 | - handle: (data: Action, f: Callback) => void | 9 | +export interface BridgeHandler { |
| 10 | + handle: (data: Message, f: Callback) => void | ||
| 10 | } | 11 | } |
| 11 | 12 | ||
| 12 | export class DefaultBridgeHandler implements BridgeHandler { | 13 | export class DefaultBridgeHandler implements BridgeHandler { |
| 13 | - handle(data: Action, f: Callback) { | 14 | + handle(data: Message, f: Callback) { |
| 14 | //1,2.3 | 15 | //1,2.3 |
| 15 | f("DefaultHandler response data") | 16 | f("DefaultHandler response data") |
| 16 | } | 17 | } |
| @@ -5,6 +5,9 @@ import { BridgeUtil } from '../utils/BridgeUtil'; | @@ -5,6 +5,9 @@ import { BridgeUtil } from '../utils/BridgeUtil'; | ||
| 5 | import { Message } from '../bean/Message'; | 5 | import { Message } from '../bean/Message'; |
| 6 | import { CallBackMessage } from '../bean/CallBackMessage'; | 6 | import { CallBackMessage } from '../bean/CallBackMessage'; |
| 7 | import { StringUtils } from '../utils/StringUtils'; | 7 | import { StringUtils } from '../utils/StringUtils'; |
| 8 | +import hilog from '@ohos.hilog'; | ||
| 9 | + | ||
| 10 | +// import { hilog } from '@kit.PerformanceAnalysisKit'; | ||
| 8 | 11 | ||
| 9 | const TAG = 'BridgeWebViewControl'; | 12 | const TAG = 'BridgeWebViewControl'; |
| 10 | 13 | ||
| @@ -47,6 +50,7 @@ export class BridgeWebViewControl extends webview.WebviewController { | @@ -47,6 +50,7 @@ export class BridgeWebViewControl extends webview.WebviewController { | ||
| 47 | * 刷新消息 | 50 | * 刷新消息 |
| 48 | */ | 51 | */ |
| 49 | flushMessageQueue() { | 52 | flushMessageQueue() { |
| 53 | + hilog.error(0xFF00, TAG, 'flushMessageQueue'); | ||
| 50 | this.loadUrlCustom(BridgeUtil.JS_FETCH_QUEUE_FROM_JAVA, (data: string) => { | 54 | this.loadUrlCustom(BridgeUtil.JS_FETCH_QUEUE_FROM_JAVA, (data: string) => { |
| 51 | let list: Array<Message> = JSON.parse(data) | 55 | let list: Array<Message> = JSON.parse(data) |
| 52 | if (list == null || list.length == 0) { | 56 | if (list == null || list.length == 0) { |
| @@ -66,11 +70,13 @@ export class BridgeWebViewControl extends webview.WebviewController { | @@ -66,11 +70,13 @@ export class BridgeWebViewControl extends webview.WebviewController { | ||
| 66 | } else { | 70 | } else { |
| 67 | let responseFunction: Callback; | 71 | let responseFunction: Callback; |
| 68 | let callbackId: string = value.callbackId | 72 | let callbackId: string = value.callbackId |
| 73 | + let handlerName: string = value.handlerName | ||
| 69 | if (StringUtils.isNotEmpty(callbackId)) { | 74 | if (StringUtils.isNotEmpty(callbackId)) { |
| 70 | responseFunction = (data: string) => { | 75 | responseFunction = (data: string) => { |
| 71 | let msg: CallBackMessage = new CallBackMessage() | 76 | let msg: CallBackMessage = new CallBackMessage() |
| 72 | msg.responseId = callbackId | 77 | msg.responseId = callbackId |
| 73 | msg.responseData = data | 78 | msg.responseData = data |
| 79 | + msg.handlerName = handlerName | ||
| 74 | this.queueMessage(msg) | 80 | this.queueMessage(msg) |
| 75 | } | 81 | } |
| 76 | } else { | 82 | } else { |
| @@ -86,7 +92,7 @@ export class BridgeWebViewControl extends webview.WebviewController { | @@ -86,7 +92,7 @@ export class BridgeWebViewControl extends webview.WebviewController { | ||
| 86 | handle = new DefaultBridgeHandler() | 92 | handle = new DefaultBridgeHandler() |
| 87 | } | 93 | } |
| 88 | if (handle != undefined && value.data != undefined) { | 94 | if (handle != undefined && value.data != undefined) { |
| 89 | - handle.handle(value.data, responseFunction) | 95 | + handle.handle(value, responseFunction) |
| 90 | } | 96 | } |
| 91 | } | 97 | } |
| 92 | }) | 98 | }) |
| @@ -107,12 +113,15 @@ export class BridgeWebViewControl extends webview.WebviewController { | @@ -107,12 +113,15 @@ export class BridgeWebViewControl extends webview.WebviewController { | ||
| 107 | */ | 113 | */ |
| 108 | private dispatchMessage(msg: CallBackMessage) { | 114 | private dispatchMessage(msg: CallBackMessage) { |
| 109 | let messageJson: string = msg.toJson() | 115 | let messageJson: string = msg.toJson() |
| 116 | + hilog.error(0xFF00, TAG, 'dispatchMessage '+ messageJson); | ||
| 110 | // messageJson = messageJson.replace("%7B", encodeURIComponent("%7B")); | 117 | // messageJson = messageJson.replace("%7B", encodeURIComponent("%7B")); |
| 111 | // messageJson = messageJson.replace("%7D", encodeURIComponent("%7D")); | 118 | // messageJson = messageJson.replace("%7D", encodeURIComponent("%7D")); |
| 112 | // messageJson = messageJson.replace("%22", encodeURIComponent("%22")); | 119 | // messageJson = messageJson.replace("%22", encodeURIComponent("%22")); |
| 113 | 120 | ||
| 114 | let javascriptCommand: string = StringUtils.formatStringForJS(BridgeUtil.JS_HANDLE_MESSAGE_FROM_JAVA, messageJson); | 121 | let javascriptCommand: string = StringUtils.formatStringForJS(BridgeUtil.JS_HANDLE_MESSAGE_FROM_JAVA, messageJson); |
| 115 | - this.runJavaScript(javascriptCommand) | 122 | + this.runJavaScript(javascriptCommand).then((res)=>{ |
| 123 | + hilog.error(0xFF00, TAG, 'dispatchMessage res: '+ res); | ||
| 124 | + }) | ||
| 116 | } | 125 | } |
| 117 | 126 | ||
| 118 | /** | 127 | /** |
| @@ -34,4 +34,8 @@ export { PermissionUtil } from './src/main/ets/utils/PermissionUtil' | @@ -34,4 +34,8 @@ 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 | 36 | ||
| 37 | -export { NumberFormatterUtils } from './src/main/ets/utils/NumberFormatterUtils' | ||
| 37 | +export { NumberFormatterUtils } from './src/main/ets/utils/NumberFormatterUtils' | ||
| 38 | + | ||
| 39 | +// export { PermissionUtils } from './src/main/ets/utils/PermissionUtils' | ||
| 40 | + | ||
| 41 | +export { ErrorToastUtils } from './src/main/ets/utils/ErrorToastUtils' |
| 1 | +import { cryptoFramework } from '@kit.CryptoArchitectureKit'; | ||
| 2 | +import { util } from '@kit.ArkTS'; | ||
| 3 | + | ||
| 4 | +const TAG: string = '[AesUtils]' | ||
| 5 | +/** | ||
| 6 | + * ASE密钥 TODO 示例密钥,业务需要按实际密钥修改 | ||
| 7 | + */ | ||
| 8 | +const AES_ENCRYPT_KEY: string = '5QXzAbJj0TJN9OQNvxFhhw=='; | ||
| 9 | +const AES128: string = 'AES128'; | ||
| 10 | +const AES128_ECB_PKCS5: string = 'AES128|ECB|PKCS5'; // 'AES128|PKCS5'; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * AES加密/解密 | ||
| 14 | + */ | ||
| 15 | +export class AesUtils { | ||
| 16 | + static stringToUint8Array(str: string) { | ||
| 17 | + let arr: number[] = new Array(); | ||
| 18 | + for (let i = 0, j = str.length; i < j; ++i) { | ||
| 19 | + arr.push(str.charCodeAt(i)); | ||
| 20 | + } | ||
| 21 | + let tmpArray = new Uint8Array(arr); | ||
| 22 | + return tmpArray; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + static uint8ArrayToString(array: Uint8Array): string { | ||
| 26 | + let arrayString = ''; | ||
| 27 | + for (let i = 0; i < array.length; i++) { | ||
| 28 | + arrayString += String.fromCharCode(array[i]); | ||
| 29 | + } | ||
| 30 | + return arrayString; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * aes加密 | ||
| 35 | + * @param message | ||
| 36 | + * @param callback | ||
| 37 | + */ | ||
| 38 | + static async aesEncrypt(message: string, secretKey?: string): Promise<string> { | ||
| 39 | + // Logger.debug(TAG, `aesEncrypt message: ${message}`); | ||
| 40 | + // 组装convertKey所需的二进制密钥数据 | ||
| 41 | + let base64Helper = new util.Base64Helper(); | ||
| 42 | + let pubKey = base64Helper.decodeSync(secretKey ?? AES_ENCRYPT_KEY); // AES密钥 | ||
| 43 | + let pubKeyBlob: cryptoFramework.DataBlob = { data: pubKey }; | ||
| 44 | + // 创建对称密钥生成器 | ||
| 45 | + let aesGenerator = cryptoFramework.createSymKeyGenerator(AES128); | ||
| 46 | + // 转换/生成对称密钥对象 | ||
| 47 | + let symKey: cryptoFramework.SymKey = await aesGenerator.convertKey(pubKeyBlob) | ||
| 48 | + // 生成加解密生成器 | ||
| 49 | + let cipher = cryptoFramework.createCipher(AES128_ECB_PKCS5); | ||
| 50 | + // 初始化加密 | ||
| 51 | + await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, null) | ||
| 52 | + // 封装加密所需数据 | ||
| 53 | + let input: cryptoFramework.DataBlob = { data: AesUtils.stringToUint8Array(message) }; | ||
| 54 | + // 当数据量较小时,可以在init完成后直接调用doFinal | ||
| 55 | + // 当数据量较大时,可以多次调用update,即分段加解密。 | ||
| 56 | + let output: cryptoFramework.DataBlob = await cipher.doFinal(input) | ||
| 57 | + // Logger.info(TAG, "aesEncrypt output.data is " + output.data); | ||
| 58 | + let result = base64Helper.encodeToStringSync(output?.data) | ||
| 59 | + // Logger.info(TAG, "aesEncrypt result is " + result); | ||
| 60 | + return result; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * aes解密 | ||
| 65 | + * @param message | ||
| 66 | + * @param callback | ||
| 67 | + */ | ||
| 68 | + static async aesDecrypt(message: string, secretKey?: string): Promise<string> { | ||
| 69 | + // Logger.debug(TAG, `aesDecrypt message: ${message}`); | ||
| 70 | + // 组装convertKey所需的二进制密钥数据 | ||
| 71 | + let base64Helper = new util.Base64Helper(); | ||
| 72 | + let pubKey = base64Helper.decodeSync(secretKey ?? AES_ENCRYPT_KEY); // AES密钥 | ||
| 73 | + let pubKeyBlob: cryptoFramework.DataBlob = { data: pubKey }; | ||
| 74 | + // 创建对称密钥生成器 | ||
| 75 | + let aesGenerator = cryptoFramework.createSymKeyGenerator(AES128); | ||
| 76 | + // 转换/生成对称密钥对象 | ||
| 77 | + let symKey: cryptoFramework.SymKey = await aesGenerator.convertKey(pubKeyBlob) | ||
| 78 | + // 生成加解密生成器 | ||
| 79 | + let cipher = cryptoFramework.createCipher(AES128_ECB_PKCS5); | ||
| 80 | + // 初始化加密 | ||
| 81 | + await cipher.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, null) | ||
| 82 | + // 封装加密所需数据 | ||
| 83 | + let newMessage = base64Helper.decodeSync(message); | ||
| 84 | + let input: cryptoFramework.DataBlob = { data: newMessage }; | ||
| 85 | + // 当数据量较小时,可以在init完成后直接调用doFinal | ||
| 86 | + // 当数据量较大时,可以多次调用update,即分段加解密。 | ||
| 87 | + let output: cryptoFramework.DataBlob = await cipher.doFinal(input) | ||
| 88 | + // Logger.debug(TAG, "aesDecrypt is output.data " + output?.data); | ||
| 89 | + let result = AesUtils.uint8ArrayToString(output?.data) | ||
| 90 | + // Logger.debug(TAG, "aesDecrypt result is " + result); | ||
| 91 | + return result | ||
| 92 | + } | ||
| 93 | +} |
| @@ -25,11 +25,11 @@ export class CollectionUtils { | @@ -25,11 +25,11 @@ export class CollectionUtils { | ||
| 25 | * @returns {boolean} true(empty) | 25 | * @returns {boolean} true(empty) |
| 26 | */ | 26 | */ |
| 27 | static isEmpty(collection?: any[]): boolean { | 27 | static isEmpty(collection?: any[]): boolean { |
| 28 | - return !collection || collection.length === 0; | 28 | + return!collection || collection.length === 0; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | static isEmptyList<T>(list1?: LinkList<T>): boolean { | 31 | static isEmptyList<T>(list1?: LinkList<T>): boolean { |
| 32 | - return !list1 || list1.length === 0; | 32 | + return!list1 || list1.length === 0; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | static isEmptyHashMap(obj?: HashMap<any, any>): boolean { | 35 | static isEmptyHashMap(obj?: HashMap<any, any>): boolean { |
| @@ -65,6 +65,13 @@ export class CollectionUtils { | @@ -65,6 +65,13 @@ export class CollectionUtils { | ||
| 65 | return collection.length > 0; | 65 | return collection.length > 0; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | + static getElement(collection?: any[], index?: number): any { | ||
| 69 | + if (CollectionUtils.isEmpty(collection) || index === undefined) { | ||
| 70 | + return null; | ||
| 71 | + } | ||
| 72 | + return index >= 0 && index < collection.length ? collection[index] : null; | ||
| 73 | + } | ||
| 74 | + | ||
| 68 | static getListSize(collection?: any[]): number { | 75 | static getListSize(collection?: any[]): number { |
| 69 | return CollectionUtils.isEmpty(collection) ? 0 : collection.length; | 76 | return CollectionUtils.isEmpty(collection) ? 0 : collection.length; |
| 70 | } | 77 | } |
| @@ -179,5 +186,6 @@ export class CollectionUtils { | @@ -179,5 +186,6 @@ export class CollectionUtils { | ||
| 179 | ss; | 186 | ss; |
| 180 | return collection.slice(start, end); | 187 | return collection.slice(start, end); |
| 181 | } | 188 | } |
| 189 | + | ||
| 182 | } | 190 | } |
| 183 | 191 |
| @@ -466,6 +466,20 @@ export class DateTimeUtils { | @@ -466,6 +466,20 @@ export class DateTimeUtils { | ||
| 466 | static getLunar(_date?: string) { | 466 | static getLunar(_date?: string) { |
| 467 | return getLunar(_date) | 467 | return getLunar(_date) |
| 468 | } | 468 | } |
| 469 | + | ||
| 470 | + /** | ||
| 471 | + * 获取指定日期的时间戳 | ||
| 472 | + * @returns | ||
| 473 | + */ | ||
| 474 | + static getDateTimestamp(date: string): number { | ||
| 475 | + if (StringUtils.isEmpty(date)) | ||
| 476 | + return 0 | ||
| 477 | + try { | ||
| 478 | + return new Date(date).getTime() | ||
| 479 | + } catch (e) { | ||
| 480 | + return 0 | ||
| 481 | + } | ||
| 482 | + } | ||
| 469 | } | 483 | } |
| 470 | 484 | ||
| 471 | // const dateTimeUtils = new DateTimeUtils() | 485 | // const dateTimeUtils = new DateTimeUtils() |
| 1 | +import { ToastUtils } from './ToastUtils' | ||
| 2 | + | ||
| 3 | +export namespace ErrorToastUtils { | ||
| 4 | + export enum ErrorType { | ||
| 5 | + NET_CORE_NO_NETWORK, //当前无网络,请重试 | ||
| 6 | + NET_CORE_WEAK_NETWORK, //当前无网络,请重试 | ||
| 7 | + NET_CORE_PAGE_ERROR_NETWORK, //网络出小差了,请检查网络后重试 | ||
| 8 | + NET_CORE_LOAD_ERROR_NETWORK, //加载失败,请重试 | ||
| 9 | + NET_CORE_ENTER_ERROR_NETWORK, //很抱歉,当前内容无法加载,请点击重试 | ||
| 10 | + LIVE_CORE_NO_NETWORK, //网络出小差了,请检查下网络 | ||
| 11 | + | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + export class ErrorToast { | ||
| 15 | + static showToast(type: ErrorType) { | ||
| 16 | + switch (type) { | ||
| 17 | + case ErrorType.NET_CORE_NO_NETWORK: | ||
| 18 | + ToastUtils.shortToast($r('app.string.net_core_no_network')) | ||
| 19 | + break | ||
| 20 | + case ErrorType.NET_CORE_WEAK_NETWORK: | ||
| 21 | + ToastUtils.shortToast($r('app.string.net_core_no_network')) | ||
| 22 | + break | ||
| 23 | + case ErrorType.NET_CORE_PAGE_ERROR_NETWORK: | ||
| 24 | + ToastUtils.shortToast($r('app.string.net_core_page_error_network')) | ||
| 25 | + break | ||
| 26 | + case ErrorType.NET_CORE_LOAD_ERROR_NETWORK: | ||
| 27 | + ToastUtils.shortToast($r('app.string.net_core_load_fail_network')) | ||
| 28 | + break | ||
| 29 | + case ErrorType.NET_CORE_ENTER_ERROR_NETWORK: | ||
| 30 | + ToastUtils.shortToast($r('app.string.net_core_enter_fail_network')) | ||
| 31 | + break | ||
| 32 | + case ErrorType.LIVE_CORE_NO_NETWORK: | ||
| 33 | + ToastUtils.shortToast($r('app.string.live_core_no_network')) | ||
| 34 | + break | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + | ||
| 41 | +} | ||
| 42 | + |
| @@ -39,6 +39,10 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | @@ -39,6 +39,10 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | ||
| 39 | return this.getData(this.totalCount() - 1); | 39 | return this.getData(this.totalCount() - 1); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | + public size(): number { | ||
| 43 | + return this.dataArray.length | ||
| 44 | + } | ||
| 45 | + | ||
| 42 | // 获取所有数据 | 46 | // 获取所有数据 |
| 43 | public getDataArray(): T[] { | 47 | public getDataArray(): T[] { |
| 44 | return this.dataArray; | 48 | return this.dataArray; |
| @@ -276,4 +280,10 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | @@ -276,4 +280,10 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | ||
| 276 | public sort(comparator: (firstValue: T, secondValue: T) => number): void { | 280 | public sort(comparator: (firstValue: T, secondValue: T) => number): void { |
| 277 | this.dataArray.sort(comparator) | 281 | this.dataArray.sort(comparator) |
| 278 | } | 282 | } |
| 283 | + | ||
| 284 | + public updateItems(start: number, data: T[]): void { | ||
| 285 | + // 从数组中的start位置开始删除dataArray.length个元素,并在同一位置插入((1个或多个))新元素。 | ||
| 286 | + this.dataArray.splice(start, this.dataArray.length, ...data); | ||
| 287 | + this.notifyDataReload() | ||
| 288 | + } | ||
| 279 | } | 289 | } |
| @@ -22,6 +22,7 @@ export class Logger { | @@ -22,6 +22,7 @@ export class Logger { | ||
| 22 | private static domain: number = 0xFF00; | 22 | private static domain: number = 0xFF00; |
| 23 | private static prefix: string = 'SightApp'; | 23 | private static prefix: string = 'SightApp'; |
| 24 | private static format: string = `%{public}s, %{public}s`; | 24 | private static format: string = `%{public}s, %{public}s`; |
| 25 | + static isDebug: boolean = true; | ||
| 25 | 26 | ||
| 26 | /** | 27 | /** |
| 27 | * constructor. | 28 | * constructor. |
| @@ -35,26 +36,44 @@ export class Logger { | @@ -35,26 +36,44 @@ export class Logger { | ||
| 35 | } | 36 | } |
| 36 | 37 | ||
| 37 | static debug(...args: string[]) { | 38 | static debug(...args: string[]) { |
| 39 | + if(!Logger.isDebug){ | ||
| 40 | + return | ||
| 41 | + } | ||
| 38 | hilog.debug(Logger.domain, Logger.prefix, Logger.format, args); | 42 | hilog.debug(Logger.domain, Logger.prefix, Logger.format, args); |
| 39 | } | 43 | } |
| 40 | 44 | ||
| 41 | static info(...args: string[]) { | 45 | static info(...args: string[]) { |
| 46 | + if(!Logger.isDebug){ | ||
| 47 | + return | ||
| 48 | + } | ||
| 42 | hilog.info(Logger.domain, Logger.prefix, Logger.format, args); | 49 | hilog.info(Logger.domain, Logger.prefix, Logger.format, args); |
| 43 | } | 50 | } |
| 44 | 51 | ||
| 45 | static warn(...args: string[]) { | 52 | static warn(...args: string[]) { |
| 53 | + if(!Logger.isDebug){ | ||
| 54 | + return | ||
| 55 | + } | ||
| 46 | hilog.warn(Logger.domain, Logger.prefix, Logger.format, args); | 56 | hilog.warn(Logger.domain, Logger.prefix, Logger.format, args); |
| 47 | } | 57 | } |
| 48 | 58 | ||
| 49 | static error(...args: string[]) { | 59 | static error(...args: string[]) { |
| 60 | + if(!Logger.isDebug){ | ||
| 61 | + return | ||
| 62 | + } | ||
| 50 | hilog.error(Logger.domain, Logger.prefix, Logger.format, args); | 63 | hilog.error(Logger.domain, Logger.prefix, Logger.format, args); |
| 51 | } | 64 | } |
| 52 | 65 | ||
| 53 | static fatal(...args: string[]) { | 66 | static fatal(...args: string[]) { |
| 67 | + if(!Logger.isDebug){ | ||
| 68 | + return | ||
| 69 | + } | ||
| 54 | hilog.fatal(Logger.domain, Logger.prefix, Logger.format, args); | 70 | hilog.fatal(Logger.domain, Logger.prefix, Logger.format, args); |
| 55 | } | 71 | } |
| 56 | 72 | ||
| 57 | static isLoggable(level: LogLevel) { | 73 | static isLoggable(level: LogLevel) { |
| 74 | + if(!Logger.isDebug){ | ||
| 75 | + return | ||
| 76 | + } | ||
| 58 | hilog.isLoggable(Logger.domain, Logger.prefix, level); | 77 | hilog.isLoggable(Logger.domain, Logger.prefix, level); |
| 59 | } | 78 | } |
| 60 | } | 79 | } |
| @@ -8,7 +8,7 @@ export class NumberFormatterUtils { | @@ -8,7 +8,7 @@ export class NumberFormatterUtils { | ||
| 8 | */ | 8 | */ |
| 9 | static formatNumberWithWan(inputNumber: number | String): string { | 9 | static formatNumberWithWan(inputNumber: number | String): string { |
| 10 | const num = typeof inputNumber === 'number' ? inputNumber : Number(inputNumber); | 10 | const num = typeof inputNumber === 'number' ? inputNumber : Number(inputNumber); |
| 11 | - if (isNaN(num) || num < 10000) { | 11 | + if (Number.isNaN(num) || num < 10000) { |
| 12 | return num.toString(); | 12 | return num.toString(); |
| 13 | } else { | 13 | } else { |
| 14 | const wanUnit = num / 10000; | 14 | const wanUnit = num / 10000; |
| 1 | +// import { abilityAccessCtrl, bundleManager, common, Permissions, Want } from '@kit.AbilityKit' | ||
| 2 | +// import { BusinessError } from '@kit.BasicServicesKit' | ||
| 3 | +// import { AppUtils } from './AppUtils' | ||
| 4 | +// import { Logger } from './Logger' | ||
| 5 | +// | ||
| 6 | +// /** | ||
| 7 | +// * 权限工具类 | ||
| 8 | +// * */ | ||
| 9 | +// export class PermissionUtils { | ||
| 10 | +// //相机权限 | ||
| 11 | +// static CAMERA: Permissions = 'ohos.permission.CAMERA' | ||
| 12 | +// //文件权限 | ||
| 13 | +// static READ_MEDIA: Permissions = 'ohos.permission.READ_MEDIA' | ||
| 14 | +// static WRITE_MEDIA: Permissions = 'ohos.permission.WRITE_MEDIA' | ||
| 15 | +// private static tokenId: number = 0 | ||
| 16 | +// | ||
| 17 | +// /**检查权限是否授权*/ | ||
| 18 | +// static async checkPermissions(permission: Permissions): Promise<boolean> { | ||
| 19 | +// let hasPermissions = false; | ||
| 20 | +// let grantStatus: abilityAccessCtrl.GrantStatus = await PermissionUtils.checkAccessToken(permission); | ||
| 21 | +// | ||
| 22 | +// if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) { | ||
| 23 | +// // 已经授权,可以继续访问目标操作 | ||
| 24 | +// hasPermissions = true; | ||
| 25 | +// } else { | ||
| 26 | +// hasPermissions = false; | ||
| 27 | +// // 申请日历权限 | ||
| 28 | +// } | ||
| 29 | +// return hasPermissions; | ||
| 30 | +// } | ||
| 31 | +// | ||
| 32 | +// /**动态申请权限*/ | ||
| 33 | +// static reqPermissionsFromUser(permissions: Array<Permissions>, component: Object): Promise<boolean> { | ||
| 34 | +// | ||
| 35 | +// return new Promise((resolve, fail) => { | ||
| 36 | +// let context = getContext(component) as common.UIAbilityContext; | ||
| 37 | +// let atManager = abilityAccessCtrl.createAtManager(); | ||
| 38 | +// atManager.requestPermissionsFromUser(context, permissions).then((data) => { | ||
| 39 | +// let grantStatus: Array<number> = data.authResults; | ||
| 40 | +// let length: number = grantStatus.length; | ||
| 41 | +// | ||
| 42 | +// for (let i = 0; i < length; i++) { | ||
| 43 | +// if (grantStatus[i] === 0) { | ||
| 44 | +// // 用户授权,可以继续访问目标操作 | ||
| 45 | +// resolve(true); | ||
| 46 | +// } else { | ||
| 47 | +// resolve(false) | ||
| 48 | +// } | ||
| 49 | +// } | ||
| 50 | +// }).catch((err: Error) => { | ||
| 51 | +// fail(err) | ||
| 52 | +// }) | ||
| 53 | +// }); | ||
| 54 | +// } | ||
| 55 | +// | ||
| 56 | +// /**跳转设置页面*/ | ||
| 57 | +// static openPermissionsInSystemSettings(context: Object): void { | ||
| 58 | +// let uiContext = getContext(context) as common.UIAbilityContext; | ||
| 59 | +// let wantInfo: Want = { | ||
| 60 | +// bundleName: 'com.huawei.hmos.settings', | ||
| 61 | +// abilityName: 'com.huawei.hmos.settings.MainAbility', | ||
| 62 | +// uri: 'application_info_entry', | ||
| 63 | +// parameters: { | ||
| 64 | +// pushParams: AppUtils.getPackageName(uiContext) // 打开指定应用的设置页面 | ||
| 65 | +// } | ||
| 66 | +// } | ||
| 67 | +// uiContext.startAbility(wantInfo) | ||
| 68 | +// } | ||
| 69 | +// | ||
| 70 | +// private static async checkAccessToken(permission: Permissions): Promise<abilityAccessCtrl.GrantStatus> { | ||
| 71 | +// let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); | ||
| 72 | +// let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED; | ||
| 73 | +// | ||
| 74 | +// // 获取应用程序的accessTokenID | ||
| 75 | +// if (PermissionUtils.tokenId == 0) { | ||
| 76 | +// try { | ||
| 77 | +// let bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION); | ||
| 78 | +// let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo; | ||
| 79 | +// PermissionUtils.tokenId = appInfo.accessTokenId; | ||
| 80 | +// } catch (error) { | ||
| 81 | +// const err: BusinessError = error as BusinessError; | ||
| 82 | +// } | ||
| 83 | +// } | ||
| 84 | +// // 校验应用是否被授予权限 | ||
| 85 | +// try { | ||
| 86 | +// grantStatus = await atManager.checkAccessToken(PermissionUtils.tokenId, permission); | ||
| 87 | +// } catch (error) { | ||
| 88 | +// const err: BusinessError = error as BusinessError; | ||
| 89 | +// } | ||
| 90 | +// | ||
| 91 | +// return grantStatus; | ||
| 92 | +// } | ||
| 93 | +// | ||
| 94 | +// } |
| @@ -15,15 +15,17 @@ export class Size { | @@ -15,15 +15,17 @@ export class Size { | ||
| 15 | 15 | ||
| 16 | export class WindowModel { | 16 | export class WindowModel { |
| 17 | private windowStage?: window.WindowStage; | 17 | private windowStage?: window.WindowStage; |
| 18 | - | ||
| 19 | static shared: WindowModel = new WindowModel() | 18 | static shared: WindowModel = new WindowModel() |
| 20 | - | ||
| 21 | static TAG = "WindowModel"; | 19 | static TAG = "WindowModel"; |
| 22 | 20 | ||
| 23 | setWindowStage(windowStage: window.WindowStage) { | 21 | setWindowStage(windowStage: window.WindowStage) { |
| 24 | this.windowStage = windowStage; | 22 | this.windowStage = windowStage; |
| 25 | } | 23 | } |
| 26 | 24 | ||
| 25 | + getWindowStage(): window.WindowStage { | ||
| 26 | + return this.windowStage as window.WindowStage | ||
| 27 | + } | ||
| 28 | + | ||
| 27 | setMainWindowFullScreen(fullScreen: boolean) { | 29 | setMainWindowFullScreen(fullScreen: boolean) { |
| 28 | if (deviceInfo.deviceType != "phone") { | 30 | if (deviceInfo.deviceType != "phone") { |
| 29 | return | 31 | return |
| @@ -65,10 +67,10 @@ export class WindowModel { | @@ -65,10 +67,10 @@ export class WindowModel { | ||
| 65 | windowClass.setWindowKeepScreenOn(isKeepScreenOn, (err: BusinessError) => { | 67 | windowClass.setWindowKeepScreenOn(isKeepScreenOn, (err: BusinessError) => { |
| 66 | const errCode: number = err.code; | 68 | const errCode: number = err.code; |
| 67 | if (errCode) { | 69 | if (errCode) { |
| 68 | - console.error(WindowModel.TAG +'设置屏幕常亮:' + isKeepScreenOn + ',失败: ' + JSON.stringify(err)); | 70 | + console.error(WindowModel.TAG + '设置屏幕常亮:' + isKeepScreenOn + ',失败: ' + JSON.stringify(err)); |
| 69 | return; | 71 | return; |
| 70 | } | 72 | } |
| 71 | - console.info(WindowModel.TAG +'设置屏幕常亮:' + isKeepScreenOn + ",成功"); | 73 | + console.info(WindowModel.TAG + '设置屏幕常亮:' + isKeepScreenOn + ",成功"); |
| 72 | }) | 74 | }) |
| 73 | }) | 75 | }) |
| 74 | } | 76 | } |
| @@ -3,6 +3,30 @@ | @@ -3,6 +3,30 @@ | ||
| 3 | { | 3 | { |
| 4 | "name": "shared_desc", | 4 | "name": "shared_desc", |
| 5 | "value": "全局工具包" | 5 | "value": "全局工具包" |
| 6 | + } , | ||
| 7 | + { | ||
| 8 | + "name": "net_core_no_network", | ||
| 9 | + "value": "当前无网络,请重试" | ||
| 10 | + } , | ||
| 11 | + { | ||
| 12 | + "name": "net_core_weak_network", | ||
| 13 | + "value": "当前无网络,请重试" | ||
| 14 | + } , | ||
| 15 | + { | ||
| 16 | + "name": "net_core_page_error_network", | ||
| 17 | + "value": "网络出小差了,请检查下网络" | ||
| 18 | + }, | ||
| 19 | + { | ||
| 20 | + "name": "net_core_load_fail_network", | ||
| 21 | + "value": "加载失败,请重试" | ||
| 22 | + }, | ||
| 23 | + { | ||
| 24 | + "name": "net_core_enter_fail_network", | ||
| 25 | + "value": "很抱歉,当前内容无法加载,请点击重试" | ||
| 26 | + }, | ||
| 27 | + { | ||
| 28 | + "name": "live_core_no_network", | ||
| 29 | + "value": "网络出小差了,请检查下网络" | ||
| 6 | } | 30 | } |
| 7 | ] | 31 | ] |
| 8 | } | 32 | } |
| @@ -98,9 +98,12 @@ instance.interceptors.response.use(// 响应拦截器response类型就是Axios.r | @@ -98,9 +98,12 @@ instance.interceptors.response.use(// 响应拦截器response类型就是Axios.r | ||
| 98 | // console.log(error.request) | 98 | // console.log(error.request) |
| 99 | // console.log(error.response) | 99 | // console.log(error.response) |
| 100 | // 这里用来处理http常见错误,进行全局提示 | 100 | // 这里用来处理http常见错误,进行全局提示 |
| 101 | - let message = buildErrorMsg(error.response?.status); | ||
| 102 | - // 错误消息可以使用全局弹框展示出来 | ||
| 103 | - console.log(`httpStatus:${error.response?.status}-${message},请检查网络或联系管理员!`) | 101 | + if(error!=null && error.response!=null ){ |
| 102 | + let message = buildErrorMsg(error.response.status); | ||
| 103 | + // 错误消息可以使用全局弹框展示出来 | ||
| 104 | + console.log(`httpStatus:${error.response?.status}-${message},请检查网络或联系管理员!`) | ||
| 105 | + } | ||
| 106 | + | ||
| 104 | return Promise.reject(error); | 107 | return Promise.reject(error); |
| 105 | } | 108 | } |
| 106 | ); | 109 | ); |
| @@ -35,6 +35,10 @@ export class HttpUrlUtils { | @@ -35,6 +35,10 @@ export class HttpUrlUtils { | ||
| 35 | */ | 35 | */ |
| 36 | static readonly COMP_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo"; | 36 | static readonly COMP_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo"; |
| 37 | /** | 37 | /** |
| 38 | + * 展现comp接口(推荐) | ||
| 39 | + */ | ||
| 40 | + static readonly COMP_REC_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/rec/compInfo"; | ||
| 41 | + /** | ||
| 38 | * 详情页面详情接口 | 42 | * 详情页面详情接口 |
| 39 | */ | 43 | */ |
| 40 | static readonly DETAIL_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail"; | 44 | static readonly DETAIL_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail"; |
| @@ -100,10 +104,14 @@ export class HttpUrlUtils { | @@ -100,10 +104,14 @@ export class HttpUrlUtils { | ||
| 100 | */ | 104 | */ |
| 101 | static readonly APPOINTMENT_editUserDetail_PATH: string = "/api/rmrb-user-center/user/zh/c/editUserDetail"; | 105 | static readonly APPOINTMENT_editUserDetail_PATH: string = "/api/rmrb-user-center/user/zh/c/editUserDetail"; |
| 102 | /** | 106 | /** |
| 103 | - * 资料编辑 更新普通用户名 | 107 | + * 资料编辑 更新普通用户名(用户名、身份证号、邮箱、手机号修改url) |
| 104 | */ | 108 | */ |
| 105 | static readonly APPOINTMENT_editUserDetail1_PATH: string = "/api/rmrb-user-center/user/zh/c/completeUserInfo"; | 109 | static readonly APPOINTMENT_editUserDetail1_PATH: string = "/api/rmrb-user-center/user/zh/c/completeUserInfo"; |
| 106 | /** | 110 | /** |
| 111 | + * 资料编辑 地区拉取 | ||
| 112 | + */ | ||
| 113 | + static readonly APPOINTMENT_userArea_PATH: string = "/api/rmrb-content-center/c/service/sys-area/treeselect"; | ||
| 114 | + /** | ||
| 107 | /** | 115 | /** |
| 108 | * 个人中心 关注列表详情 | 116 | * 个人中心 关注列表详情 |
| 109 | */ | 117 | */ |
| @@ -127,7 +135,11 @@ export class HttpUrlUtils { | @@ -127,7 +135,11 @@ export class HttpUrlUtils { | ||
| 127 | /** | 135 | /** |
| 128 | * 我的收藏 | 136 | * 我的收藏 |
| 129 | */ | 137 | */ |
| 130 | - static readonly APPOINTMENT_MyCollectionList_PATH: string = "/api/rmrb-interact/content/zh/c/interact"; | 138 | + static readonly APPOINTMENT_MyCollectionList_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/interact"; |
| 139 | + /** | ||
| 140 | + * 收藏/取消收藏 status :收藏状态 1添加收藏 0取消收藏 | ||
| 141 | + */ | ||
| 142 | + static readonly APPOINTMENT_ExecuteCollcet_PATH: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord"; | ||
| 131 | /** | 143 | /** |
| 132 | * 个人中心 我的评论列表 | 144 | * 个人中心 我的评论列表 |
| 133 | */ | 145 | */ |
| @@ -169,6 +181,40 @@ export class HttpUrlUtils { | @@ -169,6 +181,40 @@ export class HttpUrlUtils { | ||
| 169 | */ | 181 | */ |
| 170 | static readonly FOLLOW_OPERATION_PATH: string = "/api/rmrb-interact/interact/zh/c/attention/operation"; | 182 | static readonly FOLLOW_OPERATION_PATH: string = "/api/rmrb-interact/interact/zh/c/attention/operation"; |
| 171 | /** | 183 | /** |
| 184 | + * 首页 搜索提示 | ||
| 185 | + */ | ||
| 186 | + static readonly SEARCH_HINT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/hints"; | ||
| 187 | + /** | ||
| 188 | + * 搜索主页 热词 | ||
| 189 | + */ | ||
| 190 | + static readonly SEARCH_HOTS_DATA_PATH: string = "/api/rmrb-search-api/zh/c/hots"; | ||
| 191 | + | ||
| 192 | + /** | ||
| 193 | + * 搜索联想词 | ||
| 194 | + */ | ||
| 195 | + static readonly RELATED_SEARCH_CONTENT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/suggestions/"; | ||
| 196 | + | ||
| 197 | + /** | ||
| 198 | + * 直播详情 | ||
| 199 | + */ | ||
| 200 | + static readonly LIVE_DETAILS_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail"; | ||
| 201 | + | ||
| 202 | + /** | ||
| 203 | + * 直播详情-直播间列表 | ||
| 204 | + */ | ||
| 205 | + static readonly LIVE_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/video/list"; | ||
| 206 | + | ||
| 207 | + /** | ||
| 208 | + * 直播详情-大家聊列表 | ||
| 209 | + */ | ||
| 210 | + static readonly LIVE_CHAT_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/chat/list"; | ||
| 211 | + /** | ||
| 212 | + | ||
| 213 | + * 搜索结果 显示tab 数 | ||
| 214 | + */ | ||
| 215 | + static readonly SEARCH_RESULT_COUNT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/count?keyword="; | ||
| 216 | + | ||
| 217 | + /** | ||
| 172 | * 早晚报列表 | 218 | * 早晚报列表 |
| 173 | * 根据页面id获取页面楼层列表 | 219 | * 根据页面id获取页面楼层列表 |
| 174 | * https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/pageInfo?pageId=28927 | 220 | * https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/pageInfo?pageId=28927 |
| @@ -179,7 +225,19 @@ export class HttpUrlUtils { | @@ -179,7 +225,19 @@ export class HttpUrlUtils { | ||
| 179 | * */ | 225 | * */ |
| 180 | static readonly MORNING_EVENING_PAGE_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/pageInfo"; | 226 | static readonly MORNING_EVENING_PAGE_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/pageInfo"; |
| 181 | static readonly MORNING_EVENING_COMP_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo"; | 227 | static readonly MORNING_EVENING_COMP_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo"; |
| 228 | + /** | ||
| 229 | + * 直播回顾 | ||
| 230 | + * */ | ||
| 231 | + static readonly LIVE_REVIEW_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/channel/live/reviewList"; //?pageNum=1&pageSize=20 | ||
| 232 | + /** | ||
| 233 | + * 早晚报获取PAGEID | ||
| 234 | + * */ | ||
| 235 | + static readonly DAILY_PAPER_TOPIC: string = "/api/rmrb-bff-display-zh/display/zh/c/dailyPaperTopic"; | ||
| 182 | private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT; | 236 | private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT; |
| 237 | + /** | ||
| 238 | + * 推荐列表 | ||
| 239 | + */ | ||
| 240 | + static readonly RECOMMEND_LIST: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list"; | ||
| 183 | 241 | ||
| 184 | public static set hostUrl(value: string) { | 242 | public static set hostUrl(value: string) { |
| 185 | HttpUrlUtils._hostUrl = value; | 243 | HttpUrlUtils._hostUrl = value; |
| @@ -420,11 +478,17 @@ export class HttpUrlUtils { | @@ -420,11 +478,17 @@ export class HttpUrlUtils { | ||
| 420 | return url; | 478 | return url; |
| 421 | } | 479 | } |
| 422 | 480 | ||
| 481 | + static getAgreement() { | ||
| 482 | + let url = HttpUrlUtils._hostUrl + "/api/rmrb-bff-display-zh/display/zh/c/agreement"; | ||
| 483 | + return url; | ||
| 484 | + } | ||
| 485 | + | ||
| 423 | static getCheckVerifyByTokenCodeUrl() { | 486 | static getCheckVerifyByTokenCodeUrl() { |
| 424 | let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/checkVerifyCodeByToken"; | 487 | let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/checkVerifyCodeByToken"; |
| 425 | return url; | 488 | return url; |
| 426 | } | 489 | } |
| 427 | 490 | ||
| 491 | + | ||
| 428 | /*优质评论页*/ | 492 | /*优质评论页*/ |
| 429 | static getQualityCommentUrl() { | 493 | static getQualityCommentUrl() { |
| 430 | let url = HttpUrlUtils._hostUrl + "api/rmrb-comment/comment/zh/c/highQuality" | 494 | let url = HttpUrlUtils._hostUrl + "api/rmrb-comment/comment/zh/c/highQuality" |
| @@ -438,6 +502,17 @@ export class HttpUrlUtils { | @@ -438,6 +502,17 @@ export class HttpUrlUtils { | ||
| 438 | } | 502 | } |
| 439 | 503 | ||
| 440 | 504 | ||
| 505 | + //账户注销 | ||
| 506 | + static accountLogoutUrl() { | ||
| 507 | + let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/logoff"; | ||
| 508 | + return url; | ||
| 509 | + } | ||
| 510 | + | ||
| 511 | + //更换手机号绑定 | ||
| 512 | + static changeBindPhone() { | ||
| 513 | + let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/userPhoneChange"; | ||
| 514 | + return url; | ||
| 515 | + } | ||
| 441 | 516 | ||
| 442 | static getAppointmentListDataUrl() { | 517 | static getAppointmentListDataUrl() { |
| 443 | let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH | 518 | let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH |
| @@ -445,7 +520,12 @@ export class HttpUrlUtils { | @@ -445,7 +520,12 @@ export class HttpUrlUtils { | ||
| 445 | } | 520 | } |
| 446 | 521 | ||
| 447 | static getMyCollectionListDataUrl() { | 522 | static getMyCollectionListDataUrl() { |
| 448 | - let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.APPOINTMENT_MyCollectionList_PATH | 523 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_MyCollectionList_PATH |
| 524 | + return url | ||
| 525 | + } | ||
| 526 | + | ||
| 527 | + static getExecuteCollcetUrl() { | ||
| 528 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH | ||
| 449 | return url | 529 | return url |
| 450 | } | 530 | } |
| 451 | 531 | ||
| @@ -524,6 +604,40 @@ export class HttpUrlUtils { | @@ -524,6 +604,40 @@ export class HttpUrlUtils { | ||
| 524 | return url | 604 | return url |
| 525 | } | 605 | } |
| 526 | 606 | ||
| 607 | + static getSearchHintDataUrl() { | ||
| 608 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_HINT_DATA_PATH | ||
| 609 | + return url | ||
| 610 | + } | ||
| 611 | + | ||
| 612 | + static getSearchHotsDataUrl() { | ||
| 613 | + let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.SEARCH_HOTS_DATA_PATH | ||
| 614 | + return url | ||
| 615 | + } | ||
| 616 | + | ||
| 617 | + static getRelatedSearchContentDataUrl() { | ||
| 618 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.RELATED_SEARCH_CONTENT_DATA_PATH | ||
| 619 | + return url | ||
| 620 | + } | ||
| 621 | + | ||
| 622 | + static getLiveDetailsUrl() { | ||
| 623 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_DETAILS_PATH | ||
| 624 | + return url | ||
| 625 | + } | ||
| 626 | + | ||
| 627 | + static getLiveListUrl() { | ||
| 628 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_LIST_PATH | ||
| 629 | + return url | ||
| 630 | + } | ||
| 631 | + | ||
| 632 | + static getLiveChatListUrl() { | ||
| 633 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_CHAT_LIST_PATH | ||
| 634 | + return url | ||
| 635 | + } | ||
| 636 | + | ||
| 637 | + static getSearchResultCountDataUrl() { | ||
| 638 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_COUNT_DATA_PATH | ||
| 639 | + return url | ||
| 640 | + } | ||
| 527 | 641 | ||
| 528 | // static getYcgCommonHeaders(): HashMap<string, string> { | 642 | // static getYcgCommonHeaders(): HashMap<string, string> { |
| 529 | // let headers: HashMap<string, string> = new HashMap<string, string>() | 643 | // let headers: HashMap<string, string> = new HashMap<string, string>() |
| 1 | import ArrayList from '@ohos.util.ArrayList'; | 1 | import ArrayList from '@ohos.util.ArrayList'; |
| 2 | -import { Action } from 'wdBean' | ||
| 3 | -import { WDRouterPage } from './WDRouterPage' | 2 | +import { Action } from 'wdBean'; |
| 3 | +import { WDRouterPage } from './WDRouterPage'; | ||
| 4 | 4 | ||
| 5 | interface HandleObject { | 5 | interface HandleObject { |
| 6 | handle: (action: Action) => (WDRouterPage | undefined) | 6 | handle: (action: Action) => (WDRouterPage | undefined) |
| @@ -49,11 +49,16 @@ export function registerRouter() { | @@ -49,11 +49,16 @@ export function registerRouter() { | ||
| 49 | // }) | 49 | // }) |
| 50 | 50 | ||
| 51 | Action2Page.register("JUMP_DETAIL_PAGE", (action: Action) => { | 51 | Action2Page.register("JUMP_DETAIL_PAGE", (action: Action) => { |
| 52 | - // if (action.params?.detailPageType == 2 || action.params?.detailPageType == 6) { | ||
| 53 | - // return WDRouterPage.detailPlayLivePage | ||
| 54 | - // } | ||
| 55 | - if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) { | 52 | + if (action.params?.detailPageType == 2 || action.params?.detailPageType == 6) { |
| 53 | + return WDRouterPage.detailPlayLivePage | ||
| 54 | + } else if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) { | ||
| 56 | return WDRouterPage.detailVideoListPage | 55 | return WDRouterPage.detailVideoListPage |
| 56 | + }else if(action.params?.detailPageType == 9){ | ||
| 57 | + //图集详情页 | ||
| 58 | + return WDRouterPage.multiPictureDetailPage | ||
| 59 | + }else if(action.params?.detailPageType == 14 || action.params?.detailPageType == 15){ | ||
| 60 | + //动态详情页 | ||
| 61 | + return WDRouterPage.dynamicDetailPage | ||
| 57 | } else if (action.params?.detailPageType == 17) { | 62 | } else if (action.params?.detailPageType == 17) { |
| 58 | return WDRouterPage.multiPictureDetailPage | 63 | return WDRouterPage.multiPictureDetailPage |
| 59 | } else if (action.params?.detailPageType == 13) { | 64 | } else if (action.params?.detailPageType == 13) { |
| @@ -9,7 +9,7 @@ export class WDRouterPage { | @@ -9,7 +9,7 @@ export class WDRouterPage { | ||
| 9 | this.pagePath = pagePath | 9 | this.pagePath = pagePath |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | - static getBundleInfo(){ | 12 | + static getBundleInfo() { |
| 13 | let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT) | 13 | let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT) |
| 14 | return `@bundle:${bundleInfo.name}/${"phone"}/${"ets/pages/MainPage"}` | 14 | return `@bundle:${bundleInfo.name}/${"phone"}/${"ets/pages/MainPage"}` |
| 15 | } | 15 | } |
| @@ -35,6 +35,8 @@ export class WDRouterPage { | @@ -35,6 +35,8 @@ export class WDRouterPage { | ||
| 35 | // 短视频详情页 | 35 | // 短视频详情页 |
| 36 | static detailVideoListPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailVideoListPage"); | 36 | static detailVideoListPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailVideoListPage"); |
| 37 | static detailPlayShortVideoPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailPlayShortVideoPage"); | 37 | static detailPlayShortVideoPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailPlayShortVideoPage"); |
| 38 | + static VideoChannelDetail = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/VideoChannelDetail"); | ||
| 39 | + static LottieViewDemo = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/LottieViewDemo"); | ||
| 38 | // 点播详情页 | 40 | // 点播详情页 |
| 39 | static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage"); | 41 | static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage"); |
| 40 | // 直播详情页 | 42 | // 直播详情页 |
| @@ -43,6 +45,8 @@ export class WDRouterPage { | @@ -43,6 +45,8 @@ export class WDRouterPage { | ||
| 43 | static multiPictureDetailPage = new WDRouterPage("phone", "ets/pages/detail/MultiPictureDetailPage"); | 45 | static multiPictureDetailPage = new WDRouterPage("phone", "ets/pages/detail/MultiPictureDetailPage"); |
| 44 | // 音乐详情页 | 46 | // 音乐详情页 |
| 45 | static audioDetail = new WDRouterPage("phone", "ets/pages/detail/AudioDetail"); | 47 | static audioDetail = new WDRouterPage("phone", "ets/pages/detail/AudioDetail"); |
| 48 | + // 动态详情页 | ||
| 49 | + static dynamicDetailPage = new WDRouterPage("phone", "ets/pages/detail/DynamicDetailPage"); | ||
| 46 | static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); | 50 | static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); |
| 47 | static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); | 51 | static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); |
| 48 | //我的 预约 | 52 | //我的 预约 |
| @@ -68,22 +72,23 @@ export class WDRouterPage { | @@ -68,22 +72,23 @@ export class WDRouterPage { | ||
| 68 | static aboutPage = new WDRouterPage("wdComponent", "ets/components/page/SettingAboutPage"); | 72 | static aboutPage = new WDRouterPage("wdComponent", "ets/components/page/SettingAboutPage"); |
| 69 | // 设置页 | 73 | // 设置页 |
| 70 | static settingPage = new WDRouterPage("wdComponent", "ets/components/page/SettingPage"); | 74 | static settingPage = new WDRouterPage("wdComponent", "ets/components/page/SettingPage"); |
| 75 | + // 设置页 | ||
| 76 | + static logoutPage = new WDRouterPage("wdComponent", "ets/components/setting/LogoutPage"); | ||
| 71 | // 设置密码页、设置手机号页等等 (需要传参) | 77 | // 设置密码页、设置手机号页等等 (需要传参) |
| 72 | static settingPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/SettingPasswordPage"); | 78 | static settingPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/SettingPasswordPage"); |
| 73 | //其他普通用户 主页 | 79 | //其他普通用户 主页 |
| 74 | static otherNormalUserHomePagePage = new WDRouterPage("wdComponent", "ets/pages/OtherNormalUserHomePage"); | 80 | static otherNormalUserHomePagePage = new WDRouterPage("wdComponent", "ets/pages/OtherNormalUserHomePage"); |
| 75 | static guidePage = new WDRouterPage("wdLogin", "ets/pages/guide/GuidePages"); | 81 | static guidePage = new WDRouterPage("wdLogin", "ets/pages/guide/GuidePages"); |
| 76 | - | ||
| 77 | //隐私政策页面 | 82 | //隐私政策页面 |
| 78 | static privacyPage = new WDRouterPage("phone", "ets/pages/launchPage/PrivacyPage"); | 83 | static privacyPage = new WDRouterPage("phone", "ets/pages/launchPage/PrivacyPage"); |
| 79 | //启动广告页面 | 84 | //启动广告页面 |
| 80 | static launchAdvertisingPage = new WDRouterPage("phone", "ets/pages/launchPage/LaunchAdvertisingPage"); | 85 | static launchAdvertisingPage = new WDRouterPage("phone", "ets/pages/launchPage/LaunchAdvertisingPage"); |
| 81 | //主页 | 86 | //主页 |
| 82 | static mainPage = new WDRouterPage("phone", "ets/pages/MainPage"); | 87 | static mainPage = new WDRouterPage("phone", "ets/pages/MainPage"); |
| 83 | - | ||
| 84 | - | ||
| 85 | // static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview"); | 88 | // static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview"); |
| 86 | 89 | ||
| 87 | //播报页面 | 90 | //播报页面 |
| 88 | static broadcastPage = new WDRouterPage("phone", "ets/pages/broadcast/BroadcastPage"); | 91 | static broadcastPage = new WDRouterPage("phone", "ets/pages/broadcast/BroadcastPage"); |
| 92 | + //搜索主页 | ||
| 93 | + static searchPage = new WDRouterPage("wdComponent", "ets/pages/SearchPage"); | ||
| 89 | } | 94 | } |
| 1 | -import bundleManager from '@ohos.bundle.bundleManager' | ||
| 2 | - | ||
| 3 | -export class WDRouterPage { | ||
| 4 | - private moduleName: string | ||
| 5 | - private pagePath: string | ||
| 6 | - | ||
| 7 | - constructor(moduleName: string, pagePath: string) { | ||
| 8 | - this.moduleName = moduleName | ||
| 9 | - this.pagePath = pagePath | ||
| 10 | - } | ||
| 11 | - | ||
| 12 | - url() { | ||
| 13 | - let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT) | ||
| 14 | - return `@bundle:${bundleInfo.name}/${this.moduleName}/${this.pagePath}` | ||
| 15 | - } | ||
| 16 | - | ||
| 17 | - // 主页 | ||
| 18 | - static index = new WDRouterPage("phone", "ets/pages/Index"); | ||
| 19 | - // 关于页面 | ||
| 20 | - // static aboutPage = new WDRouterPage("entry", "ets/pages/about/AboutPage"); | ||
| 21 | - // web默认页面 | ||
| 22 | - static defaultWebPage = new WDRouterPage("phone", "ets/pages/web/DefaultWebPage"); | ||
| 23 | - // 电子报页面 | ||
| 24 | - static eNewspaper = new WDRouterPage("phone", "ets/pages/ENewspaper") | ||
| 25 | - // 早晚报页面 | ||
| 26 | - static morningEveningPaperPage = new WDRouterPage("phone", "ets/pages/MorningEveningPaperPage") | ||
| 27 | - // 图文详情页 | ||
| 28 | - static imageTextDetailPage = new WDRouterPage("phone", "ets/pages/ImageAndTextDetailPage"); | ||
| 29 | - // 短视频详情页 | ||
| 30 | - static detailPlayShortVideoPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailPlayShortVideoPage"); | ||
| 31 | - // 点播详情页 | ||
| 32 | - static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage"); | ||
| 33 | - // 直播详情页 | ||
| 34 | - static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage"); | ||
| 35 | - | ||
| 36 | - static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); | ||
| 37 | - | ||
| 38 | - static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); | ||
| 39 | - //我的 预约 | ||
| 40 | - static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage"); | ||
| 41 | - //我的 关注 | ||
| 42 | - static followListPage = new WDRouterPage("wdComponent", "ets/components/page/FollowListPage"); | ||
| 43 | - //资料编辑 | ||
| 44 | - static editUserInfoPage = new WDRouterPage("wdComponent", "ets/components/page/EditUserInfoPage"); | ||
| 45 | - //修改昵称 | ||
| 46 | - static editUserNikeNamePage = new WDRouterPage("wdComponent", "ets/components/page/EditUserNikeNamePage"); | ||
| 47 | - //修改简介 | ||
| 48 | - static editUserIntroductionPage = new WDRouterPage("wdComponent", "ets/components/page/EditUserIntroductionPage"); | ||
| 49 | - | ||
| 50 | - static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview"); | ||
| 51 | -} |
| 1 | -import bundleManager from '@ohos.bundle.bundleManager' | ||
| 2 | - | ||
| 3 | -export class WDRouterPage { | ||
| 4 | - private moduleName: string | ||
| 5 | - private pagePath: string | ||
| 6 | - | ||
| 7 | - constructor(moduleName: string, pagePath: string) { | ||
| 8 | - this.moduleName = moduleName | ||
| 9 | - this.pagePath = pagePath | ||
| 10 | - } | ||
| 11 | - | ||
| 12 | - url() { | ||
| 13 | - let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT) | ||
| 14 | - return `@bundle:${bundleInfo.name}/${this.moduleName}/${this.pagePath}` | ||
| 15 | - } | ||
| 16 | - | ||
| 17 | - // 主页 | ||
| 18 | - static index = new WDRouterPage("phone", "ets/pages/Index"); | ||
| 19 | - // 关于页面 | ||
| 20 | - // static aboutPage = new WDRouterPage("entry", "ets/pages/about/AboutPage"); | ||
| 21 | - // web默认页面 | ||
| 22 | - static defaultWebPage = new WDRouterPage("phone", "ets/pages/web/DefaultWebPage"); | ||
| 23 | - // 电子报页面 | ||
| 24 | - static eNewspaper = new WDRouterPage("phone", "ets/pages/ENewspaper") | ||
| 25 | - // 早晚报页面 | ||
| 26 | - static morningEveningPaperPage = new WDRouterPage("phone", "ets/pages/MorningEveningPaperPage") | ||
| 27 | - // 图文详情页 | ||
| 28 | - static imageTextDetailPage = new WDRouterPage("phone", "ets/pages/ImageAndTextDetailPage"); | ||
| 29 | - // 短视频详情页 | ||
| 30 | - static detailPlayShortVideoPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailPlayShortVideoPage"); | ||
| 31 | - // 点播详情页 | ||
| 32 | - static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage"); | ||
| 33 | - // 直播详情页 | ||
| 34 | - static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage"); | ||
| 35 | - | ||
| 36 | - static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); | ||
| 37 | - | ||
| 38 | - static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); | ||
| 39 | - //我的 预约 | ||
| 40 | - static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage"); | ||
| 41 | - //我的 关注 | ||
| 42 | - static followListPage = new WDRouterPage("wdComponent", "ets/components/page/FollowListPage"); | ||
| 43 | -} |
| 1 | -import bundleManager from '@ohos.bundle.bundleManager' | ||
| 2 | - | ||
| 3 | -export class WDRouterPage { | ||
| 4 | - private moduleName: string | ||
| 5 | - private pagePath: string | ||
| 6 | - | ||
| 7 | - constructor(moduleName: string, pagePath: string) { | ||
| 8 | - this.moduleName = moduleName | ||
| 9 | - this.pagePath = pagePath | ||
| 10 | - } | ||
| 11 | - | ||
| 12 | - url() { | ||
| 13 | - let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT) | ||
| 14 | - return `@bundle:${bundleInfo.name}/${this.moduleName}/${this.pagePath}` | ||
| 15 | - } | ||
| 16 | - | ||
| 17 | - // 主页 | ||
| 18 | - static index = new WDRouterPage("phone", "ets/pages/Index"); | ||
| 19 | - // 关于页面 | ||
| 20 | - // static aboutPage = new WDRouterPage("entry", "ets/pages/about/AboutPage"); | ||
| 21 | - // web默认页面 | ||
| 22 | - static defaultWebPage = new WDRouterPage("phone", "ets/pages/web/DefaultWebPage"); | ||
| 23 | - // 电子报页面 | ||
| 24 | - static eNewspaper = new WDRouterPage("phone", "ets/pages/ENewspaper") | ||
| 25 | - // 早晚报页面 | ||
| 26 | - static morningEveningPaperPage = new WDRouterPage("phone", "ets/pages/MorningEveningPaperPage") | ||
| 27 | - // 图文详情页 | ||
| 28 | - static imageTextDetailPage = new WDRouterPage("phone", "ets/pages/ImageAndTextDetailPage"); | ||
| 29 | - // 短视频详情页 | ||
| 30 | - static detailPlayShortVideoPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailPlayShortVideoPage"); | ||
| 31 | - // 点播详情页 | ||
| 32 | - static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage"); | ||
| 33 | - // 直播详情页 | ||
| 34 | - static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage"); | ||
| 35 | - | ||
| 36 | - static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); | ||
| 37 | - | ||
| 38 | - static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); | ||
| 39 | - //我的 预约 | ||
| 40 | - static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage"); | ||
| 41 | - //我的 关注 | ||
| 42 | - static followListPage = new WDRouterPage("wdComponent", "ets/components/page/FollowListPage"); | ||
| 43 | - //资料编辑 | ||
| 44 | - static editUserInfoPage = new WDRouterPage("wdComponent", "ets/components/page/EditUserInfoPage"); | ||
| 45 | - //修改昵称 | ||
| 46 | - static editUserNikeNamePage = new WDRouterPage("wdComponent", "ets/components/page/EditUserNikeNamePage"); | ||
| 47 | - //修改简介 | ||
| 48 | - static editUserIntroductionPage = new WDRouterPage("wdComponent", "ets/components/page/EditUserIntroductionPage"); | ||
| 49 | -} |
| 1 | -import bundleManager from '@ohos.bundle.bundleManager' | ||
| 2 | - | ||
| 3 | -export class WDRouterPage { | ||
| 4 | - private moduleName: string | ||
| 5 | - private pagePath: string | ||
| 6 | - | ||
| 7 | - constructor(moduleName: string, pagePath: string) { | ||
| 8 | - this.moduleName = moduleName | ||
| 9 | - this.pagePath = pagePath | ||
| 10 | - } | ||
| 11 | - | ||
| 12 | - url() { | ||
| 13 | - let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT) | ||
| 14 | - return `@bundle:${bundleInfo.name}/${this.moduleName}/${this.pagePath}` | ||
| 15 | - } | ||
| 16 | - | ||
| 17 | - // 主页 | ||
| 18 | - static index = new WDRouterPage("phone", "ets/pages/Index"); | ||
| 19 | - // 关于页面 | ||
| 20 | - // static aboutPage = new WDRouterPage("entry", "ets/pages/about/AboutPage"); | ||
| 21 | - // web默认页面 | ||
| 22 | - static defaultWebPage = new WDRouterPage("phone", "ets/pages/web/DefaultWebPage"); | ||
| 23 | - // 电子报页面 | ||
| 24 | - static eNewspaper = new WDRouterPage("phone", "ets/pages/ENewspaper") | ||
| 25 | - // 早晚报页面 | ||
| 26 | - static morningEveningPaperPage = new WDRouterPage("phone", "ets/pages/MorningEveningPaperPage") | ||
| 27 | - // 图文详情页 | ||
| 28 | - static imageTextDetailPage = new WDRouterPage("phone", "ets/pages/ImageAndTextDetailPage"); | ||
| 29 | - // 短视频详情页 | ||
| 30 | - static detailPlayShortVideoPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailPlayShortVideoPage"); | ||
| 31 | - // 点播详情页 | ||
| 32 | - static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage"); | ||
| 33 | - // 直播详情页 | ||
| 34 | - static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage"); | ||
| 35 | - | ||
| 36 | - static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); | ||
| 37 | - | ||
| 38 | - static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); | ||
| 39 | - //我的 预约 | ||
| 40 | - static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage"); | ||
| 41 | - //我的 关注 | ||
| 42 | - static followListPage = new WDRouterPage("wdComponent", "ets/components/page/FollowListPage"); | ||
| 43 | - | ||
| 44 | - static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview"); | ||
| 45 | -} |
| 1 | +/** | ||
| 2 | + * h5调用native,事件id枚举, | ||
| 3 | + * h5主动调用app方法 | ||
| 4 | + */ | ||
| 5 | +export class H5CallNativeType { | ||
| 6 | + static JsCallTypeList: string[] = [] | ||
| 7 | + static jsCall_currentPageOperate = 'jsCall_currentPageOperate' | ||
| 8 | + static jsCall_getAppPublicInfo = 'jsCall_getAppPublicInfo' | ||
| 9 | + static jsCall_getArticleDetailBussinessData = 'jsCall_getArticleDetailBussinessData' | ||
| 10 | + static jsCall_callAppService = 'jsCall_callAppService' | ||
| 11 | + // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。 | ||
| 12 | + | ||
| 13 | + static init() { | ||
| 14 | + H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_currentPageOperate) | ||
| 15 | + H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppPublicInfo) | ||
| 16 | + H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getArticleDetailBussinessData) | ||
| 17 | + H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_callAppService) | ||
| 18 | + } | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | + |
| 1 | -import { Action } from 'wdBean'; | ||
| 2 | -import { Callback } from 'wdJsBridge'; | 1 | +import { Callback, BridgeWebViewControl } from 'wdJsBridge'; |
| 2 | +import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | ||
| 3 | import { Logger, StringUtils, } from 'wdKit'; | 3 | import { Logger, StringUtils, } from 'wdKit'; |
| 4 | -// import { AccountManagerUtils, ILoginService, Logger, ServiceManager, StringUtils, UserBean, UserInfo } from 'wdKit'; | ||
| 5 | -import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 4 | +import { H5CallNativeType } from './H5CallNativeType'; |
| 6 | 5 | ||
| 7 | -// import { wdMenc } from 'wdMenc'; | 6 | +const TAG = 'JsBridgeBiz' |
| 8 | 7 | ||
| 9 | /** | 8 | /** |
| 10 | * h5调用native代码 | 9 | * h5调用native代码 |
| 11 | * @param data | 10 | * @param data |
| 12 | * @param call | 11 | * @param call |
| 13 | */ | 12 | */ |
| 14 | -export function performJSCallNative(data: Action, call: Callback) { | ||
| 15 | - | ||
| 16 | - // if (data.name == "GET_PROMOTION_SIGN") { | ||
| 17 | - // wdMenc.getActivitySign(data.params?.intfId, (sign) => { | ||
| 18 | - // if (sign) { | ||
| 19 | - // call(JSON.stringify(sign)); | ||
| 20 | - // } else { | ||
| 21 | - // call("") | ||
| 22 | - // } | ||
| 23 | - // }) | ||
| 24 | - // return | ||
| 25 | - // } | ||
| 26 | - | ||
| 27 | - //TODO 数据校验 | ||
| 28 | - switch (data.type) { | ||
| 29 | - //获取用户信息 | ||
| 30 | - case "GET_USER_INFO": | ||
| 31 | - //测试环境 | ||
| 32 | - // call(JSON.stringify(getTestUserBean())) | ||
| 33 | - // let isLogin = AccountManagerUtils.isLoginSync() | ||
| 34 | - // Logger.info("WebComponent", `GET_USER_INFO#:::refresh==` + isLogin); | ||
| 35 | - // | ||
| 36 | - // if (isLogin) { | ||
| 37 | - // const loginService = ServiceManager.getService(ILoginService.name) as ILoginService.Service | ||
| 38 | - // let userBean: UserBean = loginService.getUserBean() | ||
| 39 | - // // userBean.userInfo = JSON.stringify(loginService.getUserInfo()) | ||
| 40 | - // call(JSON.stringify(userBean)) | ||
| 41 | - // } else { | ||
| 42 | - // call("fail") | ||
| 43 | - // } | ||
| 44 | - | 13 | +export function performJSCallNative(data: Message, call: Callback) { |
| 14 | + Logger.debug(TAG, 'performJSCallNative handlerName: ' + data.handlerName + ', data: ' + data.data) | ||
| 15 | + switch (data.handlerName) { | ||
| 16 | + case H5CallNativeType.jsCall_currentPageOperate: | ||
| 17 | + break; | ||
| 18 | + case H5CallNativeType.jsCall_getAppPublicInfo: | ||
| 19 | + // h5获取app配置信息 | ||
| 20 | + call(getAppPublicInfo()) | ||
| 21 | + break; | ||
| 22 | + case H5CallNativeType.jsCall_getArticleDetailBussinessData: | ||
| 23 | + break; | ||
| 24 | + case H5CallNativeType.jsCall_callAppService: | ||
| 45 | break; | 25 | break; |
| 46 | - case "JUMP_DETAIL_PAGE": | ||
| 47 | - WDRouterRule.jumpWithAction(data) | 26 | + case 'changeNativeMessage': |
| 27 | + call("this is change Web Message") | ||
| 48 | break; | 28 | break; |
| 49 | - case "JUMP_INNER_NEW_PAGE": | ||
| 50 | - WDRouterRule.jumpWithAction(data) | ||
| 51 | - break | ||
| 52 | - case "GET_DEVICE_DATA": | ||
| 53 | - break | ||
| 54 | - //用户登陆 | ||
| 55 | - case "USER_LOGIN": | ||
| 56 | - WDRouterRule.jumpWithAction(data) | ||
| 57 | - //支付完成回调 | ||
| 58 | - case "REGISTER_H5_WEBVIEW_CREATE_ORDER_RESULT": | ||
| 59 | - break | ||
| 60 | - //打开H5页面 | ||
| 61 | - case "JUMP_H5_BY_WEB_VIEW": | ||
| 62 | - WDRouterRule.jumpWithAction(data) | ||
| 63 | - break | ||
| 64 | - case "USER_LOGOUT": | ||
| 65 | - // const loginService = ServiceManager.getService(ILoginService.name) as ILoginService.Service | ||
| 66 | - // loginService.logout() | ||
| 67 | - break | ||
| 68 | default: | 29 | default: |
| 69 | call("this is def value") | 30 | call("this is def value") |
| 70 | } | 31 | } |
| 71 | 32 | ||
| 72 | } | 33 | } |
| 73 | 34 | ||
| 74 | -// /** | ||
| 75 | -// * | ||
| 76 | -// * @returns 模拟测试环境的user信息 | ||
| 77 | -// */ | ||
| 78 | -// function getTestUserBean(): UserBean { | ||
| 79 | -// const loginService = ServiceManager.getService(ILoginService.name) as ILoginService.Service | ||
| 80 | -// //正是环境 | ||
| 81 | -// let userBean: UserBean = loginService.getUserBean() | ||
| 82 | -// userBean.userId = "930855275" | ||
| 83 | -// userBean.userToken = "nlps6FADECE38F5AAD2116F2" | ||
| 84 | -// // userBean.clientId = "f1bf515c-4006-4606-a752-2b4cdd9343d0" | ||
| 85 | -// // userBean.carrierCode = "CM" | ||
| 86 | -// userBean.mobile = "NTTrcDO4ADN1cTM5MTM" | ||
| 87 | -// userBean.uname = '139****0887' | ||
| 88 | -// userBean.picture = "http://36.155.98.104:23380/publish/voms2/uic_service/picture/userImage/543/626/5181.jpg" | ||
| 89 | -// // userBean.ssotoken = "STnid0000011700463753943SKPUlfNxEDJsrauGjCwUldiDfrd0mUuM" | ||
| 90 | -// // userBean.clientProvinceCode = "210" | ||
| 91 | -// // userBean.clientCityId = "0210" | ||
| 92 | -// // userBean.sign = "617DAC548595B7C9EBB13043735F1BE0" | ||
| 93 | -// // userBean.blurMobile = "177****9217" | ||
| 94 | -// let userinfo: UserInfo = ({ | ||
| 95 | -// userId: "930855275", | ||
| 96 | -// userNum: "NzDrsyN4gDM0UzNxkzMxYDO", | ||
| 97 | -// mobile: "NTTrcDO4ADN1cTM5MTM", | ||
| 98 | -// areaId: "210", | ||
| 99 | -// cityId: "0210", | ||
| 100 | -// carrierCode: "CM", | ||
| 101 | -// passId: "602201990200225921", | ||
| 102 | -// userToken: "nlps6FADECE38F5AAD2116F2", | ||
| 103 | -// expiredOn: "1705647754000", | ||
| 104 | -// blurMobile: "139****0887", | ||
| 105 | -// encrypted: true | ||
| 106 | -// }) | ||
| 107 | -// // userBean.userInfo = JSON.stringify(userinfo); | ||
| 108 | -// return userBean | ||
| 109 | -// } | ||
| 110 | -// | ||
| 111 | -// /** | ||
| 112 | -// * | ||
| 113 | -// * @returns 用户信息 | ||
| 114 | -// */ | ||
| 115 | -// function getUserBean(): UserBean { | ||
| 116 | -// const loginService = ServiceManager.getService(ILoginService.name) as ILoginService.Service | ||
| 117 | -// //正是环境 | ||
| 118 | -// let userBean: UserBean = loginService.getUserBean() | ||
| 119 | -// userBean.userId = "1437725487" | ||
| 120 | -// userBean.userToken = "nlps08468E117C554CA08A43" | ||
| 121 | -// // userBean.clientId = "27fb3129-5a54-45bc-8af1-7dc8f1155501" | ||
| 122 | -// // userBean.carrierCode = "CT" | ||
| 123 | -// userBean.mobile = "OTTrcTMykTO4ATM3cTM" | ||
| 124 | -// userBean.uname = '小可爱啊' | ||
| 125 | -// userBean.picture = "http://img.cmvideo.cn:8080/publish/voms2/uic_service/picture/userImage/1437/725/487/20211224174128beax.png" | ||
| 126 | -// // userBean.ssotoken = "STnid0000011700461738301N5rjsHdbvyzMpyzwvHrFRJsj7oNT1Juf" | ||
| 127 | -// // userBean.clientProvinceCode = "100" | ||
| 128 | -// // userBean.clientCityId = "0100" | ||
| 129 | -// // userBean.sign = "4ABFB8442EE914B57CCD9F1DE587D96D" | ||
| 130 | -// // userBean.blurMobile = "177****9217" | ||
| 131 | -// let userinfo: UserInfo = ({ | ||
| 132 | -// userId: "1437725487", | ||
| 133 | -// userNum: "MzDrsyNxITO5gDMxczNxYDO", | ||
| 134 | -// mobile: "OTTrcTMykTO4ATM3cTM", | ||
| 135 | -// areaId: "100", | ||
| 136 | -// cityId: "0100", | ||
| 137 | -// carrierCode: "CT", | ||
| 138 | -// passId: "467464726359024540", | ||
| 139 | -// userToken: "nlps08468E117C554CA08A43", | ||
| 140 | -// expiredOn: "1705645738000", | ||
| 141 | -// blurMobile: "177****9217", | ||
| 142 | -// encrypted: true | ||
| 143 | -// }) | ||
| 144 | -// // userBean.userInfo = JSON.stringify(userinfo); | ||
| 145 | -// return userBean | ||
| 146 | -// } | 35 | +class AppInfo { |
| 36 | + plat: string = '' | ||
| 37 | + system: string = '' | ||
| 38 | + // TODO 完善 | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +/** | ||
| 42 | + * 获取App公共信息 | ||
| 43 | + */ | ||
| 44 | +function getAppPublicInfo(): string { | ||
| 45 | + let info = new AppInfo() | ||
| 46 | + info.plat = 'Phone' | ||
| 47 | + // 直接用Android,后续适配再新增鸿蒙 | ||
| 48 | + info.system = 'Android' | ||
| 49 | + let result = JSON.stringify(info) | ||
| 50 | + return result; | ||
| 51 | +} | ||
| 147 | 52 | ||
| 148 | 53 |
| @@ -5,6 +5,7 @@ import { Logger } from 'wdKit'; | @@ -5,6 +5,7 @@ import { Logger } from 'wdKit'; | ||
| 5 | import { BridgeHandler, BridgeUtil, BridgeWebViewControl, Callback } from 'wdJsBridge'; | 5 | import { BridgeHandler, BridgeUtil, BridgeWebViewControl, Callback } from 'wdJsBridge'; |
| 6 | import { performJSCallNative } from './JsBridgeBiz'; | 6 | import { performJSCallNative } from './JsBridgeBiz'; |
| 7 | import { setDefaultNativeWebSettings } from './WebComponentUtil'; | 7 | import { setDefaultNativeWebSettings } from './WebComponentUtil'; |
| 8 | +import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | ||
| 8 | 9 | ||
| 9 | const TAG = 'WdWebComponent'; | 10 | const TAG = 'WdWebComponent'; |
| 10 | 11 | ||
| @@ -12,7 +13,7 @@ const TAG = 'WdWebComponent'; | @@ -12,7 +13,7 @@ const TAG = 'WdWebComponent'; | ||
| 12 | export struct WdWebComponent { | 13 | export struct WdWebComponent { |
| 13 | private webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | 14 | private webviewControl: BridgeWebViewControl = new BridgeWebViewControl() |
| 14 | //TODO 默认网页 | 15 | //TODO 默认网页 |
| 15 | - webUrl: string = ConfigConstants.DETAIL_URL | 16 | + webUrl: string | Resource = ConfigConstants.DETAIL_URL |
| 16 | /** | 17 | /** |
| 17 | * 对外暴露webview的回调,能力 | 18 | * 对外暴露webview的回调,能力 |
| 18 | */ | 19 | */ |
| @@ -30,7 +31,7 @@ export struct WdWebComponent { | @@ -30,7 +31,7 @@ export struct WdWebComponent { | ||
| 30 | /** | 31 | /** |
| 31 | * 默认【CallNative】逻辑处理 | 32 | * 默认【CallNative】逻辑处理 |
| 32 | */ | 33 | */ |
| 33 | - private defaultPerformJSCallNative: (data: Action, f: Callback) => void = (data: Action, f: Callback) => { | 34 | + private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => { |
| 34 | performJSCallNative(data, f) | 35 | performJSCallNative(data, f) |
| 35 | } | 36 | } |
| 36 | /** | 37 | /** |
| @@ -41,7 +42,7 @@ export struct WdWebComponent { | @@ -41,7 +42,7 @@ export struct WdWebComponent { | ||
| 41 | 42 | ||
| 42 | defaultRegisterHandler(): void { | 43 | defaultRegisterHandler(): void { |
| 43 | this.webviewControl.registerHandler("CallNative", { | 44 | this.webviewControl.registerHandler("CallNative", { |
| 44 | - handle: (data: Action, f: Callback) => { | 45 | + handle: (data: Message, f: Callback) => { |
| 45 | this.defaultPerformJSCallNative(data, f) | 46 | this.defaultPerformJSCallNative(data, f) |
| 46 | } | 47 | } |
| 47 | }); | 48 | }); |
| @@ -88,7 +89,7 @@ export struct WdWebComponent { | @@ -88,7 +89,7 @@ export struct WdWebComponent { | ||
| 88 | // },500) | 89 | // },500) |
| 89 | // }) | 90 | // }) |
| 90 | // this.onPageBegin(event?.url) | 91 | // this.onPageBegin(event?.url) |
| 91 | - this.webviewControl?.setCustomUserAgent('Mozilla/5.0 (Linux; Android 12; HarmonyOS; OXF-AN00; HMSCore 6.13.0.302) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 HuaweiBrowser/14.0.6.300 Mobile Safari/537.36') | 92 | + // this.webviewControl?.setCustomUserAgent('Mozilla/5.0 (Linux; Android 12; HarmonyOS; OXF-AN00; HMSCore 6.13.0.302) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 HuaweiBrowser/14.0.6.300 Mobile Safari/537.36') |
| 92 | }) | 93 | }) |
| 93 | .onLoadIntercept((event) => { | 94 | .onLoadIntercept((event) => { |
| 94 | let url: string = event.data.getRequestUrl().toString() | 95 | let url: string = event.data.getRequestUrl().toString() |
| 1 | import router from '@ohos.router'; | 1 | import router from '@ohos.router'; |
| 2 | -import { BridgeUtil, BridgeWebViewControl } from 'wdJsBridge'; | ||
| 3 | -import { ResourceManager } from 'wdJsBridge/src/main/ets/utils/ResourceManager'; | 2 | +import { BridgeHandler, BridgeUtil, BridgeWebViewControl, Callback } from 'wdJsBridge'; |
| 3 | +import { Logger } from 'wdKit/Index'; | ||
| 4 | +import { setDefaultNativeWebSettings } from './WebComponentUtil'; | ||
| 5 | +import { Action } from 'wdBean'; | ||
| 6 | +import { performJSCallNative } from './JsBridgeBiz'; | ||
| 7 | +import { H5CallNativeType } from './H5CallNativeType'; | ||
| 8 | +import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | ||
| 4 | 9 | ||
| 5 | const TAG = 'WdWebLocalComponent'; | 10 | const TAG = 'WdWebLocalComponent'; |
| 6 | 11 | ||
| @@ -26,12 +31,34 @@ export struct WdWebLocalComponent { | @@ -26,12 +31,34 @@ export struct WdWebLocalComponent { | ||
| 26 | .visibility(this.backVisibility ? Visibility.Visible : Visibility.None) | 31 | .visibility(this.backVisibility ? Visibility.Visible : Visibility.None) |
| 27 | 32 | ||
| 28 | Web({ src: this.webResource, controller: this.webviewControl }) | 33 | Web({ src: this.webResource, controller: this.webviewControl }) |
| 34 | + .layoutMode(WebLayoutMode.FIT_CONTENT) | ||
| 29 | .domStorageAccess(true) | 35 | .domStorageAccess(true) |
| 30 | .databaseAccess(true) | 36 | .databaseAccess(true) |
| 31 | .javaScriptAccess(true) | 37 | .javaScriptAccess(true) |
| 38 | + // .imageAccess(true) | ||
| 39 | + // .onlineImageAccess(true) | ||
| 40 | + // .fileAccess(true) | ||
| 32 | .onPageBegin((event) => { | 41 | .onPageBegin((event) => { |
| 33 | 42 | ||
| 34 | - }) | 43 | + // setDefaultNativeWebSettings(this.webviewControl, this.webResource).then(()=>{ |
| 44 | + // this.handleInfo && this.handleInfo.length > 1 ? this.handleInfo.forEach(value => { | ||
| 45 | + // this.webviewControl.registerHandler(value[0], value[1]) | ||
| 46 | + // }) : this.defaultRegisterHandler() | ||
| 47 | + // setTimeout(()=>{ | ||
| 48 | + // BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl) | ||
| 49 | + // },500) | ||
| 50 | + // }) | ||
| 51 | + // this.onPageBegin(event?.url) | ||
| 52 | + // BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl); | ||
| 53 | + this.onPageBegin(event?.url); | ||
| 54 | + this.registerHandlers(); | ||
| 55 | + setTimeout(() => { | ||
| 56 | + BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl) | ||
| 57 | + }, 200) | ||
| 58 | + }) | ||
| 59 | + .onPageEnd((event) => { | ||
| 60 | + this.onPageEnd(event?.url) | ||
| 61 | + }) | ||
| 35 | .onLoadIntercept((event) => { | 62 | .onLoadIntercept((event) => { |
| 36 | let url: string = event.data.getRequestUrl().toString() | 63 | let url: string = event.data.getRequestUrl().toString() |
| 37 | url = url.replace("%(?![0-9a-fA-F]{2})", "%25") | 64 | url = url.replace("%(?![0-9a-fA-F]{2})", "%25") |
| @@ -42,12 +69,50 @@ export struct WdWebLocalComponent { | @@ -42,12 +69,50 @@ export struct WdWebLocalComponent { | ||
| 42 | return true | 69 | return true |
| 43 | } | 70 | } |
| 44 | if (url.startsWith(BridgeUtil.YY_OVERRIDE_SCHEMA)) { | 71 | if (url.startsWith(BridgeUtil.YY_OVERRIDE_SCHEMA)) { |
| 72 | + Logger.debug(TAG, 'flushMessageQueue'); | ||
| 45 | this.webviewControl.flushMessageQueue() | 73 | this.webviewControl.flushMessageQueue() |
| 46 | return true | 74 | return true |
| 47 | } | 75 | } |
| 48 | - return false | 76 | + return this.onLoadIntercept(event.data.getRequestUrl().toString()); |
| 49 | }) | 77 | }) |
| 50 | } | 78 | } |
| 51 | } | 79 | } |
| 80 | + | ||
| 81 | + private registerHandlers(): void { | ||
| 82 | + // TODO 待优化 | ||
| 83 | + H5CallNativeType.init(); | ||
| 84 | + // 注册h5调用js相关 | ||
| 85 | + for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) { | ||
| 86 | + let handleName = H5CallNativeType.JsCallTypeList[i]; | ||
| 87 | + let handle = (data: Message, f: Callback) => { | ||
| 88 | + this.defaultPerformJSCallNative(data, f) | ||
| 89 | + } ; | ||
| 90 | + this.webviewControl.registerHandler(handleName, { handle: handle }); | ||
| 91 | + } | ||
| 92 | + // // TODO test | ||
| 93 | + // this.webviewControl.registerHandler('changeNativeMessage', { | ||
| 94 | + // handle: (data: Message, f: Callback) => { | ||
| 95 | + // this.defaultPerformJSCallNative(data, f) | ||
| 96 | + // } | ||
| 97 | + // }); | ||
| 98 | + | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + /** | ||
| 102 | + * 默认【CallNative】逻辑处理 | ||
| 103 | + */ | ||
| 104 | + private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => { | ||
| 105 | + performJSCallNative(data, f) | ||
| 106 | + } | ||
| 107 | + onPageBegin: (url?: string) => void = () => { | ||
| 108 | + Logger.debug(TAG, 'onPageBegin'); | ||
| 109 | + } | ||
| 110 | + onPageEnd: (url?: string) => void = () => { | ||
| 111 | + Logger.debug(TAG, 'onPageEnd'); | ||
| 112 | + } | ||
| 113 | + onLoadIntercept: (url?: string) => boolean = () => { | ||
| 114 | + Logger.debug(TAG, 'onPageBegin return false'); | ||
| 115 | + return false | ||
| 116 | + } | ||
| 52 | } | 117 | } |
| 53 | 118 |
sight_harmony/dependencies/hvigor-4.1.2.tgz
0 → 100644
This file is too large to display.
No preview for this file type
No preview for this file type
| @@ -5,6 +5,8 @@ export { BottomNavDTO } from './src/main/ets/bean/navigation/BottomNavDTO'; | @@ -5,6 +5,8 @@ export { BottomNavDTO } from './src/main/ets/bean/navigation/BottomNavDTO'; | ||
| 5 | 5 | ||
| 6 | export { TopNavDTO } from './src/main/ets/bean/navigation/TopNavDTO'; | 6 | export { TopNavDTO } from './src/main/ets/bean/navigation/TopNavDTO'; |
| 7 | 7 | ||
| 8 | +export { PageInfoDTO } from './src/main/ets/bean/navigation/PageInfoDTO'; | ||
| 9 | + | ||
| 8 | // entity | 10 | // entity |
| 9 | export { ItemDTO } from './src/main/ets/bean/ItemDTO'; | 11 | export { ItemDTO } from './src/main/ets/bean/ItemDTO'; |
| 10 | 12 | ||
| @@ -34,7 +36,8 @@ export { | @@ -34,7 +36,8 @@ export { | ||
| 34 | postExecuteLikeParams, | 36 | postExecuteLikeParams, |
| 35 | postExecuteCollectRecordParams, | 37 | postExecuteCollectRecordParams, |
| 36 | contentListParams, | 38 | contentListParams, |
| 37 | - postInteractAccentionOperateParams | 39 | + postInteractAccentionOperateParams, |
| 40 | + postRecommendListParams | ||
| 38 | } from './src/main/ets/bean/detail/MultiPictureDetailPageDTO'; | 41 | } from './src/main/ets/bean/detail/MultiPictureDetailPageDTO'; |
| 39 | 42 | ||
| 40 | export { InteractParam, ContentBean } from './src/main/ets/bean/content/InteractParam'; | 43 | export { InteractParam, ContentBean } from './src/main/ets/bean/content/InteractParam'; |
| @@ -49,6 +52,8 @@ export { GroupDTO } from './src/main/ets/bean/component/GroupDTO'; | @@ -49,6 +52,8 @@ export { GroupDTO } from './src/main/ets/bean/component/GroupDTO'; | ||
| 49 | 52 | ||
| 50 | export { CompDTO } from './src/main/ets/bean/component/CompDTO'; | 53 | export { CompDTO } from './src/main/ets/bean/component/CompDTO'; |
| 51 | 54 | ||
| 55 | +export { LiveReviewDTO } from './src/main/ets/bean/component/LiveReviewDTO'; | ||
| 56 | + | ||
| 52 | export { NewspaperListBean } from './src/main/ets/bean/newspaper/NewspaperListBean'; | 57 | export { NewspaperListBean } from './src/main/ets/bean/newspaper/NewspaperListBean'; |
| 53 | 58 | ||
| 54 | export { NewspaperListItemBean } from './src/main/ets/bean/newspaper/NewspaperListItemBean'; | 59 | export { NewspaperListItemBean } from './src/main/ets/bean/newspaper/NewspaperListItemBean'; |
| @@ -77,6 +82,8 @@ export { ShareInfoDTO } from './src/main/ets/bean/detail/ShareInfoDTO'; | @@ -77,6 +82,8 @@ export { ShareInfoDTO } from './src/main/ets/bean/detail/ShareInfoDTO'; | ||
| 77 | 82 | ||
| 78 | export { VideoInfoDTO } from './src/main/ets/bean/detail/VideoInfoDTO'; | 83 | export { VideoInfoDTO } from './src/main/ets/bean/detail/VideoInfoDTO'; |
| 79 | 84 | ||
| 85 | +export { AttentionRmhInfoDTO } from './src/main/ets/bean/detail/AttentionRmhInfoDTO'; | ||
| 86 | + | ||
| 80 | export { H5ReceiveDetailBean } from './src/main/ets/bean/h5/H5ReceiveDetailBean'; | 87 | export { H5ReceiveDetailBean } from './src/main/ets/bean/h5/H5ReceiveDetailBean'; |
| 81 | 88 | ||
| 82 | export { H5ReceiveDataJsonBean } from './src/main/ets/bean/h5/H5ReceiveDataJsonBean'; | 89 | export { H5ReceiveDataJsonBean } from './src/main/ets/bean/h5/H5ReceiveDataJsonBean'; |
| @@ -103,4 +110,13 @@ export { OperDataList } from './src/main/ets/bean/morningevening/OperDataList'; | @@ -103,4 +110,13 @@ export { OperDataList } from './src/main/ets/bean/morningevening/OperDataList'; | ||
| 103 | 110 | ||
| 104 | export { ShareInfo } from './src/main/ets/bean/morningevening/ShareInfo'; | 111 | export { ShareInfo } from './src/main/ets/bean/morningevening/ShareInfo'; |
| 105 | 112 | ||
| 106 | -export { slideShows } from './src/main/ets/bean/morningevening/slideShows'; | ||
| 113 | +export { slideShows } from './src/main/ets/bean/morningevening/slideShows'; | ||
| 114 | + | ||
| 115 | +export { LiveDetailsBean } from './src/main/ets/bean/live/LiveDetailsBean'; | ||
| 116 | + | ||
| 117 | +export { ArticleListDTO } from './src/main/ets/bean/component/ArticleListDTO'; | ||
| 118 | + | ||
| 119 | +export { appStyleImagesDTO } from './src/main/ets/bean/content/appStyleImagesDTO'; | ||
| 120 | + | ||
| 121 | +export { LiveRoomBean,LiveRoomItemBean } from './src/main/ets/bean/live/LiveRoomBean'; | ||
| 122 | + |
| 1 | +/** | ||
| 2 | + * http://192.168.1.3:3300/project/3856/interface/api/190567 | ||
| 3 | + * 接口名称:客户端 客态主页页面-获取作品-从发布库获取该创作者下 稿件列表 | ||
| 4 | + * 接口路径:GET/zh/c/article/articleList | ||
| 5 | + * 人民号-动态tab下列表数据 | ||
| 6 | + */ | ||
| 7 | +import { appStyleImagesDTO } from '../content/appStyleImagesDTO' | ||
| 8 | +import {contentVideosDTO} from '../content/contentVideosDTO' | ||
| 9 | +export interface ArticleListDTO { | ||
| 10 | + listTitle: string; | ||
| 11 | + mainPicCount: string; | ||
| 12 | + videosCount: string; | ||
| 13 | + voicesCount: string; | ||
| 14 | + landscape: number; | ||
| 15 | + sourceName: string; | ||
| 16 | + finalStatus: string; | ||
| 17 | + score: string; | ||
| 18 | + shareUrl: string; | ||
| 19 | + sortPosId: string; | ||
| 20 | + id: string; | ||
| 21 | + serialsId: string; | ||
| 22 | + oldContentId: string; | ||
| 23 | + type: string; | ||
| 24 | + tenancy: string; | ||
| 25 | + clientPubFlag: string; | ||
| 26 | + grayScale: string; | ||
| 27 | + title: string | ||
| 28 | + publishType: string; | ||
| 29 | + publishTime: string; | ||
| 30 | + firstPublishTime: string; | ||
| 31 | + onlineStatus: string; | ||
| 32 | + auditingStatus: string; | ||
| 33 | + zhOnlineStatus: string; | ||
| 34 | + zhAuditingStatus: string; | ||
| 35 | + selectedStatus: string; | ||
| 36 | + qualityScore: string; | ||
| 37 | + levelScore: number; | ||
| 38 | + isOrg: string; | ||
| 39 | + articlePayment: number; | ||
| 40 | + appStyle: number; | ||
| 41 | + appStyleImages: appStyleImagesDTO[]; | ||
| 42 | + description: string; | ||
| 43 | + introduction: string; | ||
| 44 | + deleted: string; | ||
| 45 | + keyArticle: string; | ||
| 46 | + updateTime: string; | ||
| 47 | + createTime: string; | ||
| 48 | + createUserId: string; | ||
| 49 | + createUserName: string; | ||
| 50 | + creatorId: number; | ||
| 51 | + creatorName: string; | ||
| 52 | + articleExistVote: string; | ||
| 53 | + rmhPlatform: string; | ||
| 54 | + objectPos: string; | ||
| 55 | + objectPosPictures: string; | ||
| 56 | + shareFlag: string; | ||
| 57 | + firstPublish: string; | ||
| 58 | + readNum: string; | ||
| 59 | + readFlag: string; | ||
| 60 | + creatorLevel: string; | ||
| 61 | + creatorTag: string; | ||
| 62 | + joinActivity: string; | ||
| 63 | + userType: string; | ||
| 64 | + content: object; | ||
| 65 | + contentShare: []; | ||
| 66 | + contentLinkData: string; | ||
| 67 | + contentExt: []; | ||
| 68 | + contentVideos: contentVideosDTO[]; | ||
| 69 | + contentPictures: []; | ||
| 70 | + contentPayments: string; | ||
| 71 | + contentPaymentStaffs: string; | ||
| 72 | + contentTxt: []; | ||
| 73 | + contentSource: object; | ||
| 74 | + contentTags: string; | ||
| 75 | + contentVoices: string; | ||
| 76 | + contentAuthorLocals: string; | ||
| 77 | + contentEpaperArticle: string; | ||
| 78 | + contentStatistics: string; | ||
| 79 | + topicExistHeadImage: string; | ||
| 80 | + topicComps: string; | ||
| 81 | + live: string; | ||
| 82 | + statusInfo: string; | ||
| 83 | + askInfo: string; | ||
| 84 | + askAttachmentList: string; | ||
| 85 | + askAnswerList: string; | ||
| 86 | + askFeedbackList: string; | ||
| 87 | + ttopicInteracts: string; | ||
| 88 | + ttopic: string; | ||
| 89 | + mlive: string; | ||
| 90 | + vlives: string | ||
| 91 | +} |
| @@ -29,5 +29,4 @@ export interface CompDTO { | @@ -29,5 +29,4 @@ export interface CompDTO { | ||
| 29 | subType: string; | 29 | subType: string; |
| 30 | imageScale: number; // 封面图比例 1-4:3, 2-16:9, 3-3:2 | 30 | imageScale: number; // 封面图比例 1-4:3, 2-16:9, 3-3:2 |
| 31 | audioDataList: AudioDTO[]; | 31 | audioDataList: AudioDTO[]; |
| 32 | - isSelect: boolean; | ||
| 33 | } | 32 | } |
| @@ -4,7 +4,7 @@ import { VideoInfoDTO } from '../detail/VideoInfoDTO'; | @@ -4,7 +4,7 @@ import { VideoInfoDTO } from '../detail/VideoInfoDTO'; | ||
| 4 | import { InteractDataDTO } from './InteractDataDTO'; | 4 | import { InteractDataDTO } from './InteractDataDTO'; |
| 5 | import { slideShows } from '../morningevening/slideShows'; | 5 | import { slideShows } from '../morningevening/slideShows'; |
| 6 | import { VoiceInfoDTO } from '../detail/VoiceInfoDTO'; | 6 | import { VoiceInfoDTO } from '../detail/VoiceInfoDTO'; |
| 7 | - | 7 | +import { RmhInfoDTO } from '../detail/RmhInfoDTO' |
| 8 | export interface ContentDTO { | 8 | export interface ContentDTO { |
| 9 | appStyle: string; | 9 | appStyle: string; |
| 10 | cityCode: string; | 10 | cityCode: string; |
| @@ -59,10 +59,16 @@ export interface ContentDTO { | @@ -59,10 +59,16 @@ export interface ContentDTO { | ||
| 59 | 59 | ||
| 60 | newsSummary: string; //appstyle:2 ,新闻详情 | 60 | newsSummary: string; //appstyle:2 ,新闻详情 |
| 61 | 61 | ||
| 62 | - // 二次请求接口,返回的数据,这里组装到content里;TODO 后续优化 | 62 | + // 二次请求接口,返回的数据,这里组装到content里; |
| 63 | interactData:InteractDataDTO; | 63 | interactData:InteractDataDTO; |
| 64 | 64 | ||
| 65 | hasMore: number, | 65 | hasMore: number, |
| 66 | slideShows: slideShows[], | 66 | slideShows: slideShows[], |
| 67 | - voiceInfo: VoiceInfoDTO | 67 | + voiceInfo: VoiceInfoDTO, |
| 68 | + tagWord: number, | ||
| 69 | + isSelect: boolean; | ||
| 70 | + rmhInfo: RmhInfoDTO; // 人民号信息 | ||
| 71 | + photoNum: number; | ||
| 72 | + | ||
| 73 | + | ||
| 68 | } | 74 | } |
| 1 | +export interface contentVideosDTO { | ||
| 2 | + id: number; | ||
| 3 | + contentId: number; | ||
| 4 | + ossVideoId: string; | ||
| 5 | + url: string; | ||
| 6 | + fullUrl: string; | ||
| 7 | + bucket: string; | ||
| 8 | + duration: number; | ||
| 9 | + clarity: number; | ||
| 10 | + resolutionWidth: number; | ||
| 11 | + resolutionHeight: number; | ||
| 12 | + type: number; | ||
| 13 | + original: number; | ||
| 14 | + originalVideoId: string; | ||
| 15 | + landscape: number; | ||
| 16 | + size: number; | ||
| 17 | + templateId: string; | ||
| 18 | + deleted: number; | ||
| 19 | + coverPictureId: string; | ||
| 20 | + framePictureId: string; | ||
| 21 | + createUser: string; | ||
| 22 | + createTime: string; | ||
| 23 | + updateUser: string; | ||
| 24 | + updateTime: string; | ||
| 25 | + bak1: string; | ||
| 26 | + bak2: string; | ||
| 27 | + bak3: string; | ||
| 28 | + bak4: string; | ||
| 29 | + videoType: number; | ||
| 30 | + objectPosId: string; | ||
| 31 | +} |
| 1 | +export interface AttentionRmhInfoDTO { | ||
| 2 | + attentionCreatorId: string; | ||
| 3 | + attentionHeadPhotoUrl: string; | ||
| 4 | + attentionNum: number; | ||
| 5 | + attentionUserId: string; | ||
| 6 | + attentionUserName: string; | ||
| 7 | + attentionUserType: number; | ||
| 8 | + authIcon: string; | ||
| 9 | + authId: number; | ||
| 10 | + authPersional: string; | ||
| 11 | + authTitle: string; | ||
| 12 | + banControl: number; | ||
| 13 | + categoryAuth: string; | ||
| 14 | + cnLiveCommentControl: number; | ||
| 15 | + cnLiveGiftControl: number; | ||
| 16 | + cnLiveLikeControl: number; | ||
| 17 | + cnLiveShareControl: number; | ||
| 18 | + cnShareControl: number; | ||
| 19 | + collectNum: number; | ||
| 20 | + commentNum: number; | ||
| 21 | + createTime: number; | ||
| 22 | + fansNum: number; | ||
| 23 | + honoraryIcon: string; | ||
| 24 | + honoraryTitle: string; | ||
| 25 | + id: number; | ||
| 26 | + introduction: string; | ||
| 27 | + isAttention: number | null; | ||
| 28 | + isComment: number; | ||
| 29 | + isLike: number; | ||
| 30 | + isVisiable: number; | ||
| 31 | + likeNum: number; | ||
| 32 | + liveCommentControl: number; | ||
| 33 | + liveGiftControl: number; | ||
| 34 | + liveLikeControl: number; | ||
| 35 | + liveShareControl: number; | ||
| 36 | + mainControl: number; | ||
| 37 | + posterShareControl: number; | ||
| 38 | + registTime: number; | ||
| 39 | + shareControl: number; | ||
| 40 | + shareNum: number; | ||
| 41 | + status: number; | ||
| 42 | + subjectType: string; | ||
| 43 | + updateTime: number; | ||
| 44 | + userId: string; | ||
| 45 | + userType: number | ||
| 46 | +} |
| @@ -3,6 +3,7 @@ export interface FullColumnImgUrlDTO { | @@ -3,6 +3,7 @@ export interface FullColumnImgUrlDTO { | ||
| 3 | height: number; | 3 | height: number; |
| 4 | landscape: number; | 4 | landscape: number; |
| 5 | size: number | null; | 5 | size: number | null; |
| 6 | - url: string; | 6 | + url: string; // 图片地址--列表显示 |
| 7 | weight: number; | 7 | weight: number; |
| 8 | + fullUrl: string; // 图片地址--预览地址使用;【人民号动态卡预览】 | ||
| 8 | } | 9 | } |
| @@ -177,4 +177,14 @@ export interface postInteractAccentionOperateParams { | @@ -177,4 +177,14 @@ export interface postInteractAccentionOperateParams { | ||
| 177 | // userType: number; | 177 | // userType: number; |
| 178 | // userId: string; | 178 | // userId: string; |
| 179 | status: number; | 179 | status: number; |
| 180 | +} | ||
| 181 | + | ||
| 182 | +export interface postRecommendListParams { | ||
| 183 | + imei: string; | ||
| 184 | + userId ?: string; | ||
| 185 | + contentId ?: string; | ||
| 186 | + relId ?: string; | ||
| 187 | + contentType ?: number; | ||
| 188 | + recType: number; | ||
| 189 | + channelId ? : string | ||
| 180 | } | 190 | } |
| @@ -3,11 +3,11 @@ export interface RmhInfoDTO { | @@ -3,11 +3,11 @@ export interface RmhInfoDTO { | ||
| 3 | authTitle: string; | 3 | authTitle: string; |
| 4 | authTitle2: string; | 4 | authTitle2: string; |
| 5 | banControl: number; | 5 | banControl: number; |
| 6 | - cnAttention: number; | 6 | + cnIsAttention: number; |
| 7 | cnMainControl: number; | 7 | cnMainControl: number; |
| 8 | cnShareControl: number; | 8 | cnShareControl: number; |
| 9 | - cnlsComment: number; | ||
| 10 | - cnlsLike: number; | 9 | + cnIsComment: number; |
| 10 | + cnIsLike: number; | ||
| 11 | posterShareControl: number; | 11 | posterShareControl: number; |
| 12 | rmhDesc: string; | 12 | rmhDesc: string; |
| 13 | rmhHeadUrl: string; | 13 | rmhHeadUrl: string; |
| @@ -4,6 +4,7 @@ export interface VideoInfoDTO { | @@ -4,6 +4,7 @@ export interface VideoInfoDTO { | ||
| 4 | resolutionWidth: number; | 4 | resolutionWidth: number; |
| 5 | videoDuration: number; // 视频时长 | 5 | videoDuration: number; // 视频时长 |
| 6 | videoLandScape: number; // 1横屏 2竖屏 | 6 | videoLandScape: number; // 1横屏 2竖屏 |
| 7 | + videoLandscape: number; // 1横屏 2竖屏 | ||
| 7 | videoType: number; | 8 | videoType: number; |
| 8 | videoUrl: string; //视频播放地址 | 9 | videoUrl: string; //视频播放地址 |
| 9 | firstFrameImageUri: string; // 首帧图;【视频内容,contentPictures中】 | 10 | firstFrameImageUri: string; // 首帧图;【视频内容,contentPictures中】 |
| @@ -10,7 +10,7 @@ export interface ResponseBean{ | @@ -10,7 +10,7 @@ export interface ResponseBean{ | ||
| 10 | message: string; | 10 | message: string; |
| 11 | 11 | ||
| 12 | // 响应结果 | 12 | // 响应结果 |
| 13 | - data:ContentDetailDTO; | 13 | + data:ContentDetailDTO[]; |
| 14 | 14 | ||
| 15 | // 请求响应时间戳(unix格式) | 15 | // 请求响应时间戳(unix格式) |
| 16 | timestamp?: number; | 16 | timestamp?: number; |
| 1 | +export interface LiveDetailsBean { | ||
| 2 | + /** | ||
| 3 | + * { | ||
| 4 | + "code": "0", | ||
| 5 | + "data": [ | ||
| 6 | + { | ||
| 7 | + "activityInfos": [], | ||
| 8 | + "appstyle": 2, | ||
| 9 | + "audioList": [], | ||
| 10 | + "authorList": [ | ||
| 11 | + { | ||
| 12 | + "authorName": "雷崔捷" | ||
| 13 | + } | ||
| 14 | + ], | ||
| 15 | + "bestNoticer": null, | ||
| 16 | + "commentDisplay": 0, | ||
| 17 | + "editorName": "", | ||
| 18 | + "firstFrameImageUri": "", | ||
| 19 | + "fullColumnImgUrls": [ | ||
| 20 | + { | ||
| 21 | + "format": null, | ||
| 22 | + "height": null, | ||
| 23 | + "landscape": null, | ||
| 24 | + "size": null, | ||
| 25 | + "url": "https://rmrbcmsonline.peopleapp.com/upload/image/202404/rmrb_71671711971849.png", | ||
| 26 | + "weight": null | ||
| 27 | + } | ||
| 28 | + ], | ||
| 29 | + "hasPopUp": null, | ||
| 30 | + "isNewspaper": false, | ||
| 31 | + "itemId": "", | ||
| 32 | + "itemTypeCode": "", | ||
| 33 | + "keyArticle": 0, | ||
| 34 | + "likesStyle": null, | ||
| 35 | + "liveInfo": { | ||
| 36 | + "background": { | ||
| 37 | + "imageUrl": "", | ||
| 38 | + "name": "" | ||
| 39 | + }, | ||
| 40 | + "backgroundStyle": null, | ||
| 41 | + "cornerFlag": 0, | ||
| 42 | + "cornerImgUrl": "", | ||
| 43 | + "cornerLinkUrl": "", | ||
| 44 | + "createUserId": "", | ||
| 45 | + "createUserName": "", | ||
| 46 | + "endTime": "2024-04-03 11:08:00", | ||
| 47 | + "handAngleImageUri": "", | ||
| 48 | + "handAngleLink": "", | ||
| 49 | + "handAngleSwitch": false, | ||
| 50 | + "likeEnable": 1, | ||
| 51 | + "likesStyle": "thumb", | ||
| 52 | + "liveExperience": 1, | ||
| 53 | + "liveExperienceTime": 3, | ||
| 54 | + "liveLandScape": "news", | ||
| 55 | + "liveState": "end", | ||
| 56 | + "liveStyle": 0, | ||
| 57 | + "liveWay": 0, | ||
| 58 | + "mlive": { | ||
| 59 | + "barrageShowEnable": false, | ||
| 60 | + "giftEnable": false, | ||
| 61 | + "mliveId": 20000016257, | ||
| 62 | + "roomId": "5381b934-cea8-4338-bd12-5bf70af43e0c" | ||
| 63 | + }, | ||
| 64 | + "notice": "", | ||
| 65 | + "openComment": 1, | ||
| 66 | + "padImageUri": "", | ||
| 67 | + "planStartTime": "2024-04-03 05:00:00", | ||
| 68 | + "playbackSwitch": true, | ||
| 69 | + "preCommentFlag": 1, | ||
| 70 | + "previewType": 1, | ||
| 71 | + "previewUrl": "", | ||
| 72 | + "shareSwitch": "", | ||
| 73 | + "startTime": "2024-04-03 05:03:23", | ||
| 74 | + "tplId": 5, | ||
| 75 | + "vlive": [ | ||
| 76 | + { | ||
| 77 | + "coverImageUrl": "", | ||
| 78 | + "definition": [], | ||
| 79 | + "liveStreamManagerId": null, | ||
| 80 | + "liveStreamType": 1, | ||
| 81 | + "liveUrl": "https://plwbthird.live.weibo.com/alicdn/5018938748437049.m3u8", | ||
| 82 | + "name": "线路1", | ||
| 83 | + "replayUri": "http://mlive3.video.weibocdn.com/record/alicdn/5018726527666338/index.m3u8", | ||
| 84 | + "serialNum": null, | ||
| 85 | + "shiftEnable": false, | ||
| 86 | + "showPad": false, | ||
| 87 | + "type": "play", | ||
| 88 | + "vliveId": 186728 | ||
| 89 | + } | ||
| 90 | + ], | ||
| 91 | + "vrType": 0 | ||
| 92 | + }, | ||
| 93 | + "menuShow": 1, | ||
| 94 | + "newIntroduction": "眼前有山河,心中有家国!每年清明节前夕,宁夏固原市第二中学和固原市弘文中学会组织入学新生,一天之内徒步54公里从学校往返任山河烈士陵园,用这种方式缅怀烈士们,这份坚定与执着已经延续了29年。", | ||
| 95 | + "newLinkObject": null, | ||
| 96 | + "newsBodyTitle": "", | ||
| 97 | + "newsContent": "", | ||
| 98 | + "newsContentBak": "", | ||
| 99 | + "newsDownTitle": "", | ||
| 100 | + "newsId": 20000016229, | ||
| 101 | + "newsLinkUrl": "", | ||
| 102 | + "newsShortTitle": "", | ||
| 103 | + "newsSource": "41", | ||
| 104 | + "newsSourceName": "", | ||
| 105 | + "newsSummary": "", | ||
| 106 | + "newsTags": "", | ||
| 107 | + "newsTitle": "徒步54公里的思政课,坚守29年的薪火传承", | ||
| 108 | + "newsType": 2, | ||
| 109 | + "oldNewsId": "7218507", | ||
| 110 | + "openAudio": 0, | ||
| 111 | + "openComment": null, | ||
| 112 | + "openLikes": null, | ||
| 113 | + "photoList": [], | ||
| 114 | + "popUps": [], | ||
| 115 | + "preCommentFlag": null, | ||
| 116 | + "publishTime": "2024-04-01 19:44:00", | ||
| 117 | + "reLInfo": { | ||
| 118 | + "channelId": 2061, | ||
| 119 | + "relId": "500005272745", | ||
| 120 | + "relObjectId": 2061, | ||
| 121 | + "relType": "1" | ||
| 122 | + }, | ||
| 123 | + "readFlag": 0, | ||
| 124 | + "recommendShow": null, | ||
| 125 | + "rmhInfo": null, | ||
| 126 | + "rmhPlatform": 0, | ||
| 127 | + "sceneId": "", | ||
| 128 | + "serials": null, | ||
| 129 | + "shareInfo": { | ||
| 130 | + "shareCoverUrl": "https://rmrbcmsonline.peopleapp.com/upload/image/202404/202404011944259539.png?x-oss-process=image/resize,w_400", | ||
| 131 | + "shareOpen": 1, | ||
| 132 | + "sharePosterCoverUrl": "https://rmrbcmsonline.peopleapp.com/upload/image/202404/rmrb_71671711971849.png?x-oss-process=image/resize,m_fill,h_450,w_800,limit_0/quality,q_90", | ||
| 133 | + "sharePosterOpen": 1, | ||
| 134 | + "shareSummary": "人民日报,有品质的新闻", | ||
| 135 | + "shareTitle": "徒步54公里的思政课,坚守29年的薪火传承", | ||
| 136 | + "shareUrl": "https://people.pdnews.cn/column/20000016229-500005272745" | ||
| 137 | + }, | ||
| 138 | + "specialColumnId": null, | ||
| 139 | + "specialColumnName": "", | ||
| 140 | + "subSceneId": "", | ||
| 141 | + "timeline": null, | ||
| 142 | + "topicInfo": null, | ||
| 143 | + "traceId": "", | ||
| 144 | + "traceInfo": "", | ||
| 145 | + "userInfo": null, | ||
| 146 | + "videoInfo": [], | ||
| 147 | + "viewCount": 0, | ||
| 148 | + "visitorComment": 1, | ||
| 149 | + "voteInfo": null | ||
| 150 | + } | ||
| 151 | + ], | ||
| 152 | + "message": "Success", | ||
| 153 | + "meta": null, | ||
| 154 | + "requestId": "", | ||
| 155 | + "success": true, | ||
| 156 | + "timestamp": 1712807514322 | ||
| 157 | + } | ||
| 158 | + */ | ||
| 159 | + liveInfo: LiveInfo | ||
| 160 | + fullColumnImgUrls: Array<FullColumnImgUrls> | ||
| 161 | + vlive: Array<Vlive> | ||
| 162 | + newsTitle: string | ||
| 163 | + newIntroduction: string | ||
| 164 | +} | ||
| 165 | + | ||
| 166 | +export interface LiveInfo { | ||
| 167 | + //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | ||
| 168 | + liveState: string | ||
| 169 | + //2024-04-12 15:00:00 直播开始时间 | ||
| 170 | + planStartTime: string | ||
| 171 | +} | ||
| 172 | + | ||
| 173 | +export interface FullColumnImgUrls { | ||
| 174 | + url: string | ||
| 175 | +} | ||
| 176 | + | ||
| 177 | +export interface Vlive { | ||
| 178 | + //拉流直播 url | ||
| 179 | + liveUrl: string | ||
| 180 | + //直播回看地址,多路直播录制文件URL | ||
| 181 | + replayUri: string | ||
| 182 | +} |
| 1 | +export interface LiveRoomBean { | ||
| 2 | + pageNum: number | ||
| 3 | + pageSize: number | ||
| 4 | + totalCount: number | ||
| 5 | + barrageResponses: Array<LiveRoomItemBean> | ||
| 6 | +} | ||
| 7 | + | ||
| 8 | +export interface LiveRoomItemBean { | ||
| 9 | + text: string | ||
| 10 | + senderUserAvatarUrl: string | ||
| 11 | + senderUserName: string | ||
| 12 | + pictureUrls: string[] | ||
| 13 | + time: string | ||
| 14 | + //1上墙0未上墙 | ||
| 15 | + isWall: number | ||
| 16 | + //是否置顶 1置顶0不置顶 | ||
| 17 | + isTop: number | ||
| 18 | + role: string | ||
| 19 | +} |
| 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 | +} |
| @@ -34,7 +34,8 @@ export { ENewspaperItemComponent } from "./src/main/ets/components/ENewspaperIte | @@ -34,7 +34,8 @@ export { ENewspaperItemComponent } from "./src/main/ets/components/ENewspaperIte | ||
| 34 | 34 | ||
| 35 | export { ENewspaperListDialog } from "./src/main/ets/dialog/ENewspaperListDialog" | 35 | export { ENewspaperListDialog } from "./src/main/ets/dialog/ENewspaperListDialog" |
| 36 | 36 | ||
| 37 | -export { MorningEveningPaperComponent } from "./src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent" | 37 | +export { MorningEveningPaperComponent |
| 38 | +} from "./src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent" | ||
| 38 | 39 | ||
| 39 | export { ImageAndTextPageComponent } from "./src/main/ets/components/ImageAndTextPageComponent" | 40 | export { ImageAndTextPageComponent } from "./src/main/ets/components/ImageAndTextPageComponent" |
| 40 | 41 | ||
| @@ -58,3 +59,8 @@ export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailCompo | @@ -58,3 +59,8 @@ export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailCompo | ||
| 58 | 59 | ||
| 59 | export { BroadcastPageComponent } from "./src/main/ets/components/broadcast/BroadcastPageComponent" | 60 | export { BroadcastPageComponent } from "./src/main/ets/components/broadcast/BroadcastPageComponent" |
| 60 | 61 | ||
| 62 | +export { FirstTabTopSearchComponent } from "./src/main/ets/components/search/FirstTabTopSearchComponent" | ||
| 63 | + | ||
| 64 | +export { ListHasNoMoreDataUI } from "./src/main/ets/components/reusable/ListHasNoMoreDataUI" | ||
| 65 | + | ||
| 66 | +export { LottieView } from './src/main/ets/lottie/LottieView' |
| @@ -7,13 +7,16 @@ | @@ -7,13 +7,16 @@ | ||
| 7 | "main": "Index.ets", | 7 | "main": "Index.ets", |
| 8 | "version": "1.0.0", | 8 | "version": "1.0.0", |
| 9 | "dependencies": { | 9 | "dependencies": { |
| 10 | + "@ohos/lottie": "2.0.0", | ||
| 10 | "wdConstant": "file:../../commons/wdConstant", | 11 | "wdConstant": "file:../../commons/wdConstant", |
| 11 | "wdPlayer": "file:../../features/wdPlayer", | 12 | "wdPlayer": "file:../../features/wdPlayer", |
| 12 | "wdLogin": "file:../../features/wdLogin", | 13 | "wdLogin": "file:../../features/wdLogin", |
| 13 | "wdKit": "file:../../commons/wdKit", | 14 | "wdKit": "file:../../commons/wdKit", |
| 14 | "wdWebComponent": "file:../../commons/wdWebComponent", | 15 | "wdWebComponent": "file:../../commons/wdWebComponent", |
| 15 | "wdBean": "file:../../features/wdBean", | 16 | "wdBean": "file:../../features/wdBean", |
| 17 | + "wdDetailPlayShortVideo": "file:../../features/wdDetailPlayShortVideo", | ||
| 16 | "wdRouter": "file:../../commons/wdRouter", | 18 | "wdRouter": "file:../../commons/wdRouter", |
| 17 | - "wdNetwork": "file:../../commons/wdNetwork" | 19 | + "wdNetwork": "file:../../commons/wdNetwork", |
| 20 | + "wdJsBridge": "file:../../commons/wdJsBridge" | ||
| 18 | } | 21 | } |
| 19 | } | 22 | } |
| 1 | -import { CommonConstants } from 'wdConstant'; | ||
| 2 | -import { Card3Component } from './cardview/Card3Component'; | 1 | +import { CommonConstants, CompStyle } from 'wdConstant'; |
| 2 | +import { ContentDTO } from 'wdBean'; | ||
| 3 | import { Card2Component } from './cardview/Card2Component'; | 3 | import { Card2Component } from './cardview/Card2Component'; |
| 4 | +import { Card3Component } from './cardview/Card3Component'; | ||
| 4 | import { Card4Component } from './cardview/Card4Component'; | 5 | import { Card4Component } from './cardview/Card4Component'; |
| 5 | -import { ContentDTO } from 'wdBean'; | ||
| 6 | import { Card5Component } from './cardview/Card5Component'; | 6 | import { Card5Component } from './cardview/Card5Component'; |
| 7 | import { Card6Component } from './cardview/Card6Component'; | 7 | import { Card6Component } from './cardview/Card6Component'; |
| 8 | +import { Card9Component } from './cardview/Card9Component'; | ||
| 9 | +import { Card10Component } from './cardview/Card10Component'; | ||
| 10 | +import { Card11Component } from './cardview/Card11Component'; | ||
| 11 | +import { Card17Component } from './cardview/Card17Component'; | ||
| 12 | +import { Card15Component } from './cardview/Card15Component'; | ||
| 13 | +import { Card19Component } from './cardview/Card19Component'; | ||
| 14 | +import { Card20Component } from './cardview/Card20Component'; | ||
| 8 | 15 | ||
| 9 | /** | 16 | /** |
| 10 | * card适配器,卡片样式汇总,依据ContentDTO#appStyle | 17 | * card适配器,卡片样式汇总,依据ContentDTO#appStyle |
| @@ -20,16 +27,31 @@ export struct CardParser { | @@ -20,16 +27,31 @@ export struct CardParser { | ||
| 20 | 27 | ||
| 21 | @Builder | 28 | @Builder |
| 22 | contentBuilder(contentDTO: ContentDTO) { | 29 | contentBuilder(contentDTO: ContentDTO) { |
| 23 | - if (contentDTO.appStyle === '2') { | 30 | + if (contentDTO.appStyle === CompStyle.Card_02) { |
| 24 | Card2Component({ contentDTO }) | 31 | Card2Component({ contentDTO }) |
| 25 | - } else if (contentDTO.appStyle === '3') { | 32 | + } else if (contentDTO.appStyle === CompStyle.Card_03) { |
| 26 | Card3Component({ contentDTO }) | 33 | Card3Component({ contentDTO }) |
| 27 | - } else if (contentDTO.appStyle === "4") { | 34 | + } else if (contentDTO.appStyle === CompStyle.Card_04) { |
| 28 | Card4Component({ contentDTO }) | 35 | Card4Component({ contentDTO }) |
| 29 | - } else if (contentDTO.appStyle === "5") { | 36 | + } else if (contentDTO.appStyle === CompStyle.Card_05) { |
| 30 | Card5Component({ contentDTO }) | 37 | Card5Component({ contentDTO }) |
| 31 | - } else if (contentDTO.appStyle === "6") { | 38 | + } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle |
| 39 | + .Card_13) { | ||
| 32 | Card6Component({ contentDTO }) | 40 | Card6Component({ contentDTO }) |
| 41 | + } else if (contentDTO.appStyle === CompStyle.Card_09) { | ||
| 42 | + Card9Component({ contentDTO }) | ||
| 43 | + } else if (contentDTO.appStyle === CompStyle.Card_10) { | ||
| 44 | + Card10Component({ contentDTO }) | ||
| 45 | + } else if (contentDTO.appStyle === CompStyle.Card_11) { | ||
| 46 | + Card11Component({ contentDTO }) | ||
| 47 | + } else if (contentDTO.appStyle === CompStyle.Card_15) { | ||
| 48 | + Card15Component({ contentDTO }) | ||
| 49 | + } else if (contentDTO.appStyle === CompStyle.Card_17) { | ||
| 50 | + Card17Component({ contentDTO }) | ||
| 51 | + } else if (contentDTO.appStyle === CompStyle.Card_19) { | ||
| 52 | + Card19Component({ contentDTO }) | ||
| 53 | + } else if (contentDTO.appStyle === CompStyle.Card_20) { | ||
| 54 | + Card20Component({ contentDTO }) | ||
| 33 | } | 55 | } |
| 34 | else { | 56 | else { |
| 35 | // todo:组件未实现 / Component Not Implemented | 57 | // todo:组件未实现 / Component Not Implemented |
| 1 | -import { CompDTO, ContentDTO , slideShows} from 'wdBean'; | 1 | +import { CompDTO } from 'wdBean'; |
| 2 | import { CommonConstants, CompStyle } from 'wdConstant'; | 2 | import { CommonConstants, CompStyle } from 'wdConstant'; |
| 3 | import { BannerComponent } from './view/BannerComponent'; | 3 | import { BannerComponent } from './view/BannerComponent'; |
| 4 | import { LabelComponent } from './view/LabelComponent'; | 4 | import { LabelComponent } from './view/LabelComponent'; |
| 5 | -import { TitleAbbrComponent } from './view/TitleAbbrComponent'; | ||
| 6 | -import { TitleAllComponent } from './view/TitleAllComponent'; | ||
| 7 | -import { SingleImageCardComponent } from './view/SingleImageCardComponent'; | ||
| 8 | -import { BigPicCardComponent } from './view/BigPicCardComponent'; | ||
| 9 | -import { TriPicCardComponent } from './view/TriPicCardComponent'; | ||
| 10 | import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'; | 5 | import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'; |
| 11 | -import { HeadPictureCardComponent } from './view/HeadPictureCardComponent'; | ||
| 12 | -import { ZhGridLayoutComponent } from './view/ZhGridLayoutComponent'; | ||
| 13 | import { | 6 | import { |
| 14 | HorizontalStrokeCardThreeTwoRadioForMoreComponent | 7 | HorizontalStrokeCardThreeTwoRadioForMoreComponent |
| 15 | } from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent'; | 8 | } from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent'; |
| 16 | import { | 9 | import { |
| 17 | HorizontalStrokeCardThreeTwoRadioForOneComponent | 10 | HorizontalStrokeCardThreeTwoRadioForOneComponent |
| 18 | } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent'; | 11 | } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent'; |
| 19 | -import { AlbumCardComponent } from './view/AlbumCardComponent'; | ||
| 20 | -import { ZhSingleRow04 } from './view/ZhSingleRow04' | ||
| 21 | -import { CompStyle_09 } from './view/CompStyle_09' | ||
| 22 | -import { CompStyle_10 } from './view/CompStyle_10' | 12 | +import { ZhSingleRow04 } from './compview/ZhSingleRow04'; |
| 13 | +import { ZhSingleColumn04 } from './compview/ZhSingleColumn04'; | ||
| 14 | +import { ZhSingleColumn05 } from './compview/ZhSingleColumn05'; | ||
| 15 | +import { ZhGridLayout03 } from './compview/ZhGridLayout03'; | ||
| 16 | +import { CardParser } from './CardParser'; | ||
| 17 | +import { LiveHorizontalReservationComponent } from './view/LiveHorizontalReservationComponent'; | ||
| 18 | +import { ZhGridLayout02 } from './compview/ZhGridLayout02'; | ||
| 19 | +import { Card5Component } from './cardview/Card5Component' | ||
| 23 | 20 | ||
| 24 | /** | 21 | /** |
| 25 | * comp适配器. | 22 | * comp适配器. |
| @@ -28,67 +25,7 @@ import { CompStyle_10 } from './view/CompStyle_10' | @@ -28,67 +25,7 @@ import { CompStyle_10 } from './view/CompStyle_10' | ||
| 28 | @Preview | 25 | @Preview |
| 29 | @Component | 26 | @Component |
| 30 | export struct CompParser { | 27 | export struct CompParser { |
| 31 | - @State compDTO: CompDTO = { | ||
| 32 | - compStyle: '17', | ||
| 33 | - imageScale: 3, | ||
| 34 | - operDataList: [ | ||
| 35 | - { | ||
| 36 | - title: 'title0', | ||
| 37 | - description: "description0", | ||
| 38 | - coverUrl: 'https://uatjdcdnphoto.aikan.pdnews' + | ||
| 39 | - '.cn/sjbj-20231208/image/display/d4496925a1264a749975ae9b01a4ef46.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg', | ||
| 40 | - fullColumnImgUrls: [{ | ||
| 41 | - url: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20240104/image/display/c4a9b526e0994d1bbd3ac8450f5cfc6c.jpg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg", | ||
| 42 | - },{ | ||
| 43 | - url:'https://uatjdcdnphoto.aikan.pdnews' + | ||
| 44 | - '.cn/sjbj-20231208/image/display/d4496925a1264a749975ae9b01a4ef46.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg', | ||
| 45 | - },{ | ||
| 46 | - url: 'https://uatjdcdnphoto.aikan.pdnews' + | ||
| 47 | - '.cn/sjbj-20231208/image/display/d4496925a1264a749975ae9b01a4ef46.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg', | ||
| 48 | - }] | ||
| 49 | - } as ContentDTO, | ||
| 50 | - { | ||
| 51 | - title: 'title1 title1 title1 title1 title1 title1 title1 title1 title1', | ||
| 52 | - description: "description1", | ||
| 53 | - coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20240104/image/display/c4a9b526e0994d1bbd3ac8450f5cfc6c.jpg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg", | ||
| 54 | - } as ContentDTO, | ||
| 55 | - { | ||
| 56 | - title: 'title2', | ||
| 57 | - description: "description2", | ||
| 58 | - coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231206/image/live/bbe6d821e92b48919d90c7dadfd1f05a.jpg?x-oss-process=image/resize,l_850/auto-orient,1/quality,q_95/format,jpg", | ||
| 59 | - } as ContentDTO, | ||
| 60 | - { | ||
| 61 | - title: 'title3', | ||
| 62 | - description: "description3", | ||
| 63 | - coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231109/image/live/102e6eb9356b4ef19405b04c1f6ff875.png?x-oss-process=image/resize,l_850/auto-orient,1/quality,q_95/format,jpg' | ||
| 64 | - } as ContentDTO, | ||
| 65 | - { | ||
| 66 | - title: 'title4', | ||
| 67 | - description: "description4", | ||
| 68 | - coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231218/image/display/62bdbbb35dbd45689e00790c81f04c4b.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg", | ||
| 69 | - } as ContentDTO, | ||
| 70 | - { | ||
| 71 | - title: 'title5', | ||
| 72 | - description: "description5", | ||
| 73 | - coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231218/image/display/f79bbaa5a33b4bd88176071c4f797ff6.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg", | ||
| 74 | - } as ContentDTO, | ||
| 75 | - { | ||
| 76 | - title: 'title6', | ||
| 77 | - description: "description6", | ||
| 78 | - coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231218/image/display/2c1d917009584ce2bb4a35cbb3a860a0.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg", | ||
| 79 | - } as ContentDTO, | ||
| 80 | - { | ||
| 81 | - title: 'title7', | ||
| 82 | - description: "description7", | ||
| 83 | - coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231222/image/display/117dc516ca5c42d5843c0d32050c9fc6.jpeg?x-oss-process=image/resize,w_240/quality,q_90/format,jpg", | ||
| 84 | - } as ContentDTO, | ||
| 85 | - { | ||
| 86 | - title: 'title8', | ||
| 87 | - description: "description8", | ||
| 88 | - coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231228/image/display/90a2db4077d44a1f887f068fc659d977.jpeg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg", | ||
| 89 | - } as ContentDTO | ||
| 90 | - ] | ||
| 91 | - } as CompDTO | 28 | + @State compDTO: CompDTO = {} as CompDTO |
| 92 | compIndex: number = 0; | 29 | compIndex: number = 0; |
| 93 | 30 | ||
| 94 | build() { | 31 | build() { |
| @@ -99,19 +36,8 @@ export struct CompParser { | @@ -99,19 +36,8 @@ export struct CompParser { | ||
| 99 | componentBuilder(compDTO: CompDTO, compIndex: number) { | 36 | componentBuilder(compDTO: CompDTO, compIndex: number) { |
| 100 | if (compDTO.compStyle === CompStyle.Label_03) { | 37 | if (compDTO.compStyle === CompStyle.Label_03) { |
| 101 | LabelComponent({ compDTO: compDTO }) | 38 | LabelComponent({ compDTO: compDTO }) |
| 102 | - } else if (compDTO.compStyle === CompStyle.Title_Abbr_01) { | ||
| 103 | - TitleAbbrComponent({ compDTO: compDTO }) | ||
| 104 | - } else if (compDTO.compStyle === CompStyle.Title_All_01) { | ||
| 105 | - TitleAllComponent({ compDTO: compDTO }) | ||
| 106 | - } else if (compDTO.compStyle === CompStyle.Carousel_Layout_01) { | 39 | + } else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { |
| 107 | BannerComponent({ compDTO: compDTO }) | 40 | BannerComponent({ compDTO: compDTO }) |
| 108 | - } else if (compDTO.compStyle === CompStyle.Single_ImageCard_03 | ||
| 109 | - || compDTO.compStyle === CompStyle.Single_ImageCard_01) { | ||
| 110 | - SingleImageCardComponent({ compDTO: compDTO }) | ||
| 111 | - } else if (compDTO.compStyle === "2") { | ||
| 112 | - BigPicCardComponent({ compDTO: compDTO }) | ||
| 113 | - } else if (compDTO.compStyle === "4") { | ||
| 114 | - TriPicCardComponent({ compDTO: compDTO }) | ||
| 115 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 2) { | 41 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 2) { |
| 116 | LiveHorizontalCardComponent({ compDTO: compDTO }) | 42 | LiveHorizontalCardComponent({ compDTO: compDTO }) |
| 117 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 3) { | 43 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 3) { |
| @@ -120,19 +46,23 @@ export struct CompParser { | @@ -120,19 +46,23 @@ export struct CompParser { | ||
| 120 | } else { | 46 | } else { |
| 121 | HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO }) | 47 | HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO }) |
| 122 | } | 48 | } |
| 123 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02 | ||
| 124 | - || compDTO.compStyle === '5') { | ||
| 125 | - HeadPictureCardComponent({ compDTO: compDTO }) | ||
| 126 | - } else if (compDTO.compStyle === CompStyle.ZhGrid_Layout_03) { | ||
| 127 | - ZhGridLayoutComponent({ compDTO: compDTO }) | ||
| 128 | - } else if (compDTO.compStyle === CompStyle.Album_Card_01) { | ||
| 129 | - AlbumCardComponent({ compDTO: compDTO }) | 49 | + } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) { |
| 50 | + LiveHorizontalReservationComponent({ compDTO: compDTO }) | ||
| 51 | + } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { | ||
| 52 | + ZhGridLayout02({ compDTO: compDTO }) | ||
| 53 | + } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { | ||
| 54 | + ZhGridLayout03({ compDTO: compDTO }) | ||
| 130 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) { | 55 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) { |
| 131 | - ZhSingleRow04({ compDTO: compDTO}) | ||
| 132 | - } else if (compDTO.compStyle === CompStyle.CompStyle_09) { | ||
| 133 | - CompStyle_09({ compDTO: compDTO}) | ||
| 134 | - } else if (compDTO.compStyle === CompStyle.CompStyle_10) { | ||
| 135 | - CompStyle_10({ compDTO: compDTO}) | 56 | + ZhSingleRow04({ compDTO: compDTO }) |
| 57 | + } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) { | ||
| 58 | + //头图卡 和comStyle 2相同, | ||
| 59 | + Card5Component({ contentDTO: compDTO.operDataList[0] }) | ||
| 60 | + } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) { | ||
| 61 | + ZhSingleColumn04({ compDTO: compDTO }) | ||
| 62 | + } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) { | ||
| 63 | + ZhSingleColumn05({ compDTO: compDTO }) | ||
| 64 | + } else if (!Number.isNaN(Number(compDTO.compStyle))) { | ||
| 65 | + CardParser({ contentDTO: compDTO.operDataList[0] }); | ||
| 136 | } | 66 | } |
| 137 | else { | 67 | else { |
| 138 | // todo:组件未实现 / Component Not Implemented | 68 | // todo:组件未实现 / Component Not Implemented |
| 1 | -import { Action, ContentDetailDTO } from 'wdBean'; | 1 | +import { Logger, NumberFormatterUtils } from 'wdKit'; |
| 2 | +import { | ||
| 3 | + Action, | ||
| 4 | + ContentDetailDTO, | ||
| 5 | + ContentDTO, | ||
| 6 | + postRecommendListParams, | ||
| 7 | + postExecuteLikeParams, | ||
| 8 | + batchLikeAndCollectResult, | ||
| 9 | + batchLikeAndCollectParams, | ||
| 10 | + InteractDataDTO, | ||
| 11 | + contentListParams, | ||
| 12 | +} from 'wdBean'; | ||
| 2 | import DetailViewModel from '../viewmodel/DetailViewModel'; | 13 | import DetailViewModel from '../viewmodel/DetailViewModel'; |
| 3 | import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; | 14 | import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; |
| 4 | import router from '@ohos.router'; | 15 | import router from '@ohos.router'; |
| 16 | +import { RecommendList } from '../components/view/RecommendList' | ||
| 17 | +import { CommonConstants } from 'wdConstant' | ||
| 18 | +import { HttpUrlUtils } from 'wdNetwork/Index'; | ||
| 19 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 20 | +import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | ||
| 21 | +import { PageRepository } from '../repository/PageRepository'; | ||
| 22 | + | ||
| 23 | +const TAG = 'ImageAndTextPageComponent' | ||
| 24 | + | ||
| 25 | +export interface OperationItem { | ||
| 26 | + icon: Resource; | ||
| 27 | + icon_check?: Resource; | ||
| 28 | + text: string | Resource; | ||
| 29 | + num?: number; // 个数 | ||
| 30 | +} | ||
| 5 | 31 | ||
| 6 | @Component | 32 | @Component |
| 7 | export struct ImageAndTextPageComponent { | 33 | export struct ImageAndTextPageComponent { |
| 8 | scroller: Scroller = new Scroller(); | 34 | scroller: Scroller = new Scroller(); |
| 9 | action: Action = {} as Action | 35 | action: Action = {} as Action |
| 10 | - @State detailData: ContentDetailDTO = {} as ContentDetailDTO | 36 | + @State contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO [] |
| 37 | + @State recommendList: ContentDTO[] = [] | ||
| 38 | + @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | ||
| 39 | + @State interactData: InteractDataDTO = {} as InteractDataDTO | ||
| 11 | 40 | ||
| 12 | build() { | 41 | build() { |
| 13 | - RelativeContainer() { | ||
| 14 | - RelativeContainer() { | ||
| 15 | - Text(this.detailData?.publishTime) | ||
| 16 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 17 | - .fontSize($r('app.float.font_size_13')) | ||
| 18 | - .id('date') | ||
| 19 | - .alignRules({ right: { anchor: "__container__", align: HorizontalAlign.End }, | ||
| 20 | - center:{anchor: "__container__", align:VerticalAlign.Center}}) | ||
| 21 | - | 42 | + Column() { |
| 43 | + // 发布时间 | ||
| 44 | + Row() { | ||
| 22 | Image($r('app.media.icon_ren_min_ri_bao')) | 45 | Image($r('app.media.icon_ren_min_ri_bao')) |
| 23 | .width(70) | 46 | .width(70) |
| 24 | .height(28) | 47 | .height(28) |
| 25 | - .alignRules({ left: { anchor: "__container__", align: HorizontalAlign.Start }, | ||
| 26 | - center: { anchor: "__container__", align: VerticalAlign.Center } }) | 48 | + Text(this.contentDetailData[0]?.publishTime) |
| 49 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 50 | + .fontSize($r('app.float.font_size_13')) | ||
| 51 | + .height('100%') | ||
| 52 | + .align(Alignment.End) | ||
| 27 | } | 53 | } |
| 54 | + .width(CommonConstants.FULL_WIDTH) | ||
| 28 | .height(32) | 55 | .height(32) |
| 29 | - .width('100%') | ||
| 30 | - .id('image_text_detail_top') | ||
| 31 | - .alignRules({ top: { anchor: "__container__", align: VerticalAlign.Top } }) | ||
| 32 | - .visibility(Visibility.None) | ||
| 33 | - | ||
| 34 | - Image($r('app.media.line')) | ||
| 35 | - .width('100%') | ||
| 36 | - .height(6) | ||
| 37 | - .objectFit(ImageFit.Contain) | ||
| 38 | - .id('image_text_detail_top_line') | ||
| 39 | - .alignRules({ top: { anchor: "image_text_detail_top", align: VerticalAlign.Bottom } }) | ||
| 40 | - .margin({ top: 10 }) | ||
| 41 | - .visibility(Visibility.Hidden) | ||
| 42 | - | ||
| 43 | - RelativeContainer() { | ||
| 44 | - Image($r('app.media.icon_arrow_left')) | ||
| 45 | - .width(24) | ||
| 46 | - .height(24) | ||
| 47 | - .id('back') | ||
| 48 | - .alignRules({ left: { anchor: "__container__", align: HorizontalAlign.Start }, | ||
| 49 | - center: { anchor: "__container__", align: VerticalAlign.Center } }) | ||
| 50 | - .onClick((event: ClickEvent) => { | ||
| 51 | - router.back() | ||
| 52 | - }) | ||
| 53 | - | ||
| 54 | - Image($r('app.media.icon_forward')) | ||
| 55 | - .width(24) | ||
| 56 | - .height(24) | ||
| 57 | - .id('forward') | ||
| 58 | - .alignRules({ right: { anchor: "__container__", align: HorizontalAlign.End }, | ||
| 59 | - center: { anchor: "back", align: VerticalAlign.Center } }) | ||
| 60 | - | ||
| 61 | - Image($r('app.media.icon_listen')) | ||
| 62 | - .width(24) | ||
| 63 | - .height(24) | ||
| 64 | - .margin({ right: 24 }) | ||
| 65 | - .id('listen') | ||
| 66 | - .alignRules({ right: { anchor: "forward", align: HorizontalAlign.Start }, | ||
| 67 | - center: { anchor: "back", align: VerticalAlign.Center } }) | ||
| 68 | - | ||
| 69 | - Image($r('app.media.icon_star')) | ||
| 70 | - .width(24) | ||
| 71 | - .height(24) | ||
| 72 | - .margin({ right: 24 }) | ||
| 73 | - .id('star') | ||
| 74 | - .alignRules({ right: { anchor: "listen", align: HorizontalAlign.Start }, | ||
| 75 | - center: { anchor: "back", align: VerticalAlign.Center } }) | ||
| 76 | - | ||
| 77 | - Image($r('app.media.icon_comment')) | ||
| 78 | - .width(24) | ||
| 79 | - .height(24) | ||
| 80 | - .margin({ right: 24 }) | ||
| 81 | - .id('comment') | ||
| 82 | - .alignRules({ right: { anchor: "star", align: HorizontalAlign.Start }, | ||
| 83 | - center: { anchor: "back", align: VerticalAlign.Center } }) | 56 | + .padding({ left: 15, right: 15, }) |
| 57 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 58 | + .backgroundColor(Color.White) | ||
| 84 | 59 | ||
| 60 | + Row() { | ||
| 61 | + Image($r('app.media.line')) | ||
| 62 | + .width('100%') | ||
| 63 | + .height(6) | ||
| 64 | + .objectFit(ImageFit.Cover) | ||
| 65 | + .margin({ top: 10 }) | ||
| 85 | } | 66 | } |
| 86 | - .width('100%') | ||
| 87 | - .height(56) | ||
| 88 | - .id('image_text_detail_bottom') | ||
| 89 | - .alignRules({ bottom: { anchor: "__container__", align: VerticalAlign.Bottom } }) | 67 | + .padding({ left: 15, right: 15, }) |
| 68 | + .backgroundColor(Color.White) | ||
| 90 | 69 | ||
| 91 | - Column() { | ||
| 92 | - ImageAndTextWebComponent({ detailData: this.detailData, action: this.action }) | ||
| 93 | - } | ||
| 94 | - .width('100%') | ||
| 95 | - .alignRules({ top: { anchor: "image_text_detail_top_line", align: VerticalAlign.Bottom }, | ||
| 96 | - bottom: { anchor: "image_text_detail_bottom", align: VerticalAlign.Top } }) | ||
| 97 | - .id('image_text_detail_content') | 70 | + Stack({ alignContent: Alignment.Bottom }) { |
| 71 | + List() { | ||
| 72 | + //详情展示区 | ||
| 73 | + ListItem() { | ||
| 74 | + Column() { | ||
| 75 | + ImageAndTextWebComponent({ | ||
| 76 | + contentDetailData: this.contentDetailData, | ||
| 77 | + action: this.action, | ||
| 78 | + }) | ||
| 79 | + }.width(CommonConstants.FULL_WIDTH) | ||
| 80 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 81 | + } | ||
| 98 | 82 | ||
| 99 | - } | ||
| 100 | - .width('100%') | ||
| 101 | - .height('100%') | ||
| 102 | - .padding({ left: 16, right: 16 }) | 83 | + if (this.contentDetailData[0]?.openLikes === 1) { |
| 84 | + ListItem() { | ||
| 85 | + // 点赞 | ||
| 86 | + Row() { | ||
| 87 | + Row() { | ||
| 88 | + if (this.newsStatusOfUser?.likeStatus === '1') { | ||
| 89 | + Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : $r('app.media.icon_candle_active'))) | ||
| 90 | + .width(24) | ||
| 91 | + .height(24) | ||
| 92 | + .margin({ right: 5 }) | ||
| 93 | + } else { | ||
| 94 | + Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : $r('app.media.icon_candle'))) | ||
| 95 | + .width(24) | ||
| 96 | + .height(24) | ||
| 97 | + .margin({ right: 5 }) | ||
| 98 | + } | ||
| 99 | + Text(`${this.interactData?.likeNum || 0}`) | ||
| 100 | + .fontSize(16) | ||
| 101 | + .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999') | ||
| 102 | + .fontWeight(500) | ||
| 103 | + }.alignItems(VerticalAlign.Center) | ||
| 104 | + .onClick(() => { | ||
| 105 | + this.toggleLikeStatus() | ||
| 106 | + }) | ||
| 107 | + | ||
| 108 | + }.width(CommonConstants.FULL_WIDTH).height(80) | ||
| 109 | + .justifyContent(FlexAlign.Center) | ||
| 110 | + } | ||
| 111 | + .border({ | ||
| 112 | + width: { bottom: 5 }, | ||
| 113 | + color: '#f5f5f5', | ||
| 114 | + }) | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + // 相关推荐区 | ||
| 118 | + ListItem() { | ||
| 119 | + RecommendList({ recommendList: this.recommendList }) | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + .width(CommonConstants.FULL_WIDTH) | ||
| 123 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 124 | + .padding({ bottom: 56 }) | ||
| 125 | + .scrollBar(BarState.Off) | ||
| 126 | + .edgeEffect(EdgeEffect.None) | ||
| 127 | + | ||
| 128 | + //底部交互区 | ||
| 129 | + Row() { | ||
| 130 | + Image($r('app.media.icon_arrow_left')) | ||
| 131 | + .width(24) | ||
| 132 | + .height(24) | ||
| 133 | + .onClick((event: ClickEvent) => { | ||
| 134 | + router.back() | ||
| 135 | + }) | ||
| 136 | + | ||
| 137 | + Row() { | ||
| 138 | + Image($r('app.media.icon_comment')) | ||
| 139 | + .width(24) | ||
| 140 | + .height(24) | ||
| 141 | + .margin({ right: 24 }) | ||
| 142 | + .id('comment') | ||
| 143 | + | ||
| 144 | + Image($r('app.media.icon_star')) | ||
| 145 | + .width(24) | ||
| 146 | + .height(24) | ||
| 147 | + .margin({ right: 24 }) | ||
| 148 | + | ||
| 149 | + Image($r('app.media.icon_listen')) | ||
| 150 | + .width(24) | ||
| 151 | + .height(24) | ||
| 152 | + .margin({ right: 24 }) | ||
| 153 | + | ||
| 154 | + Image($r('app.media.icon_forward')) | ||
| 155 | + .width(24) | ||
| 156 | + .height(24) | ||
| 157 | + | ||
| 158 | + } | ||
| 159 | + } | ||
| 160 | + .width(CommonConstants.FULL_WIDTH) | ||
| 161 | + .height(56) | ||
| 162 | + .padding({ left: 15, right: 15, bottom: 50, top: 20 }) | ||
| 163 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 164 | + .backgroundColor(Color.White) | ||
| 165 | + } | ||
| 166 | + }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | ||
| 103 | .backgroundColor(Color.White) | 167 | .backgroundColor(Color.White) |
| 168 | + | ||
| 104 | } | 169 | } |
| 105 | 170 | ||
| 106 | - async aboutToAppear() { | 171 | + private async getDetail() { |
| 107 | let contentId: string = '' | 172 | let contentId: string = '' |
| 108 | let relId: string = '' | 173 | let relId: string = '' |
| 109 | let relType: string = '' | 174 | let relType: string = '' |
| @@ -122,14 +187,106 @@ export struct ImageAndTextPageComponent { | @@ -122,14 +187,106 @@ export struct ImageAndTextPageComponent { | ||
| 122 | } | 187 | } |
| 123 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) | 188 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) |
| 124 | if (detailBeans && detailBeans.length > 0) { | 189 | if (detailBeans && detailBeans.length > 0) { |
| 125 | - this.detailData = detailBeans[0]; | 190 | + this.contentDetailData = detailBeans; |
| 191 | + if (this.contentDetailData[0]?.recommendShow === 1) { | ||
| 192 | + this.getRecommend() | ||
| 193 | + } | ||
| 194 | + if (this.contentDetailData[0]?.openLikes === 1) { | ||
| 195 | + this.getInteractDataStatus() | ||
| 196 | + this.queryContentInteractCount() | ||
| 197 | + } | ||
| 126 | } | 198 | } |
| 199 | + } | ||
| 200 | + } | ||
| 127 | 201 | ||
| 202 | + | ||
| 203 | + private async getRecommend() { | ||
| 204 | + let params: postRecommendListParams = { | ||
| 205 | + imei: "8272c108-4fa2-34ce-80b9-bc425a7c2a7e", | ||
| 206 | + userId: HttpUrlUtils.getUserId(), | ||
| 207 | + contentId: String(this.contentDetailData[0]?.newsId), | ||
| 208 | + recType: 1, | ||
| 209 | + contentType: this.contentDetailData[0]?.newsType, | ||
| 210 | + relId: this.contentDetailData[0]?.reLInfo?.relId, | ||
| 211 | + channelId: String(this.contentDetailData[0]?.reLInfo?.channelId) | ||
| 212 | + } | ||
| 213 | + let recommendList = await DetailViewModel.postRecommendList(params) | ||
| 214 | + if (recommendList && recommendList.length > 0) { | ||
| 215 | + this.recommendList = recommendList; | ||
| 128 | } | 216 | } |
| 217 | + } | ||
| 129 | 218 | ||
| 219 | + // 已登录->查询用户对作品点赞、收藏状态 | ||
| 220 | + private async getInteractDataStatus() { | ||
| 221 | + try { | ||
| 222 | + const params: batchLikeAndCollectParams = { | ||
| 223 | + contentList: [ | ||
| 224 | + { | ||
| 225 | + contentId: this.contentDetailData[0]?.newsId + '', | ||
| 226 | + contentType: this.contentDetailData[0]?.newsType + '', | ||
| 227 | + } | ||
| 228 | + ] | ||
| 229 | + } | ||
| 230 | + console.error(TAG, JSON.stringify(this.contentDetailData)) | ||
| 231 | + let data = await MultiPictureDetailViewModel.getInteractDataStatus(params) | ||
| 232 | + console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data)) | ||
| 233 | + this.newsStatusOfUser = data[0]; | ||
| 234 | + Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`) | ||
| 235 | + } catch (exception) { | ||
| 236 | + console.error(TAG, JSON.stringify(exception)) | ||
| 237 | + } | ||
| 130 | } | 238 | } |
| 131 | 239 | ||
| 132 | - aboutToDisappear() { | 240 | + /** |
| 241 | + * 点赞、取消点赞 | ||
| 242 | + */ | ||
| 243 | + toggleLikeStatus() { | ||
| 244 | + // 未登录,跳转登录 | ||
| 245 | + if (!HttpUrlUtils.getUserId()) { | ||
| 246 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 247 | + return | ||
| 248 | + } | ||
| 249 | + const params: postExecuteLikeParams = { | ||
| 250 | + status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1', | ||
| 251 | + contentId: this.contentDetailData[0]?.newsId + '', | ||
| 252 | + contentType: this.contentDetailData[0]?.newsType + '', | ||
| 253 | + } | ||
| 254 | + PageRepository.postExecuteLike(params).then(res => { | ||
| 255 | + console.log(TAG, '点赞、取消点赞', 'toggleLikeStatus==',) | ||
| 256 | + if (this.newsStatusOfUser) { | ||
| 257 | + this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1' | ||
| 258 | + this.queryContentInteractCount() | ||
| 259 | + } | ||
| 260 | + | ||
| 261 | + }) | ||
| 262 | + } | ||
| 263 | + | ||
| 264 | + /** | ||
| 265 | + * 查询点赞、收藏数量 | ||
| 266 | + */ | ||
| 267 | + queryContentInteractCount() { | ||
| 268 | + console.error(TAG, 'contentDetailData2222', JSON.stringify(this.contentDetailData)) | ||
| 269 | + const params: contentListParams = { | ||
| 270 | + contentList: [{ | ||
| 271 | + contentId: this.contentDetailData[0]?.newsId + '', | ||
| 272 | + contentType: this.contentDetailData[0]?.newsType, | ||
| 273 | + }] | ||
| 274 | + } | ||
| 275 | + PageRepository.getContentInteract(params).then(res => { | ||
| 276 | + if (res.data) { | ||
| 277 | + this.interactData.likeNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.likeNum) | ||
| 278 | + this.interactData.collectNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.collectNum) | ||
| 279 | + this.interactData.commentNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.commentNum) | ||
| 280 | + } | ||
| 281 | + console.log(TAG, '获取互动点赞等数据===', JSON.stringify(res)) | ||
| 282 | + console.log(TAG, 'this.interactData', JSON.stringify(this.interactData)) | ||
| 283 | + }) | ||
| 284 | + } | ||
| 133 | 285 | ||
| 286 | + aboutToAppear() { | ||
| 287 | + this.getDetail() | ||
| 288 | + } | ||
| 289 | + | ||
| 290 | + aboutToDisappear() { | ||
| 134 | } | 291 | } |
| 135 | } | 292 | } |
| @@ -8,82 +8,96 @@ import { | @@ -8,82 +8,96 @@ import { | ||
| 8 | } from 'wdBean'; | 8 | } from 'wdBean'; |
| 9 | import { Logger } from 'wdKit'; | 9 | import { Logger } from 'wdKit'; |
| 10 | import { WdWebComponent, WdWebLocalComponent } from 'wdWebComponent'; | 10 | import { WdWebComponent, WdWebLocalComponent } from 'wdWebComponent'; |
| 11 | -import { BridgeWebViewControl } from '../../../../../../commons/wdWebComponent/oh_modules/wdJsBridge/Index'; | 11 | +import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; |
| 12 | +import { BridgeWebViewControl } from 'wdJsBridge/Index'; | ||
| 12 | 13 | ||
| 13 | @Component | 14 | @Component |
| 14 | export struct ImageAndTextWebComponent { | 15 | export struct ImageAndTextWebComponent { |
| 15 | - webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | ||
| 16 | action: Action = {} as Action | 16 | action: Action = {} as Action |
| 17 | @State reload: number = 0; | 17 | @State reload: number = 0; |
| 18 | - @Prop @Watch('onDetailDataUpdated') detailData: ContentDetailDTO = {} as ContentDetailDTO | 18 | + @Prop @Watch('onDetailDataUpdated') contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO [] |
| 19 | + webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | ||
| 19 | 20 | ||
| 20 | onDetailDataUpdated() { | 21 | onDetailDataUpdated() { |
| 21 | - // if (this.action) { | ||
| 22 | - // let contentId: string = '' | ||
| 23 | - // let contentType: string = '' | ||
| 24 | - // let topicId: string = '' | ||
| 25 | - // let channelId: string = '' | ||
| 26 | - // let compId: string = '' | ||
| 27 | - // let sourcePage: string = '5' | ||
| 28 | - // if (this.action.params) { | ||
| 29 | - // if (this.action.params.contentID) { | ||
| 30 | - // contentId = this.action.params?.contentID | ||
| 31 | - // } | ||
| 32 | - // if (this.action.params.extra) { | ||
| 33 | - // if (this.action.params.extra.contentType) { | ||
| 34 | - // contentType = this.action.params.extra.contentType | ||
| 35 | - // } | ||
| 36 | - // if (this.action.params.extra.topicId) { | ||
| 37 | - // topicId = this.action.params.extra.topicId | ||
| 38 | - // } | ||
| 39 | - // if (this.action.params.extra.channelId) { | ||
| 40 | - // channelId = this.action.params.extra.channelId | ||
| 41 | - // } | ||
| 42 | - // if (this.action.params.extra.compId) { | ||
| 43 | - // compId = this.action.params.extra.compId | ||
| 44 | - // } | ||
| 45 | - // if (this.action.params.extra.sourcePage) { | ||
| 46 | - // sourcePage = this.action.params.extra.sourcePage | ||
| 47 | - // } | ||
| 48 | - // } | ||
| 49 | - // | ||
| 50 | - // } | ||
| 51 | - // | ||
| 52 | - // let h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean | ||
| 53 | - // let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { creatorId: '', isLogin: '0' } as H5ReceiveDataExtraBean | ||
| 54 | - // let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = { | ||
| 55 | - // contentId: contentId, | ||
| 56 | - // contentType: contentType | ||
| 57 | - // } as H5ReceiveDataJsonBean | ||
| 58 | - // h5ReceiveDataJsonBean.topicId = topicId | ||
| 59 | - // h5ReceiveDataJsonBean.channelId = channelId | ||
| 60 | - // h5ReceiveDataJsonBean.compId = compId | ||
| 61 | - // h5ReceiveDataJsonBean.sourcePage = sourcePage | ||
| 62 | - // h5ReceiveDataJsonBean.netError = '0' | ||
| 63 | - // let response: ResponseBean = {} as ResponseBean | ||
| 64 | - // response.data = this.detailData | ||
| 65 | - // response.code = 0 | ||
| 66 | - // response.success = true | ||
| 67 | - // h5ReceiveDataJsonBean.responseMap = response | ||
| 68 | - // h5ReceiveAppData.dataJson = h5ReceiveDataJsonBean | ||
| 69 | - // h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean | ||
| 70 | - // this.webviewControl.callHandle("jsCall_receiveAppData", JSON.stringify(h5ReceiveAppData), (data: string) => { | ||
| 71 | - // Logger.info("from js data = " + data); | ||
| 72 | - // }) | 22 | + if (this.action) { |
| 23 | + let contentId: string = '' | ||
| 24 | + let contentType: string = '' | ||
| 25 | + let topicId: string = '' | ||
| 26 | + let channelId: string = '' | ||
| 27 | + let compId: string = '' | ||
| 28 | + let sourcePage: string = '5' | ||
| 29 | + if (this.action.params) { | ||
| 30 | + if (this.action.params.contentID) { | ||
| 31 | + contentId = this.action.params?.contentID | ||
| 32 | + } | ||
| 33 | + if (this.action.params.extra) { | ||
| 34 | + if (this.action.params.extra.contentType) { | ||
| 35 | + contentType = this.action.params.extra.contentType | ||
| 36 | + } | ||
| 37 | + if (this.action.params.extra.topicId) { | ||
| 38 | + topicId = this.action.params.extra.topicId | ||
| 39 | + } | ||
| 40 | + if (this.action.params.extra.channelId) { | ||
| 41 | + channelId = this.action.params.extra.channelId | ||
| 42 | + } | ||
| 43 | + if (this.action.params.extra.compId) { | ||
| 44 | + compId = this.action.params.extra.compId | ||
| 45 | + } | ||
| 46 | + if (this.action.params.extra.sourcePage) { | ||
| 47 | + sourcePage = this.action.params.extra.sourcePage | ||
| 48 | + } | ||
| 49 | + } | ||
| 73 | 50 | ||
| 74 | - // } | 51 | + } |
| 52 | + | ||
| 53 | + let h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean | ||
| 54 | + // TODO 对接user信息、登录情况 | ||
| 55 | + let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { creatorId: '', isLogin: '0' } as H5ReceiveDataExtraBean | ||
| 56 | + let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = { | ||
| 57 | + contentId: contentId, | ||
| 58 | + contentType: contentType | ||
| 59 | + } as H5ReceiveDataJsonBean | ||
| 60 | + h5ReceiveDataJsonBean.topicId = topicId | ||
| 61 | + h5ReceiveDataJsonBean.channelId = channelId | ||
| 62 | + h5ReceiveDataJsonBean.compId = compId | ||
| 63 | + h5ReceiveDataJsonBean.sourcePage = sourcePage | ||
| 64 | + h5ReceiveDataJsonBean.netError = '0' | ||
| 65 | + let response: ResponseBean = {} as ResponseBean | ||
| 66 | + response.data = this.contentDetailData | ||
| 67 | + response.code = 200 | ||
| 68 | + response.success = true | ||
| 69 | + h5ReceiveDataJsonBean.responseMap = response | ||
| 70 | + h5ReceiveAppData.dataJson = h5ReceiveDataJsonBean | ||
| 71 | + h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean | ||
| 72 | + // TODO 暂延时1s,考虑业务流程再优化 | ||
| 73 | + setTimeout(() => { | ||
| 74 | + this.sendContentData2H5(h5ReceiveAppData); | ||
| 75 | + }, 2000) | ||
| 76 | + | ||
| 77 | + } | ||
| 75 | 78 | ||
| 76 | } | 79 | } |
| 77 | 80 | ||
| 78 | build() { | 81 | build() { |
| 79 | Column() { | 82 | Column() { |
| 80 | - if (this.detailData && this.detailData.shareInfo && this.detailData.shareInfo.shareUrl){ | ||
| 81 | - WdWebComponent({ | ||
| 82 | - webviewControl: this.webviewControl, | ||
| 83 | - webUrl: this.detailData?.shareInfo?.shareUrl, | ||
| 84 | - backVisibility: false, | ||
| 85 | - }) | ||
| 86 | - } | 83 | + WdWebLocalComponent({ |
| 84 | + webviewControl: this.webviewControl, | ||
| 85 | + webResource: $rawfile('apph5/index.html'), | ||
| 86 | + backVisibility: false, | ||
| 87 | + }) | ||
| 88 | + // WdWebLocalComponent({ | ||
| 89 | + // webviewControl: this.webviewControl, | ||
| 90 | + // webResource: "http://pd-people-uat.pdnews.cn/articletopic/35398-10000015965", | ||
| 91 | + // backVisibility: false, | ||
| 92 | + // }) | ||
| 87 | } | 93 | } |
| 88 | } | 94 | } |
| 95 | + | ||
| 96 | + private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) { | ||
| 97 | + Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData'); | ||
| 98 | + this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData, | ||
| 99 | + JSON.stringify(h5ReceiveAppData), (data: string) => { | ||
| 100 | + // Logger.debug('ImageAndTextWebComponent', "from js data = " + data); | ||
| 101 | + }) | ||
| 102 | + } | ||
| 89 | } | 103 | } |
| 1 | // import { FrontLinkObject, MorningEveningPaperDTO, PageInfoBean } from 'wdBean'; | 1 | // import { FrontLinkObject, MorningEveningPaperDTO, PageInfoBean } from 'wdBean'; |
| 2 | import { CompList, PageInfoBean } from 'wdBean'; | 2 | import { CompList, PageInfoBean } from 'wdBean'; |
| 3 | -import { DateTimeUtils, Logger } from 'wdKit/Index'; | 3 | +import { DateTimeUtils, Logger, SPHelper } from 'wdKit/Index'; |
| 4 | import { PaperReaderSimpleDialog } from '../../dialog/PaperReaderDialog'; | 4 | import { PaperReaderSimpleDialog } from '../../dialog/PaperReaderDialog'; |
| 5 | import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel'; | 5 | import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel'; |
| 6 | // import { AudioBarView } from './AudioBarView'; | 6 | // import { AudioBarView } from './AudioBarView'; |
| @@ -21,6 +21,7 @@ export struct MorningEveningPaperComponent { | @@ -21,6 +21,7 @@ export struct MorningEveningPaperComponent { | ||
| 21 | // @State compInfoBean: CompInfoBean = {} as CompInfoBean | 21 | // @State compInfoBean: CompInfoBean = {} as CompInfoBean |
| 22 | @State compListItem: CompList = {} as CompList | 22 | @State compListItem: CompList = {} as CompList |
| 23 | @State audioPlayUrl: string = "" | 23 | @State audioPlayUrl: string = "" |
| 24 | + // @Consume dailyPaperTopicPageId: number | ||
| 24 | // @Provide compListItem: CompList = {} as CompList | 25 | // @Provide compListItem: CompList = {} as CompList |
| 25 | // @State morningEveningPaperDTO: MorningEveningPaperDTO = { | 26 | // @State morningEveningPaperDTO: MorningEveningPaperDTO = { |
| 26 | // name: "新闻夜读", | 27 | // name: "新闻夜读", |
| @@ -92,13 +93,14 @@ export struct MorningEveningPaperComponent { | @@ -92,13 +93,14 @@ export struct MorningEveningPaperComponent { | ||
| 92 | } | 93 | } |
| 93 | 94 | ||
| 94 | async aboutToAppear() { | 95 | async aboutToAppear() { |
| 95 | - console.info(TAG, `aboutToAppear`) | ||
| 96 | - | 96 | + let dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String |
| 97 | + console.info(TAG, `aboutToAppear = ` + dailyPaperTopicPageId) | ||
| 97 | const currentTime = new Date().getTime() | 98 | const currentTime = new Date().getTime() |
| 98 | Logger.info(TAG, "currentTime = " + currentTime) | 99 | Logger.info(TAG, "currentTime = " + currentTime) |
| 99 | Logger.info(TAG, `currentTime = ${currentTime}`) | 100 | Logger.info(TAG, `currentTime = ${currentTime}`) |
| 100 | try { | 101 | try { |
| 101 | - let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("25091") | 102 | + // let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + this.dailyPaperTopicPageId) |
| 103 | + let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + dailyPaperTopicPageId) //"25091" | ||
| 102 | this.pageInfoBean = pageInfoBean; | 104 | this.pageInfoBean = pageInfoBean; |
| 103 | this.title = this.pageInfoBean?.topicInfo?.title | 105 | this.title = this.pageInfoBean?.topicInfo?.title |
| 104 | let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN); | 106 | let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN); |
| @@ -27,27 +27,29 @@ export struct MultiPictureDetailPageComponent { | @@ -27,27 +27,29 @@ export struct MultiPictureDetailPageComponent { | ||
| 27 | private screenWidth: number = 0 | 27 | private screenWidth: number = 0 |
| 28 | private picWidth: number = 0 | 28 | private picWidth: number = 0 |
| 29 | @State picHeight: number = 0 | 29 | @State picHeight: number = 0 |
| 30 | - @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 30 | + @State titleHeight: number = 0 |
| 31 | + @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | ||
| 31 | @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' | 32 | @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' |
| 32 | private swiperController: SwiperController = new SwiperController() | 33 | private swiperController: SwiperController = new SwiperController() |
| 33 | @State swiperIndex: number = 0; | 34 | @State swiperIndex: number = 0; |
| 34 | @Provide followStatus: string = '0' // 关注状态 | 35 | @Provide followStatus: string = '0' // 关注状态 |
| 36 | + private scroller: Scroller = new Scroller() | ||
| 35 | 37 | ||
| 36 | //watch监听页码回调 | 38 | //watch监听页码回调 |
| 37 | onCurrentPageNumUpdated(): void { | 39 | onCurrentPageNumUpdated(): void { |
| 38 | - Logger.info(TAG, `currentPageNum:${this.currentPageNum}`, ) | 40 | + Logger.info(TAG, `currentPageNum:${this.currentPageNum}`,) |
| 39 | let _swiperIndex = Number.parseInt(this.currentPageNum) | 41 | let _swiperIndex = Number.parseInt(this.currentPageNum) |
| 40 | Logger.info(TAG, `_swiperIndex:${_swiperIndex}`) | 42 | Logger.info(TAG, `_swiperIndex:${_swiperIndex}`) |
| 41 | this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex | 43 | this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex |
| 42 | } | 44 | } |
| 43 | 45 | ||
| 44 | - | ||
| 45 | async aboutToAppear() { | 46 | async aboutToAppear() { |
| 46 | //获取宽高尺寸 | 47 | //获取宽高尺寸 |
| 47 | this.screenWidth = this.displayTool.width | 48 | this.screenWidth = this.displayTool.width |
| 48 | // this.picWidth = this.screenWidth - vp2px(52) | 49 | // this.picWidth = this.screenWidth - vp2px(52) |
| 49 | this.picWidth = this.screenWidth | 50 | this.picWidth = this.screenWidth |
| 50 | - this.picHeight = this.picWidth * 566 / 378 | 51 | + this.picHeight = this.picWidth * 578 / 375 |
| 52 | + this.titleHeight = this.screenWidth * 178 / 375 | ||
| 51 | //注册字体 | 53 | //注册字体 |
| 52 | font.registerFont({ | 54 | font.registerFont({ |
| 53 | familyName: 'BebasNeue_Regular', | 55 | familyName: 'BebasNeue_Regular', |
| @@ -69,12 +71,12 @@ export struct MultiPictureDetailPageComponent { | @@ -69,12 +71,12 @@ export struct MultiPictureDetailPageComponent { | ||
| 69 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) { | 71 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) { |
| 70 | Swiper(this.swiperController) { | 72 | Swiper(this.swiperController) { |
| 71 | ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => { | 73 | ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => { |
| 72 | - MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) | 74 | + MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) |
| 73 | }) | 75 | }) |
| 74 | } | 76 | } |
| 75 | .index(this.swiperIndex) | 77 | .index(this.swiperIndex) |
| 76 | .width('100%') | 78 | .width('100%') |
| 77 | - .height(px2vp(this.picHeight)) | 79 | + .height(px2vp(this.picHeight) + 32) |
| 78 | .vertical(false) | 80 | .vertical(false) |
| 79 | .autoPlay(false) | 81 | .autoPlay(false) |
| 80 | .cachedCount(3) | 82 | .cachedCount(3) |
| @@ -82,16 +84,17 @@ export struct MultiPictureDetailPageComponent { | @@ -82,16 +84,17 @@ export struct MultiPictureDetailPageComponent { | ||
| 82 | .displayCount(1) | 84 | .displayCount(1) |
| 83 | .id('e_swiper_content') | 85 | .id('e_swiper_content') |
| 84 | .alignRules({ | 86 | .alignRules({ |
| 85 | - top: { anchor: "__container__", align: VerticalAlign.Top }, | 87 | + center: { anchor: "__container__", align: VerticalAlign.Center }, |
| 86 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 88 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| 87 | }) | 89 | }) |
| 88 | .onChange((index: number) => { | 90 | .onChange((index: number) => { |
| 89 | this.swiperIndex = index | 91 | this.swiperIndex = index |
| 90 | }) | 92 | }) |
| 91 | - if(this.contentDetailData.rmhPlatform == 1) { | 93 | + |
| 94 | + if (this.contentDetailData.rmhPlatform == 1) { | ||
| 92 | Row() { | 95 | Row() { |
| 93 | - Row(){ | ||
| 94 | - Row({space: 8}) { | 96 | + Row() { |
| 97 | + Row({ space: 8 }) { | ||
| 95 | Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl) | 98 | Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl) |
| 96 | .borderRadius('50%') | 99 | .borderRadius('50%') |
| 97 | .alt($r('app.media.picture_loading')) | 100 | .alt($r('app.media.picture_loading')) |
| @@ -102,6 +105,7 @@ export struct MultiPictureDetailPageComponent { | @@ -102,6 +105,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 102 | } | 105 | } |
| 103 | .width('13%') | 106 | .width('13%') |
| 104 | .height('100%') | 107 | .height('100%') |
| 108 | + | ||
| 105 | Row() { | 109 | Row() { |
| 106 | Flex({ | 110 | Flex({ |
| 107 | direction: FlexDirection.Column, | 111 | direction: FlexDirection.Column, |
| @@ -121,7 +125,7 @@ export struct MultiPictureDetailPageComponent { | @@ -121,7 +125,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 121 | .fontWeight(400) | 125 | .fontWeight(400) |
| 122 | .lineHeight(14) | 126 | .lineHeight(14) |
| 123 | .textOverflow({ overflow: TextOverflow.Clip }) | 127 | .textOverflow({ overflow: TextOverflow.Clip }) |
| 124 | - .margin (0) | 128 | + .margin(0) |
| 125 | } | 129 | } |
| 126 | } | 130 | } |
| 127 | .width('81%') | 131 | .width('81%') |
| @@ -133,10 +137,11 @@ export struct MultiPictureDetailPageComponent { | @@ -133,10 +137,11 @@ export struct MultiPictureDetailPageComponent { | ||
| 133 | top: 0, | 137 | top: 0, |
| 134 | bottom: 0, | 138 | bottom: 0, |
| 135 | left: 16, | 139 | left: 16, |
| 136 | - right:0 | 140 | + right: 0 |
| 137 | }) | 141 | }) |
| 138 | - if(this.followStatus == '0') { | ||
| 139 | - Row(){ | 142 | + |
| 143 | + if (this.followStatus == '0') { | ||
| 144 | + Row() { | ||
| 140 | Button('+关注', { type: ButtonType.Normal, stateEffect: true }) | 145 | Button('+关注', { type: ButtonType.Normal, stateEffect: true }) |
| 141 | .borderRadius(4) | 146 | .borderRadius(4) |
| 142 | .backgroundColor('#ED2800') | 147 | .backgroundColor('#ED2800') |
| @@ -149,7 +154,7 @@ export struct MultiPictureDetailPageComponent { | @@ -149,7 +154,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 149 | top: 10, | 154 | top: 10, |
| 150 | bottom: 10, | 155 | bottom: 10, |
| 151 | left: 16, | 156 | left: 16, |
| 152 | - right:16 | 157 | + right: 16 |
| 153 | }) | 158 | }) |
| 154 | .fontSize(12) | 159 | .fontSize(12) |
| 155 | .fontColor(Color.White) | 160 | .fontColor(Color.White) |
| @@ -166,50 +171,72 @@ export struct MultiPictureDetailPageComponent { | @@ -166,50 +171,72 @@ export struct MultiPictureDetailPageComponent { | ||
| 166 | }) | 171 | }) |
| 167 | .id('e_attention') | 172 | .id('e_attention') |
| 168 | } | 173 | } |
| 169 | - | ||
| 170 | Row() { | 174 | 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) | 175 | + Scroll(this.scroller) { |
| 176 | + Row() { | ||
| 177 | + Flex({ | ||
| 178 | + direction: FlexDirection.Column, | ||
| 179 | + justifyContent: FlexAlign.Start | ||
| 180 | + }) { | ||
| 181 | + Text() { | ||
| 182 | + Span(`${this.swiperIndex + 1}`) | ||
| 183 | + .fontSize(24) | ||
| 184 | + .fontFamily('PingFang SC-Medium') | ||
| 185 | + .fontWeight(500) | ||
| 186 | + .lineHeight(28) | ||
| 187 | + Span(`/${this.contentDetailData.photoList.length}`) | ||
| 188 | + .fontSize(14) | ||
| 189 | + .fontFamily('PingFang SC-Medium') | ||
| 190 | + .fontWeight(500) | ||
| 191 | + .lineHeight(19) | ||
| 192 | + }.fontColor(Color.White).margin(4) | ||
| 179 | 193 | ||
| 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) | 194 | + Text(`${this.contentDetailData.newsTitle}`) |
| 195 | + .fontColor(Color.White) | ||
| 196 | + .fontSize(16) | ||
| 197 | + .fontFamily('PingFang SC-Semibold') | ||
| 198 | + .fontWeight(600) | ||
| 199 | + .lineHeight(24) | ||
| 200 | + .margin({ | ||
| 201 | + top: 4, | ||
| 202 | + left: 0, | ||
| 203 | + bottom: 4, | ||
| 204 | + right: 0 | ||
| 205 | + }) | ||
| 206 | + Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`) | ||
| 207 | + .fontColor(Color.White) | ||
| 208 | + .fontSize(14) | ||
| 209 | + .fontFamily('PingFang SC-Regular') | ||
| 210 | + .fontWeight(400) | ||
| 211 | + .lineHeight(22) | ||
| 212 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 213 | + .margin({ | ||
| 214 | + top: 4, | ||
| 215 | + left: 0, | ||
| 216 | + bottom: 4, | ||
| 217 | + right: 18 | ||
| 218 | + }) | ||
| 219 | + .maxLines(16) | ||
| 220 | + } | ||
| 221 | + } | ||
| 222 | + .width('100%') | ||
| 223 | + .margin({ | ||
| 224 | + top: 8, | ||
| 225 | + left: 18, | ||
| 226 | + bottom: 24, | ||
| 227 | + right: 18 | ||
| 228 | + }) | ||
| 198 | } | 229 | } |
| 230 | + .scrollable(ScrollDirection.Vertical) | ||
| 231 | + .scrollBarWidth(0) | ||
| 232 | + .height(px2vp(this.titleHeight)) | ||
| 199 | } | 233 | } |
| 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') | 234 | .id('e_swiper_titles') |
| 209 | .alignRules({ | 235 | .alignRules({ |
| 210 | - bottom: { anchor: "e_swiper_content", align: VerticalAlign.Bottom }, | ||
| 211 | - middle: { anchor: "e_swiper_content", align: HorizontalAlign.Center } | 236 | + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, |
| 237 | + middle: { anchor: "__container__", align: HorizontalAlign.Center } | ||
| 212 | }) | 238 | }) |
| 239 | + .height(px2vp(this.titleHeight) + 64) | ||
| 213 | 240 | ||
| 214 | OperRowListView({ | 241 | OperRowListView({ |
| 215 | contentDetailData: this.contentDetailData, | 242 | contentDetailData: this.contentDetailData, |
| @@ -218,8 +245,15 @@ export struct MultiPictureDetailPageComponent { | @@ -218,8 +245,15 @@ export struct MultiPictureDetailPageComponent { | ||
| 218 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | 245 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, |
| 219 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 246 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| 220 | }) | 247 | }) |
| 221 | - .width('100%').height(56).margin(16) | ||
| 222 | - .border({ width: {top: 0.5}, color: '#FFFFFF' }) | 248 | + .width('100%') |
| 249 | + .height(56) | ||
| 250 | + .margin({ | ||
| 251 | + top: 16, | ||
| 252 | + left: 16, | ||
| 253 | + right: 16, | ||
| 254 | + bottom: 0 | ||
| 255 | + }) | ||
| 256 | + .border({ width: { top: 0.5 }, color: '#FFFFFF' }) | ||
| 223 | .id('e_oper_row') | 257 | .id('e_oper_row') |
| 224 | } | 258 | } |
| 225 | } | 259 | } |
| @@ -227,6 +261,9 @@ export struct MultiPictureDetailPageComponent { | @@ -227,6 +261,9 @@ export struct MultiPictureDetailPageComponent { | ||
| 227 | .height('100%') | 261 | .height('100%') |
| 228 | .backgroundColor(Color.Black) | 262 | .backgroundColor(Color.Black) |
| 229 | .id('e_picture_container') | 263 | .id('e_picture_container') |
| 264 | + // 设置顶部绘制延伸到状态栏 | ||
| 265 | + // 设置底部绘制延伸到导航条 | ||
| 266 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 230 | } | 267 | } |
| 231 | 268 | ||
| 232 | private async getContentDetailData() { | 269 | private async getContentDetailData() { |
| @@ -271,6 +308,7 @@ export struct MultiPictureDetailPageComponent { | @@ -271,6 +308,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 271 | 308 | ||
| 272 | } | 309 | } |
| 273 | } | 310 | } |
| 311 | + | ||
| 274 | /** | 312 | /** |
| 275 | * 关注号主 | 313 | * 关注号主 |
| 276 | */ | 314 | */ |
| @@ -14,7 +14,6 @@ import { CommonConstants } from 'wdConstant/Index'; | @@ -14,7 +14,6 @@ import { CommonConstants } from 'wdConstant/Index'; | ||
| 14 | 14 | ||
| 15 | const TAG = 'BroadcastPageComponent'; | 15 | const TAG = 'BroadcastPageComponent'; |
| 16 | 16 | ||
| 17 | -@Entry | ||
| 18 | @Component | 17 | @Component |
| 19 | export struct BroadcastPageComponent { | 18 | export struct BroadcastPageComponent { |
| 20 | @State params:Params = router.getParams() as Params; | 19 | @State params:Params = router.getParams() as Params; |
| @@ -130,10 +129,9 @@ export struct BroadcastPageComponent { | @@ -130,10 +129,9 @@ export struct BroadcastPageComponent { | ||
| 130 | } | 129 | } |
| 131 | } | 130 | } |
| 132 | .layoutWeight(1) | 131 | .layoutWeight(1) |
| 133 | - // @ts-ignore | ||
| 134 | - .onScrollFrameBegin((offset, state) => { | ||
| 135 | - console.log('ccc',String(offset), state) | ||
| 136 | - }) | 132 | + // .onScrollFrameBegin((offset, state) => { |
| 133 | + // console.log('ccc',String(offset), state) | ||
| 134 | + // }) | ||
| 137 | .onReachStart(() => { | 135 | .onReachStart(() => { |
| 138 | console.log('onReachStart----->',) | 136 | console.log('onReachStart----->',) |
| 139 | }) | 137 | }) |
| @@ -4,7 +4,6 @@ import { CommonConstants } from 'wdConstant/Index'; | @@ -4,7 +4,6 @@ import { CommonConstants } from 'wdConstant/Index'; | ||
| 4 | /** | 4 | /** |
| 5 | * 今日推荐顶部标题--fixed标题 | 5 | * 今日推荐顶部标题--fixed标题 |
| 6 | */ | 6 | */ |
| 7 | -@Entry | ||
| 8 | @Component | 7 | @Component |
| 9 | export struct RecommendHeader { | 8 | export struct RecommendHeader { |
| 10 | build() { | 9 | build() { |
| @@ -4,7 +4,6 @@ import { ProcessUtils } from '../../utils/ProcessUtils'; | @@ -4,7 +4,6 @@ import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 4 | /** | 4 | /** |
| 5 | * 播报--今日推荐列表 | 5 | * 播报--今日推荐列表 |
| 6 | */ | 6 | */ |
| 7 | -@Entry | ||
| 8 | @Component | 7 | @Component |
| 9 | export struct RecommendLists { | 8 | export struct RecommendLists { |
| 10 | @Prop recommendCompInfoBean: CompInfoBean = {} as CompInfoBean // 推荐-组件信息 | 9 | @Prop recommendCompInfoBean: CompInfoBean = {} as CompInfoBean // 推荐-组件信息 |
| @@ -5,7 +5,6 @@ import { ProcessUtils } from '../../utils/ProcessUtils'; | @@ -5,7 +5,6 @@ import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 5 | /** | 5 | /** |
| 6 | * 精选栏目 | 6 | * 精选栏目 |
| 7 | */ | 7 | */ |
| 8 | -@Entry | ||
| 9 | @Component | 8 | @Component |
| 10 | export struct SelectedColumns { | 9 | export struct SelectedColumns { |
| 11 | @Prop columnsCompInfoBean: CompInfoBean = {} as CompInfoBean // 精选栏目组件信息 | 10 | @Prop columnsCompInfoBean: CompInfoBean = {} as CompInfoBean // 精选栏目组件信息 |
| 1 | +import { ContentDTO } from 'wdBean/Index' | ||
| 2 | +import { DateTimeUtils } from 'wdKit/Index' | ||
| 3 | + | ||
| 4 | +/** | ||
| 5 | + * 这里是样式卡中,右下角显示的音视频信息 | ||
| 6 | + * 目前已知: | ||
| 7 | + * 音频: 音频图标+时长 | ||
| 8 | + * 视频:点播图标+时长;直播图标+'直播中' | ||
| 9 | + */ | ||
| 10 | +@Component | ||
| 11 | +export struct CardMediaInfo { | ||
| 12 | + @State contentDTO: ContentDTO = {} as ContentDTO // 如果有duraion,代表点播,显示时长;如果不传或者传0,显示直播中 | ||
| 13 | + // objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频, | ||
| 14 | + // 14动态图文,15动态视频16问政;100人民号,101标签 | ||
| 15 | + | ||
| 16 | + build() { | ||
| 17 | + Row() { | ||
| 18 | + if(this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15' ) { | ||
| 19 | + // 点播、动态视频 | ||
| 20 | + Row(){ | ||
| 21 | + Image($r('app.media.videoTypeIcon')) | ||
| 22 | + .mediaLogo() | ||
| 23 | + Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000)) | ||
| 24 | + .mediaText() | ||
| 25 | + } | ||
| 26 | + .backgroundColor('#4d000000') | ||
| 27 | + .borderRadius($r('app.float.button_border_radius')) | ||
| 28 | + } else if(this.contentDTO.objectType === '2') { | ||
| 29 | + // liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | ||
| 30 | + // 显示直播信息 | ||
| 31 | + Row(){ | ||
| 32 | + if(this.contentDTO.liveInfo.liveState === 'running') { | ||
| 33 | + Image($r('app.media.icon_live')) | ||
| 34 | + .mediaLogo() | ||
| 35 | + Text('直播中') | ||
| 36 | + .mediaText() | ||
| 37 | + } else if(this.contentDTO.liveInfo.liveState === 'end'){ | ||
| 38 | + Image($r('app.media.videoTypeIcon')) | ||
| 39 | + .mediaLogo() | ||
| 40 | + Text('回看') | ||
| 41 | + .mediaText() | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | + .backgroundColor('#4d000000') | ||
| 45 | + .borderRadius($r('app.float.button_border_radius')) | ||
| 46 | + } else if(this.contentDTO.objectType === '9') { | ||
| 47 | + // 显示组图;图片数量 | ||
| 48 | + Row(){ | ||
| 49 | + Image($r('app.media.album_card_shape')) | ||
| 50 | + .mediaLogo() | ||
| 51 | + Text(`${this.contentDTO.photoNum}`) | ||
| 52 | + .mediaText() | ||
| 53 | + .width(20) | ||
| 54 | + } | ||
| 55 | + .backgroundColor('#4d000000') | ||
| 56 | + .borderRadius($r('app.float.button_border_radius')) | ||
| 57 | + } else if(this.contentDTO.objectType === '13') { | ||
| 58 | + // 显示音频信息 | ||
| 59 | + Row(){ | ||
| 60 | + Image($r('app.media.broadcast_listen')) | ||
| 61 | + .height(14) | ||
| 62 | + .borderRadius($r('app.float.button_border_radius')) | ||
| 63 | + Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000)) | ||
| 64 | + .mediaText() | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + .margin(6) | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + @Styles mediaLogo() { | ||
| 72 | + .width(22) | ||
| 73 | + .height(18) | ||
| 74 | + .borderRadius($r('app.float.button_border_radius')) | ||
| 75 | + } | ||
| 76 | +} | ||
| 77 | + | ||
| 78 | +@Extend(Text) function mediaText() { | ||
| 79 | + .fontColor($r('app.color.color_fff')) | ||
| 80 | + .fontSize($r('app.float.font_size_12')) | ||
| 81 | + .width(40) | ||
| 82 | + .height(18) | ||
| 83 | + .textAlign(TextAlign.Center) | ||
| 84 | + .margin({ left: -3 }) | ||
| 85 | +} |
| 1 | +/** | ||
| 2 | + * 这里是人民号动态中的顶部信息:人民号logo,名字,描述,关注等 | ||
| 3 | + */ | ||
| 4 | +import { RmhInfoDTO } from 'wdBean' | ||
| 5 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 6 | + | ||
| 7 | +@Component | ||
| 8 | +export struct RmhTitle { | ||
| 9 | + @Prop rmhInfo: RmhInfoDTO | ||
| 10 | + | ||
| 11 | + build() { | ||
| 12 | + Flex() { | ||
| 13 | + Stack() { | ||
| 14 | + Image(this.rmhInfo.rmhHeadUrl) | ||
| 15 | + .width(36) | ||
| 16 | + .height(36).borderRadius(50) | ||
| 17 | + Image(this.rmhInfo.authIcon) | ||
| 18 | + .width(14) | ||
| 19 | + .height(14) | ||
| 20 | + .borderRadius(50) | ||
| 21 | + } | ||
| 22 | + .margin({ right: 8 }) | ||
| 23 | + .alignContent(Alignment.BottomEnd) | ||
| 24 | + .flexShrink(0) | ||
| 25 | + | ||
| 26 | + Column() { | ||
| 27 | + Text(this.rmhInfo.rmhName) | ||
| 28 | + .fontSize($r('app.float.font_size_13')) | ||
| 29 | + .fontColor($r('app.color.color_222222')) | ||
| 30 | + .fontWeight(600) | ||
| 31 | + .alignSelf(ItemAlign.Start) | ||
| 32 | + Text(this.rmhInfo.rmhDesc) | ||
| 33 | + .fontSize($r("app.float.font_size_12")) | ||
| 34 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 35 | + .maxLines(1) | ||
| 36 | + .alignSelf(ItemAlign.Start) | ||
| 37 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + Blank() | ||
| 41 | + if (this.rmhInfo.cnIsAttention) { | ||
| 42 | + Row() { | ||
| 43 | + Image($r('app.media.rmh_follow')) | ||
| 44 | + .width(16) | ||
| 45 | + .height(16) | ||
| 46 | + Text('关注') | ||
| 47 | + .fontSize($r('app.float.font_size_13')) | ||
| 48 | + .fontColor($r('app.color.color_ED2800')) | ||
| 49 | + } | ||
| 50 | + .flexShrink(0) | ||
| 51 | + .alignSelf(ItemAlign.Center) | ||
| 52 | + .onClick(() => { | ||
| 53 | + // TODO 调用关注接口 | ||
| 54 | + }) | ||
| 55 | + } | ||
| 56 | + } | ||
| 57 | + .width(CommonConstants.FULL_WIDTH) | ||
| 58 | + .margin({ bottom: 10 }) | ||
| 59 | + } | ||
| 60 | +} |
sight_harmony/features/wdComponent/src/main/ets/components/cardview/AttentionListComponent.ets
0 → 100644
| 1 | +import { AttentionRmhInfoDTO } from 'wdBean'; | ||
| 2 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 3 | + | ||
| 4 | +/** | ||
| 5 | + * AttentionListComponent 人民号-关注-我的关注 | ||
| 6 | + * 没有compstyle | ||
| 7 | + */ | ||
| 8 | +const TAG = '人民号-关注-我的关注' | ||
| 9 | + | ||
| 10 | +@Entry | ||
| 11 | +@Component | ||
| 12 | +export struct AttentionListComponent { | ||
| 13 | + @State attentionList: AttentionRmhInfoDTO[] = [] as AttentionRmhInfoDTO[] | ||
| 14 | + | ||
| 15 | + build() { | ||
| 16 | + Row({ space: 4 }) { | ||
| 17 | + List() { | ||
| 18 | + ListItem() { | ||
| 19 | + Column() { | ||
| 20 | + Image($r('app.media.attention_mine')) | ||
| 21 | + .width(48) | ||
| 22 | + .height(48) | ||
| 23 | + .padding(12) | ||
| 24 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 25 | + .borderRadius(50) | ||
| 26 | + .margin({ bottom: 8 }) | ||
| 27 | + Text('我的关注') | ||
| 28 | + .fontSize($r('app.float.font_size_13')) | ||
| 29 | + .fontColor($r('app.color.color_666666')) | ||
| 30 | + } | ||
| 31 | + .width(78) | ||
| 32 | + .height(74) | ||
| 33 | + .onClick(() => { | ||
| 34 | + // 跳转到关注列表-我的 | ||
| 35 | + WDRouterRule.jumpWithPage(WDRouterPage.followListPage) | ||
| 36 | + }) | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + ForEach(this.attentionList, (item: AttentionRmhInfoDTO, index: number) => { | ||
| 40 | + ListItem() { | ||
| 41 | + Column() { | ||
| 42 | + Stack() { | ||
| 43 | + Image(item.attentionHeadPhotoUrl) | ||
| 44 | + .width(48) | ||
| 45 | + .height(48) | ||
| 46 | + .borderRadius(50) | ||
| 47 | + Image(item.authIcon) | ||
| 48 | + .width(14) | ||
| 49 | + .height(14) | ||
| 50 | + .borderRadius(50) | ||
| 51 | + } | ||
| 52 | + .margin({ bottom: 8 }) | ||
| 53 | + .alignContent(Alignment.BottomEnd) | ||
| 54 | + | ||
| 55 | + Text(item.attentionUserName) | ||
| 56 | + .fontSize($r('app.float.font_size_13')) | ||
| 57 | + .fontColor($r('app.color.color_666666')) | ||
| 58 | + .textOverflowStyle(1) | ||
| 59 | + } | ||
| 60 | + .margin({ | ||
| 61 | + right: index === this.attentionList.length - 1 ? $r('app.float.card_comp_pagePadding_lf') : 0, | ||
| 62 | + }) | ||
| 63 | + .padding({ left: 2, right: 2 }) | ||
| 64 | + } | ||
| 65 | + .width(78) | ||
| 66 | + .height(74) | ||
| 67 | + .onClick(() => { | ||
| 68 | + //TODO 跳转到对应的人民号主页 | ||
| 69 | + | ||
| 70 | + }) | ||
| 71 | + }) | ||
| 72 | + } | ||
| 73 | + .listDirection(Axis.Horizontal) | ||
| 74 | + .height(74) | ||
| 75 | + } | ||
| 76 | + .padding({ | ||
| 77 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 78 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 79 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 80 | + }) | ||
| 81 | + } | ||
| 82 | +} | ||
| 83 | + | ||
| 84 | +@Extend(Text) | ||
| 85 | +function textOverflowStyle(maxLine: number) { | ||
| 86 | + .maxLines(maxLine) | ||
| 87 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 88 | +} |
| 1 | +import { ContentDTO, slideShows } from 'wdBean'; | ||
| 2 | +import { CommonConstants } from 'wdConstant' | ||
| 3 | +import { DateTimeUtils } from 'wdKit'; | ||
| 4 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * 大专题卡--CompStyle: 10 | ||
| 9 | + */ | ||
| 10 | +const TAG: string = 'Card10Component'; | ||
| 11 | + | ||
| 12 | +@Component | ||
| 13 | +export struct Card10Component { | ||
| 14 | + @State contentDTO: ContentDTO = {} as ContentDTO; | ||
| 15 | + | ||
| 16 | + build() { | ||
| 17 | + Column() { | ||
| 18 | + // 顶部标题,最多两行 | ||
| 19 | + if (this.contentDTO.newsTitle) { | ||
| 20 | + Text(this.contentDTO.newsTitle) | ||
| 21 | + .width(CommonConstants.FULL_WIDTH) | ||
| 22 | + .fontSize($r('app.float.font_size_17')) | ||
| 23 | + .fontWeight(600) | ||
| 24 | + .maxLines(2) | ||
| 25 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 26 | + .margin({ bottom: 19 }) | ||
| 27 | + } | ||
| 28 | + // 大图 | ||
| 29 | + Stack() { | ||
| 30 | + Image(this.contentDTO && this.contentDTO.coverUrl) | ||
| 31 | + .width('100%') | ||
| 32 | + .borderRadius({ | ||
| 33 | + topLeft: $r('app.float.image_border_radius'), | ||
| 34 | + topRight: $r('app.float.image_border_radius') | ||
| 35 | + }) | ||
| 36 | + .onClick((event: ClickEvent) => { | ||
| 37 | + ProcessUtils.processPage(this.contentDTO) | ||
| 38 | + }) | ||
| 39 | + Text('专题') | ||
| 40 | + .fontSize($r('app.float.font_size_12')) | ||
| 41 | + .padding({ left: 8, right: 8, top: 3, bottom: 3 }) | ||
| 42 | + .backgroundColor(Color.Red) | ||
| 43 | + .fontColor(Color.White) | ||
| 44 | + .borderRadius($r('app.float.button_border_radius')) | ||
| 45 | + .margin({ left: 5, bottom: 5 }) | ||
| 46 | + }.alignContent(Alignment.BottomStart) | ||
| 47 | + | ||
| 48 | + // 专题列表--后端返回三个, | ||
| 49 | + Column() { | ||
| 50 | + ForEach(this.contentDTO.slideShows, (item: slideShows, index: number) => { | ||
| 51 | + this.timelineItem(item, index) | ||
| 52 | + }) | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + // 底部-查看更多。根据接口返回的isMore判断是否显示查看更多 | ||
| 56 | + if (this.contentDTO.hasMore == 1) { | ||
| 57 | + Row() { | ||
| 58 | + Text("查看更多") | ||
| 59 | + .fontSize($r("app.float.font_size_14")) | ||
| 60 | + .fontColor($r("app.color.color_222222")) | ||
| 61 | + .margin({ right: 1 }) | ||
| 62 | + Image($r("app.media.more")) | ||
| 63 | + .width(14) | ||
| 64 | + .height(14) | ||
| 65 | + } | ||
| 66 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 67 | + .width(CommonConstants.FULL_WIDTH) | ||
| 68 | + .height(40) | ||
| 69 | + .borderRadius($r('app.float.button_border_radius')) | ||
| 70 | + .justifyContent(FlexAlign.Center) | ||
| 71 | + .margin({ top: 5 }) | ||
| 72 | + .onClick((event: ClickEvent) => { | ||
| 73 | + ProcessUtils.processPage(this.contentDTO) | ||
| 74 | + }) | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + .width(CommonConstants.FULL_WIDTH) | ||
| 78 | + .padding({ | ||
| 79 | + top: 14, | ||
| 80 | + left: 16, | ||
| 81 | + right: 16, | ||
| 82 | + bottom: 14 | ||
| 83 | + }) | ||
| 84 | + .backgroundColor($r("app.color.white")) | ||
| 85 | + .margin({ bottom: 8 }) | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + @Builder | ||
| 89 | + timelineItem(item: slideShows, index: number) { | ||
| 90 | + Row() { | ||
| 91 | + Column() { | ||
| 92 | + Text(item.newsTitle) | ||
| 93 | + .fontSize($r('app.float.font_size_17')) | ||
| 94 | + .fontWeight(400) | ||
| 95 | + .fontColor($r('app.color.color_222222')) | ||
| 96 | + .maxLines(2) | ||
| 97 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 98 | + Row() { | ||
| 99 | + // 展示发稿人 | ||
| 100 | + if (item.source) { | ||
| 101 | + Text(item.source) | ||
| 102 | + .fontSize($r('app.float.font_size_12')) | ||
| 103 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 104 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 105 | + .maxLines(1) | ||
| 106 | + .width(item.source.length > 10 ? '60%' : '') | ||
| 107 | + | ||
| 108 | + Image($r('app.media.point')) | ||
| 109 | + .width(16) | ||
| 110 | + .height(16) | ||
| 111 | + } | ||
| 112 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(String(item.publishTime)))) | ||
| 113 | + .fontSize($r("app.float.font_size_12")) | ||
| 114 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 115 | + } | ||
| 116 | + .margin({ top: 12 }) | ||
| 117 | + } | ||
| 118 | + .layoutWeight(1) | ||
| 119 | + .alignItems(HorizontalAlign.Start) | ||
| 120 | + | ||
| 121 | + // 右侧图片 | ||
| 122 | + if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) { | ||
| 123 | + Image(item.fullColumnImgUrls[0].url) | ||
| 124 | + .width(117) | ||
| 125 | + .height(78) | ||
| 126 | + .objectFit(ImageFit.Cover) | ||
| 127 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 128 | + .margin({ left: 12 }) | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + .padding({ top: 10, bottom: 10 }) | ||
| 132 | + .onClick((event: ClickEvent) => { | ||
| 133 | + const str: string = JSON.stringify(this.contentDTO); | ||
| 134 | + const data: ContentDTO = JSON.parse(str) | ||
| 135 | + data.objectId = item.newsId | ||
| 136 | + data.relId = item.relId | ||
| 137 | + data.objectType = String(item.objectType) | ||
| 138 | + ProcessUtils.processPage(data) | ||
| 139 | + }) | ||
| 140 | + } | ||
| 141 | +} |
| 1 | +//缩略标题 | ||
| 2 | +import { CommonConstants } from 'wdConstant' | ||
| 3 | +import { ContentDTO } from 'wdBean' | ||
| 4 | +import { DateTimeUtils } from 'wdKit' | ||
| 5 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 6 | + | ||
| 7 | +const TAG = 'Card11Component'; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 无图卡(标题省略) Card_11 = '11 | ||
| 11 | + */ | ||
| 12 | +@Component | ||
| 13 | +export struct Card11Component { | ||
| 14 | + @State contentDTO: ContentDTO = {} as ContentDTO; | ||
| 15 | + | ||
| 16 | + build() { | ||
| 17 | + Column() { | ||
| 18 | + Text(this.contentDTO.newsTitle) | ||
| 19 | + .fontSize($r("app.float.font_size_16")) | ||
| 20 | + .fontColor($r("app.color.color_222222")) | ||
| 21 | + .maxLines(3) | ||
| 22 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 23 | + .width(CommonConstants.FULL_WIDTH) | ||
| 24 | + Row() { | ||
| 25 | + if (this.contentDTO.source) { | ||
| 26 | + Text(this.contentDTO.source) | ||
| 27 | + .fontSize($r("app.float.font_size_12")) | ||
| 28 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 29 | + .margin({ left: 6 }) | ||
| 30 | + Image($r("app.media.point")) | ||
| 31 | + .width(16) | ||
| 32 | + .height(16) | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | ||
| 36 | + .fontSize($r("app.float.font_size_12")) | ||
| 37 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 38 | + .margin({ right: 6 }) | ||
| 39 | + // TODO '评论取哪个字段' | ||
| 40 | + // Text(`1806评`) | ||
| 41 | + // .fontSize($r("app.float.font_size_12")) | ||
| 42 | + // .fontColor($r("app.color.color_B0B0B0")) | ||
| 43 | + }.width(CommonConstants.FULL_WIDTH) | ||
| 44 | + .justifyContent(FlexAlign.Start) | ||
| 45 | + .margin({ top: 8 }) | ||
| 46 | + | ||
| 47 | + }.width(CommonConstants.FULL_WIDTH) | ||
| 48 | + .padding({ | ||
| 49 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 50 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 51 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 52 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 53 | + }) | ||
| 54 | + .backgroundColor($r("app.color.white")) | ||
| 55 | + .onClick((event: ClickEvent) => { | ||
| 56 | + ProcessUtils.processPage(this.contentDTO) | ||
| 57 | + }) | ||
| 58 | + } | ||
| 59 | +} |
| 1 | +import { ContentDTO } from 'wdBean'; | ||
| 2 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 3 | +import { RmhTitle } from '../cardCommon/RmhTitle' | ||
| 4 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 5 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 6 | + | ||
| 7 | +const TAG: string = 'Card15Component'; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 大图卡人民号: | ||
| 11 | + * compstyle:15 | ||
| 12 | + * 卡片结构:上下结构 | ||
| 13 | + * 卡片宽度:充满父窗口 | ||
| 14 | + * 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9: | ||
| 15 | + */ | ||
| 16 | +@Component | ||
| 17 | +export struct Card15Component { | ||
| 18 | + @State contentDTO: ContentDTO = { | ||
| 19 | + // appStyle: '15', | ||
| 20 | + // coverType: 1, | ||
| 21 | + // objectType: '9', | ||
| 22 | + // coverUrl: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/img/2024/0413/VL20Z09ISBEKXZU_963672030241091584.jpeg?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90', | ||
| 23 | + // fullColumnImgUrls: [ | ||
| 24 | + // { | ||
| 25 | + // landscape: 2, | ||
| 26 | + // size: 1, | ||
| 27 | + // url: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/img/2024/0413/VL20Z09ISBEKXZU_963672030241091584.jpeg?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90', | ||
| 28 | + // weight: 1170 | ||
| 29 | + // } | ||
| 30 | + // ], | ||
| 31 | + // newsTitle: '押解画面公开!被湖北民警从柬埔寨押解回国被湖北民警从柬埔寨押解回国的130名涉赌诈嫌疑人是他们被湖北民警从柬埔寨押解回国的130名涉赌诈嫌疑人是他们的130名涉赌诈嫌疑人是他们', | ||
| 32 | + // publishTime: '1712993333000', | ||
| 33 | + // rmhInfo: { | ||
| 34 | + // authIcon: '', | ||
| 35 | + // authTitle: '', | ||
| 36 | + // authTitle2: '', | ||
| 37 | + // banControl: 0, | ||
| 38 | + // cnIsAttention: 1, | ||
| 39 | + // rmhDesc: '中共武汉市委机关报长江日报官方人民号', | ||
| 40 | + // rmhHeadUrl: 'https://uatjdcdnphoto.aikan.pdnews.cn/vod/content/202302/202302Sa121448724/TUw.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg', | ||
| 41 | + // rmhId: '4255270', | ||
| 42 | + // rmhName: '长江日报', | ||
| 43 | + // userId: '513696944662469', | ||
| 44 | + // userType: '3' | ||
| 45 | + // }, | ||
| 46 | + // videoInfo: { | ||
| 47 | + // firstFrameImageUri: '', | ||
| 48 | + // videoDuration: 12, | ||
| 49 | + // // videoLandscape: 2, | ||
| 50 | + // videoUrl: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/video/2024/0413/VL20Z09ISBEKXZU_963672027208609792.mp4' | ||
| 51 | + // }, | ||
| 52 | + // photoNum: '9', | ||
| 53 | + // voiceInfo: { | ||
| 54 | + // voiceDuration: 12 | ||
| 55 | + // } | ||
| 56 | + } as ContentDTO; | ||
| 57 | + | ||
| 58 | + build() { | ||
| 59 | + Column() { | ||
| 60 | + // rmh信息 | ||
| 61 | + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) | ||
| 62 | + //新闻标题 | ||
| 63 | + if (this.contentDTO.newsTitle) { | ||
| 64 | + Text(this.contentDTO.newsTitle) | ||
| 65 | + .fontSize($r('app.float.font_size_17')) | ||
| 66 | + .fontColor($r('app.color.color_222222')) | ||
| 67 | + .width(CommonConstants.FULL_WIDTH) | ||
| 68 | + .textOverflowStyle(2) | ||
| 69 | + .margin({ bottom: 8 }) | ||
| 70 | + } | ||
| 71 | + //大图 | ||
| 72 | + Stack() { | ||
| 73 | + Image(this.contentDTO.coverUrl) | ||
| 74 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 75 | + //播放状态+时长 | ||
| 76 | + CardMediaInfo({ | ||
| 77 | + contentDTO: this.contentDTO | ||
| 78 | + }) | ||
| 79 | + } | ||
| 80 | + .width(CommonConstants.FULL_WIDTH) | ||
| 81 | + .aspectRatio(16 / 9) | ||
| 82 | + .alignContent(Alignment.BottomEnd) | ||
| 83 | + | ||
| 84 | + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | ||
| 85 | + } | ||
| 86 | + .padding({ | ||
| 87 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 88 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 89 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 90 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 91 | + }) | ||
| 92 | + .onClick((event: ClickEvent) => { | ||
| 93 | + ProcessUtils.processPage(this.contentDTO) | ||
| 94 | + }) | ||
| 95 | + } | ||
| 96 | +} | ||
| 97 | + | ||
| 98 | + | ||
| 99 | +@Extend(Text) | ||
| 100 | +function textOverflowStyle(maxLine: number) { | ||
| 101 | + .maxLines(maxLine) | ||
| 102 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 103 | +} |
| 1 | +import { Action, CompDTO, ContentDTO, Params } from 'wdBean'; | ||
| 2 | +import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; | ||
| 3 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 4 | +import { DateTimeUtils } from 'wdKit'; | ||
| 5 | +import { WDRouterRule } from 'wdRouter'; | ||
| 6 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 7 | + | ||
| 8 | +const TAG = 'Card17Component'; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 图卡集---2 | ||
| 12 | + */ | ||
| 13 | +@Component | ||
| 14 | +export struct Card17Component { | ||
| 15 | + @State compDTO: CompDTO = {} as CompDTO | ||
| 16 | + @State contentDTO: ContentDTO = {} as ContentDTO; | ||
| 17 | + | ||
| 18 | + build() { | ||
| 19 | + Column({ space: 8 }) { | ||
| 20 | + Text(this.contentDTO.newsTitle) | ||
| 21 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 22 | + .fontSize($r('app.float.font_size_17')) | ||
| 23 | + .fontColor($r('app.color.color_222222')) | ||
| 24 | + .lineHeight(25) | ||
| 25 | + .maxLines(3) | ||
| 26 | + .width(CommonConstants.FULL_WIDTH) | ||
| 27 | + | ||
| 28 | + Stack({ alignContent: Alignment.BottomEnd }) { | ||
| 29 | + // 三个图, | ||
| 30 | + GridRow({ gutter: 2 }) { | ||
| 31 | + GridCol({ span: { xs: 8 } }) { | ||
| 32 | + Image(this.contentDTO.fullColumnImgUrls[0].url) | ||
| 33 | + .width(CommonConstants.FULL_WIDTH) | ||
| 34 | + .aspectRatio(16 / 9) | ||
| 35 | + .borderRadius({ | ||
| 36 | + topLeft: $r('app.float.image_border_radius'), | ||
| 37 | + bottomLeft: $r('app.float.image_border_radius'), | ||
| 38 | + }) | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + GridCol({ span: { xs: 4 } }) { | ||
| 42 | + Image(this.contentDTO.fullColumnImgUrls[1].url) | ||
| 43 | + .width(CommonConstants.FULL_WIDTH) | ||
| 44 | + .aspectRatio(16 / 9) | ||
| 45 | + .margin({ bottom: 1 }) | ||
| 46 | + .borderRadius({ | ||
| 47 | + topRight: $r('app.float.image_border_radius'), | ||
| 48 | + }) | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + GridRow({ gutter: 2 }) { | ||
| 53 | + GridCol({ span: { xs: 8 } }) { | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + GridCol({ span: { xs: 4 } }) { | ||
| 57 | + Image(this.contentDTO.fullColumnImgUrls[2].url) | ||
| 58 | + .width(CommonConstants.FULL_WIDTH) | ||
| 59 | + .aspectRatio(16 / 9) | ||
| 60 | + .margin({ top: 1 }) | ||
| 61 | + .borderRadius({ | ||
| 62 | + bottomRight: $r('app.float.image_border_radius'), | ||
| 63 | + }) | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + CardMediaInfo({ contentDTO: this.contentDTO }) | ||
| 68 | + } | ||
| 69 | + .width(CommonConstants.FULL_WIDTH) | ||
| 70 | + .onClick((event: ClickEvent) => { | ||
| 71 | + let taskAction: Action = { | ||
| 72 | + type: 'JUMP_DETAIL_PAGE', | ||
| 73 | + params: { | ||
| 74 | + detailPageType: 17, | ||
| 75 | + contentID: this.contentDTO.objectId, | ||
| 76 | + extra: { | ||
| 77 | + relType: this.contentDTO.relType, | ||
| 78 | + relId: `${this.contentDTO.relId}`, | ||
| 79 | + } as ExtraDTO | ||
| 80 | + } as Params, | ||
| 81 | + }; | ||
| 82 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 83 | + }) | ||
| 84 | + | ||
| 85 | + Row() { | ||
| 86 | + if (this.contentDTO.source) { | ||
| 87 | + Text(this.contentDTO.source) | ||
| 88 | + .fontSize($r('app.float.font_size_13')) | ||
| 89 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 90 | + Image($r('app.media.point')) | ||
| 91 | + .width(16) | ||
| 92 | + .height(16) | ||
| 93 | + } | ||
| 94 | + if (this.contentDTO.publishTime && this.contentDTO.publishTime.length === 13) { | ||
| 95 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | ||
| 96 | + .fontSize($r('app.float.font_size_13')) | ||
| 97 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + .width(CommonConstants.FULL_WIDTH) | ||
| 101 | + .height(16) | ||
| 102 | + .id('label') | ||
| 103 | + } | ||
| 104 | + .width(CommonConstants.FULL_WIDTH) | ||
| 105 | + .padding({ | ||
| 106 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 107 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 108 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 109 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 110 | + }) | ||
| 111 | + } | ||
| 112 | +} |
-
Please register or login to post a comment