陈剑华

Merge remote-tracking branch 'origin/main'

Showing 82 changed files with 2002 additions and 1846 deletions

Too many changes to show.

To preserve performance only 82 of 82+ 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 +}
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 +}
@@ -217,6 +217,11 @@ export class HttpUrlUtils { @@ -217,6 +217,11 @@ export class HttpUrlUtils {
217 static readonly SEARCH_RESULT_COUNT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/count?keyword="; 217 static readonly SEARCH_RESULT_COUNT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/count?keyword=";
218 218
219 /** 219 /**
  220 + * 搜索结果 显示list 详情
  221 + */
  222 + static readonly SEARCH_RESULT_LIST_DATA_PATH: string = "/api/rmrb-search-api/zh/c/search";
  223 +
  224 + /**
220 * 早晚报列表 225 * 早晚报列表
221 * 根据页面id获取页面楼层列表 226 * 根据页面id获取页面楼层列表
222 * https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/pageInfo?pageId=28927 227 * https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/pageInfo?pageId=28927
@@ -497,13 +502,14 @@ export class HttpUrlUtils { @@ -497,13 +502,14 @@ export class HttpUrlUtils {
497 502
498 /*优质评论页*/ 503 /*优质评论页*/
499 static getQualityCommentUrl() { 504 static getQualityCommentUrl() {
500 - let url = HttpUrlUtils._hostUrl + "api/rmrb-comment/comment/zh/c/highQuality" 505 + let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/highQuality";
  506 +
501 return url 507 return url
502 } 508 }
503 509
504 /*获取详情页评论列表*/ 510 /*获取详情页评论列表*/
505 static getContentCommentListDataUrl() { 511 static getContentCommentListDataUrl() {
506 - let url = HttpUrlUtils._hostUrl + "api/rmrb-comment/comment/zh/c/contentCommentList" 512 + let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/contentCommentList"
507 return url 513 return url
508 } 514 }
509 515
@@ -520,6 +526,12 @@ export class HttpUrlUtils { @@ -520,6 +526,12 @@ export class HttpUrlUtils {
520 return url; 526 return url;
521 } 527 }
522 528
  529 + //获取用户安全页信息
  530 + static querySecurity() {
  531 + let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/security/query";
  532 + return url;
  533 + }
  534 +
523 static getAppointmentListDataUrl() { 535 static getAppointmentListDataUrl() {
524 let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH 536 let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH
525 return url 537 return url
@@ -645,6 +657,16 @@ export class HttpUrlUtils { @@ -645,6 +657,16 @@ export class HttpUrlUtils {
645 return url 657 return url
646 } 658 }
647 659
  660 + static getSearchResultListDataUrl() {
  661 + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_LIST_DATA_PATH
  662 + return url
  663 + }
  664 +
  665 + static getInteractListDataUrl() {
  666 + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERACT_DATA_PATH
  667 + return url
  668 + }
  669 +
648 // static getYcgCommonHeaders(): HashMap<string, string> { 670 // static getYcgCommonHeaders(): HashMap<string, string> {
649 // let headers: HashMap<string, string> = new HashMap<string, string>() 671 // let headers: HashMap<string, string> = new HashMap<string, string>()
650 // 672 //
@@ -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 - 72 + corner: string;
  73 + rmhPlatform: number;
  74 + newTags: string
73 75
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) {
  64 + Column() {
  65 + ImageAndTextWebComponent({
  66 + contentDetailData: this.contentDetailData,
  67 + action: this.action
  68 + })
74 Column() { 69 Column() {
75 - ImageAndTextWebComponent({  
76 - contentDetailData: this.contentDetailData,  
77 - action: this.action,  
78 - })  
79 - }.width(CommonConstants.FULL_WIDTH)  
80 - .height(CommonConstants.FULL_HEIGHT)  
81 - }  
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) 70 + if (this.recommendList.length > 0) {
  71 + RecommendList({ recommendList: this.recommendList })
  72 + }
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,9 +296,7 @@ export struct ImageAndTextPageComponent { @@ -211,9 +296,7 @@ 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;  
216 - } 299 + this.recommendList = recommendList;
217 } 300 }
218 301
219 // 已登录->查询用户对作品点赞、收藏状态 302 // 已登录->查询用户对作品点赞、收藏状态
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 + Image($r("app.media.point"))
  32 + .width(16)
  33 + .height(16)
  34 + }
  35 + // TODO 这里还有个判断需要完善,依赖外部,新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间
  36 + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))
  37 + .fontSize($r("app.float.font_size_12"))
  38 + .fontColor($r("app.color.color_B0B0B0"))
  39 + .margin({ right: 6 })
  40 + .flexShrink(0)
  41 + if(this.contentDTO?.interactData?.commentNum) {
  42 + Text(`${this.contentDTO.interactData.commentNum}评`)
  43 + .fontSize($r("app.float.font_size_12"))
  44 + .fontColor($r("app.color.color_B0B0B0"))
  45 + .flexShrink(0)
  46 + }
  47 + }
  48 + .width(CommonConstants.FULL_WIDTH)
  49 + .margin({ top: 8 })
  50 + }
  51 +}
@@ -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) 99 + CardSourceInfo(
  100 + {
  101 + contentDTO: {
  102 + publishTime: item.publishTime || '',
  103 + source: item.source || ''
  104 + } as ContentDTO
111 } 105 }
112 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(String(item.publishTime))))  
113 - .fontSize($r("app.float.font_size_12"))  
114 - .fontColor($r("app.color.color_B0B0B0"))  
115 - }  
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'),
@@ -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({
  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'))  
76 - }  
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) 51 + CardMediaInfo({ contentDTO: this.contentDTO })
  52 + }
  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;  
20 - 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;  
26 - }  
27 - } else {  
28 - this.browSingModel.viewType = ViewType.EMPTY;  
29 - } 32 + this.fullScreen();
  33 +
  34 +
  35 + commentViewModel.fetchQualityCommentListLocal(getContext()).then(commentListModel => {
  36 + this.allDatas.push(...commentListModel.list)
30 }) 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 + // })
  54 + }
  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 +
  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 + // })
  89 + })
  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%')
31 } 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();
@@ -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 }
@@ -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 }
@@ -71,40 +71,44 @@ export struct PageComponent { @@ -71,40 +71,44 @@ export struct PageComponent {
71 @Builder 71 @Builder
72 ListLayout() { 72 ListLayout() {
73 List() { 73 List() {
74 - // 下拉刷新  
75 - ListItem() {  
76 - RefreshLayout({  
77 - refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage,  
78 - this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)  
79 - }) 74 + if (this.name !== '视频') {
  75 + // 下拉刷新
  76 + ListItem() {
  77 + RefreshLayout({
  78 + refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage,
  79 + this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
  80 + })
  81 + }
80 } 82 }
81 83
82 - LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {  
83 - ListItem() {  
84 - Column() {  
85 - if (this.name == '视频') {  
86 - VideoChannelDetail()  
87 - } else { 84 + if (this.name === '视频') {
  85 + VideoChannelDetail()
  86 + } else {
  87 + LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {
  88 + ListItem() {
  89 + Column() {
88 CompParser({ compDTO: compDTO, compIndex: compIndex }); 90 CompParser({ compDTO: compDTO, compIndex: compIndex });
89 } 91 }
90 -  
91 } 92 }
92 - }  
93 - },  
94 - (compDTO: CompDTO, compIndex: number) => compDTO.id + compIndex.toString() + this.pageModel.timestamp  
95 - ) 93 + },
  94 + (compDTO: CompDTO, compIndex: number) => compDTO.id + compIndex.toString() + this.pageModel.timestamp
  95 + )
  96 + }
96 97
97 - // 加载更多  
98 - ListItem() {  
99 - if (this.pageModel.hasMore) {  
100 - LoadMoreLayout({  
101 - refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage,  
102 - this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight)  
103 - })  
104 - } else {  
105 - NoMoreLayout() 98 + if (this.name !== '视频') {
  99 + // 加载更多
  100 + ListItem() {
  101 + if (this.pageModel.hasMore) {
  102 + LoadMoreLayout({
  103 + refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage,
  104 + this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight)
  105 + })
  106 + } else {
  107 + NoMoreLayout()
  108 + }
106 } 109 }
107 } 110 }
  111 +
108 } 112 }
109 .scrollBar(BarState.Off) 113 .scrollBar(BarState.Off)
110 .cachedCount(8) 114 .cachedCount(8)
@@ -137,7 +141,8 @@ export struct PageComponent { @@ -137,7 +141,8 @@ export struct PageComponent {
137 141
138 onChange() { 142 onChange() {
139 Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , ${this.isFirstIn} , navIndex: ${this.currentTopNavSelectedIndex}`); 143 Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , ${this.isFirstIn} , navIndex: ${this.currentTopNavSelectedIndex}`);
140 - if (this.navIndex === this.currentTopNavSelectedIndex && !this.isFirstIn) { 144 + // if (this.navIndex === this.currentTopNavSelectedIndex && !this.isFirstIn) {
  145 + if (this.navIndex === this.currentTopNavSelectedIndex) {
141 this.getData(); 146 this.getData();
142 } 147 }
143 } 148 }
@@ -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 }
@@ -20,7 +20,7 @@ export struct SearchResultComponent{ @@ -20,7 +20,7 @@ export struct SearchResultComponent{
20 Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { 20 Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
21 ForEach(this.count, (item: string, index: number ) => { 21 ForEach(this.count, (item: string, index: number ) => {
22 TabContent(){ 22 TabContent(){
23 - SearchResultContentComponent() 23 + SearchResultContentComponent({keywords:this.searchText,searchType:item})
24 }.tabBar(this.TabBuilder(index,item)) 24 }.tabBar(this.TabBuilder(index,item))
25 }, (item: string, index: number) => index.toString()) 25 }, (item: string, index: number) => index.toString())
26 } 26 }
  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 +
1 const TAG = "SearchResultContentComponent" 13 const TAG = "SearchResultContentComponent"
2 14
3 @Component 15 @Component
4 export struct SearchResultContentComponent{ 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 +
5 26
6 aboutToAppear(): void { 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 查询创作者详情接口
7 55
  56 + }
  57 + this.getInteractData(value)
  58 + }
  59 + }).catch((err:Error)=>{
  60 + console.log(TAG,JSON.stringify(err))
  61 + this.isLoading = false
  62 + })
  63 + }
8 } 64 }
9 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 + })
10 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 + }
  163 +
  164 + this.data.push(contentDTO)
  165 + })
  166 + this.data.notifyDataReload()
  167 + this.count = this.data.totalCount()
  168 + if (this.data.totalCount() < resultData.totalCount) {
  169 + this.curPageNum++
  170 + }else {
  171 + this.hasMore = false
  172 + }
  173 + this.isLoading = false
  174 + }).catch((err:Error)=>{
  175 + console.log(TAG,"请求失败")
  176 + this.isLoading = false
  177 + })
  178 + }
11 179
12 build() { 180 build() {
  181 + Column() {
  182 + if(this.count == 0){
  183 + ListHasNoMoreDataUI({style:2})
  184 + }else{
  185 + Column(){
  186 + if (this.data_rmh!=null && this.data_rmh.length > 0) {
  187 + //List
  188 + List() {
  189 + ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
  190 + ListItem() {
  191 + Column(){
  192 + Image($r('app.media.default_head'))
  193 + .width('84lpx')
  194 + .height('84lpx')
  195 + .margin({bottom:'15lpx'})
  196 + Text(item.creatorName)
  197 + .fontSize('20lpx')
  198 + }.alignItems(HorizontalAlign.Center)
  199 +
  200 + }.onClick(()=>{
  201 + //TODO 跳转
  202 + })
  203 + .width('150lpx')
  204 + })
  205 + }
  206 + .cachedCount(6)
  207 + .edgeEffect(EdgeEffect.None)
  208 + .scrollBar(BarState.Off)
  209 + .listDirection(Axis.Horizontal)
  210 + .width('100%')
  211 + .height('150lpx')
  212 + .onReachEnd(()=>{
  213 + if(!this.isLoading){
  214 + //进入更多关注页
  215 + }
  216 + })
  217 + }
  218 + //List
  219 + List({ space: '6lpx' }) {
  220 + LazyForEach(this.data, (item: ContentDTO, index: number) => {
  221 + ListItem() {
  222 + Column(){
  223 + CardParser({contentDTO:item})
  224 + if(index != this.data.totalCount()-1 ){
  225 + Divider()
  226 + .width('100%')
  227 + .height('1lpx')
  228 + .color($r('app.color.color_F5F5F5'))
  229 + .strokeWidth('1lpx')
  230 + }
  231 + }
  232 + }
  233 + .onClick(()=>{
  234 + //TODO 跳转
  235 + })
  236 + }, (item: ContentDTO, index: number) => index.toString())
13 237
  238 + //没有更多数据 显示提示
  239 + if(!this.hasMore){
  240 + ListItem(){
  241 + ListHasNoMoreDataUI()
  242 + }
  243 + }
  244 + }.cachedCount(6)
  245 + .edgeEffect(EdgeEffect.None)
  246 + .scrollBar(BarState.Off)
  247 + .margin({top:'23lpx',left:'23lpx',right:'23lpx'})
  248 + .layoutWeight(1)
  249 + .onReachEnd(()=>{
  250 + console.log(TAG,"触底了");
  251 + if(!this.isLoading){
  252 + //加载分页数据
  253 + this.getNewSearchResultData()
  254 + }
  255 + })
  256 + }
  257 + }
  258 + }
  259 + .backgroundColor($r('app.color.white'))
  260 + .height('100%')
  261 + .width('100%')
14 } 262 }
15 } 263 }
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
7 @Component 7 @Component
8 -export struct AboutPageUI { 8 +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,42 +92,39 @@ export struct AboutPageUI { @@ -77,42 +92,39 @@ 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) {  
96 -  
97 - Row() {  
98 - // 左侧标题  
99 - Text(`${item}`)  
100 - .fontColor('#666666')  
101 - .fontSize('31lpx')  
102 -  
103 - Image($r('app.media.mine_user_arrow'))  
104 - .width('27lpx')  
105 - .height('27lpx')  
106 - .objectFit(ImageFit.Auto)  
107 - }  
108 - .alignItems(VerticalAlign.Center)  
109 - .justifyContent(FlexAlign.SpaceBetween)  
110 - .height('97lpx')  
111 - .width('100%')  
112 - .padding({left:'29lpx',right:'29lpx'}) 108 + @Builder
  109 + getArrowCell(item: string, index: number) {
  110 +
  111 + Row() {
  112 + // 左侧标题
  113 + Text(`${item}`)
  114 + .fontColor('#666666')
  115 + .fontSize('31lpx')
  116 +
  117 + Image($r('app.media.mine_user_arrow'))
  118 + .width('27lpx')
  119 + .height('27lpx')
  120 + .objectFit(ImageFit.Auto)
  121 + }
  122 + .alignItems(VerticalAlign.Center)
  123 + .justifyContent(FlexAlign.SpaceBetween)
  124 + .height('97lpx')
  125 + .width('100%')
  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)
@@ -404,4 +430,47 @@ export struct AccountAndSecurityLayout { @@ -404,4 +430,47 @@ export struct AccountAndSecurityLayout {
404 securityNum = phoneNum.replace(needSecurityString,'****') 430 securityNum = phoneNum.replace(needSecurityString,'****')
405 return securityNum; 431 return securityNum;
406 } 432 }
  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 + }
407 } 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 -}  
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 -}  
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 -}  
1 -import { CompDTO } from 'wdBean';  
2 -import { CommonConstants } from 'wdConstant'  
3 -import { ProcessUtils } from '../../utils/ProcessUtils';  
4 -  
5 -const TAG: string = 'TriPicCardComponent';  
6 -  
7 -/**  
8 - * 三图卡:  
9 - * compstyle:4  
10 - * 卡片结构:上下结构  
11 - * 卡片宽度:充满父窗口  
12 - * 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9:  
13 - */  
14 -// @Entry  
15 -@Component  
16 -export struct TriPicCardComponent {  
17 - @State compDTO: CompDTO = {} as CompDTO  
18 -  
19 - build() {  
20 - Column() {  
21 -  
22 -  
23 - //body  
24 - Column() {  
25 - //新闻标题  
26 - Text(this.compDTO.operDataList[0].newsTitle)  
27 - .fontSize(17)  
28 - .fontColor('#222222')  
29 - .maxLines(3)  
30 - .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。  
31 - //三图  
32 - Row() {  
33 - Image(this.compDTO.operDataList[0].fullColumnImgUrls[0]?.url)  
34 - .width('32%')  
35 -  
36 - .height(75)  
37 - .borderRadius({ topLeft:4,bottomLeft:4 })  
38 -  
39 - Image(this.compDTO.operDataList[0].fullColumnImgUrls[1]?.url)  
40 - .width('32%')  
41 - .height(75)  
42 -  
43 - Image(this.compDTO.operDataList[0].fullColumnImgUrls[2]?.url)  
44 - .width('32%')  
45 - .height(75)  
46 - .borderRadius({ topRight:4,bottomRight:4 })  
47 -  
48 - }  
49 - .justifyContent(FlexAlign.SpaceBetween)  
50 - .width('100%')  
51 - .height(75)  
52 - .margin({top:8})  
53 - .borderRadius(8)  
54 -  
55 - }  
56 - .width('100%')  
57 - .justifyContent(FlexAlign.Start)  
58 - .alignItems(HorizontalAlign.Start)  
59 - .padding({top:14})  
60 - .onClick((event: ClickEvent)=>{  
61 - ProcessUtils.processPage(this.compDTO.operDataList[0])  
62 - })  
63 -  
64 -  
65 - //bottom  
66 - Row() {  
67 - Text(this.compDTO.operDataList[0].source)  
68 - .bottomTextStyle()  
69 - //间隔点  
70 - Image($r('app.media.point'))  
71 - .width(12)  
72 - .height(12)  
73 -  
74 - Text(this.compDTO.operDataList[0].publishTime)  
75 - .bottomTextStyle()  
76 - Text(' ')  
77 -  
78 - Text('518条评论')  
79 - .bottomTextStyle()  
80 -  
81 - }  
82 - .width('100%')  
83 -  
84 - .justifyContent(FlexAlign.Start)  
85 - // .padding({bottom:14})  
86 - .margin({top:8})  
87 - .padding({bottom:14})  
88 -  
89 - }  
90 - .width('100%')  
91 - .padding({top:8,left:16,right:16})  
92 -  
93 -  
94 - }  
95 -  
96 -}  
97 -  
98 -  
99 -@Extend(Text) function bottomTextStyle() {  
100 - .fontSize(12)  
101 - .fontColor('#B0B0B0')  
102 -}  
1 -import { Action, CompDTO, ContentDTO, Params } from 'wdBean';  
2 -import { CompStyle } from 'wdConstant';  
3 -import { Logger } from 'wdKit';  
4 -import { WDRouterRule } from 'wdRouter';  
5 -import { ProcessUtils } from '../../utils/ProcessUtils';  
6 -  
7 -const TAG = 'Zh_Grid_Layout-03';  
8 -const FULL_PARENT: string = '100%';  
9 -let listSize: number = 4;  
10 -  
11 -/**  
12 - * 金刚卡位  
13 - * 枚举值Zh_Grid_Layout-03  
14 - * Zh_Grid_Layout-03  
15 - *  
16 - */  
17 -@Preview  
18 -@Component  
19 -export struct ZhGridLayoutComponent {  
20 - @State compDTO: CompDTO = {} as CompDTO  
21 -  
22 - aboutToAppear() {  
23 - if (this.compDTO.operDataList) {  
24 - listSize = this.compDTO.operDataList.length > 5 ? 4 : this.compDTO.operDataList.length;  
25 - }  
26 - }  
27 -  
28 - build() {  
29 - GridRow({  
30 - columns: { sm: listSize, md: 8 },  
31 - breakpoints: { value: ['320vp', '520vp', '840vp'] }  
32 - }) {  
33 - ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {  
34 - GridCol() {  
35 - this.buildItemCard(this.compDTO.operDataList[index]);  
36 - }  
37 - })  
38 - }  
39 - }  
40 -  
41 - /**  
42 - * 组件项  
43 - *  
44 - * @param programmeBean item 组件项, 上面icon,下面标题  
45 - */  
46 - @Builder  
47 - buildItemCard(item: ContentDTO) {  
48 - Column() {  
49 - Image(item.coverUrl)  
50 - .width(44)  
51 - .aspectRatio(1 / 1)  
52 - .margin(16)  
53 - Text(item.newsTitle)  
54 - .fontSize(13)  
55 - .maxLines(1)  
56 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
57 - }  
58 - .width('100%')  
59 - .onClick((event: ClickEvent) => {  
60 - ProcessUtils.processPage(item)  
61 - })  
62 - }  
63 -}  
64 -  
65 -  
1 -import { CompDTO, ContentDTO } from 'wdBean';  
2 -import { CommonConstants } from 'wdConstant';  
3 -import { DateTimeUtils } from 'wdKit';  
4 -import { ProcessUtils } from '../../utils/ProcessUtils';  
5 -  
6 -/**  
7 - * 本地精选卡  
8 - * ZhSingleRow04  
9 - */  
10 -  
11 -@Component  
12 -export struct ZhSingleRow04 {  
13 - @State compDTO: CompDTO = {} as CompDTO  
14 -  
15 - aboutToAppear() {}  
16 -  
17 - build() {  
18 - Column(){  
19 - //顶部  
20 - Row(){  
21 - Row() {  
22 - Image($r("app.media.local_selection"))  
23 - .width(24)  
24 - .height(24)  
25 - .margin({ right: 4 })  
26 - Text(this.compDTO.objectTitle)  
27 - .fontSize($r("app.float.font_size_17"))  
28 - .fontColor($r("app.color.color_222222"))  
29 - .fontWeight(600)  
30 - }  
31 - Row() {  
32 - Text("更多")  
33 - .fontSize($r("app.float.font_size_14"))  
34 - .fontColor($r("app.color.color_999999"))  
35 - .margin({ right: 1 })  
36 - Image($r("app.media.more"))  
37 - .width(14)  
38 - .height(14)  
39 - }  
40 - }  
41 - .justifyContent(FlexAlign.SpaceBetween)  
42 - .margin({ top: 8, bottom: 8 })  
43 - .width('100%')  
44 - // 列表内容  
45 - List({ space: 12 }) {  
46 - ForEach(this.compDTO.operDataList, (item: ContentDTO) => {  
47 - ListItem() {  
48 - Row(){  
49 - if(item.coverUrl) {  
50 - Image(item.coverUrl)  
51 - .width(84)  
52 - .height(56)  
53 - .borderRadius(3)  
54 - .objectFit(ImageFit.Cover)  
55 - .padding({right: 6})  
56 - }  
57 - Column(){  
58 - Text(item.newsTitle)  
59 - .fontSize($r("app.float.font_size_16"))  
60 - .fontColor($r("app.color.color_212228"))  
61 - .fontWeight(400)  
62 - .maxLines(2)  
63 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
64 - .margin({ top: 8 })  
65 -  
66 - Row(){  
67 - Text(item.source)  
68 - .fontSize($r('app.float.font_size_12'))  
69 - .fontColor($r('app.color.color_B0B0B0'))  
70 - .textOverflow({overflow: TextOverflow.Ellipsis})  
71 - .maxLines(1)  
72 - .width(item.source.length > 10 ? '60%' : '')  
73 - Image($r("app.media.point"))  
74 - .width(16)  
75 - .height(16)  
76 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.compDTO.operDataList[0].publishTime)))  
77 - .fontSize($r("app.float.font_size_12"))  
78 - .fontColor($r("app.color.color_B0B0B0"))  
79 - }  
80 - .width('100%')  
81 - }  
82 - .width(200)  
83 - }  
84 - // .margin({right: 18})  
85 - .onClick(() =>{  
86 - ProcessUtils.processPage(item)  
87 - })  
88 - }  
89 - })  
90 - }  
91 - .listDirection(Axis.Horizontal)  
92 - .width('100%')  
93 - }  
94 - .width(CommonConstants.FULL_WIDTH)  
95 - .padding({  
96 - top: 14,  
97 - left: 16,  
98 - right: 16,  
99 - bottom: 14  
100 - })  
101 - .backgroundColor($r("app.color.white"))  
102 - .margin({ bottom: 8 })  
103 - }  
104 -}  
@@ -22,6 +22,7 @@ export struct FirstLevelComponent { @@ -22,6 +22,7 @@ export struct FirstLevelComponent {
22 Text('暂无数据').fontSize(20) 22 Text('暂无数据').fontSize(20)
23 }else { 23 }else {
24 TextPicker({range:this.labelList,selected:this.select}) 24 TextPicker({range:this.labelList,selected:this.select})
  25 + .canLoop(false)
25 .onChange((value: string | string[], index: number | number[]) => { 26 .onChange((value: string | string[], index: number | number[]) => {
26 this.select = index as number 27 this.select = index as number
27 this.currentFirst = EditInfoViewModel.getAreaListManageModel(this.dataSource[index as number]) 28 this.currentFirst = EditInfoViewModel.getAreaListManageModel(this.dataSource[index as number])
@@ -15,6 +15,7 @@ export struct SecondLevelComponent { @@ -15,6 +15,7 @@ export struct SecondLevelComponent {
15 Text(this.mTip).fontSize(20) 15 Text(this.mTip).fontSize(20)
16 }else { 16 }else {
17 TextPicker({range:this.labelList,selected:this.select}) 17 TextPicker({range:this.labelList,selected:this.select})
  18 + .canLoop(false)
18 .onChange((value: string | string[], index: number | number[]) => { 19 .onChange((value: string | string[], index: number | number[]) => {
19 this.select = index as number 20 this.select = index as number
20 this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.currentFirst.children[index as number]) 21 this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.currentFirst.children[index as number])
@@ -16,6 +16,7 @@ export struct ThirdLevelComponent { @@ -16,6 +16,7 @@ export struct ThirdLevelComponent {
16 Text(this.mTip).fontSize(20) 16 Text(this.mTip).fontSize(20)
17 }else { 17 }else {
18 TextPicker({range:this.labelList,selected:this.select}) 18 TextPicker({range:this.labelList,selected:this.select})
  19 + .canLoop(false)
19 .onChange((value: string | string[], index: number | number[]) => { 20 .onChange((value: string | string[], index: number | number[]) => {
20 this.select = index as number 21 this.select = index as number
21 this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.currentSecondBean.children[index as number]) 22 this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.currentSecondBean.children[index as number])
1 -import { WDPlayerController } from 'wdPlayer'; 1 +import { WDPlayerController, PlayerConstants } from 'wdPlayer';
2 import { PaperReaderSimpleDialog } from './PaperReaderDialog'; 2 import { PaperReaderSimpleDialog } from './PaperReaderDialog';
3 import { Logger } from 'wdKit/Index'; 3 import { Logger } from 'wdKit/Index';
  4 +import { AudioSuspensionModel } from '../viewmodel/AudioSuspensionModel';
4 5
5 const TAG = 'AudioDialog'; 6 const TAG = 'AudioDialog';
6 7
7 @Preview 8 @Preview
8 @CustomDialog 9 @CustomDialog
9 export struct AudioDialog { 10 export struct AudioDialog {
  11 + @Consume audioTitle: string;
  12 + @Consume currentTime: string;
  13 + @Consume totalTime: string;
  14 + @Consume progressVal: number;
  15 + @State currentStatus: number = 0;
  16 + controllerDetail?: CustomDialogController
  17 +
10 private playerController: WDPlayerController = new WDPlayerController(); 18 private playerController: WDPlayerController = new WDPlayerController();
11 private simpleAudioDialog: CustomDialogController = new CustomDialogController({ 19 private simpleAudioDialog: CustomDialogController = new CustomDialogController({
12 builder: PaperReaderSimpleDialog({ 20 builder: PaperReaderSimpleDialog({
@@ -21,8 +29,12 @@ export struct AudioDialog { @@ -21,8 +29,12 @@ export struct AudioDialog {
21 29
22 }) 30 })
23 31
  32 + private AudioSuspension = new AudioSuspensionModel(this.simpleAudioDialog)
  33 +
  34 +
24 onCancel() { 35 onCancel() {
25 Logger.info(TAG, "cj2024 onCancel = ") 36 Logger.info(TAG, "cj2024 onCancel = ")
  37 + this.AudioSuspension.setPlayerUrl()
26 } 38 }
27 39
28 /** 40 /**
@@ -38,34 +50,92 @@ export struct AudioDialog { @@ -38,34 +50,92 @@ export struct AudioDialog {
38 } 50 }
39 51
40 build() { 52 build() {
41 - Row() {  
42 - Image($r("app.media.icon_audio_pause"))  
43 - .objectFit(ImageFit.Contain)  
44 - .margin(18)  
45 - .width(24)  
46 - .height(24)  
47 - }  
48 - .width(60)  
49 - .height(60)  
50 - .backgroundColor(Color.White)  
51 - .onClick(() => {  
52 - if (this.simpleAudioDialog) {  
53 - this.simpleAudioDialog.close()  
54 - this.simpleAudioDialog.open()  
55 - if (this.simpleAudioDialog) {  
56 - setTimeout(() => {  
57 - console.log('PaperReaderSimpleDialog delay 1s');  
58 - if (this.simpleAudioDialog != undefined) {  
59 - this.simpleAudioDialog.close()  
60 - }  
61 - if (this.simpleAudioDialog != undefined) {  
62 - this.simpleAudioDialog.open()  
63 - }  
64 - }, 500000); 53 + Stack({ alignContent: Alignment.End }) {
  54 + Column() { //标题 时间 进度条
  55 + Marquee({
  56 + start: true,
  57 + step: 5,
  58 + loop: Number.POSITIVE_INFINITY,
  59 + fromStart: true,
  60 + src: this.audioTitle
  61 + })
  62 + .width("60%")
  63 + .height(20)
  64 + .fontColor($r("app.color.color_222222"))
  65 + .fontSize(14)
  66 + .margin({ top: 10, left: 10 })
  67 + .alignSelf(ItemAlign.Start)
  68 + .onStart(() => {
  69 + console.info('Marquee animation complete onStart')
  70 + })
  71 + .onBounce(() => {
  72 + console.info('Marquee animation complete onBounce')
  73 + })
  74 + .onFinish(() => {
  75 + console.info('Marquee animation complete onFinish')
  76 + })
  77 +
  78 + Row() {
  79 + Text(this.currentTime)
  80 + .fontSize($r('app.float.font_size_12'))
  81 + .fontColor($r('app.color.color_999999'))
  82 + .height("100%")
  83 + .alignSelf(ItemAlign.Start)
  84 + Text("/" + this.totalTime)
  85 + .fontSize($r('app.float.font_size_12'))
  86 + .fontColor($r('app.color.color_999999'))
  87 + .height("100%")
  88 + .alignSelf(ItemAlign.Start)
  89 +
65 } 90 }
  91 + .width("100%")
  92 + .height(16)
  93 + .margin({ top: 4, left: 10 })
  94 +
  95 + Progress({ value: this.progressVal, total: 100, type: ProgressType.Capsule })
  96 + .color($r('app.color.color_ED2800'))
  97 + .backgroundColor($r('app.color.white'))
  98 + .width("100%")
  99 + .height(3)
  100 + .margin({ top: 7 })
66 } 101 }
  102 + .width("100%")
  103 + .height("100%")
  104 + .justifyContent(FlexAlign.Start)
67 105
68 - }) 106 + Row() {
  107 + Image(this.currentStatus != PlayerConstants.STATUS_START ? $r("app.media.icon_audio_pause") : $r("app.media.icon_audio_playing"))
  108 + .objectFit(ImageFit.Contain)
  109 + .width(24)
  110 + .height(24)
  111 + .margin({ right: 12 })
  112 + .onClick(() => {
  113 + if (this.playerController) {
  114 + // this.onConfirm()
  115 + this.playerController.switchPlayOrPause()
  116 + this.currentStatus = this.playerController.getStatus()
  117 + }
  118 + })
69 119
  120 + Image($r("app.media.icon_audio_close"))
  121 + .objectFit(ImageFit.Contain)
  122 + .width(24)
  123 + .height(24)
  124 + .onClick(() => {
  125 + if (this.playerController) {
  126 + this.playerController.stop()
  127 + }
  128 + if (this.controllerDetail) {
  129 + this.controllerDetail.close()
  130 + }
  131 + })
  132 + }.width(80)
  133 + .height(60)
  134 +
  135 + }
  136 + .width("65%")
  137 + .height(60)
  138 + .backgroundColor(Color.White)
  139 + .borderRadius(2)
70 } 140 }
71 } 141 }
@@ -52,7 +52,7 @@ export interface contentListItemParams{ @@ -52,7 +52,7 @@ export interface contentListItemParams{
52 } 52 }
53 53
54 export interface collcetRecordParams { 54 export interface collcetRecordParams {
55 - delAll?: number; 55 + delAll?: number; //是否全部删除
56 56
57 status?: number; 57 status?: number;
58 58
@@ -5,6 +5,8 @@ import HashMap from '@ohos.util.HashMap'; @@ -5,6 +5,8 @@ import HashMap from '@ohos.util.HashMap';
5 import { SearchHistoryItem } from '../viewmodel/SearchHistoryItem'; 5 import { SearchHistoryItem } from '../viewmodel/SearchHistoryItem';
6 import { SearchHotContentItem } from '../viewmodel/SearchHotContentItem'; 6 import { SearchHotContentItem } from '../viewmodel/SearchHotContentItem';
7 import { SearchResultCountItem } from '../viewmodel/SearchResultCountItem'; 7 import { SearchResultCountItem } from '../viewmodel/SearchResultCountItem';
  8 +import { SearchResultContentData } from '../viewmodel/SearchResultContentData';
  9 +import { contentListParams, InteractDataDTO } from 'wdBean/Index';
8 10
9 const TAG = "SearcherAboutDataModel" 11 const TAG = "SearcherAboutDataModel"
10 12
@@ -35,6 +37,11 @@ class SearcherAboutDataModel{ @@ -35,6 +37,11 @@ class SearcherAboutDataModel{
35 public async putSearchHistoryData(content:string){ 37 public async putSearchHistoryData(content:string){
36 let history = SPHelper.default.getSync(this.SEARCH_HISTORY_KEY,"[]") as string 38 let history = SPHelper.default.getSync(this.SEARCH_HISTORY_KEY,"[]") as string
37 this.searchHistoryData = JSON.parse(history) 39 this.searchHistoryData = JSON.parse(history)
  40 + this.searchHistoryData.forEach((element,index) => {
  41 + if (element.searchContent == content) {
  42 + this.searchHistoryData.splice(index,1)
  43 + }
  44 + });
38 this.searchHistoryData.splice(0,0,new SearchHistoryItem(content)) 45 this.searchHistoryData.splice(0,0,new SearchHistoryItem(content))
39 await SPHelper.default.saveSync(this.SEARCH_HISTORY_KEY, JSON.stringify(this.searchHistoryData)); 46 await SPHelper.default.saveSync(this.SEARCH_HISTORY_KEY, JSON.stringify(this.searchHistoryData));
40 } 47 }
@@ -76,6 +83,8 @@ class SearcherAboutDataModel{ @@ -76,6 +83,8 @@ class SearcherAboutDataModel{
76 if(this.searchHistoryData.length>10){ 83 if(this.searchHistoryData.length>10){
77 this.searchHistoryData.splice(10,this.searchHistoryData.length - 10) 84 this.searchHistoryData.splice(10,this.searchHistoryData.length - 10)
78 } 85 }
  86 + // this.putSearchHistoryData("大家")
  87 + // this.putSearchHistoryData("人民")
79 88
80 return this.searchHistoryData 89 return this.searchHistoryData
81 } 90 }
@@ -234,6 +243,83 @@ class SearcherAboutDataModel{ @@ -234,6 +243,83 @@ class SearcherAboutDataModel{
234 return compRes.data 243 return compRes.data
235 } 244 }
236 245
  246 + /**
  247 + * 搜索结果 展示列表
  248 + */
  249 + getSearchResultListData(pageSize:string,pageNum:string,searchType:string,keyword:string,context: Context): Promise<SearchResultContentData> {
  250 + return new Promise<SearchResultContentData>((success, error) => {
  251 + Logger.info(TAG, `getSearchResultListData start`);
  252 + this.fetchSearchResultListData(pageSize,pageNum,searchType,keyword).then((navResDTO: ResponseDTO<SearchResultContentData>) => {
  253 + if (!navResDTO || navResDTO.code != 0) {
  254 + success(this.getSearchResultListDataLocal(context))
  255 + return
  256 + }
  257 + Logger.info(TAG, "getSearchResultListData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp);
  258 + let navigationBean = navResDTO.data as SearchResultContentData
  259 + success(navigationBean);
  260 + }).catch((err: Error) => {
  261 + Logger.error(TAG, `getSearchResultListData catch, error.name : ${err.name}, error.message:${err.message}`);
  262 + success(this.getSearchResultListDataLocal(context))
  263 + })
  264 + })
  265 + }
  266 +
  267 + fetchSearchResultListData(pageSize:string,pageNum:string,searchType:string,keyword:string) {
  268 + let url = HttpUrlUtils.getSearchResultListDataUrl() + `?pageSize=${pageSize}&pageNum=${pageNum}&searchType=${searchType}&keyword=${keyword}`
  269 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  270 + return WDHttp.get<ResponseDTO<SearchResultContentData>>(url, headers)
  271 + };
  272 +
  273 + async getSearchResultListDataLocal(context: Context): Promise<SearchResultContentData> {
  274 + Logger.info(TAG, `getSearchResultListDataLocal start`);
  275 + let compRes: ResponseDTO<SearchResultContentData> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<SearchResultContentData>>(context,'search_result_list_data.json' );
  276 + if (!compRes || !compRes.data) {
  277 + Logger.info(TAG, `getSearchResultListDataLocal compRes is empty`);
  278 + return new SearchResultContentData()
  279 + }
  280 + Logger.info(TAG, `getSearchResultListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
  281 + return compRes.data
  282 + }
  283 +
  284 + /**
  285 + * 搜索结果 展示列表(交互详情 评论收藏点赞分享数量)
  286 + */
  287 + getInteractListData(data : contentListParams,context: Context): Promise<InteractDataDTO[]> {
  288 + return new Promise<InteractDataDTO[]>((success, error) => {
  289 + Logger.info(TAG, `getInteractListData start`);
  290 + this.fetchInteractListData(data).then((navResDTO: ResponseDTO<InteractDataDTO[]>) => {
  291 + if (!navResDTO || navResDTO.code != 0) {
  292 + success(this.getInteractListDataLocal(context))
  293 + return
  294 + }
  295 + Logger.info(TAG, "getInteractListData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp);
  296 + let navigationBean = navResDTO.data as InteractDataDTO[]
  297 + success(navigationBean);
  298 + }).catch((err: Error) => {
  299 + Logger.error(TAG, `getInteractListData catch, error.name : ${err.name}, error.message:${err.message}`);
  300 + success(this.getInteractListDataLocal(context))
  301 + })
  302 + })
  303 + }
  304 +
  305 + fetchInteractListData(data : contentListParams) {
  306 + let url = HttpUrlUtils.getInteractListDataUrl()
  307 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  308 + return WDHttp.post<ResponseDTO<InteractDataDTO[]>>(url,data, headers)
  309 + };
  310 +
  311 + async getInteractListDataLocal(context: Context): Promise<InteractDataDTO[]> {
  312 + Logger.info(TAG, `getInteractListDataLocal start`);
  313 + let compRes: ResponseDTO<InteractDataDTO[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<InteractDataDTO[]>>(context,'search_result_interact_list_data.json' );
  314 + if (!compRes || !compRes.data) {
  315 + Logger.info(TAG, `getInteractListDataLocal compRes is empty`);
  316 + return []
  317 + }
  318 + Logger.info(TAG, `getInteractListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
  319 + return compRes.data
  320 + }
  321 +
  322 +
237 } 323 }
238 324
239 const searcherAboutDataModel = SearcherAboutDataModel.getInstance() 325 const searcherAboutDataModel = SearcherAboutDataModel.getInstance()
  1 +import { Logger } from 'wdKit';
  2 +import { WDPlayerController } from 'wdPlayer';
  3 +
  4 +const TAG = 'AudioSuspensionModel'
  5 +
  6 +/**
  7 + * 音频悬浮窗公共方法类
  8 + */
  9 +export class AudioSuspensionModel {
  10 + public playerController: SubscribedAbstractProperty<WDPlayerController> = AppStorage.link<WDPlayerController>('playerController')
  11 + public simpleAudioDialog: CustomDialogController = {} as CustomDialogController
  12 + constructor(simpleAudioDialog: CustomDialogController) {
  13 + this.simpleAudioDialog = simpleAudioDialog
  14 +
  15 + this.initPlayerController()
  16 + }
  17 + /**
  18 + * 判断音频实例是否已存在,不存在则创建
  19 + */
  20 + private initPlayerController() {
  21 + if(this.playerController === undefined) {
  22 + Logger.info(TAG, 'playerController undefined')
  23 + AppStorage.setOrCreate('playerController', new WDPlayerController());
  24 + this.playerController = AppStorage.link<WDPlayerController>('playerController')
  25 + Logger.info(TAG, 'playerController create success')
  26 + } else {
  27 + Logger.info(TAG, 'playerController already exit')
  28 + }
  29 + }
  30 + /**
  31 + * 配置音频地址
  32 + */
  33 + public setPlayerUrl() {
  34 + // this.playerController.switchPlayOrPause()
  35 + Logger.info(TAG, 'handlePlayer')
  36 + }
  37 +
  38 + public delete() {
  39 + let res: boolean = AppStorage.delete('PropB');
  40 + Logger.info(TAG, `delete: ${res}`)
  41 + }
  42 +
  43 +
  44 +
  45 +}
@@ -4,6 +4,7 @@ import { SearchResultContentItem } from './SearchResultContentItem' @@ -4,6 +4,7 @@ import { SearchResultContentItem } from './SearchResultContentItem'
4 export class SearchResultContentData{ 4 export class SearchResultContentData{
5 list:SearchResultContentItem[] = [] 5 list:SearchResultContentItem[] = []
6 6
  7 +
7 keyword:string = "" 8 keyword:string = ""
8 pageNum: number = 0 9 pageNum: number = 0
9 pageSize: number = 20 10 pageSize: number = 20
1 -import { ContentDTO } from 'wdBean/Index'  
2 1
3 -export interface SearchResultContentItem{  
4 - data:ContentDTO  
5 - resultType:string 2 +export class SearchResultContentItem{
  3 + data:SearchDescription = new SearchDescription()
  4 + dataList:SearchRmhDescription[] = []
  5 + resultType:string = ""
  6 +}
6 7
  8 +class SearchDescription{
  9 + likeEnable: string = ""
  10 + previewUri: string = ""
  11 + firstFrameImageBucket: string = ""
  12 + appImg: string = ""
  13 + onlineStatus: string = ""
  14 + createUserName: string = ""
  15 + contentCheck: string = ""
  16 + type: string = ""
  17 + titleOsst: string = ""
  18 + coverHImageBucket: string = ""
  19 + shareImageUri: string = ""
  20 + searchTypeInt: string = ""
  21 + authIcon: string = ""
  22 + id: string = ""
  23 + newOld: string = ""
  24 + seoTags: string = ""
  25 + publishTime: string = ""
  26 + feedControl: string = ""
  27 + saveType: string = ""
  28 + userTypeInt: string = ""
  29 + userOrigin: string = ""
  30 + creatorType: string = ""
  31 + planStartTime: string = ""
  32 + waresSwitch: string = ""
  33 + introductionLiteral: string = ""
  34 + topicType: string = ""
  35 + hotFlag: string = ""
  36 + coverUrl: string = ""
  37 + itemId: string = ""
  38 + titleEn: string = ""
  39 + matrixId: string = ""
  40 + tplId: string = ""
  41 + joinActivity: string = ""
  42 + status: string = ""
  43 + headerPhotoUrl: string = ""
  44 + zhSearch: string = ""
  45 + activityControl: string = ""
  46 + city: string = ""
  47 + showTitleIng: string = ""
  48 + shareFlag: string = ""
  49 + creatorName: string = ""
  50 + className: string = ""
  51 + showTitleNo: string = ""
  52 + liveSwitch: string = ""
  53 + likesStyle: string = ""
  54 + dataKey: string = ""
  55 + search: string = ""
  56 + puserId: string = ""
  57 + top: string = ""
  58 + titleLiteral: string = ""
  59 + countryCode: string = ""
  60 + startTime: string = ""
  61 + shareDescription: string = ""
  62 + channelId: string = ""
  63 + openComment: string = ""
  64 + creatorClassify: string = ""
  65 + previewBucket: string = ""
  66 + picCount: string = ""
  67 + recommendControl: string = ""
  68 + creatorNameLiteral: string = ""
  69 + subjects: string = ""
  70 + updateUser: string = ""
  71 + i: string = ""
  72 + updateTime: string = ""
  73 + userId: string = ""
  74 + showTitleEd: string = ""
  75 + authTo: string = ""
  76 + rmhPlatformInt: string = ""
  77 + giftEnable: string = ""
  78 + titleEnosst: string = ""
  79 + shareCoverUrl: string = ""
  80 + deleted: string = ""
  81 + zhOperateFlag: string = ""
  82 + shareTitle: string = ""
  83 + scrollUpdated: string = ""
  84 + createTime: string = ""
  85 + creatorBan: string = ""
  86 + publishTimeInt: string = ""
  87 + organization: string = ""
  88 + channelName: string = ""
  89 + createUser: string = ""
  90 + currentPoliticsFlag: string = ""
  91 + endTime: string = ""
  92 + sourceId: string = ""
  93 + country: string = ""
  94 + secondClassify: string = ""
  95 + createUserId: string = ""
  96 + firstFrameImageUri: string = ""
  97 + pubTime: string = ""
  98 + openLikes: string = ""
  99 + contentText: string = ""
  100 + relType: string = ""
  101 + authImg: string = ""
  102 + roomId: string = ""
  103 + nameLiteral: string = ""
  104 + mainControl: string = ""
  105 + coverVImageBucket: string = ""
  106 + linkUrl: string = ""
  107 + openDownload: string = ""
  108 + zhChannelPageImg: string = ""
  109 + appStandImg: string = ""
  110 + shareSummary: string = ""
  111 + firstPublishTimeInt: string = ""
  112 + rmhPlatform: string = ""
  113 + creatorNameOsst: string = ""
  114 + searchType: string = ""
  115 + author: string = ""
  116 + askAnswerFlag: string = ""
  117 + seoTagName: string = ""
  118 + weight: string = ""
  119 + pageId: string = ""
  120 + firstPublishTime: string = ""
  121 + coverVImageUri: string = ""
  122 + publishType: string = ""
  123 + isVr: string = ""
  124 + name: string = ""
  125 + shareUrl: string = ""
  126 + userType: string = ""
  127 + firstProcessTime: string = ""
  128 + hasRecord: string = ""
  129 + shareTitleOsst: string = ""
  130 + classify: string = ""
  131 + itemType: string = ""
  132 + nameOsst: string = ""
  133 + districtCode: string = ""
  134 + hidden: string = ""
  135 + cityCode: string = ""
  136 + liveType: string = ""
  137 + appStyleImages: string = ""
  138 + titleShow: string = ""
  139 + cornerMark: string = ""
  140 + creatorId: string = ""
  141 + levelScore: string = ""
  142 + description: string = ""
  143 + liveStartTime: string = ""
  144 + likeStyle: string = ""
  145 + title: string = ""
  146 + content: string = ""
  147 + platform: string = ""
  148 + duration: string = "0"
  149 + shareDescriptionLiteral: string = ""
  150 + createTimeInt: string = ""
  151 + liveEndTime: string = ""
  152 + topicTemplate: string = ""
  153 + barrageEnable: string = ""
  154 + introduction: string = ""
  155 + notice: string = ""
  156 + shareTitleLiteral: string = ""
  157 + coverHImageUri: string = ""
  158 + relId: string = ""
  159 + classCode: string = ""
  160 + grayScale: string = ""
  161 + appStyle: number = -1
  162 + authTitle: string = ""
  163 + provinceCode: string = ""
  164 + tenancy: string = ""
  165 + platformId: string = ""
  166 + classSubName: string = ""
  167 + recommended: string = ""
  168 + descriptionLiteral: string = ""
  169 + banControl: string = ""
  170 + auditingStatus: string = ""
  171 + planEndTime: string = ""
  172 + speakControl: string = ""
  173 + sourceName: string = ""
  174 + shareImageBucket: string = ""
  175 + landscape: string = ""
  176 + collectNum: string = ""
  177 + commentNum: string = ""
  178 + likeNum: string= ""
  179 + readNum: string= ""
  180 + shareNum: string= ""
  181 +
  182 +}
  183 +
  184 +export class SearchRmhDescription{
  185 + likeEnable: string= ""
  186 + previewUri: string= ""
  187 + firstFrameImageBucket: string= ""
  188 + appImg: string= ""
  189 + onlineStatus: string= ""
  190 + createUserName: string= ""
  191 + contentCheck: string= ""
  192 + type: string= ""
  193 + titleOsst: string= ""
  194 + coverHImageBucket: string= ""
  195 + shareImageUri: string= ""
  196 + searchTypeInt: string= ""
  197 + authIcon: string= ""
  198 + id: string= ""
  199 + newOld: string= ""
  200 + seoTags: string= ""
  201 + publishTime: string= ""
  202 + feedControl: string= ""
  203 + saveType: string= ""
  204 + userTypeInt: string= ""
  205 + userOrigin: string= ""
  206 + creatorType: string= ""
  207 + planStartTime: string= ""
  208 + waresSwitch: string= ""
  209 + introductionLiteral: string= ""
  210 + topicType: string= ""
  211 + hotFlag: string= ""
  212 + coverUrl: string= ""
  213 + itemId: string= ""
  214 + titleEn: string= ""
  215 + matrixId: string= ""
  216 + tplId: string= ""
  217 + joinActivity: string= ""
  218 + status: string= ""
  219 + headerPhotoUrl: string= ""
  220 + zhSearch: string= ""
  221 + activityControl: string= ""
  222 + city: string= ""
  223 + showTitleIng: string= ""
  224 + shareFlag: string= ""
  225 + creatorName: string= ""
  226 + className: string= ""
  227 + showTitleNo: string= ""
  228 + liveSwitch: string= ""
  229 + likesStyle: string= ""
  230 + dataKey: string= ""
  231 + search: string= ""
  232 + puserId: string= ""
  233 + top: string= ""
  234 + titleLiteral: string= ""
  235 + countryCode: string= ""
  236 + startTime: string= ""
  237 + shareDescription: string= ""
  238 + channelId: string= ""
  239 + openComment: string= ""
  240 + creatorClassify: string= ""
  241 + previewBucket: string= ""
  242 + picCount: string= ""
  243 + recommendControl: string= ""
  244 + creatorNameLiteral: string= ""
  245 + subjects: string= ""
  246 + updateUser: string= ""
  247 + i: string= ""
  248 + updateTime: string= ""
  249 + userId: string= ""
  250 + showTitleEd: string= ""
  251 + authTo: string= ""
  252 + rmhPlatformInt: string= ""
  253 + giftEnable: string= ""
  254 + titleEnosst: string= ""
  255 + shareCoverUrl: string= ""
  256 + deleted: string= ""
  257 + zhOperateFlag: string= ""
  258 + shareTitle: string= ""
  259 + scrollUpdated: string= ""
  260 + createTime: string= ""
  261 + creatorBan: string= ""
  262 + publishTimeInt: string= ""
  263 + organization: string= ""
  264 + channelName: string= ""
  265 + createUser: string= ""
  266 + currentPoliticsFlag: string= ""
  267 + endTime: string= ""
  268 + sourceId: string= ""
  269 + country: string= ""
  270 + secondClassify: string= ""
  271 + createUserId: string= ""
  272 + firstFrameImageUri: string= ""
  273 + pubTime: string= ""
  274 + openLikes: string= ""
  275 + contentText: string= ""
  276 + relType: string= ""
  277 + authImg: string= ""
  278 + roomId: string= ""
  279 + nameLiteral: string= ""
  280 + mainControl: string= ""
  281 + coverVImageBucket: string= ""
  282 + linkUrl: string= ""
  283 + openDownload: string= ""
  284 + zhChannelPageImg: string= ""
  285 + appStandImg: string= ""
  286 + shareSummary: string= ""
  287 + firstPublishTimeInt: string= ""
  288 + rmhPlatform: string= ""
  289 + creatorNameOsst: string= ""
  290 + searchType: string= ""
  291 + author: string= ""
  292 + askAnswerFlag: string= ""
  293 + seoTagName: string= ""
  294 + weight: string= ""
  295 + pageId: string= ""
  296 + firstPublishTime: string= ""
  297 + coverVImageUri: string= ""
  298 + publishType: string= ""
  299 + isVr: string= ""
  300 + name: string= ""
  301 + shareUrl: string= ""
  302 + userType: string= ""
  303 + firstProcessTime: string= ""
  304 + hasRecord: string= ""
  305 + shareTitleOsst: string= ""
  306 + classify: string= ""
  307 + itemType: string= ""
  308 + nameOsst: string= ""
  309 + districtCode: string= ""
  310 + hidden: string= ""
  311 + cityCode: string= ""
  312 + liveType: string= ""
  313 + appStyleImages: string= ""
  314 + titleShow: string= ""
  315 + cornerMark: string= ""
  316 + creatorId: string= ""
  317 + levelScore: string= ""
  318 + description: string= ""
  319 + liveStartTime: string= ""
  320 + likeStyle: string= ""
  321 + title: string= ""
  322 + content: string= ""
  323 + platform: string= ""
  324 + duration: string= ""
  325 + shareDescriptionLiteral: string= ""
  326 + createTimeInt: string= ""
  327 + liveEndTime: string= ""
  328 + topicTemplate: string= ""
  329 + barrageEnable: string= ""
  330 + introduction: string= ""
  331 + notice: string= ""
  332 + shareTitleLiteral: string= ""
  333 + coverHImageUri: string= ""
  334 + relId: string= ""
  335 + classCode: string= ""
  336 + grayScale: string= ""
  337 + appStyle: string= ""
  338 + authTitle: string= ""
  339 + provinceCode: string= ""
  340 + tenancy: string= ""
  341 + platformId: string= ""
  342 + classSubName: string= ""
  343 + recommended: string= ""
  344 + descriptionLiteral: string= ""
  345 + banControl: string= ""
  346 + auditingStatus: string= ""
  347 + planEndTime: string= ""
  348 + speakControl: string= ""
  349 + sourceName: string= ""
  350 + shareImageBucket: string= ""
  351 + landscape: string= ""
7 } 352 }
@@ -37,19 +37,15 @@ export struct DetailPlayShortVideoPage { @@ -37,19 +37,15 @@ export struct DetailPlayShortVideoPage {
37 if (this.currentIndex != this.index) { 37 if (this.currentIndex != this.index) {
38 this.playerController.pause() 38 this.playerController.pause()
39 39
40 - if (this.index < this.currentIndex - 5 && this.playerController.getPlayer()) { 40 + if (this.index < this.currentIndex - 3 && this.playerController.getPlayer()) {
41 this.playerController.release() 41 this.playerController.release()
42 } 42 }
43 43
44 } else { 44 } else {
45 this.queryNewsInfoOfUser() 45 this.queryNewsInfoOfUser()
46 - console.log('currentIndex==== ', this.currentIndex)  
47 if (!this.playerController.getPlayer()) { 46 if (!this.playerController.getPlayer()) {
48 - console.error('state91111111===', this.contentDetailData?.videoInfo[0]?.videoUrl || '')  
49 this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl || ''); 47 this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl || '');
50 - console.error('state91111111===', this.playerController?.getPlayer()?.state)  
51 } else { 48 } else {
52 - console.error('state9===', this.playerController?.getPlayer()?.state)  
53 this.playerController.play() 49 this.playerController.play()
54 } 50 }
55 51
@@ -135,6 +131,7 @@ export struct DetailPlayShortVideoPage { @@ -135,6 +131,7 @@ export struct DetailPlayShortVideoPage {
135 } 131 }
136 132
137 onPageShow() { 133 onPageShow() {
  134 + // this.playerController?.play();
138 // WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED); 135 // WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED);
139 } 136 }
140 137
@@ -147,7 +144,7 @@ export struct DetailPlayShortVideoPage { @@ -147,7 +144,7 @@ export struct DetailPlayShortVideoPage {
147 144
148 onPageHide() { 145 onPageHide() {
149 // WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT); 146 // WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT);
150 - devicePLSensorManager.devicePLSensorOff(); 147 + // devicePLSensorManager.devicePLSensorOff();
151 // this.status = PlayerConstants.STATUS_PAUSE; 148 // this.status = PlayerConstants.STATUS_PAUSE;
152 this.playerController?.pause(); 149 this.playerController?.pause();
153 } 150 }
@@ -12,6 +12,7 @@ const storage = LocalStorage.getShared(); @@ -12,6 +12,7 @@ const storage = LocalStorage.getShared();
12 @Entry(storage) 12 @Entry(storage)
13 @Component 13 @Component
14 export struct DetailVideoListPage { 14 export struct DetailVideoListPage {
  15 + @Provide showComment: boolean = true
15 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 16 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
16 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 17 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
17 private contentId: string = '' 18 private contentId: string = ''
@@ -22,14 +23,20 @@ export struct DetailVideoListPage { @@ -22,14 +23,20 @@ export struct DetailVideoListPage {
22 @State testData: string[] = ['111', '222', '333'] 23 @State testData: string[] = ['111', '222', '333']
23 @State currentIndex: number = 0 24 @State currentIndex: number = 0
24 @State interactDataList: InteractDataDTO[] = [] 25 @State interactDataList: InteractDataDTO[] = []
  26 + @State isFullScreen: boolean = false
25 27
26 async aboutToAppear(): Promise<void> { 28 async aboutToAppear(): Promise<void> {
27 29
28 - 30 + /**
  31 + * 开启沉浸式并设置状态栏颜色
  32 + */
29 const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage 33 const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
30 - const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口 34 + const windowClass: window.Window = windowStage.getMainWindowSync();
31 windowClass.setWindowLayoutFullScreen(true) 35 windowClass.setWindowLayoutFullScreen(true)
32 - windowClass.setWindowSystemBarProperties({ statusBarColor: '#fff' }) 36 + this.isFullScreen = true
  37 + windowClass.setWindowSystemBarProperties({
  38 + statusBarContentColor: '#ffffff',
  39 + })
33 40
34 41
35 let data: ContentDetailDTO[] = [] 42 let data: ContentDetailDTO[] = []
@@ -99,7 +106,32 @@ export struct DetailVideoListPage { @@ -99,7 +106,32 @@ export struct DetailVideoListPage {
99 const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage 106 const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
100 const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口 107 const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
101 windowClass.setWindowLayoutFullScreen(false) 108 windowClass.setWindowLayoutFullScreen(false)
102 - windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' }) 109 + this.isFullScreen = false
  110 + windowClass.setWindowSystemBarProperties({ statusBarContentColor: '#000000' })
  111 +
  112 + }
  113 +
  114 + onPageShow(): void {
  115 + if (!this.isFullScreen) {
  116 + const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
  117 + const windowClass: window.Window = windowStage.getMainWindowSync();
  118 + windowClass.setWindowLayoutFullScreen(true)
  119 + this.isFullScreen = true
  120 + windowClass.setWindowSystemBarProperties({
  121 + statusBarContentColor: '#ffffff',
  122 + })
  123 +
  124 + }
  125 + }
  126 +
  127 + onPageHide(): void {
  128 + if (this.isFullScreen) {
  129 + const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
  130 + const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
  131 + windowClass.setWindowLayoutFullScreen(false)
  132 + this.isFullScreen = false
  133 + windowClass.setWindowSystemBarProperties({ statusBarContentColor: '#000000' })
  134 + }
103 135
104 } 136 }
105 137
@@ -14,8 +14,8 @@ export struct VideoChannelDetail { @@ -14,8 +14,8 @@ export struct VideoChannelDetail {
14 private relId: string = '' 14 private relId: string = ''
15 private relType: string = '' 15 private relType: string = ''
16 private swiperController: SwiperController = new SwiperController() 16 private swiperController: SwiperController = new SwiperController()
  17 + @Provide showComment: boolean = false
17 @State data: ContentDetailDTO[] = [] 18 @State data: ContentDetailDTO[] = []
18 - @State testData: string[] = ['111', '222', '333']  
19 @State currentIndex: number = 0 19 @State currentIndex: number = 0
20 @State interactDataList: InteractDataDTO[] = [] 20 @State interactDataList: InteractDataDTO[] = []
21 21
@@ -93,7 +93,7 @@ export struct VideoChannelDetail { @@ -93,7 +93,7 @@ export struct VideoChannelDetail {
93 if (res.data) { 93 if (res.data) {
94 this.data = this.data.concat(res.data) 94 this.data = this.data.concat(res.data)
95 } 95 }
96 - // console.log('queryVideoList===', JSON.stringify(this.data)) 96 + console.log('queryVideoList===', JSON.stringify(this.data))
97 }) 97 })
98 } 98 }
99 99