Showing
71 changed files
with
2805 additions
and
827 deletions
Too many changes to show.
To preserve performance only 71 of 71+ files are displayed.
| @@ -11,8 +11,13 @@ export class SpConstants{ | @@ -11,8 +11,13 @@ export class SpConstants{ | ||
| 11 | static USER_TEMP_TOKEN="tempToken" | 11 | static USER_TEMP_TOKEN="tempToken" |
| 12 | static USER_PHONE = "user_phone" | 12 | static USER_PHONE = "user_phone" |
| 13 | //协议相关 | 13 | //协议相关 |
| 14 | - static USER_PROTOCOL = "user_protocol" //用户协议 | ||
| 15 | - static PRIVATE_PROTOCOL = "private_protocol" //隐私协议 | 14 | + static NET_SERVICE_PROTOCOL = "user_protocol" //人民日报客户端网络服务使用协议 |
| 15 | + static PRIVATE_PROTOCOL = "private_protocol" //人民日报客户端用户隐私协议 | ||
| 16 | + static LOGOUT_PROTOCOL = "logout_protocol" //人民日报客户端app注销协议 | ||
| 17 | + static MESSAGE_BOARD_USER_PROTOCOL = "message_board_user_protocol" //"留言板-用户协议" | ||
| 18 | + static MESSAGE_BOARD_NOTICE_PROTOCOL = "message_board_notice_protocol" //留言板-留言须知 | ||
| 19 | + static MESSAGE_BOARD_QUESTION_PROTOCOL = "message_board_question_protocol" //"留言板-发布提问规定"" | ||
| 20 | + static MESSAGE_BOARD_PRIVATE_PROTOCOL = "message_board_private_protocol" //"留言板-隐私政策" | ||
| 16 | //设置页面 | 21 | //设置页面 |
| 17 | static SETTING_WIFI_IMAGE_SWITCH = "setting_wifi_switch" //wifi 图片开关 | 22 | static SETTING_WIFI_IMAGE_SWITCH = "setting_wifi_switch" //wifi 图片开关 |
| 18 | static SETTING_WIFI_VIDEO_SWITCH = "setting_wifi_switch" //wifi 视频开关 | 23 | static SETTING_WIFI_VIDEO_SWITCH = "setting_wifi_switch" //wifi 视频开关 |
| @@ -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 | } |
| 1 | +/** | ||
| 2 | + * https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-window-0000001820880785#ZH-CN_TOPIC_0000001811317218__systembarproperties | ||
| 3 | + * 状态栏、导航栏的属性。 | ||
| 4 | + */ | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 状态栏背景颜色 statusBarColor | ||
| 8 | + * 导航栏背景颜色 navigationBarColor | ||
| 9 | + */ | ||
| 10 | +export const enum SysStatusBarColor { | ||
| 11 | + WHITE = '#ffffff', | ||
| 12 | + BLACK = '#000000', | ||
| 13 | + DEFAULT = '#0x66000000' | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * 状态栏文字颜色 statusBarContentColor8 | ||
| 19 | + * 导航栏文字颜色 navigationBarContentColor8 | ||
| 20 | + */ | ||
| 21 | +export const enum SysBarContentColor { | ||
| 22 | + WHITE = '#ffffff', | ||
| 23 | + BLACK = '#000000', | ||
| 24 | + DEFAULT = '0xE5FFFFFF' | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | + | ||
| 28 | + |
| 1 | import { Action } from './Action'; | 1 | import { Action } from './Action'; |
| 2 | - | 2 | +interface dataObject { |
| 3 | + webViewHeight?: string | ||
| 4 | + dataJson?: string | ||
| 5 | +} | ||
| 3 | /** | 6 | /** |
| 4 | * 消息Message | 7 | * 消息Message |
| 5 | */ | 8 | */ |
| @@ -7,7 +10,7 @@ export class Message { | @@ -7,7 +10,7 @@ export class Message { | ||
| 7 | callbackId: string = ""; //callbackId | 10 | callbackId: string = ""; //callbackId |
| 8 | responseId: string = ""; //responseId | 11 | responseId: string = ""; //responseId |
| 9 | responseData: string = ""; //responseData | 12 | responseData: string = ""; //responseData |
| 10 | - data?: object; //data of message | 13 | + data?: dataObject; //data of message |
| 11 | handlerName: string = ""; //name of handler | 14 | handlerName: string = ""; //name of handler |
| 12 | 15 | ||
| 13 | /** | 16 | /** |
| @@ -36,6 +36,10 @@ export { UserDataLocal } from './src/main/ets/utils/UserDataLocal' | @@ -36,6 +36,10 @@ export { UserDataLocal } from './src/main/ets/utils/UserDataLocal' | ||
| 36 | 36 | ||
| 37 | export { NumberFormatterUtils } from './src/main/ets/utils/NumberFormatterUtils' | 37 | export { NumberFormatterUtils } from './src/main/ets/utils/NumberFormatterUtils' |
| 38 | 38 | ||
| 39 | -// export { PermissionUtils } from './src/main/ets/utils/PermissionUtils' | 39 | +export { PermissionUtils } from './src/main/ets/utils/PermissionUtils' |
| 40 | 40 | ||
| 41 | -export { ErrorToastUtils } from './src/main/ets/utils/ErrorToastUtils' | ||
| 41 | +export { ErrorToastUtils } from './src/main/ets/utils/ErrorToastUtils' | ||
| 42 | + | ||
| 43 | +export { EmitterUtils } from './src/main/ets/utils/EmitterUtils' | ||
| 44 | + | ||
| 45 | +export { EmitterEventId } from './src/main/ets/utils/EmitterEventId' |
| @@ -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 { |
| @@ -65,6 +65,13 @@ export class CollectionUtils { | @@ -65,6 +65,13 @@ export class CollectionUtils { | ||
| 65 | return collection.length > 0; | 65 | return collection.length > 0; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | + static getElement(collection?: any[], index?: number): any { | ||
| 69 | + if (CollectionUtils.isEmpty(collection) || index === undefined) { | ||
| 70 | + return null; | ||
| 71 | + } | ||
| 72 | + return index >= 0 && index < collection.length ? collection[index] : null; | ||
| 73 | + } | ||
| 74 | + | ||
| 68 | static getListSize(collection?: any[]): number { | 75 | static getListSize(collection?: any[]): number { |
| 69 | return CollectionUtils.isEmpty(collection) ? 0 : collection.length; | 76 | return CollectionUtils.isEmpty(collection) ? 0 : collection.length; |
| 70 | } | 77 | } |
| @@ -179,5 +186,6 @@ export class CollectionUtils { | @@ -179,5 +186,6 @@ export class CollectionUtils { | ||
| 179 | ss; | 186 | ss; |
| 180 | return collection.slice(start, end); | 187 | return collection.slice(start, end); |
| 181 | } | 188 | } |
| 189 | + | ||
| 182 | } | 190 | } |
| 183 | 191 |
| 1 | import { StringUtils } from './StringUtils'; | 1 | import { StringUtils } from './StringUtils'; |
| 2 | -import getLunar from './GetLunar' | 2 | +import getLunar from './GetLunar'; |
| 3 | + | ||
| 3 | /** | 4 | /** |
| 4 | * 日期/时间工具 | 5 | * 日期/时间工具 |
| 5 | */ | 6 | */ |
| @@ -480,6 +481,34 @@ export class DateTimeUtils { | @@ -480,6 +481,34 @@ export class DateTimeUtils { | ||
| 480 | return 0 | 481 | return 0 |
| 481 | } | 482 | } |
| 482 | } | 483 | } |
| 484 | + /** | ||
| 485 | + * 进度值换算 | ||
| 486 | + * @param seconds | ||
| 487 | + * @returns | ||
| 488 | + */ | ||
| 489 | + static secondToTime(seconds: number) { | ||
| 490 | + let time = '00:00' | ||
| 491 | + let hourUnit = 60 * 60; | ||
| 492 | + let hour = Math.floor(seconds / hourUnit); | ||
| 493 | + let minute = Math.floor((seconds - hour * hourUnit) / 60); | ||
| 494 | + let second = seconds - hour * hourUnit - minute * 60; | ||
| 495 | + if (hour > 0) { | ||
| 496 | + return `${DateTimeUtils.padding(hour.toString())}${':'}${DateTimeUtils.padding(minute.toString())}${':'}${DateTimeUtils.padding(second.toString())}`; | ||
| 497 | + } | ||
| 498 | + if (minute > 0) { | ||
| 499 | + return `${DateTimeUtils.padding(minute.toString())}${':'}${DateTimeUtils.padding(second.toString())}`; | ||
| 500 | + } else { | ||
| 501 | + return `${'00'}${':'}${DateTimeUtils.padding(second.toString())}`; | ||
| 502 | + } | ||
| 503 | + } | ||
| 504 | + | ||
| 505 | + static padding(num: string) { | ||
| 506 | + let length = 2; | ||
| 507 | + for (let len = (num.toString()).length; len < length; len = num.length) { | ||
| 508 | + num = `${'0'}${num}`; | ||
| 509 | + } | ||
| 510 | + return num; | ||
| 511 | + } | ||
| 483 | } | 512 | } |
| 484 | 513 | ||
| 485 | // const dateTimeUtils = new DateTimeUtils() | 514 | // const dateTimeUtils = new DateTimeUtils() |
| 1 | +import emitter from '@ohos.events.emitter'; | ||
| 2 | + | ||
| 3 | +const TAG: string = 'EmitterUtils'; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 线程间通信简单工具 | ||
| 7 | + */ | ||
| 8 | +export class EmitterUtils { | ||
| 9 | + /** | ||
| 10 | + * 发送空消息 | ||
| 11 | + * @param eventId 事件id | ||
| 12 | + */ | ||
| 13 | + static sendEmptyEvent(eventId: number) { | ||
| 14 | + let event: emitter.InnerEvent = { | ||
| 15 | + eventId: eventId, | ||
| 16 | + priority: emitter.EventPriority.LOW | ||
| 17 | + }; | ||
| 18 | + emitter.emit(event); | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 发送消息 | ||
| 23 | + * @param eventId 事件id | ||
| 24 | + * @param str 字符串数据 | ||
| 25 | + */ | ||
| 26 | + static sendEvent(eventId: number, str?: string) { | ||
| 27 | + let event: emitter.InnerEvent = { | ||
| 28 | + eventId: eventId, | ||
| 29 | + priority: emitter.EventPriority.LOW | ||
| 30 | + }; | ||
| 31 | + let eventData: emitter.EventData = { | ||
| 32 | + data: { | ||
| 33 | + jsonStr: str | ||
| 34 | + } | ||
| 35 | + }; | ||
| 36 | + emitter.emit(event, eventData); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 接收消息 | ||
| 41 | + * @param eventId 事件id | ||
| 42 | + * @param callback 回调函数 | ||
| 43 | + */ | ||
| 44 | + static receiveEvent(eventId: number, callback: (str?: string) => void) { | ||
| 45 | + let event: emitter.InnerEvent = { | ||
| 46 | + eventId: eventId | ||
| 47 | + }; | ||
| 48 | + | ||
| 49 | + // 收到eventId事件后执行该回调 | ||
| 50 | + let callback1 = (eventData?: emitter.EventData): void => { | ||
| 51 | + if (eventData && eventData.data) { | ||
| 52 | + try { | ||
| 53 | + let jsonObject: EmitterBean = JSON.parse(JSON.stringify(eventData.data)) | ||
| 54 | + callback(jsonObject.jsonStr) | ||
| 55 | + } catch (err) { | ||
| 56 | + callback() | ||
| 57 | + } | ||
| 58 | + } else { | ||
| 59 | + callback() | ||
| 60 | + } | ||
| 61 | + }; | ||
| 62 | + // 订阅eventId事件 | ||
| 63 | + emitter.on(event, callback1); | ||
| 64 | + } | ||
| 65 | +} | ||
| 66 | + | ||
| 67 | +interface EmitterBean { | ||
| 68 | + jsonStr: string | ||
| 69 | +} |
| @@ -7,7 +7,17 @@ export namespace ErrorToastUtils { | @@ -7,7 +7,17 @@ export namespace ErrorToastUtils { | ||
| 7 | NET_CORE_PAGE_ERROR_NETWORK, //网络出小差了,请检查网络后重试 | 7 | NET_CORE_PAGE_ERROR_NETWORK, //网络出小差了,请检查网络后重试 |
| 8 | NET_CORE_LOAD_ERROR_NETWORK, //加载失败,请重试 | 8 | NET_CORE_LOAD_ERROR_NETWORK, //加载失败,请重试 |
| 9 | NET_CORE_ENTER_ERROR_NETWORK, //很抱歉,当前内容无法加载,请点击重试 | 9 | NET_CORE_ENTER_ERROR_NETWORK, //很抱歉,当前内容无法加载,请点击重试 |
| 10 | - LIVE_CORE_NO_NETWORK, //网络出小差了,请检查下网络 | 10 | + |
| 11 | + //直播异常 | ||
| 12 | + LIVE_CORE_NO_NETWORK, //直播 无网络 网络出小差了,请检查下网络 | ||
| 13 | + LIVE_CORE_WEAK_NETWORK, //直播 弱网 网络出小差了,请检查下网络 | ||
| 14 | + LIVE_CORE_IO_NETWORK, //直播 直播流异常 直播加载异常 | ||
| 15 | + LIVE_CORE_SERVICE_NETWORK, //直播 服务端接口异常 直播加载异常 | ||
| 16 | + LIVE_CORE_SWITCH_FLOW_NETWORK, //直播 网络切换到流量 正在使用流量,请注意流量使用 | ||
| 17 | + | ||
| 18 | + //审核后异常报错 | ||
| 19 | + AUDITING_CORE_CONTENT_DISTRIBUTE, //审核 内容分发下线规则 内容已下线 | ||
| 20 | + AUDITING_CORE_ACCOUNT_ERROR, //审核 账号有问题下线规则 内容已下线 | ||
| 11 | 21 | ||
| 12 | } | 22 | } |
| 13 | 23 | ||
| @@ -32,6 +42,27 @@ export namespace ErrorToastUtils { | @@ -32,6 +42,27 @@ export namespace ErrorToastUtils { | ||
| 32 | case ErrorType.LIVE_CORE_NO_NETWORK: | 42 | case ErrorType.LIVE_CORE_NO_NETWORK: |
| 33 | ToastUtils.shortToast($r('app.string.live_core_no_network')) | 43 | ToastUtils.shortToast($r('app.string.live_core_no_network')) |
| 34 | break | 44 | break |
| 45 | + case ErrorType.LIVE_CORE_WEAK_NETWORK: | ||
| 46 | + ToastUtils.shortToast($r('app.string.live_core_weak_network')) | ||
| 47 | + break | ||
| 48 | + case ErrorType.LIVE_CORE_IO_NETWORK: | ||
| 49 | + ToastUtils.shortToast($r('app.string.live_core_io_network')) | ||
| 50 | + break | ||
| 51 | + case ErrorType.LIVE_CORE_SERVICE_NETWORK: | ||
| 52 | + ToastUtils.shortToast($r('app.string.live_core_service_network')) | ||
| 53 | + break | ||
| 54 | + case ErrorType.LIVE_CORE_SWITCH_FLOW_NETWORK: | ||
| 55 | + ToastUtils.shortToast($r('app.string.live_core_switch_flow_network')) | ||
| 56 | + break | ||
| 57 | + case ErrorType.LIVE_CORE_SWITCH_FLOW_NETWORK: | ||
| 58 | + ToastUtils.shortToast($r('app.string.live_core_switch_flow_network')) | ||
| 59 | + break | ||
| 60 | + case ErrorType.AUDITING_CORE_CONTENT_DISTRIBUTE: | ||
| 61 | + ToastUtils.shortToast($r('app.string.auditing_core_error')) | ||
| 62 | + break | ||
| 63 | + case ErrorType.AUDITING_CORE_ACCOUNT_ERROR: | ||
| 64 | + ToastUtils.shortToast($r('app.string.auditing_core_error')) | ||
| 65 | + break | ||
| 35 | } | 66 | } |
| 36 | 67 | ||
| 37 | } | 68 | } |
| 1 | -// import { abilityAccessCtrl, bundleManager, common, Permissions, Want } from '@kit.AbilityKit' | ||
| 2 | -// import { BusinessError } from '@kit.BasicServicesKit' | ||
| 3 | -// import { AppUtils } from './AppUtils' | ||
| 4 | -// import { Logger } from './Logger' | ||
| 5 | -// | ||
| 6 | -// /** | ||
| 7 | -// * 权限工具类 | ||
| 8 | -// * */ | ||
| 9 | -// export class PermissionUtils { | ||
| 10 | -// //相机权限 | ||
| 11 | -// static CAMERA: Permissions = 'ohos.permission.CAMERA' | ||
| 12 | -// //文件权限 | ||
| 13 | -// static READ_MEDIA: Permissions = 'ohos.permission.READ_MEDIA' | ||
| 14 | -// static WRITE_MEDIA: Permissions = 'ohos.permission.WRITE_MEDIA' | ||
| 15 | -// private static tokenId: number = 0 | ||
| 16 | -// | ||
| 17 | -// /**检查权限是否授权*/ | ||
| 18 | -// static async checkPermissions(permission: Permissions): Promise<boolean> { | ||
| 19 | -// let hasPermissions = false; | ||
| 20 | -// let grantStatus: abilityAccessCtrl.GrantStatus = await PermissionUtils.checkAccessToken(permission); | ||
| 21 | -// | ||
| 22 | -// if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) { | ||
| 23 | -// // 已经授权,可以继续访问目标操作 | ||
| 24 | -// hasPermissions = true; | ||
| 25 | -// } else { | ||
| 26 | -// hasPermissions = false; | ||
| 27 | -// // 申请日历权限 | ||
| 28 | -// } | ||
| 29 | -// return hasPermissions; | ||
| 30 | -// } | ||
| 31 | -// | ||
| 32 | -// /**动态申请权限*/ | ||
| 33 | -// static reqPermissionsFromUser(permissions: Array<Permissions>, component: Object): Promise<boolean> { | ||
| 34 | -// | ||
| 35 | -// return new Promise((resolve, fail) => { | ||
| 36 | -// let context = getContext(component) as common.UIAbilityContext; | ||
| 37 | -// let atManager = abilityAccessCtrl.createAtManager(); | ||
| 38 | -// atManager.requestPermissionsFromUser(context, permissions).then((data) => { | ||
| 39 | -// let grantStatus: Array<number> = data.authResults; | ||
| 40 | -// let length: number = grantStatus.length; | ||
| 41 | -// | ||
| 42 | -// for (let i = 0; i < length; i++) { | ||
| 43 | -// if (grantStatus[i] === 0) { | ||
| 44 | -// // 用户授权,可以继续访问目标操作 | ||
| 45 | -// resolve(true); | ||
| 46 | -// } else { | ||
| 47 | -// resolve(false) | ||
| 48 | -// } | ||
| 49 | -// } | ||
| 50 | -// }).catch((err: Error) => { | ||
| 51 | -// fail(err) | ||
| 52 | -// }) | ||
| 53 | -// }); | ||
| 54 | -// } | ||
| 55 | -// | ||
| 56 | -// /**跳转设置页面*/ | ||
| 57 | -// static openPermissionsInSystemSettings(context: Object): void { | ||
| 58 | -// let uiContext = getContext(context) as common.UIAbilityContext; | ||
| 59 | -// let wantInfo: Want = { | ||
| 60 | -// bundleName: 'com.huawei.hmos.settings', | ||
| 61 | -// abilityName: 'com.huawei.hmos.settings.MainAbility', | ||
| 62 | -// uri: 'application_info_entry', | ||
| 63 | -// parameters: { | ||
| 64 | -// pushParams: AppUtils.getPackageName(uiContext) // 打开指定应用的设置页面 | ||
| 65 | -// } | ||
| 66 | -// } | ||
| 67 | -// uiContext.startAbility(wantInfo) | ||
| 68 | -// } | ||
| 69 | -// | ||
| 70 | -// private static async checkAccessToken(permission: Permissions): Promise<abilityAccessCtrl.GrantStatus> { | ||
| 71 | -// let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); | ||
| 72 | -// let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED; | ||
| 73 | -// | ||
| 74 | -// // 获取应用程序的accessTokenID | ||
| 75 | -// if (PermissionUtils.tokenId == 0) { | ||
| 76 | -// try { | ||
| 77 | -// let bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION); | ||
| 78 | -// let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo; | ||
| 79 | -// PermissionUtils.tokenId = appInfo.accessTokenId; | ||
| 80 | -// } catch (error) { | ||
| 81 | -// const err: BusinessError = error as BusinessError; | ||
| 82 | -// } | ||
| 83 | -// } | ||
| 84 | -// // 校验应用是否被授予权限 | ||
| 85 | -// try { | ||
| 86 | -// grantStatus = await atManager.checkAccessToken(PermissionUtils.tokenId, permission); | ||
| 87 | -// } catch (error) { | ||
| 88 | -// const err: BusinessError = error as BusinessError; | ||
| 89 | -// } | ||
| 90 | -// | ||
| 91 | -// return grantStatus; | ||
| 92 | -// } | ||
| 93 | -// | ||
| 94 | -// } | ||
| 1 | +import { abilityAccessCtrl, bundleManager, common, Permissions, Want } from '@kit.AbilityKit' | ||
| 2 | +import { BusinessError } from '@kit.BasicServicesKit' | ||
| 3 | +import { AppUtils } from './AppUtils' | ||
| 4 | +import { Logger } from './Logger' | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 权限工具类 | ||
| 8 | + * */ | ||
| 9 | +export class PermissionUtils { | ||
| 10 | + //相机权限 | ||
| 11 | + static CAMERA: Permissions = 'ohos.permission.CAMERA' | ||
| 12 | + //文件权限 | ||
| 13 | + static READ_MEDIA: Permissions = 'ohos.permission.READ_MEDIA' | ||
| 14 | + static WRITE_MEDIA: Permissions = 'ohos.permission.WRITE_MEDIA' | ||
| 15 | + private static tokenId: number = 0 | ||
| 16 | + | ||
| 17 | + /**检查权限是否授权*/ | ||
| 18 | + static async checkPermissions(permission: Permissions): Promise<boolean> { | ||
| 19 | + let hasPermissions = false; | ||
| 20 | + let grantStatus: abilityAccessCtrl.GrantStatus = await PermissionUtils.checkAccessToken(permission); | ||
| 21 | + | ||
| 22 | + if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) { | ||
| 23 | + // 已经授权,可以继续访问目标操作 | ||
| 24 | + hasPermissions = true; | ||
| 25 | + } else { | ||
| 26 | + hasPermissions = false; | ||
| 27 | + // 申请日历权限 | ||
| 28 | + } | ||
| 29 | + return hasPermissions; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + /**动态申请权限*/ | ||
| 33 | + static reqPermissionsFromUser(permissions: Array<Permissions>, component: Object): Promise<boolean> { | ||
| 34 | + | ||
| 35 | + return new Promise((resolve, fail) => { | ||
| 36 | + let context = getContext(component) as common.UIAbilityContext; | ||
| 37 | + let atManager = abilityAccessCtrl.createAtManager(); | ||
| 38 | + atManager.requestPermissionsFromUser(context, permissions).then((data) => { | ||
| 39 | + let grantStatus: Array<number> = data.authResults; | ||
| 40 | + let length: number = grantStatus.length; | ||
| 41 | + | ||
| 42 | + for (let i = 0; i < length; i++) { | ||
| 43 | + if (grantStatus[i] === 0) { | ||
| 44 | + // 用户授权,可以继续访问目标操作 | ||
| 45 | + resolve(true); | ||
| 46 | + } else { | ||
| 47 | + resolve(false) | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + }).catch((err: Error) => { | ||
| 51 | + fail(err) | ||
| 52 | + }) | ||
| 53 | + }); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + /**跳转设置页面*/ | ||
| 57 | + static openPermissionsInSystemSettings(context: Object): void { | ||
| 58 | + let uiContext = getContext(context) as common.UIAbilityContext; | ||
| 59 | + let wantInfo: Want = { | ||
| 60 | + bundleName: 'com.huawei.hmos.settings', | ||
| 61 | + abilityName: 'com.huawei.hmos.settings.MainAbility', | ||
| 62 | + uri: 'application_info_entry', | ||
| 63 | + parameters: { | ||
| 64 | + pushParams: AppUtils.getPackageName(uiContext) // 打开指定应用的设置页面 | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + uiContext.startAbility(wantInfo) | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + private static async checkAccessToken(permission: Permissions): Promise<abilityAccessCtrl.GrantStatus> { | ||
| 71 | + let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); | ||
| 72 | + let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED; | ||
| 73 | + | ||
| 74 | + // 获取应用程序的accessTokenID | ||
| 75 | + if (PermissionUtils.tokenId == 0) { | ||
| 76 | + try { | ||
| 77 | + let bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION); | ||
| 78 | + let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo; | ||
| 79 | + PermissionUtils.tokenId = appInfo.accessTokenId; | ||
| 80 | + } catch (error) { | ||
| 81 | + const err: BusinessError = error as BusinessError; | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + // 校验应用是否被授予权限 | ||
| 85 | + try { | ||
| 86 | + grantStatus = await atManager.checkAccessToken(PermissionUtils.tokenId, permission); | ||
| 87 | + } catch (error) { | ||
| 88 | + const err: BusinessError = error as BusinessError; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + return grantStatus; | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | +} |
| 1 | import window from '@ohos.window'; | 1 | import window from '@ohos.window'; |
| 2 | -import { BusinessError } from '@ohos.base'; | 2 | +import { AsyncCallback, BusinessError } from '@ohos.base'; |
| 3 | import deviceInfo from '@ohos.deviceInfo' | 3 | import deviceInfo from '@ohos.deviceInfo' |
| 4 | import display from '@ohos.display'; | 4 | import display from '@ohos.display'; |
| 5 | 5 | ||
| 6 | + | ||
| 7 | +interface SystemBarProperties { | ||
| 8 | + statusBarColor?: string; | ||
| 9 | + isStatusBarLightIcon?: boolean; | ||
| 10 | + statusBarContentColor?: string; | ||
| 11 | + navigationBarColor?: string; | ||
| 12 | + isNavigationBarLightIcon?: boolean; | ||
| 13 | + navigationBarContentColor?: string; | ||
| 14 | +} | ||
| 15 | + | ||
| 6 | export class Size { | 16 | export class Size { |
| 7 | width: number = 0 | 17 | width: number = 0 |
| 8 | height: number = 0 | 18 | height: number = 0 |
| @@ -15,13 +25,21 @@ export class Size { | @@ -15,13 +25,21 @@ export class Size { | ||
| 15 | 25 | ||
| 16 | export class WindowModel { | 26 | export class WindowModel { |
| 17 | private windowStage?: window.WindowStage; | 27 | private windowStage?: window.WindowStage; |
| 18 | - | 28 | + private windowClass?: window.Window; |
| 19 | static shared: WindowModel = new WindowModel() | 29 | static shared: WindowModel = new WindowModel() |
| 20 | - | ||
| 21 | static TAG = "WindowModel"; | 30 | static TAG = "WindowModel"; |
| 22 | 31 | ||
| 23 | setWindowStage(windowStage: window.WindowStage) { | 32 | setWindowStage(windowStage: window.WindowStage) { |
| 24 | this.windowStage = windowStage; | 33 | this.windowStage = windowStage; |
| 34 | + this.windowClass = windowStage.getMainWindowSync(); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + getWindowStage(): window.WindowStage { | ||
| 38 | + return this.windowStage as window.WindowStage | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + getWindowClass(): window.Window { | ||
| 42 | + return this.windowClass as window.Window | ||
| 25 | } | 43 | } |
| 26 | 44 | ||
| 27 | setMainWindowFullScreen(fullScreen: boolean) { | 45 | setMainWindowFullScreen(fullScreen: boolean) { |
| @@ -65,10 +83,10 @@ export class WindowModel { | @@ -65,10 +83,10 @@ export class WindowModel { | ||
| 65 | windowClass.setWindowKeepScreenOn(isKeepScreenOn, (err: BusinessError) => { | 83 | windowClass.setWindowKeepScreenOn(isKeepScreenOn, (err: BusinessError) => { |
| 66 | const errCode: number = err.code; | 84 | const errCode: number = err.code; |
| 67 | if (errCode) { | 85 | if (errCode) { |
| 68 | - console.error(WindowModel.TAG +'设置屏幕常亮:' + isKeepScreenOn + ',失败: ' + JSON.stringify(err)); | 86 | + console.error(WindowModel.TAG + '设置屏幕常亮:' + isKeepScreenOn + ',失败: ' + JSON.stringify(err)); |
| 69 | return; | 87 | return; |
| 70 | } | 88 | } |
| 71 | - console.info(WindowModel.TAG +'设置屏幕常亮:' + isKeepScreenOn + ",成功"); | 89 | + console.info(WindowModel.TAG + '设置屏幕常亮:' + isKeepScreenOn + ",成功"); |
| 72 | }) | 90 | }) |
| 73 | }) | 91 | }) |
| 74 | } | 92 | } |
| @@ -101,5 +119,17 @@ export class WindowModel { | @@ -101,5 +119,17 @@ export class WindowModel { | ||
| 101 | }); | 119 | }); |
| 102 | }) | 120 | }) |
| 103 | } | 121 | } |
| 122 | + | ||
| 123 | + /** | ||
| 124 | + * 设置窗口全屏模式时窗口内导航栏、状态栏的属性,使用callback异步回调。 | ||
| 125 | + * @param systemBarProperties | ||
| 126 | + * @param callback | ||
| 127 | + */ | ||
| 128 | + setWindowSystemBarProperties(systemBarProperties: SystemBarProperties, callback?: AsyncCallback<void>): void { | ||
| 129 | + this.windowClass?.setWindowSystemBarProperties(systemBarProperties, (err: BusinessError) => { | ||
| 130 | + callback && callback(err) | ||
| 131 | + }) | ||
| 132 | + | ||
| 133 | + } | ||
| 104 | } | 134 | } |
| 105 | 135 |
| @@ -27,6 +27,26 @@ | @@ -27,6 +27,26 @@ | ||
| 27 | { | 27 | { |
| 28 | "name": "live_core_no_network", | 28 | "name": "live_core_no_network", |
| 29 | "value": "网络出小差了,请检查下网络" | 29 | "value": "网络出小差了,请检查下网络" |
| 30 | + }, | ||
| 31 | + { | ||
| 32 | + "name": "live_core_weak_network", | ||
| 33 | + "value": "网络出小差了,请检查下网络" | ||
| 34 | + }, | ||
| 35 | + { | ||
| 36 | + "name": "live_core_io_network", | ||
| 37 | + "value": "直播加载异常" | ||
| 38 | + }, | ||
| 39 | + { | ||
| 40 | + "name": "live_core_service_network", | ||
| 41 | + "value": "直播加载异常" | ||
| 42 | + }, | ||
| 43 | + { | ||
| 44 | + "name": "live_core_switch_flow_network", | ||
| 45 | + "value": "正在使用流量,请注意流量使用" | ||
| 46 | + }, | ||
| 47 | + { | ||
| 48 | + "name": "auditing_core_error", | ||
| 49 | + "value": "内容已下线" | ||
| 30 | } | 50 | } |
| 31 | ] | 51 | ] |
| 32 | } | 52 | } |
| @@ -4,3 +4,5 @@ export { HttpRequest as WDHttp } from "./src/main/ets/http/HttpRequest" | @@ -4,3 +4,5 @@ export { HttpRequest as WDHttp } from "./src/main/ets/http/HttpRequest" | ||
| 4 | 4 | ||
| 5 | export { HttpUrlUtils } from "./src/main/ets/http/HttpUrlUtils" | 5 | export { HttpUrlUtils } from "./src/main/ets/http/HttpUrlUtils" |
| 6 | 6 | ||
| 7 | +export { HttpBizUtil } from "./src/main/ets/http/HttpBizUtil" | ||
| 8 | + |
| 1 | +import { SpConstants } from 'wdConstant/Index'; | ||
| 2 | +import { EmitterEventId, EmitterUtils, Logger, SPHelper, ToastUtils } from 'wdKit/Index'; | ||
| 3 | +import HashMap from '@ohos.util.HashMap'; | ||
| 4 | +import { ResponseDTO } from '../bean/ResponseDTO'; | ||
| 5 | +import { HttpUrlUtils, WDHttp } from '../../../../Index'; | ||
| 6 | +import { RefreshTokenRes } from '../bean/RefreshTokenRes'; | ||
| 7 | + | ||
| 8 | +const TAG: string = 'HttpBizUtil' | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 网络请求工具,业务封装http,暂添加TokenInterceptor功能 | ||
| 12 | + * TODO 待优化,将HttpBizUtil接入 AxiosInstance.interceptors.response.use | ||
| 13 | + */ | ||
| 14 | +export class HttpBizUtil { | ||
| 15 | + /** | ||
| 16 | + * get请求,封装了刷新token逻辑,接口选用,不涉及业务接口可以用原来的接口(如page接口)。 | ||
| 17 | + * | ||
| 18 | + * @param url 请求地址 | ||
| 19 | + * @param headers 请求header参数 | ||
| 20 | + * @returns 返回值 | ||
| 21 | + */ | ||
| 22 | + static get<T = string>(url: string, headers?: HashMap<string, string>): Promise<ResponseDTO<T>> { | ||
| 23 | + return new Promise<ResponseDTO<T>>((success, debug) => { | ||
| 24 | + WDHttp.get<ResponseDTO<T>>(url, headers).then((resDTO: ResponseDTO<T>) => { | ||
| 25 | + Logger.debug(TAG, 'get: ' + resDTO.code) | ||
| 26 | + Logger.debug(TAG, 'get: ' + resDTO.message) | ||
| 27 | + // 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面 | ||
| 28 | + if (resDTO.code == 403 || resDTO.code == 406) { | ||
| 29 | + HttpBizUtil.refreshToken().then((token: string) => { | ||
| 30 | + if (headers) { | ||
| 31 | + headers.replace('RMRB-X-TOKEN', token) | ||
| 32 | + headers.replace('cookie', 'RMRB-X-TOKEN=' + token) | ||
| 33 | + } | ||
| 34 | + Logger.debug(TAG, 'get again send: ' + token) | ||
| 35 | + // refreshToken为空场景不处理,直接请求接口。 | ||
| 36 | + WDHttp.get<ResponseDTO<T>>(url, headers).then((resDTO: ResponseDTO<T>) => { | ||
| 37 | + Logger.debug(TAG, 'get again: ' + resDTO.message) | ||
| 38 | + success(resDTO) | ||
| 39 | + }).catch((res: object) => { | ||
| 40 | + debug(res) | ||
| 41 | + }) | ||
| 42 | + }); | ||
| 43 | + } else { | ||
| 44 | + success(resDTO) | ||
| 45 | + } | ||
| 46 | + }).catch((res: object) => { | ||
| 47 | + debug(res) | ||
| 48 | + }) | ||
| 49 | + }) | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * post请求,封装了刷新token逻辑,接口选用,不涉及业务接口可以用原来的接口(如page接口)。 | ||
| 54 | + * | ||
| 55 | + * @param url 请求地址 | ||
| 56 | + * @param headers 请求header参数 | ||
| 57 | + * @returns 返回值 | ||
| 58 | + */ | ||
| 59 | + static post<T = string>(url: string, data?: object, headers?: HashMap<string, string>): Promise<ResponseDTO<T>> { | ||
| 60 | + return new Promise<ResponseDTO<T>>((success, debug) => { | ||
| 61 | + WDHttp.post<ResponseDTO<T>>(url, data, headers).then((resDTO: ResponseDTO<T>) => { | ||
| 62 | + Logger.debug(TAG, 'post: ' + resDTO.code) | ||
| 63 | + Logger.debug(TAG, 'post: ' + resDTO.message) | ||
| 64 | + // 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面 | ||
| 65 | + if (resDTO.code == 0 || resDTO.code == 406) { | ||
| 66 | + HttpBizUtil.refreshToken().then((token: string) => { | ||
| 67 | + if (headers) { | ||
| 68 | + headers.replace('RMRB-X-TOKEN', token) | ||
| 69 | + headers.replace('cookie', 'RMRB-X-TOKEN=' + token) | ||
| 70 | + } | ||
| 71 | + // refreshToken为空场景不处理,直接请求接口。 | ||
| 72 | + WDHttp.post<ResponseDTO<T>>(url, headers).then((resDTO: ResponseDTO<T>) => { | ||
| 73 | + success(resDTO) | ||
| 74 | + }).catch((res: object) => { | ||
| 75 | + debug(res) | ||
| 76 | + }) | ||
| 77 | + }); | ||
| 78 | + } else { | ||
| 79 | + success(resDTO) | ||
| 80 | + } | ||
| 81 | + }).catch((res: object) => { | ||
| 82 | + debug(res) | ||
| 83 | + }) | ||
| 84 | + }) | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + /* | ||
| 88 | + * 获取刷新后的token,可能为空 | ||
| 89 | + */ | ||
| 90 | + static refreshToken(): Promise<string> { | ||
| 91 | + let url = HttpUrlUtils.getRefreshTokenUrl(); | ||
| 92 | + let params: HashMap<string, string> = new HashMap<string, string>() | ||
| 93 | + params.set('refreshToken', HttpUrlUtils.getRefreshToken()) | ||
| 94 | + params.set('deviceId', HttpUrlUtils.getDeviceId()) | ||
| 95 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 96 | + Logger.debug(TAG, 'refreshToken getRefreshToken: ' + HttpUrlUtils.getRefreshToken()) | ||
| 97 | + // // 请求刷新token接口 | ||
| 98 | + return new Promise<string>((success, debug) => { | ||
| 99 | + WDHttp.post<ResponseDTO<RefreshTokenRes>>(url, params, headers).then((resDTO: ResponseDTO<RefreshTokenRes>) => { | ||
| 100 | + let newToken = '' | ||
| 101 | + if (resDTO) { | ||
| 102 | + Logger.debug(TAG, 'refreshToken getRefreshToken: ' + resDTO.message) | ||
| 103 | + Logger.debug(TAG, 'refreshToken getRefreshToken: ' + resDTO.code) | ||
| 104 | + if (resDTO.code == 377) { | ||
| 105 | + // 377强制用户下线、重新登录、封禁等场景;refreshToken 失效 | ||
| 106 | + ToastUtils.showToast("已登出,请重新登入", 1000); | ||
| 107 | + EmitterUtils.sendEmptyEvent(EmitterEventId.FORCE_USER_LOGIN_OUT) | ||
| 108 | + // WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 109 | + } else if (resDTO.code == 0 && resDTO.data) { | ||
| 110 | + newToken = resDTO.data.jwtToken | ||
| 111 | + let refreshToken = resDTO.data.refreshToken | ||
| 112 | + SPHelper.default.save(SpConstants.USER_JWT_TOKEN, newToken) | ||
| 113 | + SPHelper.default.save(SpConstants.USER_REFRESH_TOKEN, refreshToken) | ||
| 114 | + Logger.debug(TAG, 'refreshToken jwtToken: ' + resDTO.data.jwtToken) | ||
| 115 | + Logger.debug(TAG, 'refreshToken refreshToken: ' + resDTO.data.refreshToken) | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | + success(newToken) | ||
| 119 | + }); | ||
| 120 | + }) | ||
| 121 | + } | ||
| 122 | +} |
| 1 | -import HashMap from '@ohos.util.HashMap' | ||
| 2 | -import { ConfigConstants, SpConstants } from 'wdConstant' | ||
| 3 | -import { DateTimeUtils, Logger, SPHelper, StringUtils } from 'wdKit' | 1 | +import HashMap from '@ohos.util.HashMap'; |
| 2 | +import { SpConstants } from 'wdConstant'; | ||
| 3 | +import { SPHelper, StringUtils } from 'wdKit'; | ||
| 4 | 4 | ||
| 5 | /** | 5 | /** |
| 6 | * 网络请求业务侧工具类 | 6 | * 网络请求业务侧工具类 |
| @@ -35,6 +35,10 @@ export class HttpUrlUtils { | @@ -35,6 +35,10 @@ 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接口(推荐) | ||
| 39 | + */ | ||
| 40 | + static readonly COMP_REC_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/rec/compInfo"; | ||
| 41 | + /** | ||
| 38 | * 详情页面详情接口 | 42 | * 详情页面详情接口 |
| 39 | */ | 43 | */ |
| 40 | static readonly DETAIL_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail"; | 44 | static readonly DETAIL_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail"; |
| @@ -42,6 +46,10 @@ export class HttpUrlUtils { | @@ -42,6 +46,10 @@ export class HttpUrlUtils { | ||
| 42 | * 批查接口,查询互动相关数据,如收藏数、评论数等 | 46 | * 批查接口,查询互动相关数据,如收藏数、评论数等 |
| 43 | */ | 47 | */ |
| 44 | static readonly INTERACT_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/content/interactData"; | 48 | static readonly INTERACT_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/content/interactData"; |
| 49 | + /** | ||
| 50 | + * 查询视频频道推荐楼层 | ||
| 51 | + */ | ||
| 52 | + static readonly DISPLAY_REC_COMPINFO: string = "/api/rmrb-bff-display-zh/display/zh/c/rec/compInfo"; | ||
| 45 | // 多图(图集)详情页 | 53 | // 多图(图集)详情页 |
| 46 | /** | 54 | /** |
| 47 | * 批量查询内容当前用户点赞、收藏状态 | 55 | * 批量查询内容当前用户点赞、收藏状态 |
| @@ -108,6 +116,10 @@ export class HttpUrlUtils { | @@ -108,6 +116,10 @@ export class HttpUrlUtils { | ||
| 108 | */ | 116 | */ |
| 109 | static readonly APPOINTMENT_userArea_PATH: string = "/api/rmrb-content-center/c/service/sys-area/treeselect"; | 117 | static readonly APPOINTMENT_userArea_PATH: string = "/api/rmrb-content-center/c/service/sys-area/treeselect"; |
| 110 | /** | 118 | /** |
| 119 | + * 用户token刷新接口(token过期,需要刷新) | ||
| 120 | + */ | ||
| 121 | + static readonly REFRESH_TOKEN_PATH: string = "/api/rmrb-user-center/auth/zh/c/refreshToken"; | ||
| 122 | + /** | ||
| 111 | /** | 123 | /** |
| 112 | * 个人中心 关注列表详情 | 124 | * 个人中心 关注列表详情 |
| 113 | */ | 125 | */ |
| @@ -131,7 +143,11 @@ export class HttpUrlUtils { | @@ -131,7 +143,11 @@ export class HttpUrlUtils { | ||
| 131 | /** | 143 | /** |
| 132 | * 我的收藏 | 144 | * 我的收藏 |
| 133 | */ | 145 | */ |
| 134 | - static readonly APPOINTMENT_MyCollectionList_PATH: string = "/api/rmrb-interact/content/zh/c/interact"; | 146 | + static readonly APPOINTMENT_MyCollectionList_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/interact"; |
| 147 | + /** | ||
| 148 | + * 收藏/取消收藏 status :收藏状态 1添加收藏 0取消收藏 | ||
| 149 | + */ | ||
| 150 | + static readonly APPOINTMENT_ExecuteCollcet_PATH: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord"; | ||
| 135 | /** | 151 | /** |
| 136 | * 个人中心 我的评论列表 | 152 | * 个人中心 我的评论列表 |
| 137 | */ | 153 | */ |
| @@ -180,22 +196,43 @@ export class HttpUrlUtils { | @@ -180,22 +196,43 @@ export class HttpUrlUtils { | ||
| 180 | * 搜索主页 热词 | 196 | * 搜索主页 热词 |
| 181 | */ | 197 | */ |
| 182 | static readonly SEARCH_HOTS_DATA_PATH: string = "/api/rmrb-search-api/zh/c/hots"; | 198 | static readonly SEARCH_HOTS_DATA_PATH: string = "/api/rmrb-search-api/zh/c/hots"; |
| 183 | - | ||
| 184 | /** | 199 | /** |
| 185 | * 搜索联想词 | 200 | * 搜索联想词 |
| 186 | */ | 201 | */ |
| 187 | static readonly RELATED_SEARCH_CONTENT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/suggestions/"; | 202 | static readonly RELATED_SEARCH_CONTENT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/suggestions/"; |
| 188 | - | ||
| 189 | /** | 203 | /** |
| 190 | * 直播详情 | 204 | * 直播详情 |
| 191 | */ | 205 | */ |
| 192 | static readonly LIVE_DETAILS_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail"; | 206 | static readonly LIVE_DETAILS_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail"; |
| 193 | - | 207 | + /** |
| 208 | + * 直播详情-直播间列表 | ||
| 209 | + */ | ||
| 210 | + static readonly LIVE_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/video/list"; | ||
| 211 | + /** | ||
| 212 | + * 直播详情-大家聊列表 | ||
| 213 | + */ | ||
| 214 | + static readonly LIVE_CHAT_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/chat/list"; | ||
| 215 | + /** | ||
| 216 | + * 直播详情-直播数据 | ||
| 217 | + */ | ||
| 218 | + static readonly LIVE_ROOM_DATA_PATH: string = "/api/live-center-message/zh/a/live/room/number/all"; | ||
| 219 | + /** | ||
| 220 | + * 直播详情-预约直播状态 | ||
| 221 | + */ | ||
| 222 | + static readonly LIVE_APPOINTMENT_STATUS_PATH: string = "/api/live-center-message/zh/c/live/subscribe/query"; | ||
| 223 | + /** | ||
| 224 | + * 直播详情-预约/取消预约直播 | ||
| 225 | + */ | ||
| 226 | + static readonly LIVE_APPOINTMENT_PATH: string = "/api/live-center-message/zh/c/live/subscribe"; | ||
| 194 | /** | 227 | /** |
| 195 | 228 | ||
| 196 | * 搜索结果 显示tab 数 | 229 | * 搜索结果 显示tab 数 |
| 197 | */ | 230 | */ |
| 198 | static readonly SEARCH_RESULT_COUNT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/count?keyword="; | 231 | static readonly SEARCH_RESULT_COUNT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/count?keyword="; |
| 232 | + /** | ||
| 233 | + * 搜索结果 显示list 详情 | ||
| 234 | + */ | ||
| 235 | + static readonly SEARCH_RESULT_LIST_DATA_PATH: string = "/api/rmrb-search-api/zh/c/search"; | ||
| 199 | 236 | ||
| 200 | /** | 237 | /** |
| 201 | * 早晚报列表 | 238 | * 早晚报列表 |
| @@ -348,7 +385,7 @@ export class HttpUrlUtils { | @@ -348,7 +385,7 @@ export class HttpUrlUtils { | ||
| 348 | return ''; | 385 | return ''; |
| 349 | } | 386 | } |
| 350 | 387 | ||
| 351 | - private static getDeviceId() { | 388 | + public static getDeviceId() { |
| 352 | // TODO | 389 | // TODO |
| 353 | return '8a81226a-cabd-3e1b-b630-b51db4a720ed'; | 390 | return '8a81226a-cabd-3e1b-b630-b51db4a720ed'; |
| 354 | } | 391 | } |
| @@ -442,6 +479,10 @@ export class HttpUrlUtils { | @@ -442,6 +479,10 @@ export class HttpUrlUtils { | ||
| 442 | return url; | 479 | return url; |
| 443 | } | 480 | } |
| 444 | 481 | ||
| 482 | + static getRefreshTokenUrl() { | ||
| 483 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.REFRESH_TOKEN_PATH; | ||
| 484 | + return url; | ||
| 485 | + } | ||
| 445 | 486 | ||
| 446 | static getResetPassworddUrl() { | 487 | static getResetPassworddUrl() { |
| 447 | let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/resetPassword"; | 488 | let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/resetPassword"; |
| @@ -478,6 +519,21 @@ export class HttpUrlUtils { | @@ -478,6 +519,21 @@ export class HttpUrlUtils { | ||
| 478 | return url; | 519 | return url; |
| 479 | } | 520 | } |
| 480 | 521 | ||
| 522 | + | ||
| 523 | + /*优质评论页*/ | ||
| 524 | + static getQualityCommentUrl() { | ||
| 525 | + let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/highQuality"; | ||
| 526 | + | ||
| 527 | + return url | ||
| 528 | + } | ||
| 529 | + | ||
| 530 | + /*获取详情页评论列表*/ | ||
| 531 | + static getContentCommentListDataUrl() { | ||
| 532 | + let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/contentCommentList" | ||
| 533 | + return url | ||
| 534 | + } | ||
| 535 | + | ||
| 536 | + | ||
| 481 | //账户注销 | 537 | //账户注销 |
| 482 | static accountLogoutUrl() { | 538 | static accountLogoutUrl() { |
| 483 | let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/logoff"; | 539 | let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/logoff"; |
| @@ -490,13 +546,24 @@ export class HttpUrlUtils { | @@ -490,13 +546,24 @@ export class HttpUrlUtils { | ||
| 490 | return url; | 546 | return url; |
| 491 | } | 547 | } |
| 492 | 548 | ||
| 549 | + //获取用户安全页信息 | ||
| 550 | + static querySecurity() { | ||
| 551 | + let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/security/query"; | ||
| 552 | + return url; | ||
| 553 | + } | ||
| 554 | + | ||
| 493 | static getAppointmentListDataUrl() { | 555 | static getAppointmentListDataUrl() { |
| 494 | let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH | 556 | let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH |
| 495 | return url | 557 | return url |
| 496 | } | 558 | } |
| 497 | 559 | ||
| 498 | static getMyCollectionListDataUrl() { | 560 | static getMyCollectionListDataUrl() { |
| 499 | - let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.APPOINTMENT_MyCollectionList_PATH | 561 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_MyCollectionList_PATH |
| 562 | + return url | ||
| 563 | + } | ||
| 564 | + | ||
| 565 | + static getExecuteCollcetUrl() { | ||
| 566 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH | ||
| 500 | return url | 567 | return url |
| 501 | } | 568 | } |
| 502 | 569 | ||
| @@ -601,11 +668,46 @@ export class HttpUrlUtils { | @@ -601,11 +668,46 @@ export class HttpUrlUtils { | ||
| 601 | return url | 668 | return url |
| 602 | } | 669 | } |
| 603 | 670 | ||
| 671 | + static getLiveListUrl() { | ||
| 672 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_LIST_PATH | ||
| 673 | + return url | ||
| 674 | + } | ||
| 675 | + | ||
| 676 | + static getLiveChatListUrl() { | ||
| 677 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_CHAT_LIST_PATH | ||
| 678 | + return url | ||
| 679 | + } | ||
| 680 | + | ||
| 681 | + static getLiveRoomDataUrl() { | ||
| 682 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_ROOM_DATA_PATH | ||
| 683 | + return url | ||
| 684 | + } | ||
| 685 | + | ||
| 686 | + static getLiveAppointmentStatusUrl() { | ||
| 687 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_APPOINTMENT_STATUS_PATH | ||
| 688 | + return url | ||
| 689 | + } | ||
| 690 | + | ||
| 691 | + static getLiveAppointmentUrl() { | ||
| 692 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_APPOINTMENT_PATH | ||
| 693 | + return url | ||
| 694 | + } | ||
| 695 | + | ||
| 604 | static getSearchResultCountDataUrl() { | 696 | static getSearchResultCountDataUrl() { |
| 605 | let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_COUNT_DATA_PATH | 697 | let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_COUNT_DATA_PATH |
| 606 | return url | 698 | return url |
| 607 | } | 699 | } |
| 608 | 700 | ||
| 701 | + static getSearchResultListDataUrl() { | ||
| 702 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_LIST_DATA_PATH | ||
| 703 | + return url | ||
| 704 | + } | ||
| 705 | + | ||
| 706 | + static getInteractListDataUrl() { | ||
| 707 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERACT_DATA_PATH | ||
| 708 | + return url | ||
| 709 | + } | ||
| 710 | + | ||
| 609 | // static getYcgCommonHeaders(): HashMap<string, string> { | 711 | // static getYcgCommonHeaders(): HashMap<string, string> { |
| 610 | // let headers: HashMap<string, string> = new HashMap<string, string>() | 712 | // let headers: HashMap<string, string> = new HashMap<string, string>() |
| 611 | // | 713 | // |
| @@ -53,6 +53,12 @@ export function registerRouter() { | @@ -53,6 +53,12 @@ export function registerRouter() { | ||
| 53 | return WDRouterPage.detailPlayLivePage | 53 | return WDRouterPage.detailPlayLivePage |
| 54 | } else if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) { | 54 | } else if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) { |
| 55 | return WDRouterPage.detailVideoListPage | 55 | return WDRouterPage.detailVideoListPage |
| 56 | + }else if(action.params?.detailPageType == 9){ | ||
| 57 | + //图集详情页 | ||
| 58 | + return WDRouterPage.multiPictureDetailPage | ||
| 59 | + }else if(action.params?.detailPageType == 14 || action.params?.detailPageType == 15){ | ||
| 60 | + //动态详情页 | ||
| 61 | + return WDRouterPage.dynamicDetailPage | ||
| 56 | } else if (action.params?.detailPageType == 17) { | 62 | } else if (action.params?.detailPageType == 17) { |
| 57 | return WDRouterPage.multiPictureDetailPage | 63 | return WDRouterPage.multiPictureDetailPage |
| 58 | } else if (action.params?.detailPageType == 13) { | 64 | } else if (action.params?.detailPageType == 13) { |
| @@ -74,6 +80,8 @@ export function registerRouter() { | @@ -74,6 +80,8 @@ export function registerRouter() { | ||
| 74 | return WDRouterPage.imageTextDetailPage | 80 | return WDRouterPage.imageTextDetailPage |
| 75 | } else if (action.params?.pageID == "BroadcastPage") { | 81 | } else if (action.params?.pageID == "BroadcastPage") { |
| 76 | return WDRouterPage.broadcastPage | 82 | return WDRouterPage.broadcastPage |
| 83 | + } else if (action.params?.pageID == "SPACIAL_TOPIC_PAGE") { | ||
| 84 | + return WDRouterPage.spacialTopicPage | ||
| 77 | } | 85 | } |
| 78 | return undefined | 86 | return undefined |
| 79 | }) | 87 | }) |
| @@ -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 | } |
| @@ -32,9 +32,13 @@ export class WDRouterPage { | @@ -32,9 +32,13 @@ export class WDRouterPage { | ||
| 32 | static morningEveningPaperPage = new WDRouterPage("phone", "ets/pages/MorningEveningPaperPage") | 32 | static morningEveningPaperPage = new WDRouterPage("phone", "ets/pages/MorningEveningPaperPage") |
| 33 | // 图文详情页 | 33 | // 图文详情页 |
| 34 | static imageTextDetailPage = new WDRouterPage("phone", "ets/pages/ImageAndTextDetailPage"); | 34 | static imageTextDetailPage = new WDRouterPage("phone", "ets/pages/ImageAndTextDetailPage"); |
| 35 | + // 专题页 | ||
| 36 | + static spacialTopicPage = new WDRouterPage("phone", "ets/pages/SpacialTopicPage"); | ||
| 35 | // 短视频详情页 | 37 | // 短视频详情页 |
| 36 | static detailVideoListPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailVideoListPage"); | 38 | static detailVideoListPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailVideoListPage"); |
| 37 | static detailPlayShortVideoPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailPlayShortVideoPage"); | 39 | static detailPlayShortVideoPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailPlayShortVideoPage"); |
| 40 | + static VideoChannelDetail = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/VideoChannelDetail"); | ||
| 41 | + static LottieViewDemo = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/LottieViewDemo"); | ||
| 38 | // 点播详情页 | 42 | // 点播详情页 |
| 39 | static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage"); | 43 | static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage"); |
| 40 | // 直播详情页 | 44 | // 直播详情页 |
| @@ -43,6 +47,8 @@ export class WDRouterPage { | @@ -43,6 +47,8 @@ export class WDRouterPage { | ||
| 43 | static multiPictureDetailPage = new WDRouterPage("phone", "ets/pages/detail/MultiPictureDetailPage"); | 47 | static multiPictureDetailPage = new WDRouterPage("phone", "ets/pages/detail/MultiPictureDetailPage"); |
| 44 | // 音乐详情页 | 48 | // 音乐详情页 |
| 45 | static audioDetail = new WDRouterPage("phone", "ets/pages/detail/AudioDetail"); | 49 | static audioDetail = new WDRouterPage("phone", "ets/pages/detail/AudioDetail"); |
| 50 | + // 动态详情页 | ||
| 51 | + static dynamicDetailPage = new WDRouterPage("phone", "ets/pages/detail/DynamicDetailPage"); | ||
| 46 | static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); | 52 | static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); |
| 47 | static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); | 53 | static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); |
| 48 | //我的 预约 | 54 | //我的 预约 |
| @@ -75,7 +81,6 @@ export class WDRouterPage { | @@ -75,7 +81,6 @@ export class WDRouterPage { | ||
| 75 | //其他普通用户 主页 | 81 | //其他普通用户 主页 |
| 76 | static otherNormalUserHomePagePage = new WDRouterPage("wdComponent", "ets/pages/OtherNormalUserHomePage"); | 82 | static otherNormalUserHomePagePage = new WDRouterPage("wdComponent", "ets/pages/OtherNormalUserHomePage"); |
| 77 | static guidePage = new WDRouterPage("wdLogin", "ets/pages/guide/GuidePages"); | 83 | static guidePage = new WDRouterPage("wdLogin", "ets/pages/guide/GuidePages"); |
| 78 | - | ||
| 79 | //隐私政策页面 | 84 | //隐私政策页面 |
| 80 | static privacyPage = new WDRouterPage("phone", "ets/pages/launchPage/PrivacyPage"); | 85 | static privacyPage = new WDRouterPage("phone", "ets/pages/launchPage/PrivacyPage"); |
| 81 | //启动广告页面 | 86 | //启动广告页面 |
| @@ -85,7 +90,6 @@ export class WDRouterPage { | @@ -85,7 +90,6 @@ export class WDRouterPage { | ||
| 85 | 90 | ||
| 86 | static launchInterestsPage = new WDRouterPage("phone", "ets/pages/launchPage/LaunchInterestsHobbiesPage"); | 91 | static launchInterestsPage = new WDRouterPage("phone", "ets/pages/launchPage/LaunchInterestsHobbiesPage"); |
| 87 | 92 | ||
| 88 | - | ||
| 89 | // static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview"); | 93 | // static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview"); |
| 90 | 94 | ||
| 91 | //播报页面 | 95 | //播报页面 |
| @@ -18,7 +18,7 @@ export class WDRouterRule { | @@ -18,7 +18,7 @@ export class WDRouterRule { | ||
| 18 | if (page) { | 18 | if (page) { |
| 19 | if (params) { | 19 | if (params) { |
| 20 | // router.pushUrl({ url: 'pages/routerpage2', , params: params }) | 20 | // router.pushUrl({ url: 'pages/routerpage2', , params: params }) |
| 21 | - console.log('page.url()==',page.url()) | 21 | + console.log('page.url()==',page.url(),JSON.stringify(params)) |
| 22 | router.pushUrl({ url: page.url(), params: params }) | 22 | router.pushUrl({ url: page.url(), params: params }) |
| 23 | } else { | 23 | } else { |
| 24 | router.pushUrl({ url: page.url() }).catch((error:Error)=>{ | 24 | router.pushUrl({ url: page.url() }).catch((error:Error)=>{ |
| @@ -8,13 +8,17 @@ export class H5CallNativeType { | @@ -8,13 +8,17 @@ export class H5CallNativeType { | ||
| 8 | static jsCall_getAppPublicInfo = 'jsCall_getAppPublicInfo' | 8 | static jsCall_getAppPublicInfo = 'jsCall_getAppPublicInfo' |
| 9 | static jsCall_getArticleDetailBussinessData = 'jsCall_getArticleDetailBussinessData' | 9 | static jsCall_getArticleDetailBussinessData = 'jsCall_getArticleDetailBussinessData' |
| 10 | static jsCall_callAppService = 'jsCall_callAppService' | 10 | static jsCall_callAppService = 'jsCall_callAppService' |
| 11 | + static jsCall_appInnerLinkMethod = 'jsCall_appInnerLinkMethod' | ||
| 12 | + static jsCall_receiveH5Data = 'jsCall_receiveH5Data' | ||
| 11 | // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。 | 13 | // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。 |
| 12 | 14 | ||
| 13 | - static init() { | 15 | + static { |
| 14 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_currentPageOperate) | 16 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_currentPageOperate) |
| 15 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppPublicInfo) | 17 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppPublicInfo) |
| 16 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getArticleDetailBussinessData) | 18 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getArticleDetailBussinessData) |
| 17 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_callAppService) | 19 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_callAppService) |
| 20 | + H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_appInnerLinkMethod) | ||
| 21 | + H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_receiveH5Data) | ||
| 18 | } | 22 | } |
| 19 | } | 23 | } |
| 20 | 24 |
| @@ -2,6 +2,9 @@ import { Callback, BridgeWebViewControl } from 'wdJsBridge'; | @@ -2,6 +2,9 @@ import { Callback, BridgeWebViewControl } from 'wdJsBridge'; | ||
| 2 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | 2 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; |
| 3 | import { Logger, StringUtils, } from 'wdKit'; | 3 | import { Logger, StringUtils, } from 'wdKit'; |
| 4 | import { H5CallNativeType } from './H5CallNativeType'; | 4 | import { H5CallNativeType } from './H5CallNativeType'; |
| 5 | +import { ContentDTO } from 'wdBean'; | ||
| 6 | +//TODO 这里引用了 features模块,是否考虑将跳转抽到公共模块 | ||
| 7 | +import { ProcessUtils } from '../../../../../../features/wdComponent/src/main/ets/utils/ProcessUtils'; | ||
| 5 | 8 | ||
| 6 | const TAG = 'JsBridgeBiz' | 9 | const TAG = 'JsBridgeBiz' |
| 7 | 10 | ||
| @@ -11,7 +14,7 @@ const TAG = 'JsBridgeBiz' | @@ -11,7 +14,7 @@ const TAG = 'JsBridgeBiz' | ||
| 11 | * @param call | 14 | * @param call |
| 12 | */ | 15 | */ |
| 13 | export function performJSCallNative(data: Message, call: Callback) { | 16 | export function performJSCallNative(data: Message, call: Callback) { |
| 14 | - Logger.debug(TAG, 'performJSCallNative handlerName: ' + data.handlerName + ', data: ' + data.data) | 17 | + Logger.debug(TAG, 'performJSCallNative handlerName: ' + data.handlerName + ', data: ' + JSON.stringify(data.data)) |
| 15 | switch (data.handlerName) { | 18 | switch (data.handlerName) { |
| 16 | case H5CallNativeType.jsCall_currentPageOperate: | 19 | case H5CallNativeType.jsCall_currentPageOperate: |
| 17 | break; | 20 | break; |
| @@ -23,6 +26,9 @@ export function performJSCallNative(data: Message, call: Callback) { | @@ -23,6 +26,9 @@ export function performJSCallNative(data: Message, call: Callback) { | ||
| 23 | break; | 26 | break; |
| 24 | case H5CallNativeType.jsCall_callAppService: | 27 | case H5CallNativeType.jsCall_callAppService: |
| 25 | break; | 28 | break; |
| 29 | + case H5CallNativeType.jsCall_receiveH5Data: | ||
| 30 | + handleH5Data(JSON.parse(data?.data?.dataJson || '{}')) | ||
| 31 | + break; | ||
| 26 | case 'changeNativeMessage': | 32 | case 'changeNativeMessage': |
| 27 | call("this is change Web Message") | 33 | call("this is change Web Message") |
| 28 | break; | 34 | break; |
| @@ -50,4 +56,7 @@ function getAppPublicInfo(): string { | @@ -50,4 +56,7 @@ function getAppPublicInfo(): string { | ||
| 50 | return result; | 56 | return result; |
| 51 | } | 57 | } |
| 52 | 58 | ||
| 59 | +function handleH5Data(content:ContentDTO) { | ||
| 60 | + ProcessUtils.processPage(content) | ||
| 61 | +} | ||
| 53 | 62 |
| 1 | import router from '@ohos.router'; | 1 | import router from '@ohos.router'; |
| 2 | -import { Action } from 'wdBean'; | ||
| 3 | -import { ConfigConstants } from 'wdConstant'; | ||
| 4 | -import { Logger } from 'wdKit'; | ||
| 5 | -import { BridgeHandler, BridgeUtil, BridgeWebViewControl, Callback } from 'wdJsBridge'; | 2 | +import { BridgeUtil, BridgeWebViewControl, Callback } from 'wdJsBridge'; |
| 3 | +import { Logger } from 'wdKit/Index'; | ||
| 6 | import { performJSCallNative } from './JsBridgeBiz'; | 4 | import { performJSCallNative } from './JsBridgeBiz'; |
| 7 | -import { setDefaultNativeWebSettings } from './WebComponentUtil'; | 5 | +import { H5CallNativeType } from './H5CallNativeType'; |
| 8 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | 6 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; |
| 9 | 7 | ||
| 10 | -const TAG = 'WdWebComponent'; | 8 | +const TAG = 'WdWebLocalComponent'; |
| 11 | 9 | ||
| 12 | @Component | 10 | @Component |
| 13 | export struct WdWebComponent { | 11 | export struct WdWebComponent { |
| 14 | - private webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | ||
| 15 | - //TODO 默认网页 | ||
| 16 | - webUrl: string | Resource = ConfigConstants.DETAIL_URL | ||
| 17 | - /** | ||
| 18 | - * 对外暴露webview的回调,能力 | ||
| 19 | - */ | ||
| 20 | - onPageBegin: (url?: string) => void = () => { | ||
| 21 | - } | ||
| 22 | - onPageEnd: (url?: string) => void = () => { | ||
| 23 | - } | ||
| 24 | - onLoadIntercept: (url?: string) => boolean = () => { | ||
| 25 | - return false | ||
| 26 | - } | ||
| 27 | - onHttpErrorReceive: (url?: string) => boolean = () => { | ||
| 28 | - return false | ||
| 29 | - } | 12 | + webviewControl: BridgeWebViewControl = new BridgeWebViewControl() |
| 13 | + @Prop backVisibility: boolean = false | ||
| 14 | + @Prop webUrl: string = '' | ||
| 30 | @Prop @Watch('onReloadStateChanged') reload: number = 0 | 15 | @Prop @Watch('onReloadStateChanged') reload: number = 0 |
| 31 | - /** | ||
| 32 | - * 默认【CallNative】逻辑处理 | ||
| 33 | - */ | ||
| 34 | - private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => { | ||
| 35 | - performJSCallNative(data, f) | ||
| 36 | - } | ||
| 37 | - /** | ||
| 38 | - * jsBridge的处理 | ||
| 39 | - */ | ||
| 40 | - handleInfo: [string, BridgeHandler][] = [] | ||
| 41 | - backVisibility: boolean = false | ||
| 42 | - | ||
| 43 | - defaultRegisterHandler(): void { | ||
| 44 | - this.webviewControl.registerHandler("CallNative", { | ||
| 45 | - handle: (data: Message, f: Callback) => { | ||
| 46 | - this.defaultPerformJSCallNative(data, f) | ||
| 47 | - } | ||
| 48 | - }); | ||
| 49 | - | ||
| 50 | - } | ||
| 51 | 16 | ||
| 52 | build() { | 17 | build() { |
| 53 | Column() { | 18 | Column() { |
| @@ -71,26 +36,13 @@ export struct WdWebComponent { | @@ -71,26 +36,13 @@ export struct WdWebComponent { | ||
| 71 | .zoomAccess(false) | 36 | .zoomAccess(false) |
| 72 | .horizontalScrollBarAccess(false) | 37 | .horizontalScrollBarAccess(false) |
| 73 | .verticalScrollBarAccess(false) | 38 | .verticalScrollBarAccess(false) |
| 74 | - .onHttpErrorReceive((event) => { | ||
| 75 | - //TODO 页面加载不成功的时候处理 | ||
| 76 | - Logger.info(TAG, 'onHttpErrorReceive event.request.getRequestUrl:' + event?.request.getRequestUrl()); | ||
| 77 | - Logger.info(TAG, 'onHttpErrorReceive event.response.getResponseCode:' + event?.response.getResponseCode()); | 39 | + .onPageBegin((event) => { |
| 40 | + console.log(this.webUrl,"yzl") | ||
| 41 | + this.onPageBegin(event?.url); | ||
| 78 | }) | 42 | }) |
| 79 | .onPageEnd((event) => { | 43 | .onPageEnd((event) => { |
| 80 | this.onPageEnd(event?.url) | 44 | this.onPageEnd(event?.url) |
| 81 | }) | 45 | }) |
| 82 | - .onPageBegin((event) => { | ||
| 83 | - // setDefaultNativeWebSettings(this.webviewControl, this.webUrl).then(()=>{ | ||
| 84 | - // this.handleInfo && this.handleInfo.length > 1 ? this.handleInfo.forEach(value => { | ||
| 85 | - // this.webviewControl.registerHandler(value[0], value[1]) | ||
| 86 | - // }) : this.defaultRegisterHandler() | ||
| 87 | - // setTimeout(()=>{ | ||
| 88 | - // BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl) | ||
| 89 | - // },500) | ||
| 90 | - // }) | ||
| 91 | - // this.onPageBegin(event?.url) | ||
| 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') | ||
| 93 | - }) | ||
| 94 | .onLoadIntercept((event) => { | 46 | .onLoadIntercept((event) => { |
| 95 | let url: string = event.data.getRequestUrl().toString() | 47 | let url: string = event.data.getRequestUrl().toString() |
| 96 | url = url.replace("%(?![0-9a-fA-F]{2})", "%25") | 48 | url = url.replace("%(?![0-9a-fA-F]{2})", "%25") |
| @@ -101,19 +53,51 @@ export struct WdWebComponent { | @@ -101,19 +53,51 @@ export struct WdWebComponent { | ||
| 101 | return true | 53 | return true |
| 102 | } | 54 | } |
| 103 | if (url.startsWith(BridgeUtil.YY_OVERRIDE_SCHEMA)) { | 55 | if (url.startsWith(BridgeUtil.YY_OVERRIDE_SCHEMA)) { |
| 56 | + Logger.debug(TAG, 'flushMessageQueue'); | ||
| 104 | this.webviewControl.flushMessageQueue() | 57 | this.webviewControl.flushMessageQueue() |
| 105 | return true | 58 | return true |
| 106 | } | 59 | } |
| 107 | - return this.onLoadIntercept(event.data.getRequestUrl().toString()) | 60 | + return this.onLoadIntercept(event.data.getRequestUrl().toString()); |
| 108 | }) | 61 | }) |
| 109 | } | 62 | } |
| 110 | } | 63 | } |
| 111 | 64 | ||
| 65 | + private registerHandlers(): void { | ||
| 66 | + // 注册h5调用js相关 | ||
| 67 | + for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) { | ||
| 68 | + let handleName = H5CallNativeType.JsCallTypeList[i]; | ||
| 69 | + console.log('handleName:', handleName) | ||
| 70 | + let handle = (data: Message, f: Callback) => { | ||
| 71 | + this.defaultPerformJSCallNative(data, f) | ||
| 72 | + }; | ||
| 73 | + this.webviewControl.registerHandler(handleName, { handle: handle }); | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + /** | ||
| 78 | + * 默认【CallNative】逻辑处理 | ||
| 79 | + */ | ||
| 80 | + private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => { | ||
| 81 | + performJSCallNative(data, f) | ||
| 82 | + } | ||
| 83 | + onPageBegin: (url?: string) => void = () => { | ||
| 84 | + Logger.debug(TAG, 'onPageBegin'); | ||
| 85 | + this.registerHandlers(); | ||
| 86 | + BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl) | ||
| 87 | + } | ||
| 88 | + onPageEnd: (url?: string) => void = () => { | ||
| 89 | + Logger.debug(TAG, 'onPageEnd'); | ||
| 90 | + } | ||
| 91 | + onLoadIntercept: (url?: string) => boolean = () => { | ||
| 92 | + Logger.debug(TAG, 'onLoadIntercept return false'); | ||
| 93 | + return false | ||
| 94 | + } | ||
| 112 | onReloadStateChanged() { | 95 | onReloadStateChanged() { |
| 113 | Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`); | 96 | Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`); |
| 114 | if (this.reload > 0) { | 97 | if (this.reload > 0) { |
| 115 | this.webviewControl.refresh() | 98 | this.webviewControl.refresh() |
| 116 | } | 99 | } |
| 117 | } | 100 | } |
| 101 | + | ||
| 118 | } | 102 | } |
| 119 | 103 |
| @@ -11,9 +11,10 @@ const TAG = 'WdWebLocalComponent'; | @@ -11,9 +11,10 @@ const TAG = 'WdWebLocalComponent'; | ||
| 11 | 11 | ||
| 12 | @Component | 12 | @Component |
| 13 | export struct WdWebLocalComponent { | 13 | export struct WdWebLocalComponent { |
| 14 | - private webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | ||
| 15 | - backVisibility: boolean = false | ||
| 16 | - webResource: Resource = {} as Resource | 14 | + webviewControl: BridgeWebViewControl = new BridgeWebViewControl() |
| 15 | + @Prop backVisibility: boolean = false | ||
| 16 | + @Prop webResource: Resource = {} as Resource | ||
| 17 | + @State webHeight: string | number = '100%' | ||
| 17 | 18 | ||
| 18 | build() { | 19 | build() { |
| 19 | Column() { | 20 | Column() { |
| @@ -34,23 +35,13 @@ export struct WdWebLocalComponent { | @@ -34,23 +35,13 @@ export struct WdWebLocalComponent { | ||
| 34 | .domStorageAccess(true) | 35 | .domStorageAccess(true) |
| 35 | .databaseAccess(true) | 36 | .databaseAccess(true) |
| 36 | .javaScriptAccess(true) | 37 | .javaScriptAccess(true) |
| 38 | + .imageAccess(true) | ||
| 39 | + .mixedMode(MixedMode.All) | ||
| 40 | + .onlineImageAccess(true) | ||
| 41 | + .enableNativeEmbedMode(true) | ||
| 42 | + .height(this.webHeight) | ||
| 37 | .onPageBegin((event) => { | 43 | .onPageBegin((event) => { |
| 38 | - | ||
| 39 | - // setDefaultNativeWebSettings(this.webviewControl, this.webResource).then(()=>{ | ||
| 40 | - // this.handleInfo && this.handleInfo.length > 1 ? this.handleInfo.forEach(value => { | ||
| 41 | - // this.webviewControl.registerHandler(value[0], value[1]) | ||
| 42 | - // }) : this.defaultRegisterHandler() | ||
| 43 | - // setTimeout(()=>{ | ||
| 44 | - // BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl) | ||
| 45 | - // },500) | ||
| 46 | - // }) | ||
| 47 | - // this.onPageBegin(event?.url) | ||
| 48 | - // BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl); | ||
| 49 | this.onPageBegin(event?.url); | 44 | this.onPageBegin(event?.url); |
| 50 | - this.registerHandlers(); | ||
| 51 | - setTimeout(() => { | ||
| 52 | - BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl) | ||
| 53 | - }, 200) | ||
| 54 | }) | 45 | }) |
| 55 | .onPageEnd((event) => { | 46 | .onPageEnd((event) => { |
| 56 | this.onPageEnd(event?.url) | 47 | this.onPageEnd(event?.url) |
| @@ -75,25 +66,31 @@ export struct WdWebLocalComponent { | @@ -75,25 +66,31 @@ export struct WdWebLocalComponent { | ||
| 75 | } | 66 | } |
| 76 | 67 | ||
| 77 | private registerHandlers(): void { | 68 | private registerHandlers(): void { |
| 78 | - // TODO 待优化 | ||
| 79 | - H5CallNativeType.init(); | ||
| 80 | // 注册h5调用js相关 | 69 | // 注册h5调用js相关 |
| 81 | for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) { | 70 | for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) { |
| 82 | let handleName = H5CallNativeType.JsCallTypeList[i]; | 71 | let handleName = H5CallNativeType.JsCallTypeList[i]; |
| 83 | let handle = (data: Message, f: Callback) => { | 72 | let handle = (data: Message, f: Callback) => { |
| 73 | + this.setCurrentPageOperate(data) | ||
| 84 | this.defaultPerformJSCallNative(data, f) | 74 | this.defaultPerformJSCallNative(data, f) |
| 85 | - } ; | 75 | + }; |
| 86 | this.webviewControl.registerHandler(handleName, { handle: handle }); | 76 | this.webviewControl.registerHandler(handleName, { handle: handle }); |
| 87 | } | 77 | } |
| 88 | - // // TODO test | ||
| 89 | - // this.webviewControl.registerHandler('changeNativeMessage', { | ||
| 90 | - // handle: (data: Message, f: Callback) => { | ||
| 91 | - // this.defaultPerformJSCallNative(data, f) | ||
| 92 | - // } | ||
| 93 | - // }); | ||
| 94 | - | ||
| 95 | } | 78 | } |
| 96 | 79 | ||
| 80 | + //webview 高度设置 | ||
| 81 | + private setCurrentPageOperate: (data: Message) => void = (data) => { | ||
| 82 | + console.log("setCurrentPageOperate", JSON.stringify(data)) | ||
| 83 | + if (data.handlerName === H5CallNativeType.jsCall_currentPageOperate) { | ||
| 84 | + if (typeof this.webHeight === 'number') { | ||
| 85 | + if (Number(data?.data?.webViewHeight) > this.webHeight) { | ||
| 86 | + this.webHeight = Number(data?.data?.webViewHeight) | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + { | ||
| 90 | + this.webHeight = Number(data?.data?.webViewHeight) || '100%' | ||
| 91 | + } | ||
| 92 | + } | ||
| 93 | + } | ||
| 97 | /** | 94 | /** |
| 98 | * 默认【CallNative】逻辑处理 | 95 | * 默认【CallNative】逻辑处理 |
| 99 | */ | 96 | */ |
| @@ -102,12 +99,16 @@ export struct WdWebLocalComponent { | @@ -102,12 +99,16 @@ export struct WdWebLocalComponent { | ||
| 102 | } | 99 | } |
| 103 | onPageBegin: (url?: string) => void = () => { | 100 | onPageBegin: (url?: string) => void = () => { |
| 104 | Logger.debug(TAG, 'onPageBegin'); | 101 | Logger.debug(TAG, 'onPageBegin'); |
| 102 | + this.registerHandlers(); | ||
| 103 | + // setTimeout(() => { | ||
| 104 | + BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl) | ||
| 105 | + // }, 100) | ||
| 105 | } | 106 | } |
| 106 | onPageEnd: (url?: string) => void = () => { | 107 | onPageEnd: (url?: string) => void = () => { |
| 107 | Logger.debug(TAG, 'onPageEnd'); | 108 | Logger.debug(TAG, 'onPageEnd'); |
| 108 | } | 109 | } |
| 109 | onLoadIntercept: (url?: string) => boolean = () => { | 110 | onLoadIntercept: (url?: string) => boolean = () => { |
| 110 | - Logger.debug(TAG, 'onPageBegin return false'); | 111 | + Logger.debug(TAG, 'onLoadIntercept return false'); |
| 111 | return false | 112 | return false |
| 112 | } | 113 | } |
| 113 | } | 114 | } |
| @@ -5,6 +5,8 @@ export { BottomNavDTO } from './src/main/ets/bean/navigation/BottomNavDTO'; | @@ -5,6 +5,8 @@ export { BottomNavDTO } from './src/main/ets/bean/navigation/BottomNavDTO'; | ||
| 5 | 5 | ||
| 6 | export { TopNavDTO } from './src/main/ets/bean/navigation/TopNavDTO'; | 6 | export { TopNavDTO } from './src/main/ets/bean/navigation/TopNavDTO'; |
| 7 | 7 | ||
| 8 | +export { PageInfoDTO } from './src/main/ets/bean/navigation/PageInfoDTO'; | ||
| 9 | + | ||
| 8 | // entity | 10 | // entity |
| 9 | export { ItemDTO } from './src/main/ets/bean/ItemDTO'; | 11 | export { ItemDTO } from './src/main/ets/bean/ItemDTO'; |
| 10 | 12 | ||
| @@ -50,6 +52,8 @@ export { GroupDTO } from './src/main/ets/bean/component/GroupDTO'; | @@ -50,6 +52,8 @@ export { GroupDTO } from './src/main/ets/bean/component/GroupDTO'; | ||
| 50 | 52 | ||
| 51 | export { CompDTO } from './src/main/ets/bean/component/CompDTO'; | 53 | export { CompDTO } from './src/main/ets/bean/component/CompDTO'; |
| 52 | 54 | ||
| 55 | +export { LiveReviewDTO } from './src/main/ets/bean/component/LiveReviewDTO'; | ||
| 56 | + | ||
| 53 | export { NewspaperListBean } from './src/main/ets/bean/newspaper/NewspaperListBean'; | 57 | export { NewspaperListBean } from './src/main/ets/bean/newspaper/NewspaperListBean'; |
| 54 | 58 | ||
| 55 | export { NewspaperListItemBean } from './src/main/ets/bean/newspaper/NewspaperListItemBean'; | 59 | export { NewspaperListItemBean } from './src/main/ets/bean/newspaper/NewspaperListItemBean'; |
| @@ -108,4 +112,13 @@ export { ShareInfo } from './src/main/ets/bean/morningevening/ShareInfo'; | @@ -108,4 +112,13 @@ export { ShareInfo } from './src/main/ets/bean/morningevening/ShareInfo'; | ||
| 108 | 112 | ||
| 109 | export { slideShows } from './src/main/ets/bean/morningevening/slideShows'; | 113 | export { slideShows } from './src/main/ets/bean/morningevening/slideShows'; |
| 110 | 114 | ||
| 111 | -export { LiveDetailsBean } from './src/main/ets/bean/live/LiveDetailsBean'; | ||
| 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 | + | ||
| 123 | +export { LiveRoomDataBean } from './src/main/ets/bean/live/LiveRoomDataBean'; | ||
| 124 | + |
| 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 | +} |
| @@ -29,5 +29,9 @@ export interface CompDTO { | @@ -29,5 +29,9 @@ export interface CompDTO { | ||
| 29 | subType: string; | 29 | subType: string; |
| 30 | imageScale: number; // 封面图比例 1-4:3, 2-16:9, 3-3:2 | 30 | imageScale: number; // 封面图比例 1-4:3, 2-16:9, 3-3:2 |
| 31 | audioDataList: AudioDTO[]; | 31 | audioDataList: AudioDTO[]; |
| 32 | - isSelect: boolean; | 32 | + |
| 33 | + /** | ||
| 34 | + * 组件内容源类型 (LIVE_HORIZONTAL_CARD\LIVE_RESERVATION\LIVE_LARGE_CARD\LIVE_END\LIVE_MONTHLY_RANKING ) | ||
| 35 | + */ | ||
| 36 | + dataSourceType: string; | ||
| 33 | } | 37 | } |
| @@ -2,6 +2,7 @@ import { CompDTO } from './CompDTO'; | @@ -2,6 +2,7 @@ import { CompDTO } from './CompDTO'; | ||
| 2 | 2 | ||
| 3 | /** | 3 | /** |
| 4 | * Page数据DTO | 4 | * Page数据DTO |
| 5 | + * 其实是comp接口(display/zh/c/compInfo)返回 | ||
| 5 | */ | 6 | */ |
| 6 | export interface PageDTO { | 7 | export interface PageDTO { |
| 7 | pageId: string; // 页面id | 8 | pageId: string; // 页面id |
| @@ -66,5 +66,11 @@ export interface ContentDTO { | @@ -66,5 +66,11 @@ export interface ContentDTO { | ||
| 66 | slideShows: slideShows[], | 66 | slideShows: slideShows[], |
| 67 | voiceInfo: VoiceInfoDTO, | 67 | voiceInfo: VoiceInfoDTO, |
| 68 | tagWord: number, | 68 | tagWord: number, |
| 69 | - rmhInfo: RmhInfoDTO, // 人民号信息 | 69 | + isSelect: boolean; |
| 70 | + rmhInfo: RmhInfoDTO; // 人民号信息 | ||
| 71 | + photoNum: number; | ||
| 72 | + corner: string; | ||
| 73 | + rmhPlatform: number; | ||
| 74 | + newTags: string; | ||
| 75 | + isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据 | ||
| 70 | } | 76 | } |
| 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 | +} |
| @@ -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 | } |
| @@ -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; |
| @@ -158,9 +158,12 @@ export interface LiveDetailsBean { | @@ -158,9 +158,12 @@ export interface LiveDetailsBean { | ||
| 158 | */ | 158 | */ |
| 159 | liveInfo: LiveInfo | 159 | liveInfo: LiveInfo |
| 160 | fullColumnImgUrls: Array<FullColumnImgUrls> | 160 | fullColumnImgUrls: Array<FullColumnImgUrls> |
| 161 | - vlive: Array<Vlive> | ||
| 162 | newsTitle: string | 161 | newsTitle: string |
| 162 | + newsId: string | ||
| 163 | newIntroduction: string | 163 | newIntroduction: string |
| 164 | + //迁移id | ||
| 165 | + oldNewsId: string | ||
| 166 | + reLInfo: ReLInfo | ||
| 164 | } | 167 | } |
| 165 | 168 | ||
| 166 | export interface LiveInfo { | 169 | export interface LiveInfo { |
| @@ -168,8 +171,12 @@ export interface LiveInfo { | @@ -168,8 +171,12 @@ export interface LiveInfo { | ||
| 168 | liveState: string | 171 | liveState: string |
| 169 | //2024-04-12 15:00:00 直播开始时间 | 172 | //2024-04-12 15:00:00 直播开始时间 |
| 170 | planStartTime: string | 173 | planStartTime: string |
| 174 | + vlive: Array<Vlive> | ||
| 175 | + mlive:MLive | ||
| 176 | +} | ||
| 177 | +export interface MLive { | ||
| 178 | + mliveId:string | ||
| 171 | } | 179 | } |
| 172 | - | ||
| 173 | export interface FullColumnImgUrls { | 180 | export interface FullColumnImgUrls { |
| 174 | url: string | 181 | url: string |
| 175 | } | 182 | } |
| @@ -179,4 +186,8 @@ export interface Vlive { | @@ -179,4 +186,8 @@ export interface Vlive { | ||
| 179 | liveUrl: string | 186 | liveUrl: string |
| 180 | //直播回看地址,多路直播录制文件URL | 187 | //直播回看地址,多路直播录制文件URL |
| 181 | replayUri: string | 188 | replayUri: string |
| 189 | +} | ||
| 190 | + | ||
| 191 | +export interface ReLInfo { | ||
| 192 | + relId: string | ||
| 182 | } | 193 | } |
| 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 | +} |
| 1 | +/** | ||
| 2 | + * page接口返回的Page数据DTO | ||
| 3 | + */ | ||
| 4 | +export interface PageInfoDTO { | ||
| 5 | + pageId: string; // 页面id | ||
| 6 | + id: number; // 楼层id | ||
| 7 | + name: string; // 名称 | ||
| 8 | + hasAdInfo: number; | ||
| 9 | + hasPopUp: number; | ||
| 10 | + baselineShow: number; | ||
| 11 | + groups: GroupInfoDTO[]; | ||
| 12 | + channelInfo: ChannelInfoDTO; | ||
| 13 | +} | ||
| 14 | + | ||
| 15 | +export interface ChannelInfoDTO { | ||
| 16 | + channelId: string; | ||
| 17 | + channelLevel: string; | ||
| 18 | + channelName: string; | ||
| 19 | + channelStrategy: string; | ||
| 20 | + channelStyle: string; | ||
| 21 | + pageId: string; | ||
| 22 | +} | ||
| 23 | + | ||
| 24 | +export interface GroupInfoDTO { | ||
| 25 | + blockDesc: string; | ||
| 26 | + groupStrategy: number; | ||
| 27 | + id: string; | ||
| 28 | + showType: number; | ||
| 29 | + sortValue: number; | ||
| 30 | +} |
| @@ -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 | ||
| @@ -42,23 +43,23 @@ export { ImageAndTextWebComponent } from "./src/main/ets/components/ImageAndText | @@ -42,23 +43,23 @@ export { ImageAndTextWebComponent } from "./src/main/ets/components/ImageAndText | ||
| 42 | 43 | ||
| 43 | export { DetailViewModel } from "./src/main/ets/viewmodel/DetailViewModel" | 44 | export { DetailViewModel } from "./src/main/ets/viewmodel/DetailViewModel" |
| 44 | 45 | ||
| 45 | -export { SingleImageCardComponent } from "./src/main/ets/components/view/SingleImageCardComponent" | ||
| 46 | - | ||
| 47 | -export { TriPicCardComponent } from "./src/main/ets/components/view/TriPicCardComponent" | ||
| 48 | - | ||
| 49 | export { BigPicCardComponent } from "./src/main/ets/components/view/BigPicCardComponent" | 46 | export { BigPicCardComponent } from "./src/main/ets/components/view/BigPicCardComponent" |
| 50 | 47 | ||
| 51 | -export { HeadPictureCardComponent } from "./src/main/ets/components/view/HeadPictureCardComponent" | ||
| 52 | - | ||
| 53 | -export { ZhGridLayoutComponent } from "./src/main/ets/components/view/ZhGridLayoutComponent" | ||
| 54 | - | ||
| 55 | export { MultiPictureDetailPageComponent } from "./src/main/ets/components/MultiPictureDetailPageComponent" | 48 | export { MultiPictureDetailPageComponent } from "./src/main/ets/components/MultiPictureDetailPageComponent" |
| 56 | 49 | ||
| 57 | export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailComponent" | 50 | export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailComponent" |
| 58 | 51 | ||
| 52 | +export { AudioSuspensionModel } from "./src/main/ets/viewmodel/AudioSuspensionModel" | ||
| 53 | + | ||
| 59 | export { BroadcastPageComponent } from "./src/main/ets/components/broadcast/BroadcastPageComponent" | 54 | export { BroadcastPageComponent } from "./src/main/ets/components/broadcast/BroadcastPageComponent" |
| 60 | 55 | ||
| 61 | export { FirstTabTopSearchComponent } from "./src/main/ets/components/search/FirstTabTopSearchComponent" | 56 | export { FirstTabTopSearchComponent } from "./src/main/ets/components/search/FirstTabTopSearchComponent" |
| 62 | 57 | ||
| 63 | export { ListHasNoMoreDataUI } from "./src/main/ets/components/reusable/ListHasNoMoreDataUI" | 58 | export { ListHasNoMoreDataUI } from "./src/main/ets/components/reusable/ListHasNoMoreDataUI" |
| 64 | 59 | ||
| 60 | +export { LottieView } from './src/main/ets/lottie/LottieView' | ||
| 61 | + | ||
| 62 | +export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopicPageComponent' | ||
| 63 | + | ||
| 64 | +export { LogoutViewModel } from "./src/main/ets/viewmodel/LogoutViewModel" | ||
| 65 | + |
| @@ -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 | } |
| @@ -10,6 +10,9 @@ import { Card10Component } from './cardview/Card10Component'; | @@ -10,6 +10,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'; | 12 | import { Card15Component } from './cardview/Card15Component'; |
| 13 | +import { Card19Component } from './cardview/Card19Component'; | ||
| 14 | +import { Card20Component } from './cardview/Card20Component'; | ||
| 15 | +import { Card21Component } from './cardview/Card21Component'; | ||
| 13 | 16 | ||
| 14 | /** | 17 | /** |
| 15 | * card适配器,卡片样式汇总,依据ContentDTO#appStyle | 18 | * card适配器,卡片样式汇总,依据ContentDTO#appStyle |
| @@ -40,12 +43,18 @@ export struct CardParser { | @@ -40,12 +43,18 @@ export struct CardParser { | ||
| 40 | Card9Component({ contentDTO }) | 43 | Card9Component({ contentDTO }) |
| 41 | } else if (contentDTO.appStyle === CompStyle.Card_10) { | 44 | } else if (contentDTO.appStyle === CompStyle.Card_10) { |
| 42 | Card10Component({ contentDTO }) | 45 | Card10Component({ contentDTO }) |
| 43 | - } else if (contentDTO.appStyle === CompStyle.Card_15) { | ||
| 44 | - Card15Component({ contentDTO }) | ||
| 45 | } else if (contentDTO.appStyle === CompStyle.Card_11) { | 46 | } else if (contentDTO.appStyle === CompStyle.Card_11) { |
| 46 | Card11Component({ contentDTO }) | 47 | Card11Component({ contentDTO }) |
| 48 | + } else if (contentDTO.appStyle === CompStyle.Card_15) { | ||
| 49 | + Card15Component({ contentDTO }) | ||
| 47 | } else if (contentDTO.appStyle === CompStyle.Card_17) { | 50 | } else if (contentDTO.appStyle === CompStyle.Card_17) { |
| 48 | Card17Component({ contentDTO }) | 51 | Card17Component({ contentDTO }) |
| 52 | + } else if (contentDTO.appStyle === CompStyle.Card_19) { | ||
| 53 | + Card19Component({ contentDTO }) | ||
| 54 | + } else if (contentDTO.appStyle === CompStyle.Card_20) { | ||
| 55 | + Card20Component({ contentDTO }) | ||
| 56 | + } else if (contentDTO.appStyle === CompStyle.Card_21) { | ||
| 57 | + Card21Component({ contentDTO }) | ||
| 49 | } | 58 | } |
| 50 | else { | 59 | else { |
| 51 | // todo:组件未实现 / Component Not Implemented | 60 | // todo:组件未实现 / Component Not Implemented |
| @@ -16,6 +16,7 @@ import { ZhGridLayout03 } from './compview/ZhGridLayout03'; | @@ -16,6 +16,7 @@ import { ZhGridLayout03 } from './compview/ZhGridLayout03'; | ||
| 16 | import { CardParser } from './CardParser'; | 16 | import { CardParser } from './CardParser'; |
| 17 | import { LiveHorizontalReservationComponent } from './view/LiveHorizontalReservationComponent'; | 17 | import { LiveHorizontalReservationComponent } from './view/LiveHorizontalReservationComponent'; |
| 18 | import { ZhGridLayout02 } from './compview/ZhGridLayout02'; | 18 | import { ZhGridLayout02 } from './compview/ZhGridLayout02'; |
| 19 | +import { Card5Component } from './cardview/Card5Component' | ||
| 19 | 20 | ||
| 20 | /** | 21 | /** |
| 21 | * comp适配器. | 22 | * comp适配器. |
| @@ -53,6 +54,9 @@ export struct CompParser { | @@ -53,6 +54,9 @@ export struct CompParser { | ||
| 53 | ZhGridLayout03({ compDTO: compDTO }) | 54 | ZhGridLayout03({ compDTO: compDTO }) |
| 54 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) { | 55 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) { |
| 55 | 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] }) | ||
| 56 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) { | 60 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) { |
| 57 | ZhSingleColumn04({ compDTO: compDTO }) | 61 | ZhSingleColumn04({ compDTO: compDTO }) |
| 58 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) { | 62 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) { |
| 1 | +import { Logger } from 'wdKit'; | ||
| 2 | +import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | ||
| 3 | +import { ContentDetailDTO } from 'wdBean'; | ||
| 4 | +import media from '@ohos.multimedia.media'; | ||
| 5 | +import { OperRowListView } from './view/OperRowListView'; | ||
| 6 | +import { WDPlayerController } from 'wdPlayer/Index'; | ||
| 7 | + | ||
| 8 | +const TAG = 'DynamicDetailComponent' | ||
| 9 | +@Preview | ||
| 10 | +@Component | ||
| 11 | +export struct DynamicDetailComponent { | ||
| 12 | + //入参 | ||
| 13 | + private relId: string = '' | ||
| 14 | + private contentId: string = '' | ||
| 15 | + private relType: string = '' | ||
| 16 | + //出参 | ||
| 17 | + @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | ||
| 18 | + //变量 | ||
| 19 | + /** | ||
| 20 | + * 默认未关注 点击去关注 | ||
| 21 | + */ | ||
| 22 | + private followStatus: boolean = false; | ||
| 23 | + | ||
| 24 | + | ||
| 25 | + async aboutToAppear() { | ||
| 26 | + await this.getContentDetailData() | ||
| 27 | + } | ||
| 28 | + onPageHide() { | ||
| 29 | + | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + build() { | ||
| 33 | + Row() { | ||
| 34 | + Column(){ | ||
| 35 | + //logo、日期 | ||
| 36 | + Row() { | ||
| 37 | + Image($r('app.media.ic_article_rmh')) | ||
| 38 | + .width(80) | ||
| 39 | + .height(28) | ||
| 40 | + .margin({ left: 16 }) | ||
| 41 | + Blank() | ||
| 42 | + Text("2023年03月14日 08:16") | ||
| 43 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 44 | + .fontSize(12) | ||
| 45 | + .lineHeight(28) | ||
| 46 | + .margin({ right: 16 }) | ||
| 47 | + } | ||
| 48 | + .height(48) | ||
| 49 | + .width('100%') | ||
| 50 | + //分割线 | ||
| 51 | + Image($r('app.media.ic_news_detail_division')) | ||
| 52 | + .width('100%') | ||
| 53 | + .height(7) | ||
| 54 | + .margin({left: 16, right: 16} ) | ||
| 55 | + //号主信息 | ||
| 56 | + Row() { | ||
| 57 | + //头像 | ||
| 58 | + Stack() { | ||
| 59 | + Image(this.contentDetailData.rmhInfo?.rmhHeadUrl) | ||
| 60 | + .alt(this.contentDetailData.rmhInfo?.userType=='1'?$r('app.media.default_head'):$r('app.media.icon_default_head_mater')) | ||
| 61 | + .width('32') | ||
| 62 | + .height('32') | ||
| 63 | + .objectFit(ImageFit.Cover) | ||
| 64 | + .borderRadius(16) | ||
| 65 | + Image($r('app.media.icon_border_test')) | ||
| 66 | + .width('48') | ||
| 67 | + .height('48') | ||
| 68 | + .objectFit(ImageFit.Cover) | ||
| 69 | + .borderRadius(24) | ||
| 70 | + } | ||
| 71 | + .width(48) | ||
| 72 | + .height(48) | ||
| 73 | + .alignContent(Alignment.Center) | ||
| 74 | + Column(){ | ||
| 75 | + //昵称 | ||
| 76 | + Text("this.contentDetailData.rmhInfo?.rmhName") | ||
| 77 | + .fontSize(14) | ||
| 78 | + .fontColor($r('app.color.color_222222')) | ||
| 79 | + .fontWeight(FontWeight.Medium) | ||
| 80 | + .margin({ left: 5 }) | ||
| 81 | + //简介 | ||
| 82 | + Text("this.contentDetailData.rmhInfo?.rmhDesc") | ||
| 83 | + .fontSize(14) | ||
| 84 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 85 | + .fontWeight(FontWeight.Medium) | ||
| 86 | + .margin({ left: 5 }) | ||
| 87 | + } | ||
| 88 | + if (!this.followStatus) { | ||
| 89 | + Text('关注') | ||
| 90 | + .width(60) | ||
| 91 | + .height(24) | ||
| 92 | + .textAlign(TextAlign.Center) | ||
| 93 | + .fontSize($r('app.float.font_size_12')) | ||
| 94 | + .borderRadius($r('app.float.button_border_radius')) | ||
| 95 | + .backgroundColor($r('app.color.color_ED2800')) | ||
| 96 | + .fontColor($r('app.color.color_fff')) | ||
| 97 | + .onClick(() => { | ||
| 98 | + // this.handleAccention(this.item, 1) | ||
| 99 | + }) | ||
| 100 | + } else { | ||
| 101 | + Text('已关注') | ||
| 102 | + .width(60) | ||
| 103 | + .height(24) | ||
| 104 | + .borderWidth(1) | ||
| 105 | + .textAlign(TextAlign.Center) | ||
| 106 | + .fontSize($r('app.float.font_size_12')) | ||
| 107 | + .borderRadius($r('app.float.button_border_radius')) | ||
| 108 | + .borderColor($r('app.color.color_CCCCCC')) | ||
| 109 | + .fontColor($r('app.color.color_CCCCCC')) | ||
| 110 | + .onClick(() => { | ||
| 111 | + // this.handleAccention(this.item, 0) | ||
| 112 | + }) | ||
| 113 | + } | ||
| 114 | + } | ||
| 115 | + .width('100%') | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | + .backgroundColor('#FFFFFFFF') | ||
| 119 | + } | ||
| 120 | + private async getContentDetailData() { | ||
| 121 | + try { | ||
| 122 | + let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) | ||
| 123 | + this.contentDetailData = data[0]; | ||
| 124 | + console.log('动态详情',JSON.stringify(this.contentDetailData)) | ||
| 125 | + } catch (exception) { | ||
| 126 | + console.log('请求失败',JSON.stringify(exception)) | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | +} |
| @@ -22,169 +22,238 @@ import { PageRepository } from '../repository/PageRepository'; | @@ -22,169 +22,238 @@ import { PageRepository } from '../repository/PageRepository'; | ||
| 22 | 22 | ||
| 23 | const TAG = 'ImageAndTextPageComponent' | 23 | const TAG = 'ImageAndTextPageComponent' |
| 24 | 24 | ||
| 25 | -export interface OperationItem { | ||
| 26 | - icon: Resource; | ||
| 27 | - icon_check?: Resource; | ||
| 28 | - text: string | Resource; | ||
| 29 | - num?: number; // 个数 | ||
| 30 | -} | ||
| 31 | - | ||
| 32 | @Component | 25 | @Component |
| 33 | export struct ImageAndTextPageComponent { | 26 | export struct ImageAndTextPageComponent { |
| 34 | scroller: Scroller = new Scroller(); | 27 | scroller: Scroller = new Scroller(); |
| 35 | action: Action = {} as Action | 28 | action: Action = {} as Action |
| 36 | - @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 29 | + @State contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO [] |
| 37 | @State recommendList: ContentDTO[] = [] | 30 | @State recommendList: ContentDTO[] = [] |
| 38 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | 31 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 |
| 39 | @State interactData: InteractDataDTO = {} as InteractDataDTO | 32 | @State interactData: InteractDataDTO = {} as InteractDataDTO |
| 40 | - @State operationList: OperationItem[] = [ | ||
| 41 | - { | ||
| 42 | - icon: $r('app.media.ic_comment'), | ||
| 43 | - text: "评论", | ||
| 44 | - }, | ||
| 45 | - { | ||
| 46 | - icon: $r('app.media.ic_like_uncheck'), | ||
| 47 | - icon_check: $r('app.media.ic_like_check'), | ||
| 48 | - text: "点赞", | ||
| 49 | - }, | ||
| 50 | - { | ||
| 51 | - icon: $r('app.media.ic_collect_uncheck'), | ||
| 52 | - icon_check: $r('app.media.ic_collect_check'), | ||
| 53 | - text: "收藏", | ||
| 54 | - }, | ||
| 55 | - { | ||
| 56 | - icon: $r('app.media.ic_share'), | ||
| 57 | - text: "分享" | ||
| 58 | - } | ||
| 59 | - ] | ||
| 60 | - | ||
| 61 | build() { | 33 | build() { |
| 62 | Column() { | 34 | Column() { |
| 63 | - Column() { | ||
| 64 | - // 发布时间 | ||
| 65 | - // Row() { | ||
| 66 | - // Image($r('app.media.icon_ren_min_ri_bao')) | ||
| 67 | - // .width(70) | ||
| 68 | - // .height(28) | ||
| 69 | - // Text(this.contentDetailData.publishTime) | ||
| 70 | - // .fontColor($r('app.color.color_B0B0B0')) | ||
| 71 | - // .fontSize($r('app.float.font_size_13')) | ||
| 72 | - // .height('100%') | ||
| 73 | - // .align(Alignment.End) | ||
| 74 | - // } | ||
| 75 | - // .width(CommonConstants.FULL_WIDTH) | ||
| 76 | - // .height(32) | ||
| 77 | - // .padding({ left: 15, right: 15, }) | ||
| 78 | - // .justifyContent(FlexAlign.SpaceBetween) | ||
| 79 | - // .backgroundColor(Color.White) | ||
| 80 | - // Row() { | ||
| 81 | - // Image($r('app.media.line')) | ||
| 82 | - // .width('100%') | ||
| 83 | - // .height(6) | ||
| 84 | - // .objectFit(ImageFit.Cover) | ||
| 85 | - // .margin({ top: 10 }) | ||
| 86 | - // } | ||
| 87 | - // .padding({ left: 15, right: 15, }) | ||
| 88 | - // .backgroundColor(Color.White) | 35 | + // 发布时间 |
| 36 | + Row() { | ||
| 37 | + Image($r('app.media.icon_ren_min_ri_bao')) | ||
| 38 | + .width(70) | ||
| 39 | + .height(28) | ||
| 40 | + Text(this.contentDetailData[0]?.publishTime) | ||
| 41 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 42 | + .fontSize($r('app.float.font_size_13')) | ||
| 43 | + .height('100%') | ||
| 44 | + .align(Alignment.End) | ||
| 45 | + } | ||
| 46 | + .width(CommonConstants.FULL_WIDTH) | ||
| 47 | + .height(32) | ||
| 48 | + .padding({ left: 15, right: 15, }) | ||
| 49 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 50 | + .backgroundColor(Color.White) | ||
| 89 | 51 | ||
| 52 | + Row() { | ||
| 53 | + Image($r('app.media.line')) | ||
| 54 | + .width('100%') | ||
| 55 | + .height(6) | ||
| 56 | + .objectFit(ImageFit.Cover) | ||
| 57 | + .margin({ top: 10 }) | ||
| 58 | + } | ||
| 59 | + .padding({ left: 15, right: 15 }) | ||
| 60 | + .backgroundColor(Color.White) | ||
| 90 | 61 | ||
| 91 | - Stack({ alignContent: Alignment.Bottom }) { | ||
| 92 | - List() { | ||
| 93 | - //详情展示区 | ||
| 94 | - ListItem() { | ||
| 95 | - Column() { | ||
| 96 | - ImageAndTextWebComponent({ contentDetailData: this.contentDetailData, action: this.action }) | ||
| 97 | - }.width(CommonConstants.FULL_WIDTH) | ||
| 98 | - .height(CommonConstants.FULL_HEIGHT) | 62 | + Stack({ alignContent: Alignment.Bottom }) { |
| 63 | + Scroll(this.scroller) { | ||
| 64 | + Column() { | ||
| 65 | + ImageAndTextWebComponent({ | ||
| 66 | + contentDetailData: this.contentDetailData, | ||
| 67 | + action: this.action | ||
| 68 | + }) | ||
| 69 | + Column() { | ||
| 70 | + if (this.recommendList.length > 0) { | ||
| 71 | + RecommendList({ recommendList: this.recommendList }) | ||
| 72 | + } | ||
| 99 | } | 73 | } |
| 100 | - .backgroundColor(Color.White) | 74 | + } |
| 101 | 75 | ||
| 102 | - // if (this.contentDetailData.openLikes === 1) { | ||
| 103 | - // ListItem() { | ||
| 104 | - // // 点赞 | ||
| 105 | - // Row() { | ||
| 106 | - // Row() { | ||
| 107 | - // if (this.newsStatusOfUser?.likeStatus === '1') { | ||
| 108 | - // Image(this.contentDetailData.likesStyle === 1 ? $r('app.media.ic_like_check') : (this.contentDetailData.likesStyle === 2 ? $r('app.media.icon_prayer_active') : $r('app.media.icon_candle_active'))) | ||
| 109 | - // .width(24) | ||
| 110 | - // .height(24) | ||
| 111 | - // .margin({ right: 5 }) | ||
| 112 | - // } else { | ||
| 113 | - // Image(this.contentDetailData.likesStyle === 1 ? $r('app.media.icon_like') : (this.contentDetailData.likesStyle === 2 ? $r('app.media.icon_prayer') : $r('app.media.icon_candle'))) | ||
| 114 | - // .width(24) | ||
| 115 | - // .height(24) | ||
| 116 | - // .margin({ right: 5 }) | ||
| 117 | - // } | ||
| 118 | - // Text(`${this.interactData?.likeNum || 0}`) | ||
| 119 | - // .fontSize(16) | ||
| 120 | - // .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999') | ||
| 121 | - // .fontWeight(500) | ||
| 122 | - // }.alignItems(VerticalAlign.Center) | ||
| 123 | - // .onClick(() => { | ||
| 124 | - // this.toggleLikeStatus() | ||
| 125 | - // }) | ||
| 126 | - // | ||
| 127 | - // }.width(CommonConstants.FULL_WIDTH).height(80) | ||
| 128 | - // .justifyContent(FlexAlign.Center) | ||
| 129 | - // } | ||
| 130 | - // .backgroundColor(Color.White) | ||
| 131 | - // .margin({ bottom: 5 }) | ||
| 132 | - // } | 76 | + } |
| 77 | + .width(CommonConstants.FULL_WIDTH) | ||
| 78 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 79 | + .padding({ bottom: 76 }) | ||
| 80 | + // .scrollBar(BarState.Off) | ||
| 133 | 81 | ||
| 134 | - //相关推荐区 | ||
| 135 | - // ListItem() { | ||
| 136 | - // RecommendList({ recommendList: this.recommendList }) | ||
| 137 | - // } | ||
| 138 | - // .backgroundColor(Color.White) | ||
| 139 | - } | ||
| 140 | - .width(CommonConstants.FULL_WIDTH) | ||
| 141 | - .height(CommonConstants.FULL_HEIGHT) | ||
| 142 | - .padding({ bottom: 56 }) | ||
| 143 | - .scrollBar(BarState.Off) | ||
| 144 | - .edgeEffect(EdgeEffect.None) | 82 | + //底部交互区 |
| 83 | + Row() { | ||
| 84 | + Image($r('app.media.icon_arrow_left')) | ||
| 85 | + .width(24) | ||
| 86 | + .height(24) | ||
| 87 | + .onClick((event: ClickEvent) => { | ||
| 88 | + router.back() | ||
| 89 | + }) | ||
| 145 | 90 | ||
| 146 | - //底部交互区 | ||
| 147 | Row() { | 91 | Row() { |
| 148 | - Image($r('app.media.icon_arrow_left')) | 92 | + Image($r('app.media.icon_comment')) |
| 149 | .width(24) | 93 | .width(24) |
| 150 | .height(24) | 94 | .height(24) |
| 151 | - .onClick((event: ClickEvent) => { | ||
| 152 | - router.back() | ||
| 153 | - }) | ||
| 154 | - | ||
| 155 | - Row() { | ||
| 156 | - Image($r('app.media.icon_comment')) | ||
| 157 | - .width(24) | ||
| 158 | - .height(24) | ||
| 159 | - .margin({ right: 24 }) | ||
| 160 | - .id('comment') | 95 | + .margin({ right: 24 }) |
| 96 | + .id('comment') | ||
| 161 | 97 | ||
| 162 | - Image($r('app.media.icon_star')) | ||
| 163 | - .width(24) | ||
| 164 | - .height(24) | ||
| 165 | - .margin({ right: 24 }) | 98 | + Image($r('app.media.icon_star')) |
| 99 | + .width(24) | ||
| 100 | + .height(24) | ||
| 101 | + .margin({ right: 24 }) | ||
| 166 | 102 | ||
| 167 | - Image($r('app.media.icon_listen')) | ||
| 168 | - .width(24) | ||
| 169 | - .height(24) | ||
| 170 | - .margin({ right: 24 }) | 103 | + Image($r('app.media.icon_listen')) |
| 104 | + .width(24) | ||
| 105 | + .height(24) | ||
| 106 | + .margin({ right: 24 }) | ||
| 171 | 107 | ||
| 172 | - Image($r('app.media.icon_forward')) | ||
| 173 | - .width(24) | ||
| 174 | - .height(24) | 108 | + Image($r('app.media.icon_forward')) |
| 109 | + .width(24) | ||
| 110 | + .height(24) | ||
| 175 | 111 | ||
| 176 | - } | ||
| 177 | } | 112 | } |
| 178 | - .width(CommonConstants.FULL_WIDTH) | ||
| 179 | - .height(56) | ||
| 180 | - .backgroundColor(Color.White) | ||
| 181 | - .padding({ left: 15, right: 15, }) | ||
| 182 | - .justifyContent(FlexAlign.SpaceBetween) | ||
| 183 | } | 113 | } |
| 184 | - }.backgroundColor("#f5f5f5") | ||
| 185 | - }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | 114 | + .width(CommonConstants.FULL_WIDTH) |
| 115 | + .height(56) | ||
| 116 | + .padding({ left: 15, right: 15, bottom: 50, top: 20 }) | ||
| 117 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 118 | + .backgroundColor(Color.White) | ||
| 119 | + } | ||
| 120 | + } | ||
| 121 | + .width(CommonConstants.FULL_WIDTH) | ||
| 122 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 186 | } | 123 | } |
| 187 | 124 | ||
| 125 | + // build() { | ||
| 126 | + // Column() { | ||
| 127 | + // // 发布时间 | ||
| 128 | + // Row() { | ||
| 129 | + // Image($r('app.media.icon_ren_min_ri_bao')) | ||
| 130 | + // .width(70) | ||
| 131 | + // .height(28) | ||
| 132 | + // Text(this.contentDetailData[0]?.publishTime) | ||
| 133 | + // .fontColor($r('app.color.color_B0B0B0')) | ||
| 134 | + // .fontSize($r('app.float.font_size_13')) | ||
| 135 | + // .height('100%') | ||
| 136 | + // .align(Alignment.End) | ||
| 137 | + // } | ||
| 138 | + // .width(CommonConstants.FULL_WIDTH) | ||
| 139 | + // .height(32) | ||
| 140 | + // .padding({ left: 15, right: 15, }) | ||
| 141 | + // .justifyContent(FlexAlign.SpaceBetween) | ||
| 142 | + // .backgroundColor(Color.White) | ||
| 143 | + // | ||
| 144 | + // Row() { | ||
| 145 | + // Image($r('app.media.line')) | ||
| 146 | + // .width('100%') | ||
| 147 | + // .height(6) | ||
| 148 | + // .objectFit(ImageFit.Cover) | ||
| 149 | + // .margin({ top: 10 }) | ||
| 150 | + // } | ||
| 151 | + // .padding({ left: 15, right: 15, }) | ||
| 152 | + // .backgroundColor(Color.White) | ||
| 153 | + // | ||
| 154 | + // Stack({ alignContent: Alignment.Bottom }) { | ||
| 155 | + // | ||
| 156 | + // List() { | ||
| 157 | + // //详情展示区 | ||
| 158 | + // ListItem() { | ||
| 159 | + // Column() { | ||
| 160 | + // ImageAndTextWebComponent({ | ||
| 161 | + // contentDetailData: this.contentDetailData, | ||
| 162 | + // action: this.action, | ||
| 163 | + // }) | ||
| 164 | + // }.width(CommonConstants.FULL_WIDTH) | ||
| 165 | + // // .height(CommonConstants.FULL_HEIGHT) | ||
| 166 | + // } | ||
| 167 | + // | ||
| 168 | + // if (this.contentDetailData[0]?.openLikes === 1) { | ||
| 169 | + // ListItem() { | ||
| 170 | + // // 点赞 | ||
| 171 | + // Row() { | ||
| 172 | + // Row() { | ||
| 173 | + // if (this.newsStatusOfUser?.likeStatus === '1') { | ||
| 174 | + // Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : $r('app.media.icon_candle_active'))) | ||
| 175 | + // .width(24) | ||
| 176 | + // .height(24) | ||
| 177 | + // .margin({ right: 5 }) | ||
| 178 | + // } else { | ||
| 179 | + // Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : $r('app.media.icon_candle'))) | ||
| 180 | + // .width(24) | ||
| 181 | + // .height(24) | ||
| 182 | + // .margin({ right: 5 }) | ||
| 183 | + // } | ||
| 184 | + // Text(`${this.interactData?.likeNum || 0}`) | ||
| 185 | + // .fontSize(16) | ||
| 186 | + // .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999') | ||
| 187 | + // .fontWeight(500) | ||
| 188 | + // }.alignItems(VerticalAlign.Center) | ||
| 189 | + // .onClick(() => { | ||
| 190 | + // this.toggleLikeStatus() | ||
| 191 | + // }) | ||
| 192 | + // | ||
| 193 | + // }.width(CommonConstants.FULL_WIDTH).height(80) | ||
| 194 | + // .justifyContent(FlexAlign.Center) | ||
| 195 | + // } | ||
| 196 | + // .border({ | ||
| 197 | + // width: { bottom: 5 }, | ||
| 198 | + // color: '#f5f5f5', | ||
| 199 | + // }) | ||
| 200 | + // } | ||
| 201 | + // | ||
| 202 | + // // 相关推荐区 | ||
| 203 | + // ListItem() { | ||
| 204 | + // RecommendList({ recommendList: this.recommendList }) | ||
| 205 | + // } | ||
| 206 | + // } | ||
| 207 | + // .width(CommonConstants.FULL_WIDTH) | ||
| 208 | + // .height(CommonConstants.FULL_HEIGHT) | ||
| 209 | + // .padding({ bottom: 56 }) | ||
| 210 | + // .scrollBar(BarState.Off) | ||
| 211 | + // .edgeEffect(EdgeEffect.None) | ||
| 212 | + // | ||
| 213 | + // //底部交互区 | ||
| 214 | + // Row() { | ||
| 215 | + // Image($r('app.media.icon_arrow_left')) | ||
| 216 | + // .width(24) | ||
| 217 | + // .height(24) | ||
| 218 | + // .onClick((event: ClickEvent) => { | ||
| 219 | + // router.back() | ||
| 220 | + // }) | ||
| 221 | + // | ||
| 222 | + // Row() { | ||
| 223 | + // Image($r('app.media.icon_comment')) | ||
| 224 | + // .width(24) | ||
| 225 | + // .height(24) | ||
| 226 | + // .margin({ right: 24 }) | ||
| 227 | + // .id('comment') | ||
| 228 | + // | ||
| 229 | + // Image($r('app.media.icon_star')) | ||
| 230 | + // .width(24) | ||
| 231 | + // .height(24) | ||
| 232 | + // .margin({ right: 24 }) | ||
| 233 | + // | ||
| 234 | + // Image($r('app.media.icon_listen')) | ||
| 235 | + // .width(24) | ||
| 236 | + // .height(24) | ||
| 237 | + // .margin({ right: 24 }) | ||
| 238 | + // | ||
| 239 | + // Image($r('app.media.icon_forward')) | ||
| 240 | + // .width(24) | ||
| 241 | + // .height(24) | ||
| 242 | + // | ||
| 243 | + // } | ||
| 244 | + // } | ||
| 245 | + // .width(CommonConstants.FULL_WIDTH) | ||
| 246 | + // .height(56) | ||
| 247 | + // .padding({ left: 15, right: 15, bottom: 50, top: 20 }) | ||
| 248 | + // .justifyContent(FlexAlign.SpaceBetween) | ||
| 249 | + // .backgroundColor(Color.White) | ||
| 250 | + // } | ||
| 251 | + // | ||
| 252 | + // }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | ||
| 253 | + // .backgroundColor(Color.White) | ||
| 254 | + // | ||
| 255 | + // } | ||
| 256 | + | ||
| 188 | private async getDetail() { | 257 | private async getDetail() { |
| 189 | let contentId: string = '' | 258 | let contentId: string = '' |
| 190 | let relId: string = '' | 259 | let relId: string = '' |
| @@ -204,15 +273,14 @@ export struct ImageAndTextPageComponent { | @@ -204,15 +273,14 @@ export struct ImageAndTextPageComponent { | ||
| 204 | } | 273 | } |
| 205 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) | 274 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) |
| 206 | if (detailBeans && detailBeans.length > 0) { | 275 | if (detailBeans && detailBeans.length > 0) { |
| 207 | - this.contentDetailData = detailBeans[0]; | ||
| 208 | - //TODO | ||
| 209 | - // if (this.contentDetailData.recommendShow === 1) { | ||
| 210 | - // this.getRecommend() | ||
| 211 | - // } | ||
| 212 | - // if (this.contentDetailData.openLikes === 1) { | ||
| 213 | - // this.getInteractDataStatus() | ||
| 214 | - // this.queryContentInteractCount() | ||
| 215 | - // } | 276 | + this.contentDetailData = detailBeans; |
| 277 | + if (this.contentDetailData[0]?.recommendShow === 1) { | ||
| 278 | + this.getRecommend() | ||
| 279 | + } | ||
| 280 | + if (this.contentDetailData[0]?.openLikes === 1) { | ||
| 281 | + this.getInteractDataStatus() | ||
| 282 | + this.queryContentInteractCount() | ||
| 283 | + } | ||
| 216 | } | 284 | } |
| 217 | } | 285 | } |
| 218 | } | 286 | } |
| @@ -221,16 +289,14 @@ export struct ImageAndTextPageComponent { | @@ -221,16 +289,14 @@ export struct ImageAndTextPageComponent { | ||
| 221 | let params: postRecommendListParams = { | 289 | let params: postRecommendListParams = { |
| 222 | imei: "8272c108-4fa2-34ce-80b9-bc425a7c2a7e", | 290 | imei: "8272c108-4fa2-34ce-80b9-bc425a7c2a7e", |
| 223 | userId: HttpUrlUtils.getUserId(), | 291 | userId: HttpUrlUtils.getUserId(), |
| 224 | - contentId: String(this.contentDetailData.newsId), | 292 | + contentId: String(this.contentDetailData[0]?.newsId), |
| 225 | recType: 1, | 293 | recType: 1, |
| 226 | - contentType: this.contentDetailData.newsType, | ||
| 227 | - relId: this.contentDetailData?.reLInfo?.relId, | ||
| 228 | - channelId: String(this.contentDetailData?.reLInfo?.channelId) | 294 | + contentType: this.contentDetailData[0]?.newsType, |
| 295 | + relId: this.contentDetailData[0]?.reLInfo?.relId, | ||
| 296 | + channelId: String(this.contentDetailData[0]?.reLInfo?.channelId) | ||
| 229 | } | 297 | } |
| 230 | let recommendList = await DetailViewModel.postRecommendList(params) | 298 | let recommendList = await DetailViewModel.postRecommendList(params) |
| 231 | - if (recommendList && recommendList.length > 0) { | ||
| 232 | - this.recommendList = recommendList; | ||
| 233 | - } | 299 | + this.recommendList = recommendList; |
| 234 | } | 300 | } |
| 235 | 301 | ||
| 236 | // 已登录->查询用户对作品点赞、收藏状态 | 302 | // 已登录->查询用户对作品点赞、收藏状态 |
| @@ -239,8 +305,8 @@ export struct ImageAndTextPageComponent { | @@ -239,8 +305,8 @@ export struct ImageAndTextPageComponent { | ||
| 239 | const params: batchLikeAndCollectParams = { | 305 | const params: batchLikeAndCollectParams = { |
| 240 | contentList: [ | 306 | contentList: [ |
| 241 | { | 307 | { |
| 242 | - contentId: this.contentDetailData?.newsId + '', | ||
| 243 | - contentType: this.contentDetailData?.newsType + '', | 308 | + contentId: this.contentDetailData[0]?.newsId + '', |
| 309 | + contentType: this.contentDetailData[0]?.newsType + '', | ||
| 244 | } | 310 | } |
| 245 | ] | 311 | ] |
| 246 | } | 312 | } |
| @@ -265,8 +331,8 @@ export struct ImageAndTextPageComponent { | @@ -265,8 +331,8 @@ export struct ImageAndTextPageComponent { | ||
| 265 | } | 331 | } |
| 266 | const params: postExecuteLikeParams = { | 332 | const params: postExecuteLikeParams = { |
| 267 | status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1', | 333 | status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1', |
| 268 | - contentId: this.contentDetailData?.newsId + '', | ||
| 269 | - contentType: this.contentDetailData?.newsType + '', | 334 | + contentId: this.contentDetailData[0]?.newsId + '', |
| 335 | + contentType: this.contentDetailData[0]?.newsType + '', | ||
| 270 | } | 336 | } |
| 271 | PageRepository.postExecuteLike(params).then(res => { | 337 | PageRepository.postExecuteLike(params).then(res => { |
| 272 | console.log(TAG, '点赞、取消点赞', 'toggleLikeStatus==',) | 338 | console.log(TAG, '点赞、取消点赞', 'toggleLikeStatus==',) |
| @@ -285,8 +351,8 @@ export struct ImageAndTextPageComponent { | @@ -285,8 +351,8 @@ export struct ImageAndTextPageComponent { | ||
| 285 | console.error(TAG, 'contentDetailData2222', JSON.stringify(this.contentDetailData)) | 351 | console.error(TAG, 'contentDetailData2222', JSON.stringify(this.contentDetailData)) |
| 286 | const params: contentListParams = { | 352 | const params: contentListParams = { |
| 287 | contentList: [{ | 353 | contentList: [{ |
| 288 | - contentId: this.contentDetailData?.newsId + '', | ||
| 289 | - contentType: this.contentDetailData?.newsType, | 354 | + contentId: this.contentDetailData[0]?.newsId + '', |
| 355 | + contentType: this.contentDetailData[0]?.newsType, | ||
| 290 | }] | 356 | }] |
| 291 | } | 357 | } |
| 292 | PageRepository.getContentInteract(params).then(res => { | 358 | PageRepository.getContentInteract(params).then(res => { |
| @@ -7,15 +7,15 @@ import { | @@ -7,15 +7,15 @@ import { | ||
| 7 | ResponseBean | 7 | ResponseBean |
| 8 | } from 'wdBean'; | 8 | } from 'wdBean'; |
| 9 | import { Logger } from 'wdKit'; | 9 | import { Logger } from 'wdKit'; |
| 10 | -import { WdWebComponent, WdWebLocalComponent } from 'wdWebComponent'; | 10 | +import { WdWebLocalComponent } from 'wdWebComponent'; |
| 11 | import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; | 11 | import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; |
| 12 | -import { BridgeWebViewControl } from '../../../../../../commons/wdWebComponent/oh_modules/wdJsBridge/Index'; | 12 | +import { BridgeWebViewControl } from 'wdJsBridge/Index'; |
| 13 | 13 | ||
| 14 | @Component | 14 | @Component |
| 15 | export struct ImageAndTextWebComponent { | 15 | export struct ImageAndTextWebComponent { |
| 16 | action: Action = {} as Action | 16 | action: Action = {} as Action |
| 17 | @State reload: number = 0; | 17 | @State reload: number = 0; |
| 18 | - @Prop @Watch('onDetailDataUpdated') contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 18 | + @Prop @Watch('onDetailDataUpdated') contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO [] |
| 19 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | 19 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() |
| 20 | 20 | ||
| 21 | onDetailDataUpdated() { | 21 | onDetailDataUpdated() { |
| @@ -72,7 +72,7 @@ export struct ImageAndTextWebComponent { | @@ -72,7 +72,7 @@ export struct ImageAndTextWebComponent { | ||
| 72 | // TODO 暂延时1s,考虑业务流程再优化 | 72 | // TODO 暂延时1s,考虑业务流程再优化 |
| 73 | setTimeout(() => { | 73 | setTimeout(() => { |
| 74 | this.sendContentData2H5(h5ReceiveAppData); | 74 | this.sendContentData2H5(h5ReceiveAppData); |
| 75 | - }, 1000) | 75 | + }, 2000) |
| 76 | 76 | ||
| 77 | } | 77 | } |
| 78 | 78 | ||
| @@ -92,7 +92,7 @@ export struct ImageAndTextWebComponent { | @@ -92,7 +92,7 @@ export struct ImageAndTextWebComponent { | ||
| 92 | Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData'); | 92 | Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData'); |
| 93 | this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData, | 93 | this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData, |
| 94 | JSON.stringify(h5ReceiveAppData), (data: string) => { | 94 | JSON.stringify(h5ReceiveAppData), (data: string) => { |
| 95 | - // Logger.debug('ImageAndTextWebComponent', "from js data = " + data); | 95 | + Logger.debug('ImageAndTextWebComponent', "from js data = " + data); |
| 96 | }) | 96 | }) |
| 97 | } | 97 | } |
| 98 | } | 98 | } |
| @@ -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 | */ |
| 1 | +import { Action, ContentDetailDTO, } from 'wdBean'; | ||
| 2 | +import DetailViewModel from '../viewmodel/DetailViewModel'; | ||
| 3 | +import { WdWebComponent } from 'wdWebComponent'; | ||
| 4 | +import router from '@ohos.router'; | ||
| 5 | +import { CommonConstants } from 'wdConstant' | ||
| 6 | +import { BridgeWebViewControl } from 'wdJsBridge/Index'; | ||
| 7 | + | ||
| 8 | +const TAG = 'SpacialTopicPageComponent' | ||
| 9 | + | ||
| 10 | +@Component | ||
| 11 | +export struct SpacialTopicPageComponent { | ||
| 12 | + webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | ||
| 13 | + scroller: Scroller = new Scroller(); | ||
| 14 | + action: Action = {} as Action | ||
| 15 | + @State webUrl: string = ''; | ||
| 16 | + build() { | ||
| 17 | + Column() { | ||
| 18 | + Stack({ alignContent: Alignment.Bottom }) { | ||
| 19 | + Column() { | ||
| 20 | + WdWebComponent({ | ||
| 21 | + webviewControl: this.webviewControl, | ||
| 22 | + webUrl: this.webUrl, | ||
| 23 | + backVisibility: false, | ||
| 24 | + }) | ||
| 25 | + } | ||
| 26 | + .padding({ bottom: 56 }) | ||
| 27 | + .width(CommonConstants.FULL_WIDTH) | ||
| 28 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 29 | + | ||
| 30 | + //底部交互区 | ||
| 31 | + Row() { | ||
| 32 | + Image($r('app.media.icon_arrow_left')) | ||
| 33 | + .width(24) | ||
| 34 | + .height(24) | ||
| 35 | + .onClick((event: ClickEvent) => { | ||
| 36 | + router.back() | ||
| 37 | + }) | ||
| 38 | + | ||
| 39 | + Row() { | ||
| 40 | + Image($r('app.media.icon_comment')) | ||
| 41 | + .width(24) | ||
| 42 | + .height(24) | ||
| 43 | + .margin({ right: 24 }) | ||
| 44 | + .id('comment') | ||
| 45 | + | ||
| 46 | + Image($r('app.media.icon_star')) | ||
| 47 | + .width(24) | ||
| 48 | + .height(24) | ||
| 49 | + .margin({ right: 24 }) | ||
| 50 | + | ||
| 51 | + Image($r('app.media.icon_listen')) | ||
| 52 | + .width(24) | ||
| 53 | + .height(24) | ||
| 54 | + .margin({ right: 24 }) | ||
| 55 | + | ||
| 56 | + Image($r('app.media.icon_forward')) | ||
| 57 | + .width(24) | ||
| 58 | + .height(24) | ||
| 59 | + | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + .width(CommonConstants.FULL_WIDTH) | ||
| 63 | + .height(56) | ||
| 64 | + .padding({ left: 15, right: 15, bottom: 20, top: 20 }) | ||
| 65 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 66 | + .backgroundColor(Color.White) | ||
| 67 | + } | ||
| 68 | + }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | ||
| 69 | + .backgroundColor(Color.White) | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + aboutToAppear() { | ||
| 73 | + let action: Action = router.getParams() as Action | ||
| 74 | + if (action) { | ||
| 75 | + this.webUrl = action.params?.url || '' | ||
| 76 | + } | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + aboutToDisappear() { | ||
| 80 | + } | ||
| 81 | +} |
| @@ -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 // 推荐-组件信息 |
| @@ -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 | + | ||
| 14 | + // objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频, | ||
| 15 | + // 14动态图文,15动态视频16问政;100人民号,101标签 | ||
| 16 | + | ||
| 17 | + build() { | ||
| 18 | + Row() { | ||
| 19 | + if (this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15') { | ||
| 20 | + // 点播、动态视频 | ||
| 21 | + Row() { | ||
| 22 | + Image($r('app.media.card_play')) | ||
| 23 | + .mediaLogo() | ||
| 24 | + Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000)) | ||
| 25 | + .mediaText() | ||
| 26 | + } | ||
| 27 | + } else if (this.contentDTO.objectType === '2') { | ||
| 28 | + // liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | ||
| 29 | + // 显示直播信息 | ||
| 30 | + Row() { | ||
| 31 | + if(this.contentDTO.liveInfo.liveState === 'wait') { | ||
| 32 | + Image($r('app.media.card_wait')) | ||
| 33 | + .mediaLogo() | ||
| 34 | + Text('预约') | ||
| 35 | + .mediaText() | ||
| 36 | + } else if (this.contentDTO.liveInfo.liveState === 'running') { | ||
| 37 | + Image($r('app.media.card_live')) | ||
| 38 | + .mediaLogo() | ||
| 39 | + Text('直播中') | ||
| 40 | + .mediaText() | ||
| 41 | + } else if (this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo.replayUri) { | ||
| 42 | + Image($r('app.media.card_play')) | ||
| 43 | + .mediaLogo() | ||
| 44 | + Text('回看') | ||
| 45 | + .mediaText() | ||
| 46 | + } else if(this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo | ||
| 47 | + .replayUri) { | ||
| 48 | + // Image($r('app.media.card_live')) | ||
| 49 | + // .mediaLogo() | ||
| 50 | + Text('直播结束') | ||
| 51 | + .mediaText() | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + } else if (this.contentDTO.objectType === '9') { | ||
| 55 | + // 显示组图;图片数量 | ||
| 56 | + Row() { | ||
| 57 | + Image($r('app.media.card_image')) | ||
| 58 | + .mediaLogo() | ||
| 59 | + Text(`${this.contentDTO.photoNum}`) | ||
| 60 | + .mediaText() | ||
| 61 | + } | ||
| 62 | + } else if (this.contentDTO.objectType === '13') { | ||
| 63 | + // 显示音频信息 | ||
| 64 | + Row() { | ||
| 65 | + Image($r('app.media.card_audio')) | ||
| 66 | + .mediaLogo() | ||
| 67 | + Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000)) | ||
| 68 | + .mediaText() | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + .margin(6) | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + @Styles | ||
| 76 | + mediaLogo() { | ||
| 77 | + .width(14) | ||
| 78 | + .height(14) | ||
| 79 | + .margin({ right: 3 }) | ||
| 80 | + } | ||
| 81 | +} | ||
| 82 | + | ||
| 83 | +@Extend(Text) | ||
| 84 | +function mediaText() { | ||
| 85 | + .fontColor($r('app.color.color_fff')) | ||
| 86 | + .fontSize($r('app.float.font_size_14')) | ||
| 87 | + .lineHeight(18) | ||
| 88 | + .textShadow({ | ||
| 89 | + radius: 2, | ||
| 90 | + color: 'rgba(0,0,0,0.3)', | ||
| 91 | + offsetY: 2 | ||
| 92 | + }) | ||
| 93 | +} |
| 1 | +import { ContentDTO } from 'wdBean' | ||
| 2 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 3 | +import { DateTimeUtils } from 'wdKit/Index'; | ||
| 4 | + | ||
| 5 | +@Component | ||
| 6 | +export struct CardSourceInfo { | ||
| 7 | + @State contentDTO: ContentDTO = {} as ContentDTO; | ||
| 8 | + | ||
| 9 | + build() { | ||
| 10 | + Flex() { | ||
| 11 | + if (this.contentDTO.corner) { | ||
| 12 | + Text(this.contentDTO.corner) | ||
| 13 | + .fontSize($r("app.float.font_size_12")) | ||
| 14 | + .fontColor($r("app.color.color_ED2800")) | ||
| 15 | + .margin({ right: 2 }) | ||
| 16 | + } | ||
| 17 | + if (this.contentDTO.rmhPlatform === 1) { | ||
| 18 | + Text(this.contentDTO.rmhInfo.rmhName) | ||
| 19 | + .fontSize($r("app.float.font_size_12")) | ||
| 20 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 21 | + .maxLines(1) | ||
| 22 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 23 | + } else if (this.contentDTO.source) { | ||
| 24 | + Text(`${this.contentDTO.source}`) | ||
| 25 | + .fontSize($r("app.float.font_size_12")) | ||
| 26 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 27 | + .maxLines(1) | ||
| 28 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 29 | + } | ||
| 30 | + // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 | ||
| 31 | + if (this.contentDTO.isSearch || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime | ||
| 32 | + (Number | ||
| 33 | + .parseFloat(this | ||
| 34 | + .contentDTO.publishTime)) | ||
| 35 | + .indexOf | ||
| 36 | + ('-') === -1) { | ||
| 37 | + Image($r("app.media.point")) | ||
| 38 | + .width(16) | ||
| 39 | + .height(16) | ||
| 40 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | ||
| 41 | + .fontSize($r("app.float.font_size_12")) | ||
| 42 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 43 | + .flexShrink(0) | ||
| 44 | + } | ||
| 45 | + if (this.contentDTO?.interactData?.commentNum) { | ||
| 46 | + Text(`${this.contentDTO.interactData.commentNum}评`) | ||
| 47 | + .fontSize($r("app.float.font_size_12")) | ||
| 48 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 49 | + .flexShrink(0) | ||
| 50 | + .margin({ left: 6 }) | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + .width(CommonConstants.FULL_WIDTH) | ||
| 54 | + .margin({ top: 8 }) | ||
| 55 | + } | ||
| 56 | +} |
| 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 | +} |
| @@ -2,7 +2,8 @@ import { ContentDTO, slideShows } from 'wdBean'; | @@ -2,7 +2,8 @@ import { ContentDTO, slideShows } from 'wdBean'; | ||
| 2 | import { CommonConstants } from 'wdConstant' | 2 | import { CommonConstants } from 'wdConstant' |
| 3 | import { DateTimeUtils } from 'wdKit'; | 3 | import { DateTimeUtils } from 'wdKit'; |
| 4 | import { ProcessUtils } from '../../utils/ProcessUtils'; | 4 | import { ProcessUtils } from '../../utils/ProcessUtils'; |
| 5 | - | 5 | +import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 6 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 6 | 7 | ||
| 7 | /** | 8 | /** |
| 8 | * 大专题卡--CompStyle: 10 | 9 | * 大专题卡--CompStyle: 10 |
| @@ -76,10 +77,10 @@ export struct Card10Component { | @@ -76,10 +77,10 @@ export struct Card10Component { | ||
| 76 | } | 77 | } |
| 77 | .width(CommonConstants.FULL_WIDTH) | 78 | .width(CommonConstants.FULL_WIDTH) |
| 78 | .padding({ | 79 | .padding({ |
| 79 | - top: 14, | ||
| 80 | - left: 16, | ||
| 81 | - right: 16, | ||
| 82 | - bottom: 14 | 80 | + left: $r('app.float.card_comp_pagePadding_lf'), |
| 81 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 82 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 83 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 83 | }) | 84 | }) |
| 84 | .backgroundColor($r("app.color.white")) | 85 | .backgroundColor($r("app.color.white")) |
| 85 | .margin({ bottom: 8 }) | 86 | .margin({ bottom: 8 }) |
| @@ -95,25 +96,14 @@ export struct Card10Component { | @@ -95,25 +96,14 @@ export struct Card10Component { | ||
| 95 | .fontColor($r('app.color.color_222222')) | 96 | .fontColor($r('app.color.color_222222')) |
| 96 | .maxLines(2) | 97 | .maxLines(2) |
| 97 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 98 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 98 | - Row() { | ||
| 99 | - // 展示发稿人 | ||
| 100 | - if (item.source) { | ||
| 101 | - Text(item.source) | ||
| 102 | - .fontSize($r('app.float.font_size_12')) | ||
| 103 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 104 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 105 | - .maxLines(1) | ||
| 106 | - .width(item.source.length > 10 ? '60%' : '') | ||
| 107 | - | ||
| 108 | - Image($r('app.media.point')) | ||
| 109 | - .width(16) | ||
| 110 | - .height(16) | 99 | + CardSourceInfo( |
| 100 | + { | ||
| 101 | + contentDTO: { | ||
| 102 | + publishTime: item.publishTime || '', | ||
| 103 | + source: item.source || '' | ||
| 104 | + } as ContentDTO | ||
| 111 | } | 105 | } |
| 112 | - Text(DateTimeUtils.getCommentTime(Number.parseFloat(String(item.publishTime)))) | ||
| 113 | - .fontSize($r("app.float.font_size_12")) | ||
| 114 | - .fontColor($r("app.color.color_B0B0B0")) | ||
| 115 | - } | ||
| 116 | - .margin({ top: 12 }) | 106 | + ) |
| 117 | } | 107 | } |
| 118 | .layoutWeight(1) | 108 | .layoutWeight(1) |
| 119 | .alignItems(HorizontalAlign.Start) | 109 | .alignItems(HorizontalAlign.Start) |
| @@ -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 | - | 5 | +import { ProcessUtils } from '../../utils/ProcessUtils'; |
| 6 | +import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | ||
| 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 { |
| @@ -20,34 +21,18 @@ export struct Card11Component { | @@ -20,34 +21,18 @@ export struct Card11Component { | ||
| 20 | .maxLines(3) | 21 | .maxLines(3) |
| 21 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 22 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 22 | .width(CommonConstants.FULL_WIDTH) | 23 | .width(CommonConstants.FULL_WIDTH) |
| 23 | - 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) | ||
| 34 | - | ||
| 35 | - Text(DateTimeUtils.formatDate(Number.parseFloat(this.contentDTO.publishTime))) | ||
| 36 | - .fontSize($r("app.float.font_size_12")) | ||
| 37 | - .fontColor($r("app.color.color_B0B0B0")) | ||
| 38 | - | ||
| 39 | - }.width(CommonConstants.FULL_WIDTH) | ||
| 40 | - .justifyContent(FlexAlign.Start) | ||
| 41 | - .margin({ top: 8 }) | ||
| 42 | - | 24 | + // 评论等信息 |
| 25 | + CardSourceInfo({ contentDTO: this.contentDTO }) | ||
| 43 | }.width(CommonConstants.FULL_WIDTH) | 26 | }.width(CommonConstants.FULL_WIDTH) |
| 44 | .padding({ | 27 | .padding({ |
| 45 | - top: 14, | ||
| 46 | - left: 16, | ||
| 47 | - right: 16, | ||
| 48 | - bottom: 14 | 28 | + left: $r('app.float.card_comp_pagePadding_lf'), |
| 29 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 30 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 31 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 49 | }) | 32 | }) |
| 50 | .backgroundColor($r("app.color.white")) | 33 | .backgroundColor($r("app.color.white")) |
| 51 | - .margin({ bottom: 8 }) | 34 | + .onClick((event: ClickEvent) => { |
| 35 | + ProcessUtils.processPage(this.contentDTO) | ||
| 36 | + }) | ||
| 52 | } | 37 | } |
| 53 | } | 38 | } |
| 1 | +import { ContentDTO } from 'wdBean'; | ||
| 2 | +import { RmhTitle } from '../cardCommon/RmhTitle' | ||
| 3 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 4 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 5 | + | ||
| 6 | +const TAG = 'Card12Component'; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 人民号-动态---12:人民号无图卡; | ||
| 10 | + */ | ||
| 11 | +@Component | ||
| 12 | +export struct Card12Component { | ||
| 13 | + @State contentDTO: ContentDTO = { | ||
| 14 | + appStyle: '20', | ||
| 15 | + coverType: 1, | ||
| 16 | + coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 17 | + fullColumnImgUrls: [ | ||
| 18 | + { | ||
| 19 | + landscape: 1, | ||
| 20 | + size: 1, | ||
| 21 | + url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 22 | + weight: 1600 | ||
| 23 | + } | ||
| 24 | + ], | ||
| 25 | + newsTitle: '好玩!》10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人', | ||
| 26 | + rmhInfo: { | ||
| 27 | + authIcon: | ||
| 28 | + 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png', | ||
| 29 | + authTitle: '10后音乐人王烁然个人人民号', | ||
| 30 | + authTitle2: '10后音乐人王烁然个人人民号', | ||
| 31 | + banControl: 0, | ||
| 32 | + cnIsAttention: 1, | ||
| 33 | + rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人', | ||
| 34 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg', | ||
| 35 | + rmhName: '王烁然', | ||
| 36 | + userId: '522435359667845', | ||
| 37 | + userType: '2' | ||
| 38 | + }, | ||
| 39 | + objectType: '1', | ||
| 40 | + videoInfo: { | ||
| 41 | + firstFrameImageUri: '', | ||
| 42 | + videoDuration: 37, | ||
| 43 | + videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4' | ||
| 44 | + } | ||
| 45 | + } as ContentDTO; | ||
| 46 | + | ||
| 47 | + aboutToAppear(): void { | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + build() { | ||
| 51 | + Column() { | ||
| 52 | + // rmh信息 | ||
| 53 | + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) | ||
| 54 | + // 标题 | ||
| 55 | + if (this.contentDTO.newsTitle) { | ||
| 56 | + Text(this.contentDTO.newsTitle) | ||
| 57 | + .fontSize($r('app.float.font_size_17')) | ||
| 58 | + .fontColor($r('app.color.color_222222')) | ||
| 59 | + .width(CommonConstants.FULL_WIDTH) | ||
| 60 | + .textOverflowStyle(3) | ||
| 61 | + .margin({ bottom: 8 }) | ||
| 62 | + .height(75) | ||
| 63 | + .lineHeight(25) | ||
| 64 | + .fontFamily('PingFang SC-Regular') | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + // if (this.contentDTO.fullColumnImgUrls?.[0]) { | ||
| 68 | + // createImg({ contentDTO: this.contentDTO }) | ||
| 69 | + // } | ||
| 70 | + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | ||
| 71 | + } | ||
| 72 | + .padding({ | ||
| 73 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 74 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 75 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 76 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 77 | + }) | ||
| 78 | + } | ||
| 79 | +} | ||
| 80 | + | ||
| 81 | +interface radiusType { | ||
| 82 | + topLeft: number | Resource; | ||
| 83 | + topRight: number | Resource; | ||
| 84 | + bottomLeft: number | Resource; | ||
| 85 | + bottomRight: number | Resource; | ||
| 86 | +} | ||
| 87 | + | ||
| 88 | +@Component | ||
| 89 | +struct createImg { | ||
| 90 | + @Prop contentDTO: ContentDTO | ||
| 91 | + | ||
| 92 | + build() { | ||
| 93 | + GridRow() { | ||
| 94 | + if (this.contentDTO.fullColumnImgUrls[0].landscape === 1) { | ||
| 95 | + // 横屏 | ||
| 96 | + GridCol({ | ||
| 97 | + span: { xs: 12 } | ||
| 98 | + }) { | ||
| 99 | + Stack() { | ||
| 100 | + Image(this.contentDTO.coverUrl) | ||
| 101 | + .width(CommonConstants.FULL_WIDTH) | ||
| 102 | + .aspectRatio(16 / 9) | ||
| 103 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 104 | + CardMediaInfo({ contentDTO: this.contentDTO }) | ||
| 105 | + } | ||
| 106 | + .align(Alignment.BottomEnd) | ||
| 107 | + } | ||
| 108 | + } else { | ||
| 109 | + // 竖图显示,宽度占50%,高度自适应 | ||
| 110 | + GridCol({ | ||
| 111 | + span: { xs: 6 } | ||
| 112 | + }) { | ||
| 113 | + Stack() { | ||
| 114 | + Image(this.contentDTO.coverUrl) | ||
| 115 | + .width(CommonConstants.FULL_WIDTH) | ||
| 116 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 117 | + CardMediaInfo({ contentDTO: this.contentDTO }) | ||
| 118 | + } | ||
| 119 | + .align(Alignment.BottomEnd) | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | +} | ||
| 125 | + | ||
| 126 | + | ||
| 127 | +@Extend(Text) | ||
| 128 | +function textOverflowStyle(maxLine: number) { | ||
| 129 | + .maxLines(maxLine) | ||
| 130 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 131 | +} |
| 1 | +import { ContentDTO } from 'wdBean'; | ||
| 2 | +import { RmhTitle } from '../cardCommon/RmhTitle' | ||
| 3 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 4 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 5 | + | ||
| 6 | +const TAG = 'Card14Component'; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 人民号-动态---14:人民号单图卡; | ||
| 10 | + */ | ||
| 11 | +@Component | ||
| 12 | +export struct Card14Component { | ||
| 13 | + @State contentDTO: ContentDTO = { | ||
| 14 | + // appStyle: '20', | ||
| 15 | + // coverType: 1, | ||
| 16 | + // coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 17 | + // fullColumnImgUrls: [ | ||
| 18 | + // { | ||
| 19 | + // landscape: 1, | ||
| 20 | + // size: 1, | ||
| 21 | + // url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 22 | + // weight: 1600 | ||
| 23 | + // } | ||
| 24 | + // ], | ||
| 25 | + // newsTitle: '好玩!》10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人', | ||
| 26 | + // rmhInfo: { | ||
| 27 | + // authIcon: | ||
| 28 | + // 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png', | ||
| 29 | + // authTitle: '10后音乐人王烁然个人人民号', | ||
| 30 | + // authTitle2: '10后音乐人王烁然个人人民号', | ||
| 31 | + // banControl: 0, | ||
| 32 | + // cnIsAttention: 1, | ||
| 33 | + // rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人', | ||
| 34 | + // rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg', | ||
| 35 | + // rmhName: '王烁然', | ||
| 36 | + // userId: '522435359667845', | ||
| 37 | + // userType: '2' | ||
| 38 | + // }, | ||
| 39 | + // objectType: '1', | ||
| 40 | + // videoInfo: { | ||
| 41 | + // firstFrameImageUri: '', | ||
| 42 | + // videoDuration: 37, | ||
| 43 | + // videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4' | ||
| 44 | + // } | ||
| 45 | + } as ContentDTO; | ||
| 46 | + | ||
| 47 | + aboutToAppear(): void { | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + build() { | ||
| 51 | + Column() { | ||
| 52 | + // rmh信息 | ||
| 53 | + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) | ||
| 54 | + // 左标题,右图 | ||
| 55 | + Flex({ direction: FlexDirection.Row }) { | ||
| 56 | + | ||
| 57 | + Text(this.contentDTO.newsTitle) | ||
| 58 | + .fontSize($r('app.float.font_size_17')) | ||
| 59 | + .fontColor($r('app.color.color_222222')) | ||
| 60 | + .textOverflowStyle(3) | ||
| 61 | + .lineHeight(25) | ||
| 62 | + .fontFamily('PingFang SC-Regular') | ||
| 63 | + .textAlign(TextAlign.Start) | ||
| 64 | + .flexBasis('auto') | ||
| 65 | + .margin({right: 12}) | ||
| 66 | + | ||
| 67 | + Image(this.contentDTO.coverUrl) | ||
| 68 | + .flexBasis(174) | ||
| 69 | + .height(75) | ||
| 70 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 71 | + // .flexBasis(160) | ||
| 72 | + .backgroundImageSize(ImageSize.Auto) | ||
| 73 | + | ||
| 74 | + } | ||
| 75 | + .width(CommonConstants.FULL_WIDTH) | ||
| 76 | + .margin({ bottom: 8 }) | ||
| 77 | + .height(75) | ||
| 78 | + | ||
| 79 | + | ||
| 80 | + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | ||
| 81 | + } | ||
| 82 | + .padding({ | ||
| 83 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 84 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 85 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 86 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 87 | + }) | ||
| 88 | + } | ||
| 89 | +} | ||
| 90 | + | ||
| 91 | +interface radiusType { | ||
| 92 | + topLeft: number | Resource; | ||
| 93 | + topRight: number | Resource; | ||
| 94 | + bottomLeft: number | Resource; | ||
| 95 | + bottomRight: number | Resource; | ||
| 96 | +} | ||
| 97 | + | ||
| 98 | +@Extend(Text) | ||
| 99 | +function textOverflowStyle(maxLine: number) { | ||
| 100 | + .maxLines(maxLine) | ||
| 101 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 102 | +} |
| 1 | -//全标题 "appStyle":"2", | ||
| 2 | import { ContentDTO } from 'wdBean'; | 1 | import { ContentDTO } from 'wdBean'; |
| 3 | import { ProcessUtils } from '../../utils/ProcessUtils'; | 2 | import { ProcessUtils } from '../../utils/ProcessUtils'; |
| 4 | - | 3 | +import { RmhTitle } from '../cardCommon/RmhTitle' |
| 4 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 5 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 5 | 6 | ||
| 6 | const TAG: string = 'Card15Component'; | 7 | const TAG: string = 'Card15Component'; |
| 7 | 8 | ||
| @@ -12,89 +13,91 @@ const TAG: string = 'Card15Component'; | @@ -12,89 +13,91 @@ const TAG: string = 'Card15Component'; | ||
| 12 | * 卡片宽度:充满父窗口 | 13 | * 卡片宽度:充满父窗口 |
| 13 | * 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9: | 14 | * 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9: |
| 14 | */ | 15 | */ |
| 15 | -// @Entry | ||
| 16 | @Component | 16 | @Component |
| 17 | export struct Card15Component { | 17 | export struct Card15Component { |
| 18 | - @State contentDTO: ContentDTO = {} as ContentDTO; | 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; | ||
| 19 | 57 | ||
| 20 | build() { | 58 | build() { |
| 21 | Column() { | 59 | Column() { |
| 22 | - | ||
| 23 | - Column() { | ||
| 24 | - //新闻标题 | 60 | + // rmh信息 |
| 61 | + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) | ||
| 62 | + //新闻标题 | ||
| 63 | + if (this.contentDTO.newsTitle) { | ||
| 25 | Text(this.contentDTO.newsTitle) | 64 | Text(this.contentDTO.newsTitle) |
| 26 | - .fontSize(17) | ||
| 27 | - .fontColor('#222222') | ||
| 28 | - .maxLines(3) | ||
| 29 | - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | ||
| 30 | - .align(Alignment.Start) | ||
| 31 | - //大图 | ||
| 32 | - Stack() { | ||
| 33 | - Image(this.contentDTO.coverUrl) | ||
| 34 | - .borderRadius(4) | ||
| 35 | - | ||
| 36 | - | ||
| 37 | - //播放状态+时长 | ||
| 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 | - | ||
| 53 | - } | ||
| 54 | - .width('100%') | ||
| 55 | - .height(192) | ||
| 56 | - .alignContent(Alignment.BottomEnd) | ||
| 57 | - .margin({ top: 8 }) | ||
| 58 | - | 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 }) | ||
| 59 | } | 70 | } |
| 60 | - .width('100%') | ||
| 61 | - .justifyContent(FlexAlign.Start) | ||
| 62 | - .alignItems(HorizontalAlign.Start) | ||
| 63 | - .padding({ top: 14 }) | ||
| 64 | - | ||
| 65 | - //bottom | ||
| 66 | - Row() { | ||
| 67 | - Text(this.contentDTO.source) | ||
| 68 | - .bottomTextStyle() | ||
| 69 | - //间隔点 | ||
| 70 | - Image($r('app.media.point')) | ||
| 71 | - .width(12) | ||
| 72 | - .height(12) | ||
| 73 | - | ||
| 74 | - Text(this.contentDTO.source) | ||
| 75 | - .bottomTextStyle() | ||
| 76 | - Text(' ') | ||
| 77 | - | ||
| 78 | - Text(this.contentDTO.subtitle) | ||
| 79 | - .bottomTextStyle() | ||
| 80 | - | 71 | + //大图 |
| 72 | + Stack() { | ||
| 73 | + Image(this.contentDTO.coverUrl) | ||
| 74 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 75 | + //播放状态+时长 | ||
| 76 | + CardMediaInfo({ | ||
| 77 | + contentDTO: this.contentDTO | ||
| 78 | + }) | ||
| 81 | } | 79 | } |
| 82 | - .width('100%') | ||
| 83 | - .height(18) | ||
| 84 | - .justifyContent(FlexAlign.Start) | ||
| 85 | - // .padding({bottom:14}) | ||
| 86 | - .margin({ top: 8 }) | 80 | + .width(CommonConstants.FULL_WIDTH) |
| 81 | + .aspectRatio(16 / 9) | ||
| 82 | + .alignContent(Alignment.BottomEnd) | ||
| 83 | + | ||
| 84 | + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | ||
| 87 | } | 85 | } |
| 88 | - .width('100%') | ||
| 89 | - .padding({ left: 16, right: 16 }) | 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 | + }) | ||
| 90 | .onClick((event: ClickEvent) => { | 92 | .onClick((event: ClickEvent) => { |
| 91 | ProcessUtils.processPage(this.contentDTO) | 93 | ProcessUtils.processPage(this.contentDTO) |
| 92 | }) | 94 | }) |
| 93 | } | 95 | } |
| 94 | } | 96 | } |
| 95 | 97 | ||
| 98 | + | ||
| 96 | @Extend(Text) | 99 | @Extend(Text) |
| 97 | -function bottomTextStyle() { | ||
| 98 | - .fontSize(12) | ||
| 99 | - .fontColor('#B0B0B0') | 100 | +function textOverflowStyle(maxLine: number) { |
| 101 | + .maxLines(maxLine) | ||
| 102 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 100 | } | 103 | } |
| 1 | +import { ContentDTO } from 'wdBean'; | ||
| 2 | +import { RmhTitle } from '../cardCommon/RmhTitle' | ||
| 3 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 4 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 5 | + | ||
| 6 | +const TAG = 'Card16Component'; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 人民号-动态---16:人民号三图卡; | ||
| 10 | + */ | ||
| 11 | +@Component | ||
| 12 | +export struct Card16Component { | ||
| 13 | + @State contentDTO: ContentDTO = { | ||
| 14 | + appStyle: '20', | ||
| 15 | + coverType: 1, | ||
| 16 | + coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90;https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90;https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 17 | + fullColumnImgUrls: [ | ||
| 18 | + { | ||
| 19 | + landscape: 1, | ||
| 20 | + size: 1, | ||
| 21 | + url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 22 | + weight: 1600 | ||
| 23 | + } | ||
| 24 | + ], | ||
| 25 | + newsTitle: '好玩!》10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号', | ||
| 26 | + rmhInfo: { | ||
| 27 | + authIcon: | ||
| 28 | + 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png', | ||
| 29 | + authTitle: '10后音乐人王烁然个人人民号', | ||
| 30 | + authTitle2: '10后音乐人王烁然个人人民号', | ||
| 31 | + banControl: 0, | ||
| 32 | + cnIsAttention: 1, | ||
| 33 | + rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人', | ||
| 34 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg', | ||
| 35 | + rmhName: '王烁然', | ||
| 36 | + userId: '522435359667845', | ||
| 37 | + userType: '2' | ||
| 38 | + }, | ||
| 39 | + objectType: '1', | ||
| 40 | + videoInfo: { | ||
| 41 | + firstFrameImageUri: '', | ||
| 42 | + videoDuration: 37, | ||
| 43 | + videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4' | ||
| 44 | + } | ||
| 45 | + } as ContentDTO; | ||
| 46 | + | ||
| 47 | + aboutToAppear(): void { | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + build() { | ||
| 51 | + Column() { | ||
| 52 | + // rmh信息 | ||
| 53 | + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) | ||
| 54 | + // 标题 | ||
| 55 | + if (this.contentDTO.newsTitle) { | ||
| 56 | + Text(this.contentDTO.newsTitle) | ||
| 57 | + .fontSize($r('app.float.font_size_17')) | ||
| 58 | + .fontColor($r('app.color.color_222222')) | ||
| 59 | + .width(CommonConstants.FULL_WIDTH) | ||
| 60 | + .textOverflowStyle(2) | ||
| 61 | + .margin({ bottom: 8 }) | ||
| 62 | + .lineHeight(25) | ||
| 63 | + } | ||
| 64 | + if (this.contentDTO.coverUrl) { | ||
| 65 | + Flex() { | ||
| 66 | + ForEach(this.contentDTO.coverUrl?.split(';'), (item: string) => { | ||
| 67 | + Image(item).flexBasis(113).height(75).margin({right: 2}) | ||
| 68 | + }) | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | ||
| 72 | + } | ||
| 73 | + .padding({ | ||
| 74 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 75 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 76 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 77 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 78 | + }) | ||
| 79 | + } | ||
| 80 | +} | ||
| 81 | + | ||
| 82 | +interface radiusType { | ||
| 83 | + topLeft: number | Resource; | ||
| 84 | + topRight: number | Resource; | ||
| 85 | + bottomLeft: number | Resource; | ||
| 86 | + bottomRight: number | Resource; | ||
| 87 | +} | ||
| 88 | + | ||
| 89 | +@Component | ||
| 90 | +struct createImg { | ||
| 91 | + @Prop contentDTO: ContentDTO | ||
| 92 | + | ||
| 93 | + build() { | ||
| 94 | + GridRow() { | ||
| 95 | + if (this.contentDTO.fullColumnImgUrls[0].landscape === 1) { | ||
| 96 | + // 横屏 | ||
| 97 | + GridCol({ | ||
| 98 | + span: { xs: 12 } | ||
| 99 | + }) { | ||
| 100 | + Stack() { | ||
| 101 | + Image(this.contentDTO.coverUrl) | ||
| 102 | + .width(CommonConstants.FULL_WIDTH) | ||
| 103 | + .aspectRatio(16 / 9) | ||
| 104 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 105 | + CardMediaInfo({ contentDTO: this.contentDTO }) | ||
| 106 | + } | ||
| 107 | + .align(Alignment.BottomEnd) | ||
| 108 | + } | ||
| 109 | + } else { | ||
| 110 | + // 竖图显示,宽度占50%,高度自适应 | ||
| 111 | + GridCol({ | ||
| 112 | + span: { xs: 6 } | ||
| 113 | + }) { | ||
| 114 | + Stack() { | ||
| 115 | + Image(this.contentDTO.coverUrl) | ||
| 116 | + .width(CommonConstants.FULL_WIDTH) | ||
| 117 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 118 | + CardMediaInfo({ contentDTO: this.contentDTO }) | ||
| 119 | + } | ||
| 120 | + .align(Alignment.BottomEnd) | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | +} | ||
| 126 | + | ||
| 127 | + | ||
| 128 | +@Extend(Text) | ||
| 129 | +function textOverflowStyle(maxLine: number) { | ||
| 130 | + .maxLines(maxLine) | ||
| 131 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 132 | +} |
| @@ -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 | - | 6 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 7 | +import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | ||
| 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') | 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 | + } | ||
| 36 | 40 | ||
| 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') | ||
| 45 | - | ||
| 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', |
| @@ -108,38 +81,15 @@ export struct Card17Component { | @@ -108,38 +81,15 @@ export struct Card17Component { | ||
| 108 | }; | 81 | }; |
| 109 | WDRouterRule.jumpWithAction(taskAction) | 82 | WDRouterRule.jumpWithAction(taskAction) |
| 110 | }) | 83 | }) |
| 111 | - | ||
| 112 | - Row() { | ||
| 113 | - if (this.contentDTO.source) { | ||
| 114 | - Text(this.contentDTO.source) | ||
| 115 | - .fontSize(13) | ||
| 116 | - .fontColor(0xB0B0B0) | ||
| 117 | - Image($r('app.media.point')) | ||
| 118 | - .width(16) | ||
| 119 | - .height(16) | ||
| 120 | - } | ||
| 121 | - if (this.contentDTO.publishTime && this.contentDTO.publishTime.length === 13) { | ||
| 122 | - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | ||
| 123 | - .fontSize(13) | ||
| 124 | - .fontColor(0xB0B0B0) | ||
| 125 | - } | ||
| 126 | - Text('328评') | ||
| 127 | - .fontSize(13) | ||
| 128 | - .fontColor(0xB0B0B0) | ||
| 129 | - .margin({ | ||
| 130 | - left: 6 | ||
| 131 | - }) | ||
| 132 | - } | ||
| 133 | - .width(CommonConstants.FULL_WIDTH) | ||
| 134 | - .height(16) | ||
| 135 | - .id('label') | 84 | + // 评论等信息 |
| 85 | + CardSourceInfo({ contentDTO: this.contentDTO }) | ||
| 136 | } | 86 | } |
| 137 | .width(CommonConstants.FULL_WIDTH) | 87 | .width(CommonConstants.FULL_WIDTH) |
| 138 | .padding({ | 88 | .padding({ |
| 139 | - top: 14, | ||
| 140 | - left: 16, | ||
| 141 | - right: 16, | ||
| 142 | - bottom: 14 | 89 | + left: $r('app.float.card_comp_pagePadding_lf'), |
| 90 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 91 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 92 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 143 | }) | 93 | }) |
| 144 | } | 94 | } |
| 145 | } | 95 | } |
| 1 | +import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean'; | ||
| 2 | +import { RmhTitle } from '../cardCommon/RmhTitle' | ||
| 3 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 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_955994155727712256.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 | + .onClick((event: ClickEvent) => { | ||
| 98 | + ProcessUtils.processPage(this.contentDTO) | ||
| 99 | + }) | ||
| 100 | + } | ||
| 101 | +} | ||
| 102 | + | ||
| 103 | +interface radiusType { | ||
| 104 | + topLeft: number | Resource; | ||
| 105 | + topRight: number | Resource; | ||
| 106 | + bottomLeft: number | Resource; | ||
| 107 | + bottomRight: number | Resource; | ||
| 108 | +} | ||
| 109 | + | ||
| 110 | +@Component | ||
| 111 | +struct createImg { | ||
| 112 | + @Prop fullColumnImgUrls: FullColumnImgUrlDTO[] | ||
| 113 | + @State picWidth: number = 0; | ||
| 114 | + @State picHeight: number = 0; | ||
| 115 | + aboutToAppear(): void { | ||
| 116 | + if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位 | ||
| 117 | + this.fullColumnImgUrls.splice(2,0, { | ||
| 118 | + fullUrl: '' | ||
| 119 | + } as FullColumnImgUrlDTO) | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + caclImageRadius(index: number) { | ||
| 123 | + let radius: radiusType = { | ||
| 124 | + topLeft: index === 0 ? $r('app.float.image_border_radius') : 0, | ||
| 125 | + topRight: 0, | ||
| 126 | + bottomLeft: 0, | ||
| 127 | + bottomRight: 0, | ||
| 128 | + } | ||
| 129 | + if (this.fullColumnImgUrls.length === 1) { | ||
| 130 | + radius.topRight = index === 0 ? $r('app.float.image_border_radius') : 0 | ||
| 131 | + radius.bottomLeft = index === 0 ? $r('app.float.image_border_radius') : 0 | ||
| 132 | + radius.bottomRight = index === 0 ? $r('app.float.image_border_radius') : 0 | ||
| 133 | + } else if (this.fullColumnImgUrls.length === 5 && !this.fullColumnImgUrls[2].fullUrl) { | ||
| 134 | + radius.topRight = index === 1 ? $r('app.float.image_border_radius') : 0 | ||
| 135 | + radius.bottomLeft = index === 3 ? $r('app.float.image_border_radius') : 0 | ||
| 136 | + radius.bottomRight = index === 4 ? $r('app.float.image_border_radius') : 0 | ||
| 137 | + } else { | ||
| 138 | + radius.topRight = index === 2 ? $r('app.float.image_border_radius') : 0 | ||
| 139 | + radius.bottomLeft = index === 6 ? $r('app.float.image_border_radius') : 0 | ||
| 140 | + radius.bottomRight = index === 8 ? $r('app.float.image_border_radius') : 0 | ||
| 141 | + } | ||
| 142 | + return radius | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + getPicType(){ | ||
| 146 | + if (this.picWidth && this.picWidth) { | ||
| 147 | + if (this.picWidth / this.picHeight > 343/172) { | ||
| 148 | + return 1; //横长图 | ||
| 149 | + } else if (this.picHeight / this.picWidth > 305/228) { | ||
| 150 | + return 2; //竖长图 | ||
| 151 | + } else { | ||
| 152 | + return 3 | ||
| 153 | + } | ||
| 154 | + } else { | ||
| 155 | + return 3; //普通图 | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + | ||
| 160 | + build() { | ||
| 161 | + GridRow({ | ||
| 162 | + gutter: { x: 2, y: 2 } | ||
| 163 | + }) { | ||
| 164 | + ForEach(this.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => { | ||
| 165 | + if (this.fullColumnImgUrls.length === 1) { | ||
| 166 | + if (this.getPicType() !== 3) { | ||
| 167 | + GridCol({ | ||
| 168 | + span: this.getPicType() === 1 ? 12 : 8 | ||
| 169 | + }){ | ||
| 170 | + Stack({ | ||
| 171 | + alignContent: Alignment.BottomEnd | ||
| 172 | + }) { | ||
| 173 | + if (this.getPicType() === 1) { | ||
| 174 | + Image(item.fullUrl) | ||
| 175 | + .width('100%') | ||
| 176 | + .height(172) | ||
| 177 | + .autoResize(true) | ||
| 178 | + .borderRadius(this.caclImageRadius(index)) | ||
| 179 | + } else if (this.getPicType() === 2) { | ||
| 180 | + Image(item.fullUrl) | ||
| 181 | + .width('100%') | ||
| 182 | + .height(305) | ||
| 183 | + .autoResize(true) | ||
| 184 | + .borderRadius(this.caclImageRadius(index)) | ||
| 185 | + } | ||
| 186 | + Flex({ direction: FlexDirection.Row }) { | ||
| 187 | + Image($r('app.media.icon_long_pic')) | ||
| 188 | + .width(14) | ||
| 189 | + .height(14) | ||
| 190 | + .margin({right: 4}) | ||
| 191 | + Text('长图') | ||
| 192 | + .fontSize(12) | ||
| 193 | + .fontWeight(400) | ||
| 194 | + .fontColor(0xffffff) | ||
| 195 | + .fontFamily('PingFang SC') | ||
| 196 | + } | ||
| 197 | + .width(48) | ||
| 198 | + .padding({bottom: 9}) | ||
| 199 | + | ||
| 200 | + } | ||
| 201 | + } | ||
| 202 | + } else { | ||
| 203 | + GridCol({ | ||
| 204 | + span: { xs: 8 } | ||
| 205 | + }) { | ||
| 206 | + Image(item.fullUrl) | ||
| 207 | + .width('100%') | ||
| 208 | + .borderRadius(this.caclImageRadius(index)) | ||
| 209 | + .autoResize(true) | ||
| 210 | + .opacity(!this.picWidth && !this.picHeight ? 0 : 1) | ||
| 211 | + .onComplete(callback => { | ||
| 212 | + this.picWidth = callback?.width || 0; | ||
| 213 | + this.picHeight = callback?.height || 0; | ||
| 214 | + }) | ||
| 215 | + } | ||
| 216 | + } | ||
| 217 | + } else if (this.fullColumnImgUrls.length === 4) { | ||
| 218 | + GridCol({ | ||
| 219 | + span: { xs: 4 } | ||
| 220 | + }) { | ||
| 221 | + Image(item.fullUrl) | ||
| 222 | + .aspectRatio(1) | ||
| 223 | + .borderRadius(this.caclImageRadius(index)) | ||
| 224 | + } | ||
| 225 | + } else { | ||
| 226 | + GridCol({ | ||
| 227 | + span: { sm: 4, lg: 3 } | ||
| 228 | + }) { | ||
| 229 | + Image(item.fullUrl) | ||
| 230 | + .aspectRatio(1) | ||
| 231 | + .borderRadius(this.caclImageRadius(index)) | ||
| 232 | + } | ||
| 233 | + } | ||
| 234 | + }) | ||
| 235 | + } | ||
| 236 | + } | ||
| 237 | +} | ||
| 238 | + | ||
| 239 | + | ||
| 240 | +@Extend(Text) | ||
| 241 | +function textOverflowStyle(maxLine: number) { | ||
| 242 | + .maxLines(maxLine) | ||
| 243 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 244 | +} |
| 1 | +import { ContentDTO } from 'wdBean'; | ||
| 2 | +import { RmhTitle } from '../cardCommon/RmhTitle' | ||
| 3 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 4 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 5 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 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 | + .onClick((event: ClickEvent) => { | ||
| 75 | + ProcessUtils.processPage(this.contentDTO) | ||
| 76 | + }) | ||
| 77 | + } | ||
| 78 | +} | ||
| 79 | + | ||
| 80 | +interface radiusType { | ||
| 81 | + topLeft: number | Resource; | ||
| 82 | + topRight: number | Resource; | ||
| 83 | + bottomLeft: number | Resource; | ||
| 84 | + bottomRight: number | Resource; | ||
| 85 | +} | ||
| 86 | + | ||
| 87 | +@Component | ||
| 88 | +struct createImg { | ||
| 89 | + @Prop contentDTO: ContentDTO | ||
| 90 | + | ||
| 91 | + build() { | ||
| 92 | + GridRow() { | ||
| 93 | + if (this.contentDTO.fullColumnImgUrls[0].landscape === 1) { | ||
| 94 | + // 横屏 | ||
| 95 | + GridCol({ | ||
| 96 | + span: { xs: 12 } | ||
| 97 | + }) { | ||
| 98 | + Stack() { | ||
| 99 | + Image(this.contentDTO.coverUrl) | ||
| 100 | + .width(CommonConstants.FULL_WIDTH) | ||
| 101 | + .aspectRatio(16 / 9) | ||
| 102 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 103 | + CardMediaInfo({ contentDTO: this.contentDTO }) | ||
| 104 | + } | ||
| 105 | + .align(Alignment.BottomEnd) | ||
| 106 | + } | ||
| 107 | + } else { | ||
| 108 | + // 竖图显示,宽度占50%,高度自适应 | ||
| 109 | + GridCol({ | ||
| 110 | + span: { xs: 6 } | ||
| 111 | + }) { | ||
| 112 | + Stack() { | ||
| 113 | + Image(this.contentDTO.coverUrl) | ||
| 114 | + .width(CommonConstants.FULL_WIDTH) | ||
| 115 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 116 | + CardMediaInfo({ contentDTO: this.contentDTO }) | ||
| 117 | + } | ||
| 118 | + .align(Alignment.BottomEnd) | ||
| 119 | + } | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | +} | ||
| 124 | + | ||
| 125 | + | ||
| 126 | +@Extend(Text) | ||
| 127 | +function textOverflowStyle(maxLine: number) { | ||
| 128 | + .maxLines(maxLine) | ||
| 129 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 130 | +} |
| 1 | +import { ContentDTO } from 'wdBean'; | ||
| 2 | +import { CommonConstants, CompStyle } from 'wdConstant'; | ||
| 3 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 4 | +import { RmhTitle } from '../cardCommon/RmhTitle' | ||
| 5 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 6 | + | ||
| 7 | +const TAG: string = 'Card6Component-Card13Component'; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 卡片样式:"appStyle":"21" 小视频卡人民号 | ||
| 11 | + */ | ||
| 12 | +@Component | ||
| 13 | +export struct Card21Component { | ||
| 14 | + @State contentDTO: ContentDTO = {} as ContentDTO; | ||
| 15 | + | ||
| 16 | + build() { | ||
| 17 | + Column() { | ||
| 18 | + // 顶部 rmh信息 | ||
| 19 | + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) | ||
| 20 | + // 中间内容 | ||
| 21 | + Grid() { | ||
| 22 | + GridItem() { | ||
| 23 | + Text(`${this.contentDTO.newsTitle}`) | ||
| 24 | + .fontSize($r('app.float.selected_text_size')) | ||
| 25 | + .fontColor($r('app.color.color_222222')) | ||
| 26 | + .width(CommonConstants.FULL_WIDTH) | ||
| 27 | + .maxLines(4) | ||
| 28 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 29 | + .padding({ right: 12 }) | ||
| 30 | + .lineHeight(26) | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + GridItem() { | ||
| 34 | + Stack() { | ||
| 35 | + Image(this.contentDTO.coverUrl) | ||
| 36 | + .width(CommonConstants.FULL_WIDTH) | ||
| 37 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 38 | + CardMediaInfo({ contentDTO: this.contentDTO }) | ||
| 39 | + } | ||
| 40 | + .alignContent(Alignment.BottomEnd) | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + .columnsTemplate('2fr 1fr') | ||
| 44 | + .maxCount(1) | ||
| 45 | + | ||
| 46 | + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | ||
| 47 | + } | ||
| 48 | + .onClick((event: ClickEvent) => { | ||
| 49 | + ProcessUtils.processPage(this.contentDTO) | ||
| 50 | + }) | ||
| 51 | + .padding({ | ||
| 52 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 53 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 54 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 55 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 56 | + }) | ||
| 57 | + .width(CommonConstants.FULL_WIDTH) | ||
| 58 | + } | ||
| 59 | +} |
| 1 | //全标题 "appStyle":"2", | 1 | //全标题 "appStyle":"2", |
| 2 | import { ContentDTO } from 'wdBean'; | 2 | import { ContentDTO } from 'wdBean'; |
| 3 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 3 | import { ProcessUtils } from '../../utils/ProcessUtils'; | 4 | import { ProcessUtils } from '../../utils/ProcessUtils'; |
| 4 | - | ||
| 5 | - | 5 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 6 | +import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | ||
| 6 | const TAG: string = 'Card2Component'; | 7 | const TAG: string = 'Card2Component'; |
| 7 | 8 | ||
| 8 | /** | 9 | /** |
| @@ -12,81 +13,62 @@ const TAG: string = 'Card2Component'; | @@ -12,81 +13,62 @@ const TAG: string = 'Card2Component'; | ||
| 12 | * 卡片宽度:充满父窗口 | 13 | * 卡片宽度:充满父窗口 |
| 13 | * 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9: | 14 | * 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9: |
| 14 | */ | 15 | */ |
| 15 | -// @Entry | ||
| 16 | @Component | 16 | @Component |
| 17 | export struct Card2Component { | 17 | export struct Card2Component { |
| 18 | - @State contentDTO: ContentDTO = {} as ContentDTO; | 18 | + @State contentDTO: ContentDTO = { |
| 19 | + // appStyle: '2', | ||
| 20 | + // objectType: '1', | ||
| 21 | + // coverUrl: | ||
| 22 | + // 'https://rmrbcmsonline.peopleapp.com/upload/image/202404/202404141115457926.png?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90', | ||
| 23 | + // newsTitle: '又见花开!新疆伊犁花海延绵清新怡人', | ||
| 24 | + // publishTime: '1713067227000', | ||
| 25 | + // source: '荔枝新闻', | ||
| 26 | + // videoInfo: { | ||
| 27 | + // videoDuration: 25, | ||
| 28 | + // videoLandscape: 1, | ||
| 29 | + // videoUrl: | ||
| 30 | + // 'https://rmrbcmsonline.peopleapp.com/upload/video/mp4/202404/1713064515901314d148763996.mp4' | ||
| 31 | + // } | ||
| 32 | + } as ContentDTO; | ||
| 19 | 33 | ||
| 20 | build() { | 34 | build() { |
| 21 | Column() { | 35 | Column() { |
| 22 | - | ||
| 23 | Column() { | 36 | Column() { |
| 24 | //新闻标题 | 37 | //新闻标题 |
| 25 | Text(this.contentDTO.newsTitle) | 38 | Text(this.contentDTO.newsTitle) |
| 26 | - .fontSize(17) | ||
| 27 | - .fontColor('#222222') | 39 | + .fontSize($r('app.float.font_size_17')) |
| 40 | + .fontColor($r('app.color.color_222222')) | ||
| 28 | .maxLines(3) | 41 | .maxLines(3) |
| 29 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | 42 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 |
| 30 | .align(Alignment.Start) | 43 | .align(Alignment.Start) |
| 31 | //大图 | 44 | //大图 |
| 32 | Stack() { | 45 | Stack() { |
| 33 | Image(this.contentDTO.coverUrl) | 46 | Image(this.contentDTO.coverUrl) |
| 34 | - .borderRadius(4) | ||
| 35 | - | ||
| 36 | - | 47 | + .width(CommonConstants.FULL_WIDTH) |
| 48 | + .aspectRatio(16 / 9) | ||
| 49 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 37 | //播放状态+时长 | 50 | //播放状态+时长 |
| 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 | - | 51 | + CardMediaInfo({ |
| 52 | + contentDTO: this.contentDTO | ||
| 53 | + }) | ||
| 53 | } | 54 | } |
| 54 | - .width('100%') | ||
| 55 | - .height(192) | ||
| 56 | .alignContent(Alignment.BottomEnd) | 55 | .alignContent(Alignment.BottomEnd) |
| 57 | .margin({ top: 8 }) | 56 | .margin({ top: 8 }) |
| 58 | - | ||
| 59 | } | 57 | } |
| 60 | - .width('100%') | ||
| 61 | - .justifyContent(FlexAlign.Start) | 58 | + .width(CommonConstants.FULL_WIDTH) |
| 62 | .alignItems(HorizontalAlign.Start) | 59 | .alignItems(HorizontalAlign.Start) |
| 63 | - .padding({ top: 14 }) | ||
| 64 | 60 | ||
| 65 | //bottom | 61 | //bottom |
| 66 | - Row() { | ||
| 67 | - Text(this.contentDTO.source) | ||
| 68 | - .bottomTextStyle() | ||
| 69 | - //间隔点 | ||
| 70 | - Image($r('app.media.point')) | ||
| 71 | - .width(12) | ||
| 72 | - .height(12) | ||
| 73 | - | ||
| 74 | - Text(this.contentDTO.source) | ||
| 75 | - .bottomTextStyle() | ||
| 76 | - Text(' ') | ||
| 77 | - | ||
| 78 | - Text(this.contentDTO.subtitle) | ||
| 79 | - .bottomTextStyle() | ||
| 80 | - | ||
| 81 | - } | ||
| 82 | - .width('100%') | ||
| 83 | - .height(18) | ||
| 84 | - .justifyContent(FlexAlign.Start) | ||
| 85 | - // .padding({bottom:14}) | ||
| 86 | - .margin({ top: 8 }) | 62 | + // 评论等信息 |
| 63 | + CardSourceInfo({ contentDTO: this.contentDTO }) | ||
| 87 | } | 64 | } |
| 88 | - .width('100%') | ||
| 89 | - .padding({ left: 16, right: 16 }) | 65 | + .width(CommonConstants.FULL_WIDTH) |
| 66 | + .padding({ | ||
| 67 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 68 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 69 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 70 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 71 | + }) | ||
| 90 | .onClick((event: ClickEvent) => { | 72 | .onClick((event: ClickEvent) => { |
| 91 | ProcessUtils.processPage(this.contentDTO) | 73 | ProcessUtils.processPage(this.contentDTO) |
| 92 | }) | 74 | }) |
| 1 | import { ContentDTO } from 'wdBean'; | 1 | import { ContentDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant' | 2 | import { CommonConstants } from 'wdConstant' |
| 3 | -import { DateTimeUtils } from 'wdKit/src/main/ets/utils/DateTimeUtils' | ||
| 4 | import { ProcessUtils } from '../../utils/ProcessUtils'; | 3 | import { ProcessUtils } from '../../utils/ProcessUtils'; |
| 4 | +import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | ||
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 7 | * 卡片样式:"appStyle":"3" | 7 | * 卡片样式:"appStyle":"3" |
| 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() { |
| @@ -16,36 +27,16 @@ export struct Card3Component { | @@ -16,36 +27,16 @@ export struct Card3Component { | ||
| 16 | .fontSize($r("app.float.font_size_16")) | 27 | .fontSize($r("app.float.font_size_16")) |
| 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() { | ||
| 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))) | ||
| 32 | - .fontSize($r("app.float.font_size_12")) | ||
| 33 | - .fontColor($r("app.color.color_B0B0B0")) | ||
| 34 | - | ||
| 35 | - }.width(CommonConstants.FULL_WIDTH) | ||
| 36 | - .justifyContent(FlexAlign.Start) | ||
| 37 | - .margin({ top: 8 }) | ||
| 38 | - | 30 | + // 评论等信息 |
| 31 | + CardSourceInfo({ contentDTO: this.contentDTO }) | ||
| 39 | } | 32 | } |
| 40 | - .width("100%") | 33 | + .width(CommonConstants.FULL_WIDTH) |
| 41 | .padding({ | 34 | .padding({ |
| 42 | - top: 14, | ||
| 43 | - left: 16, | ||
| 44 | - right: 16, | ||
| 45 | - bottom: 14 | 35 | + left: $r('app.float.card_comp_pagePadding_lf'), |
| 36 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 37 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 38 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 46 | }) | 39 | }) |
| 47 | - .backgroundColor($r("app.color.white")) | ||
| 48 | - .margin({ bottom: 8 }) | ||
| 49 | .onClick((event: ClickEvent) => { | 40 | .onClick((event: ClickEvent) => { |
| 50 | ProcessUtils.processPage(this.contentDTO) | 41 | ProcessUtils.processPage(this.contentDTO) |
| 51 | }) | 42 | }) |
| 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 | - | 4 | +import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 5 | const TAG: string = 'Card4Component'; | 5 | const TAG: string = 'Card4Component'; |
| 6 | 6 | ||
| 7 | /** | 7 | /** |
| @@ -13,87 +13,118 @@ const TAG: string = 'Card4Component'; | @@ -13,87 +13,118 @@ const TAG: string = 'Card4Component'; | ||
| 13 | */ | 13 | */ |
| 14 | @Component | 14 | @Component |
| 15 | export struct Card4Component { | 15 | export struct Card4Component { |
| 16 | - @State contentDTO: ContentDTO = {} as ContentDTO; | 16 | + @State contentDTO: ContentDTO = { |
| 17 | + // appStyle: '4', | ||
| 18 | + // fullColumnImgUrls: [ | ||
| 19 | + // { | ||
| 20 | + // format: null, | ||
| 21 | + // fullUrl: '', | ||
| 22 | + // height: 187, | ||
| 23 | + // landscape: 1, | ||
| 24 | + // size: 1, | ||
| 25 | + // 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', | ||
| 26 | + // weight: 248 | ||
| 27 | + // }, | ||
| 28 | + // { | ||
| 29 | + // format: null, | ||
| 30 | + // fullUrl: '', | ||
| 31 | + // height: 187, | ||
| 32 | + // landscape: 1, | ||
| 33 | + // size: 1, | ||
| 34 | + // 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', | ||
| 35 | + // weight: 248 | ||
| 36 | + // }, | ||
| 37 | + // { | ||
| 38 | + // format: null, | ||
| 39 | + // fullUrl: '', | ||
| 40 | + // height: 187, | ||
| 41 | + // landscape: 1, | ||
| 42 | + // size: 1, | ||
| 43 | + // 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', | ||
| 44 | + // weight: 248 | ||
| 45 | + // }, | ||
| 46 | + // { | ||
| 47 | + // format: null, | ||
| 48 | + // fullUrl: '', | ||
| 49 | + // height: 187, | ||
| 50 | + // landscape: 1, | ||
| 51 | + // size: 1, | ||
| 52 | + // 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', | ||
| 53 | + // weight: 248 | ||
| 54 | + // } | ||
| 55 | + // ], | ||
| 56 | + // newsTitle: '科普:如何发现家中是否有白蚁危害?丨又到白蚁分飞季②', | ||
| 57 | + // rmhInfo: { | ||
| 58 | + // authIcon: | ||
| 59 | + // 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/blue.png', | ||
| 60 | + // authTitle: '封面新闻', | ||
| 61 | + // rmhDesc: '封面新闻,亿万年轻人的生活方式。', | ||
| 62 | + // rmhHeadUrl: | ||
| 63 | + // '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', | ||
| 64 | + // rmhId: '2016608', | ||
| 65 | + // rmhName: '封面新闻', | ||
| 66 | + // userId: '522390888224390', | ||
| 67 | + // userType: '2' | ||
| 68 | + // }, | ||
| 69 | + // source: '头条号', | ||
| 70 | + // publishTime: '1651204607000', | ||
| 71 | + } as ContentDTO; | ||
| 17 | 72 | ||
| 18 | build() { | 73 | build() { |
| 19 | Column() { | 74 | Column() { |
| 20 | - | ||
| 21 | - | ||
| 22 | //body | 75 | //body |
| 23 | Column() { | 76 | Column() { |
| 24 | //新闻标题 | 77 | //新闻标题 |
| 25 | Text(this.contentDTO.newsTitle) | 78 | Text(this.contentDTO.newsTitle) |
| 26 | - .fontSize(17) | ||
| 27 | - .fontColor('#222222') | 79 | + .fontSize($r('app.float.font_size_17')) |
| 80 | + .fontColor($r('app.color.color_222222')) | ||
| 28 | .maxLines(3) | 81 | .maxLines(3) |
| 29 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | 82 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 |
| 30 | //三图 | 83 | //三图 |
| 31 | Row() { | 84 | 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 | - | 85 | + GridRow({ gutter: 2 }) { |
| 86 | + ForEach(this.contentDTO.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => { | ||
| 87 | + if (index < 3) { | ||
| 88 | + GridCol({ span: { xs: 4 } }) { | ||
| 89 | + Image(item.url) | ||
| 90 | + .width('100%') | ||
| 91 | + .aspectRatio(113 / 75) | ||
| 92 | + .borderRadius({ | ||
| 93 | + topLeft: index === 0 ? $r('app.float.image_border_radius') : 0, | ||
| 94 | + topRight: index === 2 ? $r('app.float.image_border_radius') : 0, | ||
| 95 | + bottomLeft: index === 0 ? $r('app.float.image_border_radius') : 0, | ||
| 96 | + bottomRight: index === 2 ? $r('app.float.image_border_radius') : 0, | ||
| 97 | + }) | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + }) | ||
| 101 | + } | ||
| 47 | } | 102 | } |
| 48 | - .justifyContent(FlexAlign.SpaceBetween) | ||
| 49 | .width('100%') | 103 | .width('100%') |
| 50 | - .height(75) | ||
| 51 | - .margin({top:8}) | ||
| 52 | - .borderRadius(8) | ||
| 53 | - | 104 | + .margin({ top: 8 }) |
| 54 | } | 105 | } |
| 55 | .width('100%') | 106 | .width('100%') |
| 56 | .justifyContent(FlexAlign.Start) | 107 | .justifyContent(FlexAlign.Start) |
| 57 | .alignItems(HorizontalAlign.Start) | 108 | .alignItems(HorizontalAlign.Start) |
| 58 | - .padding({top:14}) | ||
| 59 | - .onClick((event: ClickEvent)=>{ | 109 | + .onClick((event: ClickEvent) => { |
| 60 | ProcessUtils.processPage(this.contentDTO) | 110 | ProcessUtils.processPage(this.contentDTO) |
| 61 | }) | 111 | }) |
| 62 | - | ||
| 63 | - | ||
| 64 | - //bottom | ||
| 65 | - Row() { | ||
| 66 | - Text(this.contentDTO.source) | ||
| 67 | - .bottomTextStyle() | ||
| 68 | - //间隔点 | ||
| 69 | - Image($r('app.media.point')) | ||
| 70 | - .width(12) | ||
| 71 | - .height(12) | ||
| 72 | - | ||
| 73 | - Text(this.contentDTO.publishTime) | ||
| 74 | - .bottomTextStyle() | ||
| 75 | - Text(' ') | ||
| 76 | - | ||
| 77 | - Text('518条评论') | ||
| 78 | - .bottomTextStyle() | ||
| 79 | - | ||
| 80 | - } | ||
| 81 | - .width('100%') | ||
| 82 | - | ||
| 83 | - .justifyContent(FlexAlign.Start) | ||
| 84 | - // .padding({bottom:14}) | ||
| 85 | - .margin({top:8}) | ||
| 86 | - .padding({bottom:14}) | ||
| 87 | - | 112 | + //bottom 评论等信息 |
| 113 | + CardSourceInfo({ contentDTO: this.contentDTO }) | ||
| 88 | } | 114 | } |
| 89 | - .width('100%') | ||
| 90 | - .padding({top:8,left:16,right:16}) | ||
| 91 | - | 115 | + .width(CommonConstants.FULL_WIDTH) |
| 116 | + .padding({ | ||
| 117 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 118 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 119 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 120 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 121 | + }) | ||
| 92 | } | 122 | } |
| 93 | } | 123 | } |
| 94 | 124 | ||
| 95 | 125 | ||
| 96 | -@Extend(Text) function bottomTextStyle() { | 126 | +@Extend(Text) |
| 127 | +function bottomTextStyle() { | ||
| 97 | .fontSize(12) | 128 | .fontSize(12) |
| 98 | .fontColor('#B0B0B0') | 129 | .fontColor('#B0B0B0') |
| 99 | } | 130 | } |
| @@ -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 | }) |
-
Please register or login to post a comment