Merge remote-tracking branch 'origin/main'
# Conflicts: # sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card6Component.ets
Showing
70 changed files
with
2401 additions
and
930 deletions
Too many changes to show.
To preserve performance only 70 of 70+ files are displayed.
| @@ -20,6 +20,8 @@ export { WindowModel } from './src/main/ets/utils/WindowModel' | @@ -20,6 +20,8 @@ export { WindowModel } from './src/main/ets/utils/WindowModel' | ||
| 20 | 20 | ||
| 21 | export { SPHelper } from './src/main/ets/utils/SPHelper' | 21 | export { SPHelper } from './src/main/ets/utils/SPHelper' |
| 22 | 22 | ||
| 23 | +export { KVStoreHelper } from './src/main/ets/utils/KVStoreHelper' | ||
| 24 | + | ||
| 23 | export { AccountManagerUtils } from './src/main/ets/utils/AccountManagerUtils' | 25 | export { AccountManagerUtils } from './src/main/ets/utils/AccountManagerUtils' |
| 24 | 26 | ||
| 25 | export { CollectionUtils } from './src/main/ets/utils/CollectionUtils' | 27 | export { CollectionUtils } from './src/main/ets/utils/CollectionUtils' |
| @@ -60,4 +62,6 @@ export { MpaasUtils } from './src/main/ets/mpaas/MpaasUtils' | @@ -60,4 +62,6 @@ export { MpaasUtils } from './src/main/ets/mpaas/MpaasUtils' | ||
| 60 | 62 | ||
| 61 | export { MpaasUpgradeCheck, UpgradeTipContent } from './src/main/ets/mpaas/MpaasUpgradeCheck' | 63 | export { MpaasUpgradeCheck, UpgradeTipContent } from './src/main/ets/mpaas/MpaasUpgradeCheck' |
| 62 | 64 | ||
| 63 | -export { TingyunAPM } from './src/main/ets/tingyunAPM/TingyunAPM' | ||
| 65 | +export { TingyunAPM } from './src/main/ets/tingyunAPM/TingyunAPM' | ||
| 66 | + | ||
| 67 | +export { FastClickUtil } from './src/main/ets/utils/FastClickUtil'; |
| 1 | +import systemDateTime from '@ohos.systemDateTime'; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * 屏蔽快速点击事件,规定时间内只触发一次 | ||
| 5 | + */ | ||
| 6 | +export class FastClickUtil { | ||
| 7 | + | ||
| 8 | + static MIN_DELAY_TIME = 500 | ||
| 9 | + | ||
| 10 | + static minDelayBeforeTime = 0 | ||
| 11 | + | ||
| 12 | + static async isMinDelayTime(): Promise<boolean> { | ||
| 13 | + let systime = await systemDateTime.getCurrentTime(); | ||
| 14 | + return new Promise<boolean>((success, error) => { | ||
| 15 | + let rtnvalue = systime - FastClickUtil.minDelayBeforeTime <= FastClickUtil.MIN_DELAY_TIME; | ||
| 16 | + this.minDelayBeforeTime = systime; | ||
| 17 | + success(rtnvalue); | ||
| 18 | + }) | ||
| 19 | + } | ||
| 20 | +} | ||
| 21 | + |
| 1 | +import { distributedKVStore } from '@kit.ArkData'; | ||
| 2 | +import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 3 | +import { AppUtils } from './AppUtils'; | ||
| 4 | +import { Logger } from './Logger'; | ||
| 5 | + | ||
| 6 | +const TAG = 'KVStoreHelper' | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 键值型数据库管理类,类似sp,存储变大,单条数据,value<4M | ||
| 10 | + */ | ||
| 11 | +export class KVStoreHelper { | ||
| 12 | + private static _context: Context; | ||
| 13 | + // TODO 待优化,可以指定数据库名,创建多个数据库。当前没有需求,只创建一个,缓存接口数据用。 | ||
| 14 | + private static _default_store_id: string = 'default_kv_store'; | ||
| 15 | + private kvManager: distributedKVStore.KVManager | undefined = undefined; | ||
| 16 | + private kvStore: distributedKVStore.SingleKVStore | undefined = undefined; | ||
| 17 | + | ||
| 18 | + private constructor() { | ||
| 19 | + Logger.error(TAG, 'constructor') | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + static init(context: Context) { | ||
| 23 | + Logger.error(TAG, 'init') | ||
| 24 | + KVStoreHelper._context = context; | ||
| 25 | + KVStoreHelper.default.createKVManager() | ||
| 26 | + KVStoreHelper.default.createKVStore() | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + // 静态属性 | ||
| 30 | + static default: KVStoreHelper = new KVStoreHelper(); | ||
| 31 | + | ||
| 32 | + private createKVManager() { | ||
| 33 | + if (this.kvManager) { | ||
| 34 | + return | ||
| 35 | + } | ||
| 36 | + if (!KVStoreHelper._context) { | ||
| 37 | + Logger.fatal(TAG, 'context is null, must be initialized first') | ||
| 38 | + return | ||
| 39 | + } | ||
| 40 | + let context: Context = KVStoreHelper._context; | ||
| 41 | + const kvManagerConfig: distributedKVStore.KVManagerConfig = { | ||
| 42 | + context: context, | ||
| 43 | + bundleName: AppUtils.getPackageName(context) | ||
| 44 | + }; | ||
| 45 | + try { | ||
| 46 | + // 创建KVManager实例 | ||
| 47 | + this.kvManager = distributedKVStore.createKVManager(kvManagerConfig); | ||
| 48 | + Logger.info(TAG, 'Succeeded in creating KVManager.'); | ||
| 49 | + // 继续创建获取数据库 | ||
| 50 | + } catch (e) { | ||
| 51 | + let error = e as BusinessError; | ||
| 52 | + Logger.error(TAG, `Failed to create KVManager. Code:${error.code},message:${error.message}`); | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + private createKVStore() { | ||
| 57 | + if (this.kvStore) { | ||
| 58 | + return | ||
| 59 | + } | ||
| 60 | + if (!this.kvManager) { | ||
| 61 | + this.createKVManager() | ||
| 62 | + // 直接拦截,避免陷入循环 | ||
| 63 | + Logger.error(TAG, 'kvManager is null, please re-create it and try again') | ||
| 64 | + return | ||
| 65 | + } | ||
| 66 | + try { | ||
| 67 | + const options: distributedKVStore.Options = { | ||
| 68 | + createIfMissing: true, | ||
| 69 | + encrypt: false, | ||
| 70 | + backup: false, | ||
| 71 | + autoSync: false, | ||
| 72 | + // kvStoreType不填时,默认创建多设备协同数据库 | ||
| 73 | + kvStoreType: distributedKVStore.KVStoreType.SINGLE_VERSION, | ||
| 74 | + securityLevel: distributedKVStore.SecurityLevel.S1 | ||
| 75 | + }; | ||
| 76 | + this.kvManager?.getKVStore<distributedKVStore.SingleKVStore>(KVStoreHelper._default_store_id, options, | ||
| 77 | + (err, store: distributedKVStore.SingleKVStore) => { | ||
| 78 | + if (err) { | ||
| 79 | + Logger.error(TAG, `Failed to get KVStore: Code:${err.code},message:${err.message}`); | ||
| 80 | + return; | ||
| 81 | + } | ||
| 82 | + Logger.info(TAG, 'Succeeded in getting KVStore.'); | ||
| 83 | + this.kvStore = store; | ||
| 84 | + // 请确保获取到键值数据库实例后,再进行相关数据操作 | ||
| 85 | + }); | ||
| 86 | + } catch (e) { | ||
| 87 | + let error = e as BusinessError; | ||
| 88 | + Logger.error(TAG, `An unexpected error occurred. Code:${error.code},message:${error.message}`); | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + private checkStoreCreated() { | ||
| 93 | + if (!this.kvManager) { | ||
| 94 | + this.createKVManager() | ||
| 95 | + } | ||
| 96 | + if (!this.kvStore) { | ||
| 97 | + this.createKVStore() | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + get(key: string, def: boolean | string | number | Uint8Array): Promise<boolean | string | number | Uint8Array> { | ||
| 102 | + // this.checkStoreCreated() | ||
| 103 | + return new Promise<boolean | string | number | Uint8Array>((success, failed) => { | ||
| 104 | + try { | ||
| 105 | + this.kvStore?.get(key, (err, data) => { | ||
| 106 | + if (err != undefined) { | ||
| 107 | + Logger.debug(TAG, `Failed to get data. Code:${err.code},message:${err.message}`); | ||
| 108 | + success(def) | ||
| 109 | + return; | ||
| 110 | + } | ||
| 111 | + success(data) | ||
| 112 | + Logger.debug(TAG, `Succeeded in getting data. Data:${data}`); | ||
| 113 | + }); | ||
| 114 | + } catch (e) { | ||
| 115 | + success(def) | ||
| 116 | + let error = e as BusinessError; | ||
| 117 | + Logger.error(TAG, `Failed to get data. Code:${error.code},message:${error.message}`); | ||
| 118 | + } | ||
| 119 | + }); | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + put(key: string, value: boolean | string | number | Uint8Array) { | ||
| 123 | + // this.checkStoreCreated() | ||
| 124 | + try { | ||
| 125 | + this.kvStore?.put(key, value, (err) => { | ||
| 126 | + if (err !== undefined) { | ||
| 127 | + Logger.debug(TAG, `Failed to put data. Code:${err.code},message:${err.message}`); | ||
| 128 | + return; | ||
| 129 | + } | ||
| 130 | + Logger.debug(TAG, 'Succeeded in putting data.'); | ||
| 131 | + }); | ||
| 132 | + } catch (e) { | ||
| 133 | + let error = e as BusinessError; | ||
| 134 | + Logger.error(TAG, `An unexpected error occurred. Code:${error.code},message:${error.message}`); | ||
| 135 | + } | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + del(key: string) { | ||
| 139 | + // this.checkStoreCreated() | ||
| 140 | + try { | ||
| 141 | + this.kvStore?.delete(key, (err) => { | ||
| 142 | + if (err !== undefined) { | ||
| 143 | + Logger.debug(TAG, `Failed to delete data. Code:${err.code},message:${err.message}`); | ||
| 144 | + return; | ||
| 145 | + } | ||
| 146 | + Logger.debug(TAG, 'Succeeded in deleting data.'); | ||
| 147 | + }); | ||
| 148 | + } catch (e) { | ||
| 149 | + let error = e as BusinessError; | ||
| 150 | + Logger.error(TAG, `An unexpected error occurred. Code:${error.code},message:${error.message}`); | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | +} |
| @@ -4,7 +4,7 @@ import { Logger } from './Logger'; | @@ -4,7 +4,7 @@ import { Logger } from './Logger'; | ||
| 4 | const TAG = 'SPHelper' | 4 | const TAG = 'SPHelper' |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 7 | - * sp存储 | 7 | + * sp存储,单条数据,value<1k;业务数据超过1k的,建议使用KVStoreHelper |
| 8 | */ | 8 | */ |
| 9 | export class SPHelper { | 9 | export class SPHelper { |
| 10 | private static context: Context; | 10 | private static context: Context; |
| @@ -5,7 +5,7 @@ export class ToastUtils { | @@ -5,7 +5,7 @@ export class ToastUtils { | ||
| 5 | private static shortToastTime: number = 1000 | 5 | private static shortToastTime: number = 1000 |
| 6 | 6 | ||
| 7 | static showToast(message: ResourceStr, duration: number) { | 7 | static showToast(message: ResourceStr, duration: number) { |
| 8 | - prompt.showToast({ message: message, duration: duration }) | 8 | + prompt.showToast({ message: message, duration: duration, alignment: Alignment.Center }) |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | static shortToast(message: ResourceStr) { | 11 | static shortToast(message: ResourceStr) { |
| @@ -12,3 +12,5 @@ export { HttpUtils } from "./src/main/ets/utils/HttpUtils" | @@ -12,3 +12,5 @@ export { HttpUtils } from "./src/main/ets/utils/HttpUtils" | ||
| 12 | 12 | ||
| 13 | export { HostEnum, HostManager } from "./src/main/ets/http/HttpHostManager" | 13 | export { HostEnum, HostManager } from "./src/main/ets/http/HttpHostManager" |
| 14 | 14 | ||
| 15 | +export { CacheData } from "./src/main/ets/utils/CacheData" | ||
| 16 | + |
| @@ -135,6 +135,14 @@ export class HttpUrlUtils { | @@ -135,6 +135,14 @@ export class HttpUrlUtils { | ||
| 135 | */ | 135 | */ |
| 136 | static readonly APPOINTMENT_ExecuteCollcet_PATH: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord"; | 136 | static readonly APPOINTMENT_ExecuteCollcet_PATH: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord"; |
| 137 | /** | 137 | /** |
| 138 | + * 个人中心 - 消息 | ||
| 139 | + */ | ||
| 140 | + static readonly APPOINTMENT_MessageList_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private"; | ||
| 141 | + /** | ||
| 142 | + * 个人中心 - 消息 点赞数 | ||
| 143 | + */ | ||
| 144 | + static readonly APPOINTMENT_getMessageLikeCount_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/getLikeCount"; | ||
| 145 | + /** | ||
| 138 | * 个人中心 我的评论列表 | 146 | * 个人中心 我的评论列表 |
| 139 | */ | 147 | */ |
| 140 | static readonly MINE_COMMENT_LIST_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/myCommentList"; | 148 | static readonly MINE_COMMENT_LIST_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/myCommentList"; |
| @@ -301,6 +309,45 @@ export class HttpUrlUtils { | @@ -301,6 +309,45 @@ export class HttpUrlUtils { | ||
| 301 | * 查询是否设置过密码checkSetPassword | 309 | * 查询是否设置过密码checkSetPassword |
| 302 | */ | 310 | */ |
| 303 | static readonly CHECK_SET_PASSWORD_PATH: string = "/api/rmrb-user-center/user/zh/c/ifSetPassword"; | 311 | static readonly CHECK_SET_PASSWORD_PATH: string = "/api/rmrb-user-center/user/zh/c/ifSetPassword"; |
| 312 | + /** | ||
| 313 | + * 获取oss 配置 | ||
| 314 | + */ | ||
| 315 | + static readonly OSS_PARAMS_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/oss/configs"; | ||
| 316 | + | ||
| 317 | + /** | ||
| 318 | + * 获取上传OSS token | ||
| 319 | + */ | ||
| 320 | + static readonly STS_TOKEN_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/oss/stsToken"; | ||
| 321 | + | ||
| 322 | + /** | ||
| 323 | + * 获取意见反馈类型 | ||
| 324 | + */ | ||
| 325 | + static readonly FEEDBACK_TYPE_PATH: string = "/api/rmrb-interact/interact/c/user/optionClassify/list"; | ||
| 326 | + | ||
| 327 | + /** | ||
| 328 | + * 查询点赞、回复我的、系统消息的未读数量以及回复/评论人 | ||
| 329 | + */ | ||
| 330 | + static readonly MESSAGE_UN_READ_DATA_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/polymerizationInfo?createTime="; | ||
| 331 | + | ||
| 332 | + /** | ||
| 333 | + * 直播详情-直播人数 | ||
| 334 | + */ | ||
| 335 | + static readonly LIVE_ROOM_BATCH_ALL_DATA_PATH: string = "/api/live-center-message/zh/a/live/room/number/batch/all"; | ||
| 336 | + | ||
| 337 | + /** | ||
| 338 | + * 点击消息 | ||
| 339 | + */ | ||
| 340 | + static readonly SEND_MESSAGE_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/touch?createTime="; | ||
| 341 | + | ||
| 342 | + /** | ||
| 343 | + * 点击具体某个消息 | ||
| 344 | + */ | ||
| 345 | + static readonly ENTER_MESSAGE_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/readAll?contentType="; | ||
| 346 | + | ||
| 347 | + /** | ||
| 348 | + * 推送消息 | ||
| 349 | + */ | ||
| 350 | + static readonly HISTORY_PUSH_MESSAGE_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/push"; | ||
| 304 | 351 | ||
| 305 | static getHost(): string { | 352 | static getHost(): string { |
| 306 | return HostManager.getHost(); | 353 | return HostManager.getHost(); |
| @@ -463,6 +510,16 @@ export class HttpUrlUtils { | @@ -463,6 +510,16 @@ export class HttpUrlUtils { | ||
| 463 | return url | 510 | return url |
| 464 | } | 511 | } |
| 465 | 512 | ||
| 513 | + static getMessageListDataUrl() { | ||
| 514 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_MessageList_PATH | ||
| 515 | + return url | ||
| 516 | + } | ||
| 517 | + | ||
| 518 | + static getMessageLikeCount() { | ||
| 519 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_getMessageLikeCount_PATH | ||
| 520 | + return url | ||
| 521 | + } | ||
| 522 | + | ||
| 466 | static getExecuteCollcetUrl() { | 523 | static getExecuteCollcetUrl() { |
| 467 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH | 524 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH |
| 468 | return url | 525 | return url |
| @@ -699,4 +756,39 @@ export class HttpUrlUtils { | @@ -699,4 +756,39 @@ export class HttpUrlUtils { | ||
| 699 | return url; | 756 | return url; |
| 700 | } | 757 | } |
| 701 | 758 | ||
| 702 | -} | ||
| 759 | + //获取消息未读接口 | ||
| 760 | + static getMessageUnReadDataUrl() { | ||
| 761 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.MESSAGE_UN_READ_DATA_PATH | ||
| 762 | + return url | ||
| 763 | + } | ||
| 764 | + | ||
| 765 | + static reportDeviceInfo() { | ||
| 766 | + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/common/user/c/device/push"; | ||
| 767 | + return url; | ||
| 768 | + } | ||
| 769 | + | ||
| 770 | + //获取直播人数 | ||
| 771 | + static getLiveRoomBatchAllDataUrl() { | ||
| 772 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_ROOM_BATCH_ALL_DATA_PATH | ||
| 773 | + return url | ||
| 774 | + } | ||
| 775 | + | ||
| 776 | + | ||
| 777 | + //点击消息 | ||
| 778 | + static getSendClickMessageUrl() { | ||
| 779 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEND_MESSAGE_PATH | ||
| 780 | + return url | ||
| 781 | + } | ||
| 782 | + | ||
| 783 | + //消息 历史推送消息 | ||
| 784 | + static getHistoryPushUrl() { | ||
| 785 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.HISTORY_PUSH_MESSAGE_PATH | ||
| 786 | + return url | ||
| 787 | + } | ||
| 788 | + | ||
| 789 | + //点击具体某个消息 | ||
| 790 | + static getEnterClickMessageUrl() { | ||
| 791 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.ENTER_MESSAGE_PATH | ||
| 792 | + return url | ||
| 793 | + } | ||
| 794 | +} |
| 1 | +/** | ||
| 2 | + * 接口数据存储封装类 | ||
| 3 | + */ | ||
| 4 | +import { DateTimeUtils, StringUtils } from 'wdKit/Index'; | ||
| 5 | +import { CacheDataSaveUtil } from './CacheDataSaveUtil'; | ||
| 6 | + | ||
| 7 | +export class CacheData { | ||
| 8 | + // 接口返回数据 | ||
| 9 | + networkData?: object; | ||
| 10 | + // 数据更新时间戳 | ||
| 11 | + updateTimeInMillis: number = 0; | ||
| 12 | + // 接口返回md5,用于判断接口数据是否更新 | ||
| 13 | + md5: string = ''; | ||
| 14 | + | ||
| 15 | + constructor(md5: string, timeMillis: number, networkData: object) { | ||
| 16 | + this.md5 = md5 | ||
| 17 | + this.updateTimeInMillis = timeMillis | ||
| 18 | + this.networkData = networkData | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 根据新旧md5值进行判断,是否需要刷新数据 | ||
| 23 | + * @param responseMd5 新值,接口返回 | ||
| 24 | + * @returns | ||
| 25 | + */ | ||
| 26 | + needRefreshByMd5(responseMd5: string): boolean { | ||
| 27 | + if (StringUtils.isEmpty(this.md5) || StringUtils.isEmpty(responseMd5)) { | ||
| 28 | + return false | ||
| 29 | + } | ||
| 30 | + return this.md5 != responseMd5 | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + static saveCacheData(cacheKey: string, data: object, responseMd5: string) { | ||
| 34 | + if (!data) { | ||
| 35 | + return | ||
| 36 | + } | ||
| 37 | + let time = DateTimeUtils.getTimeStamp() | ||
| 38 | + let cacheData = new CacheData(responseMd5, time, data) | ||
| 39 | + CacheDataSaveUtil.save(cacheKey, JSON.stringify(cacheData)) | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 获取缓存数据 | ||
| 44 | + */ | ||
| 45 | + static getLocalCacheData(key: string): Promise<CacheData | null> { | ||
| 46 | + return new Promise<CacheData | null>((success) => { | ||
| 47 | + if (StringUtils.isEmpty(key)) { | ||
| 48 | + success(null) | ||
| 49 | + return | ||
| 50 | + } | ||
| 51 | + let ll = CacheDataSaveUtil.get(key) | ||
| 52 | + if (ll instanceof Promise) { | ||
| 53 | + ll.then((data) => { | ||
| 54 | + let str = data as string | ||
| 55 | + let cache = JSON.parse(str) as CacheData | ||
| 56 | + success(cache) | ||
| 57 | + }) | ||
| 58 | + } else { | ||
| 59 | + success(null) | ||
| 60 | + } | ||
| 61 | + }) | ||
| 62 | + } | ||
| 63 | +} |
| 1 | +import { KVStoreHelper, StringUtils } from 'wdKit/Index'; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * 接口数据存储工具类 | ||
| 5 | + */ | ||
| 6 | +export class CacheDataSaveUtil { | ||
| 7 | + static save(key: string, value: string) { | ||
| 8 | + if (StringUtils.isEmpty(key)) { | ||
| 9 | + return | ||
| 10 | + } | ||
| 11 | + KVStoreHelper.default.put(key, value) | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + static get(key: string) { | ||
| 15 | + if (StringUtils.isEmpty(key)) { | ||
| 16 | + return '' | ||
| 17 | + } | ||
| 18 | + return KVStoreHelper.default.get(key, '') | ||
| 19 | + } | ||
| 20 | +} |
| @@ -92,6 +92,8 @@ export function registerRouter() { | @@ -92,6 +92,8 @@ export function registerRouter() { | ||
| 92 | return WDRouterPage.liveMorePage | 92 | return WDRouterPage.liveMorePage |
| 93 | } else if (action.params?.pageID == "ORDER_MORE_PAGE") { | 93 | } else if (action.params?.pageID == "ORDER_MORE_PAGE") { |
| 94 | return WDRouterPage.reserveMorePage | 94 | return WDRouterPage.reserveMorePage |
| 95 | + } else if (action.params?.pageID == "FeedBackActivity") { | ||
| 96 | + return WDRouterPage.feedBackActivity | ||
| 95 | } | 97 | } |
| 96 | return undefined | 98 | return undefined |
| 97 | }) | 99 | }) |
| @@ -119,6 +119,8 @@ export class WDRouterPage { | @@ -119,6 +119,8 @@ export class WDRouterPage { | ||
| 119 | static searchPage = new WDRouterPage("wdComponent", "ets/pages/SearchPage"); | 119 | static searchPage = new WDRouterPage("wdComponent", "ets/pages/SearchPage"); |
| 120 | //消息主页 | 120 | //消息主页 |
| 121 | static mineMessagePage = new WDRouterPage("wdComponent", "ets/pages/MineMessagePage"); | 121 | static mineMessagePage = new WDRouterPage("wdComponent", "ets/pages/MineMessagePage"); |
| 122 | + //预约消息主页 | ||
| 123 | + static subscribeMessagePage = new WDRouterPage("wdComponent", "ets/pages/SubscribeMessagePage"); | ||
| 122 | //搜索人民号主页 | 124 | //搜索人民号主页 |
| 123 | static searchCreatorPage = new WDRouterPage("wdComponent", "ets/pages/SearchCreatorPage"); | 125 | static searchCreatorPage = new WDRouterPage("wdComponent", "ets/pages/SearchCreatorPage"); |
| 124 | //人民号主页 | 126 | //人民号主页 |
| @@ -133,4 +135,12 @@ export class WDRouterPage { | @@ -133,4 +135,12 @@ export class WDRouterPage { | ||
| 133 | static columnPage = new WDRouterPage("phone", "ets/pages/column/ColumnPage"); | 135 | static columnPage = new WDRouterPage("phone", "ets/pages/column/ColumnPage"); |
| 134 | //展示头像 | 136 | //展示头像 |
| 135 | static showUserHeaderPage = new WDRouterPage("wdComponent", "ets/pages/ShowUserHeaderPage"); | 137 | static showUserHeaderPage = new WDRouterPage("wdComponent", "ets/pages/ShowUserHeaderPage"); |
| 138 | + | ||
| 139 | + //意见反馈 | ||
| 140 | + static feedBackActivity = new WDRouterPage("wdComponent", "ets/components/FeedBackActivity"); | ||
| 141 | + | ||
| 142 | + // 人民号主页头像显示 | ||
| 143 | + static showHomePageHeaderPage = new WDRouterPage("wdComponent", "ets/pages/ShowHomePageHeaderPage"); | ||
| 144 | + | ||
| 145 | + | ||
| 136 | } | 146 | } |
| @@ -108,7 +108,11 @@ export class ProcessUtils { | @@ -108,7 +108,11 @@ export class ProcessUtils { | ||
| 108 | break; | 108 | break; |
| 109 | case ContentConstants.TYPE_TELETEXT: | 109 | case ContentConstants.TYPE_TELETEXT: |
| 110 | // 图文详情,跳转h5 | 110 | // 图文详情,跳转h5 |
| 111 | - ProcessUtils.gotoWeb(content); | 111 | + if(content?.linkUrl){ //有 linkUrl 走专题页展示逻辑 |
| 112 | + ProcessUtils.gotoSpecialTopic(content) | ||
| 113 | + }else{ | ||
| 114 | + ProcessUtils.gotoWeb(content); | ||
| 115 | + } | ||
| 112 | break; | 116 | break; |
| 113 | case ContentConstants.TYPE_LINK: | 117 | case ContentConstants.TYPE_LINK: |
| 114 | ProcessUtils.gotoDefaultWeb(content); | 118 | ProcessUtils.gotoDefaultWeb(content); |
| @@ -441,4 +445,26 @@ export class ProcessUtils { | @@ -441,4 +445,26 @@ export class ProcessUtils { | ||
| 441 | let params = { 'creatorId': creatorId } as Record<string, string>; | 445 | let params = { 'creatorId': creatorId } as Record<string, string>; |
| 442 | WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) | 446 | WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) |
| 443 | } | 447 | } |
| 448 | + | ||
| 449 | + /** | ||
| 450 | + * 意见反馈 | ||
| 451 | + */ | ||
| 452 | + public static gotoFeedBackActivity() { | ||
| 453 | + let taskAction: Action = { | ||
| 454 | + type: 'JUMP_INNER_NEW_PAGE', | ||
| 455 | + params: { | ||
| 456 | + pageID: 'FeedBackActivity' | ||
| 457 | + } as Params, | ||
| 458 | + }; | ||
| 459 | + | ||
| 460 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 461 | + } | ||
| 462 | + | ||
| 463 | + /** | ||
| 464 | + * 跳转到登录页 | ||
| 465 | + */ | ||
| 466 | + public static gotoLoginPage() { | ||
| 467 | + | ||
| 468 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 469 | + } | ||
| 444 | } | 470 | } |
| @@ -39,14 +39,14 @@ class AppLoginAuthInfo { | @@ -39,14 +39,14 @@ class AppLoginAuthInfo { | ||
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | interface IDataJson { | 41 | interface IDataJson { |
| 42 | - jumpType:number | ||
| 43 | - jumpUrl:string | ||
| 44 | - newsId:string | ||
| 45 | - newsObjectLevel:string | ||
| 46 | - newsObjectType:number | ||
| 47 | - newsRelId:string | ||
| 48 | - newsTitle:string | ||
| 49 | - pageId:string | 42 | + jumpType: number |
| 43 | + jumpUrl: string | ||
| 44 | + newsId: string | ||
| 45 | + newsObjectLevel: string | ||
| 46 | + newsObjectType: number | ||
| 47 | + newsRelId: string | ||
| 48 | + newsTitle: string | ||
| 49 | + pageId: string | ||
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | /** | 52 | /** |
| @@ -159,59 +159,64 @@ function handleJsCallAppInnerLinkMethod(data: Message) { | @@ -159,59 +159,64 @@ function handleJsCallAppInnerLinkMethod(data: Message) { | ||
| 159 | content.objectType = ''; | 159 | content.objectType = ''; |
| 160 | content.linkUrl = encodeURI(urlParams.get('url') || ''); | 160 | content.linkUrl = encodeURI(urlParams.get('url') || ''); |
| 161 | switch (urlParams.get('type')) { | 161 | switch (urlParams.get('type')) { |
| 162 | - case 'video': | ||
| 163 | - content.objectType = ContentConstants.TYPE_VOD | ||
| 164 | - ProcessUtils.processPage(content) | ||
| 165 | - break; | ||
| 166 | - case 'live': | ||
| 167 | - content.objectType = ContentConstants.TYPE_LIVE | ||
| 168 | - ProcessUtils.processPage(content) | ||
| 169 | - break; | ||
| 170 | - case 'article': | ||
| 171 | - content.objectType = ContentConstants.TYPE_TELETEXT | ||
| 172 | - ProcessUtils.processPage(content) | ||
| 173 | - break; | ||
| 174 | - case 'picture': | ||
| 175 | - content.objectType = ContentConstants.TYPE_NINE | ||
| 176 | - ProcessUtils.processPage(content) | ||
| 177 | - break; | ||
| 178 | - case 'audio': | ||
| 179 | - content.objectType = ContentConstants.TYPE_AUDIO | 162 | + case 'video': |
| 163 | + content.objectType = ContentConstants.TYPE_VOD | ||
| 164 | + ProcessUtils.processPage(content) | ||
| 165 | + break; | ||
| 166 | + case 'live': | ||
| 167 | + content.objectType = ContentConstants.TYPE_LIVE | ||
| 168 | + ProcessUtils.processPage(content) | ||
| 169 | + break; | ||
| 170 | + case 'article': | ||
| 171 | + content.objectType = ContentConstants.TYPE_TELETEXT | ||
| 172 | + ProcessUtils.processPage(content) | ||
| 173 | + break; | ||
| 174 | + case 'picture': | ||
| 175 | + content.objectType = ContentConstants.TYPE_NINE | ||
| 176 | + ProcessUtils.processPage(content) | ||
| 177 | + break; | ||
| 178 | + case 'audio': | ||
| 179 | + content.objectType = ContentConstants.TYPE_AUDIO | ||
| 180 | + ProcessUtils.processPage(content) | ||
| 181 | + break; | ||
| 182 | + case 'h5': | ||
| 183 | + if (urlParams.get('skipType') === '1') { | ||
| 184 | + content.objectType = ContentConstants.TYPE_LINK | ||
| 180 | ProcessUtils.processPage(content) | 185 | ProcessUtils.processPage(content) |
| 181 | - break; | ||
| 182 | - case 'h5': | ||
| 183 | - if (urlParams.get('skipType') === '1') { | ||
| 184 | - content.objectType = ContentConstants.TYPE_LINK | ||
| 185 | - ProcessUtils.processPage(content) | ||
| 186 | - } | ||
| 187 | - if (urlParams.get('skipType') === '4') { | ||
| 188 | - content.objectType = ContentConstants.TYPE_LINK | ||
| 189 | - ProcessUtils.jumpExternalWebPage(content.linkUrl) | ||
| 190 | - } | ||
| 191 | - break; | ||
| 192 | - case 'topic': | ||
| 193 | - if (urlParams.get('subType') === 'h5') { | ||
| 194 | - content.objectType = ContentConstants.TYPE_SPECIAL_TOPIC | ||
| 195 | - ProcessUtils.processPage(content) | ||
| 196 | - } | ||
| 197 | - if (urlParams.get('subType') === 'moring_evening_news') { | ||
| 198 | - ProcessUtils.gotoMorningEveningPaper() | ||
| 199 | - } | ||
| 200 | - if (urlParams.get('subType') === 'electronic_newspapers') { | ||
| 201 | - ProcessUtils.gotoENewsPaper() | ||
| 202 | - } | ||
| 203 | - break; | ||
| 204 | - case 'dynamic': | ||
| 205 | - content.objectType = ContentConstants.TYPE_FOURTEEN | 186 | + } |
| 187 | + if (urlParams.get('skipType') === '4') { | ||
| 188 | + content.objectType = ContentConstants.TYPE_LINK | ||
| 189 | + ProcessUtils.jumpExternalWebPage(content.linkUrl) | ||
| 190 | + } | ||
| 191 | + break; | ||
| 192 | + case 'topic': | ||
| 193 | + if (urlParams.get('subType') === 'h5') { | ||
| 194 | + content.objectType = ContentConstants.TYPE_SPECIAL_TOPIC | ||
| 206 | ProcessUtils.processPage(content) | 195 | ProcessUtils.processPage(content) |
| 207 | - break; | ||
| 208 | - case 'owner_page': | ||
| 209 | - let creatorId = urlParams.get('creatorId') || '' | ||
| 210 | - ProcessUtils.gotoPeopleShipHomePage(creatorId) | ||
| 211 | - break; | ||
| 212 | - default: | ||
| 213 | - break; | ||
| 214 | - } | 196 | + } |
| 197 | + if (urlParams.get('subType') === 'moring_evening_news') { | ||
| 198 | + ProcessUtils.gotoMorningEveningPaper() | ||
| 199 | + } | ||
| 200 | + if (urlParams.get('subType') === 'electronic_newspapers') { | ||
| 201 | + ProcessUtils.gotoENewsPaper() | ||
| 202 | + } | ||
| 203 | + break; | ||
| 204 | + case 'dynamic': | ||
| 205 | + content.objectType = ContentConstants.TYPE_FOURTEEN | ||
| 206 | + ProcessUtils.processPage(content) | ||
| 207 | + break; | ||
| 208 | + case 'owner_page': | ||
| 209 | + let creatorId = urlParams.get('creatorId') || '' | ||
| 210 | + ProcessUtils.gotoPeopleShipHomePage(creatorId) | ||
| 211 | + break; | ||
| 212 | + case 'app': | ||
| 213 | + if (urlParams.get('subType') === 'login') { | ||
| 214 | + ProcessUtils.gotoLoginPage() | ||
| 215 | + } | ||
| 216 | + break; | ||
| 217 | + default: | ||
| 218 | + break; | ||
| 219 | + } | ||
| 215 | 220 | ||
| 216 | } | 221 | } |
| 217 | 222 |
| 1 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | 1 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; |
| 2 | -import { H5ReceiveDataJsonBean, postBatchAttentionStatusResult } from 'wdBean'; | ||
| 3 | -import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork'; | 2 | +import { WDHttp, HttpUrlUtils } from 'wdNetwork'; |
| 4 | 3 | ||
| 5 | const TAG = 'JsCallAppService' | 4 | const TAG = 'JsCallAppService' |
| 6 | 5 | ||
| 7 | 6 | ||
| 8 | export function handleJsCallAppService(data: Message, callback: (res: string) => void) { | 7 | export function handleJsCallAppService(data: Message, callback: (res: string) => void) { |
| 9 | - let url: string = HttpUrlUtils.getHost() + data?.data?.url | 8 | + if (data?.data?.method === 'get') { |
| 9 | + let queryString: string = '' | ||
| 10 | + let parameters = data?.data?.parameters | ||
| 11 | + if (parameters) { | ||
| 12 | + queryString = Object.keys(parameters) | ||
| 13 | + .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(parameters?.[key])}`) | ||
| 14 | + .join('&'); | ||
| 15 | + } | ||
| 10 | 16 | ||
| 11 | - let responseMap: ResponseDTO<postBatchAttentionStatusResult> = {} as ResponseDTO<postBatchAttentionStatusResult> | ||
| 12 | - | ||
| 13 | - let h5ReceiveDataJson: H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>> = { | ||
| 14 | - netError: '0', | ||
| 15 | - responseMap | ||
| 16 | - } as H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>> | 17 | + let url: string = HttpUrlUtils.getHost() + data?.data?.url |
| 18 | + if (queryString) { | ||
| 19 | + url = url + `?${queryString}` | ||
| 20 | + } | ||
| 21 | + console.log('yzl', queryString, url) | ||
| 22 | + WDHttp.get(url).then((res) => { | ||
| 23 | + callback(JSON.stringify({ | ||
| 24 | + netError: '0', | ||
| 25 | + responseMap: res | ||
| 26 | + })) | ||
| 27 | + }) | ||
| 28 | + } | ||
| 29 | + if (data?.data?.method === 'post') { | ||
| 30 | + let url: string = HttpUrlUtils.getHost() + data?.data?.url | ||
| 17 | 31 | ||
| 18 | - // if (data?.data?.method === 'get') { | ||
| 19 | - // WDHttp.get<ResponseDTO<postBatchAttentionStatusResult>>(url, headers).then((res: ResponseDTO<postBatchAttentionStatusResult>) => { | ||
| 20 | - // callback(JSON.stringify(res)) | ||
| 21 | - // }) | ||
| 22 | - // } | ||
| 23 | - if (data?.data?.method === 'post' && data?.data?.url === '/api/rmrb-interact/interact/zh/c/batchAttention/status') { | ||
| 24 | - WDHttp.post<ResponseDTO<postBatchAttentionStatusResult>>(url, data?.data?.parameters).then((res: ResponseDTO<postBatchAttentionStatusResult>) => { | ||
| 25 | - h5ReceiveDataJson.responseMap = res | ||
| 26 | - callback(JSON.stringify(h5ReceiveDataJson)) | 32 | + WDHttp.post(url, data?.data?.parameters).then((res) => { |
| 33 | + callback(JSON.stringify({ | ||
| 34 | + netError: '0', | ||
| 35 | + responseMap: res | ||
| 36 | + })) | ||
| 27 | }) | 37 | }) |
| 28 | } | 38 | } |
| 29 | } | 39 | } |
| @@ -55,7 +55,7 @@ export struct WdWebLocalComponent { | @@ -55,7 +55,7 @@ export struct WdWebLocalComponent { | ||
| 55 | .mixedMode(MixedMode.All) | 55 | .mixedMode(MixedMode.All) |
| 56 | .onlineImageAccess(true) | 56 | .onlineImageAccess(true) |
| 57 | .enableNativeEmbedMode(true) | 57 | .enableNativeEmbedMode(true) |
| 58 | - .layoutMode(WebLayoutMode.FIT_CONTENT) | 58 | + // .layoutMode(WebLayoutMode.FIT_CONTENT) |
| 59 | // .nestedScroll({ scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.PARENT_FIRST }) | 59 | // .nestedScroll({ scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.PARENT_FIRST }) |
| 60 | .height(this.webHeight) | 60 | .height(this.webHeight) |
| 61 | .onPageBegin((event) => { | 61 | .onPageBegin((event) => { |
| @@ -172,3 +172,6 @@ export { MasterDetailRes } from './src/main/ets/bean/user/MasterDetailRes'; | @@ -172,3 +172,6 @@ export { MasterDetailRes } from './src/main/ets/bean/user/MasterDetailRes'; | ||
| 172 | 172 | ||
| 173 | export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean'; | 173 | export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean'; |
| 174 | 174 | ||
| 175 | + | ||
| 176 | + | ||
| 177 | +export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean'; |
| @@ -84,7 +84,7 @@ export class ContentDTO implements BaseDTO { | @@ -84,7 +84,7 @@ export class ContentDTO implements BaseDTO { | ||
| 84 | openType: string = ''; | 84 | openType: string = ''; |
| 85 | extra: string = '' | 85 | extra: string = '' |
| 86 | 86 | ||
| 87 | - static clone(old:ContentDTO): ContentDTO { | 87 | + static clone(old: ContentDTO): ContentDTO { |
| 88 | let content = new ContentDTO(); | 88 | let content = new ContentDTO(); |
| 89 | content.appStyle = old.appStyle; | 89 | content.appStyle = old.appStyle; |
| 90 | content.cityCode = old.cityCode; | 90 | content.cityCode = old.cityCode; |
| 1 | export interface commentInfo { | 1 | export interface commentInfo { |
| 2 | commentTitle: string, | 2 | commentTitle: string, |
| 3 | newsTitle: string, | 3 | newsTitle: string, |
| 4 | - userName: string, | ||
| 5 | - userHeaderUrl: string, | 4 | + userId?: string, |
| 5 | + userName?: string, | ||
| 6 | + userHeaderUrl?: string, | ||
| 6 | publishTime: number, | 7 | publishTime: number, |
| 7 | commentId: string, | 8 | commentId: string, |
| 8 | newsId: string, | 9 | newsId: string, |
| 9 | relId: string; | 10 | relId: string; |
| 10 | relType: string; | 11 | relType: string; |
| 11 | - userId: string; | 12 | + newsType?: string, |
| 13 | + objectType?: string, | ||
| 12 | } | 14 | } |
| @@ -57,6 +57,8 @@ export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailCompo | @@ -57,6 +57,8 @@ export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailCompo | ||
| 57 | 57 | ||
| 58 | export { DynamicDetailComponent } from "./src/main/ets/components/DynamicDetailComponent" | 58 | export { DynamicDetailComponent } from "./src/main/ets/components/DynamicDetailComponent" |
| 59 | 59 | ||
| 60 | +export { FeedBackActivity } from "./src/main/ets/components/FeedBackActivity" | ||
| 61 | + | ||
| 60 | export { AudioSuspensionModel } from "./src/main/ets/viewmodel/AudioSuspensionModel" | 62 | export { AudioSuspensionModel } from "./src/main/ets/viewmodel/AudioSuspensionModel" |
| 61 | 63 | ||
| 62 | export { BroadcastPageComponent } from "./src/main/ets/components/broadcast/BroadcastPageComponent" | 64 | export { BroadcastPageComponent } from "./src/main/ets/components/broadcast/BroadcastPageComponent" |
| @@ -65,7 +67,7 @@ export { FirstTabTopSearchComponent } from "./src/main/ets/components/search/Fir | @@ -65,7 +67,7 @@ export { FirstTabTopSearchComponent } from "./src/main/ets/components/search/Fir | ||
| 65 | 67 | ||
| 66 | export { ListHasNoMoreDataUI } from "./src/main/ets/components/reusable/ListHasNoMoreDataUI" | 68 | export { ListHasNoMoreDataUI } from "./src/main/ets/components/reusable/ListHasNoMoreDataUI" |
| 67 | 69 | ||
| 68 | -export { LottieView } from './src/main/ets/lottie/LottieView' | 70 | +export { LottieView } from './src/main/ets/components/lottie/LottieView' |
| 69 | 71 | ||
| 70 | export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopicPageComponent' | 72 | export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopicPageComponent' |
| 71 | 73 |
| 1 | -import { CommonConstants, CompStyle } from 'wdConstant'; | ||
| 2 | -import { ContentDTO } from 'wdBean'; | 1 | +import { CompStyle } from 'wdConstant'; |
| 2 | +import { CompDTO, ContentDTO } from 'wdBean'; | ||
| 3 | import { Card2Component } from './cardview/Card2Component'; | 3 | import { Card2Component } from './cardview/Card2Component'; |
| 4 | import { Card3Component } from './cardview/Card3Component'; | 4 | import { Card3Component } from './cardview/Card3Component'; |
| 5 | import { Card4Component } from './cardview/Card4Component'; | 5 | import { Card4Component } from './cardview/Card4Component'; |
| @@ -24,13 +24,14 @@ import { Card21Component } from './cardview/Card21Component'; | @@ -24,13 +24,14 @@ import { Card21Component } from './cardview/Card21Component'; | ||
| 24 | @Component | 24 | @Component |
| 25 | export struct CardParser { | 25 | export struct CardParser { |
| 26 | @State contentDTO: ContentDTO = new ContentDTO(); | 26 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 27 | + @State compDTO: CompDTO = {} as CompDTO | ||
| 27 | 28 | ||
| 28 | build() { | 29 | build() { |
| 29 | - this.contentBuilder(this.contentDTO); | 30 | + this.contentBuilder(this.contentDTO, this.compDTO); |
| 30 | } | 31 | } |
| 31 | 32 | ||
| 32 | @Builder | 33 | @Builder |
| 33 | - contentBuilder(contentDTO: ContentDTO) { | 34 | + contentBuilder(contentDTO: ContentDTO, compDTO: CompDTO) { |
| 34 | if (contentDTO.appStyle === CompStyle.Card_02) { | 35 | if (contentDTO.appStyle === CompStyle.Card_02) { |
| 35 | Card2Component({ contentDTO }) | 36 | Card2Component({ contentDTO }) |
| 36 | } else if (contentDTO.appStyle === CompStyle.Card_03) { | 37 | } else if (contentDTO.appStyle === CompStyle.Card_03) { |
| @@ -38,7 +39,7 @@ export struct CardParser { | @@ -38,7 +39,7 @@ export struct CardParser { | ||
| 38 | } else if (contentDTO.appStyle === CompStyle.Card_04) { | 39 | } else if (contentDTO.appStyle === CompStyle.Card_04) { |
| 39 | Card4Component({ contentDTO }) | 40 | Card4Component({ contentDTO }) |
| 40 | } else if (contentDTO.appStyle === CompStyle.Card_05) { | 41 | } else if (contentDTO.appStyle === CompStyle.Card_05) { |
| 41 | - Card5Component({ contentDTO }) | 42 | + Card5Component({ contentDTO, titleShowPolicy: compDTO.titleShowPolicy }) |
| 42 | } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle | 43 | } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle |
| 43 | .Card_13) { | 44 | .Card_13) { |
| 44 | Card6Component({ contentDTO }) | 45 | Card6Component({ contentDTO }) |
| @@ -64,8 +65,7 @@ export struct CardParser { | @@ -64,8 +65,7 @@ export struct CardParser { | ||
| 64 | Card20Component({ contentDTO }) | 65 | Card20Component({ contentDTO }) |
| 65 | } else if (contentDTO.appStyle === CompStyle.Card_21) { | 66 | } else if (contentDTO.appStyle === CompStyle.Card_21) { |
| 66 | Card21Component({ contentDTO }) | 67 | Card21Component({ contentDTO }) |
| 67 | - } | ||
| 68 | - else { | 68 | + } else { |
| 69 | // todo:组件未实现 / Component Not Implemented | 69 | // todo:组件未实现 / Component Not Implemented |
| 70 | // Text(contentDTO.appStyle) | 70 | // Text(contentDTO.appStyle) |
| 71 | // .width(CommonConstants.FULL_PARENT) | 71 | // .width(CommonConstants.FULL_PARENT) |
| 1 | -import { SPHelper,Logger,ToastUtils } from 'wdKit'; | ||
| 2 | -import { ContentDetailDTO, Action, ContentDTO,batchLikeAndCollectResult } from 'wdBean'; | 1 | +import { SPHelper, Logger, ToastUtils } from 'wdKit'; |
| 2 | +import { ContentDetailDTO, Action, ContentDTO, batchLikeAndCollectResult } from 'wdBean'; | ||
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import router from '@ohos.router'; | 4 | import router from '@ohos.router'; |
| 5 | import { batchLikeAndCollectParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | 5 | import { batchLikeAndCollectParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; |
| 6 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 6 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 7 | import { SpConstants } from 'wdConstant/Index'; | 7 | import { SpConstants } from 'wdConstant/Index'; |
| 8 | import { WDShare } from 'wdShare/Index'; | 8 | import { WDShare } from 'wdShare/Index'; |
| 9 | -import {LikeComponent} from './view/LikeComponent' | 9 | +import { LikeComponent } from './view/LikeComponent' |
| 10 | + | ||
| 10 | const TAG = 'CarderInteraction' | 11 | const TAG = 'CarderInteraction' |
| 12 | + | ||
| 11 | /** | 13 | /** |
| 12 | * 卡片 分享、评论、点赞公用组件 | 14 | * 卡片 分享、评论、点赞公用组件 |
| 13 | */ | 15 | */ |
| @@ -15,9 +17,10 @@ const TAG = 'CarderInteraction' | @@ -15,9 +17,10 @@ const TAG = 'CarderInteraction' | ||
| 15 | export struct CarderInteraction { | 17 | export struct CarderInteraction { |
| 16 | @Prop contentDTO: ContentDTO | 18 | @Prop contentDTO: ContentDTO |
| 17 | @State contentId: string = '' | 19 | @State contentId: string = '' |
| 18 | - @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | ||
| 19 | - @State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult// 点赞、收藏状态 | 20 | + @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 21 | + @State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult // 点赞、收藏状态 | ||
| 20 | @State likeBean: Record<string, string> = {} | 22 | @State likeBean: Record<string, string> = {} |
| 23 | + | ||
| 21 | async aboutToAppear() { | 24 | async aboutToAppear() { |
| 22 | await this.getContentDetailData() | 25 | await this.getContentDetailData() |
| 23 | // 点赞需要数据 | 26 | // 点赞需要数据 |
| @@ -28,51 +31,55 @@ export struct CarderInteraction { | @@ -28,51 +31,55 @@ export struct CarderInteraction { | ||
| 28 | this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + '' | 31 | this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + '' |
| 29 | this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' | 32 | this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' |
| 30 | } | 33 | } |
| 31 | - build() { | ||
| 32 | - Row(){ | ||
| 33 | - Row(){ | ||
| 34 | - Image($r('app.media.CarderInteraction_share')) | ||
| 35 | - .width(18) | ||
| 36 | - .height(18) | ||
| 37 | - Text('分享') | ||
| 38 | - .margin({left:4}) | ||
| 39 | - .fontSize(14) | ||
| 40 | - .fontColor('#666666') | ||
| 41 | - } | ||
| 42 | - .justifyContent(FlexAlign.Center) | ||
| 43 | - .onClick(()=>{ | ||
| 44 | - WDShare.shareContent(this.contentDetailData) | ||
| 45 | - }) | ||
| 46 | - Row(){ | ||
| 47 | - Image($r('app.media.CarderInteraction_comment')) | ||
| 48 | - .width(18) | ||
| 49 | - .height(18) | ||
| 50 | - Text('评论') | ||
| 51 | - .margin({left:4}) | ||
| 52 | - .fontSize(14) | ||
| 53 | - .fontColor('#666666') | ||
| 54 | - } | ||
| 55 | - .justifyContent(FlexAlign.Center) | ||
| 56 | - .onClick(()=>{ | ||
| 57 | - ProcessUtils.processPage(this.contentDTO) | ||
| 58 | - }) | ||
| 59 | - this.builderLike() | 34 | + |
| 35 | + build() { | ||
| 36 | + Row() { | ||
| 37 | + Row() { | ||
| 38 | + Image($r('app.media.CarderInteraction_share')) | ||
| 39 | + .width(18) | ||
| 40 | + .height(18) | ||
| 41 | + Text('分享') | ||
| 42 | + .margin({ left: 4 }) | ||
| 43 | + .fontSize(14) | ||
| 44 | + .fontColor('#666666') | ||
| 60 | } | 45 | } |
| 61 | - .width('100%') | ||
| 62 | - .margin({top:11}) | ||
| 63 | - .padding({ | ||
| 64 | - left:21, | ||
| 65 | - right:21 | ||
| 66 | - }) | ||
| 67 | - .justifyContent(FlexAlign.SpaceBetween) | ||
| 68 | - .alignItems(VerticalAlign.Center) | ||
| 69 | - } | 46 | + .justifyContent(FlexAlign.Center) |
| 47 | + .onClick(() => { | ||
| 48 | + WDShare.shareContent(this.contentDetailData) | ||
| 49 | + }) | ||
| 50 | + | ||
| 51 | + Row() { | ||
| 52 | + Image($r('app.media.CarderInteraction_comment')) | ||
| 53 | + .width(18) | ||
| 54 | + .height(18) | ||
| 55 | + Text('评论') | ||
| 56 | + .margin({ left: 4 }) | ||
| 57 | + .fontSize(14) | ||
| 58 | + .fontColor('#666666') | ||
| 59 | + } | ||
| 60 | + .justifyContent(FlexAlign.Center) | ||
| 61 | + .onClick(() => { | ||
| 62 | + ProcessUtils.processPage(this.contentDTO) | ||
| 63 | + }) | ||
| 64 | + | ||
| 65 | + this.builderLike() | ||
| 66 | + } | ||
| 67 | + .width('100%') | ||
| 68 | + .margin({ top: 11 }) | ||
| 69 | + .padding({ | ||
| 70 | + left: 21, | ||
| 71 | + right: 21 | ||
| 72 | + }) | ||
| 73 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 74 | + .alignItems(VerticalAlign.Center) | ||
| 75 | + } | ||
| 76 | + | ||
| 70 | /** | 77 | /** |
| 71 | * 点赞组件 | 78 | * 点赞组件 |
| 72 | */ | 79 | */ |
| 73 | @Builder | 80 | @Builder |
| 74 | builderLike() { | 81 | builderLike() { |
| 75 | - Row(){ | 82 | + Row() { |
| 76 | if (this.likeBean?.contentId) { | 83 | if (this.likeBean?.contentId) { |
| 77 | LikeComponent({ | 84 | LikeComponent({ |
| 78 | data: this.likeBean, | 85 | data: this.likeBean, |
| @@ -88,13 +95,13 @@ export struct CarderInteraction { | @@ -88,13 +95,13 @@ export struct CarderInteraction { | ||
| 88 | * */ | 95 | * */ |
| 89 | private async getContentDetailData() { | 96 | private async getContentDetailData() { |
| 90 | try { | 97 | try { |
| 91 | - let data = await MultiPictureDetailViewModel.getDetailData(this.contentDTO.relId, this.contentDTO.objectId, this.contentDTO.relType) | 98 | + let data = await MultiPictureDetailViewModel.getDetailData(this.contentDTO.relId, this.contentDTO.objectId, |
| 99 | + this.contentDTO.relType) | ||
| 92 | this.contentDetailData = data[0]; | 100 | this.contentDetailData = data[0]; |
| 93 | - console.log('动态详情',JSON.stringify(this.contentDetailData)) | 101 | + console.log('动态详情', JSON.stringify(this.contentDetailData)) |
| 94 | } catch (exception) { | 102 | } catch (exception) { |
| 95 | - console.log('请求失败',JSON.stringify(exception)) | 103 | + console.log('请求失败', JSON.stringify(exception)) |
| 96 | } | 104 | } |
| 97 | } | 105 | } |
| 98 | - | ||
| 99 | } | 106 | } |
| 100 | 107 |
| @@ -14,7 +14,6 @@ import { ZhSingleRow06 } from './compview/ZhSingleRow06'; | @@ -14,7 +14,6 @@ import { ZhSingleRow06 } from './compview/ZhSingleRow06'; | ||
| 14 | import { ZhSingleColumn04 } from './compview/ZhSingleColumn04'; | 14 | import { ZhSingleColumn04 } from './compview/ZhSingleColumn04'; |
| 15 | import { ZhSingleColumn09 } from './compview/ZhSingleColumn09'; | 15 | import { ZhSingleColumn09 } from './compview/ZhSingleColumn09'; |
| 16 | import { ZhGridLayout03 } from './compview/ZhGridLayout03'; | 16 | import { ZhGridLayout03 } from './compview/ZhGridLayout03'; |
| 17 | -import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01'; | ||
| 18 | import { CardParser } from './CardParser'; | 17 | import { CardParser } from './CardParser'; |
| 19 | import { ZhGridLayout02 } from './compview/ZhGridLayout02'; | 18 | import { ZhGridLayout02 } from './compview/ZhGridLayout02'; |
| 20 | import { Card2Component } from './cardview/Card2Component'; | 19 | import { Card2Component } from './cardview/Card2Component'; |
| @@ -23,6 +22,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | @@ -23,6 +22,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 23 | import { AdvCardParser } from './cardViewAdv/AdvCardParser'; | 22 | import { AdvCardParser } from './cardViewAdv/AdvCardParser'; |
| 24 | import PageModel from '../viewmodel/PageModel'; | 23 | import PageModel from '../viewmodel/PageModel'; |
| 25 | import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'; | 24 | import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'; |
| 25 | +import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01'; | ||
| 26 | 26 | ||
| 27 | /** | 27 | /** |
| 28 | * comp适配器. | 28 | * comp适配器. |
| @@ -32,12 +32,12 @@ import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent' | @@ -32,12 +32,12 @@ import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent' | ||
| 32 | @Component | 32 | @Component |
| 33 | export struct CompParser { | 33 | export struct CompParser { |
| 34 | @State compDTO: CompDTO = {} as CompDTO | 34 | @State compDTO: CompDTO = {} as CompDTO |
| 35 | - @State private pageModel: PageModel = new PageModel(); | ||
| 36 | @State compIndex: number = 0; | 35 | @State compIndex: number = 0; |
| 36 | + @State private pageModel: PageModel = new PageModel(); | ||
| 37 | 37 | ||
| 38 | build() { | 38 | build() { |
| 39 | Column() { | 39 | Column() { |
| 40 | - if (this.compDTO.name !="月度排行卡") { | 40 | + if (this.compDTO.name != "月度排行卡") { |
| 41 | 41 | ||
| 42 | this.componentBuilder(this.compDTO, this.compIndex); | 42 | this.componentBuilder(this.compDTO, this.compIndex); |
| 43 | } | 43 | } |
| @@ -53,7 +53,8 @@ export struct CompParser { | @@ -53,7 +53,8 @@ export struct CompParser { | ||
| 53 | } else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { | 53 | } else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { |
| 54 | ZhCarouselLayout01({ compDTO: compDTO }) | 54 | ZhCarouselLayout01({ compDTO: compDTO }) |
| 55 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 55 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 56 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 2) {// && compDTO.name ==="横划卡" | 56 | + } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && |
| 57 | + compDTO.imageScale === 2) { // && compDTO.name ==="横划卡" | ||
| 57 | 58 | ||
| 58 | LiveHorizontalCardComponent({ compDTO: compDTO }) | 59 | LiveHorizontalCardComponent({ compDTO: compDTO }) |
| 59 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 60 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| @@ -87,7 +88,7 @@ export struct CompParser { | @@ -87,7 +88,7 @@ export struct CompParser { | ||
| 87 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 88 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 88 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) { | 89 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) { |
| 89 | //头图卡 和comStyle 2相同, | 90 | //头图卡 和comStyle 2相同, |
| 90 | - Card5Component({ contentDTO: compDTO.operDataList[0] }) | 91 | + Card5Component({ contentDTO: compDTO.operDataList[0], titleShowPolicy: compDTO.titleShowPolicy }) |
| 91 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 92 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 92 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) { | 93 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) { |
| 93 | // 大图卡 | 94 | // 大图卡 |
| @@ -107,10 +108,9 @@ export struct CompParser { | @@ -107,10 +108,9 @@ export struct CompParser { | ||
| 107 | //Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 }) | 108 | //Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 }) |
| 108 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 109 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 109 | } else if (!Number.isNaN(Number(compDTO.compStyle))) { | 110 | } else if (!Number.isNaN(Number(compDTO.compStyle))) { |
| 110 | - CardParser({ contentDTO: compDTO.operDataList[0] }); | 111 | + CardParser({ contentDTO: compDTO.operDataList[0], compDTO }); |
| 111 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 112 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 112 | - } | ||
| 113 | - else { | 113 | + } else { |
| 114 | Text(compDTO.compStyle) | 114 | Text(compDTO.compStyle) |
| 115 | .width(CommonConstants.FULL_PARENT) | 115 | .width(CommonConstants.FULL_PARENT) |
| 116 | .padding(10) | 116 | .padding(10) |
| 1 | -import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper, NumberFormatterUtils, DisplayUtils, | ||
| 2 | - NetworkUtil } from 'wdKit'; | 1 | +import { |
| 2 | + AccountManagerUtils, | ||
| 3 | + Logger, | ||
| 4 | + DateTimeUtils, | ||
| 5 | + SPHelper, | ||
| 6 | + NumberFormatterUtils, | ||
| 7 | + DisplayUtils, | ||
| 8 | + NetworkUtil, | ||
| 9 | + FastClickUtil | ||
| 10 | +} from 'wdKit'; | ||
| 3 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 11 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 4 | -import { ContentDetailDTO,postBatchAttentionStatusParams, | 12 | +import { |
| 13 | + ContentDetailDTO, | ||
| 14 | + postBatchAttentionStatusParams, | ||
| 5 | PhotoListBean, | 15 | PhotoListBean, |
| 6 | ContentDTO, | 16 | ContentDTO, |
| 7 | batchLikeAndCollectResult, | 17 | batchLikeAndCollectResult, |
| 8 | RmhInfoDTO, | 18 | RmhInfoDTO, |
| 9 | - InteractDataDTO, } from 'wdBean'; | 19 | + InteractDataDTO, |
| 20 | +} from 'wdBean'; | ||
| 10 | import media from '@ohos.multimedia.media'; | 21 | import media from '@ohos.multimedia.media'; |
| 11 | import { OperRowListView } from './view/OperRowListView'; | 22 | import { OperRowListView } from './view/OperRowListView'; |
| 12 | import { WDPlayerController } from 'wdPlayer/Index'; | 23 | import { WDPlayerController } from 'wdPlayer/Index'; |
| @@ -33,6 +44,7 @@ import { detailedSkeleton } from './skeleton/detailSkeleton'; | @@ -33,6 +44,7 @@ import { detailedSkeleton } from './skeleton/detailSkeleton'; | ||
| 33 | 44 | ||
| 34 | const TAG = 'DynamicDetailComponent' | 45 | const TAG = 'DynamicDetailComponent' |
| 35 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | 46 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; |
| 47 | + | ||
| 36 | // @Preview | 48 | // @Preview |
| 37 | @Component | 49 | @Component |
| 38 | export struct DynamicDetailComponent { | 50 | export struct DynamicDetailComponent { |
| @@ -40,418 +52,480 @@ export struct DynamicDetailComponent { | @@ -40,418 +52,480 @@ export struct DynamicDetailComponent { | ||
| 40 | private relId: string = '' | 52 | private relId: string = '' |
| 41 | private contentId: string = '' | 53 | private contentId: string = '' |
| 42 | private relType: string = '' | 54 | private relType: string = '' |
| 43 | - | ||
| 44 | //出参 | 55 | //出参 |
| 45 | - @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 56 | + @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 46 | //UI | 57 | //UI |
| 47 | scroller: Scroller = new Scroller(); | 58 | scroller: Scroller = new Scroller(); |
| 48 | - | ||
| 49 | //点赞 收藏 评论 数量 | 59 | //点赞 收藏 评论 数量 |
| 50 | - @State interactDataDTO: InteractDataDTO = {likeNum:0} as InteractDataDTO | 60 | + @State interactDataDTO: InteractDataDTO = { likeNum: 0 } as InteractDataDTO |
| 51 | /** | 61 | /** |
| 52 | * 关注状态:默认未关注 点击去关注 | 62 | * 关注状态:默认未关注 点击去关注 |
| 53 | */ | 63 | */ |
| 54 | - @State followStatus: String = ''; | ||
| 55 | - | ||
| 56 | - @State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult// 点赞、收藏状态 | 64 | + @State followStatus: String = ''; |
| 65 | + @State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult // 点赞、收藏状态 | ||
| 57 | //跳转 | 66 | //跳转 |
| 58 | - private mJumpInfo: ContentDTO = new ContentDTO(); | ||
| 59 | - | 67 | + private mJumpInfo: ContentDTO = new ContentDTO(); |
| 60 | @State publishTime: string = '' | 68 | @State publishTime: string = '' |
| 61 | @State isNetConnected: boolean = true | 69 | @State isNetConnected: boolean = true |
| 62 | @State isPageEnd: boolean = false | 70 | @State isPageEnd: boolean = false |
| 63 | - | ||
| 64 | @State publishCommentModel: publishCommentModel = new publishCommentModel() | 71 | @State publishCommentModel: publishCommentModel = new publishCommentModel() |
| 65 | - | 72 | + @State reachEndIncreament: number = 0 |
| 66 | 73 | ||
| 67 | async aboutToAppear() { | 74 | async aboutToAppear() { |
| 68 | await this.getContentDetailData() | 75 | await this.getContentDetailData() |
| 69 | } | 76 | } |
| 77 | + | ||
| 70 | onPageHide() { | 78 | onPageHide() { |
| 71 | 79 | ||
| 72 | } | 80 | } |
| 73 | 81 | ||
| 74 | build() { | 82 | build() { |
| 75 | - Column(){ | ||
| 76 | - //logo、日期 | ||
| 77 | - Row() { | ||
| 78 | - Image($r('app.media.ic_article_rmh')) | ||
| 79 | - .width($r('app.float.margin_80')) | ||
| 80 | - .height($r('app.float.margin_28')) | ||
| 81 | - .margin({ left: $r('app.float.margin_16') }) | ||
| 82 | - Blank() | ||
| 83 | - Text(this.publishTime) | ||
| 84 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 85 | - .fontSize($r('app.float.font_size_12')) | ||
| 86 | - .lineHeight($r('app.float.margin_28')) | ||
| 87 | - .margin({ right: $r('app.float.margin_16') }) | ||
| 88 | - } | ||
| 89 | - .height($r('app.float.margin_48')) | 83 | + Column() { |
| 84 | + //logo、日期 | ||
| 85 | + Row() { | ||
| 86 | + Image($r('app.media.ic_article_rmh')) | ||
| 87 | + .width($r('app.float.margin_80')) | ||
| 88 | + .height($r('app.float.margin_28')) | ||
| 89 | + .margin({ left: $r('app.float.margin_16') }) | ||
| 90 | + Blank() | ||
| 91 | + Text(this.publishTime) | ||
| 92 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 93 | + .fontSize($r('app.float.font_size_12')) | ||
| 94 | + .lineHeight($r('app.float.margin_28')) | ||
| 95 | + .margin({ right: $r('app.float.margin_16') }) | ||
| 96 | + } | ||
| 97 | + .height($r('app.float.margin_48')) | ||
| 98 | + .width('100%') | ||
| 99 | + .alignItems(VerticalAlign.Bottom) | ||
| 100 | + .padding({ bottom: 5 }) | ||
| 101 | + | ||
| 102 | + //分割线 | ||
| 103 | + Image($r('app.media.ic_news_detail_division')) | ||
| 90 | .width('100%') | 104 | .width('100%') |
| 91 | - .alignItems(VerticalAlign.Bottom) | ||
| 92 | - .padding({bottom:5}) | ||
| 93 | - //分割线 | ||
| 94 | - Image($r('app.media.ic_news_detail_division')) | ||
| 95 | - .width('100%') | ||
| 96 | - .height($r('app.float.margin_7')) | ||
| 97 | - .padding({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} ) | ||
| 98 | - Stack({ alignContent: Alignment.Bottom }) { | ||
| 99 | - if (!this.isNetConnected) { | ||
| 100 | - EmptyComponent({ | ||
| 101 | - emptyType: 1, | ||
| 102 | - emptyButton: true, | ||
| 103 | - retry: () => { | ||
| 104 | - this.getContentDetailData() | ||
| 105 | - } | ||
| 106 | - }).padding({ bottom: 200 }) | 105 | + .height($r('app.float.margin_7')) |
| 106 | + .padding({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) | ||
| 107 | + Stack({ alignContent: Alignment.Bottom }) { | ||
| 108 | + if (!this.isNetConnected) { | ||
| 109 | + EmptyComponent({ | ||
| 110 | + emptyType: 1, | ||
| 111 | + emptyButton: true, | ||
| 112 | + retry: () => { | ||
| 113 | + this.getContentDetailData() | ||
| 114 | + } | ||
| 115 | + }).padding({ bottom: 200 }) | ||
| 116 | + } else { | ||
| 117 | + if (!this.isPageEnd) { | ||
| 118 | + detailedSkeleton() | ||
| 107 | } else { | 119 | } else { |
| 108 | - if (!this.isPageEnd) { | ||
| 109 | - detailedSkeleton() | ||
| 110 | - }else{ | ||
| 111 | - Scroll(this.scroller) { | ||
| 112 | - Column() { | ||
| 113 | - //号主信息 | ||
| 114 | - Row() { | ||
| 115 | - //头像 | ||
| 116 | - Stack() { | ||
| 117 | - Image(this.contentDetailData.rmhInfo?.rmhHeadUrl) | ||
| 118 | - .alt(this.contentDetailData.rmhInfo?.userType=='1'?$r('app.media.default_head'):$r('app.media.icon_default_head_mater')) | ||
| 119 | - .width($r('app.float.margin_32')) | ||
| 120 | - .height($r('app.float.margin_32')) | ||
| 121 | - .objectFit(ImageFit.Cover) | ||
| 122 | - .borderRadius($r('app.float.margin_16')) | ||
| 123 | - Image(this.contentDetailData.rmhInfo?.honoraryIcon) | ||
| 124 | - .width($r('app.float.margin_48')) | ||
| 125 | - .height($r('app.float.margin_48')) | ||
| 126 | - .objectFit(ImageFit.Cover) | ||
| 127 | - .borderRadius($r('app.float.margin_24')) | ||
| 128 | - if(!StringUtils.isEmpty(this.contentDetailData.rmhInfo?.authIcon)){ | ||
| 129 | - Stack() { | ||
| 130 | - Image(this.contentDetailData.rmhInfo?.authIcon) | ||
| 131 | - .width($r('app.float.vp_12')) | ||
| 132 | - .height($r('app.float.vp_12')) | ||
| 133 | - .objectFit(ImageFit.Cover) | ||
| 134 | - } | ||
| 135 | - .width($r('app.float.margin_48')) | ||
| 136 | - .height($r('app.float.margin_48')) | ||
| 137 | - .alignContent(Alignment.BottomEnd) | 120 | + Scroll(this.scroller) { |
| 121 | + Column() { | ||
| 122 | + //号主信息 | ||
| 123 | + Row() { | ||
| 124 | + //头像 | ||
| 125 | + Stack() { | ||
| 126 | + Image(this.contentDetailData.rmhInfo?.rmhHeadUrl) | ||
| 127 | + .alt(this.contentDetailData.rmhInfo?.userType == '1' ? $r('app.media.default_head') : | ||
| 128 | + $r('app.media.icon_default_head_mater')) | ||
| 129 | + .width($r('app.float.margin_32')) | ||
| 130 | + .height($r('app.float.margin_32')) | ||
| 131 | + .objectFit(ImageFit.Cover) | ||
| 132 | + .borderRadius($r('app.float.margin_16')) | ||
| 133 | + Image(this.contentDetailData.rmhInfo?.honoraryIcon) | ||
| 134 | + .width($r('app.float.margin_48')) | ||
| 135 | + .height($r('app.float.margin_48')) | ||
| 136 | + .objectFit(ImageFit.Cover) | ||
| 137 | + .borderRadius($r('app.float.margin_24')) | ||
| 138 | + if (!StringUtils.isEmpty(this.contentDetailData.rmhInfo?.authIcon)) { | ||
| 139 | + Stack() { | ||
| 140 | + Image(this.contentDetailData.rmhInfo?.authIcon) | ||
| 141 | + .width($r('app.float.vp_12')) | ||
| 142 | + .height($r('app.float.vp_12')) | ||
| 143 | + .objectFit(ImageFit.Cover) | ||
| 138 | } | 144 | } |
| 145 | + .width($r('app.float.margin_48')) | ||
| 146 | + .height($r('app.float.margin_48')) | ||
| 147 | + .alignContent(Alignment.BottomEnd) | ||
| 139 | } | 148 | } |
| 140 | - .width($r('app.float.margin_48')) | ||
| 141 | - .height($r('app.float.margin_48')) | ||
| 142 | - .alignContent(Alignment.Center) | ||
| 143 | - .onClick(() => { | ||
| 144 | - ProcessUtils.gotoPeopleShipHomePage(this.contentDetailData.rmhInfo == null ?"":this.contentDetailData.rmhInfo.rmhId) | ||
| 145 | - }) | ||
| 146 | - Column(){ | ||
| 147 | - //昵称 | ||
| 148 | - Text(this.contentDetailData.rmhInfo?.rmhName) | ||
| 149 | - .fontSize($r('app.float.font_size_14')) | ||
| 150 | - .fontColor($r('app.color.color_222222')) | ||
| 151 | - .fontWeight(FontWeight.Medium) | ||
| 152 | - .margin({ left: $r('app.float.margin_5') }) | ||
| 153 | - .alignSelf(ItemAlign.Start) | ||
| 154 | - //简介 | ||
| 155 | - Text(this.contentDetailData.rmhInfo?.rmhDesc) | ||
| 156 | - .fontSize($r('app.float.font_size_14')) | ||
| 157 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 158 | - .fontWeight(FontWeight.Medium) | ||
| 159 | - .maxLines(1) | ||
| 160 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 161 | - .margin({ left: $r('app.float.margin_5') }) | ||
| 162 | - .alignSelf(ItemAlign.Start) | 149 | + } |
| 150 | + .width($r('app.float.margin_48')) | ||
| 151 | + .height($r('app.float.margin_48')) | ||
| 152 | + .alignContent(Alignment.Center) | ||
| 153 | + .onClick(async () => { | ||
| 154 | + let retvalue = await FastClickUtil.isMinDelayTime() | ||
| 155 | + if(retvalue){ | ||
| 156 | + return | ||
| 163 | } | 157 | } |
| 164 | - .width('63%') | ||
| 165 | - .margin({right: $r('app.float.margin_6')}) | ||
| 166 | - if(!StringUtils.isEmpty(this.followStatus)){ | ||
| 167 | - if (this.followStatus == '0') { | ||
| 168 | - Row() { | ||
| 169 | - Blank().layoutWeight(1) | ||
| 170 | - Image($r('app.media.icon_add_attention')) | ||
| 171 | - .width($r('app.float.vp_12')) | ||
| 172 | - .height($r('app.float.vp_12')) | ||
| 173 | - .margin({right:2}) | ||
| 174 | - Text('关注') | ||
| 175 | - .textAlign(TextAlign.Center) | ||
| 176 | - .fontSize($r('app.float.font_size_12')) | ||
| 177 | - .fontColor($r('app.color.color_fff')) | ||
| 178 | - Blank().layoutWeight(1) | 158 | + ProcessUtils.gotoPeopleShipHomePage(this.contentDetailData.rmhInfo == null ? "" : |
| 159 | + this.contentDetailData.rmhInfo.rmhId) | ||
| 160 | + }) | ||
| 161 | + | ||
| 162 | + Column() { | ||
| 163 | + //昵称 | ||
| 164 | + Text(this.contentDetailData.rmhInfo?.rmhName) | ||
| 165 | + .fontSize($r('app.float.font_size_14')) | ||
| 166 | + .fontColor($r('app.color.color_222222')) | ||
| 167 | + .fontWeight(FontWeight.Medium) | ||
| 168 | + .margin({ left: $r('app.float.margin_5') }) | ||
| 169 | + .alignSelf(ItemAlign.Start) | ||
| 170 | + //简介 | ||
| 171 | + Text(this.contentDetailData.rmhInfo?.rmhDesc) | ||
| 172 | + .fontSize($r('app.float.font_size_14')) | ||
| 173 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 174 | + .fontWeight(FontWeight.Medium) | ||
| 175 | + .maxLines(1) | ||
| 176 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 177 | + .margin({ left: $r('app.float.margin_5') }) | ||
| 178 | + .alignSelf(ItemAlign.Start) | ||
| 179 | + } | ||
| 180 | + .width('63%') | ||
| 181 | + .margin({ right: $r('app.float.margin_6') }) | ||
| 182 | + | ||
| 183 | + if (!StringUtils.isEmpty(this.followStatus)) { | ||
| 184 | + if (this.followStatus == '0') { | ||
| 185 | + Row() { | ||
| 186 | + Blank().layoutWeight(1) | ||
| 187 | + Image($r('app.media.icon_add_attention')) | ||
| 188 | + .width($r('app.float.vp_12')) | ||
| 189 | + .height($r('app.float.vp_12')) | ||
| 190 | + .margin({ right: 2 }) | ||
| 191 | + Text('关注') | ||
| 192 | + .textAlign(TextAlign.Center) | ||
| 193 | + .fontSize($r('app.float.font_size_12')) | ||
| 194 | + .fontColor($r('app.color.color_fff')) | ||
| 195 | + Blank().layoutWeight(1) | ||
| 196 | + } | ||
| 197 | + .width($r('app.float.margin_54')) | ||
| 198 | + .height($r('app.float.margin_24')) | ||
| 199 | + .borderRadius($r('app.float.vp_3')) | ||
| 200 | + .backgroundColor($r('app.color.color_ED2800')) | ||
| 201 | + .onClick(async () => { | ||
| 202 | + let retvalue = await FastClickUtil.isMinDelayTime() | ||
| 203 | + if(retvalue){ | ||
| 204 | + return | ||
| 179 | } | 205 | } |
| 206 | + this.handleAccention() | ||
| 207 | + }) | ||
| 208 | + } else { | ||
| 209 | + Text('已关注') | ||
| 180 | .width($r('app.float.margin_54')) | 210 | .width($r('app.float.margin_54')) |
| 181 | .height($r('app.float.margin_24')) | 211 | .height($r('app.float.margin_24')) |
| 212 | + .borderWidth(1) | ||
| 213 | + .textAlign(TextAlign.Center) | ||
| 214 | + .fontSize($r('app.float.font_size_12')) | ||
| 182 | .borderRadius($r('app.float.vp_3')) | 215 | .borderRadius($r('app.float.vp_3')) |
| 183 | - .backgroundColor($r('app.color.color_ED2800')) | ||
| 184 | - .onClick(() => { | 216 | + .borderColor($r('app.color.color_CCCCCC_1A')) |
| 217 | + .backgroundColor($r('app.color.color_CCCCCC_1A')) | ||
| 218 | + .fontColor($r('app.color.color_CCCCCC')) | ||
| 219 | + .onClick(async () => { | ||
| 220 | + let retvalue = await FastClickUtil.isMinDelayTime() | ||
| 221 | + if(retvalue){ | ||
| 222 | + return | ||
| 223 | + } | ||
| 185 | this.handleAccention() | 224 | this.handleAccention() |
| 186 | }) | 225 | }) |
| 187 | - } else { | ||
| 188 | - Text('已关注') | ||
| 189 | - .width($r('app.float.margin_54')) | ||
| 190 | - .height($r('app.float.margin_24')) | ||
| 191 | - .borderWidth(1) | ||
| 192 | - .textAlign(TextAlign.Center) | ||
| 193 | - .fontSize($r('app.float.font_size_12')) | ||
| 194 | - .borderRadius($r('app.float.vp_3')) | ||
| 195 | - .borderColor($r('app.color.color_CCCCCC_1A')) | ||
| 196 | - .backgroundColor($r('app.color.color_CCCCCC_1A')) | ||
| 197 | - .fontColor($r('app.color.color_CCCCCC')) | ||
| 198 | - .onClick(() => { | ||
| 199 | - this.handleAccention() | ||
| 200 | - }) | ||
| 201 | - } | ||
| 202 | } | 226 | } |
| 203 | } | 227 | } |
| 204 | - .width('100%') | ||
| 205 | - .margin({ left: $r('app.float.margin_16')}) | ||
| 206 | - //内容 | ||
| 207 | - Text(StringUtils.isEmpty(this.contentDetailData.newsContent) | ||
| 208 | - ?StringUtils.isEmpty(this.contentDetailData.newsSummary) | ||
| 209 | - ?this.contentDetailData.newsTitle | ||
| 210 | - :this.contentDetailData.newsSummary | ||
| 211 | - :this.contentDetailData.newsContent) | ||
| 212 | - .fontColor($r('app.color.color_222222')) | ||
| 213 | - .fontSize($r('app.float.font_size_18')) | ||
| 214 | - .lineHeight($r('app.float.margin_25')) | ||
| 215 | - .margin({ top: $r('app.float.margin_6') | ||
| 216 | - ,left: $r('app.float.margin_16') | ||
| 217 | - ,right: $r('app.float.margin_16') }) | ||
| 218 | - .alignSelf(ItemAlign.Start) | ||
| 219 | - if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){ | ||
| 220 | - //附件内容:图片/视频 | ||
| 221 | - if(this.contentDetailData.photoList!= null && this.contentDetailData.photoList.length>0){ | ||
| 222 | - // 图片-从无图到9图展示 | ||
| 223 | - GridRow({ | ||
| 224 | - gutter: { x: 2, y: 2 } | ||
| 225 | - }) { | ||
| 226 | - ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => { | ||
| 227 | - if (this.contentDetailData.photoList.length === 1) { | ||
| 228 | - if (this.getPicType(item) !== 3) { | ||
| 229 | - GridCol({ | ||
| 230 | - span: this.getPicType(item) === 1 ? 12 : 8 | ||
| 231 | - }){ | ||
| 232 | - Stack({ | ||
| 233 | - alignContent: Alignment.BottomEnd | ||
| 234 | - }) { | ||
| 235 | - if (this.getPicType(item) === 1) { | ||
| 236 | - Image(item.picPath) | ||
| 237 | - .width('100%') | ||
| 238 | - .height(172) | ||
| 239 | - .autoResize(true) | ||
| 240 | - .borderRadius(this.caclImageRadius(index)) | ||
| 241 | - } else if (this.getPicType(item) === 2) { | ||
| 242 | - Image(item.picPath) | ||
| 243 | - .width('100%') | ||
| 244 | - .height(305) | ||
| 245 | - .autoResize(true) | ||
| 246 | - .borderRadius(this.caclImageRadius(index)) | ||
| 247 | - } | ||
| 248 | - Flex({ direction: FlexDirection.Row }) { | ||
| 249 | - Image($r('app.media.icon_long_pic')) | ||
| 250 | - .width(14) | ||
| 251 | - .height(14) | ||
| 252 | - .margin({right: 4}) | ||
| 253 | - Text('长图') | ||
| 254 | - .fontSize(12) | ||
| 255 | - .fontWeight(400) | ||
| 256 | - .fontColor(0xffffff) | ||
| 257 | - .fontFamily('PingFang SC') | ||
| 258 | - } | ||
| 259 | - .width(48) | ||
| 260 | - .padding({bottom: 9}) | 228 | + } |
| 229 | + .width('100%') | ||
| 230 | + .margin({ left: $r('app.float.margin_16') }) | ||
| 261 | 231 | ||
| 262 | - } | ||
| 263 | - } | ||
| 264 | - .onClick((event: ClickEvent) => { | ||
| 265 | - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index) | ||
| 266 | - }) | ||
| 267 | - } else { | ||
| 268 | - GridCol({ | ||
| 269 | - span: { xs: 8 } | ||
| 270 | - }) { | ||
| 271 | - Image(item.picPath) | ||
| 272 | - .width('100%') | ||
| 273 | - .borderRadius(this.caclImageRadius(index)) | ||
| 274 | - .autoResize(true) | ||
| 275 | - .opacity(!item.width && !item.height ? 0 : 1) | ||
| 276 | - .onComplete(callback => { | ||
| 277 | - item.width = callback?.width || 0; | ||
| 278 | - item.height = callback?.height || 0; | ||
| 279 | - }) | ||
| 280 | - } | ||
| 281 | - .onClick((event: ClickEvent) => { | ||
| 282 | - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index) | ||
| 283 | - }) | ||
| 284 | - } | ||
| 285 | - } else if (this.contentDetailData.photoList.length === 4) { | 232 | + //内容 |
| 233 | + Text(StringUtils.isEmpty(this.contentDetailData.newsContent) | ||
| 234 | + ? StringUtils.isEmpty(this.contentDetailData.newsSummary) | ||
| 235 | + ? this.contentDetailData.newsTitle | ||
| 236 | + : this.contentDetailData.newsSummary | ||
| 237 | + : this.contentDetailData.newsContent) | ||
| 238 | + .fontColor($r('app.color.color_222222')) | ||
| 239 | + .fontSize($r('app.float.font_size_18')) | ||
| 240 | + .lineHeight($r('app.float.margin_25')) | ||
| 241 | + .margin({ | ||
| 242 | + top: $r('app.float.margin_6') | ||
| 243 | + , left: $r('app.float.margin_16') | ||
| 244 | + , right: $r('app.float.margin_16') | ||
| 245 | + }) | ||
| 246 | + .alignSelf(ItemAlign.Start) | ||
| 247 | + if (this.contentDetailData.newsType + "" == ContentConstants.TYPE_FOURTEEN) { | ||
| 248 | + //附件内容:图片/视频 | ||
| 249 | + if (this.contentDetailData.photoList != null && this.contentDetailData.photoList.length > 0) { | ||
| 250 | + // 图片-从无图到9图展示 | ||
| 251 | + GridRow({ | ||
| 252 | + gutter: { x: 2, y: 2 } | ||
| 253 | + }) { | ||
| 254 | + ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => { | ||
| 255 | + if (this.contentDetailData.photoList.length === 1) { | ||
| 256 | + if (this.getPicType(item) !== 3) { | ||
| 286 | GridCol({ | 257 | GridCol({ |
| 287 | - span: { xs: 4 } | 258 | + span: this.getPicType(item) === 1 ? 12 : 8 |
| 288 | }) { | 259 | }) { |
| 289 | - Image(item.picPath) | ||
| 290 | - .aspectRatio(1) | ||
| 291 | - .borderRadius(this.caclImageRadius(index)) | 260 | + Stack({ |
| 261 | + alignContent: Alignment.BottomEnd | ||
| 262 | + }) { | ||
| 263 | + if (this.getPicType(item) === 1) { | ||
| 264 | + Image(item.picPath) | ||
| 265 | + .width('100%') | ||
| 266 | + .height(172) | ||
| 267 | + .autoResize(true) | ||
| 268 | + .borderRadius(this.caclImageRadius(index)) | ||
| 269 | + } else if (this.getPicType(item) === 2) { | ||
| 270 | + Image(item.picPath) | ||
| 271 | + .width('100%') | ||
| 272 | + .height(305) | ||
| 273 | + .autoResize(true) | ||
| 274 | + .borderRadius(this.caclImageRadius(index)) | ||
| 275 | + } | ||
| 276 | + Flex({ direction: FlexDirection.Row }) { | ||
| 277 | + Image($r('app.media.icon_long_pic')) | ||
| 278 | + .width(14) | ||
| 279 | + .height(14) | ||
| 280 | + .margin({ right: 4 }) | ||
| 281 | + Text('长图') | ||
| 282 | + .fontSize(12) | ||
| 283 | + .fontWeight(400) | ||
| 284 | + .fontColor(0xffffff) | ||
| 285 | + .fontFamily('PingFang SC') | ||
| 286 | + } | ||
| 287 | + .width(48) | ||
| 288 | + .padding({ bottom: 9 }) | ||
| 289 | + | ||
| 290 | + } | ||
| 292 | } | 291 | } |
| 293 | - .onClick((event: ClickEvent) => { | ||
| 294 | - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index) | 292 | + .onClick(async (event: ClickEvent) => { |
| 293 | + let retvalue = await FastClickUtil.isMinDelayTime() | ||
| 294 | + if(retvalue){ | ||
| 295 | + return | ||
| 296 | + } | ||
| 297 | + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index) | ||
| 295 | }) | 298 | }) |
| 296 | } else { | 299 | } else { |
| 297 | GridCol({ | 300 | GridCol({ |
| 298 | - span: { sm: 4, lg: 3 } | 301 | + span: { xs: 8 } |
| 299 | }) { | 302 | }) { |
| 300 | Image(item.picPath) | 303 | Image(item.picPath) |
| 301 | - .aspectRatio(1) | 304 | + .width('100%') |
| 302 | .borderRadius(this.caclImageRadius(index)) | 305 | .borderRadius(this.caclImageRadius(index)) |
| 306 | + .autoResize(true) | ||
| 307 | + .opacity(!item.width && !item.height ? 0 : 1) | ||
| 308 | + .onComplete(callback => { | ||
| 309 | + item.width = callback?.width || 0; | ||
| 310 | + item.height = callback?.height || 0; | ||
| 311 | + }) | ||
| 303 | } | 312 | } |
| 304 | - .onClick((event: ClickEvent) => { | ||
| 305 | - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index) | 313 | + .onClick(async (event: ClickEvent) => { |
| 314 | + let retvalue = await FastClickUtil.isMinDelayTime() | ||
| 315 | + if(retvalue){ | ||
| 316 | + return | ||
| 317 | + } | ||
| 318 | + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index) | ||
| 306 | }) | 319 | }) |
| 307 | } | 320 | } |
| 308 | - }) | ||
| 309 | - } | ||
| 310 | - .margin({ left: $r('app.float.margin_16'),right: $r('app.float.margin_16'),top: $r('app.float.margin_8')}) | ||
| 311 | - } | ||
| 312 | - }else{ | ||
| 313 | - if(this.contentDetailData.videoInfo!= null && this.contentDetailData.videoInfo.length>0){ | ||
| 314 | - GridRow() { | ||
| 315 | - if (this.contentDetailData.videoInfo[0].videoLandScape === 1) { | ||
| 316 | - // 横屏 | 321 | + } else if (this.contentDetailData.photoList.length === 4) { |
| 317 | GridCol({ | 322 | GridCol({ |
| 318 | - span: { xs: 12 } | 323 | + span: { xs: 4 } |
| 319 | }) { | 324 | }) { |
| 320 | - Stack() { | ||
| 321 | - Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)? | ||
| 322 | - this.contentDetailData.fullColumnImgUrls[0].url: | ||
| 323 | - this.contentDetailData.videoInfo[0].firstFrameImageUri) | ||
| 324 | - .width(DisplayUtils.getDeviceWidth()- 32) | ||
| 325 | - .height((DisplayUtils.getDeviceWidth()-32)* 9 / 16) | ||
| 326 | - .borderRadius($r('app.float.image_border_radius')) | ||
| 327 | - CardMediaInfo({ contentDTO: this.mJumpInfo }) | ||
| 328 | - } | ||
| 329 | - .align(Alignment.BottomEnd) | 325 | + Image(item.picPath) |
| 326 | + .aspectRatio(1) | ||
| 327 | + .borderRadius(this.caclImageRadius(index)) | ||
| 330 | } | 328 | } |
| 329 | + .onClick(async (event: ClickEvent) => { | ||
| 330 | + let retvalue = await FastClickUtil.isMinDelayTime() | ||
| 331 | + if(retvalue){ | ||
| 332 | + return | ||
| 333 | + } | ||
| 334 | + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index) | ||
| 335 | + }) | ||
| 331 | } else { | 336 | } else { |
| 332 | - // 竖图显示,宽度占50%,高度自适应 | ||
| 333 | GridCol({ | 337 | GridCol({ |
| 334 | - span: { xs: 6 } | 338 | + span: { sm: 4, lg: 3 } |
| 335 | }) { | 339 | }) { |
| 336 | - Stack() { | ||
| 337 | - Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)? | ||
| 338 | - this.contentDetailData.fullColumnImgUrls[0].url: | ||
| 339 | - this.contentDetailData.videoInfo[0].firstFrameImageUri) | ||
| 340 | - .width(DisplayUtils.getDeviceWidth()/2) | ||
| 341 | - .height(DisplayUtils.getDeviceWidth()/2* 4 / 3) | ||
| 342 | - .borderRadius($r('app.float.image_border_radius')) | ||
| 343 | - CardMediaInfo({ contentDTO: this.mJumpInfo }) | ||
| 344 | - } | ||
| 345 | - .align(Alignment.BottomEnd) | 340 | + Image(item.picPath) |
| 341 | + .aspectRatio(1) | ||
| 342 | + .borderRadius(this.caclImageRadius(index)) | ||
| 346 | } | 343 | } |
| 344 | + .onClick(async (event: ClickEvent) => { | ||
| 345 | + let retvalue = await FastClickUtil.isMinDelayTime() | ||
| 346 | + if(retvalue){ | ||
| 347 | + return | ||
| 348 | + } | ||
| 349 | + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index) | ||
| 350 | + }) | ||
| 347 | } | 351 | } |
| 348 | - } | ||
| 349 | - .padding({ left: this.contentDetailData.videoInfo[0].videoLandScape === 1?0: 25,top: $r('app.float.margin_8')}) | ||
| 350 | - .onClick((event: ClickEvent) => { | ||
| 351 | - ProcessUtils.processPage(this.mJumpInfo) | ||
| 352 | }) | 352 | }) |
| 353 | } | 353 | } |
| 354 | + .margin({ | ||
| 355 | + left: $r('app.float.margin_16'), | ||
| 356 | + right: $r('app.float.margin_16'), | ||
| 357 | + top: $r('app.float.margin_8') | ||
| 358 | + }) | ||
| 354 | } | 359 | } |
| 355 | - //特别声明 | ||
| 356 | - Text("特别声明:本文为人民日报新媒体平台“人民号”作者上传并发布,仅代表作者观点。人民日报仅提供信息发布平台。") | ||
| 357 | - .fontColor($r('app.color.color_CCCCCC')) | ||
| 358 | - .fontSize($r('app.float.font_size_12')) | ||
| 359 | - .lineHeight($r('app.float.margin_16')) | ||
| 360 | - .margin({ top: $r('app.float.margin_16') | ||
| 361 | - ,left: $r('app.float.vp_12') | ||
| 362 | - ,right: $r('app.float.vp_12') }) | ||
| 363 | - //微信/朋友圈/微博 | ||
| 364 | - // Row(){ | ||
| 365 | - // Image($r('app.media.xxhdpi_pic_wechat')) | ||
| 366 | - // .width($r('app.float.margin_116')) | ||
| 367 | - // .height($r('app.float.margin_36')) | ||
| 368 | - // .objectFit(ImageFit.Cover) | ||
| 369 | - // Image($r('app.media.xxhdpi_pic_pyq')) | ||
| 370 | - // .width($r('app.float.margin_116')) | ||
| 371 | - // .height($r('app.float.margin_36')) | ||
| 372 | - // .margin({ left: $r('app.float.margin_4_negative')}) | ||
| 373 | - // .objectFit(ImageFit.Cover) | ||
| 374 | - // Image($r('app.media.xxhdpi_pic_wb')) | ||
| 375 | - // .width($r('app.float.margin_116')) | ||
| 376 | - // .height($r('app.float.margin_36')) | ||
| 377 | - // .margin({ left: $r('app.float.margin_4_negative')}) | ||
| 378 | - // .objectFit(ImageFit.Cover) | ||
| 379 | - // } | ||
| 380 | - // .margin({ top: $r('app.float.margin_24')}) | ||
| 381 | - //点赞 | ||
| 382 | - Row(){ | ||
| 383 | - Blank().layoutWeight(1) | ||
| 384 | - Image(this.newsStatusOfUser?.likeStatus == '1'? | ||
| 385 | - $r('app.media.icon_like_selected_redheart') | ||
| 386 | - :$r('app.media.icon_like_unselect_grey_redheart')) | ||
| 387 | - .width($r('app.float.margin_36')) | ||
| 388 | - .height($r('app.float.margin_36')) | ||
| 389 | - .objectFit(ImageFit.Cover) | ||
| 390 | - .margin({ left: $r('app.float.margin_6_negative'),right: $r('app.float.margin_6_negative')}) | ||
| 391 | - if(this.interactDataDTO?.likeNum != 0){ | ||
| 392 | - Text(NumberFormatterUtils.formatNumberWithWan(this.interactDataDTO?.likeNum)) | ||
| 393 | - .fontColor($r('app.color.color_999999')) | ||
| 394 | - .fontSize($r('app.float.font_size_16')) | ||
| 395 | - .lineHeight($r('app.float.margin_20')) | ||
| 396 | - .margin({ left: $r('app.float.margin_2')}) | 360 | + } else { |
| 361 | + if (this.contentDetailData.videoInfo != null && this.contentDetailData.videoInfo.length > 0) { | ||
| 362 | + GridRow() { | ||
| 363 | + if (this.contentDetailData.videoInfo[0].videoLandScape === 1) { | ||
| 364 | + // 横屏 | ||
| 365 | + GridCol({ | ||
| 366 | + span: { xs: 12 } | ||
| 367 | + }) { | ||
| 368 | + Stack() { | ||
| 369 | + Image(this.contentDetailData.fullColumnImgUrls != null && | ||
| 370 | + this.contentDetailData.fullColumnImgUrls.length > 0 && | ||
| 371 | + !StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url) ? | ||
| 372 | + this.contentDetailData.fullColumnImgUrls[0].url : | ||
| 373 | + this.contentDetailData.videoInfo[0].firstFrameImageUri) | ||
| 374 | + .width(DisplayUtils.getDeviceWidth() - 32) | ||
| 375 | + .height((DisplayUtils.getDeviceWidth() - 32) * 9 / 16) | ||
| 376 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 377 | + CardMediaInfo({ contentDTO: this.mJumpInfo }) | ||
| 378 | + } | ||
| 379 | + .align(Alignment.BottomEnd) | ||
| 380 | + } | ||
| 381 | + } else { | ||
| 382 | + // 竖图显示,宽度占50%,高度自适应 | ||
| 383 | + GridCol({ | ||
| 384 | + span: { xs: 6 } | ||
| 385 | + }) { | ||
| 386 | + Stack() { | ||
| 387 | + Image(this.contentDetailData.fullColumnImgUrls != null && | ||
| 388 | + this.contentDetailData.fullColumnImgUrls.length > 0 && | ||
| 389 | + !StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url) ? | ||
| 390 | + this.contentDetailData.fullColumnImgUrls[0].url : | ||
| 391 | + this.contentDetailData.videoInfo[0].firstFrameImageUri) | ||
| 392 | + .width(DisplayUtils.getDeviceWidth() / 2) | ||
| 393 | + .height(DisplayUtils.getDeviceWidth() / 2 * 4 / 3) | ||
| 394 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 395 | + CardMediaInfo({ contentDTO: this.mJumpInfo }) | ||
| 396 | + } | ||
| 397 | + .align(Alignment.BottomEnd) | ||
| 398 | + } | ||
| 399 | + } | ||
| 397 | } | 400 | } |
| 398 | - Blank().layoutWeight(1) | 401 | + .padding({ |
| 402 | + left: this.contentDetailData.videoInfo[0].videoLandScape === 1 ? 0 : 25, | ||
| 403 | + top: $r('app.float.margin_8') | ||
| 404 | + }) | ||
| 405 | + .onClick(async (event: ClickEvent) => { | ||
| 406 | + let retvalue = await FastClickUtil.isMinDelayTime() | ||
| 407 | + if(retvalue){ | ||
| 408 | + return | ||
| 409 | + } | ||
| 410 | + ProcessUtils.processPage(this.mJumpInfo) | ||
| 411 | + }) | ||
| 399 | } | 412 | } |
| 400 | - .width($r('app.float.margin_154')) | ||
| 401 | - .height($r('app.float.margin_40')) | ||
| 402 | - .margin({top:$r('app.float.margin_16')}) | ||
| 403 | - .borderWidth($r('app.float.margin_1')) | ||
| 404 | - .borderColor($r('app.color.color_EDEDED')) | ||
| 405 | - .borderRadius($r('app.float.margin_20')) | ||
| 406 | - .onClick((event: ClickEvent) => { | ||
| 407 | - //点赞操作 | ||
| 408 | - this.toggleLikeStatus() | 413 | + } |
| 414 | + //特别声明 | ||
| 415 | + Text("特别声明:本文为人民日报新媒体平台“人民号”作者上传并发布,仅代表作者观点。人民日报仅提供信息发布平台。") | ||
| 416 | + .fontColor($r('app.color.color_CCCCCC')) | ||
| 417 | + .fontSize($r('app.float.font_size_12')) | ||
| 418 | + .lineHeight($r('app.float.margin_16')) | ||
| 419 | + .margin({ | ||
| 420 | + top: $r('app.float.margin_16') | ||
| 421 | + , left: $r('app.float.vp_12') | ||
| 422 | + , right: $r('app.float.vp_12') | ||
| 409 | }) | 423 | }) |
| 410 | - // 评论 | ||
| 411 | - if (this.contentDetailData?.openComment) { | ||
| 412 | - Divider().strokeWidth(6).color('#f5f5f5').margin({top:$r('app.float.margin_24')}) | ||
| 413 | - CommentComponent({ | ||
| 414 | - publishCommentModel: { | ||
| 415 | - targetId: String(this.contentDetailData?.newsId || ''), | ||
| 416 | - targetRelId: this.contentDetailData?.reLInfo?.relId, | ||
| 417 | - targetTitle: this.contentDetailData?.newsTitle, | ||
| 418 | - targetRelType: this.contentDetailData?.reLInfo?.relType, | ||
| 419 | - targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId), | ||
| 420 | - keyArticle: String(this.contentDetailData?.keyArticle), | ||
| 421 | - targetType: String(this.contentDetailData?.newsType), | ||
| 422 | - } as publishCommentModel | ||
| 423 | - }) | 424 | + //微信/朋友圈/微博 |
| 425 | + // Row(){ | ||
| 426 | + // Image($r('app.media.xxhdpi_pic_wechat')) | ||
| 427 | + // .width($r('app.float.margin_116')) | ||
| 428 | + // .height($r('app.float.margin_36')) | ||
| 429 | + // .objectFit(ImageFit.Cover) | ||
| 430 | + // Image($r('app.media.xxhdpi_pic_pyq')) | ||
| 431 | + // .width($r('app.float.margin_116')) | ||
| 432 | + // .height($r('app.float.margin_36')) | ||
| 433 | + // .margin({ left: $r('app.float.margin_4_negative')}) | ||
| 434 | + // .objectFit(ImageFit.Cover) | ||
| 435 | + // Image($r('app.media.xxhdpi_pic_wb')) | ||
| 436 | + // .width($r('app.float.margin_116')) | ||
| 437 | + // .height($r('app.float.margin_36')) | ||
| 438 | + // .margin({ left: $r('app.float.margin_4_negative')}) | ||
| 439 | + // .objectFit(ImageFit.Cover) | ||
| 440 | + // } | ||
| 441 | + // .margin({ top: $r('app.float.margin_24')}) | ||
| 442 | + //点赞 | ||
| 443 | + Row() { | ||
| 444 | + Blank().layoutWeight(1) | ||
| 445 | + Image(this.newsStatusOfUser?.likeStatus == '1' ? | ||
| 446 | + $r('app.media.icon_like_selected_redheart') | ||
| 447 | + : $r('app.media.icon_like_unselect_grey_redheart')) | ||
| 448 | + .width($r('app.float.margin_36')) | ||
| 449 | + .height($r('app.float.margin_36')) | ||
| 450 | + .objectFit(ImageFit.Cover) | ||
| 451 | + .margin({ left: $r('app.float.margin_6_negative'), right: $r('app.float.margin_6_negative') }) | ||
| 452 | + if (this.interactDataDTO?.likeNum != 0) { | ||
| 453 | + Text(NumberFormatterUtils.formatNumberWithWan(this.interactDataDTO?.likeNum)) | ||
| 454 | + .fontColor($r('app.color.color_999999')) | ||
| 455 | + .fontSize($r('app.float.font_size_16')) | ||
| 456 | + .lineHeight($r('app.float.margin_20')) | ||
| 457 | + .margin({ left: $r('app.float.margin_2') }) | ||
| 424 | } | 458 | } |
| 425 | Blank().layoutWeight(1) | 459 | Blank().layoutWeight(1) |
| 426 | } | 460 | } |
| 461 | + .width($r('app.float.margin_154')) | ||
| 462 | + .height($r('app.float.margin_40')) | ||
| 463 | + .margin({ top: $r('app.float.margin_16') }) | ||
| 464 | + .borderWidth($r('app.float.margin_1')) | ||
| 465 | + .borderColor($r('app.color.color_EDEDED')) | ||
| 466 | + .borderRadius($r('app.float.margin_20')) | ||
| 467 | + .onClick(async (event: ClickEvent) => { | ||
| 468 | + let retvalue = await FastClickUtil.isMinDelayTime() | ||
| 469 | + if(retvalue){ | ||
| 470 | + return | ||
| 471 | + } | ||
| 472 | + //点赞操作 | ||
| 473 | + this.toggleLikeStatus() | ||
| 474 | + }) | ||
| 475 | + | ||
| 476 | + // 评论 | ||
| 477 | + if (this.contentDetailData?.openComment) { | ||
| 478 | + Divider().strokeWidth(6).color('#f5f5f5').margin({ top: $r('app.float.margin_24') }) | ||
| 479 | + CommentComponent({ | ||
| 480 | + publishCommentModel: { | ||
| 481 | + targetId: String(this.contentDetailData?.newsId || ''), | ||
| 482 | + targetRelId: this.contentDetailData?.reLInfo?.relId, | ||
| 483 | + targetTitle: this.contentDetailData?.newsTitle, | ||
| 484 | + targetRelType: this.contentDetailData?.reLInfo?.relType, | ||
| 485 | + targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId), | ||
| 486 | + keyArticle: String(this.contentDetailData?.keyArticle), | ||
| 487 | + targetType: String(this.contentDetailData?.newsType), | ||
| 488 | + } as publishCommentModel | ||
| 489 | + }) | ||
| 490 | + } | ||
| 491 | + Blank().layoutWeight(1) | ||
| 427 | } | 492 | } |
| 428 | - .width(CommonConstants.FULL_WIDTH) | ||
| 429 | - .height(CommonConstants.FULL_HEIGHT) | ||
| 430 | - .padding({ bottom: 76 }) | ||
| 431 | - .scrollBar(BarState.Off) | ||
| 432 | - .alignSelf(ItemAlign.Start) | ||
| 433 | } | 493 | } |
| 494 | + .width(CommonConstants.FULL_WIDTH) | ||
| 495 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 496 | + .padding({ bottom: 76 }) | ||
| 497 | + .scrollBar(BarState.Off) | ||
| 498 | + .alignSelf(ItemAlign.Start) | ||
| 434 | } | 499 | } |
| 435 | - //底部交互区 | ||
| 436 | - OperRowListView({ | ||
| 437 | - contentDetailData: this.contentDetailData, | ||
| 438 | - publishCommentModel: this.publishCommentModel, | ||
| 439 | - operationButtonList: ['comment', 'collect', 'share'], | ||
| 440 | - styleType: 1, | ||
| 441 | - }) | ||
| 442 | - | ||
| 443 | } | 500 | } |
| 501 | + //底部交互区 | ||
| 502 | + OperRowListView({ | ||
| 503 | + contentDetailData: this.contentDetailData, | ||
| 504 | + publishCommentModel: this.publishCommentModel, | ||
| 505 | + operationButtonList: ['comment', 'collect', 'share'], | ||
| 506 | + styleType: 1, | ||
| 507 | + }) | ||
| 508 | + | ||
| 444 | } | 509 | } |
| 445 | - .alignSelf(ItemAlign.Start) | ||
| 446 | - .backgroundColor('#FFFFFFFF') | ||
| 447 | - .width('100%') | ||
| 448 | - .height('100%') | 510 | + } |
| 511 | + .alignSelf(ItemAlign.Start) | ||
| 512 | + .backgroundColor('#FFFFFFFF') | ||
| 513 | + .width('100%') | ||
| 514 | + .height('100%') | ||
| 449 | } | 515 | } |
| 516 | + | ||
| 450 | /** | 517 | /** |
| 451 | * 请求(动态)详情页数据 | 518 | * 请求(动态)详情页数据 |
| 452 | * */ | 519 | * */ |
| 453 | private async getContentDetailData() { | 520 | private async getContentDetailData() { |
| 454 | this.isNetConnected = NetworkUtil.isNetConnected() | 521 | this.isNetConnected = NetworkUtil.isNetConnected() |
| 522 | + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | ||
| 523 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | ||
| 524 | + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | ||
| 525 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 526 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 527 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 528 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 455 | try { | 529 | try { |
| 456 | let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) | 530 | let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) |
| 457 | this.isPageEnd = true; | 531 | this.isPageEnd = true; |
| @@ -460,9 +534,9 @@ export struct DynamicDetailComponent { | @@ -460,9 +534,9 @@ export struct DynamicDetailComponent { | ||
| 460 | DateTimeUtils.parseDate(this.contentDetailData?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN); | 534 | DateTimeUtils.parseDate(this.contentDetailData?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN); |
| 461 | let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN) | 535 | let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN) |
| 462 | this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime) | 536 | this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime) |
| 463 | - console.log('动态详情',JSON.stringify(this.contentDetailData)) | 537 | + console.log('动态详情', JSON.stringify(this.contentDetailData)) |
| 464 | } catch (exception) { | 538 | } catch (exception) { |
| 465 | - console.log('请求失败',JSON.stringify(exception)) | 539 | + console.log('请求失败', JSON.stringify(exception)) |
| 466 | this.isPageEnd = true; | 540 | this.isPageEnd = true; |
| 467 | } | 541 | } |
| 468 | this.getBatchAttentionStatus() | 542 | this.getBatchAttentionStatus() |
| @@ -471,10 +545,11 @@ export struct DynamicDetailComponent { | @@ -471,10 +545,11 @@ export struct DynamicDetailComponent { | ||
| 471 | this.interactDataV2() | 545 | this.interactDataV2() |
| 472 | } | 546 | } |
| 473 | 547 | ||
| 474 | - | ||
| 475 | private async interactDataV2() { | 548 | private async interactDataV2() { |
| 476 | this.interactDataDTO = await MultiPictureDetailViewModel.interactDataV2( | 549 | this.interactDataDTO = await MultiPictureDetailViewModel.interactDataV2( |
| 477 | - this.contentDetailData?.newsId+'',this.contentDetailData?.newsType+'',this.contentDetailData.reLInfo == null ?'':this.contentDetailData.reLInfo?.relId,this.contentDetailData.rmhPlatform) | 550 | + this.contentDetailData?.newsId + '', this.contentDetailData?.newsType + '', |
| 551 | + this.contentDetailData.reLInfo == null ? '' : this.contentDetailData.reLInfo?.relId, | ||
| 552 | + this.contentDetailData.rmhPlatform) | ||
| 478 | } | 553 | } |
| 479 | 554 | ||
| 480 | // 已登录->查询用户对作品点赞、收藏状态 | 555 | // 已登录->查询用户对作品点赞、收藏状态 |
| @@ -514,30 +589,31 @@ export struct DynamicDetailComponent { | @@ -514,30 +589,31 @@ export struct DynamicDetailComponent { | ||
| 514 | return | 589 | return |
| 515 | } | 590 | } |
| 516 | try { | 591 | try { |
| 517 | - const params: postBatchAttentionStatusParams = { | ||
| 518 | - creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }] | ||
| 519 | - } | ||
| 520 | - let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params) | ||
| 521 | - this.followStatus = data[0]?.status; | ||
| 522 | - Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`) | ||
| 523 | - } catch (exception) { | ||
| 524 | - this.followStatus = '0'; | 592 | + const params: postBatchAttentionStatusParams = { |
| 593 | + creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }] | ||
| 525 | } | 594 | } |
| 595 | + let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params) | ||
| 596 | + this.followStatus = data[0]?.status; | ||
| 597 | + Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`) | ||
| 598 | + } catch (exception) { | ||
| 599 | + this.followStatus = '0'; | ||
| 600 | + } | ||
| 526 | } | 601 | } |
| 527 | 602 | ||
| 528 | //创建跳转信息 | 603 | //创建跳转信息 |
| 529 | - makeJumpInfo(){ | 604 | + makeJumpInfo() { |
| 530 | this.mJumpInfo.pageId = 'dynamicDetailPage' | 605 | this.mJumpInfo.pageId = 'dynamicDetailPage' |
| 531 | - this.mJumpInfo.objectId = this.contentDetailData.newsId+"" | ||
| 532 | - this.mJumpInfo.relType = this.contentDetailData.reLInfo?.relType+"" | ||
| 533 | - this.mJumpInfo.relId = this.contentDetailData.reLInfo?.relId+"" | ||
| 534 | - this.mJumpInfo.objectType = (this.contentDetailData.newsType+"") == ContentConstants.TYPE_FOURTEEN?this.contentDetailData.newsType+"":ContentConstants.TYPE_VOD | ||
| 535 | - if(this.contentDetailData.videoInfo!= null && this.contentDetailData.videoInfo.length>0){ | 606 | + this.mJumpInfo.objectId = this.contentDetailData.newsId + "" |
| 607 | + this.mJumpInfo.relType = this.contentDetailData.reLInfo?.relType + "" | ||
| 608 | + this.mJumpInfo.relId = this.contentDetailData.reLInfo?.relId + "" | ||
| 609 | + this.mJumpInfo.objectType = | ||
| 610 | + (this.contentDetailData.newsType + "") == ContentConstants.TYPE_FOURTEEN ? this.contentDetailData.newsType + "" : | ||
| 611 | + ContentConstants.TYPE_VOD | ||
| 612 | + if (this.contentDetailData.videoInfo != null && this.contentDetailData.videoInfo.length > 0) { | ||
| 536 | this.mJumpInfo.videoInfo = this.contentDetailData.videoInfo[0] | 613 | this.mJumpInfo.videoInfo = this.contentDetailData.videoInfo[0] |
| 537 | } | 614 | } |
| 538 | } | 615 | } |
| 539 | 616 | ||
| 540 | - | ||
| 541 | caclImageRadius(index: number) { | 617 | caclImageRadius(index: number) { |
| 542 | let radius: radiusType = { | 618 | let radius: radiusType = { |
| 543 | topLeft: index === 0 ? $r('app.float.image_border_radius') : 0, | 619 | topLeft: index === 0 ? $r('app.float.image_border_radius') : 0, |
| @@ -561,11 +637,11 @@ export struct DynamicDetailComponent { | @@ -561,11 +637,11 @@ export struct DynamicDetailComponent { | ||
| 561 | return radius | 637 | return radius |
| 562 | } | 638 | } |
| 563 | 639 | ||
| 564 | - getPicType(item: PhotoListBean){ | 640 | + getPicType(item: PhotoListBean) { |
| 565 | if (item.width && item.width) { | 641 | if (item.width && item.width) { |
| 566 | - if (item.width / item.height > 343/172) { | 642 | + if (item.width / item.height > 343 / 172) { |
| 567 | return 1; //横长图 | 643 | return 1; //横长图 |
| 568 | - } else if (item.height / item.width > 305/228) { | 644 | + } else if (item.height / item.width > 305 / 228) { |
| 569 | return 2; //竖长图 | 645 | return 2; //竖长图 |
| 570 | } else { | 646 | } else { |
| 571 | return 3 | 647 | return 3 |
| @@ -590,7 +666,7 @@ export struct DynamicDetailComponent { | @@ -590,7 +666,7 @@ export struct DynamicDetailComponent { | ||
| 590 | attentionUserType: this.contentDetailData?.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号) | 666 | attentionUserType: this.contentDetailData?.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号) |
| 591 | attentionUserId: this.contentDetailData?.rmhInfo?.userId || '', // 被关注用户号主id | 667 | attentionUserId: this.contentDetailData?.rmhInfo?.userId || '', // 被关注用户号主id |
| 592 | attentionCreatorId: this.contentDetailData?.rmhInfo?.rmhId || '', // 被关注用户号主id | 668 | attentionCreatorId: this.contentDetailData?.rmhInfo?.rmhId || '', // 被关注用户号主id |
| 593 | - status: this.followStatus == '0'? 1:0, | 669 | + status: this.followStatus == '0' ? 1 : 0, |
| 594 | } | 670 | } |
| 595 | ContentDetailRequest.postInteractAccentionOperate(params2).then(res => { | 671 | ContentDetailRequest.postInteractAccentionOperate(params2).then(res => { |
| 596 | console.log('关注号主==', JSON.stringify(res.data)) | 672 | console.log('关注号主==', JSON.stringify(res.data)) |
| @@ -634,4 +710,4 @@ interface radiusType { | @@ -634,4 +710,4 @@ interface radiusType { | ||
| 634 | topRight: number | Resource; | 710 | topRight: number | Resource; |
| 635 | bottomLeft: number | Resource; | 711 | bottomLeft: number | Resource; |
| 636 | bottomRight: number | Resource; | 712 | bottomRight: number | Resource; |
| 637 | -} | ||
| 713 | +} |
| @@ -9,7 +9,7 @@ import font from '@ohos.font'; | @@ -9,7 +9,7 @@ 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 | import { newsSkeleton } from './skeleton/newsSkeleton'; |
| 12 | -import { Logger, ToastUtils } from 'wdKit/Index'; | 12 | +import { Logger, ToastUtils, NetworkUtil } from 'wdKit/Index'; |
| 13 | 13 | ||
| 14 | @Component | 14 | @Component |
| 15 | export struct ENewspaperPageComponent { | 15 | export struct ENewspaperPageComponent { |
| @@ -82,6 +82,12 @@ export struct ENewspaperPageComponent { | @@ -82,6 +82,12 @@ export struct ENewspaperPageComponent { | ||
| 82 | this.screenWidth = this.displayTool.width | 82 | this.screenWidth = this.displayTool.width |
| 83 | this.picWidth = this.screenWidth - vp2px(52) | 83 | this.picWidth = this.screenWidth - vp2px(52) |
| 84 | this.picHeight = this.picWidth * 566 / 378 | 84 | this.picHeight = this.picWidth * 566 / 378 |
| 85 | + // 默认日期 | ||
| 86 | + const date = new Date() | ||
| 87 | + const month = date.getMonth() + 1 | ||
| 88 | + const day = date.getDate() | ||
| 89 | + this.calendarDate = | ||
| 90 | + `${date.getFullYear()}-${month > 9 ? month : '0' + month}-${day > 9 ? day : '0' + day}` | ||
| 85 | //注册字体 | 91 | //注册字体 |
| 86 | font.registerFont({ | 92 | font.registerFont({ |
| 87 | familyName: 'BebasNeueBold', | 93 | familyName: 'BebasNeueBold', |
| @@ -135,25 +141,26 @@ export struct ENewspaperPageComponent { | @@ -135,25 +141,26 @@ export struct ENewspaperPageComponent { | ||
| 135 | }) | 141 | }) |
| 136 | .id('e_newspaper_date') | 142 | .id('e_newspaper_date') |
| 137 | .onClick(() => { | 143 | .onClick(() => { |
| 138 | - this.calendarDialogShow = !this.calendarDialogShow | ||
| 139 | - if (this.calendarDialogShow) { | ||
| 140 | - this.calendarDialogController.open() | ||
| 141 | - } else { | ||
| 142 | - this.calendarDialogController.close() | ||
| 143 | - } | ||
| 144 | - }) | ||
| 145 | - | ||
| 146 | - Image($r('app.media.icon_share')) | ||
| 147 | - .height($r('app.float.top_arrow_size')) | ||
| 148 | - .width($r('app.float.top_arrow_size')) | ||
| 149 | - .alignRules({ | ||
| 150 | - right: { anchor: "__container__", align: HorizontalAlign.End }, | ||
| 151 | - center: { anchor: "__container__", align: VerticalAlign.Center } | ||
| 152 | - }) | ||
| 153 | - .id('e_newspaper_share') | ||
| 154 | - .onClick(() => { | ||
| 155 | - ToastUtils.showToast('分享为公共方法,待开发', 1000); | 144 | + this.calendarDialogShow = !this.calendarDialogShow |
| 145 | + if (this.calendarDialogShow) { | ||
| 146 | + this.calendarDialogController.open() | ||
| 147 | + } else { | ||
| 148 | + this.calendarDialogController.close() | ||
| 149 | + } | ||
| 156 | }) | 150 | }) |
| 151 | + if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { | ||
| 152 | + Image($r('app.media.icon_share')) | ||
| 153 | + .height($r('app.float.top_arrow_size')) | ||
| 154 | + .width($r('app.float.top_arrow_size')) | ||
| 155 | + .alignRules({ | ||
| 156 | + right: { anchor: "__container__", align: HorizontalAlign.End }, | ||
| 157 | + center: { anchor: "__container__", align: VerticalAlign.Center } | ||
| 158 | + }) | ||
| 159 | + .id('e_newspaper_share') | ||
| 160 | + .onClick(() => { | ||
| 161 | + ToastUtils.showToast('分享为公共方法,待开发', 1000); | ||
| 162 | + }) | ||
| 163 | + } | ||
| 157 | } | 164 | } |
| 158 | .margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) | 165 | .margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) |
| 159 | .height($r('app.float.top_bar_height')) | 166 | .height($r('app.float.top_bar_height')) |
| @@ -260,11 +267,15 @@ export struct ENewspaperPageComponent { | @@ -260,11 +267,15 @@ export struct ENewspaperPageComponent { | ||
| 260 | }) | 267 | }) |
| 261 | .id('e_newspaper_page_num') | 268 | .id('e_newspaper_page_num') |
| 262 | .onClick((event: ClickEvent) => { | 269 | .onClick((event: ClickEvent) => { |
| 263 | - this.pageDialogShow = !this.pageDialogShow | ||
| 264 | - if (this.pageDialogShow) { | ||
| 265 | - this.pageDialogController.open() | ||
| 266 | - } else { | ||
| 267 | - this.pageDialogController.close() | 270 | + if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { |
| 271 | + this.pageDialogShow = !this.pageDialogShow | ||
| 272 | + if (this.pageDialogShow) { | ||
| 273 | + this.pageDialogController.open() | ||
| 274 | + } else { | ||
| 275 | + this.pageDialogController.close() | ||
| 276 | + } | ||
| 277 | + }else { | ||
| 278 | + ToastUtils.showToast('暂无数据', 1000) | ||
| 268 | } | 279 | } |
| 269 | }) | 280 | }) |
| 270 | 281 | ||
| @@ -291,12 +302,17 @@ export struct ENewspaperPageComponent { | @@ -291,12 +302,17 @@ export struct ENewspaperPageComponent { | ||
| 291 | }) | 302 | }) |
| 292 | .id('e_newspaper_read') | 303 | .id('e_newspaper_read') |
| 293 | .onClick((event: ClickEvent) => { | 304 | .onClick((event: ClickEvent) => { |
| 294 | - this.isOpenListDialog = true | 305 | + if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { |
| 306 | + this.isOpenListDialog = true | ||
| 307 | + }else { | ||
| 308 | + ToastUtils.showToast('暂无数据', 1000) | ||
| 309 | + } | ||
| 295 | }) | 310 | }) |
| 296 | } | 311 | } |
| 297 | .width('100%') | 312 | .width('100%') |
| 298 | .height('100%') | 313 | .height('100%') |
| 299 | .backgroundColor($r('app.color.color_80000000')) | 314 | .backgroundColor($r('app.color.color_80000000')) |
| 315 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 300 | .id('e_newspaper_container') | 316 | .id('e_newspaper_container') |
| 301 | 317 | ||
| 302 | if (this.isOpenListDialog) { | 318 | if (this.isOpenListDialog) { |
| @@ -322,8 +338,12 @@ export struct ENewspaperPageComponent { | @@ -322,8 +338,12 @@ export struct ENewspaperPageComponent { | ||
| 322 | 338 | ||
| 323 | private async getNewspaperList() { | 339 | private async getNewspaperList() { |
| 324 | try { | 340 | try { |
| 325 | - let listBean = await NewspaperViewModel.getNewspaperList(this.calendarDate, this.picWidth + 'x' + this.picHeight) | ||
| 326 | - this.newspaperListBean = listBean; | 341 | + if (NetworkUtil.isNetConnected()) { |
| 342 | + let listBean = await NewspaperViewModel.getNewspaperList(this.calendarDate, this.picWidth + 'x' + this.picHeight) | ||
| 343 | + this.newspaperListBean = listBean; | ||
| 344 | + } else { | ||
| 345 | + ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | ||
| 346 | + } | ||
| 327 | } catch (exception) { | 347 | } catch (exception) { |
| 328 | 348 | ||
| 329 | } | 349 | } |
| 1 | +import { FeedbackTypeBean } from 'wdBean/Index'; | ||
| 2 | +import { NetworkUtil } from 'wdKit/Index'; | ||
| 3 | +import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | ||
| 4 | +import { CustomTitleUI } from './reusable/CustomTitleUI' | ||
| 5 | +import { ArrayList } from '@kit.ArkTS'; | ||
| 6 | + | ||
| 7 | +const TAG = 'FeedBackActivity' | ||
| 8 | +// 意见反馈页面 | ||
| 9 | +@Entry | ||
| 10 | +@Component | ||
| 11 | +export struct FeedBackActivity { | ||
| 12 | + //UI | ||
| 13 | + scroller: Scroller = new Scroller(); | ||
| 14 | + | ||
| 15 | + @State isNetConnected: boolean = true | ||
| 16 | + | ||
| 17 | + @State feedbackTypeBeans: FeedbackTypeBean[] = [] as FeedbackTypeBean[] | ||
| 18 | + | ||
| 19 | + async aboutToAppear() { | ||
| 20 | + await this.getContentDetailData() | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + build() { | ||
| 24 | + Column() { | ||
| 25 | + //标题栏目 | ||
| 26 | + CustomTitleUI({ titleName: "意见反馈" }) | ||
| 27 | + Stack({ alignContent: Alignment.Bottom }) { | ||
| 28 | + Scroll(this.scroller) { | ||
| 29 | + Column() { | ||
| 30 | + Text('请选择问题类型') | ||
| 31 | + .fontColor($r('app.color.color_222222')) | ||
| 32 | + .fontSize($r('app.float.font_size_16')) | ||
| 33 | + .fontWeight(FontWeight.Bold) | ||
| 34 | + .margin({ left: $r('app.float.vp_15'), top: $r('app.float.vp_14') }) | ||
| 35 | + GridRow({ | ||
| 36 | + gutter: { x: 2, y: 2 } | ||
| 37 | + }) { | ||
| 38 | + ForEach(this.feedbackTypeBeans, (item: FeedbackTypeBean, index: number) => { | ||
| 39 | + GridCol({ | ||
| 40 | + span: 12 | ||
| 41 | + }) { | ||
| 42 | + Row(){ | ||
| 43 | + Toggle({ type: ToggleType.Checkbox, isOn: false }) | ||
| 44 | + Text(item.classifyName) | ||
| 45 | + .fontColor($r('app.color.color_222222')) | ||
| 46 | + .fontSize($r('app.float.font_size_14')) | ||
| 47 | + .fontWeight(FontWeight.Bold) | ||
| 48 | + .margin({ left: $r('app.float.vp_4') }) | ||
| 49 | + } | ||
| 50 | + .width(115) | ||
| 51 | + .height(22) | ||
| 52 | + .backgroundColor($r('app.color.color_fff')) | ||
| 53 | + } | ||
| 54 | + }) | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + Blank() | ||
| 58 | + .height(0.5) | ||
| 59 | + .margin({ left: $r('app.float.vp_16'), top: $r('app.float.vp_12'), right: $r('app.float.vp_16') }) | ||
| 60 | + .backgroundColor($r('app.color.color_EDEDED')) | ||
| 61 | + Text('描述您的问题') | ||
| 62 | + .fontColor($r('app.color.color_222222')) | ||
| 63 | + .fontSize($r('app.float.font_size_16')) | ||
| 64 | + .fontWeight(FontWeight.Bold) | ||
| 65 | + .margin({ left: $r('app.float.vp_16'), top: $r('app.float.vp_12') }) | ||
| 66 | + Stack() { | ||
| 67 | + TextInput({ placeholder: '您的宝贵意见是我们前行的动力' }) | ||
| 68 | + GridRow({ | ||
| 69 | + gutter: { x: 2, y: 2 } | ||
| 70 | + }) { | ||
| 71 | + ForEach(this.feedbackTypeBeans, (item: FeedbackTypeBean, index: number) => { | ||
| 72 | + GridCol({ | ||
| 73 | + span: 12 | ||
| 74 | + }) { | ||
| 75 | + } | ||
| 76 | + }) | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + Text('0/500') | ||
| 80 | + } | ||
| 81 | + .height(200) | ||
| 82 | + .width('100%') | ||
| 83 | + .margin({ left: $r('app.float.vp_16'), top: $r('app.float.vp_12'), right: $r('app.float.vp_16') }) | ||
| 84 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 85 | + .borderRadius(4) | ||
| 86 | + | ||
| 87 | + Text('期待您留下联系方式,我们将提供更好的服务') | ||
| 88 | + .fontColor($r('app.color.color_222222')) | ||
| 89 | + .fontSize($r('app.float.font_size_14')) | ||
| 90 | + .fontWeight(FontWeight.Bold) | ||
| 91 | + .margin({ left: $r('app.float.vp_16'), top: $r('app.float.margin_24') }) | ||
| 92 | + Row() { | ||
| 93 | + Text('电话或者邮箱') | ||
| 94 | + .fontColor($r('app.color.color_222222')) | ||
| 95 | + .fontSize($r('app.float.font_size_14')) | ||
| 96 | + .fontWeight(FontWeight.Bold) | ||
| 97 | + .margin({ left: $r('app.float.vp_12') }) | ||
| 98 | + TextInput({ placeholder: '请输入电话或者邮箱' }) | ||
| 99 | + } | ||
| 100 | + .height(44) | ||
| 101 | + .margin({ left: $r('app.float.vp_16'), right: $r('app.float.vp_12'), top: $r('app.float.margin_16') }) | ||
| 102 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 103 | + .borderRadius(4) | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + Text($r('app.string.submit')) | ||
| 108 | + .height(44) | ||
| 109 | + .fontColor($r('app.color.color_9E9E9E_40')) | ||
| 110 | + .fontSize($r('app.float.font_size_18')) | ||
| 111 | + .margin({ left: $r('app.float.vp_16'), right: $r('app.float.vp_16'), top: $r('app.float.vp_15') }) | ||
| 112 | + .backgroundColor($r('app.color.color_ED2800_99')) | ||
| 113 | + .borderRadius(4) | ||
| 114 | + } | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + /** | ||
| 118 | + * 请求接口数据 | ||
| 119 | + * */ | ||
| 120 | + private async getContentDetailData() { | ||
| 121 | + this.isNetConnected = NetworkUtil.isNetConnected() | ||
| 122 | + try { | ||
| 123 | + this.feedbackTypeBeans = await MultiPictureDetailViewModel.getFeedbackTypeList() | ||
| 124 | + | ||
| 125 | + } catch (exception) { | ||
| 126 | + console.log('请求失败',JSON.stringify(exception)) | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | +} |
| @@ -40,7 +40,7 @@ const TAG: string = 'ImageAndTextPageComponent' | @@ -40,7 +40,7 @@ const TAG: string = 'ImageAndTextPageComponent' | ||
| 40 | export struct ImageAndTextPageComponent { | 40 | export struct ImageAndTextPageComponent { |
| 41 | scroller: Scroller = new Scroller(); | 41 | scroller: Scroller = new Scroller(); |
| 42 | action: Action = {} as Action | 42 | action: Action = {} as Action |
| 43 | - @State contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO [] | 43 | + @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 44 | @State recommendList: ContentDTO[] = [] | 44 | @State recommendList: ContentDTO[] = [] |
| 45 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | 45 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 |
| 46 | @State interactData: InteractDataDTO = {} as InteractDataDTO | 46 | @State interactData: InteractDataDTO = {} as InteractDataDTO |
| @@ -52,57 +52,35 @@ export struct ImageAndTextPageComponent { | @@ -52,57 +52,35 @@ export struct ImageAndTextPageComponent { | ||
| 52 | @State isNetConnected: boolean = true | 52 | @State isNetConnected: boolean = true |
| 53 | @State info: Area | null = null | 53 | @State info: Area | null = null |
| 54 | @State likeNum: number = 0 | 54 | @State likeNum: number = 0 |
| 55 | - build() { | ||
| 56 | - Column() { | ||
| 57 | - // 发布时间 | ||
| 58 | - Row() { | ||
| 59 | - Image(this.contentDetailData[0]?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb')) | ||
| 60 | - .width(80) | ||
| 61 | - .height(28) | ||
| 62 | - Text(this.publishTime) | ||
| 63 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 64 | - .fontSize(13) | ||
| 65 | - } | ||
| 66 | - .width(CommonConstants.FULL_WIDTH) | ||
| 67 | - .height(32) | ||
| 68 | - .padding({ left: 15, right: 15, }) | ||
| 69 | - .justifyContent(FlexAlign.SpaceBetween) | ||
| 70 | - .alignItems(VerticalAlign.Bottom) | ||
| 71 | - | ||
| 72 | - Row() { | ||
| 73 | - Image($r('app.media.line')) | ||
| 74 | - .width('100%') | ||
| 75 | - .height(6) | ||
| 76 | - .objectFit(ImageFit.Cover) | ||
| 77 | - .margin({ top: 10 }) | ||
| 78 | - } | ||
| 79 | - .padding({ left: 15, right: 15 }) | ||
| 80 | - .backgroundColor(Color.White) | 55 | + @State reachEndIncreament: number = 0 |
| 56 | + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | ||
| 81 | 57 | ||
| 58 | + build() { | ||
| 59 | + Stack({ alignContent: Alignment.Top }) { | ||
| 82 | Stack({ alignContent: Alignment.Bottom }) { | 60 | Stack({ alignContent: Alignment.Bottom }) { |
| 83 | Scroll(this.scroller) { | 61 | Scroll(this.scroller) { |
| 84 | Column() { | 62 | Column() { |
| 85 | ImageAndTextWebComponent({ | 63 | ImageAndTextWebComponent({ |
| 86 | - contentDetailData: this.contentDetailData, | 64 | + contentDetailData: [this.contentDetailData], |
| 87 | action: this.action, | 65 | action: this.action, |
| 88 | isPageEnd: $isPageEnd | 66 | isPageEnd: $isPageEnd |
| 89 | }) | 67 | }) |
| 90 | - .padding({bottom:10}) | 68 | + .padding({ top: 15, bottom: 10 }) |
| 91 | Column() { | 69 | Column() { |
| 92 | // 点赞 | 70 | // 点赞 |
| 93 | - if (this.contentDetailData[0]?.openLikes && this.contentDetailData[0]?.likesStyle !== 4) { | 71 | + if (this.contentDetailData?.openLikes && this.contentDetailData?.likesStyle !== 4) { |
| 94 | Row() { | 72 | Row() { |
| 95 | Row() { | 73 | Row() { |
| 96 | if (this.newsStatusOfUser?.likeStatus === '1') { | 74 | if (this.newsStatusOfUser?.likeStatus === '1') { |
| 97 | - Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') : | ||
| 98 | - (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : | 75 | + Image(this.contentDetailData?.likesStyle === 1 ? $r('app.media.ic_like_check') : |
| 76 | + (this.contentDetailData?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : | ||
| 99 | $r('app.media.icon_candle_active'))) | 77 | $r('app.media.icon_candle_active'))) |
| 100 | .width(24) | 78 | .width(24) |
| 101 | .height(24) | 79 | .height(24) |
| 102 | .margin({ right: 5 }) | 80 | .margin({ right: 5 }) |
| 103 | } else { | 81 | } else { |
| 104 | - Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') : | ||
| 105 | - (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : | 82 | + Image(this.contentDetailData?.likesStyle === 1 ? $r('app.media.icon_like') : |
| 83 | + (this.contentDetailData?.likesStyle === 2 ? $r('app.media.icon_prayer') : | ||
| 106 | $r('app.media.icon_candle'))) | 84 | $r('app.media.icon_candle'))) |
| 107 | .width(24) | 85 | .width(24) |
| 108 | .height(24) | 86 | .height(24) |
| @@ -129,7 +107,7 @@ export struct ImageAndTextPageComponent { | @@ -129,7 +107,7 @@ export struct ImageAndTextPageComponent { | ||
| 129 | }) | 107 | }) |
| 130 | 108 | ||
| 131 | }.width(CommonConstants.FULL_WIDTH) | 109 | }.width(CommonConstants.FULL_WIDTH) |
| 132 | - .padding({top:14,bottom:24}) | 110 | + .padding({ top: 14, bottom: 24 }) |
| 133 | .justifyContent(FlexAlign.Center) | 111 | .justifyContent(FlexAlign.Center) |
| 134 | } | 112 | } |
| 135 | if (this.recommendList.length > 0) { | 113 | if (this.recommendList.length > 0) { |
| @@ -137,10 +115,15 @@ export struct ImageAndTextPageComponent { | @@ -137,10 +115,15 @@ export struct ImageAndTextPageComponent { | ||
| 137 | RecommendList({ recommendList: this.recommendList }) | 115 | RecommendList({ recommendList: this.recommendList }) |
| 138 | } | 116 | } |
| 139 | // 评论 | 117 | // 评论 |
| 140 | - if (this.contentDetailData[0]?.openComment) { | 118 | + if (this.contentDetailData?.openComment) { |
| 141 | Divider().strokeWidth(6).color('#f5f5f5') | 119 | Divider().strokeWidth(6).color('#f5f5f5') |
| 142 | CommentComponent({ | 120 | CommentComponent({ |
| 143 | - publishCommentModel: this.publishCommentModel | 121 | + publishCommentModel: this.publishCommentModel, |
| 122 | + fixedHeightMode: false, | ||
| 123 | + reachEndIncreament: this.reachEndIncreament, | ||
| 124 | + reachEndLoadMoreFinish: () => { | ||
| 125 | + | ||
| 126 | + } | ||
| 144 | }).onAreaChange((oldValue: Area, newValue: Area) => { | 127 | }).onAreaChange((oldValue: Area, newValue: Area) => { |
| 145 | this.info = newValue | 128 | this.info = newValue |
| 146 | }) | 129 | }) |
| @@ -149,13 +132,14 @@ export struct ImageAndTextPageComponent { | @@ -149,13 +132,14 @@ export struct ImageAndTextPageComponent { | ||
| 149 | } | 132 | } |
| 150 | } | 133 | } |
| 151 | } | 134 | } |
| 152 | - | ||
| 153 | } | 135 | } |
| 154 | .width(CommonConstants.FULL_WIDTH) | 136 | .width(CommonConstants.FULL_WIDTH) |
| 155 | - // .height(CommonConstants.FULL_HEIGHT) | ||
| 156 | - .padding({ bottom: 76 }) | 137 | + .height(CommonConstants.FULL_HEIGHT) |
| 157 | .scrollBar(BarState.Off) | 138 | .scrollBar(BarState.Off) |
| 158 | .align(Alignment.Top) | 139 | .align(Alignment.Top) |
| 140 | + .onReachEnd(() => { | ||
| 141 | + this.reachEndIncreament += 1 | ||
| 142 | + }) | ||
| 159 | 143 | ||
| 160 | if (!this.isNetConnected) { | 144 | if (!this.isNetConnected) { |
| 161 | EmptyComponent({ | 145 | EmptyComponent({ |
| @@ -167,24 +151,52 @@ export struct ImageAndTextPageComponent { | @@ -167,24 +151,52 @@ export struct ImageAndTextPageComponent { | ||
| 167 | }).padding({ bottom: 200 }) | 151 | }).padding({ bottom: 200 }) |
| 168 | } else { | 152 | } else { |
| 169 | if (!this.isPageEnd) { | 153 | if (!this.isPageEnd) { |
| 170 | - detailedSkeleton() | 154 | + detailedSkeleton().padding({ bottom: this.bottomSafeHeight }) |
| 171 | } | 155 | } |
| 172 | } | 156 | } |
| 173 | - //底部交互区 | ||
| 174 | - if (this.operationButtonList.length) { | ||
| 175 | - OperRowListView({ | ||
| 176 | - contentDetailData: this.contentDetailData[0], | ||
| 177 | - publishCommentModel: this.publishCommentModel, | ||
| 178 | - operationButtonList: this.operationButtonList, | ||
| 179 | - styleType: 1, | ||
| 180 | - }) | ||
| 181 | - } | 157 | + // 底部交互区 |
| 158 | + OperRowListView({ | ||
| 159 | + contentDetailData: this.contentDetailData, | ||
| 160 | + publishCommentModel: this.publishCommentModel, | ||
| 161 | + operationButtonList: this.operationButtonList, | ||
| 162 | + styleType: 1, | ||
| 163 | + }) | ||
| 182 | } | 164 | } |
| 165 | + .width(CommonConstants.FULL_WIDTH) | ||
| 166 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 167 | + .padding({ top: 38 }) | ||
| 168 | + | ||
| 169 | + // 发布时间 | ||
| 170 | + Column() { | ||
| 171 | + Row() { | ||
| 172 | + Image(this.contentDetailData?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb')) | ||
| 173 | + .width(80) | ||
| 174 | + .height(28) | ||
| 175 | + Text(this.publishTime) | ||
| 176 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 177 | + .fontSize(13) | ||
| 178 | + } | ||
| 179 | + .width(CommonConstants.FULL_WIDTH) | ||
| 180 | + .height(32) | ||
| 181 | + .padding({ left: 15, right: 15, }) | ||
| 182 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 183 | + .alignItems(VerticalAlign.Bottom) | ||
| 183 | 184 | ||
| 185 | + Row() { | ||
| 186 | + Image($r('app.media.line')) | ||
| 187 | + .width('100%') | ||
| 188 | + .height(6) | ||
| 189 | + .objectFit(ImageFit.Cover) | ||
| 190 | + .margin({ top: 10 }) | ||
| 191 | + } | ||
| 192 | + .padding({ left: 15, right: 15 }) | ||
| 193 | + .backgroundColor(Color.White) | ||
| 194 | + }.backgroundColor(Color.White) | ||
| 184 | } | 195 | } |
| 185 | .width(CommonConstants.FULL_WIDTH) | 196 | .width(CommonConstants.FULL_WIDTH) |
| 186 | .height(CommonConstants.FULL_HEIGHT) | 197 | .height(CommonConstants.FULL_HEIGHT) |
| 187 | .backgroundColor(Color.White) | 198 | .backgroundColor(Color.White) |
| 199 | + | ||
| 188 | } | 200 | } |
| 189 | 201 | ||
| 190 | private async getDetail() { | 202 | private async getDetail() { |
| @@ -207,29 +219,30 @@ export struct ImageAndTextPageComponent { | @@ -207,29 +219,30 @@ export struct ImageAndTextPageComponent { | ||
| 207 | } | 219 | } |
| 208 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) | 220 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) |
| 209 | if (detailBeans && detailBeans.length > 0) { | 221 | if (detailBeans && detailBeans.length > 0) { |
| 210 | - this.contentDetailData = detailBeans; | 222 | + this.contentDetailData = detailBeans[0]; |
| 211 | let dateTime = | 223 | let dateTime = |
| 212 | - DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN); | 224 | + DateTimeUtils.parseDate(this.contentDetailData?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN); |
| 213 | let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN) | 225 | let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN) |
| 214 | this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime) | 226 | this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime) |
| 215 | - if (this.contentDetailData[0]?.recommendShow === 1) { | 227 | + if (this.contentDetailData?.recommendShow === 1) { |
| 216 | this.getRecommend() | 228 | this.getRecommend() |
| 217 | } | 229 | } |
| 218 | - if (this.contentDetailData[0]?.openLikes === 1) { | 230 | + if (this.contentDetailData?.openLikes === 1) { |
| 219 | this.getInteractDataStatus() | 231 | this.getInteractDataStatus() |
| 220 | this.queryContentInteractCount() | 232 | this.queryContentInteractCount() |
| 221 | } | 233 | } |
| 222 | - if (this.contentDetailData[0]?.openComment) { | ||
| 223 | - this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '') | ||
| 224 | - this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId) | ||
| 225 | - this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle | ||
| 226 | - this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType) | ||
| 227 | - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId) | ||
| 228 | - this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle) | ||
| 229 | - this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType) | 234 | + if (this.contentDetailData?.openComment) { |
| 235 | + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | ||
| 236 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | ||
| 237 | + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | ||
| 238 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 239 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 240 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 241 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 242 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | ||
| 230 | } | 243 | } |
| 231 | - if (this.contentDetailData[0]?.openAudio && this.contentDetailData[0]?.audioList?.length && | ||
| 232 | - this.contentDetailData[0]?.audioList[0].audioUrl) { | 244 | + if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length && |
| 245 | + this.contentDetailData?.audioList[0].audioUrl) { | ||
| 233 | this.operationButtonList = ['comment', 'collect', 'listen', 'share'] | 246 | this.operationButtonList = ['comment', 'collect', 'listen', 'share'] |
| 234 | } else { | 247 | } else { |
| 235 | this.operationButtonList = ['comment', 'collect', 'share'] | 248 | this.operationButtonList = ['comment', 'collect', 'share'] |
| @@ -242,14 +255,18 @@ export struct ImageAndTextPageComponent { | @@ -242,14 +255,18 @@ export struct ImageAndTextPageComponent { | ||
| 242 | let params: postRecommendListParams = { | 255 | let params: postRecommendListParams = { |
| 243 | imei: HttpUtils.getImei(), | 256 | imei: HttpUtils.getImei(), |
| 244 | userId: HttpUtils.getUserId(), | 257 | userId: HttpUtils.getUserId(), |
| 245 | - contentId: String(this.contentDetailData[0]?.newsId), | ||
| 246 | - recType: Number(this.contentDetailData[0]?.reLInfo?.relType), | ||
| 247 | - contentType: this.contentDetailData[0]?.newsType, | ||
| 248 | - relId: this.contentDetailData[0]?.reLInfo?.relId, | ||
| 249 | - channelId: String(this.contentDetailData[0]?.reLInfo?.channelId) | 258 | + contentId: String(this.contentDetailData?.newsId), |
| 259 | + recType: Number(this.contentDetailData?.reLInfo?.relType), | ||
| 260 | + contentType: this.contentDetailData?.newsType, | ||
| 261 | + relId: this.contentDetailData?.reLInfo?.relId, | ||
| 262 | + channelId: String(this.contentDetailData?.reLInfo?.channelId) | ||
| 250 | } | 263 | } |
| 251 | let recommendList = await DetailViewModel.postRecommendList(params) | 264 | let recommendList = await DetailViewModel.postRecommendList(params) |
| 252 | - this.recommendList = recommendList; | 265 | + if (recommendList.length > 0) { |
| 266 | + //推荐列表过滤音频和活动入口 | ||
| 267 | + this.recommendList = recommendList.filter(item => item.objectType !== '3' && item.objectType !== '13'); | ||
| 268 | + } | ||
| 269 | + | ||
| 253 | } | 270 | } |
| 254 | 271 | ||
| 255 | // 已登录->查询用户对作品点赞、收藏状态 | 272 | // 已登录->查询用户对作品点赞、收藏状态 |
| @@ -258,8 +275,8 @@ export struct ImageAndTextPageComponent { | @@ -258,8 +275,8 @@ export struct ImageAndTextPageComponent { | ||
| 258 | const params: batchLikeAndCollectParams = { | 275 | const params: batchLikeAndCollectParams = { |
| 259 | contentList: [ | 276 | contentList: [ |
| 260 | { | 277 | { |
| 261 | - contentId: this.contentDetailData[0]?.newsId + '', | ||
| 262 | - contentType: this.contentDetailData[0]?.newsType + '', | 278 | + contentId: this.contentDetailData?.newsId + '', |
| 279 | + contentType: this.contentDetailData?.newsType + '', | ||
| 263 | } | 280 | } |
| 264 | ] | 281 | ] |
| 265 | } | 282 | } |
| @@ -284,8 +301,8 @@ export struct ImageAndTextPageComponent { | @@ -284,8 +301,8 @@ export struct ImageAndTextPageComponent { | ||
| 284 | } | 301 | } |
| 285 | const params: postExecuteLikeParams = { | 302 | const params: postExecuteLikeParams = { |
| 286 | status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1', | 303 | status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1', |
| 287 | - contentId: this.contentDetailData[0]?.newsId + '', | ||
| 288 | - contentType: this.contentDetailData[0]?.newsType + '', | 304 | + contentId: this.contentDetailData?.newsId + '', |
| 305 | + contentType: this.contentDetailData?.newsType + '', | ||
| 289 | } | 306 | } |
| 290 | PageRepository.postExecuteLike(params).then(res => { | 307 | PageRepository.postExecuteLike(params).then(res => { |
| 291 | console.log(TAG, '点赞、取消点赞', 'toggleLikeStatus==',) | 308 | console.log(TAG, '点赞、取消点赞', 'toggleLikeStatus==',) |
| @@ -304,8 +321,8 @@ export struct ImageAndTextPageComponent { | @@ -304,8 +321,8 @@ export struct ImageAndTextPageComponent { | ||
| 304 | console.error(TAG, 'contentDetailData2222', JSON.stringify(this.contentDetailData)) | 321 | console.error(TAG, 'contentDetailData2222', JSON.stringify(this.contentDetailData)) |
| 305 | const params: contentListParams = { | 322 | const params: contentListParams = { |
| 306 | contentList: [{ | 323 | contentList: [{ |
| 307 | - contentId: this.contentDetailData[0]?.newsId + '', | ||
| 308 | - contentType: this.contentDetailData[0]?.newsType, | 324 | + contentId: this.contentDetailData?.newsId + '', |
| 325 | + contentType: this.contentDetailData?.newsType, | ||
| 309 | }] | 326 | }] |
| 310 | } | 327 | } |
| 311 | PageRepository.getContentInteract(params).then(res => { | 328 | PageRepository.getContentInteract(params).then(res => { |
| @@ -339,4 +356,4 @@ export struct ImageAndTextPageComponent { | @@ -339,4 +356,4 @@ export struct ImageAndTextPageComponent { | ||
| 339 | 356 | ||
| 340 | aboutToDisappear() { | 357 | aboutToDisappear() { |
| 341 | } | 358 | } |
| 342 | -} | ||
| 359 | +} |
| 1 | +import { ContentDTO } from 'wdBean/Index'; | ||
| 2 | +import { ProcessUtils } from 'wdRouter/Index'; | ||
| 3 | +import { InteractMessageModel } from '../../model/InteractMessageModel' | ||
| 1 | 4 | ||
| 2 | @Component | 5 | @Component |
| 3 | export struct InteractMComponent { | 6 | export struct InteractMComponent { |
| 7 | + messageModel:InteractMessageModel = new InteractMessageModel; | ||
| 8 | +///"remark": "{"beReply":"乐事薯片,大家的最爱!!", | ||
| 9 | + // "headUrl":"https: //uatjdcdnphoto.aikan.pdnews.cn//zhbj/img/user/2023122211/2A59F725E69849A38CEE8823B0D9D141.jpg", | ||
| 10 | + // "contentId":"30035774121","contentRelObjectid":"2012","contentTitle":"乐事推出华夏风光限定罐七款城市地标包装让出游“有滋有味”", | ||
| 11 | + // "commentContent":"大家都爱吃!!","userName":"人民日报网友a8dKCV","userId":"504964178466309","contentRelId":"500002866426", | ||
| 12 | + // "shareUrl":"https: //pd-people-uat.pdnews.cn/column/30035774121-500002866426","userType":"1", | ||
| 13 | + // "contentRelType":"1","visitor":"0","contentType":"8"}", | ||
| 14 | + | ||
| 4 | build() { | 15 | build() { |
| 5 | Row(){ | 16 | Row(){ |
| 6 | - Image('') | ||
| 7 | - .backgroundColor(Color.Red) | 17 | + Image(this.messageModel.InteractMsubM.headUrl) |
| 8 | .width(36) | 18 | .width(36) |
| 9 | .height(36) | 19 | .height(36) |
| 10 | .borderRadius(18) | 20 | .borderRadius(18) |
| 11 | 21 | ||
| 12 | Column(){ | 22 | Column(){ |
| 13 | Row(){ | 23 | Row(){ |
| 14 | - Text('用户名') | 24 | + Text(this.messageModel.InteractMsubM.userName) |
| 15 | .fontSize('14fp').fontColor('#222222') | 25 | .fontSize('14fp').fontColor('#222222') |
| 16 | 26 | ||
| 17 | - Text('回复了你的评论') | 27 | + Text(this.buildContentString()) |
| 18 | .fontSize('14fp').fontColor('#999999') | 28 | .fontSize('14fp').fontColor('#999999') |
| 19 | .margin({left:5}) | 29 | .margin({left:5}) |
| 20 | }.width('100%') | 30 | }.width('100%') |
| 21 | 31 | ||
| 22 | - Text('两天前') | 32 | + Text(this.messageModel.time) |
| 23 | .margin({top:2}) | 33 | .margin({top:2}) |
| 24 | - .fontSize('12fp').fontColor('#B0B0B0') | ||
| 25 | - | ||
| 26 | - Text('评论内容') | ||
| 27 | - .margin({top:8,bottom:10}) | ||
| 28 | - .fontSize('16fp').fontColor('#222222') | ||
| 29 | - .width('100%') | ||
| 30 | - .constraintSize({maxHeight:500}) | 34 | + .fontSize('12fp').fontColor('#B0B0B0').margin({top:10,bottom:10}) |
| 31 | 35 | ||
| 32 | - Column(){ | ||
| 33 | - Text('[你的评论]乐事薯片,大家的最爱').fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500}) | ||
| 34 | - .margin({top:5,bottom:5}) | 36 | + if (this.messageModel.contentType === '208' || this.messageModel.contentType === '209'){ |
| 37 | + Text(this.messageModel.message) | ||
| 38 | + .margin({bottom:10}) | ||
| 39 | + .fontSize('16fp').fontColor('#222222') | ||
| 35 | .width('100%') | 40 | .width('100%') |
| 41 | + .constraintSize({maxHeight:500}) | ||
| 42 | + } | ||
| 36 | 43 | ||
| 37 | - Divider() | ||
| 38 | - .color('#f5f5f5') | ||
| 39 | - .backgroundColor('#f5f5f5') | ||
| 40 | - .width('100%') | ||
| 41 | - .height(1) | 44 | + Column(){ |
| 45 | + if (this.messageModel.contentType === '207' || this.messageModel.contentType === '209'){ | ||
| 46 | + Text('[你的评论]'+this.buildCommentContent()).fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500}) | ||
| 47 | + .margin({top:15,bottom:10}) | ||
| 48 | + .width('100%') | ||
| 42 | 49 | ||
| 50 | + Divider() | ||
| 51 | + .color('#EDEDED') | ||
| 52 | + .backgroundColor('#EDEDED') | ||
| 53 | + .width('100%') | ||
| 54 | + .height(1) | ||
| 55 | + } | ||
| 43 | Row(){ | 56 | Row(){ |
| 44 | - Text('乐事薯片,大家的最爱!!!!').fontSize('12fp').fontColor('#666666').constraintSize({maxHeight:500}) | 57 | + Image($r('app.media.MessageOriginTextIcon')) |
| 58 | + .width('12') | ||
| 59 | + .height('12') | ||
| 60 | + Text(this.messageModel.InteractMsubM.contentTitle) | ||
| 61 | + .fontSize('12fp') | ||
| 62 | + .fontColor('#666666') | ||
| 63 | + .maxLines(1) | ||
| 64 | + .width('90%') | ||
| 65 | + .textOverflow({overflow:TextOverflow.Ellipsis}) | ||
| 45 | 66 | ||
| 46 | Blank() | 67 | Blank() |
| 47 | 68 | ||
| 48 | Image($r('app.media.mine_user_edit')) | 69 | Image($r('app.media.mine_user_edit')) |
| 49 | .width('12') | 70 | .width('12') |
| 50 | .height('12') | 71 | .height('12') |
| 51 | - }.margin({top:5,bottom:5}).width('100%') | ||
| 52 | - }.alignItems(HorizontalAlign.Start).backgroundColor('#f5f5f5').borderRadius(5) | ||
| 53 | - }.padding({left:5}).alignItems(HorizontalAlign.Start) | ||
| 54 | - }.padding({top:5,left:16,right:16}).width('100%').height(160).alignItems(VerticalAlign.Top).backgroundColor(Color.Red) | 72 | + }.margin({top:10,bottom:15}) |
| 73 | + }.padding({left:10,right:10}).alignItems(HorizontalAlign.Start).backgroundColor('#f5f5f5').borderRadius(5) | ||
| 74 | + .onClick(()=>{ | ||
| 75 | + let contentDTO :ContentDTO = new ContentDTO(); | ||
| 76 | + contentDTO.objectType = this.messageModel.InteractMsubM.contentType | ||
| 77 | + contentDTO.objectId = this.messageModel.InteractMsubM.contentId | ||
| 78 | + ProcessUtils.processPage(contentDTO) | ||
| 79 | + }) | ||
| 80 | + }.padding({left:5,right:5}).alignItems(HorizontalAlign.Start).width('90%') | ||
| 81 | + }.padding({top:10,left:16,right:16}).width('100%').alignItems(VerticalAlign.Top) | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + buildContentString(): string { | ||
| 85 | + let contentString: string = '' | ||
| 86 | + if (this.messageModel.contentType === '206') { | ||
| 87 | + contentString = '赞了你的作品' | ||
| 88 | + }else if(this.messageModel.contentType === '207'){ | ||
| 89 | + contentString = '赞了你的评论' | ||
| 90 | + }else if(this.messageModel.contentType === '208'){ | ||
| 91 | + contentString = '评论了你的作品' | ||
| 92 | + }else if(this.messageModel.contentType === '209'){ | ||
| 93 | + contentString = '回复了你的评论' | ||
| 94 | + }else if(this.messageModel.contentType === '210'){ | ||
| 95 | + contentString = '转发了您的作品' | ||
| 96 | + }else if(this.messageModel.contentType === '211'){ | ||
| 97 | + contentString = '关注了你' | ||
| 98 | + } | ||
| 99 | + return contentString; | ||
| 100 | + } | ||
| 101 | + buildCommentContent(): string { | ||
| 102 | + let contentString : string = this.messageModel.contentType === '207'?this.messageModel.message:this.messageModel.InteractMsubM.beReply; | ||
| 103 | + return contentString; | ||
| 55 | } | 104 | } |
| 56 | } | 105 | } |
| @@ -61,6 +61,8 @@ export struct MorningEveningPaperComponent { | @@ -61,6 +61,8 @@ export struct MorningEveningPaperComponent { | ||
| 61 | @State mixedBgColor: string = '' | 61 | @State mixedBgColor: string = '' |
| 62 | // 顶部安全高度赋值 | 62 | // 顶部安全高度赋值 |
| 63 | @State topSafeHeight: number = 0; | 63 | @State topSafeHeight: number = 0; |
| 64 | + @State bottomSafeHeight: number = 0; | ||
| 65 | + | ||
| 64 | private audioDataList: AudioDataList[] = [] | 66 | private audioDataList: AudioDataList[] = [] |
| 65 | private playerController: WDPlayerController = new WDPlayerController(); | 67 | private playerController: WDPlayerController = new WDPlayerController(); |
| 66 | simpleAudioDialog: CustomDialogController = new CustomDialogController({ | 68 | simpleAudioDialog: CustomDialogController = new CustomDialogController({ |
| @@ -112,6 +114,7 @@ export struct MorningEveningPaperComponent { | @@ -112,6 +114,7 @@ export struct MorningEveningPaperComponent { | ||
| 112 | // await windowHight.setWindowLayoutFullScreen(true); | 114 | // await windowHight.setWindowLayoutFullScreen(true); |
| 113 | // WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) | 115 | // WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) |
| 114 | this.topSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height) | 116 | this.topSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height) |
| 117 | + this.bottomSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).bottomRect.height) | ||
| 115 | 118 | ||
| 116 | const dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String | 119 | const dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String |
| 117 | console.info(TAG, `aboutToAppear = ` + dailyPaperTopicPageId) | 120 | console.info(TAG, `aboutToAppear = ` + dailyPaperTopicPageId) |
| @@ -248,14 +251,15 @@ export struct MorningEveningPaperComponent { | @@ -248,14 +251,15 @@ export struct MorningEveningPaperComponent { | ||
| 248 | }) | 251 | }) |
| 249 | } | 252 | } |
| 250 | } | 253 | } |
| 251 | - .height('100%') | 254 | + .height(`calc(100% - ${this.bottomSafeHeight + this.topSafeHeight + 'vp'})`) |
| 252 | 255 | ||
| 253 | PaperTitleComponent() | 256 | PaperTitleComponent() |
| 254 | } | 257 | } |
| 255 | .width('100%') | 258 | .width('100%') |
| 256 | .height('100%') | 259 | .height('100%') |
| 257 | .padding({ | 260 | .padding({ |
| 258 | - top: this.topSafeHeight | 261 | + top: this.topSafeHeight, |
| 262 | + bottom: this.bottomSafeHeight | ||
| 259 | }) | 263 | }) |
| 260 | // .backgroundColor(Color.Black) | 264 | // .backgroundColor(Color.Black) |
| 261 | // .backgroundColor(this.pageInfoBean?.backgroundColor ?? Color.Black) | 265 | // .backgroundColor(this.pageInfoBean?.backgroundColor ?? Color.Black) |
| @@ -114,7 +114,7 @@ export struct SingleColumn999Component { | @@ -114,7 +114,7 @@ export struct SingleColumn999Component { | ||
| 114 | build() { | 114 | build() { |
| 115 | // if (this.compDTO && this.compDTO?.operDataList?.length > 0) { | 115 | // if (this.compDTO && this.compDTO?.operDataList?.length > 0) { |
| 116 | if (this.compListItem && this.compListItem?.operDataList?.length > 0) { | 116 | if (this.compListItem && this.compListItem?.operDataList?.length > 0) { |
| 117 | - List({ space: 2, initialIndex: 0 }) { | 117 | + List({ initialIndex: 0 }) { |
| 118 | // ListItemGroup({ | 118 | // ListItemGroup({ |
| 119 | // // footer: this.itemFooter("") | 119 | // // footer: this.itemFooter("") |
| 120 | // }) { | 120 | // }) { |
| 1 | -import { NetworkUtil, Logger, NetworkType, SPHelper, WindowModel, StringUtils} from 'wdKit'; | 1 | +import { NetworkUtil, Logger, NetworkType, SPHelper, WindowModel, StringUtils } from 'wdKit'; |
| 2 | import { ResponseDTO } from 'wdNetwork'; | 2 | import { ResponseDTO } from 'wdNetwork'; |
| 3 | import { | 3 | import { |
| 4 | ContentDetailDTO, | 4 | ContentDetailDTO, |
| @@ -35,7 +35,7 @@ export struct MultiPictureDetailPageComponent { | @@ -35,7 +35,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 35 | private picWidth: number = 0 | 35 | private picWidth: number = 0 |
| 36 | @State picHeight: number = 0 | 36 | @State picHeight: number = 0 |
| 37 | @State titleHeight: number = 0 | 37 | @State titleHeight: number = 0 |
| 38 | - @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 38 | + @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 39 | @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' | 39 | @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' |
| 40 | private swiperController: SwiperController = new SwiperController() | 40 | private swiperController: SwiperController = new SwiperController() |
| 41 | private swiperControllerItem: SwiperController = new SwiperController() | 41 | private swiperControllerItem: SwiperController = new SwiperController() |
| @@ -49,8 +49,8 @@ export struct MultiPictureDetailPageComponent { | @@ -49,8 +49,8 @@ export struct MultiPictureDetailPageComponent { | ||
| 49 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; | 49 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; |
| 50 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') as number; | 50 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') as number; |
| 51 | @State windowHeight: number = AppStorage.get<number>('windowHeight') as number; | 51 | @State windowHeight: number = AppStorage.get<number>('windowHeight') as number; |
| 52 | - @State currentOffset:number = 0 | ||
| 53 | - @State duration:number = 0 | 52 | + @State currentOffset: number = 0 |
| 53 | + @State duration: number = 0 | ||
| 54 | 54 | ||
| 55 | //watch监听页码回调 | 55 | //watch监听页码回调 |
| 56 | onCurrentPageNumUpdated(): void { | 56 | onCurrentPageNumUpdated(): void { |
| @@ -83,7 +83,6 @@ export struct MultiPictureDetailPageComponent { | @@ -83,7 +83,6 @@ export struct MultiPictureDetailPageComponent { | ||
| 83 | } | 83 | } |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | - | ||
| 87 | aboutToDisappear() { | 86 | aboutToDisappear() { |
| 88 | 87 | ||
| 89 | } | 88 | } |
| @@ -101,10 +100,10 @@ export struct MultiPictureDetailPageComponent { | @@ -101,10 +100,10 @@ export struct MultiPictureDetailPageComponent { | ||
| 101 | @Builder | 100 | @Builder |
| 102 | init() { | 101 | init() { |
| 103 | if (this.contentDetailData.rmhPlatform == 1) { | 102 | if (this.contentDetailData.rmhPlatform == 1) { |
| 104 | - if(!this.showDownload) { | 103 | + if (!this.showDownload) { |
| 105 | Row() { | 104 | Row() { |
| 106 | Row({ space: 8 }) { | 105 | Row({ space: 8 }) { |
| 107 | - if (this.getImgUrl()){ | 106 | + if (this.getImgUrl()) { |
| 108 | Row() { | 107 | Row() { |
| 109 | Stack() { | 108 | Stack() { |
| 110 | Image(this.getImgUrl()) | 109 | Image(this.getImgUrl()) |
| @@ -115,7 +114,7 @@ export struct MultiPictureDetailPageComponent { | @@ -115,7 +114,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 115 | .height(36) | 114 | .height(36) |
| 116 | .objectFit(ImageFit.Fill) | 115 | .objectFit(ImageFit.Fill) |
| 117 | .interpolation(ImageInterpolation.High) | 116 | .interpolation(ImageInterpolation.High) |
| 118 | - if(!StringUtils.isEmpty(this.contentDetailData.rmhInfo?.authIcon)){ | 117 | + if (!StringUtils.isEmpty(this.contentDetailData.rmhInfo?.authIcon)) { |
| 119 | Stack() { | 118 | Stack() { |
| 120 | Image(this.contentDetailData.rmhInfo?.authIcon) | 119 | Image(this.contentDetailData.rmhInfo?.authIcon) |
| 121 | .width($r('app.float.vp_13')) | 120 | .width($r('app.float.vp_13')) |
| @@ -219,7 +218,7 @@ export struct MultiPictureDetailPageComponent { | @@ -219,7 +218,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 219 | .width('100%') | 218 | .width('100%') |
| 220 | .height(44) | 219 | .height(44) |
| 221 | .zIndex(10) | 220 | .zIndex(10) |
| 222 | - .margin({top:`${this.topSafeHeight + 12}px`}) | 221 | + .margin({ top: `${this.topSafeHeight + 12}px` }) |
| 223 | .alignRules({ | 222 | .alignRules({ |
| 224 | top: { anchor: "__container__", align: VerticalAlign.Top }, | 223 | top: { anchor: "__container__", align: VerticalAlign.Top }, |
| 225 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 224 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| @@ -249,15 +248,15 @@ export struct MultiPictureDetailPageComponent { | @@ -249,15 +248,15 @@ export struct MultiPictureDetailPageComponent { | ||
| 249 | this.currentOffset = Math.abs(extraInfo.currentOffset) | 248 | this.currentOffset = Math.abs(extraInfo.currentOffset) |
| 250 | }) | 249 | }) |
| 251 | .onTouch((event: TouchEvent) => { | 250 | .onTouch((event: TouchEvent) => { |
| 252 | - if(this.duration === 0) { | ||
| 253 | - this.duration = 500 | ||
| 254 | - } | ||
| 255 | - if(event.type === 1) { | ||
| 256 | - // if(this.currentOffset > px2vp((this.windowHeight - item.height)/2 - 100)) { | ||
| 257 | - if(this.currentOffset > 160) { | ||
| 258 | - router.back() | ||
| 259 | - } | 251 | + if (this.duration === 0) { |
| 252 | + this.duration = 500 | ||
| 253 | + } | ||
| 254 | + if (event.type === 1) { | ||
| 255 | + // if(this.currentOffset > px2vp((this.windowHeight - item.height)/2 - 100)) { | ||
| 256 | + if (this.currentOffset > 160) { | ||
| 257 | + router.back() | ||
| 260 | } | 258 | } |
| 259 | + } | ||
| 261 | }) | 260 | }) |
| 262 | }) | 261 | }) |
| 263 | } | 262 | } |
| @@ -296,9 +295,9 @@ export struct MultiPictureDetailPageComponent { | @@ -296,9 +295,9 @@ export struct MultiPictureDetailPageComponent { | ||
| 296 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 295 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| 297 | }) | 296 | }) |
| 298 | } | 297 | } |
| 299 | - Column(){ | ||
| 300 | - if(!this.showDownload) { | ||
| 301 | - Column(){ | 298 | + Column() { |
| 299 | + if (!this.showDownload) { | ||
| 300 | + Column() { | ||
| 302 | Row() { | 301 | Row() { |
| 303 | Scroll(this.scroller) { | 302 | Scroll(this.scroller) { |
| 304 | Row() { | 303 | Row() { |
| @@ -306,7 +305,7 @@ export struct MultiPictureDetailPageComponent { | @@ -306,7 +305,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 306 | direction: FlexDirection.Column, | 305 | direction: FlexDirection.Column, |
| 307 | justifyContent: FlexAlign.Start | 306 | justifyContent: FlexAlign.Start |
| 308 | }) { | 307 | }) { |
| 309 | - if(this.contentDetailData?.photoList?.length) { | 308 | + if (this.contentDetailData?.photoList?.length) { |
| 310 | Text() { | 309 | Text() { |
| 311 | Span(`${this.swiperIndex + 1}`) | 310 | Span(`${this.swiperIndex + 1}`) |
| 312 | .fontSize(24) | 311 | .fontSize(24) |
| @@ -322,7 +321,7 @@ export struct MultiPictureDetailPageComponent { | @@ -322,7 +321,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 322 | .fontColor(Color.White) | 321 | .fontColor(Color.White) |
| 323 | .margin(4) | 322 | .margin(4) |
| 324 | } | 323 | } |
| 325 | - if(this.contentDetailData.newsTitle) { | 324 | + if (this.contentDetailData.newsTitle) { |
| 326 | Text(`${this.contentDetailData.newsTitle}`) | 325 | Text(`${this.contentDetailData.newsTitle}`) |
| 327 | .fontColor(Color.White) | 326 | .fontColor(Color.White) |
| 328 | .fontSize(16) | 327 | .fontSize(16) |
| @@ -336,7 +335,7 @@ export struct MultiPictureDetailPageComponent { | @@ -336,7 +335,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 336 | right: 0 | 335 | right: 0 |
| 337 | }) | 336 | }) |
| 338 | } | 337 | } |
| 339 | - if(this.contentDetailData.photoList?.[this.swiperIndex].picDesc) { | 338 | + if (this.contentDetailData.photoList?.[this.swiperIndex].picDesc) { |
| 340 | Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`) | 339 | Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`) |
| 341 | .fontColor(Color.White) | 340 | .fontColor(Color.White) |
| 342 | .fontSize(14) | 341 | .fontSize(14) |
| @@ -361,25 +360,27 @@ export struct MultiPictureDetailPageComponent { | @@ -361,25 +360,27 @@ export struct MultiPictureDetailPageComponent { | ||
| 361 | .height(px2vp(this.titleHeight)) | 360 | .height(px2vp(this.titleHeight)) |
| 362 | .align(Alignment.Bottom) | 361 | .align(Alignment.Bottom) |
| 363 | } | 362 | } |
| 363 | + | ||
| 364 | OperRowListView({ | 364 | OperRowListView({ |
| 365 | contentDetailData: this.contentDetailData, | 365 | contentDetailData: this.contentDetailData, |
| 366 | publishCommentModel: this.publishCommentModel, | 366 | publishCommentModel: this.publishCommentModel, |
| 367 | operationButtonList: this.operationButtonList, | 367 | operationButtonList: this.operationButtonList, |
| 368 | styleType: 2, | 368 | styleType: 2, |
| 369 | + componentType:5, | ||
| 369 | }) | 370 | }) |
| 370 | } | 371 | } |
| 371 | .transition(TransitionEffect.OPACITY.animation({ duration: this.duration, curve: Curve.Ease }).combine( | 372 | .transition(TransitionEffect.OPACITY.animation({ duration: this.duration, curve: Curve.Ease }).combine( |
| 372 | TransitionEffect.translate({ x: 0, y: `-${this.bottomSafeHeight}px` }) | 373 | TransitionEffect.translate({ x: 0, y: `-${this.bottomSafeHeight}px` }) |
| 373 | )) | 374 | )) |
| 374 | } | 375 | } |
| 375 | - if(this.showDownload) { | ||
| 376 | - Column(){ | 376 | + if (this.showDownload) { |
| 377 | + Column() { | ||
| 377 | Row() { | 378 | Row() { |
| 378 | Flex({ | 379 | Flex({ |
| 379 | direction: FlexDirection.Row, | 380 | direction: FlexDirection.Row, |
| 380 | justifyContent: FlexAlign.SpaceBetween | 381 | justifyContent: FlexAlign.SpaceBetween |
| 381 | }) { | 382 | }) { |
| 382 | - if(this.contentDetailData?.photoList?.length) { | 383 | + if (this.contentDetailData?.photoList?.length) { |
| 383 | Text() { | 384 | Text() { |
| 384 | Span(`${this.swiperIndex + 1}`) | 385 | Span(`${this.swiperIndex + 1}`) |
| 385 | .fontSize(24) | 386 | .fontSize(24) |
| @@ -396,7 +397,7 @@ export struct MultiPictureDetailPageComponent { | @@ -396,7 +397,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 396 | .margin(4) | 397 | .margin(4) |
| 397 | } | 398 | } |
| 398 | 399 | ||
| 399 | - if(this.contentDetailData.photoList?.[this.swiperIndex].picPath) { | 400 | + if (this.contentDetailData.photoList?.[this.swiperIndex].picPath) { |
| 400 | ImageDownloadComponent({ url: this.contentDetailData.photoList?.[this.swiperIndex].picPath }) | 401 | ImageDownloadComponent({ url: this.contentDetailData.photoList?.[this.swiperIndex].picPath }) |
| 401 | .margin({ | 402 | .margin({ |
| 402 | top: 8, | 403 | top: 8, |
| @@ -449,6 +450,7 @@ export struct MultiPictureDetailPageComponent { | @@ -449,6 +450,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 449 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | 450 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) |
| 450 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | 451 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) |
| 451 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | 452 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) |
| 453 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | ||
| 452 | } | 454 | } |
| 453 | // this.contentDetailData.photoList = [] | 455 | // this.contentDetailData.photoList = [] |
| 454 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { | 456 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { |
| @@ -8,6 +8,8 @@ import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5 | @@ -8,6 +8,8 @@ import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5 | ||
| 8 | import { OperRowListView } from './view/OperRowListView'; | 8 | import { OperRowListView } from './view/OperRowListView'; |
| 9 | import DetailViewModel from '../viewmodel/DetailViewModel'; | 9 | import DetailViewModel from '../viewmodel/DetailViewModel'; |
| 10 | import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; | 10 | import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; |
| 11 | +import { EmptyComponent } from '../components/view/EmptyComponent'; | ||
| 12 | +import { NetworkUtil } from 'wdKit'; | ||
| 11 | 13 | ||
| 12 | const TAG: string = 'SpacialTopicPageComponent' | 14 | const TAG: string = 'SpacialTopicPageComponent' |
| 13 | 15 | ||
| @@ -18,12 +20,14 @@ export struct SpacialTopicPageComponent { | @@ -18,12 +20,14 @@ export struct SpacialTopicPageComponent { | ||
| 18 | action: Action = {} as Action | 20 | action: Action = {} as Action |
| 19 | @State webUrl: string = ''; | 21 | @State webUrl: string = ''; |
| 20 | @State isPageEnd: boolean = false | 22 | @State isPageEnd: boolean = false |
| 21 | - @State contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO [] | 23 | + @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 22 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean | 24 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean |
| 23 | private webPrepared = false; | 25 | private webPrepared = false; |
| 24 | private dataPrepared = false; | 26 | private dataPrepared = false; |
| 25 | @State publishCommentModel: publishCommentModel = new publishCommentModel() | 27 | @State publishCommentModel: publishCommentModel = new publishCommentModel() |
| 26 | @State operationButtonList: string[] = ['comment', 'collect', 'share'] | 28 | @State operationButtonList: string[] = ['comment', 'collect', 'share'] |
| 29 | + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | ||
| 30 | + @State isNetConnected: boolean = true | ||
| 27 | 31 | ||
| 28 | private trySendData2H5() { | 32 | private trySendData2H5() { |
| 29 | if (!this.webPrepared || !this.dataPrepared) { | 33 | if (!this.webPrepared || !this.dataPrepared) { |
| @@ -45,6 +49,8 @@ export struct SpacialTopicPageComponent { | @@ -45,6 +49,8 @@ export struct SpacialTopicPageComponent { | ||
| 45 | } | 49 | } |
| 46 | 50 | ||
| 47 | private async getDetail() { | 51 | private async getDetail() { |
| 52 | + this.isNetConnected = NetworkUtil.isNetConnected() | ||
| 53 | + | ||
| 48 | let contentId: string = '' | 54 | let contentId: string = '' |
| 49 | let relId: string = '' | 55 | let relId: string = '' |
| 50 | let relType: string = '' | 56 | let relType: string = '' |
| @@ -63,15 +69,16 @@ export struct SpacialTopicPageComponent { | @@ -63,15 +69,16 @@ export struct SpacialTopicPageComponent { | ||
| 63 | } | 69 | } |
| 64 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) | 70 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) |
| 65 | if (detailBeans && detailBeans.length > 0) { | 71 | if (detailBeans && detailBeans.length > 0) { |
| 66 | - this.contentDetailData = detailBeans; | 72 | + this.contentDetailData = detailBeans[0]; |
| 67 | // if (this.contentDetailData[0]?.openComment) { | 73 | // if (this.contentDetailData[0]?.openComment) { |
| 68 | - this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '') | ||
| 69 | - this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId) | ||
| 70 | - this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle | ||
| 71 | - this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType) | ||
| 72 | - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId) | ||
| 73 | - this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle) | ||
| 74 | - this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType) | 74 | + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') |
| 75 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | ||
| 76 | + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | ||
| 77 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 78 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 79 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 80 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 81 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | ||
| 75 | // } | 82 | // } |
| 76 | this.trySendData2H5() | 83 | this.trySendData2H5() |
| 77 | } | 84 | } |
| @@ -92,16 +99,29 @@ export struct SpacialTopicPageComponent { | @@ -92,16 +99,29 @@ export struct SpacialTopicPageComponent { | ||
| 92 | } | 99 | } |
| 93 | .width(CommonConstants.FULL_WIDTH) | 100 | .width(CommonConstants.FULL_WIDTH) |
| 94 | .height(CommonConstants.FULL_HEIGHT) | 101 | .height(CommonConstants.FULL_HEIGHT) |
| 95 | - .padding({bottom:75}) | 102 | + .padding({ bottom: 75 }) |
| 96 | 103 | ||
| 97 | - if (!this.isPageEnd) { | ||
| 98 | - detailedSkeleton() | 104 | + if (!this.isNetConnected) { |
| 105 | + EmptyComponent({ | ||
| 106 | + emptyType: 1, | ||
| 107 | + emptyButton: true, | ||
| 108 | + retry: () => { | ||
| 109 | + this.getDetail() | ||
| 110 | + } | ||
| 111 | + }).padding({ bottom: 200 }) | ||
| 112 | + } else { | ||
| 113 | + if (!this.isPageEnd) { | ||
| 114 | + detailedSkeleton() | ||
| 115 | + } | ||
| 99 | } | 116 | } |
| 100 | //底部交互区 | 117 | //底部交互区 |
| 101 | - OperRowListView({ | ||
| 102 | - contentDetailData: this.contentDetailData[0], | ||
| 103 | - publishCommentModel: this.publishCommentModel, | ||
| 104 | - operationButtonList: this.operationButtonList, | 118 | + OperRowListView({ |
| 119 | + contentDetailData: this.contentDetailData, | ||
| 120 | + publishCommentModel: this.publishCommentModel, | ||
| 121 | + operationButtonList: this.operationButtonList, | ||
| 122 | + }) | ||
| 123 | + .padding({ | ||
| 124 | + bottom: `${this.bottomSafeHeight}px` | ||
| 105 | }) | 125 | }) |
| 106 | } | 126 | } |
| 107 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | 127 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) |
| @@ -113,4 +133,4 @@ export struct SpacialTopicPageComponent { | @@ -113,4 +133,4 @@ export struct SpacialTopicPageComponent { | ||
| 113 | } | 133 | } |
| 114 | this.getDetail() | 134 | this.getDetail() |
| 115 | } | 135 | } |
| 116 | -} | ||
| 136 | +} |
| 1 | import { RMCalendarBean } from './RMCalendarBean' | 1 | import { RMCalendarBean } from './RMCalendarBean' |
| 2 | import { RMCalenderCell } from './RMCalendarCell' | 2 | import { RMCalenderCell } from './RMCalendarCell' |
| 3 | +import { ToastUtils, NetworkUtil } from 'wdKit/Index'; | ||
| 3 | 4 | ||
| 4 | @Component | 5 | @Component |
| 5 | export struct RMCalendar { | 6 | export struct RMCalendar { |
| @@ -166,6 +167,9 @@ export struct RMCalendar { | @@ -166,6 +167,9 @@ export struct RMCalendar { | ||
| 166 | * 下一个月 | 167 | * 下一个月 |
| 167 | */ | 168 | */ |
| 168 | private nextMonth() { | 169 | private nextMonth() { |
| 170 | + if (!NetworkUtil.isNetConnected()) { | ||
| 171 | + ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | ||
| 172 | + } | ||
| 169 | // this.dates.slice(0, this.dates.length) | 173 | // this.dates.slice(0, this.dates.length) |
| 170 | this.dates = [] | 174 | this.dates = [] |
| 171 | const beforDate = new Date(this.selectDay.getFullYear(), this.selectDay.getMonth()) | 175 | const beforDate = new Date(this.selectDay.getFullYear(), this.selectDay.getMonth()) |
| @@ -180,6 +184,9 @@ export struct RMCalendar { | @@ -180,6 +184,9 @@ export struct RMCalendar { | ||
| 180 | * 上一个月 | 184 | * 上一个月 |
| 181 | */ | 185 | */ |
| 182 | private preMonth() { | 186 | private preMonth() { |
| 187 | + if (!NetworkUtil.isNetConnected()) { | ||
| 188 | + ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | ||
| 189 | + } | ||
| 183 | // this.dates.slice(0, this.dates.length) | 190 | // this.dates.slice(0, this.dates.length) |
| 184 | this.dates = [] | 191 | this.dates = [] |
| 185 | const beforDate = new Date(this.selectDay.getFullYear(), this.selectDay.getMonth()) | 192 | const beforDate = new Date(this.selectDay.getFullYear(), this.selectDay.getMonth()) |
| 1 | /** | 1 | /** |
| 2 | * 这里是人民号动态中的顶部信息:人民号logo,名字,描述,关注等 | 2 | * 这里是人民号动态中的顶部信息:人民号logo,名字,描述,关注等 |
| 3 | */ | 3 | */ |
| 4 | +import { | ||
| 5 | + ContentDetailRequest, | ||
| 6 | + postInteractAccentionOperateParams | ||
| 7 | +} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | ||
| 4 | import { RmhInfoDTO } from 'wdBean' | 8 | import { RmhInfoDTO } from 'wdBean' |
| 5 | import { CommonConstants } from 'wdConstant/Index'; | 9 | import { CommonConstants } from 'wdConstant/Index'; |
| 6 | -import { DateTimeUtils, SPHelper } from 'wdKit'; | 10 | +import { DateTimeUtils, SPHelper, Logger, ToastUtils } from 'wdKit'; |
| 7 | import { SpConstants } from 'wdConstant/Index' | 11 | import { SpConstants } from 'wdConstant/Index' |
| 8 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 12 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 9 | import router from '@ohos.router' | 13 | import router from '@ohos.router' |
| 14 | +import { postBatchAttentionStatusParams } from 'wdBean/Index'; | ||
| 15 | +import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel' | ||
| 10 | 16 | ||
| 11 | @Component | 17 | @Component |
| 12 | export struct RmhTitle { | 18 | export struct RmhTitle { |
| 13 | @Prop rmhInfo: RmhInfoDTO | 19 | @Prop rmhInfo: RmhInfoDTO |
| 14 | @Prop publishTime: string | undefined | 20 | @Prop publishTime: string | undefined |
| 21 | + /** | ||
| 22 | + * 是否需要隐藏发布时间超过2天的时间展示,默认不隐藏 | ||
| 23 | + */ | ||
| 15 | @Prop hideTime: boolean | 24 | @Prop hideTime: boolean |
| 25 | + /** | ||
| 26 | + * 默认未关注 点击去关注 | ||
| 27 | + */ | ||
| 28 | + @State followStatus: string = '0'; | ||
| 16 | 29 | ||
| 17 | - async appointReq() { | 30 | + /** |
| 31 | + * 关注号主 | ||
| 32 | + */ | ||
| 33 | + async handleAccention() { | ||
| 18 | // 未登录,跳转登录 | 34 | // 未登录,跳转登录 |
| 19 | const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | 35 | const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') |
| 20 | if (!user_id) { | 36 | if (!user_id) { |
| 21 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 37 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 22 | return | 38 | return |
| 23 | } | 39 | } |
| 40 | + | ||
| 41 | + const params2: postInteractAccentionOperateParams = { | ||
| 42 | + attentionUserType: this.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号) | ||
| 43 | + attentionUserId: this.rmhInfo?.userId || '', // 被关注用户号主id | ||
| 44 | + attentionCreatorId: this.rmhInfo?.rmhId || '', // 被关注用户号主id | ||
| 45 | + status: this.followStatus == '0' ? 1 : 0, | ||
| 46 | + } | ||
| 47 | + ContentDetailRequest.postInteractAccentionOperate(params2).then(res => { | ||
| 48 | + console.log('rmhTitle-data', JSON.stringify(res.data)) | ||
| 49 | + if (this.followStatus == '1') { | ||
| 50 | + this.followStatus = '0' | ||
| 51 | + } else { | ||
| 52 | + this.followStatus = '1' | ||
| 53 | + // 弹窗样式与何时调用待确认 | ||
| 54 | + ContentDetailRequest.postPointLevelOperate({ operateType: 6 }).then((res) => { | ||
| 55 | + console.log('关注号主获取积分==', JSON.stringify(res.data)) | ||
| 56 | + if (res.data?.showToast) { | ||
| 57 | + ToastUtils.showToast(res.data.ruleName + '+' + res.data.rulePoint + '积分', 1000); | ||
| 58 | + } | ||
| 59 | + }) | ||
| 60 | + } | ||
| 61 | + }) | ||
| 62 | + } | ||
| 63 | + /** | ||
| 64 | + * 查询当前登录用户是否关注作品号主 | ||
| 65 | + * */ | ||
| 66 | + async getBatchAttentionStatus() { | ||
| 67 | + try { | ||
| 68 | + const params: postBatchAttentionStatusParams = { | ||
| 69 | + creatorIds: [{ creatorId: this.rmhInfo?.rmhId ?? '' }] | ||
| 70 | + } | ||
| 71 | + let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params) | ||
| 72 | + this.followStatus = data[0]?.status; | ||
| 73 | + Logger.info(`rmhTitle-followStatus:${JSON.stringify(this.followStatus)}`) | ||
| 74 | + } catch (exception) { | ||
| 75 | + Logger.info(`rmhTitle-followStatus:${JSON.stringify(exception)}`) | ||
| 76 | + } | ||
| 24 | } | 77 | } |
| 25 | 78 | ||
| 26 | aboutToAppear(): void { | 79 | aboutToAppear(): void { |
| 80 | + this.getBatchAttentionStatus() | ||
| 81 | + | ||
| 27 | let page = router.getState(); | 82 | let page = router.getState(); |
| 28 | if (page.path.includes('/page/PeopleShipHomePage') || page.path.includes('/pages/MainPage')) { | 83 | if (page.path.includes('/page/PeopleShipHomePage') || page.path.includes('/pages/MainPage')) { |
| 29 | this.hideTime = true; | 84 | this.hideTime = true; |
| @@ -88,17 +143,20 @@ export struct RmhTitle { | @@ -88,17 +143,20 @@ export struct RmhTitle { | ||
| 88 | Blank() | 143 | Blank() |
| 89 | if (this.rmhInfo.cnIsAttention) { | 144 | if (this.rmhInfo.cnIsAttention) { |
| 90 | Row() { | 145 | Row() { |
| 91 | - Image($r('app.media.rmh_follow')) | ||
| 92 | - .width(16) | ||
| 93 | - .height(16) | ||
| 94 | - Text('关注') | 146 | + if (Number(this.followStatus) === 0) { |
| 147 | + Image($r('app.media.rmh_follow')) | ||
| 148 | + .width(16) | ||
| 149 | + .height(16) | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + Text(Number(this.followStatus) === 0 ? '关注' : '已关注') | ||
| 95 | .fontSize($r('app.float.font_size_13')) | 153 | .fontSize($r('app.float.font_size_13')) |
| 96 | .fontColor($r('app.color.color_ED2800')) | 154 | .fontColor($r('app.color.color_ED2800')) |
| 97 | } | 155 | } |
| 98 | .flexShrink(0) | 156 | .flexShrink(0) |
| 99 | .alignSelf(ItemAlign.Center) | 157 | .alignSelf(ItemAlign.Center) |
| 100 | .onClick(() => { | 158 | .onClick(() => { |
| 101 | - this.appointReq(); | 159 | + this.handleAccention(); |
| 102 | }) | 160 | }) |
| 103 | } | 161 | } |
| 104 | } | 162 | } |
| 1 | import { CompDTO } from 'wdBean/Index'; | 1 | import { CompDTO } from 'wdBean/Index'; |
| 2 | -import { Logger } from 'wdKit/Index'; | 2 | +import { DateTimeUtils, Logger } from 'wdKit/Index'; |
| 3 | import PageModel from '../../viewmodel/PageModel'; | 3 | import PageModel from '../../viewmodel/PageModel'; |
| 4 | 4 | ||
| 5 | /** | 5 | /** |
| @@ -59,9 +59,9 @@ export struct CardAdvBottom { | @@ -59,9 +59,9 @@ export struct CardAdvBottom { | ||
| 59 | break; | 59 | break; |
| 60 | } | 60 | } |
| 61 | } | 61 | } |
| 62 | - Logger.error("ZZZXXXXX","currentIndex====>"+currentIndex); | ||
| 63 | if (currentIndex >= 0) { | 62 | if (currentIndex >= 0) { |
| 64 | this.pageModel.compList.deleteItem(currentIndex) | 63 | this.pageModel.compList.deleteItem(currentIndex) |
| 64 | + this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 65 | } | 65 | } |
| 66 | } | 66 | } |
| 67 | } | 67 | } |
| 1 | import { CompDTO } from 'wdBean/Index'; | 1 | import { CompDTO } from 'wdBean/Index'; |
| 2 | -import { Logger } from 'wdKit/Index'; | 2 | +import { DateTimeUtils, Logger } from 'wdKit/Index'; |
| 3 | import PageModel from '../../viewmodel/PageModel'; | 3 | import PageModel from '../../viewmodel/PageModel'; |
| 4 | 4 | ||
| 5 | /** | 5 | /** |
| @@ -71,10 +71,9 @@ export struct CardAdvTop { | @@ -71,10 +71,9 @@ export struct CardAdvTop { | ||
| 71 | break; | 71 | break; |
| 72 | } | 72 | } |
| 73 | } | 73 | } |
| 74 | - | ||
| 75 | - Logger.error("ZZZXXXXX","currentIndex====>"+currentIndex); | ||
| 76 | if (currentIndex >= 0) { | 74 | if (currentIndex >= 0) { |
| 77 | this.pageModel.compList.deleteItem(currentIndex) | 75 | this.pageModel.compList.deleteItem(currentIndex) |
| 76 | + this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 78 | } | 77 | } |
| 79 | } | 78 | } |
| 80 | } | 79 | } |
| @@ -48,8 +48,9 @@ export struct Card10Component { | @@ -48,8 +48,9 @@ export struct Card10Component { | ||
| 48 | .onClick((event: ClickEvent) => { | 48 | .onClick((event: ClickEvent) => { |
| 49 | ProcessUtils.processPage(this.contentDTO) | 49 | ProcessUtils.processPage(this.contentDTO) |
| 50 | }) | 50 | }) |
| 51 | - | ||
| 52 | - Notes({ objectType: 5 }).margin({ left: 5, bottom: 5 }) | 51 | + if (this.contentDTO.objectType == '5') { |
| 52 | + Notes({ objectType: 5 }).margin({ left: 5, bottom: 5 }) | ||
| 53 | + } | ||
| 53 | }.alignContent(Alignment.BottomStart) | 54 | }.alignContent(Alignment.BottomStart) |
| 54 | 55 | ||
| 55 | // 专题列表--后端返回三个, | 56 | // 专题列表--后端返回三个, |
| @@ -106,7 +107,7 @@ export struct Card10Component { | @@ -106,7 +107,7 @@ export struct Card10Component { | ||
| 106 | .fontColor($r('app.color.color_222222')) | 107 | .fontColor($r('app.color.color_222222')) |
| 107 | .maxLines(2) | 108 | .maxLines(2) |
| 108 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 109 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 109 | - .textIndent(item.objectType == '5' ? 40 : 0) | 110 | + .textIndent(item.objectType == '5' ? 38 : 0) |
| 110 | }.alignContent(Alignment.TopStart) | 111 | }.alignContent(Alignment.TopStart) |
| 111 | 112 | ||
| 112 | CardSourceInfo( | 113 | CardSourceInfo( |
| 1 | import { Action, CompDTO, ContentDTO, Params } from 'wdBean'; | 1 | import { Action, CompDTO, ContentDTO, Params } from 'wdBean'; |
| 2 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; | 2 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; |
| 3 | import { CommonConstants } from 'wdConstant/Index'; | 3 | import { CommonConstants } from 'wdConstant/Index'; |
| 4 | -import { DateTimeUtils } from 'wdKit'; | ||
| 5 | import { WDRouterRule } from 'wdRouter'; | 4 | import { WDRouterRule } from 'wdRouter'; |
| 6 | -import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 7 | -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 5 | +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; |
| 8 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 6 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 7 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; | ||
| 9 | 8 | ||
| 10 | const TAG = 'Card17Component'; | 9 | const TAG = 'Card17Component'; |
| 11 | 10 | ||
| @@ -23,7 +22,6 @@ export struct Card17Component { | @@ -23,7 +22,6 @@ export struct Card17Component { | ||
| 23 | this.loadImg = await onlyWifiLoadImg(); | 22 | this.loadImg = await onlyWifiLoadImg(); |
| 24 | } | 23 | } |
| 25 | 24 | ||
| 26 | - | ||
| 27 | build() { | 25 | build() { |
| 28 | Column({ space: 8 }) { | 26 | Column({ space: 8 }) { |
| 29 | Text(this.contentDTO.newsTitle) | 27 | Text(this.contentDTO.newsTitle) |
| @@ -38,7 +36,8 @@ export struct Card17Component { | @@ -38,7 +36,8 @@ export struct Card17Component { | ||
| 38 | // 三个图, | 36 | // 三个图, |
| 39 | GridRow({ gutter: 2 }) { | 37 | GridRow({ gutter: 2 }) { |
| 40 | GridCol({ span: { xs: 8 } }) { | 38 | GridCol({ span: { xs: 8 } }) { |
| 41 | - Image(this.loadImg ? this.contentDTO.fullColumnImgUrls.length > 0 ?this.contentDTO.fullColumnImgUrls[0].url:'' : '') | 39 | + Image(this.loadImg ? |
| 40 | + this.contentDTO.fullColumnImgUrls.length > 0 ? this.contentDTO.fullColumnImgUrls[0].url : '' : '') | ||
| 42 | .backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5) | 41 | .backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5) |
| 43 | .width(CommonConstants.FULL_WIDTH) | 42 | .width(CommonConstants.FULL_WIDTH) |
| 44 | .aspectRatio(16 / 9) | 43 | .aspectRatio(16 / 9) |
| @@ -49,7 +48,8 @@ export struct Card17Component { | @@ -49,7 +48,8 @@ export struct Card17Component { | ||
| 49 | } | 48 | } |
| 50 | 49 | ||
| 51 | GridCol({ span: { xs: 4 } }) { | 50 | GridCol({ span: { xs: 4 } }) { |
| 52 | - Image(this.loadImg ? this.contentDTO.fullColumnImgUrls.length > 1? this.contentDTO.fullColumnImgUrls[1].url:'' : '') | 51 | + Image(this.loadImg ? |
| 52 | + this.contentDTO.fullColumnImgUrls.length > 1 ? this.contentDTO.fullColumnImgUrls[1].url : '' : '') | ||
| 53 | .backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5) | 53 | .backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5) |
| 54 | .width(CommonConstants.FULL_WIDTH) | 54 | .width(CommonConstants.FULL_WIDTH) |
| 55 | .aspectRatio(16 / 9) | 55 | .aspectRatio(16 / 9) |
| @@ -65,7 +65,8 @@ export struct Card17Component { | @@ -65,7 +65,8 @@ export struct Card17Component { | ||
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | GridCol({ span: { xs: 4 } }) { | 67 | GridCol({ span: { xs: 4 } }) { |
| 68 | - Image(this.loadImg ? this.contentDTO.fullColumnImgUrls.length > 2? this.contentDTO.fullColumnImgUrls[2].url:'' : '') | 68 | + Image(this.loadImg ? |
| 69 | + this.contentDTO.fullColumnImgUrls.length > 2 ? this.contentDTO.fullColumnImgUrls[2].url : '' : '') | ||
| 69 | .backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5) | 70 | .backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5) |
| 70 | .width(CommonConstants.FULL_WIDTH) | 71 | .width(CommonConstants.FULL_WIDTH) |
| 71 | .aspectRatio(16 / 9) | 72 | .aspectRatio(16 / 9) |
| @@ -94,6 +95,7 @@ export struct Card17Component { | @@ -94,6 +95,7 @@ export struct Card17Component { | ||
| 94 | }; | 95 | }; |
| 95 | WDRouterRule.jumpWithAction(taskAction) | 96 | WDRouterRule.jumpWithAction(taskAction) |
| 96 | }) | 97 | }) |
| 98 | + | ||
| 97 | // 评论等信息 | 99 | // 评论等信息 |
| 98 | CardSourceInfo({ contentDTO: this.contentDTO }) | 100 | CardSourceInfo({ contentDTO: this.contentDTO }) |
| 99 | } | 101 | } |
| @@ -27,6 +27,7 @@ export struct Card19Component { | @@ -27,6 +27,7 @@ export struct Card19Component { | ||
| 27 | .textOverflowStyle(3) | 27 | .textOverflowStyle(3) |
| 28 | .margin({ bottom: 8 }) | 28 | .margin({ bottom: 8 }) |
| 29 | .width(CommonConstants.FULL_WIDTH) | 29 | .width(CommonConstants.FULL_WIDTH) |
| 30 | + .lineHeight(22) | ||
| 30 | .onClick((event: ClickEvent) => { | 31 | .onClick((event: ClickEvent) => { |
| 31 | this.clicked = true; | 32 | this.clicked = true; |
| 32 | ProcessUtils.processPage(this.contentDTO) | 33 | ProcessUtils.processPage(this.contentDTO) |
| @@ -31,7 +31,7 @@ export struct Card20Component { | @@ -31,7 +31,7 @@ export struct Card20Component { | ||
| 31 | .width(CommonConstants.FULL_WIDTH) | 31 | .width(CommonConstants.FULL_WIDTH) |
| 32 | .textOverflowStyle(3) | 32 | .textOverflowStyle(3) |
| 33 | .margin({ bottom: 8 }) | 33 | .margin({ bottom: 8 }) |
| 34 | - .lineHeight(20) | 34 | + .lineHeight(22) |
| 35 | } | 35 | } |
| 36 | if (this.contentDTO.fullColumnImgUrls[0]) { | 36 | if (this.contentDTO.fullColumnImgUrls[0]) { |
| 37 | createImg({ contentDTO: this.contentDTO }) | 37 | createImg({ contentDTO: this.contentDTO }) |
| @@ -102,6 +102,9 @@ struct createImg { | @@ -102,6 +102,9 @@ struct createImg { | ||
| 102 | CardMediaInfo({ contentDTO: this.contentDTO }) | 102 | CardMediaInfo({ contentDTO: this.contentDTO }) |
| 103 | } | 103 | } |
| 104 | .align(Alignment.BottomEnd) | 104 | .align(Alignment.BottomEnd) |
| 105 | + .onClick((event: ClickEvent) => { | ||
| 106 | + ProcessUtils.gotoVod(this.contentDTO) | ||
| 107 | + }) | ||
| 105 | } | 108 | } |
| 106 | } | 109 | } |
| 107 | } | 110 | } |
| @@ -40,7 +40,7 @@ export struct Card2Component { | @@ -40,7 +40,7 @@ export struct Card2Component { | ||
| 40 | .maxLines(2) | 40 | .maxLines(2) |
| 41 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | 41 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 |
| 42 | .align(Alignment.Start) | 42 | .align(Alignment.Start) |
| 43 | - .textIndent(this.contentDTO.objectType == '5' ? 40 : 0) | 43 | + .textIndent(this.contentDTO.objectType == '5' ? 35 : 0) |
| 44 | } | 44 | } |
| 45 | .alignContent(Alignment.TopStart) | 45 | .alignContent(Alignment.TopStart) |
| 46 | 46 |
| @@ -12,7 +12,7 @@ const TAG: string = 'Card5Component'; | @@ -12,7 +12,7 @@ const TAG: string = 'Card5Component'; | ||
| 12 | @Component | 12 | @Component |
| 13 | export struct Card5Component { | 13 | export struct Card5Component { |
| 14 | @State contentDTO: ContentDTO = new ContentDTO(); | 14 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 15 | - @State titleShowPolicy: number | string = 1 | 15 | + @Prop titleShowPolicy: number | string |
| 16 | @State loadImg: boolean = false; | 16 | @State loadImg: boolean = false; |
| 17 | @State clicked: boolean = false; | 17 | @State clicked: boolean = false; |
| 18 | 18 | ||
| @@ -22,12 +22,13 @@ export struct Card5Component { | @@ -22,12 +22,13 @@ export struct Card5Component { | ||
| 22 | 22 | ||
| 23 | build() { | 23 | build() { |
| 24 | Stack() { | 24 | Stack() { |
| 25 | + | ||
| 25 | Image(this.loadImg ? this.contentDTO.coverUrl : '') | 26 | Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 26 | .backgroundColor(0xf5f5f5) | 27 | .backgroundColor(0xf5f5f5) |
| 27 | .width(CommonConstants.FULL_WIDTH) | 28 | .width(CommonConstants.FULL_WIDTH) |
| 28 | .autoResize(true) | 29 | .autoResize(true) |
| 29 | .borderRadius($r('app.float.image_border_radius')) | 30 | .borderRadius($r('app.float.image_border_radius')) |
| 30 | - // if ((this.titleShowPolicy === 1 || this.contentDTO.titleShow === 1) && this.contentDTO.newsTitle) { | 31 | + if (this.titleShowPolicy === 1) { |
| 31 | Row() | 32 | Row() |
| 32 | .width(CommonConstants.FULL_WIDTH) | 33 | .width(CommonConstants.FULL_WIDTH) |
| 33 | .height(59) | 34 | .height(59) |
| @@ -41,20 +42,21 @@ export struct Card5Component { | @@ -41,20 +42,21 @@ export struct Card5Component { | ||
| 41 | if (this.contentDTO.objectType == '5') { | 42 | if (this.contentDTO.objectType == '5') { |
| 42 | Notes({ objectType: this.contentDTO.objectType }) | 43 | Notes({ objectType: this.contentDTO.objectType }) |
| 43 | } | 44 | } |
| 45 | + | ||
| 44 | Text(this.contentDTO.newsTitle) | 46 | Text(this.contentDTO.newsTitle) |
| 45 | - .width(CommonConstants.FULL_WIDTH)// .height(CommonConstants.FULL_HEIGHT) | 47 | + .width(CommonConstants.FULL_WIDTH) |
| 46 | .fontColor(Color.White) | 48 | .fontColor(Color.White) |
| 47 | .fontSize($r('app.float.normal_text_size')) | 49 | .fontSize($r('app.float.normal_text_size')) |
| 48 | .fontWeight(FontWeight.Bold) | 50 | .fontWeight(FontWeight.Bold) |
| 49 | .maxLines(2) | 51 | .maxLines(2) |
| 50 | .align(Alignment.TopStart) | 52 | .align(Alignment.TopStart) |
| 51 | - .textIndent(this.contentDTO.objectType == '5' ? 40 : 0) | 53 | + .textIndent(this.contentDTO.objectType == '5' ? 35 : 0) |
| 52 | }.alignContent(Alignment.TopStart) | 54 | }.alignContent(Alignment.TopStart) |
| 53 | } | 55 | } |
| 54 | .justifyContent(FlexAlign.Start) | 56 | .justifyContent(FlexAlign.Start) |
| 55 | - // .height(40) | ||
| 56 | .margin({ left: 12, bottom: 10, right: 12 }) | 57 | .margin({ left: 12, bottom: 10, right: 12 }) |
| 57 | - // } | 58 | + |
| 59 | + } | ||
| 58 | } | 60 | } |
| 59 | .alignContent(Alignment.Bottom) | 61 | .alignContent(Alignment.Bottom) |
| 60 | .width(CommonConstants.FULL_WIDTH) | 62 | .width(CommonConstants.FULL_WIDTH) |
| @@ -45,11 +45,12 @@ export struct Card6Component { | @@ -45,11 +45,12 @@ export struct Card6Component { | ||
| 45 | Text(`${this.contentDTO.newsTitle}`) | 45 | Text(`${this.contentDTO.newsTitle}`) |
| 46 | .fontColor(this.clicked ? 0x848484 : 0x222222) | 46 | .fontColor(this.clicked ? 0x848484 : 0x222222) |
| 47 | .fontSize(16) | 47 | .fontSize(16) |
| 48 | + .lineHeight(24) | ||
| 48 | .fontWeight(FontWeight.Normal) | 49 | .fontWeight(FontWeight.Normal) |
| 49 | .maxLines(3) | 50 | .maxLines(3) |
| 50 | .alignSelf(ItemAlign.Start) | 51 | .alignSelf(ItemAlign.Start) |
| 51 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | 52 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 |
| 52 | - .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 60 : | 53 | + .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : |
| 53 | (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | 54 | (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || |
| 54 | this.contentDTO.objectType == '5' ? 30 : 0) | 55 | this.contentDTO.objectType == '5' ? 30 : 0) |
| 55 | }.alignContent(Alignment.TopStart) | 56 | }.alignContent(Alignment.TopStart) |
| @@ -70,7 +71,7 @@ export struct Card6Component { | @@ -70,7 +71,7 @@ export struct Card6Component { | ||
| 70 | .backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5) | 71 | .backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5) |
| 71 | .borderRadius(5) | 72 | .borderRadius(5) |
| 72 | .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) | 73 | .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) |
| 73 | - .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 80 : 180) | 74 | + .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78 : 156) |
| 74 | CardMediaInfo({ contentDTO: this.contentDTO }) | 75 | CardMediaInfo({ contentDTO: this.contentDTO }) |
| 75 | } | 76 | } |
| 76 | .alignContent(Alignment.BottomEnd) | 77 | .alignContent(Alignment.BottomEnd) |
| @@ -43,8 +43,11 @@ export struct Card9Component { | @@ -43,8 +43,11 @@ export struct Card9Component { | ||
| 43 | topRight: $r('app.float.image_border_radius') | 43 | topRight: $r('app.float.image_border_radius') |
| 44 | }) | 44 | }) |
| 45 | 45 | ||
| 46 | - Notes({ objectType: 5 }) | ||
| 47 | - .margin({ left: 5, bottom: 5 }) | 46 | + if (this.contentDTO.objectType == '5') { |
| 47 | + Notes({ objectType: 5 }) | ||
| 48 | + .margin({ left: 5, bottom: 5 }) | ||
| 49 | + } | ||
| 50 | + | ||
| 48 | }.alignContent(Alignment.BottomStart) | 51 | }.alignContent(Alignment.BottomStart) |
| 49 | 52 | ||
| 50 | // 时间线--后端返回三个, | 53 | // 时间线--后端返回三个, |
| @@ -13,10 +13,10 @@ export struct Notes { | @@ -13,10 +13,10 @@ export struct Notes { | ||
| 13 | build() { | 13 | build() { |
| 14 | if (this.returnTypeTitleFn()) { | 14 | if (this.returnTypeTitleFn()) { |
| 15 | Text(this.returnTypeTitleFn()) | 15 | Text(this.returnTypeTitleFn()) |
| 16 | - .fontSize($r('app.float.font_size_12')) | 16 | + .fontSize($r('app.float.font_size_11')) |
| 17 | .padding({ | 17 | .padding({ |
| 18 | - left: 5, | ||
| 19 | - right: 5, | 18 | + left: 4, |
| 19 | + right: 4, | ||
| 20 | top: 3, | 20 | top: 3, |
| 21 | bottom: 3 | 21 | bottom: 3 |
| 22 | }) | 22 | }) |
| @@ -20,6 +20,8 @@ export class publishCommentModel { | @@ -20,6 +20,8 @@ export class publishCommentModel { | ||
| 20 | targetType: string = '' | 20 | targetType: string = '' |
| 21 | /*评论总数*/ | 21 | /*评论总数*/ |
| 22 | totalCommentNumer: string = '0' | 22 | totalCommentNumer: string = '0' |
| 23 | + /// 游客评论开关:visitorComment 1:打开;0:关闭 | ||
| 24 | + visitorComment: string = "0" | ||
| 23 | 25 | ||
| 24 | //评论传参 | 26 | //评论传参 |
| 25 | /*评论图片url,多个逗号隔开*/ | 27 | /*评论图片url,多个逗号隔开*/ |
| @@ -8,9 +8,11 @@ import { HttpUtils } from 'wdNetwork/Index'; | @@ -8,9 +8,11 @@ import { HttpUtils } from 'wdNetwork/Index'; | ||
| 8 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 8 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 9 | import NoMoreLayout from '../../page/NoMoreLayout'; | 9 | import NoMoreLayout from '../../page/NoMoreLayout'; |
| 10 | import { EmptyComponent } from '../../view/EmptyComponent'; | 10 | import { EmptyComponent } from '../../view/EmptyComponent'; |
| 11 | +import { ContentDetailDTO, Params } from 'wdBean/Index'; | ||
| 11 | 12 | ||
| 12 | const TAG = 'CommentComponent'; | 13 | const TAG = 'CommentComponent'; |
| 13 | 14 | ||
| 15 | + | ||
| 14 | const testString = '因为读书的人\n是低着头向上看的人\n身处一隅,却能放眼世界\n2,因为读书的人\n总是比不读书的人\n活得有趣一点\n3,因为读书的人\n即使平凡,绝不平庸' | 16 | const testString = '因为读书的人\n是低着头向上看的人\n身处一隅,却能放眼世界\n2,因为读书的人\n总是比不读书的人\n活得有趣一点\n3,因为读书的人\n即使平凡,绝不平庸' |
| 15 | 17 | ||
| 16 | // @Entry | 18 | // @Entry |
| @@ -22,14 +24,20 @@ export struct CommentComponent { | @@ -22,14 +24,20 @@ export struct CommentComponent { | ||
| 22 | @State isComments: boolean = true | 24 | @State isComments: boolean = true |
| 23 | /*必传*/ | 25 | /*必传*/ |
| 24 | @ObjectLink publishCommentModel: publishCommentModel | 26 | @ObjectLink publishCommentModel: publishCommentModel |
| 27 | + @Consume contentDetailData: ContentDetailDTO | ||
| 25 | listScroller: ListScroller = new ListScroller(); // scroller控制器 | 28 | listScroller: ListScroller = new ListScroller(); // scroller控制器 |
| 26 | historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset | 29 | historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset |
| 27 | - isloading: boolean = false | ||
| 28 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); | 30 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); |
| 29 | @State dialogController: CustomDialogController | null = null; | 31 | @State dialogController: CustomDialogController | null = null; |
| 30 | 32 | ||
| 31 | // @State private browSingModel: commentListModel = new commentListModel() | 33 | // @State private browSingModel: commentListModel = new commentListModel() |
| 32 | 34 | ||
| 35 | + // 是否为固定高度模式。true时,里面上拉加载更多生效,外层不能包Scroll。 | ||
| 36 | + // false时,外层实现加载更多,并通过reachEndIncreament通知开发加载更多,reachEndLoadMoreFinish 通知上层加载更多完成 | ||
| 37 | + fixedHeightMode: boolean = false | ||
| 38 | + @Prop @Watch("parentOnReachEnd") reachEndIncreament : number = 0 | ||
| 39 | + reachEndLoadMoreFinish?: () => void | ||
| 40 | + | ||
| 33 | // 在自定义组件即将析构销毁时将dialogControlle置空 | 41 | // 在自定义组件即将析构销毁时将dialogControlle置空 |
| 34 | aboutToDisappear() { | 42 | aboutToDisappear() { |
| 35 | this.dialogController = null // 将dialogController置空 | 43 | this.dialogController = null // 将dialogController置空 |
| @@ -180,31 +188,52 @@ export struct CommentComponent { | @@ -180,31 +188,52 @@ export struct CommentComponent { | ||
| 180 | } | 188 | } |
| 181 | } | 189 | } |
| 182 | }, (item: commentItemModel, index: number) => JSON.stringify(item) + index.toString()) | 190 | }, (item: commentItemModel, index: number) => JSON.stringify(item) + index.toString()) |
| 183 | - | 191 | + |
| 184 | // 加载更多 | 192 | // 加载更多 |
| 185 | ListItem() { | 193 | ListItem() { |
| 186 | - if (this.hasMore === false) { | 194 | + if (this.hasMore == false) { |
| 187 | NoMoreLayout() | 195 | NoMoreLayout() |
| 188 | } | 196 | } |
| 189 | } | 197 | } |
| 190 | } | 198 | } |
| 191 | - | ||
| 192 | } | 199 | } |
| 200 | + .margin({bottom: 10}) | ||
| 193 | .onReachEnd(() => { | 201 | .onReachEnd(() => { |
| 202 | + if (!this.fixedHeightMode) { | ||
| 203 | + return | ||
| 204 | + } | ||
| 194 | if (this.hasMore) { | 205 | if (this.hasMore) { |
| 195 | this.getData() | 206 | this.getData() |
| 196 | } | 207 | } |
| 197 | }) | 208 | }) |
| 198 | - .enableScrollInteraction(false) | 209 | + .enableScrollInteraction(this.fixedHeightMode ? true: false) |
| 210 | + // .nestedScroll({ | ||
| 211 | + // scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 212 | + // scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 213 | + // }) | ||
| 199 | } | 214 | } |
| 200 | 215 | ||
| 201 | } | 216 | } |
| 202 | 217 | ||
| 218 | + parentOnReachEnd() { | ||
| 219 | + if (this.fixedHeightMode) { | ||
| 220 | + return | ||
| 221 | + } | ||
| 222 | + if (this.hasMore) { | ||
| 223 | + this.getData() | ||
| 224 | + } else { | ||
| 225 | + if (this.reachEndLoadMoreFinish) { | ||
| 226 | + this.reachEndLoadMoreFinish() | ||
| 227 | + } | ||
| 228 | + } | ||
| 229 | + } | ||
| 230 | + | ||
| 203 | //获取数据 | 231 | //获取数据 |
| 204 | async getData() { | 232 | async getData() { |
| 205 | commentViewModel.fetchContentCommentList(this.currentPage + '', this.publishCommentModel.targetId, | 233 | commentViewModel.fetchContentCommentList(this.currentPage + '', this.publishCommentModel.targetId, |
| 206 | this.publishCommentModel.targetType) | 234 | this.publishCommentModel.targetType) |
| 207 | .then(commentListModel => { | 235 | .then(commentListModel => { |
| 236 | + console.log('评论:', JSON.stringify(commentListModel.list)) | ||
| 208 | this.currentPage++ | 237 | this.currentPage++ |
| 209 | 238 | ||
| 210 | if (Number.parseInt(commentListModel.totalCommentNum) > | 239 | if (Number.parseInt(commentListModel.totalCommentNum) > |
| @@ -237,6 +266,9 @@ export struct CommentComponent { | @@ -237,6 +266,9 @@ export struct CommentComponent { | ||
| 237 | } else { | 266 | } else { |
| 238 | this.hasMore = false | 267 | this.hasMore = false |
| 239 | } | 268 | } |
| 269 | + if (!this.fixedHeightMode && this.reachEndLoadMoreFinish) { | ||
| 270 | + this.reachEndLoadMoreFinish() | ||
| 271 | + } | ||
| 240 | }) | 272 | }) |
| 241 | } | 273 | } |
| 242 | } | 274 | } |
| @@ -247,6 +279,7 @@ struct ChildCommentItem { | @@ -247,6 +279,7 @@ struct ChildCommentItem { | ||
| 247 | @Link publishCommentModel: publishCommentModel | 279 | @Link publishCommentModel: publishCommentModel |
| 248 | @Link dialogController: CustomDialogController | null | 280 | @Link dialogController: CustomDialogController | null |
| 249 | @ObjectLink item: commentItemModel | 281 | @ObjectLink item: commentItemModel |
| 282 | + @Consume contentDetailData: ContentDetailDTO | ||
| 250 | 283 | ||
| 251 | build() { | 284 | build() { |
| 252 | Column() { | 285 | Column() { |
| @@ -271,6 +304,14 @@ struct ChildCommentItem { | @@ -271,6 +304,14 @@ struct ChildCommentItem { | ||
| 271 | .alignContent(Alignment.Center) | 304 | .alignContent(Alignment.Center) |
| 272 | .onClick(() => { | 305 | .onClick(() => { |
| 273 | // TODO 跳转个人详情 | 306 | // TODO 跳转个人详情 |
| 307 | + // 跳转到号主页 | ||
| 308 | + if (this.contentDetailData.rmhInfo?.cnMainControl === 1) { | ||
| 309 | + const params: Params = { | ||
| 310 | + creatorId: this.contentDetailData.rmhInfo.rmhId, | ||
| 311 | + pageID: '' | ||
| 312 | + } | ||
| 313 | + WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) | ||
| 314 | + } | ||
| 274 | }) | 315 | }) |
| 275 | 316 | ||
| 276 | //昵称 | 317 | //昵称 |
| @@ -455,7 +496,7 @@ struct commentHeaderView { | @@ -455,7 +496,7 @@ struct commentHeaderView { | ||
| 455 | .margin({ left: 8 }) | 496 | .margin({ left: 8 }) |
| 456 | .alignContent(Alignment.Center) | 497 | .alignContent(Alignment.Center) |
| 457 | .onClick(() => { | 498 | .onClick(() => { |
| 458 | - // TODO 跳转个人详情 | 499 | + commentViewModel.jumpToAccountPage(this.item) |
| 459 | }) | 500 | }) |
| 460 | 501 | ||
| 461 | //昵称 | 502 | //昵称 |
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentListDialog.ets
0 → 100644
| 1 | +import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index' | ||
| 2 | +import { publishCommentModel } from '../model/PublishCommentModel' | ||
| 3 | + | ||
| 4 | +@CustomDialog | ||
| 5 | +export struct CommentListDialog { | ||
| 6 | + | ||
| 7 | + /// 内部使用 | ||
| 8 | + private publishCommentModel: publishCommentModel = new publishCommentModel() | ||
| 9 | + controller?: CustomDialogController | ||
| 10 | + | ||
| 11 | + /// 外部初始化 | ||
| 12 | + contentDetail?: ContentDetailDTO | ||
| 13 | + pageInfo?: PageInfoDTO | ||
| 14 | + | ||
| 15 | + build() { | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + | ||
| 19 | +} |
| @@ -11,11 +11,12 @@ export struct CommentTabComponent { | @@ -11,11 +11,12 @@ export struct CommentTabComponent { | ||
| 11 | } | 11 | } |
| 12 | @ObjectLink publishCommentModel: publishCommentModel | 12 | @ObjectLink publishCommentModel: publishCommentModel |
| 13 | @Prop contentDetail: ContentDetailDTO | 13 | @Prop contentDetail: ContentDetailDTO |
| 14 | + @Prop pageComponentType: number = -1 //1:视频详情页 | ||
| 14 | /*展示类型*/ | 15 | /*展示类型*/ |
| 15 | @State type: number = 1 | 16 | @State type: number = 1 |
| 16 | @State placeHolder: string = '说两句...' | 17 | @State placeHolder: string = '说两句...' |
| 17 | @State dialogController: CustomDialogController | null = null; | 18 | @State dialogController: CustomDialogController | null = null; |
| 18 | - styleType : number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) | 19 | + styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) |
| 19 | /*回调方法*/ | 20 | /*回调方法*/ |
| 20 | dialogControllerConfirm: () => void = () => { | 21 | dialogControllerConfirm: () => void = () => { |
| 21 | } | 22 | } |
| @@ -46,16 +47,44 @@ export struct CommentTabComponent { | @@ -46,16 +47,44 @@ export struct CommentTabComponent { | ||
| 46 | Row() { | 47 | Row() { |
| 47 | Stack({ alignContent: Alignment.Start }) { | 48 | Stack({ alignContent: Alignment.Start }) { |
| 48 | RelativeContainer() { | 49 | RelativeContainer() { |
| 49 | - Image($r('app.media.comment_img_input_hui')) | ||
| 50 | - .objectFit(ImageFit.Fill) | ||
| 51 | - .resizable({ slice: { top: 1, left: 1, right: 20, bottom: 1 } }) | 50 | + |
| 51 | + if (this.pageComponentType === 1) { | ||
| 52 | + Row() { | ||
| 53 | + | ||
| 54 | + } | ||
| 55 | + .width('100%') | ||
| 56 | + .height(30) | ||
| 57 | + .borderRadius(2) | ||
| 58 | + .backgroundColor(this.pageComponentType === 1 ? '#1a1a1a' : Color.Transparent) | ||
| 59 | + .margin({ | ||
| 60 | + right: 16, | ||
| 61 | + }) | ||
| 52 | .alignRules({ | 62 | .alignRules({ |
| 53 | top: { anchor: "__container__", align: VerticalAlign.Top }, | 63 | top: { anchor: "__container__", align: VerticalAlign.Top }, |
| 54 | left: { anchor: "__container__", align: HorizontalAlign.Start }, | 64 | left: { anchor: "__container__", align: HorizontalAlign.Start }, |
| 55 | right: { anchor: "__container__", align: HorizontalAlign.End }, | 65 | right: { anchor: "__container__", align: HorizontalAlign.End }, |
| 56 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | 66 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, |
| 57 | }) | 67 | }) |
| 58 | - .id("Image") | 68 | + .id("RowBg") |
| 69 | + } else { | ||
| 70 | + Image($r('app.media.comment_img_input_hui')) | ||
| 71 | + .objectFit(ImageFit.Fill) | ||
| 72 | + .resizable({ | ||
| 73 | + slice: { | ||
| 74 | + top: 1, | ||
| 75 | + left: 1, | ||
| 76 | + right: 20, | ||
| 77 | + bottom: 1 | ||
| 78 | + } | ||
| 79 | + }) | ||
| 80 | + .alignRules({ | ||
| 81 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 82 | + left: { anchor: "__container__", align: HorizontalAlign.Start }, | ||
| 83 | + right: { anchor: "__container__", align: HorizontalAlign.End }, | ||
| 84 | + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | ||
| 85 | + }) | ||
| 86 | + .id("Image") | ||
| 87 | + } | ||
| 59 | Text(this.placeHolder) | 88 | Text(this.placeHolder) |
| 60 | .fontSize(12) | 89 | .fontSize(12) |
| 61 | .fontColor('#999999') | 90 | .fontColor('#999999') |
| @@ -91,7 +120,7 @@ export struct CommentIconComponent { | @@ -91,7 +120,7 @@ export struct CommentIconComponent { | ||
| 91 | @ObjectLink publishCommentModel: publishCommentModel | 120 | @ObjectLink publishCommentModel: publishCommentModel |
| 92 | /*展示类型*/ | 121 | /*展示类型*/ |
| 93 | @State type: number = 1 | 122 | @State type: number = 1 |
| 94 | - styleType : number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) | 123 | + styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) |
| 95 | // aboutToAppear(): void { | 124 | // aboutToAppear(): void { |
| 96 | // setTimeout(() => { | 125 | // setTimeout(() => { |
| 97 | // this.publishCommentModel.totalCommentNumer = '444' | 126 | // this.publishCommentModel.totalCommentNumer = '444' |
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/QualityCommentsComponent.ets
| @@ -412,33 +412,7 @@ struct QualityCommentItem { | @@ -412,33 +412,7 @@ struct QualityCommentItem { | ||
| 412 | 412 | ||
| 413 | jumpToAccountOwner() { | 413 | jumpToAccountOwner() { |
| 414 | 414 | ||
| 415 | - let url = HttpUrlUtils.getOtherUserDetailDataUrl() | ||
| 416 | - let item : Record<string, string >= { | ||
| 417 | - "creatorId": this.item.fromCreatorId || "", | ||
| 418 | - "userType": `${this.item.fromUserType}`, | ||
| 419 | - "userId": this.item.fromUserId || "-1", | ||
| 420 | - } | ||
| 421 | - HttpBizUtil.post<ResponseDTO<MasterDetailRes>>(url, item).then((result) => { | ||
| 422 | - if (!result.data || result.data.mainControl != 1) { | ||
| 423 | - ToastUtils.longToast("暂时无法查看该创作者主页") | ||
| 424 | - return | ||
| 425 | - } | ||
| 426 | - | ||
| 427 | - if (result.data.banControl == 1) { | ||
| 428 | - ToastUtils.longToast("该账号已封禁,不予访问") | ||
| 429 | - return | ||
| 430 | - } | ||
| 431 | - | ||
| 432 | - if (result.data.userType === "1") { // 普通用户 | ||
| 433 | - let params: Record<string, string> = {'userId': result.data.userId}; | ||
| 434 | - WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params) | ||
| 435 | - } else { // 非普通用户 | ||
| 436 | - ProcessUtils.gotoPeopleShipHomePage(result.data.creatorId) | ||
| 437 | - } | ||
| 438 | - | ||
| 439 | - }).catch(() => { | ||
| 440 | - ToastUtils.longToast("暂时无法查看该创作者主页") | ||
| 441 | - }) | 415 | + commentViewModel.jumpToAccountPage(this.item) |
| 442 | } | 416 | } |
| 443 | 417 | ||
| 444 | jumpToDetail() { | 418 | jumpToDetail() { |
| 1 | +import { MasterDetailRes } from 'wdBean/Index'; | ||
| 1 | import { SpConstants } from 'wdConstant/Index'; | 2 | import { SpConstants } from 'wdConstant/Index'; |
| 2 | -import { DateTimeUtils, Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit/Index'; | 3 | +import { |
| 4 | + AccountManagerUtils, | ||
| 5 | + DateTimeUtils, DeviceUtil, Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit/Index'; | ||
| 3 | import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index'; | 6 | import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index'; |
| 4 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | 7 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; |
| 8 | +import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 5 | import { | 9 | import { |
| 6 | commentItemModel, | 10 | commentItemModel, |
| 7 | commentListModel, | 11 | commentListModel, |
| @@ -160,7 +164,9 @@ class CommentViewModel { | @@ -160,7 +164,9 @@ class CommentViewModel { | ||
| 160 | publishComment(model: publishCommentModel) { | 164 | publishComment(model: publishCommentModel) { |
| 161 | 165 | ||
| 162 | return new Promise<commentItemModel>((success, fail) => { | 166 | return new Promise<commentItemModel>((success, fail) => { |
| 163 | - let url = HttpUrlUtils.getPublishCommentUrl() | 167 | + const visitorMode = model.visitorComment == "1" && AccountManagerUtils.isLoginSync() == false |
| 168 | + let url = visitorMode ? HttpUrlUtils.getNoUserPublishCommentUrl() : HttpUrlUtils.getPublishCommentUrl() | ||
| 169 | + | ||
| 164 | let bean: Record<string, string> = {}; | 170 | let bean: Record<string, string> = {}; |
| 165 | 171 | ||
| 166 | bean['targetId'] = model.targetId; | 172 | bean['targetId'] = model.targetId; |
| @@ -176,6 +182,11 @@ class CommentViewModel { | @@ -176,6 +182,11 @@ class CommentViewModel { | ||
| 176 | bean['targetType'] = model.targetType | 182 | bean['targetType'] = model.targetType |
| 177 | bean['parentId'] = model.parentId | 183 | bean['parentId'] = model.parentId |
| 178 | 184 | ||
| 185 | + if (visitorMode) { | ||
| 186 | + bean['deviceId'] = DeviceUtil.clientId() | ||
| 187 | + bean['userName'] = SPHelper.default.getSync(SpConstants.TOURIST_NICK_NAME, "") as string | ||
| 188 | + } | ||
| 189 | + | ||
| 179 | HttpRequest.post<ResponseDTO<commentItemModel>>(url, bean).then((data: ResponseDTO<commentItemModel>) => { | 190 | HttpRequest.post<ResponseDTO<commentItemModel>>(url, bean).then((data: ResponseDTO<commentItemModel>) => { |
| 180 | if (data.code != 0) { | 191 | if (data.code != 0) { |
| 181 | ToastUtils.showToast(data.message, 1000); | 192 | ToastUtils.showToast(data.message, 1000); |
| @@ -185,10 +196,9 @@ class CommentViewModel { | @@ -185,10 +196,9 @@ class CommentViewModel { | ||
| 185 | ToastUtils.showToast(data.message, 1000); | 196 | ToastUtils.showToast(data.message, 1000); |
| 186 | let model = data.data as commentItemModel | 197 | let model = data.data as commentItemModel |
| 187 | 198 | ||
| 188 | - let userId = HttpUtils.getUserId() | ||
| 189 | - let FIRSTCOMMENTTIME = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, '') | 199 | + let firstCommentTime = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, '') as string |
| 190 | 200 | ||
| 191 | - if (!userId && !FIRSTCOMMENTTIME) { | 201 | + if (visitorMode && firstCommentTime.length == 0) { |
| 192 | //保存首次评论时间 | 202 | //保存首次评论时间 |
| 193 | SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, DateTimeUtils.formatDate(data.timestamp, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) | 203 | SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, DateTimeUtils.formatDate(data.timestamp, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) |
| 194 | } | 204 | } |
| @@ -472,6 +482,36 @@ class CommentViewModel { | @@ -472,6 +482,36 @@ class CommentViewModel { | ||
| 472 | } | 482 | } |
| 473 | return false | 483 | return false |
| 474 | } | 484 | } |
| 485 | + | ||
| 486 | + jumpToAccountPage(commentItem: commentItemModel) { | ||
| 487 | + let url = HttpUrlUtils.getOtherUserDetailDataUrl() | ||
| 488 | + let item : Record<string, string >= { | ||
| 489 | + "creatorId": commentItem.fromCreatorId || "", | ||
| 490 | + "userType": `${commentItem.fromUserType}`, | ||
| 491 | + "userId": commentItem.fromUserId || "-1", | ||
| 492 | + } | ||
| 493 | + HttpBizUtil.post<ResponseDTO<MasterDetailRes>>(url, item).then((result) => { | ||
| 494 | + if (!result.data || result.data.mainControl != 1) { | ||
| 495 | + ToastUtils.longToast("暂时无法查看该创作者主页") | ||
| 496 | + return | ||
| 497 | + } | ||
| 498 | + | ||
| 499 | + if (result.data.banControl == 1) { | ||
| 500 | + ToastUtils.longToast("该账号已封禁,不予访问") | ||
| 501 | + return | ||
| 502 | + } | ||
| 503 | + | ||
| 504 | + if (result.data.userType === "1") { // 普通用户 | ||
| 505 | + let params: Record<string, string> = {'userId': result.data.userId}; | ||
| 506 | + WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params) | ||
| 507 | + } else { // 非普通用户 | ||
| 508 | + ProcessUtils.gotoPeopleShipHomePage(result.data.creatorId) | ||
| 509 | + } | ||
| 510 | + | ||
| 511 | + }).catch(() => { | ||
| 512 | + ToastUtils.longToast("暂时无法查看该创作者主页") | ||
| 513 | + }) | ||
| 514 | + } | ||
| 475 | } | 515 | } |
| 476 | 516 | ||
| 477 | 517 |
| @@ -214,7 +214,7 @@ struct CarouselLayout01CardView { | @@ -214,7 +214,7 @@ struct CarouselLayout01CardView { | ||
| 214 | .align(Alignment.Bottom) | 214 | .align(Alignment.Bottom) |
| 215 | .maxLines(CompUtils.MAX_LINES_2) | 215 | .maxLines(CompUtils.MAX_LINES_2) |
| 216 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 216 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 217 | - .textIndent(this.item.objectType == '5' ? 40 : 0) | 217 | + .textIndent(this.item.objectType == '5' ? 35 : 0) |
| 218 | } | 218 | } |
| 219 | // .height(39) | 219 | // .height(39) |
| 220 | .padding({ | 220 | .padding({ |
| @@ -231,7 +231,7 @@ struct CarouselLayout01CardView { | @@ -231,7 +231,7 @@ struct CarouselLayout01CardView { | ||
| 231 | .height(CommonConstants.FULL_PARENT) | 231 | .height(CommonConstants.FULL_PARENT) |
| 232 | } | 232 | } |
| 233 | .width(CommonConstants.FULL_WIDTH) | 233 | .width(CommonConstants.FULL_WIDTH) |
| 234 | - .aspectRatio(CompUtils.ASPECT_RATIO_2_1) | 234 | + .aspectRatio(CompUtils.ASPECT_RATIO_16_9) |
| 235 | .alignContent(Alignment.BottomStart) | 235 | .alignContent(Alignment.BottomStart) |
| 236 | .hoverEffect(HoverEffect.Scale) | 236 | .hoverEffect(HoverEffect.Scale) |
| 237 | } | 237 | } |
| @@ -40,6 +40,7 @@ export struct ZhSingleRow03 { | @@ -40,6 +40,7 @@ export struct ZhSingleRow03 { | ||
| 40 | 40 | ||
| 41 | // 请求所有预约状态 | 41 | // 请求所有预约状态 |
| 42 | async getReserveState() { | 42 | async getReserveState() { |
| 43 | + this.reservedIds = [] | ||
| 43 | const reserveBean: reserveReqItem[] = this.compDTO.operDataList.map((item: ContentDTO) => { | 44 | const reserveBean: reserveReqItem[] = this.compDTO.operDataList.map((item: ContentDTO) => { |
| 44 | const reqItem: reserveReqItem = { | 45 | const reqItem: reserveReqItem = { |
| 45 | liveId: item.objectId.toString(), | 46 | liveId: item.objectId.toString(), |
| 1 | -import { commentInfo, CompDTO, ContentDTO, Params } from 'wdBean'; | 1 | +import { commentInfo, CompDTO, ContentDTO, Params, batchLikeAndCollectResult } from 'wdBean'; |
| 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 3 | -import { DateTimeUtils, SPHelper } from 'wdKit/Index'; | 3 | +import { DateTimeUtils, SPHelper, Logger } from 'wdKit/Index'; |
| 4 | import { ProcessUtils } from 'wdRouter'; | 4 | import { ProcessUtils } from 'wdRouter'; |
| 5 | import { SpConstants } from 'wdConstant/Index' | 5 | import { SpConstants } from 'wdConstant/Index' |
| 6 | +import { | ||
| 7 | + batchLikeAndCollectParams, | ||
| 8 | +} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | ||
| 9 | +import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'; | ||
| 10 | +import commentViewModel from '../../components/comment/viewmodel/CommentViewModel'; | ||
| 11 | +import { commentItemModel } from '../../components/comment/model/CommentModel' | ||
| 6 | 12 | ||
| 7 | /** | 13 | /** |
| 8 | * 精选评论卡 | 14 | * 精选评论卡 |
| 9 | * Zh_Single_Row-06 | 15 | * Zh_Single_Row-06 |
| 10 | */ | 16 | */ |
| 11 | const TAG = 'Zh_Single_Row-06' | 17 | const TAG = 'Zh_Single_Row-06' |
| 12 | - | ||
| 13 | -// interface commentInfo { | ||
| 14 | -// commentTitle: string, | ||
| 15 | -// newsTitle: string, | ||
| 16 | -// userName: string, | ||
| 17 | -// userHeaderUrl: string, | ||
| 18 | -// publishTime: number | ||
| 19 | -// } | ||
| 20 | -// interface operDataListItem { | ||
| 21 | -// commentInfo: commentInfo | ||
| 22 | -// } | ||
| 23 | -// interface CommentData{ | ||
| 24 | -// operDataList: Array<operDataListItem> | ||
| 25 | -// } | ||
| 26 | - | ||
| 27 | @Entry | 18 | @Entry |
| 28 | @Component | 19 | @Component |
| 29 | export struct ZhSingleRow06 { | 20 | export struct ZhSingleRow06 { |
| 30 | @State compDTO: CompDTO = {} as CompDTO | 21 | @State compDTO: CompDTO = {} as CompDTO |
| 31 | - @State likeBl: boolean = false; | 22 | + @State newsStatusOfUser: batchLikeAndCollectResult = { |
| 23 | + likeStatus: '0' | ||
| 24 | + } as batchLikeAndCollectResult // 点赞、收藏状态 | ||
| 25 | + | ||
| 26 | + aboutToAppear(): void { | ||
| 27 | + this.getInteractDataStatus() | ||
| 28 | + } | ||
| 32 | 29 | ||
| 33 | - async likeAction() { | 30 | + /** |
| 31 | + * 点赞、取消点赞 | ||
| 32 | + */ | ||
| 33 | + async toggleLikeStatus() { | ||
| 34 | + // 未登录,跳转登录 | ||
| 34 | const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | 35 | const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') |
| 35 | if (!user_id) { | 36 | if (!user_id) { |
| 36 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 37 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 37 | return | 38 | return |
| 38 | } | 39 | } |
| 39 | 40 | ||
| 40 | - if (this.likeBl) { | ||
| 41 | - this.likeBl = false; | ||
| 42 | - } else { | ||
| 43 | - this.likeBl = true; | 41 | + const commentInfo = this.compDTO.operDataList[0]?.commentInfo as commentInfo; |
| 42 | + // commentLikeChange(this.item) | ||
| 43 | + this.newsStatusOfUser.likeStatus = this.newsStatusOfUser.likeStatus === '1' ? '0' : '1'; | ||
| 44 | + const commentLikeParam = { | ||
| 45 | + targetId: commentInfo.newsId || '', | ||
| 46 | + id: commentInfo.commentId, | ||
| 47 | + targetType: commentInfo?.objectType || '', | ||
| 48 | + api_status: this.newsStatusOfUser?.likeStatus == '1' ? false : true | ||
| 49 | + } as commentItemModel; | ||
| 50 | + commentViewModel.commentLike(commentLikeParam).then(() => { | ||
| 51 | + }).catch(() => { | ||
| 52 | + this.newsStatusOfUser.likeStatus = this.newsStatusOfUser.likeStatus === '1' ? '0' : '1'; | ||
| 53 | + }) | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + // 已登录->查询用户对作品点赞、收藏状态 | ||
| 57 | + async getInteractDataStatus() { | ||
| 58 | + // 未登录,跳转登录 | ||
| 59 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 60 | + if (!user_id) { | ||
| 61 | + return | ||
| 62 | + } | ||
| 63 | + try { | ||
| 64 | + const params: batchLikeAndCollectParams = { | ||
| 65 | + contentList: [ | ||
| 66 | + { | ||
| 67 | + contentId: this.compDTO.operDataList[0]?.commentInfo?.newsId + '', | ||
| 68 | + contentType: this.compDTO.operDataList[0]?.commentInfo?.newsType + '', | ||
| 69 | + } | ||
| 70 | + ] | ||
| 71 | + } | ||
| 72 | + let data = await MultiPictureDetailViewModel.getInteractDataStatus(params) | ||
| 73 | + Logger.info(TAG, 'ZhSingleRow06-data', JSON.stringify(data)) | ||
| 74 | + this.newsStatusOfUser = data[0]; | ||
| 75 | + Logger.info(TAG, `ZhSingleRow06-newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`) | ||
| 76 | + } catch (exception) { | ||
| 77 | + console.error(TAG, JSON.stringify(exception)) | ||
| 44 | } | 78 | } |
| 45 | } | 79 | } |
| 46 | 80 | ||
| @@ -95,7 +129,7 @@ export struct ZhSingleRow06 { | @@ -95,7 +129,7 @@ export struct ZhSingleRow06 { | ||
| 95 | .fontColor(0x999999) | 129 | .fontColor(0x999999) |
| 96 | 130 | ||
| 97 | Row(){ | 131 | Row(){ |
| 98 | - Image(this.likeBl ? $r('app.media.icon_like_select') : $r('app.media.icon_like')) | 132 | + Image(Number(this.newsStatusOfUser?.likeStatus) == 1 ? $r('app.media.icon_like_select') : $r('app.media.icon_like')) |
| 99 | .width(16) | 133 | .width(16) |
| 100 | .height(16) | 134 | .height(16) |
| 101 | .margin({right: 3}) | 135 | .margin({right: 3}) |
| @@ -103,9 +137,11 @@ export struct ZhSingleRow06 { | @@ -103,9 +137,11 @@ export struct ZhSingleRow06 { | ||
| 103 | Text('点赞') | 137 | Text('点赞') |
| 104 | .fontSize(15) | 138 | .fontSize(15) |
| 105 | .fontColor(0x999999) | 139 | .fontColor(0x999999) |
| 140 | + .onClick(() => { | ||
| 141 | + }) | ||
| 106 | } | 142 | } |
| 107 | .onClick(() => { | 143 | .onClick(() => { |
| 108 | - this.likeAction() | 144 | + this.toggleLikeStatus() |
| 109 | }) | 145 | }) |
| 110 | } | 146 | } |
| 111 | .justifyContent(FlexAlign.SpaceBetween) | 147 | .justifyContent(FlexAlign.SpaceBetween) |
sight_harmony/features/wdComponent/src/main/ets/components/likeAnimation/LikeAnimationView.ets
0 → 100644
| 1 | +/** | ||
| 2 | + * 直播页面点赞动画 | ||
| 3 | + */ | ||
| 4 | + | ||
| 5 | +interface animationItem { | ||
| 6 | + x: string | number; | ||
| 7 | + y: string | number; | ||
| 8 | + opacity: number; | ||
| 9 | + name: string; | ||
| 10 | + key: string; | ||
| 11 | + url: Resource | ||
| 12 | +} | ||
| 13 | + | ||
| 14 | +@Component | ||
| 15 | +export struct LikeAnimationView { | ||
| 16 | + @State @Watch('countChange') count: number = 0 | ||
| 17 | + @State imgList: Resource[] = | ||
| 18 | + [$r('app.media.like_animation_1'), $r('app.media.like_animation_2'), $r('app.media.like_animation_3')] | ||
| 19 | + @State animationList: animationItem[] = [] | ||
| 20 | + | ||
| 21 | + countChange() { | ||
| 22 | + this.animationList.push({ | ||
| 23 | + name: 'xxxx', | ||
| 24 | + x: 0, | ||
| 25 | + y: 0, | ||
| 26 | + opacity: 1, | ||
| 27 | + key: Math.random() + '', | ||
| 28 | + url: this.getRandomUrl() | ||
| 29 | + | ||
| 30 | + }) | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + getRandomUrl(): Resource { | ||
| 34 | + if (Math.random() >= 0 && Math.random() >= 0.33) { | ||
| 35 | + return this.imgList[0] | ||
| 36 | + } else if (Math.random() >= 0.33 && Math.random() >= 0.66) { | ||
| 37 | + return this.imgList[1] | ||
| 38 | + } else { | ||
| 39 | + return this.imgList[2] | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + startAnimation() { | ||
| 44 | + | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + stopAnimation() { | ||
| 48 | + | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + aboutToAppear(): void { | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + aboutToDisappear(): void { | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + build() { | ||
| 58 | + Stack() { | ||
| 59 | + ForEach(this.animationList, (item: animationItem) => { | ||
| 60 | + Image(item.url) | ||
| 61 | + .width(48) | ||
| 62 | + .height(48) | ||
| 63 | + }, (item: animationItem) => item.key) | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + } | ||
| 67 | +} |
| 1 | -import lottie, { AnimationSegment } from '@ohos/lottie'; | 1 | +import lottie, { AnimationItem, AnimationSegment } from '@ohos/lottie'; |
| 2 | 2 | ||
| 3 | @Component | 3 | @Component |
| 4 | export struct LottieView { | 4 | export struct LottieView { |
| 5 | - @Prop name: string = '' | ||
| 6 | - @Prop path: string = '' | ||
| 7 | - @Prop lottieWidth?: number = 30 | ||
| 8 | - @Prop lottieHeight?: number = 30 | ||
| 9 | - @Prop autoplay?: boolean = false | ||
| 10 | - @Prop loop?: boolean = false | 5 | + @Prop name: string |
| 6 | + @Prop path: string | ||
| 7 | + @Prop lottieWidth: number = 30 | ||
| 8 | + @Prop lottieHeight: number = 30 | ||
| 9 | + @Prop autoplay: boolean = false | ||
| 10 | + @Prop loop: boolean = false | ||
| 11 | @Prop initialSegment?: AnimationSegment = [0, 120] // 动画起始帧 | 11 | @Prop initialSegment?: AnimationSegment = [0, 120] // 动画起始帧 |
| 12 | - @Prop onReady: (animateItem: ESObject) => void // 动画初始化完成事件 | 12 | + @Prop onReady: (animateItem: AnimationItem | null) => void // 动画初始化完成事件 |
| 13 | @Prop onComplete?: () => void // 动画完成事件 | 13 | @Prop onComplete?: () => void // 动画完成事件 |
| 14 | - private politeChickyController: CanvasRenderingContext2D = new CanvasRenderingContext2D(); // CanvasRenderingContext2D对象 | ||
| 15 | - private animateItem: ESObject = null; // 初始化loadAnimation接口的返回对象 | 14 | + private politeChickyController: CanvasRenderingContext2D = |
| 15 | + new CanvasRenderingContext2D(); // CanvasRenderingContext2D对象 | ||
| 16 | + private animateItem: AnimationItem | null = null; // 初始化loadAnimation接口的返回对象 | ||
| 16 | 17 | ||
| 17 | // 页面隐藏销毁动画 | 18 | // 页面隐藏销毁动画 |
| 18 | onPageHide(): void { | 19 | onPageHide(): void { |
| 19 | - this.animateItem.destroy() | 20 | + this.animateItem?.destroy() |
| 20 | 21 | ||
| 21 | if (this.onComplete) { | 22 | if (this.onComplete) { |
| 22 | - this.animateItem.removeEventListener('complete', this.onComplete) | 23 | + this.animateItem?.removeEventListener('complete', this.onComplete) |
| 23 | } | 24 | } |
| 24 | } | 25 | } |
| 25 | 26 | ||
| @@ -44,7 +45,7 @@ export struct LottieView { | @@ -44,7 +45,7 @@ export struct LottieView { | ||
| 44 | // initialSegment: this.initialSegment | 45 | // initialSegment: this.initialSegment |
| 45 | }) | 46 | }) |
| 46 | if (this.initialSegment) { | 47 | if (this.initialSegment) { |
| 47 | - this.animateItem.initialSegment = this.initialSegment | 48 | + this.animateItem.segments = this.initialSegment |
| 48 | } | 49 | } |
| 49 | 50 | ||
| 50 | if (this.onComplete) { | 51 | if (this.onComplete) { |
| @@ -57,7 +58,7 @@ export struct LottieView { | @@ -57,7 +58,7 @@ export struct LottieView { | ||
| 57 | Stack({ alignContent: Alignment.TopStart }) { | 58 | Stack({ alignContent: Alignment.TopStart }) { |
| 58 | Canvas(this.politeChickyController) | 59 | Canvas(this.politeChickyController) |
| 59 | .width(this.lottieWidth) | 60 | .width(this.lottieWidth) |
| 60 | - .height(this.lottieHeight) | 61 | + .height(this.lottieHeight)// .backgroundColor(Color.Black) |
| 61 | .onReady(() => { | 62 | .onReady(() => { |
| 62 | this.loadAnimation(); | 63 | this.loadAnimation(); |
| 63 | if (this.onReady) { | 64 | if (this.onReady) { |
| @@ -65,7 +66,7 @@ export struct LottieView { | @@ -65,7 +66,7 @@ export struct LottieView { | ||
| 65 | } | 66 | } |
| 66 | }) | 67 | }) |
| 67 | .onClick(() => { | 68 | .onClick(() => { |
| 68 | - this.animateItem.play() | 69 | + this.animateItem?.play() |
| 69 | }) | 70 | }) |
| 70 | } | 71 | } |
| 71 | } | 72 | } |
| 1 | import MinePageMoreFunctionModel from '../../viewmodel/MinePageMoreFunctionModel' | 1 | import MinePageMoreFunctionModel from '../../viewmodel/MinePageMoreFunctionModel' |
| 2 | -import { WDRouterRule, WDRouterPage } from 'wdRouter' | 2 | +import { WDRouterRule, WDRouterPage, ProcessUtils } from 'wdRouter' |
| 3 | import { Params } from 'wdBean'; | 3 | import { Params } from 'wdBean'; |
| 4 | import { ToastUtils } from 'wdKit/Index'; | 4 | import { ToastUtils } from 'wdKit/Index'; |
| 5 | 5 | ||
| @@ -77,7 +77,7 @@ export default struct MinePageMoreFunctionUI { | @@ -77,7 +77,7 @@ export default struct MinePageMoreFunctionUI { | ||
| 77 | }else if (item.msg == "关于") { // 关于 | 77 | }else if (item.msg == "关于") { // 关于 |
| 78 | WDRouterRule.jumpWithPage(WDRouterPage.aboutPage) | 78 | WDRouterRule.jumpWithPage(WDRouterPage.aboutPage) |
| 79 | }else if (item.msg == "意见反馈") { // 关于 | 79 | }else if (item.msg == "意见反馈") { // 关于 |
| 80 | - ToastUtils.shortToast("待开发") | 80 | + ProcessUtils.gotoFeedBackActivity() |
| 81 | } | 81 | } |
| 82 | }) | 82 | }) |
| 83 | .height('117lpx') | 83 | .height('117lpx') |
| 1 | import { WDRouterRule, WDRouterPage } from 'wdRouter' | 1 | import { WDRouterRule, WDRouterPage } from 'wdRouter' |
| 2 | +import MinePageDatasModel from '../../model/MinePageDatasModel' | ||
| 2 | import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem' | 3 | import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem' |
| 4 | +import { PagePersonFunction } from './PagePersonFunction' | ||
| 3 | 5 | ||
| 6 | + | ||
| 7 | +const TAG = "MinePagePersonFunctionUI" | ||
| 4 | @Component | 8 | @Component |
| 5 | export default struct MinePagePersonFunctionUI { | 9 | export default struct MinePagePersonFunctionUI { |
| 6 | @Link personalData:MinePagePersonalFunctionsItem[] | 10 | @Link personalData:MinePagePersonalFunctionsItem[] |
| @@ -10,30 +14,7 @@ export default struct MinePagePersonFunctionUI { | @@ -10,30 +14,7 @@ export default struct MinePagePersonFunctionUI { | ||
| 10 | Grid(){ | 14 | Grid(){ |
| 11 | ForEach(this.personalData,(item:MinePagePersonalFunctionsItem,index:number)=>{ | 15 | ForEach(this.personalData,(item:MinePagePersonalFunctionsItem,index:number)=>{ |
| 12 | GridItem(){ | 16 | GridItem(){ |
| 13 | - Row(){ | ||
| 14 | - Column(){ | ||
| 15 | - Image(item.imgSrc) | ||
| 16 | - .width('46lpx') | ||
| 17 | - .height('46lpx') | ||
| 18 | - .objectFit(ImageFit.Auto) | ||
| 19 | - .interpolation(ImageInterpolation.High) | ||
| 20 | - Text(`${item.msg}`) | ||
| 21 | - .margin({top:'8lpx'}) | ||
| 22 | - .height('23lpx') | ||
| 23 | - .fontColor($r('app.color.color_222222')) | ||
| 24 | - .fontSize('23lpx') | ||
| 25 | - } | ||
| 26 | - .alignItems(HorizontalAlign.Center) | ||
| 27 | - .width('100%') | ||
| 28 | - Blank() | ||
| 29 | - .layoutWeight(1) | ||
| 30 | - if(index % 4 < 3 && index != this.personalData.length-1){ | ||
| 31 | - Text().backgroundColor($r('app.color.color_222222')) | ||
| 32 | - .opacity(0.1) | ||
| 33 | - .width('2lpx') | ||
| 34 | - .height('29lpx') | ||
| 35 | - } | ||
| 36 | - } | 17 | + PagePersonFunction({ item: item, noDivider : (index % 4 < 3 && index != this.personalData.length-1) ? false : true}) |
| 37 | }.onClick(()=>{ | 18 | }.onClick(()=>{ |
| 38 | console.log(index+"") | 19 | console.log(index+"") |
| 39 | switch (item.msg){ | 20 | switch (item.msg){ |
| @@ -42,7 +23,8 @@ export default struct MinePagePersonFunctionUI { | @@ -42,7 +23,8 @@ export default struct MinePagePersonFunctionUI { | ||
| 42 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 23 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 43 | return | 24 | return |
| 44 | }else { | 25 | }else { |
| 45 | - WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage) | 26 | + let params: Record<string, string> = {'comment': "1"}; |
| 27 | + WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage,params) | ||
| 46 | } | 28 | } |
| 47 | break; | 29 | break; |
| 48 | } | 30 | } |
| @@ -83,6 +65,7 @@ export default struct MinePagePersonFunctionUI { | @@ -83,6 +65,7 @@ export default struct MinePagePersonFunctionUI { | ||
| 83 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 65 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 84 | return | 66 | return |
| 85 | } | 67 | } |
| 68 | + this.messageClick() | ||
| 86 | WDRouterRule.jumpWithPage(WDRouterPage.mineMessagePage) | 69 | WDRouterRule.jumpWithPage(WDRouterPage.mineMessagePage) |
| 87 | break; | 70 | break; |
| 88 | } | 71 | } |
| @@ -91,11 +74,18 @@ export default struct MinePagePersonFunctionUI { | @@ -91,11 +74,18 @@ export default struct MinePagePersonFunctionUI { | ||
| 91 | .height('117lpx') | 74 | .height('117lpx') |
| 92 | }) | 75 | }) |
| 93 | } | 76 | } |
| 94 | - // .rowsTemplate('1fr 1fr') | ||
| 95 | - .rowsTemplate('1fr') | 77 | + .rowsTemplate('1fr 1fr') |
| 96 | .columnsTemplate('1fr 1fr 1fr 1fr') | 78 | .columnsTemplate('1fr 1fr 1fr 1fr') |
| 97 | - // .height('234lpx') | ||
| 98 | - .height('167lpx') | 79 | + .height('234lpx') |
| 99 | .margin({top:'31lpx',left:'23lpx',right:'23lpx' }) | 80 | .margin({top:'31lpx',left:'23lpx',right:'23lpx' }) |
| 100 | } | 81 | } |
| 101 | -} | ||
| 82 | + | ||
| 83 | + messageClick(){ | ||
| 84 | + MinePageDatasModel.sendClickMessageData().then((value) => { | ||
| 85 | + console.log(TAG, "进入消息页面") | ||
| 86 | + }).catch((err: Error) => { | ||
| 87 | + console.log(TAG, JSON.stringify(err)) | ||
| 88 | + }) | ||
| 89 | + } | ||
| 90 | +} | ||
| 91 | + |
| 1 | +import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem' | ||
| 2 | + | ||
| 3 | +@Component | ||
| 4 | +export struct PagePersonFunction{ | ||
| 5 | + @ObjectLink item: MinePagePersonalFunctionsItem | ||
| 6 | + @State noDivider:boolean = false | ||
| 7 | + | ||
| 8 | + build() { | ||
| 9 | + Row(){ | ||
| 10 | + Column(){ | ||
| 11 | + Stack({ alignContent: Alignment.TopEnd }){ | ||
| 12 | + Image(this.item.imgSrc) | ||
| 13 | + .objectFit(ImageFit.Auto) | ||
| 14 | + .interpolation(ImageInterpolation.High) | ||
| 15 | + if (this.item.isShowRedPoint) { | ||
| 16 | + Button() | ||
| 17 | + .type(ButtonType.Circle) | ||
| 18 | + .width("12lpx") | ||
| 19 | + .height("12lpx") | ||
| 20 | + .backgroundColor($r('app.color.color_ED2800')) | ||
| 21 | + } | ||
| 22 | + }.width('46lpx') | ||
| 23 | + .height('46lpx') | ||
| 24 | + | ||
| 25 | + Text(`${this.item.msg}`) | ||
| 26 | + .margin({top:'8lpx'}) | ||
| 27 | + .height('23lpx') | ||
| 28 | + .fontColor($r('app.color.color_222222')) | ||
| 29 | + .fontSize('23lpx') | ||
| 30 | + } | ||
| 31 | + .alignItems(HorizontalAlign.Center) | ||
| 32 | + .width('100%') | ||
| 33 | + Blank() | ||
| 34 | + .layoutWeight(1) | ||
| 35 | + if(!this.noDivider){ | ||
| 36 | + Text().backgroundColor($r('app.color.color_222222')) | ||
| 37 | + .opacity(0.1) | ||
| 38 | + .width('2lpx') | ||
| 39 | + .height('29lpx') | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | +} |
| 1 | import { SpConstants } from 'wdConstant/Index' | 1 | import { SpConstants } from 'wdConstant/Index' |
| 2 | -import { DateTimeUtils, SPHelper, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index' | 2 | +import { SPHelper, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index' |
| 3 | import { HttpUtils } from 'wdNetwork/Index' | 3 | import { HttpUtils } from 'wdNetwork/Index' |
| 4 | import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' | 4 | import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' |
| 5 | import MinePageDatasModel from '../../../model/MinePageDatasModel' | 5 | import MinePageDatasModel from '../../../model/MinePageDatasModel' |
| @@ -116,9 +116,14 @@ export struct FollowChildComponent{ | @@ -116,9 +116,14 @@ export struct FollowChildComponent{ | ||
| 116 | }.height('202lpx') | 116 | }.height('202lpx') |
| 117 | .justifyContent(FlexAlign.Start) | 117 | .justifyContent(FlexAlign.Start) |
| 118 | 118 | ||
| 119 | - Text().backgroundColor($r('app.color.color_EDEDED')) | 119 | + // Text().backgroundColor($r('app.color.color_EDEDED')) |
| 120 | + // .width('100%') | ||
| 121 | + // .height('2lpx') | ||
| 122 | + Divider() | ||
| 120 | .width('100%') | 123 | .width('100%') |
| 121 | .height('2lpx') | 124 | .height('2lpx') |
| 125 | + .color($r('app.color.color_F5F5F5')) | ||
| 126 | + .strokeWidth('1lpx') | ||
| 122 | }.width('100%') | 127 | }.width('100%') |
| 123 | 128 | ||
| 124 | }else { | 129 | }else { |
| @@ -230,9 +235,15 @@ export struct FollowChildComponent{ | @@ -230,9 +235,15 @@ export struct FollowChildComponent{ | ||
| 230 | }.height('146lpx') | 235 | }.height('146lpx') |
| 231 | .justifyContent(FlexAlign.Center) | 236 | .justifyContent(FlexAlign.Center) |
| 232 | 237 | ||
| 233 | - Text().backgroundColor($r('app.color.color_EDEDED')) | 238 | + // Text().backgroundColor($r('app.color.color_EDEDED')) |
| 239 | + // .width('100%') | ||
| 240 | + // .height('2lpx') | ||
| 241 | + | ||
| 242 | + Divider() | ||
| 234 | .width('100%') | 243 | .width('100%') |
| 235 | .height('2lpx') | 244 | .height('2lpx') |
| 245 | + .color($r('app.color.color_F5F5F5')) | ||
| 246 | + .strokeWidth('1lpx') | ||
| 236 | }.width('100%') | 247 | }.width('100%') |
| 237 | 248 | ||
| 238 | } | 249 | } |
| @@ -255,12 +266,6 @@ export struct FollowChildComponent{ | @@ -255,12 +266,6 @@ export struct FollowChildComponent{ | ||
| 255 | this.data.status = this.data.status ==="0"?"1":"0" | 266 | this.data.status = this.data.status ==="0"?"1":"0" |
| 256 | 267 | ||
| 257 | UserDataLocal.setUserFollowOperation(this.data.creatorId+","+this.data.status) | 268 | UserDataLocal.setUserFollowOperation(this.data.creatorId+","+this.data.status) |
| 258 | - | ||
| 259 | - // if(this.data.status === "1"){ | ||
| 260 | - // UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+"") | ||
| 261 | - // }else{ | ||
| 262 | - // UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+","+this.data.creatorId) | ||
| 263 | - // } | ||
| 264 | } | 269 | } |
| 265 | } | 270 | } |
| 266 | }) | 271 | }) |
| @@ -30,10 +30,9 @@ export struct HomePageBottomCommentComponent { | @@ -30,10 +30,9 @@ export struct HomePageBottomCommentComponent { | ||
| 30 | build() { | 30 | build() { |
| 31 | Column() { | 31 | Column() { |
| 32 | if (this.isGetRequest == true) { | 32 | if (this.isGetRequest == true) { |
| 33 | - Divider().width('100%') | 33 | + Text().backgroundColor($r('app.color.color_EDEDED')) |
| 34 | + .width('100%') | ||
| 34 | .height('2lpx') | 35 | .height('2lpx') |
| 35 | - .strokeWidth('1lpx') | ||
| 36 | - .backgroundColor($r('app.color.color_EDEDED')) | ||
| 37 | } | 36 | } |
| 38 | if (this.count === 0) { | 37 | if (this.count === 0) { |
| 39 | if (this.isGetRequest == true) { | 38 | if (this.isGetRequest == true) { |
| @@ -65,10 +65,9 @@ export struct HomePageBottomFollowComponent { | @@ -65,10 +65,9 @@ export struct HomePageBottomFollowComponent { | ||
| 65 | 65 | ||
| 66 | Column() { | 66 | Column() { |
| 67 | if (this.isGetRequest == true) { | 67 | if (this.isGetRequest == true) { |
| 68 | - Divider().width('100%') | 68 | + Text().backgroundColor($r('app.color.color_EDEDED')) |
| 69 | + .width('100%') | ||
| 69 | .height('2lpx') | 70 | .height('2lpx') |
| 70 | - .strokeWidth('1lpx') | ||
| 71 | - .backgroundColor($r('app.color.color_EDEDED')) | ||
| 72 | } | 71 | } |
| 73 | 72 | ||
| 74 | if (this.count === 0) { | 73 | if (this.count === 0) { |
| @@ -30,10 +30,9 @@ export struct OtherHomePageBottomCommentComponent { | @@ -30,10 +30,9 @@ export struct OtherHomePageBottomCommentComponent { | ||
| 30 | 30 | ||
| 31 | build() { | 31 | build() { |
| 32 | Column() { | 32 | Column() { |
| 33 | - Divider().width('100%') | 33 | + Text().backgroundColor($r('app.color.color_EDEDED')) |
| 34 | + .width('100%') | ||
| 34 | .height('2lpx') | 35 | .height('2lpx') |
| 35 | - .strokeWidth('1lpx') | ||
| 36 | - .backgroundColor($r('app.color.color_EDEDED')) | ||
| 37 | 36 | ||
| 38 | if (this.count === 0) { | 37 | if (this.count === 0) { |
| 39 | if (this.isGetRequest == true) { | 38 | if (this.isGetRequest == true) { |
| @@ -30,10 +30,9 @@ export struct OtherHomePageBottomFollowComponent{ | @@ -30,10 +30,9 @@ export struct OtherHomePageBottomFollowComponent{ | ||
| 30 | 30 | ||
| 31 | build(){ | 31 | build(){ |
| 32 | Column(){ | 32 | Column(){ |
| 33 | - Divider().width('100%') | 33 | + Text().backgroundColor($r('app.color.color_EDEDED')) |
| 34 | + .width('100%') | ||
| 34 | .height('2lpx') | 35 | .height('2lpx') |
| 35 | - .strokeWidth('1lpx') | ||
| 36 | - .backgroundColor($r('app.color.color_EDEDED')) | ||
| 37 | 36 | ||
| 38 | if(this.count === 0){ | 37 | if(this.count === 0){ |
| 39 | Column(){ | 38 | Column(){ |
sight_harmony/features/wdComponent/src/main/ets/components/mine/message/MessageListItemUI.ets
0 → 100644
| 1 | +import { StringUtils } from 'wdKit/Index' | ||
| 2 | +import { MessageItem } from '../../../viewmodel/MessageItem' | ||
| 3 | + | ||
| 4 | +const TAG = "MessageListUI" | ||
| 5 | + | ||
| 6 | +@Component | ||
| 7 | +export struct MessageListItemUI { | ||
| 8 | + @ObjectLink item: MessageItem | ||
| 9 | + @State index:number = -1 | ||
| 10 | + | ||
| 11 | + build() { | ||
| 12 | + Column(){ | ||
| 13 | + Column() { | ||
| 14 | + Row() { | ||
| 15 | + Row() { | ||
| 16 | + Image(this.item.imgSrc) | ||
| 17 | + .objectFit(ImageFit.Auto) | ||
| 18 | + .width('92lpx') | ||
| 19 | + .height('92lpx') | ||
| 20 | + .margin({ right: '15lpx' }) | ||
| 21 | + | ||
| 22 | + Column() { | ||
| 23 | + Text(this.item.title) | ||
| 24 | + .fontWeight(500) | ||
| 25 | + .fontSize('31lpx') | ||
| 26 | + .lineHeight('42lpx') | ||
| 27 | + .fontColor($r('app.color.color_222222')) | ||
| 28 | + .maxLines(1) | ||
| 29 | + .margin({ bottom: StringUtils.isNotEmpty(this.item.desc)?'8lpx':0 }) | ||
| 30 | + | ||
| 31 | + if(StringUtils.isNotEmpty(this.item.desc)){ | ||
| 32 | + Text(`${this.item.desc}`) | ||
| 33 | + .fontColor($r('app.color.color_999999')) | ||
| 34 | + .fontSize('27lpx') | ||
| 35 | + .lineHeight('38lpx') | ||
| 36 | + .fontWeight(400) | ||
| 37 | + .maxLines(1) | ||
| 38 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 39 | + } | ||
| 40 | + } | ||
| 41 | + .height('92lpx') | ||
| 42 | + .layoutWeight(1) | ||
| 43 | + .alignItems(HorizontalAlign.Start) | ||
| 44 | + .justifyContent(StringUtils.isNotEmpty(this.item.desc)?FlexAlign.Start:FlexAlign.Center) | ||
| 45 | + }.layoutWeight(1) | ||
| 46 | + | ||
| 47 | + Column() { | ||
| 48 | + Text(`${this.item.time}`) | ||
| 49 | + .fontColor($r('app.color.color_999999')) | ||
| 50 | + .fontSize('23lpx') | ||
| 51 | + .fontWeight(500) | ||
| 52 | + .lineHeight('35lpx') | ||
| 53 | + .margin({ bottom: this.item.unReadCount > 0 ?'8lpx':0 }) | ||
| 54 | + | ||
| 55 | + if(this.item.unReadCount > 0){ | ||
| 56 | + Button(){ | ||
| 57 | + Text(`${this.item.unReadCount}`) | ||
| 58 | + .fontWeight(400) | ||
| 59 | + .fontSize("18lpx") | ||
| 60 | + .fontColor($r('app.color.white')) | ||
| 61 | + } | ||
| 62 | + .type((this.item.unReadCount>0 && this.item.unReadCount < 10 ? ButtonType.Circle:ButtonType.Capsule)) | ||
| 63 | + .backgroundColor($r("app.color.color_ED2800")) | ||
| 64 | + .stateEffect(false) | ||
| 65 | + .height("27lpx") | ||
| 66 | + .constraintSize({minWidth:"27lpx"}) | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | + .justifyContent(FlexAlign.Start) | ||
| 70 | + .alignItems(HorizontalAlign.End) | ||
| 71 | + .height('92lpx') | ||
| 72 | + } | ||
| 73 | + .width('100%') | ||
| 74 | + .height('92lpx') | ||
| 75 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 76 | + | ||
| 77 | + }.height('154lpx') | ||
| 78 | + .width("100%") | ||
| 79 | + .justifyContent(FlexAlign.Center) | ||
| 80 | + | ||
| 81 | + Text().backgroundColor($r('app.color.color_EDEDED')) | ||
| 82 | + .width('100%') | ||
| 83 | + .height('1lpx') | ||
| 84 | + .visibility(this.index != 3 ?Visibility.Visible:Visibility.None) | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + | ||
| 89 | +} |
| 1 | -import { StringUtils, ToastUtils } from 'wdKit/Index' | 1 | +import { DateTimeUtils, StringUtils, ToastUtils } from 'wdKit/Index' |
| 2 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | ||
| 3 | +import { WDMessageCenterMessageType } from '../../../model/InteractMessageModel' | ||
| 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel' | 4 | import MinePageDatasModel from '../../../model/MinePageDatasModel' |
| 3 | import { MessageItem } from '../../../viewmodel/MessageItem' | 5 | import { MessageItem } from '../../../viewmodel/MessageItem' |
| 4 | import { CustomTitleUI } from '../../reusable/CustomTitleUI' | 6 | import { CustomTitleUI } from '../../reusable/CustomTitleUI' |
| 7 | +import { MessageListItemUI } from './MessageListItemUI' | ||
| 5 | 8 | ||
| 6 | const TAG = "MessageListUI" | 9 | const TAG = "MessageListUI" |
| 7 | 10 | ||
| @@ -11,6 +14,123 @@ export struct MessageListUI { | @@ -11,6 +14,123 @@ export struct MessageListUI { | ||
| 11 | 14 | ||
| 12 | aboutToAppear() { | 15 | aboutToAppear() { |
| 13 | this.msgData = MinePageDatasModel.getMessageData() | 16 | this.msgData = MinePageDatasModel.getMessageData() |
| 17 | + this.getHistoryPush() | ||
| 18 | + this.getMessagePush() | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + //历史推送 | ||
| 22 | + getHistoryPush() { | ||
| 23 | + MinePageDatasModel.getHistoryPushData("1", "1").then((value) => { | ||
| 24 | + if (value != null && value.list != null && value.list.length > 0) { | ||
| 25 | + this.msgData.forEach((item) => { | ||
| 26 | + if (item.title == "历史推送") { | ||
| 27 | + if (value.list != null && value.list[0] != null) { | ||
| 28 | + if (value.list[0].newsTitle) { | ||
| 29 | + item.desc = value.list[0].newsTitle | ||
| 30 | + } | ||
| 31 | + if (value.list[0].publishTime) { | ||
| 32 | + item.time = this.getPublishTime("",value.list[0].publishTime) | ||
| 33 | + } | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | + }) | ||
| 37 | + } | ||
| 38 | + }).catch((err: Error) => { | ||
| 39 | + console.log(TAG, JSON.stringify(err)) | ||
| 40 | + }) | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + //互动消息 预约消息 系统消息 | ||
| 44 | + getMessagePush() { | ||
| 45 | + MinePageDatasModel.getMessageUnReadData().then((value) => { | ||
| 46 | + this.msgData.forEach((item) => { | ||
| 47 | + if (item.title == "预约消息") { | ||
| 48 | + if (value.subscribeInfo != null) { | ||
| 49 | + if (value.subscribeInfo.title) { | ||
| 50 | + item.desc = value.subscribeInfo.title | ||
| 51 | + } | ||
| 52 | + if (value.subscribeInfo.time) { | ||
| 53 | + item.time = this.getPublishTime(value.subscribeInfo.time,DateTimeUtils.getDateTimestamp(value.subscribeInfo.time)+"") | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + if(value.subscribeCount > 0){ | ||
| 57 | + item.unReadCount = value.subscribeCount | ||
| 58 | + } | ||
| 59 | + } else if (item.title == "系统消息") { | ||
| 60 | + if (value.systemInfo != null) { | ||
| 61 | + if (value.systemInfo.title) { | ||
| 62 | + item.desc = value.systemInfo.title | ||
| 63 | + } | ||
| 64 | + if (value.systemInfo.time) { | ||
| 65 | + item.time = this.getPublishTime(value.subscribeInfo.time,DateTimeUtils.getDateTimestamp(value.systemInfo.time) + "") | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + if(value.systemCount > 0){ | ||
| 69 | + item.unReadCount = value.systemCount | ||
| 70 | + } | ||
| 71 | + }else if(item.title == "互动消息"){ | ||
| 72 | + if(value.activeCount > 0){ | ||
| 73 | + item.unReadCount = value.activeCount | ||
| 74 | + } | ||
| 75 | + if (value.activeInfo != null) { | ||
| 76 | + if (value.activeInfo.title) { | ||
| 77 | + item.desc = value.activeInfo.title | ||
| 78 | + } | ||
| 79 | + if (value.activeInfo.time) { | ||
| 80 | + item.time = this.getPublishTime(value.subscribeInfo.time,DateTimeUtils.getDateTimestamp(value.activeInfo.time) + "") | ||
| 81 | + } | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + }) | ||
| 85 | + }).catch((err: Error) => { | ||
| 86 | + console.log(TAG, JSON.stringify(err)) | ||
| 87 | + }) | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + getPublishTime(data:string,publishTime: string): string { | ||
| 91 | + const publishTimestamp = parseInt(publishTime) | ||
| 92 | + const currentTime = Date.now(); // 当前时间戳 | ||
| 93 | + | ||
| 94 | + // 计算差异 | ||
| 95 | + const timeDifference = currentTime - publishTimestamp; | ||
| 96 | + | ||
| 97 | + // 转换为分钟、小时和天 | ||
| 98 | + const minutes = Math.floor(timeDifference / (1000 * 60)); | ||
| 99 | + const hours = Math.floor(timeDifference / (1000 * 60 * 60)); | ||
| 100 | + const days = Math.floor(timeDifference / (1000 * 60 * 60 * 24)); | ||
| 101 | + | ||
| 102 | + // 根据时间差返回对应的字符串 | ||
| 103 | + let result: string; | ||
| 104 | + | ||
| 105 | + if (minutes < 60) { | ||
| 106 | + result = `${minutes}分钟前`; | ||
| 107 | + if(minutes === 0){ | ||
| 108 | + result = `刚刚`; | ||
| 109 | + } | ||
| 110 | + } else if (hours < 24) { | ||
| 111 | + result = `${hours}小时前`; | ||
| 112 | + } else { | ||
| 113 | + result = `${days}天前`; | ||
| 114 | + if(days > 1){ | ||
| 115 | + let arr = data.split(" ") | ||
| 116 | + if(arr.length === 2){ | ||
| 117 | + let arr2 = arr[0].split("-") | ||
| 118 | + if(arr2.length === 3){ | ||
| 119 | + result = `${arr2[1]}-${arr2[2]}` | ||
| 120 | + } | ||
| 121 | + }else{ | ||
| 122 | + //原始数据是时间戳 需要转成dateString | ||
| 123 | + let time = DateTimeUtils.formatDate(Number(publishTime)) | ||
| 124 | + let arr = time.split("-") | ||
| 125 | + if(arr.length === 3){ | ||
| 126 | + result = `${arr[1]}-${arr[2]}` | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + console.log(result); | ||
| 133 | + return result | ||
| 14 | } | 134 | } |
| 15 | 135 | ||
| 16 | build() { | 136 | build() { |
| @@ -21,73 +141,22 @@ export struct MessageListUI { | @@ -21,73 +141,22 @@ export struct MessageListUI { | ||
| 21 | List() { | 141 | List() { |
| 22 | ForEach(this.msgData, (item: MessageItem, index: number) => { | 142 | ForEach(this.msgData, (item: MessageItem, index: number) => { |
| 23 | ListItem() { | 143 | ListItem() { |
| 24 | - Column(){ | ||
| 25 | - Column() { | ||
| 26 | - Row() { | ||
| 27 | - Row() { | ||
| 28 | - Image(item.imgSrc) | ||
| 29 | - .objectFit(ImageFit.Auto) | ||
| 30 | - .width('92lpx') | ||
| 31 | - .height('92lpx') | ||
| 32 | - .margin({ right: '15lpx' }) | ||
| 33 | - | ||
| 34 | - Column() { | ||
| 35 | - Text(item.title) | ||
| 36 | - .fontWeight(500) | ||
| 37 | - .fontSize('31lpx') | ||
| 38 | - .lineHeight('42lpx') | ||
| 39 | - .fontColor($r('app.color.color_222222')) | ||
| 40 | - .maxLines(1) | ||
| 41 | - .margin({ bottom: StringUtils.isNotEmpty(item.desc)?'8lpx':0 }) | ||
| 42 | - | ||
| 43 | - if(StringUtils.isNotEmpty(item.desc)){ | ||
| 44 | - Text(`${item.desc}`) | ||
| 45 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 46 | - .fontSize('23lpx') | ||
| 47 | - .lineHeight('38lpx') | ||
| 48 | - .fontWeight(400) | ||
| 49 | - .maxLines(1) | ||
| 50 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 51 | - } | ||
| 52 | - } | ||
| 53 | - .height('92lpx') | ||
| 54 | - .layoutWeight(1) | ||
| 55 | - .alignItems(HorizontalAlign.Start) | ||
| 56 | - .justifyContent(StringUtils.isNotEmpty(item.desc)?FlexAlign.Start:FlexAlign.Center) | ||
| 57 | - }.layoutWeight(1) | ||
| 58 | - | ||
| 59 | - Row() { | ||
| 60 | - Text(`${item.time}`) | ||
| 61 | - .fontColor($r('app.color.color_999999')) | ||
| 62 | - .fontSize('23lpx') | ||
| 63 | - .fontWeight(500) | ||
| 64 | - .lineHeight('35lpx') | ||
| 65 | - } | ||
| 66 | - .justifyContent(FlexAlign.Start) | ||
| 67 | - .alignItems(VerticalAlign.Top) | ||
| 68 | - .height('92lpx') | ||
| 69 | - } | ||
| 70 | - .width('100%') | ||
| 71 | - .height('92lpx') | ||
| 72 | - .justifyContent(FlexAlign.SpaceBetween) | ||
| 73 | - | ||
| 74 | - }.height('154lpx') | ||
| 75 | - .width("100%") | ||
| 76 | - .justifyContent(FlexAlign.Center) | ||
| 77 | - | ||
| 78 | - Text().backgroundColor($r('app.color.color_EDEDED')) | ||
| 79 | - .width('100%') | ||
| 80 | - .height('1lpx') | ||
| 81 | - .visibility(index != 3 ?Visibility.Visible:Visibility.None) | ||
| 82 | - } | 144 | + MessageListItemUI({ item: item, index: index }) |
| 83 | } | 145 | } |
| 84 | - .padding({left:"31lpx",right:"31lpx"}) | 146 | + .padding({ left: "31lpx", right: "31lpx" }) |
| 85 | .onClick(() => { | 147 | .onClick(() => { |
| 86 | - ToastUtils.shortToast(index+"") | ||
| 87 | switch (index) { | 148 | switch (index) { |
| 88 | case 0: //互动消息 | 149 | case 0: //互动消息 |
| 150 | + if(item.unReadCount > 0){ | ||
| 151 | + this.sendEnterEvent(WDMessageCenterMessageType.WDMessageCenterMessageType_Interact) | ||
| 152 | + } | ||
| 153 | + WDRouterRule.jumpWithPage(WDRouterPage.interactMessagePage) | ||
| 89 | break; | 154 | break; |
| 90 | case 1: //预约消息 | 155 | case 1: //预约消息 |
| 156 | + if(item.unReadCount > 0){ | ||
| 157 | + this.sendEnterEvent(WDMessageCenterMessageType.WDMessageCenterMessageType_Subscribe) | ||
| 158 | + } | ||
| 159 | + WDRouterRule.jumpWithPage(WDRouterPage.subscribeMessagePage) | ||
| 91 | break; | 160 | break; |
| 92 | case 2: //历史推送 | 161 | case 2: //历史推送 |
| 93 | break; | 162 | break; |
| @@ -104,4 +173,12 @@ export struct MessageListUI { | @@ -104,4 +173,12 @@ export struct MessageListUI { | ||
| 104 | .height('100%') | 173 | .height('100%') |
| 105 | .width('100%') | 174 | .width('100%') |
| 106 | } | 175 | } |
| 176 | + | ||
| 177 | + sendEnterEvent(type:number){ | ||
| 178 | + MinePageDatasModel.sendEnterMessageData(type).then((value) => { | ||
| 179 | + console.log(TAG, "消息已读") | ||
| 180 | + }).catch((err: Error) => { | ||
| 181 | + console.log(TAG, JSON.stringify(err)) | ||
| 182 | + }) | ||
| 183 | + } | ||
| 107 | } | 184 | } |
| 1 | +import { SubscribeMessageModel } from '../../../../model/InteractMessageModel' | ||
| 2 | + | ||
| 3 | +@Component | ||
| 4 | +export struct SubscribeListChildComponent{ | ||
| 5 | + @ObjectLink item: SubscribeMessageModel | ||
| 6 | + | ||
| 7 | + build() { | ||
| 8 | + Column(){ | ||
| 9 | + Row(){ | ||
| 10 | + Text(`${this.item.dealTime}`) | ||
| 11 | + .margin({top:"31lpx",bottom:"23lpx"}) | ||
| 12 | + .fontWeight(400) | ||
| 13 | + .fontSize("23lpx") | ||
| 14 | + .lineHeight("33lpx") | ||
| 15 | + .fontColor($r('app.color.color_999999')) | ||
| 16 | + }.width('100%') | ||
| 17 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 18 | + .justifyContent(FlexAlign.Center) | ||
| 19 | + | ||
| 20 | + Column(){ | ||
| 21 | + Column(){ | ||
| 22 | + Text(`${this.item.title}`) | ||
| 23 | + .fontSize("31lpx") | ||
| 24 | + .lineHeight("46lpx") | ||
| 25 | + .fontWeight(500) | ||
| 26 | + .fontColor($r('app.color.color_333333')) | ||
| 27 | + .margin({top:"27lpx",bottom:"25lpx"}) | ||
| 28 | + .maxLines(1) | ||
| 29 | + | ||
| 30 | + Text().backgroundColor($r('app.color.color_F5F5F5')) | ||
| 31 | + .width('100%') | ||
| 32 | + .height('1lpx') | ||
| 33 | + }.alignItems(HorizontalAlign.Start) | ||
| 34 | + .width("100%") | ||
| 35 | + .height("98lpx") | ||
| 36 | + | ||
| 37 | + Row(){ | ||
| 38 | + Image(`${this.item.imgUrl}`) | ||
| 39 | + .width('204lpx') | ||
| 40 | + .height('115lpx') | ||
| 41 | + .borderRadius("6lpx") | ||
| 42 | + .objectFit(ImageFit.Auto) | ||
| 43 | + .margin({right:"23lpx"}) | ||
| 44 | + | ||
| 45 | + Text(`${this.item.desc}`) | ||
| 46 | + .fontSize("27lpx") | ||
| 47 | + .lineHeight("38lpx") | ||
| 48 | + .fontWeight(400) | ||
| 49 | + .fontColor($r('app.color.color_222222')) | ||
| 50 | + .layoutWeight(1) | ||
| 51 | + }.alignItems(VerticalAlign.Center) | ||
| 52 | + .width("100%") | ||
| 53 | + .height("160lpx") | ||
| 54 | + | ||
| 55 | + Text().backgroundColor($r('app.color.color_F5F5F5')) | ||
| 56 | + .width('100%') | ||
| 57 | + .height('1lpx') | ||
| 58 | + | ||
| 59 | + Row(){ | ||
| 60 | + Text(`${this.item.time}开始`) | ||
| 61 | + .fontSize("23lpx") | ||
| 62 | + .fontWeight(600) | ||
| 63 | + .lineHeight("31lpx") | ||
| 64 | + | ||
| 65 | + Row(){ | ||
| 66 | + Text("查看详情") | ||
| 67 | + .fontSize("23lpx") | ||
| 68 | + .lineHeight("38lpx") | ||
| 69 | + .fontWeight(400) | ||
| 70 | + .fontColor($r('app.color.color_666666')) | ||
| 71 | + .margin({right:"8lpx"}) | ||
| 72 | + | ||
| 73 | + Image($r('app.media.subscribe_arrow_icon')) | ||
| 74 | + .width('23lpx') | ||
| 75 | + .height('13lpx') | ||
| 76 | + .objectFit(ImageFit.Auto) | ||
| 77 | + .interpolation(ImageInterpolation.High) | ||
| 78 | + .margin({right:"4lpx"}) | ||
| 79 | + } | ||
| 80 | + }.alignItems(VerticalAlign.Center) | ||
| 81 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 82 | + .width("100%") | ||
| 83 | + .height("73lpx") | ||
| 84 | + | ||
| 85 | + }.backgroundColor($r('app.color.white')) | ||
| 86 | + .borderRadius("8lpx") | ||
| 87 | + .width("100%") | ||
| 88 | + .padding({left:"23lpx",right:"23lpx"}) | ||
| 89 | + } | ||
| 90 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 91 | + .width("100%") | ||
| 92 | + .padding({left:"31lpx",right:"31lpx"}) | ||
| 93 | + .alignItems(HorizontalAlign.Center) | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + | ||
| 97 | +} |
| 1 | +import { LazyDataSource, StringUtils } from 'wdKit/Index'; | ||
| 2 | +import { Remark, SubscribeMessageModel, | ||
| 3 | + WDMessageCenterMessageType } from '../../../../model/InteractMessageModel'; | ||
| 4 | +import MinePageDatasModel from '../../../../model/MinePageDatasModel'; | ||
| 5 | +import { CustomTitleUI } from '../../../reusable/CustomTitleUI'; | ||
| 6 | +import { ListHasNoMoreDataUI } from '../../../reusable/ListHasNoMoreDataUI'; | ||
| 7 | +import { EmptyComponent } from '../../../view/EmptyComponent'; | ||
| 8 | +import { SubscribeListChildComponent } from './SubscribeListChildComponent'; | ||
| 9 | + | ||
| 10 | +const TAG = "SubscribeMessageComponent" | ||
| 11 | + | ||
| 12 | +@Component | ||
| 13 | +export struct SubscribeMessageComponent{ | ||
| 14 | + @State data: LazyDataSource<SubscribeMessageModel> = new LazyDataSource(); | ||
| 15 | + @State count: number = 0; | ||
| 16 | + @State isLoading: boolean = false | ||
| 17 | + @State hasMore: boolean = true | ||
| 18 | + curPageNum: number = 1; | ||
| 19 | + @State isGetRequest: boolean = false | ||
| 20 | + | ||
| 21 | + aboutToAppear() { | ||
| 22 | + this.getNewPageData() | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + build() { | ||
| 26 | + Column() { | ||
| 27 | + //标题栏目 | ||
| 28 | + CustomTitleUI({ titleName: "预约消息" }) | ||
| 29 | + if (this.count == 0) { | ||
| 30 | + if (this.isGetRequest == true) { | ||
| 31 | + EmptyComponent({ emptyType: 5 }) | ||
| 32 | + .height('100%') | ||
| 33 | + .width('100%') | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + } else { | ||
| 37 | + //刷新控件 TODO | ||
| 38 | + //List | ||
| 39 | + List() { | ||
| 40 | + LazyForEach(this.data, (item: SubscribeMessageModel, index: number) => { | ||
| 41 | + ListItem() { | ||
| 42 | + SubscribeListChildComponent({ item: item }) | ||
| 43 | + }.width('100%') | ||
| 44 | + .onClick(() => { | ||
| 45 | + }) | ||
| 46 | + }) | ||
| 47 | + | ||
| 48 | + //没有更多数据 显示提示 | ||
| 49 | + if (!this.hasMore) { | ||
| 50 | + ListItem() { | ||
| 51 | + ListHasNoMoreDataUI() | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + }.width('100%') | ||
| 55 | + .cachedCount(4) | ||
| 56 | + .scrollBar(BarState.Off) | ||
| 57 | + .layoutWeight(1) | ||
| 58 | + .onReachEnd(() => { | ||
| 59 | + if (!this.isLoading) { | ||
| 60 | + //加载分页数据 | ||
| 61 | + this.getNewPageData() | ||
| 62 | + } | ||
| 63 | + }) | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + .backgroundColor($r('app.color.color_F9F9F9')) | ||
| 67 | + .height('100%') | ||
| 68 | + .width('100%') | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + getNewPageData() { | ||
| 72 | + this.isLoading = true | ||
| 73 | + if (this.hasMore) { | ||
| 74 | + MinePageDatasModel.getSubscribeMessageData(WDMessageCenterMessageType.WDMessageCenterMessageType_Subscribe,"20",`${this.curPageNum}`).then((value) => { | ||
| 75 | + if (!this.data || value.list.length == 0) { | ||
| 76 | + this.hasMore = false | ||
| 77 | + } else { | ||
| 78 | + value.list.forEach((value) => { | ||
| 79 | + let dealTime = this.DealStartTime(value.time,1) | ||
| 80 | + let dealTime2 = this.DealStartTime(value.time,2) | ||
| 81 | + | ||
| 82 | + let remark = JSON.parse(value.remark) as Remark | ||
| 83 | + | ||
| 84 | + this.data.push(new SubscribeMessageModel(dealTime,value.message,remark.coverImageUrl,value.title,dealTime2,value.contentId)) | ||
| 85 | + }) | ||
| 86 | + this.data.notifyDataReload() | ||
| 87 | + this.count = this.data.totalCount() | ||
| 88 | + if (this.data.totalCount() < value.totalCount) { | ||
| 89 | + this.curPageNum++ | ||
| 90 | + } else { | ||
| 91 | + this.hasMore = false | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + this.isGetRequest = true | ||
| 95 | + this.isLoading = false | ||
| 96 | + }).catch((err: Error) => { | ||
| 97 | + console.log(TAG, JSON.stringify(err)) | ||
| 98 | + this.isGetRequest = true | ||
| 99 | + this.isLoading = false | ||
| 100 | + }) | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + | ||
| 105 | + DealStartTime(planStartTime: string,type:number): string { | ||
| 106 | + let dealData: string = "" | ||
| 107 | + | ||
| 108 | + if (StringUtils.isEmpty(planStartTime)) { | ||
| 109 | + console.log(TAG, "格式有误") | ||
| 110 | + return planStartTime | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + if (planStartTime.indexOf(" ") === -1) { | ||
| 114 | + console.log(TAG, "格式有误") | ||
| 115 | + return planStartTime | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + let arr = planStartTime.split(" ") | ||
| 119 | + if (arr != null && StringUtils.isNotEmpty(arr[0])) { //处理年月日 | ||
| 120 | + let time = arr[0].split("-"); | ||
| 121 | + if (time.length === 3) { | ||
| 122 | + dealData = `${time[1]}-${time[2]}` | ||
| 123 | + if(type === 1){ | ||
| 124 | + return dealData | ||
| 125 | + } | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + if (arr != null && StringUtils.isNotEmpty(arr[1])) { //处理时分 | ||
| 130 | + let time = arr[1].split(":"); | ||
| 131 | + if (time.length === 3) { | ||
| 132 | + dealData = `${dealData} ${time[0]}:${time[1]}` | ||
| 133 | + } | ||
| 134 | + } | ||
| 135 | + console.log(TAG, JSON.stringify(dealData)) | ||
| 136 | + return dealData | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + | ||
| 140 | +} |
| @@ -85,6 +85,7 @@ export struct BottomNavigationComponent { | @@ -85,6 +85,7 @@ export struct BottomNavigationComponent { | ||
| 85 | VideoChannelPage({ | 85 | VideoChannelPage({ |
| 86 | topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), | 86 | topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), |
| 87 | _currentNavIndex: $currentNavIndex, | 87 | _currentNavIndex: $currentNavIndex, |
| 88 | + autoRefresh: this.autoRefresh | ||
| 88 | }) | 89 | }) |
| 89 | } else { | 90 | } else { |
| 90 | TopNavigationComponent({ | 91 | TopNavigationComponent({ |
-
Please register or login to post a comment