陈剑华

Merge remote-tracking branch 'origin/main'

Showing 19 changed files with 257 additions and 298 deletions
1 -import HashMap from '@ohos.util.HashMap';  
2 import { SpConstants } from 'wdConstant'; 1 import { SpConstants } from 'wdConstant';
3 import { SPHelper, StringUtils } from 'wdKit'; 2 import { SPHelper, StringUtils } from 'wdKit';
4 import { HostEnum, HostManager } from './HttpHostManager'; 3 import { HostEnum, HostManager } from './HttpHostManager';
@@ -11,81 +10,73 @@ export class HttpParams { @@ -11,81 +10,73 @@ export class HttpParams {
11 private static userType = '' 10 private static userType = ''
12 private static token = '' 11 private static token = ''
13 12
14 - static getCommonHeaders(): HashMap<string, string> {  
15 - let headers: HashMap<string, string> = new HashMap<string, string>()  
16 - headers.set('User-Agent', 'Dalvik/2.1.0 (Linux; U; Android 13; 22101317C Build/TKQ1.221013.002)')  
17 - headers.set('channel', HttpParams.getChannel())  
18 - //headers.set('appCode', ConfigConstants.appCode)  
19 - headers.set('plat', HttpParams.getPlat())  
20 - //headers.set('Authorization', 'APPCODE 83092caa603a421aa0222308b3f6b27a')  
21 - headers.set('Content-Type', 'application/json; charset=utf-8')  
22 - headers.set('timestamp', HttpParams.getTimestamp())  
23 - headers.set('RMRB-X-TOKEN', HttpParams.getXToken())  
24 - headers.set('device_id', HttpParams.getDeviceId()) 13 + static buildHeaders(): Record<string, string> {
  14 + let headers: Record<string, string> = {};
  15 + // 通用请求头
  16 + headers['User-Agent'] = 'Dalvik/2.1.0 (Linux; U; Android 13; 22101317C Build/TKQ1.221013.002)'
  17 + headers['channel'] = HttpParams.getChannel()
  18 + headers['plat'] = HttpParams.getPlat()
  19 + headers['Content-Type'] = 'application/json; charset=utf-8'
  20 + headers['timestamp'] = HttpParams.getTimestamp()
  21 + headers['RMRB-X-TOKEN'] = HttpParams.getXToken()
  22 + headers['device_id'] = HttpParams.getDeviceId()
25 if (HttpParams.getXToken() != '') { 23 if (HttpParams.getXToken() != '') {
26 - headers.set('cookie', 'RMRB-X-TOKEN=' + HttpParams.getXToken()) 24 + headers['cookie'] = 'RMRB-X-TOKEN=' + HttpParams.getXToken()
27 } 25 }
28 - headers.set('build_version', HttpParams.getVersion())  
29 - headers.set('adcode', HttpParams.getAdCode())  
30 - headers.set('os_version', HttpParams.getOsVersion())  
31 - //headers.set('X-Ca-Stage', 'PRE')  
32 - headers.set('versionCode', HttpParams.getVersionCode())  
33 - headers.set('system', HttpParams.getTerminalId())  
34 - headers.set('version_name', HttpParams.getVersionName())  
35 - headers.set('EagleEye-TraceID', 'D539562E48554A60977AF4BECB6D6C7A')  
36 - headers.set('imei', HttpParams.getImei())  
37 - headers.set('Accept-Language', 'zh') 26 + headers['build_version'] = HttpParams.getVersion()
  27 + headers['adcode'] = HttpParams.getAdCode()
  28 + headers['os_version'] = HttpParams.getOsVersion()
  29 + headers['versionCode'] = HttpParams.getVersionCode()
  30 + headers['system'] = HttpParams.getTerminalId()
  31 + headers['version_name'] = HttpParams.getVersionName()
  32 + headers['EagleEye-TraceID'] = 'D539562E48554A60977AF4BECB6D6C7A'
  33 + headers['imei'] = HttpParams.getImei()
  34 + headers['Accept-Language'] = 'zh'
38 HttpParams.setLocationHeader(headers) 35 HttpParams.setLocationHeader(headers)
39 - // TODO 判断是否登录  
40 - headers.set('userId', HttpParams.getUserId())  
41 - headers.set('userType', HttpParams.getUserType())  
42 -  
43 - headers.set('mpassid', 'ZbHTMeTsfaYDAHqt8ZHIzcPs') 36 + // // TODO 判断是否登录
  37 + headers['userId'] = HttpParams.getUserId()
  38 + headers['userType'] = HttpParams.getUserType()
  39 + //
  40 + headers['mpassid'] = 'ZbHTMeTsfaYDAHqt8ZHIzcPs'
44 HttpParams.addSpecialHeaders(headers); 41 HttpParams.addSpecialHeaders(headers);
45 - // Logger.debug("TAG", '******************* commonHeaders headers start ******************************** ');  
46 - // headers.forEach((v,k)=>{  
47 - // Logger.debug("TAG", 'getCommonHeaders header: ' + k + ': ' + v);  
48 - // })  
49 - // Logger.debug("TAG", '******************* commonHeaders headers end ******************************** ');  
50 return headers; 42 return headers;
51 } 43 }
52 44
53 - static addSpecialHeaders(headers: HashMap<string, string>) { 45 + static addSpecialHeaders(headers: Record<string, string>) {
54 switch (HostManager.getHost()) { 46 switch (HostManager.getHost()) {
55 case HostEnum.HOST_UAT: 47 case HostEnum.HOST_UAT:
56 - // TODO 待优化到常量类里  
57 - headers.set('X-Ca-Stage', 'PRE');  
58 - headers.set('Authorization', 'APPCODE 83092caa603a421aa0222308b3f6b27a');  
59 - headers.set('appCode', '83092caa603a421aa0222308b3f6b27a'); 48 + headers['X-Ca-Stage'] = 'PRE'
  49 + headers['Authorization'] = 'APPCODE 83092caa603a421aa0222308b3f6b27a'
  50 + headers['appCode'] = '83092caa603a421aa0222308b3f6b27a'
60 break 51 break
61 case HostEnum.HOST_SIT: 52 case HostEnum.HOST_SIT:
62 - headers.set('X-Ca-Stage', 'TEST');  
63 - headers.set('Authorization', 'APPCODE 0af1f9085e484c97b2a44704bae72c07');  
64 - headers.set('appCode', '0af1f9085e484c97b2a44704bae72c07'); 53 + headers['X-Ca-Stage'] = 'TEST'
  54 + headers['Authorization'] = 'APPCODE 0af1f9085e484c97b2a44704bae72c07'
  55 + headers['appCode'] = '0af1f9085e484c97b2a44704bae72c07'
65 break 56 break
66 case HostEnum.HOST_PRODUCT: 57 case HostEnum.HOST_PRODUCT:
67 - headers.set('X-Ca-Stage', 'RELEASE');  
68 - headers.set('Authorization', 'APPCODE 3d4181bceeb94d9780e10dbb6c67bbf6');  
69 - headers.set('appCode', '3d4181bceeb94d9780e10dbb6c67bbf6'); 58 + headers['X-Ca-Stage'] = 'RELEASE'
  59 + headers['Authorization'] = 'APPCODE 3d4181bceeb94d9780e10dbb6c67bbf6'
  60 + headers['appCode'] = '3d4181bceeb94d9780e10dbb6c67bbf6'
70 break 61 break
71 case HostEnum.HOST_DEV: 62 case HostEnum.HOST_DEV:
72 - headers.set('X-Ca-Stage', 'TEST');  
73 - headers.set('Authorization', 'APPCODE ff33172859e14f9a8299e3bd769e79f9');  
74 - headers.set('appCode', 'ff33172859e14f9a8299e3bd769e79f9'); 63 + headers['X-Ca-Stage'] = 'TEST'
  64 + headers['Authorization'] = 'APPCODE ff33172859e14f9a8299e3bd769e79f9'
  65 + headers['appCode'] = 'ff33172859e14f9a8299e3bd769e79f9'
75 break 66 break
76 default: 67 default:
77 break 68 break
78 } 69 }
79 } 70 }
80 71
81 - static setLocationHeader(headers: HashMap<string, string>) { 72 + static setLocationHeader(headers: Record<string, string>) {
82 let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string 73 let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string
83 if (StringUtils.isNotEmpty(cityName)) { 74 if (StringUtils.isNotEmpty(cityName)) {
84 - headers.set('city', encodeURI(cityName)) 75 + headers['city'] = encodeURI(cityName)
85 } 76 }
86 let cityCode = SPHelper.default.getSync(SpConstants.LOCATION_CITY_CODE, '') as string 77 let cityCode = SPHelper.default.getSync(SpConstants.LOCATION_CITY_CODE, '') as string
87 if (StringUtils.isNotEmpty(cityCode)) { 78 if (StringUtils.isNotEmpty(cityCode)) {
88 - headers.set('city_dode', encodeURI(cityCode)) 79 + headers['city_dode'] = encodeURI(cityCode)
89 } 80 }
90 } 81 }
91 82
1 import ArrayList from '@ohos.util.ArrayList'; 1 import ArrayList from '@ohos.util.ArrayList';
2 import service from './AxiosRequest'; 2 import service from './AxiosRequest';
3 -import { HttpUtils } from '../utils/HttpUtils';  
4 import { AxiosError, AxiosHeaders, AxiosRequestConfig, RawAxiosRequestHeaders } from '@ohos/axios'; 3 import { AxiosError, AxiosHeaders, AxiosRequestConfig, RawAxiosRequestHeaders } from '@ohos/axios';
5 import { ResponseDTO } from '../bean/ResponseDTO'; 4 import { ResponseDTO } from '../bean/ResponseDTO';
6 import HashMap from '@ohos.util.HashMap'; 5 import HashMap from '@ohos.util.HashMap';
  6 +import { HttpParams } from './HttpCommonParams';
7 7
8 export class HttpRequest { 8 export class HttpRequest {
9 private static globalHeaderProviders: ArrayList<() => Record<string, string>> = new ArrayList(); 9 private static globalHeaderProviders: ArrayList<() => Record<string, string>> = new ArrayList();
@@ -14,7 +14,7 @@ export class HttpRequest { @@ -14,7 +14,7 @@ export class HttpRequest {
14 14
15 static initHttpHeader() { 15 static initHttpHeader() {
16 HttpRequest.addGlobalHeaderProvider(() => { 16 HttpRequest.addGlobalHeaderProvider(() => {
17 - return HttpUtils.buildHeaders(); 17 + return HttpParams.buildHeaders();
18 }) 18 })
19 } 19 }
20 20
@@ -34,15 +34,17 @@ export class HttpRequest { @@ -34,15 +34,17 @@ export class HttpRequest {
34 34
35 static buildHeaderWithGlobalHeader(headers?: HashMap<string, string>): AxiosHeaders { 35 static buildHeaderWithGlobalHeader(headers?: HashMap<string, string>): AxiosHeaders {
36 let commonHeader: AxiosHeaders = new AxiosHeaders() 36 let commonHeader: AxiosHeaders = new AxiosHeaders()
37 - headers?.forEach((v, k) => {  
38 - commonHeader.set(k, v);  
39 - }); 37 +
40 HttpRequest.globalHeaderProviders.forEach((func) => { 38 HttpRequest.globalHeaderProviders.forEach((func) => {
41 let headers = func(); 39 let headers = func();
42 for (const obj of Object.entries(headers)) { 40 for (const obj of Object.entries(headers)) {
43 commonHeader.set(obj[0], obj[1]); 41 commonHeader.set(obj[0], obj[1]);
44 } 42 }
45 }) 43 })
  44 + // 业务headers,覆盖common(如果有冲突的话,取业务)
  45 + headers?.forEach((v, k) => {
  46 + commonHeader.set(k, v);
  47 + });
46 if (!commonHeader.get('Content-Type')) { 48 if (!commonHeader.get('Content-Type')) {
47 commonHeader.set('Content-Type', 'application/json;charset=utf-8'); 49 commonHeader.set('Content-Type', 'application/json;charset=utf-8');
48 } 50 }
@@ -56,24 +58,13 @@ export class HttpRequest { @@ -56,24 +58,13 @@ export class HttpRequest {
56 return service.get(url, config) 58 return service.get(url, config)
57 } 59 }
58 60
59 - static post0<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> { 61 + static post<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> {
60 let config: AxiosRequestConfig = { 62 let config: AxiosRequestConfig = {
61 headers: HttpRequest.buildHeaderWithGlobalHeader(headers) 63 headers: HttpRequest.buildHeaderWithGlobalHeader(headers)
62 } 64 }
63 return service.post(url, data, config) 65 return service.post(url, data, config)
64 } 66 }
65 67
66 - static post<T = object>(url: string, data1?: object, headers?: HashMap<string, string>): Promise<T> {  
67 - let requestHeaders: AxiosHeaders = new AxiosHeaders()  
68 - headers?.forEach((v, k) => {  
69 - requestHeaders.set(k, v);  
70 - });  
71 - let config: AxiosRequestConfig = {  
72 - headers: requestHeaders as RawAxiosRequestHeaders,  
73 - }  
74 - return service.post(url, data1, config)  
75 - }  
76 -  
77 static put<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> { 68 static put<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> {
78 let config: AxiosRequestConfig = { 69 let config: AxiosRequestConfig = {
79 headers: HttpRequest.buildHeaderWithGlobalHeader(headers) 70 headers: HttpRequest.buildHeaderWithGlobalHeader(headers)
1 -// import { ResponseLogin } from '../bean/account/ResponseLogin';  
2 -import { Logger } from 'wdKit';  
3 -  
4 -// import { UserInfo } from '../bean/account/UserInfo';  
5 -// import { ConfigConstants } from '../constants/ConfigConstants';  
6 -// import { AccountManagerUtils } from './AccountManagerUtils';  
7 -// import { AppUtils } from './AppUtils';  
8 -// import { DeviceUtil } from './DeviceUtil';  
9 -// import { Logger } from './Logger';  
10 -// import { StringUtils } from './StringUtils'; 1 +import { HttpRequest } from '../http/HttpRequest';
11 2
12 const TAG: string = '[HttpUtils]' 3 const TAG: string = '[HttpUtils]'
13 4
14 export class HttpUtils { 5 export class HttpUtils {
15 - static buildHeaders(): Record<string, string> {  
16 - let timestamp: number = new Date().getTime(); // 单位毫秒  
17 - // let clientId = DeviceUtil.clientId()  
18 -  
19 - let headers: Record<string, string> = {};  
20 - // 通用请求头  
21 - headers["version"] = 'V3';  
22 - // headers["appId"] = ConfigConstants.appId; // 应用id  
23 - // headers["terminalId"] = ConfigConstants.terminalId; // 终端ID  
24 - // headers["sourceId"] = ConfigConstants.sourceId; // 咪咕视频  
25 - // headers["appType"] = ConfigConstants.appType; // 手机客户端App(安卓)  
26 - // headers["clientType"] = ConfigConstants.clientType; // 客户端类型  
27 - // headers["appVersion"] = AppUtils.getAppVersionCode() + ''; // 客户端版本号:2600010500  
28 - // headers["APP-VERSION-CODE"] = AppUtils.getAppVersionCode() + ''; // APP版本号:250006577  
29 - // headers["appVersionName"] = AppUtils.getAppVersionName() // app对外显示版本: '6.1.5.00'  
30 - // headers["appCode"] = ConfigConstants.appCode; // 应用编码:产品_渠道_应用的拼接串,用下划线_ 拼接而成  
31 - // headers["ptvCode"] = ConfigConstants.ptvCode; // 基线版本号_应用版本号 todo:  
32 - // headers["clientProvinceCode"] = ''; // 客户端分省号 // 02  
33 - // headers["provinceCode"] = ''; // 客户端分省号 // 02  
34 - // headers["clientCityId"] = ''; // 客户端城市ID // 0210  
35 - // headers["carrierCode"] = ''; // 运营商信息  
36 -  
37 - // 设备信息请求头  
38 - // headers["User-Agent"] = ''; // 终端UA,自动获取  
39 - headers["Content-Type"] = 'application/json;charset=UTF-8'; // 返回/响应的HTTP内容类型  
40 - headers["os"] = 'android'; // 操作系统类型:鸿蒙、安卓或iOS  
41 - // headers["osInfo"] = 'AD'; // 操作系统信息  
42 - headers["Phone-Info"] = 'HUAWEI'; // 手机信息: todo  
43 - // headers["oaid"] = ''; // 开放匿名设备ID,是中国移动安全联盟(MSA)发起并制定标准用户识别ID  
44 - headers["networkInfo"] = 'WIFI'; // 网络类型: todo  
45 - headers["cache-control"] = 'no-cache'; // 请求和响应遵循的缓存机制  
46 - // headers["clientId"] = clientId; // 客户端编号:客户端初始化时生成的客户端ID,保证唯一性  
47 - headers["imei"] = 'd1de6d3ae0db44bea1b3f0e20a14d90a'; // 终端手机序列号: todo  
48 - headers["X-UP-CLIENT-CHANNEL-ID"] = '2600010500-99000-101700010130012'; // 客户端渠道ID: todo  
49 - headers["channelCode"] = 'VIDEO_APPMAIL'; // 渠道编码  
50 - // headers["l_c"] = clientId; // 客户端id,同clientId  
51 - // headers["l_t"] = timestamp + ''; // 本机时间戳  
52 - // headers["l_s"] = ''; // l_c和l_t拼接后的MD5校验  
53 -  
54 - // 签名相关请求头  
55 - headers["timeStamp"] = timestamp + ''; // 服务端时间戳(毫秒):1701667763664  
56 - headers["signType"] = 'RSA'; // 签名类型,固定RSA 6 + /**
  7 + * 添加公共参数,如登录后,添加登录信息
  8 + */
  9 + static addCommonHeader() {
  10 + HttpRequest.addGlobalHeaderProvider(() => {
  11 + let headers: Record<string, string> = {};
  12 + return headers;
  13 + })
  14 + }
57 15
58 - // 业务请求头  
59 - // headers["promotionID"] = '54b0f421-a6df-41d3-9be2-92820b2c5d8c'; // 促销Id todo  
60 - // headers["tenantId"] = ''; // 租户Id 16 + /**
  17 + * 添加公共参数,如登出后,移除登录信息
  18 + */
  19 + static removeCommonHeader() {
61 20
62 - // 添加其他header  
63 - // headers["sdkCeId"] = '27fb3129-5a54-45bc-8af1-7dc8f1155501'; // 用户中台老接口定义的ID,保持不变,现网:咪咕视频Android版,27fb3129-5a54-45bc-8af1-7dc8f1155501 todo  
64 - headers["support-pendant"] = '1'; // 挂件标识, "1":客户端支持挂件节目结构;非"1":不支持挂件节目结构-展示通用对象  
65 - Logger.info(TAG, "buildHeader headers:" + JSON.stringify(headers));  
66 - return headers;  
67 } 21 }
68 -}  
69 -  
70 -// export default new HttpUtils() 22 +}
@@ -4,37 +4,39 @@ import { TopNavDTO } from './TopNavDTO'; @@ -4,37 +4,39 @@ import { TopNavDTO } from './TopNavDTO';
4 * 底导(包含顶导列表)数据 4 * 底导(包含顶导列表)数据
5 */ 5 */
6 export interface BottomNavDTO { 6 export interface BottomNavDTO {
7 - backgroundUrl: string;  
8 - channelChooseActionUrl: string;  
9 - channelChooseCColor: string;  
10 - channelChooseColor: string;  
11 - channelMoreColor: string; 7 + backgroundUrl: string; // 迭代四:页面背景图
  8 + channelChooseActionUrl: string; // 迭代四:频道选中下划线动画
  9 + channelChooseCColor: string; // 迭代四:频道未选中颜色
  10 + channelChooseColor: string; // 迭代四:频道选中颜色
  11 + channelMoreColor: string; // 迭代四:更多频道颜色
12 extraData: string; 12 extraData: string;
13 - homePageColor: string;  
14 - icon: string;  
15 - iconC: string; 13 + homePageColor: string; // 迭代四:主页图标/文字颜色
  14 + icon: string; // 未选中图标
  15 + iconC: string; // 选中图标
16 id: number; 16 id: number;
17 - immersiveIconCUrl: string;  
18 - immersiveIconUrl: string;  
19 - immersiveNameCColor: string;  
20 - immersiveNameColor: string;  
21 - logoUrl: string; 17 + immersiveIconCUrl: string; // 迭代二新增-图标颜色-选中(沉浸式频道)
  18 + immersiveIconUrl: string; // 迭代二新增-图标颜色-未选中(沉浸式频道)
  19 + immersiveNameCColor: string; // 迭代二新增-文字颜色-选中(沉浸式频道)
  20 + immersiveNameColor: string; // 迭代二新增-文字颜色-未选中(沉浸式频道)
  21 + logoUrl: string; // 迭代四:logo图片
22 morningAndEveningUrl: string; 22 morningAndEveningUrl: string;
23 name: string; 23 name: string;
24 - nameCColor: string;  
25 - nameColor: string;  
26 - nightIconCUrl: string;  
27 - nightIconUrl: string;  
28 - nightNameCColor: string;  
29 - nightNameColor: string;  
30 - noticeColor: string; 24 + nameCColor: string; // 名字选中颜色
  25 + nameColor: string; // 名字颜色
  26 + nightIconCUrl: string; // 迭代三新增-图标颜色-选中(夜间模式)
  27 + nightIconUrl: string; // 迭代三新增-图标颜色-未选中(夜间模式)
  28 + nightNameCColor: string; // 迭代三新增-文字颜色-选中(夜间模式)
  29 + nightNameColor: string; // 迭代三新增-文字颜色-未选中(夜间模式)
  30 + noticeColor: string; // 迭代四:消息通知提醒颜色
31 pageId?: string; 31 pageId?: string;
32 pageType?: string; 32 pageType?: string;
33 - searchBothColor: string;  
34 - searchUrl: string; 33 + searchBothColor: string; // 迭代四:两侧文字图标颜色,搜索图标颜色
  34 + searchUrl: string; // 迭代四:搜索背景框
35 sortValue: number; 35 sortValue: number;
36 - statusBarColor: number; 36 + statusBarColor: number; // 迭代四:状态栏图标颜色,0:白色,1:黑色
37 topNavChannelList: TopNavDTO[]; 37 topNavChannelList: TopNavDTO[];
38 - topStyle: string;  
39 - type: string; 38 + topStyle: string; // 顶部样式:中文的(11-新闻;12-人民号;13-视频;14-服务)
  39 + type: string; // 底部导航类型,1普通 2我的;【rmrb需要扩展】
  40 + fmorningAndEveningUrl: string; // 迭代四:早晚报背景框
  41 + dropDownAnimationColor: string; // 下拉加载动画颜色,1白色,2灰色。未配置值是null
40 } 42 }
@@ -4,9 +4,10 @@ import { BottomNavDTO } from './BottomNavDTO'; @@ -4,9 +4,10 @@ import { BottomNavDTO } from './BottomNavDTO';
4 * 导航Body数据 4 * 导航Body数据
5 */ 5 */
6 export interface NavigationBodyDTO { 6 export interface NavigationBodyDTO {
7 - backgroundColor: string; 7 + backgroundColor: string; // 迭代二新增-底部导航背景色(信息流频道)
8 bottomNavList: BottomNavDTO[]; 8 bottomNavList: BottomNavDTO[];
9 - // greyBottomNav: GreyBottomNav;  
10 - immersiveBackgroundColor: string;  
11 - nightBackgroundColor: string; 9 +
  10 + // greyBottomNav: GreyBottomNav; // 灰度皮肤
  11 + immersiveBackgroundColor: string; // 迭代二新增-底部导航背景色(沉浸式频道)
  12 + nightBackgroundColor: string; // 迭代三新增-底部导航背景色(夜间模式)
12 } 13 }
@@ -7,14 +7,14 @@ export interface TopNavDTO { @@ -7,14 +7,14 @@ export interface TopNavDTO {
7 channelType: number; 7 channelType: number;
8 defaultPermitted: number; 8 defaultPermitted: number;
9 delPermitted: number; 9 delPermitted: number;
10 - fontCColor: string;  
11 - fontColor: string; 10 + fontCColor: string; // 频道展示样式颜色(选中状态)
  11 + fontColor: string; // 频道展示样式颜色(未选中状态)
12 headlinesOn: number; 12 headlinesOn: number;
13 homeChannel: string; 13 homeChannel: string;
14 - iconCUrl: string;  
15 - iconCUrlSize: string;  
16 - iconUrl: string;  
17 iconUrlSize: string; 14 iconUrlSize: string;
  15 + iconCUrlSize: string;
  16 + iconUrl: string; // 频道图片展示样式图片相对地址(未选中状态)
  17 + iconCUrl: string; //频道图片展示样式图片相对地址(选中状态
18 localChannel: string; 18 localChannel: string;
19 moreChannel: string; 19 moreChannel: string;
20 movePermitted: number; 20 movePermitted: number;
@@ -23,5 +23,5 @@ export interface TopNavDTO { @@ -23,5 +23,5 @@ export interface TopNavDTO {
23 num: number; 23 num: number;
24 pageId: number; 24 pageId: number;
25 pageType: string; 25 pageType: string;
26 - underlineCColor: string; 26 + underlineCColor: string; // 选中下划线颜色
27 } 27 }
@@ -168,6 +168,11 @@ export struct MorningEveningPaperComponent { @@ -168,6 +168,11 @@ export struct MorningEveningPaperComponent {
168 } 168 }
169 } 169 }
170 170
  171 + async aboutToDisappear() {
  172 + let windowHight: window.Window = await window.getLastWindow(getContext(this));
  173 + await windowHight.setWindowLayoutFullScreen(false);
  174 + }
  175 +
171 onPageHide() { 176 onPageHide() {
172 this.status = PlayerConstants.STATUS_PAUSE; 177 this.status = PlayerConstants.STATUS_PAUSE;
173 this.playerController?.pause(); 178 this.playerController?.pause();
@@ -5,7 +5,6 @@ import commentViewModel from '../viewmodel/CommentViewModel' @@ -5,7 +5,6 @@ import commentViewModel from '../viewmodel/CommentViewModel'
5 import { router, window } from '@kit.ArkUI' 5 import { router, window } from '@kit.ArkUI'
6 import { CustomTitleUI } from '../../reusable/CustomTitleUI' 6 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'  
9 import { HttpUrlUtils } from 'wdNetwork/Index' 8 import { HttpUrlUtils } from 'wdNetwork/Index'
10 import PageModel from '../../../viewmodel/PageModel' 9 import PageModel from '../../../viewmodel/PageModel'
11 import { ErrorComponent } from '../../view/ErrorComponent' 10 import { ErrorComponent } from '../../view/ErrorComponent'
1 import { BottomNavi, CommonConstants } from 'wdConstant'; 1 import { BottomNavi, CommonConstants } from 'wdConstant';
2 -import { BottomNavDTO } from 'wdBean'; 2 +import { BottomNavDTO, TopNavDTO } from 'wdBean';
3 import { DateTimeUtils, EmitterEventId, EmitterUtils, Logger } from 'wdKit'; 3 import { DateTimeUtils, 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 import HomeChannelUtils, { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
  9 +import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
9 10
10 const TAG = 'BottomNavigationComponent'; 11 const TAG = 'BottomNavigationComponent';
11 let storage = LocalStorage.getShared(); 12 let storage = LocalStorage.getShared();
@@ -21,14 +22,13 @@ export struct BottomNavigationComponent { @@ -21,14 +22,13 @@ export struct BottomNavigationComponent {
21 @Provide isLayoutFullScreen: boolean = false 22 @Provide isLayoutFullScreen: boolean = false
22 @Provide isImmersive: boolean = false // 是否开启沉浸式模式 http://192.168.1.3:3300/project/3802/interface/api/189229 23 @Provide isImmersive: boolean = false // 是否开启沉浸式模式 http://192.168.1.3:3300/project/3802/interface/api/189229
23 @Provide isNight: boolean = false // 是否开启夜间模式 24 @Provide isNight: boolean = false // 是否开启夜间模式
  25 + @Provide currentBottomNavInfo: BottomNavDTO = {} as BottomNavDTO; // 当前底导信息
  26 + @Provide currentTopNavInfo: TopNavDTO = {} as TopNavDTO; // 当前顶导信息
  27 + @Provide barBackgroundColor: Color = Color.Transparent
24 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 28 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
25 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 29 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
26 - // 底导/顶导全部数据  
27 - @State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = []  
28 - // 底导当前选中/焦点下标  
29 - @State currentNavIndex: number = BottomNavi.NEWS;  
30 - // @State currentTopNavSelectedIndex: number = 0; //  
31 - @State barBackgroundColor: Color = Color.Transparent 30 + @State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = [] // 底导/顶导全部数据
  31 + @State currentNavIndex: number = BottomNavi.NEWS; // 底导当前选中/焦点下标
32 // 底导TabsController 32 // 底导TabsController
33 private navController: TabsController = new TabsController(); 33 private navController: TabsController = new TabsController();
34 readonly ASPECT_RATIO_1_1: number = 1 / 1; // 底导图片宽高比 34 readonly ASPECT_RATIO_1_1: number = 1 / 1; // 底导图片宽高比
@@ -44,6 +44,7 @@ export struct BottomNavigationComponent { @@ -44,6 +44,7 @@ export struct BottomNavigationComponent {
44 @State assignChannel: AssignChannelParam = new AssignChannelParam() 44 @State assignChannel: AssignChannelParam = new AssignChannelParam()
45 // 自动刷新触发(双击tab自动刷新) 45 // 自动刷新触发(双击tab自动刷新)
46 @State autoRefresh: number = 0 46 @State autoRefresh: number = 0
  47 +
47 async aboutToAppear() { 48 async aboutToAppear() {
48 Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`); 49 Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`);
49 let bottomNav = await PageViewModel.getBottomNavData(getContext(this)) 50 let bottomNav = await PageViewModel.getBottomNavData(getContext(this))
@@ -84,7 +85,6 @@ export struct BottomNavigationComponent { @@ -84,7 +85,6 @@ export struct BottomNavigationComponent {
84 _currentNavIndex: $currentNavIndex, 85 _currentNavIndex: $currentNavIndex,
85 navIndex: index, 86 navIndex: index,
86 currentBottomNavName: navItem.name, 87 currentBottomNavName: navItem.name,
87 - barBackgroundColor: $barBackgroundColor,  
88 assignChannel: this.assignChannel, 88 assignChannel: this.assignChannel,
89 autoRefresh: this.autoRefresh 89 autoRefresh: this.autoRefresh
90 }) 90 })
@@ -99,8 +99,8 @@ export struct BottomNavigationComponent { @@ -99,8 +99,8 @@ export struct BottomNavigationComponent {
99 .animationDuration(0) 99 .animationDuration(0)
100 .barHeight($r('app.float.bottom_navigation_barHeight')) 100 .barHeight($r('app.float.bottom_navigation_barHeight'))
101 .barMode(BarMode.Fixed) 101 .barMode(BarMode.Fixed)
102 - // TODO:更详细的判断是视频频道  
103 .barBackgroundColor(this.barBackgroundColor) 102 .barBackgroundColor(this.barBackgroundColor)
  103 + // 备注:鸿蒙目前只有修改三线导航背景方法,对于全面屏导航条手机需要设置背景色并使其扩散到导航区域
104 .backgroundColor(this.barBackgroundColor) 104 .backgroundColor(this.barBackgroundColor)
105 .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) 105 .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
106 106
@@ -108,17 +108,6 @@ export struct BottomNavigationComponent { @@ -108,17 +108,6 @@ export struct BottomNavigationComponent {
108 108
109 } 109 }
110 110
111 - /**  
112 - * TODO:更详细的判断视频频道  
113 - */  
114 - getFontColor(index: number): Color {  
115 - if (this.currentNavIndex === 2 && this.barBackgroundColor === Color.Black) {  
116 - return Color.White  
117 - } else {  
118 - return this.currentNavIndex === index ? Color.Red : Color.Gray  
119 - }  
120 - }  
121 -  
122 @Builder 111 @Builder
123 tabBarBuilder(navItem: BottomNavDTO, index: number) { 112 tabBarBuilder(navItem: BottomNavDTO, index: number) {
124 Stack({ alignContent: Alignment.Bottom }) { 113 Stack({ alignContent: Alignment.Bottom }) {
@@ -126,37 +115,39 @@ export struct BottomNavigationComponent { @@ -126,37 +115,39 @@ export struct BottomNavigationComponent {
126 .height(CommonConstants.FULL_PARENT) 115 .height(CommonConstants.FULL_PARENT)
127 .padding({ bottom: 15, left: 10, right: 10, top: 2 }) 116 .padding({ bottom: 15, left: 10, right: 10, top: 2 })
128 .aspectRatio(this.ASPECT_RATIO_1_1) 117 .aspectRatio(this.ASPECT_RATIO_1_1)
  118 + .gesture(
  119 + TapGesture({ count: 2 })
  120 + .onAction((event: GestureEvent) => {
  121 + if (this.currentNavIndex === index) {
  122 + // 当前tab,双击事件
  123 + this.autoRefresh++
  124 + }
  125 + })
  126 + )
129 127
130 Text(navItem.name) 128 Text(navItem.name)
131 .margin({ bottom: $r('app.float.bottom_navigation_margin_bottom') }) 129 .margin({ bottom: $r('app.float.bottom_navigation_margin_bottom') })
132 .fontWeight(this.currentNavIndex === index ? FontWeight.Bold : FontWeight.Normal) 130 .fontWeight(this.currentNavIndex === index ? FontWeight.Bold : FontWeight.Normal)
133 .textAlign(TextAlign.Center) 131 .textAlign(TextAlign.Center)
134 .fontSize($r('app.float.font_size_10'))// .fontColor(this.currentNavIndex === index ? Color.Red : Color.Gray) 132 .fontSize($r('app.float.font_size_10'))// .fontColor(this.currentNavIndex === index ? Color.Red : Color.Gray)
135 - .fontColor(this.getFontColor(index)) 133 + .fontColor(this.currentNavIndex === index ? navItem.nameCColor : navItem.nameColor)
136 .opacity(this.currentNavIndex === index ? this.FULL_OPACITY : this.SIXTY_OPACITY) 134 .opacity(this.currentNavIndex === index ? this.FULL_OPACITY : this.SIXTY_OPACITY)
137 } 135 }
138 .height($r('app.float.bottom_navigation_barHeight')) 136 .height($r('app.float.bottom_navigation_barHeight'))
139 .hoverEffect(HoverEffect.Highlight) 137 .hoverEffect(HoverEffect.Highlight)
140 .onClick(() => { 138 .onClick(() => {
141 - if (this.currentNavIndex === index) {  
142 - // 当前tab,双击事件  
143 - this.doubleClick(() => {  
144 - Logger.info(TAG, 'tab double click ')  
145 - this.autoRefresh++  
146 - }) 139 + if (navItem.name === '我的') {
  140 + this.barBackgroundColor = Color.White
  141 + this.currentBottomNavInfo = {} as BottomNavDTO
147 } else { 142 } else {
148 - // 切换tab  
149 - this.currentNavIndex = index;  
150 - Logger.info(TAG, `onChange, index: ${index}`); 143 + this.currentBottomNavInfo = navItem
151 } 144 }
  145 +
  146 + this.currentNavIndex = index;
  147 + Logger.info(TAG, `onChange, index: ${index}`);
  148 +
152 }) 149 })
153 150
154 - // .justifyContent(FlexAlign.Center)  
155 - // .onClick(() => {  
156 - // Logger.info(TAG, `onClick, index: ${index}`);  
157 - // this.currentNavIndex = index ?? 0;  
158 - // this.navController.changeIndex(this.currentNavIndex);  
159 - // })  
160 } 151 }
161 152
162 // 底导切换函数 153 // 底导切换函数
@@ -199,17 +190,17 @@ export struct BottomNavigationComponent { @@ -199,17 +190,17 @@ export struct BottomNavigationComponent {
199 /** 190 /**
200 * 双击实现 191 * 双击实现
201 */ 192 */
202 - doubleClickTime: number = 0 193 + // doubleClickTime: number = 0
203 194
204 /** 195 /**
205 * 双击实现 196 * 双击实现
206 */ 197 */
207 - private doubleClick(fun: () => void) {  
208 - let now = DateTimeUtils.getTimeStamp()  
209 - if (now - this.doubleClickTime < 200) {  
210 - fun()  
211 - } else {  
212 - this.doubleClickTime = now  
213 - }  
214 - } 198 + // private doubleClick(fun: () => void) {
  199 + // let now = DateTimeUtils.getTimeStamp()
  200 + // if (now - this.doubleClickTime < 200) {
  201 + // fun()
  202 + // } else {
  203 + // this.doubleClickTime = now
  204 + // }
  205 + // }
215 } 206 }
1 -import { CompDTO, TopNavDTO } from 'wdBean'; 1 +import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean';
2 import { LazyDataSource, Logger } from 'wdKit'; 2 import { LazyDataSource, Logger } from 'wdKit';
3 import { ProcessUtils } from 'wdRouter'; 3 import { ProcessUtils } from 'wdRouter';
4 import { PageComponent } from './PageComponent'; 4 import { PageComponent } from './PageComponent';
@@ -26,12 +26,14 @@ export struct TopNavigationComponent { @@ -26,12 +26,14 @@ export struct TopNavigationComponent {
26 @Consume isLayoutFullScreen: boolean 26 @Consume isLayoutFullScreen: boolean
27 @Consume bottomRectHeight: number 27 @Consume bottomRectHeight: number
28 @Consume topRectHeight: number 28 @Consume topRectHeight: number
  29 + @Consume @Watch('topOrBottomNavChange') currentBottomNavInfo: BottomNavDTO // 当前底导信息
  30 + @Consume barBackgroundColor: Color
29 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 31 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
30 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 32 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
31 - @Link barBackgroundColor: Color  
32 @Link _currentNavIndex?: number; 33 @Link _currentNavIndex?: number;
33 // 顶导当前选中/焦点下标 34 // 顶导当前选中/焦点下标
34 - @State currentTopNavSelectedIndex: number = 0; 35 + @State @Watch('topOrBottomNavChange') currentTopNavSelectedIndex: number = 0;
  36 + @State currentTopNavName: string = '';
35 // 顶导数据 37 // 顶导数据
36 @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] 38 @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = []
37 @State compList: LazyDataSource<CompDTO> = new LazyDataSource(); 39 @State compList: LazyDataSource<CompDTO> = new LazyDataSource();
@@ -56,6 +58,21 @@ export struct TopNavigationComponent { @@ -56,6 +58,21 @@ export struct TopNavigationComponent {
56 // 当前底导index 58 // 当前底导index
57 @State navIndex: number = 0 59 @State navIndex: number = 0
58 60
  61 + topOrBottomNavChange() {
  62 + if (this.currentBottomNavName === this.currentBottomNavInfo?.name) {
  63 + this.setBarBackgroundColor()
  64 + }
  65 + }
  66 +
  67 + setBarBackgroundColor() {
  68 + console.error('setBarBackgroundColor', this.currentTopNavName, this.currentBottomNavInfo?.name)
  69 + if (this.currentTopNavName === '视频' && this.currentBottomNavInfo?.name === '视频') {
  70 + this.barBackgroundColor = Color.Black
  71 + } else {
  72 + this.barBackgroundColor = Color.White
  73 + }
  74 + }
  75 +
59 //处理新闻tab顶导频道数据 76 //处理新闻tab顶导频道数据
60 topNavListHandle() { 77 topNavListHandle() {
61 let _channelIds: number [] = [] 78 let _channelIds: number [] = []
@@ -126,10 +143,14 @@ export struct TopNavigationComponent { @@ -126,10 +143,14 @@ export struct TopNavigationComponent {
126 this.channelIds = _channelIds 143 this.channelIds = _channelIds
127 this.myChannelList = _myChannelList 144 this.myChannelList = _myChannelList
128 145
  146 + this.currentTopNavName = this._currentNavIndex === 0 ? this.myChannelList[0].name : this.topNavList[0].name
  147 +
  148 +
129 //缓存首页频道 149 //缓存首页频道
130 let index = this.myChannelList.findIndex(_item => _item.channelId === this.indexSettingChannelId) 150 let index = this.myChannelList.findIndex(_item => _item.channelId === this.indexSettingChannelId)
131 if (index > -1) { 151 if (index > -1) {
132 this.currentTopNavSelectedIndex = index 152 this.currentTopNavSelectedIndex = index
  153 + this.currentTopNavName = this.myChannelList[index].name
133 } 154 }
134 } 155 }
135 156
@@ -196,7 +217,6 @@ export struct TopNavigationComponent { @@ -196,7 +217,6 @@ export struct TopNavigationComponent {
196 groupId: this.groupId + '', 217 groupId: this.groupId + '',
197 pageId: navItem.pageId + '', 218 pageId: navItem.pageId + '',
198 channelId: navItem.channelId + '', 219 channelId: navItem.channelId + '',
199 - barBackgroundColor: $barBackgroundColor  
200 }) 220 })
201 } else 221 } else
202 if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { 222 if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
@@ -216,9 +236,10 @@ export struct TopNavigationComponent { @@ -216,9 +236,10 @@ export struct TopNavigationComponent {
216 .barHeight($r('app.float.top_tab_bar_height')) 236 .barHeight($r('app.float.top_tab_bar_height'))
217 .barMode(BarMode.Scrollable) 237 .barMode(BarMode.Scrollable)
218 .vertical(false) 238 .vertical(false)
219 - // item.name === '视频' && this.currentTopNavSelectedIndex === 0 ?  
220 .barBackgroundColor(this.barBackgroundColor) 239 .barBackgroundColor(this.barBackgroundColor)
221 .onChange((index: number) => { 240 .onChange((index: number) => {
  241 + this.currentTopNavName = this._currentNavIndex === 0 ? this.myChannelList[index].name : this.topNavList[index].name
  242 +
222 Logger.info(TAG, `onChange index : ${index}`); 243 Logger.info(TAG, `onChange index : ${index}`);
223 if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && 244 if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) &&
224 !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) 245 !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])
@@ -256,15 +277,11 @@ export struct TopNavigationComponent { @@ -256,15 +277,11 @@ export struct TopNavigationComponent {
256 } 277 }
257 278
258 /** 279 /**
259 - * TODO:更详细的判断视频频道 280 + * TODO:根据顶导配置获取颜色展示效果不对,待确认
260 */ 281 */
261 - getFontColor(item: TopNavDTO, index: number): Color | string {  
262 - if (this._currentNavIndex === 2) {  
263 - if (this.currentTopNavSelectedIndex == 0) {  
264 - return item.name === '视频' ? Color.White : '#e5e0e0'  
265 - } else {  
266 - return this.currentTopNavSelectedIndex === index ? Color.Black : "#999999"  
267 - } 282 + getTopNavFontColor(item: TopNavDTO, index: number): Color | string {
  283 + if (item.name === '视频' && this.currentBottomNavInfo.name === '视频') {
  284 + return this.currentTopNavSelectedIndex === index ? Color.White : '#e5e0e0'
268 } else { 285 } else {
269 return this.currentTopNavSelectedIndex === index ? Color.Black : "#999999" 286 return this.currentTopNavSelectedIndex === index ? Color.Black : "#999999"
270 } 287 }
@@ -276,9 +293,10 @@ export struct TopNavigationComponent { @@ -276,9 +293,10 @@ export struct TopNavigationComponent {
276 Text(item.name) 293 Text(item.name)
277 .fontSize($r('app.float.selected_text_size')) 294 .fontSize($r('app.float.selected_text_size'))
278 .fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal) 295 .fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal)
279 - .fontColor(this.getFontColor(item, index))  
280 - .padding({ top: $r('app.float.top_tab_item_padding_top') , bottom: $r('app.float.top_tab_item_padding_bottom')}) 296 + .fontColor(this.getTopNavFontColor(item, index))
  297 + .padding({ top: $r('app.float.top_tab_item_padding_top'), bottom: $r('app.float.top_tab_item_padding_bottom') })
281 .maxLines(this.MAX_LINE) 298 .maxLines(this.MAX_LINE)
  299 + // .backgroundImage(this.currentTopNavSelectedIndex === index ? item.iconCUrl : item.iconUrl)
282 if (this.currentTopNavSelectedIndex === index) { 300 if (this.currentTopNavSelectedIndex === index) {
283 Row() 301 Row()
284 .width(20) 302 .width(20)
@@ -292,18 +310,20 @@ export struct TopNavigationComponent { @@ -292,18 +310,20 @@ export struct TopNavigationComponent {
292 minWidth: $r('app.float.top_tab_item_min_width'), 310 minWidth: $r('app.float.top_tab_item_min_width'),
293 maxWidth: $r('app.float.top_tab_item_max_width') 311 maxWidth: $r('app.float.top_tab_item_max_width')
294 }) 312 })
295 - .backgroundColor(Color.Transparent) 313 + // .backgroundColor(Color.Transparent)
296 .padding({ 314 .padding({
297 left: $r('app.float.top_tab_item_padding_horizontal'), 315 left: $r('app.float.top_tab_item_padding_horizontal'),
298 right: $r('app.float.top_tab_item_padding_horizontal'), 316 right: $r('app.float.top_tab_item_padding_horizontal'),
299 }) 317 })
300 .id(`col_tabBar${index}`) 318 .id(`col_tabBar${index}`)
301 .margin({ right: this.myChannelList.length === index + 1 ? 36 : 0 }) 319 .margin({ right: this.myChannelList.length === index + 1 ? 36 : 0 })
  320 +
302 } 321 }
303 322
304 aboutToAppear() { 323 aboutToAppear() {
305 //处理新闻tab顶导频道数据 324 //处理新闻tab顶导频道数据
306 this.topNavListHandle() 325 this.topNavListHandle()
  326 + this.setBarBackgroundColor()
307 } 327 }
308 328
309 aboutToDisappear() { 329 aboutToDisappear() {
@@ -35,16 +35,8 @@ export class PageRepository { @@ -35,16 +35,8 @@ export class PageRepository {
35 } 35 }
36 36
37 static getPageInfoUrl(pageId: string) { 37 static getPageInfoUrl(pageId: string) {
38 - let url = HttpUrlUtils.getHost() + HttpUrlUtils.PAGE_INFO_PATH;  
39 - // TODO 暂定只请求第一页,后续对接分页加载,参数再调整 first_load?  
40 - url = url + "?channelStrategy=2&loadStrategy=first_load"  
41 - + "&districtCode=" + HttpUrlUtils.getDistrictCode()  
42 - + "&provinceCode=" + HttpUrlUtils.getProvinceCode()  
43 - + "&cityCode=" + HttpUrlUtils.getCityCode()  
44 - + "&refreshTime=" + DateTimeUtils.getTimeStamp()  
45 - + "&pageId=" + pageId  
46 - // Logger.debug("TAG", 'getCompInfoUrl url: '+url);  
47 - Logger.info(TAG, "getPageInfoUrl url = " + url) 38 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.PAGE_INFO_PATH + "?pageId=" + pageId;
  39 + // Logger.info(TAG, "getPageInfoUrl url = " + url)
48 return url; 40 return url;
49 } 41 }
50 42
@@ -293,7 +285,7 @@ export class PageRepository { @@ -293,7 +285,7 @@ export class PageRepository {
293 static postExecuteLike(params: postExecuteLikeParams): Promise<ResponseDTO> { 285 static postExecuteLike(params: postExecuteLikeParams): Promise<ResponseDTO> {
294 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTELIKE 286 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTELIKE
295 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 287 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
296 - return WDHttp.post0(url, params, headers) 288 + return WDHttp.post(url, params, headers)
297 } 289 }
298 290
299 /** 291 /**
@@ -304,7 +296,7 @@ export class PageRepository { @@ -304,7 +296,7 @@ export class PageRepository {
304 static postExecuteCollectRecord(params: postExecuteCollectRecordParams): Promise<ResponseDTO> { 296 static postExecuteCollectRecord(params: postExecuteCollectRecordParams): Promise<ResponseDTO> {
305 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTECOLLECTRECORD 297 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTECOLLECTRECORD
306 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 298 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
307 - return WDHttp.post0(url, params, headers) 299 + return WDHttp.post(url, params, headers)
308 } 300 }
309 301
310 /** 302 /**
@@ -314,7 +306,7 @@ export class PageRepository { @@ -314,7 +306,7 @@ export class PageRepository {
314 static getContentInteract(params: contentListParams): Promise<ResponseDTO<InteractDataDTO[]>> { 306 static getContentInteract(params: contentListParams): Promise<ResponseDTO<InteractDataDTO[]>> {
315 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_PATH 307 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_PATH
316 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 308 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
317 - return WDHttp.post0(url, params, headers) 309 + return WDHttp.post(url, params, headers)
318 } 310 }
319 311
320 // 浏览历史新增、删除接口 312 // 浏览历史新增、删除接口
@@ -331,7 +323,7 @@ export class PageRepository { @@ -331,7 +323,7 @@ export class PageRepository {
331 static fetchBatchAttentionStatus(params: postBatchAttentionStatusParams): Promise<ResponseDTO<postBatchAttentionStatusResult[]>> { 323 static fetchBatchAttentionStatus(params: postBatchAttentionStatusParams): Promise<ResponseDTO<postBatchAttentionStatusResult[]>> {
332 let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_LIST_STATUS_DATA_PATH 324 let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_LIST_STATUS_DATA_PATH
333 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 325 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
334 - return WDHttp.post0(url, params, headers) 326 + return WDHttp.post(url, params, headers)
335 } 327 }
336 328
337 /** 329 /**
@@ -340,7 +332,7 @@ export class PageRepository { @@ -340,7 +332,7 @@ export class PageRepository {
340 static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> { 332 static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> {
341 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION 333 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION
342 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 334 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
343 - return WDHttp.post0(url, params, headers) 335 + return WDHttp.post(url, params, headers)
344 } 336 }
345 337
346 static fetchNewspaperInfo(date: string) { 338 static fetchNewspaperInfo(date: string) {
@@ -245,7 +245,7 @@ export class ContentDetailRequest { @@ -245,7 +245,7 @@ export class ContentDetailRequest {
245 static getContentInteract(params: contentListParams): Promise<ResponseDTO<InteractDataDTO[]>> { 245 static getContentInteract(params: contentListParams): Promise<ResponseDTO<InteractDataDTO[]>> {
246 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_PATH 246 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_PATH
247 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 247 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
248 - return WDHttp.post0(url, params, headers) 248 + return WDHttp.post(url, params, headers)
249 } 249 }
250 250
251 /** 251 /**
@@ -255,7 +255,7 @@ export class ContentDetailRequest { @@ -255,7 +255,7 @@ export class ContentDetailRequest {
255 static postBatchLikeAndCollectStatus(params: batchLikeAndCollectParams): Promise<ResponseDTO<batchLikeAndCollectResult[]>> { 255 static postBatchLikeAndCollectStatus(params: batchLikeAndCollectParams): Promise<ResponseDTO<batchLikeAndCollectResult[]>> {
256 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_STATUS 256 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_STATUS
257 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 257 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
258 - return WDHttp.post0(url, params, headers) 258 + return WDHttp.post(url, params, headers)
259 } 259 }
260 260
261 /** 261 /**
@@ -265,7 +265,7 @@ export class ContentDetailRequest { @@ -265,7 +265,7 @@ export class ContentDetailRequest {
265 static postBatchAttentionStatus(params: postBatchAttentionStatusParams): Promise<ResponseDTO<postBatchAttentionStatusResult[]>> { 265 static postBatchAttentionStatus(params: postBatchAttentionStatusParams): Promise<ResponseDTO<postBatchAttentionStatusResult[]>> {
266 let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_LIST_STATUS_DATA_PATH 266 let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_LIST_STATUS_DATA_PATH
267 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 267 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
268 - return WDHttp.post0(url, params, headers) 268 + return WDHttp.post(url, params, headers)
269 } 269 }
270 270
271 271
@@ -277,7 +277,7 @@ export class ContentDetailRequest { @@ -277,7 +277,7 @@ export class ContentDetailRequest {
277 static postRecommendVideoList(params: recommentVideoListParams): Promise<ResponseDTO<ContentDetailDTO[]>> { 277 static postRecommendVideoList(params: recommentVideoListParams): Promise<ResponseDTO<ContentDetailDTO[]>> {
278 let url = HttpUrlUtils.getHost() + HttpUrlUtils.RECOMMEND_VIDEOLIST 278 let url = HttpUrlUtils.getHost() + HttpUrlUtils.RECOMMEND_VIDEOLIST
279 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 279 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
280 - return WDHttp.post0(url, params, headers) 280 + return WDHttp.post(url, params, headers)
281 } 281 }
282 282
283 /** 283 /**
@@ -288,7 +288,7 @@ export class ContentDetailRequest { @@ -288,7 +288,7 @@ export class ContentDetailRequest {
288 static postExecuteLike(params: postExecuteLikeParams): Promise<ResponseDTO> { 288 static postExecuteLike(params: postExecuteLikeParams): Promise<ResponseDTO> {
289 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTELIKE 289 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTELIKE
290 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 290 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
291 - return WDHttp.post0(url, params, headers) 291 + return WDHttp.post(url, params, headers)
292 } 292 }
293 293
294 /** 294 /**
@@ -299,7 +299,7 @@ export class ContentDetailRequest { @@ -299,7 +299,7 @@ export class ContentDetailRequest {
299 static postExecuteCollectRecord(params: postExecuteCollectRecordParams): Promise<ResponseDTO> { 299 static postExecuteCollectRecord(params: postExecuteCollectRecordParams): Promise<ResponseDTO> {
300 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTECOLLECTRECORD 300 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTECOLLECTRECORD
301 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 301 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
302 - return WDHttp.post0(url, params, headers) 302 + return WDHttp.post(url, params, headers)
303 } 303 }
304 304
305 /** 305 /**
@@ -309,7 +309,7 @@ export class ContentDetailRequest { @@ -309,7 +309,7 @@ export class ContentDetailRequest {
309 static postPointLevelOperate(params: postPointLevelOperateParams): Promise<ResponseDTO> { 309 static postPointLevelOperate(params: postPointLevelOperateParams): Promise<ResponseDTO> {
310 let url = HttpUrlUtils.getHost() + HttpUrlUtils.USERPOINT_OPERATE 310 let url = HttpUrlUtils.getHost() + HttpUrlUtils.USERPOINT_OPERATE
311 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 311 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
312 - return WDHttp.post0(url, params, headers) 312 + return WDHttp.post(url, params, headers)
313 } 313 }
314 314
315 /** 315 /**
@@ -318,7 +318,7 @@ export class ContentDetailRequest { @@ -318,7 +318,7 @@ export class ContentDetailRequest {
318 static postCommentPublish(params: postCommentPublishParams): Promise<ResponseDTO> { 318 static postCommentPublish(params: postCommentPublishParams): Promise<ResponseDTO> {
319 let url = HttpUrlUtils.getHost() + HttpUrlUtils.COMMENT_PUBLISH 319 let url = HttpUrlUtils.getHost() + HttpUrlUtils.COMMENT_PUBLISH
320 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 320 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
321 - return WDHttp.post0(url, params, headers) 321 + return WDHttp.post(url, params, headers)
322 } 322 }
323 323
324 324
@@ -328,7 +328,7 @@ export class ContentDetailRequest { @@ -328,7 +328,7 @@ export class ContentDetailRequest {
328 static postInteractBrowsOperate(params: postInteractBrowsOperateParams): Promise<ResponseDTO> { 328 static postInteractBrowsOperate(params: postInteractBrowsOperateParams): Promise<ResponseDTO> {
329 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_BROWS_OPERATE 329 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_BROWS_OPERATE
330 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 330 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
331 - return WDHttp.post0(url, params, headers) 331 + return WDHttp.post(url, params, headers)
332 } 332 }
333 333
334 /** 334 /**
@@ -337,6 +337,6 @@ export class ContentDetailRequest { @@ -337,6 +337,6 @@ export class ContentDetailRequest {
337 static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> { 337 static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> {
338 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION 338 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION
339 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 339 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
340 - return WDHttp.post0(url, params, headers) 340 + return WDHttp.post(url, params, headers)
341 } 341 }
342 } 342 }
@@ -32,15 +32,15 @@ export struct DetailPlayLivePage { @@ -32,15 +32,15 @@ export struct DetailPlayLivePage {
32 32
33 aboutToAppear(): void { 33 aboutToAppear(): void {
34 Logger.info(TAG, `wyj-aboutToAppear`) 34 Logger.info(TAG, `wyj-aboutToAppear`)
35 - // this.listener?.on("change", (mediaQueryResult) => {  
36 - // Logger.info(TAG, `change;${mediaQueryResult.matches}`)  
37 - // if (mediaQueryResult?.matches) {  
38 - // this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL  
39 - // } else {  
40 - // this.displayDirection = DisplayDirection.VERTICAL  
41 - // }  
42 - // WindowModel.shared.setMainWindowFullScreen(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL)  
43 - // }) 35 + this.listener?.on("change", (mediaQueryResult) => {
  36 + Logger.info(TAG, `change;${mediaQueryResult.matches}`)
  37 + if (mediaQueryResult?.matches) {
  38 + this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL
  39 + } else {
  40 + this.displayDirection = DisplayDirection.VERTICAL
  41 + }
  42 + WindowModel.shared.setMainWindowFullScreen(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL)
  43 + })
44 this.getLiveDetails() 44 this.getLiveDetails()
45 this.getLiveRoomData() 45 this.getLiveRoomData()
46 } 46 }
@@ -72,9 +72,8 @@ export struct DetailPlayLivePage { @@ -72,9 +72,8 @@ export struct DetailPlayLivePage {
72 72
73 onPageHideCus(): void { 73 onPageHideCus(): void {
74 Logger.info(TAG, `wyj-onPageHideCus`) 74 Logger.info(TAG, `wyj-onPageHideCus`)
75 - devicePLSensorManager.devicePLSensorOff();  
76 - // WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED);  
77 - this.playerController?.pause() 75 + this.listener.off('change');
  76 + // devicePLSensorManager.devicePLSensorOff();
78 } 77 }
79 78
80 onBackPressCus(): boolean | void { 79 onBackPressCus(): boolean | void {
@@ -86,9 +85,9 @@ export struct DetailPlayLivePage { @@ -86,9 +85,9 @@ export struct DetailPlayLivePage {
86 WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ? 85 WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
87 window.Orientation.PORTRAIT : 86 window.Orientation.PORTRAIT :
88 window.Orientation.LANDSCAPE) 87 window.Orientation.LANDSCAPE)
89 - devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ?  
90 - window.Orientation.PORTRAIT :  
91 - window.Orientation.LANDSCAPE); 88 + // devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ?
  89 + // window.Orientation.PORTRAIT :
  90 + // window.Orientation.LANDSCAPE);
92 return true 91 return true
93 } 92 }
94 93
@@ -83,9 +83,9 @@ export struct TabLiveItemComponent { @@ -83,9 +83,9 @@ export struct TabLiveItemComponent {
83 //图文 83 //图文
84 if (this.item.dataType === 'ZH_TEXT_AND_IMAGE_MSG') { 84 if (this.item.dataType === 'ZH_TEXT_AND_IMAGE_MSG') {
85 List({ space: this.item.pictureUrls.length == 1 ? 0 : 5 }) { 85 List({ space: this.item.pictureUrls.length == 1 ? 0 : 5 }) {
86 - ForEach(this.item.pictureUrls, (item: string, index: number) => { 86 + ForEach(this.item.pictureUrls, (itemSub: string, index: number) => {
87 ListItem() { 87 ListItem() {
88 - Image(item) 88 + Image(itemSub)
89 .width(`${100 / this.item.pictureUrls.length}%`) 89 .width(`${100 / this.item.pictureUrls.length}%`)
90 .height(this.item.pictureUrls.length > 1 ? 70 : 174) 90 .height(this.item.pictureUrls.length > 1 ? 70 : 174)
91 .objectFit(ImageFit.Auto) 91 .objectFit(ImageFit.Auto)
1 import { window } from '@kit.ArkUI' 1 import { window } from '@kit.ArkUI'
2 import { NumberFormatterUtils, WindowModel } from 'wdKit/Index' 2 import { NumberFormatterUtils, WindowModel } from 'wdKit/Index'
3 -import { devicePLSensorManager } from 'wdDetailPlayApi/Index'  
4 import { DateFormatUtil, WDPlayerController } from 'wdPlayer/Index' 3 import { DateFormatUtil, WDPlayerController } from 'wdPlayer/Index'
5 import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' 4 import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index'
6 import { DisplayDirection } from 'wdConstant/Index' 5 import { DisplayDirection } from 'wdConstant/Index'
@@ -69,9 +68,9 @@ export struct PlayUIComponent { @@ -69,9 +68,9 @@ export struct PlayUIComponent {
69 WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ? 68 WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
70 window.Orientation.PORTRAIT : 69 window.Orientation.PORTRAIT :
71 window.Orientation.LANDSCAPE) 70 window.Orientation.LANDSCAPE)
72 - devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ?  
73 - window.Orientation.PORTRAIT :  
74 - window.Orientation.LANDSCAPE); 71 + // devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ?
  72 + // window.Orientation.PORTRAIT :
  73 + // window.Orientation.LANDSCAPE);
75 }) 74 })
76 if (this.liveDetailsBean.liveInfo?.liveState != 'wait') { 75 if (this.liveDetailsBean.liveInfo?.liveState != 'wait') {
77 Text(this.liveDetailsBean.newsTitle) 76 Text(this.liveDetailsBean.newsTitle)
@@ -191,15 +190,12 @@ export struct PlayUIComponent { @@ -191,15 +190,12 @@ export struct PlayUIComponent {
191 190
192 @Builder 191 @Builder
193 getMiddleUIComponent() { 192 getMiddleUIComponent() {
194 - Stack() {  
195 - Text('播放功能暂时关闭')  
196 - .fontColor(Color.White)  
197 - }.alignContent(Alignment.Center)  
198 - .layoutWeight(1)  
199 - .width('100%')  
200 - .onClick(() => {  
201 - this.isMenuVisible = !this.isMenuVisible  
202 - }) 193 + Stack()
  194 + .layoutWeight(1)
  195 + .width('100%')
  196 + .onClick(() => {
  197 + this.isMenuVisible = !this.isMenuVisible
  198 + })
203 } 199 }
204 200
205 @Builder 201 @Builder
@@ -238,9 +234,9 @@ export struct PlayUIComponent { @@ -238,9 +234,9 @@ export struct PlayUIComponent {
238 WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ? 234 WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
239 window.Orientation.PORTRAIT : 235 window.Orientation.PORTRAIT :
240 window.Orientation.LANDSCAPE) 236 window.Orientation.LANDSCAPE)
241 - devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ?  
242 - window.Orientation.PORTRAIT :  
243 - window.Orientation.LANDSCAPE); 237 + // devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ?
  238 + // window.Orientation.PORTRAIT :
  239 + // window.Orientation.LANDSCAPE);
244 }) 240 })
245 } 241 }
246 } 242 }
@@ -13,7 +13,7 @@ export struct TopPlayComponent { @@ -13,7 +13,7 @@ export struct TopPlayComponent {
13 aboutToAppear(): void { 13 aboutToAppear(): void {
14 if (this.playerController) { 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 }
@@ -31,7 +31,7 @@ export struct TopPlayComponent { @@ -31,7 +31,7 @@ export struct TopPlayComponent {
31 } else if (this.liveDetailsBean.liveInfo.liveState == 'end') { 31 } else if (this.liveDetailsBean.liveInfo.liveState == 'end') {
32 playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri 32 playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri
33 } 33 }
34 - // this.playerController?.firstPlay(playUrl); 34 + this.playerController?.firstPlay(playUrl);
35 } 35 }
36 } 36 }
37 37
@@ -133,7 +133,7 @@ export struct DetailPlayShortVideoPage { @@ -133,7 +133,7 @@ export struct DetailPlayShortVideoPage {
133 aboutToAppear() { 133 aboutToAppear() {
134 this.videoLandScape = this.contentDetailData?.videoInfo[0]?.videoLandScape 134 this.videoLandScape = this.contentDetailData?.videoInfo[0]?.videoLandScape
135 this.playerController.onCanplay = () => { 135 this.playerController.onCanplay = () => {
136 - if (this.index == 0 || this.currentIndex === this.index) { 136 + if ((this.index == 0 || this.currentIndex === this.index) && this.switchVideoStatus) {
137 this.playerController.play() 137 this.playerController.play()
138 } 138 }
139 } 139 }
@@ -38,7 +38,7 @@ export struct VideoChannelDetail { @@ -38,7 +38,7 @@ export struct VideoChannelDetail {
38 // private recommend?: string = '' // 0.非推荐,1.推荐; 38 // private recommend?: string = '' // 0.非推荐,1.推荐;
39 @Link @Watch('navIndexChange') bottomNavIndex: number 39 @Link @Watch('navIndexChange') bottomNavIndex: number
40 @Link @Watch('navIndexChange') topNavIndex: number 40 @Link @Watch('navIndexChange') topNavIndex: number
41 - @Link barBackgroundColor: Color 41 + @Consume barBackgroundColor: Color
42 private swiperController: SwiperController = new SwiperController() 42 private swiperController: SwiperController = new SwiperController()
43 @Provide showComment: boolean = false 43 @Provide showComment: boolean = false
44 @Provide windowWidth: number = AppStorage.get<number>('windowWidth') || 0 44 @Provide windowWidth: number = AppStorage.get<number>('windowWidth') || 0
@@ -72,11 +72,11 @@ export struct VideoChannelDetail { @@ -72,11 +72,11 @@ export struct VideoChannelDetail {
72 navIndexChange() { 72 navIndexChange() {
73 console.log('navIndexChange', this.bottomNavIndex, this.topNavIndex) 73 console.log('navIndexChange', this.bottomNavIndex, this.topNavIndex)
74 if (this.bottomNavIndex === 2 && this.topNavIndex === 0) { 74 if (this.bottomNavIndex === 2 && this.topNavIndex === 0) {
75 - this.barBackgroundColor = Color.Black 75 + // this.barBackgroundColor = Color.Black
76 this.switchVideoStatus = true 76 this.switchVideoStatus = true
77 this.openFullScreen() 77 this.openFullScreen()
78 } else { 78 } else {
79 - this.barBackgroundColor = Color.Transparent 79 + // this.barBackgroundColor = Color.Transparent
80 this.switchVideoStatus = false 80 this.switchVideoStatus = false
81 this.closeFullScreen() 81 this.closeFullScreen()
82 } 82 }
@@ -12,9 +12,14 @@ import { WDPlayerController } from 'wdPlayer/Index'; @@ -12,9 +12,14 @@ import { WDPlayerController } from 'wdPlayer/Index';
12 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 12 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
13 import { SpConstants } from 'wdConstant/Index' 13 import { SpConstants } from 'wdConstant/Index'
14 14
  15 +interface ILikeStyleResp {
  16 + url: Resource;
  17 + name: string;
  18 +}
15 19
16 const TAG = 'PlayerRightView'; 20 const TAG = 'PlayerRightView';
17 21
  22 +
18 //视频点播页右侧操作栏:点赞/收藏/评论/分享 竖着排列 23 //视频点播页右侧操作栏:点赞/收藏/评论/分享 竖着排列
19 @Component 24 @Component
20 export struct PlayerRightView { 25 export struct PlayerRightView {
@@ -210,15 +215,26 @@ export struct PlayerRightView { @@ -210,15 +215,26 @@ export struct PlayerRightView {
210 /** 215 /**
211 * 将点赞样式转换为icon 216 * 将点赞样式转换为icon
212 */ 217 */
213 - transLikeStyle2Icon(): Resource { 218 + transLikeStyle(): ILikeStyleResp {
214 if (this.likesStyle === 1) { 219 if (this.likesStyle === 1) {
215 - return this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_like_check`) : $r(`app.media.ic_like_uncheck`) 220 + return {
  221 + url: this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_like_check`) : $r(`app.media.ic_like_uncheck`),
  222 + name: '点赞'
  223 + }
216 } else if (this.likesStyle === 2) { 224 } else if (this.likesStyle === 2) {
217 - return this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_thub_check`) : $r(`app.media.ic_thub_uncheck`) 225 + return {
  226 + url: this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_thub_check`) : $r(`app.media.ic_thub_uncheck`),
  227 + name: '祈祷'
  228 + }
218 } else if (this.likesStyle === 3) { 229 } else if (this.likesStyle === 3) {
219 - return this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_candle_check`) : $r(`app.media.ic_candle_uncheck`) 230 + return {
  231 + url: this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_candle_check`) : $r(`app.media.ic_candle_uncheck`),
  232 + name: '默哀'
  233 + }
  234 + }
  235 + return {
  236 + url: $r(`app.media.icon_like_ckeck`), name: '点赞'
220 } 237 }
221 - return $r(`app.media.icon_like_ckeck`)  
222 } 238 }
223 239
224 transNum2String(name: 'likeNum' | 'collectNum' | 'commentNum') { 240 transNum2String(name: 'likeNum' | 'collectNum' | 'commentNum') {
@@ -238,14 +254,14 @@ export struct PlayerRightView { @@ -238,14 +254,14 @@ export struct PlayerRightView {
238 @Builder 254 @Builder
239 likeBuilderView() { 255 likeBuilderView() {
240 Column() { 256 Column() {
241 - Image(this.transLikeStyle2Icon()) 257 + Image(this.transLikeStyle().url)
242 .width(32) 258 .width(32)
243 .aspectRatio(1) 259 .aspectRatio(1)
244 .onClick(() => { 260 .onClick(() => {
245 // TODO:点赞动画 261 // TODO:点赞动画
246 this.toggleLikeStatus() 262 this.toggleLikeStatus()
247 }) 263 })
248 - Text(this.transNum2String('likeNum') || '赞') 264 + Text(this.transNum2String('likeNum') || this.transLikeStyle().name)
249 .width('100%') 265 .width('100%')
250 .fontWeight(500) 266 .fontWeight(500)
251 .textAlign(TextAlign.Center) 267 .textAlign(TextAlign.Center)
@@ -253,6 +269,7 @@ export struct PlayerRightView { @@ -253,6 +269,7 @@ export struct PlayerRightView {
253 .fontColor('#FFFFFF') 269 .fontColor('#FFFFFF')
254 .maxLines(1) 270 .maxLines(1)
255 .textOverflow({ overflow: TextOverflow.Ellipsis }) 271 .textOverflow({ overflow: TextOverflow.Ellipsis })
  272 + .margin({ top: 2 })
256 } 273 }
257 .margin({ bottom: 20 }) 274 .margin({ bottom: 20 })
258 .visibility(this.likesStyle !== 4 ? Visibility.Visible : Visibility.None) 275 .visibility(this.likesStyle !== 4 ? Visibility.Visible : Visibility.None)
@@ -278,6 +295,7 @@ export struct PlayerRightView { @@ -278,6 +295,7 @@ export struct PlayerRightView {
278 .fontColor('#FFFFFF') 295 .fontColor('#FFFFFF')
279 .maxLines(1) 296 .maxLines(1)
280 .textOverflow({ overflow: TextOverflow.Ellipsis }) 297 .textOverflow({ overflow: TextOverflow.Ellipsis })
  298 + .margin({ top: 2 })
281 } 299 }
282 .margin({ bottom: 20 }) 300 .margin({ bottom: 20 })
283 } 301 }
@@ -302,6 +320,7 @@ export struct PlayerRightView { @@ -302,6 +320,7 @@ export struct PlayerRightView {
302 .fontColor('#FFFFFF') 320 .fontColor('#FFFFFF')
303 .maxLines(1) 321 .maxLines(1)
304 .textOverflow({ overflow: TextOverflow.Ellipsis }) 322 .textOverflow({ overflow: TextOverflow.Ellipsis })
  323 + .margin({ top: 2 })
305 } 324 }
306 .margin({ bottom: 20 }) 325 .margin({ bottom: 20 })
307 } 326 }
@@ -326,6 +345,7 @@ export struct PlayerRightView { @@ -326,6 +345,7 @@ export struct PlayerRightView {
326 .fontColor('#FFFFFF') 345 .fontColor('#FFFFFF')
327 .maxLines(1) 346 .maxLines(1)
328 .textOverflow({ overflow: TextOverflow.Ellipsis }) 347 .textOverflow({ overflow: TextOverflow.Ellipsis })
  348 + .margin({ top: 2 })
329 } 349 }
330 .margin({ bottom: 20 }) 350 .margin({ bottom: 20 })
331 } 351 }