张善主

Merge remote-tracking branch 'origin/main'

Showing 68 changed files with 2098 additions and 1530 deletions

Too many changes to show.

To preserve performance only 68 of 68+ files are displayed.

@@ -11,8 +11,13 @@ export class SpConstants{ @@ -11,8 +11,13 @@ export class SpConstants{
11 static USER_TEMP_TOKEN="tempToken" 11 static USER_TEMP_TOKEN="tempToken"
12 static USER_PHONE = "user_phone" 12 static USER_PHONE = "user_phone"
13 //协议相关 13 //协议相关
14 - static USER_PROTOCOL = "user_protocol" //用户协议  
15 - static PRIVATE_PROTOCOL = "private_protocol" //隐私协议 14 + static NET_SERVICE_PROTOCOL = "user_protocol" //人民日报客户端网络服务使用协议
  15 + static PRIVATE_PROTOCOL = "private_protocol" //人民日报客户端用户隐私协议
  16 + static LOGOUT_PROTOCOL = "logout_protocol" //人民日报客户端app注销协议
  17 + static MESSAGE_BOARD_USER_PROTOCOL = "message_board_user_protocol" //"留言板-用户协议"
  18 + static MESSAGE_BOARD_NOTICE_PROTOCOL = "message_board_notice_protocol" //留言板-留言须知
  19 + static MESSAGE_BOARD_QUESTION_PROTOCOL = "message_board_question_protocol" //"留言板-发布提问规定""
  20 + static MESSAGE_BOARD_PRIVATE_PROTOCOL = "message_board_private_protocol" //"留言板-隐私政策"
16 //设置页面 21 //设置页面
17 static SETTING_WIFI_IMAGE_SWITCH = "setting_wifi_switch" //wifi 图片开关 22 static SETTING_WIFI_IMAGE_SWITCH = "setting_wifi_switch" //wifi 图片开关
18 static SETTING_WIFI_VIDEO_SWITCH = "setting_wifi_switch" //wifi 视频开关 23 static SETTING_WIFI_VIDEO_SWITCH = "setting_wifi_switch" //wifi 视频开关
  1 +/**
  2 + * https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-window-0000001820880785#ZH-CN_TOPIC_0000001811317218__systembarproperties
  3 + * 状态栏、导航栏的属性。
  4 + */
  5 +
  6 +/**
  7 + * 状态栏背景颜色 statusBarColor
  8 + * 导航栏背景颜色 navigationBarColor
  9 + */
  10 +export const enum SysStatusBarColor {
  11 + WHITE = '#ffffff',
  12 + BLACK = '#000000',
  13 + DEFAULT = '#0x66000000'
  14 +}
  15 +
  16 +
  17 +/**
  18 + * 状态栏文字颜色 statusBarContentColor8
  19 + * 导航栏文字颜色 navigationBarContentColor8
  20 + */
  21 +export const enum SysBarContentColor {
  22 + WHITE = '#ffffff',
  23 + BLACK = '#000000',
  24 + DEFAULT = '0xE5FFFFFF'
  25 +}
  26 +
  27 +
  28 +
1 import { Action } from './Action'; 1 import { Action } from './Action';
2 - 2 +interface dataObject {
  3 + webViewHeight?: string
  4 + dataJson?: string
  5 +}
3 /** 6 /**
4 * 消息Message 7 * 消息Message
5 */ 8 */
@@ -7,7 +10,7 @@ export class Message { @@ -7,7 +10,7 @@ export class Message {
7 callbackId: string = ""; //callbackId 10 callbackId: string = ""; //callbackId
8 responseId: string = ""; //responseId 11 responseId: string = ""; //responseId
9 responseData: string = ""; //responseData 12 responseData: string = ""; //responseData
10 - data?: object; //data of message 13 + data?: dataObject; //data of message
11 handlerName: string = ""; //name of handler 14 handlerName: string = ""; //name of handler
12 15
13 /** 16 /**
@@ -36,7 +36,7 @@ export { UserDataLocal } from './src/main/ets/utils/UserDataLocal' @@ -36,7 +36,7 @@ export { UserDataLocal } from './src/main/ets/utils/UserDataLocal'
36 36
37 export { NumberFormatterUtils } from './src/main/ets/utils/NumberFormatterUtils' 37 export { NumberFormatterUtils } from './src/main/ets/utils/NumberFormatterUtils'
38 38
39 -// export { PermissionUtils } from './src/main/ets/utils/PermissionUtils' 39 +export { PermissionUtils } from './src/main/ets/utils/PermissionUtils'
40 40
41 export { ErrorToastUtils } from './src/main/ets/utils/ErrorToastUtils' 41 export { ErrorToastUtils } from './src/main/ets/utils/ErrorToastUtils'
42 42
1 import emitter from '@ohos.events.emitter'; 1 import emitter from '@ohos.events.emitter';
2 -import HashMap from '@ohos.util.HashMap';  
3 2
4 const TAG: string = 'EmitterUtils'; 3 const TAG: string = 'EmitterUtils';
5 4
6 /** 5 /**
7 * 线程间通信简单工具 6 * 线程间通信简单工具
8 - * TODO 待优化  
9 */ 7 */
10 export class EmitterUtils { 8 export class EmitterUtils {
11 /** 9 /**
@@ -23,15 +21,17 @@ export class EmitterUtils { @@ -23,15 +21,17 @@ export class EmitterUtils {
23 /** 21 /**
24 * 发送消息 22 * 发送消息
25 * @param eventId 事件id 23 * @param eventId 事件id
26 - * @param data 数据 24 + * @param str 字符串数据
27 */ 25 */
28 - static sendEvent(eventId: number, data: { [key: string]: any; }) { 26 + static sendEvent(eventId: number, str?: string) {
29 let event: emitter.InnerEvent = { 27 let event: emitter.InnerEvent = {
30 eventId: eventId, 28 eventId: eventId,
31 priority: emitter.EventPriority.LOW 29 priority: emitter.EventPriority.LOW
32 }; 30 };
33 let eventData: emitter.EventData = { 31 let eventData: emitter.EventData = {
34 - data: data 32 + data: {
  33 + jsonStr: str
  34 + }
35 }; 35 };
36 emitter.emit(event, eventData); 36 emitter.emit(event, eventData);
37 } 37 }
@@ -41,18 +41,29 @@ export class EmitterUtils { @@ -41,18 +41,29 @@ export class EmitterUtils {
41 * @param eventId 事件id 41 * @param eventId 事件id
42 * @param callback 回调函数 42 * @param callback 回调函数
43 */ 43 */
44 - static receiveEvent(eventId: number, callback: (data?: { [key: string]: any; }) => void) { 44 + static receiveEvent(eventId: number, callback: (str?: string) => void) {
45 let event: emitter.InnerEvent = { 45 let event: emitter.InnerEvent = {
46 eventId: eventId 46 eventId: eventId
47 }; 47 };
48 48
49 - // 收到eventId为1的事件后执行该回调  
50 - let callback1 = (eventData: emitter.EventData): void => {  
51 - callback(eventData.data) 49 + // 收到eventId事件后执行该回调
  50 + let callback1 = (eventData?: emitter.EventData): void => {
  51 + if (eventData && eventData.data) {
  52 + try {
  53 + let jsonObject: EmitterBean = JSON.parse(JSON.stringify(eventData.data))
  54 + callback(jsonObject.jsonStr)
  55 + } catch (err) {
  56 + callback()
  57 + }
  58 + } else {
  59 + callback()
  60 + }
52 }; 61 };
53 -  
54 - // 订阅eventId为1的事件 62 + // 订阅eventId事件
55 emitter.on(event, callback1); 63 emitter.on(event, callback1);
56 } 64 }
57 } 65 }
58 66
  67 +interface EmitterBean {
  68 + jsonStr: string
  69 +}
@@ -7,7 +7,17 @@ export namespace ErrorToastUtils { @@ -7,7 +7,17 @@ export namespace ErrorToastUtils {
7 NET_CORE_PAGE_ERROR_NETWORK, //网络出小差了,请检查网络后重试 7 NET_CORE_PAGE_ERROR_NETWORK, //网络出小差了,请检查网络后重试
8 NET_CORE_LOAD_ERROR_NETWORK, //加载失败,请重试 8 NET_CORE_LOAD_ERROR_NETWORK, //加载失败,请重试
9 NET_CORE_ENTER_ERROR_NETWORK, //很抱歉,当前内容无法加载,请点击重试 9 NET_CORE_ENTER_ERROR_NETWORK, //很抱歉,当前内容无法加载,请点击重试
10 - LIVE_CORE_NO_NETWORK, //网络出小差了,请检查下网络 10 +
  11 + //直播异常
  12 + LIVE_CORE_NO_NETWORK, //直播 无网络 网络出小差了,请检查下网络
  13 + LIVE_CORE_WEAK_NETWORK, //直播 弱网 网络出小差了,请检查下网络
  14 + LIVE_CORE_IO_NETWORK, //直播 直播流异常 直播加载异常
  15 + LIVE_CORE_SERVICE_NETWORK, //直播 服务端接口异常 直播加载异常
  16 + LIVE_CORE_SWITCH_FLOW_NETWORK, //直播 网络切换到流量 正在使用流量,请注意流量使用
  17 +
  18 + //审核后异常报错
  19 + AUDITING_CORE_CONTENT_DISTRIBUTE, //审核 内容分发下线规则 内容已下线
  20 + AUDITING_CORE_ACCOUNT_ERROR, //审核 账号有问题下线规则 内容已下线
11 21
12 } 22 }
13 23
@@ -32,6 +42,27 @@ export namespace ErrorToastUtils { @@ -32,6 +42,27 @@ export namespace ErrorToastUtils {
32 case ErrorType.LIVE_CORE_NO_NETWORK: 42 case ErrorType.LIVE_CORE_NO_NETWORK:
33 ToastUtils.shortToast($r('app.string.live_core_no_network')) 43 ToastUtils.shortToast($r('app.string.live_core_no_network'))
34 break 44 break
  45 + case ErrorType.LIVE_CORE_WEAK_NETWORK:
  46 + ToastUtils.shortToast($r('app.string.live_core_weak_network'))
  47 + break
  48 + case ErrorType.LIVE_CORE_IO_NETWORK:
  49 + ToastUtils.shortToast($r('app.string.live_core_io_network'))
  50 + break
  51 + case ErrorType.LIVE_CORE_SERVICE_NETWORK:
  52 + ToastUtils.shortToast($r('app.string.live_core_service_network'))
  53 + break
  54 + case ErrorType.LIVE_CORE_SWITCH_FLOW_NETWORK:
  55 + ToastUtils.shortToast($r('app.string.live_core_switch_flow_network'))
  56 + break
  57 + case ErrorType.LIVE_CORE_SWITCH_FLOW_NETWORK:
  58 + ToastUtils.shortToast($r('app.string.live_core_switch_flow_network'))
  59 + break
  60 + case ErrorType.AUDITING_CORE_CONTENT_DISTRIBUTE:
  61 + ToastUtils.shortToast($r('app.string.auditing_core_error'))
  62 + break
  63 + case ErrorType.AUDITING_CORE_ACCOUNT_ERROR:
  64 + ToastUtils.shortToast($r('app.string.auditing_core_error'))
  65 + break
35 } 66 }
36 67
37 } 68 }
1 -// import { abilityAccessCtrl, bundleManager, common, Permissions, Want } from '@kit.AbilityKit'  
2 -// import { BusinessError } from '@kit.BasicServicesKit'  
3 -// import { AppUtils } from './AppUtils'  
4 -// import { Logger } from './Logger'  
5 -//  
6 -// /**  
7 -// * 权限工具类  
8 -// * */  
9 -// export class PermissionUtils {  
10 -// //相机权限  
11 -// static CAMERA: Permissions = 'ohos.permission.CAMERA'  
12 -// //文件权限  
13 -// static READ_MEDIA: Permissions = 'ohos.permission.READ_MEDIA'  
14 -// static WRITE_MEDIA: Permissions = 'ohos.permission.WRITE_MEDIA'  
15 -// private static tokenId: number = 0  
16 -//  
17 -// /**检查权限是否授权*/  
18 -// static async checkPermissions(permission: Permissions): Promise<boolean> {  
19 -// let hasPermissions = false;  
20 -// let grantStatus: abilityAccessCtrl.GrantStatus = await PermissionUtils.checkAccessToken(permission);  
21 -//  
22 -// if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {  
23 -// // 已经授权,可以继续访问目标操作  
24 -// hasPermissions = true;  
25 -// } else {  
26 -// hasPermissions = false;  
27 -// // 申请日历权限  
28 -// }  
29 -// return hasPermissions;  
30 -// }  
31 -//  
32 -// /**动态申请权限*/  
33 -// static reqPermissionsFromUser(permissions: Array<Permissions>, component: Object): Promise<boolean> {  
34 -//  
35 -// return new Promise((resolve, fail) => {  
36 -// let context = getContext(component) as common.UIAbilityContext;  
37 -// let atManager = abilityAccessCtrl.createAtManager();  
38 -// atManager.requestPermissionsFromUser(context, permissions).then((data) => {  
39 -// let grantStatus: Array<number> = data.authResults;  
40 -// let length: number = grantStatus.length;  
41 -//  
42 -// for (let i = 0; i < length; i++) {  
43 -// if (grantStatus[i] === 0) {  
44 -// // 用户授权,可以继续访问目标操作  
45 -// resolve(true);  
46 -// } else {  
47 -// resolve(false)  
48 -// }  
49 -// }  
50 -// }).catch((err: Error) => {  
51 -// fail(err)  
52 -// })  
53 -// });  
54 -// }  
55 -//  
56 -// /**跳转设置页面*/  
57 -// static openPermissionsInSystemSettings(context: Object): void {  
58 -// let uiContext = getContext(context) as common.UIAbilityContext;  
59 -// let wantInfo: Want = {  
60 -// bundleName: 'com.huawei.hmos.settings',  
61 -// abilityName: 'com.huawei.hmos.settings.MainAbility',  
62 -// uri: 'application_info_entry',  
63 -// parameters: {  
64 -// pushParams: AppUtils.getPackageName(uiContext) // 打开指定应用的设置页面  
65 -// }  
66 -// }  
67 -// uiContext.startAbility(wantInfo)  
68 -// }  
69 -//  
70 -// private static async checkAccessToken(permission: Permissions): Promise<abilityAccessCtrl.GrantStatus> {  
71 -// let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();  
72 -// let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED;  
73 -//  
74 -// // 获取应用程序的accessTokenID  
75 -// if (PermissionUtils.tokenId == 0) {  
76 -// try {  
77 -// let bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);  
78 -// let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo;  
79 -// PermissionUtils.tokenId = appInfo.accessTokenId;  
80 -// } catch (error) {  
81 -// const err: BusinessError = error as BusinessError;  
82 -// }  
83 -// }  
84 -// // 校验应用是否被授予权限  
85 -// try {  
86 -// grantStatus = await atManager.checkAccessToken(PermissionUtils.tokenId, permission);  
87 -// } catch (error) {  
88 -// const err: BusinessError = error as BusinessError;  
89 -// }  
90 -//  
91 -// return grantStatus;  
92 -// }  
93 -//  
94 -// }  
  1 +import { abilityAccessCtrl, bundleManager, common, Permissions, Want } from '@kit.AbilityKit'
  2 +import { BusinessError } from '@kit.BasicServicesKit'
  3 +import { AppUtils } from './AppUtils'
  4 +import { Logger } from './Logger'
  5 +
  6 +/**
  7 + * 权限工具类
  8 + * */
  9 +export class PermissionUtils {
  10 + //相机权限
  11 + static CAMERA: Permissions = 'ohos.permission.CAMERA'
  12 + //文件权限
  13 + static READ_MEDIA: Permissions = 'ohos.permission.READ_MEDIA'
  14 + static WRITE_MEDIA: Permissions = 'ohos.permission.WRITE_MEDIA'
  15 + private static tokenId: number = 0
  16 +
  17 + /**检查权限是否授权*/
  18 + static async checkPermissions(permission: Permissions): Promise<boolean> {
  19 + let hasPermissions = false;
  20 + let grantStatus: abilityAccessCtrl.GrantStatus = await PermissionUtils.checkAccessToken(permission);
  21 +
  22 + if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {
  23 + // 已经授权,可以继续访问目标操作
  24 + hasPermissions = true;
  25 + } else {
  26 + hasPermissions = false;
  27 + // 申请日历权限
  28 + }
  29 + return hasPermissions;
  30 + }
  31 +
  32 + /**动态申请权限*/
  33 + static reqPermissionsFromUser(permissions: Array<Permissions>, component: Object): Promise<boolean> {
  34 +
  35 + return new Promise((resolve, fail) => {
  36 + let context = getContext(component) as common.UIAbilityContext;
  37 + let atManager = abilityAccessCtrl.createAtManager();
  38 + atManager.requestPermissionsFromUser(context, permissions).then((data) => {
  39 + let grantStatus: Array<number> = data.authResults;
  40 + let length: number = grantStatus.length;
  41 +
  42 + for (let i = 0; i < length; i++) {
  43 + if (grantStatus[i] === 0) {
  44 + // 用户授权,可以继续访问目标操作
  45 + resolve(true);
  46 + } else {
  47 + resolve(false)
  48 + }
  49 + }
  50 + }).catch((err: Error) => {
  51 + fail(err)
  52 + })
  53 + });
  54 + }
  55 +
  56 + /**跳转设置页面*/
  57 + static openPermissionsInSystemSettings(context: Object): void {
  58 + let uiContext = getContext(context) as common.UIAbilityContext;
  59 + let wantInfo: Want = {
  60 + bundleName: 'com.huawei.hmos.settings',
  61 + abilityName: 'com.huawei.hmos.settings.MainAbility',
  62 + uri: 'application_info_entry',
  63 + parameters: {
  64 + pushParams: AppUtils.getPackageName(uiContext) // 打开指定应用的设置页面
  65 + }
  66 + }
  67 + uiContext.startAbility(wantInfo)
  68 + }
  69 +
  70 + private static async checkAccessToken(permission: Permissions): Promise<abilityAccessCtrl.GrantStatus> {
  71 + let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
  72 + let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED;
  73 +
  74 + // 获取应用程序的accessTokenID
  75 + if (PermissionUtils.tokenId == 0) {
  76 + try {
  77 + let bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);
  78 + let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo;
  79 + PermissionUtils.tokenId = appInfo.accessTokenId;
  80 + } catch (error) {
  81 + const err: BusinessError = error as BusinessError;
  82 + }
  83 + }
  84 + // 校验应用是否被授予权限
  85 + try {
  86 + grantStatus = await atManager.checkAccessToken(PermissionUtils.tokenId, permission);
  87 + } catch (error) {
  88 + const err: BusinessError = error as BusinessError;
  89 + }
  90 +
  91 + return grantStatus;
  92 + }
  93 +
  94 +}
1 import window from '@ohos.window'; 1 import window from '@ohos.window';
2 -import { BusinessError } from '@ohos.base'; 2 +import { AsyncCallback, BusinessError } from '@ohos.base';
3 import deviceInfo from '@ohos.deviceInfo' 3 import deviceInfo from '@ohos.deviceInfo'
4 import display from '@ohos.display'; 4 import display from '@ohos.display';
5 5
  6 +
  7 +interface SystemBarProperties {
  8 + statusBarColor?: string;
  9 + isStatusBarLightIcon?: boolean;
  10 + statusBarContentColor?: string;
  11 + navigationBarColor?: string;
  12 + isNavigationBarLightIcon?: boolean;
  13 + navigationBarContentColor?: string;
  14 +}
  15 +
6 export class Size { 16 export class Size {
7 width: number = 0 17 width: number = 0
8 height: number = 0 18 height: number = 0
@@ -15,17 +25,23 @@ export class Size { @@ -15,17 +25,23 @@ export class Size {
15 25
16 export class WindowModel { 26 export class WindowModel {
17 private windowStage?: window.WindowStage; 27 private windowStage?: window.WindowStage;
  28 + private windowClass?: window.Window;
18 static shared: WindowModel = new WindowModel() 29 static shared: WindowModel = new WindowModel()
19 static TAG = "WindowModel"; 30 static TAG = "WindowModel";
20 31
21 setWindowStage(windowStage: window.WindowStage) { 32 setWindowStage(windowStage: window.WindowStage) {
22 this.windowStage = windowStage; 33 this.windowStage = windowStage;
  34 + this.windowClass = windowStage.getMainWindowSync();
23 } 35 }
24 36
25 getWindowStage(): window.WindowStage { 37 getWindowStage(): window.WindowStage {
26 return this.windowStage as window.WindowStage 38 return this.windowStage as window.WindowStage
27 } 39 }
28 40
  41 + getWindowClass(): window.Window {
  42 + return this.windowClass as window.Window
  43 + }
  44 +
29 setMainWindowFullScreen(fullScreen: boolean) { 45 setMainWindowFullScreen(fullScreen: boolean) {
30 if (deviceInfo.deviceType != "phone") { 46 if (deviceInfo.deviceType != "phone") {
31 return 47 return
@@ -103,5 +119,17 @@ export class WindowModel { @@ -103,5 +119,17 @@ export class WindowModel {
103 }); 119 });
104 }) 120 })
105 } 121 }
  122 +
  123 + /**
  124 + * 设置窗口全屏模式时窗口内导航栏、状态栏的属性,使用callback异步回调。
  125 + * @param systemBarProperties
  126 + * @param callback
  127 + */
  128 + setWindowSystemBarProperties(systemBarProperties: SystemBarProperties, callback?: AsyncCallback<void>): void {
  129 + this.windowClass?.setWindowSystemBarProperties(systemBarProperties, (err: BusinessError) => {
  130 + callback && callback(err)
  131 + })
  132 +
  133 + }
106 } 134 }
107 135
@@ -27,6 +27,26 @@ @@ -27,6 +27,26 @@
27 { 27 {
28 "name": "live_core_no_network", 28 "name": "live_core_no_network",
29 "value": "网络出小差了,请检查下网络" 29 "value": "网络出小差了,请检查下网络"
  30 + },
  31 + {
  32 + "name": "live_core_weak_network",
  33 + "value": "网络出小差了,请检查下网络"
  34 + },
  35 + {
  36 + "name": "live_core_io_network",
  37 + "value": "直播加载异常"
  38 + },
  39 + {
  40 + "name": "live_core_service_network",
  41 + "value": "直播加载异常"
  42 + },
  43 + {
  44 + "name": "live_core_switch_flow_network",
  45 + "value": "正在使用流量,请注意流量使用"
  46 + },
  47 + {
  48 + "name": "auditing_core_error",
  49 + "value": "内容已下线"
30 } 50 }
31 ] 51 ]
32 } 52 }
@@ -46,6 +46,10 @@ export class HttpUrlUtils { @@ -46,6 +46,10 @@ export class HttpUrlUtils {
46 * 批查接口,查询互动相关数据,如收藏数、评论数等 46 * 批查接口,查询互动相关数据,如收藏数、评论数等
47 */ 47 */
48 static readonly INTERACT_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/content/interactData"; 48 static readonly INTERACT_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/content/interactData";
  49 + /**
  50 + * 查询视频频道推荐楼层
  51 + */
  52 + static readonly DISPLAY_REC_COMPINFO: string = "/api/rmrb-bff-display-zh/display/zh/c/rec/compInfo";
49 // 多图(图集)详情页 53 // 多图(图集)详情页
50 /** 54 /**
51 * 批量查询内容当前用户点赞、收藏状态 55 * 批量查询内容当前用户点赞、收藏状态
@@ -196,7 +200,6 @@ export class HttpUrlUtils { @@ -196,7 +200,6 @@ export class HttpUrlUtils {
196 * 搜索联想词 200 * 搜索联想词
197 */ 201 */
198 static readonly RELATED_SEARCH_CONTENT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/suggestions/"; 202 static readonly RELATED_SEARCH_CONTENT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/suggestions/";
199 -  
200 /** 203 /**
201 * 直播详情 204 * 直播详情
202 */ 205 */
@@ -205,7 +208,6 @@ export class HttpUrlUtils { @@ -205,7 +208,6 @@ export class HttpUrlUtils {
205 * 直播详情-直播间列表 208 * 直播详情-直播间列表
206 */ 209 */
207 static readonly LIVE_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/video/list"; 210 static readonly LIVE_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/video/list";
208 -  
209 /** 211 /**
210 * 直播详情-大家聊列表 212 * 直播详情-大家聊列表
211 */ 213 */
@@ -215,6 +217,10 @@ export class HttpUrlUtils { @@ -215,6 +217,10 @@ export class HttpUrlUtils {
215 * 搜索结果 显示tab 数 217 * 搜索结果 显示tab 数
216 */ 218 */
217 static readonly SEARCH_RESULT_COUNT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/count?keyword="; 219 static readonly SEARCH_RESULT_COUNT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/count?keyword=";
  220 + /**
  221 + * 搜索结果 显示list 详情
  222 + */
  223 + static readonly SEARCH_RESULT_LIST_DATA_PATH: string = "/api/rmrb-search-api/zh/c/search";
218 224
219 /** 225 /**
220 * 早晚报列表 226 * 早晚报列表
@@ -497,13 +503,14 @@ export class HttpUrlUtils { @@ -497,13 +503,14 @@ export class HttpUrlUtils {
497 503
498 /*优质评论页*/ 504 /*优质评论页*/
499 static getQualityCommentUrl() { 505 static getQualityCommentUrl() {
500 - let url = HttpUrlUtils._hostUrl + "api/rmrb-comment/comment/zh/c/highQuality" 506 + let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/highQuality";
  507 +
501 return url 508 return url
502 } 509 }
503 510
504 /*获取详情页评论列表*/ 511 /*获取详情页评论列表*/
505 static getContentCommentListDataUrl() { 512 static getContentCommentListDataUrl() {
506 - let url = HttpUrlUtils._hostUrl + "api/rmrb-comment/comment/zh/c/contentCommentList" 513 + let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/contentCommentList"
507 return url 514 return url
508 } 515 }
509 516
@@ -520,6 +527,12 @@ export class HttpUrlUtils { @@ -520,6 +527,12 @@ export class HttpUrlUtils {
520 return url; 527 return url;
521 } 528 }
522 529
  530 + //获取用户安全页信息
  531 + static querySecurity() {
  532 + let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/security/query";
  533 + return url;
  534 + }
  535 +
523 static getAppointmentListDataUrl() { 536 static getAppointmentListDataUrl() {
524 let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH 537 let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH
525 return url 538 return url
@@ -645,6 +658,16 @@ export class HttpUrlUtils { @@ -645,6 +658,16 @@ export class HttpUrlUtils {
645 return url 658 return url
646 } 659 }
647 660
  661 + static getSearchResultListDataUrl() {
  662 + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_LIST_DATA_PATH
  663 + return url
  664 + }
  665 +
  666 + static getInteractListDataUrl() {
  667 + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERACT_DATA_PATH
  668 + return url
  669 + }
  670 +
648 // static getYcgCommonHeaders(): HashMap<string, string> { 671 // static getYcgCommonHeaders(): HashMap<string, string> {
649 // let headers: HashMap<string, string> = new HashMap<string, string>() 672 // let headers: HashMap<string, string> = new HashMap<string, string>()
650 // 673 //
@@ -8,6 +8,8 @@ export class H5CallNativeType { @@ -8,6 +8,8 @@ export class H5CallNativeType {
8 static jsCall_getAppPublicInfo = 'jsCall_getAppPublicInfo' 8 static jsCall_getAppPublicInfo = 'jsCall_getAppPublicInfo'
9 static jsCall_getArticleDetailBussinessData = 'jsCall_getArticleDetailBussinessData' 9 static jsCall_getArticleDetailBussinessData = 'jsCall_getArticleDetailBussinessData'
10 static jsCall_callAppService = 'jsCall_callAppService' 10 static jsCall_callAppService = 'jsCall_callAppService'
  11 + static jsCall_appInnerLinkMethod = 'jsCall_appInnerLinkMethod'
  12 + static jsCall_receiveH5Data = 'jsCall_receiveH5Data'
11 // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。 13 // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。
12 14
13 static { 15 static {
@@ -15,6 +17,8 @@ export class H5CallNativeType { @@ -15,6 +17,8 @@ export class H5CallNativeType {
15 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppPublicInfo) 17 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppPublicInfo)
16 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getArticleDetailBussinessData) 18 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getArticleDetailBussinessData)
17 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_callAppService) 19 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_callAppService)
  20 + H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_appInnerLinkMethod)
  21 + H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_receiveH5Data)
18 } 22 }
19 } 23 }
20 24
@@ -2,6 +2,9 @@ import { Callback, BridgeWebViewControl } from 'wdJsBridge'; @@ -2,6 +2,9 @@ import { Callback, BridgeWebViewControl } from 'wdJsBridge';
2 import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; 2 import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
3 import { Logger, StringUtils, } from 'wdKit'; 3 import { Logger, StringUtils, } from 'wdKit';
4 import { H5CallNativeType } from './H5CallNativeType'; 4 import { H5CallNativeType } from './H5CallNativeType';
  5 +import { ContentDTO } from 'wdBean';
  6 +//TODO 这里引用了 features模块,是否考虑将跳转抽到公共模块
  7 +import { ProcessUtils } from '../../../../../../features/wdComponent/src/main/ets/utils/ProcessUtils';
5 8
6 const TAG = 'JsBridgeBiz' 9 const TAG = 'JsBridgeBiz'
7 10
@@ -11,7 +14,7 @@ const TAG = 'JsBridgeBiz' @@ -11,7 +14,7 @@ const TAG = 'JsBridgeBiz'
11 * @param call 14 * @param call
12 */ 15 */
13 export function performJSCallNative(data: Message, call: Callback) { 16 export function performJSCallNative(data: Message, call: Callback) {
14 - Logger.debug(TAG, 'performJSCallNative handlerName: ' + data.handlerName + ', data: ' + data.data) 17 + Logger.debug(TAG, 'performJSCallNative handlerName: ' + data.handlerName + ', data: ' + JSON.stringify(data.data))
15 switch (data.handlerName) { 18 switch (data.handlerName) {
16 case H5CallNativeType.jsCall_currentPageOperate: 19 case H5CallNativeType.jsCall_currentPageOperate:
17 break; 20 break;
@@ -23,6 +26,9 @@ export function performJSCallNative(data: Message, call: Callback) { @@ -23,6 +26,9 @@ export function performJSCallNative(data: Message, call: Callback) {
23 break; 26 break;
24 case H5CallNativeType.jsCall_callAppService: 27 case H5CallNativeType.jsCall_callAppService:
25 break; 28 break;
  29 + case H5CallNativeType.jsCall_receiveH5Data:
  30 + handleH5Data(JSON.parse(data?.data?.dataJson || '{}'))
  31 + break;
26 case 'changeNativeMessage': 32 case 'changeNativeMessage':
27 call("this is change Web Message") 33 call("this is change Web Message")
28 break; 34 break;
@@ -50,4 +56,7 @@ function getAppPublicInfo(): string { @@ -50,4 +56,7 @@ function getAppPublicInfo(): string {
50 return result; 56 return result;
51 } 57 }
52 58
  59 +function handleH5Data(content:ContentDTO) {
  60 + ProcessUtils.processPage(content)
  61 +}
53 62
1 import router from '@ohos.router'; 1 import router from '@ohos.router';
2 -import { Action } from 'wdBean';  
3 -import { ConfigConstants } from 'wdConstant';  
4 -import { Logger } from 'wdKit';  
5 -import { BridgeHandler, BridgeUtil, BridgeWebViewControl, Callback } from 'wdJsBridge'; 2 +import { BridgeUtil, BridgeWebViewControl, Callback } from 'wdJsBridge';
  3 +import { Logger } from 'wdKit/Index';
6 import { performJSCallNative } from './JsBridgeBiz'; 4 import { performJSCallNative } from './JsBridgeBiz';
7 -import { setDefaultNativeWebSettings } from './WebComponentUtil';  
8 -import { Message } from 'wdJsBridge/src/main/ets/bean/Message';  
9 import { H5CallNativeType } from './H5CallNativeType'; 5 import { H5CallNativeType } from './H5CallNativeType';
  6 +import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
10 7
11 -const TAG = 'WdWebComponent'; 8 +const TAG = 'WdWebLocalComponent';
12 9
13 @Component 10 @Component
14 export struct WdWebComponent { 11 export struct WdWebComponent {
15 - private webviewControl: BridgeWebViewControl = new BridgeWebViewControl()  
16 - //TODO 默认网页  
17 - webUrl: string | Resource = ConfigConstants.DETAIL_URL  
18 - /**  
19 - * 对外暴露webview的回调,能力  
20 - */  
21 - onPageBegin: (url?: string) => void = () => {  
22 - }  
23 - onPageEnd: (url?: string) => void = () => {  
24 - }  
25 - onLoadIntercept: (url?: string) => boolean = () => {  
26 - return false  
27 - }  
28 - onHttpErrorReceive: (url?: string) => boolean = () => {  
29 - return false  
30 - } 12 + webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
  13 + @Prop backVisibility: boolean = false
  14 + @Prop webUrl: string = ''
31 @Prop @Watch('onReloadStateChanged') reload: number = 0 15 @Prop @Watch('onReloadStateChanged') reload: number = 0
32 - /**  
33 - * 默认【CallNative】逻辑处理  
34 - */  
35 - private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => {  
36 - performJSCallNative(data, f)  
37 - }  
38 - /**  
39 - * jsBridge的处理  
40 - */  
41 - handleInfo: [string, BridgeHandler][] = []  
42 - backVisibility: boolean = false  
43 -  
44 - defaultRegisterHandler(): void {  
45 - this.webviewControl.registerHandler("CallNative", {  
46 - handle: (data: Message, f: Callback) => {  
47 - this.defaultPerformJSCallNative(data, f)  
48 - }  
49 - });  
50 -  
51 - }  
52 16
53 build() { 17 build() {
54 Column() { 18 Column() {
@@ -72,21 +36,13 @@ export struct WdWebComponent { @@ -72,21 +36,13 @@ export struct WdWebComponent {
72 .zoomAccess(false) 36 .zoomAccess(false)
73 .horizontalScrollBarAccess(false) 37 .horizontalScrollBarAccess(false)
74 .verticalScrollBarAccess(false) 38 .verticalScrollBarAccess(false)
75 - .onHttpErrorReceive((event) => {  
76 - //TODO 页面加载不成功的时候处理  
77 - Logger.info(TAG, 'onHttpErrorReceive event.request.getRequestUrl:' + event?.request.getRequestUrl());  
78 - Logger.info(TAG, 'onHttpErrorReceive event.response.getResponseCode:' + event?.response.getResponseCode()); 39 + .onPageBegin((event) => {
  40 + console.log(this.webUrl,"yzl")
  41 + this.onPageBegin(event?.url);
79 }) 42 })
80 .onPageEnd((event) => { 43 .onPageEnd((event) => {
81 this.onPageEnd(event?.url) 44 this.onPageEnd(event?.url)
82 }) 45 })
83 - .onPageBegin((event) => {  
84 - this.onPageBegin(event?.url);  
85 - this.registerHandlers();  
86 - setTimeout(() => {  
87 - BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)  
88 - }, 200)  
89 - })  
90 .onLoadIntercept((event) => { 46 .onLoadIntercept((event) => {
91 let url: string = event.data.getRequestUrl().toString() 47 let url: string = event.data.getRequestUrl().toString()
92 url = url.replace("%(?![0-9a-fA-F]{2})", "%25") 48 url = url.replace("%(?![0-9a-fA-F]{2})", "%25")
@@ -97,30 +53,51 @@ export struct WdWebComponent { @@ -97,30 +53,51 @@ export struct WdWebComponent {
97 return true 53 return true
98 } 54 }
99 if (url.startsWith(BridgeUtil.YY_OVERRIDE_SCHEMA)) { 55 if (url.startsWith(BridgeUtil.YY_OVERRIDE_SCHEMA)) {
  56 + Logger.debug(TAG, 'flushMessageQueue');
100 this.webviewControl.flushMessageQueue() 57 this.webviewControl.flushMessageQueue()
101 return true 58 return true
102 } 59 }
103 - return this.onLoadIntercept(event.data.getRequestUrl().toString()) 60 + return this.onLoadIntercept(event.data.getRequestUrl().toString());
104 }) 61 })
105 } 62 }
106 } 63 }
107 64
108 - onReloadStateChanged() {  
109 - Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`);  
110 - if (this.reload > 0) {  
111 - this.webviewControl.refresh()  
112 - }  
113 - }  
114 -  
115 private registerHandlers(): void { 65 private registerHandlers(): void {
116 // 注册h5调用js相关 66 // 注册h5调用js相关
117 for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) { 67 for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) {
118 let handleName = H5CallNativeType.JsCallTypeList[i]; 68 let handleName = H5CallNativeType.JsCallTypeList[i];
  69 + console.log('handleName:', handleName)
119 let handle = (data: Message, f: Callback) => { 70 let handle = (data: Message, f: Callback) => {
120 this.defaultPerformJSCallNative(data, f) 71 this.defaultPerformJSCallNative(data, f)
121 - } ; 72 + };
122 this.webviewControl.registerHandler(handleName, { handle: handle }); 73 this.webviewControl.registerHandler(handleName, { handle: handle });
123 } 74 }
124 } 75 }
  76 +
  77 + /**
  78 + * 默认【CallNative】逻辑处理
  79 + */
  80 + private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => {
  81 + performJSCallNative(data, f)
  82 + }
  83 + onPageBegin: (url?: string) => void = () => {
  84 + Logger.debug(TAG, 'onPageBegin');
  85 + this.registerHandlers();
  86 + BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)
  87 + }
  88 + onPageEnd: (url?: string) => void = () => {
  89 + Logger.debug(TAG, 'onPageEnd');
  90 + }
  91 + onLoadIntercept: (url?: string) => boolean = () => {
  92 + Logger.debug(TAG, 'onLoadIntercept return false');
  93 + return false
  94 + }
  95 + onReloadStateChanged() {
  96 + Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`);
  97 + if (this.reload > 0) {
  98 + this.webviewControl.refresh()
  99 + }
  100 + }
  101 +
125 } 102 }
126 103
@@ -11,9 +11,10 @@ const TAG = 'WdWebLocalComponent'; @@ -11,9 +11,10 @@ const TAG = 'WdWebLocalComponent';
11 11
12 @Component 12 @Component
13 export struct WdWebLocalComponent { 13 export struct WdWebLocalComponent {
14 - private webviewControl: BridgeWebViewControl = new BridgeWebViewControl()  
15 - backVisibility: boolean = false  
16 - webResource: Resource = {} as Resource 14 + webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
  15 + @Prop backVisibility: boolean = false
  16 + @Prop webResource: Resource = {} as Resource
  17 + @State webHeight : string = '100%'
17 18
18 build() { 19 build() {
19 Column() { 20 Column() {
@@ -31,19 +32,16 @@ export struct WdWebLocalComponent { @@ -31,19 +32,16 @@ export struct WdWebLocalComponent {
31 .visibility(this.backVisibility ? Visibility.Visible : Visibility.None) 32 .visibility(this.backVisibility ? Visibility.Visible : Visibility.None)
32 33
33 Web({ src: this.webResource, controller: this.webviewControl }) 34 Web({ src: this.webResource, controller: this.webviewControl })
34 - .layoutMode(WebLayoutMode.FIT_CONTENT)  
35 .domStorageAccess(true) 35 .domStorageAccess(true)
36 .databaseAccess(true) 36 .databaseAccess(true)
37 .javaScriptAccess(true) 37 .javaScriptAccess(true)
38 - // .imageAccess(true)  
39 - // .onlineImageAccess(true)  
40 - // .fileAccess(true) 38 + .imageAccess(true)
  39 + .mixedMode(MixedMode.All)
  40 + .onlineImageAccess(true)
  41 + .enableNativeEmbedMode(true)
  42 + .height(this.webHeight === '100%' ? '100%' : Number(this.webHeight))
41 .onPageBegin((event) => { 43 .onPageBegin((event) => {
42 this.onPageBegin(event?.url); 44 this.onPageBegin(event?.url);
43 - this.registerHandlers();  
44 - setTimeout(() => {  
45 - BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)  
46 - }, 200)  
47 }) 45 })
48 .onPageEnd((event) => { 46 .onPageEnd((event) => {
49 this.onPageEnd(event?.url) 47 this.onPageEnd(event?.url)
@@ -72,12 +70,20 @@ export struct WdWebLocalComponent { @@ -72,12 +70,20 @@ export struct WdWebLocalComponent {
72 for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) { 70 for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) {
73 let handleName = H5CallNativeType.JsCallTypeList[i]; 71 let handleName = H5CallNativeType.JsCallTypeList[i];
74 let handle = (data: Message, f: Callback) => { 72 let handle = (data: Message, f: Callback) => {
  73 + this.setCurrentPageOperate(data)
75 this.defaultPerformJSCallNative(data, f) 74 this.defaultPerformJSCallNative(data, f)
76 - } ; 75 + };
77 this.webviewControl.registerHandler(handleName, { handle: handle }); 76 this.webviewControl.registerHandler(handleName, { handle: handle });
78 } 77 }
79 } 78 }
80 79
  80 + //webview 高度设置
  81 + private setCurrentPageOperate: (data: Message) => void = (data) => {
  82 + console.log("setCurrentPageOperate",JSON.stringify(data))
  83 + if (data.handlerName === H5CallNativeType.jsCall_currentPageOperate) {
  84 + this.webHeight = data?.data?.webViewHeight || '100%'
  85 + }
  86 + }
81 /** 87 /**
82 * 默认【CallNative】逻辑处理 88 * 默认【CallNative】逻辑处理
83 */ 89 */
@@ -86,6 +92,10 @@ export struct WdWebLocalComponent { @@ -86,6 +92,10 @@ export struct WdWebLocalComponent {
86 } 92 }
87 onPageBegin: (url?: string) => void = () => { 93 onPageBegin: (url?: string) => void = () => {
88 Logger.debug(TAG, 'onPageBegin'); 94 Logger.debug(TAG, 'onPageBegin');
  95 + this.registerHandlers();
  96 + // setTimeout(() => {
  97 + BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)
  98 + // }, 100)
89 } 99 }
90 onPageEnd: (url?: string) => void = () => { 100 onPageEnd: (url?: string) => void = () => {
91 Logger.debug(TAG, 'onPageEnd'); 101 Logger.debug(TAG, 'onPageEnd');
@@ -69,6 +69,8 @@ export interface ContentDTO { @@ -69,6 +69,8 @@ export interface ContentDTO {
69 isSelect: boolean; 69 isSelect: boolean;
70 rmhInfo: RmhInfoDTO; // 人民号信息 70 rmhInfo: RmhInfoDTO; // 人民号信息
71 photoNum: number; 71 photoNum: number;
72 -  
73 - 72 + corner: string;
  73 + rmhPlatform: number;
  74 + newTags: string;
  75 + isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据
74 } 76 }
@@ -43,20 +43,14 @@ export { ImageAndTextWebComponent } from "./src/main/ets/components/ImageAndText @@ -43,20 +43,14 @@ export { ImageAndTextWebComponent } from "./src/main/ets/components/ImageAndText
43 43
44 export { DetailViewModel } from "./src/main/ets/viewmodel/DetailViewModel" 44 export { DetailViewModel } from "./src/main/ets/viewmodel/DetailViewModel"
45 45
46 -export { SingleImageCardComponent } from "./src/main/ets/components/view/SingleImageCardComponent"  
47 -  
48 -export { TriPicCardComponent } from "./src/main/ets/components/view/TriPicCardComponent"  
49 -  
50 export { BigPicCardComponent } from "./src/main/ets/components/view/BigPicCardComponent" 46 export { BigPicCardComponent } from "./src/main/ets/components/view/BigPicCardComponent"
51 47
52 -export { HeadPictureCardComponent } from "./src/main/ets/components/view/HeadPictureCardComponent"  
53 -  
54 -export { ZhGridLayoutComponent } from "./src/main/ets/components/view/ZhGridLayoutComponent"  
55 -  
56 export { MultiPictureDetailPageComponent } from "./src/main/ets/components/MultiPictureDetailPageComponent" 48 export { MultiPictureDetailPageComponent } from "./src/main/ets/components/MultiPictureDetailPageComponent"
57 49
58 export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailComponent" 50 export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailComponent"
59 51
  52 +export { AudioSuspensionModel } from "./src/main/ets/viewmodel/AudioSuspensionModel"
  53 +
60 export { BroadcastPageComponent } from "./src/main/ets/components/broadcast/BroadcastPageComponent" 54 export { BroadcastPageComponent } from "./src/main/ets/components/broadcast/BroadcastPageComponent"
61 55
62 export { FirstTabTopSearchComponent } from "./src/main/ets/components/search/FirstTabTopSearchComponent" 56 export { FirstTabTopSearchComponent } from "./src/main/ets/components/search/FirstTabTopSearchComponent"
@@ -12,6 +12,7 @@ import { Card17Component } from './cardview/Card17Component'; @@ -12,6 +12,7 @@ import { Card17Component } from './cardview/Card17Component';
12 import { Card15Component } from './cardview/Card15Component'; 12 import { Card15Component } from './cardview/Card15Component';
13 import { Card19Component } from './cardview/Card19Component'; 13 import { Card19Component } from './cardview/Card19Component';
14 import { Card20Component } from './cardview/Card20Component'; 14 import { Card20Component } from './cardview/Card20Component';
  15 +import { Card21Component } from './cardview/Card21Component';
15 16
16 /** 17 /**
17 * card适配器,卡片样式汇总,依据ContentDTO#appStyle 18 * card适配器,卡片样式汇总,依据ContentDTO#appStyle
@@ -52,6 +53,8 @@ export struct CardParser { @@ -52,6 +53,8 @@ export struct CardParser {
52 Card19Component({ contentDTO }) 53 Card19Component({ contentDTO })
53 } else if (contentDTO.appStyle === CompStyle.Card_20) { 54 } else if (contentDTO.appStyle === CompStyle.Card_20) {
54 Card20Component({ contentDTO }) 55 Card20Component({ contentDTO })
  56 + } else if (contentDTO.appStyle === CompStyle.Card_21) {
  57 + Card21Component({ contentDTO })
55 } 58 }
56 else { 59 else {
57 // todo:组件未实现 / Component Not Implemented 60 // todo:组件未实现 / Component Not Implemented
@@ -22,13 +22,6 @@ import { PageRepository } from '../repository/PageRepository'; @@ -22,13 +22,6 @@ import { PageRepository } from '../repository/PageRepository';
22 22
23 const TAG = 'ImageAndTextPageComponent' 23 const TAG = 'ImageAndTextPageComponent'
24 24
25 -export interface OperationItem {  
26 - icon: Resource;  
27 - icon_check?: Resource;  
28 - text: string | Resource;  
29 - num?: number; // 个数  
30 -}  
31 -  
32 @Component 25 @Component
33 export struct ImageAndTextPageComponent { 26 export struct ImageAndTextPageComponent {
34 scroller: Scroller = new Scroller(); 27 scroller: Scroller = new Scroller();
@@ -37,7 +30,6 @@ export struct ImageAndTextPageComponent { @@ -37,7 +30,6 @@ export struct ImageAndTextPageComponent {
37 @State recommendList: ContentDTO[] = [] 30 @State recommendList: ContentDTO[] = []
38 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 31 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
39 @State interactData: InteractDataDTO = {} as InteractDataDTO 32 @State interactData: InteractDataDTO = {} as InteractDataDTO
40 -  
41 build() { 33 build() {
42 Column() { 34 Column() {
43 // 发布时间 35 // 发布时间
@@ -64,66 +56,28 @@ export struct ImageAndTextPageComponent { @@ -64,66 +56,28 @@ export struct ImageAndTextPageComponent {
64 .objectFit(ImageFit.Cover) 56 .objectFit(ImageFit.Cover)
65 .margin({ top: 10 }) 57 .margin({ top: 10 })
66 } 58 }
67 - .padding({ left: 15, right: 15, }) 59 + .padding({ left: 15, right: 15 })
68 .backgroundColor(Color.White) 60 .backgroundColor(Color.White)
69 61
70 Stack({ alignContent: Alignment.Bottom }) { 62 Stack({ alignContent: Alignment.Bottom }) {
71 - List() {  
72 - //详情展示区  
73 - ListItem() { 63 + Scroll(this.scroller) {
74 Column() { 64 Column() {
75 ImageAndTextWebComponent({ 65 ImageAndTextWebComponent({
76 contentDetailData: this.contentDetailData, 66 contentDetailData: this.contentDetailData,
77 - action: this.action, 67 + action: this.action
78 }) 68 })
79 - }.width(CommonConstants.FULL_WIDTH)  
80 - .height(CommonConstants.FULL_HEIGHT) 69 + Column() {
  70 + if (this.recommendList.length > 0) {
  71 + RecommendList({ recommendList: this.recommendList })
81 } 72 }
82 -  
83 - if (this.contentDetailData[0]?.openLikes === 1) {  
84 - ListItem() {  
85 - // 点赞  
86 - Row() {  
87 - Row() {  
88 - if (this.newsStatusOfUser?.likeStatus === '1') {  
89 - 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')))  
90 - .width(24)  
91 - .height(24)  
92 - .margin({ right: 5 })  
93 - } else {  
94 - 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')))  
95 - .width(24)  
96 - .height(24)  
97 - .margin({ right: 5 })  
98 - }  
99 - Text(`${this.interactData?.likeNum || 0}`)  
100 - .fontSize(16)  
101 - .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')  
102 - .fontWeight(500)  
103 - }.alignItems(VerticalAlign.Center)  
104 - .onClick(() => {  
105 - this.toggleLikeStatus()  
106 - })  
107 -  
108 - }.width(CommonConstants.FULL_WIDTH).height(80)  
109 - .justifyContent(FlexAlign.Center)  
110 } 73 }
111 - .border({  
112 - width: { bottom: 5 },  
113 - color: '#f5f5f5',  
114 - })  
115 } 74 }
116 75
117 - // 相关推荐区  
118 - ListItem() {  
119 - RecommendList({ recommendList: this.recommendList })  
120 - }  
121 } 76 }
122 .width(CommonConstants.FULL_WIDTH) 77 .width(CommonConstants.FULL_WIDTH)
123 .height(CommonConstants.FULL_HEIGHT) 78 .height(CommonConstants.FULL_HEIGHT)
124 - .padding({ bottom: 56 })  
125 - .scrollBar(BarState.Off)  
126 - .edgeEffect(EdgeEffect.None) 79 + .padding({ bottom: 76 })
  80 + // .scrollBar(BarState.Off)
127 81
128 //底部交互区 82 //底部交互区
129 Row() { 83 Row() {
@@ -163,11 +117,143 @@ export struct ImageAndTextPageComponent { @@ -163,11 +117,143 @@ export struct ImageAndTextPageComponent {
163 .justifyContent(FlexAlign.SpaceBetween) 117 .justifyContent(FlexAlign.SpaceBetween)
164 .backgroundColor(Color.White) 118 .backgroundColor(Color.White)
165 } 119 }
166 - }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)  
167 - .backgroundColor(Color.White)  
168 - 120 + }
  121 + .width(CommonConstants.FULL_WIDTH)
  122 + .height(CommonConstants.FULL_HEIGHT)
169 } 123 }
170 124
  125 + // build() {
  126 + // Column() {
  127 + // // 发布时间
  128 + // Row() {
  129 + // Image($r('app.media.icon_ren_min_ri_bao'))
  130 + // .width(70)
  131 + // .height(28)
  132 + // Text(this.contentDetailData[0]?.publishTime)
  133 + // .fontColor($r('app.color.color_B0B0B0'))
  134 + // .fontSize($r('app.float.font_size_13'))
  135 + // .height('100%')
  136 + // .align(Alignment.End)
  137 + // }
  138 + // .width(CommonConstants.FULL_WIDTH)
  139 + // .height(32)
  140 + // .padding({ left: 15, right: 15, })
  141 + // .justifyContent(FlexAlign.SpaceBetween)
  142 + // .backgroundColor(Color.White)
  143 + //
  144 + // Row() {
  145 + // Image($r('app.media.line'))
  146 + // .width('100%')
  147 + // .height(6)
  148 + // .objectFit(ImageFit.Cover)
  149 + // .margin({ top: 10 })
  150 + // }
  151 + // .padding({ left: 15, right: 15, })
  152 + // .backgroundColor(Color.White)
  153 + //
  154 + // Stack({ alignContent: Alignment.Bottom }) {
  155 + //
  156 + // List() {
  157 + // //详情展示区
  158 + // ListItem() {
  159 + // Column() {
  160 + // ImageAndTextWebComponent({
  161 + // contentDetailData: this.contentDetailData,
  162 + // action: this.action,
  163 + // })
  164 + // }.width(CommonConstants.FULL_WIDTH)
  165 + // // .height(CommonConstants.FULL_HEIGHT)
  166 + // }
  167 + //
  168 + // if (this.contentDetailData[0]?.openLikes === 1) {
  169 + // ListItem() {
  170 + // // 点赞
  171 + // Row() {
  172 + // Row() {
  173 + // if (this.newsStatusOfUser?.likeStatus === '1') {
  174 + // 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')))
  175 + // .width(24)
  176 + // .height(24)
  177 + // .margin({ right: 5 })
  178 + // } else {
  179 + // 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')))
  180 + // .width(24)
  181 + // .height(24)
  182 + // .margin({ right: 5 })
  183 + // }
  184 + // Text(`${this.interactData?.likeNum || 0}`)
  185 + // .fontSize(16)
  186 + // .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')
  187 + // .fontWeight(500)
  188 + // }.alignItems(VerticalAlign.Center)
  189 + // .onClick(() => {
  190 + // this.toggleLikeStatus()
  191 + // })
  192 + //
  193 + // }.width(CommonConstants.FULL_WIDTH).height(80)
  194 + // .justifyContent(FlexAlign.Center)
  195 + // }
  196 + // .border({
  197 + // width: { bottom: 5 },
  198 + // color: '#f5f5f5',
  199 + // })
  200 + // }
  201 + //
  202 + // // 相关推荐区
  203 + // ListItem() {
  204 + // RecommendList({ recommendList: this.recommendList })
  205 + // }
  206 + // }
  207 + // .width(CommonConstants.FULL_WIDTH)
  208 + // .height(CommonConstants.FULL_HEIGHT)
  209 + // .padding({ bottom: 56 })
  210 + // .scrollBar(BarState.Off)
  211 + // .edgeEffect(EdgeEffect.None)
  212 + //
  213 + // //底部交互区
  214 + // Row() {
  215 + // Image($r('app.media.icon_arrow_left'))
  216 + // .width(24)
  217 + // .height(24)
  218 + // .onClick((event: ClickEvent) => {
  219 + // router.back()
  220 + // })
  221 + //
  222 + // Row() {
  223 + // Image($r('app.media.icon_comment'))
  224 + // .width(24)
  225 + // .height(24)
  226 + // .margin({ right: 24 })
  227 + // .id('comment')
  228 + //
  229 + // Image($r('app.media.icon_star'))
  230 + // .width(24)
  231 + // .height(24)
  232 + // .margin({ right: 24 })
  233 + //
  234 + // Image($r('app.media.icon_listen'))
  235 + // .width(24)
  236 + // .height(24)
  237 + // .margin({ right: 24 })
  238 + //
  239 + // Image($r('app.media.icon_forward'))
  240 + // .width(24)
  241 + // .height(24)
  242 + //
  243 + // }
  244 + // }
  245 + // .width(CommonConstants.FULL_WIDTH)
  246 + // .height(56)
  247 + // .padding({ left: 15, right: 15, bottom: 50, top: 20 })
  248 + // .justifyContent(FlexAlign.SpaceBetween)
  249 + // .backgroundColor(Color.White)
  250 + // }
  251 + //
  252 + // }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
  253 + // .backgroundColor(Color.White)
  254 + //
  255 + // }
  256 +
171 private async getDetail() { 257 private async getDetail() {
172 let contentId: string = '' 258 let contentId: string = ''
173 let relId: string = '' 259 let relId: string = ''
@@ -199,7 +285,6 @@ export struct ImageAndTextPageComponent { @@ -199,7 +285,6 @@ export struct ImageAndTextPageComponent {
199 } 285 }
200 } 286 }
201 287
202 -  
203 private async getRecommend() { 288 private async getRecommend() {
204 let params: postRecommendListParams = { 289 let params: postRecommendListParams = {
205 imei: "8272c108-4fa2-34ce-80b9-bc425a7c2a7e", 290 imei: "8272c108-4fa2-34ce-80b9-bc425a7c2a7e",
@@ -211,10 +296,8 @@ export struct ImageAndTextPageComponent { @@ -211,10 +296,8 @@ export struct ImageAndTextPageComponent {
211 channelId: String(this.contentDetailData[0]?.reLInfo?.channelId) 296 channelId: String(this.contentDetailData[0]?.reLInfo?.channelId)
212 } 297 }
213 let recommendList = await DetailViewModel.postRecommendList(params) 298 let recommendList = await DetailViewModel.postRecommendList(params)
214 - if (recommendList && recommendList.length > 0) {  
215 this.recommendList = recommendList; 299 this.recommendList = recommendList;
216 } 300 }
217 - }  
218 301
219 // 已登录->查询用户对作品点赞、收藏状态 302 // 已登录->查询用户对作品点赞、收藏状态
220 private async getInteractDataStatus() { 303 private async getInteractDataStatus() {
1 -import { Action, ContentDetailDTO, ContentDTO, batchLikeAndCollectResult, InteractDataDTO, } from 'wdBean'; 1 +import { Action, ContentDetailDTO, } from 'wdBean';
2 import DetailViewModel from '../viewmodel/DetailViewModel'; 2 import DetailViewModel from '../viewmodel/DetailViewModel';
3 -import { OperRowListView } from './view/OperRowListView';  
4 import { WdWebComponent } from 'wdWebComponent'; 3 import { WdWebComponent } from 'wdWebComponent';
5 import router from '@ohos.router'; 4 import router from '@ohos.router';
6 import { CommonConstants } from 'wdConstant' 5 import { CommonConstants } from 'wdConstant'
  6 +import { BridgeWebViewControl } from 'wdJsBridge/Index';
7 7
8 const TAG = 'SpacialTopicPageComponent' 8 const TAG = 'SpacialTopicPageComponent'
9 9
10 @Component 10 @Component
11 export struct SpacialTopicPageComponent { 11 export struct SpacialTopicPageComponent {
  12 + webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
12 scroller: Scroller = new Scroller(); 13 scroller: Scroller = new Scroller();
13 action: Action = {} as Action 14 action: Action = {} as Action
14 - private webUrl?: string;  
15 - @State contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO []  
16 - @State recommendList: ContentDTO[] = []  
17 - @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态  
18 - @State interactData: InteractDataDTO = {} as InteractDataDTO  
19 - 15 + @State webUrl: string = '';
20 build() { 16 build() {
21 Column() { 17 Column() {
22 Stack({ alignContent: Alignment.Bottom }) { 18 Stack({ alignContent: Alignment.Bottom }) {
23 Column() { 19 Column() {
24 WdWebComponent({ 20 WdWebComponent({
  21 + webviewControl: this.webviewControl,
25 webUrl: this.webUrl, 22 webUrl: this.webUrl,
26 - backVisibility: false 23 + backVisibility: false,
27 }) 24 })
28 } 25 }
29 - .padding({bottom:56}) 26 + .padding({ bottom: 56 })
30 .width(CommonConstants.FULL_WIDTH) 27 .width(CommonConstants.FULL_WIDTH)
31 .height(CommonConstants.FULL_HEIGHT) 28 .height(CommonConstants.FULL_HEIGHT)
32 29
@@ -72,36 +69,11 @@ export struct SpacialTopicPageComponent { @@ -72,36 +69,11 @@ export struct SpacialTopicPageComponent {
72 .backgroundColor(Color.White) 69 .backgroundColor(Color.White)
73 } 70 }
74 71
75 - // private async getDetail() {  
76 - // let contentId: string = ''  
77 - // let relId: string = ''  
78 - // let relType: string = ''  
79 - // if (this.action && this.action.params) {  
80 - // if (this.action.params.contentID) {  
81 - // contentId = this.action.params.contentID;  
82 - // }  
83 - // if (this.action && this.action.params && this.action.params.extra) {  
84 - // if (this.action.params.extra.relId) {  
85 - // relId = this.action.params.extra.relId;  
86 - // }  
87 - // if (this.action.params.extra.relType) {  
88 - // relType = this.action.params.extra.relType  
89 - // }  
90 - //  
91 - // }  
92 - // let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)  
93 - // if (detailBeans && detailBeans.length > 0) {  
94 - // this.contentDetailData = detailBeans;  
95 - // }  
96 - // }  
97 - // }  
98 -  
99 aboutToAppear() { 72 aboutToAppear() {
100 let action: Action = router.getParams() as Action 73 let action: Action = router.getParams() as Action
101 if (action) { 74 if (action) {
102 - this.webUrl = action.params?.url 75 + this.webUrl = action.params?.url || ''
103 } 76 }
104 - // this.getDetail()  
105 } 77 }
106 78
107 aboutToDisappear() { 79 aboutToDisappear() {
@@ -10,56 +10,60 @@ import { DateTimeUtils } from 'wdKit/Index' @@ -10,56 +10,60 @@ import { DateTimeUtils } from 'wdKit/Index'
10 @Component 10 @Component
11 export struct CardMediaInfo { 11 export struct CardMediaInfo {
12 @State contentDTO: ContentDTO = {} as ContentDTO // 如果有duraion,代表点播,显示时长;如果不传或者传0,显示直播中 12 @State contentDTO: ContentDTO = {} as ContentDTO // 如果有duraion,代表点播,显示时长;如果不传或者传0,显示直播中
  13 +
13 // objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频, 14 // objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,
14 // 14动态图文,15动态视频16问政;100人民号,101标签 15 // 14动态图文,15动态视频16问政;100人民号,101标签
15 16
16 build() { 17 build() {
17 Row() { 18 Row() {
18 - if(this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15' ) { 19 + if (this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15') {
19 // 点播、动态视频 20 // 点播、动态视频
20 - Row(){  
21 - Image($r('app.media.videoTypeIcon')) 21 + Row() {
  22 + Image($r('app.media.card_play'))
22 .mediaLogo() 23 .mediaLogo()
23 Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000)) 24 Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000))
24 .mediaText() 25 .mediaText()
25 } 26 }
26 - .backgroundColor('#4d000000')  
27 - .borderRadius($r('app.float.button_border_radius'))  
28 - } else if(this.contentDTO.objectType === '2') { 27 + } else if (this.contentDTO.objectType === '2') {
29 // liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 28 // liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
30 // 显示直播信息 29 // 显示直播信息
31 - Row(){  
32 - if(this.contentDTO.liveInfo.liveState === 'running') {  
33 - Image($r('app.media.icon_live')) 30 + Row() {
  31 + if(this.contentDTO.liveInfo.liveState === 'wait') {
  32 + Image($r('app.media.card_wait'))
  33 + .mediaLogo()
  34 + Text('预约')
  35 + .mediaText()
  36 + } else if (this.contentDTO.liveInfo.liveState === 'running') {
  37 + Image($r('app.media.card_live'))
34 .mediaLogo() 38 .mediaLogo()
35 Text('直播中') 39 Text('直播中')
36 .mediaText() 40 .mediaText()
37 - } else if(this.contentDTO.liveInfo.liveState === 'end'){  
38 - Image($r('app.media.videoTypeIcon')) 41 + } else if (this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo.replayUri) {
  42 + Image($r('app.media.card_play'))
39 .mediaLogo() 43 .mediaLogo()
40 Text('回看') 44 Text('回看')
41 .mediaText() 45 .mediaText()
  46 + } else if(this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo
  47 + .replayUri) {
  48 + // Image($r('app.media.card_live'))
  49 + // .mediaLogo()
  50 + Text('直播结束')
  51 + .mediaText()
42 } 52 }
43 } 53 }
44 - .backgroundColor('#4d000000')  
45 - .borderRadius($r('app.float.button_border_radius'))  
46 - } else if(this.contentDTO.objectType === '9') { 54 + } else if (this.contentDTO.objectType === '9') {
47 // 显示组图;图片数量 55 // 显示组图;图片数量
48 - Row(){  
49 - Image($r('app.media.album_card_shape')) 56 + Row() {
  57 + Image($r('app.media.card_image'))
50 .mediaLogo() 58 .mediaLogo()
51 Text(`${this.contentDTO.photoNum}`) 59 Text(`${this.contentDTO.photoNum}`)
52 .mediaText() 60 .mediaText()
53 - .width(20)  
54 } 61 }
55 - .backgroundColor('#4d000000')  
56 - .borderRadius($r('app.float.button_border_radius'))  
57 - } else if(this.contentDTO.objectType === '13') { 62 + } else if (this.contentDTO.objectType === '13') {
58 // 显示音频信息 63 // 显示音频信息
59 - Row(){  
60 - Image($r('app.media.broadcast_listen'))  
61 - .height(14)  
62 - .borderRadius($r('app.float.button_border_radius')) 64 + Row() {
  65 + Image($r('app.media.card_audio'))
  66 + .mediaLogo()
63 Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000)) 67 Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000))
64 .mediaText() 68 .mediaText()
65 } 69 }
@@ -68,18 +72,27 @@ export struct CardMediaInfo { @@ -68,18 +72,27 @@ export struct CardMediaInfo {
68 .margin(6) 72 .margin(6)
69 } 73 }
70 74
71 - @Styles mediaLogo() {  
72 - .width(22)  
73 - .height(18)  
74 - .borderRadius($r('app.float.button_border_radius')) 75 + @Styles
  76 + mediaLogo() {
  77 + .width(14)
  78 + .height(14)
  79 + .margin({ right: 3 })
  80 + .shadow({
  81 + radius: 2,
  82 + color: 'rgba(0,0,0,0.3)',
  83 + offsetY: 2
  84 + })
75 } 85 }
76 } 86 }
77 87
78 -@Extend(Text) function mediaText() { 88 +@Extend(Text)
  89 +function mediaText() {
79 .fontColor($r('app.color.color_fff')) 90 .fontColor($r('app.color.color_fff'))
80 - .fontSize($r('app.float.font_size_12'))  
81 - .width(40)  
82 - .height(18)  
83 - .textAlign(TextAlign.Center)  
84 - .margin({ left: -3 }) 91 + .fontSize($r('app.float.font_size_14'))
  92 + .lineHeight(18)
  93 + .textShadow({
  94 + radius: 2,
  95 + color: 'rgba(0,0,0,0.3)',
  96 + offsetY: 2
  97 + })
85 } 98 }
  1 +import { ContentDTO } from 'wdBean'
  2 +import { CommonConstants } from 'wdConstant/Index';
  3 +import { DateTimeUtils } from 'wdKit/Index';
  4 +
  5 +@Component
  6 +export struct CardSourceInfo {
  7 + @State contentDTO: ContentDTO = {} as ContentDTO;
  8 + build() {
  9 + Flex() {
  10 + if(this.contentDTO.corner) {
  11 + Text(this.contentDTO.corner)
  12 + .fontSize($r("app.float.font_size_12"))
  13 + .fontColor($r("app.color.color_ED2800"))
  14 + .margin({right: 2})
  15 + }
  16 + if(this.contentDTO.rmhPlatform === 1) {
  17 + Text(this.contentDTO.rmhInfo.rmhName)
  18 + .fontSize($r("app.float.font_size_12"))
  19 + .fontColor($r("app.color.color_B0B0B0"))
  20 + .maxLines(1)
  21 + .textOverflow({overflow: TextOverflow.Ellipsis})
  22 + Image($r("app.media.point"))
  23 + .width(16)
  24 + .height(16)
  25 + } else if(this.contentDTO.source) {
  26 + Text(`${this.contentDTO.source}`)
  27 + .fontSize($r("app.float.font_size_12"))
  28 + .fontColor($r("app.color.color_B0B0B0"))
  29 + .maxLines(1)
  30 + .textOverflow({overflow: TextOverflow.Ellipsis})
  31 + }
  32 + // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间
  33 + if(this.contentDTO.isSearch || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime
  34 + (Number
  35 + .parseFloat(this
  36 + .contentDTO.publishTime))
  37 + .indexOf
  38 + ('-') === -1) {
  39 + Image($r("app.media.point"))
  40 + .width(16)
  41 + .height(16)
  42 + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))
  43 + .fontSize($r("app.float.font_size_12"))
  44 + .fontColor($r("app.color.color_B0B0B0"))
  45 + .margin({ right: 6 })
  46 + .flexShrink(0)
  47 + }
  48 + if(this.contentDTO?.interactData?.commentNum) {
  49 + Text(`${this.contentDTO.interactData.commentNum}评`)
  50 + .fontSize($r("app.float.font_size_12"))
  51 + .fontColor($r("app.color.color_B0B0B0"))
  52 + .flexShrink(0)
  53 + }
  54 + }
  55 + .width(CommonConstants.FULL_WIDTH)
  56 + .margin({ top: 8 })
  57 + }
  58 +}
@@ -2,7 +2,8 @@ import { ContentDTO, slideShows } from 'wdBean'; @@ -2,7 +2,8 @@ import { ContentDTO, slideShows } from 'wdBean';
2 import { CommonConstants } from 'wdConstant' 2 import { CommonConstants } from 'wdConstant'
3 import { DateTimeUtils } from 'wdKit'; 3 import { DateTimeUtils } from 'wdKit';
4 import { ProcessUtils } from '../../utils/ProcessUtils'; 4 import { ProcessUtils } from '../../utils/ProcessUtils';
5 - 5 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
  6 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
6 7
7 /** 8 /**
8 * 大专题卡--CompStyle: 10 9 * 大专题卡--CompStyle: 10
@@ -76,10 +77,10 @@ export struct Card10Component { @@ -76,10 +77,10 @@ export struct Card10Component {
76 } 77 }
77 .width(CommonConstants.FULL_WIDTH) 78 .width(CommonConstants.FULL_WIDTH)
78 .padding({ 79 .padding({
79 - top: 14,  
80 - left: 16,  
81 - right: 16,  
82 - bottom: 14 80 + left: $r('app.float.card_comp_pagePadding_lf'),
  81 + right: $r('app.float.card_comp_pagePadding_lf'),
  82 + top: $r('app.float.card_comp_pagePadding_tb'),
  83 + bottom: $r('app.float.card_comp_pagePadding_tb')
83 }) 84 })
84 .backgroundColor($r("app.color.white")) 85 .backgroundColor($r("app.color.white"))
85 .margin({ bottom: 8 }) 86 .margin({ bottom: 8 })
@@ -95,25 +96,14 @@ export struct Card10Component { @@ -95,25 +96,14 @@ export struct Card10Component {
95 .fontColor($r('app.color.color_222222')) 96 .fontColor($r('app.color.color_222222'))
96 .maxLines(2) 97 .maxLines(2)
97 .textOverflow({ overflow: TextOverflow.Ellipsis }) 98 .textOverflow({ overflow: TextOverflow.Ellipsis })
98 - Row() {  
99 - // 展示发稿人  
100 - if (item.source) {  
101 - Text(item.source)  
102 - .fontSize($r('app.float.font_size_12'))  
103 - .fontColor($r('app.color.color_B0B0B0'))  
104 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
105 - .maxLines(1)  
106 - .width(item.source.length > 10 ? '60%' : '')  
107 -  
108 - Image($r('app.media.point'))  
109 - .width(16)  
110 - .height(16)  
111 - }  
112 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(String(item.publishTime))))  
113 - .fontSize($r("app.float.font_size_12"))  
114 - .fontColor($r("app.color.color_B0B0B0")) 99 + CardSourceInfo(
  100 + {
  101 + contentDTO: {
  102 + publishTime: item.publishTime || '',
  103 + source: item.source || ''
  104 + } as ContentDTO
115 } 105 }
116 - .margin({ top: 12 }) 106 + )
117 } 107 }
118 .layoutWeight(1) 108 .layoutWeight(1)
119 .alignItems(HorizontalAlign.Start) 109 .alignItems(HorizontalAlign.Start)
@@ -3,7 +3,7 @@ import { CommonConstants } from 'wdConstant' @@ -3,7 +3,7 @@ import { CommonConstants } from 'wdConstant'
3 import { ContentDTO } from 'wdBean' 3 import { ContentDTO } from 'wdBean'
4 import { DateTimeUtils } from 'wdKit' 4 import { DateTimeUtils } from 'wdKit'
5 import { ProcessUtils } from '../../utils/ProcessUtils'; 5 import { ProcessUtils } from '../../utils/ProcessUtils';
6 - 6 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
7 const TAG = 'Card11Component'; 7 const TAG = 'Card11Component';
8 8
9 /** 9 /**
@@ -21,29 +21,8 @@ export struct Card11Component { @@ -21,29 +21,8 @@ export struct Card11Component {
21 .maxLines(3) 21 .maxLines(3)
22 .textOverflow({ overflow: TextOverflow.Ellipsis }) 22 .textOverflow({ overflow: TextOverflow.Ellipsis })
23 .width(CommonConstants.FULL_WIDTH) 23 .width(CommonConstants.FULL_WIDTH)
24 - Row() {  
25 - if (this.contentDTO.source) {  
26 - Text(this.contentDTO.source)  
27 - .fontSize($r("app.float.font_size_12"))  
28 - .fontColor($r("app.color.color_B0B0B0"))  
29 - .margin({ left: 6 })  
30 - Image($r("app.media.point"))  
31 - .width(16)  
32 - .height(16)  
33 - }  
34 -  
35 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))  
36 - .fontSize($r("app.float.font_size_12"))  
37 - .fontColor($r("app.color.color_B0B0B0"))  
38 - .margin({ right: 6 })  
39 - // TODO '评论取哪个字段'  
40 - // Text(`1806评`)  
41 - // .fontSize($r("app.float.font_size_12"))  
42 - // .fontColor($r("app.color.color_B0B0B0"))  
43 - }.width(CommonConstants.FULL_WIDTH)  
44 - .justifyContent(FlexAlign.Start)  
45 - .margin({ top: 8 })  
46 - 24 + // 评论等信息
  25 + CardSourceInfo({ contentDTO: this.contentDTO })
47 }.width(CommonConstants.FULL_WIDTH) 26 }.width(CommonConstants.FULL_WIDTH)
48 .padding({ 27 .padding({
49 left: $r('app.float.card_comp_pagePadding_lf'), 28 left: $r('app.float.card_comp_pagePadding_lf'),
  1 +import { ContentDTO } from 'wdBean';
  2 +import { RmhTitle } from '../cardCommon/RmhTitle'
  3 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
  4 +import { CommonConstants } from 'wdConstant/Index';
  5 +
  6 +const TAG = 'Card12Component';
  7 +
  8 +/**
  9 + * 人民号-动态---12:人民号无图卡;
  10 + */
  11 +@Component
  12 +export struct Card12Component {
  13 + @State contentDTO: ContentDTO = {
  14 + appStyle: '20',
  15 + coverType: 1,
  16 + coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
  17 + fullColumnImgUrls: [
  18 + {
  19 + landscape: 1,
  20 + size: 1,
  21 + url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
  22 + weight: 1600
  23 + }
  24 + ],
  25 + newsTitle: '好玩!》10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
  26 + rmhInfo: {
  27 + authIcon:
  28 + 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',
  29 + authTitle: '10后音乐人王烁然个人人民号',
  30 + authTitle2: '10后音乐人王烁然个人人民号',
  31 + banControl: 0,
  32 + cnIsAttention: 1,
  33 + rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
  34 + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
  35 + rmhName: '王烁然',
  36 + userId: '522435359667845',
  37 + userType: '2'
  38 + },
  39 + objectType: '1',
  40 + videoInfo: {
  41 + firstFrameImageUri: '',
  42 + videoDuration: 37,
  43 + videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'
  44 + }
  45 + } as ContentDTO;
  46 +
  47 + aboutToAppear(): void {
  48 + }
  49 +
  50 + build() {
  51 + Column() {
  52 + // rmh信息
  53 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
  54 + // 标题
  55 + if (this.contentDTO.newsTitle) {
  56 + Text(this.contentDTO.newsTitle)
  57 + .fontSize($r('app.float.font_size_17'))
  58 + .fontColor($r('app.color.color_222222'))
  59 + .width(CommonConstants.FULL_WIDTH)
  60 + .textOverflowStyle(3)
  61 + .margin({ bottom: 8 })
  62 + .height(75)
  63 + .lineHeight(25)
  64 + .fontFamily('PingFang SC-Regular')
  65 + }
  66 +
  67 + // if (this.contentDTO.fullColumnImgUrls?.[0]) {
  68 + // createImg({ contentDTO: this.contentDTO })
  69 + // }
  70 + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
  71 + }
  72 + .padding({
  73 + left: $r('app.float.card_comp_pagePadding_lf'),
  74 + right: $r('app.float.card_comp_pagePadding_lf'),
  75 + top: $r('app.float.card_comp_pagePadding_tb'),
  76 + bottom: $r('app.float.card_comp_pagePadding_tb')
  77 + })
  78 + }
  79 +}
  80 +
  81 +interface radiusType {
  82 + topLeft: number | Resource;
  83 + topRight: number | Resource;
  84 + bottomLeft: number | Resource;
  85 + bottomRight: number | Resource;
  86 +}
  87 +
  88 +@Component
  89 +struct createImg {
  90 + @Prop contentDTO: ContentDTO
  91 +
  92 + build() {
  93 + GridRow() {
  94 + if (this.contentDTO.fullColumnImgUrls[0].landscape === 1) {
  95 + // 横屏
  96 + GridCol({
  97 + span: { xs: 12 }
  98 + }) {
  99 + Stack() {
  100 + Image(this.contentDTO.coverUrl)
  101 + .width(CommonConstants.FULL_WIDTH)
  102 + .aspectRatio(16 / 9)
  103 + .borderRadius($r('app.float.image_border_radius'))
  104 + CardMediaInfo({ contentDTO: this.contentDTO })
  105 + }
  106 + .align(Alignment.BottomEnd)
  107 + }
  108 + } else {
  109 + // 竖图显示,宽度占50%,高度自适应
  110 + GridCol({
  111 + span: { xs: 6 }
  112 + }) {
  113 + Stack() {
  114 + Image(this.contentDTO.coverUrl)
  115 + .width(CommonConstants.FULL_WIDTH)
  116 + .borderRadius($r('app.float.image_border_radius'))
  117 + CardMediaInfo({ contentDTO: this.contentDTO })
  118 + }
  119 + .align(Alignment.BottomEnd)
  120 + }
  121 + }
  122 + }
  123 + }
  124 +}
  125 +
  126 +
  127 +@Extend(Text)
  128 +function textOverflowStyle(maxLine: number) {
  129 + .maxLines(maxLine)
  130 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  131 +}
  1 +import { ContentDTO } from 'wdBean';
  2 +import { RmhTitle } from '../cardCommon/RmhTitle'
  3 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
  4 +import { CommonConstants } from 'wdConstant/Index';
  5 +
  6 +const TAG = 'Card14Component';
  7 +
  8 +/**
  9 + * 人民号-动态---14:人民号单图卡;
  10 + */
  11 +@Component
  12 +export struct Card14Component {
  13 + @State contentDTO: ContentDTO = {
  14 + // appStyle: '20',
  15 + // coverType: 1,
  16 + // coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
  17 + // fullColumnImgUrls: [
  18 + // {
  19 + // landscape: 1,
  20 + // size: 1,
  21 + // url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
  22 + // weight: 1600
  23 + // }
  24 + // ],
  25 + // newsTitle: '好玩!》10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
  26 + // rmhInfo: {
  27 + // authIcon:
  28 + // 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',
  29 + // authTitle: '10后音乐人王烁然个人人民号',
  30 + // authTitle2: '10后音乐人王烁然个人人民号',
  31 + // banControl: 0,
  32 + // cnIsAttention: 1,
  33 + // rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
  34 + // rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
  35 + // rmhName: '王烁然',
  36 + // userId: '522435359667845',
  37 + // userType: '2'
  38 + // },
  39 + // objectType: '1',
  40 + // videoInfo: {
  41 + // firstFrameImageUri: '',
  42 + // videoDuration: 37,
  43 + // videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'
  44 + // }
  45 + } as ContentDTO;
  46 +
  47 + aboutToAppear(): void {
  48 + }
  49 +
  50 + build() {
  51 + Column() {
  52 + // rmh信息
  53 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
  54 + // 左标题,右图
  55 + Flex({ direction: FlexDirection.Row }) {
  56 +
  57 + Text(this.contentDTO.newsTitle)
  58 + .fontSize($r('app.float.font_size_17'))
  59 + .fontColor($r('app.color.color_222222'))
  60 + .textOverflowStyle(3)
  61 + .lineHeight(25)
  62 + .fontFamily('PingFang SC-Regular')
  63 + .textAlign(TextAlign.Start)
  64 + .flexBasis('auto')
  65 + .margin({right: 12})
  66 +
  67 + Image(this.contentDTO.coverUrl)
  68 + .flexBasis(174)
  69 + .height(75)
  70 + .borderRadius($r('app.float.image_border_radius'))
  71 + // .flexBasis(160)
  72 + .backgroundImageSize(ImageSize.Auto)
  73 +
  74 + }
  75 + .width(CommonConstants.FULL_WIDTH)
  76 + .margin({ bottom: 8 })
  77 + .height(75)
  78 +
  79 +
  80 + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
  81 + }
  82 + .padding({
  83 + left: $r('app.float.card_comp_pagePadding_lf'),
  84 + right: $r('app.float.card_comp_pagePadding_lf'),
  85 + top: $r('app.float.card_comp_pagePadding_tb'),
  86 + bottom: $r('app.float.card_comp_pagePadding_tb')
  87 + })
  88 + }
  89 +}
  90 +
  91 +interface radiusType {
  92 + topLeft: number | Resource;
  93 + topRight: number | Resource;
  94 + bottomLeft: number | Resource;
  95 + bottomRight: number | Resource;
  96 +}
  97 +
  98 +@Extend(Text)
  99 +function textOverflowStyle(maxLine: number) {
  100 + .maxLines(maxLine)
  101 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  102 +}
  1 +import { ContentDTO } from 'wdBean';
  2 +import { RmhTitle } from '../cardCommon/RmhTitle'
  3 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
  4 +import { CommonConstants } from 'wdConstant/Index';
  5 +
  6 +const TAG = 'Card16Component';
  7 +
  8 +/**
  9 + * 人民号-动态---16:人民号三图卡;
  10 + */
  11 +@Component
  12 +export struct Card16Component {
  13 + @State contentDTO: ContentDTO = {
  14 + appStyle: '20',
  15 + coverType: 1,
  16 + coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90;https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90;https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
  17 + fullColumnImgUrls: [
  18 + {
  19 + landscape: 1,
  20 + size: 1,
  21 + url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
  22 + weight: 1600
  23 + }
  24 + ],
  25 + newsTitle: '好玩!》10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号',
  26 + rmhInfo: {
  27 + authIcon:
  28 + 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',
  29 + authTitle: '10后音乐人王烁然个人人民号',
  30 + authTitle2: '10后音乐人王烁然个人人民号',
  31 + banControl: 0,
  32 + cnIsAttention: 1,
  33 + rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
  34 + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
  35 + rmhName: '王烁然',
  36 + userId: '522435359667845',
  37 + userType: '2'
  38 + },
  39 + objectType: '1',
  40 + videoInfo: {
  41 + firstFrameImageUri: '',
  42 + videoDuration: 37,
  43 + videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'
  44 + }
  45 + } as ContentDTO;
  46 +
  47 + aboutToAppear(): void {
  48 + }
  49 +
  50 + build() {
  51 + Column() {
  52 + // rmh信息
  53 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
  54 + // 标题
  55 + if (this.contentDTO.newsTitle) {
  56 + Text(this.contentDTO.newsTitle)
  57 + .fontSize($r('app.float.font_size_17'))
  58 + .fontColor($r('app.color.color_222222'))
  59 + .width(CommonConstants.FULL_WIDTH)
  60 + .textOverflowStyle(2)
  61 + .margin({ bottom: 8 })
  62 + .lineHeight(25)
  63 + }
  64 + if (this.contentDTO.coverUrl) {
  65 + Flex() {
  66 + ForEach(this.contentDTO.coverUrl?.split(';'), (item: string) => {
  67 + Image(item).flexBasis(113).height(75).margin({right: 2})
  68 + })
  69 + }
  70 + }
  71 + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
  72 + }
  73 + .padding({
  74 + left: $r('app.float.card_comp_pagePadding_lf'),
  75 + right: $r('app.float.card_comp_pagePadding_lf'),
  76 + top: $r('app.float.card_comp_pagePadding_tb'),
  77 + bottom: $r('app.float.card_comp_pagePadding_tb')
  78 + })
  79 + }
  80 +}
  81 +
  82 +interface radiusType {
  83 + topLeft: number | Resource;
  84 + topRight: number | Resource;
  85 + bottomLeft: number | Resource;
  86 + bottomRight: number | Resource;
  87 +}
  88 +
  89 +@Component
  90 +struct createImg {
  91 + @Prop contentDTO: ContentDTO
  92 +
  93 + build() {
  94 + GridRow() {
  95 + if (this.contentDTO.fullColumnImgUrls[0].landscape === 1) {
  96 + // 横屏
  97 + GridCol({
  98 + span: { xs: 12 }
  99 + }) {
  100 + Stack() {
  101 + Image(this.contentDTO.coverUrl)
  102 + .width(CommonConstants.FULL_WIDTH)
  103 + .aspectRatio(16 / 9)
  104 + .borderRadius($r('app.float.image_border_radius'))
  105 + CardMediaInfo({ contentDTO: this.contentDTO })
  106 + }
  107 + .align(Alignment.BottomEnd)
  108 + }
  109 + } else {
  110 + // 竖图显示,宽度占50%,高度自适应
  111 + GridCol({
  112 + span: { xs: 6 }
  113 + }) {
  114 + Stack() {
  115 + Image(this.contentDTO.coverUrl)
  116 + .width(CommonConstants.FULL_WIDTH)
  117 + .borderRadius($r('app.float.image_border_radius'))
  118 + CardMediaInfo({ contentDTO: this.contentDTO })
  119 + }
  120 + .align(Alignment.BottomEnd)
  121 + }
  122 + }
  123 + }
  124 + }
  125 +}
  126 +
  127 +
  128 +@Extend(Text)
  129 +function textOverflowStyle(maxLine: number) {
  130 + .maxLines(maxLine)
  131 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  132 +}
@@ -4,7 +4,7 @@ import { CommonConstants } from 'wdConstant/Index'; @@ -4,7 +4,7 @@ import { CommonConstants } from 'wdConstant/Index';
4 import { DateTimeUtils } from 'wdKit'; 4 import { DateTimeUtils } from 'wdKit';
5 import { WDRouterRule } from 'wdRouter'; 5 import { WDRouterRule } from 'wdRouter';
6 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 6 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
7 - 7 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
8 const TAG = 'Card17Component'; 8 const TAG = 'Card17Component';
9 9
10 /** 10 /**
@@ -81,25 +81,8 @@ export struct Card17Component { @@ -81,25 +81,8 @@ export struct Card17Component {
81 }; 81 };
82 WDRouterRule.jumpWithAction(taskAction) 82 WDRouterRule.jumpWithAction(taskAction)
83 }) 83 })
84 -  
85 - Row() {  
86 - if (this.contentDTO.source) {  
87 - Text(this.contentDTO.source)  
88 - .fontSize($r('app.float.font_size_13'))  
89 - .fontColor($r('app.color.color_B0B0B0'))  
90 - Image($r('app.media.point'))  
91 - .width(16)  
92 - .height(16)  
93 - }  
94 - if (this.contentDTO.publishTime && this.contentDTO.publishTime.length === 13) {  
95 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))  
96 - .fontSize($r('app.float.font_size_13'))  
97 - .fontColor($r('app.color.color_B0B0B0'))  
98 - }  
99 - }  
100 - .width(CommonConstants.FULL_WIDTH)  
101 - .height(16)  
102 - .id('label') 84 + // 评论等信息
  85 + CardSourceInfo({ contentDTO: this.contentDTO })
103 } 86 }
104 .width(CommonConstants.FULL_WIDTH) 87 .width(CommonConstants.FULL_WIDTH)
105 .padding({ 88 .padding({
@@ -13,7 +13,7 @@ export struct Card19Component { @@ -13,7 +13,7 @@ export struct Card19Component {
13 // coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg', 13 // coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
14 // fullColumnImgUrls: [ 14 // fullColumnImgUrls: [
15 // { 15 // {
16 - // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/quality,q_90/auto-orient,1', 16 + // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994155727712256.png?x-oss-process=image/quality,q_90/auto-orient,1',
17 // height: 1500, 17 // height: 1500,
18 // landscape: 1, 18 // landscape: 1,
19 // size: 1, 19 // size: 1,
@@ -107,6 +107,8 @@ interface radiusType { @@ -107,6 +107,8 @@ interface radiusType {
107 @Component 107 @Component
108 struct createImg { 108 struct createImg {
109 @Prop fullColumnImgUrls: FullColumnImgUrlDTO[] 109 @Prop fullColumnImgUrls: FullColumnImgUrlDTO[]
  110 + @State picWidth: number = 0;
  111 + @State picHeight: number = 0;
110 aboutToAppear(): void { 112 aboutToAppear(): void {
111 if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位 113 if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位
112 this.fullColumnImgUrls.splice(2,0, { 114 this.fullColumnImgUrls.splice(2,0, {
@@ -137,18 +139,77 @@ struct createImg { @@ -137,18 +139,77 @@ struct createImg {
137 return radius 139 return radius
138 } 140 }
139 141
  142 + getPicType(){
  143 + if (this.picWidth && this.picWidth) {
  144 + if (this.picWidth / this.picHeight > 343/172) {
  145 + return 1; //横长图
  146 + } else if (this.picHeight / this.picWidth > 305/228) {
  147 + return 2; //竖长图
  148 + } else {
  149 + return 3
  150 + }
  151 + } else {
  152 + return 3; //普通图
  153 + }
  154 + }
  155 +
  156 +
140 build() { 157 build() {
141 GridRow({ 158 GridRow({
142 gutter: { x: 2, y: 2 } 159 gutter: { x: 2, y: 2 }
143 }) { 160 }) {
144 ForEach(this.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => { 161 ForEach(this.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => {
145 if (this.fullColumnImgUrls.length === 1) { 162 if (this.fullColumnImgUrls.length === 1) {
  163 + if (this.getPicType() !== 3) {
  164 + GridCol({
  165 + span: this.getPicType() === 1 ? 12 : 8
  166 + }){
  167 + Stack({
  168 + alignContent: Alignment.BottomEnd
  169 + }) {
  170 + if (this.getPicType() === 1) {
  171 + Image(item.fullUrl)
  172 + .width('100%')
  173 + .height(172)
  174 + .autoResize(true)
  175 + .borderRadius(this.caclImageRadius(index))
  176 + } else if (this.getPicType() === 2) {
  177 + Image(item.fullUrl)
  178 + .width('100%')
  179 + .height(305)
  180 + .autoResize(true)
  181 + .borderRadius(this.caclImageRadius(index))
  182 + }
  183 + Flex({ direction: FlexDirection.Row }) {
  184 + Image($r('app.media.icon_long_pic'))
  185 + .width(14)
  186 + .height(14)
  187 + .margin({right: 4})
  188 + Text('长图')
  189 + .fontSize(12)
  190 + .fontWeight(400)
  191 + .fontColor(0xffffff)
  192 + .fontFamily('PingFang SC')
  193 + }
  194 + .width(48)
  195 + .padding({bottom: 9})
  196 +
  197 + }
  198 + }
  199 + } else {
146 GridCol({ 200 GridCol({
147 span: { xs: 8 } 201 span: { xs: 8 }
148 }) { 202 }) {
149 Image(item.fullUrl) 203 Image(item.fullUrl)
150 .width('100%') 204 .width('100%')
151 .borderRadius(this.caclImageRadius(index)) 205 .borderRadius(this.caclImageRadius(index))
  206 + .autoResize(true)
  207 + .opacity(!this.picWidth && !this.picHeight ? 0 : 1)
  208 + .onComplete(callback => {
  209 + this.picWidth = callback?.width || 0;
  210 + this.picHeight = callback?.height || 0;
  211 + })
  212 + }
152 } 213 }
153 } else if (this.fullColumnImgUrls.length === 4) { 214 } else if (this.fullColumnImgUrls.length === 4) {
154 GridCol({ 215 GridCol({
  1 +import { ContentDTO } from 'wdBean';
  2 +import { CommonConstants, CompStyle } from 'wdConstant';
  3 +import { ProcessUtils } from '../../utils/ProcessUtils';
  4 +import { RmhTitle } from '../cardCommon/RmhTitle'
  5 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
  6 +
  7 +const TAG: string = 'Card6Component-Card13Component';
  8 +
  9 +/**
  10 + * 卡片样式:"appStyle":"21" 小视频卡人民号
  11 + */
  12 +@Component
  13 +export struct Card21Component {
  14 + @State contentDTO: ContentDTO = {} as ContentDTO;
  15 +
  16 + build() {
  17 + Column() {
  18 + // 顶部 rmh信息
  19 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
  20 + // 中间内容
  21 + Grid() {
  22 + GridItem() {
  23 + Text(`${this.contentDTO.newsTitle}`)
  24 + .fontSize($r('app.float.selected_text_size'))
  25 + .fontColor($r('app.color.color_222222'))
  26 + .width(CommonConstants.FULL_WIDTH)
  27 + .maxLines(4)
  28 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  29 + .padding({ right: 12 })
  30 + .lineHeight(26)
  31 + }
  32 +
  33 + GridItem() {
  34 + Stack() {
  35 + Image(this.contentDTO.coverUrl)
  36 + .width(CommonConstants.FULL_WIDTH)
  37 + .borderRadius($r('app.float.image_border_radius'))
  38 + CardMediaInfo({ contentDTO: this.contentDTO })
  39 + }
  40 + .alignContent(Alignment.BottomEnd)
  41 + }
  42 + }
  43 + .columnsTemplate('2fr 1fr')
  44 + .maxCount(1)
  45 +
  46 + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
  47 + }
  48 + .onClick((event: ClickEvent) => {
  49 + ProcessUtils.processPage(this.contentDTO)
  50 + })
  51 + .padding({
  52 + left: $r('app.float.card_comp_pagePadding_lf'),
  53 + right: $r('app.float.card_comp_pagePadding_lf'),
  54 + top: $r('app.float.card_comp_pagePadding_tb'),
  55 + bottom: $r('app.float.card_comp_pagePadding_tb')
  56 + })
  57 + .width(CommonConstants.FULL_WIDTH)
  58 + }
  59 +}
1 //全标题 "appStyle":"2", 1 //全标题 "appStyle":"2",
2 import { ContentDTO } from 'wdBean'; 2 import { ContentDTO } from 'wdBean';
3 import { CommonConstants } from 'wdConstant/Index'; 3 import { CommonConstants } from 'wdConstant/Index';
4 -import { DateTimeUtils } from 'wdKit/Index';  
5 import { ProcessUtils } from '../../utils/ProcessUtils'; 4 import { ProcessUtils } from '../../utils/ProcessUtils';
6 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
7 - 6 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
8 const TAG: string = 'Card2Component'; 7 const TAG: string = 'Card2Component';
9 8
10 /** 9 /**
@@ -60,21 +59,8 @@ export struct Card2Component { @@ -60,21 +59,8 @@ export struct Card2Component {
60 .alignItems(HorizontalAlign.Start) 59 .alignItems(HorizontalAlign.Start)
61 60
62 //bottom 61 //bottom
63 - Row() {  
64 - Text(this.contentDTO.source)  
65 - .bottomTextStyle()  
66 - //间隔点  
67 - Image($r('app.media.point'))  
68 - .width(12)  
69 - .height(12)  
70 -  
71 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))  
72 - .bottomTextStyle()  
73 - }  
74 - .width(CommonConstants.FULL_WIDTH)  
75 - .height(18)  
76 - .justifyContent(FlexAlign.Start)  
77 - .margin({ top: 8 }) 62 + // 评论等信息
  63 + CardSourceInfo({ contentDTO: this.contentDTO })
78 } 64 }
79 .width(CommonConstants.FULL_WIDTH) 65 .width(CommonConstants.FULL_WIDTH)
80 .padding({ 66 .padding({
1 import { ContentDTO } from 'wdBean'; 1 import { ContentDTO } from 'wdBean';
2 import { CommonConstants } from 'wdConstant' 2 import { CommonConstants } from 'wdConstant'
3 -import { DateTimeUtils } from 'wdKit/src/main/ets/utils/DateTimeUtils'  
4 import { ProcessUtils } from '../../utils/ProcessUtils'; 3 import { ProcessUtils } from '../../utils/ProcessUtils';
  4 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
5 5
6 /** 6 /**
7 * 卡片样式:"appStyle":"3" 7 * 卡片样式:"appStyle":"3"
@@ -27,30 +27,8 @@ export struct Card3Component { @@ -27,30 +27,8 @@ export struct Card3Component {
27 .fontSize($r("app.float.font_size_16")) 27 .fontSize($r("app.float.font_size_16"))
28 .fontColor($r("app.color.color_222222")) 28 .fontColor($r("app.color.color_222222"))
29 .width(CommonConstants.FULL_WIDTH) 29 .width(CommonConstants.FULL_WIDTH)
30 - Row() {  
31 - // TODO "锐评"取得哪个字段,什么时候显示。  
32 - // Text("锐评")  
33 - // .fontSize($r("app.float.font_size_12"))  
34 - // .fontColor($r("app.color.color_ED2800"))  
35 - if(this.contentDTO.source) {  
36 - Text(this.contentDTO.source)  
37 - .fontSize($r("app.float.font_size_12"))  
38 - .fontColor($r("app.color.color_B0B0B0"))  
39 - Image($r("app.media.point"))  
40 - .width(16)  
41 - .height(16)  
42 - }  
43 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))  
44 - .fontSize($r("app.float.font_size_12"))  
45 - .fontColor($r("app.color.color_B0B0B0"))  
46 - .margin({ right: 6 })  
47 - // TODO '评论取哪个字段'  
48 - Text(`${this.contentDTO?.interactData?.commentNum}评`)  
49 - .fontSize($r("app.float.font_size_12"))  
50 - .fontColor($r("app.color.color_B0B0B0"))  
51 - }.width(CommonConstants.FULL_WIDTH)  
52 - .justifyContent(FlexAlign.Start)  
53 - .margin({ top: 8 }) 30 + // 评论等信息
  31 + CardSourceInfo({ contentDTO: this.contentDTO })
54 } 32 }
55 .width(CommonConstants.FULL_WIDTH) 33 .width(CommonConstants.FULL_WIDTH)
56 .padding({ 34 .padding({
1 import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean'; 1 import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
2 import { CommonConstants } from 'wdConstant/Index'; 2 import { CommonConstants } from 'wdConstant/Index';
3 import { ProcessUtils } from '../../utils/ProcessUtils'; 3 import { ProcessUtils } from '../../utils/ProcessUtils';
4 -import { DateTimeUtils } from 'wdKit/Index';  
5 - 4 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
6 const TAG: string = 'Card4Component'; 5 const TAG: string = 'Card4Component';
7 6
8 /** 7 /**
@@ -110,25 +109,8 @@ export struct Card4Component { @@ -110,25 +109,8 @@ export struct Card4Component {
110 .onClick((event: ClickEvent) => { 109 .onClick((event: ClickEvent) => {
111 ProcessUtils.processPage(this.contentDTO) 110 ProcessUtils.processPage(this.contentDTO)
112 }) 111 })
113 -  
114 -  
115 - //bottom  
116 - Row() {  
117 - Text(this.contentDTO.source)  
118 - .bottomTextStyle()  
119 - //间隔点  
120 - Image($r('app.media.point'))  
121 - .width(12)  
122 - .height(12)  
123 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))  
124 - .bottomTextStyle()  
125 - // TODO 评论字段取值  
126 - // Text('518条评论')  
127 - // .bottomTextStyle()  
128 - }  
129 - .width('100%')  
130 - .justifyContent(FlexAlign.Start)  
131 - .margin({ top: 8 }) 112 + //bottom 评论等信息
  113 + CardSourceInfo({ contentDTO: this.contentDTO })
132 } 114 }
133 .width(CommonConstants.FULL_WIDTH) 115 .width(CommonConstants.FULL_WIDTH)
134 .padding({ 116 .padding({
1 import { ContentDTO } from 'wdBean'; 1 import { ContentDTO } from 'wdBean';
2 import { CommonConstants, CompStyle } from 'wdConstant'; 2 import { CommonConstants, CompStyle } from 'wdConstant';
3 -import { DateTimeUtils } from 'wdKit';  
4 import { ProcessUtils } from '../../utils/ProcessUtils'; 3 import { ProcessUtils } from '../../utils/ProcessUtils';
5 - 4 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
  5 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
6 const TAG: string = 'Card6Component-Card13Component'; 6 const TAG: string = 'Card6Component-Card13Component';
7 -const FULL_PARENT: string = '100%';  
8 7
9 /** 8 /**
10 - * 卡片样式:"appStyle":"6"以及13 9 + * 卡片样式:"appStyle":"6"以及13--- 小视频卡
11 */ 10 */
12 @Component 11 @Component
13 export struct Card6Component { 12 export struct Card6Component {
@@ -17,7 +16,17 @@ export struct Card6Component { @@ -17,7 +16,17 @@ export struct Card6Component {
17 Row() { 16 Row() {
18 Column() { 17 Column() {
19 Column() { 18 Column() {
20 - Text(this.contentDTO.newsTitle) 19 + // TODO 这个tag涉及样式问题。待优化。
  20 + // if (this.contentDTO.newTags) {
  21 + // Text(this.contentDTO.newTags)
  22 + // .backgroundColor($r('app.color.color_ED2800'))
  23 + // .borderRadius($r('app.float.button_border_radius'))
  24 + // .fontColor($r('app.color.color_fff'))
  25 + // .fontSize($r('app.float.font_size_12'))
  26 + // .padding(2)
  27 + // .margin({ right: 2 })
  28 + // }
  29 + Text(`${this.contentDTO.newsTitle}`)
21 .fontSize(16) 30 .fontSize(16)
22 .fontWeight(FontWeight.Normal) 31 .fontWeight(FontWeight.Normal)
23 .maxLines(3)// 32 .maxLines(3)//
@@ -26,93 +35,35 @@ export struct Card6Component { @@ -26,93 +35,35 @@ export struct Card6Component {
26 }.height("80%") 35 }.height("80%")
27 .justifyContent(FlexAlign.Start) 36 .justifyContent(FlexAlign.Start)
28 37
29 - Row() {  
30 - if (this.contentDTO.source) {  
31 - Text(this.contentDTO.source)  
32 - .fontSize($r('app.float.font_size_12'))  
33 - .fontColor(Color.Gray)  
34 - .maxLines(1)  
35 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
36 - .width(this.contentDTO.source.length > 8 ? '50%' : '')  
37 - Image($r('app.media.point'))  
38 - .width(16)  
39 - .height(16)  
40 - }  
41 - if (this.contentDTO.publishTime && this.contentDTO.publishTime.length === 13) {  
42 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))  
43 - .fontSize($r('app.float.font_size_12'))  
44 - .fontColor(Color.Gray)  
45 - }  
46 - Text(this.contentDTO.visitorComment + '评')  
47 - .fontSize($r('app.float.font_size_12'))  
48 - .fontColor(Color.Gray)  
49 - .padding({  
50 - left: 5  
51 - })  
52 - }.alignSelf(ItemAlign.Start)  
53 - .height("20%")  
54 - .justifyContent(FlexAlign.Start) 38 +
  39 + //bottom 评论等信息
  40 + CardSourceInfo({ contentDTO: this.contentDTO })
55 } 41 }
56 .alignItems(HorizontalAlign.Start) 42 .alignItems(HorizontalAlign.Start)
57 .justifyContent(FlexAlign.Start) 43 .justifyContent(FlexAlign.Start)
58 .width('58%') 44 .width('58%')
59 -  
60 - Blank(16)  
61 if (this.contentDTO.coverUrl) { 45 if (this.contentDTO.coverUrl) {
62 Stack() { 46 Stack() {
63 Image(this.contentDTO.coverUrl) 47 Image(this.contentDTO.coverUrl)
64 .borderRadius(5) 48 .borderRadius(5)
65 .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) 49 .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4)
66 .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 90 : 180) 50 .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 90 : 180)
67 - if (this.contentDTO.videoInfo) {  
68 - Row() {  
69 - Image($r('app.media.iv_card_play_yellow_flag'))  
70 - .width(22)  
71 - .height(18)  
72 - Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000))  
73 - .fontSize($r('app.float.font_size_13'))  
74 - .fontWeight(400)  
75 - .fontColor($r('app.color.color_fff')) 51 + CardMediaInfo({ contentDTO: this.contentDTO })
76 } 52 }
77 - .alignItems(VerticalAlign.Bottom)  
78 - .height(18)  
79 - .padding({ right: 4 })  
80 - .margin({  
81 - right: 4,  
82 - bottom: 4  
83 - })  
84 - .backgroundColor($r('app.color.color_4d000000'))  
85 - } else if (this.contentDTO.voiceInfo) {  
86 - Row() {  
87 - Image($r('app.media.icon_listen'))  
88 - .width(22)  
89 - .height(18)  
90 - Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo  
91 - .voiceDuration * 1000))  
92 - .fontSize($r('app.float.font_size_13'))  
93 - .fontWeight(400)  
94 - .fontColor($r('app.color.color_fff'))  
95 - }  
96 - .alignItems(VerticalAlign.Bottom)  
97 - .height(18)  
98 - .padding({ right: 4 })  
99 - .margin({  
100 - right: 4,  
101 - bottom: 4  
102 - })  
103 - .backgroundColor($r('app.color.color_4d000000'))  
104 - }  
105 - }.alignContent(Alignment.BottomEnd) 53 + .alignContent(Alignment.BottomEnd)
106 } 54 }
107 } 55 }
108 .onClick((event: ClickEvent) => { 56 .onClick((event: ClickEvent) => {
109 ProcessUtils.processPage(this.contentDTO) 57 ProcessUtils.processPage(this.contentDTO)
110 }) 58 })
111 - .padding(  
112 - { top: 16, bottom: 16, left: 14, right: 14 })  
113 - .width(FULL_PARENT) 59 + .padding({
  60 + left: $r('app.float.card_comp_pagePadding_lf'),
  61 + right: $r('app.float.card_comp_pagePadding_lf'),
  62 + top: $r('app.float.card_comp_pagePadding_tb'),
  63 + bottom: $r('app.float.card_comp_pagePadding_tb')
  64 + })
  65 + .width(CommonConstants.FULL_WIDTH)
114 .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 127 : 217) 66 .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 127 : 217)
115 .justifyContent(FlexAlign.SpaceBetween) 67 .justifyContent(FlexAlign.SpaceBetween)
116 -  
117 } 68 }
118 } 69 }
@@ -104,7 +104,7 @@ export struct Card9Component { @@ -104,7 +104,7 @@ export struct Card9Component {
104 Column() { 104 Column() {
105 Row() { 105 Row() {
106 // 标题 106 // 标题
107 - Image($r("app.media.point_icon")) 107 + Image($r("app.media.timeline_rect"))
108 .width(9) 108 .width(9)
109 .height(9) 109 .height(9)
110 .margin({ right: 5 }) 110 .margin({ right: 5 })
@@ -157,11 +157,11 @@ struct CreatorItem { @@ -157,11 +157,11 @@ struct CreatorItem {
157 .width(44) 157 .width(44)
158 .height(44) 158 .height(44)
159 if (this.isSelected) { 159 if (this.isSelected) {
160 - Image($r('app.media.MyCollection_selected_icon')) 160 + Image($r('app.media.rmh_selected'))
161 .width(16) 161 .width(16)
162 .height(16) 162 .height(16)
163 } else { 163 } else {
164 - Image($r('app.media.ic_succeed_refresh')) 164 + Image($r('app.media.rmh_unselected'))
165 .width(16) 165 .width(16)
166 .height(16) 166 .height(16)
167 } 167 }
@@ -36,6 +36,7 @@ export class commentListModel extends PageModel{ @@ -36,6 +36,7 @@ export class commentListModel extends PageModel{
36 36
37 } 37 }
38 38
  39 +@Observed
39 export class commentItemModel { 40 export class commentItemModel {
40 authorLike: string = '' 41 authorLike: string = ''
41 avatarFrame: string = '' 42 avatarFrame: string = ''
@@ -92,7 +93,7 @@ export class commentItemModel { @@ -92,7 +93,7 @@ export class commentItemModel {
92 targetRelType:string = ''; 93 targetRelType:string = '';
93 targetType:string = ''; 94 targetType:string = '';
94 visitorComment:string = ''; 95 visitorComment:string = '';
95 - shareInfo:commentItemShareInfoModel[] = [] 96 + shareInfo:commentItemShareInfoModel = new commentItemShareInfoModel;
96 // targetId:string = ''; 97 // targetId:string = '';
97 // targetId:string = ''; 98 // targetId:string = '';
98 // targetId:string = ''; 99 // targetId:string = '';
1 import ArrayList from '@ohos.util.ArrayList' 1 import ArrayList from '@ohos.util.ArrayList'
2 import { ViewType } from 'wdConstant/Index'; 2 import { ViewType } from 'wdConstant/Index';
3 -import { LazyDataSource } from 'wdKit/Index'; 3 +import { DateTimeUtils, LazyDataSource } from 'wdKit/Index';
4 import PageModel from '../../../viewmodel/PageModel'; 4 import PageModel from '../../../viewmodel/PageModel';
5 import { commentItemModel, commentListModel, WDPublicUserType } from '../model/CommentModel'; 5 import { commentItemModel, commentListModel, WDPublicUserType } from '../model/CommentModel';
6 import commentViewModel from '../viewmodel/CommentViewModel' 6 import commentViewModel from '../viewmodel/CommentViewModel'
@@ -166,7 +166,9 @@ export struct CommentComponent { @@ -166,7 +166,9 @@ export struct CommentComponent {
166 // ///1小时~1天:x小时前 166 // ///1小时~1天:x小时前
167 // ///1天~2天:1天前 167 // ///1天~2天:1天前
168 // ///2天~:日期隐藏 168 // ///2天~:日期隐藏
169 - Text(item.createTime) 169 +
  170 +
  171 + Text(DateTimeUtils.getCommentTime(Number.parseFloat(item.createTime)))
170 .fontColor($r('app.color.color_B0B0B0')) 172 .fontColor($r('app.color.color_B0B0B0'))
171 .fontSize(12) 173 .fontSize(12)
172 174
1 import { ViewType } from 'wdConstant/Index' 1 import { ViewType } from 'wdConstant/Index'
2 -import { LazyDataSource } from 'wdKit/Index' 2 +import { DateTimeUtils, LazyDataSource, WindowModel } from 'wdKit/Index'
3 import { commentItemModel, commentListModel } from '../model/CommentModel' 3 import { commentItemModel, commentListModel } from '../model/CommentModel'
4 import commentViewModel from '../viewmodel/CommentViewModel' 4 import commentViewModel from '../viewmodel/CommentViewModel'
  5 +import { window } from '@kit.ArkUI'
  6 +
  7 +const TAG = 'QualityCommentsComponent';
5 8
6 @Entry 9 @Entry
7 @Preview 10 @Preview
8 @Component 11 @Component
9 export struct QualityCommentsComponent { 12 export struct QualityCommentsComponent {
  13 + bottomSafeHeight: string = AppStorage.get<number>('bottomSafeHeight') + 'px';
10 @State private browSingModel: commentListModel = new commentListModel() 14 @State private browSingModel: commentListModel = new commentListModel()
11 isloading: boolean = false 15 isloading: boolean = false
  16 + lastWindowColor:string = '#ffffff'
  17 + currentWindowColor:string = '#FF4202'
12 @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); 18 @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
13 19
  20 + aboutToDisappear(): void {
  21 +
  22 + const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
  23 + const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
  24 + windowClass.setWindowBackgroundColor(this.lastWindowColor)
  25 + windowClass.setWindowLayoutFullScreen(false)
  26 + // windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' })
  27 +
  28 + }
  29 +
14 aboutToAppear(): void { 30 aboutToAppear(): void {
15 31
16 - commentViewModel.fetchQualityCommentList('1').then((commentListModel)=>{  
17 - if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {  
18 - commentListModel.hasMore = true;  
19 - this.browSingModel.viewType = ViewType.LOADED; 32 + this.fullScreen();
  33 +
  34 +
  35 + commentViewModel.fetchQualityCommentListLocal(getContext()).then(commentListModel => {
20 this.allDatas.push(...commentListModel.list) 36 this.allDatas.push(...commentListModel.list)
21 - if (commentListModel.list.length === this.browSingModel.pageSize) {  
22 - this.browSingModel.currentPage++;  
23 - this.browSingModel.hasMore = true;  
24 - } else {  
25 - this.browSingModel.hasMore = false; 37 + })
  38 +
  39 + // commentViewModel.fetchQualityCommentList('1').then((commentListModel) => {
  40 + // if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {
  41 + // // commentListModel.hasMore = true;
  42 + // // this.browSingModel.viewType = ViewType.LOADED;
  43 + // this.allDatas.push(...commentListModel.list)
  44 + // // if (commentListModel.list.length === this.browSingModel.pageSize) {
  45 + // // this.browSingModel.currentPage++;
  46 + // // this.browSingModel.hasMore = true;
  47 + // // } else {
  48 + // // this.browSingModel.hasMore = false;
  49 + // // }
  50 + // } else {
  51 + // this.browSingModel.viewType = ViewType.EMPTY;
  52 + // }
  53 + // })
26 } 54 }
27 - } else {  
28 - this.browSingModel.viewType = ViewType.EMPTY; 55 +
  56 + fullScreen() {
  57 + const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
  58 + const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
  59 + // windowClass.setWindowBackgroundColor(this.currentWindowColor)
  60 + windowClass.setWindowLayoutFullScreen(true)
  61 + // windowClass.setWindowSystemBarProperties({ statusBarColor: '#fff' })
  62 +
  63 + // windowClass.setWindowLayoutFullScreen(true).then(() => {
  64 + // console.log(TAG + 'setWindowLayoutFullScreen');
  65 + // })
  66 +
29 } 67 }
  68 +
  69 + @Builder
  70 + titleHeader() {
  71 + Row() {
  72 + Image($r('app.media.comment_img_banner')).width('100%').aspectRatio(375 / 283);
  73 + }
  74 + }
  75 +
  76 + build() {
  77 + Column() {
  78 + // this.titleHeader()
  79 + List({ space: 28 }) {
  80 + ListItemGroup({ header: this.titleHeader() })
  81 +
  82 + LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
  83 + ListItem() {
  84 + QualityCommentItem({ item: item }).margin({ left: 12, right: 12 })
  85 + }
  86 + // .offset({
  87 + // y:-87
  88 + // })
30 }) 89 })
31 } 90 }
  91 + // .contentStartOffset(- 87)
  92 + .edgeEffect(EdgeEffect.Spring)
  93 + .margin({bottom:this.bottomSafeHeight})
  94 + // .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
  95 + }.backgroundColor(this.currentWindowColor).height('100%').width('100%')
  96 + }
  97 +}
  98 +
  99 +
  100 +@Component
  101 +struct QualityCommentItem {
  102 + @ObjectLink item: commentItemModel
32 103
33 build() { 104 build() {
  105 + Column() {
  106 + /*头像以及昵称*/
  107 + RelativeContainer() {
  108 + Image(this.item.fromUserHeader)
  109 + .width(50)
  110 + .height(50)
  111 + .borderRadius(25)
  112 + .borderWidth(2)
  113 + .borderColor(Color.White)
  114 + .id('image1')
  115 + .alignRules({
  116 + top: { anchor: "__container__", align: VerticalAlign.Top },
  117 + left: { anchor: "__container__", align: HorizontalAlign.Start }
  118 + })
  119 + .offset(
  120 + {
  121 + y: -16
  122 + }
  123 + )
  124 + Text(this.item.fromUserName)
  125 + .fontSize(14)
  126 + .fontColor('#222222')
  127 + .fontWeight(FontWeight.Medium)
  128 + .id('text1')
  129 + .alignRules({
  130 + bottom: { anchor: "image1", align: VerticalAlign.Bottom },
  131 + left: { anchor: "image1", align: HorizontalAlign.End }
  132 + })
  133 + .offset(
  134 + {
  135 + x: 6,
  136 + y: -6 - 16
  137 + }
  138 + )
  139 + }.height(42)
  140 +
  141 + Column() {
  142 + /*评论内容*/
  143 + Text() {
  144 + ImageSpan($r('app.media.WDBestCommentTitleDotIcon'))
  145 + .width(12)
  146 + .height(12)
  147 + .objectFit(ImageFit.Fill)
  148 + .offset({
  149 + y: -6
  150 + })
  151 + Span(' ' + this.item.commentContent)
  152 + .fontSize(16)
  153 + .fontColor('#222222')
  154 + .fontWeight(FontWeight.Medium)
  155 + }.margin({ top: 10 })
  156 +
  157 + /*分割线*/
  158 + Row() {
  159 +
  160 + }.width('100%').margin({ top: 10, left: 0, right: 0 }).backgroundColor('#EDEDED').height(2.5);
  161 +
  162 + /*文章或者评论*/
  163 + Row() {
  164 + Row() {
  165 + Image($r('app.media.comment_img_link')).width(16).height(16)
  166 + Text(this.item.shareInfo.shareTitle)
  167 + .fontSize(14)
  168 + .fontColor('#666666')
  169 + .margin({ left: 6, right: 12 })
  170 + .maxLines(1)
  171 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  172 + }.height(40).layoutWeight(1)
  173 +
  174 + Image($r('app.media.more')).width(12).height(12)
  175 +
  176 + }.width('100%').height(40).justifyContent(FlexAlign.SpaceBetween)
  177 +
  178 + }
  179 + .backgroundColor('#F9F9F9')
  180 + .width('100%')
  181 + .alignItems(HorizontalAlign.Start)
  182 + .borderRadius(4)
  183 + .padding({ left: 12, right: 12 })
  184 +
  185 + /*时间 点赞评论*/
  186 + Row() {
  187 +
  188 + Text(DateTimeUtils.getCommentTime(DateTimeUtils.getDateTimestamp(this.item.createTime))).fontSize(14).fontColor('#999999')
  189 +
  190 + Row({space:16}){
  191 + Row(){
  192 + Image($r('app.media.comment_icon_pinglun')).width(16).height(16)
  193 + }
  194 +
  195 + Row(){
  196 + //comment_like_select
  197 + Image($r(this.item.likeNum?'app.media.comment_like_select':'app.media.comment_like_normal')).width(16).height(16)
  198 + if (this.item.likeNum){Text(this.item.likeNum).fontColor(this.item.isLike?'#ED2800':'#999999').fontSize(14).margin({left:3})}
  199 + }
  200 + }
  201 + }.height(38).width('100%').justifyContent(FlexAlign.SpaceBetween)
  202 +
  203 + }.backgroundColor('#FFFFFF').padding({ top: 0, left: 16, right: 16 }).borderRadius(4)
34 204
35 } 205 }
36 } 206 }
@@ -32,7 +32,21 @@ class CommentViewModel { @@ -32,7 +32,21 @@ class CommentViewModel {
32 return compRes.data 32 return compRes.data
33 } 33 }
34 34
  35 + /*获取本地mock数据*/
  36 + async fetchQualityCommentListLocal(context: Context): Promise<commentListModel> {
  37 + Logger.info(TAG, `getBottomNavDataMock start`);
  38 + let compRes: ResponseDTO<commentListModel> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<commentListModel>>(context,'qualityComment_local.json' );
  39 + if (!compRes || !compRes.data) {
  40 + Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`);
  41 + return new commentListModel()
  42 + }
  43 + Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
  44 + return compRes.data
  45 + }
  46 +
  47 +
35 48
  49 + //qualityComment_local.json
36 fetchQualityCommentList(pageNum: string) { 50 fetchQualityCommentList(pageNum: string) {
37 let url = HttpUrlUtils.getQualityCommentUrl() + `?&pageSize=${10}&pageNum=${pageNum}` 51 let url = HttpUrlUtils.getQualityCommentUrl() + `?&pageSize=${10}&pageNum=${pageNum}`
38 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 52 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
@@ -33,8 +33,8 @@ export default struct MinePageUserSimpleInfoUI { @@ -33,8 +33,8 @@ export default struct MinePageUserSimpleInfoUI {
33 Stack(){ 33 Stack(){
34 Image(this.headPhotoUrl) 34 Image(this.headPhotoUrl)
35 .alt($r('app.media.default_head')) 35 .alt($r('app.media.default_head'))
36 - .width('108lpx')  
37 - .height('108lpx') 36 + .width('100lpx')
  37 + .height('100lpx')
38 .objectFit(ImageFit.Cover) 38 .objectFit(ImageFit.Cover)
39 .borderRadius(50) 39 .borderRadius(50)
40 Image(this.levelHead) 40 Image(this.levelHead)
@@ -18,7 +18,7 @@ export struct FollowFirstTabsComponent{ @@ -18,7 +18,7 @@ export struct FollowFirstTabsComponent{
18 value.forEach((element)=>{ 18 value.forEach((element)=>{
19 this.data.push(element) 19 this.data.push(element)
20 }) 20 })
21 - console.log("ycg",this.data.length.toString()); 21 +
22 if(this.controller != null && this.data.length>1 && this.changeIndex === 1){ 22 if(this.controller != null && this.data.length>1 && this.changeIndex === 1){
23 //个人主页 跳转 关注页 tab 2 23 //个人主页 跳转 关注页 tab 2
24 let intervalID = setInterval(() => { 24 let intervalID = setInterval(() => {
@@ -171,6 +171,7 @@ struct ChildComponent { @@ -171,6 +171,7 @@ struct ChildComponent {
171 .fontSize('31lpx') 171 .fontSize('31lpx')
172 .lineHeight('38lpx') 172 .lineHeight('38lpx')
173 .fontColor($r('app.color.color_222222')) 173 .fontColor($r('app.color.color_222222'))
  174 + .maxLines(1)
174 Text(`粉丝${this.data.cnFansNum}`) 175 Text(`粉丝${this.data.cnFansNum}`)
175 .fontColor($r('app.color.color_B0B0B0')) 176 .fontColor($r('app.color.color_B0B0B0'))
176 .fontSize('23lpx') 177 .fontSize('23lpx')
@@ -35,25 +35,45 @@ export struct FollowSecondTabsComponent{ @@ -35,25 +35,45 @@ export struct FollowSecondTabsComponent{
35 35
36 @Builder FollowSecondUI(){ 36 @Builder FollowSecondUI(){
37 Row() { 37 Row() {
  38 + Row(){
  39 + // 页签
  40 + Column({ space: 7 }) {
  41 + Scroll() {
  42 + Column() {
  43 + ForEach(this.data[this.firstIndex].children, (item: FollowSecondListItem, index: number ) => {
  44 + this.TabBuilder(index,item)
  45 + })
  46 + }
  47 + .justifyContent(FlexAlign.Start)
  48 + }
  49 + .align(Alignment.Top)
  50 + .scrollable(ScrollDirection.Vertical)
  51 + .scrollBar(BarState.Off)
  52 + .height('100%')
  53 + }.height('100%')
  54 + .alignItems(HorizontalAlign.Center)
  55 + }
  56 + .alignItems(VerticalAlign.Top)
  57 + .height('100%')
  58 +
38 Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { 59 Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
39 ForEach(this.data[this.firstIndex].children, (item: FollowSecondListItem, index: number ) => { 60 ForEach(this.data[this.firstIndex].children, (item: FollowSecondListItem, index: number ) => {
40 TabContent(){ 61 TabContent(){
41 FollowThirdTabsComponent({data:$data,firstIndex:$firstIndex,secondIndex:index}) 62 FollowThirdTabsComponent({data:$data,firstIndex:$firstIndex,secondIndex:index})
42 - }.tabBar(this.TabBuilder(index,item)) 63 + }
43 .backgroundColor($r('app.color.white')) 64 .backgroundColor($r('app.color.white'))
44 }, (item: FollowListItem, index: number) => index.toString()) 65 }, (item: FollowListItem, index: number) => index.toString())
45 } 66 }
46 .vertical(true) 67 .vertical(true)
47 .barMode(BarMode.Scrollable) 68 .barMode(BarMode.Scrollable)
48 - .barWidth('140lpx')  
49 .animationDuration(0) 69 .animationDuration(0)
50 .onChange((index: number) => { 70 .onChange((index: number) => {
51 this.currentIndex = index 71 this.currentIndex = index
52 }) 72 })
53 - .width('100%') 73 + .barWidth(0)
  74 + .height('100%')
  75 + .layoutWeight(1)
54 }.width('100%') 76 }.width('100%')
55 - .alignItems(VerticalAlign.Top)  
56 - .backgroundColor('#0FF')  
57 } 77 }
58 78
59 @Builder TabBuilder(index: number, item: FollowSecondListItem) { 79 @Builder TabBuilder(index: number, item: FollowSecondListItem) {
@@ -73,6 +93,7 @@ export struct FollowSecondTabsComponent{ @@ -73,6 +93,7 @@ export struct FollowSecondTabsComponent{
73 }) 93 })
74 .justifyContent(FlexAlign.Center) 94 .justifyContent(FlexAlign.Center)
75 .height('84lpx') 95 .height('84lpx')
  96 + .width('140lpx')
76 .backgroundColor(this.currentIndex === index?$r('app.color.white'):$r('app.color.color_F9F9F9')) 97 .backgroundColor(this.currentIndex === index?$r('app.color.white'):$r('app.color.color_F9F9F9'))
77 } 98 }
78 99
@@ -34,19 +34,45 @@ export struct FollowThirdTabsComponent{ @@ -34,19 +34,45 @@ export struct FollowThirdTabsComponent{
34 .lineHeight('38lpx') 34 .lineHeight('38lpx')
35 .backgroundColor($r('app.color.color_F9F9F9')) 35 .backgroundColor($r('app.color.color_F9F9F9'))
36 .padding('13lpx') 36 .padding('13lpx')
  37 + .maxLines(1)
37 } 38 }
38 .onClick(()=>{ 39 .onClick(()=>{
39 this.currentIndex = index 40 this.currentIndex = index
40 this.controller.changeIndex(this.currentIndex) 41 this.controller.changeIndex(this.currentIndex)
41 }) 42 })
42 - .height('100%') 43 + .height('84lpx')
43 .margin({right:'9lpx'}) 44 .margin({right:'9lpx'})
44 .padding({left:'20lpx',right:index === this.data[this.firstIndex].children[this.secondIndex].children.length-1?"20lpx":"0lpx"}) 45 .padding({left:'20lpx',right:index === this.data[this.firstIndex].children[this.secondIndex].children.length-1?"20lpx":"0lpx"})
45 .justifyContent(FlexAlign.Center) 46 .justifyContent(FlexAlign.Center)
46 } 47 }
47 48
48 @Builder FollowThirdUI(){ 49 @Builder FollowThirdUI(){
  50 +
  51 + Column(){
  52 + Column() {
  53 + // 页签
  54 + Row({ space: 7 }) {
  55 + Scroll() {
49 Row() { 56 Row() {
  57 + ForEach(this.data[this.firstIndex].children[this.secondIndex].children, (item: FollowThirdListItem, index: number ) => {
  58 + this.TabBuilder(index,item)
  59 + })
  60 + }
  61 + .justifyContent(FlexAlign.Start)
  62 + }
  63 + .align(Alignment.Start)
  64 + .scrollable(ScrollDirection.Horizontal)
  65 + .scrollBar(BarState.Off)
  66 + .width('90%')
  67 + .padding({left:'11lpx'})
  68 + }
  69 + .alignItems(VerticalAlign.Bottom)
  70 + .width('100%')
  71 + }
  72 + .backgroundColor($r('app.color.white'))
  73 + .alignItems(HorizontalAlign.Start)
  74 + .width('100%')
  75 +
50 Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { 76 Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
51 ForEach(this.data[this.firstIndex].children[this.secondIndex].children, (item: FollowThirdListItem, index: number ) => { 77 ForEach(this.data[this.firstIndex].children[this.secondIndex].children, (item: FollowThirdListItem, index: number ) => {
52 TabContent(){ 78 TabContent(){
@@ -58,20 +84,19 @@ export struct FollowThirdTabsComponent{ @@ -58,20 +84,19 @@ export struct FollowThirdTabsComponent{
58 .margin({left:'20lpx'}) 84 .margin({left:'20lpx'})
59 FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].children[this.secondIndex].children[index].id}) 85 FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].children[this.secondIndex].children[index].id})
60 } 86 }
61 - }.tabBar(this.TabBuilder(index,item)) 87 + }
62 .backgroundColor($r('app.color.white')) 88 .backgroundColor($r('app.color.white'))
63 }, (item: FollowListItem, index: number) => index.toString()) 89 }, (item: FollowListItem, index: number) => index.toString())
64 } 90 }
  91 + .barHeight(0)
65 .vertical(false) 92 .vertical(false)
66 .barMode(BarMode.Scrollable) 93 .barMode(BarMode.Scrollable)
67 - .barWidth('100%')  
68 - .barHeight('84lpx')  
69 .animationDuration(0) 94 .animationDuration(0)
70 .onChange((index: number) => { 95 .onChange((index: number) => {
71 this.currentIndex = index 96 this.currentIndex = index
72 }) 97 })
73 .width('100%') 98 .width('100%')
74 - }.width('100%') 99 + }
75 } 100 }
76 101
77 } 102 }
@@ -90,6 +90,7 @@ export struct OtherHomePageBottomCommentComponent{ @@ -90,6 +90,7 @@ export struct OtherHomePageBottomCommentComponent{
90 MinePageDatasModel.getOtherCommentListData(object,getContext(this)).then((value)=>{ 90 MinePageDatasModel.getOtherCommentListData(object,getContext(this)).then((value)=>{
91 if (!this.data_comment || value.list.length == 0){ 91 if (!this.data_comment || value.list.length == 0){
92 this.hasMore = false 92 this.hasMore = false
  93 + this.isLoading = false
93 }else{ 94 }else{
94 this.getCommentListStatus(value) 95 this.getCommentListStatus(value)
95 } 96 }
@@ -60,6 +60,7 @@ export struct BottomNavigationComponent { @@ -60,6 +60,7 @@ export struct BottomNavigationComponent {
60 MinePageComponent() 60 MinePageComponent()
61 } else { 61 } else {
62 TopNavigationComponent({ 62 TopNavigationComponent({
  63 + groupId: navItem.id,
63 topNavList: navItem.topNavChannelList, 64 topNavList: navItem.topNavChannelList,
64 _currentNavIndex: this.currentNavIndex, 65 _currentNavIndex: this.currentNavIndex,
65 changeBarBackgroundColor: (color: Color) => { 66 changeBarBackgroundColor: (color: Color) => {
@@ -84,9 +84,13 @@ struct EditUserInfoPage { @@ -84,9 +84,13 @@ struct EditUserInfoPage {
84 Blank() 84 Blank()
85 85
86 Text(r.subTitle) 86 Text(r.subTitle)
  87 + .textOverflow({overflow:TextOverflow.Ellipsis})
  88 + .maxLines(1)
87 .fontSize(16) 89 .fontSize(16)
88 .fontColor(Color.Gray) 90 .fontColor(Color.Gray)
89 .padding({right:10}) 91 .padding({right:10})
  92 + .width('70%')
  93 + .textAlign(TextAlign.End)
90 94
91 Image($r('app.media.mine_user_edit')) 95 Image($r('app.media.mine_user_edit'))
92 .width('12') 96 .width('12')
@@ -130,10 +134,11 @@ struct EditUserInfoPage { @@ -130,10 +134,11 @@ struct EditUserInfoPage {
130 }) 134 })
131 }else if(i === 5){ 135 }else if(i === 5){
132 TextPickerDialog.show({ 136 TextPickerDialog.show({
133 - range:['女','男'], 137 + range:['男','女'],
  138 + canLoop:false,
134 selected:0, 139 selected:0,
135 onAccept:(value:TextPickerResult) => { 140 onAccept:(value:TextPickerResult) => {
136 - this.currentUserInfo.userExtend.sex = value.index as number; 141 + this.currentUserInfo.userExtend.sex = value.index == 0?1:0;
137 this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_sex 142 this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_sex
138 this.updateEditModel() 143 this.updateEditModel()
139 } 144 }
@@ -2,7 +2,7 @@ import { CustomTitleAndEditUI } from '../reusable/CustomTitleAndEditUI' @@ -2,7 +2,7 @@ import { CustomTitleAndEditUI } from '../reusable/CustomTitleAndEditUI'
2 import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel'; 2 import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel';
3 import PageModel from '../../viewmodel/PageModel'; 3 import PageModel from '../../viewmodel/PageModel';
4 import { CommonConstants, ViewType } from 'wdConstant' 4 import { CommonConstants, ViewType } from 'wdConstant'
5 -import { EmptyComponent } from '../view/EmptyComponent' 5 +import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent'
6 import { ErrorComponent } from '../view/ErrorComponent' 6 import { ErrorComponent } from '../view/ErrorComponent'
7 import RefreshLayout from './RefreshLayout' 7 import RefreshLayout from './RefreshLayout'
8 import { RefreshLayoutBean } from './RefreshLayoutBean'; 8 import { RefreshLayoutBean } from './RefreshLayoutBean';
@@ -43,7 +43,7 @@ struct MyCollectionListPage { @@ -43,7 +43,7 @@ struct MyCollectionListPage {
43 }else if(this.browSingModel.viewType == ViewType.ERROR){ 43 }else if(this.browSingModel.viewType == ViewType.ERROR){
44 ErrorComponent() 44 ErrorComponent()
45 }else if(this.browSingModel.viewType == ViewType.EMPTY){ 45 }else if(this.browSingModel.viewType == ViewType.EMPTY){
46 - EmptyComponent() 46 + EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoCollection})
47 }else { 47 }else {
48 this.ListLayout() 48 this.ListLayout()
49 } 49 }
1 -  
2 -import { Logger, DateTimeUtils, CollectionUtils } from 'wdKit'; 1 +import { CollectionUtils, DateTimeUtils, Logger } from 'wdKit';
3 import { CommonConstants, CompStyle, ViewType } from 'wdConstant'; 2 import { CommonConstants, CompStyle, ViewType } from 'wdConstant';
4 import PageViewModel from '../../viewmodel/PageViewModel'; 3 import PageViewModel from '../../viewmodel/PageViewModel';
5 import { EmptyComponent } from '../view/EmptyComponent'; 4 import { EmptyComponent } from '../view/EmptyComponent';
@@ -13,8 +12,7 @@ import LoadMoreLayout from './LoadMoreLayout'; @@ -13,8 +12,7 @@ import LoadMoreLayout from './LoadMoreLayout';
13 import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; 12 import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
14 import { CompParser } from '../CompParser'; 13 import { CompParser } from '../CompParser';
15 import { GroupInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO'; 14 import { GroupInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO';
16 -import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';  
17 -import { CompDTO, LiveReviewDTO, PageDTO ,PageInfoDTO} from 'wdBean'; 15 +import { CompDTO, LiveReviewDTO, PageDTO, PageInfoBean } from 'wdBean';
18 16
19 17
20 const TAG = 'PageComponent'; 18 const TAG = 'PageComponent';
@@ -41,7 +39,6 @@ export struct PageComponent { @@ -41,7 +39,6 @@ export struct PageComponent {
41 totalCount: 0, 39 totalCount: 0,
42 list: [] 40 list: []
43 }; 41 };
44 - name: string = "";  
45 @Link @Watch('onChange') currentTopNavSelectedIndex: number 42 @Link @Watch('onChange') currentTopNavSelectedIndex: number
46 43
47 build() { 44 build() {
@@ -72,6 +69,7 @@ export struct PageComponent { @@ -72,6 +69,7 @@ export struct PageComponent {
72 @Builder 69 @Builder
73 ListLayout() { 70 ListLayout() {
74 List() { 71 List() {
  72 +
75 // 下拉刷新 73 // 下拉刷新
76 ListItem() { 74 ListItem() {
77 RefreshLayout({ 75 RefreshLayout({
@@ -83,13 +81,8 @@ export struct PageComponent { @@ -83,13 +81,8 @@ export struct PageComponent {
83 LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => { 81 LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {
84 ListItem() { 82 ListItem() {
85 Column() { 83 Column() {
86 - if (this.name == '视频') {  
87 - VideoChannelDetail()  
88 - } else {  
89 CompParser({ compDTO: compDTO, compIndex: compIndex }); 84 CompParser({ compDTO: compDTO, compIndex: compIndex });
90 } 85 }
91 -  
92 - }  
93 } 86 }
94 }, 87 },
95 (compDTO: CompDTO, compIndex: number) => compDTO.id + compIndex.toString() + this.pageModel.timestamp 88 (compDTO: CompDTO, compIndex: number) => compDTO.id + compIndex.toString() + this.pageModel.timestamp
@@ -106,6 +99,7 @@ export struct PageComponent { @@ -106,6 +99,7 @@ export struct PageComponent {
106 NoMoreLayout() 99 NoMoreLayout()
107 } 100 }
108 } 101 }
  102 +
109 } 103 }
110 .scrollBar(BarState.Off) 104 .scrollBar(BarState.Off)
111 .cachedCount(8) 105 .cachedCount(8)
@@ -138,7 +132,8 @@ export struct PageComponent { @@ -138,7 +132,8 @@ export struct PageComponent {
138 132
139 onChange() { 133 onChange() {
140 Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , ${this.isFirstIn} , navIndex: ${this.currentTopNavSelectedIndex}`); 134 Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , ${this.isFirstIn} , navIndex: ${this.currentTopNavSelectedIndex}`);
141 - if (this.navIndex === this.currentTopNavSelectedIndex && !this.isFirstIn) { 135 + // if (this.navIndex === this.currentTopNavSelectedIndex && !this.isFirstIn) {
  136 + if (this.navIndex === this.currentTopNavSelectedIndex) {
142 this.getData(); 137 this.getData();
143 } 138 }
144 } 139 }
@@ -158,6 +153,16 @@ export struct PageComponent { @@ -158,6 +153,16 @@ export struct PageComponent {
158 this.pageModel.viewType = ViewType.EMPTY; 153 this.pageModel.viewType = ViewType.EMPTY;
159 return; 154 return;
160 } 155 }
  156 + if (this.navIndex === 0) {
  157 + await this.getVideoListData(pageInfo);
  158 + } else {
  159 + await this.getLiveListData(pageInfo);
  160 + }
  161 +
  162 +
  163 + }
  164 +
  165 + private async getVideoListData(pageInfo: PageInfoBean) {
161 let groupInfo: GroupInfoDTO = CollectionUtils.getElement(pageInfo.groups, 0); 166 let groupInfo: GroupInfoDTO = CollectionUtils.getElement(pageInfo.groups, 0);
162 if (groupInfo != null) { 167 if (groupInfo != null) {
163 this.pageModel.isRecGroup = groupInfo.groupStrategy === 1; 168 this.pageModel.isRecGroup = groupInfo.groupStrategy === 1;
@@ -165,7 +170,89 @@ export struct PageComponent { @@ -165,7 +170,89 @@ export struct PageComponent {
165 } 170 }
166 // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代 171 // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代
167 // for (const group of pageInfo.groups) { 172 // for (const group of pageInfo.groups) {
168 - this.pageDto = await PageViewModel.getPageData(this.pageModel, getContext(this)) 173 + this.pageDto = await PageViewModel.getPageData(this.pageModel, getContext(this));
  174 + this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString();
  175 + if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) {
  176 + this.pageDto.compList.forEach((comp) => {
  177 + if (comp.compStyle === CompStyle.Zh_Grid_Layout_02 && this.liveReviewDTO && this.liveReviewDTO.list && this.liveReviewDTO.list.length > 0) {
  178 + comp.operDataList.push(...this.liveReviewDTO.list);
  179 + }
  180 + });
  181 +
  182 + this.pageModel.viewType = ViewType.LOADED;
  183 + this.pageModel.compList.push(...this.pageDto.compList);
  184 + if (this.pageDto.compList.length === this.pageModel.pageSize) {
  185 + this.pageModel.currentPage++;
  186 + this.pageModel.hasMore = true;
  187 + } else {
  188 + this.pageModel.hasMore = false;
  189 + }
  190 + // // 二次请求,批查互动数据
  191 + // PageViewModel.getInteractData(pageDto.compList).then((data: CompDTO[]) => {
  192 + // // 刷新,替换所有数据
  193 + // this.pageModel.compList.replaceAll(...data)
  194 + // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
  195 + // })
  196 + this.isFirstIn = false;
  197 + Logger.debug(TAG, 'cj111');
  198 + // } else {
  199 + // Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.');
  200 + // this.pageModel.viewType = ViewType.EMPTY;
  201 + // }
  202 + }
  203 + }
  204 +
  205 + // private async getLiveListData(pageInfo: PageInfoBean) {
  206 + // // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代
  207 + // for (const group of pageInfo.groups) {
  208 + // this.pageDto = await PageViewModel.getPageData(this.pageModel, getContext(this));
  209 + // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString();
  210 + // if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) {
  211 + // this.pageDto.compList.forEach((comp) => {
  212 + // if (comp.compStyle === CompStyle.Zh_Grid_Layout_02 && this.liveReviewDTO && this.liveReviewDTO.list && this.liveReviewDTO.list.length > 0) {
  213 + // comp.operDataList.push(...this.liveReviewDTO.list);
  214 + // }
  215 + // });
  216 + //
  217 + // this.pageModel.viewType = ViewType.LOADED;
  218 + // this.pageModel.compList.push(...this.pageDto.compList);
  219 + // if (this.pageDto.compList.length === this.pageModel.pageSize) {
  220 + // this.pageModel.currentPage++;
  221 + // this.pageModel.hasMore = true;
  222 + // } else {
  223 + // this.pageModel.hasMore = false;
  224 + // }
  225 + // // // 二次请求,批查互动数据
  226 + // // PageViewModel.getInteractData(pageDto.compList).then((data: CompDTO[]) => {
  227 + // // // 刷新,替换所有数据
  228 + // // this.pageModel.compList.replaceAll(...data)
  229 + // // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
  230 + // // })
  231 + // this.isFirstIn = false;
  232 + // Logger.debug(TAG, 'cj111');
  233 + // // } else {
  234 + // // Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.');
  235 + // // this.pageModel.viewType = ViewType.EMPTY;
  236 + // }
  237 + // }
  238 + // }
  239 +
  240 + async getLiveListData(pageInfo: PageInfoBean) {
  241 + // Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
  242 + // this.pageModel.pageId = this.pageId;
  243 + // this.pageModel.groupId = this.pageId;
  244 + // this.pageModel.channelId = this.channelId;
  245 + // this.pageModel.currentPage = 1;
  246 + // let pageInfo = await PageViewModel.getPageUrlData(this.pageModel.pageId);
  247 + // if (pageInfo == null) {
  248 + // this.pageModel.viewType = ViewType.EMPTY;
  249 + // return;
  250 + // }
  251 + Logger.debug(TAG, 'getPageUrlData ' + pageInfo.id);
  252 + // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代
  253 + for (const group of pageInfo.groups) {
  254 + this.pageDto = await PageViewModel.getLivePageData(this.pageModel.pageId, `${group.id}`, this.pageModel.channelId, group.groupStrategy
  255 + , this.pageModel.currentPage, this.pageModel.pageSize, getContext(this))
169 this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() 256 this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
170 if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) { 257 if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) {
171 this.pageDto.compList.forEach((comp) => { 258 this.pageDto.compList.forEach((comp) => {
@@ -189,12 +276,11 @@ export struct PageComponent { @@ -189,12 +276,11 @@ export struct PageComponent {
189 this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() 276 this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
190 }) 277 })
191 this.isFirstIn = false 278 this.isFirstIn = false
192 - // } else {  
193 - // Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.');  
194 - // this.pageModel.viewType = ViewType.EMPTY;  
195 - // } 279 + } else {
  280 + Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.');
  281 + this.pageModel.viewType = ViewType.EMPTY;
  282 + }
196 } 283 }
197 -  
198 } 284 }
199 285
200 async getPreviewData() { 286 async getPreviewData() {
@@ -6,6 +6,7 @@ import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'; @@ -6,6 +6,7 @@ import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout';
6 import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent'; 6 import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent';
7 import window from '@ohos.window'; 7 import window from '@ohos.window';
8 import { WindowModel } from 'wdKit'; 8 import { WindowModel } from 'wdKit';
  9 +import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';
9 10
10 const TAG = 'TopNavigationComponent'; 11 const TAG = 'TopNavigationComponent';
11 12
@@ -20,6 +21,7 @@ const storage = LocalStorage.getShared(); @@ -20,6 +21,7 @@ const storage = LocalStorage.getShared();
20 @Entry(storage) 21 @Entry(storage)
21 @Component 22 @Component
22 export struct TopNavigationComponent { 23 export struct TopNavigationComponent {
  24 + private groupId: number = 0
23 private tabsController: TabsController = new TabsController() 25 private tabsController: TabsController = new TabsController()
24 private changeBarBackgroundColor: (color: Color) => void = () => { 26 private changeBarBackgroundColor: (color: Color) => void = () => {
25 } 27 }
@@ -236,13 +238,21 @@ export struct TopNavigationComponent { @@ -236,13 +238,21 @@ export struct TopNavigationComponent {
236 Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) { 238 Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) {
237 ForEach(this._currentNavIndex === 0 ? this.myChannelList : this.topNavList, (navItem: TopNavDTO, index: number) => { 239 ForEach(this._currentNavIndex === 0 ? this.myChannelList : this.topNavList, (navItem: TopNavDTO, index: number) => {
238 TabContent() { 240 TabContent() {
  241 + if (this._currentNavIndex === 2 && navItem.name === '视频') {
  242 + VideoChannelDetail({
  243 + bottomNavIndex: this._currentNavIndex,
  244 + topNavIndex: this.currentTopNavSelectedIndex,
  245 + groupId: this.groupId + '',
  246 + pageId: navItem.pageId + '',
  247 + channelId: navItem.channelId + '',
  248 + })
  249 + } else
239 if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { 250 if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
240 PageComponent({ 251 PageComponent({
241 currentTopNavSelectedIndex: $currentTopNavSelectedIndex, 252 currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
242 navIndex: index, 253 navIndex: index,
243 pageId: navItem.pageId + '', 254 pageId: navItem.pageId + '',
244 channelId: navItem.channelId + '', 255 channelId: navItem.channelId + '',
245 - name: navItem.name  
246 }) 256 })
247 } 257 }
248 } 258 }
@@ -128,7 +128,7 @@ export struct SearchComponent { @@ -128,7 +128,7 @@ export struct SearchComponent {
128 * @param content 128 * @param content
129 */ 129 */
130 getSearchHistoryResData(content:string,index:number){ 130 getSearchHistoryResData(content:string,index:number){
131 - //删除单记录 131 + //删除单记录
132 SearcherAboutDataModel.delSearchSingleHistoryData(index) 132 SearcherAboutDataModel.delSearchSingleHistoryData(index)
133 this.isClickedHistory = true 133 this.isClickedHistory = true
134 this.searchResData(content) 134 this.searchResData(content)
@@ -149,33 +149,6 @@ export struct SearchComponent { @@ -149,33 +149,6 @@ export struct SearchComponent {
149 this.getSearchResultCountData() 149 this.getSearchResultCountData()
150 } 150 }
151 151
152 - getSearchResultCountData() {  
153 - SearcherAboutDataModel.getSearchResultCountData(encodeURI(this.searchText),getContext(this)).then((value) => {  
154 - if (value != null) {  
155 - this.count = []  
156 - if(value.allTotal!=0){  
157 - this.count.push("全部")  
158 - }  
159 - if(value.cmsTotal!=0){  
160 - this.count.push("精选")  
161 - }  
162 - if(value.rmhTotal!=0){  
163 - this.count.push("人民号")  
164 - }  
165 - if(value.videoTotal!=0){  
166 - this.count.push("视频")  
167 - }  
168 - if(value.activityTotal!=0){  
169 - this.count.push("活动")  
170 - }  
171 - }  
172 - }).catch((err: Error) => {  
173 - console.log(TAG, JSON.stringify(err))  
174 - })  
175 - }  
176 -  
177 -  
178 -  
179 /** 152 /**
180 * 点击联想搜索列表回调 153 * 点击联想搜索列表回调
181 * @param content 154 * @param content
@@ -291,4 +264,30 @@ export struct SearchComponent { @@ -291,4 +264,30 @@ export struct SearchComponent {
291 .padding({ left: '31lpx' }) 264 .padding({ left: '31lpx' })
292 .alignItems(VerticalAlign.Center) 265 .alignItems(VerticalAlign.Center)
293 } 266 }
  267 +
  268 +
  269 + getSearchResultCountData() {
  270 + SearcherAboutDataModel.getSearchResultCountData(encodeURI(this.searchText),getContext(this)).then((value) => {
  271 + if (value != null) {
  272 + this.count = []
  273 + if(value.allTotal!=0){
  274 + this.count.push("全部")
  275 + }
  276 + if(value.cmsTotal!=0){
  277 + this.count.push("精选")
  278 + }
  279 + if(value.rmhTotal!=0){
  280 + this.count.push("人民号")
  281 + }
  282 + if(value.videoTotal!=0){
  283 + this.count.push("视频")
  284 + }
  285 + if(value.activityTotal!=0){
  286 + this.count.push("活动")
  287 + }
  288 + }
  289 + }).catch((err: Error) => {
  290 + console.log(TAG, JSON.stringify(err))
  291 + })
  292 + }
294 } 293 }
  1 +import { SearchResultContentComponent } from './SearchResultContentComponent'
1 2
2 const TAG = "SearchResultComponent" 3 const TAG = "SearchResultComponent"
3 /** 4 /**
@@ -19,7 +20,7 @@ export struct SearchResultComponent{ @@ -19,7 +20,7 @@ export struct SearchResultComponent{
19 Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { 20 Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
20 ForEach(this.count, (item: string, index: number ) => { 21 ForEach(this.count, (item: string, index: number ) => {
21 TabContent(){ 22 TabContent(){
22 - Text(item) 23 + SearchResultContentComponent({keywords:this.searchText,searchType:item})
23 }.tabBar(this.TabBuilder(index,item)) 24 }.tabBar(this.TabBuilder(index,item))
24 }, (item: string, index: number) => index.toString()) 25 }, (item: string, index: number) => index.toString())
25 } 26 }
@@ -63,4 +64,5 @@ export struct SearchResultComponent{ @@ -63,4 +64,5 @@ export struct SearchResultComponent{
63 .margin({right:'9lpx'}) 64 .margin({right:'9lpx'})
64 .padding({left:'31lpx',right:index === this.count.length-1?"31lpx":"0lpx"}) 65 .padding({left:'31lpx',right:index === this.count.length-1?"31lpx":"0lpx"})
65 } 66 }
  67 +
66 } 68 }
  1 +import { ContentDTO,
  2 + contentListParams,
  3 + FullColumnImgUrlDTO, InteractDataDTO, RmhInfoDTO, VideoInfoDTO } from 'wdBean/Index'
  4 +import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO'
  5 +import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO'
  6 +import { LazyDataSource, StringUtils } from 'wdKit/Index'
  7 +import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
  8 +import { SearchResultContentData } from '../../viewmodel/SearchResultContentData'
  9 +import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
  10 +import { CardParser } from '../CardParser'
  11 +import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI'
  12 +
  13 +const TAG = "SearchResultContentComponent"
  14 +
  15 +@Component
  16 +export struct SearchResultContentComponent{
  17 + @State keywords:string = ""
  18 + @State searchType:string = ""
  19 + @State data: LazyDataSource<ContentDTO> = new LazyDataSource();
  20 + @State data_rmh: SearchRmhDescription[] = []
  21 + @State count:number = 0;
  22 + @State isLoading:boolean = false
  23 + @State hasMore:boolean = true
  24 + curPageNum:number = 1;
  25 +
  26 +
  27 + aboutToAppear(): void {
  28 + if(this.searchType == "全部"){
  29 + this.searchType = "all"
  30 + }else if(this.searchType == "精选"){
  31 + this.searchType = "cms"
  32 + }else if(this.searchType == "人民号"){
  33 + this.searchType = "rmh"
  34 + }else if(this.searchType == "视频"){
  35 + this.searchType = "video"
  36 + }else if(this.searchType == "活动"){
  37 + this.searchType = "activity"
  38 + }
  39 +
  40 + this.keywords = encodeURI(this.keywords)
  41 + this.getNewSearchResultData()
  42 + }
  43 +
  44 + getNewSearchResultData(){
  45 + this.isLoading = true
  46 + if(this.hasMore){
  47 + SearcherAboutDataModel.getSearchResultListData("20",`${this.curPageNum}`,this.searchType,this.keywords,getContext(this)).then((value)=>{
  48 + if (!this.data || value.list.length == 0){
  49 + this.hasMore = false
  50 + this.isLoading = false
  51 + }else{
  52 + if(value.list[0].dataList!=null){
  53 + this.data_rmh = value.list[0].dataList
  54 + //TODO 查询创作者详情接口
  55 +
  56 + }
  57 + this.getInteractData(value)
  58 + }
  59 + }).catch((err:Error)=>{
  60 + console.log(TAG,JSON.stringify(err))
  61 + this.isLoading = false
  62 + })
  63 + }
  64 + }
  65 +
  66 + getInteractData(resultData:SearchResultContentData){
  67 + if(resultData.list[0].dataList!=null){
  68 + resultData.list.splice(0,1)
  69 + }
  70 +
  71 + let data : contentListParams = {
  72 + contentList: []
  73 + }
  74 + resultData.list.forEach((item)=>{
  75 + data.contentList.push({
  76 + contentId: item.data.id + '',
  77 + contentType: Number.parseInt(item.data.type)
  78 + })
  79 + })
  80 +
  81 + SearcherAboutDataModel.getInteractListData(data,getContext(this)).then((newValue)=>{
  82 + newValue.forEach((item)=>{
  83 + resultData.list.forEach((data)=>{
  84 + if (item.contentId == data.data.id) {
  85 + data.data.collectNum = item.collectNum+""
  86 + data.data.commentNum = item.commentNum+""
  87 + data.data.likeNum = item.likeNum+""
  88 + data.data.readNum = item.readNum+""
  89 + data.data.shareNum = item.shareNum+""
  90 + }
  91 + })
  92 + })
  93 +
  94 + resultData.list.forEach((value)=>{
  95 + let photos:FullColumnImgUrlDTO[] = []
  96 + if(value.data.appStyle === 4){
  97 + value.data.appStyleImages.split("&&").forEach((value)=>{
  98 + photos.push({url:value} as FullColumnImgUrlDTO)
  99 + })
  100 + }
  101 +
  102 + //TODO 48 个赋值
  103 + let contentDTO:ContentDTO = {
  104 + appStyle: value.data.appStyle + "",
  105 + cityCode: value.data.cityCode,
  106 + coverSize: "",
  107 + coverType: -1,
  108 + coverUrl: value.data.appStyleImages.split("&&")[0],
  109 + description: value.data.description,
  110 + districtCode: value.data.districtCode,
  111 + endTime: value.data.endTime,
  112 + hImageUrl: "",
  113 + heatValue: "",
  114 + innerUrl: "",
  115 + landscape: Number.parseInt(value.data.landscape),
  116 + // lengthTime:null,
  117 + linkUrl: value.data.linkUrl,
  118 + openLikes: Number.parseInt(value.data.openLikes),
  119 + openUrl: "",
  120 + pageId: value.data.pageId,
  121 + programAuth: "",
  122 + programId: "",
  123 + programName: "",
  124 + programSource: -1,
  125 + programType: -1,
  126 + provinceCode: value.data.provinceCode,
  127 + showTitleEd: value.data.showTitleEd,
  128 + showTitleIng: value.data.showTitleIng,
  129 + showTitleNo: value.data.showTitleNo,
  130 + startTime: value.data.startTime,
  131 + subType: "",
  132 + subtitle: "",
  133 + title: value.data.title,
  134 + vImageUrl: "",
  135 + screenType: "",
  136 + source: StringUtils.isEmpty(value.data.creatorName) ? value.data.sourceName : value.data.creatorName,
  137 + objectId: "",
  138 + objectType: value.data.type,
  139 + channelId: value.data.channelId,
  140 + relId: value.data.relId,
  141 + relType: value.data.relType,
  142 + newsTitle: value.data.titleLiteral,
  143 + publishTime: value.data.publishTime,
  144 + visitorComment: -1,
  145 + fullColumnImgUrls: photos,
  146 + newsSummary: "",
  147 + hasMore: -1,
  148 + slideShows: [],
  149 + voiceInfo: {} as VoiceInfoDTO,
  150 + tagWord: -1,
  151 + isSelect: true,
  152 + rmhInfo: {} as RmhInfoDTO,
  153 + photoNum: -1,
  154 + liveInfo: {} as LiveInfoDTO,
  155 + videoInfo: {
  156 + videoDuration: Number.parseInt(value.data.duration)
  157 + } as VideoInfoDTO,
  158 + interactData: {} as InteractDataDTO,
  159 + corner: '',
  160 + rmhPlatform: 0,
  161 + newTags: '',
  162 + isSearch: true
  163 + }
  164 +
  165 + this.data.push(contentDTO)
  166 + })
  167 + this.data.notifyDataReload()
  168 + this.count = this.data.totalCount()
  169 + if (this.data.totalCount() < resultData.totalCount) {
  170 + this.curPageNum++
  171 + }else {
  172 + this.hasMore = false
  173 + }
  174 + this.isLoading = false
  175 + }).catch((err:Error)=>{
  176 + console.log(TAG,"请求失败")
  177 + this.isLoading = false
  178 + })
  179 + }
  180 +
  181 + build() {
  182 + Column() {
  183 + if(this.count == 0){
  184 + ListHasNoMoreDataUI({style:2})
  185 + }else{
  186 + Column(){
  187 + if (this.data_rmh!=null && this.data_rmh.length > 0) {
  188 + //List
  189 + List() {
  190 + ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
  191 + ListItem() {
  192 + Column(){
  193 + Image($r('app.media.default_head'))
  194 + .width('84lpx')
  195 + .height('84lpx')
  196 + .margin({bottom:'15lpx'})
  197 + Text(item.creatorName)
  198 + .fontSize('20lpx')
  199 + }.alignItems(HorizontalAlign.Center)
  200 +
  201 + }.onClick(()=>{
  202 + //TODO 跳转
  203 + })
  204 + .width('150lpx')
  205 + })
  206 + }
  207 + .cachedCount(6)
  208 + .edgeEffect(EdgeEffect.None)
  209 + .scrollBar(BarState.Off)
  210 + .listDirection(Axis.Horizontal)
  211 + .width('100%')
  212 + .height('150lpx')
  213 + .onReachEnd(()=>{
  214 + if(!this.isLoading){
  215 + //进入更多关注页
  216 + }
  217 + })
  218 + }
  219 + //List
  220 + List({ space: '6lpx' }) {
  221 + LazyForEach(this.data, (item: ContentDTO, index: number) => {
  222 + ListItem() {
  223 + Column(){
  224 + CardParser({contentDTO:item})
  225 + if(index != this.data.totalCount()-1 ){
  226 + Divider()
  227 + .width('100%')
  228 + .height('1lpx')
  229 + .color($r('app.color.color_F5F5F5'))
  230 + .strokeWidth('1lpx')
  231 + }
  232 + }
  233 + }
  234 + .onClick(()=>{
  235 + //TODO 跳转
  236 + })
  237 + }, (item: ContentDTO, index: number) => index.toString())
  238 +
  239 + //没有更多数据 显示提示
  240 + if(!this.hasMore){
  241 + ListItem(){
  242 + ListHasNoMoreDataUI()
  243 + }
  244 + }
  245 + }.cachedCount(6)
  246 + .edgeEffect(EdgeEffect.None)
  247 + .scrollBar(BarState.Off)
  248 + .margin({top:'23lpx',left:'23lpx',right:'23lpx'})
  249 + .layoutWeight(1)
  250 + .onReachEnd(()=>{
  251 + console.log(TAG,"触底了");
  252 + if(!this.isLoading){
  253 + //加载分页数据
  254 + this.getNewSearchResultData()
  255 + }
  256 + })
  257 + }
  258 + }
  259 + }
  260 + .backgroundColor($r('app.color.white'))
  261 + .height('100%')
  262 + .width('100%')
  263 + }
  264 +}
1 import { Params } from 'wdBean'; 1 import { Params } from 'wdBean';
2 import { WDRouterPage, WDRouterRule } from 'wdRouter'; 2 import { WDRouterPage, WDRouterRule } from 'wdRouter';
3 -import featureAbility from '@ohos.ability.featureAbility'; 3 +import { EnvironmentCustomDialog } from './EnvironmentCustomDialog';
4 4
5 const TAG = 'AboutPageUI'; 5 const TAG = 'AboutPageUI';
6 6
@@ -9,7 +9,18 @@ export struct AboutPageUI { @@ -9,7 +9,18 @@ export struct AboutPageUI {
9 @State listData: Array<string | Array<string>> = ['隐私授权协议', '软件许可及用户协议']; 9 @State listData: Array<string | Array<string>> = ['隐私授权协议', '软件许可及用户协议'];
10 @State message: string = '京ICP备16066560号-6A Copyright © 人民日报客户端\nall rights reserved.' 10 @State message: string = '京ICP备16066560号-6A Copyright © 人民日报客户端\nall rights reserved.'
11 @State version: string = '版本号:v' 11 @State version: string = '版本号:v'
  12 + clickTimes: number = 0
  13 + dialogController: CustomDialogController = new CustomDialogController({
  14 + builder: EnvironmentCustomDialog({
  15 + cancel: () => {
12 16
  17 + },
  18 + confirm: () => {
  19 + }
  20 + }),
  21 + customStyle: true,
  22 + alignment: DialogAlignment.Center
  23 + })
13 24
14 build() { 25 build() {
15 Navigation() { 26 Navigation() {
@@ -19,18 +30,24 @@ export struct AboutPageUI { @@ -19,18 +30,24 @@ export struct AboutPageUI {
19 .title('关于') 30 .title('关于')
20 } 31 }
21 32
22 - aboutToAppear(){ 33 + aboutToAppear() {
23 let context = getContext(); 34 let context = getContext();
24 context.getApplicationContext(); 35 context.getApplicationContext();
25 } 36 }
26 37
27 - @Builder aboutUi() { 38 + @Builder
  39 + aboutUi() {
28 Column() { 40 Column() {
29 Image($r('app.media.setting_about_logo')) 41 Image($r('app.media.setting_about_logo'))
30 .width('278lpx') 42 .width('278lpx')
31 .height('154lpx') 43 .height('154lpx')
32 - .margin({top:'173lpx',bottom:'154lpx'})  
33 - 44 + .margin({ top: '173lpx', bottom: '154lpx' })
  45 + .onClick(() => {
  46 + this.clickTimes++
  47 + if (this.clickTimes > 2) {
  48 + this.dialogController.open()
  49 + }
  50 + })
34 // Row(){ 51 // Row(){
35 // 52 //
36 // }.backgroundColor(Color.Yellow) 53 // }.backgroundColor(Color.Yellow)
@@ -44,19 +61,17 @@ export struct AboutPageUI { @@ -44,19 +61,17 @@ export struct AboutPageUI {
44 // .height('97lpx') 61 // .height('97lpx')
45 62
46 63
47 -  
48 -  
49 - List(){  
50 - ForEach(this.listData, (item:string, index : number) =>{ 64 + List() {
  65 + ForEach(this.listData, (item: string, index: number) => {
51 ListItem() { 66 ListItem() {
52 this.getArrowCell(item, index) 67 this.getArrowCell(item, index)
53 - }.onClick(() =>{ 68 + }.onClick(() => {
54 if (index == 0) { 69 if (index == 0) {
55 - let bean={contentId:"1",pageID:""} as Params  
56 - WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean)  
57 - }else{  
58 - let bean={contentId:"2",pageID:""} as Params  
59 - WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) 70 + let bean = { contentID: "2", pageID: "" } as Params
  71 + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean)
  72 + } else {
  73 + let bean = { contentID: "1", pageID: "" } as Params
  74 + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean)
60 } 75 }
61 }) 76 })
62 }) 77 })
@@ -77,22 +92,21 @@ export struct AboutPageUI { @@ -77,22 +92,21 @@ export struct AboutPageUI {
77 .fontSize('25lpx') 92 .fontSize('25lpx')
78 .textAlign(TextAlign.Center) 93 .textAlign(TextAlign.Center)
79 .fontColor($r("app.color.color_666666")) 94 .fontColor($r("app.color.color_666666"))
80 - .margin({bottom:'31lpx'}) 95 + .margin({ bottom: '31lpx' })
81 96
82 Text(this.message) 97 Text(this.message)
83 .fontSize('19lpx') 98 .fontSize('19lpx')
84 .textAlign(TextAlign.Center) 99 .textAlign(TextAlign.Center)
85 .fontColor($r("app.color.color_999999")) 100 .fontColor($r("app.color.color_999999"))
86 - .margin({bottom:'35lpx'}) 101 + .margin({ bottom: '35lpx' })
87 } 102 }
88 .width('100%') 103 .width('100%')
89 .height('100%') 104 .height('100%')
90 } 105 }
91 106
92 -  
93 -  
94 // 右文字+箭头cell 107 // 右文字+箭头cell
95 - @Builder getArrowCell(item:string, index:number) { 108 + @Builder
  109 + getArrowCell(item: string, index: number) {
96 110
97 Row() { 111 Row() {
98 // 左侧标题 112 // 左侧标题
@@ -109,10 +123,8 @@ export struct AboutPageUI { @@ -109,10 +123,8 @@ export struct AboutPageUI {
109 .justifyContent(FlexAlign.SpaceBetween) 123 .justifyContent(FlexAlign.SpaceBetween)
110 .height('97lpx') 124 .height('97lpx')
111 .width('100%') 125 .width('100%')
112 - .padding({left:'29lpx',right:'29lpx'}) 126 + .padding({ left: '29lpx', right: '29lpx' })
113 } 127 }
114 -  
115 -  
116 } 128 }
117 129
118 130
@@ -17,6 +17,7 @@ import { Router } from '@ohos.arkui.UIContext'; @@ -17,6 +17,7 @@ import { Router } from '@ohos.arkui.UIContext';
17 import promptAction from '@ohos.promptAction'; 17 import promptAction from '@ohos.promptAction';
18 import { LogoutViewModel } from '../../viewmodel/LogoutViewModel'; 18 import { LogoutViewModel } from '../../viewmodel/LogoutViewModel';
19 import { CustomLogoutDialog } from './CustomLogoutDialog'; 19 import { CustomLogoutDialog } from './CustomLogoutDialog';
  20 +import { emitter } from '@kit.BasicServicesKit';
20 21
21 export { SettingPasswordParams } from "wdLogin" 22 export { SettingPasswordParams } from "wdLogin"
22 23
@@ -41,9 +42,11 @@ export struct AccountAndSecurityLayout { @@ -41,9 +42,11 @@ export struct AccountAndSecurityLayout {
41 alignment: DialogAlignment.Center 42 alignment: DialogAlignment.Center
42 }) 43 })
43 44
  45 +
44 aboutToAppear() { 46 aboutToAppear() {
45 // 获取设置页面数据 47 // 获取设置页面数据
46 this.getAccountAndSecurityData() 48 this.getAccountAndSecurityData()
  49 + this.addEmitEvent()
47 } 50 }
48 51
49 async getAccountAndSecurityData() { 52 async getAccountAndSecurityData() {
@@ -56,6 +59,28 @@ export struct AccountAndSecurityLayout { @@ -56,6 +59,28 @@ export struct AccountAndSecurityLayout {
56 59
57 } 60 }
58 61
  62 + addEmitEvent(){
  63 + // 定义一个eventId为1的事件
  64 + let event: emitter.InnerEvent = {
  65 + eventId: 10010
  66 + };
  67 +
  68 + // 收到eventId为1的事件后执行该回调
  69 + let callback = (eventData: emitter.EventData): void => {
  70 + promptAction.showToast({
  71 + message: JSON.stringify(eventData)
  72 + });
  73 + if(eventData&&eventData.data){
  74 + this.listData[0].subTitle = eventData.data['content']
  75 + }
  76 + Logger.debug( 'event callback:' + JSON.stringify(eventData));
  77 + };
  78 +
  79 + // 订阅eventId为1的事件
  80 + emitter.on(event, callback);
  81 +
  82 + }
  83 +
59 build() { 84 build() {
60 Column(){ 85 Column(){
61 if(this.isAccountPage){ 86 if(this.isAccountPage){
@@ -106,7 +131,8 @@ export struct AccountAndSecurityLayout { @@ -106,7 +131,8 @@ export struct AccountAndSecurityLayout {
106 ListItem() { 131 ListItem() {
107 if (item.type == 0) { 132 if (item.type == 0) {
108 Column() { 133 Column() {
109 - this.getArrowCell(item) 134 + // this.getArrowCell(item)
  135 + AccountArrowCell({ item:item})
110 }.padding({ left: '27lpx' }).height('117lpx').justifyContent(FlexAlign.Center) 136 }.padding({ left: '27lpx' }).height('117lpx').justifyContent(FlexAlign.Center)
111 } else if (item.type == 1) { 137 } else if (item.type == 1) {
112 Column() { 138 Column() {
@@ -285,7 +311,7 @@ export struct AccountAndSecurityLayout { @@ -285,7 +311,7 @@ export struct AccountAndSecurityLayout {
285 }.alignItems(VerticalAlign.Center) 311 }.alignItems(VerticalAlign.Center)
286 312
287 Row() { 313 Row() {
288 - Text("登录") 314 + Text("注销账户")
289 .borderRadius(4) 315 .borderRadius(4)
290 .fontColor(this.protocolState ? "#FFFFFFFF" : "#66FFFFFF") 316 .fontColor(this.protocolState ? "#FFFFFFFF" : "#66FFFFFF")
291 .fontSize(18) 317 .fontSize(18)
@@ -405,3 +431,46 @@ export struct AccountAndSecurityLayout { @@ -405,3 +431,46 @@ export struct AccountAndSecurityLayout {
405 return securityNum; 431 return securityNum;
406 } 432 }
407 } 433 }
  434 +
  435 +@Component
  436 +export struct AccountArrowCell{
  437 + @ObjectLink item: MineMainSettingFunctionItem
  438 + build() {
  439 + Column() {
  440 + Row() {
  441 + // 左侧logo和标题
  442 + Row() {
  443 + // 判断有没有图片
  444 + if (this.item.imgSrc) {
  445 + Image(this.item.imgSrc)
  446 + .height('38lpx')
  447 + .margin({ right: '5lpx' })
  448 + }
  449 + Text(`${this.item.title}`)
  450 + .margin({ top: '8lpx' })
  451 + .height('38lpx')
  452 + .fontColor('#333333')
  453 + .fontSize('29lpx')
  454 + }.width('60%')
  455 +
  456 + // 右侧文案和右箭头
  457 + Row() {
  458 + Text(this.item.subTitle ? this.item.subTitle : '')
  459 + .fontColor('#999999')
  460 + .maxLines(1)
  461 + Image($r('app.media.mine_user_arrow'))
  462 + .width('27lpx')
  463 + .height('27lpx')
  464 + .objectFit(ImageFit.Auto)
  465 + Column().width('29lpx')
  466 + }.width('40%')
  467 + .margin({ right: '29lpx' })
  468 + .justifyContent(FlexAlign.End)
  469 +
  470 + }
  471 + .alignItems(VerticalAlign.Center)
  472 + .justifyContent(FlexAlign.SpaceBetween)
  473 + }
  474 + .height('54lpx')
  475 + }
  476 +}
  1 +import { SPHelper } from 'wdKit/Index';
  2 +import { HttpUrlUtils } from 'wdNetwork/Index';
  3 +
  4 +@CustomDialog
  5 +export struct EnvironmentCustomDialog {
  6 + currentEnvironment: string = HttpUrlUtils.HOST_PRODUCT;
  7 + controller: CustomDialogController
  8 + cancel: () => void = () => {
  9 + }
  10 + confirm: () => void = () => {
  11 + }
  12 +
  13 + build() {
  14 + Column() {
  15 + Text("请选择环境")
  16 + .fontColor("#222222")
  17 + .fontSize(18)
  18 + .width("100%")
  19 + .fontWeight(FontWeight.Bold)
  20 + .textAlign(TextAlign.Center)
  21 + .margin({ top: 20 })
  22 + Row() {
  23 + Radio({ value: 'Radio1', group: 'radioGroup' })
  24 + .checked(true)
  25 + .height(20)
  26 + .width(20)
  27 + .onChange((isChecked: boolean) => {
  28 + if (isChecked) {
  29 + this.currentEnvironment = HttpUrlUtils.HOST_SIT;
  30 + }
  31 + })
  32 + Text('切换到SIT(测试)环境,重启应用生效')
  33 + .fontSize(14)
  34 + }
  35 + .justifyContent(FlexAlign.Start)
  36 + .width('90%')
  37 +
  38 + Row() {
  39 + Radio({ value: 'Radio1', group: 'radioGroup' })
  40 + .checked(true)
  41 + .height(20)
  42 + .width(20)
  43 + .onChange((isChecked: boolean) => {
  44 + if (isChecked) {
  45 + this.currentEnvironment = HttpUrlUtils.HOST_UAT;
  46 + }
  47 + })
  48 + Text('切换到UAT(预发布)环境,重启应用生效')
  49 + .fontSize(14)
  50 + }
  51 + .width('90%')
  52 + .justifyContent(FlexAlign.Start)
  53 +
  54 + Row() {
  55 + Radio({ value: 'Radio1', group: 'radioGroup' })
  56 + .checked(true)
  57 + .height(20)
  58 + .width(20)
  59 + .onChange((isChecked: boolean) => {
  60 + if (isChecked) {
  61 + this.currentEnvironment = HttpUrlUtils.HOST_PRODUCT;
  62 + }
  63 + })
  64 + Text('切换到PROD(现网)环境,重启应用生效')
  65 + .fontSize(14)
  66 + }
  67 + .width('90%')
  68 + .justifyContent(FlexAlign.Start)
  69 +
  70 + Row() {
  71 + Radio({ value: 'Radio1', group: 'radioGroup' })
  72 + .checked(true)
  73 + .height(20)
  74 + .width(20)
  75 + .onChange((isChecked: boolean) => {
  76 + if (isChecked) {
  77 + this.currentEnvironment = HttpUrlUtils.HOST_DEV;
  78 + }
  79 + })
  80 + Text('切换到DEV(开发)环境,重启应用生效')
  81 + .fontSize(14)
  82 + }
  83 + .width('90%')
  84 + .justifyContent(FlexAlign.Start)
  85 +
  86 + Button('确认')
  87 + .margin({ top: 20 })
  88 + .onClick(() => {
  89 + // HttpUrlUtils.hostUrl = this.currentEnvironment
  90 + SPHelper.default.saveSync('hostUrl', this.currentEnvironment);
  91 + this.controller.close()
  92 + this.confirm()
  93 + })
  94 + }.height(261).backgroundColor(Color.White).borderRadius(6).width('74%')
  95 +
  96 + }
  97 +}
1 -import { Action, CompDTO, Params } from 'wdBean';  
2 -import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';  
3 -import { CommonConstants } from 'wdConstant/Index';  
4 -import { DateTimeUtils, Logger } from 'wdKit';  
5 -import { WDRouterRule } from 'wdRouter';  
6 -  
7 -const TAG = 'AlbumCardComponent';  
8 -  
9 -@Preview  
10 -@Component  
11 -export struct AlbumCardComponent {  
12 - @State compDTO: CompDTO = {} as CompDTO  
13 -  
14 - aboutToAppear() {  
15 - Logger.debug(TAG + "this.compDTO.operDataList" + JSON.stringify(this.compDTO.operDataList));  
16 -  
17 - }  
18 -  
19 - build() {  
20 - Column({ space: 8 }) {  
21 - Text(this.compDTO.operDataList[0].newsTitle)  
22 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
23 - .fontSize(17)  
24 - .fontColor(0x222222)  
25 - .lineHeight(25)  
26 - .maxLines(3)  
27 - .width(CommonConstants.FULL_WIDTH)  
28 -  
29 - RelativeContainer() {  
30 - Image(this.compDTO.operDataList[0].fullColumnImgUrls[0].url)  
31 - .width('66.6%')  
32 - .aspectRatio(16/9)  
33 - .alignRules({  
34 - top: { anchor: "__container__", align: VerticalAlign.Top },  
35 - left: { anchor: "__container__", align: HorizontalAlign.Start }  
36 - })  
37 - .id('mainImage')  
38 -  
39 - Image(this.compDTO.operDataList[0].fullColumnImgUrls[1].url)  
40 - .width('33%')  
41 - .aspectRatio(16/9)  
42 - .alignRules({  
43 - top: { anchor: "__container__", align: VerticalAlign.Top },  
44 - right: { anchor: "__container__", align: HorizontalAlign.End }  
45 - })  
46 - .id('subTopImage')  
47 -  
48 - Image(this.compDTO.operDataList[0].fullColumnImgUrls[2].url)  
49 - .width('33%')  
50 - .aspectRatio(16/9)  
51 - .alignRules({  
52 - right: { anchor: "__container__", align: HorizontalAlign.End },  
53 - bottom: { anchor: "__container__", align: VerticalAlign.Bottom }  
54 - })  
55 - .id('subBottomImage')  
56 - // 下面是渲染右下角图标  
57 - Shape() {  
58 - Rect().width(33).height(18)  
59 - }  
60 - // .viewPort({ x: -2, y: -2, width: 304, height: 130 })  
61 - .fill(0x000000)  
62 - .fillOpacity(0.3)  
63 - // .strokeDashArray([20])  
64 - // .strokeDashOffset(10)  
65 - .strokeLineCap(LineCapStyle.Round)  
66 - .strokeLineJoin(LineJoinStyle.Round)  
67 - .antiAlias(true)  
68 - .id('shape')  
69 - .alignRules({  
70 - right: { anchor: "__container__", align: HorizontalAlign.End },  
71 - bottom: { anchor: "__container__", align: VerticalAlign.Bottom }  
72 - })  
73 - .margin({ right: 4,  
74 - bottom: 4 })  
75 -  
76 - Image($r('app.media.album_card_shape'))  
77 - .width(22)  
78 - .height(18)  
79 - .alignRules({  
80 - left: { anchor: "shape", align: HorizontalAlign.Start },  
81 - top: { anchor: "shape", align: VerticalAlign.Top }  
82 - })  
83 - .id('shapeSubImage')  
84 -  
85 - Text(this.compDTO.operDataList[0].fullColumnImgUrls.length + '')  
86 - .fontSize(13)  
87 - .fontColor(0xFFFFFF)  
88 - .id('pageIndex')  
89 - .alignRules({  
90 - right: { anchor: "shape", align: HorizontalAlign.End },  
91 - top: { anchor: "shape", align: VerticalAlign.Top }  
92 - })  
93 - .margin({ right: 2 })  
94 - .textAlign(TextAlign.Center)  
95 - .width(17)  
96 - .height(17)  
97 - }  
98 - .width(CommonConstants.FULL_WIDTH)  
99 - .aspectRatio(24/9)  
100 - .onClick((event: ClickEvent) => {  
101 - let taskAction: Action = {  
102 - type: 'JUMP_DETAIL_PAGE',  
103 - params: {  
104 - detailPageType: 17,  
105 - contentID: this.compDTO.operDataList?.[0].objectId,  
106 - extra: {  
107 - relType: this.compDTO.operDataList?.[0].relType,  
108 - relId: `${this.compDTO.operDataList?.[0].relId}`,  
109 - } as ExtraDTO  
110 - } as Params,  
111 - };  
112 - WDRouterRule.jumpWithAction(taskAction)  
113 - })  
114 -  
115 - Row() {  
116 - if (this.compDTO.operDataList[0].source) {  
117 - Text(this.compDTO.operDataList[0].source)  
118 - .fontSize(13)  
119 - .fontColor(0xB0B0B0)  
120 - Image($r('app.media.point'))  
121 - .width(16)  
122 - .height(16)  
123 - }  
124 - if (this.compDTO.operDataList[0].publishTime && this.compDTO.operDataList[0].publishTime.length === 13) {  
125 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.compDTO.operDataList[0].publishTime)))  
126 - .fontSize(13)  
127 - .fontColor(0xB0B0B0)  
128 - }  
129 - Text('328评')  
130 - .fontSize(13)  
131 - .fontColor(0xB0B0B0)  
132 - .margin({  
133 - left: 6  
134 - })  
135 - }  
136 - .width(CommonConstants.FULL_WIDTH)  
137 - .height(16)  
138 - .id('label')  
139 - }  
140 - .width(CommonConstants.FULL_WIDTH)  
141 - .padding({  
142 - top: 14,  
143 - left: 16,  
144 - right: 16,  
145 - bottom: 14  
146 - })  
147 - }  
148 -}  
@@ -52,8 +52,7 @@ export struct BannerComponent { @@ -52,8 +52,7 @@ export struct BannerComponent {
52 .borderRadius($r('app.float.image_border_radius')) 52 .borderRadius($r('app.float.image_border_radius'))
53 .displayCount(this.buildDisplayCount()) // 仅展示1个图片 53 .displayCount(this.buildDisplayCount()) // 仅展示1个图片
54 .cachedCount(2) 54 .cachedCount(2)
55 - .index(1) // The default index of Swiper.  
56 - .autoPlay(true) 55 + .index(0) // The default index of Swiper.
57 .indicator(Indicator.dot() 56 .indicator(Indicator.dot()
58 .right(5) 57 .right(5)
59 .itemWidth(4) 58 .itemWidth(4)
1 -import { CompDTO, slideShows } from 'wdBean';  
2 -import { CommonConstants } from 'wdConstant'  
3 -import { DateTimeUtils } from 'wdKit';  
4 -import { ProcessUtils } from '../../utils/ProcessUtils';  
5 -/**  
6 - * 时间链卡--CompStyle: 09  
7 - */  
8 -@Component  
9 -export struct CompStyle_09 {  
10 - @State compDTO: CompDTO = {} as CompDTO  
11 -  
12 - build() {  
13 - Column(){  
14 - // 顶部标题,最多两行  
15 - if(this.compDTO.operDataList[0].newsTitle) {  
16 - Text(this.compDTO.operDataList[0].newsTitle)  
17 - .width(CommonConstants.FULL_WIDTH)  
18 - .fontSize($r('app.float.font_size_17'))  
19 - .fontWeight(600)  
20 - .maxLines(2)  
21 - .textOverflow({overflow: TextOverflow.Ellipsis})  
22 - .margin({ bottom: 19 })  
23 - }  
24 - // 大图  
25 - Stack(){  
26 - Image(this.compDTO.operDataList[0].coverUrl)  
27 - .width('100%')  
28 - .borderRadius({topLeft: $r('app.float.image_border_radius'), topRight: $r('app.float.image_border_radius')})  
29 - Text('专题')  
30 - .fontSize($r('app.float.font_size_12'))  
31 - .padding({left: 8, right: 8, top: 3, bottom: 3})  
32 - .backgroundColor(Color.Red)  
33 - .fontColor(Color.White)  
34 - .borderRadius($r('app.float.button_border_radius'))  
35 - .margin({left: 5, bottom: 5})  
36 - }.alignContent(Alignment.BottomStart)  
37 - // 时间线--后端返回三个,  
38 - Column(){  
39 - ForEach(this.compDTO.operDataList[0].slideShows, (item:slideShows, index:number) => {  
40 - this.timelineItem(item, index)  
41 - })  
42 - }  
43 - // 底部-查看更多。根据接口返回的isMore判断是否显示查看更多  
44 - if(this.compDTO.operDataList[0].hasMore == 1) {  
45 - Row() {  
46 - Text("查看更多")  
47 - .fontSize($r("app.float.font_size_14"))  
48 - .fontColor($r("app.color.color_222222"))  
49 - .margin({ right: 1 })  
50 - Image($r("app.media.more"))  
51 - .width(14)  
52 - .height(14)  
53 - }  
54 - .backgroundColor($r('app.color.color_F5F5F5'))  
55 - .width(CommonConstants.FULL_WIDTH)  
56 - .height(40)  
57 - .borderRadius($r('app.float.button_border_radius'))  
58 - .justifyContent(FlexAlign.Center)  
59 - .margin({top: 5})  
60 - }  
61 - }  
62 - .width(CommonConstants.FULL_WIDTH)  
63 - .padding({  
64 - top: 14,  
65 - left: 16,  
66 - right: 16,  
67 - bottom: 14  
68 - })  
69 - .backgroundColor($r("app.color.white"))  
70 - .margin({ bottom: 8 })  
71 - .onClick((event: ClickEvent) => {  
72 - ProcessUtils.processPage(this.compDTO?.operDataList[0])  
73 - })  
74 - }  
75 -  
76 - @Builder timelineItem (item:slideShows, index:number) {  
77 - Column(){  
78 - Stack() {  
79 - if(index < this.compDTO.operDataList[0].slideShows.length - 1) {  
80 - Divider()  
81 - .vertical(true)  
82 - .color($r('app.color.color_EDEDED'))  
83 - .strokeWidth(1)  
84 - .margin({top: index > 0 ? 0 : 16, left: 4})  
85 - }  
86 - if(index > 0 && index == this.compDTO.operDataList[0].slideShows.length - 1) {  
87 - Divider()  
88 - .vertical(true)  
89 - .color($r('app.color.color_EDEDED'))  
90 - .strokeWidth(1)  
91 - .height(16)  
92 - .margin({left: 4})  
93 - }  
94 -  
95 - Column(){  
96 - Row() {  
97 - // 标题  
98 - Image($r("app.media.point_icon"))  
99 - .width(9)  
100 - .height(9)  
101 - .margin({ right: 5 })  
102 - Text(DateTimeUtils.formatDate(item.publishTime, "MM月dd日 HH:mm"))  
103 - .fontSize($r('app.float.font_size_12'))  
104 - .fontColor($r('app.color.color_222222'))  
105 - .fontWeight(600)  
106 - }  
107 - .width(CommonConstants.FULL_WIDTH)  
108 - .height(32)  
109 - .alignItems(VerticalAlign.Center)  
110 - Row() {  
111 - Text(item.newsTitle)  
112 - .fontSize($r('app.float.font_size_17'))  
113 - .fontWeight(400)  
114 - .fontColor($r('app.color.color_222222'))  
115 - .layoutWeight(1)  
116 - .maxLines(2)  
117 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
118 - .alignSelf(ItemAlign.Center)  
119 - .margin({left: 12})  
120 - if(item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {  
121 - Image(item.fullColumnImgUrls[0].url)  
122 - .width(90)  
123 - .height(60)  
124 - .borderRadius($r('app.float.image_border_radius'))  
125 - }  
126 - }  
127 - }  
128 - }  
129 - .alignContent(Alignment.TopStart)  
130 - }  
131 - .height(item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url ? 100 : 78)  
132 - .alignItems(HorizontalAlign.Start)  
133 - }  
134 -}  
1 -import { CompDTO, ContentDTO, slideShows } from 'wdBean';  
2 -import { CommonConstants } from 'wdConstant'  
3 -import { DateTimeUtils } from 'wdKit';  
4 -import { ProcessUtils } from '../../utils/ProcessUtils';  
5 -  
6 -  
7 -/**  
8 - * 大专题卡--CompStyle: 10  
9 - */  
10 -@Component  
11 -export struct CompStyle_10 {  
12 - @State compDTO: CompDTO = {} as CompDTO  
13 -  
14 - build() {  
15 - Column(){  
16 - // 顶部标题,最多两行  
17 - if(this.compDTO.operDataList[0].newsTitle) {  
18 - Text(this.compDTO.operDataList[0].newsTitle)  
19 - .width(CommonConstants.FULL_WIDTH)  
20 - .fontSize($r('app.float.font_size_17'))  
21 - .fontWeight(600)  
22 - .maxLines(2)  
23 - .textOverflow({overflow: TextOverflow.Ellipsis})  
24 - .margin({ bottom: 19 })  
25 - }  
26 - // 大图  
27 - Stack(){  
28 - Image(this.compDTO.operDataList[0] && this.compDTO.operDataList[0].coverUrl)  
29 - .width('100%')  
30 - .borderRadius({topLeft: $r('app.float.image_border_radius'), topRight: $r('app.float.image_border_radius')})  
31 - .onClick((event: ClickEvent) => {  
32 - ProcessUtils.processPage(this.compDTO?.operDataList[0])  
33 - })  
34 - Text('专题')  
35 - .fontSize($r('app.float.font_size_12'))  
36 - .padding({left: 8, right: 8, top: 3, bottom: 3})  
37 - .backgroundColor(Color.Red)  
38 - .fontColor(Color.White)  
39 - .borderRadius($r('app.float.button_border_radius'))  
40 - .margin({left: 5, bottom: 5})  
41 - }.alignContent(Alignment.BottomStart)  
42 - // 专题列表--后端返回三个,  
43 - Column(){  
44 - ForEach(this.compDTO.operDataList[0].slideShows, (item:slideShows, index:number) => {  
45 - this.timelineItem(item, index)  
46 - })  
47 - }  
48 - // 底部-查看更多。根据接口返回的isMore判断是否显示查看更多  
49 - if(this.compDTO.operDataList[0].hasMore == 1) {  
50 - Row() {  
51 - Text("查看更多")  
52 - .fontSize($r("app.float.font_size_14"))  
53 - .fontColor($r("app.color.color_222222"))  
54 - .margin({ right: 1 })  
55 - Image($r("app.media.more"))  
56 - .width(14)  
57 - .height(14)  
58 - }  
59 - .backgroundColor($r('app.color.color_F5F5F5'))  
60 - .width(CommonConstants.FULL_WIDTH)  
61 - .height(40)  
62 - .borderRadius($r('app.float.button_border_radius'))  
63 - .justifyContent(FlexAlign.Center)  
64 - .margin({top: 5})  
65 - .onClick((event: ClickEvent) => {  
66 - ProcessUtils.processPage(this.compDTO?.operDataList[0])  
67 - })  
68 - }  
69 - }  
70 - .width(CommonConstants.FULL_WIDTH)  
71 - .padding({  
72 - top: 14,  
73 - left: 16,  
74 - right: 16,  
75 - bottom: 14  
76 - })  
77 - .backgroundColor($r("app.color.white"))  
78 - .margin({ bottom: 8 })  
79 - }  
80 - @Builder timelineItem (item:slideShows, index:number) {  
81 - Row() {  
82 - Column(){  
83 - Text(item.newsTitle)  
84 - .fontSize($r('app.float.font_size_17'))  
85 - .fontWeight(400)  
86 - .fontColor($r('app.color.color_222222'))  
87 - .maxLines(2)  
88 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
89 - Row(){  
90 - // 展示发稿人  
91 - if(item.source) {  
92 - Text(item.source)  
93 - .fontSize($r('app.float.font_size_12'))  
94 - .fontColor($r('app.color.color_B0B0B0'))  
95 - .textOverflow({overflow: TextOverflow.Ellipsis})  
96 - .maxLines(1)  
97 - .width(item.source.length > 10 ? '60%' : '')  
98 -  
99 - Image($r('app.media.point'))  
100 - .width(16)  
101 - .height(16)  
102 - }  
103 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(String(item.publishTime))))  
104 - .fontSize($r("app.float.font_size_12"))  
105 - .fontColor($r("app.color.color_B0B0B0"))  
106 - }  
107 - .margin({top: 12})  
108 - }  
109 - .layoutWeight(1)  
110 - .alignItems(HorizontalAlign.Start)  
111 -  
112 - // 右侧图片  
113 - if(item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {  
114 - Image(item.fullColumnImgUrls[0].url)  
115 - .width(117)  
116 - .height(78)  
117 - .objectFit(ImageFit.Cover)  
118 - .borderRadius($r('app.float.image_border_radius'))  
119 - .margin({left: 12})  
120 - }  
121 - }  
122 - .padding({top: 10, bottom: 10})  
123 - .onClick((event: ClickEvent) => {  
124 - const str: string = JSON.stringify(this.compDTO.operDataList[0]);  
125 - const data: ContentDTO = JSON.parse(str)  
126 - data.objectId = item.newsId  
127 - data.relId = item.relId  
128 - data.objectType = String(item.objectType)  
129 - ProcessUtils.processPage(data)  
130 - })  
131 - }  
132 -}  
@@ -4,6 +4,42 @@ import { Logger } from 'wdKit'; @@ -4,6 +4,42 @@ import { Logger } from 'wdKit';
4 const TAG = 'EmptyComponent'; 4 const TAG = 'EmptyComponent';
5 5
6 /** 6 /**
  7 + * WDViewDefaultType 缺省页
  8 + */
  9 +export const enum WDViewDefaultType {
  10 + ///默认
  11 + WDViewDefaultType_Default,
  12 + ///无网
  13 + WDViewDefaultType_NoNetwork,
  14 + ///暂无内容(列表页)
  15 + WDViewDefaultType_NoListContent,
  16 + ///内容找不到了(内容详情页)
  17 + WDViewDefaultType_NoContent,
  18 + ///无搜索内容
  19 + WDViewDefaultType_NoSearchResult,
  20 + ///无消息内容
  21 + WDViewDefaultType_NoMessage,
  22 + ///无收藏内容
  23 + WDViewDefaultType_NoCollection,
  24 + ///无历史记录
  25 + WDViewDefaultType_NoHistory,
  26 + ///网络失败
  27 + WDViewDefaultType_NetworkFailed,
  28 + ///内容获取失败
  29 + WDViewDefaultType_ContentFailed,
  30 + ///无预约内容
  31 + WDViewDefaultType_NoBooking,
  32 + ///无评论内容
  33 + WDViewDefaultType_NoComment,
  34 + ///暂无作品
  35 + WDViewDefaultType_NoCreation,
  36 + ///该号主无法访问
  37 + WDViewDefaultType_NoVisitAccount,
  38 + ///暂无关注
  39 + WDViewDefaultType_NoFollow
  40 +}
  41 +
  42 +/**
7 * 空数据/无数据 43 * 空数据/无数据
8 */ 44 */
9 @Component 45 @Component
@@ -11,18 +47,19 @@ export struct EmptyComponent { @@ -11,18 +47,19 @@ export struct EmptyComponent {
11 // private emptySize: SizeOptions = {}; 47 // private emptySize: SizeOptions = {};
12 @State emptyWidth: string | number = CommonConstants.FULL_PARENT; 48 @State emptyWidth: string | number = CommonConstants.FULL_PARENT;
13 @State emptyHeight: string | number = CommonConstants.FULL_PARENT; 49 @State emptyHeight: string | number = CommonConstants.FULL_PARENT;
  50 + @State emptyType:number = WDViewDefaultType.WDViewDefaultType_Default
14 /** 51 /**
15 * The empty image width percentage setting. 52 * The empty image width percentage setting.
16 */ 53 */
17 - readonly EMPTY_IMAGE_WIDTH: string = '50%'; 54 + readonly EMPTY_IMAGE_WIDTH: string = '15%';
18 /** 55 /**
19 * The empty image height percentage setting. 56 * The empty image height percentage setting.
20 */ 57 */
21 - readonly EMPTY_IMAGE_HEIGHT: string = '30%'; 58 + readonly EMPTY_IMAGE_HEIGHT: string = '15%';
22 /** 59 /**
23 * The empty data text component margin top. 60 * The empty data text component margin top.
24 */ 61 */
25 - readonly EMPTY_TIP_TEXT_MARGIN_TOP: string = '2%'; 62 + readonly EMPTY_TIP_TEXT_MARGIN_TOP: string = '10';
26 /** 63 /**
27 * The empty data text opacity. 64 * The empty data text opacity.
28 */ 65 */
@@ -38,11 +75,11 @@ export struct EmptyComponent { @@ -38,11 +75,11 @@ export struct EmptyComponent {
38 @Builder 75 @Builder
39 noProgrammeData() { 76 noProgrammeData() {
40 Column() { 77 Column() {
41 - // Image($r('app.media.icon_no_content'))  
42 - // .width(this.EMPTY_IMAGE_WIDTH)  
43 - // .height(this.EMPTY_IMAGE_HEIGHT)  
44 - // .objectFit(ImageFit.Contain)  
45 - // // .border({ width: 1, color: Color.Red, radius: 6 }) 78 + Image(this.buildNoDataTipImage())
  79 + .width('this.EMPTY_IMAGE_WIDTH')
  80 + .height(this.EMPTY_IMAGE_HEIGHT)
  81 + .objectFit(ImageFit.Contain)
  82 + // .border({ width: 1, color: Color.Red, radius: 6 })
46 83
47 Text(this.buildNoDataTip()) 84 Text(this.buildNoDataTip())
48 .fontSize($r('app.float.normal_text_size')) 85 .fontSize($r('app.float.normal_text_size'))
@@ -59,8 +96,22 @@ export struct EmptyComponent { @@ -59,8 +96,22 @@ export struct EmptyComponent {
59 .height(this.emptyHeight) 96 .height(this.emptyHeight)
60 } 97 }
61 98
62 - buildNoDataTip(): Resource | string { 99 + buildNoDataTip(): string {
  100 + Logger.info(TAG, "buildNoDataTip");
  101 + let contentString: string = '暂无内容'
  102 + if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection) {
  103 + contentString = '暂无收藏'
  104 + }
  105 + return contentString
  106 + }
  107 +
  108 +
  109 + buildNoDataTipImage(): Resource | string {
63 Logger.info(TAG, "buildNoDataTip"); 110 Logger.info(TAG, "buildNoDataTip");
64 - return $r('app.string.load_net_data_none') 111 + let imageString: Resource | string = $r('app.media.icon_no_content')
  112 + if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection) {
  113 + imageString = $r('app.media.icon_no_collection')
  114 + }
  115 + return imageString
65 } 116 }
66 } 117 }
1 -import { CompDTO } from 'wdBean';  
2 -import { CommonConstants } from 'wdConstant';  
3 -import { ProcessUtils } from '../../utils/ProcessUtils';  
4 -  
5 -@Component  
6 -export struct HeadPictureCardComponent {  
7 - @State compDTO: CompDTO = {} as CompDTO  
8 -  
9 - build() {  
10 - Stack() {  
11 - Image(this.compDTO.operDataList[0].coverUrl)  
12 - .width(CommonConstants.FULL_WIDTH)  
13 - .autoResize(true)  
14 - .borderRadius($r('app.float.image_border_radius'))  
15 - if (this.compDTO.operDataList[0].newsTitle) {  
16 - Row()  
17 - .width(CommonConstants.FULL_WIDTH)  
18 - .height(59)  
19 - .linearGradient({  
20 - colors: [  
21 - ['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]  
22 - ]  
23 - })  
24 - Row() {  
25 - Text(this.compDTO.operDataList[0].newsTitle)  
26 - .width(CommonConstants.FULL_WIDTH)  
27 - .height(CommonConstants.FULL_HEIGHT)  
28 - .fontColor(Color.White)  
29 - .fontSize($r('app.float.normal_text_size'))  
30 - .fontWeight(FontWeight.Bold)  
31 - .maxLines(2)  
32 - .align(Alignment.Bottom)  
33 - }  
34 - .justifyContent(FlexAlign.Start)  
35 - .height(40)  
36 - .margin({ left: 12, bottom: 10, right: 12 })  
37 - }  
38 - }  
39 - .alignContent(Alignment.Bottom)  
40 - .width(CommonConstants.FULL_WIDTH)  
41 - .padding(  
42 - { top: 16, bottom: 16, left: 14, right: 14 })  
43 - .onClick((event: ClickEvent) => {  
44 - ProcessUtils.processPage(this.compDTO?.operDataList[0])  
45 - })  
46 - }  
47 -}  
@@ -27,11 +27,11 @@ export struct RecommendList { @@ -27,11 +27,11 @@ export struct RecommendList {
27 .width(CommonConstants.FULL_PARENT) 27 .width(CommonConstants.FULL_PARENT)
28 .justifyContent(FlexAlign.Start) 28 .justifyContent(FlexAlign.Start)
29 } 29 }
30 - ForEach(this.recommendList, (item: ContentDTO) => {  
31 - Row(){ 30 + ForEach(this.recommendList, (item: ContentDTO, index: number) => {
  31 + Row() {
32 CardParser({ contentDTO: item }); 32 CardParser({ contentDTO: item });
33 }.border({ 33 }.border({
34 - width:{bottom: 1}, 34 + width: { bottom: this.recommendList.length === index + 1 ? 0 : 1 },
35 color: '#f5f5f5' 35 color: '#f5f5f5'
36 }) 36 })
37 }, (item: ContentDTO) => JSON.stringify(item)) 37 }, (item: ContentDTO) => JSON.stringify(item))
1 -import { Action, CompDTO, ContentDTO, Params } from 'wdBean';  
2 -import { CompStyle } from 'wdConstant';  
3 -import { Logger, DateTimeUtils } from 'wdKit';  
4 -import { WDRouterRule } from 'wdRouter';  
5 -  
6 -const TAG = 'SingleImageCardAppComponent';  
7 -const FULL_PARENT: string = '100%';  
8 -  
9 -/**  
10 - * 单图卡-3行标题/2行标题  
11 - * 枚举值13  
12 - *  
13 - * 重磅推荐/精选/电视剧/电影/综艺/短剧/更多>/  
14 - */  
15 -@Entry  
16 -@Component  
17 -export struct SingleImageCardAppComponent {  
18 - // @State compDTO: CompDTO = {} as CompDTO  
19 -  
20 - @State compDTO: CompDTO = {  
21 - operDataList: [  
22 - {  
23 - coverSize: '660*371',  
24 - coverType: 1,  
25 - visitorComment: 10,  
26 - coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/a9028e7011bb440e94ba7c63d80b39b7.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',  
27 - newsTitle: '一条江豚的自述',  
28 - newsSummary: '我是生活在长江里的一头江豚,是长江中唯一的水生哺乳动物,更是国家一级保护动物。但曾几何时,我和我的江中小伙伴出现了生存危机……直到有一天,我突然发现,打渔人变成护渔人,江水变清澈了,长江逐渐恢复了生机,我的家族数量上升到了1249头。当长江之水再一次悠悠流淌,我们相拥在清澈波光中起舞。长江,我的家园。',  
29 - videoInfo: {  
30 - // clarity: 1,  
31 - resolutionHeight: 20,  
32 - resolutionWidth: 20,  
33 - videoDuration: 229,  
34 - videoLandScape: 1,  
35 - videoType: 1,  
36 - videoUrl: "https://cdnjdout.aikan.pdnews.cn/zhbj-20240116/vod/content/output/c72f4170db2c4d34befa453f60d39a69_opt.mp4",  
37 - firstFrameImageUri: "", // 首帧图;【视频内容,contentPictures中】  
38 - },  
39 -  
40 - } as ContentDTO  
41 - ]  
42 - } as CompDTO  
43 -  
44 - aboutToAppear() {  
45 - }  
46 -  
47 - build() {  
48 - Column() {  
49 - Text(this.compDTO.operDataList[0].newsTitle)  
50 - .fontSize(16)  
51 - .fontWeight(FontWeight.Bold)  
52 - .alignSelf(ItemAlign.Start)  
53 - .maxLines(3)  
54 - .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。  
55 - if (this.compDTO.operDataList[0].coverUrl) {  
56 - Stack() {  
57 - Image(this.compDTO.operDataList[0].coverUrl)  
58 - .borderRadius(5)  
59 - .aspectRatio(16 / 9)  
60 - .padding({ top: 10 })  
61 - if (this.compDTO.operDataList[0].videoInfo) {  
62 - Row() {  
63 - Image($r('app.media.iv_card_play_yellow_flag'))  
64 - .width(22)  
65 - .height(18)  
66 - Text(DateTimeUtils.getFormattedDuration(this.compDTO.operDataList[0].videoInfo.videoDuration * 1000))  
67 - .fontSize($r('app.float.font_size_13'))  
68 - .fontWeight(400)  
69 - .fontColor($r('app.color.color_fff'))  
70 - }  
71 - .alignItems(VerticalAlign.Bottom)  
72 - .height(18)  
73 - .padding({ right: 4 })  
74 - .margin({  
75 - right: 4,  
76 - bottom: 4  
77 - })  
78 - .backgroundColor($r('app.color.color_4d000000'))  
79 - }  
80 - }.alignContent(Alignment.BottomEnd)  
81 - }  
82 - if (this.compDTO.operDataList[0].newsSummary) {  
83 - Text(this.compDTO.operDataList[0].newsSummary)  
84 - .fontSize(14)  
85 - .padding({ top: 10 })  
86 - .alignSelf(ItemAlign.Start)  
87 - .maxLines(3)  
88 - .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。  
89 - }  
90 - Row() {  
91 - Text(this.compDTO.operDataList[0].visitorComment + "评")  
92 - .fontSize(12)  
93 - .fontColor(Color.Gray)  
94 - Image($r('app.media.icon_share'))  
95 - .width(16)  
96 - .height(16)  
97 - .margin(10)  
98 - }.width(FULL_PARENT)  
99 - .justifyContent(FlexAlign.SpaceBetween)  
100 - }  
101 - .margin(22)  
102 - }  
103 -}  
1 -import { Action, CompDTO, Params } from 'wdBean';  
2 -import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';  
3 -import { CompStyle } from 'wdConstant';  
4 -import { Logger, DateTimeUtils } from 'wdKit';  
5 -import { WDRouterRule } from 'wdRouter';  
6 -import { ProcessUtils } from '../../utils/ProcessUtils';  
7 -  
8 -const TAG = 'SingleImageCardComponent';  
9 -const FULL_PARENT: string = '100%';  
10 -  
11 -/**  
12 - * 单图卡-3行标题/2行标题  
13 - * 枚举值13  
14 - * ImageCard-03  
15 - * 重磅推荐/精选/电视剧/电影/综艺/短剧/更多>/  
16 - */  
17 -  
18 -@Component  
19 -export struct SingleImageCardComponent {  
20 - @State compDTO: CompDTO = {} as CompDTO  
21 -  
22 - aboutToAppear() {  
23 - //Logger.debug(TAG + "" + JSON.stringify(this.compDTO.operDataList));  
24 -  
25 - }  
26 -  
27 - build() {  
28 - Row() {  
29 - Column() {  
30 - Column() {  
31 - Text(this.compDTO.operDataList[0].newsTitle)  
32 - .fontSize(16)  
33 - .fontWeight(FontWeight.Normal)  
34 - .maxLines(3)//  
35 - .alignSelf(ItemAlign.Start)  
36 - .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。  
37 - }.height("80%")  
38 - .justifyContent(FlexAlign.Start)  
39 -  
40 - Row() {  
41 - if (this.compDTO.operDataList[0].source) {  
42 - Text(this.compDTO.operDataList[0].source)  
43 - .fontSize($r('app.float.font_size_12'))  
44 - .fontColor(Color.Gray)  
45 - .maxLines(1)  
46 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
47 - .width(this.compDTO.operDataList[0].source.length > 8 ? '50%' : '')  
48 - Image($r('app.media.point'))  
49 - .width(16)  
50 - .height(16)  
51 - }  
52 - if (this.compDTO.operDataList[0].publishTime && this.compDTO.operDataList[0].publishTime.length === 13) {  
53 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.compDTO.operDataList[0].publishTime)))  
54 - .fontSize($r('app.float.font_size_12'))  
55 - .fontColor(Color.Gray)  
56 - }  
57 - Text(this.compDTO.operDataList[0].visitorComment + '评')  
58 - .fontSize($r('app.float.font_size_12'))  
59 - .fontColor(Color.Gray)  
60 - .padding({  
61 - left: 5  
62 - })  
63 - }.alignSelf(ItemAlign.Start)  
64 - .height("20%")  
65 - .justifyContent(FlexAlign.Start)  
66 - }  
67 - .alignItems(HorizontalAlign.Start)  
68 - .justifyContent(FlexAlign.Start)  
69 - .width('58%')  
70 -  
71 - Blank(16)  
72 - if (this.compDTO.operDataList[0].coverUrl) {  
73 - Stack() {  
74 - Image(this.compDTO.operDataList[0].coverUrl)  
75 - .borderRadius(5)  
76 - .aspectRatio(this.compDTO.compStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4)  
77 - .height(this.compDTO.compStyle === CompStyle.Card_13 ? 90 : 180)  
78 - if (this.compDTO.operDataList[0].videoInfo) {  
79 - Row() {  
80 - Image($r('app.media.iv_card_play_yellow_flag'))  
81 - .width(22)  
82 - .height(18)  
83 - Text(DateTimeUtils.getFormattedDuration(this.compDTO.operDataList[0].videoInfo.videoDuration * 1000))  
84 - .fontSize($r('app.float.font_size_13'))  
85 - .fontWeight(400)  
86 - .fontColor($r('app.color.color_fff'))  
87 - }  
88 - .alignItems(VerticalAlign.Bottom)  
89 - .height(18)  
90 - .padding({ right: 4 })  
91 - .margin({  
92 - right: 4,  
93 - bottom: 4  
94 - })  
95 - .backgroundColor($r('app.color.color_4d000000'))  
96 - } else if(this.compDTO.operDataList[0].voiceInfo) {  
97 - Row() {  
98 - Image($r('app.media.icon_listen'))  
99 - .width(22)  
100 - .height(18)  
101 - Text(DateTimeUtils.getFormattedDuration(this.compDTO.operDataList[0].voiceInfo  
102 - .voiceDuration * 1000))  
103 - .fontSize($r('app.float.font_size_13'))  
104 - .fontWeight(400)  
105 - .fontColor($r('app.color.color_fff'))  
106 - }  
107 - .alignItems(VerticalAlign.Bottom)  
108 - .height(18)  
109 - .padding({ right: 4 })  
110 - .margin({  
111 - right: 4,  
112 - bottom: 4  
113 - })  
114 - .backgroundColor($r('app.color.color_4d000000'))  
115 - }  
116 - }.alignContent(Alignment.BottomEnd)  
117 - }  
118 - }  
119 - .onClick((event: ClickEvent) => {  
120 - ProcessUtils.processPage(this.compDTO?.operDataList[0])  
121 - })  
122 - .padding(  
123 - { top: 16, bottom: 16, left: 14, right: 14 })  
124 - .width(FULL_PARENT)  
125 - .height(this.compDTO.compStyle === CompStyle.Card_13 ? 127 : 217)  
126 - .justifyContent(FlexAlign.SpaceBetween)  
127 - }  
128 -}  
1 -// import { CommonConstants } from 'wdConstant/src/main/ets/constants/CommonConstants'  
2 -  
3 -@Entry  
4 -@Component  
5 -export struct SmallVideoCardComponent {  
6 - build() {  
7 - Row() {  
8 - Column() {  
9 - Text('“畅享亚运”新模式活动打卡,看杭州打开“金角银边活动启动 跟着体育明星云打卡,看杭州打开“金角银边')  
10 - .fontWeight(400)  
11 - .fontSize($r('app.float.font_size_17'))  
12 - .maxLines(4)  
13 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
14 - .fontColor($r('app.color.color_222222'))  
15 - .lineHeight(25)  
16 - Row() {  
17 - Text('人民日报')  
18 - .labelTextStyle()  
19 - Image($r('app.media.point'))  
20 - .width(16)  
21 - .height(16)  
22 - Text('20分钟前')  
23 - .labelTextStyle()  
24 - .margin({  
25 - right: 6  
26 - })  
27 - Text('2000评')  
28 - .labelTextStyle()  
29 - }  
30 - }  
31 - .height(156)  
32 - .layoutWeight(1)  
33 - .justifyContent(FlexAlign.SpaceBetween)  
34 - .alignItems(HorizontalAlign.Start)  
35 - .margin({ right: 12 })  
36 -  
37 - Stack({ alignContent: Alignment.BottomEnd }) {  
38 - Image('https://www.harmonyos.com/resource/image/partner/harmonyos-connect/pic_shengtai_connect_qudao_xianxia.jpg')  
39 - .width(117)  
40 - .aspectRatio(117 / 156)  
41 - .border({ radius: 4 })  
42 - Row() {  
43 - Image($r('app.media.iv_card_play_yellow_flag'))  
44 - .width(22)  
45 - .height(18)  
46 - Text('10:00')  
47 - .fontSize($r('app.float.font_size_13'))  
48 - .fontWeight(400)  
49 - .fontColor($r('app.color.color_fff'))  
50 - }  
51 - .height(18)  
52 - .padding({ right: 4 })  
53 - .margin({  
54 - right: 4,  
55 - bottom: 4  
56 - })  
57 - .backgroundColor($r('app.color.color_4d000000'))  
58 - }  
59 - }  
60 - // .width(CommonConstants.FULL_WIDTH)  
61 - .width('100%')  
62 - .height(184)  
63 - .padding({  
64 - top: 14,  
65 - bottom: 14,  
66 - left: 16,  
67 - right: 16  
68 - })  
69 - }  
70 -}  
71 -  
72 -@Extend(Text) function labelTextStyle() {  
73 - .fontSize($r('app.float.font_size_12'))  
74 - .fontWeight(400)  
75 - .fontColor($r('app.color.color_B0B0B0'))  
76 -}  
1 -//缩略标题  
2 -import { CommonConstants } from 'wdConstant'  
3 -import { CompDTO } from 'wdBean'  
4 -import { DateTimeUtils } from 'wdKit'  
5 -  
6 -@Component  
7 -export struct TitleAbbrComponent {  
8 - @State compDTO: CompDTO = {} as CompDTO  
9 -  
10 - build() {  
11 - Column() {  
12 - Text(this.compDTO.operDataList[0].newsTitle)  
13 - .fontSize($r("app.float.font_size_16"))  
14 - .fontColor($r("app.color.color_222222"))  
15 - .maxLines(3)  
16 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
17 - .width(CommonConstants.FULL_WIDTH)  
18 - Row() {  
19 - Text("锐评")  
20 - .fontSize($r("app.float.font_size_12"))  
21 - .fontColor($r("app.color.color_ED2800"))  
22 - Text(this.compDTO.operDataList[0].source)  
23 - .fontSize($r("app.float.font_size_12"))  
24 - .fontColor($r("app.color.color_B0B0B0"))  
25 - .margin({ left: 6 })  
26 - Image($r("app.media.point"))  
27 - .width(16)  
28 - .height(16)  
29 -  
30 - Text(DateTimeUtils.formatDate(Number.parseFloat(this.compDTO.operDataList[0].publishTime)))  
31 - .fontSize($r("app.float.font_size_12"))  
32 - .fontColor($r("app.color.color_B0B0B0"))  
33 -  
34 - }.width(CommonConstants.FULL_WIDTH)  
35 - .justifyContent(FlexAlign.Start)  
36 - .margin({ top: 8 })  
37 -  
38 - }.width(CommonConstants.FULL_WIDTH)  
39 - .padding({  
40 - top: 14,  
41 - left: 16,  
42 - right: 16,  
43 - bottom: 14  
44 - })  
45 - .backgroundColor($r("app.color.white"))  
46 - .margin({ bottom: 8 })  
47 - }  
48 -}  
1 -//全标题 "compStyle":"3",  
2 -import { CommonConstants } from 'wdConstant'  
3 -import { CompDTO } from 'wdBean'  
4 -import { DateTimeUtils } from 'wdKit/src/main/ets/utils/DateTimeUtils'  
5 -import { Logger } from 'wdKit/src/main/ets/utils/Logger'  
6 -import { ProcessUtils } from '../../utils/ProcessUtils'  
7 -  
8 -@Component  
9 -export struct TitleAllComponent {  
10 - @State compDTO: CompDTO = {} as CompDTO  
11 -  
12 - build() {  
13 - Column() {  
14 - Text(this.compDTO.operDataList[0].newsTitle)  
15 - .fontSize($r("app.float.font_size_16"))  
16 - .fontColor($r("app.color.color_222222"))  
17 - .width(CommonConstants.FULL_WIDTH)  
18 - Row() {  
19 - Text("锐评")  
20 - .fontSize($r("app.float.font_size_12"))  
21 - .fontColor($r("app.color.color_ED2800"))  
22 - Text(this.compDTO.operDataList[0].source)  
23 - .fontSize($r("app.float.font_size_12"))  
24 - .fontColor($r("app.color.color_B0B0B0"))  
25 - .margin({ left: 6 })  
26 - Image($r("app.media.point"))  
27 - .width(16)  
28 - .height(16)  
29 -  
30 - Text(DateTimeUtils.formatDate(Number.parseFloat(this.compDTO.operDataList[0].publishTime)))  
31 - .fontSize($r("app.float.font_size_12"))  
32 - .fontColor($r("app.color.color_B0B0B0"))  
33 -  
34 - }.width(CommonConstants.FULL_WIDTH)  
35 - .justifyContent(FlexAlign.Start)  
36 - .margin({ top: 8 })  
37 -  
38 - }.width("100%")  
39 - .padding({  
40 - top: 14,  
41 - left: 16,  
42 - right: 16,  
43 - bottom: 14  
44 - })  
45 - .backgroundColor($r("app.color.white"))  
46 - .margin({ bottom: 8 })  
47 - .onClick((event: ClickEvent)=>{  
48 - ProcessUtils.processPage(this.compDTO.operDataList[0])  
49 - })  
50 - }  
51 - aboutToAppear(){  
52 - // Logger.info("ssx",JSON.stringify(this.compDTO.operDataList[0]))  
53 - }  
54 -}