zhenghy

播放器创建与销毁

@@ -56,6 +56,10 @@ export class HttpUrlUtils { @@ -56,6 +56,10 @@ export class HttpUrlUtils {
56 */ 56 */
57 static readonly INTERACT_EXECUTECOLLECTRECORD: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord"; 57 static readonly INTERACT_EXECUTECOLLECTRECORD: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord";
58 /** 58 /**
  59 + * 关注号主
  60 + */
  61 + static readonly INTERACT_ACCENTION_OPERATION: string = "/api/rmrb-interact/interact/zh/c/attention/operation";
  62 + /**
59 * 用户等级/积分-APP根据业务场景动态增减成长值(APP) 63 * 用户等级/积分-APP根据业务场景动态增减成长值(APP)
60 */ 64 */
61 static readonly USERPOINT_OPERATE: string = "/api/rmrb-user-point/auth/pointLevel/zh/operate"; 65 static readonly USERPOINT_OPERATE: string = "/api/rmrb-user-point/auth/pointLevel/zh/operate";
@@ -144,12 +148,10 @@ export class HttpUrlUtils { @@ -144,12 +148,10 @@ export class HttpUrlUtils {
144 * 个人中心 我的关注列表 148 * 个人中心 我的关注列表
145 */ 149 */
146 static readonly OTHER_USER_FOLLOW_LIST_DATA_PATH: string = "/api/rmrb-interact/interact/zh/c/userAttention/list"; 150 static readonly OTHER_USER_FOLLOW_LIST_DATA_PATH: string = "/api/rmrb-interact/interact/zh/c/userAttention/list";
147 -  
148 /** 151 /**
149 * 预约操作 152 * 预约操作
150 */ 153 */
151 static readonly APPOINTMENT_OPERATION_STATUS_PATH: string = "/api/live-center-message/zh/c/live/subscribe"; 154 static readonly APPOINTMENT_OPERATION_STATUS_PATH: string = "/api/live-center-message/zh/c/live/subscribe";
152 -  
153 /** 155 /**
154 * 点赞操作 156 * 点赞操作
155 */ 157 */
@@ -169,11 +171,12 @@ export class HttpUrlUtils { @@ -169,11 +171,12 @@ export class HttpUrlUtils {
169 * */ 171 * */
170 static readonly MORNING_EVENING_PAGE_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/pageInfo"; 172 static readonly MORNING_EVENING_PAGE_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/pageInfo";
171 static readonly MORNING_EVENING_COMP_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo"; 173 static readonly MORNING_EVENING_COMP_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo";
172 - private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT; 174 + private static _hostUrl: string = HttpUrlUtils.HOST_UAT;
173 175
174 public static set hostUrl(value: string) { 176 public static set hostUrl(value: string) {
175 HttpUrlUtils._hostUrl = value; 177 HttpUrlUtils._hostUrl = value;
176 } 178 }
  179 +
177 private static userId = '' 180 private static userId = ''
178 private static userType = '' 181 private static userType = ''
179 private static token = '' 182 private static token = ''
@@ -189,8 +192,8 @@ export class HttpUrlUtils { @@ -189,8 +192,8 @@ export class HttpUrlUtils {
189 headers.set('timestamp', HttpUrlUtils.getTimestamp()) 192 headers.set('timestamp', HttpUrlUtils.getTimestamp())
190 headers.set('RMRB-X-TOKEN', HttpUrlUtils.getXToken()) 193 headers.set('RMRB-X-TOKEN', HttpUrlUtils.getXToken())
191 headers.set('device_id', HttpUrlUtils.getDeviceId()) 194 headers.set('device_id', HttpUrlUtils.getDeviceId())
192 - if(HttpUrlUtils.getXToken()!=''){  
193 - headers.set('cookie', 'RMRB-X-TOKEN='+HttpUrlUtils.getXToken()) 195 + if (HttpUrlUtils.getXToken() != '') {
  196 + headers.set('cookie', 'RMRB-X-TOKEN=' + HttpUrlUtils.getXToken())
194 } 197 }
195 headers.set('build_version', HttpUrlUtils.getVersion()) 198 headers.set('build_version', HttpUrlUtils.getVersion())
196 headers.set('adcode', HttpUrlUtils.getAdCode()) 199 headers.set('adcode', HttpUrlUtils.getAdCode())
@@ -271,20 +274,20 @@ export class HttpUrlUtils { @@ -271,20 +274,20 @@ export class HttpUrlUtils {
271 } 274 }
272 275
273 private static getXToken() { 276 private static getXToken() {
274 - if(StringUtils.isNotEmpty(HttpUrlUtils.token)){ 277 + if (StringUtils.isNotEmpty(HttpUrlUtils.token)) {
275 return HttpUrlUtils.token 278 return HttpUrlUtils.token
276 } 279 }
277 - HttpUrlUtils.token = SPHelper.default.getSync(SpConstants.USER_JWT_TOKEN,"") as string  
278 - if(StringUtils.isNotEmpty(HttpUrlUtils.token)) {  
279 - return HttpUrlUtils.token 280 + HttpUrlUtils.token = SPHelper.default.getSync(SpConstants.USER_JWT_TOKEN, "") as string
  281 + if (StringUtils.isNotEmpty(HttpUrlUtils.token)) {
  282 + return HttpUrlUtils.token
280 } 283 }
281 return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc'; 284 return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc';
282 } 285 }
283 286
284 - static getRefreshToken() {  
285 - let refreshToken = SPHelper.default.getSync(SpConstants.USER_REFRESH_TOKEN,"")  
286 - if(StringUtils.isNotEmpty(refreshToken)) {  
287 - return refreshToken as string; 287 + static getRefreshToken() {
  288 + let refreshToken = SPHelper.default.getSync(SpConstants.USER_REFRESH_TOKEN, "")
  289 + if (StringUtils.isNotEmpty(refreshToken)) {
  290 + return refreshToken as string;
288 } 291 }
289 return ''; 292 return '';
290 } 293 }
@@ -347,18 +350,18 @@ export class HttpUrlUtils { @@ -347,18 +350,18 @@ export class HttpUrlUtils {
347 350
348 public static getUserId() { 351 public static getUserId() {
349 // TODO 对接登录 352 // TODO 对接登录
350 - if(StringUtils.isNotEmpty(HttpUrlUtils.userId)){ 353 + if (StringUtils.isNotEmpty(HttpUrlUtils.userId)) {
351 return HttpUrlUtils.userId 354 return HttpUrlUtils.userId
352 } 355 }
353 - HttpUrlUtils.userId = SPHelper.default.getSync(SpConstants.USER_ID,"") as string 356 + HttpUrlUtils.userId = SPHelper.default.getSync(SpConstants.USER_ID, "") as string
354 return HttpUrlUtils.userId; 357 return HttpUrlUtils.userId;
355 } 358 }
356 359
357 - public static getUserType() {  
358 - if(StringUtils.isNotEmpty(HttpUrlUtils.userType)){ 360 + public static getUserType() {
  361 + if (StringUtils.isNotEmpty(HttpUrlUtils.userType)) {
359 return HttpUrlUtils.userType 362 return HttpUrlUtils.userType
360 } 363 }
361 - HttpUrlUtils.userType = SPHelper.default.getSync(SpConstants.USER_Type,"") as string 364 + HttpUrlUtils.userType = SPHelper.default.getSync(SpConstants.USER_Type, "") as string
362 return HttpUrlUtils.userType; 365 return HttpUrlUtils.userType;
363 } 366 }
364 367
@@ -116,6 +116,16 @@ export interface postInteractBrowsOperateParams { @@ -116,6 +116,16 @@ export interface postInteractBrowsOperateParams {
116 contentList: postInteractBrowsOperateParamsContent[] 116 contentList: postInteractBrowsOperateParamsContent[]
117 } 117 }
118 118
  119 +export interface postInteractAccentionOperateParams {
  120 + attentionUserType: string;
  121 + attentionUserId: string;
  122 + attentionCreatorId: string;
  123 +
  124 + // userType: number;
  125 + // userId: string;
  126 + status: number;
  127 +}
  128 +
119 export class ContentDetailRequest { 129 export class ContentDetailRequest {
120 static getContentDetailDataMock(context: Context): Promise<ResponseDTO<ContentDetailDTO[]>> { 130 static getContentDetailDataMock(context: Context): Promise<ResponseDTO<ContentDetailDTO[]>> {
121 Logger.info(TAG, `getContentDetailDataMock start`); 131 Logger.info(TAG, `getContentDetailDataMock start`);
@@ -191,7 +201,7 @@ export class ContentDetailRequest { @@ -191,7 +201,7 @@ export class ContentDetailRequest {
191 } 201 }
192 202
193 /** 203 /**
194 - *用户点赞、取消点赞 204 + * 用户点赞、取消点赞
195 * @param params 205 * @param params
196 * @returns 206 * @returns
197 */ 207 */
@@ -202,7 +212,7 @@ export class ContentDetailRequest { @@ -202,7 +212,7 @@ export class ContentDetailRequest {
202 } 212 }
203 213
204 /** 214 /**
205 - *用户收藏、取消收藏 215 + * 用户收藏、取消收藏
206 * @param params 216 * @param params
207 * @returns 217 * @returns
208 */ 218 */
@@ -240,4 +250,13 @@ export class ContentDetailRequest { @@ -240,4 +250,13 @@ export class ContentDetailRequest {
240 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 250 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
241 return WDHttp.post0(url, params, headers) 251 return WDHttp.post0(url, params, headers)
242 } 252 }
  253 +
  254 + /**
  255 + * 关注号主
  256 + */
  257 + static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> {
  258 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION
  259 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  260 + return WDHttp.post0(url, params, headers)
  261 + }
243 } 262 }
@@ -37,16 +37,19 @@ export struct DetailPlayShortVideoPage { @@ -37,16 +37,19 @@ export struct DetailPlayShortVideoPage {
37 if (this.currentIndex != this.index) { 37 if (this.currentIndex != this.index) {
38 this.playerController.pause() 38 this.playerController.pause()
39 39
40 - // if (this.index < this.currentIndex - 5 && this.playerController.getPlayer()) {  
41 - // this.playerController.release()  
42 - // } 40 + if (this.index < this.currentIndex - 5 && this.playerController.getPlayer()) {
  41 + this.playerController.release()
  42 + }
43 43
44 } else { 44 } else {
45 this.queryNewsInfoOfUser() 45 this.queryNewsInfoOfUser()
46 console.log('currentIndex==== ', this.currentIndex) 46 console.log('currentIndex==== ', this.currentIndex)
47 if (!this.playerController.getPlayer()) { 47 if (!this.playerController.getPlayer()) {
  48 + console.error('state91111111===', this.contentDetailData?.videoInfo[0]?.videoUrl || '')
48 this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl || ''); 49 this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl || '');
  50 + console.error('state91111111===', this.playerController?.getPlayer()?.state)
49 } else { 51 } else {
  52 + console.error('state9===', this.playerController?.getPlayer()?.state)
50 this.playerController.play() 53 this.playerController.play()
51 } 54 }
52 55
@@ -103,7 +106,7 @@ export struct DetailPlayShortVideoPage { @@ -103,7 +106,7 @@ export struct DetailPlayShortVideoPage {
103 } 106 }
104 107
105 aboutToAppear() { 108 aboutToAppear() {
106 - console.log('开始设置setContentDetailData', JSON.stringify(this.contentDetailData)) 109 + // console.log('开始设置setContentDetailData', JSON.stringify(this.contentDetailData))
107 this.videoLandScape = this.contentDetailData?.videoInfo[0]?.videoLandScape 110 this.videoLandScape = this.contentDetailData?.videoInfo[0]?.videoLandScape
108 this.queryNewsInfoOfUser() 111 this.queryNewsInfoOfUser()
109 this.playerController.onCanplay = () => { 112 this.playerController.onCanplay = () => {
@@ -136,7 +139,8 @@ export struct DetailPlayShortVideoPage { @@ -136,7 +139,8 @@ export struct DetailPlayShortVideoPage {
136 } 139 }
137 140
138 aboutToDisappear(): void { 141 aboutToDisappear(): void {
139 - this.playerController?.pause(); 142 + console.log('aboutToDisappear', this.index)
  143 + this.playerController?.release();
140 // this.playerController.onCanplay = ()={} 144 // this.playerController.onCanplay = ()={}
141 } 145 }
142 146
@@ -153,7 +157,7 @@ export struct DetailPlayShortVideoPage { @@ -153,7 +157,7 @@ export struct DetailPlayShortVideoPage {
153 WDPlayerRenderView({ 157 WDPlayerRenderView({
154 playerController: this.playerController, 158 playerController: this.playerController,
155 onLoad: async () => { 159 onLoad: async () => {
156 - console.log('onload==',) 160 + // console.log('onload==', this.index)
157 // if (this.index === 0) { 161 // if (this.index === 0) {
158 this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl); 162 this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl);
159 // } 163 // }
@@ -91,11 +91,8 @@ export struct DetailVideoListPage { @@ -91,11 +91,8 @@ export struct DetailVideoListPage {
91 if (res.data) { 91 if (res.data) {
92 this.data = this.data.concat(res.data) 92 this.data = this.data.concat(res.data)
93 } 93 }
94 -  
95 -  
96 - console.log('queryVideoList===', JSON.stringify(this.data)) 94 + // console.log('queryVideoList===', JSON.stringify(this.data))
97 }) 95 })
98 -  
99 } 96 }
100 97
101 build() { 98 build() {
1 -@Entry 1 +@Preview
2 @Component 2 @Component
3 export struct Test { 3 export struct Test {
4 - @Prop currentItem: string = '';  
5 - @Prop @Watch('currentIndexChange') currentIndex: number = 0;  
6 - @Prop index: number = 0;  
7 -  
8 - currentIndexChange() {  
9 - console.log('currentIndexChange====', this.currentIndex);  
10 - }  
11 -  
12 build() { 4 build() {
13 Row() { 5 Row() {
14 - Column() {  
15 - Text('currentItem: ' + this.currentItem).fontSize(30)  
16 - Text('currentIndex: ' + this.currentIndex).fontSize(30)  
17 - Text('index: ' + this.index).fontSize(30)  
18 - } 6 +
  7 + RelativeContainer() {
  8 + Image($r('app.media.ic_like_uncheck'))
  9 + .width('100%')
  10 + .borderRadius(24)
  11 + .aspectRatio(1)
  12 + .border({ width: 1, color: Color.White, style: BorderStyle.Solid })
  13 + .alignRules({
  14 + top: { anchor: "__container__", align: VerticalAlign.Top },
  15 + left: { anchor: "__container__", align: HorizontalAlign.Start }
  16 + })
  17 + .id("row1")
  18 +
  19 + Image($r('app.media.ic_add'))
  20 + .width(24)
  21 + .borderRadius(12)
  22 + .alignRules({
  23 + left: { anchor: "__container__", align: HorizontalAlign.Center },
  24 + bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
  25 + })
  26 + .margin({ left: -12 })
  27 + .id("row2")
  28 + }.height('auto')
  29 +
19 } 30 }
  31 + .height(58)
  32 + .width(48)
  33 + .backgroundColor(Color.Black)
  34 +
20 } 35 }
21 } 36 }
@@ -5,7 +5,8 @@ import { @@ -5,7 +5,8 @@ import {
5 ContentDetailRequest, 5 ContentDetailRequest,
6 contentListParams, 6 contentListParams,
7 postExecuteCollectRecordParams, 7 postExecuteCollectRecordParams,
8 - postExecuteLikeParams 8 + postExecuteLikeParams,
  9 + postInteractAccentionOperateParams
9 } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; 10 } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
10 import { ToastUtils } from 'wdKit'; 11 import { ToastUtils } from 'wdKit';
11 import { HttpUrlUtils } from 'wdNetwork/Index'; 12 import { HttpUrlUtils } from 'wdNetwork/Index';
@@ -30,6 +31,7 @@ export struct OperationListView { @@ -30,6 +31,7 @@ export struct OperationListView {
30 @Consume interactData: InteractDataDTO 31 @Consume interactData: InteractDataDTO
31 @Consume contentDetailData: ContentDetailDTO 32 @Consume contentDetailData: ContentDetailDTO
32 @Consume newsStatusOfUser: batchLikeAndCollectResult 33 @Consume newsStatusOfUser: batchLikeAndCollectResult
  34 + @Consume followStatus: string
33 @State operationList: OperationItem[] = [ 35 @State operationList: OperationItem[] = [
34 { 36 {
35 icon: $r('app.media.ic_like_uncheck'), 37 icon: $r('app.media.ic_like_uncheck'),
@@ -128,30 +130,73 @@ export struct OperationListView { @@ -128,30 +130,73 @@ export struct OperationListView {
128 }) 130 })
129 } 131 }
130 132
131 - build() { 133 + getImgUrl() {
  134 + return this.contentDetailData?.rmhInfo?.rmhHeadUrl || this.contentDetailData?.userInfo?.userHeadUrl
  135 + }
132 136
133 - Column() {  
134 - this.buildUserComp()  
135 - ForEach(this.operationList, (item: OperationItem, index: number) => {  
136 - this.buildOperationItem(item, index)  
137 - }, (item: OperationItem, index: number) => JSON.stringify(item)) 137 + /**
  138 + * 关注号主
  139 + */
  140 + handleAccention() {
  141 + // 未登录,跳转登录
  142 + if (!HttpUrlUtils.getUserId()) {
  143 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  144 + return
138 } 145 }
139 - .width(48)  
140 - }  
141 146
142 - getImgUrl() {  
143 - return this.contentDetailData?.rmhInfo?.rmhHeadUrl || this.contentDetailData?.userInfo?.userHeadUrl 147 + const params2: postInteractAccentionOperateParams = {
  148 + attentionUserType: this.contentDetailData?.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
  149 + attentionUserId: this.contentDetailData?.rmhInfo?.userId || '', // 被关注用户号主id
  150 + attentionCreatorId: this.contentDetailData?.rmhInfo?.rmhId || '', // 被关注用户号主id
  151 + // userType: 1,
  152 + // userId: '1',
  153 + status: 1,
  154 + }
  155 + ContentDetailRequest.postInteractAccentionOperate(params2).then(res => {
  156 + console.log('关注号主==', JSON.stringify(res.data))
  157 + if (this.followStatus == '1') {
  158 + this.followStatus = '0'
  159 + } else {
  160 + this.followStatus = '1'
  161 + }
  162 + })
144 } 163 }
145 164
146 @Builder 165 @Builder
147 buildUserComp() { 166 buildUserComp() {
148 Column() { 167 Column() {
149 if (this.getImgUrl()) { 168 if (this.getImgUrl()) {
150 - Image(this.getImgUrl())  
151 - .width('100%')  
152 - .borderRadius(24)  
153 - .aspectRatio(1)  
154 - .border({ width: 1, color: Color.White, style: BorderStyle.Solid }) 169 + RelativeContainer() {
  170 + Image(this.getImgUrl())
  171 + .width('100%')
  172 + .borderRadius(24)
  173 + .aspectRatio(1)
  174 + .border({ width: 1, color: Color.White, style: BorderStyle.Solid })
  175 + .alignRules({
  176 + top: { anchor: "__container__", align: VerticalAlign.Top },
  177 + left: { anchor: "__container__", align: HorizontalAlign.Start }
  178 + })
  179 + .id("row1")
  180 + .onClick(() => {
  181 + // 号主页
  182 + })
  183 + if (this.followStatus == '0') {
  184 + Image($r('app.media.ic_add'))
  185 + .width(24)
  186 + .borderRadius(12)
  187 + .alignRules({
  188 + left: { anchor: "__container__", align: HorizontalAlign.Center },
  189 + bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
  190 + })
  191 + .margin({ left: -12 })
  192 + .id("row2")
  193 + .onClick(() => {
  194 + // 关注
  195 + this.handleAccention()
  196 + })
  197 + }
  198 +
  199 + }.height(60)
155 } 200 }
156 }.margin({ bottom: 30 }) 201 }.margin({ bottom: 30 })
157 } 202 }
@@ -160,7 +205,7 @@ export struct OperationListView { @@ -160,7 +205,7 @@ export struct OperationListView {
160 buildOperationItem(item: OperationItem, index: number) { 205 buildOperationItem(item: OperationItem, index: number) {
161 Column() { 206 Column() {
162 if (item.text === '赞') { 207 if (item.text === '赞') {
163 - Image(this.newsStatusOfUser?.likeStatus == '0' ? item.icon : item.icon_check) 208 + Image(this.newsStatusOfUser?.likeStatus == '1' ? item.icon_check : item.icon)
164 .width(32) 209 .width(32)
165 .aspectRatio(1) 210 .aspectRatio(1)
166 .onClick(() => { 211 .onClick(() => {
@@ -175,7 +220,7 @@ export struct OperationListView { @@ -175,7 +220,7 @@ export struct OperationListView {
175 .maxLines(1) 220 .maxLines(1)
176 .textOverflow({ overflow: TextOverflow.Ellipsis }) 221 .textOverflow({ overflow: TextOverflow.Ellipsis })
177 } else if (item.text === '收藏') { 222 } else if (item.text === '收藏') {
178 - Image(this.newsStatusOfUser?.collectStatus == 0 ? item.icon : item.icon_check) 223 + Image(this.newsStatusOfUser?.collectStatus == 1 ? item.icon_check : item.icon)
179 .width(32) 224 .width(32)
180 .aspectRatio(1) 225 .aspectRatio(1)
181 .onClick(() => { 226 .onClick(() => {
@@ -193,6 +238,9 @@ export struct OperationListView { @@ -193,6 +238,9 @@ export struct OperationListView {
193 Image(item.icon) 238 Image(item.icon)
194 .width(32) 239 .width(32)
195 .aspectRatio(1) 240 .aspectRatio(1)
  241 + .onClick((event: ClickEvent) => {
  242 + ToastUtils.showToast('评论为公共方法,待开发', 1000);
  243 + })
196 Text(this.interactData?.commentNum ? (this.interactData.commentNum + '') : item.text) 244 Text(this.interactData?.commentNum ? (this.interactData.commentNum + '') : item.text)
197 .width('100%')// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown) 245 .width('100%')// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown)
198 .fontWeight(500) 246 .fontWeight(500)
@@ -205,6 +253,9 @@ export struct OperationListView { @@ -205,6 +253,9 @@ export struct OperationListView {
205 Image(item.icon) 253 Image(item.icon)
206 .width(32) 254 .width(32)
207 .aspectRatio(1) 255 .aspectRatio(1)
  256 + .onClick((event: ClickEvent) => {
  257 + ToastUtils.showToast('分享为公共方法,待开发', 1000);
  258 + })
208 Text(item.text) 259 Text(item.text)
209 .width('100%')// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown) 260 .width('100%')// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown)
210 .fontWeight(500) 261 .fontWeight(500)
@@ -216,15 +267,20 @@ export struct OperationListView { @@ -216,15 +267,20 @@ export struct OperationListView {
216 } 267 }
217 268
218 } 269 }
219 - .width(32) 270 + // .width(48)
220 .margin({ bottom: 20 }) 271 .margin({ bottom: 20 })
221 - // .backgroundColor(Color.Black)  
222 .alignItems(HorizontalAlign.Center) 272 .alignItems(HorizontalAlign.Center)
223 .hoverEffect(HoverEffect.Scale) 273 .hoverEffect(HoverEffect.Scale)
224 274
225 - // .onClick((event: ClickEvent) => {  
226 - // console.info(TAG, `buildOperationItem onClick event index: ${index}`);  
227 - // // ToastUtils.showToast('体验版,本功能暂未开发', 1000);  
228 - // }) 275 + }
  276 +
  277 + build() {
  278 + Column() {
  279 + this.buildUserComp()
  280 + ForEach(this.operationList, (item: OperationItem, index: number) => {
  281 + this.buildOperationItem(item, index)
  282 + }, (item: OperationItem, index: number) => JSON.stringify(item))
  283 + }
  284 + .width(48)
229 } 285 }
230 } 286 }
1 { 1 {
2 "src": [ 2 "src": [
3 - "pages/DetailVideoListPage",  
4 - "pages/Test" 3 + "pages/DetailVideoListPage"
5 ] 4 ]
6 } 5 }
@@ -2,6 +2,7 @@ import media from '@ohos.multimedia.media'; @@ -2,6 +2,7 @@ import media from '@ohos.multimedia.media';
2 import prompt from '@ohos.promptAction'; 2 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 6
6 @Observed 7 @Observed
7 export class WDPlayerController { 8 export class WDPlayerController {
@@ -44,7 +45,10 @@ export class WDPlayerController { @@ -44,7 +45,10 @@ export class WDPlayerController {
44 Logger.error('[PlayVideoModel] createAvPlayer fail!'); 45 Logger.error('[PlayVideoModel] createAvPlayer fail!');
45 reject(); 46 reject();
46 } 47 }
  48 + }).catch((error: BusinessError) => {
  49 + console.error(`AVPlayer catchCallback, error message:${error.message}`);
47 }); 50 });
  51 + ;
48 }); 52 });
49 } 53 }
50 54