wangliang_wd

feat:解决推荐列表展示冲突

Showing 72 changed files with 2912 additions and 675 deletions

Too many changes to show.

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

@@ -19,8 +19,8 @@ @@ -19,8 +19,8 @@
19 { 19 {
20 "name": "default", 20 "name": "default",
21 "signingConfig": "default", 21 "signingConfig": "default",
22 - "compileSdkVersion": "4.0.0(10)",  
23 - "compatibleSdkVersion": "4.0.0(10)", 22 + "compileSdkVersion": "4.1.0(11)",
  23 + "compatibleSdkVersion": "4.1.0(11)",
24 "runtimeOS": "HarmonyOS", 24 "runtimeOS": "HarmonyOS",
25 } 25 }
26 ], 26 ],
@@ -9,8 +9,14 @@ export class SpConstants{ @@ -9,8 +9,14 @@ export class SpConstants{
9 static USER_LONG_TIME_NO_LOGIN_MARK="longTimeNoLoginMark" 9 static USER_LONG_TIME_NO_LOGIN_MARK="longTimeNoLoginMark"
10 static USER_STATUS="user_status" 10 static USER_STATUS="user_status"
11 static USER_TEMP_TOKEN="tempToken" 11 static USER_TEMP_TOKEN="tempToken"
  12 + static USER_PHONE = "user_phone"
12 //协议相关 13 //协议相关
13 static USER_PROTOCOL = "user_protocol" //用户协议 14 static USER_PROTOCOL = "user_protocol" //用户协议
14 static PRIVATE_PROTOCOL = "private_protocol" //隐私协议 15 static PRIVATE_PROTOCOL = "private_protocol" //隐私协议
  16 + //设置页面
  17 + static SETTING_WIFI_IMAGE_SWITCH = "setting_wifi_switch" //wifi 图片开关
  18 + static SETTING_WIFI_VIDEO_SWITCH = "setting_wifi_switch" //wifi 视频开关
  19 + static SETTING_SUSPENSION_SWITCH = "setting_suspension_switch" //悬浮窗 开关
  20 + static SETTING_PUSH_SWITCH = "setting_push_switch" //推送 开关
15 21
16 } 22 }
@@ -20,47 +20,47 @@ export const enum CompStyle { @@ -20,47 +20,47 @@ export const enum CompStyle {
20 Masonry_Layout_01 = 'Masonry_Layout-01', // 双列瀑布流/瀑布流卡:视频、直播、专题、活动 20 Masonry_Layout_01 = 'Masonry_Layout-01', // 双列瀑布流/瀑布流卡:视频、直播、专题、活动
21 21
22 22
23 - Zh_Carousel_Layout_01 = 'Zh_Carousel_Layout-01', //1 轮播图卡---1  
24 - Zh_Single_Row_01 = 'Zh_Single_Row-01', //2 横划卡 imageScale-封面图比例 1-4:3, 2-16:9, 3-3:2---1  
25 - Zh_Single_Row_02 = 'Zh_Single_Row-02', //3 小视频横划卡---1 23 + Zh_Carousel_Layout_01 = 'Zh_Carousel_Layout-01', //1 轮播图卡
  24 + Zh_Single_Row_01 = 'Zh_Single_Row-01', //2 横划卡 imageScale-封面图比例 1-4:3, 2-16:9, 3-3:2
  25 + Zh_Single_Row_02 = 'Zh_Single_Row-02', //3 小视频横划卡
26 Zh_Single_Row_03 = 'Zh_Single_Row-03', //6 直播预约卡 26 Zh_Single_Row_03 = 'Zh_Single_Row-03', //6 直播预约卡
27 - Zh_Single_Row_04 = 'Zh_Single_Row-04', // 地方精选卡---2  
28 - Zh_Single_Row_05 = 'Zh_Single_Row-05', //15 人民号横划卡---1  
29 - Zh_Single_Row_06 = 'Zh_Single_Row-06', //20 热门评论卡--精选评论卡-1 27 + Zh_Single_Row_04 = 'Zh_Single_Row-04', // 地方精选卡
  28 + Zh_Single_Row_05 = 'Zh_Single_Row-05', //15 人民号横划卡
  29 + Zh_Single_Row_06 = 'Zh_Single_Row-06', //20 热门评论卡--精选评论卡
30 Zh_Single_Column_01 = 'Zh_Single_Column-01', //5 专题时间链卡 30 Zh_Single_Column_01 = 'Zh_Single_Column-01', //5 专题时间链卡
31 - Zh_Single_Column_02 = 'Zh_Single_Column-02', //10 头图卡---2 31 + Zh_Single_Column_02 = 'Zh_Single_Column-02', //10 头图卡
32 Zh_Single_Column_03 = 'Zh_Single_Column-03', //9 直播大图卡 32 Zh_Single_Column_03 = 'Zh_Single_Column-03', //9 直播大图卡
33 - Zh_Single_Column_04 = 'Zh_Single_Column-04', //17 人民号主题卡---1  
34 - Zh_Single_Column_05 = 'Zh_Single_Column-05', //16 人民号入驻卡---1 33 + Zh_Single_Column_04 = 'Zh_Single_Column-04', //17 人民号主题卡
  34 + Zh_Single_Column_05 = 'Zh_Single_Column-05', //16 人民号入驻卡
35 Zh_Single_Column_06 = 'Zh_Single_Column-06', //12 本地问政卡 35 Zh_Single_Column_06 = 'Zh_Single_Column-06', //12 本地问政卡
36 Zh_Single_Column_07 = 'Zh_Single_Column-07', //14 热门留言卡 36 Zh_Single_Column_07 = 'Zh_Single_Column-07', //14 热门留言卡
37 Zh_Single_Column_08 = 'Zh_Single_Column-08', //12 问政提问卡 37 Zh_Single_Column_08 = 'Zh_Single_Column-08', //12 问政提问卡
38 Zh_Single_Column_10 = 'Zh_Single_Column-10', //18 服务组合卡 38 Zh_Single_Column_10 = 'Zh_Single_Column-10', //18 服务组合卡
39 Zh_Single_Column_11 = 'Zh_Single_Column-11', //19 问政组合卡 39 Zh_Single_Column_11 = 'Zh_Single_Column-11', //19 问政组合卡
40 Zh_Grid_Layout_01 = 'Zh_Grid_Layout-01', //4 信息流组合卡 40 Zh_Grid_Layout_01 = 'Zh_Grid_Layout-01', //4 信息流组合卡
41 - Zh_Grid_Layout_02 = 'Zh_Grid_Layout-02', //7 双列流小视频,一行两图卡---1  
42 - Zh_Grid_Layout_03 = 'Zh_Grid_Layout-03', //11 金刚位卡---2 41 + Zh_Grid_Layout_02 = 'Zh_Grid_Layout-02', //7 双列流小视频,一行两图卡
  42 + Zh_Grid_Layout_03 = 'Zh_Grid_Layout-03', //11 金刚位卡
43 Card_01 = '1', // 小图卡 43 Card_01 = '1', // 小图卡
44 - Card_02 = '2', // 大图卡---2  
45 - Card_03 = '3', // 无图卡(全标题)---2  
46 - Card_04 = '4', // 三图卡---2  
47 - Card_05 = '5', // 头图卡---2  
48 - Card_06 = '6', // 小视频卡---2 44 + Card_02 = '2', // 大图卡
  45 + Card_03 = '3', // 无图卡(全标题)
  46 + Card_04 = '4', // 三图卡
  47 + Card_05 = '5', // 头图卡
  48 + Card_06 = '6', // 小视频卡
49 Card_07 = '7', // 作者卡 49 Card_07 = '7', // 作者卡
50 Card_08 = '8', // 财经快讯卡 50 Card_08 = '8', // 财经快讯卡
51 - Card_09 = '9', // 时间轴卡---2  
52 - Card_10 = '10', // 大专题卡---2  
53 - Card_11 = '11', // 无图卡(标题省略)---2  
54 - Card_12 = '12', // 无图卡人民号---1  
55 - Card_13 = '13', // 单图卡---2--同6  
56 - Card_14 = '14', // 单图卡人民号---1  
57 - Card_15 = '15', // 大图卡人民号---1  
58 - Card_16 = '16', // 三图卡人民号---1  
59 - Card_17 = '17', // 图卡集---2 51 + Card_09 = '9', // 时间轴卡
  52 + Card_10 = '10', // 大专题卡
  53 + Card_11 = '11', // 无图卡(标题省略)
  54 + Card_12 = '12', // 无图卡人民号
  55 + Card_13 = '13', // 单图卡--同6
  56 + Card_14 = '14', // 单图卡人民号
  57 + Card_15 = '15', // 大图卡人民号
  58 + Card_16 = '16', // 三图卡人民号
  59 + Card_17 = '17', // 图卡集
60 Card_18 = '18', // 图卡集人民号 60 Card_18 = '18', // 图卡集人民号
61 - Card_19 = '19', // 动态图文卡人民号---1  
62 - Card_20 = '20', // 动态视频卡人民号---1  
63 - Card_21 = '21', // 小视频卡人民号---1 61 + Card_19 = '19', // 动态图文卡人民号
  62 + Card_20 = '20', // 动态视频卡人民号
  63 + Card_21 = '21', // 小视频卡人民号
64 Card_22 = '22', // 时间链 64 Card_22 = '22', // 时间链
65 Card_23 = '23', // 问政卡 65 Card_23 = '23', // 问政卡
66 } 66 }
@@ -7,7 +7,7 @@ export class Message { @@ -7,7 +7,7 @@ export class Message {
7 callbackId: string = ""; //callbackId 7 callbackId: string = ""; //callbackId
8 responseId: string = ""; //responseId 8 responseId: string = ""; //responseId
9 responseData: string = ""; //responseData 9 responseData: string = ""; //responseData
10 - data?: Action; //data of message 10 + data?: object; //data of message
11 handlerName: string = ""; //name of handler 11 handlerName: string = ""; //name of handler
12 12
13 /** 13 /**
1 import { Action } from '../bean/Action' 1 import { Action } from '../bean/Action'
  2 +import { Message } from '../bean/Message'
2 3
3 /** 4 /**
4 * 注册回调接口 5 * 注册回调接口
5 */ 6 */
6 export type Callback = (data: string) => void 7 export type Callback = (data: string) => void
7 8
8 -export interface BridgeHandler {  
9 - handle: (data: Action, f: Callback) => void 9 +export interface BridgeHandler {
  10 + handle: (data: Message, f: Callback) => void
10 } 11 }
11 12
12 export class DefaultBridgeHandler implements BridgeHandler { 13 export class DefaultBridgeHandler implements BridgeHandler {
13 - handle(data: Action, f: Callback) { 14 + handle(data: Message, f: Callback) {
14 //1,2.3 15 //1,2.3
15 f("DefaultHandler response data") 16 f("DefaultHandler response data")
16 } 17 }
@@ -5,6 +5,9 @@ import { BridgeUtil } from '../utils/BridgeUtil'; @@ -5,6 +5,9 @@ import { BridgeUtil } from '../utils/BridgeUtil';
5 import { Message } from '../bean/Message'; 5 import { Message } from '../bean/Message';
6 import { CallBackMessage } from '../bean/CallBackMessage'; 6 import { CallBackMessage } from '../bean/CallBackMessage';
7 import { StringUtils } from '../utils/StringUtils'; 7 import { StringUtils } from '../utils/StringUtils';
  8 +import hilog from '@ohos.hilog';
  9 +
  10 +// import { hilog } from '@kit.PerformanceAnalysisKit';
8 11
9 const TAG = 'BridgeWebViewControl'; 12 const TAG = 'BridgeWebViewControl';
10 13
@@ -47,6 +50,7 @@ export class BridgeWebViewControl extends webview.WebviewController { @@ -47,6 +50,7 @@ export class BridgeWebViewControl extends webview.WebviewController {
47 * 刷新消息 50 * 刷新消息
48 */ 51 */
49 flushMessageQueue() { 52 flushMessageQueue() {
  53 + hilog.error(0xFF00, TAG, 'flushMessageQueue');
50 this.loadUrlCustom(BridgeUtil.JS_FETCH_QUEUE_FROM_JAVA, (data: string) => { 54 this.loadUrlCustom(BridgeUtil.JS_FETCH_QUEUE_FROM_JAVA, (data: string) => {
51 let list: Array<Message> = JSON.parse(data) 55 let list: Array<Message> = JSON.parse(data)
52 if (list == null || list.length == 0) { 56 if (list == null || list.length == 0) {
@@ -66,11 +70,13 @@ export class BridgeWebViewControl extends webview.WebviewController { @@ -66,11 +70,13 @@ export class BridgeWebViewControl extends webview.WebviewController {
66 } else { 70 } else {
67 let responseFunction: Callback; 71 let responseFunction: Callback;
68 let callbackId: string = value.callbackId 72 let callbackId: string = value.callbackId
  73 + let handlerName: string = value.handlerName
69 if (StringUtils.isNotEmpty(callbackId)) { 74 if (StringUtils.isNotEmpty(callbackId)) {
70 responseFunction = (data: string) => { 75 responseFunction = (data: string) => {
71 let msg: CallBackMessage = new CallBackMessage() 76 let msg: CallBackMessage = new CallBackMessage()
72 msg.responseId = callbackId 77 msg.responseId = callbackId
73 msg.responseData = data 78 msg.responseData = data
  79 + msg.handlerName = handlerName
74 this.queueMessage(msg) 80 this.queueMessage(msg)
75 } 81 }
76 } else { 82 } else {
@@ -86,7 +92,7 @@ export class BridgeWebViewControl extends webview.WebviewController { @@ -86,7 +92,7 @@ export class BridgeWebViewControl extends webview.WebviewController {
86 handle = new DefaultBridgeHandler() 92 handle = new DefaultBridgeHandler()
87 } 93 }
88 if (handle != undefined && value.data != undefined) { 94 if (handle != undefined && value.data != undefined) {
89 - handle.handle(value.data, responseFunction) 95 + handle.handle(value, responseFunction)
90 } 96 }
91 } 97 }
92 }) 98 })
@@ -107,12 +113,15 @@ export class BridgeWebViewControl extends webview.WebviewController { @@ -107,12 +113,15 @@ export class BridgeWebViewControl extends webview.WebviewController {
107 */ 113 */
108 private dispatchMessage(msg: CallBackMessage) { 114 private dispatchMessage(msg: CallBackMessage) {
109 let messageJson: string = msg.toJson() 115 let messageJson: string = msg.toJson()
  116 + hilog.error(0xFF00, TAG, 'dispatchMessage '+ messageJson);
110 // messageJson = messageJson.replace("%7B", encodeURIComponent("%7B")); 117 // messageJson = messageJson.replace("%7B", encodeURIComponent("%7B"));
111 // messageJson = messageJson.replace("%7D", encodeURIComponent("%7D")); 118 // messageJson = messageJson.replace("%7D", encodeURIComponent("%7D"));
112 // messageJson = messageJson.replace("%22", encodeURIComponent("%22")); 119 // messageJson = messageJson.replace("%22", encodeURIComponent("%22"));
113 120
114 let javascriptCommand: string = StringUtils.formatStringForJS(BridgeUtil.JS_HANDLE_MESSAGE_FROM_JAVA, messageJson); 121 let javascriptCommand: string = StringUtils.formatStringForJS(BridgeUtil.JS_HANDLE_MESSAGE_FROM_JAVA, messageJson);
115 - this.runJavaScript(javascriptCommand) 122 + this.runJavaScript(javascriptCommand).then((res)=>{
  123 + hilog.error(0xFF00, TAG, 'dispatchMessage res: '+ res);
  124 + })
116 } 125 }
117 126
118 /** 127 /**
@@ -36,4 +36,6 @@ export { UserDataLocal } from './src/main/ets/utils/UserDataLocal' @@ -36,4 +36,6 @@ 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 +
  41 +export { ErrorToastUtils } from './src/main/ets/utils/ErrorToastUtils'
  1 +import { cryptoFramework } from '@kit.CryptoArchitectureKit';
  2 +import { util } from '@kit.ArkTS';
  3 +
  4 +const TAG: string = '[AesUtils]'
  5 +/**
  6 + * ASE密钥 TODO 示例密钥,业务需要按实际密钥修改
  7 + */
  8 +const AES_ENCRYPT_KEY: string = '5QXzAbJj0TJN9OQNvxFhhw==';
  9 +const AES128: string = 'AES128';
  10 +const AES128_ECB_PKCS5: string = 'AES128|ECB|PKCS5'; // 'AES128|PKCS5';
  11 +
  12 +/**
  13 + * AES加密/解密
  14 + */
  15 +export class AesUtils {
  16 + static stringToUint8Array(str: string) {
  17 + let arr: number[] = new Array();
  18 + for (let i = 0, j = str.length; i < j; ++i) {
  19 + arr.push(str.charCodeAt(i));
  20 + }
  21 + let tmpArray = new Uint8Array(arr);
  22 + return tmpArray;
  23 + }
  24 +
  25 + static uint8ArrayToString(array: Uint8Array): string {
  26 + let arrayString = '';
  27 + for (let i = 0; i < array.length; i++) {
  28 + arrayString += String.fromCharCode(array[i]);
  29 + }
  30 + return arrayString;
  31 + }
  32 +
  33 + /**
  34 + * aes加密
  35 + * @param message
  36 + * @param callback
  37 + */
  38 + static async aesEncrypt(message: string, secretKey?: string): Promise<string> {
  39 + // Logger.debug(TAG, `aesEncrypt message: ${message}`);
  40 + // 组装convertKey所需的二进制密钥数据
  41 + let base64Helper = new util.Base64Helper();
  42 + let pubKey = base64Helper.decodeSync(secretKey ?? AES_ENCRYPT_KEY); // AES密钥
  43 + let pubKeyBlob: cryptoFramework.DataBlob = { data: pubKey };
  44 + // 创建对称密钥生成器
  45 + let aesGenerator = cryptoFramework.createSymKeyGenerator(AES128);
  46 + // 转换/生成对称密钥对象
  47 + let symKey: cryptoFramework.SymKey = await aesGenerator.convertKey(pubKeyBlob)
  48 + // 生成加解密生成器
  49 + let cipher = cryptoFramework.createCipher(AES128_ECB_PKCS5);
  50 + // 初始化加密
  51 + await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, null)
  52 + // 封装加密所需数据
  53 + let input: cryptoFramework.DataBlob = { data: AesUtils.stringToUint8Array(message) };
  54 + // 当数据量较小时,可以在init完成后直接调用doFinal
  55 + // 当数据量较大时,可以多次调用update,即分段加解密。
  56 + let output: cryptoFramework.DataBlob = await cipher.doFinal(input)
  57 + // Logger.info(TAG, "aesEncrypt output.data is " + output.data);
  58 + let result = base64Helper.encodeToStringSync(output?.data)
  59 + // Logger.info(TAG, "aesEncrypt result is " + result);
  60 + return result;
  61 + }
  62 +
  63 + /**
  64 + * aes解密
  65 + * @param message
  66 + * @param callback
  67 + */
  68 + static async aesDecrypt(message: string, secretKey?: string): Promise<string> {
  69 + // Logger.debug(TAG, `aesDecrypt message: ${message}`);
  70 + // 组装convertKey所需的二进制密钥数据
  71 + let base64Helper = new util.Base64Helper();
  72 + let pubKey = base64Helper.decodeSync(secretKey ?? AES_ENCRYPT_KEY); // AES密钥
  73 + let pubKeyBlob: cryptoFramework.DataBlob = { data: pubKey };
  74 + // 创建对称密钥生成器
  75 + let aesGenerator = cryptoFramework.createSymKeyGenerator(AES128);
  76 + // 转换/生成对称密钥对象
  77 + let symKey: cryptoFramework.SymKey = await aesGenerator.convertKey(pubKeyBlob)
  78 + // 生成加解密生成器
  79 + let cipher = cryptoFramework.createCipher(AES128_ECB_PKCS5);
  80 + // 初始化加密
  81 + await cipher.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, null)
  82 + // 封装加密所需数据
  83 + let newMessage = base64Helper.decodeSync(message);
  84 + let input: cryptoFramework.DataBlob = { data: newMessage };
  85 + // 当数据量较小时,可以在init完成后直接调用doFinal
  86 + // 当数据量较大时,可以多次调用update,即分段加解密。
  87 + let output: cryptoFramework.DataBlob = await cipher.doFinal(input)
  88 + // Logger.debug(TAG, "aesDecrypt is output.data " + output?.data);
  89 + let result = AesUtils.uint8ArrayToString(output?.data)
  90 + // Logger.debug(TAG, "aesDecrypt result is " + result);
  91 + return result
  92 + }
  93 +}
@@ -25,11 +25,11 @@ export class CollectionUtils { @@ -25,11 +25,11 @@ export class CollectionUtils {
25 * @returns {boolean} true(empty) 25 * @returns {boolean} true(empty)
26 */ 26 */
27 static isEmpty(collection?: any[]): boolean { 27 static isEmpty(collection?: any[]): boolean {
28 - return !collection || collection.length === 0; 28 + return!collection || collection.length === 0;
29 } 29 }
30 30
31 static isEmptyList<T>(list1?: LinkList<T>): boolean { 31 static isEmptyList<T>(list1?: LinkList<T>): boolean {
32 - return !list1 || list1.length === 0; 32 + return!list1 || list1.length === 0;
33 } 33 }
34 34
35 static isEmptyHashMap(obj?: HashMap<any, any>): boolean { 35 static isEmptyHashMap(obj?: HashMap<any, any>): boolean {
@@ -186,5 +186,6 @@ export class CollectionUtils { @@ -186,5 +186,6 @@ export class CollectionUtils {
186 ss; 186 ss;
187 return collection.slice(start, end); 187 return collection.slice(start, end);
188 } 188 }
  189 +
189 } 190 }
190 191
@@ -466,6 +466,20 @@ export class DateTimeUtils { @@ -466,6 +466,20 @@ export class DateTimeUtils {
466 static getLunar(_date?: string) { 466 static getLunar(_date?: string) {
467 return getLunar(_date) 467 return getLunar(_date)
468 } 468 }
  469 +
  470 + /**
  471 + * 获取指定日期的时间戳
  472 + * @returns
  473 + */
  474 + static getDateTimestamp(date: string): number {
  475 + if (StringUtils.isEmpty(date))
  476 + return 0
  477 + try {
  478 + return new Date(date).getTime()
  479 + } catch (e) {
  480 + return 0
  481 + }
  482 + }
469 } 483 }
470 484
471 // const dateTimeUtils = new DateTimeUtils() 485 // const dateTimeUtils = new DateTimeUtils()
  1 +import { ToastUtils } from './ToastUtils'
  2 +
  3 +export namespace ErrorToastUtils {
  4 + export enum ErrorType {
  5 + NET_CORE_NO_NETWORK, //当前无网络,请重试
  6 + NET_CORE_WEAK_NETWORK, //当前无网络,请重试
  7 + NET_CORE_PAGE_ERROR_NETWORK, //网络出小差了,请检查网络后重试
  8 + NET_CORE_LOAD_ERROR_NETWORK, //加载失败,请重试
  9 + NET_CORE_ENTER_ERROR_NETWORK, //很抱歉,当前内容无法加载,请点击重试
  10 + LIVE_CORE_NO_NETWORK, //网络出小差了,请检查下网络
  11 +
  12 + }
  13 +
  14 + export class ErrorToast {
  15 + static showToast(type: ErrorType) {
  16 + switch (type) {
  17 + case ErrorType.NET_CORE_NO_NETWORK:
  18 + ToastUtils.shortToast($r('app.string.net_core_no_network'))
  19 + break
  20 + case ErrorType.NET_CORE_WEAK_NETWORK:
  21 + ToastUtils.shortToast($r('app.string.net_core_no_network'))
  22 + break
  23 + case ErrorType.NET_CORE_PAGE_ERROR_NETWORK:
  24 + ToastUtils.shortToast($r('app.string.net_core_page_error_network'))
  25 + break
  26 + case ErrorType.NET_CORE_LOAD_ERROR_NETWORK:
  27 + ToastUtils.shortToast($r('app.string.net_core_load_fail_network'))
  28 + break
  29 + case ErrorType.NET_CORE_ENTER_ERROR_NETWORK:
  30 + ToastUtils.shortToast($r('app.string.net_core_enter_fail_network'))
  31 + break
  32 + case ErrorType.LIVE_CORE_NO_NETWORK:
  33 + ToastUtils.shortToast($r('app.string.live_core_no_network'))
  34 + break
  35 + }
  36 +
  37 + }
  38 + }
  39 +
  40 +
  41 +}
  42 +
@@ -8,7 +8,7 @@ export class NumberFormatterUtils { @@ -8,7 +8,7 @@ export class NumberFormatterUtils {
8 */ 8 */
9 static formatNumberWithWan(inputNumber: number | String): string { 9 static formatNumberWithWan(inputNumber: number | String): string {
10 const num = typeof inputNumber === 'number' ? inputNumber : Number(inputNumber); 10 const num = typeof inputNumber === 'number' ? inputNumber : Number(inputNumber);
11 - if (isNaN(num) || num < 10000) { 11 + if (Number.isNaN(num) || num < 10000) {
12 return num.toString(); 12 return num.toString();
13 } else { 13 } else {
14 const wanUnit = num / 10000; 14 const wanUnit = num / 10000;
@@ -15,15 +15,17 @@ export class Size { @@ -15,15 +15,17 @@ export class Size {
15 15
16 export class WindowModel { 16 export class WindowModel {
17 private windowStage?: window.WindowStage; 17 private windowStage?: window.WindowStage;
18 -  
19 static shared: WindowModel = new WindowModel() 18 static shared: WindowModel = new WindowModel()
20 -  
21 static TAG = "WindowModel"; 19 static TAG = "WindowModel";
22 20
23 setWindowStage(windowStage: window.WindowStage) { 21 setWindowStage(windowStage: window.WindowStage) {
24 this.windowStage = windowStage; 22 this.windowStage = windowStage;
25 } 23 }
26 24
  25 + getWindowStage(): window.WindowStage {
  26 + return this.windowStage as window.WindowStage
  27 + }
  28 +
27 setMainWindowFullScreen(fullScreen: boolean) { 29 setMainWindowFullScreen(fullScreen: boolean) {
28 if (deviceInfo.deviceType != "phone") { 30 if (deviceInfo.deviceType != "phone") {
29 return 31 return
@@ -65,10 +67,10 @@ export class WindowModel { @@ -65,10 +67,10 @@ export class WindowModel {
65 windowClass.setWindowKeepScreenOn(isKeepScreenOn, (err: BusinessError) => { 67 windowClass.setWindowKeepScreenOn(isKeepScreenOn, (err: BusinessError) => {
66 const errCode: number = err.code; 68 const errCode: number = err.code;
67 if (errCode) { 69 if (errCode) {
68 - console.error(WindowModel.TAG +'设置屏幕常亮:' + isKeepScreenOn + ',失败: ' + JSON.stringify(err)); 70 + console.error(WindowModel.TAG + '设置屏幕常亮:' + isKeepScreenOn + ',失败: ' + JSON.stringify(err));
69 return; 71 return;
70 } 72 }
71 - console.info(WindowModel.TAG +'设置屏幕常亮:' + isKeepScreenOn + ",成功"); 73 + console.info(WindowModel.TAG + '设置屏幕常亮:' + isKeepScreenOn + ",成功");
72 }) 74 })
73 }) 75 })
74 } 76 }
@@ -3,6 +3,30 @@ @@ -3,6 +3,30 @@
3 { 3 {
4 "name": "shared_desc", 4 "name": "shared_desc",
5 "value": "全局工具包" 5 "value": "全局工具包"
  6 + } ,
  7 + {
  8 + "name": "net_core_no_network",
  9 + "value": "当前无网络,请重试"
  10 + } ,
  11 + {
  12 + "name": "net_core_weak_network",
  13 + "value": "当前无网络,请重试"
  14 + } ,
  15 + {
  16 + "name": "net_core_page_error_network",
  17 + "value": "网络出小差了,请检查下网络"
  18 + },
  19 + {
  20 + "name": "net_core_load_fail_network",
  21 + "value": "加载失败,请重试"
  22 + },
  23 + {
  24 + "name": "net_core_enter_fail_network",
  25 + "value": "很抱歉,当前内容无法加载,请点击重试"
  26 + },
  27 + {
  28 + "name": "live_core_no_network",
  29 + "value": "网络出小差了,请检查下网络"
6 } 30 }
7 ] 31 ]
8 } 32 }
@@ -35,9 +35,9 @@ export class HttpUrlUtils { @@ -35,9 +35,9 @@ export class HttpUrlUtils {
35 */ 35 */
36 static readonly COMP_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo"; 36 static readonly COMP_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo";
37 /** 37 /**
38 - * 推荐内容的展现comp接口 38 + * 展现comp接口(推荐)
39 */ 39 */
40 - static readonly HOTCOMP_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/rec/compInfo"; 40 + static readonly COMP_REC_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/rec/compInfo";
41 /** 41 /**
42 * 详情页面详情接口 42 * 详情页面详情接口
43 */ 43 */
@@ -188,6 +188,32 @@ export class HttpUrlUtils { @@ -188,6 +188,32 @@ export class HttpUrlUtils {
188 * 搜索主页 热词 188 * 搜索主页 热词
189 */ 189 */
190 static readonly SEARCH_HOTS_DATA_PATH: string = "/api/rmrb-search-api/zh/c/hots"; 190 static readonly SEARCH_HOTS_DATA_PATH: string = "/api/rmrb-search-api/zh/c/hots";
  191 +
  192 + /**
  193 + * 搜索联想词
  194 + */
  195 + static readonly RELATED_SEARCH_CONTENT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/suggestions/";
  196 +
  197 + /**
  198 + * 直播详情
  199 + */
  200 + static readonly LIVE_DETAILS_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail";
  201 +
  202 + /**
  203 + * 直播详情-直播间列表
  204 + */
  205 + static readonly LIVE_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/video/list";
  206 +
  207 + /**
  208 + * 直播详情-大家聊列表
  209 + */
  210 + static readonly LIVE_CHAT_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/chat/list";
  211 + /**
  212 +
  213 + * 搜索结果 显示tab 数
  214 + */
  215 + static readonly SEARCH_RESULT_COUNT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/count?keyword=";
  216 +
191 /** 217 /**
192 * 早晚报列表 218 * 早晚报列表
193 * 根据页面id获取页面楼层列表 219 * 根据页面id获取页面楼层列表
@@ -199,7 +225,19 @@ export class HttpUrlUtils { @@ -199,7 +225,19 @@ export class HttpUrlUtils {
199 * */ 225 * */
200 static readonly MORNING_EVENING_PAGE_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/pageInfo"; 226 static readonly MORNING_EVENING_PAGE_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/pageInfo";
201 static readonly MORNING_EVENING_COMP_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo"; 227 static readonly MORNING_EVENING_COMP_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo";
  228 + /**
  229 + * 直播回顾
  230 + * */
  231 + static readonly LIVE_REVIEW_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/channel/live/reviewList"; //?pageNum=1&pageSize=20
  232 + /**
  233 + * 早晚报获取PAGEID
  234 + * */
  235 + static readonly DAILY_PAPER_TOPIC: string = "/api/rmrb-bff-display-zh/display/zh/c/dailyPaperTopic";
202 private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT; 236 private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT;
  237 + /**
  238 + * 推荐列表
  239 + */
  240 + static readonly RECOMMEND_LIST: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list";
203 241
204 public static set hostUrl(value: string) { 242 public static set hostUrl(value: string) {
205 HttpUrlUtils._hostUrl = value; 243 HttpUrlUtils._hostUrl = value;
@@ -439,6 +477,7 @@ export class HttpUrlUtils { @@ -439,6 +477,7 @@ export class HttpUrlUtils {
439 let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/checkVerifyCode"; 477 let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/checkVerifyCode";
440 return url; 478 return url;
441 } 479 }
  480 +
442 static getAgreement() { 481 static getAgreement() {
443 let url = HttpUrlUtils._hostUrl + "/api/rmrb-bff-display-zh/display/zh/c/agreement"; 482 let url = HttpUrlUtils._hostUrl + "/api/rmrb-bff-display-zh/display/zh/c/agreement";
444 return url; 483 return url;
@@ -449,6 +488,18 @@ export class HttpUrlUtils { @@ -449,6 +488,18 @@ export class HttpUrlUtils {
449 return url; 488 return url;
450 } 489 }
451 490
  491 + //账户注销
  492 + static accountLogoutUrl() {
  493 + let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/logoff";
  494 + return url;
  495 + }
  496 +
  497 + //更换手机号绑定
  498 + static changeBindPhone() {
  499 + let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/userPhoneChange";
  500 + return url;
  501 + }
  502 +
452 static getAppointmentListDataUrl() { 503 static getAppointmentListDataUrl() {
453 let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH 504 let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH
454 return url 505 return url
@@ -549,7 +600,30 @@ export class HttpUrlUtils { @@ -549,7 +600,30 @@ export class HttpUrlUtils {
549 return url 600 return url
550 } 601 }
551 602
  603 + static getRelatedSearchContentDataUrl() {
  604 + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.RELATED_SEARCH_CONTENT_DATA_PATH
  605 + return url
  606 + }
552 607
  608 + static getLiveDetailsUrl() {
  609 + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_DETAILS_PATH
  610 + return url
  611 + }
  612 +
  613 + static getLiveListUrl() {
  614 + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_LIST_PATH
  615 + return url
  616 + }
  617 +
  618 + static getLiveChatListUrl() {
  619 + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_CHAT_LIST_PATH
  620 + return url
  621 + }
  622 +
  623 + static getSearchResultCountDataUrl() {
  624 + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_COUNT_DATA_PATH
  625 + return url
  626 + }
553 627
554 // static getYcgCommonHeaders(): HashMap<string, string> { 628 // static getYcgCommonHeaders(): HashMap<string, string> {
555 // let headers: HashMap<string, string> = new HashMap<string, string>() 629 // let headers: HashMap<string, string> = new HashMap<string, string>()
@@ -49,10 +49,9 @@ export function registerRouter() { @@ -49,10 +49,9 @@ export function registerRouter() {
49 // }) 49 // })
50 50
51 Action2Page.register("JUMP_DETAIL_PAGE", (action: Action) => { 51 Action2Page.register("JUMP_DETAIL_PAGE", (action: Action) => {
52 - // if (action.params?.detailPageType == 2 || action.params?.detailPageType == 6) {  
53 - // return WDRouterPage.detailPlayLivePage  
54 - // }  
55 - if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) { 52 + if (action.params?.detailPageType == 2 || action.params?.detailPageType == 6) {
  53 + return WDRouterPage.detailPlayLivePage
  54 + } else if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) {
56 return WDRouterPage.detailVideoListPage 55 return WDRouterPage.detailVideoListPage
57 } else if (action.params?.detailPageType == 17) { 56 } else if (action.params?.detailPageType == 17) {
58 return WDRouterPage.multiPictureDetailPage 57 return WDRouterPage.multiPictureDetailPage
@@ -75,8 +74,6 @@ export function registerRouter() { @@ -75,8 +74,6 @@ export function registerRouter() {
75 return WDRouterPage.imageTextDetailPage 74 return WDRouterPage.imageTextDetailPage
76 } else if (action.params?.pageID == "BroadcastPage") { 75 } else if (action.params?.pageID == "BroadcastPage") {
77 return WDRouterPage.broadcastPage 76 return WDRouterPage.broadcastPage
78 - } else if (action.params?.pageID == "LIVE_DETAILS_PAGER") {  
79 - return WDRouterPage.detailPlayLivePage  
80 } 77 }
81 return undefined 78 return undefined
82 }) 79 })
@@ -9,7 +9,7 @@ export class WDRouterPage { @@ -9,7 +9,7 @@ export class WDRouterPage {
9 this.pagePath = pagePath 9 this.pagePath = pagePath
10 } 10 }
11 11
12 - static getBundleInfo(){ 12 + static getBundleInfo() {
13 let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT) 13 let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT)
14 return `@bundle:${bundleInfo.name}/${"phone"}/${"ets/pages/MainPage"}` 14 return `@bundle:${bundleInfo.name}/${"phone"}/${"ets/pages/MainPage"}`
15 } 15 }
@@ -35,6 +35,8 @@ export class WDRouterPage { @@ -35,6 +35,8 @@ export class WDRouterPage {
35 // 短视频详情页 35 // 短视频详情页
36 static detailVideoListPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailVideoListPage"); 36 static detailVideoListPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailVideoListPage");
37 static detailPlayShortVideoPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailPlayShortVideoPage"); 37 static detailPlayShortVideoPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailPlayShortVideoPage");
  38 + static VideoChannelDetail = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/VideoChannelDetail");
  39 + static LottieViewDemo = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/LottieViewDemo");
38 // 点播详情页 40 // 点播详情页
39 static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage"); 41 static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage");
40 // 直播详情页 42 // 直播详情页
@@ -68,20 +70,19 @@ export class WDRouterPage { @@ -68,20 +70,19 @@ export class WDRouterPage {
68 static aboutPage = new WDRouterPage("wdComponent", "ets/components/page/SettingAboutPage"); 70 static aboutPage = new WDRouterPage("wdComponent", "ets/components/page/SettingAboutPage");
69 // 设置页 71 // 设置页
70 static settingPage = new WDRouterPage("wdComponent", "ets/components/page/SettingPage"); 72 static settingPage = new WDRouterPage("wdComponent", "ets/components/page/SettingPage");
  73 + // 设置页
  74 + static logoutPage = new WDRouterPage("wdComponent", "ets/components/setting/LogoutPage");
71 // 设置密码页、设置手机号页等等 (需要传参) 75 // 设置密码页、设置手机号页等等 (需要传参)
72 static settingPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/SettingPasswordPage"); 76 static settingPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/SettingPasswordPage");
73 //其他普通用户 主页 77 //其他普通用户 主页
74 static otherNormalUserHomePagePage = new WDRouterPage("wdComponent", "ets/pages/OtherNormalUserHomePage"); 78 static otherNormalUserHomePagePage = new WDRouterPage("wdComponent", "ets/pages/OtherNormalUserHomePage");
75 static guidePage = new WDRouterPage("wdLogin", "ets/pages/guide/GuidePages"); 79 static guidePage = new WDRouterPage("wdLogin", "ets/pages/guide/GuidePages");
76 -  
77 //隐私政策页面 80 //隐私政策页面
78 static privacyPage = new WDRouterPage("phone", "ets/pages/launchPage/PrivacyPage"); 81 static privacyPage = new WDRouterPage("phone", "ets/pages/launchPage/PrivacyPage");
79 //启动广告页面 82 //启动广告页面
80 static launchAdvertisingPage = new WDRouterPage("phone", "ets/pages/launchPage/LaunchAdvertisingPage"); 83 static launchAdvertisingPage = new WDRouterPage("phone", "ets/pages/launchPage/LaunchAdvertisingPage");
81 //主页 84 //主页
82 static mainPage = new WDRouterPage("phone", "ets/pages/MainPage"); 85 static mainPage = new WDRouterPage("phone", "ets/pages/MainPage");
83 -  
84 -  
85 // static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview"); 86 // static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview");
86 87
87 //播报页面 88 //播报页面
  1 +/**
  2 + * h5调用native,事件id枚举,
  3 + * h5主动调用app方法
  4 + */
  5 +export class H5CallNativeType {
  6 + static JsCallTypeList: string[] = []
  7 + static jsCall_currentPageOperate = 'jsCall_currentPageOperate'
  8 + static jsCall_getAppPublicInfo = 'jsCall_getAppPublicInfo'
  9 + static jsCall_getArticleDetailBussinessData = 'jsCall_getArticleDetailBussinessData'
  10 + static jsCall_callAppService = 'jsCall_callAppService'
  11 + // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。
  12 +
  13 + static init() {
  14 + H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_currentPageOperate)
  15 + H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppPublicInfo)
  16 + H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getArticleDetailBussinessData)
  17 + H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_callAppService)
  18 + }
  19 +}
  20 +
  21 +
1 -import { Action } from 'wdBean';  
2 -import { Callback } from 'wdJsBridge'; 1 +import { Callback, BridgeWebViewControl } from 'wdJsBridge';
  2 +import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
3 import { Logger, StringUtils, } from 'wdKit'; 3 import { Logger, StringUtils, } from 'wdKit';
4 -// import { AccountManagerUtils, ILoginService, Logger, ServiceManager, StringUtils, UserBean, UserInfo } from 'wdKit';  
5 -import { WDRouterPage, WDRouterRule } from 'wdRouter'; 4 +import { H5CallNativeType } from './H5CallNativeType';
6 5
7 -// import { wdMenc } from 'wdMenc'; 6 +const TAG = 'JsBridgeBiz'
8 7
9 /** 8 /**
10 * h5调用native代码 9 * h5调用native代码
11 * @param data 10 * @param data
12 * @param call 11 * @param call
13 */ 12 */
14 -export function performJSCallNative(data: Action, call: Callback) {  
15 -  
16 - // if (data.name == "GET_PROMOTION_SIGN") {  
17 - // wdMenc.getActivitySign(data.params?.intfId, (sign) => {  
18 - // if (sign) {  
19 - // call(JSON.stringify(sign));  
20 - // } else {  
21 - // call("")  
22 - // }  
23 - // })  
24 - // return  
25 - // }  
26 -  
27 - //TODO 数据校验  
28 - switch (data.type) {  
29 - //获取用户信息  
30 - case "GET_USER_INFO":  
31 - //测试环境  
32 - // call(JSON.stringify(getTestUserBean()))  
33 - // let isLogin = AccountManagerUtils.isLoginSync()  
34 - // Logger.info("WebComponent", `GET_USER_INFO#:::refresh==` + isLogin);  
35 - //  
36 - // if (isLogin) {  
37 - // const loginService = ServiceManager.getService(ILoginService.name) as ILoginService.Service  
38 - // let userBean: UserBean = loginService.getUserBean()  
39 - // // userBean.userInfo = JSON.stringify(loginService.getUserInfo())  
40 - // call(JSON.stringify(userBean))  
41 - // } else {  
42 - // call("fail")  
43 - // }  
44 - 13 +export function performJSCallNative(data: Message, call: Callback) {
  14 + Logger.debug(TAG, 'performJSCallNative handlerName: ' + data.handlerName + ', data: ' + data.data)
  15 + switch (data.handlerName) {
  16 + case H5CallNativeType.jsCall_currentPageOperate:
  17 + break;
  18 + case H5CallNativeType.jsCall_getAppPublicInfo:
  19 + // h5获取app配置信息
  20 + call(getAppPublicInfo())
  21 + break;
  22 + case H5CallNativeType.jsCall_getArticleDetailBussinessData:
  23 + break;
  24 + case H5CallNativeType.jsCall_callAppService:
45 break; 25 break;
46 - case "JUMP_DETAIL_PAGE":  
47 - WDRouterRule.jumpWithAction(data) 26 + case 'changeNativeMessage':
  27 + call("this is change Web Message")
48 break; 28 break;
49 - case "JUMP_INNER_NEW_PAGE":  
50 - WDRouterRule.jumpWithAction(data)  
51 - break  
52 - case "GET_DEVICE_DATA":  
53 - break  
54 - //用户登陆  
55 - case "USER_LOGIN":  
56 - WDRouterRule.jumpWithAction(data)  
57 - //支付完成回调  
58 - case "REGISTER_H5_WEBVIEW_CREATE_ORDER_RESULT":  
59 - break  
60 - //打开H5页面  
61 - case "JUMP_H5_BY_WEB_VIEW":  
62 - WDRouterRule.jumpWithAction(data)  
63 - break  
64 - case "USER_LOGOUT":  
65 - // const loginService = ServiceManager.getService(ILoginService.name) as ILoginService.Service  
66 - // loginService.logout()  
67 - break  
68 default: 29 default:
69 call("this is def value") 30 call("this is def value")
70 } 31 }
71 32
72 } 33 }
73 34
74 -// /**  
75 -// *  
76 -// * @returns 模拟测试环境的user信息  
77 -// */  
78 -// function getTestUserBean(): UserBean {  
79 -// const loginService = ServiceManager.getService(ILoginService.name) as ILoginService.Service  
80 -// //正是环境  
81 -// let userBean: UserBean = loginService.getUserBean()  
82 -// userBean.userId = "930855275"  
83 -// userBean.userToken = "nlps6FADECE38F5AAD2116F2"  
84 -// // userBean.clientId = "f1bf515c-4006-4606-a752-2b4cdd9343d0"  
85 -// // userBean.carrierCode = "CM"  
86 -// userBean.mobile = "NTTrcDO4ADN1cTM5MTM"  
87 -// userBean.uname = '139****0887'  
88 -// userBean.picture = "http://36.155.98.104:23380/publish/voms2/uic_service/picture/userImage/543/626/5181.jpg"  
89 -// // userBean.ssotoken = "STnid0000011700463753943SKPUlfNxEDJsrauGjCwUldiDfrd0mUuM"  
90 -// // userBean.clientProvinceCode = "210"  
91 -// // userBean.clientCityId = "0210"  
92 -// // userBean.sign = "617DAC548595B7C9EBB13043735F1BE0"  
93 -// // userBean.blurMobile = "177****9217"  
94 -// let userinfo: UserInfo = ({  
95 -// userId: "930855275",  
96 -// userNum: "NzDrsyN4gDM0UzNxkzMxYDO",  
97 -// mobile: "NTTrcDO4ADN1cTM5MTM",  
98 -// areaId: "210",  
99 -// cityId: "0210",  
100 -// carrierCode: "CM",  
101 -// passId: "602201990200225921",  
102 -// userToken: "nlps6FADECE38F5AAD2116F2",  
103 -// expiredOn: "1705647754000",  
104 -// blurMobile: "139****0887",  
105 -// encrypted: true  
106 -// })  
107 -// // userBean.userInfo = JSON.stringify(userinfo);  
108 -// return userBean  
109 -// }  
110 -//  
111 -// /**  
112 -// *  
113 -// * @returns 用户信息  
114 -// */  
115 -// function getUserBean(): UserBean {  
116 -// const loginService = ServiceManager.getService(ILoginService.name) as ILoginService.Service  
117 -// //正是环境  
118 -// let userBean: UserBean = loginService.getUserBean()  
119 -// userBean.userId = "1437725487"  
120 -// userBean.userToken = "nlps08468E117C554CA08A43"  
121 -// // userBean.clientId = "27fb3129-5a54-45bc-8af1-7dc8f1155501"  
122 -// // userBean.carrierCode = "CT"  
123 -// userBean.mobile = "OTTrcTMykTO4ATM3cTM"  
124 -// userBean.uname = '小可爱啊'  
125 -// userBean.picture = "http://img.cmvideo.cn:8080/publish/voms2/uic_service/picture/userImage/1437/725/487/20211224174128beax.png"  
126 -// // userBean.ssotoken = "STnid0000011700461738301N5rjsHdbvyzMpyzwvHrFRJsj7oNT1Juf"  
127 -// // userBean.clientProvinceCode = "100"  
128 -// // userBean.clientCityId = "0100"  
129 -// // userBean.sign = "4ABFB8442EE914B57CCD9F1DE587D96D"  
130 -// // userBean.blurMobile = "177****9217"  
131 -// let userinfo: UserInfo = ({  
132 -// userId: "1437725487",  
133 -// userNum: "MzDrsyNxITO5gDMxczNxYDO",  
134 -// mobile: "OTTrcTMykTO4ATM3cTM",  
135 -// areaId: "100",  
136 -// cityId: "0100",  
137 -// carrierCode: "CT",  
138 -// passId: "467464726359024540",  
139 -// userToken: "nlps08468E117C554CA08A43",  
140 -// expiredOn: "1705645738000",  
141 -// blurMobile: "177****9217",  
142 -// encrypted: true  
143 -// })  
144 -// // userBean.userInfo = JSON.stringify(userinfo);  
145 -// return userBean  
146 -// } 35 +class AppInfo {
  36 + plat: string = ''
  37 + system: string = ''
  38 + // TODO 完善
  39 +}
  40 +
  41 +/**
  42 + * 获取App公共信息
  43 + */
  44 +function getAppPublicInfo(): string {
  45 + let info = new AppInfo()
  46 + info.plat = 'Phone'
  47 + // 直接用Android,后续适配再新增鸿蒙
  48 + info.system = 'Android'
  49 + let result = JSON.stringify(info)
  50 + return result;
  51 +}
147 52
148 53
  1 +/**
  2 + * native调用h5,事件id枚举
  3 + * app主动调用h5方法
  4 + */
  5 +export const enum NativeCallH5Type {
  6 + jsCall_receiveAppData = 'jsCall_receiveAppData',
  7 + // TODO 业务自行新增类型,自行调用,例:
  8 + // TODO this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData,xxxx)
  9 +
  10 +}
  11 +
  12 +
@@ -5,6 +5,7 @@ import { Logger } from 'wdKit'; @@ -5,6 +5,7 @@ import { Logger } from 'wdKit';
5 import { BridgeHandler, BridgeUtil, BridgeWebViewControl, Callback } from 'wdJsBridge'; 5 import { BridgeHandler, BridgeUtil, BridgeWebViewControl, Callback } from 'wdJsBridge';
6 import { performJSCallNative } from './JsBridgeBiz'; 6 import { performJSCallNative } from './JsBridgeBiz';
7 import { setDefaultNativeWebSettings } from './WebComponentUtil'; 7 import { setDefaultNativeWebSettings } from './WebComponentUtil';
  8 +import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
8 9
9 const TAG = 'WdWebComponent'; 10 const TAG = 'WdWebComponent';
10 11
@@ -12,7 +13,7 @@ const TAG = 'WdWebComponent'; @@ -12,7 +13,7 @@ const TAG = 'WdWebComponent';
12 export struct WdWebComponent { 13 export struct WdWebComponent {
13 private webviewControl: BridgeWebViewControl = new BridgeWebViewControl() 14 private webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
14 //TODO 默认网页 15 //TODO 默认网页
15 - webUrl: string = ConfigConstants.DETAIL_URL 16 + webUrl: string | Resource = ConfigConstants.DETAIL_URL
16 /** 17 /**
17 * 对外暴露webview的回调,能力 18 * 对外暴露webview的回调,能力
18 */ 19 */
@@ -30,7 +31,7 @@ export struct WdWebComponent { @@ -30,7 +31,7 @@ export struct WdWebComponent {
30 /** 31 /**
31 * 默认【CallNative】逻辑处理 32 * 默认【CallNative】逻辑处理
32 */ 33 */
33 - private defaultPerformJSCallNative: (data: Action, f: Callback) => void = (data: Action, f: Callback) => { 34 + private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => {
34 performJSCallNative(data, f) 35 performJSCallNative(data, f)
35 } 36 }
36 /** 37 /**
@@ -41,7 +42,7 @@ export struct WdWebComponent { @@ -41,7 +42,7 @@ export struct WdWebComponent {
41 42
42 defaultRegisterHandler(): void { 43 defaultRegisterHandler(): void {
43 this.webviewControl.registerHandler("CallNative", { 44 this.webviewControl.registerHandler("CallNative", {
44 - handle: (data: Action, f: Callback) => { 45 + handle: (data: Message, f: Callback) => {
45 this.defaultPerformJSCallNative(data, f) 46 this.defaultPerformJSCallNative(data, f)
46 } 47 }
47 }); 48 });
@@ -88,7 +89,7 @@ export struct WdWebComponent { @@ -88,7 +89,7 @@ export struct WdWebComponent {
88 // },500) 89 // },500)
89 // }) 90 // })
90 // this.onPageBegin(event?.url) 91 // this.onPageBegin(event?.url)
91 - this.webviewControl?.setCustomUserAgent('Mozilla/5.0 (Linux; Android 12; HarmonyOS; OXF-AN00; HMSCore 6.13.0.302) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 HuaweiBrowser/14.0.6.300 Mobile Safari/537.36') 92 + // this.webviewControl?.setCustomUserAgent('Mozilla/5.0 (Linux; Android 12; HarmonyOS; OXF-AN00; HMSCore 6.13.0.302) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 HuaweiBrowser/14.0.6.300 Mobile Safari/537.36')
92 }) 93 })
93 .onLoadIntercept((event) => { 94 .onLoadIntercept((event) => {
94 let url: string = event.data.getRequestUrl().toString() 95 let url: string = event.data.getRequestUrl().toString()
1 import router from '@ohos.router'; 1 import router from '@ohos.router';
2 -import { BridgeUtil, BridgeWebViewControl } from 'wdJsBridge';  
3 -import { ResourceManager } from 'wdJsBridge/src/main/ets/utils/ResourceManager'; 2 +import { BridgeHandler, BridgeUtil, BridgeWebViewControl, Callback } from 'wdJsBridge';
  3 +import { Logger } from 'wdKit/Index';
  4 +import { setDefaultNativeWebSettings } from './WebComponentUtil';
  5 +import { Action } from 'wdBean';
  6 +import { performJSCallNative } from './JsBridgeBiz';
  7 +import { H5CallNativeType } from './H5CallNativeType';
  8 +import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
4 9
5 const TAG = 'WdWebLocalComponent'; 10 const TAG = 'WdWebLocalComponent';
6 11
@@ -26,12 +31,34 @@ export struct WdWebLocalComponent { @@ -26,12 +31,34 @@ export struct WdWebLocalComponent {
26 .visibility(this.backVisibility ? Visibility.Visible : Visibility.None) 31 .visibility(this.backVisibility ? Visibility.Visible : Visibility.None)
27 32
28 Web({ src: this.webResource, controller: this.webviewControl }) 33 Web({ src: this.webResource, controller: this.webviewControl })
  34 + .layoutMode(WebLayoutMode.FIT_CONTENT)
29 .domStorageAccess(true) 35 .domStorageAccess(true)
30 .databaseAccess(true) 36 .databaseAccess(true)
31 .javaScriptAccess(true) 37 .javaScriptAccess(true)
  38 + // .imageAccess(true)
  39 + // .onlineImageAccess(true)
  40 + // .fileAccess(true)
32 .onPageBegin((event) => { 41 .onPageBegin((event) => {
33 42
34 - }) 43 + // setDefaultNativeWebSettings(this.webviewControl, this.webResource).then(()=>{
  44 + // this.handleInfo && this.handleInfo.length > 1 ? this.handleInfo.forEach(value => {
  45 + // this.webviewControl.registerHandler(value[0], value[1])
  46 + // }) : this.defaultRegisterHandler()
  47 + // setTimeout(()=>{
  48 + // BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)
  49 + // },500)
  50 + // })
  51 + // this.onPageBegin(event?.url)
  52 + // BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl);
  53 + this.onPageBegin(event?.url);
  54 + this.registerHandlers();
  55 + setTimeout(() => {
  56 + BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)
  57 + }, 200)
  58 + })
  59 + .onPageEnd((event) => {
  60 + this.onPageEnd(event?.url)
  61 + })
35 .onLoadIntercept((event) => { 62 .onLoadIntercept((event) => {
36 let url: string = event.data.getRequestUrl().toString() 63 let url: string = event.data.getRequestUrl().toString()
37 url = url.replace("%(?![0-9a-fA-F]{2})", "%25") 64 url = url.replace("%(?![0-9a-fA-F]{2})", "%25")
@@ -42,12 +69,50 @@ export struct WdWebLocalComponent { @@ -42,12 +69,50 @@ export struct WdWebLocalComponent {
42 return true 69 return true
43 } 70 }
44 if (url.startsWith(BridgeUtil.YY_OVERRIDE_SCHEMA)) { 71 if (url.startsWith(BridgeUtil.YY_OVERRIDE_SCHEMA)) {
  72 + Logger.debug(TAG, 'flushMessageQueue');
45 this.webviewControl.flushMessageQueue() 73 this.webviewControl.flushMessageQueue()
46 return true 74 return true
47 } 75 }
48 - return false 76 + return this.onLoadIntercept(event.data.getRequestUrl().toString());
49 }) 77 })
50 } 78 }
51 } 79 }
  80 +
  81 + private registerHandlers(): void {
  82 + // TODO 待优化
  83 + H5CallNativeType.init();
  84 + // 注册h5调用js相关
  85 + for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) {
  86 + let handleName = H5CallNativeType.JsCallTypeList[i];
  87 + let handle = (data: Message, f: Callback) => {
  88 + this.defaultPerformJSCallNative(data, f)
  89 + } ;
  90 + this.webviewControl.registerHandler(handleName, { handle: handle });
  91 + }
  92 + // // TODO test
  93 + // this.webviewControl.registerHandler('changeNativeMessage', {
  94 + // handle: (data: Message, f: Callback) => {
  95 + // this.defaultPerformJSCallNative(data, f)
  96 + // }
  97 + // });
  98 +
  99 + }
  100 +
  101 + /**
  102 + * 默认【CallNative】逻辑处理
  103 + */
  104 + private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => {
  105 + performJSCallNative(data, f)
  106 + }
  107 + onPageBegin: (url?: string) => void = () => {
  108 + Logger.debug(TAG, 'onPageBegin');
  109 + }
  110 + onPageEnd: (url?: string) => void = () => {
  111 + Logger.debug(TAG, 'onPageEnd');
  112 + }
  113 + onLoadIntercept: (url?: string) => boolean = () => {
  114 + Logger.debug(TAG, 'onPageBegin return false');
  115 + return false
  116 + }
52 } 117 }
53 118
@@ -36,7 +36,8 @@ export { @@ -36,7 +36,8 @@ export {
36 postExecuteLikeParams, 36 postExecuteLikeParams,
37 postExecuteCollectRecordParams, 37 postExecuteCollectRecordParams,
38 contentListParams, 38 contentListParams,
39 - postInteractAccentionOperateParams 39 + postInteractAccentionOperateParams,
  40 + postRecommendListParams
40 } from './src/main/ets/bean/detail/MultiPictureDetailPageDTO'; 41 } from './src/main/ets/bean/detail/MultiPictureDetailPageDTO';
41 42
42 export { InteractParam, ContentBean } from './src/main/ets/bean/content/InteractParam'; 43 export { InteractParam, ContentBean } from './src/main/ets/bean/content/InteractParam';
@@ -51,6 +52,8 @@ export { GroupDTO } from './src/main/ets/bean/component/GroupDTO'; @@ -51,6 +52,8 @@ export { GroupDTO } from './src/main/ets/bean/component/GroupDTO';
51 52
52 export { CompDTO } from './src/main/ets/bean/component/CompDTO'; 53 export { CompDTO } from './src/main/ets/bean/component/CompDTO';
53 54
  55 +export { LiveReviewDTO } from './src/main/ets/bean/component/LiveReviewDTO';
  56 +
54 export { NewspaperListBean } from './src/main/ets/bean/newspaper/NewspaperListBean'; 57 export { NewspaperListBean } from './src/main/ets/bean/newspaper/NewspaperListBean';
55 58
56 export { NewspaperListItemBean } from './src/main/ets/bean/newspaper/NewspaperListItemBean'; 59 export { NewspaperListItemBean } from './src/main/ets/bean/newspaper/NewspaperListItemBean';
@@ -79,6 +82,8 @@ export { ShareInfoDTO } from './src/main/ets/bean/detail/ShareInfoDTO'; @@ -79,6 +82,8 @@ export { ShareInfoDTO } from './src/main/ets/bean/detail/ShareInfoDTO';
79 82
80 export { VideoInfoDTO } from './src/main/ets/bean/detail/VideoInfoDTO'; 83 export { VideoInfoDTO } from './src/main/ets/bean/detail/VideoInfoDTO';
81 84
  85 +export { AttentionRmhInfoDTO } from './src/main/ets/bean/detail/AttentionRmhInfoDTO';
  86 +
82 export { H5ReceiveDetailBean } from './src/main/ets/bean/h5/H5ReceiveDetailBean'; 87 export { H5ReceiveDetailBean } from './src/main/ets/bean/h5/H5ReceiveDetailBean';
83 88
84 export { H5ReceiveDataJsonBean } from './src/main/ets/bean/h5/H5ReceiveDataJsonBean'; 89 export { H5ReceiveDataJsonBean } from './src/main/ets/bean/h5/H5ReceiveDataJsonBean';
@@ -105,4 +110,13 @@ export { OperDataList } from './src/main/ets/bean/morningevening/OperDataList'; @@ -105,4 +110,13 @@ export { OperDataList } from './src/main/ets/bean/morningevening/OperDataList';
105 110
106 export { ShareInfo } from './src/main/ets/bean/morningevening/ShareInfo'; 111 export { ShareInfo } from './src/main/ets/bean/morningevening/ShareInfo';
107 112
108 -export { slideShows } from './src/main/ets/bean/morningevening/slideShows';  
  113 +export { slideShows } from './src/main/ets/bean/morningevening/slideShows';
  114 +
  115 +export { LiveDetailsBean } from './src/main/ets/bean/live/LiveDetailsBean';
  116 +
  117 +export { ArticleListDTO } from './src/main/ets/bean/component/ArticleListDTO';
  118 +
  119 +export { appStyleImagesDTO } from './src/main/ets/bean/content/appStyleImagesDTO';
  120 +
  121 +export { LiveRoomBean,LiveRoomItemBean } from './src/main/ets/bean/live/LiveRoomBean';
  122 +
  1 +/**
  2 + * http://192.168.1.3:3300/project/3856/interface/api/190567
  3 + * 接口名称:客户端 客态主页页面-获取作品-从发布库获取该创作者下 稿件列表
  4 + * 接口路径:GET/zh/c/article/articleList
  5 + * 人民号-动态tab下列表数据
  6 + */
  7 +import { appStyleImagesDTO } from '../content/appStyleImagesDTO'
  8 +import {contentVideosDTO} from '../content/contentVideosDTO'
  9 +export interface ArticleListDTO {
  10 + listTitle: string;
  11 + mainPicCount: string;
  12 + videosCount: string;
  13 + voicesCount: string;
  14 + landscape: number;
  15 + sourceName: string;
  16 + finalStatus: string;
  17 + score: string;
  18 + shareUrl: string;
  19 + sortPosId: string;
  20 + id: string;
  21 + serialsId: string;
  22 + oldContentId: string;
  23 + type: string;
  24 + tenancy: string;
  25 + clientPubFlag: string;
  26 + grayScale: string;
  27 + title: string
  28 + publishType: string;
  29 + publishTime: string;
  30 + firstPublishTime: string;
  31 + onlineStatus: string;
  32 + auditingStatus: string;
  33 + zhOnlineStatus: string;
  34 + zhAuditingStatus: string;
  35 + selectedStatus: string;
  36 + qualityScore: string;
  37 + levelScore: number;
  38 + isOrg: string;
  39 + articlePayment: number;
  40 + appStyle: number;
  41 + appStyleImages: appStyleImagesDTO[];
  42 + description: string;
  43 + introduction: string;
  44 + deleted: string;
  45 + keyArticle: string;
  46 + updateTime: string;
  47 + createTime: string;
  48 + createUserId: string;
  49 + createUserName: string;
  50 + creatorId: number;
  51 + creatorName: string;
  52 + articleExistVote: string;
  53 + rmhPlatform: string;
  54 + objectPos: string;
  55 + objectPosPictures: string;
  56 + shareFlag: string;
  57 + firstPublish: string;
  58 + readNum: string;
  59 + readFlag: string;
  60 + creatorLevel: string;
  61 + creatorTag: string;
  62 + joinActivity: string;
  63 + userType: string;
  64 + content: object;
  65 + contentShare: [];
  66 + contentLinkData: string;
  67 + contentExt: [];
  68 + contentVideos: contentVideosDTO[];
  69 + contentPictures: [];
  70 + contentPayments: string;
  71 + contentPaymentStaffs: string;
  72 + contentTxt: [];
  73 + contentSource: object;
  74 + contentTags: string;
  75 + contentVoices: string;
  76 + contentAuthorLocals: string;
  77 + contentEpaperArticle: string;
  78 + contentStatistics: string;
  79 + topicExistHeadImage: string;
  80 + topicComps: string;
  81 + live: string;
  82 + statusInfo: string;
  83 + askInfo: string;
  84 + askAttachmentList: string;
  85 + askAnswerList: string;
  86 + askFeedbackList: string;
  87 + ttopicInteracts: string;
  88 + ttopic: string;
  89 + mlive: string;
  90 + vlives: string
  91 +}
  1 +import { ContentDTO } from '../content/ContentDTO';
  2 +
  3 +export interface LiveReviewDTO {
  4 + hasNext: boolean;
  5 + pageNum: number;
  6 + pageSize: number;
  7 + totalCount: number;
  8 + list: ContentDTO[];
  9 +}
@@ -4,7 +4,7 @@ import { VideoInfoDTO } from '../detail/VideoInfoDTO'; @@ -4,7 +4,7 @@ import { VideoInfoDTO } from '../detail/VideoInfoDTO';
4 import { InteractDataDTO } from './InteractDataDTO'; 4 import { InteractDataDTO } from './InteractDataDTO';
5 import { slideShows } from '../morningevening/slideShows'; 5 import { slideShows } from '../morningevening/slideShows';
6 import { VoiceInfoDTO } from '../detail/VoiceInfoDTO'; 6 import { VoiceInfoDTO } from '../detail/VoiceInfoDTO';
7 - 7 +import { RmhInfoDTO } from '../detail/RmhInfoDTO'
8 export interface ContentDTO { 8 export interface ContentDTO {
9 appStyle: string; 9 appStyle: string;
10 cityCode: string; 10 cityCode: string;
@@ -67,4 +67,8 @@ export interface ContentDTO { @@ -67,4 +67,8 @@ export interface ContentDTO {
67 voiceInfo: VoiceInfoDTO, 67 voiceInfo: VoiceInfoDTO,
68 tagWord: number, 68 tagWord: number,
69 isSelect: boolean; 69 isSelect: boolean;
  70 + rmhInfo: RmhInfoDTO; // 人民号信息
  71 + photoNum: number;
  72 +
  73 +
70 } 74 }
  1 +export interface appStyleImagesDTO {
  2 + url: string;
  3 + bucket: string;
  4 + landscape: number;
  5 + sort: number;
  6 + height: number;
  7 + weight: number;
  8 + size: number;
  9 + format: number;
  10 + fullUrl: string
  11 +}
  1 +export interface contentVideosDTO {
  2 + id: number;
  3 + contentId: number;
  4 + ossVideoId: string;
  5 + url: string;
  6 + fullUrl: string;
  7 + bucket: string;
  8 + duration: number;
  9 + clarity: number;
  10 + resolutionWidth: number;
  11 + resolutionHeight: number;
  12 + type: number;
  13 + original: number;
  14 + originalVideoId: string;
  15 + landscape: number;
  16 + size: number;
  17 + templateId: string;
  18 + deleted: number;
  19 + coverPictureId: string;
  20 + framePictureId: string;
  21 + createUser: string;
  22 + createTime: string;
  23 + updateUser: string;
  24 + updateTime: string;
  25 + bak1: string;
  26 + bak2: string;
  27 + bak3: string;
  28 + bak4: string;
  29 + videoType: number;
  30 + objectPosId: string;
  31 +}
  1 +export interface AttentionRmhInfoDTO {
  2 + attentionCreatorId: string;
  3 + attentionHeadPhotoUrl: string;
  4 + attentionNum: number;
  5 + attentionUserId: string;
  6 + attentionUserName: string;
  7 + attentionUserType: number;
  8 + authIcon: string;
  9 + authId: number;
  10 + authPersional: string;
  11 + authTitle: string;
  12 + banControl: number;
  13 + categoryAuth: string;
  14 + cnLiveCommentControl: number;
  15 + cnLiveGiftControl: number;
  16 + cnLiveLikeControl: number;
  17 + cnLiveShareControl: number;
  18 + cnShareControl: number;
  19 + collectNum: number;
  20 + commentNum: number;
  21 + createTime: number;
  22 + fansNum: number;
  23 + honoraryIcon: string;
  24 + honoraryTitle: string;
  25 + id: number;
  26 + introduction: string;
  27 + isAttention: number | null;
  28 + isComment: number;
  29 + isLike: number;
  30 + isVisiable: number;
  31 + likeNum: number;
  32 + liveCommentControl: number;
  33 + liveGiftControl: number;
  34 + liveLikeControl: number;
  35 + liveShareControl: number;
  36 + mainControl: number;
  37 + posterShareControl: number;
  38 + registTime: number;
  39 + shareControl: number;
  40 + shareNum: number;
  41 + status: number;
  42 + subjectType: string;
  43 + updateTime: number;
  44 + userId: string;
  45 + userType: number
  46 +}
@@ -3,6 +3,7 @@ export interface FullColumnImgUrlDTO { @@ -3,6 +3,7 @@ export interface FullColumnImgUrlDTO {
3 height: number; 3 height: number;
4 landscape: number; 4 landscape: number;
5 size: number | null; 5 size: number | null;
6 - url: string; 6 + url: string; // 图片地址--列表显示
7 weight: number; 7 weight: number;
  8 + fullUrl: string; // 图片地址--预览地址使用;【人民号动态卡预览】
8 } 9 }
@@ -177,4 +177,14 @@ export interface postInteractAccentionOperateParams { @@ -177,4 +177,14 @@ export interface postInteractAccentionOperateParams {
177 // userType: number; 177 // userType: number;
178 // userId: string; 178 // userId: string;
179 status: number; 179 status: number;
  180 +}
  181 +
  182 +export interface postRecommendListParams {
  183 + imei: string;
  184 + userId ?: string;
  185 + contentId ?: string;
  186 + relId ?: string;
  187 + contentType ?: number;
  188 + recType: number;
  189 + channelId ? : string
180 } 190 }
@@ -3,11 +3,11 @@ export interface RmhInfoDTO { @@ -3,11 +3,11 @@ export interface RmhInfoDTO {
3 authTitle: string; 3 authTitle: string;
4 authTitle2: string; 4 authTitle2: string;
5 banControl: number; 5 banControl: number;
6 - cnAttention: number; 6 + cnIsAttention: number;
7 cnMainControl: number; 7 cnMainControl: number;
8 cnShareControl: number; 8 cnShareControl: number;
9 - cnlsComment: number;  
10 - cnlsLike: number; 9 + cnIsComment: number;
  10 + cnIsLike: number;
11 posterShareControl: number; 11 posterShareControl: number;
12 rmhDesc: string; 12 rmhDesc: string;
13 rmhHeadUrl: string; 13 rmhHeadUrl: string;
@@ -4,6 +4,7 @@ export interface VideoInfoDTO { @@ -4,6 +4,7 @@ export interface VideoInfoDTO {
4 resolutionWidth: number; 4 resolutionWidth: number;
5 videoDuration: number; // 视频时长 5 videoDuration: number; // 视频时长
6 videoLandScape: number; // 1横屏 2竖屏 6 videoLandScape: number; // 1横屏 2竖屏
  7 + videoLandscape: number; // 1横屏 2竖屏
7 videoType: number; 8 videoType: number;
8 videoUrl: string; //视频播放地址 9 videoUrl: string; //视频播放地址
9 firstFrameImageUri: string; // 首帧图;【视频内容,contentPictures中】 10 firstFrameImageUri: string; // 首帧图;【视频内容,contentPictures中】
@@ -10,7 +10,7 @@ export interface ResponseBean{ @@ -10,7 +10,7 @@ export interface ResponseBean{
10 message: string; 10 message: string;
11 11
12 // 响应结果 12 // 响应结果
13 - data:ContentDetailDTO; 13 + data:ContentDetailDTO[];
14 14
15 // 请求响应时间戳(unix格式) 15 // 请求响应时间戳(unix格式)
16 timestamp?: number; 16 timestamp?: number;
  1 +export interface LiveDetailsBean {
  2 + /**
  3 + * {
  4 + "code": "0",
  5 + "data": [
  6 + {
  7 + "activityInfos": [],
  8 + "appstyle": 2,
  9 + "audioList": [],
  10 + "authorList": [
  11 + {
  12 + "authorName": "雷崔捷"
  13 + }
  14 + ],
  15 + "bestNoticer": null,
  16 + "commentDisplay": 0,
  17 + "editorName": "",
  18 + "firstFrameImageUri": "",
  19 + "fullColumnImgUrls": [
  20 + {
  21 + "format": null,
  22 + "height": null,
  23 + "landscape": null,
  24 + "size": null,
  25 + "url": "https://rmrbcmsonline.peopleapp.com/upload/image/202404/rmrb_71671711971849.png",
  26 + "weight": null
  27 + }
  28 + ],
  29 + "hasPopUp": null,
  30 + "isNewspaper": false,
  31 + "itemId": "",
  32 + "itemTypeCode": "",
  33 + "keyArticle": 0,
  34 + "likesStyle": null,
  35 + "liveInfo": {
  36 + "background": {
  37 + "imageUrl": "",
  38 + "name": ""
  39 + },
  40 + "backgroundStyle": null,
  41 + "cornerFlag": 0,
  42 + "cornerImgUrl": "",
  43 + "cornerLinkUrl": "",
  44 + "createUserId": "",
  45 + "createUserName": "",
  46 + "endTime": "2024-04-03 11:08:00",
  47 + "handAngleImageUri": "",
  48 + "handAngleLink": "",
  49 + "handAngleSwitch": false,
  50 + "likeEnable": 1,
  51 + "likesStyle": "thumb",
  52 + "liveExperience": 1,
  53 + "liveExperienceTime": 3,
  54 + "liveLandScape": "news",
  55 + "liveState": "end",
  56 + "liveStyle": 0,
  57 + "liveWay": 0,
  58 + "mlive": {
  59 + "barrageShowEnable": false,
  60 + "giftEnable": false,
  61 + "mliveId": 20000016257,
  62 + "roomId": "5381b934-cea8-4338-bd12-5bf70af43e0c"
  63 + },
  64 + "notice": "",
  65 + "openComment": 1,
  66 + "padImageUri": "",
  67 + "planStartTime": "2024-04-03 05:00:00",
  68 + "playbackSwitch": true,
  69 + "preCommentFlag": 1,
  70 + "previewType": 1,
  71 + "previewUrl": "",
  72 + "shareSwitch": "",
  73 + "startTime": "2024-04-03 05:03:23",
  74 + "tplId": 5,
  75 + "vlive": [
  76 + {
  77 + "coverImageUrl": "",
  78 + "definition": [],
  79 + "liveStreamManagerId": null,
  80 + "liveStreamType": 1,
  81 + "liveUrl": "https://plwbthird.live.weibo.com/alicdn/5018938748437049.m3u8",
  82 + "name": "线路1",
  83 + "replayUri": "http://mlive3.video.weibocdn.com/record/alicdn/5018726527666338/index.m3u8",
  84 + "serialNum": null,
  85 + "shiftEnable": false,
  86 + "showPad": false,
  87 + "type": "play",
  88 + "vliveId": 186728
  89 + }
  90 + ],
  91 + "vrType": 0
  92 + },
  93 + "menuShow": 1,
  94 + "newIntroduction": "眼前有山河,心中有家国!每年清明节前夕,宁夏固原市第二中学和固原市弘文中学会组织入学新生,一天之内徒步54公里从学校往返任山河烈士陵园,用这种方式缅怀烈士们,这份坚定与执着已经延续了29年。",
  95 + "newLinkObject": null,
  96 + "newsBodyTitle": "",
  97 + "newsContent": "",
  98 + "newsContentBak": "",
  99 + "newsDownTitle": "",
  100 + "newsId": 20000016229,
  101 + "newsLinkUrl": "",
  102 + "newsShortTitle": "",
  103 + "newsSource": "41",
  104 + "newsSourceName": "",
  105 + "newsSummary": "",
  106 + "newsTags": "",
  107 + "newsTitle": "徒步54公里的思政课,坚守29年的薪火传承",
  108 + "newsType": 2,
  109 + "oldNewsId": "7218507",
  110 + "openAudio": 0,
  111 + "openComment": null,
  112 + "openLikes": null,
  113 + "photoList": [],
  114 + "popUps": [],
  115 + "preCommentFlag": null,
  116 + "publishTime": "2024-04-01 19:44:00",
  117 + "reLInfo": {
  118 + "channelId": 2061,
  119 + "relId": "500005272745",
  120 + "relObjectId": 2061,
  121 + "relType": "1"
  122 + },
  123 + "readFlag": 0,
  124 + "recommendShow": null,
  125 + "rmhInfo": null,
  126 + "rmhPlatform": 0,
  127 + "sceneId": "",
  128 + "serials": null,
  129 + "shareInfo": {
  130 + "shareCoverUrl": "https://rmrbcmsonline.peopleapp.com/upload/image/202404/202404011944259539.png?x-oss-process=image/resize,w_400",
  131 + "shareOpen": 1,
  132 + "sharePosterCoverUrl": "https://rmrbcmsonline.peopleapp.com/upload/image/202404/rmrb_71671711971849.png?x-oss-process=image/resize,m_fill,h_450,w_800,limit_0/quality,q_90",
  133 + "sharePosterOpen": 1,
  134 + "shareSummary": "人民日报,有品质的新闻",
  135 + "shareTitle": "徒步54公里的思政课,坚守29年的薪火传承",
  136 + "shareUrl": "https://people.pdnews.cn/column/20000016229-500005272745"
  137 + },
  138 + "specialColumnId": null,
  139 + "specialColumnName": "",
  140 + "subSceneId": "",
  141 + "timeline": null,
  142 + "topicInfo": null,
  143 + "traceId": "",
  144 + "traceInfo": "",
  145 + "userInfo": null,
  146 + "videoInfo": [],
  147 + "viewCount": 0,
  148 + "visitorComment": 1,
  149 + "voteInfo": null
  150 + }
  151 + ],
  152 + "message": "Success",
  153 + "meta": null,
  154 + "requestId": "",
  155 + "success": true,
  156 + "timestamp": 1712807514322
  157 + }
  158 + */
  159 + liveInfo: LiveInfo
  160 + fullColumnImgUrls: Array<FullColumnImgUrls>
  161 + vlive: Array<Vlive>
  162 + newsTitle: string
  163 + newIntroduction: string
  164 +}
  165 +
  166 +export interface LiveInfo {
  167 + //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
  168 + liveState: string
  169 + //2024-04-12 15:00:00 直播开始时间
  170 + planStartTime: string
  171 +}
  172 +
  173 +export interface FullColumnImgUrls {
  174 + url: string
  175 +}
  176 +
  177 +export interface Vlive {
  178 + //拉流直播 url
  179 + liveUrl: string
  180 + //直播回看地址,多路直播录制文件URL
  181 + replayUri: string
  182 +}
  1 +export interface LiveRoomBean {
  2 + pageNum: number
  3 + pageSize: number
  4 + totalCount: number
  5 + barrageResponses: Array<LiveRoomItemBean>
  6 +}
  7 +
  8 +export interface LiveRoomItemBean {
  9 + text: string
  10 + senderUserAvatarUrl: string
  11 + senderUserName: string
  12 + pictureUrls: string[]
  13 + time: string
  14 + //1上墙0未上墙
  15 + isWall: number
  16 + //是否置顶 1置顶0不置顶
  17 + isTop: number
  18 + role: string
  19 +}
@@ -34,7 +34,8 @@ export { ENewspaperItemComponent } from "./src/main/ets/components/ENewspaperIte @@ -34,7 +34,8 @@ export { ENewspaperItemComponent } from "./src/main/ets/components/ENewspaperIte
34 34
35 export { ENewspaperListDialog } from "./src/main/ets/dialog/ENewspaperListDialog" 35 export { ENewspaperListDialog } from "./src/main/ets/dialog/ENewspaperListDialog"
36 36
37 -export { MorningEveningPaperComponent } from "./src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent" 37 +export { MorningEveningPaperComponent
  38 +} from "./src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent"
38 39
39 export { ImageAndTextPageComponent } from "./src/main/ets/components/ImageAndTextPageComponent" 40 export { ImageAndTextPageComponent } from "./src/main/ets/components/ImageAndTextPageComponent"
40 41
@@ -62,3 +63,4 @@ export { FirstTabTopSearchComponent } from "./src/main/ets/components/search/Fir @@ -62,3 +63,4 @@ export { FirstTabTopSearchComponent } from "./src/main/ets/components/search/Fir
62 63
63 export { ListHasNoMoreDataUI } from "./src/main/ets/components/reusable/ListHasNoMoreDataUI" 64 export { ListHasNoMoreDataUI } from "./src/main/ets/components/reusable/ListHasNoMoreDataUI"
64 65
  66 +export { LottieView } from './src/main/ets/lottie/LottieView'
@@ -7,13 +7,16 @@ @@ -7,13 +7,16 @@
7 "main": "Index.ets", 7 "main": "Index.ets",
8 "version": "1.0.0", 8 "version": "1.0.0",
9 "dependencies": { 9 "dependencies": {
  10 + "@ohos/lottie": "2.0.0",
10 "wdConstant": "file:../../commons/wdConstant", 11 "wdConstant": "file:../../commons/wdConstant",
11 "wdPlayer": "file:../../features/wdPlayer", 12 "wdPlayer": "file:../../features/wdPlayer",
12 "wdLogin": "file:../../features/wdLogin", 13 "wdLogin": "file:../../features/wdLogin",
13 "wdKit": "file:../../commons/wdKit", 14 "wdKit": "file:../../commons/wdKit",
14 "wdWebComponent": "file:../../commons/wdWebComponent", 15 "wdWebComponent": "file:../../commons/wdWebComponent",
15 "wdBean": "file:../../features/wdBean", 16 "wdBean": "file:../../features/wdBean",
  17 + "wdDetailPlayShortVideo": "file:../../features/wdDetailPlayShortVideo",
16 "wdRouter": "file:../../commons/wdRouter", 18 "wdRouter": "file:../../commons/wdRouter",
17 - "wdNetwork": "file:../../commons/wdNetwork" 19 + "wdNetwork": "file:../../commons/wdNetwork",
  20 + "wdJsBridge": "file:../../commons/wdJsBridge"
18 } 21 }
19 } 22 }
@@ -9,6 +9,9 @@ import { Card9Component } from './cardview/Card9Component'; @@ -9,6 +9,9 @@ import { Card9Component } from './cardview/Card9Component';
9 import { Card10Component } from './cardview/Card10Component'; 9 import { Card10Component } from './cardview/Card10Component';
10 import { Card11Component } from './cardview/Card11Component'; 10 import { Card11Component } from './cardview/Card11Component';
11 import { Card17Component } from './cardview/Card17Component'; 11 import { Card17Component } from './cardview/Card17Component';
  12 +import { Card15Component } from './cardview/Card15Component';
  13 +import { Card19Component } from './cardview/Card19Component';
  14 +import { Card20Component } from './cardview/Card20Component';
12 15
13 /** 16 /**
14 * card适配器,卡片样式汇总,依据ContentDTO#appStyle 17 * card适配器,卡片样式汇总,依据ContentDTO#appStyle
@@ -41,8 +44,14 @@ export struct CardParser { @@ -41,8 +44,14 @@ export struct CardParser {
41 Card10Component({ contentDTO }) 44 Card10Component({ contentDTO })
42 } else if (contentDTO.appStyle === CompStyle.Card_11) { 45 } else if (contentDTO.appStyle === CompStyle.Card_11) {
43 Card11Component({ contentDTO }) 46 Card11Component({ contentDTO })
  47 + } else if (contentDTO.appStyle === CompStyle.Card_15) {
  48 + Card15Component({ contentDTO })
44 } else if (contentDTO.appStyle === CompStyle.Card_17) { 49 } else if (contentDTO.appStyle === CompStyle.Card_17) {
45 Card17Component({ contentDTO }) 50 Card17Component({ contentDTO })
  51 + } else if (contentDTO.appStyle === CompStyle.Card_19) {
  52 + Card19Component({ contentDTO })
  53 + } else if (contentDTO.appStyle === CompStyle.Card_20) {
  54 + Card20Component({ contentDTO })
46 } 55 }
47 else { 56 else {
48 // todo:组件未实现 / Component Not Implemented 57 // todo:组件未实现 / Component Not Implemented
1 -import { CompDTO} from 'wdBean'; 1 +import { CompDTO } from 'wdBean';
2 import { CommonConstants, CompStyle } from 'wdConstant'; 2 import { CommonConstants, CompStyle } from 'wdConstant';
3 import { BannerComponent } from './view/BannerComponent'; 3 import { BannerComponent } from './view/BannerComponent';
4 import { LabelComponent } from './view/LabelComponent'; 4 import { LabelComponent } from './view/LabelComponent';
@@ -9,11 +9,15 @@ import { @@ -9,11 +9,15 @@ import {
9 import { 9 import {
10 HorizontalStrokeCardThreeTwoRadioForOneComponent 10 HorizontalStrokeCardThreeTwoRadioForOneComponent
11 } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent'; 11 } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';
12 -import { ZhSingleRow04 } from './compview/ZhSingleRow04'  
13 -import { ZhSingleColumn04 } from './compview/ZhSingleColumn04'  
14 -import { ZhSingleColumn05 } from './compview/ZhSingleColumn05'  
15 -import { ZhGridLayout03 } from './compview/ZhGridLayout03' 12 +import { ZhSingleRow04 } from './compview/ZhSingleRow04';
  13 +import { ZhSingleColumn04 } from './compview/ZhSingleColumn04';
  14 +import { ZhSingleColumn05 } from './compview/ZhSingleColumn05';
  15 +import { ZhGridLayout03 } from './compview/ZhGridLayout03';
16 import { CardParser } from './CardParser'; 16 import { CardParser } from './CardParser';
  17 +import { LiveHorizontalReservationComponent } from './view/LiveHorizontalReservationComponent';
  18 +import { ZhGridLayout02 } from './compview/ZhGridLayout02';
  19 +import { Card5Component } from './cardview/Card5Component'
  20 +
17 /** 21 /**
18 * comp适配器. 22 * comp适配器.
19 * 首页楼层comp解析器. 23 * 首页楼层comp解析器.
@@ -42,16 +46,23 @@ export struct CompParser { @@ -42,16 +46,23 @@ export struct CompParser {
42 } else { 46 } else {
43 HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO }) 47 HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO })
44 } 48 }
  49 + } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) {
  50 + LiveHorizontalReservationComponent({ compDTO: compDTO })
  51 + } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) {
  52 + ZhGridLayout02({ compDTO: compDTO })
45 } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { 53 } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) {
46 ZhGridLayout03({ compDTO: compDTO }) 54 ZhGridLayout03({ compDTO: compDTO })
47 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) { 55 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) {
48 - ZhSingleRow04({ compDTO: compDTO}) 56 + ZhSingleRow04({ compDTO: compDTO })
  57 + } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
  58 + //头图卡 和comStyle 2相同,
  59 + Card5Component({ contentDTO: compDTO.operDataList[0] })
49 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) { 60 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) {
50 - ZhSingleColumn04({ compDTO: compDTO}) 61 + ZhSingleColumn04({ compDTO: compDTO })
51 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) { 62 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) {
52 - ZhSingleColumn05({ compDTO: compDTO}) 63 + ZhSingleColumn05({ compDTO: compDTO })
53 } else if (!Number.isNaN(Number(compDTO.compStyle))) { 64 } else if (!Number.isNaN(Number(compDTO.compStyle))) {
54 - CardParser({ contentDTO: compDTO.operDataList[0]}); 65 + CardParser({ contentDTO: compDTO.operDataList[0] });
55 } 66 }
56 else { 67 else {
57 // todo:组件未实现 / Component Not Implemented 68 // todo:组件未实现 / Component Not Implemented
1 -import { Action, ContentDetailDTO } from 'wdBean'; 1 +import { Logger, NumberFormatterUtils } from 'wdKit';
  2 +import {
  3 + Action,
  4 + ContentDetailDTO,
  5 + ContentDTO,
  6 + postRecommendListParams,
  7 + postExecuteLikeParams,
  8 + batchLikeAndCollectResult,
  9 + batchLikeAndCollectParams,
  10 + InteractDataDTO,
  11 + contentListParams,
  12 +} from 'wdBean';
2 import DetailViewModel from '../viewmodel/DetailViewModel'; 13 import DetailViewModel from '../viewmodel/DetailViewModel';
3 import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; 14 import { ImageAndTextWebComponent } from './ImageAndTextWebComponent';
4 import router from '@ohos.router'; 15 import router from '@ohos.router';
  16 +import { RecommendList } from '../components/view/RecommendList'
  17 +import { CommonConstants } from 'wdConstant'
  18 +import { HttpUrlUtils } from 'wdNetwork/Index';
  19 +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
  20 +import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
  21 +import { PageRepository } from '../repository/PageRepository';
  22 +
  23 +const TAG = 'ImageAndTextPageComponent'
  24 +
  25 +export interface OperationItem {
  26 + icon: Resource;
  27 + icon_check?: Resource;
  28 + text: string | Resource;
  29 + num?: number; // 个数
  30 +}
5 31
6 @Component 32 @Component
7 export struct ImageAndTextPageComponent { 33 export struct ImageAndTextPageComponent {
8 scroller: Scroller = new Scroller(); 34 scroller: Scroller = new Scroller();
9 action: Action = {} as Action 35 action: Action = {} as Action
10 - @State detailData: ContentDetailDTO = {} as ContentDetailDTO 36 + @State contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO []
  37 + @State recommendList: ContentDTO[] = []
  38 + @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
  39 + @State interactData: InteractDataDTO = {} as InteractDataDTO
11 40
12 build() { 41 build() {
13 - RelativeContainer() {  
14 - RelativeContainer() {  
15 - Text(this.detailData?.publishTime)  
16 - .fontColor($r('app.color.color_B0B0B0'))  
17 - .fontSize($r('app.float.font_size_13'))  
18 - .id('date')  
19 - .alignRules({ right: { anchor: "__container__", align: HorizontalAlign.End },  
20 - center:{anchor: "__container__", align:VerticalAlign.Center}})  
21 - 42 + Column() {
  43 + // 发布时间
  44 + Row() {
22 Image($r('app.media.icon_ren_min_ri_bao')) 45 Image($r('app.media.icon_ren_min_ri_bao'))
23 .width(70) 46 .width(70)
24 .height(28) 47 .height(28)
25 - .alignRules({ left: { anchor: "__container__", align: HorizontalAlign.Start },  
26 - center: { anchor: "__container__", align: VerticalAlign.Center } }) 48 + Text(this.contentDetailData[0]?.publishTime)
  49 + .fontColor($r('app.color.color_B0B0B0'))
  50 + .fontSize($r('app.float.font_size_13'))
  51 + .height('100%')
  52 + .align(Alignment.End)
27 } 53 }
  54 + .width(CommonConstants.FULL_WIDTH)
28 .height(32) 55 .height(32)
29 - .width('100%')  
30 - .id('image_text_detail_top')  
31 - .alignRules({ top: { anchor: "__container__", align: VerticalAlign.Top } })  
32 - .visibility(Visibility.None)  
33 -  
34 - Image($r('app.media.line'))  
35 - .width('100%')  
36 - .height(6)  
37 - .objectFit(ImageFit.Contain)  
38 - .id('image_text_detail_top_line')  
39 - .alignRules({ top: { anchor: "image_text_detail_top", align: VerticalAlign.Bottom } })  
40 - .margin({ top: 10 })  
41 - .visibility(Visibility.Hidden)  
42 -  
43 - RelativeContainer() {  
44 - Image($r('app.media.icon_arrow_left'))  
45 - .width(24)  
46 - .height(24)  
47 - .id('back')  
48 - .alignRules({ left: { anchor: "__container__", align: HorizontalAlign.Start },  
49 - center: { anchor: "__container__", align: VerticalAlign.Center } })  
50 - .onClick((event: ClickEvent) => {  
51 - router.back()  
52 - })  
53 -  
54 - Image($r('app.media.icon_forward'))  
55 - .width(24)  
56 - .height(24)  
57 - .id('forward')  
58 - .alignRules({ right: { anchor: "__container__", align: HorizontalAlign.End },  
59 - center: { anchor: "back", align: VerticalAlign.Center } })  
60 -  
61 - Image($r('app.media.icon_listen'))  
62 - .width(24)  
63 - .height(24)  
64 - .margin({ right: 24 })  
65 - .id('listen')  
66 - .alignRules({ right: { anchor: "forward", align: HorizontalAlign.Start },  
67 - center: { anchor: "back", align: VerticalAlign.Center } })  
68 -  
69 - Image($r('app.media.icon_star'))  
70 - .width(24)  
71 - .height(24)  
72 - .margin({ right: 24 })  
73 - .id('star')  
74 - .alignRules({ right: { anchor: "listen", align: HorizontalAlign.Start },  
75 - center: { anchor: "back", align: VerticalAlign.Center } })  
76 -  
77 - Image($r('app.media.icon_comment'))  
78 - .width(24)  
79 - .height(24)  
80 - .margin({ right: 24 })  
81 - .id('comment')  
82 - .alignRules({ right: { anchor: "star", align: HorizontalAlign.Start },  
83 - center: { anchor: "back", align: VerticalAlign.Center } }) 56 + .padding({ left: 15, right: 15, })
  57 + .justifyContent(FlexAlign.SpaceBetween)
  58 + .backgroundColor(Color.White)
84 59
  60 + Row() {
  61 + Image($r('app.media.line'))
  62 + .width('100%')
  63 + .height(6)
  64 + .objectFit(ImageFit.Cover)
  65 + .margin({ top: 10 })
85 } 66 }
86 - .width('100%')  
87 - .height(56)  
88 - .id('image_text_detail_bottom')  
89 - .alignRules({ bottom: { anchor: "__container__", align: VerticalAlign.Bottom } }) 67 + .padding({ left: 15, right: 15, })
  68 + .backgroundColor(Color.White)
90 69
91 - Column() {  
92 - ImageAndTextWebComponent({ detailData: this.detailData, action: this.action })  
93 - }  
94 - .width('100%')  
95 - .alignRules({ top: { anchor: "image_text_detail_top_line", align: VerticalAlign.Bottom },  
96 - bottom: { anchor: "image_text_detail_bottom", align: VerticalAlign.Top } })  
97 - .id('image_text_detail_content') 70 + Stack({ alignContent: Alignment.Bottom }) {
  71 + List() {
  72 + //详情展示区
  73 + ListItem() {
  74 + Column() {
  75 + ImageAndTextWebComponent({
  76 + contentDetailData: this.contentDetailData,
  77 + action: this.action,
  78 + })
  79 + }.width(CommonConstants.FULL_WIDTH)
  80 + .height(CommonConstants.FULL_HEIGHT)
  81 + }
98 82
99 - }  
100 - .width('100%')  
101 - .height('100%')  
102 - .padding({ left: 16, right: 16 }) 83 + if (this.contentDetailData[0]?.openLikes === 1) {
  84 + ListItem() {
  85 + // 点赞
  86 + Row() {
  87 + Row() {
  88 + if (this.newsStatusOfUser?.likeStatus === '1') {
  89 + Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : $r('app.media.icon_candle_active')))
  90 + .width(24)
  91 + .height(24)
  92 + .margin({ right: 5 })
  93 + } else {
  94 + Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : $r('app.media.icon_candle')))
  95 + .width(24)
  96 + .height(24)
  97 + .margin({ right: 5 })
  98 + }
  99 + Text(`${this.interactData?.likeNum || 0}`)
  100 + .fontSize(16)
  101 + .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')
  102 + .fontWeight(500)
  103 + }.alignItems(VerticalAlign.Center)
  104 + .onClick(() => {
  105 + this.toggleLikeStatus()
  106 + })
  107 +
  108 + }.width(CommonConstants.FULL_WIDTH).height(80)
  109 + .justifyContent(FlexAlign.Center)
  110 + }
  111 + .border({
  112 + width: { bottom: 5 },
  113 + color: '#f5f5f5',
  114 + })
  115 + }
  116 +
  117 + // 相关推荐区
  118 + ListItem() {
  119 + RecommendList({ recommendList: this.recommendList })
  120 + }
  121 + }
  122 + .width(CommonConstants.FULL_WIDTH)
  123 + .height(CommonConstants.FULL_HEIGHT)
  124 + .padding({ bottom: 56 })
  125 + .scrollBar(BarState.Off)
  126 + .edgeEffect(EdgeEffect.None)
  127 +
  128 + //底部交互区
  129 + Row() {
  130 + Image($r('app.media.icon_arrow_left'))
  131 + .width(24)
  132 + .height(24)
  133 + .onClick((event: ClickEvent) => {
  134 + router.back()
  135 + })
  136 +
  137 + Row() {
  138 + Image($r('app.media.icon_comment'))
  139 + .width(24)
  140 + .height(24)
  141 + .margin({ right: 24 })
  142 + .id('comment')
  143 +
  144 + Image($r('app.media.icon_star'))
  145 + .width(24)
  146 + .height(24)
  147 + .margin({ right: 24 })
  148 +
  149 + Image($r('app.media.icon_listen'))
  150 + .width(24)
  151 + .height(24)
  152 + .margin({ right: 24 })
  153 +
  154 + Image($r('app.media.icon_forward'))
  155 + .width(24)
  156 + .height(24)
  157 +
  158 + }
  159 + }
  160 + .width(CommonConstants.FULL_WIDTH)
  161 + .height(56)
  162 + .padding({ left: 15, right: 15, bottom: 50, top: 20 })
  163 + .justifyContent(FlexAlign.SpaceBetween)
  164 + .backgroundColor(Color.White)
  165 + }
  166 + }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
103 .backgroundColor(Color.White) 167 .backgroundColor(Color.White)
  168 +
104 } 169 }
105 170
106 - async aboutToAppear() { 171 + private async getDetail() {
107 let contentId: string = '' 172 let contentId: string = ''
108 let relId: string = '' 173 let relId: string = ''
109 let relType: string = '' 174 let relType: string = ''
@@ -122,14 +187,106 @@ export struct ImageAndTextPageComponent { @@ -122,14 +187,106 @@ export struct ImageAndTextPageComponent {
122 } 187 }
123 let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) 188 let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
124 if (detailBeans && detailBeans.length > 0) { 189 if (detailBeans && detailBeans.length > 0) {
125 - this.detailData = detailBeans[0]; 190 + this.contentDetailData = detailBeans;
  191 + if (this.contentDetailData[0]?.recommendShow === 1) {
  192 + this.getRecommend()
  193 + }
  194 + if (this.contentDetailData[0]?.openLikes === 1) {
  195 + this.getInteractDataStatus()
  196 + this.queryContentInteractCount()
  197 + }
126 } 198 }
  199 + }
  200 + }
127 201
  202 +
  203 + private async getRecommend() {
  204 + let params: postRecommendListParams = {
  205 + imei: "8272c108-4fa2-34ce-80b9-bc425a7c2a7e",
  206 + userId: HttpUrlUtils.getUserId(),
  207 + contentId: String(this.contentDetailData[0]?.newsId),
  208 + recType: 1,
  209 + contentType: this.contentDetailData[0]?.newsType,
  210 + relId: this.contentDetailData[0]?.reLInfo?.relId,
  211 + channelId: String(this.contentDetailData[0]?.reLInfo?.channelId)
  212 + }
  213 + let recommendList = await DetailViewModel.postRecommendList(params)
  214 + if (recommendList && recommendList.length > 0) {
  215 + this.recommendList = recommendList;
128 } 216 }
  217 + }
129 218
  219 + // 已登录->查询用户对作品点赞、收藏状态
  220 + private async getInteractDataStatus() {
  221 + try {
  222 + const params: batchLikeAndCollectParams = {
  223 + contentList: [
  224 + {
  225 + contentId: this.contentDetailData[0]?.newsId + '',
  226 + contentType: this.contentDetailData[0]?.newsType + '',
  227 + }
  228 + ]
  229 + }
  230 + console.error(TAG, JSON.stringify(this.contentDetailData))
  231 + let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
  232 + console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data))
  233 + this.newsStatusOfUser = data[0];
  234 + Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
  235 + } catch (exception) {
  236 + console.error(TAG, JSON.stringify(exception))
  237 + }
130 } 238 }
131 239
132 - aboutToDisappear() { 240 + /**
  241 + * 点赞、取消点赞
  242 + */
  243 + toggleLikeStatus() {
  244 + // 未登录,跳转登录
  245 + if (!HttpUrlUtils.getUserId()) {
  246 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  247 + return
  248 + }
  249 + const params: postExecuteLikeParams = {
  250 + status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1',
  251 + contentId: this.contentDetailData[0]?.newsId + '',
  252 + contentType: this.contentDetailData[0]?.newsType + '',
  253 + }
  254 + PageRepository.postExecuteLike(params).then(res => {
  255 + console.log(TAG, '点赞、取消点赞', 'toggleLikeStatus==',)
  256 + if (this.newsStatusOfUser) {
  257 + this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1'
  258 + this.queryContentInteractCount()
  259 + }
  260 +
  261 + })
  262 + }
  263 +
  264 + /**
  265 + * 查询点赞、收藏数量
  266 + */
  267 + queryContentInteractCount() {
  268 + console.error(TAG, 'contentDetailData2222', JSON.stringify(this.contentDetailData))
  269 + const params: contentListParams = {
  270 + contentList: [{
  271 + contentId: this.contentDetailData[0]?.newsId + '',
  272 + contentType: this.contentDetailData[0]?.newsType,
  273 + }]
  274 + }
  275 + PageRepository.getContentInteract(params).then(res => {
  276 + if (res.data) {
  277 + this.interactData.likeNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.likeNum)
  278 + this.interactData.collectNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.collectNum)
  279 + this.interactData.commentNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.commentNum)
  280 + }
  281 + console.log(TAG, '获取互动点赞等数据===', JSON.stringify(res))
  282 + console.log(TAG, 'this.interactData', JSON.stringify(this.interactData))
  283 + })
  284 + }
133 285
  286 + aboutToAppear() {
  287 + this.getDetail()
  288 + }
  289 +
  290 + aboutToDisappear() {
134 } 291 }
135 } 292 }
@@ -8,82 +8,96 @@ import { @@ -8,82 +8,96 @@ import {
8 } from 'wdBean'; 8 } from 'wdBean';
9 import { Logger } from 'wdKit'; 9 import { Logger } from 'wdKit';
10 import { WdWebComponent, WdWebLocalComponent } from 'wdWebComponent'; 10 import { WdWebComponent, WdWebLocalComponent } from 'wdWebComponent';
11 -import { BridgeWebViewControl } from '../../../../../../commons/wdWebComponent/oh_modules/wdJsBridge/Index'; 11 +import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type';
  12 +import { BridgeWebViewControl } from 'wdJsBridge/Index';
12 13
13 @Component 14 @Component
14 export struct ImageAndTextWebComponent { 15 export struct ImageAndTextWebComponent {
15 - webviewControl: BridgeWebViewControl = new BridgeWebViewControl()  
16 action: Action = {} as Action 16 action: Action = {} as Action
17 @State reload: number = 0; 17 @State reload: number = 0;
18 - @Prop @Watch('onDetailDataUpdated') detailData: ContentDetailDTO = {} as ContentDetailDTO 18 + @Prop @Watch('onDetailDataUpdated') contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO []
  19 + webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
19 20
20 onDetailDataUpdated() { 21 onDetailDataUpdated() {
21 - // if (this.action) {  
22 - // let contentId: string = ''  
23 - // let contentType: string = ''  
24 - // let topicId: string = ''  
25 - // let channelId: string = ''  
26 - // let compId: string = ''  
27 - // let sourcePage: string = '5'  
28 - // if (this.action.params) {  
29 - // if (this.action.params.contentID) {  
30 - // contentId = this.action.params?.contentID  
31 - // }  
32 - // if (this.action.params.extra) {  
33 - // if (this.action.params.extra.contentType) {  
34 - // contentType = this.action.params.extra.contentType  
35 - // }  
36 - // if (this.action.params.extra.topicId) {  
37 - // topicId = this.action.params.extra.topicId  
38 - // }  
39 - // if (this.action.params.extra.channelId) {  
40 - // channelId = this.action.params.extra.channelId  
41 - // }  
42 - // if (this.action.params.extra.compId) {  
43 - // compId = this.action.params.extra.compId  
44 - // }  
45 - // if (this.action.params.extra.sourcePage) {  
46 - // sourcePage = this.action.params.extra.sourcePage  
47 - // }  
48 - // }  
49 - //  
50 - // }  
51 - //  
52 - // let h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean  
53 - // let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { creatorId: '', isLogin: '0' } as H5ReceiveDataExtraBean  
54 - // let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = {  
55 - // contentId: contentId,  
56 - // contentType: contentType  
57 - // } as H5ReceiveDataJsonBean  
58 - // h5ReceiveDataJsonBean.topicId = topicId  
59 - // h5ReceiveDataJsonBean.channelId = channelId  
60 - // h5ReceiveDataJsonBean.compId = compId  
61 - // h5ReceiveDataJsonBean.sourcePage = sourcePage  
62 - // h5ReceiveDataJsonBean.netError = '0'  
63 - // let response: ResponseBean = {} as ResponseBean  
64 - // response.data = this.detailData  
65 - // response.code = 0  
66 - // response.success = true  
67 - // h5ReceiveDataJsonBean.responseMap = response  
68 - // h5ReceiveAppData.dataJson = h5ReceiveDataJsonBean  
69 - // h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean  
70 - // this.webviewControl.callHandle("jsCall_receiveAppData", JSON.stringify(h5ReceiveAppData), (data: string) => {  
71 - // Logger.info("from js data = " + data);  
72 - // }) 22 + if (this.action) {
  23 + let contentId: string = ''
  24 + let contentType: string = ''
  25 + let topicId: string = ''
  26 + let channelId: string = ''
  27 + let compId: string = ''
  28 + let sourcePage: string = '5'
  29 + if (this.action.params) {
  30 + if (this.action.params.contentID) {
  31 + contentId = this.action.params?.contentID
  32 + }
  33 + if (this.action.params.extra) {
  34 + if (this.action.params.extra.contentType) {
  35 + contentType = this.action.params.extra.contentType
  36 + }
  37 + if (this.action.params.extra.topicId) {
  38 + topicId = this.action.params.extra.topicId
  39 + }
  40 + if (this.action.params.extra.channelId) {
  41 + channelId = this.action.params.extra.channelId
  42 + }
  43 + if (this.action.params.extra.compId) {
  44 + compId = this.action.params.extra.compId
  45 + }
  46 + if (this.action.params.extra.sourcePage) {
  47 + sourcePage = this.action.params.extra.sourcePage
  48 + }
  49 + }
73 50
74 - // } 51 + }
  52 +
  53 + let h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
  54 + // TODO 对接user信息、登录情况
  55 + let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { creatorId: '', isLogin: '0' } as H5ReceiveDataExtraBean
  56 + let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = {
  57 + contentId: contentId,
  58 + contentType: contentType
  59 + } as H5ReceiveDataJsonBean
  60 + h5ReceiveDataJsonBean.topicId = topicId
  61 + h5ReceiveDataJsonBean.channelId = channelId
  62 + h5ReceiveDataJsonBean.compId = compId
  63 + h5ReceiveDataJsonBean.sourcePage = sourcePage
  64 + h5ReceiveDataJsonBean.netError = '0'
  65 + let response: ResponseBean = {} as ResponseBean
  66 + response.data = this.contentDetailData
  67 + response.code = 200
  68 + response.success = true
  69 + h5ReceiveDataJsonBean.responseMap = response
  70 + h5ReceiveAppData.dataJson = h5ReceiveDataJsonBean
  71 + h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean
  72 + // TODO 暂延时1s,考虑业务流程再优化
  73 + setTimeout(() => {
  74 + this.sendContentData2H5(h5ReceiveAppData);
  75 + }, 2000)
  76 +
  77 + }
75 78
76 } 79 }
77 80
78 build() { 81 build() {
79 Column() { 82 Column() {
80 - if (this.detailData && this.detailData.shareInfo && this.detailData.shareInfo.shareUrl){  
81 - WdWebComponent({  
82 - webviewControl: this.webviewControl,  
83 - webUrl: this.detailData?.shareInfo?.shareUrl,  
84 - backVisibility: false,  
85 - })  
86 - } 83 + WdWebLocalComponent({
  84 + webviewControl: this.webviewControl,
  85 + webResource: $rawfile('apph5/index.html'),
  86 + backVisibility: false,
  87 + })
  88 + // WdWebLocalComponent({
  89 + // webviewControl: this.webviewControl,
  90 + // webResource: "http://pd-people-uat.pdnews.cn/articletopic/35398-10000015965",
  91 + // backVisibility: false,
  92 + // })
87 } 93 }
88 } 94 }
  95 +
  96 + private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) {
  97 + Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData');
  98 + this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData,
  99 + JSON.stringify(h5ReceiveAppData), (data: string) => {
  100 + // Logger.debug('ImageAndTextWebComponent', "from js data = " + data);
  101 + })
  102 + }
89 } 103 }
1 // import { FrontLinkObject, MorningEveningPaperDTO, PageInfoBean } from 'wdBean'; 1 // import { FrontLinkObject, MorningEveningPaperDTO, PageInfoBean } from 'wdBean';
2 import { CompList, PageInfoBean } from 'wdBean'; 2 import { CompList, PageInfoBean } from 'wdBean';
3 -import { DateTimeUtils, Logger } from 'wdKit/Index'; 3 +import { DateTimeUtils, Logger, SPHelper } from 'wdKit/Index';
4 import { PaperReaderSimpleDialog } from '../../dialog/PaperReaderDialog'; 4 import { PaperReaderSimpleDialog } from '../../dialog/PaperReaderDialog';
5 import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel'; 5 import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel';
6 // import { AudioBarView } from './AudioBarView'; 6 // import { AudioBarView } from './AudioBarView';
@@ -21,6 +21,7 @@ export struct MorningEveningPaperComponent { @@ -21,6 +21,7 @@ export struct MorningEveningPaperComponent {
21 // @State compInfoBean: CompInfoBean = {} as CompInfoBean 21 // @State compInfoBean: CompInfoBean = {} as CompInfoBean
22 @State compListItem: CompList = {} as CompList 22 @State compListItem: CompList = {} as CompList
23 @State audioPlayUrl: string = "" 23 @State audioPlayUrl: string = ""
  24 + // @Consume dailyPaperTopicPageId: number
24 // @Provide compListItem: CompList = {} as CompList 25 // @Provide compListItem: CompList = {} as CompList
25 // @State morningEveningPaperDTO: MorningEveningPaperDTO = { 26 // @State morningEveningPaperDTO: MorningEveningPaperDTO = {
26 // name: "新闻夜读", 27 // name: "新闻夜读",
@@ -92,13 +93,14 @@ export struct MorningEveningPaperComponent { @@ -92,13 +93,14 @@ export struct MorningEveningPaperComponent {
92 } 93 }
93 94
94 async aboutToAppear() { 95 async aboutToAppear() {
95 - console.info(TAG, `aboutToAppear`)  
96 - 96 + let dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String
  97 + console.info(TAG, `aboutToAppear = ` + dailyPaperTopicPageId)
97 const currentTime = new Date().getTime() 98 const currentTime = new Date().getTime()
98 Logger.info(TAG, "currentTime = " + currentTime) 99 Logger.info(TAG, "currentTime = " + currentTime)
99 Logger.info(TAG, `currentTime = ${currentTime}`) 100 Logger.info(TAG, `currentTime = ${currentTime}`)
100 try { 101 try {
101 - let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("25091") 102 + // let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + this.dailyPaperTopicPageId)
  103 + let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + dailyPaperTopicPageId) //"25091"
102 this.pageInfoBean = pageInfoBean; 104 this.pageInfoBean = pageInfoBean;
103 this.title = this.pageInfoBean?.topicInfo?.title 105 this.title = this.pageInfoBean?.topicInfo?.title
104 let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN); 106 let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN);
@@ -28,7 +28,7 @@ export struct MultiPictureDetailPageComponent { @@ -28,7 +28,7 @@ export struct MultiPictureDetailPageComponent {
28 private picWidth: number = 0 28 private picWidth: number = 0
29 @State picHeight: number = 0 29 @State picHeight: number = 0
30 @State titleHeight: number = 0 30 @State titleHeight: number = 0
31 - @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO 31 + @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
32 @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' 32 @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01'
33 private swiperController: SwiperController = new SwiperController() 33 private swiperController: SwiperController = new SwiperController()
34 @State swiperIndex: number = 0; 34 @State swiperIndex: number = 0;
@@ -37,13 +37,12 @@ export struct MultiPictureDetailPageComponent { @@ -37,13 +37,12 @@ export struct MultiPictureDetailPageComponent {
37 37
38 //watch监听页码回调 38 //watch监听页码回调
39 onCurrentPageNumUpdated(): void { 39 onCurrentPageNumUpdated(): void {
40 - Logger.info(TAG, `currentPageNum:${this.currentPageNum}`, ) 40 + Logger.info(TAG, `currentPageNum:${this.currentPageNum}`,)
41 let _swiperIndex = Number.parseInt(this.currentPageNum) 41 let _swiperIndex = Number.parseInt(this.currentPageNum)
42 Logger.info(TAG, `_swiperIndex:${_swiperIndex}`) 42 Logger.info(TAG, `_swiperIndex:${_swiperIndex}`)
43 this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex 43 this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex
44 } 44 }
45 45
46 -  
47 async aboutToAppear() { 46 async aboutToAppear() {
48 //获取宽高尺寸 47 //获取宽高尺寸
49 this.screenWidth = this.displayTool.width 48 this.screenWidth = this.displayTool.width
@@ -72,7 +71,7 @@ export struct MultiPictureDetailPageComponent { @@ -72,7 +71,7 @@ export struct MultiPictureDetailPageComponent {
72 if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) { 71 if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) {
73 Swiper(this.swiperController) { 72 Swiper(this.swiperController) {
74 ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => { 73 ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => {
75 - MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) 74 + MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })
76 }) 75 })
77 } 76 }
78 .index(this.swiperIndex) 77 .index(this.swiperIndex)
@@ -91,10 +90,11 @@ export struct MultiPictureDetailPageComponent { @@ -91,10 +90,11 @@ export struct MultiPictureDetailPageComponent {
91 .onChange((index: number) => { 90 .onChange((index: number) => {
92 this.swiperIndex = index 91 this.swiperIndex = index
93 }) 92 })
94 - if(this.contentDetailData.rmhPlatform == 1) { 93 +
  94 + if (this.contentDetailData.rmhPlatform == 1) {
95 Row() { 95 Row() {
96 - Row(){  
97 - Row({space: 8}) { 96 + Row() {
  97 + Row({ space: 8 }) {
98 Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl) 98 Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl)
99 .borderRadius('50%') 99 .borderRadius('50%')
100 .alt($r('app.media.picture_loading')) 100 .alt($r('app.media.picture_loading'))
@@ -105,6 +105,7 @@ export struct MultiPictureDetailPageComponent { @@ -105,6 +105,7 @@ export struct MultiPictureDetailPageComponent {
105 } 105 }
106 .width('13%') 106 .width('13%')
107 .height('100%') 107 .height('100%')
  108 +
108 Row() { 109 Row() {
109 Flex({ 110 Flex({
110 direction: FlexDirection.Column, 111 direction: FlexDirection.Column,
@@ -124,7 +125,7 @@ export struct MultiPictureDetailPageComponent { @@ -124,7 +125,7 @@ export struct MultiPictureDetailPageComponent {
124 .fontWeight(400) 125 .fontWeight(400)
125 .lineHeight(14) 126 .lineHeight(14)
126 .textOverflow({ overflow: TextOverflow.Clip }) 127 .textOverflow({ overflow: TextOverflow.Clip })
127 - .margin (0) 128 + .margin(0)
128 } 129 }
129 } 130 }
130 .width('81%') 131 .width('81%')
@@ -136,10 +137,11 @@ export struct MultiPictureDetailPageComponent { @@ -136,10 +137,11 @@ export struct MultiPictureDetailPageComponent {
136 top: 0, 137 top: 0,
137 bottom: 0, 138 bottom: 0,
138 left: 16, 139 left: 16,
139 - right:0 140 + right: 0
140 }) 141 })
141 - if(this.followStatus == '0') {  
142 - Row(){ 142 +
  143 + if (this.followStatus == '0') {
  144 + Row() {
143 Button('+关注', { type: ButtonType.Normal, stateEffect: true }) 145 Button('+关注', { type: ButtonType.Normal, stateEffect: true })
144 .borderRadius(4) 146 .borderRadius(4)
145 .backgroundColor('#ED2800') 147 .backgroundColor('#ED2800')
@@ -152,7 +154,7 @@ export struct MultiPictureDetailPageComponent { @@ -152,7 +154,7 @@ export struct MultiPictureDetailPageComponent {
152 top: 10, 154 top: 10,
153 bottom: 10, 155 bottom: 10,
154 left: 16, 156 left: 16,
155 - right:16 157 + right: 16
156 }) 158 })
157 .fontSize(12) 159 .fontSize(12)
158 .fontColor(Color.White) 160 .fontColor(Color.White)
@@ -169,7 +171,7 @@ export struct MultiPictureDetailPageComponent { @@ -169,7 +171,7 @@ export struct MultiPictureDetailPageComponent {
169 }) 171 })
170 .id('e_attention') 172 .id('e_attention')
171 } 173 }
172 - Row(){ 174 + Row() {
173 Scroll(this.scroller) { 175 Scroll(this.scroller) {
174 Row() { 176 Row() {
175 Flex({ 177 Flex({
@@ -177,22 +179,38 @@ export struct MultiPictureDetailPageComponent { @@ -177,22 +179,38 @@ export struct MultiPictureDetailPageComponent {
177 justifyContent: FlexAlign.Start 179 justifyContent: FlexAlign.Start
178 }) { 180 }) {
179 Text() { 181 Text() {
180 - Span(`${this.swiperIndex + 1}`).fontSize(24).fontFamily('PingFang SC-Medium').fontWeight(500).lineHeight(28)  
181 - Span(`/${this.contentDetailData.photoList.length}`).fontSize(14).fontFamily('PingFang SC-Medium').fontWeight(500).lineHeight(19) 182 + Span(`${this.swiperIndex + 1}`)
  183 + .fontSize(24)
  184 + .fontFamily('PingFang SC-Medium')
  185 + .fontWeight(500)
  186 + .lineHeight(28)
  187 + Span(`/${this.contentDetailData.photoList.length}`)
  188 + .fontSize(14)
  189 + .fontFamily('PingFang SC-Medium')
  190 + .fontWeight(500)
  191 + .lineHeight(19)
182 }.fontColor(Color.White).margin(4) 192 }.fontColor(Color.White).margin(4)
183 193
184 - Text(`${this.contentDetailData.newsTitle}`).fontColor(Color.White).fontSize(16).fontFamily('PingFang SC-Semibold')  
185 - .fontWeight(600).lineHeight(24)  
186 - .margin ({ 194 + Text(`${this.contentDetailData.newsTitle}`)
  195 + .fontColor(Color.White)
  196 + .fontSize(16)
  197 + .fontFamily('PingFang SC-Semibold')
  198 + .fontWeight(600)
  199 + .lineHeight(24)
  200 + .margin({
187 top: 4, 201 top: 4,
188 left: 0, 202 left: 0,
189 bottom: 4, 203 bottom: 4,
190 right: 0 204 right: 0
191 }) 205 })
192 - Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`).fontColor(Color.White)  
193 - .fontSize(14).fontFamily('PingFang SC-Regular').fontWeight(400).lineHeight(22) 206 + Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`)
  207 + .fontColor(Color.White)
  208 + .fontSize(14)
  209 + .fontFamily('PingFang SC-Regular')
  210 + .fontWeight(400)
  211 + .lineHeight(22)
194 .textOverflow({ overflow: TextOverflow.Ellipsis }) 212 .textOverflow({ overflow: TextOverflow.Ellipsis })
195 - .margin ({ 213 + .margin({
196 top: 4, 214 top: 4,
197 left: 0, 215 left: 0,
198 bottom: 4, 216 bottom: 4,
@@ -202,7 +220,7 @@ export struct MultiPictureDetailPageComponent { @@ -202,7 +220,7 @@ export struct MultiPictureDetailPageComponent {
202 } 220 }
203 } 221 }
204 .width('100%') 222 .width('100%')
205 - .margin ({ 223 + .margin({
206 top: 8, 224 top: 8,
207 left: 18, 225 left: 18,
208 bottom: 24, 226 bottom: 24,
@@ -227,13 +245,15 @@ export struct MultiPictureDetailPageComponent { @@ -227,13 +245,15 @@ export struct MultiPictureDetailPageComponent {
227 bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, 245 bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
228 middle: { anchor: "__container__", align: HorizontalAlign.Center } 246 middle: { anchor: "__container__", align: HorizontalAlign.Center }
229 }) 247 })
230 - .width('100%').height(56).margin({  
231 - top: 16,  
232 - left: 16,  
233 - right:16,  
234 - bottom: 0  
235 - })  
236 - .border({ width: {top: 0.5}, color: '#FFFFFF' }) 248 + .width('100%')
  249 + .height(56)
  250 + .margin({
  251 + top: 16,
  252 + left: 16,
  253 + right: 16,
  254 + bottom: 0
  255 + })
  256 + .border({ width: { top: 0.5 }, color: '#FFFFFF' })
237 .id('e_oper_row') 257 .id('e_oper_row')
238 } 258 }
239 } 259 }
@@ -241,6 +261,9 @@ export struct MultiPictureDetailPageComponent { @@ -241,6 +261,9 @@ export struct MultiPictureDetailPageComponent {
241 .height('100%') 261 .height('100%')
242 .backgroundColor(Color.Black) 262 .backgroundColor(Color.Black)
243 .id('e_picture_container') 263 .id('e_picture_container')
  264 + // 设置顶部绘制延伸到状态栏
  265 + // 设置底部绘制延伸到导航条
  266 + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
244 } 267 }
245 268
246 private async getContentDetailData() { 269 private async getContentDetailData() {
@@ -285,6 +308,7 @@ export struct MultiPictureDetailPageComponent { @@ -285,6 +308,7 @@ export struct MultiPictureDetailPageComponent {
285 308
286 } 309 }
287 } 310 }
  311 +
288 /** 312 /**
289 * 关注号主 313 * 关注号主
290 */ 314 */
@@ -14,7 +14,6 @@ import { CommonConstants } from 'wdConstant/Index'; @@ -14,7 +14,6 @@ import { CommonConstants } from 'wdConstant/Index';
14 14
15 const TAG = 'BroadcastPageComponent'; 15 const TAG = 'BroadcastPageComponent';
16 16
17 -@Entry  
18 @Component 17 @Component
19 export struct BroadcastPageComponent { 18 export struct BroadcastPageComponent {
20 @State params:Params = router.getParams() as Params; 19 @State params:Params = router.getParams() as Params;
@@ -4,7 +4,6 @@ import { CommonConstants } from 'wdConstant/Index'; @@ -4,7 +4,6 @@ import { CommonConstants } from 'wdConstant/Index';
4 /** 4 /**
5 * 今日推荐顶部标题--fixed标题 5 * 今日推荐顶部标题--fixed标题
6 */ 6 */
7 -@Entry  
8 @Component 7 @Component
9 export struct RecommendHeader { 8 export struct RecommendHeader {
10 build() { 9 build() {
@@ -4,7 +4,6 @@ import { ProcessUtils } from '../../utils/ProcessUtils'; @@ -4,7 +4,6 @@ import { ProcessUtils } from '../../utils/ProcessUtils';
4 /** 4 /**
5 * 播报--今日推荐列表 5 * 播报--今日推荐列表
6 */ 6 */
7 -@Entry  
8 @Component 7 @Component
9 export struct RecommendLists { 8 export struct RecommendLists {
10 @Prop recommendCompInfoBean: CompInfoBean = {} as CompInfoBean // 推荐-组件信息 9 @Prop recommendCompInfoBean: CompInfoBean = {} as CompInfoBean // 推荐-组件信息
@@ -3,7 +3,6 @@ import { DateTimeUtils } from 'wdKit'; @@ -3,7 +3,6 @@ import { DateTimeUtils } from 'wdKit';
3 /** 3 /**
4 * 播报标题描述 4 * 播报标题描述
5 */ 5 */
6 -@Entry  
7 @Component 6 @Component
8 export struct RecommendTitle { 7 export struct RecommendTitle {
9 build() { 8 build() {
@@ -5,7 +5,6 @@ import { ProcessUtils } from '../../utils/ProcessUtils'; @@ -5,7 +5,6 @@ import { ProcessUtils } from '../../utils/ProcessUtils';
5 /** 5 /**
6 * 精选栏目 6 * 精选栏目
7 */ 7 */
8 -@Entry  
9 @Component 8 @Component
10 export struct SelectedColumns { 9 export struct SelectedColumns {
11 @Prop columnsCompInfoBean: CompInfoBean = {} as CompInfoBean // 精选栏目组件信息 10 @Prop columnsCompInfoBean: CompInfoBean = {} as CompInfoBean // 精选栏目组件信息
  1 +import { ContentDTO } from 'wdBean/Index'
  2 +import { DateTimeUtils } from 'wdKit/Index'
  3 +
  4 +/**
  5 + * 这里是样式卡中,右下角显示的音视频信息
  6 + * 目前已知:
  7 + * 音频: 音频图标+时长
  8 + * 视频:点播图标+时长;直播图标+'直播中'
  9 + */
  10 +@Component
  11 +export struct CardMediaInfo {
  12 + @State contentDTO: ContentDTO = {} as ContentDTO // 如果有duraion,代表点播,显示时长;如果不传或者传0,显示直播中
  13 + // objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,
  14 + // 14动态图文,15动态视频16问政;100人民号,101标签
  15 +
  16 + build() {
  17 + Row() {
  18 + if(this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15' ) {
  19 + // 点播、动态视频
  20 + Row(){
  21 + Image($r('app.media.videoTypeIcon'))
  22 + .mediaLogo()
  23 + Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000))
  24 + .mediaText()
  25 + }
  26 + .backgroundColor('#4d000000')
  27 + .borderRadius($r('app.float.button_border_radius'))
  28 + } else if(this.contentDTO.objectType === '2') {
  29 + // liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
  30 + // 显示直播信息
  31 + Row(){
  32 + if(this.contentDTO.liveInfo.liveState === 'running') {
  33 + Image($r('app.media.icon_live'))
  34 + .mediaLogo()
  35 + Text('直播中')
  36 + .mediaText()
  37 + } else if(this.contentDTO.liveInfo.liveState === 'end'){
  38 + Image($r('app.media.videoTypeIcon'))
  39 + .mediaLogo()
  40 + Text('回看')
  41 + .mediaText()
  42 + }
  43 + }
  44 + .backgroundColor('#4d000000')
  45 + .borderRadius($r('app.float.button_border_radius'))
  46 + } else if(this.contentDTO.objectType === '9') {
  47 + // 显示组图;图片数量
  48 + Row(){
  49 + Image($r('app.media.album_card_shape'))
  50 + .mediaLogo()
  51 + Text(`${this.contentDTO.photoNum}`)
  52 + .mediaText()
  53 + .width(20)
  54 + }
  55 + .backgroundColor('#4d000000')
  56 + .borderRadius($r('app.float.button_border_radius'))
  57 + } else if(this.contentDTO.objectType === '13') {
  58 + // 显示音频信息
  59 + Row(){
  60 + Image($r('app.media.broadcast_listen'))
  61 + .height(14)
  62 + .borderRadius($r('app.float.button_border_radius'))
  63 + Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000))
  64 + .mediaText()
  65 + }
  66 + }
  67 + }
  68 + .margin(6)
  69 + }
  70 +
  71 + @Styles mediaLogo() {
  72 + .width(22)
  73 + .height(18)
  74 + .borderRadius($r('app.float.button_border_radius'))
  75 + }
  76 +}
  77 +
  78 +@Extend(Text) function mediaText() {
  79 + .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 })
  85 +}
  1 +/**
  2 + * 这里是人民号动态中的顶部信息:人民号logo,名字,描述,关注等
  3 + */
  4 +import { RmhInfoDTO } from 'wdBean'
  5 +import { CommonConstants } from 'wdConstant/Index';
  6 +
  7 +@Component
  8 +export struct RmhTitle {
  9 + @Prop rmhInfo: RmhInfoDTO
  10 +
  11 + build() {
  12 + Flex() {
  13 + Stack() {
  14 + Image(this.rmhInfo.rmhHeadUrl)
  15 + .width(36)
  16 + .height(36).borderRadius(50)
  17 + Image(this.rmhInfo.authIcon)
  18 + .width(14)
  19 + .height(14)
  20 + .borderRadius(50)
  21 + }
  22 + .margin({ right: 8 })
  23 + .alignContent(Alignment.BottomEnd)
  24 + .flexShrink(0)
  25 +
  26 + Column() {
  27 + Text(this.rmhInfo.rmhName)
  28 + .fontSize($r('app.float.font_size_13'))
  29 + .fontColor($r('app.color.color_222222'))
  30 + .fontWeight(600)
  31 + .alignSelf(ItemAlign.Start)
  32 + Text(this.rmhInfo.rmhDesc)
  33 + .fontSize($r("app.float.font_size_12"))
  34 + .fontColor($r("app.color.color_B0B0B0"))
  35 + .maxLines(1)
  36 + .alignSelf(ItemAlign.Start)
  37 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  38 + }
  39 +
  40 + Blank()
  41 + if (this.rmhInfo.cnIsAttention) {
  42 + Row() {
  43 + Image($r('app.media.rmh_follow'))
  44 + .width(16)
  45 + .height(16)
  46 + Text('关注')
  47 + .fontSize($r('app.float.font_size_13'))
  48 + .fontColor($r('app.color.color_ED2800'))
  49 + }
  50 + .flexShrink(0)
  51 + .alignSelf(ItemAlign.Center)
  52 + .onClick(() => {
  53 + // TODO 调用关注接口
  54 + })
  55 + }
  56 + }
  57 + .width(CommonConstants.FULL_WIDTH)
  58 + .margin({ bottom: 10 })
  59 + }
  60 +}
  1 +import { AttentionRmhInfoDTO } from 'wdBean';
  2 +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
  3 +
  4 +/**
  5 + * AttentionListComponent 人民号-关注-我的关注
  6 + * 没有compstyle
  7 + */
  8 +const TAG = '人民号-关注-我的关注'
  9 +
  10 +@Entry
  11 +@Component
  12 +export struct AttentionListComponent {
  13 + @State attentionList: AttentionRmhInfoDTO[] = [] as AttentionRmhInfoDTO[]
  14 +
  15 + build() {
  16 + Row({ space: 4 }) {
  17 + List() {
  18 + ListItem() {
  19 + Column() {
  20 + Image($r('app.media.attention_mine'))
  21 + .width(48)
  22 + .height(48)
  23 + .padding(12)
  24 + .backgroundColor($r('app.color.color_F5F5F5'))
  25 + .borderRadius(50)
  26 + .margin({ bottom: 8 })
  27 + Text('我的关注')
  28 + .fontSize($r('app.float.font_size_13'))
  29 + .fontColor($r('app.color.color_666666'))
  30 + }
  31 + .width(78)
  32 + .height(74)
  33 + .onClick(() => {
  34 + // 跳转到关注列表-我的
  35 + WDRouterRule.jumpWithPage(WDRouterPage.followListPage)
  36 + })
  37 + }
  38 +
  39 + ForEach(this.attentionList, (item: AttentionRmhInfoDTO, index: number) => {
  40 + ListItem() {
  41 + Column() {
  42 + Stack() {
  43 + Image(item.attentionHeadPhotoUrl)
  44 + .width(48)
  45 + .height(48)
  46 + .borderRadius(50)
  47 + Image(item.authIcon)
  48 + .width(14)
  49 + .height(14)
  50 + .borderRadius(50)
  51 + }
  52 + .margin({ bottom: 8 })
  53 + .alignContent(Alignment.BottomEnd)
  54 +
  55 + Text(item.attentionUserName)
  56 + .fontSize($r('app.float.font_size_13'))
  57 + .fontColor($r('app.color.color_666666'))
  58 + .textOverflowStyle(1)
  59 + }
  60 + .margin({
  61 + right: index === this.attentionList.length - 1 ? $r('app.float.card_comp_pagePadding_lf') : 0,
  62 + })
  63 + .padding({ left: 2, right: 2 })
  64 + }
  65 + .width(78)
  66 + .height(74)
  67 + .onClick(() => {
  68 + //TODO 跳转到对应的人民号主页
  69 +
  70 + })
  71 + })
  72 + }
  73 + .listDirection(Axis.Horizontal)
  74 + .height(74)
  75 + }
  76 + .padding({
  77 + left: $r('app.float.card_comp_pagePadding_lf'),
  78 + top: $r('app.float.card_comp_pagePadding_tb'),
  79 + bottom: $r('app.float.card_comp_pagePadding_tb')
  80 + })
  81 + }
  82 +}
  83 +
  84 +@Extend(Text)
  85 +function textOverflowStyle(maxLine: number) {
  86 + .maxLines(maxLine)
  87 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  88 +}
@@ -2,11 +2,12 @@ @@ -2,11 +2,12 @@
2 import { CommonConstants } from 'wdConstant' 2 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 6
6 const TAG = 'Card11Component'; 7 const TAG = 'Card11Component';
7 8
8 /** 9 /**
9 - * 无图卡(标题省略) 10 + * 无图卡(标题省略) Card_11 = '11
10 */ 11 */
11 @Component 12 @Component
12 export struct Card11Component { 13 export struct Card11Component {
@@ -21,33 +22,38 @@ export struct Card11Component { @@ -21,33 +22,38 @@ export struct Card11Component {
21 .textOverflow({ overflow: TextOverflow.Ellipsis }) 22 .textOverflow({ overflow: TextOverflow.Ellipsis })
22 .width(CommonConstants.FULL_WIDTH) 23 .width(CommonConstants.FULL_WIDTH)
23 Row() { 24 Row() {
24 - Text("锐评")  
25 - .fontSize($r("app.float.font_size_12"))  
26 - .fontColor($r("app.color.color_ED2800"))  
27 - Text(this.contentDTO.source)  
28 - .fontSize($r("app.float.font_size_12"))  
29 - .fontColor($r("app.color.color_B0B0B0"))  
30 - .margin({ left: 6 })  
31 - Image($r("app.media.point"))  
32 - .width(16)  
33 - .height(16) 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 34
35 - Text(DateTimeUtils.formatDate(Number.parseFloat(this.contentDTO.publishTime))) 35 + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))
36 .fontSize($r("app.float.font_size_12")) 36 .fontSize($r("app.float.font_size_12"))
37 .fontColor($r("app.color.color_B0B0B0")) 37 .fontColor($r("app.color.color_B0B0B0"))
38 - 38 + .margin({ right: 6 })
  39 + // TODO '评论取哪个字段'
  40 + // Text(`1806评`)
  41 + // .fontSize($r("app.float.font_size_12"))
  42 + // .fontColor($r("app.color.color_B0B0B0"))
39 }.width(CommonConstants.FULL_WIDTH) 43 }.width(CommonConstants.FULL_WIDTH)
40 .justifyContent(FlexAlign.Start) 44 .justifyContent(FlexAlign.Start)
41 .margin({ top: 8 }) 45 .margin({ top: 8 })
42 46
43 }.width(CommonConstants.FULL_WIDTH) 47 }.width(CommonConstants.FULL_WIDTH)
44 .padding({ 48 .padding({
45 - top: 14,  
46 - left: 16,  
47 - right: 16,  
48 - bottom: 14 49 + left: $r('app.float.card_comp_pagePadding_lf'),
  50 + right: $r('app.float.card_comp_pagePadding_lf'),
  51 + top: $r('app.float.card_comp_pagePadding_tb'),
  52 + bottom: $r('app.float.card_comp_pagePadding_tb')
49 }) 53 })
50 .backgroundColor($r("app.color.white")) 54 .backgroundColor($r("app.color.white"))
51 - .margin({ bottom: 8 }) 55 + .onClick((event: ClickEvent) => {
  56 + ProcessUtils.processPage(this.contentDTO)
  57 + })
52 } 58 }
53 } 59 }
  1 +import { ContentDTO } from 'wdBean';
  2 +import { ProcessUtils } from '../../utils/ProcessUtils';
  3 +import { RmhTitle } from '../cardCommon/RmhTitle'
  4 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
  5 +import { CommonConstants } from 'wdConstant/Index';
  6 +
  7 +const TAG: string = 'Card15Component';
  8 +
  9 +/**
  10 + * 大图卡人民号:
  11 + * compstyle:15
  12 + * 卡片结构:上下结构
  13 + * 卡片宽度:充满父窗口
  14 + * 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9:
  15 + */
  16 +@Component
  17 +export struct Card15Component {
  18 + @State contentDTO: ContentDTO = {
  19 + // appStyle: '15',
  20 + // coverType: 1,
  21 + // objectType: '9',
  22 + // coverUrl: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/img/2024/0413/VL20Z09ISBEKXZU_963672030241091584.jpeg?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90',
  23 + // fullColumnImgUrls: [
  24 + // {
  25 + // landscape: 2,
  26 + // size: 1,
  27 + // url: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/img/2024/0413/VL20Z09ISBEKXZU_963672030241091584.jpeg?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90',
  28 + // weight: 1170
  29 + // }
  30 + // ],
  31 + // newsTitle: '押解画面公开!被湖北民警从柬埔寨押解回国被湖北民警从柬埔寨押解回国的130名涉赌诈嫌疑人是他们被湖北民警从柬埔寨押解回国的130名涉赌诈嫌疑人是他们的130名涉赌诈嫌疑人是他们',
  32 + // publishTime: '1712993333000',
  33 + // rmhInfo: {
  34 + // authIcon: '',
  35 + // authTitle: '',
  36 + // authTitle2: '',
  37 + // banControl: 0,
  38 + // cnIsAttention: 1,
  39 + // rmhDesc: '中共武汉市委机关报长江日报官方人民号',
  40 + // rmhHeadUrl: 'https://uatjdcdnphoto.aikan.pdnews.cn/vod/content/202302/202302Sa121448724/TUw.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
  41 + // rmhId: '4255270',
  42 + // rmhName: '长江日报',
  43 + // userId: '513696944662469',
  44 + // userType: '3'
  45 + // },
  46 + // videoInfo: {
  47 + // firstFrameImageUri: '',
  48 + // videoDuration: 12,
  49 + // // videoLandscape: 2,
  50 + // videoUrl: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/video/2024/0413/VL20Z09ISBEKXZU_963672027208609792.mp4'
  51 + // },
  52 + // photoNum: '9',
  53 + // voiceInfo: {
  54 + // voiceDuration: 12
  55 + // }
  56 + } as ContentDTO;
  57 +
  58 + build() {
  59 + Column() {
  60 + // rmh信息
  61 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
  62 + //新闻标题
  63 + if (this.contentDTO.newsTitle) {
  64 + Text(this.contentDTO.newsTitle)
  65 + .fontSize($r('app.float.font_size_17'))
  66 + .fontColor($r('app.color.color_222222'))
  67 + .width(CommonConstants.FULL_WIDTH)
  68 + .textOverflowStyle(2)
  69 + .margin({ bottom: 8 })
  70 + }
  71 + //大图
  72 + Stack() {
  73 + Image(this.contentDTO.coverUrl)
  74 + .borderRadius($r('app.float.image_border_radius'))
  75 + //播放状态+时长
  76 + CardMediaInfo({
  77 + contentDTO: this.contentDTO
  78 + })
  79 + }
  80 + .width(CommonConstants.FULL_WIDTH)
  81 + .aspectRatio(16 / 9)
  82 + .alignContent(Alignment.BottomEnd)
  83 +
  84 + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
  85 + }
  86 + .padding({
  87 + left: $r('app.float.card_comp_pagePadding_lf'),
  88 + right: $r('app.float.card_comp_pagePadding_lf'),
  89 + top: $r('app.float.card_comp_pagePadding_tb'),
  90 + bottom: $r('app.float.card_comp_pagePadding_tb')
  91 + })
  92 + .onClick((event: ClickEvent) => {
  93 + ProcessUtils.processPage(this.contentDTO)
  94 + })
  95 + }
  96 +}
  97 +
  98 +
  99 +@Extend(Text)
  100 +function textOverflowStyle(maxLine: number) {
  101 + .maxLines(maxLine)
  102 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  103 +}
@@ -3,12 +3,13 @@ import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; @@ -3,12 +3,13 @@ import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
3 import { CommonConstants } from 'wdConstant/Index'; 3 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 7
7 const TAG = 'Card17Component'; 8 const TAG = 'Card17Component';
8 -/**  
9 -* 图卡集---2  
10 -*/  
11 9
  10 +/**
  11 + * 图卡集---2
  12 + */
12 @Component 13 @Component
13 export struct Card17Component { 14 export struct Card17Component {
14 @State compDTO: CompDTO = {} as CompDTO 15 @State compDTO: CompDTO = {} as CompDTO
@@ -18,82 +19,54 @@ export struct Card17Component { @@ -18,82 +19,54 @@ export struct Card17Component {
18 Column({ space: 8 }) { 19 Column({ space: 8 }) {
19 Text(this.contentDTO.newsTitle) 20 Text(this.contentDTO.newsTitle)
20 .textOverflow({ overflow: TextOverflow.Ellipsis }) 21 .textOverflow({ overflow: TextOverflow.Ellipsis })
21 - .fontSize(17)  
22 - .fontColor(0x222222) 22 + .fontSize($r('app.float.font_size_17'))
  23 + .fontColor($r('app.color.color_222222'))
23 .lineHeight(25) 24 .lineHeight(25)
24 .maxLines(3) 25 .maxLines(3)
25 .width(CommonConstants.FULL_WIDTH) 26 .width(CommonConstants.FULL_WIDTH)
26 27
27 - RelativeContainer() {  
28 - Image(this.contentDTO.fullColumnImgUrls[0].url)  
29 - .width('66.6%')  
30 - .aspectRatio(16 / 9)  
31 - .alignRules({  
32 - top: { anchor: "__container__", align: VerticalAlign.Top },  
33 - left: { anchor: "__container__", align: HorizontalAlign.Start }  
34 - })  
35 - .id('mainImage')  
36 -  
37 - Image(this.contentDTO.fullColumnImgUrls[1].url)  
38 - .width('33%')  
39 - .aspectRatio(16 / 9)  
40 - .alignRules({  
41 - top: { anchor: "__container__", align: VerticalAlign.Top },  
42 - right: { anchor: "__container__", align: HorizontalAlign.End }  
43 - })  
44 - .id('subTopImage') 28 + Stack({ alignContent: Alignment.BottomEnd }) {
  29 + // 三个图,
  30 + GridRow({ gutter: 2 }) {
  31 + GridCol({ span: { xs: 8 } }) {
  32 + Image(this.contentDTO.fullColumnImgUrls[0].url)
  33 + .width(CommonConstants.FULL_WIDTH)
  34 + .aspectRatio(16 / 9)
  35 + .borderRadius({
  36 + topLeft: $r('app.float.image_border_radius'),
  37 + bottomLeft: $r('app.float.image_border_radius'),
  38 + })
  39 + }
45 40
46 - Image(this.contentDTO.fullColumnImgUrls[2].url)  
47 - .width('33%')  
48 - .aspectRatio(16 / 9)  
49 - .alignRules({  
50 - right: { anchor: "__container__", align: HorizontalAlign.End },  
51 - bottom: { anchor: "__container__", align: VerticalAlign.Bottom }  
52 - })  
53 - .id('subBottomImage')  
54 - // 下面是渲染右下角图标  
55 - Shape() {  
56 - Rect().width(33).height(18) 41 + GridCol({ span: { xs: 4 } }) {
  42 + Image(this.contentDTO.fullColumnImgUrls[1].url)
  43 + .width(CommonConstants.FULL_WIDTH)
  44 + .aspectRatio(16 / 9)
  45 + .margin({ bottom: 1 })
  46 + .borderRadius({
  47 + topRight: $r('app.float.image_border_radius'),
  48 + })
  49 + }
57 } 50 }
58 - .fill(0x000000)  
59 - .fillOpacity(0.3)  
60 - .strokeLineCap(LineCapStyle.Round)  
61 - .strokeLineJoin(LineJoinStyle.Round)  
62 - .antiAlias(true)  
63 - .id('shape')  
64 - .alignRules({  
65 - right: { anchor: "__container__", align: HorizontalAlign.End },  
66 - bottom: { anchor: "__container__", align: VerticalAlign.Bottom }  
67 - })  
68 - .margin({  
69 - right: 4,  
70 - bottom: 4  
71 - })  
72 51
73 - Image($r('app.media.album_card_shape'))  
74 - .width(22)  
75 - .height(18)  
76 - .alignRules({  
77 - left: { anchor: "shape", align: HorizontalAlign.Start },  
78 - top: { anchor: "shape", align: VerticalAlign.Top }  
79 - })  
80 - .id('shapeSubImage') 52 + GridRow({ gutter: 2 }) {
  53 + GridCol({ span: { xs: 8 } }) {
  54 + }
  55 +
  56 + GridCol({ span: { xs: 4 } }) {
  57 + Image(this.contentDTO.fullColumnImgUrls[2].url)
  58 + .width(CommonConstants.FULL_WIDTH)
  59 + .aspectRatio(16 / 9)
  60 + .margin({ top: 1 })
  61 + .borderRadius({
  62 + bottomRight: $r('app.float.image_border_radius'),
  63 + })
  64 + }
  65 + }
81 66
82 - Text(this.contentDTO.fullColumnImgUrls.length + '')  
83 - .fontSize(13)  
84 - .fontColor(0xFFFFFF)  
85 - .id('pageIndex')  
86 - .alignRules({  
87 - right: { anchor: "shape", align: HorizontalAlign.End },  
88 - top: { anchor: "shape", align: VerticalAlign.Top }  
89 - })  
90 - .margin({ right: 2 })  
91 - .textAlign(TextAlign.Center)  
92 - .width(17)  
93 - .height(17) 67 + CardMediaInfo({ contentDTO: this.contentDTO })
94 } 68 }
95 .width(CommonConstants.FULL_WIDTH) 69 .width(CommonConstants.FULL_WIDTH)
96 - .aspectRatio(24 / 9)  
97 .onClick((event: ClickEvent) => { 70 .onClick((event: ClickEvent) => {
98 let taskAction: Action = { 71 let taskAction: Action = {
99 type: 'JUMP_DETAIL_PAGE', 72 type: 'JUMP_DETAIL_PAGE',
@@ -112,23 +85,17 @@ export struct Card17Component { @@ -112,23 +85,17 @@ export struct Card17Component {
112 Row() { 85 Row() {
113 if (this.contentDTO.source) { 86 if (this.contentDTO.source) {
114 Text(this.contentDTO.source) 87 Text(this.contentDTO.source)
115 - .fontSize(13)  
116 - .fontColor(0xB0B0B0) 88 + .fontSize($r('app.float.font_size_13'))
  89 + .fontColor($r('app.color.color_B0B0B0'))
117 Image($r('app.media.point')) 90 Image($r('app.media.point'))
118 .width(16) 91 .width(16)
119 .height(16) 92 .height(16)
120 } 93 }
121 if (this.contentDTO.publishTime && this.contentDTO.publishTime.length === 13) { 94 if (this.contentDTO.publishTime && this.contentDTO.publishTime.length === 13) {
122 Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) 95 Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))
123 - .fontSize(13)  
124 - .fontColor(0xB0B0B0) 96 + .fontSize($r('app.float.font_size_13'))
  97 + .fontColor($r('app.color.color_B0B0B0'))
125 } 98 }
126 - Text('328评')  
127 - .fontSize(13)  
128 - .fontColor(0xB0B0B0)  
129 - .margin({  
130 - left: 6  
131 - })  
132 } 99 }
133 .width(CommonConstants.FULL_WIDTH) 100 .width(CommonConstants.FULL_WIDTH)
134 .height(16) 101 .height(16)
@@ -136,10 +103,10 @@ export struct Card17Component { @@ -136,10 +103,10 @@ export struct Card17Component {
136 } 103 }
137 .width(CommonConstants.FULL_WIDTH) 104 .width(CommonConstants.FULL_WIDTH)
138 .padding({ 105 .padding({
139 - top: 14,  
140 - left: 16,  
141 - right: 16,  
142 - bottom: 14 106 + left: $r('app.float.card_comp_pagePadding_lf'),
  107 + right: $r('app.float.card_comp_pagePadding_lf'),
  108 + top: $r('app.float.card_comp_pagePadding_tb'),
  109 + bottom: $r('app.float.card_comp_pagePadding_tb')
143 }) 110 })
144 } 111 }
145 } 112 }
  1 +import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
  2 +import { RmhTitle } from '../cardCommon/RmhTitle'
  3 +
  4 +const TAG = 'Card19Component';
  5 +
  6 +/**
  7 + * 人民号-动态---19:动态图文卡人民号; 从无图--9图
  8 + */
  9 +@Component
  10 +export struct Card19Component {
  11 + @State contentDTO: ContentDTO = {
  12 + // appStyle: '19',
  13 + // coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
  14 + // fullColumnImgUrls: [
  15 + // {
  16 + // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/quality,q_90/auto-orient,1',
  17 + // height: 1500,
  18 + // landscape: 1,
  19 + // size: 1,
  20 + // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
  21 + // weight: 2000
  22 + // },
  23 + // {
  24 + // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994155727712256.png?x-oss-process=image/quality,q_90/auto-orient,1',
  25 + // height: 1500,
  26 + // landscape: 1,
  27 + // size: 1,
  28 + // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994155727712256.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
  29 + // weight: 2000
  30 + // },
  31 + // {
  32 + // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/quality,q_90/auto-orient,1',
  33 + // height: 1280,
  34 + // landscape: 1,
  35 + // size: 1,
  36 + // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
  37 + // weight: 1707
  38 + // },
  39 + // {
  40 + // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/quality,q_90/auto-orient,1',
  41 + // height: 1280,
  42 + // landscape: 1,
  43 + // size: 1,
  44 + // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
  45 + // weight: 1707
  46 + // }
  47 + // ],
  48 + // newsSummary: '#平安建设双提升#【进工地,送安全】3月21日下午,@合肥交警 包河大队走进辖区建筑工地为驾驶员、安全员们开展春季交通安全主题宣传活动。活动中,交警结合涉工程运输车、渣土车交通事故案例,详细讲解行驶注意事项,并普及了“一盔一带”“右转必停”等安全常识,要求驾驶员牢固树立交通安全意识,自觉遵守交通法律法规,确保出行安全。',
  49 + // newsTitle: '#平安建设双提升#【进工地,送安全】3月21日下午,@合肥交警 包河大队走进辖区建筑工地为驾驶员、安全员们开展春季交通安全主题宣传活动。活动中,交警结合涉工程运输车、渣土车交通事故案例,详细讲解行驶注意事项,并普及了“一盔一带”“右转必停”等安全常识,要求驾驶员牢固树立交通安全意识,自觉遵守交通法律法规,确保出行安全。',
  50 + // publishTime: '1711185754000',
  51 + // relType: '1',
  52 + // rmhInfo: {
  53 + // authIcon: '',
  54 + // authTitle: '',
  55 + // authTitle2: '',
  56 + // banControl: 0,
  57 + // cnIsAttention: 1,
  58 + // cnIsComment: 1,
  59 + // cnIsLike: 1,
  60 + // cnMainControl: 1,
  61 + // cnShareControl: 1,
  62 + // posterShareControl: 1,
  63 + // rmhDesc: '合肥市公安局官方人民号',
  64 + // rmhHeadUrl: 'https://uatjdcdnphoto.aikan.pdnews.cn/vod/content/202302/202302Sa121448724/TUw.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
  65 + // rmhId: '4255290',
  66 + // rmhName: '合肥警方',
  67 + // userId: '513697181730757',
  68 + // userType: '2'
  69 + // }
  70 + } as ContentDTO
  71 +
  72 + aboutToAppear(): void {
  73 + }
  74 +
  75 + build() {
  76 + Column() {
  77 + // rmh信息
  78 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
  79 + // 标题
  80 + if (this.contentDTO.newsTitle) {
  81 + Text(this.contentDTO.newsTitle)
  82 + .fontSize($r('app.float.font_size_17'))
  83 + .fontColor($r('app.color.color_222222'))
  84 + .textOverflowStyle(2)
  85 + .margin({ bottom: 8 })
  86 + }
  87 + // 图片-从无图到9图展示
  88 + createImg({ fullColumnImgUrls: this.contentDTO.fullColumnImgUrls })
  89 + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
  90 + }
  91 + .padding({
  92 + left: $r('app.float.card_comp_pagePadding_lf'),
  93 + right: $r('app.float.card_comp_pagePadding_lf'),
  94 + top: $r('app.float.card_comp_pagePadding_tb'),
  95 + bottom: $r('app.float.card_comp_pagePadding_tb')
  96 + })
  97 + }
  98 +}
  99 +
  100 +interface radiusType {
  101 + topLeft: number | Resource;
  102 + topRight: number | Resource;
  103 + bottomLeft: number | Resource;
  104 + bottomRight: number | Resource;
  105 +}
  106 +
  107 +@Component
  108 +struct createImg {
  109 + @Prop fullColumnImgUrls: FullColumnImgUrlDTO[]
  110 + aboutToAppear(): void {
  111 + if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位
  112 + this.fullColumnImgUrls.splice(2,0, {
  113 + fullUrl: ''
  114 + } as FullColumnImgUrlDTO)
  115 + }
  116 + }
  117 + caclImageRadius(index: number) {
  118 + let radius: radiusType = {
  119 + topLeft: index === 0 ? $r('app.float.image_border_radius') : 0,
  120 + topRight: 0,
  121 + bottomLeft: 0,
  122 + bottomRight: 0,
  123 + }
  124 + if (this.fullColumnImgUrls.length === 1) {
  125 + radius.topRight = index === 0 ? $r('app.float.image_border_radius') : 0
  126 + radius.bottomLeft = index === 0 ? $r('app.float.image_border_radius') : 0
  127 + radius.bottomRight = index === 0 ? $r('app.float.image_border_radius') : 0
  128 + } else if (this.fullColumnImgUrls.length === 5 && !this.fullColumnImgUrls[2].fullUrl) {
  129 + radius.topRight = index === 1 ? $r('app.float.image_border_radius') : 0
  130 + radius.bottomLeft = index === 3 ? $r('app.float.image_border_radius') : 0
  131 + radius.bottomRight = index === 4 ? $r('app.float.image_border_radius') : 0
  132 + } else {
  133 + radius.topRight = index === 2 ? $r('app.float.image_border_radius') : 0
  134 + radius.bottomLeft = index === 6 ? $r('app.float.image_border_radius') : 0
  135 + radius.bottomRight = index === 8 ? $r('app.float.image_border_radius') : 0
  136 + }
  137 + return radius
  138 + }
  139 +
  140 + build() {
  141 + GridRow({
  142 + gutter: { x: 2, y: 2 }
  143 + }) {
  144 + ForEach(this.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => {
  145 + if (this.fullColumnImgUrls.length === 1) {
  146 + GridCol({
  147 + span: { xs: 8 }
  148 + }) {
  149 + Image(item.fullUrl)
  150 + .width('100%')
  151 + .borderRadius(this.caclImageRadius(index))
  152 + }
  153 + } else if (this.fullColumnImgUrls.length === 4) {
  154 + GridCol({
  155 + span: { xs: 4 }
  156 + }) {
  157 + Image(item.fullUrl)
  158 + .aspectRatio(1)
  159 + .borderRadius(this.caclImageRadius(index))
  160 + }
  161 + } else {
  162 + GridCol({
  163 + span: { sm: 4, lg: 3 }
  164 + }) {
  165 + Image(item.fullUrl)
  166 + .aspectRatio(1)
  167 + .borderRadius(this.caclImageRadius(index))
  168 + }
  169 + }
  170 + })
  171 + }
  172 + }
  173 +}
  174 +
  175 +
  176 +@Extend(Text)
  177 +function textOverflowStyle(maxLine: number) {
  178 + .maxLines(maxLine)
  179 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  180 +}
  1 +import { ContentDTO } from 'wdBean';
  2 +import { RmhTitle } from '../cardCommon/RmhTitle'
  3 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
  4 +import { CommonConstants } from 'wdConstant/Index';
  5 +
  6 +const TAG = 'Card20Component';
  7 +
  8 +/**
  9 + * 人民号-动态---20:动态视频卡人民号 分横屏和竖屏;
  10 + */
  11 +@Component
  12 +export struct Card20Component {
  13 + @State contentDTO: ContentDTO = {
  14 + // appStyle: '20',
  15 + // coverType: 1,
  16 + // coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
  17 + // fullColumnImgUrls: [
  18 + // {
  19 + // landscape: 1,
  20 + // size: 1,
  21 + // url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
  22 + // weight: 1600
  23 + // }
  24 + // ],
  25 + // newsTitle: '好玩!》',
  26 + // rmhInfo: {
  27 + // authIcon:
  28 + // 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',
  29 + // authTitle: '10后音乐人王烁然个人人民号',
  30 + // authTitle2: '10后音乐人王烁然个人人民号',
  31 + // banControl: 0,
  32 + // cnIsAttention: 1,
  33 + // rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
  34 + // rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
  35 + // rmhName: '王烁然',
  36 + // userId: '522435359667845',
  37 + // userType: '2'
  38 + // },
  39 + // objectType: '1',
  40 + // videoInfo: {
  41 + // firstFrameImageUri: '',
  42 + // videoDuration: 37,
  43 + // videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'
  44 + // }
  45 + } as ContentDTO;
  46 +
  47 + aboutToAppear(): void {
  48 + }
  49 +
  50 + build() {
  51 + Column() {
  52 + // rmh信息
  53 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
  54 + // 标题
  55 + if (this.contentDTO.newsTitle) {
  56 + Text(this.contentDTO.newsTitle)
  57 + .fontSize($r('app.float.font_size_17'))
  58 + .fontColor($r('app.color.color_222222'))
  59 + .width(CommonConstants.FULL_WIDTH)
  60 + .textOverflowStyle(2)
  61 + .margin({ bottom: 8 })
  62 + }
  63 + if (this.contentDTO.fullColumnImgUrls[0]) {
  64 + createImg({ contentDTO: this.contentDTO })
  65 + }
  66 + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
  67 + }
  68 + .padding({
  69 + left: $r('app.float.card_comp_pagePadding_lf'),
  70 + right: $r('app.float.card_comp_pagePadding_lf'),
  71 + top: $r('app.float.card_comp_pagePadding_tb'),
  72 + bottom: $r('app.float.card_comp_pagePadding_tb')
  73 + })
  74 + }
  75 +}
  76 +
  77 +interface radiusType {
  78 + topLeft: number | Resource;
  79 + topRight: number | Resource;
  80 + bottomLeft: number | Resource;
  81 + bottomRight: number | Resource;
  82 +}
  83 +
  84 +@Component
  85 +struct createImg {
  86 + @Prop contentDTO: ContentDTO
  87 +
  88 + build() {
  89 + GridRow() {
  90 + if (this.contentDTO.fullColumnImgUrls[0].landscape === 1) {
  91 + // 横屏
  92 + GridCol({
  93 + span: { xs: 12 }
  94 + }) {
  95 + Stack() {
  96 + Image(this.contentDTO.coverUrl)
  97 + .width(CommonConstants.FULL_WIDTH)
  98 + .aspectRatio(16 / 9)
  99 + .borderRadius($r('app.float.image_border_radius'))
  100 + CardMediaInfo({ contentDTO: this.contentDTO })
  101 + }
  102 + .align(Alignment.BottomEnd)
  103 + }
  104 + } else {
  105 + // 竖图显示,宽度占50%,高度自适应
  106 + GridCol({
  107 + span: { xs: 6 }
  108 + }) {
  109 + Stack() {
  110 + Image(this.contentDTO.coverUrl)
  111 + .width(CommonConstants.FULL_WIDTH)
  112 + .borderRadius($r('app.float.image_border_radius'))
  113 + CardMediaInfo({ contentDTO: this.contentDTO })
  114 + }
  115 + .align(Alignment.BottomEnd)
  116 + }
  117 + }
  118 + }
  119 + }
  120 +}
  121 +
  122 +
  123 +@Extend(Text)
  124 +function textOverflowStyle(maxLine: number) {
  125 + .maxLines(maxLine)
  126 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  127 +}
1 //全标题 "appStyle":"2", 1 //全标题 "appStyle":"2",
2 import { ContentDTO } from 'wdBean'; 2 import { ContentDTO } from 'wdBean';
  3 +import { CommonConstants } from 'wdConstant/Index';
  4 +import { DateTimeUtils } from 'wdKit/Index';
3 import { ProcessUtils } from '../../utils/ProcessUtils'; 5 import { ProcessUtils } from '../../utils/ProcessUtils';
4 - 6 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
5 7
6 const TAG: string = 'Card2Component'; 8 const TAG: string = 'Card2Component';
7 9
@@ -12,55 +14,50 @@ const TAG: string = 'Card2Component'; @@ -12,55 +14,50 @@ const TAG: string = 'Card2Component';
12 * 卡片宽度:充满父窗口 14 * 卡片宽度:充满父窗口
13 * 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9: 15 * 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9:
14 */ 16 */
15 -// @Entry  
16 @Component 17 @Component
17 export struct Card2Component { 18 export struct Card2Component {
18 - @State contentDTO: ContentDTO = {} as ContentDTO; 19 + @State contentDTO: ContentDTO = {
  20 + // appStyle: '2',
  21 + // objectType: '1',
  22 + // coverUrl:
  23 + // 'https://rmrbcmsonline.peopleapp.com/upload/image/202404/202404141115457926.png?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90',
  24 + // newsTitle: '又见花开!新疆伊犁花海延绵清新怡人',
  25 + // publishTime: '1713067227000',
  26 + // source: '荔枝新闻',
  27 + // videoInfo: {
  28 + // videoDuration: 25,
  29 + // videoLandscape: 1,
  30 + // videoUrl:
  31 + // 'https://rmrbcmsonline.peopleapp.com/upload/video/mp4/202404/1713064515901314d148763996.mp4'
  32 + // }
  33 + } as ContentDTO;
19 34
20 build() { 35 build() {
21 Column() { 36 Column() {
22 -  
23 Column() { 37 Column() {
24 //新闻标题 38 //新闻标题
25 Text(this.contentDTO.newsTitle) 39 Text(this.contentDTO.newsTitle)
26 - .fontSize(17)  
27 - .fontColor('#222222') 40 + .fontSize($r('app.float.font_size_17'))
  41 + .fontColor($r('app.color.color_222222'))
28 .maxLines(3) 42 .maxLines(3)
29 .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 43 .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
30 .align(Alignment.Start) 44 .align(Alignment.Start)
31 //大图 45 //大图
32 Stack() { 46 Stack() {
33 Image(this.contentDTO.coverUrl) 47 Image(this.contentDTO.coverUrl)
34 - .borderRadius(4)  
35 -  
36 - 48 + .width(CommonConstants.FULL_WIDTH)
  49 + .aspectRatio(16 / 9)
  50 + .borderRadius($r('app.float.image_border_radius'))
37 //播放状态+时长 51 //播放状态+时长
38 - Row() {  
39 - Image($r('app.media.icon_live'))  
40 - .width(22)  
41 - .height(18)  
42 -  
43 - Stack() {  
44 - Text('直播中')  
45 - .fontColor('#FFFFFF')  
46 - .fontSize(11)  
47 - }  
48 - .width(44)  
49 - .height(18)  
50 - .backgroundColor('#4d000000')  
51 - }.margin({ right: 8, bottom: 8 })  
52 - 52 + CardMediaInfo({
  53 + contentDTO: this.contentDTO
  54 + })
53 } 55 }
54 - .width('100%')  
55 - .height(192)  
56 .alignContent(Alignment.BottomEnd) 56 .alignContent(Alignment.BottomEnd)
57 .margin({ top: 8 }) 57 .margin({ top: 8 })
58 -  
59 } 58 }
60 - .width('100%')  
61 - .justifyContent(FlexAlign.Start) 59 + .width(CommonConstants.FULL_WIDTH)
62 .alignItems(HorizontalAlign.Start) 60 .alignItems(HorizontalAlign.Start)
63 - .padding({ top: 14 })  
64 61
65 //bottom 62 //bottom
66 Row() { 63 Row() {
@@ -71,22 +68,21 @@ export struct Card2Component { @@ -71,22 +68,21 @@ export struct Card2Component {
71 .width(12) 68 .width(12)
72 .height(12) 69 .height(12)
73 70
74 - Text(this.contentDTO.source)  
75 - .bottomTextStyle()  
76 - Text(' ')  
77 -  
78 - Text(this.contentDTO.subtitle) 71 + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))
79 .bottomTextStyle() 72 .bottomTextStyle()
80 -  
81 } 73 }
82 - .width('100%') 74 + .width(CommonConstants.FULL_WIDTH)
83 .height(18) 75 .height(18)
84 .justifyContent(FlexAlign.Start) 76 .justifyContent(FlexAlign.Start)
85 - // .padding({bottom:14})  
86 .margin({ top: 8 }) 77 .margin({ top: 8 })
87 } 78 }
88 - .width('100%')  
89 - .padding({ left: 16, right: 16 }) 79 + .width(CommonConstants.FULL_WIDTH)
  80 + .padding({
  81 + left: $r('app.float.card_comp_pagePadding_lf'),
  82 + right: $r('app.float.card_comp_pagePadding_lf'),
  83 + top: $r('app.float.card_comp_pagePadding_tb'),
  84 + bottom: $r('app.float.card_comp_pagePadding_tb')
  85 + })
90 .onClick((event: ClickEvent) => { 86 .onClick((event: ClickEvent) => {
91 ProcessUtils.processPage(this.contentDTO) 87 ProcessUtils.processPage(this.contentDTO)
92 }) 88 })
@@ -5,10 +5,21 @@ import { ProcessUtils } from '../../utils/ProcessUtils'; @@ -5,10 +5,21 @@ import { ProcessUtils } from '../../utils/ProcessUtils';
5 5
6 /** 6 /**
7 * 卡片样式:"appStyle":"3" 7 * 卡片样式:"appStyle":"3"
  8 + * Card_03 = '3', // 无图卡(全标题)
8 */ 9 */
9 @Component 10 @Component
10 export struct Card3Component { 11 export struct Card3Component {
11 - @State contentDTO: ContentDTO = {} as ContentDTO; 12 + @State contentDTO: ContentDTO = {
  13 + // appStyle: '3',
  14 + // channelId: '2002',
  15 + // newsTitle: '习近平向斯洛伐克当选总统佩',
  16 + // objectId: '30044351686',
  17 + // objectType: '8',
  18 + // publishTime: '1712967589000',
  19 + // relId: '500005307414',
  20 + // relType: '1',
  21 + // source: '新华社',
  22 + } as ContentDTO;
12 23
13 build() { 24 build() {
14 Column() { 25 Column() {
@@ -17,35 +28,37 @@ export struct Card3Component { @@ -17,35 +28,37 @@ export struct Card3Component {
17 .fontColor($r("app.color.color_222222")) 28 .fontColor($r("app.color.color_222222"))
18 .width(CommonConstants.FULL_WIDTH) 29 .width(CommonConstants.FULL_WIDTH)
19 Row() { 30 Row() {
20 - Text("锐评")  
21 - .fontSize($r("app.float.font_size_12"))  
22 - .fontColor($r("app.color.color_ED2800"))  
23 - Text(this.contentDTO.source)  
24 - .fontSize($r("app.float.font_size_12"))  
25 - .fontColor($r("app.color.color_B0B0B0"))  
26 - .margin({ left: 6 })  
27 - Image($r("app.media.point"))  
28 - .width(16)  
29 - .height(16)  
30 -  
31 - Text(DateTimeUtils.formatDate(Number.parseFloat(this.contentDTO.publishTime))) 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)))
32 .fontSize($r("app.float.font_size_12")) 44 .fontSize($r("app.float.font_size_12"))
33 .fontColor($r("app.color.color_B0B0B0")) 45 .fontColor($r("app.color.color_B0B0B0"))
34 - 46 + .margin({ right: 6 })
  47 + // TODO '评论取哪个字段'
  48 + // Text(`1806评`)
  49 + // .fontSize($r("app.float.font_size_12"))
  50 + // .fontColor($r("app.color.color_B0B0B0"))
35 }.width(CommonConstants.FULL_WIDTH) 51 }.width(CommonConstants.FULL_WIDTH)
36 .justifyContent(FlexAlign.Start) 52 .justifyContent(FlexAlign.Start)
37 .margin({ top: 8 }) 53 .margin({ top: 8 })
38 -  
39 } 54 }
40 - .width("100%") 55 + .width(CommonConstants.FULL_WIDTH)
41 .padding({ 56 .padding({
42 - top: 14,  
43 - left: 16,  
44 - right: 16,  
45 - bottom: 14 57 + left: $r('app.float.card_comp_pagePadding_lf'),
  58 + right: $r('app.float.card_comp_pagePadding_lf'),
  59 + top: $r('app.float.card_comp_pagePadding_tb'),
  60 + bottom: $r('app.float.card_comp_pagePadding_tb')
46 }) 61 })
47 - .backgroundColor($r("app.color.white"))  
48 - .margin({ bottom: 8 })  
49 .onClick((event: ClickEvent) => { 62 .onClick((event: ClickEvent) => {
50 ProcessUtils.processPage(this.contentDTO) 63 ProcessUtils.processPage(this.contentDTO)
51 }) 64 })
1 -//全标题 "appStyle":"4",  
2 -import { ContentDTO } from 'wdBean'; 1 +import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
  2 +import { CommonConstants } from 'wdConstant/Index';
3 import { ProcessUtils } from '../../utils/ProcessUtils'; 3 import { ProcessUtils } from '../../utils/ProcessUtils';
  4 +import { DateTimeUtils } from 'wdKit/Index';
4 5
5 const TAG: string = 'Card4Component'; 6 const TAG: string = 'Card4Component';
6 7
@@ -13,50 +14,100 @@ const TAG: string = 'Card4Component'; @@ -13,50 +14,100 @@ const TAG: string = 'Card4Component';
13 */ 14 */
14 @Component 15 @Component
15 export struct Card4Component { 16 export struct Card4Component {
16 - @State contentDTO: ContentDTO = {} as ContentDTO; 17 + @State contentDTO: ContentDTO = {
  18 + // appStyle: '4',
  19 + // fullColumnImgUrls: [
  20 + // {
  21 + // format: null,
  22 + // fullUrl: '',
  23 + // height: 187,
  24 + // landscape: 1,
  25 + // size: 1,
  26 + // url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118198_0c20f7c31c7b4eca6b0d0871e7771c62.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90',
  27 + // weight: 248
  28 + // },
  29 + // {
  30 + // format: null,
  31 + // fullUrl: '',
  32 + // height: 187,
  33 + // landscape: 1,
  34 + // size: 1,
  35 + // url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118198_0c20f7c31c7b4eca6b0d0871e7771c62.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90',
  36 + // weight: 248
  37 + // },
  38 + // {
  39 + // format: null,
  40 + // fullUrl: '',
  41 + // height: 187,
  42 + // landscape: 1,
  43 + // size: 1,
  44 + // url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118200_d10309bee894a67311e6c8f77df676d4.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90',
  45 + // weight: 248
  46 + // },
  47 + // {
  48 + // format: null,
  49 + // fullUrl: '',
  50 + // height: 187,
  51 + // landscape: 1,
  52 + // size: 1,
  53 + // url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118202_f33743e452fb69ee2c45c18a56eccdf6.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90',
  54 + // weight: 248
  55 + // }
  56 + // ],
  57 + // newsTitle: '科普:如何发现家中是否有白蚁危害?丨又到白蚁分飞季②',
  58 + // rmhInfo: {
  59 + // authIcon:
  60 + // 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/blue.png',
  61 + // authTitle: '封面新闻',
  62 + // rmhDesc: '封面新闻,亿万年轻人的生活方式。',
  63 + // rmhHeadUrl:
  64 + // 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221212/122faff796.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
  65 + // rmhId: '2016608',
  66 + // rmhName: '封面新闻',
  67 + // userId: '522390888224390',
  68 + // userType: '2'
  69 + // },
  70 + // source: '头条号',
  71 + // publishTime: '1651204607000',
  72 + } as ContentDTO;
17 73
18 build() { 74 build() {
19 Column() { 75 Column() {
20 -  
21 -  
22 //body 76 //body
23 Column() { 77 Column() {
24 //新闻标题 78 //新闻标题
25 Text(this.contentDTO.newsTitle) 79 Text(this.contentDTO.newsTitle)
26 - .fontSize(17)  
27 - .fontColor('#222222') 80 + .fontSize($r('app.float.font_size_17'))
  81 + .fontColor($r('app.color.color_222222'))
28 .maxLines(3) 82 .maxLines(3)
29 .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 83 .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
30 //三图 84 //三图
31 Row() { 85 Row() {
32 - Image(this.contentDTO.fullColumnImgUrls[0]?.url)  
33 - .width('32%')  
34 -  
35 - .height(75)  
36 - .borderRadius({ topLeft:4,bottomLeft:4 })  
37 -  
38 - Image(this.contentDTO.fullColumnImgUrls[1]?.url)  
39 - .width('32%')  
40 - .height(75)  
41 -  
42 - Image(this.contentDTO.fullColumnImgUrls[2]?.url)  
43 - .width('32%')  
44 - .height(75)  
45 - .borderRadius({ topRight:4,bottomRight:4 })  
46 - 86 + GridRow({ gutter: 2 }) {
  87 + ForEach(this.contentDTO.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => {
  88 + if (index < 3) {
  89 + GridCol({ span: { xs: 4 } }) {
  90 + Image(item.url)
  91 + .width('100%')
  92 + .aspectRatio(113 / 75)
  93 + .borderRadius({
  94 + topLeft: index === 0 ? $r('app.float.image_border_radius') : 0,
  95 + topRight: index === 2 ? $r('app.float.image_border_radius') : 0,
  96 + bottomLeft: index === 0 ? $r('app.float.image_border_radius') : 0,
  97 + bottomRight: index === 2 ? $r('app.float.image_border_radius') : 0,
  98 + })
  99 + }
  100 + }
  101 + })
  102 + }
47 } 103 }
48 - .justifyContent(FlexAlign.SpaceBetween)  
49 .width('100%') 104 .width('100%')
50 - .height(75)  
51 - .margin({top:8})  
52 - .borderRadius(8)  
53 - 105 + .margin({ top: 8 })
54 } 106 }
55 .width('100%') 107 .width('100%')
56 .justifyContent(FlexAlign.Start) 108 .justifyContent(FlexAlign.Start)
57 .alignItems(HorizontalAlign.Start) 109 .alignItems(HorizontalAlign.Start)
58 - .padding({top:14})  
59 - .onClick((event: ClickEvent)=>{ 110 + .onClick((event: ClickEvent) => {
60 ProcessUtils.processPage(this.contentDTO) 111 ProcessUtils.processPage(this.contentDTO)
61 }) 112 })
62 113
@@ -69,31 +120,29 @@ export struct Card4Component { @@ -69,31 +120,29 @@ export struct Card4Component {
69 Image($r('app.media.point')) 120 Image($r('app.media.point'))
70 .width(12) 121 .width(12)
71 .height(12) 122 .height(12)
72 -  
73 - Text(this.contentDTO.publishTime)  
74 - .bottomTextStyle()  
75 - Text(' ')  
76 -  
77 - Text('518条评论') 123 + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))
78 .bottomTextStyle() 124 .bottomTextStyle()
79 - 125 + // TODO 评论字段取值
  126 + // Text('518条评论')
  127 + // .bottomTextStyle()
80 } 128 }
81 .width('100%') 129 .width('100%')
82 -  
83 .justifyContent(FlexAlign.Start) 130 .justifyContent(FlexAlign.Start)
84 - // .padding({bottom:14})  
85 - .margin({top:8})  
86 - .padding({bottom:14})  
87 - 131 + .margin({ top: 8 })
88 } 132 }
89 - .width('100%')  
90 - .padding({top:8,left:16,right:16})  
91 - 133 + .width(CommonConstants.FULL_WIDTH)
  134 + .padding({
  135 + left: $r('app.float.card_comp_pagePadding_lf'),
  136 + right: $r('app.float.card_comp_pagePadding_lf'),
  137 + top: $r('app.float.card_comp_pagePadding_tb'),
  138 + bottom: $r('app.float.card_comp_pagePadding_tb')
  139 + })
92 } 140 }
93 } 141 }
94 142
95 143
96 -@Extend(Text) function bottomTextStyle() { 144 +@Extend(Text)
  145 +function bottomTextStyle() {
97 .fontSize(12) 146 .fontSize(12)
98 .fontColor('#B0B0B0') 147 .fontColor('#B0B0B0')
99 } 148 }
@@ -5,11 +5,21 @@ import { ProcessUtils } from '../../utils/ProcessUtils'; @@ -5,11 +5,21 @@ import { ProcessUtils } from '../../utils/ProcessUtils';
5 const TAG: string = 'Card5Component'; 5 const TAG: string = 'Card5Component';
6 6
7 /** 7 /**
8 - * 卡片样式:"appStyle":"5" 8 + * 卡片样式:"appStyle":"5" 头图卡
9 */ 9 */
  10 +// @Entry
10 @Component 11 @Component
11 export struct Card5Component { 12 export struct Card5Component {
12 - @State contentDTO: ContentDTO = {} as ContentDTO; 13 + @State contentDTO: ContentDTO = {
  14 + // coverSize: '850*478',
  15 + // coverType: 1,
  16 + // coverUrl:
  17 + // 'https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20240323/image/display/54ce2de0d20842839e96a644c78361b7.jpg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
  18 + // linkUrl:
  19 + // 'https://pd-people-uat.pdnews.cn/h/atv/collect/1000000472?hiddenNavigator=1',
  20 + // newsTitle: '今天是周日,天气阴天,明天是周一。',
  21 + // objectType: '6'
  22 + } as ContentDTO;
13 23
14 build() { 24 build() {
15 Stack() { 25 Stack() {
@@ -43,8 +53,12 @@ export struct Card5Component { @@ -43,8 +53,12 @@ export struct Card5Component {
43 } 53 }
44 .alignContent(Alignment.Bottom) 54 .alignContent(Alignment.Bottom)
45 .width(CommonConstants.FULL_WIDTH) 55 .width(CommonConstants.FULL_WIDTH)
46 - .padding(  
47 - { top: 16, bottom: 16, left: 14, right: 14 }) 56 + .padding({
  57 + left: $r('app.float.card_comp_pagePadding_lf'),
  58 + right: $r('app.float.card_comp_pagePadding_lf'),
  59 + top: $r('app.float.card_comp_pagePadding_tb'),
  60 + bottom: $r('app.float.card_comp_pagePadding_tb')
  61 + })
48 .onClick((event: ClickEvent) => { 62 .onClick((event: ClickEvent) => {
49 ProcessUtils.processPage(this.contentDTO) 63 ProcessUtils.processPage(this.contentDTO)
50 }) 64 })
@@ -3,11 +3,11 @@ import { CommonConstants, CompStyle } from 'wdConstant'; @@ -3,11 +3,11 @@ import { CommonConstants, CompStyle } 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
6 -const TAG: string = 'Card6Component'; 6 +const TAG: string = 'Card6Component-Card13Component';
7 const FULL_PARENT: string = '100%'; 7 const FULL_PARENT: string = '100%';
8 8
9 /** 9 /**
10 - * 卡片样式:"appStyle":"6" 10 + * 卡片样式:"appStyle":"6"以及13
11 */ 11 */
12 @Component 12 @Component
13 export struct Card6Component { 13 export struct Card6Component {
  1 +import { RmhInfoDTO, ContentDTO, Params } from 'wdBean';
  2 +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
  3 +import { HttpUrlUtils } from 'wdNetwork/Index';
  4 +import { postInteractAccentionOperateParams } from 'wdBean';
  5 +import { PageRepository } from '../../repository/PageRepository';
  6 +import { CommonConstants } from 'wdConstant/Index';
  7 +
  8 +/**
  9 + * 人民号--推荐---没有关注的情况下,推荐的优质号主---ui称为:人民号冷启动卡
  10 + * RecommendAttentionRmh
  11 + */
  12 +const TAG = 'RecommendAttentionRmh'
  13 +
  14 +interface RmhInfo extends RmhInfoDTO {
  15 + isSelected: boolean;
  16 + headPhotoUrl: string;
  17 + introduction: string;
  18 + userName: string;
  19 +}
  20 +
  21 +@Entry
  22 +@Component
  23 +export struct RecommendAttentionRmh {
  24 + @State recommendRmhList: RmhInfo[] = [
  25 + // {
  26 + // authIcon: 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/blue.png',
  27 + // headPhotoUrl: 'https://uatjdcdnphoto.aikan.pdnews.cn/vod/content/202302/202302Sa121448724/TUw.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
  28 + // introduction: '1。',
  29 + // userName: '中国'
  30 + // } as RmhInfo,
  31 + ]
  32 + @State selectedCount: number = 0
  33 +
  34 + @Builder
  35 + buildItemCard(item: RmhInfo) {
  36 + Column() {
  37 + Image(item.headPhotoUrl)
  38 + .width(44)
  39 + .aspectRatio(1 / 1)
  40 + .margin(16)
  41 + Text(item.userName)
  42 + .fontSize(13)
  43 + .maxLines(1)
  44 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  45 + }
  46 + .width('100%')
  47 + }
  48 +
  49 + build() {
  50 + Column() {
  51 + //顶部
  52 + this.CompHeader()
  53 + GridRow({
  54 + gutter: 10,
  55 + columns: { sm: 3, md: 4, lg: 8 },
  56 + breakpoints: {
  57 + value: ['320vp', '520vp', '840vp'],
  58 + reference: BreakpointsReference.WindowSize
  59 + }
  60 + }) {
  61 + ForEach(this.recommendRmhList, (item: RmhInfo, index: number) => {
  62 + GridCol() {
  63 + CreatorItem({ item, index, list: $recommendRmhList, selectedCount: $selectedCount })
  64 + }
  65 + })
  66 + }
  67 +
  68 + Button(`一键关注(${this.selectedCount})`, { type: ButtonType.Normal })
  69 + .borderRadius($r('app.float.button_border_radius'))
  70 + .height(36)
  71 + .backgroundColor($r('app.color.color_ED2800'))
  72 + .margin({ top: 20 })
  73 + .onClick(() => {
  74 + // TODO 调用一键关注的接口
  75 + const selectedLists = this.recommendRmhList.filter(item => {
  76 + console.log(`选中状态:${item.isSelected}`)
  77 + return item.isSelected !== false
  78 + })
  79 + console.log(JSON.stringify(selectedLists))
  80 + })
  81 + }
  82 + .padding({
  83 + left: $r('app.float.card_comp_pagePadding_lf'),
  84 + right: $r('app.float.card_comp_pagePadding_lf'),
  85 + top: $r('app.float.card_comp_pagePadding_tb'),
  86 + bottom: $r('app.float.card_comp_pagePadding_tb')
  87 + })
  88 + .backgroundColor($r('app.color.white'))
  89 + .margin({ bottom: 8 })
  90 + }
  91 +
  92 + @Builder
  93 + CompHeader() {
  94 + Row() {
  95 + Row() {
  96 + Image($r("app.media.redLine"))
  97 + .width(3)
  98 + .height(16)
  99 + .margin({ right: 4 })
  100 + Text('为你推荐优质号主')
  101 + .fontSize($r("app.float.font_size_17"))
  102 + .fontColor($r("app.color.color_222222"))
  103 + .fontWeight(600)
  104 + }
  105 +
  106 + Row() {
  107 + Text("换一换")
  108 + .fontSize($r("app.float.font_size_14"))
  109 + .fontColor($r("app.color.color_999999"))
  110 + .margin({ right: 1 })
  111 + Image($r("app.media.ic_refresh"))
  112 + .width(14)
  113 + .height(14)
  114 + .onClick(() => {
  115 + // TODO 通知父组件,重新查询推荐数据
  116 + })
  117 + }
  118 + .padding({
  119 + right: $r('app.float.card_comp_pagePadding_lf'),
  120 + })
  121 + }
  122 + .justifyContent(FlexAlign.SpaceBetween)
  123 + .margin({ top: 8, bottom: 8 })
  124 + .width('100%')
  125 + }
  126 +}
  127 +
  128 +@Extend(Text)
  129 +function textOverflowStyle(maxLine: number) {
  130 + .maxLines(maxLine)
  131 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  132 +}
  133 +
  134 +@Component
  135 +struct CreatorItem {
  136 + @Prop item: RmhInfo
  137 + @Prop index: number
  138 + @Link list: RmhInfo[]
  139 + @Link selectedCount: number;
  140 + @State isSelected: boolean = true;
  141 +
  142 + getSelectedCount() {
  143 + const selected = this.list.filter(item => {
  144 + return item.isSelected !== false
  145 + })
  146 + this.selectedCount = selected.length
  147 + }
  148 +
  149 + aboutToAppear(): void {
  150 + this.getSelectedCount()
  151 + }
  152 +
  153 + build() {
  154 + Column() {
  155 + Stack() {
  156 + Image(this.item.headPhotoUrl)
  157 + .width(44)
  158 + .height(44)
  159 + if (this.isSelected) {
  160 + Image($r('app.media.MyCollection_selected_icon'))
  161 + .width(16)
  162 + .height(16)
  163 + } else {
  164 + Image($r('app.media.ic_succeed_refresh'))
  165 + .width(16)
  166 + .height(16)
  167 + }
  168 + }
  169 + .margin({ top: 2, bottom: 5 })
  170 + .alignContent(Alignment.BottomEnd)
  171 +
  172 + Flex({ justifyContent: FlexAlign.Center }) {
  173 + Text(this.item.userName)
  174 + .fontColor($r('app.color.color_222222'))
  175 + .fontSize($r('app.float.font_size_14'))
  176 + .fontWeight(500)
  177 + .textOverflowStyle(1)
  178 + .textAlign(TextAlign.Center)
  179 + Image(this.item.authIcon)
  180 + .width(14)
  181 + .height(14)
  182 + .borderRadius(50)
  183 + .flexShrink(0)
  184 + }
  185 + .width(CommonConstants.FULL_WIDTH)
  186 +
  187 + Text(this.item.introduction)
  188 + .fontColor($r('app.color.color_B0B0B0'))
  189 + .fontSize($r('app.float.font_size_12'))
  190 + .margin({ top: 8, bottom: 14 })
  191 + .textOverflowStyle(2)
  192 + .textAlign(TextAlign.Center)
  193 + }
  194 + .padding({ left: 6, right: 6 })
  195 + .width('100%')
  196 + .onClick(() => {
  197 + // 选中或者取消选中
  198 + this.isSelected = !this.isSelected
  199 + this.list[this.index].isSelected = this.isSelected
  200 + this.getSelectedCount()
  201 + })
  202 + }
  203 +}
  1 +import { CompDTO, ContentDTO } from 'wdBean';
  2 +import { CommonConstants } from 'wdConstant/Index';
  3 +
  4 +const TAG = 'Zh_Grid_Layout-02';
  5 +const FULL_PARENT: string = '100%';
  6 +let listSize: number = 2;
  7 +
  8 +/**
  9 + * 双图卡
  10 + * 枚举值Zh_Grid_Layout-02
  11 + * Zh_Grid_Layout-02
  12 + *
  13 + */
  14 +@Preview
  15 +@Component
  16 +export struct ZhGridLayout02 {
  17 + @State compDTO: CompDTO = {} as CompDTO
  18 +
  19 + aboutToAppear() {
  20 + if (this.compDTO.operDataList) {
  21 + listSize = this.compDTO.operDataList.length > 5 ? 2 : this.compDTO.operDataList.length;
  22 + }
  23 + }
  24 +
  25 + build() {
  26 + Column() {
  27 + Row() {
  28 + Image($r("app.media.redLine"))
  29 + .width(3)
  30 + .height(16)
  31 + .margin({ right: 4 })
  32 + Text(this.compDTO.objectTitle)
  33 + .fontSize($r("app.float.font_size_17"))
  34 + .fontColor($r("app.color.color_222222"))
  35 + .fontWeight(600)
  36 + }
  37 + .justifyContent(FlexAlign.Start)
  38 + .margin({ top: 8, bottom: 8 })
  39 + .width(CommonConstants.FULL_WIDTH)
  40 +
  41 +
  42 + GridRow({
  43 + columns: { sm: listSize, md: 2 },
  44 + breakpoints: { value: ['320vp', '520vp', '840vp'] }
  45 + }) {
  46 + ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
  47 + GridCol() {
  48 + this.buildItemCard(this.compDTO.operDataList[index]);
  49 + }
  50 + })
  51 + }
  52 + }
  53 + .width(CommonConstants.FULL_WIDTH)
  54 + .padding({
  55 + top: 14,
  56 + left: 16,
  57 + right: 16
  58 + })
  59 +
  60 + }
  61 +
  62 + /**
  63 + * 组件项
  64 + *
  65 + * @param programmeBean item 组件项, 上面icon,下面标题
  66 + */
  67 + @Builder
  68 + buildItemCard(item: ContentDTO) {
  69 + Column() {
  70 + Image(item.fullColumnImgUrls[0].url)
  71 + .width(170)
  72 + .height(95)
  73 + .margin(16)
  74 + Text(item.newsTitle)
  75 + .fontSize(13)
  76 + .maxLines(2)
  77 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  78 + }
  79 + .width('100%')
  80 + }
  81 +}
  82 +
  83 +
@@ -8,7 +8,6 @@ const TAG = 'Zh_Single_Column-04'; @@ -8,7 +8,6 @@ const TAG = 'Zh_Single_Column-04';
8 * 人民号主题卡 8 * 人民号主题卡
9 * 枚举值 Zh_Single_Column-04 9 * 枚举值 Zh_Single_Column-04
10 */ 10 */
11 -@Entry  
12 @Component 11 @Component
13 export struct ZhSingleColumn04 { 12 export struct ZhSingleColumn04 {
14 @State compDTO: CompDTO = {} as CompDTO 13 @State compDTO: CompDTO = {} as CompDTO
@@ -8,20 +8,35 @@ const TAG = 'Zh_Single_Column-05'; @@ -8,20 +8,35 @@ const TAG = 'Zh_Single_Column-05';
8 * 人民号入住卡 8 * 人民号入住卡
9 * 枚举值 Zh_Single_Column-05 9 * 枚举值 Zh_Single_Column-05
10 */ 10 */
11 -@Entry  
12 @Component 11 @Component
13 export struct ZhSingleColumn05 { 12 export struct ZhSingleColumn05 {
14 @State compDTO: CompDTO = {} as CompDTO 13 @State compDTO: CompDTO = {} as CompDTO
15 14
16 build() { 15 build() {
17 Row() { 16 Row() {
18 - Image($r('app.media.rmh_join_log'))  
19 - .height(18)  
20 - .margin({ right: 10 })  
21 - Text('快速入住通道')  
22 - Image($r('app.media.arrow_icon_right'))  
23 - .width(16)  
24 - .height(16) 17 + Row(){
  18 + Image($r('app.media.rmh_join_log'))
  19 + .height(18)
  20 + .margin({ right: 10 })
  21 + Text('快速入住通道')
  22 + Image($r('app.media.arrow_icon_right'))
  23 + .width(16)
  24 + .height(16)
  25 + }
  26 + .padding(10)
  27 + .width(CommonConstants.FULL_WIDTH)
  28 + .backgroundColor($r('app.color.color_F9F9F9'))
  29 + .justifyContent(FlexAlign.Center)
  30 + .borderRadius($r('app.float.button_border_radius'))
  31 + .onClick(() => {
  32 + let taskAction: Action = {
  33 + type: 'JUMP_H5_BY_WEB_VIEW',
  34 + params: {
  35 + url: this.compDTO.linkUrl
  36 + } as Params,
  37 + };
  38 + WDRouterRule.jumpWithAction(taskAction)
  39 + })
25 } 40 }
26 .width(CommonConstants.FULL_WIDTH) 41 .width(CommonConstants.FULL_WIDTH)
27 .padding({ 42 .padding({
@@ -30,17 +45,7 @@ export struct ZhSingleColumn05 { @@ -30,17 +45,7 @@ export struct ZhSingleColumn05 {
30 top: $r('app.float.card_comp_pagePadding_tb'), 45 top: $r('app.float.card_comp_pagePadding_tb'),
31 bottom: $r('app.float.card_comp_pagePadding_tb') 46 bottom: $r('app.float.card_comp_pagePadding_tb')
32 }) 47 })
33 - .backgroundColor($r('app.color.color_fff'))  
34 - .justifyContent(FlexAlign.Center)  
35 - .onClick(() => {  
36 - let taskAction: Action = {  
37 - type: 'JUMP_H5_BY_WEB_VIEW',  
38 - params: {  
39 - url: this.compDTO.linkUrl  
40 - } as Params,  
41 - };  
42 - WDRouterRule.jumpWithAction(taskAction)  
43 - }) 48 +
44 } 49 }
45 } 50 }
46 51
  1 +import { CompDTO, ContentDTO, Params } from 'wdBean';
  2 +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
  3 +import { HttpUrlUtils } from 'wdNetwork/Index';
  4 +import { postInteractAccentionOperateParams } from 'wdBean';
  5 +import { PageRepository } from '../../repository/PageRepository';
  6 +import { CommonConstants } from 'wdConstant/Index';
  7 +
  8 +/**
  9 + * 人民号横划卡
  10 + * Zh_Single_Row-05
  11 + */
  12 +const TAG = 'Zh_Single_Row-05'
  13 +
  14 +@Entry
  15 +@Component
  16 +export struct ZhSingleRow05 {
  17 + @State compDTO: CompDTO = {
  18 + // objectTitle: '创作者推荐',
  19 + // operDataList: [
  20 + // {
  21 + // rmhInfo: {
  22 + // rmhId: '2489729',
  23 + // rmhName: '陕西青年职业学院',
  24 + // rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政',
  25 + // rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' +
  26 + // '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg'
  27 + // }
  28 + // },
  29 + // ]
  30 + } as CompDTO
  31 +
  32 + build() {
  33 + Column() {
  34 + //顶部
  35 + this.CompHeader(this.compDTO)
  36 + Row(){
  37 + // 列表内容
  38 + List({ space: 8 }) {
  39 + ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
  40 + CreatorItem({
  41 + item
  42 + })
  43 + .margin({right: index === this.compDTO.operDataList.length - 1 ? $r('app.float.card_comp_pagePadding_lf') : 0})
  44 + })
  45 + }
  46 + .listDirection(Axis.Horizontal)
  47 + }
  48 + .width(CommonConstants.FULL_WIDTH)
  49 + .height(170)
  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 + .backgroundColor($r('app.color.white'))
  58 + .margin({ bottom: 8 })
  59 + }
  60 +
  61 + @Builder
  62 + CompHeader(item: CompDTO) {
  63 + Row() {
  64 + Row() {
  65 + Image($r("app.media.redLine"))
  66 + .width(3)
  67 + .height(16)
  68 + .margin({ right: 4 })
  69 + Text(item.objectTitle)
  70 + .fontSize($r("app.float.font_size_17"))
  71 + .fontColor($r("app.color.color_222222"))
  72 + .fontWeight(600)
  73 + }
  74 +
  75 + Row() {
  76 + Text("更多")
  77 + .fontSize($r("app.float.font_size_14"))
  78 + .fontColor($r("app.color.color_999999"))
  79 + .margin({ right: 1 })
  80 + Image($r("app.media.more"))
  81 + .width(14)
  82 + .height(14)
  83 + .onClick(() => {
  84 + // TODO 跳转的页面,定义的入参可能不合理。推荐id: 41
  85 + let params: Params = {
  86 + pageID: "1"
  87 + }
  88 + WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params)
  89 + })
  90 + }
  91 + .padding({
  92 + right: $r('app.float.card_comp_pagePadding_lf'),
  93 + })
  94 + }
  95 + .justifyContent(FlexAlign.SpaceBetween)
  96 + .margin({ top: 8, bottom: 8 })
  97 + .width('100%')
  98 + }
  99 +}
  100 +
  101 +@Extend(Text)
  102 +function textOverflowStyle(maxLine: number) {
  103 + .maxLines(maxLine)
  104 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  105 +}
  106 +
  107 +@Component
  108 +struct CreatorItem {
  109 + @Prop item: ContentDTO
  110 + @State rmhIsAttention: number = 0
  111 + build() {
  112 + ListItem() {
  113 + Column() {
  114 + Image(this.item.rmhInfo.rmhHeadUrl)
  115 + .width(44)
  116 + .height(44)
  117 + .margin({ top: 12, bottom: 8 })
  118 + Text(this.item.rmhInfo.rmhName)
  119 + .fontColor($r('app.color.color_222222'))
  120 + .fontSize($r('app.float.font_size_14'))
  121 + .fontWeight(500)
  122 + .textOverflowStyle(1)
  123 + Text(this.item.rmhInfo.rmhDesc)
  124 + .fontColor($r('app.color.color_B0B0B0'))
  125 + .fontSize($r('app.float.font_size_12'))
  126 + .margin({ top: 8, bottom: 14 })
  127 + .textOverflowStyle(2)
  128 + if (!this.rmhIsAttention) {
  129 + Text('关注')
  130 + .width(60)
  131 + .height(24)
  132 + .textAlign(TextAlign.Center)
  133 + .fontSize($r('app.float.font_size_12'))
  134 + .borderRadius($r('app.float.button_border_radius'))
  135 + .backgroundColor($r('app.color.color_ED2800'))
  136 + .fontColor($r('app.color.color_fff'))
  137 + .onClick(() => {
  138 + this.handleAccention(this.item, 1)
  139 + })
  140 + } else {
  141 + Text('已关注')
  142 + .width(60)
  143 + .height(24)
  144 + .borderWidth(1)
  145 + .textAlign(TextAlign.Center)
  146 + .fontSize($r('app.float.font_size_12'))
  147 + .borderRadius($r('app.float.button_border_radius'))
  148 + .borderColor($r('app.color.color_CCCCCC'))
  149 + .fontColor($r('app.color.color_CCCCCC'))
  150 + .onClick(() => {
  151 + this.handleAccention(this.item, 0)
  152 + })
  153 + }
  154 +
  155 + }
  156 + .width(100)
  157 + .height(170)
  158 + .padding({ left: 6, right: 6 })
  159 + .borderWidth(1)
  160 + .borderColor($r('app.color.color_EDEDED'))
  161 + .borderRadius($r('app.float.image_border_radius'))
  162 + }
  163 + .onClick(() => {
  164 + console.log('跳转到rmh');
  165 + })
  166 + }
  167 +
  168 + /**
  169 + * 关注号主 TODO 这里后面需要抽离
  170 + */
  171 + handleAccention(item: ContentDTO, status: number) {
  172 + this.rmhIsAttention = this.rmhIsAttention ? 0 : 1
  173 + return
  174 + // 未登录,跳转登录
  175 + if (!HttpUrlUtils.getUserId()) {
  176 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  177 + return
  178 + }
  179 +
  180 + const params: postInteractAccentionOperateParams = {
  181 + attentionUserType: item.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
  182 + attentionUserId: item.rmhInfo?.userId || '', // 被关注用户号主id
  183 + attentionCreatorId: item.rmhInfo?.rmhId || '', // 被关注用户号主id
  184 + // userType: 1,
  185 + // userId: '1', // TODO 用户id需要从本地获取
  186 + status: status,
  187 + }
  188 + PageRepository.postInteractAccentionOperate(params).then(res => {
  189 + console.log(TAG, '关注号主==', JSON.stringify(res.data))
  190 + if (status === 1) {
  191 + this.rmhIsAttention = 0
  192 + } else {
  193 + this.rmhIsAttention = 1
  194 + }
  195 + })
  196 + }
  197 +}
  1 +import lottie, { AnimationSegment } from '@ohos/lottie';
  2 +
  3 +@Component
  4 +export struct LottieView {
  5 + @Prop name: string = ''
  6 + @Prop path: string = ''
  7 + @Prop lottieWidth?: number = 30
  8 + @Prop lottieHeight?: number = 30
  9 + @Prop autoplay?: boolean = false
  10 + @Prop loop?: boolean = false
  11 + @Prop initialSegment?: AnimationSegment = [0, 120] // 动画起始帧
  12 + @Prop onReady: (animateItem: ESObject) => void // 动画初始化完成事件
  13 + @Prop onComplete?: () => void // 动画完成事件
  14 + private politeChickyController: CanvasRenderingContext2D = new CanvasRenderingContext2D(); // CanvasRenderingContext2D对象
  15 + private animateItem: ESObject = null; // 初始化loadAnimation接口的返回对象
  16 +
  17 + // 页面隐藏销毁动画
  18 + onPageHide(): void {
  19 + this.animateItem.destroy()
  20 +
  21 + if (this.onComplete) {
  22 + this.animateItem.removeEventListener('complete', this.onComplete)
  23 + }
  24 + }
  25 +
  26 + /**
  27 + * 加载动画
  28 + * @param autoplay 控制动画是否自动播放参数
  29 + */
  30 + loadAnimation() {
  31 + // 销毁动画,减少缓存
  32 + if (this.animateItem !== null) {
  33 + this.animateItem.destroy();
  34 + this.animateItem = null;
  35 + }
  36 +
  37 + this.animateItem = lottie.loadAnimation({
  38 + container: this.politeChickyController,
  39 + renderer: 'canvas',
  40 + loop: this.loop,
  41 + autoplay: this.autoplay,
  42 + name: this.name, // 动画名称
  43 + path: this.path, // hap包内动画资源文件路径,仅支持json格式
  44 + // initialSegment: this.initialSegment
  45 + })
  46 + if (this.initialSegment) {
  47 + this.animateItem.initialSegment = this.initialSegment
  48 + }
  49 +
  50 + if (this.onComplete) {
  51 + this.animateItem.addEventListener('complete', this.onComplete)
  52 + }
  53 +
  54 + }
  55 +
  56 + build() {
  57 + Stack({ alignContent: Alignment.TopStart }) {
  58 + Canvas(this.politeChickyController)
  59 + .width(this.lottieWidth)
  60 + .height(this.lottieHeight)
  61 + .onReady(() => {
  62 + this.loadAnimation();
  63 + if (this.onReady) {
  64 + this.onReady(this.animateItem)
  65 + }
  66 + })
  67 + .onClick(() => {
  68 + this.animateItem.play()
  69 + })
  70 + }
  71 + }
  72 +}
@@ -53,6 +53,7 @@ export struct FollowSecondTabsComponent{ @@ -53,6 +53,7 @@ export struct FollowSecondTabsComponent{
53 .width('100%') 53 .width('100%')
54 }.width('100%') 54 }.width('100%')
55 .alignItems(VerticalAlign.Top) 55 .alignItems(VerticalAlign.Top)
  56 + .backgroundColor('#0FF')
56 } 57 }
57 58
58 @Builder TabBuilder(index: number, item: FollowSecondListItem) { 59 @Builder TabBuilder(index: number, item: FollowSecondListItem) {
@@ -7,16 +7,24 @@ import { CompUtils } from '../../utils/CompUtils'; @@ -7,16 +7,24 @@ import { CompUtils } from '../../utils/CompUtils';
7 import PageViewModel from '../../viewmodel/PageViewModel'; 7 import PageViewModel from '../../viewmodel/PageViewModel';
8 8
9 const TAG = 'BottomNavigationComponent'; 9 const TAG = 'BottomNavigationComponent';
  10 +let storage = LocalStorage.getShared();
10 11
11 /** 12 /**
12 * 底部页签导航栏/底导 13 * 底部页签导航栏/底导
13 */ 14 */
  15 +@Entry(storage)
14 @Component 16 @Component
15 export struct BottomNavigationComponent { 17 export struct BottomNavigationComponent {
  18 + @Provide bottomRectHeight: number = 0
  19 + @Provide topRectHeight: number = 0
  20 + @Provide isLayoutFullScreen: boolean = false
  21 + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
  22 + @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
16 // 底导/顶导全部数据 23 // 底导/顶导全部数据
17 @State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = [] 24 @State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = []
18 // 底导当前选中/焦点下标 25 // 底导当前选中/焦点下标
19 @State currentNavIndex: number = BottomNavi.NEWS; 26 @State currentNavIndex: number = BottomNavi.NEWS;
  27 + @State barBackgroundColor: Color = Color.Transparent
20 // 底导TabsController 28 // 底导TabsController
21 private navController: TabsController = new TabsController(); 29 private navController: TabsController = new TabsController();
22 readonly ASPECT_RATIO_1_1: number = 1 / 1; // 底导图片宽高比 30 readonly ASPECT_RATIO_1_1: number = 1 / 1; // 底导图片宽高比
@@ -51,20 +59,44 @@ export struct BottomNavigationComponent { @@ -51,20 +59,44 @@ export struct BottomNavigationComponent {
51 // 我的页面组件数据列表 59 // 我的页面组件数据列表
52 MinePageComponent() 60 MinePageComponent()
53 } else { 61 } else {
54 - TopNavigationComponent({ topNavList: navItem.topNavChannelList, _currentNavIndex: this.currentNavIndex }) 62 + TopNavigationComponent({
  63 + topNavList: navItem.topNavChannelList,
  64 + _currentNavIndex: this.currentNavIndex,
  65 + changeBarBackgroundColor: (color: Color) => {
  66 + this.barBackgroundColor = color
  67 + }
  68 + })
55 } 69 }
  70 +
56 } 71 }
57 } 72 }
58 .tabBar(this.tabBarBuilder(navItem, index)) 73 .tabBar(this.tabBarBuilder(navItem, index))
59 }); 74 });
  75 +
60 } 76 }
61 .barHeight($r('app.float.bottom_navigation_barHeight')) 77 .barHeight($r('app.float.bottom_navigation_barHeight'))
62 .barMode(BarMode.Fixed) 78 .barMode(BarMode.Fixed)
  79 + // TODO:更详细的判断是视频频道
  80 + .barBackgroundColor(this.barBackgroundColor)
63 .onChange((index: number) => { 81 .onChange((index: number) => {
64 Logger.info(TAG, `onChange, index: ${index}`); 82 Logger.info(TAG, `onChange, index: ${index}`);
65 this.currentNavIndex = index; 83 this.currentNavIndex = index;
66 // this.onBottomNavigationIndexChange() 84 // this.onBottomNavigationIndexChange()
67 }) 85 })
  86 + .backgroundColor(this.barBackgroundColor)
  87 + .padding({ bottom: this.bottomRectHeight + 'px', top: this.topRectHeight + 'px' }) // 此处margin具体数值在实际中应与导航条区域高度保持一致
  88 +
  89 + }
  90 +
  91 + /**
  92 + * TODO:更详细的判断视频频道
  93 + */
  94 + getFontColor(index: number): Color {
  95 + if (this.currentNavIndex === 2 && this.barBackgroundColor === Color.Black) {
  96 + return Color.White
  97 + } else {
  98 + return this.currentNavIndex === index ? Color.Red : Color.Gray
  99 + }
68 } 100 }
69 101
70 @Builder 102 @Builder
@@ -79,8 +111,8 @@ export struct BottomNavigationComponent { @@ -79,8 +111,8 @@ export struct BottomNavigationComponent {
79 .margin({ bottom: $r('app.float.bottom_navigation_margin_bottom') }) 111 .margin({ bottom: $r('app.float.bottom_navigation_margin_bottom') })
80 .fontWeight(this.currentNavIndex === index ? FontWeight.Bold : FontWeight.Normal) 112 .fontWeight(this.currentNavIndex === index ? FontWeight.Bold : FontWeight.Normal)
81 .textAlign(TextAlign.Center) 113 .textAlign(TextAlign.Center)
82 - .fontSize($r('app.float.font_size_10'))  
83 - .fontColor(this.currentNavIndex === index ? Color.Red : Color.Gray) 114 + .fontSize($r('app.float.font_size_10'))// .fontColor(this.currentNavIndex === index ? Color.Red : Color.Gray)
  115 + .fontColor(this.getFontColor(index))
84 .opacity(this.currentNavIndex === index ? this.FULL_OPACITY : this.SIXTY_OPACITY) 116 .opacity(this.currentNavIndex === index ? this.FULL_OPACITY : this.SIXTY_OPACITY)
85 } 117 }
86 .height($r('app.float.bottom_navigation_barHeight')) 118 .height($r('app.float.bottom_navigation_barHeight'))
@@ -288,14 +288,15 @@ struct ChannelDialog { @@ -288,14 +288,15 @@ struct ChannelDialog {
288 .justifyContent(FlexAlign.Center) 288 .justifyContent(FlexAlign.Center)
289 .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff') 289 .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff')
290 .onClick(() => { 290 .onClick(() => {
291 - if (this.isEditIng) {  
292 - if (item.delPermitted === 1) {  
293 - this.delChannelItem(index)  
294 - }  
295 - } else {  
296 - this.confirm(index)  
297 - this.controller?.close()  
298 - } 291 + console.log('onTouch')
  292 + if (this.isEditIng) {
  293 + if (item.delPermitted === 1) {
  294 + this.delChannelItem(index)
  295 + }
  296 + } else {
  297 + this.confirm(index)
  298 + this.controller?.close()
  299 + }
299 }) 300 })
300 } 301 }
301 .width('23%') 302 .width('23%')
1 -import { CommonConstants, ViewType } from 'wdConstant'; 1 +
2 import { Logger, DateTimeUtils, CollectionUtils } from 'wdKit'; 2 import { Logger, DateTimeUtils, CollectionUtils } from 'wdKit';
  3 +import { CommonConstants, CompStyle, ViewType } from 'wdConstant';
3 import PageViewModel from '../../viewmodel/PageViewModel'; 4 import PageViewModel from '../../viewmodel/PageViewModel';
4 import { EmptyComponent } from '../view/EmptyComponent'; 5 import { EmptyComponent } from '../view/EmptyComponent';
5 import { ErrorComponent } from '../view/ErrorComponent'; 6 import { ErrorComponent } from '../view/ErrorComponent';
@@ -11,8 +12,10 @@ import NoMoreLayout from './NoMoreLayout'; @@ -11,8 +12,10 @@ import NoMoreLayout from './NoMoreLayout';
11 import LoadMoreLayout from './LoadMoreLayout'; 12 import LoadMoreLayout from './LoadMoreLayout';
12 import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; 13 import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
13 import { CompParser } from '../CompParser'; 14 import { CompParser } from '../CompParser';
14 -import { CompDTO,PageInfoDTO } from 'wdBean';  
15 import { GroupInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO'; 15 import { GroupInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO';
  16 +import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';
  17 +import { CompDTO, LiveReviewDTO, PageDTO ,PageInfoDTO} from 'wdBean';
  18 +
16 19
17 const TAG = 'PageComponent'; 20 const TAG = 'PageComponent';
18 21
@@ -22,6 +25,23 @@ export struct PageComponent { @@ -22,6 +25,23 @@ export struct PageComponent {
22 navIndex: number = 0; 25 navIndex: number = 0;
23 pageId: string = ""; 26 pageId: string = "";
24 channelId: string = ""; 27 channelId: string = "";
  28 + pageNum: number = 1;
  29 + isFirstIn: boolean = true
  30 + pageDto: PageDTO = {
  31 + pageId: '',
  32 + id: 0,
  33 + name: '',
  34 + branchMark: false,
  35 + compList: []
  36 + }
  37 + liveReviewDTO: LiveReviewDTO = {
  38 + hasNext: false,
  39 + pageNum: 0,
  40 + pageSize: 0,
  41 + totalCount: 0,
  42 + list: []
  43 + };
  44 + name: string = "";
25 @Link @Watch('onChange') currentTopNavSelectedIndex: number 45 @Link @Watch('onChange') currentTopNavSelectedIndex: number
26 46
27 build() { 47 build() {
@@ -63,7 +83,12 @@ export struct PageComponent { @@ -63,7 +83,12 @@ export struct PageComponent {
63 LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => { 83 LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {
64 ListItem() { 84 ListItem() {
65 Column() { 85 Column() {
66 - CompParser({ compDTO: compDTO, compIndex: compIndex }); 86 + if (this.name == '视频') {
  87 + VideoChannelDetail()
  88 + } else {
  89 + CompParser({ compDTO: compDTO, compIndex: compIndex });
  90 + }
  91 +
67 } 92 }
68 } 93 }
69 }, 94 },
@@ -95,63 +120,88 @@ export struct PageComponent { @@ -95,63 +120,88 @@ export struct PageComponent {
95 120
96 @Builder 121 @Builder
97 LoadingLayout() { 122 LoadingLayout() {
98 - CustomRefreshLoadLayout({ refreshBean: new RefreshLayoutBean(true,  
99 - $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.pageModel.pullDownRefreshHeight) }) 123 + CustomRefreshLoadLayout({
  124 + refreshBean: new RefreshLayoutBean(true,
  125 + $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.pageModel.pullDownRefreshHeight)
  126 + })
100 } 127 }
101 128
102 async aboutToAppear() { 129 async aboutToAppear() {
103 // 选中tab,才请求数据。拦截大量接口请求 130 // 选中tab,才请求数据。拦截大量接口请求
104 - if (this.navIndex === this.currentTopNavSelectedIndex) { 131 + if (this.navIndex === 0 && this.navIndex === this.currentTopNavSelectedIndex) {
105 this.getData(); 132 this.getData();
  133 + } else if (this.navIndex === 1) {
  134 + this.getPreviewData()
106 } 135 }
  136 +
107 } 137 }
108 138
109 onChange() { 139 onChange() {
110 - Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`);  
111 - if (this.navIndex === this.currentTopNavSelectedIndex) { 140 + Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , ${this.isFirstIn} , navIndex: ${this.currentTopNavSelectedIndex}`);
  141 + if (this.navIndex === this.currentTopNavSelectedIndex && !this.isFirstIn) {
112 this.getData(); 142 this.getData();
113 } 143 }
114 } 144 }
115 145
  146 + /**
  147 + * 要按顺序处理pageInfo.groups中的每个元素,并确保每个异步操作完成后再继续执行下一个,你应该避免使用forEach。
  148 + * 取而代之的是,你可以使用for...of循环,并配合async/await来确保按顺序执行操作。
  149 + * */
116 async getData() { 150 async getData() {
117 Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`); 151 Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
118 this.pageModel.pageId = this.pageId; 152 this.pageModel.pageId = this.pageId;
119 this.pageModel.groupId = this.pageId; 153 this.pageModel.groupId = this.pageId;
120 this.pageModel.channelId = this.channelId; 154 this.pageModel.channelId = this.channelId;
121 this.pageModel.currentPage = 1; 155 this.pageModel.currentPage = 1;
122 - let pageInfo = await PageViewModel.getPageInfo(this.pageModel.pageId); 156 + let pageInfo = await PageViewModel.getPageUrlData(this.pageModel.pageId);
123 if (pageInfo == null) { 157 if (pageInfo == null) {
124 this.pageModel.viewType = ViewType.EMPTY; 158 this.pageModel.viewType = ViewType.EMPTY;
125 return; 159 return;
126 } 160 }
127 -  
128 let groupInfo: GroupInfoDTO = CollectionUtils.getElement(pageInfo.groups, 0); 161 let groupInfo: GroupInfoDTO = CollectionUtils.getElement(pageInfo.groups, 0);
129 if (groupInfo != null) { 162 if (groupInfo != null) {
130 this.pageModel.isRecGroup = groupInfo.groupStrategy === 1; 163 this.pageModel.isRecGroup = groupInfo.groupStrategy === 1;
131 this.pageModel.groupId = groupInfo.id; 164 this.pageModel.groupId = groupInfo.id;
132 } 165 }
  166 + // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代
  167 + // for (const group of pageInfo.groups) {
  168 + this.pageDto = await PageViewModel.getPageData(this.pageModel, getContext(this))
  169 + this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
  170 + if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) {
  171 + this.pageDto.compList.forEach((comp) => {
  172 + if (comp.compStyle === CompStyle.Zh_Grid_Layout_02 && this.liveReviewDTO && this.liveReviewDTO.list && this.liveReviewDTO.list.length > 0) {
  173 + comp.operDataList.push(...this.liveReviewDTO.list)
  174 + }
  175 + })
133 176
134 - let pageDto = await PageViewModel.getPageData(this.pageModel, getContext(this))  
135 - this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()  
136 - if (pageDto && pageDto.compList && pageDto.compList.length > 0) {  
137 - this.pageModel.viewType = ViewType.LOADED;  
138 - this.pageModel.compList.push(...pageDto.compList)  
139 - if (pageDto.compList.length === this.pageModel.pageSize) {  
140 - this.pageModel.currentPage++;  
141 - this.pageModel.hasMore = true;  
142 - } else {  
143 - this.pageModel.hasMore = false;  
144 - }  
145 - // 二次请求,批查互动数据  
146 - PageViewModel.getInteractData(pageDto.compList).then((data: CompDTO[]) => {  
147 - // 刷新,替换所有数据  
148 - this.pageModel.compList.replaceAll(...data)  
149 - this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()  
150 - })  
151 - } else {  
152 - Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.');  
153 - this.pageModel.viewType = ViewType.EMPTY; 177 + this.pageModel.viewType = ViewType.LOADED;
  178 + this.pageModel.compList.push(...this.pageDto.compList)
  179 + if (this.pageDto.compList.length === this.pageModel.pageSize) {
  180 + this.pageModel.currentPage++;
  181 + this.pageModel.hasMore = true;
  182 + } else {
  183 + this.pageModel.hasMore = false;
  184 + }
  185 + // // 二次请求,批查互动数据
  186 + // PageViewModel.getInteractData(pageDto.compList).then((data: CompDTO[]) => {
  187 + // // 刷新,替换所有数据
  188 + // this.pageModel.compList.replaceAll(...data)
  189 + // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
  190 + // })
  191 + this.isFirstIn = false
  192 + Logger.debug(TAG, 'cj111');
  193 + // } else {
  194 + // Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.');
  195 + // this.pageModel.viewType = ViewType.EMPTY;
  196 + // }
154 } 197 }
  198 +
  199 + }
  200 +
  201 + async getPreviewData() {
  202 + this.liveReviewDTO = await PageViewModel.getLiveReviewUrl(this.pageNum, this.pageModel.pageSize)
  203 + Logger.debug(TAG, 'aboutToAppear, getPreviewData ' + this.liveReviewDTO.hasNext);
  204 + this.getData();
155 } 205 }
156 } 206 }
157 207