douaojie

Merge remote-tracking branch 'origin/main'

Showing 67 changed files with 2938 additions and 701 deletions

Too many changes to show.

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

@@ -11,8 +11,13 @@ export class SpConstants{ @@ -11,8 +11,13 @@ export class SpConstants{
11 static USER_TEMP_TOKEN="tempToken" 11 static USER_TEMP_TOKEN="tempToken"
12 static USER_PHONE = "user_phone" 12 static USER_PHONE = "user_phone"
13 //协议相关 13 //协议相关
14 - static USER_PROTOCOL = "user_protocol" //用户协议  
15 - static PRIVATE_PROTOCOL = "private_protocol" //隐私协议 14 + static NET_SERVICE_PROTOCOL = "user_protocol" //人民日报客户端网络服务使用协议
  15 + static PRIVATE_PROTOCOL = "private_protocol" //人民日报客户端用户隐私协议
  16 + static LOGOUT_PROTOCOL = "logout_protocol" //人民日报客户端app注销协议
  17 + static MESSAGE_BOARD_USER_PROTOCOL = "message_board_user_protocol" //"留言板-用户协议"
  18 + static MESSAGE_BOARD_NOTICE_PROTOCOL = "message_board_notice_protocol" //留言板-留言须知
  19 + static MESSAGE_BOARD_QUESTION_PROTOCOL = "message_board_question_protocol" //"留言板-发布提问规定""
  20 + static MESSAGE_BOARD_PRIVATE_PROTOCOL = "message_board_private_protocol" //"留言板-隐私政策"
16 //设置页面 21 //设置页面
17 static SETTING_WIFI_IMAGE_SWITCH = "setting_wifi_switch" //wifi 图片开关 22 static SETTING_WIFI_IMAGE_SWITCH = "setting_wifi_switch" //wifi 图片开关
18 static SETTING_WIFI_VIDEO_SWITCH = "setting_wifi_switch" //wifi 视频开关 23 static SETTING_WIFI_VIDEO_SWITCH = "setting_wifi_switch" //wifi 视频开关
  1 +/**
  2 + * https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-window-0000001820880785#ZH-CN_TOPIC_0000001811317218__systembarproperties
  3 + * 状态栏、导航栏的属性。
  4 + */
  5 +
  6 +/**
  7 + * 状态栏背景颜色 statusBarColor
  8 + * 导航栏背景颜色 navigationBarColor
  9 + */
  10 +export const enum SysStatusBarColor {
  11 + WHITE = '#ffffff',
  12 + BLACK = '#000000',
  13 + DEFAULT = '#0x66000000'
  14 +}
  15 +
  16 +
  17 +/**
  18 + * 状态栏文字颜色 statusBarContentColor8
  19 + * 导航栏文字颜色 navigationBarContentColor8
  20 + */
  21 +export const enum SysBarContentColor {
  22 + WHITE = '#ffffff',
  23 + BLACK = '#000000',
  24 + DEFAULT = '0xE5FFFFFF'
  25 +}
  26 +
  27 +
  28 +
1 import { Action } from './Action'; 1 import { Action } from './Action';
2 - 2 +interface dataObject {
  3 + webViewHeight?: string
  4 + dataJson?: string
  5 +}
3 /** 6 /**
4 * 消息Message 7 * 消息Message
5 */ 8 */
@@ -7,7 +10,7 @@ export class Message { @@ -7,7 +10,7 @@ export class Message {
7 callbackId: string = ""; //callbackId 10 callbackId: string = ""; //callbackId
8 responseId: string = ""; //responseId 11 responseId: string = ""; //responseId
9 responseData: string = ""; //responseData 12 responseData: string = ""; //responseData
10 - data?: object; //data of message 13 + data?: dataObject; //data of message
11 handlerName: string = ""; //name of handler 14 handlerName: string = ""; //name of handler
12 15
13 /** 16 /**
@@ -36,6 +36,10 @@ export { UserDataLocal } from './src/main/ets/utils/UserDataLocal' @@ -36,6 +36,10 @@ export { UserDataLocal } from './src/main/ets/utils/UserDataLocal'
36 36
37 export { NumberFormatterUtils } from './src/main/ets/utils/NumberFormatterUtils' 37 export { NumberFormatterUtils } from './src/main/ets/utils/NumberFormatterUtils'
38 38
39 -// export { PermissionUtils } from './src/main/ets/utils/PermissionUtils' 39 +export { PermissionUtils } from './src/main/ets/utils/PermissionUtils'
40 40
41 -export { ErrorToastUtils } from './src/main/ets/utils/ErrorToastUtils'  
  41 +export { ErrorToastUtils } from './src/main/ets/utils/ErrorToastUtils'
  42 +
  43 +export { EmitterUtils } from './src/main/ets/utils/EmitterUtils'
  44 +
  45 +export { EmitterEventId } from './src/main/ets/utils/EmitterEventId'
@@ -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 +/**
  2 + * 线程间通信事件id枚举
  3 + */
  4 +export enum EmitterEventId {
  5 + // 通知登出,事件id
  6 + FORCE_USER_LOGIN_OUT = 1
  7 +}
  8 +
  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 +}
1 -// import { abilityAccessCtrl, bundleManager, common, Permissions, Want } from '@kit.AbilityKit'  
2 -// import { BusinessError } from '@kit.BasicServicesKit'  
3 -// import { AppUtils } from './AppUtils'  
4 -// import { Logger } from './Logger'  
5 -//  
6 -// /**  
7 -// * 权限工具类  
8 -// * */  
9 -// export class PermissionUtils {  
10 -// //相机权限  
11 -// static CAMERA: Permissions = 'ohos.permission.CAMERA'  
12 -// //文件权限  
13 -// static READ_MEDIA: Permissions = 'ohos.permission.READ_MEDIA'  
14 -// static WRITE_MEDIA: Permissions = 'ohos.permission.WRITE_MEDIA'  
15 -// private static tokenId: number = 0  
16 -//  
17 -// /**检查权限是否授权*/  
18 -// static async checkPermissions(permission: Permissions): Promise<boolean> {  
19 -// let hasPermissions = false;  
20 -// let grantStatus: abilityAccessCtrl.GrantStatus = await PermissionUtils.checkAccessToken(permission);  
21 -//  
22 -// if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {  
23 -// // 已经授权,可以继续访问目标操作  
24 -// hasPermissions = true;  
25 -// } else {  
26 -// hasPermissions = false;  
27 -// // 申请日历权限  
28 -// }  
29 -// return hasPermissions;  
30 -// }  
31 -//  
32 -// /**动态申请权限*/  
33 -// static reqPermissionsFromUser(permissions: Array<Permissions>, component: Object): Promise<boolean> {  
34 -//  
35 -// return new Promise((resolve, fail) => {  
36 -// let context = getContext(component) as common.UIAbilityContext;  
37 -// let atManager = abilityAccessCtrl.createAtManager();  
38 -// atManager.requestPermissionsFromUser(context, permissions).then((data) => {  
39 -// let grantStatus: Array<number> = data.authResults;  
40 -// let length: number = grantStatus.length;  
41 -//  
42 -// for (let i = 0; i < length; i++) {  
43 -// if (grantStatus[i] === 0) {  
44 -// // 用户授权,可以继续访问目标操作  
45 -// resolve(true);  
46 -// } else {  
47 -// resolve(false)  
48 -// }  
49 -// }  
50 -// }).catch((err: Error) => {  
51 -// fail(err)  
52 -// })  
53 -// });  
54 -// }  
55 -//  
56 -// /**跳转设置页面*/  
57 -// static openPermissionsInSystemSettings(context: Object): void {  
58 -// let uiContext = getContext(context) as common.UIAbilityContext;  
59 -// let wantInfo: Want = {  
60 -// bundleName: 'com.huawei.hmos.settings',  
61 -// abilityName: 'com.huawei.hmos.settings.MainAbility',  
62 -// uri: 'application_info_entry',  
63 -// parameters: {  
64 -// pushParams: AppUtils.getPackageName(uiContext) // 打开指定应用的设置页面  
65 -// }  
66 -// }  
67 -// uiContext.startAbility(wantInfo)  
68 -// }  
69 -//  
70 -// private static async checkAccessToken(permission: Permissions): Promise<abilityAccessCtrl.GrantStatus> {  
71 -// let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();  
72 -// let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED;  
73 -//  
74 -// // 获取应用程序的accessTokenID  
75 -// if (PermissionUtils.tokenId == 0) {  
76 -// try {  
77 -// let bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);  
78 -// let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo;  
79 -// PermissionUtils.tokenId = appInfo.accessTokenId;  
80 -// } catch (error) {  
81 -// const err: BusinessError = error as BusinessError;  
82 -// }  
83 -// }  
84 -// // 校验应用是否被授予权限  
85 -// try {  
86 -// grantStatus = await atManager.checkAccessToken(PermissionUtils.tokenId, permission);  
87 -// } catch (error) {  
88 -// const err: BusinessError = error as BusinessError;  
89 -// }  
90 -//  
91 -// return grantStatus;  
92 -// }  
93 -//  
94 -// }  
  1 +import { abilityAccessCtrl, bundleManager, common, Permissions, Want } from '@kit.AbilityKit'
  2 +import { BusinessError } from '@kit.BasicServicesKit'
  3 +import { AppUtils } from './AppUtils'
  4 +import { Logger } from './Logger'
  5 +
  6 +/**
  7 + * 权限工具类
  8 + * */
  9 +export class PermissionUtils {
  10 + //相机权限
  11 + static CAMERA: Permissions = 'ohos.permission.CAMERA'
  12 + //文件权限
  13 + static READ_MEDIA: Permissions = 'ohos.permission.READ_MEDIA'
  14 + static WRITE_MEDIA: Permissions = 'ohos.permission.WRITE_MEDIA'
  15 + private static tokenId: number = 0
  16 +
  17 + /**检查权限是否授权*/
  18 + static async checkPermissions(permission: Permissions): Promise<boolean> {
  19 + let hasPermissions = false;
  20 + let grantStatus: abilityAccessCtrl.GrantStatus = await PermissionUtils.checkAccessToken(permission);
  21 +
  22 + if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {
  23 + // 已经授权,可以继续访问目标操作
  24 + hasPermissions = true;
  25 + } else {
  26 + hasPermissions = false;
  27 + // 申请日历权限
  28 + }
  29 + return hasPermissions;
  30 + }
  31 +
  32 + /**动态申请权限*/
  33 + static reqPermissionsFromUser(permissions: Array<Permissions>, component: Object): Promise<boolean> {
  34 +
  35 + return new Promise((resolve, fail) => {
  36 + let context = getContext(component) as common.UIAbilityContext;
  37 + let atManager = abilityAccessCtrl.createAtManager();
  38 + atManager.requestPermissionsFromUser(context, permissions).then((data) => {
  39 + let grantStatus: Array<number> = data.authResults;
  40 + let length: number = grantStatus.length;
  41 +
  42 + for (let i = 0; i < length; i++) {
  43 + if (grantStatus[i] === 0) {
  44 + // 用户授权,可以继续访问目标操作
  45 + resolve(true);
  46 + } else {
  47 + resolve(false)
  48 + }
  49 + }
  50 + }).catch((err: Error) => {
  51 + fail(err)
  52 + })
  53 + });
  54 + }
  55 +
  56 + /**跳转设置页面*/
  57 + static openPermissionsInSystemSettings(context: Object): void {
  58 + let uiContext = getContext(context) as common.UIAbilityContext;
  59 + let wantInfo: Want = {
  60 + bundleName: 'com.huawei.hmos.settings',
  61 + abilityName: 'com.huawei.hmos.settings.MainAbility',
  62 + uri: 'application_info_entry',
  63 + parameters: {
  64 + pushParams: AppUtils.getPackageName(uiContext) // 打开指定应用的设置页面
  65 + }
  66 + }
  67 + uiContext.startAbility(wantInfo)
  68 + }
  69 +
  70 + private static async checkAccessToken(permission: Permissions): Promise<abilityAccessCtrl.GrantStatus> {
  71 + let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
  72 + let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED;
  73 +
  74 + // 获取应用程序的accessTokenID
  75 + if (PermissionUtils.tokenId == 0) {
  76 + try {
  77 + let bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);
  78 + let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo;
  79 + PermissionUtils.tokenId = appInfo.accessTokenId;
  80 + } catch (error) {
  81 + const err: BusinessError = error as BusinessError;
  82 + }
  83 + }
  84 + // 校验应用是否被授予权限
  85 + try {
  86 + grantStatus = await atManager.checkAccessToken(PermissionUtils.tokenId, permission);
  87 + } catch (error) {
  88 + const err: BusinessError = error as BusinessError;
  89 + }
  90 +
  91 + return grantStatus;
  92 + }
  93 +
  94 +}
1 import window from '@ohos.window'; 1 import window from '@ohos.window';
2 -import { BusinessError } from '@ohos.base'; 2 +import { AsyncCallback, BusinessError } from '@ohos.base';
3 import deviceInfo from '@ohos.deviceInfo' 3 import deviceInfo from '@ohos.deviceInfo'
4 import display from '@ohos.display'; 4 import display from '@ohos.display';
5 5
  6 +
  7 +interface SystemBarProperties {
  8 + statusBarColor?: string;
  9 + isStatusBarLightIcon?: boolean;
  10 + statusBarContentColor?: string;
  11 + navigationBarColor?: string;
  12 + isNavigationBarLightIcon?: boolean;
  13 + navigationBarContentColor?: string;
  14 +}
  15 +
6 export class Size { 16 export class Size {
7 width: number = 0 17 width: number = 0
8 height: number = 0 18 height: number = 0
@@ -15,17 +25,23 @@ export class Size { @@ -15,17 +25,23 @@ export class Size {
15 25
16 export class WindowModel { 26 export class WindowModel {
17 private windowStage?: window.WindowStage; 27 private windowStage?: window.WindowStage;
  28 + private windowClass?: window.Window;
18 static shared: WindowModel = new WindowModel() 29 static shared: WindowModel = new WindowModel()
19 static TAG = "WindowModel"; 30 static TAG = "WindowModel";
20 31
21 setWindowStage(windowStage: window.WindowStage) { 32 setWindowStage(windowStage: window.WindowStage) {
22 this.windowStage = windowStage; 33 this.windowStage = windowStage;
  34 + this.windowClass = windowStage.getMainWindowSync();
23 } 35 }
24 36
25 getWindowStage(): window.WindowStage { 37 getWindowStage(): window.WindowStage {
26 return this.windowStage as window.WindowStage 38 return this.windowStage as window.WindowStage
27 } 39 }
28 40
  41 + getWindowClass(): window.Window {
  42 + return this.windowClass as window.Window
  43 + }
  44 +
29 setMainWindowFullScreen(fullScreen: boolean) { 45 setMainWindowFullScreen(fullScreen: boolean) {
30 if (deviceInfo.deviceType != "phone") { 46 if (deviceInfo.deviceType != "phone") {
31 return 47 return
@@ -103,5 +119,17 @@ export class WindowModel { @@ -103,5 +119,17 @@ export class WindowModel {
103 }); 119 });
104 }) 120 })
105 } 121 }
  122 +
  123 + /**
  124 + * 设置窗口全屏模式时窗口内导航栏、状态栏的属性,使用callback异步回调。
  125 + * @param systemBarProperties
  126 + * @param callback
  127 + */
  128 + setWindowSystemBarProperties(systemBarProperties: SystemBarProperties, callback?: AsyncCallback<void>): void {
  129 + this.windowClass?.setWindowSystemBarProperties(systemBarProperties, (err: BusinessError) => {
  130 + callback && callback(err)
  131 + })
  132 +
  133 + }
106 } 134 }
107 135
@@ -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 +/*
  2 + * refresh token接口返回
  3 + */
  4 +export interface RefreshTokenRes {
  5 + jwtToken: string;
  6 + refreshToken: string;
  7 +}
  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";
@@ -42,6 +46,10 @@ export class HttpUrlUtils { @@ -42,6 +46,10 @@ export class HttpUrlUtils {
42 * 批查接口,查询互动相关数据,如收藏数、评论数等 46 * 批查接口,查询互动相关数据,如收藏数、评论数等
43 */ 47 */
44 static readonly INTERACT_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/content/interactData"; 48 static readonly INTERACT_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/content/interactData";
  49 + /**
  50 + * 查询视频频道推荐楼层
  51 + */
  52 + static readonly DISPLAY_REC_COMPINFO: string = "/api/rmrb-bff-display-zh/display/zh/c/rec/compInfo";
45 // 多图(图集)详情页 53 // 多图(图集)详情页
46 /** 54 /**
47 * 批量查询内容当前用户点赞、收藏状态 55 * 批量查询内容当前用户点赞、收藏状态
@@ -108,6 +116,10 @@ export class HttpUrlUtils { @@ -108,6 +116,10 @@ export class HttpUrlUtils {
108 */ 116 */
109 static readonly APPOINTMENT_userArea_PATH: string = "/api/rmrb-content-center/c/service/sys-area/treeselect"; 117 static readonly APPOINTMENT_userArea_PATH: string = "/api/rmrb-content-center/c/service/sys-area/treeselect";
110 /** 118 /**
  119 + * 用户token刷新接口(token过期,需要刷新)
  120 + */
  121 + static readonly REFRESH_TOKEN_PATH: string = "/api/rmrb-user-center/auth/zh/c/refreshToken";
  122 + /**
111 /** 123 /**
112 * 个人中心 关注列表详情 124 * 个人中心 关注列表详情
113 */ 125 */
@@ -131,7 +143,11 @@ export class HttpUrlUtils { @@ -131,7 +143,11 @@ export class HttpUrlUtils {
131 /** 143 /**
132 * 我的收藏 144 * 我的收藏
133 */ 145 */
134 - static readonly APPOINTMENT_MyCollectionList_PATH: string = "/api/rmrb-interact/content/zh/c/interact"; 146 + static readonly APPOINTMENT_MyCollectionList_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/interact";
  147 + /**
  148 + * 收藏/取消收藏 status :收藏状态 1添加收藏 0取消收藏
  149 + */
  150 + static readonly APPOINTMENT_ExecuteCollcet_PATH: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord";
135 /** 151 /**
136 * 个人中心 我的评论列表 152 * 个人中心 我的评论列表
137 */ 153 */
@@ -180,22 +196,18 @@ export class HttpUrlUtils { @@ -180,22 +196,18 @@ export class HttpUrlUtils {
180 * 搜索主页 热词 196 * 搜索主页 热词
181 */ 197 */
182 static readonly SEARCH_HOTS_DATA_PATH: string = "/api/rmrb-search-api/zh/c/hots"; 198 static readonly SEARCH_HOTS_DATA_PATH: string = "/api/rmrb-search-api/zh/c/hots";
183 -  
184 /** 199 /**
185 * 搜索联想词 200 * 搜索联想词
186 */ 201 */
187 static readonly RELATED_SEARCH_CONTENT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/suggestions/"; 202 static readonly RELATED_SEARCH_CONTENT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/suggestions/";
188 -  
189 /** 203 /**
190 * 直播详情 204 * 直播详情
191 */ 205 */
192 static readonly LIVE_DETAILS_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail"; 206 static readonly LIVE_DETAILS_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail";
193 -  
194 /** 207 /**
195 * 直播详情-直播间列表 208 * 直播详情-直播间列表
196 */ 209 */
197 static readonly LIVE_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/video/list"; 210 static readonly LIVE_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/video/list";
198 -  
199 /** 211 /**
200 * 直播详情-大家聊列表 212 * 直播详情-大家聊列表
201 */ 213 */
@@ -205,6 +217,10 @@ export class HttpUrlUtils { @@ -205,6 +217,10 @@ export class HttpUrlUtils {
205 * 搜索结果 显示tab 数 217 * 搜索结果 显示tab 数
206 */ 218 */
207 static readonly SEARCH_RESULT_COUNT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/count?keyword="; 219 static readonly SEARCH_RESULT_COUNT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/count?keyword=";
  220 + /**
  221 + * 搜索结果 显示list 详情
  222 + */
  223 + static readonly SEARCH_RESULT_LIST_DATA_PATH: string = "/api/rmrb-search-api/zh/c/search";
208 224
209 /** 225 /**
210 * 早晚报列表 226 * 早晚报列表
@@ -350,7 +366,7 @@ export class HttpUrlUtils { @@ -350,7 +366,7 @@ export class HttpUrlUtils {
350 return ''; 366 return '';
351 } 367 }
352 368
353 - private static getDeviceId() { 369 + public static getDeviceId() {
354 // TODO 370 // TODO
355 return '8a81226a-cabd-3e1b-b630-b51db4a720ed'; 371 return '8a81226a-cabd-3e1b-b630-b51db4a720ed';
356 } 372 }
@@ -444,6 +460,10 @@ export class HttpUrlUtils { @@ -444,6 +460,10 @@ export class HttpUrlUtils {
444 return url; 460 return url;
445 } 461 }
446 462
  463 + static getRefreshTokenUrl() {
  464 + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.REFRESH_TOKEN_PATH;
  465 + return url;
  466 + }
447 467
448 static getResetPassworddUrl() { 468 static getResetPassworddUrl() {
449 let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/resetPassword"; 469 let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/resetPassword";
@@ -480,6 +500,21 @@ export class HttpUrlUtils { @@ -480,6 +500,21 @@ export class HttpUrlUtils {
480 return url; 500 return url;
481 } 501 }
482 502
  503 +
  504 + /*优质评论页*/
  505 + static getQualityCommentUrl() {
  506 + let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/highQuality";
  507 +
  508 + return url
  509 + }
  510 +
  511 + /*获取详情页评论列表*/
  512 + static getContentCommentListDataUrl() {
  513 + let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/contentCommentList"
  514 + return url
  515 + }
  516 +
  517 +
483 //账户注销 518 //账户注销
484 static accountLogoutUrl() { 519 static accountLogoutUrl() {
485 let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/logoff"; 520 let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/logoff";
@@ -492,13 +527,24 @@ export class HttpUrlUtils { @@ -492,13 +527,24 @@ export class HttpUrlUtils {
492 return url; 527 return url;
493 } 528 }
494 529
  530 + //获取用户安全页信息
  531 + static querySecurity() {
  532 + let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/security/query";
  533 + return url;
  534 + }
  535 +
495 static getAppointmentListDataUrl() { 536 static getAppointmentListDataUrl() {
496 let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH 537 let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH
497 return url 538 return url
498 } 539 }
499 540
500 static getMyCollectionListDataUrl() { 541 static getMyCollectionListDataUrl() {
501 - let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.APPOINTMENT_MyCollectionList_PATH 542 + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_MyCollectionList_PATH
  543 + return url
  544 + }
  545 +
  546 + static getExecuteCollcetUrl() {
  547 + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH
502 return url 548 return url
503 } 549 }
504 550
@@ -612,6 +658,16 @@ export class HttpUrlUtils { @@ -612,6 +658,16 @@ export class HttpUrlUtils {
612 return url 658 return url
613 } 659 }
614 660
  661 + static getSearchResultListDataUrl() {
  662 + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_LIST_DATA_PATH
  663 + return url
  664 + }
  665 +
  666 + static getInteractListDataUrl() {
  667 + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERACT_DATA_PATH
  668 + return url
  669 + }
  670 +
615 // static getYcgCommonHeaders(): HashMap<string, string> { 671 // static getYcgCommonHeaders(): HashMap<string, string> {
616 // let headers: HashMap<string, string> = new HashMap<string, string>() 672 // let headers: HashMap<string, string> = new HashMap<string, string>()
617 // 673 //
@@ -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 //我的 预约
@@ -8,13 +8,17 @@ export class H5CallNativeType { @@ -8,13 +8,17 @@ export class H5CallNativeType {
8 static jsCall_getAppPublicInfo = 'jsCall_getAppPublicInfo' 8 static jsCall_getAppPublicInfo = 'jsCall_getAppPublicInfo'
9 static jsCall_getArticleDetailBussinessData = 'jsCall_getArticleDetailBussinessData' 9 static jsCall_getArticleDetailBussinessData = 'jsCall_getArticleDetailBussinessData'
10 static jsCall_callAppService = 'jsCall_callAppService' 10 static jsCall_callAppService = 'jsCall_callAppService'
  11 + static jsCall_appInnerLinkMethod = 'jsCall_appInnerLinkMethod'
  12 + static jsCall_receiveH5Data = 'jsCall_receiveH5Data'
11 // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。 13 // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。
12 14
13 - static init() { 15 + static {
14 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_currentPageOperate) 16 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_currentPageOperate)
15 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppPublicInfo) 17 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppPublicInfo)
16 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getArticleDetailBussinessData) 18 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getArticleDetailBussinessData)
17 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_callAppService) 19 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_callAppService)
  20 + H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_appInnerLinkMethod)
  21 + H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_receiveH5Data)
18 } 22 }
19 } 23 }
20 24
@@ -2,6 +2,9 @@ import { Callback, BridgeWebViewControl } from 'wdJsBridge'; @@ -2,6 +2,9 @@ import { Callback, BridgeWebViewControl } from 'wdJsBridge';
2 import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; 2 import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
3 import { Logger, StringUtils, } from 'wdKit'; 3 import { Logger, StringUtils, } from 'wdKit';
4 import { H5CallNativeType } from './H5CallNativeType'; 4 import { H5CallNativeType } from './H5CallNativeType';
  5 +import { ContentDTO } from 'wdBean';
  6 +//TODO 这里引用了 features模块,是否考虑将跳转抽到公共模块
  7 +import { ProcessUtils } from '../../../../../../features/wdComponent/src/main/ets/utils/ProcessUtils';
5 8
6 const TAG = 'JsBridgeBiz' 9 const TAG = 'JsBridgeBiz'
7 10
@@ -11,7 +14,7 @@ const TAG = 'JsBridgeBiz' @@ -11,7 +14,7 @@ const TAG = 'JsBridgeBiz'
11 * @param call 14 * @param call
12 */ 15 */
13 export function performJSCallNative(data: Message, call: Callback) { 16 export function performJSCallNative(data: Message, call: Callback) {
14 - Logger.debug(TAG, 'performJSCallNative handlerName: ' + data.handlerName + ', data: ' + data.data) 17 + Logger.debug(TAG, 'performJSCallNative handlerName: ' + data.handlerName + ', data: ' + JSON.stringify(data.data))
15 switch (data.handlerName) { 18 switch (data.handlerName) {
16 case H5CallNativeType.jsCall_currentPageOperate: 19 case H5CallNativeType.jsCall_currentPageOperate:
17 break; 20 break;
@@ -23,6 +26,9 @@ export function performJSCallNative(data: Message, call: Callback) { @@ -23,6 +26,9 @@ export function performJSCallNative(data: Message, call: Callback) {
23 break; 26 break;
24 case H5CallNativeType.jsCall_callAppService: 27 case H5CallNativeType.jsCall_callAppService:
25 break; 28 break;
  29 + case H5CallNativeType.jsCall_receiveH5Data:
  30 + handleH5Data(JSON.parse(data?.data?.dataJson || '{}'))
  31 + break;
26 case 'changeNativeMessage': 32 case 'changeNativeMessage':
27 call("this is change Web Message") 33 call("this is change Web Message")
28 break; 34 break;
@@ -50,4 +56,7 @@ function getAppPublicInfo(): string { @@ -50,4 +56,7 @@ function getAppPublicInfo(): string {
50 return result; 56 return result;
51 } 57 }
52 58
  59 +function handleH5Data(content:ContentDTO) {
  60 + ProcessUtils.processPage(content)
  61 +}
53 62
1 import router from '@ohos.router'; 1 import router from '@ohos.router';
2 -import { Action } from 'wdBean';  
3 -import { ConfigConstants } from 'wdConstant';  
4 -import { Logger } from 'wdKit';  
5 -import { BridgeHandler, BridgeUtil, BridgeWebViewControl, Callback } from 'wdJsBridge'; 2 +import { BridgeUtil, BridgeWebViewControl, Callback } from 'wdJsBridge';
  3 +import { Logger } from 'wdKit/Index';
6 import { performJSCallNative } from './JsBridgeBiz'; 4 import { performJSCallNative } from './JsBridgeBiz';
7 -import { setDefaultNativeWebSettings } from './WebComponentUtil'; 5 +import { H5CallNativeType } from './H5CallNativeType';
8 import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; 6 import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
9 7
10 -const TAG = 'WdWebComponent'; 8 +const TAG = 'WdWebLocalComponent';
11 9
12 @Component 10 @Component
13 export struct WdWebComponent { 11 export struct WdWebComponent {
14 - private webviewControl: BridgeWebViewControl = new BridgeWebViewControl()  
15 - //TODO 默认网页  
16 - webUrl: string | Resource = ConfigConstants.DETAIL_URL  
17 - /**  
18 - * 对外暴露webview的回调,能力  
19 - */  
20 - onPageBegin: (url?: string) => void = () => {  
21 - }  
22 - onPageEnd: (url?: string) => void = () => {  
23 - }  
24 - onLoadIntercept: (url?: string) => boolean = () => {  
25 - return false  
26 - }  
27 - onHttpErrorReceive: (url?: string) => boolean = () => {  
28 - return false  
29 - } 12 + webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
  13 + @Prop backVisibility: boolean = false
  14 + @Prop webUrl: string = ''
30 @Prop @Watch('onReloadStateChanged') reload: number = 0 15 @Prop @Watch('onReloadStateChanged') reload: number = 0
31 - /**  
32 - * 默认【CallNative】逻辑处理  
33 - */  
34 - private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => {  
35 - performJSCallNative(data, f)  
36 - }  
37 - /**  
38 - * jsBridge的处理  
39 - */  
40 - handleInfo: [string, BridgeHandler][] = []  
41 - backVisibility: boolean = false  
42 -  
43 - defaultRegisterHandler(): void {  
44 - this.webviewControl.registerHandler("CallNative", {  
45 - handle: (data: Message, f: Callback) => {  
46 - this.defaultPerformJSCallNative(data, f)  
47 - }  
48 - });  
49 -  
50 - }  
51 16
52 build() { 17 build() {
53 Column() { 18 Column() {
@@ -71,26 +36,13 @@ export struct WdWebComponent { @@ -71,26 +36,13 @@ export struct WdWebComponent {
71 .zoomAccess(false) 36 .zoomAccess(false)
72 .horizontalScrollBarAccess(false) 37 .horizontalScrollBarAccess(false)
73 .verticalScrollBarAccess(false) 38 .verticalScrollBarAccess(false)
74 - .onHttpErrorReceive((event) => {  
75 - //TODO 页面加载不成功的时候处理  
76 - Logger.info(TAG, 'onHttpErrorReceive event.request.getRequestUrl:' + event?.request.getRequestUrl());  
77 - Logger.info(TAG, 'onHttpErrorReceive event.response.getResponseCode:' + event?.response.getResponseCode()); 39 + .onPageBegin((event) => {
  40 + console.log(this.webUrl,"yzl")
  41 + this.onPageBegin(event?.url);
78 }) 42 })
79 .onPageEnd((event) => { 43 .onPageEnd((event) => {
80 this.onPageEnd(event?.url) 44 this.onPageEnd(event?.url)
81 }) 45 })
82 - .onPageBegin((event) => {  
83 - // setDefaultNativeWebSettings(this.webviewControl, this.webUrl).then(()=>{  
84 - // this.handleInfo && this.handleInfo.length > 1 ? this.handleInfo.forEach(value => {  
85 - // this.webviewControl.registerHandler(value[0], value[1])  
86 - // }) : this.defaultRegisterHandler()  
87 - // setTimeout(()=>{  
88 - // BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)  
89 - // },500)  
90 - // })  
91 - // this.onPageBegin(event?.url)  
92 - // this.webviewControl?.setCustomUserAgent('Mozilla/5.0 (Linux; Android 12; HarmonyOS; OXF-AN00; HMSCore 6.13.0.302) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 HuaweiBrowser/14.0.6.300 Mobile Safari/537.36')  
93 - })  
94 .onLoadIntercept((event) => { 46 .onLoadIntercept((event) => {
95 let url: string = event.data.getRequestUrl().toString() 47 let url: string = event.data.getRequestUrl().toString()
96 url = url.replace("%(?![0-9a-fA-F]{2})", "%25") 48 url = url.replace("%(?![0-9a-fA-F]{2})", "%25")
@@ -101,19 +53,51 @@ export struct WdWebComponent { @@ -101,19 +53,51 @@ export struct WdWebComponent {
101 return true 53 return true
102 } 54 }
103 if (url.startsWith(BridgeUtil.YY_OVERRIDE_SCHEMA)) { 55 if (url.startsWith(BridgeUtil.YY_OVERRIDE_SCHEMA)) {
  56 + Logger.debug(TAG, 'flushMessageQueue');
104 this.webviewControl.flushMessageQueue() 57 this.webviewControl.flushMessageQueue()
105 return true 58 return true
106 } 59 }
107 - return this.onLoadIntercept(event.data.getRequestUrl().toString()) 60 + return this.onLoadIntercept(event.data.getRequestUrl().toString());
108 }) 61 })
109 } 62 }
110 } 63 }
111 64
  65 + private registerHandlers(): void {
  66 + // 注册h5调用js相关
  67 + for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) {
  68 + let handleName = H5CallNativeType.JsCallTypeList[i];
  69 + console.log('handleName:', handleName)
  70 + let handle = (data: Message, f: Callback) => {
  71 + this.defaultPerformJSCallNative(data, f)
  72 + };
  73 + this.webviewControl.registerHandler(handleName, { handle: handle });
  74 + }
  75 + }
  76 +
  77 + /**
  78 + * 默认【CallNative】逻辑处理
  79 + */
  80 + private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => {
  81 + performJSCallNative(data, f)
  82 + }
  83 + onPageBegin: (url?: string) => void = () => {
  84 + Logger.debug(TAG, 'onPageBegin');
  85 + this.registerHandlers();
  86 + BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)
  87 + }
  88 + onPageEnd: (url?: string) => void = () => {
  89 + Logger.debug(TAG, 'onPageEnd');
  90 + }
  91 + onLoadIntercept: (url?: string) => boolean = () => {
  92 + Logger.debug(TAG, 'onLoadIntercept return false');
  93 + return false
  94 + }
112 onReloadStateChanged() { 95 onReloadStateChanged() {
113 Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`); 96 Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`);
114 if (this.reload > 0) { 97 if (this.reload > 0) {
115 this.webviewControl.refresh() 98 this.webviewControl.refresh()
116 } 99 }
117 } 100 }
  101 +
118 } 102 }
119 103
@@ -11,9 +11,10 @@ const TAG = 'WdWebLocalComponent'; @@ -11,9 +11,10 @@ const TAG = 'WdWebLocalComponent';
11 11
12 @Component 12 @Component
13 export struct WdWebLocalComponent { 13 export struct WdWebLocalComponent {
14 - private webviewControl: BridgeWebViewControl = new BridgeWebViewControl()  
15 - backVisibility: boolean = false  
16 - webResource: Resource = {} as Resource 14 + webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
  15 + @Prop backVisibility: boolean = false
  16 + @Prop webResource: Resource = {} as Resource
  17 + @State webHeight : string = '100%'
17 18
18 build() { 19 build() {
19 Column() { 20 Column() {
@@ -31,30 +32,16 @@ export struct WdWebLocalComponent { @@ -31,30 +32,16 @@ export struct WdWebLocalComponent {
31 .visibility(this.backVisibility ? Visibility.Visible : Visibility.None) 32 .visibility(this.backVisibility ? Visibility.Visible : Visibility.None)
32 33
33 Web({ src: this.webResource, controller: this.webviewControl }) 34 Web({ src: this.webResource, controller: this.webviewControl })
34 - .layoutMode(WebLayoutMode.FIT_CONTENT)  
35 .domStorageAccess(true) 35 .domStorageAccess(true)
36 .databaseAccess(true) 36 .databaseAccess(true)
37 .javaScriptAccess(true) 37 .javaScriptAccess(true)
38 - // .imageAccess(true)  
39 - // .onlineImageAccess(true)  
40 - // .fileAccess(true) 38 + .imageAccess(true)
  39 + .mixedMode(MixedMode.All)
  40 + .onlineImageAccess(true)
  41 + .enableNativeEmbedMode(true)
  42 + .height(this.webHeight === '100%' ? '100%' : Number(this.webHeight))
41 .onPageBegin((event) => { 43 .onPageBegin((event) => {
42 -  
43 - // setDefaultNativeWebSettings(this.webviewControl, this.webResource).then(()=>{  
44 - // this.handleInfo && this.handleInfo.length > 1 ? this.handleInfo.forEach(value => {  
45 - // this.webviewControl.registerHandler(value[0], value[1])  
46 - // }) : this.defaultRegisterHandler()  
47 - // setTimeout(()=>{  
48 - // BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)  
49 - // },500)  
50 - // })  
51 - // this.onPageBegin(event?.url)  
52 - // BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl);  
53 this.onPageBegin(event?.url); 44 this.onPageBegin(event?.url);
54 - this.registerHandlers();  
55 - setTimeout(() => {  
56 - BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)  
57 - }, 200)  
58 }) 45 })
59 .onPageEnd((event) => { 46 .onPageEnd((event) => {
60 this.onPageEnd(event?.url) 47 this.onPageEnd(event?.url)
@@ -79,25 +66,24 @@ export struct WdWebLocalComponent { @@ -79,25 +66,24 @@ export struct WdWebLocalComponent {
79 } 66 }
80 67
81 private registerHandlers(): void { 68 private registerHandlers(): void {
82 - // TODO 待优化  
83 - H5CallNativeType.init();  
84 // 注册h5调用js相关 69 // 注册h5调用js相关
85 for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) { 70 for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) {
86 let handleName = H5CallNativeType.JsCallTypeList[i]; 71 let handleName = H5CallNativeType.JsCallTypeList[i];
87 let handle = (data: Message, f: Callback) => { 72 let handle = (data: Message, f: Callback) => {
  73 + this.setCurrentPageOperate(data)
88 this.defaultPerformJSCallNative(data, f) 74 this.defaultPerformJSCallNative(data, f)
89 - } ; 75 + };
90 this.webviewControl.registerHandler(handleName, { handle: handle }); 76 this.webviewControl.registerHandler(handleName, { handle: handle });
91 } 77 }
92 - // // TODO test  
93 - // this.webviewControl.registerHandler('changeNativeMessage', {  
94 - // handle: (data: Message, f: Callback) => {  
95 - // this.defaultPerformJSCallNative(data, f)  
96 - // }  
97 - // });  
98 -  
99 } 78 }
100 79
  80 + //webview 高度设置
  81 + private setCurrentPageOperate: (data: Message) => void = (data) => {
  82 + console.log("setCurrentPageOperate",JSON.stringify(data))
  83 + if (data.handlerName === H5CallNativeType.jsCall_currentPageOperate) {
  84 + this.webHeight = data?.data?.webViewHeight || '100%'
  85 + }
  86 + }
101 /** 87 /**
102 * 默认【CallNative】逻辑处理 88 * 默认【CallNative】逻辑处理
103 */ 89 */
@@ -106,12 +92,16 @@ export struct WdWebLocalComponent { @@ -106,12 +92,16 @@ export struct WdWebLocalComponent {
106 } 92 }
107 onPageBegin: (url?: string) => void = () => { 93 onPageBegin: (url?: string) => void = () => {
108 Logger.debug(TAG, 'onPageBegin'); 94 Logger.debug(TAG, 'onPageBegin');
  95 + this.registerHandlers();
  96 + // setTimeout(() => {
  97 + BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)
  98 + // }, 100)
109 } 99 }
110 onPageEnd: (url?: string) => void = () => { 100 onPageEnd: (url?: string) => void = () => {
111 Logger.debug(TAG, 'onPageEnd'); 101 Logger.debug(TAG, 'onPageEnd');
112 } 102 }
113 onLoadIntercept: (url?: string) => boolean = () => { 103 onLoadIntercept: (url?: string) => boolean = () => {
114 - Logger.debug(TAG, 'onPageBegin return false'); 104 + Logger.debug(TAG, 'onLoadIntercept return false');
115 return false 105 return false
116 } 106 }
117 } 107 }
@@ -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,15 @@ export interface ContentDTO { @@ -62,11 +62,15 @@ 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: number; 71 photoNum: number;
71 - 72 + corner: string;
  73 + rmhPlatform: number;
  74 + newTags: string;
  75 + isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据
72 } 76 }
  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 +}
@@ -43,20 +43,14 @@ export { ImageAndTextWebComponent } from "./src/main/ets/components/ImageAndText @@ -43,20 +43,14 @@ export { ImageAndTextWebComponent } from "./src/main/ets/components/ImageAndText
43 43
44 export { DetailViewModel } from "./src/main/ets/viewmodel/DetailViewModel" 44 export { DetailViewModel } from "./src/main/ets/viewmodel/DetailViewModel"
45 45
46 -export { SingleImageCardComponent } from "./src/main/ets/components/view/SingleImageCardComponent"  
47 -  
48 -export { TriPicCardComponent } from "./src/main/ets/components/view/TriPicCardComponent"  
49 -  
50 export { BigPicCardComponent } from "./src/main/ets/components/view/BigPicCardComponent" 46 export { BigPicCardComponent } from "./src/main/ets/components/view/BigPicCardComponent"
51 47
52 -export { HeadPictureCardComponent } from "./src/main/ets/components/view/HeadPictureCardComponent"  
53 -  
54 -export { ZhGridLayoutComponent } from "./src/main/ets/components/view/ZhGridLayoutComponent"  
55 -  
56 export { MultiPictureDetailPageComponent } from "./src/main/ets/components/MultiPictureDetailPageComponent" 48 export { MultiPictureDetailPageComponent } from "./src/main/ets/components/MultiPictureDetailPageComponent"
57 49
58 export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailComponent" 50 export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailComponent"
59 51
  52 +export { AudioSuspensionModel } from "./src/main/ets/viewmodel/AudioSuspensionModel"
  53 +
60 export { BroadcastPageComponent } from "./src/main/ets/components/broadcast/BroadcastPageComponent" 54 export { BroadcastPageComponent } from "./src/main/ets/components/broadcast/BroadcastPageComponent"
61 55
62 export { FirstTabTopSearchComponent } from "./src/main/ets/components/search/FirstTabTopSearchComponent" 56 export { FirstTabTopSearchComponent } from "./src/main/ets/components/search/FirstTabTopSearchComponent"
@@ -64,3 +58,8 @@ export { FirstTabTopSearchComponent } from "./src/main/ets/components/search/Fir @@ -64,3 +58,8 @@ export { FirstTabTopSearchComponent } from "./src/main/ets/components/search/Fir
64 export { ListHasNoMoreDataUI } from "./src/main/ets/components/reusable/ListHasNoMoreDataUI" 58 export { ListHasNoMoreDataUI } from "./src/main/ets/components/reusable/ListHasNoMoreDataUI"
65 59
66 export { LottieView } from './src/main/ets/lottie/LottieView' 60 export { LottieView } from './src/main/ets/lottie/LottieView'
  61 +
  62 +export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopicPageComponent'
  63 +
  64 +export { LogoutViewModel } from "./src/main/ets/viewmodel/LogoutViewModel"
  65 +
@@ -12,6 +12,7 @@ import { Card17Component } from './cardview/Card17Component'; @@ -12,6 +12,7 @@ import { Card17Component } from './cardview/Card17Component';
12 import { Card15Component } from './cardview/Card15Component'; 12 import { Card15Component } from './cardview/Card15Component';
13 import { Card19Component } from './cardview/Card19Component'; 13 import { Card19Component } from './cardview/Card19Component';
14 import { Card20Component } from './cardview/Card20Component'; 14 import { Card20Component } from './cardview/Card20Component';
  15 +import { Card21Component } from './cardview/Card21Component';
15 16
16 /** 17 /**
17 * card适配器,卡片样式汇总,依据ContentDTO#appStyle 18 * card适配器,卡片样式汇总,依据ContentDTO#appStyle
@@ -52,6 +53,8 @@ export struct CardParser { @@ -52,6 +53,8 @@ export struct CardParser {
52 Card19Component({ contentDTO }) 53 Card19Component({ contentDTO })
53 } else if (contentDTO.appStyle === CompStyle.Card_20) { 54 } else if (contentDTO.appStyle === CompStyle.Card_20) {
54 Card20Component({ contentDTO }) 55 Card20Component({ contentDTO })
  56 + } else if (contentDTO.appStyle === CompStyle.Card_21) {
  57 + Card21Component({ contentDTO })
55 } 58 }
56 else { 59 else {
57 // todo:组件未实现 / Component Not Implemented 60 // todo:组件未实现 / Component Not Implemented
  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 +}
@@ -22,13 +22,6 @@ import { PageRepository } from '../repository/PageRepository'; @@ -22,13 +22,6 @@ import { PageRepository } from '../repository/PageRepository';
22 22
23 const TAG = 'ImageAndTextPageComponent' 23 const TAG = 'ImageAndTextPageComponent'
24 24
25 -export interface OperationItem {  
26 - icon: Resource;  
27 - icon_check?: Resource;  
28 - text: string | Resource;  
29 - num?: number; // 个数  
30 -}  
31 -  
32 @Component 25 @Component
33 export struct ImageAndTextPageComponent { 26 export struct ImageAndTextPageComponent {
34 scroller: Scroller = new Scroller(); 27 scroller: Scroller = new Scroller();
@@ -37,7 +30,6 @@ export struct ImageAndTextPageComponent { @@ -37,7 +30,6 @@ export struct ImageAndTextPageComponent {
37 @State recommendList: ContentDTO[] = [] 30 @State recommendList: ContentDTO[] = []
38 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 31 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
39 @State interactData: InteractDataDTO = {} as InteractDataDTO 32 @State interactData: InteractDataDTO = {} as InteractDataDTO
40 -  
41 build() { 33 build() {
42 Column() { 34 Column() {
43 // 发布时间 35 // 发布时间
@@ -64,66 +56,28 @@ export struct ImageAndTextPageComponent { @@ -64,66 +56,28 @@ export struct ImageAndTextPageComponent {
64 .objectFit(ImageFit.Cover) 56 .objectFit(ImageFit.Cover)
65 .margin({ top: 10 }) 57 .margin({ top: 10 })
66 } 58 }
67 - .padding({ left: 15, right: 15, }) 59 + .padding({ left: 15, right: 15 })
68 .backgroundColor(Color.White) 60 .backgroundColor(Color.White)
69 61
70 Stack({ alignContent: Alignment.Bottom }) { 62 Stack({ alignContent: Alignment.Bottom }) {
71 - List() {  
72 - //详情展示区  
73 - ListItem() { 63 + Scroll(this.scroller) {
  64 + Column() {
  65 + ImageAndTextWebComponent({
  66 + contentDetailData: this.contentDetailData,
  67 + action: this.action
  68 + })
74 Column() { 69 Column() {
75 - ImageAndTextWebComponent({  
76 - contentDetailData: this.contentDetailData,  
77 - action: this.action,  
78 - })  
79 - }.width(CommonConstants.FULL_WIDTH)  
80 - .height(CommonConstants.FULL_HEIGHT)  
81 - }  
82 -  
83 - if (this.contentDetailData[0]?.openLikes === 1) {  
84 - ListItem() {  
85 - // 点赞  
86 - Row() {  
87 - Row() {  
88 - if (this.newsStatusOfUser?.likeStatus === '1') {  
89 - Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : $r('app.media.icon_candle_active')))  
90 - .width(24)  
91 - .height(24)  
92 - .margin({ right: 5 })  
93 - } else {  
94 - Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : $r('app.media.icon_candle')))  
95 - .width(24)  
96 - .height(24)  
97 - .margin({ right: 5 })  
98 - }  
99 - Text(`${this.interactData?.likeNum || 0}`)  
100 - .fontSize(16)  
101 - .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')  
102 - .fontWeight(500)  
103 - }.alignItems(VerticalAlign.Center)  
104 - .onClick(() => {  
105 - this.toggleLikeStatus()  
106 - })  
107 -  
108 - }.width(CommonConstants.FULL_WIDTH).height(80)  
109 - .justifyContent(FlexAlign.Center) 70 + if (this.recommendList.length > 0) {
  71 + RecommendList({ recommendList: this.recommendList })
  72 + }
110 } 73 }
111 - .border({  
112 - width: { bottom: 5 },  
113 - color: '#f5f5f5',  
114 - })  
115 } 74 }
116 75
117 - // 相关推荐区  
118 - ListItem() {  
119 - RecommendList({ recommendList: this.recommendList })  
120 - }  
121 } 76 }
122 .width(CommonConstants.FULL_WIDTH) 77 .width(CommonConstants.FULL_WIDTH)
123 .height(CommonConstants.FULL_HEIGHT) 78 .height(CommonConstants.FULL_HEIGHT)
124 - .padding({ bottom: 56 })  
125 - .scrollBar(BarState.Off)  
126 - .edgeEffect(EdgeEffect.None) 79 + .padding({ bottom: 76 })
  80 + // .scrollBar(BarState.Off)
127 81
128 //底部交互区 82 //底部交互区
129 Row() { 83 Row() {
@@ -163,11 +117,143 @@ export struct ImageAndTextPageComponent { @@ -163,11 +117,143 @@ export struct ImageAndTextPageComponent {
163 .justifyContent(FlexAlign.SpaceBetween) 117 .justifyContent(FlexAlign.SpaceBetween)
164 .backgroundColor(Color.White) 118 .backgroundColor(Color.White)
165 } 119 }
166 - }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)  
167 - .backgroundColor(Color.White)  
168 - 120 + }
  121 + .width(CommonConstants.FULL_WIDTH)
  122 + .height(CommonConstants.FULL_HEIGHT)
169 } 123 }
170 124
  125 + // build() {
  126 + // Column() {
  127 + // // 发布时间
  128 + // Row() {
  129 + // Image($r('app.media.icon_ren_min_ri_bao'))
  130 + // .width(70)
  131 + // .height(28)
  132 + // Text(this.contentDetailData[0]?.publishTime)
  133 + // .fontColor($r('app.color.color_B0B0B0'))
  134 + // .fontSize($r('app.float.font_size_13'))
  135 + // .height('100%')
  136 + // .align(Alignment.End)
  137 + // }
  138 + // .width(CommonConstants.FULL_WIDTH)
  139 + // .height(32)
  140 + // .padding({ left: 15, right: 15, })
  141 + // .justifyContent(FlexAlign.SpaceBetween)
  142 + // .backgroundColor(Color.White)
  143 + //
  144 + // Row() {
  145 + // Image($r('app.media.line'))
  146 + // .width('100%')
  147 + // .height(6)
  148 + // .objectFit(ImageFit.Cover)
  149 + // .margin({ top: 10 })
  150 + // }
  151 + // .padding({ left: 15, right: 15, })
  152 + // .backgroundColor(Color.White)
  153 + //
  154 + // Stack({ alignContent: Alignment.Bottom }) {
  155 + //
  156 + // List() {
  157 + // //详情展示区
  158 + // ListItem() {
  159 + // Column() {
  160 + // ImageAndTextWebComponent({
  161 + // contentDetailData: this.contentDetailData,
  162 + // action: this.action,
  163 + // })
  164 + // }.width(CommonConstants.FULL_WIDTH)
  165 + // // .height(CommonConstants.FULL_HEIGHT)
  166 + // }
  167 + //
  168 + // if (this.contentDetailData[0]?.openLikes === 1) {
  169 + // ListItem() {
  170 + // // 点赞
  171 + // Row() {
  172 + // Row() {
  173 + // if (this.newsStatusOfUser?.likeStatus === '1') {
  174 + // Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : $r('app.media.icon_candle_active')))
  175 + // .width(24)
  176 + // .height(24)
  177 + // .margin({ right: 5 })
  178 + // } else {
  179 + // Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : $r('app.media.icon_candle')))
  180 + // .width(24)
  181 + // .height(24)
  182 + // .margin({ right: 5 })
  183 + // }
  184 + // Text(`${this.interactData?.likeNum || 0}`)
  185 + // .fontSize(16)
  186 + // .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')
  187 + // .fontWeight(500)
  188 + // }.alignItems(VerticalAlign.Center)
  189 + // .onClick(() => {
  190 + // this.toggleLikeStatus()
  191 + // })
  192 + //
  193 + // }.width(CommonConstants.FULL_WIDTH).height(80)
  194 + // .justifyContent(FlexAlign.Center)
  195 + // }
  196 + // .border({
  197 + // width: { bottom: 5 },
  198 + // color: '#f5f5f5',
  199 + // })
  200 + // }
  201 + //
  202 + // // 相关推荐区
  203 + // ListItem() {
  204 + // RecommendList({ recommendList: this.recommendList })
  205 + // }
  206 + // }
  207 + // .width(CommonConstants.FULL_WIDTH)
  208 + // .height(CommonConstants.FULL_HEIGHT)
  209 + // .padding({ bottom: 56 })
  210 + // .scrollBar(BarState.Off)
  211 + // .edgeEffect(EdgeEffect.None)
  212 + //
  213 + // //底部交互区
  214 + // Row() {
  215 + // Image($r('app.media.icon_arrow_left'))
  216 + // .width(24)
  217 + // .height(24)
  218 + // .onClick((event: ClickEvent) => {
  219 + // router.back()
  220 + // })
  221 + //
  222 + // Row() {
  223 + // Image($r('app.media.icon_comment'))
  224 + // .width(24)
  225 + // .height(24)
  226 + // .margin({ right: 24 })
  227 + // .id('comment')
  228 + //
  229 + // Image($r('app.media.icon_star'))
  230 + // .width(24)
  231 + // .height(24)
  232 + // .margin({ right: 24 })
  233 + //
  234 + // Image($r('app.media.icon_listen'))
  235 + // .width(24)
  236 + // .height(24)
  237 + // .margin({ right: 24 })
  238 + //
  239 + // Image($r('app.media.icon_forward'))
  240 + // .width(24)
  241 + // .height(24)
  242 + //
  243 + // }
  244 + // }
  245 + // .width(CommonConstants.FULL_WIDTH)
  246 + // .height(56)
  247 + // .padding({ left: 15, right: 15, bottom: 50, top: 20 })
  248 + // .justifyContent(FlexAlign.SpaceBetween)
  249 + // .backgroundColor(Color.White)
  250 + // }
  251 + //
  252 + // }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
  253 + // .backgroundColor(Color.White)
  254 + //
  255 + // }
  256 +
171 private async getDetail() { 257 private async getDetail() {
172 let contentId: string = '' 258 let contentId: string = ''
173 let relId: string = '' 259 let relId: string = ''
@@ -199,7 +285,6 @@ export struct ImageAndTextPageComponent { @@ -199,7 +285,6 @@ export struct ImageAndTextPageComponent {
199 } 285 }
200 } 286 }
201 287
202 -  
203 private async getRecommend() { 288 private async getRecommend() {
204 let params: postRecommendListParams = { 289 let params: postRecommendListParams = {
205 imei: "8272c108-4fa2-34ce-80b9-bc425a7c2a7e", 290 imei: "8272c108-4fa2-34ce-80b9-bc425a7c2a7e",
@@ -211,9 +296,7 @@ export struct ImageAndTextPageComponent { @@ -211,9 +296,7 @@ export struct ImageAndTextPageComponent {
211 channelId: String(this.contentDetailData[0]?.reLInfo?.channelId) 296 channelId: String(this.contentDetailData[0]?.reLInfo?.channelId)
212 } 297 }
213 let recommendList = await DetailViewModel.postRecommendList(params) 298 let recommendList = await DetailViewModel.postRecommendList(params)
214 - if (recommendList && recommendList.length > 0) {  
215 - this.recommendList = recommendList;  
216 - } 299 + this.recommendList = recommendList;
217 } 300 }
218 301
219 // 已登录->查询用户对作品点赞、收藏状态 302 // 已登录->查询用户对作品点赞、收藏状态
@@ -7,7 +7,7 @@ import { @@ -7,7 +7,7 @@ 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 'wdJsBridge/Index'; 12 import { BridgeWebViewControl } from 'wdJsBridge/Index';
13 13
@@ -85,11 +85,6 @@ export struct ImageAndTextWebComponent { @@ -85,11 +85,6 @@ export struct ImageAndTextWebComponent {
85 webResource: $rawfile('apph5/index.html'), 85 webResource: $rawfile('apph5/index.html'),
86 backVisibility: false, 86 backVisibility: false,
87 }) 87 })
88 - // WdWebLocalComponent({  
89 - // webviewControl: this.webviewControl,  
90 - // webResource: "http://pd-people-uat.pdnews.cn/articletopic/35398-10000015965",  
91 - // backVisibility: false,  
92 - // })  
93 } 88 }
94 } 89 }
95 90
@@ -97,7 +92,7 @@ export struct ImageAndTextWebComponent { @@ -97,7 +92,7 @@ export struct ImageAndTextWebComponent {
97 Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData'); 92 Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData');
98 this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData, 93 this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData,
99 JSON.stringify(h5ReceiveAppData), (data: string) => { 94 JSON.stringify(h5ReceiveAppData), (data: string) => {
100 - // Logger.debug('ImageAndTextWebComponent', "from js data = " + data); 95 + Logger.debug('ImageAndTextWebComponent', "from js data = " + data);
101 }) 96 })
102 } 97 }
103 } 98 }
  1 +import { Action, ContentDetailDTO, } from 'wdBean';
  2 +import DetailViewModel from '../viewmodel/DetailViewModel';
  3 +import { WdWebComponent } from 'wdWebComponent';
  4 +import router from '@ohos.router';
  5 +import { CommonConstants } from 'wdConstant'
  6 +import { BridgeWebViewControl } from 'wdJsBridge/Index';
  7 +
  8 +const TAG = 'SpacialTopicPageComponent'
  9 +
  10 +@Component
  11 +export struct SpacialTopicPageComponent {
  12 + webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
  13 + scroller: Scroller = new Scroller();
  14 + action: Action = {} as Action
  15 + @State webUrl: string = '';
  16 + build() {
  17 + Column() {
  18 + Stack({ alignContent: Alignment.Bottom }) {
  19 + Column() {
  20 + WdWebComponent({
  21 + webviewControl: this.webviewControl,
  22 + webUrl: this.webUrl,
  23 + backVisibility: false,
  24 + })
  25 + }
  26 + .padding({ bottom: 56 })
  27 + .width(CommonConstants.FULL_WIDTH)
  28 + .height(CommonConstants.FULL_HEIGHT)
  29 +
  30 + //底部交互区
  31 + Row() {
  32 + Image($r('app.media.icon_arrow_left'))
  33 + .width(24)
  34 + .height(24)
  35 + .onClick((event: ClickEvent) => {
  36 + router.back()
  37 + })
  38 +
  39 + Row() {
  40 + Image($r('app.media.icon_comment'))
  41 + .width(24)
  42 + .height(24)
  43 + .margin({ right: 24 })
  44 + .id('comment')
  45 +
  46 + Image($r('app.media.icon_star'))
  47 + .width(24)
  48 + .height(24)
  49 + .margin({ right: 24 })
  50 +
  51 + Image($r('app.media.icon_listen'))
  52 + .width(24)
  53 + .height(24)
  54 + .margin({ right: 24 })
  55 +
  56 + Image($r('app.media.icon_forward'))
  57 + .width(24)
  58 + .height(24)
  59 +
  60 + }
  61 + }
  62 + .width(CommonConstants.FULL_WIDTH)
  63 + .height(56)
  64 + .padding({ left: 15, right: 15, bottom: 20, top: 20 })
  65 + .justifyContent(FlexAlign.SpaceBetween)
  66 + .backgroundColor(Color.White)
  67 + }
  68 + }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
  69 + .backgroundColor(Color.White)
  70 + }
  71 +
  72 + aboutToAppear() {
  73 + let action: Action = router.getParams() as Action
  74 + if (action) {
  75 + this.webUrl = action.params?.url || ''
  76 + }
  77 + }
  78 +
  79 + aboutToDisappear() {
  80 + }
  81 +}
@@ -10,56 +10,60 @@ import { DateTimeUtils } from 'wdKit/Index' @@ -10,56 +10,60 @@ import { DateTimeUtils } from 'wdKit/Index'
10 @Component 10 @Component
11 export struct CardMediaInfo { 11 export struct CardMediaInfo {
12 @State contentDTO: ContentDTO = {} as ContentDTO // 如果有duraion,代表点播,显示时长;如果不传或者传0,显示直播中 12 @State contentDTO: ContentDTO = {} as ContentDTO // 如果有duraion,代表点播,显示时长;如果不传或者传0,显示直播中
  13 +
13 // objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频, 14 // objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,
14 // 14动态图文,15动态视频16问政;100人民号,101标签 15 // 14动态图文,15动态视频16问政;100人民号,101标签
15 16
16 build() { 17 build() {
17 Row() { 18 Row() {
18 - if(this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15' ) { 19 + if (this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15') {
19 // 点播、动态视频 20 // 点播、动态视频
20 - Row(){  
21 - Image($r('app.media.videoTypeIcon')) 21 + Row() {
  22 + Image($r('app.media.card_play'))
22 .mediaLogo() 23 .mediaLogo()
23 Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000)) 24 Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000))
24 .mediaText() 25 .mediaText()
25 } 26 }
26 - .backgroundColor('#4d000000')  
27 - .borderRadius($r('app.float.button_border_radius'))  
28 - } else if(this.contentDTO.objectType === '2') { 27 + } else if (this.contentDTO.objectType === '2') {
29 // liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 28 // liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
30 // 显示直播信息 29 // 显示直播信息
31 - Row(){  
32 - if(this.contentDTO.liveInfo.liveState === 'running') {  
33 - Image($r('app.media.icon_live')) 30 + Row() {
  31 + if(this.contentDTO.liveInfo.liveState === 'wait') {
  32 + Image($r('app.media.card_wait'))
  33 + .mediaLogo()
  34 + Text('预约')
  35 + .mediaText()
  36 + } else if (this.contentDTO.liveInfo.liveState === 'running') {
  37 + Image($r('app.media.card_live'))
34 .mediaLogo() 38 .mediaLogo()
35 Text('直播中') 39 Text('直播中')
36 .mediaText() 40 .mediaText()
37 - } else if(this.contentDTO.liveInfo.liveState === 'end'){  
38 - Image($r('app.media.videoTypeIcon')) 41 + } else if (this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo.replayUri) {
  42 + Image($r('app.media.card_play'))
39 .mediaLogo() 43 .mediaLogo()
40 Text('回看') 44 Text('回看')
41 .mediaText() 45 .mediaText()
  46 + } else if(this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo
  47 + .replayUri) {
  48 + // Image($r('app.media.card_live'))
  49 + // .mediaLogo()
  50 + Text('直播结束')
  51 + .mediaText()
42 } 52 }
43 } 53 }
44 - .backgroundColor('#4d000000')  
45 - .borderRadius($r('app.float.button_border_radius'))  
46 - } else if(this.contentDTO.objectType === '9') { 54 + } else if (this.contentDTO.objectType === '9') {
47 // 显示组图;图片数量 55 // 显示组图;图片数量
48 - Row(){  
49 - Image($r('app.media.album_card_shape')) 56 + Row() {
  57 + Image($r('app.media.card_image'))
50 .mediaLogo() 58 .mediaLogo()
51 Text(`${this.contentDTO.photoNum}`) 59 Text(`${this.contentDTO.photoNum}`)
52 .mediaText() 60 .mediaText()
53 - .width(20)  
54 } 61 }
55 - .backgroundColor('#4d000000')  
56 - .borderRadius($r('app.float.button_border_radius'))  
57 - } else if(this.contentDTO.objectType === '13') { 62 + } else if (this.contentDTO.objectType === '13') {
58 // 显示音频信息 63 // 显示音频信息
59 - Row(){  
60 - Image($r('app.media.broadcast_listen'))  
61 - .height(14)  
62 - .borderRadius($r('app.float.button_border_radius')) 64 + Row() {
  65 + Image($r('app.media.card_audio'))
  66 + .mediaLogo()
63 Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000)) 67 Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000))
64 .mediaText() 68 .mediaText()
65 } 69 }
@@ -68,18 +72,27 @@ export struct CardMediaInfo { @@ -68,18 +72,27 @@ export struct CardMediaInfo {
68 .margin(6) 72 .margin(6)
69 } 73 }
70 74
71 - @Styles mediaLogo() {  
72 - .width(22)  
73 - .height(18)  
74 - .borderRadius($r('app.float.button_border_radius')) 75 + @Styles
  76 + mediaLogo() {
  77 + .width(14)
  78 + .height(14)
  79 + .margin({ right: 3 })
  80 + .shadow({
  81 + radius: 2,
  82 + color: 'rgba(0,0,0,0.3)',
  83 + offsetY: 2
  84 + })
75 } 85 }
76 } 86 }
77 87
78 -@Extend(Text) function mediaText() { 88 +@Extend(Text)
  89 +function mediaText() {
79 .fontColor($r('app.color.color_fff')) 90 .fontColor($r('app.color.color_fff'))
80 - .fontSize($r('app.float.font_size_12'))  
81 - .width(40)  
82 - .height(18)  
83 - .textAlign(TextAlign.Center)  
84 - .margin({ left: -3 }) 91 + .fontSize($r('app.float.font_size_14'))
  92 + .lineHeight(18)
  93 + .textShadow({
  94 + radius: 2,
  95 + color: 'rgba(0,0,0,0.3)',
  96 + offsetY: 2
  97 + })
85 } 98 }
  1 +import { ContentDTO } from 'wdBean'
  2 +import { CommonConstants } from 'wdConstant/Index';
  3 +import { DateTimeUtils } from 'wdKit/Index';
  4 +
  5 +@Component
  6 +export struct CardSourceInfo {
  7 + @State contentDTO: ContentDTO = {} as ContentDTO;
  8 + build() {
  9 + Flex() {
  10 + if(this.contentDTO.corner) {
  11 + Text(this.contentDTO.corner)
  12 + .fontSize($r("app.float.font_size_12"))
  13 + .fontColor($r("app.color.color_ED2800"))
  14 + .margin({right: 2})
  15 + }
  16 + if(this.contentDTO.rmhPlatform === 1) {
  17 + Text(this.contentDTO.rmhInfo.rmhName)
  18 + .fontSize($r("app.float.font_size_12"))
  19 + .fontColor($r("app.color.color_B0B0B0"))
  20 + .maxLines(1)
  21 + .textOverflow({overflow: TextOverflow.Ellipsis})
  22 + Image($r("app.media.point"))
  23 + .width(16)
  24 + .height(16)
  25 + } else if(this.contentDTO.source) {
  26 + Text(`${this.contentDTO.source}`)
  27 + .fontSize($r("app.float.font_size_12"))
  28 + .fontColor($r("app.color.color_B0B0B0"))
  29 + .maxLines(1)
  30 + .textOverflow({overflow: TextOverflow.Ellipsis})
  31 + }
  32 + // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间
  33 + if(this.contentDTO.isSearch || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime
  34 + (Number
  35 + .parseFloat(this
  36 + .contentDTO.publishTime))
  37 + .indexOf
  38 + ('-') === -1) {
  39 + Image($r("app.media.point"))
  40 + .width(16)
  41 + .height(16)
  42 + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))
  43 + .fontSize($r("app.float.font_size_12"))
  44 + .fontColor($r("app.color.color_B0B0B0"))
  45 + .margin({ right: 6 })
  46 + .flexShrink(0)
  47 + }
  48 + if(this.contentDTO?.interactData?.commentNum) {
  49 + Text(`${this.contentDTO.interactData.commentNum}评`)
  50 + .fontSize($r("app.float.font_size_12"))
  51 + .fontColor($r("app.color.color_B0B0B0"))
  52 + .flexShrink(0)
  53 + }
  54 + }
  55 + .width(CommonConstants.FULL_WIDTH)
  56 + .margin({ top: 8 })
  57 + }
  58 +}
@@ -2,7 +2,8 @@ import { ContentDTO, slideShows } from 'wdBean'; @@ -2,7 +2,8 @@ import { ContentDTO, slideShows } from 'wdBean';
2 import { CommonConstants } from 'wdConstant' 2 import { CommonConstants } from 'wdConstant'
3 import { DateTimeUtils } from 'wdKit'; 3 import { DateTimeUtils } from 'wdKit';
4 import { ProcessUtils } from '../../utils/ProcessUtils'; 4 import { ProcessUtils } from '../../utils/ProcessUtils';
5 - 5 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
  6 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
6 7
7 /** 8 /**
8 * 大专题卡--CompStyle: 10 9 * 大专题卡--CompStyle: 10
@@ -76,10 +77,10 @@ export struct Card10Component { @@ -76,10 +77,10 @@ export struct Card10Component {
76 } 77 }
77 .width(CommonConstants.FULL_WIDTH) 78 .width(CommonConstants.FULL_WIDTH)
78 .padding({ 79 .padding({
79 - top: 14,  
80 - left: 16,  
81 - right: 16,  
82 - bottom: 14 80 + left: $r('app.float.card_comp_pagePadding_lf'),
  81 + right: $r('app.float.card_comp_pagePadding_lf'),
  82 + top: $r('app.float.card_comp_pagePadding_tb'),
  83 + bottom: $r('app.float.card_comp_pagePadding_tb')
83 }) 84 })
84 .backgroundColor($r("app.color.white")) 85 .backgroundColor($r("app.color.white"))
85 .margin({ bottom: 8 }) 86 .margin({ bottom: 8 })
@@ -95,25 +96,14 @@ export struct Card10Component { @@ -95,25 +96,14 @@ export struct Card10Component {
95 .fontColor($r('app.color.color_222222')) 96 .fontColor($r('app.color.color_222222'))
96 .maxLines(2) 97 .maxLines(2)
97 .textOverflow({ overflow: TextOverflow.Ellipsis }) 98 .textOverflow({ overflow: TextOverflow.Ellipsis })
98 - Row() {  
99 - // 展示发稿人  
100 - if (item.source) {  
101 - Text(item.source)  
102 - .fontSize($r('app.float.font_size_12'))  
103 - .fontColor($r('app.color.color_B0B0B0'))  
104 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
105 - .maxLines(1)  
106 - .width(item.source.length > 10 ? '60%' : '')  
107 -  
108 - Image($r('app.media.point'))  
109 - .width(16)  
110 - .height(16) 99 + CardSourceInfo(
  100 + {
  101 + contentDTO: {
  102 + publishTime: item.publishTime || '',
  103 + source: item.source || ''
  104 + } as ContentDTO
111 } 105 }
112 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(String(item.publishTime))))  
113 - .fontSize($r("app.float.font_size_12"))  
114 - .fontColor($r("app.color.color_B0B0B0"))  
115 - }  
116 - .margin({ top: 12 }) 106 + )
117 } 107 }
118 .layoutWeight(1) 108 .layoutWeight(1)
119 .alignItems(HorizontalAlign.Start) 109 .alignItems(HorizontalAlign.Start)
@@ -3,7 +3,7 @@ import { CommonConstants } from 'wdConstant' @@ -3,7 +3,7 @@ import { CommonConstants } from 'wdConstant'
3 import { ContentDTO } from 'wdBean' 3 import { ContentDTO } from 'wdBean'
4 import { DateTimeUtils } from 'wdKit' 4 import { DateTimeUtils } from 'wdKit'
5 import { ProcessUtils } from '../../utils/ProcessUtils'; 5 import { ProcessUtils } from '../../utils/ProcessUtils';
6 - 6 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
7 const TAG = 'Card11Component'; 7 const TAG = 'Card11Component';
8 8
9 /** 9 /**
@@ -21,29 +21,8 @@ export struct Card11Component { @@ -21,29 +21,8 @@ export struct Card11Component {
21 .maxLines(3) 21 .maxLines(3)
22 .textOverflow({ overflow: TextOverflow.Ellipsis }) 22 .textOverflow({ overflow: TextOverflow.Ellipsis })
23 .width(CommonConstants.FULL_WIDTH) 23 .width(CommonConstants.FULL_WIDTH)
24 - Row() {  
25 - if (this.contentDTO.source) {  
26 - Text(this.contentDTO.source)  
27 - .fontSize($r("app.float.font_size_12"))  
28 - .fontColor($r("app.color.color_B0B0B0"))  
29 - .margin({ left: 6 })  
30 - Image($r("app.media.point"))  
31 - .width(16)  
32 - .height(16)  
33 - }  
34 -  
35 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))  
36 - .fontSize($r("app.float.font_size_12"))  
37 - .fontColor($r("app.color.color_B0B0B0"))  
38 - .margin({ right: 6 })  
39 - // TODO '评论取哪个字段'  
40 - // Text(`1806评`)  
41 - // .fontSize($r("app.float.font_size_12"))  
42 - // .fontColor($r("app.color.color_B0B0B0"))  
43 - }.width(CommonConstants.FULL_WIDTH)  
44 - .justifyContent(FlexAlign.Start)  
45 - .margin({ top: 8 })  
46 - 24 + // 评论等信息
  25 + CardSourceInfo({ contentDTO: this.contentDTO })
47 }.width(CommonConstants.FULL_WIDTH) 26 }.width(CommonConstants.FULL_WIDTH)
48 .padding({ 27 .padding({
49 left: $r('app.float.card_comp_pagePadding_lf'), 28 left: $r('app.float.card_comp_pagePadding_lf'),
  1 +import { ContentDTO } from 'wdBean';
  2 +import { RmhTitle } from '../cardCommon/RmhTitle'
  3 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
  4 +import { CommonConstants } from 'wdConstant/Index';
  5 +
  6 +const TAG = 'Card12Component';
  7 +
  8 +/**
  9 + * 人民号-动态---12:人民号无图卡;
  10 + */
  11 +@Component
  12 +export struct Card12Component {
  13 + @State contentDTO: ContentDTO = {
  14 + appStyle: '20',
  15 + coverType: 1,
  16 + coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
  17 + fullColumnImgUrls: [
  18 + {
  19 + landscape: 1,
  20 + size: 1,
  21 + url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
  22 + weight: 1600
  23 + }
  24 + ],
  25 + newsTitle: '好玩!》10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
  26 + rmhInfo: {
  27 + authIcon:
  28 + 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',
  29 + authTitle: '10后音乐人王烁然个人人民号',
  30 + authTitle2: '10后音乐人王烁然个人人民号',
  31 + banControl: 0,
  32 + cnIsAttention: 1,
  33 + rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
  34 + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
  35 + rmhName: '王烁然',
  36 + userId: '522435359667845',
  37 + userType: '2'
  38 + },
  39 + objectType: '1',
  40 + videoInfo: {
  41 + firstFrameImageUri: '',
  42 + videoDuration: 37,
  43 + videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'
  44 + }
  45 + } as ContentDTO;
  46 +
  47 + aboutToAppear(): void {
  48 + }
  49 +
  50 + build() {
  51 + Column() {
  52 + // rmh信息
  53 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
  54 + // 标题
  55 + if (this.contentDTO.newsTitle) {
  56 + Text(this.contentDTO.newsTitle)
  57 + .fontSize($r('app.float.font_size_17'))
  58 + .fontColor($r('app.color.color_222222'))
  59 + .width(CommonConstants.FULL_WIDTH)
  60 + .textOverflowStyle(3)
  61 + .margin({ bottom: 8 })
  62 + .height(75)
  63 + .lineHeight(25)
  64 + .fontFamily('PingFang SC-Regular')
  65 + }
  66 +
  67 + // if (this.contentDTO.fullColumnImgUrls?.[0]) {
  68 + // createImg({ contentDTO: this.contentDTO })
  69 + // }
  70 + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
  71 + }
  72 + .padding({
  73 + left: $r('app.float.card_comp_pagePadding_lf'),
  74 + right: $r('app.float.card_comp_pagePadding_lf'),
  75 + top: $r('app.float.card_comp_pagePadding_tb'),
  76 + bottom: $r('app.float.card_comp_pagePadding_tb')
  77 + })
  78 + }
  79 +}
  80 +
  81 +interface radiusType {
  82 + topLeft: number | Resource;
  83 + topRight: number | Resource;
  84 + bottomLeft: number | Resource;
  85 + bottomRight: number | Resource;
  86 +}
  87 +
  88 +@Component
  89 +struct createImg {
  90 + @Prop contentDTO: ContentDTO
  91 +
  92 + build() {
  93 + GridRow() {
  94 + if (this.contentDTO.fullColumnImgUrls[0].landscape === 1) {
  95 + // 横屏
  96 + GridCol({
  97 + span: { xs: 12 }
  98 + }) {
  99 + Stack() {
  100 + Image(this.contentDTO.coverUrl)
  101 + .width(CommonConstants.FULL_WIDTH)
  102 + .aspectRatio(16 / 9)
  103 + .borderRadius($r('app.float.image_border_radius'))
  104 + CardMediaInfo({ contentDTO: this.contentDTO })
  105 + }
  106 + .align(Alignment.BottomEnd)
  107 + }
  108 + } else {
  109 + // 竖图显示,宽度占50%,高度自适应
  110 + GridCol({
  111 + span: { xs: 6 }
  112 + }) {
  113 + Stack() {
  114 + Image(this.contentDTO.coverUrl)
  115 + .width(CommonConstants.FULL_WIDTH)
  116 + .borderRadius($r('app.float.image_border_radius'))
  117 + CardMediaInfo({ contentDTO: this.contentDTO })
  118 + }
  119 + .align(Alignment.BottomEnd)
  120 + }
  121 + }
  122 + }
  123 + }
  124 +}
  125 +
  126 +
  127 +@Extend(Text)
  128 +function textOverflowStyle(maxLine: number) {
  129 + .maxLines(maxLine)
  130 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  131 +}
  1 +import { ContentDTO } from 'wdBean';
  2 +import { RmhTitle } from '../cardCommon/RmhTitle'
  3 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
  4 +import { CommonConstants } from 'wdConstant/Index';
  5 +
  6 +const TAG = 'Card14Component';
  7 +
  8 +/**
  9 + * 人民号-动态---14:人民号单图卡;
  10 + */
  11 +@Component
  12 +export struct Card14Component {
  13 + @State contentDTO: ContentDTO = {
  14 + // appStyle: '20',
  15 + // coverType: 1,
  16 + // coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
  17 + // fullColumnImgUrls: [
  18 + // {
  19 + // landscape: 1,
  20 + // size: 1,
  21 + // url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
  22 + // weight: 1600
  23 + // }
  24 + // ],
  25 + // newsTitle: '好玩!》10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
  26 + // rmhInfo: {
  27 + // authIcon:
  28 + // 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',
  29 + // authTitle: '10后音乐人王烁然个人人民号',
  30 + // authTitle2: '10后音乐人王烁然个人人民号',
  31 + // banControl: 0,
  32 + // cnIsAttention: 1,
  33 + // rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
  34 + // rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
  35 + // rmhName: '王烁然',
  36 + // userId: '522435359667845',
  37 + // userType: '2'
  38 + // },
  39 + // objectType: '1',
  40 + // videoInfo: {
  41 + // firstFrameImageUri: '',
  42 + // videoDuration: 37,
  43 + // videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'
  44 + // }
  45 + } as ContentDTO;
  46 +
  47 + aboutToAppear(): void {
  48 + }
  49 +
  50 + build() {
  51 + Column() {
  52 + // rmh信息
  53 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
  54 + // 左标题,右图
  55 + Flex({ direction: FlexDirection.Row }) {
  56 +
  57 + Text(this.contentDTO.newsTitle)
  58 + .fontSize($r('app.float.font_size_17'))
  59 + .fontColor($r('app.color.color_222222'))
  60 + .textOverflowStyle(3)
  61 + .lineHeight(25)
  62 + .fontFamily('PingFang SC-Regular')
  63 + .textAlign(TextAlign.Start)
  64 + .flexBasis('auto')
  65 + .margin({right: 12})
  66 +
  67 + Image(this.contentDTO.coverUrl)
  68 + .flexBasis(174)
  69 + .height(75)
  70 + .borderRadius($r('app.float.image_border_radius'))
  71 + // .flexBasis(160)
  72 + .backgroundImageSize(ImageSize.Auto)
  73 +
  74 + }
  75 + .width(CommonConstants.FULL_WIDTH)
  76 + .margin({ bottom: 8 })
  77 + .height(75)
  78 +
  79 +
  80 + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
  81 + }
  82 + .padding({
  83 + left: $r('app.float.card_comp_pagePadding_lf'),
  84 + right: $r('app.float.card_comp_pagePadding_lf'),
  85 + top: $r('app.float.card_comp_pagePadding_tb'),
  86 + bottom: $r('app.float.card_comp_pagePadding_tb')
  87 + })
  88 + }
  89 +}
  90 +
  91 +interface radiusType {
  92 + topLeft: number | Resource;
  93 + topRight: number | Resource;
  94 + bottomLeft: number | Resource;
  95 + bottomRight: number | Resource;
  96 +}
  97 +
  98 +@Extend(Text)
  99 +function textOverflowStyle(maxLine: number) {
  100 + .maxLines(maxLine)
  101 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  102 +}
  1 +import { ContentDTO } from 'wdBean';
  2 +import { RmhTitle } from '../cardCommon/RmhTitle'
  3 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
  4 +import { CommonConstants } from 'wdConstant/Index';
  5 +
  6 +const TAG = 'Card16Component';
  7 +
  8 +/**
  9 + * 人民号-动态---16:人民号三图卡;
  10 + */
  11 +@Component
  12 +export struct Card16Component {
  13 + @State contentDTO: ContentDTO = {
  14 + appStyle: '20',
  15 + coverType: 1,
  16 + coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90;https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90;https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
  17 + fullColumnImgUrls: [
  18 + {
  19 + landscape: 1,
  20 + size: 1,
  21 + url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
  22 + weight: 1600
  23 + }
  24 + ],
  25 + newsTitle: '好玩!》10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号',
  26 + rmhInfo: {
  27 + authIcon:
  28 + 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',
  29 + authTitle: '10后音乐人王烁然个人人民号',
  30 + authTitle2: '10后音乐人王烁然个人人民号',
  31 + banControl: 0,
  32 + cnIsAttention: 1,
  33 + rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
  34 + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
  35 + rmhName: '王烁然',
  36 + userId: '522435359667845',
  37 + userType: '2'
  38 + },
  39 + objectType: '1',
  40 + videoInfo: {
  41 + firstFrameImageUri: '',
  42 + videoDuration: 37,
  43 + videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'
  44 + }
  45 + } as ContentDTO;
  46 +
  47 + aboutToAppear(): void {
  48 + }
  49 +
  50 + build() {
  51 + Column() {
  52 + // rmh信息
  53 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
  54 + // 标题
  55 + if (this.contentDTO.newsTitle) {
  56 + Text(this.contentDTO.newsTitle)
  57 + .fontSize($r('app.float.font_size_17'))
  58 + .fontColor($r('app.color.color_222222'))
  59 + .width(CommonConstants.FULL_WIDTH)
  60 + .textOverflowStyle(2)
  61 + .margin({ bottom: 8 })
  62 + .lineHeight(25)
  63 + }
  64 + if (this.contentDTO.coverUrl) {
  65 + Flex() {
  66 + ForEach(this.contentDTO.coverUrl?.split(';'), (item: string) => {
  67 + Image(item).flexBasis(113).height(75).margin({right: 2})
  68 + })
  69 + }
  70 + }
  71 + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
  72 + }
  73 + .padding({
  74 + left: $r('app.float.card_comp_pagePadding_lf'),
  75 + right: $r('app.float.card_comp_pagePadding_lf'),
  76 + top: $r('app.float.card_comp_pagePadding_tb'),
  77 + bottom: $r('app.float.card_comp_pagePadding_tb')
  78 + })
  79 + }
  80 +}
  81 +
  82 +interface radiusType {
  83 + topLeft: number | Resource;
  84 + topRight: number | Resource;
  85 + bottomLeft: number | Resource;
  86 + bottomRight: number | Resource;
  87 +}
  88 +
  89 +@Component
  90 +struct createImg {
  91 + @Prop contentDTO: ContentDTO
  92 +
  93 + build() {
  94 + GridRow() {
  95 + if (this.contentDTO.fullColumnImgUrls[0].landscape === 1) {
  96 + // 横屏
  97 + GridCol({
  98 + span: { xs: 12 }
  99 + }) {
  100 + Stack() {
  101 + Image(this.contentDTO.coverUrl)
  102 + .width(CommonConstants.FULL_WIDTH)
  103 + .aspectRatio(16 / 9)
  104 + .borderRadius($r('app.float.image_border_radius'))
  105 + CardMediaInfo({ contentDTO: this.contentDTO })
  106 + }
  107 + .align(Alignment.BottomEnd)
  108 + }
  109 + } else {
  110 + // 竖图显示,宽度占50%,高度自适应
  111 + GridCol({
  112 + span: { xs: 6 }
  113 + }) {
  114 + Stack() {
  115 + Image(this.contentDTO.coverUrl)
  116 + .width(CommonConstants.FULL_WIDTH)
  117 + .borderRadius($r('app.float.image_border_radius'))
  118 + CardMediaInfo({ contentDTO: this.contentDTO })
  119 + }
  120 + .align(Alignment.BottomEnd)
  121 + }
  122 + }
  123 + }
  124 + }
  125 +}
  126 +
  127 +
  128 +@Extend(Text)
  129 +function textOverflowStyle(maxLine: number) {
  130 + .maxLines(maxLine)
  131 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  132 +}
@@ -4,7 +4,7 @@ import { CommonConstants } from 'wdConstant/Index'; @@ -4,7 +4,7 @@ import { CommonConstants } from 'wdConstant/Index';
4 import { DateTimeUtils } from 'wdKit'; 4 import { DateTimeUtils } from 'wdKit';
5 import { WDRouterRule } from 'wdRouter'; 5 import { WDRouterRule } from 'wdRouter';
6 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 6 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
7 - 7 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
8 const TAG = 'Card17Component'; 8 const TAG = 'Card17Component';
9 9
10 /** 10 /**
@@ -81,25 +81,8 @@ export struct Card17Component { @@ -81,25 +81,8 @@ export struct Card17Component {
81 }; 81 };
82 WDRouterRule.jumpWithAction(taskAction) 82 WDRouterRule.jumpWithAction(taskAction)
83 }) 83 })
84 -  
85 - Row() {  
86 - if (this.contentDTO.source) {  
87 - Text(this.contentDTO.source)  
88 - .fontSize($r('app.float.font_size_13'))  
89 - .fontColor($r('app.color.color_B0B0B0'))  
90 - Image($r('app.media.point'))  
91 - .width(16)  
92 - .height(16)  
93 - }  
94 - if (this.contentDTO.publishTime && this.contentDTO.publishTime.length === 13) {  
95 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))  
96 - .fontSize($r('app.float.font_size_13'))  
97 - .fontColor($r('app.color.color_B0B0B0'))  
98 - }  
99 - }  
100 - .width(CommonConstants.FULL_WIDTH)  
101 - .height(16)  
102 - .id('label') 84 + // 评论等信息
  85 + CardSourceInfo({ contentDTO: this.contentDTO })
103 } 86 }
104 .width(CommonConstants.FULL_WIDTH) 87 .width(CommonConstants.FULL_WIDTH)
105 .padding({ 88 .padding({
@@ -13,37 +13,37 @@ export struct Card19Component { @@ -13,37 +13,37 @@ export struct Card19Component {
13 // coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg', 13 // coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
14 // fullColumnImgUrls: [ 14 // fullColumnImgUrls: [
15 // { 15 // {
16 - // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/quality,q_90/auto-orient,1',  
17 - // height: 1500,  
18 - // landscape: 1,  
19 - // size: 1,  
20 - // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',  
21 - // weight: 2000  
22 - // },  
23 - // {  
24 // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994155727712256.png?x-oss-process=image/quality,q_90/auto-orient,1', 16 // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994155727712256.png?x-oss-process=image/quality,q_90/auto-orient,1',
25 // height: 1500, 17 // height: 1500,
26 // landscape: 1, 18 // landscape: 1,
27 // size: 1, 19 // size: 1,
28 - // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994155727712256.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg', 20 + // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
29 // weight: 2000 21 // weight: 2000
30 // }, 22 // },
31 - // {  
32 - // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/quality,q_90/auto-orient,1',  
33 - // height: 1280,  
34 - // landscape: 1,  
35 - // size: 1,  
36 - // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',  
37 - // weight: 1707  
38 - // },  
39 - // {  
40 - // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/quality,q_90/auto-orient,1',  
41 - // height: 1280,  
42 - // landscape: 1,  
43 - // size: 1,  
44 - // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',  
45 - // weight: 1707  
46 - // } 23 + // {
  24 + // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994155727712256.png?x-oss-process=image/quality,q_90/auto-orient,1',
  25 + // height: 1500,
  26 + // landscape: 1,
  27 + // size: 1,
  28 + // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994155727712256.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
  29 + // weight: 2000
  30 + // },
  31 + // {
  32 + // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/quality,q_90/auto-orient,1',
  33 + // height: 1280,
  34 + // landscape: 1,
  35 + // size: 1,
  36 + // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
  37 + // weight: 1707
  38 + // },
  39 + // {
  40 + // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/quality,q_90/auto-orient,1',
  41 + // height: 1280,
  42 + // landscape: 1,
  43 + // size: 1,
  44 + // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
  45 + // weight: 1707
  46 + // }
47 // ], 47 // ],
48 // newsSummary: '#平安建设双提升#【进工地,送安全】3月21日下午,@合肥交警 包河大队走进辖区建筑工地为驾驶员、安全员们开展春季交通安全主题宣传活动。活动中,交警结合涉工程运输车、渣土车交通事故案例,详细讲解行驶注意事项,并普及了“一盔一带”“右转必停”等安全常识,要求驾驶员牢固树立交通安全意识,自觉遵守交通法律法规,确保出行安全。', 48 // newsSummary: '#平安建设双提升#【进工地,送安全】3月21日下午,@合肥交警 包河大队走进辖区建筑工地为驾驶员、安全员们开展春季交通安全主题宣传活动。活动中,交警结合涉工程运输车、渣土车交通事故案例,详细讲解行驶注意事项,并普及了“一盔一带”“右转必停”等安全常识,要求驾驶员牢固树立交通安全意识,自觉遵守交通法律法规,确保出行安全。',
49 // newsTitle: '#平安建设双提升#【进工地,送安全】3月21日下午,@合肥交警 包河大队走进辖区建筑工地为驾驶员、安全员们开展春季交通安全主题宣传活动。活动中,交警结合涉工程运输车、渣土车交通事故案例,详细讲解行驶注意事项,并普及了“一盔一带”“右转必停”等安全常识,要求驾驶员牢固树立交通安全意识,自觉遵守交通法律法规,确保出行安全。', 49 // newsTitle: '#平安建设双提升#【进工地,送安全】3月21日下午,@合肥交警 包河大队走进辖区建筑工地为驾驶员、安全员们开展春季交通安全主题宣传活动。活动中,交警结合涉工程运输车、渣土车交通事故案例,详细讲解行驶注意事项,并普及了“一盔一带”“右转必停”等安全常识,要求驾驶员牢固树立交通安全意识,自觉遵守交通法律法规,确保出行安全。',
@@ -107,6 +107,8 @@ interface radiusType { @@ -107,6 +107,8 @@ interface radiusType {
107 @Component 107 @Component
108 struct createImg { 108 struct createImg {
109 @Prop fullColumnImgUrls: FullColumnImgUrlDTO[] 109 @Prop fullColumnImgUrls: FullColumnImgUrlDTO[]
  110 + @State picWidth: number = 0;
  111 + @State picHeight: number = 0;
110 aboutToAppear(): void { 112 aboutToAppear(): void {
111 if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位 113 if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位
112 this.fullColumnImgUrls.splice(2,0, { 114 this.fullColumnImgUrls.splice(2,0, {
@@ -137,18 +139,77 @@ struct createImg { @@ -137,18 +139,77 @@ struct createImg {
137 return radius 139 return radius
138 } 140 }
139 141
  142 + getPicType(){
  143 + if (this.picWidth && this.picWidth) {
  144 + if (this.picWidth / this.picHeight > 343/172) {
  145 + return 1; //横长图
  146 + } else if (this.picHeight / this.picWidth > 305/228) {
  147 + return 2; //竖长图
  148 + } else {
  149 + return 3
  150 + }
  151 + } else {
  152 + return 3; //普通图
  153 + }
  154 + }
  155 +
  156 +
140 build() { 157 build() {
141 GridRow({ 158 GridRow({
142 gutter: { x: 2, y: 2 } 159 gutter: { x: 2, y: 2 }
143 }) { 160 }) {
144 ForEach(this.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => { 161 ForEach(this.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => {
145 if (this.fullColumnImgUrls.length === 1) { 162 if (this.fullColumnImgUrls.length === 1) {
146 - GridCol({  
147 - span: { xs: 8 }  
148 - }) {  
149 - Image(item.fullUrl)  
150 - .width('100%')  
151 - .borderRadius(this.caclImageRadius(index)) 163 + if (this.getPicType() !== 3) {
  164 + GridCol({
  165 + span: this.getPicType() === 1 ? 12 : 8
  166 + }){
  167 + Stack({
  168 + alignContent: Alignment.BottomEnd
  169 + }) {
  170 + if (this.getPicType() === 1) {
  171 + Image(item.fullUrl)
  172 + .width('100%')
  173 + .height(172)
  174 + .autoResize(true)
  175 + .borderRadius(this.caclImageRadius(index))
  176 + } else if (this.getPicType() === 2) {
  177 + Image(item.fullUrl)
  178 + .width('100%')
  179 + .height(305)
  180 + .autoResize(true)
  181 + .borderRadius(this.caclImageRadius(index))
  182 + }
  183 + Flex({ direction: FlexDirection.Row }) {
  184 + Image($r('app.media.icon_long_pic'))
  185 + .width(14)
  186 + .height(14)
  187 + .margin({right: 4})
  188 + Text('长图')
  189 + .fontSize(12)
  190 + .fontWeight(400)
  191 + .fontColor(0xffffff)
  192 + .fontFamily('PingFang SC')
  193 + }
  194 + .width(48)
  195 + .padding({bottom: 9})
  196 +
  197 + }
  198 + }
  199 + } else {
  200 + GridCol({
  201 + span: { xs: 8 }
  202 + }) {
  203 + Image(item.fullUrl)
  204 + .width('100%')
  205 + .borderRadius(this.caclImageRadius(index))
  206 + .autoResize(true)
  207 + .opacity(!this.picWidth && !this.picHeight ? 0 : 1)
  208 + .onComplete(callback => {
  209 + this.picWidth = callback?.width || 0;
  210 + this.picHeight = callback?.height || 0;
  211 + })
  212 + }
152 } 213 }
153 } else if (this.fullColumnImgUrls.length === 4) { 214 } else if (this.fullColumnImgUrls.length === 4) {
154 GridCol({ 215 GridCol({
  1 +import { ContentDTO } from 'wdBean';
  2 +import { CommonConstants, CompStyle } from 'wdConstant';
  3 +import { ProcessUtils } from '../../utils/ProcessUtils';
  4 +import { RmhTitle } from '../cardCommon/RmhTitle'
  5 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
  6 +
  7 +const TAG: string = 'Card6Component-Card13Component';
  8 +
  9 +/**
  10 + * 卡片样式:"appStyle":"21" 小视频卡人民号
  11 + */
  12 +@Component
  13 +export struct Card21Component {
  14 + @State contentDTO: ContentDTO = {} as ContentDTO;
  15 +
  16 + build() {
  17 + Column() {
  18 + // 顶部 rmh信息
  19 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
  20 + // 中间内容
  21 + Grid() {
  22 + GridItem() {
  23 + Text(`${this.contentDTO.newsTitle}`)
  24 + .fontSize($r('app.float.selected_text_size'))
  25 + .fontColor($r('app.color.color_222222'))
  26 + .width(CommonConstants.FULL_WIDTH)
  27 + .maxLines(4)
  28 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  29 + .padding({ right: 12 })
  30 + .lineHeight(26)
  31 + }
  32 +
  33 + GridItem() {
  34 + Stack() {
  35 + Image(this.contentDTO.coverUrl)
  36 + .width(CommonConstants.FULL_WIDTH)
  37 + .borderRadius($r('app.float.image_border_radius'))
  38 + CardMediaInfo({ contentDTO: this.contentDTO })
  39 + }
  40 + .alignContent(Alignment.BottomEnd)
  41 + }
  42 + }
  43 + .columnsTemplate('2fr 1fr')
  44 + .maxCount(1)
  45 +
  46 + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
  47 + }
  48 + .onClick((event: ClickEvent) => {
  49 + ProcessUtils.processPage(this.contentDTO)
  50 + })
  51 + .padding({
  52 + left: $r('app.float.card_comp_pagePadding_lf'),
  53 + right: $r('app.float.card_comp_pagePadding_lf'),
  54 + top: $r('app.float.card_comp_pagePadding_tb'),
  55 + bottom: $r('app.float.card_comp_pagePadding_tb')
  56 + })
  57 + .width(CommonConstants.FULL_WIDTH)
  58 + }
  59 +}
1 //全标题 "appStyle":"2", 1 //全标题 "appStyle":"2",
2 import { ContentDTO } from 'wdBean'; 2 import { ContentDTO } from 'wdBean';
3 import { CommonConstants } from 'wdConstant/Index'; 3 import { CommonConstants } from 'wdConstant/Index';
4 -import { DateTimeUtils } from 'wdKit/Index';  
5 import { ProcessUtils } from '../../utils/ProcessUtils'; 4 import { ProcessUtils } from '../../utils/ProcessUtils';
6 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
7 - 6 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
8 const TAG: string = 'Card2Component'; 7 const TAG: string = 'Card2Component';
9 8
10 /** 9 /**
@@ -60,21 +59,8 @@ export struct Card2Component { @@ -60,21 +59,8 @@ export struct Card2Component {
60 .alignItems(HorizontalAlign.Start) 59 .alignItems(HorizontalAlign.Start)
61 60
62 //bottom 61 //bottom
63 - Row() {  
64 - Text(this.contentDTO.source)  
65 - .bottomTextStyle()  
66 - //间隔点  
67 - Image($r('app.media.point'))  
68 - .width(12)  
69 - .height(12)  
70 -  
71 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))  
72 - .bottomTextStyle()  
73 - }  
74 - .width(CommonConstants.FULL_WIDTH)  
75 - .height(18)  
76 - .justifyContent(FlexAlign.Start)  
77 - .margin({ top: 8 }) 62 + // 评论等信息
  63 + CardSourceInfo({ contentDTO: this.contentDTO })
78 } 64 }
79 .width(CommonConstants.FULL_WIDTH) 65 .width(CommonConstants.FULL_WIDTH)
80 .padding({ 66 .padding({
1 import { ContentDTO } from 'wdBean'; 1 import { ContentDTO } from 'wdBean';
2 import { CommonConstants } from 'wdConstant' 2 import { CommonConstants } from 'wdConstant'
3 -import { DateTimeUtils } from 'wdKit/src/main/ets/utils/DateTimeUtils'  
4 import { ProcessUtils } from '../../utils/ProcessUtils'; 3 import { ProcessUtils } from '../../utils/ProcessUtils';
  4 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
5 5
6 /** 6 /**
7 * 卡片样式:"appStyle":"3" 7 * 卡片样式:"appStyle":"3"
@@ -27,30 +27,8 @@ export struct Card3Component { @@ -27,30 +27,8 @@ export struct Card3Component {
27 .fontSize($r("app.float.font_size_16")) 27 .fontSize($r("app.float.font_size_16"))
28 .fontColor($r("app.color.color_222222")) 28 .fontColor($r("app.color.color_222222"))
29 .width(CommonConstants.FULL_WIDTH) 29 .width(CommonConstants.FULL_WIDTH)
30 - Row() {  
31 - // TODO "锐评"取得哪个字段,什么时候显示。  
32 - // Text("锐评")  
33 - // .fontSize($r("app.float.font_size_12"))  
34 - // .fontColor($r("app.color.color_ED2800"))  
35 - if(this.contentDTO.source) {  
36 - Text(this.contentDTO.source)  
37 - .fontSize($r("app.float.font_size_12"))  
38 - .fontColor($r("app.color.color_B0B0B0"))  
39 - Image($r("app.media.point"))  
40 - .width(16)  
41 - .height(16)  
42 - }  
43 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))  
44 - .fontSize($r("app.float.font_size_12"))  
45 - .fontColor($r("app.color.color_B0B0B0"))  
46 - .margin({ right: 6 })  
47 - // TODO '评论取哪个字段'  
48 - // Text(`1806评`)  
49 - // .fontSize($r("app.float.font_size_12"))  
50 - // .fontColor($r("app.color.color_B0B0B0"))  
51 - }.width(CommonConstants.FULL_WIDTH)  
52 - .justifyContent(FlexAlign.Start)  
53 - .margin({ top: 8 }) 30 + // 评论等信息
  31 + CardSourceInfo({ contentDTO: this.contentDTO })
54 } 32 }
55 .width(CommonConstants.FULL_WIDTH) 33 .width(CommonConstants.FULL_WIDTH)
56 .padding({ 34 .padding({
1 import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean'; 1 import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
2 import { CommonConstants } from 'wdConstant/Index'; 2 import { CommonConstants } from 'wdConstant/Index';
3 import { ProcessUtils } from '../../utils/ProcessUtils'; 3 import { ProcessUtils } from '../../utils/ProcessUtils';
4 -import { DateTimeUtils } from 'wdKit/Index';  
5 - 4 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
6 const TAG: string = 'Card4Component'; 5 const TAG: string = 'Card4Component';
7 6
8 /** 7 /**
@@ -110,25 +109,8 @@ export struct Card4Component { @@ -110,25 +109,8 @@ export struct Card4Component {
110 .onClick((event: ClickEvent) => { 109 .onClick((event: ClickEvent) => {
111 ProcessUtils.processPage(this.contentDTO) 110 ProcessUtils.processPage(this.contentDTO)
112 }) 111 })
113 -  
114 -  
115 - //bottom  
116 - Row() {  
117 - Text(this.contentDTO.source)  
118 - .bottomTextStyle()  
119 - //间隔点  
120 - Image($r('app.media.point'))  
121 - .width(12)  
122 - .height(12)  
123 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))  
124 - .bottomTextStyle()  
125 - // TODO 评论字段取值  
126 - // Text('518条评论')  
127 - // .bottomTextStyle()  
128 - }  
129 - .width('100%')  
130 - .justifyContent(FlexAlign.Start)  
131 - .margin({ top: 8 }) 112 + //bottom 评论等信息
  113 + CardSourceInfo({ contentDTO: this.contentDTO })
132 } 114 }
133 .width(CommonConstants.FULL_WIDTH) 115 .width(CommonConstants.FULL_WIDTH)
134 .padding({ 116 .padding({
1 import { ContentDTO } from 'wdBean'; 1 import { ContentDTO } from 'wdBean';
2 import { CommonConstants, CompStyle } from 'wdConstant'; 2 import { CommonConstants, CompStyle } from 'wdConstant';
3 -import { DateTimeUtils } from 'wdKit';  
4 import { ProcessUtils } from '../../utils/ProcessUtils'; 3 import { ProcessUtils } from '../../utils/ProcessUtils';
5 - 4 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
  5 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
6 const TAG: string = 'Card6Component-Card13Component'; 6 const TAG: string = 'Card6Component-Card13Component';
7 -const FULL_PARENT: string = '100%';  
8 7
9 /** 8 /**
10 - * 卡片样式:"appStyle":"6"以及13 9 + * 卡片样式:"appStyle":"6"以及13--- 小视频卡
11 */ 10 */
12 @Component 11 @Component
13 export struct Card6Component { 12 export struct Card6Component {
@@ -17,7 +16,17 @@ export struct Card6Component { @@ -17,7 +16,17 @@ export struct Card6Component {
17 Row() { 16 Row() {
18 Column() { 17 Column() {
19 Column() { 18 Column() {
20 - Text(this.contentDTO.newsTitle) 19 + // TODO 这个tag涉及样式问题。待优化。
  20 + // if (this.contentDTO.newTags) {
  21 + // Text(this.contentDTO.newTags)
  22 + // .backgroundColor($r('app.color.color_ED2800'))
  23 + // .borderRadius($r('app.float.button_border_radius'))
  24 + // .fontColor($r('app.color.color_fff'))
  25 + // .fontSize($r('app.float.font_size_12'))
  26 + // .padding(2)
  27 + // .margin({ right: 2 })
  28 + // }
  29 + Text(`${this.contentDTO.newsTitle}`)
21 .fontSize(16) 30 .fontSize(16)
22 .fontWeight(FontWeight.Normal) 31 .fontWeight(FontWeight.Normal)
23 .maxLines(3)// 32 .maxLines(3)//
@@ -26,93 +35,35 @@ export struct Card6Component { @@ -26,93 +35,35 @@ export struct Card6Component {
26 }.height("80%") 35 }.height("80%")
27 .justifyContent(FlexAlign.Start) 36 .justifyContent(FlexAlign.Start)
28 37
29 - Row() {  
30 - if (this.contentDTO.source) {  
31 - Text(this.contentDTO.source)  
32 - .fontSize($r('app.float.font_size_12'))  
33 - .fontColor(Color.Gray)  
34 - .maxLines(1)  
35 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
36 - .width(this.contentDTO.source.length > 8 ? '50%' : '')  
37 - Image($r('app.media.point'))  
38 - .width(16)  
39 - .height(16)  
40 - }  
41 - if (this.contentDTO.publishTime && this.contentDTO.publishTime.length === 13) {  
42 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))  
43 - .fontSize($r('app.float.font_size_12'))  
44 - .fontColor(Color.Gray)  
45 - }  
46 - Text(this.contentDTO.visitorComment + '评')  
47 - .fontSize($r('app.float.font_size_12'))  
48 - .fontColor(Color.Gray)  
49 - .padding({  
50 - left: 5  
51 - })  
52 - }.alignSelf(ItemAlign.Start)  
53 - .height("20%")  
54 - .justifyContent(FlexAlign.Start) 38 +
  39 + //bottom 评论等信息
  40 + CardSourceInfo({ contentDTO: this.contentDTO })
55 } 41 }
56 .alignItems(HorizontalAlign.Start) 42 .alignItems(HorizontalAlign.Start)
57 .justifyContent(FlexAlign.Start) 43 .justifyContent(FlexAlign.Start)
58 .width('58%') 44 .width('58%')
59 -  
60 - Blank(16)  
61 if (this.contentDTO.coverUrl) { 45 if (this.contentDTO.coverUrl) {
62 Stack() { 46 Stack() {
63 Image(this.contentDTO.coverUrl) 47 Image(this.contentDTO.coverUrl)
64 .borderRadius(5) 48 .borderRadius(5)
65 .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) 49 .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4)
66 .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 90 : 180) 50 .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 90 : 180)
67 - if (this.contentDTO.videoInfo) {  
68 - Row() {  
69 - Image($r('app.media.iv_card_play_yellow_flag'))  
70 - .width(22)  
71 - .height(18)  
72 - Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000))  
73 - .fontSize($r('app.float.font_size_13'))  
74 - .fontWeight(400)  
75 - .fontColor($r('app.color.color_fff'))  
76 - }  
77 - .alignItems(VerticalAlign.Bottom)  
78 - .height(18)  
79 - .padding({ right: 4 })  
80 - .margin({  
81 - right: 4,  
82 - bottom: 4  
83 - })  
84 - .backgroundColor($r('app.color.color_4d000000'))  
85 - } else if (this.contentDTO.voiceInfo) {  
86 - Row() {  
87 - Image($r('app.media.icon_listen'))  
88 - .width(22)  
89 - .height(18)  
90 - Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo  
91 - .voiceDuration * 1000))  
92 - .fontSize($r('app.float.font_size_13'))  
93 - .fontWeight(400)  
94 - .fontColor($r('app.color.color_fff'))  
95 - }  
96 - .alignItems(VerticalAlign.Bottom)  
97 - .height(18)  
98 - .padding({ right: 4 })  
99 - .margin({  
100 - right: 4,  
101 - bottom: 4  
102 - })  
103 - .backgroundColor($r('app.color.color_4d000000'))  
104 - }  
105 - }.alignContent(Alignment.BottomEnd) 51 + CardMediaInfo({ contentDTO: this.contentDTO })
  52 + }
  53 + .alignContent(Alignment.BottomEnd)
106 } 54 }
107 } 55 }
108 .onClick((event: ClickEvent) => { 56 .onClick((event: ClickEvent) => {
109 ProcessUtils.processPage(this.contentDTO) 57 ProcessUtils.processPage(this.contentDTO)
110 }) 58 })
111 - .padding(  
112 - { top: 16, bottom: 16, left: 14, right: 14 })  
113 - .width(FULL_PARENT) 59 + .padding({
  60 + left: $r('app.float.card_comp_pagePadding_lf'),
  61 + right: $r('app.float.card_comp_pagePadding_lf'),
  62 + top: $r('app.float.card_comp_pagePadding_tb'),
  63 + bottom: $r('app.float.card_comp_pagePadding_tb')
  64 + })
  65 + .width(CommonConstants.FULL_WIDTH)
114 .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 127 : 217) 66 .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 127 : 217)
115 .justifyContent(FlexAlign.SpaceBetween) 67 .justifyContent(FlexAlign.SpaceBetween)
116 -  
117 } 68 }
118 } 69 }
@@ -104,7 +104,7 @@ export struct Card9Component { @@ -104,7 +104,7 @@ export struct Card9Component {
104 Column() { 104 Column() {
105 Row() { 105 Row() {
106 // 标题 106 // 标题
107 - Image($r("app.media.point_icon")) 107 + Image($r("app.media.timeline_rect"))
108 .width(9) 108 .width(9)
109 .height(9) 109 .height(9)
110 .margin({ right: 5 }) 110 .margin({ right: 5 })
@@ -157,11 +157,11 @@ struct CreatorItem { @@ -157,11 +157,11 @@ struct CreatorItem {
157 .width(44) 157 .width(44)
158 .height(44) 158 .height(44)
159 if (this.isSelected) { 159 if (this.isSelected) {
160 - Image($r('app.media.MyCollection_selected_icon')) 160 + Image($r('app.media.rmh_selected'))
161 .width(16) 161 .width(16)
162 .height(16) 162 .height(16)
163 } else { 163 } else {
164 - Image($r('app.media.ic_succeed_refresh')) 164 + Image($r('app.media.rmh_unselected'))
165 .width(16) 165 .width(16)
166 .height(16) 166 .height(16)
167 } 167 }
  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 +@Observed
  40 +export class commentItemModel {
  41 + authorLike: string = ''
  42 + avatarFrame: string = ''
  43 + checkStatus: string = ''
  44 + childCommentNum: string = ''
  45 + childComments: commentItemModel[] = []
  46 + commentContent: string = ''
  47 + commentContentSensitive: string = ''
  48 + commentLevel: number = 0
  49 + commentPics: string = ''
  50 + commentSensitive: string = ''
  51 + commentType: number = 0
  52 + contentAuthor: number = 0
  53 + createTime: string = ''
  54 + creatorFlag: string = ''
  55 + fromCreatorId: string = ''
  56 + fromDeviceId: string = ''
  57 + fromUserHeader: string = ''
  58 + fromUserId: string = ''
  59 + fromUserName: string = ''
  60 + fromUserType: WDPublicUserType = 0
  61 + id: string = ''
  62 + likeNum: string = ''
  63 + /*是否点赞*/
  64 + isLike: boolean = false
  65 + mySelf: string = ''
  66 + parentId: string = ''
  67 + region: string = ''
  68 + replyNum: string = ''
  69 + rootCommentId: string = ''
  70 + sensitiveExist: string = ''
  71 + sensitiveShow: string = ''
  72 + toUserContentAuthor: string = ''
  73 + toUserId: string = ''
  74 + toUserName: string = ''
  75 + toUserType: string = ''
  76 + topFlag: string = ''
  77 + uuid: string = ''
  78 + /*本地使用,收起时默认3行 -1为不限制行数*/
  79 + maxLine: number = 3
  80 +
  81 + /*是否有展示更多*/
  82 + hasMore:boolean = false
  83 + /*当有展示更多的时候,当前的状态是展开还是收起*/
  84 + expanded:boolean = false
  85 +
  86 + highQualityExpireTime:string = '';
  87 + highQualityTime:string = '';
  88 + targetTitle:string = '';
  89 + targetStatus:string = '';
  90 + targetId:string = '';
  91 + targetRelId:string = '';
  92 + targetRelObjectId:string = '';
  93 + targetRelType:string = '';
  94 + targetType:string = '';
  95 + visitorComment:string = '';
  96 + shareInfo:commentItemShareInfoModel = new commentItemShareInfoModel;
  97 + // targetId:string = '';
  98 + // targetId:string = '';
  99 + // targetId:string = '';
  100 +
  101 +}
  102 +
  103 +export class commentItemShareInfoModel {
  104 + shareCoverUrl: string = ''
  105 + shareSummary: string = ''
  106 + shareTitle: string = ''
  107 + shareUrl: string = ''
  108 +}
  1 +import ArrayList from '@ohos.util.ArrayList'
  2 +import { ViewType } from 'wdConstant/Index';
  3 +import { DateTimeUtils, 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 +
  170 +
  171 + Text(DateTimeUtils.getCommentTime(Number.parseFloat(item.createTime)))
  172 + .fontColor($r('app.color.color_B0B0B0'))
  173 + .fontSize(12)
  174 +
  175 + Image($r('app.media.comment_hyphen_block'))
  176 + .size({
  177 + width: 4,
  178 + height: 4
  179 + })
  180 +
  181 + Text('回复')
  182 + .fontColor($r('app.color.color_222222'))
  183 + .fontSize(12)
  184 + .onClick(() => {
  185 + //TODO: 回复
  186 + })
  187 + }
  188 +
  189 + Row({ space: 6 }) {
  190 + Text(item.likeNum)
  191 + .fontColor($r('app.color.color_666666'))
  192 + .fontSize(14)
  193 +
  194 + Image($r('app.media.comment_like_normal'))
  195 + .size({
  196 + width: 16,
  197 + height: 16
  198 + })
  199 + .onClick(() => {
  200 + //TODO: 点赞
  201 + })
  202 + }
  203 +
  204 + }
  205 + .justifyContent(FlexAlign.SpaceBetween)
  206 + .height(30)
  207 + .margin({ left: 59, right: 16 })
  208 + }
  209 +
  210 + build() {
  211 + Column() {
  212 +
  213 + List() {
  214 + ListItemGroup({ header: this.titleHeader() })
  215 + LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
  216 + if (item.hasMore) {
  217 + ListItemGroup({ header: this.CommentHeaderItem(item), footer: this.GroupFooterView(item) }) {
  218 + ForEach(item.childComments, (childItem: commentItemModel, subIndex: number) => {
  219 + ListItem() {
  220 + ChildCommentItem();
  221 + }
  222 + })
  223 + }
  224 + }else {
  225 + ListItemGroup({ header: this.CommentHeaderItem(item)}) {
  226 + ForEach(item.childComments, (childItem: commentItemModel, subIndex: number) => {
  227 + ListItem() {
  228 + ChildCommentItem();
  229 + }
  230 + })
  231 + }
  232 + }
  233 + })
  234 + }.layoutWeight(1)
  235 + }
  236 + }
  237 +
  238 + //获取数据
  239 + async getData() {
  240 + this.browSingModel.currentPage = 1
  241 + commentViewModel.getCommentLocal(getContext()).then(commentListModel => {
  242 + if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {
  243 + commentListModel.hasMore = true;
  244 + this.browSingModel.viewType = ViewType.LOADED;
  245 + this.allDatas.push(...commentListModel.list)
  246 + if (commentListModel.list.length === this.browSingModel.pageSize) {
  247 + this.browSingModel.currentPage++;
  248 + this.browSingModel.hasMore = true;
  249 + } else {
  250 + this.browSingModel.hasMore = false;
  251 + }
  252 + } else {
  253 + this.browSingModel.viewType = ViewType.EMPTY;
  254 + }
  255 +
  256 +
  257 +
  258 + })
  259 + }
  260 +
  261 + /*回复评论*/
  262 + ReplyComment() {
  263 +
  264 + }
  265 +}
  266 +
  267 +
  268 +@Component
  269 +struct ChildCommentItem {
  270 + build() {
  271 + Text('child')
  272 + }
  273 +}
  274 +
  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 +}
  1 +import { ViewType } from 'wdConstant/Index'
  2 +import { DateTimeUtils, LazyDataSource, WindowModel } from 'wdKit/Index'
  3 +import { commentItemModel, commentListModel } from '../model/CommentModel'
  4 +import commentViewModel from '../viewmodel/CommentViewModel'
  5 +import { window } from '@kit.ArkUI'
  6 +
  7 +const TAG = 'QualityCommentsComponent';
  8 +
  9 +@Entry
  10 +@Preview
  11 +@Component
  12 +export struct QualityCommentsComponent {
  13 + bottomSafeHeight: string = AppStorage.get<number>('bottomSafeHeight') + 'px';
  14 + @State private browSingModel: commentListModel = new commentListModel()
  15 + isloading: boolean = false
  16 + lastWindowColor:string = '#ffffff'
  17 + currentWindowColor:string = '#FF4202'
  18 + @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
  19 +
  20 + aboutToDisappear(): void {
  21 +
  22 + const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
  23 + const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
  24 + windowClass.setWindowBackgroundColor(this.lastWindowColor)
  25 + windowClass.setWindowLayoutFullScreen(false)
  26 + // windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' })
  27 +
  28 + }
  29 +
  30 + aboutToAppear(): void {
  31 +
  32 + this.fullScreen();
  33 +
  34 +
  35 + commentViewModel.fetchQualityCommentListLocal(getContext()).then(commentListModel => {
  36 + this.allDatas.push(...commentListModel.list)
  37 + })
  38 +
  39 + // commentViewModel.fetchQualityCommentList('1').then((commentListModel) => {
  40 + // if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {
  41 + // // commentListModel.hasMore = true;
  42 + // // this.browSingModel.viewType = ViewType.LOADED;
  43 + // this.allDatas.push(...commentListModel.list)
  44 + // // if (commentListModel.list.length === this.browSingModel.pageSize) {
  45 + // // this.browSingModel.currentPage++;
  46 + // // this.browSingModel.hasMore = true;
  47 + // // } else {
  48 + // // this.browSingModel.hasMore = false;
  49 + // // }
  50 + // } else {
  51 + // this.browSingModel.viewType = ViewType.EMPTY;
  52 + // }
  53 + // })
  54 + }
  55 +
  56 + fullScreen() {
  57 + const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
  58 + const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
  59 + // windowClass.setWindowBackgroundColor(this.currentWindowColor)
  60 + windowClass.setWindowLayoutFullScreen(true)
  61 + // windowClass.setWindowSystemBarProperties({ statusBarColor: '#fff' })
  62 +
  63 + // windowClass.setWindowLayoutFullScreen(true).then(() => {
  64 + // console.log(TAG + 'setWindowLayoutFullScreen');
  65 + // })
  66 +
  67 + }
  68 +
  69 + @Builder
  70 + titleHeader() {
  71 + Row() {
  72 + Image($r('app.media.comment_img_banner')).width('100%').aspectRatio(375 / 283);
  73 + }
  74 + }
  75 +
  76 + build() {
  77 + Column() {
  78 + // this.titleHeader()
  79 + List({ space: 28 }) {
  80 + ListItemGroup({ header: this.titleHeader() })
  81 +
  82 + LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
  83 + ListItem() {
  84 + QualityCommentItem({ item: item }).margin({ left: 12, right: 12 })
  85 + }
  86 + // .offset({
  87 + // y:-87
  88 + // })
  89 + })
  90 + }
  91 + // .contentStartOffset(- 87)
  92 + .edgeEffect(EdgeEffect.Spring)
  93 + .margin({bottom:this.bottomSafeHeight})
  94 + // .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
  95 + }.backgroundColor(this.currentWindowColor).height('100%').width('100%')
  96 + }
  97 +}
  98 +
  99 +
  100 +@Component
  101 +struct QualityCommentItem {
  102 + @ObjectLink item: commentItemModel
  103 +
  104 + build() {
  105 + Column() {
  106 + /*头像以及昵称*/
  107 + RelativeContainer() {
  108 + Image(this.item.fromUserHeader)
  109 + .width(50)
  110 + .height(50)
  111 + .borderRadius(25)
  112 + .borderWidth(2)
  113 + .borderColor(Color.White)
  114 + .id('image1')
  115 + .alignRules({
  116 + top: { anchor: "__container__", align: VerticalAlign.Top },
  117 + left: { anchor: "__container__", align: HorizontalAlign.Start }
  118 + })
  119 + .offset(
  120 + {
  121 + y: -16
  122 + }
  123 + )
  124 + Text(this.item.fromUserName)
  125 + .fontSize(14)
  126 + .fontColor('#222222')
  127 + .fontWeight(FontWeight.Medium)
  128 + .id('text1')
  129 + .alignRules({
  130 + bottom: { anchor: "image1", align: VerticalAlign.Bottom },
  131 + left: { anchor: "image1", align: HorizontalAlign.End }
  132 + })
  133 + .offset(
  134 + {
  135 + x: 6,
  136 + y: -6 - 16
  137 + }
  138 + )
  139 + }.height(42)
  140 +
  141 + Column() {
  142 + /*评论内容*/
  143 + Text() {
  144 + ImageSpan($r('app.media.WDBestCommentTitleDotIcon'))
  145 + .width(12)
  146 + .height(12)
  147 + .objectFit(ImageFit.Fill)
  148 + .offset({
  149 + y: -6
  150 + })
  151 + Span(' ' + this.item.commentContent)
  152 + .fontSize(16)
  153 + .fontColor('#222222')
  154 + .fontWeight(FontWeight.Medium)
  155 + }.margin({ top: 10 })
  156 +
  157 + /*分割线*/
  158 + Row() {
  159 +
  160 + }.width('100%').margin({ top: 10, left: 0, right: 0 }).backgroundColor('#EDEDED').height(2.5);
  161 +
  162 + /*文章或者评论*/
  163 + Row() {
  164 + Row() {
  165 + Image($r('app.media.comment_img_link')).width(16).height(16)
  166 + Text(this.item.shareInfo.shareTitle)
  167 + .fontSize(14)
  168 + .fontColor('#666666')
  169 + .margin({ left: 6, right: 12 })
  170 + .maxLines(1)
  171 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  172 + }.height(40).layoutWeight(1)
  173 +
  174 + Image($r('app.media.more')).width(12).height(12)
  175 +
  176 + }.width('100%').height(40).justifyContent(FlexAlign.SpaceBetween)
  177 +
  178 + }
  179 + .backgroundColor('#F9F9F9')
  180 + .width('100%')
  181 + .alignItems(HorizontalAlign.Start)
  182 + .borderRadius(4)
  183 + .padding({ left: 12, right: 12 })
  184 +
  185 + /*时间 点赞评论*/
  186 + Row() {
  187 +
  188 + Text(DateTimeUtils.getCommentTime(DateTimeUtils.getDateTimestamp(this.item.createTime))).fontSize(14).fontColor('#999999')
  189 +
  190 + Row({space:16}){
  191 + Row(){
  192 + Image($r('app.media.comment_icon_pinglun')).width(16).height(16)
  193 + }
  194 +
  195 + Row(){
  196 + //comment_like_select
  197 + Image($r(this.item.likeNum?'app.media.comment_like_select':'app.media.comment_like_normal')).width(16).height(16)
  198 + if (this.item.likeNum){Text(this.item.likeNum).fontColor(this.item.isLike?'#ED2800':'#999999').fontSize(14).margin({left:3})}
  199 + }
  200 + }
  201 + }.height(38).width('100%').justifyContent(FlexAlign.SpaceBetween)
  202 +
  203 + }.backgroundColor('#FFFFFF').padding({ top: 0, left: 16, right: 16 }).borderRadius(4)
  204 +
  205 + }
  206 +}
  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 + /*获取本地mock数据*/
  36 + async fetchQualityCommentListLocal(context: Context): Promise<commentListModel> {
  37 + Logger.info(TAG, `getBottomNavDataMock start`);
  38 + let compRes: ResponseDTO<commentListModel> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<commentListModel>>(context,'qualityComment_local.json' );
  39 + if (!compRes || !compRes.data) {
  40 + Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`);
  41 + return new commentListModel()
  42 + }
  43 + Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
  44 + return compRes.data
  45 + }
  46 +
  47 +
  48 +
  49 + //qualityComment_local.json
  50 + fetchQualityCommentList(pageNum: string) {
  51 + let url = HttpUrlUtils.getQualityCommentUrl() + `?&pageSize=${10}&pageNum=${pageNum}`
  52 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  53 + return new Promise<commentListModel>((success, fail) => {
  54 + HttpRequest.get<ResponseDTO<commentListModel>>(url, headers).then((data: ResponseDTO<commentListModel>) => {
  55 + if (!data || !data.data) {
  56 + fail("数据为空")
  57 + return
  58 + }
  59 + if (data.code != 0) {
  60 + fail(data.message)
  61 + return
  62 + }
  63 + let listData = data.data as commentListModel
  64 +
  65 + success(listData)
  66 + }, (error: Error) => {
  67 + fail(error.message)
  68 + Logger.debug(TAG, error.toString())
  69 + })
  70 + })
  71 + }
  72 +
  73 +
  74 + // BaseGetRequest(contentID:number,contentType:string,pageNum:string){
  75 + // let url = HttpUrlUtils.getMyCollectionListDataUrl()+ `?type=${type}&operateTag=${1}&pageSize=${10}&pageNum=${pageNum}`
  76 + // if (tagId.length > 0) {
  77 + // url = url + `&tagId=${tagId}`
  78 + // }
  79 + // let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders()
  80 + // return WDHttp.get<ResponseDTO<commentListModel>>(url, headers)
  81 + // }
  82 + //
  83 + //
  84 + // fetchCommentList(contentID:number,contentType:string,pageNum:string):Promise<commentListModel>{
  85 + // return new Promise<commentListModel>((success,error) => {
  86 + // this.BaseGetRequest(contentID,contentType,pageNum).then((navResDTO: ResponseDTO<commentListModel>) => {
  87 + // if (!navResDTO || navResDTO.code != 0) {
  88 + // // success(this.getAppointmentListDataLocal(context))
  89 + // return
  90 + // }
  91 + // Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
  92 + // let listData = navResDTO.data as commentListModel
  93 + // success(listData)
  94 + // }).catch((err: Error) => {
  95 + // Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
  96 + // error("page data invalid");
  97 + // })
  98 + // })
  99 + // }
  100 +
  101 +
  102 +}
  103 +
  104 +
  105 +const commentViewModel = CommentViewModel.getInstance();
  106 +
  107 +export default commentViewModel as CommentViewModel
@@ -33,8 +33,8 @@ export default struct MinePageUserSimpleInfoUI { @@ -33,8 +33,8 @@ export default struct MinePageUserSimpleInfoUI {
33 Stack(){ 33 Stack(){
34 Image(this.headPhotoUrl) 34 Image(this.headPhotoUrl)
35 .alt($r('app.media.default_head')) 35 .alt($r('app.media.default_head'))
36 - .width('108lpx')  
37 - .height('108lpx') 36 + .width('100lpx')
  37 + .height('100lpx')
38 .objectFit(ImageFit.Cover) 38 .objectFit(ImageFit.Cover)
39 .borderRadius(50) 39 .borderRadius(50)
40 Image(this.levelHead) 40 Image(this.levelHead)
@@ -18,7 +18,7 @@ export struct FollowFirstTabsComponent{ @@ -18,7 +18,7 @@ export struct FollowFirstTabsComponent{
18 value.forEach((element)=>{ 18 value.forEach((element)=>{
19 this.data.push(element) 19 this.data.push(element)
20 }) 20 })
21 - console.log("ycg",this.data.length.toString()); 21 +
22 if(this.controller != null && this.data.length>1 && this.changeIndex === 1){ 22 if(this.controller != null && this.data.length>1 && this.changeIndex === 1){
23 //个人主页 跳转 关注页 tab 2 23 //个人主页 跳转 关注页 tab 2
24 let intervalID = setInterval(() => { 24 let intervalID = setInterval(() => {
@@ -171,6 +171,7 @@ struct ChildComponent { @@ -171,6 +171,7 @@ struct ChildComponent {
171 .fontSize('31lpx') 171 .fontSize('31lpx')
172 .lineHeight('38lpx') 172 .lineHeight('38lpx')
173 .fontColor($r('app.color.color_222222')) 173 .fontColor($r('app.color.color_222222'))
  174 + .maxLines(1)
174 Text(`粉丝${this.data.cnFansNum}`) 175 Text(`粉丝${this.data.cnFansNum}`)
175 .fontColor($r('app.color.color_B0B0B0')) 176 .fontColor($r('app.color.color_B0B0B0'))
176 .fontSize('23lpx') 177 .fontSize('23lpx')
@@ -35,25 +35,45 @@ export struct FollowSecondTabsComponent{ @@ -35,25 +35,45 @@ export struct FollowSecondTabsComponent{
35 35
36 @Builder FollowSecondUI(){ 36 @Builder FollowSecondUI(){
37 Row() { 37 Row() {
  38 + Row(){
  39 + // 页签
  40 + Column({ space: 7 }) {
  41 + Scroll() {
  42 + Column() {
  43 + ForEach(this.data[this.firstIndex].children, (item: FollowSecondListItem, index: number ) => {
  44 + this.TabBuilder(index,item)
  45 + })
  46 + }
  47 + .justifyContent(FlexAlign.Start)
  48 + }
  49 + .align(Alignment.Top)
  50 + .scrollable(ScrollDirection.Vertical)
  51 + .scrollBar(BarState.Off)
  52 + .height('100%')
  53 + }.height('100%')
  54 + .alignItems(HorizontalAlign.Center)
  55 + }
  56 + .alignItems(VerticalAlign.Top)
  57 + .height('100%')
  58 +
38 Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { 59 Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
39 ForEach(this.data[this.firstIndex].children, (item: FollowSecondListItem, index: number ) => { 60 ForEach(this.data[this.firstIndex].children, (item: FollowSecondListItem, index: number ) => {
40 TabContent(){ 61 TabContent(){
41 FollowThirdTabsComponent({data:$data,firstIndex:$firstIndex,secondIndex:index}) 62 FollowThirdTabsComponent({data:$data,firstIndex:$firstIndex,secondIndex:index})
42 - }.tabBar(this.TabBuilder(index,item)) 63 + }
43 .backgroundColor($r('app.color.white')) 64 .backgroundColor($r('app.color.white'))
44 }, (item: FollowListItem, index: number) => index.toString()) 65 }, (item: FollowListItem, index: number) => index.toString())
45 } 66 }
46 .vertical(true) 67 .vertical(true)
47 .barMode(BarMode.Scrollable) 68 .barMode(BarMode.Scrollable)
48 - .barWidth('140lpx')  
49 .animationDuration(0) 69 .animationDuration(0)
50 .onChange((index: number) => { 70 .onChange((index: number) => {
51 this.currentIndex = index 71 this.currentIndex = index
52 }) 72 })
53 - .width('100%') 73 + .barWidth(0)
  74 + .height('100%')
  75 + .layoutWeight(1)
54 }.width('100%') 76 }.width('100%')
55 - .alignItems(VerticalAlign.Top)  
56 - .backgroundColor('#0FF')  
57 } 77 }
58 78
59 @Builder TabBuilder(index: number, item: FollowSecondListItem) { 79 @Builder TabBuilder(index: number, item: FollowSecondListItem) {
@@ -73,6 +93,7 @@ export struct FollowSecondTabsComponent{ @@ -73,6 +93,7 @@ export struct FollowSecondTabsComponent{
73 }) 93 })
74 .justifyContent(FlexAlign.Center) 94 .justifyContent(FlexAlign.Center)
75 .height('84lpx') 95 .height('84lpx')
  96 + .width('140lpx')
76 .backgroundColor(this.currentIndex === index?$r('app.color.white'):$r('app.color.color_F9F9F9')) 97 .backgroundColor(this.currentIndex === index?$r('app.color.white'):$r('app.color.color_F9F9F9'))
77 } 98 }
78 99
@@ -34,19 +34,45 @@ export struct FollowThirdTabsComponent{ @@ -34,19 +34,45 @@ export struct FollowThirdTabsComponent{
34 .lineHeight('38lpx') 34 .lineHeight('38lpx')
35 .backgroundColor($r('app.color.color_F9F9F9')) 35 .backgroundColor($r('app.color.color_F9F9F9'))
36 .padding('13lpx') 36 .padding('13lpx')
  37 + .maxLines(1)
37 } 38 }
38 .onClick(()=>{ 39 .onClick(()=>{
39 this.currentIndex = index 40 this.currentIndex = index
40 this.controller.changeIndex(this.currentIndex) 41 this.controller.changeIndex(this.currentIndex)
41 }) 42 })
42 - .height('100%') 43 + .height('84lpx')
43 .margin({right:'9lpx'}) 44 .margin({right:'9lpx'})
44 .padding({left:'20lpx',right:index === this.data[this.firstIndex].children[this.secondIndex].children.length-1?"20lpx":"0lpx"}) 45 .padding({left:'20lpx',right:index === this.data[this.firstIndex].children[this.secondIndex].children.length-1?"20lpx":"0lpx"})
45 .justifyContent(FlexAlign.Center) 46 .justifyContent(FlexAlign.Center)
46 } 47 }
47 48
48 @Builder FollowThirdUI(){ 49 @Builder FollowThirdUI(){
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 }
@@ -90,6 +90,7 @@ export struct OtherHomePageBottomCommentComponent{ @@ -90,6 +90,7 @@ export struct OtherHomePageBottomCommentComponent{
90 MinePageDatasModel.getOtherCommentListData(object,getContext(this)).then((value)=>{ 90 MinePageDatasModel.getOtherCommentListData(object,getContext(this)).then((value)=>{
91 if (!this.data_comment || value.list.length == 0){ 91 if (!this.data_comment || value.list.length == 0){
92 this.hasMore = false 92 this.hasMore = false
  93 + this.isLoading = false
93 }else{ 94 }else{
94 this.getCommentListStatus(value) 95 this.getCommentListStatus(value)
95 } 96 }
@@ -60,6 +60,7 @@ export struct BottomNavigationComponent { @@ -60,6 +60,7 @@ export struct BottomNavigationComponent {
60 MinePageComponent() 60 MinePageComponent()
61 } else { 61 } else {
62 TopNavigationComponent({ 62 TopNavigationComponent({
  63 + groupId: navItem.id,
63 topNavList: navItem.topNavChannelList, 64 topNavList: navItem.topNavChannelList,
64 _currentNavIndex: this.currentNavIndex, 65 _currentNavIndex: this.currentNavIndex,
65 changeBarBackgroundColor: (color: Color) => { 66 changeBarBackgroundColor: (color: Color) => {
@@ -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)
@@ -84,9 +84,13 @@ struct EditUserInfoPage { @@ -84,9 +84,13 @@ struct EditUserInfoPage {
84 Blank() 84 Blank()
85 85
86 Text(r.subTitle) 86 Text(r.subTitle)
  87 + .textOverflow({overflow:TextOverflow.Ellipsis})
  88 + .maxLines(1)
87 .fontSize(16) 89 .fontSize(16)
88 .fontColor(Color.Gray) 90 .fontColor(Color.Gray)
89 .padding({right:10}) 91 .padding({right:10})
  92 + .width('70%')
  93 + .textAlign(TextAlign.End)
90 94
91 Image($r('app.media.mine_user_edit')) 95 Image($r('app.media.mine_user_edit'))
92 .width('12') 96 .width('12')
@@ -130,10 +134,11 @@ struct EditUserInfoPage { @@ -130,10 +134,11 @@ struct EditUserInfoPage {
130 }) 134 })
131 }else if(i === 5){ 135 }else if(i === 5){
132 TextPickerDialog.show({ 136 TextPickerDialog.show({
133 - range:['女','男'], 137 + range:['男','女'],
  138 + canLoop:false,
134 selected:0, 139 selected:0,
135 onAccept:(value:TextPickerResult) => { 140 onAccept:(value:TextPickerResult) => {
136 - this.currentUserInfo.userExtend.sex = value.index as number; 141 + this.currentUserInfo.userExtend.sex = value.index == 0?1:0;
137 this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_sex 142 this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_sex
138 this.updateEditModel() 143 this.updateEditModel()
139 } 144 }
@@ -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,9 @@ import NoMoreLayout from './NoMoreLayout'; @@ -11,8 +11,9 @@ 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 { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';  
15 -import { CompDTO, LiveReviewDTO, PageDTO } from 'wdBean'; 14 +import { GroupInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO';
  15 +import { CompDTO, LiveReviewDTO, PageDTO, PageInfoBean } from 'wdBean';
  16 +
16 17
17 const TAG = 'PageComponent'; 18 const TAG = 'PageComponent';
18 19
@@ -38,7 +39,6 @@ export struct PageComponent { @@ -38,7 +39,6 @@ export struct PageComponent {
38 totalCount: 0, 39 totalCount: 0,
39 list: [] 40 list: []
40 }; 41 };
41 - name: string = "";  
42 @Link @Watch('onChange') currentTopNavSelectedIndex: number 42 @Link @Watch('onChange') currentTopNavSelectedIndex: number
43 43
44 build() { 44 build() {
@@ -69,6 +69,7 @@ export struct PageComponent { @@ -69,6 +69,7 @@ export struct PageComponent {
69 @Builder 69 @Builder
70 ListLayout() { 70 ListLayout() {
71 List() { 71 List() {
  72 +
72 // 下拉刷新 73 // 下拉刷新
73 ListItem() { 74 ListItem() {
74 RefreshLayout({ 75 RefreshLayout({
@@ -80,12 +81,7 @@ export struct PageComponent { @@ -80,12 +81,7 @@ export struct PageComponent {
80 LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => { 81 LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {
81 ListItem() { 82 ListItem() {
82 Column() { 83 Column() {
83 - if (this.name == '视频') {  
84 - VideoChannelDetail()  
85 - } else {  
86 - CompParser({ compDTO: compDTO, compIndex: compIndex });  
87 - }  
88 - 84 + CompParser({ compDTO: compDTO, compIndex: compIndex });
89 } 85 }
90 } 86 }
91 }, 87 },
@@ -103,6 +99,7 @@ export struct PageComponent { @@ -103,6 +99,7 @@ export struct PageComponent {
103 NoMoreLayout() 99 NoMoreLayout()
104 } 100 }
105 } 101 }
  102 +
106 } 103 }
107 .scrollBar(BarState.Off) 104 .scrollBar(BarState.Off)
108 .cachedCount(8) 105 .cachedCount(8)
@@ -135,7 +132,8 @@ export struct PageComponent { @@ -135,7 +132,8 @@ export struct PageComponent {
135 132
136 onChange() { 133 onChange() {
137 Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , ${this.isFirstIn} , navIndex: ${this.currentTopNavSelectedIndex}`); 134 Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , ${this.isFirstIn} , navIndex: ${this.currentTopNavSelectedIndex}`);
138 - if (this.navIndex === this.currentTopNavSelectedIndex && !this.isFirstIn) { 135 + // if (this.navIndex === this.currentTopNavSelectedIndex && !this.isFirstIn) {
  136 + if (this.navIndex === this.currentTopNavSelectedIndex) {
139 this.getData(); 137 this.getData();
140 } 138 }
141 } 139 }
@@ -155,10 +153,105 @@ export struct PageComponent { @@ -155,10 +153,105 @@ export struct PageComponent {
155 this.pageModel.viewType = ViewType.EMPTY; 153 this.pageModel.viewType = ViewType.EMPTY;
156 return; 154 return;
157 } 155 }
  156 + if (this.navIndex === 0) {
  157 + await this.getVideoListData(pageInfo);
  158 + } else {
  159 + await this.getLiveListData(pageInfo);
  160 + }
  161 +
  162 +
  163 + }
  164 +
  165 + private async getVideoListData(pageInfo: PageInfoBean) {
  166 + let groupInfo: GroupInfoDTO = CollectionUtils.getElement(pageInfo.groups, 0);
  167 + if (groupInfo != null) {
  168 + this.pageModel.isRecGroup = groupInfo.groupStrategy === 1;
  169 + this.pageModel.groupId = groupInfo.id;
  170 + }
  171 + // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代
  172 + // for (const group of pageInfo.groups) {
  173 + this.pageDto = await PageViewModel.getPageData(this.pageModel, getContext(this));
  174 + this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString();
  175 + if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) {
  176 + this.pageDto.compList.forEach((comp) => {
  177 + if (comp.compStyle === CompStyle.Zh_Grid_Layout_02 && this.liveReviewDTO && this.liveReviewDTO.list && this.liveReviewDTO.list.length > 0) {
  178 + comp.operDataList.push(...this.liveReviewDTO.list);
  179 + }
  180 + });
  181 +
  182 + this.pageModel.viewType = ViewType.LOADED;
  183 + this.pageModel.compList.push(...this.pageDto.compList);
  184 + if (this.pageDto.compList.length === this.pageModel.pageSize) {
  185 + this.pageModel.currentPage++;
  186 + this.pageModel.hasMore = true;
  187 + } else {
  188 + this.pageModel.hasMore = false;
  189 + }
  190 + // // 二次请求,批查互动数据
  191 + // PageViewModel.getInteractData(pageDto.compList).then((data: CompDTO[]) => {
  192 + // // 刷新,替换所有数据
  193 + // this.pageModel.compList.replaceAll(...data)
  194 + // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
  195 + // })
  196 + this.isFirstIn = false;
  197 + Logger.debug(TAG, 'cj111');
  198 + // } else {
  199 + // Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.');
  200 + // this.pageModel.viewType = ViewType.EMPTY;
  201 + // }
  202 + }
  203 + }
  204 +
  205 + // private async getLiveListData(pageInfo: PageInfoBean) {
  206 + // // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代
  207 + // for (const group of pageInfo.groups) {
  208 + // this.pageDto = await PageViewModel.getPageData(this.pageModel, getContext(this));
  209 + // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString();
  210 + // if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) {
  211 + // this.pageDto.compList.forEach((comp) => {
  212 + // if (comp.compStyle === CompStyle.Zh_Grid_Layout_02 && this.liveReviewDTO && this.liveReviewDTO.list && this.liveReviewDTO.list.length > 0) {
  213 + // comp.operDataList.push(...this.liveReviewDTO.list);
  214 + // }
  215 + // });
  216 + //
  217 + // this.pageModel.viewType = ViewType.LOADED;
  218 + // this.pageModel.compList.push(...this.pageDto.compList);
  219 + // if (this.pageDto.compList.length === this.pageModel.pageSize) {
  220 + // this.pageModel.currentPage++;
  221 + // this.pageModel.hasMore = true;
  222 + // } else {
  223 + // this.pageModel.hasMore = false;
  224 + // }
  225 + // // // 二次请求,批查互动数据
  226 + // // PageViewModel.getInteractData(pageDto.compList).then((data: CompDTO[]) => {
  227 + // // // 刷新,替换所有数据
  228 + // // this.pageModel.compList.replaceAll(...data)
  229 + // // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
  230 + // // })
  231 + // this.isFirstIn = false;
  232 + // Logger.debug(TAG, 'cj111');
  233 + // // } else {
  234 + // // Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.');
  235 + // // this.pageModel.viewType = ViewType.EMPTY;
  236 + // }
  237 + // }
  238 + // }
  239 +
  240 + async getLiveListData(pageInfo: PageInfoBean) {
  241 + // Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
  242 + // this.pageModel.pageId = this.pageId;
  243 + // this.pageModel.groupId = this.pageId;
  244 + // this.pageModel.channelId = this.channelId;
  245 + // this.pageModel.currentPage = 1;
  246 + // let pageInfo = await PageViewModel.getPageUrlData(this.pageModel.pageId);
  247 + // if (pageInfo == null) {
  248 + // this.pageModel.viewType = ViewType.EMPTY;
  249 + // return;
  250 + // }
158 Logger.debug(TAG, 'getPageUrlData ' + pageInfo.id); 251 Logger.debug(TAG, 'getPageUrlData ' + pageInfo.id);
159 // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代 252 // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代
160 for (const group of pageInfo.groups) { 253 for (const group of pageInfo.groups) {
161 - this.pageDto = await PageViewModel.getPageData(this.pageModel.pageId, `${group.id}`, this.pageModel.channelId 254 + this.pageDto = await PageViewModel.getLivePageData(this.pageModel.pageId, `${group.id}`, this.pageModel.channelId, group.groupStrategy
162 , this.pageModel.currentPage, this.pageModel.pageSize, getContext(this)) 255 , this.pageModel.currentPage, this.pageModel.pageSize, getContext(this))
163 this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() 256 this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
164 if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) { 257 if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) {
@@ -176,50 +269,18 @@ export struct PageComponent { @@ -176,50 +269,18 @@ export struct PageComponent {
176 } else { 269 } else {
177 this.pageModel.hasMore = false; 270 this.pageModel.hasMore = false;
178 } 271 }
179 - // // 二次请求,批查互动数据  
180 - // PageViewModel.getInteractData(pageDto.compList).then((data: CompDTO[]) => {  
181 - // // 刷新,替换所有数据  
182 - // this.pageModel.compList.replaceAll(...data)  
183 - // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()  
184 - // }) 272 + // 二次请求,批查互动数据
  273 + PageViewModel.getInteractData(this.pageDto.compList).then((data: CompDTO[]) => {
  274 + // 刷新,替换所有数据
  275 + this.pageModel.compList.replaceAll(...data)
  276 + this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
  277 + })
185 this.isFirstIn = false 278 this.isFirstIn = false
186 - Logger.debug(TAG, 'cj111');  
187 } else { 279 } else {
188 Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.'); 280 Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.');
189 this.pageModel.viewType = ViewType.EMPTY; 281 this.pageModel.viewType = ViewType.EMPTY;
190 } 282 }
191 } 283 }
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 } 284 }
224 285
225 async getPreviewData() { 286 async getPreviewData() {
@@ -6,6 +6,7 @@ import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'; @@ -6,6 +6,7 @@ import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout';
6 import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent'; 6 import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent';
7 import window from '@ohos.window'; 7 import window from '@ohos.window';
8 import { WindowModel } from 'wdKit'; 8 import { WindowModel } from 'wdKit';
  9 +import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';
9 10
10 const TAG = 'TopNavigationComponent'; 11 const TAG = 'TopNavigationComponent';
11 12
@@ -20,6 +21,7 @@ const storage = LocalStorage.getShared(); @@ -20,6 +21,7 @@ const storage = LocalStorage.getShared();
20 @Entry(storage) 21 @Entry(storage)
21 @Component 22 @Component
22 export struct TopNavigationComponent { 23 export struct TopNavigationComponent {
  24 + private groupId: number = 0
23 private tabsController: TabsController = new TabsController() 25 private tabsController: TabsController = new TabsController()
24 private changeBarBackgroundColor: (color: Color) => void = () => { 26 private changeBarBackgroundColor: (color: Color) => void = () => {
25 } 27 }
@@ -236,15 +238,23 @@ export struct TopNavigationComponent { @@ -236,15 +238,23 @@ export struct TopNavigationComponent {
236 Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) { 238 Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) {
237 ForEach(this._currentNavIndex === 0 ? this.myChannelList : this.topNavList, (navItem: TopNavDTO, index: number) => { 239 ForEach(this._currentNavIndex === 0 ? this.myChannelList : this.topNavList, (navItem: TopNavDTO, index: number) => {
238 TabContent() { 240 TabContent() {
239 - if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {  
240 - PageComponent({  
241 - currentTopNavSelectedIndex: $currentTopNavSelectedIndex,  
242 - navIndex: index, 241 + if (this._currentNavIndex === 2 && navItem.name === '视频') {
  242 + VideoChannelDetail({
  243 + bottomNavIndex: this._currentNavIndex,
  244 + topNavIndex: this.currentTopNavSelectedIndex,
  245 + groupId: this.groupId + '',
243 pageId: navItem.pageId + '', 246 pageId: navItem.pageId + '',
244 channelId: navItem.channelId + '', 247 channelId: navItem.channelId + '',
245 - name: navItem.name  
246 }) 248 })
247 - } 249 + } else
  250 + if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
  251 + PageComponent({
  252 + currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
  253 + navIndex: index,
  254 + pageId: navItem.pageId + '',
  255 + channelId: navItem.channelId + '',
  256 + })
  257 + }
248 } 258 }
249 .tabBar(this.tabBarBuilder(navItem, index)) 259 .tabBar(this.tabBarBuilder(navItem, index))
250 260
@@ -128,7 +128,7 @@ export struct SearchComponent { @@ -128,7 +128,7 @@ export struct SearchComponent {
128 * @param content 128 * @param content
129 */ 129 */
130 getSearchHistoryResData(content:string,index:number){ 130 getSearchHistoryResData(content:string,index:number){
131 - //删除单记录 131 + //删除单记录
132 SearcherAboutDataModel.delSearchSingleHistoryData(index) 132 SearcherAboutDataModel.delSearchSingleHistoryData(index)
133 this.isClickedHistory = true 133 this.isClickedHistory = true
134 this.searchResData(content) 134 this.searchResData(content)
@@ -149,33 +149,6 @@ export struct SearchComponent { @@ -149,33 +149,6 @@ export struct SearchComponent {
149 this.getSearchResultCountData() 149 this.getSearchResultCountData()
150 } 150 }
151 151
152 - getSearchResultCountData() {  
153 - SearcherAboutDataModel.getSearchResultCountData(encodeURI(this.searchText),getContext(this)).then((value) => {  
154 - if (value != null) {  
155 - this.count = []  
156 - if(value.allTotal!=0){  
157 - this.count.push("全部")  
158 - }  
159 - if(value.cmsTotal!=0){  
160 - this.count.push("精选")  
161 - }  
162 - if(value.rmhTotal!=0){  
163 - this.count.push("人民号")  
164 - }  
165 - if(value.videoTotal!=0){  
166 - this.count.push("视频")  
167 - }  
168 - if(value.activityTotal!=0){  
169 - this.count.push("活动")  
170 - }  
171 - }  
172 - }).catch((err: Error) => {  
173 - console.log(TAG, JSON.stringify(err))  
174 - })  
175 - }  
176 -  
177 -  
178 -  
179 /** 152 /**
180 * 点击联想搜索列表回调 153 * 点击联想搜索列表回调
181 * @param content 154 * @param content
@@ -291,4 +264,30 @@ export struct SearchComponent { @@ -291,4 +264,30 @@ export struct SearchComponent {
291 .padding({ left: '31lpx' }) 264 .padding({ left: '31lpx' })
292 .alignItems(VerticalAlign.Center) 265 .alignItems(VerticalAlign.Center)
293 } 266 }
  267 +
  268 +
  269 + getSearchResultCountData() {
  270 + SearcherAboutDataModel.getSearchResultCountData(encodeURI(this.searchText),getContext(this)).then((value) => {
  271 + if (value != null) {
  272 + this.count = []
  273 + if(value.allTotal!=0){
  274 + this.count.push("全部")
  275 + }
  276 + if(value.cmsTotal!=0){
  277 + this.count.push("精选")
  278 + }
  279 + if(value.rmhTotal!=0){
  280 + this.count.push("人民号")
  281 + }
  282 + if(value.videoTotal!=0){
  283 + this.count.push("视频")
  284 + }
  285 + if(value.activityTotal!=0){
  286 + this.count.push("活动")
  287 + }
  288 + }
  289 + }).catch((err: Error) => {
  290 + console.log(TAG, JSON.stringify(err))
  291 + })
  292 + }
294 } 293 }
  1 +import { SearchResultContentComponent } from './SearchResultContentComponent'
1 2
2 const TAG = "SearchResultComponent" 3 const TAG = "SearchResultComponent"
3 /** 4 /**
@@ -19,7 +20,7 @@ export struct SearchResultComponent{ @@ -19,7 +20,7 @@ export struct SearchResultComponent{
19 Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { 20 Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
20 ForEach(this.count, (item: string, index: number ) => { 21 ForEach(this.count, (item: string, index: number ) => {
21 TabContent(){ 22 TabContent(){
22 - Text(item) 23 + SearchResultContentComponent({keywords:this.searchText,searchType:item})
23 }.tabBar(this.TabBuilder(index,item)) 24 }.tabBar(this.TabBuilder(index,item))
24 }, (item: string, index: number) => index.toString()) 25 }, (item: string, index: number) => index.toString())
25 } 26 }
@@ -63,4 +64,5 @@ export struct SearchResultComponent{ @@ -63,4 +64,5 @@ export struct SearchResultComponent{
63 .margin({right:'9lpx'}) 64 .margin({right:'9lpx'})
64 .padding({left:'31lpx',right:index === this.count.length-1?"31lpx":"0lpx"}) 65 .padding({left:'31lpx',right:index === this.count.length-1?"31lpx":"0lpx"})
65 } 66 }
  67 +
66 } 68 }
  1 +import { ContentDTO,
  2 + contentListParams,
  3 + FullColumnImgUrlDTO, InteractDataDTO, RmhInfoDTO, VideoInfoDTO } from 'wdBean/Index'
  4 +import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO'
  5 +import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO'
  6 +import { LazyDataSource, StringUtils } from 'wdKit/Index'
  7 +import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
  8 +import { SearchResultContentData } from '../../viewmodel/SearchResultContentData'
  9 +import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
  10 +import { CardParser } from '../CardParser'
  11 +import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI'
  12 +
  13 +const TAG = "SearchResultContentComponent"
  14 +
  15 +@Component
  16 +export struct SearchResultContentComponent{
  17 + @State keywords:string = ""
  18 + @State searchType:string = ""
  19 + @State data: LazyDataSource<ContentDTO> = new LazyDataSource();
  20 + @State data_rmh: SearchRmhDescription[] = []
  21 + @State count:number = 0;
  22 + @State isLoading:boolean = false
  23 + @State hasMore:boolean = true
  24 + curPageNum:number = 1;
  25 +
  26 +
  27 + aboutToAppear(): void {
  28 + if(this.searchType == "全部"){
  29 + this.searchType = "all"
  30 + }else if(this.searchType == "精选"){
  31 + this.searchType = "cms"
  32 + }else if(this.searchType == "人民号"){
  33 + this.searchType = "rmh"
  34 + }else if(this.searchType == "视频"){
  35 + this.searchType = "video"
  36 + }else if(this.searchType == "活动"){
  37 + this.searchType = "activity"
  38 + }
  39 +
  40 + this.keywords = encodeURI(this.keywords)
  41 + this.getNewSearchResultData()
  42 + }
  43 +
  44 + getNewSearchResultData(){
  45 + this.isLoading = true
  46 + if(this.hasMore){
  47 + SearcherAboutDataModel.getSearchResultListData("20",`${this.curPageNum}`,this.searchType,this.keywords,getContext(this)).then((value)=>{
  48 + if (!this.data || value.list.length == 0){
  49 + this.hasMore = false
  50 + this.isLoading = false
  51 + }else{
  52 + if(value.list[0].dataList!=null){
  53 + this.data_rmh = value.list[0].dataList
  54 + //TODO 查询创作者详情接口
  55 +
  56 + }
  57 + this.getInteractData(value)
  58 + }
  59 + }).catch((err:Error)=>{
  60 + console.log(TAG,JSON.stringify(err))
  61 + this.isLoading = false
  62 + })
  63 + }
  64 + }
  65 +
  66 + getInteractData(resultData:SearchResultContentData){
  67 + if(resultData.list[0].dataList!=null){
  68 + resultData.list.splice(0,1)
  69 + }
  70 +
  71 + let data : contentListParams = {
  72 + contentList: []
  73 + }
  74 + resultData.list.forEach((item)=>{
  75 + data.contentList.push({
  76 + contentId: item.data.id + '',
  77 + contentType: Number.parseInt(item.data.type)
  78 + })
  79 + })
  80 +
  81 + SearcherAboutDataModel.getInteractListData(data,getContext(this)).then((newValue)=>{
  82 + newValue.forEach((item)=>{
  83 + resultData.list.forEach((data)=>{
  84 + if (item.contentId == data.data.id) {
  85 + data.data.collectNum = item.collectNum+""
  86 + data.data.commentNum = item.commentNum+""
  87 + data.data.likeNum = item.likeNum+""
  88 + data.data.readNum = item.readNum+""
  89 + data.data.shareNum = item.shareNum+""
  90 + }
  91 + })
  92 + })
  93 +
  94 + resultData.list.forEach((value)=>{
  95 + let photos:FullColumnImgUrlDTO[] = []
  96 + if(value.data.appStyle === 4){
  97 + value.data.appStyleImages.split("&&").forEach((value)=>{
  98 + photos.push({url:value} as FullColumnImgUrlDTO)
  99 + })
  100 + }
  101 +
  102 + //TODO 48 个赋值
  103 + let contentDTO:ContentDTO = {
  104 + appStyle: value.data.appStyle + "",
  105 + cityCode: value.data.cityCode,
  106 + coverSize: "",
  107 + coverType: -1,
  108 + coverUrl: value.data.appStyleImages.split("&&")[0],
  109 + description: value.data.description,
  110 + districtCode: value.data.districtCode,
  111 + endTime: value.data.endTime,
  112 + hImageUrl: "",
  113 + heatValue: "",
  114 + innerUrl: "",
  115 + landscape: Number.parseInt(value.data.landscape),
  116 + // lengthTime:null,
  117 + linkUrl: value.data.linkUrl,
  118 + openLikes: Number.parseInt(value.data.openLikes),
  119 + openUrl: "",
  120 + pageId: value.data.pageId,
  121 + programAuth: "",
  122 + programId: "",
  123 + programName: "",
  124 + programSource: -1,
  125 + programType: -1,
  126 + provinceCode: value.data.provinceCode,
  127 + showTitleEd: value.data.showTitleEd,
  128 + showTitleIng: value.data.showTitleIng,
  129 + showTitleNo: value.data.showTitleNo,
  130 + startTime: value.data.startTime,
  131 + subType: "",
  132 + subtitle: "",
  133 + title: value.data.title,
  134 + vImageUrl: "",
  135 + screenType: "",
  136 + source: StringUtils.isEmpty(value.data.creatorName) ? value.data.sourceName : value.data.creatorName,
  137 + objectId: "",
  138 + objectType: value.data.type,
  139 + channelId: value.data.channelId,
  140 + relId: value.data.relId,
  141 + relType: value.data.relType,
  142 + newsTitle: value.data.titleLiteral,
  143 + publishTime: value.data.publishTime,
  144 + visitorComment: -1,
  145 + fullColumnImgUrls: photos,
  146 + newsSummary: "",
  147 + hasMore: -1,
  148 + slideShows: [],
  149 + voiceInfo: {} as VoiceInfoDTO,
  150 + tagWord: -1,
  151 + isSelect: true,
  152 + rmhInfo: {} as RmhInfoDTO,
  153 + photoNum: -1,
  154 + liveInfo: {} as LiveInfoDTO,
  155 + videoInfo: {
  156 + videoDuration: Number.parseInt(value.data.duration)
  157 + } as VideoInfoDTO,
  158 + interactData: {} as InteractDataDTO,
  159 + corner: '',
  160 + rmhPlatform: 0,
  161 + newTags: '',
  162 + isSearch: true
  163 + }
  164 +
  165 + this.data.push(contentDTO)
  166 + })
  167 + this.data.notifyDataReload()
  168 + this.count = this.data.totalCount()
  169 + if (this.data.totalCount() < resultData.totalCount) {
  170 + this.curPageNum++
  171 + }else {
  172 + this.hasMore = false
  173 + }
  174 + this.isLoading = false
  175 + }).catch((err:Error)=>{
  176 + console.log(TAG,"请求失败")
  177 + this.isLoading = false
  178 + })
  179 + }
  180 +
  181 + build() {
  182 + Column() {
  183 + if(this.count == 0){
  184 + ListHasNoMoreDataUI({style:2})
  185 + }else{
  186 + Column(){
  187 + if (this.data_rmh!=null && this.data_rmh.length > 0) {
  188 + //List
  189 + List() {
  190 + ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
  191 + ListItem() {
  192 + Column(){
  193 + Image($r('app.media.default_head'))
  194 + .width('84lpx')
  195 + .height('84lpx')
  196 + .margin({bottom:'15lpx'})
  197 + Text(item.creatorName)
  198 + .fontSize('20lpx')
  199 + }.alignItems(HorizontalAlign.Center)
  200 +
  201 + }.onClick(()=>{
  202 + //TODO 跳转
  203 + })
  204 + .width('150lpx')
  205 + })
  206 + }
  207 + .cachedCount(6)
  208 + .edgeEffect(EdgeEffect.None)
  209 + .scrollBar(BarState.Off)
  210 + .listDirection(Axis.Horizontal)
  211 + .width('100%')
  212 + .height('150lpx')
  213 + .onReachEnd(()=>{
  214 + if(!this.isLoading){
  215 + //进入更多关注页
  216 + }
  217 + })
  218 + }
  219 + //List
  220 + List({ space: '6lpx' }) {
  221 + LazyForEach(this.data, (item: ContentDTO, index: number) => {
  222 + ListItem() {
  223 + Column(){
  224 + CardParser({contentDTO:item})
  225 + if(index != this.data.totalCount()-1 ){
  226 + Divider()
  227 + .width('100%')
  228 + .height('1lpx')
  229 + .color($r('app.color.color_F5F5F5'))
  230 + .strokeWidth('1lpx')
  231 + }
  232 + }
  233 + }
  234 + .onClick(()=>{
  235 + //TODO 跳转
  236 + })
  237 + }, (item: ContentDTO, index: number) => index.toString())
  238 +
  239 + //没有更多数据 显示提示
  240 + if(!this.hasMore){
  241 + ListItem(){
  242 + ListHasNoMoreDataUI()
  243 + }
  244 + }
  245 + }.cachedCount(6)
  246 + .edgeEffect(EdgeEffect.None)
  247 + .scrollBar(BarState.Off)
  248 + .margin({top:'23lpx',left:'23lpx',right:'23lpx'})
  249 + .layoutWeight(1)
  250 + .onReachEnd(()=>{
  251 + console.log(TAG,"触底了");
  252 + if(!this.isLoading){
  253 + //加载分页数据
  254 + this.getNewSearchResultData()
  255 + }
  256 + })
  257 + }
  258 + }
  259 + }
  260 + .backgroundColor($r('app.color.white'))
  261 + .height('100%')
  262 + .width('100%')
  263 + }
  264 +}