Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
# Conflicts: # sight_harmony/features/wdComponent/src/main/ets/components/CompParser.ets
Showing
75 changed files
with
3144 additions
and
387 deletions
Too many changes to show.
To preserve performance only 75 of 75+ files are displayed.
| @@ -20,3 +20,5 @@ export { DurationEnum } from './src/main/ets/enum/DurationEnum'; | @@ -20,3 +20,5 @@ export { DurationEnum } from './src/main/ets/enum/DurationEnum'; | ||
| 20 | export { ScreenType } from './src/main/ets/enum/ScreenType'; | 20 | export { ScreenType } from './src/main/ets/enum/ScreenType'; |
| 21 | 21 | ||
| 22 | export { SpConstants } from './src/main/ets/constants/SpConstants'; | 22 | export { SpConstants } from './src/main/ets/constants/SpConstants'; |
| 23 | + | ||
| 24 | +export { DisplayDirection } from './src/main/ets/constants/VideoConstants'; |
| @@ -11,8 +11,8 @@ export class SpConstants{ | @@ -11,8 +11,8 @@ export class SpConstants{ | ||
| 11 | static USER_TEMP_TOKEN="tempToken" | 11 | static USER_TEMP_TOKEN="tempToken" |
| 12 | static USER_PHONE = "user_phone" | 12 | static USER_PHONE = "user_phone" |
| 13 | //协议相关 | 13 | //协议相关 |
| 14 | - static USER_PROTOCOL = "user_protocol" //用户协议 | ||
| 15 | - static PRIVATE_PROTOCOL = "private_protocol" //隐私协议 | 14 | + static NET_SERVICE_PROTOCOL = "user_protocol" //人民日报客户端网络服务使用协议 |
| 15 | + static PRIVATE_PROTOCOL = "private_protocol" //人民日报客户端用户隐私协议 | ||
| 16 | static LOGOUT_PROTOCOL = "logout_protocol" //人民日报客户端app注销协议 | 16 | static LOGOUT_PROTOCOL = "logout_protocol" //人民日报客户端app注销协议 |
| 17 | static MESSAGE_BOARD_USER_PROTOCOL = "message_board_user_protocol" //"留言板-用户协议" | 17 | static MESSAGE_BOARD_USER_PROTOCOL = "message_board_user_protocol" //"留言板-用户协议" |
| 18 | static MESSAGE_BOARD_NOTICE_PROTOCOL = "message_board_notice_protocol" //留言板-留言须知 | 18 | static MESSAGE_BOARD_NOTICE_PROTOCOL = "message_board_notice_protocol" //留言板-留言须知 |
| @@ -24,4 +24,6 @@ export class SpConstants{ | @@ -24,4 +24,6 @@ export class SpConstants{ | ||
| 24 | static SETTING_SUSPENSION_SWITCH = "setting_suspension_switch" //悬浮窗 开关 | 24 | static SETTING_SUSPENSION_SWITCH = "setting_suspension_switch" //悬浮窗 开关 |
| 25 | static SETTING_PUSH_SWITCH = "setting_push_switch" //推送 开关 | 25 | static SETTING_PUSH_SWITCH = "setting_push_switch" //推送 开关 |
| 26 | 26 | ||
| 27 | + //未登录保存兴趣标签 | ||
| 28 | + static PUBLICVISUTORMODE_INTERESTTAGS = 'PublicVisitorMode_InterestTags' | ||
| 27 | } | 29 | } |
| @@ -16,7 +16,7 @@ export const enum CompStyle { | @@ -16,7 +16,7 @@ export const enum CompStyle { | ||
| 16 | Single_Column_05 = 'Single_Column-05', // 海报图卡:/ | 16 | Single_Column_05 = 'Single_Column-05', // 海报图卡:/ |
| 17 | Single_Column_06 = 'Single_Column-06', // 留言板卡:/ | 17 | Single_Column_06 = 'Single_Column-06', // 留言板卡:/ |
| 18 | Grid_Layout_01 = 'Grid_Layout-01', // 横屏宫格卡:视频、直播 | 18 | Grid_Layout_01 = 'Grid_Layout-01', // 横屏宫格卡:视频、直播 |
| 19 | - Grid_Layout_02 = 'Grid_Layout-02', // 竖屏宫格卡:视频、直播、榜单 | 19 | + Grid_Layout_02 = 'Grid_Layout-02', // 竖屏宫格卡 :视频、直播、榜单 |
| 20 | Masonry_Layout_01 = 'Masonry_Layout-01', // 双列瀑布流/瀑布流卡:视频、直播、专题、活动 | 20 | Masonry_Layout_01 = 'Masonry_Layout-01', // 双列瀑布流/瀑布流卡:视频、直播、专题、活动 |
| 21 | 21 | ||
| 22 | 22 |
| @@ -43,3 +43,5 @@ export { ErrorToastUtils } from './src/main/ets/utils/ErrorToastUtils' | @@ -43,3 +43,5 @@ export { ErrorToastUtils } from './src/main/ets/utils/ErrorToastUtils' | ||
| 43 | export { EmitterUtils } from './src/main/ets/utils/EmitterUtils' | 43 | 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 | + | ||
| 47 | +export { HWLocationUtils } from './src/main/ets/utils/HWLocationUtils' |
| 1 | import { StringUtils } from './StringUtils'; | 1 | import { StringUtils } from './StringUtils'; |
| 2 | -import getLunar from './GetLunar' | 2 | +import getLunar from './GetLunar'; |
| 3 | + | ||
| 3 | /** | 4 | /** |
| 4 | * 日期/时间工具 | 5 | * 日期/时间工具 |
| 5 | */ | 6 | */ |
| @@ -480,6 +481,34 @@ export class DateTimeUtils { | @@ -480,6 +481,34 @@ export class DateTimeUtils { | ||
| 480 | return 0 | 481 | return 0 |
| 481 | } | 482 | } |
| 482 | } | 483 | } |
| 484 | + /** | ||
| 485 | + * 进度值换算 | ||
| 486 | + * @param seconds | ||
| 487 | + * @returns | ||
| 488 | + */ | ||
| 489 | + static secondToTime(seconds: number) { | ||
| 490 | + let time = '00:00' | ||
| 491 | + let hourUnit = 60 * 60; | ||
| 492 | + let hour = Math.floor(seconds / hourUnit); | ||
| 493 | + let minute = Math.floor((seconds - hour * hourUnit) / 60); | ||
| 494 | + let second = seconds - hour * hourUnit - minute * 60; | ||
| 495 | + if (hour > 0) { | ||
| 496 | + return `${DateTimeUtils.padding(hour.toString())}${':'}${DateTimeUtils.padding(minute.toString())}${':'}${DateTimeUtils.padding(second.toString())}`; | ||
| 497 | + } | ||
| 498 | + if (minute > 0) { | ||
| 499 | + return `${DateTimeUtils.padding(minute.toString())}${':'}${DateTimeUtils.padding(second.toString())}`; | ||
| 500 | + } else { | ||
| 501 | + return `${'00'}${':'}${DateTimeUtils.padding(second.toString())}`; | ||
| 502 | + } | ||
| 503 | + } | ||
| 504 | + | ||
| 505 | + static padding(num: string) { | ||
| 506 | + let length = 2; | ||
| 507 | + for (let len = (num.toString()).length; len < length; len = num.length) { | ||
| 508 | + num = `${'0'}${num}`; | ||
| 509 | + } | ||
| 510 | + return num; | ||
| 511 | + } | ||
| 483 | } | 512 | } |
| 484 | 513 | ||
| 485 | // const dateTimeUtils = new DateTimeUtils() | 514 | // const dateTimeUtils = new DateTimeUtils() |
| @@ -7,7 +7,17 @@ export namespace ErrorToastUtils { | @@ -7,7 +7,17 @@ export namespace ErrorToastUtils { | ||
| 7 | NET_CORE_PAGE_ERROR_NETWORK, //网络出小差了,请检查网络后重试 | 7 | NET_CORE_PAGE_ERROR_NETWORK, //网络出小差了,请检查网络后重试 |
| 8 | NET_CORE_LOAD_ERROR_NETWORK, //加载失败,请重试 | 8 | NET_CORE_LOAD_ERROR_NETWORK, //加载失败,请重试 |
| 9 | NET_CORE_ENTER_ERROR_NETWORK, //很抱歉,当前内容无法加载,请点击重试 | 9 | NET_CORE_ENTER_ERROR_NETWORK, //很抱歉,当前内容无法加载,请点击重试 |
| 10 | - LIVE_CORE_NO_NETWORK, //网络出小差了,请检查下网络 | 10 | + |
| 11 | + //直播异常 | ||
| 12 | + LIVE_CORE_NO_NETWORK, //直播 无网络 网络出小差了,请检查下网络 | ||
| 13 | + LIVE_CORE_WEAK_NETWORK, //直播 弱网 网络出小差了,请检查下网络 | ||
| 14 | + LIVE_CORE_IO_NETWORK, //直播 直播流异常 直播加载异常 | ||
| 15 | + LIVE_CORE_SERVICE_NETWORK, //直播 服务端接口异常 直播加载异常 | ||
| 16 | + LIVE_CORE_SWITCH_FLOW_NETWORK, //直播 网络切换到流量 正在使用流量,请注意流量使用 | ||
| 17 | + | ||
| 18 | + //审核后异常报错 | ||
| 19 | + AUDITING_CORE_CONTENT_DISTRIBUTE, //审核 内容分发下线规则 内容已下线 | ||
| 20 | + AUDITING_CORE_ACCOUNT_ERROR, //审核 账号有问题下线规则 内容已下线 | ||
| 11 | 21 | ||
| 12 | } | 22 | } |
| 13 | 23 | ||
| @@ -32,6 +42,27 @@ export namespace ErrorToastUtils { | @@ -32,6 +42,27 @@ export namespace ErrorToastUtils { | ||
| 32 | case ErrorType.LIVE_CORE_NO_NETWORK: | 42 | case ErrorType.LIVE_CORE_NO_NETWORK: |
| 33 | ToastUtils.shortToast($r('app.string.live_core_no_network')) | 43 | ToastUtils.shortToast($r('app.string.live_core_no_network')) |
| 34 | break | 44 | break |
| 45 | + case ErrorType.LIVE_CORE_WEAK_NETWORK: | ||
| 46 | + ToastUtils.shortToast($r('app.string.live_core_weak_network')) | ||
| 47 | + break | ||
| 48 | + case ErrorType.LIVE_CORE_IO_NETWORK: | ||
| 49 | + ToastUtils.shortToast($r('app.string.live_core_io_network')) | ||
| 50 | + break | ||
| 51 | + case ErrorType.LIVE_CORE_SERVICE_NETWORK: | ||
| 52 | + ToastUtils.shortToast($r('app.string.live_core_service_network')) | ||
| 53 | + break | ||
| 54 | + case ErrorType.LIVE_CORE_SWITCH_FLOW_NETWORK: | ||
| 55 | + ToastUtils.shortToast($r('app.string.live_core_switch_flow_network')) | ||
| 56 | + break | ||
| 57 | + case ErrorType.LIVE_CORE_SWITCH_FLOW_NETWORK: | ||
| 58 | + ToastUtils.shortToast($r('app.string.live_core_switch_flow_network')) | ||
| 59 | + break | ||
| 60 | + case ErrorType.AUDITING_CORE_CONTENT_DISTRIBUTE: | ||
| 61 | + ToastUtils.shortToast($r('app.string.auditing_core_error')) | ||
| 62 | + break | ||
| 63 | + case ErrorType.AUDITING_CORE_ACCOUNT_ERROR: | ||
| 64 | + ToastUtils.shortToast($r('app.string.auditing_core_error')) | ||
| 65 | + break | ||
| 35 | } | 66 | } |
| 36 | 67 | ||
| 37 | } | 68 | } |
| 1 | +import { Logger } from './Logger'; | ||
| 2 | +import { PermissionUtils } from './PermissionUtils'; | ||
| 3 | +import { abilityAccessCtrl, bundleManager, Permissions } from '@kit.AbilityKit'; | ||
| 4 | +import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 5 | +import { geoLocationManager } from '@kit.LocationKit'; | ||
| 6 | +import { SPHelper } from './SPHelper'; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 系统定位服务实现 | ||
| 10 | + * */ | ||
| 11 | +export class HWLocationUtils { | ||
| 12 | + //d定位相关 | ||
| 13 | + static LOCATION_CITY_NAME = "location_city_name" //定位 | ||
| 14 | + static LOCATION_CITY_CODE = "location_city_code" //定位 | ||
| 15 | + | ||
| 16 | + | ||
| 17 | + static LOCATION: Permissions = 'ohos.permission.LOCATION' | ||
| 18 | + static APPROXIMATELY_LOCATION: Permissions = 'ohos.permission.APPROXIMATELY_LOCATION' | ||
| 19 | + | ||
| 20 | + private static getLocation() { | ||
| 21 | + let requestInfo: geoLocationManager.LocationRequest = { | ||
| 22 | + 'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX, | ||
| 23 | + 'scenario': geoLocationManager.LocationRequestScenario.UNSET, | ||
| 24 | + distanceInterval: 0, | ||
| 25 | + timeInterval: 60, | ||
| 26 | + maxAccuracy: 0 | ||
| 27 | + }; | ||
| 28 | + geoLocationManager.on('locationChange', requestInfo, (data) => { | ||
| 29 | + Logger.debug('location :' + JSON.stringify(data)) | ||
| 30 | + }) | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + private static getLocationData() { | ||
| 34 | + return new Promise<Record<string, string | number>>((success, fail) => { | ||
| 35 | + let requestInfo: geoLocationManager.LocationRequest = { | ||
| 36 | + 'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX, | ||
| 37 | + 'scenario': geoLocationManager.LocationRequestScenario.DAILY_LIFE_SERVICE, | ||
| 38 | + distanceInterval: 0, | ||
| 39 | + timeInterval: 60, | ||
| 40 | + maxAccuracy: 0 | ||
| 41 | + }; | ||
| 42 | + geoLocationManager.on('locationChange', requestInfo, (data) => { | ||
| 43 | + Logger.debug('location :' + JSON.stringify(data)) //{"latitude":31.86870096,"longitude":117.3015341,"altitude":0,"accuracy":5000,"speed":0,"timeStamp":1713332445643,"direction":0,"timeSinceBoot":589519570869240,"additions":"","additionSize":0} | ||
| 44 | + let record: Record<string, string | number> = {}; | ||
| 45 | + record['latitude'] = data.latitude | ||
| 46 | + record['longitude'] = data.longitude | ||
| 47 | + success(record) | ||
| 48 | + }) | ||
| 49 | + }) | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + //开启定位服务 | ||
| 53 | + static async startLocationService() { | ||
| 54 | + let grant = await PermissionUtils.checkPermissions(HWLocationUtils.APPROXIMATELY_LOCATION) | ||
| 55 | + if (grant) { | ||
| 56 | + HWLocationUtils.getCurrentLocation() | ||
| 57 | + return | ||
| 58 | + } | ||
| 59 | + let context = getContext(); | ||
| 60 | + let requestGrant = await PermissionUtils.reqPermissionsFromUser([HWLocationUtils.APPROXIMATELY_LOCATION], context); | ||
| 61 | + Logger.debug('location2 :' + requestGrant) | ||
| 62 | + if (requestGrant) { | ||
| 63 | + HWLocationUtils.getCurrentLocation() | ||
| 64 | + } else { | ||
| 65 | + PermissionUtils.openPermissionsInSystemSettings(context) | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + private static getCurrentLocation() { | ||
| 70 | + let requestInfo: geoLocationManager.CurrentLocationRequest = { | ||
| 71 | + 'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX, | ||
| 72 | + 'scenario': geoLocationManager.LocationRequestScenario.DAILY_LIFE_SERVICE, | ||
| 73 | + 'maxAccuracy': 0 | ||
| 74 | + }; | ||
| 75 | + try { | ||
| 76 | + geoLocationManager.getCurrentLocation(requestInfo).then((result) => { | ||
| 77 | + //{"latitude":31.8687047,"longitude":117.30152005,"altitude":0,"accuracy":5000,"speed":0,"timeStamp":1713331875766,"direction":0,"timeSinceBoot":588949694096931,"additions":"","additionSize":0} | ||
| 78 | + Logger.debug('location' + JSON.stringify(result)) | ||
| 79 | + HWLocationUtils.getReverseGeoCodeRequest(result.latitude, result.longitude) | ||
| 80 | + }) | ||
| 81 | + .catch((error: number) => { | ||
| 82 | + Logger.debug('location' + JSON.stringify(error)) | ||
| 83 | + }); | ||
| 84 | + } catch (err) { | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + private static getGeoCodeRequest(description: string) { | ||
| 89 | + let requestInfo: geoLocationManager.GeoCodeRequest = { 'description': description }; | ||
| 90 | + geoLocationManager.getAddressesFromLocationName(requestInfo, (error, data) => { | ||
| 91 | + if (data) { | ||
| 92 | + Logger.debug('location :' + JSON.stringify(data)) | ||
| 93 | + } | ||
| 94 | + //[{"latitude":31.898204927828598,"longitude":117.29702564819466,"locale":"zh","placeName":"安徽省合肥市瑶海区白龙路与北二环路辅路交叉口南20米","countryCode":"CN","countryName":"中国","administrativeArea":"安徽省","subAdministrativeArea":"合肥市","locality":"合肥市","subLocality":"瑶海区","roadName":"白龙路与北二环路辅路","subRoadName":"20","premises":"20","postalCode":"","phoneNumber":"18756071597","addressUrl":"","descriptionsSize":0,"isFromMock":false}] | ||
| 95 | + }) | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + private static getReverseGeoCodeRequest(latitude: number, longitude: number) { | ||
| 99 | + let requestInfo: geoLocationManager.ReverseGeoCodeRequest = { | ||
| 100 | + "latitude": latitude, | ||
| 101 | + "longitude": longitude, | ||
| 102 | + "maxItems": 2 | ||
| 103 | + }; | ||
| 104 | + geoLocationManager.getAddressesFromLocation(requestInfo, (error, data) => { | ||
| 105 | + if (error) { | ||
| 106 | + Logger.debug('location :' + JSON.stringify(error)) | ||
| 107 | + } | ||
| 108 | + if (data) { | ||
| 109 | + Logger.debug('location :' + JSON.stringify(data)) | ||
| 110 | + if (data[0] && data[0].countryName) { | ||
| 111 | + if (data[0].descriptionsSize && data[0].descriptions) { | ||
| 112 | + let code = data[0].descriptions[1] | ||
| 113 | + let cityCode = code.substring(0, 6) | ||
| 114 | + let cityName = data[0].subAdministrativeArea; | ||
| 115 | + if (cityName) { | ||
| 116 | + SPHelper.default.save(HWLocationUtils.LOCATION_CITY_NAME, cityName) | ||
| 117 | + } | ||
| 118 | + if (cityCode) { | ||
| 119 | + SPHelper.default.save(HWLocationUtils.LOCATION_CITY_NAME, cityCode) | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + }) | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + | ||
| 128 | + //取消定位 | ||
| 129 | + static cancelLocation() { | ||
| 130 | + // geoLocationManager.off('locationChange') | ||
| 131 | + return new Promise<boolean>((success, fail) => { | ||
| 132 | + geoLocationManager.off("locationChange", (data) => { | ||
| 133 | + Logger.debug('location :' + JSON.stringify(data)) | ||
| 134 | + success(true) | ||
| 135 | + }) | ||
| 136 | + }) | ||
| 137 | + } | ||
| 138 | +} |
| @@ -101,4 +101,9 @@ export class SPHelper { | @@ -101,4 +101,9 @@ export class SPHelper { | ||
| 101 | // preferences.clearSync() | 101 | // preferences.clearSync() |
| 102 | // preferences.flush() | 102 | // preferences.flush() |
| 103 | // } | 103 | // } |
| 104 | + | ||
| 105 | + public getPreferences(){ | ||
| 106 | + let preferences = data_preferences.getPreferences(SPHelper.context, SPHelper.spFilename); | ||
| 107 | + return preferences; | ||
| 108 | + } | ||
| 104 | } | 109 | } |
| 1 | import window from '@ohos.window'; | 1 | import window from '@ohos.window'; |
| 2 | -import { BusinessError } from '@ohos.base'; | 2 | +import { AsyncCallback, BusinessError } from '@ohos.base'; |
| 3 | import deviceInfo from '@ohos.deviceInfo' | 3 | import deviceInfo from '@ohos.deviceInfo' |
| 4 | import display from '@ohos.display'; | 4 | import display from '@ohos.display'; |
| 5 | 5 | ||
| 6 | + | ||
| 7 | +interface SystemBarProperties { | ||
| 8 | + statusBarColor?: string; | ||
| 9 | + isStatusBarLightIcon?: boolean; | ||
| 10 | + statusBarContentColor?: string; | ||
| 11 | + navigationBarColor?: string; | ||
| 12 | + isNavigationBarLightIcon?: boolean; | ||
| 13 | + navigationBarContentColor?: string; | ||
| 14 | +} | ||
| 15 | + | ||
| 6 | export class Size { | 16 | export class Size { |
| 7 | width: number = 0 | 17 | width: number = 0 |
| 8 | height: number = 0 | 18 | height: number = 0 |
| @@ -15,17 +25,24 @@ export class Size { | @@ -15,17 +25,24 @@ export class Size { | ||
| 15 | 25 | ||
| 16 | export class WindowModel { | 26 | export class WindowModel { |
| 17 | private windowStage?: window.WindowStage; | 27 | private windowStage?: window.WindowStage; |
| 28 | + private windowClass?: window.Window; | ||
| 29 | + private isFullScreen: boolean = false | ||
| 18 | static shared: WindowModel = new WindowModel() | 30 | static shared: WindowModel = new WindowModel() |
| 19 | static TAG = "WindowModel"; | 31 | static TAG = "WindowModel"; |
| 20 | 32 | ||
| 21 | setWindowStage(windowStage: window.WindowStage) { | 33 | setWindowStage(windowStage: window.WindowStage) { |
| 22 | this.windowStage = windowStage; | 34 | this.windowStage = windowStage; |
| 35 | + this.windowClass = windowStage.getMainWindowSync(); | ||
| 23 | } | 36 | } |
| 24 | 37 | ||
| 25 | getWindowStage(): window.WindowStage { | 38 | getWindowStage(): window.WindowStage { |
| 26 | return this.windowStage as window.WindowStage | 39 | return this.windowStage as window.WindowStage |
| 27 | } | 40 | } |
| 28 | 41 | ||
| 42 | + getWindowClass(): window.Window { | ||
| 43 | + return this.windowClass as window.Window | ||
| 44 | + } | ||
| 45 | + | ||
| 29 | setMainWindowFullScreen(fullScreen: boolean) { | 46 | setMainWindowFullScreen(fullScreen: boolean) { |
| 30 | if (deviceInfo.deviceType != "phone") { | 47 | if (deviceInfo.deviceType != "phone") { |
| 31 | return | 48 | return |
| @@ -103,5 +120,25 @@ export class WindowModel { | @@ -103,5 +120,25 @@ export class WindowModel { | ||
| 103 | }); | 120 | }); |
| 104 | }) | 121 | }) |
| 105 | } | 122 | } |
| 123 | + | ||
| 124 | + /** | ||
| 125 | + * 设置窗口全屏模式时窗口内导航栏、状态栏的属性,使用callback异步回调。 | ||
| 126 | + * @param systemBarProperties | ||
| 127 | + * @param callback | ||
| 128 | + */ | ||
| 129 | + setWindowSystemBarProperties(systemBarProperties: SystemBarProperties, callback?: AsyncCallback<void>): void { | ||
| 130 | + this.windowClass?.setWindowSystemBarProperties(systemBarProperties, (err: BusinessError) => { | ||
| 131 | + callback && callback(err) | ||
| 132 | + }) | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + setWindowLayoutFullScreen(isFullScreen: boolean) { | ||
| 136 | + this.isFullScreen = isFullScreen | ||
| 137 | + this.windowClass?.setWindowLayoutFullScreen(isFullScreen) | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + getIsFullScreen(): boolean { | ||
| 141 | + return this.isFullScreen | ||
| 142 | + } | ||
| 106 | } | 143 | } |
| 107 | 144 |
| @@ -27,6 +27,26 @@ | @@ -27,6 +27,26 @@ | ||
| 27 | { | 27 | { |
| 28 | "name": "live_core_no_network", | 28 | "name": "live_core_no_network", |
| 29 | "value": "网络出小差了,请检查下网络" | 29 | "value": "网络出小差了,请检查下网络" |
| 30 | + }, | ||
| 31 | + { | ||
| 32 | + "name": "live_core_weak_network", | ||
| 33 | + "value": "网络出小差了,请检查下网络" | ||
| 34 | + }, | ||
| 35 | + { | ||
| 36 | + "name": "live_core_io_network", | ||
| 37 | + "value": "直播加载异常" | ||
| 38 | + }, | ||
| 39 | + { | ||
| 40 | + "name": "live_core_service_network", | ||
| 41 | + "value": "直播加载异常" | ||
| 42 | + }, | ||
| 43 | + { | ||
| 44 | + "name": "live_core_switch_flow_network", | ||
| 45 | + "value": "正在使用流量,请注意流量使用" | ||
| 46 | + }, | ||
| 47 | + { | ||
| 48 | + "name": "auditing_core_error", | ||
| 49 | + "value": "内容已下线" | ||
| 30 | } | 50 | } |
| 31 | ] | 51 | ] |
| 32 | } | 52 | } |
| 1 | { | 1 | { |
| 2 | - "lockfileVersion": 1, | 2 | + "meta": { |
| 3 | + "stableOrder": true | ||
| 4 | + }, | ||
| 5 | + "lockfileVersion": 3, | ||
| 3 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |
| 4 | "specifiers": { | 7 | "specifiers": { |
| 5 | - "@ohos/axios@^2.1.1": "@ohos/axios@2.2.0" | 8 | + "@ohos/axios@^2.1.1": "@ohos/axios@2.2.0", |
| 9 | + "wdConstant@../wdConstant": "wdConstant@../wdConstant", | ||
| 10 | + "wdKit@../wdKit": "wdKit@../wdKit" | ||
| 6 | }, | 11 | }, |
| 7 | "packages": { | 12 | "packages": { |
| 8 | "@ohos/axios@2.2.0": { | 13 | "@ohos/axios@2.2.0": { |
| 14 | + "name": "@ohos/axios", | ||
| 15 | + "integrity": "sha512-v1QBWk6DfcN8wUW3D0ieFbHTR1taSI5cOgxp5l6B5cegXuNYhSc8ggKlAIXe6h/14LsfM+NW0ZGfSXcNEIM5yA==", | ||
| 9 | "resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.2.0.har", | 16 | "resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.2.0.har", |
| 10 | - "integrity": "sha512-v1QBWk6DfcN8wUW3D0ieFbHTR1taSI5cOgxp5l6B5cegXuNYhSc8ggKlAIXe6h/14LsfM+NW0ZGfSXcNEIM5yA==" | 17 | + "registryType": "ohpm" |
| 18 | + }, | ||
| 19 | + "wdConstant@../wdConstant": { | ||
| 20 | + "name": "wdconstant", | ||
| 21 | + "resolved": "../wdConstant", | ||
| 22 | + "registryType": "local" | ||
| 23 | + }, | ||
| 24 | + "wdKit@../wdKit": { | ||
| 25 | + "name": "wdkit", | ||
| 26 | + "resolved": "../wdKit", | ||
| 27 | + "registryType": "local" | ||
| 11 | } | 28 | } |
| 12 | } | 29 | } |
| 13 | } | 30 | } |
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | * ResponseDTO | 2 | * ResponseDTO |
| 3 | */ | 3 | */ |
| 4 | export interface ResponseDTO<T = string> { | 4 | export interface ResponseDTO<T = string> { |
| 5 | - success:boolean; | 5 | + success: boolean; |
| 6 | 6 | ||
| 7 | // 服务请求响应值/微服务响应状态码” | 7 | // 服务请求响应值/微服务响应状态码” |
| 8 | code: number; | 8 | code: number; |
| @@ -12,6 +12,7 @@ export interface ResponseDTO<T = string> { | @@ -12,6 +12,7 @@ export interface ResponseDTO<T = string> { | ||
| 12 | 12 | ||
| 13 | // 响应结果 | 13 | // 响应结果 |
| 14 | data?: T; | 14 | data?: T; |
| 15 | + totalCount?: number; | ||
| 15 | 16 | ||
| 16 | // 请求响应时间戳(unix格式) | 17 | // 请求响应时间戳(unix格式) |
| 17 | timestamp?: number; | 18 | timestamp?: number; |
| 1 | -import HashMap from '@ohos.util.HashMap' | ||
| 2 | -import { ConfigConstants, SpConstants } from 'wdConstant' | ||
| 3 | -import { DateTimeUtils, Logger, SPHelper, StringUtils } from 'wdKit' | 1 | +import HashMap from '@ohos.util.HashMap'; |
| 2 | +import { SpConstants } from 'wdConstant'; | ||
| 3 | +import { SPHelper, StringUtils } from 'wdKit'; | ||
| 4 | 4 | ||
| 5 | /** | 5 | /** |
| 6 | * 网络请求业务侧工具类 | 6 | * 网络请求业务侧工具类 |
| @@ -46,6 +46,10 @@ export class HttpUrlUtils { | @@ -46,6 +46,10 @@ export class HttpUrlUtils { | ||
| 46 | * 批查接口,查询互动相关数据,如收藏数、评论数等 | 46 | * 批查接口,查询互动相关数据,如收藏数、评论数等 |
| 47 | */ | 47 | */ |
| 48 | static readonly INTERACT_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/content/interactData"; | 48 | static readonly INTERACT_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/content/interactData"; |
| 49 | + /** | ||
| 50 | + * 查询视频频道推荐楼层 | ||
| 51 | + */ | ||
| 52 | + static readonly DISPLAY_REC_COMPINFO: string = "/api/rmrb-bff-display-zh/display/zh/c/rec/compInfo"; | ||
| 49 | // 多图(图集)详情页 | 53 | // 多图(图集)详情页 |
| 50 | /** | 54 | /** |
| 51 | * 批量查询内容当前用户点赞、收藏状态 | 55 | * 批量查询内容当前用户点赞、收藏状态 |
| @@ -196,7 +200,6 @@ export class HttpUrlUtils { | @@ -196,7 +200,6 @@ export class HttpUrlUtils { | ||
| 196 | * 搜索联想词 | 200 | * 搜索联想词 |
| 197 | */ | 201 | */ |
| 198 | static readonly RELATED_SEARCH_CONTENT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/suggestions/"; | 202 | static readonly RELATED_SEARCH_CONTENT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/suggestions/"; |
| 199 | - | ||
| 200 | /** | 203 | /** |
| 201 | * 直播详情 | 204 | * 直播详情 |
| 202 | */ | 205 | */ |
| @@ -205,23 +208,52 @@ export class HttpUrlUtils { | @@ -205,23 +208,52 @@ export class HttpUrlUtils { | ||
| 205 | * 直播详情-直播间列表 | 208 | * 直播详情-直播间列表 |
| 206 | */ | 209 | */ |
| 207 | static readonly LIVE_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/video/list"; | 210 | static readonly LIVE_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/video/list"; |
| 208 | - | ||
| 209 | /** | 211 | /** |
| 210 | * 直播详情-大家聊列表 | 212 | * 直播详情-大家聊列表 |
| 211 | */ | 213 | */ |
| 212 | static readonly LIVE_CHAT_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/chat/list"; | 214 | static readonly LIVE_CHAT_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/chat/list"; |
| 213 | /** | 215 | /** |
| 216 | + * 直播详情-直播数据 | ||
| 217 | + */ | ||
| 218 | + static readonly LIVE_ROOM_DATA_PATH: string = "/api/live-center-message/zh/a/live/room/number/all"; | ||
| 219 | + /** | ||
| 220 | + * 直播详情-预约直播状态 | ||
| 221 | + */ | ||
| 222 | + static readonly LIVE_APPOINTMENT_STATUS_PATH: string = "/api/live-center-message/zh/c/live/subscribe/query"; | ||
| 223 | + /** | ||
| 224 | + * 直播详情-预约/取消预约直播 | ||
| 225 | + */ | ||
| 226 | + static readonly LIVE_APPOINTMENT_PATH: string = "/api/live-center-message/zh/c/live/subscribe"; | ||
| 227 | + /** | ||
| 214 | 228 | ||
| 215 | * 搜索结果 显示tab 数 | 229 | * 搜索结果 显示tab 数 |
| 216 | */ | 230 | */ |
| 217 | static readonly SEARCH_RESULT_COUNT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/count?keyword="; | 231 | static readonly SEARCH_RESULT_COUNT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/count?keyword="; |
| 218 | - | ||
| 219 | /** | 232 | /** |
| 220 | * 搜索结果 显示list 详情 | 233 | * 搜索结果 显示list 详情 |
| 221 | */ | 234 | */ |
| 222 | static readonly SEARCH_RESULT_LIST_DATA_PATH: string = "/api/rmrb-search-api/zh/c/search"; | 235 | static readonly SEARCH_RESULT_LIST_DATA_PATH: string = "/api/rmrb-search-api/zh/c/search"; |
| 223 | 236 | ||
| 224 | /** | 237 | /** |
| 238 | + * 创作者详情接口 | ||
| 239 | + */ | ||
| 240 | + static readonly CREATOR_DETAIL_LIST_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/master/detailList"; | ||
| 241 | + /** | ||
| 242 | + * 客态查询发布作品数量 | ||
| 243 | + */ | ||
| 244 | + static readonly ARTICLE_COUNT_HOTS_DATA_PATH: string = "/api/rmrb-content-search/zh/c/article/count"; | ||
| 245 | + | ||
| 246 | + /** | ||
| 247 | + * 客户端 客态主页页面-获取作品-从发布库获取该创作者下 稿件列表 | ||
| 248 | + */ | ||
| 249 | + static readonly ARTICLE_LIST_HOTS_DATA_PATH: string = "/api/rmrb-content-search/zh/c/article/articleList"; | ||
| 250 | + | ||
| 251 | + /** | ||
| 252 | + * 客户端 客态主页页面-获取影响力 | ||
| 253 | + */ | ||
| 254 | + static readonly CREATOR_INFLUENCE_HOTS_DATA_PATH: string = "/api/rmrb-bigdata-bi/zh/c/stats/creator/influence/info"; | ||
| 255 | + | ||
| 256 | + /** | ||
| 225 | * 早晚报列表 | 257 | * 早晚报列表 |
| 226 | * 根据页面id获取页面楼层列表 | 258 | * 根据页面id获取页面楼层列表 |
| 227 | * https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/pageInfo?pageId=28927 | 259 | * https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/pageInfo?pageId=28927 |
| @@ -240,6 +272,17 @@ export class HttpUrlUtils { | @@ -240,6 +272,17 @@ export class HttpUrlUtils { | ||
| 240 | * 早晚报获取PAGEID | 272 | * 早晚报获取PAGEID |
| 241 | * */ | 273 | * */ |
| 242 | static readonly DAILY_PAPER_TOPIC: string = "/api/rmrb-bff-display-zh/display/zh/c/dailyPaperTopic"; | 274 | static readonly DAILY_PAPER_TOPIC: string = "/api/rmrb-bff-display-zh/display/zh/c/dailyPaperTopic"; |
| 275 | + | ||
| 276 | + /** | ||
| 277 | + * app启动页 兴趣偏好 | ||
| 278 | + */ | ||
| 279 | + static readonly INTERESTS_HOTS_DATA_PATH: string = "/api/rmrb-user-center/user/zh/c/tag/queryTags"; | ||
| 280 | + /** | ||
| 281 | + * 更新 兴趣偏好 | ||
| 282 | + */ | ||
| 283 | + static readonly INTERESTS_UPDATETAG_PATH: string = "/api/rmrb-user-center/user/zh/c/tag/updateUserTag"; | ||
| 284 | + | ||
| 285 | + | ||
| 243 | private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT; | 286 | private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT; |
| 244 | /** | 287 | /** |
| 245 | * 推荐列表 | 288 | * 推荐列表 |
| @@ -655,6 +698,17 @@ export class HttpUrlUtils { | @@ -655,6 +698,17 @@ export class HttpUrlUtils { | ||
| 655 | return url | 698 | return url |
| 656 | } | 699 | } |
| 657 | 700 | ||
| 701 | + static getInterestsUrl() { | ||
| 702 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERESTS_HOTS_DATA_PATH; | ||
| 703 | + return url; | ||
| 704 | + | ||
| 705 | + } | ||
| 706 | + | ||
| 707 | + static getUpdateInterestsUrl() { | ||
| 708 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERESTS_UPDATETAG_PATH; | ||
| 709 | + return url; | ||
| 710 | + } | ||
| 711 | + | ||
| 658 | static getLiveDetailsUrl() { | 712 | static getLiveDetailsUrl() { |
| 659 | let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_DETAILS_PATH | 713 | let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_DETAILS_PATH |
| 660 | return url | 714 | return url |
| @@ -670,6 +724,21 @@ export class HttpUrlUtils { | @@ -670,6 +724,21 @@ export class HttpUrlUtils { | ||
| 670 | return url | 724 | return url |
| 671 | } | 725 | } |
| 672 | 726 | ||
| 727 | + static getLiveRoomDataUrl() { | ||
| 728 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_ROOM_DATA_PATH | ||
| 729 | + return url | ||
| 730 | + } | ||
| 731 | + | ||
| 732 | + static getLiveAppointmentStatusUrl() { | ||
| 733 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_APPOINTMENT_STATUS_PATH | ||
| 734 | + return url | ||
| 735 | + } | ||
| 736 | + | ||
| 737 | + static getLiveAppointmentUrl() { | ||
| 738 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_APPOINTMENT_PATH | ||
| 739 | + return url | ||
| 740 | + } | ||
| 741 | + | ||
| 673 | static getSearchResultCountDataUrl() { | 742 | static getSearchResultCountDataUrl() { |
| 674 | let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_COUNT_DATA_PATH | 743 | let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_COUNT_DATA_PATH |
| 675 | return url | 744 | return url |
| @@ -680,6 +749,37 @@ export class HttpUrlUtils { | @@ -680,6 +749,37 @@ export class HttpUrlUtils { | ||
| 680 | return url | 749 | return url |
| 681 | } | 750 | } |
| 682 | 751 | ||
| 752 | + static getInteractListDataUrl() { | ||
| 753 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERACT_DATA_PATH | ||
| 754 | + return url | ||
| 755 | + } | ||
| 756 | + | ||
| 757 | + static getCreatorDetailListDataUrl() { | ||
| 758 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.CREATOR_DETAIL_LIST_DATA_PATH | ||
| 759 | + return url | ||
| 760 | + } | ||
| 761 | + | ||
| 762 | + static getArticleCountHotsDataUrl() { | ||
| 763 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.ARTICLE_COUNT_HOTS_DATA_PATH | ||
| 764 | + return url | ||
| 765 | + } | ||
| 766 | + | ||
| 767 | + static getArticleListHotsDataUrl() { | ||
| 768 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.ARTICLE_LIST_HOTS_DATA_PATH | ||
| 769 | + return url | ||
| 770 | + } | ||
| 771 | + | ||
| 772 | + static getCreatorInfluenceInfoHotsDataUrl() { | ||
| 773 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.CREATOR_INFLUENCE_HOTS_DATA_PATH | ||
| 774 | + return url | ||
| 775 | + } | ||
| 776 | + | ||
| 777 | + //点赞 | ||
| 778 | + static executeLike() { | ||
| 779 | + let url = HttpUrlUtils._hostUrl + "/api/rmrb-interact/interact/zh/c/like/executeLike"; | ||
| 780 | + return url; | ||
| 781 | + } | ||
| 782 | + | ||
| 683 | // static getYcgCommonHeaders(): HashMap<string, string> { | 783 | // static getYcgCommonHeaders(): HashMap<string, string> { |
| 684 | // let headers: HashMap<string, string> = new HashMap<string, string>() | 784 | // let headers: HashMap<string, string> = new HashMap<string, string>() |
| 685 | // | 785 | // |
| 1 | { | 1 | { |
| 2 | - "lockfileVersion": 1, | 2 | + "meta": { |
| 3 | + "stableOrder": true | ||
| 4 | + }, | ||
| 5 | + "lockfileVersion": 3, | ||
| 3 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |
| 4 | - "specifiers": {}, | ||
| 5 | - "packages": {} | 7 | + "specifiers": { |
| 8 | + "wdBean@../../features/wdBean": "wdBean@../../features/wdBean", | ||
| 9 | + "wdKit@../wdKit": "wdKit@../wdKit" | ||
| 10 | + }, | ||
| 11 | + "packages": { | ||
| 12 | + "wdBean@../../features/wdBean": { | ||
| 13 | + "name": "wdbean", | ||
| 14 | + "resolved": "../../features/wdBean", | ||
| 15 | + "registryType": "local" | ||
| 16 | + }, | ||
| 17 | + "wdKit@../wdKit": { | ||
| 18 | + "name": "wdkit", | ||
| 19 | + "resolved": "../wdKit", | ||
| 20 | + "registryType": "local" | ||
| 21 | + } | ||
| 22 | + } | ||
| 6 | } | 23 | } |
| @@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
| 8 | "version": "1.0.0", | 8 | "version": "1.0.0", |
| 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 | } | 13 | } |
| 13 | } | 14 | } |
| @@ -50,13 +50,17 @@ export function registerRouter() { | @@ -50,13 +50,17 @@ 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) { | ||
| 53 | return WDRouterPage.detailPlayLivePage | 54 | return WDRouterPage.detailPlayLivePage |
| 55 | + } else { | ||
| 56 | + return WDRouterPage.detailPlayVLivePage | ||
| 57 | + } | ||
| 54 | } else if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) { | 58 | } else if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) { |
| 55 | return WDRouterPage.detailVideoListPage | 59 | return WDRouterPage.detailVideoListPage |
| 56 | - }else if(action.params?.detailPageType == 9){ | 60 | + } else if (action.params?.detailPageType == 9) { |
| 57 | //图集详情页 | 61 | //图集详情页 |
| 58 | return WDRouterPage.multiPictureDetailPage | 62 | return WDRouterPage.multiPictureDetailPage |
| 59 | - }else if(action.params?.detailPageType == 14 || action.params?.detailPageType == 15){ | 63 | + } else if (action.params?.detailPageType == 14 || action.params?.detailPageType == 15) { |
| 60 | //动态详情页 | 64 | //动态详情页 |
| 61 | return WDRouterPage.dynamicDetailPage | 65 | return WDRouterPage.dynamicDetailPage |
| 62 | } else if (action.params?.detailPageType == 17) { | 66 | } else if (action.params?.detailPageType == 17) { |
| @@ -14,6 +14,16 @@ export class WDRouterPage { | @@ -14,6 +14,16 @@ export class WDRouterPage { | ||
| 14 | return `@bundle:${bundleInfo.name}/${"phone"}/${"ets/pages/MainPage"}` | 14 | return `@bundle:${bundleInfo.name}/${"phone"}/${"ets/pages/MainPage"}` |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | + static getLoginBundleInfo() { | ||
| 18 | + let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT) | ||
| 19 | + return `@bundle:${bundleInfo.name}/${"wdLogin"}/${"ets/pages/login/LoginPage"}` | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + static getSettingBundleInfo() { | ||
| 23 | + let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT) | ||
| 24 | + return `@bundle:${bundleInfo.name}/${"wdComponent"}/${"ets/components/page/SettingPage"}` | ||
| 25 | + } | ||
| 26 | + | ||
| 17 | 27 | ||
| 18 | url() { | 28 | url() { |
| 19 | let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT) | 29 | let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT) |
| @@ -43,6 +53,7 @@ export class WDRouterPage { | @@ -43,6 +53,7 @@ export class WDRouterPage { | ||
| 43 | static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage"); | 53 | static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage"); |
| 44 | // 直播详情页 | 54 | // 直播详情页 |
| 45 | 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"); | ||
| 46 | // 多图(图集)详情页 | 57 | // 多图(图集)详情页 |
| 47 | static multiPictureDetailPage = new WDRouterPage("phone", "ets/pages/detail/MultiPictureDetailPage"); | 58 | static multiPictureDetailPage = new WDRouterPage("phone", "ets/pages/detail/MultiPictureDetailPage"); |
| 48 | // 音乐详情页 | 59 | // 音乐详情页 |
| @@ -89,10 +100,17 @@ export class WDRouterPage { | @@ -89,10 +100,17 @@ export class WDRouterPage { | ||
| 89 | static launchAdvertisingPage = new WDRouterPage("phone", "ets/pages/launchPage/LaunchAdvertisingPage"); | 100 | static launchAdvertisingPage = new WDRouterPage("phone", "ets/pages/launchPage/LaunchAdvertisingPage"); |
| 90 | //主页 | 101 | //主页 |
| 91 | static mainPage = new WDRouterPage("phone", "ets/pages/MainPage"); | 102 | static mainPage = new WDRouterPage("phone", "ets/pages/MainPage"); |
| 103 | + | ||
| 104 | + static launchInterestsPage = new WDRouterPage("phone", "ets/pages/launchPage/LaunchInterestsHobbiesPage"); | ||
| 105 | + | ||
| 92 | // static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview"); | 106 | // static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview"); |
| 93 | 107 | ||
| 94 | //播报页面 | 108 | //播报页面 |
| 95 | static broadcastPage = new WDRouterPage("phone", "ets/pages/broadcast/BroadcastPage"); | 109 | static broadcastPage = new WDRouterPage("phone", "ets/pages/broadcast/BroadcastPage"); |
| 96 | //搜索主页 | 110 | //搜索主页 |
| 97 | static searchPage = new WDRouterPage("wdComponent", "ets/pages/SearchPage"); | 111 | static searchPage = new WDRouterPage("wdComponent", "ets/pages/SearchPage"); |
| 112 | + //搜索人民号主页 | ||
| 113 | + static searchCreatorPage = new WDRouterPage("wdComponent", "ets/pages/SearchCreatorPage"); | ||
| 114 | + //人民号主页 | ||
| 115 | + static peopleShipHomePage = new WDRouterPage("wdComponent", "ets/components/page/PeopleShipHomePage"); | ||
| 98 | } | 116 | } |
| @@ -18,7 +18,7 @@ export class WDRouterRule { | @@ -18,7 +18,7 @@ export class WDRouterRule { | ||
| 18 | if (page) { | 18 | if (page) { |
| 19 | if (params) { | 19 | if (params) { |
| 20 | // router.pushUrl({ url: 'pages/routerpage2', , params: params }) | 20 | // router.pushUrl({ url: 'pages/routerpage2', , params: params }) |
| 21 | - console.log('page.url()==',page.url()) | 21 | + console.log('page.url()==',page.url(),JSON.stringify(params)) |
| 22 | router.pushUrl({ url: page.url(), params: params }) | 22 | router.pushUrl({ url: page.url(), params: params }) |
| 23 | } else { | 23 | } else { |
| 24 | router.pushUrl({ url: page.url() }).catch((error:Error)=>{ | 24 | router.pushUrl({ url: page.url() }).catch((error:Error)=>{ |
| 1 | { | 1 | { |
| 2 | - "lockfileVersion": 1, | 2 | + "meta": { |
| 3 | + "stableOrder": true | ||
| 4 | + }, | ||
| 5 | + "lockfileVersion": 3, | ||
| 3 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |
| 4 | - "specifiers": {}, | ||
| 5 | - "packages": {} | 7 | + "specifiers": { |
| 8 | + "wdBean@../../features/wdBean": "wdBean@../../features/wdBean", | ||
| 9 | + "wdConstant@../wdConstant": "wdConstant@../wdConstant", | ||
| 10 | + "wdJsBridge@../wdJsBridge": "wdJsBridge@../wdJsBridge", | ||
| 11 | + "wdKit@../wdKit": "wdKit@../wdKit", | ||
| 12 | + "wdRouter@../wdRouter": "wdRouter@../wdRouter" | ||
| 13 | + }, | ||
| 14 | + "packages": { | ||
| 15 | + "wdBean@../../features/wdBean": { | ||
| 16 | + "name": "wdbean", | ||
| 17 | + "resolved": "../../features/wdBean", | ||
| 18 | + "registryType": "local" | ||
| 19 | + }, | ||
| 20 | + "wdConstant@../wdConstant": { | ||
| 21 | + "name": "wdconstant", | ||
| 22 | + "resolved": "../wdConstant", | ||
| 23 | + "registryType": "local" | ||
| 24 | + }, | ||
| 25 | + "wdJsBridge@../wdJsBridge": { | ||
| 26 | + "name": "wdjsbridge", | ||
| 27 | + "resolved": "../wdJsBridge", | ||
| 28 | + "registryType": "local" | ||
| 29 | + }, | ||
| 30 | + "wdKit@../wdKit": { | ||
| 31 | + "name": "wdkit", | ||
| 32 | + "resolved": "../wdKit", | ||
| 33 | + "registryType": "local" | ||
| 34 | + }, | ||
| 35 | + "wdRouter@../wdRouter": { | ||
| 36 | + "name": "wdrouter", | ||
| 37 | + "resolved": "../wdRouter", | ||
| 38 | + "registryType": "local", | ||
| 39 | + "dependencies": { | ||
| 40 | + "wdKit": "file:../wdKit", | ||
| 41 | + "wdBean": "file:../../features/wdBean" | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | + } | ||
| 6 | } | 45 | } |
| @@ -41,6 +41,7 @@ export function performJSCallNative(data: Message, call: Callback) { | @@ -41,6 +41,7 @@ export function performJSCallNative(data: Message, call: Callback) { | ||
| 41 | class AppInfo { | 41 | class AppInfo { |
| 42 | plat: string = '' | 42 | plat: string = '' |
| 43 | system: string = '' | 43 | system: string = '' |
| 44 | + networkStatus: number = 1 | ||
| 44 | // TODO 完善 | 45 | // TODO 完善 |
| 45 | } | 46 | } |
| 46 | 47 | ||
| @@ -52,6 +53,7 @@ function getAppPublicInfo(): string { | @@ -52,6 +53,7 @@ function getAppPublicInfo(): string { | ||
| 52 | info.plat = 'Phone' | 53 | info.plat = 'Phone' |
| 53 | // 直接用Android,后续适配再新增鸿蒙 | 54 | // 直接用Android,后续适配再新增鸿蒙 |
| 54 | info.system = 'Android' | 55 | info.system = 'Android' |
| 56 | + info.networkStatus = 1 | ||
| 55 | let result = JSON.stringify(info) | 57 | let result = JSON.stringify(info) |
| 56 | return result; | 58 | return result; |
| 57 | } | 59 | } |
| @@ -13,6 +13,7 @@ export struct WdWebComponent { | @@ -13,6 +13,7 @@ export struct WdWebComponent { | ||
| 13 | @Prop backVisibility: boolean = false | 13 | @Prop backVisibility: boolean = false |
| 14 | @Prop webUrl: string = '' | 14 | @Prop webUrl: string = '' |
| 15 | @Prop @Watch('onReloadStateChanged') reload: number = 0 | 15 | @Prop @Watch('onReloadStateChanged') reload: number = 0 |
| 16 | + @Link isPageEnd: boolean | ||
| 16 | 17 | ||
| 17 | build() { | 18 | build() { |
| 18 | Column() { | 19 | Column() { |
| @@ -37,7 +38,6 @@ export struct WdWebComponent { | @@ -37,7 +38,6 @@ export struct WdWebComponent { | ||
| 37 | .horizontalScrollBarAccess(false) | 38 | .horizontalScrollBarAccess(false) |
| 38 | .verticalScrollBarAccess(false) | 39 | .verticalScrollBarAccess(false) |
| 39 | .onPageBegin((event) => { | 40 | .onPageBegin((event) => { |
| 40 | - console.log(this.webUrl,"yzl") | ||
| 41 | this.onPageBegin(event?.url); | 41 | this.onPageBegin(event?.url); |
| 42 | }) | 42 | }) |
| 43 | .onPageEnd((event) => { | 43 | .onPageEnd((event) => { |
| @@ -86,18 +86,19 @@ export struct WdWebComponent { | @@ -86,18 +86,19 @@ export struct WdWebComponent { | ||
| 86 | BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl) | 86 | BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl) |
| 87 | } | 87 | } |
| 88 | onPageEnd: (url?: string) => void = () => { | 88 | onPageEnd: (url?: string) => void = () => { |
| 89 | + this.isPageEnd = true | ||
| 89 | Logger.debug(TAG, 'onPageEnd'); | 90 | Logger.debug(TAG, 'onPageEnd'); |
| 90 | } | 91 | } |
| 91 | onLoadIntercept: (url?: string) => boolean = () => { | 92 | onLoadIntercept: (url?: string) => boolean = () => { |
| 92 | Logger.debug(TAG, 'onLoadIntercept return false'); | 93 | Logger.debug(TAG, 'onLoadIntercept return false'); |
| 93 | return false | 94 | return false |
| 94 | } | 95 | } |
| 96 | + | ||
| 95 | onReloadStateChanged() { | 97 | onReloadStateChanged() { |
| 96 | Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`); | 98 | Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`); |
| 97 | if (this.reload > 0) { | 99 | if (this.reload > 0) { |
| 98 | this.webviewControl.refresh() | 100 | this.webviewControl.refresh() |
| 99 | } | 101 | } |
| 100 | } | 102 | } |
| 101 | - | ||
| 102 | } | 103 | } |
| 103 | 104 |
| @@ -12,9 +12,12 @@ const TAG = 'WdWebLocalComponent'; | @@ -12,9 +12,12 @@ const TAG = 'WdWebLocalComponent'; | ||
| 12 | @Component | 12 | @Component |
| 13 | export struct WdWebLocalComponent { | 13 | export struct WdWebLocalComponent { |
| 14 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | 14 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() |
| 15 | + onWebPrepared: () => void = () => { | ||
| 16 | + } | ||
| 15 | @Prop backVisibility: boolean = false | 17 | @Prop backVisibility: boolean = false |
| 16 | @Prop webResource: Resource = {} as Resource | 18 | @Prop webResource: Resource = {} as Resource |
| 17 | - @State webHeight : string = '100%' | 19 | + @State webHeight: string | number = '100%' |
| 20 | + @Link isPageEnd: boolean | ||
| 18 | 21 | ||
| 19 | build() { | 22 | build() { |
| 20 | Column() { | 23 | Column() { |
| @@ -39,7 +42,7 @@ export struct WdWebLocalComponent { | @@ -39,7 +42,7 @@ export struct WdWebLocalComponent { | ||
| 39 | .mixedMode(MixedMode.All) | 42 | .mixedMode(MixedMode.All) |
| 40 | .onlineImageAccess(true) | 43 | .onlineImageAccess(true) |
| 41 | .enableNativeEmbedMode(true) | 44 | .enableNativeEmbedMode(true) |
| 42 | - .height(this.webHeight === '100%' ? '100%' : Number(this.webHeight)) | 45 | + .height(this.webHeight) |
| 43 | .onPageBegin((event) => { | 46 | .onPageBegin((event) => { |
| 44 | this.onPageBegin(event?.url); | 47 | this.onPageBegin(event?.url); |
| 45 | }) | 48 | }) |
| @@ -79,9 +82,15 @@ export struct WdWebLocalComponent { | @@ -79,9 +82,15 @@ export struct WdWebLocalComponent { | ||
| 79 | 82 | ||
| 80 | //webview 高度设置 | 83 | //webview 高度设置 |
| 81 | private setCurrentPageOperate: (data: Message) => void = (data) => { | 84 | private setCurrentPageOperate: (data: Message) => void = (data) => { |
| 82 | - console.log("setCurrentPageOperate",JSON.stringify(data)) | ||
| 83 | - if (data.handlerName === H5CallNativeType.jsCall_currentPageOperate) { | ||
| 84 | - this.webHeight = data?.data?.webViewHeight || '100%' | 85 | + if (data.handlerName === H5CallNativeType.jsCall_currentPageOperate && data?.data?.operateType === '8') { |
| 86 | + if (typeof this.webHeight === 'number') { | ||
| 87 | + if (Number(data?.data?.webViewHeight) > this.webHeight) { | ||
| 88 | + this.webHeight = Number(data?.data?.webViewHeight) | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + { | ||
| 92 | + this.webHeight = Number(data?.data?.webViewHeight) || '100%' | ||
| 93 | + } | ||
| 85 | } | 94 | } |
| 86 | } | 95 | } |
| 87 | /** | 96 | /** |
| @@ -99,6 +108,8 @@ export struct WdWebLocalComponent { | @@ -99,6 +108,8 @@ export struct WdWebLocalComponent { | ||
| 99 | } | 108 | } |
| 100 | onPageEnd: (url?: string) => void = () => { | 109 | onPageEnd: (url?: string) => void = () => { |
| 101 | Logger.debug(TAG, 'onPageEnd'); | 110 | Logger.debug(TAG, 'onPageEnd'); |
| 111 | + this.onWebPrepared() | ||
| 112 | + this.isPageEnd = true | ||
| 102 | } | 113 | } |
| 103 | onLoadIntercept: (url?: string) => boolean = () => { | 114 | onLoadIntercept: (url?: string) => boolean = () => { |
| 104 | Logger.debug(TAG, 'onLoadIntercept return false'); | 115 | Logger.debug(TAG, 'onLoadIntercept return false'); |
| @@ -37,7 +37,8 @@ export { | @@ -37,7 +37,8 @@ export { | ||
| 37 | postExecuteCollectRecordParams, | 37 | postExecuteCollectRecordParams, |
| 38 | contentListParams, | 38 | contentListParams, |
| 39 | postInteractAccentionOperateParams, | 39 | postInteractAccentionOperateParams, |
| 40 | - postRecommendListParams | 40 | + postRecommendListParams, |
| 41 | + contentListItem | ||
| 41 | } from './src/main/ets/bean/detail/MultiPictureDetailPageDTO'; | 42 | } from './src/main/ets/bean/detail/MultiPictureDetailPageDTO'; |
| 42 | 43 | ||
| 43 | export { InteractParam, ContentBean } from './src/main/ets/bean/content/InteractParam'; | 44 | export { InteractParam, ContentBean } from './src/main/ets/bean/content/InteractParam'; |
| @@ -120,3 +121,23 @@ export { appStyleImagesDTO } from './src/main/ets/bean/content/appStyleImagesDTO | @@ -120,3 +121,23 @@ export { appStyleImagesDTO } from './src/main/ets/bean/content/appStyleImagesDTO | ||
| 120 | 121 | ||
| 121 | export { LiveRoomBean,LiveRoomItemBean } from './src/main/ets/bean/live/LiveRoomBean'; | 122 | export { LiveRoomBean,LiveRoomItemBean } from './src/main/ets/bean/live/LiveRoomBean'; |
| 122 | 123 | ||
| 124 | +export { LiveRoomDataBean } from './src/main/ets/bean/live/LiveRoomDataBean'; | ||
| 125 | + | ||
| 126 | +export { LiveInfoDTO } from './src/main/ets/bean/detail/LiveInfoDTO'; | ||
| 127 | + | ||
| 128 | +export { LiveDTO } from './src/main/ets/bean/peoples/LiveDTO'; | ||
| 129 | + | ||
| 130 | +export { contentVideosDTO } from './src/main/ets/bean/content/contentVideosDTO'; | ||
| 131 | + | ||
| 132 | +export { ContentExtDTO } from './src/main/ets/bean/peoples/ContentExtDTO'; | ||
| 133 | + | ||
| 134 | +export { ContentShareDTO } from './src/main/ets/bean/peoples/ContentShareDTO'; | ||
| 135 | + | ||
| 136 | +export { | ||
| 137 | + PeopleShipUserDetailData, | ||
| 138 | + ArticleCountData, | ||
| 139 | + ArticleTypeData, | ||
| 140 | + ArticleListData, | ||
| 141 | + InfluenceData | ||
| 142 | +} from './src/main/ets/bean/peoples/PeopleShipUserDetailData'; | ||
| 143 | + |
| @@ -6,9 +6,14 @@ | @@ -6,9 +6,14 @@ | ||
| 6 | */ | 6 | */ |
| 7 | import { appStyleImagesDTO } from '../content/appStyleImagesDTO' | 7 | import { appStyleImagesDTO } from '../content/appStyleImagesDTO' |
| 8 | import {contentVideosDTO} from '../content/contentVideosDTO' | 8 | import {contentVideosDTO} from '../content/contentVideosDTO' |
| 9 | +import { VlivesDTO } from '../peoples/VlivesDTO' | ||
| 10 | +import { LiveDTO } from '../peoples/LiveDTO' | ||
| 11 | +import { ContentExtDTO } from '../peoples/ContentExtDTO' | ||
| 12 | +import { ContentShareDTO } from '../peoples/ContentShareDTO' | ||
| 13 | + | ||
| 9 | export interface ArticleListDTO { | 14 | export interface ArticleListDTO { |
| 10 | listTitle: string; | 15 | listTitle: string; |
| 11 | - mainPicCount: string; | 16 | + mainPicCount: number; |
| 12 | videosCount: string; | 17 | videosCount: string; |
| 13 | voicesCount: string; | 18 | voicesCount: string; |
| 14 | landscape: number; | 19 | landscape: number; |
| @@ -20,7 +25,7 @@ export interface ArticleListDTO { | @@ -20,7 +25,7 @@ export interface ArticleListDTO { | ||
| 20 | id: string; | 25 | id: string; |
| 21 | serialsId: string; | 26 | serialsId: string; |
| 22 | oldContentId: string; | 27 | oldContentId: string; |
| 23 | - type: string; | 28 | + type: number; |
| 24 | tenancy: string; | 29 | tenancy: string; |
| 25 | clientPubFlag: string; | 30 | clientPubFlag: string; |
| 26 | grayScale: string; | 31 | grayScale: string; |
| @@ -62,11 +67,12 @@ export interface ArticleListDTO { | @@ -62,11 +67,12 @@ export interface ArticleListDTO { | ||
| 62 | joinActivity: string; | 67 | joinActivity: string; |
| 63 | userType: string; | 68 | userType: string; |
| 64 | content: object; | 69 | content: object; |
| 65 | - contentShare: []; | 70 | + contentShare: ContentShareDTO[]; |
| 66 | contentLinkData: string; | 71 | contentLinkData: string; |
| 67 | - contentExt: []; | 72 | + contentExt: ContentExtDTO[]; |
| 68 | contentVideos: contentVideosDTO[]; | 73 | contentVideos: contentVideosDTO[]; |
| 69 | - contentPictures: []; | 74 | + appStyleVideos: contentVideosDTO[]; |
| 75 | + contentPictures: appStyleImagesDTO[]; | ||
| 70 | contentPayments: string; | 76 | contentPayments: string; |
| 71 | contentPaymentStaffs: string; | 77 | contentPaymentStaffs: string; |
| 72 | contentTxt: []; | 78 | contentTxt: []; |
| @@ -78,7 +84,7 @@ export interface ArticleListDTO { | @@ -78,7 +84,7 @@ export interface ArticleListDTO { | ||
| 78 | contentStatistics: string; | 84 | contentStatistics: string; |
| 79 | topicExistHeadImage: string; | 85 | topicExistHeadImage: string; |
| 80 | topicComps: string; | 86 | topicComps: string; |
| 81 | - live: string; | 87 | + live: LiveDTO; |
| 82 | statusInfo: string; | 88 | statusInfo: string; |
| 83 | askInfo: string; | 89 | askInfo: string; |
| 84 | askAttachmentList: string; | 90 | askAttachmentList: string; |
| @@ -87,5 +93,5 @@ export interface ArticleListDTO { | @@ -87,5 +93,5 @@ export interface ArticleListDTO { | ||
| 87 | ttopicInteracts: string; | 93 | ttopicInteracts: string; |
| 88 | ttopic: string; | 94 | ttopic: string; |
| 89 | mlive: string; | 95 | mlive: string; |
| 90 | - vlives: string | 96 | + vlives: VlivesDTO[]; |
| 91 | } | 97 | } |
| @@ -29,4 +29,9 @@ export interface CompDTO { | @@ -29,4 +29,9 @@ export interface CompDTO { | ||
| 29 | subType: string; | 29 | subType: string; |
| 30 | imageScale: number; // 封面图比例 1-4:3, 2-16:9, 3-3:2 | 30 | imageScale: number; // 封面图比例 1-4:3, 2-16:9, 3-3:2 |
| 31 | audioDataList: AudioDTO[]; | 31 | audioDataList: AudioDTO[]; |
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 组件内容源类型 (LIVE_HORIZONTAL_CARD\LIVE_RESERVATION\LIVE_LARGE_CARD\LIVE_END\LIVE_MONTHLY_RANKING ) | ||
| 35 | + */ | ||
| 36 | + dataSourceType: string; | ||
| 32 | } | 37 | } |
| @@ -2,6 +2,7 @@ import { CompDTO } from './CompDTO'; | @@ -2,6 +2,7 @@ import { CompDTO } from './CompDTO'; | ||
| 2 | 2 | ||
| 3 | /** | 3 | /** |
| 4 | * Page数据DTO | 4 | * Page数据DTO |
| 5 | + * 其实是comp接口(display/zh/c/compInfo)返回 | ||
| 5 | */ | 6 | */ |
| 6 | export interface PageDTO { | 7 | export interface PageDTO { |
| 7 | pageId: string; // 页面id | 8 | pageId: string; // 页面id |
| @@ -21,6 +21,7 @@ export interface ContentDTO { | @@ -21,6 +21,7 @@ export interface ContentDTO { | ||
| 21 | lengthTime?: object; | 21 | lengthTime?: object; |
| 22 | linkUrl: string; | 22 | linkUrl: string; |
| 23 | openLikes: number; | 23 | openLikes: number; |
| 24 | + openComment?: number; | ||
| 24 | openUrl: string; | 25 | openUrl: string; |
| 25 | pageId: string; | 26 | pageId: string; |
| 26 | // playUrls: any[]; | 27 | // playUrls: any[]; |
| @@ -71,6 +72,7 @@ export interface ContentDTO { | @@ -71,6 +72,7 @@ export interface ContentDTO { | ||
| 71 | photoNum: number; | 72 | photoNum: number; |
| 72 | corner: string; | 73 | corner: string; |
| 73 | rmhPlatform: number; | 74 | rmhPlatform: number; |
| 74 | - newTags: string | ||
| 75 | - | 75 | + newTags: string; |
| 76 | + titleShow?: number; | ||
| 77 | + isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据 | ||
| 76 | } | 78 | } |
| @@ -18,5 +18,6 @@ export interface Params { | @@ -18,5 +18,6 @@ export interface Params { | ||
| 18 | // 8.专辑竖屏详情页 | 18 | // 8.专辑竖屏详情页 |
| 19 | // 13.音频详情页 | 19 | // 13.音频详情页 |
| 20 | // 17.多图(图集)详情页 | 20 | // 17.多图(图集)详情页 |
| 21 | - detailPageType?:number; // 详情页类型 | 21 | + detailPageType?: number; // 详情页类型 |
| 22 | + liveStyle?: number; // 直播类型:0横屏,1竖屏 | ||
| 22 | } | 23 | } |
| @@ -160,7 +160,7 @@ export interface postExecuteCollectRecordParams { | @@ -160,7 +160,7 @@ export interface postExecuteCollectRecordParams { | ||
| 160 | contentList: postExecuteCollectRecordParamsItem[] | 160 | contentList: postExecuteCollectRecordParamsItem[] |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | -interface contentListItem { | 163 | +export interface contentListItem { |
| 164 | contentId: string; | 164 | contentId: string; |
| 165 | contentType: number; | 165 | contentType: number; |
| 166 | } | 166 | } |
| @@ -158,16 +158,27 @@ export interface LiveDetailsBean { | @@ -158,16 +158,27 @@ export interface LiveDetailsBean { | ||
| 158 | */ | 158 | */ |
| 159 | liveInfo: LiveInfo | 159 | liveInfo: LiveInfo |
| 160 | fullColumnImgUrls: Array<FullColumnImgUrls> | 160 | fullColumnImgUrls: Array<FullColumnImgUrls> |
| 161 | - vlive: Array<Vlive> | ||
| 162 | newsTitle: string | 161 | newsTitle: string |
| 162 | + newsId: string | ||
| 163 | newIntroduction: string | 163 | newIntroduction: string |
| 164 | + //迁移id | ||
| 165 | + oldNewsId: string | ||
| 166 | + reLInfo: ReLInfo | ||
| 167 | + rmhInfo: RmhInfo | ||
| 164 | } | 168 | } |
| 165 | 169 | ||
| 166 | export interface LiveInfo { | 170 | export interface LiveInfo { |
| 167 | - //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | 171 | + //直播新闻-直播状态 wait 待开播 running 直播中 end 已结束cancel已取消paused暂停 |
| 168 | liveState: string | 172 | liveState: string |
| 169 | //2024-04-12 15:00:00 直播开始时间 | 173 | //2024-04-12 15:00:00 直播开始时间 |
| 170 | planStartTime: string | 174 | planStartTime: string |
| 175 | + liveStyle: number; | ||
| 176 | + vlive: Array<Vlive> | ||
| 177 | + mlive: MLive | ||
| 178 | +} | ||
| 179 | + | ||
| 180 | +export interface MLive { | ||
| 181 | + mliveId: string | ||
| 171 | } | 182 | } |
| 172 | 183 | ||
| 173 | export interface FullColumnImgUrls { | 184 | export interface FullColumnImgUrls { |
| @@ -179,4 +190,18 @@ export interface Vlive { | @@ -179,4 +190,18 @@ export interface Vlive { | ||
| 179 | liveUrl: string | 190 | liveUrl: string |
| 180 | //直播回看地址,多路直播录制文件URL | 191 | //直播回看地址,多路直播录制文件URL |
| 181 | replayUri: string | 192 | replayUri: string |
| 193 | + // 画面兼容 0-横屏流画面,1-竖屏流画面(仅竖屏直播使用)【前端使用, 可能竖屏模式但是直播流画面是横屏流,前端使用该字段】 | ||
| 194 | + liveStreamType: number | null | ||
| 195 | +} | ||
| 196 | + | ||
| 197 | +export interface ReLInfo { | ||
| 198 | + relId: string | ||
| 199 | +} | ||
| 200 | + | ||
| 201 | +export interface RmhInfo { | ||
| 202 | + rmhName: string; | ||
| 203 | + rmhHeadUrl: string; | ||
| 204 | + rmhId: string; | ||
| 205 | + userId: string; | ||
| 206 | + userType: string; | ||
| 182 | } | 207 | } |
| 1 | +export interface ContentExtDTO { | ||
| 2 | + id: number; | ||
| 3 | + contentId: number; | ||
| 4 | + openLikes: number; | ||
| 5 | + openComment: number; | ||
| 6 | + openDownload: number; | ||
| 7 | + likesStyle: number; | ||
| 8 | + top: number; | ||
| 9 | + joinActivity: number; | ||
| 10 | + hotFlag: number; | ||
| 11 | + preCommentFlag: number; | ||
| 12 | + currentPoliticsFlag: number; | ||
| 13 | + appStyle: number; | ||
| 14 | + tenancy: number; | ||
| 15 | + downloadFlag: number; | ||
| 16 | + publishType: number; | ||
| 17 | + payment: number; | ||
| 18 | + deleted: number; | ||
| 19 | + createUser: string; | ||
| 20 | + createTime: string; | ||
| 21 | + updateUser: string; | ||
| 22 | + updateTime: string; | ||
| 23 | + keyArticle: number; | ||
| 24 | + toExamine: number; | ||
| 25 | + bestNoticer: number; | ||
| 26 | + commentDisplay: number; | ||
| 27 | + imageQuality: number; | ||
| 28 | + haveAdver: number; | ||
| 29 | + openAudio: number; | ||
| 30 | + withdrawNum: number; | ||
| 31 | + menuShow: string; | ||
| 32 | + recommendShow: string; | ||
| 33 | + recommendSelf: string; | ||
| 34 | + concentration: string; | ||
| 35 | + objectPosId: string; | ||
| 36 | + articleExistVote: number; | ||
| 37 | + zhExpireTimeAi: number; | ||
| 38 | + zhTagsAi: string; | ||
| 39 | + appReadCountShow: number; | ||
| 40 | +} |
| 1 | +export interface LiveDTO { | ||
| 2 | + status: string; | ||
| 3 | + previewType: number; | ||
| 4 | + planStartTime: number; | ||
| 5 | + tplId: number; | ||
| 6 | + startTime: number; | ||
| 7 | + endTime: number; | ||
| 8 | + userOrigin: string; | ||
| 9 | + liveStyle: number; | ||
| 10 | + liveWay: number; | ||
| 11 | + liveStreamType: number; | ||
| 12 | + liveExperienceSwitch: boolean; | ||
| 13 | + liveExperienceTime: number; | ||
| 14 | + handAngleSwitch: boolean; | ||
| 15 | + likeStyle: string; | ||
| 16 | + liveType: string; | ||
| 17 | + preDisplay: number; | ||
| 18 | + playbackSwitch: boolean; | ||
| 19 | + originalAddress: string; | ||
| 20 | + provinceName: string; | ||
| 21 | + liveRemindSwitch: boolean; | ||
| 22 | + recordUrlFlag: number; | ||
| 23 | + vr: number; | ||
| 24 | + landscape: string; | ||
| 25 | + recordUrl: string; | ||
| 26 | + uri: string; | ||
| 27 | +} |
| 1 | +import { ArticleListDTO } from '../component/ArticleListDTO' | ||
| 2 | +/** | ||
| 3 | +* http://192.168.1.3:3300/project/3796/interface/api/188629 | ||
| 4 | +* 接口名称:客户端 客态主页页面-获取作品-从发布库获取该创作者下 稿件列表 | ||
| 5 | + * 接口路径:/contact/zh/c/master/detail | ||
| 6 | + * 人民号-主页详情页面数据 | ||
| 7 | + */ | ||
| 8 | +export interface PeopleShipUserDetailData { | ||
| 9 | + articleCreation: number; | ||
| 10 | + attentionNum: number; | ||
| 11 | + authIcon: string; | ||
| 12 | + authId: number; | ||
| 13 | + authPersonal: string; | ||
| 14 | + authTitle: string; | ||
| 15 | + avatarFrame: string; | ||
| 16 | + banControl: number; | ||
| 17 | + browseNum: number; | ||
| 18 | + categoryAuth: string; | ||
| 19 | + city: string; | ||
| 20 | + cnContentPublish: number; | ||
| 21 | + cnIsComment: number; | ||
| 22 | + cnIsLike: number; | ||
| 23 | + cnLiveCommentControl: number; | ||
| 24 | + cnLiveGiftControl: number; | ||
| 25 | + cnLiveLikeControl: number; | ||
| 26 | + cnLivePublish: number; | ||
| 27 | + cnLiveShareControl: number; | ||
| 28 | + cnShareControl: number; | ||
| 29 | + contentPublish: number; | ||
| 30 | + creatorId: string; | ||
| 31 | + district: string; | ||
| 32 | + dynamicControl: number; | ||
| 33 | + dynamicCreation: number; | ||
| 34 | + fansNum: number; | ||
| 35 | + headPhotoUrl: string; | ||
| 36 | + honoraryIcon: string; | ||
| 37 | + honoraryTitle: string; | ||
| 38 | + introduction: string; | ||
| 39 | + isAttention: number; | ||
| 40 | + isComment: number; | ||
| 41 | + isLike: number; | ||
| 42 | + liveCommentControl: number; | ||
| 43 | + liveGiftControl: number; | ||
| 44 | + liveLikeControl: number; | ||
| 45 | + livePublish: number; | ||
| 46 | + liveShareControl: number; | ||
| 47 | + liveSwitch: number; | ||
| 48 | + mainControl: number; | ||
| 49 | + originUserId: string; | ||
| 50 | + pictureCollectionCreation: number; | ||
| 51 | + posterShareControl: number; | ||
| 52 | + province: string; | ||
| 53 | + region: string; | ||
| 54 | + registTime: number; | ||
| 55 | + shareControl: number; | ||
| 56 | + shareUrl: string; | ||
| 57 | + subjectType: number; | ||
| 58 | + userId: string; | ||
| 59 | + userName: string; | ||
| 60 | + userType: string; | ||
| 61 | + videoCollectionCreation: number; | ||
| 62 | + videoCreation: number; | ||
| 63 | +} | ||
| 64 | + | ||
| 65 | +//article/count | ||
| 66 | +/* | ||
| 67 | + * 客户端 客态查询发布作品数量 | ||
| 68 | + * http://192.168.1.3:3300/project/3856/interface/api/190579 | ||
| 69 | + * 接口路径:/zh/c/article/count | ||
| 70 | + * */ | ||
| 71 | +export interface ArticleCountData { | ||
| 72 | + zbCount: number; //直播数量 (直播) | ||
| 73 | + dtCount: number; //动态数量 (动态) | ||
| 74 | + twCount: number; //图文数量 (文章) | ||
| 75 | + ztCount: number; //组图数量 (图集) | ||
| 76 | + spCount: number; // 视频数量 (视频) | ||
| 77 | + publishCount: number; // 发布数量 | ||
| 78 | + serialsCount: number; // | ||
| 79 | +} | ||
| 80 | + | ||
| 81 | +export class ArticleTypeData { | ||
| 82 | + name?: string; //名称 | ||
| 83 | + type?: number; // 类型 | ||
| 84 | + | ||
| 85 | + constructor(name?: string, type?: number) { | ||
| 86 | + this.name = name; | ||
| 87 | + this.type = type; | ||
| 88 | + } | ||
| 89 | +} | ||
| 90 | + | ||
| 91 | +export interface ArticleListData { | ||
| 92 | + totalCount: number; | ||
| 93 | + pageNum: number; | ||
| 94 | + pageSize: number; | ||
| 95 | + list: ArticleListDTO[]; | ||
| 96 | +} | ||
| 97 | + | ||
| 98 | +// 影响力 | ||
| 99 | +export interface InfluenceData { | ||
| 100 | + creatorId: string; | ||
| 101 | + influence: number; | ||
| 102 | + influenceTotal: number; | ||
| 103 | +} |
| 1 | +export interface VlivesDTO { | ||
| 2 | + id: number; | ||
| 3 | + type: string; | ||
| 4 | + // definition?: any; | ||
| 5 | + // streamAppName?: any; | ||
| 6 | + // streamName?: any; | ||
| 7 | + pullStreamUrl: string; | ||
| 8 | + // streamStatus?: any; | ||
| 9 | + // shiftEnable?: any; | ||
| 10 | + // clipEnable?: any; | ||
| 11 | + // recordEnable?: any; | ||
| 12 | + status: string; | ||
| 13 | + liveId: number; | ||
| 14 | + name: string; | ||
| 15 | + // serialNum?: any; | ||
| 16 | + streamWH: string; | ||
| 17 | + recordUrl: string; | ||
| 18 | + // playPreviewImageUri?: any; | ||
| 19 | + // playPreviewImageFullUrl?: any; | ||
| 20 | + // playPreviewImageBucket?: any; | ||
| 21 | + showPad: boolean; | ||
| 22 | + // liveStreamManagerId?: any; | ||
| 23 | + // recordBucket?: any; | ||
| 24 | + // recordUri?: any; | ||
| 25 | +} |
| @@ -63,3 +63,9 @@ export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopi | @@ -63,3 +63,9 @@ export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopi | ||
| 63 | 63 | ||
| 64 | export { LogoutViewModel } from "./src/main/ets/viewmodel/LogoutViewModel" | 64 | export { LogoutViewModel } from "./src/main/ets/viewmodel/LogoutViewModel" |
| 65 | 65 | ||
| 66 | +export { ImageSwiperComponent } from "./src/main/ets/components/ImageSwiperComponent" | ||
| 67 | + | ||
| 68 | +export { newsSkeleton } from "./src/main/ets/components/skeleton/newsSkeleton" | ||
| 69 | + | ||
| 70 | +export { LiveCommentComponent } from "./src/main/ets/components/comment/view/LiveCommentComponent" | ||
| 71 | + |
| @@ -6,8 +6,11 @@ | @@ -6,8 +6,11 @@ | ||
| 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |
| 7 | "specifiers": { | 7 | "specifiers": { |
| 8 | "@ohos/axios@^2.1.1": "@ohos/axios@2.2.0", | 8 | "@ohos/axios@^2.1.1": "@ohos/axios@2.2.0", |
| 9 | + "@ohos/lottie@2.0.0": "@ohos/lottie@2.0.0", | ||
| 9 | "wdBean@../wdBean": "wdBean@../wdBean", | 10 | "wdBean@../wdBean": "wdBean@../wdBean", |
| 10 | "wdConstant@../../commons/wdConstant": "wdConstant@../../commons/wdConstant", | 11 | "wdConstant@../../commons/wdConstant": "wdConstant@../../commons/wdConstant", |
| 12 | + "wdDetailPlayApi@../wdDetailPlayApi": "wdDetailPlayApi@../wdDetailPlayApi", | ||
| 13 | + "wdDetailPlayShortVideo@../wdDetailPlayShortVideo": "wdDetailPlayShortVideo@../wdDetailPlayShortVideo", | ||
| 11 | "wdJsBridge@../../commons/wdJsBridge": "wdJsBridge@../../commons/wdJsBridge", | 14 | "wdJsBridge@../../commons/wdJsBridge": "wdJsBridge@../../commons/wdJsBridge", |
| 12 | "wdKit@../../commons/wdKit": "wdKit@../../commons/wdKit", | 15 | "wdKit@../../commons/wdKit": "wdKit@../../commons/wdKit", |
| 13 | "wdLogin@../wdLogin": "wdLogin@../wdLogin", | 16 | "wdLogin@../wdLogin": "wdLogin@../wdLogin", |
| @@ -23,6 +26,12 @@ | @@ -23,6 +26,12 @@ | ||
| 23 | "resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.2.0.har", | 26 | "resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.2.0.har", |
| 24 | "registryType": "ohpm" | 27 | "registryType": "ohpm" |
| 25 | }, | 28 | }, |
| 29 | + "@ohos/lottie@2.0.0": { | ||
| 30 | + "name": "@ohos/lottie", | ||
| 31 | + "integrity": "sha512-jFEFYfuqGO323aMiwtzHmDGRJI0qTxjZD2Lzbn+LxRdoHSfu5OVu22I8gVm5ej019tCw3WOk547NHZ2GuWiNSg==", | ||
| 32 | + "resolved": "https://repo.harmonyos.com/ohpm/@ohos/lottie/-/lottie-2.0.0.har", | ||
| 33 | + "registryType": "ohpm" | ||
| 34 | + }, | ||
| 26 | "wdBean@../wdBean": { | 35 | "wdBean@../wdBean": { |
| 27 | "name": "wdbean", | 36 | "name": "wdbean", |
| 28 | "resolved": "../wdBean", | 37 | "resolved": "../wdBean", |
| @@ -33,6 +42,32 @@ | @@ -33,6 +42,32 @@ | ||
| 33 | "resolved": "../../commons/wdConstant", | 42 | "resolved": "../../commons/wdConstant", |
| 34 | "registryType": "local" | 43 | "registryType": "local" |
| 35 | }, | 44 | }, |
| 45 | + "wdDetailPlayApi@../wdDetailPlayApi": { | ||
| 46 | + "name": "wddetailplayapi", | ||
| 47 | + "resolved": "../wdDetailPlayApi", | ||
| 48 | + "registryType": "local", | ||
| 49 | + "dependencies": { | ||
| 50 | + "wdPlayer": "file:../../features/wdPlayer", | ||
| 51 | + "wdKit": "file:../../commons/wdKit", | ||
| 52 | + "wdBean": "file:../../features/wdBean", | ||
| 53 | + "wdRouter": "file:../../commons/wdRouter", | ||
| 54 | + "wdNetwork": "file:../../commons/wdNetwork" | ||
| 55 | + } | ||
| 56 | + }, | ||
| 57 | + "wdDetailPlayShortVideo@../wdDetailPlayShortVideo": { | ||
| 58 | + "name": "wddetailplayshortvideo", | ||
| 59 | + "resolved": "../wdDetailPlayShortVideo", | ||
| 60 | + "registryType": "local", | ||
| 61 | + "dependencies": { | ||
| 62 | + "@ohos/lottie": "2.0.0", | ||
| 63 | + "wdPlayer": "file:../../features/wdPlayer", | ||
| 64 | + "wdKit": "file:../../commons/wdKit", | ||
| 65 | + "wdBean": "file:../../features/wdBean", | ||
| 66 | + "wdRouter": "file:../../commons/wdRouter", | ||
| 67 | + "wdNetwork": "file:../../commons/wdNetwork", | ||
| 68 | + "wdDetailPlayApi": "file:../../features/wdDetailPlayApi" | ||
| 69 | + } | ||
| 70 | + }, | ||
| 36 | "wdJsBridge@../../commons/wdJsBridge": { | 71 | "wdJsBridge@../../commons/wdJsBridge": { |
| 37 | "name": "wdjsbridge", | 72 | "name": "wdjsbridge", |
| 38 | "resolved": "../../commons/wdJsBridge", | 73 | "resolved": "../../commons/wdJsBridge", |
| @@ -8,8 +8,11 @@ import { Card6Component } from './cardview/Card6Component'; | @@ -8,8 +8,11 @@ import { Card6Component } from './cardview/Card6Component'; | ||
| 8 | import { Card9Component } from './cardview/Card9Component'; | 8 | import { Card9Component } from './cardview/Card9Component'; |
| 9 | import { Card10Component } from './cardview/Card10Component'; | 9 | import { Card10Component } from './cardview/Card10Component'; |
| 10 | import { Card11Component } from './cardview/Card11Component'; | 10 | import { Card11Component } from './cardview/Card11Component'; |
| 11 | -import { Card17Component } from './cardview/Card17Component'; | 11 | +import { Card12Component } from './cardview/Card12Component'; |
| 12 | +import { Card14Component } from './cardview/Card14Component'; | ||
| 12 | import { Card15Component } from './cardview/Card15Component'; | 13 | import { Card15Component } from './cardview/Card15Component'; |
| 14 | +import { Card16Component } from './cardview/Card16Component'; | ||
| 15 | +import { Card17Component } from './cardview/Card17Component'; | ||
| 13 | import { Card19Component } from './cardview/Card19Component'; | 16 | import { Card19Component } from './cardview/Card19Component'; |
| 14 | import { Card20Component } from './cardview/Card20Component'; | 17 | import { Card20Component } from './cardview/Card20Component'; |
| 15 | import { Card21Component } from './cardview/Card21Component'; | 18 | import { Card21Component } from './cardview/Card21Component'; |
| @@ -45,8 +48,14 @@ export struct CardParser { | @@ -45,8 +48,14 @@ export struct CardParser { | ||
| 45 | Card10Component({ contentDTO }) | 48 | Card10Component({ contentDTO }) |
| 46 | } else if (contentDTO.appStyle === CompStyle.Card_11) { | 49 | } else if (contentDTO.appStyle === CompStyle.Card_11) { |
| 47 | Card11Component({ contentDTO }) | 50 | Card11Component({ contentDTO }) |
| 51 | + } else if (contentDTO.appStyle === CompStyle.Card_12) { | ||
| 52 | + Card12Component({ contentDTO }) | ||
| 53 | + } else if (contentDTO.appStyle === CompStyle.Card_14) { | ||
| 54 | + Card14Component({ contentDTO }) | ||
| 48 | } else if (contentDTO.appStyle === CompStyle.Card_15) { | 55 | } else if (contentDTO.appStyle === CompStyle.Card_15) { |
| 49 | Card15Component({ contentDTO }) | 56 | Card15Component({ contentDTO }) |
| 57 | + } else if (contentDTO.appStyle === CompStyle.Card_16) { | ||
| 58 | + Card16Component({ contentDTO }) | ||
| 50 | } else if (contentDTO.appStyle === CompStyle.Card_17) { | 59 | } else if (contentDTO.appStyle === CompStyle.Card_17) { |
| 51 | Card17Component({ contentDTO }) | 60 | Card17Component({ contentDTO }) |
| 52 | } else if (contentDTO.appStyle === CompStyle.Card_19) { | 61 | } else if (contentDTO.appStyle === CompStyle.Card_19) { |
| @@ -58,9 +67,9 @@ export struct CardParser { | @@ -58,9 +67,9 @@ export struct CardParser { | ||
| 58 | } | 67 | } |
| 59 | else { | 68 | else { |
| 60 | // todo:组件未实现 / Component Not Implemented | 69 | // todo:组件未实现 / Component Not Implemented |
| 61 | - Text(contentDTO.appStyle) | ||
| 62 | - .width(CommonConstants.FULL_PARENT) | ||
| 63 | - .padding(10) | 70 | + // Text(contentDTO.appStyle) |
| 71 | + // .width(CommonConstants.FULL_PARENT) | ||
| 72 | + // .padding(10) | ||
| 64 | // .backgroundColor(Color.Brown) // 展示本页未实现的compStyle | 73 | // .backgroundColor(Color.Brown) // 展示本页未实现的compStyle |
| 65 | } | 74 | } |
| 66 | } | 75 | } |
| @@ -9,6 +9,7 @@ import { | @@ -9,6 +9,7 @@ import { | ||
| 9 | import { | 9 | import { |
| 10 | HorizontalStrokeCardThreeTwoRadioForOneComponent | 10 | HorizontalStrokeCardThreeTwoRadioForOneComponent |
| 11 | } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent'; | 11 | } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent'; |
| 12 | +import { ZhSingleRow02 } from './compview/ZhSingleRow02'; | ||
| 12 | import { ZhSingleRow04 } from './compview/ZhSingleRow04'; | 13 | import { ZhSingleRow04 } from './compview/ZhSingleRow04'; |
| 13 | import { ZhSingleColumn04 } from './compview/ZhSingleColumn04'; | 14 | import { ZhSingleColumn04 } from './compview/ZhSingleColumn04'; |
| 14 | import { ZhSingleColumn05 } from './compview/ZhSingleColumn05'; | 15 | import { ZhSingleColumn05 } from './compview/ZhSingleColumn05'; |
| @@ -30,7 +31,10 @@ export struct CompParser { | @@ -30,7 +31,10 @@ export struct CompParser { | ||
| 30 | compIndex: number = 0; | 31 | compIndex: number = 0; |
| 31 | 32 | ||
| 32 | build() { | 33 | build() { |
| 34 | + Column(){ | ||
| 33 | this.componentBuilder(this.compDTO, this.compIndex); | 35 | this.componentBuilder(this.compDTO, this.compIndex); |
| 36 | + Divider().strokeWidth(1).color('#f5f5f5').padding({left:16,right:16}) | ||
| 37 | + } | ||
| 34 | } | 38 | } |
| 35 | 39 | ||
| 36 | @Builder | 40 | @Builder |
| @@ -47,6 +51,8 @@ export struct CompParser { | @@ -47,6 +51,8 @@ export struct CompParser { | ||
| 47 | } else { | 51 | } else { |
| 48 | HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO }) | 52 | HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO }) |
| 49 | } | 53 | } |
| 54 | + } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) { | ||
| 55 | + ZhSingleRow02({ compDTO }) | ||
| 50 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) { | 56 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) { |
| 51 | LiveHorizontalReservationComponent({ compDTO: compDTO }) | 57 | LiveHorizontalReservationComponent({ compDTO: compDTO }) |
| 52 | } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { | 58 | } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { |
| @@ -75,6 +81,9 @@ export struct CompParser { | @@ -75,6 +81,9 @@ export struct CompParser { | ||
| 75 | WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage) | 81 | WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage) |
| 76 | } | 82 | } |
| 77 | }) | 83 | }) |
| 84 | + // Text(compDTO.compStyle) | ||
| 85 | + // .width(CommonConstants.FULL_PARENT) | ||
| 86 | + // .padding(10) | ||
| 78 | // .backgroundColor(Color.Brown) // 展示本页未实现的compStyle | 87 | // .backgroundColor(Color.Brown) // 展示本页未实现的compStyle |
| 79 | } | 88 | } |
| 80 | } | 89 | } |
| 1 | -import { Logger } from 'wdKit'; | 1 | +import { AccountManagerUtils, Logger } from 'wdKit'; |
| 2 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 2 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 3 | -import { ContentDetailDTO } from 'wdBean'; | 3 | +import { ContentDetailDTO,batchLikeAndCollectResult,batchLikeAndCollectParams,postBatchAttentionStatusParams, |
| 4 | + PhotoListBean, | ||
| 5 | + ContentDTO, } from 'wdBean'; | ||
| 4 | import media from '@ohos.multimedia.media'; | 6 | import media from '@ohos.multimedia.media'; |
| 5 | import { OperRowListView } from './view/OperRowListView'; | 7 | import { OperRowListView } from './view/OperRowListView'; |
| 6 | import { WDPlayerController } from 'wdPlayer/Index'; | 8 | import { WDPlayerController } from 'wdPlayer/Index'; |
| 9 | +import { ContentConstants } from '../constants/ContentConstants'; | ||
| 10 | +import { ProcessUtils } from '../utils/ProcessUtils'; | ||
| 7 | 11 | ||
| 8 | const TAG = 'DynamicDetailComponent' | 12 | const TAG = 'DynamicDetailComponent' |
| 9 | @Preview | 13 | @Preview |
| @@ -14,8 +18,16 @@ export struct DynamicDetailComponent { | @@ -14,8 +18,16 @@ export struct DynamicDetailComponent { | ||
| 14 | private contentId: string = '' | 18 | private contentId: string = '' |
| 15 | private relType: string = '' | 19 | private relType: string = '' |
| 16 | //出参 | 20 | //出参 |
| 17 | - @State contentDetailData: ContentDetailDTO[] = [] as ContentDetailDTO[] | 21 | + @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 22 | + //变量 | ||
| 23 | + /** | ||
| 24 | + * 默认未关注 点击去关注 | ||
| 25 | + */ | ||
| 26 | + private followStatus: String = '0'; | ||
| 27 | + @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | ||
| 18 | 28 | ||
| 29 | + //跳转 | ||
| 30 | + private mJumpInfo: ContentDTO = {} as ContentDTO; | ||
| 19 | 31 | ||
| 20 | async aboutToAppear() { | 32 | async aboutToAppear() { |
| 21 | await this.getContentDetailData() | 33 | await this.getContentDetailData() |
| @@ -27,18 +39,406 @@ export struct DynamicDetailComponent { | @@ -27,18 +39,406 @@ export struct DynamicDetailComponent { | ||
| 27 | build() { | 39 | build() { |
| 28 | Row() { | 40 | Row() { |
| 29 | Column(){ | 41 | Column(){ |
| 30 | - Text("this is a test!") | 42 | + //logo、日期 |
| 43 | + Row() { | ||
| 44 | + Image($r('app.media.ic_article_rmh')) | ||
| 45 | + .width($r('app.float.margin_80')) | ||
| 46 | + .height($r('app.float.margin_28')) | ||
| 47 | + .margin({ left: $r('app.float.margin_16') }) | ||
| 48 | + Blank() | ||
| 49 | + Text("2023年03月14日 08:16") | ||
| 50 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 51 | + .fontSize($r('app.float.font_size_12')) | ||
| 52 | + .lineHeight($r('app.float.margin_28')) | ||
| 53 | + .margin({ right: $r('app.float.margin_16') }) | ||
| 54 | + } | ||
| 55 | + .height($r('app.float.margin_48')) | ||
| 56 | + .width('100%') | ||
| 57 | + //分割线 | ||
| 58 | + Image($r('app.media.ic_news_detail_division')) | ||
| 59 | + .width('100%') | ||
| 60 | + .height($r('app.float.margin_7')) | ||
| 61 | + .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); | ||
| 144 | + } | ||
| 145 | + }) | ||
| 146 | + } | ||
| 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 | + } | ||
| 31 | } | 155 | } |
| 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) | ||
| 32 | } | 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 | + //评论组件/底部组件 | ||
| 33 | 195 | ||
| 34 | } | 196 | } |
| 197 | + } | ||
| 198 | + .backgroundColor('#FFFFFFFF') | ||
| 199 | + } | ||
| 200 | + /** | ||
| 201 | + * 请求(动态)详情页数据 | ||
| 202 | + * */ | ||
| 35 | private async getContentDetailData() { | 203 | private async getContentDetailData() { |
| 36 | try { | 204 | try { |
| 37 | let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) | 205 | let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) |
| 38 | - this.contentDetailData = data; | 206 | + this.contentDetailData = data[0]; |
| 207 | + this.makeJumpInfo | ||
| 39 | console.log('动态详情',JSON.stringify(this.contentDetailData)) | 208 | console.log('动态详情',JSON.stringify(this.contentDetailData)) |
| 40 | } catch (exception) { | 209 | } catch (exception) { |
| 41 | console.log('请求失败',JSON.stringify(exception)) | 210 | console.log('请求失败',JSON.stringify(exception)) |
| 42 | } | 211 | } |
| 212 | + this.getBatchAttentionStatus | ||
| 213 | + this.getInteractDataStatus | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + // 查询当前登录用户点赞状态 | ||
| 217 | + private async getInteractDataStatus() { | ||
| 218 | + //未登录 | ||
| 219 | + if(!AccountManagerUtils.isLoginSync() || this.contentDetailData?.openLikes != 1){ | ||
| 220 | + return | ||
| 221 | + } | ||
| 222 | + try { | ||
| 223 | + const params: batchLikeAndCollectParams = { | ||
| 224 | + contentList: [ | ||
| 225 | + { | ||
| 226 | + contentId: this.contentDetailData?.newsId + '', | ||
| 227 | + contentType: this.contentDetailData?.newsType + '', | ||
| 228 | + } | ||
| 229 | + ] | ||
| 230 | + } | ||
| 231 | + console.error(TAG, JSON.stringify(this.contentDetailData)) | ||
| 232 | + let data = await MultiPictureDetailViewModel.getInteractDataStatus(params) | ||
| 233 | + console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data)) | ||
| 234 | + this.newsStatusOfUser = data[0]; | ||
| 235 | + Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`) | ||
| 236 | + } catch (exception) { | ||
| 237 | + console.error(TAG, JSON.stringify(exception)) | ||
| 238 | + } | ||
| 239 | + } | ||
| 240 | + | ||
| 241 | + /** | ||
| 242 | + * 查询当前登录用户是否关注作品号主 | ||
| 243 | + * */ | ||
| 244 | + private async getBatchAttentionStatus() { | ||
| 245 | + try { | ||
| 246 | + const params: postBatchAttentionStatusParams = { | ||
| 247 | + creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }] | ||
| 248 | + } | ||
| 249 | + let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params) | ||
| 250 | + this.followStatus = data[0]?.status; | ||
| 251 | + Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`) | ||
| 252 | + } catch (exception) { | ||
| 253 | + | ||
| 254 | + } | ||
| 255 | + } | ||
| 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 | + | ||
| 299 | + //创建跳转信息 | ||
| 300 | + 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+""; | ||
| 306 | + } | ||
| 307 | + | ||
| 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 | + } | ||
| 417 | + } 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); | ||
| 439 | + } else { | ||
| 440 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 4); | ||
| 441 | + } | ||
| 442 | + } | ||
| 43 | } | 443 | } |
| 44 | } | 444 | } |
| @@ -2,6 +2,7 @@ import { Action, NewspaperListItemBean, NewspaperPositionItemBean, Params } from | @@ -2,6 +2,7 @@ import { Action, NewspaperListItemBean, NewspaperPositionItemBean, Params } from | ||
| 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 { StringUtils } from 'wdKit'; | 3 | import { StringUtils } from 'wdKit'; |
| 4 | import { WDRouterRule } from 'wdRouter'; | 4 | import { WDRouterRule } from 'wdRouter'; |
| 5 | +import { newsSkeleton } from './skeleton/newsSkeleton'; | ||
| 5 | 6 | ||
| 6 | @Component | 7 | @Component |
| 7 | export struct ENewspaperItemComponent { | 8 | export struct ENewspaperItemComponent { |
| @@ -11,13 +12,20 @@ export struct ENewspaperItemComponent { | @@ -11,13 +12,20 @@ export struct ENewspaperItemComponent { | ||
| 11 | private startX: number = 0 | 12 | private startX: number = 0 |
| 12 | private startY: number = 0 | 13 | private startY: number = 0 |
| 13 | private itemBeanClicked: NewspaperPositionItemBean = {} as NewspaperPositionItemBean | 14 | private itemBeanClicked: NewspaperPositionItemBean = {} as NewspaperPositionItemBean |
| 15 | + @State isShowSkeleton: boolean = true | ||
| 14 | 16 | ||
| 15 | build() { | 17 | build() { |
| 16 | Stack() { | 18 | Stack() { |
| 19 | + newsSkeleton() | ||
| 20 | + .visibility(this.isShowSkeleton ? Visibility.Visible : Visibility.None) | ||
| 17 | Image(this.newspaperListItemBean.pagePic) | 21 | Image(this.newspaperListItemBean.pagePic) |
| 18 | .width('100%') | 22 | .width('100%') |
| 19 | .aspectRatio(378 / 566) | 23 | .aspectRatio(378 / 566) |
| 20 | .objectFit(ImageFit.Fill) | 24 | .objectFit(ImageFit.Fill) |
| 25 | + .onComplete(() => { | ||
| 26 | + this.isShowSkeleton = false | ||
| 27 | + }) | ||
| 28 | + .visibility(this.isShowSkeleton ? Visibility.None : Visibility.Visible) | ||
| 21 | 29 | ||
| 22 | Canvas(this.context) | 30 | Canvas(this.context) |
| 23 | .width('100%') | 31 | .width('100%') |
| @@ -62,7 +70,7 @@ export struct ENewspaperItemComponent { | @@ -62,7 +70,7 @@ export struct ENewspaperItemComponent { | ||
| 62 | pageID: 'IMAGE_TEXT_DETAIL', | 70 | pageID: 'IMAGE_TEXT_DETAIL', |
| 63 | extra: { | 71 | extra: { |
| 64 | relType: this.itemBeanClicked.relType ?? '', | 72 | relType: this.itemBeanClicked.relType ?? '', |
| 65 | - relId: ''+this.itemBeanClicked.relId, | 73 | + relId: '' + this.itemBeanClicked.relId, |
| 66 | sourcePage: '5' | 74 | sourcePage: '5' |
| 67 | } as ExtraDTO | 75 | } as ExtraDTO |
| 68 | } as Params, | 76 | } as Params, |
| @@ -8,6 +8,7 @@ import { ENewspaperCalendarDialog } from '../dialog/ENewspaperCalendarDialog'; | @@ -8,6 +8,7 @@ import { ENewspaperCalendarDialog } from '../dialog/ENewspaperCalendarDialog'; | ||
| 8 | import font from '@ohos.font'; | 8 | import font from '@ohos.font'; |
| 9 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'; | 9 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'; |
| 10 | import { RMCalendarBean } from './calendar/RMCalendarBean'; | 10 | import { RMCalendarBean } from './calendar/RMCalendarBean'; |
| 11 | +import { newsSkeleton } from './skeleton/newsSkeleton'; | ||
| 11 | 12 | ||
| 12 | @Component | 13 | @Component |
| 13 | export struct ENewspaperPageComponent { | 14 | export struct ENewspaperPageComponent { |
| @@ -63,13 +64,15 @@ export struct ENewspaperPageComponent { | @@ -63,13 +64,15 @@ export struct ENewspaperPageComponent { | ||
| 63 | customStyle: true, | 64 | customStyle: true, |
| 64 | }) | 65 | }) |
| 65 | //文字报纸弹框 | 66 | //文字报纸弹框 |
| 66 | - listDialogController: CustomDialogController = new CustomDialogController({ | ||
| 67 | - builder: ENewspaperListDialog({ | ||
| 68 | - newspaperListBean: this.newspaperListBean | ||
| 69 | - }), | ||
| 70 | - alignment: DialogAlignment.Bottom, | ||
| 71 | - offset: { dx: 0, dy: 0 } | ||
| 72 | - }) | 67 | + @State isOpenListDialog: boolean = false |
| 68 | + | ||
| 69 | + // listDialogController: CustomDialogController = new CustomDialogController({ | ||
| 70 | + // builder: ENewspaperListDialog({ | ||
| 71 | + // newspaperListBean: this.newspaperListBean | ||
| 72 | + // }), | ||
| 73 | + // alignment: DialogAlignment.Bottom, | ||
| 74 | + // offset: { dx: 0, dy: 0 } | ||
| 75 | + // }) | ||
| 73 | 76 | ||
| 74 | async aboutToAppear() { | 77 | async aboutToAppear() { |
| 75 | //获取宽高尺寸 | 78 | //获取宽高尺寸 |
| @@ -95,6 +98,7 @@ export struct ENewspaperPageComponent { | @@ -95,6 +98,7 @@ export struct ENewspaperPageComponent { | ||
| 95 | } | 98 | } |
| 96 | 99 | ||
| 97 | build() { | 100 | build() { |
| 101 | + Stack() { | ||
| 98 | RelativeContainer() { | 102 | RelativeContainer() { |
| 99 | RelativeContainer() { | 103 | RelativeContainer() { |
| 100 | Image($r('app.media.icon_arrow_down')) | 104 | Image($r('app.media.icon_arrow_down')) |
| @@ -110,11 +114,11 @@ export struct ENewspaperPageComponent { | @@ -110,11 +114,11 @@ export struct ENewspaperPageComponent { | ||
| 110 | }) | 114 | }) |
| 111 | 115 | ||
| 112 | Row() { | 116 | Row() { |
| 113 | - Text(this.calendarDate) | 117 | + Text(this.calendarDate?.replace('-', '.')?.replace('-', '.')) |
| 114 | .fontSize($r('app.float.font_size_20')) | 118 | .fontSize($r('app.float.font_size_20')) |
| 115 | .fontColor($r('app.color.white')) | 119 | .fontColor($r('app.color.white')) |
| 116 | .fontFamily('BebasNeue_Regular') | 120 | .fontFamily('BebasNeue_Regular') |
| 117 | - .fontWeight(FontWeight.Bold) | 121 | + .fontWeight(FontWeight.Regular) |
| 118 | 122 | ||
| 119 | Image($r('app.media.icon_triangle')) | 123 | Image($r('app.media.icon_triangle')) |
| 120 | .width($r('app.float.border_radius_6')) | 124 | .width($r('app.float.border_radius_6')) |
| @@ -154,6 +158,18 @@ export struct ENewspaperPageComponent { | @@ -154,6 +158,18 @@ export struct ENewspaperPageComponent { | ||
| 154 | }) | 158 | }) |
| 155 | .id('e_newspaper_top') | 159 | .id('e_newspaper_top') |
| 156 | 160 | ||
| 161 | + if (!this.newspaperListBean || !this.newspaperListBean.list || this.newspaperListBean.list.length == 0) { | ||
| 162 | + newsSkeleton() | ||
| 163 | + .alignRules({ | ||
| 164 | + top: { anchor: "e_newspaper_top", align: VerticalAlign.Bottom }, | ||
| 165 | + middle: { anchor: "__container__", align: HorizontalAlign.Center } | ||
| 166 | + }) | ||
| 167 | + .id('news_skeleton_id') | ||
| 168 | + .width('100%') | ||
| 169 | + .height(px2vp(this.picHeight) + 32) | ||
| 170 | + .margin({ top: 35, left: 10, right: 10 }) | ||
| 171 | + } | ||
| 172 | + | ||
| 157 | if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { | 173 | if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { |
| 158 | Swiper(this.swiperController) { | 174 | Swiper(this.swiperController) { |
| 159 | ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => { | 175 | ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => { |
| @@ -167,6 +183,7 @@ export struct ENewspaperPageComponent { | @@ -167,6 +183,7 @@ export struct ENewspaperPageComponent { | ||
| 167 | .autoPlay(false) | 183 | .autoPlay(false) |
| 168 | .cachedCount(3) | 184 | .cachedCount(3) |
| 169 | .indicator(false) | 185 | .indicator(false) |
| 186 | + .loop(false) | ||
| 170 | .displayCount(1) | 187 | .displayCount(1) |
| 171 | .margin({ top: 35, left: 10, right: 10 }) | 188 | .margin({ top: 35, left: 10, right: 10 }) |
| 172 | .id('e_newspaper_content') | 189 | .id('e_newspaper_content') |
| @@ -191,12 +208,13 @@ export struct ENewspaperPageComponent { | @@ -191,12 +208,13 @@ export struct ENewspaperPageComponent { | ||
| 191 | .id('e_newspaper_shadow') | 208 | .id('e_newspaper_shadow') |
| 192 | 209 | ||
| 193 | Row() { | 210 | Row() { |
| 194 | - Text('滑动查看下一版') | 211 | + Text(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? '已到底部,可以选择其他日期' : '滑动查看下一版') |
| 195 | .fontColor(Color.White) | 212 | .fontColor(Color.White) |
| 196 | .fontSize($r('app.float.font_size_14')) | 213 | .fontSize($r('app.float.font_size_14')) |
| 197 | Image($r('app.media.icon_next_page')) | 214 | Image($r('app.media.icon_next_page')) |
| 198 | .width($r('app.float.vp_16')) | 215 | .width($r('app.float.vp_16')) |
| 199 | .height($r('app.float.vp_16')) | 216 | .height($r('app.float.vp_16')) |
| 217 | + .visibility(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? Visibility.None : Visibility.Visible) | ||
| 200 | } | 218 | } |
| 201 | .justifyContent(FlexAlign.Center) | 219 | .justifyContent(FlexAlign.Center) |
| 202 | .margin({ top: $r('app.float.margin_16') }) | 220 | .margin({ top: $r('app.float.margin_16') }) |
| @@ -264,13 +282,23 @@ export struct ENewspaperPageComponent { | @@ -264,13 +282,23 @@ export struct ENewspaperPageComponent { | ||
| 264 | }) | 282 | }) |
| 265 | .id('e_newspaper_read') | 283 | .id('e_newspaper_read') |
| 266 | .onClick((event: ClickEvent) => { | 284 | .onClick((event: ClickEvent) => { |
| 267 | - this.listDialogController.open() | 285 | + this.isOpenListDialog = true |
| 268 | }) | 286 | }) |
| 269 | } | 287 | } |
| 270 | .width('100%') | 288 | .width('100%') |
| 271 | .height('100%') | 289 | .height('100%') |
| 272 | .backgroundColor($r('app.color.color_80000000')) | 290 | .backgroundColor($r('app.color.color_80000000')) |
| 273 | .id('e_newspaper_container') | 291 | .id('e_newspaper_container') |
| 292 | + | ||
| 293 | + ENewspaperListDialog({ | ||
| 294 | + newspaperListBean: this.newspaperListBean, | ||
| 295 | + closeDialog: () => { | ||
| 296 | + this.isOpenListDialog = false | ||
| 297 | + } | ||
| 298 | + }) | ||
| 299 | + .visibility(this.isOpenListDialog ? Visibility.Visible : Visibility.None) | ||
| 300 | + } | ||
| 301 | + | ||
| 274 | } | 302 | } |
| 275 | 303 | ||
| 276 | private async getNewspaperTime() { | 304 | private async getNewspaperTime() { |
| 1 | -import { Logger, NumberFormatterUtils } from 'wdKit'; | 1 | +import { Logger, NumberFormatterUtils, DateTimeUtils } from 'wdKit'; |
| 2 | import { | 2 | import { |
| 3 | Action, | 3 | Action, |
| 4 | ContentDetailDTO, | 4 | ContentDetailDTO, |
| @@ -14,14 +14,15 @@ import DetailViewModel from '../viewmodel/DetailViewModel'; | @@ -14,14 +14,15 @@ import DetailViewModel from '../viewmodel/DetailViewModel'; | ||
| 14 | import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; | 14 | import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; |
| 15 | import router from '@ohos.router'; | 15 | import router from '@ohos.router'; |
| 16 | import { RecommendList } from '../components/view/RecommendList' | 16 | import { RecommendList } from '../components/view/RecommendList' |
| 17 | -import { CommonConstants } from 'wdConstant' | 17 | +import { CommonConstants } from 'wdConstant'; |
| 18 | import { HttpUrlUtils } from 'wdNetwork/Index'; | 18 | import { HttpUrlUtils } from 'wdNetwork/Index'; |
| 19 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 19 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 20 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 20 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 21 | import { PageRepository } from '../repository/PageRepository'; | 21 | import { PageRepository } from '../repository/PageRepository'; |
| 22 | +import { detailedSkeleton } from './skeleton/detailSkeleton'; | ||
| 23 | +const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | ||
| 22 | 24 | ||
| 23 | const TAG = 'ImageAndTextPageComponent' | 25 | const TAG = 'ImageAndTextPageComponent' |
| 24 | - | ||
| 25 | @Component | 26 | @Component |
| 26 | export struct ImageAndTextPageComponent { | 27 | export struct ImageAndTextPageComponent { |
| 27 | scroller: Scroller = new Scroller(); | 28 | scroller: Scroller = new Scroller(); |
| @@ -30,14 +31,19 @@ export struct ImageAndTextPageComponent { | @@ -30,14 +31,19 @@ export struct ImageAndTextPageComponent { | ||
| 30 | @State recommendList: ContentDTO[] = [] | 31 | @State recommendList: ContentDTO[] = [] |
| 31 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | 32 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 |
| 32 | @State interactData: InteractDataDTO = {} as InteractDataDTO | 33 | @State interactData: InteractDataDTO = {} as InteractDataDTO |
| 34 | + @State isPageEnd: boolean = false | ||
| 35 | + @State publishTime: string = '' | ||
| 33 | build() { | 36 | build() { |
| 34 | Column() { | 37 | Column() { |
| 38 | + if (!this.isPageEnd) { | ||
| 39 | + detailedSkeleton() | ||
| 40 | + } else { | ||
| 35 | // 发布时间 | 41 | // 发布时间 |
| 36 | Row() { | 42 | Row() { |
| 37 | - Image($r('app.media.icon_ren_min_ri_bao')) | ||
| 38 | - .width(70) | 43 | + Image(this.contentDetailData[0]?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb')) |
| 44 | + .width(80) | ||
| 39 | .height(28) | 45 | .height(28) |
| 40 | - Text(this.contentDetailData[0]?.publishTime) | 46 | + Text(this.publishTime) |
| 41 | .fontColor($r('app.color.color_B0B0B0')) | 47 | .fontColor($r('app.color.color_B0B0B0')) |
| 42 | .fontSize($r('app.float.font_size_13')) | 48 | .fontSize($r('app.float.font_size_13')) |
| 43 | .height('100%') | 49 | .height('100%') |
| @@ -58,13 +64,16 @@ export struct ImageAndTextPageComponent { | @@ -58,13 +64,16 @@ export struct ImageAndTextPageComponent { | ||
| 58 | } | 64 | } |
| 59 | .padding({ left: 15, right: 15 }) | 65 | .padding({ left: 15, right: 15 }) |
| 60 | .backgroundColor(Color.White) | 66 | .backgroundColor(Color.White) |
| 67 | + } | ||
| 68 | + | ||
| 61 | 69 | ||
| 62 | Stack({ alignContent: Alignment.Bottom }) { | 70 | Stack({ alignContent: Alignment.Bottom }) { |
| 63 | Scroll(this.scroller) { | 71 | Scroll(this.scroller) { |
| 64 | Column() { | 72 | Column() { |
| 65 | ImageAndTextWebComponent({ | 73 | ImageAndTextWebComponent({ |
| 66 | contentDetailData: this.contentDetailData, | 74 | contentDetailData: this.contentDetailData, |
| 67 | - action: this.action | 75 | + action: this.action, |
| 76 | + isPageEnd: $isPageEnd | ||
| 68 | }) | 77 | }) |
| 69 | Column() { | 78 | Column() { |
| 70 | if (this.recommendList.length > 0) { | 79 | if (this.recommendList.length > 0) { |
| @@ -77,7 +86,7 @@ export struct ImageAndTextPageComponent { | @@ -77,7 +86,7 @@ export struct ImageAndTextPageComponent { | ||
| 77 | .width(CommonConstants.FULL_WIDTH) | 86 | .width(CommonConstants.FULL_WIDTH) |
| 78 | .height(CommonConstants.FULL_HEIGHT) | 87 | .height(CommonConstants.FULL_HEIGHT) |
| 79 | .padding({ bottom: 76 }) | 88 | .padding({ bottom: 76 }) |
| 80 | - // .scrollBar(BarState.Off) | 89 | + .scrollBar(BarState.Off) |
| 81 | 90 | ||
| 82 | //底部交互区 | 91 | //底部交互区 |
| 83 | Row() { | 92 | Row() { |
| @@ -122,138 +131,6 @@ export struct ImageAndTextPageComponent { | @@ -122,138 +131,6 @@ export struct ImageAndTextPageComponent { | ||
| 122 | .height(CommonConstants.FULL_HEIGHT) | 131 | .height(CommonConstants.FULL_HEIGHT) |
| 123 | } | 132 | } |
| 124 | 133 | ||
| 125 | - // build() { | ||
| 126 | - // Column() { | ||
| 127 | - // // 发布时间 | ||
| 128 | - // Row() { | ||
| 129 | - // Image($r('app.media.icon_ren_min_ri_bao')) | ||
| 130 | - // .width(70) | ||
| 131 | - // .height(28) | ||
| 132 | - // Text(this.contentDetailData[0]?.publishTime) | ||
| 133 | - // .fontColor($r('app.color.color_B0B0B0')) | ||
| 134 | - // .fontSize($r('app.float.font_size_13')) | ||
| 135 | - // .height('100%') | ||
| 136 | - // .align(Alignment.End) | ||
| 137 | - // } | ||
| 138 | - // .width(CommonConstants.FULL_WIDTH) | ||
| 139 | - // .height(32) | ||
| 140 | - // .padding({ left: 15, right: 15, }) | ||
| 141 | - // .justifyContent(FlexAlign.SpaceBetween) | ||
| 142 | - // .backgroundColor(Color.White) | ||
| 143 | - // | ||
| 144 | - // Row() { | ||
| 145 | - // Image($r('app.media.line')) | ||
| 146 | - // .width('100%') | ||
| 147 | - // .height(6) | ||
| 148 | - // .objectFit(ImageFit.Cover) | ||
| 149 | - // .margin({ top: 10 }) | ||
| 150 | - // } | ||
| 151 | - // .padding({ left: 15, right: 15, }) | ||
| 152 | - // .backgroundColor(Color.White) | ||
| 153 | - // | ||
| 154 | - // Stack({ alignContent: Alignment.Bottom }) { | ||
| 155 | - // | ||
| 156 | - // List() { | ||
| 157 | - // //详情展示区 | ||
| 158 | - // ListItem() { | ||
| 159 | - // Column() { | ||
| 160 | - // ImageAndTextWebComponent({ | ||
| 161 | - // contentDetailData: this.contentDetailData, | ||
| 162 | - // action: this.action, | ||
| 163 | - // }) | ||
| 164 | - // }.width(CommonConstants.FULL_WIDTH) | ||
| 165 | - // // .height(CommonConstants.FULL_HEIGHT) | ||
| 166 | - // } | ||
| 167 | - // | ||
| 168 | - // if (this.contentDetailData[0]?.openLikes === 1) { | ||
| 169 | - // ListItem() { | ||
| 170 | - // // 点赞 | ||
| 171 | - // Row() { | ||
| 172 | - // Row() { | ||
| 173 | - // if (this.newsStatusOfUser?.likeStatus === '1') { | ||
| 174 | - // Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : $r('app.media.icon_candle_active'))) | ||
| 175 | - // .width(24) | ||
| 176 | - // .height(24) | ||
| 177 | - // .margin({ right: 5 }) | ||
| 178 | - // } else { | ||
| 179 | - // Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : $r('app.media.icon_candle'))) | ||
| 180 | - // .width(24) | ||
| 181 | - // .height(24) | ||
| 182 | - // .margin({ right: 5 }) | ||
| 183 | - // } | ||
| 184 | - // Text(`${this.interactData?.likeNum || 0}`) | ||
| 185 | - // .fontSize(16) | ||
| 186 | - // .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999') | ||
| 187 | - // .fontWeight(500) | ||
| 188 | - // }.alignItems(VerticalAlign.Center) | ||
| 189 | - // .onClick(() => { | ||
| 190 | - // this.toggleLikeStatus() | ||
| 191 | - // }) | ||
| 192 | - // | ||
| 193 | - // }.width(CommonConstants.FULL_WIDTH).height(80) | ||
| 194 | - // .justifyContent(FlexAlign.Center) | ||
| 195 | - // } | ||
| 196 | - // .border({ | ||
| 197 | - // width: { bottom: 5 }, | ||
| 198 | - // color: '#f5f5f5', | ||
| 199 | - // }) | ||
| 200 | - // } | ||
| 201 | - // | ||
| 202 | - // // 相关推荐区 | ||
| 203 | - // ListItem() { | ||
| 204 | - // RecommendList({ recommendList: this.recommendList }) | ||
| 205 | - // } | ||
| 206 | - // } | ||
| 207 | - // .width(CommonConstants.FULL_WIDTH) | ||
| 208 | - // .height(CommonConstants.FULL_HEIGHT) | ||
| 209 | - // .padding({ bottom: 56 }) | ||
| 210 | - // .scrollBar(BarState.Off) | ||
| 211 | - // .edgeEffect(EdgeEffect.None) | ||
| 212 | - // | ||
| 213 | - // //底部交互区 | ||
| 214 | - // Row() { | ||
| 215 | - // Image($r('app.media.icon_arrow_left')) | ||
| 216 | - // .width(24) | ||
| 217 | - // .height(24) | ||
| 218 | - // .onClick((event: ClickEvent) => { | ||
| 219 | - // router.back() | ||
| 220 | - // }) | ||
| 221 | - // | ||
| 222 | - // Row() { | ||
| 223 | - // Image($r('app.media.icon_comment')) | ||
| 224 | - // .width(24) | ||
| 225 | - // .height(24) | ||
| 226 | - // .margin({ right: 24 }) | ||
| 227 | - // .id('comment') | ||
| 228 | - // | ||
| 229 | - // Image($r('app.media.icon_star')) | ||
| 230 | - // .width(24) | ||
| 231 | - // .height(24) | ||
| 232 | - // .margin({ right: 24 }) | ||
| 233 | - // | ||
| 234 | - // Image($r('app.media.icon_listen')) | ||
| 235 | - // .width(24) | ||
| 236 | - // .height(24) | ||
| 237 | - // .margin({ right: 24 }) | ||
| 238 | - // | ||
| 239 | - // Image($r('app.media.icon_forward')) | ||
| 240 | - // .width(24) | ||
| 241 | - // .height(24) | ||
| 242 | - // | ||
| 243 | - // } | ||
| 244 | - // } | ||
| 245 | - // .width(CommonConstants.FULL_WIDTH) | ||
| 246 | - // .height(56) | ||
| 247 | - // .padding({ left: 15, right: 15, bottom: 50, top: 20 }) | ||
| 248 | - // .justifyContent(FlexAlign.SpaceBetween) | ||
| 249 | - // .backgroundColor(Color.White) | ||
| 250 | - // } | ||
| 251 | - // | ||
| 252 | - // }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | ||
| 253 | - // .backgroundColor(Color.White) | ||
| 254 | - // | ||
| 255 | - // } | ||
| 256 | - | ||
| 257 | private async getDetail() { | 134 | private async getDetail() { |
| 258 | let contentId: string = '' | 135 | let contentId: string = '' |
| 259 | let relId: string = '' | 136 | let relId: string = '' |
| @@ -274,6 +151,8 @@ export struct ImageAndTextPageComponent { | @@ -274,6 +151,8 @@ export struct ImageAndTextPageComponent { | ||
| 274 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) | 151 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) |
| 275 | if (detailBeans && detailBeans.length > 0) { | 152 | if (detailBeans && detailBeans.length > 0) { |
| 276 | this.contentDetailData = detailBeans; | 153 | this.contentDetailData = detailBeans; |
| 154 | + let dateTime = DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN); | ||
| 155 | + this.publishTime = DateTimeUtils.formatDate(dateTime,PATTERN_DATE_CN_RN) | ||
| 277 | if (this.contentDetailData[0]?.recommendShow === 1) { | 156 | if (this.contentDetailData[0]?.recommendShow === 1) { |
| 278 | this.getRecommend() | 157 | this.getRecommend() |
| 279 | } | 158 | } |
| @@ -15,8 +15,12 @@ import { BridgeWebViewControl } from 'wdJsBridge/Index'; | @@ -15,8 +15,12 @@ import { BridgeWebViewControl } from 'wdJsBridge/Index'; | ||
| 15 | export struct ImageAndTextWebComponent { | 15 | export struct ImageAndTextWebComponent { |
| 16 | action: Action = {} as Action | 16 | action: Action = {} as Action |
| 17 | @State reload: number = 0; | 17 | @State reload: number = 0; |
| 18 | + @Link isPageEnd: boolean | ||
| 18 | @Prop @Watch('onDetailDataUpdated') contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO [] | 19 | @Prop @Watch('onDetailDataUpdated') contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO [] |
| 19 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | 20 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() |
| 21 | + private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean | ||
| 22 | + private webPrepared = false; | ||
| 23 | + private dataPrepared = false; | ||
| 20 | 24 | ||
| 21 | onDetailDataUpdated() { | 25 | onDetailDataUpdated() { |
| 22 | if (this.action) { | 26 | if (this.action) { |
| @@ -50,9 +54,14 @@ export struct ImageAndTextWebComponent { | @@ -50,9 +54,14 @@ export struct ImageAndTextWebComponent { | ||
| 50 | 54 | ||
| 51 | } | 55 | } |
| 52 | 56 | ||
| 53 | - let h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean | ||
| 54 | // TODO 对接user信息、登录情况 | 57 | // TODO 对接user信息、登录情况 |
| 55 | - let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { creatorId: '', isLogin: '0' } as H5ReceiveDataExtraBean | 58 | + let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { |
| 59 | + creatorId: '', | ||
| 60 | + isLogin: '0', | ||
| 61 | + networkStatus: 1, | ||
| 62 | + loadImageOnlyWifiSwitch: '2', | ||
| 63 | + | ||
| 64 | + } as H5ReceiveDataExtraBean | ||
| 56 | let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = { | 65 | let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = { |
| 57 | contentId: contentId, | 66 | contentId: contentId, |
| 58 | contentType: contentType | 67 | contentType: contentType |
| @@ -67,12 +76,10 @@ export struct ImageAndTextWebComponent { | @@ -67,12 +76,10 @@ export struct ImageAndTextWebComponent { | ||
| 67 | response.code = 200 | 76 | response.code = 200 |
| 68 | response.success = true | 77 | response.success = true |
| 69 | h5ReceiveDataJsonBean.responseMap = response | 78 | h5ReceiveDataJsonBean.responseMap = response |
| 70 | - h5ReceiveAppData.dataJson = h5ReceiveDataJsonBean | ||
| 71 | - h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean | ||
| 72 | - // TODO 暂延时1s,考虑业务流程再优化 | ||
| 73 | - setTimeout(() => { | ||
| 74 | - this.sendContentData2H5(h5ReceiveAppData); | ||
| 75 | - }, 2000) | 79 | + this.h5ReceiveAppData.dataJson = h5ReceiveDataJsonBean |
| 80 | + this.h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean | ||
| 81 | + this.dataPrepared = true | ||
| 82 | + this.trySendData2H5() | ||
| 76 | 83 | ||
| 77 | } | 84 | } |
| 78 | 85 | ||
| @@ -84,10 +91,26 @@ export struct ImageAndTextWebComponent { | @@ -84,10 +91,26 @@ export struct ImageAndTextWebComponent { | ||
| 84 | webviewControl: this.webviewControl, | 91 | webviewControl: this.webviewControl, |
| 85 | webResource: $rawfile('apph5/index.html'), | 92 | webResource: $rawfile('apph5/index.html'), |
| 86 | backVisibility: false, | 93 | backVisibility: false, |
| 94 | + onWebPrepared: this.onWebPrepared.bind(this), | ||
| 95 | + isPageEnd: $isPageEnd | ||
| 96 | + | ||
| 87 | }) | 97 | }) |
| 88 | } | 98 | } |
| 89 | } | 99 | } |
| 90 | 100 | ||
| 101 | + private trySendData2H5() { | ||
| 102 | + if (!this.webPrepared || !this.dataPrepared) { | ||
| 103 | + return | ||
| 104 | + } | ||
| 105 | + // 数据、web组件,都准备好了,开始塞详情数据 | ||
| 106 | + this.sendContentData2H5(this.h5ReceiveAppData) | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + private onWebPrepared() { | ||
| 110 | + this.webPrepared = true | ||
| 111 | + this.trySendData2H5() | ||
| 112 | + } | ||
| 113 | + | ||
| 91 | private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) { | 114 | private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) { |
| 92 | Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData'); | 115 | Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData'); |
| 93 | this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData, | 116 | this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData, |
| 1 | +import { abilityAccessCtrl, common, Permissions } from '@kit.AbilityKit'; | ||
| 2 | +import { http } from '@kit.NetworkKit'; | ||
| 3 | +import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 4 | +import { promptAction } from '@kit.ArkUI'; | ||
| 5 | +import { image } from '@kit.ImageKit'; | ||
| 6 | +import { photoAccessHelper } from '@kit.MediaLibraryKit'; | ||
| 7 | +import fs from '@ohos.file.fs'; | ||
| 8 | + | ||
| 9 | +const PERMISSIONS: Array<Permissions> = [ | ||
| 10 | + 'ohos.permission.READ_IMAGEVIDEO', | ||
| 11 | + 'ohos.permission.WRITE_IMAGEVIDEO' | ||
| 12 | +]; | ||
| 13 | + | ||
| 14 | +/* | ||
| 15 | + * saveButton参考文档 | ||
| 16 | + * https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/savebutton-0000001820999677 | ||
| 17 | + * */ | ||
| 18 | +@Component | ||
| 19 | +export struct ImageDownloadComponent { | ||
| 20 | + @State image: PixelMap | undefined = undefined; | ||
| 21 | + @State photoAccessHelper: photoAccessHelper.PhotoAccessHelper | undefined = undefined; // 相册模块管理实例 | ||
| 22 | + @State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer | ||
| 23 | + url: string = '' | ||
| 24 | + | ||
| 25 | + build() { | ||
| 26 | + Column() { | ||
| 27 | + SaveButton({ icon: SaveIconStyle.LINES }) | ||
| 28 | + .iconColor(Color.White) | ||
| 29 | + .onClick(async () => { | ||
| 30 | + console.info(`cj2024 onClick ${this.imageBuffer}`) | ||
| 31 | + if (this.imageBuffer !== undefined) { | ||
| 32 | + await this.saveImage(this.imageBuffer); | ||
| 33 | + promptAction.showToast({ | ||
| 34 | + message: $r('app.string.image_request_success'), | ||
| 35 | + duration: 2000 | ||
| 36 | + }) | ||
| 37 | + } | ||
| 38 | + }) | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + async aboutToAppear(): Promise<void> { | ||
| 44 | + console.info(`cj2024 图片下载 ${this.url}`) | ||
| 45 | + const context = getContext(this) as common.UIAbilityContext; | ||
| 46 | + const atManager = abilityAccessCtrl.createAtManager(); | ||
| 47 | + await atManager.requestPermissionsFromUser(context, PERMISSIONS); | ||
| 48 | + this.getPicture(); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * 通过http的request方法从网络下载图片资源 | ||
| 53 | + */ | ||
| 54 | + async getPicture() { | ||
| 55 | + console.info(`cj2024 getPicture`) | ||
| 56 | + http.createHttp() | ||
| 57 | + .request(this.url, | ||
| 58 | + (error: BusinessError, data: http.HttpResponse) => { | ||
| 59 | + if (error) { | ||
| 60 | + // 下载失败时弹窗提示检查网络,不执行后续逻辑 | ||
| 61 | + promptAction.showToast({ | ||
| 62 | + message: $r('app.string.image_request_fail'), | ||
| 63 | + duration: 2000 | ||
| 64 | + }) | ||
| 65 | + return; | ||
| 66 | + } | ||
| 67 | + this.transcodePixelMap(data); | ||
| 68 | + // 判断网络获取到的资源是否为ArrayBuffer类型 | ||
| 69 | + console.info(`cj2024 getPicture ${data.result}`) | ||
| 70 | + if (data.result instanceof ArrayBuffer) { | ||
| 71 | + console.info(`cj2024 getPicture 222`) | ||
| 72 | + this.imageBuffer = data.result as ArrayBuffer; | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + ) | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * 使用createPixelMap将ArrayBuffer类型的图片装换为PixelMap类型 | ||
| 80 | + * @param data:网络获取到的资源 | ||
| 81 | + */ | ||
| 82 | + transcodePixelMap(data: http.HttpResponse) { | ||
| 83 | + console.info(`cj2024 transcodePixelMap ${data.responseCode}`) | ||
| 84 | + if (http.ResponseCode.OK === data.responseCode) { | ||
| 85 | + const imageData: ArrayBuffer = data.result as ArrayBuffer; | ||
| 86 | + // 通过ArrayBuffer创建图片源实例。 | ||
| 87 | + const imageSource: image.ImageSource = image.createImageSource(imageData); | ||
| 88 | + const options: image.InitializationOptions = { | ||
| 89 | + 'alphaType': 0, // 透明度 | ||
| 90 | + 'editable': false, // 是否可编辑 | ||
| 91 | + 'pixelFormat': 3, // 像素格式 | ||
| 92 | + 'scaleMode': 1, // 缩略值 | ||
| 93 | + 'size': { height: 100, width: 100 } | ||
| 94 | + }; // 创建图片大小 | ||
| 95 | + | ||
| 96 | + // 通过属性创建PixelMap | ||
| 97 | + imageSource.createPixelMap(options).then((pixelMap: PixelMap) => { | ||
| 98 | + this.image = pixelMap; | ||
| 99 | + }); | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + /** | ||
| 104 | + * 保存ArrayBuffer到图库 | ||
| 105 | + * @param buffer:图片ArrayBuffer | ||
| 106 | + * @returns | ||
| 107 | + */ | ||
| 108 | + async saveImage(buffer: ArrayBuffer | string): Promise<void> { | ||
| 109 | + console.info(`cj2024 saveImage buffer ${buffer}`) | ||
| 110 | + const context = getContext(this) as common.UIAbilityContext; // 获取getPhotoAccessHelper需要的context | ||
| 111 | + const helper = photoAccessHelper.getPhotoAccessHelper(context); // 获取相册管理模块的实例 | ||
| 112 | + const uri = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE, 'jpg'); // 指定待创建的文件类型、后缀和创建选项,创建图片或视频资源 | ||
| 113 | + console.info(`cj2024 saveImage uri ${uri}`) | ||
| 114 | + const file = await fs.open(uri, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); | ||
| 115 | + await fs.write(file.fd, buffer); | ||
| 116 | + await fs.close(file.fd); | ||
| 117 | + } | ||
| 118 | +} |
| 1 | +import { PhotoListBean } from 'wdBean/Index'; | ||
| 2 | +import { Logger } from 'wdKit/Index'; | ||
| 3 | +import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent'; | ||
| 4 | +import { display, router } from '@kit.ArkUI'; | ||
| 5 | +import { ImageDownloadComponent } from './ImageDownloadComponent'; | ||
| 6 | + | ||
| 7 | +const TAG = 'ImageSwiperComponent'; | ||
| 8 | + | ||
| 9 | +@Component | ||
| 10 | +export struct ImageSwiperComponent { | ||
| 11 | + @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' | ||
| 12 | + private scroller: Scroller = new Scroller() | ||
| 13 | + @State swiperIndex: number = 0; | ||
| 14 | + photoList: PhotoListBean[] = []; | ||
| 15 | + private swiperController: SwiperController = new SwiperController() | ||
| 16 | + private displayTool = display.getDefaultDisplaySync() | ||
| 17 | + private screenWidth: number = 0 | ||
| 18 | + private picWidth: number = 0 | ||
| 19 | + @State picHeight: number = 0 | ||
| 20 | + | ||
| 21 | + //watch监听页码回调 | ||
| 22 | + onCurrentPageNumUpdated(): void { | ||
| 23 | + Logger.info(TAG, `currentPageNum:${this.currentPageNum}`,) | ||
| 24 | + let _swiperIndex = Number.parseInt(this.currentPageNum) | ||
| 25 | + Logger.info(TAG, `_swiperIndex:${_swiperIndex}`) | ||
| 26 | + this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + aboutToAppear(): void { | ||
| 30 | + //获取宽高尺寸 | ||
| 31 | + this.screenWidth = this.displayTool.width | ||
| 32 | + // this.picWidth = this.screenWidth - vp2px(52) | ||
| 33 | + this.picWidth = this.screenWidth | ||
| 34 | + this.picHeight = this.picWidth * 578 / 375 | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + build() { | ||
| 38 | + RelativeContainer() { | ||
| 39 | + Image($r('app.media.icon_arrow_left_white')) | ||
| 40 | + .width(24) | ||
| 41 | + .height(24) | ||
| 42 | + .aspectRatio(1) | ||
| 43 | + .interpolation(ImageInterpolation.High) | ||
| 44 | + .alignRules({ | ||
| 45 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 46 | + left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 47 | + }) | ||
| 48 | + .onClick(() => { | ||
| 49 | + router.back(); | ||
| 50 | + }) | ||
| 51 | + .id("backImg") | ||
| 52 | + | ||
| 53 | + if (this.photoList && this.photoList?.length > 0) { | ||
| 54 | + Swiper(this.swiperController) { | ||
| 55 | + ForEach(this.photoList, (item: PhotoListBean) => { | ||
| 56 | + MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) | ||
| 57 | + }) | ||
| 58 | + } | ||
| 59 | + .index(this.swiperIndex) | ||
| 60 | + .width('100%') | ||
| 61 | + .height(px2vp(this.picHeight) + 32) | ||
| 62 | + .vertical(false) | ||
| 63 | + .autoPlay(false) | ||
| 64 | + .cachedCount(3) | ||
| 65 | + .indicator(false) | ||
| 66 | + .displayCount(1) | ||
| 67 | + .id('e_swiper_content') | ||
| 68 | + .alignRules({ | ||
| 69 | + center: { anchor: "__container__", align: VerticalAlign.Center }, | ||
| 70 | + middle: { anchor: "__container__", align: HorizontalAlign.Center } | ||
| 71 | + }) | ||
| 72 | + .onChange((index: number) => { | ||
| 73 | + this.swiperIndex = index | ||
| 74 | + }) | ||
| 75 | + | ||
| 76 | + Row() { | ||
| 77 | + Scroll(this.scroller) { | ||
| 78 | + Row() { | ||
| 79 | + Flex({ | ||
| 80 | + direction: FlexDirection.Column, | ||
| 81 | + justifyContent: FlexAlign.Start | ||
| 82 | + }) { | ||
| 83 | + Text() { | ||
| 84 | + Span(`${this.swiperIndex + 1}`) | ||
| 85 | + .fontSize(24) | ||
| 86 | + .fontFamily('PingFang SC-Medium') | ||
| 87 | + .fontWeight(500) | ||
| 88 | + .lineHeight(28) | ||
| 89 | + Span(`/${this.photoList.length}`) | ||
| 90 | + .fontSize(14) | ||
| 91 | + .fontFamily('PingFang SC-Medium') | ||
| 92 | + .fontWeight(500) | ||
| 93 | + .lineHeight(19) | ||
| 94 | + }.fontColor(Color.White).margin(4) | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + .width('100%') | ||
| 98 | + .margin({ | ||
| 99 | + top: 8, | ||
| 100 | + left: 18, | ||
| 101 | + bottom: 24, | ||
| 102 | + right: 18 | ||
| 103 | + }) | ||
| 104 | + } | ||
| 105 | + .scrollable(ScrollDirection.Vertical) | ||
| 106 | + .scrollBarWidth(0) | ||
| 107 | + } | ||
| 108 | + .id('e_swiper_titles') | ||
| 109 | + .alignRules({ | ||
| 110 | + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | ||
| 111 | + middle: { anchor: "__container__", align: HorizontalAlign.Center } | ||
| 112 | + }) | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + ImageDownloadComponent({ url: this.photoList[this.swiperIndex].picPath }) | ||
| 116 | + .alignRules({ | ||
| 117 | + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | ||
| 118 | + right: { anchor: "__container__", align: HorizontalAlign.End } | ||
| 119 | + }) | ||
| 120 | + .margin({ | ||
| 121 | + top: 8, | ||
| 122 | + left: 18, | ||
| 123 | + bottom: 24, | ||
| 124 | + right: 18 | ||
| 125 | + }) | ||
| 126 | + .id("downloadImg") | ||
| 127 | + } | ||
| 128 | + .width('100%') | ||
| 129 | + .height('100%') | ||
| 130 | + .backgroundColor(Color.Black) | ||
| 131 | + .id('e_picture_container') | ||
| 132 | + // 设置顶部绘制延伸到状态栏 | ||
| 133 | + // 设置底部绘制延伸到导航条 | ||
| 134 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 135 | + } | ||
| 136 | +} |
sight_harmony/features/wdComponent/src/main/ets/components/MultiPictureDetailEmptyComponent.ets
0 → 100644
| 1 | +import { CommonConstants } from 'wdConstant'; | ||
| 2 | +import { Logger } from 'wdKit'; | ||
| 3 | + | ||
| 4 | +const TAG = 'EmptyComponent'; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * WDViewDefaultType 缺省页 | ||
| 8 | + */ | ||
| 9 | +export const enum WDViewDefaultType { | ||
| 10 | + ///无网 | ||
| 11 | + WDViewDefaultType_NoNetwork, | ||
| 12 | + ///网络失败 请稍后重试-倒计时 | ||
| 13 | + WDViewDefaultType_NetworkFailed, | ||
| 14 | + ///内容获取失败 | ||
| 15 | + WDViewDefaultType_ContentFailed, | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * 空数据/无数据 | ||
| 20 | + */ | ||
| 21 | +@Preview | ||
| 22 | +@Component | ||
| 23 | +export struct MultiPictureDetailEmptyComponent { | ||
| 24 | + // private emptySize: SizeOptions = {}; | ||
| 25 | + @State emptyWidth: string | number = CommonConstants.FULL_PARENT; | ||
| 26 | + @State emptyHeight: string | number = CommonConstants.FULL_PARENT; | ||
| 27 | + @State emptyType: number = WDViewDefaultType.WDViewDefaultType_ContentFailed | ||
| 28 | + /** | ||
| 29 | + * The empty image width percentage setting. | ||
| 30 | + */ | ||
| 31 | + readonly EMPTY_IMAGE_WIDTH: string = '15%'; | ||
| 32 | + /** | ||
| 33 | + * The empty image height percentage setting. | ||
| 34 | + */ | ||
| 35 | + readonly EMPTY_IMAGE_HEIGHT: string = '15%'; | ||
| 36 | + /** | ||
| 37 | + * The empty data text component margin top. | ||
| 38 | + */ | ||
| 39 | + readonly EMPTY_TIP_TEXT_MARGIN_TOP: string = '10'; | ||
| 40 | + /** | ||
| 41 | + * The empty data text opacity. | ||
| 42 | + */ | ||
| 43 | + readonly TEXT_OPACITY: number = 1; | ||
| 44 | + | ||
| 45 | + build() { | ||
| 46 | + this.noProgrammeData(); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * 无数据,空白view组件 | ||
| 51 | + */ | ||
| 52 | + @Builder | ||
| 53 | + noProgrammeData() { | ||
| 54 | + Column() { | ||
| 55 | + Image(this.buildNoDataTipImage()) | ||
| 56 | + .width('this.EMPTY_IMAGE_WIDTH') | ||
| 57 | + .height(this.EMPTY_IMAGE_HEIGHT) | ||
| 58 | + .objectFit(ImageFit.Contain) | ||
| 59 | + // .border({ width: 1, color: Color.Red, radius: 6 }) | ||
| 60 | + | ||
| 61 | + Text(this.buildNoDataTip()) | ||
| 62 | + .fontSize($r('app.float.font_size_14')) | ||
| 63 | + .fontColor('#999999') | ||
| 64 | + .fontWeight(FontWeight.Normal) | ||
| 65 | + .opacity(this.TEXT_OPACITY) | ||
| 66 | + .margin({ top: this.EMPTY_TIP_TEXT_MARGIN_TOP }) | ||
| 67 | + .onClick((event: ClickEvent) => { | ||
| 68 | + Logger.info(TAG, `noProgrammeData onClick event?.source: ${event.source}`); | ||
| 69 | + }) | ||
| 70 | + Button('点击重试', { type: ButtonType.Normal, stateEffect: true }) | ||
| 71 | + .borderRadius(4) | ||
| 72 | + .margin(16) | ||
| 73 | + .height(28) | ||
| 74 | + .fontSize(12) | ||
| 75 | + .fontColor('#CCCCCC') | ||
| 76 | + .fontFamily('PingFang SC-Medium') | ||
| 77 | + .border({ width: 1, color: '#545454' }) | ||
| 78 | + .backgroundColor(Color.Black) | ||
| 79 | + } | ||
| 80 | + .justifyContent(FlexAlign.Center) | ||
| 81 | + .width(this.emptyWidth) | ||
| 82 | + .height(this.emptyHeight) | ||
| 83 | + .backgroundColor(Color.Black) | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + buildNoDataTip(): string { | ||
| 87 | + Logger.info(TAG, "buildNoDataTip"); | ||
| 88 | + let contentString: string = '获取内容失败请重试' | ||
| 89 | + if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) { | ||
| 90 | + contentString = '网络出小差了,请检查网络后重试' | ||
| 91 | + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_ContentFailed) { | ||
| 92 | + contentString = '获取内容失败请重试' | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + return contentString | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + buildNoDataTipImage(): Resource | string { | ||
| 99 | + Logger.info(TAG, "buildNoDataTip"); | ||
| 100 | + let imageString: Resource | string = $r('app.media.icon_no_content') | ||
| 101 | + if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) { | ||
| 102 | + imageString = $r('app.media.icon_no_net') | ||
| 103 | + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_ContentFailed) { | ||
| 104 | + imageString = $r('app.media.icon_no_content') | ||
| 105 | + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NetworkFailed) { | ||
| 106 | + imageString = $r('app.media.icon_no_net') | ||
| 107 | + } | ||
| 108 | + return imageString | ||
| 109 | + } | ||
| 110 | +} |
| 1 | import { Logger } from 'wdKit'; | 1 | import { Logger } from 'wdKit'; |
| 2 | +import { ResponseDTO } from 'wdNetwork'; | ||
| 2 | import { | 3 | import { |
| 3 | ContentDetailDTO, | 4 | ContentDetailDTO, |
| 4 | PhotoListBean, | 5 | PhotoListBean, |
| @@ -11,6 +12,7 @@ import display from '@ohos.display'; | @@ -11,6 +12,7 @@ import display from '@ohos.display'; | ||
| 11 | import font from '@ohos.font'; | 12 | import font from '@ohos.font'; |
| 12 | import { OperRowListView } from './view/OperRowListView'; | 13 | import { OperRowListView } from './view/OperRowListView'; |
| 13 | import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent'; | 14 | import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent'; |
| 15 | +import { MultiPictureDetailEmptyComponent } from './MultiPictureDetailEmptyComponent'; | ||
| 14 | import { DateTimeUtils } from 'wdKit/Index'; | 16 | import { DateTimeUtils } from 'wdKit/Index'; |
| 15 | import { HttpUrlUtils } from 'wdNetwork/Index'; | 17 | import { HttpUrlUtils } from 'wdNetwork/Index'; |
| 16 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 18 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| @@ -34,6 +36,7 @@ export struct MultiPictureDetailPageComponent { | @@ -34,6 +36,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 34 | @State swiperIndex: number = 0; | 36 | @State swiperIndex: number = 0; |
| 35 | @Provide followStatus: string = '0' // 关注状态 | 37 | @Provide followStatus: string = '0' // 关注状态 |
| 36 | private scroller: Scroller = new Scroller() | 38 | private scroller: Scroller = new Scroller() |
| 39 | + @State netStatus: number = 0 // 存储网络状态用来展示缺省图 | ||
| 37 | 40 | ||
| 38 | //watch监听页码回调 | 41 | //watch监听页码回调 |
| 39 | onCurrentPageNumUpdated(): void { | 42 | onCurrentPageNumUpdated(): void { |
| @@ -56,10 +59,6 @@ export struct MultiPictureDetailPageComponent { | @@ -56,10 +59,6 @@ export struct MultiPictureDetailPageComponent { | ||
| 56 | familySrc: $rawfile('font/BebasNeue_Regular.otf') | 59 | familySrc: $rawfile('font/BebasNeue_Regular.otf') |
| 57 | }) | 60 | }) |
| 58 | this.getContentDetailData() | 61 | this.getContentDetailData() |
| 59 | - if (HttpUrlUtils.getUserId()) { | ||
| 60 | - this.getInteractBrowsOperate() | ||
| 61 | - this.getBatchAttentionStatus() | ||
| 62 | - } | ||
| 63 | } | 62 | } |
| 64 | 63 | ||
| 65 | aboutToDisappear() { | 64 | aboutToDisappear() { |
| @@ -238,6 +237,16 @@ export struct MultiPictureDetailPageComponent { | @@ -238,6 +237,16 @@ export struct MultiPictureDetailPageComponent { | ||
| 238 | }) | 237 | }) |
| 239 | .height(px2vp(this.titleHeight) + 64) | 238 | .height(px2vp(this.titleHeight) + 64) |
| 240 | 239 | ||
| 240 | + } else { | ||
| 241 | + if (this.netStatus === 1) { | ||
| 242 | + MultiPictureDetailEmptyComponent({ emptyType: 2}) | ||
| 243 | + .id('e_empty_content') | ||
| 244 | + .alignRules({ | ||
| 245 | + center: { anchor: "__container__", align: VerticalAlign.Center }, | ||
| 246 | + middle: { anchor: "__container__", align: HorizontalAlign.Center } | ||
| 247 | + }) | ||
| 248 | + } | ||
| 249 | + } | ||
| 241 | OperRowListView({ | 250 | OperRowListView({ |
| 242 | contentDetailData: this.contentDetailData, | 251 | contentDetailData: this.contentDetailData, |
| 243 | }) | 252 | }) |
| @@ -256,7 +265,6 @@ export struct MultiPictureDetailPageComponent { | @@ -256,7 +265,6 @@ export struct MultiPictureDetailPageComponent { | ||
| 256 | .border({ width: { top: 0.5 }, color: '#FFFFFF' }) | 265 | .border({ width: { top: 0.5 }, color: '#FFFFFF' }) |
| 257 | .id('e_oper_row') | 266 | .id('e_oper_row') |
| 258 | } | 267 | } |
| 259 | - } | ||
| 260 | .width('100%') | 268 | .width('100%') |
| 261 | .height('100%') | 269 | .height('100%') |
| 262 | .backgroundColor(Color.Black) | 270 | .backgroundColor(Color.Black) |
| @@ -266,11 +274,41 @@ export struct MultiPictureDetailPageComponent { | @@ -266,11 +274,41 @@ export struct MultiPictureDetailPageComponent { | ||
| 266 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | 274 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) |
| 267 | } | 275 | } |
| 268 | 276 | ||
| 269 | - private async getContentDetailData() { | 277 | + private getContentDetailData() { |
| 270 | try { | 278 | try { |
| 271 | - let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) | ||
| 272 | - this.contentDetailData = data?.[0]; | 279 | + PageRepository.fetchDetailData(this.relId, this.contentId, this.relType).then((resDTO: ResponseDTO<ContentDetailDTO[]>) => { |
| 280 | + // Logger.info(TAG, `fetchDetailData then,navResDTO.timestamp ${resDTO.timestamp}`); | ||
| 281 | + // Logger.info(TAG, `fetchDetailData then,navResDTO: ${JSON.stringify(resDTO)}`); | ||
| 282 | + // Logger.info(TAG, `fetchDetailData then,navResDTO.data: ${JSON.stringify(resDTO.data)}`); | ||
| 283 | + if (!resDTO || !resDTO.data) { | ||
| 284 | + Logger.error(TAG, 'fetchDetailData is empty'); | ||
| 285 | + return | ||
| 286 | + } | ||
| 287 | + if (resDTO.code != 0) { | ||
| 288 | + Logger.error(TAG, `fetchDetailData then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 289 | + return | ||
| 290 | + } | ||
| 291 | + this.contentDetailData = resDTO.data?.[0]; | ||
| 273 | Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`) | 292 | Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`) |
| 293 | + if (HttpUrlUtils.getUserId()) { | ||
| 294 | + this.getInteractBrowsOperate() | ||
| 295 | + this.getBatchAttentionStatus() | ||
| 296 | + } | ||
| 297 | + }).catch((err: Error) => { | ||
| 298 | + Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); | ||
| 299 | + /*// 请求失败处理 | ||
| 300 | + if (err.response) { | ||
| 301 | + // 请求已发出,但服务器响应的状态码不在2xx范围内 | ||
| 302 | + console.error('请求失败,状态码:', err.response.status); | ||
| 303 | + console.error('响应数据:', err.response.data); | ||
| 304 | + } else if (err.request) { | ||
| 305 | + // 请求已发出,但无响应(例如:网络故障) | ||
| 306 | + console.error('请求已发出,但无响应:', err.request); | ||
| 307 | + } else { | ||
| 308 | + // 发生了其他类型的错误(如配置错误或拒绝权限等) | ||
| 309 | + console.error('请求发生错误:', err.message); | ||
| 310 | + }*/ | ||
| 311 | + }) | ||
| 274 | } catch (exception) { | 312 | } catch (exception) { |
| 275 | 313 | ||
| 276 | } | 314 | } |
| @@ -4,6 +4,7 @@ import { WdWebComponent } from 'wdWebComponent'; | @@ -4,6 +4,7 @@ import { WdWebComponent } from 'wdWebComponent'; | ||
| 4 | import router from '@ohos.router'; | 4 | import router from '@ohos.router'; |
| 5 | import { CommonConstants } from 'wdConstant' | 5 | import { CommonConstants } from 'wdConstant' |
| 6 | import { BridgeWebViewControl } from 'wdJsBridge/Index'; | 6 | import { BridgeWebViewControl } from 'wdJsBridge/Index'; |
| 7 | +import { detailedSkeleton } from './skeleton/detailSkeleton' | ||
| 7 | 8 | ||
| 8 | const TAG = 'SpacialTopicPageComponent' | 9 | const TAG = 'SpacialTopicPageComponent' |
| 9 | 10 | ||
| @@ -13,14 +14,20 @@ export struct SpacialTopicPageComponent { | @@ -13,14 +14,20 @@ export struct SpacialTopicPageComponent { | ||
| 13 | scroller: Scroller = new Scroller(); | 14 | scroller: Scroller = new Scroller(); |
| 14 | action: Action = {} as Action | 15 | action: Action = {} as Action |
| 15 | @State webUrl: string = ''; | 16 | @State webUrl: string = ''; |
| 17 | + @State isPageEnd: boolean = false | ||
| 18 | + | ||
| 16 | build() { | 19 | build() { |
| 17 | Column() { | 20 | Column() { |
| 21 | + if (!this.isPageEnd) { | ||
| 22 | + detailedSkeleton() | ||
| 23 | + } | ||
| 18 | Stack({ alignContent: Alignment.Bottom }) { | 24 | Stack({ alignContent: Alignment.Bottom }) { |
| 19 | Column() { | 25 | Column() { |
| 20 | WdWebComponent({ | 26 | WdWebComponent({ |
| 21 | webviewControl: this.webviewControl, | 27 | webviewControl: this.webviewControl, |
| 22 | webUrl: this.webUrl, | 28 | webUrl: this.webUrl, |
| 23 | backVisibility: false, | 29 | backVisibility: false, |
| 30 | + isPageEnd:$isPageEnd | ||
| 24 | }) | 31 | }) |
| 25 | } | 32 | } |
| 26 | .padding({ bottom: 56 }) | 33 | .padding({ bottom: 56 }) |
| @@ -64,6 +71,8 @@ export struct SpacialTopicPageComponent { | @@ -64,6 +71,8 @@ export struct SpacialTopicPageComponent { | ||
| 64 | .padding({ left: 15, right: 15, bottom: 20, top: 20 }) | 71 | .padding({ left: 15, right: 15, bottom: 20, top: 20 }) |
| 65 | .justifyContent(FlexAlign.SpaceBetween) | 72 | .justifyContent(FlexAlign.SpaceBetween) |
| 66 | .backgroundColor(Color.White) | 73 | .backgroundColor(Color.White) |
| 74 | + | ||
| 75 | + | ||
| 67 | } | 76 | } |
| 68 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | 77 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) |
| 69 | .backgroundColor(Color.White) | 78 | .backgroundColor(Color.White) |
| @@ -10,56 +10,60 @@ import { DateTimeUtils } from 'wdKit/Index' | @@ -10,56 +10,60 @@ import { DateTimeUtils } from 'wdKit/Index' | ||
| 10 | @Component | 10 | @Component |
| 11 | export struct CardMediaInfo { | 11 | export struct CardMediaInfo { |
| 12 | @State contentDTO: ContentDTO = {} as ContentDTO // 如果有duraion,代表点播,显示时长;如果不传或者传0,显示直播中 | 12 | @State contentDTO: ContentDTO = {} as ContentDTO // 如果有duraion,代表点播,显示时长;如果不传或者传0,显示直播中 |
| 13 | + | ||
| 13 | // objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频, | 14 | // objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频, |
| 14 | // 14动态图文,15动态视频16问政;100人民号,101标签 | 15 | // 14动态图文,15动态视频16问政;100人民号,101标签 |
| 15 | 16 | ||
| 16 | build() { | 17 | build() { |
| 17 | Row() { | 18 | Row() { |
| 18 | - if(this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15' ) { | 19 | + if (this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15') { |
| 19 | // 点播、动态视频 | 20 | // 点播、动态视频 |
| 20 | - Row(){ | ||
| 21 | - Image($r('app.media.videoTypeIcon')) | 21 | + Row() { |
| 22 | + Image($r('app.media.card_play')) | ||
| 22 | .mediaLogo() | 23 | .mediaLogo() |
| 23 | Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000)) | 24 | Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000)) |
| 24 | .mediaText() | 25 | .mediaText() |
| 25 | } | 26 | } |
| 26 | - .backgroundColor('#4d000000') | ||
| 27 | - .borderRadius($r('app.float.button_border_radius')) | ||
| 28 | - } else if(this.contentDTO.objectType === '2') { | 27 | + } else if (this.contentDTO.objectType === '2') { |
| 29 | // liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | 28 | // liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 |
| 30 | // 显示直播信息 | 29 | // 显示直播信息 |
| 31 | - Row(){ | ||
| 32 | - if(this.contentDTO.liveInfo.liveState === 'running') { | ||
| 33 | - Image($r('app.media.icon_live')) | 30 | + Row() { |
| 31 | + if(this.contentDTO.liveInfo.liveState === 'wait') { | ||
| 32 | + Image($r('app.media.card_wait')) | ||
| 33 | + .mediaLogo() | ||
| 34 | + Text('预约') | ||
| 35 | + .mediaText() | ||
| 36 | + } else if (this.contentDTO.liveInfo.liveState === 'running') { | ||
| 37 | + Image($r('app.media.card_live')) | ||
| 34 | .mediaLogo() | 38 | .mediaLogo() |
| 35 | Text('直播中') | 39 | Text('直播中') |
| 36 | .mediaText() | 40 | .mediaText() |
| 37 | - } else if(this.contentDTO.liveInfo.liveState === 'end'){ | ||
| 38 | - Image($r('app.media.videoTypeIcon')) | 41 | + } else if (this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo.replayUri) { |
| 42 | + Image($r('app.media.card_play')) | ||
| 39 | .mediaLogo() | 43 | .mediaLogo() |
| 40 | Text('回看') | 44 | Text('回看') |
| 41 | .mediaText() | 45 | .mediaText() |
| 46 | + } else if(this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo | ||
| 47 | + .replayUri) { | ||
| 48 | + // Image($r('app.media.card_live')) | ||
| 49 | + // .mediaLogo() | ||
| 50 | + Text('直播结束') | ||
| 51 | + .mediaText() | ||
| 42 | } | 52 | } |
| 43 | } | 53 | } |
| 44 | - .backgroundColor('#4d000000') | ||
| 45 | - .borderRadius($r('app.float.button_border_radius')) | ||
| 46 | - } else if(this.contentDTO.objectType === '9') { | 54 | + } else if (this.contentDTO.objectType === '9') { |
| 47 | // 显示组图;图片数量 | 55 | // 显示组图;图片数量 |
| 48 | - Row(){ | ||
| 49 | - Image($r('app.media.album_card_shape')) | 56 | + Row() { |
| 57 | + Image($r('app.media.card_image')) | ||
| 50 | .mediaLogo() | 58 | .mediaLogo() |
| 51 | Text(`${this.contentDTO.photoNum}`) | 59 | Text(`${this.contentDTO.photoNum}`) |
| 52 | .mediaText() | 60 | .mediaText() |
| 53 | - .width(20) | ||
| 54 | } | 61 | } |
| 55 | - .backgroundColor('#4d000000') | ||
| 56 | - .borderRadius($r('app.float.button_border_radius')) | ||
| 57 | - } else if(this.contentDTO.objectType === '13') { | 62 | + } else if (this.contentDTO.objectType === '13') { |
| 58 | // 显示音频信息 | 63 | // 显示音频信息 |
| 59 | - Row(){ | ||
| 60 | - Image($r('app.media.broadcast_listen')) | ||
| 61 | - .height(14) | ||
| 62 | - .borderRadius($r('app.float.button_border_radius')) | 64 | + Row() { |
| 65 | + Image($r('app.media.card_audio')) | ||
| 66 | + .mediaLogo() | ||
| 63 | Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000)) | 67 | Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000)) |
| 64 | .mediaText() | 68 | .mediaText() |
| 65 | } | 69 | } |
| @@ -68,18 +72,22 @@ export struct CardMediaInfo { | @@ -68,18 +72,22 @@ export struct CardMediaInfo { | ||
| 68 | .margin(6) | 72 | .margin(6) |
| 69 | } | 73 | } |
| 70 | 74 | ||
| 71 | - @Styles mediaLogo() { | ||
| 72 | - .width(22) | ||
| 73 | - .height(18) | ||
| 74 | - .borderRadius($r('app.float.button_border_radius')) | 75 | + @Styles |
| 76 | + mediaLogo() { | ||
| 77 | + .width(14) | ||
| 78 | + .height(14) | ||
| 79 | + .margin({ right: 3 }) | ||
| 75 | } | 80 | } |
| 76 | } | 81 | } |
| 77 | 82 | ||
| 78 | -@Extend(Text) function mediaText() { | 83 | +@Extend(Text) |
| 84 | +function mediaText() { | ||
| 79 | .fontColor($r('app.color.color_fff')) | 85 | .fontColor($r('app.color.color_fff')) |
| 80 | - .fontSize($r('app.float.font_size_12')) | ||
| 81 | - .width(40) | ||
| 82 | - .height(18) | ||
| 83 | - .textAlign(TextAlign.Center) | ||
| 84 | - .margin({ left: -3 }) | 86 | + .fontSize($r('app.float.font_size_14')) |
| 87 | + .lineHeight(18) | ||
| 88 | + .textShadow({ | ||
| 89 | + radius: 2, | ||
| 90 | + color: 'rgba(0,0,0,0.3)', | ||
| 91 | + offsetY: 2 | ||
| 92 | + }) | ||
| 85 | } | 93 | } |
| @@ -5,44 +5,52 @@ import { DateTimeUtils } from 'wdKit/Index'; | @@ -5,44 +5,52 @@ import { DateTimeUtils } from 'wdKit/Index'; | ||
| 5 | @Component | 5 | @Component |
| 6 | export struct CardSourceInfo { | 6 | export struct CardSourceInfo { |
| 7 | @State contentDTO: ContentDTO = {} as ContentDTO; | 7 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 8 | + | ||
| 8 | build() { | 9 | build() { |
| 9 | Flex() { | 10 | Flex() { |
| 10 | - if(this.contentDTO.corner) { | 11 | + if (this.contentDTO.corner) { |
| 11 | Text(this.contentDTO.corner) | 12 | Text(this.contentDTO.corner) |
| 12 | .fontSize($r("app.float.font_size_12")) | 13 | .fontSize($r("app.float.font_size_12")) |
| 13 | .fontColor($r("app.color.color_ED2800")) | 14 | .fontColor($r("app.color.color_ED2800")) |
| 14 | - .margin({right: 2}) | 15 | + .margin({ right: 2 }) |
| 15 | } | 16 | } |
| 16 | - if(this.contentDTO.rmhPlatform === 1) { | ||
| 17 | - Text(this.contentDTO.rmhInfo.rmhName) | 17 | + if (this.contentDTO.rmhPlatform === 1) { |
| 18 | + Text(this.contentDTO.rmhInfo?.rmhName) | ||
| 18 | .fontSize($r("app.float.font_size_12")) | 19 | .fontSize($r("app.float.font_size_12")) |
| 19 | .fontColor($r("app.color.color_B0B0B0")) | 20 | .fontColor($r("app.color.color_B0B0B0")) |
| 20 | .maxLines(1) | 21 | .maxLines(1) |
| 21 | - .textOverflow({overflow: TextOverflow.Ellipsis}) | 22 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 22 | Image($r("app.media.point")) | 23 | Image($r("app.media.point")) |
| 23 | .width(16) | 24 | .width(16) |
| 24 | .height(16) | 25 | .height(16) |
| 25 | - } else if(this.contentDTO.source) { | 26 | + } else if (this.contentDTO.source) { |
| 26 | Text(`${this.contentDTO.source}`) | 27 | Text(`${this.contentDTO.source}`) |
| 27 | .fontSize($r("app.float.font_size_12")) | 28 | .fontSize($r("app.float.font_size_12")) |
| 28 | .fontColor($r("app.color.color_B0B0B0")) | 29 | .fontColor($r("app.color.color_B0B0B0")) |
| 29 | .maxLines(1) | 30 | .maxLines(1) |
| 30 | - .textOverflow({overflow: TextOverflow.Ellipsis}) | 31 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 31 | Image($r("app.media.point")) | 32 | Image($r("app.media.point")) |
| 32 | .width(16) | 33 | .width(16) |
| 33 | .height(16) | 34 | .height(16) |
| 34 | } | 35 | } |
| 35 | - // TODO 这里还有个判断需要完善,依赖外部,新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 | 36 | + // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 |
| 37 | + if (this.contentDTO.isSearch || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime | ||
| 38 | + (Number | ||
| 39 | + .parseFloat(this | ||
| 40 | + .contentDTO.publishTime)) | ||
| 41 | + .indexOf | ||
| 42 | + ('-') === -1) { | ||
| 36 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | 43 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) |
| 37 | .fontSize($r("app.float.font_size_12")) | 44 | .fontSize($r("app.float.font_size_12")) |
| 38 | .fontColor($r("app.color.color_B0B0B0")) | 45 | .fontColor($r("app.color.color_B0B0B0")) |
| 39 | - .margin({ right: 6 }) | ||
| 40 | .flexShrink(0) | 46 | .flexShrink(0) |
| 41 | - if(this.contentDTO?.interactData?.commentNum) { | 47 | + } |
| 48 | + if (this.contentDTO?.interactData?.commentNum) { | ||
| 42 | Text(`${this.contentDTO.interactData.commentNum}评`) | 49 | Text(`${this.contentDTO.interactData.commentNum}评`) |
| 43 | .fontSize($r("app.float.font_size_12")) | 50 | .fontSize($r("app.float.font_size_12")) |
| 44 | .fontColor($r("app.color.color_B0B0B0")) | 51 | .fontColor($r("app.color.color_B0B0B0")) |
| 45 | .flexShrink(0) | 52 | .flexShrink(0) |
| 53 | + .margin({ left: 6 }) | ||
| 46 | } | 54 | } |
| 47 | } | 55 | } |
| 48 | .width(CommonConstants.FULL_WIDTH) | 56 | .width(CommonConstants.FULL_WIDTH) |
| @@ -17,7 +17,7 @@ export struct Card10Component { | @@ -17,7 +17,7 @@ export struct Card10Component { | ||
| 17 | build() { | 17 | build() { |
| 18 | Column() { | 18 | Column() { |
| 19 | // 顶部标题,最多两行 | 19 | // 顶部标题,最多两行 |
| 20 | - if (this.contentDTO.newsTitle) { | 20 | + if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { |
| 21 | Text(this.contentDTO.newsTitle) | 21 | Text(this.contentDTO.newsTitle) |
| 22 | .width(CommonConstants.FULL_WIDTH) | 22 | .width(CommonConstants.FULL_WIDTH) |
| 23 | .fontSize($r('app.float.font_size_17')) | 23 | .fontSize($r('app.float.font_size_17')) |
| @@ -2,6 +2,7 @@ import { ContentDTO } from 'wdBean'; | @@ -2,6 +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 | 6 | ||
| 6 | const TAG = 'Card12Component'; | 7 | const TAG = 'Card12Component'; |
| 7 | 8 | ||
| @@ -10,39 +11,7 @@ const TAG = 'Card12Component'; | @@ -10,39 +11,7 @@ const TAG = 'Card12Component'; | ||
| 10 | */ | 11 | */ |
| 11 | @Component | 12 | @Component |
| 12 | export struct Card12Component { | 13 | export struct Card12Component { |
| 13 | - @State contentDTO: ContentDTO = { | ||
| 14 | - appStyle: '20', | ||
| 15 | - coverType: 1, | ||
| 16 | - coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 17 | - fullColumnImgUrls: [ | ||
| 18 | - { | ||
| 19 | - landscape: 1, | ||
| 20 | - size: 1, | ||
| 21 | - url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 22 | - weight: 1600 | ||
| 23 | - } | ||
| 24 | - ], | ||
| 25 | - newsTitle: '好玩!》10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人', | ||
| 26 | - rmhInfo: { | ||
| 27 | - authIcon: | ||
| 28 | - 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png', | ||
| 29 | - authTitle: '10后音乐人王烁然个人人民号', | ||
| 30 | - authTitle2: '10后音乐人王烁然个人人民号', | ||
| 31 | - banControl: 0, | ||
| 32 | - cnIsAttention: 1, | ||
| 33 | - rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人', | ||
| 34 | - rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg', | ||
| 35 | - rmhName: '王烁然', | ||
| 36 | - userId: '522435359667845', | ||
| 37 | - userType: '2' | ||
| 38 | - }, | ||
| 39 | - objectType: '1', | ||
| 40 | - videoInfo: { | ||
| 41 | - firstFrameImageUri: '', | ||
| 42 | - videoDuration: 37, | ||
| 43 | - videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4' | ||
| 44 | - } | ||
| 45 | - } as ContentDTO; | 14 | + @State contentDTO: ContentDTO = {} as ContentDTO; |
| 46 | 15 | ||
| 47 | aboutToAppear(): void { | 16 | aboutToAppear(): void { |
| 48 | } | 17 | } |
| @@ -50,7 +19,9 @@ export struct Card12Component { | @@ -50,7 +19,9 @@ export struct Card12Component { | ||
| 50 | build() { | 19 | build() { |
| 51 | Column() { | 20 | Column() { |
| 52 | // rmh信息 | 21 | // rmh信息 |
| 22 | + if (this.contentDTO.rmhInfo) { | ||
| 53 | RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) | 23 | RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) |
| 24 | + } | ||
| 54 | // 标题 | 25 | // 标题 |
| 55 | if (this.contentDTO.newsTitle) { | 26 | if (this.contentDTO.newsTitle) { |
| 56 | Text(this.contentDTO.newsTitle) | 27 | Text(this.contentDTO.newsTitle) |
| @@ -64,9 +35,6 @@ export struct Card12Component { | @@ -64,9 +35,6 @@ export struct Card12Component { | ||
| 64 | .fontFamily('PingFang SC-Regular') | 35 | .fontFamily('PingFang SC-Regular') |
| 65 | } | 36 | } |
| 66 | 37 | ||
| 67 | - // if (this.contentDTO.fullColumnImgUrls?.[0]) { | ||
| 68 | - // createImg({ contentDTO: this.contentDTO }) | ||
| 69 | - // } | ||
| 70 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 38 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 71 | } | 39 | } |
| 72 | .padding({ | 40 | .padding({ |
| @@ -75,6 +43,9 @@ export struct Card12Component { | @@ -75,6 +43,9 @@ export struct Card12Component { | ||
| 75 | top: $r('app.float.card_comp_pagePadding_tb'), | 43 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 76 | bottom: $r('app.float.card_comp_pagePadding_tb') | 44 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 77 | }) | 45 | }) |
| 46 | + .onClick((event: ClickEvent) => { | ||
| 47 | + ProcessUtils.processPage(this.contentDTO) | ||
| 48 | + }) | ||
| 78 | } | 49 | } |
| 79 | } | 50 | } |
| 80 | 51 | ||
| @@ -85,45 +56,6 @@ interface radiusType { | @@ -85,45 +56,6 @@ interface radiusType { | ||
| 85 | bottomRight: number | Resource; | 56 | bottomRight: number | Resource; |
| 86 | } | 57 | } |
| 87 | 58 | ||
| 88 | -@Component | ||
| 89 | -struct createImg { | ||
| 90 | - @Prop contentDTO: ContentDTO | ||
| 91 | - | ||
| 92 | - build() { | ||
| 93 | - GridRow() { | ||
| 94 | - if (this.contentDTO.fullColumnImgUrls[0].landscape === 1) { | ||
| 95 | - // 横屏 | ||
| 96 | - GridCol({ | ||
| 97 | - span: { xs: 12 } | ||
| 98 | - }) { | ||
| 99 | - Stack() { | ||
| 100 | - Image(this.contentDTO.coverUrl) | ||
| 101 | - .width(CommonConstants.FULL_WIDTH) | ||
| 102 | - .aspectRatio(16 / 9) | ||
| 103 | - .borderRadius($r('app.float.image_border_radius')) | ||
| 104 | - CardMediaInfo({ contentDTO: this.contentDTO }) | ||
| 105 | - } | ||
| 106 | - .align(Alignment.BottomEnd) | ||
| 107 | - } | ||
| 108 | - } else { | ||
| 109 | - // 竖图显示,宽度占50%,高度自适应 | ||
| 110 | - GridCol({ | ||
| 111 | - span: { xs: 6 } | ||
| 112 | - }) { | ||
| 113 | - Stack() { | ||
| 114 | - Image(this.contentDTO.coverUrl) | ||
| 115 | - .width(CommonConstants.FULL_WIDTH) | ||
| 116 | - .borderRadius($r('app.float.image_border_radius')) | ||
| 117 | - CardMediaInfo({ contentDTO: this.contentDTO }) | ||
| 118 | - } | ||
| 119 | - .align(Alignment.BottomEnd) | ||
| 120 | - } | ||
| 121 | - } | ||
| 122 | - } | ||
| 123 | - } | ||
| 124 | -} | ||
| 125 | - | ||
| 126 | - | ||
| 127 | @Extend(Text) | 59 | @Extend(Text) |
| 128 | function textOverflowStyle(maxLine: number) { | 60 | function textOverflowStyle(maxLine: number) { |
| 129 | .maxLines(maxLine) | 61 | .maxLines(maxLine) |
| @@ -2,15 +2,15 @@ import { ContentDTO } from 'wdBean'; | @@ -2,15 +2,15 @@ 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 | 6 | ||
| 6 | -const TAG = 'Card12Component'; | 7 | +const TAG = 'Card14Component'; |
| 7 | 8 | ||
| 8 | /** | 9 | /** |
| 9 | - * 人民号-动态---12:人民号无图卡; | 10 | + * 人民号-动态---14:人民号单图卡; |
| 10 | */ | 11 | */ |
| 11 | -@Entry | ||
| 12 | @Component | 12 | @Component |
| 13 | -export struct Card12Component { | 13 | +export struct Card14Component { |
| 14 | @State contentDTO: ContentDTO = { | 14 | @State contentDTO: ContentDTO = { |
| 15 | appStyle: '20', | 15 | appStyle: '20', |
| 16 | coverType: 1, | 16 | coverType: 1, |
| @@ -23,7 +23,7 @@ export struct Card12Component { | @@ -23,7 +23,7 @@ export struct Card12Component { | ||
| 23 | weight: 1600 | 23 | weight: 1600 |
| 24 | } | 24 | } |
| 25 | ], | 25 | ], |
| 26 | - newsTitle: '好玩!》10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人', | 26 | + newsTitle: '好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》', |
| 27 | rmhInfo: { | 27 | rmhInfo: { |
| 28 | authIcon: | 28 | authIcon: |
| 29 | 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png', | 29 | 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png', |
| @@ -51,9 +51,11 @@ export struct Card12Component { | @@ -51,9 +51,11 @@ export struct Card12Component { | ||
| 51 | build() { | 51 | build() { |
| 52 | Column() { | 52 | Column() { |
| 53 | // rmh信息 | 53 | // rmh信息 |
| 54 | + if (this.contentDTO.rmhInfo) { | ||
| 54 | RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) | 55 | RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) |
| 56 | + } | ||
| 55 | // 左标题,右图 | 57 | // 左标题,右图 |
| 56 | - Flex({ direction: FlexDirection.Row }) { | 58 | + Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) { |
| 57 | 59 | ||
| 58 | Text(this.contentDTO.newsTitle) | 60 | Text(this.contentDTO.newsTitle) |
| 59 | .fontSize($r('app.float.font_size_17')) | 61 | .fontSize($r('app.float.font_size_17')) |
| @@ -62,12 +64,13 @@ export struct Card12Component { | @@ -62,12 +64,13 @@ export struct Card12Component { | ||
| 62 | .lineHeight(25) | 64 | .lineHeight(25) |
| 63 | .fontFamily('PingFang SC-Regular') | 65 | .fontFamily('PingFang SC-Regular') |
| 64 | .textAlign(TextAlign.Start) | 66 | .textAlign(TextAlign.Start) |
| 65 | - .flexBasis('auto') | 67 | + // .flexBasis('auto') |
| 66 | .margin({right: 12}) | 68 | .margin({right: 12}) |
| 69 | + .flexBasis(214) | ||
| 67 | 70 | ||
| 68 | Image(this.contentDTO.coverUrl) | 71 | Image(this.contentDTO.coverUrl) |
| 69 | - .flexBasis(174) | ||
| 70 | - .height(75) | 72 | + .flexBasis(117) |
| 73 | + .height(78) | ||
| 71 | .borderRadius($r('app.float.image_border_radius')) | 74 | .borderRadius($r('app.float.image_border_radius')) |
| 72 | // .flexBasis(160) | 75 | // .flexBasis(160) |
| 73 | .backgroundImageSize(ImageSize.Auto) | 76 | .backgroundImageSize(ImageSize.Auto) |
| @@ -86,6 +89,9 @@ export struct Card12Component { | @@ -86,6 +89,9 @@ export struct Card12Component { | ||
| 86 | top: $r('app.float.card_comp_pagePadding_tb'), | 89 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 87 | bottom: $r('app.float.card_comp_pagePadding_tb') | 90 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 88 | }) | 91 | }) |
| 92 | + .onClick((event: ClickEvent) => { | ||
| 93 | + ProcessUtils.processPage(this.contentDTO) | ||
| 94 | + }) | ||
| 89 | } | 95 | } |
| 90 | } | 96 | } |
| 91 | 97 |
| 1 | +import { ContentDTO } from 'wdBean'; | ||
| 2 | +import { RmhTitle } from '../cardCommon/RmhTitle' | ||
| 3 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 4 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 5 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 6 | + | ||
| 7 | +const TAG = 'Card16Component'; | ||
| 8 | + | ||
| 9 | +interface fullColumnImgUrlItem { | ||
| 10 | + url: string | ||
| 11 | +} | ||
| 12 | + | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 人民号-动态---16:人民号三图卡; | ||
| 16 | + */ | ||
| 17 | +@Component | ||
| 18 | +export struct Card16Component { | ||
| 19 | + @State contentDTO: ContentDTO = {} as ContentDTO; | ||
| 20 | + | ||
| 21 | + aboutToAppear(): void { | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + build() { | ||
| 25 | + Column() { | ||
| 26 | + // rmh信息 | ||
| 27 | + if (this.contentDTO.rmhInfo) { | ||
| 28 | + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) | ||
| 29 | + } | ||
| 30 | + // 标题 | ||
| 31 | + if (this.contentDTO.newsTitle) { | ||
| 32 | + Text(this.contentDTO.newsTitle) | ||
| 33 | + .fontSize($r('app.float.font_size_17')) | ||
| 34 | + .fontColor($r('app.color.color_222222')) | ||
| 35 | + .width(CommonConstants.FULL_WIDTH) | ||
| 36 | + .textOverflowStyle(2) | ||
| 37 | + .margin({ bottom: 8 }) | ||
| 38 | + .lineHeight(25) | ||
| 39 | + } | ||
| 40 | + if (this.contentDTO.fullColumnImgUrls?.length > 0) { | ||
| 41 | + Flex() { | ||
| 42 | + ForEach(this.contentDTO.fullColumnImgUrls.slice(0, 3), (item: fullColumnImgUrlItem, index: number) => { | ||
| 43 | + Image(item.url).flexBasis(113).height(75).margin({ right: index > 1 ? 0 : 2 }) | ||
| 44 | + }) | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | ||
| 48 | + } | ||
| 49 | + .padding({ | ||
| 50 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 51 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 52 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 53 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 54 | + }) | ||
| 55 | + .onClick((event: ClickEvent) => { | ||
| 56 | + ProcessUtils.processPage(this.contentDTO) | ||
| 57 | + }) | ||
| 58 | + } | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +interface radiusType { | ||
| 62 | + topLeft: number | Resource; | ||
| 63 | + topRight: number | Resource; | ||
| 64 | + bottomLeft: number | Resource; | ||
| 65 | + bottomRight: number | Resource; | ||
| 66 | +} | ||
| 67 | + | ||
| 68 | +@Component | ||
| 69 | +struct createImg { | ||
| 70 | + @Prop contentDTO: ContentDTO | ||
| 71 | + | ||
| 72 | + build() { | ||
| 73 | + GridRow() { | ||
| 74 | + if (this.contentDTO.fullColumnImgUrls[0].landscape === 1) { | ||
| 75 | + // 横屏 | ||
| 76 | + GridCol({ | ||
| 77 | + span: { xs: 12 } | ||
| 78 | + }) { | ||
| 79 | + Stack() { | ||
| 80 | + Image(this.contentDTO.coverUrl) | ||
| 81 | + .width(CommonConstants.FULL_WIDTH) | ||
| 82 | + .aspectRatio(16 / 9) | ||
| 83 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 84 | + CardMediaInfo({ contentDTO: this.contentDTO }) | ||
| 85 | + } | ||
| 86 | + .align(Alignment.BottomEnd) | ||
| 87 | + } | ||
| 88 | + } else { | ||
| 89 | + // 竖图显示,宽度占50%,高度自适应 | ||
| 90 | + GridCol({ | ||
| 91 | + span: { xs: 6 } | ||
| 92 | + }) { | ||
| 93 | + Stack() { | ||
| 94 | + Image(this.contentDTO.coverUrl) | ||
| 95 | + .width(CommonConstants.FULL_WIDTH) | ||
| 96 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 97 | + CardMediaInfo({ contentDTO: this.contentDTO }) | ||
| 98 | + } | ||
| 99 | + .align(Alignment.BottomEnd) | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | +} | ||
| 105 | + | ||
| 106 | + | ||
| 107 | +@Extend(Text) | ||
| 108 | +function textOverflowStyle(maxLine: number) { | ||
| 109 | + .maxLines(maxLine) | ||
| 110 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 111 | +} |
| 1 | import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean'; | 1 | import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean'; |
| 2 | import { RmhTitle } from '../cardCommon/RmhTitle' | 2 | import { RmhTitle } from '../cardCommon/RmhTitle' |
| 3 | - | 3 | +import { ProcessUtils } from '../../utils/ProcessUtils'; |
| 4 | const TAG = 'Card19Component'; | 4 | const TAG = 'Card19Component'; |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| @@ -13,7 +13,7 @@ export struct Card19Component { | @@ -13,7 +13,7 @@ export struct Card19Component { | ||
| 13 | // coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg', | 13 | // coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg', |
| 14 | // fullColumnImgUrls: [ | 14 | // fullColumnImgUrls: [ |
| 15 | // { | 15 | // { |
| 16 | - // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/quality,q_90/auto-orient,1', | 16 | + // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994155727712256.png?x-oss-process=image/quality,q_90/auto-orient,1', |
| 17 | // height: 1500, | 17 | // height: 1500, |
| 18 | // landscape: 1, | 18 | // landscape: 1, |
| 19 | // size: 1, | 19 | // size: 1, |
| @@ -94,6 +94,9 @@ export struct Card19Component { | @@ -94,6 +94,9 @@ export struct Card19Component { | ||
| 94 | top: $r('app.float.card_comp_pagePadding_tb'), | 94 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 95 | bottom: $r('app.float.card_comp_pagePadding_tb') | 95 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 96 | }) | 96 | }) |
| 97 | + .onClick((event: ClickEvent) => { | ||
| 98 | + ProcessUtils.processPage(this.contentDTO) | ||
| 99 | + }) | ||
| 97 | } | 100 | } |
| 98 | } | 101 | } |
| 99 | 102 | ||
| @@ -107,6 +110,8 @@ interface radiusType { | @@ -107,6 +110,8 @@ interface radiusType { | ||
| 107 | @Component | 110 | @Component |
| 108 | struct createImg { | 111 | struct createImg { |
| 109 | @Prop fullColumnImgUrls: FullColumnImgUrlDTO[] | 112 | @Prop fullColumnImgUrls: FullColumnImgUrlDTO[] |
| 113 | + @State picWidth: number = 0; | ||
| 114 | + @State picHeight: number = 0; | ||
| 110 | aboutToAppear(): void { | 115 | aboutToAppear(): void { |
| 111 | if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位 | 116 | if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位 |
| 112 | this.fullColumnImgUrls.splice(2,0, { | 117 | this.fullColumnImgUrls.splice(2,0, { |
| @@ -137,18 +142,77 @@ struct createImg { | @@ -137,18 +142,77 @@ struct createImg { | ||
| 137 | return radius | 142 | return radius |
| 138 | } | 143 | } |
| 139 | 144 | ||
| 145 | + getPicType(){ | ||
| 146 | + if (this.picWidth && this.picWidth) { | ||
| 147 | + if (this.picWidth / this.picHeight > 343/172) { | ||
| 148 | + return 1; //横长图 | ||
| 149 | + } else if (this.picHeight / this.picWidth > 305/228) { | ||
| 150 | + return 2; //竖长图 | ||
| 151 | + } else { | ||
| 152 | + return 3 | ||
| 153 | + } | ||
| 154 | + } else { | ||
| 155 | + return 3; //普通图 | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + | ||
| 140 | build() { | 160 | build() { |
| 141 | GridRow({ | 161 | GridRow({ |
| 142 | gutter: { x: 2, y: 2 } | 162 | gutter: { x: 2, y: 2 } |
| 143 | }) { | 163 | }) { |
| 144 | ForEach(this.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => { | 164 | ForEach(this.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => { |
| 145 | if (this.fullColumnImgUrls.length === 1) { | 165 | if (this.fullColumnImgUrls.length === 1) { |
| 166 | + if (this.getPicType() !== 3) { | ||
| 167 | + GridCol({ | ||
| 168 | + span: this.getPicType() === 1 ? 12 : 8 | ||
| 169 | + }){ | ||
| 170 | + Stack({ | ||
| 171 | + alignContent: Alignment.BottomEnd | ||
| 172 | + }) { | ||
| 173 | + if (this.getPicType() === 1) { | ||
| 174 | + Image(item.fullUrl) | ||
| 175 | + .width('100%') | ||
| 176 | + .height(172) | ||
| 177 | + .autoResize(true) | ||
| 178 | + .borderRadius(this.caclImageRadius(index)) | ||
| 179 | + } else if (this.getPicType() === 2) { | ||
| 180 | + Image(item.fullUrl) | ||
| 181 | + .width('100%') | ||
| 182 | + .height(305) | ||
| 183 | + .autoResize(true) | ||
| 184 | + .borderRadius(this.caclImageRadius(index)) | ||
| 185 | + } | ||
| 186 | + Flex({ direction: FlexDirection.Row }) { | ||
| 187 | + Image($r('app.media.icon_long_pic')) | ||
| 188 | + .width(14) | ||
| 189 | + .height(14) | ||
| 190 | + .margin({right: 4}) | ||
| 191 | + Text('长图') | ||
| 192 | + .fontSize(12) | ||
| 193 | + .fontWeight(400) | ||
| 194 | + .fontColor(0xffffff) | ||
| 195 | + .fontFamily('PingFang SC') | ||
| 196 | + } | ||
| 197 | + .width(48) | ||
| 198 | + .padding({bottom: 9}) | ||
| 199 | + | ||
| 200 | + } | ||
| 201 | + } | ||
| 202 | + } else { | ||
| 146 | GridCol({ | 203 | GridCol({ |
| 147 | span: { xs: 8 } | 204 | span: { xs: 8 } |
| 148 | }) { | 205 | }) { |
| 149 | Image(item.fullUrl) | 206 | Image(item.fullUrl) |
| 150 | .width('100%') | 207 | .width('100%') |
| 151 | .borderRadius(this.caclImageRadius(index)) | 208 | .borderRadius(this.caclImageRadius(index)) |
| 209 | + .autoResize(true) | ||
| 210 | + .opacity(!this.picWidth && !this.picHeight ? 0 : 1) | ||
| 211 | + .onComplete(callback => { | ||
| 212 | + this.picWidth = callback?.width || 0; | ||
| 213 | + this.picHeight = callback?.height || 0; | ||
| 214 | + }) | ||
| 215 | + } | ||
| 152 | } | 216 | } |
| 153 | } else if (this.fullColumnImgUrls.length === 4) { | 217 | } else if (this.fullColumnImgUrls.length === 4) { |
| 154 | GridCol({ | 218 | GridCol({ |
| @@ -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 | - | 5 | +import { ProcessUtils } from '../../utils/ProcessUtils'; |
| 6 | const TAG = 'Card20Component'; | 6 | const TAG = 'Card20Component'; |
| 7 | 7 | ||
| 8 | /** | 8 | /** |
| @@ -71,6 +71,9 @@ export struct Card20Component { | @@ -71,6 +71,9 @@ export struct Card20Component { | ||
| 71 | top: $r('app.float.card_comp_pagePadding_tb'), | 71 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 72 | bottom: $r('app.float.card_comp_pagePadding_tb') | 72 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 73 | }) | 73 | }) |
| 74 | + .onClick((event: ClickEvent) => { | ||
| 75 | + ProcessUtils.processPage(this.contentDTO) | ||
| 76 | + }) | ||
| 74 | } | 77 | } |
| 75 | } | 78 | } |
| 76 | 79 |
| @@ -42,9 +42,9 @@ export struct Card6Component { | @@ -42,9 +42,9 @@ export struct Card6Component { | ||
| 42 | .alignItems(HorizontalAlign.Start) | 42 | .alignItems(HorizontalAlign.Start) |
| 43 | .justifyContent(FlexAlign.Start) | 43 | .justifyContent(FlexAlign.Start) |
| 44 | .width('58%') | 44 | .width('58%') |
| 45 | - if (this.contentDTO.coverUrl) { | ||
| 46 | Stack() { | 45 | Stack() { |
| 47 | Image(this.contentDTO.coverUrl) | 46 | Image(this.contentDTO.coverUrl) |
| 47 | + .backgroundColor($r('app.color.color_B0B0B0')) | ||
| 48 | .borderRadius(5) | 48 | .borderRadius(5) |
| 49 | .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) | 49 | .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) |
| 50 | .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 90 : 180) | 50 | .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 90 : 180) |
| @@ -52,7 +52,6 @@ export struct Card6Component { | @@ -52,7 +52,6 @@ export struct Card6Component { | ||
| 52 | } | 52 | } |
| 53 | .alignContent(Alignment.BottomEnd) | 53 | .alignContent(Alignment.BottomEnd) |
| 54 | } | 54 | } |
| 55 | - } | ||
| 56 | .onClick((event: ClickEvent) => { | 55 | .onClick((event: ClickEvent) => { |
| 57 | ProcessUtils.processPage(this.contentDTO) | 56 | ProcessUtils.processPage(this.contentDTO) |
| 58 | }) | 57 | }) |
| @@ -15,7 +15,7 @@ export struct Card9Component { | @@ -15,7 +15,7 @@ export struct Card9Component { | ||
| 15 | build() { | 15 | build() { |
| 16 | Column() { | 16 | Column() { |
| 17 | // 顶部标题,最多两行 | 17 | // 顶部标题,最多两行 |
| 18 | - if (this.contentDTO.newsTitle) { | 18 | + if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { |
| 19 | Text(this.contentDTO.newsTitle) | 19 | Text(this.contentDTO.newsTitle) |
| 20 | .width(CommonConstants.FULL_WIDTH) | 20 | .width(CommonConstants.FULL_WIDTH) |
| 21 | .fontSize($r('app.float.font_size_17')) | 21 | .fontSize($r('app.float.font_size_17')) |
| @@ -104,7 +104,7 @@ export struct Card9Component { | @@ -104,7 +104,7 @@ export struct Card9Component { | ||
| 104 | Column() { | 104 | Column() { |
| 105 | Row() { | 105 | Row() { |
| 106 | // 标题 | 106 | // 标题 |
| 107 | - Image($r("app.media.point_icon")) | 107 | + Image($r("app.media.timeline_rect")) |
| 108 | .width(9) | 108 | .width(9) |
| 109 | .height(9) | 109 | .height(9) |
| 110 | .margin({ right: 5 }) | 110 | .margin({ right: 5 }) |
| @@ -157,11 +157,11 @@ struct CreatorItem { | @@ -157,11 +157,11 @@ struct CreatorItem { | ||
| 157 | .width(44) | 157 | .width(44) |
| 158 | .height(44) | 158 | .height(44) |
| 159 | if (this.isSelected) { | 159 | if (this.isSelected) { |
| 160 | - Image($r('app.media.MyCollection_selected_icon')) | 160 | + Image($r('app.media.rmh_selected')) |
| 161 | .width(16) | 161 | .width(16) |
| 162 | .height(16) | 162 | .height(16) |
| 163 | } else { | 163 | } else { |
| 164 | - Image($r('app.media.ic_succeed_refresh')) | 164 | + Image($r('app.media.rmh_unselected')) |
| 165 | .width(16) | 165 | .width(16) |
| 166 | .height(16) | 166 | .height(16) |
| 167 | } | 167 | } |
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/LiveCommentComponent.ets
0 → 100644
| 1 | +import { router } from '@kit.ArkUI' | ||
| 2 | +import { NumberFormatterUtils, ToastUtils } from 'wdKit/Index' | ||
| 3 | + | ||
| 4 | +@Component | ||
| 5 | +export struct LiveCommentComponent { | ||
| 6 | + public clickCollect?: (isCollect: boolean) => void | ||
| 7 | + public clickHeart?: (isHeart: boolean) => void | ||
| 8 | + @State isCollect: boolean = false | ||
| 9 | + @State isLike: boolean = false | ||
| 10 | + @State heartNum: number = 0 | ||
| 11 | + | ||
| 12 | + build() { | ||
| 13 | + Row() { | ||
| 14 | + Image($r('app.media.back_icon')) | ||
| 15 | + .width(24) | ||
| 16 | + .height(24) | ||
| 17 | + .margin({ | ||
| 18 | + left: 16, | ||
| 19 | + right: 12 | ||
| 20 | + }) | ||
| 21 | + .onClick(() => { | ||
| 22 | + router.back() | ||
| 23 | + }) | ||
| 24 | + Stack() { | ||
| 25 | + Image($r('app.media.background_search')) | ||
| 26 | + .interpolation(ImageInterpolation.High) | ||
| 27 | + .width('100%') | ||
| 28 | + .height(30) | ||
| 29 | + TextArea({ placeholder: '说两句...' }) | ||
| 30 | + .backgroundColor(Color.Transparent) | ||
| 31 | + .enabled(false) | ||
| 32 | + .margin({ | ||
| 33 | + left: 5, | ||
| 34 | + right: 20 | ||
| 35 | + }) | ||
| 36 | + } | ||
| 37 | + .layoutWeight(1) | ||
| 38 | + .onClick(() => { | ||
| 39 | + ToastUtils.shortToast('依赖其它功能开发') | ||
| 40 | + }) | ||
| 41 | + | ||
| 42 | + Image(this.isCollect ? $r('app.media.ic_collect_check') : $r('app.media.iv_live_comment_collect_un')) | ||
| 43 | + .width(24) | ||
| 44 | + .height(24) | ||
| 45 | + .margin({ | ||
| 46 | + left: 20, | ||
| 47 | + right: 24 | ||
| 48 | + }) | ||
| 49 | + .onClick(() => { | ||
| 50 | + this.isCollect = !this.isCollect | ||
| 51 | + }) | ||
| 52 | + Image($r('app.media.iv_live_comment_share')) | ||
| 53 | + .width(24) | ||
| 54 | + .height(24) | ||
| 55 | + .onClick(() => { | ||
| 56 | + ToastUtils.shortToast('依赖其它功能开发') | ||
| 57 | + }) | ||
| 58 | + Stack() { | ||
| 59 | + Text(NumberFormatterUtils.formatNumberWithWan(this.heartNum)) | ||
| 60 | + .height(12) | ||
| 61 | + .fontSize('8fp') | ||
| 62 | + .fontWeight(500) | ||
| 63 | + .fontColor(Color.White) | ||
| 64 | + .backgroundImage($r('app.media.iv_live_comment_hert_num')) | ||
| 65 | + .backgroundImageSize(ImageSize.Cover) | ||
| 66 | + .margin({ | ||
| 67 | + left: 6, | ||
| 68 | + bottom: 33 | ||
| 69 | + }) | ||
| 70 | + .padding({ | ||
| 71 | + left: 6, | ||
| 72 | + right: 2 | ||
| 73 | + }) | ||
| 74 | + Image(this.isLike ? $r('app.media.iv_live_comment_hert_light') : $r('app.media.comment_like_normal')) | ||
| 75 | + .width(24) | ||
| 76 | + .height(24) | ||
| 77 | + .margin({ | ||
| 78 | + right: 20, | ||
| 79 | + }) | ||
| 80 | + } | ||
| 81 | + .width(44) | ||
| 82 | + .height(56) | ||
| 83 | + .margin({ | ||
| 84 | + left: 24 | ||
| 85 | + }) | ||
| 86 | + .onClick(() => { | ||
| 87 | + this.isLike = !this.isLike | ||
| 88 | + }) | ||
| 89 | + } | ||
| 90 | + .height(56) | ||
| 91 | + .width('100%') | ||
| 92 | + .backgroundColor(Color.White) | ||
| 93 | + } | ||
| 94 | +} |
| 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 { CollectionUtils, DateTimeUtils, Logger, StringUtils, ToastUtils } from 'wdKit/Index'; | ||
| 4 | +import PageViewModel from '../../viewmodel/PageViewModel'; | ||
| 3 | 5 | ||
| 4 | const TAG = 'Zh_Grid_Layout-02'; | 6 | const TAG = 'Zh_Grid_Layout-02'; |
| 5 | const FULL_PARENT: string = '100%'; | 7 | const FULL_PARENT: string = '100%'; |
| @@ -11,19 +13,28 @@ let listSize: number = 2; | @@ -11,19 +13,28 @@ let listSize: number = 2; | ||
| 11 | * Zh_Grid_Layout-02 | 13 | * Zh_Grid_Layout-02 |
| 12 | * | 14 | * |
| 13 | */ | 15 | */ |
| 14 | -@Preview | ||
| 15 | @Component | 16 | @Component |
| 16 | export struct ZhGridLayout02 { | 17 | export struct ZhGridLayout02 { |
| 17 | @State compDTO: CompDTO = {} as CompDTO | 18 | @State compDTO: CompDTO = {} as CompDTO |
| 19 | + @State operDataList: ContentDTO[] = [] | ||
| 20 | + currentPage = 1 | ||
| 21 | + pageSize = 12 | ||
| 18 | 22 | ||
| 19 | aboutToAppear() { | 23 | aboutToAppear() { |
| 20 | - if (this.compDTO.operDataList) { | ||
| 21 | - listSize = this.compDTO.operDataList.length > 5 ? 2 : this.compDTO.operDataList.length; | ||
| 22 | - } | 24 | + Logger.debug(TAG, 'aboutToAppear ' + this.compDTO.objectTitle) |
| 25 | + this.currentPage = 1 | ||
| 26 | + PageViewModel.getLiveReviewUrl(this.currentPage, this.pageSize).then((liveReviewDTO) => { | ||
| 27 | + this.operDataList = [] | ||
| 28 | + this.operDataList.push(...liveReviewDTO.list) | ||
| 29 | + }) | ||
| 23 | } | 30 | } |
| 24 | 31 | ||
| 25 | build() { | 32 | build() { |
| 26 | Column() { | 33 | Column() { |
| 34 | + | ||
| 35 | + | ||
| 36 | + Scroll() { | ||
| 37 | + Column() { | ||
| 27 | Row() { | 38 | Row() { |
| 28 | Image($r("app.media.redLine")) | 39 | Image($r("app.media.redLine")) |
| 29 | .width(3) | 40 | .width(3) |
| @@ -38,19 +49,40 @@ export struct ZhGridLayout02 { | @@ -38,19 +49,40 @@ export struct ZhGridLayout02 { | ||
| 38 | .margin({ top: 8, bottom: 8 }) | 49 | .margin({ top: 8, bottom: 8 }) |
| 39 | .width(CommonConstants.FULL_WIDTH) | 50 | .width(CommonConstants.FULL_WIDTH) |
| 40 | 51 | ||
| 41 | - | ||
| 42 | GridRow({ | 52 | GridRow({ |
| 43 | columns: { sm: listSize, md: 2 }, | 53 | columns: { sm: listSize, md: 2 }, |
| 44 | breakpoints: { value: ['320vp', '520vp', '840vp'] } | 54 | breakpoints: { value: ['320vp', '520vp', '840vp'] } |
| 45 | }) { | 55 | }) { |
| 46 | - ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => { | 56 | + ForEach(this.operDataList, (item: ContentDTO, index: number) => { |
| 47 | GridCol() { | 57 | GridCol() { |
| 48 | - this.buildItemCard(this.compDTO.operDataList[index]); | 58 | + this.buildItemCard(item); |
| 49 | } | 59 | } |
| 50 | }) | 60 | }) |
| 51 | } | 61 | } |
| 52 | } | 62 | } |
| 63 | + | ||
| 64 | + } | ||
| 65 | + .width("100%") | ||
| 66 | + .height("100%") | ||
| 67 | + // .layoutWeight(1) | ||
| 68 | + .edgeEffect(EdgeEffect.None) | ||
| 69 | + .scrollBar(BarState.Off) | ||
| 70 | + .onReachStart(() => { | ||
| 71 | + Logger.debug(TAG, 'onReachStart') | ||
| 72 | + }) | ||
| 73 | + .onReachEnd(() => { | ||
| 74 | + Logger.debug(TAG, 'onReachEnd') | ||
| 75 | + this.addItems() | ||
| 76 | + }) | ||
| 77 | + .nestedScroll({ | ||
| 78 | + scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 79 | + scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 80 | + }) | ||
| 81 | + } | ||
| 53 | .width(CommonConstants.FULL_WIDTH) | 82 | .width(CommonConstants.FULL_WIDTH) |
| 83 | + // .width("100%") | ||
| 84 | + .height("100%") | ||
| 85 | + // .layoutWeight(1) | ||
| 54 | .padding({ | 86 | .padding({ |
| 55 | top: 14, | 87 | top: 14, |
| 56 | left: 16, | 88 | left: 16, |
| @@ -78,6 +110,15 @@ export struct ZhGridLayout02 { | @@ -78,6 +110,15 @@ export struct ZhGridLayout02 { | ||
| 78 | } | 110 | } |
| 79 | .width('100%') | 111 | .width('100%') |
| 80 | } | 112 | } |
| 113 | + | ||
| 114 | + addItems() { | ||
| 115 | + Logger.debug(TAG, 'addItems') | ||
| 116 | + this.currentPage++ | ||
| 117 | + PageViewModel.getLiveReviewUrl(this.currentPage, this.pageSize).then((liveReviewDTO) => { | ||
| 118 | + this.operDataList.push(...liveReviewDTO.list) | ||
| 119 | + Logger.debug(TAG, 'addItems after: ' + this.operDataList.length) | ||
| 120 | + }) | ||
| 121 | + } | ||
| 81 | } | 122 | } |
| 82 | 123 | ||
| 83 | 124 |
| @@ -56,6 +56,9 @@ export struct ZhGridLayout03 { | @@ -56,6 +56,9 @@ export struct ZhGridLayout03 { | ||
| 56 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 56 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 57 | } | 57 | } |
| 58 | .width('100%') | 58 | .width('100%') |
| 59 | + .onClick((event: ClickEvent) => { | ||
| 60 | + ProcessUtils.processPage(item) | ||
| 61 | + }) | ||
| 59 | } | 62 | } |
| 60 | } | 63 | } |
| 61 | 64 |
| 1 | +import { CompDTO, ContentDTO, Params } from 'wdBean'; | ||
| 2 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 3 | +import { HttpUrlUtils } from 'wdNetwork/Index'; | ||
| 4 | +import { postInteractAccentionOperateParams } from 'wdBean'; | ||
| 5 | +import { PageRepository } from '../../repository/PageRepository'; | ||
| 6 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 小视频横划卡 | ||
| 10 | + * Zh_Single_Row-02 | ||
| 11 | + */ | ||
| 12 | +const TAG = 'Zh_Single_Row-02' | ||
| 13 | + | ||
| 14 | +@Entry | ||
| 15 | +@Component | ||
| 16 | +export struct ZhSingleRow02 { | ||
| 17 | + @State compDTO: CompDTO = { | ||
| 18 | + objectTitle: '大标题', | ||
| 19 | + operDataList: [ | ||
| 20 | + { | ||
| 21 | + rmhInfo: { | ||
| 22 | + rmhId: '2489729', | ||
| 23 | + rmhName: '陕西青年职业学院', | ||
| 24 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 25 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 26 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 27 | + } | ||
| 28 | + }, | ||
| 29 | + { | ||
| 30 | + rmhInfo: { | ||
| 31 | + rmhId: '2489729', | ||
| 32 | + rmhName: '陕西青年职业学院', | ||
| 33 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 34 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 35 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 36 | + } | ||
| 37 | + }, | ||
| 38 | + { | ||
| 39 | + rmhInfo: { | ||
| 40 | + rmhId: '2489729', | ||
| 41 | + rmhName: '陕西青年职业学院', | ||
| 42 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 43 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 44 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 45 | + } | ||
| 46 | + }, | ||
| 47 | + { | ||
| 48 | + rmhInfo: { | ||
| 49 | + rmhId: '2489729', | ||
| 50 | + rmhName: '陕西青年职业学院', | ||
| 51 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 52 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 53 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 54 | + } | ||
| 55 | + }, | ||
| 56 | + { | ||
| 57 | + rmhInfo: { | ||
| 58 | + rmhId: '2489729', | ||
| 59 | + rmhName: '陕西青年职业学院', | ||
| 60 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 61 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 62 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 63 | + } | ||
| 64 | + }, | ||
| 65 | + ] | ||
| 66 | + } as CompDTO | ||
| 67 | + | ||
| 68 | + build() { | ||
| 69 | + Column() { | ||
| 70 | + //顶部 | ||
| 71 | + this.CompHeader(this.compDTO) | ||
| 72 | + Row(){ | ||
| 73 | + // 列表内容 | ||
| 74 | + List() { | ||
| 75 | + ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => { | ||
| 76 | + CreatorItem({ | ||
| 77 | + item | ||
| 78 | + }) | ||
| 79 | + .margin({right: index === this.compDTO.operDataList.length - 1 ? $r('app.float.card_comp_pagePadding_lf') : 0}) | ||
| 80 | + }) | ||
| 81 | + } | ||
| 82 | + .listDirection(Axis.Horizontal) | ||
| 83 | + } | ||
| 84 | + .width(CommonConstants.FULL_WIDTH) | ||
| 85 | + .height(208) | ||
| 86 | + } | ||
| 87 | + .padding({ | ||
| 88 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 89 | + // right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 90 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 91 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 92 | + }) | ||
| 93 | + .backgroundColor($r('app.color.white')) | ||
| 94 | + .margin({ bottom: 8 }) | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + @Builder | ||
| 98 | + CompHeader(item: CompDTO) { | ||
| 99 | + Row() { | ||
| 100 | + Row() { | ||
| 101 | + Image($r("app.media.redLine")) | ||
| 102 | + .width(3) | ||
| 103 | + .height(16) | ||
| 104 | + .margin({ right: 4 }) | ||
| 105 | + Text(item.objectTitle) | ||
| 106 | + .fontSize($r("app.float.font_size_17")) | ||
| 107 | + .fontColor($r("app.color.color_222222")) | ||
| 108 | + .fontWeight(600) | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + Row() { | ||
| 112 | + Text("更多") | ||
| 113 | + .fontSize($r("app.float.font_size_14")) | ||
| 114 | + .fontColor($r("app.color.color_999999")) | ||
| 115 | + .margin({ right: 1 }) | ||
| 116 | + Image($r("app.media.more")) | ||
| 117 | + .width(14) | ||
| 118 | + .height(14) | ||
| 119 | + .onClick(() => { | ||
| 120 | + // TODO 跳转的页面,定义的入参可能不合理。推荐id: 41 | ||
| 121 | + let params: Params = { | ||
| 122 | + pageID: "1" | ||
| 123 | + } | ||
| 124 | + WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params) | ||
| 125 | + }) | ||
| 126 | + } | ||
| 127 | + .padding({ | ||
| 128 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 129 | + }) | ||
| 130 | + } | ||
| 131 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 132 | + .margin({ top: 8, bottom: 8 }) | ||
| 133 | + .width('100%') | ||
| 134 | + } | ||
| 135 | +} | ||
| 136 | + | ||
| 137 | +@Extend(Text) | ||
| 138 | +function textOverflowStyle(maxLine: number) { | ||
| 139 | + .maxLines(maxLine) | ||
| 140 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 141 | +} | ||
| 142 | + | ||
| 143 | +@Component | ||
| 144 | +struct CreatorItem { | ||
| 145 | + @Prop item: ContentDTO | ||
| 146 | + @State rmhIsAttention: number = 0 | ||
| 147 | + build() { | ||
| 148 | + ListItem() { | ||
| 149 | + Column() { | ||
| 150 | + Stack({ alignContent: Alignment.Bottom }) { | ||
| 151 | + Image('') | ||
| 152 | + .width(156) | ||
| 153 | + .height(208) | ||
| 154 | + Row() | ||
| 155 | + .width(156) | ||
| 156 | + .height(80) | ||
| 157 | + .linearGradient({ | ||
| 158 | + direction: GradientDirection.Bottom, | ||
| 159 | + colors: [[0xffffff, 0.0], [0x000000, 1.0]] | ||
| 160 | + }) | ||
| 161 | + .opacity(0.3) | ||
| 162 | + Text('这里显示卡片标题这里显示卡片标题这里显示卡片标题这里显示卡片标题这里显示卡片标题') | ||
| 163 | + .fontColor(0xffffff) | ||
| 164 | + .fontSize(14) | ||
| 165 | + .maxLines(2) | ||
| 166 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 167 | + .width(140) | ||
| 168 | + .height(40) | ||
| 169 | + .margin({bottom: 8}) | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + } | ||
| 173 | + .width(156) | ||
| 174 | + .height(208) | ||
| 175 | + .margin({ right: 11 }) | ||
| 176 | + .borderWidth(1) | ||
| 177 | + .borderColor($r('app.color.color_EDEDED')) | ||
| 178 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 179 | + } | ||
| 180 | + .onClick(() => { | ||
| 181 | + console.log('跳转到rmh'); | ||
| 182 | + }) | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + /** | ||
| 186 | + * 关注号主 TODO 这里后面需要抽离 | ||
| 187 | + */ | ||
| 188 | + handleAccention(item: ContentDTO, status: number) { | ||
| 189 | + this.rmhIsAttention = this.rmhIsAttention ? 0 : 1 | ||
| 190 | + return | ||
| 191 | + // 未登录,跳转登录 | ||
| 192 | + if (!HttpUrlUtils.getUserId()) { | ||
| 193 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 194 | + return | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + const params: postInteractAccentionOperateParams = { | ||
| 198 | + attentionUserType: item.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号) | ||
| 199 | + attentionUserId: item.rmhInfo?.userId || '', // 被关注用户号主id | ||
| 200 | + attentionCreatorId: item.rmhInfo?.rmhId || '', // 被关注用户号主id | ||
| 201 | + // userType: 1, | ||
| 202 | + // userId: '1', // TODO 用户id需要从本地获取 | ||
| 203 | + status: status, | ||
| 204 | + } | ||
| 205 | + PageRepository.postInteractAccentionOperate(params).then(res => { | ||
| 206 | + console.log(TAG, '关注号主==', JSON.stringify(res.data)) | ||
| 207 | + if (status === 1) { | ||
| 208 | + this.rmhIsAttention = 0 | ||
| 209 | + } else { | ||
| 210 | + this.rmhIsAttention = 1 | ||
| 211 | + } | ||
| 212 | + }) | ||
| 213 | + } | ||
| 214 | +} |
| 1 | +import { CompDTO, ContentDTO, Params } from 'wdBean'; | ||
| 2 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 3 | +import { HttpUrlUtils } from 'wdNetwork/Index'; | ||
| 4 | +import { postInteractAccentionOperateParams } from 'wdBean'; | ||
| 5 | +import { PageRepository } from '../../repository/PageRepository'; | ||
| 6 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 精选评论卡 | ||
| 10 | + * Zh_Single_Row-06 | ||
| 11 | + */ | ||
| 12 | +const TAG = 'Zh_Single_Row-06' | ||
| 13 | + | ||
| 14 | +@Entry | ||
| 15 | +@Component | ||
| 16 | +export struct ZhSingleRow06 { | ||
| 17 | + @State compDTO: CompDTO = { | ||
| 18 | + objectTitle: '大标题', | ||
| 19 | + operDataList: [ | ||
| 20 | + { | ||
| 21 | + rmhInfo: { | ||
| 22 | + rmhId: '2489729', | ||
| 23 | + rmhName: '陕西青年职业学院', | ||
| 24 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 25 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 26 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 27 | + } | ||
| 28 | + }, | ||
| 29 | + { | ||
| 30 | + rmhInfo: { | ||
| 31 | + rmhId: '2489729', | ||
| 32 | + rmhName: '陕西青年职业学院', | ||
| 33 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 34 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 35 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 36 | + } | ||
| 37 | + }, | ||
| 38 | + { | ||
| 39 | + rmhInfo: { | ||
| 40 | + rmhId: '2489729', | ||
| 41 | + rmhName: '陕西青年职业学院', | ||
| 42 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 43 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 44 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 45 | + } | ||
| 46 | + }, | ||
| 47 | + { | ||
| 48 | + rmhInfo: { | ||
| 49 | + rmhId: '2489729', | ||
| 50 | + rmhName: '陕西青年职业学院', | ||
| 51 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 52 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 53 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 54 | + } | ||
| 55 | + }, | ||
| 56 | + { | ||
| 57 | + rmhInfo: { | ||
| 58 | + rmhId: '2489729', | ||
| 59 | + rmhName: '陕西青年职业学院', | ||
| 60 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 61 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 62 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 63 | + } | ||
| 64 | + }, | ||
| 65 | + ] | ||
| 66 | + } as CompDTO | ||
| 67 | + | ||
| 68 | + build() { | ||
| 69 | + Column() { | ||
| 70 | + //顶部 | ||
| 71 | + this.CompHeader(this.compDTO) | ||
| 72 | + Row(){ | ||
| 73 | + // 列表内容 | ||
| 74 | + List() { | ||
| 75 | + ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => { | ||
| 76 | + CreatorItem({ | ||
| 77 | + item | ||
| 78 | + }) | ||
| 79 | + .margin({right: index === this.compDTO.operDataList.length - 1 ? $r('app.float.card_comp_pagePadding_lf') : 0}) | ||
| 80 | + }) | ||
| 81 | + } | ||
| 82 | + .listDirection(Axis.Horizontal) | ||
| 83 | + } | ||
| 84 | + .width(CommonConstants.FULL_WIDTH) | ||
| 85 | + .height(208) | ||
| 86 | + } | ||
| 87 | + .padding({ | ||
| 88 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 89 | + // right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 90 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 91 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 92 | + }) | ||
| 93 | + .backgroundColor($r('app.color.white')) | ||
| 94 | + .margin({ bottom: 8 }) | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + @Builder | ||
| 98 | + CompHeader(item: CompDTO) { | ||
| 99 | + Row() { | ||
| 100 | + Row() { | ||
| 101 | + Image($r("app.media.icon_elite_comment")) | ||
| 102 | + .width(24) | ||
| 103 | + .height(24) | ||
| 104 | + .margin({ right: 4 }) | ||
| 105 | + Text('精选评论') | ||
| 106 | + .fontSize($r("app.float.font_size_17")) | ||
| 107 | + .fontColor($r("app.color.color_222222")) | ||
| 108 | + .fontWeight(600) | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + Row() { | ||
| 112 | + Text("更多") | ||
| 113 | + .fontSize($r("app.float.font_size_14")) | ||
| 114 | + .fontColor($r("app.color.color_999999")) | ||
| 115 | + .margin({ right: 1 }) | ||
| 116 | + Image($r("app.media.more")) | ||
| 117 | + .width(14) | ||
| 118 | + .height(14) | ||
| 119 | + .onClick(() => { | ||
| 120 | + // TODO 跳转的页面,定义的入参可能不合理。推荐id: 41 | ||
| 121 | + let params: Params = { | ||
| 122 | + pageID: "1" | ||
| 123 | + } | ||
| 124 | + WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params) | ||
| 125 | + }) | ||
| 126 | + } | ||
| 127 | + .padding({ | ||
| 128 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 129 | + }) | ||
| 130 | + } | ||
| 131 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 132 | + .margin({ top: 8, bottom: 8 }) | ||
| 133 | + .width('100%') | ||
| 134 | + } | ||
| 135 | +} | ||
| 136 | + | ||
| 137 | +@Extend(Text) | ||
| 138 | +function textOverflowStyle(maxLine: number) { | ||
| 139 | + .maxLines(maxLine) | ||
| 140 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 141 | +} | ||
| 142 | + | ||
| 143 | +@Component | ||
| 144 | +struct CreatorItem { | ||
| 145 | + @Prop item: ContentDTO | ||
| 146 | + @State rmhIsAttention: number = 0 | ||
| 147 | + build() { | ||
| 148 | + ListItem() { | ||
| 149 | + Column() { | ||
| 150 | + Flex({direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween}) { | ||
| 151 | + Column() { | ||
| 152 | + Row() { | ||
| 153 | + Image('') | ||
| 154 | + .width(20) | ||
| 155 | + .height(20) | ||
| 156 | + .margin({right: 4}) | ||
| 157 | + .border({width: 1, color: 0xcccccc, radius: 10}) | ||
| 158 | + Text('立志之间') | ||
| 159 | + .fontColor(0x212228) | ||
| 160 | + .fontSize(12) | ||
| 161 | + } | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + Column() { | ||
| 165 | + Row() { | ||
| 166 | + Image($r('app.media.icon_like_no')) | ||
| 167 | + .width(16) | ||
| 168 | + .height(16) | ||
| 169 | + .margin({right: 4}) | ||
| 170 | + Text('3835') | ||
| 171 | + .fontSize(14) | ||
| 172 | + .fontColor(0x999999) | ||
| 173 | + } | ||
| 174 | + } | ||
| 175 | + } | ||
| 176 | + .margin({top: 10, left: 10, right: 10, bottom: 8}) | ||
| 177 | + | ||
| 178 | + Text('就业不仅是民生问题,也是发展问题,就业不仅是民生问题,也是发展问题,就业不仅是民生问题,也是发展问题,') | ||
| 179 | + .maxLines(2) | ||
| 180 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 181 | + .margin({left: 10, right: 10, bottom: 8}) | ||
| 182 | + .fontSize(17) | ||
| 183 | + .fontColor(0x212228) | ||
| 184 | + .lineHeight(25) | ||
| 185 | + | ||
| 186 | + Row() { | ||
| 187 | + Image('') | ||
| 188 | + .width(66) | ||
| 189 | + .height(44) | ||
| 190 | + .borderRadius({topLeft: 3, topRight: 0, bottomLeft: 3, bottomRight: 0}) | ||
| 191 | + Text('原文|强化就业优先政策 健全就业促进机制原文|强化就业优先政策 健全就业促进机制原文|强化就业优先政策 健全就业促进机制') | ||
| 192 | + .margin({left: 8}) | ||
| 193 | + .width(172) | ||
| 194 | + .maxLines(2) | ||
| 195 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 196 | + } | ||
| 197 | + .linearGradient({ | ||
| 198 | + direction: GradientDirection.Right, | ||
| 199 | + colors: [[0xffffff, 0.0],[0xffffff, 0.8], [0xf9f9f9, 1.0]] | ||
| 200 | + }) | ||
| 201 | + } | ||
| 202 | + .width(276) | ||
| 203 | + .height(150) | ||
| 204 | + .margin({ right: 10 }) | ||
| 205 | + .borderWidth(1) | ||
| 206 | + .borderColor($r('app.color.color_EDEDED')) | ||
| 207 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 208 | + .backgroundColor(0xf9f9f9) | ||
| 209 | + } | ||
| 210 | + .onClick(() => { | ||
| 211 | + console.log('跳转到rmh'); | ||
| 212 | + }) | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + /** | ||
| 216 | + * 关注号主 TODO 这里后面需要抽离 | ||
| 217 | + */ | ||
| 218 | + handleAccention(item: ContentDTO, status: number) { | ||
| 219 | + this.rmhIsAttention = this.rmhIsAttention ? 0 : 1 | ||
| 220 | + return | ||
| 221 | + // 未登录,跳转登录 | ||
| 222 | + if (!HttpUrlUtils.getUserId()) { | ||
| 223 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 224 | + return | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + const params: postInteractAccentionOperateParams = { | ||
| 228 | + attentionUserType: item.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号) | ||
| 229 | + attentionUserId: item.rmhInfo?.userId || '', // 被关注用户号主id | ||
| 230 | + attentionCreatorId: item.rmhInfo?.rmhId || '', // 被关注用户号主id | ||
| 231 | + // userType: 1, | ||
| 232 | + // userId: '1', // TODO 用户id需要从本地获取 | ||
| 233 | + status: status, | ||
| 234 | + } | ||
| 235 | + PageRepository.postInteractAccentionOperate(params).then(res => { | ||
| 236 | + console.log(TAG, '关注号主==', JSON.stringify(res.data)) | ||
| 237 | + if (status === 1) { | ||
| 238 | + this.rmhIsAttention = 0 | ||
| 239 | + } else { | ||
| 240 | + this.rmhIsAttention = 1 | ||
| 241 | + } | ||
| 242 | + }) | ||
| 243 | + } | ||
| 244 | +} |
| 1 | +import { CompDTO, ContentDTO, Params } from 'wdBean'; | ||
| 2 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 3 | +import { HttpUrlUtils } from 'wdNetwork/Index'; | ||
| 4 | +import { postInteractAccentionOperateParams } from 'wdBean'; | ||
| 5 | +import { PageRepository } from '../repository/PageRepository'; | ||
| 6 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 精选评论卡 | ||
| 10 | + * Zh_Single_Row-06 | ||
| 11 | + */ | ||
| 12 | +const TAG = 'Zh_Single_Row-06' | ||
| 13 | + | ||
| 14 | +@Entry | ||
| 15 | +@Component | ||
| 16 | +export struct ZhSingleRow06 { | ||
| 17 | + @State compDTO: CompDTO = {} as CompDTO | ||
| 18 | + @State list: Array<string> = ['社会', '三个字', '是四个字', '时事', '社会', '三个字', '是四个字', '时事'] | ||
| 19 | + @State activeIndexs: Array<number> = [] | ||
| 20 | + | ||
| 21 | + getItemWidth(index: number) { | ||
| 22 | + if (index % 4 === 0 || index % 4 === 3) { | ||
| 23 | + return 80 | ||
| 24 | + } else { | ||
| 25 | + return 96 | ||
| 26 | + } | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + build() { | ||
| 30 | + Column() { | ||
| 31 | + //顶部 | ||
| 32 | + this.CompHeader(this.compDTO) | ||
| 33 | + Grid() { | ||
| 34 | + ForEach(this.list, (item: string, index: number) => { | ||
| 35 | + GridItem() { | ||
| 36 | + Text(item) | ||
| 37 | + .fontSize(14) | ||
| 38 | + .fontColor(this.activeIndexs.includes(index) ? 0x222222 : 0x666666) | ||
| 39 | + .fontWeight(this.activeIndexs.includes(index) ? 600 : 400) | ||
| 40 | + .textAlign(TextAlign.Center) | ||
| 41 | + } | ||
| 42 | + .onClick(() => { | ||
| 43 | + if (this.activeIndexs.includes(index)) { | ||
| 44 | + const ind = this.activeIndexs.indexOf(index); | ||
| 45 | + this.activeIndexs.splice(ind, 1) | ||
| 46 | + } else { | ||
| 47 | + this.activeIndexs.push(index) | ||
| 48 | + } | ||
| 49 | + }) | ||
| 50 | + }) | ||
| 51 | + } | ||
| 52 | + .height(70) | ||
| 53 | + .columnsTemplate('1fr 1fr 1fr 1fr') | ||
| 54 | + .rowsTemplate('1fr 1fr') | ||
| 55 | + .margin({bottom: 10}) | ||
| 56 | + | ||
| 57 | + | ||
| 58 | + Text('选中标签,为您推荐更多您感兴趣的内容') | ||
| 59 | + .fontSize(12) | ||
| 60 | + .fontColor(0xB0B0B0) | ||
| 61 | + .textAlign(TextAlign.Center) | ||
| 62 | + .margin({bottom: 10}) | ||
| 63 | + | ||
| 64 | + Row() { | ||
| 65 | + Text('选好了') | ||
| 66 | + .fontSize(14) | ||
| 67 | + .fontColor(0x000000) | ||
| 68 | + .width('100%') | ||
| 69 | + .textAlign(TextAlign.Center) | ||
| 70 | + } | ||
| 71 | + .height(40) | ||
| 72 | + .backgroundColor(0xf9f9f9) | ||
| 73 | + .width('100%') | ||
| 74 | + .borderRadius(3) | ||
| 75 | + } | ||
| 76 | + .padding({ | ||
| 77 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 78 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 79 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 80 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 81 | + }) | ||
| 82 | + .backgroundColor($r('app.color.white')) | ||
| 83 | + .margin({ bottom: 8 }) | ||
| 84 | + | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + @Builder | ||
| 88 | + CompHeader(item: CompDTO) { | ||
| 89 | + Row() { | ||
| 90 | + Row() { | ||
| 91 | + Image($r("app.media.icon_interest_ask")) | ||
| 92 | + .width(24) | ||
| 93 | + .height(24) | ||
| 94 | + .margin({ right: 4 }) | ||
| 95 | + Text('以下是否有您感兴趣?') | ||
| 96 | + .fontSize($r("app.float.font_size_17")) | ||
| 97 | + .fontColor(0x000000) | ||
| 98 | + .fontWeight(600) | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + Row() { | ||
| 102 | + Image($r("app.media.close_button")) | ||
| 103 | + .width(14) | ||
| 104 | + .height(14) | ||
| 105 | + .onClick(() => { | ||
| 106 | + }) | ||
| 107 | + } | ||
| 108 | + .padding({ | ||
| 109 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 110 | + }) | ||
| 111 | + } | ||
| 112 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 113 | + .margin({ top: 8, bottom: 8 }) | ||
| 114 | + .width('100%') | ||
| 115 | + } | ||
| 116 | +} | ||
| 117 | + | ||
| 118 | +@Extend(Text) | ||
| 119 | +function textOverflowStyle(maxLine: number) { | ||
| 120 | + .maxLines(maxLine) | ||
| 121 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 122 | +} | ||
| 123 | + | ||
| 124 | +@Component | ||
| 125 | +struct CreatorItem { | ||
| 126 | + @Prop item: ContentDTO | ||
| 127 | + @State rmhIsAttention: number = 0 | ||
| 128 | + build() { | ||
| 129 | + ListItem() { | ||
| 130 | + Column() { | ||
| 131 | + Flex({direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween}) { | ||
| 132 | + Column() { | ||
| 133 | + Row() { | ||
| 134 | + Image('') | ||
| 135 | + .width(20) | ||
| 136 | + .height(20) | ||
| 137 | + .margin({right: 4}) | ||
| 138 | + .border({width: 1, color: 0xcccccc, radius: 10}) | ||
| 139 | + Text('立志之间') | ||
| 140 | + .fontColor(0x212228) | ||
| 141 | + .fontSize(12) | ||
| 142 | + } | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + Column() { | ||
| 146 | + Row() { | ||
| 147 | + Image($r('app.media.icon_like_no')) | ||
| 148 | + .width(16) | ||
| 149 | + .height(16) | ||
| 150 | + .margin({right: 4}) | ||
| 151 | + Text('3835') | ||
| 152 | + .fontSize(14) | ||
| 153 | + .fontColor(0x999999) | ||
| 154 | + } | ||
| 155 | + } | ||
| 156 | + } | ||
| 157 | + .margin({top: 10, left: 10, right: 10, bottom: 8}) | ||
| 158 | + | ||
| 159 | + Text('就业不仅是民生问题,也是发展问题,就业不仅是民生问题,也是发展问题,就业不仅是民生问题,也是发展问题,') | ||
| 160 | + .maxLines(2) | ||
| 161 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 162 | + .margin({left: 10, right: 10, bottom: 8}) | ||
| 163 | + .fontSize(17) | ||
| 164 | + .fontColor(0x212228) | ||
| 165 | + .lineHeight(25) | ||
| 166 | + | ||
| 167 | + Row() { | ||
| 168 | + Image('') | ||
| 169 | + .width(66) | ||
| 170 | + .height(44) | ||
| 171 | + .borderRadius({topLeft: 3, topRight: 0, bottomLeft: 3, bottomRight: 0}) | ||
| 172 | + Text('原文|强化就业优先政策 健全就业促进机制原文|强化就业优先政策 健全就业促进机制原文|强化就业优先政策 健全就业促进机制') | ||
| 173 | + .margin({left: 8}) | ||
| 174 | + .width(172) | ||
| 175 | + .maxLines(2) | ||
| 176 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 177 | + } | ||
| 178 | + .linearGradient({ | ||
| 179 | + direction: GradientDirection.Right, | ||
| 180 | + colors: [[0xffffff, 0.0],[0xffffff, 0.8], [0xf9f9f9, 1.0]] | ||
| 181 | + }) | ||
| 182 | + } | ||
| 183 | + .width(276) | ||
| 184 | + .height(150) | ||
| 185 | + .margin({ right: 10 }) | ||
| 186 | + .borderWidth(1) | ||
| 187 | + .borderColor($r('app.color.color_EDEDED')) | ||
| 188 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 189 | + .backgroundColor(0xf9f9f9) | ||
| 190 | + } | ||
| 191 | + .onClick(() => { | ||
| 192 | + console.log('跳转到rmh'); | ||
| 193 | + }) | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + /** | ||
| 197 | + * 关注号主 TODO 这里后面需要抽离 | ||
| 198 | + */ | ||
| 199 | + handleAccention(item: ContentDTO, status: number) { | ||
| 200 | + this.rmhIsAttention = this.rmhIsAttention ? 0 : 1 | ||
| 201 | + return | ||
| 202 | + // 未登录,跳转登录 | ||
| 203 | + if (!HttpUrlUtils.getUserId()) { | ||
| 204 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 205 | + return | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + const params: postInteractAccentionOperateParams = { | ||
| 209 | + attentionUserType: item.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号) | ||
| 210 | + attentionUserId: item.rmhInfo?.userId || '', // 被关注用户号主id | ||
| 211 | + attentionCreatorId: item.rmhInfo?.rmhId || '', // 被关注用户号主id | ||
| 212 | + // userType: 1, | ||
| 213 | + // userId: '1', // TODO 用户id需要从本地获取 | ||
| 214 | + status: status, | ||
| 215 | + } | ||
| 216 | + PageRepository.postInteractAccentionOperate(params).then(res => { | ||
| 217 | + console.log(TAG, '关注号主==', JSON.stringify(res.data)) | ||
| 218 | + if (status === 1) { | ||
| 219 | + this.rmhIsAttention = 0 | ||
| 220 | + } else { | ||
| 221 | + this.rmhIsAttention = 1 | ||
| 222 | + } | ||
| 223 | + }) | ||
| 224 | + } | ||
| 225 | +} |
| @@ -16,7 +16,7 @@ export default struct MinePageMoreFunctionUI { | @@ -16,7 +16,7 @@ export default struct MinePageMoreFunctionUI { | ||
| 16 | .fontColor($r('app.color.color_666666')) | 16 | .fontColor($r('app.color.color_666666')) |
| 17 | .fontSize('29lpx') | 17 | .fontSize('29lpx') |
| 18 | .margin({ left: "31lpx" }) | 18 | .margin({ left: "31lpx" }) |
| 19 | - .fontWeight(600) | 19 | + .fontWeight('600lpx') |
| 20 | }.height('92lpx') | 20 | }.height('92lpx') |
| 21 | .width('100%') | 21 | .width('100%') |
| 22 | .justifyContent(FlexAlign.Center) | 22 | .justifyContent(FlexAlign.Center) |
| 1 | import { WDRouterRule, WDRouterPage } from 'wdRouter' | 1 | import { WDRouterRule, WDRouterPage } from 'wdRouter' |
| 2 | import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem' | 2 | import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem' |
| 3 | -import router from '@ohos.router' | ||
| 4 | 3 | ||
| 5 | @Component | 4 | @Component |
| 6 | export default struct MinePagePersonFunctionUI { | 5 | export default struct MinePagePersonFunctionUI { |
| 7 | @Link personalData:MinePagePersonalFunctionsItem[] | 6 | @Link personalData:MinePagePersonalFunctionsItem[] |
| 8 | @Prop isLogin:boolean | 7 | @Prop isLogin:boolean |
| 9 | - @Consume('isLogin')@Watch('loginChange') loginState:Record<string,string> | ||
| 10 | - loginChange(){ | ||
| 11 | - if(this.loginState){ | ||
| 12 | - this.isLogin=true | ||
| 13 | - } | ||
| 14 | - } | ||
| 15 | 8 | ||
| 16 | build() { | 9 | build() { |
| 17 | Grid(){ | 10 | Grid(){ |
| @@ -45,6 +38,15 @@ export default struct MinePagePersonFunctionUI { | @@ -45,6 +38,15 @@ export default struct MinePagePersonFunctionUI { | ||
| 45 | }.onClick(()=>{ | 38 | }.onClick(()=>{ |
| 46 | console.log(index+"") | 39 | console.log(index+"") |
| 47 | switch (item.msg){ | 40 | switch (item.msg){ |
| 41 | + case "评论":{ | ||
| 42 | + if(!this.isLogin){ | ||
| 43 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 44 | + return | ||
| 45 | + }else { | ||
| 46 | + WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage) | ||
| 47 | + } | ||
| 48 | + break; | ||
| 49 | + } | ||
| 48 | case "预约":{ | 50 | case "预约":{ |
| 49 | if(!this.isLogin){ | 51 | if(!this.isLogin){ |
| 50 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 52 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 1 | -import { Logger, UserDataLocal } from 'wdKit' | 1 | +import { Logger, StringUtils, UserDataLocal } from 'wdKit' |
| 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter' | 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter' |
| 3 | import MinePageDatasModel from '../../model/MinePageDatasModel' | 3 | import MinePageDatasModel from '../../model/MinePageDatasModel' |
| 4 | const TAG = "MinePageUserSimpleInfoUI" | 4 | const TAG = "MinePageUserSimpleInfoUI" |
| @@ -12,18 +12,13 @@ export default struct MinePageUserSimpleInfoUI { | @@ -12,18 +12,13 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 12 | @State levelHead:string = "" | 12 | @State levelHead:string = "" |
| 13 | @State levelId:number = 0 | 13 | @State levelId:number = 0 |
| 14 | 14 | ||
| 15 | - | ||
| 16 | - @Consume('isLogin') @Watch('loginChange') loginState:Record<string,string> | ||
| 17 | - loginChange(){ | ||
| 18 | - Logger.debug("isLogin",'MinePageUserSimpleInfoUI') | ||
| 19 | - if(this.loginState){ | ||
| 20 | - this.isLogin=true | ||
| 21 | - } | ||
| 22 | - } | ||
| 23 | loginStateChange(){ | 15 | loginStateChange(){ |
| 24 | if(this.isLogin){ | 16 | if(this.isLogin){ |
| 25 | this.getUserInfo() | 17 | this.getUserInfo() |
| 26 | this.getUserLevel() | 18 | this.getUserLevel() |
| 19 | + }else{ | ||
| 20 | + this.headPhotoUrl = "" | ||
| 21 | + this.levelHead = "" | ||
| 27 | } | 22 | } |
| 28 | } | 23 | } |
| 29 | 24 | ||
| @@ -31,17 +26,20 @@ export default struct MinePageUserSimpleInfoUI { | @@ -31,17 +26,20 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 31 | Row(){ | 26 | Row(){ |
| 32 | //头像 | 27 | //头像 |
| 33 | Stack(){ | 28 | Stack(){ |
| 34 | - Image(this.headPhotoUrl) | 29 | + Image(this.headPhotoUrl==""?$r('app.media.default_head'):this.headPhotoUrl) |
| 35 | .alt($r('app.media.default_head')) | 30 | .alt($r('app.media.default_head')) |
| 36 | .width('100lpx') | 31 | .width('100lpx') |
| 37 | .height('100lpx') | 32 | .height('100lpx') |
| 38 | .objectFit(ImageFit.Cover) | 33 | .objectFit(ImageFit.Cover) |
| 39 | .borderRadius(50) | 34 | .borderRadius(50) |
| 35 | + | ||
| 36 | + if(StringUtils.isNotEmpty(this.levelHead)){ | ||
| 40 | Image(this.levelHead) | 37 | Image(this.levelHead) |
| 41 | .width('130lpx') | 38 | .width('130lpx') |
| 42 | .height('130lpx') | 39 | .height('130lpx') |
| 43 | .objectFit(ImageFit.Cover) | 40 | .objectFit(ImageFit.Cover) |
| 44 | .borderRadius(50) | 41 | .borderRadius(50) |
| 42 | + } | ||
| 45 | }.width('130lpx') | 43 | }.width('130lpx') |
| 46 | .height('130lpx') | 44 | .height('130lpx') |
| 47 | .alignContent(Alignment.Center) | 45 | .alignContent(Alignment.Center) |
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowChildComponent.ets
0 → 100644
| 1 | +import { StringUtils, ToastUtils } from 'wdKit/Index' | ||
| 2 | +import { HttpUrlUtils } from 'wdNetwork/Index' | ||
| 3 | +import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' | ||
| 4 | +import MinePageDatasModel from '../../../model/MinePageDatasModel' | ||
| 5 | +import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem' | ||
| 6 | +import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRequestItem' | ||
| 7 | + | ||
| 8 | +@Component | ||
| 9 | +export struct FollowChildComponent{ | ||
| 10 | + @ObjectLink data: FollowListDetailItem | ||
| 11 | + @State type:number = 0 | ||
| 12 | + | ||
| 13 | + build() { | ||
| 14 | + if(this.type == 0 ){ | ||
| 15 | + Column(){ | ||
| 16 | + Column(){ | ||
| 17 | + | ||
| 18 | + Row() { | ||
| 19 | + Row(){ | ||
| 20 | + Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl) | ||
| 21 | + .objectFit(ImageFit.Auto) | ||
| 22 | + .width('92lpx') | ||
| 23 | + .height('92lpx') | ||
| 24 | + .margin({right:'15lpx'}) | ||
| 25 | + .borderRadius(50) | ||
| 26 | + .borderWidth('1lpx') | ||
| 27 | + .borderColor($r('app.color.color_0D000000')) | ||
| 28 | + | ||
| 29 | + Column(){ | ||
| 30 | + Text(this.data.cnUserName) | ||
| 31 | + .fontWeight('400lpx') | ||
| 32 | + .fontSize('31lpx') | ||
| 33 | + .lineHeight('38lpx') | ||
| 34 | + .fontColor($r('app.color.color_222222')) | ||
| 35 | + .maxLines(1) | ||
| 36 | + .margin({bottom:'8lpx'}) | ||
| 37 | + | ||
| 38 | + Text(`粉丝${this.data.cnFansNum}`) | ||
| 39 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 40 | + .fontSize('23lpx') | ||
| 41 | + .fontWeight('400lpx') | ||
| 42 | + .lineHeight('31lpx') | ||
| 43 | + .margin({bottom:'8lpx'}) | ||
| 44 | + | ||
| 45 | + Text(`${this.data.introduction}`) | ||
| 46 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 47 | + .fontSize('23lpx') | ||
| 48 | + .maxLines(2) | ||
| 49 | + .textAlign(TextAlign.Start) | ||
| 50 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 51 | + } | ||
| 52 | + .layoutWeight(1) | ||
| 53 | + .alignItems(HorizontalAlign.Start) | ||
| 54 | + .justifyContent(FlexAlign.Start) | ||
| 55 | + }.layoutWeight(1) | ||
| 56 | + .alignItems(VerticalAlign.Top) | ||
| 57 | + .onClick(()=>{ | ||
| 58 | + this.jumpCreatorHomePage() | ||
| 59 | + }) | ||
| 60 | + | ||
| 61 | + if(this.data.status == "1"){ | ||
| 62 | + Row(){ | ||
| 63 | + Text(`已关注`) | ||
| 64 | + .fontColor($r('app.color.color_CCCCCC')) | ||
| 65 | + .fontSize('23lpx') | ||
| 66 | + .fontWeight('500lpx') | ||
| 67 | + .lineHeight('35lpx') | ||
| 68 | + } | ||
| 69 | + .justifyContent(FlexAlign.Center) | ||
| 70 | + .width('100lpx') | ||
| 71 | + .height('46lpx') | ||
| 72 | + .onClick(()=>{ | ||
| 73 | + this.followOperation() | ||
| 74 | + }).margin({top:'29lpx'}) | ||
| 75 | + }else{ | ||
| 76 | + Row(){ | ||
| 77 | + Image($r('app.media.follow_icon')) | ||
| 78 | + .margin({right:'4lpx'}) | ||
| 79 | + .width('23lpx') | ||
| 80 | + .height('23lpx') | ||
| 81 | + Text(`关注`) | ||
| 82 | + .fontColor($r('app.color.color_ED2800')) | ||
| 83 | + .fontSize('23lpx') | ||
| 84 | + .fontWeight('500lpx') | ||
| 85 | + .lineHeight('35lpx') | ||
| 86 | + }.borderColor($r('app.color.color_1AED2800')) | ||
| 87 | + .borderRadius('6lpx') | ||
| 88 | + .borderWidth('2lpx') | ||
| 89 | + .justifyContent(FlexAlign.Center) | ||
| 90 | + .width('100lpx') | ||
| 91 | + .height('46lpx') | ||
| 92 | + .margin({top:'29lpx'}) | ||
| 93 | + .onClick(()=>{ | ||
| 94 | + this.followOperation() | ||
| 95 | + }) | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + .padding({top:'27lpx'}) | ||
| 99 | + .width('100%') | ||
| 100 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 101 | + .alignItems(VerticalAlign.Top) | ||
| 102 | + | ||
| 103 | + }.height('202lpx') | ||
| 104 | + .justifyContent(FlexAlign.Start) | ||
| 105 | + | ||
| 106 | + Divider().width('100%') | ||
| 107 | + .height('1lpx') | ||
| 108 | + .strokeWidth('1lpx') | ||
| 109 | + .backgroundColor($r('app.color.color_EDEDED')) | ||
| 110 | + }.width('100%') | ||
| 111 | + | ||
| 112 | + }else { | ||
| 113 | + Column(){ | ||
| 114 | + Column(){ | ||
| 115 | + | ||
| 116 | + Row() { | ||
| 117 | + Row(){ | ||
| 118 | + Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl) | ||
| 119 | + .objectFit(ImageFit.Auto) | ||
| 120 | + .width('92lpx') | ||
| 121 | + .height('92lpx') | ||
| 122 | + .margin({right:'15lpx'}) | ||
| 123 | + .borderRadius(50) | ||
| 124 | + .borderWidth('1lpx') | ||
| 125 | + .borderColor($r('app.color.color_0D000000')) | ||
| 126 | + | ||
| 127 | + Column(){ | ||
| 128 | + Text(this.data.cnUserName) | ||
| 129 | + .fontWeight('400lpx') | ||
| 130 | + .fontSize('31lpx') | ||
| 131 | + .lineHeight('38lpx') | ||
| 132 | + .fontColor($r('app.color.color_222222')) | ||
| 133 | + .maxLines(1) | ||
| 134 | + .margin({bottom:'12lpx'}) | ||
| 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) | ||
| 144 | + | ||
| 145 | + Text(`${this.data.introduction}`) | ||
| 146 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 147 | + .fontSize('23lpx') | ||
| 148 | + .layoutWeight(1) | ||
| 149 | + .maxLines(1) | ||
| 150 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 151 | + }.width('100%') | ||
| 152 | + } | ||
| 153 | + .layoutWeight(1) | ||
| 154 | + .alignItems(HorizontalAlign.Start) | ||
| 155 | + }.layoutWeight(1) | ||
| 156 | + .onClick(()=>{ | ||
| 157 | + this.jumpCreatorHomePage() | ||
| 158 | + }) | ||
| 159 | + | ||
| 160 | + if(this.type === 2){ | ||
| 161 | + Blank() | ||
| 162 | + }else { | ||
| 163 | + if(this.data.status == "1"){ | ||
| 164 | + Row(){ | ||
| 165 | + Text(`已关注`) | ||
| 166 | + .fontColor($r('app.color.color_CCCCCC')) | ||
| 167 | + .fontSize('23lpx') | ||
| 168 | + .fontWeight('500lpx') | ||
| 169 | + .lineHeight('35lpx') | ||
| 170 | + } | ||
| 171 | + .justifyContent(FlexAlign.Center) | ||
| 172 | + .width('100lpx') | ||
| 173 | + .height('46lpx') | ||
| 174 | + .onClick(()=>{ | ||
| 175 | + this.followOperation() | ||
| 176 | + }) | ||
| 177 | + }else{ | ||
| 178 | + Row(){ | ||
| 179 | + Image($r('app.media.follow_icon')) | ||
| 180 | + .margin({right:'4lpx'}) | ||
| 181 | + .width('23lpx') | ||
| 182 | + .height('23lpx') | ||
| 183 | + Text(`关注`) | ||
| 184 | + .fontColor($r('app.color.color_ED2800')) | ||
| 185 | + .fontSize('23lpx') | ||
| 186 | + .fontWeight('500lpx') | ||
| 187 | + .lineHeight('35lpx') | ||
| 188 | + }.borderColor($r('app.color.color_1AED2800')) | ||
| 189 | + .borderRadius('6lpx') | ||
| 190 | + .borderWidth('2lpx') | ||
| 191 | + .justifyContent(FlexAlign.Center) | ||
| 192 | + .width('100lpx') | ||
| 193 | + .height('46lpx') | ||
| 194 | + .onClick(()=>{ | ||
| 195 | + this.followOperation() | ||
| 196 | + }) | ||
| 197 | + } | ||
| 198 | + } | ||
| 199 | + } | ||
| 200 | + .width('100%') | ||
| 201 | + .height('92lpx') | ||
| 202 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 203 | + | ||
| 204 | + }.height('146lpx') | ||
| 205 | + .justifyContent(FlexAlign.Center) | ||
| 206 | + .onClick(()=>{ | ||
| 207 | + }) | ||
| 208 | + | ||
| 209 | + Divider().width('100%') | ||
| 210 | + .height('1lpx') | ||
| 211 | + .strokeWidth('1lpx') | ||
| 212 | + .backgroundColor($r('app.color.color_EDEDED')) | ||
| 213 | + }.width('100%') | ||
| 214 | + | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + } | ||
| 218 | + | ||
| 219 | + followOperation(){ | ||
| 220 | + let item = new FollowOperationRequestItem(this.data.cnUserType,this.data.cnUserId,this.data.creatorId,HttpUrlUtils.getUserType(),HttpUrlUtils.getUserId(),this.data.status==="0" ? 1:0) | ||
| 221 | + MinePageDatasModel.getFollowOperation(item,getContext(this)).then((value)=>{ | ||
| 222 | + if(value!=null){ | ||
| 223 | + if (value.code === 0 || value.code.toString() === "0") { | ||
| 224 | + this.data.status = this.data.status ==="0"?"1":"0" | ||
| 225 | + } | ||
| 226 | + } | ||
| 227 | + }) | ||
| 228 | + } | ||
| 229 | + | ||
| 230 | + jumpCreatorHomePage() { | ||
| 231 | + if(this.data.mainControl === 0){ | ||
| 232 | + ToastUtils.shortToast("无法查看此用户主页") | ||
| 233 | + }else if(this.data.banControl === 1){ | ||
| 234 | + ToastUtils.shortToast("该账号已封禁,不予访问") | ||
| 235 | + }else{ | ||
| 236 | + let params = {'creatorId': this.data.creatorId} as Record<string, string>; | ||
| 237 | + WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) | ||
| 238 | + } | ||
| 239 | + } | ||
| 240 | +} |
-
Please register or login to post a comment