Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: (28 commits) 版本号与Android对齐,用7.3.7.0 feat: 1)处理直播结束view;2)添加获取拉流地址 刷新token修改。 desc:获取消息需要登录 fix(17802): UI还原问题-【uat】意见反馈-描述您的问题-输入框提示文案颜色未置灰,字体大小偏大,看图 fix(17808): UI还原问题-【uat】意见反馈-描述您的问题-输入框字数没置灰显示,看图 fix:bug[18314] 【华为验收】【ux-直板机】【底部导航条适配】点击 我的-预约,进入该页面,该页面底部导航条未沉浸 feat: 进入横屏多路直播-置空-评论预显示禁止直播间,大家聊不支持下拉刷新 fix(17809): UI还原问题-【uat】意见反馈-描述您的问题-“期待您留下联系方式,我们将提供更好的服务” 文案字体和大小与android不一致,看图 feat: 17449 UI还原问题--地方频道下的人民号动态长图无法显示长图信息 修复视频全屏变形 ref |> 直播模块增加评论输入框逻辑 修复视频频道点击接口重复调用 直播详情页互动组件点赞组件点赞数据++ 直播详情页互动组件点赞组件完善 漏提 fix:somebug 集成图片框架ImageKnife,底导用图片框架加载icon 一级视频详情页-埋点 仅wifi下加载图片开关逻辑修改 ...
Showing
54 changed files
with
1510 additions
and
213 deletions
| @@ -2,8 +2,8 @@ | @@ -2,8 +2,8 @@ | ||
| 2 | "app": { | 2 | "app": { |
| 3 | "bundleName": "com.peopledailychina.hosactivity", | 3 | "bundleName": "com.peopledailychina.hosactivity", |
| 4 | "vendor": "$string:app_vendor", | 4 | "vendor": "$string:app_vendor", |
| 5 | - "versionCode": 10000, | ||
| 6 | - "versionName": "1.0.0", | 5 | + "versionCode": 7370, |
| 6 | + "versionName": "7.3.7.0", | ||
| 7 | "icon": "$media:app_icon", | 7 | "icon": "$media:app_icon", |
| 8 | "label": "$string:app_name" | 8 | "label": "$string:app_name" |
| 9 | } | 9 | } |
| @@ -17,6 +17,14 @@ | @@ -17,6 +17,14 @@ | ||
| 17 | "value": "13fp" | 17 | "value": "13fp" |
| 18 | }, | 18 | }, |
| 19 | { | 19 | { |
| 20 | + "name": "font_size_13_5", | ||
| 21 | + "value": "13.5fp" | ||
| 22 | + }, | ||
| 23 | + { | ||
| 24 | + "name": "font_size_13_2", | ||
| 25 | + "value": "13.2fp" | ||
| 26 | + }, | ||
| 27 | + { | ||
| 20 | "name": "font_size_14", | 28 | "name": "font_size_14", |
| 21 | "value": "14fp" | 29 | "value": "14fp" |
| 22 | }, | 30 | }, |
| @@ -40,6 +40,9 @@ instance.interceptors.request.use( | @@ -40,6 +40,9 @@ instance.interceptors.request.use( | ||
| 40 | // 公共请求参数 | 40 | // 公共请求参数 |
| 41 | // config.params.key = key | 41 | // config.params.key = key |
| 42 | Logger.debug('HttpRequest', 'request: ' + config.url) | 42 | Logger.debug('HttpRequest', 'request: ' + config.url) |
| 43 | + // TODO 临时打印token,测试token失效。待删除 | ||
| 44 | + Logger.debug('HttpRequest', 'request token: ' + config?.headers?.get('RMRB-X-TOKEN')) | ||
| 45 | + Logger.debug('HttpRequest', 'request cookie: ' + config?.headers?.get('cookie')) | ||
| 43 | return config; | 46 | return config; |
| 44 | }, | 47 | }, |
| 45 | (error: AxiosError) => { | 48 | (error: AxiosError) => { |
| @@ -29,10 +29,11 @@ export class HttpBizUtil { | @@ -29,10 +29,11 @@ export class HttpBizUtil { | ||
| 29 | // 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面 | 29 | // 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面 |
| 30 | if (res.code == 403 || res.code == 406) { | 30 | if (res.code == 403 || res.code == 406) { |
| 31 | HttpBizUtil.refreshToken().then((token: string) => { | 31 | HttpBizUtil.refreshToken().then((token: string) => { |
| 32 | - if (headers) { | ||
| 33 | - headers.replace('RMRB-X-TOKEN', token) | ||
| 34 | - headers.replace('cookie', 'RMRB-X-TOKEN=' + token) | 32 | + if (!headers) { |
| 33 | + headers = new HashMap() | ||
| 35 | } | 34 | } |
| 35 | + headers?.replace('RMRB-X-TOKEN', token) | ||
| 36 | + headers?.replace('cookie', 'RMRB-X-TOKEN=' + token) | ||
| 36 | Logger.debug(TAG, 'get again send: ' + token) | 37 | Logger.debug(TAG, 'get again send: ' + token) |
| 37 | // refreshToken为空场景不处理,直接请求接口。 | 38 | // refreshToken为空场景不处理,直接请求接口。 |
| 38 | WDHttp.get<T>(url, headers).then((againResDTO: T) => { | 39 | WDHttp.get<T>(url, headers).then((againResDTO: T) => { |
| @@ -67,10 +68,11 @@ export class HttpBizUtil { | @@ -67,10 +68,11 @@ export class HttpBizUtil { | ||
| 67 | Logger.debug(TAG, 'post catch error: ' + JSON.stringify(res)) | 68 | Logger.debug(TAG, 'post catch error: ' + JSON.stringify(res)) |
| 68 | if (res.code == 403 || res.code == 406) { | 69 | if (res.code == 403 || res.code == 406) { |
| 69 | HttpBizUtil.refreshToken().then((token: string) => { | 70 | HttpBizUtil.refreshToken().then((token: string) => { |
| 70 | - if (headers) { | ||
| 71 | - headers.replace('RMRB-X-TOKEN', token) | ||
| 72 | - headers.replace('cookie', 'RMRB-X-TOKEN=' + token) | 71 | + if (!headers) { |
| 72 | + headers = new HashMap() | ||
| 73 | } | 73 | } |
| 74 | + headers?.replace('RMRB-X-TOKEN', token) | ||
| 75 | + headers?.replace('cookie', 'RMRB-X-TOKEN=' + token) | ||
| 74 | Logger.debug(TAG, 'post again send: ' + token) | 76 | Logger.debug(TAG, 'post again send: ' + token) |
| 75 | // refreshToken为空场景不处理,直接请求接口。 | 77 | // refreshToken为空场景不处理,直接请求接口。 |
| 76 | WDHttp.post<T>(url, data, headers).then((againResDTO: T) => { | 78 | WDHttp.post<T>(url, data, headers).then((againResDTO: T) => { |
| @@ -32,6 +32,11 @@ export class HttpUrlUtils { | @@ -32,6 +32,11 @@ export class HttpUrlUtils { | ||
| 32 | * 详情页面详情接口 | 32 | * 详情页面详情接口 |
| 33 | */ | 33 | */ |
| 34 | static readonly DETAIL_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail"; | 34 | static readonly DETAIL_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail"; |
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 获取视频直播间拉流地址 | ||
| 38 | + */ | ||
| 39 | + static readonly PULL_STREAM_PATH: string = "/api/live-center-video/zh/c/vlive/pull-stream/"; | ||
| 35 | /** | 40 | /** |
| 36 | * 批查接口,查询互动相关数据,如收藏数、评论数等 | 41 | * 批查接口,查询互动相关数据,如收藏数、评论数等 |
| 37 | */ | 42 | */ |
| @@ -207,6 +212,14 @@ export class HttpUrlUtils { | @@ -207,6 +212,14 @@ export class HttpUrlUtils { | ||
| 207 | */ | 212 | */ |
| 208 | static readonly LIVE_ROOM_DATA_PATH: string = "/api/live-center-message/zh/a/live/room/number/all"; | 213 | static readonly LIVE_ROOM_DATA_PATH: string = "/api/live-center-message/zh/a/live/room/number/all"; |
| 209 | /** | 214 | /** |
| 215 | + * 直播详情-C端点赞接口 | ||
| 216 | + */ | ||
| 217 | + static readonly LIVE_ROOM_NUMBER_LIKE: string = "/api/live-center-message/zh/c/live/room/number/like"; | ||
| 218 | + /** | ||
| 219 | + * 直播详情-查询是否点赞接口 | ||
| 220 | + */ | ||
| 221 | + static readonly LIVE_LIKE: string = "/api/live-center-message/zh/a/live/like"; | ||
| 222 | + /** | ||
| 210 | * 直播详情-预约直播状态 | 223 | * 直播详情-预约直播状态 |
| 211 | */ | 224 | */ |
| 212 | static readonly LIVE_APPOINTMENT_STATUS_PATH: string = "/api/live-center-message/zh/c/live/subscribe/query"; | 225 | static readonly LIVE_APPOINTMENT_STATUS_PATH: string = "/api/live-center-message/zh/c/live/subscribe/query"; |
| @@ -218,6 +231,15 @@ export class HttpUrlUtils { | @@ -218,6 +231,15 @@ export class HttpUrlUtils { | ||
| 218 | * 预约状态 | 231 | * 预约状态 |
| 219 | */ | 232 | */ |
| 220 | static readonly LIVE_APPOINTMENT_BATCH_PATH: string = "/api/live-center-message/zh/c/live/subscribe/user/batch"; | 233 | static readonly LIVE_APPOINTMENT_BATCH_PATH: string = "/api/live-center-message/zh/c/live/subscribe/user/batch"; |
| 234 | + | ||
| 235 | + /** | ||
| 236 | + * 查询是否被禁言 | ||
| 237 | + */ | ||
| 238 | + static getLiveBarrageHasBanUrl() { | ||
| 239 | + let url = HttpUrlUtils.getHost() + "/api/live-center-message/zh/c/mlive/barrage/ban" | ||
| 240 | + return url | ||
| 241 | + } | ||
| 242 | + | ||
| 221 | /** | 243 | /** |
| 222 | 244 | ||
| 223 | * 搜索结果 显示tab 数 | 245 | * 搜索结果 显示tab 数 |
| @@ -633,11 +655,21 @@ export class HttpUrlUtils { | @@ -633,11 +655,21 @@ export class HttpUrlUtils { | ||
| 633 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_CHAT_LIST_PATH | 655 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_CHAT_LIST_PATH |
| 634 | return url | 656 | return url |
| 635 | } | 657 | } |
| 636 | - | 658 | + // 直播详情-直播数据 |
| 637 | static getLiveRoomDataUrl() { | 659 | static getLiveRoomDataUrl() { |
| 638 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_ROOM_DATA_PATH | 660 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_ROOM_DATA_PATH |
| 639 | return url | 661 | return url |
| 640 | } | 662 | } |
| 663 | + // 直播详情-C端点赞接口 | ||
| 664 | + static getLiveRoomNumberLikeUrl() { | ||
| 665 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_ROOM_NUMBER_LIKE | ||
| 666 | + return url | ||
| 667 | + } | ||
| 668 | + // 直播详情-查询是否点赞接口 | ||
| 669 | + static getLiveLikeUrl() { | ||
| 670 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_LIKE | ||
| 671 | + return url | ||
| 672 | + } | ||
| 641 | 673 | ||
| 642 | static getLiveAppointmentStatusUrl() { | 674 | static getLiveAppointmentStatusUrl() { |
| 643 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_APPOINTMENT_STATUS_PATH | 675 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_APPOINTMENT_STATUS_PATH |
| @@ -70,6 +70,8 @@ export { NewspaperTimeItemBean } from './src/main/ets/bean/newspaper/NewspaperTi | @@ -70,6 +70,8 @@ export { NewspaperTimeItemBean } from './src/main/ets/bean/newspaper/NewspaperTi | ||
| 70 | 70 | ||
| 71 | export { ContentDetailDTO } from './src/main/ets/bean/detail/ContentDetailDTO'; | 71 | export { ContentDetailDTO } from './src/main/ets/bean/detail/ContentDetailDTO'; |
| 72 | 72 | ||
| 73 | +export { GetPullAddressBean } from './src/main/ets/bean/live/GetPullAddressBean'; | ||
| 74 | + | ||
| 73 | export { RmhInfoDTO } from './src/main/ets/bean/detail/RmhInfoDTO'; | 75 | export { RmhInfoDTO } from './src/main/ets/bean/detail/RmhInfoDTO'; |
| 74 | 76 | ||
| 75 | export { UserInfoDTO } from './src/main/ets/bean/detail/UserInfoDTO'; | 77 | export { UserInfoDTO } from './src/main/ets/bean/detail/UserInfoDTO'; |
| @@ -122,7 +124,7 @@ export { appStyleImagesDTO } from './src/main/ets/bean/content/appStyleImagesDTO | @@ -122,7 +124,7 @@ export { appStyleImagesDTO } from './src/main/ets/bean/content/appStyleImagesDTO | ||
| 122 | 124 | ||
| 123 | export { LiveRoomBean, LiveRoomItemBean } from './src/main/ets/bean/live/LiveRoomBean'; | 125 | export { LiveRoomBean, LiveRoomItemBean } from './src/main/ets/bean/live/LiveRoomBean'; |
| 124 | 126 | ||
| 125 | -export { LiveRoomDataBean } from './src/main/ets/bean/live/LiveRoomDataBean'; | 127 | +export { LiveRoomDataBean, ValueType } from './src/main/ets/bean/live/LiveRoomDataBean'; |
| 126 | 128 | ||
| 127 | export { ReserveBean } from './src/main/ets/bean/live/ReserveBean'; | 129 | export { ReserveBean } from './src/main/ets/bean/live/ReserveBean'; |
| 128 | 130 |
| @@ -19,4 +19,9 @@ export interface RmhInfoDTO { | @@ -19,4 +19,9 @@ export interface RmhInfoDTO { | ||
| 19 | userId: string; | 19 | userId: string; |
| 20 | userType: string; | 20 | userType: string; |
| 21 | honoraryIcon:string; | 21 | honoraryIcon:string; |
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 发布标识,0-cms;1-表示号主发布 | ||
| 25 | + */ | ||
| 26 | + rmhPlatform:number | ||
| 22 | } | 27 | } |
| 1 | +/** | ||
| 2 | + * 获取拉流地址解析类 | ||
| 3 | + */ | ||
| 4 | +export class GetPullAddressBean { | ||
| 5 | + origin: OriginBean = new OriginBean(); | ||
| 6 | + transCode: Array<TransCodeBean> = new Array; | ||
| 7 | +} | ||
| 8 | + | ||
| 9 | +class OriginBean { | ||
| 10 | + expireTime: number = -1; | ||
| 11 | + definition: string = ''; | ||
| 12 | + flvUrl: string = ''; | ||
| 13 | + m3u8Url: string = ''; | ||
| 14 | + rtmpUrl: string = ''; | ||
| 15 | + rtsUrl: string = ''; | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +export class TransCodeBean { | ||
| 19 | + expireTime: number = -1; | ||
| 20 | + definition: string = ''; | ||
| 21 | + flvUrl: string = ''; | ||
| 22 | + m3u8Url: string = ''; | ||
| 23 | + rtmpUrl: string = ''; | ||
| 24 | + rtsUrl: string = ''; | ||
| 25 | +} |
| @@ -5,3 +5,5 @@ export interface LiveRoomDataBean { | @@ -5,3 +5,5 @@ export interface LiveRoomDataBean { | ||
| 5 | pv: number, | 5 | pv: number, |
| 6 | subscribeNum: number, | 6 | subscribeNum: number, |
| 7 | } | 7 | } |
| 8 | + | ||
| 9 | +export type ValueType = number | string | boolean | Array<number> | Array<string> | Array<boolean> | Uint8Array | object | bigint; |
| @@ -90,6 +90,8 @@ export { MultiPictureDetailItemComponent } from './src/main/ets/components/Multi | @@ -90,6 +90,8 @@ export { MultiPictureDetailItemComponent } from './src/main/ets/components/Multi | ||
| 90 | 90 | ||
| 91 | export { OperRowListView } from './src/main/ets/components/view/OperRowListView'; | 91 | export { OperRowListView } from './src/main/ets/components/view/OperRowListView'; |
| 92 | 92 | ||
| 93 | +export { LiveOperRowListView } from './src/main/ets/components/view/LiveOperRowListView'; | ||
| 94 | + | ||
| 93 | export { ImageDownloadComponent } from './src/main/ets/components/ImageDownloadComponent'; | 95 | export { ImageDownloadComponent } from './src/main/ets/components/ImageDownloadComponent'; |
| 94 | 96 | ||
| 95 | export { PageRepository } from './src/main/ets/repository/PageRepository'; | 97 | export { PageRepository } from './src/main/ets/repository/PageRepository'; |
| @@ -97,6 +97,10 @@ export struct FeedBackActivity { | @@ -97,6 +97,10 @@ export struct FeedBackActivity { | ||
| 97 | TextArea({ placeholder: $r('app.string.feedback_comments') }) | 97 | TextArea({ placeholder: $r('app.string.feedback_comments') }) |
| 98 | .width(CommonConstants.FULL_WIDTH) | 98 | .width(CommonConstants.FULL_WIDTH) |
| 99 | .height(CommonConstants.FULL_HEIGHT) | 99 | .height(CommonConstants.FULL_HEIGHT) |
| 100 | + .fontColor($r('app.color.color_222222')) | ||
| 101 | + .fontSize($r('app.float.font_size_13_2')) | ||
| 102 | + .placeholderColor($r('app.color.color_CCCCCC')) | ||
| 103 | + .placeholderFont({size:$r('app.float.font_size_13_2')}) | ||
| 100 | .padding({bottom:96}) | 104 | .padding({bottom:96}) |
| 101 | .backgroundColor($r('app.color.color_F5F5F5')) | 105 | .backgroundColor($r('app.color.color_F5F5F5')) |
| 102 | .align(Alignment.TopStart) | 106 | .align(Alignment.TopStart) |
| @@ -170,6 +174,8 @@ export struct FeedBackActivity { | @@ -170,6 +174,8 @@ export struct FeedBackActivity { | ||
| 170 | .margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_12'),left: $r('app.float.vp_12')}) | 174 | .margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_12'),left: $r('app.float.vp_12')}) |
| 171 | Text(this.textNumLabel) | 175 | Text(this.textNumLabel) |
| 172 | .margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_11')}) | 176 | .margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_11')}) |
| 177 | + .fontColor($r('app.color.color_999999')) | ||
| 178 | + .fontSize($r('app.float.font_size_13_5')) | ||
| 173 | } | 179 | } |
| 174 | .height(200) | 180 | .height(200) |
| 175 | .width('94%') | 181 | .width('94%') |
| @@ -182,7 +188,7 @@ export struct FeedBackActivity { | @@ -182,7 +188,7 @@ export struct FeedBackActivity { | ||
| 182 | 188 | ||
| 183 | Text($r('app.string.feedback_email')) | 189 | Text($r('app.string.feedback_email')) |
| 184 | .fontColor($r('app.color.color_222222')) | 190 | .fontColor($r('app.color.color_222222')) |
| 185 | - .fontSize($r('app.float.font_size_14')) | 191 | + .fontSize($r('app.float.font_size_13_2')) |
| 186 | .width('94%') | 192 | .width('94%') |
| 187 | .margin({ top: $r('app.float.margin_24') }) | 193 | .margin({ top: $r('app.float.margin_24') }) |
| 188 | Row() { | 194 | Row() { |
| @@ -232,6 +238,7 @@ export struct FeedBackActivity { | @@ -232,6 +238,7 @@ export struct FeedBackActivity { | ||
| 232 | } | 238 | } |
| 233 | }.margin({bottom:20}) | 239 | }.margin({bottom:20}) |
| 234 | } | 240 | } |
| 241 | + .backgroundColor($r('app.color.color_fff')) | ||
| 235 | } | 242 | } |
| 236 | 243 | ||
| 237 | /** | 244 | /** |
| @@ -103,11 +103,14 @@ interface radiusType { | @@ -103,11 +103,14 @@ interface radiusType { | ||
| 103 | bottomRight: number | Resource; | 103 | bottomRight: number | Resource; |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | +interface picProps { | ||
| 107 | + width: number, | ||
| 108 | + height: number | ||
| 109 | +} | ||
| 110 | + | ||
| 106 | @Component | 111 | @Component |
| 107 | struct createImg { | 112 | struct createImg { |
| 108 | @Prop fullColumnImgUrls: FullColumnImgUrlDTO[] | 113 | @Prop fullColumnImgUrls: FullColumnImgUrlDTO[] |
| 109 | - @State picWidth: number = 0; | ||
| 110 | - @State picHeight: number = 0; | ||
| 111 | @State loadImg: boolean = false; | 114 | @State loadImg: boolean = false; |
| 112 | 115 | ||
| 113 | async aboutToAppear(): Promise<void> { | 116 | async aboutToAppear(): Promise<void> { |
| @@ -143,11 +146,11 @@ struct createImg { | @@ -143,11 +146,11 @@ struct createImg { | ||
| 143 | return radius | 146 | return radius |
| 144 | } | 147 | } |
| 145 | 148 | ||
| 146 | - getPicType(){ | ||
| 147 | - if (this.picWidth && this.picHeight) { | ||
| 148 | - if (this.picWidth / this.picHeight > 2/1) { | 149 | + getPicType(picWidth: number, picHeight: number) { |
| 150 | + if (picWidth && picHeight) { | ||
| 151 | + if (picWidth / picHeight > 2/1) { | ||
| 149 | return 1; //横长图 | 152 | return 1; //横长图 |
| 150 | - } else if ( this.picWidth/this.picHeight < 1/2) { | 153 | + } else if (picWidth/picHeight < 1/2) { |
| 151 | return 2; //竖长图 | 154 | return 2; //竖长图 |
| 152 | } else { | 155 | } else { |
| 153 | return 3 | 156 | return 3 |
| @@ -163,21 +166,21 @@ struct createImg { | @@ -163,21 +166,21 @@ struct createImg { | ||
| 163 | }) { | 166 | }) { |
| 164 | ForEach(this.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => { | 167 | ForEach(this.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => { |
| 165 | if (this.fullColumnImgUrls.length === 1) { | 168 | if (this.fullColumnImgUrls.length === 1) { |
| 166 | - if (this.getPicType() !== 3) { | 169 | + if (this.getPicType(item.weight, item.height) !== 3) { |
| 167 | GridCol({ | 170 | GridCol({ |
| 168 | - span: this.getPicType() === 1 ? 12 : 8 | 171 | + span: this.getPicType(item.weight, item.height) === 1 ? 12 : 8 |
| 169 | }){ | 172 | }){ |
| 170 | Stack({ | 173 | Stack({ |
| 171 | alignContent: Alignment.BottomEnd | 174 | alignContent: Alignment.BottomEnd |
| 172 | }) { | 175 | }) { |
| 173 | - if (this.getPicType() === 1) { | 176 | + if (this.getPicType(item.weight, item.height) === 1) { |
| 174 | Image(this.loadImg ? item.fullUrl || item.url : '') | 177 | Image(this.loadImg ? item.fullUrl || item.url : '') |
| 175 | .backgroundColor(0xf5f5f5) | 178 | .backgroundColor(0xf5f5f5) |
| 176 | .width('100%') | 179 | .width('100%') |
| 177 | .height(172) | 180 | .height(172) |
| 178 | .autoResize(true) | 181 | .autoResize(true) |
| 179 | .borderRadius(this.caclImageRadius(index)) | 182 | .borderRadius(this.caclImageRadius(index)) |
| 180 | - } else if (this.getPicType() === 2) { | 183 | + } else if (this.getPicType(item.weight, item.height) === 2) { |
| 181 | Image(this.loadImg ? item.fullUrl || item.url : '') | 184 | Image(this.loadImg ? item.fullUrl || item.url : '') |
| 182 | .width('100%') | 185 | .width('100%') |
| 183 | .height(305) | 186 | .height(305) |
| @@ -200,6 +203,10 @@ struct createImg { | @@ -200,6 +203,10 @@ struct createImg { | ||
| 200 | }) | 203 | }) |
| 201 | .fontColor(0xffffff) | 204 | .fontColor(0xffffff) |
| 202 | .fontFamily('PingFang SC') | 205 | .fontFamily('PingFang SC') |
| 206 | + .visibility( | ||
| 207 | + item.weight / item.height > 2 / 1 || item.weight / item.height < 1 / 2 | ||
| 208 | + ? Visibility.Visible : Visibility.None | ||
| 209 | + ) | ||
| 203 | } | 210 | } |
| 204 | .width(48) | 211 | .width(48) |
| 205 | .padding({bottom: 9}) | 212 | .padding({bottom: 9}) |
| @@ -215,11 +222,7 @@ struct createImg { | @@ -215,11 +222,7 @@ struct createImg { | ||
| 215 | .width('100%') | 222 | .width('100%') |
| 216 | .autoResize(true) | 223 | .autoResize(true) |
| 217 | .borderRadius(this.caclImageRadius(index)) | 224 | .borderRadius(this.caclImageRadius(index)) |
| 218 | - .opacity(!this.picWidth && !this.picHeight ? 0 : 1) | ||
| 219 | - .onComplete(callback => { | ||
| 220 | - this.picWidth = callback?.width || 0; | ||
| 221 | - this.picHeight = callback?.height || 0; | ||
| 222 | - }) | 225 | + .opacity(!item.weight && !item.height ? 0 : 1) |
| 223 | } | 226 | } |
| 224 | } | 227 | } |
| 225 | } else if (this.fullColumnImgUrls.length === 4) { | 228 | } else if (this.fullColumnImgUrls.length === 4) { |
| @@ -231,11 +234,7 @@ struct createImg { | @@ -231,11 +234,7 @@ struct createImg { | ||
| 231 | .backgroundColor(0xf5f5f5) | 234 | .backgroundColor(0xf5f5f5) |
| 232 | .aspectRatio(1) | 235 | .aspectRatio(1) |
| 233 | .borderRadius(this.caclImageRadius(index)) | 236 | .borderRadius(this.caclImageRadius(index)) |
| 234 | - .onComplete(callback => { | ||
| 235 | - this.picWidth = callback?.width || 0; | ||
| 236 | - this.picHeight = callback?.height || 0; | ||
| 237 | - }) | ||
| 238 | - if(this.getPicType() !== 3){ | 237 | + if(this.getPicType(item.weight, item.height) !== 3){ |
| 239 | Flex({ direction: FlexDirection.Row }) { | 238 | Flex({ direction: FlexDirection.Row }) { |
| 240 | Image($r('app.media.icon_long_pic')) | 239 | Image($r('app.media.icon_long_pic')) |
| 241 | .width(12) | 240 | .width(12) |
| @@ -252,6 +251,10 @@ struct createImg { | @@ -252,6 +251,10 @@ struct createImg { | ||
| 252 | }) | 251 | }) |
| 253 | .fontColor(0xffffff) | 252 | .fontColor(0xffffff) |
| 254 | .fontFamily('PingFang SC') | 253 | .fontFamily('PingFang SC') |
| 254 | + .visibility( | ||
| 255 | + item.weight / item.height > 2 / 1 || item.weight / item.height < 1 / 2 | ||
| 256 | + ? Visibility.Visible : Visibility.None | ||
| 257 | + ) | ||
| 255 | } | 258 | } |
| 256 | .width(48) | 259 | .width(48) |
| 257 | .align(Alignment.BottomEnd) | 260 | .align(Alignment.BottomEnd) |
| @@ -268,11 +271,7 @@ struct createImg { | @@ -268,11 +271,7 @@ struct createImg { | ||
| 268 | .backgroundColor(0xf5f5f5) | 271 | .backgroundColor(0xf5f5f5) |
| 269 | .aspectRatio(1) | 272 | .aspectRatio(1) |
| 270 | .borderRadius(this.caclImageRadius(index)) | 273 | .borderRadius(this.caclImageRadius(index)) |
| 271 | - .onComplete(callback => { | ||
| 272 | - this.picWidth = callback?.width || 0; | ||
| 273 | - this.picHeight = callback?.height || 0; | ||
| 274 | - }) | ||
| 275 | - if (this.getPicType() !== 3) { | 274 | + if (this.getPicType(item.weight, item.height) !== 3) { |
| 276 | Flex({ direction: FlexDirection.Row }) { | 275 | Flex({ direction: FlexDirection.Row }) { |
| 277 | Image($r('app.media.icon_long_pic')) | 276 | Image($r('app.media.icon_long_pic')) |
| 278 | .width(12) | 277 | .width(12) |
| @@ -289,6 +288,10 @@ struct createImg { | @@ -289,6 +288,10 @@ struct createImg { | ||
| 289 | }) | 288 | }) |
| 290 | .fontColor(0xffffff) | 289 | .fontColor(0xffffff) |
| 291 | .fontFamily('PingFang SC') | 290 | .fontFamily('PingFang SC') |
| 291 | + .visibility( | ||
| 292 | + item.weight / item.height > 2 / 1 || item.weight / item.height < 1 / 2 | ||
| 293 | + ? Visibility.Visible : Visibility.None | ||
| 294 | + ) | ||
| 292 | } | 295 | } |
| 293 | .width(48) | 296 | .width(48) |
| 294 | .align(Alignment.BottomEnd) | 297 | .align(Alignment.BottomEnd) |
| @@ -61,13 +61,13 @@ export struct Card2Component { | @@ -61,13 +61,13 @@ export struct Card2Component { | ||
| 61 | // } | 61 | // } |
| 62 | // } | 62 | // } |
| 63 | if(this.contentDTO.objectType == '5'){ | 63 | if(this.contentDTO.objectType == '5'){ |
| 64 | - Notes({ objectType: this.contentDTO.objectType }).height(20).align(Alignment.Center) | 64 | + Notes({ objectType: this.contentDTO.objectType }).height(29).align(Alignment.Center) |
| 65 | } else { | 65 | } else { |
| 66 | if (this.contentDTO.seoTags) { | 66 | if (this.contentDTO.seoTags) { |
| 67 | - Notes({ newTags: this.contentDTO.seoTags }).height(20).align(Alignment.Center) | 67 | + Notes({ newTags: this.contentDTO.seoTags }).height(29).align(Alignment.Center) |
| 68 | } | 68 | } |
| 69 | if (this.contentDTO.newTags) { | 69 | if (this.contentDTO.newTags) { |
| 70 | - Notes({ newTags: this.contentDTO.newTags }).height(20).align(Alignment.Center) | 70 | + Notes({ newTags: this.contentDTO.newTags }).height(29).align(Alignment.Center) |
| 71 | } | 71 | } |
| 72 | } | 72 | } |
| 73 | //新闻标题 | 73 | //新闻标题 |
| @@ -42,13 +42,13 @@ export struct Card3Component { | @@ -42,13 +42,13 @@ export struct Card3Component { | ||
| 42 | // Notes({ objectType: this.contentDTO.objectType }).height(27).align(Alignment.Center) | 42 | // Notes({ objectType: this.contentDTO.objectType }).height(27).align(Alignment.Center) |
| 43 | // } | 43 | // } |
| 44 | if(this.contentDTO.objectType == '5'){ | 44 | if(this.contentDTO.objectType == '5'){ |
| 45 | - Notes({ objectType: this.contentDTO.objectType }).height(20).align(Alignment.Center) | 45 | + Notes({ objectType: this.contentDTO.objectType }).height(29).align(Alignment.Center) |
| 46 | } else { | 46 | } else { |
| 47 | if (this.contentDTO.seoTags) { | 47 | if (this.contentDTO.seoTags) { |
| 48 | - Notes({ newTags: this.contentDTO.seoTags }).height(20).align(Alignment.Center) | 48 | + Notes({ newTags: this.contentDTO.seoTags }).height(29).align(Alignment.Center) |
| 49 | } | 49 | } |
| 50 | if (this.contentDTO.newTags) { | 50 | if (this.contentDTO.newTags) { |
| 51 | - Notes({ newTags: this.contentDTO.newTags }).height(20).align(Alignment.Center) | 51 | + Notes({ newTags: this.contentDTO.newTags }).height(29).align(Alignment.Center) |
| 52 | } | 52 | } |
| 53 | } | 53 | } |
| 54 | Text() { | 54 | Text() { |
| @@ -89,18 +89,19 @@ export struct Card6Component { | @@ -89,18 +89,19 @@ export struct Card6Component { | ||
| 89 | ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 : | 89 | ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 : |
| 90 | 0 ) | 90 | 0 ) |
| 91 | }.alignContent(Alignment.TopStart) | 91 | }.alignContent(Alignment.TopStart) |
| 92 | + // .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 60: 156) | ||
| 92 | 93 | ||
| 93 | } | 94 | } |
| 94 | .justifyContent(FlexAlign.Start) | 95 | .justifyContent(FlexAlign.Start) |
| 95 | - | ||
| 96 | Blank() | 96 | Blank() |
| 97 | //bottom 评论等信息 | 97 | //bottom 评论等信息 |
| 98 | CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO }) | 98 | CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO }) |
| 99 | + | ||
| 99 | } | 100 | } |
| 100 | .alignItems(HorizontalAlign.Start) | 101 | .alignItems(HorizontalAlign.Start) |
| 101 | .justifyContent(FlexAlign.Start) | 102 | .justifyContent(FlexAlign.Start) |
| 102 | .width('64%') | 103 | .width('64%') |
| 103 | - .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78 : 156) | 104 | + |
| 104 | 105 | ||
| 105 | Stack({alignContent: Alignment.BottomEnd}) { | 106 | Stack({alignContent: Alignment.BottomEnd}) { |
| 106 | Image(this.loadImg ? this.contentDTO.coverUrl || this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '') | 107 | Image(this.loadImg ? this.contentDTO.coverUrl || this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '') |
| @@ -110,6 +111,7 @@ export struct Card6Component { | @@ -110,6 +111,7 @@ export struct Card6Component { | ||
| 110 | .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78 : 156) | 111 | .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78 : 156) |
| 111 | CardMediaInfo({ contentDTO: this.contentDTO }) | 112 | CardMediaInfo({ contentDTO: this.contentDTO }) |
| 112 | } | 113 | } |
| 114 | + | ||
| 113 | } | 115 | } |
| 114 | .onClick((event: ClickEvent) => { | 116 | .onClick((event: ClickEvent) => { |
| 115 | InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName) | 117 | InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName) |
| @@ -123,6 +125,7 @@ export struct Card6Component { | @@ -123,6 +125,7 @@ export struct Card6Component { | ||
| 123 | top: $r('app.float.card_comp_pagePadding_tb'), | 125 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 124 | bottom: $r('app.float.card_comp_pagePadding_tb') | 126 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 125 | }) | 127 | }) |
| 128 | + | ||
| 126 | .width(CommonConstants.FULL_WIDTH) | 129 | .width(CommonConstants.FULL_WIDTH) |
| 127 | // .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 107 : 217) | 130 | // .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 107 : 217) |
| 128 | .justifyContent(FlexAlign.SpaceBetween) | 131 | .justifyContent(FlexAlign.SpaceBetween) |
| @@ -38,8 +38,12 @@ export struct CommentListDialogView { | @@ -38,8 +38,12 @@ export struct CommentListDialogView { | ||
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | closeAction() { | 40 | closeAction() { |
| 41 | + if (this.onClose) { | ||
| 42 | + this.onClose() | ||
| 43 | + } else { | ||
| 41 | this.showCommentList = false | 44 | this.showCommentList = false |
| 42 | } | 45 | } |
| 46 | + } | ||
| 43 | 47 | ||
| 44 | build() { | 48 | build() { |
| 45 | } | 49 | } |
| @@ -58,6 +58,12 @@ export struct AppointmentListUI { | @@ -58,6 +58,12 @@ export struct AppointmentListUI { | ||
| 58 | } | 58 | } |
| 59 | } | 59 | } |
| 60 | } else { | 60 | } else { |
| 61 | + Stack(){ | ||
| 62 | + Row() | ||
| 63 | + .width("100%") | ||
| 64 | + .height("100%") | ||
| 65 | + .backgroundColor($r('app.color.color_F9F9F9')) | ||
| 66 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) | ||
| 61 | CustomPullToRefresh({ | 67 | CustomPullToRefresh({ |
| 62 | alldata:this.data, | 68 | alldata:this.data, |
| 63 | scroller:this.scroller, | 69 | scroller:this.scroller, |
| @@ -84,7 +90,8 @@ export struct AppointmentListUI { | @@ -84,7 +90,8 @@ export struct AppointmentListUI { | ||
| 84 | }) | 90 | }) |
| 85 | } | 91 | } |
| 86 | } | 92 | } |
| 87 | - .backgroundColor($r('app.color.color_F9F9F9')) | 93 | + } |
| 94 | + .backgroundColor($r('app.color.color_transparent')) | ||
| 88 | .height('100%') | 95 | .height('100%') |
| 89 | .width('100%') | 96 | .width('100%') |
| 90 | } | 97 | } |
| @@ -20,12 +20,10 @@ struct ChannelSubscriptionLayout { | @@ -20,12 +20,10 @@ struct ChannelSubscriptionLayout { | ||
| 20 | //当前选中的频道 | 20 | //当前选中的频道 |
| 21 | @Link currentTopNavSelectedIndex: number; | 21 | @Link currentTopNavSelectedIndex: number; |
| 22 | @Prop homeChannelList: TopNavDTO [] | 22 | @Prop homeChannelList: TopNavDTO [] |
| 23 | - @Prop indexSettingChannelId: number | ||
| 24 | @Link myChannelList: TopNavDTO [] | 23 | @Link myChannelList: TopNavDTO [] |
| 25 | @Link moreChannelList: TopNavDTO [] | 24 | @Link moreChannelList: TopNavDTO [] |
| 26 | @Link localChannelList: TopNavDTO [] | 25 | @Link localChannelList: TopNavDTO [] |
| 27 | @Link channelIds: number [] | 26 | @Link channelIds: number [] |
| 28 | - @StorageLink('channelIds') storeChannelIds: string = '' | ||
| 29 | @State isShow: boolean = false | 27 | @State isShow: boolean = false |
| 30 | @State dragItem: number = -1 | 28 | @State dragItem: number = -1 |
| 31 | private dragRefOffsetX: number = 0 | 29 | private dragRefOffsetX: number = 0 |
| @@ -34,7 +32,7 @@ struct ChannelSubscriptionLayout { | @@ -34,7 +32,7 @@ struct ChannelSubscriptionLayout { | ||
| 34 | @State offsetY: number = 0 | 32 | @State offsetY: number = 0 |
| 35 | private FIX_VP_X: number = 80 | 33 | private FIX_VP_X: number = 80 |
| 36 | private FIX_VP_Y: number = 48 | 34 | private FIX_VP_Y: number = 48 |
| 37 | - @State indexSettingTabIndex: number = 0 | 35 | + @State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002 |
| 38 | @State isEditIng: boolean = false | 36 | @State isEditIng: boolean = false |
| 39 | @State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO | 37 | @State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO |
| 40 | changeTab: (index: number) => void = () => { | 38 | changeTab: (index: number) => void = () => { |
| @@ -50,13 +48,13 @@ struct ChannelSubscriptionLayout { | @@ -50,13 +48,13 @@ struct ChannelSubscriptionLayout { | ||
| 50 | let channelIdTmp = this.channelIds.splice(index1, 1) | 48 | let channelIdTmp = this.channelIds.splice(index1, 1) |
| 51 | this.myChannelList.splice(index2, 0, tmp[0]) | 49 | this.myChannelList.splice(index2, 0, tmp[0]) |
| 52 | this.channelIds.splice(index2, 0, channelIdTmp[0]) | 50 | this.channelIds.splice(index2, 0, channelIdTmp[0]) |
| 53 | - this.storeChannelIds = this.channelIds.join(',') | 51 | + AppStorage.setOrCreate('channelIds', this.channelIds.join(',')) |
| 54 | } | 52 | } |
| 55 | //删除频道 | 53 | //删除频道 |
| 56 | delChannelItem(index: number){ | 54 | delChannelItem(index: number){ |
| 57 | let item = this.myChannelList.splice(index, 1)[0] | 55 | let item = this.myChannelList.splice(index, 1)[0] |
| 58 | this.channelIds.splice(index, 1) | 56 | this.channelIds.splice(index, 1) |
| 59 | - this.storeChannelIds = this.channelIds.join(',') | 57 | + AppStorage.setOrCreate('channelIds', this.channelIds.join(',')) |
| 60 | if (item.moreChannel === '1') { | 58 | if (item.moreChannel === '1') { |
| 61 | this.moreChannelList.unshift(item) | 59 | this.moreChannelList.unshift(item) |
| 62 | } | 60 | } |
| @@ -68,7 +66,7 @@ struct ChannelSubscriptionLayout { | @@ -68,7 +66,7 @@ struct ChannelSubscriptionLayout { | ||
| 68 | addChannelItem(item: TopNavDTO){ | 66 | addChannelItem(item: TopNavDTO){ |
| 69 | this.channelIds.push(item.channelId) | 67 | this.channelIds.push(item.channelId) |
| 70 | this.myChannelList.push(item) | 68 | this.myChannelList.push(item) |
| 71 | - this.storeChannelIds = this.channelIds.join(',') | 69 | + AppStorage.setOrCreate('channelIds', this.channelIds.join(',')) |
| 72 | } | 70 | } |
| 73 | 71 | ||
| 74 | itemMove(index: number, newIndex: number): void { | 72 | itemMove(index: number, newIndex: number): void { |
| @@ -265,6 +263,7 @@ struct ChannelSubscriptionLayout { | @@ -265,6 +263,7 @@ struct ChannelSubscriptionLayout { | ||
| 265 | .alignContent(Alignment.Start) | 263 | .alignContent(Alignment.Start) |
| 266 | .height(36) | 264 | .height(36) |
| 267 | .onClick(() => { | 265 | .onClick(() => { |
| 266 | + this.indexSettingChannelId = item.channelId | ||
| 268 | AppStorage.set('indexSettingChannelId', item.channelId) | 267 | AppStorage.set('indexSettingChannelId', item.channelId) |
| 269 | }) | 268 | }) |
| 270 | }) | 269 | }) |
| @@ -61,13 +61,17 @@ export struct MinePageComponent { | @@ -61,13 +61,17 @@ export struct MinePageComponent { | ||
| 61 | @Prop isMinePage:boolean = false; | 61 | @Prop isMinePage:boolean = false; |
| 62 | 62 | ||
| 63 | //第一次还没创建时候 pageShow 接收不到监听 | 63 | //第一次还没创建时候 pageShow 接收不到监听 |
| 64 | - pageShowForUpdateData(): void { | 64 | + async pageShowForUpdateData() { |
| 65 | if(this.isMinePage){ | 65 | if(this.isMinePage){ |
| 66 | + let userid = await SPHelper.default.get(SpConstants.USER_ID,"") | ||
| 67 | + if(StringUtils.isNotEmpty(userid)){ | ||
| 66 | this.getMessageData() | 68 | this.getMessageData() |
| 69 | + } | ||
| 70 | + | ||
| 67 | this.pageShowTime = DateTimeUtils.getTimeStamp() | 71 | this.pageShowTime = DateTimeUtils.getTimeStamp() |
| 68 | } | 72 | } |
| 69 | } | 73 | } |
| 70 | - pageHideForUpdateData(): void { | 74 | + pageHideForUpdateData(){ |
| 71 | if(this.isMinePage){ | 75 | if(this.isMinePage){ |
| 72 | this.pageHideTime = DateTimeUtils.getTimeStamp() | 76 | this.pageHideTime = DateTimeUtils.getTimeStamp() |
| 73 | let duration = 0 | 77 | let duration = 0 |
| @@ -83,10 +87,9 @@ export struct MinePageComponent { | @@ -83,10 +87,9 @@ export struct MinePageComponent { | ||
| 83 | aboutToAppear(){ | 87 | aboutToAppear(){ |
| 84 | this.pageFirstCreateTime = DateTimeUtils.getTimeStamp() | 88 | this.pageFirstCreateTime = DateTimeUtils.getTimeStamp() |
| 85 | 89 | ||
| 86 | - this.getUserLogin() | ||
| 87 | this.getFunctionData() | 90 | this.getFunctionData() |
| 91 | + this.getUserLogin() | ||
| 88 | this.addLoginStatusObserver() | 92 | this.addLoginStatusObserver() |
| 89 | - this.getMessageData() | ||
| 90 | } | 93 | } |
| 91 | 94 | ||
| 92 | getMessageData(){ | 95 | getMessageData(){ |
| @@ -177,6 +180,7 @@ export struct MinePageComponent { | @@ -177,6 +180,7 @@ export struct MinePageComponent { | ||
| 177 | let userid = await SPHelper.default.get(SpConstants.USER_ID,"") | 180 | let userid = await SPHelper.default.get(SpConstants.USER_ID,"") |
| 178 | if(StringUtils.isNotEmpty(userid)){ | 181 | if(StringUtils.isNotEmpty(userid)){ |
| 179 | this.isLogin = true | 182 | this.isLogin = true |
| 183 | + this.getMessageData() | ||
| 180 | }else{ | 184 | }else{ |
| 181 | this.isLogin = false | 185 | this.isLogin = false |
| 182 | } | 186 | } |
| @@ -13,9 +13,6 @@ import DailyPaperTopicModel from '../../model/DailyPaperTopicModel' | @@ -13,9 +13,6 @@ import DailyPaperTopicModel from '../../model/DailyPaperTopicModel' | ||
| 13 | 13 | ||
| 14 | const TAG = 'TopNavigationComponent'; | 14 | const TAG = 'TopNavigationComponent'; |
| 15 | 15 | ||
| 16 | -PersistentStorage.persistProp('channelIds', ''); | ||
| 17 | -PersistentStorage.persistProp('indexSettingChannelId', 2002); | ||
| 18 | - | ||
| 19 | const storage = LocalStorage.getShared(); | 16 | const storage = LocalStorage.getShared(); |
| 20 | 17 | ||
| 21 | /** | 18 | /** |
| @@ -48,11 +45,11 @@ export struct TopNavigationComponentNew { | @@ -48,11 +45,11 @@ export struct TopNavigationComponentNew { | ||
| 48 | @State currentTopNavSelectedIndex: number = 0; | 45 | @State currentTopNavSelectedIndex: number = 0; |
| 49 | // 顶导数据 | 46 | // 顶导数据 |
| 50 | @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] | 47 | @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] |
| 51 | - @StorageProp('indexSettingChannelId') indexSettingChannelId: number = 2002 | 48 | + @State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002 |
| 52 | //我的频道id列表 | 49 | //我的频道id列表 |
| 53 | @State channelIds: number[] = [] | 50 | @State channelIds: number[] = [] |
| 54 | //本地缓存频道id列表 | 51 | //本地缓存频道id列表 |
| 55 | - @StorageProp('channelIds') storageChannelIds: string = '' | 52 | + @State storageChannelIds: string = AppStorage.get<string>('channelIds') || '' |
| 56 | @State homeChannelList: TopNavDTO[] = [] | 53 | @State homeChannelList: TopNavDTO[] = [] |
| 57 | // 我的频道列表 | 54 | // 我的频道列表 |
| 58 | @State myChannelList: TopNavDTO[] = [] | 55 | @State myChannelList: TopNavDTO[] = [] |
| @@ -191,7 +188,6 @@ export struct TopNavigationComponentNew { | @@ -191,7 +188,6 @@ export struct TopNavigationComponentNew { | ||
| 191 | this.topBar() | 188 | this.topBar() |
| 192 | ChannelSubscriptionLayout({ | 189 | ChannelSubscriptionLayout({ |
| 193 | currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | 190 | currentTopNavSelectedIndex: $currentTopNavSelectedIndex, |
| 194 | - indexSettingChannelId: this.indexSettingChannelId, | ||
| 195 | homeChannelList: this.homeChannelList, | 191 | homeChannelList: this.homeChannelList, |
| 196 | myChannelList: $myChannelList, | 192 | myChannelList: $myChannelList, |
| 197 | moreChannelList: $moreChannelList, | 193 | moreChannelList: $moreChannelList, |
| @@ -406,18 +402,29 @@ export struct TopNavigationComponentNew { | @@ -406,18 +402,29 @@ export struct TopNavigationComponentNew { | ||
| 406 | 402 | ||
| 407 | //频道分类 | 403 | //频道分类 |
| 408 | if (item.name !== '播报') { //暂时隐藏播报 | 404 | if (item.name !== '播报') { //暂时隐藏播报 |
| 409 | - if (item.myChannel === '1') { | 405 | + if (item.myChannel === '1' && !this.storageChannelIds) { |
| 410 | _myChannelList.push(item) | 406 | _myChannelList.push(item) |
| 411 | _channelIds.push(item.channelId) | 407 | _channelIds.push(item.channelId) |
| 412 | - } else if (item.moreChannel === '1') { | 408 | + } |
| 409 | + if (item.moreChannel === '1') { | ||
| 413 | this.moreChannelList.push(item) | 410 | this.moreChannelList.push(item) |
| 414 | - } else if (item.localChannel === '1' && item.myChannel !== '1') { | 411 | + } |
| 412 | + if (item.localChannel === '1' && item.myChannel !== '1') { | ||
| 415 | this.localChannelList.push(item) | 413 | this.localChannelList.push(item) |
| 416 | } | 414 | } |
| 417 | } | 415 | } |
| 418 | 416 | ||
| 419 | }) | 417 | }) |
| 420 | 418 | ||
| 419 | + if(this.storageChannelIds){ | ||
| 420 | + _storageChannelIds.forEach((_item:string)=>{ | ||
| 421 | + let index = defaultList.findIndex(ele => Number(_item) === ele.channelId) | ||
| 422 | + if(index > -1){ | ||
| 423 | + _myChannelList.push(defaultList[index]) | ||
| 424 | + _channelIds.push(defaultList[index].channelId) | ||
| 425 | + } | ||
| 426 | + }) | ||
| 427 | + } | ||
| 421 | if (cityName) { | 428 | if (cityName) { |
| 422 | let index = _myChannelList.findIndex(ele => cityName.includes(ele.name)) | 429 | let index = _myChannelList.findIndex(ele => cityName.includes(ele.name)) |
| 423 | const localChannelitem = _myChannelList.splice(index, 1)[0]; | 430 | const localChannelitem = _myChannelList.splice(index, 1)[0]; |
| @@ -466,10 +473,6 @@ export struct TopNavigationComponentNew { | @@ -466,10 +473,6 @@ export struct TopNavigationComponentNew { | ||
| 466 | this.changePage(this.currentTopNavSelectedIndex) | 473 | this.changePage(this.currentTopNavSelectedIndex) |
| 467 | } | 474 | } |
| 468 | 475 | ||
| 469 | - aboutToDisappear() { | ||
| 470 | - AppStorage.set('channelIds', this.channelIds.join(',')) | ||
| 471 | - } | ||
| 472 | - | ||
| 473 | onTopNavigationDataUpdated() { | 476 | onTopNavigationDataUpdated() { |
| 474 | Logger.info(TAG, | 477 | Logger.info(TAG, |
| 475 | `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`); | 478 | `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`); |
| @@ -466,7 +466,8 @@ export struct SearchResultContentComponent { | @@ -466,7 +466,8 @@ export struct SearchResultContentComponent { | ||
| 466 | rmhDesc: obj.introduction, | 466 | rmhDesc: obj.introduction, |
| 467 | userId: obj.userId, | 467 | userId: obj.userId, |
| 468 | userType: obj.userType, | 468 | userType: obj.userType, |
| 469 | - honoraryIcon:'' | 469 | + honoraryIcon:'', |
| 470 | + rmhPlatform:0 | ||
| 470 | } | 471 | } |
| 471 | if(rem.length>0){ | 472 | if(rem.length>0){ |
| 472 | rem.forEach(item=>{ | 473 | rem.forEach(item=>{ |
| @@ -491,7 +492,8 @@ export struct SearchResultContentComponent { | @@ -491,7 +492,8 @@ export struct SearchResultContentComponent { | ||
| 491 | rmhDesc: item.introduction, | 492 | rmhDesc: item.introduction, |
| 492 | userId: item.userId, | 493 | userId: item.userId, |
| 493 | userType: item.userType, | 494 | userType: item.userType, |
| 494 | - honoraryIcon:'' | 495 | + honoraryIcon:'', |
| 496 | + rmhPlatform:0 | ||
| 495 | } | 497 | } |
| 496 | } | 498 | } |
| 497 | }) | 499 | }) |
| 1 | +import { DisplayUtils, NumberFormatterUtils } from 'wdKit/Index' | ||
| 2 | +import { SPHelper } from 'wdKit'; | ||
| 3 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 4 | +import { SpConstants } from 'wdConstant/Index'; | ||
| 5 | +import measure from '@ohos.measure' | ||
| 6 | +import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index'; | ||
| 7 | +import { | ||
| 8 | + ContentDetailDTO, | ||
| 9 | +} from 'wdBean'; | ||
| 10 | +import { LiveModel } from '../../viewmodel/LiveModel'; | ||
| 11 | +import { HttpUtils } from 'wdNetwork/Index'; | ||
| 12 | + | ||
| 13 | +const TAG = 'LiveLikeComponent'; | ||
| 14 | + | ||
| 15 | +interface ILikeStyleResp { | ||
| 16 | + url: Resource; | ||
| 17 | + name: string; | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +@Component | ||
| 21 | +export struct LiveLikeComponent { | ||
| 22 | + private LiveModel: LiveModel = new LiveModel() | ||
| 23 | + @Prop @Watch('onDetailUpdated') contentDetailData: ContentDetailDTO | ||
| 24 | + @Prop pageComponentType: number | ||
| 25 | + @State likesStyle: string = "love" // 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福 | ||
| 26 | + @State likeStatus: boolean = false | ||
| 27 | + @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 | ||
| 28 | + styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) 3 透明背景 | ||
| 29 | + @State likeCount: number = 0 //点赞数 | ||
| 30 | + @State likeBean: Record<string, string> = {} | ||
| 31 | + pageParam: ParamType = {} | ||
| 32 | + PageName: string = '' | ||
| 33 | + | ||
| 34 | + //上层传值 样例 | ||
| 35 | + // this.data['contentId'] = '30035444649' //必须 | ||
| 36 | + // this.data['userName'] = '人民日报网友2kD2xW' | ||
| 37 | + // this.data['contentType'] = '8' //必须 | ||
| 38 | + // this.data['title'] = '开创两校交流先河!克罗地亚教育代表团访问同济大学' | ||
| 39 | + // this.data['userHeaderUrl'] = "" | ||
| 40 | + // this.data['channelId'] = "2059" //必须 | ||
| 41 | + // this.data['status'] = "1" | ||
| 42 | + // 内容用 是否开启点赞 1是 0否; | ||
| 43 | + // this.contentDetailData.openLikes == 1 | ||
| 44 | + async aboutToAppear() { | ||
| 45 | + this.onDetailUpdated() | ||
| 46 | + this.contentTrackingDict() | ||
| 47 | + } | ||
| 48 | + async onDetailUpdated() { | ||
| 49 | + // 2:竖屏直播页 4:横屏直播页 | ||
| 50 | + // 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福 | ||
| 51 | + this.likesStyle = this.contentDetailData?.liveInfo?.likesStyle | ||
| 52 | + this.openLikes = this.contentDetailData?.liveInfo?.likeEnable == 1 ? true : false | ||
| 53 | + console.log(TAG, 'this.contentDetailData', JSON.stringify(this.contentDetailData)) | ||
| 54 | + // 点赞需要数据 | ||
| 55 | + this.likeBean['contentId'] = this.contentDetailData.newsId + '' | ||
| 56 | + //获取点赞状态 | ||
| 57 | + this.getLikeStatus() | ||
| 58 | + //获取点赞数 | ||
| 59 | + this.getLikeCount() | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + contentTrackingDict(){ | ||
| 63 | + this.pageParam = { | ||
| 64 | + 'contentType': `${this.contentDetailData.newsType}`, | ||
| 65 | + 'contentId': `${this.contentDetailData.newsId}`, | ||
| 66 | + 'contentName': `${this.contentDetailData.newsTitle || ''}`, | ||
| 67 | + } | ||
| 68 | + if(this.contentDetailData.newsType == 2) { | ||
| 69 | + this.PageName = TrackConstants.PageName.Live_Detail // 直播 | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + build() { | ||
| 74 | + // 直播,点赞按钮底测有灰色圆角背景+右上点赞数量 | ||
| 75 | + this.likeCompStyle() | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * 将点赞样式转换为icon | ||
| 80 | + */ | ||
| 81 | + transLikeStyle(): ILikeStyleResp { | ||
| 82 | + if (this.likesStyle === 'love' || this.likesStyle === 'thumb') { | ||
| 83 | + return { | ||
| 84 | + url: this.likeStatus ? $r(`app.media.ic_like_check`) : | ||
| 85 | + this.styleType == 1 ? $r('app.media.icon_like_default') : $r(`app.media.ic_like_uncheck`), | ||
| 86 | + name: '赞' | ||
| 87 | + } | ||
| 88 | + } else if (this.likesStyle === 'pray') { | ||
| 89 | + return { | ||
| 90 | + url: this.likeStatus ? $r(`app.media.ic_thub_check`) : $r(`app.media.ic_thub_uncheck`), | ||
| 91 | + name: '祈祷' | ||
| 92 | + } | ||
| 93 | + } else if (this.likesStyle === 'mourning') { | ||
| 94 | + return { | ||
| 95 | + url: this.likeStatus ? $r(`app.media.ic_candle_check`) : | ||
| 96 | + $r(`app.media.ic_candle_uncheck`), | ||
| 97 | + name: '默哀' | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + return { | ||
| 101 | + url: this.likeStatus ? $r(`app.media.ic_like_check`) : | ||
| 102 | + this.styleType == 1 ? $r('app.media.icon_like_default') : $r(`app.media.ic_like_uncheck`), | ||
| 103 | + name: '点赞' | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + @Builder | ||
| 108 | + likeCompStyle() { | ||
| 109 | + Stack({ alignContent: Alignment.Bottom }) { | ||
| 110 | + Column() { | ||
| 111 | + Image(this.transLikeStyle().url) | ||
| 112 | + .width(24) | ||
| 113 | + .height(24) | ||
| 114 | + .onClick(() => { | ||
| 115 | + this.clickButtonEvent() | ||
| 116 | + }) | ||
| 117 | + } | ||
| 118 | + .justifyContent(FlexAlign.Center) | ||
| 119 | + .width(36) | ||
| 120 | + .height(36) | ||
| 121 | + .borderRadius(18) | ||
| 122 | + .backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : this.pageComponentType === 8 ? Color.Transparent : '#FFF5F5F5') | ||
| 123 | + Row() { | ||
| 124 | + Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) | ||
| 125 | + .fontSize(8) | ||
| 126 | + .fontColor(Color.White) | ||
| 127 | + .padding({ left: 8, right: 2 }) | ||
| 128 | + } | ||
| 129 | + .height(12) | ||
| 130 | + .alignItems(VerticalAlign.Center) | ||
| 131 | + .position({ x: '100%', y: 10 }) | ||
| 132 | + .markAnchor({ x: '100%' }) | ||
| 133 | + .backgroundImage($r('app.media.ic_like_back')) | ||
| 134 | + .backgroundImageSize({height: 13}) | ||
| 135 | + .width(this.getMeasureText(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) + | ||
| 136 | + 12) | ||
| 137 | + .visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden) | ||
| 138 | + } | ||
| 139 | + .width(36) | ||
| 140 | + .height(42) | ||
| 141 | + .visibility(this.likesStyle == 'empty' || !this.openLikes ? Visibility.None : Visibility.Visible) | ||
| 142 | + | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + async clickButtonEvent() { | ||
| 146 | + console.log(TAG, 'clickButtonEvent 点赞点击') | ||
| 147 | + // 未登录,跳转登录 | ||
| 148 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 149 | + if (!user_id) { | ||
| 150 | + console.log(TAG, '点赞点击,未登录') | ||
| 151 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 152 | + return | ||
| 153 | + } | ||
| 154 | + this.executeLike() | ||
| 155 | + | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + async executeLike() { | ||
| 159 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 160 | + if (!user_id) { | ||
| 161 | + console.log(TAG, '查询点赞状态,未登录') | ||
| 162 | + return | ||
| 163 | + } | ||
| 164 | + this.LiveModel.getLiveRoomNumberLike(this.likeBean['contentId'], 1, HttpUtils.getDeviceId()).then((data) => { | ||
| 165 | + | ||
| 166 | + console.log(TAG, '点赞接口调用成功', JSON.stringify(data)) | ||
| 167 | + this.likeCount++ | ||
| 168 | + | ||
| 169 | + }).catch(() => { | ||
| 170 | + }) | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + async getLikeStatus() { | ||
| 174 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 175 | + if (!user_id) { | ||
| 176 | + console.log(TAG, '查询点赞状态,未登录') | ||
| 177 | + return | ||
| 178 | + } | ||
| 179 | + this.LiveModel.getLiveLike(this.likeBean['contentId'], user_id, HttpUtils.getDeviceId()).then(data => { | ||
| 180 | + console.log(TAG, '查询点赞、收藏状态==', JSON.stringify(data)) | ||
| 181 | + this.likeStatus = data | ||
| 182 | + }).catch(() => { | ||
| 183 | + this.likeStatus = false | ||
| 184 | + }) | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + /** | ||
| 188 | + * 获取点赞数 | ||
| 189 | + */ | ||
| 190 | + getLikeCount() { | ||
| 191 | + this.LiveModel.getLiveRoomData(this.likeBean['contentId']).then(data => { | ||
| 192 | + console.log(TAG, '查询点赞、收藏数量 res', JSON.stringify(data)) | ||
| 193 | + if (data) { | ||
| 194 | + this.likeCount = Number(data.likeNum) | ||
| 195 | + } else { | ||
| 196 | + this.likeCount = 0 | ||
| 197 | + } | ||
| 198 | + }).catch(() => { | ||
| 199 | + this.likeCount = 0 | ||
| 200 | + }) | ||
| 201 | + } | ||
| 202 | + private getMeasureText(text: string) { | ||
| 203 | + let width = measure.measureText({ | ||
| 204 | + textContent: text, | ||
| 205 | + fontSize: 8, | ||
| 206 | + lineHeight: 12, | ||
| 207 | + constraintWidth: DisplayUtils.getDeviceWidth(), | ||
| 208 | + }) | ||
| 209 | + width = px2vp(width) | ||
| 210 | + return width | ||
| 211 | + } | ||
| 212 | +} |
| 1 | +import { NumberFormatterUtils, SPHelper, ToastUtils } from 'wdKit'; | ||
| 2 | +import promptAction from '@ohos.promptAction'; | ||
| 3 | +import { | ||
| 4 | + batchLikeAndCollectResult, | ||
| 5 | + batchLikeAndCollectParams, | ||
| 6 | + ContentDetailDTO, | ||
| 7 | + contentListParams, | ||
| 8 | + InteractDataDTO, | ||
| 9 | + postExecuteCollectRecordParams | ||
| 10 | +} from 'wdBean'; | ||
| 11 | +import router from '@ohos.router'; | ||
| 12 | +import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'; | ||
| 13 | +import { LiveLikeComponent } from './LiveLikeComponent'; | ||
| 14 | +import { CommentTabComponent, CommentIconComponent, } from '../comment/view/CommentTabComponent'; | ||
| 15 | +import { publishCommentModel } from '../comment/model/PublishCommentModel' | ||
| 16 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 17 | +import { PageRepository } from '../../repository/PageRepository'; | ||
| 18 | +import { SpConstants } from 'wdConstant/Index'; | ||
| 19 | +import { WDShare } from 'wdShare/Index'; | ||
| 20 | +import { EmitterEventId, EmitterUtils } from 'wdKit/Index' | ||
| 21 | +import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index'; | ||
| 22 | +import { CommentCustomDialog, CommentDialogInputContent } from '../comment/view/CommentCustomDialog'; | ||
| 23 | +import { HttpUtils } from 'wdNetwork/Index'; | ||
| 24 | + | ||
| 25 | +const TAG = 'LiveOperRowListView'; | ||
| 26 | + | ||
| 27 | +/** | ||
| 28 | + * 直播详情页底部通栏组件:包含返回、评论、点赞、收藏、分享 | ||
| 29 | + * 上层传值: | ||
| 30 | + * 1、(必传) contentDetailData---直播详情 | ||
| 31 | + * 2、(非必传) operationButtonList---组件展示条件, | ||
| 32 | + * ['comment', 'like', 'collect', 'share'],需要展示什么传什么 | ||
| 33 | + * comment--评论;like--点赞;collect--收藏;share--分享; | ||
| 34 | + * 注意:外层需注册 @Provide contentDetailData:contentDetailData = {} as contentDetailData | ||
| 35 | + * 传值示例: | ||
| 36 | + LiveOperRowListView({ | ||
| 37 | + | ||
| 38 | + contentDetailData: this.contentDetailData[0], | ||
| 39 | + operationButtonList: ['comment', 'like', 'collect', 'share'] | ||
| 40 | + }) | ||
| 41 | + */ | ||
| 42 | + | ||
| 43 | +@Preview | ||
| 44 | +@Component | ||
| 45 | +export struct LiveOperRowListView { | ||
| 46 | + private onBack: () => void = () => { | ||
| 47 | + } | ||
| 48 | + private onCommentInputFocus?: () => void | ||
| 49 | + private onCommentInputed?: (comment: CommentDialogInputContent) => void | ||
| 50 | + | ||
| 51 | + @Prop @Watch('onDetailUpdated') contentDetailData: ContentDetailDTO // 稿件详情 | ||
| 52 | + /** | ||
| 53 | + * 用于区分页面类型,在哪个页面嵌套就传相应的值 | ||
| 54 | + * 2:竖屏直播页 4:横屏直播页 | ||
| 55 | + * 8: 评论弹框内 | ||
| 56 | + */ | ||
| 57 | + @Prop pageComponentType?: number = -1 | ||
| 58 | + @Prop showBackIcon?: boolean = true | ||
| 59 | + @Prop operationButtonList?: string[] = ['comment', 'collect', 'share'] // 组件展示条件 | ||
| 60 | + @State needLike: boolean = true | ||
| 61 | + @State styleType: number = -1 | ||
| 62 | + @State bgColor: ResourceColor = Color.White | ||
| 63 | + @State interactData: InteractDataDTO = {} as InteractDataDTO | ||
| 64 | + @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | ||
| 65 | + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | ||
| 66 | + @State dialogController: CustomDialogController | null = null; | ||
| 67 | + pageParam: ParamType = {} | ||
| 68 | + PageName: string = '' | ||
| 69 | + @State likesStyle: number | string = "love" // 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福 | ||
| 70 | + @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 | ||
| 71 | + | ||
| 72 | + /// comment | ||
| 73 | + @State showCommentInput: boolean = false | ||
| 74 | + private banComment: boolean = true // 是否已禁言 | ||
| 75 | + private commentInputDialogController?: CustomDialogController | ||
| 76 | + @State publishCommentModel: publishCommentModel = new publishCommentModel() | ||
| 77 | + | ||
| 78 | + async aboutToAppear() { | ||
| 79 | + console.info(TAG, 'this.needLike', this.needLike) | ||
| 80 | + this.handleStyle() | ||
| 81 | + this.onDetailUpdated() | ||
| 82 | + this.contentTrackingDict() | ||
| 83 | + this.checkCanInputComment() | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + contentTrackingDict(){ | ||
| 87 | + this.pageParam = { | ||
| 88 | + 'contentType': `${this.contentDetailData.newsType}`, | ||
| 89 | + 'contentId': `${this.contentDetailData.newsId}`, | ||
| 90 | + 'contentName': `${this.contentDetailData.newsTitle || ''}`, | ||
| 91 | + } | ||
| 92 | + if(this.contentDetailData.newsType == 2) { | ||
| 93 | + this.PageName = TrackConstants.PageName.Live_Detail // 直播 | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + async onDetailUpdated() { | ||
| 98 | + console.info(TAG, 'this.styleType', this.styleType) | ||
| 99 | + this.handleStyle() | ||
| 100 | + if (!this.contentDetailData) { | ||
| 101 | + return | ||
| 102 | + } | ||
| 103 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 104 | + if (user_id) { | ||
| 105 | + this.getInteractDataStatus() | ||
| 106 | + } | ||
| 107 | + await this.queryContentInteractCount() | ||
| 108 | + | ||
| 109 | + console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData)) | ||
| 110 | + console.info(TAG, 'this.operationButtonList', JSON.stringify(this.operationButtonList)) | ||
| 111 | + // 评论需要数据 | ||
| 112 | + /* this.publishCommentModel.targetId = this.contentDetailData.newsId + '' | ||
| 113 | + this.publishCommentModel.targetRelId = this.contentDetailData.reLInfo?.relId + '' | ||
| 114 | + this.publishCommentModel.targetTitle = this.contentDetailData.newsTitle + '' | ||
| 115 | + this.publishCommentModel.targetRelType = this.contentDetailData.reLInfo?.relType + '' | ||
| 116 | + this.publishCommentModel.targetRelObjectId = this.contentDetailData.reLInfo?.relObjectId + '' | ||
| 117 | + this.publishCommentModel.keyArticle = this.contentDetailData.keyArticle + '' | ||
| 118 | + this.publishCommentModel.targetType = this.contentDetailData.newsType + ''*/ | ||
| 119 | + // 2:竖屏直播页 3:图集 4:横屏直播页 | ||
| 120 | + // 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福 | ||
| 121 | + this.likesStyle = this.contentDetailData?.liveInfo?.likesStyle | ||
| 122 | + this.openLikes = this.contentDetailData?.liveInfo?.likeEnable == 1 ? true : false | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + build() { | ||
| 126 | + // 直播详情页 | ||
| 127 | + | ||
| 128 | + Column() { | ||
| 129 | + if(this.styleType != 3) { | ||
| 130 | + Divider().strokeWidth(1).color(this.styleType == 1 ? '#F5F5F5' : this.styleType == 2 ? '#262626' : 'rgba(0,0,0,0)') | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { | ||
| 134 | + Row() { | ||
| 135 | + Column() { | ||
| 136 | + Image(this.styleType == 1 ? $r('app.media.icon_arrow_left') : | ||
| 137 | + $r('app.media.icon_arrow_left_white')) | ||
| 138 | + .width(24) | ||
| 139 | + .height(24) | ||
| 140 | + .aspectRatio(1) | ||
| 141 | + .interpolation(ImageInterpolation.High) | ||
| 142 | + } | ||
| 143 | + .width(48) | ||
| 144 | + .hoverEffect(HoverEffect.Scale) | ||
| 145 | + .visibility(this.showBackIcon ? Visibility.Visible : Visibility.None) | ||
| 146 | + .onClick(() => { | ||
| 147 | + if (this.onBack) { | ||
| 148 | + this.onBack() | ||
| 149 | + } | ||
| 150 | + router.back(); | ||
| 151 | + }) | ||
| 152 | + | ||
| 153 | + | ||
| 154 | + if (this.contentDetailData?.newsId) { | ||
| 155 | + ForEach(this.operationButtonList, (item: string, index: number) => { | ||
| 156 | + if (item == 'comment') { | ||
| 157 | + this.builderComment() | ||
| 158 | + } else if (item == 'like' && this.needLike) { | ||
| 159 | + this.builderLike() | ||
| 160 | + } else if (item == 'collect') { | ||
| 161 | + this.builderCollect() | ||
| 162 | + } else if (item == 'share') { | ||
| 163 | + this.builderShare() | ||
| 164 | + } else { | ||
| 165 | + } | ||
| 166 | + }) | ||
| 167 | + } | ||
| 168 | + } | ||
| 169 | + .width('100%') | ||
| 170 | + .justifyContent(FlexAlign.Start) | ||
| 171 | + } | ||
| 172 | + .width('100%') | ||
| 173 | + .backgroundColor(this.bgColor) | ||
| 174 | + .padding({ | ||
| 175 | + top: 10, | ||
| 176 | + // bottom: 10 | ||
| 177 | + bottom: `${this.bottomSafeHeight}px` | ||
| 178 | + // bottom: 50 | ||
| 179 | + }) | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + /** | ||
| 185 | + * 评论组件 | ||
| 186 | + */ | ||
| 187 | + @Builder | ||
| 188 | + builderComment() { | ||
| 189 | + Column() { | ||
| 190 | + if (this.showCommentInput) { | ||
| 191 | + Row() { | ||
| 192 | + Stack({ alignContent: Alignment.Start }) { | ||
| 193 | + RelativeContainer() { | ||
| 194 | + | ||
| 195 | + Image($r('app.media.comment_img_input_hui')) | ||
| 196 | + .objectFit(ImageFit.Fill) | ||
| 197 | + .resizable({ | ||
| 198 | + slice: { | ||
| 199 | + top: 1, | ||
| 200 | + left: 1, | ||
| 201 | + right: 20, | ||
| 202 | + bottom: 1 | ||
| 203 | + } | ||
| 204 | + }) | ||
| 205 | + .alignRules({ | ||
| 206 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 207 | + left: { anchor: "__container__", align: HorizontalAlign.Start }, | ||
| 208 | + right: { anchor: "__container__", align: HorizontalAlign.End }, | ||
| 209 | + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | ||
| 210 | + }) | ||
| 211 | + .id("Image") | ||
| 212 | + Text("说两句...") | ||
| 213 | + .fontSize(12) | ||
| 214 | + .fontColor('#999999') | ||
| 215 | + .margin({ left: 10 }) | ||
| 216 | + .alignRules({ | ||
| 217 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 218 | + left: { anchor: "__container__", align: HorizontalAlign.Start }, | ||
| 219 | + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | ||
| 220 | + }) | ||
| 221 | + .id("Text") | ||
| 222 | + } | ||
| 223 | + } | ||
| 224 | + } | ||
| 225 | + .height(30) | ||
| 226 | + .onClick(() => { | ||
| 227 | + if (this.onCommentInputFocus) { | ||
| 228 | + this.onCommentInputFocus() | ||
| 229 | + } | ||
| 230 | + this.showCommentDialog() | ||
| 231 | + }) | ||
| 232 | + } else { | ||
| 233 | + Blank() | ||
| 234 | + } | ||
| 235 | + } | ||
| 236 | + .layoutWeight(1) | ||
| 237 | + .margin({ left: 16 }) | ||
| 238 | + } | ||
| 239 | + | ||
| 240 | + /** | ||
| 241 | + * 点赞组件 | ||
| 242 | + */ | ||
| 243 | + @Builder | ||
| 244 | + builderLike() { | ||
| 245 | + Column() { | ||
| 246 | + LiveLikeComponent({ | ||
| 247 | + contentDetailData: this.contentDetailData, | ||
| 248 | + styleType: this.styleType, | ||
| 249 | + pageComponentType: this.pageComponentType | ||
| 250 | + }) | ||
| 251 | + } | ||
| 252 | + .width(48) | ||
| 253 | + .visibility(this.likesStyle == 4 || this.likesStyle == 'empty' || !this.openLikes ? Visibility.None : Visibility.Visible) | ||
| 254 | + } | ||
| 255 | + | ||
| 256 | + /** | ||
| 257 | + * 收藏组件 | ||
| 258 | + */ | ||
| 259 | + @Builder | ||
| 260 | + builderCollect() { | ||
| 261 | + | ||
| 262 | + Stack() { | ||
| 263 | + Image(this.newsStatusOfUser?.collectStatus == 1 ? $r('app.media.ic_collect_check1') : | ||
| 264 | + this.styleType == 1 ? $r('app.media.iv_live_comment_collect_un') : | ||
| 265 | + $r('app.media.iv_live_comment_collect_un_white')) | ||
| 266 | + .width(24) | ||
| 267 | + .height(24) | ||
| 268 | + .interpolation(ImageInterpolation.High) | ||
| 269 | + /*Text(`${this.interactData?.collectNum}`) | ||
| 270 | + .fontSize(8) | ||
| 271 | + .fontColor(Color.White) | ||
| 272 | + .height(12) | ||
| 273 | + .margin({ left: 6 }) | ||
| 274 | + .backgroundImage($r('app.media.comment_icon_number')) | ||
| 275 | + .offset({ | ||
| 276 | + x: 12 | ||
| 277 | + })*/ | ||
| 278 | + } | ||
| 279 | + .height(36) | ||
| 280 | + .width(48) | ||
| 281 | + .borderRadius(18) | ||
| 282 | + .backgroundColor(this.pageComponentType === 2 ? '#4D000000' : Color.Transparent) | ||
| 283 | + .onClick(() => { | ||
| 284 | + this.toggleCollectStatus() | ||
| 285 | + }) | ||
| 286 | + | ||
| 287 | + } | ||
| 288 | + | ||
| 289 | + /** | ||
| 290 | + * 分享组件 | ||
| 291 | + */ | ||
| 292 | + @Builder | ||
| 293 | + builderShare() { | ||
| 294 | + Column() { | ||
| 295 | + Image(this.styleType == 1 ? $r('app.media.iv_live_comment_share') : | ||
| 296 | + $r('app.media.iv_live_comment_share_white')) | ||
| 297 | + .width(24) | ||
| 298 | + .height(24) | ||
| 299 | + .aspectRatio(1) | ||
| 300 | + .interpolation(ImageInterpolation.High) | ||
| 301 | + .onClick((event: ClickEvent) => { | ||
| 302 | + // ToastUtils.showToast('分享为公共方法,待开发', 1000); | ||
| 303 | + this.share() | ||
| 304 | + }) | ||
| 305 | + } | ||
| 306 | + .justifyContent(FlexAlign.Center) | ||
| 307 | + .height(36) | ||
| 308 | + .width(48) | ||
| 309 | + .borderRadius(18) | ||
| 310 | + .backgroundColor(this.pageComponentType === 2 ? '#4D000000' : Color.Transparent) | ||
| 311 | + } | ||
| 312 | + | ||
| 313 | + handleStyle() { | ||
| 314 | + if (this.styleType == 1) { | ||
| 315 | + this.bgColor = Color.White | ||
| 316 | + } else if (this.styleType == 2) { | ||
| 317 | + this.bgColor = Color.Black | ||
| 318 | + } else if (this.styleType == 3) { | ||
| 319 | + this.bgColor = Color.Transparent | ||
| 320 | + } | ||
| 321 | + } | ||
| 322 | + | ||
| 323 | + share() { | ||
| 324 | + WDShare.shareContent(this.contentDetailData) | ||
| 325 | + } | ||
| 326 | + | ||
| 327 | + showCommentDialog() { | ||
| 328 | + if (this.contentDetailData.liveInfo.openComment != 1) { | ||
| 329 | + ToastUtils.showToast("暂时无法评论", 3000) | ||
| 330 | + return | ||
| 331 | + } | ||
| 332 | + //未登录,游客评论打开 | ||
| 333 | + if (!HttpUtils.isLogin() && this.contentDetailData.visitorComment == 1) { | ||
| 334 | + this.commentDialog() | ||
| 335 | + return | ||
| 336 | + } | ||
| 337 | + | ||
| 338 | + if (!HttpUtils.isLogin()) { | ||
| 339 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 340 | + return | ||
| 341 | + } | ||
| 342 | + if (this.banComment) { | ||
| 343 | + ToastUtils.showToast("暂时无法评论", 3000) | ||
| 344 | + return | ||
| 345 | + } | ||
| 346 | + this.commentDialog() | ||
| 347 | + } | ||
| 348 | + | ||
| 349 | + private commentDialog() { | ||
| 350 | + this.commentInputDialogController = new CustomDialogController({ | ||
| 351 | + builder: CommentCustomDialog({ | ||
| 352 | + onPublishBtnClick: (content: CommentDialogInputContent) => { | ||
| 353 | + if (this.banComment) { | ||
| 354 | + ToastUtils.showToast("暂时无法评论", 3000) | ||
| 355 | + } else if (this.onCommentInputed) { | ||
| 356 | + this.onCommentInputed(content) | ||
| 357 | + } | ||
| 358 | + this.commentInputDialogController?.close() | ||
| 359 | + return true | ||
| 360 | + }, | ||
| 361 | + publishCommentModel: this.publishCommentModel | ||
| 362 | + }), | ||
| 363 | + autoCancel: true, | ||
| 364 | + alignment: DialogAlignment.Bottom, | ||
| 365 | + customStyle: true, | ||
| 366 | + offset: { | ||
| 367 | + dx: 0, | ||
| 368 | + dy: -20 | ||
| 369 | + }, | ||
| 370 | + backgroundColor: "#50000000", | ||
| 371 | + }) | ||
| 372 | + this.publishCommentModel.rootCommentId = '-1'; | ||
| 373 | + this.publishCommentModel.parentId = '-1'; | ||
| 374 | + this.publishCommentModel.placeHolderText = "说两句..." | ||
| 375 | + this.commentInputDialogController?.open(); | ||
| 376 | + } | ||
| 377 | + | ||
| 378 | + // 已登录->查询用户对作品收藏状态 | ||
| 379 | + private async getInteractDataStatus() { | ||
| 380 | + try { | ||
| 381 | + const params: batchLikeAndCollectParams = { | ||
| 382 | + contentList: [ | ||
| 383 | + { | ||
| 384 | + contentId: this.contentDetailData?.newsId + '', | ||
| 385 | + contentType: this.contentDetailData?.newsType + '', | ||
| 386 | + contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '', | ||
| 387 | + } | ||
| 388 | + ] | ||
| 389 | + } | ||
| 390 | + console.info(TAG, '查询用户对作品收藏1', JSON.stringify(params)) | ||
| 391 | + // console.info(TAG, '查询用户对作品收藏11', JSON.stringify(params)) | ||
| 392 | + let data = await MultiPictureDetailViewModel.getInteractDataStatus(params) | ||
| 393 | + console.info(TAG, '查询用户对作品收藏22', JSON.stringify(data)) | ||
| 394 | + this.newsStatusOfUser = data[0]; | ||
| 395 | + } catch (exception) { | ||
| 396 | + // console.error(TAG, JSON.stringify(exception)) | ||
| 397 | + } | ||
| 398 | + } | ||
| 399 | + | ||
| 400 | + /** | ||
| 401 | + * 收藏、取消收藏 | ||
| 402 | + */ | ||
| 403 | + async toggleCollectStatus() { | ||
| 404 | + // 未登录,跳转登录 | ||
| 405 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 406 | + console.log(TAG, '收藏点击,登录', user_id) | ||
| 407 | + if (!user_id) { | ||
| 408 | + console.log(TAG, '收藏点击,用户未登录') | ||
| 409 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 410 | + return | ||
| 411 | + } | ||
| 412 | + const params: postExecuteCollectRecordParams = { | ||
| 413 | + status: this.newsStatusOfUser?.collectStatus === 1 ? '0' : '1', | ||
| 414 | + contentList: [{ | ||
| 415 | + contentId: this.contentDetailData?.newsId + '', | ||
| 416 | + contentType: this.contentDetailData?.newsType + '', | ||
| 417 | + relType: this.contentDetailData?.reLInfo?.relType || '' + '', | ||
| 418 | + contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '', | ||
| 419 | + }], | ||
| 420 | + | ||
| 421 | + } | ||
| 422 | + console.log(TAG, '收藏点击', JSON.stringify(params)) | ||
| 423 | + PageRepository.postExecuteCollectRecord(params).then(res => { | ||
| 424 | + if (this.newsStatusOfUser) { | ||
| 425 | + this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 | ||
| 426 | + if (this.newsStatusOfUser.collectStatus === 1) { | ||
| 427 | + promptAction.showToast({ message: '收藏成功' }) | ||
| 428 | + TrackingContent.collect(true,this.PageName,this.PageName,this.pageParam) | ||
| 429 | + } else { | ||
| 430 | + TrackingContent.collect(false,this.PageName,this.PageName,this.pageParam) | ||
| 431 | + } | ||
| 432 | + this.queryContentInteractCount() | ||
| 433 | + } | ||
| 434 | + console.log(TAG, '收藏点击 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser)) | ||
| 435 | + }) | ||
| 436 | + | ||
| 437 | + } | ||
| 438 | + | ||
| 439 | + /** | ||
| 440 | + * 查询点赞、收藏数量 | ||
| 441 | + */ | ||
| 442 | + queryContentInteractCount() { | ||
| 443 | + // console.error(TAG, 'contentDetailData2222', JSON.stringify(this.contentDetailData)) | ||
| 444 | + const params: contentListParams = { | ||
| 445 | + contentList: [{ | ||
| 446 | + contentId: this.contentDetailData?.newsId + '', | ||
| 447 | + contentType: this.contentDetailData?.newsType, | ||
| 448 | + }] | ||
| 449 | + } | ||
| 450 | + console.log(TAG, '查询点赞、收藏数量', JSON.stringify(params)) | ||
| 451 | + PageRepository.getContentInteract(params).then(res => { | ||
| 452 | + console.log(TAG, '查询点赞、收藏数量 res', JSON.stringify(res)) | ||
| 453 | + if (res.data) { | ||
| 454 | + this.interactData.likeNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.likeNum) | ||
| 455 | + this.interactData.collectNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.collectNum) | ||
| 456 | + this.interactData.commentNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.commentNum) | ||
| 457 | + } | ||
| 458 | + // console.log(TAG, '获取互动点赞等数据===', JSON.stringify(res)) | ||
| 459 | + console.log(TAG, 'this.interactData44', JSON.stringify(this.interactData)) | ||
| 460 | + }) | ||
| 461 | + } | ||
| 462 | + | ||
| 463 | + async checkCanInputComment() { | ||
| 464 | + // 允许评论,且大家聊没隐藏 | ||
| 465 | + let canComment = (this.contentDetailData.liveInfo.openComment == 1 && this.contentDetailData.liveInfo.liveStyle != 2) | ||
| 466 | + this.showCommentInput = canComment | ||
| 467 | + | ||
| 468 | + let mLiveId: string = this.contentDetailData.liveInfo.mlive.mliveId as string | ||
| 469 | + if (!HttpUtils.isLogin() || mLiveId == undefined) { | ||
| 470 | + return | ||
| 471 | + } | ||
| 472 | + | ||
| 473 | + // 查询是否被禁言 | ||
| 474 | + PageRepository.fetchLiveBarrageBan(mLiveId).then(res => { | ||
| 475 | + this.banComment = res.data as boolean | ||
| 476 | + this.showCommentInput = !this.banComment && canComment | ||
| 477 | + }) | ||
| 478 | + } | ||
| 479 | +} |
| @@ -3,7 +3,7 @@ import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' | @@ -3,7 +3,7 @@ import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' | ||
| 3 | import { WDRouterRule } from 'wdRouter/Index' | 3 | import { WDRouterRule } from 'wdRouter/Index' |
| 4 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog' | 4 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog' |
| 5 | import { Logger } from 'wdKit'; | 5 | import { Logger } from 'wdKit'; |
| 6 | -import { window } from '@kit.ArkUI'; | 6 | +import { font, window } from '@kit.ArkUI'; |
| 7 | 7 | ||
| 8 | /** | 8 | /** |
| 9 | * 读报纸半屏弹窗 | 9 | * 读报纸半屏弹窗 |
| @@ -56,6 +56,11 @@ export struct ENewspaperListDialog { | @@ -56,6 +56,11 @@ export struct ENewspaperListDialog { | ||
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | async aboutToAppear() { | 58 | async aboutToAppear() { |
| 59 | + //注册字体 | ||
| 60 | + font.registerFont({ | ||
| 61 | + familyName: 'BebasNeueBold', | ||
| 62 | + familySrc: $rawfile('font/BebasNeueBold.otf') | ||
| 63 | + }) | ||
| 59 | // 屏幕高度 - 滑动高度计算 | 64 | // 屏幕高度 - 滑动高度计算 |
| 60 | let windowClass: window.Window = await window.getLastWindow(getContext(this)); | 65 | let windowClass: window.Window = await window.getLastWindow(getContext(this)); |
| 61 | let changeHeight = 85 + 44 + px2vp(windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height) | 66 | let changeHeight = 85 + 44 + px2vp(windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height) |
| @@ -151,7 +156,7 @@ export struct ENewspaperListDialog { | @@ -151,7 +156,7 @@ export struct ENewspaperListDialog { | ||
| 151 | Column() { | 156 | Column() { |
| 152 | if (itemIndex == 0) { | 157 | if (itemIndex == 0) { |
| 153 | Text(item.pageNum + '版:' + item.pageName) | 158 | Text(item.pageNum + '版:' + item.pageName) |
| 154 | - .fontSize($r('app.float.font_size_14')) | 159 | + .fontSize($r('app.float.font_size_13')) |
| 155 | .fontColor($r('app.color.color_ED2800')) | 160 | .fontColor($r('app.color.color_ED2800')) |
| 156 | .fontWeight(600) | 161 | .fontWeight(600) |
| 157 | .width('100%') | 162 | .width('100%') |
| @@ -165,7 +170,7 @@ export struct ENewspaperListDialog { | @@ -165,7 +170,7 @@ export struct ENewspaperListDialog { | ||
| 165 | Column() { | 170 | Column() { |
| 166 | if (positionItem.shortTitle) { | 171 | if (positionItem.shortTitle) { |
| 167 | Text(positionItem.shortTitle) | 172 | Text(positionItem.shortTitle) |
| 168 | - .fontSize($r('app.float.font_size_14')) | 173 | + .fontSize($r('app.float.font_size_13')) |
| 169 | .fontColor($r('app.color.color_222222')) | 174 | .fontColor($r('app.color.color_222222')) |
| 170 | .fontWeight(600) | 175 | .fontWeight(600) |
| 171 | // .maxLines(2) | 176 | // .maxLines(2) |
| @@ -176,7 +181,7 @@ export struct ENewspaperListDialog { | @@ -176,7 +181,7 @@ export struct ENewspaperListDialog { | ||
| 176 | 181 | ||
| 177 | if (positionItem.title) { | 182 | if (positionItem.title) { |
| 178 | Text(positionItem.title) | 183 | Text(positionItem.title) |
| 179 | - .fontSize($r('app.float.font_size_17')) | 184 | + .fontSize($r('app.float.font_size_16')) |
| 180 | .fontColor($r('app.color.color_222222')) | 185 | .fontColor($r('app.color.color_222222')) |
| 181 | .fontWeight(600) | 186 | .fontWeight(600) |
| 182 | .margin({ | 187 | .margin({ |
| @@ -187,7 +192,7 @@ export struct ENewspaperListDialog { | @@ -187,7 +192,7 @@ export struct ENewspaperListDialog { | ||
| 187 | 192 | ||
| 188 | if (positionItem.downTitle) { | 193 | if (positionItem.downTitle) { |
| 189 | Text(positionItem.downTitle) | 194 | Text(positionItem.downTitle) |
| 190 | - .fontSize($r('app.float.font_size_14')) | 195 | + .fontSize($r('app.float.font_size_13')) |
| 191 | .fontColor($r('app.color.color_222222')) | 196 | .fontColor($r('app.color.color_222222')) |
| 192 | .fontWeight(600) | 197 | .fontWeight(600) |
| 193 | .margin({ | 198 | .margin({ |
| @@ -197,7 +202,7 @@ export struct ENewspaperListDialog { | @@ -197,7 +202,7 @@ export struct ENewspaperListDialog { | ||
| 197 | } | 202 | } |
| 198 | if (positionItem.newsTxt) { | 203 | if (positionItem.newsTxt) { |
| 199 | Text(positionItem.newsTxt) | 204 | Text(positionItem.newsTxt) |
| 200 | - .fontSize($r('app.float.font_size_14')) | 205 | + .fontSize($r('app.float.font_size_13')) |
| 201 | .fontColor($r('app.color.color_999999')) | 206 | .fontColor($r('app.color.color_999999')) |
| 202 | .lineHeight(25) | 207 | .lineHeight(25) |
| 203 | .margin({ | 208 | .margin({ |
| @@ -73,9 +73,9 @@ class MinePageDatasModel{ | @@ -73,9 +73,9 @@ class MinePageDatasModel{ | ||
| 73 | this.personalData.push(new MinePagePersonalFunctionsItem("关注",$r('app.media.mine_follow_icon'))) | 73 | this.personalData.push(new MinePagePersonalFunctionsItem("关注",$r('app.media.mine_follow_icon'))) |
| 74 | this.personalData.push(new MinePagePersonalFunctionsItem("收藏",$r('app.media.mine_collect_icon'))) | 74 | this.personalData.push(new MinePagePersonalFunctionsItem("收藏",$r('app.media.mine_collect_icon'))) |
| 75 | // this.personalData.push(new MinePagePersonalFunctionsItem("历史",$r('app.media.mine_history_icon'))) | 75 | // this.personalData.push(new MinePagePersonalFunctionsItem("历史",$r('app.media.mine_history_icon'))) |
| 76 | - this.personalData.push(new MinePagePersonalFunctionsItem("消息",$r('app.media.mine_msg_icon'))) | ||
| 77 | // this.personalData.push(new MinePagePersonalFunctionsItem("留言板",$r('app.media.mine_msgboard_icon'))) | 76 | // this.personalData.push(new MinePagePersonalFunctionsItem("留言板",$r('app.media.mine_msgboard_icon'))) |
| 78 | this.personalData.push(new MinePagePersonalFunctionsItem("预约",$r('app.media.mine_order_icon'))) | 77 | this.personalData.push(new MinePagePersonalFunctionsItem("预约",$r('app.media.mine_order_icon'))) |
| 78 | + this.personalData.push(new MinePagePersonalFunctionsItem("消息",$r('app.media.mine_msg_icon'))) | ||
| 79 | return this.personalData | 79 | return this.personalData |
| 80 | } | 80 | } |
| 81 | 81 | ||
| @@ -883,7 +883,8 @@ class MinePageDatasModel{ | @@ -883,7 +883,8 @@ class MinePageDatasModel{ | ||
| 883 | rmhDesc: obj.introduction, | 883 | rmhDesc: obj.introduction, |
| 884 | userId: obj.userId, | 884 | userId: obj.userId, |
| 885 | userType: obj.userType, | 885 | userType: obj.userType, |
| 886 | - honoraryIcon:'' | 886 | + honoraryIcon:'', |
| 887 | + rmhPlatform:0 | ||
| 887 | } | 888 | } |
| 888 | if(rem.length>0){ | 889 | if(rem.length>0){ |
| 889 | rem.forEach(item=>{ | 890 | rem.forEach(item=>{ |
| @@ -908,7 +909,8 @@ class MinePageDatasModel{ | @@ -908,7 +909,8 @@ class MinePageDatasModel{ | ||
| 908 | rmhDesc: item.introduction, | 909 | rmhDesc: item.introduction, |
| 909 | userId: item.userId, | 910 | userId: item.userId, |
| 910 | userType: item.userType, | 911 | userType: item.userType, |
| 911 | - honoraryIcon:'' | 912 | + honoraryIcon:'', |
| 913 | + rmhPlatform:0 | ||
| 912 | } | 914 | } |
| 913 | } | 915 | } |
| 914 | }) | 916 | }) |
| @@ -480,4 +480,11 @@ export class PageRepository { | @@ -480,4 +480,11 @@ export class PageRepository { | ||
| 480 | url = url + "?liveIdList=" + ids; | 480 | url = url + "?liveIdList=" + ids; |
| 481 | return WDHttp.get<ResponseDTO<LiveRoomDataBean[]>>(url) | 481 | return WDHttp.get<ResponseDTO<LiveRoomDataBean[]>>(url) |
| 482 | }; | 482 | }; |
| 483 | + | ||
| 484 | + static fetchLiveBarrageBan(mLiveId: string) { | ||
| 485 | + let url = HttpUrlUtils.getLiveBarrageHasBanUrl() | ||
| 486 | + url = url + "?mliveId=" + mLiveId | ||
| 487 | + return WDHttp.get<ResponseDTO<boolean>>(url) | ||
| 488 | + } | ||
| 489 | + | ||
| 483 | } | 490 | } |
| 1 | import { NetworkUtil, SPHelper } from 'wdKit'; | 1 | import { NetworkUtil, SPHelper } from 'wdKit'; |
| 2 | import { SpConstants } from 'wdConstant'; | 2 | import { SpConstants } from 'wdConstant'; |
| 3 | 3 | ||
| 4 | -async function onlyWifiLoadImg() : Promise<boolean> { | 4 | +async function onlyWifiLoadImg(): Promise<boolean> { |
| 5 | let loadImageOnlyWifiSwitch = await SPHelper.default.get(SpConstants.SETTING_WIFI_IMAGE_SWITCH, '') || false; | 5 | let loadImageOnlyWifiSwitch = await SPHelper.default.get(SpConstants.SETTING_WIFI_IMAGE_SWITCH, '') || false; |
| 6 | - let isNetConnected = NetworkUtil.isNetConnected(); | 6 | + if (!loadImageOnlyWifiSwitch) { |
| 7 | + // 开关没开,直接让加载图片 | ||
| 8 | + return true | ||
| 9 | + } | ||
| 7 | let netWorkStatus = NetworkUtil.getNetworkType(); | 10 | let netWorkStatus = NetworkUtil.getNetworkType(); |
| 8 | - | ||
| 9 | - if (isNetConnected) { | 11 | + // 开关打开,wifi下才加载图片 |
| 10 | if (netWorkStatus === NetworkUtil.TYPE_WIFI) { | 12 | if (netWorkStatus === NetworkUtil.TYPE_WIFI) { |
| 11 | - return true; | ||
| 12 | - } else { | ||
| 13 | - if (loadImageOnlyWifiSwitch) { | ||
| 14 | - return false | ||
| 15 | - } else { | ||
| 16 | - return true; | ||
| 17 | - } | ||
| 18 | - } | ||
| 19 | - } else { | ||
| 20 | - return false; | 13 | + return true |
| 21 | } | 14 | } |
| 15 | + return false | ||
| 22 | } | 16 | } |
| 23 | 17 | ||
| 24 | export { onlyWifiLoadImg } | 18 | export { onlyWifiLoadImg } |
| 1 | import { HttpUrlUtils, ResponseDTO } from 'wdNetwork'; | 1 | import { HttpUrlUtils, ResponseDTO } from 'wdNetwork'; |
| 2 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | 2 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; |
| 3 | import { Logger, ToastUtils, EmitterEventId, EmitterUtils } from 'wdKit'; | 3 | import { Logger, ToastUtils, EmitterEventId, EmitterUtils } from 'wdKit'; |
| 4 | -import { LiveDetailsBean, ReserveBean, ReserveItemBean, joinPeopleNum } from 'wdBean/Index'; | 4 | +import { LiveDetailsBean, ReserveBean, ReserveItemBean, joinPeopleNum, LiveRoomDataBean, ValueType } from 'wdBean/Index'; |
| 5 | 5 | ||
| 6 | const TAG = 'LiveModel' | 6 | const TAG = 'LiveModel' |
| 7 | 7 | ||
| @@ -73,6 +73,89 @@ export class LiveModel { | @@ -73,6 +73,89 @@ export class LiveModel { | ||
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | /** | 75 | /** |
| 76 | + * 获取直播数据 | ||
| 77 | + * @param liveId | ||
| 78 | + * @returns | ||
| 79 | + */ | ||
| 80 | + getLiveRoomData(liveId: string) { | ||
| 81 | + return new Promise<LiveRoomDataBean>((success, fail) => { | ||
| 82 | + HttpRequest.get<ResponseDTO<LiveRoomDataBean>>( | ||
| 83 | + HttpUrlUtils.getLiveRoomDataUrl() + `?liveId=${liveId}`, | ||
| 84 | + ).then((data: ResponseDTO<LiveRoomDataBean>) => { | ||
| 85 | + if (!data || !data.data) { | ||
| 86 | + fail("数据为空") | ||
| 87 | + return | ||
| 88 | + } | ||
| 89 | + if (data.code != 0) { | ||
| 90 | + fail(data.message) | ||
| 91 | + return | ||
| 92 | + } | ||
| 93 | + success(data.data) | ||
| 94 | + }, (error: Error) => { | ||
| 95 | + fail(error.message) | ||
| 96 | + Logger.debug(TAG + ":error ", error.toString()) | ||
| 97 | + }) | ||
| 98 | + }) | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + /** | ||
| 102 | + * 直播详情-C端点赞接口 | ||
| 103 | + * @param liveId | ||
| 104 | + * @param number | ||
| 105 | + * @param deviceId | ||
| 106 | + * @returns | ||
| 107 | + */ | ||
| 108 | + getLiveRoomNumberLike(liveId: string, number: number, deviceId: string | number) { | ||
| 109 | + return new Promise<number>((success, fail) => { | ||
| 110 | + HttpRequest.get<ResponseDTO<number>>( | ||
| 111 | + HttpUrlUtils.getLiveRoomNumberLikeUrl() + `?liveId=${liveId}&number=${number}&deviceId=${deviceId}`, | ||
| 112 | + ).then((data: ResponseDTO<number>) => { | ||
| 113 | + if (!data || !data.data) { | ||
| 114 | + fail("数据为空") | ||
| 115 | + return | ||
| 116 | + } | ||
| 117 | + if (data.code != 0) { | ||
| 118 | + fail(data.message) | ||
| 119 | + return | ||
| 120 | + } | ||
| 121 | + console.log('LiveLikeComponent data.data', data.data) | ||
| 122 | + success(data.data) | ||
| 123 | + }, (error: Error) => { | ||
| 124 | + fail(error.message) | ||
| 125 | + Logger.debug(TAG + ":error ", error.toString()) | ||
| 126 | + }) | ||
| 127 | + }) | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + /** | ||
| 131 | + * 直播详情-查询是否点赞接口 | ||
| 132 | + * @param liveId | ||
| 133 | + * @param userId | ||
| 134 | + * @param deviceId | ||
| 135 | + * @returns | ||
| 136 | + */ | ||
| 137 | + getLiveLike(liveId: string, userId: ValueType, deviceId: string | number) { | ||
| 138 | + return new Promise<boolean>((success, fail) => { | ||
| 139 | + HttpRequest.get<ResponseDTO<boolean>>( | ||
| 140 | + HttpUrlUtils.getLiveLikeUrl() + `?liveId=${liveId}&userId=${userId}&deviceId=${deviceId}`, | ||
| 141 | + ).then((data: ResponseDTO<boolean>) => { | ||
| 142 | + if (!data || !data.data) { | ||
| 143 | + fail("数据为空") | ||
| 144 | + return | ||
| 145 | + } | ||
| 146 | + if (data.code != 0) { | ||
| 147 | + fail(data.message) | ||
| 148 | + return | ||
| 149 | + } | ||
| 150 | + success(data.data) | ||
| 151 | + }, (error: Error) => { | ||
| 152 | + fail(error.message) | ||
| 153 | + Logger.debug(TAG + ":error ", error.toString()) | ||
| 154 | + }) | ||
| 155 | + }) | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + /** | ||
| 76 | * 查询预约状态 | 159 | * 查询预约状态 |
| 77 | * | 160 | * |
| 78 | [{"relationId":"500002824823","liveId":"20000120522"},{"relationId":"500002845517","liveId":"20000120782"}] | 161 | [{"relationId":"500002824823","liveId":"20000120522"},{"relationId":"500002845517","liveId":"20000120782"}] |
| @@ -17,6 +17,14 @@ | @@ -17,6 +17,14 @@ | ||
| 17 | "value": "13fp" | 17 | "value": "13fp" |
| 18 | }, | 18 | }, |
| 19 | { | 19 | { |
| 20 | + "name": "font_size_13_2", | ||
| 21 | + "value": "13.2fp" | ||
| 22 | + }, | ||
| 23 | + { | ||
| 24 | + "name": "font_size_13_5", | ||
| 25 | + "value": "13.5fp" | ||
| 26 | + }, | ||
| 27 | + { | ||
| 20 | "name": "font_size_14", | 28 | "name": "font_size_14", |
| 21 | "value": "14fp" | 29 | "value": "14fp" |
| 22 | }, | 30 | }, |
| 1 | import { Logger, ResourcesUtils, EmitterUtils, EmitterEventId } from 'wdKit'; | 1 | import { Logger, ResourcesUtils, EmitterUtils, EmitterEventId } from 'wdKit'; |
| 2 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | 2 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 3 | -import { ContentDetailDTO, InteractDataDTO } from 'wdBean'; | 3 | +import { ContentDetailDTO, GetPullAddressBean, InteractDataDTO } from 'wdBean'; |
| 4 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | 4 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; |
| 5 | 5 | ||
| 6 | const TAG = 'ContentDetailRequest'; | 6 | const TAG = 'ContentDetailRequest'; |
| @@ -208,6 +208,19 @@ export class ContentDetailRequest { | @@ -208,6 +208,19 @@ export class ContentDetailRequest { | ||
| 208 | return url; | 208 | return url; |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | + | ||
| 212 | + static getLiveRoomPullStreamUrl(vliveId:string){ | ||
| 213 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.PULL_STREAM_PATH | ||
| 214 | + url = url + vliveId | ||
| 215 | + return url; | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + static getLiveRoomPullStream(vliveId: string): Promise<ResponseDTO<GetPullAddressBean>> { | ||
| 219 | + let url = ContentDetailRequest.getLiveRoomPullStreamUrl(vliveId) | ||
| 220 | + return WDHttp.get<ResponseDTO<GetPullAddressBean>>(url) | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + | ||
| 211 | static getContentDetail(params: ContentDetailRequestParams): Promise<ResponseDTO<ContentDetailDTO[]>> { | 224 | static getContentDetail(params: ContentDetailRequestParams): Promise<ResponseDTO<ContentDetailDTO[]>> { |
| 212 | if (mock_switch) { | 225 | if (mock_switch) { |
| 213 | return ContentDetailRequest.getContentDetailDataMock(getContext()); | 226 | return ContentDetailRequest.getContentDetailDataMock(getContext()); |
| @@ -216,6 +229,8 @@ export class ContentDetailRequest { | @@ -216,6 +229,8 @@ export class ContentDetailRequest { | ||
| 216 | return WDHttp.get<ResponseDTO<ContentDetailDTO[]>>(url) | 229 | return WDHttp.get<ResponseDTO<ContentDetailDTO[]>>(url) |
| 217 | } | 230 | } |
| 218 | 231 | ||
| 232 | + | ||
| 233 | + | ||
| 219 | /** | 234 | /** |
| 220 | * 查询沉浸式视频频道推荐楼层数据 | 235 | * 查询沉浸式视频频道推荐楼层数据 |
| 221 | * @returns | 236 | * @returns |
| 1 | -import { Action, ContentDetailDTO } from 'wdBean/Index'; | 1 | +import { Action, ContentDetailDTO, GetPullAddressBean } from 'wdBean/Index'; |
| 2 | import { LiveViewModel } from '../viewModel/LiveViewModel'; | 2 | import { LiveViewModel } from '../viewModel/LiveViewModel'; |
| 3 | import router from '@ohos.router'; | 3 | import router from '@ohos.router'; |
| 4 | 4 | ||
| @@ -71,7 +71,6 @@ export struct DetailPlayLiveCommon { | @@ -71,7 +71,6 @@ export struct DetailPlayLiveCommon { | ||
| 71 | .then((data: Array<ContentDetailDTO>) => { | 71 | .then((data: Array<ContentDetailDTO>) => { |
| 72 | console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data)) | 72 | console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data)) |
| 73 | if (data) { | 73 | if (data) { |
| 74 | - | ||
| 75 | let detailData = data[0] | 74 | let detailData = data[0] |
| 76 | this.liveLandscape = | 75 | this.liveLandscape = |
| 77 | detailData?.liveInfo?.liveLandScape //String(this.contentDetailData?.liveInfo?.liveLandScape || '') | 76 | detailData?.liveInfo?.liveLandScape //String(this.contentDetailData?.liveInfo?.liveLandScape || '') |
| @@ -79,14 +78,7 @@ export struct DetailPlayLiveCommon { | @@ -79,14 +78,7 @@ export struct DetailPlayLiveCommon { | ||
| 79 | this.liveState = detailData.liveInfo?.liveState | 78 | this.liveState = detailData.liveInfo?.liveState |
| 80 | 79 | ||
| 81 | 80 | ||
| 82 | - if (this.liveState === 'wait' || this.liveLandscape === 'news') { | ||
| 83 | - this.contentDetailData = data[0] | ||
| 84 | - } else if (this.liveLandscape === 'general') { | ||
| 85 | - //todo 不加setTimeOut ,接口返回的数据 就没法让PlayerComponent #@Consume @Watch('updateData') liveDetailsBean 的updateData方法运行 | ||
| 86 | - setTimeout(() => { | ||
| 87 | this.contentDetailData = data[0] | 81 | this.contentDetailData = data[0] |
| 88 | - }, 10) | ||
| 89 | - } | ||
| 90 | 82 | ||
| 91 | console.log(TAG, '查询视频详情用于评论展示 openComment:', detailData.openComment) | 83 | console.log(TAG, '查询视频详情用于评论展示 openComment:', detailData.openComment) |
| 92 | this.publishCommentModel.targetId = String(detailData?.newsId || '') | 84 | this.publishCommentModel.targetId = String(detailData?.newsId || '') |
| @@ -107,7 +99,20 @@ export struct DetailPlayLiveCommon { | @@ -107,7 +99,20 @@ export struct DetailPlayLiveCommon { | ||
| 107 | if (detailData.liveInfo.liveState == 'end') { | 99 | if (detailData.liveInfo.liveState == 'end') { |
| 108 | this.playUrl = detailData.liveInfo.vlive[0].replayUri | 100 | this.playUrl = detailData.liveInfo.vlive[0].replayUri |
| 109 | } | 101 | } |
| 110 | - //console.error('XXXXZZZZ', "liveLandscape =" + this.liveLandscape + ' this.liveState =' + this.liveState) | 102 | + |
| 103 | + //人民号类型单独获取直播地址 | ||
| 104 | + if (detailData.rmhPlatform === 1) { | ||
| 105 | + | ||
| 106 | + let vliveId = detailData.liveInfo.vlive[0].vliveId as string | ||
| 107 | + console.error(TAG, 'vliveId==' + vliveId) | ||
| 108 | + this.liveViewModel.getLiveRoomPullAddress(vliveId) | ||
| 109 | + .then((data: GetPullAddressBean) => { | ||
| 110 | + console.log(TAG, ' GetPullAddressBean:', JSON.stringify(data)) | ||
| 111 | + | ||
| 112 | + }) | ||
| 113 | + | ||
| 114 | + } | ||
| 115 | + | ||
| 111 | } | 116 | } |
| 112 | }) | 117 | }) |
| 113 | } | 118 | } |
| @@ -7,7 +7,7 @@ import mediaquery from '@ohos.mediaquery'; | @@ -7,7 +7,7 @@ import mediaquery from '@ohos.mediaquery'; | ||
| 7 | import { Logger, WindowModel } from 'wdKit/Index'; | 7 | import { Logger, WindowModel } from 'wdKit/Index'; |
| 8 | import { router, window } from '@kit.ArkUI'; | 8 | import { router, window } from '@kit.ArkUI'; |
| 9 | import { WDAliPlayerController } from 'wdPlayer/Index'; | 9 | import { WDAliPlayerController } from 'wdPlayer/Index'; |
| 10 | -import { OperRowListView } from 'wdComponent/src/main/ets/components/view/OperRowListView'; | 10 | +import { LiveOperRowListView } from 'wdComponent'; |
| 11 | import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'; | 11 | import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'; |
| 12 | 12 | ||
| 13 | let TAG: string = 'DetailPlayLivePage'; | 13 | let TAG: string = 'DetailPlayLivePage'; |
| @@ -69,19 +69,22 @@ export struct DetailPlayLivePage { | @@ -69,19 +69,22 @@ export struct DetailPlayLivePage { | ||
| 69 | .layoutWeight(1) | 69 | .layoutWeight(1) |
| 70 | .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) | 70 | .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) |
| 71 | 71 | ||
| 72 | - OperRowListView({ | ||
| 73 | - componentType: 4, | 72 | + LiveOperRowListView({ |
| 74 | operationButtonList: ['comment', 'collect', 'share', 'like'], | 73 | operationButtonList: ['comment', 'collect', 'share', 'like'], |
| 75 | styleType: 1, | 74 | styleType: 1, |
| 76 | contentDetailData: this.contentDetailData, | 75 | contentDetailData: this.contentDetailData, |
| 77 | - publishCommentModel: this.publishCommentModel, | ||
| 78 | - showCommentIcon: false, | ||
| 79 | - onCommentFocus: () => { | 76 | + onCommentInputFocus: () => { |
| 80 | // 切换到大家聊 | 77 | // 切换到大家聊 |
| 81 | this.changeToTab = Math.random() | 78 | this.changeToTab = Math.random() |
| 79 | + }, | ||
| 80 | + onCommentInputed: (content) => { | ||
| 81 | + if (content.comment) { | ||
| 82 | + this.liveViewModel.sendComment(content.comment) | ||
| 83 | + } | ||
| 82 | } | 84 | } |
| 83 | }).visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) | 85 | }).visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) |
| 84 | 86 | ||
| 87 | + | ||
| 85 | // LiveCommentComponent({ heartNum: this.liveRoomDataBean.likeNum }) | 88 | // LiveCommentComponent({ heartNum: this.liveRoomDataBean.likeNum }) |
| 86 | // .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) | 89 | // .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) |
| 87 | } | 90 | } |
| 1 | import { HttpUrlUtils, ResponseDTO } from 'wdNetwork'; | 1 | import { HttpUrlUtils, ResponseDTO } from 'wdNetwork'; |
| 2 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | 2 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; |
| 3 | import { Logger, ToastUtils, EmitterEventId, EmitterUtils } from 'wdKit'; | 3 | import { Logger, ToastUtils, EmitterEventId, EmitterUtils } from 'wdKit'; |
| 4 | -import { ContentDetailDTO, LiveDetailsBean, LiveRoomBean, LiveRoomDataBean, ReserveItemBean } from 'wdBean/Index'; | 4 | +import { ContentDetailDTO, LiveDetailsBean, LiveRoomBean, LiveRoomDataBean, ReserveItemBean, ValueType } from 'wdBean/Index'; |
| 5 | import { ContentDetailRequest } from 'wdDetailPlayApi/Index'; | 5 | import { ContentDetailRequest } from 'wdDetailPlayApi/Index'; |
| 6 | 6 | ||
| 7 | const TAG = 'LiveModel' | 7 | const TAG = 'LiveModel' |
| @@ -151,6 +151,62 @@ export class LiveModel { | @@ -151,6 +151,62 @@ export class LiveModel { | ||
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | /** | 153 | /** |
| 154 | + * 直播详情-C端点赞接口 | ||
| 155 | + * @param liveId | ||
| 156 | + * @param number | ||
| 157 | + * @param deviceId | ||
| 158 | + * @returns | ||
| 159 | + */ | ||
| 160 | + getLiveRoomNumberLike(liveId: string, number: number, deviceId: string | number) { | ||
| 161 | + return new Promise<number>((success, fail) => { | ||
| 162 | + HttpRequest.get<ResponseDTO<number>>( | ||
| 163 | + HttpUrlUtils.getLiveRoomNumberLikeUrl() + `?liveId=${liveId}&number=${number}&deviceId=${deviceId}`, | ||
| 164 | + ).then((data: ResponseDTO<number>) => { | ||
| 165 | + if (!data || !data.data) { | ||
| 166 | + fail("数据为空") | ||
| 167 | + return | ||
| 168 | + } | ||
| 169 | + if (data.code != 0) { | ||
| 170 | + fail(data.message) | ||
| 171 | + return | ||
| 172 | + } | ||
| 173 | + success(data.data) | ||
| 174 | + }, (error: Error) => { | ||
| 175 | + fail(error.message) | ||
| 176 | + Logger.debug(TAG + ":error ", error.toString()) | ||
| 177 | + }) | ||
| 178 | + }) | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + /** | ||
| 182 | + * 直播详情-查询是否点赞接口 | ||
| 183 | + * @param liveId | ||
| 184 | + * @param userId | ||
| 185 | + * @param deviceId | ||
| 186 | + * @returns | ||
| 187 | + */ | ||
| 188 | + getLiveLike(liveId: string, userId: ValueType, deviceId: string | number) { | ||
| 189 | + return new Promise<boolean>((success, fail) => { | ||
| 190 | + HttpRequest.get<ResponseDTO<boolean>>( | ||
| 191 | + HttpUrlUtils.getLiveLikeUrl() + `?liveId=${liveId}&userId=${userId}&deviceId=${deviceId}`, | ||
| 192 | + ).then((data: ResponseDTO<boolean>) => { | ||
| 193 | + if (!data || !data.data) { | ||
| 194 | + fail("数据为空") | ||
| 195 | + return | ||
| 196 | + } | ||
| 197 | + if (data.code != 0) { | ||
| 198 | + fail(data.message) | ||
| 199 | + return | ||
| 200 | + } | ||
| 201 | + success(data.data) | ||
| 202 | + }, (error: Error) => { | ||
| 203 | + fail(error.message) | ||
| 204 | + Logger.debug(TAG + ":error ", error.toString()) | ||
| 205 | + }) | ||
| 206 | + }) | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + /** | ||
| 154 | * 获取直播预约状态 | 210 | * 获取直播预约状态 |
| 155 | * @param relationId | 211 | * @param relationId |
| 156 | * @param liveId | 212 | * @param liveId |
| 1 | -import { ContentDetailDTO, LiveDetailsBean, LiveRoomBean, LiveRoomDataBean } from 'wdBean/Index' | 1 | +import { ContentDetailDTO, |
| 2 | + GetPullAddressBean, | ||
| 3 | + LiveDetailsBean, LiveRoomBean, LiveRoomDataBean, ValueType } from 'wdBean/Index' | ||
| 4 | +import { ContentDetailRequest } from 'wdDetailPlayApi/Index' | ||
| 2 | 5 | ||
| 3 | import { ResponseDTO } from 'wdNetwork/Index' | 6 | import { ResponseDTO } from 'wdNetwork/Index' |
| 4 | import { LiveModel } from './LiveModel' | 7 | import { LiveModel } from './LiveModel' |
| @@ -24,6 +27,28 @@ export class LiveViewModel { | @@ -24,6 +27,28 @@ export class LiveViewModel { | ||
| 24 | 27 | ||
| 25 | } | 28 | } |
| 26 | 29 | ||
| 30 | + getLiveRoomPullAddress(vliveId:string){ | ||
| 31 | + // return new Promise<GetPullAddressBean>((success, fail) => { | ||
| 32 | + // this.liveModel.getContentDetail(contentId, relId, relType).then((data) => { | ||
| 33 | + // success(data) | ||
| 34 | + // }).catch((message: string) => { | ||
| 35 | + // fail(message) | ||
| 36 | + // }) | ||
| 37 | + // }) | ||
| 38 | + | ||
| 39 | + return new Promise<GetPullAddressBean>((success, fail) => { | ||
| 40 | + ContentDetailRequest.getLiveRoomPullStream(vliveId).then(async (resDTO: ResponseDTO<GetPullAddressBean>) => { | ||
| 41 | + console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data)) | ||
| 42 | + if (resDTO.data) { | ||
| 43 | + success(resDTO.data) | ||
| 44 | + } | ||
| 45 | + }).catch(() => { | ||
| 46 | + fail("数据为空") | ||
| 47 | + }) | ||
| 48 | + | ||
| 49 | + }) | ||
| 50 | + | ||
| 51 | + } | ||
| 27 | 52 | ||
| 28 | //直播详情 | 53 | //直播详情 |
| 29 | getLiveDetails(contentId: string, relId: string, relType: string) { | 54 | getLiveDetails(contentId: string, relId: string, relType: string) { |
| @@ -68,6 +93,26 @@ export class LiveViewModel { | @@ -68,6 +93,26 @@ export class LiveViewModel { | ||
| 68 | }) | 93 | }) |
| 69 | }) | 94 | }) |
| 70 | } | 95 | } |
| 96 | + // 直播详情-C端点赞接口 | ||
| 97 | + getLiveRoomNumberLike(liveId: string, number: number, deviceId: string | number) { | ||
| 98 | + return new Promise<number>((success, fail) => { | ||
| 99 | + this.liveModel.getLiveRoomNumberLike(liveId, number, deviceId).then((data) => { | ||
| 100 | + success(data) | ||
| 101 | + }).catch((message: string) => { | ||
| 102 | + fail(message) | ||
| 103 | + }) | ||
| 104 | + }) | ||
| 105 | + } | ||
| 106 | + // 直播详情-查询是否点赞接口 | ||
| 107 | + getLiveLike(liveId: string, userId: ValueType, deviceId: string | number) { | ||
| 108 | + return new Promise<boolean>((success, fail) => { | ||
| 109 | + this.liveModel.getLiveLike(liveId, userId, deviceId).then((data) => { | ||
| 110 | + success(data) | ||
| 111 | + }).catch((message: string) => { | ||
| 112 | + fail(message) | ||
| 113 | + }) | ||
| 114 | + }) | ||
| 115 | + } | ||
| 71 | 116 | ||
| 72 | //直播预约状态查询 | 117 | //直播预约状态查询 |
| 73 | getLiveAppointmentStatus(relationId: string, liveId: string) { | 118 | getLiveAppointmentStatus(relationId: string, liveId: string) { |
| @@ -90,4 +135,8 @@ export class LiveViewModel { | @@ -90,4 +135,8 @@ export class LiveViewModel { | ||
| 90 | }) | 135 | }) |
| 91 | }) | 136 | }) |
| 92 | } | 137 | } |
| 138 | + | ||
| 139 | + sendComment(comment: string) { | ||
| 140 | + | ||
| 141 | + } | ||
| 93 | } | 142 | } |
| @@ -12,6 +12,10 @@ import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment | @@ -12,6 +12,10 @@ import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment | ||
| 12 | 12 | ||
| 13 | const TAG: string = 'TabChatComponent'; | 13 | const TAG: string = 'TabChatComponent'; |
| 14 | 14 | ||
| 15 | +/** | ||
| 16 | + * | ||
| 17 | + * 非沉浸式---大家聊 | ||
| 18 | + */ | ||
| 15 | @Component | 19 | @Component |
| 16 | export struct TabChatComponent { | 20 | export struct TabChatComponent { |
| 17 | @State private pageModel: PageModel = new PageModel() | 21 | @State private pageModel: PageModel = new PageModel() |
| @@ -13,11 +13,9 @@ export struct TabComponent { | @@ -13,11 +13,9 @@ export struct TabComponent { | ||
| 13 | @State currentIndex: number = 0 | 13 | @State currentIndex: number = 0 |
| 14 | private controller: TabsController = new TabsController() | 14 | private controller: TabsController = new TabsController() |
| 15 | @Prop tabs: string[] = [] | 15 | @Prop tabs: string[] = [] |
| 16 | - | ||
| 17 | aboutToAppear(): void { | 16 | aboutToAppear(): void { |
| 18 | 17 | ||
| 19 | } | 18 | } |
| 20 | - | ||
| 21 | /** | 19 | /** |
| 22 | * 评论切换到大家聊 | 20 | * 评论切换到大家聊 |
| 23 | */ | 21 | */ |
| 1 | import { ContentDetailDTO, LiveDetailsBean } from 'wdBean/Index' | 1 | import { ContentDetailDTO, LiveDetailsBean } from 'wdBean/Index' |
| 2 | import { LiveCountdownComponent } from './LiveCountdownComponent' | 2 | import { LiveCountdownComponent } from './LiveCountdownComponent' |
| 3 | 3 | ||
| 4 | +/** | ||
| 5 | + * 非沉浸式---简介 | ||
| 6 | + */ | ||
| 4 | @Component | 7 | @Component |
| 5 | export struct TabInfoComponent { | 8 | export struct TabInfoComponent { |
| 6 | @Consume contentDetailData: ContentDetailDTO | 9 | @Consume contentDetailData: ContentDetailDTO |
| 1 | -import { ContentDetailDTO, LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index' | ||
| 2 | -import { EmptyComponent, ErrorComponent, ListHasNoMoreDataUI, WDViewDefaultType } from 'wdComponent/Index' | 1 | +import { ContentDetailDTO, LiveRoomItemBean } from 'wdBean/Index' |
| 2 | +import { CustomPullToRefresh, EmptyComponent, ErrorComponent, WDViewDefaultType } from 'wdComponent/Index' | ||
| 3 | import { TabLiveItemComponent } from './TabLiveItemComponent' | 3 | import { TabLiveItemComponent } from './TabLiveItemComponent' |
| 4 | import CustomRefreshLoadLayout from 'wdComponent/src/main/ets/components/page/CustomRefreshLoadLayout' | 4 | import CustomRefreshLoadLayout from 'wdComponent/src/main/ets/components/page/CustomRefreshLoadLayout' |
| 5 | import { RefreshLayoutBean } from 'wdComponent/src/main/ets/components/page/RefreshLayoutBean' | 5 | import { RefreshLayoutBean } from 'wdComponent/src/main/ets/components/page/RefreshLayoutBean' |
| 6 | import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel' | 6 | import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel' |
| 7 | import { ViewType } from 'wdConstant/Index' | 7 | import { ViewType } from 'wdConstant/Index' |
| 8 | -import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout' | ||
| 9 | -import { StringUtils } from 'wdKit/Index' | 8 | +import { LazyDataSource, StringUtils } from 'wdKit/Index' |
| 10 | import { LiveViewModel } from '../../viewModel/LiveViewModel' | 9 | import { LiveViewModel } from '../../viewModel/LiveViewModel' |
| 11 | import { Logger } from 'wdKit' | 10 | import { Logger } from 'wdKit' |
| 11 | +import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout' | ||
| 12 | +import { PeopleShipNoMoreData } from 'wdComponent/src/main/ets/components/reusable/PeopleShipNoMoreData' | ||
| 12 | 13 | ||
| 13 | const TAG: string = 'TabLiveComponent'; | 14 | const TAG: string = 'TabLiveComponent'; |
| 14 | 15 | ||
| @@ -18,9 +19,10 @@ const TAG: string = 'TabLiveComponent'; | @@ -18,9 +19,10 @@ const TAG: string = 'TabLiveComponent'; | ||
| 18 | @Component | 19 | @Component |
| 19 | export struct TabLiveComponent { | 20 | export struct TabLiveComponent { |
| 20 | liveViewModel: LiveViewModel = new LiveViewModel() | 21 | liveViewModel: LiveViewModel = new LiveViewModel() |
| 21 | - @State liveList: Array<LiveRoomItemBean> = [] | 22 | + @State liveList: LazyDataSource<LiveRoomItemBean> = new LazyDataSource(); |
| 22 | @Consume @Watch('updateData') contentDetailData: ContentDetailDTO | 23 | @Consume @Watch('updateData') contentDetailData: ContentDetailDTO |
| 23 | @State private pageModel: PageModel = new PageModel() | 24 | @State private pageModel: PageModel = new PageModel() |
| 25 | + private scroller: Scroller = new Scroller() | ||
| 24 | 26 | ||
| 25 | aboutToAppear(): void { | 27 | aboutToAppear(): void { |
| 26 | this.getLiveList() | 28 | this.getLiveList() |
| @@ -35,7 +37,19 @@ export struct TabLiveComponent { | @@ -35,7 +37,19 @@ export struct TabLiveComponent { | ||
| 35 | } else if (this.pageModel.viewType == ViewType.EMPTY) { | 37 | } else if (this.pageModel.viewType == ViewType.EMPTY) { |
| 36 | EmptyComponent({ emptyType: WDViewDefaultType.WDViewDefaultType_NoContent1 }) | 38 | EmptyComponent({ emptyType: WDViewDefaultType.WDViewDefaultType_NoContent1 }) |
| 37 | } else { | 39 | } else { |
| 40 | + CustomPullToRefresh({ | ||
| 41 | + alldata: this.liveList, | ||
| 42 | + scroller: this.scroller, | ||
| 43 | + hasMore: false, | ||
| 44 | + customList: () => { | ||
| 38 | this.ListLayout() | 45 | this.ListLayout() |
| 46 | + }, | ||
| 47 | + onRefresh: (resolve) => { | ||
| 48 | + this.pageModel.currentPage = 1 | ||
| 49 | + this.getLiveList(resolve) | ||
| 50 | + }, | ||
| 51 | + }) | ||
| 52 | + | ||
| 39 | } | 53 | } |
| 40 | } | 54 | } |
| 41 | .alignContent(Alignment.Top) | 55 | .alignContent(Alignment.Top) |
| @@ -46,32 +60,35 @@ export struct TabLiveComponent { | @@ -46,32 +60,35 @@ export struct TabLiveComponent { | ||
| 46 | 60 | ||
| 47 | @Builder | 61 | @Builder |
| 48 | ListLayout() { | 62 | ListLayout() { |
| 49 | - List() { | ||
| 50 | - ListItem() { | ||
| 51 | - // 下拉刷新 TODO 待对接新的下拉刷新组件 | ||
| 52 | - // RefreshLayout({ | ||
| 53 | - // refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage, | ||
| 54 | - // this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight) | ||
| 55 | - // }) | ||
| 56 | - } | ||
| 57 | 63 | ||
| 58 | - ForEach(this.liveList, (item: LiveRoomItemBean) => { | 64 | + List({ scroller: this.scroller }) { |
| 65 | + // 下拉刷新 | ||
| 66 | + LazyForEach(this.liveList, (item: LiveRoomItemBean, index: number) => { | ||
| 59 | ListItem() { | 67 | ListItem() { |
| 60 | TabLiveItemComponent({ item: item }) | 68 | TabLiveItemComponent({ item: item }) |
| 61 | } | 69 | } |
| 62 | - }) | 70 | + }, |
| 71 | + (item: LiveRoomItemBean, contentIndex: number) => JSON.stringify(item) | ||
| 72 | + ) | ||
| 63 | // 加载更多 | 73 | // 加载更多 |
| 64 | ListItem() { | 74 | ListItem() { |
| 65 | - if (this.pageModel.hasMore) { | ||
| 66 | - // LoadMoreLayout({ | ||
| 67 | - // refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage, | ||
| 68 | - // this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight) | ||
| 69 | - // }) | ||
| 70 | - } else { | ||
| 71 | - ListHasNoMoreDataUI() | 75 | + if (this.pageModel.hasMore && this.liveList && this.liveList.totalCount() > 0) { |
| 76 | + LoadMoreLayout({ isVisible: this.pageModel.hasMore }) | ||
| 77 | + } else if (!this.pageModel.hasMore && !this.pageModel.isLoading) { | ||
| 78 | + PeopleShipNoMoreData() | ||
| 79 | + } | ||
| 72 | } | 80 | } |
| 73 | } | 81 | } |
| 82 | + .edgeEffect(EdgeEffect.None) | ||
| 83 | + .scrollBar(BarState.Off) | ||
| 84 | + .onReachEnd(() => { | ||
| 85 | + Logger.debug(TAG, "触底了"); | ||
| 86 | + if (!this.pageModel.isLoading && this.pageModel.hasMore) { | ||
| 87 | + //加载分页数据 | ||
| 88 | + //this.currentPage++; | ||
| 89 | + this.getLiveList() | ||
| 74 | } | 90 | } |
| 91 | + }) | ||
| 75 | } | 92 | } |
| 76 | 93 | ||
| 77 | @Builder | 94 | @Builder |
| @@ -82,19 +99,35 @@ export struct TabLiveComponent { | @@ -82,19 +99,35 @@ export struct TabLiveComponent { | ||
| 82 | }) | 99 | }) |
| 83 | } | 100 | } |
| 84 | 101 | ||
| 85 | - getLiveList() { | 102 | + async getLiveList(resolve?: (value: string | PromiseLike<string>) => void) { |
| 86 | if (!this.contentDetailData || !this.contentDetailData.newsId) { | 103 | if (!this.contentDetailData || !this.contentDetailData.newsId) { |
| 87 | // 参数不够,直接拦截接口 | 104 | // 参数不够,直接拦截接口 |
| 88 | return | 105 | return |
| 89 | } | 106 | } |
| 107 | + if (this.pageModel.isLoading) { | ||
| 108 | + | ||
| 109 | + if (resolve) { | ||
| 110 | + resolve('已更新至最新') | ||
| 111 | + } | ||
| 112 | + return | ||
| 113 | + } | ||
| 114 | + this.pageModel.isLoading = true | ||
| 90 | this.pageModel.currentPage = 1 | 115 | this.pageModel.currentPage = 1 |
| 91 | this.liveViewModel.getLiveList( | 116 | this.liveViewModel.getLiveList( |
| 92 | this.pageModel.currentPage, | 117 | this.pageModel.currentPage, |
| 93 | this.contentDetailData?.liveInfo?.mlive?.mliveId, | 118 | this.contentDetailData?.liveInfo?.mlive?.mliveId, |
| 94 | - this.contentDetailData?.newsId+'', | 119 | + this.contentDetailData?.newsId + '', |
| 95 | 20) | 120 | 20) |
| 96 | .then( | 121 | .then( |
| 97 | (data) => { | 122 | (data) => { |
| 123 | + this.pageModel.isLoading = false | ||
| 124 | + if (resolve) { | ||
| 125 | + if (this.pageModel.currentPage == 1) { | ||
| 126 | + resolve('已更新至最新') | ||
| 127 | + } else { | ||
| 128 | + resolve('') | ||
| 129 | + } | ||
| 130 | + } | ||
| 98 | Logger.debug(TAG, '直播间数据:' + `${JSON.stringify(data)}`) | 131 | Logger.debug(TAG, '直播间数据:' + `${JSON.stringify(data)}`) |
| 99 | if (data.barrageResponses && data.barrageResponses.length > 0) { | 132 | if (data.barrageResponses && data.barrageResponses.length > 0) { |
| 100 | /** | 133 | /** |
| @@ -106,6 +139,10 @@ export struct TabLiveComponent { | @@ -106,6 +139,10 @@ export struct TabLiveComponent { | ||
| 106 | 3.内容:详情接口的简介,newIntroduction | 139 | 3.内容:详情接口的简介,newIntroduction |
| 107 | */ | 140 | */ |
| 108 | this.pageModel.viewType = ViewType.LOADED; | 141 | this.pageModel.viewType = ViewType.LOADED; |
| 142 | + if(this.pageModel.currentPage ===1){ | ||
| 143 | + this.liveList.clear() | ||
| 144 | + } | ||
| 145 | + | ||
| 109 | this.liveList.push(...data.barrageResponses) | 146 | this.liveList.push(...data.barrageResponses) |
| 110 | if (data.barrageResponses.length === this.pageModel.pageSize) { | 147 | if (data.barrageResponses.length === this.pageModel.pageSize) { |
| 111 | this.pageModel.currentPage++; | 148 | this.pageModel.currentPage++; |
| @@ -124,9 +161,11 @@ export struct TabLiveComponent { | @@ -124,9 +161,11 @@ export struct TabLiveComponent { | ||
| 124 | && this.contentDetailData.liveInfo.liveState != 'wait') { | 161 | && this.contentDetailData.liveInfo.liveState != 'wait') { |
| 125 | this.pageModel.viewType = ViewType.LOADED; | 162 | this.pageModel.viewType = ViewType.LOADED; |
| 126 | this.updateLiveListData() | 163 | this.updateLiveListData() |
| 164 | + this.pageModel.hasMore = false; | ||
| 127 | } else { | 165 | } else { |
| 128 | this.pageModel.viewType = ViewType.EMPTY; | 166 | this.pageModel.viewType = ViewType.EMPTY; |
| 129 | } | 167 | } |
| 168 | + | ||
| 130 | } | 169 | } |
| 131 | }, | 170 | }, |
| 132 | () => { | 171 | () => { |
| @@ -155,7 +194,7 @@ export struct TabLiveComponent { | @@ -155,7 +194,7 @@ export struct TabLiveComponent { | ||
| 155 | } | 194 | } |
| 156 | 195 | ||
| 157 | updateData() { | 196 | updateData() { |
| 158 | - if (this.liveList.length > 0) { | 197 | + if (this.liveList.totalCount() > 0) { |
| 159 | // TODO 拦截刷新?根据业务斟酌下 | 198 | // TODO 拦截刷新?根据业务斟酌下 |
| 160 | return | 199 | return |
| 161 | } | 200 | } |
| @@ -52,7 +52,6 @@ export struct TopPlayComponent { | @@ -52,7 +52,6 @@ export struct TopPlayComponent { | ||
| 52 | } else if (status === PlayerConstants.STATUS_COMPLETION) { | 52 | } else if (status === PlayerConstants.STATUS_COMPLETION) { |
| 53 | // 播放完成 | 53 | // 播放完成 |
| 54 | 54 | ||
| 55 | - | ||
| 56 | } else { | 55 | } else { |
| 57 | this.isError = false | 56 | this.isError = false |
| 58 | } | 57 | } |
| @@ -63,7 +62,6 @@ export struct TopPlayComponent { | @@ -63,7 +62,6 @@ export struct TopPlayComponent { | ||
| 63 | } | 62 | } |
| 64 | 63 | ||
| 65 | updateData() { | 64 | updateData() { |
| 66 | - | ||
| 67 | // 检测等待中的直播预告是否视频资源 | 65 | // 检测等待中的直播预告是否视频资源 |
| 68 | if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewType === 1 | 66 | if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewType === 1 |
| 69 | && this.contentDetailData.liveInfo.previewUrl && | 67 | && this.contentDetailData.liveInfo.previewUrl && |
| 1 | import { Action, ContentDetailDTO, LiveDetailsBean, LiveRoomDataBean, LiveRoomItemBean } from 'wdBean/Index' | 1 | import { Action, ContentDetailDTO, LiveDetailsBean, LiveRoomDataBean, LiveRoomItemBean } from 'wdBean/Index' |
| 2 | import { LiveCommentComponent } from 'wdComponent/Index' | 2 | import { LiveCommentComponent } from 'wdComponent/Index' |
| 3 | import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel' | 3 | import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel' |
| 4 | -import { OperRowListView } from 'wdComponent/src/main/ets/components/view/OperRowListView' | 4 | +import { LiveOperRowListView } from 'wdComponent' |
| 5 | import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel' | 5 | import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel' |
| 6 | import { DisplayDirection, SpConstants, ViewType } from 'wdConstant/Index' | 6 | import { DisplayDirection, SpConstants, ViewType } from 'wdConstant/Index' |
| 7 | import { ContentDetailRequest } from 'wdDetailPlayApi/Index' | 7 | import { ContentDetailRequest } from 'wdDetailPlayApi/Index' |
| @@ -112,14 +112,19 @@ export struct PlayerCommentComponent { | @@ -112,14 +112,19 @@ export struct PlayerCommentComponent { | ||
| 112 | .margin({ bottom: 20 }) | 112 | .margin({ bottom: 20 }) |
| 113 | 113 | ||
| 114 | // 收藏、分享、点赞是否需要根据字段显隐 | 114 | // 收藏、分享、点赞是否需要根据字段显隐 |
| 115 | - OperRowListView({ | 115 | + LiveOperRowListView({ |
| 116 | styleType: 3, | 116 | styleType: 3, |
| 117 | - componentType: 4, | ||
| 118 | pageComponentType: 2, // 竖屏直播页 | 117 | pageComponentType: 2, // 竖屏直播页 |
| 119 | operationButtonList: ['comment', 'collect', 'share', 'like'], | 118 | operationButtonList: ['comment', 'collect', 'share', 'like'], |
| 120 | contentDetailData: this.contentDetailData, | 119 | contentDetailData: this.contentDetailData, |
| 121 | - publishCommentModel: this.publishCommentModel, | ||
| 122 | - showCommentIcon: false, | 120 | + onCommentInputFocus: () => { |
| 121 | + | ||
| 122 | + }, | ||
| 123 | + onCommentInputed: (content) => { | ||
| 124 | + if (content.comment) { | ||
| 125 | + this.liveViewModel.sendComment(content.comment) | ||
| 126 | + } | ||
| 127 | + }, | ||
| 123 | onBack: () => { | 128 | onBack: () => { |
| 124 | WindowModel.shared.setWindowLayoutFullScreen(false) | 129 | WindowModel.shared.setWindowLayoutFullScreen(false) |
| 125 | WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) | 130 | WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) |
| @@ -28,7 +28,10 @@ export struct PlayerComponent { | @@ -28,7 +28,10 @@ export struct PlayerComponent { | ||
| 28 | this.playerController?.pause() | 28 | this.playerController?.pause() |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | - aboutToAppear(): void { | 31 | + async aboutToAppear(): Promise<void> { |
| 32 | + setTimeout(() => { | ||
| 33 | + this.updateData() | ||
| 34 | + }, 10) | ||
| 32 | } | 35 | } |
| 33 | 36 | ||
| 34 | async aboutToDisappear(): Promise<void> { | 37 | async aboutToDisappear(): Promise<void> { |
| @@ -36,6 +39,7 @@ export struct PlayerComponent { | @@ -36,6 +39,7 @@ export struct PlayerComponent { | ||
| 36 | await this.playerController?.pause() | 39 | await this.playerController?.pause() |
| 37 | await this.playerController?.stop() | 40 | await this.playerController?.stop() |
| 38 | await this.playerController?.release() | 41 | await this.playerController?.release() |
| 42 | + | ||
| 39 | } | 43 | } |
| 40 | 44 | ||
| 41 | updateData() { | 45 | updateData() { |
| @@ -58,6 +62,7 @@ export struct PlayerComponent { | @@ -58,6 +62,7 @@ export struct PlayerComponent { | ||
| 58 | this.liveStreamType = liveStreamType | 62 | this.liveStreamType = liveStreamType |
| 59 | this.playUrl = playUrl | 63 | this.playUrl = playUrl |
| 60 | } | 64 | } |
| 65 | + console.error("XXXXZZZZ", 'updateData ----liveState==>' + this.playUrl) | ||
| 61 | } | 66 | } |
| 62 | 67 | ||
| 63 | build() { | 68 | build() { |
| @@ -69,6 +74,7 @@ export struct PlayerComponent { | @@ -69,6 +74,7 @@ export struct PlayerComponent { | ||
| 69 | playerController: this.playerController, | 74 | playerController: this.playerController, |
| 70 | onLoad: () => { | 75 | onLoad: () => { |
| 71 | this.isCanplay = true | 76 | this.isCanplay = true |
| 77 | + console.error("XXXXZZZZ", '------2------------') | ||
| 72 | this.playerController?.firstPlay(this.playUrl); | 78 | this.playerController?.firstPlay(this.playUrl); |
| 73 | } | 79 | } |
| 74 | }) | 80 | }) |
| @@ -77,7 +83,7 @@ export struct PlayerComponent { | @@ -77,7 +83,7 @@ export struct PlayerComponent { | ||
| 77 | playerController: this.playerController, | 83 | playerController: this.playerController, |
| 78 | onLoad: () => { | 84 | onLoad: () => { |
| 79 | this.isCanplay = true | 85 | this.isCanplay = true |
| 80 | - console.error('WDAliPlayerController', '------1------------') | 86 | + console.error('XXXXZZZZ', '------1------------') |
| 81 | this.playerController?.firstPlay(this.playUrl); | 87 | this.playerController?.firstPlay(this.playUrl); |
| 82 | } | 88 | } |
| 83 | }).margin({ top: 195 }).height(211) | 89 | }).margin({ top: 195 }).height(211) |
| @@ -4,6 +4,7 @@ import { SpConstants } from 'wdConstant/Index' | @@ -4,6 +4,7 @@ import { SpConstants } from 'wdConstant/Index' | ||
| 4 | import { ContentDetailRequest, postInteractAccentionOperateParams } from 'wdDetailPlayApi/Index' | 4 | import { ContentDetailRequest, postInteractAccentionOperateParams } from 'wdDetailPlayApi/Index' |
| 5 | import { NumberFormatterUtils, DateTimeUtils, SPHelper } from 'wdKit/Index' | 5 | import { NumberFormatterUtils, DateTimeUtils, SPHelper } from 'wdKit/Index' |
| 6 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | 6 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' |
| 7 | +import { router } from '@kit.ArkUI' | ||
| 7 | 8 | ||
| 8 | const TAG = 'PlayerEndView' | 9 | const TAG = 'PlayerEndView' |
| 9 | 10 | ||
| @@ -15,9 +16,12 @@ export struct PlayerEndView { | @@ -15,9 +16,12 @@ export struct PlayerEndView { | ||
| 15 | @Consume liveRoomDataBean: LiveRoomDataBean | 16 | @Consume liveRoomDataBean: LiveRoomDataBean |
| 16 | @State duration: string = '' | 17 | @State duration: string = '' |
| 17 | @State followStatus: String = '0'; | 18 | @State followStatus: String = '0'; |
| 19 | + private onBack: () => void = () => { | ||
| 20 | + } | ||
| 18 | 21 | ||
| 19 | aboutToAppear(): void { | 22 | aboutToAppear(): void { |
| 20 | - const sn = DateTimeUtils.parseDate(this.contentDetailData.liveInfo.startTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN) | 23 | + const sn = |
| 24 | + DateTimeUtils.parseDate(this.contentDetailData.liveInfo.startTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN) | ||
| 21 | const en = DateTimeUtils.parseDate(this.contentDetailData.liveInfo.endTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN) | 25 | const en = DateTimeUtils.parseDate(this.contentDetailData.liveInfo.endTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN) |
| 22 | const sd = DateTimeUtils.getDuration(sn, en) | 26 | const sd = DateTimeUtils.getDuration(sn, en) |
| 23 | this.duration = DateTimeUtils.secondToTime(sd / 1000) | 27 | this.duration = DateTimeUtils.secondToTime(sd / 1000) |
| @@ -113,7 +117,12 @@ export struct PlayerEndView { | @@ -113,7 +117,12 @@ export struct PlayerEndView { | ||
| 113 | .fontWeight(400) | 117 | .fontWeight(400) |
| 114 | .fontSize(16) | 118 | .fontSize(16) |
| 115 | .fontColor(Color.White) | 119 | .fontColor(Color.White) |
| 116 | - .padding({ top: 8, bottom: 8, left: 122, right: 122 }) | 120 | + .padding({ |
| 121 | + top: 8, | ||
| 122 | + bottom: 8, | ||
| 123 | + left: 122, | ||
| 124 | + right: 122 | ||
| 125 | + }) | ||
| 117 | .backgroundColor(this.followStatus == '0' ? '#FFED2800' : Color.Grey) | 126 | .backgroundColor(this.followStatus == '0' ? '#FFED2800' : Color.Grey) |
| 118 | .borderRadius(4) | 127 | .borderRadius(4) |
| 119 | .onClick(() => { | 128 | .onClick(() => { |
| @@ -140,8 +149,30 @@ export struct PlayerEndView { | @@ -140,8 +149,30 @@ export struct PlayerEndView { | ||
| 140 | } | 149 | } |
| 141 | .width(307) | 150 | .width(307) |
| 142 | .padding({ top: 40 }) | 151 | .padding({ top: 40 }) |
| 152 | + | ||
| 153 | + Blank() | ||
| 154 | + | ||
| 155 | + // 返回按钮 | ||
| 156 | + Row() { | ||
| 157 | + Image($r('app.media.icon_arrow_left_white')) | ||
| 158 | + .width(24) | ||
| 159 | + .height(24) | ||
| 160 | + .aspectRatio(1) | ||
| 161 | + .interpolation(ImageInterpolation.High) | ||
| 162 | + .hoverEffect(HoverEffect.Scale) | ||
| 163 | + .margin({ bottom: 30 ,left:14}) | ||
| 164 | + .onClick(() => { | ||
| 165 | + if (this.onBack) { | ||
| 166 | + this.onBack() | ||
| 167 | + } | ||
| 168 | + router.back(); | ||
| 169 | + }) | ||
| 170 | + | ||
| 171 | + }.width('100%') | ||
| 172 | + | ||
| 143 | } | 173 | } |
| 144 | .height('100%') | 174 | .height('100%') |
| 175 | + .width('100%') | ||
| 145 | 176 | ||
| 146 | } | 177 | } |
| 147 | } | 178 | } |
| @@ -16,6 +16,7 @@ import { CommentDialogView } from '../view/CommentDialogView'; | @@ -16,6 +16,7 @@ import { CommentDialogView } from '../view/CommentDialogView'; | ||
| 16 | import { window } from '@kit.ArkUI'; | 16 | import { window } from '@kit.ArkUI'; |
| 17 | import { PlayerFullScreenView } from '../view/PlayerFullScreenView'; | 17 | import { PlayerFullScreenView } from '../view/PlayerFullScreenView'; |
| 18 | import { OperRowListView, publishCommentModel } from 'wdComponent/Index'; | 18 | import { OperRowListView, publishCommentModel } from 'wdComponent/Index'; |
| 19 | +import { ParamType, TrackConstants } from 'wdTracking/Index'; | ||
| 19 | 20 | ||
| 20 | const TAG = 'DetailPlayShortVideoPage'; | 21 | const TAG = 'DetailPlayShortVideoPage'; |
| 21 | 22 | ||
| @@ -49,6 +50,10 @@ export struct DetailPlayShortVideoPage { | @@ -49,6 +50,10 @@ export struct DetailPlayShortVideoPage { | ||
| 49 | @Consume showComment: boolean // 是否显示底部评论,首页视频频道传false | 50 | @Consume showComment: boolean // 是否显示底部评论,首页视频频道传false |
| 50 | @State imageVisible: boolean = true | 51 | @State imageVisible: boolean = true |
| 51 | @State ratio: number = 16 / 9 | 52 | @State ratio: number = 16 / 9 |
| 53 | + @State playerWidth: number | string = px2vp(this.windowWidth) | ||
| 54 | + @State playerHeight: number | string = px2vp(this.windowHeight) | ||
| 55 | + pageParam: ParamType = {} | ||
| 56 | + PageName: string = '' | ||
| 52 | 57 | ||
| 53 | /** | 58 | /** |
| 54 | * 页面显示重查用户关注、点赞等信息 | 59 | * 页面显示重查用户关注、点赞等信息 |
| @@ -91,7 +96,8 @@ export struct DetailPlayShortVideoPage { | @@ -91,7 +96,8 @@ export struct DetailPlayShortVideoPage { | ||
| 91 | } else { | 96 | } else { |
| 92 | this.queryNewsInfoOfUser() | 97 | this.queryNewsInfoOfUser() |
| 93 | if (!this.playerController.getPlayer()) { | 98 | if (!this.playerController.getPlayer()) { |
| 94 | - this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl || ''); | 99 | + this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl || '', this.PageName, |
| 100 | + this.PageName, this.pageParam); | ||
| 95 | } else { | 101 | } else { |
| 96 | await this.playerController.play() | 102 | await this.playerController.play() |
| 97 | this.imageVisible = false | 103 | this.imageVisible = false |
| @@ -165,7 +171,30 @@ export struct DetailPlayShortVideoPage { | @@ -165,7 +171,30 @@ export struct DetailPlayShortVideoPage { | ||
| 165 | } | 171 | } |
| 166 | this.queryNewsInfoOfUser() | 172 | this.queryNewsInfoOfUser() |
| 167 | 173 | ||
| 174 | + this.contentTrackingDict() | ||
| 175 | + } | ||
| 168 | 176 | ||
| 177 | + contentTrackingDict() { | ||
| 178 | + this.pageParam = { | ||
| 179 | + 'contentType': `${this.contentDetailData.newsType}`, | ||
| 180 | + 'contentId': `${this.contentDetailData.newsId}`, | ||
| 181 | + 'contentName': `${this.contentDetailData.newsTitle || ''}`, | ||
| 182 | + } | ||
| 183 | + if (this.contentDetailData.newsType == 1) { | ||
| 184 | + this.PageName = TrackConstants.PageName.VideoDetail // 点播 | ||
| 185 | + } else if (this.contentDetailData.newsType == 2) { | ||
| 186 | + this.PageName = TrackConstants.PageName.Live_Detail // 直播 | ||
| 187 | + } else if (this.contentDetailData.newsType == 5) { | ||
| 188 | + this.PageName = TrackConstants.PageName.Summary_Detail // 专题详情页 | ||
| 189 | + } else if (this.contentDetailData.newsType == 8) { | ||
| 190 | + this.PageName = TrackConstants.PageName.Article_Detail // 图文详情页 | ||
| 191 | + } else if (this.contentDetailData.newsType == 9) { | ||
| 192 | + this.PageName = TrackConstants.PageName.Atlas_Detail // 图集详情页 | ||
| 193 | + } else if (this.contentDetailData.newsType == 14 || this.contentDetailData.newsType == 15) { | ||
| 194 | + this.PageName = TrackConstants.PageName.DynamicDetail // 动态图文/动态视频 | ||
| 195 | + } | ||
| 196 | + console.log('视频详情页', JSON.stringify(this.pageParam)) | ||
| 197 | + console.log('视频详情页2', JSON.stringify(this.PageName)) | ||
| 169 | } | 198 | } |
| 170 | 199 | ||
| 171 | async aboutToDisappear(): Promise<void> { | 200 | async aboutToDisappear(): Promise<void> { |
| @@ -174,6 +203,32 @@ export struct DetailPlayShortVideoPage { | @@ -174,6 +203,32 @@ export struct DetailPlayShortVideoPage { | ||
| 174 | await this.playerController?.release(); | 203 | await this.playerController?.release(); |
| 175 | } | 204 | } |
| 176 | 205 | ||
| 206 | + /** | ||
| 207 | + * 屏幕变化动态计算播放器宽高 | ||
| 208 | + */ | ||
| 209 | + calculatePlayerRect() { | ||
| 210 | + let width = this.windowWidth | ||
| 211 | + let height = this.windowHeight | ||
| 212 | + if (this.displayDirection === DisplayDirection.VERTICAL) { | ||
| 213 | + width = this.windowWidth | ||
| 214 | + height = this.windowHeight | ||
| 215 | + } else { | ||
| 216 | + width = this.windowHeight | ||
| 217 | + height = this.windowWidth | ||
| 218 | + } | ||
| 219 | + // 视频宽高比屏幕大,则宽度撑满 | ||
| 220 | + if (this.ratio > width / height) { | ||
| 221 | + this.playerWidth = '100%' | ||
| 222 | + this.playerHeight = px2vp(width / this.ratio) | ||
| 223 | + } else { | ||
| 224 | + // 否则高度撑满 | ||
| 225 | + this.playerHeight = '100%' | ||
| 226 | + this.playerWidth = px2vp(height * this.ratio) | ||
| 227 | + } | ||
| 228 | + console.log('calculatePlayerRect=====', this.windowWidth, this.windowHeight) | ||
| 229 | + | ||
| 230 | + } | ||
| 231 | + | ||
| 177 | build() { | 232 | build() { |
| 178 | Stack({ alignContent: Alignment.Top }) { | 233 | Stack({ alignContent: Alignment.Top }) { |
| 179 | Column() { | 234 | Column() { |
| @@ -182,7 +237,8 @@ export struct DetailPlayShortVideoPage { | @@ -182,7 +237,8 @@ export struct DetailPlayShortVideoPage { | ||
| 182 | index: $index, | 237 | index: $index, |
| 183 | currentIndex: $currentIndex, | 238 | currentIndex: $currentIndex, |
| 184 | showCommentList: $showCommentList, | 239 | showCommentList: $showCommentList, |
| 185 | - publishCommentModel: $publishCommentModel | 240 | + publishCommentModel: $publishCommentModel, |
| 241 | + interactData: $interactData, | ||
| 186 | }) | 242 | }) |
| 187 | this.playerViewBuilder() | 243 | this.playerViewBuilder() |
| 188 | 244 | ||
| @@ -224,6 +280,7 @@ export struct DetailPlayShortVideoPage { | @@ -224,6 +280,7 @@ export struct DetailPlayShortVideoPage { | ||
| 224 | } | 280 | } |
| 225 | .height('100%') | 281 | .height('100%') |
| 226 | .width('100%') | 282 | .width('100%') |
| 283 | + .onAreaChange(() => this.calculatePlayerRect()) | ||
| 227 | 284 | ||
| 228 | } | 285 | } |
| 229 | 286 | ||
| @@ -237,9 +294,9 @@ export struct DetailPlayShortVideoPage { | @@ -237,9 +294,9 @@ export struct DetailPlayShortVideoPage { | ||
| 237 | Image(this.contentDetailData?.firstFrameImageUri) | 294 | Image(this.contentDetailData?.firstFrameImageUri) |
| 238 | .width('100%') | 295 | .width('100%') |
| 239 | .height(this.windowWidth / this.ratio + 'px') | 296 | .height(this.windowWidth / this.ratio + 'px') |
| 240 | - .opacity(this.imageVisible ? 1 : 0) | 297 | + .opacity(this.imageVisible ? 0.8 : 0) |
| 241 | .animation({ | 298 | .animation({ |
| 242 | - duration: 500, curve: Curve.EaseInOut | 299 | + duration: 350, curve: Curve.EaseInOut |
| 243 | }) | 300 | }) |
| 244 | } | 301 | } |
| 245 | 302 | ||
| @@ -250,12 +307,13 @@ export struct DetailPlayShortVideoPage { | @@ -250,12 +307,13 @@ export struct DetailPlayShortVideoPage { | ||
| 250 | playerController: this.playerController, | 307 | playerController: this.playerController, |
| 251 | onLoad: async () => { | 308 | onLoad: async () => { |
| 252 | if (this.contentDetailData != null && this.contentDetailData?.videoInfo[0] != null) { | 309 | if (this.contentDetailData != null && this.contentDetailData?.videoInfo[0] != null) { |
| 253 | - this.playerController.firstPlay(this.contentDetailData.videoInfo[0].videoUrl); | 310 | + this.playerController.firstPlay(this.contentDetailData.videoInfo[0].videoUrl, this.PageName, this.PageName, |
| 311 | + this.pageParam); | ||
| 254 | } | 312 | } |
| 255 | } | 313 | } |
| 256 | }) | 314 | }) |
| 257 | - .width(this.displayDirection === DisplayDirection.VERTICAL ? '100%' : this.windowWidth * 16 / 9 + 'px') | ||
| 258 | - .height(this.displayDirection === DisplayDirection.VERTICAL ? this.windowWidth / this.ratio + 'px' : '100%') | 315 | + .width(this.playerWidth) |
| 316 | + .height(this.playerHeight) | ||
| 259 | 317 | ||
| 260 | this.playerCoverBuilder() | 318 | this.playerCoverBuilder() |
| 261 | 319 |
| @@ -15,7 +15,7 @@ import { DisplayDirection } from 'wdConstant/Index'; | @@ -15,7 +15,7 @@ import { DisplayDirection } from 'wdConstant/Index'; | ||
| 15 | import { window } from '@kit.ArkUI'; | 15 | import { window } from '@kit.ArkUI'; |
| 16 | import { EmptyComponent, WDViewDefaultType } from 'wdComponent/Index'; | 16 | import { EmptyComponent, WDViewDefaultType } from 'wdComponent/Index'; |
| 17 | import { DateTimeUtils } from 'wdKit/Index'; | 17 | import { DateTimeUtils } from 'wdKit/Index'; |
| 18 | -import {TrackConstants,TrackingPageBrowse } from 'wdTracking/Index'; | 18 | +import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index'; |
| 19 | 19 | ||
| 20 | interface loadMoreData { | 20 | interface loadMoreData { |
| 21 | pageNum: number; | 21 | pageNum: number; |
| @@ -61,17 +61,17 @@ export struct VideoChannelDetail { | @@ -61,17 +61,17 @@ export struct VideoChannelDetail { | ||
| 61 | @State totalCount: number = 0 | 61 | @State totalCount: number = 0 |
| 62 | @State isMouted: boolean = false | 62 | @State isMouted: boolean = false |
| 63 | @State isRequestError: boolean = false | 63 | @State isRequestError: boolean = false |
| 64 | - pageShowTime:number = 0; | ||
| 65 | - pageHideTime:number = 0; | 64 | + @State isRequesting: boolean = false |
| 65 | + pageShowTime: number = 0; | ||
| 66 | + pageHideTime: number = 0; | ||
| 66 | 67 | ||
| 67 | autoRefreshChange() { | 68 | autoRefreshChange() { |
| 68 | - if (this.topNavIndex === 0) { | 69 | + if (this.topNavIndex === 0 && !this.isRequesting) { |
| 69 | this.data = [] | 70 | this.data = [] |
| 70 | this.interactDataList = [] | 71 | this.interactDataList = [] |
| 71 | this.totalCount = 0 | 72 | this.totalCount = 0 |
| 72 | this.isMouted = false | 73 | this.isMouted = false |
| 73 | this.getRecCompInfo() | 74 | this.getRecCompInfo() |
| 74 | - this.getRecCompInfo() | ||
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | } | 77 | } |
| @@ -95,8 +95,9 @@ export struct VideoChannelDetail { | @@ -95,8 +95,9 @@ export struct VideoChannelDetail { | ||
| 95 | console.log(TAG, '一级视频隐藏') | 95 | console.log(TAG, '一级视频隐藏') |
| 96 | this.pageHideTime = DateTimeUtils.getTimeStamp() | 96 | this.pageHideTime = DateTimeUtils.getTimeStamp() |
| 97 | let duration = 0 | 97 | let duration = 0 |
| 98 | - duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) | ||
| 99 | - TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal,duration) | 98 | + duration = Math.floor((this.pageHideTime - this.pageShowTime) / 1000) |
| 99 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Customer_Personal, | ||
| 100 | + TrackConstants.PageName.Customer_Personal, duration) | ||
| 100 | } | 101 | } |
| 101 | 102 | ||
| 102 | /** | 103 | /** |
| @@ -187,7 +188,7 @@ export struct VideoChannelDetail { | @@ -187,7 +188,7 @@ export struct VideoChannelDetail { | ||
| 187 | AlertDialog.show({ message: '没有更多视频了~' }) | 188 | AlertDialog.show({ message: '没有更多视频了~' }) |
| 188 | return | 189 | return |
| 189 | } | 190 | } |
| 190 | - | 191 | + this.isRequesting = true |
| 191 | const params: getRecCompInfoParams = { | 192 | const params: getRecCompInfoParams = { |
| 192 | groupId: this.groupId, | 193 | groupId: this.groupId, |
| 193 | pageId: this.pageId, | 194 | pageId: this.pageId, |
| @@ -237,6 +238,7 @@ export struct VideoChannelDetail { | @@ -237,6 +238,7 @@ export struct VideoChannelDetail { | ||
| 237 | }).catch(() => { | 238 | }).catch(() => { |
| 238 | // 获取内容失败请重试 | 239 | // 获取内容失败请重试 |
| 239 | this.isRequestError = true | 240 | this.isRequestError = true |
| 241 | + this.isRequesting = false | ||
| 240 | }) | 242 | }) |
| 241 | } | 243 | } |
| 242 | 244 | ||
| @@ -251,7 +253,14 @@ export struct VideoChannelDetail { | @@ -251,7 +253,14 @@ export struct VideoChannelDetail { | ||
| 251 | this.data = this.data.concat(res.data) | 253 | this.data = this.data.concat(res.data) |
| 252 | } | 254 | } |
| 253 | console.log('根据视频楼层信息批量查询视频列表', JSON.stringify(res.data)) | 255 | console.log('根据视频楼层信息批量查询视频列表', JSON.stringify(res.data)) |
| 256 | + }).finally(() => { | ||
| 257 | + setTimeout(() => { | ||
| 258 | + this.isRequesting = false | ||
| 259 | + }, 2000) | ||
| 260 | + | ||
| 254 | }) | 261 | }) |
| 262 | + } else { | ||
| 263 | + this.isRequesting = false | ||
| 255 | } | 264 | } |
| 256 | } | 265 | } |
| 257 | 266 | ||
| @@ -268,6 +277,7 @@ export struct VideoChannelDetail { | @@ -268,6 +277,7 @@ export struct VideoChannelDetail { | ||
| 268 | }) | 277 | }) |
| 269 | } | 278 | } |
| 270 | } | 279 | } |
| 280 | + | ||
| 271 | build() { | 281 | build() { |
| 272 | Column() { | 282 | Column() { |
| 273 | if (this.isRequestError) { | 283 | if (this.isRequestError) { |
| 1 | -import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index' | 1 | +import { ContentDetailDTO, InteractDataDTO, PageInfoDTO } from 'wdBean/Index' |
| 2 | 2 | ||
| 3 | import { CommentListDialogView, publishCommentModel } from 'wdComponent/Index' | 3 | import { CommentListDialogView, publishCommentModel } from 'wdComponent/Index' |
| 4 | 4 | ||
| @@ -9,6 +9,7 @@ export struct CommentDialogView { | @@ -9,6 +9,7 @@ export struct CommentDialogView { | ||
| 9 | @Link currentIndex: number | 9 | @Link currentIndex: number |
| 10 | @Link publishCommentModel: publishCommentModel | 10 | @Link publishCommentModel: publishCommentModel |
| 11 | @Consume contentDetailData: ContentDetailDTO | 11 | @Consume contentDetailData: ContentDetailDTO |
| 12 | + @Link interactData: InteractDataDTO | ||
| 12 | @State fakePageInfo: PageInfoDTO = {} as PageInfoDTO | 13 | @State fakePageInfo: PageInfoDTO = {} as PageInfoDTO |
| 13 | @State dialogOffsetY: number = 0 // (this.windowHeight - this.windowWidth * 9 / 16) | 14 | @State dialogOffsetY: number = 0 // (this.windowHeight - this.windowWidth * 9 / 16) |
| 14 | 15 | ||
| @@ -34,6 +35,9 @@ export struct CommentDialogView { | @@ -34,6 +35,9 @@ export struct CommentDialogView { | ||
| 34 | pageInfo: this.fakePageInfo, | 35 | pageInfo: this.fakePageInfo, |
| 35 | onClose: () => { | 36 | onClose: () => { |
| 36 | this.showCommentList = false | 37 | this.showCommentList = false |
| 38 | + if (Number.parseInt(this.publishCommentModel.totalCommentNumer) > Number.parseInt(this.interactData.commentNum + "")) { | ||
| 39 | + this.interactData.commentNum = Number.parseInt(this.publishCommentModel.totalCommentNumer) | ||
| 40 | + } | ||
| 37 | } | 41 | } |
| 38 | }) | 42 | }) |
| 39 | } | 43 | } |
| @@ -38,9 +38,8 @@ export struct PlayerRightView { | @@ -38,9 +38,8 @@ export struct PlayerRightView { | ||
| 38 | @Consume showCommentList: boolean | 38 | @Consume showCommentList: boolean |
| 39 | @Consume displayDirection: DisplayDirection | 39 | @Consume displayDirection: DisplayDirection |
| 40 | @Consume publishCommentModel: publishCommentModel | 40 | @Consume publishCommentModel: publishCommentModel |
| 41 | - // @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 41 | + @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 42 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 | 42 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 |
| 43 | - @State likesStyle: number | string = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | ||
| 44 | pageParam: ParamType = {} | 43 | pageParam: ParamType = {} |
| 45 | PageName: string = '' | 44 | PageName: string = '' |
| 46 | followUserId: string = '' | 45 | followUserId: string = '' |
| @@ -387,7 +386,7 @@ export struct PlayerRightView { | @@ -387,7 +386,7 @@ export struct PlayerRightView { | ||
| 387 | .width(32) | 386 | .width(32) |
| 388 | .aspectRatio(1) | 387 | .aspectRatio(1) |
| 389 | 388 | ||
| 390 | - Text(this.transNum2String('commentNum') || '抢首评') | 389 | + Text(this.interactData.commentNum > 0 ? this.transNum2String('commentNum') : '抢首评') |
| 391 | .width('100%') | 390 | .width('100%') |
| 392 | .fontWeight(500) | 391 | .fontWeight(500) |
| 393 | .textAlign(TextAlign.Center) | 392 | .textAlign(TextAlign.Center) |
| @@ -8,6 +8,8 @@ | @@ -8,6 +8,8 @@ | ||
| 8 | "version": "1.0.0", | 8 | "version": "1.0.0", |
| 9 | "dependencies": { | 9 | "dependencies": { |
| 10 | "wdKit": "file:../../commons/wdKit", | 10 | "wdKit": "file:../../commons/wdKit", |
| 11 | - "premierlibrary": "file:./libs/premierlibrary.har" | 11 | + "premierlibrary": "file:./libs/premierlibrary.har", |
| 12 | + "wdTracking": "file:../wdTracking", | ||
| 13 | + "wdBean": "file:../../features/wdBean" | ||
| 12 | } | 14 | } |
| 13 | } | 15 | } |
| @@ -7,12 +7,13 @@ import { | @@ -7,12 +7,13 @@ import { | ||
| 7 | paused, | 7 | paused, |
| 8 | stopped, | 8 | stopped, |
| 9 | completion, | 9 | completion, |
| 10 | - error} from 'premierlibrary/src/main/ets/com/aliyun/player/IPlayer'; | 10 | + error |
| 11 | +} from 'premierlibrary/src/main/ets/com/aliyun/player/IPlayer'; | ||
| 11 | 12 | ||
| 12 | import { initGlobalPlayerSettings, setupPlayerConfig } from '../utils/GlobalSetting'; | 13 | import { initGlobalPlayerSettings, setupPlayerConfig } from '../utils/GlobalSetting'; |
| 13 | import prompt from '@ohos.promptAction'; | 14 | import prompt from '@ohos.promptAction'; |
| 14 | import { PlayerConstants, AVPlayerStatus, Events } from '../constants/PlayerConstants'; | 15 | import { PlayerConstants, AVPlayerStatus, Events } from '../constants/PlayerConstants'; |
| 15 | -import { Logger } from 'wdKit/Index'; | 16 | +import { Logger, StringUtils } from 'wdKit/Index'; |
| 16 | 17 | ||
| 17 | const TAG = "WDAliPlayerController" | 18 | const TAG = "WDAliPlayerController" |
| 18 | 19 | ||
| @@ -26,7 +27,6 @@ const TAG = "WDAliPlayerController" | @@ -26,7 +27,6 @@ const TAG = "WDAliPlayerController" | ||
| 26 | export class WDAliPlayerController { | 27 | export class WDAliPlayerController { |
| 27 | private initPromise: Promise<void>; | 28 | private initPromise: Promise<void>; |
| 28 | private avPlayer?: AliPlayer; | 29 | private avPlayer?: AliPlayer; |
| 29 | - | ||
| 30 | // 内部播放器状态 | 30 | // 内部播放器状态 |
| 31 | private avPlayerStatus: number = idle | 31 | private avPlayerStatus: number = idle |
| 32 | private duration: number = 0; | 32 | private duration: number = 0; |
| @@ -38,18 +38,14 @@ export class WDAliPlayerController { | @@ -38,18 +38,14 @@ export class WDAliPlayerController { | ||
| 38 | private seekTime: number = 0; | 38 | private seekTime: number = 0; |
| 39 | private positionY: number = 0; | 39 | private positionY: number = 0; |
| 40 | private startTime: number = 0 | 40 | private startTime: number = 0 |
| 41 | - | ||
| 42 | public errorCode?: number | 41 | public errorCode?: number |
| 43 | public errorMesage?: string | 42 | public errorMesage?: string |
| 44 | - | ||
| 45 | public onVideoSizeChange?: (width: number, height: number) => void; | 43 | public onVideoSizeChange?: (width: number, height: number) => void; |
| 46 | public onBufferUpdate?: (buffered: number, duration: number) => void; | 44 | public onBufferUpdate?: (buffered: number, duration: number) => void; |
| 47 | public onTimeUpdate?: (position: number, duration: number) => void; | 45 | public onTimeUpdate?: (position: number, duration: number) => void; |
| 48 | public onVolumeUpdate?: (volume: number) => void; | 46 | public onVolumeUpdate?: (volume: number) => void; |
| 49 | - | ||
| 50 | // 播放完成,决定是否继续播放回调 | 47 | // 播放完成,决定是否继续播放回调 |
| 51 | public continue?: () => void; | 48 | public continue?: () => void; |
| 52 | - | ||
| 53 | // 准备完成,决定是否播放回调。如果不实现,则自动播放 | 49 | // 准备完成,决定是否播放回调。如果不实现,则自动播放 |
| 54 | public onCanplay?: () => void; | 50 | public onCanplay?: () => void; |
| 55 | public onStatusChange?: (status: number) => void; | 51 | public onStatusChange?: (status: number) => void; |
| @@ -117,12 +113,12 @@ export class WDAliPlayerController { | @@ -117,12 +113,12 @@ export class WDAliPlayerController { | ||
| 117 | onInfo: (bean: InfoBean) => { | 113 | onInfo: (bean: InfoBean) => { |
| 118 | 114 | ||
| 119 | if (bean.getCode() === InfoCode.CurrentPosition) { | 115 | if (bean.getCode() === InfoCode.CurrentPosition) { |
| 120 | - let position : number = bean.getExtraValue() | 116 | + let position: number = bean.getExtraValue() |
| 121 | Logger.debug(TAG, `播放进度条:${position}/ ${this.duration}`) | 117 | Logger.debug(TAG, `播放进度条:${position}/ ${this.duration}`) |
| 122 | this.initProgress(position); | 118 | this.initProgress(position); |
| 123 | 119 | ||
| 124 | } else if (bean.getCode() === InfoCode.BufferedPosition) { | 120 | } else if (bean.getCode() === InfoCode.BufferedPosition) { |
| 125 | - let buffer : number = bean.getExtraValue() | 121 | + let buffer: number = bean.getExtraValue() |
| 126 | if (this.onBufferUpdate) { | 122 | if (this.onBufferUpdate) { |
| 127 | this.onBufferUpdate(buffer, this.duration) | 123 | this.onBufferUpdate(buffer, this.duration) |
| 128 | } | 124 | } |
| @@ -140,7 +136,8 @@ export class WDAliPlayerController { | @@ -140,7 +136,8 @@ export class WDAliPlayerController { | ||
| 140 | switch (status) { | 136 | switch (status) { |
| 141 | case initalized: { | 137 | case initalized: { |
| 142 | //this.avPlayer?.prepare(); | 138 | //this.avPlayer?.prepare(); |
| 143 | - } break | 139 | + } |
| 140 | + break | ||
| 144 | case prepared: { | 141 | case prepared: { |
| 145 | if (this.startTime) { | 142 | if (this.startTime) { |
| 146 | this.setSeekTime(this.startTime, SliderChangeMode.Begin); | 143 | this.setSeekTime(this.startTime, SliderChangeMode.Begin); |
| @@ -154,20 +151,24 @@ export class WDAliPlayerController { | @@ -154,20 +151,24 @@ export class WDAliPlayerController { | ||
| 154 | } else { | 151 | } else { |
| 155 | this.play() | 152 | this.play() |
| 156 | } | 153 | } |
| 157 | - } break | 154 | + } |
| 155 | + break | ||
| 158 | case started: { | 156 | case started: { |
| 159 | this.setBright(); | 157 | this.setBright(); |
| 160 | this.status = PlayerConstants.STATUS_START; | 158 | this.status = PlayerConstants.STATUS_START; |
| 161 | this.watchStatus(); | 159 | this.watchStatus(); |
| 162 | - } break | 160 | + } |
| 161 | + break | ||
| 163 | case paused: { | 162 | case paused: { |
| 164 | this.status = PlayerConstants.STATUS_PAUSE; | 163 | this.status = PlayerConstants.STATUS_PAUSE; |
| 165 | this.watchStatus(); | 164 | this.watchStatus(); |
| 166 | - } break | 165 | + } |
| 166 | + break | ||
| 167 | case stopped: { | 167 | case stopped: { |
| 168 | this.status = PlayerConstants.STATUS_STOP; | 168 | this.status = PlayerConstants.STATUS_STOP; |
| 169 | this.watchStatus(); | 169 | this.watchStatus(); |
| 170 | - } break | 170 | + } |
| 171 | + break | ||
| 171 | case completion: { | 172 | case completion: { |
| 172 | this.status = PlayerConstants.STATUS_COMPLETION; | 173 | this.status = PlayerConstants.STATUS_COMPLETION; |
| 173 | this.watchStatus(); | 174 | this.watchStatus(); |
| @@ -179,7 +180,8 @@ export class WDAliPlayerController { | @@ -179,7 +180,8 @@ export class WDAliPlayerController { | ||
| 179 | //this.url = this.avPlayer.url || ''; | 180 | //this.url = this.avPlayer.url || ''; |
| 180 | //this.avPlayer.reset(); | 181 | //this.avPlayer.reset(); |
| 181 | } | 182 | } |
| 182 | - } break | 183 | + } |
| 184 | + break | ||
| 183 | case error: { | 185 | case error: { |
| 184 | // 这里拿不到错误信息 | 186 | // 这里拿不到错误信息 |
| 185 | // this.status = PlayerConstants.STATUS_ERROR; | 187 | // this.status = PlayerConstants.STATUS_ERROR; |
| @@ -189,7 +191,7 @@ export class WDAliPlayerController { | @@ -189,7 +191,7 @@ export class WDAliPlayerController { | ||
| 189 | } | 191 | } |
| 190 | }); | 192 | }); |
| 191 | this.avPlayer?.setOnErrorListener({ | 193 | this.avPlayer?.setOnErrorListener({ |
| 192 | - onError:(errorInfo) => { | 194 | + onError: (errorInfo) => { |
| 193 | Logger.error(TAG, "播放错误", JSON.stringify(errorInfo)) | 195 | Logger.error(TAG, "播放错误", JSON.stringify(errorInfo)) |
| 194 | this.errorCode = errorInfo.getCode() | 196 | this.errorCode = errorInfo.getCode() |
| 195 | this.errorMesage = errorInfo.getMsg() | 197 | this.errorMesage = errorInfo.getMsg() |
| @@ -220,21 +222,29 @@ export class WDAliPlayerController { | @@ -220,21 +222,29 @@ export class WDAliPlayerController { | ||
| 220 | } | 222 | } |
| 221 | 223 | ||
| 222 | private setAliPlayerURL(url: string) { | 224 | private setAliPlayerURL(url: string) { |
| 223 | - let urlSource : UrlSource = new UrlSource() | 225 | + let urlSource: UrlSource = new UrlSource() |
| 224 | urlSource.setUri(url) | 226 | urlSource.setUri(url) |
| 225 | this.avPlayer?.setUrlDataSource(urlSource) | 227 | this.avPlayer?.setUrlDataSource(urlSource) |
| 226 | } | 228 | } |
| 227 | 229 | ||
| 228 | - private getStatusStringWith(status: number) : string { | 230 | + private getStatusStringWith(status: number): string { |
| 229 | switch (status) { | 231 | switch (status) { |
| 230 | - case idle: return 'idle' | ||
| 231 | - case initalized: return 'initalized' | ||
| 232 | - case prepared: return 'prepared' | ||
| 233 | - case started: return 'started' | ||
| 234 | - case paused: return 'paused' | ||
| 235 | - case stopped: return 'stopped' | ||
| 236 | - case completion: return 'completion' | ||
| 237 | - case error: return 'error' | 232 | + case idle: |
| 233 | + return 'idle' | ||
| 234 | + case initalized: | ||
| 235 | + return 'initalized' | ||
| 236 | + case prepared: | ||
| 237 | + return 'prepared' | ||
| 238 | + case started: | ||
| 239 | + return 'started' | ||
| 240 | + case paused: | ||
| 241 | + return 'paused' | ||
| 242 | + case stopped: | ||
| 243 | + return 'stopped' | ||
| 244 | + case completion: | ||
| 245 | + return 'completion' | ||
| 246 | + case error: | ||
| 247 | + return 'error' | ||
| 238 | } | 248 | } |
| 239 | return 'unknow' | 249 | return 'unknow' |
| 240 | } | 250 | } |
| @@ -256,6 +266,10 @@ export class WDAliPlayerController { | @@ -256,6 +266,10 @@ export class WDAliPlayerController { | ||
| 256 | } | 266 | } |
| 257 | 267 | ||
| 258 | async firstPlay(url: string) { | 268 | async firstPlay(url: string) { |
| 269 | + if (StringUtils.isEmpty(url)) { | ||
| 270 | + return | ||
| 271 | + } | ||
| 272 | + | ||
| 259 | this.url = url; | 273 | this.url = url; |
| 260 | if (this.avPlayer == null) { | 274 | if (this.avPlayer == null) { |
| 261 | Logger.info(TAG, "等待播放器初始化") | 275 | Logger.info(TAG, "等待播放器初始化") |
| @@ -278,7 +292,7 @@ export class WDAliPlayerController { | @@ -278,7 +292,7 @@ export class WDAliPlayerController { | ||
| 278 | 292 | ||
| 279 | this.avPlayer?.setAutoPlay(false) | 293 | this.avPlayer?.setAutoPlay(false) |
| 280 | 294 | ||
| 281 | - Logger.debug(TAG, "开始播放", this.url) | 295 | + Logger.debug(TAG, "开始播放:"+ this.url) |
| 282 | this.setAliPlayerURL(this.url); | 296 | this.setAliPlayerURL(this.url); |
| 283 | 297 | ||
| 284 | Logger.info(TAG, "设置SurfaceId: " + this.surfaceId) | 298 | Logger.info(TAG, "设置SurfaceId: " + this.surfaceId) |
| @@ -3,6 +3,9 @@ import prompt from '@ohos.promptAction'; | @@ -3,6 +3,9 @@ import prompt from '@ohos.promptAction'; | ||
| 3 | import { Logger } from '../utils/Logger'; | 3 | import { Logger } from '../utils/Logger'; |
| 4 | import { PlayerConstants, AVPlayerStatus, Events } from '../constants/PlayerConstants'; | 4 | import { PlayerConstants, AVPlayerStatus, Events } from '../constants/PlayerConstants'; |
| 5 | import { BusinessError } from '@ohos.base'; | 5 | import { BusinessError } from '@ohos.base'; |
| 6 | +import { TrackingPlay } from 'wdTracking/Index'; | ||
| 7 | +import { ParamType } from 'wdTracking/Index'; | ||
| 8 | +import { DateTimeUtils } from 'wdKit/Index'; | ||
| 6 | 9 | ||
| 7 | @Observed | 10 | @Observed |
| 8 | export class WDPlayerController { | 11 | export class WDPlayerController { |
| @@ -17,6 +20,12 @@ export class WDPlayerController { | @@ -17,6 +20,12 @@ export class WDPlayerController { | ||
| 17 | private seekTime: number = 0; | 20 | private seekTime: number = 0; |
| 18 | private positionY: number = 0; | 21 | private positionY: number = 0; |
| 19 | private startTime: number = 0; | 22 | private startTime: number = 0; |
| 23 | + private pageParam: ParamType = {} | ||
| 24 | + private pageName: string = '' | ||
| 25 | + private creatStartTime:number = 0;//开始加载时间 | ||
| 26 | + private creatEndTime:number = 0;//加载完成时间 | ||
| 27 | + private prepareTime:number = 0; //加载时间 | ||
| 28 | + private currentPlayTime:number = 0; //当前播放时间 | ||
| 20 | public onVideoSizeChange?: (width: number, height: number) => void; | 29 | public onVideoSizeChange?: (width: number, height: number) => void; |
| 21 | public onTimeUpdate?: (position: number, duration: number) => void; | 30 | public onTimeUpdate?: (position: number, duration: number) => void; |
| 22 | public onVolumeUpdate?: (volume: number) => void; | 31 | public onVolumeUpdate?: (volume: number) => void; |
| @@ -28,6 +37,9 @@ export class WDPlayerController { | @@ -28,6 +37,9 @@ export class WDPlayerController { | ||
| 28 | public videoWidth: number = 0 | 37 | public videoWidth: number = 0 |
| 29 | public videoHeight: number = 0 | 38 | public videoHeight: number = 0 |
| 30 | 39 | ||
| 40 | + | ||
| 41 | + | ||
| 42 | + | ||
| 31 | constructor() { | 43 | constructor() { |
| 32 | Logger.error("初始化") | 44 | Logger.error("初始化") |
| 33 | this.initPromise = this.createAVPlayer(); | 45 | this.initPromise = this.createAVPlayer(); |
| @@ -123,6 +135,8 @@ export class WDPlayerController { | @@ -123,6 +135,8 @@ export class WDPlayerController { | ||
| 123 | }); | 135 | }); |
| 124 | this.avPlayer?.on(Events.ERROR, (error) => { | 136 | this.avPlayer?.on(Events.ERROR, (error) => { |
| 125 | this.playError(error.message); | 137 | this.playError(error.message); |
| 138 | + console.log('播放错误',JSON.stringify(error)) | ||
| 139 | + TrackingPlay.videoPlayError(error.message, this.pageName, this.pageName, this.pageParam) | ||
| 126 | }) | 140 | }) |
| 127 | this.avPlayer?.on('seekDone', (time: number) => { | 141 | this.avPlayer?.on('seekDone', (time: number) => { |
| 128 | this.initProgress(time); | 142 | this.initProgress(time); |
| @@ -148,10 +162,20 @@ export class WDPlayerController { | @@ -148,10 +162,20 @@ export class WDPlayerController { | ||
| 148 | this.surfaceId = surfaceId | 162 | this.surfaceId = surfaceId |
| 149 | } | 163 | } |
| 150 | 164 | ||
| 151 | - async firstPlay(url: string) { | 165 | + async firstPlay(url: string,pageId?: string, pageName?: string, pageParam?: ParamType) { |
| 152 | this.url = url; | 166 | this.url = url; |
| 167 | + //加载时长prepareTime | ||
| 168 | + this.creatStartTime = DateTimeUtils.getTimeStamp() | ||
| 169 | + console.log('开始创建',JSON.stringify(this.creatStartTime)) | ||
| 170 | + this.prepareTime = 0 | ||
| 171 | + if(pageName){ | ||
| 172 | + this.pageName = pageName | ||
| 173 | + } | ||
| 174 | + if(pageParam){ | ||
| 175 | + this.pageParam = pageParam | ||
| 176 | + } | ||
| 153 | if (this.avPlayer == null) { | 177 | if (this.avPlayer == null) { |
| 154 | - Logger.error("等待") | 178 | + console.log("等待") |
| 155 | await this.initPromise; | 179 | await this.initPromise; |
| 156 | } else { | 180 | } else { |
| 157 | if (this.avPlayer.state != AVPlayerStatus.IDLE) { | 181 | if (this.avPlayer.state != AVPlayerStatus.IDLE) { |
| @@ -164,8 +188,13 @@ export class WDPlayerController { | @@ -164,8 +188,13 @@ export class WDPlayerController { | ||
| 164 | if (this.avPlayer == null) { | 188 | if (this.avPlayer == null) { |
| 165 | return | 189 | return |
| 166 | } | 190 | } |
| 167 | - Logger.error("开始播放", this.url) | 191 | + console.log("开始播放", this.url) |
| 168 | this.avPlayer.url = this.url; | 192 | this.avPlayer.url = this.url; |
| 193 | + //加载时长prepareTime | ||
| 194 | + this.creatEndTime = DateTimeUtils.getTimeStamp() | ||
| 195 | + this.prepareTime = 0 | ||
| 196 | + this.prepareTime = Math.floor((this.creatEndTime - this.creatStartTime)/1000) | ||
| 197 | + console.log('开始播放2',JSON.stringify(this.prepareTime)) | ||
| 169 | } | 198 | } |
| 170 | 199 | ||
| 171 | async release() { | 200 | async release() { |
| @@ -271,6 +300,7 @@ export class WDPlayerController { | @@ -271,6 +300,7 @@ export class WDPlayerController { | ||
| 271 | } | 300 | } |
| 272 | if (mode === SliderChangeMode.End) { | 301 | if (mode === SliderChangeMode.End) { |
| 273 | this.seekTime = Math.floor(value * this.duration / 100); | 302 | this.seekTime = Math.floor(value * this.duration / 100); |
| 303 | + this.currentPlayTime = this.seekTime | ||
| 274 | this.avPlayer?.seek(this.seekTime); | 304 | this.avPlayer?.seek(this.seekTime); |
| 275 | } | 305 | } |
| 276 | } | 306 | } |
| @@ -288,6 +318,7 @@ export class WDPlayerController { | @@ -288,6 +318,7 @@ export class WDPlayerController { | ||
| 288 | } | 318 | } |
| 289 | 319 | ||
| 290 | initProgress(time: number) { | 320 | initProgress(time: number) { |
| 321 | + this.currentPlayTime=Math.floor(time / 1000); | ||
| 291 | let nowSeconds = Math.floor(time / 1000); | 322 | let nowSeconds = Math.floor(time / 1000); |
| 292 | let totalSeconds = Math.floor(this.duration / 1000); | 323 | let totalSeconds = Math.floor(this.duration / 1000); |
| 293 | if (this.onTimeUpdate) { | 324 | if (this.onTimeUpdate) { |
| @@ -357,6 +388,24 @@ export class WDPlayerController { | @@ -357,6 +388,24 @@ export class WDPlayerController { | ||
| 357 | 388 | ||
| 358 | watchStatus() { | 389 | watchStatus() { |
| 359 | console.log('watchStatus', this.status) | 390 | console.log('watchStatus', this.status) |
| 391 | + if(this.status == 1){ | ||
| 392 | + console.log('播放视频') | ||
| 393 | + console.log('播放视频prepareTime',JSON.stringify(this.prepareTime)) | ||
| 394 | + console.log('播放视频pageName',JSON.stringify(this.pageName)) | ||
| 395 | + console.log('播放视频pageParam',JSON.stringify(this.pageParam)) | ||
| 396 | + // 播放埋点 | ||
| 397 | + TrackingPlay.videoPositivePlay(Number(this.prepareTime),this.pageName, this.pageName, this.pageParam) | ||
| 398 | + } | ||
| 399 | + if(this.status == 2){ | ||
| 400 | + let initDuration = Math.floor(Number(this.duration)/1000) | ||
| 401 | + console.log('播放结束') | ||
| 402 | + console.log('播放结束currentPlayTime',JSON.stringify(this.currentPlayTime)) | ||
| 403 | + console.log('播放结束initDuration',JSON.stringify(initDuration)) | ||
| 404 | + console.log('播放结束pageName',JSON.stringify(this.pageName)) | ||
| 405 | + console.log('播放结束pageParam',JSON.stringify(this.pageParam)) | ||
| 406 | + // 播放结束埋点 | ||
| 407 | + TrackingPlay.videoPlayEnd(this.currentPlayTime, initDuration, this.currentPlayTime, this.pageName, this.pageName, this.pageParam) | ||
| 408 | + } | ||
| 360 | if (this.onStatusChange) { | 409 | if (this.onStatusChange) { |
| 361 | this.onStatusChange(this.status) | 410 | this.onStatusChange(this.status) |
| 362 | } | 411 | } |
| @@ -25,7 +25,7 @@ export class TrackingPlay { | @@ -25,7 +25,7 @@ export class TrackingPlay { | ||
| 25 | Tracking.event("video_positive_pybk", params) | 25 | Tracking.event("video_positive_pybk", params) |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | - // 视频 播放结束 | 28 | + // 视频 播放结束 currentPlayTime:当前时长,totalTime:总时长 ,browseTime:浏览时长, |
| 29 | static videoPlayEnd(currentPlayTime: number, totalTime: number, browseTime: number, pageId: string, pageName: string, extParams: ParamType) { | 29 | static videoPlayEnd(currentPlayTime: number, totalTime: number, browseTime: number, pageId: string, pageName: string, extParams: ParamType) { |
| 30 | let params = TrackingUtils.generateParams(extParams) | 30 | let params = TrackingUtils.generateParams(extParams) |
| 31 | if (pageId.length) { | 31 | if (pageId.length) { |
| @@ -13,7 +13,8 @@ | @@ -13,7 +13,8 @@ | ||
| 13 | "@ohos/pulltorefresh": "^2.0.5", | 13 | "@ohos/pulltorefresh": "^2.0.5", |
| 14 | "@mpaas/udid": "0.0.2", | 14 | "@mpaas/udid": "0.0.2", |
| 15 | "@mpaas/upgrade": "0.0.2", | 15 | "@mpaas/upgrade": "0.0.2", |
| 16 | - "@mpaas/framework": "0.0.2" | 16 | + "@mpaas/framework": "0.0.2", |
| 17 | + "@ohos/imageknife": "^2.1.2" | ||
| 17 | }, | 18 | }, |
| 18 | "dynamicDependencies": {} | 19 | "dynamicDependencies": {} |
| 19 | } | 20 | } |
| @@ -7,8 +7,12 @@ import { MinePageComponent } from 'wdComponent/src/main/ets/components/page/Mine | @@ -7,8 +7,12 @@ import { MinePageComponent } from 'wdComponent/src/main/ets/components/page/Mine | ||
| 7 | import { CompUtils, TopNavigationComponent, TopNavigationComponentNew } from 'wdComponent/Index'; | 7 | import { CompUtils, TopNavigationComponent, 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 { ImageKnifeComponent, ImageKnifeOption, NONE } from '@ohos/imageknife'; | ||
| 10 | 11 | ||
| 11 | const TAG = 'BottomNavigationComponent'; | 12 | const TAG = 'BottomNavigationComponent'; |
| 13 | +PersistentStorage.persistProp('channelIds', ''); | ||
| 14 | +PersistentStorage.persistProp('indexSettingChannelId', 2002); | ||
| 15 | + | ||
| 12 | let storage = LocalStorage.getShared(); | 16 | let storage = LocalStorage.getShared(); |
| 13 | 17 | ||
| 14 | /** | 18 | /** |
| @@ -131,16 +135,26 @@ export struct BottomNavigationComponent { | @@ -131,16 +135,26 @@ export struct BottomNavigationComponent { | ||
| 131 | @Builder | 135 | @Builder |
| 132 | tabBarBuilder(navItem: BottomNavDTO, index: number) { | 136 | tabBarBuilder(navItem: BottomNavDTO, index: number) { |
| 133 | Stack({ alignContent: Alignment.Bottom }) { | 137 | Stack({ alignContent: Alignment.Bottom }) { |
| 134 | - Image(this.getBottomIcon(navItem, this.currentNavIndex === index)) | ||
| 135 | - .height(CommonConstants.FULL_PARENT) | 138 | + // Image(this.getBottomIcon(navItem, this.currentNavIndex === index)) |
| 139 | + // .height(CommonConstants.FULL_PARENT) | ||
| 140 | + // .padding({ | ||
| 141 | + // bottom: 15, | ||
| 142 | + // left: 10, | ||
| 143 | + // right: 10, | ||
| 144 | + // top: 2 | ||
| 145 | + // }) | ||
| 146 | + // .aspectRatio(this.ASPECT_RATIO_1_1) | ||
| 147 | + // .alt(this.getBottomLocalIcon(navItem, this.currentNavIndex === index)) | ||
| 148 | + ImageKnifeComponent({ imageKnifeOption: this.getBottomImageKnifeOption(navItem, this.currentNavIndex === index) }) | ||
| 136 | .padding({ | 149 | .padding({ |
| 137 | bottom: 15, | 150 | bottom: 15, |
| 138 | left: 10, | 151 | left: 10, |
| 139 | right: 10, | 152 | right: 10, |
| 140 | top: 2 | 153 | top: 2 |
| 141 | }) | 154 | }) |
| 142 | - .aspectRatio(this.ASPECT_RATIO_1_1) | ||
| 143 | - .alt(this.getBottomLocalIcon(navItem, this.currentNavIndex === index)) | 155 | + .width('100%') |
| 156 | + .height('100%') | ||
| 157 | + .enabled(false) | ||
| 144 | 158 | ||
| 145 | Text(navItem.name) | 159 | Text(navItem.name) |
| 146 | .margin({ bottom: $r('app.float.bottom_navigation_margin_bottom') }) | 160 | .margin({ bottom: $r('app.float.bottom_navigation_margin_bottom') }) |
| @@ -154,6 +168,7 @@ export struct BottomNavigationComponent { | @@ -154,6 +168,7 @@ export struct BottomNavigationComponent { | ||
| 154 | .height($r('app.float.bottom_navigation_barHeight')) | 168 | .height($r('app.float.bottom_navigation_barHeight')) |
| 155 | .hoverEffect(HoverEffect.Highlight) | 169 | .hoverEffect(HoverEffect.Highlight) |
| 156 | .visibility(this.displayDirection === DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) | 170 | .visibility(this.displayDirection === DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) |
| 171 | + // .hitTestBehavior(HitTestMode.Block) | ||
| 157 | .onClick(() => { | 172 | .onClick(() => { |
| 158 | Logger.info(TAG, `onChange, index: ${index}`); | 173 | Logger.info(TAG, `onChange, index: ${index}`); |
| 159 | this.onBottomNavigationIndexChange(navItem, index) | 174 | this.onBottomNavigationIndexChange(navItem, index) |
| @@ -161,6 +176,24 @@ export struct BottomNavigationComponent { | @@ -161,6 +176,24 @@ export struct BottomNavigationComponent { | ||
| 161 | 176 | ||
| 162 | } | 177 | } |
| 163 | 178 | ||
| 179 | + getBottomImageKnifeOption(navItem: BottomNavDTO, isSelect: boolean): ImageKnifeOption { | ||
| 180 | + let defaultIcon = this.getBottomLocalIcon(navItem, isSelect) | ||
| 181 | + let url = this.getBottomIcon(navItem, isSelect) | ||
| 182 | + | ||
| 183 | + let imageKnifeOption: ImageKnifeOption = { | ||
| 184 | + loadSrc: url, | ||
| 185 | + // 占位图使用本地资源 | ||
| 186 | + placeholderSrc: defaultIcon, | ||
| 187 | + // 失败占位图使用本地资源 | ||
| 188 | + errorholderSrc: defaultIcon, | ||
| 189 | + // 是否开启一级内存缓存 | ||
| 190 | + isCacheable: true, | ||
| 191 | + // 磁盘缓存none | ||
| 192 | + strategy: new NONE() | ||
| 193 | + }; | ||
| 194 | + return imageKnifeOption | ||
| 195 | + } | ||
| 196 | + | ||
| 164 | private getBottomIcon(navItem: BottomNavDTO, isSelect: boolean): string | Resource { | 197 | private getBottomIcon(navItem: BottomNavDTO, isSelect: boolean): string | Resource { |
| 165 | if (!navItem) { | 198 | if (!navItem) { |
| 166 | return '' | 199 | return '' |
| @@ -173,10 +206,10 @@ export struct BottomNavigationComponent { | @@ -173,10 +206,10 @@ export struct BottomNavigationComponent { | ||
| 173 | // 获取常规icon | 206 | // 获取常规icon |
| 174 | icon = isSelect ? navItem.iconC : navItem.icon | 207 | icon = isSelect ? navItem.iconC : navItem.icon |
| 175 | } | 208 | } |
| 176 | - if (StringUtils.isEmpty(icon) || icon.includes('.pag')) { | ||
| 177 | - // 兜底,获取预置的本地icon | ||
| 178 | - return this.getBottomLocalIcon(navItem, isSelect) | ||
| 179 | - } | 209 | + // if (StringUtils.isEmpty(icon) || icon.includes('.pag')) { |
| 210 | + // // 兜底,获取预置的本地icon | ||
| 211 | + // return this.getBottomLocalIcon(navItem, isSelect) | ||
| 212 | + // } | ||
| 180 | return icon | 213 | return icon |
| 181 | } | 214 | } |
| 182 | 215 |
| @@ -6,7 +6,8 @@ import { | @@ -6,7 +6,8 @@ import { | ||
| 6 | postInteractBrowsOperateParams, | 6 | postInteractBrowsOperateParams, |
| 7 | postBatchAttentionStatusParams, | 7 | postBatchAttentionStatusParams, |
| 8 | postInteractAccentionOperateParams, | 8 | postInteractAccentionOperateParams, |
| 9 | - Params | 9 | + Params, |
| 10 | + InteractDataDTO | ||
| 10 | } from 'wdBean'; | 11 | } from 'wdBean'; |
| 11 | import display from '@ohos.display'; | 12 | import display from '@ohos.display'; |
| 12 | import { DateTimeUtils } from 'wdKit/Index'; | 13 | import { DateTimeUtils } from 'wdKit/Index'; |
| @@ -59,6 +60,7 @@ export struct MultiPictureDetailPageComponent { | @@ -59,6 +60,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 59 | @State operationButtonList: string[] = ['comment', 'like', 'collect', 'share'] | 60 | @State operationButtonList: string[] = ['comment', 'like', 'collect', 'share'] |
| 60 | @State currentOffset: number = 0 | 61 | @State currentOffset: number = 0 |
| 61 | @State duration: number = 0 | 62 | @State duration: number = 0 |
| 63 | + @Provide interactData: InteractDataDTO = {} as InteractDataDTO | ||
| 62 | pageParam: ParamType = {} | 64 | pageParam: ParamType = {} |
| 63 | followUserId: string = '' | 65 | followUserId: string = '' |
| 64 | followUserName: string = '' | 66 | followUserName: string = '' |
| @@ -116,7 +118,8 @@ export struct MultiPictureDetailPageComponent { | @@ -116,7 +118,8 @@ export struct MultiPictureDetailPageComponent { | ||
| 116 | index: $index, | 118 | index: $index, |
| 117 | currentIndex: $currentIndex, | 119 | currentIndex: $currentIndex, |
| 118 | showCommentList: $showCommentList, | 120 | showCommentList: $showCommentList, |
| 119 | - publishCommentModel: $publishCommentModel | 121 | + publishCommentModel: $publishCommentModel, |
| 122 | + interactData:$interactData | ||
| 120 | }) | 123 | }) |
| 121 | 124 | ||
| 122 | } | 125 | } |
| @@ -17,6 +17,7 @@ import { TrackingModule } from 'wdTracking/Index' | @@ -17,6 +17,7 @@ import { TrackingModule } from 'wdTracking/Index' | ||
| 17 | import { JSON } from '@kit.ArkTS' | 17 | import { JSON } from '@kit.ArkTS' |
| 18 | import app from '@system.app' | 18 | import app from '@system.app' |
| 19 | import { GetuiPush, HWLocationUtils } from 'wdHwAbility/Index' | 19 | import { GetuiPush, HWLocationUtils } from 'wdHwAbility/Index' |
| 20 | +import { ImageKnife, ImageKnifeGlobal } from '@ohos/imageknife' | ||
| 20 | 21 | ||
| 21 | const TAG = "[StartupManager]" | 22 | const TAG = "[StartupManager]" |
| 22 | 23 | ||
| @@ -58,6 +59,14 @@ export class StartupManager { | @@ -58,6 +59,14 @@ export class StartupManager { | ||
| 58 | HostManager.changeHost(spHostUrl as HostEnum) | 59 | HostManager.changeHost(spHostUrl as HostEnum) |
| 59 | } | 60 | } |
| 60 | 61 | ||
| 62 | + // 初始化全局ImageKnife | ||
| 63 | + ImageKnife.with(this.context); | ||
| 64 | + let imageKnife: ImageKnife | undefined = ImageKnifeGlobal.getInstance().getImageKnife() | ||
| 65 | + if (imageKnife != undefined) { | ||
| 66 | + //设置全局内存缓存大小张数 | ||
| 67 | + imageKnife.setLruCacheSize(100, 100 * 1204 * 1024) | ||
| 68 | + } | ||
| 69 | + | ||
| 61 | // 友盟预初始化 | 70 | // 友盟预初始化 |
| 62 | this.preInitUmentStat() | 71 | this.preInitUmentStat() |
| 63 | 72 |
-
Please register or login to post a comment