yangsunyue_wd
Showing 94 changed files with 2597 additions and 1884 deletions
@@ -13,6 +13,11 @@ export class SpConstants{ @@ -13,6 +13,11 @@ export class SpConstants{
13 //协议相关 13 //协议相关
14 static USER_PROTOCOL = "user_protocol" //用户协议 14 static USER_PROTOCOL = "user_protocol" //用户协议
15 static PRIVATE_PROTOCOL = "private_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'
  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 +}
@@ -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 +}
@@ -112,6 +112,10 @@ export class HttpUrlUtils { @@ -112,6 +112,10 @@ export class HttpUrlUtils {
112 */ 112 */
113 static readonly APPOINTMENT_userArea_PATH: string = "/api/rmrb-content-center/c/service/sys-area/treeselect"; 113 static readonly APPOINTMENT_userArea_PATH: string = "/api/rmrb-content-center/c/service/sys-area/treeselect";
114 /** 114 /**
  115 + * 用户token刷新接口(token过期,需要刷新)
  116 + */
  117 + static readonly REFRESH_TOKEN_PATH: string = "/api/rmrb-user-center/auth/zh/c/refreshToken";
  118 + /**
115 /** 119 /**
116 * 个人中心 关注列表详情 120 * 个人中心 关注列表详情
117 */ 121 */
@@ -188,7 +192,6 @@ export class HttpUrlUtils { @@ -188,7 +192,6 @@ export class HttpUrlUtils {
188 * 搜索主页 热词 192 * 搜索主页 热词
189 */ 193 */
190 static readonly SEARCH_HOTS_DATA_PATH: string = "/api/rmrb-search-api/zh/c/hots"; 194 static readonly SEARCH_HOTS_DATA_PATH: string = "/api/rmrb-search-api/zh/c/hots";
191 -  
192 /** 195 /**
193 * 搜索联想词 196 * 搜索联想词
194 */ 197 */
@@ -198,7 +201,6 @@ export class HttpUrlUtils { @@ -198,7 +201,6 @@ export class HttpUrlUtils {
198 * 直播详情 201 * 直播详情
199 */ 202 */
200 static readonly LIVE_DETAILS_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail"; 203 static readonly LIVE_DETAILS_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail";
201 -  
202 /** 204 /**
203 * 直播详情-直播间列表 205 * 直播详情-直播间列表
204 */ 206 */
@@ -215,6 +217,11 @@ export class HttpUrlUtils { @@ -215,6 +217,11 @@ export class HttpUrlUtils {
215 static readonly SEARCH_RESULT_COUNT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/count?keyword="; 217 static readonly SEARCH_RESULT_COUNT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/count?keyword=";
216 218
217 /** 219 /**
  220 + * 搜索结果 显示list 详情
  221 + */
  222 + static readonly SEARCH_RESULT_LIST_DATA_PATH: string = "/api/rmrb-search-api/zh/c/search";
  223 +
  224 + /**
218 * 早晚报列表 225 * 早晚报列表
219 * 根据页面id获取页面楼层列表 226 * 根据页面id获取页面楼层列表
220 * https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/pageInfo?pageId=28927 227 * https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/pageInfo?pageId=28927
@@ -358,7 +365,7 @@ export class HttpUrlUtils { @@ -358,7 +365,7 @@ export class HttpUrlUtils {
358 return ''; 365 return '';
359 } 366 }
360 367
361 - private static getDeviceId() { 368 + public static getDeviceId() {
362 // TODO 369 // TODO
363 return '8a81226a-cabd-3e1b-b630-b51db4a720ed'; 370 return '8a81226a-cabd-3e1b-b630-b51db4a720ed';
364 } 371 }
@@ -452,6 +459,10 @@ export class HttpUrlUtils { @@ -452,6 +459,10 @@ export class HttpUrlUtils {
452 return url; 459 return url;
453 } 460 }
454 461
  462 + static getRefreshTokenUrl() {
  463 + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.REFRESH_TOKEN_PATH;
  464 + return url;
  465 + }
455 466
456 static getResetPassworddUrl() { 467 static getResetPassworddUrl() {
457 let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/resetPassword"; 468 let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/resetPassword";
@@ -515,6 +526,12 @@ export class HttpUrlUtils { @@ -515,6 +526,12 @@ export class HttpUrlUtils {
515 return url; 526 return url;
516 } 527 }
517 528
  529 + //获取用户安全页信息
  530 + static querySecurity() {
  531 + let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/security/query";
  532 + return url;
  533 + }
  534 +
518 static getAppointmentListDataUrl() { 535 static getAppointmentListDataUrl() {
519 let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH 536 let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH
520 return url 537 return url
@@ -640,6 +657,11 @@ export class HttpUrlUtils { @@ -640,6 +657,11 @@ export class HttpUrlUtils {
640 return url 657 return url
641 } 658 }
642 659
  660 + static getSearchResultListDataUrl() {
  661 + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_LIST_DATA_PATH
  662 + return url
  663 + }
  664 +
643 // static getYcgCommonHeaders(): HashMap<string, string> { 665 // static getYcgCommonHeaders(): HashMap<string, string> {
644 // let headers: HashMap<string, string> = new HashMap<string, string>() 666 // let headers: HashMap<string, string> = new HashMap<string, string>()
645 // 667 //
@@ -80,6 +80,8 @@ export function registerRouter() { @@ -80,6 +80,8 @@ export function registerRouter() {
80 return WDRouterPage.imageTextDetailPage 80 return WDRouterPage.imageTextDetailPage
81 } else if (action.params?.pageID == "BroadcastPage") { 81 } else if (action.params?.pageID == "BroadcastPage") {
82 return WDRouterPage.broadcastPage 82 return WDRouterPage.broadcastPage
  83 + } else if (action.params?.pageID == "SPACIAL_TOPIC_PAGE") {
  84 + return WDRouterPage.spacialTopicPage
83 } 85 }
84 return undefined 86 return undefined
85 }) 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");
@@ -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 }
@@ -69,6 +69,8 @@ export interface ContentDTO { @@ -69,6 +69,8 @@ export interface ContentDTO {
69 isSelect: boolean; 69 isSelect: boolean;
70 rmhInfo: RmhInfoDTO; // 人民号信息 70 rmhInfo: RmhInfoDTO; // 人民号信息
71 photoNum: number; 71 photoNum: number;
72 - 72 + corner: string;
  73 + rmhPlatform: number;
  74 + newTags: string
73 75
74 } 76 }
@@ -43,20 +43,14 @@ export { ImageAndTextWebComponent } from "./src/main/ets/components/ImageAndText @@ -43,20 +43,14 @@ export { ImageAndTextWebComponent } from "./src/main/ets/components/ImageAndText
43 43
44 export { DetailViewModel } from "./src/main/ets/viewmodel/DetailViewModel" 44 export { DetailViewModel } from "./src/main/ets/viewmodel/DetailViewModel"
45 45
46 -export { SingleImageCardComponent } from "./src/main/ets/components/view/SingleImageCardComponent"  
47 -  
48 -export { TriPicCardComponent } from "./src/main/ets/components/view/TriPicCardComponent"  
49 -  
50 export { BigPicCardComponent } from "./src/main/ets/components/view/BigPicCardComponent" 46 export { BigPicCardComponent } from "./src/main/ets/components/view/BigPicCardComponent"
51 47
52 -export { HeadPictureCardComponent } from "./src/main/ets/components/view/HeadPictureCardComponent"  
53 -  
54 -export { ZhGridLayoutComponent } from "./src/main/ets/components/view/ZhGridLayoutComponent"  
55 -  
56 export { MultiPictureDetailPageComponent } from "./src/main/ets/components/MultiPictureDetailPageComponent" 48 export { MultiPictureDetailPageComponent } from "./src/main/ets/components/MultiPictureDetailPageComponent"
57 49
58 export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailComponent" 50 export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailComponent"
59 51
  52 +export { AudioSuspensionModel } from "./src/main/ets/viewmodel/AudioSuspensionModel"
  53 +
60 export { BroadcastPageComponent } from "./src/main/ets/components/broadcast/BroadcastPageComponent" 54 export { BroadcastPageComponent } from "./src/main/ets/components/broadcast/BroadcastPageComponent"
61 55
62 export { FirstTabTopSearchComponent } from "./src/main/ets/components/search/FirstTabTopSearchComponent" 56 export { FirstTabTopSearchComponent } from "./src/main/ets/components/search/FirstTabTopSearchComponent"
@@ -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) {
74 Column() { 64 Column() {
75 ImageAndTextWebComponent({ 65 ImageAndTextWebComponent({
76 contentDetailData: this.contentDetailData, 66 contentDetailData: this.contentDetailData,
77 - action: this.action, 67 + action: this.action
78 }) 68 })
79 - }.width(CommonConstants.FULL_WIDTH)  
80 - .height(CommonConstants.FULL_HEIGHT) 69 + Column() {
  70 + if (this.recommendList.length > 0) {
  71 + RecommendList({ recommendList: this.recommendList })
81 } 72 }
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)  
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,10 +296,8 @@ export struct ImageAndTextPageComponent { @@ -211,10 +296,8 @@ 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; 299 this.recommendList = recommendList;
216 } 300 }
217 - }  
218 301
219 // 已登录->查询用户对作品点赞、收藏状态 302 // 已登录->查询用户对作品点赞、收藏状态
220 private async getInteractDataStatus() { 303 private async getInteractDataStatus() {
@@ -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 +}
  1 +import { ContentDTO } from 'wdBean'
  2 +import { CommonConstants } from 'wdConstant/Index';
  3 +import { DateTimeUtils } from 'wdKit/Index';
  4 +
  5 +@Component
  6 +export struct CardSourceInfo {
  7 + @State contentDTO: ContentDTO = {} as ContentDTO;
  8 + build() {
  9 + Flex() {
  10 + if(this.contentDTO.corner) {
  11 + Text(this.contentDTO.corner)
  12 + .fontSize($r("app.float.font_size_12"))
  13 + .fontColor($r("app.color.color_ED2800"))
  14 + .margin({right: 2})
  15 + }
  16 + if(this.contentDTO.rmhPlatform === 1) {
  17 + Text(this.contentDTO.rmhInfo.rmhName)
  18 + .fontSize($r("app.float.font_size_12"))
  19 + .fontColor($r("app.color.color_B0B0B0"))
  20 + .maxLines(1)
  21 + .textOverflow({overflow: TextOverflow.Ellipsis})
  22 + Image($r("app.media.point"))
  23 + .width(16)
  24 + .height(16)
  25 + } else if(this.contentDTO.source) {
  26 + Text(`${this.contentDTO.source}`)
  27 + .fontSize($r("app.float.font_size_12"))
  28 + .fontColor($r("app.color.color_B0B0B0"))
  29 + .maxLines(1)
  30 + .textOverflow({overflow: TextOverflow.Ellipsis})
  31 + Image($r("app.media.point"))
  32 + .width(16)
  33 + .height(16)
  34 + }
  35 + // TODO 这里还有个判断需要完善,依赖外部,新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间
  36 + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))
  37 + .fontSize($r("app.float.font_size_12"))
  38 + .fontColor($r("app.color.color_B0B0B0"))
  39 + .margin({ right: 6 })
  40 + .flexShrink(0)
  41 + if(this.contentDTO?.interactData?.commentNum) {
  42 + Text(`${this.contentDTO.interactData.commentNum}评`)
  43 + .fontSize($r("app.float.font_size_12"))
  44 + .fontColor($r("app.color.color_B0B0B0"))
  45 + .flexShrink(0)
  46 + }
  47 + }
  48 + .width(CommonConstants.FULL_WIDTH)
  49 + .margin({ top: 8 })
  50 + }
  51 +}
@@ -2,7 +2,8 @@ import { ContentDTO, slideShows } from 'wdBean'; @@ -2,7 +2,8 @@ import { ContentDTO, slideShows } from 'wdBean';
2 import { CommonConstants } from 'wdConstant' 2 import { CommonConstants } from 'wdConstant'
3 import { DateTimeUtils } from 'wdKit'; 3 import { DateTimeUtils } from 'wdKit';
4 import { ProcessUtils } from '../../utils/ProcessUtils'; 4 import { ProcessUtils } from '../../utils/ProcessUtils';
5 - 5 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
  6 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
6 7
7 /** 8 /**
8 * 大专题卡--CompStyle: 10 9 * 大专题卡--CompStyle: 10
@@ -76,10 +77,10 @@ export struct Card10Component { @@ -76,10 +77,10 @@ export struct Card10Component {
76 } 77 }
77 .width(CommonConstants.FULL_WIDTH) 78 .width(CommonConstants.FULL_WIDTH)
78 .padding({ 79 .padding({
79 - top: 14,  
80 - left: 16,  
81 - right: 16,  
82 - bottom: 14 80 + left: $r('app.float.card_comp_pagePadding_lf'),
  81 + right: $r('app.float.card_comp_pagePadding_lf'),
  82 + top: $r('app.float.card_comp_pagePadding_tb'),
  83 + bottom: $r('app.float.card_comp_pagePadding_tb')
83 }) 84 })
84 .backgroundColor($r("app.color.white")) 85 .backgroundColor($r("app.color.white"))
85 .margin({ bottom: 8 }) 86 .margin({ bottom: 8 })
@@ -95,25 +96,14 @@ export struct Card10Component { @@ -95,25 +96,14 @@ export struct Card10Component {
95 .fontColor($r('app.color.color_222222')) 96 .fontColor($r('app.color.color_222222'))
96 .maxLines(2) 97 .maxLines(2)
97 .textOverflow({ overflow: TextOverflow.Ellipsis }) 98 .textOverflow({ overflow: TextOverflow.Ellipsis })
98 - Row() {  
99 - // 展示发稿人  
100 - if (item.source) {  
101 - Text(item.source)  
102 - .fontSize($r('app.float.font_size_12'))  
103 - .fontColor($r('app.color.color_B0B0B0'))  
104 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
105 - .maxLines(1)  
106 - .width(item.source.length > 10 ? '60%' : '')  
107 -  
108 - Image($r('app.media.point'))  
109 - .width(16)  
110 - .height(16)  
111 - }  
112 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(String(item.publishTime))))  
113 - .fontSize($r("app.float.font_size_12"))  
114 - .fontColor($r("app.color.color_B0B0B0")) 99 + CardSourceInfo(
  100 + {
  101 + contentDTO: {
  102 + publishTime: item.publishTime || '',
  103 + source: item.source || ''
  104 + } as ContentDTO
115 } 105 }
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 = 'Card12Component';
  7 +
  8 +/**
  9 + * 人民号-动态---12:人民号无图卡;
  10 + */
  11 +@Entry
  12 +@Component
  13 +export struct Card12Component {
  14 + @State contentDTO: ContentDTO = {
  15 + appStyle: '20',
  16 + coverType: 1,
  17 + coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
  18 + fullColumnImgUrls: [
  19 + {
  20 + landscape: 1,
  21 + size: 1,
  22 + url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
  23 + weight: 1600
  24 + }
  25 + ],
  26 + newsTitle: '好玩!》10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
  27 + rmhInfo: {
  28 + authIcon:
  29 + 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',
  30 + authTitle: '10后音乐人王烁然个人人民号',
  31 + authTitle2: '10后音乐人王烁然个人人民号',
  32 + banControl: 0,
  33 + cnIsAttention: 1,
  34 + rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
  35 + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
  36 + rmhName: '王烁然',
  37 + userId: '522435359667845',
  38 + userType: '2'
  39 + },
  40 + objectType: '1',
  41 + videoInfo: {
  42 + firstFrameImageUri: '',
  43 + videoDuration: 37,
  44 + videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'
  45 + }
  46 + } as ContentDTO;
  47 +
  48 + aboutToAppear(): void {
  49 + }
  50 +
  51 + build() {
  52 + Column() {
  53 + // rmh信息
  54 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
  55 + // 左标题,右图
  56 + Flex({ direction: FlexDirection.Row }) {
  57 +
  58 + Text(this.contentDTO.newsTitle)
  59 + .fontSize($r('app.float.font_size_17'))
  60 + .fontColor($r('app.color.color_222222'))
  61 + .textOverflowStyle(3)
  62 + .lineHeight(25)
  63 + .fontFamily('PingFang SC-Regular')
  64 + .textAlign(TextAlign.Start)
  65 + .flexBasis('auto')
  66 + .margin({right: 12})
  67 +
  68 + Image(this.contentDTO.coverUrl)
  69 + .flexBasis(174)
  70 + .height(75)
  71 + .borderRadius($r('app.float.image_border_radius'))
  72 + // .flexBasis(160)
  73 + .backgroundImageSize(ImageSize.Auto)
  74 +
  75 + }
  76 + .width(CommonConstants.FULL_WIDTH)
  77 + .margin({ bottom: 8 })
  78 + .height(75)
  79 +
  80 +
  81 + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
  82 + }
  83 + .padding({
  84 + left: $r('app.float.card_comp_pagePadding_lf'),
  85 + right: $r('app.float.card_comp_pagePadding_lf'),
  86 + top: $r('app.float.card_comp_pagePadding_tb'),
  87 + bottom: $r('app.float.card_comp_pagePadding_tb')
  88 + })
  89 + }
  90 +}
  91 +
  92 +interface radiusType {
  93 + topLeft: number | Resource;
  94 + topRight: number | Resource;
  95 + bottomLeft: number | Resource;
  96 + bottomRight: number | Resource;
  97 +}
  98 +
  99 +@Extend(Text)
  100 +function textOverflowStyle(maxLine: number) {
  101 + .maxLines(maxLine)
  102 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  103 +}
@@ -4,7 +4,7 @@ import { CommonConstants } from 'wdConstant/Index'; @@ -4,7 +4,7 @@ import { CommonConstants } from 'wdConstant/Index';
4 import { DateTimeUtils } from 'wdKit'; 4 import { DateTimeUtils } from 'wdKit';
5 import { WDRouterRule } from 'wdRouter'; 5 import { WDRouterRule } from 'wdRouter';
6 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 6 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
7 - 7 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
8 const TAG = 'Card17Component'; 8 const TAG = 'Card17Component';
9 9
10 /** 10 /**
@@ -81,25 +81,8 @@ export struct Card17Component { @@ -81,25 +81,8 @@ export struct Card17Component {
81 }; 81 };
82 WDRouterRule.jumpWithAction(taskAction) 82 WDRouterRule.jumpWithAction(taskAction)
83 }) 83 })
84 -  
85 - Row() {  
86 - if (this.contentDTO.source) {  
87 - Text(this.contentDTO.source)  
88 - .fontSize($r('app.float.font_size_13'))  
89 - .fontColor($r('app.color.color_B0B0B0'))  
90 - Image($r('app.media.point'))  
91 - .width(16)  
92 - .height(16)  
93 - }  
94 - if (this.contentDTO.publishTime && this.contentDTO.publishTime.length === 13) {  
95 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))  
96 - .fontSize($r('app.float.font_size_13'))  
97 - .fontColor($r('app.color.color_B0B0B0'))  
98 - }  
99 - }  
100 - .width(CommonConstants.FULL_WIDTH)  
101 - .height(16)  
102 - .id('label') 84 + // 评论等信息
  85 + CardSourceInfo({ contentDTO: this.contentDTO })
103 } 86 }
104 .width(CommonConstants.FULL_WIDTH) 87 .width(CommonConstants.FULL_WIDTH)
105 .padding({ 88 .padding({
  1 +import { ContentDTO } from 'wdBean';
  2 +import { CommonConstants, CompStyle } from 'wdConstant';
  3 +import { ProcessUtils } from '../../utils/ProcessUtils';
  4 +import { RmhTitle } from '../cardCommon/RmhTitle'
  5 +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
  6 +
  7 +const TAG: string = 'Card6Component-Card13Component';
  8 +
  9 +/**
  10 + * 卡片样式:"appStyle":"21" 小视频卡人民号
  11 + */
  12 +@Component
  13 +export struct Card21Component {
  14 + @State contentDTO: ContentDTO = {} as ContentDTO;
  15 +
  16 + build() {
  17 + Column() {
  18 + // 顶部 rmh信息
  19 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
  20 + // 中间内容
  21 + Grid() {
  22 + GridItem() {
  23 + Text(`${this.contentDTO.newsTitle}`)
  24 + .fontSize($r('app.float.selected_text_size'))
  25 + .fontColor($r('app.color.color_222222'))
  26 + .width(CommonConstants.FULL_WIDTH)
  27 + .maxLines(4)
  28 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  29 + .padding({ right: 12 })
  30 + .lineHeight(26)
  31 + }
  32 +
  33 + GridItem() {
  34 + Stack() {
  35 + Image(this.contentDTO.coverUrl)
  36 + .width(CommonConstants.FULL_WIDTH)
  37 + .borderRadius($r('app.float.image_border_radius'))
  38 + CardMediaInfo({ contentDTO: this.contentDTO })
  39 + }
  40 + .alignContent(Alignment.BottomEnd)
  41 + }
  42 + }
  43 + .columnsTemplate('2fr 1fr')
  44 + .maxCount(1)
  45 +
  46 + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
  47 + }
  48 + .onClick((event: ClickEvent) => {
  49 + ProcessUtils.processPage(this.contentDTO)
  50 + })
  51 + .padding({
  52 + left: $r('app.float.card_comp_pagePadding_lf'),
  53 + right: $r('app.float.card_comp_pagePadding_lf'),
  54 + top: $r('app.float.card_comp_pagePadding_tb'),
  55 + bottom: $r('app.float.card_comp_pagePadding_tb')
  56 + })
  57 + .width(CommonConstants.FULL_WIDTH)
  58 + }
  59 +}
1 //全标题 "appStyle":"2", 1 //全标题 "appStyle":"2",
2 import { ContentDTO } from 'wdBean'; 2 import { ContentDTO } from 'wdBean';
3 import { CommonConstants } from 'wdConstant/Index'; 3 import { CommonConstants } from 'wdConstant/Index';
4 -import { DateTimeUtils } from 'wdKit/Index';  
5 import { ProcessUtils } from '../../utils/ProcessUtils'; 4 import { ProcessUtils } from '../../utils/ProcessUtils';
6 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
7 - 6 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
8 const TAG: string = 'Card2Component'; 7 const TAG: string = 'Card2Component';
9 8
10 /** 9 /**
@@ -60,21 +59,8 @@ export struct Card2Component { @@ -60,21 +59,8 @@ export struct Card2Component {
60 .alignItems(HorizontalAlign.Start) 59 .alignItems(HorizontalAlign.Start)
61 60
62 //bottom 61 //bottom
63 - Row() {  
64 - Text(this.contentDTO.source)  
65 - .bottomTextStyle()  
66 - //间隔点  
67 - Image($r('app.media.point'))  
68 - .width(12)  
69 - .height(12)  
70 -  
71 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))  
72 - .bottomTextStyle()  
73 - }  
74 - .width(CommonConstants.FULL_WIDTH)  
75 - .height(18)  
76 - .justifyContent(FlexAlign.Start)  
77 - .margin({ top: 8 }) 62 + // 评论等信息
  63 + CardSourceInfo({ contentDTO: this.contentDTO })
78 } 64 }
79 .width(CommonConstants.FULL_WIDTH) 65 .width(CommonConstants.FULL_WIDTH)
80 .padding({ 66 .padding({
1 import { ContentDTO } from 'wdBean'; 1 import { ContentDTO } from 'wdBean';
2 import { CommonConstants } from 'wdConstant' 2 import { CommonConstants } from 'wdConstant'
3 -import { DateTimeUtils } from 'wdKit/src/main/ets/utils/DateTimeUtils'  
4 import { ProcessUtils } from '../../utils/ProcessUtils'; 3 import { ProcessUtils } from '../../utils/ProcessUtils';
  4 +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
5 5
6 /** 6 /**
7 * 卡片样式:"appStyle":"3" 7 * 卡片样式:"appStyle":"3"
@@ -27,30 +27,8 @@ export struct Card3Component { @@ -27,30 +27,8 @@ export struct Card3Component {
27 .fontSize($r("app.float.font_size_16")) 27 .fontSize($r("app.float.font_size_16"))
28 .fontColor($r("app.color.color_222222")) 28 .fontColor($r("app.color.color_222222"))
29 .width(CommonConstants.FULL_WIDTH) 29 .width(CommonConstants.FULL_WIDTH)
30 - Row() {  
31 - // TODO "锐评"取得哪个字段,什么时候显示。  
32 - // Text("锐评")  
33 - // .fontSize($r("app.float.font_size_12"))  
34 - // .fontColor($r("app.color.color_ED2800"))  
35 - if(this.contentDTO.source) {  
36 - Text(this.contentDTO.source)  
37 - .fontSize($r("app.float.font_size_12"))  
38 - .fontColor($r("app.color.color_B0B0B0"))  
39 - Image($r("app.media.point"))  
40 - .width(16)  
41 - .height(16)  
42 - }  
43 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))  
44 - .fontSize($r("app.float.font_size_12"))  
45 - .fontColor($r("app.color.color_B0B0B0"))  
46 - .margin({ right: 6 })  
47 - // TODO '评论取哪个字段'  
48 - // Text(`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')) 51 + CardMediaInfo({ contentDTO: this.contentDTO })
76 } 52 }
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) 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 }
@@ -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(){
  50 +
  51 + Column(){
  52 + Column() {
  53 + // 页签
  54 + Row({ space: 7 }) {
  55 + Scroll() {
49 Row() { 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 }
@@ -288,7 +288,6 @@ struct ChannelDialog { @@ -288,7 +288,6 @@ struct ChannelDialog {
288 .justifyContent(FlexAlign.Center) 288 .justifyContent(FlexAlign.Center)
289 .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff') 289 .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff')
290 .onClick(() => { 290 .onClick(() => {
291 - console.log('onTouch')  
292 if (this.isEditIng) { 291 if (this.isEditIng) {
293 if (item.delPermitted === 1) { 292 if (item.delPermitted === 1) {
294 this.delChannelItem(index) 293 this.delChannelItem(index)
1 -  
2 -import { Logger, DateTimeUtils, CollectionUtils } from 'wdKit'; 1 +import { CollectionUtils, DateTimeUtils, Logger } from 'wdKit';
3 import { CommonConstants, CompStyle, ViewType } from 'wdConstant'; 2 import { CommonConstants, CompStyle, ViewType } from 'wdConstant';
4 import PageViewModel from '../../viewmodel/PageViewModel'; 3 import PageViewModel from '../../viewmodel/PageViewModel';
5 import { EmptyComponent } from '../view/EmptyComponent'; 4 import { EmptyComponent } from '../view/EmptyComponent';
@@ -14,7 +13,7 @@ import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; @@ -14,7 +13,7 @@ import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
14 import { CompParser } from '../CompParser'; 13 import { CompParser } from '../CompParser';
15 import { GroupInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO'; 14 import { GroupInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO';
16 import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; 15 import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';
17 -import { CompDTO, LiveReviewDTO, PageDTO ,PageInfoDTO} from 'wdBean'; 16 +import { CompDTO, LiveReviewDTO, PageDTO, PageInfoBean } from 'wdBean';
18 17
19 18
20 const TAG = 'PageComponent'; 19 const TAG = 'PageComponent';
@@ -72,6 +71,7 @@ export struct PageComponent { @@ -72,6 +71,7 @@ export struct PageComponent {
72 @Builder 71 @Builder
73 ListLayout() { 72 ListLayout() {
74 List() { 73 List() {
  74 + if (this.name !== '视频') {
75 // 下拉刷新 75 // 下拉刷新
76 ListItem() { 76 ListItem() {
77 RefreshLayout({ 77 RefreshLayout({
@@ -79,22 +79,23 @@ export struct PageComponent { @@ -79,22 +79,23 @@ export struct PageComponent {
79 this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight) 79 this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
80 }) 80 })
81 } 81 }
  82 + }
82 83
  84 + if (this.name === '视频') {
  85 + VideoChannelDetail()
  86 + } else {
83 LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => { 87 LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {
84 ListItem() { 88 ListItem() {
85 Column() { 89 Column() {
86 - if (this.name == '视频') {  
87 - VideoChannelDetail()  
88 - } else {  
89 CompParser({ compDTO: compDTO, compIndex: compIndex }); 90 CompParser({ compDTO: compDTO, compIndex: compIndex });
90 } 91 }
91 -  
92 - }  
93 } 92 }
94 }, 93 },
95 (compDTO: CompDTO, compIndex: number) => compDTO.id + compIndex.toString() + this.pageModel.timestamp 94 (compDTO: CompDTO, compIndex: number) => compDTO.id + compIndex.toString() + this.pageModel.timestamp
96 ) 95 )
  96 + }
97 97
  98 + if (this.name !== '视频') {
98 // 加载更多 99 // 加载更多
99 ListItem() { 100 ListItem() {
100 if (this.pageModel.hasMore) { 101 if (this.pageModel.hasMore) {
@@ -107,6 +108,8 @@ export struct PageComponent { @@ -107,6 +108,8 @@ export struct PageComponent {
107 } 108 }
108 } 109 }
109 } 110 }
  111 +
  112 + }
110 .scrollBar(BarState.Off) 113 .scrollBar(BarState.Off)
111 .cachedCount(8) 114 .cachedCount(8)
112 .height(CommonConstants.FULL_PARENT) 115 .height(CommonConstants.FULL_PARENT)
@@ -138,7 +141,8 @@ export struct PageComponent { @@ -138,7 +141,8 @@ export struct PageComponent {
138 141
139 onChange() { 142 onChange() {
140 Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , ${this.isFirstIn} , navIndex: ${this.currentTopNavSelectedIndex}`); 143 Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , ${this.isFirstIn} , navIndex: ${this.currentTopNavSelectedIndex}`);
141 - if (this.navIndex === this.currentTopNavSelectedIndex && !this.isFirstIn) { 144 + // if (this.navIndex === this.currentTopNavSelectedIndex && !this.isFirstIn) {
  145 + if (this.navIndex === this.currentTopNavSelectedIndex) {
142 this.getData(); 146 this.getData();
143 } 147 }
144 } 148 }
@@ -158,6 +162,16 @@ export struct PageComponent { @@ -158,6 +162,16 @@ export struct PageComponent {
158 this.pageModel.viewType = ViewType.EMPTY; 162 this.pageModel.viewType = ViewType.EMPTY;
159 return; 163 return;
160 } 164 }
  165 + if (this.navIndex === 0) {
  166 + await this.getVideoListData(pageInfo);
  167 + } else {
  168 + await this.getLiveListData(pageInfo);
  169 + }
  170 +
  171 +
  172 + }
  173 +
  174 + private async getVideoListData(pageInfo: PageInfoBean) {
161 let groupInfo: GroupInfoDTO = CollectionUtils.getElement(pageInfo.groups, 0); 175 let groupInfo: GroupInfoDTO = CollectionUtils.getElement(pageInfo.groups, 0);
162 if (groupInfo != null) { 176 if (groupInfo != null) {
163 this.pageModel.isRecGroup = groupInfo.groupStrategy === 1; 177 this.pageModel.isRecGroup = groupInfo.groupStrategy === 1;
@@ -165,17 +179,17 @@ export struct PageComponent { @@ -165,17 +179,17 @@ export struct PageComponent {
165 } 179 }
166 // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代 180 // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代
167 // for (const group of pageInfo.groups) { 181 // for (const group of pageInfo.groups) {
168 - this.pageDto = await PageViewModel.getPageData(this.pageModel, getContext(this))  
169 - this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() 182 + this.pageDto = await PageViewModel.getPageData(this.pageModel, getContext(this));
  183 + this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString();
170 if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) { 184 if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) {
171 this.pageDto.compList.forEach((comp) => { 185 this.pageDto.compList.forEach((comp) => {
172 if (comp.compStyle === CompStyle.Zh_Grid_Layout_02 && this.liveReviewDTO && this.liveReviewDTO.list && this.liveReviewDTO.list.length > 0) { 186 if (comp.compStyle === CompStyle.Zh_Grid_Layout_02 && this.liveReviewDTO && this.liveReviewDTO.list && this.liveReviewDTO.list.length > 0) {
173 - comp.operDataList.push(...this.liveReviewDTO.list) 187 + comp.operDataList.push(...this.liveReviewDTO.list);
174 } 188 }
175 - }) 189 + });
176 190
177 this.pageModel.viewType = ViewType.LOADED; 191 this.pageModel.viewType = ViewType.LOADED;
178 - this.pageModel.compList.push(...this.pageDto.compList) 192 + this.pageModel.compList.push(...this.pageDto.compList);
179 if (this.pageDto.compList.length === this.pageModel.pageSize) { 193 if (this.pageDto.compList.length === this.pageModel.pageSize) {
180 this.pageModel.currentPage++; 194 this.pageModel.currentPage++;
181 this.pageModel.hasMore = true; 195 this.pageModel.hasMore = true;
@@ -188,14 +202,94 @@ export struct PageComponent { @@ -188,14 +202,94 @@ export struct PageComponent {
188 // this.pageModel.compList.replaceAll(...data) 202 // this.pageModel.compList.replaceAll(...data)
189 // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() 203 // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
190 // }) 204 // })
191 - this.isFirstIn = false 205 + this.isFirstIn = false;
192 Logger.debug(TAG, 'cj111'); 206 Logger.debug(TAG, 'cj111');
193 // } else { 207 // } else {
194 // Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.'); 208 // Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.');
195 // this.pageModel.viewType = ViewType.EMPTY; 209 // this.pageModel.viewType = ViewType.EMPTY;
196 // } 210 // }
197 } 211 }
  212 + }
198 213
  214 + // private async getLiveListData(pageInfo: PageInfoBean) {
  215 + // // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代
  216 + // for (const group of pageInfo.groups) {
  217 + // this.pageDto = await PageViewModel.getPageData(this.pageModel, getContext(this));
  218 + // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString();
  219 + // if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) {
  220 + // this.pageDto.compList.forEach((comp) => {
  221 + // if (comp.compStyle === CompStyle.Zh_Grid_Layout_02 && this.liveReviewDTO && this.liveReviewDTO.list && this.liveReviewDTO.list.length > 0) {
  222 + // comp.operDataList.push(...this.liveReviewDTO.list);
  223 + // }
  224 + // });
  225 + //
  226 + // this.pageModel.viewType = ViewType.LOADED;
  227 + // this.pageModel.compList.push(...this.pageDto.compList);
  228 + // if (this.pageDto.compList.length === this.pageModel.pageSize) {
  229 + // this.pageModel.currentPage++;
  230 + // this.pageModel.hasMore = true;
  231 + // } else {
  232 + // this.pageModel.hasMore = false;
  233 + // }
  234 + // // // 二次请求,批查互动数据
  235 + // // PageViewModel.getInteractData(pageDto.compList).then((data: CompDTO[]) => {
  236 + // // // 刷新,替换所有数据
  237 + // // this.pageModel.compList.replaceAll(...data)
  238 + // // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
  239 + // // })
  240 + // this.isFirstIn = false;
  241 + // Logger.debug(TAG, 'cj111');
  242 + // // } else {
  243 + // // Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.');
  244 + // // this.pageModel.viewType = ViewType.EMPTY;
  245 + // }
  246 + // }
  247 + // }
  248 +
  249 + async getLiveListData(pageInfo: PageInfoBean) {
  250 + // Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
  251 + // this.pageModel.pageId = this.pageId;
  252 + // this.pageModel.groupId = this.pageId;
  253 + // this.pageModel.channelId = this.channelId;
  254 + // this.pageModel.currentPage = 1;
  255 + // let pageInfo = await PageViewModel.getPageUrlData(this.pageModel.pageId);
  256 + // if (pageInfo == null) {
  257 + // this.pageModel.viewType = ViewType.EMPTY;
  258 + // return;
  259 + // }
  260 + Logger.debug(TAG, 'getPageUrlData ' + pageInfo.id);
  261 + // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代
  262 + for (const group of pageInfo.groups) {
  263 + this.pageDto = await PageViewModel.getLivePageData(this.pageModel.pageId, `${group.id}`, this.pageModel.channelId, group.groupStrategy
  264 + , this.pageModel.currentPage, this.pageModel.pageSize, getContext(this))
  265 + this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
  266 + if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) {
  267 + this.pageDto.compList.forEach((comp) => {
  268 + if (comp.compStyle === CompStyle.Zh_Grid_Layout_02 && this.liveReviewDTO && this.liveReviewDTO.list && this.liveReviewDTO.list.length > 0) {
  269 + comp.operDataList.push(...this.liveReviewDTO.list)
  270 + }
  271 + })
  272 +
  273 + this.pageModel.viewType = ViewType.LOADED;
  274 + this.pageModel.compList.push(...this.pageDto.compList)
  275 + if (this.pageDto.compList.length === this.pageModel.pageSize) {
  276 + this.pageModel.currentPage++;
  277 + this.pageModel.hasMore = true;
  278 + } else {
  279 + this.pageModel.hasMore = false;
  280 + }
  281 + // 二次请求,批查互动数据
  282 + PageViewModel.getInteractData(this.pageDto.compList).then((data: CompDTO[]) => {
  283 + // 刷新,替换所有数据
  284 + this.pageModel.compList.replaceAll(...data)
  285 + this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
  286 + })
  287 + this.isFirstIn = false
  288 + } else {
  289 + Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.');
  290 + this.pageModel.viewType = ViewType.EMPTY;
  291 + }
  292 + }
199 } 293 }
200 294
201 async getPreviewData() { 295 async getPreviewData() {
@@ -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, FullColumnImgUrlDTO, InteractDataDTO, RmhInfoDTO, VideoInfoDTO } from 'wdBean/Index'
  2 +import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO'
  3 +import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO'
  4 +import { LazyDataSource, StringUtils } from 'wdKit/Index'
  5 +import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
  6 +import { CardParser } from '../CardParser'
  7 +import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI'
  8 +
  9 +const TAG = "SearchResultContentComponent"
  10 +
  11 +@Component
  12 +export struct SearchResultContentComponent{
  13 + @State keywords:string = ""
  14 + @State searchType:string = ""
  15 + @State data: LazyDataSource<ContentDTO> = new LazyDataSource();
  16 + @State count:number = 0;
  17 + @State isLoading:boolean = false
  18 + @State hasMore:boolean = true
  19 + curPageNum:number = 1;
  20 +
  21 +
  22 + aboutToAppear(): void {
  23 + if(this.searchType == "全部"){
  24 + this.searchType = "all"
  25 + }else if(this.searchType == "精选"){
  26 + this.searchType = "cms"
  27 + }else if(this.searchType == "人民号"){
  28 + this.searchType = "rmh"
  29 + }else if(this.searchType == "视频"){
  30 + this.searchType = "video"
  31 + }else if(this.searchType == "活动"){
  32 + this.searchType = "activity"
  33 + }
  34 +
  35 + this.keywords = encodeURI(this.keywords)
  36 + this.getNewSearchResultData()
  37 + }
  38 +
  39 + getNewSearchResultData(){
  40 + this.isLoading = true
  41 + if(this.hasMore){
  42 + SearcherAboutDataModel.getSearchResultListData("20",`${this.curPageNum}`,this.searchType,this.keywords,getContext(this)).then((value)=>{
  43 + if (!this.data || value.list.length == 0){
  44 + this.hasMore = false
  45 + }else{
  46 + value.list.forEach((value)=>{
  47 +
  48 + let photos:FullColumnImgUrlDTO[] = []
  49 + if(value.data.appStyle === 4){
  50 + value.data.appStyleImages.split("&&").forEach((value)=>{
  51 + photos.push({url:value} as FullColumnImgUrlDTO)
  52 + })
  53 + }
  54 +
  55 + //TODO 48 个赋值
  56 + let contentDTO:ContentDTO = {
  57 + appStyle: value.data.appStyle + "",
  58 + cityCode: value.data.cityCode,
  59 + coverSize: "",
  60 + coverType: -1,
  61 + coverUrl: value.data.appStyleImages.split("&&")[0],
  62 + description: value.data.description,
  63 + districtCode: value.data.districtCode,
  64 + endTime: value.data.endTime,
  65 + hImageUrl: "",
  66 + heatValue: "",
  67 + innerUrl: "",
  68 + landscape: Number.parseInt(value.data.landscape),
  69 + // lengthTime:null,
  70 + linkUrl: value.data.linkUrl,
  71 + openLikes: Number.parseInt(value.data.openLikes),
  72 + openUrl: "",
  73 + pageId: value.data.pageId,
  74 + programAuth: "",
  75 + programId: "",
  76 + programName: "",
  77 + programSource: -1,
  78 + programType: -1,
  79 + provinceCode: value.data.provinceCode,
  80 + showTitleEd: value.data.showTitleEd,
  81 + showTitleIng: value.data.showTitleIng,
  82 + showTitleNo: value.data.showTitleNo,
  83 + startTime: value.data.startTime,
  84 + subType: "",
  85 + subtitle: "",
  86 + title: value.data.title,
  87 + vImageUrl: "",
  88 + screenType: "",
  89 + source: StringUtils.isEmpty(value.data.creatorName) ? value.data.sourceName : value.data.creatorName,
  90 + objectId: "",
  91 + objectType: value.data.type,
  92 + channelId: value.data.channelId,
  93 + relId: value.data.relId,
  94 + relType: value.data.relType,
  95 + newsTitle: value.data.titleLiteral,
  96 + publishTime: value.data.publishTime,
  97 + visitorComment: -1,
  98 + fullColumnImgUrls: photos,
  99 + newsSummary: "",
  100 + hasMore: -1,
  101 + slideShows: [],
  102 + voiceInfo: {} as VoiceInfoDTO,
  103 + tagWord: -1,
  104 + isSelect: true,
  105 + rmhInfo: {} as RmhInfoDTO,
  106 + photoNum: -1,
  107 + liveInfo: {} as LiveInfoDTO,
  108 + videoInfo: {
  109 + videoDuration: Number.parseInt(value.data.duration)
  110 + } as VideoInfoDTO,
  111 + interactData: {} as InteractDataDTO,
  112 + corner: '',
  113 + rmhPlatform: 0,
  114 + newTags: ''
  115 + }
  116 +
  117 + this.data.push(contentDTO)
  118 + })
  119 + this.data.notifyDataReload()
  120 + this.count = this.data.totalCount()
  121 + if (this.data.totalCount() < value.totalCount) {
  122 + this.curPageNum++
  123 + }else {
  124 + this.hasMore = false
  125 + }
  126 + }
  127 + }).catch((err:Error)=>{
  128 + console.log(TAG,JSON.stringify(err))
  129 + })
  130 + }
  131 + this.isLoading = false
  132 + }
  133 +
  134 +
  135 + build() {
  136 + Column() {
  137 + if(this.count == 0){
  138 + ListHasNoMoreDataUI({style:2})
  139 + }else{
  140 + //List
  141 + List({ space: '6lpx' }) {
  142 + LazyForEach(this.data, (item: ContentDTO, index: number) => {
  143 + ListItem() {
  144 + CardParser({contentDTO:item})
  145 + }
  146 + .onClick(()=>{
  147 + //TODO 跳转
  148 + })
  149 + }, (item: ContentDTO, index: number) => index.toString())
  150 +
  151 + //没有更多数据 显示提示
  152 + if(!this.hasMore){
  153 + ListItem(){
  154 + ListHasNoMoreDataUI()
  155 + }
  156 + }
  157 + }.cachedCount(4)
  158 + .scrollBar(BarState.Off)
  159 + .margin({top:'23lpx',left:'23lpx',right:'23lpx'})
  160 + .layoutWeight(1)
  161 + .onReachEnd(()=>{
  162 + console.log(TAG,"触底了");
  163 + if(!this.isLoading){
  164 + //加载分页数据
  165 + this.getNewSearchResultData()
  166 + }
  167 + })
  168 + }
  169 + }
  170 + .backgroundColor($r('app.color.white'))
  171 + .height('100%')
  172 + .width('100%')
  173 + }
  174 +}
1 import { Params } from 'wdBean'; 1 import { Params } from 'wdBean';
2 import { WDRouterPage, WDRouterRule } from 'wdRouter'; 2 import { WDRouterPage, WDRouterRule } from 'wdRouter';
3 -import featureAbility from '@ohos.ability.featureAbility'; 3 +import { EnvironmentCustomDialog } from './EnvironmentCustomDialog';
4 4
5 const TAG = 'AboutPageUI'; 5 const TAG = 'AboutPageUI';
6 6
@@ -9,7 +9,18 @@ export struct AboutPageUI { @@ -9,7 +9,18 @@ export struct AboutPageUI {
9 @State listData: Array<string | Array<string>> = ['隐私授权协议', '软件许可及用户协议']; 9 @State listData: Array<string | Array<string>> = ['隐私授权协议', '软件许可及用户协议'];
10 @State message: string = '京ICP备16066560号-6A Copyright © 人民日报客户端\nall rights reserved.' 10 @State message: string = '京ICP备16066560号-6A Copyright © 人民日报客户端\nall rights reserved.'
11 @State version: string = '版本号:v' 11 @State version: string = '版本号:v'
  12 + clickTimes: number = 0
  13 + dialogController: CustomDialogController = new CustomDialogController({
  14 + builder: EnvironmentCustomDialog({
  15 + cancel: () => {
12 16
  17 + },
  18 + confirm: () => {
  19 + }
  20 + }),
  21 + customStyle: true,
  22 + alignment: DialogAlignment.Center
  23 + })
13 24
14 build() { 25 build() {
15 Navigation() { 26 Navigation() {
@@ -19,18 +30,24 @@ export struct AboutPageUI { @@ -19,18 +30,24 @@ export struct AboutPageUI {
19 .title('关于') 30 .title('关于')
20 } 31 }
21 32
22 - aboutToAppear(){ 33 + aboutToAppear() {
23 let context = getContext(); 34 let context = getContext();
24 context.getApplicationContext(); 35 context.getApplicationContext();
25 } 36 }
26 37
27 - @Builder aboutUi() { 38 + @Builder
  39 + aboutUi() {
28 Column() { 40 Column() {
29 Image($r('app.media.setting_about_logo')) 41 Image($r('app.media.setting_about_logo'))
30 .width('278lpx') 42 .width('278lpx')
31 .height('154lpx') 43 .height('154lpx')
32 - .margin({top:'173lpx',bottom:'154lpx'})  
33 - 44 + .margin({ top: '173lpx', bottom: '154lpx' })
  45 + .onClick(() => {
  46 + this.clickTimes++
  47 + if (this.clickTimes > 2) {
  48 + this.dialogController.open()
  49 + }
  50 + })
34 // Row(){ 51 // Row(){
35 // 52 //
36 // }.backgroundColor(Color.Yellow) 53 // }.backgroundColor(Color.Yellow)
@@ -44,19 +61,17 @@ export struct AboutPageUI { @@ -44,19 +61,17 @@ export struct AboutPageUI {
44 // .height('97lpx') 61 // .height('97lpx')
45 62
46 63
47 -  
48 -  
49 - List(){  
50 - ForEach(this.listData, (item:string, index : number) =>{ 64 + List() {
  65 + ForEach(this.listData, (item: string, index: number) => {
51 ListItem() { 66 ListItem() {
52 this.getArrowCell(item, index) 67 this.getArrowCell(item, index)
53 - }.onClick(() =>{ 68 + }.onClick(() => {
54 if (index == 0) { 69 if (index == 0) {
55 - let bean={contentId:"1",pageID:""} as Params  
56 - WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean)  
57 - }else{  
58 - let bean={contentId:"2",pageID:""} as Params  
59 - WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) 70 + let bean = { contentId: "1", pageID: "" } as Params
  71 + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean)
  72 + } else {
  73 + let bean = { contentId: "2", pageID: "" } as Params
  74 + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean)
60 } 75 }
61 }) 76 })
62 }) 77 })
@@ -77,22 +92,21 @@ export struct AboutPageUI { @@ -77,22 +92,21 @@ export struct AboutPageUI {
77 .fontSize('25lpx') 92 .fontSize('25lpx')
78 .textAlign(TextAlign.Center) 93 .textAlign(TextAlign.Center)
79 .fontColor($r("app.color.color_666666")) 94 .fontColor($r("app.color.color_666666"))
80 - .margin({bottom:'31lpx'}) 95 + .margin({ bottom: '31lpx' })
81 96
82 Text(this.message) 97 Text(this.message)
83 .fontSize('19lpx') 98 .fontSize('19lpx')
84 .textAlign(TextAlign.Center) 99 .textAlign(TextAlign.Center)
85 .fontColor($r("app.color.color_999999")) 100 .fontColor($r("app.color.color_999999"))
86 - .margin({bottom:'35lpx'}) 101 + .margin({ bottom: '35lpx' })
87 } 102 }
88 .width('100%') 103 .width('100%')
89 .height('100%') 104 .height('100%')
90 } 105 }
91 106
92 -  
93 -  
94 // 右文字+箭头cell 107 // 右文字+箭头cell
95 - @Builder getArrowCell(item:string, index:number) { 108 + @Builder
  109 + getArrowCell(item: string, index: number) {
96 110
97 Row() { 111 Row() {
98 // 左侧标题 112 // 左侧标题
@@ -109,10 +123,8 @@ export struct AboutPageUI { @@ -109,10 +123,8 @@ export struct AboutPageUI {
109 .justifyContent(FlexAlign.SpaceBetween) 123 .justifyContent(FlexAlign.SpaceBetween)
110 .height('97lpx') 124 .height('97lpx')
111 .width('100%') 125 .width('100%')
112 - .padding({left:'29lpx',right:'29lpx'}) 126 + .padding({ left: '29lpx', right: '29lpx' })
113 } 127 }
114 -  
115 -  
116 } 128 }
117 129
118 130
@@ -17,6 +17,7 @@ import { Router } from '@ohos.arkui.UIContext'; @@ -17,6 +17,7 @@ import { Router } from '@ohos.arkui.UIContext';
17 import promptAction from '@ohos.promptAction'; 17 import promptAction from '@ohos.promptAction';
18 import { LogoutViewModel } from '../../viewmodel/LogoutViewModel'; 18 import { LogoutViewModel } from '../../viewmodel/LogoutViewModel';
19 import { CustomLogoutDialog } from './CustomLogoutDialog'; 19 import { CustomLogoutDialog } from './CustomLogoutDialog';
  20 +import { emitter } from '@kit.BasicServicesKit';
20 21
21 export { SettingPasswordParams } from "wdLogin" 22 export { SettingPasswordParams } from "wdLogin"
22 23
@@ -41,9 +42,11 @@ export struct AccountAndSecurityLayout { @@ -41,9 +42,11 @@ export struct AccountAndSecurityLayout {
41 alignment: DialogAlignment.Center 42 alignment: DialogAlignment.Center
42 }) 43 })
43 44
  45 +
44 aboutToAppear() { 46 aboutToAppear() {
45 // 获取设置页面数据 47 // 获取设置页面数据
46 this.getAccountAndSecurityData() 48 this.getAccountAndSecurityData()
  49 + this.addEmitEvent()
47 } 50 }
48 51
49 async getAccountAndSecurityData() { 52 async getAccountAndSecurityData() {
@@ -56,6 +59,28 @@ export struct AccountAndSecurityLayout { @@ -56,6 +59,28 @@ export struct AccountAndSecurityLayout {
56 59
57 } 60 }
58 61
  62 + addEmitEvent(){
  63 + // 定义一个eventId为1的事件
  64 + let event: emitter.InnerEvent = {
  65 + eventId: 10010
  66 + };
  67 +
  68 + // 收到eventId为1的事件后执行该回调
  69 + let callback = (eventData: emitter.EventData): void => {
  70 + promptAction.showToast({
  71 + message: JSON.stringify(eventData)
  72 + });
  73 + if(eventData&&eventData.data){
  74 + this.listData[0].subTitle = eventData.data['content']
  75 + }
  76 + Logger.debug( 'event callback:' + JSON.stringify(eventData));
  77 + };
  78 +
  79 + // 订阅eventId为1的事件
  80 + emitter.on(event, callback);
  81 +
  82 + }
  83 +
59 build() { 84 build() {
60 Column(){ 85 Column(){
61 if(this.isAccountPage){ 86 if(this.isAccountPage){
@@ -106,7 +131,8 @@ export struct AccountAndSecurityLayout { @@ -106,7 +131,8 @@ export struct AccountAndSecurityLayout {
106 ListItem() { 131 ListItem() {
107 if (item.type == 0) { 132 if (item.type == 0) {
108 Column() { 133 Column() {
109 - this.getArrowCell(item) 134 + // this.getArrowCell(item)
  135 + AccountArrowCell({ item:item})
110 }.padding({ left: '27lpx' }).height('117lpx').justifyContent(FlexAlign.Center) 136 }.padding({ left: '27lpx' }).height('117lpx').justifyContent(FlexAlign.Center)
111 } else if (item.type == 1) { 137 } else if (item.type == 1) {
112 Column() { 138 Column() {
@@ -285,7 +311,7 @@ export struct AccountAndSecurityLayout { @@ -285,7 +311,7 @@ export struct AccountAndSecurityLayout {
285 }.alignItems(VerticalAlign.Center) 311 }.alignItems(VerticalAlign.Center)
286 312
287 Row() { 313 Row() {
288 - Text("登录") 314 + Text("注销账户")
289 .borderRadius(4) 315 .borderRadius(4)
290 .fontColor(this.protocolState ? "#FFFFFFFF" : "#66FFFFFF") 316 .fontColor(this.protocolState ? "#FFFFFFFF" : "#66FFFFFF")
291 .fontSize(18) 317 .fontSize(18)
@@ -405,3 +431,46 @@ export struct AccountAndSecurityLayout { @@ -405,3 +431,46 @@ export struct AccountAndSecurityLayout {
405 return securityNum; 431 return securityNum;
406 } 432 }
407 } 433 }
  434 +
  435 +@Component
  436 +export struct AccountArrowCell{
  437 + @ObjectLink item: MineMainSettingFunctionItem
  438 + build() {
  439 + Column() {
  440 + Row() {
  441 + // 左侧logo和标题
  442 + Row() {
  443 + // 判断有没有图片
  444 + if (this.item.imgSrc) {
  445 + Image(this.item.imgSrc)
  446 + .height('38lpx')
  447 + .margin({ right: '5lpx' })
  448 + }
  449 + Text(`${this.item.title}`)
  450 + .margin({ top: '8lpx' })
  451 + .height('38lpx')
  452 + .fontColor('#333333')
  453 + .fontSize('29lpx')
  454 + }.width('60%')
  455 +
  456 + // 右侧文案和右箭头
  457 + Row() {
  458 + Text(this.item.subTitle ? this.item.subTitle : '')
  459 + .fontColor('#999999')
  460 + .maxLines(1)
  461 + Image($r('app.media.mine_user_arrow'))
  462 + .width('27lpx')
  463 + .height('27lpx')
  464 + .objectFit(ImageFit.Auto)
  465 + Column().width('29lpx')
  466 + }.width('40%')
  467 + .margin({ right: '29lpx' })
  468 + .justifyContent(FlexAlign.End)
  469 +
  470 + }
  471 + .alignItems(VerticalAlign.Center)
  472 + .justifyContent(FlexAlign.SpaceBetween)
  473 + }
  474 + .height('54lpx')
  475 + }
  476 +}
  1 +import { SPHelper } from 'wdKit/Index';
  2 +import { HttpUrlUtils } from 'wdNetwork/Index';
  3 +
  4 +@CustomDialog
  5 +export struct EnvironmentCustomDialog {
  6 + currentEnvironment: string = HttpUrlUtils.HOST_PRODUCT;
  7 + controller: CustomDialogController
  8 + cancel: () => void = () => {
  9 + }
  10 + confirm: () => void = () => {
  11 + }
  12 +
  13 + build() {
  14 + Column() {
  15 + Text("请选择环境")
  16 + .fontColor("#222222")
  17 + .fontSize(18)
  18 + .width("100%")
  19 + .fontWeight(FontWeight.Bold)
  20 + .textAlign(TextAlign.Center)
  21 + .margin({ top: 20 })
  22 + Row() {
  23 + Radio({ value: 'Radio1', group: 'radioGroup' })
  24 + .checked(true)
  25 + .height(20)
  26 + .width(20)
  27 + .onChange((isChecked: boolean) => {
  28 + if (isChecked) {
  29 + this.currentEnvironment = HttpUrlUtils.HOST_SIT;
  30 + }
  31 + })
  32 + Text('切换到SIT(测试)环境,重启应用生效')
  33 + .fontSize(14)
  34 + }
  35 + .justifyContent(FlexAlign.Start)
  36 + .width('90%')
  37 +
  38 + Row() {
  39 + Radio({ value: 'Radio1', group: 'radioGroup' })
  40 + .checked(true)
  41 + .height(20)
  42 + .width(20)
  43 + .onChange((isChecked: boolean) => {
  44 + if (isChecked) {
  45 + this.currentEnvironment = HttpUrlUtils.HOST_UAT;
  46 + }
  47 + })
  48 + Text('切换到UAT(预发布)环境,重启应用生效')
  49 + .fontSize(14)
  50 + }
  51 + .width('90%')
  52 + .justifyContent(FlexAlign.Start)
  53 +
  54 + Row() {
  55 + Radio({ value: 'Radio1', group: 'radioGroup' })
  56 + .checked(true)
  57 + .height(20)
  58 + .width(20)
  59 + .onChange((isChecked: boolean) => {
  60 + if (isChecked) {
  61 + this.currentEnvironment = HttpUrlUtils.HOST_PRODUCT;
  62 + }
  63 + })
  64 + Text('切换到PROD(现网)环境,重启应用生效')
  65 + .fontSize(14)
  66 + }
  67 + .width('90%')
  68 + .justifyContent(FlexAlign.Start)
  69 +
  70 + Row() {
  71 + Radio({ value: 'Radio1', group: 'radioGroup' })
  72 + .checked(true)
  73 + .height(20)
  74 + .width(20)
  75 + .onChange((isChecked: boolean) => {
  76 + if (isChecked) {
  77 + this.currentEnvironment = HttpUrlUtils.HOST_DEV;
  78 + }
  79 + })
  80 + Text('切换到DEV(开发)环境,重启应用生效')
  81 + .fontSize(14)
  82 + }
  83 + .width('90%')
  84 + .justifyContent(FlexAlign.Start)
  85 +
  86 + Button('确认')
  87 + .margin({ top: 20 })
  88 + .onClick(() => {
  89 + // HttpUrlUtils.hostUrl = this.currentEnvironment
  90 + SPHelper.default.saveSync('hostUrl', this.currentEnvironment);
  91 + this.controller.close()
  92 + this.confirm()
  93 + })
  94 + }.height(261).backgroundColor(Color.White).borderRadius(6).width('74%')
  95 +
  96 + }
  97 +}
1 -import { Action, CompDTO, Params } from 'wdBean';  
2 -import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';  
3 -import { CommonConstants } from 'wdConstant/Index';  
4 -import { DateTimeUtils, Logger } from 'wdKit';  
5 -import { WDRouterRule } from 'wdRouter';  
6 -  
7 -const TAG = 'AlbumCardComponent';  
8 -  
9 -@Preview  
10 -@Component  
11 -export struct AlbumCardComponent {  
12 - @State compDTO: CompDTO = {} as CompDTO  
13 -  
14 - aboutToAppear() {  
15 - Logger.debug(TAG + "this.compDTO.operDataList" + JSON.stringify(this.compDTO.operDataList));  
16 -  
17 - }  
18 -  
19 - build() {  
20 - Column({ space: 8 }) {  
21 - Text(this.compDTO.operDataList[0].newsTitle)  
22 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
23 - .fontSize(17)  
24 - .fontColor(0x222222)  
25 - .lineHeight(25)  
26 - .maxLines(3)  
27 - .width(CommonConstants.FULL_WIDTH)  
28 -  
29 - RelativeContainer() {  
30 - Image(this.compDTO.operDataList[0].fullColumnImgUrls[0].url)  
31 - .width('66.6%')  
32 - .aspectRatio(16/9)  
33 - .alignRules({  
34 - top: { anchor: "__container__", align: VerticalAlign.Top },  
35 - left: { anchor: "__container__", align: HorizontalAlign.Start }  
36 - })  
37 - .id('mainImage')  
38 -  
39 - Image(this.compDTO.operDataList[0].fullColumnImgUrls[1].url)  
40 - .width('33%')  
41 - .aspectRatio(16/9)  
42 - .alignRules({  
43 - top: { anchor: "__container__", align: VerticalAlign.Top },  
44 - right: { anchor: "__container__", align: HorizontalAlign.End }  
45 - })  
46 - .id('subTopImage')  
47 -  
48 - Image(this.compDTO.operDataList[0].fullColumnImgUrls[2].url)  
49 - .width('33%')  
50 - .aspectRatio(16/9)  
51 - .alignRules({  
52 - right: { anchor: "__container__", align: HorizontalAlign.End },  
53 - bottom: { anchor: "__container__", align: VerticalAlign.Bottom }  
54 - })  
55 - .id('subBottomImage')  
56 - // 下面是渲染右下角图标  
57 - Shape() {  
58 - Rect().width(33).height(18)  
59 - }  
60 - // .viewPort({ x: -2, y: -2, width: 304, height: 130 })  
61 - .fill(0x000000)  
62 - .fillOpacity(0.3)  
63 - // .strokeDashArray([20])  
64 - // .strokeDashOffset(10)  
65 - .strokeLineCap(LineCapStyle.Round)  
66 - .strokeLineJoin(LineJoinStyle.Round)  
67 - .antiAlias(true)  
68 - .id('shape')  
69 - .alignRules({  
70 - right: { anchor: "__container__", align: HorizontalAlign.End },  
71 - bottom: { anchor: "__container__", align: VerticalAlign.Bottom }  
72 - })  
73 - .margin({ right: 4,  
74 - bottom: 4 })  
75 -  
76 - Image($r('app.media.album_card_shape'))  
77 - .width(22)  
78 - .height(18)  
79 - .alignRules({  
80 - left: { anchor: "shape", align: HorizontalAlign.Start },  
81 - top: { anchor: "shape", align: VerticalAlign.Top }  
82 - })  
83 - .id('shapeSubImage')  
84 -  
85 - Text(this.compDTO.operDataList[0].fullColumnImgUrls.length + '')  
86 - .fontSize(13)  
87 - .fontColor(0xFFFFFF)  
88 - .id('pageIndex')  
89 - .alignRules({  
90 - right: { anchor: "shape", align: HorizontalAlign.End },  
91 - top: { anchor: "shape", align: VerticalAlign.Top }  
92 - })  
93 - .margin({ right: 2 })  
94 - .textAlign(TextAlign.Center)  
95 - .width(17)  
96 - .height(17)  
97 - }  
98 - .width(CommonConstants.FULL_WIDTH)  
99 - .aspectRatio(24/9)  
100 - .onClick((event: ClickEvent) => {  
101 - let taskAction: Action = {  
102 - type: 'JUMP_DETAIL_PAGE',  
103 - params: {  
104 - detailPageType: 17,  
105 - contentID: this.compDTO.operDataList?.[0].objectId,  
106 - extra: {  
107 - relType: this.compDTO.operDataList?.[0].relType,  
108 - relId: `${this.compDTO.operDataList?.[0].relId}`,  
109 - } as ExtraDTO  
110 - } as Params,  
111 - };  
112 - WDRouterRule.jumpWithAction(taskAction)  
113 - })  
114 -  
115 - Row() {  
116 - if (this.compDTO.operDataList[0].source) {  
117 - Text(this.compDTO.operDataList[0].source)  
118 - .fontSize(13)  
119 - .fontColor(0xB0B0B0)  
120 - Image($r('app.media.point'))  
121 - .width(16)  
122 - .height(16)  
123 - }  
124 - if (this.compDTO.operDataList[0].publishTime && this.compDTO.operDataList[0].publishTime.length === 13) {  
125 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.compDTO.operDataList[0].publishTime)))  
126 - .fontSize(13)  
127 - .fontColor(0xB0B0B0)  
128 - }  
129 - Text('328评')  
130 - .fontSize(13)  
131 - .fontColor(0xB0B0B0)  
132 - .margin({  
133 - left: 6  
134 - })  
135 - }  
136 - .width(CommonConstants.FULL_WIDTH)  
137 - .height(16)  
138 - .id('label')  
139 - }  
140 - .width(CommonConstants.FULL_WIDTH)  
141 - .padding({  
142 - top: 14,  
143 - left: 16,  
144 - right: 16,  
145 - bottom: 14  
146 - })  
147 - }  
148 -}  
1 -import { CompDTO, slideShows } from 'wdBean';  
2 -import { CommonConstants } from 'wdConstant'  
3 -import { DateTimeUtils } from 'wdKit';  
4 -import { ProcessUtils } from '../../utils/ProcessUtils';  
5 -/**  
6 - * 时间链卡--CompStyle: 09  
7 - */  
8 -@Component  
9 -export struct CompStyle_09 {  
10 - @State compDTO: CompDTO = {} as CompDTO  
11 -  
12 - build() {  
13 - Column(){  
14 - // 顶部标题,最多两行  
15 - if(this.compDTO.operDataList[0].newsTitle) {  
16 - Text(this.compDTO.operDataList[0].newsTitle)  
17 - .width(CommonConstants.FULL_WIDTH)  
18 - .fontSize($r('app.float.font_size_17'))  
19 - .fontWeight(600)  
20 - .maxLines(2)  
21 - .textOverflow({overflow: TextOverflow.Ellipsis})  
22 - .margin({ bottom: 19 })  
23 - }  
24 - // 大图  
25 - Stack(){  
26 - Image(this.compDTO.operDataList[0].coverUrl)  
27 - .width('100%')  
28 - .borderRadius({topLeft: $r('app.float.image_border_radius'), topRight: $r('app.float.image_border_radius')})  
29 - Text('专题')  
30 - .fontSize($r('app.float.font_size_12'))  
31 - .padding({left: 8, right: 8, top: 3, bottom: 3})  
32 - .backgroundColor(Color.Red)  
33 - .fontColor(Color.White)  
34 - .borderRadius($r('app.float.button_border_radius'))  
35 - .margin({left: 5, bottom: 5})  
36 - }.alignContent(Alignment.BottomStart)  
37 - // 时间线--后端返回三个,  
38 - Column(){  
39 - ForEach(this.compDTO.operDataList[0].slideShows, (item:slideShows, index:number) => {  
40 - this.timelineItem(item, index)  
41 - })  
42 - }  
43 - // 底部-查看更多。根据接口返回的isMore判断是否显示查看更多  
44 - if(this.compDTO.operDataList[0].hasMore == 1) {  
45 - Row() {  
46 - Text("查看更多")  
47 - .fontSize($r("app.float.font_size_14"))  
48 - .fontColor($r("app.color.color_222222"))  
49 - .margin({ right: 1 })  
50 - Image($r("app.media.more"))  
51 - .width(14)  
52 - .height(14)  
53 - }  
54 - .backgroundColor($r('app.color.color_F5F5F5'))  
55 - .width(CommonConstants.FULL_WIDTH)  
56 - .height(40)  
57 - .borderRadius($r('app.float.button_border_radius'))  
58 - .justifyContent(FlexAlign.Center)  
59 - .margin({top: 5})  
60 - }  
61 - }  
62 - .width(CommonConstants.FULL_WIDTH)  
63 - .padding({  
64 - top: 14,  
65 - left: 16,  
66 - right: 16,  
67 - bottom: 14  
68 - })  
69 - .backgroundColor($r("app.color.white"))  
70 - .margin({ bottom: 8 })  
71 - .onClick((event: ClickEvent) => {  
72 - ProcessUtils.processPage(this.compDTO?.operDataList[0])  
73 - })  
74 - }  
75 -  
76 - @Builder timelineItem (item:slideShows, index:number) {  
77 - Column(){  
78 - Stack() {  
79 - if(index < this.compDTO.operDataList[0].slideShows.length - 1) {  
80 - Divider()  
81 - .vertical(true)  
82 - .color($r('app.color.color_EDEDED'))  
83 - .strokeWidth(1)  
84 - .margin({top: index > 0 ? 0 : 16, left: 4})  
85 - }  
86 - if(index > 0 && index == this.compDTO.operDataList[0].slideShows.length - 1) {  
87 - Divider()  
88 - .vertical(true)  
89 - .color($r('app.color.color_EDEDED'))  
90 - .strokeWidth(1)  
91 - .height(16)  
92 - .margin({left: 4})  
93 - }  
94 -  
95 - Column(){  
96 - Row() {  
97 - // 标题  
98 - Image($r("app.media.point_icon"))  
99 - .width(9)  
100 - .height(9)  
101 - .margin({ right: 5 })  
102 - Text(DateTimeUtils.formatDate(item.publishTime, "MM月dd日 HH:mm"))  
103 - .fontSize($r('app.float.font_size_12'))  
104 - .fontColor($r('app.color.color_222222'))  
105 - .fontWeight(600)  
106 - }  
107 - .width(CommonConstants.FULL_WIDTH)  
108 - .height(32)  
109 - .alignItems(VerticalAlign.Center)  
110 - Row() {  
111 - Text(item.newsTitle)  
112 - .fontSize($r('app.float.font_size_17'))  
113 - .fontWeight(400)  
114 - .fontColor($r('app.color.color_222222'))  
115 - .layoutWeight(1)  
116 - .maxLines(2)  
117 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
118 - .alignSelf(ItemAlign.Center)  
119 - .margin({left: 12})  
120 - if(item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {  
121 - Image(item.fullColumnImgUrls[0].url)  
122 - .width(90)  
123 - .height(60)  
124 - .borderRadius($r('app.float.image_border_radius'))  
125 - }  
126 - }  
127 - }  
128 - }  
129 - .alignContent(Alignment.TopStart)  
130 - }  
131 - .height(item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url ? 100 : 78)  
132 - .alignItems(HorizontalAlign.Start)  
133 - }  
134 -}  
1 -import { CompDTO, ContentDTO, slideShows } from 'wdBean';  
2 -import { CommonConstants } from 'wdConstant'  
3 -import { DateTimeUtils } from 'wdKit';  
4 -import { ProcessUtils } from '../../utils/ProcessUtils';  
5 -  
6 -  
7 -/**  
8 - * 大专题卡--CompStyle: 10  
9 - */  
10 -@Component  
11 -export struct CompStyle_10 {  
12 - @State compDTO: CompDTO = {} as CompDTO  
13 -  
14 - build() {  
15 - Column(){  
16 - // 顶部标题,最多两行  
17 - if(this.compDTO.operDataList[0].newsTitle) {  
18 - Text(this.compDTO.operDataList[0].newsTitle)  
19 - .width(CommonConstants.FULL_WIDTH)  
20 - .fontSize($r('app.float.font_size_17'))  
21 - .fontWeight(600)  
22 - .maxLines(2)  
23 - .textOverflow({overflow: TextOverflow.Ellipsis})  
24 - .margin({ bottom: 19 })  
25 - }  
26 - // 大图  
27 - Stack(){  
28 - Image(this.compDTO.operDataList[0] && this.compDTO.operDataList[0].coverUrl)  
29 - .width('100%')  
30 - .borderRadius({topLeft: $r('app.float.image_border_radius'), topRight: $r('app.float.image_border_radius')})  
31 - .onClick((event: ClickEvent) => {  
32 - ProcessUtils.processPage(this.compDTO?.operDataList[0])  
33 - })  
34 - Text('专题')  
35 - .fontSize($r('app.float.font_size_12'))  
36 - .padding({left: 8, right: 8, top: 3, bottom: 3})  
37 - .backgroundColor(Color.Red)  
38 - .fontColor(Color.White)  
39 - .borderRadius($r('app.float.button_border_radius'))  
40 - .margin({left: 5, bottom: 5})  
41 - }.alignContent(Alignment.BottomStart)  
42 - // 专题列表--后端返回三个,  
43 - Column(){  
44 - ForEach(this.compDTO.operDataList[0].slideShows, (item:slideShows, index:number) => {  
45 - this.timelineItem(item, index)  
46 - })  
47 - }  
48 - // 底部-查看更多。根据接口返回的isMore判断是否显示查看更多  
49 - if(this.compDTO.operDataList[0].hasMore == 1) {  
50 - Row() {  
51 - Text("查看更多")  
52 - .fontSize($r("app.float.font_size_14"))  
53 - .fontColor($r("app.color.color_222222"))  
54 - .margin({ right: 1 })  
55 - Image($r("app.media.more"))  
56 - .width(14)  
57 - .height(14)  
58 - }  
59 - .backgroundColor($r('app.color.color_F5F5F5'))  
60 - .width(CommonConstants.FULL_WIDTH)  
61 - .height(40)  
62 - .borderRadius($r('app.float.button_border_radius'))  
63 - .justifyContent(FlexAlign.Center)  
64 - .margin({top: 5})  
65 - .onClick((event: ClickEvent) => {  
66 - ProcessUtils.processPage(this.compDTO?.operDataList[0])  
67 - })  
68 - }  
69 - }  
70 - .width(CommonConstants.FULL_WIDTH)  
71 - .padding({  
72 - top: 14,  
73 - left: 16,  
74 - right: 16,  
75 - bottom: 14  
76 - })  
77 - .backgroundColor($r("app.color.white"))  
78 - .margin({ bottom: 8 })  
79 - }  
80 - @Builder timelineItem (item:slideShows, index:number) {  
81 - Row() {  
82 - Column(){  
83 - Text(item.newsTitle)  
84 - .fontSize($r('app.float.font_size_17'))  
85 - .fontWeight(400)  
86 - .fontColor($r('app.color.color_222222'))  
87 - .maxLines(2)  
88 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
89 - Row(){  
90 - // 展示发稿人  
91 - if(item.source) {  
92 - Text(item.source)  
93 - .fontSize($r('app.float.font_size_12'))  
94 - .fontColor($r('app.color.color_B0B0B0'))  
95 - .textOverflow({overflow: TextOverflow.Ellipsis})  
96 - .maxLines(1)  
97 - .width(item.source.length > 10 ? '60%' : '')  
98 -  
99 - Image($r('app.media.point'))  
100 - .width(16)  
101 - .height(16)  
102 - }  
103 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(String(item.publishTime))))  
104 - .fontSize($r("app.float.font_size_12"))  
105 - .fontColor($r("app.color.color_B0B0B0"))  
106 - }  
107 - .margin({top: 12})  
108 - }  
109 - .layoutWeight(1)  
110 - .alignItems(HorizontalAlign.Start)  
111 -  
112 - // 右侧图片  
113 - if(item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {  
114 - Image(item.fullColumnImgUrls[0].url)  
115 - .width(117)  
116 - .height(78)  
117 - .objectFit(ImageFit.Cover)  
118 - .borderRadius($r('app.float.image_border_radius'))  
119 - .margin({left: 12})  
120 - }  
121 - }  
122 - .padding({top: 10, bottom: 10})  
123 - .onClick((event: ClickEvent) => {  
124 - const str: string = JSON.stringify(this.compDTO.operDataList[0]);  
125 - const data: ContentDTO = JSON.parse(str)  
126 - data.objectId = item.newsId  
127 - data.relId = item.relId  
128 - data.objectType = String(item.objectType)  
129 - ProcessUtils.processPage(data)  
130 - })  
131 - }  
132 -}  
1 -import { CompDTO } from 'wdBean';  
2 -import { CommonConstants } from 'wdConstant';  
3 -import { ProcessUtils } from '../../utils/ProcessUtils';  
4 -  
5 -@Component  
6 -export struct HeadPictureCardComponent {  
7 - @State compDTO: CompDTO = {} as CompDTO  
8 -  
9 - build() {  
10 - Stack() {  
11 - Image(this.compDTO.operDataList[0].coverUrl)  
12 - .width(CommonConstants.FULL_WIDTH)  
13 - .autoResize(true)  
14 - .borderRadius($r('app.float.image_border_radius'))  
15 - if (this.compDTO.operDataList[0].newsTitle) {  
16 - Row()  
17 - .width(CommonConstants.FULL_WIDTH)  
18 - .height(59)  
19 - .linearGradient({  
20 - colors: [  
21 - ['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]  
22 - ]  
23 - })  
24 - Row() {  
25 - Text(this.compDTO.operDataList[0].newsTitle)  
26 - .width(CommonConstants.FULL_WIDTH)  
27 - .height(CommonConstants.FULL_HEIGHT)  
28 - .fontColor(Color.White)  
29 - .fontSize($r('app.float.normal_text_size'))  
30 - .fontWeight(FontWeight.Bold)  
31 - .maxLines(2)  
32 - .align(Alignment.Bottom)  
33 - }  
34 - .justifyContent(FlexAlign.Start)  
35 - .height(40)  
36 - .margin({ left: 12, bottom: 10, right: 12 })  
37 - }  
38 - }  
39 - .alignContent(Alignment.Bottom)  
40 - .width(CommonConstants.FULL_WIDTH)  
41 - .padding(  
42 - { top: 16, bottom: 16, left: 14, right: 14 })  
43 - .onClick((event: ClickEvent) => {  
44 - ProcessUtils.processPage(this.compDTO?.operDataList[0])  
45 - })  
46 - }  
47 -}  
@@ -27,11 +27,11 @@ export struct RecommendList { @@ -27,11 +27,11 @@ export struct RecommendList {
27 .width(CommonConstants.FULL_PARENT) 27 .width(CommonConstants.FULL_PARENT)
28 .justifyContent(FlexAlign.Start) 28 .justifyContent(FlexAlign.Start)
29 } 29 }
30 - ForEach(this.recommendList, (item: ContentDTO) => {  
31 - Row(){ 30 + ForEach(this.recommendList, (item: ContentDTO, index: number) => {
  31 + Row() {
32 CardParser({ contentDTO: item }); 32 CardParser({ contentDTO: item });
33 }.border({ 33 }.border({
34 - width:{bottom: 1}, 34 + width: { bottom: this.recommendList.length === index + 1 ? 0 : 1 },
35 color: '#f5f5f5' 35 color: '#f5f5f5'
36 }) 36 })
37 }, (item: ContentDTO) => JSON.stringify(item)) 37 }, (item: ContentDTO) => JSON.stringify(item))
1 -import { Action, CompDTO, ContentDTO, Params } from 'wdBean';  
2 -import { CompStyle } from 'wdConstant';  
3 -import { Logger, DateTimeUtils } from 'wdKit';  
4 -import { WDRouterRule } from 'wdRouter';  
5 -  
6 -const TAG = 'SingleImageCardAppComponent';  
7 -const FULL_PARENT: string = '100%';  
8 -  
9 -/**  
10 - * 单图卡-3行标题/2行标题  
11 - * 枚举值13  
12 - *  
13 - * 重磅推荐/精选/电视剧/电影/综艺/短剧/更多>/  
14 - */  
15 -@Entry  
16 -@Component  
17 -export struct SingleImageCardAppComponent {  
18 - // @State compDTO: CompDTO = {} as CompDTO  
19 -  
20 - @State compDTO: CompDTO = {  
21 - operDataList: [  
22 - {  
23 - coverSize: '660*371',  
24 - coverType: 1,  
25 - visitorComment: 10,  
26 - coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/a9028e7011bb440e94ba7c63d80b39b7.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',  
27 - newsTitle: '一条江豚的自述',  
28 - newsSummary: '我是生活在长江里的一头江豚,是长江中唯一的水生哺乳动物,更是国家一级保护动物。但曾几何时,我和我的江中小伙伴出现了生存危机……直到有一天,我突然发现,打渔人变成护渔人,江水变清澈了,长江逐渐恢复了生机,我的家族数量上升到了1249头。当长江之水再一次悠悠流淌,我们相拥在清澈波光中起舞。长江,我的家园。',  
29 - videoInfo: {  
30 - // clarity: 1,  
31 - resolutionHeight: 20,  
32 - resolutionWidth: 20,  
33 - videoDuration: 229,  
34 - videoLandScape: 1,  
35 - videoType: 1,  
36 - videoUrl: "https://cdnjdout.aikan.pdnews.cn/zhbj-20240116/vod/content/output/c72f4170db2c4d34befa453f60d39a69_opt.mp4",  
37 - firstFrameImageUri: "", // 首帧图;【视频内容,contentPictures中】  
38 - },  
39 -  
40 - } as ContentDTO  
41 - ]  
42 - } as CompDTO  
43 -  
44 - aboutToAppear() {  
45 - }  
46 -  
47 - build() {  
48 - Column() {  
49 - Text(this.compDTO.operDataList[0].newsTitle)  
50 - .fontSize(16)  
51 - .fontWeight(FontWeight.Bold)  
52 - .alignSelf(ItemAlign.Start)  
53 - .maxLines(3)  
54 - .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。  
55 - if (this.compDTO.operDataList[0].coverUrl) {  
56 - Stack() {  
57 - Image(this.compDTO.operDataList[0].coverUrl)  
58 - .borderRadius(5)  
59 - .aspectRatio(16 / 9)  
60 - .padding({ top: 10 })  
61 - if (this.compDTO.operDataList[0].videoInfo) {  
62 - Row() {  
63 - Image($r('app.media.iv_card_play_yellow_flag'))  
64 - .width(22)  
65 - .height(18)  
66 - Text(DateTimeUtils.getFormattedDuration(this.compDTO.operDataList[0].videoInfo.videoDuration * 1000))  
67 - .fontSize($r('app.float.font_size_13'))  
68 - .fontWeight(400)  
69 - .fontColor($r('app.color.color_fff'))  
70 - }  
71 - .alignItems(VerticalAlign.Bottom)  
72 - .height(18)  
73 - .padding({ right: 4 })  
74 - .margin({  
75 - right: 4,  
76 - bottom: 4  
77 - })  
78 - .backgroundColor($r('app.color.color_4d000000'))  
79 - }  
80 - }.alignContent(Alignment.BottomEnd)  
81 - }  
82 - if (this.compDTO.operDataList[0].newsSummary) {  
83 - Text(this.compDTO.operDataList[0].newsSummary)  
84 - .fontSize(14)  
85 - .padding({ top: 10 })  
86 - .alignSelf(ItemAlign.Start)  
87 - .maxLines(3)  
88 - .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。  
89 - }  
90 - Row() {  
91 - Text(this.compDTO.operDataList[0].visitorComment + "评")  
92 - .fontSize(12)  
93 - .fontColor(Color.Gray)  
94 - Image($r('app.media.icon_share'))  
95 - .width(16)  
96 - .height(16)  
97 - .margin(10)  
98 - }.width(FULL_PARENT)  
99 - .justifyContent(FlexAlign.SpaceBetween)  
100 - }  
101 - .margin(22)  
102 - }  
103 -}  
1 -import { Action, CompDTO, Params } from 'wdBean';  
2 -import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';  
3 -import { CompStyle } from 'wdConstant';  
4 -import { Logger, DateTimeUtils } from 'wdKit';  
5 -import { WDRouterRule } from 'wdRouter';  
6 -import { ProcessUtils } from '../../utils/ProcessUtils';  
7 -  
8 -const TAG = 'SingleImageCardComponent';  
9 -const FULL_PARENT: string = '100%';  
10 -  
11 -/**  
12 - * 单图卡-3行标题/2行标题  
13 - * 枚举值13  
14 - * ImageCard-03  
15 - * 重磅推荐/精选/电视剧/电影/综艺/短剧/更多>/  
16 - */  
17 -  
18 -@Component  
19 -export struct SingleImageCardComponent {  
20 - @State compDTO: CompDTO = {} as CompDTO  
21 -  
22 - aboutToAppear() {  
23 - //Logger.debug(TAG + "" + JSON.stringify(this.compDTO.operDataList));  
24 -  
25 - }  
26 -  
27 - build() {  
28 - Row() {  
29 - Column() {  
30 - Column() {  
31 - Text(this.compDTO.operDataList[0].newsTitle)  
32 - .fontSize(16)  
33 - .fontWeight(FontWeight.Normal)  
34 - .maxLines(3)//  
35 - .alignSelf(ItemAlign.Start)  
36 - .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。  
37 - }.height("80%")  
38 - .justifyContent(FlexAlign.Start)  
39 -  
40 - Row() {  
41 - if (this.compDTO.operDataList[0].source) {  
42 - Text(this.compDTO.operDataList[0].source)  
43 - .fontSize($r('app.float.font_size_12'))  
44 - .fontColor(Color.Gray)  
45 - .maxLines(1)  
46 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
47 - .width(this.compDTO.operDataList[0].source.length > 8 ? '50%' : '')  
48 - Image($r('app.media.point'))  
49 - .width(16)  
50 - .height(16)  
51 - }  
52 - if (this.compDTO.operDataList[0].publishTime && this.compDTO.operDataList[0].publishTime.length === 13) {  
53 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.compDTO.operDataList[0].publishTime)))  
54 - .fontSize($r('app.float.font_size_12'))  
55 - .fontColor(Color.Gray)  
56 - }  
57 - Text(this.compDTO.operDataList[0].visitorComment + '评')  
58 - .fontSize($r('app.float.font_size_12'))  
59 - .fontColor(Color.Gray)  
60 - .padding({  
61 - left: 5  
62 - })  
63 - }.alignSelf(ItemAlign.Start)  
64 - .height("20%")  
65 - .justifyContent(FlexAlign.Start)  
66 - }  
67 - .alignItems(HorizontalAlign.Start)  
68 - .justifyContent(FlexAlign.Start)  
69 - .width('58%')  
70 -  
71 - Blank(16)  
72 - if (this.compDTO.operDataList[0].coverUrl) {  
73 - Stack() {  
74 - Image(this.compDTO.operDataList[0].coverUrl)  
75 - .borderRadius(5)  
76 - .aspectRatio(this.compDTO.compStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4)  
77 - .height(this.compDTO.compStyle === CompStyle.Card_13 ? 90 : 180)  
78 - if (this.compDTO.operDataList[0].videoInfo) {  
79 - Row() {  
80 - Image($r('app.media.iv_card_play_yellow_flag'))  
81 - .width(22)  
82 - .height(18)  
83 - Text(DateTimeUtils.getFormattedDuration(this.compDTO.operDataList[0].videoInfo.videoDuration * 1000))  
84 - .fontSize($r('app.float.font_size_13'))  
85 - .fontWeight(400)  
86 - .fontColor($r('app.color.color_fff'))  
87 - }  
88 - .alignItems(VerticalAlign.Bottom)  
89 - .height(18)  
90 - .padding({ right: 4 })  
91 - .margin({  
92 - right: 4,  
93 - bottom: 4  
94 - })  
95 - .backgroundColor($r('app.color.color_4d000000'))  
96 - } else if(this.compDTO.operDataList[0].voiceInfo) {  
97 - Row() {  
98 - Image($r('app.media.icon_listen'))  
99 - .width(22)  
100 - .height(18)  
101 - Text(DateTimeUtils.getFormattedDuration(this.compDTO.operDataList[0].voiceInfo  
102 - .voiceDuration * 1000))  
103 - .fontSize($r('app.float.font_size_13'))  
104 - .fontWeight(400)  
105 - .fontColor($r('app.color.color_fff'))  
106 - }  
107 - .alignItems(VerticalAlign.Bottom)  
108 - .height(18)  
109 - .padding({ right: 4 })  
110 - .margin({  
111 - right: 4,  
112 - bottom: 4  
113 - })  
114 - .backgroundColor($r('app.color.color_4d000000'))  
115 - }  
116 - }.alignContent(Alignment.BottomEnd)  
117 - }  
118 - }  
119 - .onClick((event: ClickEvent) => {  
120 - ProcessUtils.processPage(this.compDTO?.operDataList[0])  
121 - })  
122 - .padding(  
123 - { top: 16, bottom: 16, left: 14, right: 14 })  
124 - .width(FULL_PARENT)  
125 - .height(this.compDTO.compStyle === CompStyle.Card_13 ? 127 : 217)  
126 - .justifyContent(FlexAlign.SpaceBetween)  
127 - }  
128 -}  
1 -// import { CommonConstants } from 'wdConstant/src/main/ets/constants/CommonConstants'  
2 -  
3 -@Entry  
4 -@Component  
5 -export struct SmallVideoCardComponent {  
6 - build() {  
7 - Row() {  
8 - Column() {  
9 - Text('“畅享亚运”新模式活动打卡,看杭州打开“金角银边活动启动 跟着体育明星云打卡,看杭州打开“金角银边')  
10 - .fontWeight(400)  
11 - .fontSize($r('app.float.font_size_17'))  
12 - .maxLines(4)  
13 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
14 - .fontColor($r('app.color.color_222222'))  
15 - .lineHeight(25)  
16 - Row() {  
17 - Text('人民日报')  
18 - .labelTextStyle()  
19 - Image($r('app.media.point'))  
20 - .width(16)  
21 - .height(16)  
22 - Text('20分钟前')  
23 - .labelTextStyle()  
24 - .margin({  
25 - right: 6  
26 - })  
27 - Text('2000评')  
28 - .labelTextStyle()  
29 - }  
30 - }  
31 - .height(156)  
32 - .layoutWeight(1)  
33 - .justifyContent(FlexAlign.SpaceBetween)  
34 - .alignItems(HorizontalAlign.Start)  
35 - .margin({ right: 12 })  
36 -  
37 - Stack({ alignContent: Alignment.BottomEnd }) {  
38 - Image('https://www.harmonyos.com/resource/image/partner/harmonyos-connect/pic_shengtai_connect_qudao_xianxia.jpg')  
39 - .width(117)  
40 - .aspectRatio(117 / 156)  
41 - .border({ radius: 4 })  
42 - Row() {  
43 - Image($r('app.media.iv_card_play_yellow_flag'))  
44 - .width(22)  
45 - .height(18)  
46 - Text('10:00')  
47 - .fontSize($r('app.float.font_size_13'))  
48 - .fontWeight(400)  
49 - .fontColor($r('app.color.color_fff'))  
50 - }  
51 - .height(18)  
52 - .padding({ right: 4 })  
53 - .margin({  
54 - right: 4,  
55 - bottom: 4  
56 - })  
57 - .backgroundColor($r('app.color.color_4d000000'))  
58 - }  
59 - }  
60 - // .width(CommonConstants.FULL_WIDTH)  
61 - .width('100%')  
62 - .height(184)  
63 - .padding({  
64 - top: 14,  
65 - bottom: 14,  
66 - left: 16,  
67 - right: 16  
68 - })  
69 - }  
70 -}  
71 -  
72 -@Extend(Text) function labelTextStyle() {  
73 - .fontSize($r('app.float.font_size_12'))  
74 - .fontWeight(400)  
75 - .fontColor($r('app.color.color_B0B0B0'))  
76 -}  
1 -//缩略标题  
2 -import { CommonConstants } from 'wdConstant'  
3 -import { CompDTO } from 'wdBean'  
4 -import { DateTimeUtils } from 'wdKit'  
5 -  
6 -@Component  
7 -export struct TitleAbbrComponent {  
8 - @State compDTO: CompDTO = {} as CompDTO  
9 -  
10 - build() {  
11 - Column() {  
12 - Text(this.compDTO.operDataList[0].newsTitle)  
13 - .fontSize($r("app.float.font_size_16"))  
14 - .fontColor($r("app.color.color_222222"))  
15 - .maxLines(3)  
16 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
17 - .width(CommonConstants.FULL_WIDTH)  
18 - Row() {  
19 - Text("锐评")  
20 - .fontSize($r("app.float.font_size_12"))  
21 - .fontColor($r("app.color.color_ED2800"))  
22 - Text(this.compDTO.operDataList[0].source)  
23 - .fontSize($r("app.float.font_size_12"))  
24 - .fontColor($r("app.color.color_B0B0B0"))  
25 - .margin({ left: 6 })  
26 - Image($r("app.media.point"))  
27 - .width(16)  
28 - .height(16)  
29 -  
30 - Text(DateTimeUtils.formatDate(Number.parseFloat(this.compDTO.operDataList[0].publishTime)))  
31 - .fontSize($r("app.float.font_size_12"))  
32 - .fontColor($r("app.color.color_B0B0B0"))  
33 -  
34 - }.width(CommonConstants.FULL_WIDTH)  
35 - .justifyContent(FlexAlign.Start)  
36 - .margin({ top: 8 })  
37 -  
38 - }.width(CommonConstants.FULL_WIDTH)  
39 - .padding({  
40 - top: 14,  
41 - left: 16,  
42 - right: 16,  
43 - bottom: 14  
44 - })  
45 - .backgroundColor($r("app.color.white"))  
46 - .margin({ bottom: 8 })  
47 - }  
48 -}  
1 -//全标题 "compStyle":"3",  
2 -import { CommonConstants } from 'wdConstant'  
3 -import { CompDTO } from 'wdBean'  
4 -import { DateTimeUtils } from 'wdKit/src/main/ets/utils/DateTimeUtils'  
5 -import { Logger } from 'wdKit/src/main/ets/utils/Logger'  
6 -import { ProcessUtils } from '../../utils/ProcessUtils'  
7 -  
8 -@Component  
9 -export struct TitleAllComponent {  
10 - @State compDTO: CompDTO = {} as CompDTO  
11 -  
12 - build() {  
13 - Column() {  
14 - Text(this.compDTO.operDataList[0].newsTitle)  
15 - .fontSize($r("app.float.font_size_16"))  
16 - .fontColor($r("app.color.color_222222"))  
17 - .width(CommonConstants.FULL_WIDTH)  
18 - Row() {  
19 - Text("锐评")  
20 - .fontSize($r("app.float.font_size_12"))  
21 - .fontColor($r("app.color.color_ED2800"))  
22 - Text(this.compDTO.operDataList[0].source)  
23 - .fontSize($r("app.float.font_size_12"))  
24 - .fontColor($r("app.color.color_B0B0B0"))  
25 - .margin({ left: 6 })  
26 - Image($r("app.media.point"))  
27 - .width(16)  
28 - .height(16)  
29 -  
30 - Text(DateTimeUtils.formatDate(Number.parseFloat(this.compDTO.operDataList[0].publishTime)))  
31 - .fontSize($r("app.float.font_size_12"))  
32 - .fontColor($r("app.color.color_B0B0B0"))  
33 -  
34 - }.width(CommonConstants.FULL_WIDTH)  
35 - .justifyContent(FlexAlign.Start)  
36 - .margin({ top: 8 })  
37 -  
38 - }.width("100%")  
39 - .padding({  
40 - top: 14,  
41 - left: 16,  
42 - right: 16,  
43 - bottom: 14  
44 - })  
45 - .backgroundColor($r("app.color.white"))  
46 - .margin({ bottom: 8 })  
47 - .onClick((event: ClickEvent)=>{  
48 - ProcessUtils.processPage(this.compDTO.operDataList[0])  
49 - })  
50 - }  
51 - aboutToAppear(){  
52 - // Logger.info("ssx",JSON.stringify(this.compDTO.operDataList[0]))  
53 - }  
54 -}  
1 -import { CompDTO } from 'wdBean';  
2 -import { CommonConstants } from 'wdConstant'  
3 -import { ProcessUtils } from '../../utils/ProcessUtils';  
4 -  
5 -const TAG: string = 'TriPicCardComponent';  
6 -  
7 -/**  
8 - * 三图卡:  
9 - * compstyle:4  
10 - * 卡片结构:上下结构  
11 - * 卡片宽度:充满父窗口  
12 - * 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9:  
13 - */  
14 -// @Entry  
15 -@Component  
16 -export struct TriPicCardComponent {  
17 - @State compDTO: CompDTO = {} as CompDTO  
18 -  
19 - build() {  
20 - Column() {  
21 -  
22 -  
23 - //body  
24 - Column() {  
25 - //新闻标题  
26 - Text(this.compDTO.operDataList[0].newsTitle)  
27 - .fontSize(17)  
28 - .fontColor('#222222')  
29 - .maxLines(3)  
30 - .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。  
31 - //三图  
32 - Row() {  
33 - Image(this.compDTO.operDataList[0].fullColumnImgUrls[0]?.url)  
34 - .width('32%')  
35 -  
36 - .height(75)  
37 - .borderRadius({ topLeft:4,bottomLeft:4 })  
38 -  
39 - Image(this.compDTO.operDataList[0].fullColumnImgUrls[1]?.url)  
40 - .width('32%')  
41 - .height(75)  
42 -  
43 - Image(this.compDTO.operDataList[0].fullColumnImgUrls[2]?.url)  
44 - .width('32%')  
45 - .height(75)  
46 - .borderRadius({ topRight:4,bottomRight:4 })  
47 -  
48 - }  
49 - .justifyContent(FlexAlign.SpaceBetween)  
50 - .width('100%')  
51 - .height(75)  
52 - .margin({top:8})  
53 - .borderRadius(8)  
54 -  
55 - }  
56 - .width('100%')  
57 - .justifyContent(FlexAlign.Start)  
58 - .alignItems(HorizontalAlign.Start)  
59 - .padding({top:14})  
60 - .onClick((event: ClickEvent)=>{  
61 - ProcessUtils.processPage(this.compDTO.operDataList[0])  
62 - })  
63 -  
64 -  
65 - //bottom  
66 - Row() {  
67 - Text(this.compDTO.operDataList[0].source)  
68 - .bottomTextStyle()  
69 - //间隔点  
70 - Image($r('app.media.point'))  
71 - .width(12)  
72 - .height(12)  
73 -  
74 - Text(this.compDTO.operDataList[0].publishTime)  
75 - .bottomTextStyle()  
76 - Text(' ')  
77 -  
78 - Text('518条评论')  
79 - .bottomTextStyle()  
80 -  
81 - }  
82 - .width('100%')  
83 -  
84 - .justifyContent(FlexAlign.Start)  
85 - // .padding({bottom:14})  
86 - .margin({top:8})  
87 - .padding({bottom:14})  
88 -  
89 - }  
90 - .width('100%')  
91 - .padding({top:8,left:16,right:16})  
92 -  
93 -  
94 - }  
95 -  
96 -}  
97 -  
98 -  
99 -@Extend(Text) function bottomTextStyle() {  
100 - .fontSize(12)  
101 - .fontColor('#B0B0B0')  
102 -}  
1 -import { Action, CompDTO, ContentDTO, Params } from 'wdBean';  
2 -import { CompStyle } from 'wdConstant';  
3 -import { Logger } from 'wdKit';  
4 -import { WDRouterRule } from 'wdRouter';  
5 -import { ProcessUtils } from '../../utils/ProcessUtils';  
6 -  
7 -const TAG = 'Zh_Grid_Layout-03';  
8 -const FULL_PARENT: string = '100%';  
9 -let listSize: number = 4;  
10 -  
11 -/**  
12 - * 金刚卡位  
13 - * 枚举值Zh_Grid_Layout-03  
14 - * Zh_Grid_Layout-03  
15 - *  
16 - */  
17 -@Preview  
18 -@Component  
19 -export struct ZhGridLayoutComponent {  
20 - @State compDTO: CompDTO = {} as CompDTO  
21 -  
22 - aboutToAppear() {  
23 - if (this.compDTO.operDataList) {  
24 - listSize = this.compDTO.operDataList.length > 5 ? 4 : this.compDTO.operDataList.length;  
25 - }  
26 - }  
27 -  
28 - build() {  
29 - GridRow({  
30 - columns: { sm: listSize, md: 8 },  
31 - breakpoints: { value: ['320vp', '520vp', '840vp'] }  
32 - }) {  
33 - ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {  
34 - GridCol() {  
35 - this.buildItemCard(this.compDTO.operDataList[index]);  
36 - }  
37 - })  
38 - }  
39 - }  
40 -  
41 - /**  
42 - * 组件项  
43 - *  
44 - * @param programmeBean item 组件项, 上面icon,下面标题  
45 - */  
46 - @Builder  
47 - buildItemCard(item: ContentDTO) {  
48 - Column() {  
49 - Image(item.coverUrl)  
50 - .width(44)  
51 - .aspectRatio(1 / 1)  
52 - .margin(16)  
53 - Text(item.newsTitle)  
54 - .fontSize(13)  
55 - .maxLines(1)  
56 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
57 - }  
58 - .width('100%')  
59 - .onClick((event: ClickEvent) => {  
60 - ProcessUtils.processPage(item)  
61 - })  
62 - }  
63 -}  
64 -  
65 -  
1 -import { CompDTO, ContentDTO } from 'wdBean';  
2 -import { CommonConstants } from 'wdConstant';  
3 -import { DateTimeUtils } from 'wdKit';  
4 -import { ProcessUtils } from '../../utils/ProcessUtils';  
5 -  
6 -/**  
7 - * 本地精选卡  
8 - * ZhSingleRow04  
9 - */  
10 -  
11 -@Component  
12 -export struct ZhSingleRow04 {  
13 - @State compDTO: CompDTO = {} as CompDTO  
14 -  
15 - aboutToAppear() {}  
16 -  
17 - build() {  
18 - Column(){  
19 - //顶部  
20 - Row(){  
21 - Row() {  
22 - Image($r("app.media.local_selection"))  
23 - .width(24)  
24 - .height(24)  
25 - .margin({ right: 4 })  
26 - Text(this.compDTO.objectTitle)  
27 - .fontSize($r("app.float.font_size_17"))  
28 - .fontColor($r("app.color.color_222222"))  
29 - .fontWeight(600)  
30 - }  
31 - Row() {  
32 - Text("更多")  
33 - .fontSize($r("app.float.font_size_14"))  
34 - .fontColor($r("app.color.color_999999"))  
35 - .margin({ right: 1 })  
36 - Image($r("app.media.more"))  
37 - .width(14)  
38 - .height(14)  
39 - }  
40 - }  
41 - .justifyContent(FlexAlign.SpaceBetween)  
42 - .margin({ top: 8, bottom: 8 })  
43 - .width('100%')  
44 - // 列表内容  
45 - List({ space: 12 }) {  
46 - ForEach(this.compDTO.operDataList, (item: ContentDTO) => {  
47 - ListItem() {  
48 - Row(){  
49 - if(item.coverUrl) {  
50 - Image(item.coverUrl)  
51 - .width(84)  
52 - .height(56)  
53 - .borderRadius(3)  
54 - .objectFit(ImageFit.Cover)  
55 - .padding({right: 6})  
56 - }  
57 - Column(){  
58 - Text(item.newsTitle)  
59 - .fontSize($r("app.float.font_size_16"))  
60 - .fontColor($r("app.color.color_212228"))  
61 - .fontWeight(400)  
62 - .maxLines(2)  
63 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
64 - .margin({ top: 8 })  
65 -  
66 - Row(){  
67 - Text(item.source)  
68 - .fontSize($r('app.float.font_size_12'))  
69 - .fontColor($r('app.color.color_B0B0B0'))  
70 - .textOverflow({overflow: TextOverflow.Ellipsis})  
71 - .maxLines(1)  
72 - .width(item.source.length > 10 ? '60%' : '')  
73 - Image($r("app.media.point"))  
74 - .width(16)  
75 - .height(16)  
76 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.compDTO.operDataList[0].publishTime)))  
77 - .fontSize($r("app.float.font_size_12"))  
78 - .fontColor($r("app.color.color_B0B0B0"))  
79 - }  
80 - .width('100%')  
81 - }  
82 - .width(200)  
83 - }  
84 - // .margin({right: 18})  
85 - .onClick(() =>{  
86 - ProcessUtils.processPage(item)  
87 - })  
88 - }  
89 - })  
90 - }  
91 - .listDirection(Axis.Horizontal)  
92 - .width('100%')  
93 - }  
94 - .width(CommonConstants.FULL_WIDTH)  
95 - .padding({  
96 - top: 14,  
97 - left: 16,  
98 - right: 16,  
99 - bottom: 14  
100 - })  
101 - .backgroundColor($r("app.color.white"))  
102 - .margin({ bottom: 8 })  
103 - }  
104 -}  
1 -import { WDPlayerController } from 'wdPlayer'; 1 +import { WDPlayerController, PlayerConstants } from 'wdPlayer';
2 import { PaperReaderSimpleDialog } from './PaperReaderDialog'; 2 import { PaperReaderSimpleDialog } from './PaperReaderDialog';
3 import { Logger } from 'wdKit/Index'; 3 import { Logger } from 'wdKit/Index';
  4 +import { AudioSuspensionModel } from '../viewmodel/AudioSuspensionModel';
4 5
5 const TAG = 'AudioDialog'; 6 const TAG = 'AudioDialog';
6 7
7 @Preview 8 @Preview
8 @CustomDialog 9 @CustomDialog
9 export struct AudioDialog { 10 export struct AudioDialog {
  11 + @Consume audioTitle: string;
  12 + @Consume currentTime: string;
  13 + @Consume totalTime: string;
  14 + @Consume progressVal: number;
  15 + @State currentStatus: number = 0;
  16 + controllerDetail?: CustomDialogController
  17 +
10 private playerController: WDPlayerController = new WDPlayerController(); 18 private playerController: WDPlayerController = new WDPlayerController();
11 private simpleAudioDialog: CustomDialogController = new CustomDialogController({ 19 private simpleAudioDialog: CustomDialogController = new CustomDialogController({
12 builder: PaperReaderSimpleDialog({ 20 builder: PaperReaderSimpleDialog({
@@ -21,8 +29,12 @@ export struct AudioDialog { @@ -21,8 +29,12 @@ export struct AudioDialog {
21 29
22 }) 30 })
23 31
  32 + private AudioSuspension = new AudioSuspensionModel(this.simpleAudioDialog)
  33 +
  34 +
24 onCancel() { 35 onCancel() {
25 Logger.info(TAG, "cj2024 onCancel = ") 36 Logger.info(TAG, "cj2024 onCancel = ")
  37 + this.AudioSuspension.setPlayerUrl()
26 } 38 }
27 39
28 /** 40 /**
@@ -38,34 +50,92 @@ export struct AudioDialog { @@ -38,34 +50,92 @@ export struct AudioDialog {
38 } 50 }
39 51
40 build() { 52 build() {
  53 + Stack({ alignContent: Alignment.End }) {
  54 + Column() { //标题 时间 进度条
  55 + Marquee({
  56 + start: true,
  57 + step: 5,
  58 + loop: Number.POSITIVE_INFINITY,
  59 + fromStart: true,
  60 + src: this.audioTitle
  61 + })
  62 + .width("60%")
  63 + .height(20)
  64 + .fontColor($r("app.color.color_222222"))
  65 + .fontSize(14)
  66 + .margin({ top: 10, left: 10 })
  67 + .alignSelf(ItemAlign.Start)
  68 + .onStart(() => {
  69 + console.info('Marquee animation complete onStart')
  70 + })
  71 + .onBounce(() => {
  72 + console.info('Marquee animation complete onBounce')
  73 + })
  74 + .onFinish(() => {
  75 + console.info('Marquee animation complete onFinish')
  76 + })
  77 +
41 Row() { 78 Row() {
42 - Image($r("app.media.icon_audio_pause")) 79 + Text(this.currentTime)
  80 + .fontSize($r('app.float.font_size_12'))
  81 + .fontColor($r('app.color.color_999999'))
  82 + .height("100%")
  83 + .alignSelf(ItemAlign.Start)
  84 + Text("/" + this.totalTime)
  85 + .fontSize($r('app.float.font_size_12'))
  86 + .fontColor($r('app.color.color_999999'))
  87 + .height("100%")
  88 + .alignSelf(ItemAlign.Start)
  89 +
  90 + }
  91 + .width("100%")
  92 + .height(16)
  93 + .margin({ top: 4, left: 10 })
  94 +
  95 + Progress({ value: this.progressVal, total: 100, type: ProgressType.Capsule })
  96 + .color($r('app.color.color_ED2800'))
  97 + .backgroundColor($r('app.color.white'))
  98 + .width("100%")
  99 + .height(3)
  100 + .margin({ top: 7 })
  101 + }
  102 + .width("100%")
  103 + .height("100%")
  104 + .justifyContent(FlexAlign.Start)
  105 +
  106 + Row() {
  107 + Image(this.currentStatus != PlayerConstants.STATUS_START ? $r("app.media.icon_audio_pause") : $r("app.media.icon_audio_playing"))
43 .objectFit(ImageFit.Contain) 108 .objectFit(ImageFit.Contain)
44 - .margin(18)  
45 .width(24) 109 .width(24)
46 .height(24) 110 .height(24)
47 - }  
48 - .width(60)  
49 - .height(60)  
50 - .backgroundColor(Color.White) 111 + .margin({ right: 12 })
51 .onClick(() => { 112 .onClick(() => {
52 - if (this.simpleAudioDialog) {  
53 - this.simpleAudioDialog.close()  
54 - this.simpleAudioDialog.open()  
55 - if (this.simpleAudioDialog) {  
56 - setTimeout(() => {  
57 - console.log('PaperReaderSimpleDialog delay 1s');  
58 - if (this.simpleAudioDialog != undefined) {  
59 - this.simpleAudioDialog.close() 113 + if (this.playerController) {
  114 + // this.onConfirm()
  115 + this.playerController.switchPlayOrPause()
  116 + this.currentStatus = this.playerController.getStatus()
60 } 117 }
61 - if (this.simpleAudioDialog != undefined) {  
62 - this.simpleAudioDialog.open()  
63 - }  
64 - }, 500000); 118 + })
  119 +
  120 + Image($r("app.media.icon_audio_close"))
  121 + .objectFit(ImageFit.Contain)
  122 + .width(24)
  123 + .height(24)
  124 + .onClick(() => {
  125 + if (this.playerController) {
  126 + this.playerController.stop()
65 } 127 }
  128 + if (this.controllerDetail) {
  129 + this.controllerDetail.close()
66 } 130 }
67 -  
68 }) 131 })
  132 + }.width(80)
  133 + .height(60)
69 134
70 } 135 }
  136 + .width("65%")
  137 + .height(60)
  138 + .backgroundColor(Color.White)
  139 + .borderRadius(2)
  140 + }
71 } 141 }
@@ -3,7 +3,7 @@ import MinePagePersonalFunctionsItem from '../viewmodel/MinePagePersonalFunction @@ -3,7 +3,7 @@ import MinePagePersonalFunctionsItem from '../viewmodel/MinePagePersonalFunction
3 import MinePageCreatorFunctionsItem from '../viewmodel/MinePageCreatorFunctionsItem' 3 import MinePageCreatorFunctionsItem from '../viewmodel/MinePageCreatorFunctionsItem'
4 import MinePageMoreFunctionModel from '../viewmodel/MinePageMoreFunctionModel'; 4 import MinePageMoreFunctionModel from '../viewmodel/MinePageMoreFunctionModel';
5 import HashMap from '@ohos.util.HashMap'; 5 import HashMap from '@ohos.util.HashMap';
6 -import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; 6 +import { HttpBizUtil, HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
7 import { MineAppointmentListItem } from '../viewmodel/MineAppointmentListItem'; 7 import { MineAppointmentListItem } from '../viewmodel/MineAppointmentListItem';
8 import { Logger, ResourcesUtils, StringUtils } from 'wdKit'; 8 import { Logger, ResourcesUtils, StringUtils } from 'wdKit';
9 import { MineFollowListDetailItem } from '../viewmodel/MineFollowListDetailItem'; 9 import { MineFollowListDetailItem } from '../viewmodel/MineFollowListDetailItem';
@@ -371,7 +371,8 @@ class MinePageDatasModel{ @@ -371,7 +371,8 @@ class MinePageDatasModel{
371 fetchMineUserLevelData() { 371 fetchMineUserLevelData() {
372 let url = HttpUrlUtils.getMineUserLevelDataUrl() 372 let url = HttpUrlUtils.getMineUserLevelDataUrl()
373 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 373 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
374 - return WDHttp.get<ResponseDTO<MineUserLevelItem>>(url, headers) 374 + // return WDHttp.get<ResponseDTO<MineUserLevelItem>>(url, headers)
  375 + return HttpBizUtil.get<MineUserLevelItem>(url, headers)
375 }; 376 };
376 377
377 async getMineUserLevelDataLocal(context: Context): Promise<MineUserLevelItem> { 378 async getMineUserLevelDataLocal(context: Context): Promise<MineUserLevelItem> {
@@ -409,7 +410,8 @@ class MinePageDatasModel{ @@ -409,7 +410,8 @@ class MinePageDatasModel{
409 fetchMineUserDetailData() { 410 fetchMineUserDetailData() {
410 let url = HttpUrlUtils.getMineUserDetailDataUrl() 411 let url = HttpUrlUtils.getMineUserDetailDataUrl()
411 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 412 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
412 - return WDHttp.get<ResponseDTO<MineUserDetailItem>>(url, headers) 413 + // return WDHttp.get<ResponseDTO<MineUserDetailItem>>(url, headers)
  414 + return HttpBizUtil.get<MineUserDetailItem>(url, headers)
413 }; 415 };
414 416
415 async getMineUserDetailDataLocal(context: Context): Promise<MineUserDetailItem> { 417 async getMineUserDetailDataLocal(context: Context): Promise<MineUserDetailItem> {
@@ -5,6 +5,7 @@ import HashMap from '@ohos.util.HashMap'; @@ -5,6 +5,7 @@ import HashMap from '@ohos.util.HashMap';
5 import { SearchHistoryItem } from '../viewmodel/SearchHistoryItem'; 5 import { SearchHistoryItem } from '../viewmodel/SearchHistoryItem';
6 import { SearchHotContentItem } from '../viewmodel/SearchHotContentItem'; 6 import { SearchHotContentItem } from '../viewmodel/SearchHotContentItem';
7 import { SearchResultCountItem } from '../viewmodel/SearchResultCountItem'; 7 import { SearchResultCountItem } from '../viewmodel/SearchResultCountItem';
  8 +import { SearchResultContentData } from '../viewmodel/SearchResultContentData';
8 9
9 const TAG = "SearcherAboutDataModel" 10 const TAG = "SearcherAboutDataModel"
10 11
@@ -35,6 +36,11 @@ class SearcherAboutDataModel{ @@ -35,6 +36,11 @@ class SearcherAboutDataModel{
35 public async putSearchHistoryData(content:string){ 36 public async putSearchHistoryData(content:string){
36 let history = SPHelper.default.getSync(this.SEARCH_HISTORY_KEY,"[]") as string 37 let history = SPHelper.default.getSync(this.SEARCH_HISTORY_KEY,"[]") as string
37 this.searchHistoryData = JSON.parse(history) 38 this.searchHistoryData = JSON.parse(history)
  39 + this.searchHistoryData.forEach((element,index) => {
  40 + if (element.searchContent == content) {
  41 + this.searchHistoryData.splice(index,1)
  42 + }
  43 + });
38 this.searchHistoryData.splice(0,0,new SearchHistoryItem(content)) 44 this.searchHistoryData.splice(0,0,new SearchHistoryItem(content))
39 await SPHelper.default.saveSync(this.SEARCH_HISTORY_KEY, JSON.stringify(this.searchHistoryData)); 45 await SPHelper.default.saveSync(this.SEARCH_HISTORY_KEY, JSON.stringify(this.searchHistoryData));
40 } 46 }
@@ -234,6 +240,45 @@ class SearcherAboutDataModel{ @@ -234,6 +240,45 @@ class SearcherAboutDataModel{
234 return compRes.data 240 return compRes.data
235 } 241 }
236 242
  243 + /**
  244 + * 搜索结果 展示列表
  245 + */
  246 + getSearchResultListData(pageSize:string,pageNum:string,searchType:string,keyword:string,context: Context): Promise<SearchResultContentData> {
  247 + return new Promise<SearchResultContentData>((success, error) => {
  248 + Logger.info(TAG, `getSearchResultListData start`);
  249 + this.fetchSearchResultListData(pageSize,pageNum,searchType,keyword).then((navResDTO: ResponseDTO<SearchResultContentData>) => {
  250 + if (!navResDTO || navResDTO.code != 0) {
  251 + success(this.getSearchResultListDataLocal(context))
  252 + return
  253 + }
  254 + Logger.info(TAG, "getSearchResultListData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp);
  255 + let navigationBean = navResDTO.data as SearchResultContentData
  256 + success(navigationBean);
  257 + }).catch((err: Error) => {
  258 + Logger.error(TAG, `getSearchResultListData catch, error.name : ${err.name}, error.message:${err.message}`);
  259 + success(this.getSearchResultListDataLocal(context))
  260 + })
  261 + })
  262 + }
  263 +
  264 + fetchSearchResultListData(pageSize:string,pageNum:string,searchType:string,keyword:string) {
  265 + let url = HttpUrlUtils.getSearchResultListDataUrl() + `?pageSize=${pageSize}&pageNum=${pageNum}&searchType=${searchType}&keyword=${keyword}`
  266 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  267 + return WDHttp.get<ResponseDTO<SearchResultContentData>>(url, headers)
  268 + };
  269 +
  270 + async getSearchResultListDataLocal(context: Context): Promise<SearchResultContentData> {
  271 + Logger.info(TAG, `getSearchResultListDataLocal start`);
  272 + let compRes: ResponseDTO<SearchResultContentData> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<SearchResultContentData>>(context,'search_result_list_data.json' );
  273 + if (!compRes || !compRes.data) {
  274 + Logger.info(TAG, `getSearchResultListDataLocal compRes is empty`);
  275 + return new SearchResultContentData()
  276 + }
  277 + Logger.info(TAG, `getSearchResultListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
  278 + return compRes.data
  279 + }
  280 +
  281 +
237 } 282 }
238 283
239 const searcherAboutDataModel = SearcherAboutDataModel.getInstance() 284 const searcherAboutDataModel = SearcherAboutDataModel.getInstance()
@@ -2,6 +2,7 @@ import router from '@ohos.router' @@ -2,6 +2,7 @@ import router from '@ohos.router'
2 import { Params } from 'wdBean'; 2 import { Params } from 'wdBean';
3 import { StringUtils } from 'wdKit'; 3 import { StringUtils } from 'wdKit';
4 import { WDRouterPage, WDRouterRule } from 'wdRouter'; 4 import { WDRouterPage, WDRouterRule } from 'wdRouter';
  5 +import { CardParser } from '../components/CardParser';
5 import { HomePageBottomComponent } from '../components/mine/home/HomePageBottomComponent'; 6 import { HomePageBottomComponent } from '../components/mine/home/HomePageBottomComponent';
6 import MinePageDatasModel from '../model/MinePageDatasModel'; 7 import MinePageDatasModel from '../model/MinePageDatasModel';
7 8
@@ -182,14 +183,37 @@ struct MineHomePage { @@ -182,14 +183,37 @@ struct MineHomePage {
182 183
183 Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') 184 Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
184 185
  186 + Column(){
  187 + Column() {
  188 + // 页签
  189 + Row({ space: 7 }) {
  190 + Scroll() {
  191 + Row() {
  192 + this.TabBuilder(0,"评论")
  193 + this.TabBuilder(1,"关注")
  194 + }
  195 + .justifyContent(FlexAlign.Start)
  196 + }
  197 + .align(Alignment.Start)
  198 + .scrollable(ScrollDirection.Horizontal)
  199 + .scrollBar(BarState.Off)
  200 + .width('90%')
  201 + .padding({left:'31lpx'})
  202 + }
  203 + .alignItems(VerticalAlign.Bottom)
  204 + .width('100%')
  205 + }
  206 + .alignItems(HorizontalAlign.Start)
  207 + .width('100%')
  208 +
185 //tab 页面 209 //tab 页面
186 Tabs({controller: this.controller}) { 210 Tabs({controller: this.controller}) {
187 TabContent() { 211 TabContent() {
188 HomePageBottomComponent({style:0}) 212 HomePageBottomComponent({style:0})
189 - }.tabBar(this.TabBuilder(0,"评论")) 213 + }
190 TabContent() { 214 TabContent() {
191 HomePageBottomComponent({style:1}) 215 HomePageBottomComponent({style:1})
192 - }.tabBar(this.TabBuilder(1,"关注")) 216 + }
193 } 217 }
194 .backgroundColor($r('app.color.white')) 218 .backgroundColor($r('app.color.white'))
195 .animationDuration(0) 219 .animationDuration(0)
@@ -197,6 +221,8 @@ struct MineHomePage { @@ -197,6 +221,8 @@ struct MineHomePage {
197 this.currentIndex = index 221 this.currentIndex = index
198 }) 222 })
199 .vertical(false) 223 .vertical(false)
  224 + .barHeight(0)
  225 + }
200 }.width("100%") 226 }.width("100%")
201 } 227 }
202 .edgeEffect(EdgeEffect.None) 228 .edgeEffect(EdgeEffect.None)
@@ -206,8 +232,8 @@ struct MineHomePage { @@ -206,8 +232,8 @@ struct MineHomePage {
206 } 232 }
207 }.width('100%') 233 }.width('100%')
208 .layoutWeight(1) 234 .layoutWeight(1)
209 -  
210 } 235 }
  236 +
211 @Builder MineHomeTitleTransparent() { 237 @Builder MineHomeTitleTransparent() {
212 RelativeContainer() { 238 RelativeContainer() {
213 //标题栏目 239 //标题栏目
@@ -342,9 +368,9 @@ struct MineHomePage { @@ -342,9 +368,9 @@ struct MineHomePage {
342 this.currentIndex = index 368 this.currentIndex = index
343 this.controller.changeIndex(this.currentIndex) 369 this.controller.changeIndex(this.currentIndex)
344 }) 370 })
345 - .height('100%')  
346 - .width('100%')  
347 - .margin({right:'9lpx'}) 371 + .height('77lpx')
  372 + .width('70lpx')
  373 + .margin({right:'29lpx'})
348 } 374 }
349 375
350 /** 376 /**
@@ -172,17 +172,42 @@ struct OtherNormalUserHomePage { @@ -172,17 +172,42 @@ struct OtherNormalUserHomePage {
172 .width('100%') 172 .width('100%')
173 .backgroundColor($r('app.color.white')) 173 .backgroundColor($r('app.color.white'))
174 } 174 }
  175 +
175 //间隔符 176 //间隔符
176 Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') 177 Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
177 178
  179 + Column(){
  180 + Column() {
  181 + // 页签
  182 + Row({ space: 7 }) {
  183 + Scroll() {
  184 + Row() {
  185 + this.TabBuilder(0,"评论")
  186 + this.TabBuilder(1,"关注")
  187 + }
  188 + .justifyContent(FlexAlign.Start)
  189 + }
  190 + .align(Alignment.Start)
  191 + .scrollable(ScrollDirection.Horizontal)
  192 + .scrollBar(BarState.Off)
  193 + .width('90%')
  194 + .padding({left:'31lpx'})
  195 + }
  196 + .alignItems(VerticalAlign.Bottom)
  197 + .width('100%')
  198 + }
  199 + .backgroundColor($r('app.color.white'))
  200 + .alignItems(HorizontalAlign.Start)
  201 + .width('100%')
  202 +
178 //tab 页面 203 //tab 页面
179 Tabs({controller: this.controller}) { 204 Tabs({controller: this.controller}) {
180 TabContent() { 205 TabContent() {
181 OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum}) 206 OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum})
182 - }.tabBar(this.TabBuilder(0,"评论")) 207 + }
183 TabContent() { 208 TabContent() {
184 OtherHomePageBottomFollowComponent({curUserId:this.curUserId}) 209 OtherHomePageBottomFollowComponent({curUserId:this.curUserId})
185 - }.tabBar(this.TabBuilder(1,"关注")) 210 + }
186 } 211 }
187 .backgroundColor($r('app.color.white')) 212 .backgroundColor($r('app.color.white'))
188 .animationDuration(0) 213 .animationDuration(0)
@@ -190,6 +215,8 @@ struct OtherNormalUserHomePage { @@ -190,6 +215,8 @@ struct OtherNormalUserHomePage {
190 this.currentIndex = index 215 this.currentIndex = index
191 }) 216 })
192 .vertical(false) 217 .vertical(false)
  218 + .barHeight(0)
  219 + }
193 }.width("100%") 220 }.width("100%")
194 } 221 }
195 .edgeEffect(EdgeEffect.None) 222 .edgeEffect(EdgeEffect.None)
@@ -300,9 +327,9 @@ struct OtherNormalUserHomePage { @@ -300,9 +327,9 @@ struct OtherNormalUserHomePage {
300 this.currentIndex = index 327 this.currentIndex = index
301 this.controller.changeIndex(this.currentIndex) 328 this.controller.changeIndex(this.currentIndex)
302 }) 329 })
303 - .height('100%')  
304 - .width('100%')  
305 - .margin({right:'9lpx'}) 330 + .height('77lpx')
  331 + .width('70lpx')
  332 + .margin({right:'29lpx'})
306 } 333 }
307 334
308 335
@@ -6,6 +6,7 @@ import { @@ -6,6 +6,7 @@ import {
6 CompInfoBean, 6 CompInfoBean,
7 ContentDetailDTO, 7 ContentDetailDTO,
8 ContentDTO, 8 ContentDTO,
  9 + contentListParams,
9 InteractDataDTO, 10 InteractDataDTO,
10 LiveReviewDTO, 11 LiveReviewDTO,
11 MorningEveningPaperDTO, 12 MorningEveningPaperDTO,
@@ -14,11 +15,10 @@ import { @@ -14,11 +15,10 @@ import {
14 NewspaperTimeInfoBean, 15 NewspaperTimeInfoBean,
15 PageDTO, 16 PageDTO,
16 PageInfoBean, 17 PageInfoBean,
  18 + PageInfoDTO,
17 postBatchAttentionStatusParams, 19 postBatchAttentionStatusParams,
18 postBatchAttentionStatusResult, 20 postBatchAttentionStatusResult,
19 postExecuteCollectRecordParams, 21 postExecuteCollectRecordParams,
20 - contentListParams,  
21 - PageInfoDTO,  
22 postExecuteLikeParams, 22 postExecuteLikeParams,
23 postInteractAccentionOperateParams, 23 postInteractAccentionOperateParams,
24 postRecommendListParams 24 postRecommendListParams
@@ -48,10 +48,10 @@ export class PageRepository { @@ -48,10 +48,10 @@ export class PageRepository {
48 48
49 static getCompInfoUrl(pageId: string, groupId: string, channelId: string, groupStrategy: number, currentPage: number, pageSize: number) { 49 static getCompInfoUrl(pageId: string, groupId: string, channelId: string, groupStrategy: number, currentPage: number, pageSize: number) {
50 let url = HttpUrlUtils.getHost(); 50 let url = HttpUrlUtils.getHost();
51 - if(1 == groupStrategy){ 51 + if (1 == groupStrategy) {
52 //推荐 52 //推荐
53 url = url + HttpUrlUtils.COMP_REC_PATH; 53 url = url + HttpUrlUtils.COMP_REC_PATH;
54 - }else{ 54 + } else {
55 //非推荐 55 //非推荐
56 url = url + HttpUrlUtils.COMP_PATH; 56 url = url + HttpUrlUtils.COMP_PATH;
57 } 57 }
@@ -194,8 +194,14 @@ export class PageRepository { @@ -194,8 +194,14 @@ export class PageRepository {
194 return WDHttp.get<ResponseDTO<PageInfoDTO>>(url, headers) 194 return WDHttp.get<ResponseDTO<PageInfoDTO>>(url, headers)
195 }; 195 };
196 196
197 - static fetchCompData(pageId: string, groupId: string, channelId: string,groupStrategy:number, currentPage: number, pageSize: number) {  
198 - let url = PageRepository.getCompInfoUrl(pageId, groupId, channelId,groupStrategy, currentPage, pageSize) 197 + static fetchLivePageData(pageId: string, groupId: string, channelId: string, groupStrategy: number, currentPage: number, pageSize: number) {
  198 + let url = PageRepository.getCompInfoUrl(pageId, groupId, channelId, groupStrategy, currentPage, pageSize)
  199 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  200 + return WDHttp.get<ResponseDTO<PageDTO>>(url, headers)
  201 + };
  202 +
  203 + static fetchCompData(pageId: string, groupId: string, channelId: string, groupStrategy: number, currentPage: number, pageSize: number) {
  204 + let url = PageRepository.getCompInfoUrl(pageId, groupId, channelId, groupStrategy, currentPage, pageSize)
199 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 205 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
200 return WDHttp.get<ResponseDTO<PageDTO>>(url, headers) 206 return WDHttp.get<ResponseDTO<PageDTO>>(url, headers)
201 }; 207 };
@@ -103,9 +103,10 @@ export class ProcessUtils { @@ -103,9 +103,10 @@ export class ProcessUtils {
103 103
104 private static gotoSpecialTopic(content: ContentDTO) { 104 private static gotoSpecialTopic(content: ContentDTO) {
105 let taskAction: Action = { 105 let taskAction: Action = {
106 - type: 'JUMP_H5_BY_WEB_VIEW', 106 + type: 'JUMP_INNER_NEW_PAGE',
107 params: { 107 params: {
108 - url: content.linkUrl 108 + url: content.linkUrl,
  109 + pageID: 'SPACIAL_TOPIC_PAGE',
109 } as Params, 110 } as Params,
110 }; 111 };
111 WDRouterRule.jumpWithAction(taskAction) 112 WDRouterRule.jumpWithAction(taskAction)
  1 +import { Logger } from 'wdKit';
  2 +import { WDPlayerController } from 'wdPlayer';
  3 +
  4 +const TAG = 'AudioSuspensionModel'
  5 +
  6 +/**
  7 + * 音频悬浮窗公共方法类
  8 + */
  9 +export class AudioSuspensionModel {
  10 + public playerController: SubscribedAbstractProperty<WDPlayerController> = AppStorage.link<WDPlayerController>('playerController')
  11 + public simpleAudioDialog: CustomDialogController = {} as CustomDialogController
  12 + constructor(simpleAudioDialog: CustomDialogController) {
  13 + this.simpleAudioDialog = simpleAudioDialog
  14 +
  15 + this.initPlayerController()
  16 + }
  17 + /**
  18 + * 判断音频实例是否已存在,不存在则创建
  19 + */
  20 + private initPlayerController() {
  21 + if(this.playerController === undefined) {
  22 + Logger.info(TAG, 'playerController undefined')
  23 + AppStorage.setOrCreate('playerController', new WDPlayerController());
  24 + this.playerController = AppStorage.link<WDPlayerController>('playerController')
  25 + Logger.info(TAG, 'playerController create success')
  26 + } else {
  27 + Logger.info(TAG, 'playerController already exit')
  28 + }
  29 + }
  30 + /**
  31 + * 配置音频地址
  32 + */
  33 + public setPlayerUrl() {
  34 + // this.playerController.switchPlayOrPause()
  35 + Logger.info(TAG, 'handlePlayer')
  36 + }
  37 +
  38 + public delete() {
  39 + let res: boolean = AppStorage.delete('PropB');
  40 + Logger.info(TAG, `delete: ${res}`)
  41 + }
  42 +
  43 +
  44 +
  45 +}
@@ -11,6 +11,15 @@ export class LogoutViewModel{ @@ -11,6 +11,15 @@ export class LogoutViewModel{
11 requestLogout(){ 11 requestLogout(){
12 return new Promise<string>((success, fail) => { 12 return new Promise<string>((success, fail) => {
13 this.logout.requestLogout().then((data) => { 13 this.logout.requestLogout().then((data) => {
  14 + LogoutViewModel.clearLoginInfo()
  15 + success(data)
  16 + }).catch((message: string) => {
  17 + fail(message)
  18 + })
  19 + })
  20 + }
  21 +
  22 + static clearLoginInfo() {
14 SPHelper.default.save(SpConstants.USER_FIRST_MARK, '') 23 SPHelper.default.save(SpConstants.USER_FIRST_MARK, '')
15 SPHelper.default.save(SpConstants.USER_ID, '') 24 SPHelper.default.save(SpConstants.USER_ID, '')
16 SPHelper.default.save(SpConstants.USER_JWT_TOKEN, '') 25 SPHelper.default.save(SpConstants.USER_JWT_TOKEN, '')
@@ -23,10 +32,5 @@ export class LogoutViewModel{ @@ -23,10 +32,5 @@ export class LogoutViewModel{
23 HttpUrlUtils.setUserId("") 32 HttpUrlUtils.setUserId("")
24 HttpUrlUtils.setUserType("") 33 HttpUrlUtils.setUserType("")
25 HttpUrlUtils.setUserToken('') 34 HttpUrlUtils.setUserToken('')
26 - success(data)  
27 - }).catch((message: string) => {  
28 - fail(message)  
29 - })  
30 - })  
31 } 35 }
32 } 36 }
@@ -7,11 +7,9 @@ import { @@ -7,11 +7,9 @@ import {
7 MorningEveningPaperDTO, 7 MorningEveningPaperDTO,
8 NavigationBodyDTO, 8 NavigationBodyDTO,
9 PageDTO, 9 PageDTO,
10 - PageInfoBean,  
11 - PageInfoDTO 10 + PageInfoBean
12 } from 'wdBean'; 11 } from 'wdBean';
13 12
14 -  
15 import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit'; 13 import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit';
16 import { ResponseDTO, } from 'wdNetwork'; 14 import { ResponseDTO, } from 'wdNetwork';
17 import { PageRepository } from '../repository/PageRepository'; 15 import { PageRepository } from '../repository/PageRepository';
@@ -145,7 +143,36 @@ export class PageViewModel extends BaseViewModel { @@ -145,7 +143,36 @@ export class PageViewModel extends BaseViewModel {
145 143
146 async getPageData(pageModel: PageModel, context?: Context): Promise<PageDTO> { 144 async getPageData(pageModel: PageModel, context?: Context): Promise<PageDTO> {
147 Logger.debug(TAG, 'getPageData pageId: ' + pageModel.pageId); 145 Logger.debug(TAG, 'getPageData pageId: ' + pageModel.pageId);
148 - return this.parseComp(PageRepository.fetchCompData(pageModel.pageId, pageModel.groupId, pageModel.channelId, pageModel.isRecGroup==true?1:0,pageModel.currentPage, pageModel.pageSize)) 146 + return this.parseComp(PageRepository.fetchCompData(pageModel.pageId, pageModel.groupId, pageModel.channelId, pageModel.isRecGroup == true ? 1 : 0, pageModel.currentPage, pageModel.pageSize))
  147 + }
  148 +
  149 + async getLivePageData(pageId: string, groupId: string, channelId: string, groupStrategy: number, currentPage: number
  150 + , pageSize: number, context: Context): Promise<PageDTO> {
  151 + Logger.debug(TAG, 'getPageData pageId: ' + pageId);
  152 + if (mock_switch) {
  153 + return this.getPageData1(currentPage, context);
  154 + }
  155 + return new Promise<PageDTO>((success, error) => {
  156 + PageRepository.fetchLivePageData(pageId, groupId, channelId, groupStrategy, currentPage, pageSize)
  157 + .then((resDTO: ResponseDTO<PageDTO>) => {
  158 + if (!resDTO || !resDTO.data) {
  159 + Logger.error(TAG, 'getNavData then resDTO is empty');
  160 + error('resDTO is empty');
  161 + return
  162 + }
  163 + if (resDTO.code != 0) {
  164 + Logger.error(TAG, `getNavData then code:${resDTO.code}, message:${resDTO.message}`);
  165 + error('resDTO Response Code is failure');
  166 + return
  167 + }
  168 + Logger.info(TAG, "getNavData then,resDTO.timestamp:" + resDTO.timestamp);
  169 + success(resDTO.data);
  170 + })
  171 + .catch((err: Error) => {
  172 + Logger.error(TAG, `getPageData catch, error.name : ${err.name}, error.message:${err.message}`);
  173 + error(err);
  174 + })
  175 + })
149 } 176 }
150 177
151 private parseComp(getData: Promise<ResponseDTO<PageDTO>>): Promise<PageDTO> { 178 private parseComp(getData: Promise<ResponseDTO<PageDTO>>): Promise<PageDTO> {
  1 +import { SearchResultContentItem } from './SearchResultContentItem'
  2 +
  3 +@Observed
  4 +export class SearchResultContentData{
  5 + list:SearchResultContentItem[] = []
  6 +
  7 + keyword:string = ""
  8 + pageNum: number = 0
  9 + pageSize: number = 20
  10 + totalCount: number = 0
  11 +
  12 +
  13 +}
  1 +
  2 +export class SearchResultContentItem{
  3 + data:SearchDescription = new SearchDescription()
  4 + resultType:string = ""
  5 +}
  6 +
  7 +class SearchDescription{
  8 + likeEnable: string = ""
  9 + previewUri: string = ""
  10 + firstFrameImageBucket: string = ""
  11 + appImg: string = ""
  12 + onlineStatus: string = ""
  13 + createUserName: string = ""
  14 + contentCheck: string = ""
  15 + type: string = ""
  16 + titleOsst: string = ""
  17 + coverHImageBucket: string = ""
  18 + shareImageUri: string = ""
  19 + searchTypeInt: string = ""
  20 + authIcon: string = ""
  21 + id: string = ""
  22 + newOld: string = ""
  23 + seoTags: string = ""
  24 + publishTime: string = ""
  25 + feedControl: string = ""
  26 + saveType: string = ""
  27 + userTypeInt: string = ""
  28 + userOrigin: string = ""
  29 + creatorType: string = ""
  30 + planStartTime: string = ""
  31 + waresSwitch: string = ""
  32 + introductionLiteral: string = ""
  33 + topicType: string = ""
  34 + hotFlag: string = ""
  35 + coverUrl: string = ""
  36 + itemId: string = ""
  37 + titleEn: string = ""
  38 + matrixId: string = ""
  39 + tplId: string = ""
  40 + joinActivity: string = ""
  41 + status: string = ""
  42 + headerPhotoUrl: string = ""
  43 + zhSearch: string = ""
  44 + activityControl: string = ""
  45 + city: string = ""
  46 + showTitleIng: string = ""
  47 + shareFlag: string = ""
  48 + creatorName: string = ""
  49 + className: string = ""
  50 + showTitleNo: string = ""
  51 + liveSwitch: string = ""
  52 + likesStyle: string = ""
  53 + dataKey: string = ""
  54 + search: string = ""
  55 + puserId: string = ""
  56 + top: string = ""
  57 + titleLiteral: string = ""
  58 + countryCode: string = ""
  59 + startTime: string = ""
  60 + shareDescription: string = ""
  61 + channelId: string = ""
  62 + openComment: string = ""
  63 + creatorClassify: string = ""
  64 + previewBucket: string = ""
  65 + picCount: string = ""
  66 + recommendControl: string = ""
  67 + creatorNameLiteral: string = ""
  68 + subjects: string = ""
  69 + updateUser: string = ""
  70 + i: string = ""
  71 + updateTime: string = ""
  72 + userId: string = ""
  73 + showTitleEd: string = ""
  74 + authTo: string = ""
  75 + rmhPlatformInt: string = ""
  76 + giftEnable: string = ""
  77 + titleEnosst: string = ""
  78 + shareCoverUrl: string = ""
  79 + deleted: string = ""
  80 + zhOperateFlag: string = ""
  81 + shareTitle: string = ""
  82 + scrollUpdated: string = ""
  83 + createTime: string = ""
  84 + creatorBan: string = ""
  85 + publishTimeInt: string = ""
  86 + organization: string = ""
  87 + channelName: string = ""
  88 + createUser: string = ""
  89 + currentPoliticsFlag: string = ""
  90 + endTime: string = ""
  91 + sourceId: string = ""
  92 + country: string = ""
  93 + secondClassify: string = ""
  94 + createUserId: string = ""
  95 + firstFrameImageUri: string = ""
  96 + pubTime: string = ""
  97 + openLikes: string = ""
  98 + contentText: string = ""
  99 + relType: string = ""
  100 + authImg: string = ""
  101 + roomId: string = ""
  102 + nameLiteral: string = ""
  103 + mainControl: string = ""
  104 + coverVImageBucket: string = ""
  105 + linkUrl: string = ""
  106 + openDownload: string = ""
  107 + zhChannelPageImg: string = ""
  108 + appStandImg: string = ""
  109 + shareSummary: string = ""
  110 + firstPublishTimeInt: string = ""
  111 + rmhPlatform: string = ""
  112 + creatorNameOsst: string = ""
  113 + searchType: string = ""
  114 + author: string = ""
  115 + askAnswerFlag: string = ""
  116 + seoTagName: string = ""
  117 + weight: string = ""
  118 + pageId: string = ""
  119 + firstPublishTime: string = ""
  120 + coverVImageUri: string = ""
  121 + publishType: string = ""
  122 + isVr: string = ""
  123 + name: string = ""
  124 + shareUrl: string = ""
  125 + userType: string = ""
  126 + firstProcessTime: string = ""
  127 + hasRecord: string = ""
  128 + shareTitleOsst: string = ""
  129 + classify: string = ""
  130 + itemType: string = ""
  131 + nameOsst: string = ""
  132 + districtCode: string = ""
  133 + hidden: string = ""
  134 + cityCode: string = ""
  135 + liveType: string = ""
  136 + appStyleImages: string = ""
  137 + titleShow: string = ""
  138 + cornerMark: string = ""
  139 + creatorId: string = ""
  140 + levelScore: string = ""
  141 + description: string = ""
  142 + liveStartTime: string = ""
  143 + likeStyle: string = ""
  144 + title: string = ""
  145 + content: string = ""
  146 + platform: string = ""
  147 + duration: string = "0"
  148 + shareDescriptionLiteral: string = ""
  149 + createTimeInt: string = ""
  150 + liveEndTime: string = ""
  151 + topicTemplate: string = ""
  152 + barrageEnable: string = ""
  153 + introduction: string = ""
  154 + notice: string = ""
  155 + shareTitleLiteral: string = ""
  156 + coverHImageUri: string = ""
  157 + relId: string = ""
  158 + classCode: string = ""
  159 + grayScale: string = ""
  160 + appStyle: number = -1
  161 + authTitle: string = ""
  162 + provinceCode: string = ""
  163 + tenancy: string = ""
  164 + platformId: string = ""
  165 + classSubName: string = ""
  166 + recommended: string = ""
  167 + descriptionLiteral: string = ""
  168 + banControl: string = ""
  169 + auditingStatus: string = ""
  170 + planEndTime: string = ""
  171 + speakControl: string = ""
  172 + sourceName: string = ""
  173 + shareImageBucket: string = ""
  174 + landscape: string = ""
  175 +
  176 +
  177 +}
@@ -37,19 +37,15 @@ export struct DetailPlayShortVideoPage { @@ -37,19 +37,15 @@ export struct DetailPlayShortVideoPage {
37 if (this.currentIndex != this.index) { 37 if (this.currentIndex != this.index) {
38 this.playerController.pause() 38 this.playerController.pause()
39 39
40 - if (this.index < this.currentIndex - 5 && this.playerController.getPlayer()) { 40 + if (this.index < this.currentIndex - 3 && this.playerController.getPlayer()) {
41 this.playerController.release() 41 this.playerController.release()
42 } 42 }
43 43
44 } else { 44 } else {
45 this.queryNewsInfoOfUser() 45 this.queryNewsInfoOfUser()
46 - console.log('currentIndex==== ', this.currentIndex)  
47 if (!this.playerController.getPlayer()) { 46 if (!this.playerController.getPlayer()) {
48 - console.error('state91111111===', this.contentDetailData?.videoInfo[0]?.videoUrl || '')  
49 this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl || ''); 47 this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl || '');
50 - console.error('state91111111===', this.playerController?.getPlayer()?.state)  
51 } else { 48 } else {
52 - console.error('state9===', this.playerController?.getPlayer()?.state)  
53 this.playerController.play() 49 this.playerController.play()
54 } 50 }
55 51
@@ -135,6 +131,7 @@ export struct DetailPlayShortVideoPage { @@ -135,6 +131,7 @@ export struct DetailPlayShortVideoPage {
135 } 131 }
136 132
137 onPageShow() { 133 onPageShow() {
  134 + // this.playerController?.play();
138 // WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED); 135 // WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED);
139 } 136 }
140 137
@@ -147,7 +144,7 @@ export struct DetailPlayShortVideoPage { @@ -147,7 +144,7 @@ export struct DetailPlayShortVideoPage {
147 144
148 onPageHide() { 145 onPageHide() {
149 // WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT); 146 // WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT);
150 - devicePLSensorManager.devicePLSensorOff(); 147 + // devicePLSensorManager.devicePLSensorOff();
151 // this.status = PlayerConstants.STATUS_PAUSE; 148 // this.status = PlayerConstants.STATUS_PAUSE;
152 this.playerController?.pause(); 149 this.playerController?.pause();
153 } 150 }
@@ -12,6 +12,7 @@ const storage = LocalStorage.getShared(); @@ -12,6 +12,7 @@ const storage = LocalStorage.getShared();
12 @Entry(storage) 12 @Entry(storage)
13 @Component 13 @Component
14 export struct DetailVideoListPage { 14 export struct DetailVideoListPage {
  15 + @Provide showComment: boolean = true
15 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 16 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
16 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 17 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
17 private contentId: string = '' 18 private contentId: string = ''
@@ -22,14 +23,20 @@ export struct DetailVideoListPage { @@ -22,14 +23,20 @@ export struct DetailVideoListPage {
22 @State testData: string[] = ['111', '222', '333'] 23 @State testData: string[] = ['111', '222', '333']
23 @State currentIndex: number = 0 24 @State currentIndex: number = 0
24 @State interactDataList: InteractDataDTO[] = [] 25 @State interactDataList: InteractDataDTO[] = []
  26 + @State isFullScreen: boolean = false
25 27
26 async aboutToAppear(): Promise<void> { 28 async aboutToAppear(): Promise<void> {
27 29
28 - 30 + /**
  31 + * 开启沉浸式并设置状态栏颜色
  32 + */
29 const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage 33 const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
30 - const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口 34 + const windowClass: window.Window = windowStage.getMainWindowSync();
31 windowClass.setWindowLayoutFullScreen(true) 35 windowClass.setWindowLayoutFullScreen(true)
32 - windowClass.setWindowSystemBarProperties({ statusBarColor: '#fff' }) 36 + this.isFullScreen = true
  37 + windowClass.setWindowSystemBarProperties({
  38 + statusBarContentColor: '#ffffff',
  39 + })
33 40
34 41
35 let data: ContentDetailDTO[] = [] 42 let data: ContentDetailDTO[] = []
@@ -99,7 +106,32 @@ export struct DetailVideoListPage { @@ -99,7 +106,32 @@ export struct DetailVideoListPage {
99 const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage 106 const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
100 const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口 107 const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
101 windowClass.setWindowLayoutFullScreen(false) 108 windowClass.setWindowLayoutFullScreen(false)
102 - windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' }) 109 + this.isFullScreen = false
  110 + windowClass.setWindowSystemBarProperties({ statusBarContentColor: '#000000' })
  111 +
  112 + }
  113 +
  114 + onPageShow(): void {
  115 + if (!this.isFullScreen) {
  116 + const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
  117 + const windowClass: window.Window = windowStage.getMainWindowSync();
  118 + windowClass.setWindowLayoutFullScreen(true)
  119 + this.isFullScreen = true
  120 + windowClass.setWindowSystemBarProperties({
  121 + statusBarContentColor: '#ffffff',
  122 + })
  123 +
  124 + }
  125 + }
  126 +
  127 + onPageHide(): void {
  128 + if (this.isFullScreen) {
  129 + const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
  130 + const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
  131 + windowClass.setWindowLayoutFullScreen(false)
  132 + this.isFullScreen = false
  133 + windowClass.setWindowSystemBarProperties({ statusBarContentColor: '#000000' })
  134 + }
103 135
104 } 136 }
105 137
@@ -14,8 +14,8 @@ export struct VideoChannelDetail { @@ -14,8 +14,8 @@ export struct VideoChannelDetail {
14 private relId: string = '' 14 private relId: string = ''
15 private relType: string = '' 15 private relType: string = ''
16 private swiperController: SwiperController = new SwiperController() 16 private swiperController: SwiperController = new SwiperController()
  17 + @Provide showComment: boolean = false
17 @State data: ContentDetailDTO[] = [] 18 @State data: ContentDetailDTO[] = []
18 - @State testData: string[] = ['111', '222', '333']  
19 @State currentIndex: number = 0 19 @State currentIndex: number = 0
20 @State interactDataList: InteractDataDTO[] = [] 20 @State interactDataList: InteractDataDTO[] = []
21 21
@@ -93,7 +93,7 @@ export struct VideoChannelDetail { @@ -93,7 +93,7 @@ export struct VideoChannelDetail {
93 if (res.data) { 93 if (res.data) {
94 this.data = this.data.concat(res.data) 94 this.data = this.data.concat(res.data)
95 } 95 }
96 - // console.log('queryVideoList===', JSON.stringify(this.data)) 96 + console.log('queryVideoList===', JSON.stringify(this.data))
97 }) 97 })
98 } 98 }
99 99
@@ -10,6 +10,7 @@ import { @@ -10,6 +10,7 @@ import {
10 } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; 10 } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
11 import { ToastUtils } from 'wdKit'; 11 import { ToastUtils } from 'wdKit';
12 import { HttpUrlUtils } from 'wdNetwork/Index'; 12 import { HttpUrlUtils } from 'wdNetwork/Index';
  13 +import { WDPlayerController } from 'wdPlayer/Index';
13 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 14 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
14 15
15 export interface OperationItem { 16 export interface OperationItem {
@@ -28,6 +29,7 @@ const TAG = 'OperationListView'; @@ -28,6 +29,7 @@ const TAG = 'OperationListView';
28 @Preview 29 @Preview
29 @Component 30 @Component
30 export struct OperationListView { 31 export struct OperationListView {
  32 + private playerController?: WDPlayerController;
31 @Consume interactData: InteractDataDTO 33 @Consume interactData: InteractDataDTO
32 @Consume contentDetailData: ContentDetailDTO 34 @Consume contentDetailData: ContentDetailDTO
33 @Consume newsStatusOfUser: batchLikeAndCollectResult 35 @Consume newsStatusOfUser: batchLikeAndCollectResult
@@ -65,6 +67,7 @@ export struct OperationListView { @@ -65,6 +67,7 @@ export struct OperationListView {
65 toggleLikeStatus() { 67 toggleLikeStatus() {
66 // 未登录,跳转登录 68 // 未登录,跳转登录
67 if (!HttpUrlUtils.getUserId()) { 69 if (!HttpUrlUtils.getUserId()) {
  70 + this.playerController?.pause()
68 WDRouterRule.jumpWithPage(WDRouterPage.loginPage) 71 WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
69 return 72 return
70 } 73 }
@@ -2,7 +2,7 @@ import router from '@ohos.router'; @@ -2,7 +2,7 @@ import router from '@ohos.router';
2 import window from '@ohos.window'; 2 import window from '@ohos.window';
3 import deviceInfo from '@ohos.deviceInfo'; 3 import deviceInfo from '@ohos.deviceInfo';
4 import { WindowModel } from 'wdKit'; 4 import { WindowModel } from 'wdKit';
5 -import { WDPlayerController } from 'wdPlayer'; 5 +import { PlayerConstants, WDPlayerController } from 'wdPlayer';
6 import { devicePLSensorManager } from 'wdDetailPlayApi'; 6 import { devicePLSensorManager } from 'wdDetailPlayApi';
7 import { OperationListView } from './OperationListView'; 7 import { OperationListView } from './OperationListView';
8 import { ContentDetailDTO, RmhInfoDTO, UserInfoDTO } from 'wdBean/Index'; 8 import { ContentDetailDTO, RmhInfoDTO, UserInfoDTO } from 'wdBean/Index';
@@ -17,7 +17,9 @@ export struct PlayerTitleComment { @@ -17,7 +17,9 @@ export struct PlayerTitleComment {
17 @Consume isFullScreen: boolean; 17 @Consume isFullScreen: boolean;
18 @Consume progressVal: number; 18 @Consume progressVal: number;
19 @Consume videoLandScape?: number 19 @Consume videoLandScape?: number
  20 + @Consume showComment?: boolean
20 @State isOpen: boolean = false 21 @State isOpen: boolean = false
  22 + @State status: number = PlayerConstants.STATUS_START;
21 dialogController: CustomDialogController = new CustomDialogController({ 23 dialogController: CustomDialogController = new CustomDialogController({
22 builder: DetailDialog({ 24 builder: DetailDialog({
23 name: this.getName(), 25 name: this.getName(),
@@ -32,6 +34,12 @@ export struct PlayerTitleComment { @@ -32,6 +34,12 @@ export struct PlayerTitleComment {
32 }) 34 })
33 35
34 aboutToAppear() { 36 aboutToAppear() {
  37 + if (this.playerController) {
  38 + this.playerController.onStatusChange = (status: number) => {
  39 + this.status = status
  40 + }
  41 +
  42 + }
35 43
36 } 44 }
37 45
@@ -54,35 +62,36 @@ export struct PlayerTitleComment { @@ -54,35 +62,36 @@ export struct PlayerTitleComment {
54 build() { 62 build() {
55 Column() { 63 Column() {
56 64
57 - if (this.contentDetailData?.videoInfo[0]?.videoLandScape === 1) {  
58 - Column() {  
59 - Row() {  
60 - Image($r('app.media.ic_switch_orientation'))  
61 - .width(34)  
62 - .aspectRatio(1)  
63 - .objectFit(ImageFit.Contain)  
64 - .padding({ left: 10, right: 5 })  
65 - Text("全屏观看")  
66 - .fontColor(Color.White)  
67 - .fontSize('14fp')  
68 - .maxLines(2)  
69 - .layoutWeight(1)  
70 - }  
71 - .width(100)  
72 - .backgroundColor(Color.Gray)  
73 - .borderRadius(10)  
74 - .alignItems(VerticalAlign.Center)  
75 - .visibility(this.videoLandScape == 2 ? Visibility.Hidden : Visibility.Visible)  
76 - .onClick(() => {  
77 - this.isFullScreen = !this.isFullScreen;  
78 - WindowModel.shared.setPreferredOrientation(window.Orientation.LANDSCAPE);  
79 - devicePLSensorManager.devicePLSensorOn(window.Orientation.LANDSCAPE);  
80 - })  
81 - }  
82 - .width('100%')  
83 - // .margin({ bottom: 120 })  
84 - .alignItems(HorizontalAlign.Center)  
85 - } 65 + // if (this.contentDetailData?.videoInfo[0]?.videoLandScape === 1) {
  66 + // Column() {
  67 + // Row() {
  68 + // Image($r('app.media.ic_switch_orientation'))
  69 + // .width(16)
  70 + // .aspectRatio(1)
  71 + // .objectFit(ImageFit.Contain)
  72 + // .padding({ left: 8, right: 4 })
  73 + // Text("全屏观看")
  74 + // .fontColor(Color.White)
  75 + // .fontSize(12)
  76 + // .layoutWeight(1)
  77 + // }
  78 + // .width(84)
  79 + // .height(28)
  80 + // .backgroundColor('#0d0d0d')
  81 + // .border({ width: 1, color: '#4DFFFFFF', radius: 2 })
  82 + // .alignItems(VerticalAlign.Center)
  83 + // .justifyContent(FlexAlign.Center)
  84 + // .visibility(this.videoLandScape == 2 ? Visibility.Hidden : Visibility.Visible)
  85 + // .onClick(() => {
  86 + // // this.isFullScreen = !this.isFullScreen;
  87 + // // WindowModel.shared.setPreferredOrientation(window.Orientation.LANDSCAPE);
  88 + // // devicePLSensorManager.devicePLSensorOn(window.Orientation.LANDSCAPE);
  89 + // })
  90 + // }
  91 + // .width('100%')
  92 + // .margin({ top: 452 })
  93 + //
  94 + // }
86 95
87 96
88 Row() { 97 Row() {
@@ -103,7 +112,7 @@ export struct PlayerTitleComment { @@ -103,7 +112,7 @@ export struct PlayerTitleComment {
103 } 112 }
104 113
105 114
106 - if (this.contentDetailData?.newsSummary) { 115 + if (this.contentDetailData?.newsSummary && this.showComment) {
107 Text('查看详情 > ') 116 Text('查看详情 > ')
108 .margin({ top: 8 }) 117 .margin({ top: 8 })
109 .padding(6) 118 .padding(6)
@@ -123,7 +132,9 @@ export struct PlayerTitleComment { @@ -123,7 +132,9 @@ export struct PlayerTitleComment {
123 .alignItems(HorizontalAlign.Start) 132 .alignItems(HorizontalAlign.Start)
124 .margin({ left: 16 }) 133 .margin({ left: 16 })
125 134
126 - OperationListView() 135 + OperationListView({
  136 + playerController: this.playerController
  137 + })
127 .width(48) 138 .width(48)
128 } 139 }
129 .width('100%') 140 .width('100%')
@@ -134,17 +145,24 @@ export struct PlayerTitleComment { @@ -134,17 +145,24 @@ export struct PlayerTitleComment {
134 Slider({ 145 Slider({
135 value: this.progressVal, 146 value: this.progressVal,
136 step: 1, 147 step: 1,
137 - style: SliderStyle.OutSet 148 + // style: SliderStyle.OutSet
  149 + })
  150 + .blockColor(this.status === PlayerConstants.STATUS_START ? Color.Transparent : $r('app.color.play_block_color'))
  151 + .trackColor(this.status === PlayerConstants.STATUS_START ? $r('app.color.play_track_color') : $r('app.color.pause_track_color'))
  152 + .selectedColor(this.status === PlayerConstants.STATUS_START ? $r('app.color.play_selected_color') : $r('app.color.pause_selected_color'))
  153 + .trackThickness(this.status === PlayerConstants.STATUS_START ? 1 : 4)
  154 + .blockStyle({
  155 + type: this.status === PlayerConstants.STATUS_START ? SliderBlockType.DEFAULT : SliderBlockType.IMAGE,
  156 + image: $r('app.media.ic_player_block')
138 }) 157 })
139 - .blockColor(Color.White)  
140 - .trackColor($r('app.color.track_color'))  
141 - .selectedColor($r('app.color.index_tab_selected_font_color'))  
142 - .trackThickness(1) 158 + .blockSize({ width: 18, height: 12 })
143 .width('100%') 159 .width('100%')
  160 + .height(19)
144 .onChange((value: number, mode: SliderChangeMode) => { 161 .onChange((value: number, mode: SliderChangeMode) => {
145 this.playerController?.setSeekTime(value, mode); 162 this.playerController?.setSeekTime(value, mode);
146 }) 163 })
147 164
  165 + if (this.showComment) {
148 Row() { 166 Row() {
149 Image($r('app.media.ic_back')) 167 Image($r('app.media.ic_back'))
150 .width(24) 168 .width(24)
@@ -163,11 +181,14 @@ export struct PlayerTitleComment { @@ -163,11 +181,14 @@ export struct PlayerTitleComment {
163 .layoutWeight(1) 181 .layoutWeight(1)
164 .backgroundColor('#1a1a1a') 182 .backgroundColor('#1a1a1a')
165 .borderRadius(2) 183 .borderRadius(2)
  184 + .height(30)
166 .margin({ left: 12 }) 185 .margin({ left: 12 })
167 } 186 }
168 .alignItems(VerticalAlign.Center) 187 .alignItems(VerticalAlign.Center)
169 .padding({ left: 16, right: 16, top: 11, bottom: 11 }) 188 .padding({ left: 16, right: 16, top: 11, bottom: 11 })
170 } 189 }
  190 +
  191 + }
171 }.backgroundColor(Color.Black) 192 }.backgroundColor(Color.Black)
172 193
173 } 194 }
1 { 1 {
2 "color": [ 2 "color": [
3 { 3 {
  4 + "name": "play_block_color",
  5 + "value": "#FFFFFF"
  6 + },
  7 + {
  8 + "name": "play_track_color",
  9 + "value": "#1AFFFFFF"
  10 + },
  11 + {
  12 + "name": "play_selected_color",
  13 + "value": "#4DFFFFFF"
  14 + },
  15 + {
  16 + "name": "pause_block_color",
  17 + "value": "#FFFFFF"
  18 + },
  19 + {
  20 + "name": "pause_track_color",
  21 + "value": "#1AFFFFFF"
  22 + },
  23 + {
  24 + "name": "pause_selected_color",
  25 + "value": "#FFED2800"
  26 + },
  27 + {
4 "name": "index_tab_selected_font_color", 28 "name": "index_tab_selected_font_color",
5 - "value": "#007DFF" 29 + "value": "#4DFFFFFF"
6 }, 30 },
7 { 31 {
8 "name": "divider_color", 32 "name": "divider_color",
@@ -10,7 +34,7 @@ @@ -10,7 +34,7 @@
10 }, 34 },
11 { 35 {
12 "name": "track_color", 36 "name": "track_color",
13 - "value": "#888888" 37 + "value": "#1AFFFFFF"
14 }, 38 },
15 { 39 {
16 "name": "speed_text_color", 40 "name": "speed_text_color",
@@ -7,7 +7,9 @@ import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/ @@ -7,7 +7,9 @@ import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/
7 import { WDRouterRule, WDRouterPage } from 'wdRouter'; 7 import { WDRouterRule, WDRouterPage } from 'wdRouter';
8 import { SettingPasswordParams } from './SettingPasswordLayout' 8 import { SettingPasswordParams } from './SettingPasswordLayout'
9 import { Router } from '@ohos.arkui.UIContext' 9 import { Router } from '@ohos.arkui.UIContext'
10 -import { ToastUtils } from 'wdKit/Index' 10 +import { SPHelper, ToastUtils } from 'wdKit/Index'
  11 +import { SpConstants } from 'wdConstant/Index'
  12 +import { emitter } from '@kit.BasicServicesKit'
11 13
12 14
13 const TAG = 'ForgetPasswordPage' 15 const TAG = 'ForgetPasswordPage'
@@ -147,7 +149,34 @@ struct ForgetPasswordPage { @@ -147,7 +149,34 @@ struct ForgetPasswordPage {
147 } 149 }
148 this.loginViewModel.changeBindPhone(this.phoneContent,this.codeContent).then(()=>{ 150 this.loginViewModel.changeBindPhone(this.phoneContent,this.codeContent).then(()=>{
149 ToastUtils.shortToast('绑定成功') 151 ToastUtils.shortToast('绑定成功')
  152 + this.querySecurity()
  153 + })
  154 + }
  155 +
  156 + querySecurity(){
  157 + this.loginViewModel.querySecurity().then(()=>{
  158 + SPHelper.default.save(SpConstants.USER_PHONE,this.phoneContent)
  159 + this.sendEmitEvent()
150 router.back() 160 router.back()
  161 + }).catch(()=>{
  162 +
151 }) 163 })
152 } 164 }
  165 +
  166 + sendEmitEvent(){
  167 + // 定义一个eventId为1的事件,事件优先级为Low
  168 + let event: emitter.InnerEvent = {
  169 + eventId: 10010,
  170 + priority: emitter.EventPriority.LOW
  171 + };
  172 +
  173 + let eventData: emitter.EventData = {
  174 + data: {
  175 + content: this.phoneContent,
  176 + }
  177 + };
  178 +
  179 + // 发送eventId为1的事件,事件内容为eventData
  180 + emitter.emit(event, eventData);
  181 + }
153 } 182 }
@@ -71,11 +71,11 @@ export class LoginModel { @@ -71,11 +71,11 @@ export class LoginModel {
71 return new Promise<LoginBean>((success, fail) => { 71 return new Promise<LoginBean>((success, fail) => {
72 HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), bean, headers).then((data: ResponseDTO<LoginBean>) => { 72 HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), bean, headers).then((data: ResponseDTO<LoginBean>) => {
73 Logger.debug("LoginViewModel:success2 ", data.message) 73 Logger.debug("LoginViewModel:success2 ", data.message)
74 - if (!data || !data.data) { 74 + if (!data) {
75 fail("数据为空") 75 fail("数据为空")
76 return 76 return
77 } 77 }
78 - if (data.code != 0) { 78 + if (!data.data||data.code != 0) {
79 fail(data.message) 79 fail(data.message)
80 return 80 return
81 } 81 }
@@ -99,11 +99,11 @@ export class LoginModel { @@ -99,11 +99,11 @@ export class LoginModel {
99 return new Promise<LoginBean>((success, fail) => { 99 return new Promise<LoginBean>((success, fail) => {
100 HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), bean, headers).then((data: ResponseDTO<LoginBean>) => { 100 HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), bean, headers).then((data: ResponseDTO<LoginBean>) => {
101 Logger.debug("LoginViewModel:success2 ", data.message) 101 Logger.debug("LoginViewModel:success2 ", data.message)
102 - if (!data || !data.data) { 102 + if (!data) {
103 fail("数据为空") 103 fail("数据为空")
104 return 104 return
105 } 105 }
106 - if (data.code != 0) { 106 + if (!data.data||data.code != 0) {
107 fail(data.message) 107 fail(data.message)
108 return 108 return
109 } 109 }
@@ -268,10 +268,10 @@ export class LoginModel { @@ -268,10 +268,10 @@ export class LoginModel {
268 let bean: Record<string, Object> = {}; 268 let bean: Record<string, Object> = {};
269 bean['phone'] = phone 269 bean['phone'] = phone
270 bean['verifyCode'] = verificationCode 270 bean['verifyCode'] = verificationCode
271 - return new Promise<LoginBean>((success, fail) => {  
272 - HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.changeBindPhone(), bean, headers).then((data: ResponseDTO<LoginBean>) => { 271 + return new Promise<object>((success, fail) => {
  272 + HttpRequest.post<ResponseDTO<object>>(HttpUrlUtils.changeBindPhone(), bean, headers).then((data: ResponseDTO<object>) => {
273 Logger.debug("LoginViewModel:success2 ", data.message) 273 Logger.debug("LoginViewModel:success2 ", data.message)
274 - if (!data || !data.data) { 274 + if (!data) {
275 fail("数据为空") 275 fail("数据为空")
276 return 276 return
277 } 277 }
@@ -279,7 +279,29 @@ export class LoginModel { @@ -279,7 +279,29 @@ export class LoginModel {
279 fail(data.message) 279 fail(data.message)
280 return 280 return
281 } 281 }
282 - success(data.data) 282 + success(data)
  283 + }, (error: Error) => {
  284 + fail(error.message)
  285 + Logger.debug("LoginViewModel:error2 ", error.toString())
  286 + })
  287 + })
  288 + }
  289 +
  290 + /**获取用户安全页信息*/
  291 + querySecurity(){
  292 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  293 + return new Promise<object>((success, fail) => {
  294 + HttpRequest.get<ResponseDTO<object>>(HttpUrlUtils.querySecurity(), headers).then((data: ResponseDTO<object>) => {
  295 + Logger.debug("LoginViewModel:success2 ", data.message)
  296 + if (!data) {
  297 + fail("数据为空")
  298 + return
  299 + }
  300 + if (data.code != 0) {
  301 + fail(data.message)
  302 + return
  303 + }
  304 + success(data)
283 }, (error: Error) => { 305 }, (error: Error) => {
284 fail(error.message) 306 fail(error.message)
285 Logger.debug("LoginViewModel:error2 ", error.toString()) 307 Logger.debug("LoginViewModel:error2 ", error.toString())
@@ -312,6 +312,8 @@ struct LoginPage { @@ -312,6 +312,8 @@ struct LoginPage {
312 url: `${WDRouterPage.getBundleInfo()}` 312 url: `${WDRouterPage.getBundleInfo()}`
313 } 313 }
314 ) 314 )
  315 + }).catch((error:string)=>{
  316 + promptAction.showToast({ message: error })
315 }) 317 })
316 } else { 318 } else {
317 this.loginViewModel.appLoginByPassword(this.accountContent, 0, this.passwordContent, "").then((data) => { 319 this.loginViewModel.appLoginByPassword(this.accountContent, 0, this.passwordContent, "").then((data) => {
@@ -14,18 +14,22 @@ struct LoginProtocolWebview { @@ -14,18 +14,22 @@ struct LoginProtocolWebview {
14 webviewController: webview.WebviewController = new webview.WebviewController() 14 webviewController: webview.WebviewController = new webview.WebviewController()
15 userProtocol = "https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1005.html" 15 userProtocol = "https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1005.html"
16 privateProtocol = 'https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1001.html' 16 privateProtocol = 'https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1001.html'
  17 + logoutProtocol = 'https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1003.html'
17 18
18 async aboutToAppear() { 19 async aboutToAppear() {
19 if (router.getParams()) { 20 if (router.getParams()) {
20 let params = router.getParams() as Params 21 let params = router.getParams() as Params
21 Logger.info(TAG, 'params.contentID:' + params.contentID); 22 Logger.info(TAG, 'params.contentID:' + params.contentID);
22 - if (params.contentID == "1") { 23 + if (params.contentID == "1") { //用户协议
23 this.webUrl = await SPHelper.default.get(SpConstants.USER_PROTOCOL, this.userProtocol) as string 24 this.webUrl = await SPHelper.default.get(SpConstants.USER_PROTOCOL, this.userProtocol) as string
24 this.webviewController.loadUrl(this.webUrl) 25 this.webviewController.loadUrl(this.webUrl)
25 26
26 - } else { 27 + } else if(params.contentID == "2"){ //隐私协议
27 this.webUrl = await SPHelper.default.get(SpConstants.PRIVATE_PROTOCOL, this.privateProtocol) as string 28 this.webUrl = await SPHelper.default.get(SpConstants.PRIVATE_PROTOCOL, this.privateProtocol) as string
28 this.webviewController.loadUrl(this.webUrl) 29 this.webviewController.loadUrl(this.webUrl)
  30 + }else if(params.contentID == "3"){ //注销协议
  31 + this.webUrl = await SPHelper.default.get(SpConstants.LOGOUT_PROTOCOL, this.logoutProtocol) as string
  32 + this.webviewController.loadUrl(this.webUrl)
29 } 33 }
30 } 34 }
31 35
@@ -7,10 +7,8 @@ import cryptoFramework from '@ohos.security.cryptoFramework' @@ -7,10 +7,8 @@ import cryptoFramework from '@ohos.security.cryptoFramework'
7 import buffer from '@ohos.buffer' 7 import buffer from '@ohos.buffer'
8 import { encryptMessage } from '../../utils/cryptoUtil' 8 import { encryptMessage } from '../../utils/cryptoUtil'
9 9
10 -import {  
11 - SpConstants  
12 -} from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants'  
13 import { HttpUrlUtils } from 'wdNetwork/src/main/ets/http/HttpUrlUtils' 10 import { HttpUrlUtils } from 'wdNetwork/src/main/ets/http/HttpUrlUtils'
  11 +import { SpConstants } from 'wdConstant/Index'
14 12
15 const TAG = "LoginViewModel" 13 const TAG = "LoginViewModel"
16 14
@@ -61,8 +59,8 @@ export class LoginViewModel { @@ -61,8 +59,8 @@ export class LoginViewModel {
61 HttpUrlUtils.setUserType(data.userType+"") 59 HttpUrlUtils.setUserType(data.userType+"")
62 HttpUrlUtils.setUserToken(data.jwtToken) 60 HttpUrlUtils.setUserToken(data.jwtToken)
63 success(data) 61 success(data)
64 - }).catch(() => {  
65 - fail() 62 + }).catch((error:string) => {
  63 + fail(error)
66 }) 64 })
67 }) 65 })
68 } 66 }
@@ -171,8 +169,8 @@ export class LoginViewModel { @@ -171,8 +169,8 @@ export class LoginViewModel {
171 } 169 }
172 170
173 changeBindPhone(phone: string, verificationCode: string) { 171 changeBindPhone(phone: string, verificationCode: string) {
174 - return new Promise<LoginBean>((success, fail) => {  
175 - this.loginModel.changeBindPhone(phone, verificationCode).then((data: LoginBean) => { 172 + return new Promise<object>((success, fail) => {
  173 + this.loginModel.changeBindPhone(phone, verificationCode).then((data: object) => {
176 success(data) 174 success(data)
177 }).catch(() => { 175 }).catch(() => {
178 fail() 176 fail()
@@ -180,7 +178,15 @@ export class LoginViewModel { @@ -180,7 +178,15 @@ export class LoginViewModel {
180 }) 178 })
181 } 179 }
182 180
183 - 181 + querySecurity(){
  182 + return new Promise<object>((success, fail) => {
  183 + this.loginModel.querySecurity().then((data: object) => {
  184 + success(data)
  185 + }).catch(() => {
  186 + fail()
  187 + })
  188 + })
  189 + }
184 190
185 async doMd(content: string): Promise<string> { 191 async doMd(content: string): Promise<string> {
186 let mdAlgName = 'SHA256'; // 摘要算法名 192 let mdAlgName = 'SHA256'; // 摘要算法名
@@ -22,6 +22,7 @@ export class WDPlayerController { @@ -22,6 +22,7 @@ export class WDPlayerController {
22 public onVolumeUpdate?: (volume: number) => void; 22 public onVolumeUpdate?: (volume: number) => void;
23 public continue?: () => void; 23 public continue?: () => void;
24 public onCanplay?: () => void; 24 public onCanplay?: () => void;
  25 + public onStatusChange?: (status: number) => void;
25 26
26 constructor() { 27 constructor() {
27 Logger.error("初始化") 28 Logger.error("初始化")
@@ -146,7 +147,7 @@ export class WDPlayerController { @@ -146,7 +147,7 @@ export class WDPlayerController {
146 if (this.avPlayer == null) { 147 if (this.avPlayer == null) {
147 return 148 return
148 } 149 }
149 - Logger.error("开始播放") 150 + Logger.error("开始播放", this.url)
150 this.avPlayer.url = this.url; 151 this.avPlayer.url = this.url;
151 } 152 }
152 153
@@ -163,92 +164,92 @@ export class WDPlayerController { @@ -163,92 +164,92 @@ export class WDPlayerController {
163 } 164 }
164 165
165 async pause() { 166 async pause() {
166 - if (this.avPlayer == null) {  
167 - await this.initPromise;  
168 - }  
169 - if (this.avPlayer == null) {  
170 - return  
171 - }  
172 - this.avPlayer.pause(); 167 + // if (this.avPlayer == null) {
  168 + // await this.initPromise;
  169 + // }
  170 + // if (this.avPlayer == null) {
  171 + // return
  172 + // }
  173 + this.avPlayer?.pause();
173 } 174 }
174 175
175 async play() { 176 async play() {
176 - if (this.avPlayer == null) {  
177 - await this.initPromise;  
178 - }  
179 - if (this.avPlayer == null) {  
180 - return  
181 - }  
182 - this.avPlayer.play(); 177 + // if (this.avPlayer == null) {
  178 + // await this.initPromise;
  179 + // }
  180 + // if (this.avPlayer == null) {
  181 + // return
  182 + // }
  183 + this.avPlayer?.play();
183 } 184 }
184 185
185 async stop() { 186 async stop() {
186 - if (this.avPlayer == null) {  
187 - await this.initPromise;  
188 - }  
189 - if (this.avPlayer == null) {  
190 - return  
191 - }  
192 - this.avPlayer.stop(); 187 + // if (this.avPlayer == null) {
  188 + // await this.initPromise;
  189 + // }
  190 + // if (this.avPlayer == null) {
  191 + // return
  192 + // }
  193 + this.avPlayer?.stop();
193 } 194 }
194 195
195 async setLoop() { 196 async setLoop() {
196 - if (this.avPlayer == null) {  
197 - await this.initPromise;  
198 - }  
199 - if (this.avPlayer == null) {  
200 - return  
201 - } 197 + // if (this.avPlayer == null) {
  198 + // await this.initPromise;
  199 + // }
  200 + // if (this.avPlayer == null) {
  201 + // return
  202 + // }
202 this.loop = !this.loop; 203 this.loop = !this.loop;
203 } 204 }
204 205
205 async setSpeed(playSpeed: number) { 206 async setSpeed(playSpeed: number) {
206 - if (this.avPlayer == null) {  
207 - await this.initPromise;  
208 - }  
209 - if (this.avPlayer == null) {  
210 - return  
211 - }  
212 - if (PlayerConstants.OPERATE_STATE.indexOf(this.avPlayer.state) === -1) { 207 + // if (this.avPlayer == null) {
  208 + // await this.initPromise;
  209 + // }
  210 + // if (this.avPlayer == null) {
  211 + // return
  212 + // }
  213 + if (this.avPlayer && PlayerConstants.OPERATE_STATE.indexOf(this.avPlayer?.state) === -1) {
213 return; 214 return;
214 } 215 }
215 this.playSpeed = playSpeed; 216 this.playSpeed = playSpeed;
216 - this.avPlayer.setSpeed(this.playSpeed); 217 + this.avPlayer?.setSpeed(this.playSpeed);
217 } 218 }
218 219
219 async switchPlayOrPause() { 220 async switchPlayOrPause() {
220 - if (this.avPlayer == null) {  
221 - await this.initPromise;  
222 - }  
223 - if (this.avPlayer == null) {  
224 - return  
225 - } 221 + // if (this.avPlayer == null) {
  222 + // await this.initPromise;
  223 + // }
  224 + // if (this.avPlayer == null) {
  225 + // return
  226 + // }
226 if (this.status === PlayerConstants.STATUS_START) { 227 if (this.status === PlayerConstants.STATUS_START) {
227 - this.avPlayer.pause(); 228 + this.avPlayer?.pause();
228 } else { 229 } else {
229 - this.avPlayer.play(); 230 + this.avPlayer?.play();
230 } 231 }
231 } 232 }
232 233
233 async setSeekTime(value: number, mode: SliderChangeMode) { 234 async setSeekTime(value: number, mode: SliderChangeMode) {
234 - if (this.avPlayer == null) {  
235 - await this.initPromise;  
236 - }  
237 - if (this.avPlayer == null) {  
238 - return  
239 - }  
240 - if (mode == SliderChangeMode.Begin) {  
241 - this.seekTime = value * 1000;  
242 - this.avPlayer.seek(this.seekTime, media.SeekMode.SEEK_PREV_SYNC);  
243 - } 235 + // if (this.avPlayer == null) {
  236 + // await this.initPromise;
  237 + // }
  238 + // if (this.avPlayer == null) {
  239 + // return
  240 + // }
  241 + // if (mode == SliderChangeMode.Begin) {
  242 + // this.seekTime = value * 1000;
  243 + // this.avPlayer?.seek(this.seekTime, media.SeekMode.SEEK_PREV_SYNC);
  244 + // }
244 if (mode === SliderChangeMode.Moving) { 245 if (mode === SliderChangeMode.Moving) {
245 // this.progressThis.progressVal = value; 246 // this.progressThis.progressVal = value;
246 // this.progressThis.currentTime = DateFormatUtil.secondToTime(Math.floor(value * this.duration / 247 // this.progressThis.currentTime = DateFormatUtil.secondToTime(Math.floor(value * this.duration /
247 // 100 / 1000)); 248 // 100 / 1000));
248 } 249 }
249 if (mode === SliderChangeMode.End) { 250 if (mode === SliderChangeMode.End) {
250 - this.seekTime = value * this.duration / 100;  
251 - this.avPlayer.seek(this.seekTime, media.SeekMode.SEEK_PREV_SYNC); 251 + this.seekTime = value * this.duration;
  252 + this.avPlayer?.seek(this.seekTime, media.SeekMode.SEEK_PREV_SYNC);
252 } 253 }
253 } 254 }
254 255
@@ -333,6 +334,10 @@ export class WDPlayerController { @@ -333,6 +334,10 @@ export class WDPlayerController {
333 } 334 }
334 335
335 watchStatus() { 336 watchStatus() {
  337 + console.log('watchStatus', this.status)
  338 + if (this.onStatusChange) {
  339 + this.onStatusChange(this.status)
  340 + }
336 // if (this.status === PlayConstants.STATUS_START) { 341 // if (this.status === PlayConstants.STATUS_START) {
337 // globalThis.windowClass.setWindowKeepScreenOn(true); 342 // globalThis.windowClass.setWindowKeepScreenOn(true);
338 // } else { 343 // } else {
@@ -94,17 +94,27 @@ export struct WDPlayerRenderView { @@ -94,17 +94,27 @@ export struct WDPlayerRenderView {
94 }) 94 })
95 .width(this.selfSize.width) 95 .width(this.selfSize.width)
96 .height(this.selfSize.height) 96 .height(this.selfSize.height)
  97 + .margin({ top: this.getPlayerMarginTop() })
97 } 98 }
98 .id(this.insId) 99 .id(this.insId)
99 .onAreaChange(() => { 100 .onAreaChange(() => {
100 // this.updateLayout() 101 // this.updateLayout()
101 }) 102 })
102 .backgroundColor("#000000") 103 .backgroundColor("#000000")
  104 + .alignItems(VerticalAlign.Center)
103 .justifyContent(FlexAlign.Center) 105 .justifyContent(FlexAlign.Center)
  106 + .alignItems(this.selfSize.width === '100%' ? VerticalAlign.Top : VerticalAlign.Center)
104 .height('100%') 107 .height('100%')
105 .width('100%') 108 .width('100%')
106 } 109 }
107 110
  111 + /**
  112 + * 横屏播放器非居中展示
  113 + */
  114 + getPlayerMarginTop() {
  115 + return this.selfSize.width === '100%' && this.videoWidth > this.videoHeight ? 218 : 0
  116 + }
  117 +
108 updateLayout() { 118 updateLayout() {
109 let info = componentUtils.getRectangleById(this.insId); 119 let info = componentUtils.getRectangleById(this.insId);
110 if (info.size.width > 0 && info.size.height > 0 && this.videoHeight > 0 && this.videoWidth > 0) { 120 if (info.size.width > 0 && info.size.height > 0 && this.videoHeight > 0 && this.videoWidth > 0) {
@@ -4,8 +4,8 @@ import UIAbility from '@ohos.app.ability.UIAbility'; @@ -4,8 +4,8 @@ import UIAbility from '@ohos.app.ability.UIAbility';
4 import Want from '@ohos.app.ability.Want'; 4 import Want from '@ohos.app.ability.Want';
5 import window from '@ohos.window'; 5 import window from '@ohos.window';
6 import { registerRouter } from 'wdRouter'; 6 import { registerRouter } from 'wdRouter';
7 -import { SPHelper, WindowModel } from 'wdKit';  
8 -import { WDHttp } from 'wdNetwork' 7 +import { SPHelper, StringUtils, WindowModel } from 'wdKit';
  8 +import { HttpUrlUtils, WDHttp } from 'wdNetwork';
9 9
10 export default class EntryAbility extends UIAbility { 10 export default class EntryAbility extends UIAbility {
11 onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { 11 onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
@@ -13,6 +13,10 @@ export default class EntryAbility extends UIAbility { @@ -13,6 +13,10 @@ export default class EntryAbility extends UIAbility {
13 hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); 13 hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
14 registerRouter(); 14 registerRouter();
15 WDHttp.initHttpHeader() 15 WDHttp.initHttpHeader()
  16 + const spHostUrl = SPHelper.default.getSync('hostUrl', '') as string
  17 + if (StringUtils.isNotEmpty(spHostUrl)) {
  18 + HttpUrlUtils.hostUrl = spHostUrl
  19 + }
16 } 20 }
17 21
18 onDestroy(): void { 22 onDestroy(): void {
1 -import { BottomNavigationComponent} from 'wdComponent'; 1 +import { BottomNavigationComponent, LogoutViewModel} from 'wdComponent';
2 import { BreakpointConstants } from 'wdConstant'; 2 import { BreakpointConstants } from 'wdConstant';
3 3
4 -import { BreakpointSystem, Logger } from 'wdKit'; 4 +import { BreakpointSystem, EmitterEventId, EmitterUtils, Logger } from 'wdKit';
5 import router from '@ohos.router'; 5 import router from '@ohos.router';
  6 +import { promptAction } from '@kit.ArkUI';
6 7
7 8
8 const TAG = 'MainPage'; 9 const TAG = 'MainPage';
@@ -22,6 +23,9 @@ struct MainPage { @@ -22,6 +23,9 @@ struct MainPage {
22 aboutToAppear() { 23 aboutToAppear() {
23 this.breakpointSystem.register() 24 this.breakpointSystem.register()
24 Logger.info(TAG, `aboutToAppear `); 25 Logger.info(TAG, `aboutToAppear `);
  26 + EmitterUtils.receiveEvent(EmitterEventId.FORCE_USER_LOGIN_OUT, () => {
  27 + LogoutViewModel.clearLoginInfo()
  28 + })
25 } 29 }
26 30
27 aboutToDisappear() { 31 aboutToDisappear() {
  1 +import { Action } from 'wdBean';
  2 +import { SpacialTopicPageComponent } from 'wdComponent'
  3 +import { Logger } from 'wdKit'
  4 +import router from '@ohos.router';
  5 +
  6 +const TAG = 'SpacialPage';
  7 +
  8 +@Entry
  9 +@Component
  10 +struct SpacialTopicPage {
  11 + action: Action = {} as Action
  12 +
  13 + build() {
  14 + Column() {
  15 + SpacialTopicPageComponent()
  16 + }
  17 + }
  18 +
  19 + pageTransition(){
  20 + // 定义页面进入时的效果,从右边侧滑入
  21 + PageTransitionEnter({ type: RouteType.None, duration: 300 })
  22 + .slide(SlideEffect.Right)
  23 + // 定义页面退出时的效果,向右边侧滑出
  24 + PageTransitionExit({ type: RouteType.None, duration: 300 })
  25 + .slide(SlideEffect.Right)
  26 + }
  27 +
  28 +
  29 + aboutToAppear() {
  30 + Logger.info(TAG, 'aboutToAppear');
  31 + let action: Action = router.getParams() as Action
  32 + this.action = action
  33 + }
  34 +
  35 + aboutToDisappear() {
  36 + Logger.info(TAG, 'aboutToDisappear');
  37 + }
  38 +
  39 + onPageShow() {
  40 + Logger.info(TAG, 'onPageShow');
  41 + }
  42 +
  43 + onPageHide() {
  44 + Logger.info(TAG, 'onPageHide');
  45 + }
  46 +
  47 + onBackPress() {
  48 + Logger.info(TAG, 'onBackPress');
  49 + }
  50 +}
  1 +import { Logger } from 'wdKit';
  2 +import { AudioDetailComponent } from 'wdComponent';
  3 +import router from '@ohos.router';
  4 +import { Params, Action } from 'wdBean';
  5 +const TAG = 'DynamicDetailPage';
  6 +@Entry
  7 +@Component
  8 +struct DynamicDetailPage {
  9 +
  10 + @State relId: string = ''
  11 + @State contentId: string = ''
  12 + @State relType: string = ''
  13 +
  14 + build() {
  15 + Column() {
  16 + AudioDetailComponent({
  17 + relId: this.relId,
  18 + contentId: this.contentId,
  19 + relType: this.relType
  20 + })
  21 + }
  22 + .height('100%')
  23 + .width('100%')
  24 + .backgroundColor('#20272E')
  25 + }
  26 + aboutToAppear() {
  27 + let par:Action = router.getParams() as Action;
  28 + let params = par?.params;
  29 + this.relId = params?.extra?.relId || '';
  30 + this.relType = params?.extra?.relType || '';
  31 + this.contentId = params?.contentID || '';
  32 + }
  33 +}
@@ -26,6 +26,16 @@ export class LaunchModel { @@ -26,6 +26,16 @@ export class LaunchModel {
26 SPHelper.default.save(SpConstants.USER_PROTOCOL, data.data[i].linkUrl) 26 SPHelper.default.save(SpConstants.USER_PROTOCOL, data.data[i].linkUrl)
27 } else if (data.data[i].type == 2) { 27 } else if (data.data[i].type == 2) {
28 SPHelper.default.save(SpConstants.PRIVATE_PROTOCOL, data.data[i].linkUrl) 28 SPHelper.default.save(SpConstants.PRIVATE_PROTOCOL, data.data[i].linkUrl)
  29 + }else if (data.data[i].type == 4) {
  30 + SPHelper.default.save(SpConstants.LOGOUT_PROTOCOL, data.data[i].linkUrl)
  31 + }else if (data.data[i].type == 5) {
  32 + SPHelper.default.save(SpConstants.MESSAGE_BOARD_USER_PROTOCOL, data.data[i].linkUrl)
  33 + }else if (data.data[i].type == 6) {
  34 + SPHelper.default.save(SpConstants.MESSAGE_BOARD_NOTICE_PROTOCOL, data.data[i].linkUrl)
  35 + }else if (data.data[i].type == 7) {
  36 + SPHelper.default.save(SpConstants.MESSAGE_BOARD_QUESTION_PROTOCOL, data.data[i].linkUrl)
  37 + }else if (data.data[i].type == 8) {
  38 + SPHelper.default.save(SpConstants.MESSAGE_BOARD_PRIVATE_PROTOCOL, data.data[i].linkUrl)
29 } 39 }
30 } 40 }
31 41
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 "pages/launchPage/PrivacyPage", 10 "pages/launchPage/PrivacyPage",
11 "pages/launchPage/LaunchPage", 11 "pages/launchPage/LaunchPage",
12 "pages/launchPage/LaunchAdvertisingPage", 12 "pages/launchPage/LaunchAdvertisingPage",
13 - "pages/broadcast/BroadcastPage" 13 + "pages/broadcast/BroadcastPage",
  14 + "pages/SpacialTopicPage"
14 ] 15 ]
15 } 16 }
This diff could not be displayed because it is too large.