yangsunyue_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool

# Conflicts:
#	sight_harmony/commons/wdKit/src/main/ets/utils/EmitterEventId.ts
Showing 64 changed files with 950 additions and 554 deletions
@@ -67,15 +67,15 @@ export const enum CompStyle { @@ -67,15 +67,15 @@ export const enum CompStyle {
67 67
68 68
69 69
70 - Card_Adv_4 = 4, //4:轮播图 5:三图广告 6:小图广告 7:长通栏广告 8:大图广告 9:视频广告 10:展会广告 11:冠名广告 12:顶部长通栏广告  
71 - Card_Adv_5 = 5,  
72 - Card_Adv_6 = 5,  
73 - Card_Adv_7 = 7,  
74 - Card_Adv_8 = 8,  
75 - Card_Adv_9 = 9,  
76 - Card_Adv_10 = 10,  
77 - Card_Adv_11 = 11,  
78 - Card_Adv_12 = 12, 70 + Card_Adv_4 = 4, //4:轮播图
  71 + Card_Adv_5 = 5, // 5:三图广告
  72 + Card_Adv_6 = 6, // 6:小图广告
  73 + Card_Adv_7 = 7, // 7:长通栏广告
  74 + Card_Adv_8 = 8, // 8:大图广告
  75 + Card_Adv_9 = 9, // 9:视频广告
  76 + Card_Adv_10 = 10, // 10:展会广告
  77 + Card_Adv_11 = 11, // 11:冠名广告
  78 + Card_Adv_12 = 12, // 12:顶部长通栏广告
79 79
80 /** 80 /**
81 * 本地稿件和组件样式 81 * 本地稿件和组件样式
@@ -14,5 +14,12 @@ export enum EmitterEventId { @@ -14,5 +14,12 @@ export enum EmitterEventId {
14 LOCATION = 5, 14 LOCATION = 5,
15 /*发布评论*/ 15 /*发布评论*/
16 COMMENT_PUBLISH = 6, 16 COMMENT_PUBLISH = 6,
  17 +
  18 + // App回到前台
  19 + APP_ENTER_FOREGROUD = 100,
  20 + // App进入后台
  21 + APP_ENTER_BACKGROUD = 101,
  22 +
  23 +
17 } 24 }
18 25
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 +}
@@ -5,3 +5,5 @@ export { WDRouterPage } from './src/main/ets/router/WDRouterPage' @@ -5,3 +5,5 @@ export { WDRouterPage } from './src/main/ets/router/WDRouterPage'
5 export { registerRouter } from './src/main/ets/router/Action2Page' 5 export { registerRouter } from './src/main/ets/router/Action2Page'
6 6
7 export { ProcessUtils } from './src/main/ets/utils/ProcessUtils' 7 export { ProcessUtils } from './src/main/ets/utils/ProcessUtils'
  8 +
  9 +export { RouterJumpInterceptor, JumpInterceptorAction } from './src/main/ets/router/RouterJumpInterceptor'
  1 +import { WDRouterPage } from './WDRouterPage';
  2 +
  3 +export interface JumpInterceptorAction {
  4 + on(params?: object, singleMode?: boolean): boolean
  5 +}
  6 +
  7 +// TODO:待优化
  8 +// 临时解决跳转页面之前方法拦截,比如登录先走一键登录,直播请求接口等
  9 +//
  10 +export class RouterJumpInterceptor {
  11 +
  12 + private static actions: Record<string, JumpInterceptorAction> = {}
  13 +
  14 + static getInterceptorAction(jumpPage: WDRouterPage): JumpInterceptorAction | undefined {
  15 + return RouterJumpInterceptor.actions[jumpPage.url()]
  16 + }
  17 +
  18 + static register(jumpPage: WDRouterPage, interceptorAction: JumpInterceptorAction) {
  19 + RouterJumpInterceptor.actions[jumpPage.url()] = interceptorAction
  20 + }
  21 +
  22 +
  23 +}
@@ -66,6 +66,7 @@ export class WDRouterPage { @@ -66,6 +66,7 @@ export class WDRouterPage {
66 // 动态详情页 66 // 动态详情页
67 static dynamicDetailPage = new WDRouterPage("phone", "ets/pages/detail/DynamicDetailPage"); 67 static dynamicDetailPage = new WDRouterPage("phone", "ets/pages/detail/DynamicDetailPage");
68 static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); 68 static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage");
  69 + static oneKeyLoginPage = new WDRouterPage("wdLogin", "ets/pages/login/OneKeyLoginPage");
69 static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); 70 static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage");
70 //我的 预约 71 //我的 预约
71 static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage"); 72 static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage");
@@ -3,6 +3,7 @@ import { Action } from 'wdBean' @@ -3,6 +3,7 @@ import { Action } from 'wdBean'
3 import { ToastUtils } from 'wdKit' 3 import { ToastUtils } from 'wdKit'
4 import { Action2Page } from './Action2Page' 4 import { Action2Page } from './Action2Page'
5 import { WDRouterPage } from './WDRouterPage' 5 import { WDRouterPage } from './WDRouterPage'
  6 +import { RouterJumpInterceptor } from './RouterJumpInterceptor'
6 7
7 export class WDRouterRule { 8 export class WDRouterRule {
8 static jumpWithAction(action?: Action) { 9 static jumpWithAction(action?: Action) {
@@ -16,6 +17,11 @@ export class WDRouterRule { @@ -16,6 +17,11 @@ export class WDRouterRule {
16 17
17 static jumpWithPage(page?: WDRouterPage, params?: object, singleMode?: boolean) { 18 static jumpWithPage(page?: WDRouterPage, params?: object, singleMode?: boolean) {
18 if (page) { 19 if (page) {
  20 + let action = RouterJumpInterceptor.getInterceptorAction(page)
  21 + if (action && action.on(params, singleMode)) {
  22 + return
  23 + }
  24 +
19 let mode = router.RouterMode.Standard 25 let mode = router.RouterMode.Standard
20 if (singleMode) { 26 if (singleMode) {
21 mode = router.RouterMode.Single 27 mode = router.RouterMode.Single
@@ -36,6 +42,10 @@ export class WDRouterRule { @@ -36,6 +42,10 @@ export class WDRouterRule {
36 42
37 static jumpWithReplacePage(page?: WDRouterPage, params?: object) { 43 static jumpWithReplacePage(page?: WDRouterPage, params?: object) {
38 if (page) { 44 if (page) {
  45 + let action = RouterJumpInterceptor.getInterceptorAction(page)
  46 + if (action && action.on(params)) {
  47 + return
  48 + }
39 if (params) { 49 if (params) {
40 // router.pushUrl({ url: 'pages/routerpage2', , params: params }) 50 // router.pushUrl({ url: 'pages/routerpage2', , params: params })
41 router.replaceUrl({ url: page.url(), params: params }) 51 router.replaceUrl({ url: page.url(), params: params })
@@ -17,7 +17,7 @@ const TAG = 'ProcessUtils'; @@ -17,7 +17,7 @@ const TAG = 'ProcessUtils';
17 */ 17 */
18 export class ProcessUtils { 18 export class ProcessUtils {
19 /** 19 /**
20 - * 广告中心的业务广告跳转方法( 现用在挂角广告) 20 + * 广告中心的业务广告跳转方法( 现用在挂角广告、信息流页面广告
21 * @param advContent 21 * @param advContent
22 */ 22 */
23 static openAdvDetail(matInfo: CompAdvMatInfoBean) { 23 static openAdvDetail(matInfo: CompAdvMatInfoBean) {
@@ -157,7 +157,7 @@ export class ProcessUtils { @@ -157,7 +157,7 @@ export class ProcessUtils {
157 * 图集详情页 157 * 图集详情页
158 * @param content 158 * @param content
159 * */ 159 * */
160 - public static gotoMultiPictureListPage(photoList: PhotoListBean[], swiperIndex?:number) { 160 + public static gotoMultiPictureListPage(photoList: PhotoListBean[], swiperIndex?: number) {
161 let taskAction: Action = { 161 let taskAction: Action = {
162 type: 'JUMP_DETAIL_PAGE', 162 type: 'JUMP_DETAIL_PAGE',
163 params: { 163 params: {
@@ -187,8 +187,14 @@ export class ProcessUtils { @@ -187,8 +187,14 @@ export class ProcessUtils {
187 let taskAction: Action = { 187 let taskAction: Action = {
188 type: 'JUMP_INNER_NEW_PAGE', 188 type: 'JUMP_INNER_NEW_PAGE',
189 params: { 189 params: {
  190 + contentID: content?.objectId,
190 url: content.linkUrl, 191 url: content.linkUrl,
191 pageID: 'SPACIAL_TOPIC_PAGE', 192 pageID: 'SPACIAL_TOPIC_PAGE',
  193 + extra: {
  194 + relType: content?.relType,
  195 + relId: content?.relId,
  196 + channelId: content?.channelId,
  197 + } as ExtraDTO
192 } as Params, 198 } as Params,
193 }; 199 };
194 WDRouterRule.jumpWithAction(taskAction) 200 WDRouterRule.jumpWithAction(taskAction)
@@ -423,11 +429,10 @@ export class ProcessUtils { @@ -423,11 +429,10 @@ export class ProcessUtils {
423 429
424 /** 430 /**
425 * 跳转人民号主页 431 * 跳转人民号主页
426 - *@params creatorId 创作者id 432 + * @params creatorId 创作者id
427 */ 433 */
428 public static gotoPeopleShipHomePage(creatorId: string) { 434 public static gotoPeopleShipHomePage(creatorId: string) {
429 - let params = {'creatorId': creatorId} as Record<string, string>; 435 + let params = { 'creatorId': creatorId } as Record<string, string>;
430 WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) 436 WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
431 } 437 }
432 -  
433 } 438 }
1 -import HashMap from '@ohos.util.HashMap';  
2 import { Callback } from 'wdJsBridge'; 1 import { Callback } from 'wdJsBridge';
3 import { Message, IImgListData } from 'wdJsBridge/src/main/ets/bean/Message'; 2 import { Message, IImgListData } from 'wdJsBridge/src/main/ets/bean/Message';
4 -import { Logger } from 'wdKit'; 3 +import { Logger, SPHelper } from 'wdKit';
5 import { H5CallNativeType } from './H5CallNativeType'; 4 import { H5CallNativeType } from './H5CallNativeType';
6 import { H5OperateType } from './H5OperateType'; 5 import { H5OperateType } from './H5OperateType';
7 -import { ContentConstants } from 'wdConstant'; 6 +import { ContentConstants, SpConstants } from 'wdConstant';
8 import { ProcessUtils } from 'wdRouter'; 7 import { ProcessUtils } from 'wdRouter';
9 import router from '@ohos.router'; 8 import router from '@ohos.router';
10 import Url from '@ohos.url' 9 import Url from '@ohos.url'
11 import { ContentDTO, PhotoListBean } from 'wdBean'; 10 import { ContentDTO, PhotoListBean } from 'wdBean';
12 -import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork'; 11 +import { handleJsCallAppService } from './JsCallAppService'
13 12
14 const TAG = 'JsBridgeBiz' 13 const TAG = 'JsBridgeBiz'
15 14
@@ -20,6 +19,19 @@ class AppInfo { @@ -20,6 +19,19 @@ class AppInfo {
20 // TODO 完善 19 // TODO 完善
21 } 20 }
22 21
  22 +class AppLoginAuthInfo {
  23 + "X-Ca-Stage": string = ''
  24 + userType: number = SPHelper.default.getSync(SpConstants.USER_Type, '') as number
  25 + userName: string = SPHelper.default.getSync(SpConstants.USER_NAME, '') as string
  26 + userID: string = SPHelper.default.getSync(SpConstants.USER_ID, '') as string
  27 + "RMRB-X-TOKEN": string = SPHelper.default.getSync(SpConstants.USER_TEMP_TOKEN, '') as string
  28 + phoneNumber: string = SPHelper.default.getSync(SpConstants.USER_PHONE, '') as string
  29 + nickName: string = ''
  30 + isLogined: string = SPHelper.default.getSync(SpConstants.USER_STATUS, '') as string
  31 + creatorID: string = SPHelper.default.getSync(SpConstants.USER_CREATOR_ID, '') as string
  32 + Authorization: string = ''
  33 +}
  34 +
23 /** 35 /**
24 * h5调用native代码 36 * h5调用native代码
25 * @param data 37 * @param data
@@ -39,7 +51,7 @@ export function performJSCallNative(data: Message, call: Callback) { @@ -39,7 +51,7 @@ export function performJSCallNative(data: Message, call: Callback) {
39 case H5CallNativeType.jsCall_getArticleDetailBussinessData: 51 case H5CallNativeType.jsCall_getArticleDetailBussinessData:
40 break; 52 break;
41 case H5CallNativeType.jsCall_callAppService: 53 case H5CallNativeType.jsCall_callAppService:
42 - handleJsCallCallAppService(data, (res: string) => { 54 + handleJsCallAppService(data, (res: string) => {
43 call(res) 55 call(res)
44 }) 56 })
45 break; 57 break;
@@ -49,6 +61,9 @@ export function performJSCallNative(data: Message, call: Callback) { @@ -49,6 +61,9 @@ export function performJSCallNative(data: Message, call: Callback) {
49 case H5CallNativeType.jsCall_appInnerLinkMethod: 61 case H5CallNativeType.jsCall_appInnerLinkMethod:
50 handleJsCallAppInnerLinkMethod(data) 62 handleJsCallAppInnerLinkMethod(data)
51 break; 63 break;
  64 + case H5CallNativeType.jsCall_getAppLoginAuthInfo:
  65 + call(handleJsCallGetAppLoginAuthInfo())
  66 + break;
52 default: 67 default:
53 break; 68 break;
54 } 69 }
@@ -64,21 +79,6 @@ function handleJsCallCurrentPageOperate(data: Message) { @@ -64,21 +79,6 @@ function handleJsCallCurrentPageOperate(data: Message) {
64 } 79 }
65 } 80 }
66 81
67 -function handleJsCallCallAppService(data: Message, callback: (res: string) => void) {  
68 - let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();  
69 - let url: string = HttpUrlUtils.getHost() + data?.data?.url  
70 - if (data?.data?.method === 'get') {  
71 - WDHttp.get<ResponseDTO<string>>(url, headers).then((res: ResponseDTO<string>) => {  
72 - callback(JSON.stringify(res))  
73 - })  
74 - }  
75 - if (data?.data?.method === 'post') {  
76 - WDHttp.post<ResponseDTO<string>>(url, data?.data?.parameters, headers).then(res => {  
77 - callback(JSON.stringify(res))  
78 - })  
79 - }  
80 -}  
81 -  
82 /** 82 /**
83 * 获取App公共信息 83 * 获取App公共信息
84 */ 84 */
@@ -90,12 +90,11 @@ function getAppPublicInfo(): string { @@ -90,12 +90,11 @@ function getAppPublicInfo(): string {
90 info.networkStatus = 1 90 info.networkStatus = 1
91 let result = JSON.stringify(info) 91 let result = JSON.stringify(info)
92 Logger.debug(TAG, 'getAppPublicInfo: ' + JSON.stringify(info)) 92 Logger.debug(TAG, 'getAppPublicInfo: ' + JSON.stringify(info))
93 -  
94 return result; 93 return result;
95 } 94 }
96 95
97 function handleJsCallReceiveH5Data(data: Message) { 96 function handleJsCallReceiveH5Data(data: Message) {
98 - switch (data?.data?.dataSource) { 97 + switch (String(data?.data?.dataSource)) {
99 case '3': 98 case '3':
100 let imgListData: IImgListData = JSON.parse(data?.data?.imgListData || "{}") 99 let imgListData: IImgListData = JSON.parse(data?.data?.imgListData || "{}")
101 let imgArr = imgListData?.imgArr || [] 100 let imgArr = imgListData?.imgArr || []
@@ -110,7 +109,7 @@ function handleJsCallReceiveH5Data(data: Message) { @@ -110,7 +109,7 @@ function handleJsCallReceiveH5Data(data: Message) {
110 } 109 }
111 return photo 110 return photo
112 }) 111 })
113 - ProcessUtils.gotoMultiPictureListPage(photoList,swiperIndex) 112 + ProcessUtils.gotoMultiPictureListPage(photoList, swiperIndex)
114 } 113 }
115 break; 114 break;
116 case '5': 115 case '5':
@@ -183,3 +182,9 @@ function handleJsCallAppInnerLinkMethod(data: Message) { @@ -183,3 +182,9 @@ function handleJsCallAppInnerLinkMethod(data: Message) {
183 } 182 }
184 } 183 }
185 } 184 }
  185 +
  186 +function handleJsCallGetAppLoginAuthInfo() {
  187 + let appLoginAuthInfo = new AppLoginAuthInfo()
  188 + let result = JSON.stringify(appLoginAuthInfo)
  189 + return result;
  190 +}
  1 +import HashMap from '@ohos.util.HashMap';
  2 +import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
  3 +import { H5ReceiveDataJsonBean, postBatchAttentionStatusResult } from 'wdBean';
  4 +import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork';
  5 +
  6 +const TAG = 'JsCallAppService'
  7 +
  8 +
  9 +export function handleJsCallAppService(data: Message, callback: (res: string) => void) {
  10 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  11 + let url: string = HttpUrlUtils.getHost() + data?.data?.url
  12 +
  13 + let responseMap: ResponseDTO<postBatchAttentionStatusResult> = {} as ResponseDTO<postBatchAttentionStatusResult>
  14 +
  15 + let h5ReceiveDataJson: H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>> = {
  16 + netError: '0',
  17 + responseMap
  18 + } as H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>>
  19 +
  20 + // if (data?.data?.method === 'get') {
  21 + // WDHttp.get<ResponseDTO<postBatchAttentionStatusResult>>(url, headers).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {
  22 + // callback(JSON.stringify(res))
  23 + // })
  24 + // }
  25 + if (data?.data?.method === 'post' && data?.data?.url === '/api/rmrb-interact/interact/zh/c/batchAttention/status') {
  26 + WDHttp.post<ResponseDTO<postBatchAttentionStatusResult>>(url, data?.data?.parameters, headers).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {
  27 + h5ReceiveDataJson.responseMap = res
  28 + callback(JSON.stringify(h5ReceiveDataJson))
  29 + })
  30 + }
  31 +}
@@ -8,4 +8,5 @@ export interface commentInfo { @@ -8,4 +8,5 @@ export interface commentInfo {
8 newsId: string, 8 newsId: string,
9 relId: string; 9 relId: string;
10 relType: string; 10 relType: string;
  11 + userId: string;
11 } 12 }
1 export interface H5ReceiveDataExtraBean { 1 export interface H5ReceiveDataExtraBean {
2 creatorId: string; 2 creatorId: string;
  3 + cnsTraceId: string;
3 isLogin: string; 4 isLogin: string;
  5 + loadImageOnlyWifiSwitch: string;
4 networkStatus: number; 6 networkStatus: number;
5 - loadImageOnlyWifiSwitch: string 7 + darkMode: string;
  8 + fontSizes: string;
6 } 9 }
1 import { ResponseBean } from './ResponseBean'; 1 import { ResponseBean } from './ResponseBean';
2 2
3 -export interface H5ReceiveDataJsonBean {  
4 - contentId: string;  
5 - contentType: string;  
6 - topicId: string;  
7 - channelId: string;  
8 - compId: string;  
9 - sourcePage: string; 3 +export interface H5ReceiveDataJsonBean<T = ResponseBean> {
  4 + contentId?: string;
  5 + contentType?: string;
  6 + topicId?: string;
  7 + channelId?: string;
  8 + compId?: string;
  9 + sourcePage?: string;
10 netError: string; 10 netError: string;
11 - responseMap: ResponseBean; 11 + responseMap: T;
12 12
13 } 13 }
1 import { ContentDetailDTO } from '../detail/ContentDetailDTO'; 1 import { ContentDetailDTO } from '../detail/ContentDetailDTO';
2 2
3 -export interface ResponseBean{  
4 - success:boolean; 3 +export interface ResponseBean<T = ContentDetailDTO[]> {
  4 + success: boolean;
5 5
6 // 服务请求响应值/微服务响应状态码” 6 // 服务请求响应值/微服务响应状态码”
7 code: number; 7 code: number;
@@ -10,8 +10,7 @@ export interface ResponseBean{ @@ -10,8 +10,7 @@ export interface ResponseBean{
10 message: string; 10 message: string;
11 11
12 // 响应结果 12 // 响应结果
13 - data:ContentDetailDTO[];  
14 - 13 + data: T
15 // 请求响应时间戳(unix格式) 14 // 请求响应时间戳(unix格式)
16 timestamp?: number; 15 timestamp?: number;
17 } 16 }
@@ -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 }
@@ -24,7 +24,6 @@ import { ZhGridLayout02 } from './compview/ZhGridLayout02'; @@ -24,7 +24,6 @@ import { ZhGridLayout02 } from './compview/ZhGridLayout02';
24 import { Card2Component } from './cardview/Card2Component'; 24 import { Card2Component } from './cardview/Card2Component';
25 import { Card5Component } from './cardview/Card5Component'; 25 import { Card5Component } from './cardview/Card5Component';
26 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 26 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
27 -import { CardAdvComponent } from './cardViewAdv/CardAdvComponent';  
28 import { AdvCardParser } from './cardViewAdv/AdvCardParser'; 27 import { AdvCardParser } from './cardViewAdv/AdvCardParser';
29 28
30 /** 29 /**
@@ -13,7 +13,6 @@ import { @@ -13,7 +13,6 @@ import {
13 import DetailViewModel from '../viewmodel/DetailViewModel'; 13 import DetailViewModel from '../viewmodel/DetailViewModel';
14 import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; 14 import { ImageAndTextWebComponent } from './ImageAndTextWebComponent';
15 import { OperRowListView } from './view/OperRowListView'; 15 import { OperRowListView } from './view/OperRowListView';
16 -import router from '@ohos.router';  
17 import { RecommendList } from '../components/view/RecommendList' 16 import { RecommendList } from '../components/view/RecommendList'
18 import { CommonConstants } from 'wdConstant'; 17 import { CommonConstants } from 'wdConstant';
19 import { HttpUrlUtils } from 'wdNetwork/Index'; 18 import { HttpUrlUtils } from 'wdNetwork/Index';
@@ -21,10 +20,11 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; @@ -21,10 +20,11 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
21 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 20 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
22 import { PageRepository } from '../repository/PageRepository'; 21 import { PageRepository } from '../repository/PageRepository';
23 import { detailedSkeleton } from './skeleton/detailSkeleton'; 22 import { detailedSkeleton } from './skeleton/detailSkeleton';
  23 +import { CommentComponent } from '../components/comment/view/CommentComponent'
24 24
25 const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; 25 const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
26 26
27 -const TAG = 'ImageAndTextPageComponent' 27 +const TAG: string = 'ImageAndTextPageComponent'
28 28
29 @Component 29 @Component
30 export struct ImageAndTextPageComponent { 30 export struct ImageAndTextPageComponent {
@@ -75,9 +75,55 @@ export struct ImageAndTextPageComponent { @@ -75,9 +75,55 @@ export struct ImageAndTextPageComponent {
75 isPageEnd: $isPageEnd 75 isPageEnd: $isPageEnd
76 }) 76 })
77 Column() { 77 Column() {
  78 + // 点赞
  79 + if (this.contentDetailData[0]?.openLikes) {
  80 + Row() {
  81 + Row() {
  82 + if (this.newsStatusOfUser?.likeStatus === '1') {
  83 + Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : $r('app.media.icon_candle_active')))
  84 + .width(24)
  85 + .height(24)
  86 + .margin({ right: 5 })
  87 + } else {
  88 + Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : $r('app.media.icon_candle')))
  89 + .width(24)
  90 + .height(24)
  91 + .margin({ right: 5 })
  92 + }
  93 + if(this.interactData?.likeNum !== '0'){
  94 + Text(`${this.interactData?.likeNum}`)
  95 + .fontSize(16)
  96 + .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')
  97 + .fontWeight(500)
  98 + }
  99 + }
  100 + .width(140)
  101 + .height(36)
  102 + .justifyContent(FlexAlign.Center)
  103 + .alignItems(VerticalAlign.Center)
  104 + .borderRadius(20)
  105 + .border({
  106 + width: 1,
  107 + color: '#EDEDED',
  108 + })
  109 + .onClick(() => {
  110 + this.toggleLikeStatus()
  111 + })
  112 +
  113 + }.width(CommonConstants.FULL_WIDTH).height(80)
  114 + .justifyContent(FlexAlign.Center)
  115 +
  116 + Divider().strokeWidth(6).color('#f5f5f5')
  117 + }
78 if (this.recommendList.length > 0) { 118 if (this.recommendList.length > 0) {
79 RecommendList({ recommendList: this.recommendList }) 119 RecommendList({ recommendList: this.recommendList })
80 } 120 }
  121 + // 评论
  122 + if(this.contentDetailData[0]?.openComment){
  123 + // CommentComponent({
  124 + //
  125 + // })
  126 + }
81 } 127 }
82 } 128 }
83 129
@@ -95,42 +141,6 @@ export struct ImageAndTextPageComponent { @@ -95,42 +141,6 @@ export struct ImageAndTextPageComponent {
95 if (this.contentDetailData?.length) { 141 if (this.contentDetailData?.length) {
96 OperRowListView({contentDetailData: this.contentDetailData[0]}) 142 OperRowListView({contentDetailData: this.contentDetailData[0]})
97 } 143 }
98 - /* Row() {  
99 - Image($r('app.media.icon_arrow_left'))  
100 - .width(24)  
101 - .height(24)  
102 - .onClick((event: ClickEvent) => {  
103 - router.back()  
104 - })  
105 -  
106 - Row() {  
107 - Image($r('app.media.icon_comment'))  
108 - .width(24)  
109 - .height(24)  
110 - .margin({ right: 24 })  
111 - .id('comment')  
112 -  
113 - Image($r('app.media.icon_star'))  
114 - .width(24)  
115 - .height(24)  
116 - .margin({ right: 24 })  
117 -  
118 - Image($r('app.media.icon_listen'))  
119 - .width(24)  
120 - .height(24)  
121 - .margin({ right: 24 })  
122 -  
123 - Image($r('app.media.icon_forward'))  
124 - .width(24)  
125 - .height(24)  
126 -  
127 - }  
128 - }  
129 - .width(CommonConstants.FULL_WIDTH)  
130 - .height(56)  
131 - .padding({ left: 15, right: 15, bottom: 50, top: 20 })  
132 - .justifyContent(FlexAlign.SpaceBetween)  
133 - .backgroundColor(Color.White)*/  
134 } 144 }
135 145
136 } 146 }
@@ -12,6 +12,7 @@ import { WdWebLocalComponent } from 'wdWebComponent'; @@ -12,6 +12,7 @@ import { WdWebLocalComponent } from 'wdWebComponent';
12 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; 12 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type';
13 import { BridgeWebViewControl } from 'wdJsBridge/Index'; 13 import { BridgeWebViewControl } from 'wdJsBridge/Index';
14 14
  15 +const TAG: string = 'ImageAndTextWebComponent'
15 @Component 16 @Component
16 export struct ImageAndTextWebComponent { 17 export struct ImageAndTextWebComponent {
17 action: Action = {} as Action 18 action: Action = {} as Action
@@ -60,9 +61,12 @@ export struct ImageAndTextWebComponent { @@ -60,9 +61,12 @@ export struct ImageAndTextWebComponent {
60 // TODO 对接user信息、登录情况 61 // TODO 对接user信息、登录情况
61 let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { 62 let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = {
62 creatorId: creatorId, 63 creatorId: creatorId,
  64 + cnsTraceId: '',
63 isLogin: isLogin, 65 isLogin: isLogin,
64 - networkStatus: Number(NetworkUtil.isNetConnected()),  
65 loadImageOnlyWifiSwitch: '2', 66 loadImageOnlyWifiSwitch: '2',
  67 + networkStatus: Number(NetworkUtil.isNetConnected()),
  68 + darkMode: 'light',
  69 + fontSizes: 'normalsize'
66 70
67 } as H5ReceiveDataExtraBean 71 } as H5ReceiveDataExtraBean
68 let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = { 72 let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = {
@@ -83,7 +87,6 @@ export struct ImageAndTextWebComponent { @@ -83,7 +87,6 @@ export struct ImageAndTextWebComponent {
83 this.h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean 87 this.h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean
84 this.dataPrepared = true 88 this.dataPrepared = true
85 this.trySendData2H5() 89 this.trySendData2H5()
86 -  
87 } 90 }
88 91
89 } 92 }
@@ -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();
1 -import { Action, H5ReceiveDetailBean } from 'wdBean'; 1 +import { Action, H5ReceiveDetailBean, ContentDetailDTO } from 'wdBean';
2 import { WdWebComponent } from 'wdWebComponent'; 2 import { WdWebComponent } from 'wdWebComponent';
3 import router from '@ohos.router'; 3 import router from '@ohos.router';
4 import { CommonConstants } from 'wdConstant' 4 import { CommonConstants } from 'wdConstant'
5 import { BridgeWebViewControl } from 'wdJsBridge/Index'; 5 import { BridgeWebViewControl } from 'wdJsBridge/Index';
6 import { detailedSkeleton } from './skeleton/detailSkeleton' 6 import { detailedSkeleton } from './skeleton/detailSkeleton'
7 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; 7 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type';
8 -const TAG = 'SpacialTopicPageComponent' 8 +import { OperRowListView } from './view/OperRowListView';
  9 +import DetailViewModel from '../viewmodel/DetailViewModel';
  10 +
  11 +const TAG: string = 'SpacialTopicPageComponent'
9 12
10 @Component 13 @Component
11 export struct SpacialTopicPageComponent { 14 export struct SpacialTopicPageComponent {
@@ -14,6 +17,7 @@ export struct SpacialTopicPageComponent { @@ -14,6 +17,7 @@ export struct SpacialTopicPageComponent {
14 action: Action = {} as Action 17 action: Action = {} as Action
15 @State webUrl: string = ''; 18 @State webUrl: string = '';
16 @State isPageEnd: boolean = false 19 @State isPageEnd: boolean = false
  20 + @State contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO []
17 private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean 21 private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
18 private webPrepared = false; 22 private webPrepared = false;
19 private dataPrepared = false; 23 private dataPrepared = false;
@@ -37,11 +41,33 @@ export struct SpacialTopicPageComponent { @@ -37,11 +41,33 @@ export struct SpacialTopicPageComponent {
37 }) 41 })
38 } 42 }
39 43
  44 + private async getDetail() {
  45 + let contentId: string = ''
  46 + let relId: string = ''
  47 + let relType: string = ''
  48 + if (this.action && this.action.params) {
  49 + if (this.action.params.contentID) {
  50 + contentId = this.action.params.contentID;
  51 + }
  52 + if (this.action && this.action.params && this.action.params.extra) {
  53 + if (this.action.params.extra.relId) {
  54 + relId = this.action.params.extra.relId;
  55 + }
  56 + if (this.action.params.extra.relType) {
  57 + relType = this.action.params.extra.relType
  58 + }
  59 +
  60 + }
  61 + let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
  62 + if (detailBeans && detailBeans.length > 0) {
  63 + this.contentDetailData = detailBeans;
  64 + this.trySendData2H5()
  65 + }
  66 + }
  67 + }
  68 +
40 build() { 69 build() {
41 Column() { 70 Column() {
42 - if (!this.isPageEnd) {  
43 - detailedSkeleton()  
44 - }  
45 Stack({ alignContent: Alignment.Bottom }) { 71 Stack({ alignContent: Alignment.Bottom }) {
46 Column() { 72 Column() {
47 WdWebComponent({ 73 WdWebComponent({
@@ -52,62 +78,23 @@ export struct SpacialTopicPageComponent { @@ -52,62 +78,23 @@ export struct SpacialTopicPageComponent {
52 isPageEnd: $isPageEnd 78 isPageEnd: $isPageEnd
53 }) 79 })
54 } 80 }
55 - .padding({ bottom: 56 })  
56 .width(CommonConstants.FULL_WIDTH) 81 .width(CommonConstants.FULL_WIDTH)
57 .height(CommonConstants.FULL_HEIGHT) 82 .height(CommonConstants.FULL_HEIGHT)
  83 + .padding({ bottom: 126 })
58 84
59 - //底部交互区  
60 - Row() {  
61 - Image($r('app.media.icon_arrow_left'))  
62 - .width(24)  
63 - .height(24)  
64 - .onClick((event: ClickEvent) => {  
65 - router.back()  
66 - })  
67 -  
68 - Row() {  
69 - Image($r('app.media.icon_comment'))  
70 - .width(24)  
71 - .height(24)  
72 - .margin({ right: 24 })  
73 - .id('comment')  
74 -  
75 - Image($r('app.media.icon_star'))  
76 - .width(24)  
77 - .height(24)  
78 - .margin({ right: 24 })  
79 -  
80 - Image($r('app.media.icon_listen'))  
81 - .width(24)  
82 - .height(24)  
83 - .margin({ right: 24 })  
84 -  
85 - Image($r('app.media.icon_forward'))  
86 - .width(24)  
87 - .height(24)  
88 -  
89 - } 85 + if (!this.isPageEnd) {
  86 + detailedSkeleton()
90 } 87 }
91 - .width(CommonConstants.FULL_WIDTH)  
92 - .height(56)  
93 - .padding({ left: 15, right: 15, bottom: 20, top: 20 })  
94 - .justifyContent(FlexAlign.SpaceBetween)  
95 - .backgroundColor(Color.White)  
96 - 88 + //底部交互区
  89 + OperRowListView({ contentDetailData: this.contentDetailData[0] })
97 } 90 }
98 }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) 91 }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
99 - .backgroundColor(Color.White)  
100 } 92 }
101 93
102 aboutToAppear() { 94 aboutToAppear() {
103 - let action: Action = router.getParams() as Action  
104 - if (action) {  
105 - this.webUrl = action.params?.url || '' 95 + if (this.action) {
  96 + this.webUrl = this.action.params?.url || ''
106 } 97 }
107 - this.trySendData2H5()  
108 - }  
109 -  
110 - aboutToDisappear() {  
111 - 98 + this.getDetail()
112 } 99 }
113 } 100 }
1 import { CompStyle } from 'wdConstant'; 1 import { CompStyle } from 'wdConstant';
2 import { CompDTO } from 'wdBean'; 2 import { CompDTO } from 'wdBean';
3 -import { CardAdvComponent } from './CardAdvComponent';  
4 import { CardAdvThreeImageComponent } from './CardAdvThreeImageComponent'; 3 import { CardAdvThreeImageComponent } from './CardAdvThreeImageComponent';
5 import { CardAdvSmallImageComponent } from './CardAdvSmallImageComponent'; 4 import { CardAdvSmallImageComponent } from './CardAdvSmallImageComponent';
6 import { CardAdvLongImageComponent } from './CardAdvLongImageComponent'; 5 import { CardAdvLongImageComponent } from './CardAdvLongImageComponent';
@@ -22,12 +22,12 @@ export struct CardAdvBigImageComponent { @@ -22,12 +22,12 @@ export struct CardAdvBigImageComponent {
22 22
23 aboutToAppear(): void { 23 aboutToAppear(): void {
24 24
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----') 25 + console.error('ZZZXXXXX', '----大图卡----aboutToAppear-----')
26 } 26 }
27 27
28 aboutToDisappear(): void { 28 aboutToDisappear(): void {
29 29
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----') 30 + console.error('ZZZXXXXX', '---大图卡-----aboutToDisappear-----')
31 } 31 }
32 32
33 build() { 33 build() {
1 -//全标题 "appStyle":"2",  
2 -import { CompDTO, ContentDTO } from 'wdBean';  
3 -import { CommonConstants } from 'wdConstant/Index';  
4 -import { ProcessUtils } from 'wdRouter';  
5 -import { CardMediaInfo } from '../cardCommon/CardMediaInfo'  
6 -import { CardSourceInfo } from '../cardCommon/CardSourceInfo'  
7 -  
8 -const TAG: string = 'Card2Component';  
9 -  
10 -/**  
11 - * @Description: 类描述  
12 - * @Author:  
13 - * @Email: liyubing@wondertek.com.cn  
14 - * @CreateDate:  
15 - * @UpdateRemark: 更新说明  
16 - * @Version: 1.0  
17 - */  
18 -@Component  
19 -export struct CardAdvComponent {  
20 -  
21 - @State compDTO: CompDTO = {} as CompDTO  
22 -  
23 - aboutToAppear(): void {  
24 -  
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----')  
26 - }  
27 -  
28 - aboutToDisappear(): void {  
29 -  
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----')  
31 - }  
32 -  
33 - build() {  
34 -  
35 - Column() {  
36 - Text(this.compDTO.matInfo.advTitle)  
37 - .fontSize($r('app.float.font_size_17'))  
38 - .fontColor($r('app.color.color_222222'))  
39 - .maxLines(3)  
40 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
41 - .align(Alignment.Start)  
42 - }  
43 - .width(CommonConstants.FULL_WIDTH)  
44 - .padding({  
45 - left: $r('app.float.card_comp_pagePadding_lf'),  
46 - right: $r('app.float.card_comp_pagePadding_lf'),  
47 - top: $r('app.float.card_comp_pagePadding_tb'),  
48 - bottom: $r('app.float.card_comp_pagePadding_tb')  
49 - })  
50 - .onClick((event: ClickEvent) => {  
51 - //ProcessUtils.processPage(this.contentDTO)  
52 - })  
53 - }  
54 -}  
55 -  
56 -@Extend(Text)  
57 -function bottomTextStyle() {  
58 - .fontSize(12)  
59 - .fontColor('#B0B0B0')  
60 -}  
@@ -22,12 +22,12 @@ export struct CardAdvGanMiComponent { @@ -22,12 +22,12 @@ export struct CardAdvGanMiComponent {
22 22
23 aboutToAppear(): void { 23 aboutToAppear(): void {
24 24
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----') 25 + console.error('ZZZXXXXX', '--冠名广告------aboutToAppear-----')
26 } 26 }
27 27
28 aboutToDisappear(): void { 28 aboutToDisappear(): void {
29 29
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----') 30 + console.error('ZZZXXXXX', '--冠名广告------aboutToDisappear-----')
31 } 31 }
32 32
33 build() { 33 build() {
@@ -22,12 +22,12 @@ export struct CardAdvLongImageComponent { @@ -22,12 +22,12 @@ export struct CardAdvLongImageComponent {
22 22
23 aboutToAppear(): void { 23 aboutToAppear(): void {
24 24
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----') 25 + console.error('ZZZXXXXX', '--长通栏广告 和 顶部长通栏广告------aboutToAppear-----')
26 } 26 }
27 27
28 aboutToDisappear(): void { 28 aboutToDisappear(): void {
29 29
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----') 30 + console.error('ZZZXXXXX', '--长通栏广告 和 顶部长通栏广告------aboutToDisappear-----')
31 } 31 }
32 32
33 build() { 33 build() {
1 //全标题 "appStyle":"2", 1 //全标题 "appStyle":"2",
2 -import { CompDTO, ContentDTO } from 'wdBean';  
3 -import { CommonConstants } from 'wdConstant/Index'; 2 +import { CompDTO } from 'wdBean';
4 import { ProcessUtils } from 'wdRouter'; 3 import { ProcessUtils } from 'wdRouter';
5 -import { CardMediaInfo } from '../cardCommon/CardMediaInfo'  
6 -import { CardSourceInfo } from '../cardCommon/CardSourceInfo'  
7 -  
8 -const TAG: string = 'Card2Component';  
9 -  
10 -/**  
11 - * @Description: 广告---小图卡  
12 - * @Author:  
13 - * @Email: liyubing@wondertek.com.cn  
14 - * @CreateDate:  
15 - * @UpdateRemark: 更新说明  
16 - * @Version: 1.0 4 +
  5 +import measure from '@ohos.measure';
  6 +import { DisplayUtils } from 'wdKit/Index';
  7 +
  8 +const TAG: string = 'CardAdvSmallImageComponent';
  9 +
  10 +/**
  11 + * @Description: 广告---小图卡
  12 + * @Author:
  13 + * @Email: liyubing@wondertek.com.cn
  14 + * @CreateDate:
  15 + * @UpdateRemark: 更新说明
  16 + * @Version: 1.0
17 */ 17 */
18 @Component 18 @Component
19 export struct CardAdvSmallImageComponent { 19 export struct CardAdvSmallImageComponent {
20 -  
21 @State compDTO: CompDTO = {} as CompDTO 20 @State compDTO: CompDTO = {} as CompDTO
  21 + @State isBigThreeLine: boolean = false // 标题的行数大于等于3行 是true
22 22
23 aboutToAppear(): void { 23 aboutToAppear(): void {
24 24
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----') 25 + console.error('ZZZXXXXX', '----小图卡----aboutToAppear-----')
  26 + // 计算标题文本行数
  27 + let screenWith = DisplayUtils.getDeviceWidth();
  28 + screenWith = screenWith * 0.62
  29 + let titleNameLineNum = this.getTextLineNum(this.compDTO.matInfo.advTitle, screenWith, 25, 18)
  30 + this.isBigThreeLine = titleNameLineNum >= 3;
26 } 31 }
27 32
28 aboutToDisappear(): void { 33 aboutToDisappear(): void {
29 34
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----') 35 + console.error('ZZZXXXXX', '---小图卡-----aboutToDisappear-----')
31 } 36 }
32 37
33 build() { 38 build() {
34 39
35 - Column() { 40 + RelativeContainer() {
  41 +
  42 + // 广告标题
36 Text(this.compDTO.matInfo.advTitle) 43 Text(this.compDTO.matInfo.advTitle)
37 - .fontSize($r('app.float.font_size_17')) 44 + .fontSize('18fp')
38 .fontColor($r('app.color.color_222222')) 45 .fontColor($r('app.color.color_222222'))
39 .maxLines(3) 46 .maxLines(3)
  47 + .lineHeight(25)
40 .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 48 .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
41 - .align(Alignment.Start) 49 + .width('62%')
  50 + .alignRules({
  51 + top: { anchor: '__container__', align: VerticalAlign.Top },
  52 + left: { anchor: '__container__', align: HorizontalAlign.Start },
  53 + })
  54 + .id("title_name")
  55 + // 广告图
  56 + Image(this.compDTO.matInfo.matImageUrl[0])
  57 + .width('34%')
  58 + .aspectRatio(3 / 2)
  59 + .borderRadius(4)
  60 + .id('adv_imag')
  61 + .alignRules({
  62 + top: { anchor: 'title_name', align: VerticalAlign.Top },
  63 + left: { anchor: 'title_name', align: HorizontalAlign.End },
  64 +
  65 + })
  66 + .margin({ left: 12 })
  67 +
  68 + Row() {
  69 + Text($r('app.string.comp_advertisement')).fontSize('12fp').fontColor($r('app.color.color_B0B0B0'))
  70 +
  71 + Blank()
  72 +
  73 + Stack() {
  74 + Image($r('app.media.comp_adv_close'))
  75 + .width(9)
  76 + .height(9)
  77 + .borderRadius({
  78 + topLeft: '4vp',
  79 + topRight: '4vp',
  80 + bottomLeft: '4vp',
  81 + bottomRight: '4vp'
  82 + })
  83 + }
  84 + .width(18)
  85 + .height(14)
  86 + .borderWidth(0.5)
  87 + .borderColor($r('app.color.color_EDEDED'))
  88 + .borderRadius(4)
  89 +
  90 + }.width('62%').alignRules({
  91 + bottom: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: VerticalAlign.Bottom },
  92 + right: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: HorizontalAlign.Start },
  93 +
  94 + top: { anchor: this.isBigThreeLine ? 'title_name' : '', align: VerticalAlign.Bottom },
  95 + left: { anchor: this.isBigThreeLine ? 'title_name' : '', align: HorizontalAlign.Start },
  96 + }).id('bottom_adv').margin({
  97 + right: this.isBigThreeLine ? 0 : 12,
  98 + top: this.isBigThreeLine ? 8 : 0,
  99 + })
42 } 100 }
43 - .width(CommonConstants.FULL_WIDTH) 101 + .width("100%")
  102 + .height(this.isBigThreeLine ? 127 : 106)
44 .padding({ 103 .padding({
45 left: $r('app.float.card_comp_pagePadding_lf'), 104 left: $r('app.float.card_comp_pagePadding_lf'),
46 right: $r('app.float.card_comp_pagePadding_lf'), 105 right: $r('app.float.card_comp_pagePadding_lf'),
@@ -48,13 +107,31 @@ export struct CardAdvSmallImageComponent { @@ -48,13 +107,31 @@ export struct CardAdvSmallImageComponent {
48 bottom: $r('app.float.card_comp_pagePadding_tb') 107 bottom: $r('app.float.card_comp_pagePadding_tb')
49 }) 108 })
50 .onClick((event: ClickEvent) => { 109 .onClick((event: ClickEvent) => {
51 - //ProcessUtils.processPage(this.contentDTO) 110 + ProcessUtils.openAdvDetail(this.compDTO.matInfo)
  111 + })
  112 + }
  113 +
  114 + // 获取文本几行
  115 + private getTextLineNum(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
  116 + let size = this.topMeasureText(text, constraintWidth, lineHeight, fontSize)
  117 + let height: number = Number(size.height)
  118 + return Math.ceil(px2vp(height) / lineHeight)
  119 + }
  120 +
  121 + private topMeasureText(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
  122 + return measure.measureTextSize({
  123 + textContent: text,
  124 + fontSize: fontSize,
  125 + lineHeight: lineHeight,
  126 + constraintWidth: constraintWidth,
52 }) 127 })
53 } 128 }
54 } 129 }
55 130
  131 +
56 @Extend(Text) 132 @Extend(Text)
57 function bottomTextStyle() { 133 function bottomTextStyle() {
58 .fontSize(12) 134 .fontSize(12)
59 .fontColor('#B0B0B0') 135 .fontColor('#B0B0B0')
60 -}  
  136 +}
  137 +
@@ -22,12 +22,12 @@ export struct CardAdvThreeImageComponent { @@ -22,12 +22,12 @@ export struct CardAdvThreeImageComponent {
22 22
23 aboutToAppear(): void { 23 aboutToAppear(): void {
24 24
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----') 25 + console.error('ZZZXXXXX', '---三图卡-----aboutToAppear-----')
26 } 26 }
27 27
28 aboutToDisappear(): void { 28 aboutToDisappear(): void {
29 29
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----') 30 + console.error('ZZZXXXXX', '----三图卡----aboutToDisappear-----')
31 } 31 }
32 32
33 build() { 33 build() {
@@ -22,12 +22,12 @@ export struct CardAdvVideoComponent { @@ -22,12 +22,12 @@ export struct CardAdvVideoComponent {
22 22
23 aboutToAppear(): void { 23 aboutToAppear(): void {
24 24
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----') 25 + console.error('ZZZXXXXX', '--视频广告------aboutToAppear-----')
26 } 26 }
27 27
28 aboutToDisappear(): void { 28 aboutToDisappear(): void {
29 29
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----') 30 + console.error('ZZZXXXXX', '---视频广告-----aboutToDisappear-----')
31 } 31 }
32 32
33 build() { 33 build() {
@@ -22,12 +22,12 @@ export struct CardAdvVideoExComponent { @@ -22,12 +22,12 @@ export struct CardAdvVideoExComponent {
22 22
23 aboutToAppear(): void { 23 aboutToAppear(): void {
24 24
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----') 25 + console.error('ZZZXXXXX', '--冠名广告------aboutToAppear-----')
26 } 26 }
27 27
28 aboutToDisappear(): void { 28 aboutToDisappear(): void {
29 29
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----') 30 + console.error('ZZZXXXXX', '----冠名广告----aboutToDisappear-----')
31 } 31 }
32 32
33 build() { 33 build() {
@@ -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'
@@ -120,6 +120,9 @@ export struct ZhSingleRow06 { @@ -120,6 +120,9 @@ export struct ZhSingleRow06 {
120 .maxLines(1) 120 .maxLines(1)
121 .textOverflow({overflow: TextOverflow.Ellipsis}) 121 .textOverflow({overflow: TextOverflow.Ellipsis})
122 } 122 }
  123 + .onClick(() => {
  124 + ProcessUtils.commentGotoWeb(item.operDataList[0]?.commentInfo as commentInfo)
  125 + })
123 126
124 Row() { 127 Row() {
125 Image($r("app.media.icon_elite_comment")) 128 Image($r("app.media.icon_elite_comment"))
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 }
@@ -11,6 +11,7 @@ const MY_CHANNEL_TIP2: string = '拖动调整频道顺序' @@ -11,6 +11,7 @@ const MY_CHANNEL_TIP2: string = '拖动调整频道顺序'
11 const MORE_CHANNEL: string = '更多频道' 11 const MORE_CHANNEL: string = '更多频道'
12 const LOCAL_CHANNEL: string = '地方频道' 12 const LOCAL_CHANNEL: string = '地方频道'
13 13
  14 +const TAG: string = 'ChannelSubscriptionLayout'
14 15
15 @CustomDialog 16 @CustomDialog
16 struct ChannelDialog { 17 struct ChannelDialog {
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() {
@@ -13,7 +13,10 @@ import router from '@ohos.router'; @@ -13,7 +13,10 @@ import router from '@ohos.router';
13 import inputMethod from '@ohos.inputMethod'; 13 import inputMethod from '@ohos.inputMethod';
14 import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'; 14 import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
15 import { LikeComponent } from './LikeComponent'; 15 import { LikeComponent } from './LikeComponent';
16 -import { CommentCustomDialog } from '../comment/view/CommentCustomDialog'; 16 +import { CommentTabComponent, CommentIconComponent, } from '../comment/view/CommentTabComponent';
  17 +import { publishCommentModel } from '../comment/model/PublishCommentModel'
  18 +
  19 +// import { CommentCustomDialog } from '../comment/view/CommentCustomDialog';
17 import { HttpUrlUtils } from 'wdNetwork/Index'; 20 import { HttpUrlUtils } from 'wdNetwork/Index';
18 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 21 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
19 import { PageRepository } from '../../repository/PageRepository'; 22 import { PageRepository } from '../../repository/PageRepository';
@@ -38,6 +41,7 @@ export struct OperRowListView { @@ -38,6 +41,7 @@ export struct OperRowListView {
38 @State interactData: InteractDataDTO = {} as InteractDataDTO 41 @State interactData: InteractDataDTO = {} as InteractDataDTO
39 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 42 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
40 @State likeBean: Record<string, string> = {} 43 @State likeBean: Record<string, string> = {}
  44 + @State publishCommentModel: publishCommentModel = new publishCommentModel()
41 45
42 @State operationList: OperationItem[] = [ 46 @State operationList: OperationItem[] = [
43 { 47 {
@@ -81,13 +85,23 @@ export struct OperRowListView { @@ -81,13 +85,23 @@ export struct OperRowListView {
81 this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' 85 this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
82 console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData)) 86 console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData))
83 console.info(TAG, 'likeBean----', JSON.stringify(this.likeBean)) 87 console.info(TAG, 'likeBean----', JSON.stringify(this.likeBean))
  88 + // 评论需要数据
  89 + this.publishCommentModel.targetId = this.contentDetailData.newsId + ''
  90 + this.publishCommentModel.targetRelId = this.contentDetailData.reLInfo?.relId + ''
  91 + this.publishCommentModel.targetTitle = this.contentDetailData.newsTitle + ''
  92 + this.publishCommentModel.targetRelType = this.contentDetailData.reLInfo?.relType + ''
  93 + this.publishCommentModel.targetRelObjectId = this.contentDetailData.reLInfo?.relObjectId + ''
  94 + this.publishCommentModel.keyArticle = this.contentDetailData.keyArticle + ''
  95 + this.publishCommentModel.targetType = this.contentDetailData.newsType + ''
  96 + this.publishCommentModel.totalCommentNumer = '10'
84 } 97 }
85 98
86 build() { 99 build() {
87 Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems:ItemAlign.Center }){ 100 Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems:ItemAlign.Center }){
88 Row() { 101 Row() {
89 Column() { 102 Column() {
90 - Image($r('app.media.icon_arrow_left_white')) 103 + // Image($r('app.media.icon_arrow_left_white'))
  104 + Image($r('app.media.icon_arrow_left'))
91 .width(24) 105 .width(24)
92 .height(24) 106 .height(24)
93 .aspectRatio(1) 107 .aspectRatio(1)
@@ -109,6 +123,10 @@ export struct OperRowListView { @@ -109,6 +123,10 @@ export struct OperRowListView {
109 /* CommentCustomDialog({ 123 /* CommentCustomDialog({
110 placeHolderText: '说两句' 124 placeHolderText: '说两句'
111 })*/ 125 })*/
  126 + if (this.publishCommentModel?.targetId) {
  127 + CommentTabComponent({publishCommentModel: this.publishCommentModel})
  128 + CommentIconComponent({publishCommentModel: this.publishCommentModel})
  129 + }
112 } 130 }
113 /*TextInput({placeholder:'说两句...'}) 131 /*TextInput({placeholder:'说两句...'})
114 .placeholderColor('#999999') 132 .placeholderColor('#999999')
@@ -140,7 +158,8 @@ export struct OperRowListView { @@ -140,7 +158,8 @@ export struct OperRowListView {
140 } 158 }
141 .width('100%') 159 .width('100%')
142 .height(50) 160 .height(50)
143 - .backgroundColor(Color.Black) 161 + // .backgroundColor(Color.Black)
  162 + .backgroundColor(Color.White)
144 .margin({ 163 .margin({
145 bottom: 20 164 bottom: 20
146 }) 165 })
@@ -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
@@ -107,7 +107,7 @@ export struct DetailPlayVLivePage { @@ -107,7 +107,7 @@ export struct DetailPlayVLivePage {
107 (data) => { 107 (data) => {
108 if (data.length > 0) { 108 if (data.length > 0) {
109 this.liveDetailsBean = data[0] 109 this.liveDetailsBean = data[0]
110 - this.liveState = 'end' // this.liveDetailsBean.liveInfo?.liveState //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 110 + this.liveState = this.liveDetailsBean.liveInfo?.liveState //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
111 if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) { 111 if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) {
112 this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url 112 this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url
113 } 113 }
@@ -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 }
@@ -22,7 +22,7 @@ export struct DetailVideoListPage { @@ -22,7 +22,7 @@ export struct DetailVideoListPage {
22 @Provide showComment: boolean = true 22 @Provide showComment: boolean = true
23 @Provide pageShow: number = -1 23 @Provide pageShow: number = -1
24 @Provide pageHide: number = -1 24 @Provide pageHide: number = -1
25 - @Provide switchVideoStatus: boolean = false 25 + @Provide switchVideoStatus: boolean = true
26 @State data: ContentDetailDTO[] = [] 26 @State data: ContentDetailDTO[] = []
27 @State currentIndex: number = 0 27 @State currentIndex: number = 0
28 @State interactDataList: InteractDataDTO[] = [] 28 @State interactDataList: InteractDataDTO[] = []
@@ -38,13 +38,13 @@ export struct VideoChannelDetail { @@ -38,13 +38,13 @@ 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
45 @Consume @Watch('pageShowChange') pageShow: number 45 @Consume @Watch('pageShowChange') pageShow: number
46 @Consume @Watch('pageHideChange') pageHide: number 46 @Consume @Watch('pageHideChange') pageHide: number
47 - @Provide switchVideoStatus: boolean = false 47 + @Provide switchVideoStatus: boolean = true
48 @State data: ContentDetailDTO[] = [] 48 @State data: ContentDetailDTO[] = []
49 @State currentIndex: number = 0 49 @State currentIndex: number = 0
50 @State interactDataList: InteractDataDTO[] = [] 50 @State interactDataList: InteractDataDTO[] = []
@@ -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 }
1 export { add } from "./src/main/ets/utils/Calc" 1 export { add } from "./src/main/ets/utils/Calc"
2 -export { SettingPasswordParams } from "./src/main/ets/pages/login/SettingPasswordLayout"  
  2 +export { SettingPasswordParams } from "./src/main/ets/pages/login/SettingPasswordLayout"
  3 +
  4 +export { LoginModule } from './src/main/ets/LoginModule'
  1 +import HuaweiAuth from './utils/HuaweiAuth'
  2 +import { JumpInterceptorAction, RouterJumpInterceptor, WDRouterPage } from 'wdRouter'
  3 +import { BusinessError } from '@kit.BasicServicesKit'
  4 +import { router } from '@kit.ArkUI'
  5 +import { AccountManagerUtils } from 'wdKit/Index'
  6 +
  7 +class LoginJumpHandler implements JumpInterceptorAction {
  8 +
  9 + /// 说明是调用了跳转 WDRouterPage.loginPage 页面的行为
  10 + on(params?: object | undefined, singleMode?: boolean | undefined): boolean {
  11 +
  12 + HuaweiAuth.sharedInstance().fetchAnonymousPhone().then((anonymousPhone) => {
  13 +
  14 + router.pushUrl({url: WDRouterPage.oneKeyLoginPage.url()})
  15 + }).catch((error: string) => {
  16 + router.pushUrl({url: WDRouterPage.loginPage.url()})
  17 + })
  18 + return true
  19 + }
  20 +}
  21 +
  22 +export class LoginModule {
  23 +
  24 + static startup() {
  25 +
  26 + /// 初始化华为一键登录相关
  27 + if (HuaweiAuth.enable) {
  28 +
  29 + HuaweiAuth.sharedInstance().registerEvents()
  30 +
  31 + AccountManagerUtils.isLogin().then((login) => {
  32 + if (!login) {
  33 + HuaweiAuth.sharedInstance().rePrefetchAnonymousPhone()
  34 + }
  35 + })
  36 + RouterJumpInterceptor.register(WDRouterPage.loginPage, new LoginJumpHandler())
  37 + }
  38 +
  39 + }
  40 +}
@@ -9,6 +9,10 @@ import { WDRouterPage } from 'wdRouter/src/main/ets/router/WDRouterPage'; @@ -9,6 +9,10 @@ import { WDRouterPage } from 'wdRouter/src/main/ets/router/WDRouterPage';
9 import { WDRouterRule } from 'wdRouter/src/main/ets/router/WDRouterRule'; 9 import { WDRouterRule } from 'wdRouter/src/main/ets/router/WDRouterRule';
10 import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/src/main/ets/bean/content/Params' 10 import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/src/main/ets/bean/content/Params'
11 import {InterestsHobbiesModel} from '../../../../../../../products/phone/src/main/ets/pages/viewModel/InterestsHobbiesModel' 11 import {InterestsHobbiesModel} from '../../../../../../../products/phone/src/main/ets/pages/viewModel/InterestsHobbiesModel'
  12 +import HuaweiAuth from '../../utils/HuaweiAuth'
  13 +import { loginComponentManager, LoginWithHuaweiIDButton } from '@hms.core.account.LoginComponent'
  14 +import { BusinessError } from '@ohos.base'
  15 +
12 @Extend(Row) 16 @Extend(Row)
13 function otherStyle() { 17 function otherStyle() {
14 .backgroundImageSize(ImageSize.Cover) 18 .backgroundImageSize(ImageSize.Cover)
@@ -56,7 +60,6 @@ struct LoginPage { @@ -56,7 +60,6 @@ struct LoginPage {
56 }) 60 })
57 loginViewModel = new LoginViewModel() 61 loginViewModel = new LoginViewModel()
58 @State isProtocol:boolean=false 62 @State isProtocol:boolean=false
59 -  
60 onCodeSend() { 63 onCodeSend() {
61 Logger.debug(TAG, "isCodeSend:" + this.isCodeSend + "") 64 Logger.debug(TAG, "isCodeSend:" + this.isCodeSend + "")
62 if (this.isCodeSend) { 65 if (this.isCodeSend) {
@@ -15,6 +15,7 @@ struct LoginProtocolWebview { @@ -15,6 +15,7 @@ struct LoginProtocolWebview {
15 userProtocol = "https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1005.html" 15 userProtocol = "https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1005.html"
16 privateProtocol = 'https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1001.html' 16 privateProtocol = 'https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1001.html'
17 logoutProtocol = 'https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1003.html' 17 logoutProtocol = 'https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1003.html'
  18 + huaweiAuthProtocol = 'https://privacy.consumer.huawei.com/legal/id/authentication-terms.htm?code=CN&language=zh-CN'
18 19
19 async aboutToAppear() { 20 async aboutToAppear() {
20 if (router.getParams()) { 21 if (router.getParams()) {
@@ -30,6 +31,9 @@ struct LoginProtocolWebview { @@ -30,6 +31,9 @@ struct LoginProtocolWebview {
30 }else if(params.contentID == "3"){ //注销协议 31 }else if(params.contentID == "3"){ //注销协议
31 this.webUrl = await SPHelper.default.get(SpConstants.LOGOUT_PROTOCOL, this.logoutProtocol) as string 32 this.webUrl = await SPHelper.default.get(SpConstants.LOGOUT_PROTOCOL, this.logoutProtocol) as string
32 this.webviewController.loadUrl(this.webUrl) 33 this.webviewController.loadUrl(this.webUrl)
  34 + } else if(params.contentID == "4"){ //华为用户认证协议
  35 + this.webUrl = this.huaweiAuthProtocol
  36 + this.webviewController.loadUrl(this.webUrl)
33 } 37 }
34 } 38 }
35 39
  1 +import { router } from '@kit.ArkUI'
  2 +import { Params } from 'wdBean/Index'
  3 +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
  4 +import HuaweiAuth from '../../utils/HuaweiAuth'
  5 +import { BusinessError } from '@kit.BasicServicesKit'
  6 +
  7 +@Entry
  8 +@Component
  9 +struct OneKeyLoginPage {
  10 + anonymousPhone: string = ''
  11 + @State agreeProtocol: boolean = false
  12 +
  13 + aboutToAppear(): void {
  14 + this.anonymousPhone = HuaweiAuth.sharedInstance().anonymousPhone||""
  15 + }
  16 +
  17 + build() {
  18 + Column() {
  19 + this.CloseRow()
  20 +
  21 + Image($r("app.media.login_logo"))
  22 + .width(120)
  23 + .height(66)
  24 + .margin({ top: 78, bottom: 74})
  25 + .align(Alignment.Center)
  26 +
  27 + Text(this.anonymousPhone)
  28 + .fontSize(30)
  29 + .fontWeight(600)
  30 + .fontColor("#222222")
  31 + .margin({bottom: 10})
  32 + .align(Alignment.Center)
  33 +
  34 + this.ProtocolRow()
  35 +
  36 + Row() {
  37 + Button("华为账号一键登录")
  38 + .type(ButtonType.Normal)
  39 + .height(48)
  40 + .backgroundColor(!this.agreeProtocol ? Color.Grey : Color.Red)
  41 + .width("100%")
  42 + .onClick((event) => {
  43 + if (!this.agreeProtocol) {
  44 + return
  45 + }
  46 + HuaweiAuth.sharedInstance().oneKeyLogin().then((authorizeCode) => {
  47 +
  48 + //TODO: 调用服务端接口登录
  49 + }).catch((error: BusinessError) => {
  50 +
  51 + })
  52 + })
  53 + }
  54 + .padding({ left: 25, right: 25 })
  55 + .margin({top: 15})
  56 +
  57 + Button("其他手机号登录")
  58 + .type(ButtonType.Normal)
  59 + .align(Alignment.Center)
  60 + .foregroundColor("#666666")
  61 + .backgroundColor(Color.White)
  62 + .onClick((event) => {
  63 + router.replaceUrl({url: WDRouterPage.loginPage.url()})
  64 + })
  65 + }
  66 + }
  67 +
  68 + @Builder ProtocolRow() {
  69 + Row({space: 4}) {
  70 + Image(this.agreeProtocol ? $r('app.media.login_checkbox_select') : $r('app.media.login_checkbox_unselected'))
  71 + .width(15)
  72 + .height(15)
  73 + .onClick(() => {
  74 + this.agreeProtocol = !this.agreeProtocol
  75 + })
  76 + Text() {
  77 + Span("我已阅读并同意").fontColor("#999999").fontSize(12)
  78 + Span("《用户协议》").fontColor("#ED2800").fontSize(12).onClick(() => {
  79 + let bean = { contentID: "1", pageID: "" } as Params
  80 + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean)
  81 + })
  82 + Span("、").fontColor("#999999").fontSize(12)
  83 + Span("《隐私政策》").fontColor("#ED2800").fontSize(12).onClick(() => {
  84 + let bean = { contentID: "2", pageID: "" } as Params
  85 + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean)
  86 + })
  87 + Span("和").fontColor("#999999").fontSize(12)
  88 + Span("《华为账号用户认证协议》").fontColor("#ED2800").fontSize(12).onClick(() => {
  89 + let bean = { contentID: "4", pageID: "" } as Params
  90 + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean)
  91 + })
  92 + }
  93 + .layoutWeight(1)
  94 + }
  95 + .margin({top: 15})
  96 + .padding({ left: 25, right: 25 })
  97 + .width('100%')
  98 + }
  99 +
  100 + @Builder CloseRow() {
  101 + Row() {
  102 + Blank()
  103 + Image($r('app.media.login_closed'))
  104 + .width(24)
  105 + .height(24)
  106 + .onClick(() => router.back())
  107 + }.margin({ top: 15, right: 15 })
  108 + .width("100%")
  109 + }
  110 +}
  1 +import { authentication, extendService } from '@kit.AccountKit';
  2 +import { AccountManagerUtils, EmitterEventId, EmitterUtils, Logger } from 'wdKit/Index';
  3 +import { util } from '@kit.ArkTS';
  4 +import { DEFAULT } from '@ohos/hypium';
  5 +import { BusinessError } from '@kit.BasicServicesKit';
  6 +
  7 +const TAG = "HuaweiOneKeyAuth"
  8 +
  9 +export default class HuaweiAuth {
  10 +
  11 + // 是否开启
  12 + static enable = false
  13 + // 匿名手机号
  14 + private _anonymousPhone?: string
  15 + get anonymousPhone() {
  16 + return this._anonymousPhone
  17 + }
  18 +
  19 + private static instance: HuaweiAuth
  20 + static sharedInstance(): HuaweiAuth {
  21 + if (!HuaweiAuth.instance) {
  22 + HuaweiAuth.instance = new HuaweiAuth()
  23 + }
  24 + return HuaweiAuth.instance
  25 + }
  26 +
  27 + registerEvents() {
  28 + // 注册用户退出登录,取一次用来下次使用
  29 + EmitterUtils.receiveEvent(EmitterEventId.FORCE_USER_LOGIN_OUT, ((str?: string) => {
  30 + HuaweiAuth.sharedInstance().rePrefetchAnonymousPhone()
  31 + }))
  32 + EmitterUtils.receiveEvent(EmitterEventId.APP_ENTER_FOREGROUD, ((str?: string) => {
  33 + AccountManagerUtils.isLogin().then((login) => {
  34 + if (!login) {
  35 + HuaweiAuth.sharedInstance().rePrefetchAnonymousPhone()
  36 + }
  37 + })
  38 + }))
  39 + }
  40 +
  41 + // 重新预取手机号(App启动未登录、回前台未登录、和退出登录 时调用提前取号)
  42 + rePrefetchAnonymousPhone() {
  43 + this._anonymousPhone = undefined
  44 + this.fetchAnonymousPhone()
  45 + }
  46 +
  47 + // 要登录时,先调用。如果获取到手机号了 则弹起一键登录页面
  48 + fetchAnonymousPhone() : Promise<string> {
  49 +
  50 + return new Promise((resolve, fail) => {
  51 + if (this.anonymousPhone) {
  52 + resolve(this.anonymousPhone)
  53 + return
  54 + }
  55 +
  56 + let authRequest = new authentication.HuaweiIDProvider().createAuthorizationWithHuaweiIDRequest();
  57 + // 权限有 phone 、email、realTimePhone、quickLoginMobilePhone,这里用获取匿名手机号
  58 + authRequest.scopes = ['quickLoginAnonymousPhone'];
  59 + authRequest.state = util.generateRandomUUID();
  60 + authRequest.forceAuthorization = false;
  61 + let controller = new authentication.AuthenticationController(getContext(this));
  62 + try {
  63 + controller.executeRequest(authRequest).then((response: authentication.AuthorizationWithHuaweiIDResponse) => {
  64 + let anonymousPhone = response.data?.extraInfo?.quickLoginAnonymousPhone;
  65 + if (anonymousPhone) {
  66 + Logger.info(TAG, 'get anonymousPhone, ' + JSON.stringify(response));
  67 + this._anonymousPhone = anonymousPhone as string
  68 + resolve(this._anonymousPhone)
  69 + return;
  70 + }
  71 +
  72 + Logger.info(TAG, 'get anonymousPhone is empty. ' + JSON.stringify(response));
  73 + fail("获取匿名手机号为空")
  74 + }).catch((err: BusinessError) => {
  75 + Logger.error(TAG, 'get anonymousPhone failed. ' + JSON.stringify(err));
  76 + fail("获取匿名手机号失败")
  77 + })
  78 + } catch (err) {
  79 + Logger.error(TAG, 'get anonymousPhone fail. ' + JSON.stringify(err));
  80 + fail("获取匿名手机号失败")
  81 + }
  82 + })
  83 + }
  84 +
  85 + // 华为账号一键登录授权
  86 + // 返回结果为 Authorization Code
  87 + oneKeyLogin() : Promise<string> {
  88 +
  89 + let loginRequest = new authentication.HuaweiIDProvider().createLoginWithHuaweiIDRequest();
  90 + // 当用户未登录华为帐号时,是否强制拉起华为帐号登录界面
  91 + loginRequest.forceLogin = true;
  92 + loginRequest.state = util.generateRandomUUID();
  93 +
  94 + return new Promise((resolve, fail) => {
  95 +
  96 + try {
  97 + let controller = new authentication.AuthenticationController(getContext(this));
  98 + controller.executeRequest(loginRequest, (err, data) => {
  99 + if (err) {
  100 + Logger.error(TAG, 'login fail, ' + JSON.stringify(err))
  101 + fail(err)
  102 + return;
  103 + }
  104 + let loginWithHuaweiIDResponse = data as authentication.LoginWithHuaweiIDResponse;
  105 + let state = loginWithHuaweiIDResponse.state;
  106 + if (state != undefined && loginRequest.state != state) {
  107 + Logger.error(TAG, 'login fail, The state is different' + JSON.stringify(loginWithHuaweiIDResponse))
  108 + fail({
  109 + code: 99999,
  110 + name: "一键登录",
  111 + message:"状态错误:" + `请求状态 ${loginRequest.state}, 结果状态 ${state}`
  112 + } as BusinessError)
  113 + return;
  114 + }
  115 +
  116 + Logger.info(TAG, 'login success, ' + JSON.stringify(loginWithHuaweiIDResponse));
  117 + let loginWithHuaweiIDCredential = loginWithHuaweiIDResponse.data!;
  118 + let authorizationCode = loginWithHuaweiIDCredential.authorizationCode;
  119 + resolve(authorizationCode!)
  120 + });
  121 + } catch (error) {
  122 + Logger.error(TAG, 'login fail, ' + JSON.stringify(error))
  123 + fail(error)
  124 + }
  125 + });
  126 + }
  127 +
  128 + // 打开账户中心
  129 + openAccountCenter() {
  130 + try {
  131 + extendService.startAccountCenter(getContext(this), (err, data) => {
  132 + if (err) {
  133 + Logger.info(TAG, 'startAccountCenterWithCallback fail,error: ' + JSON.stringify(err));
  134 + return;
  135 + }
  136 + Logger.info(TAG, 'startAccountCenterWithCallback success');
  137 + });
  138 + } catch (error) {
  139 + Logger.error(TAG, 'startAccountCenterWithCallback fail,error: ' + JSON.stringify(error));
  140 + }
  141 + }
  142 +}
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 "pages/login/LoginProtocolWebview", 6 "pages/login/LoginProtocolWebview",
7 "pages/login/SettingPasswordPage", 7 "pages/login/SettingPasswordPage",
8 "pages/login/SettingPasswordLayout", 8 "pages/login/SettingPasswordLayout",
9 - "pages/guide/GuidePages" 9 + "pages/guide/GuidePages",
  10 + "pages/login/OneKeyLoginPage"
10 ] 11 ]
11 } 12 }
@@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
16 "wdRouter": "file:../../commons/wdRouter", 16 "wdRouter": "file:../../commons/wdRouter",
17 "wdNetwork": "file:../../commons/wdNetwork", 17 "wdNetwork": "file:../../commons/wdNetwork",
18 "wdHwAbility": "file:../../features/wdHwAbility", 18 "wdHwAbility": "file:../../features/wdHwAbility",
19 - "wdJsBridge": "file:../../commons/wdJsBridge" 19 + "wdJsBridge": "file:../../commons/wdJsBridge",
  20 + "wdLogin": "file:../../features/wdLogin"
20 } 21 }
21 } 22 }
@@ -15,12 +15,14 @@ import { @@ -15,12 +15,14 @@ import {
15 WindowModel 15 WindowModel
16 } from 'wdKit'; 16 } from 'wdKit';
17 import { HostEnum, HostManager, WDHttp } from 'wdNetwork'; 17 import { HostEnum, HostManager, WDHttp } from 'wdNetwork';
  18 +import { LoginModule } from 'wdLogin/src/main/ets/LoginModule';
18 19
19 export default class EntryAbility extends UIAbility { 20 export default class EntryAbility extends UIAbility {
20 onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { 21 onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
21 SPHelper.init(this.context); 22 SPHelper.init(this.context);
22 hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); 23 hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
23 registerRouter(); 24 registerRouter();
  25 + LoginModule.startup()
24 NetworkManager.getInstance().init() 26 NetworkManager.getInstance().init()
25 WDHttp.initHttpHeader() 27 WDHttp.initHttpHeader()
26 const spHostUrl = SPHelper.default.getSync('hostUrl', '') as string 28 const spHostUrl = SPHelper.default.getSync('hostUrl', '') as string
@@ -94,10 +96,14 @@ export default class EntryAbility extends UIAbility { @@ -94,10 +96,14 @@ export default class EntryAbility extends UIAbility {
94 onForeground(): void { 96 onForeground(): void {
95 // Ability has brought to foreground 97 // Ability has brought to foreground
96 hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); 98 hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
  99 +
  100 + EmitterUtils.sendEmptyEvent(EmitterEventId.APP_ENTER_FOREGROUD)
97 } 101 }
98 102
99 onBackground(): void { 103 onBackground(): void {
100 // Ability has back to background 104 // Ability has back to background
101 hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); 105 hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
  106 +
  107 + EmitterUtils.sendEmptyEvent(EmitterEventId.APP_ENTER_BACKGROUD)
102 } 108 }
103 } 109 }
1 import { Action } from 'wdBean'; 1 import { Action } from 'wdBean';
2 import { SpacialTopicPageComponent } from 'wdComponent' 2 import { SpacialTopicPageComponent } from 'wdComponent'
  3 +import { CommonConstants } from 'wdConstant'
3 import { Logger } from 'wdKit' 4 import { Logger } from 'wdKit'
4 import router from '@ohos.router'; 5 import router from '@ohos.router';
5 6
6 -const TAG = 'SpacialPage'; 7 +const TAG = 'SpacialTopicPage';
7 8
8 @Entry 9 @Entry
9 @Component 10 @Component
@@ -12,11 +13,11 @@ struct SpacialTopicPage { @@ -12,11 +13,11 @@ struct SpacialTopicPage {
12 13
13 build() { 14 build() {
14 Column() { 15 Column() {
15 - SpacialTopicPageComponent()  
16 - } 16 + SpacialTopicPageComponent({ action: this.action })
  17 + }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
17 } 18 }
18 19
19 - pageTransition(){ 20 + pageTransition() {
20 // 定义页面进入时的效果,从右边侧滑入 21 // 定义页面进入时的效果,从右边侧滑入
21 PageTransitionEnter({ type: RouteType.None, duration: 300 }) 22 PageTransitionEnter({ type: RouteType.None, duration: 300 })
22 .slide(SlideEffect.Right) 23 .slide(SlideEffect.Right)
@@ -25,7 +26,6 @@ struct SpacialTopicPage { @@ -25,7 +26,6 @@ struct SpacialTopicPage {
25 .slide(SlideEffect.Right) 26 .slide(SlideEffect.Right)
26 } 27 }
27 28
28 -  
29 aboutToAppear() { 29 aboutToAppear() {
30 Logger.info(TAG, 'aboutToAppear'); 30 Logger.info(TAG, 'aboutToAppear');
31 let action: Action = router.getParams() as Action 31 let action: Action = router.getParams() as Action
@@ -28,7 +28,6 @@ struct DefaultWebPage { @@ -28,7 +28,6 @@ struct DefaultWebPage {
28 isPageEnd: $isPageEnd 28 isPageEnd: $isPageEnd
29 }) 29 })
30 } 30 }
31 - .padding({ bottom: 56 })  
32 .width(CommonConstants.FULL_WIDTH) 31 .width(CommonConstants.FULL_WIDTH)
33 .height(CommonConstants.FULL_HEIGHT) 32 .height(CommonConstants.FULL_HEIGHT)
34 } 33 }
@@ -34,6 +34,10 @@ @@ -34,6 +34,10 @@
34 ] 34 ]
35 } 35 }
36 ], 36 ],
  37 + "metadata": [{
  38 + "name": "client_id",
  39 + "value": "220837707901830144"
  40 + }],
37 "requestPermissions": [ 41 "requestPermissions": [
38 { 42 {
39 "name": "ohos.permission.CAMERA", 43 "name": "ohos.permission.CAMERA",
@@ -88,6 +92,6 @@ @@ -88,6 +92,6 @@
88 { 92 {
89 "name": "ohos.permission.INTERNET" 93 "name": "ohos.permission.INTERNET"
90 } 94 }
91 - ], 95 + ]
92 } 96 }
93 } 97 }