Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
# Conflicts: # sight_harmony/features/wdComponent/Index.ets
Showing
100 changed files
with
2477 additions
and
758 deletions
Too many changes to show.
To preserve performance only 100 of 100+ files are displayed.
| @@ -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 | + |
| @@ -38,4 +38,8 @@ export { NumberFormatterUtils } from './src/main/ets/utils/NumberFormatterUtils' | @@ -38,4 +38,8 @@ 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' |
| @@ -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 | } |
| @@ -180,12 +187,5 @@ export class CollectionUtils { | @@ -180,12 +187,5 @@ export class CollectionUtils { | ||
| 180 | return collection.slice(start, end); | 187 | return collection.slice(start, end); |
| 181 | } | 188 | } |
| 182 | 189 | ||
| 183 | - | ||
| 184 | - static getElement(collection?: any[], index?: number): any { | ||
| 185 | - if (CollectionUtils.isEmpty(collection) || index === undefined) { | ||
| 186 | - return null; | ||
| 187 | - } | ||
| 188 | - return index >= 0 && index < collection.length ? collection[index] : null; | ||
| 189 | - } | ||
| 190 | } | 190 | } |
| 191 | 191 |
| 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 | +} |
| @@ -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 | +} |
| @@ -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"; |
| @@ -108,6 +112,10 @@ export class HttpUrlUtils { | @@ -108,6 +112,10 @@ export class HttpUrlUtils { | ||
| 108 | */ | 112 | */ |
| 109 | static readonly APPOINTMENT_userArea_PATH: string = "/api/rmrb-content-center/c/service/sys-area/treeselect"; | 113 | static readonly APPOINTMENT_userArea_PATH: string = "/api/rmrb-content-center/c/service/sys-area/treeselect"; |
| 110 | /** | 114 | /** |
| 115 | + * 用户token刷新接口(token过期,需要刷新) | ||
| 116 | + */ | ||
| 117 | + static readonly REFRESH_TOKEN_PATH: string = "/api/rmrb-user-center/auth/zh/c/refreshToken"; | ||
| 118 | + /** | ||
| 111 | /** | 119 | /** |
| 112 | * 个人中心 关注列表详情 | 120 | * 个人中心 关注列表详情 |
| 113 | */ | 121 | */ |
| @@ -131,7 +139,11 @@ export class HttpUrlUtils { | @@ -131,7 +139,11 @@ export class HttpUrlUtils { | ||
| 131 | /** | 139 | /** |
| 132 | * 我的收藏 | 140 | * 我的收藏 |
| 133 | */ | 141 | */ |
| 134 | - static readonly APPOINTMENT_MyCollectionList_PATH: string = "/api/rmrb-interact/content/zh/c/interact"; | 142 | + static readonly APPOINTMENT_MyCollectionList_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/interact"; |
| 143 | + /** | ||
| 144 | + * 收藏/取消收藏 status :收藏状态 1添加收藏 0取消收藏 | ||
| 145 | + */ | ||
| 146 | + static readonly APPOINTMENT_ExecuteCollcet_PATH: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord"; | ||
| 135 | /** | 147 | /** |
| 136 | * 个人中心 我的评论列表 | 148 | * 个人中心 我的评论列表 |
| 137 | */ | 149 | */ |
| @@ -180,7 +192,6 @@ export class HttpUrlUtils { | @@ -180,7 +192,6 @@ export class HttpUrlUtils { | ||
| 180 | * 搜索主页 热词 | 192 | * 搜索主页 热词 |
| 181 | */ | 193 | */ |
| 182 | static readonly SEARCH_HOTS_DATA_PATH: string = "/api/rmrb-search-api/zh/c/hots"; | 194 | static readonly SEARCH_HOTS_DATA_PATH: string = "/api/rmrb-search-api/zh/c/hots"; |
| 183 | - | ||
| 184 | /** | 195 | /** |
| 185 | * 搜索联想词 | 196 | * 搜索联想词 |
| 186 | */ | 197 | */ |
| @@ -190,7 +201,6 @@ export class HttpUrlUtils { | @@ -190,7 +201,6 @@ export class HttpUrlUtils { | ||
| 190 | * 直播详情 | 201 | * 直播详情 |
| 191 | */ | 202 | */ |
| 192 | static readonly LIVE_DETAILS_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail"; | 203 | static readonly LIVE_DETAILS_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail"; |
| 193 | - | ||
| 194 | /** | 204 | /** |
| 195 | * 直播详情-直播间列表 | 205 | * 直播详情-直播间列表 |
| 196 | */ | 206 | */ |
| @@ -350,7 +360,7 @@ export class HttpUrlUtils { | @@ -350,7 +360,7 @@ export class HttpUrlUtils { | ||
| 350 | return ''; | 360 | return ''; |
| 351 | } | 361 | } |
| 352 | 362 | ||
| 353 | - private static getDeviceId() { | 363 | + public static getDeviceId() { |
| 354 | // TODO | 364 | // TODO |
| 355 | return '8a81226a-cabd-3e1b-b630-b51db4a720ed'; | 365 | return '8a81226a-cabd-3e1b-b630-b51db4a720ed'; |
| 356 | } | 366 | } |
| @@ -444,6 +454,10 @@ export class HttpUrlUtils { | @@ -444,6 +454,10 @@ export class HttpUrlUtils { | ||
| 444 | return url; | 454 | return url; |
| 445 | } | 455 | } |
| 446 | 456 | ||
| 457 | + static getRefreshTokenUrl() { | ||
| 458 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.REFRESH_TOKEN_PATH; | ||
| 459 | + return url; | ||
| 460 | + } | ||
| 447 | 461 | ||
| 448 | static getResetPassworddUrl() { | 462 | static getResetPassworddUrl() { |
| 449 | let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/resetPassword"; | 463 | let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/resetPassword"; |
| @@ -480,6 +494,20 @@ export class HttpUrlUtils { | @@ -480,6 +494,20 @@ export class HttpUrlUtils { | ||
| 480 | return url; | 494 | return url; |
| 481 | } | 495 | } |
| 482 | 496 | ||
| 497 | + | ||
| 498 | + /*优质评论页*/ | ||
| 499 | + static getQualityCommentUrl() { | ||
| 500 | + let url = HttpUrlUtils._hostUrl + "api/rmrb-comment/comment/zh/c/highQuality" | ||
| 501 | + return url | ||
| 502 | + } | ||
| 503 | + | ||
| 504 | + /*获取详情页评论列表*/ | ||
| 505 | + static getContentCommentListDataUrl() { | ||
| 506 | + let url = HttpUrlUtils._hostUrl + "api/rmrb-comment/comment/zh/c/contentCommentList" | ||
| 507 | + return url | ||
| 508 | + } | ||
| 509 | + | ||
| 510 | + | ||
| 483 | //账户注销 | 511 | //账户注销 |
| 484 | static accountLogoutUrl() { | 512 | static accountLogoutUrl() { |
| 485 | let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/logoff"; | 513 | let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/logoff"; |
| @@ -498,7 +526,12 @@ export class HttpUrlUtils { | @@ -498,7 +526,12 @@ export class HttpUrlUtils { | ||
| 498 | } | 526 | } |
| 499 | 527 | ||
| 500 | static getMyCollectionListDataUrl() { | 528 | static getMyCollectionListDataUrl() { |
| 501 | - let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.APPOINTMENT_MyCollectionList_PATH | 529 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_MyCollectionList_PATH |
| 530 | + return url | ||
| 531 | + } | ||
| 532 | + | ||
| 533 | + static getExecuteCollcetUrl() { | ||
| 534 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH | ||
| 502 | return url | 535 | return url |
| 503 | } | 536 | } |
| 504 | 537 |
| @@ -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 | }) |
| @@ -32,6 +32,8 @@ export class WDRouterPage { | @@ -32,6 +32,8 @@ 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"); |
| @@ -45,6 +47,8 @@ export class WDRouterPage { | @@ -45,6 +47,8 @@ export class WDRouterPage { | ||
| 45 | static multiPictureDetailPage = new WDRouterPage("phone", "ets/pages/detail/MultiPictureDetailPage"); | 47 | static multiPictureDetailPage = new WDRouterPage("phone", "ets/pages/detail/MultiPictureDetailPage"); |
| 46 | // 音乐详情页 | 48 | // 音乐详情页 |
| 47 | 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"); | ||
| 48 | static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); | 52 | static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); |
| 49 | static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); | 53 | static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); |
| 50 | //我的 预约 | 54 | //我的 预约 |
| @@ -10,7 +10,7 @@ export class H5CallNativeType { | @@ -10,7 +10,7 @@ export class H5CallNativeType { | ||
| 10 | static jsCall_callAppService = 'jsCall_callAppService' | 10 | static jsCall_callAppService = 'jsCall_callAppService' |
| 11 | // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。 | 11 | // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。 |
| 12 | 12 | ||
| 13 | - static init() { | 13 | + static { |
| 14 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_currentPageOperate) | 14 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_currentPageOperate) |
| 15 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppPublicInfo) | 15 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppPublicInfo) |
| 16 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getArticleDetailBussinessData) | 16 | H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getArticleDetailBussinessData) |
| @@ -6,6 +6,7 @@ import { BridgeHandler, BridgeUtil, BridgeWebViewControl, Callback } from 'wdJsB | @@ -6,6 +6,7 @@ import { BridgeHandler, BridgeUtil, BridgeWebViewControl, Callback } from 'wdJsB | ||
| 6 | import { performJSCallNative } from './JsBridgeBiz'; | 6 | import { performJSCallNative } from './JsBridgeBiz'; |
| 7 | import { setDefaultNativeWebSettings } from './WebComponentUtil'; | 7 | import { setDefaultNativeWebSettings } from './WebComponentUtil'; |
| 8 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | 8 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; |
| 9 | +import { H5CallNativeType } from './H5CallNativeType'; | ||
| 9 | 10 | ||
| 10 | const TAG = 'WdWebComponent'; | 11 | const TAG = 'WdWebComponent'; |
| 11 | 12 | ||
| @@ -80,16 +81,11 @@ export struct WdWebComponent { | @@ -80,16 +81,11 @@ export struct WdWebComponent { | ||
| 80 | this.onPageEnd(event?.url) | 81 | this.onPageEnd(event?.url) |
| 81 | }) | 82 | }) |
| 82 | .onPageBegin((event) => { | 83 | .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') | 84 | + this.onPageBegin(event?.url); |
| 85 | + this.registerHandlers(); | ||
| 86 | + setTimeout(() => { | ||
| 87 | + BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl) | ||
| 88 | + }, 200) | ||
| 93 | }) | 89 | }) |
| 94 | .onLoadIntercept((event) => { | 90 | .onLoadIntercept((event) => { |
| 95 | let url: string = event.data.getRequestUrl().toString() | 91 | let url: string = event.data.getRequestUrl().toString() |
| @@ -115,5 +111,16 @@ export struct WdWebComponent { | @@ -115,5 +111,16 @@ export struct WdWebComponent { | ||
| 115 | this.webviewControl.refresh() | 111 | this.webviewControl.refresh() |
| 116 | } | 112 | } |
| 117 | } | 113 | } |
| 114 | + | ||
| 115 | + private registerHandlers(): void { | ||
| 116 | + // 注册h5调用js相关 | ||
| 117 | + for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) { | ||
| 118 | + let handleName = H5CallNativeType.JsCallTypeList[i]; | ||
| 119 | + let handle = (data: Message, f: Callback) => { | ||
| 120 | + this.defaultPerformJSCallNative(data, f) | ||
| 121 | + } ; | ||
| 122 | + this.webviewControl.registerHandler(handleName, { handle: handle }); | ||
| 123 | + } | ||
| 124 | + } | ||
| 118 | } | 125 | } |
| 119 | 126 |
| @@ -31,21 +31,14 @@ export struct WdWebLocalComponent { | @@ -31,21 +31,14 @@ export struct WdWebLocalComponent { | ||
| 31 | .visibility(this.backVisibility ? Visibility.Visible : Visibility.None) | 31 | .visibility(this.backVisibility ? Visibility.Visible : Visibility.None) |
| 32 | 32 | ||
| 33 | Web({ src: this.webResource, controller: this.webviewControl }) | 33 | Web({ src: this.webResource, controller: this.webviewControl }) |
| 34 | + .layoutMode(WebLayoutMode.FIT_CONTENT) | ||
| 34 | .domStorageAccess(true) | 35 | .domStorageAccess(true) |
| 35 | .databaseAccess(true) | 36 | .databaseAccess(true) |
| 36 | .javaScriptAccess(true) | 37 | .javaScriptAccess(true) |
| 38 | + // .imageAccess(true) | ||
| 39 | + // .onlineImageAccess(true) | ||
| 40 | + // .fileAccess(true) | ||
| 37 | .onPageBegin((event) => { | 41 | .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); | 42 | this.onPageBegin(event?.url); |
| 50 | this.registerHandlers(); | 43 | this.registerHandlers(); |
| 51 | setTimeout(() => { | 44 | setTimeout(() => { |
| @@ -75,8 +68,6 @@ export struct WdWebLocalComponent { | @@ -75,8 +68,6 @@ export struct WdWebLocalComponent { | ||
| 75 | } | 68 | } |
| 76 | 69 | ||
| 77 | private registerHandlers(): void { | 70 | private registerHandlers(): void { |
| 78 | - // TODO 待优化 | ||
| 79 | - H5CallNativeType.init(); | ||
| 80 | // 注册h5调用js相关 | 71 | // 注册h5调用js相关 |
| 81 | for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) { | 72 | for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) { |
| 82 | let handleName = H5CallNativeType.JsCallTypeList[i]; | 73 | let handleName = H5CallNativeType.JsCallTypeList[i]; |
| @@ -85,13 +76,6 @@ export struct WdWebLocalComponent { | @@ -85,13 +76,6 @@ export struct WdWebLocalComponent { | ||
| 85 | } ; | 76 | } ; |
| 86 | this.webviewControl.registerHandler(handleName, { handle: handle }); | 77 | this.webviewControl.registerHandler(handleName, { handle: handle }); |
| 87 | } | 78 | } |
| 88 | - // // TODO test | ||
| 89 | - // this.webviewControl.registerHandler('changeNativeMessage', { | ||
| 90 | - // handle: (data: Message, f: Callback) => { | ||
| 91 | - // this.defaultPerformJSCallNative(data, f) | ||
| 92 | - // } | ||
| 93 | - // }); | ||
| 94 | - | ||
| 95 | } | 79 | } |
| 96 | 80 | ||
| 97 | /** | 81 | /** |
| @@ -107,7 +91,7 @@ export struct WdWebLocalComponent { | @@ -107,7 +91,7 @@ export struct WdWebLocalComponent { | ||
| 107 | Logger.debug(TAG, 'onPageEnd'); | 91 | Logger.debug(TAG, 'onPageEnd'); |
| 108 | } | 92 | } |
| 109 | onLoadIntercept: (url?: string) => boolean = () => { | 93 | onLoadIntercept: (url?: string) => boolean = () => { |
| 110 | - Logger.debug(TAG, 'onPageBegin return false'); | 94 | + Logger.debug(TAG, 'onLoadIntercept return false'); |
| 111 | return false | 95 | return false |
| 112 | } | 96 | } |
| 113 | } | 97 | } |
| @@ -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 |
| @@ -29,5 +29,4 @@ export interface CompDTO { | @@ -29,5 +29,4 @@ 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; | ||
| 33 | } | 32 | } |
| @@ -62,11 +62,13 @@ export interface ContentDTO { | @@ -62,11 +62,13 @@ export interface ContentDTO { | ||
| 62 | // 二次请求接口,返回的数据,这里组装到content里; | 62 | // 二次请求接口,返回的数据,这里组装到content里; |
| 63 | interactData:InteractDataDTO; | 63 | interactData:InteractDataDTO; |
| 64 | 64 | ||
| 65 | - hasMore: number; | ||
| 66 | - slideShows: slideShows[]; | ||
| 67 | - voiceInfo: VoiceInfoDTO; | ||
| 68 | - tagWord: number; | 65 | + hasMore: number, |
| 66 | + slideShows: slideShows[], | ||
| 67 | + voiceInfo: VoiceInfoDTO, | ||
| 68 | + tagWord: number, | ||
| 69 | + isSelect: boolean; | ||
| 69 | rmhInfo: RmhInfoDTO; // 人民号信息 | 70 | rmhInfo: RmhInfoDTO; // 人民号信息 |
| 70 | - photoNum: string; | 71 | + photoNum: number; |
| 72 | + | ||
| 71 | 73 | ||
| 72 | } | 74 | } |
| @@ -4,6 +4,7 @@ export interface VideoInfoDTO { | @@ -4,6 +4,7 @@ export interface VideoInfoDTO { | ||
| 4 | resolutionWidth: number; | 4 | resolutionWidth: number; |
| 5 | videoDuration: number; // 视频时长 | 5 | videoDuration: number; // 视频时长 |
| 6 | videoLandScape: number; // 1横屏 2竖屏 | 6 | videoLandScape: number; // 1横屏 2竖屏 |
| 7 | + videoLandscape: number; // 1横屏 2竖屏 | ||
| 7 | videoType: number; | 8 | videoType: number; |
| 8 | videoUrl: string; //视频播放地址 | 9 | videoUrl: string; //视频播放地址 |
| 9 | firstFrameImageUri: string; // 首帧图;【视频内容,contentPictures中】 | 10 | firstFrameImageUri: string; // 首帧图;【视频内容,contentPictures中】 |
| @@ -10,7 +10,7 @@ export interface ResponseBean{ | @@ -10,7 +10,7 @@ export interface ResponseBean{ | ||
| 10 | message: string; | 10 | message: string; |
| 11 | 11 | ||
| 12 | // 响应结果 | 12 | // 响应结果 |
| 13 | - data:ContentDetailDTO; | 13 | + data:ContentDetailDTO[]; |
| 14 | 14 | ||
| 15 | // 请求响应时间戳(unix格式) | 15 | // 请求响应时间戳(unix格式) |
| 16 | timestamp?: number; | 16 | timestamp?: number; |
| 1 | +/** | ||
| 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 | +} |
| @@ -64,5 +64,3 @@ export { FirstTabTopSearchComponent } from "./src/main/ets/components/search/Fir | @@ -64,5 +64,3 @@ export { FirstTabTopSearchComponent } from "./src/main/ets/components/search/Fir | ||
| 64 | export { ListHasNoMoreDataUI } from "./src/main/ets/components/reusable/ListHasNoMoreDataUI" | 64 | export { ListHasNoMoreDataUI } from "./src/main/ets/components/reusable/ListHasNoMoreDataUI" |
| 65 | 65 | ||
| 66 | export { LottieView } from './src/main/ets/lottie/LottieView' | 66 | export { LottieView } from './src/main/ets/lottie/LottieView' |
| 67 | - | ||
| 68 | -export { AudioSuspensionModel } from "./src/main/ets/viewmodel/AudioSuspensionModel" |
| @@ -16,6 +16,7 @@ | @@ -16,6 +16,7 @@ | ||
| 16 | "wdBean": "file:../../features/wdBean", | 16 | "wdBean": "file:../../features/wdBean", |
| 17 | "wdDetailPlayShortVideo": "file:../../features/wdDetailPlayShortVideo", | 17 | "wdDetailPlayShortVideo": "file:../../features/wdDetailPlayShortVideo", |
| 18 | "wdRouter": "file:../../commons/wdRouter", | 18 | "wdRouter": "file:../../commons/wdRouter", |
| 19 | - "wdNetwork": "file:../../commons/wdNetwork" | 19 | + "wdNetwork": "file:../../commons/wdNetwork", |
| 20 | + "wdJsBridge": "file:../../commons/wdJsBridge" | ||
| 20 | } | 21 | } |
| 21 | } | 22 | } |
| @@ -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 | + async aboutToAppear() { | ||
| 21 | + await this.getContentDetailData() | ||
| 22 | + } | ||
| 23 | + onPageHide() { | ||
| 24 | + | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + build() { | ||
| 28 | + Row() { | ||
| 29 | + Column(){ | ||
| 30 | + Text("this is a test!") | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + } | ||
| 35 | + private async getContentDetailData() { | ||
| 36 | + try { | ||
| 37 | + let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) | ||
| 38 | + this.contentDetailData = data; | ||
| 39 | + console.log('动态详情',JSON.stringify(this.contentDetailData)) | ||
| 40 | + } catch (exception) { | ||
| 41 | + console.log('请求失败',JSON.stringify(exception)) | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | +} |
| @@ -33,156 +33,139 @@ export interface OperationItem { | @@ -33,156 +33,139 @@ export interface OperationItem { | ||
| 33 | export struct ImageAndTextPageComponent { | 33 | export struct ImageAndTextPageComponent { |
| 34 | scroller: Scroller = new Scroller(); | 34 | scroller: Scroller = new Scroller(); |
| 35 | action: Action = {} as Action | 35 | action: Action = {} as Action |
| 36 | - @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 36 | + @State contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO [] |
| 37 | @State recommendList: ContentDTO[] = [] | 37 | @State recommendList: ContentDTO[] = [] |
| 38 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | 38 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 |
| 39 | @State interactData: InteractDataDTO = {} as InteractDataDTO | 39 | @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 | 40 | ||
| 61 | build() { | 41 | build() { |
| 62 | Column() { | 42 | 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) | 43 | + // 发布时间 |
| 44 | + Row() { | ||
| 45 | + Image($r('app.media.icon_ren_min_ri_bao')) | ||
| 46 | + .width(70) | ||
| 47 | + .height(28) | ||
| 48 | + Text(this.contentDetailData[0]?.publishTime) | ||
| 49 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 50 | + .fontSize($r('app.float.font_size_13')) | ||
| 51 | + .height('100%') | ||
| 52 | + .align(Alignment.End) | ||
| 53 | + } | ||
| 54 | + .width(CommonConstants.FULL_WIDTH) | ||
| 55 | + .height(32) | ||
| 56 | + .padding({ left: 15, right: 15, }) | ||
| 57 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 58 | + .backgroundColor(Color.White) | ||
| 89 | 59 | ||
| 60 | + Row() { | ||
| 61 | + Image($r('app.media.line')) | ||
| 62 | + .width('100%') | ||
| 63 | + .height(6) | ||
| 64 | + .objectFit(ImageFit.Cover) | ||
| 65 | + .margin({ top: 10 }) | ||
| 66 | + } | ||
| 67 | + .padding({ left: 15, right: 15, }) | ||
| 68 | + .backgroundColor(Color.White) | ||
| 90 | 69 | ||
| 91 | - Stack({ alignContent: Alignment.Bottom }) { | ||
| 92 | - List() { | ||
| 93 | - //详情展示区 | 70 | + Stack({ alignContent: Alignment.Bottom }) { |
| 71 | + List() { | ||
| 72 | + //详情展示区 | ||
| 73 | + ListItem() { | ||
| 74 | + Column() { | ||
| 75 | + ImageAndTextWebComponent({ | ||
| 76 | + contentDetailData: this.contentDetailData, | ||
| 77 | + action: this.action, | ||
| 78 | + }) | ||
| 79 | + }.width(CommonConstants.FULL_WIDTH) | ||
| 80 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + if (this.contentDetailData[0]?.openLikes === 1) { | ||
| 94 | ListItem() { | 84 | ListItem() { |
| 95 | - Column() { | ||
| 96 | - ImageAndTextWebComponent({ contentDetailData: this.contentDetailData, action: this.action }) | ||
| 97 | - }.width(CommonConstants.FULL_WIDTH) | ||
| 98 | - .height(CommonConstants.FULL_HEIGHT) | ||
| 99 | - } | ||
| 100 | - .backgroundColor(Color.White) | 85 | + // 点赞 |
| 86 | + Row() { | ||
| 87 | + Row() { | ||
| 88 | + if (this.newsStatusOfUser?.likeStatus === '1') { | ||
| 89 | + Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : $r('app.media.icon_candle_active'))) | ||
| 90 | + .width(24) | ||
| 91 | + .height(24) | ||
| 92 | + .margin({ right: 5 }) | ||
| 93 | + } else { | ||
| 94 | + Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : $r('app.media.icon_candle'))) | ||
| 95 | + .width(24) | ||
| 96 | + .height(24) | ||
| 97 | + .margin({ right: 5 }) | ||
| 98 | + } | ||
| 99 | + Text(`${this.interactData?.likeNum || 0}`) | ||
| 100 | + .fontSize(16) | ||
| 101 | + .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999') | ||
| 102 | + .fontWeight(500) | ||
| 103 | + }.alignItems(VerticalAlign.Center) | ||
| 104 | + .onClick(() => { | ||
| 105 | + this.toggleLikeStatus() | ||
| 106 | + }) | ||
| 101 | 107 | ||
| 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 | - // } | 108 | + }.width(CommonConstants.FULL_WIDTH).height(80) |
| 109 | + .justifyContent(FlexAlign.Center) | ||
| 110 | + } | ||
| 111 | + .border({ | ||
| 112 | + width: { bottom: 5 }, | ||
| 113 | + color: '#f5f5f5', | ||
| 114 | + }) | ||
| 115 | + } | ||
| 133 | 116 | ||
| 134 | - //相关推荐区 | ||
| 135 | - // ListItem() { | ||
| 136 | - // RecommendList({ recommendList: this.recommendList }) | ||
| 137 | - // } | ||
| 138 | - // .backgroundColor(Color.White) | 117 | + // 相关推荐区 |
| 118 | + ListItem() { | ||
| 119 | + RecommendList({ recommendList: this.recommendList }) | ||
| 139 | } | 120 | } |
| 140 | - .width(CommonConstants.FULL_WIDTH) | ||
| 141 | - .height(CommonConstants.FULL_HEIGHT) | ||
| 142 | - .padding({ bottom: 56 }) | ||
| 143 | - .scrollBar(BarState.Off) | ||
| 144 | - .edgeEffect(EdgeEffect.None) | 121 | + } |
| 122 | + .width(CommonConstants.FULL_WIDTH) | ||
| 123 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 124 | + .padding({ bottom: 56 }) | ||
| 125 | + .scrollBar(BarState.Off) | ||
| 126 | + .edgeEffect(EdgeEffect.None) | ||
| 127 | + | ||
| 128 | + //底部交互区 | ||
| 129 | + Row() { | ||
| 130 | + Image($r('app.media.icon_arrow_left')) | ||
| 131 | + .width(24) | ||
| 132 | + .height(24) | ||
| 133 | + .onClick((event: ClickEvent) => { | ||
| 134 | + router.back() | ||
| 135 | + }) | ||
| 145 | 136 | ||
| 146 | - //底部交互区 | ||
| 147 | Row() { | 137 | Row() { |
| 148 | - Image($r('app.media.icon_arrow_left')) | 138 | + Image($r('app.media.icon_comment')) |
| 149 | .width(24) | 139 | .width(24) |
| 150 | .height(24) | 140 | .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') | 141 | + .margin({ right: 24 }) |
| 142 | + .id('comment') | ||
| 161 | 143 | ||
| 162 | - Image($r('app.media.icon_star')) | ||
| 163 | - .width(24) | ||
| 164 | - .height(24) | ||
| 165 | - .margin({ right: 24 }) | 144 | + Image($r('app.media.icon_star')) |
| 145 | + .width(24) | ||
| 146 | + .height(24) | ||
| 147 | + .margin({ right: 24 }) | ||
| 166 | 148 | ||
| 167 | - Image($r('app.media.icon_listen')) | ||
| 168 | - .width(24) | ||
| 169 | - .height(24) | ||
| 170 | - .margin({ right: 24 }) | 149 | + Image($r('app.media.icon_listen')) |
| 150 | + .width(24) | ||
| 151 | + .height(24) | ||
| 152 | + .margin({ right: 24 }) | ||
| 171 | 153 | ||
| 172 | - Image($r('app.media.icon_forward')) | ||
| 173 | - .width(24) | ||
| 174 | - .height(24) | 154 | + Image($r('app.media.icon_forward')) |
| 155 | + .width(24) | ||
| 156 | + .height(24) | ||
| 175 | 157 | ||
| 176 | - } | ||
| 177 | } | 158 | } |
| 178 | - .width(CommonConstants.FULL_WIDTH) | ||
| 179 | - .height(56) | ||
| 180 | - .backgroundColor(Color.White) | ||
| 181 | - .padding({ left: 15, right: 15, }) | ||
| 182 | - .justifyContent(FlexAlign.SpaceBetween) | ||
| 183 | } | 159 | } |
| 184 | - }.backgroundColor("#f5f5f5") | 160 | + .width(CommonConstants.FULL_WIDTH) |
| 161 | + .height(56) | ||
| 162 | + .padding({ left: 15, right: 15, bottom: 50, top: 20 }) | ||
| 163 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 164 | + .backgroundColor(Color.White) | ||
| 165 | + } | ||
| 185 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | 166 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) |
| 167 | + .backgroundColor(Color.White) | ||
| 168 | + | ||
| 186 | } | 169 | } |
| 187 | 170 | ||
| 188 | private async getDetail() { | 171 | private async getDetail() { |
| @@ -204,28 +187,28 @@ export struct ImageAndTextPageComponent { | @@ -204,28 +187,28 @@ export struct ImageAndTextPageComponent { | ||
| 204 | } | 187 | } |
| 205 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) | 188 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) |
| 206 | if (detailBeans && detailBeans.length > 0) { | 189 | 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 | - // } | 190 | + this.contentDetailData = detailBeans; |
| 191 | + if (this.contentDetailData[0]?.recommendShow === 1) { | ||
| 192 | + this.getRecommend() | ||
| 193 | + } | ||
| 194 | + if (this.contentDetailData[0]?.openLikes === 1) { | ||
| 195 | + this.getInteractDataStatus() | ||
| 196 | + this.queryContentInteractCount() | ||
| 197 | + } | ||
| 216 | } | 198 | } |
| 217 | } | 199 | } |
| 218 | } | 200 | } |
| 219 | 201 | ||
| 202 | + | ||
| 220 | private async getRecommend() { | 203 | private async getRecommend() { |
| 221 | let params: postRecommendListParams = { | 204 | let params: postRecommendListParams = { |
| 222 | imei: "8272c108-4fa2-34ce-80b9-bc425a7c2a7e", | 205 | imei: "8272c108-4fa2-34ce-80b9-bc425a7c2a7e", |
| 223 | userId: HttpUrlUtils.getUserId(), | 206 | userId: HttpUrlUtils.getUserId(), |
| 224 | - contentId: String(this.contentDetailData.newsId), | 207 | + contentId: String(this.contentDetailData[0]?.newsId), |
| 225 | recType: 1, | 208 | recType: 1, |
| 226 | - contentType: this.contentDetailData.newsType, | ||
| 227 | - relId: this.contentDetailData?.reLInfo?.relId, | ||
| 228 | - channelId: String(this.contentDetailData?.reLInfo?.channelId) | 209 | + contentType: this.contentDetailData[0]?.newsType, |
| 210 | + relId: this.contentDetailData[0]?.reLInfo?.relId, | ||
| 211 | + channelId: String(this.contentDetailData[0]?.reLInfo?.channelId) | ||
| 229 | } | 212 | } |
| 230 | let recommendList = await DetailViewModel.postRecommendList(params) | 213 | let recommendList = await DetailViewModel.postRecommendList(params) |
| 231 | if (recommendList && recommendList.length > 0) { | 214 | if (recommendList && recommendList.length > 0) { |
| @@ -239,8 +222,8 @@ export struct ImageAndTextPageComponent { | @@ -239,8 +222,8 @@ export struct ImageAndTextPageComponent { | ||
| 239 | const params: batchLikeAndCollectParams = { | 222 | const params: batchLikeAndCollectParams = { |
| 240 | contentList: [ | 223 | contentList: [ |
| 241 | { | 224 | { |
| 242 | - contentId: this.contentDetailData?.newsId + '', | ||
| 243 | - contentType: this.contentDetailData?.newsType + '', | 225 | + contentId: this.contentDetailData[0]?.newsId + '', |
| 226 | + contentType: this.contentDetailData[0]?.newsType + '', | ||
| 244 | } | 227 | } |
| 245 | ] | 228 | ] |
| 246 | } | 229 | } |
| @@ -265,8 +248,8 @@ export struct ImageAndTextPageComponent { | @@ -265,8 +248,8 @@ export struct ImageAndTextPageComponent { | ||
| 265 | } | 248 | } |
| 266 | const params: postExecuteLikeParams = { | 249 | const params: postExecuteLikeParams = { |
| 267 | status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1', | 250 | status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1', |
| 268 | - contentId: this.contentDetailData?.newsId + '', | ||
| 269 | - contentType: this.contentDetailData?.newsType + '', | 251 | + contentId: this.contentDetailData[0]?.newsId + '', |
| 252 | + contentType: this.contentDetailData[0]?.newsType + '', | ||
| 270 | } | 253 | } |
| 271 | PageRepository.postExecuteLike(params).then(res => { | 254 | PageRepository.postExecuteLike(params).then(res => { |
| 272 | console.log(TAG, '点赞、取消点赞', 'toggleLikeStatus==',) | 255 | console.log(TAG, '点赞、取消点赞', 'toggleLikeStatus==',) |
| @@ -285,8 +268,8 @@ export struct ImageAndTextPageComponent { | @@ -285,8 +268,8 @@ export struct ImageAndTextPageComponent { | ||
| 285 | console.error(TAG, 'contentDetailData2222', JSON.stringify(this.contentDetailData)) | 268 | console.error(TAG, 'contentDetailData2222', JSON.stringify(this.contentDetailData)) |
| 286 | const params: contentListParams = { | 269 | const params: contentListParams = { |
| 287 | contentList: [{ | 270 | contentList: [{ |
| 288 | - contentId: this.contentDetailData?.newsId + '', | ||
| 289 | - contentType: this.contentDetailData?.newsType, | 271 | + contentId: this.contentDetailData[0]?.newsId + '', |
| 272 | + contentType: this.contentDetailData[0]?.newsType, | ||
| 290 | }] | 273 | }] |
| 291 | } | 274 | } |
| 292 | PageRepository.getContentInteract(params).then(res => { | 275 | 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 | } |
| 1 | +import { Action, ContentDetailDTO, ContentDTO, batchLikeAndCollectResult, InteractDataDTO, } from 'wdBean'; | ||
| 2 | +import DetailViewModel from '../viewmodel/DetailViewModel'; | ||
| 3 | +import { OperRowListView } from './view/OperRowListView'; | ||
| 4 | +import { WdWebComponent } from 'wdWebComponent'; | ||
| 5 | +import router from '@ohos.router'; | ||
| 6 | +import { CommonConstants } from 'wdConstant' | ||
| 7 | + | ||
| 8 | +const TAG = 'SpacialTopicPageComponent' | ||
| 9 | + | ||
| 10 | +@Component | ||
| 11 | +export struct SpacialTopicPageComponent { | ||
| 12 | + scroller: Scroller = new Scroller(); | ||
| 13 | + action: Action = {} as Action | ||
| 14 | + private webUrl?: string; | ||
| 15 | + @State contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO [] | ||
| 16 | + @State recommendList: ContentDTO[] = [] | ||
| 17 | + @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | ||
| 18 | + @State interactData: InteractDataDTO = {} as InteractDataDTO | ||
| 19 | + | ||
| 20 | + build() { | ||
| 21 | + Column() { | ||
| 22 | + Stack({ alignContent: Alignment.Bottom }) { | ||
| 23 | + Column() { | ||
| 24 | + WdWebComponent({ | ||
| 25 | + webUrl: this.webUrl, | ||
| 26 | + backVisibility: false | ||
| 27 | + }) | ||
| 28 | + } | ||
| 29 | + .padding({bottom:56}) | ||
| 30 | + .width(CommonConstants.FULL_WIDTH) | ||
| 31 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 32 | + | ||
| 33 | + //底部交互区 | ||
| 34 | + Row() { | ||
| 35 | + Image($r('app.media.icon_arrow_left')) | ||
| 36 | + .width(24) | ||
| 37 | + .height(24) | ||
| 38 | + .onClick((event: ClickEvent) => { | ||
| 39 | + router.back() | ||
| 40 | + }) | ||
| 41 | + | ||
| 42 | + Row() { | ||
| 43 | + Image($r('app.media.icon_comment')) | ||
| 44 | + .width(24) | ||
| 45 | + .height(24) | ||
| 46 | + .margin({ right: 24 }) | ||
| 47 | + .id('comment') | ||
| 48 | + | ||
| 49 | + Image($r('app.media.icon_star')) | ||
| 50 | + .width(24) | ||
| 51 | + .height(24) | ||
| 52 | + .margin({ right: 24 }) | ||
| 53 | + | ||
| 54 | + Image($r('app.media.icon_listen')) | ||
| 55 | + .width(24) | ||
| 56 | + .height(24) | ||
| 57 | + .margin({ right: 24 }) | ||
| 58 | + | ||
| 59 | + Image($r('app.media.icon_forward')) | ||
| 60 | + .width(24) | ||
| 61 | + .height(24) | ||
| 62 | + | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + .width(CommonConstants.FULL_WIDTH) | ||
| 66 | + .height(56) | ||
| 67 | + .padding({ left: 15, right: 15, bottom: 20, top: 20 }) | ||
| 68 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 69 | + .backgroundColor(Color.White) | ||
| 70 | + } | ||
| 71 | + }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | ||
| 72 | + .backgroundColor(Color.White) | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + // private async getDetail() { | ||
| 76 | + // let contentId: string = '' | ||
| 77 | + // let relId: string = '' | ||
| 78 | + // let relType: string = '' | ||
| 79 | + // if (this.action && this.action.params) { | ||
| 80 | + // if (this.action.params.contentID) { | ||
| 81 | + // contentId = this.action.params.contentID; | ||
| 82 | + // } | ||
| 83 | + // if (this.action && this.action.params && this.action.params.extra) { | ||
| 84 | + // if (this.action.params.extra.relId) { | ||
| 85 | + // relId = this.action.params.extra.relId; | ||
| 86 | + // } | ||
| 87 | + // if (this.action.params.extra.relType) { | ||
| 88 | + // relType = this.action.params.extra.relType | ||
| 89 | + // } | ||
| 90 | + // | ||
| 91 | + // } | ||
| 92 | + // let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) | ||
| 93 | + // if (detailBeans && detailBeans.length > 0) { | ||
| 94 | + // this.contentDetailData = detailBeans; | ||
| 95 | + // } | ||
| 96 | + // } | ||
| 97 | + // } | ||
| 98 | + | ||
| 99 | + aboutToAppear() { | ||
| 100 | + let action: Action = router.getParams() as Action | ||
| 101 | + if (action) { | ||
| 102 | + this.webUrl = action.params?.url | ||
| 103 | + } | ||
| 104 | + // this.getDetail() | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + aboutToDisappear() { | ||
| 108 | + } | ||
| 109 | +} |
| @@ -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 // 精选栏目组件信息 |
| @@ -15,37 +15,31 @@ export struct CardMediaInfo { | @@ -15,37 +15,31 @@ export struct CardMediaInfo { | ||
| 15 | 15 | ||
| 16 | build() { | 16 | build() { |
| 17 | Row() { | 17 | Row() { |
| 18 | - if(this.contentDTO.objectType === '1') { | ||
| 19 | - // 显示点播 | 18 | + if(this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15' ) { |
| 19 | + // 点播、动态视频 | ||
| 20 | Row(){ | 20 | Row(){ |
| 21 | Image($r('app.media.videoTypeIcon')) | 21 | Image($r('app.media.videoTypeIcon')) |
| 22 | - .width(22) | ||
| 23 | - .height(18) | ||
| 24 | - .borderRadius($r('app.float.button_border_radius')) | 22 | + .mediaLogo() |
| 25 | Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000)) | 23 | Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000)) |
| 26 | - .fontColor($r('app.color.color_fff')) | ||
| 27 | - .fontSize($r('app.float.font_size_12')) | ||
| 28 | - .width(40) | ||
| 29 | - .height(18) | ||
| 30 | - .textAlign(TextAlign.Center) | ||
| 31 | - .margin({ left: -3 }) | 24 | + .mediaText() |
| 32 | } | 25 | } |
| 33 | .backgroundColor('#4d000000') | 26 | .backgroundColor('#4d000000') |
| 34 | .borderRadius($r('app.float.button_border_radius')) | 27 | .borderRadius($r('app.float.button_border_radius')) |
| 35 | } else if(this.contentDTO.objectType === '2') { | 28 | } else if(this.contentDTO.objectType === '2') { |
| 29 | + // liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | ||
| 36 | // 显示直播信息 | 30 | // 显示直播信息 |
| 37 | Row(){ | 31 | Row(){ |
| 38 | - Image($r('app.media.icon_live')) | ||
| 39 | - .width(22) | ||
| 40 | - .height(18) | ||
| 41 | - .borderRadius($r('app.float.button_border_radius')) | ||
| 42 | - Text('直播中') | ||
| 43 | - .fontColor($r('app.color.color_fff')) | ||
| 44 | - .fontSize($r('app.float.font_size_12')) | ||
| 45 | - .width(40) | ||
| 46 | - .height(18) | ||
| 47 | - .textAlign(TextAlign.Center) | ||
| 48 | - .margin({ left: -3 }) | 32 | + if(this.contentDTO.liveInfo.liveState === 'running') { |
| 33 | + Image($r('app.media.icon_live')) | ||
| 34 | + .mediaLogo() | ||
| 35 | + Text('直播中') | ||
| 36 | + .mediaText() | ||
| 37 | + } else if(this.contentDTO.liveInfo.liveState === 'end'){ | ||
| 38 | + Image($r('app.media.videoTypeIcon')) | ||
| 39 | + .mediaLogo() | ||
| 40 | + Text('回看') | ||
| 41 | + .mediaText() | ||
| 42 | + } | ||
| 49 | } | 43 | } |
| 50 | .backgroundColor('#4d000000') | 44 | .backgroundColor('#4d000000') |
| 51 | .borderRadius($r('app.float.button_border_radius')) | 45 | .borderRadius($r('app.float.button_border_radius')) |
| @@ -53,16 +47,10 @@ export struct CardMediaInfo { | @@ -53,16 +47,10 @@ export struct CardMediaInfo { | ||
| 53 | // 显示组图;图片数量 | 47 | // 显示组图;图片数量 |
| 54 | Row(){ | 48 | Row(){ |
| 55 | Image($r('app.media.album_card_shape')) | 49 | Image($r('app.media.album_card_shape')) |
| 56 | - .width(22) | ||
| 57 | - .height(18) | ||
| 58 | - .borderRadius($r('app.float.button_border_radius')) | ||
| 59 | - Text(this.contentDTO.photoNum) | ||
| 60 | - .fontColor($r('app.color.color_fff')) | ||
| 61 | - .fontSize($r('app.float.font_size_12')) | 50 | + .mediaLogo() |
| 51 | + Text(`${this.contentDTO.photoNum}`) | ||
| 52 | + .mediaText() | ||
| 62 | .width(20) | 53 | .width(20) |
| 63 | - .height(18) | ||
| 64 | - .textAlign(TextAlign.Center) | ||
| 65 | - .margin({ left: -3 }) | ||
| 66 | } | 54 | } |
| 67 | .backgroundColor('#4d000000') | 55 | .backgroundColor('#4d000000') |
| 68 | .borderRadius($r('app.float.button_border_radius')) | 56 | .borderRadius($r('app.float.button_border_radius')) |
| @@ -73,15 +61,25 @@ export struct CardMediaInfo { | @@ -73,15 +61,25 @@ export struct CardMediaInfo { | ||
| 73 | .height(14) | 61 | .height(14) |
| 74 | .borderRadius($r('app.float.button_border_radius')) | 62 | .borderRadius($r('app.float.button_border_radius')) |
| 75 | Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000)) | 63 | Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000)) |
| 76 | - .fontColor($r('app.color.color_fff')) | ||
| 77 | - .fontSize($r('app.float.font_size_12')) | ||
| 78 | - .width(40) | ||
| 79 | - .height(18) | ||
| 80 | - .textAlign(TextAlign.Center) | ||
| 81 | - .margin({ left: -3 }) | 64 | + .mediaText() |
| 82 | } | 65 | } |
| 83 | } | 66 | } |
| 84 | } | 67 | } |
| 85 | .margin(6) | 68 | .margin(6) |
| 86 | } | 69 | } |
| 70 | + | ||
| 71 | + @Styles mediaLogo() { | ||
| 72 | + .width(22) | ||
| 73 | + .height(18) | ||
| 74 | + .borderRadius($r('app.float.button_border_radius')) | ||
| 75 | + } | ||
| 76 | +} | ||
| 77 | + | ||
| 78 | +@Extend(Text) function mediaText() { | ||
| 79 | + .fontColor($r('app.color.color_fff')) | ||
| 80 | + .fontSize($r('app.float.font_size_12')) | ||
| 81 | + .width(40) | ||
| 82 | + .height(18) | ||
| 83 | + .textAlign(TextAlign.Center) | ||
| 84 | + .margin({ left: -3 }) | ||
| 87 | } | 85 | } |
| @@ -4,7 +4,6 @@ | @@ -4,7 +4,6 @@ | ||
| 4 | import { RmhInfoDTO } from 'wdBean' | 4 | import { RmhInfoDTO } from 'wdBean' |
| 5 | import { CommonConstants } from 'wdConstant/Index'; | 5 | import { CommonConstants } from 'wdConstant/Index'; |
| 6 | 6 | ||
| 7 | -@Entry | ||
| 8 | @Component | 7 | @Component |
| 9 | export struct RmhTitle { | 8 | export struct RmhTitle { |
| 10 | @Prop rmhInfo: RmhInfoDTO | 9 | @Prop rmhInfo: RmhInfoDTO |
| @@ -2,11 +2,12 @@ | @@ -2,11 +2,12 @@ | ||
| 2 | import { CommonConstants } from 'wdConstant' | 2 | import { CommonConstants } from 'wdConstant' |
| 3 | import { ContentDTO } from 'wdBean' | 3 | import { ContentDTO } from 'wdBean' |
| 4 | import { DateTimeUtils } from 'wdKit' | 4 | import { DateTimeUtils } from 'wdKit' |
| 5 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 5 | 6 | ||
| 6 | const TAG = 'Card11Component'; | 7 | const TAG = 'Card11Component'; |
| 7 | 8 | ||
| 8 | /** | 9 | /** |
| 9 | - * 无图卡(标题省略) | 10 | + * 无图卡(标题省略) Card_11 = '11 |
| 10 | */ | 11 | */ |
| 11 | @Component | 12 | @Component |
| 12 | export struct Card11Component { | 13 | export struct Card11Component { |
| @@ -21,33 +22,38 @@ export struct Card11Component { | @@ -21,33 +22,38 @@ export struct Card11Component { | ||
| 21 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 22 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 22 | .width(CommonConstants.FULL_WIDTH) | 23 | .width(CommonConstants.FULL_WIDTH) |
| 23 | Row() { | 24 | Row() { |
| 24 | - Text("锐评") | ||
| 25 | - .fontSize($r("app.float.font_size_12")) | ||
| 26 | - .fontColor($r("app.color.color_ED2800")) | ||
| 27 | - Text(this.contentDTO.source) | ||
| 28 | - .fontSize($r("app.float.font_size_12")) | ||
| 29 | - .fontColor($r("app.color.color_B0B0B0")) | ||
| 30 | - .margin({ left: 6 }) | ||
| 31 | - Image($r("app.media.point")) | ||
| 32 | - .width(16) | ||
| 33 | - .height(16) | 25 | + if (this.contentDTO.source) { |
| 26 | + Text(this.contentDTO.source) | ||
| 27 | + .fontSize($r("app.float.font_size_12")) | ||
| 28 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 29 | + .margin({ left: 6 }) | ||
| 30 | + Image($r("app.media.point")) | ||
| 31 | + .width(16) | ||
| 32 | + .height(16) | ||
| 33 | + } | ||
| 34 | 34 | ||
| 35 | - Text(DateTimeUtils.formatDate(Number.parseFloat(this.contentDTO.publishTime))) | 35 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) |
| 36 | .fontSize($r("app.float.font_size_12")) | 36 | .fontSize($r("app.float.font_size_12")) |
| 37 | .fontColor($r("app.color.color_B0B0B0")) | 37 | .fontColor($r("app.color.color_B0B0B0")) |
| 38 | - | 38 | + .margin({ right: 6 }) |
| 39 | + // TODO '评论取哪个字段' | ||
| 40 | + // Text(`1806评`) | ||
| 41 | + // .fontSize($r("app.float.font_size_12")) | ||
| 42 | + // .fontColor($r("app.color.color_B0B0B0")) | ||
| 39 | }.width(CommonConstants.FULL_WIDTH) | 43 | }.width(CommonConstants.FULL_WIDTH) |
| 40 | .justifyContent(FlexAlign.Start) | 44 | .justifyContent(FlexAlign.Start) |
| 41 | .margin({ top: 8 }) | 45 | .margin({ top: 8 }) |
| 42 | 46 | ||
| 43 | }.width(CommonConstants.FULL_WIDTH) | 47 | }.width(CommonConstants.FULL_WIDTH) |
| 44 | .padding({ | 48 | .padding({ |
| 45 | - top: 14, | ||
| 46 | - left: 16, | ||
| 47 | - right: 16, | ||
| 48 | - bottom: 14 | 49 | + left: $r('app.float.card_comp_pagePadding_lf'), |
| 50 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 51 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 52 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 49 | }) | 53 | }) |
| 50 | .backgroundColor($r("app.color.white")) | 54 | .backgroundColor($r("app.color.white")) |
| 51 | - .margin({ bottom: 8 }) | 55 | + .onClick((event: ClickEvent) => { |
| 56 | + ProcessUtils.processPage(this.contentDTO) | ||
| 57 | + }) | ||
| 52 | } | 58 | } |
| 53 | } | 59 | } |
| 1 | +import { ContentDTO } from 'wdBean'; | ||
| 2 | +import { 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 = 'Card12Component'; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 人民号-动态---12:人民号无图卡; | ||
| 10 | + */ | ||
| 11 | +@Entry | ||
| 12 | +@Component | ||
| 13 | +export struct Card12Component { | ||
| 14 | + @State contentDTO: ContentDTO = { | ||
| 15 | + appStyle: '20', | ||
| 16 | + coverType: 1, | ||
| 17 | + 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', | ||
| 18 | + fullColumnImgUrls: [ | ||
| 19 | + { | ||
| 20 | + landscape: 1, | ||
| 21 | + size: 1, | ||
| 22 | + 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', | ||
| 23 | + weight: 1600 | ||
| 24 | + } | ||
| 25 | + ], | ||
| 26 | + newsTitle: '好玩!》10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人', | ||
| 27 | + rmhInfo: { | ||
| 28 | + authIcon: | ||
| 29 | + 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png', | ||
| 30 | + authTitle: '10后音乐人王烁然个人人民号', | ||
| 31 | + authTitle2: '10后音乐人王烁然个人人民号', | ||
| 32 | + banControl: 0, | ||
| 33 | + cnIsAttention: 1, | ||
| 34 | + rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人', | ||
| 35 | + 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', | ||
| 36 | + rmhName: '王烁然', | ||
| 37 | + userId: '522435359667845', | ||
| 38 | + userType: '2' | ||
| 39 | + }, | ||
| 40 | + objectType: '1', | ||
| 41 | + videoInfo: { | ||
| 42 | + firstFrameImageUri: '', | ||
| 43 | + videoDuration: 37, | ||
| 44 | + videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4' | ||
| 45 | + } | ||
| 46 | + } as ContentDTO; | ||
| 47 | + | ||
| 48 | + aboutToAppear(): void { | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + build() { | ||
| 52 | + Column() { | ||
| 53 | + // rmh信息 | ||
| 54 | + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) | ||
| 55 | + // 左标题,右图 | ||
| 56 | + Flex({ direction: FlexDirection.Row }) { | ||
| 57 | + | ||
| 58 | + Text(this.contentDTO.newsTitle) | ||
| 59 | + .fontSize($r('app.float.font_size_17')) | ||
| 60 | + .fontColor($r('app.color.color_222222')) | ||
| 61 | + .textOverflowStyle(3) | ||
| 62 | + .lineHeight(25) | ||
| 63 | + .fontFamily('PingFang SC-Regular') | ||
| 64 | + .textAlign(TextAlign.Start) | ||
| 65 | + .flexBasis('auto') | ||
| 66 | + .margin({right: 12}) | ||
| 67 | + | ||
| 68 | + Image(this.contentDTO.coverUrl) | ||
| 69 | + .flexBasis(174) | ||
| 70 | + .height(75) | ||
| 71 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 72 | + // .flexBasis(160) | ||
| 73 | + .backgroundImageSize(ImageSize.Auto) | ||
| 74 | + | ||
| 75 | + } | ||
| 76 | + .width(CommonConstants.FULL_WIDTH) | ||
| 77 | + .margin({ bottom: 8 }) | ||
| 78 | + .height(75) | ||
| 79 | + | ||
| 80 | + | ||
| 81 | + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | ||
| 82 | + } | ||
| 83 | + .padding({ | ||
| 84 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 85 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 86 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 87 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 88 | + }) | ||
| 89 | + } | ||
| 90 | +} | ||
| 91 | + | ||
| 92 | +interface radiusType { | ||
| 93 | + topLeft: number | Resource; | ||
| 94 | + topRight: number | Resource; | ||
| 95 | + bottomLeft: number | Resource; | ||
| 96 | + bottomRight: number | Resource; | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | +@Extend(Text) | ||
| 100 | +function textOverflowStyle(maxLine: number) { | ||
| 101 | + .maxLines(maxLine) | ||
| 102 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 103 | +} |
| @@ -3,12 +3,13 @@ import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; | @@ -3,12 +3,13 @@ import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; | ||
| 3 | import { CommonConstants } from 'wdConstant/Index'; | 3 | import { CommonConstants } from 'wdConstant/Index'; |
| 4 | import { DateTimeUtils } from 'wdKit'; | 4 | import { DateTimeUtils } from 'wdKit'; |
| 5 | import { WDRouterRule } from 'wdRouter'; | 5 | import { WDRouterRule } from 'wdRouter'; |
| 6 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 6 | 7 | ||
| 7 | const TAG = 'Card17Component'; | 8 | const TAG = 'Card17Component'; |
| 8 | -/** | ||
| 9 | -* 图卡集---2 | ||
| 10 | -*/ | ||
| 11 | 9 | ||
| 10 | +/** | ||
| 11 | + * 图卡集---2 | ||
| 12 | + */ | ||
| 12 | @Component | 13 | @Component |
| 13 | export struct Card17Component { | 14 | export struct Card17Component { |
| 14 | @State compDTO: CompDTO = {} as CompDTO | 15 | @State compDTO: CompDTO = {} as CompDTO |
| @@ -18,82 +19,54 @@ export struct Card17Component { | @@ -18,82 +19,54 @@ export struct Card17Component { | ||
| 18 | Column({ space: 8 }) { | 19 | Column({ space: 8 }) { |
| 19 | Text(this.contentDTO.newsTitle) | 20 | Text(this.contentDTO.newsTitle) |
| 20 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 21 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 21 | - .fontSize(17) | ||
| 22 | - .fontColor(0x222222) | 22 | + .fontSize($r('app.float.font_size_17')) |
| 23 | + .fontColor($r('app.color.color_222222')) | ||
| 23 | .lineHeight(25) | 24 | .lineHeight(25) |
| 24 | .maxLines(3) | 25 | .maxLines(3) |
| 25 | .width(CommonConstants.FULL_WIDTH) | 26 | .width(CommonConstants.FULL_WIDTH) |
| 26 | 27 | ||
| 27 | - RelativeContainer() { | ||
| 28 | - Image(this.contentDTO.fullColumnImgUrls[0].url) | ||
| 29 | - .width('66.6%') | ||
| 30 | - .aspectRatio(16 / 9) | ||
| 31 | - .alignRules({ | ||
| 32 | - top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 33 | - left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 34 | - }) | ||
| 35 | - .id('mainImage') | ||
| 36 | - | ||
| 37 | - Image(this.contentDTO.fullColumnImgUrls[1].url) | ||
| 38 | - .width('33%') | ||
| 39 | - .aspectRatio(16 / 9) | ||
| 40 | - .alignRules({ | ||
| 41 | - top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 42 | - right: { anchor: "__container__", align: HorizontalAlign.End } | ||
| 43 | - }) | ||
| 44 | - .id('subTopImage') | 28 | + Stack({ alignContent: Alignment.BottomEnd }) { |
| 29 | + // 三个图, | ||
| 30 | + GridRow({ gutter: 2 }) { | ||
| 31 | + GridCol({ span: { xs: 8 } }) { | ||
| 32 | + Image(this.contentDTO.fullColumnImgUrls[0].url) | ||
| 33 | + .width(CommonConstants.FULL_WIDTH) | ||
| 34 | + .aspectRatio(16 / 9) | ||
| 35 | + .borderRadius({ | ||
| 36 | + topLeft: $r('app.float.image_border_radius'), | ||
| 37 | + bottomLeft: $r('app.float.image_border_radius'), | ||
| 38 | + }) | ||
| 39 | + } | ||
| 45 | 40 | ||
| 46 | - Image(this.contentDTO.fullColumnImgUrls[2].url) | ||
| 47 | - .width('33%') | ||
| 48 | - .aspectRatio(16 / 9) | ||
| 49 | - .alignRules({ | ||
| 50 | - right: { anchor: "__container__", align: HorizontalAlign.End }, | ||
| 51 | - bottom: { anchor: "__container__", align: VerticalAlign.Bottom } | ||
| 52 | - }) | ||
| 53 | - .id('subBottomImage') | ||
| 54 | - // 下面是渲染右下角图标 | ||
| 55 | - Shape() { | ||
| 56 | - Rect().width(33).height(18) | 41 | + GridCol({ span: { xs: 4 } }) { |
| 42 | + Image(this.contentDTO.fullColumnImgUrls[1].url) | ||
| 43 | + .width(CommonConstants.FULL_WIDTH) | ||
| 44 | + .aspectRatio(16 / 9) | ||
| 45 | + .margin({ bottom: 1 }) | ||
| 46 | + .borderRadius({ | ||
| 47 | + topRight: $r('app.float.image_border_radius'), | ||
| 48 | + }) | ||
| 49 | + } | ||
| 57 | } | 50 | } |
| 58 | - .fill(0x000000) | ||
| 59 | - .fillOpacity(0.3) | ||
| 60 | - .strokeLineCap(LineCapStyle.Round) | ||
| 61 | - .strokeLineJoin(LineJoinStyle.Round) | ||
| 62 | - .antiAlias(true) | ||
| 63 | - .id('shape') | ||
| 64 | - .alignRules({ | ||
| 65 | - right: { anchor: "__container__", align: HorizontalAlign.End }, | ||
| 66 | - bottom: { anchor: "__container__", align: VerticalAlign.Bottom } | ||
| 67 | - }) | ||
| 68 | - .margin({ | ||
| 69 | - right: 4, | ||
| 70 | - bottom: 4 | ||
| 71 | - }) | ||
| 72 | 51 | ||
| 73 | - Image($r('app.media.album_card_shape')) | ||
| 74 | - .width(22) | ||
| 75 | - .height(18) | ||
| 76 | - .alignRules({ | ||
| 77 | - left: { anchor: "shape", align: HorizontalAlign.Start }, | ||
| 78 | - top: { anchor: "shape", align: VerticalAlign.Top } | ||
| 79 | - }) | ||
| 80 | - .id('shapeSubImage') | 52 | + GridRow({ gutter: 2 }) { |
| 53 | + GridCol({ span: { xs: 8 } }) { | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + GridCol({ span: { xs: 4 } }) { | ||
| 57 | + Image(this.contentDTO.fullColumnImgUrls[2].url) | ||
| 58 | + .width(CommonConstants.FULL_WIDTH) | ||
| 59 | + .aspectRatio(16 / 9) | ||
| 60 | + .margin({ top: 1 }) | ||
| 61 | + .borderRadius({ | ||
| 62 | + bottomRight: $r('app.float.image_border_radius'), | ||
| 63 | + }) | ||
| 64 | + } | ||
| 65 | + } | ||
| 81 | 66 | ||
| 82 | - Text(this.contentDTO.fullColumnImgUrls.length + '') | ||
| 83 | - .fontSize(13) | ||
| 84 | - .fontColor(0xFFFFFF) | ||
| 85 | - .id('pageIndex') | ||
| 86 | - .alignRules({ | ||
| 87 | - right: { anchor: "shape", align: HorizontalAlign.End }, | ||
| 88 | - top: { anchor: "shape", align: VerticalAlign.Top } | ||
| 89 | - }) | ||
| 90 | - .margin({ right: 2 }) | ||
| 91 | - .textAlign(TextAlign.Center) | ||
| 92 | - .width(17) | ||
| 93 | - .height(17) | 67 | + CardMediaInfo({ contentDTO: this.contentDTO }) |
| 94 | } | 68 | } |
| 95 | .width(CommonConstants.FULL_WIDTH) | 69 | .width(CommonConstants.FULL_WIDTH) |
| 96 | - .aspectRatio(24 / 9) | ||
| 97 | .onClick((event: ClickEvent) => { | 70 | .onClick((event: ClickEvent) => { |
| 98 | let taskAction: Action = { | 71 | let taskAction: Action = { |
| 99 | type: 'JUMP_DETAIL_PAGE', | 72 | type: 'JUMP_DETAIL_PAGE', |
| @@ -112,23 +85,17 @@ export struct Card17Component { | @@ -112,23 +85,17 @@ export struct Card17Component { | ||
| 112 | Row() { | 85 | Row() { |
| 113 | if (this.contentDTO.source) { | 86 | if (this.contentDTO.source) { |
| 114 | Text(this.contentDTO.source) | 87 | Text(this.contentDTO.source) |
| 115 | - .fontSize(13) | ||
| 116 | - .fontColor(0xB0B0B0) | 88 | + .fontSize($r('app.float.font_size_13')) |
| 89 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 117 | Image($r('app.media.point')) | 90 | Image($r('app.media.point')) |
| 118 | .width(16) | 91 | .width(16) |
| 119 | .height(16) | 92 | .height(16) |
| 120 | } | 93 | } |
| 121 | if (this.contentDTO.publishTime && this.contentDTO.publishTime.length === 13) { | 94 | if (this.contentDTO.publishTime && this.contentDTO.publishTime.length === 13) { |
| 122 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | 95 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) |
| 123 | - .fontSize(13) | ||
| 124 | - .fontColor(0xB0B0B0) | 96 | + .fontSize($r('app.float.font_size_13')) |
| 97 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 125 | } | 98 | } |
| 126 | - Text('328评') | ||
| 127 | - .fontSize(13) | ||
| 128 | - .fontColor(0xB0B0B0) | ||
| 129 | - .margin({ | ||
| 130 | - left: 6 | ||
| 131 | - }) | ||
| 132 | } | 99 | } |
| 133 | .width(CommonConstants.FULL_WIDTH) | 100 | .width(CommonConstants.FULL_WIDTH) |
| 134 | .height(16) | 101 | .height(16) |
| @@ -136,10 +103,10 @@ export struct Card17Component { | @@ -136,10 +103,10 @@ export struct Card17Component { | ||
| 136 | } | 103 | } |
| 137 | .width(CommonConstants.FULL_WIDTH) | 104 | .width(CommonConstants.FULL_WIDTH) |
| 138 | .padding({ | 105 | .padding({ |
| 139 | - top: 14, | ||
| 140 | - left: 16, | ||
| 141 | - right: 16, | ||
| 142 | - bottom: 14 | 106 | + left: $r('app.float.card_comp_pagePadding_lf'), |
| 107 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 108 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 109 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 143 | }) | 110 | }) |
| 144 | } | 111 | } |
| 145 | } | 112 | } |
| @@ -6,7 +6,6 @@ const TAG = 'Card19Component'; | @@ -6,7 +6,6 @@ const TAG = 'Card19Component'; | ||
| 6 | /** | 6 | /** |
| 7 | * 人民号-动态---19:动态图文卡人民号; 从无图--9图 | 7 | * 人民号-动态---19:动态图文卡人民号; 从无图--9图 |
| 8 | */ | 8 | */ |
| 9 | -@Entry | ||
| 10 | @Component | 9 | @Component |
| 11 | export struct Card19Component { | 10 | export struct Card19Component { |
| 12 | @State contentDTO: ContentDTO = { | 11 | @State contentDTO: ContentDTO = { |
| @@ -8,7 +8,6 @@ const TAG = 'Card20Component'; | @@ -8,7 +8,6 @@ const TAG = 'Card20Component'; | ||
| 8 | /** | 8 | /** |
| 9 | * 人民号-动态---20:动态视频卡人民号 分横屏和竖屏; | 9 | * 人民号-动态---20:动态视频卡人民号 分横屏和竖屏; |
| 10 | */ | 10 | */ |
| 11 | -@Entry | ||
| 12 | @Component | 11 | @Component |
| 13 | export struct Card20Component { | 12 | export struct Card20Component { |
| 14 | @State contentDTO: ContentDTO = { | 13 | @State contentDTO: ContentDTO = { |
| 1 | //全标题 "appStyle":"2", | 1 | //全标题 "appStyle":"2", |
| 2 | import { ContentDTO } from 'wdBean'; | 2 | import { ContentDTO } from 'wdBean'; |
| 3 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 4 | +import { DateTimeUtils } from 'wdKit/Index'; | ||
| 3 | import { ProcessUtils } from '../../utils/ProcessUtils'; | 5 | import { ProcessUtils } from '../../utils/ProcessUtils'; |
| 4 | - | 6 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 5 | 7 | ||
| 6 | const TAG: string = 'Card2Component'; | 8 | const TAG: string = 'Card2Component'; |
| 7 | 9 | ||
| @@ -12,55 +14,50 @@ const TAG: string = 'Card2Component'; | @@ -12,55 +14,50 @@ const TAG: string = 'Card2Component'; | ||
| 12 | * 卡片宽度:充满父窗口 | 14 | * 卡片宽度:充满父窗口 |
| 13 | * 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9: | 15 | * 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9: |
| 14 | */ | 16 | */ |
| 15 | -// @Entry | ||
| 16 | @Component | 17 | @Component |
| 17 | export struct Card2Component { | 18 | export struct Card2Component { |
| 18 | - @State contentDTO: ContentDTO = {} as ContentDTO; | 19 | + @State contentDTO: ContentDTO = { |
| 20 | + // appStyle: '2', | ||
| 21 | + // objectType: '1', | ||
| 22 | + // coverUrl: | ||
| 23 | + // 'https://rmrbcmsonline.peopleapp.com/upload/image/202404/202404141115457926.png?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90', | ||
| 24 | + // newsTitle: '又见花开!新疆伊犁花海延绵清新怡人', | ||
| 25 | + // publishTime: '1713067227000', | ||
| 26 | + // source: '荔枝新闻', | ||
| 27 | + // videoInfo: { | ||
| 28 | + // videoDuration: 25, | ||
| 29 | + // videoLandscape: 1, | ||
| 30 | + // videoUrl: | ||
| 31 | + // 'https://rmrbcmsonline.peopleapp.com/upload/video/mp4/202404/1713064515901314d148763996.mp4' | ||
| 32 | + // } | ||
| 33 | + } as ContentDTO; | ||
| 19 | 34 | ||
| 20 | build() { | 35 | build() { |
| 21 | Column() { | 36 | Column() { |
| 22 | - | ||
| 23 | Column() { | 37 | Column() { |
| 24 | //新闻标题 | 38 | //新闻标题 |
| 25 | Text(this.contentDTO.newsTitle) | 39 | Text(this.contentDTO.newsTitle) |
| 26 | - .fontSize(17) | ||
| 27 | - .fontColor('#222222') | 40 | + .fontSize($r('app.float.font_size_17')) |
| 41 | + .fontColor($r('app.color.color_222222')) | ||
| 28 | .maxLines(3) | 42 | .maxLines(3) |
| 29 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | 43 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 |
| 30 | .align(Alignment.Start) | 44 | .align(Alignment.Start) |
| 31 | //大图 | 45 | //大图 |
| 32 | Stack() { | 46 | Stack() { |
| 33 | Image(this.contentDTO.coverUrl) | 47 | Image(this.contentDTO.coverUrl) |
| 34 | - .borderRadius(4) | ||
| 35 | - | ||
| 36 | - | 48 | + .width(CommonConstants.FULL_WIDTH) |
| 49 | + .aspectRatio(16 / 9) | ||
| 50 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 37 | //播放状态+时长 | 51 | //播放状态+时长 |
| 38 | - Row() { | ||
| 39 | - Image($r('app.media.icon_live')) | ||
| 40 | - .width(22) | ||
| 41 | - .height(18) | ||
| 42 | - | ||
| 43 | - Stack() { | ||
| 44 | - Text('直播中') | ||
| 45 | - .fontColor('#FFFFFF') | ||
| 46 | - .fontSize(11) | ||
| 47 | - } | ||
| 48 | - .width(44) | ||
| 49 | - .height(18) | ||
| 50 | - .backgroundColor('#4d000000') | ||
| 51 | - }.margin({ right: 8, bottom: 8 }) | ||
| 52 | - | 52 | + CardMediaInfo({ |
| 53 | + contentDTO: this.contentDTO | ||
| 54 | + }) | ||
| 53 | } | 55 | } |
| 54 | - .width('100%') | ||
| 55 | - .height(192) | ||
| 56 | .alignContent(Alignment.BottomEnd) | 56 | .alignContent(Alignment.BottomEnd) |
| 57 | .margin({ top: 8 }) | 57 | .margin({ top: 8 }) |
| 58 | - | ||
| 59 | } | 58 | } |
| 60 | - .width('100%') | ||
| 61 | - .justifyContent(FlexAlign.Start) | 59 | + .width(CommonConstants.FULL_WIDTH) |
| 62 | .alignItems(HorizontalAlign.Start) | 60 | .alignItems(HorizontalAlign.Start) |
| 63 | - .padding({ top: 14 }) | ||
| 64 | 61 | ||
| 65 | //bottom | 62 | //bottom |
| 66 | Row() { | 63 | Row() { |
| @@ -71,22 +68,21 @@ export struct Card2Component { | @@ -71,22 +68,21 @@ export struct Card2Component { | ||
| 71 | .width(12) | 68 | .width(12) |
| 72 | .height(12) | 69 | .height(12) |
| 73 | 70 | ||
| 74 | - Text(this.contentDTO.source) | ||
| 75 | - .bottomTextStyle() | ||
| 76 | - Text(' ') | ||
| 77 | - | ||
| 78 | - Text(this.contentDTO.subtitle) | 71 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) |
| 79 | .bottomTextStyle() | 72 | .bottomTextStyle() |
| 80 | - | ||
| 81 | } | 73 | } |
| 82 | - .width('100%') | 74 | + .width(CommonConstants.FULL_WIDTH) |
| 83 | .height(18) | 75 | .height(18) |
| 84 | .justifyContent(FlexAlign.Start) | 76 | .justifyContent(FlexAlign.Start) |
| 85 | - // .padding({bottom:14}) | ||
| 86 | .margin({ top: 8 }) | 77 | .margin({ top: 8 }) |
| 87 | } | 78 | } |
| 88 | - .width('100%') | ||
| 89 | - .padding({ left: 16, right: 16 }) | 79 | + .width(CommonConstants.FULL_WIDTH) |
| 80 | + .padding({ | ||
| 81 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 82 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 83 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 84 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 85 | + }) | ||
| 90 | .onClick((event: ClickEvent) => { | 86 | .onClick((event: ClickEvent) => { |
| 91 | ProcessUtils.processPage(this.contentDTO) | 87 | ProcessUtils.processPage(this.contentDTO) |
| 92 | }) | 88 | }) |
| @@ -5,10 +5,21 @@ import { ProcessUtils } from '../../utils/ProcessUtils'; | @@ -5,10 +5,21 @@ import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 7 | * 卡片样式:"appStyle":"3" | 7 | * 卡片样式:"appStyle":"3" |
| 8 | + * Card_03 = '3', // 无图卡(全标题) | ||
| 8 | */ | 9 | */ |
| 9 | @Component | 10 | @Component |
| 10 | export struct Card3Component { | 11 | export struct Card3Component { |
| 11 | - @State contentDTO: ContentDTO = {} as ContentDTO; | 12 | + @State contentDTO: ContentDTO = { |
| 13 | + // appStyle: '3', | ||
| 14 | + // channelId: '2002', | ||
| 15 | + // newsTitle: '习近平向斯洛伐克当选总统佩', | ||
| 16 | + // objectId: '30044351686', | ||
| 17 | + // objectType: '8', | ||
| 18 | + // publishTime: '1712967589000', | ||
| 19 | + // relId: '500005307414', | ||
| 20 | + // relType: '1', | ||
| 21 | + // source: '新华社', | ||
| 22 | + } as ContentDTO; | ||
| 12 | 23 | ||
| 13 | build() { | 24 | build() { |
| 14 | Column() { | 25 | Column() { |
| @@ -17,35 +28,37 @@ export struct Card3Component { | @@ -17,35 +28,37 @@ export struct Card3Component { | ||
| 17 | .fontColor($r("app.color.color_222222")) | 28 | .fontColor($r("app.color.color_222222")) |
| 18 | .width(CommonConstants.FULL_WIDTH) | 29 | .width(CommonConstants.FULL_WIDTH) |
| 19 | Row() { | 30 | Row() { |
| 20 | - Text("锐评") | ||
| 21 | - .fontSize($r("app.float.font_size_12")) | ||
| 22 | - .fontColor($r("app.color.color_ED2800")) | ||
| 23 | - Text(this.contentDTO.source) | 31 | + // TODO "锐评"取得哪个字段,什么时候显示。 |
| 32 | + // Text("锐评") | ||
| 33 | + // .fontSize($r("app.float.font_size_12")) | ||
| 34 | + // .fontColor($r("app.color.color_ED2800")) | ||
| 35 | + if(this.contentDTO.source) { | ||
| 36 | + Text(this.contentDTO.source) | ||
| 37 | + .fontSize($r("app.float.font_size_12")) | ||
| 38 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 39 | + Image($r("app.media.point")) | ||
| 40 | + .width(16) | ||
| 41 | + .height(16) | ||
| 42 | + } | ||
| 43 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | ||
| 24 | .fontSize($r("app.float.font_size_12")) | 44 | .fontSize($r("app.float.font_size_12")) |
| 25 | .fontColor($r("app.color.color_B0B0B0")) | 45 | .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))) | 46 | + .margin({ right: 6 }) |
| 47 | + // TODO '评论取哪个字段' | ||
| 48 | + Text(`${this.contentDTO?.interactData?.commentNum}评`) | ||
| 32 | .fontSize($r("app.float.font_size_12")) | 49 | .fontSize($r("app.float.font_size_12")) |
| 33 | .fontColor($r("app.color.color_B0B0B0")) | 50 | .fontColor($r("app.color.color_B0B0B0")) |
| 34 | - | ||
| 35 | }.width(CommonConstants.FULL_WIDTH) | 51 | }.width(CommonConstants.FULL_WIDTH) |
| 36 | .justifyContent(FlexAlign.Start) | 52 | .justifyContent(FlexAlign.Start) |
| 37 | .margin({ top: 8 }) | 53 | .margin({ top: 8 }) |
| 38 | - | ||
| 39 | } | 54 | } |
| 40 | - .width("100%") | 55 | + .width(CommonConstants.FULL_WIDTH) |
| 41 | .padding({ | 56 | .padding({ |
| 42 | - top: 14, | ||
| 43 | - left: 16, | ||
| 44 | - right: 16, | ||
| 45 | - bottom: 14 | 57 | + left: $r('app.float.card_comp_pagePadding_lf'), |
| 58 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 59 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 60 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 46 | }) | 61 | }) |
| 47 | - .backgroundColor($r("app.color.white")) | ||
| 48 | - .margin({ bottom: 8 }) | ||
| 49 | .onClick((event: ClickEvent) => { | 62 | .onClick((event: ClickEvent) => { |
| 50 | ProcessUtils.processPage(this.contentDTO) | 63 | ProcessUtils.processPage(this.contentDTO) |
| 51 | }) | 64 | }) |
| 1 | -//全标题 "appStyle":"4", | ||
| 2 | -import { ContentDTO } from 'wdBean'; | 1 | +import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean'; |
| 2 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 3 | import { ProcessUtils } from '../../utils/ProcessUtils'; | 3 | import { ProcessUtils } from '../../utils/ProcessUtils'; |
| 4 | +import { DateTimeUtils } from 'wdKit/Index'; | ||
| 4 | 5 | ||
| 5 | const TAG: string = 'Card4Component'; | 6 | const TAG: string = 'Card4Component'; |
| 6 | 7 | ||
| @@ -13,50 +14,100 @@ const TAG: string = 'Card4Component'; | @@ -13,50 +14,100 @@ const TAG: string = 'Card4Component'; | ||
| 13 | */ | 14 | */ |
| 14 | @Component | 15 | @Component |
| 15 | export struct Card4Component { | 16 | export struct Card4Component { |
| 16 | - @State contentDTO: ContentDTO = {} as ContentDTO; | 17 | + @State contentDTO: ContentDTO = { |
| 18 | + // appStyle: '4', | ||
| 19 | + // fullColumnImgUrls: [ | ||
| 20 | + // { | ||
| 21 | + // format: null, | ||
| 22 | + // fullUrl: '', | ||
| 23 | + // height: 187, | ||
| 24 | + // landscape: 1, | ||
| 25 | + // size: 1, | ||
| 26 | + // url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118198_0c20f7c31c7b4eca6b0d0871e7771c62.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90', | ||
| 27 | + // weight: 248 | ||
| 28 | + // }, | ||
| 29 | + // { | ||
| 30 | + // format: null, | ||
| 31 | + // fullUrl: '', | ||
| 32 | + // height: 187, | ||
| 33 | + // landscape: 1, | ||
| 34 | + // size: 1, | ||
| 35 | + // url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118198_0c20f7c31c7b4eca6b0d0871e7771c62.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90', | ||
| 36 | + // weight: 248 | ||
| 37 | + // }, | ||
| 38 | + // { | ||
| 39 | + // format: null, | ||
| 40 | + // fullUrl: '', | ||
| 41 | + // height: 187, | ||
| 42 | + // landscape: 1, | ||
| 43 | + // size: 1, | ||
| 44 | + // url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118200_d10309bee894a67311e6c8f77df676d4.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90', | ||
| 45 | + // weight: 248 | ||
| 46 | + // }, | ||
| 47 | + // { | ||
| 48 | + // format: null, | ||
| 49 | + // fullUrl: '', | ||
| 50 | + // height: 187, | ||
| 51 | + // landscape: 1, | ||
| 52 | + // size: 1, | ||
| 53 | + // url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118202_f33743e452fb69ee2c45c18a56eccdf6.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90', | ||
| 54 | + // weight: 248 | ||
| 55 | + // } | ||
| 56 | + // ], | ||
| 57 | + // newsTitle: '科普:如何发现家中是否有白蚁危害?丨又到白蚁分飞季②', | ||
| 58 | + // rmhInfo: { | ||
| 59 | + // authIcon: | ||
| 60 | + // 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/blue.png', | ||
| 61 | + // authTitle: '封面新闻', | ||
| 62 | + // rmhDesc: '封面新闻,亿万年轻人的生活方式。', | ||
| 63 | + // rmhHeadUrl: | ||
| 64 | + // 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221212/122faff796.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg', | ||
| 65 | + // rmhId: '2016608', | ||
| 66 | + // rmhName: '封面新闻', | ||
| 67 | + // userId: '522390888224390', | ||
| 68 | + // userType: '2' | ||
| 69 | + // }, | ||
| 70 | + // source: '头条号', | ||
| 71 | + // publishTime: '1651204607000', | ||
| 72 | + } as ContentDTO; | ||
| 17 | 73 | ||
| 18 | build() { | 74 | build() { |
| 19 | Column() { | 75 | Column() { |
| 20 | - | ||
| 21 | - | ||
| 22 | //body | 76 | //body |
| 23 | Column() { | 77 | Column() { |
| 24 | //新闻标题 | 78 | //新闻标题 |
| 25 | Text(this.contentDTO.newsTitle) | 79 | Text(this.contentDTO.newsTitle) |
| 26 | - .fontSize(17) | ||
| 27 | - .fontColor('#222222') | 80 | + .fontSize($r('app.float.font_size_17')) |
| 81 | + .fontColor($r('app.color.color_222222')) | ||
| 28 | .maxLines(3) | 82 | .maxLines(3) |
| 29 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | 83 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 |
| 30 | //三图 | 84 | //三图 |
| 31 | Row() { | 85 | Row() { |
| 32 | - Image(this.contentDTO.fullColumnImgUrls[0]?.url) | ||
| 33 | - .width('32%') | ||
| 34 | - | ||
| 35 | - .height(75) | ||
| 36 | - .borderRadius({ topLeft:4,bottomLeft:4 }) | ||
| 37 | - | ||
| 38 | - Image(this.contentDTO.fullColumnImgUrls[1]?.url) | ||
| 39 | - .width('32%') | ||
| 40 | - .height(75) | ||
| 41 | - | ||
| 42 | - Image(this.contentDTO.fullColumnImgUrls[2]?.url) | ||
| 43 | - .width('32%') | ||
| 44 | - .height(75) | ||
| 45 | - .borderRadius({ topRight:4,bottomRight:4 }) | ||
| 46 | - | 86 | + GridRow({ gutter: 2 }) { |
| 87 | + ForEach(this.contentDTO.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => { | ||
| 88 | + if (index < 3) { | ||
| 89 | + GridCol({ span: { xs: 4 } }) { | ||
| 90 | + Image(item.url) | ||
| 91 | + .width('100%') | ||
| 92 | + .aspectRatio(113 / 75) | ||
| 93 | + .borderRadius({ | ||
| 94 | + topLeft: index === 0 ? $r('app.float.image_border_radius') : 0, | ||
| 95 | + topRight: index === 2 ? $r('app.float.image_border_radius') : 0, | ||
| 96 | + bottomLeft: index === 0 ? $r('app.float.image_border_radius') : 0, | ||
| 97 | + bottomRight: index === 2 ? $r('app.float.image_border_radius') : 0, | ||
| 98 | + }) | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | + }) | ||
| 102 | + } | ||
| 47 | } | 103 | } |
| 48 | - .justifyContent(FlexAlign.SpaceBetween) | ||
| 49 | .width('100%') | 104 | .width('100%') |
| 50 | - .height(75) | ||
| 51 | - .margin({top:8}) | ||
| 52 | - .borderRadius(8) | ||
| 53 | - | 105 | + .margin({ top: 8 }) |
| 54 | } | 106 | } |
| 55 | .width('100%') | 107 | .width('100%') |
| 56 | .justifyContent(FlexAlign.Start) | 108 | .justifyContent(FlexAlign.Start) |
| 57 | .alignItems(HorizontalAlign.Start) | 109 | .alignItems(HorizontalAlign.Start) |
| 58 | - .padding({top:14}) | ||
| 59 | - .onClick((event: ClickEvent)=>{ | 110 | + .onClick((event: ClickEvent) => { |
| 60 | ProcessUtils.processPage(this.contentDTO) | 111 | ProcessUtils.processPage(this.contentDTO) |
| 61 | }) | 112 | }) |
| 62 | 113 | ||
| @@ -69,31 +120,29 @@ export struct Card4Component { | @@ -69,31 +120,29 @@ export struct Card4Component { | ||
| 69 | Image($r('app.media.point')) | 120 | Image($r('app.media.point')) |
| 70 | .width(12) | 121 | .width(12) |
| 71 | .height(12) | 122 | .height(12) |
| 72 | - | ||
| 73 | - Text(this.contentDTO.publishTime) | ||
| 74 | - .bottomTextStyle() | ||
| 75 | - Text(' ') | ||
| 76 | - | ||
| 77 | - Text('518条评论') | 123 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) |
| 78 | .bottomTextStyle() | 124 | .bottomTextStyle() |
| 79 | - | 125 | + // TODO 评论字段取值 |
| 126 | + // Text('518条评论') | ||
| 127 | + // .bottomTextStyle() | ||
| 80 | } | 128 | } |
| 81 | .width('100%') | 129 | .width('100%') |
| 82 | - | ||
| 83 | .justifyContent(FlexAlign.Start) | 130 | .justifyContent(FlexAlign.Start) |
| 84 | - // .padding({bottom:14}) | ||
| 85 | - .margin({top:8}) | ||
| 86 | - .padding({bottom:14}) | ||
| 87 | - | 131 | + .margin({ top: 8 }) |
| 88 | } | 132 | } |
| 89 | - .width('100%') | ||
| 90 | - .padding({top:8,left:16,right:16}) | ||
| 91 | - | 133 | + .width(CommonConstants.FULL_WIDTH) |
| 134 | + .padding({ | ||
| 135 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 136 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 137 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 138 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 139 | + }) | ||
| 92 | } | 140 | } |
| 93 | } | 141 | } |
| 94 | 142 | ||
| 95 | 143 | ||
| 96 | -@Extend(Text) function bottomTextStyle() { | 144 | +@Extend(Text) |
| 145 | +function bottomTextStyle() { | ||
| 97 | .fontSize(12) | 146 | .fontSize(12) |
| 98 | .fontColor('#B0B0B0') | 147 | .fontColor('#B0B0B0') |
| 99 | } | 148 | } |
| @@ -5,11 +5,21 @@ import { ProcessUtils } from '../../utils/ProcessUtils'; | @@ -5,11 +5,21 @@ import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 5 | const TAG: string = 'Card5Component'; | 5 | const TAG: string = 'Card5Component'; |
| 6 | 6 | ||
| 7 | /** | 7 | /** |
| 8 | - * 卡片样式:"appStyle":"5" | 8 | + * 卡片样式:"appStyle":"5" 头图卡 |
| 9 | */ | 9 | */ |
| 10 | +// @Entry | ||
| 10 | @Component | 11 | @Component |
| 11 | export struct Card5Component { | 12 | export struct Card5Component { |
| 12 | - @State contentDTO: ContentDTO = {} as ContentDTO; | 13 | + @State contentDTO: ContentDTO = { |
| 14 | + // coverSize: '850*478', | ||
| 15 | + // coverType: 1, | ||
| 16 | + // coverUrl: | ||
| 17 | + // 'https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20240323/image/display/54ce2de0d20842839e96a644c78361b7.jpg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg', | ||
| 18 | + // linkUrl: | ||
| 19 | + // 'https://pd-people-uat.pdnews.cn/h/atv/collect/1000000472?hiddenNavigator=1', | ||
| 20 | + // newsTitle: '今天是周日,天气阴天,明天是周一。', | ||
| 21 | + // objectType: '6' | ||
| 22 | + } as ContentDTO; | ||
| 13 | 23 | ||
| 14 | build() { | 24 | build() { |
| 15 | Stack() { | 25 | Stack() { |
| @@ -43,8 +53,12 @@ export struct Card5Component { | @@ -43,8 +53,12 @@ export struct Card5Component { | ||
| 43 | } | 53 | } |
| 44 | .alignContent(Alignment.Bottom) | 54 | .alignContent(Alignment.Bottom) |
| 45 | .width(CommonConstants.FULL_WIDTH) | 55 | .width(CommonConstants.FULL_WIDTH) |
| 46 | - .padding( | ||
| 47 | - { top: 16, bottom: 16, left: 14, right: 14 }) | 56 | + .padding({ |
| 57 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 58 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 59 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 60 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 61 | + }) | ||
| 48 | .onClick((event: ClickEvent) => { | 62 | .onClick((event: ClickEvent) => { |
| 49 | ProcessUtils.processPage(this.contentDTO) | 63 | ProcessUtils.processPage(this.contentDTO) |
| 50 | }) | 64 | }) |
| @@ -3,11 +3,11 @@ import { CommonConstants, CompStyle } from 'wdConstant'; | @@ -3,11 +3,11 @@ import { CommonConstants, CompStyle } from 'wdConstant'; | ||
| 3 | import { DateTimeUtils } from 'wdKit'; | 3 | import { DateTimeUtils } from 'wdKit'; |
| 4 | import { ProcessUtils } from '../../utils/ProcessUtils'; | 4 | import { ProcessUtils } from '../../utils/ProcessUtils'; |
| 5 | 5 | ||
| 6 | -const TAG: string = 'Card6Component'; | 6 | +const TAG: string = 'Card6Component-Card13Component'; |
| 7 | const FULL_PARENT: string = '100%'; | 7 | const FULL_PARENT: string = '100%'; |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| 10 | - * 卡片样式:"appStyle":"6" | 10 | + * 卡片样式:"appStyle":"6"以及13 |
| 11 | */ | 11 | */ |
| 12 | @Component | 12 | @Component |
| 13 | export struct Card6Component { | 13 | export struct Card6Component { |
sight_harmony/features/wdComponent/src/main/ets/components/comment/model/CommentModel.ets
0 → 100644
| 1 | +import PageModel from '../../../viewmodel/PageModel' | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +/// 所有用户类型定义 | ||
| 5 | +/// 1--普通账户正常;--不能直播、点播 | ||
| 6 | +/// 2--视频号,可以直播、点播;显示查看修改都是自己的信息; | ||
| 7 | +/// 3--矩阵号,是有视频号升级来的;可以登陆app,我的里面是自己的信息;发评论、发视频、直播都是自己;矩阵号下面可以挂视频号、运营子账号; | ||
| 8 | +/// 4--运营子账号,登陆使用的是自己的userId手机,密码;显示是对应视频号的信息,我的里面是视频号的信息,无法更改基本信息,自己没有头像,昵称信息;发点播、发直播、发评论,都是对应视频号的身份发送的;还是需要记录子账号的userId;(评论表 userId,userType,creatorId) | ||
| 9 | +export enum WDPublicUserType { | ||
| 10 | + /// 未知类型 | ||
| 11 | + WDPublicUserType_Unkown = 0, | ||
| 12 | + | ||
| 13 | + /// 普通用户 | ||
| 14 | + WDPublicUserType_NormalUser = 1, | ||
| 15 | + | ||
| 16 | + /// 号主 | ||
| 17 | + WDPublicUserType_AccountOwner = 2, | ||
| 18 | + | ||
| 19 | + /// 矩阵号 | ||
| 20 | + WDPublicUserType_Matrix = 3, | ||
| 21 | + | ||
| 22 | + /// 运营子账号 | ||
| 23 | + WDPublicUserType_OperatingSubAccount = 4, | ||
| 24 | + | ||
| 25 | + /// 内容源账号 | ||
| 26 | + WDPublicUserType_ContentSourceAccount = 5, | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +@Observed | ||
| 30 | +export class commentListModel extends PageModel{ | ||
| 31 | + pageNum: number = 0 | ||
| 32 | + pageSize: number = 0 | ||
| 33 | + totalCount: number = 0 | ||
| 34 | + hasNext: number = 0 | ||
| 35 | + list: commentItemModel[] = [] | ||
| 36 | + | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +export class commentItemModel { | ||
| 40 | + authorLike: string = '' | ||
| 41 | + avatarFrame: string = '' | ||
| 42 | + checkStatus: string = '' | ||
| 43 | + childCommentNum: string = '' | ||
| 44 | + childComments: commentItemModel[] = [] | ||
| 45 | + commentContent: string = '' | ||
| 46 | + commentContentSensitive: string = '' | ||
| 47 | + commentLevel: number = 0 | ||
| 48 | + commentPics: string = '' | ||
| 49 | + commentSensitive: string = '' | ||
| 50 | + commentType: number = 0 | ||
| 51 | + contentAuthor: number = 0 | ||
| 52 | + createTime: string = '' | ||
| 53 | + creatorFlag: string = '' | ||
| 54 | + fromCreatorId: string = '' | ||
| 55 | + fromDeviceId: string = '' | ||
| 56 | + fromUserHeader: string = '' | ||
| 57 | + fromUserId: string = '' | ||
| 58 | + fromUserName: string = '' | ||
| 59 | + fromUserType: WDPublicUserType = 0 | ||
| 60 | + id: string = '' | ||
| 61 | + likeNum: string = '' | ||
| 62 | + /*是否点赞*/ | ||
| 63 | + isLike: boolean = false | ||
| 64 | + mySelf: string = '' | ||
| 65 | + parentId: string = '' | ||
| 66 | + region: string = '' | ||
| 67 | + replyNum: string = '' | ||
| 68 | + rootCommentId: string = '' | ||
| 69 | + sensitiveExist: string = '' | ||
| 70 | + sensitiveShow: string = '' | ||
| 71 | + toUserContentAuthor: string = '' | ||
| 72 | + toUserId: string = '' | ||
| 73 | + toUserName: string = '' | ||
| 74 | + toUserType: string = '' | ||
| 75 | + topFlag: string = '' | ||
| 76 | + uuid: string = '' | ||
| 77 | + /*本地使用,收起时默认3行 -1为不限制行数*/ | ||
| 78 | + maxLine: number = 3 | ||
| 79 | + | ||
| 80 | + /*是否有展示更多*/ | ||
| 81 | + hasMore:boolean = false | ||
| 82 | + /*当有展示更多的时候,当前的状态是展开还是收起*/ | ||
| 83 | + expanded:boolean = false | ||
| 84 | + | ||
| 85 | + highQualityExpireTime:string = ''; | ||
| 86 | + highQualityTime:string = ''; | ||
| 87 | + targetTitle:string = ''; | ||
| 88 | + targetStatus:string = ''; | ||
| 89 | + targetId:string = ''; | ||
| 90 | + targetRelId:string = ''; | ||
| 91 | + targetRelObjectId:string = ''; | ||
| 92 | + targetRelType:string = ''; | ||
| 93 | + targetType:string = ''; | ||
| 94 | + visitorComment:string = ''; | ||
| 95 | + shareInfo:commentItemShareInfoModel[] = [] | ||
| 96 | + // targetId:string = ''; | ||
| 97 | + // targetId:string = ''; | ||
| 98 | + // targetId:string = ''; | ||
| 99 | + | ||
| 100 | +} | ||
| 101 | + | ||
| 102 | +export class commentItemShareInfoModel { | ||
| 103 | + shareCoverUrl: string = '' | ||
| 104 | + shareSummary: string = '' | ||
| 105 | + shareTitle: string = '' | ||
| 106 | + shareUrl: string = '' | ||
| 107 | +} |
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/BottomCommentComponent.ets
0 → 100644
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentComponent.ets
0 → 100644
| 1 | +import ArrayList from '@ohos.util.ArrayList' | ||
| 2 | +import { ViewType } from 'wdConstant/Index'; | ||
| 3 | +import { LazyDataSource } from 'wdKit/Index'; | ||
| 4 | +import PageModel from '../../../viewmodel/PageModel'; | ||
| 5 | +import { commentItemModel, commentListModel, WDPublicUserType } from '../model/CommentModel'; | ||
| 6 | +import commentViewModel from '../viewmodel/CommentViewModel' | ||
| 7 | +import { CommentText } from './CommentText'; | ||
| 8 | +import measure from '@ohos.measure' | ||
| 9 | + | ||
| 10 | +@Entry | ||
| 11 | +@Preview | ||
| 12 | +@Component | ||
| 13 | +export struct CommentComponent { | ||
| 14 | + @State private browSingModel: commentListModel = new commentListModel() | ||
| 15 | + isloading: boolean = false | ||
| 16 | + // @State allDatas :commentItemModel[] = []; | ||
| 17 | + | ||
| 18 | + @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); | ||
| 19 | + | ||
| 20 | + aboutToAppear() { | ||
| 21 | + this.getData(); | ||
| 22 | + this.getData(); | ||
| 23 | + this.getData(); | ||
| 24 | + this.getData(); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + /*标题:全部评论*/ | ||
| 28 | + @Builder | ||
| 29 | + titleHeader() { | ||
| 30 | + Row() { | ||
| 31 | + Row() { | ||
| 32 | + Image($r('app.media.redLine')) | ||
| 33 | + .height(16) | ||
| 34 | + .width(3) | ||
| 35 | + Text('全部评论') | ||
| 36 | + .fontSize(18)// .fontColor('#222222') | ||
| 37 | + .fontColor($r('app.color.color_222222')) | ||
| 38 | + .fontWeight(FontWeight.Medium) | ||
| 39 | + .margin({ left: 5 }) | ||
| 40 | + | ||
| 41 | + } | ||
| 42 | + .margin({ left: 16 }) | ||
| 43 | + | ||
| 44 | + }.height(44) | ||
| 45 | + .width('100%') | ||
| 46 | + .justifyContent(FlexAlign.SpaceBetween); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + /*1级评论作为titleHeader*/ | ||
| 50 | + @Builder | ||
| 51 | + CommentHeaderItem(item: commentItemModel) { | ||
| 52 | + Column() { | ||
| 53 | + Row() { | ||
| 54 | + //头像 | ||
| 55 | + Stack() { | ||
| 56 | + Image(item.fromUserHeader) | ||
| 57 | + .alt($r('app.media.default_head')) | ||
| 58 | + .width('32') | ||
| 59 | + .height('32') | ||
| 60 | + .objectFit(ImageFit.Cover) | ||
| 61 | + .borderRadius(16) | ||
| 62 | + Image($r('app.media.icon_border_test')) | ||
| 63 | + .width('48') | ||
| 64 | + .height('48') | ||
| 65 | + .objectFit(ImageFit.Cover) | ||
| 66 | + .borderRadius(24) | ||
| 67 | + } | ||
| 68 | + .width(48) | ||
| 69 | + .height(48) | ||
| 70 | + .margin({ left: 8 }) | ||
| 71 | + .alignContent(Alignment.Center) | ||
| 72 | + .onClick(() => { | ||
| 73 | + // TODO 跳转个人详情 | ||
| 74 | + }) | ||
| 75 | + | ||
| 76 | + //昵称 | ||
| 77 | + Text(item.fromUserName) | ||
| 78 | + .fontSize(14) | ||
| 79 | + .fontColor($r('app.color.color_222222')) | ||
| 80 | + .fontWeight(FontWeight.Medium) | ||
| 81 | + .margin({ left: 5 }) | ||
| 82 | + | ||
| 83 | + | ||
| 84 | + /// 暂时不显示 “我” 的标签了 | ||
| 85 | + /// 人民号>置顶>作者 | ||
| 86 | + | ||
| 87 | + //人民号 | ||
| 88 | + // if (item.fromUserType === WDPublicUserType.WDPublicUserType_Matrix) { | ||
| 89 | + Image($r('app.media.comment_rmh_tag')).width(20).height(20).margin({ left: 5 }); | ||
| 90 | + // } | ||
| 91 | + //置顶 | ||
| 92 | + // if (item.topFlag) { | ||
| 93 | + Image($r('app.media.comment_icon_zhiding')).width(30).height(18).margin({ left: 5 }); | ||
| 94 | + // } | ||
| 95 | + //作者 | ||
| 96 | + // if (item.contentAuthor === 1) { | ||
| 97 | + Text('作者') | ||
| 98 | + .fontSize(11) | ||
| 99 | + .fontColor('#968562') | ||
| 100 | + .backgroundColor('#F1EFEB') | ||
| 101 | + .textAlign(TextAlign.Center) | ||
| 102 | + .borderRadius(2) | ||
| 103 | + .width(30) | ||
| 104 | + .height(18) | ||
| 105 | + .margin({ left: 5 }); | ||
| 106 | + // } | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + CommentText({ | ||
| 110 | + longMessage: item.commentContent, | ||
| 111 | + maxline: 3, | ||
| 112 | + fontSize: 16, | ||
| 113 | + fontWeight: FontWeight.Regular, | ||
| 114 | + marginWidth: (59 + 16) | ||
| 115 | + }) | ||
| 116 | + .margin({ left: 59, right: 16 }) | ||
| 117 | + | ||
| 118 | + | ||
| 119 | + this.CommentFooterView(item); | ||
| 120 | + }.alignItems(HorizontalAlign.Start) | ||
| 121 | + | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + /*查看更多和收起*/ | ||
| 125 | + @Builder | ||
| 126 | + GroupFooterView(item: commentItemModel) { | ||
| 127 | + Row() { | ||
| 128 | + if (item.expanded){ | ||
| 129 | + Row() { | ||
| 130 | + Text('收起').fontColor($r('app.color.color_222222')).fontSize(14) | ||
| 131 | + Image($r('app.media.comment_pickUp')).width(12).height(12) | ||
| 132 | + }.margin({ left: 213 }) | ||
| 133 | + }else { | ||
| 134 | + Row() { | ||
| 135 | + Text().backgroundColor($r('app.color.color_EDEDED')).width(24).height(1) | ||
| 136 | + Text('查看更多回复').fontColor($r('app.color.color_222222')).fontSize(14).margin({ left: 6 }) | ||
| 137 | + Image($r('app.media.comment_unfold')).width(12).height(12) | ||
| 138 | + }.margin({ left: 53 }) | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + | ||
| 142 | + | ||
| 143 | + | ||
| 144 | + }.height(30) | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + /*评论内容下面的IP地址时间点赞*/ | ||
| 148 | + @Builder | ||
| 149 | + CommentFooterView(item: commentItemModel) { | ||
| 150 | + Row() { | ||
| 151 | + | ||
| 152 | + Row({ space: 6 }) { | ||
| 153 | + Text(item.region ? (item.region + '网友') : '人民日报客户端网友') | ||
| 154 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 155 | + .fontSize(12); | ||
| 156 | + Image($r('app.media.comment_hyphen')) | ||
| 157 | + .size({ | ||
| 158 | + width: 4, | ||
| 159 | + height: 4 | ||
| 160 | + }) | ||
| 161 | + | ||
| 162 | + //TODO: 时间格式需要本地调整 | ||
| 163 | + // / 展现专用,用于获取多久之前 | ||
| 164 | + // ///小于1分钟:刚刚 | ||
| 165 | + // ///1~60分钟:x分钟前 | ||
| 166 | + // ///1小时~1天:x小时前 | ||
| 167 | + // ///1天~2天:1天前 | ||
| 168 | + // ///2天~:日期隐藏 | ||
| 169 | + Text(item.createTime) | ||
| 170 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 171 | + .fontSize(12) | ||
| 172 | + | ||
| 173 | + Image($r('app.media.comment_hyphen_block')) | ||
| 174 | + .size({ | ||
| 175 | + width: 4, | ||
| 176 | + height: 4 | ||
| 177 | + }) | ||
| 178 | + | ||
| 179 | + Text('回复') | ||
| 180 | + .fontColor($r('app.color.color_222222')) | ||
| 181 | + .fontSize(12) | ||
| 182 | + .onClick(() => { | ||
| 183 | + //TODO: 回复 | ||
| 184 | + }) | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + Row({ space: 6 }) { | ||
| 188 | + Text(item.likeNum) | ||
| 189 | + .fontColor($r('app.color.color_666666')) | ||
| 190 | + .fontSize(14) | ||
| 191 | + | ||
| 192 | + Image($r('app.media.comment_like_normal')) | ||
| 193 | + .size({ | ||
| 194 | + width: 16, | ||
| 195 | + height: 16 | ||
| 196 | + }) | ||
| 197 | + .onClick(() => { | ||
| 198 | + //TODO: 点赞 | ||
| 199 | + }) | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + } | ||
| 203 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 204 | + .height(30) | ||
| 205 | + .margin({ left: 59, right: 16 }) | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + build() { | ||
| 209 | + Column() { | ||
| 210 | + | ||
| 211 | + List() { | ||
| 212 | + ListItemGroup({ header: this.titleHeader() }) | ||
| 213 | + LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { | ||
| 214 | + if (item.hasMore) { | ||
| 215 | + ListItemGroup({ header: this.CommentHeaderItem(item), footer: this.GroupFooterView(item) }) { | ||
| 216 | + ForEach(item.childComments, (childItem: commentItemModel, subIndex: number) => { | ||
| 217 | + ListItem() { | ||
| 218 | + ChildCommentItem(); | ||
| 219 | + } | ||
| 220 | + }) | ||
| 221 | + } | ||
| 222 | + }else { | ||
| 223 | + ListItemGroup({ header: this.CommentHeaderItem(item)}) { | ||
| 224 | + ForEach(item.childComments, (childItem: commentItemModel, subIndex: number) => { | ||
| 225 | + ListItem() { | ||
| 226 | + ChildCommentItem(); | ||
| 227 | + } | ||
| 228 | + }) | ||
| 229 | + } | ||
| 230 | + } | ||
| 231 | + }) | ||
| 232 | + }.layoutWeight(1) | ||
| 233 | + } | ||
| 234 | + } | ||
| 235 | + | ||
| 236 | + //获取数据 | ||
| 237 | + async getData() { | ||
| 238 | + this.browSingModel.currentPage = 1 | ||
| 239 | + commentViewModel.getCommentLocal(getContext()).then(commentListModel => { | ||
| 240 | + if (commentListModel && commentListModel.list && commentListModel.list.length > 0) { | ||
| 241 | + commentListModel.hasMore = true; | ||
| 242 | + this.browSingModel.viewType = ViewType.LOADED; | ||
| 243 | + this.allDatas.push(...commentListModel.list) | ||
| 244 | + if (commentListModel.list.length === this.browSingModel.pageSize) { | ||
| 245 | + this.browSingModel.currentPage++; | ||
| 246 | + this.browSingModel.hasMore = true; | ||
| 247 | + } else { | ||
| 248 | + this.browSingModel.hasMore = false; | ||
| 249 | + } | ||
| 250 | + } else { | ||
| 251 | + this.browSingModel.viewType = ViewType.EMPTY; | ||
| 252 | + } | ||
| 253 | + | ||
| 254 | + | ||
| 255 | + | ||
| 256 | + }) | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + /*回复评论*/ | ||
| 260 | + ReplyComment() { | ||
| 261 | + | ||
| 262 | + } | ||
| 263 | +} | ||
| 264 | + | ||
| 265 | + | ||
| 266 | +@Component | ||
| 267 | +struct ChildCommentItem { | ||
| 268 | + build() { | ||
| 269 | + Text('child') | ||
| 270 | + } | ||
| 271 | +} | ||
| 272 | + |
| 1 | +import measure from '@ohos.measure' | ||
| 2 | +import curves from '@ohos.curves'; | ||
| 3 | +import { BusinessError } from '@ohos.base'; | ||
| 4 | +import display from '@ohos.display'; | ||
| 5 | + | ||
| 6 | +const collapseString = '...展开全文' | ||
| 7 | +const uncollapseString = '...收起' | ||
| 8 | + | ||
| 9 | +@Component | ||
| 10 | +@Preview | ||
| 11 | +export struct CommentText { | ||
| 12 | + // 长文本 | ||
| 13 | + @State longMessage: string = '' | ||
| 14 | + // 最大显示行数 | ||
| 15 | + @State maxLineMesssage: string = ''; | ||
| 16 | + | ||
| 17 | + @State lines: number = 3; | ||
| 18 | + @State maxline: number = 3; | ||
| 19 | + @State marginWidth:number = 0; | ||
| 20 | + // 长文本状态(展开 or 收起) | ||
| 21 | + @State collapseText: string = collapseString | ||
| 22 | + // 屏幕宽度(单位px) | ||
| 23 | + screenWidth: number = 0; | ||
| 24 | + // 是否需要显示"展开"字样(注:当文本长度较短时就不需要“展开”) | ||
| 25 | + @State isExpanded: boolean = false | ||
| 26 | + /*当前展开状态*/ | ||
| 27 | + @State expandedStates: boolean = false; | ||
| 28 | + @State fontSize: number = 18; | ||
| 29 | + @State fontWeight: FontWeight = FontWeight.Regular | ||
| 30 | + fontColor: ResourceColor = $r('app.color.color_222222') | ||
| 31 | + // 测量文本宽度(单位px) | ||
| 32 | + @State textWidth: number = 0; | ||
| 33 | + | ||
| 34 | + // constructor(longMessage?:string,) { | ||
| 35 | + // super(); | ||
| 36 | + // this.longMessage = longMessage; | ||
| 37 | + // } | ||
| 38 | + // 获取当前所有的display对象 | ||
| 39 | + promise: Promise<Array<display.Display>> = display.getAllDisplays() | ||
| 40 | + | ||
| 41 | + | ||
| 42 | + | ||
| 43 | + aboutToAppear() { | ||
| 44 | + console.log(`文本宽度为:${this.textWidth}`) | ||
| 45 | + let padding = vp2px(5 + this.marginWidth) | ||
| 46 | + | ||
| 47 | + this.textWidth = measure.measureText({ | ||
| 48 | + textContent: this.longMessage, | ||
| 49 | + fontSize: this.fontSize, | ||
| 50 | + fontWeight: this.fontWeight, | ||
| 51 | + constraintWidth:(this.screenWidth - padding) | ||
| 52 | + }) | ||
| 53 | + | ||
| 54 | + console.log(`文本宽度为:${this.textWidth}`) | ||
| 55 | + | ||
| 56 | + this.promise.then((data: Array<display.Display>) => { | ||
| 57 | + console.log(`所有的屏幕信息:${JSON.stringify(data)}`) | ||
| 58 | + //单位为像素 | ||
| 59 | + this.screenWidth = data[0]["width"] | ||
| 60 | + // 屏幕宽度 * 最大行数 * 组件宽度比例 和 文字测量宽度 | ||
| 61 | + this.isExpanded = (this.screenWidth - padding) * this.lines <= this.textWidth | ||
| 62 | + // this.expandedStates = this.isExpanded; | ||
| 63 | + | ||
| 64 | + //需要展开的话计算3行需要显示的文字 | ||
| 65 | + if (this.isExpanded) { | ||
| 66 | + | ||
| 67 | + | ||
| 68 | + let padding = vp2px(5 + this.marginWidth) | ||
| 69 | + let maxLineTextWidth = (this.screenWidth - padding) * this.maxline; | ||
| 70 | + | ||
| 71 | + for (let index = 0; index < this.longMessage.length; index++) { | ||
| 72 | + const element = this.longMessage.substring(0, index) | ||
| 73 | + const string = element + this.collapseText; //截取 | ||
| 74 | + const thisTextWidth = measure.measureText({ | ||
| 75 | + textContent: string, | ||
| 76 | + fontSize: this.fontSize, | ||
| 77 | + fontWeight: this.fontWeight, | ||
| 78 | + constraintWidth:(this.screenWidth - padding) | ||
| 79 | + }) | ||
| 80 | + | ||
| 81 | + //计算有误差20 | ||
| 82 | + | ||
| 83 | + if (thisTextWidth >= maxLineTextWidth) { | ||
| 84 | + break | ||
| 85 | + } | ||
| 86 | + this.maxLineMesssage = element; | ||
| 87 | + | ||
| 88 | + } | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + | ||
| 92 | + }).catch((err: BusinessError) => { | ||
| 93 | + console.error(`Failed to obtain all the display objects. Code: ${JSON.stringify(err)}`) | ||
| 94 | + }) | ||
| 95 | + | ||
| 96 | + | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + build() { | ||
| 100 | + Row() { | ||
| 101 | + Column() { | ||
| 102 | + if (this.isExpanded) { | ||
| 103 | + // Stack({ alignContent: Alignment.BottomEnd }) { | ||
| 104 | + Text(this.longMessage) { | ||
| 105 | + Span(this.expandedStates ? this.longMessage : this.maxLineMesssage) | ||
| 106 | + Span(this.collapseText).onClick(() => { | ||
| 107 | + if (this.collapseText == collapseString) { | ||
| 108 | + this.collapseText = uncollapseString; | ||
| 109 | + this.expandedStates = true; | ||
| 110 | + this.lines = -1; // 使得设置的最大行属性无效 | ||
| 111 | + // 展开动画 | ||
| 112 | + // animateTo({ | ||
| 113 | + // duration: 150, | ||
| 114 | + // curve: curves.springMotion(), | ||
| 115 | + // }, () => { | ||
| 116 | + // this.lines = -1; // 使得设置的最大行属性无效 | ||
| 117 | + // }) | ||
| 118 | + } else { | ||
| 119 | + this.collapseText = collapseString; | ||
| 120 | + this.expandedStates = false; | ||
| 121 | + this.lines = this.maxline; // 只显示3行 | ||
| 122 | + // 收起动画 | ||
| 123 | + // animateTo({ | ||
| 124 | + // duration: 100, | ||
| 125 | + // curve: Curve.Friction, | ||
| 126 | + // }, () => { | ||
| 127 | + // this.lines = this.maxline; // 只显示3行 | ||
| 128 | + // }) | ||
| 129 | + } | ||
| 130 | + }) | ||
| 131 | + } | ||
| 132 | + .width('100%') | ||
| 133 | + .fontSize(this.fontSize) | ||
| 134 | + .fontWeight(this.fontWeight) | ||
| 135 | + .fontColor(this.fontColor) | ||
| 136 | + .maxLines(this.lines) | ||
| 137 | + // .backgroundColor(Color.Red) | ||
| 138 | + | ||
| 139 | + // } | ||
| 140 | + } | ||
| 141 | + else { | ||
| 142 | + Text('我没有展开收起') | ||
| 143 | + .width('100%') | ||
| 144 | + .fontSize(this.fontSize) | ||
| 145 | + .fontWeight(this.fontWeight) | ||
| 146 | + .fontColor(this.fontColor) | ||
| 147 | + } | ||
| 148 | + } | ||
| 149 | + // .backgroundColor(Color.Brown) | ||
| 150 | + .width('100%') | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + // .height('100%') | ||
| 154 | + } | ||
| 155 | +} | ||
| 156 | + | ||
| 157 | + | ||
| 158 | +// Index.ets | ||
| 159 | +@Entry | ||
| 160 | +@Component | ||
| 161 | +struct Index { | ||
| 162 | + build() { | ||
| 163 | + Column() { | ||
| 164 | + CommentText() | ||
| 165 | + } | ||
| 166 | + } | ||
| 167 | +} |
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/QualityCommentsComponent.ets
0 → 100644
| 1 | +import { ViewType } from 'wdConstant/Index' | ||
| 2 | +import { LazyDataSource } from 'wdKit/Index' | ||
| 3 | +import { commentItemModel, commentListModel } from '../model/CommentModel' | ||
| 4 | +import commentViewModel from '../viewmodel/CommentViewModel' | ||
| 5 | + | ||
| 6 | +@Entry | ||
| 7 | +@Preview | ||
| 8 | +@Component | ||
| 9 | +export struct QualityCommentsComponent { | ||
| 10 | + @State private browSingModel: commentListModel = new commentListModel() | ||
| 11 | + isloading: boolean = false | ||
| 12 | + @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); | ||
| 13 | + | ||
| 14 | + aboutToAppear(): void { | ||
| 15 | + | ||
| 16 | + commentViewModel.fetchQualityCommentList('1').then((commentListModel)=>{ | ||
| 17 | + if (commentListModel && commentListModel.list && commentListModel.list.length > 0) { | ||
| 18 | + commentListModel.hasMore = true; | ||
| 19 | + this.browSingModel.viewType = ViewType.LOADED; | ||
| 20 | + this.allDatas.push(...commentListModel.list) | ||
| 21 | + if (commentListModel.list.length === this.browSingModel.pageSize) { | ||
| 22 | + this.browSingModel.currentPage++; | ||
| 23 | + this.browSingModel.hasMore = true; | ||
| 24 | + } else { | ||
| 25 | + this.browSingModel.hasMore = false; | ||
| 26 | + } | ||
| 27 | + } else { | ||
| 28 | + this.browSingModel.viewType = ViewType.EMPTY; | ||
| 29 | + } | ||
| 30 | + }) | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + build() { | ||
| 34 | + | ||
| 35 | + } | ||
| 36 | +} |
sight_harmony/features/wdComponent/src/main/ets/components/comment/viewmodel/CommentViewModel.ets
0 → 100644
| 1 | +import { Logger, ResourcesUtils } from 'wdKit/Index'; | ||
| 2 | +import { HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index'; | ||
| 3 | +import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | ||
| 4 | +import { commentItemModel, commentListModel } from '../model/CommentModel'; | ||
| 5 | +import HashMap from '@ohos.util.HashMap'; | ||
| 6 | + | ||
| 7 | +const TAG = "CommentViewModel" | ||
| 8 | + | ||
| 9 | +class CommentViewModel { | ||
| 10 | + private static instance: CommentViewModel | ||
| 11 | + /** | ||
| 12 | + * 单例模式 | ||
| 13 | + * @returns | ||
| 14 | + */ | ||
| 15 | + public static getInstance(): CommentViewModel { | ||
| 16 | + if (!CommentViewModel.instance) { | ||
| 17 | + CommentViewModel.instance = new CommentViewModel(); | ||
| 18 | + } | ||
| 19 | + return CommentViewModel.instance; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + /*获取本地mock数据*/ | ||
| 24 | + async getCommentLocal(context: Context): Promise<commentListModel> { | ||
| 25 | + Logger.info(TAG, `getBottomNavDataMock start`); | ||
| 26 | + let compRes: ResponseDTO<commentListModel> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<commentListModel>>(context,'comment_local.json' ); | ||
| 27 | + if (!compRes || !compRes.data) { | ||
| 28 | + Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`); | ||
| 29 | + return new commentListModel() | ||
| 30 | + } | ||
| 31 | + Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 32 | + return compRes.data | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + fetchQualityCommentList(pageNum: string) { | ||
| 37 | + let url = HttpUrlUtils.getQualityCommentUrl() + `?&pageSize=${10}&pageNum=${pageNum}` | ||
| 38 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 39 | + return new Promise<commentListModel>((success, fail) => { | ||
| 40 | + HttpRequest.get<ResponseDTO<commentListModel>>(url, headers).then((data: ResponseDTO<commentListModel>) => { | ||
| 41 | + if (!data || !data.data) { | ||
| 42 | + fail("数据为空") | ||
| 43 | + return | ||
| 44 | + } | ||
| 45 | + if (data.code != 0) { | ||
| 46 | + fail(data.message) | ||
| 47 | + return | ||
| 48 | + } | ||
| 49 | + let listData = data.data as commentListModel | ||
| 50 | + | ||
| 51 | + success(listData) | ||
| 52 | + }, (error: Error) => { | ||
| 53 | + fail(error.message) | ||
| 54 | + Logger.debug(TAG, error.toString()) | ||
| 55 | + }) | ||
| 56 | + }) | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + | ||
| 60 | + // BaseGetRequest(contentID:number,contentType:string,pageNum:string){ | ||
| 61 | + // let url = HttpUrlUtils.getMyCollectionListDataUrl()+ `?type=${type}&operateTag=${1}&pageSize=${10}&pageNum=${pageNum}` | ||
| 62 | + // if (tagId.length > 0) { | ||
| 63 | + // url = url + `&tagId=${tagId}` | ||
| 64 | + // } | ||
| 65 | + // let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders() | ||
| 66 | + // return WDHttp.get<ResponseDTO<commentListModel>>(url, headers) | ||
| 67 | + // } | ||
| 68 | + // | ||
| 69 | + // | ||
| 70 | + // fetchCommentList(contentID:number,contentType:string,pageNum:string):Promise<commentListModel>{ | ||
| 71 | + // return new Promise<commentListModel>((success,error) => { | ||
| 72 | + // this.BaseGetRequest(contentID,contentType,pageNum).then((navResDTO: ResponseDTO<commentListModel>) => { | ||
| 73 | + // if (!navResDTO || navResDTO.code != 0) { | ||
| 74 | + // // success(this.getAppointmentListDataLocal(context)) | ||
| 75 | + // return | ||
| 76 | + // } | ||
| 77 | + // Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | ||
| 78 | + // let listData = navResDTO.data as commentListModel | ||
| 79 | + // success(listData) | ||
| 80 | + // }).catch((err: Error) => { | ||
| 81 | + // Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 82 | + // error("page data invalid"); | ||
| 83 | + // }) | ||
| 84 | + // }) | ||
| 85 | + // } | ||
| 86 | + | ||
| 87 | + | ||
| 88 | +} | ||
| 89 | + | ||
| 90 | + | ||
| 91 | +const commentViewModel = CommentViewModel.getInstance(); | ||
| 92 | + | ||
| 93 | +export default commentViewModel as CommentViewModel |
| @@ -8,7 +8,6 @@ const TAG = 'Zh_Single_Column-04'; | @@ -8,7 +8,6 @@ const TAG = 'Zh_Single_Column-04'; | ||
| 8 | * 人民号主题卡 | 8 | * 人民号主题卡 |
| 9 | * 枚举值 Zh_Single_Column-04 | 9 | * 枚举值 Zh_Single_Column-04 |
| 10 | */ | 10 | */ |
| 11 | -@Entry | ||
| 12 | @Component | 11 | @Component |
| 13 | export struct ZhSingleColumn04 { | 12 | export struct ZhSingleColumn04 { |
| 14 | @State compDTO: CompDTO = {} as CompDTO | 13 | @State compDTO: CompDTO = {} as CompDTO |
| @@ -8,7 +8,6 @@ const TAG = 'Zh_Single_Column-05'; | @@ -8,7 +8,6 @@ const TAG = 'Zh_Single_Column-05'; | ||
| 8 | * 人民号入住卡 | 8 | * 人民号入住卡 |
| 9 | * 枚举值 Zh_Single_Column-05 | 9 | * 枚举值 Zh_Single_Column-05 |
| 10 | */ | 10 | */ |
| 11 | -@Entry | ||
| 12 | @Component | 11 | @Component |
| 13 | export struct ZhSingleColumn05 { | 12 | export struct ZhSingleColumn05 { |
| 14 | @State compDTO: CompDTO = {} as CompDTO | 13 | @State compDTO: CompDTO = {} as CompDTO |
| @@ -33,8 +33,8 @@ export default struct MinePageUserSimpleInfoUI { | @@ -33,8 +33,8 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 33 | Stack(){ | 33 | Stack(){ |
| 34 | Image(this.headPhotoUrl) | 34 | Image(this.headPhotoUrl) |
| 35 | .alt($r('app.media.default_head')) | 35 | .alt($r('app.media.default_head')) |
| 36 | - .width('108lpx') | ||
| 37 | - .height('108lpx') | 36 | + .width('100lpx') |
| 37 | + .height('100lpx') | ||
| 38 | .objectFit(ImageFit.Cover) | 38 | .objectFit(ImageFit.Cover) |
| 39 | .borderRadius(50) | 39 | .borderRadius(50) |
| 40 | Image(this.levelHead) | 40 | Image(this.levelHead) |
| @@ -18,7 +18,7 @@ export struct FollowFirstTabsComponent{ | @@ -18,7 +18,7 @@ export struct FollowFirstTabsComponent{ | ||
| 18 | value.forEach((element)=>{ | 18 | value.forEach((element)=>{ |
| 19 | this.data.push(element) | 19 | this.data.push(element) |
| 20 | }) | 20 | }) |
| 21 | - console.log("ycg",this.data.length.toString()); | 21 | + |
| 22 | if(this.controller != null && this.data.length>1 && this.changeIndex === 1){ | 22 | if(this.controller != null && this.data.length>1 && this.changeIndex === 1){ |
| 23 | //个人主页 跳转 关注页 tab 2 | 23 | //个人主页 跳转 关注页 tab 2 |
| 24 | let intervalID = setInterval(() => { | 24 | let intervalID = setInterval(() => { |
| @@ -171,6 +171,7 @@ struct ChildComponent { | @@ -171,6 +171,7 @@ struct ChildComponent { | ||
| 171 | .fontSize('31lpx') | 171 | .fontSize('31lpx') |
| 172 | .lineHeight('38lpx') | 172 | .lineHeight('38lpx') |
| 173 | .fontColor($r('app.color.color_222222')) | 173 | .fontColor($r('app.color.color_222222')) |
| 174 | + .maxLines(1) | ||
| 174 | Text(`粉丝${this.data.cnFansNum}`) | 175 | Text(`粉丝${this.data.cnFansNum}`) |
| 175 | .fontColor($r('app.color.color_B0B0B0')) | 176 | .fontColor($r('app.color.color_B0B0B0')) |
| 176 | .fontSize('23lpx') | 177 | .fontSize('23lpx') |
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowSecondTabsComponent.ets
| @@ -35,25 +35,45 @@ export struct FollowSecondTabsComponent{ | @@ -35,25 +35,45 @@ export struct FollowSecondTabsComponent{ | ||
| 35 | 35 | ||
| 36 | @Builder FollowSecondUI(){ | 36 | @Builder FollowSecondUI(){ |
| 37 | Row() { | 37 | Row() { |
| 38 | + Row(){ | ||
| 39 | + // 页签 | ||
| 40 | + Column({ space: 7 }) { | ||
| 41 | + Scroll() { | ||
| 42 | + Column() { | ||
| 43 | + ForEach(this.data[this.firstIndex].children, (item: FollowSecondListItem, index: number ) => { | ||
| 44 | + this.TabBuilder(index,item) | ||
| 45 | + }) | ||
| 46 | + } | ||
| 47 | + .justifyContent(FlexAlign.Start) | ||
| 48 | + } | ||
| 49 | + .align(Alignment.Top) | ||
| 50 | + .scrollable(ScrollDirection.Vertical) | ||
| 51 | + .scrollBar(BarState.Off) | ||
| 52 | + .height('100%') | ||
| 53 | + }.height('100%') | ||
| 54 | + .alignItems(HorizontalAlign.Center) | ||
| 55 | + } | ||
| 56 | + .alignItems(VerticalAlign.Top) | ||
| 57 | + .height('100%') | ||
| 58 | + | ||
| 38 | Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { | 59 | Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { |
| 39 | ForEach(this.data[this.firstIndex].children, (item: FollowSecondListItem, index: number ) => { | 60 | ForEach(this.data[this.firstIndex].children, (item: FollowSecondListItem, index: number ) => { |
| 40 | TabContent(){ | 61 | TabContent(){ |
| 41 | FollowThirdTabsComponent({data:$data,firstIndex:$firstIndex,secondIndex:index}) | 62 | FollowThirdTabsComponent({data:$data,firstIndex:$firstIndex,secondIndex:index}) |
| 42 | - }.tabBar(this.TabBuilder(index,item)) | 63 | + } |
| 43 | .backgroundColor($r('app.color.white')) | 64 | .backgroundColor($r('app.color.white')) |
| 44 | }, (item: FollowListItem, index: number) => index.toString()) | 65 | }, (item: FollowListItem, index: number) => index.toString()) |
| 45 | } | 66 | } |
| 46 | .vertical(true) | 67 | .vertical(true) |
| 47 | .barMode(BarMode.Scrollable) | 68 | .barMode(BarMode.Scrollable) |
| 48 | - .barWidth('140lpx') | ||
| 49 | .animationDuration(0) | 69 | .animationDuration(0) |
| 50 | .onChange((index: number) => { | 70 | .onChange((index: number) => { |
| 51 | this.currentIndex = index | 71 | this.currentIndex = index |
| 52 | }) | 72 | }) |
| 53 | - .width('100%') | 73 | + .barWidth(0) |
| 74 | + .height('100%') | ||
| 75 | + .layoutWeight(1) | ||
| 54 | }.width('100%') | 76 | }.width('100%') |
| 55 | - .alignItems(VerticalAlign.Top) | ||
| 56 | - .backgroundColor('#0FF') | ||
| 57 | } | 77 | } |
| 58 | 78 | ||
| 59 | @Builder TabBuilder(index: number, item: FollowSecondListItem) { | 79 | @Builder TabBuilder(index: number, item: FollowSecondListItem) { |
| @@ -73,6 +93,7 @@ export struct FollowSecondTabsComponent{ | @@ -73,6 +93,7 @@ export struct FollowSecondTabsComponent{ | ||
| 73 | }) | 93 | }) |
| 74 | .justifyContent(FlexAlign.Center) | 94 | .justifyContent(FlexAlign.Center) |
| 75 | .height('84lpx') | 95 | .height('84lpx') |
| 96 | + .width('140lpx') | ||
| 76 | .backgroundColor(this.currentIndex === index?$r('app.color.white'):$r('app.color.color_F9F9F9')) | 97 | .backgroundColor(this.currentIndex === index?$r('app.color.white'):$r('app.color.color_F9F9F9')) |
| 77 | } | 98 | } |
| 78 | 99 |
| @@ -34,19 +34,45 @@ export struct FollowThirdTabsComponent{ | @@ -34,19 +34,45 @@ export struct FollowThirdTabsComponent{ | ||
| 34 | .lineHeight('38lpx') | 34 | .lineHeight('38lpx') |
| 35 | .backgroundColor($r('app.color.color_F9F9F9')) | 35 | .backgroundColor($r('app.color.color_F9F9F9')) |
| 36 | .padding('13lpx') | 36 | .padding('13lpx') |
| 37 | + .maxLines(1) | ||
| 37 | } | 38 | } |
| 38 | .onClick(()=>{ | 39 | .onClick(()=>{ |
| 39 | this.currentIndex = index | 40 | this.currentIndex = index |
| 40 | this.controller.changeIndex(this.currentIndex) | 41 | this.controller.changeIndex(this.currentIndex) |
| 41 | }) | 42 | }) |
| 42 | - .height('100%') | 43 | + .height('84lpx') |
| 43 | .margin({right:'9lpx'}) | 44 | .margin({right:'9lpx'}) |
| 44 | .padding({left:'20lpx',right:index === this.data[this.firstIndex].children[this.secondIndex].children.length-1?"20lpx":"0lpx"}) | 45 | .padding({left:'20lpx',right:index === this.data[this.firstIndex].children[this.secondIndex].children.length-1?"20lpx":"0lpx"}) |
| 45 | .justifyContent(FlexAlign.Center) | 46 | .justifyContent(FlexAlign.Center) |
| 46 | } | 47 | } |
| 47 | 48 | ||
| 48 | @Builder FollowThirdUI(){ | 49 | @Builder FollowThirdUI(){ |
| 49 | - Row() { | 50 | + |
| 51 | + Column(){ | ||
| 52 | + Column() { | ||
| 53 | + // 页签 | ||
| 54 | + Row({ space: 7 }) { | ||
| 55 | + Scroll() { | ||
| 56 | + Row() { | ||
| 57 | + ForEach(this.data[this.firstIndex].children[this.secondIndex].children, (item: FollowThirdListItem, index: number ) => { | ||
| 58 | + this.TabBuilder(index,item) | ||
| 59 | + }) | ||
| 60 | + } | ||
| 61 | + .justifyContent(FlexAlign.Start) | ||
| 62 | + } | ||
| 63 | + .align(Alignment.Start) | ||
| 64 | + .scrollable(ScrollDirection.Horizontal) | ||
| 65 | + .scrollBar(BarState.Off) | ||
| 66 | + .width('90%') | ||
| 67 | + .padding({left:'11lpx'}) | ||
| 68 | + } | ||
| 69 | + .alignItems(VerticalAlign.Bottom) | ||
| 70 | + .width('100%') | ||
| 71 | + } | ||
| 72 | + .backgroundColor($r('app.color.white')) | ||
| 73 | + .alignItems(HorizontalAlign.Start) | ||
| 74 | + .width('100%') | ||
| 75 | + | ||
| 50 | Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { | 76 | Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { |
| 51 | ForEach(this.data[this.firstIndex].children[this.secondIndex].children, (item: FollowThirdListItem, index: number ) => { | 77 | ForEach(this.data[this.firstIndex].children[this.secondIndex].children, (item: FollowThirdListItem, index: number ) => { |
| 52 | TabContent(){ | 78 | TabContent(){ |
| @@ -58,20 +84,19 @@ export struct FollowThirdTabsComponent{ | @@ -58,20 +84,19 @@ export struct FollowThirdTabsComponent{ | ||
| 58 | .margin({left:'20lpx'}) | 84 | .margin({left:'20lpx'}) |
| 59 | FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].children[this.secondIndex].children[index].id}) | 85 | FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].children[this.secondIndex].children[index].id}) |
| 60 | } | 86 | } |
| 61 | - }.tabBar(this.TabBuilder(index,item)) | 87 | + } |
| 62 | .backgroundColor($r('app.color.white')) | 88 | .backgroundColor($r('app.color.white')) |
| 63 | }, (item: FollowListItem, index: number) => index.toString()) | 89 | }, (item: FollowListItem, index: number) => index.toString()) |
| 64 | } | 90 | } |
| 91 | + .barHeight(0) | ||
| 65 | .vertical(false) | 92 | .vertical(false) |
| 66 | .barMode(BarMode.Scrollable) | 93 | .barMode(BarMode.Scrollable) |
| 67 | - .barWidth('100%') | ||
| 68 | - .barHeight('84lpx') | ||
| 69 | .animationDuration(0) | 94 | .animationDuration(0) |
| 70 | .onChange((index: number) => { | 95 | .onChange((index: number) => { |
| 71 | this.currentIndex = index | 96 | this.currentIndex = index |
| 72 | }) | 97 | }) |
| 73 | .width('100%') | 98 | .width('100%') |
| 74 | - }.width('100%') | 99 | + } |
| 75 | } | 100 | } |
| 76 | 101 | ||
| 77 | } | 102 | } |
| @@ -6,13 +6,14 @@ import { EmptyComponent } from '../view/EmptyComponent' | @@ -6,13 +6,14 @@ import { EmptyComponent } from '../view/EmptyComponent' | ||
| 6 | import { ErrorComponent } from '../view/ErrorComponent' | 6 | import { ErrorComponent } from '../view/ErrorComponent' |
| 7 | import RefreshLayout from './RefreshLayout' | 7 | import RefreshLayout from './RefreshLayout' |
| 8 | import { RefreshLayoutBean } from './RefreshLayoutBean'; | 8 | import { RefreshLayoutBean } from './RefreshLayoutBean'; |
| 9 | -import { CompDTO } from 'wdBean' | 9 | +import { CompDTO, ContentDTO } from 'wdBean' |
| 10 | import LoadMoreLayout from './LoadMoreLayout' | 10 | import LoadMoreLayout from './LoadMoreLayout' |
| 11 | import NoMoreLayout from './NoMoreLayout' | 11 | import NoMoreLayout from './NoMoreLayout' |
| 12 | import { CompParser } from '../CompParser' | 12 | import { CompParser } from '../CompParser' |
| 13 | import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; | 13 | import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; |
| 14 | import { CustomSelectUI } from '../view/CustomSelectUI'; | 14 | import { CustomSelectUI } from '../view/CustomSelectUI'; |
| 15 | import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; | 15 | import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; |
| 16 | +import { BigPicCardComponent } from '../view/BigPicCardComponent'; | ||
| 16 | 17 | ||
| 17 | @Entry | 18 | @Entry |
| 18 | @Component | 19 | @Component |
| @@ -20,8 +21,8 @@ struct BrowsingHistoryPage { | @@ -20,8 +21,8 @@ struct BrowsingHistoryPage { | ||
| 20 | @State private browSingModel: PageModel = new PageModel() | 21 | @State private browSingModel: PageModel = new PageModel() |
| 21 | isloading : boolean = false | 22 | isloading : boolean = false |
| 22 | @Provide isEditState:boolean = false | 23 | @Provide isEditState:boolean = false |
| 23 | - @State allDatas :CompDTO[] = []; | ||
| 24 | - @State selectDatas :CompDTO[] = []; | 24 | + @State allDatas :ContentDTO[] = []; |
| 25 | + @State selectDatas :ContentDTO[] = []; | ||
| 25 | @Provide deleteNum :number = 0; | 26 | @Provide deleteNum :number = 0; |
| 26 | @Provide isAllSelect:boolean = false | 27 | @Provide isAllSelect:boolean = false |
| 27 | aboutToAppear(){ | 28 | aboutToAppear(){ |
| @@ -72,7 +73,7 @@ struct BrowsingHistoryPage { | @@ -72,7 +73,7 @@ struct BrowsingHistoryPage { | ||
| 72 | }) | 73 | }) |
| 73 | } | 74 | } |
| 74 | 75 | ||
| 75 | - ForEach(this.allDatas, (compDTO: CompDTO, compIndex: number) => { | 76 | + ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => { |
| 76 | ListItem() { | 77 | ListItem() { |
| 77 | this.newCompParser(compDTO,compIndex) | 78 | this.newCompParser(compDTO,compIndex) |
| 78 | } | 79 | } |
| @@ -94,7 +95,7 @@ struct BrowsingHistoryPage { | @@ -94,7 +95,7 @@ struct BrowsingHistoryPage { | ||
| 94 | } | 95 | } |
| 95 | 96 | ||
| 96 | @Builder | 97 | @Builder |
| 97 | - newCompParser(compDTO: CompDTO, compIndex: number){ | 98 | + newCompParser(compDTO: ContentDTO, compIndex: number){ |
| 98 | Row(){ | 99 | Row(){ |
| 99 | if (this.isEditState){ | 100 | if (this.isEditState){ |
| 100 | CustomSelectUI({ | 101 | CustomSelectUI({ |
| @@ -106,7 +107,7 @@ struct BrowsingHistoryPage { | @@ -106,7 +107,7 @@ struct BrowsingHistoryPage { | ||
| 106 | .margin({left:16}) | 107 | .margin({left:16}) |
| 107 | } | 108 | } |
| 108 | Column() { | 109 | Column() { |
| 109 | - CompParser({ compDTO: compDTO, compIndex: compIndex }) | 110 | + BigPicCardComponent({contentDTO:compDTO}) |
| 110 | } | 111 | } |
| 111 | } | 112 | } |
| 112 | } | 113 | } |
| @@ -118,11 +119,11 @@ struct BrowsingHistoryPage { | @@ -118,11 +119,11 @@ struct BrowsingHistoryPage { | ||
| 118 | 119 | ||
| 119 | async getData() { | 120 | async getData() { |
| 120 | this.browSingModel.currentPage = 1 | 121 | this.browSingModel.currentPage = 1 |
| 121 | - MyCollectionViewModel.newFetchMyCollectList(2,'1',this.browSingModel.currentPage,getContext(this)).then(pageDto => { | ||
| 122 | - if (pageDto && pageDto.compList && pageDto.compList.length > 0) { | 122 | + MyCollectionViewModel.fetchMyCollectList(2,'1',this.browSingModel.currentPage,getContext(this)).then(collectionItem => { |
| 123 | + if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { | ||
| 123 | this.browSingModel.viewType = ViewType.LOADED; | 124 | this.browSingModel.viewType = ViewType.LOADED; |
| 124 | - this.allDatas.push(...pageDto.compList) | ||
| 125 | - if (pageDto.compList.length === this.browSingModel.pageSize) { | 125 | + this.allDatas.push(...collectionItem.list) |
| 126 | + if (collectionItem.list.length === this.browSingModel.pageSize) { | ||
| 126 | this.browSingModel.currentPage++; | 127 | this.browSingModel.currentPage++; |
| 127 | this.browSingModel.hasMore = true; | 128 | this.browSingModel.hasMore = true; |
| 128 | } else { | 129 | } else { |
| @@ -136,7 +137,7 @@ struct BrowsingHistoryPage { | @@ -136,7 +137,7 @@ struct BrowsingHistoryPage { | ||
| 136 | 137 | ||
| 137 | //数据处理 | 138 | //数据处理 |
| 138 | //单个选择 | 139 | //单个选择 |
| 139 | - addCompDTO(isOn:boolean , compDTO: CompDTO){ | 140 | + addCompDTO(isOn:boolean , compDTO: ContentDTO){ |
| 140 | compDTO.isSelect = isOn; | 141 | compDTO.isSelect = isOn; |
| 141 | if (isOn === true){ | 142 | if (isOn === true){ |
| 142 | this.selectDatas.push(compDTO) | 143 | this.selectDatas.push(compDTO) |
| @@ -150,7 +151,7 @@ struct BrowsingHistoryPage { | @@ -150,7 +151,7 @@ struct BrowsingHistoryPage { | ||
| 150 | 151 | ||
| 151 | //全选 | 152 | //全选 |
| 152 | allSelectDatas(isOn:boolean){ | 153 | allSelectDatas(isOn:boolean){ |
| 153 | - let datas: CompDTO[] = []; | 154 | + let datas: ContentDTO[] = []; |
| 154 | for (let index = 0; index < this.allDatas.length; index++) { | 155 | for (let index = 0; index < this.allDatas.length; index++) { |
| 155 | const compDTO = this.allDatas[index]; | 156 | const compDTO = this.allDatas[index]; |
| 156 | compDTO.isSelect = isOn | 157 | compDTO.isSelect = isOn |
| @@ -287,9 +287,7 @@ struct ChannelDialog { | @@ -287,9 +287,7 @@ struct ChannelDialog { | ||
| 287 | .height('100%') | 287 | .height('100%') |
| 288 | .justifyContent(FlexAlign.Center) | 288 | .justifyContent(FlexAlign.Center) |
| 289 | .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff') | 289 | .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff') |
| 290 | - .onTouch((event?: TouchEvent) => { | ||
| 291 | - if(event&&event.type === TouchType.Down){ | ||
| 292 | - console.log('onTouch') | 290 | + .onClick(() => { |
| 293 | if (this.isEditIng) { | 291 | if (this.isEditIng) { |
| 294 | if (item.delPermitted === 1) { | 292 | if (item.delPermitted === 1) { |
| 295 | this.delChannelItem(index) | 293 | this.delChannelItem(index) |
| @@ -298,7 +296,6 @@ struct ChannelDialog { | @@ -298,7 +296,6 @@ struct ChannelDialog { | ||
| 298 | this.confirm(index) | 296 | this.confirm(index) |
| 299 | this.controller?.close() | 297 | this.controller?.close() |
| 300 | } | 298 | } |
| 301 | - } | ||
| 302 | }) | 299 | }) |
| 303 | } | 300 | } |
| 304 | .width('23%') | 301 | .width('23%') |
| @@ -42,7 +42,7 @@ struct EditUserInfoPage { | @@ -42,7 +42,7 @@ struct EditUserInfoPage { | ||
| 42 | build() { | 42 | build() { |
| 43 | Row() { | 43 | Row() { |
| 44 | Column() { | 44 | Column() { |
| 45 | - CustomTitleUI({titleName:'资料编辑'}) | 45 | + CustomTitleUI({titleName:'编辑资料'}) |
| 46 | Image(this.headerImg) | 46 | Image(this.headerImg) |
| 47 | .alt($r('app.media.default_head')) | 47 | .alt($r('app.media.default_head')) |
| 48 | .backgroundColor(Color.Gray) | 48 | .backgroundColor(Color.Gray) |
| @@ -6,13 +6,15 @@ import { EmptyComponent } from '../view/EmptyComponent' | @@ -6,13 +6,15 @@ import { EmptyComponent } from '../view/EmptyComponent' | ||
| 6 | import { ErrorComponent } from '../view/ErrorComponent' | 6 | import { ErrorComponent } from '../view/ErrorComponent' |
| 7 | import RefreshLayout from './RefreshLayout' | 7 | import RefreshLayout from './RefreshLayout' |
| 8 | import { RefreshLayoutBean } from './RefreshLayoutBean'; | 8 | import { RefreshLayoutBean } from './RefreshLayoutBean'; |
| 9 | -import { CompDTO } from 'wdBean' | 9 | +import { CompDTO, ContentDTO } from 'wdBean' |
| 10 | import LoadMoreLayout from './LoadMoreLayout' | 10 | import LoadMoreLayout from './LoadMoreLayout' |
| 11 | import NoMoreLayout from './NoMoreLayout' | 11 | import NoMoreLayout from './NoMoreLayout' |
| 12 | import { CompParser } from '../CompParser' | 12 | import { CompParser } from '../CompParser' |
| 13 | import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; | 13 | import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; |
| 14 | import { CustomSelectUI } from '../view/CustomSelectUI'; | 14 | import { CustomSelectUI } from '../view/CustomSelectUI'; |
| 15 | import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; | 15 | import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; |
| 16 | +import { BigPicCardComponent } from '../view/BigPicCardComponent'; | ||
| 17 | +import { contentListItemParams } from '../../model/MyCollectionModel'; | ||
| 16 | 18 | ||
| 17 | @Entry | 19 | @Entry |
| 18 | @Component | 20 | @Component |
| @@ -20,8 +22,8 @@ struct MyCollectionListPage { | @@ -20,8 +22,8 @@ struct MyCollectionListPage { | ||
| 20 | @State private browSingModel: PageModel = new PageModel() | 22 | @State private browSingModel: PageModel = new PageModel() |
| 21 | isloading : boolean = false | 23 | isloading : boolean = false |
| 22 | @Provide isEditState:boolean = false | 24 | @Provide isEditState:boolean = false |
| 23 | - @State allDatas :CompDTO[] = []; | ||
| 24 | - @State selectDatas :CompDTO[] = []; | 25 | + @State allDatas :ContentDTO[] = []; |
| 26 | + @State selectDatas :ContentDTO[] = []; | ||
| 25 | @Provide deleteNum :number = 0; | 27 | @Provide deleteNum :number = 0; |
| 26 | @Provide isAllSelect:boolean = false | 28 | @Provide isAllSelect:boolean = false |
| 27 | aboutToAppear(){ | 29 | aboutToAppear(){ |
| @@ -72,7 +74,7 @@ struct MyCollectionListPage { | @@ -72,7 +74,7 @@ struct MyCollectionListPage { | ||
| 72 | }) | 74 | }) |
| 73 | } | 75 | } |
| 74 | 76 | ||
| 75 | - ForEach(this.allDatas, (compDTO: CompDTO, compIndex: number) => { | 77 | + ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => { |
| 76 | ListItem() { | 78 | ListItem() { |
| 77 | this.newCompParser(compDTO,compIndex) | 79 | this.newCompParser(compDTO,compIndex) |
| 78 | } | 80 | } |
| @@ -94,7 +96,7 @@ struct MyCollectionListPage { | @@ -94,7 +96,7 @@ struct MyCollectionListPage { | ||
| 94 | } | 96 | } |
| 95 | 97 | ||
| 96 | @Builder | 98 | @Builder |
| 97 | - newCompParser(compDTO: CompDTO, compIndex: number){ | 99 | + newCompParser(compDTO: ContentDTO, compIndex: number){ |
| 98 | Row(){ | 100 | Row(){ |
| 99 | if (this.isEditState){ | 101 | if (this.isEditState){ |
| 100 | CustomSelectUI({ | 102 | CustomSelectUI({ |
| @@ -106,7 +108,7 @@ struct MyCollectionListPage { | @@ -106,7 +108,7 @@ struct MyCollectionListPage { | ||
| 106 | .margin({left:16}) | 108 | .margin({left:16}) |
| 107 | } | 109 | } |
| 108 | Column() { | 110 | Column() { |
| 109 | - CompParser({ compDTO: compDTO, compIndex: compIndex }) | 111 | + BigPicCardComponent({contentDTO:compDTO}) |
| 110 | } | 112 | } |
| 111 | } | 113 | } |
| 112 | } | 114 | } |
| @@ -118,11 +120,11 @@ struct MyCollectionListPage { | @@ -118,11 +120,11 @@ struct MyCollectionListPage { | ||
| 118 | 120 | ||
| 119 | async getData() { | 121 | async getData() { |
| 120 | this.browSingModel.currentPage = 1 | 122 | this.browSingModel.currentPage = 1 |
| 121 | - MyCollectionViewModel.newFetchMyCollectList(1,'1',this.browSingModel.currentPage,getContext(this)).then(pageDto => { | ||
| 122 | - if (pageDto && pageDto.compList && pageDto.compList.length > 0) { | 123 | + MyCollectionViewModel.fetchMyCollectList(1,'1',this.browSingModel.currentPage,getContext(this)).then(collectionItem => { |
| 124 | + if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { | ||
| 123 | this.browSingModel.viewType = ViewType.LOADED; | 125 | this.browSingModel.viewType = ViewType.LOADED; |
| 124 | - this.allDatas.push(...pageDto.compList) | ||
| 125 | - if (pageDto.compList.length === this.browSingModel.pageSize) { | 126 | + this.allDatas.push(...collectionItem.list) |
| 127 | + if (collectionItem.list.length === this.browSingModel.pageSize) { | ||
| 126 | this.browSingModel.currentPage++; | 128 | this.browSingModel.currentPage++; |
| 127 | this.browSingModel.hasMore = true; | 129 | this.browSingModel.hasMore = true; |
| 128 | } else { | 130 | } else { |
| @@ -136,7 +138,7 @@ struct MyCollectionListPage { | @@ -136,7 +138,7 @@ struct MyCollectionListPage { | ||
| 136 | 138 | ||
| 137 | //数据处理 | 139 | //数据处理 |
| 138 | //单个选择 | 140 | //单个选择 |
| 139 | - addCompDTO(isOn:boolean , compDTO: CompDTO){ | 141 | + addCompDTO(isOn:boolean , compDTO: ContentDTO){ |
| 140 | compDTO.isSelect = isOn; | 142 | compDTO.isSelect = isOn; |
| 141 | if (isOn === true){ | 143 | if (isOn === true){ |
| 142 | this.selectDatas.push(compDTO) | 144 | this.selectDatas.push(compDTO) |
| @@ -150,7 +152,7 @@ struct MyCollectionListPage { | @@ -150,7 +152,7 @@ struct MyCollectionListPage { | ||
| 150 | 152 | ||
| 151 | //全选 | 153 | //全选 |
| 152 | allSelectDatas(isOn:boolean){ | 154 | allSelectDatas(isOn:boolean){ |
| 153 | - let datas: CompDTO[] = []; | 155 | + let datas: ContentDTO[] = []; |
| 154 | for (let index = 0; index < this.allDatas.length; index++) { | 156 | for (let index = 0; index < this.allDatas.length; index++) { |
| 155 | const compDTO = this.allDatas[index]; | 157 | const compDTO = this.allDatas[index]; |
| 156 | compDTO.isSelect = isOn | 158 | compDTO.isSelect = isOn |
| @@ -169,13 +171,22 @@ struct MyCollectionListPage { | @@ -169,13 +171,22 @@ struct MyCollectionListPage { | ||
| 169 | 171 | ||
| 170 | //删除 | 172 | //删除 |
| 171 | deleteDatas(){ | 173 | deleteDatas(){ |
| 174 | + let deleteDatas:contentListItemParams[] = []; | ||
| 172 | for (let index = 0; index < this.selectDatas.length; index++) { | 175 | for (let index = 0; index < this.selectDatas.length; index++) { |
| 173 | - const compDTO = this.allDatas[index]; | ||
| 174 | - this.allDatas.splice(this.selectDatas.indexOf(compDTO),1) | 176 | + const compDTO = this.selectDatas[index]; |
| 177 | + this.allDatas.splice(this.allDatas.indexOf(compDTO),1) | ||
| 178 | + deleteDatas.push({contentId:compDTO.objectId,contentType:compDTO.objectType,relType:compDTO.relType,contentRelId:compDTO.relId}) | ||
| 175 | } | 179 | } |
| 176 | 180 | ||
| 181 | + MyCollectionViewModel.executeCollcet({ | ||
| 182 | + delAll:this.isAllSelect === true?1:0, | ||
| 183 | + status:0, | ||
| 184 | + contentList:deleteDatas | ||
| 185 | + }) | ||
| 186 | + | ||
| 177 | //重置删除状态 | 187 | //重置删除状态 |
| 178 | this.isEditState = false | 188 | this.isEditState = false |
| 179 | this.isAllSelect = false | 189 | this.isAllSelect = false |
| 180 | } | 190 | } |
| 191 | + | ||
| 181 | } | 192 | } |
| 1 | +import { CollectionUtils, DateTimeUtils, Logger } from 'wdKit'; | ||
| 1 | import { CommonConstants, CompStyle, ViewType } from 'wdConstant'; | 2 | import { CommonConstants, CompStyle, ViewType } from 'wdConstant'; |
| 2 | -import { DateTimeUtils, Logger } from 'wdKit'; | ||
| 3 | import PageViewModel from '../../viewmodel/PageViewModel'; | 3 | import PageViewModel from '../../viewmodel/PageViewModel'; |
| 4 | import { EmptyComponent } from '../view/EmptyComponent'; | 4 | import { EmptyComponent } from '../view/EmptyComponent'; |
| 5 | import { ErrorComponent } from '../view/ErrorComponent'; | 5 | import { ErrorComponent } from '../view/ErrorComponent'; |
| @@ -11,8 +11,10 @@ import NoMoreLayout from './NoMoreLayout'; | @@ -11,8 +11,10 @@ import NoMoreLayout from './NoMoreLayout'; | ||
| 11 | import LoadMoreLayout from './LoadMoreLayout'; | 11 | import LoadMoreLayout from './LoadMoreLayout'; |
| 12 | import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; | 12 | import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; |
| 13 | import { CompParser } from '../CompParser'; | 13 | import { CompParser } from '../CompParser'; |
| 14 | +import { GroupInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO'; | ||
| 14 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; | 15 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; |
| 15 | -import { CompDTO, LiveReviewDTO, PageDTO } from 'wdBean'; | 16 | +import { CompDTO, LiveReviewDTO, PageDTO, PageInfoBean } from 'wdBean'; |
| 17 | + | ||
| 16 | 18 | ||
| 17 | const TAG = 'PageComponent'; | 19 | const TAG = 'PageComponent'; |
| 18 | 20 | ||
| @@ -69,40 +71,44 @@ export struct PageComponent { | @@ -69,40 +71,44 @@ export struct PageComponent { | ||
| 69 | @Builder | 71 | @Builder |
| 70 | ListLayout() { | 72 | ListLayout() { |
| 71 | List() { | 73 | List() { |
| 72 | - // 下拉刷新 | ||
| 73 | - ListItem() { | ||
| 74 | - RefreshLayout({ | ||
| 75 | - refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage, | ||
| 76 | - this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight) | ||
| 77 | - }) | 74 | + if (this.name !== '视频') { |
| 75 | + // 下拉刷新 | ||
| 76 | + ListItem() { | ||
| 77 | + RefreshLayout({ | ||
| 78 | + refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage, | ||
| 79 | + this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight) | ||
| 80 | + }) | ||
| 81 | + } | ||
| 78 | } | 82 | } |
| 79 | 83 | ||
| 80 | - LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => { | ||
| 81 | - ListItem() { | ||
| 82 | - Column() { | ||
| 83 | - if (this.name == '视频') { | ||
| 84 | - VideoChannelDetail() | ||
| 85 | - } else { | 84 | + if (this.name === '视频') { |
| 85 | + VideoChannelDetail() | ||
| 86 | + } else { | ||
| 87 | + LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => { | ||
| 88 | + ListItem() { | ||
| 89 | + Column() { | ||
| 86 | CompParser({ compDTO: compDTO, compIndex: compIndex }); | 90 | CompParser({ compDTO: compDTO, compIndex: compIndex }); |
| 87 | } | 91 | } |
| 88 | - | ||
| 89 | } | 92 | } |
| 90 | - } | ||
| 91 | - }, | ||
| 92 | - (compDTO: CompDTO, compIndex: number) => compDTO.id + compIndex.toString() + this.pageModel.timestamp | ||
| 93 | - ) | ||
| 94 | - | ||
| 95 | - // 加载更多 | ||
| 96 | - ListItem() { | ||
| 97 | - if (this.pageModel.hasMore) { | ||
| 98 | - LoadMoreLayout({ | ||
| 99 | - refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage, | ||
| 100 | - this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight) | ||
| 101 | - }) | ||
| 102 | - } else { | ||
| 103 | - NoMoreLayout() | 93 | + }, |
| 94 | + (compDTO: CompDTO, compIndex: number) => compDTO.id + compIndex.toString() + this.pageModel.timestamp | ||
| 95 | + ) | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + if (this.name !== '视频') { | ||
| 99 | + // 加载更多 | ||
| 100 | + ListItem() { | ||
| 101 | + if (this.pageModel.hasMore) { | ||
| 102 | + LoadMoreLayout({ | ||
| 103 | + refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage, | ||
| 104 | + this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight) | ||
| 105 | + }) | ||
| 106 | + } else { | ||
| 107 | + NoMoreLayout() | ||
| 108 | + } | ||
| 104 | } | 109 | } |
| 105 | } | 110 | } |
| 111 | + | ||
| 106 | } | 112 | } |
| 107 | .scrollBar(BarState.Off) | 113 | .scrollBar(BarState.Off) |
| 108 | .cachedCount(8) | 114 | .cachedCount(8) |
| @@ -155,10 +161,105 @@ export struct PageComponent { | @@ -155,10 +161,105 @@ export struct PageComponent { | ||
| 155 | this.pageModel.viewType = ViewType.EMPTY; | 161 | this.pageModel.viewType = ViewType.EMPTY; |
| 156 | return; | 162 | return; |
| 157 | } | 163 | } |
| 164 | + if (this.navIndex === 0) { | ||
| 165 | + await this.getVideoListData(pageInfo); | ||
| 166 | + } else { | ||
| 167 | + await this.getLiveListData(pageInfo); | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + private async getVideoListData(pageInfo: PageInfoBean) { | ||
| 174 | + let groupInfo: GroupInfoDTO = CollectionUtils.getElement(pageInfo.groups, 0); | ||
| 175 | + if (groupInfo != null) { | ||
| 176 | + this.pageModel.isRecGroup = groupInfo.groupStrategy === 1; | ||
| 177 | + this.pageModel.groupId = groupInfo.id; | ||
| 178 | + } | ||
| 179 | + // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代 | ||
| 180 | + // for (const group of pageInfo.groups) { | ||
| 181 | + this.pageDto = await PageViewModel.getPageData(this.pageModel, getContext(this)); | ||
| 182 | + this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString(); | ||
| 183 | + if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) { | ||
| 184 | + this.pageDto.compList.forEach((comp) => { | ||
| 185 | + if (comp.compStyle === CompStyle.Zh_Grid_Layout_02 && this.liveReviewDTO && this.liveReviewDTO.list && this.liveReviewDTO.list.length > 0) { | ||
| 186 | + comp.operDataList.push(...this.liveReviewDTO.list); | ||
| 187 | + } | ||
| 188 | + }); | ||
| 189 | + | ||
| 190 | + this.pageModel.viewType = ViewType.LOADED; | ||
| 191 | + this.pageModel.compList.push(...this.pageDto.compList); | ||
| 192 | + if (this.pageDto.compList.length === this.pageModel.pageSize) { | ||
| 193 | + this.pageModel.currentPage++; | ||
| 194 | + this.pageModel.hasMore = true; | ||
| 195 | + } else { | ||
| 196 | + this.pageModel.hasMore = false; | ||
| 197 | + } | ||
| 198 | + // // 二次请求,批查互动数据 | ||
| 199 | + // PageViewModel.getInteractData(pageDto.compList).then((data: CompDTO[]) => { | ||
| 200 | + // // 刷新,替换所有数据 | ||
| 201 | + // this.pageModel.compList.replaceAll(...data) | ||
| 202 | + // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 203 | + // }) | ||
| 204 | + this.isFirstIn = false; | ||
| 205 | + Logger.debug(TAG, 'cj111'); | ||
| 206 | + // } else { | ||
| 207 | + // Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.'); | ||
| 208 | + // this.pageModel.viewType = ViewType.EMPTY; | ||
| 209 | + // } | ||
| 210 | + } | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + // private async getLiveListData(pageInfo: PageInfoBean) { | ||
| 214 | + // // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代 | ||
| 215 | + // for (const group of pageInfo.groups) { | ||
| 216 | + // this.pageDto = await PageViewModel.getPageData(this.pageModel, getContext(this)); | ||
| 217 | + // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString(); | ||
| 218 | + // if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) { | ||
| 219 | + // this.pageDto.compList.forEach((comp) => { | ||
| 220 | + // if (comp.compStyle === CompStyle.Zh_Grid_Layout_02 && this.liveReviewDTO && this.liveReviewDTO.list && this.liveReviewDTO.list.length > 0) { | ||
| 221 | + // comp.operDataList.push(...this.liveReviewDTO.list); | ||
| 222 | + // } | ||
| 223 | + // }); | ||
| 224 | + // | ||
| 225 | + // this.pageModel.viewType = ViewType.LOADED; | ||
| 226 | + // this.pageModel.compList.push(...this.pageDto.compList); | ||
| 227 | + // if (this.pageDto.compList.length === this.pageModel.pageSize) { | ||
| 228 | + // this.pageModel.currentPage++; | ||
| 229 | + // this.pageModel.hasMore = true; | ||
| 230 | + // } else { | ||
| 231 | + // this.pageModel.hasMore = false; | ||
| 232 | + // } | ||
| 233 | + // // // 二次请求,批查互动数据 | ||
| 234 | + // // PageViewModel.getInteractData(pageDto.compList).then((data: CompDTO[]) => { | ||
| 235 | + // // // 刷新,替换所有数据 | ||
| 236 | + // // this.pageModel.compList.replaceAll(...data) | ||
| 237 | + // // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 238 | + // // }) | ||
| 239 | + // this.isFirstIn = false; | ||
| 240 | + // Logger.debug(TAG, 'cj111'); | ||
| 241 | + // // } else { | ||
| 242 | + // // Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.'); | ||
| 243 | + // // this.pageModel.viewType = ViewType.EMPTY; | ||
| 244 | + // } | ||
| 245 | + // } | ||
| 246 | + // } | ||
| 247 | + | ||
| 248 | + async getLiveListData(pageInfo: PageInfoBean) { | ||
| 249 | + // Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`); | ||
| 250 | + // this.pageModel.pageId = this.pageId; | ||
| 251 | + // this.pageModel.groupId = this.pageId; | ||
| 252 | + // this.pageModel.channelId = this.channelId; | ||
| 253 | + // this.pageModel.currentPage = 1; | ||
| 254 | + // let pageInfo = await PageViewModel.getPageUrlData(this.pageModel.pageId); | ||
| 255 | + // if (pageInfo == null) { | ||
| 256 | + // this.pageModel.viewType = ViewType.EMPTY; | ||
| 257 | + // return; | ||
| 258 | + // } | ||
| 158 | Logger.debug(TAG, 'getPageUrlData ' + pageInfo.id); | 259 | Logger.debug(TAG, 'getPageUrlData ' + pageInfo.id); |
| 159 | // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代 | 260 | // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代 |
| 160 | for (const group of pageInfo.groups) { | 261 | for (const group of pageInfo.groups) { |
| 161 | - this.pageDto = await PageViewModel.getPageData(this.pageModel.pageId, `${group.id}`, this.pageModel.channelId | 262 | + this.pageDto = await PageViewModel.getLivePageData(this.pageModel.pageId, `${group.id}`, this.pageModel.channelId, group.groupStrategy |
| 162 | , this.pageModel.currentPage, this.pageModel.pageSize, getContext(this)) | 263 | , this.pageModel.currentPage, this.pageModel.pageSize, getContext(this)) |
| 163 | this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | 264 | this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() |
| 164 | if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) { | 265 | if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) { |
| @@ -176,50 +277,18 @@ export struct PageComponent { | @@ -176,50 +277,18 @@ export struct PageComponent { | ||
| 176 | } else { | 277 | } else { |
| 177 | this.pageModel.hasMore = false; | 278 | this.pageModel.hasMore = false; |
| 178 | } | 279 | } |
| 179 | - // // 二次请求,批查互动数据 | ||
| 180 | - // PageViewModel.getInteractData(pageDto.compList).then((data: CompDTO[]) => { | ||
| 181 | - // // 刷新,替换所有数据 | ||
| 182 | - // this.pageModel.compList.replaceAll(...data) | ||
| 183 | - // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 184 | - // }) | 280 | + // 二次请求,批查互动数据 |
| 281 | + PageViewModel.getInteractData(this.pageDto.compList).then((data: CompDTO[]) => { | ||
| 282 | + // 刷新,替换所有数据 | ||
| 283 | + this.pageModel.compList.replaceAll(...data) | ||
| 284 | + this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 285 | + }) | ||
| 185 | this.isFirstIn = false | 286 | this.isFirstIn = false |
| 186 | - Logger.debug(TAG, 'cj111'); | ||
| 187 | } else { | 287 | } else { |
| 188 | Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.'); | 288 | Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.'); |
| 189 | this.pageModel.viewType = ViewType.EMPTY; | 289 | this.pageModel.viewType = ViewType.EMPTY; |
| 190 | } | 290 | } |
| 191 | } | 291 | } |
| 192 | - | ||
| 193 | - // this.isFirstIn = false | ||
| 194 | - // let groupInfo: Group = CollectionUtils.getElement(pageInfo.groups, 0); | ||
| 195 | - // if (groupInfo != null) { | ||
| 196 | - // this.pageModel.groupStrategy = groupInfo.groupStrategy; | ||
| 197 | - // this.pageModel.isRecGroup = groupInfo.groupStrategy === 1; | ||
| 198 | - // this.pageModel.groupId = "" + groupInfo.id; | ||
| 199 | - // } | ||
| 200 | - // let pageDto = await PageViewModel.getPageData(this.pageModel.pageId, this.pageModel.pageId, this.pageModel.channelId | ||
| 201 | - // , this.pageModel.currentPage, this.pageModel.pageSize, getContext(this)) | ||
| 202 | - // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 203 | - // if (pageDto && pageDto.compList && pageDto.compList.length > 0) { | ||
| 204 | - // this.pageModel.viewType = ViewType.LOADED; | ||
| 205 | - // this.pageModel.compList.push(...pageDto.compList) | ||
| 206 | - // if (pageDto.compList.length === this.pageModel.pageSize) { | ||
| 207 | - // this.pageModel.currentPage++; | ||
| 208 | - // this.pageModel.hasMore = true; | ||
| 209 | - // } else { | ||
| 210 | - // this.pageModel.hasMore = false; | ||
| 211 | - // } | ||
| 212 | - // // 二次请求,批查互动数据 | ||
| 213 | - // PageViewModel.getInteractData(pageDto.compList).then((data: CompDTO[]) => { | ||
| 214 | - // // 刷新,替换所有数据 | ||
| 215 | - // this.pageModel.compList.replaceAll(...data) | ||
| 216 | - // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 217 | - // }) | ||
| 218 | - // } else { | ||
| 219 | - // Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.'); | ||
| 220 | - // this.pageModel.viewType = ViewType.EMPTY; | ||
| 221 | - // } | ||
| 222 | - | ||
| 223 | } | 292 | } |
| 224 | 293 | ||
| 225 | async getPreviewData() { | 294 | async getPreviewData() { |
| 1 | +import { SearchResultContentComponent } from './SearchResultContentComponent' | ||
| 1 | 2 | ||
| 2 | const TAG = "SearchResultComponent" | 3 | const TAG = "SearchResultComponent" |
| 3 | /** | 4 | /** |
| @@ -19,7 +20,7 @@ export struct SearchResultComponent{ | @@ -19,7 +20,7 @@ export struct SearchResultComponent{ | ||
| 19 | Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { | 20 | Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { |
| 20 | ForEach(this.count, (item: string, index: number ) => { | 21 | ForEach(this.count, (item: string, index: number ) => { |
| 21 | TabContent(){ | 22 | TabContent(){ |
| 22 | - Text(item) | 23 | + SearchResultContentComponent() |
| 23 | }.tabBar(this.TabBuilder(index,item)) | 24 | }.tabBar(this.TabBuilder(index,item)) |
| 24 | }, (item: string, index: number) => index.toString()) | 25 | }, (item: string, index: number) => index.toString()) |
| 25 | } | 26 | } |
| @@ -63,4 +64,5 @@ export struct SearchResultComponent{ | @@ -63,4 +64,5 @@ export struct SearchResultComponent{ | ||
| 63 | .margin({right:'9lpx'}) | 64 | .margin({right:'9lpx'}) |
| 64 | .padding({left:'31lpx',right:index === this.count.length-1?"31lpx":"0lpx"}) | 65 | .padding({left:'31lpx',right:index === this.count.length-1?"31lpx":"0lpx"}) |
| 65 | } | 66 | } |
| 67 | + | ||
| 66 | } | 68 | } |
| @@ -54,7 +54,6 @@ export struct BannerComponent { | @@ -54,7 +54,6 @@ export struct BannerComponent { | ||
| 54 | .cachedCount(2) | 54 | .cachedCount(2) |
| 55 | .index(1) // The default index of Swiper. | 55 | .index(1) // The default index of Swiper. |
| 56 | .autoPlay(true) | 56 | .autoPlay(true) |
| 57 | - .interval(DurationEnum.DURATION_4) | ||
| 58 | .indicator(Indicator.dot() | 57 | .indicator(Indicator.dot() |
| 59 | .right(5) | 58 | .right(5) |
| 60 | .itemWidth(4) | 59 | .itemWidth(4) |
| @@ -62,7 +61,6 @@ export struct BannerComponent { | @@ -62,7 +61,6 @@ export struct BannerComponent { | ||
| 62 | .selectedItemWidth(10) | 61 | .selectedItemWidth(10) |
| 63 | .selectedItemHeight(6)) | 62 | .selectedItemHeight(6)) |
| 64 | .loop(true) | 63 | .loop(true) |
| 65 | - .duration(DurationEnum.DURATION_4) | ||
| 66 | .vertical(false) | 64 | .vertical(false) |
| 67 | .curve(Curve.Linear) | 65 | .curve(Curve.Linear) |
| 68 | .onChange((index: number) => { | 66 | .onChange((index: number) => { |
| @@ -19,8 +19,10 @@ export struct BigPicCardComponent { | @@ -19,8 +19,10 @@ export struct BigPicCardComponent { | ||
| 19 | 19 | ||
| 20 | aboutToAppear() { | 20 | aboutToAppear() { |
| 21 | // 取第一个数据 | 21 | // 取第一个数据 |
| 22 | - this.contentDTO = this.compDTO.operDataList[0]; | ||
| 23 | - this.contentDTO.appStyle = "2"; | 22 | + if (this.compDTO.operDataList) { |
| 23 | + this.contentDTO = this.compDTO.operDataList[0]; | ||
| 24 | + this.contentDTO.appStyle = "2"; | ||
| 25 | + } | ||
| 24 | } | 26 | } |
| 25 | 27 | ||
| 26 | build() { | 28 | build() { |
| @@ -9,7 +9,6 @@ const TAG = 'LabelComponent'; | @@ -9,7 +9,6 @@ const TAG = 'LabelComponent'; | ||
| 9 | * Label-03 | 9 | * Label-03 |
| 10 | * 重磅推荐/精选/电视剧/电影/综艺/短剧/更多>/ | 10 | * 重磅推荐/精选/电视剧/电影/综艺/短剧/更多>/ |
| 11 | */ | 11 | */ |
| 12 | -@Entry | ||
| 13 | @Component | 12 | @Component |
| 14 | export struct LabelComponent { | 13 | export struct LabelComponent { |
| 15 | @State compDTO: CompDTO = {} as CompDTO | 14 | @State compDTO: CompDTO = {} as CompDTO |
| 1 | // 视频直播横划卡16:9 | 1 | // 视频直播横划卡16:9 |
| 2 | import { LiveVideoTypeComponent } from './LiveVideoTypeComponent' | 2 | import { LiveVideoTypeComponent } from './LiveVideoTypeComponent' |
| 3 | import { LiveHorizontalCardForOneComponent } from './LiveHorizontalCardForOneComponent' | 3 | import { LiveHorizontalCardForOneComponent } from './LiveHorizontalCardForOneComponent' |
| 4 | -import { CompDTO, ContentDTO } from 'wdBean' | 4 | +import { Action, CompDTO, ContentDTO, Params } from 'wdBean' |
| 5 | import { CommonConstants } from 'wdConstant' | 5 | import { CommonConstants } from 'wdConstant' |
| 6 | +import { WDRouterRule } from 'wdRouter/Index' | ||
| 6 | 7 | ||
| 7 | @Component | 8 | @Component |
| 8 | export struct LiveHorizontalCardComponent { | 9 | export struct LiveHorizontalCardComponent { |
| @@ -22,7 +23,7 @@ export struct LiveHorizontalCardComponent { | @@ -22,7 +23,7 @@ export struct LiveHorizontalCardComponent { | ||
| 22 | .fontWeight(600) | 23 | .fontWeight(600) |
| 23 | } | 24 | } |
| 24 | 25 | ||
| 25 | - if (this.compDTO.operDataList.length > 10) { | 26 | + if (this.compDTO.operDataList.length > 8) { |
| 26 | Row() { | 27 | Row() { |
| 27 | Text("更多") | 28 | Text("更多") |
| 28 | .fontSize($r("app.float.font_size_14")) | 29 | .fontSize($r("app.float.font_size_14")) |
| @@ -32,6 +33,15 @@ export struct LiveHorizontalCardComponent { | @@ -32,6 +33,15 @@ export struct LiveHorizontalCardComponent { | ||
| 32 | .width(14) | 33 | .width(14) |
| 33 | .height(14) | 34 | .height(14) |
| 34 | } | 35 | } |
| 36 | + .onClick(() => { | ||
| 37 | + let taskAction: Action = { | ||
| 38 | + type: 'JUMP_H5_BY_WEB_VIEW', | ||
| 39 | + params: { | ||
| 40 | + url: this.compDTO.linkUrl | ||
| 41 | + } as Params, | ||
| 42 | + }; | ||
| 43 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 44 | + }) | ||
| 35 | } | 45 | } |
| 36 | }.justifyContent(FlexAlign.SpaceBetween) | 46 | }.justifyContent(FlexAlign.SpaceBetween) |
| 37 | .padding({ left: 16, right: 16 }) | 47 | .padding({ left: 16, right: 16 }) |
| 1 | import { ContentDTO } from 'wdBean'; | 1 | import { ContentDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant'; | 2 | import { CommonConstants } from 'wdConstant'; |
| 3 | -import { Card3Component } from '../cardview/Card3Component' | ||
| 4 | -import { Card6Component } from '../cardview/Card6Component' | 3 | +import { CardParser } from '../CardParser'; |
| 5 | 4 | ||
| 6 | const RECOMMEND_LIST_TITLE = '相关推荐' | 5 | const RECOMMEND_LIST_TITLE = '相关推荐' |
| 7 | 6 | ||
| @@ -28,12 +27,13 @@ export struct RecommendList { | @@ -28,12 +27,13 @@ export struct RecommendList { | ||
| 28 | .width(CommonConstants.FULL_PARENT) | 27 | .width(CommonConstants.FULL_PARENT) |
| 29 | .justifyContent(FlexAlign.Start) | 28 | .justifyContent(FlexAlign.Start) |
| 30 | } | 29 | } |
| 31 | - ForEach(this.recommendList, (item: ContentDTO, index: number) => { | ||
| 32 | - if (item.coverUrl) { | ||
| 33 | - Card6Component({ contentDTO: item }) | ||
| 34 | - } else { | ||
| 35 | - Card3Component({ contentDTO: item }) | ||
| 36 | - } | 30 | + ForEach(this.recommendList, (item: ContentDTO) => { |
| 31 | + Row(){ | ||
| 32 | + CardParser({ contentDTO: item }); | ||
| 33 | + }.border({ | ||
| 34 | + width:{bottom: 1}, | ||
| 35 | + color: '#f5f5f5' | ||
| 36 | + }) | ||
| 37 | }, (item: ContentDTO) => JSON.stringify(item)) | 37 | }, (item: ContentDTO) => JSON.stringify(item)) |
| 38 | }.width('100%') | 38 | }.width('100%') |
| 39 | } | 39 | } |
| @@ -56,6 +56,9 @@ export struct ZhGridLayoutComponent { | @@ -56,6 +56,9 @@ export struct ZhGridLayoutComponent { | ||
| 56 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 56 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 57 | } | 57 | } |
| 58 | .width('100%') | 58 | .width('100%') |
| 59 | + .onClick((event: ClickEvent) => { | ||
| 60 | + ProcessUtils.processPage(item) | ||
| 61 | + }) | ||
| 59 | } | 62 | } |
| 60 | } | 63 | } |
| 61 | 64 |
| 1 | -import { Logger } from 'wdKit'; | ||
| 2 | import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel'; | 1 | import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel'; |
| 3 | -import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel'; | ||
| 4 | import { FirstLevelComponent } from './FirstLevelComponent'; | 2 | import { FirstLevelComponent } from './FirstLevelComponent'; |
| 5 | import { SecondLevelComponent } from './SecondLevelComponent'; | 3 | import { SecondLevelComponent } from './SecondLevelComponent'; |
| 6 | import { ThirdLevelComponent } from './ThirdLevelComponent'; | 4 | import { ThirdLevelComponent } from './ThirdLevelComponent'; |
| 7 | @CustomDialog | 5 | @CustomDialog |
| 6 | + | ||
| 8 | export struct AreaPickerDialog { | 7 | export struct AreaPickerDialog { |
| 9 | @Provide currentFirst: AreaListManageModel = new AreaListManageModel('','','',[]) | 8 | @Provide currentFirst: AreaListManageModel = new AreaListManageModel('','','',[]) |
| 10 | @Provide currentSecondBean: AreaListManageModel = new AreaListManageModel('','','',[]) | 9 | @Provide currentSecondBean: AreaListManageModel = new AreaListManageModel('','','',[]) |
| @@ -21,7 +21,23 @@ export class ContentConstants { | @@ -21,7 +21,23 @@ export class ContentConstants { | ||
| 21 | */ | 21 | */ |
| 22 | static readonly TYPE_TELETEXT: string = "8"; | 22 | static readonly TYPE_TELETEXT: string = "8"; |
| 23 | /** | 23 | /** |
| 24 | + * 9:图集 | ||
| 25 | + */ | ||
| 26 | + static readonly TYPE_NINE: string = "9"; | ||
| 27 | + /** | ||
| 24 | * 13:音频详情 | 28 | * 13:音频详情 |
| 25 | */ | 29 | */ |
| 26 | static readonly TYPE_AUDIO: string = "13"; | 30 | static readonly TYPE_AUDIO: string = "13"; |
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 14:动态图文 | ||
| 34 | + */ | ||
| 35 | + static readonly TYPE_FOURTEEN: string = "14"; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 15:动态视频 | ||
| 39 | + */ | ||
| 40 | + static readonly TYPE_FIFTEEN: string = "15"; | ||
| 41 | + | ||
| 42 | + | ||
| 27 | } | 43 | } |
| @@ -3,7 +3,7 @@ import MinePagePersonalFunctionsItem from '../viewmodel/MinePagePersonalFunction | @@ -3,7 +3,7 @@ import MinePagePersonalFunctionsItem from '../viewmodel/MinePagePersonalFunction | ||
| 3 | import MinePageCreatorFunctionsItem from '../viewmodel/MinePageCreatorFunctionsItem' | 3 | import MinePageCreatorFunctionsItem from '../viewmodel/MinePageCreatorFunctionsItem' |
| 4 | import MinePageMoreFunctionModel from '../viewmodel/MinePageMoreFunctionModel'; | 4 | import MinePageMoreFunctionModel from '../viewmodel/MinePageMoreFunctionModel'; |
| 5 | import HashMap from '@ohos.util.HashMap'; | 5 | import HashMap from '@ohos.util.HashMap'; |
| 6 | -import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | 6 | +import { HttpBizUtil, HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 7 | import { MineAppointmentListItem } from '../viewmodel/MineAppointmentListItem'; | 7 | import { MineAppointmentListItem } from '../viewmodel/MineAppointmentListItem'; |
| 8 | import { Logger, ResourcesUtils, StringUtils } from 'wdKit'; | 8 | import { Logger, ResourcesUtils, StringUtils } from 'wdKit'; |
| 9 | import { MineFollowListDetailItem } from '../viewmodel/MineFollowListDetailItem'; | 9 | import { MineFollowListDetailItem } from '../viewmodel/MineFollowListDetailItem'; |
| @@ -371,7 +371,8 @@ class MinePageDatasModel{ | @@ -371,7 +371,8 @@ class MinePageDatasModel{ | ||
| 371 | fetchMineUserLevelData() { | 371 | fetchMineUserLevelData() { |
| 372 | let url = HttpUrlUtils.getMineUserLevelDataUrl() | 372 | let url = HttpUrlUtils.getMineUserLevelDataUrl() |
| 373 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | 373 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); |
| 374 | - return WDHttp.get<ResponseDTO<MineUserLevelItem>>(url, headers) | 374 | + // return WDHttp.get<ResponseDTO<MineUserLevelItem>>(url, headers) |
| 375 | + return HttpBizUtil.get<MineUserLevelItem>(url, headers) | ||
| 375 | }; | 376 | }; |
| 376 | 377 | ||
| 377 | async getMineUserLevelDataLocal(context: Context): Promise<MineUserLevelItem> { | 378 | async getMineUserLevelDataLocal(context: Context): Promise<MineUserLevelItem> { |
| @@ -409,7 +410,8 @@ class MinePageDatasModel{ | @@ -409,7 +410,8 @@ class MinePageDatasModel{ | ||
| 409 | fetchMineUserDetailData() { | 410 | fetchMineUserDetailData() { |
| 410 | let url = HttpUrlUtils.getMineUserDetailDataUrl() | 411 | let url = HttpUrlUtils.getMineUserDetailDataUrl() |
| 411 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | 412 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); |
| 412 | - return WDHttp.get<ResponseDTO<MineUserDetailItem>>(url, headers) | 413 | + // return WDHttp.get<ResponseDTO<MineUserDetailItem>>(url, headers) |
| 414 | + return HttpBizUtil.get<MineUserDetailItem>(url, headers) | ||
| 413 | }; | 415 | }; |
| 414 | 416 | ||
| 415 | async getMineUserDetailDataLocal(context: Context): Promise<MineUserDetailItem> { | 417 | async getMineUserDetailDataLocal(context: Context): Promise<MineUserDetailItem> { |
| 1 | +import { ContentDTO } from 'wdBean/Index'; | ||
| 1 | 2 | ||
| 2 | // { | 3 | // { |
| 3 | // "hasNext": 0, | 4 | // "hasNext": 0, |
| @@ -22,24 +23,38 @@ export class MyCollectionModel{ | @@ -22,24 +23,38 @@ export class MyCollectionModel{ | ||
| 22 | } | 23 | } |
| 23 | } | 24 | } |
| 24 | 25 | ||
| 25 | -@Observed | ||
| 26 | -export class MyCollectionItem{ | 26 | +export class MyCollectionItem{ |
| 27 | pageNum:number = 0 | 27 | pageNum:number = 0 |
| 28 | pageSize:number = 0 | 28 | pageSize:number = 0 |
| 29 | totalCount:number = 0 | 29 | totalCount:number = 0 |
| 30 | hasNext:number = 0 | 30 | hasNext:number = 0 |
| 31 | - list:MyCollectionModel[] = [] | 31 | + list:ContentDTO[] = [] |
| 32 | + | ||
| 33 | + constructor(list?:ContentDTO[],pageNum?: number,pageSize?: number,totalCount?: number,hasNext?:number) { | ||
| 34 | + } | ||
| 32 | } | 35 | } |
| 33 | 36 | ||
| 37 | +export interface MyCollectionListModel{ | ||
| 38 | + data: MyCollectionItem | ||
| 39 | + code: number | ||
| 40 | + message: string | ||
| 41 | + success: string | ||
| 42 | + timestamp: number | ||
| 43 | +} | ||
| 34 | 44 | ||
| 35 | -export class MyCollectionListModel{ | ||
| 36 | - list:MyCollectionModel[] = [] | ||
| 37 | 45 | ||
| 38 | - pageNum: number = 0 | ||
| 39 | - pageSize: number = 20 | ||
| 40 | - totalCount: number = 0 | ||
| 41 | 46 | ||
| 42 | - constructor(list?:MyCollectionModel[],pageNum?: number,pageSize?: number,totalCount?: number) { | ||
| 43 | - } | 47 | +export interface contentListItemParams{ |
| 48 | + contentId?:string; | ||
| 49 | + contentType?:string; | ||
| 50 | + relType?:string; | ||
| 51 | + contentRelId?:string; | ||
| 44 | } | 52 | } |
| 45 | 53 | ||
| 54 | +export interface collcetRecordParams { | ||
| 55 | + delAll?: number; | ||
| 56 | + | ||
| 57 | + status?: number; | ||
| 58 | + | ||
| 59 | + contentList?: contentListItemParams[]; | ||
| 60 | +} |
| @@ -2,6 +2,7 @@ import router from '@ohos.router' | @@ -2,6 +2,7 @@ import router from '@ohos.router' | ||
| 2 | import { Params } from 'wdBean'; | 2 | import { Params } from 'wdBean'; |
| 3 | import { StringUtils } from 'wdKit'; | 3 | import { StringUtils } from 'wdKit'; |
| 4 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 4 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 5 | +import { CardParser } from '../components/CardParser'; | ||
| 5 | import { HomePageBottomComponent } from '../components/mine/home/HomePageBottomComponent'; | 6 | import { HomePageBottomComponent } from '../components/mine/home/HomePageBottomComponent'; |
| 6 | import MinePageDatasModel from '../model/MinePageDatasModel'; | 7 | import MinePageDatasModel from '../model/MinePageDatasModel'; |
| 7 | 8 | ||
| @@ -182,21 +183,46 @@ struct MineHomePage { | @@ -182,21 +183,46 @@ struct MineHomePage { | ||
| 182 | 183 | ||
| 183 | Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') | 184 | Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') |
| 184 | 185 | ||
| 185 | - //tab 页面 | ||
| 186 | - Tabs({controller: this.controller}) { | ||
| 187 | - TabContent() { | ||
| 188 | - HomePageBottomComponent({style:0}) | ||
| 189 | - }.tabBar(this.TabBuilder(0,"评论")) | ||
| 190 | - TabContent() { | ||
| 191 | - HomePageBottomComponent({style:1}) | ||
| 192 | - }.tabBar(this.TabBuilder(1,"关注")) | 186 | + Column(){ |
| 187 | + Column() { | ||
| 188 | + // 页签 | ||
| 189 | + Row({ space: 7 }) { | ||
| 190 | + Scroll() { | ||
| 191 | + Row() { | ||
| 192 | + this.TabBuilder(0,"评论") | ||
| 193 | + this.TabBuilder(1,"关注") | ||
| 194 | + } | ||
| 195 | + .justifyContent(FlexAlign.Start) | ||
| 196 | + } | ||
| 197 | + .align(Alignment.Start) | ||
| 198 | + .scrollable(ScrollDirection.Horizontal) | ||
| 199 | + .scrollBar(BarState.Off) | ||
| 200 | + .width('90%') | ||
| 201 | + .padding({left:'31lpx'}) | ||
| 202 | + } | ||
| 203 | + .alignItems(VerticalAlign.Bottom) | ||
| 204 | + .width('100%') | ||
| 205 | + } | ||
| 206 | + .alignItems(HorizontalAlign.Start) | ||
| 207 | + .width('100%') | ||
| 208 | + | ||
| 209 | + //tab 页面 | ||
| 210 | + Tabs({controller: this.controller}) { | ||
| 211 | + TabContent() { | ||
| 212 | + HomePageBottomComponent({style:0}) | ||
| 213 | + } | ||
| 214 | + TabContent() { | ||
| 215 | + HomePageBottomComponent({style:1}) | ||
| 216 | + } | ||
| 217 | + } | ||
| 218 | + .backgroundColor($r('app.color.white')) | ||
| 219 | + .animationDuration(0) | ||
| 220 | + .onChange((index: number) => { | ||
| 221 | + this.currentIndex = index | ||
| 222 | + }) | ||
| 223 | + .vertical(false) | ||
| 224 | + .barHeight(0) | ||
| 193 | } | 225 | } |
| 194 | - .backgroundColor($r('app.color.white')) | ||
| 195 | - .animationDuration(0) | ||
| 196 | - .onChange((index: number) => { | ||
| 197 | - this.currentIndex = index | ||
| 198 | - }) | ||
| 199 | - .vertical(false) | ||
| 200 | }.width("100%") | 226 | }.width("100%") |
| 201 | } | 227 | } |
| 202 | .edgeEffect(EdgeEffect.None) | 228 | .edgeEffect(EdgeEffect.None) |
| @@ -206,8 +232,8 @@ struct MineHomePage { | @@ -206,8 +232,8 @@ struct MineHomePage { | ||
| 206 | } | 232 | } |
| 207 | }.width('100%') | 233 | }.width('100%') |
| 208 | .layoutWeight(1) | 234 | .layoutWeight(1) |
| 209 | - | ||
| 210 | } | 235 | } |
| 236 | + | ||
| 211 | @Builder MineHomeTitleTransparent() { | 237 | @Builder MineHomeTitleTransparent() { |
| 212 | RelativeContainer() { | 238 | RelativeContainer() { |
| 213 | //标题栏目 | 239 | //标题栏目 |
| @@ -342,9 +368,9 @@ struct MineHomePage { | @@ -342,9 +368,9 @@ struct MineHomePage { | ||
| 342 | this.currentIndex = index | 368 | this.currentIndex = index |
| 343 | this.controller.changeIndex(this.currentIndex) | 369 | this.controller.changeIndex(this.currentIndex) |
| 344 | }) | 370 | }) |
| 345 | - .height('100%') | ||
| 346 | - .width('100%') | ||
| 347 | - .margin({right:'9lpx'}) | 371 | + .height('77lpx') |
| 372 | + .width('70lpx') | ||
| 373 | + .margin({right:'29lpx'}) | ||
| 348 | } | 374 | } |
| 349 | 375 | ||
| 350 | /** | 376 | /** |
| @@ -172,24 +172,51 @@ struct OtherNormalUserHomePage { | @@ -172,24 +172,51 @@ struct OtherNormalUserHomePage { | ||
| 172 | .width('100%') | 172 | .width('100%') |
| 173 | .backgroundColor($r('app.color.white')) | 173 | .backgroundColor($r('app.color.white')) |
| 174 | } | 174 | } |
| 175 | + | ||
| 175 | //间隔符 | 176 | //间隔符 |
| 176 | Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') | 177 | Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') |
| 177 | 178 | ||
| 178 | - //tab 页面 | ||
| 179 | - Tabs({controller: this.controller}) { | ||
| 180 | - TabContent() { | ||
| 181 | - OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum}) | ||
| 182 | - }.tabBar(this.TabBuilder(0,"评论")) | ||
| 183 | - TabContent() { | ||
| 184 | - OtherHomePageBottomFollowComponent({curUserId:this.curUserId}) | ||
| 185 | - }.tabBar(this.TabBuilder(1,"关注")) | 179 | + Column(){ |
| 180 | + Column() { | ||
| 181 | + // 页签 | ||
| 182 | + Row({ space: 7 }) { | ||
| 183 | + Scroll() { | ||
| 184 | + Row() { | ||
| 185 | + this.TabBuilder(0,"评论") | ||
| 186 | + this.TabBuilder(1,"关注") | ||
| 187 | + } | ||
| 188 | + .justifyContent(FlexAlign.Start) | ||
| 189 | + } | ||
| 190 | + .align(Alignment.Start) | ||
| 191 | + .scrollable(ScrollDirection.Horizontal) | ||
| 192 | + .scrollBar(BarState.Off) | ||
| 193 | + .width('90%') | ||
| 194 | + .padding({left:'31lpx'}) | ||
| 195 | + } | ||
| 196 | + .alignItems(VerticalAlign.Bottom) | ||
| 197 | + .width('100%') | ||
| 198 | + } | ||
| 199 | + .backgroundColor($r('app.color.white')) | ||
| 200 | + .alignItems(HorizontalAlign.Start) | ||
| 201 | + .width('100%') | ||
| 202 | + | ||
| 203 | + //tab 页面 | ||
| 204 | + Tabs({controller: this.controller}) { | ||
| 205 | + TabContent() { | ||
| 206 | + OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum}) | ||
| 207 | + } | ||
| 208 | + TabContent() { | ||
| 209 | + OtherHomePageBottomFollowComponent({curUserId:this.curUserId}) | ||
| 210 | + } | ||
| 211 | + } | ||
| 212 | + .backgroundColor($r('app.color.white')) | ||
| 213 | + .animationDuration(0) | ||
| 214 | + .onChange((index: number) => { | ||
| 215 | + this.currentIndex = index | ||
| 216 | + }) | ||
| 217 | + .vertical(false) | ||
| 218 | + .barHeight(0) | ||
| 186 | } | 219 | } |
| 187 | - .backgroundColor($r('app.color.white')) | ||
| 188 | - .animationDuration(0) | ||
| 189 | - .onChange((index: number) => { | ||
| 190 | - this.currentIndex = index | ||
| 191 | - }) | ||
| 192 | - .vertical(false) | ||
| 193 | }.width("100%") | 220 | }.width("100%") |
| 194 | } | 221 | } |
| 195 | .edgeEffect(EdgeEffect.None) | 222 | .edgeEffect(EdgeEffect.None) |
| @@ -300,9 +327,9 @@ struct OtherNormalUserHomePage { | @@ -300,9 +327,9 @@ struct OtherNormalUserHomePage { | ||
| 300 | this.currentIndex = index | 327 | this.currentIndex = index |
| 301 | this.controller.changeIndex(this.currentIndex) | 328 | this.controller.changeIndex(this.currentIndex) |
| 302 | }) | 329 | }) |
| 303 | - .height('100%') | ||
| 304 | - .width('100%') | ||
| 305 | - .margin({right:'9lpx'}) | 330 | + .height('77lpx') |
| 331 | + .width('70lpx') | ||
| 332 | + .margin({right:'29lpx'}) | ||
| 306 | } | 333 | } |
| 307 | 334 | ||
| 308 | 335 |
| @@ -15,6 +15,7 @@ import { | @@ -15,6 +15,7 @@ import { | ||
| 15 | NewspaperTimeInfoBean, | 15 | NewspaperTimeInfoBean, |
| 16 | PageDTO, | 16 | PageDTO, |
| 17 | PageInfoBean, | 17 | PageInfoBean, |
| 18 | + PageInfoDTO, | ||
| 18 | postBatchAttentionStatusParams, | 19 | postBatchAttentionStatusParams, |
| 19 | postBatchAttentionStatusResult, | 20 | postBatchAttentionStatusResult, |
| 20 | postExecuteCollectRecordParams, | 21 | postExecuteCollectRecordParams, |
| @@ -45,8 +46,15 @@ export class PageRepository { | @@ -45,8 +46,15 @@ export class PageRepository { | ||
| 45 | return url; | 46 | return url; |
| 46 | } | 47 | } |
| 47 | 48 | ||
| 48 | - static getCompInfoUrl(pageId: string, groupId: string, channelId: string, currentPage: number, pageSize: number) { | ||
| 49 | - let url = HttpUrlUtils.getHost() + HttpUrlUtils.COMP_PATH; | 49 | + static getCompInfoUrl(pageId: string, groupId: string, channelId: string, groupStrategy: number, currentPage: number, pageSize: number) { |
| 50 | + let url = HttpUrlUtils.getHost(); | ||
| 51 | + if (1 == groupStrategy) { | ||
| 52 | + //推荐 | ||
| 53 | + url = url + HttpUrlUtils.COMP_REC_PATH; | ||
| 54 | + } else { | ||
| 55 | + //非推荐 | ||
| 56 | + url = url + HttpUrlUtils.COMP_PATH; | ||
| 57 | + } | ||
| 50 | // TODO 暂定只请求第一页,后续对接分页加载,参数再调整 first_load? | 58 | // TODO 暂定只请求第一页,后续对接分页加载,参数再调整 first_load? |
| 51 | url = url + "?channelStrategy=2&loadStrategy=first_load" | 59 | url = url + "?channelStrategy=2&loadStrategy=first_load" |
| 52 | + "&districtCode=" + HttpUrlUtils.getDistrictCode() | 60 | + "&districtCode=" + HttpUrlUtils.getDistrictCode() |
| @@ -178,10 +186,22 @@ export class PageRepository { | @@ -178,10 +186,22 @@ export class PageRepository { | ||
| 178 | let url = PageRepository.getPageUrl(pageId) | 186 | let url = PageRepository.getPageUrl(pageId) |
| 179 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | 187 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); |
| 180 | return WDHttp.get<ResponseDTO<PageInfoBean>>(url, headers) | 188 | return WDHttp.get<ResponseDTO<PageInfoBean>>(url, headers) |
| 189 | + } | ||
| 190 | + | ||
| 191 | + static fetchPageData(pageId: string) { | ||
| 192 | + let url = PageRepository.getPageInfoUrl(pageId) | ||
| 193 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 194 | + return WDHttp.get<ResponseDTO<PageInfoDTO>>(url, headers) | ||
| 195 | + }; | ||
| 196 | + | ||
| 197 | + static fetchLivePageData(pageId: string, groupId: string, channelId: string, groupStrategy: number, currentPage: number, pageSize: number) { | ||
| 198 | + let url = PageRepository.getCompInfoUrl(pageId, groupId, channelId, groupStrategy, currentPage, pageSize) | ||
| 199 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 200 | + return WDHttp.get<ResponseDTO<PageDTO>>(url, headers) | ||
| 181 | }; | 201 | }; |
| 182 | 202 | ||
| 183 | - static fetchPageData(pageId: string, groupId: string, channelId: string, currentPage: number, pageSize: number) { | ||
| 184 | - let url = PageRepository.getCompInfoUrl(pageId, groupId, channelId, currentPage, pageSize) | 203 | + static fetchCompData(pageId: string, groupId: string, channelId: string, groupStrategy: number, currentPage: number, pageSize: number) { |
| 204 | + let url = PageRepository.getCompInfoUrl(pageId, groupId, channelId, groupStrategy, currentPage, pageSize) | ||
| 185 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | 205 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); |
| 186 | return WDHttp.get<ResponseDTO<PageDTO>>(url, headers) | 206 | return WDHttp.get<ResponseDTO<PageDTO>>(url, headers) |
| 187 | }; | 207 | }; |
| @@ -42,19 +42,71 @@ export class ProcessUtils { | @@ -42,19 +42,71 @@ export class ProcessUtils { | ||
| 42 | // 图文详情,跳转h5 | 42 | // 图文详情,跳转h5 |
| 43 | ProcessUtils.gotoWeb(content); | 43 | ProcessUtils.gotoWeb(content); |
| 44 | break; | 44 | break; |
| 45 | + //图集详情页 | ||
| 46 | + case ContentConstants.TYPE_NINE: | ||
| 47 | + ProcessUtils.gotoAtlasDetailPage(content); | ||
| 48 | + break; | ||
| 45 | case ContentConstants.TYPE_SPECIAL_TOPIC: | 49 | case ContentConstants.TYPE_SPECIAL_TOPIC: |
| 46 | // 专题详情,跳转h5 | 50 | // 专题详情,跳转h5 |
| 47 | ProcessUtils.gotoSpecialTopic(content); | 51 | ProcessUtils.gotoSpecialTopic(content); |
| 48 | break; | 52 | break; |
| 53 | + //动态详情页(动态图文) | ||
| 54 | + case ContentConstants.TYPE_FOURTEEN: | ||
| 55 | + //动态详情页(动态视频) | ||
| 56 | + case ContentConstants.TYPE_FIFTEEN: | ||
| 57 | + ProcessUtils.gotoDynamicDetailPage(content); | ||
| 58 | + break; | ||
| 49 | default: | 59 | default: |
| 50 | break; | 60 | break; |
| 51 | } | 61 | } |
| 52 | } | 62 | } |
| 63 | + | ||
| 64 | + /** | ||
| 65 | + * 动态详情页(动态视频/动态图片) | ||
| 66 | + * @param content | ||
| 67 | + * */ | ||
| 68 | + private static gotoDynamicDetailPage(content: ContentDTO) { | ||
| 69 | + let taskAction: Action = { | ||
| 70 | + type: 'JUMP_DETAIL_PAGE', | ||
| 71 | + params: { | ||
| 72 | + detailPageType: 14, | ||
| 73 | + contentID: content?.objectId, | ||
| 74 | + extra:{ | ||
| 75 | + relType: content?.relType, | ||
| 76 | + relId: content?.relId, | ||
| 77 | + } as ExtraDTO | ||
| 78 | + } as Params, | ||
| 79 | + }; | ||
| 80 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 81 | + Logger.debug(TAG, `gotoDynamicDetailPage, ${content.objectId}`); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * 图集详情页 | ||
| 86 | + * @param content | ||
| 87 | + * */ | ||
| 88 | + private static gotoAtlasDetailPage(content: ContentDTO) { | ||
| 89 | + let taskAction: Action = { | ||
| 90 | + type: 'JUMP_DETAIL_PAGE', | ||
| 91 | + params: { | ||
| 92 | + detailPageType: 17, | ||
| 93 | + contentID: content?.objectId, | ||
| 94 | + extra:{ | ||
| 95 | + relType: content?.relType, | ||
| 96 | + relId: content?.relId, | ||
| 97 | + } as ExtraDTO | ||
| 98 | + } as Params, | ||
| 99 | + }; | ||
| 100 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 101 | + Logger.debug(TAG, `gotoAtlasDetailPage, ${content.objectId}`); | ||
| 102 | + } | ||
| 103 | + | ||
| 53 | private static gotoSpecialTopic(content: ContentDTO) { | 104 | private static gotoSpecialTopic(content: ContentDTO) { |
| 54 | let taskAction: Action = { | 105 | let taskAction: Action = { |
| 55 | - type: 'JUMP_H5_BY_WEB_VIEW', | 106 | + type: 'JUMP_INNER_NEW_PAGE', |
| 56 | params: { | 107 | params: { |
| 57 | - url: content.linkUrl | 108 | + url: content.linkUrl, |
| 109 | + pageID: 'SPACIAL_TOPIC_PAGE', | ||
| 58 | } as Params, | 110 | } as Params, |
| 59 | }; | 111 | }; |
| 60 | WDRouterRule.jumpWithAction(taskAction) | 112 | WDRouterRule.jumpWithAction(taskAction) |
| @@ -71,8 +71,7 @@ export function touchUpPullRefresh(pageModel: PageModel) { | @@ -71,8 +71,7 @@ export function touchUpPullRefresh(pageModel: PageModel) { | ||
| 71 | pageModel.currentPage = 1; | 71 | pageModel.currentPage = 1; |
| 72 | setTimeout(() => { | 72 | setTimeout(() => { |
| 73 | let self: PageModel = pageModel; | 73 | let self: PageModel = pageModel; |
| 74 | - | ||
| 75 | - PageViewModel.getPageData(self.pageId, self.groupId, self.channelId, self.currentPage, self.pageSize, getContext()) | 74 | + PageViewModel.getPageData(self, getContext()) |
| 76 | .then((data: PageDTO) => { | 75 | .then((data: PageDTO) => { |
| 77 | self.timestamp = DateTimeUtils.getTimeStamp().toString() | 76 | self.timestamp = DateTimeUtils.getTimeStamp().toString() |
| 78 | if (data == null || data.compList == null || data.compList.length == 0) { | 77 | if (data == null || data.compList == null || data.compList.length == 0) { |
| @@ -28,7 +28,7 @@ export function touchUpLoadMore(model: PageModel) { | @@ -28,7 +28,7 @@ export function touchUpLoadMore(model: PageModel) { | ||
| 28 | self.isLoading = true; | 28 | self.isLoading = true; |
| 29 | setTimeout(() => { | 29 | setTimeout(() => { |
| 30 | closeLoadMore(model); | 30 | closeLoadMore(model); |
| 31 | - PageViewModel.getPageData(self.pageId, self.groupId, self.channelId, self.currentPage, self.pageSize, getContext()) | 31 | + PageViewModel.getPageData(self, getContext()) |
| 32 | .then((data: PageDTO) => { | 32 | .then((data: PageDTO) => { |
| 33 | self.timestamp = DateTimeUtils.getTimeStamp().toString() | 33 | self.timestamp = DateTimeUtils.getTimeStamp().toString() |
| 34 | if (data == null || data.compList == null || data.compList.length == 0) { | 34 | if (data == null || data.compList == null || data.compList.length == 0) { |
| @@ -11,22 +11,26 @@ export class LogoutViewModel{ | @@ -11,22 +11,26 @@ export class LogoutViewModel{ | ||
| 11 | requestLogout(){ | 11 | requestLogout(){ |
| 12 | return new Promise<string>((success, fail) => { | 12 | return new Promise<string>((success, fail) => { |
| 13 | this.logout.requestLogout().then((data) => { | 13 | this.logout.requestLogout().then((data) => { |
| 14 | - SPHelper.default.save(SpConstants.USER_FIRST_MARK, '') | ||
| 15 | - SPHelper.default.save(SpConstants.USER_ID, '') | ||
| 16 | - SPHelper.default.save(SpConstants.USER_JWT_TOKEN, '') | ||
| 17 | - SPHelper.default.save(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, '') | ||
| 18 | - SPHelper.default.save(SpConstants.USER_REFRESH_TOKEN, '') | ||
| 19 | - SPHelper.default.save(SpConstants.USER_STATUS, '') | ||
| 20 | - SPHelper.default.save(SpConstants.USER_Type, '') | ||
| 21 | - SPHelper.default.save(SpConstants.USER_NAME, '') | ||
| 22 | - SPHelper.default.save(SpConstants.USER_PHONE, '') | ||
| 23 | - HttpUrlUtils.setUserId("") | ||
| 24 | - HttpUrlUtils.setUserType("") | ||
| 25 | - HttpUrlUtils.setUserToken('') | 14 | + LogoutViewModel.clearLoginInfo() |
| 26 | success(data) | 15 | success(data) |
| 27 | }).catch((message: string) => { | 16 | }).catch((message: string) => { |
| 28 | fail(message) | 17 | fail(message) |
| 29 | }) | 18 | }) |
| 30 | }) | 19 | }) |
| 31 | } | 20 | } |
| 21 | + | ||
| 22 | + static clearLoginInfo() { | ||
| 23 | + SPHelper.default.save(SpConstants.USER_FIRST_MARK, '') | ||
| 24 | + SPHelper.default.save(SpConstants.USER_ID, '') | ||
| 25 | + SPHelper.default.save(SpConstants.USER_JWT_TOKEN, '') | ||
| 26 | + SPHelper.default.save(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, '') | ||
| 27 | + SPHelper.default.save(SpConstants.USER_REFRESH_TOKEN, '') | ||
| 28 | + SPHelper.default.save(SpConstants.USER_STATUS, '') | ||
| 29 | + SPHelper.default.save(SpConstants.USER_Type, '') | ||
| 30 | + SPHelper.default.save(SpConstants.USER_NAME, '') | ||
| 31 | + SPHelper.default.save(SpConstants.USER_PHONE, '') | ||
| 32 | + HttpUrlUtils.setUserId("") | ||
| 33 | + HttpUrlUtils.setUserType("") | ||
| 34 | + HttpUrlUtils.setUserToken('') | ||
| 35 | + } | ||
| 32 | } | 36 | } |
| 1 | -import { MyCollectionListModel } from '../model/MyCollectionModel'; | 1 | +import { collcetRecordParams, MyCollectionItem, MyCollectionListModel } from '../model/MyCollectionModel'; |
| 2 | import HashMap from '@ohos.util.HashMap'; | 2 | import HashMap from '@ohos.util.HashMap'; |
| 3 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | 3 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 4 | import { Logger, ResourcesUtils } from 'wdKit'; | 4 | import { Logger, ResourcesUtils } from 'wdKit'; |
| 5 | import { PageDTO } from 'wdBean'; | 5 | import { PageDTO } from 'wdBean'; |
| 6 | +import promptAction from '@ohos.promptAction'; | ||
| 6 | 7 | ||
| 7 | const TAG = "MyCollectionViewModel" | 8 | const TAG = "MyCollectionViewModel" |
| 8 | 9 | ||
| 9 | class MyCollectionViewModel { | 10 | class MyCollectionViewModel { |
| 10 | private static instance:MyCollectionViewModel | 11 | private static instance:MyCollectionViewModel |
| 11 | - | ||
| 12 | /** | 12 | /** |
| 13 | * 单例模式 | 13 | * 单例模式 |
| 14 | * @returns | 14 | * @returns |
| @@ -20,84 +20,48 @@ class MyCollectionViewModel { | @@ -20,84 +20,48 @@ class MyCollectionViewModel { | ||
| 20 | return MyCollectionViewModel.instance; | 20 | return MyCollectionViewModel.instance; |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | - BaseGetRequest(type:number,tagId:string,pageNum:string){ | ||
| 24 | - let url = HttpUrlUtils.getMyCollectionListDataUrl()+ `?type=${type}&operateTag=${1}&pageSize=${20}&pageNum=${pageNum}` | ||
| 25 | - if (tagId.length > 0) { | ||
| 26 | - url = url + `&tagId=${tagId}` | ||
| 27 | - } | 23 | + //Type 1 收藏 2 浏览历史 |
| 24 | + //tagId 收藏界面 标签筛选 | ||
| 25 | + BaseGetRequest(type:number,tagId:string,pageNum:number){ | ||
| 26 | + let url = HttpUrlUtils.getMyCollectionListDataUrl()+ `?type=${type}&operateTag=${2}&pageSize=${20}&pageNum=${pageNum.toString()}` | ||
| 27 | + // if (tagId.length > 0) { | ||
| 28 | + // url = url + `&tagId=${tagId}` | ||
| 29 | + // } | ||
| 28 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders() | 30 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders() |
| 29 | - return WDHttp.get<ResponseDTO<MyCollectionListModel>>(url, headers) | 31 | + return WDHttp.get<MyCollectionListModel>(url, headers) |
| 30 | } | 32 | } |
| 31 | 33 | ||
| 32 | - async getAppointmentListDataLocal(context: Context): Promise<MyCollectionListModel> { | ||
| 33 | - Logger.info(TAG, `getBottomNavDataMock start`); | ||
| 34 | - let compRes: ResponseDTO<MyCollectionListModel> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MyCollectionListModel>>(context,'browsingHistory_list_data.json' ); | ||
| 35 | - if (!compRes || !compRes.data) { | ||
| 36 | - Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`); | ||
| 37 | - return new MyCollectionListModel() | ||
| 38 | - } | ||
| 39 | - Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 40 | - return compRes.data | ||
| 41 | - } | ||
| 42 | 34 | ||
| 43 | - //Type 1 收藏 2 浏览历史 | ||
| 44 | - //tagId 收藏界面 标签筛选 | ||
| 45 | - fetchMyCollectList(type:number,tagId:string,pageNum:string,context: Context):Promise<MyCollectionListModel>{ | ||
| 46 | - return new Promise<MyCollectionListModel>((success,error) => { | ||
| 47 | - this.BaseGetRequest(type,tagId,pageNum).then((navResDTO: ResponseDTO<MyCollectionListModel>) => { | 35 | + fetchMyCollectList(type:number,tagId:string,pageNum:number,context: Context):Promise<MyCollectionItem>{ |
| 36 | + return new Promise((success,error) => { | ||
| 37 | + this.BaseGetRequest(type,tagId,pageNum).then((navResDTO: MyCollectionListModel) => { | ||
| 48 | if (!navResDTO || navResDTO.code != 0) { | 38 | if (!navResDTO || navResDTO.code != 0) { |
| 49 | - success(this.getAppointmentListDataLocal(context)) | ||
| 50 | return | 39 | return |
| 51 | } | 40 | } |
| 52 | - Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | ||
| 53 | - let listData = navResDTO.data as MyCollectionListModel | ||
| 54 | - success(listData) | 41 | + Logger.info(TAG, "fetchMyCollectList then,navResDTO.timeStamp:" + navResDTO.timestamp); |
| 42 | + success(navResDTO.data) | ||
| 55 | }).catch((err: Error) => { | 43 | }).catch((err: Error) => { |
| 56 | - Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | 44 | + Logger.error(TAG, `fetchMyCollectList catch, error.name : ${err.name}, error.message:${err.message}`); |
| 57 | error("page data invalid"); | 45 | error("page data invalid"); |
| 58 | }) | 46 | }) |
| 59 | }) | 47 | }) |
| 60 | } | 48 | } |
| 61 | 49 | ||
| 62 | - | ||
| 63 | - newBaseGetRequest(type:number,tagId:string,pageNum:number){ | ||
| 64 | - let url = HttpUrlUtils.getMyCollectionListDataUrl()+ `?type=${type}&operateTag=${1}&pageSize=${20}&pageNum=${pageNum.toString()}` | ||
| 65 | - if (tagId.length > 0) { | ||
| 66 | - url = url + `&tagId=${tagId}` | ||
| 67 | - } | ||
| 68 | - let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders() | ||
| 69 | - return WDHttp.get<ResponseDTO<PageDTO>>(url, headers) | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - newFetchMyCollectList(type:number,tagId:string,pageNum:number,context: Context):Promise<PageDTO>{ | ||
| 73 | - return new Promise<PageDTO>((success,error) => { | ||
| 74 | - success(this.newGetAppointmentListDataLocal(type,context)) | ||
| 75 | - return | ||
| 76 | - this.newBaseGetRequest(type,tagId,pageNum).then((navResDTO: ResponseDTO<PageDTO>) => { | ||
| 77 | - if (!navResDTO || navResDTO.code != 0) { | ||
| 78 | - success(this.newGetAppointmentListDataLocal(type,context)) | ||
| 79 | - return | 50 | + //收藏/取消收藏 status :收藏状态 1添加收藏 0取消收藏 |
| 51 | + executeCollcet(params: collcetRecordParams):Promise<ResponseDTO>{ | ||
| 52 | + return new Promise(() => { | ||
| 53 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders() | ||
| 54 | + WDHttp.post<ResponseDTO>(HttpUrlUtils.getExecuteCollcetUrl(),params,headers).then((navResDTO: ResponseDTO) => { | ||
| 55 | + if (navResDTO.code == 0) { | ||
| 56 | + promptAction.showToast({ message: '删除成功' }) | ||
| 80 | } | 57 | } |
| 81 | - Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | ||
| 82 | - let listData = navResDTO.data as PageDTO | ||
| 83 | - success(listData) | ||
| 84 | - }).catch((err: Error) => { | ||
| 85 | - Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 86 | - error("page data invalid"); | ||
| 87 | }) | 58 | }) |
| 59 | + .catch((error: Error) => { | ||
| 60 | + Logger.info(TAG,'executeCollcet','ResponseDTO') | ||
| 61 | + }) | ||
| 88 | }) | 62 | }) |
| 89 | } | 63 | } |
| 90 | 64 | ||
| 91 | - async newGetAppointmentListDataLocal(type:number, context: Context): Promise<PageDTO> { | ||
| 92 | - Logger.info(TAG, `getBottomNavDataMock start`); | ||
| 93 | - let compRes: ResponseDTO<PageDTO> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>(context,type == 1?'MyCollection_list_data.json':'browsingHistory_list_data.json'); | ||
| 94 | - if (!compRes || !compRes.data) { | ||
| 95 | - Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`); | ||
| 96 | - return {} as PageDTO | ||
| 97 | - } | ||
| 98 | - Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 99 | - return compRes.data | ||
| 100 | - } | ||
| 101 | } | 65 | } |
| 102 | 66 | ||
| 103 | const collectionViewModel = MyCollectionViewModel.getInstance(); | 67 | const collectionViewModel = MyCollectionViewModel.getInstance(); |
| @@ -8,6 +8,7 @@ export default class PageModel { | @@ -8,6 +8,7 @@ export default class PageModel { | ||
| 8 | pageId: string = ""; | 8 | pageId: string = ""; |
| 9 | groupId: string = ""; | 9 | groupId: string = ""; |
| 10 | channelId: string = ""; | 10 | channelId: string = ""; |
| 11 | + isRecGroup: boolean = false; | ||
| 11 | compList: LazyDataSource<CompDTO> = new LazyDataSource(); | 12 | compList: LazyDataSource<CompDTO> = new LazyDataSource(); |
| 12 | // 页面状态,刷新、加载更多等 | 13 | // 页面状态,刷新、加载更多等 |
| 13 | currentPage: number = 1; | 14 | currentPage: number = 1; |
| @@ -35,5 +36,4 @@ export default class PageModel { | @@ -35,5 +36,4 @@ export default class PageModel { | ||
| 35 | // keyGenerator相关字符串,用于刷新list布局 | 36 | // keyGenerator相关字符串,用于刷新list布局 |
| 36 | timestamp: String = '1'; | 37 | timestamp: String = '1'; |
| 37 | groupStrategy: number = 0; | 38 | groupStrategy: number = 0; |
| 38 | - isRecGroup: boolean = false; | ||
| 39 | } | 39 | } |
| @@ -14,6 +14,7 @@ import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit'; | @@ -14,6 +14,7 @@ import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit'; | ||
| 14 | import { ResponseDTO, } from 'wdNetwork'; | 14 | import { ResponseDTO, } from 'wdNetwork'; |
| 15 | import { PageRepository } from '../repository/PageRepository'; | 15 | import { PageRepository } from '../repository/PageRepository'; |
| 16 | import { BaseViewModel } from './BaseViewModel'; | 16 | import { BaseViewModel } from './BaseViewModel'; |
| 17 | +import PageModel from './PageModel'; | ||
| 17 | 18 | ||
| 18 | const TAG = 'PageViewModel'; | 19 | const TAG = 'PageViewModel'; |
| 19 | /** | 20 | /** |
| @@ -140,14 +141,43 @@ export class PageViewModel extends BaseViewModel { | @@ -140,14 +141,43 @@ export class PageViewModel extends BaseViewModel { | ||
| 140 | return compRes.data | 141 | return compRes.data |
| 141 | } | 142 | } |
| 142 | 143 | ||
| 143 | - async getPageData(pageId: string, groupId: string, channelId: string, currentPage: number | 144 | + async getPageData(pageModel: PageModel, context?: Context): Promise<PageDTO> { |
| 145 | + Logger.debug(TAG, 'getPageData pageId: ' + pageModel.pageId); | ||
| 146 | + return this.parseComp(PageRepository.fetchCompData(pageModel.pageId, pageModel.groupId, pageModel.channelId, pageModel.isRecGroup == true ? 1 : 0, pageModel.currentPage, pageModel.pageSize)) | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + async getLivePageData(pageId: string, groupId: string, channelId: string, groupStrategy: number, currentPage: number | ||
| 144 | , pageSize: number, context: Context): Promise<PageDTO> { | 150 | , pageSize: number, context: Context): Promise<PageDTO> { |
| 145 | Logger.debug(TAG, 'getPageData pageId: ' + pageId); | 151 | Logger.debug(TAG, 'getPageData pageId: ' + pageId); |
| 146 | if (mock_switch) { | 152 | if (mock_switch) { |
| 147 | return this.getPageData1(currentPage, context); | 153 | return this.getPageData1(currentPage, context); |
| 148 | } | 154 | } |
| 149 | return new Promise<PageDTO>((success, error) => { | 155 | return new Promise<PageDTO>((success, error) => { |
| 150 | - PageRepository.fetchPageData(pageId, groupId, channelId, currentPage, pageSize) | 156 | + PageRepository.fetchLivePageData(pageId, groupId, channelId, groupStrategy, currentPage, pageSize) |
| 157 | + .then((resDTO: ResponseDTO<PageDTO>) => { | ||
| 158 | + if (!resDTO || !resDTO.data) { | ||
| 159 | + Logger.error(TAG, 'getNavData then resDTO is empty'); | ||
| 160 | + error('resDTO is empty'); | ||
| 161 | + return | ||
| 162 | + } | ||
| 163 | + if (resDTO.code != 0) { | ||
| 164 | + Logger.error(TAG, `getNavData then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 165 | + error('resDTO Response Code is failure'); | ||
| 166 | + return | ||
| 167 | + } | ||
| 168 | + Logger.info(TAG, "getNavData then,resDTO.timestamp:" + resDTO.timestamp); | ||
| 169 | + success(resDTO.data); | ||
| 170 | + }) | ||
| 171 | + .catch((err: Error) => { | ||
| 172 | + Logger.error(TAG, `getPageData catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 173 | + error(err); | ||
| 174 | + }) | ||
| 175 | + }) | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + private parseComp(getData: Promise<ResponseDTO<PageDTO>>): Promise<PageDTO> { | ||
| 179 | + return new Promise<PageDTO>((success, error) => { | ||
| 180 | + getData | ||
| 151 | .then((resDTO: ResponseDTO<PageDTO>) => { | 181 | .then((resDTO: ResponseDTO<PageDTO>) => { |
| 152 | if (!resDTO || !resDTO.data) { | 182 | if (!resDTO || !resDTO.data) { |
| 153 | Logger.error(TAG, 'getNavData then resDTO is empty'); | 183 | Logger.error(TAG, 'getNavData then resDTO is empty'); |
2.45 KB
2.95 KB
sight_harmony/features/wdComponent/src/main/resources/base/media/WDInput_keyboardImage.png
0 → 100644
776 Bytes
1.26 KB
sight_harmony/features/wdComponent/src/main/resources/base/media/WDInput_selectImageDelete.png
0 → 100644
1.42 KB
2.8 KB
1.02 KB
244 Bytes
sight_harmony/features/wdComponent/src/main/resources/base/media/comment_hyphen_block.png
0 → 100644
242 Bytes
-
Please register or login to post a comment