张善主

Merge remote-tracking branch 'origin/main'

Showing 55 changed files with 786 additions and 323 deletions
@@ -38,4 +38,7 @@ export class SpConstants{ @@ -38,4 +38,7 @@ export class SpConstants{
38 //启动页数据存储key 38 //启动页数据存储key
39 static APP_LAUNCH_PAGE_DATA_MODEL = 'app_launch_page_data_model' 39 static APP_LAUNCH_PAGE_DATA_MODEL = 'app_launch_page_data_model'
40 40
  41 + //频道信息流页面左右挂角
  42 + static APP_PAGE_CORNER_ADV = 'app_page_corner_adv_'
  43 +
41 } 44 }
@@ -8,5 +8,7 @@ export enum EmitterEventId { @@ -8,5 +8,7 @@ export enum EmitterEventId {
8 NETWORK_CONNECTED = 2, 8 NETWORK_CONNECTED = 2,
9 // 网络断开,事件id 9 // 网络断开,事件id
10 NETWORK_DISCONNECTED = 3, 10 NETWORK_DISCONNECTED = 3,
  11 + // 跳转首页指定频道,事件id
  12 + JUMP_HOME_CHANNEL = 4,
11 } 13 }
12 14
1 export { ResponseDTO } from "./src/main/ets/bean/ResponseDTO" 1 export { ResponseDTO } from "./src/main/ets/bean/ResponseDTO"
2 2
  3 +export { ResposeError } from "./src/main/ets/bean/ResposeError"
  4 +
3 export { HttpRequest as WDHttp } from "./src/main/ets/http/HttpRequest" 5 export { HttpRequest as WDHttp } from "./src/main/ets/http/HttpRequest"
4 6
5 export { HttpUrlUtils } from "./src/main/ets/http/HttpUrlUtils" 7 export { HttpUrlUtils } from "./src/main/ets/http/HttpUrlUtils"
  1 +/**
  2 + * 接口返回错误数据封装
  3 + */
  4 +export class ResposeError {
  5 + code: number = -1;
  6 + message: string = '';
  7 +
  8 + static buildError(message: string, code?: number): ResposeError {
  9 + let error = new ResposeError()
  10 + error.message = message
  11 + if (code) {
  12 + error.code = code
  13 + }
  14 + return error;
  15 + }
  16 +}
@@ -6,6 +6,7 @@ import axios, { @@ -6,6 +6,7 @@ import axios, {
6 InternalAxiosRequestConfig 6 InternalAxiosRequestConfig
7 } from '@ohos/axios'; 7 } from '@ohos/axios';
8 import { Logger } from 'wdKit/Index'; 8 import { Logger } from 'wdKit/Index';
  9 +import { ResposeError } from '../bean/ResposeError';
9 10
10 // import type ResponseDTO from '../models/ResponseDTO'; 11 // import type ResponseDTO from '../models/ResponseDTO';
11 12
@@ -99,17 +100,16 @@ instance.interceptors.response.use(// 响应拦截器response类型就是Axios.r @@ -99,17 +100,16 @@ instance.interceptors.response.use(// 响应拦截器response类型就是Axios.r
99 }, 100 },
100 (error: AxiosError) => { 101 (error: AxiosError) => {
101 // 异常响应 102 // 异常响应
102 - // console.log('全局响应失败拦截')  
103 - // console.log(error.request)  
104 - // console.log(error.response) 103 + // 429-流量超标;403-临时token;406-token过期,强制下线
105 // 这里用来处理http常见错误,进行全局提示 104 // 这里用来处理http常见错误,进行全局提示
  105 + let errorBean = new ResposeError()
106 if (error != null && error.response != null) { 106 if (error != null && error.response != null) {
107 let message = buildErrorMsg(error.response.status); 107 let message = buildErrorMsg(error.response.status);
108 // 错误消息可以使用全局弹框展示出来 108 // 错误消息可以使用全局弹框展示出来
109 console.log(`httpStatus:${error.response?.status}-${message},请检查网络或联系管理员!`) 109 console.log(`httpStatus:${error.response?.status}-${message},请检查网络或联系管理员!`)
  110 + errorBean = buildError(error.response.status)
110 } 111 }
111 -  
112 - return Promise.reject(error); 112 + return Promise.reject(errorBean);
113 } 113 }
114 ); 114 );
115 115
@@ -161,3 +161,9 @@ function buildErrorMsg(httpStatus: number): string { @@ -161,3 +161,9 @@ function buildErrorMsg(httpStatus: number): string {
161 } 161 }
162 return message; 162 return message;
163 } 163 }
  164 +
  165 +function buildError(httpStatus: number): ResposeError {
  166 + let message = buildErrorMsg(httpStatus);
  167 + let error: ResposeError = ResposeError.buildError(message, httpStatus)
  168 + return error;
  169 +}
@@ -4,6 +4,7 @@ import HashMap from '@ohos.util.HashMap'; @@ -4,6 +4,7 @@ import HashMap from '@ohos.util.HashMap';
4 import { ResponseDTO } from '../bean/ResponseDTO'; 4 import { ResponseDTO } from '../bean/ResponseDTO';
5 import { HttpUrlUtils, WDHttp } from '../../../../Index'; 5 import { HttpUrlUtils, WDHttp } from '../../../../Index';
6 import { RefreshTokenRes } from '../bean/RefreshTokenRes'; 6 import { RefreshTokenRes } from '../bean/RefreshTokenRes';
  7 +import { ResposeError } from '../bean/ResposeError';
7 8
8 const TAG: string = 'HttpBizUtil' 9 const TAG: string = 'HttpBizUtil'
9 10
@@ -20,14 +21,12 @@ export class HttpBizUtil { @@ -20,14 +21,12 @@ export class HttpBizUtil {
20 * @returns 返回值 21 * @returns 返回值
21 */ 22 */
22 static get<T = ResponseDTO<string>>(url: string, headers?: HashMap<string, string>): Promise<T> { 23 static get<T = ResponseDTO<string>>(url: string, headers?: HashMap<string, string>): Promise<T> {
23 - return new Promise<T>((success, debug) => { 24 + return new Promise<T>((success, error) => {
24 WDHttp.get<T>(url, headers).then((originalRes: T) => { 25 WDHttp.get<T>(url, headers).then((originalRes: T) => {
25 - try {  
26 - let resDTO = originalRes as ResponseDTO  
27 - Logger.debug(TAG, 'get: ' + resDTO.code)  
28 - Logger.debug(TAG, 'get: ' + resDTO.message) 26 + success(originalRes)
  27 + }).catch((res: ResposeError) => {
29 // 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面 28 // 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面
30 - if (resDTO.code == 403 || resDTO.code == 406) { 29 + if (res.code == 403 || res.code == 406) {
31 HttpBizUtil.refreshToken().then((token: string) => { 30 HttpBizUtil.refreshToken().then((token: string) => {
32 if (headers) { 31 if (headers) {
33 headers.replace('RMRB-X-TOKEN', token) 32 headers.replace('RMRB-X-TOKEN', token)
@@ -39,18 +38,14 @@ export class HttpBizUtil { @@ -39,18 +38,14 @@ export class HttpBizUtil {
39 Logger.debug(TAG, 'get again: ' + againResDTO) 38 Logger.debug(TAG, 'get again: ' + againResDTO)
40 success(againResDTO) 39 success(againResDTO)
41 }).catch((res: object) => { 40 }).catch((res: object) => {
42 - debug(res) 41 + error(ResposeError.buildError(JSON.stringify(res)))
43 }) 42 })
44 }); 43 });
45 } else { 44 } else {
46 - success(originalRes)  
47 - }  
48 - } catch (e) {  
49 - debug(originalRes) 45 + // 非403、406,直接抛出去
  46 + Logger.debug(TAG, 'get else: ' + JSON.stringify(res))
  47 + error(res)
50 } 48 }
51 -  
52 - }).catch((res: object) => {  
53 - debug(res)  
54 }) 49 })
55 }) 50 })
56 } 51 }
@@ -63,34 +58,31 @@ export class HttpBizUtil { @@ -63,34 +58,31 @@ export class HttpBizUtil {
63 * @returns 返回值 58 * @returns 返回值
64 */ 59 */
65 static post<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> { 60 static post<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> {
66 - return new Promise<T>((success, debug) => { 61 + return new Promise<T>((success, error) => {
67 WDHttp.post<T>(url, data, headers).then((originalRes: T) => { 62 WDHttp.post<T>(url, data, headers).then((originalRes: T) => {
68 - try {  
69 - let resDTO = originalRes as ResponseDTO  
70 - Logger.debug(TAG, 'post: ' + resDTO.code)  
71 - Logger.debug(TAG, 'post: ' + resDTO.message) 63 + success(originalRes)
  64 + }).catch((res: ResposeError) => {
72 // 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面 65 // 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面
73 - if (resDTO.code == 403 || resDTO.code == 406) { 66 + Logger.debug(TAG, 'post catch error: ' + JSON.stringify(res))
  67 + if (res.code == 403 || res.code == 406) {
74 HttpBizUtil.refreshToken().then((token: string) => { 68 HttpBizUtil.refreshToken().then((token: string) => {
75 if (headers) { 69 if (headers) {
76 headers.replace('RMRB-X-TOKEN', token) 70 headers.replace('RMRB-X-TOKEN', token)
77 headers.replace('cookie', 'RMRB-X-TOKEN=' + token) 71 headers.replace('cookie', 'RMRB-X-TOKEN=' + token)
78 } 72 }
  73 + Logger.debug(TAG, 'post again send: ' + token)
79 // refreshToken为空场景不处理,直接请求接口。 74 // refreshToken为空场景不处理,直接请求接口。
80 - WDHttp.post<T>(url, headers).then((againResDTO: T) => { 75 + WDHttp.post<T>(url, data, headers).then((againResDTO: T) => {
  76 + Logger.debug(TAG, 'post again success: ' + JSON.stringify(againResDTO))
81 success(againResDTO) 77 success(againResDTO)
82 }).catch((res: object) => { 78 }).catch((res: object) => {
83 - debug(res) 79 + error(ResposeError.buildError(JSON.stringify(res)))
84 }) 80 })
85 }); 81 });
86 } else { 82 } else {
87 - success(originalRes) 83 + // 非403、406,直接抛出去
  84 + error(res)
88 } 85 }
89 - } catch (e) {  
90 - success(originalRes)  
91 - }  
92 - }).catch((res: object) => {  
93 - debug(res)  
94 }) 86 })
95 }) 87 })
96 } 88 }
@@ -104,9 +96,9 @@ export class HttpBizUtil { @@ -104,9 +96,9 @@ export class HttpBizUtil {
104 params.set('refreshToken', HttpUrlUtils.getRefreshToken()) 96 params.set('refreshToken', HttpUrlUtils.getRefreshToken())
105 params.set('deviceId', HttpUrlUtils.getDeviceId()) 97 params.set('deviceId', HttpUrlUtils.getDeviceId())
106 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 98 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
107 - Logger.debug(TAG, 'refreshToken getRefreshToken: ' + HttpUrlUtils.getRefreshToken())  
108 - // // 请求刷新token接口  
109 - return new Promise<string>((success, debug) => { 99 + // Logger.debug(TAG, 'refreshToken getRefreshToken: ' + HttpUrlUtils.getRefreshToken())
  100 + // 请求刷新token接口
  101 + return new Promise<string>((success, error) => {
110 WDHttp.post<ResponseDTO<RefreshTokenRes>>(url, params, headers).then((resDTO: ResponseDTO<RefreshTokenRes>) => { 102 WDHttp.post<ResponseDTO<RefreshTokenRes>>(url, params, headers).then((resDTO: ResponseDTO<RefreshTokenRes>) => {
111 let newToken = '' 103 let newToken = ''
112 if (resDTO) { 104 if (resDTO) {
@@ -126,6 +118,7 @@ export class HttpBizUtil { @@ -126,6 +118,7 @@ export class HttpBizUtil {
126 Logger.debug(TAG, 'refreshToken refreshToken: ' + resDTO.data.refreshToken) 118 Logger.debug(TAG, 'refreshToken refreshToken: ' + resDTO.data.refreshToken)
127 } 119 }
128 } 120 }
  121 + Logger.debug(TAG, 'refreshToken last jwtToken: ' + newToken)
129 success(newToken) 122 success(newToken)
130 }); 123 });
131 }) 124 })
@@ -52,7 +52,7 @@ export class WDRouterPage { @@ -52,7 +52,7 @@ export class WDRouterPage {
52 // 点播详情页 52 // 点播详情页
53 static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage"); 53 static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage");
54 // 直播详情页 54 // 直播详情页
55 - static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage"); 55 + // static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage");
56 static detailPlayVLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayVLivePage"); 56 static detailPlayVLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayVLivePage");
57 static detailPlayLiveCommon = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLiveCommon"); 57 static detailPlayLiveCommon = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLiveCommon");
58 // 多图(图集)详情页 58 // 多图(图集)详情页
@@ -122,4 +122,6 @@ export class WDRouterPage { @@ -122,4 +122,6 @@ export class WDRouterPage {
122 static reserveMorePage = new WDRouterPage("wdComponent", "ets/components/page/ReserveMorePage"); 122 static reserveMorePage = new WDRouterPage("wdComponent", "ets/components/page/ReserveMorePage");
123 //金刚位聚合页 123 //金刚位聚合页
124 static themeListPage = new WDRouterPage("wdComponent", "ets/components/page/ThemeListPage"); 124 static themeListPage = new WDRouterPage("wdComponent", "ets/components/page/ThemeListPage");
  125 + // 栏目页面、频道详情
  126 + static columnPage = new WDRouterPage("phone", "ets/pages/column/ColumnPage");
125 } 127 }
@@ -14,15 +14,19 @@ export class WDRouterRule { @@ -14,15 +14,19 @@ export class WDRouterRule {
14 WDRouterRule.jumpWithPage(page, action) 14 WDRouterRule.jumpWithPage(page, action)
15 } 15 }
16 16
17 - static jumpWithPage(page?: WDRouterPage, params?: object) { 17 + static jumpWithPage(page?: WDRouterPage, params?: object, singleMode?: boolean) {
18 if (page) { 18 if (page) {
  19 + let mode = router.RouterMode.Standard
  20 + if (singleMode) {
  21 + mode = router.RouterMode.Single
  22 + }
19 if (params) { 23 if (params) {
20 // router.pushUrl({ url: 'pages/routerpage2', , params: params }) 24 // router.pushUrl({ url: 'pages/routerpage2', , params: params })
21 console.log('page.url()==',page.url(),JSON.stringify(params)) 25 console.log('page.url()==',page.url(),JSON.stringify(params))
22 router.pushUrl({ url: page.url(), params: params }) 26 router.pushUrl({ url: page.url(), params: params })
23 } else { 27 } else {
24 - router.pushUrl({ url: page.url() }).catch((error:Error)=>{  
25 - console.log("err",JSON.stringify(error))//100002 uri is not exist 28 + router.pushUrl({ url: page.url() }, mode).catch((error: Error) => {
  29 + console.log("err", JSON.stringify(error)) //100002 uri is not exist
26 }) 30 })
27 } 31 }
28 } else { 32 } else {
  1 +import { BottomNavDTO, NavigationBodyDTO, TopNavDTO } from 'wdBean/Index';
  2 +import { EmitterEventId, EmitterUtils, StringUtils } from 'wdKit/Index';
  3 +import { WDRouterPage } from '../router/WDRouterPage';
  4 +import { WDRouterRule } from '../router/WDRouterRule';
  5 +import { HashMap } from '@kit.ArkTS';
  6 +
  7 +/**
  8 + * 首页、频道相关跳转、处理
  9 + */
  10 +export class HomeChannelUtils {
  11 + private bottomNavData: NavigationBodyDTO | null = null
  12 +
  13 + setBottomNavData(bottomNavData: NavigationBodyDTO) {
  14 + this.bottomNavData = bottomNavData
  15 + }
  16 +
  17 + /**
  18 + * 切换到指定频道
  19 + *
  20 + * @param channelId 频道id【顶导id】
  21 + * @param pageId 目标页面id
  22 + */
  23 + jumpChannelTab(channelId: string, pageId: string) {
  24 + // 1、首页所有展示频道遍历,找到目标频道
  25 + // 2、频道管理里的,非我的频道所有列表遍历,找到目标频道 【这步去掉,和this.bottomNavData重复了】
  26 + // 3、一级频道【1、2里找到目标】->【切换底导、切换频道/新增临时频道】
  27 + // 4、二级频道【1、2里都没有找到目标】->【跳转栏目页面-ColumnPageComponent】
  28 +
  29 + // 1. 遍历查找目标channel
  30 + if (this.bottomNavData == null || this.bottomNavData.bottomNavList == null || this.bottomNavData.bottomNavList.length <= 0) {
  31 + this.jumpColumn(channelId, pageId)
  32 + return
  33 + }
  34 + let bean = new AssignChannelParam()
  35 + bean.channelId = channelId
  36 + bean.pageId = pageId ? pageId : ''
  37 + let bottomNavList = this.bottomNavData.bottomNavList
  38 + for (let i = 0; i < bottomNavList.length; i++) {
  39 + let bottomNavDTO: BottomNavDTO = bottomNavList[i]
  40 + let channelList = bottomNavDTO.topNavChannelList
  41 + if (channelList == null || channelList.length <= 0) {
  42 + continue
  43 + }
  44 + for (let j = 0; j < channelList.length; j++) {
  45 + let topNavDTO: TopNavDTO = channelList[j]
  46 + if (topNavDTO.channelId.toString() === channelId) {
  47 + bean.pageId = topNavDTO.pageId.toString()
  48 + bean.bottomNavId = bottomNavDTO.id.toString()
  49 + break
  50 + }
  51 + }
  52 + }
  53 + if (StringUtils.isEmpty(bean.bottomNavId)) {
  54 + this.jumpColumn(channelId, pageId)
  55 + } else {
  56 + this.jumpHomeChannel(bean)
  57 + }
  58 + }
  59 +
  60 + jumpColumn(channelId: string, pageId: string) {
  61 + let params: AssignChannelParam = new AssignChannelParam()
  62 + params.pageId = pageId
  63 + params.channelId = channelId
  64 + WDRouterRule.jumpWithPage(WDRouterPage.columnPage, params)
  65 + }
  66 +
  67 + jumpHomeChannel(param: AssignChannelParam) {
  68 + // 跳转首页
  69 + WDRouterRule.jumpWithPage(WDRouterPage.mainPage, undefined, true)
  70 + // 通知切换频道
  71 + EmitterUtils.sendEvent(EmitterEventId.JUMP_HOME_CHANNEL, JSON.stringify(param))
  72 + }
  73 +}
  74 +
  75 +@Observed
  76 +export class AssignChannelParam {
  77 + pageId: string = '';
  78 + channelId: string = '';
  79 + bottomNavId: string = '';
  80 +}
  81 +
  82 +let homeChannelUtils = new HomeChannelUtils();
  83 +
  84 +export default homeChannelUtils as HomeChannelUtils;
@@ -2,14 +2,13 @@ import { Action, ContentDTO, Params, PhotoListBean, commentInfo } from 'wdBean'; @@ -2,14 +2,13 @@ import { Action, ContentDTO, Params, PhotoListBean, commentInfo } from 'wdBean';
2 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; 2 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
3 import { Logger } from 'wdKit'; 3 import { Logger } from 'wdKit';
4 import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; 4 import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils';
5 -import { WDRouterRule } from '../router/WDRouterRule'; 5 +import { WDRouterRule, WDRouterPage } from '../../../../Index';
6 import { ContentConstants } from 'wdConstant'; 6 import { ContentConstants } from 'wdConstant';
7 import { common, Want } from '@kit.AbilityKit'; 7 import { common, Want } from '@kit.AbilityKit';
8 import { BusinessError } from '@kit.BasicServicesKit'; 8 import { BusinessError } from '@kit.BasicServicesKit';
9 import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean'; 9 import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
10 import { AdvertsBean } from 'wdBean/src/main/ets/bean/adv/AdvertsBean'; 10 import { AdvertsBean } from 'wdBean/src/main/ets/bean/adv/AdvertsBean';
11 -  
12 -// import { LiveModel } from '../viewmodel/LiveModel'; 11 +import HomeChannelUtils from './HomeChannelUtils';
13 12
14 const TAG = 'ProcessUtils'; 13 const TAG = 'ProcessUtils';
15 14
@@ -390,4 +389,23 @@ export class ProcessUtils { @@ -390,4 +389,23 @@ export class ProcessUtils {
390 }; 389 };
391 WDRouterRule.jumpWithAction(taskAction) 390 WDRouterRule.jumpWithAction(taskAction)
392 } 391 }
  392 +
  393 + /**
  394 + * 切换到指定频道
  395 + *
  396 + * @param channelId 频道id【顶导id】
  397 + */
  398 + public static jumpChannelTab(channelId: string, pageId: string) {
  399 + HomeChannelUtils.jumpChannelTab(channelId, pageId)
  400 + }
  401 +
  402 + /**
  403 + * 跳转人民号主页
  404 + *@params creatorId 创作者id
  405 + */
  406 + public static gotoPeopleShipHomePage(creatorId: string) {
  407 + let params = {'creatorId': creatorId} as Record<string, string>;
  408 + WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
  409 + }
  410 +
393 } 411 }
@@ -145,6 +145,10 @@ function handleJsCallAppInnerLinkMethod(data: Message) { @@ -145,6 +145,10 @@ function handleJsCallAppInnerLinkMethod(data: Message) {
145 content.objectType = ContentConstants.TYPE_FOURTEEN 145 content.objectType = ContentConstants.TYPE_FOURTEEN
146 ProcessUtils.processPage(content) 146 ProcessUtils.processPage(content)
147 break; 147 break;
  148 + case 'owner_page':
  149 + let creatorId = urlParams.get('creatorId') || ''
  150 + ProcessUtils.gotoPeopleShipHomePage(creatorId)
  151 + break;
148 default: 152 default:
149 break; 153 break;
150 } 154 }
@@ -68,14 +68,9 @@ export interface CompAdvBean { @@ -68,14 +68,9 @@ export interface CompAdvBean {
68 displayPriority: number; 68 displayPriority: number;
69 69
70 /** 70 /**
71 - * 展示的次数  
72 - */  
73 - showCount: number;  
74 -  
75 - /**  
76 * 页面id 71 * 页面id
77 */ 72 */
78 - pageId: String ; 73 + pageId: String;
79 74
80 /** 75 /**
81 * 开屏广告-显示时长 76 * 开屏广告-显示时长
@@ -97,6 +92,4 @@ export interface CompAdvBean { @@ -97,6 +92,4 @@ export interface CompAdvBean {
97 displayRound: number; 92 displayRound: number;
98 93
99 94
100 -  
101 -  
102 } 95 }
@@ -18,9 +18,15 @@ export interface LiveRoomItemBean { @@ -18,9 +18,15 @@ export interface LiveRoomItemBean {
18 role: string 18 role: string
19 //ZH_TEXT_AND_IMAGE_MSG :图文,ZH_TEXT_MSG:文本,ZH_VIDEO_MSG:视频,ZH_AUDIO_MSG:音频 19 //ZH_TEXT_AND_IMAGE_MSG :图文,ZH_TEXT_MSG:文本,ZH_VIDEO_MSG:视频,ZH_AUDIO_MSG:音频
20 dataType: string 20 dataType: string
  21 + //视频封面图
21 transcodeImageUrl: string 22 transcodeImageUrl: string
  23 + //视频地址
22 videoUrl: string 24 videoUrl: string
  25 + //图片宽高
23 pictureResolutions: string[] 26 pictureResolutions: string[]
24 //音视频长度 27 //音视频长度
25 duration: number 28 duration: number
  29 + //音频地址
  30 + audioUrl: string
  31 +
26 } 32 }
@@ -77,5 +77,7 @@ export { LiveCommentComponent } from "./src/main/ets/components/comment/view/Liv @@ -77,5 +77,7 @@ export { LiveCommentComponent } from "./src/main/ets/components/comment/view/Liv
77 77
78 export { WDViewDefaultType } from "./src/main/ets/components/view/EmptyComponent" 78 export { WDViewDefaultType } from "./src/main/ets/components/view/EmptyComponent"
79 79
  80 +export { AudioRowComponent } from "./src/main/ets/components/live/AudioRowComponent"
  81 +
80 export { WDLiveViewDefaultType } from "./src/main/ets/components/view/LiveEmptyComponent" 82 export { WDLiveViewDefaultType } from "./src/main/ets/components/view/LiveEmptyComponent"
81 83
@@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
18 "wdRouter": "file:../../commons/wdRouter", 18 "wdRouter": "file:../../commons/wdRouter",
19 "wdNetwork": "file:../../commons/wdNetwork", 19 "wdNetwork": "file:../../commons/wdNetwork",
20 "wdJsBridge": "file:../../commons/wdJsBridge", 20 "wdJsBridge": "file:../../commons/wdJsBridge",
21 - "wdDetailPlayApi":"file:../../features/wdDetailPlayApi" 21 + "wdDetailPlayApi":"file:../../features/wdDetailPlayApi",
  22 + "wdHwAbility": "file:../../features/wdHwAbility"
22 } 23 }
23 } 24 }
1 -import { Logger } from 'wdKit';  
2 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 1 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
3 import { ContentDetailDTO } from 'wdBean'; 2 import { ContentDetailDTO } from 'wdBean';
4 import media from '@ohos.multimedia.media'; 3 import media from '@ohos.multimedia.media';
@@ -6,9 +5,10 @@ import { OperRowListView } from './view/OperRowListView'; @@ -6,9 +5,10 @@ import { OperRowListView } from './view/OperRowListView';
6 import { WDPlayerController } from 'wdPlayer/Index'; 5 import { WDPlayerController } from 'wdPlayer/Index';
7 6
8 const TAG = 'AudioDetailComponent' 7 const TAG = 'AudioDetailComponent'
9 -interface Arr{  
10 - image:string,  
11 - title:string 8 +
  9 +interface Arr {
  10 + image: string,
  11 + title: string
12 } 12 }
13 13
14 @Component 14 @Component
@@ -18,38 +18,34 @@ export struct AudioDetailComponent { @@ -18,38 +18,34 @@ export struct AudioDetailComponent {
18 private relType: string = '' 18 private relType: string = ''
19 private avPlayer?: media.AVPlayer; 19 private avPlayer?: media.AVPlayer;
20 @State playerController: WDPlayerController = new WDPlayerController(); 20 @State playerController: WDPlayerController = new WDPlayerController();
21 -  
22 - private arr:Arr[]=[  
23 - {image:'clock',title:'定时'},  
24 - {image:'theOriginal',title:'原文'},  
25 - {image:'list',title:'列表'}, 21 + private arr: Arr[] = [
  22 + { image: 'clock', title: '定时' },
  23 + { image: 'theOriginal', title: '原文' },
  24 + { image: 'list', title: '列表' },
26 ] 25 ]
27 -  
28 - @State contentDetailData: ContentDetailDTO[] = [] as ContentDetailDTO[]//详情  
29 - @State coverImage:string = '' //封面图  
30 - @State newsTitle:string = '' //标题  
31 - @State audioUrl:string = '' //音频路径  
32 - @State duration:number = 0 //时长  
33 - @State outSetValueOne:number = 40 //播放进度  
34 - 26 + @State contentDetailData: ContentDetailDTO[] = [] as ContentDetailDTO[] //详情
  27 + @State coverImage: string = '' //封面图
  28 + @State newsTitle: string = '' //标题
  29 + @State audioUrl: string = '' //音频路径
  30 + @State duration: number = 0 //时长
  31 + @State outSetValueOne: number = 40 //播放进度
35 @State isPlay: boolean = false 32 @State isPlay: boolean = false
  33 +
36 async aboutToAppear() { 34 async aboutToAppear() {
37 await this.getContentDetailData() 35 await this.getContentDetailData()
38 this.playerController.firstPlay(this.audioUrl); 36 this.playerController.firstPlay(this.audioUrl);
39 - this.playerController.onCanplay = () => {  
40 - this.playerController.play()  
41 - this.isPlay = true  
42 - }  
43 - this.playerController.onTimeUpdate = (nowSeconds, totalSeconds) =>{  
44 - console.log('现在时间',nowSeconds)  
45 - console.log('总时间',totalSeconds) 37 + this.playerController.onTimeUpdate = (nowSeconds, totalSeconds) => {
  38 + console.log('现在时间', nowSeconds)
  39 + console.log('总时间', totalSeconds)
46 this.outSetValueOne = nowSeconds 40 this.outSetValueOne = nowSeconds
47 this.duration = totalSeconds 41 this.duration = totalSeconds
48 } 42 }
49 } 43 }
  44 +
50 onPageHide() { 45 onPageHide() {
51 this.playerController?.pause(); 46 this.playerController?.pause();
52 } 47 }
  48 +
53 build() { 49 build() {
54 Row() { 50 Row() {
55 Column() { 51 Column() {
@@ -63,6 +59,7 @@ export struct AudioDetailComponent { @@ -63,6 +59,7 @@ export struct AudioDetailComponent {
63 .justifyContent(FlexAlign.Center) 59 .justifyContent(FlexAlign.Center)
64 .width('100%') 60 .width('100%')
65 .margin({ top: 64 }) 61 .margin({ top: 64 })
  62 +
66 // 标题 63 // 标题
67 Row() { 64 Row() {
68 Text(this.newsTitle) 65 Text(this.newsTitle)
@@ -75,11 +72,12 @@ export struct AudioDetailComponent { @@ -75,11 +72,12 @@ export struct AudioDetailComponent {
75 } 72 }
76 .padding({ left: 34, right: 34 }) 73 .padding({ left: 34, right: 34 })
77 .margin({ top: 32 }) 74 .margin({ top: 32 })
  75 +
78 // 操作矩阵 76 // 操作矩阵
79 Row() { 77 Row() {
80 - ForEach(this.arr,(item:Arr)=>{ 78 + ForEach(this.arr, (item: Arr) => {
81 Column() { 79 Column() {
82 - Image(item.image=='clock'?$r('app.media.clock_close'):item.image=='theOriginal'?$r('app.media.theOriginal_close'):item.image=='list'?$r('app.media.list_close'):'') 80 + Image(item.image == 'clock' ? $r('app.media.clock_close') : item.image == 'theOriginal' ? $r('app.media.theOriginal_close') : item.image == 'list' ? $r('app.media.list_close') : '')
83 .width(28) 81 .width(28)
84 .height(28) 82 .height(28)
85 Text(item.title) 83 Text(item.title)
@@ -96,9 +94,9 @@ export struct AudioDetailComponent { @@ -96,9 +94,9 @@ export struct AudioDetailComponent {
96 .justifyContent(FlexAlign.SpaceBetween) 94 .justifyContent(FlexAlign.SpaceBetween)
97 .margin({ top: 60 }) 95 .margin({ top: 60 })
98 96
99 - Column(){ 97 + Column() {
100 // 进度条 98 // 进度条
101 - Row(){ 99 + Row() {
102 Slider({ 100 Slider({
103 value: this.outSetValueOne, 101 value: this.outSetValueOne,
104 step: 1 102 step: 1
@@ -107,16 +105,17 @@ export struct AudioDetailComponent { @@ -107,16 +105,17 @@ export struct AudioDetailComponent {
107 .trackColor('rgba(0,0,0,0.5)') 105 .trackColor('rgba(0,0,0,0.5)')
108 .selectedColor('#ED2800') 106 .selectedColor('#ED2800')
109 .onChange((value: number, mode: SliderChangeMode) => { 107 .onChange((value: number, mode: SliderChangeMode) => {
110 - console.log('滑块长度',value) 108 + console.log('滑块长度', value)
111 this.playerController?.setSeekTime(value, mode); 109 this.playerController?.setSeekTime(value, mode);
112 }) 110 })
113 } 111 }
114 .width('100%') 112 .width('100%')
115 - .padding({left:24,right:24})  
116 - .margin({top:110}) 113 + .padding({ left: 24, right: 24 })
  114 + .margin({ top: 110 })
  115 +
117 // 播放按钮 116 // 播放按钮
118 - Row(){  
119 - Column(){ 117 + Row() {
  118 + Column() {
120 Image($r('app.media.loop_close')) 119 Image($r('app.media.loop_close'))
121 .width(24) 120 .width(24)
122 .height(24) 121 .height(24)
@@ -130,26 +129,27 @@ export struct AudioDetailComponent { @@ -130,26 +129,27 @@ export struct AudioDetailComponent {
130 Image($r('app.media.Backward_close')) 129 Image($r('app.media.Backward_close'))
131 .width(24) 130 .width(24)
132 .height(24) 131 .height(24)
133 - Stack({ alignContent: Alignment.Center }){  
134 - Image(this.isPlay?$r('app.media.suspend'):$r('app.media.playicon')) 132 + Stack({ alignContent: Alignment.Center }) {
  133 + Image(this.isPlay ? $r('app.media.suspend') : $r('app.media.playicon'))
135 .width(32) 134 .width(32)
136 .height(32) 135 .height(32)
137 } 136 }
138 .padding(28) 137 .padding(28)
139 .backgroundColor('#4D5258') 138 .backgroundColor('#4D5258')
140 .borderRadius(50) 139 .borderRadius(50)
141 - .onClick(()=>{  
142 - if(this.isPlay){ 140 + .onClick(() => {
  141 + if (this.isPlay) {
143 this.playerController.pause() 142 this.playerController.pause()
144 - }else{ 143 + } else {
145 this.playerController.play() 144 this.playerController.play()
146 } 145 }
147 this.isPlay = !this.isPlay 146 this.isPlay = !this.isPlay
148 }) 147 })
  148 +
149 Image($r('app.media.fastForward_close')) 149 Image($r('app.media.fastForward_close'))
150 .width(24) 150 .width(24)
151 .height(24) 151 .height(24)
152 - Column(){ 152 + Column() {
153 Image($r('app.media.doubleSpeed_close')) 153 Image($r('app.media.doubleSpeed_close'))
154 .width(24) 154 .width(24)
155 .height(24) 155 .height(24)
@@ -162,30 +162,32 @@ export struct AudioDetailComponent { @@ -162,30 +162,32 @@ export struct AudioDetailComponent {
162 } 162 }
163 .width('100%') 163 .width('100%')
164 .justifyContent(FlexAlign.SpaceBetween) 164 .justifyContent(FlexAlign.SpaceBetween)
165 - .margin({top:56})  
166 - .padding({left:32,right:32}) 165 + .margin({ top: 56 })
  166 + .padding({ left: 32, right: 32 })
167 } 167 }
168 .layoutWeight(1) 168 .layoutWeight(1)
  169 +
169 OperRowListView() 170 OperRowListView()
170 } 171 }
171 } 172 }
172 173
173 } 174 }
  175 +
174 private async getContentDetailData() { 176 private async getContentDetailData() {
175 try { 177 try {
176 let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) 178 let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType)
177 this.contentDetailData = data; 179 this.contentDetailData = data;
178 - console.log('音乐详情',JSON.stringify(this.contentDetailData)) 180 + console.log('音乐详情', JSON.stringify(this.contentDetailData))
179 this.newsTitle = this.contentDetailData[0].newsTitle 181 this.newsTitle = this.contentDetailData[0].newsTitle
180 - console.log('标题',JSON.stringify(this.newsTitle)) 182 + console.log('标题', JSON.stringify(this.newsTitle))
181 this.coverImage = this.contentDetailData[0].fullColumnImgUrls[0].url 183 this.coverImage = this.contentDetailData[0].fullColumnImgUrls[0].url
182 - console.log('封面图',JSON.stringify(this.coverImage)) 184 + console.log('封面图', JSON.stringify(this.coverImage))
183 this.duration = this.contentDetailData[0].audioList[0].duration 185 this.duration = this.contentDetailData[0].audioList[0].duration
184 - console.log('音频时长',JSON.stringify(this.duration)) 186 + console.log('音频时长', JSON.stringify(this.duration))
185 this.audioUrl = this.contentDetailData[0].audioList[0].audioUrl 187 this.audioUrl = this.contentDetailData[0].audioList[0].audioUrl
186 - console.log('音频时长',JSON.stringify(this.audioUrl)) 188 + console.log('音频时长', JSON.stringify(this.audioUrl))
187 } catch (exception) { 189 } catch (exception) {
188 - console.log('请求失败',JSON.stringify(exception)) 190 + console.log('请求失败', JSON.stringify(exception))
189 } 191 }
190 } 192 }
191 } 193 }
@@ -2,6 +2,7 @@ import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean'; @@ -2,6 +2,7 @@ import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
2 import { CommonConstants } from 'wdConstant/Index'; 2 import { CommonConstants } from 'wdConstant/Index';
3 import { ProcessUtils } from 'wdRouter'; 3 import { ProcessUtils } from 'wdRouter';
4 import { CardSourceInfo } from '../cardCommon/CardSourceInfo' 4 import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
  5 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
5 const TAG: string = 'Card4Component'; 6 const TAG: string = 'Card4Component';
6 7
7 /** 8 /**
@@ -81,6 +82,7 @@ export struct Card4Component { @@ -81,6 +82,7 @@ export struct Card4Component {
81 .maxLines(3) 82 .maxLines(3)
82 .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 83 .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
83 //三图 84 //三图
  85 + Stack(){
84 Row() { 86 Row() {
85 GridRow({ gutter: 2 }) { 87 GridRow({ gutter: 2 }) {
86 ForEach(this.contentDTO.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => { 88 ForEach(this.contentDTO.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => {
@@ -100,8 +102,14 @@ export struct Card4Component { @@ -100,8 +102,14 @@ export struct Card4Component {
100 }) 102 })
101 } 103 }
102 } 104 }
103 - .width('100%') 105 + .width(CommonConstants.FULL_PARENT)
104 .margin({ top: 8 }) 106 .margin({ top: 8 })
  107 + CardMediaInfo({
  108 + contentDTO: this.contentDTO
  109 + })
  110 + }
  111 + .width(CommonConstants.FULL_PARENT)
  112 + .alignContent(Alignment.BottomEnd)
105 } 113 }
106 .width('100%') 114 .width('100%')
107 .justifyContent(FlexAlign.Start) 115 .justifyContent(FlexAlign.Start)
@@ -220,7 +220,7 @@ struct ChildCommentItem { @@ -220,7 +220,7 @@ struct ChildCommentItem {
220 Span(this.item.fromUserName) 220 Span(this.item.fromUserName)
221 if (this.item.toUserName) { 221 if (this.item.toUserName) {
222 Span(' ') 222 Span(' ')
223 - ImageSpan($r('app.media.comment_reply')).size({ width: 6, height: 9 }).offset({ y: -2.5 }) 223 + ImageSpan($r('app.media.comment_reply')).size({ width: 6, height: 9 }).offset({ y: -2.7 })
224 Span(' ') 224 Span(' ')
225 Span(this.item.toUserName) 225 Span(this.item.toUserName)
226 } 226 }
@@ -44,7 +44,8 @@ export struct CommentText { @@ -44,7 +44,8 @@ export struct CommentText {
44 textContent: this.longMessage, 44 textContent: this.longMessage,
45 fontSize: this.fontSize, 45 fontSize: this.fontSize,
46 fontWeight: this.fontWeight, 46 fontWeight: this.fontWeight,
47 - constraintWidth: (this.screenWidth - padding) 47 + constraintWidth: (this.screenWidth - padding),
  48 + wordBreak:WordBreak.BREAK_ALL
48 }) 49 })
49 50
50 console.log(`文本宽度为:${this.textWidth}`) 51 console.log(`文本宽度为:${this.textWidth}`)
@@ -71,7 +72,8 @@ export struct CommentText { @@ -71,7 +72,8 @@ export struct CommentText {
71 textContent: string, 72 textContent: string,
72 fontSize: this.fontSize, 73 fontSize: this.fontSize,
73 fontWeight: this.fontWeight, 74 fontWeight: this.fontWeight,
74 - constraintWidth: (this.screenWidth - padding) 75 + constraintWidth: (this.screenWidth - padding),
  76 + wordBreak:WordBreak.BREAK_ALL
75 }) 77 })
76 78
77 //计算有误差20 79 //计算有误差20
@@ -130,6 +132,7 @@ export struct CommentText { @@ -130,6 +132,7 @@ export struct CommentText {
130 .fontWeight(this.fontWeight) 132 .fontWeight(this.fontWeight)
131 .fontColor(this.fontColor) 133 .fontColor(this.fontColor)
132 .maxLines(this.lines) 134 .maxLines(this.lines)
  135 + .wordBreak(WordBreak.BREAK_ALL)
133 136
134 // .backgroundColor(Color.Red) 137 // .backgroundColor(Color.Red)
135 138
@@ -7,6 +7,7 @@ import { CustomTitleUI } from '../../reusable/CustomTitleUI' @@ -7,6 +7,7 @@ import { CustomTitleUI } from '../../reusable/CustomTitleUI'
7 import { MyCommentDataSource } from '../model/MyCommentDataSource' 7 import { MyCommentDataSource } from '../model/MyCommentDataSource'
8 import { HttpUtils } from 'wdNetwork/src/main/ets/utils/HttpUtils' 8 import { HttpUtils } from 'wdNetwork/src/main/ets/utils/HttpUtils'
9 import { HttpUrlUtils } from 'wdNetwork/Index' 9 import { HttpUrlUtils } from 'wdNetwork/Index'
  10 +import PageModel from '../../../viewmodel/PageModel'
10 11
11 const TAG = 'QualityCommentsComponent'; 12 const TAG = 'QualityCommentsComponent';
12 13
@@ -14,12 +15,14 @@ const TAG = 'QualityCommentsComponent'; @@ -14,12 +15,14 @@ const TAG = 'QualityCommentsComponent';
14 @Preview 15 @Preview
15 @Component 16 @Component
16 export struct QualityCommentsComponent { 17 export struct QualityCommentsComponent {
  18 +
  19 + @State private browSingModel: PageModel = new PageModel()
  20 + isloading : boolean = false
  21 +
17 @State tileOpacity: number = 0; 22 @State tileOpacity: number = 0;
18 firstPositionY: number = 0; 23 firstPositionY: number = 0;
19 bottomSafeHeight: string = AppStorage.get<number>('bottomSafeHeight') + 'px'; 24 bottomSafeHeight: string = AppStorage.get<number>('bottomSafeHeight') + 'px';
20 topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; 25 topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
21 - // @State private browSingModel: commentListModel = new commentListModel()  
22 - isloading: boolean = false  
23 lastWindowColor: string = '#ffffff' 26 lastWindowColor: string = '#ffffff'
24 currentWindowColor: string = '#FF4202' 27 currentWindowColor: string = '#FF4202'
25 @State allDatas: MyCommentDataSource = new MyCommentDataSource(); 28 @State allDatas: MyCommentDataSource = new MyCommentDataSource();
@@ -221,7 +221,7 @@ class CommentViewModel { @@ -221,7 +221,7 @@ class CommentViewModel {
221 221
222 222
223 //子评论 223 //子评论
224 - if (element.childComments.length) { 224 + if (element.childComments) {
225 for (const obj2 of element.childComments) { 225 for (const obj2 of element.childComments) {
226 if ((obj2.id + '').length > 0) { 226 if ((obj2.id + '').length > 0) {
227 commentIDs.push(obj2.id + '') 227 commentIDs.push(obj2.id + '')
@@ -267,7 +267,7 @@ class CommentViewModel { @@ -267,7 +267,7 @@ class CommentViewModel {
267 if (element.commentId == commentModel.id) { 267 if (element.commentId == commentModel.id) {
268 commentModel.api_status = element.status 268 commentModel.api_status = element.status
269 } 269 }
270 - if (commentModel.childComments.length) { 270 + if (commentModel.childComments) {
271 for (const childCommentModel of commentModel.childComments) { 271 for (const childCommentModel of commentModel.childComments) {
272 if (element.commentId == childCommentModel.id) { 272 if (element.commentId == childCommentModel.id) {
273 childCommentModel.api_status = element.status 273 childCommentModel.api_status = element.status
@@ -310,7 +310,7 @@ class CommentViewModel { @@ -310,7 +310,7 @@ class CommentViewModel {
310 if (element.userId == commentModel.fromUserId) { 310 if (element.userId == commentModel.fromUserId) {
311 commentModel.api_levelHead = element.levelHead 311 commentModel.api_levelHead = element.levelHead
312 } 312 }
313 - if (commentModel.childComments.length) { 313 + if (commentModel.childComments) {
314 for (const childCommentModel of commentModel.childComments) { 314 for (const childCommentModel of commentModel.childComments) {
315 if (element.userId == childCommentModel.fromUserId) { 315 if (element.userId == childCommentModel.fromUserId) {
316 childCommentModel.api_levelHead = element.levelHead 316 childCommentModel.api_levelHead = element.levelHead
@@ -356,7 +356,7 @@ class CommentViewModel { @@ -356,7 +356,7 @@ class CommentViewModel {
356 if (element.creatorId == commentModel.fromCreatorId) { 356 if (element.creatorId == commentModel.fromCreatorId) {
357 commentModel.api_authIcon = element.authIcon 357 commentModel.api_authIcon = element.authIcon
358 } 358 }
359 - if (commentModel.childComments.length) { 359 + if (commentModel.childComments) {
360 for (const childCommentModel of commentModel.childComments) { 360 for (const childCommentModel of commentModel.childComments) {
361 if (element.creatorId == childCommentModel.fromCreatorId) { 361 if (element.creatorId == childCommentModel.fromCreatorId) {
362 childCommentModel.api_authIcon = element.authIcon 362 childCommentModel.api_authIcon = element.authIcon
@@ -4,6 +4,7 @@ import { BreakPointType, Logger } from 'wdKit'; @@ -4,6 +4,7 @@ import { BreakPointType, Logger } from 'wdKit';
4 import { CompUtils } from '../../utils/CompUtils'; 4 import { CompUtils } from '../../utils/CompUtils';
5 import { ProcessUtils } from 'wdRouter'; 5 import { ProcessUtils } from 'wdRouter';
6 import { EmptyComponent } from '../view/EmptyComponent'; 6 import { EmptyComponent } from '../view/EmptyComponent';
  7 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
7 8
8 const TAG = 'Zh_Carousel_Layout-01'; 9 const TAG = 'Zh_Carousel_Layout-01';
9 10
@@ -73,7 +74,7 @@ export struct ZhCarouselLayout01 { @@ -73,7 +74,7 @@ export struct ZhCarouselLayout01 {
73 ForEach(this.compDTO?.operDataList, (item: ContentDTO, index: number) => { 74 ForEach(this.compDTO?.operDataList, (item: ContentDTO, index: number) => {
74 CarouselLayout01CardView({ 75 CarouselLayout01CardView({
75 item: item, 76 item: item,
76 - index: index 77 + length: this.compDTO.operDataList.length
77 }) 78 })
78 }) 79 })
79 } 80 }
@@ -102,6 +103,7 @@ export struct ZhCarouselLayout01 { @@ -102,6 +103,7 @@ export struct ZhCarouselLayout01 {
102 console.info("onAnimationEnd, index: " + index) 103 console.info("onAnimationEnd, index: " + index)
103 }) 104 })
104 105
  106 + if (this.compDTO?.operDataList.length > 1) {
105 // 自定义indicator 107 // 自定义indicator
106 GridRow({ 108 GridRow({
107 columns: this.data.totalCount(), 109 columns: this.data.totalCount(),
@@ -133,6 +135,7 @@ export struct ZhCarouselLayout01 { @@ -133,6 +135,7 @@ export struct ZhCarouselLayout01 {
133 }) 135 })
134 .alignItems(ItemAlign.End) 136 .alignItems(ItemAlign.End)
135 } 137 }
  138 + }
136 .alignContent(Alignment.BottomEnd) 139 .alignContent(Alignment.BottomEnd)
137 .width(CommonConstants.FULL_WIDTH) 140 .width(CommonConstants.FULL_WIDTH)
138 .padding({ 141 .padding({
@@ -159,7 +162,7 @@ export struct ZhCarouselLayout01 { @@ -159,7 +162,7 @@ export struct ZhCarouselLayout01 {
159 @Component 162 @Component
160 struct CarouselLayout01CardView { 163 struct CarouselLayout01CardView {
161 private item: ContentDTO = {} as ContentDTO; 164 private item: ContentDTO = {} as ContentDTO;
162 - private index: number = -1; 165 + private length: number = 1; // 轮播图数量
163 166
164 build() { 167 build() {
165 Stack() { 168 Stack() {
@@ -167,6 +170,7 @@ struct CarouselLayout01CardView { @@ -167,6 +170,7 @@ struct CarouselLayout01CardView {
167 .width(CommonConstants.FULL_PARENT) 170 .width(CommonConstants.FULL_PARENT)
168 .height(CommonConstants.FULL_PARENT) 171 .height(CommonConstants.FULL_PARENT)
169 .objectFit(ImageFit.Cover) 172 .objectFit(ImageFit.Cover)
  173 +
170 Row() 174 Row()
171 .width(CommonConstants.FULL_PARENT) 175 .width(CommonConstants.FULL_PARENT)
172 .height(60) 176 .height(60)
@@ -174,6 +178,13 @@ struct CarouselLayout01CardView { @@ -174,6 +178,13 @@ struct CarouselLayout01CardView {
174 direction: GradientDirection.Top, // 渐变方向:to Top/从下往上 178 direction: GradientDirection.Top, // 渐变方向:to Top/从下往上
175 colors: [[0x7508111A, 0.0], [0x7508111A, 0.3], [Color.Transparent, 1.0]] 179 colors: [[0x7508111A, 0.0], [0x7508111A, 0.3], [Color.Transparent, 1.0]]
176 }) 180 })
  181 + Column() {
  182 + // 这里用于展示轮播图右上角信息,这里只对直播类型的展示
  183 + if (this.item.objectType === '2') {
  184 + CardMediaInfo({ contentDTO: this.item })
  185 + .width(CommonConstants.FULL_PARENT)
  186 + }
  187 + Blank()
177 // 文本信息 188 // 文本信息
178 Text(`${this.item.corner}${this.item.newsTitle}`) 189 Text(`${this.item.corner}${this.item.newsTitle}`)
179 .width(CommonConstants.FULL_PARENT) 190 .width(CommonConstants.FULL_PARENT)
@@ -183,7 +194,7 @@ struct CarouselLayout01CardView { @@ -183,7 +194,7 @@ struct CarouselLayout01CardView {
183 right: 10 194 right: 10
184 }) 195 })
185 .margin({ 196 .margin({
186 - bottom: 28 197 + bottom: this.length > 1 ? 28 : 10
187 }) 198 })
188 .fontColor(Color.White) 199 .fontColor(Color.White)
189 .fontSize($r('app.float.font_size_16')) 200 .fontSize($r('app.float.font_size_16'))
@@ -193,6 +204,9 @@ struct CarouselLayout01CardView { @@ -193,6 +204,9 @@ struct CarouselLayout01CardView {
193 .maxLines(CompUtils.MAX_LINES_2) 204 .maxLines(CompUtils.MAX_LINES_2)
194 .textOverflow({ overflow: TextOverflow.Ellipsis }) 205 .textOverflow({ overflow: TextOverflow.Ellipsis })
195 } 206 }
  207 + .width(CommonConstants.FULL_PARENT)
  208 + .height(CommonConstants.FULL_PARENT)
  209 + }
196 .width(CommonConstants.FULL_WIDTH) 210 .width(CommonConstants.FULL_WIDTH)
197 .aspectRatio(CompUtils.ASPECT_RATIO_2_1) 211 .aspectRatio(CompUtils.ASPECT_RATIO_2_1)
198 .alignContent(Alignment.BottomStart) 212 .alignContent(Alignment.BottomStart)
@@ -244,7 +258,7 @@ struct indicatorAnimations { @@ -244,7 +258,7 @@ struct indicatorAnimations {
244 .width('100%') 258 .width('100%')
245 .alignContent(Alignment.Start) 259 .alignContent(Alignment.Start)
246 260
247 - Text(`0${this.index + 1}`) 261 + Text(this.index + 1 < 10 ? `0${this.index + 1}` : `${this.index + 1}`)
248 .fontSize(this.centerFontSize) 262 .fontSize(this.centerFontSize)
249 .fontColor($r('app.color.white')) 263 .fontColor($r('app.color.white'))
250 .width(16) 264 .width(16)
  1 +import { DateTimeUtils, Logger } from 'wdKit/Index';
  2 +import { WDPlayerController } from 'wdPlayer/Index';
  3 +
  4 +let TAG: string = 'AudioRowComponent'
  5 +
  6 +@Component
  7 +export struct AudioRowComponent {
  8 + @State playerController: WDPlayerController = new WDPlayerController();
  9 + @State audioUrl: string = '' //音频路径
  10 + @State duration: number = 0 //时长
  11 + @State outSetValueOne: number = 0 //播放进度
  12 + @State isPlaying: boolean = false
  13 +
  14 + aboutToAppear(): void {
  15 + this.playerController.firstPlay(this.audioUrl)
  16 + // this.playerController.onTimeUpdate = (nowSeconds, totalSeconds) => {
  17 + // console.log('现在时间', nowSeconds)
  18 + // console.log('总时间', totalSeconds)
  19 + // this.outSetValueOne = nowSeconds
  20 + // this.duration = totalSeconds
  21 + // }
  22 + }
  23 +
  24 + build() {
  25 + Row() {
  26 + Image($r('app.media.icon_voice'))
  27 + .width(20)
  28 + .aspectRatio(1)
  29 + .margin({
  30 + left: 8,
  31 + right: 6
  32 + })
  33 + .visibility(this.isPlaying ? Visibility.Visible : Visibility.Hidden)
  34 + Text(`${DateTimeUtils.getFormattedDuration(this.duration)}`)
  35 + .fontColor('#666666')
  36 + .fontWeight(400)
  37 + .fontSize('14fp')
  38 + }
  39 + .backgroundColor(Color.White)
  40 + .height(36)
  41 + .borderRadius(4)
  42 + .margin({ top: 8, right: 16 })
  43 + .width('100%')
  44 + .onClick(() => {
  45 + this.isPlaying = !this.isPlaying
  46 + this.playerController?.switchPlayOrPause()
  47 + })
  48 + .onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {
  49 + Logger.debug(TAG, `当前屏幕可见区域大小: currentRatio:' +${currentRatio}`)
  50 + // if (isVisible && currentRatio >= 1.0) {
  51 + // Logger.debug(TAG, `播放器-播放. currentRatio:' +${currentRatio}`)
  52 + // this.playerController?.play()
  53 + // }
  54 +
  55 + if (!isVisible && currentRatio <= 0.0) {
  56 + Logger.debug(TAG, `播放器-暂停. currentRatio:' +${currentRatio}`)
  57 + this.playerController?.pause()
  58 + }
  59 + })
  60 + }
  61 +
  62 + aboutToDisappear(): void {
  63 + this.playerController?.release()
  64 + }
  65 +}
@@ -10,6 +10,7 @@ import { QueryListIsFollowedItem } from '../../../viewmodel/QueryListIsFollowedI @@ -10,6 +10,7 @@ import { QueryListIsFollowedItem } from '../../../viewmodel/QueryListIsFollowedI
10 import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; 10 import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
11 import { FollowChildComponent } from './FollowChildComponent'; 11 import { FollowChildComponent } from './FollowChildComponent';
12 import dataPreferences from '@ohos.data.preferences'; 12 import dataPreferences from '@ohos.data.preferences';
  13 +import { EmptyComponent } from '../../view/EmptyComponent';
13 14
14 const TAG = "FollowListDetailUI" 15 const TAG = "FollowListDetailUI"
15 16
@@ -32,8 +33,9 @@ export struct FollowListDetailUI { @@ -32,8 +33,9 @@ export struct FollowListDetailUI {
32 build() { 33 build() {
33 Column() { 34 Column() {
34 if (this.count === 0) { 35 if (this.count === 0) {
35 - ListHasNoMoreDataUI({ style: 2 })  
36 - .height('100%') 36 + EmptyComponent({emptyType:14})
  37 + .layoutWeight(1)
  38 + .width('100%')
37 } else { 39 } else {
38 List({ space: 3 }) { 40 List({ space: 3 }) {
39 LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => { 41 LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => {
@@ -15,6 +15,7 @@ export struct ChildCommentComponent { @@ -15,6 +15,7 @@ export struct ChildCommentComponent {
15 @State isExpandParent: boolean = false; 15 @State isExpandParent: boolean = false;
16 @State isOverLines: boolean = false 16 @State isOverLines: boolean = false
17 @State isOverLinesParent: boolean = false 17 @State isOverLinesParent: boolean = false
  18 + testText:string = "1,因为读书的人\n是低着头向上看的人\n身处一隅,却能放眼世界\n2,因为读书的人\n总是比不读书的人\n活得有趣一点\n3,因为读书的人\n即使平凡,绝不平庸"
18 19
19 build() { 20 build() {
20 Column() { 21 Column() {
@@ -71,7 +72,7 @@ export struct ChildCommentComponent { @@ -71,7 +72,7 @@ export struct ChildCommentComponent {
71 }) 72 })
72 } 73 }
73 } 74 }
74 - .margin({ bottom: '10lpx' }) 75 + .margin({ bottom: '5lpx' })
75 .width('100%') 76 .width('100%')
76 .height('108lpx') 77 .height('108lpx')
77 .padding({ left: '31lpx', right: '31lpx' }) 78 .padding({ left: '31lpx', right: '31lpx' })
@@ -93,6 +94,7 @@ export struct ChildCommentComponent { @@ -93,6 +94,7 @@ export struct ChildCommentComponent {
93 }) 94 })
94 } 95 }
95 }.maxLines(5) 96 }.maxLines(5)
  97 + .wordBreak(WordBreak.BREAK_ALL)
96 .textStyle() 98 .textStyle()
97 } 99 }
98 }.padding({ left: '31lpx', right: '31lpx' }) 100 }.padding({ left: '31lpx', right: '31lpx' })
@@ -138,6 +140,7 @@ export struct ChildCommentComponent { @@ -138,6 +140,7 @@ export struct ChildCommentComponent {
138 }) 140 })
139 } 141 }
140 }.maxLines(5) 142 }.maxLines(5)
  143 + .wordBreak(WordBreak.BREAK_ALL)
141 .textAlign(TextAlign.Start) 144 .textAlign(TextAlign.Start)
142 .width('100%') 145 .width('100%')
143 } 146 }
@@ -243,11 +246,13 @@ export struct ChildCommentComponent { @@ -243,11 +246,13 @@ export struct ChildCommentComponent {
243 let measureTruncateWidth: number = measure.measureText({ 246 let measureTruncateWidth: number = measure.measureText({
244 textContent: truncateContent, 247 textContent: truncateContent,
245 fontSize: px2fp(fontSize), 248 fontSize: px2fp(fontSize),
  249 + wordBreak:WordBreak.BREAK_ALL
246 }) 250 })
247 if(type === 1){ 251 if(type === 1){
248 measureTruncateWidth = measureTruncateWidth + measure.measureText({ 252 measureTruncateWidth = measureTruncateWidth + measure.measureText({
249 textContent: `@${this.data.parentCommentUserName}:`, 253 textContent: `@${this.data.parentCommentUserName}:`,
250 fontSize: px2fp(fontSize), 254 fontSize: px2fp(fontSize),
  255 + wordBreak:WordBreak.BREAK_ALL
251 }) 256 })
252 } 257 }
253 let clipStr: string = '' 258 let clipStr: string = ''
@@ -255,6 +260,7 @@ export struct ChildCommentComponent { @@ -255,6 +260,7 @@ export struct ChildCommentComponent {
255 if (measure.measureText({ 260 if (measure.measureText({
256 textContent: clipStr, 261 textContent: clipStr,
257 fontSize: px2fp(fontSize), 262 fontSize: px2fp(fontSize),
  263 + wordBreak:WordBreak.BREAK_ALL
258 }) >= textWidth * maxLines - measureTruncateWidth) { 264 }) >= textWidth * maxLines - measureTruncateWidth) {
259 if (type === 0) { 265 if (type === 0) {
260 this.isOverLines = true 266 this.isOverLines = true
@@ -95,7 +95,7 @@ export struct HomePageBottomComponent{ @@ -95,7 +95,7 @@ export struct HomePageBottomComponent{
95 WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) 95 WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
96 }) 96 })
97 97
98 - EmptyComponent({emptyType:4}) 98 + EmptyComponent({emptyType:14})
99 .layoutWeight(1) 99 .layoutWeight(1)
100 .width('100%') 100 .width('100%')
101 }.layoutWeight(1) 101 }.layoutWeight(1)
@@ -5,6 +5,7 @@ import MinePageDatasModel from '../../../model/MinePageDatasModel'; @@ -5,6 +5,7 @@ import MinePageDatasModel from '../../../model/MinePageDatasModel';
5 import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; 5 import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem';
6 import { UserFollowListRequestItem } from '../../../viewmodel/UserFollowListRequestItem'; 6 import { UserFollowListRequestItem } from '../../../viewmodel/UserFollowListRequestItem';
7 import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; 7 import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
  8 +import { EmptyComponent } from '../../view/EmptyComponent';
8 import { FollowChildComponent } from '../follow/FollowChildComponent'; 9 import { FollowChildComponent } from '../follow/FollowChildComponent';
9 10
10 const TAG = "HomePageBottomComponent" 11 const TAG = "HomePageBottomComponent"
@@ -30,8 +31,37 @@ export struct OtherHomePageBottomFollowComponent{ @@ -30,8 +31,37 @@ export struct OtherHomePageBottomFollowComponent{
30 .backgroundColor($r('app.color.color_EDEDED')) 31 .backgroundColor($r('app.color.color_EDEDED'))
31 32
32 if(this.count === 0){ 33 if(this.count === 0){
33 - ListHasNoMoreDataUI({style:2})  
34 - .height('100%') 34 + Column(){
  35 + Row(){
  36 + Text("关注更多人民号")
  37 + .fontWeight('400lpx')
  38 + .fontColor($r('app.color.color_222222'))
  39 + .lineHeight('38lpx')
  40 + .fontSize('27lpx')
  41 + .textAlign(TextAlign.Center)
  42 + .margin({right:'4lpx'})
  43 + Image($r('app.media.arrow_icon_right'))
  44 + .objectFit(ImageFit.Auto)
  45 + .width('27lpx')
  46 + .height('27lpx')
  47 + }.height('69lpx')
  48 + .width('659lpx')
  49 + .alignItems(VerticalAlign.Center)
  50 + .justifyContent(FlexAlign.Center)
  51 + .backgroundColor($r('app.color.color_F5F5F5'))
  52 + .margin({top:'31lpx',bottom:'4lpx'})
  53 + .onClick(()=>{
  54 + let params: Params = {
  55 + pageID: "1"
  56 + }
  57 + WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
  58 + })
  59 +
  60 + EmptyComponent({emptyType:14})
  61 + .layoutWeight(1)
  62 + .width('100%')
  63 + }.layoutWeight(1)
  64 + .justifyContent(FlexAlign.Start)
35 }else{ 65 }else{
36 List({ space: 3 }) { 66 List({ space: 3 }) {
37 67
1 import { BottomNavi, CommonConstants } from 'wdConstant'; 1 import { BottomNavi, CommonConstants } from 'wdConstant';
2 import { BottomNavDTO } from 'wdBean'; 2 import { BottomNavDTO } from 'wdBean';
3 -import { Logger } from 'wdKit'; 3 +import { EmitterEventId, EmitterUtils, Logger } from 'wdKit';
4 import { TopNavigationComponent } from './TopNavigationComponent'; 4 import { TopNavigationComponent } from './TopNavigationComponent';
5 import { MinePageComponent } from './MinePageComponent'; 5 import { MinePageComponent } from './MinePageComponent';
6 import { CompUtils } from '../../utils/CompUtils'; 6 import { CompUtils } from '../../utils/CompUtils';
7 import PageViewModel from '../../viewmodel/PageViewModel'; 7 import PageViewModel from '../../viewmodel/PageViewModel';
  8 +import HomeChannelUtils, { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
8 9
9 const TAG = 'BottomNavigationComponent'; 10 const TAG = 'BottomNavigationComponent';
10 let storage = LocalStorage.getShared(); 11 let storage = LocalStorage.getShared();
@@ -39,6 +40,10 @@ export struct BottomNavigationComponent { @@ -39,6 +40,10 @@ export struct BottomNavigationComponent {
39 * Component opacity value: 0.6. 40 * Component opacity value: 0.6.
40 */ 41 */
41 readonly SIXTY_OPACITY: number = 0.6; 42 readonly SIXTY_OPACITY: number = 0.6;
  43 + // 接收指定频道跳转的参数
  44 + @State assignChannel: AssignChannelParam = new AssignChannelParam()
  45 + // 用于传参到顶导组件,【不用channelParam,主要是时序问题,需要先底导处理完,再延时触发顶导处理】
  46 + @State assignChannel1: AssignChannelParam = new AssignChannelParam()
42 47
43 async aboutToAppear() { 48 async aboutToAppear() {
44 Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`); 49 Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`);
@@ -49,6 +54,16 @@ export struct BottomNavigationComponent { @@ -49,6 +54,16 @@ export struct BottomNavigationComponent {
49 bottomNav.bottomNavList = bottomNav.bottomNavList.filter(item => item.name !== '服务'); 54 bottomNav.bottomNavList = bottomNav.bottomNavList.filter(item => item.name !== '服务');
50 this.bottomNavList = bottomNav.bottomNavList 55 this.bottomNavList = bottomNav.bottomNavList
51 } 56 }
  57 + HomeChannelUtils.setBottomNavData(bottomNav)
  58 +
  59 + EmitterUtils.receiveEvent(EmitterEventId.JUMP_HOME_CHANNEL, (str?: string) => {
  60 + Logger.debug(TAG, 'receiveEvent JUMP_HOME_CHANNEL: ' + str)
  61 + if (str) {
  62 + // 跳转指定频道场景,传参底导id、频道id
  63 + this.assignChannel = JSON.parse(str) as AssignChannelParam
  64 + this.changeBottomNav()
  65 + }
  66 + })
52 } 67 }
53 68
54 aboutToDisappear() { 69 aboutToDisappear() {
@@ -69,8 +84,8 @@ export struct BottomNavigationComponent { @@ -69,8 +84,8 @@ export struct BottomNavigationComponent {
69 topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), 84 topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
70 _currentNavIndex: $currentNavIndex, 85 _currentNavIndex: $currentNavIndex,
71 currentBottomNavName: navItem.name, 86 currentBottomNavName: navItem.name,
72 - barBackgroundColor: $barBackgroundColor  
73 - 87 + barBackgroundColor: $barBackgroundColor,
  88 + assignChannel: this.assignChannel1
74 }) 89 })
75 } 90 }
76 91
@@ -145,4 +160,30 @@ export struct BottomNavigationComponent { @@ -145,4 +160,30 @@ export struct BottomNavigationComponent {
145 // Logger.info(TAG, `onBottomNavigationDataUpdated currentNavIndex: ${this.currentNavIndex},length:${this.bottomNavItemList.length}`); 160 // Logger.info(TAG, `onBottomNavigationDataUpdated currentNavIndex: ${this.currentNavIndex},length:${this.bottomNavItemList.length}`);
146 this.onBottomNavigationIndexChange() 161 this.onBottomNavigationIndexChange()
147 } 162 }
  163 +
  164 + /**
  165 + * 底导id变化,即指定频道跳转场景
  166 + */
  167 + changeBottomNav() {
  168 + let index = -1
  169 + for (let i = 0; i < this.bottomNavList.length; i++) {
  170 + let bottomNavDTO: BottomNavDTO = this.bottomNavList[i]
  171 + if (bottomNavDTO.id.toString() === this.assignChannel.bottomNavId) {
  172 + index = i
  173 + break
  174 + }
  175 + }
  176 + if (index >= 0 && index != this.currentNavIndex) {
  177 + // 切底导
  178 + this.currentNavIndex = index
  179 + }
  180 +
  181 + setTimeout(() => {
  182 + // 底导切换后,触发顶导切换
  183 + this.assignChannel1 = new AssignChannelParam()
  184 + this.assignChannel1.pageId = this.assignChannel.pageId
  185 + this.assignChannel1.channelId = this.assignChannel.channelId
  186 + this.assignChannel1.bottomNavId = this.assignChannel.bottomNavId
  187 + }, 20)
  188 + }
148 } 189 }
@@ -2,8 +2,7 @@ import { Action, ContentDTO, Params } from 'wdBean'; @@ -2,8 +2,7 @@ import { Action, ContentDTO, Params } from 'wdBean';
2 import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant'; 2 import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant';
3 import { Logger } from 'wdKit'; 3 import { Logger } from 'wdKit';
4 import { CompUtils } from '../../utils/CompUtils'; 4 import { CompUtils } from '../../utils/CompUtils';
5 -import { WDRouterRule } from 'wdRouter';  
6 -import { ProcessUtils } from 'wdRouter'; 5 +import { ProcessUtils, WDRouterRule } from 'wdRouter';
7 6
8 const TAG: string = 'CardView'; 7 const TAG: string = 'CardView';
9 8
@@ -24,8 +23,7 @@ export struct CarouselLayout01CardView { @@ -24,8 +23,7 @@ export struct CarouselLayout01CardView {
24 Image(this.item.coverUrl) 23 Image(this.item.coverUrl)
25 .width(CommonConstants.FULL_PARENT) 24 .width(CommonConstants.FULL_PARENT)
26 .height(CommonConstants.FULL_PARENT) 25 .height(CommonConstants.FULL_PARENT)
27 - .objectFit(ImageFit.Cover)  
28 - // .borderRadius($r("app.float.border_radius_6")) 26 + .objectFit(ImageFit.Cover)// .borderRadius($r("app.float.border_radius_6"))
29 .alignRules({ 27 .alignRules({
30 top: { anchor: '__container__', align: VerticalAlign.Top }, 28 top: { anchor: '__container__', align: VerticalAlign.Top },
31 left: { anchor: '__container__', align: HorizontalAlign.Start } 29 left: { anchor: '__container__', align: HorizontalAlign.Start }
@@ -435,11 +433,10 @@ export struct PaperSingleColumn999CardView { @@ -435,11 +433,10 @@ export struct PaperSingleColumn999CardView {
435 .fontSize(12) 433 .fontSize(12)
436 .fontColor(Color.Gray) 434 .fontColor(Color.Gray)
437 .margin({ left: 22 }) 435 .margin({ left: 22 })
438 - Image($r('app.media.icon_share')) 436 + Image($r('app.media.icon_forward'))
439 .width(16) 437 .width(16)
440 .height(16) 438 .height(16)
441 .margin({ left: 10, right: 22, top: 10, bottom: 10 }) 439 .margin({ left: 10, right: 22, top: 10, bottom: 10 })
442 - .backgroundColor(Color.Brown)  
443 }.width(CommonConstants.FULL_PARENT) 440 }.width(CommonConstants.FULL_PARENT)
444 .justifyContent(FlexAlign.SpaceBetween) 441 .justifyContent(FlexAlign.SpaceBetween)
445 } 442 }
@@ -447,7 +444,7 @@ export struct PaperSingleColumn999CardView { @@ -447,7 +444,7 @@ export struct PaperSingleColumn999CardView {
447 .backgroundColor(Color.White) 444 .backgroundColor(Color.White)
448 .margin({ bottom: 5, left: 12, right: 12 }) 445 .margin({ bottom: 5, left: 12, right: 12 })
449 .borderRadius(4) 446 .borderRadius(4)
450 - .onClick(()=>{ 447 + .onClick(() => {
451 ProcessUtils.processPage(this.item) 448 ProcessUtils.processPage(this.item)
452 }) 449 })
453 } 450 }
@@ -65,7 +65,6 @@ export struct PageComponent { @@ -65,7 +65,6 @@ export struct PageComponent {
65 this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight) 65 this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
66 }) 66 })
67 } 67 }
68 -  
69 LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => { 68 LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {
70 ListItem() { 69 ListItem() {
71 Column() { 70 Column() {
@@ -124,9 +123,10 @@ export struct PageComponent { @@ -124,9 +123,10 @@ export struct PageComponent {
124 123
125 if (this.pageAdvModel.isShowAds) { 124 if (this.pageAdvModel.isShowAds) {
126 if (this.pageAdvModel.pageCornerAdv.matInfo != null) { 125 if (this.pageAdvModel.pageCornerAdv.matInfo != null) {
127 - // 页面右边挂角 126 + // 广告中心的挂角广告
128 this.drawPageCornerAdvView(1, 1 == this.pageAdvModel.isRightAdv) 127 this.drawPageCornerAdvView(1, 1 == this.pageAdvModel.isRightAdv)
129 } else if (this.pageAdvModel.pageCornerContentInfo.advert != null) { 128 } else if (this.pageAdvModel.pageCornerContentInfo.advert != null) {
  129 + // 展现中心的挂角广告业务
130 this.drawPageCornerAdvView(2, 1 == this.pageAdvModel.isRightAdv) 130 this.drawPageCornerAdvView(2, 1 == this.pageAdvModel.isRightAdv)
131 } 131 }
132 } 132 }
@@ -5,6 +5,7 @@ import hilog from '@ohos.hilog'; @@ -5,6 +5,7 @@ import hilog from '@ohos.hilog';
5 import { PrivacySettingModel } from '../../model/PrivacySettingModel' 5 import { PrivacySettingModel } from '../../model/PrivacySettingModel'
6 import { Params } from 'wdBean'; 6 import { Params } from 'wdBean';
7 import { WDRouterPage, WDRouterRule } from 'wdRouter'; 7 import { WDRouterPage, WDRouterRule } from 'wdRouter';
  8 +import { HttpUrlUtils } from 'wdNetwork/Index';
8 9
9 const TAG = 'PrivacySettingPage'; 10 const TAG = 'PrivacySettingPage';
10 const DiyString = '开启个性化推荐' 11 const DiyString = '开启个性化推荐'
@@ -23,6 +24,9 @@ export struct PrivacySettingPage { @@ -23,6 +24,9 @@ export struct PrivacySettingPage {
23 } 24 }
24 25
25 aboutToAppear() { 26 aboutToAppear() {
  27 + if (!HttpUrlUtils.getUserId()) {
  28 + this.listData.splice(0, 1);
  29 + }
26 // 获取权限= 30 // 获取权限=
27 // SPHelper.default.save('sdf','sdf'); 31 // SPHelper.default.save('sdf','sdf');
28 // this.initListData(); 32 // this.initListData();
@@ -60,7 +64,7 @@ export struct PrivacySettingPage { @@ -60,7 +64,7 @@ export struct PrivacySettingPage {
60 List({ space: '23lpx' }) { 64 List({ space: '23lpx' }) {
61 ForEach(this.listData, (item: PrivacySettingModel, index:number) => { 65 ForEach(this.listData, (item: PrivacySettingModel, index:number) => {
62 ListItem() { 66 ListItem() {
63 - if (index == 0) { 67 + if (item.privacyName == DiyString) {
64 getTuiJianCell({ item:item, index:index }); 68 getTuiJianCell({ item:item, index:index });
65 } else { 69 } else {
66 getArrowCell({ item:item, index:index }); 70 getArrowCell({ item:item, index:index });
@@ -73,6 +77,8 @@ export struct PrivacySettingPage { @@ -73,6 +77,8 @@ export struct PrivacySettingPage {
73 PermissionUtil.reqPermissionsFromUser([item.permissionKey], this).then((res)=>{ 77 PermissionUtil.reqPermissionsFromUser([item.permissionKey], this).then((res)=>{
74 item.permission = res; 78 item.permission = res;
75 }); 79 });
  80 + }else{
  81 + PermissionUtil.openPermissionsInSystemSettings(this);
76 } 82 }
77 } 83 }
78 }) 84 })
1 import { Action, CompDTO, Params, TopNavDTO } from 'wdBean'; 1 import { Action, CompDTO, Params, TopNavDTO } from 'wdBean';
2 -import { LazyDataSource, Logger } from 'wdKit'; 2 +import { LazyDataSource, Logger, StringUtils } from 'wdKit';
3 import { ProcessUtils } from 'wdRouter'; 3 import { ProcessUtils } from 'wdRouter';
4 import { PageComponent } from './PageComponent'; 4 import { PageComponent } from './PageComponent';
5 import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'; 5 import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout';
@@ -7,6 +7,7 @@ import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent @@ -7,6 +7,7 @@ import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent
7 import window from '@ohos.window'; 7 import window from '@ohos.window';
8 import { WindowModel } from 'wdKit'; 8 import { WindowModel } from 'wdKit';
9 import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; 9 import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';
  10 +import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
10 11
11 const TAG = 'TopNavigationComponent'; 12 const TAG = 'TopNavigationComponent';
12 13
@@ -49,6 +50,7 @@ export struct TopNavigationComponent { @@ -49,6 +50,7 @@ export struct TopNavigationComponent {
49 // 地方频道列表 50 // 地方频道列表
50 @State localChannelList: TopNavDTO[] = [] 51 @State localChannelList: TopNavDTO[] = []
51 readonly MAX_LINE: number = 1; 52 readonly MAX_LINE: number = 1;
  53 + @ObjectLink @Watch('onAssignChannelChange') assignChannel: AssignChannelParam
52 54
53 //处理新闻tab顶导频道数据 55 //处理新闻tab顶导频道数据
54 topNavListHandle() { 56 topNavListHandle() {
@@ -308,4 +310,81 @@ export struct TopNavigationComponent { @@ -308,4 +310,81 @@ export struct TopNavigationComponent {
308 onTopNavigationDataUpdated() { 310 onTopNavigationDataUpdated() {
309 Logger.info(TAG, `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`); 311 Logger.info(TAG, `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`);
310 } 312 }
  313 +
  314 + /**
  315 + * 频道id变化,即指定频道跳转场景
  316 + */
  317 + onAssignChannelChange() {
  318 + let channelId = this.assignChannel.channelId
  319 + let index = -1
  320 + if (this._currentNavIndex === 0) {
  321 + // 第一个,新闻,先拿我的,再拿其他
  322 + index = this.getChannelByMine(channelId)
  323 + if (index == -1) {
  324 + // 不在我的里,需要临时新增频道展示
  325 + let channel = this.getChannelByOthers(channelId)
  326 + if (channel) {
  327 + this.myChannelList.push(channel)
  328 + setTimeout(() => {
  329 + this.tabsController.changeIndex(this.myChannelList.length - 1)
  330 + }, 20)
  331 + }
  332 + } else {
  333 + // 直接切换
  334 + this.tabsController.changeIndex(index)
  335 + }
  336 + } else {
  337 + index = this.getChannelByTopNav(channelId)
  338 + if (index > -1) {
  339 + // 找到了,直接切换,否则不处理
  340 + this.tabsController.changeIndex(index)
  341 + }
  342 + }
  343 +
  344 + }
  345 +
  346 + /**
  347 + * 非新闻,从topNav里拿数据
  348 + */
  349 + private getChannelByTopNav(channelId: string) {
  350 + for (let i = 0; i < this.topNavList.length; i++) {
  351 + let topNavDTO: TopNavDTO = this.topNavList[i]
  352 + if (topNavDTO.channelId.toString() === channelId) {
  353 + return i
  354 + }
  355 + }
  356 + return -1
  357 + }
  358 +
  359 + /**
  360 + * 新闻,从myChannelList里拿数据
  361 + */
  362 + private getChannelByMine(channelId: string) {
  363 + for (let i = 0; i < this.myChannelList.length; i++) {
  364 + let topNavDTO: TopNavDTO = this.myChannelList[i]
  365 + if (topNavDTO.channelId.toString() === channelId) {
  366 + return i
  367 + }
  368 + }
  369 + return -1
  370 + }
  371 +
  372 + /**
  373 + * 新闻,从其他里拿数据
  374 + */
  375 + private getChannelByOthers(channelId: string) {
  376 + for (let i = 0; i < this.moreChannelList.length; i++) {
  377 + let topNavDTO: TopNavDTO = this.moreChannelList[i]
  378 + if (topNavDTO.channelId.toString() === channelId) {
  379 + return topNavDTO
  380 + }
  381 + }
  382 + for (let j = 0; j < this.localChannelList.length; j++) {
  383 + let topNavDTO: TopNavDTO = this.localChannelList[j]
  384 + if (topNavDTO.channelId.toString() === channelId) {
  385 + return topNavDTO
  386 + }
  387 + }
  388 + return null
  389 + }
311 } 390 }
@@ -24,7 +24,7 @@ export struct PeopleShipHomeListComponent { @@ -24,7 +24,7 @@ export struct PeopleShipHomeListComponent {
24 // 列表 24 // 列表
25 else if (this.publishCount == 0) { 25 else if (this.publishCount == 0) {
26 // 无数据展示 26 // 无数据展示
27 - EmptyComponent().height(DisplayUtils.getDeviceHeight() - this.topHeight) 27 + EmptyComponent({emptyType: 13}).height(DisplayUtils.getDeviceHeight() - this.topHeight)
28 } else { 28 } else {
29 Column() { 29 Column() {
30 Column() { 30 Column() {
@@ -46,6 +46,7 @@ export struct PeopleShipHomeListComponent { @@ -46,6 +46,7 @@ export struct PeopleShipHomeListComponent {
46 .alignItems(VerticalAlign.Bottom) 46 .alignItems(VerticalAlign.Bottom)
47 .width('100%') 47 .width('100%')
48 } 48 }
  49 + .height('44vp')
49 .alignItems(HorizontalAlign.Start) 50 .alignItems(HorizontalAlign.Start)
50 .width('100%') 51 .width('100%')
51 52
@@ -109,8 +110,8 @@ export struct PeopleShipHomeListComponent { @@ -109,8 +110,8 @@ export struct PeopleShipHomeListComponent {
109 .justifyContent(FlexAlign.Center) 110 .justifyContent(FlexAlign.Center)
110 .constraintSize({ minWidth: 35 }) 111 .constraintSize({ minWidth: 35 })
111 .margin({ 112 .margin({
112 - left: '16vp',  
113 - right: '16vp' 113 + left: index == 0 ? '16vp' : '10vp',
  114 + right: index == this.tabArr.length - 1 ? '16vp' : '10vp'
114 }) 115 })
115 .height('44vp') 116 .height('44vp')
116 .onClick(() => { 117 .onClick(() => {
@@ -6,6 +6,7 @@ import { Logger } from 'wdKit' @@ -6,6 +6,7 @@ import { Logger } from 'wdKit'
6 import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel' 6 import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel'
7 import { InfluenceData, PeopleShipUserDetailData } from 'wdBean' 7 import { InfluenceData, PeopleShipUserDetailData } from 'wdBean'
8 import { PeopleShipHomeAttentionComponent } from './PeopleShipHomeAttentionComponent' 8 import { PeopleShipHomeAttentionComponent } from './PeopleShipHomeAttentionComponent'
  9 +import { HWLocationUtils } from 'wdHwAbility'
9 10
10 11
11 @Component 12 @Component
@@ -29,6 +30,7 @@ export struct PeopleShipHomePageTopComponent { @@ -29,6 +30,7 @@ export struct PeopleShipHomePageTopComponent {
29 @State topFixedHeight: number = 320 30 @State topFixedHeight: number = 320
30 @State lineInNum: number = 1 31 @State lineInNum: number = 1
31 @Link topHeight: number 32 @Link topHeight: number
  33 + @State provinceName: string = ''
32 build() { 34 build() {
33 Column() { 35 Column() {
34 Stack({ alignContent: Alignment.TopStart}) { 36 Stack({ alignContent: Alignment.TopStart}) {
@@ -136,7 +138,6 @@ export struct PeopleShipHomePageTopComponent { @@ -136,7 +138,6 @@ export struct PeopleShipHomePageTopComponent {
136 .margin({ 138 .margin({
137 left: '16vp', 139 left: '16vp',
138 right: '16vp', 140 right: '16vp',
139 - bottom: '10vp'  
140 }) 141 })
141 }.width('100%') 142 }.width('100%')
142 .alignItems(VerticalAlign.Top) 143 .alignItems(VerticalAlign.Top)
@@ -151,14 +152,14 @@ export struct PeopleShipHomePageTopComponent { @@ -151,14 +152,14 @@ export struct PeopleShipHomePageTopComponent {
151 .margin({ 152 .margin({
152 left: '16vp', 153 left: '16vp',
153 right: '16vp', 154 right: '16vp',
154 - bottom: '10vp'  
155 }) 155 })
156 }.width('100%') 156 }.width('100%')
157 .alignItems(VerticalAlign.Top) 157 .alignItems(VerticalAlign.Top)
158 } 158 }
159 159
160 // IP归属地 160 // IP归属地
161 - Text(`IP归属地:${this.detailModel.region}`) 161 + if (this.provinceName && this.provinceName.length > 0) {
  162 + Text(`IP归属地:${this.provinceName}`)
162 .lineHeight('18vp') 163 .lineHeight('18vp')
163 .fontSize($r('app.float.vp_12')) 164 .fontSize($r('app.float.vp_12'))
164 .fontColor($r('app.color.color_999999')) 165 .fontColor($r('app.color.color_999999'))
@@ -168,7 +169,9 @@ export struct PeopleShipHomePageTopComponent { @@ -168,7 +169,9 @@ export struct PeopleShipHomePageTopComponent {
168 .margin({ 169 .margin({
169 right: '16vp', 170 right: '16vp',
170 left: '16vp', 171 left: '16vp',
  172 + top: '10vp'
171 }) 173 })
  174 + }
172 175
173 // 发布, 粉丝, 影响力 176 // 发布, 粉丝, 影响力
174 Row() { 177 Row() {
@@ -294,7 +297,8 @@ export struct PeopleShipHomePageTopComponent { @@ -294,7 +297,8 @@ export struct PeopleShipHomePageTopComponent {
294 }) 297 })
295 } 298 }
296 299
297 - onIntroductionUpdated() { 300 + async onIntroductionUpdated() {
  301 +
298 if (this.content.length == 0 && this.detailModel.introduction ) { 302 if (this.content.length == 0 && this.detailModel.introduction ) {
299 this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) 303 this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
300 if (this.lineInNum > 3) { 304 if (this.lineInNum > 3) {
@@ -303,7 +307,12 @@ export struct PeopleShipHomePageTopComponent { @@ -303,7 +307,12 @@ export struct PeopleShipHomePageTopComponent {
303 } 307 }
304 } 308 }
305 if (this.detailModel) { 309 if (this.detailModel) {
306 - this.topFixedHeight = 336 310 + this.topFixedHeight = 308
  311 + if (this.detailModel.region && this.detailModel.region.length > 0) {
  312 + this.provinceName = this.detailModel.region
  313 + }else {
  314 + this.provinceName = await this.computeIPRegion(this.detailModel.province)
  315 + }
307 if(this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) { 316 if(this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) {
308 this.topFixedHeight += this.getTextLineNum(this.detailModel.categoryAuth, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22 317 this.topFixedHeight += this.getTextLineNum(this.detailModel.categoryAuth, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22
309 } 318 }
@@ -325,6 +334,10 @@ export struct PeopleShipHomePageTopComponent { @@ -325,6 +334,10 @@ export struct PeopleShipHomePageTopComponent {
325 }else { 334 }else {
326 this.topHeight = this.topFixedHeight + (this.isCollapse ? 21*3 : 21 * this.lineInNum ) 335 this.topHeight = this.topFixedHeight + (this.isCollapse ? 21*3 : 21 * this.lineInNum )
327 } 336 }
  337 + // IP归属地
  338 + if (this.provinceName && this.provinceName.length > 0) {
  339 + this.topHeight += 28
  340 + }
328 } 341 }
329 } 342 }
330 343
@@ -335,4 +348,17 @@ export struct PeopleShipHomePageTopComponent { @@ -335,4 +348,17 @@ export struct PeopleShipHomePageTopComponent {
335 return `${count}` 348 return `${count}`
336 } 349 }
337 350
  351 + // 通过省份code获取IP问题
  352 + private async computeIPRegion(province: string) {
  353 + if (province && province.length) {
  354 + try {
  355 + let provinceName = await HWLocationUtils.getProvinceName(province) ;
  356 + return provinceName
  357 + } catch (e) {
  358 + return ''
  359 + }
  360 + }
  361 + return ''
  362 + }
  363 +
338 } 364 }
@@ -41,6 +41,8 @@ export const enum WDViewDefaultType { @@ -41,6 +41,8 @@ export const enum WDViewDefaultType {
41 WDViewDefaultType_NoVideo, 41 WDViewDefaultType_NoVideo,
42 /// 16.暂无内容1 42 /// 16.暂无内容1
43 WDViewDefaultType_NoContent1, 43 WDViewDefaultType_NoContent1,
  44 + // 17. 暂无评论快来抢沙发
  45 + WDViewDefaultType_NoComment1
44 } 46 }
45 47
46 /** 48 /**
@@ -210,6 +212,8 @@ export struct EmptyComponent { @@ -210,6 +212,8 @@ export struct EmptyComponent {
210 contentString = '暂无内容' 212 contentString = '暂无内容'
211 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoFollow) { 213 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoFollow) {
212 contentString = '暂无关注' 214 contentString = '暂无关注'
  215 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment1) {
  216 + contentString = '暂无评论,快来抢沙发'
213 } 217 }
214 218
215 return contentString 219 return contentString
@@ -222,7 +226,7 @@ export struct EmptyComponent { @@ -222,7 +226,7 @@ export struct EmptyComponent {
222 imageString = $r('app.media.icon_no_collection') 226 imageString = $r('app.media.icon_no_collection')
223 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) { 227 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) {
224 imageString = $r('app.media.icon_no_message') 228 imageString = $r('app.media.icon_no_message')
225 - } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment) { 229 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment || this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment1) {
226 imageString = $r('app.media.icon_no_comment') 230 imageString = $r('app.media.icon_no_comment')
227 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoSearchResult) { 231 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoSearchResult) {
228 imageString = $r('app.media.icon_no_result') 232 imageString = $r('app.media.icon_no_result')
@@ -254,3 +258,4 @@ export struct EmptyComponent { @@ -254,3 +258,4 @@ export struct EmptyComponent {
254 } 258 }
255 } 259 }
256 } 260 }
  261 +
@@ -46,38 +46,12 @@ export struct LiveEmptyComponent { @@ -46,38 +46,12 @@ export struct LiveEmptyComponent {
46 private timer: number = -1 46 private timer: number = -1
47 retry: () => void = () => { 47 retry: () => void = () => {
48 } 48 }
49 -  
50 - createTimer() {  
51 - if (this.emptyType === 8) {  
52 - this.timer = setInterval(() => {  
53 - this.timeNum--;  
54 - if (this.timeNum === 0) {  
55 - clearInterval(this.timer);  
56 - }  
57 - }, 1000);  
58 - }  
59 - }  
60 -  
61 - destroyTimer() {  
62 - if (this.emptyType === 8) {  
63 - clearInterval(this.timer);  
64 - }  
65 - }  
66 -  
67 - onPageShow(): void {  
68 - this.createTimer()  
69 - }  
70 -  
71 - aboutToAppear(): void {  
72 - this.createTimer()  
73 - }  
74 -  
75 onPageHide(): void { 49 onPageHide(): void {
76 - this.destroyTimer() 50 +
77 } 51 }
78 52
79 aboutToDisappear() { 53 aboutToDisappear() {
80 - this.destroyTimer() 54 +
81 } 55 }
82 56
83 build() { 57 build() {
@@ -98,7 +72,7 @@ export struct LiveEmptyComponent { @@ -98,7 +72,7 @@ export struct LiveEmptyComponent {
98 // .width('this.EMPTY_IMAGE_WIDTH') 72 // .width('this.EMPTY_IMAGE_WIDTH')
99 // .height(this.EMPTY_IMAGE_HEIGHT) 73 // .height(this.EMPTY_IMAGE_HEIGHT)
100 74
101 - Text(this.emptyType !== 8 ? this.buildNoDataTip() : `${this.buildNoDataTip()}(${this.timeNum}s)`) 75 + Text(this.buildNoDataTip())
102 .fontSize($r('app.float.font_size_14')) 76 .fontSize($r('app.float.font_size_14'))
103 .fontColor('#FF999999') 77 .fontColor('#FF999999')
104 .fontWeight(FontWeight.Normal) 78 .fontWeight(FontWeight.Normal)
@@ -107,42 +81,6 @@ export struct LiveEmptyComponent { @@ -107,42 +81,6 @@ export struct LiveEmptyComponent {
107 .onClick((event: ClickEvent) => { 81 .onClick((event: ClickEvent) => {
108 Logger.info(TAG, `noProgrammeData onClick event?.source: ${event.source}`); 82 Logger.info(TAG, `noProgrammeData onClick event?.source: ${event.source}`);
109 }) 83 })
110 -  
111 - if (this.isShowButton()) {  
112 - if (this.emptyType !== 15) {  
113 - Button('点击重试')  
114 - .type(ButtonType.Normal)  
115 - .width(80)  
116 - .height(28)  
117 - .backgroundColor('#fffffff')  
118 - .fontColor('#FF666666')  
119 - .border({ width: 1 })  
120 - .borderColor('#FFEDEDED')  
121 - .borderRadius(4)  
122 - .fontSize($r('app.float.font_size_12'))  
123 - .margin({ top: 16 })  
124 - .padding(0)  
125 - .onClick(() => {  
126 - this.retry()  
127 - })  
128 - } else {  
129 - Button('点击重试')  
130 - .type(ButtonType.Normal)  
131 - .width(80)  
132 - .height(28)  
133 - .backgroundColor(Color.Black)  
134 - .fontColor('#FFCCCCCC')  
135 - .border({ width: 1 })  
136 - .borderColor('#4DFFFFFF')  
137 - .borderRadius(4)  
138 - .fontSize($r('app.float.font_size_12'))  
139 - .margin({ top: 16 })  
140 - .padding(0)  
141 - .onClick(() => {  
142 - this.retry()  
143 - })  
144 - }  
145 - }  
146 } 84 }
147 .justifyContent(FlexAlign.Center) 85 .justifyContent(FlexAlign.Center)
148 .width(this.emptyWidth) 86 .width(this.emptyWidth)
@@ -172,12 +110,4 @@ export struct LiveEmptyComponent { @@ -172,12 +110,4 @@ export struct LiveEmptyComponent {
172 } 110 }
173 return imageString 111 return imageString
174 } 112 }
175 -  
176 - isShowButton() {  
177 - if (this.emptyType === 1 || this.emptyType === 9 || this.emptyType === 15) {  
178 - return true  
179 - } else {  
180 - return false  
181 - }  
182 - }  
183 } 113 }
@@ -6,7 +6,6 @@ import { StringUtils } from 'wdKit/Index' @@ -6,7 +6,6 @@ import { StringUtils } from 'wdKit/Index'
6 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 6 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
7 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' 7 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
8 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' 8 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
9 -import { LiveModel } from '../../viewmodel/LiveModel'  
10 9
11 @Component 10 @Component
12 export struct LiveHorizontalReservationComponent { 11 export struct LiveHorizontalReservationComponent {
@@ -20,7 +19,7 @@ export struct LiveHorizontalReservationComponent { @@ -20,7 +19,7 @@ export struct LiveHorizontalReservationComponent {
20 .width(3) 19 .width(3)
21 .height(16) 20 .height(16)
22 .margin({ right: 4 }) 21 .margin({ right: 4 })
23 - Text(StringUtils.isNotEmpty(this?.compDTO?.objectTitle) ? this?.compDTO?.objectTitle : "直播预") 22 + Text(StringUtils.isNotEmpty(this?.compDTO?.objectTitle) ? this?.compDTO?.objectTitle : "直播预")
24 .fontSize($r("app.float.font_size_17")) 23 .fontSize($r("app.float.font_size_17"))
25 .fontColor($r("app.color.color_222222")) 24 .fontColor($r("app.color.color_222222"))
26 .fontWeight(600) 25 .fontWeight(600)
@@ -82,6 +81,7 @@ export struct LiveHorizontalReservationComponent { @@ -82,6 +81,7 @@ export struct LiveHorizontalReservationComponent {
82 }) 81 })
83 }) 82 })
84 }.listDirection(Axis.Horizontal) 83 }.listDirection(Axis.Horizontal)
  84 + .scrollBar(BarState.Off)
85 .width(CommonConstants.FULL_WIDTH) 85 .width(CommonConstants.FULL_WIDTH)
86 .height(this.compDTO.operDataList.length == 2 ? 180 : 136) 86 .height(this.compDTO.operDataList.length == 2 ? 180 : 136)
87 } else if (this.compDTO.operDataList.length) { 87 } else if (this.compDTO.operDataList.length) {
1 import { PageInfoDTO } from 'wdBean/Index'; 1 import { PageInfoDTO } from 'wdBean/Index';
2 import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean'; 2 import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean';
  3 +import { DateTimeUtils, SPHelper } from 'wdKit/Index';
  4 +import { ArrayList } from '@kit.ArkTS';
  5 +import { SpConstants } from 'wdConstant/Index';
3 6
4 /** 7 /**
5 * @Description: 处理页面的广告业务 8 * @Description: 处理页面的广告业务
@@ -18,16 +21,11 @@ export default class PageAdModel { @@ -18,16 +21,11 @@ export default class PageAdModel {
18 // 1:右边;2:左边 -> 默认右边 21 // 1:右边;2:左边 -> 默认右边
19 pageCornerContentInfo: AdvRuleBean = {} as AdvRuleBean 22 pageCornerContentInfo: AdvRuleBean = {} as AdvRuleBean
20 23
21 - // 展现中心业务信息  
22 -  
23 -  
24 -  
25 -  
26 /** 24 /**
27 * 解析广告资源 25 * 解析广告资源
28 * @param pageInfo 26 * @param pageInfo
29 */ 27 */
30 - analysisAdvSource(pageInfo: PageInfoDTO): void { 28 + async analysisAdvSource(pageInfo: PageInfoDTO) {
31 29
32 if (pageInfo.hasAdInfo === 1 && pageInfo.cornersAdv != null) { 30 if (pageInfo.hasAdInfo === 1 && pageInfo.cornersAdv != null) {
33 // 优先展示展现中心广告 31 // 优先展示展现中心广告
@@ -55,12 +53,26 @@ export default class PageAdModel { @@ -55,12 +53,26 @@ export default class PageAdModel {
55 } else if (pageInfo.cornersAdv2 != null && pageInfo.cornersAdv2.length > 0) { 53 } else if (pageInfo.cornersAdv2 != null && pageInfo.cornersAdv2.length > 0) {
56 // 广告中心-挂角广告信息 54 // 广告中心-挂角广告信息
57 let cornersAdv2 = pageInfo.cornersAdv2 55 let cornersAdv2 = pageInfo.cornersAdv2
58 - // 获取  
59 - let showCompAdvBean = cornersAdv2[0] 56 +
  57 + if (cornersAdv2.length == 0) {
  58 + return
  59 + }
  60 + // 加工处理广告中心的广告数据
  61 + let pageCoreAdvArray = this.treatPageInfoAdsData(cornersAdv2);
  62 +
  63 + let advLength = pageCoreAdvArray.length;
  64 + let pageId = pageInfo.id.toString();
  65 + let a = 0;
  66 + if (advLength > 1) {
  67 + a = await this.calPageAdvIndex(pageId,advLength)
  68 + }
  69 + // 获取投放
  70 + let showCompAdvBean = pageCoreAdvArray.convertToArray()[a]
60 71
61 if (showCompAdvBean.matInfo == null) { 72 if (showCompAdvBean.matInfo == null) {
62 return 73 return
63 } 74 }
  75 + this.saveReleaseAdvIndex(pageId, a)
64 // 76 //
65 let slotInfo = showCompAdvBean.slotInfo; 77 let slotInfo = showCompAdvBean.slotInfo;
66 let postion = slotInfo.position 78 let postion = slotInfo.position
@@ -76,4 +88,84 @@ export default class PageAdModel { @@ -76,4 +88,84 @@ export default class PageAdModel {
76 } 88 }
77 89
78 } 90 }
  91 + /**
  92 + * 计算投放广告的序列号
  93 + * @param pageId
  94 + * @param advLength
  95 + * @returns
  96 + */
  97 + private async calPageAdvIndex(pageId: string , advLength: number): Promise<number>{
  98 +
  99 + let index = await this.obtainReleaseAdvIndex(pageId);
  100 + let a = await index + 1;
  101 + if (a >= advLength) {
  102 + a = 0;
  103 + }
  104 + return a;
  105 + }
  106 +
  107 + /**
  108 + * 获取已投放挂角广告的编号
  109 + * @param pageId
  110 + * @returns
  111 + */
  112 + private async obtainReleaseAdvIndex(pageId: string): Promise<number> {
  113 +
  114 + let index: number = await SPHelper.default.get(SpConstants.APP_PAGE_CORNER_ADV + pageId, -1) as number;
  115 +
  116 + return index;
  117 + }
  118 +
  119 + /**
  120 + * 存储已经投放广告的编号
  121 + * @param pageId
  122 + * @param index
  123 + */
  124 + private async saveReleaseAdvIndex(pageId: string, index: number) {
  125 + await SPHelper.default.save(SpConstants.APP_PAGE_CORNER_ADV + pageId, index)
  126 + }
  127 +
  128 + /**
  129 + * 删除数据
  130 + * @param pageId
  131 + */
  132 + private async clearHistoryAdvIndex(pageId: string){
  133 +
  134 + SPHelper.default.deleteSync(SpConstants.APP_PAGE_CORNER_ADV + pageId)
  135 +
  136 + }
  137 +
  138 + private checkPageCornerAdv(pageId: string): Promise<boolean> {
  139 + let haveData = SPHelper.default.has(SpConstants.APP_PAGE_CORNER_ADV + pageId)
  140 + return haveData
  141 + }
  142 +
  143 + /**
  144 + * 对广告中心的广告 数据按不同维度加工 筛选出符合的数据
  145 + * @param cornersAdv2 页面的广告数据
  146 + * @param pageId 所在页面pageid
  147 + */
  148 + private treatPageInfoAdsData(cornersAdv2: CompAdvBean[]): ArrayList<CompAdvBean> {
  149 +
  150 + // 按时间维度过滤出广告数据
  151 + let compAdsArray: ArrayList<CompAdvBean> = new ArrayList();
  152 + let serverTimeLong: number = DateTimeUtils.getTimeStamp();
  153 + for (let advBean of cornersAdv2) {
  154 + let startLong = advBean.startTime;
  155 + let endLong = advBean.endTime;
  156 +
  157 + if (serverTimeLong >= startLong && serverTimeLong <= endLong) {
  158 + //符合开始时间和结束时间要求
  159 + compAdsArray.add(advBean)
  160 + }
  161 + }
  162 +
  163 + //按展现优先级维度 数值越小,等级越高
  164 + if (compAdsArray.length > 1) {
  165 + //B、按展现优先级维度 数值越小,等级越高
  166 + compAdsArray.sort((a: CompAdvBean, b: CompAdvBean) => a.displayPriority - b.displayPriority)
  167 + }
  168 +
  169 + return compAdsArray;
  170 + }
79 } 171 }
@@ -51,12 +51,6 @@ export default class PageModel { @@ -51,12 +51,6 @@ export default class PageModel {
51 // keyGenerator相关字符串,用于刷新list布局 51 // keyGenerator相关字符串,用于刷新list布局
52 timestamp: String = '1'; 52 timestamp: String = '1';
53 53
54 - // //左右挂角广告对象  
55 - // pageCornerAdv:CompAdvBean = {} as CompAdvBean // 挂角广告  
56 - // isShowAds : boolean = false;  
57 - // isRightAdv : number = 1;// 1:右边;2:左边 -> 默认右边  
58 - // pageCornerContentInfo:AdvRuleBean = {} as AdvRuleBean // 展现中心业务信息  
59 -  
60 54
61 /** 55 /**
62 * 简单复制业务数据 56 * 简单复制业务数据
@@ -52,6 +52,10 @@ @@ -52,6 +52,10 @@
52 { 52 {
53 "name": "comp_advertisement", 53 "name": "comp_advertisement",
54 "value": "广告" 54 "value": "广告"
  55 + },
  56 + {
  57 + "name": "location_reason",
  58 + "value": " "
55 } 59 }
56 ] 60 ]
57 } 61 }
@@ -2,15 +2,15 @@ import { Action, LiveDetailsBean } from 'wdBean/Index'; @@ -2,15 +2,15 @@ import { Action, LiveDetailsBean } 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
5 -import { DetailPlayLivePage } from './DetailPlayLivePage'  
6 -import { DetailPlayVLivePage } from './DetailPlayVLivePage' 5 +import { DetailPlayLivePage } from './DetailPlayLivePage';
  6 +import { DetailPlayVLivePage } from './DetailPlayVLivePage';
  7 +import { Logger } from 'wdKit/Index';
7 8
8 const TAG = 'DetailPlayLiveCommon' 9 const TAG = 'DetailPlayLiveCommon'
9 10
10 -@Entry() 11 +@Entry
11 @Component 12 @Component
12 export struct DetailPlayLiveCommon { 13 export struct DetailPlayLiveCommon {
13 - TAG: string = 'DetailPlayLiveCommon';  
14 private liveViewModel: LiveViewModel = new LiveViewModel() 14 private liveViewModel: LiveViewModel = new LiveViewModel()
15 @State liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean 15 @State liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean
16 @State liveState: string = '' 16 @State liveState: string = ''
@@ -18,8 +18,12 @@ export struct DetailPlayLiveCommon { @@ -18,8 +18,12 @@ export struct DetailPlayLiveCommon {
18 @State relId: string = '' 18 @State relId: string = ''
19 @State contentId: string = '' 19 @State contentId: string = ''
20 @State relType: string = '' 20 @State relType: string = ''
  21 + @Provide pageShow: number = -1
  22 + @Provide pageHide: number = -1
  23 + @Provide pageBackPress: number = -1
21 24
22 aboutToAppear(): void { 25 aboutToAppear(): void {
  26 + Logger.debug(TAG, 'aboutToAppear')
23 //https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500005302448&relType=1&contentId=20000016340 27 //https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500005302448&relType=1&contentId=20000016340
24 const par: Action = router.getParams() as Action; 28 const par: Action = router.getParams() as Action;
25 const params = par?.params; 29 const params = par?.params;
@@ -56,5 +60,21 @@ export struct DetailPlayLiveCommon { @@ -56,5 +60,21 @@ export struct DetailPlayLiveCommon {
56 60
57 }) 61 })
58 } 62 }
  63 +
  64 + onPageShow() {
  65 + this.pageShow = Math.random()
  66 + Logger.debug(TAG, 'onPageShow')
  67 + }
  68 +
  69 + onPageHide() {
  70 + this.pageHide = Math.random()
  71 + Logger.debug(TAG, 'onPageHide')
  72 + }
  73 +
  74 + onBackPress(): boolean | void {
  75 + this.pageBackPress = Math.random()
  76 + Logger.debug(TAG, 'onBackPress')
  77 + return true
  78 + }
59 } 79 }
60 80
1 -import { Action, LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index'; 1 +import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index';
2 import { LiveViewModel } from '../viewModel/LiveViewModel'; 2 import { LiveViewModel } from '../viewModel/LiveViewModel';
3 import { TabComponent } from '../widgets/details/TabComponent'; 3 import { TabComponent } from '../widgets/details/TabComponent';
4 import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet'; 4 import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet';
5 -import router from '@ohos.router';  
6 import { DisplayDirection } from 'wdConstant/Index'; 5 import { DisplayDirection } from 'wdConstant/Index';
7 import mediaquery from '@ohos.mediaquery'; 6 import mediaquery from '@ohos.mediaquery';
8 import { Logger, WindowModel } from 'wdKit/Index'; 7 import { Logger, WindowModel } from 'wdKit/Index';
9 -import { window } from '@kit.ArkUI'; 8 +import { router, window } from '@kit.ArkUI';
10 import { devicePLSensorManager } from 'wdDetailPlayApi/Index'; 9 import { devicePLSensorManager } from 'wdDetailPlayApi/Index';
11 import { LiveCommentComponent } from 'wdComponent/Index'; 10 import { LiveCommentComponent } from 'wdComponent/Index';
12 import { WDPlayerController } from 'wdPlayer/Index'; 11 import { WDPlayerController } from 'wdPlayer/Index';
13 12
14 -@Entry 13 +let TAG: string = 'DetailPlayLivePage';
  14 +
15 @Component 15 @Component
16 export struct DetailPlayLivePage { 16 export struct DetailPlayLivePage {
17 //横竖屏,默认竖屏 17 //横竖屏,默认竖屏
18 @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL 18 @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL
19 playerController: WDPlayerController = new WDPlayerController(); 19 playerController: WDPlayerController = new WDPlayerController();
20 - TAG: string = 'DetailPlayLivePage';  
21 liveViewModel: LiveViewModel = new LiveViewModel() 20 liveViewModel: LiveViewModel = new LiveViewModel()
22 @State relId: string = '' 21 @State relId: string = ''
23 @State contentId: string = '' 22 @State contentId: string = ''
@@ -27,11 +26,14 @@ export struct DetailPlayLivePage { @@ -27,11 +26,14 @@ export struct DetailPlayLivePage {
27 @State tabs: string[] = [] 26 @State tabs: string[] = []
28 //监听屏幕横竖屏变化 27 //监听屏幕横竖屏变化
29 listener = mediaquery.matchMediaSync('(orientation: landscape)'); 28 listener = mediaquery.matchMediaSync('(orientation: landscape)');
  29 + @Consume @Watch('onPageShowCus') pageShow: number
  30 + @Consume @Watch('onPageHideCus') pageHide: number
  31 + @Consume @Watch('onBackPressCus') pageBackPress: number
30 32
31 aboutToAppear(): void { 33 aboutToAppear(): void {
32 - Logger.info(this.TAG, `wyj-aboutToAppear`) 34 + Logger.info(TAG, `wyj-aboutToAppear`)
33 this.listener?.on("change", (mediaQueryResult) => { 35 this.listener?.on("change", (mediaQueryResult) => {
34 - Logger.info(this.TAG, `change;${mediaQueryResult.matches}`) 36 + Logger.info(TAG, `change;${mediaQueryResult.matches}`)
35 if (mediaQueryResult?.matches) { 37 if (mediaQueryResult?.matches) {
36 this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL 38 this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL
37 } else { 39 } else {
@@ -39,11 +41,6 @@ export struct DetailPlayLivePage { @@ -39,11 +41,6 @@ export struct DetailPlayLivePage {
39 } 41 }
40 WindowModel.shared.setMainWindowFullScreen(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL) 42 WindowModel.shared.setMainWindowFullScreen(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL)
41 }) 43 })
42 - let par: Action = router.getParams() as Action;  
43 - let params = par?.params;  
44 - this.relId = params?.extra?.relId || '';  
45 - this.relType = params?.extra?.relType || '';  
46 - this.contentId = params?.contentID || '';  
47 this.getLiveDetails() 44 this.getLiveDetails()
48 this.getLiveRoomData() 45 this.getLiveRoomData()
49 } 46 }
@@ -62,18 +59,39 @@ export struct DetailPlayLivePage { @@ -62,18 +59,39 @@ export struct DetailPlayLivePage {
62 .width('100%') 59 .width('100%')
63 } 60 }
64 61
65 - onPageShow(): void {  
66 - Logger.info(this.TAG, `wyj-onPageShow`) 62 + aboutToDisappear(): void {
  63 + Logger.info(TAG, `wyj-aboutToDisappear`)
  64 + this.playerController?.stop()
  65 + this.playerController?.release()
  66 + }
  67 +
  68 + onPageShowCus(): void {
  69 + Logger.info(TAG, `wyj-onPageShowCus`)
67 // WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED); 70 // WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED);
68 } 71 }
69 72
70 - onPageHide(): void {  
71 - Logger.info(this.TAG, `wyj-onPageHide`) 73 + onPageHideCus(): void {
  74 + Logger.info(TAG, `wyj-onPageHideCus`)
72 devicePLSensorManager.devicePLSensorOff(); 75 devicePLSensorManager.devicePLSensorOff();
73 // WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED); 76 // WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED);
74 this.playerController?.pause() 77 this.playerController?.pause()
75 } 78 }
76 79
  80 + onBackPressCus(): boolean | void {
  81 + if (this.displayDirection == DisplayDirection.VERTICAL) {
  82 + router.back()
  83 + } else {
  84 + this.displayDirection = DisplayDirection.VERTICAL
  85 + }
  86 + WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
  87 + window.Orientation.PORTRAIT :
  88 + window.Orientation.LANDSCAPE)
  89 + devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ?
  90 + window.Orientation.PORTRAIT :
  91 + window.Orientation.LANDSCAPE);
  92 + return true
  93 + }
  94 +
77 getLiveDetails() { 95 getLiveDetails() {
78 this.liveViewModel.getLiveDetails(this.contentId, this.relId, this.relType) 96 this.liveViewModel.getLiveDetails(this.contentId, this.relId, this.relType)
79 .then( 97 .then(
@@ -102,23 +120,4 @@ export struct DetailPlayLivePage { @@ -102,23 +120,4 @@ export struct DetailPlayLivePage {
102 120
103 }) 121 })
104 } 122 }
105 -  
106 - aboutToDisappear(): void {  
107 - Logger.info(this.TAG, `wyj-aboutToDisappear`)  
108 - }  
109 -  
110 - onBackPress(): boolean | void {  
111 - if (this.displayDirection == DisplayDirection.VERTICAL) {  
112 - router.back()  
113 - } else {  
114 - this.displayDirection = DisplayDirection.VERTICAL  
115 - }  
116 - WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?  
117 - window.Orientation.PORTRAIT :  
118 - window.Orientation.LANDSCAPE)  
119 - devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ?  
120 - window.Orientation.PORTRAIT :  
121 - window.Orientation.LANDSCAPE);  
122 - return true  
123 - }  
124 } 123 }
@@ -53,7 +53,7 @@ export struct DetailPlayVLivePage { @@ -53,7 +53,7 @@ export struct DetailPlayVLivePage {
53 build() { 53 build() {
54 Column() { 54 Column() {
55 // 直播结束且无回看 55 // 直播结束且无回看
56 - if (this.liveState === 'end' || !this.playUrl) { 56 + if (this.liveState === 'end' && !this.playUrl) {
57 LiveEmptyComponent({ 57 LiveEmptyComponent({
58 emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveEnd 58 emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveEnd
59 }) 59 })
@@ -26,7 +26,7 @@ export struct TabChatComponent { @@ -26,7 +26,7 @@ export struct TabChatComponent {
26 } else if (this.pageModel.viewType == ViewType.ERROR) { 26 } else if (this.pageModel.viewType == ViewType.ERROR) {
27 ErrorComponent() 27 ErrorComponent()
28 } else if (this.pageModel.viewType == ViewType.EMPTY) { 28 } else if (this.pageModel.viewType == ViewType.EMPTY) {
29 - EmptyComponent({ emptyType: WDViewDefaultType.WDViewDefaultType_NoContent1 }) 29 + EmptyComponent({ emptyType: WDViewDefaultType.WDViewDefaultType_NoComment1 })
30 } else { 30 } else {
31 this.ListLayout() 31 this.ListLayout()
32 } 32 }
1 import { LiveRoomItemBean } from 'wdBean/Index' 1 import { LiveRoomItemBean } from 'wdBean/Index'
  2 +import { StringUtils } from 'wdKit/Index'
2 3
3 @Component 4 @Component
4 export struct TabChatItemComponent { 5 export struct TabChatItemComponent {
@@ -9,7 +10,7 @@ export struct TabChatItemComponent { @@ -9,7 +10,7 @@ export struct TabChatItemComponent {
9 10
10 build() { 11 build() {
11 Row() { 12 Row() {
12 - Image(this.item.senderUserAvatarUrl) 13 + Image(StringUtils.isEmpty(this.item.senderUserAvatarUrl) ? $r('app.media.default_head') : this.item.senderUserAvatarUrl)
13 .borderRadius(90) 14 .borderRadius(90)
14 .width(24) 15 .width(24)
15 .height(24) 16 .height(24)
1 import { Action, LiveRoomItemBean, Params, PhotoListBean } from 'wdBean/Index' 1 import { Action, LiveRoomItemBean, Params, PhotoListBean } from 'wdBean/Index'
2 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' 2 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
  3 +import { AudioRowComponent } from 'wdComponent/Index'
3 import { DateTimeUtils, StringUtils } from 'wdKit/Index' 4 import { DateTimeUtils, StringUtils } from 'wdKit/Index'
4 import { WDRouterRule } from 'wdRouter/Index' 5 import { WDRouterRule } from 'wdRouter/Index'
5 6
@@ -106,29 +107,14 @@ export struct TabLiveItemComponent { @@ -106,29 +107,14 @@ export struct TabLiveItemComponent {
106 .listDirection(Axis.Horizontal) 107 .listDirection(Axis.Horizontal)
107 .margin({ 108 .margin({
108 top: 8, 109 top: 8,
109 - right: 16  
110 }) 110 })
111 } 111 }
112 //音频 112 //音频
113 else if (this.item.dataType === 'ZH_AUDIO_MSG') { 113 else if (this.item.dataType === 'ZH_AUDIO_MSG') {
114 - Row() {  
115 - Image($r('app.media.icon_voice'))  
116 - .width(20)  
117 - .aspectRatio(1)  
118 - .margin({  
119 - left: 8,  
120 - right: 6 114 + AudioRowComponent({
  115 + audioUrl: this.item.audioUrl,
  116 + duration: this.item.duration
121 }) 117 })
122 - Text(DateTimeUtils.getFormattedDuration(this.item.duration))  
123 - .fontColor('#666666')  
124 - .fontWeight(400)  
125 - .fontSize('14fp')  
126 - }  
127 - .backgroundColor(Color.White)  
128 - .height(36)  
129 - .borderRadius(4)  
130 - .margin({ top: 8, right: 16 })  
131 - .width('100%')  
132 } 118 }
133 //视频 119 //视频
134 else if (this.item.dataType === 'ZH_VIDEO_MSG') { 120 else if (this.item.dataType === 'ZH_VIDEO_MSG') {
@@ -160,14 +146,12 @@ export struct TabLiveItemComponent { @@ -160,14 +146,12 @@ export struct TabLiveItemComponent {
160 } 146 }
161 .margin({ 147 .margin({
162 top: 8, 148 top: 8,
163 - right: 16  
164 }) 149 })
165 .aspectRatio(Number.parseFloat(this.item.pictureResolutions[0]?.split('*')[0]) / Number.parseFloat(this.item.pictureResolutions[0]?.split('*')[1])) 150 .aspectRatio(Number.parseFloat(this.item.pictureResolutions[0]?.split('*')[0]) / Number.parseFloat(this.item.pictureResolutions[0]?.split('*')[1]))
166 .onClick(() => { 151 .onClick(() => {
167 this.gotoVideoPlayPage() 152 this.gotoVideoPlayPage()
168 }) 153 })
169 } 154 }
170 -  
171 } 155 }
172 .margin({ 156 .margin({
173 left: 8, 157 left: 8,
@@ -75,7 +75,7 @@ export struct PlayUIComponent { @@ -75,7 +75,7 @@ export struct PlayUIComponent {
75 if (this.liveDetailsBean.liveInfo?.liveState != 'wait') { 75 if (this.liveDetailsBean.liveInfo?.liveState != 'wait') {
76 Text(this.liveDetailsBean.newsTitle) 76 Text(this.liveDetailsBean.newsTitle)
77 .maxLines(1) 77 .maxLines(1)
78 - .textOverflow({ overflow: TextOverflow.Ellipsis }) 78 + .textOverflow({ overflow: TextOverflow.MARQUEE })
79 .fontSize('16fp') 79 .fontSize('16fp')
80 .fontWeight(500) 80 .fontWeight(500)
81 .fontColor(Color.White) 81 .fontColor(Color.White)
@@ -269,8 +269,7 @@ export struct PlayUIComponent { @@ -269,8 +269,7 @@ export struct PlayUIComponent {
269 .blockSize({ 269 .blockSize({
270 width: 18, 270 width: 18,
271 height: 12 271 height: 12
272 - })  
273 - // .blockStyle({ 272 + })// .blockStyle({
274 // type: SliderBlockType.IMAGE, 273 // type: SliderBlockType.IMAGE,
275 // image: $r('app.media.ic_player_block') 274 // image: $r('app.media.ic_player_block')
276 // }) 275 // })
1 import { LiveDetailsBean } from 'wdBean/Index'; 1 import { LiveDetailsBean } from 'wdBean/Index';
2 -import { Logger } from 'wdKit/Index';  
3 import { WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; 2 import { WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index';
4 import { PlayUIComponent } from './PlayUIComponent'; 3 import { PlayUIComponent } from './PlayUIComponent';
5 4
@@ -7,13 +6,15 @@ import { PlayUIComponent } from './PlayUIComponent'; @@ -7,13 +6,15 @@ import { PlayUIComponent } from './PlayUIComponent';
7 export struct TopPlayComponent { 6 export struct TopPlayComponent {
8 TAG: string = 'TopPlayComponent' 7 TAG: string = 'TopPlayComponent'
9 @Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean 8 @Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean
10 - playerController: WDPlayerController = new WDPlayerController(); 9 + playerController?: WDPlayerController
11 @State imgUrl: string = '' 10 @State imgUrl: string = ''
12 @State isWait: boolean = false 11 @State isWait: boolean = false
13 12
14 aboutToAppear(): void { 13 aboutToAppear(): void {
  14 + if (this.playerController) {
15 this.playerController.onCanplay = () => { 15 this.playerController.onCanplay = () => {
16 - this.playerController.play() 16 + this.playerController?.play()
  17 + }
17 } 18 }
18 } 19 }
19 20
@@ -30,7 +31,7 @@ export struct TopPlayComponent { @@ -30,7 +31,7 @@ export struct TopPlayComponent {
30 } else if (this.liveDetailsBean.liveInfo.liveState == 'end') { 31 } else if (this.liveDetailsBean.liveInfo.liveState == 'end') {
31 playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri 32 playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri
32 } 33 }
33 - this.playerController.firstPlay(playUrl); 34 + this.playerController?.firstPlay(playUrl);
34 } 35 }
35 } 36 }
36 37
@@ -44,18 +45,6 @@ export struct TopPlayComponent { @@ -44,18 +45,6 @@ export struct TopPlayComponent {
44 .height('100%') 45 .height('100%')
45 .width('100%') 46 .width('100%')
46 .visibility(this.isWait ? Visibility.None : Visibility.Visible) 47 .visibility(this.isWait ? Visibility.None : Visibility.Visible)
47 - .onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {  
48 - Logger.debug(this.TAG, `当前屏幕可见区域大小: currentRatio:' +${currentRatio}`)  
49 - if (isVisible && currentRatio >= 1.0) {  
50 - Logger.debug(this.TAG, `播放器-暂停. currentRatio:' +${currentRatio}`)  
51 - this.playerController.play()  
52 - }  
53 -  
54 - if (!isVisible && currentRatio <= 0.0) {  
55 - Logger.debug(this.TAG, `播放器-播放. currentRatio:' +${currentRatio}`)  
56 - this.playerController.pause()  
57 - }  
58 - })  
59 Image(this.imgUrl) 48 Image(this.imgUrl)
60 .objectFit(ImageFit.Contain) 49 .objectFit(ImageFit.Contain)
61 .visibility(this.isWait ? Visibility.Visible : Visibility.None) 50 .visibility(this.isWait ? Visibility.Visible : Visibility.None)
@@ -65,8 +54,5 @@ export struct TopPlayComponent { @@ -65,8 +54,5 @@ export struct TopPlayComponent {
65 } 54 }
66 55
67 aboutToDisappear(): void { 56 aboutToDisappear(): void {
68 - this.playerController.pause()  
69 - this.playerController.stop()  
70 - this.playerController.release()  
71 } 57 }
72 } 58 }
@@ -35,6 +35,10 @@ @@ -35,6 +35,10 @@
35 { 35 {
36 "name": "reason_read_write_media", 36 "name": "reason_read_write_media",
37 "value": "user_grant" 37 "value": "user_grant"
  38 + },
  39 + {
  40 + "name": "location_reason",
  41 + "value": " "
38 } 42 }
39 ] 43 ]
40 } 44 }
1 { 1 {
2 "src": [ 2 "src": [
3 - "pages/DetailPlayLivePage",  
4 "pages/DetailPlayVLivePage", 3 "pages/DetailPlayVLivePage",
5 "pages/DetailPlayLiveCommon" 4 "pages/DetailPlayLiveCommon"
6 ] 5 ]
1 { 1 {
2 "src": [ 2 "src": [
3 - "pages/DetailVideoListPage",  
4 - "pages/VideoChannelDetail" 3 + "pages/DetailVideoListPage"
5 ] 4 ]
6 } 5 }
@@ -152,6 +152,22 @@ export class HWLocationUtils { @@ -152,6 +152,22 @@ export class HWLocationUtils {
152 } 152 }
153 return '' 153 return ''
154 } 154 }
  155 +
  156 + // 通过省份code获取省份名称
  157 + static async getProvinceName(provinceCode: string) {
  158 + let bean = await ResourcesUtils.getResourcesJson<ResponseDTO<Array<LocalData>>>(getContext(), 'areaList_data.json');
  159 + if (bean) {
  160 + if (bean.code == 0 && bean.data) {
  161 + for (let i = 0; i < bean.data.length; i++) {
  162 + if (bean.data[i].code == provinceCode) {
  163 + return bean.data[i].label
  164 + }
  165 + }
  166 + }
  167 + }
  168 + return ''
  169 + }
  170 +
155 } 171 }
156 172
157 interface LocalData { 173 interface LocalData {
1 -import { PageComponent } from './PageComponent'; 1 +import { PageComponent } from 'wdComponent/Index';
  2 +import { HashMap } from '@kit.ArkTS';
  3 +import { router } from '@kit.ArkUI';
  4 +import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
2 5
3 -const TAG = 'ColumnPageComponent'; 6 +const TAG = 'ColumnPage';
4 7
5 /** 8 /**
6 * 二级栏目页面,展排数据 9 * 二级栏目页面,展排数据
7 */ 10 */
  11 +@Entry
8 @Component 12 @Component
9 -export struct ColumnPageComponent { 13 +export struct ColumnPage {
10 @State currentTopNavSelectedIndex: number = 0; 14 @State currentTopNavSelectedIndex: number = 0;
  15 + @State param: AssignChannelParam = router.getParams() as AssignChannelParam
11 pageId: string = ""; 16 pageId: string = "";
12 channelId: string = ""; 17 channelId: string = "";
13 18
  19 + aboutToAppear() {
  20 + this.pageId = this.param.pageId
  21 + this.channelId = this.param.channelId
  22 + }
  23 +
14 build() { 24 build() {
  25 + Column() {
15 PageComponent({ 26 PageComponent({
16 currentTopNavSelectedIndex: $currentTopNavSelectedIndex, 27 currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
17 navIndex: this.currentTopNavSelectedIndex, 28 navIndex: this.currentTopNavSelectedIndex,
18 pageId: this.pageId, 29 pageId: this.pageId,
19 channelId: this.channelId, 30 channelId: this.channelId,
20 }); 31 });
21 - 32 + }
22 } 33 }
23 } 34 }
24 35
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
13 "pages/launchPage/LaunchAdvertisingPage", 13 "pages/launchPage/LaunchAdvertisingPage",
14 "pages/broadcast/BroadcastPage", 14 "pages/broadcast/BroadcastPage",
15 "pages/launchPage/LaunchInterestsHobbiesPage", 15 "pages/launchPage/LaunchInterestsHobbiesPage",
16 - "pages/SpacialTopicPage" 16 + "pages/SpacialTopicPage",
  17 + "pages/column/ColumnPage"
17 ] 18 ]
18 } 19 }