Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
94 changed files
with
2371 additions
and
839 deletions
Too many changes to show.
To preserve performance only 94 of 94+ files are displayed.
| 1 | { | 1 | { |
| 2 | "app": { | 2 | "app": { |
| 3 | + // "signingConfigs": [ | ||
| 4 | + // { | ||
| 5 | + // "name": "default", | ||
| 6 | + // "type": "HarmonyOS", | ||
| 7 | + // "material": { | ||
| 8 | + // "certpath": "C:\\Users\\pc\\.ohos\\config\\default_sight_harmony_l75MehGV9G3TUayEtL68-EIWqyYDqfVXfu9D-DPJ7I0=.cer", | ||
| 9 | + // "storePassword": "0000001AB256FAF47AA4D68E4841C95D357490DE9FBB26A3A9161AD3069E31B3623E25CB49409CCA9CF7", | ||
| 10 | + // "keyAlias": "debugKey", | ||
| 11 | + // "keyPassword": "0000001AFB06818C2BC8DC275326668AAC62B91EBF7D3F84E8BE0F156D02623AA0F4F8C6B73F362CB371", | ||
| 12 | + // "profile": "C:\\Users\\pc\\.ohos\\config\\default_sight_harmony_l75MehGV9G3TUayEtL68-EIWqyYDqfVXfu9D-DPJ7I0=.p7b", | ||
| 13 | + // "signAlg": "SHA256withECDSA", | ||
| 14 | + // "storeFile": "C:\\Users\\pc\\.ohos\\config\\default_sight_harmony_l75MehGV9G3TUayEtL68-EIWqyYDqfVXfu9D-DPJ7I0=.p12" | ||
| 15 | + // } | ||
| 16 | + // } | ||
| 17 | + // ], | ||
| 3 | "signingConfigs": [ | 18 | "signingConfigs": [ |
| 4 | { | 19 | { |
| 5 | "name": "default", | 20 | "name": "default", |
| 6 | "type": "HarmonyOS", | 21 | "type": "HarmonyOS", |
| 7 | "material": { | 22 | "material": { |
| 8 | - "certpath": "C:\\Users\\pc\\.ohos\\config\\default_sight_harmony_l75MehGV9G3TUayEtL68-EIWqyYDqfVXfu9D-DPJ7I0=.cer", | ||
| 9 | - "storePassword": "0000001AB256FAF47AA4D68E4841C95D357490DE9FBB26A3A9161AD3069E31B3623E25CB49409CCA9CF7", | ||
| 10 | - "keyAlias": "debugKey", | ||
| 11 | - "keyPassword": "0000001AFB06818C2BC8DC275326668AAC62B91EBF7D3F84E8BE0F156D02623AA0F4F8C6B73F362CB371", | ||
| 12 | - "profile": "C:\\Users\\pc\\.ohos\\config\\default_sight_harmony_l75MehGV9G3TUayEtL68-EIWqyYDqfVXfu9D-DPJ7I0=.p7b", | 23 | + "storePassword": "0000001EF28F8A628911F4F52B75E452C814EE4370854DD8DFCE186496B6AD88F8DE5AD3E10F24C1079F2EDD1FFF", |
| 24 | + "certpath": "./singing_config/manual_com.peopledailychina.hosactivity_sign/鸿蒙中文版客户端证书.cer", | ||
| 25 | + "keyAlias": "peopledailyhosalias", | ||
| 26 | + "keyPassword": "0000001E2E8A50EFF2E6D2023242B432388B2748F8299D8BB319C0B06CFF7DCEA7482C5E3CDF1398CCE095BDC68B", | ||
| 27 | + "profile": "./singing_config/manual_com.peopledailychina.hosactivity_sign/peopledaiychina-hos-profile-debugDebug.p7b", | ||
| 13 | "signAlg": "SHA256withECDSA", | 28 | "signAlg": "SHA256withECDSA", |
| 14 | - "storeFile": "C:\\Users\\pc\\.ohos\\config\\default_sight_harmony_l75MehGV9G3TUayEtL68-EIWqyYDqfVXfu9D-DPJ7I0=.p12" | 29 | + "storeFile": "./singing_config/manual_com.peopledailychina.hosactivity_sign/keystorefile.p12" |
| 15 | } | 30 | } |
| 16 | } | 31 | } |
| 17 | ], | 32 | ], |
| @@ -217,6 +232,18 @@ | @@ -217,6 +232,18 @@ | ||
| 217 | ] | 232 | ] |
| 218 | } | 233 | } |
| 219 | ] | 234 | ] |
| 235 | + }, | ||
| 236 | + { | ||
| 237 | + "name": "wdHwAbility", | ||
| 238 | + "srcPath": "./features/wdHwAbility", | ||
| 239 | + "targets": [ | ||
| 240 | + { | ||
| 241 | + "name": "default", | ||
| 242 | + "applyToProducts": [ | ||
| 243 | + "default" | ||
| 244 | + ] | ||
| 245 | + } | ||
| 246 | + ] | ||
| 220 | } | 247 | } |
| 221 | ] | 248 | ] |
| 222 | } | 249 | } |
| @@ -22,3 +22,6 @@ export { ScreenType } from './src/main/ets/enum/ScreenType'; | @@ -22,3 +22,6 @@ export { ScreenType } from './src/main/ets/enum/ScreenType'; | ||
| 22 | export { SpConstants } from './src/main/ets/constants/SpConstants'; | 22 | export { SpConstants } from './src/main/ets/constants/SpConstants'; |
| 23 | 23 | ||
| 24 | export { DisplayDirection } from './src/main/ets/constants/VideoConstants'; | 24 | export { DisplayDirection } from './src/main/ets/constants/VideoConstants'; |
| 25 | + | ||
| 26 | +export { ContentConstants } from './src/main/ets/constants/ContentConstants'; | ||
| 27 | + |
| 1 | +export class ContentConstants { | ||
| 2 | + /* content#objectType,跳转类型:0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14动态图文,15动态视频 */ | ||
| 3 | + /** | ||
| 4 | + * 0:不跳转 | ||
| 5 | + */ | ||
| 6 | + static readonly TYPE_NONE: string = "0"; | ||
| 7 | + /** | ||
| 8 | + * 1:点播 | ||
| 9 | + */ | ||
| 10 | + static readonly TYPE_VOD: string = "1"; | ||
| 11 | + /** | ||
| 12 | + * 2:直播 | ||
| 13 | + */ | ||
| 14 | + static readonly TYPE_LIVE: string = "2"; | ||
| 15 | + /** | ||
| 16 | + * 5:专题详情 | ||
| 17 | + */ | ||
| 18 | + static readonly TYPE_SPECIAL_TOPIC: string = "5"; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 6:链接 | ||
| 22 | + */ | ||
| 23 | + static readonly TYPE_LINK: string = "6"; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 8:图文详情,这里是h5页面 | ||
| 27 | + */ | ||
| 28 | + static readonly TYPE_TELETEXT: string = "8"; | ||
| 29 | + /** | ||
| 30 | + * 9:图集 | ||
| 31 | + */ | ||
| 32 | + static readonly TYPE_NINE: string = "9"; | ||
| 33 | + /** | ||
| 34 | + * 13:音频详情 | ||
| 35 | + */ | ||
| 36 | + static readonly TYPE_AUDIO: string = "13"; | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 14:动态图文 | ||
| 40 | + */ | ||
| 41 | + static readonly TYPE_FOURTEEN: string = "14"; | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 15:动态视频 | ||
| 45 | + */ | ||
| 46 | + static readonly TYPE_FIFTEEN: string = "15"; | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 30:金刚位聚合页 | ||
| 50 | + */ | ||
| 51 | + static readonly TYPE_THIRTY: string = "30"; | ||
| 52 | + | ||
| 53 | +} |
| @@ -10,6 +10,10 @@ export class SpConstants{ | @@ -10,6 +10,10 @@ export class SpConstants{ | ||
| 10 | static USER_STATUS="user_status" | 10 | static USER_STATUS="user_status" |
| 11 | static USER_TEMP_TOKEN="tempToken" | 11 | static USER_TEMP_TOKEN="tempToken" |
| 12 | static USER_PHONE = "user_phone" | 12 | static USER_PHONE = "user_phone" |
| 13 | + static USER_CREATOR_ID = "creatorId" | ||
| 14 | + static USER_HEAD_PHOTO_URL = "headPhotoUrl" | ||
| 15 | + static USER_SEX = "sex" | ||
| 16 | + static USER_BIRTHDAY = "birthday" | ||
| 13 | //协议相关 | 17 | //协议相关 |
| 14 | static NET_SERVICE_PROTOCOL = "user_protocol" //人民日报客户端网络服务使用协议 | 18 | static NET_SERVICE_PROTOCOL = "user_protocol" //人民日报客户端网络服务使用协议 |
| 15 | static PRIVATE_PROTOCOL = "private_protocol" //人民日报客户端用户隐私协议 | 19 | static PRIVATE_PROTOCOL = "private_protocol" //人民日报客户端用户隐私协议 |
| @@ -20,10 +24,18 @@ export class SpConstants{ | @@ -20,10 +24,18 @@ export class SpConstants{ | ||
| 20 | static MESSAGE_BOARD_PRIVATE_PROTOCOL = "message_board_private_protocol" //"留言板-隐私政策" | 24 | static MESSAGE_BOARD_PRIVATE_PROTOCOL = "message_board_private_protocol" //"留言板-隐私政策" |
| 21 | //设置页面 | 25 | //设置页面 |
| 22 | static SETTING_WIFI_IMAGE_SWITCH = "setting_wifi_switch" //wifi 图片开关 | 26 | static SETTING_WIFI_IMAGE_SWITCH = "setting_wifi_switch" //wifi 图片开关 |
| 23 | - static SETTING_WIFI_VIDEO_SWITCH = "setting_wifi_switch" //wifi 视频开关 | 27 | + static SETTING_WIFI_VIDEO_SWITCH = "setting_video_switch" //wifi 视频开关 |
| 24 | static SETTING_SUSPENSION_SWITCH = "setting_suspension_switch" //悬浮窗 开关 | 28 | static SETTING_SUSPENSION_SWITCH = "setting_suspension_switch" //悬浮窗 开关 |
| 25 | static SETTING_PUSH_SWITCH = "setting_push_switch" //推送 开关 | 29 | static SETTING_PUSH_SWITCH = "setting_push_switch" //推送 开关 |
| 26 | 30 | ||
| 27 | //未登录保存兴趣标签 | 31 | //未登录保存兴趣标签 |
| 28 | static PUBLICVISUTORMODE_INTERESTTAGS = 'PublicVisitorMode_InterestTags' | 32 | static PUBLICVISUTORMODE_INTERESTTAGS = 'PublicVisitorMode_InterestTags' |
| 33 | + | ||
| 34 | + //定位相关 | ||
| 35 | + static LOCATION_CITY_NAME = "location_city_name" //定位 | ||
| 36 | + static LOCATION_CITY_CODE = "location_city_code" //定位 | ||
| 37 | + | ||
| 38 | + //启动页数据存储key | ||
| 39 | + static APP_LAUNCH_PAGE_DATA_MODEL = 'app_launch_page_data_model' | ||
| 40 | + | ||
| 29 | } | 41 | } |
| 1 | import { Action } from './Action'; | 1 | import { Action } from './Action'; |
| 2 | interface dataObject { | 2 | interface dataObject { |
| 3 | + // dataSource: | ||
| 4 | + // 1、图文详情数据 | ||
| 5 | + // 2、英文端跳转推荐内容数据 | ||
| 6 | + // 3、显示图片预览 | ||
| 7 | + // 4、专题pageinfo数据 | ||
| 8 | + // 5、专题comp运营位点击跳转(传给App记录浏览历史) | ||
| 9 | + // 6、图文详情引用内容跳转 | ||
| 10 | + // 7、专题分享海报图上的数据列表(H5可选第一页前5条运营位数据) | ||
| 11 | + // 8、活动投稿 文章跳转 | ||
| 12 | + // 9、活动投稿 视频跳转 | ||
| 13 | + // 10、活动投稿 动态跳转 | ||
| 14 | + // 11、活动投稿 图集跳转 | ||
| 3 | dataSource: number | 15 | dataSource: number |
| 4 | operateType?: string | 16 | operateType?: string |
| 5 | webViewHeight?: string | 17 | webViewHeight?: string |
| @@ -44,4 +44,8 @@ export { EmitterUtils } from './src/main/ets/utils/EmitterUtils' | @@ -44,4 +44,8 @@ export { EmitterUtils } from './src/main/ets/utils/EmitterUtils' | ||
| 44 | 44 | ||
| 45 | export { EmitterEventId } from './src/main/ets/utils/EmitterEventId' | 45 | export { EmitterEventId } from './src/main/ets/utils/EmitterEventId' |
| 46 | 46 | ||
| 47 | -export { HWLocationUtils } from './src/main/ets/utils/HWLocationUtils' | ||
| 47 | +export { NetworkUtil } from './src/main/ets/utils/NetworkUtil' | ||
| 48 | + | ||
| 49 | +export { NetworkManager } from './src/main/ets/network/NetworkManager' | ||
| 50 | + | ||
| 51 | +export { NetworkType } from './src/main/ets/network/NetworkType' |
| 1 | +import connection from '@ohos.net.connection'; | ||
| 2 | +import { BusinessError } from '@ohos.base'; | ||
| 3 | +import { Logger } from '../utils/Logger'; | ||
| 4 | +import { EmitterUtils } from '../utils/EmitterUtils'; | ||
| 5 | +import { EmitterEventId } from '../utils/EmitterEventId'; | ||
| 6 | +import { NetworkType } from './NetworkType'; | ||
| 7 | + | ||
| 8 | +const TAG = 'NetworkManager' | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 网络管理类 | ||
| 12 | + */ | ||
| 13 | +export class NetworkManager { | ||
| 14 | + private netCon: connection.NetConnection | null = null; | ||
| 15 | + private static instance: NetworkManager; | ||
| 16 | + private networkType: NetworkType = NetworkType.TYPE_UNKNOWN | ||
| 17 | + | ||
| 18 | + public static getInstance(): NetworkManager { | ||
| 19 | + if (!NetworkManager.instance) { | ||
| 20 | + NetworkManager.instance = new NetworkManager(); | ||
| 21 | + } | ||
| 22 | + return NetworkManager.instance; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + public init() { | ||
| 26 | + // 初始化 | ||
| 27 | + if (this.netCon) { | ||
| 28 | + // 拦截重复初始化 | ||
| 29 | + return | ||
| 30 | + } | ||
| 31 | + this.networkMonitorRegister() | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public release() { | ||
| 35 | + this.networkMonitorUnregister() | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + private constructor() { | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + private networkMonitorRegister() { | ||
| 42 | + this.netCon = connection.createNetConnection(); | ||
| 43 | + this.netCon.register((error) => { | ||
| 44 | + if (error) { | ||
| 45 | + Logger.error(TAG, 'register error:' + error.message); | ||
| 46 | + return; | ||
| 47 | + } | ||
| 48 | + Logger.info(TAG, 'register success'); | ||
| 49 | + }) | ||
| 50 | + this.netCon.on('netAvailable', (data: connection.NetHandle) => { | ||
| 51 | + Logger.info(TAG, 'netAvailable, data is: ' + JSON.stringify(data)) | ||
| 52 | + }) | ||
| 53 | + this.netCon.on('netBlockStatusChange', (data: connection.NetBlockStatusInfo) => { | ||
| 54 | + Logger.info(TAG, 'netBlockStatusChange, data is: ' + JSON.stringify(data)) | ||
| 55 | + // TODO 网络阻塞,是否创建新的网络、提示 | ||
| 56 | + }) | ||
| 57 | + this.netCon.on('netCapabilitiesChange', (data: connection.NetCapabilityInfo) => { | ||
| 58 | + Logger.info(TAG, 'netCapabilitiesChange, data is: ' + JSON.stringify(data)) | ||
| 59 | + this.parseData(data) | ||
| 60 | + // 可能多次通知 | ||
| 61 | + EmitterUtils.sendEvent(EmitterEventId.NETWORK_CONNECTED, JSON.stringify(this.networkType)) | ||
| 62 | + }) | ||
| 63 | + this.netCon.on('netConnectionPropertiesChange', (data: connection.NetConnectionPropertyInfo) => { | ||
| 64 | + Logger.info(TAG, 'netConnectionPropertiesChange, data is: ' + JSON.stringify(data)) | ||
| 65 | + }) | ||
| 66 | + | ||
| 67 | + this.netCon.on('netUnavailable', ((data: void) => { | ||
| 68 | + Logger.info(TAG, 'netUnavailable, data is: ' + JSON.stringify(data)) | ||
| 69 | + })); | ||
| 70 | + this.netCon.on('netLost', ((data: connection.NetHandle) => { | ||
| 71 | + Logger.info(TAG, 'netLost, data is: ' + JSON.stringify(data)) | ||
| 72 | + // TODO 断网 | ||
| 73 | + EmitterUtils.sendEvent(EmitterEventId.NETWORK_DISCONNECTED) | ||
| 74 | + this.networkType = NetworkType.TYPE_NONE | ||
| 75 | + })) | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + private networkMonitorUnregister() { | ||
| 79 | + if (this.netCon) { | ||
| 80 | + this.netCon.unregister((error: BusinessError) => { | ||
| 81 | + if (error) { | ||
| 82 | + Logger.error(TAG, 'unregister error:' + error.message); | ||
| 83 | + return; | ||
| 84 | + } | ||
| 85 | + Logger.info(TAG, 'unregister success'); | ||
| 86 | + }) | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + /** | ||
| 91 | + * @deprecated | ||
| 92 | + */ | ||
| 93 | + private getNetworkMessage(netHandle: connection.NetHandle) { | ||
| 94 | + connection.getNetCapabilities(netHandle, (error, netCap) => { | ||
| 95 | + if (error) { | ||
| 96 | + Logger.error(TAG, 'getNetCapabilities error:' + error.message); | ||
| 97 | + return; | ||
| 98 | + } | ||
| 99 | + let netType = netCap.bearerTypes; | ||
| 100 | + this.reset(netType) | ||
| 101 | + }) | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + private reset(netType: Array<connection.NetBearType>) { | ||
| 105 | + if (netType == null) { | ||
| 106 | + return | ||
| 107 | + } | ||
| 108 | + for (let i = 0; i < netType.length; i++) { | ||
| 109 | + if (netType[i] === 0) { | ||
| 110 | + // 蜂窝网 | ||
| 111 | + this.networkType = NetworkType.TYPE_CELLULAR | ||
| 112 | + } else if (netType[i] === 1) { | ||
| 113 | + // Wi-Fi网络 | ||
| 114 | + this.networkType = NetworkType.TYPE_WIFI | ||
| 115 | + } else { | ||
| 116 | + // 以太网网络 | ||
| 117 | + this.networkType = NetworkType.TYPE_ETHERNET | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + /** | ||
| 123 | + * 获取网络类型,网络监听网络变化刷新类型,这里优先返回变量 | ||
| 124 | + */ | ||
| 125 | + public getNetType(): NetworkType { | ||
| 126 | + if (this.networkType != NetworkType.TYPE_UNKNOWN) { | ||
| 127 | + return this.networkType | ||
| 128 | + } | ||
| 129 | + return this.getNetTypeSync() | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + /** | ||
| 133 | + * 同步获取网络类型,耗时 | ||
| 134 | + */ | ||
| 135 | + public getNetTypeSync(): NetworkType { | ||
| 136 | + let netHandle = connection.getDefaultNetSync(); | ||
| 137 | + let netCapabilities = connection.getNetCapabilitiesSync(netHandle) | ||
| 138 | + this.reset(netCapabilities.bearerTypes) | ||
| 139 | + return this.networkType; | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + private parseData(data: connection.NetCapabilityInfo) { | ||
| 143 | + // 解析网络信息 | ||
| 144 | + this.reset(data.netCap.bearerTypes) | ||
| 145 | + } | ||
| 146 | +} |
| @@ -3,6 +3,10 @@ | @@ -3,6 +3,10 @@ | ||
| 3 | */ | 3 | */ |
| 4 | export enum EmitterEventId { | 4 | export enum EmitterEventId { |
| 5 | // 通知登出,事件id | 5 | // 通知登出,事件id |
| 6 | - FORCE_USER_LOGIN_OUT = 1 | 6 | + FORCE_USER_LOGIN_OUT = 1, |
| 7 | + // 网络连接成功,事件id | ||
| 8 | + NETWORK_CONNECTED = 2, | ||
| 9 | + // 网络断开,事件id | ||
| 10 | + NETWORK_DISCONNECTED = 3, | ||
| 7 | } | 11 | } |
| 8 | 12 |
| @@ -22,6 +22,11 @@ export class Logger { | @@ -22,6 +22,11 @@ export class Logger { | ||
| 22 | private static domain: number = 0xFF00; | 22 | private static domain: number = 0xFF00; |
| 23 | private static prefix: string = 'SightApp'; | 23 | private static prefix: string = 'SightApp'; |
| 24 | private static format: string = `%{public}s, %{public}s`; | 24 | private static format: string = `%{public}s, %{public}s`; |
| 25 | + private static format_ext: string = `%{public}s`; | ||
| 26 | + /** | ||
| 27 | + * 暂时没找到限制大小相关文档,尝试4000是不行的,3500可以。可以后续优化 | ||
| 28 | + */ | ||
| 29 | + private static CHUNK_SIZE: number = 3500; | ||
| 25 | static isDebug: boolean = true; | 30 | static isDebug: boolean = true; |
| 26 | 31 | ||
| 27 | /** | 32 | /** |
| @@ -36,46 +41,113 @@ export class Logger { | @@ -36,46 +41,113 @@ export class Logger { | ||
| 36 | } | 41 | } |
| 37 | 42 | ||
| 38 | static debug(...args: string[]) { | 43 | static debug(...args: string[]) { |
| 39 | - if(!Logger.isDebug){ | 44 | + if (!Logger.isDebug) { |
| 40 | return | 45 | return |
| 41 | } | 46 | } |
| 42 | - hilog.debug(Logger.domain, Logger.prefix, Logger.format, args); | 47 | + Logger.logContent(LogLevel.DEBUG, ...args) |
| 43 | } | 48 | } |
| 44 | 49 | ||
| 45 | static info(...args: string[]) { | 50 | static info(...args: string[]) { |
| 46 | - if(!Logger.isDebug){ | 51 | + if (!Logger.isDebug) { |
| 47 | return | 52 | return |
| 48 | } | 53 | } |
| 49 | - hilog.info(Logger.domain, Logger.prefix, Logger.format, args); | 54 | + Logger.logContent(LogLevel.INFO, ...args) |
| 50 | } | 55 | } |
| 51 | 56 | ||
| 52 | static warn(...args: string[]) { | 57 | static warn(...args: string[]) { |
| 53 | - if(!Logger.isDebug){ | 58 | + if (!Logger.isDebug) { |
| 54 | return | 59 | return |
| 55 | } | 60 | } |
| 56 | - hilog.warn(Logger.domain, Logger.prefix, Logger.format, args); | 61 | + Logger.logContent(LogLevel.WARN, ...args) |
| 57 | } | 62 | } |
| 58 | 63 | ||
| 59 | static error(...args: string[]) { | 64 | static error(...args: string[]) { |
| 60 | - if(!Logger.isDebug){ | 65 | + if (!Logger.isDebug) { |
| 61 | return | 66 | return |
| 62 | } | 67 | } |
| 63 | - hilog.error(Logger.domain, Logger.prefix, Logger.format, args); | 68 | + Logger.logContent(LogLevel.ERROR, ...args) |
| 64 | } | 69 | } |
| 65 | 70 | ||
| 66 | static fatal(...args: string[]) { | 71 | static fatal(...args: string[]) { |
| 67 | - if(!Logger.isDebug){ | 72 | + if (!Logger.isDebug) { |
| 68 | return | 73 | return |
| 69 | } | 74 | } |
| 70 | - hilog.fatal(Logger.domain, Logger.prefix, Logger.format, args); | 75 | + Logger.logContent(LogLevel.FATAL, ...args) |
| 71 | } | 76 | } |
| 72 | 77 | ||
| 73 | static isLoggable(level: LogLevel) { | 78 | static isLoggable(level: LogLevel) { |
| 74 | - if(!Logger.isDebug){ | 79 | + if (!Logger.isDebug) { |
| 75 | return | 80 | return |
| 76 | } | 81 | } |
| 82 | + // 判断是否打印 TODO | ||
| 77 | hilog.isLoggable(Logger.domain, Logger.prefix, level); | 83 | hilog.isLoggable(Logger.domain, Logger.prefix, level); |
| 78 | } | 84 | } |
| 85 | + | ||
| 86 | + static logContent(level: LogLevel, ...args: string[]) { | ||
| 87 | + let msg = Logger.getMsg(...args) | ||
| 88 | + let length = msg.length | ||
| 89 | + if (length < Logger.CHUNK_SIZE) { | ||
| 90 | + // 不超限,保持原来的打印 | ||
| 91 | + Logger.print(level, ...args) | ||
| 92 | + } else { | ||
| 93 | + // 超限,分段打印 | ||
| 94 | + for (let i = 0; i < length; i += Logger.CHUNK_SIZE) { | ||
| 95 | + let count = Math.min(length - i, Logger.CHUNK_SIZE); | ||
| 96 | + Logger.printExt(level, msg.substring(i, i + count)); | ||
| 97 | + } | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + static print(level: LogLevel, ...msg: string[]) { | ||
| 102 | + switch (level) { | ||
| 103 | + case LogLevel.DEBUG: | ||
| 104 | + hilog.debug(Logger.domain, Logger.prefix, Logger.format, msg); | ||
| 105 | + break | ||
| 106 | + case LogLevel.INFO: | ||
| 107 | + hilog.info(Logger.domain, Logger.prefix, Logger.format, msg); | ||
| 108 | + break | ||
| 109 | + case LogLevel.WARN: | ||
| 110 | + hilog.warn(Logger.domain, Logger.prefix, Logger.format, msg); | ||
| 111 | + break | ||
| 112 | + case LogLevel.ERROR: | ||
| 113 | + hilog.error(Logger.domain, Logger.prefix, Logger.format, msg); | ||
| 114 | + break | ||
| 115 | + case LogLevel.FATAL: | ||
| 116 | + hilog.fatal(Logger.domain, Logger.prefix, Logger.format, msg); | ||
| 117 | + break | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + static printExt(level: LogLevel, msg: string) { | ||
| 122 | + switch (level) { | ||
| 123 | + case LogLevel.DEBUG: | ||
| 124 | + hilog.debug(Logger.domain, Logger.prefix, Logger.format_ext, msg); | ||
| 125 | + break | ||
| 126 | + case LogLevel.INFO: | ||
| 127 | + hilog.info(Logger.domain, Logger.prefix, Logger.format_ext, msg); | ||
| 128 | + break | ||
| 129 | + case LogLevel.WARN: | ||
| 130 | + hilog.warn(Logger.domain, Logger.prefix, Logger.format_ext, msg); | ||
| 131 | + break | ||
| 132 | + case LogLevel.ERROR: | ||
| 133 | + hilog.error(Logger.domain, Logger.prefix, Logger.format_ext, msg); | ||
| 134 | + break | ||
| 135 | + case LogLevel.FATAL: | ||
| 136 | + hilog.fatal(Logger.domain, Logger.prefix, Logger.format_ext, msg); | ||
| 137 | + break | ||
| 138 | + } | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + static getMsg(...args: string[]): string { | ||
| 142 | + if (args == null || args.length <= 0) { | ||
| 143 | + return ''; | ||
| 144 | + } | ||
| 145 | + let msg = '' | ||
| 146 | + args.forEach((v) => { | ||
| 147 | + msg = msg.concat(', ').concat(v) | ||
| 148 | + }) | ||
| 149 | + return msg.substring(2, msg.length); | ||
| 150 | + } | ||
| 79 | } | 151 | } |
| 80 | 152 | ||
| 81 | export default new Logger('SightApp', 0xFF00) | 153 | export default new Logger('SightApp', 0xFF00) |
| 1 | +import { NetworkManager } from '../network/NetworkManager' | ||
| 2 | +import { NetworkType } from '../network/NetworkType' | ||
| 3 | + | ||
| 4 | +/** | ||
| 5 | + * 网络相关工具类 | ||
| 6 | + * 要实时监听网络,需要添加注册函数{例:src/main/ets/entryability/EntryAbility.ets:32} | ||
| 7 | + */ | ||
| 8 | +export class NetworkUtil { | ||
| 9 | + /** | ||
| 10 | + * 网络环境:0:无网 1:WiFi 2:2G 3:3G 4:4G 5:5G,暂时只识别出蜂窝网 | ||
| 11 | + * 扩展6-以太网 | ||
| 12 | + */ | ||
| 13 | + static TYPE_NONE = '0' | ||
| 14 | + static TYPE_WIFI = '1' | ||
| 15 | + static TYPE_CELLULAR = '5' | ||
| 16 | + // TODO 以太网,手机不涉及 | ||
| 17 | + static TYPE_ETHERNET = '6' | ||
| 18 | + | ||
| 19 | + static getNetworkType(): string { | ||
| 20 | + let type = NetworkManager.getInstance().getNetType() | ||
| 21 | + return NetworkUtil.parseType(type) | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + static parseType(type: NetworkType): string { | ||
| 25 | + switch (type) { | ||
| 26 | + case NetworkType.TYPE_UNKNOWN: | ||
| 27 | + case NetworkType.TYPE_NONE: | ||
| 28 | + return NetworkUtil.TYPE_NONE; | ||
| 29 | + case NetworkType.TYPE_WIFI: | ||
| 30 | + return NetworkUtil.TYPE_WIFI; | ||
| 31 | + case NetworkType.TYPE_CELLULAR: | ||
| 32 | + return NetworkUtil.TYPE_CELLULAR; | ||
| 33 | + case NetworkType.TYPE_ETHERNET: | ||
| 34 | + return NetworkUtil.TYPE_ETHERNET; | ||
| 35 | + default: | ||
| 36 | + return NetworkUtil.TYPE_NONE; | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 判断网络是否已连接 | ||
| 42 | + * @returns | ||
| 43 | + */ | ||
| 44 | + static isNetConnected(): boolean { | ||
| 45 | + let type = NetworkManager.getInstance().getNetType() | ||
| 46 | + if (type == NetworkType.TYPE_NONE) { | ||
| 47 | + return false | ||
| 48 | + } | ||
| 49 | + return true | ||
| 50 | + } | ||
| 51 | +} |
| @@ -26,7 +26,7 @@ export class ResourcesUtils { | @@ -26,7 +26,7 @@ export class ResourcesUtils { | ||
| 26 | try { | 26 | try { |
| 27 | let text = buffer.from(content).toString("utf8"); | 27 | let text = buffer.from(content).toString("utf8"); |
| 28 | if (text) { | 28 | if (text) { |
| 29 | - Logger.info(TAG, "getResourcesText then text:" + text); | 29 | + // Logger.info(TAG, "getResourcesText then text:" + text); |
| 30 | success(text); | 30 | success(text); |
| 31 | } else { | 31 | } else { |
| 32 | Logger.warn(TAG, "getResourcesText then text is empty"); | 32 | Logger.warn(TAG, "getResourcesText then text is empty"); |
| @@ -24,6 +24,7 @@ export class UserDataLocal { | @@ -24,6 +24,7 @@ export class UserDataLocal { | ||
| 24 | static USER_HEADER_URL="userHeaderUrl" | 24 | static USER_HEADER_URL="userHeaderUrl" |
| 25 | static USER_LEVEL="userLevel" | 25 | static USER_LEVEL="userLevel" |
| 26 | static USER_LEVEL_HEADER_URL="userLevelHeaderUrl" | 26 | static USER_LEVEL_HEADER_URL="userLevelHeaderUrl" |
| 27 | + static USER_FOLLOW_OPERATION="user_follow_operation" | ||
| 27 | 28 | ||
| 28 | //刷新token 用到 | 29 | //刷新token 用到 |
| 29 | static USER_REFRESH_TOKEN="refreshToken" | 30 | static USER_REFRESH_TOKEN="refreshToken" |
| @@ -89,6 +90,10 @@ export class UserDataLocal { | @@ -89,6 +90,10 @@ export class UserDataLocal { | ||
| 89 | SPHelper.default.save(UserDataLocal.USER_HEADER_URL, url) | 90 | SPHelper.default.save(UserDataLocal.USER_HEADER_URL, url) |
| 90 | } | 91 | } |
| 91 | 92 | ||
| 93 | + public static setUserFollowOperation(timestamp:string) { | ||
| 94 | + SPHelper.default.saveSync(UserDataLocal.USER_FOLLOW_OPERATION, timestamp) | ||
| 95 | + } | ||
| 96 | + | ||
| 92 | 97 | ||
| 93 | public static getUserLevel() { | 98 | public static getUserLevel() { |
| 94 | if(UserDataLocal.userLevel != -1){ | 99 | if(UserDataLocal.userLevel != -1){ |
| @@ -132,6 +132,14 @@ export class WindowModel { | @@ -132,6 +132,14 @@ export class WindowModel { | ||
| 132 | }) | 132 | }) |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | + setWindowSystemBarEnable(names: Array<'status' | 'navigation'>) { | ||
| 136 | + this.windowClass?.setWindowSystemBarEnable(names) | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + getWindowProperties() { | ||
| 140 | + return this.windowClass?.getWindowProperties() | ||
| 141 | + } | ||
| 142 | + | ||
| 135 | setWindowLayoutFullScreen(isFullScreen: boolean) { | 143 | setWindowLayoutFullScreen(isFullScreen: boolean) { |
| 136 | this.isFullScreen = isFullScreen | 144 | this.isFullScreen = isFullScreen |
| 137 | this.windowClass?.setWindowLayoutFullScreen(isFullScreen) | 145 | this.windowClass?.setWindowLayoutFullScreen(isFullScreen) |
| @@ -12,8 +12,17 @@ export interface ResponseDTO<T = string> { | @@ -12,8 +12,17 @@ export interface ResponseDTO<T = string> { | ||
| 12 | 12 | ||
| 13 | // 响应结果 | 13 | // 响应结果 |
| 14 | data?: T; | 14 | data?: T; |
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * @deprecated | ||
| 18 | + */ | ||
| 15 | totalCount?: number; | 19 | totalCount?: number; |
| 20 | + meta?: MetaDTO; | ||
| 16 | 21 | ||
| 17 | // 请求响应时间戳(unix格式) | 22 | // 请求响应时间戳(unix格式) |
| 18 | timestamp?: number; | 23 | timestamp?: number; |
| 24 | +} | ||
| 25 | + | ||
| 26 | +export interface MetaDTO { | ||
| 27 | + md5: string; | ||
| 19 | } | 28 | } |
| @@ -5,6 +5,7 @@ import axios, { | @@ -5,6 +5,7 @@ import axios, { | ||
| 5 | HttpStatusCode, | 5 | HttpStatusCode, |
| 6 | InternalAxiosRequestConfig | 6 | InternalAxiosRequestConfig |
| 7 | } from '@ohos/axios'; | 7 | } from '@ohos/axios'; |
| 8 | +import { Logger } from 'wdKit/Index'; | ||
| 8 | 9 | ||
| 9 | // import type ResponseDTO from '../models/ResponseDTO'; | 10 | // import type ResponseDTO from '../models/ResponseDTO'; |
| 10 | 11 | ||
| @@ -37,6 +38,7 @@ instance.interceptors.request.use( | @@ -37,6 +38,7 @@ instance.interceptors.request.use( | ||
| 37 | } | 38 | } |
| 38 | // 公共请求参数 | 39 | // 公共请求参数 |
| 39 | // config.params.key = key | 40 | // config.params.key = key |
| 41 | + Logger.debug('HttpRequest', 'request: ' + config.url) | ||
| 40 | return config; | 42 | return config; |
| 41 | }, | 43 | }, |
| 42 | (error: AxiosError) => { | 44 | (error: AxiosError) => { |
| @@ -84,6 +86,9 @@ instance.interceptors.response.use(// 响应拦截器response类型就是Axios.r | @@ -84,6 +86,9 @@ instance.interceptors.response.use(// 响应拦截器response类型就是Axios.r | ||
| 84 | // return Promise.reject(new Error(message)) | 86 | // return Promise.reject(new Error(message)) |
| 85 | // } | 87 | // } |
| 86 | // const data: ResponseBean<any> = response.data | 88 | // const data: ResponseBean<any> = response.data |
| 89 | + Logger.debug('HttpRequest', 'response ==============start=================') | ||
| 90 | + Logger.debug('HttpRequest', 'response: ' + JSON.stringify(response.data)) | ||
| 91 | + Logger.debug('HttpRequest', 'response ==============end=================') | ||
| 87 | // 改造返回的数据,即将AxiosResponse的data返回,服务端返回的数据 | 92 | // 改造返回的数据,即将AxiosResponse的data返回,服务端返回的数据 |
| 88 | return response.data; | 93 | return response.data; |
| 89 | } else { | 94 | } else { |
| @@ -98,7 +103,7 @@ instance.interceptors.response.use(// 响应拦截器response类型就是Axios.r | @@ -98,7 +103,7 @@ instance.interceptors.response.use(// 响应拦截器response类型就是Axios.r | ||
| 98 | // console.log(error.request) | 103 | // console.log(error.request) |
| 99 | // console.log(error.response) | 104 | // console.log(error.response) |
| 100 | // 这里用来处理http常见错误,进行全局提示 | 105 | // 这里用来处理http常见错误,进行全局提示 |
| 101 | - if(error!=null && error.response!=null ){ | 106 | + if (error != null && error.response != null) { |
| 102 | let message = buildErrorMsg(error.response.status); | 107 | let message = buildErrorMsg(error.response.status); |
| 103 | // 错误消息可以使用全局弹框展示出来 | 108 | // 错误消息可以使用全局弹框展示出来 |
| 104 | console.log(`httpStatus:${error.response?.status}-${message},请检查网络或联系管理员!`) | 109 | console.log(`httpStatus:${error.response?.status}-${message},请检查网络或联系管理员!`) |
| @@ -225,6 +225,10 @@ export class HttpUrlUtils { | @@ -225,6 +225,10 @@ export class HttpUrlUtils { | ||
| 225 | */ | 225 | */ |
| 226 | static readonly LIVE_APPOINTMENT_PATH: string = "/api/live-center-message/zh/c/live/subscribe"; | 226 | static readonly LIVE_APPOINTMENT_PATH: string = "/api/live-center-message/zh/c/live/subscribe"; |
| 227 | /** | 227 | /** |
| 228 | + * 预约状态 | ||
| 229 | + */ | ||
| 230 | + static readonly LIVE_APPOINTMENT_BATCH_PATH: string = "api/live-center-message/zh/c/live/subscribe/user/batch"; | ||
| 231 | + /** | ||
| 228 | 232 | ||
| 229 | * 搜索结果 显示tab 数 | 233 | * 搜索结果 显示tab 数 |
| 230 | */ | 234 | */ |
| @@ -281,12 +285,21 @@ export class HttpUrlUtils { | @@ -281,12 +285,21 @@ export class HttpUrlUtils { | ||
| 281 | * 更新 兴趣偏好 | 285 | * 更新 兴趣偏好 |
| 282 | */ | 286 | */ |
| 283 | static readonly INTERESTS_UPDATETAG_PATH: string = "/api/rmrb-user-center/user/zh/c/tag/updateUserTag"; | 287 | static readonly INTERESTS_UPDATETAG_PATH: string = "/api/rmrb-user-center/user/zh/c/tag/updateUserTag"; |
| 288 | + /** | ||
| 289 | + * 获取启动页相关数据 | ||
| 290 | + */ | ||
| 291 | + static readonly LAUNCH_PAGE_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/launchPage"; | ||
| 284 | private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT; | 292 | private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT; |
| 285 | /** | 293 | /** |
| 286 | * 推荐列表 | 294 | * 推荐列表 |
| 287 | */ | 295 | */ |
| 288 | static readonly RECOMMEND_LIST: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list"; | 296 | static readonly RECOMMEND_LIST: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list"; |
| 289 | 297 | ||
| 298 | + /** | ||
| 299 | + * 搜索推荐 | ||
| 300 | + */ | ||
| 301 | + static readonly SEARCH_SUGGEST_DATA_PATH: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list"; | ||
| 302 | + | ||
| 290 | public static set hostUrl(value: string) { | 303 | public static set hostUrl(value: string) { |
| 291 | HttpUrlUtils._hostUrl = value; | 304 | HttpUrlUtils._hostUrl = value; |
| 292 | } | 305 | } |
| @@ -319,8 +332,9 @@ export class HttpUrlUtils { | @@ -319,8 +332,9 @@ export class HttpUrlUtils { | ||
| 319 | headers.set('EagleEye-TraceID', 'D539562E48554A60977AF4BECB6D6C7A') | 332 | headers.set('EagleEye-TraceID', 'D539562E48554A60977AF4BECB6D6C7A') |
| 320 | headers.set('imei', HttpUrlUtils.getImei()) | 333 | headers.set('imei', HttpUrlUtils.getImei()) |
| 321 | headers.set('Accept-Language', 'zh') | 334 | headers.set('Accept-Language', 'zh') |
| 322 | - headers.set('city', HttpUrlUtils.getCity()) | ||
| 323 | - headers.set('city_dode', HttpUrlUtils.getCityCode()) | 335 | + // headers.set('city', HttpUrlUtils.getCity()) |
| 336 | + // headers.set('city_dode', HttpUrlUtils.getCityCode()) | ||
| 337 | + HttpUrlUtils.setLocationHeader(headers) | ||
| 324 | // TODO 判断是否登录 | 338 | // TODO 判断是否登录 |
| 325 | headers.set('userId', HttpUrlUtils.getUserId()) | 339 | headers.set('userId', HttpUrlUtils.getUserId()) |
| 326 | headers.set('userType', HttpUrlUtils.getUserType()) | 340 | headers.set('userType', HttpUrlUtils.getUserType()) |
| @@ -363,6 +377,17 @@ export class HttpUrlUtils { | @@ -363,6 +377,17 @@ export class HttpUrlUtils { | ||
| 363 | } | 377 | } |
| 364 | } | 378 | } |
| 365 | 379 | ||
| 380 | + static setLocationHeader(headers: HashMap<string, string>) { | ||
| 381 | + let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string | ||
| 382 | + if (StringUtils.isNotEmpty(cityName)) { | ||
| 383 | + headers.set('city', encodeURI(cityName)) | ||
| 384 | + } | ||
| 385 | + let cityCode = SPHelper.default.getSync(SpConstants.LOCATION_CITY_CODE, '') as string | ||
| 386 | + if (StringUtils.isNotEmpty(cityCode)) { | ||
| 387 | + headers.set('city_dode', encodeURI(cityCode)) | ||
| 388 | + } | ||
| 389 | + } | ||
| 390 | + | ||
| 366 | static getHost() { | 391 | static getHost() { |
| 367 | return HttpUrlUtils._hostUrl; | 392 | return HttpUrlUtils._hostUrl; |
| 368 | } | 393 | } |
| @@ -458,7 +483,7 @@ export class HttpUrlUtils { | @@ -458,7 +483,7 @@ export class HttpUrlUtils { | ||
| 458 | return 'Android'; | 483 | return 'Android'; |
| 459 | } | 484 | } |
| 460 | 485 | ||
| 461 | - private static getImei() { | 486 | + public static getImei() { |
| 462 | // TODO | 487 | // TODO |
| 463 | return '8a81226a-cabd-3e1b-b630-b51db4a720ed'; | 488 | return '8a81226a-cabd-3e1b-b630-b51db4a720ed'; |
| 464 | } | 489 | } |
| @@ -486,7 +511,12 @@ export class HttpUrlUtils { | @@ -486,7 +511,12 @@ export class HttpUrlUtils { | ||
| 486 | } | 511 | } |
| 487 | 512 | ||
| 488 | static getVerifyCodeByTokenUrl() { | 513 | static getVerifyCodeByTokenUrl() { |
| 489 | - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/sendVerifyCodeByToken"; | 514 | + let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/sendVerifyCodeByToken"; |
| 515 | + return url; | ||
| 516 | + } | ||
| 517 | + | ||
| 518 | + static getCheckVerifyCodeByToken() { | ||
| 519 | + let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/checkVerifyCodeByToken"; | ||
| 490 | return url; | 520 | return url; |
| 491 | } | 521 | } |
| 492 | 522 | ||
| @@ -732,6 +762,12 @@ export class HttpUrlUtils { | @@ -732,6 +762,12 @@ export class HttpUrlUtils { | ||
| 732 | return url; | 762 | return url; |
| 733 | } | 763 | } |
| 734 | 764 | ||
| 765 | + static getLaunchPageDataUrl() { | ||
| 766 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LAUNCH_PAGE_PATH; | ||
| 767 | + return url; | ||
| 768 | + | ||
| 769 | + } | ||
| 770 | + | ||
| 735 | static getLiveDetailsUrl() { | 771 | static getLiveDetailsUrl() { |
| 736 | let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_DETAILS_PATH | 772 | let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_DETAILS_PATH |
| 737 | return url | 773 | return url |
| @@ -762,6 +798,11 @@ export class HttpUrlUtils { | @@ -762,6 +798,11 @@ export class HttpUrlUtils { | ||
| 762 | return url | 798 | return url |
| 763 | } | 799 | } |
| 764 | 800 | ||
| 801 | + static getAppointmentStatusUrl() { | ||
| 802 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_APPOINTMENT_BATCH_PATH | ||
| 803 | + return url | ||
| 804 | + } | ||
| 805 | + | ||
| 765 | static getSearchResultCountDataUrl() { | 806 | static getSearchResultCountDataUrl() { |
| 766 | let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_COUNT_DATA_PATH | 807 | let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_COUNT_DATA_PATH |
| 767 | return url | 808 | return url |
| @@ -802,6 +843,17 @@ export class HttpUrlUtils { | @@ -802,6 +843,17 @@ export class HttpUrlUtils { | ||
| 802 | let url = HttpUrlUtils._hostUrl + "/api/rmrb-interact/interact/zh/c/like/executeLike"; | 843 | let url = HttpUrlUtils._hostUrl + "/api/rmrb-interact/interact/zh/c/like/executeLike"; |
| 803 | return url; | 844 | return url; |
| 804 | } | 845 | } |
| 846 | + //搜索推荐 | ||
| 847 | + static getSearchSuggestDataUrl() { | ||
| 848 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_SUGGEST_DATA_PATH | ||
| 849 | + return url | ||
| 850 | + } | ||
| 851 | + | ||
| 852 | + //金刚位聚合页 | ||
| 853 | + static getThemeListUrl() { | ||
| 854 | + let url = HttpUrlUtils._hostUrl + "/api/rmrb-bff-display-zh/display/zh/c/themeList"; | ||
| 855 | + return url; | ||
| 856 | + } | ||
| 805 | 857 | ||
| 806 | // static getYcgCommonHeaders(): HashMap<string, string> { | 858 | // static getYcgCommonHeaders(): HashMap<string, string> { |
| 807 | // let headers: HashMap<string, string> = new HashMap<string, string>() | 859 | // let headers: HashMap<string, string> = new HashMap<string, string>() |
| @@ -2,4 +2,6 @@ export { WDRouterRule } from './src/main/ets/router/WDRouterRule' | @@ -2,4 +2,6 @@ export { WDRouterRule } from './src/main/ets/router/WDRouterRule' | ||
| 2 | 2 | ||
| 3 | export { WDRouterPage } from './src/main/ets/router/WDRouterPage' | 3 | export { WDRouterPage } from './src/main/ets/router/WDRouterPage' |
| 4 | 4 | ||
| 5 | -export { registerRouter } from './src/main/ets/router/Action2Page' | ||
| 5 | +export { registerRouter } from './src/main/ets/router/Action2Page' | ||
| 6 | + | ||
| 7 | +export { ProcessUtils } from './src/main/ets/utils/ProcessUtils' |
| @@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
| 9 | "dependencies": { | 9 | "dependencies": { |
| 10 | "wdKit": "file:../wdKit", | 10 | "wdKit": "file:../wdKit", |
| 11 | "wdBean": "file:../../features/wdBean", | 11 | "wdBean": "file:../../features/wdBean", |
| 12 | - "wdNetwork": "file:../../commons/wdNetwork" | 12 | + "wdNetwork": "file:../../commons/wdNetwork", |
| 13 | + "wdConstant": "file:../../commons/wdConstant" | ||
| 13 | } | 14 | } |
| 14 | } | 15 | } |
| @@ -50,11 +50,7 @@ export function registerRouter() { | @@ -50,11 +50,7 @@ export function registerRouter() { | ||
| 50 | 50 | ||
| 51 | Action2Page.register("JUMP_DETAIL_PAGE", (action: Action) => { | 51 | Action2Page.register("JUMP_DETAIL_PAGE", (action: Action) => { |
| 52 | if (action.params?.detailPageType == 2 || action.params?.detailPageType == 6) { | 52 | if (action.params?.detailPageType == 2 || action.params?.detailPageType == 6) { |
| 53 | - if (action.params?.liveStyle === 0) { | ||
| 54 | - return WDRouterPage.detailPlayLivePage | ||
| 55 | - } else { | ||
| 56 | - return WDRouterPage.detailPlayVLivePage | ||
| 57 | - } | 53 | + return WDRouterPage.detailPlayLiveCommon |
| 58 | } else if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) { | 54 | } else if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) { |
| 59 | return WDRouterPage.detailVideoListPage | 55 | return WDRouterPage.detailVideoListPage |
| 60 | } else if (action.params?.detailPageType == 9) { | 56 | } else if (action.params?.detailPageType == 9) { |
| @@ -69,6 +65,10 @@ export function registerRouter() { | @@ -69,6 +65,10 @@ export function registerRouter() { | ||
| 69 | return WDRouterPage.audioDetail | 65 | return WDRouterPage.audioDetail |
| 70 | } else if (action.params?.detailPageType == 18) { | 66 | } else if (action.params?.detailPageType == 18) { |
| 71 | return WDRouterPage.multiPictureListPage | 67 | return WDRouterPage.multiPictureListPage |
| 68 | + } else if (action.params?.detailPageType == 19) { | ||
| 69 | + return WDRouterPage.videoPlayPage | ||
| 70 | + }else if (action.params?.detailPageType == 30) { | ||
| 71 | + return WDRouterPage.themeListPage | ||
| 72 | } | 72 | } |
| 73 | return WDRouterPage.detailPlayVodPage | 73 | return WDRouterPage.detailPlayVodPage |
| 74 | }) | 74 | }) |
| @@ -54,10 +54,13 @@ export class WDRouterPage { | @@ -54,10 +54,13 @@ export class WDRouterPage { | ||
| 54 | // 直播详情页 | 54 | // 直播详情页 |
| 55 | static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage"); | 55 | static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage"); |
| 56 | static detailPlayVLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayVLivePage"); | 56 | static detailPlayVLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayVLivePage"); |
| 57 | + static detailPlayLiveCommon = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLiveCommon"); | ||
| 57 | // 多图(图集)详情页 | 58 | // 多图(图集)详情页 |
| 58 | static multiPictureDetailPage = new WDRouterPage("phone", "ets/pages/detail/MultiPictureDetailPage"); | 59 | static multiPictureDetailPage = new WDRouterPage("phone", "ets/pages/detail/MultiPictureDetailPage"); |
| 59 | //大图列表页 | 60 | //大图列表页 |
| 60 | static multiPictureListPage = new WDRouterPage("wdComponent", "ets/pages/MultiPictureListPage"); | 61 | static multiPictureListPage = new WDRouterPage("wdComponent", "ets/pages/MultiPictureListPage"); |
| 62 | + //单个视频播放页 | ||
| 63 | + static videoPlayPage = new WDRouterPage("wdComponent", "ets/pages/VideoPlayPage"); | ||
| 61 | // 音乐详情页 | 64 | // 音乐详情页 |
| 62 | static audioDetail = new WDRouterPage("phone", "ets/pages/detail/AudioDetail"); | 65 | static audioDetail = new WDRouterPage("phone", "ets/pages/detail/AudioDetail"); |
| 63 | // 动态详情页 | 66 | // 动态详情页 |
| @@ -117,4 +120,6 @@ export class WDRouterPage { | @@ -117,4 +120,6 @@ export class WDRouterPage { | ||
| 117 | static liveMorePage = new WDRouterPage("wdComponent", "ets/components/page/LiveMorePage"); | 120 | static liveMorePage = new WDRouterPage("wdComponent", "ets/components/page/LiveMorePage"); |
| 118 | //预约更多页 | 121 | //预约更多页 |
| 119 | static reserveMorePage = new WDRouterPage("wdComponent", "ets/components/page/ReserveMorePage"); | 122 | static reserveMorePage = new WDRouterPage("wdComponent", "ets/components/page/ReserveMorePage"); |
| 123 | + //金刚位聚合页 | ||
| 124 | + static themeListPage = new WDRouterPage("wdComponent", "ets/components/page/ThemeListPage"); | ||
| 120 | } | 125 | } |
| 1 | -import { Action, ContentDTO, Params } from 'wdBean'; | 1 | +import { Action, ContentDTO, Params, PhotoListBean, commentInfo } from 'wdBean'; |
| 2 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; | 2 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; |
| 3 | import { Logger } from 'wdKit'; | 3 | import { Logger } from 'wdKit'; |
| 4 | import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; | 4 | import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; |
| 5 | -import { WDRouterRule } from 'wdRouter'; | ||
| 6 | -import { ContentConstants } from '../constants/ContentConstants'; | ||
| 7 | -import { LiveModel } from '../viewmodel/LiveModel'; | 5 | +import { WDRouterRule } from '../router/WDRouterRule'; |
| 6 | +import { ContentConstants } from 'wdConstant'; | ||
| 7 | +import { common, Want } from '@kit.AbilityKit'; | ||
| 8 | +import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 9 | +import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean'; | ||
| 10 | +import { AdvertsBean } from 'wdBean/src/main/ets/bean/adv/AdvertsBean'; | ||
| 11 | + | ||
| 12 | +// import { LiveModel } from '../viewmodel/LiveModel'; | ||
| 8 | 13 | ||
| 9 | const TAG = 'ProcessUtils'; | 14 | const TAG = 'ProcessUtils'; |
| 10 | 15 | ||
| @@ -13,6 +18,65 @@ const TAG = 'ProcessUtils'; | @@ -13,6 +18,65 @@ const TAG = 'ProcessUtils'; | ||
| 13 | */ | 18 | */ |
| 14 | export class ProcessUtils { | 19 | export class ProcessUtils { |
| 15 | /** | 20 | /** |
| 21 | + * 广告中心的业务广告跳转方法( 现用在挂角广告) | ||
| 22 | + * @param advContent | ||
| 23 | + */ | ||
| 24 | + static openAdvDetail(matInfo: CompAdvMatInfoBean) { | ||
| 25 | + | ||
| 26 | + if (matInfo == null) { | ||
| 27 | + return; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + // 优先openType,再取linkType | ||
| 31 | + let type: string; | ||
| 32 | + if (!StringUtils.isEmpty(matInfo.openType)) { | ||
| 33 | + type = matInfo.openType; | ||
| 34 | + } else { | ||
| 35 | + type = matInfo.linkType; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + if ('0' == type) { | ||
| 39 | + // 0 :无链接 | ||
| 40 | + return; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + let linkUrl: string = matInfo.linkUrl; | ||
| 44 | + if (StringUtils.isEmpty(linkUrl)) { | ||
| 45 | + return; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + if ('1' == type) { | ||
| 49 | + // 内链 | ||
| 50 | + let content: ContentDTO = {} as ContentDTO; | ||
| 51 | + content.linkUrl = linkUrl; | ||
| 52 | + ProcessUtils.gotoWeb(content); | ||
| 53 | + } else if ('2' == type) { | ||
| 54 | + // 外链 | ||
| 55 | + ProcessUtils.jumpExternalWebPage(linkUrl); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * 展现中心的广告跳转 ( 现用在挂角广告) | ||
| 63 | + * @param advert 展现中心的展现广告 | ||
| 64 | + */ | ||
| 65 | + static advJumpMainPage(advert: AdvertsBean) { | ||
| 66 | + | ||
| 67 | + let content: ContentDTO = { | ||
| 68 | + linkUrl: advert.linkUrl, | ||
| 69 | + pageId: advert.pageId, | ||
| 70 | + objectId: advert.objectId, | ||
| 71 | + objectType: advert.objectType, | ||
| 72 | + relId: advert.relId, | ||
| 73 | + bottomNavId: advert.bottomNavId | ||
| 74 | + } as ContentDTO; | ||
| 75 | + | ||
| 76 | + ProcessUtils.processPage(content); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + /** | ||
| 16 | * 页面跳转 | 80 | * 页面跳转 |
| 17 | */ | 81 | */ |
| 18 | static processPage(content: ContentDTO) { | 82 | static processPage(content: ContentDTO) { |
| @@ -25,7 +89,7 @@ export class ProcessUtils { | @@ -25,7 +89,7 @@ export class ProcessUtils { | ||
| 25 | return; | 89 | return; |
| 26 | } | 90 | } |
| 27 | let type = content.objectType; | 91 | let type = content.objectType; |
| 28 | - console.log(TAG,'objectType',`${JSON.stringify(content)}`); | 92 | + console.log(TAG, 'objectType', `${JSON.stringify(content)}`); |
| 29 | switch (type) { | 93 | switch (type) { |
| 30 | case ContentConstants.TYPE_NONE: | 94 | case ContentConstants.TYPE_NONE: |
| 31 | Logger.debug(TAG, "processPage, do nothing"); | 95 | Logger.debug(TAG, "processPage, do nothing"); |
| @@ -57,10 +121,13 @@ export class ProcessUtils { | @@ -57,10 +121,13 @@ export class ProcessUtils { | ||
| 57 | break; | 121 | break; |
| 58 | //动态详情页(动态图文) | 122 | //动态详情页(动态图文) |
| 59 | case ContentConstants.TYPE_FOURTEEN: | 123 | case ContentConstants.TYPE_FOURTEEN: |
| 60 | - break; | 124 | + ProcessUtils.gotoDynamicDetailPage(content); |
| 61 | //动态详情页(动态视频) | 125 | //动态详情页(动态视频) |
| 62 | case ContentConstants.TYPE_FIFTEEN: | 126 | case ContentConstants.TYPE_FIFTEEN: |
| 63 | - ProcessUtils.gotoWeb(content); | 127 | + ProcessUtils.gotoDynamicDetailPage(content); |
| 128 | + break; | ||
| 129 | + case ContentConstants.TYPE_THIRTY: | ||
| 130 | + ProcessUtils.gotoThemeListPage(content) | ||
| 64 | break; | 131 | break; |
| 65 | default: | 132 | default: |
| 66 | break; | 133 | break; |
| @@ -75,7 +142,7 @@ export class ProcessUtils { | @@ -75,7 +142,7 @@ export class ProcessUtils { | ||
| 75 | let taskAction: Action = { | 142 | let taskAction: Action = { |
| 76 | type: 'JUMP_DETAIL_PAGE', | 143 | type: 'JUMP_DETAIL_PAGE', |
| 77 | params: { | 144 | params: { |
| 78 | - detailPageType: 14, | 145 | + detailPageType: Number.parseInt(content.objectType), |
| 79 | contentID: content?.objectId, | 146 | contentID: content?.objectId, |
| 80 | extra: { | 147 | extra: { |
| 81 | relType: content?.relType, | 148 | relType: content?.relType, |
| @@ -91,20 +158,18 @@ export class ProcessUtils { | @@ -91,20 +158,18 @@ export class ProcessUtils { | ||
| 91 | * 图集详情页 | 158 | * 图集详情页 |
| 92 | * @param content | 159 | * @param content |
| 93 | * */ | 160 | * */ |
| 94 | - private static gotoAtlasDetailPage(content: ContentDTO) { | 161 | + public static gotoMultiPictureListPage(photoList: PhotoListBean[]) { |
| 95 | let taskAction: Action = { | 162 | let taskAction: Action = { |
| 96 | type: 'JUMP_DETAIL_PAGE', | 163 | type: 'JUMP_DETAIL_PAGE', |
| 97 | params: { | 164 | params: { |
| 98 | - detailPageType: 17, | ||
| 99 | - contentID: content?.objectId, | 165 | + detailPageType: 18, |
| 100 | extra: { | 166 | extra: { |
| 101 | - relType: content?.relType, | ||
| 102 | - relId: content?.relId, | 167 | + photoList |
| 103 | } as ExtraDTO | 168 | } as ExtraDTO |
| 104 | } as Params, | 169 | } as Params, |
| 105 | }; | 170 | }; |
| 106 | WDRouterRule.jumpWithAction(taskAction) | 171 | WDRouterRule.jumpWithAction(taskAction) |
| 107 | - Logger.debug(TAG, `gotoAtlasDetailPage, ${content.objectId}`); | 172 | + Logger.debug(TAG, `gotoMultiPictureListPage`); |
| 108 | } | 173 | } |
| 109 | 174 | ||
| 110 | private static gotoSpecialTopic(content: ContentDTO) { | 175 | private static gotoSpecialTopic(content: ContentDTO) { |
| @@ -129,16 +194,25 @@ export class ProcessUtils { | @@ -129,16 +194,25 @@ export class ProcessUtils { | ||
| 129 | Logger.debug(TAG, `gotoWeb, ${content.objectId}`); | 194 | Logger.debug(TAG, `gotoWeb, ${content.objectId}`); |
| 130 | } | 195 | } |
| 131 | 196 | ||
| 197 | + static commentGotoWeb(content: commentInfo) { | ||
| 198 | + let taskAction: Action = { | ||
| 199 | + type: 'JUMP_INNER_NEW_PAGE', | ||
| 200 | + params: { | ||
| 201 | + contentID: content?.newsId, | ||
| 202 | + pageID: 'IMAGE_TEXT_DETAIL', | ||
| 203 | + extra: { | ||
| 204 | + relType: content?.relType, | ||
| 205 | + relId: content?.relId, | ||
| 206 | + sourcePage: '5', | ||
| 207 | + commentId: content?.commentId | ||
| 208 | + } as ExtraDTO | ||
| 209 | + } as Params, | ||
| 210 | + }; | ||
| 211 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 212 | + Logger.debug(TAG, `commentGotoWeb, ${content.newsId}`); | ||
| 213 | + } | ||
| 214 | + | ||
| 132 | private static gotoWeb(content: ContentDTO) { | 215 | private static gotoWeb(content: ContentDTO) { |
| 133 | - // // topicId | ||
| 134 | - // content.channelId; | ||
| 135 | - // content.linkUrl; | ||
| 136 | - // content.objectId; | ||
| 137 | - // // CompId | ||
| 138 | - // content.relId; | ||
| 139 | - // content.relType; | ||
| 140 | - // // ScrollToBottom | ||
| 141 | - // // FromPage | ||
| 142 | let taskAction: Action = { | 216 | let taskAction: Action = { |
| 143 | type: 'JUMP_INNER_NEW_PAGE', | 217 | type: 'JUMP_INNER_NEW_PAGE', |
| 144 | params: { | 218 | params: { |
| @@ -148,7 +222,8 @@ export class ProcessUtils { | @@ -148,7 +222,8 @@ export class ProcessUtils { | ||
| 148 | relType: content?.relType, | 222 | relType: content?.relType, |
| 149 | relId: content?.relId, | 223 | relId: content?.relId, |
| 150 | channelId: content?.channelId, | 224 | channelId: content?.channelId, |
| 151 | - sourcePage: '5' | 225 | + sourcePage: '5', |
| 226 | + commentId: content?.commentInfo?.commentId | ||
| 152 | } as ExtraDTO | 227 | } as ExtraDTO |
| 153 | } as Params, | 228 | } as Params, |
| 154 | }; | 229 | }; |
| @@ -173,20 +248,11 @@ export class ProcessUtils { | @@ -173,20 +248,11 @@ export class ProcessUtils { | ||
| 173 | } | 248 | } |
| 174 | 249 | ||
| 175 | private static async gotoLive(content: ContentDTO) { | 250 | private static async gotoLive(content: ContentDTO) { |
| 176 | - const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '') | ||
| 177 | - const liveStyle = liveDetail[0].liveInfo.liveStyle | ||
| 178 | - const liveState = liveDetail[0].liveInfo.liveState | ||
| 179 | - | ||
| 180 | - | ||
| 181 | - console.error('liveDetail===', liveDetail) | ||
| 182 | - | ||
| 183 | - | ||
| 184 | let taskAction: Action = { | 251 | let taskAction: Action = { |
| 185 | type: 'JUMP_DETAIL_PAGE', | 252 | type: 'JUMP_DETAIL_PAGE', |
| 186 | params: { | 253 | params: { |
| 187 | detailPageType: 2, | 254 | detailPageType: 2, |
| 188 | contentID: content?.objectId, | 255 | contentID: content?.objectId, |
| 189 | - liveStyle: liveState === 'wait' ? 0 : liveStyle, | ||
| 190 | extra: { | 256 | extra: { |
| 191 | relType: content?.relType, | 257 | relType: content?.relType, |
| 192 | relId: content?.relId, | 258 | relId: content?.relId, |
| @@ -212,4 +278,78 @@ export class ProcessUtils { | @@ -212,4 +278,78 @@ export class ProcessUtils { | ||
| 212 | WDRouterRule.jumpWithAction(taskAction) | 278 | WDRouterRule.jumpWithAction(taskAction) |
| 213 | Logger.debug(TAG, `gotoAudio, ${content.objectId}`); | 279 | Logger.debug(TAG, `gotoAudio, ${content.objectId}`); |
| 214 | } | 280 | } |
| 215 | -} | ||
| 281 | + | ||
| 282 | + /** | ||
| 283 | + * 金刚位聚合页 | ||
| 284 | + * @param content | ||
| 285 | + * */ | ||
| 286 | + private static gotoThemeListPage(content: ContentDTO) { | ||
| 287 | + let taskAction: Action = { | ||
| 288 | + type: 'JUMP_DETAIL_PAGE', | ||
| 289 | + params: { | ||
| 290 | + detailPageType: 30, | ||
| 291 | + contentID: content?.objectId, | ||
| 292 | + extra: { | ||
| 293 | + relType: content?.relType, | ||
| 294 | + relId: content?.relId, | ||
| 295 | + } as ExtraDTO | ||
| 296 | + } as Params, | ||
| 297 | + }; | ||
| 298 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 299 | + Logger.debug(TAG, `gotoAtlasDetailPage, ${content.objectId}`); | ||
| 300 | + } | ||
| 301 | + | ||
| 302 | + /** | ||
| 303 | + * 图片预览页 | ||
| 304 | + * @param content | ||
| 305 | + * */ | ||
| 306 | + private static gotoAtlasDetailPage(content: ContentDTO) { | ||
| 307 | + let taskAction: Action = { | ||
| 308 | + type: 'JUMP_DETAIL_PAGE', | ||
| 309 | + params: { | ||
| 310 | + detailPageType: 17, | ||
| 311 | + contentID: content?.objectId, | ||
| 312 | + extra: { | ||
| 313 | + relType: content?.relType, | ||
| 314 | + relId: content?.relId, | ||
| 315 | + } as ExtraDTO | ||
| 316 | + } as Params, | ||
| 317 | + }; | ||
| 318 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 319 | + Logger.debug(TAG, `gotoAtlasDetailPage, ${content.objectId}`); | ||
| 320 | + } | ||
| 321 | + | ||
| 322 | + /** | ||
| 323 | + * 打开外链 | ||
| 324 | + * @param url 外链地址 | ||
| 325 | + */ | ||
| 326 | + public static jumpExternalWebPage(url: string) { | ||
| 327 | + let context = getContext() as common.UIAbilityContext; | ||
| 328 | + let wantInfo: Want = { | ||
| 329 | + action: 'ohos.want.action.viewData', | ||
| 330 | + entities: ['entity.system.browsable'], | ||
| 331 | + uri: url | ||
| 332 | + } | ||
| 333 | + context.startAbility(wantInfo).then(() => { | ||
| 334 | + Logger.debug(TAG, 'jumpExternalWebPage success') | ||
| 335 | + }).catch((err: BusinessError) => { | ||
| 336 | + Logger.error(TAG, 'jumpExternalWebPage success, error: ' + JSON.stringify(err)) | ||
| 337 | + }) | ||
| 338 | + } | ||
| 339 | + | ||
| 340 | + /** | ||
| 341 | + * 打开端内web页面 | ||
| 342 | + * @param url web地址 | ||
| 343 | + */ | ||
| 344 | + public static gotoDefaultWebPage(url: string) { | ||
| 345 | + let taskAction: Action = { | ||
| 346 | + type: 'JUMP_H5_BY_WEB_VIEW', | ||
| 347 | + params: { | ||
| 348 | + url: url, | ||
| 349 | + } as Params, | ||
| 350 | + }; | ||
| 351 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 352 | + } | ||
| 353 | + | ||
| 354 | + | ||
| 355 | +} |
| @@ -3,8 +3,7 @@ import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | @@ -3,8 +3,7 @@ import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | ||
| 3 | import { Logger } from 'wdKit'; | 3 | import { Logger } from 'wdKit'; |
| 4 | import { H5CallNativeType } from './H5CallNativeType'; | 4 | import { H5CallNativeType } from './H5CallNativeType'; |
| 5 | import { ContentDTO } from 'wdBean'; | 5 | import { ContentDTO } from 'wdBean'; |
| 6 | -//TODO 这里引用了 features模块,是否考虑将跳转抽到公共模块 | ||
| 7 | -import { ProcessUtils } from '../../../../../../features/wdComponent/src/main/ets/utils/ProcessUtils'; | 6 | +import { ProcessUtils } from 'wdRouter/src/main/ets/utils/ProcessUtils'; |
| 8 | 7 | ||
| 9 | const TAG = 'JsBridgeBiz' | 8 | const TAG = 'JsBridgeBiz' |
| 10 | 9 | ||
| @@ -15,6 +14,7 @@ const TAG = 'JsBridgeBiz' | @@ -15,6 +14,7 @@ const TAG = 'JsBridgeBiz' | ||
| 15 | */ | 14 | */ |
| 16 | export function performJSCallNative(data: Message, call: Callback) { | 15 | export function performJSCallNative(data: Message, call: Callback) { |
| 17 | Logger.debug(TAG, 'performJSCallNative handlerName: ' + data.handlerName + ', data: ' + JSON.stringify(data.data)) | 16 | Logger.debug(TAG, 'performJSCallNative handlerName: ' + data.handlerName + ', data: ' + JSON.stringify(data.data)) |
| 17 | + | ||
| 18 | switch (data.handlerName) { | 18 | switch (data.handlerName) { |
| 19 | case H5CallNativeType.jsCall_currentPageOperate: | 19 | case H5CallNativeType.jsCall_currentPageOperate: |
| 20 | break; | 20 | break; |
| @@ -25,12 +25,13 @@ export function performJSCallNative(data: Message, call: Callback) { | @@ -25,12 +25,13 @@ export function performJSCallNative(data: Message, call: Callback) { | ||
| 25 | case H5CallNativeType.jsCall_getArticleDetailBussinessData: | 25 | case H5CallNativeType.jsCall_getArticleDetailBussinessData: |
| 26 | break; | 26 | break; |
| 27 | case H5CallNativeType.jsCall_callAppService: | 27 | case H5CallNativeType.jsCall_callAppService: |
| 28 | + handleJsCallCallAppService(data) | ||
| 28 | break; | 29 | break; |
| 29 | case H5CallNativeType.jsCall_receiveH5Data: | 30 | case H5CallNativeType.jsCall_receiveH5Data: |
| 30 | - if(data?.data?.dataSource === 5){ | ||
| 31 | - handleH5Data(JSON.parse(data?.data?.dataJson || '{}')) | ||
| 32 | - | ||
| 33 | - } | 31 | + handleJsCallReceiveH5Data(data) |
| 32 | + break; | ||
| 33 | + case H5CallNativeType.jsCall_appInnerLinkMethod: | ||
| 34 | + handleJsCallAppInnerLinkMethod(data) | ||
| 34 | break; | 35 | break; |
| 35 | case 'changeNativeMessage': | 36 | case 'changeNativeMessage': |
| 36 | call("this is change Web Message") | 37 | call("this is change Web Message") |
| @@ -52,17 +53,35 @@ class AppInfo { | @@ -52,17 +53,35 @@ class AppInfo { | ||
| 52 | * 获取App公共信息 | 53 | * 获取App公共信息 |
| 53 | */ | 54 | */ |
| 54 | function getAppPublicInfo(): string { | 55 | function getAppPublicInfo(): string { |
| 56 | + | ||
| 55 | let info = new AppInfo() | 57 | let info = new AppInfo() |
| 56 | info.plat = 'Phone' | 58 | info.plat = 'Phone' |
| 57 | // 直接用Android,后续适配再新增鸿蒙 | 59 | // 直接用Android,后续适配再新增鸿蒙 |
| 58 | info.system = 'Android' | 60 | info.system = 'Android' |
| 59 | info.networkStatus = 1 | 61 | info.networkStatus = 1 |
| 60 | let result = JSON.stringify(info) | 62 | let result = JSON.stringify(info) |
| 63 | + Logger.debug(TAG, 'getAppPublicInfo: ' + JSON.stringify(info)) | ||
| 64 | + | ||
| 61 | return result; | 65 | return result; |
| 62 | } | 66 | } |
| 63 | 67 | ||
| 64 | -function handleH5Data(content:ContentDTO) { | ||
| 65 | - Logger.debug(TAG, 'handleH5Data' + ', content: ' + JSON.stringify(content)) | ||
| 66 | - ProcessUtils.processPage(content) | 68 | +function handleJsCallReceiveH5Data(data: Message) { |
| 69 | + switch (data?.data?.dataSource) { | ||
| 70 | + case 5: | ||
| 71 | + if (data?.data?.dataSource === 5) { | ||
| 72 | + ProcessUtils.processPage(JSON.parse(data?.data?.dataJson || '{}')) | ||
| 73 | + } | ||
| 74 | + break; | ||
| 75 | + default: | ||
| 76 | + | ||
| 77 | + break; | ||
| 78 | + } | ||
| 79 | +} | ||
| 80 | + | ||
| 81 | +function handleJsCallCallAppService(data: Message) { | ||
| 82 | + | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +function handleJsCallAppInnerLinkMethod(data: Message) { | ||
| 67 | } | 86 | } |
| 68 | 87 |
| @@ -7,7 +7,7 @@ import { performJSCallNative } from './JsBridgeBiz'; | @@ -7,7 +7,7 @@ import { performJSCallNative } from './JsBridgeBiz'; | ||
| 7 | import { H5CallNativeType } from './H5CallNativeType'; | 7 | import { H5CallNativeType } from './H5CallNativeType'; |
| 8 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | 8 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; |
| 9 | 9 | ||
| 10 | -const TAG = 'WdWebLocalComponent'; | 10 | +const TAG = 'WdWebComponent'; |
| 11 | 11 | ||
| 12 | @Component | 12 | @Component |
| 13 | export struct WdWebComponent { | 13 | export struct WdWebComponent { |
| @@ -85,9 +85,10 @@ export struct WdWebComponent { | @@ -85,9 +85,10 @@ export struct WdWebComponent { | ||
| 85 | onPageBegin: (url?: string) => void = () => { | 85 | onPageBegin: (url?: string) => void = () => { |
| 86 | Logger.debug(TAG, 'onPageBegin'); | 86 | Logger.debug(TAG, 'onPageBegin'); |
| 87 | this.registerHandlers(); | 87 | this.registerHandlers(); |
| 88 | - // setTimeout(() => { | ||
| 89 | - BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl) | ||
| 90 | - // }, 100) | 88 | + //有时序问题 必须延时执行 |
| 89 | + setTimeout(() => { | ||
| 90 | + BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl) | ||
| 91 | + }, 200) | ||
| 91 | } | 92 | } |
| 92 | onPageEnd: (url?: string) => void = () => { | 93 | onPageEnd: (url?: string) => void = () => { |
| 93 | Logger.debug(TAG, 'onPageEnd'); | 94 | Logger.debug(TAG, 'onPageEnd'); |
| @@ -102,9 +102,10 @@ export struct WdWebLocalComponent { | @@ -102,9 +102,10 @@ export struct WdWebLocalComponent { | ||
| 102 | onPageBegin: (url?: string) => void = () => { | 102 | onPageBegin: (url?: string) => void = () => { |
| 103 | Logger.debug(TAG, 'onPageBegin'); | 103 | Logger.debug(TAG, 'onPageBegin'); |
| 104 | this.registerHandlers(); | 104 | this.registerHandlers(); |
| 105 | - // setTimeout(() => { | ||
| 106 | - BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl) | ||
| 107 | - // }, 100) | 105 | + //有时序问题 必须延时执行 |
| 106 | + setTimeout(() => { | ||
| 107 | + BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl) | ||
| 108 | + }, 200) | ||
| 108 | } | 109 | } |
| 109 | onPageEnd: (url?: string) => void = () => { | 110 | onPageEnd: (url?: string) => void = () => { |
| 110 | Logger.debug(TAG, 'onPageEnd'); | 111 | Logger.debug(TAG, 'onPageEnd'); |
| @@ -15,6 +15,8 @@ export { ItemBean } from './src/main/ets/bean/ItemBean'; | @@ -15,6 +15,8 @@ export { ItemBean } from './src/main/ets/bean/ItemBean'; | ||
| 15 | // Content | 15 | // Content |
| 16 | export { ContentDTO } from './src/main/ets/bean/content/ContentDTO'; | 16 | export { ContentDTO } from './src/main/ets/bean/content/ContentDTO'; |
| 17 | 17 | ||
| 18 | +export { commentInfo } from './src/main/ets/bean/content/commentInfo'; | ||
| 19 | + | ||
| 18 | export { AudioDTO } from './src/main/ets/bean/content/AudioDTO'; | 20 | export { AudioDTO } from './src/main/ets/bean/content/AudioDTO'; |
| 19 | 21 | ||
| 20 | export { Action } from './src/main/ets/bean/content/Action' | 22 | export { Action } from './src/main/ets/bean/content/Action' |
| @@ -37,7 +39,6 @@ export { | @@ -37,7 +39,6 @@ export { | ||
| 37 | postExecuteCollectRecordParams, | 39 | postExecuteCollectRecordParams, |
| 38 | contentListParams, | 40 | contentListParams, |
| 39 | postInteractAccentionOperateParams, | 41 | postInteractAccentionOperateParams, |
| 40 | - postRecommendListParams, | ||
| 41 | contentListItem | 42 | contentListItem |
| 42 | } from './src/main/ets/bean/detail/MultiPictureDetailPageDTO'; | 43 | } from './src/main/ets/bean/detail/MultiPictureDetailPageDTO'; |
| 43 | 44 | ||
| @@ -119,12 +120,18 @@ export { ArticleListDTO } from './src/main/ets/bean/component/ArticleListDTO'; | @@ -119,12 +120,18 @@ export { ArticleListDTO } from './src/main/ets/bean/component/ArticleListDTO'; | ||
| 119 | 120 | ||
| 120 | export { appStyleImagesDTO } from './src/main/ets/bean/content/appStyleImagesDTO'; | 121 | export { appStyleImagesDTO } from './src/main/ets/bean/content/appStyleImagesDTO'; |
| 121 | 122 | ||
| 122 | -export { LiveRoomBean,LiveRoomItemBean } from './src/main/ets/bean/live/LiveRoomBean'; | 123 | +export { LiveRoomBean, LiveRoomItemBean } from './src/main/ets/bean/live/LiveRoomBean'; |
| 123 | 124 | ||
| 124 | export { LiveRoomDataBean } from './src/main/ets/bean/live/LiveRoomDataBean'; | 125 | export { LiveRoomDataBean } from './src/main/ets/bean/live/LiveRoomDataBean'; |
| 125 | 126 | ||
| 127 | +export { ReserveBean } from './src/main/ets/bean/live/ReserveBean'; | ||
| 128 | + | ||
| 126 | export { LiveInfoDTO } from './src/main/ets/bean/detail/LiveInfoDTO'; | 129 | export { LiveInfoDTO } from './src/main/ets/bean/detail/LiveInfoDTO'; |
| 127 | 130 | ||
| 131 | +export { postRecommendListParams } from './src/main/ets/bean/detail/postRecommendListParams'; | ||
| 132 | + | ||
| 133 | +export { postThemeListParams } from './src/main/ets/bean/detail/postThemeListParams'; | ||
| 134 | + | ||
| 128 | export { LiveDTO } from './src/main/ets/bean/peoples/LiveDTO'; | 135 | export { LiveDTO } from './src/main/ets/bean/peoples/LiveDTO'; |
| 129 | 136 | ||
| 130 | export { contentVideosDTO } from './src/main/ets/bean/content/contentVideosDTO'; | 137 | export { contentVideosDTO } from './src/main/ets/bean/content/contentVideosDTO'; |
| @@ -141,3 +148,8 @@ export { | @@ -141,3 +148,8 @@ export { | ||
| 141 | InfluenceData | 148 | InfluenceData |
| 142 | } from './src/main/ets/bean/peoples/PeopleShipUserDetailData'; | 149 | } from './src/main/ets/bean/peoples/PeopleShipUserDetailData'; |
| 143 | 150 | ||
| 151 | +export { | ||
| 152 | + UserDetail, | ||
| 153 | + UserExtend | ||
| 154 | +} from './src/main/ets/bean/user/UserDetail'; | ||
| 155 | + |
| 1 | + | ||
| 2 | +/** | ||
| 3 | + * @Description: 信息集合 | ||
| 4 | + * @Author: | ||
| 5 | + * @Email: liyubing@wondertek.com.cn | ||
| 6 | + * @CreateDate: | ||
| 7 | + * @UpdateRemark: 更新说明 | ||
| 8 | + * @Version: 1.0 | ||
| 9 | + */ | ||
| 10 | +export interface AdvertsBean{ | ||
| 11 | + | ||
| 12 | + /** | ||
| 13 | + * 广告id | ||
| 14 | + */ | ||
| 15 | + id:string | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * 广告relId | ||
| 19 | + */ | ||
| 20 | + relId:string | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 广告素材名称 | ||
| 24 | + */ | ||
| 25 | + matTitle:string | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 投放开始时间yyyy-MM-dd HH:mm:ss | ||
| 29 | + */ | ||
| 30 | + startTime:string | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 投放结束时间yyyy-MM-dd HH:mm:ss | ||
| 34 | + */ | ||
| 35 | + endTime:string | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 展现时段,多组数据:9:00:00-10:00:00|17:00:00-18:00:00 | ||
| 39 | + */ | ||
| 40 | + displayTime:string | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 展现优先级,数值越小,等级越高 | ||
| 44 | + */ | ||
| 45 | + displayLevel:string | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 链接跳转类型,0:无连接;1:内链(站内内容);2:外链 | ||
| 49 | + */ | ||
| 50 | + linkType:number; | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * 外链广告外链地址,link_type=2生效 | ||
| 54 | + */ | ||
| 55 | + linkUrl:string | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 内链内容id 仅link_type=1生效 | ||
| 59 | + */ | ||
| 60 | + contentId:string | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * 对象类型 0:不跳转 1:视频,2:直播,5:专题,6:链接,8:图文,9:组图,10:H5新闻,11:频道 | ||
| 64 | + */ | ||
| 65 | + objectType:string | ||
| 66 | + /** | ||
| 67 | + * 内容标题 | ||
| 68 | + */ | ||
| 69 | + contentTitle:string | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * 专题页面id | ||
| 73 | + */ | ||
| 74 | + topicPageId:string | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * 挂角封面图 | ||
| 78 | + */ | ||
| 79 | + displayUrl:string | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * 页面id | ||
| 83 | + */ | ||
| 84 | + pageId:string | ||
| 85 | + | ||
| 86 | + /** | ||
| 87 | + * 跳转id | ||
| 88 | + */ | ||
| 89 | + objectId:string | ||
| 90 | + | ||
| 91 | + /** | ||
| 92 | + * 对象分类 ;频道(1:一级频道,2:二级频道),专题(1:普通专题,2:主题专题,3:作者专题) | ||
| 93 | + */ | ||
| 94 | + objectLevel:string | ||
| 95 | + | ||
| 96 | + /** | ||
| 97 | + * 底部导航栏 id(用于频道跳转) | ||
| 98 | + */ | ||
| 99 | + bottomNavId:string | ||
| 100 | + | ||
| 101 | +} |
| 1 | +/** | ||
| 2 | + * @Description: 挂角广告数据 | ||
| 3 | + * @Author: | ||
| 4 | + * @Email: liyubing@wondertek.com.cn | ||
| 5 | + * @CreateDate: | ||
| 6 | + * @UpdateRemark: 更新说明 | ||
| 7 | + * @Version: 1.0 | ||
| 8 | + */ | ||
| 9 | +import { AdvertsBean } from './AdvertsBean'; | ||
| 10 | +import { CompAdvMatInfoBean, CompAdvSlotInfoBean } from './CompAdvInfoBean'; | ||
| 11 | + | ||
| 12 | +export interface AdvRuleBean { | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * 广告投放位编码 | ||
| 16 | + */ | ||
| 17 | + pos: string; | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 广告展示顺序,0:随机展示;1列表循环 | ||
| 21 | + */ | ||
| 22 | + displayMode: number | ||
| 23 | + /** | ||
| 24 | + * 每间隔刷新n次展示广告 | ||
| 25 | + */ | ||
| 26 | + refreshFrequency: number | ||
| 27 | + /** | ||
| 28 | + * 广告信息集合 | ||
| 29 | + */ | ||
| 30 | + advert: AdvertsBean; | ||
| 31 | + | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +/** | ||
| 35 | + * 广告组件数据 | ||
| 36 | + */ | ||
| 37 | +export interface CompAdvBean { | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 广告订单id | ||
| 41 | + */ | ||
| 42 | + id: string; | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 投放开始时间 | ||
| 46 | + */ | ||
| 47 | + startTime: number; | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * 投放结束时间 | ||
| 51 | + */ | ||
| 52 | + endTime: number; | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 信息流广告素材 | ||
| 56 | + */ | ||
| 57 | + matInfo: CompAdvMatInfoBean | ||
| 58 | + /** | ||
| 59 | + * 信息流广告位 | ||
| 60 | + */ | ||
| 61 | + slotInfo: CompAdvSlotInfoBean | ||
| 62 | + /** | ||
| 63 | + * 展示优先级 | ||
| 64 | + * 广告A,displayPriority=1 | ||
| 65 | + * 广告B,displayPriority=2 | ||
| 66 | + * 则打开页面时,挂角展示顺序 A->B (优先级升序排列) | ||
| 67 | + */ | ||
| 68 | + displayPriority: number; | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * 展示的次数 | ||
| 72 | + */ | ||
| 73 | + showCount: number; | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 页面id | ||
| 77 | + */ | ||
| 78 | + pageId: String ; | ||
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * 开屏广告-显示时长 | ||
| 82 | + */ | ||
| 83 | + displayDuration: String; | ||
| 84 | + | ||
| 85 | + /** | ||
| 86 | + * 开屏广告-展示轮数 | ||
| 87 | + * 2.launchAdInfo有多个时: | ||
| 88 | + * 广告A,displayRound=10 | ||
| 89 | + * 广告B,displayRound=5, | ||
| 90 | + * 每次开机屏展示广告概率 | ||
| 91 | + * 广告A=10/(10+5) | ||
| 92 | + * 广告B=5/(10+5) | ||
| 93 | + * 广告A展示10次后,不再展示, | ||
| 94 | + * 广告B展示5此后,不再展示。 | ||
| 95 | + * 下一轮展示继续上面逻辑。 | ||
| 96 | + */ | ||
| 97 | + displayRound: number; | ||
| 98 | + | ||
| 99 | + | ||
| 100 | + | ||
| 101 | + | ||
| 102 | +} |
| 1 | +/** | ||
| 2 | + * @Description: 组件广告信息 | ||
| 3 | + * @Author: | ||
| 4 | + * @Email: liyubing@wondertek.com.cn | ||
| 5 | + * @CreateDate: | ||
| 6 | + * @UpdateRemark: 更新说明 | ||
| 7 | + * @Version: 1.0 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +/* | ||
| 11 | + 信息流广告素材解析累 | ||
| 12 | + */ | ||
| 13 | +export interface CompAdvMatInfoBean { | ||
| 14 | + | ||
| 15 | + /** | ||
| 16 | + * 广告标题 | ||
| 17 | + */ | ||
| 18 | + advTitle: string | ||
| 19 | + /** | ||
| 20 | + * 3:信息流广告 | ||
| 21 | + */ | ||
| 22 | + advType: string | ||
| 23 | + /** | ||
| 24 | + * 信息流广告类型(4:轮播图 5:三图广告 6:小图广告 7:长通栏广告 8:大图广告 9:视频广告 10:展会广告 11:冠名广告 12:顶部长通栏广告) | ||
| 25 | + */ | ||
| 26 | + advSubType: string | ||
| 27 | + /** | ||
| 28 | + * 素材图片信息;adv_subtype=4,5,6,7,8,9,12 时使用 | ||
| 29 | + */ | ||
| 30 | + matImageUrl: string[] | ||
| 31 | + /** | ||
| 32 | + * 视频广告地址(adv_subtype=9) | ||
| 33 | + */ | ||
| 34 | + matVideoUrl: string | ||
| 35 | + /** | ||
| 36 | + * 扩展信息:advSubType=10,11时使用,字段示例见接口备注。 | ||
| 37 | + */ | ||
| 38 | + extraData: string | ||
| 39 | + /** | ||
| 40 | + * 链接类型: 0:无链接;1:内链(文章);2:外链 | ||
| 41 | + */ | ||
| 42 | + linkType: string | ||
| 43 | + /** | ||
| 44 | + * 链接跳转类型 :0-没链接,不用打开,1-端内打开,2-端外打开 | ||
| 45 | + */ | ||
| 46 | + openType: string | ||
| 47 | + /** | ||
| 48 | + * 广告跳转链接 | ||
| 49 | + */ | ||
| 50 | + linkUrl: string | ||
| 51 | + /** | ||
| 52 | + * 素材类型(0:图片 1:视频) | ||
| 53 | + */ | ||
| 54 | + matType: string | ||
| 55 | + /** | ||
| 56 | + * 开屏样式(1:全屏样式 0:底部固定Logo) | ||
| 57 | + */ | ||
| 58 | + startStyle: string | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +/** | ||
| 62 | + * 信息流广告位 | ||
| 63 | + */ | ||
| 64 | +export interface CompAdvSlotInfoBean { | ||
| 65 | + | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * 组件id | ||
| 69 | + */ | ||
| 70 | + compId: string; | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * 广告位位置 从1开始 | ||
| 74 | + */ | ||
| 75 | + position: number; | ||
| 76 | + | ||
| 77 | + /** | ||
| 78 | + * 频道id | ||
| 79 | + */ | ||
| 80 | + channelId: string; | ||
| 81 | + | ||
| 82 | +} |
| @@ -15,4 +15,5 @@ export interface ExtraDTO extends ItemDTO { | @@ -15,4 +15,5 @@ export interface ExtraDTO extends ItemDTO { | ||
| 15 | relType: string; | 15 | relType: string; |
| 16 | liveStreamType?: number; | 16 | liveStreamType?: number; |
| 17 | photoList: PhotoListBean[]; | 17 | photoList: PhotoListBean[]; |
| 18 | + commentId?: string; | ||
| 18 | } | 19 | } |
| @@ -78,4 +78,6 @@ export interface ContentDTO { | @@ -78,4 +78,6 @@ export interface ContentDTO { | ||
| 78 | titleShow?: number; | 78 | titleShow?: number; |
| 79 | isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据 | 79 | isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据 |
| 80 | commentInfo?: commentInfo | 80 | commentInfo?: commentInfo |
| 81 | + //底部导航栏 id(用于频道跳转) | ||
| 82 | + bottomNavId:string; | ||
| 81 | } | 83 | } |
| @@ -19,7 +19,10 @@ export interface Params { | @@ -19,7 +19,10 @@ export interface Params { | ||
| 19 | // 13.音频详情页 | 19 | // 13.音频详情页 |
| 20 | // 17.多图(图集)详情页 | 20 | // 17.多图(图集)详情页 |
| 21 | // 18.大图列表页 | 21 | // 18.大图列表页 |
| 22 | + // 19.单个视频播放页 | ||
| 22 | detailPageType?: number; // 详情页类型 | 23 | detailPageType?: number; // 详情页类型 |
| 23 | liveStyle?: number; // 直播类型:0横屏,1竖屏 | 24 | liveStyle?: number; // 直播类型:0横屏,1竖屏 |
| 24 | creatorId?: string; //号主id | 25 | creatorId?: string; //号主id |
| 26 | + videoUrl?: string; | ||
| 27 | + videoCoverUrl?: string; | ||
| 25 | } | 28 | } |
| @@ -3,5 +3,9 @@ export interface commentInfo { | @@ -3,5 +3,9 @@ export interface commentInfo { | ||
| 3 | newsTitle: string, | 3 | newsTitle: string, |
| 4 | userName: string, | 4 | userName: string, |
| 5 | userHeaderUrl: string, | 5 | userHeaderUrl: string, |
| 6 | - publishTime: number | 6 | + publishTime: number, |
| 7 | + commentId: string, | ||
| 8 | + newsId: string, | ||
| 9 | + relId: string; | ||
| 10 | + relType: string; | ||
| 7 | } | 11 | } |
| @@ -177,14 +177,4 @@ export interface postInteractAccentionOperateParams { | @@ -177,14 +177,4 @@ export interface postInteractAccentionOperateParams { | ||
| 177 | // userType: number; | 177 | // userType: number; |
| 178 | // userId: string; | 178 | // userId: string; |
| 179 | status: number; | 179 | status: number; |
| 180 | -} | ||
| 181 | - | ||
| 182 | -export interface postRecommendListParams { | ||
| 183 | - imei: string; | ||
| 184 | - userId ?: string; | ||
| 185 | - contentId ?: string; | ||
| 186 | - relId ?: string; | ||
| 187 | - contentType ?: number; | ||
| 188 | - recType: number; | ||
| 189 | - channelId ? : string | ||
| 190 | } | 180 | } |
| @@ -3,11 +3,14 @@ export interface RmhInfoDTO { | @@ -3,11 +3,14 @@ export interface RmhInfoDTO { | ||
| 3 | authTitle: string; | 3 | authTitle: string; |
| 4 | authTitle2: string; | 4 | authTitle2: string; |
| 5 | banControl: number; | 5 | banControl: number; |
| 6 | - cnIsAttention: number; | 6 | + cnIsAttention?: number; |
| 7 | + cnAttention?: number; | ||
| 8 | + cnlsComment?: number; | ||
| 9 | + cnlsLike?: number; | ||
| 7 | cnMainControl: number; | 10 | cnMainControl: number; |
| 8 | cnShareControl: number; | 11 | cnShareControl: number; |
| 9 | - cnIsComment: number; | ||
| 10 | - cnIsLike: number; | 12 | + cnIsComment?: number; |
| 13 | + cnIsLike?: number; | ||
| 11 | posterShareControl: number; | 14 | posterShareControl: number; |
| 12 | rmhDesc: string; | 15 | rmhDesc: string; |
| 13 | rmhHeadUrl: string; | 16 | rmhHeadUrl: string; |
| @@ -16,4 +16,11 @@ export interface LiveRoomItemBean { | @@ -16,4 +16,11 @@ export interface LiveRoomItemBean { | ||
| 16 | //是否置顶 1置顶0不置顶 | 16 | //是否置顶 1置顶0不置顶 |
| 17 | isTop: number | 17 | isTop: number |
| 18 | role: string | 18 | role: string |
| 19 | + //ZH_TEXT_AND_IMAGE_MSG :图文,ZH_TEXT_MSG:文本,ZH_VIDEO_MSG:视频,ZH_AUDIO_MSG:音频 | ||
| 20 | + dataType: string | ||
| 21 | + transcodeImageUrl: string | ||
| 22 | + videoUrl: string | ||
| 23 | + pictureResolutions: string[] | ||
| 24 | + //音视频长度 | ||
| 25 | + duration: number | ||
| 19 | } | 26 | } |
| 1 | /** | 1 | /** |
| 2 | * page接口返回的Page数据DTO | 2 | * page接口返回的Page数据DTO |
| 3 | */ | 3 | */ |
| 4 | +import { AdvRuleBean, CompAdvBean } from '../adv/AdvsRuleBean'; | ||
| 5 | + | ||
| 4 | export interface PageInfoDTO { | 6 | export interface PageInfoDTO { |
| 5 | pageId: string; // 页面id | 7 | pageId: string; // 页面id |
| 6 | id: number; // 楼层id | 8 | id: number; // 楼层id |
| 7 | name: string; // 名称 | 9 | name: string; // 名称 |
| 8 | - hasAdInfo: number; | ||
| 9 | hasPopUp: number; | 10 | hasPopUp: number; |
| 10 | baselineShow: number; | 11 | baselineShow: number; |
| 11 | groups: GroupInfoDTO[]; | 12 | groups: GroupInfoDTO[]; |
| 12 | channelInfo: ChannelInfoDTO; | 13 | channelInfo: ChannelInfoDTO; |
| 14 | + | ||
| 15 | + /** | ||
| 16 | + * 1-有过广告配置,0-没有广告配置 | ||
| 17 | + */ | ||
| 18 | + hasAdInfo: number; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 挂角广告数据 | ||
| 22 | + */ | ||
| 23 | + cornersAdv:AdvRuleBean | ||
| 24 | + /** | ||
| 25 | + * 广告中心-挂角广告信息 | ||
| 26 | + */ | ||
| 27 | + cornersAdv2:CompAdvBean[] | ||
| 28 | + | ||
| 13 | } | 29 | } |
| 14 | 30 | ||
| 15 | export interface ChannelInfoDTO { | 31 | export interface ChannelInfoDTO { |
| 1 | +export interface UserDetail{ | ||
| 2 | + createTime:string | ||
| 3 | + headPhotoStatus:number | ||
| 4 | + id:number | ||
| 5 | + modifyNumber:number | ||
| 6 | + phone:string | ||
| 7 | + status:number | ||
| 8 | + tenancy:number | ||
| 9 | + userNameStatus:number | ||
| 10 | + userType:number | ||
| 11 | + userName:string | ||
| 12 | + userExtend:UserExtend | ||
| 13 | +} | ||
| 14 | + | ||
| 15 | + export interface UserExtend{ | ||
| 16 | + airec:number | ||
| 17 | + deviceId:string | ||
| 18 | + lastLoginTime:string | ||
| 19 | + sex:number | ||
| 20 | + address:string | ||
| 21 | + birthday:string | ||
| 22 | + city:string | ||
| 23 | + county:string | ||
| 24 | + headPhotoUrl:string | ||
| 25 | + introduction:string | ||
| 26 | + province:string | ||
| 27 | + sign:string | ||
| 28 | + creatorId:string | ||
| 29 | +} | ||
| 30 | + |
| @@ -51,6 +51,8 @@ export { MultiPictureDetailPageComponent } from "./src/main/ets/components/Multi | @@ -51,6 +51,8 @@ export { MultiPictureDetailPageComponent } from "./src/main/ets/components/Multi | ||
| 51 | 51 | ||
| 52 | export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailComponent" | 52 | export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailComponent" |
| 53 | 53 | ||
| 54 | +export { DynamicDetailComponent } from "./src/main/ets/components/DynamicDetailComponent" | ||
| 55 | + | ||
| 54 | export { AudioSuspensionModel } from "./src/main/ets/viewmodel/AudioSuspensionModel" | 56 | export { AudioSuspensionModel } from "./src/main/ets/viewmodel/AudioSuspensionModel" |
| 55 | 57 | ||
| 56 | export { BroadcastPageComponent } from "./src/main/ets/components/broadcast/BroadcastPageComponent" | 58 | export { BroadcastPageComponent } from "./src/main/ets/components/broadcast/BroadcastPageComponent" |
| @@ -20,7 +20,8 @@ import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01'; | @@ -20,7 +20,8 @@ import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01'; | ||
| 20 | import { CardParser } from './CardParser'; | 20 | import { CardParser } from './CardParser'; |
| 21 | import { LiveHorizontalReservationComponent } from './view/LiveHorizontalReservationComponent'; | 21 | import { LiveHorizontalReservationComponent } from './view/LiveHorizontalReservationComponent'; |
| 22 | import { ZhGridLayout02 } from './compview/ZhGridLayout02'; | 22 | import { ZhGridLayout02 } from './compview/ZhGridLayout02'; |
| 23 | -import { Card5Component } from './cardview/Card5Component' | 23 | +import { Card5Component } from './cardview/Card5Component'; |
| 24 | +import { Card2Component } from './cardview/Card2Component'; | ||
| 24 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 25 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 25 | 26 | ||
| 26 | /** | 27 | /** |
| @@ -71,6 +72,9 @@ export struct CompParser { | @@ -71,6 +72,9 @@ export struct CompParser { | ||
| 71 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) { | 72 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) { |
| 72 | //头图卡 和comStyle 2相同, | 73 | //头图卡 和comStyle 2相同, |
| 73 | Card5Component({ contentDTO: compDTO.operDataList[0] }) | 74 | Card5Component({ contentDTO: compDTO.operDataList[0] }) |
| 75 | + } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) { | ||
| 76 | + // 大图卡 | ||
| 77 | + Card2Component({ contentDTO: compDTO.operDataList[0] }) | ||
| 74 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) { | 78 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) { |
| 75 | ZhSingleColumn04({ compDTO: compDTO }) | 79 | ZhSingleColumn04({ compDTO: compDTO }) |
| 76 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) { | 80 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) { |
| 1 | -import { AccountManagerUtils, Logger } from 'wdKit'; | 1 | +import { AccountManagerUtils, Logger, DateTimeUtils } from 'wdKit'; |
| 2 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 2 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 3 | import { ContentDetailDTO,batchLikeAndCollectResult,batchLikeAndCollectParams,postBatchAttentionStatusParams, | 3 | import { ContentDetailDTO,batchLikeAndCollectResult,batchLikeAndCollectParams,postBatchAttentionStatusParams, |
| 4 | PhotoListBean, | 4 | PhotoListBean, |
| 5 | - ContentDTO, } from 'wdBean'; | 5 | + ContentDTO, |
| 6 | + RmhInfoDTO, } from 'wdBean'; | ||
| 6 | import media from '@ohos.multimedia.media'; | 7 | import media from '@ohos.multimedia.media'; |
| 7 | import { OperRowListView } from './view/OperRowListView'; | 8 | import { OperRowListView } from './view/OperRowListView'; |
| 8 | import { WDPlayerController } from 'wdPlayer/Index'; | 9 | import { WDPlayerController } from 'wdPlayer/Index'; |
| 9 | import { ContentConstants } from '../constants/ContentConstants'; | 10 | import { ContentConstants } from '../constants/ContentConstants'; |
| 10 | -import { ProcessUtils } from '../utils/ProcessUtils'; | ||
| 11 | - | 11 | +import { ProcessUtils } from 'wdRouter'; |
| 12 | +import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; | ||
| 13 | +import display from '@ohos.display'; | ||
| 14 | +import { BusinessError } from '@ohos.base'; | ||
| 15 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 16 | +import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo' | ||
| 17 | +import router from '@ohos.router'; | ||
| 12 | const TAG = 'DynamicDetailComponent' | 18 | const TAG = 'DynamicDetailComponent' |
| 13 | @Preview | 19 | @Preview |
| 14 | @Component | 20 | @Component |
| @@ -17,9 +23,17 @@ export struct DynamicDetailComponent { | @@ -17,9 +23,17 @@ export struct DynamicDetailComponent { | ||
| 17 | private relId: string = '' | 23 | private relId: string = '' |
| 18 | private contentId: string = '' | 24 | private contentId: string = '' |
| 19 | private relType: string = '' | 25 | private relType: string = '' |
| 20 | - //出参 | ||
| 21 | - @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 26 | + //出参 fixme 模拟数据用json转换 |
| 27 | + @State contentDetailData: ContentDetailDTO = { | ||
| 28 | + publishTime: "2023年03月14日 08:16", | ||
| 29 | + rmhInfo:{rmhHeadUrl:"",rmhName:"人民号名称",rmhDesc:"人民号描述单行展示"}, | ||
| 30 | + newsContent:"优先展示这个内容", | ||
| 31 | + newsSummary:"其次展示这个内容", | ||
| 32 | + newsTitle:"上面两个都没有再展示这个内容", | ||
| 33 | + newsType:15 | ||
| 34 | + } as ContentDetailDTO | ||
| 22 | //变量 | 35 | //变量 |
| 36 | + scroller: Scroller = new Scroller(); | ||
| 23 | /** | 37 | /** |
| 24 | * 默认未关注 点击去关注 | 38 | * 默认未关注 点击去关注 |
| 25 | */ | 39 | */ |
| @@ -27,7 +41,13 @@ export struct DynamicDetailComponent { | @@ -27,7 +41,13 @@ export struct DynamicDetailComponent { | ||
| 27 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | 41 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 |
| 28 | 42 | ||
| 29 | //跳转 | 43 | //跳转 |
| 30 | - private mJumpInfo: ContentDTO = {} as ContentDTO; | 44 | + private mJumpInfo: ContentDTO = {} as ContentDTO; |
| 45 | + | ||
| 46 | + // 获取当前所有的display对象 | ||
| 47 | + promise: Promise<Array<display.Display>> = display.getAllDisplays() | ||
| 48 | + | ||
| 49 | + // 屏幕宽度(单位px) | ||
| 50 | + @State screenWidth: number = 0; | ||
| 31 | 51 | ||
| 32 | async aboutToAppear() { | 52 | async aboutToAppear() { |
| 33 | await this.getContentDetailData() | 53 | await this.getContentDetailData() |
| @@ -37,7 +57,6 @@ export struct DynamicDetailComponent { | @@ -37,7 +57,6 @@ export struct DynamicDetailComponent { | ||
| 37 | } | 57 | } |
| 38 | 58 | ||
| 39 | build() { | 59 | build() { |
| 40 | - Row() { | ||
| 41 | Column(){ | 60 | Column(){ |
| 42 | //logo、日期 | 61 | //logo、日期 |
| 43 | Row() { | 62 | Row() { |
| @@ -46,7 +65,7 @@ export struct DynamicDetailComponent { | @@ -46,7 +65,7 @@ export struct DynamicDetailComponent { | ||
| 46 | .height($r('app.float.margin_28')) | 65 | .height($r('app.float.margin_28')) |
| 47 | .margin({ left: $r('app.float.margin_16') }) | 66 | .margin({ left: $r('app.float.margin_16') }) |
| 48 | Blank() | 67 | Blank() |
| 49 | - Text("2023年03月14日 08:16") | 68 | + Text(StringUtils.isEmpty(this.contentDetailData.publishTime)?"":this.contentDetailData.publishTime.replace('-','年').replace('-','月').replace(' ','日 ').substring(0,this.contentDetailData.publishTime.length-2)) |
| 50 | .fontColor($r('app.color.color_B0B0B0')) | 69 | .fontColor($r('app.color.color_B0B0B0')) |
| 51 | .fontSize($r('app.float.font_size_12')) | 70 | .fontSize($r('app.float.font_size_12')) |
| 52 | .lineHeight($r('app.float.margin_28')) | 71 | .lineHeight($r('app.float.margin_28')) |
| @@ -59,143 +78,307 @@ export struct DynamicDetailComponent { | @@ -59,143 +78,307 @@ export struct DynamicDetailComponent { | ||
| 59 | .width('100%') | 78 | .width('100%') |
| 60 | .height($r('app.float.margin_7')) | 79 | .height($r('app.float.margin_7')) |
| 61 | .margin({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} ) | 80 | .margin({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} ) |
| 62 | - //号主信息 | ||
| 63 | - Row() { | ||
| 64 | - //头像 | ||
| 65 | - Stack() { | ||
| 66 | - Image(this.contentDetailData.rmhInfo?.rmhHeadUrl) | ||
| 67 | - .alt(this.contentDetailData.rmhInfo?.userType=='1'?$r('app.media.default_head'):$r('app.media.icon_default_head_mater')) | ||
| 68 | - .width($r('app.float.margin_32')) | ||
| 69 | - .height($r('app.float.margin_32')) | ||
| 70 | - .objectFit(ImageFit.Cover) | ||
| 71 | - .borderRadius($r('app.float.margin_16')) | ||
| 72 | - Image($r('app.media.icon_border_test')) | ||
| 73 | - .width($r('app.float.margin_48')) | ||
| 74 | - .height($r('app.float.margin_48')) | ||
| 75 | - .objectFit(ImageFit.Cover) | ||
| 76 | - .borderRadius($r('app.float.margin_24')) | ||
| 77 | - } | ||
| 78 | - .width($r('app.float.margin_48')) | ||
| 79 | - .height($r('app.float.margin_48')) | ||
| 80 | - .alignContent(Alignment.Center) | ||
| 81 | - Column(){ | ||
| 82 | - //昵称 | ||
| 83 | - Text("this.contentDetailData.rmhInfo?.rmhName") | ||
| 84 | - .fontSize($r('app.float.font_size_14')) | ||
| 85 | - .fontColor($r('app.color.color_222222')) | ||
| 86 | - .fontWeight(FontWeight.Medium) | ||
| 87 | - .margin({ left: $r('app.float.margin_5') }) | ||
| 88 | - //简介 | ||
| 89 | - Text("this.contentDetailData.rmhInfo?.rmhDesc") | ||
| 90 | - .fontSize($r('app.float.font_size_14')) | ||
| 91 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 92 | - .fontWeight(FontWeight.Medium) | ||
| 93 | - .margin({ left: $r('app.float.margin_5') }) | ||
| 94 | - } | ||
| 95 | - if (this.followStatus == '0') { | ||
| 96 | - Text('关注') | ||
| 97 | - .width(60) | ||
| 98 | - .height($r('app.float.margin_48')) | ||
| 99 | - .textAlign(TextAlign.Center) | ||
| 100 | - .fontSize($r('app.float.font_size_12')) | ||
| 101 | - .borderRadius($r('app.float.vp_3')) | ||
| 102 | - .backgroundColor($r('app.color.color_ED2800')) | ||
| 103 | - .fontColor($r('app.color.color_fff')) | ||
| 104 | - .onClick(() => { | ||
| 105 | - // this.handleAccention(this.item, 1) | ||
| 106 | - }) | ||
| 107 | - } else { | ||
| 108 | - Text('已关注') | ||
| 109 | - .width($r('app.float.margin_60')) | ||
| 110 | - .height($r('app.float.margin_48')) | ||
| 111 | - .borderWidth(1) | ||
| 112 | - .textAlign(TextAlign.Center) | ||
| 113 | - .fontSize($r('app.float.font_size_12')) | ||
| 114 | - .borderRadius($r('app.float.vp_3')) | ||
| 115 | - .borderColor($r('app.color.color_CCCCCC')) | ||
| 116 | - .fontColor($r('app.color.color_CCCCCC')) | ||
| 117 | - .onClick(() => { | ||
| 118 | - // this.handleAccention(this.item, 0) | ||
| 119 | - }) | ||
| 120 | - } | ||
| 121 | - } | ||
| 122 | - .width('100%') | ||
| 123 | - //内容 | ||
| 124 | - Text("这里展示标题这里展示标题这里展示标题这里这里展示标题这里展示标题这里展示标题这里这里展示标题这里展示标题这里展示标题这里") | ||
| 125 | - .fontColor($r('app.color.color_222222')) | ||
| 126 | - .fontSize($r('app.float.font_size_18')) | ||
| 127 | - .lineHeight($r('app.float.margin_25')) | ||
| 128 | - .margin({ top: $r('app.float.margin_6') | ||
| 129 | - ,left: $r('app.float.margin_16') | ||
| 130 | - ,right: $r('app.float.margin_16') }) | ||
| 131 | - if(this.contentDetailData.photoList!= null && this.contentDetailData.photoList.length>0){ | ||
| 132 | - //附件内容:图片/视频 | ||
| 133 | - if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){ | ||
| 134 | - GridRow({ | ||
| 135 | - columns: { sm: this.contentDetailData.photoList.length | ||
| 136 | - , md: this.contentDetailData.photoList.length == 1?1: | ||
| 137 | - this.contentDetailData.photoList.length == 4?2: | ||
| 138 | - 3 }, | ||
| 139 | - breakpoints: { value: ['320vp', '520vp', '840vp'] } | ||
| 140 | - }) { | ||
| 141 | - ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => { | ||
| 142 | - GridCol() { | ||
| 143 | - this.buildItemCard(this.contentDetailData.photoList[index],this.contentDetailData.photoList.length, index); | 81 | + Stack({ alignContent: Alignment.Bottom }) { |
| 82 | + Scroll(this.scroller) { | ||
| 83 | + Column() { | ||
| 84 | + //号主信息 | ||
| 85 | + Row() { | ||
| 86 | + //头像 | ||
| 87 | + Stack() { | ||
| 88 | + Image(this.contentDetailData.rmhInfo?.rmhHeadUrl) | ||
| 89 | + .alt(this.contentDetailData.rmhInfo?.userType=='1'?$r('app.media.default_head'):$r('app.media.icon_default_head_mater')) | ||
| 90 | + .width($r('app.float.margin_32')) | ||
| 91 | + .height($r('app.float.margin_32')) | ||
| 92 | + .objectFit(ImageFit.Cover) | ||
| 93 | + .borderRadius($r('app.float.margin_16')) | ||
| 94 | + Image($r('app.media.icon_border_test')) | ||
| 95 | + .width($r('app.float.margin_48')) | ||
| 96 | + .height($r('app.float.margin_48')) | ||
| 97 | + .objectFit(ImageFit.Cover) | ||
| 98 | + .borderRadius($r('app.float.margin_24')) | ||
| 99 | + } | ||
| 100 | + .width($r('app.float.margin_48')) | ||
| 101 | + .height($r('app.float.margin_48')) | ||
| 102 | + .alignContent(Alignment.Center) | ||
| 103 | + Column(){ | ||
| 104 | + //昵称 | ||
| 105 | + Text(this.contentDetailData.rmhInfo?.rmhName) | ||
| 106 | + .fontSize($r('app.float.font_size_14')) | ||
| 107 | + .fontColor($r('app.color.color_222222')) | ||
| 108 | + .fontWeight(FontWeight.Medium) | ||
| 109 | + .margin({ left: $r('app.float.margin_5') }) | ||
| 110 | + .alignSelf(ItemAlign.Start) | ||
| 111 | + //简介 | ||
| 112 | + Text(this.contentDetailData.rmhInfo?.rmhDesc) | ||
| 113 | + .fontSize($r('app.float.font_size_14')) | ||
| 114 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 115 | + .fontWeight(FontWeight.Medium) | ||
| 116 | + .maxLines(1) | ||
| 117 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 118 | + .margin({ left: $r('app.float.margin_5') }) | ||
| 119 | + .alignSelf(ItemAlign.Start) | ||
| 120 | + } | ||
| 121 | + .width('63%') | ||
| 122 | + .margin({right: $r('app.float.margin_6')}) | ||
| 123 | + if (this.followStatus == '0') { | ||
| 124 | + Text('关注') | ||
| 125 | + .width($r('app.float.margin_54')) | ||
| 126 | + .height($r('app.float.margin_24')) | ||
| 127 | + .textAlign(TextAlign.Center) | ||
| 128 | + .fontSize($r('app.float.font_size_12')) | ||
| 129 | + .borderRadius($r('app.float.vp_3')) | ||
| 130 | + .backgroundColor($r('app.color.color_ED2800')) | ||
| 131 | + .fontColor($r('app.color.color_fff')) | ||
| 132 | + .onClick(() => { | ||
| 133 | + // this.handleAccention(this.item, 1) | ||
| 134 | + }) | ||
| 135 | + } else { | ||
| 136 | + Text('已关注') | ||
| 137 | + .width($r('app.float.margin_54')) | ||
| 138 | + .height($r('app.float.margin_24')) | ||
| 139 | + .borderWidth(1) | ||
| 140 | + .textAlign(TextAlign.Center) | ||
| 141 | + .fontSize($r('app.float.font_size_12')) | ||
| 142 | + .borderRadius($r('app.float.vp_3')) | ||
| 143 | + .borderColor($r('app.color.color_CCCCCC')) | ||
| 144 | + .fontColor($r('app.color.color_CCCCCC')) | ||
| 145 | + .onClick(() => { | ||
| 146 | + // this.handleAccention(this.item, 0) | ||
| 147 | + }) | ||
| 148 | + } | ||
| 149 | + } | ||
| 150 | + .width('100%') | ||
| 151 | + .margin({ left: $r('app.float.margin_16')}) | ||
| 152 | + //内容 | ||
| 153 | + Text(StringUtils.isEmpty(this.contentDetailData.newsContent) | ||
| 154 | + ?StringUtils.isEmpty(this.contentDetailData.newsSummary) | ||
| 155 | + ?this.contentDetailData.newsTitle | ||
| 156 | + :this.contentDetailData.newsSummary | ||
| 157 | + :this.contentDetailData.newsContent) | ||
| 158 | + .fontColor($r('app.color.color_222222')) | ||
| 159 | + .fontSize($r('app.float.font_size_18')) | ||
| 160 | + .lineHeight($r('app.float.margin_25')) | ||
| 161 | + .margin({ top: $r('app.float.margin_6') | ||
| 162 | + ,left: $r('app.float.margin_16') | ||
| 163 | + ,right: $r('app.float.margin_16') }) | ||
| 164 | + .alignSelf(ItemAlign.Start) | ||
| 165 | + if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){ | ||
| 166 | + //附件内容:图片/视频 | ||
| 167 | + if(this.contentDetailData.photoList!= null && this.contentDetailData.photoList.length>0){ | ||
| 168 | + // 图片-从无图到9图展示 | ||
| 169 | + GridRow({ | ||
| 170 | + gutter: { x: 2, y: 2 } | ||
| 171 | + }) { | ||
| 172 | + ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => { | ||
| 173 | + if (this.contentDetailData.photoList.length === 1) { | ||
| 174 | + if (this.getPicType(item) !== 3) { | ||
| 175 | + GridCol({ | ||
| 176 | + span: this.getPicType(item) === 1 ? 12 : 8 | ||
| 177 | + }){ | ||
| 178 | + Stack({ | ||
| 179 | + alignContent: Alignment.BottomEnd | ||
| 180 | + }) { | ||
| 181 | + if (this.getPicType(item) === 1) { | ||
| 182 | + Image(item.picPath) | ||
| 183 | + .width('100%') | ||
| 184 | + .height(172) | ||
| 185 | + .autoResize(true) | ||
| 186 | + .borderRadius(this.caclImageRadius(index)) | ||
| 187 | + } else if (this.getPicType(item) === 2) { | ||
| 188 | + Image(item.picPath) | ||
| 189 | + .width('100%') | ||
| 190 | + .height(305) | ||
| 191 | + .autoResize(true) | ||
| 192 | + .borderRadius(this.caclImageRadius(index)) | ||
| 193 | + } | ||
| 194 | + Flex({ direction: FlexDirection.Row }) { | ||
| 195 | + Image($r('app.media.icon_long_pic')) | ||
| 196 | + .width(14) | ||
| 197 | + .height(14) | ||
| 198 | + .margin({right: 4}) | ||
| 199 | + Text('长图') | ||
| 200 | + .fontSize(12) | ||
| 201 | + .fontWeight(400) | ||
| 202 | + .fontColor(0xffffff) | ||
| 203 | + .fontFamily('PingFang SC') | ||
| 204 | + } | ||
| 205 | + .width(48) | ||
| 206 | + .padding({bottom: 9}) | ||
| 207 | + | ||
| 208 | + } | ||
| 209 | + } | ||
| 210 | + .onClick((event: ClickEvent) => { | ||
| 211 | + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList) | ||
| 212 | + }) | ||
| 213 | + } else { | ||
| 214 | + GridCol({ | ||
| 215 | + span: { xs: 8 } | ||
| 216 | + }) { | ||
| 217 | + Image(item.picPath) | ||
| 218 | + .width('100%') | ||
| 219 | + .borderRadius(this.caclImageRadius(index)) | ||
| 220 | + .autoResize(true) | ||
| 221 | + .opacity(!item.width && !item.height ? 0 : 1) | ||
| 222 | + .onComplete(callback => { | ||
| 223 | + item.width = callback?.width || 0; | ||
| 224 | + item.height = callback?.height || 0; | ||
| 225 | + }) | ||
| 226 | + } | ||
| 227 | + } | ||
| 228 | + } else if (this.contentDetailData.photoList.length === 4) { | ||
| 229 | + GridCol({ | ||
| 230 | + span: { xs: 4 } | ||
| 231 | + }) { | ||
| 232 | + Image(item.picPath) | ||
| 233 | + .aspectRatio(1) | ||
| 234 | + .borderRadius(this.caclImageRadius(index)) | ||
| 235 | + } | ||
| 236 | + } else { | ||
| 237 | + GridCol({ | ||
| 238 | + span: { sm: 4, lg: 3 } | ||
| 239 | + }) { | ||
| 240 | + Image(item.picPath) | ||
| 241 | + .aspectRatio(1) | ||
| 242 | + .borderRadius(this.caclImageRadius(index)) | ||
| 243 | + } | ||
| 244 | + } | ||
| 245 | + }) | ||
| 246 | + } | ||
| 247 | + .margin({ left: $r('app.float.margin_16'),right: $r('app.float.margin_16'),top: $r('app.float.margin_8')}) | ||
| 144 | } | 248 | } |
| 249 | + }else{ | ||
| 250 | + if(this.contentDetailData.videoInfo!= null && this.contentDetailData.videoInfo.length>0){ | ||
| 251 | + GridRow() { | ||
| 252 | + if (this.contentDetailData.videoInfo[0].videoLandScape === 1) { | ||
| 253 | + // 横屏 | ||
| 254 | + GridCol({ | ||
| 255 | + span: { xs: 12 } | ||
| 256 | + }) { | ||
| 257 | + Stack() { | ||
| 258 | + Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)? | ||
| 259 | + this.contentDetailData.fullColumnImgUrls[0].url: | ||
| 260 | + this.contentDetailData.videoInfo[0].firstFrameImageUri) | ||
| 261 | + .width(CommonConstants.FULL_WIDTH) | ||
| 262 | + .aspectRatio(16 / 9) | ||
| 263 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 264 | + CardMediaInfo({ contentDTO: this.mJumpInfo }) | ||
| 265 | + } | ||
| 266 | + .align(Alignment.BottomEnd) | ||
| 267 | + } | ||
| 268 | + } else { | ||
| 269 | + // 竖图显示,宽度占50%,高度自适应 | ||
| 270 | + GridCol({ | ||
| 271 | + span: { xs: 6 } | ||
| 272 | + }) { | ||
| 273 | + Stack() { | ||
| 274 | + Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)? | ||
| 275 | + this.contentDetailData.fullColumnImgUrls[0].url: | ||
| 276 | + this.contentDetailData.videoInfo[0].firstFrameImageUri) | ||
| 277 | + .width(CommonConstants.FULL_WIDTH) | ||
| 278 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 279 | + CardMediaInfo({ contentDTO: this.mJumpInfo }) | ||
| 280 | + } | ||
| 281 | + .align(Alignment.BottomEnd) | ||
| 282 | + } | ||
| 283 | + } | ||
| 284 | + } | ||
| 285 | + .margin({ left: $r('app.float.margin_16'),right: $r('app.float.margin_16'),top: $r('app.float.margin_8')}) | ||
| 286 | + .onClick((event: ClickEvent) => { | ||
| 287 | + ProcessUtils.processPage(this.mJumpInfo) | ||
| 288 | + }) | ||
| 289 | + } | ||
| 290 | + } | ||
| 291 | + //特别声明 | ||
| 292 | + Text("特别声明:本文为人民日报新媒体平台“人民号”作者上传并发布,仅代表作者观点。人民日报仅提供信息发布平台。") | ||
| 293 | + .fontColor($r('app.color.color_CCCCCC')) | ||
| 294 | + .fontSize($r('app.float.font_size_12')) | ||
| 295 | + .lineHeight($r('app.float.margin_16')) | ||
| 296 | + .margin({ top: $r('app.float.margin_16') | ||
| 297 | + ,left: $r('app.float.margin_16') | ||
| 298 | + ,right: $r('app.float.margin_16') }) | ||
| 299 | + //微信/朋友圈/微博 | ||
| 300 | + Row(){ | ||
| 301 | + Image($r('app.media.xxhdpi_pic_wechat')) | ||
| 302 | + .width($r('app.float.margin_116')) | ||
| 303 | + .height($r('app.float.margin_36')) | ||
| 304 | + .objectFit(ImageFit.Cover) | ||
| 305 | + Image($r('app.media.xxhdpi_pic_pyq')) | ||
| 306 | + .width($r('app.float.margin_116')) | ||
| 307 | + .height($r('app.float.margin_36')) | ||
| 308 | + .margin({ left: $r('app.float.margin_4_negative')}) | ||
| 309 | + .objectFit(ImageFit.Cover) | ||
| 310 | + Image($r('app.media.xxhdpi_pic_wb')) | ||
| 311 | + .width($r('app.float.margin_116')) | ||
| 312 | + .height($r('app.float.margin_36')) | ||
| 313 | + .margin({ left: $r('app.float.margin_4_negative')}) | ||
| 314 | + .objectFit(ImageFit.Cover) | ||
| 315 | + } | ||
| 316 | + .margin({ top: $r('app.float.margin_24')}) | ||
| 317 | + //点赞 | ||
| 318 | + Row(){ | ||
| 319 | + Image($r('app.media.icon_like_selected_redheart')) | ||
| 320 | + .width($r('app.float.margin_24')) | ||
| 321 | + .height($r('app.float.margin_24')) | ||
| 322 | + .objectFit(ImageFit.Cover) | ||
| 323 | + Text("2.6万") | ||
| 324 | + .fontColor($r('app.color.color_999999')) | ||
| 325 | + .fontSize($r('app.float.font_size_16')) | ||
| 326 | + .lineHeight($r('app.float.margin_20')) | ||
| 327 | + .margin({ left: $r('app.float.margin_2')}) | ||
| 328 | + } | ||
| 329 | + .margin({top:$r('app.float.margin_16')}) | ||
| 330 | + Blank().layoutWeight(1) | ||
| 331 | + //fixme 评论组件 | ||
| 332 | + } | ||
| 333 | + } | ||
| 334 | + .width(CommonConstants.FULL_WIDTH) | ||
| 335 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 336 | + .padding({ bottom: 76 }) | ||
| 337 | + .scrollBar(BarState.Off) | ||
| 338 | + .alignSelf(ItemAlign.Start) | ||
| 339 | + //底部交互区 | ||
| 340 | + Row() { | ||
| 341 | + Image($r('app.media.icon_arrow_left')) | ||
| 342 | + .width(24) | ||
| 343 | + .height(24) | ||
| 344 | + .onClick((event: ClickEvent) => { | ||
| 345 | + router.back() | ||
| 145 | }) | 346 | }) |
| 347 | + | ||
| 348 | + Row() { | ||
| 349 | + Image($r('app.media.icon_comment')) | ||
| 350 | + .width(24) | ||
| 351 | + .height(24) | ||
| 352 | + .margin({ right: 24 }) | ||
| 353 | + .id('comment') | ||
| 354 | + | ||
| 355 | + Image($r('app.media.icon_star')) | ||
| 356 | + .width(24) | ||
| 357 | + .height(24) | ||
| 358 | + .margin({ right: 24 }) | ||
| 359 | + | ||
| 360 | + Image($r('app.media.icon_listen')) | ||
| 361 | + .width(24) | ||
| 362 | + .height(24) | ||
| 363 | + .margin({ right: 24 }) | ||
| 364 | + | ||
| 365 | + Image($r('app.media.icon_forward')) | ||
| 366 | + .width(24) | ||
| 367 | + .height(24) | ||
| 368 | + | ||
| 146 | } | 369 | } |
| 147 | - }else{ | ||
| 148 | - //附件内容:视频,只有一个 | ||
| 149 | - ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => { | ||
| 150 | - GridCol() { | ||
| 151 | - this.buildItemCard(this.contentDetailData.photoList[index],this.contentDetailData.photoList.length, index); | ||
| 152 | - } | ||
| 153 | - }) | ||
| 154 | } | 370 | } |
| 371 | + .width(CommonConstants.FULL_WIDTH) | ||
| 372 | + .height(56) | ||
| 373 | + .padding({ left: 15, right: 15, bottom: 50, top: 20 }) | ||
| 374 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 375 | + .backgroundColor(Color.White) | ||
| 155 | } | 376 | } |
| 156 | - //特别声明 | ||
| 157 | - Text("特别声明:本文为人民日报新媒体平台“人民号”作者上传并发布,仅代表作者观点。人民日报仅提供信息发布平台。") | ||
| 158 | - .fontColor($r('app.color.color_CCCCCC')) | ||
| 159 | - .fontSize($r('app.float.font_size_12')) | ||
| 160 | - .lineHeight($r('app.float.margin_16')) | ||
| 161 | - .margin({ top: $r('app.float.margin_16') | ||
| 162 | - ,left: $r('app.float.margin_16') | ||
| 163 | - ,right: $r('app.float.margin_16') }) | ||
| 164 | - //微信/朋友圈/微博 | ||
| 165 | - Row(){ | ||
| 166 | - Image($r('app.media.xxhdpi_pic_wechat')) | ||
| 167 | - .width($r('app.float.margin_116')) | ||
| 168 | - .height($r('app.float.margin_36')) | ||
| 169 | - .objectFit(ImageFit.Cover) | ||
| 170 | - Image($r('app.media.xxhdpi_pic_pyq')) | ||
| 171 | - .width($r('app.float.margin_116')) | ||
| 172 | - .height($r('app.float.margin_36')) | ||
| 173 | - .margin({ left: $r('app.float.margin_4_negative')}) | ||
| 174 | - .objectFit(ImageFit.Cover) | ||
| 175 | - Image($r('app.media.xxhdpi_pic_wb')) | ||
| 176 | - .width($r('app.float.margin_116')) | ||
| 177 | - .height($r('app.float.margin_36')) | ||
| 178 | - .margin({ left: $r('app.float.margin_4_negative')}) | ||
| 179 | - .objectFit(ImageFit.Cover) | ||
| 180 | - } | ||
| 181 | - .margin({ top: $r('app.float.margin_24')}) | ||
| 182 | - //点赞 | ||
| 183 | - Row(){ | ||
| 184 | - Image($r('app.media.icon_like_selected_redheart')) | ||
| 185 | - .width($r('app.float.margin_24')) | ||
| 186 | - .height($r('app.float.margin_24')) | ||
| 187 | - .objectFit(ImageFit.Cover) | ||
| 188 | - Text("2.6万") | ||
| 189 | - .fontColor($r('app.color.color_999999')) | ||
| 190 | - .fontSize($r('app.float.font_size_16')) | ||
| 191 | - .lineHeight($r('app.float.margin_20')) | ||
| 192 | - .margin({ left: $r('app.float.margin_2')}) | ||
| 193 | - } | ||
| 194 | - //评论组件/底部组件 | ||
| 195 | - | ||
| 196 | } | 377 | } |
| 197 | - } | ||
| 198 | - .backgroundColor('#FFFFFFFF') | 378 | + .alignSelf(ItemAlign.Start) |
| 379 | + .backgroundColor('#FFFFFFFF') | ||
| 380 | + .width('100%') | ||
| 381 | + .height('100%') | ||
| 199 | } | 382 | } |
| 200 | /** | 383 | /** |
| 201 | * 请求(动态)详情页数据 | 384 | * 请求(动态)详情页数据 |
| @@ -204,13 +387,13 @@ export struct DynamicDetailComponent { | @@ -204,13 +387,13 @@ export struct DynamicDetailComponent { | ||
| 204 | try { | 387 | try { |
| 205 | let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) | 388 | let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) |
| 206 | this.contentDetailData = data[0]; | 389 | this.contentDetailData = data[0]; |
| 207 | - this.makeJumpInfo | ||
| 208 | console.log('动态详情',JSON.stringify(this.contentDetailData)) | 390 | console.log('动态详情',JSON.stringify(this.contentDetailData)) |
| 209 | } catch (exception) { | 391 | } catch (exception) { |
| 210 | console.log('请求失败',JSON.stringify(exception)) | 392 | console.log('请求失败',JSON.stringify(exception)) |
| 211 | } | 393 | } |
| 212 | - this.getBatchAttentionStatus | ||
| 213 | - this.getInteractDataStatus | 394 | + this.getBatchAttentionStatus() |
| 395 | + this.getInteractDataStatus() | ||
| 396 | + this.makeJumpInfo() | ||
| 214 | } | 397 | } |
| 215 | 398 | ||
| 216 | // 查询当前登录用户点赞状态 | 399 | // 查询当前登录用户点赞状态 |
| @@ -253,192 +436,61 @@ export struct DynamicDetailComponent { | @@ -253,192 +436,61 @@ export struct DynamicDetailComponent { | ||
| 253 | 436 | ||
| 254 | } | 437 | } |
| 255 | } | 438 | } |
| 256 | - @Builder | ||
| 257 | - setItemImageStyle(picPath: string,topLeft: number,topRight: number,bottomLeft: number,bottomRight: number){ | ||
| 258 | - //四角圆角 | ||
| 259 | - Image(picPath) | ||
| 260 | - .width(44).aspectRatio(1 / 1).margin(16).borderRadius({topLeft: topLeft, topRight: topRight, bottomLeft: bottomLeft, bottomRight: bottomRight}) | ||
| 261 | - } | ||
| 262 | - /** | ||
| 263 | - * 组件项 | ||
| 264 | - * | ||
| 265 | - * @param programmeBean item 组件项, 上面icon,下面标题 | ||
| 266 | - */ | ||
| 267 | - @Builder | ||
| 268 | - buildItemCard(item: PhotoListBean,len: number,index: number) { | ||
| 269 | - Column() { | ||
| 270 | - this.setItemImageRoundCorner(len, item, index) | ||
| 271 | - Flex({ direction: FlexDirection.Row }) { | ||
| 272 | - Image($r('app.media.icon_long_pic')) | ||
| 273 | - .width(14) | ||
| 274 | - .height(14) | ||
| 275 | - .margin({right: 4}) | ||
| 276 | - Text('长图') | ||
| 277 | - .fontSize(12) | ||
| 278 | - .fontWeight(400) | ||
| 279 | - .fontColor(0xffffff) | ||
| 280 | - .fontFamily('PingFang SC') | ||
| 281 | - } | ||
| 282 | - .width(48) | ||
| 283 | - .padding({bottom: 9}) | ||
| 284 | - } | ||
| 285 | - .width('100%') | ||
| 286 | - .onClick((event: ClickEvent) => { | ||
| 287 | - if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){ | ||
| 288 | - //fixme 跳转到查看图片页面(带页脚/下载按钮) | ||
| 289 | - // this.mJumpInfo.objectType = ContentConstants.TYPE_ | ||
| 290 | - ProcessUtils.processPage(this.mJumpInfo) | ||
| 291 | - }else{ | ||
| 292 | - //fixme 跳转到播放视频页面(点播) | ||
| 293 | - this.mJumpInfo.objectType = ContentConstants.TYPE_VOD | ||
| 294 | - ProcessUtils.processPage(this.mJumpInfo) | ||
| 295 | - } | ||
| 296 | - }) | ||
| 297 | - } | ||
| 298 | 439 | ||
| 299 | //创建跳转信息 | 440 | //创建跳转信息 |
| 300 | makeJumpInfo(){ | 441 | makeJumpInfo(){ |
| 301 | - this.mJumpInfo.pageId = 'dynamicDetailPage'; | ||
| 302 | - // this.mJumpInfo.from = 'dynamicDetailPage'; | ||
| 303 | - this.mJumpInfo.objectId = this.contentDetailData.newsId+""; | ||
| 304 | - this.mJumpInfo.relType = this.contentDetailData.reLInfo?.relType+""; | ||
| 305 | - this.mJumpInfo.relId = this.contentDetailData.reLInfo?.relId+""; | 442 | + this.mJumpInfo.pageId = 'dynamicDetailPage' |
| 443 | + this.mJumpInfo.objectId = this.contentDetailData.newsId+"" | ||
| 444 | + this.mJumpInfo.relType = this.contentDetailData.reLInfo?.relType+"" | ||
| 445 | + this.mJumpInfo.relId = this.contentDetailData.reLInfo?.relId+"" | ||
| 446 | + this.mJumpInfo.objectType = (this.contentDetailData.newsType+"") == ContentConstants.TYPE_FOURTEEN?this.contentDetailData.newsType+"":ContentConstants.TYPE_VOD | ||
| 447 | + if(this.contentDetailData.videoInfo!= null && this.contentDetailData.videoInfo.length>0){ | ||
| 448 | + this.mJumpInfo.videoInfo = this.contentDetailData.videoInfo[0] | ||
| 449 | + } | ||
| 306 | } | 450 | } |
| 307 | 451 | ||
| 308 | - //设置图片圆角 | ||
| 309 | - @Builder | ||
| 310 | - setItemImageRoundCorner(len: number, item: PhotoListBean, index: number) { | ||
| 311 | - if (len == 1) { | ||
| 312 | - //四角圆角 | ||
| 313 | - this.setItemImageStyle(item.picPath, 4, 4, 4, 4); | ||
| 314 | - } else if (len == 2) { | ||
| 315 | - if (index == 0) { | ||
| 316 | - //左边圆角 | ||
| 317 | - this.setItemImageStyle(item.picPath, 4, 0, 4, 0); | ||
| 318 | - } else { | ||
| 319 | - //右边圆角 | ||
| 320 | - this.setItemImageStyle(item.picPath, 0, 4, 0, 4); | ||
| 321 | - } | ||
| 322 | - } else if (3 == len) { | ||
| 323 | - if (index == 0) { | ||
| 324 | - //左边圆角 | ||
| 325 | - this.setItemImageStyle(item.picPath, 4, 0, 4, 0); | ||
| 326 | - } else if (index == 1) { | ||
| 327 | - //直角 | ||
| 328 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 329 | - } else { | ||
| 330 | - //右边圆角 | ||
| 331 | - this.setItemImageStyle(item.picPath, 0, 4, 0, 4); | ||
| 332 | - } | ||
| 333 | - } else if (4 == len) { | ||
| 334 | - if (index == 0) { | ||
| 335 | - //左边圆角 | ||
| 336 | - this.setItemImageStyle(item.picPath, 4, 0, 4, 0); | ||
| 337 | - } else if (index == 1) { | ||
| 338 | - //右边圆角 | ||
| 339 | - this.setItemImageStyle(item.picPath, 0, 4, 0, 4); | ||
| 340 | - } else if (index = 2) { | ||
| 341 | - //左边圆角 | ||
| 342 | - this.setItemImageStyle(item.picPath, 4, 0, 4, 0); | ||
| 343 | - } else { | ||
| 344 | - //右边圆角 | ||
| 345 | - this.setItemImageStyle(item.picPath, 0, 4, 0, 4); | ||
| 346 | - } | ||
| 347 | - } else if (5 == len) { | ||
| 348 | - if (index == 0) { | ||
| 349 | - this.setItemImageStyle(item.picPath, 4, 0, 0, 0); | ||
| 350 | - } else if (index == 1) { | ||
| 351 | - //直角 | ||
| 352 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 353 | - } else if (index = 2) { | ||
| 354 | - this.setItemImageStyle(item.picPath, 4, 4, 4, 4); | ||
| 355 | - } else if (index = 3) { | ||
| 356 | - this.setItemImageStyle(item.picPath, 0, 0, 4, 0); | ||
| 357 | - } else { | ||
| 358 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 4); | ||
| 359 | - } | ||
| 360 | - } else if (6 == len) { | ||
| 361 | - if (index == 0) { | ||
| 362 | - this.setItemImageStyle(item.picPath, 4, 0, 0, 0); | ||
| 363 | - } else if (index == 1) { | ||
| 364 | - //直角 | ||
| 365 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 366 | - } else if (index = 2) { | ||
| 367 | - this.setItemImageStyle(item.picPath, 0, 4, 0, 0); | ||
| 368 | - } else if (index = 3) { | ||
| 369 | - this.setItemImageStyle(item.picPath, 0, 0, 4, 0); | ||
| 370 | - } else if (index = 4) { | ||
| 371 | - //直角 | ||
| 372 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 373 | - } else { | ||
| 374 | - //右边圆角 | ||
| 375 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 4); | ||
| 376 | - } | ||
| 377 | - } else if (7 == len) { | ||
| 378 | - if (index == 0) { | ||
| 379 | - this.setItemImageStyle(item.picPath, 4, 0, 0, 0); | ||
| 380 | - } else if (index == 1) { | ||
| 381 | - //直角 | ||
| 382 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 383 | - } else if (index = 2) { | ||
| 384 | - this.setItemImageStyle(item.picPath, 0, 4, 0, 0); | ||
| 385 | - } else if (index = 3) { | ||
| 386 | - //直角 | ||
| 387 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 388 | - } else if (index = 4) { | ||
| 389 | - //直角 | ||
| 390 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 391 | - } else if (index = 5) { | ||
| 392 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 4); | ||
| 393 | - } else { | ||
| 394 | - this.setItemImageStyle(item.picPath, 0, 0, 4, 4); | ||
| 395 | - } | ||
| 396 | - } else if (8 == len) { | ||
| 397 | - if (index == 0) { | ||
| 398 | - this.setItemImageStyle(item.picPath, 4, 0, 0, 0); | ||
| 399 | - } else if (index == 1) { | ||
| 400 | - //直角 | ||
| 401 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 402 | - } else if (index = 2) { | ||
| 403 | - this.setItemImageStyle(item.picPath, 0, 4, 0, 0); | ||
| 404 | - } else if (index = 3) { | ||
| 405 | - //直角 | ||
| 406 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 407 | - } else if (index = 4) { | ||
| 408 | - //直角 | ||
| 409 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 410 | - } else if (index = 5) { | ||
| 411 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 4); | ||
| 412 | - } else if (index = 6) { | ||
| 413 | - this.setItemImageStyle(item.picPath, 0, 0, 4, 0); | ||
| 414 | - } else { | ||
| 415 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 4); | ||
| 416 | - } | 452 | + |
| 453 | + caclImageRadius(index: number) { | ||
| 454 | + let radius: radiusType = { | ||
| 455 | + topLeft: index === 0 ? $r('app.float.image_border_radius') : 0, | ||
| 456 | + topRight: 0, | ||
| 457 | + bottomLeft: 0, | ||
| 458 | + bottomRight: 0, | ||
| 459 | + } | ||
| 460 | + if (this.contentDetailData.photoList.length === 1) { | ||
| 461 | + radius.topRight = index === 0 ? $r('app.float.image_border_radius') : 0 | ||
| 462 | + radius.bottomLeft = index === 0 ? $r('app.float.image_border_radius') : 0 | ||
| 463 | + radius.bottomRight = index === 0 ? $r('app.float.image_border_radius') : 0 | ||
| 464 | + } else if (this.contentDetailData.photoList.length === 5 && !this.contentDetailData.photoList[2].fullUrl) { | ||
| 465 | + radius.topRight = index === 1 ? $r('app.float.image_border_radius') : 0 | ||
| 466 | + radius.bottomLeft = index === 3 ? $r('app.float.image_border_radius') : 0 | ||
| 467 | + radius.bottomRight = index === 4 ? $r('app.float.image_border_radius') : 0 | ||
| 417 | } else { | 468 | } else { |
| 418 | - if (index == 0) { | ||
| 419 | - this.setItemImageStyle(item.picPath, 4, 0, 0, 0); | ||
| 420 | - } else if (index == 1) { | ||
| 421 | - //直角 | ||
| 422 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 423 | - } else if (index == 2) { | ||
| 424 | - this.setItemImageStyle(item.picPath, 0, 4, 0, 0); | ||
| 425 | - } else if (index == 3) { | ||
| 426 | - //直角 | ||
| 427 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 428 | - } else if (index == 4) { | ||
| 429 | - //直角 | ||
| 430 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 431 | - } else if (index == 5) { | ||
| 432 | - //直角 | ||
| 433 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 434 | - } else if (index == 6) { | ||
| 435 | - this.setItemImageStyle(item.picPath, 0, 0, 4, 0); | ||
| 436 | - } else if (index == 7) { | ||
| 437 | - //直角 | ||
| 438 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | 469 | + radius.topRight = index === 2 ? $r('app.float.image_border_radius') : 0 |
| 470 | + radius.bottomLeft = index === 6 ? $r('app.float.image_border_radius') : 0 | ||
| 471 | + radius.bottomRight = index === 8 ? $r('app.float.image_border_radius') : 0 | ||
| 472 | + } | ||
| 473 | + return radius | ||
| 474 | + } | ||
| 475 | + | ||
| 476 | + getPicType(item: PhotoListBean){ | ||
| 477 | + if (item.width && item.width) { | ||
| 478 | + if (item.width / item.height > 343/172) { | ||
| 479 | + return 1; //横长图 | ||
| 480 | + } else if (item.height / item.width > 305/228) { | ||
| 481 | + return 2; //竖长图 | ||
| 439 | } else { | 482 | } else { |
| 440 | - this.setItemImageStyle(item.picPath, 0, 0, 0, 4); | 483 | + return 3 |
| 441 | } | 484 | } |
| 485 | + } else { | ||
| 486 | + return 3; //普通图 | ||
| 442 | } | 487 | } |
| 443 | } | 488 | } |
| 489 | +} | ||
| 490 | + | ||
| 491 | +interface radiusType { | ||
| 492 | + topLeft: number | Resource; | ||
| 493 | + topRight: number | Resource; | ||
| 494 | + bottomLeft: number | Resource; | ||
| 495 | + bottomRight: number | Resource; | ||
| 444 | } | 496 | } |
| 1 | import { PhotoListBean } from 'wdBean'; | 1 | import { PhotoListBean } from 'wdBean'; |
| 2 | import { Logger } from 'wdKit'; | 2 | import { Logger } from 'wdKit'; |
| 3 | -import router from '@ohos.router'; | ||
| 4 | -import display from '@ohos.display'; | ||
| 5 | 3 | ||
| 6 | const TAG = 'MultiPictureDetailPageComponent'; | 4 | const TAG = 'MultiPictureDetailPageComponent'; |
| 7 | 5 | ||
| @@ -11,14 +9,10 @@ export struct MultiPictureDetailItemComponent { | @@ -11,14 +9,10 @@ export struct MultiPictureDetailItemComponent { | ||
| 11 | //alt app.media.picture_loading 设计稿尺寸 | 9 | //alt app.media.picture_loading 设计稿尺寸 |
| 12 | @State imageWidth:string | number = 167 | 10 | @State imageWidth:string | number = 167 |
| 13 | @State ratio:number = 167/60 | 11 | @State ratio:number = 167/60 |
| 14 | - private scroller: Scroller = new Scroller() | ||
| 15 | - private displayTool = display.getDefaultDisplaySync() | ||
| 16 | - @State picHeight: number = 0 | ||
| 17 | 12 | ||
| 18 | 13 | ||
| 19 | async aboutToAppear() { | 14 | async aboutToAppear() { |
| 20 | - Logger.info(TAG, 'pictures preview') | ||
| 21 | - this.picHeight = this.displayTool.width * 578 / 375 | 15 | + // Logger.info(TAG, 'pictures preview') |
| 22 | } | 16 | } |
| 23 | 17 | ||
| 24 | build() { | 18 | build() { |
| @@ -33,16 +27,6 @@ export struct MultiPictureDetailItemComponent { | @@ -33,16 +27,6 @@ export struct MultiPictureDetailItemComponent { | ||
| 33 | this.imageWidth = '100%' | 27 | this.imageWidth = '100%' |
| 34 | this.ratio = this.MultiPictureDetailItem.width / this.MultiPictureDetailItem.height | 28 | this.ratio = this.MultiPictureDetailItem.width / this.MultiPictureDetailItem.height |
| 35 | }) | 29 | }) |
| 36 | - /*.onDrop(event => { | ||
| 37 | - router.back(); | ||
| 38 | - }) | ||
| 39 | - .draggable(true)*/ | ||
| 40 | - /*Scroll(this.scroller) { | ||
| 41 | - | ||
| 42 | - } | ||
| 43 | - .scrollable(ScrollDirection.Vertical) | ||
| 44 | - .scrollBarWidth(0) | ||
| 45 | - .height(px2vp(this.picHeight))*/ | ||
| 46 | } | 30 | } |
| 47 | .height('100%') | 31 | .height('100%') |
| 48 | .width('100%') | 32 | .width('100%') |
| 1 | -import { Logger, SPHelper } from 'wdKit'; | 1 | +import { NetworkUtil, Logger, NetworkType, SPHelper, } from 'wdKit'; |
| 2 | import { ResponseDTO } from 'wdNetwork'; | 2 | import { ResponseDTO } from 'wdNetwork'; |
| 3 | import { | 3 | import { |
| 4 | ContentDetailDTO, | 4 | ContentDetailDTO, |
| @@ -18,6 +18,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index'; | @@ -18,6 +18,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index'; | ||
| 18 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 18 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 19 | import { PageRepository } from '../repository/PageRepository'; | 19 | import { PageRepository } from '../repository/PageRepository'; |
| 20 | import { SpConstants } from 'wdConstant/Index'; | 20 | import { SpConstants } from 'wdConstant/Index'; |
| 21 | +import { router } from '@kit.ArkUI'; | ||
| 21 | 22 | ||
| 22 | const TAG = 'MultiPictureDetailPageComponent'; | 23 | const TAG = 'MultiPictureDetailPageComponent'; |
| 23 | 24 | ||
| @@ -34,6 +35,7 @@ export struct MultiPictureDetailPageComponent { | @@ -34,6 +35,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 34 | @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 35 | @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 35 | @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' | 36 | @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' |
| 36 | private swiperController: SwiperController = new SwiperController() | 37 | private swiperController: SwiperController = new SwiperController() |
| 38 | + private swiperControllerItem: SwiperController = new SwiperController() | ||
| 37 | @State swiperIndex: number = 0; | 39 | @State swiperIndex: number = 0; |
| 38 | @Provide followStatus: string = '0' // 关注状态 | 40 | @Provide followStatus: string = '0' // 关注状态 |
| 39 | private scroller: Scroller = new Scroller() | 41 | private scroller: Scroller = new Scroller() |
| @@ -59,7 +61,15 @@ export struct MultiPictureDetailPageComponent { | @@ -59,7 +61,15 @@ export struct MultiPictureDetailPageComponent { | ||
| 59 | familyName: 'BebasNeue_Regular', | 61 | familyName: 'BebasNeue_Regular', |
| 60 | familySrc: $rawfile('font/BebasNeue_Regular.otf') | 62 | familySrc: $rawfile('font/BebasNeue_Regular.otf') |
| 61 | }) | 63 | }) |
| 62 | - this.getContentDetailData() | 64 | + // 注册监听网络连接 |
| 65 | + let netStatus = NetworkUtil.isNetConnected() | ||
| 66 | + if (netStatus) { | ||
| 67 | + // 有网络 | ||
| 68 | + this.getContentDetailData() | ||
| 69 | + } else { | ||
| 70 | + // 无网络 | ||
| 71 | + this.netStatus = 1 | ||
| 72 | + } | ||
| 63 | } | 73 | } |
| 64 | 74 | ||
| 65 | aboutToDisappear() { | 75 | aboutToDisappear() { |
| @@ -71,7 +81,19 @@ export struct MultiPictureDetailPageComponent { | @@ -71,7 +81,19 @@ export struct MultiPictureDetailPageComponent { | ||
| 71 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) { | 81 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) { |
| 72 | Swiper(this.swiperController) { | 82 | Swiper(this.swiperController) { |
| 73 | ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => { | 83 | ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => { |
| 74 | - MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) | 84 | + Swiper(this.swiperControllerItem) { |
| 85 | + MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) | ||
| 86 | + } | ||
| 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 | + }) | ||
| 75 | }) | 97 | }) |
| 76 | } | 98 | } |
| 77 | .index(this.swiperIndex) | 99 | .index(this.swiperIndex) |
| @@ -82,6 +104,7 @@ export struct MultiPictureDetailPageComponent { | @@ -82,6 +104,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 82 | .cachedCount(3) | 104 | .cachedCount(3) |
| 83 | .indicator(false) | 105 | .indicator(false) |
| 84 | .displayCount(1) | 106 | .displayCount(1) |
| 107 | + .loop(false) | ||
| 85 | .id('e_swiper_content') | 108 | .id('e_swiper_content') |
| 86 | .alignRules({ | 109 | .alignRules({ |
| 87 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 110 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| @@ -241,15 +264,18 @@ export struct MultiPictureDetailPageComponent { | @@ -241,15 +264,18 @@ export struct MultiPictureDetailPageComponent { | ||
| 241 | }) | 264 | }) |
| 242 | .height(px2vp(this.titleHeight) + 64) | 265 | .height(px2vp(this.titleHeight) + 64) |
| 243 | 266 | ||
| 244 | - } else { | ||
| 245 | - if(this.netStatus !== undefined) { | ||
| 246 | - EmptyComponent({ emptyType: this.netStatus}) | ||
| 247 | - .id('e_empty_content') | ||
| 248 | - .alignRules({ | ||
| 249 | - center: { anchor: "__container__", align: VerticalAlign.Center }, | ||
| 250 | - middle: { anchor: "__container__", align: HorizontalAlign.Center } | ||
| 251 | - }) | ||
| 252 | - } | 267 | + } |
| 268 | + if (this.netStatus !== undefined) { | ||
| 269 | + EmptyComponent({ | ||
| 270 | + emptyType: this.netStatus, emptyButton: true, retry: () => { | ||
| 271 | + this.getContentDetailData() | ||
| 272 | + } | ||
| 273 | + }) | ||
| 274 | + .id('e_empty_content') | ||
| 275 | + .alignRules({ | ||
| 276 | + center: { anchor: "__container__", align: VerticalAlign.Center }, | ||
| 277 | + middle: { anchor: "__container__", align: HorizontalAlign.Center } | ||
| 278 | + }) | ||
| 253 | } | 279 | } |
| 254 | OperRowListView({ | 280 | OperRowListView({ |
| 255 | contentDetailData: this.contentDetailData, | 281 | contentDetailData: this.contentDetailData, |
| @@ -278,44 +304,39 @@ export struct MultiPictureDetailPageComponent { | @@ -278,44 +304,39 @@ export struct MultiPictureDetailPageComponent { | ||
| 278 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | 304 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) |
| 279 | } | 305 | } |
| 280 | 306 | ||
| 281 | - private getContentDetailData() { | 307 | + getContentDetailData() { |
| 282 | try { | 308 | try { |
| 283 | - PageRepository.fetchDetailData(this.relId, this.contentId, this.relType).then((resDTO: ResponseDTO<ContentDetailDTO[]>) => { | ||
| 284 | - // Logger.info(TAG, `fetchDetailData then,navResDTO.timestamp ${resDTO.timestamp}`); | ||
| 285 | - // Logger.info(TAG, `fetchDetailData then,navResDTO: ${JSON.stringify(resDTO)}`); | ||
| 286 | - // Logger.info(TAG, `fetchDetailData then,navResDTO.data: ${JSON.stringify(resDTO.data)}`); | ||
| 287 | - if (!resDTO || !resDTO.data) { | ||
| 288 | - Logger.error(TAG, 'fetchDetailData is empty'); | ||
| 289 | - return | ||
| 290 | - } | ||
| 291 | - if (resDTO.code != 0) { | ||
| 292 | - Logger.error(TAG, `fetchDetailData then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 293 | - return | ||
| 294 | - } | ||
| 295 | - this.contentDetailData = resDTO.data?.[0]; | ||
| 296 | - if(this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { | ||
| 297 | - this.netStatus = 0 | ||
| 298 | - } | ||
| 299 | - Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`) | ||
| 300 | - if (HttpUrlUtils.getUserId()) { | ||
| 301 | - this.getInteractBrowsOperate() | ||
| 302 | - this.getBatchAttentionStatus() | ||
| 303 | - } | ||
| 304 | - }).catch((err: Error) => { | ||
| 305 | - Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); | ||
| 306 | - /*// 请求失败处理 | ||
| 307 | - if (err.response) { | ||
| 308 | - // 请求已发出,但服务器响应的状态码不在2xx范围内 | ||
| 309 | - console.error('请求失败,状态码:', err.response.status); | ||
| 310 | - console.error('响应数据:', err.response.data); | ||
| 311 | - } else if (err.request) { | ||
| 312 | - // 请求已发出,但无响应(例如:网络故障) | ||
| 313 | - console.error('请求已发出,但无响应:', err.request); | ||
| 314 | - } else { | ||
| 315 | - // 发生了其他类型的错误(如配置错误或拒绝权限等) | ||
| 316 | - console.error('请求发生错误:', err.message); | ||
| 317 | - }*/ | ||
| 318 | - }) | 309 | + PageRepository.fetchDetailData(this.relId, this.contentId, this.relType) |
| 310 | + .then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => { | ||
| 311 | + if (!resDTO || !resDTO.data) { | ||
| 312 | + Logger.error(TAG, 'fetchDetailData is empty'); | ||
| 313 | + return | ||
| 314 | + } | ||
| 315 | + if (resDTO.code != 0) { | ||
| 316 | + Logger.error(TAG, `fetchDetailData then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 317 | + return | ||
| 318 | + } | ||
| 319 | + this.netStatus = undefined | ||
| 320 | + this.contentDetailData = resDTO.data?.[0]; | ||
| 321 | + // this.contentDetailData.photoList = [] | ||
| 322 | + if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { | ||
| 323 | + // 暂无内容 | ||
| 324 | + this.netStatus = 0 | ||
| 325 | + Logger.info(TAG, `this.netStatus:${JSON.stringify(this.netStatus)}`) | ||
| 326 | + } | ||
| 327 | + Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`) | ||
| 328 | + // 未登录,跳转登录 | ||
| 329 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 330 | + if (user_id) { | ||
| 331 | + this.getInteractBrowsOperate() | ||
| 332 | + this.getBatchAttentionStatus() | ||
| 333 | + } | ||
| 334 | + }) | ||
| 335 | + .catch((err: Error) => { | ||
| 336 | + Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); | ||
| 337 | + // 内容获取失败 | ||
| 338 | + this.netStatus = 9 | ||
| 339 | + }) | ||
| 319 | } catch (exception) { | 340 | } catch (exception) { |
| 320 | 341 | ||
| 321 | } | 342 | } |
| 1 | import { CompInfoBean, CompDTO, CompList } from 'wdBean' | 1 | import { CompInfoBean, CompDTO, CompList } from 'wdBean' |
| 2 | import { CommonConstants } from 'wdConstant'; | 2 | import { CommonConstants } from 'wdConstant'; |
| 3 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 3 | +import { ProcessUtils } from 'wdRouter'; |
| 4 | /** | 4 | /** |
| 5 | * 播报--今日推荐列表 | 5 | * 播报--今日推荐列表 |
| 6 | */ | 6 | */ |
| 1 | import { CompInfoBean, CompDTO } from 'wdBean' | 1 | import { CompInfoBean, CompDTO } from 'wdBean' |
| 2 | import { DateTimeUtils } from 'wdKit/Index' | 2 | import { DateTimeUtils } from 'wdKit/Index' |
| 3 | import { CommonConstants } from 'wdConstant'; | 3 | import { CommonConstants } from 'wdConstant'; |
| 4 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 4 | +import { ProcessUtils } from 'wdRouter'; |
| 5 | /** | 5 | /** |
| 6 | * 精选栏目 | 6 | * 精选栏目 |
| 7 | */ | 7 | */ |
| @@ -21,8 +21,10 @@ export struct CardMediaInfo { | @@ -21,8 +21,10 @@ export struct CardMediaInfo { | ||
| 21 | Row() { | 21 | Row() { |
| 22 | Image($r('app.media.card_play')) | 22 | Image($r('app.media.card_play')) |
| 23 | .mediaLogo() | 23 | .mediaLogo() |
| 24 | - Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000)) | ||
| 25 | - .mediaText() | 24 | + if(this.contentDTO.videoInfo!=null){ |
| 25 | + Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000)) | ||
| 26 | + .mediaText() | ||
| 27 | + } | ||
| 26 | } | 28 | } |
| 27 | } else if (this.contentDTO.objectType === '2') { | 29 | } else if (this.contentDTO.objectType === '2') { |
| 28 | // liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | 30 | // liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 |
| 1 | import { ContentDTO, slideShows } from 'wdBean'; | 1 | import { ContentDTO, slideShows } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant' | 2 | import { CommonConstants } from 'wdConstant' |
| 3 | import { DateTimeUtils } from 'wdKit'; | 3 | import { DateTimeUtils } from 'wdKit'; |
| 4 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 4 | +import { ProcessUtils } from 'wdRouter'; |
| 5 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 5 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 6 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 6 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 7 | 7 |
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | import { CommonConstants } from 'wdConstant' | 2 | import { CommonConstants } from 'wdConstant' |
| 3 | import { ContentDTO } from 'wdBean' | 3 | import { ContentDTO } from 'wdBean' |
| 4 | import { DateTimeUtils } from 'wdKit' | 4 | import { DateTimeUtils } from 'wdKit' |
| 5 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 5 | +import { ProcessUtils } from 'wdRouter'; |
| 6 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 6 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 7 | const TAG = 'Card11Component'; | 7 | const TAG = 'Card11Component'; |
| 8 | 8 |
| @@ -2,7 +2,7 @@ import { ContentDTO } from 'wdBean'; | @@ -2,7 +2,7 @@ import { ContentDTO } from 'wdBean'; | ||
| 2 | import { RmhTitle } from '../cardCommon/RmhTitle' | 2 | import { RmhTitle } from '../cardCommon/RmhTitle' |
| 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 4 | import { CommonConstants } from 'wdConstant/Index'; | 4 | import { CommonConstants } from 'wdConstant/Index'; |
| 5 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 5 | +import { ProcessUtils } from 'wdRouter'; |
| 6 | 6 | ||
| 7 | const TAG = 'Card12Component'; | 7 | const TAG = 'Card12Component'; |
| 8 | 8 |
| @@ -2,7 +2,7 @@ import { ContentDTO } from 'wdBean'; | @@ -2,7 +2,7 @@ import { ContentDTO } from 'wdBean'; | ||
| 2 | import { RmhTitle } from '../cardCommon/RmhTitle' | 2 | import { RmhTitle } from '../cardCommon/RmhTitle' |
| 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 4 | import { CommonConstants } from 'wdConstant/Index'; | 4 | import { CommonConstants } from 'wdConstant/Index'; |
| 5 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 5 | +import { ProcessUtils } from 'wdRouter'; |
| 6 | 6 | ||
| 7 | const TAG = 'Card14Component'; | 7 | const TAG = 'Card14Component'; |
| 8 | 8 |
| 1 | import { ContentDTO } from 'wdBean'; | 1 | import { ContentDTO } from 'wdBean'; |
| 2 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 2 | +import { ProcessUtils } from 'wdRouter'; |
| 3 | import { RmhTitle } from '../cardCommon/RmhTitle' | 3 | import { RmhTitle } from '../cardCommon/RmhTitle' |
| 4 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 4 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 5 | import { CommonConstants } from 'wdConstant/Index'; | 5 | import { CommonConstants } from 'wdConstant/Index'; |
| @@ -2,7 +2,7 @@ import { ContentDTO } from 'wdBean'; | @@ -2,7 +2,7 @@ import { ContentDTO } from 'wdBean'; | ||
| 2 | import { RmhTitle } from '../cardCommon/RmhTitle' | 2 | import { RmhTitle } from '../cardCommon/RmhTitle' |
| 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 4 | import { CommonConstants } from 'wdConstant/Index'; | 4 | import { CommonConstants } from 'wdConstant/Index'; |
| 5 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 5 | +import { ProcessUtils } from 'wdRouter'; |
| 6 | 6 | ||
| 7 | const TAG = 'Card16Component'; | 7 | const TAG = 'Card16Component'; |
| 8 | 8 |
| @@ -29,7 +29,8 @@ export struct Card17Component { | @@ -29,7 +29,8 @@ export struct Card17Component { | ||
| 29 | // 三个图, | 29 | // 三个图, |
| 30 | GridRow({ gutter: 2 }) { | 30 | GridRow({ gutter: 2 }) { |
| 31 | GridCol({ span: { xs: 8 } }) { | 31 | GridCol({ span: { xs: 8 } }) { |
| 32 | - Image(this.contentDTO.fullColumnImgUrls[0].url) | 32 | + Image(this.contentDTO.fullColumnImgUrls.length > 0 ?this.contentDTO.fullColumnImgUrls[0].url:'') |
| 33 | + .backgroundColor('#f5f5f5') | ||
| 33 | .width(CommonConstants.FULL_WIDTH) | 34 | .width(CommonConstants.FULL_WIDTH) |
| 34 | .aspectRatio(16 / 9) | 35 | .aspectRatio(16 / 9) |
| 35 | .borderRadius({ | 36 | .borderRadius({ |
| @@ -39,7 +40,8 @@ export struct Card17Component { | @@ -39,7 +40,8 @@ export struct Card17Component { | ||
| 39 | } | 40 | } |
| 40 | 41 | ||
| 41 | GridCol({ span: { xs: 4 } }) { | 42 | GridCol({ span: { xs: 4 } }) { |
| 42 | - Image(this.contentDTO.fullColumnImgUrls[1].url) | 43 | + Image(this.contentDTO.fullColumnImgUrls.length > 1? this.contentDTO.fullColumnImgUrls[1].url:'') |
| 44 | + .backgroundColor('#f5f5f5') | ||
| 43 | .width(CommonConstants.FULL_WIDTH) | 45 | .width(CommonConstants.FULL_WIDTH) |
| 44 | .aspectRatio(16 / 9) | 46 | .aspectRatio(16 / 9) |
| 45 | .margin({ bottom: 1 }) | 47 | .margin({ bottom: 1 }) |
| @@ -54,7 +56,8 @@ export struct Card17Component { | @@ -54,7 +56,8 @@ export struct Card17Component { | ||
| 54 | } | 56 | } |
| 55 | 57 | ||
| 56 | GridCol({ span: { xs: 4 } }) { | 58 | GridCol({ span: { xs: 4 } }) { |
| 57 | - Image(this.contentDTO.fullColumnImgUrls[2].url) | 59 | + Image(this.contentDTO.fullColumnImgUrls.length > 2? this.contentDTO.fullColumnImgUrls[2].url:'') |
| 60 | + .backgroundColor('#f5f5f5') | ||
| 58 | .width(CommonConstants.FULL_WIDTH) | 61 | .width(CommonConstants.FULL_WIDTH) |
| 59 | .aspectRatio(16 / 9) | 62 | .aspectRatio(16 / 9) |
| 60 | .margin({ top: 1 }) | 63 | .margin({ top: 1 }) |
| 1 | -import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean'; | 1 | +import { ContentDTO, FullColumnImgUrlDTO, PhotoListBean } from 'wdBean'; |
| 2 | import { RmhTitle } from '../cardCommon/RmhTitle' | 2 | import { RmhTitle } from '../cardCommon/RmhTitle' |
| 3 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 3 | +import { ProcessUtils } from 'wdRouter'; |
| 4 | import { CommonConstants } from 'wdConstant/Index'; | 4 | import { CommonConstants } from 'wdConstant/Index'; |
| 5 | 5 | ||
| 6 | const TAG = 'Card19Component'; | 6 | const TAG = 'Card19Component'; |
| @@ -92,8 +92,17 @@ export struct Card19Component { | @@ -92,8 +92,17 @@ export struct Card19Component { | ||
| 92 | } | 92 | } |
| 93 | // 图片-从无图到9图展示 | 93 | // 图片-从无图到9图展示 |
| 94 | createImg({ fullColumnImgUrls: this.contentDTO.fullColumnImgUrls }) | 94 | createImg({ fullColumnImgUrls: this.contentDTO.fullColumnImgUrls }) |
| 95 | - .onClick((event: ClickEvent) => { | ||
| 96 | - ProcessUtils.processPage(this.contentDTO) | 95 | + .onClick(() => { |
| 96 | + const photoList: PhotoListBean[] = this.contentDTO.fullColumnImgUrls.map(item => { | ||
| 97 | + const photo: PhotoListBean = { | ||
| 98 | + width: item.weight, | ||
| 99 | + height: item.height, | ||
| 100 | + picPath: item.fullUrl, | ||
| 101 | + picDesc: '' | ||
| 102 | + } | ||
| 103 | + return photo | ||
| 104 | + }) | ||
| 105 | + ProcessUtils.gotoMultiPictureListPage(photoList) | ||
| 97 | }) | 106 | }) |
| 98 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 107 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 99 | } | 108 | } |
| @@ -103,6 +112,9 @@ export struct Card19Component { | @@ -103,6 +112,9 @@ export struct Card19Component { | ||
| 103 | top: $r('app.float.card_comp_pagePadding_tb'), | 112 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 104 | bottom: $r('app.float.card_comp_pagePadding_tb') | 113 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 105 | }) | 114 | }) |
| 115 | + .onClick((event: ClickEvent) => { | ||
| 116 | + ProcessUtils.processPage(this.contentDTO) | ||
| 117 | + }) | ||
| 106 | } | 118 | } |
| 107 | } | 119 | } |
| 108 | 120 |
| @@ -2,7 +2,7 @@ import { ContentDTO } from 'wdBean'; | @@ -2,7 +2,7 @@ import { ContentDTO } from 'wdBean'; | ||
| 2 | import { RmhTitle } from '../cardCommon/RmhTitle' | 2 | import { RmhTitle } from '../cardCommon/RmhTitle' |
| 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 4 | import { CommonConstants } from 'wdConstant/Index'; | 4 | import { CommonConstants } from 'wdConstant/Index'; |
| 5 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 5 | +import { ProcessUtils } from 'wdRouter'; |
| 6 | const TAG = 'Card20Component'; | 6 | const TAG = 'Card20Component'; |
| 7 | 7 | ||
| 8 | /** | 8 | /** |
| 1 | import { ContentDTO } from 'wdBean'; | 1 | import { ContentDTO } from 'wdBean'; |
| 2 | import { CommonConstants, CompStyle } from 'wdConstant'; | 2 | import { CommonConstants, CompStyle } from 'wdConstant'; |
| 3 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 3 | +import { ProcessUtils } from 'wdRouter'; |
| 4 | import { RmhTitle } from '../cardCommon/RmhTitle' | 4 | import { RmhTitle } from '../cardCommon/RmhTitle' |
| 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 6 | 6 |
| 1 | //全标题 "appStyle":"2", | 1 | //全标题 "appStyle":"2", |
| 2 | import { ContentDTO } from 'wdBean'; | 2 | import { ContentDTO } from 'wdBean'; |
| 3 | import { CommonConstants } from 'wdConstant/Index'; | 3 | import { CommonConstants } from 'wdConstant/Index'; |
| 4 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 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 | const TAG: string = 'Card2Component'; | 7 | const TAG: string = 'Card2Component'; |
| 1 | import { ContentDTO } from 'wdBean'; | 1 | import { ContentDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant' | 2 | import { CommonConstants } from 'wdConstant' |
| 3 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 3 | +import { ProcessUtils } from 'wdRouter'; |
| 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 1 | import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean'; | 1 | import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant/Index'; | 2 | import { CommonConstants } from 'wdConstant/Index'; |
| 3 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 3 | +import { ProcessUtils } from 'wdRouter'; |
| 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 5 | const TAG: string = 'Card4Component'; | 5 | const TAG: string = 'Card4Component'; |
| 6 | 6 |
| 1 | import { ContentDTO } from 'wdBean'; | 1 | import { ContentDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant'; | 2 | import { CommonConstants } from 'wdConstant'; |
| 3 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 3 | +import { ProcessUtils } from 'wdRouter'; |
| 4 | 4 | ||
| 5 | const TAG: string = 'Card5Component'; | 5 | const TAG: string = 'Card5Component'; |
| 6 | 6 |
| 1 | import { ContentDTO } from 'wdBean'; | 1 | import { ContentDTO } from 'wdBean'; |
| 2 | import { CommonConstants, CompStyle } from 'wdConstant'; | 2 | import { CommonConstants, CompStyle } from 'wdConstant'; |
| 3 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 3 | +import { ProcessUtils } from 'wdRouter'; |
| 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 6 | const TAG: string = 'Card6Component-Card13Component'; | 6 | const TAG: string = 'Card6Component-Card13Component'; |
| 1 | import { ContentDTO, slideShows } from 'wdBean'; | 1 | import { ContentDTO, slideShows } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant' | 2 | import { CommonConstants } from 'wdConstant' |
| 3 | import { DateTimeUtils } from 'wdKit'; | 3 | import { DateTimeUtils } from 'wdKit'; |
| 4 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 4 | +import { ProcessUtils } from 'wdRouter'; |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 7 | * 时间链卡--CompStyle: 09 | 7 | * 时间链卡--CompStyle: 09 |
| @@ -2,7 +2,7 @@ import { CompDTO, ContentDTO, } from 'wdBean'; | @@ -2,7 +2,7 @@ import { CompDTO, ContentDTO, } from 'wdBean'; | ||
| 2 | import { BreakpointConstants, CommonConstants, DurationEnum } from 'wdConstant'; | 2 | import { BreakpointConstants, CommonConstants, DurationEnum } from 'wdConstant'; |
| 3 | import { BreakPointType, Logger } from 'wdKit'; | 3 | import { BreakPointType, Logger } from 'wdKit'; |
| 4 | import { CompUtils } from '../../utils/CompUtils'; | 4 | import { CompUtils } from '../../utils/CompUtils'; |
| 5 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 5 | +import { ProcessUtils } from 'wdRouter'; |
| 6 | import { EmptyComponent } from '../view/EmptyComponent'; | 6 | import { EmptyComponent } from '../view/EmptyComponent'; |
| 7 | 7 | ||
| 8 | const TAG = 'Zh_Carousel_Layout-01'; | 8 | const TAG = 'Zh_Carousel_Layout-01'; |
| 1 | import { CompDTO, ContentDTO } from 'wdBean'; | 1 | import { CompDTO, ContentDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant/Index'; | 2 | import { CommonConstants } from 'wdConstant/Index'; |
| 3 | import { Logger } from 'wdKit/Index'; | 3 | import { Logger } from 'wdKit/Index'; |
| 4 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 4 | +import { ProcessUtils } from 'wdRouter'; |
| 5 | import PageViewModel from '../../viewmodel/PageViewModel'; | 5 | import PageViewModel from '../../viewmodel/PageViewModel'; |
| 6 | 6 | ||
| 7 | const TAG = 'Zh_Grid_Layout-02'; | 7 | const TAG = 'Zh_Grid_Layout-02'; |
| @@ -2,7 +2,7 @@ import { Action, CompDTO, ContentDTO, Params } from 'wdBean'; | @@ -2,7 +2,7 @@ import { Action, CompDTO, ContentDTO, Params } from 'wdBean'; | ||
| 2 | import { CompStyle } from 'wdConstant'; | 2 | import { CompStyle } from 'wdConstant'; |
| 3 | import { Logger } from 'wdKit'; | 3 | import { Logger } from 'wdKit'; |
| 4 | import { WDRouterRule } from 'wdRouter'; | 4 | import { WDRouterRule } from 'wdRouter'; |
| 5 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 5 | +import { ProcessUtils } from 'wdRouter'; |
| 6 | 6 | ||
| 7 | const TAG = 'Zh_Grid_Layout-03'; | 7 | const TAG = 'Zh_Grid_Layout-03'; |
| 8 | const FULL_PARENT: string = '100%'; | 8 | const FULL_PARENT: string = '100%'; |
| @@ -36,6 +36,12 @@ export struct ZhGridLayout03 { | @@ -36,6 +36,12 @@ export struct ZhGridLayout03 { | ||
| 36 | } | 36 | } |
| 37 | }) | 37 | }) |
| 38 | } | 38 | } |
| 39 | + .padding({ | ||
| 40 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 41 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 42 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 43 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 44 | + }) | ||
| 39 | } | 45 | } |
| 40 | 46 | ||
| 41 | /** | 47 | /** |
| @@ -49,7 +55,9 @@ export struct ZhGridLayout03 { | @@ -49,7 +55,9 @@ export struct ZhGridLayout03 { | ||
| 49 | Image(item.coverUrl) | 55 | Image(item.coverUrl) |
| 50 | .width(44) | 56 | .width(44) |
| 51 | .aspectRatio(1 / 1) | 57 | .aspectRatio(1 / 1) |
| 52 | - .margin(16) | 58 | + .margin({ |
| 59 | + bottom: 16 | ||
| 60 | + }) | ||
| 53 | Text(item.newsTitle) | 61 | Text(item.newsTitle) |
| 54 | .fontSize(13) | 62 | .fontSize(13) |
| 55 | .maxLines(1) | 63 | .maxLines(1) |
| 1 | import { CompDTO, ContentDTO } from 'wdBean'; | 1 | import { CompDTO, ContentDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant'; | 2 | import { CommonConstants } from 'wdConstant'; |
| 3 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 3 | +import { ProcessUtils } from 'wdRouter'; |
| 4 | 4 | ||
| 5 | const TAG = 'Zh_Single_Column-04'; | 5 | const TAG = 'Zh_Single_Column-04'; |
| 6 | 6 |
| @@ -4,7 +4,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index'; | @@ -4,7 +4,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index'; | ||
| 4 | import { postInteractAccentionOperateParams } from 'wdBean'; | 4 | import { postInteractAccentionOperateParams } from 'wdBean'; |
| 5 | import { PageRepository } from '../../repository/PageRepository'; | 5 | import { PageRepository } from '../../repository/PageRepository'; |
| 6 | import { CommonConstants } from 'wdConstant/Index'; | 6 | import { CommonConstants } from 'wdConstant/Index'; |
| 7 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 7 | +import { ProcessUtils } from 'wdRouter'; |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| 10 | * 小视频横划卡 | 10 | * 小视频横划卡 |
| @@ -31,6 +31,7 @@ export struct ZhSingleRow02 { | @@ -31,6 +31,7 @@ export struct ZhSingleRow02 { | ||
| 31 | }) | 31 | }) |
| 32 | } | 32 | } |
| 33 | .listDirection(Axis.Horizontal) | 33 | .listDirection(Axis.Horizontal) |
| 34 | + .scrollBar(BarState.Off) | ||
| 34 | } | 35 | } |
| 35 | .width(CommonConstants.FULL_WIDTH) | 36 | .width(CommonConstants.FULL_WIDTH) |
| 36 | .height(208) | 37 | .height(208) |
| 1 | import { CompDTO, ContentDTO } from 'wdBean'; | 1 | import { CompDTO, ContentDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant'; | 2 | import { CommonConstants } from 'wdConstant'; |
| 3 | import { DateTimeUtils } from 'wdKit'; | 3 | import { DateTimeUtils } from 'wdKit'; |
| 4 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 4 | +import { ProcessUtils } from 'wdRouter'; |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 7 | * 本地精选卡 | 7 | * 本地精选卡 |
| @@ -40,6 +40,10 @@ export struct ZhSingleRow04 { | @@ -40,6 +40,10 @@ export struct ZhSingleRow04 { | ||
| 40 | .justifyContent(FlexAlign.SpaceBetween) | 40 | .justifyContent(FlexAlign.SpaceBetween) |
| 41 | .margin({ top: 8, bottom: 8 }) | 41 | .margin({ top: 8, bottom: 8 }) |
| 42 | .width('100%') | 42 | .width('100%') |
| 43 | + .padding({ | ||
| 44 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 45 | + right: $r('app.float.card_comp_pagePadding_lf') | ||
| 46 | + }) | ||
| 43 | 47 | ||
| 44 | // 列表内容 | 48 | // 列表内容 |
| 45 | List({ space: 12 }) { | 49 | List({ space: 12 }) { |
| @@ -50,7 +54,9 @@ export struct ZhSingleRow04 { | @@ -50,7 +54,9 @@ export struct ZhSingleRow04 { | ||
| 50 | operDataListItem: item | 54 | operDataListItem: item |
| 51 | } | 55 | } |
| 52 | ) | 56 | ) |
| 53 | - .margin({right: index === this.compDTO.operDataList.length - 1 ? $r('app.float.card_comp_pagePadding_lf') : 0}) | 57 | + .margin({right: index === this.compDTO.operDataList.length - 1 ? $r('app.float.card_comp_pagePadding_lf') : 0, left: |
| 58 | + index === 0 ? $r('app.float.card_comp_pagePadding_lf') : 0, | ||
| 59 | + top: 6}) | ||
| 54 | .onClick(() => { | 60 | .onClick(() => { |
| 55 | ProcessUtils.processPage(item) | 61 | ProcessUtils.processPage(item) |
| 56 | }) | 62 | }) |
| @@ -60,13 +66,9 @@ export struct ZhSingleRow04 { | @@ -60,13 +66,9 @@ export struct ZhSingleRow04 { | ||
| 60 | .listDirection(Axis.Horizontal) | 66 | .listDirection(Axis.Horizontal) |
| 61 | .scrollBar(BarState.Off) | 67 | .scrollBar(BarState.Off) |
| 62 | .width(CommonConstants.FULL_PARENT) | 68 | .width(CommonConstants.FULL_PARENT) |
| 69 | + .height(166) | ||
| 63 | } | 70 | } |
| 64 | .width(CommonConstants.FULL_WIDTH) | 71 | .width(CommonConstants.FULL_WIDTH) |
| 65 | - .padding({ | ||
| 66 | - left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 67 | - top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 68 | - bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 69 | - }) | ||
| 70 | .backgroundColor($r("app.color.white")) | 72 | .backgroundColor($r("app.color.white")) |
| 71 | .margin({ bottom: 8 }) | 73 | .margin({ bottom: 8 }) |
| 72 | } | 74 | } |
| @@ -124,7 +126,7 @@ struct localCard { | @@ -124,7 +126,7 @@ struct localCard { | ||
| 124 | .border({ | 126 | .border({ |
| 125 | radius: 2, | 127 | radius: 2, |
| 126 | }) | 128 | }) |
| 127 | - .shadow({ radius: 5, color: '#1A000000', offsetX: 0, offsetY: 2 }) | 129 | + .shadow({ radius: 15, color: '#1A000000', offsetX: 2, offsetY: 2 }) |
| 128 | .margin({ | 130 | .margin({ |
| 129 | right: 10 | 131 | right: 10 |
| 130 | }) | 132 | }) |
| 1 | -import { CompDTO, ContentDTO, Params } from 'wdBean'; | 1 | +import { commentInfo, CompDTO, ContentDTO, Params } from 'wdBean'; |
| 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 3 | import { HttpUrlUtils } from 'wdNetwork/Index'; | 3 | import { HttpUrlUtils } from 'wdNetwork/Index'; |
| 4 | import { postInteractAccentionOperateParams } from 'wdBean'; | 4 | import { postInteractAccentionOperateParams } from 'wdBean'; |
| 5 | import { PageRepository } from '../../repository/PageRepository'; | 5 | import { PageRepository } from '../../repository/PageRepository'; |
| 6 | import { DateTimeUtils } from 'wdKit/Index'; | 6 | import { DateTimeUtils } from 'wdKit/Index'; |
| 7 | import { CommonConstants } from 'wdConstant/Index'; | 7 | import { CommonConstants } from 'wdConstant/Index'; |
| 8 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 8 | +import { ProcessUtils } from 'wdRouter'; |
| 9 | 9 | ||
| 10 | /** | 10 | /** |
| 11 | * 精选评论卡 | 11 | * 精选评论卡 |
| @@ -27,6 +27,7 @@ const TAG = 'Zh_Single_Row-06' | @@ -27,6 +27,7 @@ const TAG = 'Zh_Single_Row-06' | ||
| 27 | // operDataList: Array<operDataListItem> | 27 | // operDataList: Array<operDataListItem> |
| 28 | // } | 28 | // } |
| 29 | 29 | ||
| 30 | +@Entry | ||
| 30 | @Component | 31 | @Component |
| 31 | export struct ZhSingleRow06 { | 32 | export struct ZhSingleRow06 { |
| 32 | @State compDTO: CompDTO = {} as CompDTO | 33 | @State compDTO: CompDTO = {} as CompDTO |
| @@ -44,9 +45,12 @@ export struct ZhSingleRow06 { | @@ -44,9 +45,12 @@ export struct ZhSingleRow06 { | ||
| 44 | .textOverflow({overflow: TextOverflow.Ellipsis}) | 45 | .textOverflow({overflow: TextOverflow.Ellipsis}) |
| 45 | .lineHeight(23) | 46 | .lineHeight(23) |
| 46 | .fontSize(16) | 47 | .fontSize(16) |
| 47 | - .margin({bottom: 19}) | 48 | + .margin({bottom: 10}) |
| 49 | + .padding({bottom: 10}) | ||
| 48 | .textAlign(TextAlign.Start) | 50 | .textAlign(TextAlign.Start) |
| 49 | .width('100%') | 51 | .width('100%') |
| 52 | + .border({width: {bottom: 1}}) | ||
| 53 | + .borderColor(0xf4f4f4) | ||
| 50 | 54 | ||
| 51 | 55 | ||
| 52 | Row() { | 56 | Row() { |
| @@ -68,6 +72,9 @@ export struct ZhSingleRow06 { | @@ -68,6 +72,9 @@ export struct ZhSingleRow06 { | ||
| 68 | .backgroundColor(0xf9f9f9) | 72 | .backgroundColor(0xf9f9f9) |
| 69 | .borderRadius(4) | 73 | .borderRadius(4) |
| 70 | .margin({bottom: 12}) | 74 | .margin({bottom: 12}) |
| 75 | + .onClick(() => { | ||
| 76 | + ProcessUtils.commentGotoWeb(this.compDTO.operDataList[0]?.commentInfo as commentInfo) | ||
| 77 | + }) | ||
| 71 | 78 | ||
| 72 | Row() { | 79 | Row() { |
| 73 | Text(DateTimeUtils.getCommentTime(this.compDTO.operDataList[0]?.commentInfo?.publishTime)) | 80 | Text(DateTimeUtils.getCommentTime(this.compDTO.operDataList[0]?.commentInfo?.publishTime)) |
| @@ -95,11 +102,6 @@ export struct ZhSingleRow06 { | @@ -95,11 +102,6 @@ export struct ZhSingleRow06 { | ||
| 95 | bottom: $r('app.float.card_comp_pagePadding_tb') | 102 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 96 | }) | 103 | }) |
| 97 | .backgroundColor($r('app.color.white')) | 104 | .backgroundColor($r('app.color.white')) |
| 98 | - .margin({ bottom: 8 }) | ||
| 99 | - .height(251) | ||
| 100 | - .onClick(() => { | ||
| 101 | - WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage) | ||
| 102 | - }) | ||
| 103 | } | 105 | } |
| 104 | 106 | ||
| 105 | @Builder | 107 | @Builder |
| @@ -128,6 +130,9 @@ export struct ZhSingleRow06 { | @@ -128,6 +130,9 @@ export struct ZhSingleRow06 { | ||
| 128 | .width(14) | 130 | .width(14) |
| 129 | .height(14) | 131 | .height(14) |
| 130 | } | 132 | } |
| 133 | + .onClick(() => { | ||
| 134 | + WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage) | ||
| 135 | + }) | ||
| 131 | } | 136 | } |
| 132 | .margin({bottom: 10}) | 137 | .margin({bottom: 10}) |
| 133 | .justifyContent(FlexAlign.SpaceBetween) | 138 | .justifyContent(FlexAlign.SpaceBetween) |
| 1 | import MinePageMoreFunctionModel from '../../viewmodel/MinePageMoreFunctionModel' | 1 | import MinePageMoreFunctionModel from '../../viewmodel/MinePageMoreFunctionModel' |
| 2 | import { WDRouterRule, WDRouterPage } from 'wdRouter' | 2 | import { WDRouterRule, WDRouterPage } from 'wdRouter' |
| 3 | -import { Action, Params } from 'wdBean'; | ||
| 4 | -import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; | 3 | +import { Params } from 'wdBean'; |
| 5 | 4 | ||
| 6 | @Component | 5 | @Component |
| 7 | export default struct MinePageMoreFunctionUI { | 6 | export default struct MinePageMoreFunctionUI { |
| @@ -70,18 +69,12 @@ export default struct MinePageMoreFunctionUI { | @@ -70,18 +69,12 @@ export default struct MinePageMoreFunctionUI { | ||
| 70 | } | 69 | } |
| 71 | .onClick(() => { | 70 | .onClick(() => { |
| 72 | console.log(index + "") | 71 | console.log(index + "") |
| 73 | - if (index == 0) { | ||
| 74 | - // WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 75 | - } else if (index == 1) { | ||
| 76 | - // WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 77 | - } else if (index == 2) { | ||
| 78 | - | ||
| 79 | - } else if (index == 3) { //设置 | 72 | + if (item.msg == "设置") { //设置 |
| 80 | let params: Params = { | 73 | let params: Params = { |
| 81 | pageID: 'mainSetting' | 74 | pageID: 'mainSetting' |
| 82 | } | 75 | } |
| 83 | WDRouterRule.jumpWithPage(WDRouterPage.settingPage, params) | 76 | WDRouterRule.jumpWithPage(WDRouterPage.settingPage, params) |
| 84 | - }else if (index == 4) { // 关于 | 77 | + }else if (item.msg == "关于") { // 关于 |
| 85 | WDRouterRule.jumpWithPage(WDRouterPage.aboutPage) | 78 | WDRouterRule.jumpWithPage(WDRouterPage.aboutPage) |
| 86 | } | 79 | } |
| 87 | }) | 80 | }) |
| @@ -83,9 +83,11 @@ export default struct MinePagePersonFunctionUI { | @@ -83,9 +83,11 @@ export default struct MinePagePersonFunctionUI { | ||
| 83 | .height('117lpx') | 83 | .height('117lpx') |
| 84 | }) | 84 | }) |
| 85 | } | 85 | } |
| 86 | - .rowsTemplate('1fr 1fr') | 86 | + // .rowsTemplate('1fr 1fr') |
| 87 | + .rowsTemplate('1fr') | ||
| 87 | .columnsTemplate('1fr 1fr 1fr 1fr') | 88 | .columnsTemplate('1fr 1fr 1fr 1fr') |
| 88 | - .height('234lpx') | 89 | + // .height('234lpx') |
| 90 | + .height('167lpx') | ||
| 89 | .margin({top:'31lpx',left:'23lpx',right:'23lpx' }) | 91 | .margin({top:'31lpx',left:'23lpx',right:'23lpx' }) |
| 90 | } | 92 | } |
| 91 | } | 93 | } |
| @@ -119,6 +119,7 @@ export default struct MinePageUserSimpleInfoUI { | @@ -119,6 +119,7 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 119 | .width('50lpx') | 119 | .width('50lpx') |
| 120 | .height('50lpx') | 120 | .height('50lpx') |
| 121 | }.width('131lpx') | 121 | }.width('131lpx') |
| 122 | + .visibility(Visibility.Hidden) | ||
| 122 | }.backgroundColor($r('app.color.white')) | 123 | }.backgroundColor($r('app.color.white')) |
| 123 | .setFullWidth() | 124 | .setFullWidth() |
| 124 | .padding({top:'31lpx',left:'46lpx'}) | 125 | .padding({top:'31lpx',left:'46lpx'}) |
| 1 | -import { StringUtils, ToastUtils } from 'wdKit/Index' | 1 | +import { DateTimeUtils, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index' |
| 2 | import { HttpUrlUtils } from 'wdNetwork/Index' | 2 | import { HttpUrlUtils } from 'wdNetwork/Index' |
| 3 | import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' | 3 | import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' |
| 4 | import MinePageDatasModel from '../../../model/MinePageDatasModel' | 4 | import MinePageDatasModel from '../../../model/MinePageDatasModel' |
| @@ -133,14 +133,17 @@ export struct FollowChildComponent{ | @@ -133,14 +133,17 @@ export struct FollowChildComponent{ | ||
| 133 | .maxLines(1) | 133 | .maxLines(1) |
| 134 | .margin({bottom:'12lpx'}) | 134 | .margin({bottom:'12lpx'}) |
| 135 | Row(){ | 135 | Row(){ |
| 136 | - Text(`粉丝${this.data.cnFansNum}`) | ||
| 137 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 138 | - .fontSize('23lpx') | ||
| 139 | - | ||
| 140 | - Image($r("app.media.point")) | ||
| 141 | - .width('31lpx') | ||
| 142 | - .height('31lpx') | ||
| 143 | - .objectFit(ImageFit.Auto) | 136 | + if(this.data.cnFansNum!="0"){ |
| 137 | + Text(`粉丝${this.data.cnFansNum}`) | ||
| 138 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 139 | + .fontSize('23lpx') | ||
| 140 | + } | ||
| 141 | + if(this.data.cnFansNum!="0" && StringUtils.isNotEmpty(this.data.introduction)){ | ||
| 142 | + Image($r("app.media.point")) | ||
| 143 | + .width('31lpx') | ||
| 144 | + .height('31lpx') | ||
| 145 | + .objectFit(ImageFit.Auto) | ||
| 146 | + } | ||
| 144 | 147 | ||
| 145 | Text(`${this.data.introduction}`) | 148 | Text(`${this.data.introduction}`) |
| 146 | .fontColor($r('app.color.color_B0B0B0')) | 149 | .fontColor($r('app.color.color_B0B0B0')) |
| @@ -222,6 +225,12 @@ export struct FollowChildComponent{ | @@ -222,6 +225,12 @@ export struct FollowChildComponent{ | ||
| 222 | if(value!=null){ | 225 | if(value!=null){ |
| 223 | if (value.code === 0 || value.code.toString() === "0") { | 226 | if (value.code === 0 || value.code.toString() === "0") { |
| 224 | this.data.status = this.data.status ==="0"?"1":"0" | 227 | this.data.status = this.data.status ==="0"?"1":"0" |
| 228 | + | ||
| 229 | + if(this.data.status === "1"){ | ||
| 230 | + UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+"") | ||
| 231 | + }else{ | ||
| 232 | + UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+","+this.data.creatorId) | ||
| 233 | + } | ||
| 225 | } | 234 | } |
| 226 | } | 235 | } |
| 227 | }) | 236 | }) |
| 1 | -import { LazyDataSource } from 'wdKit'; | 1 | +import { LazyDataSource, SPHelper, UserDataLocal } from 'wdKit'; |
| 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; | 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; |
| 3 | import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel'; | 3 | import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel'; |
| 4 | import { CreatorDetailRequestItem } from '../../../viewmodel/CreatorDetailRequestItem'; | 4 | import { CreatorDetailRequestItem } from '../../../viewmodel/CreatorDetailRequestItem'; |
| @@ -9,50 +9,55 @@ import { MineFollowListDetailItem } from '../../../viewmodel/MineFollowListDetai | @@ -9,50 +9,55 @@ import { MineFollowListDetailItem } from '../../../viewmodel/MineFollowListDetai | ||
| 9 | import { QueryListIsFollowedItem } from '../../../viewmodel/QueryListIsFollowedItem'; | 9 | import { QueryListIsFollowedItem } from '../../../viewmodel/QueryListIsFollowedItem'; |
| 10 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | 10 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; |
| 11 | import { FollowChildComponent } from './FollowChildComponent'; | 11 | import { FollowChildComponent } from './FollowChildComponent'; |
| 12 | +import dataPreferences from '@ohos.data.preferences'; | ||
| 12 | 13 | ||
| 13 | const TAG = "FollowListDetailUI" | 14 | const TAG = "FollowListDetailUI" |
| 15 | + | ||
| 14 | @Component | 16 | @Component |
| 15 | -export struct FollowListDetailUI{ | ||
| 16 | - @State creatorDirectoryId:number = -1; | ||
| 17 | - @State type:number = 0 | 17 | +export struct FollowListDetailUI { |
| 18 | + @State creatorDirectoryId: number = -1; | ||
| 19 | + @State type: number = 0 | ||
| 18 | @State data: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); | 20 | @State data: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); |
| 19 | - @State count:number = 0; | ||
| 20 | - @State isLoading:boolean = false | ||
| 21 | - @State hasMore:boolean = true | ||
| 22 | - curPageNum:number = 1; | 21 | + @State count: number = 0; |
| 22 | + @State isLoading: boolean = false | ||
| 23 | + @State hasMore: boolean = true | ||
| 24 | + curPageNum: number = 1; | ||
| 25 | + preferences: dataPreferences.Preferences | null = null; | ||
| 23 | 26 | ||
| 24 | - aboutToAppear(){ | 27 | + aboutToAppear() { |
| 25 | this.getNewPageData() | 28 | this.getNewPageData() |
| 29 | + this.addFollowStatusObserver() | ||
| 26 | } | 30 | } |
| 27 | 31 | ||
| 28 | - build(){ | ||
| 29 | - Column(){ | ||
| 30 | - if(this.count === 0){ | ||
| 31 | - ListHasNoMoreDataUI({style:2}) | 32 | + build() { |
| 33 | + Column() { | ||
| 34 | + if (this.count === 0) { | ||
| 35 | + ListHasNoMoreDataUI({ style: 2 }) | ||
| 32 | .height('100%') | 36 | .height('100%') |
| 33 | - }else{ | 37 | + } else { |
| 34 | List({ space: 3 }) { | 38 | List({ space: 3 }) { |
| 35 | LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => { | 39 | LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => { |
| 36 | ListItem() { | 40 | ListItem() { |
| 37 | - FollowChildComponent({data: item,type:this.type}) | 41 | + FollowChildComponent({ data: item, type: this.type }) |
| 38 | } | 42 | } |
| 39 | .onClick(() => { | 43 | .onClick(() => { |
| 40 | }) | 44 | }) |
| 41 | - }, (item: FollowListDetailItem, index: number) => index.toString()) | 45 | + }, (item: FollowListDetailItem) => item.creatorId) |
| 42 | 46 | ||
| 43 | //没有更多数据 显示提示 | 47 | //没有更多数据 显示提示 |
| 44 | - if(!this.hasMore){ | ||
| 45 | - ListItem(){ | 48 | + if (!this.hasMore) { |
| 49 | + ListItem() { | ||
| 46 | ListHasNoMoreDataUI() | 50 | ListHasNoMoreDataUI() |
| 47 | } | 51 | } |
| 48 | } | 52 | } |
| 49 | - }.cachedCount(10) | ||
| 50 | - .padding({left:'31lpx',right:'31lpx'}) | 53 | + } |
| 54 | + .cachedCount(10) | ||
| 55 | + .padding({ left: '31lpx', right: '31lpx' }) | ||
| 51 | .layoutWeight(1) | 56 | .layoutWeight(1) |
| 52 | .scrollBar(BarState.Off) | 57 | .scrollBar(BarState.Off) |
| 53 | - .onReachEnd(()=>{ | ||
| 54 | - console.log(TAG,"触底了"); | ||
| 55 | - if(!this.isLoading){ | 58 | + .onReachEnd(() => { |
| 59 | + console.log(TAG, "触底了"); | ||
| 60 | + if (!this.isLoading) { | ||
| 56 | this.isLoading = true | 61 | this.isLoading = true |
| 57 | //加载分页数据 | 62 | //加载分页数据 |
| 58 | this.getNewPageData() | 63 | this.getNewPageData() |
| @@ -63,79 +68,128 @@ export struct FollowListDetailUI{ | @@ -63,79 +68,128 @@ export struct FollowListDetailUI{ | ||
| 63 | .width('100%') | 68 | .width('100%') |
| 64 | } | 69 | } |
| 65 | 70 | ||
| 66 | - getNewPageData(){ | ||
| 67 | - this.isLoading = true | ||
| 68 | - //我的关注列表 | ||
| 69 | - if (this.creatorDirectoryId === -1){ | ||
| 70 | - if(this.hasMore){ | ||
| 71 | - let object = new FollowListDetailRequestItem(-1,20,this.curPageNum) | ||
| 72 | - | ||
| 73 | - MinePageDatasModel.getMineFollowListData(object,getContext(this)).then((value)=>{ | ||
| 74 | - if (!this.data || value.list.length == 0){ | ||
| 75 | - this.hasMore = false | 71 | + async addFollowStatusObserver() { |
| 72 | + this.preferences = await SPHelper.default.getPreferences(); | ||
| 73 | + let observer = (key: string) => { | ||
| 74 | + if (key == UserDataLocal.USER_FOLLOW_OPERATION) { | ||
| 75 | + if (this.creatorDirectoryId === -1) { | ||
| 76 | + let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION,"") as string | ||
| 77 | + let arr = value.split(',') | ||
| 78 | + if(arr!=null && arr.length === 2){ | ||
| 79 | + this.data.getDataArray().forEach((element,index) => { | ||
| 80 | + if (element.creatorId === arr[1]) { | ||
| 81 | + this.data.deleteItem(index) | ||
| 82 | + } | ||
| 83 | + }); | ||
| 76 | }else{ | 84 | }else{ |
| 77 | - value.list.forEach((value)=>{ | ||
| 78 | - this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId,value.mainControl,value.banControl)) | ||
| 79 | - }) | ||
| 80 | - this.data.notifyDataReload() | ||
| 81 | - this.count = this.data.totalCount() | ||
| 82 | - if (this.data.totalCount() < value.totalCount) { | ||
| 83 | - this.curPageNum++ | ||
| 84 | - }else { | ||
| 85 | - this.hasMore = false | 85 | + if(!this.isLoading){ |
| 86 | + this.isLoading = true | ||
| 87 | + this.hasMore = true | ||
| 88 | + this.curPageNum = 1 | ||
| 89 | + this.data.clear() | ||
| 90 | + this.data.notifyDataReload() | ||
| 91 | + this.getMyFollowListDetail() | ||
| 86 | } | 92 | } |
| 87 | } | 93 | } |
| 88 | - this.isLoading = false | ||
| 89 | - }).catch((err:Error)=>{ | ||
| 90 | - console.log(TAG,"请求失败") | ||
| 91 | - this.isLoading = false | ||
| 92 | - }) | 94 | + } |
| 93 | } | 95 | } |
| 94 | - }else{ | ||
| 95 | - if(this.hasMore){ | ||
| 96 | - let object = new FollowListDetailRequestItem(this.creatorDirectoryId,20,this.curPageNum) | 96 | + } |
| 97 | + this.preferences.on('change', observer); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + getMyFollowListDetail() { | ||
| 101 | + if (this.hasMore) { | ||
| 102 | + let object = new FollowListDetailRequestItem(-1, 20, this.curPageNum) | ||
| 97 | 103 | ||
| 98 | - MinePageDatasModel.getFollowListDetailData(object,getContext(this)).then((value)=>{ | ||
| 99 | - if (!this.data || value.list.length == 0){ | 104 | + MinePageDatasModel.getMineFollowListData(object, getContext(this)).then((value) => { |
| 105 | + if (!this.data || value.list.length == 0) { | ||
| 106 | + this.hasMore = false | ||
| 107 | + this.isLoading = false | ||
| 108 | + } else { | ||
| 109 | + value.list.forEach((value) => { | ||
| 110 | + let fansNum:number = value.fansNum | ||
| 111 | + let fansNumString = "" | ||
| 112 | + if (fansNum > 10000) { | ||
| 113 | + let temp = (fansNum / 10000) + "" | ||
| 114 | + let index = temp.indexOf('.') | ||
| 115 | + if (index != -1) { | ||
| 116 | + temp = temp.substring(0, index + 2) | ||
| 117 | + } else { | ||
| 118 | + temp = temp | ||
| 119 | + } | ||
| 120 | + fansNumString = temp + "万" | ||
| 121 | + } else { | ||
| 122 | + fansNumString = fansNum + "" | ||
| 123 | + } | ||
| 124 | + this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl, value.attentionUserName, fansNumString, value.introduction, value.attentionCreatorId, "1", value.attentionUserId, value.attentionUserType, value.attentionUserId, value.mainControl, value.banControl)) | ||
| 125 | + }) | ||
| 126 | + this.data.notifyDataReload() | ||
| 127 | + this.count = this.data.totalCount() | ||
| 128 | + if (this.data.totalCount() < value.totalCount) { | ||
| 129 | + this.curPageNum++ | ||
| 130 | + } else { | ||
| 131 | + this.hasMore = false | ||
| 132 | + } | ||
| 133 | + } | ||
| 134 | + this.isLoading = false | ||
| 135 | + }).catch((err: Error) => { | ||
| 136 | + console.log(TAG, "请求失败") | ||
| 137 | + this.isLoading = false | ||
| 138 | + }) | ||
| 139 | + }else { | ||
| 140 | + this.isLoading = false | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + getNewPageData() { | ||
| 145 | + //我的关注列表 | ||
| 146 | + if (this.creatorDirectoryId === -1) { | ||
| 147 | + this.getMyFollowListDetail() | ||
| 148 | + } else { | ||
| 149 | + if (this.hasMore) { | ||
| 150 | + let object = new FollowListDetailRequestItem(this.creatorDirectoryId, 20, this.curPageNum) | ||
| 151 | + | ||
| 152 | + MinePageDatasModel.getFollowListDetailData(object, getContext(this)).then((value) => { | ||
| 153 | + if (!this.data || value.list.length == 0) { | ||
| 100 | this.hasMore = false | 154 | this.hasMore = false |
| 101 | this.isLoading = false | 155 | this.isLoading = false |
| 102 | - }else{ | 156 | + } else { |
| 103 | this.getFollowListStatus(value) | 157 | this.getFollowListStatus(value) |
| 104 | } | 158 | } |
| 105 | - }).catch((err:Error)=>{ | ||
| 106 | - console.log(TAG,"请求失败") | 159 | + }).catch((err: Error) => { |
| 160 | + console.log(TAG, "请求失败") | ||
| 107 | this.isLoading = false | 161 | this.isLoading = false |
| 108 | }) | 162 | }) |
| 109 | } | 163 | } |
| 110 | } | 164 | } |
| 111 | } | 165 | } |
| 112 | 166 | ||
| 113 | - getFollowListStatus(result:MineFollowListDetailItem){ | ||
| 114 | - let data_temp : FollowListDetailItem[] = [] | ||
| 115 | - result.list.forEach((item)=>{ | ||
| 116 | - data_temp.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,"0",item.attentionUserId,item.cnUserType,item.cnUserId,item.cnMainControl,-1)) | 167 | + getFollowListStatus(result: MineFollowListDetailItem) { |
| 168 | + let data_temp: FollowListDetailItem[] = [] | ||
| 169 | + result.list.forEach((item) => { | ||
| 170 | + data_temp.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, item.introduction, item.creatorId, "0", item.attentionUserId, item.cnUserType, item.cnUserId, item.cnMainControl, -1)) | ||
| 117 | }) | 171 | }) |
| 118 | let request = new CreatorDetailRequestItem() | 172 | let request = new CreatorDetailRequestItem() |
| 119 | 173 | ||
| 120 | - data_temp.forEach((data)=>{ | 174 | + data_temp.forEach((data) => { |
| 121 | request.creatorIdList.push(data.creatorId) | 175 | request.creatorIdList.push(data.creatorId) |
| 122 | }) | 176 | }) |
| 123 | - SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{ | ||
| 124 | - if(value!=null && value.length>0){ | ||
| 125 | - data_temp.forEach((data)=>{ | ||
| 126 | - value.forEach((item)=>{ | ||
| 127 | - if(data.creatorId == item.creatorId){ | 177 | + SearcherAboutDataModel.getCreatorDetailListData(request).then((value) => { |
| 178 | + if (value != null && value.length > 0) { | ||
| 179 | + data_temp.forEach((data) => { | ||
| 180 | + value.forEach((item) => { | ||
| 181 | + if (data.creatorId == item.creatorId) { | ||
| 128 | data.headPhotoUrl = item.headPhotoUrl | 182 | data.headPhotoUrl = item.headPhotoUrl |
| 129 | - if(item.fansNum>10000){ | ||
| 130 | - let temp = (item.fansNum/10000)+"" | 183 | + if (item.fansNum > 10000) { |
| 184 | + let temp = (item.fansNum / 10000) + "" | ||
| 131 | let index = temp.indexOf('.') | 185 | let index = temp.indexOf('.') |
| 132 | - if(index != -1){ | ||
| 133 | - temp = temp.substring(0,index+2) | ||
| 134 | - }else{ | 186 | + if (index != -1) { |
| 187 | + temp = temp.substring(0, index + 2) | ||
| 188 | + } else { | ||
| 135 | temp = temp | 189 | temp = temp |
| 136 | } | 190 | } |
| 137 | data.cnFansNum = temp + "万" | 191 | data.cnFansNum = temp + "万" |
| 138 | - }else{ | 192 | + } else { |
| 139 | data.cnFansNum = item.fansNum + "" | 193 | data.cnFansNum = item.fansNum + "" |
| 140 | } | 194 | } |
| 141 | data.introduction = item.introduction | 195 | data.introduction = item.introduction |
| @@ -144,32 +198,32 @@ export struct FollowListDetailUI{ | @@ -144,32 +198,32 @@ export struct FollowListDetailUI{ | ||
| 144 | } | 198 | } |
| 145 | }) | 199 | }) |
| 146 | }) | 200 | }) |
| 147 | - this.getFollowStatus(data_temp,result.totalCount) | 201 | + this.getFollowStatus(data_temp, result.totalCount) |
| 148 | } | 202 | } |
| 149 | - }).catch((err:Error)=>{ | ||
| 150 | - console.log(TAG,JSON.stringify(err)) | 203 | + }).catch((err: Error) => { |
| 204 | + console.log(TAG, JSON.stringify(err)) | ||
| 151 | this.isLoading = false | 205 | this.isLoading = false |
| 152 | - this.count = this.count===-1?0:this.count | 206 | + this.count = this.count === -1 ? 0 : this.count |
| 153 | }) | 207 | }) |
| 154 | } | 208 | } |
| 155 | 209 | ||
| 156 | - getFollowStatus(result : FollowListDetailItem[],totalCount:number){ | 210 | + getFollowStatus(result: FollowListDetailItem[], totalCount: number) { |
| 157 | let status = new FollowListStatusRequestItem() | 211 | let status = new FollowListStatusRequestItem() |
| 158 | - result.forEach((item)=>{ | 212 | + result.forEach((item) => { |
| 159 | status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId)) | 213 | status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId)) |
| 160 | }) | 214 | }) |
| 161 | 215 | ||
| 162 | - MinePageDatasModel.getFollowListStatusData(status,getContext(this)).then((newValue)=>{ | ||
| 163 | - newValue.forEach((item)=>{ | ||
| 164 | - result.forEach((list)=>{ | 216 | + MinePageDatasModel.getFollowListStatusData(status, getContext(this)).then((newValue) => { |
| 217 | + newValue.forEach((item) => { | ||
| 218 | + result.forEach((list) => { | ||
| 165 | if (item.creatorId == list.creatorId) { | 219 | if (item.creatorId == list.creatorId) { |
| 166 | list.status = item.status | 220 | list.status = item.status |
| 167 | } | 221 | } |
| 168 | }) | 222 | }) |
| 169 | }) | 223 | }) |
| 170 | 224 | ||
| 171 | - result.forEach((item)=>{ | ||
| 172 | - this.data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,item.status,item.attentionUserId,item.cnUserType,item.cnUserId,item.mainControl,item.banControl)) | 225 | + result.forEach((item) => { |
| 226 | + this.data.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, item.introduction, item.creatorId, item.status, item.attentionUserId, item.cnUserType, item.cnUserId, item.mainControl, item.banControl)) | ||
| 173 | }) | 227 | }) |
| 174 | 228 | ||
| 175 | this.data.notifyDataReload() | 229 | this.data.notifyDataReload() |
| @@ -177,15 +231,14 @@ export struct FollowListDetailUI{ | @@ -177,15 +231,14 @@ export struct FollowListDetailUI{ | ||
| 177 | this.count = this.data.totalCount() | 231 | this.count = this.data.totalCount() |
| 178 | if (this.data.totalCount() < totalCount) { | 232 | if (this.data.totalCount() < totalCount) { |
| 179 | this.curPageNum++ | 233 | this.curPageNum++ |
| 180 | - }else { | 234 | + } else { |
| 181 | this.hasMore = false | 235 | this.hasMore = false |
| 182 | } | 236 | } |
| 183 | 237 | ||
| 184 | this.isLoading = false | 238 | this.isLoading = false |
| 185 | - }).catch((err:Error)=>{ | ||
| 186 | - console.log(TAG,"请求失败") | 239 | + }).catch((err: Error) => { |
| 240 | + console.log(TAG, "请求失败") | ||
| 187 | this.isLoading = false | 241 | this.isLoading = false |
| 188 | }) | 242 | }) |
| 189 | } | 243 | } |
| 190 | - | ||
| 191 | } | 244 | } |
| 1 | -import { Params } from 'wdBean'; | ||
| 2 | -import { DateTimeUtils, LazyDataSource,UserDataLocal } from 'wdKit'; | ||
| 3 | -import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 1 | +import { ContentDTO, Params } from 'wdBean'; |
| 2 | +import { DateTimeUtils, LazyDataSource, SPHelper,UserDataLocal } from 'wdKit'; | ||
| 3 | +import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter'; | ||
| 4 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; | 4 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; |
| 5 | import { CommentListItem } from '../../../viewmodel/CommentListItem'; | 5 | import { CommentListItem } from '../../../viewmodel/CommentListItem'; |
| 6 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; | 6 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; |
| 7 | import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem'; | 7 | import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem'; |
| 8 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | 8 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; |
| 9 | import { FollowChildComponent } from '../follow/FollowChildComponent'; | 9 | import { FollowChildComponent } from '../follow/FollowChildComponent'; |
| 10 | +import dataPreferences from '@ohos.data.preferences'; | ||
| 10 | 11 | ||
| 11 | const TAG = "HomePageBottomComponent" | 12 | const TAG = "HomePageBottomComponent" |
| 12 | @Component | 13 | @Component |
| @@ -21,9 +22,38 @@ export struct HomePageBottomComponent{ | @@ -21,9 +22,38 @@ export struct HomePageBottomComponent{ | ||
| 21 | @State isMineAccount:boolean = true; | 22 | @State isMineAccount:boolean = true; |
| 22 | @State userId:string = ""; | 23 | @State userId:string = ""; |
| 23 | @Link commentNum:number | 24 | @Link commentNum:number |
| 25 | + preferences: dataPreferences.Preferences | null = null; | ||
| 24 | 26 | ||
| 25 | aboutToAppear(){ | 27 | aboutToAppear(){ |
| 26 | this.getNewPageData() | 28 | this.getNewPageData() |
| 29 | + this.addFollowStatusObserver() | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + async addFollowStatusObserver() { | ||
| 33 | + this.preferences = await SPHelper.default.getPreferences(); | ||
| 34 | + let observer = (key: string) => { | ||
| 35 | + if (key == UserDataLocal.USER_FOLLOW_OPERATION) { | ||
| 36 | + let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION,"") as string | ||
| 37 | + let arr = value.split(',') | ||
| 38 | + if(arr!=null && arr.length === 2){ | ||
| 39 | + this.data_follow.getDataArray().forEach((element,index) => { | ||
| 40 | + if (element.creatorId === arr[1]) { | ||
| 41 | + this.data_follow.deleteItem(index) | ||
| 42 | + } | ||
| 43 | + }); | ||
| 44 | + }else{ | ||
| 45 | + if(!this.isLoading){ | ||
| 46 | + this.isLoading = true | ||
| 47 | + this.hasMore = true | ||
| 48 | + this.curPageNum = 1 | ||
| 49 | + this.data_follow.clear() | ||
| 50 | + this.data_follow.notifyDataReload() | ||
| 51 | + this.getMyFollowListDetail() | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + this.preferences.on('change', observer); | ||
| 27 | } | 57 | } |
| 28 | 58 | ||
| 29 | build(){ | 59 | build(){ |
| @@ -175,34 +205,55 @@ export struct HomePageBottomComponent{ | @@ -175,34 +205,55 @@ export struct HomePageBottomComponent{ | ||
| 175 | .borderRadius(12) | 205 | .borderRadius(12) |
| 176 | } | 206 | } |
| 177 | 207 | ||
| 208 | + | ||
| 209 | + getMyFollowListDetail(){ | ||
| 210 | + if(this.hasMore){ | ||
| 211 | + let object = new FollowListDetailRequestItem(-1,20,this.curPageNum) | ||
| 212 | + | ||
| 213 | + MinePageDatasModel.getMineFollowListData(object,getContext(this)).then((value)=>{ | ||
| 214 | + if (!this.data_follow || value.list.length == 0){ | ||
| 215 | + this.hasMore = false | ||
| 216 | + }else{ | ||
| 217 | + value.list.forEach((value)=>{ | ||
| 218 | + let fansNum:number = value.fansNum | ||
| 219 | + let fansNumString = "" | ||
| 220 | + if (fansNum > 10000) { | ||
| 221 | + let temp = (fansNum / 10000) + "" | ||
| 222 | + let index = temp.indexOf('.') | ||
| 223 | + if (index != -1) { | ||
| 224 | + temp = temp.substring(0, index + 2) | ||
| 225 | + } else { | ||
| 226 | + temp = temp | ||
| 227 | + } | ||
| 228 | + fansNumString = temp + "万" | ||
| 229 | + } else { | ||
| 230 | + fansNumString = fansNum + "" | ||
| 231 | + } | ||
| 232 | + this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,fansNumString,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId,value.mainControl,value.banControl)) | ||
| 233 | + }) | ||
| 234 | + this.data_follow.notifyDataReload() | ||
| 235 | + this.count = this.data_follow.totalCount() | ||
| 236 | + if (this.data_follow.totalCount() < value.totalCount) { | ||
| 237 | + this.curPageNum++ | ||
| 238 | + }else { | ||
| 239 | + this.hasMore = false | ||
| 240 | + } | ||
| 241 | + } | ||
| 242 | + this.isLoading = false | ||
| 243 | + }).catch((err:Error)=>{ | ||
| 244 | + console.log(TAG,"请求失败") | ||
| 245 | + this.isLoading = false | ||
| 246 | + }) | ||
| 247 | + }else{ | ||
| 248 | + this.isLoading = false | ||
| 249 | + } | ||
| 250 | + } | ||
| 251 | + | ||
| 178 | getNewPageData(){ | 252 | getNewPageData(){ |
| 179 | this.isLoading = true | 253 | this.isLoading = true |
| 180 | //我的关注列表 | 254 | //我的关注列表 |
| 181 | if (this.style === 1){ | 255 | if (this.style === 1){ |
| 182 | - if(this.hasMore){ | ||
| 183 | - let object = new FollowListDetailRequestItem(-1,20,this.curPageNum) | ||
| 184 | - | ||
| 185 | - MinePageDatasModel.getMineFollowListData(object,getContext(this)).then((value)=>{ | ||
| 186 | - if (!this.data_follow || value.list.length == 0){ | ||
| 187 | - this.hasMore = false | ||
| 188 | - }else{ | ||
| 189 | - value.list.forEach((value)=>{ | ||
| 190 | - this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId,value.mainControl,value.banControl)) | ||
| 191 | - }) | ||
| 192 | - this.data_follow.notifyDataReload() | ||
| 193 | - this.count = this.data_follow.totalCount() | ||
| 194 | - if (this.data_follow.totalCount() < value.totalCount) { | ||
| 195 | - this.curPageNum++ | ||
| 196 | - }else { | ||
| 197 | - this.hasMore = false | ||
| 198 | - } | ||
| 199 | - } | ||
| 200 | - this.isLoading = false | ||
| 201 | - }).catch((err:Error)=>{ | ||
| 202 | - console.log(TAG,"请求失败") | ||
| 203 | - this.isLoading = false | ||
| 204 | - }) | ||
| 205 | - } | 256 | + this.getMyFollowListDetail() |
| 206 | }else if(this.style === 0){ | 257 | }else if(this.style === 0){ |
| 207 | if(this.hasMore){ | 258 | if(this.hasMore){ |
| 208 | let time = encodeURI(DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) | 259 | let time = encodeURI(DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) |
| @@ -214,7 +265,7 @@ export struct HomePageBottomComponent{ | @@ -214,7 +265,7 @@ export struct HomePageBottomComponent{ | ||
| 214 | }else{ | 265 | }else{ |
| 215 | value.list.forEach((value)=>{ | 266 | value.list.forEach((value)=>{ |
| 216 | let publishTime = DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(value.createTime,DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) | 267 | let publishTime = DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(value.createTime,DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) |
| 217 | - this.data_comment.push(new CommentListItem(value.fromUserHeader,value.fromUserName,value.targetTitle,publishTime,value.commentContent,value.likeNum,0,value.id,value.targetId,value.targetType)) | 268 | + this.data_comment.push(new CommentListItem(value.fromUserHeader,value.fromUserName,value.targetTitle,publishTime,value.commentContent,value.likeNum,0,value.id,value.targetId,value.targetType,value.targetRelId,value.targetRelObjectId,value.targetRelType,value.targetStatus)) |
| 218 | }) | 269 | }) |
| 219 | this.data_comment.notifyDataReload() | 270 | this.data_comment.notifyDataReload() |
| 220 | this.count = this.data_comment.totalCount() | 271 | this.count = this.data_comment.totalCount() |
| @@ -230,6 +281,8 @@ export struct HomePageBottomComponent{ | @@ -230,6 +281,8 @@ export struct HomePageBottomComponent{ | ||
| 230 | console.log(TAG,"请求失败") | 281 | console.log(TAG,"请求失败") |
| 231 | this.isLoading = false | 282 | this.isLoading = false |
| 232 | }) | 283 | }) |
| 284 | + }else{ | ||
| 285 | + this.isLoading = false | ||
| 233 | } | 286 | } |
| 234 | } | 287 | } |
| 235 | } | 288 | } |
| @@ -312,6 +365,14 @@ struct ChildCommentComponent { | @@ -312,6 +365,14 @@ struct ChildCommentComponent { | ||
| 312 | .width('662lpx') | 365 | .width('662lpx') |
| 313 | .backgroundColor($r('app.color.color_F5F5F5')) | 366 | .backgroundColor($r('app.color.color_F5F5F5')) |
| 314 | .margin({top:'19lpx',bottom:'31lpx'}) | 367 | .margin({top:'19lpx',bottom:'31lpx'}) |
| 368 | + .onClick(()=>{ | ||
| 369 | + ProcessUtils.processPage( | ||
| 370 | + {objectId: this.data.targetId, | ||
| 371 | + relType:this.data.targetRelType+"", | ||
| 372 | + relId:this.data.targetRelId, | ||
| 373 | + objectType:this.data.targetType+"", | ||
| 374 | + } as ContentDTO ) | ||
| 375 | + }) | ||
| 315 | 376 | ||
| 316 | if(!this.isLastItem){ | 377 | if(!this.isLastItem){ |
| 317 | Divider().width('100%') | 378 | Divider().width('100%') |
| @@ -6,6 +6,8 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | @@ -6,6 +6,8 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | ||
| 6 | import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem'; | 6 | import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem'; |
| 7 | import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; | 7 | import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; |
| 8 | import { CommentLikeOperationRequestItem } from '../../../viewmodel/CommentLikeOperationRequestItem'; | 8 | import { CommentLikeOperationRequestItem } from '../../../viewmodel/CommentLikeOperationRequestItem'; |
| 9 | +import { ProcessUtils } from 'wdRouter/Index'; | ||
| 10 | +import { ContentDTO } from 'wdBean/Index'; | ||
| 9 | 11 | ||
| 10 | const TAG = "HomePageBottomComponent" | 12 | const TAG = "HomePageBottomComponent" |
| 11 | @Component | 13 | @Component |
| @@ -107,7 +109,7 @@ export struct OtherHomePageBottomCommentComponent{ | @@ -107,7 +109,7 @@ export struct OtherHomePageBottomCommentComponent{ | ||
| 107 | let data : CommentListItem[] = [] | 109 | let data : CommentListItem[] = [] |
| 108 | value.list.forEach((item)=>{ | 110 | value.list.forEach((item)=>{ |
| 109 | status.commentIdList.push(item.id) | 111 | status.commentIdList.push(item.id) |
| 110 | - data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,0,item.id,item.targetId,item.targetType)) | 112 | + data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,0,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus)) |
| 111 | }) | 113 | }) |
| 112 | 114 | ||
| 113 | MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{ | 115 | MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{ |
| @@ -120,7 +122,7 @@ export struct OtherHomePageBottomCommentComponent{ | @@ -120,7 +122,7 @@ export struct OtherHomePageBottomCommentComponent{ | ||
| 120 | }) | 122 | }) |
| 121 | 123 | ||
| 122 | data.forEach((item)=>{ | 124 | data.forEach((item)=>{ |
| 123 | - this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,item.like_status,item.id,item.targetId,item.targetType)) | 125 | + this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,item.like_status,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus)) |
| 124 | }) | 126 | }) |
| 125 | 127 | ||
| 126 | this.data_comment.notifyDataReload() | 128 | this.data_comment.notifyDataReload() |
| @@ -237,6 +239,14 @@ struct ChildCommentComponent { | @@ -237,6 +239,14 @@ struct ChildCommentComponent { | ||
| 237 | .width('662lpx') | 239 | .width('662lpx') |
| 238 | .backgroundColor($r('app.color.color_F5F5F5')) | 240 | .backgroundColor($r('app.color.color_F5F5F5')) |
| 239 | .margin({top:'19lpx',bottom:'31lpx'}) | 241 | .margin({top:'19lpx',bottom:'31lpx'}) |
| 242 | + .onClick(()=>{ | ||
| 243 | + ProcessUtils.processPage( | ||
| 244 | + {objectId: this.data.targetId, | ||
| 245 | + relType:this.data.targetRelType+"", | ||
| 246 | + relId:this.data.targetRelId, | ||
| 247 | + objectType:this.data.targetType+"", | ||
| 248 | + } as ContentDTO ) | ||
| 249 | + }) | ||
| 240 | 250 | ||
| 241 | if(!this.isLastItem){ | 251 | if(!this.isLastItem){ |
| 242 | Divider().width('100%') | 252 | Divider().width('100%') |
| @@ -67,10 +67,10 @@ export struct BottomNavigationComponent { | @@ -67,10 +67,10 @@ export struct BottomNavigationComponent { | ||
| 67 | TopNavigationComponent({ | 67 | TopNavigationComponent({ |
| 68 | groupId: navItem.id, | 68 | groupId: navItem.id, |
| 69 | topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), | 69 | topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), |
| 70 | - _currentNavIndex: this.currentNavIndex, | ||
| 71 | - changeBarBackgroundColor: (color: Color) => { | ||
| 72 | - this.barBackgroundColor = color | ||
| 73 | - } | 70 | + _currentNavIndex: $currentNavIndex, |
| 71 | + currentBottomNavName: navItem.name, | ||
| 72 | + barBackgroundColor: $barBackgroundColor | ||
| 73 | + | ||
| 74 | }) | 74 | }) |
| 75 | } | 75 | } |
| 76 | 76 | ||
| @@ -80,6 +80,7 @@ export struct BottomNavigationComponent { | @@ -80,6 +80,7 @@ export struct BottomNavigationComponent { | ||
| 80 | }); | 80 | }); |
| 81 | 81 | ||
| 82 | } | 82 | } |
| 83 | + .animationDuration(0) | ||
| 83 | .barHeight($r('app.float.bottom_navigation_barHeight')) | 84 | .barHeight($r('app.float.bottom_navigation_barHeight')) |
| 84 | .barMode(BarMode.Fixed) | 85 | .barMode(BarMode.Fixed) |
| 85 | // TODO:更详细的判断是视频频道 | 86 | // TODO:更详细的判断是视频频道 |
| @@ -90,7 +91,9 @@ export struct BottomNavigationComponent { | @@ -90,7 +91,9 @@ export struct BottomNavigationComponent { | ||
| 90 | // this.onBottomNavigationIndexChange() | 91 | // this.onBottomNavigationIndexChange() |
| 91 | }) | 92 | }) |
| 92 | .backgroundColor(this.barBackgroundColor) | 93 | .backgroundColor(this.barBackgroundColor) |
| 93 | - .padding({ bottom: this.bottomRectHeight + 'px', top: this.topRectHeight + 'px' }) // 此处margin具体数值在实际中应与导航条区域高度保持一致 | 94 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) |
| 95 | + | ||
| 96 | + // .padding({ bottom: this.bottomRectHeight + 'px', top: this.topRectHeight + 'px' }) // 此处margin具体数值在实际中应与导航条区域高度保持一致 | ||
| 94 | 97 | ||
| 95 | } | 98 | } |
| 96 | 99 |
| @@ -3,7 +3,7 @@ import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant'; | @@ -3,7 +3,7 @@ import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant'; | ||
| 3 | import { Logger } from 'wdKit'; | 3 | import { Logger } from 'wdKit'; |
| 4 | import { CompUtils } from '../../utils/CompUtils'; | 4 | import { CompUtils } from '../../utils/CompUtils'; |
| 5 | import { WDRouterRule } from 'wdRouter'; | 5 | import { WDRouterRule } from 'wdRouter'; |
| 6 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 6 | +import { ProcessUtils } from 'wdRouter'; |
| 7 | 7 | ||
| 8 | const TAG: string = 'CardView'; | 8 | const TAG: string = 'CardView'; |
| 9 | 9 |
| @@ -298,47 +298,55 @@ struct ChannelDialog { | @@ -298,47 +298,55 @@ struct ChannelDialog { | ||
| 298 | .zIndex(this.dragItem == item.num ? 1 : 0) | 298 | .zIndex(this.dragItem == item.num ? 1 : 0) |
| 299 | .translate(this.dragItem == item.num ? { x: this.offsetX, y: this.offsetY } : { x: 0, y: 0 }) | 299 | .translate(this.dragItem == item.num ? { x: this.offsetX, y: this.offsetY } : { x: 0, y: 0 }) |
| 300 | .gesture( | 300 | .gesture( |
| 301 | - GestureGroup(GestureMode.Parallel, | ||
| 302 | - TapGesture() | ||
| 303 | - .onAction((event?: GestureEvent) => { | ||
| 304 | - if (this.isEditIng) { | ||
| 305 | - if (item.delPermitted === 1) { | ||
| 306 | - this.delChannelItem(index) | ||
| 307 | - } | ||
| 308 | - } else { | ||
| 309 | - this.confirm(index) | ||
| 310 | - this.controller?.close() | 301 | + GestureGroup(GestureMode.Parallel, |
| 302 | + TapGesture() | ||
| 303 | + .onAction((event?: GestureEvent) => { | ||
| 304 | + if (this.isEditIng) { | ||
| 305 | + if (item.delPermitted === 1) { | ||
| 306 | + this.delChannelItem(index) | ||
| 311 | } | 307 | } |
| 312 | - }), | ||
| 313 | - PanGesture({ fingers: 1, direction: null, distance: 0 }) | ||
| 314 | - .onActionStart((event: GestureEvent) => { | ||
| 315 | - this.dragItem = item.num | 308 | + } else { |
| 309 | + this.confirm(index) | ||
| 310 | + this.controller?.close() | ||
| 311 | + } | ||
| 312 | + }), | ||
| 313 | + LongPressGesture({ repeat: true }) | ||
| 314 | + .onAction((event: GestureEvent | undefined) => { | ||
| 315 | + if (event) { | ||
| 316 | + if (event.repeat && this.isEditIng === false) { | ||
| 317 | + this.isEditIng = true; | ||
| 318 | + } | ||
| 319 | + } | ||
| 320 | + }), | ||
| 321 | + PanGesture({ fingers: 1, direction: null, distance: 0 }) | ||
| 322 | + .onActionStart((event: GestureEvent) => { | ||
| 323 | + this.dragItem = item.num | ||
| 324 | + this.dragRefOffsetX = 0 | ||
| 325 | + this.dragRefOffsetY = 0 | ||
| 326 | + }) | ||
| 327 | + .onActionUpdate((event: GestureEvent) => { | ||
| 328 | + animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => { | ||
| 329 | + this.handleAnimationTo(item, event) | ||
| 330 | + }) | ||
| 331 | + }) | ||
| 332 | + .onActionEnd((event: GestureEvent) => { | ||
| 333 | + animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => { | ||
| 334 | + this.dragItem = -1 | ||
| 335 | + this.offsetX = 0 | ||
| 336 | + this.offsetY = 0 | ||
| 316 | this.dragRefOffsetX = 0 | 337 | this.dragRefOffsetX = 0 |
| 317 | this.dragRefOffsetY = 0 | 338 | this.dragRefOffsetY = 0 |
| 318 | }) | 339 | }) |
| 319 | - .onActionUpdate((event: GestureEvent) => { | ||
| 320 | - animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => { | ||
| 321 | - this.handleAnimationTo(item, event) | ||
| 322 | - }) | ||
| 323 | - }) | ||
| 324 | - .onActionEnd((event: GestureEvent) => { | ||
| 325 | - animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => { | ||
| 326 | - this.dragItem = -1 | ||
| 327 | - this.offsetX = 0 | ||
| 328 | - this.offsetY = 0 | ||
| 329 | - this.dragRefOffsetX = 0 | ||
| 330 | - this.dragRefOffsetY = 0 | ||
| 331 | - }) | ||
| 332 | - }) | ||
| 333 | - ).onCancel(() => { | ||
| 334 | - animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => { | ||
| 335 | - this.dragItem = -1 | ||
| 336 | - this.offsetX = 0 | ||
| 337 | - this.offsetY = 0 | ||
| 338 | - this.dragRefOffsetX = 0 | ||
| 339 | - this.dragRefOffsetY = 0 | ||
| 340 | }) | 340 | }) |
| 341 | + ).onCancel(() => { | ||
| 342 | + animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => { | ||
| 343 | + this.dragItem = -1 | ||
| 344 | + this.offsetX = 0 | ||
| 345 | + this.offsetY = 0 | ||
| 346 | + this.dragRefOffsetX = 0 | ||
| 347 | + this.dragRefOffsetY = 0 | ||
| 341 | }) | 348 | }) |
| 349 | + }) | ||
| 342 | ) | 350 | ) |
| 343 | }, (item: TopNavDTO) => JSON.stringify(item)) | 351 | }, (item: TopNavDTO) => JSON.stringify(item)) |
| 344 | } | 352 | } |
| @@ -156,22 +156,23 @@ struct EditUserInfoPage { | @@ -156,22 +156,23 @@ struct EditUserInfoPage { | ||
| 156 | 156 | ||
| 157 | if (userName) { | 157 | if (userName) { |
| 158 | if (userName != this.currentUserInfo.userName) { | 158 | if (userName != this.currentUserInfo.userName) { |
| 159 | - this.currentUserInfo.userName = userName; | ||
| 160 | - this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_nickname | ||
| 161 | - this.updateEditModel() | 159 | + // this.currentUserInfo.userName = userName; |
| 160 | + // this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_nickname | ||
| 161 | + // this.updateEditModel() | ||
| 162 | + this.getAccountOwnerInfo() | ||
| 162 | } | 163 | } |
| 163 | } else if (introduction){ | 164 | } else if (introduction){ |
| 164 | if (introduction != this.currentUserInfo.userExtend.introduction ) { | 165 | if (introduction != this.currentUserInfo.userExtend.introduction ) { |
| 165 | - this.currentUserInfo.userExtend.introduction = introduction; | ||
| 166 | - this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_intro | ||
| 167 | - this.updateEditModel() | 166 | + // this.currentUserInfo.userExtend.introduction = introduction; |
| 167 | + // this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_intro | ||
| 168 | + // this.updateEditModel() | ||
| 169 | + this.getAccountOwnerInfo() | ||
| 168 | } | 170 | } |
| 169 | } | 171 | } |
| 170 | } | 172 | } |
| 171 | } | 173 | } |
| 172 | 174 | ||
| 173 | updateEditModel(){ | 175 | updateEditModel(){ |
| 174 | - this.listData = [] | ||
| 175 | // this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo)) | 176 | // this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo)) |
| 176 | EditInfoViewModel.updateUserInfo(this.currentUserInfo).then(()=>{ | 177 | EditInfoViewModel.updateUserInfo(this.currentUserInfo).then(()=>{ |
| 177 | this.getAccountOwnerInfo() | 178 | this.getAccountOwnerInfo() |
| @@ -179,6 +180,7 @@ struct EditUserInfoPage { | @@ -179,6 +180,7 @@ struct EditUserInfoPage { | ||
| 179 | } | 180 | } |
| 180 | getAccountOwnerInfo(){ | 181 | getAccountOwnerInfo(){ |
| 181 | EditInfoViewModel.queryAccountOwnerInfo(1,getContext(this)).then((editModel) => { | 182 | EditInfoViewModel.queryAccountOwnerInfo(1,getContext(this)).then((editModel) => { |
| 183 | + this.listData = [] | ||
| 182 | this.headerImg = editModel.userExtend.headPhotoUrl | 184 | this.headerImg = editModel.userExtend.headPhotoUrl |
| 183 | this.currentUserInfo = editModel as editModel; | 185 | this.currentUserInfo = editModel as editModel; |
| 184 | this.listData.push(...EditInfoViewModel.getEditListInfo(editModel)) | 186 | this.listData.push(...EditInfoViewModel.getEditListInfo(editModel)) |
| 1 | import { CustomTitleUI } from '../reusable/CustomTitleUI' | 1 | import { CustomTitleUI } from '../reusable/CustomTitleUI' |
| 2 | import router from '@ohos.router' | 2 | import router from '@ohos.router' |
| 3 | -import { editModelParams } from '../../model/EditInfoModel' | ||
| 4 | - | 3 | +import { editModel, editModelParams, WDEditDataModelType } from '../../model/EditInfoModel' |
| 4 | +import EditInfoViewModel from '../../viewmodel/EditInfoViewModel'; | ||
| 5 | @Entry | 5 | @Entry |
| 6 | @Component | 6 | @Component |
| 7 | struct EditUserIntroductionPage { | 7 | struct EditUserIntroductionPage { |
| @@ -51,6 +51,7 @@ struct EditUserIntroductionPage { | @@ -51,6 +51,7 @@ struct EditUserIntroductionPage { | ||
| 51 | .borderRadius(5) | 51 | .borderRadius(5) |
| 52 | .margin(30) | 52 | .margin(30) |
| 53 | .onClick(()=>{ | 53 | .onClick(()=>{ |
| 54 | + this.updateEditModel() | ||
| 54 | let params: editModelParams = { | 55 | let params: editModelParams = { |
| 55 | introduction: this.introduction | 56 | introduction: this.introduction |
| 56 | } | 57 | } |
| @@ -61,4 +62,12 @@ struct EditUserIntroductionPage { | @@ -61,4 +62,12 @@ struct EditUserIntroductionPage { | ||
| 61 | }) | 62 | }) |
| 62 | } | 63 | } |
| 63 | } | 64 | } |
| 65 | + | ||
| 66 | + | ||
| 67 | + updateEditModel(){ | ||
| 68 | + let currentUserInfo:editModel = new editModel() | ||
| 69 | + currentUserInfo.userExtend.introduction = this.introduction | ||
| 70 | + currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_intro | ||
| 71 | + EditInfoViewModel.updateUserInfo(currentUserInfo) | ||
| 72 | + } | ||
| 64 | } | 73 | } |
| 1 | import { CustomTitleUI } from '../reusable/CustomTitleUI' | 1 | import { CustomTitleUI } from '../reusable/CustomTitleUI' |
| 2 | import router from '@ohos.router' | 2 | import router from '@ohos.router' |
| 3 | -import { editModelParams } from '../../model/EditInfoModel' | ||
| 4 | - | 3 | +import { editModel, editModelParams, WDEditDataModelType } from '../../model/EditInfoModel' |
| 4 | +import EditInfoViewModel from '../../viewmodel/EditInfoViewModel'; | ||
| 5 | +// import { encryptMessage } from '../../../utils/cryptoUtil' | ||
| 6 | +import { encryptMessage } from 'wdLogin/src/main/ets/utils/cryptoUtil' | ||
| 5 | @Entry | 7 | @Entry |
| 6 | @Component | 8 | @Component |
| 7 | struct EditUserNikeNamePage { | 9 | struct EditUserNikeNamePage { |
| @@ -51,14 +53,24 @@ struct EditUserNikeNamePage { | @@ -51,14 +53,24 @@ struct EditUserNikeNamePage { | ||
| 51 | .borderRadius(5) | 53 | .borderRadius(5) |
| 52 | .margin(30) | 54 | .margin(30) |
| 53 | .onClick(()=>{ | 55 | .onClick(()=>{ |
| 54 | - let params: editModelParams = { | ||
| 55 | - userName: this.nikeName | ||
| 56 | - } | ||
| 57 | - router.back({ | ||
| 58 | - url:'', | ||
| 59 | - params:params | ||
| 60 | - }) | 56 | + ///内部更新 |
| 57 | + this.updateEditModel() | ||
| 61 | }) | 58 | }) |
| 62 | } | 59 | } |
| 63 | } | 60 | } |
| 61 | + | ||
| 62 | + async updateEditModel(){ | ||
| 63 | + let currentUserInfo:editModel = new editModel() | ||
| 64 | + currentUserInfo.userName = await encryptMessage(this.nikeName); | ||
| 65 | + currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_nickname | ||
| 66 | + EditInfoViewModel.updateUserInfo(currentUserInfo).then(()=>{ | ||
| 67 | + let params: editModelParams = { | ||
| 68 | + userName: this.nikeName | ||
| 69 | + } | ||
| 70 | + router.back({ | ||
| 71 | + url:'', | ||
| 72 | + params:params | ||
| 73 | + }) | ||
| 74 | + }) | ||
| 75 | + } | ||
| 64 | } | 76 | } |
| 1 | import { ContentDTO } from 'wdBean'; | 1 | import { ContentDTO } from 'wdBean'; |
| 2 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 2 | +import { ProcessUtils } from 'wdRouter'; |
| 3 | import { CommonConstants } from 'wdConstant/Index'; | 3 | import { CommonConstants } from 'wdConstant/Index'; |
| 4 | import PageViewModel from '../../viewmodel/PageViewModel'; | 4 | import PageViewModel from '../../viewmodel/PageViewModel'; |
| 5 | import RefreshLayout from '../page/RefreshLayout'; | 5 | import RefreshLayout from '../page/RefreshLayout'; |
| @@ -14,6 +14,7 @@ import { CompParser } from '../CompParser'; | @@ -14,6 +14,7 @@ import { CompParser } from '../CompParser'; | ||
| 14 | import { CompDTO } from 'wdBean'; | 14 | import { CompDTO } from 'wdBean'; |
| 15 | import PageHelper from '../../viewmodel/PageHelper'; | 15 | import PageHelper from '../../viewmodel/PageHelper'; |
| 16 | import { channelSkeleton } from '../skeleton/channelSkeleton' | 16 | import { channelSkeleton } from '../skeleton/channelSkeleton' |
| 17 | +import { ProcessUtils } from 'wdRouter/Index'; | ||
| 17 | 18 | ||
| 18 | const TAG = 'PageComponent'; | 19 | const TAG = 'PageComponent'; |
| 19 | 20 | ||
| @@ -52,48 +53,56 @@ export struct PageComponent { | @@ -52,48 +53,56 @@ export struct PageComponent { | ||
| 52 | 53 | ||
| 53 | @Builder | 54 | @Builder |
| 54 | ListLayout() { | 55 | ListLayout() { |
| 55 | - List() { | ||
| 56 | - // 下拉刷新 | ||
| 57 | - ListItem() { | ||
| 58 | - RefreshLayout({ | ||
| 59 | - refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage, | ||
| 60 | - this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight) | ||
| 61 | - }) | ||
| 62 | - } | ||
| 63 | 56 | ||
| 64 | - LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => { | 57 | + RelativeContainer() { |
| 58 | + List() { | ||
| 59 | + // 下拉刷新 | ||
| 65 | ListItem() { | 60 | ListItem() { |
| 66 | - Column() { | ||
| 67 | - CompParser({ compDTO: compDTO, compIndex: compIndex }); | ||
| 68 | - } | ||
| 69 | - } | ||
| 70 | - }, | ||
| 71 | - (compDTO: CompDTO, compIndex: number) => compDTO.id + compIndex.toString() + this.pageModel.timestamp | ||
| 72 | - ) | ||
| 73 | - | ||
| 74 | - // 加载更多 | ||
| 75 | - ListItem() { | ||
| 76 | - if (this.pageModel.hasMore) { | ||
| 77 | - LoadMoreLayout({ | ||
| 78 | - refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage, | ||
| 79 | - this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight) | 61 | + RefreshLayout({ |
| 62 | + refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage, | ||
| 63 | + this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight) | ||
| 80 | }) | 64 | }) |
| 81 | - } else if (!this.pageModel.contentNeedScroll) { | ||
| 82 | - NoMoreLayout() | 65 | + } |
| 66 | + | ||
| 67 | + LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => { | ||
| 68 | + ListItem() { | ||
| 69 | + Column() { | ||
| 70 | + CompParser({ compDTO: compDTO, compIndex: compIndex }); | ||
| 71 | + } | ||
| 72 | + } | ||
| 73 | + }, | ||
| 74 | + (compDTO: CompDTO, compIndex: number) => compDTO.id + compIndex.toString() + this.pageModel.timestamp | ||
| 75 | + ) | ||
| 76 | + | ||
| 77 | + // 加载更多 | ||
| 78 | + ListItem() { | ||
| 79 | + if (this.pageModel.hasMore) { | ||
| 80 | + LoadMoreLayout({ | ||
| 81 | + refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage, | ||
| 82 | + this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight) | ||
| 83 | + }) | ||
| 84 | + } else if (!this.pageModel.contentNeedScroll) { | ||
| 85 | + NoMoreLayout() | ||
| 86 | + } | ||
| 83 | } | 87 | } |
| 84 | } | 88 | } |
| 89 | + // comp自己处理分页,这里设置EdgeEffect.None | ||
| 90 | + .edgeEffect(this.pageModel.contentNeedScroll ? EdgeEffect.None : EdgeEffect.Spring) | ||
| 91 | + .scrollBar(BarState.Off) | ||
| 92 | + .cachedCount(8) | ||
| 93 | + .height(CommonConstants.FULL_PARENT) | ||
| 94 | + .onScrollIndex((start: number, end: number) => { | ||
| 95 | + // Listen to the first index of the current list. | ||
| 96 | + this.pageModel.startIndex = start; | ||
| 97 | + // 包含了 头尾item,判断时需要考虑+2 | ||
| 98 | + this.pageModel.endIndex = end; | ||
| 99 | + }) | ||
| 100 | + .id('page_list') | ||
| 101 | + | ||
| 102 | + // 挂角广告 | ||
| 103 | + this.pageHornAd() | ||
| 104 | + | ||
| 85 | } | 105 | } |
| 86 | - // comp自己处理分页,这里设置EdgeEffect.None | ||
| 87 | - .edgeEffect(this.pageModel.contentNeedScroll ? EdgeEffect.None : EdgeEffect.Spring) | ||
| 88 | - .scrollBar(BarState.Off) | ||
| 89 | - .cachedCount(8) | ||
| 90 | - .height(CommonConstants.FULL_PARENT) | ||
| 91 | - .onScrollIndex((start: number, end: number) => { | ||
| 92 | - // Listen to the first index of the current list. | ||
| 93 | - this.pageModel.startIndex = start; | ||
| 94 | - // 包含了 头尾item,判断时需要考虑+2 | ||
| 95 | - this.pageModel.endIndex = end; | ||
| 96 | - }) | ||
| 97 | } | 106 | } |
| 98 | 107 | ||
| 99 | @Builder | 108 | @Builder |
| @@ -105,6 +114,100 @@ export struct PageComponent { | @@ -105,6 +114,100 @@ export struct PageComponent { | ||
| 105 | // }) | 114 | // }) |
| 106 | } | 115 | } |
| 107 | 116 | ||
| 117 | + /** | ||
| 118 | + * 页面挂角广告 | ||
| 119 | + */ | ||
| 120 | + @Builder | ||
| 121 | + pageHornAd() { | ||
| 122 | + | ||
| 123 | + if (this.pageModel.isShowAds) { | ||
| 124 | + if (this.pageModel.pageCornerAdv.matInfo != null) { | ||
| 125 | + // 页面右边挂角 | ||
| 126 | + this.drawPageCornerAdvView(1, 1 == this.pageModel.isRightAdv) | ||
| 127 | + } else if (this.pageModel.pageCornerContentInfo.advert != null) { | ||
| 128 | + this.drawPageCornerAdvView(2, 1 == this.pageModel.isRightAdv) | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + /** | ||
| 135 | + * 绘制页面挂角 | ||
| 136 | + * | ||
| 137 | + * @param type 1:广告中心的挂角广告;2:展现中心的挂角广告 | ||
| 138 | + * @param isRightCorne true:右挂角;false:左挂角 | ||
| 139 | + */ | ||
| 140 | + @Builder | ||
| 141 | + drawPageCornerAdvView(type: number, isRightCorne: boolean) { | ||
| 142 | + // 页面左挂角 | ||
| 143 | + Image(type === 1 ? this.pageModel.pageCornerAdv.matInfo.matImageUrl[0] | ||
| 144 | + : this.pageModel.pageCornerContentInfo.advert.displayUrl) | ||
| 145 | + .width($r('app.float.vp_80')) | ||
| 146 | + .height($r('app.float.vp_80')) | ||
| 147 | + .id("left_iv") | ||
| 148 | + .alignRules({ | ||
| 149 | + bottom: { anchor: '__container__', align: VerticalAlign.Bottom }, | ||
| 150 | + left: { anchor: isRightCorne ? "" : '__container__', align: HorizontalAlign.Start }, | ||
| 151 | + right: { anchor: isRightCorne ? '__container__' : "", align: HorizontalAlign.End }, | ||
| 152 | + }) | ||
| 153 | + .margin({ | ||
| 154 | + bottom: "65vp", | ||
| 155 | + left: isRightCorne ? 0 : $r('app.float.card_comp_pagePadding_lf'), | ||
| 156 | + right: isRightCorne ? $r('app.float.card_comp_pagePadding_lf') : 0, | ||
| 157 | + | ||
| 158 | + }) | ||
| 159 | + .onClick(() => { | ||
| 160 | + if (type === 1) { | ||
| 161 | + // 广告业务跳转 | ||
| 162 | + ProcessUtils.openAdvDetail(this.pageModel.pageCornerAdv.matInfo); | ||
| 163 | + } else { | ||
| 164 | + // 展现中心的业务跳转 | ||
| 165 | + ProcessUtils.advJumpMainPage(this.pageModel.pageCornerContentInfo.advert) | ||
| 166 | + } | ||
| 167 | + }) | ||
| 168 | + // 关闭按钮 | ||
| 169 | + Image($r('app.media.icon_adv_horn_close')) | ||
| 170 | + .id('left_close') | ||
| 171 | + .width($r('app.float.vp_16')) | ||
| 172 | + .alignRules({ | ||
| 173 | + top: { anchor: 'left_iv', align: VerticalAlign.Top }, | ||
| 174 | + left: { anchor: isRightCorne ? '' : 'left_iv', align: HorizontalAlign.Start }, | ||
| 175 | + right: { anchor: isRightCorne ? 'left_iv' : '', align: HorizontalAlign.End }, | ||
| 176 | + }) | ||
| 177 | + .offset({ | ||
| 178 | + x: isRightCorne ? 10 : -10, | ||
| 179 | + y: isRightCorne ? -10 : -10 | ||
| 180 | + }) | ||
| 181 | + .onClick(() => { | ||
| 182 | + // 关闭挂角广告 | ||
| 183 | + this.pageModel.isShowAds = false; | ||
| 184 | + | ||
| 185 | + }) | ||
| 186 | + | ||
| 187 | + if (type == 1) { | ||
| 188 | + Text($r('app.string.comp_advertisement')) | ||
| 189 | + .width($r('app.float.vp_28')) | ||
| 190 | + .height($r('app.float.vp_16')) | ||
| 191 | + .fontSize($r('app.float.font_size_10')) | ||
| 192 | + .fontColor(Color.White) | ||
| 193 | + .id('left_tag') | ||
| 194 | + .alignRules({ | ||
| 195 | + bottom: { anchor: 'left_iv', align: VerticalAlign.Bottom }, | ||
| 196 | + left: { anchor: isRightCorne ? '' : 'left_iv', align: HorizontalAlign.Start }, | ||
| 197 | + right: { anchor: isRightCorne ? 'left_iv' : '', align: HorizontalAlign.End }, | ||
| 198 | + }) | ||
| 199 | + .textAlign(TextAlign.Center) | ||
| 200 | + .backgroundColor($r('app.color.res_color_general_000000_30')) | ||
| 201 | + .borderRadius({ | ||
| 202 | + topLeft: $r('app.float.vp_2'), | ||
| 203 | + topRight: $r('app.float.vp_2'), | ||
| 204 | + bottomLeft: $r('app.float.vp_2'), | ||
| 205 | + bottomRight: $r('app.float.vp_2') | ||
| 206 | + }) | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + } | ||
| 210 | + | ||
| 108 | async aboutToAppear() { | 211 | async aboutToAppear() { |
| 109 | // 选中tab,才请求数据。拦截大量接口请求 | 212 | // 选中tab,才请求数据。拦截大量接口请求 |
| 110 | if (this.navIndex === this.currentTopNavSelectedIndex) { | 213 | if (this.navIndex === this.currentTopNavSelectedIndex) { |
| @@ -125,14 +228,15 @@ export struct PageComponent { | @@ -125,14 +228,15 @@ export struct PageComponent { | ||
| 125 | this.pageModel.groupId = this.pageId; | 228 | this.pageModel.groupId = this.pageId; |
| 126 | this.pageModel.channelId = this.channelId; | 229 | this.pageModel.channelId = this.channelId; |
| 127 | this.pageModel.currentPage = 1; | 230 | this.pageModel.currentPage = 1; |
| 128 | - let pageInfo = await PageViewModel.getPageInfo(this.pageModel.pageId); | ||
| 129 | - if (pageInfo == null) { | ||
| 130 | - this.pageModel.viewType = ViewType.EMPTY; | ||
| 131 | - return; | ||
| 132 | - } | ||
| 133 | - this.pageModel.pageInfo = pageInfo; | ||
| 134 | - this.pageModel.loadStrategy = 1 | ||
| 135 | - PageHelper.parseGroup(this.pageModel) | 231 | + PageHelper.getInitData(this.pageModel) |
| 232 | + // let pageInfo = await PageViewModel.getPageInfo(this.pageModel.pageId); | ||
| 233 | + // if (pageInfo == null) { | ||
| 234 | + // this.pageModel.viewType = ViewType.EMPTY; | ||
| 235 | + // return; | ||
| 236 | + // } | ||
| 237 | + // this.pageModel.pageInfo = pageInfo; | ||
| 238 | + // this.pageModel.loadStrategy = 1 | ||
| 239 | + // PageHelper.parseGroup(this.pageModel) | ||
| 136 | } | 240 | } |
| 137 | } | 241 | } |
| 138 | 242 |
| @@ -95,7 +95,7 @@ export struct PrivacySettingPage { | @@ -95,7 +95,7 @@ export struct PrivacySettingPage { | ||
| 95 | .margin({ top: '46lpx' }) | 95 | .margin({ top: '46lpx' }) |
| 96 | .onClick(() => { | 96 | .onClick(() => { |
| 97 | //跳转隐私政策 | 97 | //跳转隐私政策 |
| 98 | - let bean={contentId:"2",pageID:""} as Params | 98 | + let bean={contentID:"2",pageID:""} as Params |
| 99 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) | 99 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) |
| 100 | }) | 100 | }) |
| 101 | Text(this.tipsEnd) | 101 | Text(this.tipsEnd) |
| 1 | -import { ContentDTO } from 'wdBean'; | ||
| 2 | -import { ProcessUtils } from '../../utils/ProcessUtils'; | 1 | +import { ContentDTO, ReserveBean } from 'wdBean'; |
| 2 | +import { ProcessUtils } from 'wdRouter'; | ||
| 3 | import { CommonConstants } from 'wdConstant/Index'; | 3 | import { CommonConstants } from 'wdConstant/Index'; |
| 4 | import PageViewModel from '../../viewmodel/PageViewModel'; | 4 | import PageViewModel from '../../viewmodel/PageViewModel'; |
| 5 | import RefreshLayout from '../page/RefreshLayout'; | 5 | import RefreshLayout from '../page/RefreshLayout'; |
| @@ -7,6 +7,7 @@ import { RefreshLayoutBean } from '../page/RefreshLayoutBean'; | @@ -7,6 +7,7 @@ import { RefreshLayoutBean } from '../page/RefreshLayoutBean'; | ||
| 7 | import PageModel from '../../viewmodel/PageModel'; | 7 | import PageModel from '../../viewmodel/PageModel'; |
| 8 | import { LazyDataSource } from 'wdKit/Index'; | 8 | import { LazyDataSource } from 'wdKit/Index'; |
| 9 | import { router } from '@kit.ArkUI'; | 9 | import { router } from '@kit.ArkUI'; |
| 10 | +import { LiveModel } from '../../viewmodel/LiveModel'; | ||
| 10 | 11 | ||
| 11 | const TAG: string = 'ReserveMorePage'; | 12 | const TAG: string = 'ReserveMorePage'; |
| 12 | 13 | ||
| @@ -23,12 +24,15 @@ const TAG: string = 'ReserveMorePage'; | @@ -23,12 +24,15 @@ const TAG: string = 'ReserveMorePage'; | ||
| 23 | struct ReserveMorePage { | 24 | struct ReserveMorePage { |
| 24 | @State private pageModel: PageModel = new PageModel(); | 25 | @State private pageModel: PageModel = new PageModel(); |
| 25 | @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); | 26 | @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); |
| 27 | + reserveBean: ReserveBean[] = [] | ||
| 26 | topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; | 28 | topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; |
| 27 | type: number = 2; | 29 | type: number = 2; |
| 28 | currentPage: number = 1; | 30 | currentPage: number = 1; |
| 29 | pageSize: number = 20; | 31 | pageSize: number = 20; |
| 30 | operDataList: ContentDTO[] = []; | 32 | operDataList: ContentDTO[] = []; |
| 31 | title: string = '预约列表' | 33 | title: string = '预约列表' |
| 34 | + //是否预约过直播 | ||
| 35 | + @State isAppointmentLive: boolean = false | ||
| 32 | @State contentDTO: ContentDTO = { | 36 | @State contentDTO: ContentDTO = { |
| 33 | // appStyle: '15', | 37 | // appStyle: '15', |
| 34 | // coverType: 1, | 38 | // coverType: 1, |
| @@ -69,12 +73,32 @@ struct ReserveMorePage { | @@ -69,12 +73,32 @@ struct ReserveMorePage { | ||
| 69 | // } | 73 | // } |
| 70 | } as ContentDTO; | 74 | } as ContentDTO; |
| 71 | 75 | ||
| 72 | - aboutToAppear(): void { | ||
| 73 | - PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then((liveReviewDTO) => { | 76 | + async aboutToAppear(): Promise<void> { |
| 77 | + // PageViewModel.get | ||
| 78 | + | ||
| 79 | + PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then(async (liveReviewDTO) => { | ||
| 74 | // this.operDataList = [] | 80 | // this.operDataList = [] |
| 75 | // this.operDataList.push(...liveReviewDTO.list) | 81 | // this.operDataList.push(...liveReviewDTO.list) |
| 76 | this.data.push(...liveReviewDTO.list) | 82 | this.data.push(...liveReviewDTO.list) |
| 83 | + this.reserveBean = this.transformToLiveDetailsBeans(liveReviewDTO.list) | ||
| 84 | + | ||
| 85 | + const apointMentStatus = await LiveModel.getAppointmentStatus(this.reserveBean) | ||
| 86 | + console.info(`cj2024 ${apointMentStatus.code}`) | ||
| 77 | }) | 87 | }) |
| 88 | + | ||
| 89 | + | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + // 这个函数遍历liveReviewDTO.list并转换为LiveDetailsBean数组 | ||
| 93 | + transformToLiveDetailsBeans(list: ContentDTO[]): ReserveBean[] { | ||
| 94 | + const liveDetailsBeans: ReserveBean[] = []; | ||
| 95 | + list.forEach(item => { | ||
| 96 | + liveDetailsBeans.push({ | ||
| 97 | + relationId: item.relId, | ||
| 98 | + liveId: item.objectId, | ||
| 99 | + }); | ||
| 100 | + }); | ||
| 101 | + return liveDetailsBeans | ||
| 78 | } | 102 | } |
| 79 | 103 | ||
| 80 | build() { | 104 | build() { |
| @@ -86,9 +110,8 @@ struct ReserveMorePage { | @@ -86,9 +110,8 @@ struct ReserveMorePage { | ||
| 86 | // .title('直播列表') | 110 | // .title('直播列表') |
| 87 | 111 | ||
| 88 | Column() { | 112 | Column() { |
| 113 | + this.TabbarNormal() | ||
| 89 | Column() { | 114 | Column() { |
| 90 | - this.TabbarNormal() | ||
| 91 | - | ||
| 92 | this.ListLayout() | 115 | this.ListLayout() |
| 93 | } | 116 | } |
| 94 | .padding({ | 117 | .padding({ |
| @@ -200,7 +223,7 @@ struct ReserveMorePage { | @@ -200,7 +223,7 @@ struct ReserveMorePage { | ||
| 200 | .margin(12) | 223 | .margin(12) |
| 201 | 224 | ||
| 202 | Flex({ justifyContent: FlexAlign.Center }) { | 225 | Flex({ justifyContent: FlexAlign.Center }) { |
| 203 | - Text('预约') | 226 | + Text(this.isAppointmentLive ? '已预约' : '预约') |
| 204 | .fontSize(12) | 227 | .fontSize(12) |
| 205 | .fontWeight(400) | 228 | .fontWeight(400) |
| 206 | .fontFamily('PingFang SC-Regular') | 229 | .fontFamily('PingFang SC-Regular') |
| @@ -208,6 +231,9 @@ struct ReserveMorePage { | @@ -208,6 +231,9 @@ struct ReserveMorePage { | ||
| 208 | .height(24) | 231 | .height(24) |
| 209 | .fontColor(Color.White) | 232 | .fontColor(Color.White) |
| 210 | .textAlign(TextAlign.Center) | 233 | .textAlign(TextAlign.Center) |
| 234 | + .onClick(() => { | ||
| 235 | + this.liveAppointment(item) | ||
| 236 | + }) | ||
| 211 | } | 237 | } |
| 212 | .width(52) | 238 | .width(52) |
| 213 | .backgroundColor('#ED2800') | 239 | .backgroundColor('#ED2800') |
| @@ -255,6 +281,23 @@ struct ReserveMorePage { | @@ -255,6 +281,23 @@ struct ReserveMorePage { | ||
| 255 | } | 281 | } |
| 256 | } | 282 | } |
| 257 | 283 | ||
| 284 | + async liveAppointment(item: ContentDTO) { | ||
| 285 | + // this.liveViewModel.liveAppointment( | ||
| 286 | + // this.liveDetailsBean.reLInfo ? this.liveDetailsBean.reLInfo.relId : '', | ||
| 287 | + // this.liveDetailsBean.newsId, | ||
| 288 | + // !this.isAppointmentLive).then( | ||
| 289 | + // (data) => { | ||
| 290 | + // if (data.success) { | ||
| 291 | + // this.isAppointmentLive = !this.isAppointmentLive | ||
| 292 | + // } | ||
| 293 | + // }, | ||
| 294 | + // () => { | ||
| 295 | + // | ||
| 296 | + // }) | ||
| 297 | + const liveDetail = await LiveModel.liveAppointment(item?.relId || '', item?.objectId || '', this.isAppointmentLive || false) | ||
| 298 | + // const liveDetail = await LiveModel.getAppointmentStatus(item?.relId || '', item?.objectId || '', this.isAppointmentLive || false) | ||
| 299 | + } | ||
| 300 | + | ||
| 258 | /*导航栏*/ | 301 | /*导航栏*/ |
| 259 | @Builder | 302 | @Builder |
| 260 | TabbarNormal() { | 303 | TabbarNormal() { |
| 1 | +import { ContentDTO } from 'wdBean'; | ||
| 2 | +import { CommonConstants ,ViewType} from 'wdConstant'; | ||
| 3 | +import PageViewModel from '../../viewmodel/PageViewModel'; | ||
| 4 | +import RefreshLayout from '../page/RefreshLayout'; | ||
| 5 | +import { RefreshLayoutBean } from '../page/RefreshLayoutBean'; | ||
| 6 | +import PageModel from '../../viewmodel/PageModel'; | ||
| 7 | +import { DateTimeUtils, LazyDataSource } from 'wdKit/Index'; | ||
| 8 | +import router from '@ohos.router'; | ||
| 9 | +import { CardParser } from '../CardParser'; | ||
| 10 | +import { channelSkeleton } from '../skeleton/channelSkeleton' | ||
| 11 | +import { ErrorComponent } from '../view/ErrorComponent'; | ||
| 12 | +import { EmptyComponent } from '../view/EmptyComponent'; | ||
| 13 | + | ||
| 14 | +const TAG: string = 'ThemeListPage'; | ||
| 15 | + | ||
| 16 | +@Entry | ||
| 17 | +@Component | ||
| 18 | +struct ThemeListPage { | ||
| 19 | + @State private pageModel: PageModel = new PageModel(); | ||
| 20 | + @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); | ||
| 21 | + sort: number = 1; | ||
| 22 | + currentPage: number = 1; | ||
| 23 | + pageSize: number = 20; | ||
| 24 | + title: string = '金刚位聚合页' | ||
| 25 | + | ||
| 26 | + aboutToAppear(): void { | ||
| 27 | + PageViewModel.postThemeList(this.sort, this.currentPage, this.pageSize).then((liveReviewDTO) => { | ||
| 28 | + console.log(`postThemeList${JSON.stringify(liveReviewDTO)}`) | ||
| 29 | + this.data.push(...liveReviewDTO.list) | ||
| 30 | + if(this.data.getDataArray().length > 0){ | ||
| 31 | + this.pageModel.viewType = ViewType.LOADED; | ||
| 32 | + }else{ | ||
| 33 | + this.pageModel.viewType = ViewType.EMPTY | ||
| 34 | + } | ||
| 35 | + }) | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + build() { | ||
| 39 | + Column() { | ||
| 40 | + this.TabbarNormal() | ||
| 41 | + if (this.pageModel.viewType == ViewType.LOADING) { | ||
| 42 | + this.LoadingLayout() | ||
| 43 | + } else if (this.pageModel.viewType == ViewType.ERROR) { | ||
| 44 | + ErrorComponent() | ||
| 45 | + } else if (this.pageModel.viewType == ViewType.EMPTY) { | ||
| 46 | + EmptyComponent() | ||
| 47 | + } else { | ||
| 48 | + this.ListLayout() | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | + .padding({ | ||
| 52 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 53 | + }) | ||
| 54 | + } | ||
| 55 | + @Builder | ||
| 56 | + LoadingLayout() { | ||
| 57 | + channelSkeleton() | ||
| 58 | + } | ||
| 59 | + /*导航栏*/ | ||
| 60 | + @Builder | ||
| 61 | + TabbarNormal() { | ||
| 62 | + RelativeContainer() { | ||
| 63 | + //标题栏目 | ||
| 64 | + Image($r('app.media.icon_arrow_left')) | ||
| 65 | + .width(24) | ||
| 66 | + .height(24) | ||
| 67 | + .objectFit(ImageFit.Auto) | ||
| 68 | + .id("back_icon") | ||
| 69 | + .alignRules({ | ||
| 70 | + center: { anchor: "__container__", align: VerticalAlign.Center }, | ||
| 71 | + left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 72 | + }) | ||
| 73 | + .onClick(() => { | ||
| 74 | + router.back() | ||
| 75 | + }) | ||
| 76 | + | ||
| 77 | + Text(this.title)// .height('42lpx') | ||
| 78 | + .maxLines(1) | ||
| 79 | + .id("title") | ||
| 80 | + .fontSize('35lpx') | ||
| 81 | + .fontWeight(400) | ||
| 82 | + .fontColor($r('app.color.color_222222')) | ||
| 83 | + .lineHeight('42lpx') | ||
| 84 | + .alignRules({ | ||
| 85 | + center: { anchor: "__container__", align: VerticalAlign.Center }, | ||
| 86 | + middle: { anchor: "__container__", align: HorizontalAlign.Center } | ||
| 87 | + }) | ||
| 88 | + } | ||
| 89 | + .height(44) | ||
| 90 | + .width('100%') | ||
| 91 | + .padding({ | ||
| 92 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 93 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 94 | + }) | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + @Builder | ||
| 98 | + ListLayout() { | ||
| 99 | + List() { | ||
| 100 | + // 下拉刷新 | ||
| 101 | + ListItem() { | ||
| 102 | + RefreshLayout({ | ||
| 103 | + refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage, | ||
| 104 | + this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight) | ||
| 105 | + }) | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + LazyForEach(this.data, (contentDTO: ContentDTO, contentIndex: number) => { | ||
| 109 | + ListItem() { | ||
| 110 | + Column() { | ||
| 111 | + CardParser({ contentDTO }); | ||
| 112 | + } | ||
| 113 | + } | ||
| 114 | + }, | ||
| 115 | + (contentDTO: ContentDTO, contentIndex: number) => contentDTO.pageId + contentIndex.toString() | ||
| 116 | + ) | ||
| 117 | + } | ||
| 118 | + .scrollBar(BarState.Off) | ||
| 119 | + .cachedCount(8) | ||
| 120 | + .height(CommonConstants.FULL_PARENT) | ||
| 121 | + .onScrollIndex((start: number, end: number) => { | ||
| 122 | + this.pageModel.startIndex = start; | ||
| 123 | + this.pageModel.endIndex = end; | ||
| 124 | + }) | ||
| 125 | + } | ||
| 126 | +} |
| @@ -11,7 +11,7 @@ import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; | @@ -11,7 +11,7 @@ import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; | ||
| 11 | const TAG = 'TopNavigationComponent'; | 11 | const TAG = 'TopNavigationComponent'; |
| 12 | 12 | ||
| 13 | PersistentStorage.persistProp('channelIds', ''); | 13 | PersistentStorage.persistProp('channelIds', ''); |
| 14 | -PersistentStorage.persistProp('indexSettingChannelId', 0); | 14 | +PersistentStorage.persistProp('indexSettingChannelId', 2002); |
| 15 | 15 | ||
| 16 | const storage = LocalStorage.getShared(); | 16 | const storage = LocalStorage.getShared(); |
| 17 | 17 | ||
| @@ -22,22 +22,21 @@ const storage = LocalStorage.getShared(); | @@ -22,22 +22,21 @@ const storage = LocalStorage.getShared(); | ||
| 22 | @Component | 22 | @Component |
| 23 | export struct TopNavigationComponent { | 23 | export struct TopNavigationComponent { |
| 24 | private groupId: number = 0 | 24 | private groupId: number = 0 |
| 25 | + private currentBottomNavName: string = '' | ||
| 25 | private tabsController: TabsController = new TabsController() | 26 | private tabsController: TabsController = new TabsController() |
| 26 | - private changeBarBackgroundColor: (color: Color) => void = () => { | ||
| 27 | - } | ||
| 28 | @Consume isLayoutFullScreen: boolean | 27 | @Consume isLayoutFullScreen: boolean |
| 29 | @Consume bottomRectHeight: number | 28 | @Consume bottomRectHeight: number |
| 30 | @Consume topRectHeight: number | 29 | @Consume topRectHeight: number |
| 31 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | 30 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 32 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 31 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 33 | - @State barBackgroundColor: Color = Color.Transparent | ||
| 34 | - @Prop @Watch('indexChange') _currentNavIndex?: number; | 32 | + @Link barBackgroundColor: Color |
| 33 | + @Link _currentNavIndex?: number; | ||
| 35 | // 顶导当前选中/焦点下标 | 34 | // 顶导当前选中/焦点下标 |
| 36 | - @State @Watch('indexChange') currentTopNavSelectedIndex: number = 0; | 35 | + @State currentTopNavSelectedIndex: number = 0; |
| 37 | // 顶导数据 | 36 | // 顶导数据 |
| 38 | @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] | 37 | @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] |
| 39 | @State compList: LazyDataSource<CompDTO> = new LazyDataSource(); | 38 | @State compList: LazyDataSource<CompDTO> = new LazyDataSource(); |
| 40 | - @StorageProp('indexSettingChannelId') indexSettingChannelId: number = 0 | 39 | + @StorageProp('indexSettingChannelId') indexSettingChannelId: number = 2002 |
| 41 | //我的频道id列表 | 40 | //我的频道id列表 |
| 42 | @State channelIds: number[] = [] | 41 | @State channelIds: number[] = [] |
| 43 | //本地缓存频道id列表 | 42 | //本地缓存频道id列表 |
| @@ -107,7 +106,7 @@ export struct TopNavigationComponent { | @@ -107,7 +106,7 @@ export struct TopNavigationComponent { | ||
| 107 | } | 106 | } |
| 108 | 107 | ||
| 109 | //频道分类 | 108 | //频道分类 |
| 110 | - if (item.myChannel === '1') { | 109 | + if (item.myChannel === '1' && item.name !== '播报') { |
| 111 | _myChannelList.push(item) | 110 | _myChannelList.push(item) |
| 112 | _channelIds.push(item.channelId) | 111 | _channelIds.push(item.channelId) |
| 113 | } else if (item.moreChannel === '1') { | 112 | } else if (item.moreChannel === '1') { |
| @@ -122,13 +121,9 @@ export struct TopNavigationComponent { | @@ -122,13 +121,9 @@ export struct TopNavigationComponent { | ||
| 122 | this.myChannelList = _myChannelList | 121 | this.myChannelList = _myChannelList |
| 123 | 122 | ||
| 124 | //缓存首页频道 | 123 | //缓存首页频道 |
| 125 | - if (!this.indexSettingChannelId) { | ||
| 126 | - AppStorage.set('indexSettingChannelId', this.homeChannelList[0].channelId) | ||
| 127 | - } else { | ||
| 128 | - let index = this.myChannelList.findIndex(_item => _item.channelId === this.indexSettingChannelId) | ||
| 129 | - if (index > -1) { | ||
| 130 | - this.currentTopNavSelectedIndex = index | ||
| 131 | - } | 124 | + let index = this.myChannelList.findIndex(_item => _item.channelId === this.indexSettingChannelId) |
| 125 | + if (index > -1) { | ||
| 126 | + this.currentTopNavSelectedIndex = index | ||
| 132 | } | 127 | } |
| 133 | } | 128 | } |
| 134 | 129 | ||
| @@ -150,29 +145,6 @@ export struct TopNavigationComponent { | @@ -150,29 +145,6 @@ export struct TopNavigationComponent { | ||
| 150 | WDRouterRule.jumpWithAction(taskAction) | 145 | WDRouterRule.jumpWithAction(taskAction) |
| 151 | } | 146 | } |
| 152 | 147 | ||
| 153 | - indexChange() { | ||
| 154 | - | ||
| 155 | - // 判断视频频道待处理 | ||
| 156 | - if (this._currentNavIndex === 2 && this.currentTopNavSelectedIndex == 0) { | ||
| 157 | - this.barBackgroundColor = Color.Black | ||
| 158 | - this.changeBarBackgroundColor && this.changeBarBackgroundColor(this.barBackgroundColor) | ||
| 159 | - WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) | ||
| 160 | - WindowModel.shared.setWindowLayoutFullScreen(true) | ||
| 161 | - this.isLayoutFullScreen = true | ||
| 162 | - this.bottomRectHeight = this.bottomSafeHeight | ||
| 163 | - this.topRectHeight = this.topSafeHeight | ||
| 164 | - | ||
| 165 | - } else { | ||
| 166 | - this.barBackgroundColor = Color.Transparent | ||
| 167 | - this.changeBarBackgroundColor && this.changeBarBackgroundColor(this.barBackgroundColor) | ||
| 168 | - WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) | ||
| 169 | - WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 170 | - this.isLayoutFullScreen = false | ||
| 171 | - this.bottomRectHeight = 0 | ||
| 172 | - this.topRectHeight = 0 | ||
| 173 | - } | ||
| 174 | - } | ||
| 175 | - | ||
| 176 | build() { | 148 | build() { |
| 177 | Column() { | 149 | Column() { |
| 178 | // 顶部搜索、日报logo、早晚报 | 150 | // 顶部搜索、日报logo、早晚报 |
| @@ -225,15 +197,16 @@ export struct TopNavigationComponent { | @@ -225,15 +197,16 @@ export struct TopNavigationComponent { | ||
| 225 | // 频道分类list | 197 | // 频道分类list |
| 226 | Stack({ alignContent: Alignment.TopEnd }) { | 198 | Stack({ alignContent: Alignment.TopEnd }) { |
| 227 | Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) { | 199 | Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) { |
| 228 | - ForEach(this._currentNavIndex === 0 ? this.myChannelList : this.topNavList, (navItem: TopNavDTO, index: number) => { | 200 | + ForEach(this.currentBottomNavName === '新闻' ? this.myChannelList : this.topNavList, (navItem: TopNavDTO, index: number) => { |
| 229 | TabContent() { | 201 | TabContent() { |
| 230 | - if (this._currentNavIndex === 2 && navItem.name === '视频') { | 202 | + if (this.currentBottomNavName === '视频' && navItem.name === '视频') { |
| 231 | VideoChannelDetail({ | 203 | VideoChannelDetail({ |
| 232 | - bottomNavIndex: this._currentNavIndex, | ||
| 233 | - topNavIndex: this.currentTopNavSelectedIndex, | 204 | + bottomNavIndex: $_currentNavIndex, |
| 205 | + topNavIndex: $currentTopNavSelectedIndex, | ||
| 234 | groupId: this.groupId + '', | 206 | groupId: this.groupId + '', |
| 235 | pageId: navItem.pageId + '', | 207 | pageId: navItem.pageId + '', |
| 236 | channelId: navItem.channelId + '', | 208 | channelId: navItem.channelId + '', |
| 209 | + barBackgroundColor: $barBackgroundColor | ||
| 237 | }) | 210 | }) |
| 238 | } else | 211 | } else |
| 239 | if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { | 212 | if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { |
| @@ -322,12 +295,13 @@ export struct TopNavigationComponent { | @@ -322,12 +295,13 @@ export struct TopNavigationComponent { | ||
| 322 | .fontColor(this.getFontColor(item, index)) | 295 | .fontColor(this.getFontColor(item, index)) |
| 323 | .padding({ top: $r('app.float.top_tab_item_padding_top') }) | 296 | .padding({ top: $r('app.float.top_tab_item_padding_top') }) |
| 324 | .maxLines(this.MAX_LINE) | 297 | .maxLines(this.MAX_LINE) |
| 325 | - Divider() | ||
| 326 | - .width(16) | ||
| 327 | - .strokeWidth(2)// 分割线粗细度。 | ||
| 328 | - .padding({ top: 2 }) | ||
| 329 | - .color(Color.Red) | ||
| 330 | - .opacity(this.currentTopNavSelectedIndex === index ? 1 : 0) | 298 | + if (this.currentTopNavSelectedIndex === index) { |
| 299 | + Row() | ||
| 300 | + .width(20) | ||
| 301 | + .height(3) | ||
| 302 | + .backgroundImage($r('app.media.icon_channel_active'), ImageRepeat.NoRepeat) | ||
| 303 | + } | ||
| 304 | + | ||
| 331 | } | 305 | } |
| 332 | .hoverEffect(HoverEffect.Highlight) | 306 | .hoverEffect(HoverEffect.Highlight) |
| 333 | .constraintSize({ | 307 | .constraintSize({ |
| @@ -151,7 +151,7 @@ export struct PeopleShipHomeArticleListComponent { | @@ -151,7 +151,7 @@ export struct PeopleShipHomeArticleListComponent { | ||
| 151 | try { | 151 | try { |
| 152 | this.isLoading = true | 152 | this.isLoading = true |
| 153 | let listData: ArticleListData = await PeopleShipHomePageDataModel.getPeopleShipHomePageArticleListData(this.creatorId, this.currentPage, 20, this.typeModel.type) | 153 | let listData: ArticleListData = await PeopleShipHomePageDataModel.getPeopleShipHomePageArticleListData(this.creatorId, this.currentPage, 20, this.typeModel.type) |
| 154 | - Logger.debug(TAG, `获取页面信息, ${listData.list.length}`); | 154 | + Logger.debug(TAG, `获取页面信息, ${JSON.stringify(listData.list)}`); |
| 155 | Logger.debug(TAG, `已更新值最新, ${this.currentPage}`); | 155 | Logger.debug(TAG, `已更新值最新, ${this.currentPage}`); |
| 156 | 156 | ||
| 157 | if (resolve ) { | 157 | if (resolve ) { |
| @@ -173,7 +173,7 @@ export struct PeopleShipHomeArticleListComponent { | @@ -173,7 +173,7 @@ export struct PeopleShipHomeArticleListComponent { | ||
| 173 | } | 173 | } |
| 174 | this.isLoading = false | 174 | this.isLoading = false |
| 175 | this.queryArticleContentInteractCount(listData) | 175 | this.queryArticleContentInteractCount(listData) |
| 176 | - Logger.debug(TAG, '展示的总数', `${this.arr.length}`) | 176 | + Logger.debug(TAG, '展示的总数'+`${this.arr.length}`) |
| 177 | }catch (exception) { | 177 | }catch (exception) { |
| 178 | if (resolve) { | 178 | if (resolve) { |
| 179 | resolve('') | 179 | resolve('') |
| @@ -236,7 +236,8 @@ export struct PeopleShipHomeArticleListComponent { | @@ -236,7 +236,8 @@ export struct PeopleShipHomeArticleListComponent { | ||
| 236 | // 19.动态图文卡-人民号,20.动态视频卡-人民号, | 236 | // 19.动态图文卡-人民号,20.动态视频卡-人民号, |
| 237 | // 21 小视频卡-人民号 | 237 | // 21 小视频卡-人民号 |
| 238 | contentDTO.objectType = `${element.type}`; | 238 | contentDTO.objectType = `${element.type}`; |
| 239 | - | 239 | + // 时间显示 |
| 240 | + contentDTO.isSearch = true | ||
| 240 | // contentDTO.productNum = element.productCount; | 241 | // contentDTO.productNum = element.productCount; |
| 241 | // if (master) { | 242 | // if (master) { |
| 242 | // contentDTO.customWorkStatus = element.workStatus; | 243 | // contentDTO.customWorkStatus = element.workStatus; |
| @@ -277,8 +278,10 @@ export struct PeopleShipHomeArticleListComponent { | @@ -277,8 +278,10 @@ export struct PeopleShipHomeArticleListComponent { | ||
| 277 | 278 | ||
| 278 | 279 | ||
| 279 | //图集数量 | 280 | //图集数量 |
| 280 | - contentDTO.photoNum = element.mainPicCount; | ||
| 281 | - | 281 | + if (element.mainPicCount) { |
| 282 | + contentDTO.photoNum = element.mainPicCount; | ||
| 283 | + } | ||
| 284 | + Logger.debug(TAG, '图集数量:' + `${element.mainPicCount}`) | ||
| 282 | if (element.contentExt && element.contentExt.length > 0) { | 285 | if (element.contentExt && element.contentExt.length > 0) { |
| 283 | let extModel = element.contentExt[0]; | 286 | let extModel = element.contentExt[0]; |
| 284 | contentDTO.openLikes = extModel.openLikes; | 287 | contentDTO.openLikes = extModel.openLikes; |
-
Please register or login to post a comment