Merge remote-tracking branch 'origin/main' into main
# Conflicts: # sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponent.ets # sight_harmony/products/phone/src/main/ets/pages/view/BottomNavigationComponent.ets
Showing
21 changed files
with
107 additions
and
720 deletions
| @@ -295,6 +295,10 @@ export class ProcessUtils { | @@ -295,6 +295,10 @@ export class ProcessUtils { | ||
| 295 | Logger.debug(TAG, `gotoVod, ${content.objectId}`); | 295 | Logger.debug(TAG, `gotoVod, ${content.objectId}`); |
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | + /** | ||
| 299 | + * 进入直播详情页面 | ||
| 300 | + * @param content | ||
| 301 | + */ | ||
| 298 | public static async gotoLive(content: ContentDTO) { | 302 | public static async gotoLive(content: ContentDTO) { |
| 299 | let taskAction: Action = { | 303 | let taskAction: Action = { |
| 300 | type: 'JUMP_DETAIL_PAGE', | 304 | type: 'JUMP_DETAIL_PAGE', |
| @@ -14,8 +14,6 @@ export { PageComponent } from "./src/main/ets/components/page/PageComponent" | @@ -14,8 +14,6 @@ export { PageComponent } from "./src/main/ets/components/page/PageComponent" | ||
| 14 | 14 | ||
| 15 | export { LikeComponent } from "./src/main/ets/components/view/LikeComponent" | 15 | export { LikeComponent } from "./src/main/ets/components/view/LikeComponent" |
| 16 | 16 | ||
| 17 | -export { TopNavigationComponent } from "./src/main/ets/components/page/TopNavigationComponent" | ||
| 18 | - | ||
| 19 | export { TopNavigationComponentNew } from "./src/main/ets/components/page/TopNavigationComponentNew" | 17 | export { TopNavigationComponentNew } from "./src/main/ets/components/page/TopNavigationComponentNew" |
| 20 | 18 | ||
| 21 | export { LabelComponent } from "./src/main/ets/components/view/LabelComponent" | 19 | export { LabelComponent } from "./src/main/ets/components/view/LabelComponent" |
| @@ -65,16 +65,9 @@ export struct FeedBackActivity { | @@ -65,16 +65,9 @@ export struct FeedBackActivity { | ||
| 65 | GridCol({ | 65 | GridCol({ |
| 66 | }) { | 66 | }) { |
| 67 | Row(){ | 67 | Row(){ |
| 68 | - Toggle({ type: ToggleType.Checkbox, isOn: feedbackTypeBean.isSelect }) | ||
| 69 | - .onChange((select) => { | ||
| 70 | - feedbackTypeBean.isSelect = select | ||
| 71 | - this.canSubmit = this.checkSubmit() | ||
| 72 | - | ||
| 73 | - TrackingButton.click('submit_feedback',TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage,{ | ||
| 74 | - 'feedback_type':feedbackTypeBean.id+'' | ||
| 75 | - }) | ||
| 76 | - | ||
| 77 | - }) | 68 | + Image(feedbackTypeBean.isSelect ? $r('app.media.checkbox_true') : $r('app.media.checkbox_false')) |
| 69 | + .width(17) | ||
| 70 | + .height(17) | ||
| 78 | Text(feedbackTypeBean.classifyName) | 71 | Text(feedbackTypeBean.classifyName) |
| 79 | .fontColor($r('app.color.color_222222')) | 72 | .fontColor($r('app.color.color_222222')) |
| 80 | .fontSize($r('app.float.font_size_14')) | 73 | .fontSize($r('app.float.font_size_14')) |
| @@ -84,6 +77,21 @@ export struct FeedBackActivity { | @@ -84,6 +77,21 @@ export struct FeedBackActivity { | ||
| 84 | .height($r('app.float.vp_22')) | 77 | .height($r('app.float.vp_22')) |
| 85 | .margin({bottom:$r('app.float.margin_16')}) | 78 | .margin({bottom:$r('app.float.margin_16')}) |
| 86 | .backgroundColor($r('app.color.color_fff')) | 79 | .backgroundColor($r('app.color.color_fff')) |
| 80 | + .onClick(() => { | ||
| 81 | + let temp = {} as FeedbackTypeBean | ||
| 82 | + temp.id = feedbackTypeBean.id | ||
| 83 | + temp.classifyName = feedbackTypeBean.classifyName | ||
| 84 | + if(feedbackTypeBean.isSelect){ | ||
| 85 | + temp.isSelect = false | ||
| 86 | + }else{ | ||
| 87 | + temp.isSelect = true | ||
| 88 | + } | ||
| 89 | + this.feedbackTypeBeans[index] = temp | ||
| 90 | + this.canSubmit = this.checkSubmit() | ||
| 91 | + TrackingButton.click('submit_feedback',TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage,{ | ||
| 92 | + 'feedback_type':feedbackTypeBean.id+'' | ||
| 93 | + }) | ||
| 94 | + }) | ||
| 87 | } | 95 | } |
| 88 | }) | 96 | }) |
| 89 | } | 97 | } |
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponent.ets
deleted
100644 → 0
| 1 | -import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean'; | ||
| 2 | -import { SpConstants } from 'wdConstant'; | ||
| 3 | -import { DisplayUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit'; | ||
| 4 | -import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter'; | ||
| 5 | -import { PageComponent } from './PageComponent'; | ||
| 6 | -import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'; | ||
| 7 | -import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent'; | ||
| 8 | -import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; | ||
| 9 | -import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent'; | ||
| 10 | -import { channelSkeleton } from '../skeleton/channelSkeleton'; | ||
| 11 | -import { TrackingButton, TrackConstants } from 'wdTracking/Index'; | ||
| 12 | -import { ParamType, Tracking } from 'wdTracking/Index'; | ||
| 13 | - | ||
| 14 | -const TAG = 'TopNavigationComponent'; | ||
| 15 | - | ||
| 16 | -PersistentStorage.persistProp('channelIds', ''); | ||
| 17 | -PersistentStorage.persistProp('indexSettingChannelId', 2002); | ||
| 18 | - | ||
| 19 | -const storage = LocalStorage.getShared(); | ||
| 20 | - | ||
| 21 | -/** | ||
| 22 | - * 顶部页签导航栏/顶导 | ||
| 23 | - */ | ||
| 24 | -@Entry(storage) | ||
| 25 | -@Component | ||
| 26 | -export struct TopNavigationComponent { | ||
| 27 | - private groupId: number = 0 | ||
| 28 | - private currentBottomNavName: string = '' | ||
| 29 | - | ||
| 30 | - private pageName: string = '' | ||
| 31 | - private pageId: number = 0 | ||
| 32 | - private tabsController: TabsController = new TabsController() | ||
| 33 | - @Consume isLayoutFullScreen: boolean | ||
| 34 | - @Consume bottomRectHeight: number | ||
| 35 | - @Consume topRectHeight: number | ||
| 36 | - @Consume currentBottomNavInfo: BottomNavDTO // 当前底导信息 | ||
| 37 | - @Consume barBackgroundColor: Color | ||
| 38 | - @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | ||
| 39 | - @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | ||
| 40 | - @Link _currentNavIndex?: number; | ||
| 41 | - // 顶导当前选中/焦点下标 | ||
| 42 | - @State currentTopNavSelectedIndex: number = 0; | ||
| 43 | - /** | ||
| 44 | - * @deprecated TODO,没地方用到,是否弃用 | ||
| 45 | - */ | ||
| 46 | - @State currentTopNavName: string = ''; | ||
| 47 | - @State currentTopNavItem: TopNavDTO = {} as TopNavDTO | ||
| 48 | - // 顶导数据 | ||
| 49 | - @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] | ||
| 50 | - @State compList: LazyDataSource<CompDTO> = new LazyDataSource(); | ||
| 51 | - @StorageProp('indexSettingChannelId') indexSettingChannelId: number = 2002 | ||
| 52 | - //我的频道id列表 | ||
| 53 | - @State channelIds: number[] = [] | ||
| 54 | - //本地缓存频道id列表 | ||
| 55 | - @StorageProp('channelIds') storageChannelIds: string = '' | ||
| 56 | - @State homeChannelList: TopNavDTO[] = [] | ||
| 57 | - // 我的频道列表 | ||
| 58 | - @State myChannelList: TopNavDTO[] = [] | ||
| 59 | - // 更多频道列表 | ||
| 60 | - @State moreChannelList: TopNavDTO[] = [] | ||
| 61 | - // 地方频道列表 | ||
| 62 | - @State localChannelList: TopNavDTO[] = [] | ||
| 63 | - readonly MAX_LINE: number = 1; | ||
| 64 | - @ObjectLink @Watch('onAssignChannelChange') assignChannel: AssignChannelParam | ||
| 65 | - // 底导传递过来的自动刷新通知 | ||
| 66 | - @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 | ||
| 67 | - // 传递给page的自动刷新通知 | ||
| 68 | - @State autoRefresh2Page: number = 0 | ||
| 69 | - // 当前底导index | ||
| 70 | - @State navIndex: number = 0 | ||
| 71 | - @State animationDuration: number = 0 | ||
| 72 | - @State indicatorLeftMargin: number = 0 | ||
| 73 | - @State indicatorWidth: number = 0 | ||
| 74 | - private tabsWidth: number = 0 | ||
| 75 | - // 标识,是否为点击触发的tab切换,临时变量 | ||
| 76 | - private changeByClick: boolean = false | ||
| 77 | - | ||
| 78 | - //处理新闻tab顶导频道数据 | ||
| 79 | - topNavListHandle() { | ||
| 80 | - let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string | ||
| 81 | - | ||
| 82 | - let _channelIds: number [] = [] | ||
| 83 | - let _myChannelList: TopNavDTO [] = [] | ||
| 84 | - let _storageChannelIds: string [] = [] //list1 | ||
| 85 | - let defaultMyChannelList: TopNavDTO[] = [] | ||
| 86 | - let defaultList = [...this.topNavList] | ||
| 87 | - defaultList.sort((a, b) => { | ||
| 88 | - return a.num - b.num; | ||
| 89 | - }); | ||
| 90 | - | ||
| 91 | - //defaultMyChannelList | ||
| 92 | - defaultList.forEach(item => { | ||
| 93 | - if (item.defaultPermitted === 1 || item.movePermitted === 0 || item.delPermitted === 0 || | ||
| 94 | - item.headlinesOn === 1) { | ||
| 95 | - defaultMyChannelList.push(item); | ||
| 96 | - } | ||
| 97 | - if (item.defaultPermitted === 1) { | ||
| 98 | - this.homeChannelList.push(item) | ||
| 99 | - } | ||
| 100 | - }) | ||
| 101 | - | ||
| 102 | - //有缓存频道id | ||
| 103 | - if (this.storageChannelIds) { | ||
| 104 | - _storageChannelIds = this.storageChannelIds.split(',') | ||
| 105 | - } | ||
| 106 | - | ||
| 107 | - defaultMyChannelList.forEach(item => { | ||
| 108 | - item.myChannel = '1' | ||
| 109 | - if (item.defaultPermitted === 1) { | ||
| 110 | - item.homeChannel = '1' | ||
| 111 | - } | ||
| 112 | - let index = defaultList.findIndex(_item => _item.channelId === item.channelId) | ||
| 113 | - if (index !== -1) { | ||
| 114 | - defaultList.splice(index, 1) | ||
| 115 | - } | ||
| 116 | - }) | ||
| 117 | - defaultList.unshift(...defaultMyChannelList) | ||
| 118 | - | ||
| 119 | - defaultList.forEach((item, index) => { | ||
| 120 | - if (this.storageChannelIds && _storageChannelIds.includes(String(item.channelId))) { | ||
| 121 | - item.myChannel = '1' | ||
| 122 | - } | ||
| 123 | - if (item.channelType === 2) { | ||
| 124 | - if (cityName.includes(item.name)) { | ||
| 125 | - item.myChannel = '1' | ||
| 126 | - } | ||
| 127 | - item.localChannel = '1' | ||
| 128 | - } | ||
| 129 | - if (index >= 11) { | ||
| 130 | - if (item.channelType === 1) { | ||
| 131 | - item.moreChannel = '1' | ||
| 132 | - } | ||
| 133 | - } else { | ||
| 134 | - if (item.channelType === 1 && item.myChannel !== '1') { | ||
| 135 | - item.moreChannel = '1' | ||
| 136 | - } | ||
| 137 | - } | ||
| 138 | - | ||
| 139 | - //频道分类 | ||
| 140 | - if (item.name !== '播报') { //暂时隐藏播报 | ||
| 141 | - if (item.myChannel === '1') { | ||
| 142 | - _myChannelList.push(item) | ||
| 143 | - _channelIds.push(item.channelId) | ||
| 144 | - } else if (item.moreChannel === '1') { | ||
| 145 | - this.moreChannelList.push(item) | ||
| 146 | - } else if (item.localChannel === '1' && item.myChannel !== '1') { | ||
| 147 | - this.localChannelList.push(item) | ||
| 148 | - } | ||
| 149 | - } | ||
| 150 | - | ||
| 151 | - }) | ||
| 152 | - | ||
| 153 | - if (cityName) { | ||
| 154 | - let index = _myChannelList.findIndex(ele => cityName.includes(ele.name)) | ||
| 155 | - const localChannelitem = _myChannelList.splice(index, 1)[0]; | ||
| 156 | - // 将当前地区频道插入到第四个 | ||
| 157 | - _myChannelList.splice(3, 0, localChannelitem); | ||
| 158 | - } | ||
| 159 | - | ||
| 160 | - this.channelIds = _channelIds | ||
| 161 | - this.myChannelList = _myChannelList | ||
| 162 | - | ||
| 163 | - // 崩溃 | ||
| 164 | - // this.currentTopNavName = this._currentNavIndex === 0 ? this.myChannelList[0].name : this.topNavList[0].name | ||
| 165 | - if (this._currentNavIndex === 0 && this.myChannelList && this.myChannelList.length > 0 && this.myChannelList[0] && | ||
| 166 | - this.myChannelList[0].name) { | ||
| 167 | - this.currentTopNavName = this.myChannelList[0].name | ||
| 168 | - } else if (this._currentNavIndex != 0 && this.topNavList && this.topNavList.length > 0 && this.topNavList[0].name) { | ||
| 169 | - this.currentTopNavName = this.topNavList[0].name | ||
| 170 | - } | ||
| 171 | - | ||
| 172 | - //缓存首页频道 | ||
| 173 | - let index = this.myChannelList.findIndex(_item => _item?.channelId === this.indexSettingChannelId) | ||
| 174 | - if (index > -1) { | ||
| 175 | - this.currentTopNavSelectedIndex = index | ||
| 176 | - this.currentTopNavName = this.myChannelList[index].name | ||
| 177 | - } | ||
| 178 | - this.currentTopNavItem = this.myChannelList[this.currentTopNavSelectedIndex] | ||
| 179 | - } | ||
| 180 | - | ||
| 181 | - isBroadcast(item?: TopNavDTO) { | ||
| 182 | - // TODO 用id channelId = '2066' | ||
| 183 | - return item?.name === '播报' | ||
| 184 | - } | ||
| 185 | - | ||
| 186 | - isLayout(item?: TopNavDTO) { | ||
| 187 | - // TODO 用id channelId = '2006' | ||
| 188 | - return item?.name === '版面' | ||
| 189 | - } | ||
| 190 | - | ||
| 191 | - isSpecialChannel(item?: TopNavDTO) { | ||
| 192 | - // 版面、播报,可以用这个判断 | ||
| 193 | - return item?.channelType === 3 | ||
| 194 | - } | ||
| 195 | - | ||
| 196 | - | ||
| 197 | - build() { | ||
| 198 | - Column() { | ||
| 199 | - // 顶部搜索、日报logo、早晚报 | ||
| 200 | - Column() { | ||
| 201 | - Row() { | ||
| 202 | - FirstTabTopSearchComponent() | ||
| 203 | - | ||
| 204 | - Image($r('app.media.icon_ren_min_ri_bao')) | ||
| 205 | - .width(72) | ||
| 206 | - .height(29) | ||
| 207 | - .onClick(() => { | ||
| 208 | - ProcessUtils.gotoENewsPaper() | ||
| 209 | - }) | ||
| 210 | - Stack({ alignContent: Alignment.Center }) { | ||
| 211 | - Image($r('app.media.background_read_paper_home')) | ||
| 212 | - .width('100%') | ||
| 213 | - .height('100%') | ||
| 214 | - .objectFit(ImageFit.Contain) | ||
| 215 | - Row() { | ||
| 216 | - Image($r('app.media.icon_read_paper_home')) | ||
| 217 | - .width(18) | ||
| 218 | - .height(18) | ||
| 219 | - Text('早晚报') | ||
| 220 | - .fontColor("#666666") | ||
| 221 | - .fontSize($r('app.float.font_size_13')) | ||
| 222 | - } | ||
| 223 | - .alignItems(VerticalAlign.Center) | ||
| 224 | - .justifyContent(FlexAlign.Center) | ||
| 225 | - } | ||
| 226 | - .height(30) | ||
| 227 | - .width(124) | ||
| 228 | - .onClick(() => { | ||
| 229 | - if (NetworkUtil.isNetConnected()) { | ||
| 230 | - | ||
| 231 | - // 早晚报埋点 | ||
| 232 | - const params: ParamType = { | ||
| 233 | - "pageName": this.pageName, | ||
| 234 | - "pageId": this.pageId, | ||
| 235 | - } | ||
| 236 | - Tracking.event("morning_evening_news_click", params) | ||
| 237 | - | ||
| 238 | - ProcessUtils.gotoMorningEveningPaper() | ||
| 239 | - } else { | ||
| 240 | - ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | ||
| 241 | - } | ||
| 242 | - }) | ||
| 243 | - }.width('100%') | ||
| 244 | - .justifyContent(FlexAlign.SpaceBetween) | ||
| 245 | - } | ||
| 246 | - .width('100%') | ||
| 247 | - .height(40) | ||
| 248 | - .padding({ top: 10 }) | ||
| 249 | - .backgroundColor($r('app.color.white')) | ||
| 250 | - .visibility(this._currentNavIndex == 0 ? Visibility.Visible : Visibility.None) | ||
| 251 | - | ||
| 252 | - // 频道分类list | ||
| 253 | - Stack({ alignContent: Alignment.TopEnd }) { | ||
| 254 | - Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) { | ||
| 255 | - ForEach(this.currentBottomNavName === '新闻' ? this.myChannelList : this.topNavList, | ||
| 256 | - (navItem: TopNavDTO, index: number) => { | ||
| 257 | - TabContent() { | ||
| 258 | - if (this.currentBottomNavName === '人民号' && navItem.name === '关注') { | ||
| 259 | - PeopleShipMainComponent({ | ||
| 260 | - currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | ||
| 261 | - navIndex: index, | ||
| 262 | - pageId: navItem.pageId + '', | ||
| 263 | - channelId: navItem.channelId + '', | ||
| 264 | - }) | ||
| 265 | - } else | ||
| 266 | - if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { | ||
| 267 | - PageComponent({ | ||
| 268 | - currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | ||
| 269 | - navIndex: index, | ||
| 270 | - pageId: navItem.pageId + '', | ||
| 271 | - channelId: navItem.channelId + '', | ||
| 272 | - autoRefresh: this.autoRefresh2Page | ||
| 273 | - }) | ||
| 274 | - } else { | ||
| 275 | - channelSkeleton() | ||
| 276 | - } | ||
| 277 | - } | ||
| 278 | - .tabBar(this.tabBarBuilder(navItem, index)) | ||
| 279 | - | ||
| 280 | - }, (navItem: TopNavDTO) => JSON.stringify(navItem)); | ||
| 281 | - } | ||
| 282 | - .barHeight($r('app.float.top_tab_bar_height')) | ||
| 283 | - .height(this._currentNavIndex == 0 ? DisplayUtils.getDeviceHeight() - vp2px(48.3) : | ||
| 284 | - '100%') | ||
| 285 | - .barMode(BarMode.Scrollable) | ||
| 286 | - .vertical(false) | ||
| 287 | - .barBackgroundColor(this.barBackgroundColor) | ||
| 288 | - .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 289 | - let width = Number.parseFloat(newValue.width.toString()) | ||
| 290 | - this.tabsWidth = Number.isNaN(width) ? 0 : width | ||
| 291 | - }) | ||
| 292 | - .onChange((index: number) => { | ||
| 293 | - this.currentTopNavName = | ||
| 294 | - this._currentNavIndex === 0 ? this.myChannelList[index].name : this.topNavList[index].name | ||
| 295 | - Logger.info(TAG, `onChange index : ${index}`); | ||
| 296 | - if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && | ||
| 297 | - !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) | ||
| 298 | - ) { | ||
| 299 | - //在 tab 切换之前意图共享 | ||
| 300 | - // this.topNavInsightIntentShare(this.currentTopNavItem) | ||
| 301 | - | ||
| 302 | - this.currentTopNavSelectedIndex = index; | ||
| 303 | - this.currentTopNavItem = this.myChannelList[index] | ||
| 304 | - } | ||
| 305 | - if (this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) { | ||
| 306 | - // 跳转到播报页面 | ||
| 307 | - ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId) | ||
| 308 | - this.tabsController.changeIndex(this.currentTopNavSelectedIndex) | ||
| 309 | - } | ||
| 310 | - if (this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) { | ||
| 311 | - ProcessUtils.gotoENewsPaper() | ||
| 312 | - if (!this.changeByClick) { | ||
| 313 | - // 识别左滑右滑,跳过版面,到下一个 | ||
| 314 | - let nextIndex = this.currentTopNavSelectedIndex > index ? index - 1 : index + 1 | ||
| 315 | - this.tabsController.changeIndex(nextIndex) | ||
| 316 | - } else { | ||
| 317 | - this.tabsController.changeIndex(this.currentTopNavSelectedIndex) | ||
| 318 | - // 重置标识 | ||
| 319 | - this.changeByClick = false | ||
| 320 | - } | ||
| 321 | - } | ||
| 322 | - }) | ||
| 323 | - // .onAnimationStart((index: number, targetIndex: number, event: TabsAnimationEvent) => { | ||
| 324 | - // if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && | ||
| 325 | - // !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) | ||
| 326 | - // ) { | ||
| 327 | - // return | ||
| 328 | - // } | ||
| 329 | - // this.currentTopNavSelectedIndex = targetIndex | ||
| 330 | - // // 切换动画开始时触发该回调。下划线跟着页面一起滑动,同时宽度渐变。 | ||
| 331 | - // let targetIndexInfo = this.getTextInfo(targetIndex) | ||
| 332 | - // this.startAnimateTo(this.animationDuration, targetIndexInfo.left, targetIndexInfo.width) | ||
| 333 | - // }) | ||
| 334 | - // .onAnimationEnd((index: number, event: TabsAnimationEvent) => { | ||
| 335 | - // if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && | ||
| 336 | - // !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) | ||
| 337 | - // ) { | ||
| 338 | - // return | ||
| 339 | - // } | ||
| 340 | - // // 切换动画结束时触发该回调。下划线动画停止。 | ||
| 341 | - // let currentIndicatorInfo = this.getCurrentIndicatorInfo(index, event) | ||
| 342 | - // this.startAnimateTo(0, currentIndicatorInfo.left, currentIndicatorInfo.width) | ||
| 343 | - // }) | ||
| 344 | - // .onGestureSwipe((index: number, event: TabsAnimationEvent) => { | ||
| 345 | - // if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && | ||
| 346 | - // !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) | ||
| 347 | - // ) { | ||
| 348 | - // return | ||
| 349 | - // } | ||
| 350 | - // // 在页面跟手滑动过程中,逐帧触发该回调。 | ||
| 351 | - // let currentIndicatorInfo = this.getCurrentIndicatorInfo(index, event) | ||
| 352 | - // this.currentTopNavSelectedIndex = currentIndicatorInfo.index | ||
| 353 | - // this.indicatorLeftMargin = currentIndicatorInfo.left | ||
| 354 | - // this.indicatorWidth = currentIndicatorInfo.width | ||
| 355 | - // }) | ||
| 356 | - | ||
| 357 | - // 分类列表最右侧频道设置 | ||
| 358 | - if (this._currentNavIndex === 0) { | ||
| 359 | - ChannelSubscriptionLayout({ | ||
| 360 | - currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | ||
| 361 | - indexSettingChannelId: this.indexSettingChannelId, | ||
| 362 | - homeChannelList: this.homeChannelList, | ||
| 363 | - myChannelList: $myChannelList, | ||
| 364 | - moreChannelList: $moreChannelList, | ||
| 365 | - localChannelList: $localChannelList, | ||
| 366 | - channelIds: $channelIds, | ||
| 367 | - changeTab: (index) => { | ||
| 368 | - this.tabsController.changeIndex(index) | ||
| 369 | - } | ||
| 370 | - }) | ||
| 371 | - } else { | ||
| 372 | - Row() { | ||
| 373 | - Image($r('app.media.icon_search')) | ||
| 374 | - .width('24vp') | ||
| 375 | - .height('24vp') | ||
| 376 | - } | ||
| 377 | - .height('40vp') | ||
| 378 | - .width('40vp') | ||
| 379 | - .margin({ right: 10 }) | ||
| 380 | - .alignItems(VerticalAlign.Center) | ||
| 381 | - .justifyContent(FlexAlign.Center) | ||
| 382 | - .onClick(() => { | ||
| 383 | - WDRouterRule.jumpWithPage(WDRouterPage.searchPage) | ||
| 384 | - }) | ||
| 385 | - } | ||
| 386 | - } | ||
| 387 | - } | ||
| 388 | - } | ||
| 389 | - | ||
| 390 | - @Builder | ||
| 391 | - tabBarBuilder(item: TopNavDTO, index: number) { | ||
| 392 | - Column() { | ||
| 393 | - Text(item?.name) | ||
| 394 | - .fontSize($r('app.float.selected_text_size')) | ||
| 395 | - .fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal) | ||
| 396 | - .fontColor(this.currentTopNavSelectedIndex === index ? Color.Black : "#999999") | ||
| 397 | - .padding({ top: $r('app.float.top_tab_item_padding_top'), bottom: $r('app.float.top_tab_item_padding_bottom') }) | ||
| 398 | - .maxLines(this.MAX_LINE) | ||
| 399 | - .id(index.toString()) | ||
| 400 | - .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 401 | - if (this.currentTopNavSelectedIndex === index && | ||
| 402 | - (this.indicatorLeftMargin === 0 || this.indicatorWidth === 0)) { | ||
| 403 | - if (newValue.position.x != undefined) { | ||
| 404 | - let positionX = Number.parseFloat(newValue.position.x.toString()) | ||
| 405 | - this.indicatorLeftMargin = Number.isNaN(positionX) ? 0 : positionX | ||
| 406 | - } | ||
| 407 | - let width = Number.parseFloat(newValue.width.toString()) | ||
| 408 | - this.indicatorWidth = Number.isNaN(width) ? 0 : width | ||
| 409 | - } | ||
| 410 | - }) | ||
| 411 | - // .backgroundImage(this.currentTopNavSelectedIndex === index ? item.iconCUrl : item.iconUrl) | ||
| 412 | - if (this.currentTopNavSelectedIndex === index) { | ||
| 413 | - Row() | ||
| 414 | - .width(20) | ||
| 415 | - .height(3) | ||
| 416 | - .backgroundImage($r('app.media.icon_channel_active'), ImageRepeat.NoRepeat) | ||
| 417 | - .backgroundImageSize(ImageSize.Contain) | ||
| 418 | - } | ||
| 419 | - } | ||
| 420 | - .hoverEffect(HoverEffect.Highlight) | ||
| 421 | - .constraintSize({ | ||
| 422 | - minWidth: $r('app.float.top_tab_item_min_width'), | ||
| 423 | - maxWidth: $r('app.float.top_tab_item_max_width') | ||
| 424 | - }) | ||
| 425 | - // .backgroundColor(Color.Transparent) | ||
| 426 | - .padding({ | ||
| 427 | - left: $r('app.float.top_tab_item_padding_horizontal'), | ||
| 428 | - right: $r('app.float.top_tab_item_padding_horizontal'), | ||
| 429 | - }) | ||
| 430 | - .id(`col_tabBar${index}`) | ||
| 431 | - .margin({ right: this.myChannelList.length === index + 1 ? 36 : 0 }) | ||
| 432 | - .onClick(() => { | ||
| 433 | - Logger.debug(TAG, `onClick, index: ${index}`); | ||
| 434 | - if (this.currentTopNavSelectedIndex === index) { | ||
| 435 | - // 当前tab,单击事件 | ||
| 436 | - this.doAutoRefresh() | ||
| 437 | - } else { | ||
| 438 | - this.changeByClick = true | ||
| 439 | - this.tabsController.changeIndex(index) | ||
| 440 | - } | ||
| 441 | - | ||
| 442 | - }) | ||
| 443 | - } | ||
| 444 | - | ||
| 445 | - | ||
| 446 | - aboutToAppear() { | ||
| 447 | - //处理新闻tab顶导频道数据 | ||
| 448 | - this.topNavListHandle() | ||
| 449 | - } | ||
| 450 | - | ||
| 451 | - aboutToDisappear() { | ||
| 452 | - AppStorage.set('channelIds', this.channelIds.join(',')) | ||
| 453 | - } | ||
| 454 | - | ||
| 455 | - onTopNavigationDataUpdated() { | ||
| 456 | - Logger.info(TAG, | ||
| 457 | - `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`); | ||
| 458 | - } | ||
| 459 | - | ||
| 460 | - onAutoRefresh() { | ||
| 461 | - if (this.navIndex != this._currentNavIndex) { | ||
| 462 | - return | ||
| 463 | - } | ||
| 464 | - // 通知page刷新 | ||
| 465 | - this.autoRefresh2Page++ | ||
| 466 | - } | ||
| 467 | - | ||
| 468 | - private doAutoRefresh() { | ||
| 469 | - // 通知page刷新 | ||
| 470 | - this.autoRefresh2Page++ | ||
| 471 | - } | ||
| 472 | - | ||
| 473 | - /** | ||
| 474 | - * 判断是否当前页面处理逻辑,如消息通知,只需要切换到当前底导的处理,过滤掉非当前。 | ||
| 475 | - */ | ||
| 476 | - private isCurrentPage(): boolean { | ||
| 477 | - return this._currentNavIndex === this.navIndex | ||
| 478 | - } | ||
| 479 | - | ||
| 480 | - /** | ||
| 481 | - * 频道id变化,即指定频道跳转场景 | ||
| 482 | - */ | ||
| 483 | - onAssignChannelChange() { | ||
| 484 | - if (!this.isCurrentPage()) { | ||
| 485 | - return | ||
| 486 | - } | ||
| 487 | - let channelId = this.assignChannel.channelId | ||
| 488 | - let index = -1 | ||
| 489 | - if (this._currentNavIndex === 0) { | ||
| 490 | - // 第一个,新闻,先拿我的,再拿其他 | ||
| 491 | - index = this.getChannelByMine(channelId) | ||
| 492 | - if (index == -1) { | ||
| 493 | - // 不在我的里,需要临时新增频道展示 | ||
| 494 | - let channel = this.getChannelByOthers(channelId) | ||
| 495 | - if (channel) { | ||
| 496 | - this.myChannelList.push(channel) | ||
| 497 | - setTimeout(() => { | ||
| 498 | - this.tabsController.changeIndex(this.myChannelList.length - 1) | ||
| 499 | - }, 20) | ||
| 500 | - } | ||
| 501 | - } else { | ||
| 502 | - // 直接切换 | ||
| 503 | - this.tabsController.changeIndex(index) | ||
| 504 | - } | ||
| 505 | - } else { | ||
| 506 | - index = this.getChannelByTopNav(channelId) | ||
| 507 | - if (index > -1) { | ||
| 508 | - // 找到了,直接切换,否则不处理 | ||
| 509 | - this.tabsController.changeIndex(index) | ||
| 510 | - } | ||
| 511 | - } | ||
| 512 | - | ||
| 513 | - } | ||
| 514 | - | ||
| 515 | - /** | ||
| 516 | - * 非新闻,从topNav里拿数据 | ||
| 517 | - */ | ||
| 518 | - private getChannelByTopNav(channelId: string) { | ||
| 519 | - for (let i = 0; i < this.topNavList.length; i++) { | ||
| 520 | - let topNavDTO: TopNavDTO = this.topNavList[i] | ||
| 521 | - if (topNavDTO.channelId.toString() === channelId) { | ||
| 522 | - return i | ||
| 523 | - } | ||
| 524 | - } | ||
| 525 | - return -1 | ||
| 526 | - } | ||
| 527 | - | ||
| 528 | - /** | ||
| 529 | - * 新闻,从myChannelList里拿数据 | ||
| 530 | - */ | ||
| 531 | - private getChannelByMine(channelId: string) { | ||
| 532 | - for (let i = 0; i < this.myChannelList.length; i++) { | ||
| 533 | - let topNavDTO: TopNavDTO = this.myChannelList[i] | ||
| 534 | - if (topNavDTO.channelId.toString() === channelId) { | ||
| 535 | - return i | ||
| 536 | - } | ||
| 537 | - } | ||
| 538 | - return -1 | ||
| 539 | - } | ||
| 540 | - | ||
| 541 | - /** | ||
| 542 | - * 新闻,从其他里拿数据 | ||
| 543 | - */ | ||
| 544 | - private getChannelByOthers(channelId: string) { | ||
| 545 | - for (let i = 0; i < this.moreChannelList.length; i++) { | ||
| 546 | - let topNavDTO: TopNavDTO = this.moreChannelList[i] | ||
| 547 | - if (topNavDTO.channelId.toString() === channelId) { | ||
| 548 | - return topNavDTO | ||
| 549 | - } | ||
| 550 | - } | ||
| 551 | - for (let j = 0; j < this.localChannelList.length; j++) { | ||
| 552 | - let topNavDTO: TopNavDTO = this.localChannelList[j] | ||
| 553 | - if (topNavDTO.channelId.toString() === channelId) { | ||
| 554 | - return topNavDTO | ||
| 555 | - } | ||
| 556 | - } | ||
| 557 | - return null | ||
| 558 | - } | ||
| 559 | - | ||
| 560 | - // private getTextInfo(index: number): Record<string, number> { | ||
| 561 | - // let strJson = getInspectorByKey(index.toString()) | ||
| 562 | - // try { | ||
| 563 | - // let obj: Record<string, string> = JSON.parse(strJson) | ||
| 564 | - // let rectInfo: number[][] = JSON.parse('[' + obj.$rect + ']') | ||
| 565 | - // return { 'left': px2vp(rectInfo[0][0]), 'width': px2vp(rectInfo[1][0] - rectInfo[0][0]) } | ||
| 566 | - // } catch (error) { | ||
| 567 | - // return { 'left': 0, 'width': 0 } | ||
| 568 | - // } | ||
| 569 | - // } | ||
| 570 | - // | ||
| 571 | - // private getCurrentIndicatorInfo(index: number, event: TabsAnimationEvent): Record<string, number> { | ||
| 572 | - // let nextIndex = index | ||
| 573 | - // if (index > 0 && event.currentOffset > 0) { | ||
| 574 | - // nextIndex-- | ||
| 575 | - // } else if (index < 3 && event.currentOffset < 0) { | ||
| 576 | - // nextIndex++ | ||
| 577 | - // } | ||
| 578 | - // let indexInfo = this.getTextInfo(index) | ||
| 579 | - // let nextIndexInfo = this.getTextInfo(nextIndex) | ||
| 580 | - // let swipeRatio = Math.abs(event.currentOffset / this.tabsWidth) | ||
| 581 | - // let currentIndex = swipeRatio > 0.5 ? nextIndex : index // 页面滑动超过一半,tabBar切换到下一页。 | ||
| 582 | - // let currentLeft = indexInfo.left + (nextIndexInfo.left - indexInfo.left) * swipeRatio | ||
| 583 | - // let currentWidth = indexInfo.width + (nextIndexInfo.width - indexInfo.width) * swipeRatio | ||
| 584 | - // return { 'index': currentIndex, 'left': currentLeft, 'width': currentWidth } | ||
| 585 | - // } | ||
| 586 | - | ||
| 587 | - // private startAnimateTo(duration: number, leftMargin: number, width: number) { | ||
| 588 | - // animateTo({ | ||
| 589 | - // duration: duration, // 动画时长 | ||
| 590 | - // curve: Curve.Linear, // 动画曲线 | ||
| 591 | - // iterations: 1, // 播放次数 | ||
| 592 | - // playMode: PlayMode.Normal, // 动画模式 | ||
| 593 | - // onFinish: () => { | ||
| 594 | - // console.info('play end') | ||
| 595 | - // } | ||
| 596 | - // }, () => { | ||
| 597 | - // this.indicatorLeftMargin = leftMargin | ||
| 598 | - // this.indicatorWidth = width | ||
| 599 | - // }) | ||
| 600 | - // } | ||
| 601 | -} |
| 1 | import { Action, CompDTO, ContentDTO, Params } from 'wdBean' | 1 | import { Action, CompDTO, ContentDTO, Params } from 'wdBean' |
| 2 | -import { WDRouterRule } from 'wdRouter/Index' | 2 | +import { ProcessUtils, WDRouterRule } from 'wdRouter/Index' |
| 3 | import { Logger } from 'wdKit/Index' | 3 | import { Logger } from 'wdKit/Index' |
| 4 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' | 4 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' |
| 5 | import { LiveModel } from '../../viewmodel/LiveModel' | 5 | import { LiveModel } from '../../viewmodel/LiveModel' |
| @@ -69,24 +69,9 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | @@ -69,24 +69,9 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | ||
| 69 | .onClick(() => { | 69 | .onClick(() => { |
| 70 | InfomationCardClick.track(this.compDTO, this.compDTO.operDataList[0], this.pageId, this.pageName) | 70 | InfomationCardClick.track(this.compDTO, this.compDTO.operDataList[0], this.pageId, this.pageName) |
| 71 | this.clicked = true; | 71 | this.clicked = true; |
| 72 | - this.gotoLive(this.compDTO?.operDataList[0]) | 72 | + ProcessUtils.gotoLive(this.compDTO?.operDataList[0]) |
| 73 | }) | 73 | }) |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | - async gotoLive(content: ContentDTO) { | ||
| 77 | 76 | ||
| 78 | - let taskAction: Action = { | ||
| 79 | - type: 'JUMP_DETAIL_PAGE', | ||
| 80 | - params: { | ||
| 81 | - detailPageType: 2, | ||
| 82 | - contentID: content?.objectId, | ||
| 83 | - extra: { | ||
| 84 | - relType: content?.relType, | ||
| 85 | - relId: content?.relId, | ||
| 86 | - } as ExtraDTO | ||
| 87 | - } as Params, | ||
| 88 | - }; | ||
| 89 | - WDRouterRule.jumpWithAction(taskAction) | ||
| 90 | - // Logger.debug(TAG, `gotoLive, ${content.objectId}`); | ||
| 91 | - } | ||
| 92 | } | 77 | } |
| @@ -5,7 +5,7 @@ import { CommonConstants } from 'wdConstant' | @@ -5,7 +5,7 @@ import { CommonConstants } from 'wdConstant' | ||
| 5 | import { StringUtils } from 'wdKit/Index' | 5 | import { StringUtils } from 'wdKit/Index' |
| 6 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 6 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 7 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' | 7 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' |
| 8 | -import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | 8 | +import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index' |
| 9 | 9 | ||
| 10 | @Component | 10 | @Component |
| 11 | export struct LiveHorizontalReservationComponent { | 11 | export struct LiveHorizontalReservationComponent { |
| @@ -76,7 +76,7 @@ export struct LiveHorizontalReservationComponent { | @@ -76,7 +76,7 @@ export struct LiveHorizontalReservationComponent { | ||
| 76 | .onClick(() => { | 76 | .onClick(() => { |
| 77 | if (item.objectType != '0') { | 77 | if (item.objectType != '0') { |
| 78 | console.log(item.objectId) | 78 | console.log(item.objectId) |
| 79 | - this.gotoLive(item) | 79 | + ProcessUtils.gotoLive(item) |
| 80 | } | 80 | } |
| 81 | }) | 81 | }) |
| 82 | }) | 82 | }) |
| @@ -107,20 +107,5 @@ export struct LiveHorizontalReservationComponent { | @@ -107,20 +107,5 @@ export struct LiveHorizontalReservationComponent { | ||
| 107 | WDRouterRule.jumpWithPage(WDRouterPage.reserveMorePage) | 107 | WDRouterRule.jumpWithPage(WDRouterPage.reserveMorePage) |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | - async gotoLive(content: ContentDTO) { | ||
| 111 | 110 | ||
| 112 | - let taskAction: Action = { | ||
| 113 | - type: 'JUMP_DETAIL_PAGE', | ||
| 114 | - params: { | ||
| 115 | - detailPageType: 2, | ||
| 116 | - contentID: content?.objectId, | ||
| 117 | - extra: { | ||
| 118 | - relType: content?.relType, | ||
| 119 | - relId: content?.relId, | ||
| 120 | - } as ExtraDTO | ||
| 121 | - } as Params, | ||
| 122 | - }; | ||
| 123 | - WDRouterRule.jumpWithAction(taskAction) | ||
| 124 | - // Logger.debug(TAG, `gotoLive, ${content.objectId}`); | ||
| 125 | - } | ||
| 126 | } | 111 | } |
No preview for this file type
No preview for this file type
| @@ -6,6 +6,7 @@ import { DetailPlayLivePage } from './DetailPlayLivePage'; | @@ -6,6 +6,7 @@ import { DetailPlayLivePage } from './DetailPlayLivePage'; | ||
| 6 | import { DetailPlayVLivePage } from './DetailPlayVLivePage'; | 6 | import { DetailPlayVLivePage } from './DetailPlayVLivePage'; |
| 7 | import { Logger, ToastUtils } from 'wdKit/Index'; | 7 | import { Logger, ToastUtils } from 'wdKit/Index'; |
| 8 | import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'; | 8 | import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'; |
| 9 | +import { PictureLoading } from '../widgets/vertical/PictureLoading'; | ||
| 9 | 10 | ||
| 10 | const TAG = 'DetailPlayLiveCommon' | 11 | const TAG = 'DetailPlayLiveCommon' |
| 11 | 12 | ||
| @@ -36,6 +37,8 @@ export struct DetailPlayLiveCommon { | @@ -36,6 +37,8 @@ export struct DetailPlayLiveCommon { | ||
| 36 | // 横屏或竖屏 general-竖屏,news-横屏 | 37 | // 横屏或竖屏 general-竖屏,news-横屏 |
| 37 | @State liveLandscape: string = '' | 38 | @State liveLandscape: string = '' |
| 38 | 39 | ||
| 40 | + @State isLoading: boolean = false | ||
| 41 | + | ||
| 39 | async aboutToAppear(): Promise<void> { | 42 | async aboutToAppear(): Promise<void> { |
| 40 | const par: Action = router.getParams() as Action; | 43 | const par: Action = router.getParams() as Action; |
| 41 | const params = par?.params; | 44 | const params = par?.params; |
| @@ -55,6 +58,8 @@ export struct DetailPlayLiveCommon { | @@ -55,6 +58,8 @@ export struct DetailPlayLiveCommon { | ||
| 55 | } else if (this.liveLandscape === 'general') { | 58 | } else if (this.liveLandscape === 'general') { |
| 56 | // 沉浸式直播 | 59 | // 沉浸式直播 |
| 57 | DetailPlayVLivePage() | 60 | DetailPlayVLivePage() |
| 61 | + }else { | ||
| 62 | + PictureLoading().visibility(this.isLoading ? Visibility.None : Visibility.Visible) | ||
| 58 | } | 63 | } |
| 59 | } | 64 | } |
| 60 | .height('100%') | 65 | .height('100%') |
| @@ -117,10 +122,12 @@ export struct DetailPlayLiveCommon { | @@ -117,10 +122,12 @@ export struct DetailPlayLiveCommon { | ||
| 117 | 122 | ||
| 118 | 123 | ||
| 119 | } else { | 124 | } else { |
| 125 | + this.isLoading | ||
| 120 | ToastUtils.shortToast('内容不存在') | 126 | ToastUtils.shortToast('内容不存在') |
| 121 | router.back() | 127 | router.back() |
| 122 | } | 128 | } |
| 123 | },()=>{ | 129 | },()=>{ |
| 130 | + this.isLoading | ||
| 124 | ToastUtils.shortToast('内容不存在') | 131 | ToastUtils.shortToast('内容不存在') |
| 125 | router.back() | 132 | router.back() |
| 126 | 133 |
| @@ -10,6 +10,7 @@ import { SpConstants } from 'wdConstant/Index'; | @@ -10,6 +10,7 @@ import { SpConstants } from 'wdConstant/Index'; | ||
| 10 | const TAG = 'LiveModel' | 10 | const TAG = 'LiveModel' |
| 11 | 11 | ||
| 12 | export class LiveModel { | 12 | export class LiveModel { |
| 13 | + | ||
| 13 | getContentDetail(contentId: string, relId: string, relType: string) { | 14 | getContentDetail(contentId: string, relId: string, relType: string) { |
| 14 | return new Promise<Array<ContentDetailDTO>>((success, fail) => { | 15 | return new Promise<Array<ContentDetailDTO>>((success, fail) => { |
| 15 | ContentDetailRequest.getContentDetail({ | 16 | ContentDetailRequest.getContentDetail({ |
| @@ -19,9 +20,14 @@ export class LiveModel { | @@ -19,9 +20,14 @@ export class LiveModel { | ||
| 19 | }).then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => { | 20 | }).then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => { |
| 20 | console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data)) | 21 | console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data)) |
| 21 | if (resDTO.data) { | 22 | if (resDTO.data) { |
| 23 | + //console.error("XXXXZZZZ", '---getContentDetail-0---1------------') | ||
| 22 | success(resDTO.data) | 24 | success(resDTO.data) |
| 25 | + }else { | ||
| 26 | + // console.error("XXXXZZZZ", '---getContentDetail-0--2----1--------') | ||
| 27 | + fail("数据为空") | ||
| 23 | } | 28 | } |
| 24 | }).catch(() => { | 29 | }).catch(() => { |
| 30 | + // console.error("XXXXZZZZ", '---getContentDetail-0--2----2--------') | ||
| 25 | fail("数据为空") | 31 | fail("数据为空") |
| 26 | }) | 32 | }) |
| 27 | 33 |
| @@ -22,8 +22,10 @@ export class LiveViewModel { | @@ -22,8 +22,10 @@ export class LiveViewModel { | ||
| 22 | getContentDetail(contentId: string, relId: string, relType: string) { | 22 | getContentDetail(contentId: string, relId: string, relType: string) { |
| 23 | return new Promise<Array<ContentDetailDTO>>((success, fail) => { | 23 | return new Promise<Array<ContentDetailDTO>>((success, fail) => { |
| 24 | this.liveModel.getContentDetail(contentId, relId, relType).then((data) => { | 24 | this.liveModel.getContentDetail(contentId, relId, relType).then((data) => { |
| 25 | + //console.error("XXXXZZZZ", '---getContentDetail---1------------') | ||
| 25 | success(data) | 26 | success(data) |
| 26 | }).catch((message: string) => { | 27 | }).catch((message: string) => { |
| 28 | + // console.error("XXXXZZZZ", '----getContentDetail--2------------') | ||
| 27 | fail(message) | 29 | fail(message) |
| 28 | }) | 30 | }) |
| 29 | }) | 31 | }) |
| @@ -12,56 +12,33 @@ export struct TabComponent { | @@ -12,56 +12,33 @@ export struct TabComponent { | ||
| 12 | @State fontColor: string = '#999999' | 12 | @State fontColor: string = '#999999' |
| 13 | @State selectedFontColor: string = '#222222' | 13 | @State selectedFontColor: string = '#222222' |
| 14 | @State currentIndex: number = 0 | 14 | @State currentIndex: number = 0 |
| 15 | - private controller: TabsController = new TabsController() | 15 | + // private controller: TabsController = new TabsController() |
| 16 | + private swiperController: SwiperController = new SwiperController() | ||
| 16 | @Prop tabs: string[] = [] | 17 | @Prop tabs: string[] = [] |
| 17 | - @Prop lastInputedLiveComment: LiveRoomItemBean // 上次输入的直播间消息 | ||
| 18 | - @Prop lastInputedChatComment: LiveRoomItemBean // 上次输入的大家聊消息 | 18 | + @Prop lastInputedLiveComment: LiveRoomItemBean // 上次输入的直播间消息 |
| 19 | + @Prop lastInputedChatComment: LiveRoomItemBean // 上次输入的大家聊消息 | ||
| 19 | 20 | ||
| 20 | aboutToAppear(): void { | 21 | aboutToAppear(): void { |
| 21 | 22 | ||
| 22 | } | 23 | } |
| 24 | + | ||
| 23 | /** | 25 | /** |
| 24 | * 评论切换到大家聊 | 26 | * 评论切换到大家聊 |
| 25 | */ | 27 | */ |
| 26 | changeToChart() { | 28 | changeToChart() { |
| 27 | const index = this.tabs.findIndex(item => item === '大家聊') | 29 | const index = this.tabs.findIndex(item => item === '大家聊') |
| 28 | if (index !== -1) { | 30 | if (index !== -1) { |
| 29 | - this.controller.changeIndex(index) | 31 | + this.swiperController.changeIndex(index) |
| 30 | } | 32 | } |
| 31 | } | 33 | } |
| 32 | 34 | ||
| 33 | build() { | 35 | build() { |
| 34 | - Stack({alignContent: Alignment.TopStart}) { | ||
| 35 | - Tabs({ barPosition: BarPosition.Start, index: this.currentIndex, controller: this.controller }) { | ||
| 36 | - ForEach(this.tabs, (item: string, index: number) => { | ||
| 37 | - TabContent() { | ||
| 38 | - if ('简介' === item) { | ||
| 39 | - TabInfoComponent() | ||
| 40 | - } else if ('直播间' === item) { | ||
| 41 | - TabLiveComponent({lastInputedComment: this.lastInputedLiveComment}) | ||
| 42 | - } else if ('大家聊' === item) { | ||
| 43 | - TabChatComponent({lastInputedComment: this.lastInputedChatComment}) | ||
| 44 | - } | ||
| 45 | - } | ||
| 46 | - .backgroundColor('#F5F5F5') | ||
| 47 | - }, (item: string, index: number) => { | ||
| 48 | - return item + index | ||
| 49 | - }) | ||
| 50 | - } | ||
| 51 | - .layoutWeight(1) | ||
| 52 | - .vertical(false) | ||
| 53 | - .barMode(BarMode.Fixed) | ||
| 54 | - .barHeight(48) | ||
| 55 | - .animationDuration(100) | ||
| 56 | - .onChange((index: number) => { | ||
| 57 | - this.currentIndex = index | ||
| 58 | - }) | ||
| 59 | - .backgroundColor(Color.White) | 36 | + Column() { |
| 60 | 37 | ||
| 61 | // 页签 | 38 | // 页签 |
| 62 | Row() { | 39 | Row() { |
| 63 | Scroll() { | 40 | Scroll() { |
| 64 | - Row({space: '24vp'}) { | 41 | + Row({ space: '24vp' }) { |
| 65 | ForEach(this.tabs, (item: string, index: number) => { | 42 | ForEach(this.tabs, (item: string, index: number) => { |
| 66 | this.tabBuilder(index, item) | 43 | this.tabBuilder(index, item) |
| 67 | }) | 44 | }) |
| @@ -79,8 +56,33 @@ export struct TabComponent { | @@ -79,8 +56,33 @@ export struct TabComponent { | ||
| 79 | .height('48vp') | 56 | .height('48vp') |
| 80 | .alignItems(VerticalAlign.Bottom) | 57 | .alignItems(VerticalAlign.Bottom) |
| 81 | .width('100%') | 58 | .width('100%') |
| 82 | - }.layoutWeight(1) | ||
| 83 | 59 | ||
| 60 | + Swiper(this.swiperController) { | ||
| 61 | + ForEach(this.tabs, (item: string, index: number) => { | ||
| 62 | + if ('简介' === item) { | ||
| 63 | + TabInfoComponent().backgroundColor('#F5F5F5') | ||
| 64 | + } else if ('直播间' === item) { | ||
| 65 | + TabLiveComponent({ lastInputedComment: this.lastInputedLiveComment }).backgroundColor('#F5F5F5') | ||
| 66 | + } else if ('大家聊' === item) { | ||
| 67 | + TabChatComponent({ lastInputedComment: this.lastInputedChatComment }).backgroundColor('#F5F5F5') | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + }, (item: string, index: number) => { | ||
| 71 | + return item + index | ||
| 72 | + }) | ||
| 73 | + } | ||
| 74 | + .layoutWeight(1) | ||
| 75 | + .vertical(false) | ||
| 76 | + .indicator(false) | ||
| 77 | + .loop(false) | ||
| 78 | + .alignSelf(ItemAlign.Start) | ||
| 79 | + .effectMode(EdgeEffect.None) | ||
| 80 | + .onChange((index: number) => { | ||
| 81 | + this.currentIndex = index | ||
| 82 | + }) | ||
| 83 | + .backgroundColor(Color.White) | ||
| 84 | + | ||
| 85 | + }.layoutWeight(1) | ||
| 84 | 86 | ||
| 85 | } | 87 | } |
| 86 | 88 | ||
| @@ -102,7 +104,7 @@ export struct TabComponent { | @@ -102,7 +104,7 @@ export struct TabComponent { | ||
| 102 | .constraintSize({ minWidth: 35 }) | 104 | .constraintSize({ minWidth: 35 }) |
| 103 | .height('48vp') | 105 | .height('48vp') |
| 104 | .onClick(() => { | 106 | .onClick(() => { |
| 105 | - this.controller.changeIndex(index) | 107 | + this.swiperController.changeIndex(index) |
| 106 | this.currentIndex = index | 108 | this.currentIndex = index |
| 107 | }) | 109 | }) |
| 108 | } | 110 | } |
| @@ -76,7 +76,6 @@ export struct PlayerComponent { | @@ -76,7 +76,6 @@ export struct PlayerComponent { | ||
| 76 | playerController: this.playerController, | 76 | playerController: this.playerController, |
| 77 | onLoad: () => { | 77 | onLoad: () => { |
| 78 | this.isCanplay = true | 78 | this.isCanplay = true |
| 79 | - console.error("XXXXZZZZ", '------2------------') | ||
| 80 | this.playerController?.firstPlay(this.playUrl); | 79 | this.playerController?.firstPlay(this.playUrl); |
| 81 | } | 80 | } |
| 82 | }) | 81 | }) |
| @@ -85,7 +84,6 @@ export struct PlayerComponent { | @@ -85,7 +84,6 @@ export struct PlayerComponent { | ||
| 85 | playerController: this.playerController, | 84 | playerController: this.playerController, |
| 86 | onLoad: () => { | 85 | onLoad: () => { |
| 87 | this.isCanplay = true | 86 | this.isCanplay = true |
| 88 | - console.error('XXXXZZZZ', '------1------------') | ||
| 89 | this.playerController?.firstPlay(this.playUrl); | 87 | this.playerController?.firstPlay(this.playUrl); |
| 90 | } | 88 | } |
| 91 | }).margin({ top: 195 }).height(211) | 89 | }).margin({ top: 195 }).height(211) |
| @@ -292,12 +292,15 @@ export struct DetailPlayShortVideoPage { | @@ -292,12 +292,15 @@ export struct DetailPlayShortVideoPage { | ||
| 292 | playerCoverBuilder() { | 292 | playerCoverBuilder() { |
| 293 | // 问题:画面会闪一下 | 293 | // 问题:画面会闪一下 |
| 294 | Image(this.contentDetailData?.firstFrameImageUri) | 294 | Image(this.contentDetailData?.firstFrameImageUri) |
| 295 | - .width('100%') | ||
| 296 | - .height(this.windowWidth / this.ratio + 'px') | ||
| 297 | - .opacity(this.imageVisible ? 0.8 : 0) | ||
| 298 | - .animation({ | ||
| 299 | - duration: 350, curve: Curve.EaseInOut | ||
| 300 | - }) | 295 | + .width(this.playerWidth) |
| 296 | + .height(this.playerHeight)// .opacity(this.imageVisible ? 0.7 : 0) | ||
| 297 | + // .animation({ | ||
| 298 | + // // duration: 350, | ||
| 299 | + // curve: Curve.EaseInOut, | ||
| 300 | + // expectedFrameRateRange: { min: 30, max: 120, expected: 60 } | ||
| 301 | + // }) | ||
| 302 | + .visibility(this.imageVisible ? Visibility.Visible : Visibility.None) | ||
| 303 | + | ||
| 301 | } | 304 | } |
| 302 | 305 | ||
| 303 | @Builder | 306 | @Builder |
| @@ -4,7 +4,7 @@ import { EmitterEventId, EmitterUtils, Logger, StringUtils } from 'wdKit'; | @@ -4,7 +4,7 @@ import { EmitterEventId, EmitterUtils, Logger, StringUtils } from 'wdKit'; | ||
| 4 | import { HttpUtils } from 'wdNetwork/Index'; | 4 | import { HttpUtils } from 'wdNetwork/Index'; |
| 5 | import HomeChannelUtils, { AssignChannelParam } from 'wdRouter/Index'; | 5 | import HomeChannelUtils, { AssignChannelParam } from 'wdRouter/Index'; |
| 6 | import { MinePageComponent } from 'wdComponent/src/main/ets/components/page/MinePageComponent'; | 6 | import { MinePageComponent } from 'wdComponent/src/main/ets/components/page/MinePageComponent'; |
| 7 | -import { CompUtils, TopNavigationComponent, TopNavigationComponentNew } from 'wdComponent/Index'; | 7 | +import { CompUtils, TopNavigationComponentNew } from 'wdComponent/Index'; |
| 8 | import { VideoChannelPage } from './VideoChannelPage'; | 8 | import { VideoChannelPage } from './VideoChannelPage'; |
| 9 | import ChannelViewModel from 'wdComponent/src/main/ets/viewmodel/ChannelViewModel'; | 9 | import ChannelViewModel from 'wdComponent/src/main/ets/viewmodel/ChannelViewModel'; |
| 10 | import { ALL, ImageKnifeComponent, ImageKnifeOption, NONE } from '@ohos/imageknife'; | 10 | import { ALL, ImageKnifeComponent, ImageKnifeOption, NONE } from '@ohos/imageknife'; |
| @@ -22,7 +22,6 @@ let storage = LocalStorage.getShared(); | @@ -22,7 +22,6 @@ let storage = LocalStorage.getShared(); | ||
| 22 | @Entry(storage) | 22 | @Entry(storage) |
| 23 | @Component | 23 | @Component |
| 24 | export struct BottomNavigationComponent { | 24 | export struct BottomNavigationComponent { |
| 25 | - private isNewTopPage = true // TODO 顶导重构页面开关,false,则用原来的顶导 | ||
| 26 | @Provide bottomRectHeight: number = 0 | 25 | @Provide bottomRectHeight: number = 0 |
| 27 | @Provide topRectHeight: number = 0 | 26 | @Provide topRectHeight: number = 0 |
| 28 | @Provide isLayoutFullScreen: boolean = false | 27 | @Provide isLayoutFullScreen: boolean = false |
| @@ -88,32 +87,15 @@ export struct BottomNavigationComponent { | @@ -88,32 +87,15 @@ export struct BottomNavigationComponent { | ||
| 88 | autoRefresh: this.autoRefresh | 87 | autoRefresh: this.autoRefresh |
| 89 | }) | 88 | }) |
| 90 | } else { | 89 | } else { |
| 91 | - if (this.isNewTopPage) { | ||
| 92 | - TopNavigationComponentNew({ | ||
| 93 | - groupId: navItem.id, | ||
| 94 | - pageId: navItem.id, | ||
| 95 | - topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), | ||
| 96 | - _currentNavIndex: $currentNavIndex, | ||
| 97 | - bottomNavIndex: index, | ||
| 98 | - currentBottomNavName: navItem.name, | ||
| 99 | - pageName: navItem.pageName, | ||
| 100 | - assignChannel: this.assignChannel, | ||
| 101 | - autoRefresh: this.autoRefresh | ||
| 102 | - }) | ||
| 103 | - } else { | ||
| 104 | - TopNavigationComponent({ | ||
| 105 | - groupId: navItem.id, | ||
| 106 | - topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), | ||
| 107 | - _currentNavIndex: $currentNavIndex, | ||
| 108 | - pageName: navItem.pageName, | ||
| 109 | - pageId: navItem.id, | ||
| 110 | - navIndex: index, | ||
| 111 | - currentBottomNavName: navItem.name, | ||
| 112 | - assignChannel: this.assignChannel, | ||
| 113 | - autoRefresh: this.autoRefresh | ||
| 114 | - }) | ||
| 115 | - } | ||
| 116 | - | 90 | + TopNavigationComponentNew({ |
| 91 | + groupId: navItem.id, | ||
| 92 | + topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), | ||
| 93 | + _currentNavIndex: $currentNavIndex, | ||
| 94 | + bottomNavIndex: index, | ||
| 95 | + currentBottomNavName: navItem.name, | ||
| 96 | + assignChannel: this.assignChannel, | ||
| 97 | + autoRefresh: this.autoRefresh | ||
| 98 | + }) | ||
| 117 | } | 99 | } |
| 118 | } | 100 | } |
| 119 | .tabBar(this.tabBarBuilder(navItem, index)) | 101 | .tabBar(this.tabBarBuilder(navItem, index)) |
| @@ -30,7 +30,6 @@ export struct VideoChannelPage { | @@ -30,7 +30,6 @@ export struct VideoChannelPage { | ||
| 30 | @State indicatorWidth: number = 0 | 30 | @State indicatorWidth: number = 0 |
| 31 | // 传递给page的自动刷新通知 | 31 | // 传递给page的自动刷新通知 |
| 32 | @State autoRefresh2Page: number = 0 | 32 | @State autoRefresh2Page: number = 0 |
| 33 | - | ||
| 34 | aboutToAppear(): void { | 33 | aboutToAppear(): void { |
| 35 | this.setBarBackgroundColor() | 34 | this.setBarBackgroundColor() |
| 36 | console.log(TAG, 'aboutToAppear') | 35 | console.log(TAG, 'aboutToAppear') |
| @@ -131,14 +130,14 @@ export struct VideoChannelPage { | @@ -131,14 +130,14 @@ export struct VideoChannelPage { | ||
| 131 | .onClick(() => { | 130 | .onClick(() => { |
| 132 | TrackingButton.searchClick(TrackConstants.PageName.Search, "VIDEOS") | 131 | TrackingButton.searchClick(TrackConstants.PageName.Search, "VIDEOS") |
| 133 | let params = { 'tabName': "VIDEOS" } as Record<string, string> | 132 | let params = { 'tabName': "VIDEOS" } as Record<string, string> |
| 134 | - WDRouterRule.jumpWithPage(WDRouterPage.searchPage,params) | 133 | + WDRouterRule.jumpWithPage(WDRouterPage.searchPage, params) |
| 135 | }) | 134 | }) |
| 136 | .backgroundColor(Color.Transparent) | 135 | .backgroundColor(Color.Transparent) |
| 137 | 136 | ||
| 138 | } | 137 | } |
| 139 | .zIndex(20) | 138 | .zIndex(20) |
| 140 | .height($r('app.float.top_tab_bar_height_common')) | 139 | .height($r('app.float.top_tab_bar_height_common')) |
| 141 | - .margin({top:10}) | 140 | + .margin({ top: 10 }) |
| 142 | .visibility(this.displayDirection === DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) | 141 | .visibility(this.displayDirection === DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) |
| 143 | 142 | ||
| 144 | } | 143 | } |
| @@ -174,6 +173,7 @@ export struct VideoChannelPage { | @@ -174,6 +173,7 @@ export struct VideoChannelPage { | ||
| 174 | .width('100%') | 173 | .width('100%') |
| 175 | .height('100%') | 174 | .height('100%') |
| 176 | .cachedCount(-1) | 175 | .cachedCount(-1) |
| 176 | + .disableSwipe(this.displayDirection === DisplayDirection.VERTICAL ? false : true) | ||
| 177 | .displayCount(1, true) | 177 | .displayCount(1, true) |
| 178 | .alignSelf(ItemAlign.Start) | 178 | .alignSelf(ItemAlign.Start) |
| 179 | .effectMode(EdgeEffect.None) | 179 | .effectMode(EdgeEffect.None) |
| @@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
| 17 | "name": "EntryAbility", // 这里不能改动,和后台推送有绑定 | 17 | "name": "EntryAbility", // 这里不能改动,和后台推送有绑定 |
| 18 | "srcEntry": "./ets/entryability/EntryAbility.ets", | 18 | "srcEntry": "./ets/entryability/EntryAbility.ets", |
| 19 | "description": "$string:EntryAbility_desc", | 19 | "description": "$string:EntryAbility_desc", |
| 20 | - "icon": "$media:app_icon", | 20 | + "icon": "$media:app_icon_layer", |
| 21 | "label": "$string:EntryAbility_label", | 21 | "label": "$string:EntryAbility_label", |
| 22 | "startWindowIcon": "$media:app_icon", | 22 | "startWindowIcon": "$media:app_icon", |
| 23 | "startWindowBackground": "$color:start_window_background", | 23 | "startWindowBackground": "$color:start_window_background", |
1015 Bytes
7.3 KB
-
Please register or login to post a comment