wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool: (115 commits)
  fix: 时间轴按钮颜色
  feat(动态):微调
  列表缺省页修复
  desc:fix bug(关注)
  屏蔽活动、音频
  fix
  fix:解决 切换至版面返回时 页面空白问题
  feat(动态):动态详情微调
  desc:历史搜索 关联用户
  fix:16656 人民号主页中的“+关注”与“已显示全部内容””的样式鸿蒙与安卓不一致
  fix: 16669desc:16669 人民号--关注鸿蒙版多出一个关注按钮少一个搜索入口
  解决音频、活动组件屏蔽后又被互动数据更新重新插入列表问题
  feat(卡片):隐藏人民账号横滑卡
  desc:修复搜索相关bug
  feat(动态):评论model重新创建
  增加合并游客评论弹框
  desc:评论相关 保存游客首次评论
  desc:评论相关 保存游客首次评论
  desc:评论相关 保存游客首次评论
  fix:H5详情页增加无网缺省图
  ...
Showing 83 changed files with 1970 additions and 1213 deletions

Too many changes to show.

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

@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 "app": { 2 "app": {
3 "bundleName": "com.peopledailychina.hosactivity", 3 "bundleName": "com.peopledailychina.hosactivity",
4 "vendor": "$string:app_vendor", 4 "vendor": "$string:app_vendor",
5 - "versionCode": 1000000, 5 + "versionCode": 10000,
6 "versionName": "1.0.0", 6 "versionName": "1.0.0",
7 "icon": "$media:app_icon", 7 "icon": "$media:app_icon",
8 "label": "$string:app_name" 8 "label": "$string:app_name"
@@ -244,6 +244,30 @@ @@ -244,6 +244,30 @@
244 ] 244 ]
245 } 245 }
246 ] 246 ]
  247 + },
  248 + {
  249 + "name": "wdShareBase",
  250 + "srcPath": "./commons/wdShareBase",
  251 + "targets": [
  252 + {
  253 + "name": "default",
  254 + "applyToProducts": [
  255 + "default"
  256 + ]
  257 + }
  258 + ]
  259 + },
  260 + {
  261 + "name": "wdShare",
  262 + "srcPath": "./features/wdShare",
  263 + "targets": [
  264 + {
  265 + "name": "default",
  266 + "applyToProducts": [
  267 + "default"
  268 + ]
  269 + }
  270 + ]
247 } 271 }
248 ] 272 ]
249 } 273 }
@@ -34,6 +34,8 @@ export class SpConstants{ @@ -34,6 +34,8 @@ export class SpConstants{
34 //定位相关 34 //定位相关
35 static LOCATION_CITY_NAME = "location_city_name" //定位 35 static LOCATION_CITY_NAME = "location_city_name" //定位
36 static LOCATION_CITY_CODE = "location_city_code" //定位 36 static LOCATION_CITY_CODE = "location_city_code" //定位
  37 + static LOCATION_PROVINCE_CODE = "location_province_code" //定位,省份code
  38 + static LOCATION_DISTRICT_CODE = "location_district_code" //定位,区县,返回9位,如:合肥-瑶海区-310115114
37 static LOCATION_PERMISSION_REFUSE = "location_permission_refuse" //定位 39 static LOCATION_PERMISSION_REFUSE = "location_permission_refuse" //定位
38 40
39 //启动页数据存储key 41 //启动页数据存储key
@@ -42,4 +44,7 @@ export class SpConstants{ @@ -42,4 +44,7 @@ export class SpConstants{
42 //频道信息流页面左右挂角 44 //频道信息流页面左右挂角
43 static APP_PAGE_CORNER_ADV = 'app_page_corner_adv_' 45 static APP_PAGE_CORNER_ADV = 'app_page_corner_adv_'
44 46
  47 +
  48 + //游客状态下首次评论时间
  49 + static FIRSTCOMMENTTIME = 'firstCommentTime'
45 } 50 }
@@ -67,15 +67,15 @@ export const enum CompStyle { @@ -67,15 +67,15 @@ export const enum CompStyle {
67 67
68 68
69 69
70 - Card_Adv_4 = 4, //4:轮播图 5:三图广告 6:小图广告 7:长通栏广告 8:大图广告 9:视频广告 10:展会广告 11:冠名广告 12:顶部长通栏广告  
71 - Card_Adv_5 = 5,  
72 - Card_Adv_6 = 5,  
73 - Card_Adv_7 = 7,  
74 - Card_Adv_8 = 8,  
75 - Card_Adv_9 = 9,  
76 - Card_Adv_10 = 10,  
77 - Card_Adv_11 = 11,  
78 - Card_Adv_12 = 12, 70 + Card_Adv_4 = 4, //4:轮播图
  71 + Card_Adv_5 = 5, // 5:三图广告
  72 + Card_Adv_6 = 6, // 6:小图广告
  73 + Card_Adv_7 = 7, // 7:长通栏广告
  74 + Card_Adv_8 = 8, // 8:大图广告
  75 + Card_Adv_9 = 9, // 9:视频广告
  76 + Card_Adv_10 = 10, // 10:展会广告
  77 + Card_Adv_11 = 11, // 11:冠名广告
  78 + Card_Adv_12 = 12, // 12:顶部长通栏广告
79 79
80 /** 80 /**
81 * 本地稿件和组件样式 81 * 本地稿件和组件样式
1 import { Action } from './Action'; 1 import { Action } from './Action';
2 2
  3 +interface IImgItem {
  4 + pic: string
  5 + width: number
  6 + height: number
  7 +}
  8 +
  9 +export interface IImgListData {
  10 + imgIndex: number
  11 + imgArr: IImgItem[]
  12 +}
  13 +
3 interface dataObject { 14 interface dataObject {
4 // dataSource: 15 // dataSource:
5 // 1、图文详情数据 16 // 1、图文详情数据
@@ -13,7 +24,7 @@ interface dataObject { @@ -13,7 +24,7 @@ interface dataObject {
13 // 9、活动投稿 视频跳转 24 // 9、活动投稿 视频跳转
14 // 10、活动投稿 动态跳转 25 // 10、活动投稿 动态跳转
15 // 11、活动投稿 图集跳转 26 // 11、活动投稿 图集跳转
16 - dataSource: number 27 + dataSource: string
17 operateType?: string 28 operateType?: string
18 webViewHeight?: string 29 webViewHeight?: string
19 dataJson?: string 30 dataJson?: string
@@ -27,6 +38,7 @@ interface dataObject { @@ -27,6 +38,7 @@ interface dataObject {
27 positionLeft?: string 38 positionLeft?: string
28 positionTop?: string 39 positionTop?: string
29 videoLandscape?: string 40 videoLandscape?: string
  41 + imgListData?: string
30 } 42 }
31 43
32 /** 44 /**
@@ -50,6 +50,30 @@ export class DeviceUtil { @@ -50,6 +50,30 @@ export class DeviceUtil {
50 * @returns 50 * @returns
51 */ 51 */
52 static getDisplayVersion(): string { 52 static getDisplayVersion(): string {
53 - return deviceInfo.productModel; 53 + return deviceInfo.displayVersion;
  54 + }
  55 +
  56 + /**
  57 + * 返回设备sdk版本
  58 + * 12
  59 + * @returns
  60 + */
  61 + static getOsVersion(): string {
  62 + return deviceInfo.sdkApiVersion + '';
  63 + }
  64 +
  65 + /**
  66 + * 获取平台标识,暂手机,后续适配tv、笔记本、pad,再扩展
  67 + */
  68 + static getPlat() {
  69 + return 'Phone';
  70 + }
  71 +
  72 + /**
  73 + * 客户端日志链路追踪traceid生成:在每个请求头加上参数Key:EagleEye-TraceID ,value为32位生成随机值
  74 + */
  75 + static getRandomUUIDForTraceID(): string {
  76 + deviceInfo.productModel
  77 + return util.generateRandomUUID().toUpperCase().replace('-', '')
54 } 78 }
55 -}  
  79 +}
@@ -11,6 +11,18 @@ export enum EmitterEventId { @@ -11,6 +11,18 @@ export enum EmitterEventId {
11 // 跳转首页指定频道,事件id 11 // 跳转首页指定频道,事件id
12 JUMP_HOME_CHANNEL = 4, 12 JUMP_HOME_CHANNEL = 4,
13 13
14 - LOCATION = 5 14 + LOCATION = 5,
  15 + /*发布评论*/
  16 + COMMENT_PUBLISH = 6,
  17 +
  18 + // 关注,取消关注
  19 + PEOPLE_SHIP_ATTENTION = 7,
  20 +
  21 + // App回到前台
  22 + APP_ENTER_FOREGROUD = 100,
  23 + // App进入后台
  24 + APP_ENTER_BACKGROUD = 101,
  25 +
  26 +
15 } 27 }
16 28
@@ -289,4 +289,8 @@ export class LazyDataSource<T> extends BasicDataSource<T> { @@ -289,4 +289,8 @@ export class LazyDataSource<T> extends BasicDataSource<T> {
289 this.dataArray.splice(start, this.dataArray.length, ...data); 289 this.dataArray.splice(start, this.dataArray.length, ...data);
290 this.notifyDataReload() 290 this.notifyDataReload()
291 } 291 }
  292 +
  293 + public reloadData(): void {
  294 + this.notifyDataReload();
  295 + }
292 } 296 }
1 import data_preferences from '@ohos.data.preferences'; 1 import data_preferences from '@ohos.data.preferences';
  2 +import { Logger } from './Logger';
2 3
3 -/*  
4 -// SPHelper.default.get("key1", "defValue1").then((value1) => {  
5 -// this.message = value1.toString();  
6 -// }) 4 +const TAG = 'SPHelper'
7 5
8 -// let value2: string = await SPHelper.default.get("key2", "defValue2");  
9 -// this.message = result;  
10 -*  
11 -* 单例模式 6 +/**
  7 + * sp存储
12 */ 8 */
13 export class SPHelper { 9 export class SPHelper {
14 private static context: Context; 10 private static context: Context;
@@ -21,7 +17,7 @@ export class SPHelper { @@ -21,7 +17,7 @@ export class SPHelper {
21 static setSpFilename(spFilename: string) { 17 static setSpFilename(spFilename: string) {
22 SPHelper.spFilename = spFilename; 18 SPHelper.spFilename = spFilename;
23 } 19 }
24 - 20 +
25 // 静态属性 21 // 静态属性
26 static default: SPHelper = new SPHelper(); 22 static default: SPHelper = new SPHelper();
27 23
@@ -49,7 +45,11 @@ export class SPHelper { @@ -49,7 +45,11 @@ export class SPHelper {
49 saveSync(key: string, value: data_preferences.ValueType) { 45 saveSync(key: string, value: data_preferences.ValueType) {
50 const preferences: data_preferences.Preferences = this.getVideoPreferencesSync(); 46 const preferences: data_preferences.Preferences = this.getVideoPreferencesSync();
51 preferences.putSync(key, value) 47 preferences.putSync(key, value)
52 - preferences.flush() // todo:Asynchronously 48 + preferences.flush().then(() => {
  49 + Logger.debug(TAG, 'saveSync flush success')
  50 + }).catch((error: object) => {
  51 + Logger.debug(TAG, 'saveSync flush failed: ' + JSON.stringify(error))
  52 + });
53 } 53 }
54 54
55 async get(key: string, defValue: data_preferences.ValueType): Promise<data_preferences.ValueType> { 55 async get(key: string, defValue: data_preferences.ValueType): Promise<data_preferences.ValueType> {
@@ -84,7 +84,11 @@ export class SPHelper { @@ -84,7 +84,11 @@ export class SPHelper {
84 deleteSync(key: string) { 84 deleteSync(key: string) {
85 const preferences: data_preferences.Preferences = this.getVideoPreferencesSync(); 85 const preferences: data_preferences.Preferences = this.getVideoPreferencesSync();
86 preferences.deleteSync(key) 86 preferences.deleteSync(key)
87 - preferences.flush(); // todo:Asynchronously 87 + preferences.flush().then(() => {
  88 + Logger.debug(TAG, 'deleteSync flush success')
  89 + }).catch((error: object) => {
  90 + Logger.debug(TAG, 'deleteSync flush failed: ' + JSON.stringify(error))
  91 + });
88 } 92 }
89 93
90 async clearSync() { 94 async clearSync() {
@@ -96,14 +100,8 @@ export class SPHelper { @@ -96,14 +100,8 @@ export class SPHelper {
96 }); 100 });
97 } 101 }
98 102
99 - // clearSync() {  
100 - // let preferences: data_preferences.Preferences = this.getVideoPreferencesSync()  
101 - // preferences.clearSync()  
102 - // preferences.flush()  
103 - // }  
104 -  
105 - public getPreferences(){  
106 - let preferences = data_preferences.getPreferences(SPHelper.context, SPHelper.spFilename); 103 + public getPreferences() {
  104 + let preferences = data_preferences.getPreferences(SPHelper.context, SPHelper.spFilename);
107 return preferences; 105 return preferences;
108 } 106 }
109 } 107 }
@@ -6,41 +6,34 @@ import { SPHelper } from './SPHelper' @@ -6,41 +6,34 @@ import { SPHelper } from './SPHelper'
6 import { StringUtils } from './StringUtils' 6 import { StringUtils } from './StringUtils'
7 7
8 export class UserDataLocal { 8 export class UserDataLocal {
9 - public static userId=''  
10 - public static userType=''  
11 - public static token=''  
12 - public static userName=''  
13 -  
14 - public static userHeaderUrl=''  
15 - public static userLevel = -1  
16 - public static userLevelHeaderUrl='' 9 + private static userId=''
  10 + private static userType=''
  11 + private static userName=''
  12 + private static userHeaderUrl=''
  13 + private static userLevel = -1
  14 + private static userLevelHeaderUrl=''
17 15
18 //先写死 16 //先写死
19 static USER_ID="userId" 17 static USER_ID="userId"
20 static USER_Type="userType" 18 static USER_Type="userType"
21 - static USER_JWT_TOKEN="jwtToken"  
22 static USER_NAME="userName" 19 static USER_NAME="userName"
23 -  
24 static USER_HEADER_URL="userHeaderUrl" 20 static USER_HEADER_URL="userHeaderUrl"
25 static USER_LEVEL="userLevel" 21 static USER_LEVEL="userLevel"
26 static USER_LEVEL_HEADER_URL="userLevelHeaderUrl" 22 static USER_LEVEL_HEADER_URL="userLevelHeaderUrl"
27 - static USER_FOLLOW_OPERATION="user_follow_operation"  
28 -  
29 - //刷新token 用到  
30 - static USER_REFRESH_TOKEN="refreshToken"  
31 23
  24 + static USER_FOLLOW_OPERATION="user_follow_operation"
32 25
33 /** 26 /**
34 * 清除 本地用户数据 27 * 清除 本地用户数据
35 */ 28 */
36 public static clearUserData(){ 29 public static clearUserData(){
37 - SPHelper.default.deleteSync(UserDataLocal.USER_ID)  
38 - SPHelper.default.deleteSync(UserDataLocal.USER_Type)  
39 - SPHelper.default.deleteSync(UserDataLocal.USER_JWT_TOKEN) //待确认  
40 - SPHelper.default.deleteSync(UserDataLocal.USER_NAME)  
41 - SPHelper.default.deleteSync(UserDataLocal.USER_HEADER_URL)  
42 - SPHelper.default.deleteSync(UserDataLocal.USER_LEVEL)  
43 - SPHelper.default.deleteSync(UserDataLocal.USER_LEVEL_HEADER_URL) 30 + UserDataLocal.userId=''
  31 + UserDataLocal.userType=''
  32 + UserDataLocal.userName=''
  33 +
  34 + UserDataLocal.userHeaderUrl=''
  35 + UserDataLocal.userLevel = -1
  36 + UserDataLocal.userLevelHeaderUrl=''
44 } 37 }
45 38
46 public static getUserId() { 39 public static getUserId() {
@@ -59,17 +52,6 @@ export class UserDataLocal { @@ -59,17 +52,6 @@ export class UserDataLocal {
59 return UserDataLocal.userType; 52 return UserDataLocal.userType;
60 } 53 }
61 54
62 - private static getXToken() {  
63 - if(StringUtils.isNotEmpty(UserDataLocal.token)){  
64 - return UserDataLocal.token  
65 - }  
66 - UserDataLocal.token = SPHelper.default.getSync(UserDataLocal.USER_JWT_TOKEN,"") as string  
67 - if(StringUtils.isNotEmpty(UserDataLocal.token)) {  
68 - return UserDataLocal.token  
69 - }  
70 - return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc';  
71 - }  
72 -  
73 public static getUserName() { 55 public static getUserName() {
74 if(StringUtils.isNotEmpty(UserDataLocal.userName)){ 56 if(StringUtils.isNotEmpty(UserDataLocal.userName)){
75 return UserDataLocal.userName 57 return UserDataLocal.userName
@@ -118,4 +100,5 @@ export class UserDataLocal { @@ -118,4 +100,5 @@ export class UserDataLocal {
118 public static setUserLevelHeaderUrl(url:string) { 100 public static setUserLevelHeaderUrl(url:string) {
119 SPHelper.default.save(UserDataLocal.USER_LEVEL_HEADER_URL, url) 101 SPHelper.default.save(UserDataLocal.USER_LEVEL_HEADER_URL, url)
120 } 102 }
  103 +
121 } 104 }
@@ -8,3 +8,7 @@ export { HttpUrlUtils } from "./src/main/ets/http/HttpUrlUtils" @@ -8,3 +8,7 @@ export { HttpUrlUtils } from "./src/main/ets/http/HttpUrlUtils"
8 8
9 export { HttpBizUtil } from "./src/main/ets/http/HttpBizUtil" 9 export { HttpBizUtil } from "./src/main/ets/http/HttpBizUtil"
10 10
  11 +export { HttpUtils } from "./src/main/ets/utils/HttpUtils"
  12 +
  13 +export { HostEnum, HostManager } from "./src/main/ets/http/HttpHostManager"
  14 +
@@ -5,6 +5,7 @@ import { ResponseDTO } from '../bean/ResponseDTO'; @@ -5,6 +5,7 @@ import { ResponseDTO } from '../bean/ResponseDTO';
5 import { HttpUrlUtils, WDHttp } from '../../../../Index'; 5 import { HttpUrlUtils, WDHttp } from '../../../../Index';
6 import { RefreshTokenRes } from '../bean/RefreshTokenRes'; 6 import { RefreshTokenRes } from '../bean/RefreshTokenRes';
7 import { ResposeError } from '../bean/ResposeError'; 7 import { ResposeError } from '../bean/ResposeError';
  8 +import { HttpUtils } from '../utils/HttpUtils';
8 9
9 const TAG: string = 'HttpBizUtil' 10 const TAG: string = 'HttpBizUtil'
10 11
@@ -93,13 +94,12 @@ export class HttpBizUtil { @@ -93,13 +94,12 @@ export class HttpBizUtil {
93 static refreshToken(): Promise<string> { 94 static refreshToken(): Promise<string> {
94 let url = HttpUrlUtils.getRefreshTokenUrl(); 95 let url = HttpUrlUtils.getRefreshTokenUrl();
95 let params: HashMap<string, string> = new HashMap<string, string>() 96 let params: HashMap<string, string> = new HashMap<string, string>()
96 - params.set('refreshToken', HttpUrlUtils.getRefreshToken())  
97 - params.set('deviceId', HttpUrlUtils.getDeviceId())  
98 - let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 97 + params.set('refreshToken', HttpUtils.getRefreshToken())
  98 + params.set('deviceId', HttpUtils.getDeviceId())
99 // Logger.debug(TAG, 'refreshToken getRefreshToken: ' + HttpUrlUtils.getRefreshToken()) 99 // Logger.debug(TAG, 'refreshToken getRefreshToken: ' + HttpUrlUtils.getRefreshToken())
100 // 请求刷新token接口 100 // 请求刷新token接口
101 return new Promise<string>((success, error) => { 101 return new Promise<string>((success, error) => {
102 - WDHttp.post<ResponseDTO<RefreshTokenRes>>(url, params, headers).then((resDTO: ResponseDTO<RefreshTokenRes>) => { 102 + WDHttp.post<ResponseDTO<RefreshTokenRes>>(url, params).then((resDTO: ResponseDTO<RefreshTokenRes>) => {
103 let newToken = '' 103 let newToken = ''
104 if (resDTO) { 104 if (resDTO) {
105 Logger.debug(TAG, 'refreshToken getRefreshToken: ' + resDTO.message) 105 Logger.debug(TAG, 'refreshToken getRefreshToken: ' + resDTO.message)
  1 +import { SpConstants } from 'wdConstant';
  2 +import { DateTimeUtils, DeviceUtil, SPHelper, StringUtils } from 'wdKit';
  3 +import { HttpUtils } from '../utils/HttpUtils';
  4 +import { HostEnum, HostManager } from './HttpHostManager';
  5 +
  6 +/**
  7 + * 网络请求参数工具类,TODO 不对外暴露,收缩权限
  8 + */
  9 +export class HttpParams {
  10 + static buildHeaders(): Record<string, string> {
  11 + let headers: Record<string, string> = {};
  12 + // 通用请求头
  13 + headers['User-Agent'] = 'Dalvik/2.1.0 (Linux; U; Android 13; 22101317C Build/TKQ1.221013.002)' // TODO
  14 + headers['channel'] = 'rmrb_china_0000' // 自有渠道
  15 + headers['plat'] = DeviceUtil.getPlat()
  16 + headers['Content-Type'] = 'application/json; charset=utf-8'
  17 + headers['device_id'] = DeviceUtil.clientId()
  18 + headers['build_version'] = HttpParams.getVersion()
  19 + headers['adcode'] = HttpUtils.getProvinceCode()
  20 + headers['os_version'] = DeviceUtil.getOsVersion()
  21 + headers['system'] = 'Android' // TODO 后续是否新增鸿蒙标识
  22 + headers['versionCode'] = HttpParams.getVersionCode()
  23 + headers['version_name'] = HttpParams.getVersionName()
  24 + headers['EagleEye-TraceID'] = DeviceUtil.getRandomUUIDForTraceID()
  25 + headers['imei'] = DeviceUtil.clientId()
  26 + headers['Accept-Language'] = 'zh'
  27 + headers['timestamp'] = DateTimeUtils.getTimeStamp() + ''
  28 + headers['mpassid'] = 'ZbHTMeTsfaYDAHqt8ZHIzcPs'
  29 + HttpParams.setLocationHeader(headers)
  30 + if (HttpUtils.isLogin()) {
  31 + headers['RMRB-X-TOKEN'] = HttpUtils.getUserToken()
  32 + headers['cookie'] = 'RMRB-X-TOKEN=' + HttpUtils.getUserToken()
  33 + headers['userId'] = HttpUtils.getUserId()
  34 + headers['userType'] = HttpUtils.getUserType()
  35 + }
  36 + HttpParams.addSpecialHeaders(headers);
  37 + return headers;
  38 + }
  39 +
  40 + static addSpecialHeaders(headers: Record<string, string>) {
  41 + switch (HostManager.getHost()) {
  42 + case HostEnum.HOST_UAT:
  43 + headers['X-Ca-Stage'] = 'PRE'
  44 + headers['Authorization'] = 'APPCODE 83092caa603a421aa0222308b3f6b27a'
  45 + headers['appCode'] = '83092caa603a421aa0222308b3f6b27a'
  46 + break
  47 + case HostEnum.HOST_SIT:
  48 + headers['X-Ca-Stage'] = 'TEST'
  49 + headers['Authorization'] = 'APPCODE 0af1f9085e484c97b2a44704bae72c07'
  50 + headers['appCode'] = '0af1f9085e484c97b2a44704bae72c07'
  51 + break
  52 + case HostEnum.HOST_PRODUCT:
  53 + headers['X-Ca-Stage'] = 'RELEASE'
  54 + headers['Authorization'] = 'APPCODE 3d4181bceeb94d9780e10dbb6c67bbf6'
  55 + headers['appCode'] = '3d4181bceeb94d9780e10dbb6c67bbf6'
  56 + break
  57 + case HostEnum.HOST_DEV:
  58 + headers['X-Ca-Stage'] = 'TEST'
  59 + headers['Authorization'] = 'APPCODE ff33172859e14f9a8299e3bd769e79f9'
  60 + headers['appCode'] = 'ff33172859e14f9a8299e3bd769e79f9'
  61 + break
  62 + default:
  63 + break
  64 + }
  65 + }
  66 +
  67 + /**
  68 + * 设置定位信息header
  69 + *
  70 + * @param headers
  71 + */
  72 + static setLocationHeader(headers: Record<string, string>) {
  73 + let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string
  74 + if (StringUtils.isNotEmpty(cityName)) {
  75 + headers['city'] = encodeURI(cityName)
  76 + }
  77 + let cityCode = SPHelper.default.getSync(SpConstants.LOCATION_CITY_CODE, '') as string
  78 + if (StringUtils.isNotEmpty(cityCode)) {
  79 + headers['city_dode'] = encodeURI(cityCode)
  80 + }
  81 + }
  82 +
  83 + private static getVersion() {
  84 + // TODO
  85 + return '202401242103';
  86 + }
  87 +
  88 + private static getVersionCode() {
  89 + // TODO
  90 + return '10000';
  91 + }
  92 +
  93 + private static getVersionName() {
  94 + // TODO 读取配置
  95 + return '1.0.0';
  96 + }
  97 +}
  1 +export enum HostEnum {
  2 + /**
  3 + * uat环境url
  4 + */
  5 + HOST_UAT = 'https://pd-apis-uat.pdnews.cn',
  6 + /**
  7 + * 中文端sit环境
  8 + */
  9 + HOST_SIT = 'https://pd-apis-sit.pdnews.cn',
  10 + /**
  11 + * dev环境url
  12 + */
  13 + HOST_DEV = 'https://pd-apis-dev.pdnews.cn',
  14 + /**
  15 + * 正式环境url
  16 + */
  17 + HOST_PRODUCT = 'https://pdapis.pdnews.cn',
  18 +}
  19 +
  20 +/**
  21 + * 环境host管理工具类
  22 + */
  23 +export class HostManager {
  24 + private static _hostUrl: HostEnum = HostEnum.HOST_PRODUCT;
  25 +
  26 + static changeHost(host: HostEnum) {
  27 + HostManager._hostUrl = host;
  28 + }
  29 +
  30 + static getHost(): string {
  31 + return HostManager._hostUrl;
  32 + }
  33 +}
1 import ArrayList from '@ohos.util.ArrayList'; 1 import ArrayList from '@ohos.util.ArrayList';
2 import service from './AxiosRequest'; 2 import service from './AxiosRequest';
3 -import { HttpUtils } from '../utils/HttpUtils';  
4 import { AxiosError, AxiosHeaders, AxiosRequestConfig, RawAxiosRequestHeaders } from '@ohos/axios'; 3 import { AxiosError, AxiosHeaders, AxiosRequestConfig, RawAxiosRequestHeaders } from '@ohos/axios';
5 import { ResponseDTO } from '../bean/ResponseDTO'; 4 import { ResponseDTO } from '../bean/ResponseDTO';
6 import HashMap from '@ohos.util.HashMap'; 5 import HashMap from '@ohos.util.HashMap';
  6 +import { HttpParams } from './HttpCommonParams';
7 7
8 export class HttpRequest { 8 export class HttpRequest {
9 private static globalHeaderProviders: ArrayList<() => Record<string, string>> = new ArrayList(); 9 private static globalHeaderProviders: ArrayList<() => Record<string, string>> = new ArrayList();
@@ -14,7 +14,7 @@ export class HttpRequest { @@ -14,7 +14,7 @@ export class HttpRequest {
14 14
15 static initHttpHeader() { 15 static initHttpHeader() {
16 HttpRequest.addGlobalHeaderProvider(() => { 16 HttpRequest.addGlobalHeaderProvider(() => {
17 - return HttpUtils.buildHeaders(); 17 + return HttpParams.buildHeaders();
18 }) 18 })
19 } 19 }
20 20
@@ -34,15 +34,17 @@ export class HttpRequest { @@ -34,15 +34,17 @@ export class HttpRequest {
34 34
35 static buildHeaderWithGlobalHeader(headers?: HashMap<string, string>): AxiosHeaders { 35 static buildHeaderWithGlobalHeader(headers?: HashMap<string, string>): AxiosHeaders {
36 let commonHeader: AxiosHeaders = new AxiosHeaders() 36 let commonHeader: AxiosHeaders = new AxiosHeaders()
37 - headers?.forEach((v, k) => {  
38 - commonHeader.set(k, v);  
39 - }); 37 +
40 HttpRequest.globalHeaderProviders.forEach((func) => { 38 HttpRequest.globalHeaderProviders.forEach((func) => {
41 - let headers = func();  
42 - for (const obj of Object.entries(headers)) { 39 + let getHeaders = func();
  40 + for (const obj of Object.entries(getHeaders)) {
43 commonHeader.set(obj[0], obj[1]); 41 commonHeader.set(obj[0], obj[1]);
44 } 42 }
45 }) 43 })
  44 + // 业务headers,覆盖common(如果有冲突的话,取业务)
  45 + headers?.forEach((v, k) => {
  46 + commonHeader.set(k, v);
  47 + });
46 if (!commonHeader.get('Content-Type')) { 48 if (!commonHeader.get('Content-Type')) {
47 commonHeader.set('Content-Type', 'application/json;charset=utf-8'); 49 commonHeader.set('Content-Type', 'application/json;charset=utf-8');
48 } 50 }
@@ -56,24 +58,13 @@ export class HttpRequest { @@ -56,24 +58,13 @@ export class HttpRequest {
56 return service.get(url, config) 58 return service.get(url, config)
57 } 59 }
58 60
59 - static post0<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> { 61 + static post<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> {
60 let config: AxiosRequestConfig = { 62 let config: AxiosRequestConfig = {
61 headers: HttpRequest.buildHeaderWithGlobalHeader(headers) 63 headers: HttpRequest.buildHeaderWithGlobalHeader(headers)
62 } 64 }
63 return service.post(url, data, config) 65 return service.post(url, data, config)
64 } 66 }
65 67
66 - static post<T = object>(url: string, data1?: object, headers?: HashMap<string, string>): Promise<T> {  
67 - let requestHeaders: AxiosHeaders = new AxiosHeaders()  
68 - headers?.forEach((v, k) => {  
69 - requestHeaders.set(k, v);  
70 - });  
71 - let config: AxiosRequestConfig = {  
72 - headers: requestHeaders as RawAxiosRequestHeaders,  
73 - }  
74 - return service.post(url, data1, config)  
75 - }  
76 -  
77 static put<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> { 68 static put<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> {
78 let config: AxiosRequestConfig = { 69 let config: AxiosRequestConfig = {
79 headers: HttpRequest.buildHeaderWithGlobalHeader(headers) 70 headers: HttpRequest.buildHeaderWithGlobalHeader(headers)
1 -import HashMap from '@ohos.util.HashMap';  
2 -import { SpConstants } from 'wdConstant';  
3 -import { SPHelper, StringUtils } from 'wdKit'; 1 +import { HostManager } from './HttpHostManager';
4 2
5 /** 3 /**
6 - * 网络请求业务侧工具类 4 + * 网络请求业务侧接口url工具类
7 */ 5 */
8 export class HttpUrlUtils { 6 export class HttpUrlUtils {
9 /** 7 /**
10 - * uat环境url  
11 - */  
12 - static readonly HOST_UAT: string = "https://pd-apis-uat.pdnews.cn";  
13 - /**  
14 - * 中文端sit环境  
15 - */  
16 - static readonly HOST_SIT: string = "https://pd-apis-sit.pdnews.cn";  
17 - /**  
18 - * 正式环境url  
19 - */  
20 - static readonly HOST_PRODUCT: string = "https://pdapis.pdnews.cn";  
21 - /**  
22 - * dev环境url  
23 - */  
24 - static readonly HOST_DEV: string = "https://pd-apis-dev.pdnews.cn";  
25 - /**  
26 * 启动接口(底导接口) 8 * 启动接口(底导接口)
27 */ 9 */
28 static readonly BOTTOM_NAV_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup"; 10 static readonly BOTTOM_NAV_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup";
@@ -64,10 +46,6 @@ export class HttpUrlUtils { @@ -64,10 +46,6 @@ export class HttpUrlUtils {
64 */ 46 */
65 static readonly INTERACT_EXECUTELIKE: string = "/api/rmrb-interact/interact/zh/c/like/executeLike"; 47 static readonly INTERACT_EXECUTELIKE: string = "/api/rmrb-interact/interact/zh/c/like/executeLike";
66 /** 48 /**
67 - * 收藏、取消收藏  
68 - */  
69 - static readonly INTERACT_EXECUTECOLLECTRECORD: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord";  
70 - /**  
71 * 关注号主 49 * 关注号主
72 */ 50 */
73 static readonly INTERACT_ACCENTION_OPERATION: string = "/api/rmrb-interact/interact/zh/c/attention/operation"; 51 static readonly INTERACT_ACCENTION_OPERATION: string = "/api/rmrb-interact/interact/zh/c/attention/operation";
@@ -293,265 +271,78 @@ export class HttpUrlUtils { @@ -293,265 +271,78 @@ export class HttpUrlUtils {
293 * 获取启动页相关数据 271 * 获取启动页相关数据
294 */ 272 */
295 static readonly LAUNCH_PAGE_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/launchPage"; 273 static readonly LAUNCH_PAGE_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/launchPage";
296 - private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT;  
297 /** 274 /**
298 * 推荐列表 275 * 推荐列表
299 */ 276 */
300 static readonly RECOMMEND_LIST: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list"; 277 static readonly RECOMMEND_LIST: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list";
301 -  
302 /** 278 /**
303 * 搜索推荐 279 * 搜索推荐
304 */ 280 */
305 static readonly SEARCH_SUGGEST_DATA_PATH: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list"; 281 static readonly SEARCH_SUGGEST_DATA_PATH: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list";
306 282
307 - public static set hostUrl(value: string) {  
308 - HttpUrlUtils._hostUrl = value;  
309 - }  
310 -  
311 - private static userId = ''  
312 - private static userType = ''  
313 - private static token = ''  
314 -  
315 - static getCommonHeaders(): HashMap<string, string> {  
316 - let headers: HashMap<string, string> = new HashMap<string, string>()  
317 - headers.set('User-Agent', 'Dalvik/2.1.0 (Linux; U; Android 13; 22101317C Build/TKQ1.221013.002)')  
318 - headers.set('channel', HttpUrlUtils.getChannel())  
319 - //headers.set('appCode', ConfigConstants.appCode)  
320 - headers.set('plat', HttpUrlUtils.getPlat())  
321 - //headers.set('Authorization', 'APPCODE 83092caa603a421aa0222308b3f6b27a')  
322 - headers.set('Content-Type', 'application/json; charset=utf-8')  
323 - headers.set('timestamp', HttpUrlUtils.getTimestamp())  
324 - headers.set('RMRB-X-TOKEN', HttpUrlUtils.getXToken())  
325 - headers.set('device_id', HttpUrlUtils.getDeviceId())  
326 - if (HttpUrlUtils.getXToken() != '') {  
327 - headers.set('cookie', 'RMRB-X-TOKEN=' + HttpUrlUtils.getXToken())  
328 - }  
329 - headers.set('build_version', HttpUrlUtils.getVersion())  
330 - headers.set('adcode', HttpUrlUtils.getAdCode())  
331 - headers.set('os_version', HttpUrlUtils.getOsVersion())  
332 - //headers.set('X-Ca-Stage', 'PRE')  
333 - headers.set('versionCode', HttpUrlUtils.getVersionCode())  
334 - headers.set('system', HttpUrlUtils.getTerminalId())  
335 - headers.set('version_name', HttpUrlUtils.getVersionName())  
336 - headers.set('EagleEye-TraceID', 'D539562E48554A60977AF4BECB6D6C7A')  
337 - headers.set('imei', HttpUrlUtils.getImei())  
338 - headers.set('Accept-Language', 'zh')  
339 - // headers.set('city', HttpUrlUtils.getCity())  
340 - // headers.set('city_dode', HttpUrlUtils.getCityCode())  
341 - HttpUrlUtils.setLocationHeader(headers)  
342 - // TODO 判断是否登录  
343 - headers.set('userId', HttpUrlUtils.getUserId())  
344 - headers.set('userType', HttpUrlUtils.getUserType())  
345 -  
346 - headers.set('mpassid', 'ZbHTMeTsfaYDAHqt8ZHIzcPs')  
347 - HttpUrlUtils.addSpecialHeaders(headers);  
348 - // Logger.debug("TAG", '******************* commonHeaders headers start ******************************** ');  
349 - // headers.forEach((v,k)=>{  
350 - // Logger.debug("TAG", 'getCommonHeaders header: ' + k + ': ' + v);  
351 - // })  
352 - // Logger.debug("TAG", '******************* commonHeaders headers end ******************************** ');  
353 - return headers;  
354 - }  
355 -  
356 - static addSpecialHeaders(headers: HashMap<string, string>) {  
357 - switch (HttpUrlUtils._hostUrl) {  
358 - case HttpUrlUtils.HOST_UAT:  
359 - // TODO 待优化到常量类里  
360 - headers.set('X-Ca-Stage', 'PRE');  
361 - headers.set('Authorization', 'APPCODE 83092caa603a421aa0222308b3f6b27a');  
362 - headers.set('appCode', '83092caa603a421aa0222308b3f6b27a');  
363 - break  
364 - case HttpUrlUtils.HOST_SIT:  
365 - headers.set('X-Ca-Stage', 'TEST');  
366 - headers.set('Authorization', 'APPCODE 0af1f9085e484c97b2a44704bae72c07');  
367 - headers.set('appCode', '0af1f9085e484c97b2a44704bae72c07');  
368 - break  
369 - case HttpUrlUtils.HOST_PRODUCT:  
370 - headers.set('X-Ca-Stage', 'RELEASE');  
371 - headers.set('Authorization', 'APPCODE 3d4181bceeb94d9780e10dbb6c67bbf6');  
372 - headers.set('appCode', '3d4181bceeb94d9780e10dbb6c67bbf6');  
373 - break  
374 - case HttpUrlUtils.HOST_DEV:  
375 - headers.set('X-Ca-Stage', 'TEST');  
376 - headers.set('Authorization', 'APPCODE ff33172859e14f9a8299e3bd769e79f9');  
377 - headers.set('appCode', 'ff33172859e14f9a8299e3bd769e79f9');  
378 - break  
379 - default:  
380 - break  
381 - }  
382 - }  
383 -  
384 - static setLocationHeader(headers: HashMap<string, string>) {  
385 - let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string  
386 - if (StringUtils.isNotEmpty(cityName)) {  
387 - headers.set('city', encodeURI(cityName))  
388 - }  
389 - let cityCode = SPHelper.default.getSync(SpConstants.LOCATION_CITY_CODE, '') as string  
390 - if (StringUtils.isNotEmpty(cityCode)) {  
391 - headers.set('city_dode', encodeURI(cityCode))  
392 - }  
393 - }  
394 -  
395 - static getHost() {  
396 - return HttpUrlUtils._hostUrl;  
397 - }  
398 -  
399 - private static getCity() {  
400 - // TODO 对接定位  
401 - return '%E5%90%88%E8%82%A5%E5%B8%82';  
402 - }  
403 -  
404 - private static getChannel() {  
405 - // TODO 对接配置  
406 - return 'rmrb_china_0000';  
407 - }  
408 -  
409 - private static getPlat() {  
410 - return 'Phone';  
411 - }  
412 -  
413 - private static getTimestamp() {  
414 - // return DateTimeUtils.getCurrentTime() + '';  
415 - // TODO 暂时写死,有些page 真实时间戳 返回数据为空  
416 - return '155203523';  
417 - }  
418 -  
419 - private static getXToken() {  
420 - if (StringUtils.isNotEmpty(HttpUrlUtils.token)) {  
421 - return HttpUrlUtils.token  
422 - }  
423 - HttpUrlUtils.token = SPHelper.default.getSync(SpConstants.USER_JWT_TOKEN, "") as string  
424 - if (StringUtils.isNotEmpty(HttpUrlUtils.token)) {  
425 - return HttpUrlUtils.token  
426 - }  
427 - // return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc';  
428 - return ''  
429 - }  
430 -  
431 - static getRefreshToken() {  
432 - let refreshToken = SPHelper.default.getSync(SpConstants.USER_REFRESH_TOKEN, "")  
433 - if (StringUtils.isNotEmpty(refreshToken)) {  
434 - return refreshToken as string;  
435 - }  
436 - return '';  
437 - }  
438 -  
439 - public static getDeviceId() {  
440 - // TODO  
441 - return '8a81226a-cabd-3e1b-b630-b51db4a720ed';  
442 - }  
443 -  
444 - private static getVersion() {  
445 - // TODO  
446 - return '202401242103';  
447 - }  
448 -  
449 - private static getVersionCode() {  
450 - // TODO  
451 - return '7301';  
452 - }  
453 -  
454 - private static getVersionName() {  
455 - // TODO  
456 - return '7.3.0.1';  
457 - }  
458 -  
459 - private static getAdCode() {  
460 - return '340000';  
461 - }  
462 -  
463 - private static getOsVersion() {  
464 - // TODO  
465 - return '12';  
466 - }  
467 -  
468 - public static getCityCode() {  
469 - // TODO  
470 - return '340100';  
471 - }  
472 -  
473 - public static getProvinceCode() {  
474 - // TODO  
475 - return '340000';  
476 - }  
477 -  
478 /** 283 /**
479 - * 地区code 284 + * 人民号号主推荐
480 */ 285 */
481 - public static getDistrictCode() {  
482 - // TODO  
483 - return '340103';  
484 - } 286 + static readonly RMH_RECOMMEND_DATA_PATH: string = "/api/rmrb-bff-display-zh/recommend/zh/c/rmh";
485 287
486 - private static getTerminalId() {  
487 - return 'Android';  
488 - } 288 + /**
  289 + * 关注号主发布内容接口
  290 + */
  291 + static readonly ATTENTION_CONTENT_LIST_DATA_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/attention/contentList";
489 292
490 - public static getImei() {  
491 - // TODO  
492 - return '8a81226a-cabd-3e1b-b630-b51db4a720ed';  
493 - } 293 + /**
  294 + * 一键关注接口
  295 + */
  296 + static readonly ATTENTION_BATCH_DATA_PATH: string = "/api/rmrb-interact/interact/zh/c/attention/batch";
494 297
495 - public static getUserId() {  
496 - // TODO 对接登录  
497 - if (StringUtils.isNotEmpty(HttpUrlUtils.userId)) {  
498 - return HttpUrlUtils.userId  
499 - }  
500 - HttpUrlUtils.userId = SPHelper.default.getSync(SpConstants.USER_ID, "") as string  
501 - return HttpUrlUtils.userId;  
502 - }  
503 298
504 - public static getUserType() {  
505 - if (StringUtils.isNotEmpty(HttpUrlUtils.userType)) {  
506 - return HttpUrlUtils.userType  
507 - }  
508 - HttpUrlUtils.userType = SPHelper.default.getSync(SpConstants.USER_Type, "") as string  
509 - return HttpUrlUtils.userType; 299 + static getHost(): string {
  300 + return HostManager.getHost();
510 } 301 }
511 302
512 static getVerifyCodeUrl() { 303 static getVerifyCodeUrl() {
513 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/sendVerifyCode"; 304 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/auth/zh/c/sendVerifyCode";
514 return url; 305 return url;
515 } 306 }
516 307
517 static getVerifyCodeByTokenUrl() { 308 static getVerifyCodeByTokenUrl() {
518 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/sendVerifyCodeByToken"; 309 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/sendVerifyCodeByToken";
519 return url; 310 return url;
520 } 311 }
521 312
522 static getCheckVerifyCodeByToken() { 313 static getCheckVerifyCodeByToken() {
523 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/checkVerifyCodeByToken"; 314 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/checkVerifyCodeByToken";
524 return url; 315 return url;
525 } 316 }
526 317
527 318
528 static getForgetPasswordUrl() { 319 static getForgetPasswordUrl() {
529 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/forgotPassword"; 320 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/forgotPassword";
530 return url; 321 return url;
531 } 322 }
532 323
533 static getLogoutUrl() { 324 static getLogoutUrl() {
534 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/appLogout"; 325 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/appLogout";
535 return url; 326 return url;
536 } 327 }
537 328
538 static getRefreshTokenUrl() { 329 static getRefreshTokenUrl() {
539 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.REFRESH_TOKEN_PATH; 330 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.REFRESH_TOKEN_PATH;
540 return url; 331 return url;
541 } 332 }
542 333
543 static getResetPassworddUrl() { 334 static getResetPassworddUrl() {
544 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/resetPassword"; 335 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/resetPassword";
545 return url; 336 return url;
546 } 337 }
547 338
548 static queryUserDetail() { 339 static queryUserDetail() {
549 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/queryUserDetail"; 340 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/queryUserDetail";
550 return url; 341 return url;
551 } 342 }
552 343
553 static editUserDetail() { 344 static editUserDetail() {
554 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/editUserDetail"; 345 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/editUserDetail";
555 return url; 346 return url;
556 } 347 }
557 348
@@ -561,358 +352,339 @@ export class HttpUrlUtils { @@ -561,358 +352,339 @@ export class HttpUrlUtils {
561 } 352 }
562 353
563 static getCheckVerifyCodeUrl() { 354 static getCheckVerifyCodeUrl() {
564 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/checkVerifyCode"; 355 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/auth/zh/c/checkVerifyCode";
565 return url; 356 return url;
566 } 357 }
567 358
568 static getAgreement() { 359 static getAgreement() {
569 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-bff-display-zh/display/zh/c/agreement"; 360 + let url = HttpUrlUtils.getHost() + "/api/rmrb-bff-display-zh/display/zh/c/agreement";
570 return url; 361 return url;
571 } 362 }
572 363
573 static getCheckVerifyByTokenCodeUrl() { 364 static getCheckVerifyByTokenCodeUrl() {
574 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/checkVerifyCodeByToken"; 365 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/auth/zh/c/checkVerifyCodeByToken";
575 return url; 366 return url;
576 } 367 }
577 368
578 369
579 /*优质评论页*/ 370 /*优质评论页*/
580 static getQualityCommentUrl() { 371 static getQualityCommentUrl() {
581 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/highQuality"; 372 + let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/highQuality";
582 373
583 return url 374 return url
584 } 375 }
585 376
586 /*获取详情页评论列表*/ 377 /*获取详情页评论列表*/
587 static getContentCommentListDataUrl() { 378 static getContentCommentListDataUrl() {
588 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/contentCommentList" 379 + let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/contentCommentList"
589 return url 380 return url
590 } 381 }
591 382
592 /*获取子评论列表*/ 383 /*获取子评论列表*/
593 static getChildContentCommentListDataUrl() { 384 static getChildContentCommentListDataUrl() {
594 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/childCommentList" 385 + let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/childCommentList"
595 return url 386 return url
596 } 387 }
597 388
598 /*评论状态*/ 389 /*评论状态*/
599 static getBatchCommentStatusUrl() { 390 static getBatchCommentStatusUrl() {
600 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/batchCommentStatus" 391 + let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/batchCommentStatus"
601 return url 392 return url
602 } 393 }
603 394
604 /*评论点赞*/ 395 /*评论点赞*/
605 static getCommentLikeUrl() { 396 static getCommentLikeUrl() {
606 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/commentLike" 397 + let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/commentLike"
607 return url 398 return url
608 } 399 }
609 400
610 /*发布评论*/ 401 /*发布评论*/
611 static getPublishCommentUrl() { 402 static getPublishCommentUrl() {
612 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/publish" 403 + let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/publish"
613 return url 404 return url
614 } 405 }
615 406
616 /*游客发布评论*/ 407 /*游客发布评论*/
617 static getNoUserPublishCommentUrl() { 408 static getNoUserPublishCommentUrl() {
618 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/commentLike" 409 + let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/commentLike"
619 return url 410 return url
620 } 411 }
621 412
622 /*levleIcon*/ 413 /*levleIcon*/
623 static getBatchUserUrl() { 414 static getBatchUserUrl() {
624 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-point/auth/level/zh/c/batchUser" 415 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-point/auth/level/zh/c/batchUser"
625 return url 416 return url
626 } 417 }
627 418
628 /*authIcon 20个一次上限*/ 419 /*authIcon 20个一次上限*/
629 static getDetailListUrl() { 420 static getDetailListUrl() {
630 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-contact/contact/zh/c/master/detailList" 421 + let url = HttpUrlUtils.getHost() + "/api/rmrb-contact/contact/zh/c/master/detailList"
631 return url 422 return url
632 } 423 }
633 424
634 425
635 //账户注销 426 //账户注销
636 static accountLogoutUrl() { 427 static accountLogoutUrl() {
637 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/logoff"; 428 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/logoff";
638 return url; 429 return url;
639 } 430 }
640 431
641 //更换手机号绑定 432 //更换手机号绑定
642 static changeBindPhone() { 433 static changeBindPhone() {
643 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/userPhoneChange"; 434 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/userPhoneChange";
644 return url; 435 return url;
645 } 436 }
646 437
647 //获取用户安全页信息 438 //获取用户安全页信息
648 static querySecurity() { 439 static querySecurity() {
649 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/security/query"; 440 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/security/query";
  441 + return url;
  442 + }
  443 +
  444 + //游客评论合并
  445 + static visitorMergeComment() {
  446 + let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/visitorMerge";
650 return url; 447 return url;
651 } 448 }
652 449
653 static getAppointmentListDataUrl() { 450 static getAppointmentListDataUrl() {
654 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH 451 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH
655 return url 452 return url
656 } 453 }
657 454
658 static getMyCollectionListDataUrl() { 455 static getMyCollectionListDataUrl() {
659 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_MyCollectionList_PATH 456 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_MyCollectionList_PATH
660 return url 457 return url
661 } 458 }
662 459
663 static getExecuteCollcetUrl() { 460 static getExecuteCollcetUrl() {
664 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH 461 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH
665 return url 462 return url
666 } 463 }
667 464
668 static getFollowListDetailDataUrl() { 465 static getFollowListDetailDataUrl() {
669 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.FOLLOW_LIST_DETAIL_DATA_PATH 466 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_LIST_DETAIL_DATA_PATH
670 return url 467 return url
671 } 468 }
672 469
673 static getFollowListDataUrl() { 470 static getFollowListDataUrl() {
674 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.FOLLOW_LIST_DATA_PATH 471 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_LIST_DATA_PATH
675 return url 472 return url
676 } 473 }
677 474
678 static getMineFollowListDataUrl() { 475 static getMineFollowListDataUrl() {
679 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.MINE_FOLLOW_LIST_DATA_PATH 476 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.MINE_FOLLOW_LIST_DATA_PATH
680 return url 477 return url
681 } 478 }
682 479
683 static getFollowListStatusDataUrl() { 480 static getFollowListStatusDataUrl() {
684 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.FOLLOW_LIST_STATUS_DATA_PATH 481 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_LIST_STATUS_DATA_PATH
685 return url 482 return url
686 } 483 }
687 484
688 static getCommentListStatusDataUrl() { 485 static getCommentListStatusDataUrl() {
689 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.COMMENT_LIST_STATUS_DATA_PATH 486 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.COMMENT_LIST_STATUS_DATA_PATH
690 return url 487 return url
691 } 488 }
692 489
693 static getMineCommentListDataUrl() { 490 static getMineCommentListDataUrl() {
694 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.MINE_COMMENT_LIST_DATA_PATH 491 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.MINE_COMMENT_LIST_DATA_PATH
695 return url 492 return url
696 } 493 }
697 494
698 static getMineUserLevelDataUrl() { 495 static getMineUserLevelDataUrl() {
699 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.MINE_USER_LEVEL_DATA_PATH 496 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.MINE_USER_LEVEL_DATA_PATH
700 return url 497 return url
701 } 498 }
702 499
703 static getOtherUserLevelDataUrl() { 500 static getOtherUserLevelDataUrl() {
704 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.OTHER_USER_LEVEL_DATA_PATH 501 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.OTHER_USER_LEVEL_DATA_PATH
705 return url 502 return url
706 } 503 }
707 504
708 static getMineUserDetailDataUrl() { 505 static getMineUserDetailDataUrl() {
709 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.MINE_USER_DETAIL_DATA_PATH 506 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.MINE_USER_DETAIL_DATA_PATH
710 return url 507 return url
711 } 508 }
712 509
713 static getOtherUserDetailDataUrl() { 510 static getOtherUserDetailDataUrl() {
714 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.OTHER_USER_DETAIL_DATA_PATH 511 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.OTHER_USER_DETAIL_DATA_PATH
715 return url 512 return url
716 } 513 }
717 514
718 static getOtherCommentListDataUrl() { 515 static getOtherCommentListDataUrl() {
719 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.OTHER_COMMENT_LIST_DATA_PATH 516 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.OTHER_COMMENT_LIST_DATA_PATH
720 return url 517 return url
721 } 518 }
722 519
723 static getOtherUserFollowListDataUrl() { 520 static getOtherUserFollowListDataUrl() {
724 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.OTHER_USER_FOLLOW_LIST_DATA_PATH 521 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.OTHER_USER_FOLLOW_LIST_DATA_PATH
725 return url 522 return url
726 } 523 }
727 524
728 static getAppointmentOperationUrl() { 525 static getAppointmentOperationUrl() {
729 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_OPERATION_STATUS_PATH 526 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_OPERATION_STATUS_PATH
730 return url 527 return url
731 } 528 }
732 529
733 static getCommentLikeOperationUrl() { 530 static getCommentLikeOperationUrl() {
734 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.COMMENT_LIKE_OPERATION_PATH 531 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.COMMENT_LIKE_OPERATION_PATH
735 return url 532 return url
736 } 533 }
737 534
738 static getFollowOperationUrl() { 535 static getFollowOperationUrl() {
739 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.FOLLOW_OPERATION_PATH 536 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_OPERATION_PATH
740 return url 537 return url
741 } 538 }
742 539
743 static getSearchHintDataUrl() { 540 static getSearchHintDataUrl() {
744 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_HINT_DATA_PATH 541 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEARCH_HINT_DATA_PATH
745 return url 542 return url
746 } 543 }
747 544
748 static getSearchHotsDataUrl() { 545 static getSearchHotsDataUrl() {
749 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_HOTS_DATA_PATH 546 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEARCH_HOTS_DATA_PATH
750 return url 547 return url
751 } 548 }
752 549
753 static getRelatedSearchContentDataUrl() { 550 static getRelatedSearchContentDataUrl() {
754 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.RELATED_SEARCH_CONTENT_DATA_PATH 551 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.RELATED_SEARCH_CONTENT_DATA_PATH
755 return url 552 return url
756 } 553 }
757 554
758 static getInterestsUrl() { 555 static getInterestsUrl() {
759 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERESTS_HOTS_DATA_PATH; 556 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERESTS_HOTS_DATA_PATH;
760 return url; 557 return url;
761 558
762 } 559 }
763 560
764 static getUpdateInterestsUrl() { 561 static getUpdateInterestsUrl() {
765 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERESTS_UPDATETAG_PATH; 562 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERESTS_UPDATETAG_PATH;
766 return url; 563 return url;
767 } 564 }
768 565
769 static getLaunchPageDataUrl() { 566 static getLaunchPageDataUrl() {
770 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LAUNCH_PAGE_PATH; 567 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LAUNCH_PAGE_PATH;
771 return url; 568 return url;
772 569
773 } 570 }
774 571
775 static getLiveDetailsUrl() { 572 static getLiveDetailsUrl() {
776 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_DETAILS_PATH 573 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_DETAILS_PATH
777 return url 574 return url
778 } 575 }
779 576
780 static getLiveListUrl() { 577 static getLiveListUrl() {
781 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_LIST_PATH 578 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_LIST_PATH
782 return url 579 return url
783 } 580 }
784 581
785 static getLiveChatListUrl() { 582 static getLiveChatListUrl() {
786 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_CHAT_LIST_PATH 583 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_CHAT_LIST_PATH
787 return url 584 return url
788 } 585 }
789 586
790 static getLiveRoomDataUrl() { 587 static getLiveRoomDataUrl() {
791 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_ROOM_DATA_PATH 588 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_ROOM_DATA_PATH
792 return url 589 return url
793 } 590 }
794 591
795 static getLiveAppointmentStatusUrl() { 592 static getLiveAppointmentStatusUrl() {
796 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_APPOINTMENT_STATUS_PATH 593 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_APPOINTMENT_STATUS_PATH
797 return url 594 return url
798 } 595 }
799 596
800 static getLiveAppointmentUrl() { 597 static getLiveAppointmentUrl() {
801 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_APPOINTMENT_PATH 598 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_APPOINTMENT_PATH
802 return url 599 return url
803 } 600 }
804 601
805 static getAppointmentStatusUrl() { 602 static getAppointmentStatusUrl() {
806 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_APPOINTMENT_BATCH_PATH 603 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_APPOINTMENT_BATCH_PATH
807 return url 604 return url
808 } 605 }
809 606
810 static getSearchResultCountDataUrl() { 607 static getSearchResultCountDataUrl() {
811 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_COUNT_DATA_PATH 608 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEARCH_RESULT_COUNT_DATA_PATH
812 return url 609 return url
813 } 610 }
814 611
815 static getSearchResultListDataUrl() { 612 static getSearchResultListDataUrl() {
816 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_LIST_DATA_PATH 613 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEARCH_RESULT_LIST_DATA_PATH
817 return url 614 return url
818 } 615 }
819 616
820 static getInteractListDataUrl() { 617 static getInteractListDataUrl() {
821 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERACT_DATA_PATH 618 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_PATH
822 return url 619 return url
823 } 620 }
824 621
825 static getCreatorDetailListDataUrl() { 622 static getCreatorDetailListDataUrl() {
826 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.CREATOR_DETAIL_LIST_DATA_PATH 623 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.CREATOR_DETAIL_LIST_DATA_PATH
827 return url 624 return url
828 } 625 }
829 626
830 static getArticleCountHotsDataUrl() { 627 static getArticleCountHotsDataUrl() {
831 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.ARTICLE_COUNT_HOTS_DATA_PATH 628 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.ARTICLE_COUNT_HOTS_DATA_PATH
832 return url 629 return url
833 } 630 }
834 631
835 static getArticleListHotsDataUrl() { 632 static getArticleListHotsDataUrl() {
836 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.ARTICLE_LIST_HOTS_DATA_PATH 633 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.ARTICLE_LIST_HOTS_DATA_PATH
837 return url 634 return url
838 } 635 }
839 636
840 static getCreatorInfluenceInfoHotsDataUrl() { 637 static getCreatorInfluenceInfoHotsDataUrl() {
841 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.CREATOR_INFLUENCE_HOTS_DATA_PATH 638 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.CREATOR_INFLUENCE_HOTS_DATA_PATH
842 return url 639 return url
843 } 640 }
844 641
845 //点赞 642 //点赞
846 static executeLike() { 643 static executeLike() {
847 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-interact/interact/zh/c/like/executeLike"; 644 + let url = HttpUrlUtils.getHost() + "/api/rmrb-interact/interact/zh/c/like/executeLike";
848 return url; 645 return url;
849 } 646 }
850 647
851 //获取点赞状态 648 //获取点赞状态
852 static getLikeStatus() { 649 static getLikeStatus() {
853 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-interact/interact/zh/c/batchLikeAndCollect/status"; 650 + let url = HttpUrlUtils.getHost() + "/api/rmrb-interact/interact/zh/c/batchLikeAndCollect/status";
  651 + return url;
  652 + }
  653 +
  654 + //获取点赞数
  655 + static getLikeCount() {
  656 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_V2_DATA_PATH;
854 return url; 657 return url;
855 } 658 }
856 659
857 //搜索推荐 660 //搜索推荐
858 static getSearchSuggestDataUrl() { 661 static getSearchSuggestDataUrl() {
859 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_SUGGEST_DATA_PATH 662 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEARCH_SUGGEST_DATA_PATH
860 return url 663 return url
861 } 664 }
862 665
863 //金刚位聚合页 666 //金刚位聚合页
864 static getThemeListUrl() { 667 static getThemeListUrl() {
865 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-bff-display-zh/display/zh/c/themeList"; 668 + let url = HttpUrlUtils.getHost() + "/api/rmrb-bff-display-zh/display/zh/c/themeList";
866 return url; 669 return url;
867 } 670 }
868 671
869 - // static getYcgCommonHeaders(): HashMap<string, string> {  
870 - // let headers: HashMap<string, string> = new HashMap<string, string>()  
871 - //  
872 - // headers.set('mpassid', 'XGt6jfGUx8ADAKruTyAMdhHj')  
873 - // headers.set('city', "%E5%90%88%E8%82%A5%E5%B8%82")  
874 - // headers.set('User-Agent', 'Dalvik/2.1.0 (Linux; U; Android 10; PCT-AL10 Build/HUAWEIPCT-AL10)')  
875 - // headers.set('channel', "rmrb_china_0000")  
876 - // headers.set('appCode', "0af1f9085e484c97b2a44704bae72c07")  
877 - // headers.set('Authorization', "APPCODE 0af1f9085e484c97b2a44704bae72c07")  
878 - // headers.set('X-Ca-Stage', "TEST")  
879 - // headers.set('plat', "Phone")  
880 - // headers.set('Content-Type', 'application/json; charset=utf-8')  
881 - // headers.set('timestamp', "740977741")  
882 - // headers.set('RMRB-X-TOKEN', "eyJhbGciOiJIUzI1NiIsImtpZCI6IklFazBGclhfV2RYMEx1ZktDU01iYTVYd0VmUHZ6a043T0F5UTRFLWIwWU0ifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcxMDc1NjM3NywidXNlcklkIjo1NjczODc0NzcwNjM2MjEsInVzZXJWZXJzaW9uIjoiNTY3Mzg3NDc3MDYzNjIxXzAiLCJ1c2VyTmFtZSI6IiVFNCVCQSVCQSVFNiVCMCU5MSVFNiU5NyVBNSVFNiU4QSVBNSVFNyVCRCU5MSVFNSU4RiU4QmFQcnRxNSIsInVzZXJUeXBlIjoxLCJjcmVhdG9ySWQiOm51bGwsInVzZXJJZFpoIjpudWxsfQ.KBkF0Yki-JWlq0ZIOCzgKwQc1ycBnFHa6CF-rMPRgHU")  
883 - // headers.set('device_id', "5156098c-6c44-3514-af70-04a0139a9327")  
884 - // // headers.set('cookie', 'RMRB-X-TOKEN=eyJhbGciOiJIUzI1NiIsImtpZCI6IklFazBGclhfV2RYMEx1ZktDU01iYTVYd0VmUHZ6a043T0F5UTRFLWIwWU0ifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcxMDU4Mzk0MywidXNlcklkIjo1NjczODc0NzcwNjM2MjEsInVzZXJWZXJzaW9uIjoiNTY3Mzg3NDc3MDYzNjIxXzAiLCJ1c2VyTmFtZSI6IiVFNCVCQSVCQSVFNiVCMCU5MSVFNiU5NyVBNSVFNiU4QSVBNSVFNyVCRCU5MSVFNSU4RiU4QmFQcnRxNSIsInVzZXJUeXBlIjoxLCJjcmVhdG9ySWQiOm51bGwsInVzZXJJZFpoIjpudWxsfQ._LTKrUxQozpCj1XMhx1TWOIxn5gjDveoPuMFGpI0g_8')  
885 - // headers.set('build_version', "202403112023")  
886 - // headers.set('adcode', "340000")  
887 - // headers.set('os_version', "10")  
888 - // headers.set('city_dode', "340100")  
889 - // headers.set('userId', "567387477063621")  
890 - // headers.set('versionCode', "7302")  
891 - // headers.set('system', "Android")  
892 - // headers.set('version_name', "7.3.0.2")  
893 - // headers.set('EagleEye-TraceID', '101118E4D006453DA549A82AA8CAFBFE')  
894 - // headers.set('imei', "5156098c-6c44-3514-af70-04a0139a9327")  
895 - // headers.set('userType', "1")  
896 - // headers.set('Accept-Language', 'zh')  
897 - //  
898 - // // HttpUrlUtils.addSpecialHeaders(headers);  
899 - // // Logger.debug("TAG", '******************* commonHeaders headers start ******************************** ');  
900 - // // headers.forEach((v,k)=>{  
901 - // // Logger.debug("TAG", 'getCommonHeaders header: ' + k + ': ' + v);  
902 - // // })  
903 - // // Logger.debug("TAG", '******************* commonHeaders headers end ******************************** ');  
904 - // return headers;  
905 - // }  
906 -  
907 - public static setUserId(userId: string) {  
908 - HttpUrlUtils.userId = userId;  
909 - }  
910 -  
911 - public static setUserType(userType: string) {  
912 - HttpUrlUtils.userType = userType;  
913 - }  
914 -  
915 - public static setUserToken(token: string) {  
916 - HttpUrlUtils.token = token; 672 + // 人民号号主推荐
  673 + static getRmhRecommendUrl() {
  674 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.RMH_RECOMMEND_DATA_PATH;
  675 + return url;
  676 + }
  677 +
  678 + // 关注号主发布内容接口
  679 + static getAttentionContentListUrl() {
  680 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.ATTENTION_CONTENT_LIST_DATA_PATH;
  681 + return url;
917 } 682 }
  683 +
  684 + // 一键关注接口
  685 + static getAttentionBatchUrl() {
  686 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.ATTENTION_BATCH_DATA_PATH;
  687 + return url;
  688 + }
  689 +
918 } 690 }
1 -// import { ResponseLogin } from '../bean/account/ResponseLogin';  
2 -import { Logger } from 'wdKit';  
3 -  
4 -// import { UserInfo } from '../bean/account/UserInfo';  
5 -// import { ConfigConstants } from '../constants/ConfigConstants';  
6 -// import { AccountManagerUtils } from './AccountManagerUtils';  
7 -// import { AppUtils } from './AppUtils';  
8 -// import { DeviceUtil } from './DeviceUtil';  
9 -// import { Logger } from './Logger';  
10 -// import { StringUtils } from './StringUtils'; 1 +import { SpConstants } from 'wdConstant/Index';
  2 +import { DeviceUtil, SPHelper, StringUtils } from 'wdKit/Index';
  3 +import { HttpRequest } from '../http/HttpRequest';
11 4
12 const TAG: string = '[HttpUtils]' 5 const TAG: string = '[HttpUtils]'
13 6
  7 +/**
  8 + * http相关工具类,对外暴露
  9 + */
14 export class HttpUtils { 10 export class HttpUtils {
15 - static buildHeaders(): Record<string, string> {  
16 - let timestamp: number = new Date().getTime(); // 单位毫秒  
17 - // let clientId = DeviceUtil.clientId() 11 + static getRefreshToken() {
  12 + let refreshToken = SPHelper.default.getSync(SpConstants.USER_REFRESH_TOKEN, "")
  13 + if (StringUtils.isNotEmpty(refreshToken)) {
  14 + return refreshToken as string;
  15 + }
  16 + return '';
  17 + }
18 18
19 - let headers: Record<string, string> = {};  
20 - // 通用请求头  
21 - headers["version"] = 'V3';  
22 - // headers["appId"] = ConfigConstants.appId; // 应用id  
23 - // headers["terminalId"] = ConfigConstants.terminalId; // 终端ID  
24 - // headers["sourceId"] = ConfigConstants.sourceId; // 咪咕视频  
25 - // headers["appType"] = ConfigConstants.appType; // 手机客户端App(安卓)  
26 - // headers["clientType"] = ConfigConstants.clientType; // 客户端类型  
27 - // headers["appVersion"] = AppUtils.getAppVersionCode() + ''; // 客户端版本号:2600010500  
28 - // headers["APP-VERSION-CODE"] = AppUtils.getAppVersionCode() + ''; // APP版本号:250006577  
29 - // headers["appVersionName"] = AppUtils.getAppVersionName() // app对外显示版本: '6.1.5.00'  
30 - // headers["appCode"] = ConfigConstants.appCode; // 应用编码:产品_渠道_应用的拼接串,用下划线_ 拼接而成  
31 - // headers["ptvCode"] = ConfigConstants.ptvCode; // 基线版本号_应用版本号 todo:  
32 - // headers["clientProvinceCode"] = ''; // 客户端分省号 // 02  
33 - // headers["provinceCode"] = ''; // 客户端分省号 // 02  
34 - // headers["clientCityId"] = ''; // 客户端城市ID // 0210  
35 - // headers["carrierCode"] = ''; // 运营商信息 19 + /**
  20 + * 设备id,uuid
  21 + */
  22 + public static getDeviceId(): string {
  23 + return DeviceUtil.clientId();
  24 + }
36 25
37 - // 设备信息请求头  
38 - // headers["User-Agent"] = ''; // 终端UA,自动获取  
39 - headers["Content-Type"] = 'application/json;charset=UTF-8'; // 返回/响应的HTTP内容类型  
40 - headers["os"] = 'android'; // 操作系统类型:鸿蒙、安卓或iOS  
41 - // headers["osInfo"] = 'AD'; // 操作系统信息  
42 - headers["Phone-Info"] = 'HUAWEI'; // 手机信息: todo  
43 - // headers["oaid"] = ''; // 开放匿名设备ID,是中国移动安全联盟(MSA)发起并制定标准用户识别ID  
44 - headers["networkInfo"] = 'WIFI'; // 网络类型: todo  
45 - headers["cache-control"] = 'no-cache'; // 请求和响应遵循的缓存机制  
46 - // headers["clientId"] = clientId; // 客户端编号:客户端初始化时生成的客户端ID,保证唯一性  
47 - headers["imei"] = 'd1de6d3ae0db44bea1b3f0e20a14d90a'; // 终端手机序列号: todo  
48 - headers["X-UP-CLIENT-CHANNEL-ID"] = '2600010500-99000-101700010130012'; // 客户端渠道ID: todo  
49 - headers["channelCode"] = 'VIDEO_APPMAIL'; // 渠道编码  
50 - // headers["l_c"] = clientId; // 客户端id,同clientId  
51 - // headers["l_t"] = timestamp + ''; // 本机时间戳  
52 - // headers["l_s"] = ''; // l_c和l_t拼接后的MD5校验 26 + /**
  27 + * 定位,城市code
  28 + */
  29 + public static getCityCode(): string {
  30 + // 城市编码
  31 + return SPHelper.default.getSync(SpConstants.LOCATION_CITY_CODE, '') as string
  32 + }
53 33
54 - // 签名相关请求头  
55 - headers["timeStamp"] = timestamp + ''; // 服务端时间戳(毫秒):1701667763664  
56 - headers["signType"] = 'RSA'; // 签名类型,固定RSA 34 + /**
  35 + * 定位,省份code
  36 + */
  37 + public static getProvinceCode(): string {
  38 + return SPHelper.default.getSync(SpConstants.LOCATION_PROVINCE_CODE, '') as string
  39 + }
57 40
58 - // 业务请求头  
59 - // headers["promotionID"] = '54b0f421-a6df-41d3-9be2-92820b2c5d8c'; // 促销Id todo  
60 - // headers["tenantId"] = ''; // 租户Id 41 + /**
  42 + * 定位,地区code
  43 + */
  44 + public static getDistrictCode(): string {
  45 + let districtCode = SPHelper.default.getSync(SpConstants.LOCATION_DISTRICT_CODE, '') as string
  46 + if (districtCode === '') {
  47 + return districtCode
  48 + }
  49 + // 截取前6位,如返回310115114,需要310115 (上海浦东)
  50 + return districtCode.substring(0, 6);
  51 + }
61 52
62 - // 添加其他header  
63 - // headers["sdkCeId"] = '27fb3129-5a54-45bc-8af1-7dc8f1155501'; // 用户中台老接口定义的ID,保持不变,现网:咪咕视频Android版,27fb3129-5a54-45bc-8af1-7dc8f1155501 todo  
64 - headers["support-pendant"] = '1'; // 挂件标识, "1":客户端支持挂件节目结构;非"1":不支持挂件节目结构-展示通用对象  
65 - Logger.info(TAG, "buildHeader headers:" + JSON.stringify(headers));  
66 - return headers; 53 + public static getImei(): string {
  54 + return DeviceUtil.clientId();
67 } 55 }
68 -}  
69 56
70 -// export default new HttpUtils() 57 + public static getUserId(): string {
  58 + return SPHelper.default.getSync(SpConstants.USER_ID, "") as string
  59 + }
  60 +
  61 + public static getUserType(): string {
  62 + return SPHelper.default.getSync(SpConstants.USER_Type, "") as string
  63 + }
  64 +
  65 + static getUserToken(): string {
  66 + return SPHelper.default.getSync(SpConstants.USER_JWT_TOKEN, "") as string
  67 + }
  68 +
  69 + public static isLogin(): boolean {
  70 + let token = HttpUtils.getUserToken()
  71 + if (token == null || token == undefined || token.length <= 0) {
  72 + return false
  73 + }
  74 + return true
  75 + }
  76 +}
@@ -5,3 +5,5 @@ export { WDRouterPage } from './src/main/ets/router/WDRouterPage' @@ -5,3 +5,5 @@ export { WDRouterPage } from './src/main/ets/router/WDRouterPage'
5 export { registerRouter } from './src/main/ets/router/Action2Page' 5 export { registerRouter } from './src/main/ets/router/Action2Page'
6 6
7 export { ProcessUtils } from './src/main/ets/utils/ProcessUtils' 7 export { ProcessUtils } from './src/main/ets/utils/ProcessUtils'
  8 +
  9 +export { RouterJumpInterceptor, JumpInterceptorAction } from './src/main/ets/router/RouterJumpInterceptor'
  1 +import { WDRouterPage } from './WDRouterPage';
  2 +
  3 +export interface JumpInterceptorAction {
  4 + on(params?: object, singleMode?: boolean): boolean
  5 +}
  6 +
  7 +// TODO:待优化
  8 +// 临时解决跳转页面之前方法拦截,比如登录先走一键登录,直播请求接口等
  9 +//
  10 +export class RouterJumpInterceptor {
  11 +
  12 + private static actions: Record<string, JumpInterceptorAction> = {}
  13 +
  14 + static getInterceptorAction(jumpPage: WDRouterPage): JumpInterceptorAction | undefined {
  15 + return RouterJumpInterceptor.actions[jumpPage.url()]
  16 + }
  17 +
  18 + static register(jumpPage: WDRouterPage, interceptorAction: JumpInterceptorAction) {
  19 + RouterJumpInterceptor.actions[jumpPage.url()] = interceptorAction
  20 + }
  21 +
  22 +
  23 +}
@@ -66,6 +66,7 @@ export class WDRouterPage { @@ -66,6 +66,7 @@ export class WDRouterPage {
66 // 动态详情页 66 // 动态详情页
67 static dynamicDetailPage = new WDRouterPage("phone", "ets/pages/detail/DynamicDetailPage"); 67 static dynamicDetailPage = new WDRouterPage("phone", "ets/pages/detail/DynamicDetailPage");
68 static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); 68 static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage");
  69 + static oneKeyLoginPage = new WDRouterPage("wdLogin", "ets/pages/login/OneKeyLoginPage");
69 static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); 70 static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage");
70 //我的 预约 71 //我的 预约
71 static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage"); 72 static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage");
@@ -124,4 +125,6 @@ export class WDRouterPage { @@ -124,4 +125,6 @@ export class WDRouterPage {
124 static themeListPage = new WDRouterPage("wdComponent", "ets/components/page/ThemeListPage"); 125 static themeListPage = new WDRouterPage("wdComponent", "ets/components/page/ThemeListPage");
125 // 栏目页面、频道详情 126 // 栏目页面、频道详情
126 static columnPage = new WDRouterPage("phone", "ets/pages/column/ColumnPage"); 127 static columnPage = new WDRouterPage("phone", "ets/pages/column/ColumnPage");
  128 + //展示头像
  129 + static showUserHeaderPage = new WDRouterPage("wdComponent", "ets/pages/ShowUserHeaderPage");
127 } 130 }
@@ -3,6 +3,7 @@ import { Action } from 'wdBean' @@ -3,6 +3,7 @@ import { Action } from 'wdBean'
3 import { ToastUtils } from 'wdKit' 3 import { ToastUtils } from 'wdKit'
4 import { Action2Page } from './Action2Page' 4 import { Action2Page } from './Action2Page'
5 import { WDRouterPage } from './WDRouterPage' 5 import { WDRouterPage } from './WDRouterPage'
  6 +import { RouterJumpInterceptor } from './RouterJumpInterceptor'
6 7
7 export class WDRouterRule { 8 export class WDRouterRule {
8 static jumpWithAction(action?: Action) { 9 static jumpWithAction(action?: Action) {
@@ -16,6 +17,11 @@ export class WDRouterRule { @@ -16,6 +17,11 @@ export class WDRouterRule {
16 17
17 static jumpWithPage(page?: WDRouterPage, params?: object, singleMode?: boolean) { 18 static jumpWithPage(page?: WDRouterPage, params?: object, singleMode?: boolean) {
18 if (page) { 19 if (page) {
  20 + let action = RouterJumpInterceptor.getInterceptorAction(page)
  21 + if (action && action.on(params, singleMode)) {
  22 + return
  23 + }
  24 +
19 let mode = router.RouterMode.Standard 25 let mode = router.RouterMode.Standard
20 if (singleMode) { 26 if (singleMode) {
21 mode = router.RouterMode.Single 27 mode = router.RouterMode.Single
@@ -36,6 +42,10 @@ export class WDRouterRule { @@ -36,6 +42,10 @@ export class WDRouterRule {
36 42
37 static jumpWithReplacePage(page?: WDRouterPage, params?: object) { 43 static jumpWithReplacePage(page?: WDRouterPage, params?: object) {
38 if (page) { 44 if (page) {
  45 + let action = RouterJumpInterceptor.getInterceptorAction(page)
  46 + if (action && action.on(params)) {
  47 + return
  48 + }
39 if (params) { 49 if (params) {
40 // router.pushUrl({ url: 'pages/routerpage2', , params: params }) 50 // router.pushUrl({ url: 'pages/routerpage2', , params: params })
41 router.replaceUrl({ url: page.url(), params: params }) 51 router.replaceUrl({ url: page.url(), params: params })
@@ -17,7 +17,7 @@ const TAG = 'ProcessUtils'; @@ -17,7 +17,7 @@ const TAG = 'ProcessUtils';
17 */ 17 */
18 export class ProcessUtils { 18 export class ProcessUtils {
19 /** 19 /**
20 - * 广告中心的业务广告跳转方法( 现用在挂角广告) 20 + * 广告中心的业务广告跳转方法( 现用在挂角广告、信息流页面广告
21 * @param advContent 21 * @param advContent
22 */ 22 */
23 static openAdvDetail(matInfo: CompAdvMatInfoBean) { 23 static openAdvDetail(matInfo: CompAdvMatInfoBean) {
@@ -157,13 +157,14 @@ export class ProcessUtils { @@ -157,13 +157,14 @@ export class ProcessUtils {
157 * 图集详情页 157 * 图集详情页
158 * @param content 158 * @param content
159 * */ 159 * */
160 - public static gotoMultiPictureListPage(photoList: PhotoListBean[]) { 160 + public static gotoMultiPictureListPage(photoList: PhotoListBean[], swiperIndex?: number) {
161 let taskAction: Action = { 161 let taskAction: Action = {
162 type: 'JUMP_DETAIL_PAGE', 162 type: 'JUMP_DETAIL_PAGE',
163 params: { 163 params: {
164 detailPageType: 18, 164 detailPageType: 18,
165 extra: { 165 extra: {
166 - photoList 166 + photoList,
  167 + swiperIndex
167 } as ExtraDTO 168 } as ExtraDTO
168 } as Params, 169 } as Params,
169 }; 170 };
@@ -186,8 +187,14 @@ export class ProcessUtils { @@ -186,8 +187,14 @@ export class ProcessUtils {
186 let taskAction: Action = { 187 let taskAction: Action = {
187 type: 'JUMP_INNER_NEW_PAGE', 188 type: 'JUMP_INNER_NEW_PAGE',
188 params: { 189 params: {
  190 + contentID: content?.objectId,
189 url: content.linkUrl, 191 url: content.linkUrl,
190 pageID: 'SPACIAL_TOPIC_PAGE', 192 pageID: 'SPACIAL_TOPIC_PAGE',
  193 + extra: {
  194 + relType: content?.relType,
  195 + relId: content?.relId,
  196 + channelId: content?.channelId,
  197 + } as ExtraDTO
191 } as Params, 198 } as Params,
192 }; 199 };
193 WDRouterRule.jumpWithAction(taskAction) 200 WDRouterRule.jumpWithAction(taskAction)
@@ -422,11 +429,10 @@ export class ProcessUtils { @@ -422,11 +429,10 @@ export class ProcessUtils {
422 429
423 /** 430 /**
424 * 跳转人民号主页 431 * 跳转人民号主页
425 - *@params creatorId 创作者id 432 + * @params creatorId 创作者id
426 */ 433 */
427 public static gotoPeopleShipHomePage(creatorId: string) { 434 public static gotoPeopleShipHomePage(creatorId: string) {
428 - let params = {'creatorId': creatorId} as Record<string, string>; 435 + let params = { 'creatorId': creatorId } as Record<string, string>;
429 WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) 436 WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
430 } 437 }
431 -  
432 } 438 }
  1 +/node_modules
  2 +/oh_modules
  3 +/.preview
  4 +/build
  5 +/.cxx
  6 +/.test
  1 +export { WDShareObject, WDShareBase } from "./src/main/ets/WDShareBase"
  2 +
  3 +export { ShareContent, ShareScene, ShareType } from "./src/main/ets/Constant"
  1 +{
  2 + "apiType": "stageMode",
  3 + "buildOption": {
  4 + },
  5 + "buildOptionSet": [
  6 + {
  7 + "name": "release",
  8 + "arkOptions": {
  9 + "obfuscation": {
  10 + "ruleOptions": {
  11 + "enable": true,
  12 + "files": [
  13 + "./obfuscation-rules.txt"
  14 + ]
  15 + }
  16 + }
  17 + },
  18 + },
  19 + ],
  20 + "targets": [
  21 + {
  22 + "name": "default"
  23 + }
  24 + ]
  25 +}
  1 +import { hspTasks } from '@ohos/hvigor-ohos-plugin';
  2 +
  3 +export default {
  4 + system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
  5 + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
  6 +}
  1 +# Define project specific obfuscation rules here.
  2 +# You can include the obfuscation configuration files in the current module's build-profile.json5.
  3 +#
  4 +# For more details, see
  5 +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md
  6 +
  7 +# Obfuscation options:
  8 +# -disable-obfuscation: disable all obfuscations
  9 +# -enable-property-obfuscation: obfuscate the property names
  10 +# -enable-toplevel-obfuscation: obfuscate the names in the global scope
  11 +# -compact: remove unnecessary blank spaces and all line feeds
  12 +# -remove-log: remove all console.* statements
  13 +# -print-namecache: print the name cache that contains the mapping from the old names to new names
  14 +# -apply-namecache: reuse the given cache file
  15 +
  16 +# Keep options:
  17 +# -keep-property-name: specifies property names that you want to keep
  18 +# -keep-global-name: specifies names that you want to keep in the global scope
  1 +{
  2 + "name": "wdsharebase",
  3 + "version": "1.0.0",
  4 + "description": "Please describe the basic information.",
  5 + "main": "Index.ets",
  6 + "author": "",
  7 + "license": "Apache-2.0",
  8 + "packageType": "InterfaceHar",
  9 + "dependencies": {
  10 + }
  11 +}
  1 +
  2 +export const enum ShareType {
  3 + System = 0,
  4 + WeChat,
  5 + QQ,
  6 + Weibo,
  7 +
  8 +}
  9 +
  10 +export const enum ShareScene {
  11 + System = 0,
  12 +
  13 + WeChatSession,
  14 + WeChatTimeline,
  15 +
  16 + QQFriend,
  17 + QQZone,
  18 +
  19 + Weibo,
  20 +}
  21 +
  22 +export const enum ShareContentType {
  23 + PrueText = 1,
  24 + ImageAndText,
  25 + Link,
  26 +}
  27 +
  28 +export interface ShareContentText {
  29 + text: string
  30 +}
  31 +export interface ShareContentImageAndText {
  32 + title: string
  33 + desc?: string
  34 + imgURI: string
  35 +
  36 +}
  37 +export interface ShareContentLink {
  38 + title: string
  39 + desc?: string
  40 + link: string
  41 + icon?: string
  42 +}
  43 +
  44 +export type ShareContent = ShareContentText | ShareContentImageAndText | ShareContentLink
  1 +import { ShareContent, ShareContentImageAndText, ShareContentLink, ShareContentText,
  2 + ShareContentType,
  3 + ShareScene } from '../Constant';
  4 +import { WDShareInterface } from '../WDShareInterface';
  5 +import { AsyncCallback } from '@kit.BasicServicesKit';
  6 +import { common } from '@kit.AbilityKit';
  7 +import { systemShare } from '@kit.ShareKit';
  8 +import { uniformTypeDescriptor as utd } from '@kit.ArkData';
  9 +
  10 +export class WDSystemShare implements WDShareInterface {
  11 +
  12 + shareContent(scene: ShareScene, content: ShareContent, contentType: ShareContentType): Promise<string> {
  13 +
  14 + return new Promise((resolve, fail) => {
  15 + try {
  16 +
  17 + let controller: systemShare.ShareController = new systemShare.ShareController(this.getShareData(content, contentType));
  18 + let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext
  19 +
  20 + controller.on('dismiss', () => {
  21 +
  22 + resolve("dismiss")
  23 + });
  24 +
  25 + controller.show(context, {
  26 + previewMode: systemShare.SharePreviewMode.DEFAULT,
  27 + selectionMode: systemShare.SelectionMode.SINGLE
  28 + });
  29 +
  30 + console.log("分享控制器调用完成")
  31 + } catch (e) {
  32 + fail(e)
  33 + }
  34 + })
  35 + }
  36 +
  37 + getShareData(content: ShareContent, contentType: ShareContentType) : systemShare.SharedData {
  38 + if (contentType === ShareContentType.PrueText) {
  39 + let prueText = content as ShareContentText
  40 + console.log("分享纯文本")
  41 + return new systemShare.SharedData({
  42 + utd: utd.UniformDataType.PLAIN_TEXT,
  43 + content: prueText.text
  44 + });
  45 + }
  46 +
  47 + if (contentType === ShareContentType.ImageAndText) {
  48 + let imageAndText = content as ShareContentImageAndText
  49 + console.log("分享图片和文本")
  50 + let data: systemShare.SharedData = new systemShare.SharedData({
  51 + utd: utd.UniformDataType.PLAIN_TEXT,
  52 + content: imageAndText.title
  53 + });
  54 + data.addRecord({
  55 + utd: utd.UniformDataType.PNG,
  56 + uri: imageAndText.imgURI
  57 + });
  58 + return data
  59 + }
  60 +
  61 + console.log("分享链接和文本")
  62 + let link = content as ShareContentLink
  63 + let data: systemShare.SharedData = new systemShare.SharedData({
  64 + utd: utd.UniformDataType.PLAIN_TEXT,
  65 + content: link.title
  66 + });
  67 + data.addRecord({
  68 + utd: utd.UniformDataType.HYPERLINK,
  69 + uri: link.link
  70 + });
  71 + return data
  72 + }
  73 +
  74 +
  75 +}
  1 +import { ShareContent, ShareContentType, ShareScene, ShareType } from './Constant'
  2 +import { HashMap } from '@kit.ArkTS'
  3 +import { WDShareInterface } from './WDShareInterface'
  4 +import { WDSystemShare } from './System/WDSystemShare'
  5 +
  6 +export interface WDShareObject {
  7 + to: ShareType,
  8 + scene: ShareScene,
  9 + type: ShareContentType,
  10 + obj: ShareContent
  11 +}
  12 +
  13 +export class WDShareBase {
  14 +
  15 + private static instance?: WDShareBase
  16 + static getInstance() : WDShareBase {
  17 + if (!WDShareBase.instance) {
  18 + WDShareBase.instance = new WDShareBase()
  19 + WDShareBase.instance.register()
  20 + }
  21 + return WDShareBase.instance
  22 + }
  23 +
  24 + private handles: HashMap<ShareType, WDShareInterface> = new HashMap()
  25 +
  26 + register() {
  27 + this.handles.set(ShareType.System, new WDSystemShare())
  28 + }
  29 +
  30 + share(obj: WDShareObject) : null | Promise<string> {
  31 + let shareHandler: WDShareInterface = this.handles.get(obj.to)
  32 + if (shareHandler) {
  33 + return shareHandler.shareContent(obj.scene, obj.obj, obj.type)
  34 + }
  35 + return null
  36 + }
  37 +
  38 +
  39 +
  40 +
  41 +}
  1 +import { ShareContent, ShareContentType, ShareScene } from './Constant'
  2 +import { AsyncCallback } from '@kit.BasicServicesKit'
  3 +
  4 +export interface WDShareInterface {
  5 + // shareContent(scene:ShareScene, content: ShareContent, callback: AsyncCallback<void>): void
  6 + shareContent(scene:ShareScene, content: ShareContent, contentType: ShareContentType): Promise<string>
  7 +
  8 +
  9 +
  10 +}
  1 +@Entry
  2 +@Component
  3 +struct IndexPage {
  4 + @State message: string = 'Hello World';
  5 +
  6 + build() {
  7 + Row() {
  8 + Column() {
  9 + Text(this.message)
  10 + .fontSize(50)
  11 + .fontWeight(FontWeight.Bold)
  12 + }
  13 + .width('100%')
  14 + }
  15 + .height('100%')
  16 + }
  17 +}
  1 +{
  2 + "module": {
  3 + "name": "wdShareBase",
  4 + "type": "shared",
  5 + "description": "$string:shared_desc",
  6 + "deviceTypes": [
  7 + "phone",
  8 + "tablet",
  9 + "2in1"
  10 + ],
  11 + "deliveryWithInstall": true,
  12 + "pages": "$profile:main_pages"
  13 + }
  14 +}
  1 +{
  2 + "color": [
  3 + {
  4 + "name": "white",
  5 + "value": "#FFFFFF"
  6 + }
  7 + ]
  8 +}
  1 +{
  2 + "string": [
  3 + {
  4 + "name": "shared_desc",
  5 + "value": "description"
  6 + }
  7 + ]
  8 +}
  1 +{
  2 + "src": [
  3 + "pages/IndexPage"
  4 + ]
  5 +}
  1 +import localUnitTest from './LocalUnit.test';
  2 +
  3 +export default function testsuite() {
  4 + localUnitTest();
  5 +}
  1 +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
  2 +
  3 +export default function localUnitTest() {
  4 + describe('localUnitTest',() => {
  5 + // Defines a test suite. Two parameters are supported: test suite name and test suite function.
  6 + beforeAll(() => {
  7 + // Presets an action, which is performed only once before all test cases of the test suite start.
  8 + // This API supports only one parameter: preset action function.
  9 + });
  10 + beforeEach(() => {
  11 + // Presets an action, which is performed before each unit test case starts.
  12 + // The number of execution times is the same as the number of test cases defined by **it**.
  13 + // This API supports only one parameter: preset action function.
  14 + });
  15 + afterEach(() => {
  16 + // Presets a clear action, which is performed after each unit test case ends.
  17 + // The number of execution times is the same as the number of test cases defined by **it**.
  18 + // This API supports only one parameter: clear action function.
  19 + });
  20 + afterAll(() => {
  21 + // Presets a clear action, which is performed after all test cases of the test suite end.
  22 + // This API supports only one parameter: clear action function.
  23 + });
  24 + it('assertContain', 0, () => {
  25 + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
  26 + let a = 'abc';
  27 + let b = 'b';
  28 + // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
  29 + expect(a).assertContain(b);
  30 + expect(a).assertEqual(a);
  31 + });
  32 + });
  33 +}
1 -import HashMap from '@ohos.util.HashMap';  
2 import { Callback } from 'wdJsBridge'; 1 import { Callback } from 'wdJsBridge';
3 -import { Message } from 'wdJsBridge/src/main/ets/bean/Message';  
4 -import { Logger } from 'wdKit'; 2 +import { Message, IImgListData } from 'wdJsBridge/src/main/ets/bean/Message';
  3 +import { Logger, SPHelper } from 'wdKit';
5 import { H5CallNativeType } from './H5CallNativeType'; 4 import { H5CallNativeType } from './H5CallNativeType';
6 import { H5OperateType } from './H5OperateType'; 5 import { H5OperateType } from './H5OperateType';
7 -import { ContentConstants } from 'wdConstant'; 6 +import { ContentConstants, SpConstants } from 'wdConstant';
8 import { ProcessUtils } from 'wdRouter'; 7 import { ProcessUtils } from 'wdRouter';
9 import router from '@ohos.router'; 8 import router from '@ohos.router';
10 import Url from '@ohos.url' 9 import Url from '@ohos.url'
11 -import { ContentDTO } from 'wdBean/Index';  
12 -import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork'; 10 +import { ContentDTO, PhotoListBean } from 'wdBean';
  11 +import { handleJsCallAppService } from './JsCallAppService'
13 12
14 const TAG = 'JsBridgeBiz' 13 const TAG = 'JsBridgeBiz'
15 14
@@ -20,6 +19,19 @@ class AppInfo { @@ -20,6 +19,19 @@ class AppInfo {
20 // TODO 完善 19 // TODO 完善
21 } 20 }
22 21
  22 +class AppLoginAuthInfo {
  23 + "X-Ca-Stage": string = ''
  24 + userType: number = SPHelper.default.getSync(SpConstants.USER_Type, '') as number
  25 + userName: string = SPHelper.default.getSync(SpConstants.USER_NAME, '') as string
  26 + userID: string = SPHelper.default.getSync(SpConstants.USER_ID, '') as string
  27 + "RMRB-X-TOKEN": string = SPHelper.default.getSync(SpConstants.USER_TEMP_TOKEN, '') as string
  28 + phoneNumber: string = SPHelper.default.getSync(SpConstants.USER_PHONE, '') as string
  29 + nickName: string = ''
  30 + isLogined: string = SPHelper.default.getSync(SpConstants.USER_STATUS, '') as string
  31 + creatorID: string = SPHelper.default.getSync(SpConstants.USER_CREATOR_ID, '') as string
  32 + Authorization: string = ''
  33 +}
  34 +
23 /** 35 /**
24 * h5调用native代码 36 * h5调用native代码
25 * @param data 37 * @param data
@@ -39,7 +51,7 @@ export function performJSCallNative(data: Message, call: Callback) { @@ -39,7 +51,7 @@ export function performJSCallNative(data: Message, call: Callback) {
39 case H5CallNativeType.jsCall_getArticleDetailBussinessData: 51 case H5CallNativeType.jsCall_getArticleDetailBussinessData:
40 break; 52 break;
41 case H5CallNativeType.jsCall_callAppService: 53 case H5CallNativeType.jsCall_callAppService:
42 - handleJsCallCallAppService(data, (res: string) => { 54 + handleJsCallAppService(data, (res: string) => {
43 call(res) 55 call(res)
44 }) 56 })
45 break; 57 break;
@@ -49,6 +61,9 @@ export function performJSCallNative(data: Message, call: Callback) { @@ -49,6 +61,9 @@ export function performJSCallNative(data: Message, call: Callback) {
49 case H5CallNativeType.jsCall_appInnerLinkMethod: 61 case H5CallNativeType.jsCall_appInnerLinkMethod:
50 handleJsCallAppInnerLinkMethod(data) 62 handleJsCallAppInnerLinkMethod(data)
51 break; 63 break;
  64 + case H5CallNativeType.jsCall_getAppLoginAuthInfo:
  65 + call(handleJsCallGetAppLoginAuthInfo())
  66 + break;
52 default: 67 default:
53 break; 68 break;
54 } 69 }
@@ -64,21 +79,6 @@ function handleJsCallCurrentPageOperate(data: Message) { @@ -64,21 +79,6 @@ function handleJsCallCurrentPageOperate(data: Message) {
64 } 79 }
65 } 80 }
66 81
67 -function handleJsCallCallAppService(data: Message, callback: (res: string) => void) {  
68 - let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();  
69 - let url: string = HttpUrlUtils.getHost() + data?.data?.url  
70 - if (data?.data?.method === 'get') {  
71 - WDHttp.get<ResponseDTO<string>>(url, headers).then((res: ResponseDTO<string>) => {  
72 - callback(JSON.stringify(res))  
73 - })  
74 - }  
75 - if (data?.data?.method === 'post') {  
76 - WDHttp.post<ResponseDTO<string>>(url, data?.data?.parameters, headers).then(res => {  
77 - callback(JSON.stringify(res))  
78 - })  
79 - }  
80 -}  
81 -  
82 /** 82 /**
83 * 获取App公共信息 83 * 获取App公共信息
84 */ 84 */
@@ -90,17 +90,31 @@ function getAppPublicInfo(): string { @@ -90,17 +90,31 @@ function getAppPublicInfo(): string {
90 info.networkStatus = 1 90 info.networkStatus = 1
91 let result = JSON.stringify(info) 91 let result = JSON.stringify(info)
92 Logger.debug(TAG, 'getAppPublicInfo: ' + JSON.stringify(info)) 92 Logger.debug(TAG, 'getAppPublicInfo: ' + JSON.stringify(info))
93 -  
94 return result; 93 return result;
95 } 94 }
96 95
97 function handleJsCallReceiveH5Data(data: Message) { 96 function handleJsCallReceiveH5Data(data: Message) {
98 - switch (data?.data?.dataSource) {  
99 - case 5:  
100 - if (data?.data?.dataSource === 5) {  
101 - ProcessUtils.processPage(JSON.parse(data?.data?.dataJson || '{}')) 97 + switch (String(data?.data?.dataSource)) {
  98 + case '3':
  99 + let imgListData: IImgListData = JSON.parse(data?.data?.imgListData || "{}")
  100 + let imgArr = imgListData?.imgArr || []
  101 + let swiperIndex = imgListData?.imgIndex
  102 + if (imgArr.length > 0) {
  103 + const photoList: PhotoListBean[] = imgArr.map(item => {
  104 + const photo: PhotoListBean = {
  105 + width: item.width,
  106 + height: item.height,
  107 + picPath: item.pic,
  108 + picDesc: ''
  109 + }
  110 + return photo
  111 + })
  112 + ProcessUtils.gotoMultiPictureListPage(photoList, swiperIndex)
102 } 113 }
103 break; 114 break;
  115 + case '5':
  116 + ProcessUtils.processPage(JSON.parse(data?.data?.dataJson || '{}'))
  117 + break;
104 default: 118 default:
105 break; 119 break;
106 } 120 }
@@ -168,3 +182,9 @@ function handleJsCallAppInnerLinkMethod(data: Message) { @@ -168,3 +182,9 @@ function handleJsCallAppInnerLinkMethod(data: Message) {
168 } 182 }
169 } 183 }
170 } 184 }
  185 +
  186 +function handleJsCallGetAppLoginAuthInfo() {
  187 + let appLoginAuthInfo = new AppLoginAuthInfo()
  188 + let result = JSON.stringify(appLoginAuthInfo)
  189 + return result;
  190 +}
  1 +import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
  2 +import { H5ReceiveDataJsonBean, postBatchAttentionStatusResult } from 'wdBean';
  3 +import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork';
  4 +
  5 +const TAG = 'JsCallAppService'
  6 +
  7 +
  8 +export function handleJsCallAppService(data: Message, callback: (res: string) => void) {
  9 + let url: string = HttpUrlUtils.getHost() + data?.data?.url
  10 +
  11 + let responseMap: ResponseDTO<postBatchAttentionStatusResult> = {} as ResponseDTO<postBatchAttentionStatusResult>
  12 +
  13 + let h5ReceiveDataJson: H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>> = {
  14 + netError: '0',
  15 + responseMap
  16 + } as H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>>
  17 +
  18 + // if (data?.data?.method === 'get') {
  19 + // WDHttp.get<ResponseDTO<postBatchAttentionStatusResult>>(url, headers).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {
  20 + // callback(JSON.stringify(res))
  21 + // })
  22 + // }
  23 + if (data?.data?.method === 'post' && data?.data?.url === '/api/rmrb-interact/interact/zh/c/batchAttention/status') {
  24 + WDHttp.post<ResponseDTO<postBatchAttentionStatusResult>>(url, data?.data?.parameters).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {
  25 + h5ReceiveDataJson.responseMap = res
  26 + callback(JSON.stringify(h5ReceiveDataJson))
  27 + })
  28 + }
  29 +}
@@ -79,6 +79,7 @@ export struct WdWebLocalComponent { @@ -79,6 +79,7 @@ export struct WdWebLocalComponent {
79 if (this.videoUrl) { 79 if (this.videoUrl) {
80 Video({ src: this.videoUrl }) 80 Video({ src: this.videoUrl })
81 .autoPlay(true) 81 .autoPlay(true)
  82 + .objectFit(ImageFit.Contain)
82 .width(this.positionWidth) 83 .width(this.positionWidth)
83 .height(this.positionHeight) 84 .height(this.positionHeight)
84 .borderRadius(5) 85 .borderRadius(5)
This file is too large to display.
@@ -153,3 +153,15 @@ export { @@ -153,3 +153,15 @@ export {
153 UserExtend 153 UserExtend
154 } from './src/main/ets/bean/user/UserDetail'; 154 } from './src/main/ets/bean/user/UserDetail';
155 155
  156 +export {
  157 + RmhRecommendDTO
  158 +} from './src/main/ets/bean/peoples/RmhRecommendDTO';
  159 +
  160 +export {
  161 + PeopleShipContentListDTO
  162 +} from './src/main/ets/bean/peoples/PeopleShipContentListDTO';
  163 +
  164 +export {
  165 + AttentionBatchDTO,
  166 + CreatorDTO
  167 +} from './src/main/ets/bean/peoples/AttentionBatchDTO';
  1 +/**
  2 + * @Description: 广告扩展信息的解析模型
  3 + * @Author:
  4 + * @Email: liyubing@wondertek.com.cn
  5 + * @CreateDate:
  6 + * @UpdateRemark: 更新说明
  7 + * @Version: 1.0
  8 + */
  9 +export interface AdvExtraData {
  10 +
  11 +
  12 + itemTopImage: string;
  13 + itemMore: AdvExtraItemData;
  14 + item: AdvExtraItemData[]
  15 +
  16 +}
  17 +
  18 +export interface AdvExtraItemData {
  19 +/**
  20 + * 图片地址
  21 + */
  22 + image: string;
  23 + /**
  24 + * 标题
  25 + */
  26 + title: string ;
  27 + /**
  28 + * 跳转地址
  29 + */
  30 + linkUrl: string;
  31 + /**
  32 + * 跳转类型
  33 + */
  34 + linkType: string;
  35 +
  36 +}
@@ -15,5 +15,6 @@ export interface ExtraDTO extends ItemDTO { @@ -15,5 +15,6 @@ export interface ExtraDTO extends ItemDTO {
15 relType: string; 15 relType: string;
16 liveStreamType?: number; 16 liveStreamType?: number;
17 photoList: PhotoListBean[]; 17 photoList: PhotoListBean[];
  18 + swiperIndex?: number
18 commentId?: string; 19 commentId?: string;
19 } 20 }
@@ -2,11 +2,11 @@ @@ -2,11 +2,11 @@
2 * 批查接口查询互动相关数据,返回数据bean 2 * 批查接口查询互动相关数据,返回数据bean
3 */ 3 */
4 export interface InteractDataDTO { 4 export interface InteractDataDTO {
5 - collectNum: number | String;  
6 - commentNum: number | String; 5 + collectNum: number | string;
  6 + commentNum: number | string;
7 contentId: string; 7 contentId: string;
8 contentType: number; 8 contentType: number;
9 - likeNum: number | String; 9 + likeNum: number | string;
10 readNum: number; 10 readNum: number;
11 shareNum: number; 11 shareNum: number;
12 } 12 }
@@ -8,4 +8,5 @@ export interface commentInfo { @@ -8,4 +8,5 @@ export interface commentInfo {
8 newsId: string, 8 newsId: string,
9 relId: string; 9 relId: string;
10 relType: string; 10 relType: string;
  11 + userId: string;
11 } 12 }
1 export interface UserInfoDTO { 1 export interface UserInfoDTO {
2 - userHeadUrl:string 2 + userHeadUrl: string
  3 + userName?: string
  4 + headPhotoUrl?: string
3 } 5 }
1 export interface H5ReceiveDataExtraBean { 1 export interface H5ReceiveDataExtraBean {
2 creatorId: string; 2 creatorId: string;
  3 + cnsTraceId: string;
3 isLogin: string; 4 isLogin: string;
  5 + loadImageOnlyWifiSwitch: string;
4 networkStatus: number; 6 networkStatus: number;
5 - loadImageOnlyWifiSwitch: string 7 + darkMode: string;
  8 + fontSizes: string;
6 } 9 }
1 import { ResponseBean } from './ResponseBean'; 1 import { ResponseBean } from './ResponseBean';
2 2
3 -export interface H5ReceiveDataJsonBean {  
4 - contentId: string;  
5 - contentType: string;  
6 - topicId: string;  
7 - channelId: string;  
8 - compId: string;  
9 - sourcePage: string; 3 +export interface H5ReceiveDataJsonBean<T = ResponseBean> {
  4 + contentId?: string;
  5 + contentType?: string;
  6 + topicId?: string;
  7 + channelId?: string;
  8 + compId?: string;
  9 + sourcePage?: string;
10 netError: string; 10 netError: string;
11 - responseMap: ResponseBean; 11 + responseMap: T;
12 12
13 } 13 }
1 import { ContentDetailDTO } from '../detail/ContentDetailDTO'; 1 import { ContentDetailDTO } from '../detail/ContentDetailDTO';
2 2
3 -export interface ResponseBean{  
4 - success:boolean; 3 +export interface ResponseBean<T = ContentDetailDTO[]> {
  4 + success: boolean;
5 5
6 // 服务请求响应值/微服务响应状态码” 6 // 服务请求响应值/微服务响应状态码”
7 code: number; 7 code: number;
@@ -10,8 +10,7 @@ export interface ResponseBean{ @@ -10,8 +10,7 @@ export interface ResponseBean{
10 message: string; 10 message: string;
11 11
12 // 响应结果 12 // 响应结果
13 - data:ContentDetailDTO[];  
14 - 13 + data: T
15 // 请求响应时间戳(unix格式) 14 // 请求响应时间戳(unix格式)
16 timestamp?: number; 15 timestamp?: number;
17 } 16 }
@@ -159,7 +159,7 @@ export interface LiveDetailsBean { @@ -159,7 +159,7 @@ export interface LiveDetailsBean {
159 } 159 }
160 */ 160 */
161 liveInfo: LiveInfo 161 liveInfo: LiveInfo
162 - fullColumnImgUrls: Array<FullColumnImgUrls> 162 + fullColumnImgUrls: Array<FullColumnImgUrlBean>
163 newsTitle: string 163 newsTitle: string
164 newsId: string 164 newsId: string
165 newIntroduction: string 165 newIntroduction: string
@@ -186,8 +186,12 @@ export interface MLive { @@ -186,8 +186,12 @@ export interface MLive {
186 mliveId: string 186 mliveId: string
187 } 187 }
188 188
189 -export interface FullColumnImgUrls { 189 +export interface FullColumnImgUrlBean {
190 url: string 190 url: string
  191 + height: string
  192 + landscape: number
  193 + size: string
  194 + weight: string
191 } 195 }
192 196
193 export interface Vlive { 197 export interface Vlive {
  1 +import { FullColumnImgUrlBean } from './LiveDetailsBean'
  2 +
1 export interface LiveRoomBean { 3 export interface LiveRoomBean {
2 pageNum: number 4 pageNum: number
3 pageSize: number 5 pageSize: number
@@ -15,6 +17,7 @@ export interface LiveRoomItemBean { @@ -15,6 +17,7 @@ export interface LiveRoomItemBean {
15 isWall: number 17 isWall: number
16 //是否置顶 1置顶0不置顶 18 //是否置顶 1置顶0不置顶
17 isTop: number 19 isTop: number
  20 + //guest :嘉宾,host:主持人
18 role: string 21 role: string
19 //ZH_TEXT_AND_IMAGE_MSG :图文,ZH_TEXT_MSG:文本,ZH_VIDEO_MSG:视频,ZH_AUDIO_MSG:音频 22 //ZH_TEXT_AND_IMAGE_MSG :图文,ZH_TEXT_MSG:文本,ZH_VIDEO_MSG:视频,ZH_AUDIO_MSG:音频
20 dataType: string 23 dataType: string
@@ -28,5 +31,7 @@ export interface LiveRoomItemBean { @@ -28,5 +31,7 @@ export interface LiveRoomItemBean {
28 duration: number 31 duration: number
29 //音频地址 32 //音频地址
30 audioUrl: string 33 audioUrl: string
  34 + //详情页面插入数据bean
  35 + fullColumnImgUrlDto: FullColumnImgUrlBean
31 36
32 } 37 }
@@ -4,37 +4,39 @@ import { TopNavDTO } from './TopNavDTO'; @@ -4,37 +4,39 @@ import { TopNavDTO } from './TopNavDTO';
4 * 底导(包含顶导列表)数据 4 * 底导(包含顶导列表)数据
5 */ 5 */
6 export interface BottomNavDTO { 6 export interface BottomNavDTO {
7 - backgroundUrl: string;  
8 - channelChooseActionUrl: string;  
9 - channelChooseCColor: string;  
10 - channelChooseColor: string;  
11 - channelMoreColor: string; 7 + backgroundUrl: string; // 迭代四:页面背景图
  8 + channelChooseActionUrl: string; // 迭代四:频道选中下划线动画
  9 + channelChooseCColor: string; // 迭代四:频道未选中颜色
  10 + channelChooseColor: string; // 迭代四:频道选中颜色
  11 + channelMoreColor: string; // 迭代四:更多频道颜色
12 extraData: string; 12 extraData: string;
13 - homePageColor: string;  
14 - icon: string;  
15 - iconC: string; 13 + homePageColor: string; // 迭代四:主页图标/文字颜色
  14 + icon: string; // 未选中图标
  15 + iconC: string; // 选中图标
16 id: number; 16 id: number;
17 - immersiveIconCUrl: string;  
18 - immersiveIconUrl: string;  
19 - immersiveNameCColor: string;  
20 - immersiveNameColor: string;  
21 - logoUrl: string; 17 + immersiveIconCUrl: string; // 迭代二新增-图标颜色-选中(沉浸式频道)
  18 + immersiveIconUrl: string; // 迭代二新增-图标颜色-未选中(沉浸式频道)
  19 + immersiveNameCColor: string; // 迭代二新增-文字颜色-选中(沉浸式频道)
  20 + immersiveNameColor: string; // 迭代二新增-文字颜色-未选中(沉浸式频道)
  21 + logoUrl: string; // 迭代四:logo图片
22 morningAndEveningUrl: string; 22 morningAndEveningUrl: string;
23 name: string; 23 name: string;
24 - nameCColor: string;  
25 - nameColor: string;  
26 - nightIconCUrl: string;  
27 - nightIconUrl: string;  
28 - nightNameCColor: string;  
29 - nightNameColor: string;  
30 - noticeColor: string; 24 + nameCColor: string; // 名字选中颜色
  25 + nameColor: string; // 名字颜色
  26 + nightIconCUrl: string; // 迭代三新增-图标颜色-选中(夜间模式)
  27 + nightIconUrl: string; // 迭代三新增-图标颜色-未选中(夜间模式)
  28 + nightNameCColor: string; // 迭代三新增-文字颜色-选中(夜间模式)
  29 + nightNameColor: string; // 迭代三新增-文字颜色-未选中(夜间模式)
  30 + noticeColor: string; // 迭代四:消息通知提醒颜色
31 pageId?: string; 31 pageId?: string;
32 pageType?: string; 32 pageType?: string;
33 - searchBothColor: string;  
34 - searchUrl: string; 33 + searchBothColor: string; // 迭代四:两侧文字图标颜色,搜索图标颜色
  34 + searchUrl: string; // 迭代四:搜索背景框
35 sortValue: number; 35 sortValue: number;
36 - statusBarColor: number; 36 + statusBarColor: number; // 迭代四:状态栏图标颜色,0:白色,1:黑色
37 topNavChannelList: TopNavDTO[]; 37 topNavChannelList: TopNavDTO[];
38 - topStyle: string;  
39 - type: string; 38 + topStyle: string; // 顶部样式:中文的(11-新闻;12-人民号;13-视频;14-服务)
  39 + type: string; // 底部导航类型,1普通 2我的;【rmrb需要扩展】
  40 + fmorningAndEveningUrl: string; // 迭代四:早晚报背景框
  41 + dropDownAnimationColor: string; // 下拉加载动画颜色,1白色,2灰色。未配置值是null
40 } 42 }
@@ -4,9 +4,10 @@ import { BottomNavDTO } from './BottomNavDTO'; @@ -4,9 +4,10 @@ import { BottomNavDTO } from './BottomNavDTO';
4 * 导航Body数据 4 * 导航Body数据
5 */ 5 */
6 export interface NavigationBodyDTO { 6 export interface NavigationBodyDTO {
7 - backgroundColor: string; 7 + backgroundColor: string; // 迭代二新增-底部导航背景色(信息流频道)
8 bottomNavList: BottomNavDTO[]; 8 bottomNavList: BottomNavDTO[];
9 - // greyBottomNav: GreyBottomNav;  
10 - immersiveBackgroundColor: string;  
11 - nightBackgroundColor: string; 9 +
  10 + // greyBottomNav: GreyBottomNav; // 灰度皮肤
  11 + immersiveBackgroundColor: string; // 迭代二新增-底部导航背景色(沉浸式频道)
  12 + nightBackgroundColor: string; // 迭代三新增-底部导航背景色(夜间模式)
12 } 13 }
@@ -7,14 +7,14 @@ export interface TopNavDTO { @@ -7,14 +7,14 @@ export interface TopNavDTO {
7 channelType: number; 7 channelType: number;
8 defaultPermitted: number; 8 defaultPermitted: number;
9 delPermitted: number; 9 delPermitted: number;
10 - fontCColor: string;  
11 - fontColor: string; 10 + fontCColor: string; // 频道展示样式颜色(选中状态)
  11 + fontColor: string; // 频道展示样式颜色(未选中状态)
12 headlinesOn: number; 12 headlinesOn: number;
13 homeChannel: string; 13 homeChannel: string;
14 - iconCUrl: string;  
15 - iconCUrlSize: string;  
16 - iconUrl: string;  
17 iconUrlSize: string; 14 iconUrlSize: string;
  15 + iconCUrlSize: string;
  16 + iconUrl: string; // 频道图片展示样式图片相对地址(未选中状态)
  17 + iconCUrl: string; //频道图片展示样式图片相对地址(选中状态
18 localChannel: string; 18 localChannel: string;
19 moreChannel: string; 19 moreChannel: string;
20 movePermitted: number; 20 movePermitted: number;
@@ -23,5 +23,5 @@ export interface TopNavDTO { @@ -23,5 +23,5 @@ export interface TopNavDTO {
23 num: number; 23 num: number;
24 pageId: number; 24 pageId: number;
25 pageType: string; 25 pageType: string;
26 - underlineCColor: string; 26 + underlineCColor: string; // 选中下划线颜色
27 } 27 }
  1 +export class AttentionBatchDTO{
  2 + creators: CreatorDTO[];
  3 +
  4 + constructor(creators: CreatorDTO[] = []) {
  5 + this.creators = creators
  6 + }
  7 +}
  8 +
  9 +export class CreatorDTO {
  10 + attentionUserType: string;
  11 + attentionUserId: string;
  12 + attentionCreatorId: string;
  13 +
  14 + constructor(attentionUserType: string, attentionUserId: string, attentionCreatorId: string) {
  15 + this.attentionUserType = attentionUserType
  16 + this.attentionUserId = attentionUserId
  17 + this.attentionCreatorId = attentionCreatorId
  18 + }
  19 +
  20 +}
  1 +import { ContentDTO } from '../content/ContentDTO'
  2 +
  3 +
  4 +export interface PeopleShipContentListDTO {
  5 + followCreators: boolean;
  6 + hasNext: number;
  7 + list: ContentDTO[];
  8 + pageNum: number;
  9 + pageSize: number;
  10 + totalCount: number;
  11 +}
  1 +export interface RmhRecommendDTO {
  2 + authIcon: string;
  3 + authTitle: string;
  4 + authTitle2: string;
  5 + cnAttention: number;
  6 + cnMainControl: number;
  7 + creatorId: string;
  8 + fansNum: number;
  9 + headPhotoUrl: string;
  10 + introduction: string;
  11 + itemId: string;
  12 + itemType: string;
  13 + itemTypeCode: string;
  14 + posterShareControl: number;
  15 + region: string;
  16 + sceneId: string;
  17 + subSceneId: string;
  18 + traceId: string;
  19 + traceInfo: string;
  20 + userId: string;
  21 + userName: string;
  22 + userType: string;
  23 +}
  24 +
@@ -71,8 +71,6 @@ export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopi @@ -71,8 +71,6 @@ export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopi
71 71
72 export { LogoutViewModel } from "./src/main/ets/viewmodel/LogoutViewModel" 72 export { LogoutViewModel } from "./src/main/ets/viewmodel/LogoutViewModel"
73 73
74 -export { ImageSwiperComponent } from "./src/main/ets/components/ImageSwiperComponent"  
75 -  
76 export { newsSkeleton } from "./src/main/ets/components/skeleton/newsSkeleton" 74 export { newsSkeleton } from "./src/main/ets/components/skeleton/newsSkeleton"
77 75
78 export { LiveCommentComponent } from "./src/main/ets/components/comment/view/LiveCommentComponent" 76 export { LiveCommentComponent } from "./src/main/ets/components/comment/view/LiveCommentComponent"
@@ -167,7 +167,7 @@ export struct AudioDetailComponent { @@ -167,7 +167,7 @@ export struct AudioDetailComponent {
167 } 167 }
168 .layoutWeight(1) 168 .layoutWeight(1)
169 169
170 - OperRowListView() 170 + // OperRowListView()
171 } 171 }
172 } 172 }
173 173
@@ -9,6 +9,7 @@ import { @@ -9,6 +9,7 @@ import {
9 HorizontalStrokeCardThreeTwoRadioForOneComponent 9 HorizontalStrokeCardThreeTwoRadioForOneComponent
10 } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent'; 10 } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';
11 import { ZhSingleRow02 } from './compview/ZhSingleRow02'; 11 import { ZhSingleRow02 } from './compview/ZhSingleRow02';
  12 +import { ZhSingleRow03 } from './compview/ZhSingleRow03';
12 import { ZhSingleRow04 } from './compview/ZhSingleRow04'; 13 import { ZhSingleRow04 } from './compview/ZhSingleRow04';
13 import { ZhSingleRow05 } from './compview/ZhSingleRow05'; 14 import { ZhSingleRow05 } from './compview/ZhSingleRow05';
14 import { ZhSingleRow06 } from './compview/ZhSingleRow06'; 15 import { ZhSingleRow06 } from './compview/ZhSingleRow06';
@@ -23,7 +24,6 @@ import { ZhGridLayout02 } from './compview/ZhGridLayout02'; @@ -23,7 +24,6 @@ import { ZhGridLayout02 } from './compview/ZhGridLayout02';
23 import { Card2Component } from './cardview/Card2Component'; 24 import { Card2Component } from './cardview/Card2Component';
24 import { Card5Component } from './cardview/Card5Component'; 25 import { Card5Component } from './cardview/Card5Component';
25 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 26 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
26 -import { CardAdvComponent } from './cardViewAdv/CardAdvComponent';  
27 import { AdvCardParser } from './cardViewAdv/AdvCardParser'; 27 import { AdvCardParser } from './cardViewAdv/AdvCardParser';
28 28
29 /** 29 /**
@@ -44,49 +44,67 @@ export struct CompParser { @@ -44,49 +44,67 @@ export struct CompParser {
44 44
45 @Builder 45 @Builder
46 componentBuilder(compDTO: CompDTO, compIndex: number) { 46 componentBuilder(compDTO: CompDTO, compIndex: number) {
47 - // if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口 47 + if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
48 if (compDTO.compStyle === CompStyle.Label_03) { 48 if (compDTO.compStyle === CompStyle.Label_03) {
49 LabelComponent({ compDTO: compDTO }) 49 LabelComponent({ compDTO: compDTO })
  50 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
50 } else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { 51 } else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
51 ZhCarouselLayout01({ compDTO: compDTO }) 52 ZhCarouselLayout01({ compDTO: compDTO })
  53 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
52 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 2) { 54 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 2) {
53 LiveHorizontalCardComponent({ compDTO: compDTO }) 55 LiveHorizontalCardComponent({ compDTO: compDTO })
  56 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
54 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 3) { 57 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 3) {
55 if (compDTO.operDataList.length > 1) { 58 if (compDTO.operDataList.length > 1) {
56 HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: compDTO }) 59 HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: compDTO })
57 } else { 60 } else {
58 HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO }) 61 HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO })
59 } 62 }
  63 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
60 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) { 64 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) {
61 ZhSingleRow02({ compDTO }) 65 ZhSingleRow02({ compDTO })
  66 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
62 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) { 67 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) {
63 - LiveHorizontalReservationComponent({ compDTO: compDTO }) 68 + ZhSingleRow03({ compDTO: compDTO })
  69 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
64 } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { 70 } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) {
65 ZhGridLayout02({ compDTO: compDTO }) 71 ZhGridLayout02({ compDTO: compDTO })
  72 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
66 } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { 73 } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) {
67 ZhGridLayout03({ compDTO: compDTO }) 74 ZhGridLayout03({ compDTO: compDTO })
  75 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
68 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) { 76 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) {
69 ZhSingleRow04({ compDTO: compDTO }) 77 ZhSingleRow04({ compDTO: compDTO })
  78 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
70 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_05) { 79 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_05) {
71 - ZhSingleRow05({ compDTO }) 80 + // ZhSingleRow05({ compDTO })
  81 + // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
72 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) { 82 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) {
73 ZhSingleRow06({ compDTO }) 83 ZhSingleRow06({ compDTO })
  84 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
74 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) { 85 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
75 //头图卡 和comStyle 2相同, 86 //头图卡 和comStyle 2相同,
76 Card5Component({ contentDTO: compDTO.operDataList[0] }) 87 Card5Component({ contentDTO: compDTO.operDataList[0] })
  88 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
77 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) { 89 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) {
78 // 大图卡 90 // 大图卡
79 Card2Component({ contentDTO: compDTO.operDataList[0] }) 91 Card2Component({ contentDTO: compDTO.operDataList[0] })
  92 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
80 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) { 93 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) {
81 ZhSingleColumn04({ compDTO: compDTO }) 94 ZhSingleColumn04({ compDTO: compDTO })
  95 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
82 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) { 96 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) {
83 - ZhSingleColumn05({ compDTO: compDTO }) 97 + // ZhSingleColumn05({ compDTO: compDTO })
  98 + // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
84 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_09) { 99 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_09) {
85 ZhSingleColumn09({ compDTO }) 100 ZhSingleColumn09({ compDTO })
  101 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
86 } else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告 102 } else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告
87 AdvCardParser({compDTO}) 103 AdvCardParser({compDTO})
  104 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
88 } else if (!Number.isNaN(Number(compDTO.compStyle))) { 105 } else if (!Number.isNaN(Number(compDTO.compStyle))) {
89 CardParser({ contentDTO: compDTO.operDataList[0] }); 106 CardParser({ contentDTO: compDTO.operDataList[0] });
  107 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
90 } 108 }
91 else { 109 else {
92 Text(compDTO.compStyle) 110 Text(compDTO.compStyle)
@@ -97,10 +115,10 @@ export struct CompParser { @@ -97,10 +115,10 @@ export struct CompParser {
97 WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage) 115 WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage)
98 } 116 }
99 }) 117 })
  118 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
100 } 119 }
101 - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })  
102 } 120 }
103 121
104 - // } 122 + }
105 } 123 }
106 124
1 -import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper, NumberFormatterUtils } from 'wdKit'; 1 +import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper, NumberFormatterUtils, DisplayUtils } from 'wdKit';
2 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 2 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
3 import { ContentDetailDTO,postBatchAttentionStatusParams, 3 import { ContentDetailDTO,postBatchAttentionStatusParams,
4 PhotoListBean, 4 PhotoListBean,
@@ -25,6 +25,9 @@ import { BusinessError } from '@ohos.base'; @@ -25,6 +25,9 @@ import { BusinessError } from '@ohos.base';
25 import { CommonConstants, SpConstants } from 'wdConstant/Index'; 25 import { CommonConstants, SpConstants } from 'wdConstant/Index';
26 import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo' 26 import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo'
27 import router from '@ohos.router'; 27 import router from '@ohos.router';
  28 +import { publishCommentModel } from './comment/model/PublishCommentModel';
  29 +import { CommentComponent } from './comment/view/CommentComponent';
  30 +
28 const TAG = 'DynamicDetailComponent' 31 const TAG = 'DynamicDetailComponent'
29 @Preview 32 @Preview
30 @Component 33 @Component
@@ -44,12 +47,14 @@ export struct DynamicDetailComponent { @@ -44,12 +47,14 @@ export struct DynamicDetailComponent {
44 /** 47 /**
45 * 关注状态:默认未关注 点击去关注 48 * 关注状态:默认未关注 点击去关注
46 */ 49 */
47 - @State followStatus: String = '0'; 50 + @State followStatus: String = '';
48 51
49 - @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined// 点赞、收藏状态 52 + @State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult// 点赞、收藏状态
50 //跳转 53 //跳转
51 private mJumpInfo: ContentDTO = {} as ContentDTO; 54 private mJumpInfo: ContentDTO = {} as ContentDTO;
52 55
  56 +
  57 +
53 async aboutToAppear() { 58 async aboutToAppear() {
54 await this.getContentDetailData() 59 await this.getContentDetailData()
55 } 60 }
@@ -78,7 +83,7 @@ export struct DynamicDetailComponent { @@ -78,7 +83,7 @@ export struct DynamicDetailComponent {
78 Image($r('app.media.ic_news_detail_division')) 83 Image($r('app.media.ic_news_detail_division'))
79 .width('100%') 84 .width('100%')
80 .height($r('app.float.margin_7')) 85 .height($r('app.float.margin_7'))
81 - .margin({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} ) 86 + .padding({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} )
82 Stack({ alignContent: Alignment.Bottom }) { 87 Stack({ alignContent: Alignment.Bottom }) {
83 Scroll(this.scroller) { 88 Scroll(this.scroller) {
84 Column() { 89 Column() {
@@ -121,31 +126,33 @@ export struct DynamicDetailComponent { @@ -121,31 +126,33 @@ export struct DynamicDetailComponent {
121 } 126 }
122 .width('63%') 127 .width('63%')
123 .margin({right: $r('app.float.margin_6')}) 128 .margin({right: $r('app.float.margin_6')})
124 - if (this.followStatus == '0') {  
125 - Text('关注')  
126 - .width($r('app.float.margin_54'))  
127 - .height($r('app.float.margin_24'))  
128 - .textAlign(TextAlign.Center)  
129 - .fontSize($r('app.float.font_size_12'))  
130 - .borderRadius($r('app.float.vp_3'))  
131 - .backgroundColor($r('app.color.color_ED2800'))  
132 - .fontColor($r('app.color.color_fff'))  
133 - .onClick(() => {  
134 - this.handleAccention()  
135 - })  
136 - } else {  
137 - Text('已关注')  
138 - .width($r('app.float.margin_54'))  
139 - .height($r('app.float.margin_24'))  
140 - .borderWidth(1)  
141 - .textAlign(TextAlign.Center)  
142 - .fontSize($r('app.float.font_size_12'))  
143 - .borderRadius($r('app.float.vp_3'))  
144 - .borderColor($r('app.color.color_CCCCCC'))  
145 - .fontColor($r('app.color.color_CCCCCC'))  
146 - .onClick(() => {  
147 - this.handleAccention()  
148 - }) 129 + if(!StringUtils.isEmpty(this.followStatus)){
  130 + if (this.followStatus == '0') {
  131 + Text('关注')
  132 + .width($r('app.float.margin_54'))
  133 + .height($r('app.float.margin_24'))
  134 + .textAlign(TextAlign.Center)
  135 + .fontSize($r('app.float.font_size_12'))
  136 + .borderRadius($r('app.float.vp_3'))
  137 + .backgroundColor($r('app.color.color_ED2800'))
  138 + .fontColor($r('app.color.color_fff'))
  139 + .onClick(() => {
  140 + this.handleAccention()
  141 + })
  142 + } else {
  143 + Text('已关注')
  144 + .width($r('app.float.margin_54'))
  145 + .height($r('app.float.margin_24'))
  146 + .borderWidth(1)
  147 + .textAlign(TextAlign.Center)
  148 + .fontSize($r('app.float.font_size_12'))
  149 + .borderRadius($r('app.float.vp_3'))
  150 + .borderColor($r('app.color.color_CCCCCC'))
  151 + .fontColor($r('app.color.color_CCCCCC'))
  152 + .onClick(() => {
  153 + this.handleAccention()
  154 + })
  155 + }
149 } 156 }
150 } 157 }
151 .width('100%') 158 .width('100%')
@@ -209,7 +216,7 @@ export struct DynamicDetailComponent { @@ -209,7 +216,7 @@ export struct DynamicDetailComponent {
209 } 216 }
210 } 217 }
211 .onClick((event: ClickEvent) => { 218 .onClick((event: ClickEvent) => {
212 - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList) 219 + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
213 }) 220 })
214 } else { 221 } else {
215 GridCol({ 222 GridCol({
@@ -226,7 +233,7 @@ export struct DynamicDetailComponent { @@ -226,7 +233,7 @@ export struct DynamicDetailComponent {
226 }) 233 })
227 } 234 }
228 .onClick((event: ClickEvent) => { 235 .onClick((event: ClickEvent) => {
229 - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList) 236 + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
230 }) 237 })
231 } 238 }
232 } else if (this.contentDetailData.photoList.length === 4) { 239 } else if (this.contentDetailData.photoList.length === 4) {
@@ -238,7 +245,7 @@ export struct DynamicDetailComponent { @@ -238,7 +245,7 @@ export struct DynamicDetailComponent {
238 .borderRadius(this.caclImageRadius(index)) 245 .borderRadius(this.caclImageRadius(index))
239 } 246 }
240 .onClick((event: ClickEvent) => { 247 .onClick((event: ClickEvent) => {
241 - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList) 248 + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
242 }) 249 })
243 } else { 250 } else {
244 GridCol({ 251 GridCol({
@@ -249,7 +256,7 @@ export struct DynamicDetailComponent { @@ -249,7 +256,7 @@ export struct DynamicDetailComponent {
249 .borderRadius(this.caclImageRadius(index)) 256 .borderRadius(this.caclImageRadius(index))
250 } 257 }
251 .onClick((event: ClickEvent) => { 258 .onClick((event: ClickEvent) => {
252 - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList) 259 + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
253 }) 260 })
254 } 261 }
255 }) 262 })
@@ -268,8 +275,8 @@ export struct DynamicDetailComponent { @@ -268,8 +275,8 @@ export struct DynamicDetailComponent {
268 Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)? 275 Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)?
269 this.contentDetailData.fullColumnImgUrls[0].url: 276 this.contentDetailData.fullColumnImgUrls[0].url:
270 this.contentDetailData.videoInfo[0].firstFrameImageUri) 277 this.contentDetailData.videoInfo[0].firstFrameImageUri)
271 - .width(CommonConstants.FULL_WIDTH)  
272 - .aspectRatio(16 / 9) 278 + .width(DisplayUtils.getDeviceWidth()- 32)
  279 + .height((DisplayUtils.getDeviceWidth()-32)* 9 / 16)
273 .borderRadius($r('app.float.image_border_radius')) 280 .borderRadius($r('app.float.image_border_radius'))
274 CardMediaInfo({ contentDTO: this.mJumpInfo }) 281 CardMediaInfo({ contentDTO: this.mJumpInfo })
275 } 282 }
@@ -284,7 +291,8 @@ export struct DynamicDetailComponent { @@ -284,7 +291,8 @@ export struct DynamicDetailComponent {
284 Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)? 291 Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)?
285 this.contentDetailData.fullColumnImgUrls[0].url: 292 this.contentDetailData.fullColumnImgUrls[0].url:
286 this.contentDetailData.videoInfo[0].firstFrameImageUri) 293 this.contentDetailData.videoInfo[0].firstFrameImageUri)
287 - .width(CommonConstants.FULL_WIDTH) 294 + .width(DisplayUtils.getDeviceWidth()/2)
  295 + .height(DisplayUtils.getDeviceWidth()/2* 4 / 3)
288 .borderRadius($r('app.float.image_border_radius')) 296 .borderRadius($r('app.float.image_border_radius'))
289 CardMediaInfo({ contentDTO: this.mJumpInfo }) 297 CardMediaInfo({ contentDTO: this.mJumpInfo })
290 } 298 }
@@ -292,7 +300,7 @@ export struct DynamicDetailComponent { @@ -292,7 +300,7 @@ export struct DynamicDetailComponent {
292 } 300 }
293 } 301 }
294 } 302 }
295 - .margin({ left: $r('app.float.margin_16'),right: $r('app.float.margin_16'),top: $r('app.float.margin_8')}) 303 + .padding({ left: this.contentDetailData.videoInfo[0].videoLandScape === 1?0: 16,top: $r('app.float.margin_8')})
296 .onClick((event: ClickEvent) => { 304 .onClick((event: ClickEvent) => {
297 ProcessUtils.processPage(this.mJumpInfo) 305 ProcessUtils.processPage(this.mJumpInfo)
298 }) 306 })
@@ -330,9 +338,10 @@ export struct DynamicDetailComponent { @@ -330,9 +338,10 @@ export struct DynamicDetailComponent {
330 Image(this.newsStatusOfUser?.likeStatus == '1'? 338 Image(this.newsStatusOfUser?.likeStatus == '1'?
331 $r('app.media.icon_like_selected_redheart') 339 $r('app.media.icon_like_selected_redheart')
332 :$r('app.media.icon_like_unselect_grey_redheart')) 340 :$r('app.media.icon_like_unselect_grey_redheart'))
333 - .width($r('app.float.margin_24'))  
334 - .height($r('app.float.margin_24')) 341 + .width($r('app.float.margin_36'))
  342 + .height($r('app.float.margin_36'))
335 .objectFit(ImageFit.Cover) 343 .objectFit(ImageFit.Cover)
  344 + .margin({ left: $r('app.float.margin_6_negative'),right: $r('app.float.margin_6_negative')})
336 if(this.interactDataDTO?.likeNum != 0){ 345 if(this.interactDataDTO?.likeNum != 0){
337 Text(NumberFormatterUtils.formatNumberWithWan(this.interactDataDTO?.likeNum)) 346 Text(NumberFormatterUtils.formatNumberWithWan(this.interactDataDTO?.likeNum))
338 .fontColor($r('app.color.color_999999')) 347 .fontColor($r('app.color.color_999999'))
@@ -352,8 +361,22 @@ export struct DynamicDetailComponent { @@ -352,8 +361,22 @@ export struct DynamicDetailComponent {
352 //点赞操作 361 //点赞操作
353 this.toggleLikeStatus() 362 this.toggleLikeStatus()
354 }) 363 })
  364 + // 评论
  365 + if (this.contentDetailData?.openComment) {
  366 + Divider().strokeWidth(6).color('#f5f5f5').margin({top:$r('app.float.margin_24')})
  367 + CommentComponent({
  368 + publishCommentModel: {
  369 + targetId: String(this.contentDetailData?.newsId || ''),
  370 + targetRelId: this.contentDetailData?.reLInfo?.relId,
  371 + targetTitle: this.contentDetailData?.newsTitle,
  372 + targetRelType: this.contentDetailData?.reLInfo?.relType,
  373 + targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId),
  374 + keyArticle: String(this.contentDetailData?.keyArticle),
  375 + targetType: String(this.contentDetailData?.newsType),
  376 + } as publishCommentModel
  377 + })
  378 + }
355 Blank().layoutWeight(1) 379 Blank().layoutWeight(1)
356 - //fixme 评论组件  
357 } 380 }
358 } 381 }
359 .width(CommonConstants.FULL_WIDTH) 382 .width(CommonConstants.FULL_WIDTH)
@@ -362,42 +385,19 @@ export struct DynamicDetailComponent { @@ -362,42 +385,19 @@ export struct DynamicDetailComponent {
362 .scrollBar(BarState.Off) 385 .scrollBar(BarState.Off)
363 .alignSelf(ItemAlign.Start) 386 .alignSelf(ItemAlign.Start)
364 //底部交互区 387 //底部交互区
365 - Row() {  
366 - Image($r('app.media.icon_arrow_left'))  
367 - .width(24)  
368 - .height(24)  
369 - .onClick((event: ClickEvent) => {  
370 - router.back()  
371 - })  
372 -  
373 - Row() {  
374 - Image($r('app.media.icon_comment'))  
375 - .width(24)  
376 - .height(24)  
377 - .margin({ right: 24 })  
378 - .id('comment')  
379 -  
380 - Image($r('app.media.icon_star'))  
381 - .width(24)  
382 - .height(24)  
383 - .margin({ right: 24 })  
384 -  
385 - Image($r('app.media.icon_listen'))  
386 - .width(24)  
387 - .height(24)  
388 - .margin({ right: 24 })  
389 -  
390 - Image($r('app.media.icon_forward'))  
391 - .width(24)  
392 - .height(24)  
393 -  
394 - }  
395 - }  
396 - .width(CommonConstants.FULL_WIDTH)  
397 - .height(56)  
398 - .padding({ left: 15, right: 15, bottom: 50, top: 20 })  
399 - .justifyContent(FlexAlign.SpaceBetween)  
400 - .backgroundColor(Color.White) 388 + OperRowListView({ contentDetailData: this.contentDetailData
  389 + ,interactData:this.interactDataDTO
  390 + ,newsStatusOfUser:this.newsStatusOfUser
  391 + ,publishCommentModel: {
  392 + targetId: String(this.contentDetailData?.newsId || ''),
  393 + targetRelId: this.contentDetailData?.reLInfo?.relId,
  394 + targetTitle: this.contentDetailData?.newsTitle,
  395 + targetRelType: this.contentDetailData?.reLInfo?.relType,
  396 + targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId),
  397 + keyArticle: String(this.contentDetailData?.keyArticle),
  398 + targetType: String(this.contentDetailData?.newsType),
  399 + } as publishCommentModel
  400 + ,needLike:false})
401 } 401 }
402 } 402 }
403 .alignSelf(ItemAlign.Start) 403 .alignSelf(ItemAlign.Start)
@@ -430,12 +430,17 @@ export struct DynamicDetailComponent { @@ -430,12 +430,17 @@ export struct DynamicDetailComponent {
430 430
431 // 已登录->查询用户对作品点赞、收藏状态 431 // 已登录->查询用户对作品点赞、收藏状态
432 private async getInteractDataStatus() { 432 private async getInteractDataStatus() {
  433 + // 未登录,跳转登录
  434 + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
  435 + if (!user_id) {
  436 + return
  437 + }
433 try { 438 try {
434 const params: batchLikeAndCollectParams = { 439 const params: batchLikeAndCollectParams = {
435 contentList: [ 440 contentList: [
436 { 441 {
437 - contentId: this.contentDetailData[0]?.newsId + '',  
438 - contentType: this.contentDetailData[0]?.newsType + '', 442 + contentId: this.contentDetailData?.newsId + '',
  443 + contentType: this.contentDetailData?.newsType + '',
439 } 444 }
440 ] 445 ]
441 } 446 }
@@ -453,16 +458,22 @@ export struct DynamicDetailComponent { @@ -453,16 +458,22 @@ export struct DynamicDetailComponent {
453 * 查询当前登录用户是否关注作品号主 458 * 查询当前登录用户是否关注作品号主
454 * */ 459 * */
455 private async getBatchAttentionStatus() { 460 private async getBatchAttentionStatus() {
  461 + // 未登录,跳转登录
  462 + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
  463 + if (!user_id) {
  464 + this.followStatus = '0';
  465 + return
  466 + }
456 try { 467 try {
457 - const params: postBatchAttentionStatusParams = {  
458 - creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }] 468 + const params: postBatchAttentionStatusParams = {
  469 + creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }]
  470 + }
  471 + let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)
  472 + this.followStatus = data[0]?.status;
  473 + Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)
  474 + } catch (exception) {
  475 + this.followStatus = '0';
459 } 476 }
460 - let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)  
461 - this.followStatus = data[0]?.status;  
462 - Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)  
463 - } catch (exception) {  
464 -  
465 - }  
466 } 477 }
467 478
468 //创建跳转信息 479 //创建跳转信息
@@ -558,18 +569,13 @@ export struct DynamicDetailComponent { @@ -558,18 +569,13 @@ export struct DynamicDetailComponent {
558 contentType: this.contentDetailData?.newsType + '', 569 contentType: this.contentDetailData?.newsType + '',
559 } 570 }
560 ContentDetailRequest.postExecuteLike(params).then(res => { 571 ContentDetailRequest.postExecuteLike(params).then(res => {
561 -  
562 - if (this.newsStatusOfUser) {  
563 - this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'  
564 - if (this.newsStatusOfUser.likeStatus === '1') {  
565 - this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) + 1  
566 - } else {  
567 - this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) - 1  
568 - }  
569 - console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum)  
570 - // this.queryContentInteractCount() 572 + this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'
  573 + if (this.newsStatusOfUser.likeStatus === '1') {
  574 + this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) + 1
  575 + } else {
  576 + this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) - 1
571 } 577 }
572 - 578 + console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum)
573 }) 579 })
574 } 580 }
575 } 581 }
1 -import { Logger, NumberFormatterUtils, DateTimeUtils } from 'wdKit'; 1 +import { Logger, NumberFormatterUtils, DateTimeUtils, EmitterUtils, EmitterEventId, NetworkUtil } from 'wdKit';
2 import { 2 import {
3 Action, 3 Action,
4 ContentDetailDTO, 4 ContentDetailDTO,
@@ -15,16 +15,18 @@ import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; @@ -15,16 +15,18 @@ import { ImageAndTextWebComponent } from './ImageAndTextWebComponent';
15 import { OperRowListView } from './view/OperRowListView'; 15 import { OperRowListView } from './view/OperRowListView';
16 import { RecommendList } from '../components/view/RecommendList' 16 import { RecommendList } from '../components/view/RecommendList'
17 import { CommonConstants } from 'wdConstant'; 17 import { CommonConstants } from 'wdConstant';
18 -import { HttpUrlUtils } from 'wdNetwork/Index';  
19 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 18 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
20 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 19 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
21 import { PageRepository } from '../repository/PageRepository'; 20 import { PageRepository } from '../repository/PageRepository';
22 import { detailedSkeleton } from './skeleton/detailSkeleton'; 21 import { detailedSkeleton } from './skeleton/detailSkeleton';
  22 +import { publishCommentModel } from '../components/comment/model/PublishCommentModel';
  23 +import { EmptyComponent } from '../components/view/EmptyComponent';
23 import { CommentComponent } from '../components/comment/view/CommentComponent' 24 import { CommentComponent } from '../components/comment/view/CommentComponent'
  25 +import { HttpUtils } from 'wdNetwork/Index';
24 26
25 const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; 27 const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
26 28
27 -const TAG = 'ImageAndTextPageComponent' 29 +const TAG: string = 'ImageAndTextPageComponent'
28 30
29 @Component 31 @Component
30 export struct ImageAndTextPageComponent { 32 export struct ImageAndTextPageComponent {
@@ -36,6 +38,9 @@ export struct ImageAndTextPageComponent { @@ -36,6 +38,9 @@ export struct ImageAndTextPageComponent {
36 @State interactData: InteractDataDTO = {} as InteractDataDTO 38 @State interactData: InteractDataDTO = {} as InteractDataDTO
37 @State isPageEnd: boolean = false 39 @State isPageEnd: boolean = false
38 @State publishTime: string = '' 40 @State publishTime: string = ''
  41 + @State publishCommentModel: publishCommentModel = new publishCommentModel()
  42 + @State operationButtonList: string[] = ['comment', 'collect', 'share']
  43 + @State isNetConnected: boolean = true
39 44
40 build() { 45 build() {
41 Column() { 46 Column() {
@@ -80,20 +85,26 @@ export struct ImageAndTextPageComponent { @@ -80,20 +85,26 @@ export struct ImageAndTextPageComponent {
80 Row() { 85 Row() {
81 Row() { 86 Row() {
82 if (this.newsStatusOfUser?.likeStatus === '1') { 87 if (this.newsStatusOfUser?.likeStatus === '1') {
83 - 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'))) 88 + Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') :
  89 + (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') :
  90 + $r('app.media.icon_candle_active')))
84 .width(24) 91 .width(24)
85 .height(24) 92 .height(24)
86 .margin({ right: 5 }) 93 .margin({ right: 5 })
87 } else { 94 } else {
88 - 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 + Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') :
  96 + (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') :
  97 + $r('app.media.icon_candle')))
89 .width(24) 98 .width(24)
90 .height(24) 99 .height(24)
91 .margin({ right: 5 }) 100 .margin({ right: 5 })
92 } 101 }
93 - Text(`${this.interactData?.likeNum || 0}`)  
94 - .fontSize(16)  
95 - .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')  
96 - .fontWeight(500) 102 + if (this.interactData?.likeNum != '0') {
  103 + Text(`${this.interactData?.likeNum}`)
  104 + .fontSize(16)
  105 + .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')
  106 + .fontWeight(500)
  107 + }
97 } 108 }
98 .width(140) 109 .width(140)
99 .height(36) 110 .height(36)
@@ -110,15 +121,18 @@ export struct ImageAndTextPageComponent { @@ -110,15 +121,18 @@ export struct ImageAndTextPageComponent {
110 121
111 }.width(CommonConstants.FULL_WIDTH).height(80) 122 }.width(CommonConstants.FULL_WIDTH).height(80)
112 .justifyContent(FlexAlign.Center) 123 .justifyContent(FlexAlign.Center)
113 -  
114 - Divider().strokeWidth(6).color('#f5f5f5')  
115 } 124 }
116 if (this.recommendList.length > 0) { 125 if (this.recommendList.length > 0) {
  126 + Divider().strokeWidth(6).color('#f5f5f5')
117 RecommendList({ recommendList: this.recommendList }) 127 RecommendList({ recommendList: this.recommendList })
118 } 128 }
119 // 评论 129 // 评论
120 - if(this.contentDetailData[0]?.openComment){  
121 - 130 + if (this.contentDetailData[0]?.openComment) {
  131 + Divider().strokeWidth(6).color('#f5f5f5')
  132 + CommentComponent({
  133 + publishCommentModel: this.publishCommentModel
  134 + })
  135 + // .onMeasureSize()
122 } 136 }
123 } 137 }
124 } 138 }
@@ -126,15 +140,32 @@ export struct ImageAndTextPageComponent { @@ -126,15 +140,32 @@ export struct ImageAndTextPageComponent {
126 } 140 }
127 .width(CommonConstants.FULL_WIDTH) 141 .width(CommonConstants.FULL_WIDTH)
128 .height(CommonConstants.FULL_HEIGHT) 142 .height(CommonConstants.FULL_HEIGHT)
129 - .padding({ bottom: 126 }) 143 + .padding({ bottom: 76 })
130 .scrollBar(BarState.Off) 144 .scrollBar(BarState.Off)
  145 + .align(Alignment.Top)
131 146
132 - if (!this.isPageEnd) {  
133 - detailedSkeleton() 147 + if(!this.isNetConnected) {
  148 + EmptyComponent({
  149 + emptyType: 1,
  150 + emptyButton: true,
  151 + retry: () => {
  152 + this.getDetail()
  153 + }
  154 + })
  155 + }else{
  156 + if (!this.isPageEnd) {
  157 + detailedSkeleton()
  158 + }
134 } 159 }
135 160
136 //底部交互区 161 //底部交互区
137 - OperRowListView({ contentDetailData: this.contentDetailData[0] }) 162 + if (this.contentDetailData?.length) {
  163 + OperRowListView({
  164 + contentDetailData: this.contentDetailData[0],
  165 + publishCommentModel: this.publishCommentModel,
  166 + operationButtonList: this.operationButtonList,
  167 + })
  168 + }
138 } 169 }
139 170
140 } 171 }
@@ -143,6 +174,7 @@ export struct ImageAndTextPageComponent { @@ -143,6 +174,7 @@ export struct ImageAndTextPageComponent {
143 } 174 }
144 175
145 private async getDetail() { 176 private async getDetail() {
  177 + this.isNetConnected = NetworkUtil.isNetConnected()
146 let contentId: string = '' 178 let contentId: string = ''
147 let relId: string = '' 179 let relId: string = ''
148 let relType: string = '' 180 let relType: string = ''
@@ -162,7 +194,8 @@ export struct ImageAndTextPageComponent { @@ -162,7 +194,8 @@ export struct ImageAndTextPageComponent {
162 let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) 194 let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
163 if (detailBeans && detailBeans.length > 0) { 195 if (detailBeans && detailBeans.length > 0) {
164 this.contentDetailData = detailBeans; 196 this.contentDetailData = detailBeans;
165 - let dateTime = DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN); 197 + let dateTime =
  198 + DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
166 this.publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN) 199 this.publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
167 if (this.contentDetailData[0]?.recommendShow === 1) { 200 if (this.contentDetailData[0]?.recommendShow === 1) {
168 this.getRecommend() 201 this.getRecommend()
@@ -171,16 +204,28 @@ export struct ImageAndTextPageComponent { @@ -171,16 +204,28 @@ export struct ImageAndTextPageComponent {
171 this.getInteractDataStatus() 204 this.getInteractDataStatus()
172 this.queryContentInteractCount() 205 this.queryContentInteractCount()
173 } 206 }
  207 + if (this.contentDetailData[0]?.openComment) {
  208 + this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '')
  209 + this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId)
  210 + this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle
  211 + this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType)
  212 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId)
  213 + this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle)
  214 + this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType)
  215 + }
  216 + if (this.contentDetailData[0]?.audioList?.length && this.contentDetailData[0]?.audioList[0].audioUrl) {
  217 + this.operationButtonList = ['comment', 'collect', 'listen', 'share']
  218 + }
174 } 219 }
175 } 220 }
176 } 221 }
177 222
178 private async getRecommend() { 223 private async getRecommend() {
179 let params: postRecommendListParams = { 224 let params: postRecommendListParams = {
180 - imei: "8272c108-4fa2-34ce-80b9-bc425a7c2a7e",  
181 - userId: HttpUrlUtils.getUserId(), 225 + imei: HttpUtils.getImei(),
  226 + userId: HttpUtils.getUserId(),
182 contentId: String(this.contentDetailData[0]?.newsId), 227 contentId: String(this.contentDetailData[0]?.newsId),
183 - recType: 1, 228 + recType: Number(this.contentDetailData[0]?.reLInfo?.relType),
184 contentType: this.contentDetailData[0]?.newsType, 229 contentType: this.contentDetailData[0]?.newsType,
185 relId: this.contentDetailData[0]?.reLInfo?.relId, 230 relId: this.contentDetailData[0]?.reLInfo?.relId,
186 channelId: String(this.contentDetailData[0]?.reLInfo?.channelId) 231 channelId: String(this.contentDetailData[0]?.reLInfo?.channelId)
@@ -215,7 +260,7 @@ export struct ImageAndTextPageComponent { @@ -215,7 +260,7 @@ export struct ImageAndTextPageComponent {
215 */ 260 */
216 toggleLikeStatus() { 261 toggleLikeStatus() {
217 // 未登录,跳转登录 262 // 未登录,跳转登录
218 - if (!HttpUrlUtils.getUserId()) { 263 + if (!HttpUtils.getUserId()) {
219 WDRouterRule.jumpWithPage(WDRouterPage.loginPage) 264 WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
220 return 265 return
221 } 266 }
@@ -258,6 +303,15 @@ export struct ImageAndTextPageComponent { @@ -258,6 +303,15 @@ export struct ImageAndTextPageComponent {
258 303
259 aboutToAppear() { 304 aboutToAppear() {
260 this.getDetail() 305 this.getDetail()
  306 + //注册通知,来自别的组件的评论成功通知
  307 + EmitterUtils.receiveEvent(EmitterEventId.COMMENT_PUBLISH, (targetId?: string) => {
  308 + if (targetId) {
  309 + if (targetId == this.publishCommentModel.targetId) {
  310 + // 滚动到评论列表
  311 +
  312 + }
  313 + }
  314 + })
261 } 315 }
262 316
263 aboutToDisappear() { 317 aboutToDisappear() {
@@ -12,6 +12,7 @@ import { WdWebLocalComponent } from 'wdWebComponent'; @@ -12,6 +12,7 @@ import { WdWebLocalComponent } from 'wdWebComponent';
12 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; 12 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type';
13 import { BridgeWebViewControl } from 'wdJsBridge/Index'; 13 import { BridgeWebViewControl } from 'wdJsBridge/Index';
14 14
  15 +const TAG: string = 'ImageAndTextWebComponent'
15 @Component 16 @Component
16 export struct ImageAndTextWebComponent { 17 export struct ImageAndTextWebComponent {
17 action: Action = {} as Action 18 action: Action = {} as Action
@@ -60,9 +61,12 @@ export struct ImageAndTextWebComponent { @@ -60,9 +61,12 @@ export struct ImageAndTextWebComponent {
60 // TODO 对接user信息、登录情况 61 // TODO 对接user信息、登录情况
61 let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { 62 let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = {
62 creatorId: creatorId, 63 creatorId: creatorId,
  64 + cnsTraceId: '',
63 isLogin: isLogin, 65 isLogin: isLogin,
64 - networkStatus: Number(NetworkUtil.isNetConnected()),  
65 loadImageOnlyWifiSwitch: '2', 66 loadImageOnlyWifiSwitch: '2',
  67 + networkStatus: Number(NetworkUtil.isNetConnected()),
  68 + darkMode: 'light',
  69 + fontSizes: 'normalsize'
66 70
67 } as H5ReceiveDataExtraBean 71 } as H5ReceiveDataExtraBean
68 let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = { 72 let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = {
@@ -83,7 +87,6 @@ export struct ImageAndTextWebComponent { @@ -83,7 +87,6 @@ export struct ImageAndTextWebComponent {
83 this.h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean 87 this.h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean
84 this.dataPrepared = true 88 this.dataPrepared = true
85 this.trySendData2H5() 89 this.trySendData2H5()
86 -  
87 } 90 }
88 91
89 } 92 }
@@ -114,7 +117,7 @@ export struct ImageAndTextWebComponent { @@ -114,7 +117,7 @@ export struct ImageAndTextWebComponent {
114 } 117 }
115 118
116 private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) { 119 private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) {
117 - Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData'); 120 + Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData',JSON.stringify(h5ReceiveAppData));
118 this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData, 121 this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData,
119 JSON.stringify(h5ReceiveAppData), (data: string) => { 122 JSON.stringify(h5ReceiveAppData), (data: string) => {
120 Logger.debug('ImageAndTextWebComponent', "from js data = " + data); 123 Logger.debug('ImageAndTextWebComponent', "from js data = " + data);
@@ -20,7 +20,7 @@ export struct ImageDownloadComponent { @@ -20,7 +20,7 @@ export struct ImageDownloadComponent {
20 @State image: PixelMap | undefined = undefined; 20 @State image: PixelMap | undefined = undefined;
21 @State photoAccessHelper: photoAccessHelper.PhotoAccessHelper | undefined = undefined; // 相册模块管理实例 21 @State photoAccessHelper: photoAccessHelper.PhotoAccessHelper | undefined = undefined; // 相册模块管理实例
22 @State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer 22 @State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer
23 - url: string = '' 23 + @Prop @Watch('onChangeUrl') url: string = ''
24 24
25 build() { 25 build() {
26 Column() { 26 Column() {
@@ -40,7 +40,11 @@ export struct ImageDownloadComponent { @@ -40,7 +40,11 @@ export struct ImageDownloadComponent {
40 40
41 } 41 }
42 42
43 - async aboutToAppear(): Promise<void> { 43 + aboutToAppear(): void {
  44 + this.onChangeUrl()
  45 + }
  46 +
  47 + async onChangeUrl(): Promise<void> {
44 console.info(`cj2024 图片下载 ${this.url}`) 48 console.info(`cj2024 图片下载 ${this.url}`)
45 const context = getContext(this) as common.UIAbilityContext; 49 const context = getContext(this) as common.UIAbilityContext;
46 const atManager = abilityAccessCtrl.createAtManager(); 50 const atManager = abilityAccessCtrl.createAtManager();
1 -import { PhotoListBean } from 'wdBean/Index';  
2 -import { Logger } from 'wdKit/Index';  
3 -import { display, router } from '@kit.ArkUI';  
4 -import { ImageDownloadComponent } from './ImageDownloadComponent';  
5 -import { ImageItemView } from './view/ImageItemView';  
6 -  
7 -const TAG = 'ImageSwiperComponent';  
8 -  
9 -@Component  
10 -export struct ImageSwiperComponent {  
11 - @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01'  
12 - private scroller: Scroller = new Scroller()  
13 - @State swiperIndex: number = 0;  
14 - photoList: PhotoListBean[] = [];  
15 - private swiperController: SwiperController = new SwiperController()  
16 - private displayTool = display.getDefaultDisplaySync()  
17 - private screenWidth: number = 0  
18 - private picWidth: number = 0  
19 - @State picHeight: number = 0  
20 - @State isEnableSwipe: boolean = true;  
21 -  
22 - // @Provide bgc: Color = Color.White;  
23 -  
24 - //watch监听页码回调  
25 - onCurrentPageNumUpdated(): void {  
26 - Logger.info(TAG, `currentPageNum:${this.currentPageNum}`,)  
27 - let _swiperIndex = Number.parseInt(this.currentPageNum)  
28 - Logger.info(TAG, `_swiperIndex:${_swiperIndex}`)  
29 - this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex  
30 - }  
31 -  
32 - aboutToAppear(): void {  
33 - //获取宽高尺寸  
34 - this.screenWidth = this.displayTool.width  
35 - // this.picWidth = this.screenWidth - vp2px(52)  
36 - this.picWidth = this.screenWidth  
37 - this.picHeight = this.picWidth * 578 / 375  
38 - }  
39 -  
40 - build() {  
41 - RelativeContainer() {  
42 - Image($r('app.media.icon_arrow_left_white'))  
43 - .width(24)  
44 - .height(24)  
45 - .aspectRatio(1)  
46 - .interpolation(ImageInterpolation.High)  
47 - .alignRules({  
48 - top: { anchor: "__container__", align: VerticalAlign.Top },  
49 - left: { anchor: "__container__", align: HorizontalAlign.Start }  
50 - })  
51 - .onClick(() => {  
52 - router.back();  
53 - })  
54 - .id("backImg")  
55 -  
56 - if (this.photoList && this.photoList?.length > 0) {  
57 - Swiper(this.swiperController) {  
58 - ForEach(this.photoList, (item: PhotoListBean) => {  
59 - // MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })  
60 - ImageItemView({ MultiPictureDetailItem: item, isEnableSwipe: this.isEnableSwipe })  
61 - })  
62 - }  
63 - .index(this.swiperIndex)  
64 - .width('100%')  
65 - .height(px2vp(this.picHeight) + 32)  
66 - .vertical(false)  
67 - .autoPlay(false)  
68 - .cachedCount(3)  
69 - .indicator(false)  
70 - .displayCount(1)  
71 - .id('e_swiper_content')  
72 - .alignRules({  
73 - center: { anchor: "__container__", align: VerticalAlign.Center },  
74 - middle: { anchor: "__container__", align: HorizontalAlign.Center }  
75 - })  
76 - .onChange((index: number) => {  
77 - this.swiperIndex = index  
78 - })  
79 -  
80 - Row() {  
81 - Scroll(this.scroller) {  
82 - Row() {  
83 - Flex({  
84 - direction: FlexDirection.Column,  
85 - justifyContent: FlexAlign.Start  
86 - }) {  
87 - Text() {  
88 - Span(`${this.swiperIndex + 1}`)  
89 - .fontSize(24)  
90 - .fontFamily('PingFang SC-Medium')  
91 - .fontWeight(500)  
92 - .lineHeight(28)  
93 - Span(`/${this.photoList.length}`)  
94 - .fontSize(14)  
95 - .fontFamily('PingFang SC-Medium')  
96 - .fontWeight(500)  
97 - .lineHeight(19)  
98 - }.fontColor(Color.White).margin(4)  
99 - }  
100 - }  
101 - .width('100%')  
102 - .margin({  
103 - top: 8,  
104 - left: 18,  
105 - bottom: 24,  
106 - right: 18  
107 - })  
108 - }  
109 - .scrollable(ScrollDirection.Vertical)  
110 - .scrollBarWidth(0)  
111 - }  
112 - .id('e_swiper_titles')  
113 - .alignRules({  
114 - bottom: { anchor: "__container__", align: VerticalAlign.Bottom },  
115 - middle: { anchor: "__container__", align: HorizontalAlign.Center }  
116 - })  
117 - }  
118 -  
119 - ImageDownloadComponent({ url: this.photoList[this.swiperIndex].picPath })  
120 - .alignRules({  
121 - bottom: { anchor: "__container__", align: VerticalAlign.Bottom },  
122 - right: { anchor: "__container__", align: HorizontalAlign.End }  
123 - })  
124 - .margin({  
125 - top: 8,  
126 - left: 18,  
127 - bottom: 24,  
128 - right: 18  
129 - })  
130 - .id("downloadImg")  
131 - }  
132 - .width('100%')  
133 - .height('100%')  
134 - .backgroundColor(Color.Black)  
135 - .id('e_picture_container')  
136 - // 设置顶部绘制延伸到状态栏  
137 - // 设置底部绘制延伸到导航条  
138 - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])  
139 - }  
140 -}  
@@ -152,6 +152,8 @@ export struct MorningEveningPaperComponent { @@ -152,6 +152,8 @@ export struct MorningEveningPaperComponent {
152 if (imageSource) { 152 if (imageSource) {
153 this.pickColor(imageSource) 153 this.pickColor(imageSource)
154 154
  155 + } else {
  156 + this.mixedBgColor = this.pageInfoBean.backgroundColor
155 } 157 }
156 158
157 } 159 }
@@ -168,6 +170,11 @@ export struct MorningEveningPaperComponent { @@ -168,6 +170,11 @@ export struct MorningEveningPaperComponent {
168 } 170 }
169 } 171 }
170 172
  173 + async aboutToDisappear() {
  174 + let windowHight: window.Window = await window.getLastWindow(getContext(this));
  175 + await windowHight.setWindowLayoutFullScreen(false);
  176 + }
  177 +
171 onPageHide() { 178 onPageHide() {
172 this.status = PlayerConstants.STATUS_PAUSE; 179 this.status = PlayerConstants.STATUS_PAUSE;
173 this.playerController?.pause(); 180 this.playerController?.pause();
@@ -21,7 +21,7 @@ export struct MultiPictureDetailItemComponent { @@ -21,7 +21,7 @@ export struct MultiPictureDetailItemComponent {
21 .alt($r('app.media.picture_loading')) 21 .alt($r('app.media.picture_loading'))
22 .width(this.imageWidth) 22 .width(this.imageWidth)
23 .aspectRatio(this.ratio) 23 .aspectRatio(this.ratio)
24 - .objectFit(ImageFit.Fill) 24 + .objectFit(ImageFit.Contain)
25 .interpolation(ImageInterpolation.High) 25 .interpolation(ImageInterpolation.High)
26 .onComplete(event => { 26 .onComplete(event => {
27 this.imageWidth = '100%' 27 this.imageWidth = '100%'
1 -import { NetworkUtil, Logger, NetworkType, SPHelper, } from 'wdKit'; 1 +import { NetworkUtil, Logger, NetworkType, SPHelper, WindowModel} from 'wdKit';
2 import { ResponseDTO } from 'wdNetwork'; 2 import { ResponseDTO } from 'wdNetwork';
3 import { 3 import {
4 ContentDetailDTO, 4 ContentDetailDTO,
@@ -12,6 +12,8 @@ import display from '@ohos.display'; @@ -12,6 +12,8 @@ import display from '@ohos.display';
12 import font from '@ohos.font'; 12 import font from '@ohos.font';
13 import { OperRowListView } from './view/OperRowListView'; 13 import { OperRowListView } from './view/OperRowListView';
14 import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent'; 14 import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent';
  15 +import { ImageDownloadComponent } from '../components/ImageDownloadComponent';
  16 +import { publishCommentModel } from '../components/comment/model/PublishCommentModel';
15 import { EmptyComponent } from './view/EmptyComponent'; 17 import { EmptyComponent } from './view/EmptyComponent';
16 import { DateTimeUtils } from 'wdKit/Index'; 18 import { DateTimeUtils } from 'wdKit/Index';
17 import { HttpUrlUtils } from 'wdNetwork/Index'; 19 import { HttpUrlUtils } from 'wdNetwork/Index';
@@ -37,9 +39,11 @@ export struct MultiPictureDetailPageComponent { @@ -37,9 +39,11 @@ export struct MultiPictureDetailPageComponent {
37 private swiperController: SwiperController = new SwiperController() 39 private swiperController: SwiperController = new SwiperController()
38 private swiperControllerItem: SwiperController = new SwiperController() 40 private swiperControllerItem: SwiperController = new SwiperController()
39 @State swiperIndex: number = 0; 41 @State swiperIndex: number = 0;
40 - @Provide followStatus: string = '0' // 关注状态 42 + @Provide followStatus: string | undefined = undefined // 关注状态
41 private scroller: Scroller = new Scroller() 43 private scroller: Scroller = new Scroller()
42 @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图 44 @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图
  45 + @State showDownload: Boolean = false // 控制是否显示下载默认隐藏
  46 + @State publishCommentModel: publishCommentModel = new publishCommentModel()
43 47
44 //watch监听页码回调 48 //watch监听页码回调
45 onCurrentPageNumUpdated(): void { 49 onCurrentPageNumUpdated(): void {
@@ -78,125 +82,169 @@ export struct MultiPictureDetailPageComponent { @@ -78,125 +82,169 @@ export struct MultiPictureDetailPageComponent {
78 82
79 build() { 83 build() {
80 RelativeContainer() { 84 RelativeContainer() {
81 - if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) {  
82 - Swiper(this.swiperController) {  
83 - ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => {  
84 - Swiper(this.swiperControllerItem) {  
85 - MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) 85 + this.init()
  86 + }
  87 + .width('100%')
  88 + .height('100%')
  89 + .backgroundColor(Color.Black)
  90 + .id('e_picture_container')
  91 + // 设置顶部绘制延伸到状态栏
  92 + // 设置底部绘制延伸到导航条
  93 + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
  94 + }
  95 +
  96 + @Builder
  97 + init() {
  98 + if (this.contentDetailData.rmhPlatform == 1) {
  99 + Row() {
  100 + Row({ space: 8 }) {
  101 + Row() {
  102 + Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl)
  103 + .borderRadius(24)
  104 + .aspectRatio(1)
  105 + .border({ width: 1, color: Color.White, style: BorderStyle.Solid })
  106 + .alt($r('app.media.picture_loading'))
  107 + .width(36)
  108 + .height(36)
  109 + .objectFit(ImageFit.Fill)
  110 + .interpolation(ImageInterpolation.High)
  111 + }
  112 + .width('13%')
  113 + .height('100%')
  114 +
  115 + Row() {
  116 + Flex({
  117 + direction: FlexDirection.Column,
  118 + justifyContent: FlexAlign.SpaceAround,
  119 + alignItems: ItemAlign.Start
  120 + }) {
  121 + Text(`${this.contentDetailData?.rmhInfo?.rmhName}`)
  122 + .fontColor(Color.White)
  123 + .fontSize(14)
  124 + .fontFamily('PingFang PingFang SC-Medium')
  125 + .fontWeight(500)
  126 + .lineHeight(17)
  127 + .margin(0)
  128 + .height(17)
  129 + Text(`${this.contentDetailData?.rmhInfo?.rmhDesc}`)
  130 + .fontColor('#676767')
  131 + .fontSize(12)
  132 + .fontFamily('PingFang SC-Regular')
  133 + .fontWeight(400)
  134 + .lineHeight(14)
  135 + .height(14)
  136 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  137 + .margin(0)
  138 + .maxLines(1)
86 } 139 }
87 - .width('100%')  
88 - .height('100%')  
89 - .vertical(true)  
90 - .autoPlay(false)  
91 - .cachedCount(1)  
92 - .indicator(false)  
93 - .displayCount(1)  
94 - .onAnimationEnd(event => {  
95 - router.back()  
96 - })  
97 - }) 140 + }
  141 + .width('81%')
  142 + .height('100%')
98 } 143 }
99 - .index(this.swiperIndex)  
100 - .width('100%')  
101 - .height(px2vp(this.picHeight) + 32)  
102 - .vertical(false)  
103 - .autoPlay(false)  
104 - .cachedCount(3)  
105 - .indicator(false)  
106 - .displayCount(1)  
107 - .loop(false)  
108 - .id('e_swiper_content')  
109 - .alignRules({  
110 - center: { anchor: "__container__", align: VerticalAlign.Center },  
111 - middle: { anchor: "__container__", align: HorizontalAlign.Center }  
112 - })  
113 - .onChange((index: number) => {  
114 - this.swiperIndex = index 144 + .width('74.4%')
  145 + .height('100%')
  146 + .margin({
  147 + top: 0,
  148 + bottom: 0,
  149 + left: 16,
  150 + right: 0
115 }) 151 })
116 152
117 - if (this.contentDetailData.rmhPlatform == 1) {  
118 - Row() {  
119 - Row({ space: 8 }) {  
120 - Row() {  
121 - Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl)  
122 - .borderRadius(24)  
123 - .aspectRatio(1)  
124 - .border({ width: 1, color: Color.White, style: BorderStyle.Solid })  
125 - .alt($r('app.media.picture_loading'))  
126 - .width(36)  
127 - .height(36)  
128 - .objectFit(ImageFit.Fill)  
129 - .interpolation(ImageInterpolation.High)  
130 - }  
131 - .width('13%')  
132 - .height('100%')  
133 - 153 + Row() {
  154 + if (this.followStatus == '0') {
  155 + Button({ type: ButtonType.Normal, stateEffect: true }) {
134 Row() { 156 Row() {
135 - Flex({  
136 - direction: FlexDirection.Column,  
137 - justifyContent: FlexAlign.SpaceAround,  
138 - alignItems: ItemAlign.Start  
139 - }) {  
140 - Text(`${this.contentDetailData?.rmhInfo?.rmhName}`)  
141 - .fontColor(Color.White)  
142 - .fontSize(14)  
143 - .fontFamily('PingFang PingFang SC-Medium')  
144 - .fontWeight(500)  
145 - .lineHeight(17)  
146 - .margin(0)  
147 - .height(17)  
148 - Text(`${this.contentDetailData?.rmhInfo?.rmhDesc}`)  
149 - .fontColor('#676767')  
150 - .fontSize(12)  
151 - .fontFamily('PingFang SC-Regular')  
152 - .fontWeight(400)  
153 - .lineHeight(14)  
154 - .height(14)  
155 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
156 - .margin(0)  
157 - }  
158 - }  
159 - .width('81%')  
160 - .height('100%') 157 + Text('+关注').fontSize(12).fontColor(0xffffff)
  158 + }.alignItems(VerticalAlign.Center)
161 } 159 }
162 - .width('74.4%')  
163 - .height('100%')  
164 - .margin({  
165 - top: 0,  
166 - bottom: 0,  
167 - left: 16,  
168 - right: 0 160 + .borderRadius(4)
  161 + .backgroundColor('#ED2800')
  162 + .width(48)
  163 + .height(24)
  164 + .onClick(() => {
  165 + this.handleAccention()
169 }) 166 })
170 -  
171 - if (this.followStatus == '0') { 167 + } else {
  168 + Button({ type: ButtonType.Normal, stateEffect: true }) {
172 Row() { 169 Row() {
173 - Button({ type: ButtonType.Normal, stateEffect: true }) {  
174 - Row() {  
175 - Text('+关注').fontSize(12).fontColor(0xffffff)  
176 - }.alignItems(VerticalAlign.Center)  
177 - }  
178 - .borderRadius(4)  
179 - .backgroundColor('#ED2800')  
180 - .width(48)  
181 - .height(24)  
182 - .onClick(() => {  
183 - this.handleAccention()  
184 - })  
185 - }  
186 - .justifyContent(FlexAlign.Center)  
187 - .alignItems(VerticalAlign.Center)  
188 - .width('21.6%')  
189 - .height('100%') 170 + Text('已关注').fontSize(12).fontColor(0xffffff)
  171 + }.alignItems(VerticalAlign.Center)
190 } 172 }
  173 + .borderRadius(4)
  174 + .backgroundColor('#B0B0B0')
  175 + .width(48)
  176 + .height(24)
  177 + }
  178 +
  179 + }
  180 + .justifyContent(FlexAlign.Center)
  181 + .alignItems(VerticalAlign.Center)
  182 + .width('21.6%')
  183 + .height('100%')
  184 + }
  185 + .width('100%')
  186 + .height(44)
  187 + .zIndex(10)
  188 + .alignRules({
  189 + top: { anchor: "__container__", align: VerticalAlign.Top },
  190 + middle: { anchor: "__container__", align: HorizontalAlign.Center }
  191 + })
  192 + .id('e_attention')
  193 + }
  194 + if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) {
  195 + Swiper(this.swiperController) {
  196 + ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => {
  197 + Swiper(this.swiperControllerItem) {
  198 + MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })
191 } 199 }
192 .width('100%') 200 .width('100%')
193 - .height(44)  
194 - .alignRules({  
195 - top: { anchor: "e_swiper_content", align: VerticalAlign.Top },  
196 - middle: { anchor: "e_swiper_content", align: HorizontalAlign.Center } 201 + .height('100%')
  202 + .vertical(true)
  203 + .autoPlay(false)
  204 + .cachedCount(1)
  205 + .indicator(false)
  206 + .displayCount(1)
  207 + .onAnimationEnd(event => {
  208 + router.back()
197 }) 209 })
198 - .id('e_attention') 210 + })
  211 + }
  212 + .index(this.swiperIndex)
  213 + .width('100%')
  214 + .height('100%')
  215 + .vertical(false)
  216 + .autoPlay(false)
  217 + .cachedCount(3)
  218 + .indicator(false)
  219 + .displayCount(1)
  220 + .loop(false)
  221 + .id('e_swiper_content')
  222 + .alignRules({
  223 + center: { anchor: "__container__", align: VerticalAlign.Center },
  224 + middle: { anchor: "__container__", align: HorizontalAlign.Center }
  225 + })
  226 + .zIndex(1)
  227 + .onChange((index: number) => {
  228 + this.swiperIndex = index
  229 + })
  230 + .onClick(() => {
  231 + this.showDownload = !this.showDownload
  232 + })
  233 + }
  234 + if (this.netStatus !== undefined) {
  235 + EmptyComponent({
  236 + emptyType: this.netStatus, emptyButton: true, retry: () => {
  237 + this.getContentDetailData()
199 } 238 }
  239 + })
  240 + .id('e_empty_content')
  241 + .alignRules({
  242 + center: { anchor: "__container__", align: VerticalAlign.Center },
  243 + middle: { anchor: "__container__", align: HorizontalAlign.Center }
  244 + })
  245 + }
  246 + Column(){
  247 + Column(){
200 Row() { 248 Row() {
201 Scroll(this.scroller) { 249 Scroll(this.scroller) {
202 Row() { 250 Row() {
@@ -210,12 +258,14 @@ export struct MultiPictureDetailPageComponent { @@ -210,12 +258,14 @@ export struct MultiPictureDetailPageComponent {
210 .fontFamily('PingFang SC-Medium') 258 .fontFamily('PingFang SC-Medium')
211 .fontWeight(500) 259 .fontWeight(500)
212 .lineHeight(28) 260 .lineHeight(28)
213 - Span(`/${this.contentDetailData.photoList.length}`) 261 + Span(`/${this.contentDetailData?.photoList?.length}`)
214 .fontSize(14) 262 .fontSize(14)
215 .fontFamily('PingFang SC-Medium') 263 .fontFamily('PingFang SC-Medium')
216 .fontWeight(500) 264 .fontWeight(500)
217 .lineHeight(19) 265 .lineHeight(19)
218 - }.fontColor(Color.White).margin(4) 266 + }
  267 + .fontColor(Color.White)
  268 + .margin(4)
219 269
220 Text(`${this.contentDetailData.newsTitle}`) 270 Text(`${this.contentDetailData.newsTitle}`)
221 .fontColor(Color.White) 271 .fontColor(Color.White)
@@ -246,62 +296,61 @@ export struct MultiPictureDetailPageComponent { @@ -246,62 +296,61 @@ export struct MultiPictureDetailPageComponent {
246 } 296 }
247 } 297 }
248 .width('100%') 298 .width('100%')
249 - .margin({  
250 - top: 8,  
251 - left: 18,  
252 - bottom: 24,  
253 - right: 18  
254 - })  
255 } 299 }
256 .scrollable(ScrollDirection.Vertical) 300 .scrollable(ScrollDirection.Vertical)
257 .scrollBarWidth(0) 301 .scrollBarWidth(0)
258 .height(px2vp(this.titleHeight)) 302 .height(px2vp(this.titleHeight))
  303 + .align(Alignment.Bottom)
259 } 304 }
260 - .id('e_swiper_titles')  
261 - .alignRules({  
262 - bottom: { anchor: "__container__", align: VerticalAlign.Bottom },  
263 - middle: { anchor: "__container__", align: HorizontalAlign.Center } 305 + OperRowListView({
  306 + contentDetailData: this.contentDetailData,
  307 + publishCommentModel: this.publishCommentModel,
264 }) 308 })
265 - .height(px2vp(this.titleHeight) + 64)  
266 - 309 + .width('100%')
  310 + .height(56)
  311 + .border({ width: { top: 0.5 }, color: '#FFFFFF' })
267 } 312 }
268 - if (this.netStatus !== undefined) {  
269 - EmptyComponent({  
270 - emptyType: this.netStatus, emptyButton: true, retry: () => {  
271 - this.getContentDetailData() 313 + .visibility(!this.showDownload ? Visibility.Visible : Visibility.None)
  314 + Column(){
  315 + Row() {
  316 + Flex({
  317 + direction: FlexDirection.Row,
  318 + justifyContent: FlexAlign.SpaceBetween
  319 + }) {
  320 + Text() {
  321 + Span(`${this.swiperIndex + 1}`)
  322 + .fontSize(24)
  323 + .fontFamily('PingFang SC-Medium')
  324 + .fontWeight(500)
  325 + .lineHeight(28)
  326 + Span(`/${this.contentDetailData?.photoList?.length}`)
  327 + .fontSize(14)
  328 + .fontFamily('PingFang SC-Medium')
  329 + .fontWeight(500)
  330 + .lineHeight(19)
  331 + }
  332 + .fontColor(Color.White)
  333 + .margin(4)
  334 +
  335 + ImageDownloadComponent({ url: this.contentDetailData.photoList?.[this.swiperIndex].picPath })
  336 + .margin({
  337 + top: 8,
  338 + left: 18,
  339 + bottom: 24,
  340 + right: 18
  341 + })
272 } 342 }
273 - })  
274 - .id('e_empty_content')  
275 - .alignRules({  
276 - center: { anchor: "__container__", align: VerticalAlign.Center },  
277 - middle: { anchor: "__container__", align: HorizontalAlign.Center }  
278 - })  
279 - }  
280 - OperRowListView({  
281 - contentDetailData: this.contentDetailData,  
282 - })  
283 - .alignRules({  
284 - bottom: { anchor: "__container__", align: VerticalAlign.Bottom },  
285 - middle: { anchor: "__container__", align: HorizontalAlign.Center }  
286 - }) 343 + }
287 .width('100%') 344 .width('100%')
288 - .height(56)  
289 - .margin({  
290 - top: 16,  
291 - left: 16,  
292 - right: 16,  
293 - bottom: 0  
294 - })  
295 - .border({ width: { top: 0.5 }, color: '#FFFFFF' })  
296 - .id('e_oper_row') 345 + }
  346 + .visibility(this.showDownload ? Visibility.Visible : Visibility.None)
297 } 347 }
298 - .width('100%')  
299 - .height('100%')  
300 - .backgroundColor(Color.Black)  
301 - .id('e_picture_container')  
302 - // 设置顶部绘制延伸到状态栏  
303 - // 设置底部绘制延伸到导航条  
304 - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) 348 + .zIndex(10)
  349 + .id('e_swiper_bottom')
  350 + .alignRules({
  351 + bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
  352 + middle: { anchor: "__container__", align: HorizontalAlign.Center }
  353 + })
305 } 354 }
306 355
307 getContentDetailData() { 356 getContentDetailData() {
@@ -318,6 +367,20 @@ export struct MultiPictureDetailPageComponent { @@ -318,6 +367,20 @@ export struct MultiPictureDetailPageComponent {
318 } 367 }
319 this.netStatus = undefined 368 this.netStatus = undefined
320 this.contentDetailData = resDTO.data?.[0]; 369 this.contentDetailData = resDTO.data?.[0];
  370 + if (this.contentDetailData.rmhPlatform == 1) {
  371 + WindowModel.shared.setWindowSystemBarProperties({
  372 + statusBarContentColor: '#ffffff',
  373 + })
  374 + }
  375 + if (this.contentDetailData?.openComment) {
  376 + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
  377 + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
  378 + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
  379 + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
  380 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
  381 + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
  382 + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
  383 + }
321 // this.contentDetailData.photoList = [] 384 // this.contentDetailData.photoList = []
322 if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { 385 if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
323 // 暂无内容 386 // 暂无内容
1 -import { Action, H5ReceiveDetailBean } from 'wdBean'; 1 +import { Action, H5ReceiveDetailBean, ContentDetailDTO } from 'wdBean';
2 import { WdWebComponent } from 'wdWebComponent'; 2 import { WdWebComponent } from 'wdWebComponent';
3 import router from '@ohos.router'; 3 import router from '@ohos.router';
4 import { CommonConstants } from 'wdConstant' 4 import { CommonConstants } from 'wdConstant'
5 import { BridgeWebViewControl } from 'wdJsBridge/Index'; 5 import { BridgeWebViewControl } from 'wdJsBridge/Index';
6 import { detailedSkeleton } from './skeleton/detailSkeleton' 6 import { detailedSkeleton } from './skeleton/detailSkeleton'
7 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; 7 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type';
8 -const TAG = 'SpacialTopicPageComponent' 8 +import { OperRowListView } from './view/OperRowListView';
  9 +import DetailViewModel from '../viewmodel/DetailViewModel';
  10 +import { publishCommentModel } from '../components/comment/model/PublishCommentModel';
  11 +
  12 +const TAG: string = 'SpacialTopicPageComponent'
9 13
10 @Component 14 @Component
11 export struct SpacialTopicPageComponent { 15 export struct SpacialTopicPageComponent {
@@ -14,9 +18,11 @@ export struct SpacialTopicPageComponent { @@ -14,9 +18,11 @@ export struct SpacialTopicPageComponent {
14 action: Action = {} as Action 18 action: Action = {} as Action
15 @State webUrl: string = ''; 19 @State webUrl: string = '';
16 @State isPageEnd: boolean = false 20 @State isPageEnd: boolean = false
  21 + @State contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO []
17 private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean 22 private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
18 private webPrepared = false; 23 private webPrepared = false;
19 private dataPrepared = false; 24 private dataPrepared = false;
  25 + @State publishCommentModel: publishCommentModel = new publishCommentModel()
20 26
21 private trySendData2H5() { 27 private trySendData2H5() {
22 if (!this.webPrepared || !this.dataPrepared) { 28 if (!this.webPrepared || !this.dataPrepared) {
@@ -37,11 +43,42 @@ export struct SpacialTopicPageComponent { @@ -37,11 +43,42 @@ export struct SpacialTopicPageComponent {
37 }) 43 })
38 } 44 }
39 45
  46 + private async getDetail() {
  47 + let contentId: string = ''
  48 + let relId: string = ''
  49 + let relType: string = ''
  50 + if (this.action && this.action.params) {
  51 + if (this.action.params.contentID) {
  52 + contentId = this.action.params.contentID;
  53 + }
  54 + if (this.action && this.action.params && this.action.params.extra) {
  55 + if (this.action.params.extra.relId) {
  56 + relId = this.action.params.extra.relId;
  57 + }
  58 + if (this.action.params.extra.relType) {
  59 + relType = this.action.params.extra.relType
  60 + }
  61 +
  62 + }
  63 + let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
  64 + if (detailBeans && detailBeans.length > 0) {
  65 + this.contentDetailData = detailBeans;
  66 + if (this.contentDetailData[0]?.openComment) {
  67 + this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '')
  68 + this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId)
  69 + this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle
  70 + this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType)
  71 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId)
  72 + this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle)
  73 + this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType)
  74 + }
  75 + this.trySendData2H5()
  76 + }
  77 + }
  78 + }
  79 +
40 build() { 80 build() {
41 Column() { 81 Column() {
42 - if (!this.isPageEnd) {  
43 - detailedSkeleton()  
44 - }  
45 Stack({ alignContent: Alignment.Bottom }) { 82 Stack({ alignContent: Alignment.Bottom }) {
46 Column() { 83 Column() {
47 WdWebComponent({ 84 WdWebComponent({
@@ -52,62 +89,25 @@ export struct SpacialTopicPageComponent { @@ -52,62 +89,25 @@ export struct SpacialTopicPageComponent {
52 isPageEnd: $isPageEnd 89 isPageEnd: $isPageEnd
53 }) 90 })
54 } 91 }
55 - .padding({ bottom: 56 })  
56 .width(CommonConstants.FULL_WIDTH) 92 .width(CommonConstants.FULL_WIDTH)
57 .height(CommonConstants.FULL_HEIGHT) 93 .height(CommonConstants.FULL_HEIGHT)
58 94
59 - //底部交互区  
60 - Row() {  
61 - Image($r('app.media.icon_arrow_left'))  
62 - .width(24)  
63 - .height(24)  
64 - .onClick((event: ClickEvent) => {  
65 - router.back()  
66 - })  
67 -  
68 - Row() {  
69 - Image($r('app.media.icon_comment'))  
70 - .width(24)  
71 - .height(24)  
72 - .margin({ right: 24 })  
73 - .id('comment')  
74 -  
75 - Image($r('app.media.icon_star'))  
76 - .width(24)  
77 - .height(24)  
78 - .margin({ right: 24 })  
79 -  
80 - Image($r('app.media.icon_listen'))  
81 - .width(24)  
82 - .height(24)  
83 - .margin({ right: 24 })  
84 -  
85 - Image($r('app.media.icon_forward'))  
86 - .width(24)  
87 - .height(24)  
88 -  
89 - } 95 + if (!this.isPageEnd) {
  96 + detailedSkeleton()
90 } 97 }
91 - .width(CommonConstants.FULL_WIDTH)  
92 - .height(56)  
93 - .padding({ left: 15, right: 15, bottom: 20, top: 20 })  
94 - .justifyContent(FlexAlign.SpaceBetween)  
95 - .backgroundColor(Color.White)  
96 - 98 + //底部交互区
  99 + OperRowListView({
  100 + contentDetailData: this.contentDetailData[0],
  101 + publishCommentModel: this.publishCommentModel
  102 + })
97 } 103 }
98 }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) 104 }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
99 - .backgroundColor(Color.White)  
100 } 105 }
101 106
102 aboutToAppear() { 107 aboutToAppear() {
103 - let action: Action = router.getParams() as Action  
104 - if (action) {  
105 - this.webUrl = action.params?.url || '' 108 + if (this.action) {
  109 + this.webUrl = this.action.params?.url || ''
106 } 110 }
107 - this.trySendData2H5()  
108 - }  
109 -  
110 - aboutToDisappear() {  
111 - 111 + this.getDetail()
112 } 112 }
113 } 113 }
@@ -30,7 +30,7 @@ export struct LiveFollowComponent { @@ -30,7 +30,7 @@ export struct LiveFollowComponent {
30 Stack() { 30 Stack() {
31 Stack() 31 Stack()
32 .height(22) 32 .height(22)
33 - .width(130) 33 + .width(150)
34 .backgroundColor('#000000') 34 .backgroundColor('#000000')
35 .opacity(0.3) 35 .opacity(0.3)
36 .borderRadius({ 36 .borderRadius({
@@ -71,7 +71,7 @@ export struct LiveFollowComponent { @@ -71,7 +71,7 @@ export struct LiveFollowComponent {
71 }) 71 })
72 } 72 }
73 .height(22) 73 .height(22)
74 - .width(130) 74 + .width(150)
75 } 75 }
76 } 76 }
77 77
@@ -3,10 +3,12 @@ @@ -3,10 +3,12 @@
3 */ 3 */
4 import { RmhInfoDTO } from 'wdBean' 4 import { RmhInfoDTO } from 'wdBean'
5 import { CommonConstants } from 'wdConstant/Index'; 5 import { CommonConstants } from 'wdConstant/Index';
  6 +import { DateTimeUtils } from 'wdKit';
6 7
7 @Component 8 @Component
8 export struct RmhTitle { 9 export struct RmhTitle {
9 @Prop rmhInfo: RmhInfoDTO 10 @Prop rmhInfo: RmhInfoDTO
  11 + @Prop publishTime: string | undefined
10 12
11 build() { 13 build() {
12 Flex() { 14 Flex() {
@@ -29,12 +31,22 @@ export struct RmhTitle { @@ -29,12 +31,22 @@ export struct RmhTitle {
29 .fontColor($r('app.color.color_222222')) 31 .fontColor($r('app.color.color_222222'))
30 .fontWeight(600) 32 .fontWeight(600)
31 .alignSelf(ItemAlign.Start) 33 .alignSelf(ItemAlign.Start)
32 - Text(this.rmhInfo.rmhDesc)  
33 - .fontSize($r("app.float.font_size_12"))  
34 - .fontColor($r("app.color.color_B0B0B0"))  
35 - .maxLines(1)  
36 - .alignSelf(ItemAlign.Start)  
37 - .textOverflow({ overflow: TextOverflow.Ellipsis }) 34 + Row() {
  35 + if (this.publishTime) {
  36 + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime)))
  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(this.rmhInfo.rmhDesc)
  44 + .fontSize($r("app.float.font_size_12"))
  45 + .fontColor($r("app.color.color_B0B0B0"))
  46 + .maxLines(1)
  47 + .alignSelf(ItemAlign.Start)
  48 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  49 + }
38 } 50 }
39 51
40 Blank() 52 Blank()
1 import { CompStyle } from 'wdConstant'; 1 import { CompStyle } from 'wdConstant';
2 import { CompDTO } from 'wdBean'; 2 import { CompDTO } from 'wdBean';
3 -import { CardAdvComponent } from './CardAdvComponent';  
4 import { CardAdvThreeImageComponent } from './CardAdvThreeImageComponent'; 3 import { CardAdvThreeImageComponent } from './CardAdvThreeImageComponent';
5 import { CardAdvSmallImageComponent } from './CardAdvSmallImageComponent'; 4 import { CardAdvSmallImageComponent } from './CardAdvSmallImageComponent';
6 import { CardAdvLongImageComponent } from './CardAdvLongImageComponent'; 5 import { CardAdvLongImageComponent } from './CardAdvLongImageComponent';
1 -//全标题 "appStyle":"2",  
2 -import { CompDTO, ContentDTO } from 'wdBean'; 1 +import { CompDTO } from 'wdBean';
3 import { CommonConstants } from 'wdConstant/Index'; 2 import { CommonConstants } from 'wdConstant/Index';
4 import { ProcessUtils } from 'wdRouter'; 3 import { ProcessUtils } from 'wdRouter';
5 -import { CardMediaInfo } from '../cardCommon/CardMediaInfo'  
6 -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' 4 +import { CardAdvBottom } from './CardAdvBottom';
7 5
8 const TAG: string = 'Card2Component'; 6 const TAG: string = 'Card2Component';
9 7
10 -/**  
11 - * @Description: 广告---大图卡  
12 - * @Author:  
13 - * @Email: liyubing@wondertek.com.cn  
14 - * @CreateDate:  
15 - * @UpdateRemark: 更新说明  
16 - * @Version: 1.0 8 +/**
  9 + * @Description: 广告---大图卡
  10 + * @Author:
  11 + * @Email: liyubing@wondertek.com.cn
  12 + * @CreateDate:
  13 + * @UpdateRemark: 更新说明
  14 + * @Version: 1.0
17 */ 15 */
18 @Component 16 @Component
19 export struct CardAdvBigImageComponent { 17 export struct CardAdvBigImageComponent {
20 -  
21 @State compDTO: CompDTO = {} as CompDTO 18 @State compDTO: CompDTO = {} as CompDTO
22 19
  20 +
23 aboutToAppear(): void { 21 aboutToAppear(): void {
24 22
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----') 23 + console.error('ZZZXXXXX', '----大图卡----aboutToAppear-----')
  24 +
  25 +
26 } 26 }
27 27
28 aboutToDisappear(): void { 28 aboutToDisappear(): void {
29 29
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----') 30 + console.error('ZZZXXXXX', '---大图卡-----aboutToDisappear-----')
31 } 31 }
32 32
33 build() { 33 build() {
34 34
35 Column() { 35 Column() {
36 - Text(this.compDTO.matInfo.advTitle)  
37 - .fontSize($r('app.float.font_size_17'))  
38 - .fontColor($r('app.color.color_222222'))  
39 - .maxLines(3)  
40 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
41 - .align(Alignment.Start) 36 +
  37 + //新闻标题
  38 + Text(this.compDTO.matInfo.advTitle).bottomTextStyle().margin({ bottom: 8, })
  39 + //大图
  40 + Image(this.compDTO.matInfo.matImageUrl[0])
  41 + .width(CommonConstants.FULL_WIDTH)
  42 + .aspectRatio(16 / 9)
  43 + .borderRadius(4)
  44 + .borderWidth(0.5)
  45 + .borderColor($r('app.color.color_0D000000'))
  46 + .width(CommonConstants.FULL_WIDTH)
  47 +
  48 + CardAdvBottom().margin({
  49 + top: 8,
  50 + })
42 } 51 }
43 .width(CommonConstants.FULL_WIDTH) 52 .width(CommonConstants.FULL_WIDTH)
44 .padding({ 53 .padding({
@@ -48,13 +57,21 @@ export struct CardAdvBigImageComponent { @@ -48,13 +57,21 @@ export struct CardAdvBigImageComponent {
48 bottom: $r('app.float.card_comp_pagePadding_tb') 57 bottom: $r('app.float.card_comp_pagePadding_tb')
49 }) 58 })
50 .onClick((event: ClickEvent) => { 59 .onClick((event: ClickEvent) => {
51 - //ProcessUtils.processPage(this.contentDTO) 60 + ProcessUtils.openAdvDetail(this.compDTO.matInfo)
52 }) 61 })
53 } 62 }
54 } 63 }
55 64
  65 +/*
  66 + 标题样式
  67 + */
56 @Extend(Text) 68 @Extend(Text)
57 function bottomTextStyle() { 69 function bottomTextStyle() {
58 - .fontSize(12)  
59 - .fontColor('#B0B0B0') 70 + .fontSize('18fp')
  71 + .fontColor($r('app.color.color_222222'))
  72 + .maxLines(3)
  73 + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
  74 + .align(Alignment.Start)
  75 + .width('100%')
  76 + .lineHeight(25)
60 } 77 }
  1 +import { CompDTO } from 'wdBean/Index';
  2 +
  3 +/**
  4 + * @Description: 广告稿件 底部标签+删除按钮
  5 + * @Author:
  6 + * @Email: liyubing@wondertek.com.cn
  7 + * @CreateDate:
  8 + * @UpdateRemark: 更新说明
  9 + * @Version: 1.0
  10 + */
  11 +@Component
  12 +export struct CardAdvBottom {
  13 + @State compDTO: CompDTO = {} as CompDTO;
  14 +
  15 + build() {
  16 +
  17 + Row() {
  18 + Text($r('app.string.comp_advertisement')).fontSize('12fp').fontColor($r('app.color.color_B0B0B0'))
  19 +
  20 + Blank()
  21 +
  22 + Stack() {
  23 + Image($r('app.media.comp_adv_close'))
  24 + .width(9)
  25 + .height(9)
  26 + .borderRadius({
  27 + topLeft: '4vp',
  28 + topRight: '4vp',
  29 + bottomLeft: '4vp',
  30 + bottomRight: '4vp'
  31 + })
  32 + }
  33 + .width(18)
  34 + .height(14)
  35 + .borderWidth(0.5)
  36 + .borderColor($r('app.color.color_EDEDED'))
  37 + .borderRadius(4)
  38 +
  39 + }.width('100%')
  40 + }
  41 +}
1 -//全标题 "appStyle":"2",  
2 -import { CompDTO, ContentDTO } from 'wdBean';  
3 -import { CommonConstants } from 'wdConstant/Index';  
4 -import { ProcessUtils } from 'wdRouter';  
5 -import { CardMediaInfo } from '../cardCommon/CardMediaInfo'  
6 -import { CardSourceInfo } from '../cardCommon/CardSourceInfo'  
7 -  
8 -const TAG: string = 'Card2Component';  
9 -  
10 -/**  
11 - * @Description: 类描述  
12 - * @Author:  
13 - * @Email: liyubing@wondertek.com.cn  
14 - * @CreateDate:  
15 - * @UpdateRemark: 更新说明  
16 - * @Version: 1.0  
17 - */  
18 -@Component  
19 -export struct CardAdvComponent {  
20 -  
21 - @State compDTO: CompDTO = {} as CompDTO  
22 -  
23 - aboutToAppear(): void {  
24 -  
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----')  
26 - }  
27 -  
28 - aboutToDisappear(): void {  
29 -  
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----')  
31 - }  
32 -  
33 - build() {  
34 -  
35 - Column() {  
36 - Text(this.compDTO.matInfo.advTitle)  
37 - .fontSize($r('app.float.font_size_17'))  
38 - .fontColor($r('app.color.color_222222'))  
39 - .maxLines(3)  
40 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
41 - .align(Alignment.Start)  
42 - }  
43 - .width(CommonConstants.FULL_WIDTH)  
44 - .padding({  
45 - left: $r('app.float.card_comp_pagePadding_lf'),  
46 - right: $r('app.float.card_comp_pagePadding_lf'),  
47 - top: $r('app.float.card_comp_pagePadding_tb'),  
48 - bottom: $r('app.float.card_comp_pagePadding_tb')  
49 - })  
50 - .onClick((event: ClickEvent) => {  
51 - //ProcessUtils.processPage(this.contentDTO)  
52 - })  
53 - }  
54 -}  
55 -  
56 -@Extend(Text)  
57 -function bottomTextStyle() {  
58 - .fontSize(12)  
59 - .fontColor('#B0B0B0')  
60 -}  
1 //全标题 "appStyle":"2", 1 //全标题 "appStyle":"2",
2 import { CompDTO, ContentDTO } from 'wdBean'; 2 import { CompDTO, ContentDTO } from 'wdBean';
  3 +import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/AdvExtraData';
  4 +import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
3 import { CommonConstants } from 'wdConstant/Index'; 5 import { CommonConstants } from 'wdConstant/Index';
4 import { ProcessUtils } from 'wdRouter'; 6 import { ProcessUtils } from 'wdRouter';
5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 7 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
@@ -7,54 +9,194 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo' @@ -7,54 +9,194 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
7 9
8 const TAG: string = 'Card2Component'; 10 const TAG: string = 'Card2Component';
9 11
10 -/**  
11 - * @Description: 广告---冠名广告  
12 - * @Author:  
13 - * @Email: liyubing@wondertek.com.cn  
14 - * @CreateDate:  
15 - * @UpdateRemark: 更新说明  
16 - * @Version: 1.0 12 +/**
  13 + * @Description: 广告---冠名广告
  14 + * @Author:
  15 + * @Email: liyubing@wondertek.com.cn
  16 + * @CreateDate:
  17 + * @UpdateRemark: 更新说明
  18 + * @Version: 1.0
17 */ 19 */
18 @Component 20 @Component
19 export struct CardAdvGanMiComponent { 21 export struct CardAdvGanMiComponent {
20 -  
21 @State compDTO: CompDTO = {} as CompDTO 22 @State compDTO: CompDTO = {} as CompDTO
  23 + @State advExtraData: AdvExtraData = {} as AdvExtraData
  24 + @State advLength: number = 0;
22 25
23 aboutToAppear(): void { 26 aboutToAppear(): void {
24 27
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----') 28 + console.error('ZZZXXXXX', '--冠名广告------aboutToAppear-----')
  29 +
  30 + let extraData = this.compDTO.matInfo.extraData
  31 + let labelDTO = JSON.parse(extraData) as AdvExtraData
  32 + this.advExtraData = labelDTO
  33 + //this.advExtraData.item = [this.advExtraData.item[0]]
  34 + // this.advExtraData.item[2].title ="我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国"
  35 + this.advLength = this.advExtraData.item.length
26 } 36 }
27 37
28 aboutToDisappear(): void { 38 aboutToDisappear(): void {
29 39
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----') 40 + console.error('ZZZXXXXX', '--冠名广告------aboutToDisappear-----')
31 } 41 }
32 42
33 build() { 43 build() {
34 44
35 Column() { 45 Column() {
36 - Text(this.compDTO.matInfo.advTitle)  
37 - .fontSize($r('app.float.font_size_17'))  
38 - .fontColor($r('app.color.color_222222'))  
39 - .maxLines(3)  
40 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
41 - .align(Alignment.Start) 46 +
  47 +
  48 + Row() {
  49 + Stack() {
  50 + //长图
  51 + Image(this.advExtraData.itemTopImage)
  52 + .width(CommonConstants.FULL_WIDTH)
  53 + .aspectRatio(343 / 40)
  54 + .borderRadius(4)
  55 + .borderWidth(0.5)
  56 + .borderColor($r('app.color.color_0D000000'))
  57 +
  58 + // 广告标签和删除功能
  59 + Row() {
  60 + Text($r('app.string.comp_advertisement'))
  61 + .fontSize('10fp')
  62 + .fontColor($r('app.color.white'))
  63 + .width(28)
  64 + .height(16)
  65 + .backgroundColor('#4D000000')
  66 + .borderRadius(3)
  67 + .textAlign(TextAlign.Center)
  68 +
  69 + Blank()
  70 +
  71 + Stack() {
  72 + Image($r('app.media.comp_adv_close_white'))
  73 + .width(9)
  74 + .height(9)
  75 + .borderRadius({
  76 + topLeft: '4vp',
  77 + topRight: '4vp',
  78 + bottomLeft: '4vp',
  79 + bottomRight: '4vp'
  80 + })
  81 + }
  82 + .width(18)
  83 + .height(14)
  84 + .backgroundColor('#4D000000')
  85 + .borderWidth(0.5)
  86 + .borderColor($r('app.color.white'))
  87 + .borderRadius(3)
  88 +
  89 + }.width('100%').padding({
  90 + top: 8,
  91 + left: 8,
  92 + right: 8
  93 + })
  94 + }
  95 + .alignContent(Alignment.Top)
  96 + .width(CommonConstants.FULL_WIDTH)
  97 + }.width('100%').padding({
  98 + left: $r('app.float.card_comp_pagePadding_lf'),
  99 + right: $r('app.float.card_comp_pagePadding_lf'),
  100 + })
  101 +
  102 +
  103 + //
  104 + List({ space: 8 }) {
  105 +
  106 + ForEach(this.advExtraData.item, (content: AdvExtraItemData) => {
  107 +
  108 + ListItem() {
  109 + // 广告列表信息
  110 + Column() {
  111 +
  112 + Image(content.image)
  113 + .width('100%')
  114 + .aspectRatio(150 / 84)
  115 + .borderWidth(0.5)
  116 + .borderColor($r('app.color.color_0D000000'))
  117 + .borderRadius(4)
  118 +
  119 + Text(content.title)
  120 + .fontSize('16fp')
  121 + .fontColor($r('app.color.color_222222'))
  122 + .fontSize('15fp')
  123 + .maxLines(3)
  124 + .lineHeight(20)
  125 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  126 + .width('100%')
  127 + .margin({ top: 8 })
  128 +
  129 + }.width(this.advLength >= 3 ? 150 : this.advLength == 2 ? 210 : '100%').onClick(() => {
  130 +
  131 + let matInfo: CompAdvMatInfoBean = {
  132 + linkUrl: content.linkUrl,
  133 + linkType: content.linkType
  134 + } as CompAdvMatInfoBean;
  135 + ProcessUtils.openAdvDetail(matInfo)
  136 +
  137 + })
  138 +
  139 + }
  140 +
  141 + })
  142 +
  143 + }
  144 + .width('100%')
  145 + .listDirection(Axis.Horizontal)
  146 + .edgeEffect(EdgeEffect.None)
  147 + .scrollBar(BarState.Off)
  148 + .contentStartOffset(this.advLength == 1 ? 0 : 16)
  149 + .contentEndOffset(this.advLength == 1 ? 0 : 16)
  150 + .margin({ top: 10, bottom: 10 })
  151 + .padding({
  152 + left: this.advLength == 1 ? 16 : 0,
  153 + right: this.advLength == 1 ? 16 : 0,
  154 + })
  155 +
  156 +
  157 + // 更多按钮
  158 + commonButton(this.advExtraData)
  159 +
42 } 160 }
43 .width(CommonConstants.FULL_WIDTH) 161 .width(CommonConstants.FULL_WIDTH)
44 .padding({ 162 .padding({
45 - left: $r('app.float.card_comp_pagePadding_lf'),  
46 - right: $r('app.float.card_comp_pagePadding_lf'),  
47 top: $r('app.float.card_comp_pagePadding_tb'), 163 top: $r('app.float.card_comp_pagePadding_tb'),
48 bottom: $r('app.float.card_comp_pagePadding_tb') 164 bottom: $r('app.float.card_comp_pagePadding_tb')
49 }) 165 })
50 - .onClick((event: ClickEvent) => {  
51 - //ProcessUtils.processPage(this.contentDTO)  
52 - }) 166 +
53 } 167 }
54 } 168 }
55 169
56 -@Extend(Text)  
57 -function bottomTextStyle() {  
58 - .fontSize(12)  
59 - .fontColor('#B0B0B0') 170 +/*
  171 + 标题样式
  172 + */
  173 +@Builder
  174 +function commonButton(advExtraData: AdvExtraData) {
  175 +
  176 +
  177 + Row() {
  178 + Row() {
  179 + Blank()
  180 + Text('查看更多').fontColor('#222222').fontSize('14fp')
  181 + Image($r('app.media.icon_comp_more_right_red')).width(16).height(16)
  182 + Blank()
  183 +
  184 + }
  185 + .width('100%')
  186 + .backgroundColor('#F5F5F5')
  187 + .borderRadius(3)
  188 + .padding({ top: 10, bottom: 10, })
  189 + .onClick(() => {
  190 + let matInfo: CompAdvMatInfoBean = {
  191 + linkUrl: advExtraData.itemMore.linkUrl,
  192 + linkType: advExtraData.itemMore.linkType
  193 + } as CompAdvMatInfoBean;
  194 + ProcessUtils.openAdvDetail(matInfo)
  195 + })
  196 + }.width('100%').padding({
  197 + left: $r('app.float.card_comp_pagePadding_lf'),
  198 + right: $r('app.float.card_comp_pagePadding_lf'),
  199 +
  200 + })
  201 +
60 } 202 }
1 //全标题 "appStyle":"2", 1 //全标题 "appStyle":"2",
2 import { CompDTO, ContentDTO } from 'wdBean'; 2 import { CompDTO, ContentDTO } from 'wdBean';
3 -import { CommonConstants } from 'wdConstant/Index'; 3 +import { CommonConstants, CompStyle } from 'wdConstant/Index';
4 import { ProcessUtils } from 'wdRouter'; 4 import { ProcessUtils } from 'wdRouter';
5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
6 import { CardSourceInfo } from '../cardCommon/CardSourceInfo' 6 import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
  7 +import { CardAdvBottom } from './CardAdvBottom';
7 8
8 const TAG: string = 'Card2Component'; 9 const TAG: string = 'Card2Component';
9 10
10 -/**  
11 - * @Description: 广告---长通栏广告 和 顶部长通栏广告  
12 - * @Author:  
13 - * @Email: liyubing@wondertek.com.cn  
14 - * @CreateDate:  
15 - * @UpdateRemark: 更新说明  
16 - * @Version: 1.0 11 +/**
  12 + * @Description: 广告---长通栏广告 和 顶部长通栏广告
  13 + * @Author:
  14 + * @Email: liyubing@wondertek.com.cn
  15 + * @CreateDate:
  16 + * @UpdateRemark: 更新说明
  17 + * @Version: 1.0
17 */ 18 */
18 @Component 19 @Component
19 export struct CardAdvLongImageComponent { 20 export struct CardAdvLongImageComponent {
20 21
  22 +
21 @State compDTO: CompDTO = {} as CompDTO 23 @State compDTO: CompDTO = {} as CompDTO
22 24
  25 + @State haveTitle : boolean = true
  26 +
23 aboutToAppear(): void { 27 aboutToAppear(): void {
24 28
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----') 29 + console.error('ZZZXXXXX', '--长通栏广告 和 顶部长通栏广告------aboutToAppear-----')
  30 +
  31 + this.haveTitle = this.compDTO.matInfo.advSubType === CompStyle.Card_Adv_7;
26 } 32 }
27 33
28 aboutToDisappear(): void { 34 aboutToDisappear(): void {
29 35
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----') 36 + console.error('ZZZXXXXX', '--长通栏广告 和 顶部长通栏广告------aboutToDisappear-----')
31 } 37 }
32 38
33 build() { 39 build() {
34 40
35 Column() { 41 Column() {
36 - Text(this.compDTO.matInfo.advTitle)  
37 - .fontSize($r('app.float.font_size_17'))  
38 - .fontColor($r('app.color.color_222222'))  
39 - .maxLines(3)  
40 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
41 - .align(Alignment.Start) 42 +
  43 + //新闻标题
  44 + if(this.haveTitle ){
  45 + Text(this.compDTO.matInfo.advTitle).bottomTextStyle().margin({ bottom: 8, })
  46 + }
  47 +
  48 + //长图
  49 + Image(this.compDTO.matInfo.matImageUrl[0])
  50 + .width(CommonConstants.FULL_WIDTH)
  51 + .aspectRatio(343 / 96)
  52 + .borderRadius(4)
  53 + .borderWidth(0.5)
  54 + .borderColor($r('app.color.color_0D000000'))
  55 +
  56 + CardAdvBottom().margin({
  57 + top: 8,
  58 + })
42 } 59 }
43 .width(CommonConstants.FULL_WIDTH) 60 .width(CommonConstants.FULL_WIDTH)
44 .padding({ 61 .padding({
@@ -48,13 +65,20 @@ export struct CardAdvLongImageComponent { @@ -48,13 +65,20 @@ export struct CardAdvLongImageComponent {
48 bottom: $r('app.float.card_comp_pagePadding_tb') 65 bottom: $r('app.float.card_comp_pagePadding_tb')
49 }) 66 })
50 .onClick((event: ClickEvent) => { 67 .onClick((event: ClickEvent) => {
51 - //ProcessUtils.processPage(this.contentDTO) 68 + ProcessUtils.openAdvDetail(this.compDTO.matInfo)
52 }) 69 })
53 } 70 }
54 } 71 }
55 72
  73 +/*
  74 + 标题样式
  75 + */
56 @Extend(Text) 76 @Extend(Text)
57 function bottomTextStyle() { 77 function bottomTextStyle() {
58 - .fontSize(12)  
59 - .fontColor('#B0B0B0') 78 + .fontSize('18fp')
  79 + .fontColor($r('app.color.color_222222'))
  80 + .maxLines(3)
  81 + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
  82 + .align(Alignment.Start)
  83 + .lineHeight(25)
60 } 84 }
1 //全标题 "appStyle":"2", 1 //全标题 "appStyle":"2",
2 -import { CompDTO, ContentDTO } from 'wdBean';  
3 -import { CommonConstants } from 'wdConstant/Index'; 2 +import { CompDTO } from 'wdBean';
4 import { ProcessUtils } from 'wdRouter'; 3 import { ProcessUtils } from 'wdRouter';
5 -import { CardMediaInfo } from '../cardCommon/CardMediaInfo'  
6 -import { CardSourceInfo } from '../cardCommon/CardSourceInfo'  
7 -  
8 -const TAG: string = 'Card2Component';  
9 -  
10 -/**  
11 - * @Description: 广告---小图卡  
12 - * @Author:  
13 - * @Email: liyubing@wondertek.com.cn  
14 - * @CreateDate:  
15 - * @UpdateRemark: 更新说明  
16 - * @Version: 1.0 4 +
  5 +import measure from '@ohos.measure';
  6 +import { DisplayUtils } from 'wdKit/Index';
  7 +import { CardAdvBottom } from './CardAdvBottom';
  8 +
  9 +const TAG: string = 'CardAdvSmallImageComponent';
  10 +
  11 +/**
  12 + * @Description: 广告---小图卡
  13 + * @Author:
  14 + * @Email: liyubing@wondertek.com.cn
  15 + * @CreateDate:
  16 + * @UpdateRemark: 更新说明
  17 + * @Version: 1.0
17 */ 18 */
18 @Component 19 @Component
19 export struct CardAdvSmallImageComponent { 20 export struct CardAdvSmallImageComponent {
20 -  
21 @State compDTO: CompDTO = {} as CompDTO 21 @State compDTO: CompDTO = {} as CompDTO
  22 + @State isBigThreeLine: boolean = false // 标题的行数大于等于3行 是true
22 23
23 aboutToAppear(): void { 24 aboutToAppear(): void {
24 25
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----') 26 + console.error('ZZZXXXXX', '----小图卡----aboutToAppear-----')
  27 + // 计算标题文本行数
  28 + let screenWith = DisplayUtils.getDeviceWidth();
  29 + screenWith = screenWith * 0.62
  30 + let titleNameLineNum = this.getTextLineNum(this.compDTO.matInfo.advTitle, screenWith, 25, 18)
  31 + this.isBigThreeLine = titleNameLineNum >= 3;
26 } 32 }
27 33
28 aboutToDisappear(): void { 34 aboutToDisappear(): void {
29 35
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----') 36 + console.error('ZZZXXXXX', '---小图卡-----aboutToDisappear-----')
31 } 37 }
32 38
33 build() { 39 build() {
34 40
35 - Column() { 41 + RelativeContainer() {
  42 +
  43 + // 广告标题
36 Text(this.compDTO.matInfo.advTitle) 44 Text(this.compDTO.matInfo.advTitle)
37 - .fontSize($r('app.float.font_size_17')) 45 + .fontSize('18fp')
38 .fontColor($r('app.color.color_222222')) 46 .fontColor($r('app.color.color_222222'))
39 .maxLines(3) 47 .maxLines(3)
  48 + .lineHeight(25)
40 .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 49 .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
41 - .align(Alignment.Start) 50 + .width('62%')
  51 + .alignRules({
  52 + top: { anchor: '__container__', align: VerticalAlign.Top },
  53 + left: { anchor: '__container__', align: HorizontalAlign.Start },
  54 + })
  55 + .id("title_name")
  56 +
  57 + // 广告图
  58 + Image(this.compDTO.matInfo.matImageUrl[0])
  59 + .width('34%')
  60 + .aspectRatio(3 / 2)
  61 + .id('adv_imag')
  62 + .borderWidth(0.5)
  63 + .borderColor($r('app.color.color_0D000000'))
  64 + .borderRadius(4)
  65 + //.alt('wwww.baidu.com')
  66 + .alignRules({
  67 + top: { anchor: 'title_name', align: VerticalAlign.Top },
  68 + left: { anchor: 'title_name', align: HorizontalAlign.End },
  69 + })
  70 + .margin({ left: 12 })
  71 +
  72 +
  73 + CardAdvBottom().width('62%').id('bottom_adv').alignRules({
  74 + bottom: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: VerticalAlign.Bottom },
  75 + right: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: HorizontalAlign.Start },
  76 + top: { anchor: this.isBigThreeLine ? 'title_name' : '', align: VerticalAlign.Bottom },
  77 + left: { anchor: this.isBigThreeLine ? 'title_name' : '', align: HorizontalAlign.Start },
  78 + }).margin({
  79 + right: this.isBigThreeLine ? 0 : 12,
  80 + top: this.isBigThreeLine ? 8 : 0,
  81 + })
  82 +
42 } 83 }
43 - .width(CommonConstants.FULL_WIDTH) 84 + .width("100%")
  85 + .height(this.isBigThreeLine ? 127 : 106)
44 .padding({ 86 .padding({
45 left: $r('app.float.card_comp_pagePadding_lf'), 87 left: $r('app.float.card_comp_pagePadding_lf'),
46 right: $r('app.float.card_comp_pagePadding_lf'), 88 right: $r('app.float.card_comp_pagePadding_lf'),
@@ -48,13 +90,31 @@ export struct CardAdvSmallImageComponent { @@ -48,13 +90,31 @@ export struct CardAdvSmallImageComponent {
48 bottom: $r('app.float.card_comp_pagePadding_tb') 90 bottom: $r('app.float.card_comp_pagePadding_tb')
49 }) 91 })
50 .onClick((event: ClickEvent) => { 92 .onClick((event: ClickEvent) => {
51 - //ProcessUtils.processPage(this.contentDTO) 93 + ProcessUtils.openAdvDetail(this.compDTO.matInfo)
  94 + })
  95 + }
  96 +
  97 + // 获取文本几行
  98 + private getTextLineNum(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
  99 + let size = this.topMeasureText(text, constraintWidth, lineHeight, fontSize)
  100 + let height: number = Number(size.height)
  101 + return Math.ceil(px2vp(height) / lineHeight)
  102 + }
  103 +
  104 + private topMeasureText(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
  105 + return measure.measureTextSize({
  106 + textContent: text,
  107 + fontSize: fontSize,
  108 + lineHeight: lineHeight,
  109 + constraintWidth: constraintWidth,
52 }) 110 })
53 } 111 }
54 } 112 }
55 113
  114 +
56 @Extend(Text) 115 @Extend(Text)
57 function bottomTextStyle() { 116 function bottomTextStyle() {
58 .fontSize(12) 117 .fontSize(12)
59 .fontColor('#B0B0B0') 118 .fontColor('#B0B0B0')
60 -}  
  119 +}
  120 +