Showing
137 changed files
with
2922 additions
and
718 deletions
| @@ -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' |
| 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; |
| @@ -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"; |
| @@ -316,6 +324,25 @@ export class HttpUrlUtils { | @@ -316,6 +324,25 @@ export class HttpUrlUtils { | ||
| 316 | */ | 324 | */ |
| 317 | static readonly FEEDBACK_TYPE_PATH: string = "/api/rmrb-interact/interact/c/user/optionClassify/list"; | 325 | static readonly FEEDBACK_TYPE_PATH: string = "/api/rmrb-interact/interact/c/user/optionClassify/list"; |
| 318 | 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 HISTORY_PUSH_MESSAGE_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/push"; | ||
| 319 | 346 | ||
| 320 | static getHost(): string { | 347 | static getHost(): string { |
| 321 | return HostManager.getHost(); | 348 | return HostManager.getHost(); |
| @@ -478,6 +505,16 @@ export class HttpUrlUtils { | @@ -478,6 +505,16 @@ export class HttpUrlUtils { | ||
| 478 | return url | 505 | return url |
| 479 | } | 506 | } |
| 480 | 507 | ||
| 508 | + static getMessageListDataUrl() { | ||
| 509 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_MessageList_PATH | ||
| 510 | + return url | ||
| 511 | + } | ||
| 512 | + | ||
| 513 | + static getMessageLikeCount() { | ||
| 514 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_getMessageLikeCount_PATH | ||
| 515 | + return url | ||
| 516 | + } | ||
| 517 | + | ||
| 481 | static getExecuteCollcetUrl() { | 518 | static getExecuteCollcetUrl() { |
| 482 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH | 519 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH |
| 483 | return url | 520 | return url |
| @@ -714,4 +751,33 @@ export class HttpUrlUtils { | @@ -714,4 +751,33 @@ export class HttpUrlUtils { | ||
| 714 | return url; | 751 | return url; |
| 715 | } | 752 | } |
| 716 | 753 | ||
| 717 | -} | ||
| 754 | + //获取消息未读接口 | ||
| 755 | + static getMessageUnReadDataUrl() { | ||
| 756 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.MESSAGE_UN_READ_DATA_PATH | ||
| 757 | + return url | ||
| 758 | + } | ||
| 759 | + | ||
| 760 | + static reportDeviceInfo() { | ||
| 761 | + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/common/user/c/device/push"; | ||
| 762 | + return url; | ||
| 763 | + } | ||
| 764 | + | ||
| 765 | + //获取直播人数 | ||
| 766 | + static getLiveRoomBatchAllDataUrl() { | ||
| 767 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_ROOM_BATCH_ALL_DATA_PATH | ||
| 768 | + return url | ||
| 769 | + } | ||
| 770 | + | ||
| 771 | + | ||
| 772 | + //点击消息 | ||
| 773 | + static getSendClickMessageUrl() { | ||
| 774 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEND_MESSAGE_PATH | ||
| 775 | + return url | ||
| 776 | + } | ||
| 777 | + | ||
| 778 | + //消息 历史推送消息 | ||
| 779 | + static getHistoryPushUrl() { | ||
| 780 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.HISTORY_PUSH_MESSAGE_PATH | ||
| 781 | + return url | ||
| 782 | + } | ||
| 783 | +} |
| 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 | +} |
| @@ -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 | //人民号主页 |
| @@ -136,4 +138,9 @@ export class WDRouterPage { | @@ -136,4 +138,9 @@ export class WDRouterPage { | ||
| 136 | 138 | ||
| 137 | //意见反馈 | 139 | //意见反馈 |
| 138 | static feedBackActivity = new WDRouterPage("wdComponent", "ets/components/FeedBackActivity"); | 140 | static feedBackActivity = new WDRouterPage("wdComponent", "ets/components/FeedBackActivity"); |
| 141 | + | ||
| 142 | + // 人民号主页头像显示 | ||
| 143 | + static showHomePageHeaderPage = new WDRouterPage("wdComponent", "ets/pages/ShowHomePageHeaderPage"); | ||
| 144 | + | ||
| 145 | + | ||
| 139 | } | 146 | } |
| @@ -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) => { |
| @@ -69,6 +69,7 @@ export struct DynamicDetailComponent { | @@ -69,6 +69,7 @@ export struct DynamicDetailComponent { | ||
| 69 | @State isNetConnected: boolean = true | 69 | @State isNetConnected: boolean = true |
| 70 | @State isPageEnd: boolean = false | 70 | @State isPageEnd: boolean = false |
| 71 | @State publishCommentModel: publishCommentModel = new publishCommentModel() | 71 | @State publishCommentModel: publishCommentModel = new publishCommentModel() |
| 72 | + @State reachEndIncreament: number = 0 | ||
| 72 | 73 | ||
| 73 | async aboutToAppear() { | 74 | async aboutToAppear() { |
| 74 | await this.getContentDetailData() | 75 | await this.getContentDetailData() |
| @@ -709,4 +710,4 @@ interface radiusType { | @@ -709,4 +710,4 @@ interface radiusType { | ||
| 709 | topRight: number | Resource; | 710 | topRight: number | Resource; |
| 710 | bottomLeft: number | Resource; | 711 | bottomLeft: number | Resource; |
| 711 | bottomRight: number | Resource; | 712 | bottomRight: number | Resource; |
| 712 | -} | ||
| 713 | +} |
| @@ -148,18 +148,19 @@ export struct ENewspaperPageComponent { | @@ -148,18 +148,19 @@ export struct ENewspaperPageComponent { | ||
| 148 | this.calendarDialogController.close() | 148 | this.calendarDialogController.close() |
| 149 | } | 149 | } |
| 150 | }) | 150 | }) |
| 151 | - | ||
| 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 | - }) | 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 | + } | ||
| 163 | } | 164 | } |
| 164 | .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') }) |
| 165 | .height($r('app.float.top_bar_height')) | 166 | .height($r('app.float.top_bar_height')) |
| @@ -311,6 +312,7 @@ export struct ENewspaperPageComponent { | @@ -311,6 +312,7 @@ export struct ENewspaperPageComponent { | ||
| 311 | .width('100%') | 312 | .width('100%') |
| 312 | .height('100%') | 313 | .height('100%') |
| 313 | .backgroundColor($r('app.color.color_80000000')) | 314 | .backgroundColor($r('app.color.color_80000000')) |
| 315 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 314 | .id('e_newspaper_container') | 316 | .id('e_newspaper_container') |
| 315 | 317 | ||
| 316 | if (this.isOpenListDialog) { | 318 | if (this.isOpenListDialog) { |
| @@ -52,6 +52,7 @@ export struct ImageAndTextPageComponent { | @@ -52,6 +52,7 @@ 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 | + @State reachEndIncreament : number = 0 | ||
| 55 | 56 | ||
| 56 | build() { | 57 | build() { |
| 57 | Column() { | 58 | Column() { |
| @@ -141,7 +142,12 @@ export struct ImageAndTextPageComponent { | @@ -141,7 +142,12 @@ export struct ImageAndTextPageComponent { | ||
| 141 | if (this.contentDetailData?.openComment) { | 142 | if (this.contentDetailData?.openComment) { |
| 142 | Divider().strokeWidth(6).color('#f5f5f5') | 143 | Divider().strokeWidth(6).color('#f5f5f5') |
| 143 | CommentComponent({ | 144 | CommentComponent({ |
| 144 | - publishCommentModel: this.publishCommentModel | 145 | + publishCommentModel: this.publishCommentModel, |
| 146 | + fixedHeightMode: false, | ||
| 147 | + reachEndIncreament: this.reachEndIncreament, | ||
| 148 | + reachEndLoadMoreFinish: () => { | ||
| 149 | + | ||
| 150 | + } | ||
| 145 | }).onAreaChange((oldValue: Area, newValue: Area) => { | 151 | }).onAreaChange((oldValue: Area, newValue: Area) => { |
| 146 | this.info = newValue | 152 | this.info = newValue |
| 147 | }) | 153 | }) |
| @@ -157,6 +163,9 @@ export struct ImageAndTextPageComponent { | @@ -157,6 +163,9 @@ export struct ImageAndTextPageComponent { | ||
| 157 | .padding({ bottom: 76 }) | 163 | .padding({ bottom: 76 }) |
| 158 | .scrollBar(BarState.Off) | 164 | .scrollBar(BarState.Off) |
| 159 | .align(Alignment.Top) | 165 | .align(Alignment.Top) |
| 166 | + .onReachEnd(() => { | ||
| 167 | + this.reachEndIncreament += 1 | ||
| 168 | + }) | ||
| 160 | 169 | ||
| 161 | if (!this.isNetConnected) { | 170 | if (!this.isNetConnected) { |
| 162 | EmptyComponent({ | 171 | EmptyComponent({ |
| @@ -228,6 +237,7 @@ export struct ImageAndTextPageComponent { | @@ -228,6 +237,7 @@ export struct ImageAndTextPageComponent { | ||
| 228 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | 237 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) |
| 229 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | 238 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) |
| 230 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | 239 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) |
| 240 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | ||
| 231 | } | 241 | } |
| 232 | if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length && | 242 | if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length && |
| 233 | this.contentDetailData?.audioList[0].audioUrl) { | 243 | this.contentDetailData?.audioList[0].audioUrl) { |
| @@ -340,4 +350,4 @@ export struct ImageAndTextPageComponent { | @@ -340,4 +350,4 @@ export struct ImageAndTextPageComponent { | ||
| 340 | 350 | ||
| 341 | aboutToDisappear() { | 351 | aboutToDisappear() { |
| 342 | } | 352 | } |
| 343 | -} | ||
| 353 | +} |
| 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) |
| @@ -366,6 +366,7 @@ export struct MultiPictureDetailPageComponent { | @@ -366,6 +366,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 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( |
| @@ -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) { |
| @@ -72,6 +72,7 @@ export struct SpacialTopicPageComponent { | @@ -72,6 +72,7 @@ export struct SpacialTopicPageComponent { | ||
| 72 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | 72 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) |
| 73 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | 73 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) |
| 74 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | 74 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) |
| 75 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | ||
| 75 | // } | 76 | // } |
| 76 | this.trySendData2H5() | 77 | this.trySendData2H5() |
| 77 | } | 78 | } |
| @@ -113,4 +114,4 @@ export struct SpacialTopicPageComponent { | @@ -113,4 +114,4 @@ export struct SpacialTopicPageComponent { | ||
| 113 | } | 114 | } |
| 114 | this.getDetail() | 115 | this.getDetail() |
| 115 | } | 116 | } |
| 116 | -} | ||
| 117 | +} |
| @@ -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 | } |
| @@ -45,6 +45,7 @@ export struct Card6Component { | @@ -45,6 +45,7 @@ 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) |
| @@ -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 ? 90 : 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) |
| @@ -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 |
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 { 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){ |
| @@ -84,6 +65,7 @@ export default struct MinePagePersonFunctionUI { | @@ -84,6 +65,7 @@ export default struct MinePagePersonFunctionUI { | ||
| 84 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 65 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 85 | return | 66 | return |
| 86 | } | 67 | } |
| 68 | + this.messageClick() | ||
| 87 | WDRouterRule.jumpWithPage(WDRouterPage.mineMessagePage) | 69 | WDRouterRule.jumpWithPage(WDRouterPage.mineMessagePage) |
| 88 | break; | 70 | break; |
| 89 | } | 71 | } |
| @@ -97,4 +79,13 @@ export default struct MinePagePersonFunctionUI { | @@ -97,4 +79,13 @@ export default struct MinePagePersonFunctionUI { | ||
| 97 | .height('234lpx') | 79 | .height('234lpx') |
| 98 | .margin({top:'31lpx',left:'23lpx',right:'23lpx' }) | 80 | .margin({top:'31lpx',left:'23lpx',right:'23lpx' }) |
| 99 | } | 81 | } |
| 100 | -} | ||
| 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 | +} |
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' | ||
| 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel' | 3 | import MinePageDatasModel from '../../../model/MinePageDatasModel' |
| 3 | import { MessageItem } from '../../../viewmodel/MessageItem' | 4 | import { MessageItem } from '../../../viewmodel/MessageItem' |
| 4 | import { CustomTitleUI } from '../../reusable/CustomTitleUI' | 5 | import { CustomTitleUI } from '../../reusable/CustomTitleUI' |
| 6 | +import { MessageListItemUI } from './MessageListItemUI' | ||
| 5 | 7 | ||
| 6 | const TAG = "MessageListUI" | 8 | const TAG = "MessageListUI" |
| 7 | 9 | ||
| @@ -11,6 +13,123 @@ export struct MessageListUI { | @@ -11,6 +13,123 @@ export struct MessageListUI { | ||
| 11 | 13 | ||
| 12 | aboutToAppear() { | 14 | aboutToAppear() { |
| 13 | this.msgData = MinePageDatasModel.getMessageData() | 15 | this.msgData = MinePageDatasModel.getMessageData() |
| 16 | + this.getHistoryPush() | ||
| 17 | + this.getMessagePush() | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + //历史推送 | ||
| 21 | + getHistoryPush() { | ||
| 22 | + MinePageDatasModel.getHistoryPushData("1", "1").then((value) => { | ||
| 23 | + if (value != null && value.list != null && value.list.length > 0) { | ||
| 24 | + this.msgData.forEach((item) => { | ||
| 25 | + if (item.title == "历史推送") { | ||
| 26 | + if (value.list != null && value.list[0] != null) { | ||
| 27 | + if (value.list[0].newsTitle) { | ||
| 28 | + item.desc = value.list[0].newsTitle | ||
| 29 | + } | ||
| 30 | + if (value.list[0].publishTime) { | ||
| 31 | + item.time = this.getPublishTime("",value.list[0].publishTime) | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | + } | ||
| 35 | + }) | ||
| 36 | + } | ||
| 37 | + }).catch((err: Error) => { | ||
| 38 | + console.log(TAG, JSON.stringify(err)) | ||
| 39 | + }) | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + //互动消息 预约消息 系统消息 | ||
| 43 | + getMessagePush() { | ||
| 44 | + MinePageDatasModel.getMessageUnReadData().then((value) => { | ||
| 45 | + this.msgData.forEach((item) => { | ||
| 46 | + if (item.title == "预约消息") { | ||
| 47 | + if (value.subscribeInfo != null) { | ||
| 48 | + if (value.subscribeInfo.title) { | ||
| 49 | + item.desc = value.subscribeInfo.title | ||
| 50 | + } | ||
| 51 | + if (value.subscribeInfo.time) { | ||
| 52 | + item.time = this.getPublishTime(value.subscribeInfo.time,DateTimeUtils.getDateTimestamp(value.subscribeInfo.time)+"") | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + if(value.subscribeCount > 0){ | ||
| 56 | + item.unReadCount = value.subscribeCount | ||
| 57 | + } | ||
| 58 | + } else if (item.title == "系统消息") { | ||
| 59 | + if (value.systemInfo != null) { | ||
| 60 | + if (value.systemInfo.title) { | ||
| 61 | + item.desc = value.systemInfo.title | ||
| 62 | + } | ||
| 63 | + if (value.systemInfo.time) { | ||
| 64 | + item.time = this.getPublishTime(value.subscribeInfo.time,DateTimeUtils.getDateTimestamp(value.systemInfo.time) + "") | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + if(value.systemCount > 0){ | ||
| 68 | + item.unReadCount = value.systemCount | ||
| 69 | + } | ||
| 70 | + }else if(item.title == "互动消息"){ | ||
| 71 | + if(value.activeCount > 0){ | ||
| 72 | + item.unReadCount = value.activeCount | ||
| 73 | + } | ||
| 74 | + if (value.activeInfo != null) { | ||
| 75 | + if (value.activeInfo.title) { | ||
| 76 | + item.desc = value.activeInfo.title | ||
| 77 | + } | ||
| 78 | + if (value.activeInfo.time) { | ||
| 79 | + item.time = this.getPublishTime(value.subscribeInfo.time,DateTimeUtils.getDateTimestamp(value.activeInfo.time) + "") | ||
| 80 | + } | ||
| 81 | + } | ||
| 82 | + } | ||
| 83 | + }) | ||
| 84 | + }).catch((err: Error) => { | ||
| 85 | + console.log(TAG, JSON.stringify(err)) | ||
| 86 | + }) | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + getPublishTime(data:string,publishTime: string): string { | ||
| 90 | + const publishTimestamp = parseInt(publishTime) | ||
| 91 | + const currentTime = Date.now(); // 当前时间戳 | ||
| 92 | + | ||
| 93 | + // 计算差异 | ||
| 94 | + const timeDifference = currentTime - publishTimestamp; | ||
| 95 | + | ||
| 96 | + // 转换为分钟、小时和天 | ||
| 97 | + const minutes = Math.floor(timeDifference / (1000 * 60)); | ||
| 98 | + const hours = Math.floor(timeDifference / (1000 * 60 * 60)); | ||
| 99 | + const days = Math.floor(timeDifference / (1000 * 60 * 60 * 24)); | ||
| 100 | + | ||
| 101 | + // 根据时间差返回对应的字符串 | ||
| 102 | + let result: string; | ||
| 103 | + | ||
| 104 | + if (minutes < 60) { | ||
| 105 | + result = `${minutes}分钟前`; | ||
| 106 | + if(minutes === 0){ | ||
| 107 | + result = `刚刚`; | ||
| 108 | + } | ||
| 109 | + } else if (hours < 24) { | ||
| 110 | + result = `${hours}小时前`; | ||
| 111 | + } else { | ||
| 112 | + result = `${days}天前`; | ||
| 113 | + if(days > 1){ | ||
| 114 | + let arr = data.split(" ") | ||
| 115 | + if(arr.length === 2){ | ||
| 116 | + let arr2 = arr[0].split("-") | ||
| 117 | + if(arr2.length === 3){ | ||
| 118 | + result = `${arr2[1]}-${arr2[2]}` | ||
| 119 | + } | ||
| 120 | + }else{ | ||
| 121 | + //原始数据是时间戳 需要转成dateString | ||
| 122 | + let time = DateTimeUtils.formatDate(Number(publishTime)) | ||
| 123 | + let arr = time.split("-") | ||
| 124 | + if(arr.length === 3){ | ||
| 125 | + result = `${arr[1]}-${arr[2]}` | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + console.log(result); | ||
| 132 | + return result | ||
| 14 | } | 133 | } |
| 15 | 134 | ||
| 16 | build() { | 135 | build() { |
| @@ -21,73 +140,16 @@ export struct MessageListUI { | @@ -21,73 +140,16 @@ export struct MessageListUI { | ||
| 21 | List() { | 140 | List() { |
| 22 | ForEach(this.msgData, (item: MessageItem, index: number) => { | 141 | ForEach(this.msgData, (item: MessageItem, index: number) => { |
| 23 | ListItem() { | 142 | 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 | - } | 143 | + MessageListItemUI({ item: item, index: index }) |
| 83 | } | 144 | } |
| 84 | - .padding({left:"31lpx",right:"31lpx"}) | 145 | + .padding({ left: "31lpx", right: "31lpx" }) |
| 85 | .onClick(() => { | 146 | .onClick(() => { |
| 86 | - ToastUtils.shortToast(index+"") | ||
| 87 | switch (index) { | 147 | switch (index) { |
| 88 | case 0: //互动消息 | 148 | case 0: //互动消息 |
| 149 | + WDRouterRule.jumpWithPage(WDRouterPage.interactMessagePage) | ||
| 89 | break; | 150 | break; |
| 90 | case 1: //预约消息 | 151 | case 1: //预约消息 |
| 152 | + WDRouterRule.jumpWithPage(WDRouterPage.subscribeMessagePage) | ||
| 91 | break; | 153 | break; |
| 92 | case 2: //历史推送 | 154 | case 2: //历史推送 |
| 93 | break; | 155 | break; |
| 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 | +} |
| @@ -19,19 +19,25 @@ struct EditUserIntroductionPage { | @@ -19,19 +19,25 @@ struct EditUserIntroductionPage { | ||
| 19 | .width('100%') | 19 | .width('100%') |
| 20 | .height(80) | 20 | .height(80) |
| 21 | .backgroundColor(Color.White) | 21 | .backgroundColor(Color.White) |
| 22 | + .placeholderColor('#999999') | ||
| 22 | .onChange(value => { | 23 | .onChange(value => { |
| 23 | this.numCount = value.length | 24 | this.numCount = value.length |
| 24 | if (this.numCount === 60) { | 25 | if (this.numCount === 60) { |
| 25 | this.textColor = '#ED2800' | 26 | this.textColor = '#ED2800' |
| 27 | + }else if(this.numCount === 0){ | ||
| 28 | + this.textColor = '#999999' | ||
| 26 | }else { | 29 | }else { |
| 27 | this.textColor = '#222222' | 30 | this.textColor = '#222222' |
| 28 | } | 31 | } |
| 29 | this.introduction = value | 32 | this.introduction = value |
| 30 | }) | 33 | }) |
| 31 | 34 | ||
| 32 | - Text(this.numCount.toString() + '/60') | ||
| 33 | - .fontColor(this.textColor) | ||
| 34 | - .margin({left: -50}) | 35 | + Row(){ |
| 36 | + Text(this.numCount.toString()) | ||
| 37 | + .fontColor(this.textColor) | ||
| 38 | + Text('/60') | ||
| 39 | + .fontColor('#999999') | ||
| 40 | + }.margin({left: -50}) | ||
| 35 | } | 41 | } |
| 36 | .alignItems(VerticalAlign.Bottom) | 42 | .alignItems(VerticalAlign.Bottom) |
| 37 | 43 | ||
| @@ -42,7 +48,7 @@ struct EditUserIntroductionPage { | @@ -42,7 +48,7 @@ struct EditUserIntroductionPage { | ||
| 42 | Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多60个字,只能输入中文、数字、英文字母。') | 48 | Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多60个字,只能输入中文、数字、英文字母。') |
| 43 | .fontSize(13) | 49 | .fontSize(13) |
| 44 | .padding(12) | 50 | .padding(12) |
| 45 | - .fontColor(Color.Gray) | 51 | + .fontColor(Color.Gray).lineHeight(25) |
| 46 | 52 | ||
| 47 | Button('保存') | 53 | Button('保存') |
| 48 | .type(ButtonType.Normal) | 54 | .type(ButtonType.Normal) |
| @@ -22,19 +22,25 @@ struct EditUserNikeNamePage { | @@ -22,19 +22,25 @@ struct EditUserNikeNamePage { | ||
| 22 | .maxLength(16) | 22 | .maxLength(16) |
| 23 | .height(50) | 23 | .height(50) |
| 24 | .backgroundColor(Color.White) | 24 | .backgroundColor(Color.White) |
| 25 | + .placeholderColor('#999999') | ||
| 25 | .onChange(value => { | 26 | .onChange(value => { |
| 26 | this.numCount = value.length | 27 | this.numCount = value.length |
| 27 | if (this.numCount === 16) { | 28 | if (this.numCount === 16) { |
| 28 | this.textColor = '#ED2800' | 29 | this.textColor = '#ED2800' |
| 30 | + }else if(this.numCount === 0){ | ||
| 31 | + this.textColor = '#999999' | ||
| 29 | }else { | 32 | }else { |
| 30 | this.textColor = '#222222' | 33 | this.textColor = '#222222' |
| 31 | } | 34 | } |
| 32 | this.nikeName = value | 35 | this.nikeName = value |
| 33 | }) | 36 | }) |
| 34 | 37 | ||
| 35 | - Text(this.numCount.toString() + '/16') | ||
| 36 | - .fontColor(this.textColor) | ||
| 37 | - .margin({left: -50}) | 38 | + Row(){ |
| 39 | + Text(this.numCount.toString()) | ||
| 40 | + .fontColor(this.textColor) | ||
| 41 | + Text('/16') | ||
| 42 | + .fontColor('#999999') | ||
| 43 | + }.margin({left: -50}) | ||
| 38 | } | 44 | } |
| 39 | .alignItems(VerticalAlign.Center) | 45 | .alignItems(VerticalAlign.Center) |
| 40 | 46 | ||
| @@ -44,7 +50,7 @@ struct EditUserNikeNamePage { | @@ -44,7 +50,7 @@ struct EditUserNikeNamePage { | ||
| 44 | Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多16个字,只能输入中文、数字、英文字母。') | 50 | Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多16个字,只能输入中文、数字、英文字母。') |
| 45 | .fontSize(13) | 51 | .fontSize(13) |
| 46 | .padding(12) | 52 | .padding(12) |
| 47 | - .fontColor(Color.Gray) | 53 | + .fontColor(Color.Gray).lineHeight(25) |
| 48 | 54 | ||
| 49 | Button('保存') | 55 | Button('保存') |
| 50 | .type(ButtonType.Normal) | 56 | .type(ButtonType.Normal) |
| 1 | 1 | ||
| 2 | -import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel'; | 2 | +import InteractMessageViewModel from '../../viewmodel/InteractMessageViewModel'; |
| 3 | import PageModel from '../../viewmodel/PageModel'; | 3 | import PageModel from '../../viewmodel/PageModel'; |
| 4 | import { CommonConstants, ViewType } from 'wdConstant' | 4 | import { CommonConstants, ViewType } from 'wdConstant' |
| 5 | import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent' | 5 | import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent' |
| 6 | -import { ContentDTO } from 'wdBean' | ||
| 7 | import NoMoreLayout from './NoMoreLayout' | 6 | import NoMoreLayout from './NoMoreLayout' |
| 8 | -import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; | ||
| 9 | -import { CustomSelectUI } from '../view/CustomSelectUI'; | ||
| 10 | -import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; | ||
| 11 | -import { BigPicCardComponent } from '../view/BigPicCardComponent'; | ||
| 12 | - | ||
| 13 | import { CustomTitleUI } from '../reusable/CustomTitleUI'; | 7 | import { CustomTitleUI } from '../reusable/CustomTitleUI'; |
| 14 | -import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | ||
| 15 | import { InteractMComponent } from '../InteractMessage/InteractMComponent'; | 8 | import { InteractMComponent } from '../InteractMessage/InteractMComponent'; |
| 9 | +import { InteractMessageModel, WDMessageCenterMessageType } from '../../model/InteractMessageModel'; | ||
| 10 | +import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | ||
| 16 | 11 | ||
| 17 | @Entry | 12 | @Entry |
| 18 | @Component | 13 | @Component |
| @@ -20,39 +15,40 @@ struct InteractMessagePage { | @@ -20,39 +15,40 @@ struct InteractMessagePage { | ||
| 20 | @State private browSingModel: PageModel = new PageModel() | 15 | @State private browSingModel: PageModel = new PageModel() |
| 21 | isloading : boolean = false | 16 | isloading : boolean = false |
| 22 | @Provide isEditState:boolean = false | 17 | @Provide isEditState:boolean = false |
| 23 | - @State allDatas :ContentDTO[] = []; | 18 | + @State allDatas :InteractMessageModel[] = []; |
| 24 | private scroller: Scroller = new Scroller(); | 19 | private scroller: Scroller = new Scroller(); |
| 25 | - @State likeNum: number = 20 | 20 | + @State likeNum: number = 0 |
| 21 | + @State currentPage: number = 1; | ||
| 26 | 22 | ||
| 27 | aboutToAppear(){ | 23 | aboutToAppear(){ |
| 28 | this.getData() | 24 | this.getData() |
| 25 | + this.getMessageLikeCount() | ||
| 29 | } | 26 | } |
| 30 | 27 | ||
| 31 | build() { | 28 | build() { |
| 32 | Column(){ | 29 | Column(){ |
| 33 | CustomTitleUI({titleName:'互动消息'}) | 30 | CustomTitleUI({titleName:'互动消息'}) |
| 34 | - this.ListLayout() | ||
| 35 | - // if(this.browSingModel.viewType == ViewType.ERROR){ | ||
| 36 | - // EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NetworkFailed}) | ||
| 37 | - // }else if(this.browSingModel.viewType == ViewType.EMPTY){ | ||
| 38 | - // EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoHistory}) | ||
| 39 | - // }else { | ||
| 40 | - // CustomPullToRefresh({ | ||
| 41 | - // alldata:this.allDatas, | ||
| 42 | - // scroller:this.scroller, | ||
| 43 | - // customList:()=>{ | ||
| 44 | - // this.ListLayout() | ||
| 45 | - // }, | ||
| 46 | - // onRefresh:(resolve)=>{ | ||
| 47 | - // this.browSingModel.currentPage = 0 | ||
| 48 | - // this.getData(resolve) | ||
| 49 | - // }, | ||
| 50 | - // onLoadMore:(resolve)=> { | ||
| 51 | - // this.browSingModel.currentPage++ | ||
| 52 | - // this.getData() | ||
| 53 | - // } | ||
| 54 | - // }) | ||
| 55 | - // } | 31 | + if(this.browSingModel.viewType == ViewType.ERROR){ |
| 32 | + EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NetworkFailed}) | ||
| 33 | + }else if(this.browSingModel.viewType == ViewType.EMPTY){ | ||
| 34 | + EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoHistory}) | ||
| 35 | + }else { | ||
| 36 | + CustomPullToRefresh({ | ||
| 37 | + alldata:this.allDatas, | ||
| 38 | + scroller:this.scroller, | ||
| 39 | + customList:()=>{ | ||
| 40 | + this.ListLayout() | ||
| 41 | + }, | ||
| 42 | + onRefresh:(resolve)=>{ | ||
| 43 | + this.browSingModel.currentPage = 0 | ||
| 44 | + this.getData(resolve) | ||
| 45 | + }, | ||
| 46 | + onLoadMore:(resolve)=> { | ||
| 47 | + this.browSingModel.currentPage++ | ||
| 48 | + this.getData() | ||
| 49 | + } | ||
| 50 | + }) | ||
| 51 | + } | ||
| 56 | 52 | ||
| 57 | } | 53 | } |
| 58 | .width(CommonConstants.FULL_WIDTH) | 54 | .width(CommonConstants.FULL_WIDTH) |
| @@ -66,9 +62,9 @@ struct InteractMessagePage { | @@ -66,9 +62,9 @@ struct InteractMessagePage { | ||
| 66 | } | 62 | } |
| 67 | 63 | ||
| 68 | // 下拉刷新 | 64 | // 下拉刷新 |
| 69 | - ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => { | 65 | + ForEach(this.allDatas, (InteractM: InteractMessageModel, compIndex: number) => { |
| 70 | ListItem() { | 66 | ListItem() { |
| 71 | - InteractMComponent() | 67 | + InteractMComponent({messageModel:InteractM}) |
| 72 | } | 68 | } |
| 73 | }) | 69 | }) |
| 74 | // 加载更多 | 70 | // 加载更多 |
| @@ -112,12 +108,22 @@ struct InteractMessagePage { | @@ -112,12 +108,22 @@ struct InteractMessagePage { | ||
| 112 | } | 108 | } |
| 113 | 109 | ||
| 114 | async getData(resolve?: (value: string | PromiseLike<string>) => void){ | 110 | async getData(resolve?: (value: string | PromiseLike<string>) => void){ |
| 115 | - MyCollectionViewModel.fetchMyCollectList(2,'1',this.browSingModel.currentPage,getContext(this)).then(collectionItem => { | 111 | + InteractMessageViewModel.fetchMessageList(WDMessageCenterMessageType.WDMessageCenterMessageType_Interact,this.currentPage).then(InteractMessageMItem => { |
| 116 | if(resolve) resolve('刷新成功') | 112 | if(resolve) resolve('刷新成功') |
| 117 | - if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { | 113 | + if (InteractMessageMItem && InteractMessageMItem.list && InteractMessageMItem.list.length > 0) { |
| 118 | this.browSingModel.viewType = ViewType.LOADED; | 114 | this.browSingModel.viewType = ViewType.LOADED; |
| 119 | - this.allDatas.push(...collectionItem.list) | ||
| 120 | - if (collectionItem.list.length === this.browSingModel.pageSize) { | 115 | + |
| 116 | + if (this.currentPage === 1) { | ||
| 117 | + this.allDatas = [] | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + for (let index = 0; index < InteractMessageMItem.list.length; index++) { | ||
| 121 | + const element = InteractMessageMItem.list[index]; | ||
| 122 | + element.InteractMsubM = JSON.parse(element.remark) | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + this.allDatas.push(...InteractMessageMItem.list) | ||
| 126 | + if (InteractMessageMItem.list.length === this.browSingModel.pageSize) { | ||
| 121 | this.browSingModel.currentPage++; | 127 | this.browSingModel.currentPage++; |
| 122 | this.browSingModel.hasMore = true; | 128 | this.browSingModel.hasMore = true; |
| 123 | } else { | 129 | } else { |
| @@ -129,4 +135,11 @@ struct InteractMessagePage { | @@ -129,4 +135,11 @@ struct InteractMessagePage { | ||
| 129 | }) | 135 | }) |
| 130 | } | 136 | } |
| 131 | 137 | ||
| 138 | + async getMessageLikeCount(){ | ||
| 139 | + InteractMessageViewModel.getMessageLikeCount().then(num => { | ||
| 140 | + this.likeNum = num | ||
| 141 | + }) | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + | ||
| 132 | } | 145 | } |
| 1 | -import { ContentDTO } from 'wdBean'; | 1 | +import { ContentDTO, LiveRoomDataBean } from 'wdBean'; |
| 2 | import { ProcessUtils } from 'wdRouter'; | 2 | import { ProcessUtils } from 'wdRouter'; |
| 3 | import { CommonConstants } from 'wdConstant/Index'; | 3 | import { CommonConstants } from 'wdConstant/Index'; |
| 4 | import PageViewModel from '../../viewmodel/PageViewModel'; | 4 | import PageViewModel from '../../viewmodel/PageViewModel'; |
| 5 | -import RefreshLayout from '../page/RefreshLayout'; | ||
| 6 | -import { RefreshLayoutBean } from '../page/RefreshLayoutBean'; | ||
| 7 | -import PageModel from '../../viewmodel/PageModel'; | ||
| 8 | -import { DateTimeUtils, LazyDataSource } from 'wdKit/Index'; | 5 | +import { DateTimeUtils, LazyDataSource, Logger } from 'wdKit/Index'; |
| 9 | import { router } from '@kit.ArkUI'; | 6 | import { router } from '@kit.ArkUI'; |
| 7 | +import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType'; | ||
| 8 | +import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | ||
| 9 | +import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'; | ||
| 10 | +import { EmptyComponent } from '../view/EmptyComponent'; | ||
| 11 | +import { ErrorComponent } from '../view/ErrorComponent'; | ||
| 12 | +import LoadMoreLayout from '../page/LoadMoreLayout' | ||
| 10 | 13 | ||
| 11 | const TAG: string = 'LiveMorePage'; | 14 | const TAG: string = 'LiveMorePage'; |
| 12 | 15 | ||
| @@ -21,60 +24,22 @@ const TAG: string = 'LiveMorePage'; | @@ -21,60 +24,22 @@ const TAG: string = 'LiveMorePage'; | ||
| 21 | @Entry | 24 | @Entry |
| 22 | @Component | 25 | @Component |
| 23 | struct LiveMorePage { | 26 | struct LiveMorePage { |
| 24 | - @State private pageModel: PageModel = new PageModel(); | ||
| 25 | @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); | 27 | @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); |
| 26 | topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; | 28 | topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; |
| 27 | type: number = 1; | 29 | type: number = 1; |
| 28 | - currentPage: number = 1; | ||
| 29 | pageSize: number = 20; | 30 | pageSize: number = 20; |
| 30 | operDataList: ContentDTO[] = []; | 31 | operDataList: ContentDTO[] = []; |
| 31 | title: string = '直播列表' | 32 | title: string = '直播列表' |
| 32 | @State contentDTO: ContentDTO = new ContentDTO(); | 33 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 33 | - // appStyle: '15', | ||
| 34 | - // coverType: 1, | ||
| 35 | - // objectType: '9', | ||
| 36 | - // coverUrl: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/img/2024/0413/VL20Z09ISBEKXZU_963672030241091584.jpeg?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90', | ||
| 37 | - // fullColumnImgUrls: [ | ||
| 38 | - // { | ||
| 39 | - // landscape: 2, | ||
| 40 | - // size: 1, | ||
| 41 | - // url: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/img/2024/0413/VL20Z09ISBEKXZU_963672030241091584.jpeg?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90', | ||
| 42 | - // weight: 1170 | ||
| 43 | - // } | ||
| 44 | - // ], | ||
| 45 | - // newsTitle: '押解画面公开!被湖北民警从柬埔寨押解回国被湖北民警从柬埔寨押解回国的130名涉赌诈嫌疑人是他们被湖北民警从柬埔寨押解回国的130名涉赌诈嫌疑人是他们的130名涉赌诈嫌疑人是他们', | ||
| 46 | - // publishTime: '1712993333000', | ||
| 47 | - // rmhInfo: { | ||
| 48 | - // authIcon: '', | ||
| 49 | - // authTitle: '', | ||
| 50 | - // authTitle2: '', | ||
| 51 | - // banControl: 0, | ||
| 52 | - // cnIsAttention: 1, | ||
| 53 | - // rmhDesc: '中共武汉市委机关报长江日报官方人民号', | ||
| 54 | - // rmhHeadUrl: 'https://uatjdcdnphoto.aikan.pdnews.cn/vod/content/202302/202302Sa121448724/TUw.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg', | ||
| 55 | - // rmhId: '4255270', | ||
| 56 | - // rmhName: '长江日报', | ||
| 57 | - // userId: '513696944662469', | ||
| 58 | - // userType: '3' | ||
| 59 | - // }, | ||
| 60 | - // videoInfo: { | ||
| 61 | - // firstFrameImageUri: '', | ||
| 62 | - // videoDuration: 12, | ||
| 63 | - // // videoLandscape: 2, | ||
| 64 | - // videoUrl: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/video/2024/0413/VL20Z09ISBEKXZU_963672027208609792.mp4' | ||
| 65 | - // }, | ||
| 66 | - // photoNum: '9', | ||
| 67 | - // voiceInfo: { | ||
| 68 | - // voiceDuration: 12 | ||
| 69 | - // } | ||
| 70 | - // } as ContentDTO; | ||
| 71 | - | 34 | + @State private hasMore: boolean = true |
| 35 | + @State private currentPage: number = 1 | ||
| 36 | + @State private isLoading: boolean = false | ||
| 37 | + @State viewType: ViewType = ViewType.LOADING | ||
| 38 | + private scroller: Scroller = new Scroller() | ||
| 39 | + @State liveRoomList: LiveRoomDataBean[] = [] | ||
| 72 | aboutToAppear(): void { | 40 | aboutToAppear(): void { |
| 73 | - PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then((liveReviewDTO) => { | ||
| 74 | - // this.operDataList = [] | ||
| 75 | - // this.operDataList.push(...liveReviewDTO.list) | ||
| 76 | - this.data.push(...liveReviewDTO.list) | ||
| 77 | - }) | 41 | + this.currentPage = 1 |
| 42 | + this.getData() | ||
| 78 | } | 43 | } |
| 79 | 44 | ||
| 80 | build() { | 45 | build() { |
| @@ -88,48 +53,78 @@ struct LiveMorePage { | @@ -88,48 +53,78 @@ struct LiveMorePage { | ||
| 88 | Column() { | 53 | Column() { |
| 89 | this.TabbarNormal() | 54 | this.TabbarNormal() |
| 90 | 55 | ||
| 91 | - this.ListLayout() | 56 | + if (this.viewType == ViewType.LOADING) { |
| 57 | + this.LoadingLayout() | ||
| 58 | + } else if (this.viewType == ViewType.ERROR) { | ||
| 59 | + ErrorComponent() | ||
| 60 | + .onTouch(() => { | ||
| 61 | + if (this.viewType === ViewType.ERROR) { | ||
| 62 | + this.getData() | ||
| 63 | + } | ||
| 64 | + }) | ||
| 65 | + } else if (this.viewType == ViewType.EMPTY) { | ||
| 66 | + EmptyComponent() | ||
| 67 | + } else { | ||
| 68 | + CustomPullToRefresh({ | ||
| 69 | + alldata: this.data, | ||
| 70 | + scroller: this.scroller, | ||
| 71 | + hasMore: false, | ||
| 72 | + customList: () => { | ||
| 73 | + this.ListLayout() | ||
| 74 | + }, | ||
| 75 | + onRefresh: (resolve) => { | ||
| 76 | + this.currentPage = 1 | ||
| 77 | + this.getData(resolve) | ||
| 78 | + }, | ||
| 79 | + }) | ||
| 80 | + } | ||
| 92 | } | 81 | } |
| 93 | .padding({ | 82 | .padding({ |
| 94 | left: $r('app.float.card_comp_pagePadding_lf'), | 83 | left: $r('app.float.card_comp_pagePadding_lf'), |
| 95 | right: $r('app.float.card_comp_pagePadding_lf'), | 84 | right: $r('app.float.card_comp_pagePadding_lf'), |
| 96 | bottom: $r('app.float.card_comp_pagePadding_tb') | 85 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 97 | }) | 86 | }) |
| 98 | - .onClick((event: ClickEvent) => { | 87 | + .onClick(() => { |
| 99 | ProcessUtils.processPage(this.contentDTO) | 88 | ProcessUtils.processPage(this.contentDTO) |
| 100 | }) | 89 | }) |
| 101 | } | 90 | } |
| 102 | 91 | ||
| 103 | @Builder | 92 | @Builder |
| 93 | + LoadingLayout() { | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + | ||
| 97 | + @Builder | ||
| 104 | ListLayout() { | 98 | ListLayout() { |
| 105 | - List() { | 99 | + List({scroller: this.scroller}) { |
| 106 | // 下拉刷新 | 100 | // 下拉刷新 |
| 107 | - ListItem() { | ||
| 108 | - RefreshLayout({ | ||
| 109 | - refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage, | ||
| 110 | - this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight) | ||
| 111 | - }) | ||
| 112 | - } | ||
| 113 | - | ||
| 114 | - LazyForEach(this.data, (contentDTO: ContentDTO, contentIndex: number) => { | 101 | + LazyForEach(this.data, (contentDTO: ContentDTO) => { |
| 115 | ListItem() { | 102 | ListItem() { |
| 116 | - // Column() { | ||
| 117 | - // CompParser({ compDTO: compDTO, compIndex: compIndex }); | ||
| 118 | - // } | ||
| 119 | this.buildItem(contentDTO) | 103 | this.buildItem(contentDTO) |
| 120 | } | 104 | } |
| 121 | }, | 105 | }, |
| 122 | (contentDTO: ContentDTO, contentIndex: number) => contentDTO.pageId + contentIndex.toString() | 106 | (contentDTO: ContentDTO, contentIndex: number) => contentDTO.pageId + contentIndex.toString() |
| 123 | ) | 107 | ) |
| 108 | + // 加载更多 | ||
| 109 | + ListItem() { | ||
| 110 | + if (this.hasMore && this.data && this.data.totalCount() > 0) { | ||
| 111 | + LoadMoreLayout({ isVisible: this.hasMore }) | ||
| 112 | + } else if (!this.hasMore && !this.isLoading) { | ||
| 113 | + PeopleShipNoMoreData() | ||
| 114 | + } | ||
| 115 | + } | ||
| 124 | } | 116 | } |
| 125 | .scrollBar(BarState.Off) | 117 | .scrollBar(BarState.Off) |
| 118 | + .edgeEffect(EdgeEffect.None) | ||
| 126 | .cachedCount(8) | 119 | .cachedCount(8) |
| 127 | - .height(CommonConstants.FULL_PARENT) | ||
| 128 | - .onScrollIndex((start: number, end: number) => { | ||
| 129 | - // Listen to the first index of the current list. | ||
| 130 | - this.pageModel.startIndex = start; | ||
| 131 | - // 包含了 头尾item,判断时需要考虑+2 | ||
| 132 | - this.pageModel.endIndex = end; | 120 | + .height('calc(100% - 44vp)') |
| 121 | + .onReachEnd(() => { | ||
| 122 | + Logger.debug(TAG, "触底了"); | ||
| 123 | + if(!this.isLoading && this.hasMore){ | ||
| 124 | + //加载分页数据 | ||
| 125 | + this.currentPage++; | ||
| 126 | + this.getData() | ||
| 127 | + } | ||
| 133 | }) | 128 | }) |
| 134 | } | 129 | } |
| 135 | 130 | ||
| @@ -148,22 +143,45 @@ struct LiveMorePage { | @@ -148,22 +143,45 @@ struct LiveMorePage { | ||
| 148 | .margin({ top: 16, bottom: 8 }) | 143 | .margin({ top: 16, bottom: 8 }) |
| 149 | .alignSelf(ItemAlign.Start) | 144 | .alignSelf(ItemAlign.Start) |
| 150 | Stack() { | 145 | Stack() { |
| 151 | - Image(item.fullColumnImgUrls[0].url) | ||
| 152 | - .width('100%') | ||
| 153 | - .height(196) | ||
| 154 | - .borderRadius(4) | ||
| 155 | - this.LiveImage() | ||
| 156 | - | 146 | + if (item.fullColumnImgUrls && item.fullColumnImgUrls.length > 0) { |
| 147 | + Image(item.fullColumnImgUrls[0].url) | ||
| 148 | + .width('100%') | ||
| 149 | + .height(196) | ||
| 150 | + .borderRadius(4) | ||
| 151 | + } | ||
| 152 | + this.LiveImage(item) | ||
| 157 | } | 153 | } |
| 158 | .alignContent(Alignment.BottomEnd) | 154 | .alignContent(Alignment.BottomEnd) |
| 159 | 155 | ||
| 160 | - Text(DateTimeUtils.getCommentTime(Number.parseFloat(item.publishTimestamp))) | ||
| 161 | - .fontSize(13) | ||
| 162 | - .maxLines(1) | ||
| 163 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 164 | - .margin({ top: 8, bottom: 8 }) | ||
| 165 | - .align(Alignment.Start) | ||
| 166 | - .width('100%') | 156 | + Row() { |
| 157 | + if (item.rmhInfo && item.rmhInfo.rmhName) { | ||
| 158 | + Text(item.rmhInfo.rmhName) | ||
| 159 | + .fontSize(12) | ||
| 160 | + .fontWeight(400) | ||
| 161 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 162 | + .fontFamily('PingFang SC-Medium') | ||
| 163 | + .maxLines(1) | ||
| 164 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 165 | + .align(Alignment.Start) | ||
| 166 | + | ||
| 167 | + Image($r('app.media.point_live_icon')) | ||
| 168 | + .objectFit(ImageFit.Auto) | ||
| 169 | + .interpolation(ImageInterpolation.High) | ||
| 170 | + .width(16) | ||
| 171 | + .height(16) | ||
| 172 | + .margin(2) | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(item.publishTimestamp))) | ||
| 176 | + .fontSize(12) | ||
| 177 | + .maxLines(1) | ||
| 178 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 179 | + .align(Alignment.Start) | ||
| 180 | + .width('100%') | ||
| 181 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 182 | + } | ||
| 183 | + .margin({ top: 8, bottom: 8 }) | ||
| 184 | + | ||
| 167 | 185 | ||
| 168 | Divider() | 186 | Divider() |
| 169 | .strokeWidth(1) | 187 | .strokeWidth(1) |
| @@ -198,10 +216,10 @@ struct LiveMorePage { | @@ -198,10 +216,10 @@ struct LiveMorePage { | ||
| 198 | Text(this.title)// .height('42lpx') | 216 | Text(this.title)// .height('42lpx') |
| 199 | .maxLines(1) | 217 | .maxLines(1) |
| 200 | .id("title") | 218 | .id("title") |
| 201 | - .fontSize('35lpx') | 219 | + .fontSize('18vp') |
| 202 | .fontWeight(400) | 220 | .fontWeight(400) |
| 203 | .fontColor($r('app.color.color_222222')) | 221 | .fontColor($r('app.color.color_222222')) |
| 204 | - .lineHeight('42lpx') | 222 | + .lineHeight('22vp') |
| 205 | .alignRules({ | 223 | .alignRules({ |
| 206 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 224 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| 207 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 225 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| @@ -212,17 +230,141 @@ struct LiveMorePage { | @@ -212,17 +230,141 @@ struct LiveMorePage { | ||
| 212 | } | 230 | } |
| 213 | 231 | ||
| 214 | @Builder | 232 | @Builder |
| 215 | - LiveImage() { | 233 | + LiveImage(item: ContentDTO) { |
| 216 | Row() { | 234 | Row() { |
| 217 | - Image($r('app.media.icon_live_status_running')) | ||
| 218 | - .width(22) | ||
| 219 | - .height(18) | 235 | + Image($r('app.media.icon_live_new_running')) |
| 236 | + .width(14) | ||
| 237 | + .height(14) | ||
| 238 | + .margin({ | ||
| 239 | + right: '2vp' | ||
| 240 | + }) | ||
| 220 | Text('直播中') | 241 | Text('直播中') |
| 221 | - .fontSize('11fp') | 242 | + .fontSize('12vp') |
| 222 | .fontWeight(400) | 243 | .fontWeight(400) |
| 223 | .fontColor(Color.White) | 244 | .fontColor(Color.White) |
| 245 | + .margin({ | ||
| 246 | + right: '5vp' | ||
| 247 | + }) | ||
| 248 | + Divider() | ||
| 249 | + .vertical(true) | ||
| 250 | + .strokeWidth(1) | ||
| 251 | + .height('12vp') | ||
| 252 | + .margin({ top: 2, bottom: 2 }) | ||
| 253 | + .color(Color.White) | ||
| 254 | + if (this.getLiveRoomNumber(item).length > 0) { | ||
| 255 | + Text(this.getLiveRoomNumber(item)) | ||
| 256 | + .fontSize('12vp') | ||
| 257 | + .fontWeight(400) | ||
| 258 | + .fontColor(Color.White) | ||
| 259 | + .margin({ | ||
| 260 | + left: '5vp' | ||
| 261 | + }) | ||
| 262 | + } | ||
| 224 | } | 263 | } |
| 225 | - .backgroundColor('#4D000000') | 264 | + .justifyContent(FlexAlign.End) |
| 226 | .margin({ right: 8, bottom: 8 }) | 265 | .margin({ right: 8, bottom: 8 }) |
| 227 | } | 266 | } |
| 267 | + | ||
| 268 | + private async getData(resolve?: (value: string | PromiseLike<string>) => void) { | ||
| 269 | + if (this.isLoading) { | ||
| 270 | + if (resolve) { | ||
| 271 | + resolve('已更新至最新') | ||
| 272 | + } | ||
| 273 | + return | ||
| 274 | + } | ||
| 275 | + this.isLoading = true | ||
| 276 | + try { | ||
| 277 | + const liveReviewDTO = await PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize) | ||
| 278 | + | ||
| 279 | + if (liveReviewDTO && liveReviewDTO.list && liveReviewDTO.list.length > 0) { | ||
| 280 | + if (liveReviewDTO.list.length === this.pageSize) { | ||
| 281 | + this.hasMore = true; | ||
| 282 | + } else { | ||
| 283 | + this.hasMore = false; | ||
| 284 | + } | ||
| 285 | + if (this.currentPage == 1) { | ||
| 286 | + this.data.clear() | ||
| 287 | + } | ||
| 288 | + this.data.push(...liveReviewDTO.list) | ||
| 289 | + this.getLiveRoomDataInfo(liveReviewDTO.list) | ||
| 290 | + } else { | ||
| 291 | + this.hasMore = false; | ||
| 292 | + } | ||
| 293 | + this.resolveEnd(true, resolve) | ||
| 294 | + if (liveReviewDTO.list.length == 0 && this.currentPage == 1) { | ||
| 295 | + this.viewType = ViewType.EMPTY | ||
| 296 | + } | ||
| 297 | + }catch (exception) { | ||
| 298 | + this.resolveEnd(false, resolve) | ||
| 299 | + } | ||
| 300 | + // PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then(async (liveReviewDTO) => { | ||
| 301 | + // // this.operDataList = [] | ||
| 302 | + // // this.operDataList.push(...liveReviewDTO.list) | ||
| 303 | + // this.data.push(...liveReviewDTO.list) | ||
| 304 | + // | ||
| 305 | + // // this.getAppointmentInfo() | ||
| 306 | + // }) | ||
| 307 | + } | ||
| 308 | + | ||
| 309 | + private resolveEnd(isTop: boolean, resolve?: (value: string | PromiseLike<string>) => void) { | ||
| 310 | + if (resolve) { | ||
| 311 | + if (this.currentPage == 1 && isTop) { | ||
| 312 | + resolve('已更新至最新') | ||
| 313 | + }else { | ||
| 314 | + resolve('') | ||
| 315 | + } | ||
| 316 | + } | ||
| 317 | + if (this.currentPage == 1 && !isTop) { | ||
| 318 | + this.viewType = ViewType.ERROR | ||
| 319 | + } else { | ||
| 320 | + this.viewType = ViewType.LOADED | ||
| 321 | + } | ||
| 322 | + this.isLoading = false | ||
| 323 | + } | ||
| 324 | + | ||
| 325 | + private getLiveDetailIds(list: ContentDTO[]): string { | ||
| 326 | + let idList: string[] = [] | ||
| 327 | + list.forEach(item => { | ||
| 328 | + idList.push(item.objectId) | ||
| 329 | + }); | ||
| 330 | + return idList.join(',') | ||
| 331 | + } | ||
| 332 | + // 获取评论数 | ||
| 333 | + async getLiveRoomDataInfo(list: ContentDTO[]) { | ||
| 334 | + const reserveIds = this.getLiveDetailIds(list) | ||
| 335 | + Logger.debug(TAG,'是否预约数据:' +` ${reserveIds}`) | ||
| 336 | + PageViewModel.getLiveRoomBatchInfo(reserveIds).then((result) => { | ||
| 337 | + Logger.debug(TAG,'是否预约数据:' +` ${JSON.stringify(result)}`) | ||
| 338 | + if (result && result.length > 0) { | ||
| 339 | + this.liveRoomList.push(...result) | ||
| 340 | + this.data.reloadData() | ||
| 341 | + } | ||
| 342 | + }).catch(() =>{ | ||
| 343 | + // this.data.push(...list) | ||
| 344 | + }) | ||
| 345 | + } | ||
| 346 | + | ||
| 347 | + // 判断是否预约 | ||
| 348 | + getLiveRoomNumber(item: ContentDTO): string { | ||
| 349 | + const objc = this.liveRoomList.find((element: LiveRoomDataBean) => { | ||
| 350 | + return element.liveId.toString() == item.objectId | ||
| 351 | + }) | ||
| 352 | + if (objc && objc.pv && objc.pv > 0) { | ||
| 353 | + return this.computeShowNum(objc.pv) | ||
| 354 | + } | ||
| 355 | + return '' | ||
| 356 | + } | ||
| 357 | + | ||
| 358 | + private computeShowNum(count: number): string { | ||
| 359 | + if (count >= 10000) { | ||
| 360 | + let num = ( count / 10000).toFixed(1) | ||
| 361 | + if (Number(num.substring(num.length-1)) == 0) { | ||
| 362 | + num = num.substring(0, num.length-2) | ||
| 363 | + } | ||
| 364 | + return num + '万人参加' | ||
| 365 | + } | ||
| 366 | + return `${count}人参加` | ||
| 367 | + } | ||
| 368 | + | ||
| 369 | + | ||
| 228 | } | 370 | } |
| @@ -31,7 +31,10 @@ export struct MinePageComponent { | @@ -31,7 +31,10 @@ export struct MinePageComponent { | ||
| 31 | this.isLogin = false | 31 | this.isLogin = false |
| 32 | }else { | 32 | }else { |
| 33 | this.isLogin = true | 33 | this.isLogin = true |
| 34 | - this.addRecordDialog() | 34 | + this.addRecordDialog() |
| 35 | + if(this.personalData.length > 0){ | ||
| 36 | + this.getMessageData() | ||
| 37 | + } | ||
| 35 | } | 38 | } |
| 36 | } | 39 | } |
| 37 | } | 40 | } |
| @@ -53,8 +56,25 @@ export struct MinePageComponent { | @@ -53,8 +56,25 @@ export struct MinePageComponent { | ||
| 53 | this.getUserLogin() | 56 | this.getUserLogin() |
| 54 | this.getFunctionData() | 57 | this.getFunctionData() |
| 55 | this.addLoginStatusObserver() | 58 | this.addLoginStatusObserver() |
| 59 | + this.getMessageData() | ||
| 56 | } | 60 | } |
| 57 | 61 | ||
| 62 | + getMessageData(){ | ||
| 63 | + MinePageDatasModel.getMessageUnReadData().then((value) => { | ||
| 64 | + if(value !=null) { | ||
| 65 | + if(value.activeCount >0 ||value.subscribeCount > 0 || value.systemCount > 0){ | ||
| 66 | + this.personalData.forEach((value) => { | ||
| 67 | + if(value.msg == "消息") | ||
| 68 | + value.isShowRedPoint = true | ||
| 69 | + }) | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + }).catch((err: Error) => { | ||
| 73 | + console.log(TAG, JSON.stringify(err)) | ||
| 74 | + }) | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + | ||
| 58 | async addLoginStatusObserver(){ | 78 | async addLoginStatusObserver(){ |
| 59 | this.preferences = await SPHelper.default.getPreferences(); | 79 | this.preferences = await SPHelper.default.getPreferences(); |
| 60 | this.preferences.on('change', this.observer); | 80 | this.preferences.on('change', this.observer); |
| @@ -21,6 +21,7 @@ const TAG = 'PageComponent'; | @@ -21,6 +21,7 @@ const TAG = 'PageComponent'; | ||
| 21 | export struct PageComponent { | 21 | export struct PageComponent { |
| 22 | @State private pageModel: PageModel = new PageModel(); | 22 | @State private pageModel: PageModel = new PageModel(); |
| 23 | @State private pageAdvModel: PageAdModel = new PageAdModel(); | 23 | @State private pageAdvModel: PageAdModel = new PageAdModel(); |
| 24 | + @State timer: number = -1 | ||
| 24 | navIndex: number = 0; | 25 | navIndex: number = 0; |
| 25 | pageId: string = ""; | 26 | pageId: string = ""; |
| 26 | channelId: string = ""; | 27 | channelId: string = ""; |
| @@ -29,6 +30,7 @@ export struct PageComponent { | @@ -29,6 +30,7 @@ export struct PageComponent { | ||
| 29 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 | 30 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 |
| 30 | private listScroller: Scroller = new Scroller(); | 31 | private listScroller: Scroller = new Scroller(); |
| 31 | needload: boolean = true; | 32 | needload: boolean = true; |
| 33 | + | ||
| 32 | build() { | 34 | build() { |
| 33 | Column() { | 35 | Column() { |
| 34 | if (this.pageModel.viewType == ViewType.LOADING) { | 36 | if (this.pageModel.viewType == ViewType.LOADING) { |
| @@ -222,9 +224,10 @@ export struct PageComponent { | @@ -222,9 +224,10 @@ export struct PageComponent { | ||
| 222 | } | 224 | } |
| 223 | 225 | ||
| 224 | onChange() { | 226 | onChange() { |
| 225 | - Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`); | 227 | + Logger.info(TAG, |
| 228 | + `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`); | ||
| 226 | if (this.navIndex === this.currentTopNavSelectedIndex) { | 229 | if (this.navIndex === this.currentTopNavSelectedIndex) { |
| 227 | - if(this.needload){ | 230 | + if (this.needload) { |
| 228 | this.getData(); | 231 | this.getData(); |
| 229 | } | 232 | } |
| 230 | this.needload = false; | 233 | this.needload = false; |
| @@ -242,13 +245,19 @@ export struct PageComponent { | @@ -242,13 +245,19 @@ export struct PageComponent { | ||
| 242 | } | 245 | } |
| 243 | 246 | ||
| 244 | async getData() { | 247 | async getData() { |
| 245 | - Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`); | ||
| 246 | - this.pageModel.pageId = this.pageId; | ||
| 247 | - this.pageModel.groupId = this.pageId; | ||
| 248 | - this.pageModel.channelId = this.channelId; | ||
| 249 | - this.pageModel.currentPage = 1; | ||
| 250 | - this.pageModel.pageTotalCompSize = 0; | ||
| 251 | - PageHelper.getInitData(this.pageModel, this.pageAdvModel) | 248 | + if (this.timer) { |
| 249 | + clearTimeout(this.timer) | ||
| 250 | + } | ||
| 251 | + this.timer = setTimeout(() => { | ||
| 252 | + Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`); | ||
| 253 | + this.pageModel.pageId = this.pageId; | ||
| 254 | + this.pageModel.groupId = this.pageId; | ||
| 255 | + this.pageModel.channelId = this.channelId; | ||
| 256 | + this.pageModel.currentPage = 1; | ||
| 257 | + this.pageModel.pageTotalCompSize = 0; | ||
| 258 | + PageHelper.getInitData(this.pageModel, this.pageAdvModel) | ||
| 259 | + }, 100) | ||
| 260 | + | ||
| 252 | } | 261 | } |
| 253 | } | 262 | } |
| 254 | 263 |
| @@ -13,6 +13,7 @@ import { | @@ -13,6 +13,7 @@ import { | ||
| 13 | PeopleShipUserDetailData, | 13 | PeopleShipUserDetailData, |
| 14 | ArticleCountData | 14 | ArticleCountData |
| 15 | } from 'wdBean' | 15 | } from 'wdBean' |
| 16 | +import { EmptyComponent } from '../view/EmptyComponent' | ||
| 16 | 17 | ||
| 17 | @Entry | 18 | @Entry |
| 18 | @Component | 19 | @Component |
| @@ -35,65 +36,87 @@ struct PeopleShipHomePage { | @@ -35,65 +36,87 @@ struct PeopleShipHomePage { | ||
| 35 | @Provide @Watch('handleChangeAttentionStata') isLoadingAttention: boolean = false | 36 | @Provide @Watch('handleChangeAttentionStata') isLoadingAttention: boolean = false |
| 36 | //关注显示 | 37 | //关注显示 |
| 37 | @State attentionOpacity: boolean = false | 38 | @State attentionOpacity: boolean = false |
| 38 | - @Provide topHeight: number = 400 | 39 | + @Provide topHeight: number = 286 |
| 40 | + @State isLoading: boolean = true | ||
| 39 | 41 | ||
| 40 | build() { | 42 | build() { |
| 41 | - | ||
| 42 | - Stack({ alignContent: Alignment.TopStart }) { | ||
| 43 | - // 头部返回 | ||
| 44 | - PeopleShipHomePageNavComponent({ | ||
| 45 | - attentionOpacity: this.attentionOpacity, | ||
| 46 | - topOpacity: this.topOpacity, | ||
| 47 | - detailModel: this.detailModel | ||
| 48 | - }) | ||
| 49 | - .height($r('app.float.top_bar_height')) | ||
| 50 | - .zIndex(100) | ||
| 51 | - .backgroundColor(Color.Transparent) | ||
| 52 | - | ||
| 53 | - if (this.detailModel && this.detailModel.userName) { | ||
| 54 | - Scroll(this.scroller) { | ||
| 55 | - Column() { | ||
| 56 | - // 顶部相关 | ||
| 57 | - PeopleShipHomePageTopComponent({ | ||
| 58 | - creatorId: this.creatorId, | ||
| 59 | - detailModel: this.detailModel, | ||
| 60 | - publishCount: this.publishCount, | ||
| 61 | - topHeight: this.topHeight | ||
| 62 | - }) | 43 | + Stack({ alignContent: Alignment.TopStart }) { |
| 44 | + // 顶部图片 | ||
| 45 | + Image($r('app.media.home_page_bg')) | ||
| 46 | + .width('100%') | ||
| 47 | + .height('120vp') | ||
| 48 | + .objectFit(ImageFit.Fill) | ||
| 49 | + .backgroundColor(Color.White) | ||
| 50 | + .visibility(this.isLoading ? Visibility.None : Visibility.Visible) | ||
| 51 | + | ||
| 52 | + Column(){ | ||
| 53 | + // 头部返回 | ||
| 54 | + PeopleShipHomePageNavComponent({ | ||
| 55 | + attentionOpacity: this.attentionOpacity, | ||
| 56 | + topOpacity: this.topOpacity, | ||
| 57 | + detailModel: this.detailModel | ||
| 58 | + }) | ||
| 59 | + .height($r('app.float.top_bar_height')) | ||
| 60 | + .backgroundColor(Color.Transparent) | ||
| 61 | + if (this.detailModel && this.detailModel.userName) { | ||
| 62 | + Scroll(this.scroller) { | ||
| 63 | + Column() { | ||
| 64 | + // 顶部相关 | ||
| 65 | + PeopleShipHomePageTopComponent({ | ||
| 66 | + creatorId: this.creatorId, | ||
| 67 | + detailModel: this.detailModel, | ||
| 68 | + publishCount: this.publishCount, | ||
| 69 | + topHeight: this.topHeight | ||
| 70 | + }) | ||
| 71 | + .width("100%") | ||
| 72 | + .height(this.topHeight) | ||
| 73 | + // 列表 | ||
| 74 | + Column(){ | ||
| 75 | + PeopleShipHomeListComponent({ | ||
| 76 | + publishCount: this.publishCount, | ||
| 77 | + creatorId: this.creatorId | ||
| 78 | + }) | ||
| 79 | + }.height('100%') | ||
| 80 | + | ||
| 81 | + | ||
| 82 | + } | ||
| 63 | .width("100%") | 83 | .width("100%") |
| 64 | - .height(this.topHeight) | 84 | + .justifyContent(FlexAlign.Start) |
| 85 | + .alignItems(HorizontalAlign.Start) | ||
| 86 | + // .height('100%') | ||
| 87 | + // .height(this.publishCount == 0 ? '100%' : '') | ||
| 88 | + } | ||
| 89 | + .scrollable(ScrollDirection.Vertical) | ||
| 90 | + // .alignSelf(ItemAlign.Start) | ||
| 91 | + // .align(Alignment.Start) | ||
| 92 | + .edgeEffect(EdgeEffect.None) | ||
| 93 | + .friction(0.7) | ||
| 94 | + .backgroundColor(Color.White) | ||
| 95 | + .scrollBar(BarState.Off) | ||
| 96 | + .width('100%') | ||
| 97 | + .height('calc(100% - 44vp)') | ||
| 98 | + // .layoutWeight(1) | ||
| 99 | + .onDidScroll(() => { | ||
| 100 | + // this.topOpacity = yOffset / (this.getDeviceHeight() * 0.2) | ||
| 101 | + this.topOpacity = this.scroller.currentOffset().yOffset / 100 | ||
| 102 | + if (this.scroller.currentOffset().yOffset >= this.topHeight - 66) { | ||
| 103 | + this.attentionOpacity = true | ||
| 104 | + } else { | ||
| 105 | + this.attentionOpacity = false | ||
| 106 | + } | ||
| 107 | + Logger.debug('PeopleShipHomePage',`透明度:${this.topOpacity}`) | ||
| 65 | 108 | ||
| 66 | - // 列表 | ||
| 67 | - PeopleShipHomeListComponent({ | ||
| 68 | - publishCount: this.publishCount, | ||
| 69 | - creatorId: this.creatorId | ||
| 70 | }) | 109 | }) |
| 71 | - | ||
| 72 | } | 110 | } |
| 73 | - .width("100%") | ||
| 74 | - .justifyContent(FlexAlign.Start) | ||
| 75 | - // .height(this.publishCount == 0 ? '100%' : '') | 111 | + |
| 76 | } | 112 | } |
| 77 | - .edgeEffect(EdgeEffect.None) | ||
| 78 | - .friction(0.6) | ||
| 79 | - .backgroundColor(Color.White) | ||
| 80 | - .scrollBar(BarState.Off) | 113 | + .alignItems(HorizontalAlign.Start) |
| 114 | + .justifyContent(FlexAlign.Start) | ||
| 81 | .width('100%') | 115 | .width('100%') |
| 82 | - .height('100%') | ||
| 83 | - .onDidScroll(() => { | ||
| 84 | - // this.topOpacity = yOffset / (this.getDeviceHeight() * 0.2) | ||
| 85 | - this.topOpacity = this.scroller.currentOffset().yOffset / 100 | ||
| 86 | - if (this.scroller.currentOffset().yOffset >= this.topHeight - 66) { | ||
| 87 | - this.attentionOpacity = true | ||
| 88 | - } else { | ||
| 89 | - this.attentionOpacity = false | ||
| 90 | - } | ||
| 91 | - Logger.debug('PeopleShipHomePage',`透明度:${this.topOpacity}`) | ||
| 92 | - | ||
| 93 | - }) | 116 | + // .height('100%') |
| 94 | } | 117 | } |
| 95 | - | ||
| 96 | - } | 118 | + // .height('100%') |
| 119 | + .width('100%') | ||
| 97 | 120 | ||
| 98 | } | 121 | } |
| 99 | 122 | ||
| @@ -104,9 +127,11 @@ struct PeopleShipHomePage { | @@ -104,9 +127,11 @@ struct PeopleShipHomePage { | ||
| 104 | 127 | ||
| 105 | private async getData() { | 128 | private async getData() { |
| 106 | try { | 129 | try { |
| 130 | + this.isLoading = true | ||
| 107 | // 获取页面信息 | 131 | // 获取页面信息 |
| 108 | this.detailModel = await PeopleShipHomePageDataModel.getPeopleShipHomePageDetailInfo(this.creatorId, '', '') | 132 | this.detailModel = await PeopleShipHomePageDataModel.getPeopleShipHomePageDetailInfo(this.creatorId, '', '') |
| 109 | Logger.debug('PeopleShipHomePage', '获取页面信息' + `${JSON.stringify(this.detailModel)}`) | 133 | Logger.debug('PeopleShipHomePage', '获取页面信息' + `${JSON.stringify(this.detailModel)}`) |
| 134 | + this.isLoading = false | ||
| 110 | 135 | ||
| 111 | // 获取关注 | 136 | // 获取关注 |
| 112 | // 登录后获取,是否关注 | 137 | // 登录后获取,是否关注 |
| @@ -117,7 +142,7 @@ struct PeopleShipHomePage { | @@ -117,7 +142,7 @@ struct PeopleShipHomePage { | ||
| 117 | } | 142 | } |
| 118 | 143 | ||
| 119 | } catch (exception) { | 144 | } catch (exception) { |
| 120 | - | 145 | + this.isLoading = false |
| 121 | } | 146 | } |
| 122 | } | 147 | } |
| 123 | 148 |
| 1 | +import { insightIntent } from '@kit.IntentsKit'; | ||
| 1 | import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean'; | 2 | import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean'; |
| 2 | import { SpConstants } from 'wdConstant'; | 3 | import { SpConstants } from 'wdConstant'; |
| 3 | import { DisplayUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit'; | 4 | import { DisplayUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit'; |
| @@ -8,6 +9,7 @@ import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent | @@ -8,6 +9,7 @@ import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent | ||
| 8 | import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; | 9 | import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; |
| 9 | import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent'; | 10 | import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent'; |
| 10 | import { channelSkeleton } from '../skeleton/channelSkeleton'; | 11 | import { channelSkeleton } from '../skeleton/channelSkeleton'; |
| 12 | +import { common } from '@kit.AbilityKit'; | ||
| 11 | 13 | ||
| 12 | 14 | ||
| 13 | const TAG = 'TopNavigationComponent'; | 15 | const TAG = 'TopNavigationComponent'; |
| @@ -37,6 +39,7 @@ export struct TopNavigationComponent { | @@ -37,6 +39,7 @@ export struct TopNavigationComponent { | ||
| 37 | // 顶导当前选中/焦点下标 | 39 | // 顶导当前选中/焦点下标 |
| 38 | @State currentTopNavSelectedIndex: number = 0; | 40 | @State currentTopNavSelectedIndex: number = 0; |
| 39 | @State currentTopNavName: string = ''; | 41 | @State currentTopNavName: string = ''; |
| 42 | + @State currentTopNavItem: TopNavDTO = {} as TopNavDTO | ||
| 40 | // 顶导数据 | 43 | // 顶导数据 |
| 41 | @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] | 44 | @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] |
| 42 | @State compList: LazyDataSource<CompDTO> = new LazyDataSource(); | 45 | @State compList: LazyDataSource<CompDTO> = new LazyDataSource(); |
| @@ -58,6 +61,8 @@ export struct TopNavigationComponent { | @@ -58,6 +61,8 @@ export struct TopNavigationComponent { | ||
| 58 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 | 61 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 |
| 59 | // 传递给page的自动刷新通知 | 62 | // 传递给page的自动刷新通知 |
| 60 | @State autoRefresh2Page: number = 0 | 63 | @State autoRefresh2Page: number = 0 |
| 64 | + //保存当前导航选中时的时间戳 意图开始时间 | ||
| 65 | + @State executedStartTime: number = new Date().getTime() | ||
| 61 | // 当前底导index | 66 | // 当前底导index |
| 62 | @State navIndex: number = 0 | 67 | @State navIndex: number = 0 |
| 63 | @State animationDuration: number = 0 | 68 | @State animationDuration: number = 0 |
| @@ -167,6 +172,7 @@ export struct TopNavigationComponent { | @@ -167,6 +172,7 @@ export struct TopNavigationComponent { | ||
| 167 | this.currentTopNavSelectedIndex = index | 172 | this.currentTopNavSelectedIndex = index |
| 168 | this.currentTopNavName = this.myChannelList[index].name | 173 | this.currentTopNavName = this.myChannelList[index].name |
| 169 | } | 174 | } |
| 175 | + this.currentTopNavItem = this.myChannelList[this.currentTopNavSelectedIndex] | ||
| 170 | } | 176 | } |
| 171 | 177 | ||
| 172 | isBroadcast(item: TopNavDTO) { | 178 | isBroadcast(item: TopNavDTO) { |
| @@ -184,6 +190,49 @@ export struct TopNavigationComponent { | @@ -184,6 +190,49 @@ export struct TopNavigationComponent { | ||
| 184 | return item.channelType === 3 | 190 | return item.channelType === 3 |
| 185 | } | 191 | } |
| 186 | 192 | ||
| 193 | + //意图共享 | ||
| 194 | + topNavInsightIntentShare(item: TopNavDTO){ | ||
| 195 | + let tapNavIntent: insightIntent.InsightIntent = { | ||
| 196 | + intentName: 'ViewColumn', | ||
| 197 | + intentVersion: '1.0.1', | ||
| 198 | + identifier: '52dac3b0-6520-4974-81e5-25f0879449b5', | ||
| 199 | + intentActionInfo: { | ||
| 200 | + actionMode: 'EXPECTED', | ||
| 201 | + currentPercentage: 50, | ||
| 202 | + executedTimeSlots: { | ||
| 203 | + executedEndTime: new Date().getTime(), | ||
| 204 | + executedStartTime: this.executedStartTime | ||
| 205 | + } | ||
| 206 | + }, | ||
| 207 | + intentEntityInfo: { | ||
| 208 | + entityName: 'ViewColumn', | ||
| 209 | + entityId: String(item.pageId) || '', | ||
| 210 | + displayName: item.name, | ||
| 211 | + logoURL: 'https://www-file.huawei.com/-/media/corporate/images/home/logo/huawei_logo.png', | ||
| 212 | + rankingHint: 99, | ||
| 213 | + isPublicData: true | ||
| 214 | + } | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + try { | ||
| 218 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 219 | + // 共享数据 | ||
| 220 | + insightIntent.shareIntent(context, [tapNavIntent], (error) => { | ||
| 221 | + if (error?.code) { | ||
| 222 | + // 处理业务逻辑错误 | ||
| 223 | + console.error(`shareIntent failed, error.code: ${error?.code}, error.message: ${error?.message}`); | ||
| 224 | + return; | ||
| 225 | + } | ||
| 226 | + // 执行正常业务 | ||
| 227 | + console.log('shareIntent succeed'); | ||
| 228 | + }); | ||
| 229 | + } catch (error) { | ||
| 230 | + // 处理异常 | ||
| 231 | + console.error(`error.code: ${error?.code}, error.message: ${error?.message}`); | ||
| 232 | + } | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + | ||
| 187 | build() { | 236 | build() { |
| 188 | Column() { | 237 | Column() { |
| 189 | // 顶部搜索、日报logo、早晚报 | 238 | // 顶部搜索、日报logo、早晚报 |
| @@ -278,7 +327,11 @@ export struct TopNavigationComponent { | @@ -278,7 +327,11 @@ export struct TopNavigationComponent { | ||
| 278 | if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && | 327 | if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && |
| 279 | !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) | 328 | !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) |
| 280 | ) { | 329 | ) { |
| 330 | + //在 tab 切换之前意图共享 | ||
| 331 | + // this.topNavInsightIntentShare(this.currentTopNavItem) | ||
| 332 | + | ||
| 281 | this.currentTopNavSelectedIndex = index; | 333 | this.currentTopNavSelectedIndex = index; |
| 334 | + this.currentTopNavItem = this.myChannelList[index] | ||
| 282 | } | 335 | } |
| 283 | if (this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) { | 336 | if (this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) { |
| 284 | // 跳转到播报页面 | 337 | // 跳转到播报页面 |
| @@ -416,9 +469,11 @@ export struct TopNavigationComponent { | @@ -416,9 +469,11 @@ export struct TopNavigationComponent { | ||
| 416 | this.changeByClick = true | 469 | this.changeByClick = true |
| 417 | this.tabsController.changeIndex(index) | 470 | this.tabsController.changeIndex(index) |
| 418 | } | 471 | } |
| 472 | + | ||
| 419 | }) | 473 | }) |
| 420 | } | 474 | } |
| 421 | 475 | ||
| 476 | + | ||
| 422 | aboutToAppear() { | 477 | aboutToAppear() { |
| 423 | //处理新闻tab顶导频道数据 | 478 | //处理新闻tab顶导频道数据 |
| 424 | this.topNavListHandle() | 479 | this.topNavListHandle() |
| 1 | -import { Logger, DisplayUtils} from 'wdKit' | 1 | +import { Logger} from 'wdKit' |
| 2 | import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel' | 2 | import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel' |
| 3 | import { | 3 | import { |
| 4 | ContentDTO, | 4 | ContentDTO, |
| @@ -16,11 +16,11 @@ import { | @@ -16,11 +16,11 @@ import { | ||
| 16 | } from 'wdBean' | 16 | } from 'wdBean' |
| 17 | import { CardParser } from '../CardParser' | 17 | import { CardParser } from '../CardParser' |
| 18 | import { PageRepository } from '../../repository/PageRepository' | 18 | import { PageRepository } from '../../repository/PageRepository' |
| 19 | -import { RefreshLayoutBean } from '../page/RefreshLayoutBean' | ||
| 20 | import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout' | 19 | import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout' |
| 21 | import { ErrorComponent } from '../view/ErrorComponent' | 20 | import { ErrorComponent } from '../view/ErrorComponent' |
| 22 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh' | 21 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh' |
| 23 | import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData' | 22 | import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData' |
| 23 | +import LoadMoreLayout from '../page/LoadMoreLayout' | ||
| 24 | 24 | ||
| 25 | const TAG = 'PeopleShipHomeArticleListComponent'; | 25 | const TAG = 'PeopleShipHomeArticleListComponent'; |
| 26 | 26 | ||
| @@ -47,45 +47,29 @@ export struct PeopleShipHomeArticleListComponent { | @@ -47,45 +47,29 @@ export struct PeopleShipHomeArticleListComponent { | ||
| 47 | } else if (this.viewType == 2) { | 47 | } else if (this.viewType == 2) { |
| 48 | ErrorComponent() | 48 | ErrorComponent() |
| 49 | } else { | 49 | } else { |
| 50 | - CustomPullToRefresh({ | ||
| 51 | - alldata:this.arr, | ||
| 52 | - scroller:this.scroller, | ||
| 53 | - hasMore: this.hasMore, | ||
| 54 | - customList:()=>{ | ||
| 55 | - this.ListLayout() | ||
| 56 | - }, | ||
| 57 | - onRefresh:(resolve)=>{ | ||
| 58 | - this.currentPage = 1 | ||
| 59 | - this.getPeopleShipPageArticleList(resolve) | ||
| 60 | - }, | ||
| 61 | - onLoadMore:(resolve)=> { | ||
| 62 | - if (this.hasMore === false) { | ||
| 63 | - if(resolve) { | ||
| 64 | - resolve('') | ||
| 65 | - } | ||
| 66 | - return | ||
| 67 | - } | ||
| 68 | - if(!this.isLoading && this.hasMore){ | ||
| 69 | - //加载分页数据 | ||
| 70 | - this.currentPage++; | ||
| 71 | - this.getPeopleShipPageArticleList(resolve) | ||
| 72 | - }else { | ||
| 73 | - if(resolve) { | ||
| 74 | - resolve('') | ||
| 75 | - } | ||
| 76 | - } | ||
| 77 | - }, | ||
| 78 | - }) | 50 | + this.ListLayout() |
| 51 | + // CustomPullToRefresh({ | ||
| 52 | + // alldata:this.arr, | ||
| 53 | + // scroller:this.scroller, | ||
| 54 | + // hasMore: false, | ||
| 55 | + // customList:()=>{ | ||
| 56 | + // this.ListLayout() | ||
| 57 | + // }, | ||
| 58 | + // onRefresh:(resolve)=>{ | ||
| 59 | + // this.currentPage = 1 | ||
| 60 | + // this.getPeopleShipPageArticleList(resolve) | ||
| 61 | + // }, | ||
| 62 | + // }) | ||
| 79 | } | 63 | } |
| 80 | 64 | ||
| 81 | } | 65 | } |
| 82 | 66 | ||
| 83 | @Builder | 67 | @Builder |
| 84 | LoadingLayout() { | 68 | LoadingLayout() { |
| 85 | - CustomRefreshLoadLayout({ | ||
| 86 | - refreshBean: new RefreshLayoutBean(true, | ||
| 87 | - $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), 20) | ||
| 88 | - }).height(DisplayUtils.getDeviceHeight() - this.topHeight) | 69 | + // CustomRefreshLoadLayout({ |
| 70 | + // refreshBean: new RefreshLayoutBean(true, | ||
| 71 | + // $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), 20) | ||
| 72 | + // }).height(DisplayUtils.getDeviceHeight() - this.topHeight) | ||
| 89 | } | 73 | } |
| 90 | 74 | ||
| 91 | @Builder | 75 | @Builder |
| @@ -93,7 +77,6 @@ export struct PeopleShipHomeArticleListComponent { | @@ -93,7 +77,6 @@ export struct PeopleShipHomeArticleListComponent { | ||
| 93 | 77 | ||
| 94 | List({scroller: this.scroller}) { | 78 | List({scroller: this.scroller}) { |
| 95 | // 下拉刷新 | 79 | // 下拉刷新 |
| 96 | - | ||
| 97 | ForEach(this.arr, (item: ContentDTO) => { | 80 | ForEach(this.arr, (item: ContentDTO) => { |
| 98 | ListItem() { | 81 | ListItem() { |
| 99 | CardParser({ contentDTO: item }) | 82 | CardParser({ contentDTO: item }) |
| @@ -103,11 +86,14 @@ export struct PeopleShipHomeArticleListComponent { | @@ -103,11 +86,14 @@ export struct PeopleShipHomeArticleListComponent { | ||
| 103 | 86 | ||
| 104 | // 加载更多 | 87 | // 加载更多 |
| 105 | ListItem() { | 88 | ListItem() { |
| 106 | - if (!this.hasMore && !this.isLoading) { | 89 | + if (this.hasMore && this.arr && this.arr.length > 0) { |
| 90 | + LoadMoreLayout({ isVisible: this.hasMore }) | ||
| 91 | + } else if (!this.hasMore && !this.isLoading) { | ||
| 107 | PeopleShipNoMoreData() | 92 | PeopleShipNoMoreData() |
| 108 | } | 93 | } |
| 109 | } | 94 | } |
| 110 | } | 95 | } |
| 96 | + .backgroundColor(Color.Transparent) | ||
| 111 | .width("100%") | 97 | .width("100%") |
| 112 | .height("100%") | 98 | .height("100%") |
| 113 | .edgeEffect(EdgeEffect.None) | 99 | .edgeEffect(EdgeEffect.None) |
| @@ -115,13 +101,13 @@ export struct PeopleShipHomeArticleListComponent { | @@ -115,13 +101,13 @@ export struct PeopleShipHomeArticleListComponent { | ||
| 115 | scrollForward: NestedScrollMode.PARENT_FIRST, | 101 | scrollForward: NestedScrollMode.PARENT_FIRST, |
| 116 | scrollBackward: NestedScrollMode.SELF_FIRST | 102 | scrollBackward: NestedScrollMode.SELF_FIRST |
| 117 | }) | 103 | }) |
| 118 | - | ||
| 119 | - // .onReachEnd(() => { | ||
| 120 | - // if(!this.isLoading && this.hasMore){ | ||
| 121 | - // //加载分页数据 | ||
| 122 | - // this.getPeopleShipPageArticleList() | ||
| 123 | - // } | ||
| 124 | - // }) | 104 | + .onReachEnd(() => { |
| 105 | + if(!this.isLoading && this.hasMore){ | ||
| 106 | + //加载分页数据 | ||
| 107 | + this.currentPage++; | ||
| 108 | + this.getPeopleShipPageArticleList() | ||
| 109 | + } | ||
| 110 | + }) | ||
| 125 | } | 111 | } |
| 126 | 112 | ||
| 127 | aboutToAppear() { | 113 | aboutToAppear() { |
| @@ -313,7 +299,6 @@ export struct PeopleShipHomeArticleListComponent { | @@ -313,7 +299,6 @@ export struct PeopleShipHomeArticleListComponent { | ||
| 313 | } | 299 | } |
| 314 | 300 | ||
| 315 | } | 301 | } |
| 316 | - | ||
| 317 | // this.arr = listData.list | 302 | // this.arr = listData.list |
| 318 | } | 303 | } |
| 319 | 304 |
| @@ -24,10 +24,10 @@ export struct PeopleShipHomeListComponent { | @@ -24,10 +24,10 @@ export struct PeopleShipHomeListComponent { | ||
| 24 | // 列表 | 24 | // 列表 |
| 25 | else if (this.publishCount == 0) { | 25 | else if (this.publishCount == 0) { |
| 26 | // 无数据展示 | 26 | // 无数据展示 |
| 27 | - EmptyComponent({emptyType: 12}).height(DisplayUtils.getDeviceHeight() - this.topHeight) | 27 | + EmptyComponent({emptyType: 12}).height('100%') |
| 28 | } else { | 28 | } else { |
| 29 | Column() { | 29 | Column() { |
| 30 | - Column() { | 30 | + Stack({ alignContent: Alignment.Top }){ |
| 31 | // 页签 | 31 | // 页签 |
| 32 | Row() { | 32 | Row() { |
| 33 | Scroll() { | 33 | Scroll() { |
| @@ -44,54 +44,54 @@ export struct PeopleShipHomeListComponent { | @@ -44,54 +44,54 @@ export struct PeopleShipHomeListComponent { | ||
| 44 | .scrollBar(BarState.Off) | 44 | .scrollBar(BarState.Off) |
| 45 | .width('100%') | 45 | .width('100%') |
| 46 | } | 46 | } |
| 47 | + .zIndex(10) | ||
| 47 | .backgroundColor(Color.White) | 48 | .backgroundColor(Color.White) |
| 49 | + .height('44vp') | ||
| 48 | .alignItems(VerticalAlign.Bottom) | 50 | .alignItems(VerticalAlign.Bottom) |
| 49 | .width('100%') | 51 | .width('100%') |
| 50 | - } | ||
| 51 | - .justifyContent(FlexAlign.Start) | ||
| 52 | - .height('44vp') | ||
| 53 | - .alignItems(HorizontalAlign.Start) | ||
| 54 | - .width('100%') | ||
| 55 | 52 | ||
| 56 | - Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { | ||
| 57 | - ForEach(this.tabArr, (item: ArticleTypeData, index: number) => { | ||
| 58 | - TabContent() { | ||
| 59 | - PeopleShipHomeArticleListComponent({ | ||
| 60 | - typeModel: item, | ||
| 61 | - creatorId: this.creatorId, | ||
| 62 | - currentTopSelectedIndex: this.currentIndex, | ||
| 63 | - currentIndex: index | ||
| 64 | - }) | ||
| 65 | - } | ||
| 66 | - // }.tabBar(this.tabBuilder(index, item.name ?? '')) | 53 | + Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { |
| 54 | + ForEach(this.tabArr, (item: ArticleTypeData, index: number) => { | ||
| 55 | + TabContent() { | ||
| 56 | + PeopleShipHomeArticleListComponent({ | ||
| 57 | + typeModel: item, | ||
| 58 | + creatorId: this.creatorId, | ||
| 59 | + currentTopSelectedIndex: this.currentIndex, | ||
| 60 | + currentIndex: index | ||
| 61 | + }) | ||
| 62 | + } | ||
| 63 | + // .tabBar(this.Tab(index, item.name ?? '')) | ||
| 64 | + }) | ||
| 65 | + | ||
| 66 | + } | ||
| 67 | + .backgroundColor(Color.White) | ||
| 68 | + .barWidth('100%') | ||
| 69 | + .vertical(false) | ||
| 70 | + .barHeight('44vp') | ||
| 71 | + .height('100% ') | ||
| 72 | + .animationDuration(0) | ||
| 73 | + .divider({ | ||
| 74 | + strokeWidth: '0.5vp', | ||
| 75 | + color: $r('app.color.color_F5F5F5'), | ||
| 76 | + startMargin: 0, | ||
| 77 | + endMargin: 0 | ||
| 78 | + }) | ||
| 79 | + .onChange((index: number) => { | ||
| 80 | + this.currentIndex = index | ||
| 67 | }) | 81 | }) |
| 68 | 82 | ||
| 69 | } | 83 | } |
| 70 | - .backgroundColor(Color.White) | ||
| 71 | - .barWidth('100%') | ||
| 72 | - .barHeight(0) | ||
| 73 | - .vertical(false) | ||
| 74 | - .height(DisplayUtils.getDeviceHeight() - 144) | ||
| 75 | - .animationDuration(0) | ||
| 76 | - .divider({ | ||
| 77 | - strokeWidth: '0.5vp', | ||
| 78 | - color: $r('app.color.color_F5F5F5'), | ||
| 79 | - startMargin: 0, | ||
| 80 | - endMargin: 0 | ||
| 81 | - }) | ||
| 82 | - .onChange((index: number) => { | ||
| 83 | - this.currentIndex = index | ||
| 84 | - }) | 84 | + |
| 85 | } | 85 | } |
| 86 | } | 86 | } |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | @Builder | 89 | @Builder |
| 90 | LoadingLayout() { | 90 | LoadingLayout() { |
| 91 | - CustomRefreshLoadLayout({ | ||
| 92 | - refreshBean: new RefreshLayoutBean(true, | ||
| 93 | - $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), DisplayUtils.getDeviceHeight() - this.topHeight) | ||
| 94 | - }).height(DisplayUtils.getDeviceHeight() - this.topHeight) | 91 | + // CustomRefreshLoadLayout({ |
| 92 | + // refreshBean: new RefreshLayoutBean(true, | ||
| 93 | + // $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), DisplayUtils.getDeviceHeight() - this.topHeight) | ||
| 94 | + // }).height('100%') | ||
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | // 单独的页签 | 97 | // 单独的页签 |
| @@ -43,9 +43,8 @@ export struct PeopleShipHomePageNavComponent { | @@ -43,9 +43,8 @@ export struct PeopleShipHomePageNavComponent { | ||
| 43 | }).onClick(()=>{ | 43 | }).onClick(()=>{ |
| 44 | let params = { | 44 | let params = { |
| 45 | 'headPhotoUrl': this.detailModel.headPhotoUrl, | 45 | 'headPhotoUrl': this.detailModel.headPhotoUrl, |
| 46 | - 'headType': '1' | ||
| 47 | } as Record<string, string>; | 46 | } as Record<string, string>; |
| 48 | - WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage,params) | 47 | + WDRouterRule.jumpWithPage(WDRouterPage.showHomePageHeaderPage,params) |
| 49 | }).margin({ | 48 | }).margin({ |
| 50 | left: '10vp', | 49 | left: '10vp', |
| 51 | }) | 50 | }) |
| @@ -56,9 +56,8 @@ export struct PeopleShipHomePageTopComponent { | @@ -56,9 +56,8 @@ export struct PeopleShipHomePageTopComponent { | ||
| 56 | }).onClick(() => { | 56 | }).onClick(() => { |
| 57 | let params = { | 57 | let params = { |
| 58 | 'headPhotoUrl': this.detailModel.headPhotoUrl, | 58 | 'headPhotoUrl': this.detailModel.headPhotoUrl, |
| 59 | - 'headType': '1' | ||
| 60 | } as Record<string, string>; | 59 | } as Record<string, string>; |
| 61 | - WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage, params) | 60 | + WDRouterRule.jumpWithPage(WDRouterPage.showHomePageHeaderPage, params) |
| 62 | }) | 61 | }) |
| 63 | 62 | ||
| 64 | 63 | ||
| @@ -369,7 +368,11 @@ export struct PeopleShipHomePageTopComponent { | @@ -369,7 +368,11 @@ export struct PeopleShipHomePageTopComponent { | ||
| 369 | 368 | ||
| 370 | private computeShowNum(count: number) { | 369 | private computeShowNum(count: number) { |
| 371 | if (count >= 10000) { | 370 | if (count >= 10000) { |
| 372 | - return `${(count / 10000).toFixed(1)}万` | 371 | + let num = ( count / 10000).toFixed(1) |
| 372 | + if (Number(num.substring(num.length-1)) == 0) { | ||
| 373 | + num = num.substring(0, num.length-2) | ||
| 374 | + } | ||
| 375 | + return num + '万' | ||
| 373 | } | 376 | } |
| 374 | return `${count}` | 377 | return `${count}` |
| 375 | } | 378 | } |
| @@ -12,6 +12,7 @@ import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'; | @@ -12,6 +12,7 @@ import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'; | ||
| 12 | import { HttpUtils } from 'wdNetwork/Index'; | 12 | import { HttpUtils } from 'wdNetwork/Index'; |
| 13 | import { WDRouterPage, WDRouterRule } from 'wdRouter' | 13 | import { WDRouterPage, WDRouterRule } from 'wdRouter' |
| 14 | import { LazyDataSource } from 'wdKit/Index'; | 14 | import { LazyDataSource } from 'wdKit/Index'; |
| 15 | +import LoadMoreLayout from '../page/LoadMoreLayout' | ||
| 15 | 16 | ||
| 16 | const TAG: string = 'ReserveMorePage'; | 17 | const TAG: string = 'ReserveMorePage'; |
| 17 | 18 | ||
| @@ -95,7 +96,9 @@ struct ReserveMorePage { | @@ -95,7 +96,9 @@ struct ReserveMorePage { | ||
| 95 | ) | 96 | ) |
| 96 | // 加载更多 | 97 | // 加载更多 |
| 97 | ListItem() { | 98 | ListItem() { |
| 98 | - if (!this.hasMore && !this.isLoading) { | 99 | + if (this.hasMore && this.data && this.data.totalCount() > 0) { |
| 100 | + LoadMoreLayout({ isVisible: this.hasMore }) | ||
| 101 | + } else if (!this.hasMore && !this.isLoading) { | ||
| 99 | PeopleShipNoMoreData() | 102 | PeopleShipNoMoreData() |
| 100 | } | 103 | } |
| 101 | } | 104 | } |
| @@ -104,7 +107,7 @@ struct ReserveMorePage { | @@ -104,7 +107,7 @@ struct ReserveMorePage { | ||
| 104 | .edgeEffect(EdgeEffect.None) | 107 | .edgeEffect(EdgeEffect.None) |
| 105 | .scrollBar(BarState.Off) | 108 | .scrollBar(BarState.Off) |
| 106 | .backgroundColor('#F5F5F5') | 109 | .backgroundColor('#F5F5F5') |
| 107 | - .layoutWeight(1) | 110 | + .height('calc(100% - 44vp)') |
| 108 | .onReachEnd(() => { | 111 | .onReachEnd(() => { |
| 109 | Logger.debug(TAG, "触底了"); | 112 | Logger.debug(TAG, "触底了"); |
| 110 | if(!this.isLoading && this.hasMore){ | 113 | if(!this.isLoading && this.hasMore){ |
| @@ -124,7 +127,7 @@ struct ReserveMorePage { | @@ -124,7 +127,7 @@ struct ReserveMorePage { | ||
| 124 | buildItem(item: ContentDTO, index: number) { | 127 | buildItem(item: ContentDTO, index: number) { |
| 125 | Column() { | 128 | Column() { |
| 126 | Stack() { | 129 | Stack() { |
| 127 | - Image(item.fullColumnImgUrls[0].url) | 130 | + Image(item.fullColumnImgUrls[0]?.url) |
| 128 | .width('100%') | 131 | .width('100%') |
| 129 | .height(196) | 132 | .height(196) |
| 130 | .borderRadius(4) | 133 | .borderRadius(4) |
| @@ -136,64 +139,49 @@ struct ReserveMorePage { | @@ -136,64 +139,49 @@ struct ReserveMorePage { | ||
| 136 | Text(item.newsTitle) | 139 | Text(item.newsTitle) |
| 137 | .fontSize(17) | 140 | .fontSize(17) |
| 138 | .maxLines(2) | 141 | .maxLines(2) |
| 142 | + .lineHeight(25) | ||
| 139 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 143 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 140 | - .margin({ top: 16, left: 12, right: 12 }) | 144 | + .margin({ top: 4, left: 12, right: 12 }) |
| 141 | .alignSelf(ItemAlign.Start) | 145 | .alignSelf(ItemAlign.Start) |
| 142 | Row() { | 146 | Row() { |
| 143 | - Row() { | ||
| 144 | - Image($r('app.media.reserve_play_icon')) | ||
| 145 | - .width(20) | ||
| 146 | - .height(20) | ||
| 147 | - .margin({ left: 10, top: 2, bottom: 2, right: 6 }) | ||
| 148 | - // Text(DateTimeUtils.formatDate(item.liveInfo.liveStartTime, "MM月dd日 HH:mm")) | ||
| 149 | - Text(this.getReserveDate(item.liveInfo.liveStartTime, 1)) | ||
| 150 | - .fontSize(12) | ||
| 151 | - .fontWeight(500) | ||
| 152 | - .fontColor('#ED2800') | ||
| 153 | - .fontFamily('PingFang SC-Medium') | ||
| 154 | - .maxLines(1) | ||
| 155 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 156 | - .margin({ top: 8, bottom: 8 }) | ||
| 157 | - .align(Alignment.Start) | ||
| 158 | - | ||
| 159 | - Image($r('app.media.point_icon')) | ||
| 160 | - .objectFit(ImageFit.Auto) | ||
| 161 | - .interpolation(ImageInterpolation.High) | ||
| 162 | - .width(6) | ||
| 163 | - .height(16) | ||
| 164 | - .margin(2) | ||
| 165 | - | ||
| 166 | - Text(this.getReserveDate(item.liveInfo.liveStartTime, 2)) | ||
| 167 | - .fontSize(12) | ||
| 168 | - .fontWeight(500) | ||
| 169 | - .fontColor('#ED2800') | ||
| 170 | - .fontFamily('PingFang SC-Medium') | ||
| 171 | - .maxLines(1) | ||
| 172 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 173 | - .margin({ top: 8, bottom: 8, right: 10 }) | ||
| 174 | - .align(Alignment.Start) | 147 | + if (item.liveInfo && item.liveInfo.liveStartTime) { |
| 148 | + Row() { | ||
| 149 | + Image($r('app.media.reserve_play_icon')) | ||
| 150 | + .width(20) | ||
| 151 | + .height(20) | ||
| 152 | + .margin({ left: 10, top: 2, bottom: 2, right: 6 }) | ||
| 153 | + | ||
| 154 | + Text(this.getReserveDate(item.liveInfo.liveStartTime, 1)) | ||
| 155 | + .fontSize(12) | ||
| 156 | + .fontWeight(500) | ||
| 157 | + .fontColor('#ED2800') | ||
| 158 | + .fontFamily('PingFang SC-Medium') | ||
| 159 | + .maxLines(1) | ||
| 160 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 161 | + .margin({ top: 8, bottom: 8 }) | ||
| 162 | + .align(Alignment.Start) | ||
| 163 | + | ||
| 164 | + Image($r('app.media.point_icon')) | ||
| 165 | + .objectFit(ImageFit.Auto) | ||
| 166 | + .interpolation(ImageInterpolation.High) | ||
| 167 | + .width(6) | ||
| 168 | + .height(16) | ||
| 169 | + .margin(2) | ||
| 170 | + | ||
| 171 | + Text(this.getReserveDate(item.liveInfo.liveStartTime, 2)) | ||
| 172 | + .fontSize(12) | ||
| 173 | + .fontWeight(500) | ||
| 174 | + .fontColor('#ED2800') | ||
| 175 | + .fontFamily('PingFang SC-Medium') | ||
| 176 | + .maxLines(1) | ||
| 177 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 178 | + .margin({ top: 8, bottom: 8, right: 10 }) | ||
| 179 | + .align(Alignment.Start) | ||
| 180 | + } | ||
| 181 | + .backgroundColor('#F5F5F5') | ||
| 182 | + .margin(12) | ||
| 175 | } | 183 | } |
| 176 | - .backgroundColor('#F5F5F5') | ||
| 177 | - .margin(12) | ||
| 178 | - | ||
| 179 | - // Flex({ justifyContent: FlexAlign.Center }) { | ||
| 180 | - // Text(this.isAppointmentLive ? '已预约' : '预约') | ||
| 181 | - // .fontSize(12) | ||
| 182 | - // .fontWeight(400) | ||
| 183 | - // .fontFamily('PingFang SC-Regular') | ||
| 184 | - // .width(52) | ||
| 185 | - // .height(24) | ||
| 186 | - // .fontColor(Color.White) | ||
| 187 | - // .textAlign(TextAlign.Center) | ||
| 188 | - // .onClick(() => { | ||
| 189 | - // this.liveAppointment(item) | ||
| 190 | - // }) | ||
| 191 | - // } | ||
| 192 | - // .width(52) | ||
| 193 | - // .backgroundColor('#ED2800') | ||
| 194 | - // .borderRadius(3) | ||
| 195 | - // ReserveMoreAttentionComponent({reserveItem: this.getAttentionItem(item), }) | ||
| 196 | - // .margin({ right: 12 }) | 184 | + // 预约 |
| 197 | Row() { | 185 | Row() { |
| 198 | LoadingProgress() | 186 | LoadingProgress() |
| 199 | .width(20) | 187 | .width(20) |
| @@ -201,7 +189,7 @@ struct ReserveMorePage { | @@ -201,7 +189,7 @@ struct ReserveMorePage { | ||
| 201 | .color(!this.isReserved(item) ? $r('app.color.color_fff') : $r('app.color.color_CCCCCC')) | 189 | .color(!this.isReserved(item) ? $r('app.color.color_fff') : $r('app.color.color_CCCCCC')) |
| 202 | .visibility((this.isLoadingAttention && this.liveId == item.objectId) ? Visibility.Visible : Visibility.None) | 190 | .visibility((this.isLoadingAttention && this.liveId == item.objectId) ? Visibility.Visible : Visibility.None) |
| 203 | 191 | ||
| 204 | - Text(!this.isReserved(item) ? '关注' : '已关注') | 192 | + Text(!this.isReserved(item) ? '预约' : '已预约') |
| 205 | .fontSize($r('app.float.vp_12')) | 193 | .fontSize($r('app.float.vp_12')) |
| 206 | .fontWeight(500) | 194 | .fontWeight(500) |
| 207 | .fontColor(!this.isReserved(item) ? $r('app.color.color_fff') : $r('app.color.color_CCCCCC')) | 195 | .fontColor(!this.isReserved(item) ? $r('app.color.color_fff') : $r('app.color.color_CCCCCC')) |
| @@ -253,6 +241,9 @@ struct ReserveMorePage { | @@ -253,6 +241,9 @@ struct ReserveMorePage { | ||
| 253 | .height(24) | 241 | .height(24) |
| 254 | .objectFit(ImageFit.Auto) | 242 | .objectFit(ImageFit.Auto) |
| 255 | .id("back_icon") | 243 | .id("back_icon") |
| 244 | + .margin({ | ||
| 245 | + left: '16vp' | ||
| 246 | + }) | ||
| 256 | .alignRules({ | 247 | .alignRules({ |
| 257 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 248 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| 258 | left: { anchor: "__container__", align: HorizontalAlign.Start } | 249 | left: { anchor: "__container__", align: HorizontalAlign.Start } |
| @@ -264,10 +255,10 @@ struct ReserveMorePage { | @@ -264,10 +255,10 @@ struct ReserveMorePage { | ||
| 264 | Text(this.title)// .height('42lpx') | 255 | Text(this.title)// .height('42lpx') |
| 265 | .maxLines(1) | 256 | .maxLines(1) |
| 266 | .id("title") | 257 | .id("title") |
| 267 | - .fontSize('35lpx') | 258 | + .fontSize('18vp') |
| 268 | .fontWeight(400) | 259 | .fontWeight(400) |
| 269 | .fontColor($r('app.color.color_222222')) | 260 | .fontColor($r('app.color.color_222222')) |
| 270 | - .lineHeight('42lpx') | 261 | + .lineHeight('22vp') |
| 271 | .alignRules({ | 262 | .alignRules({ |
| 272 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 263 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| 273 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 264 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| @@ -281,11 +272,14 @@ struct ReserveMorePage { | @@ -281,11 +272,14 @@ struct ReserveMorePage { | ||
| 281 | @Builder | 272 | @Builder |
| 282 | LiveImage() { | 273 | LiveImage() { |
| 283 | Row() { | 274 | Row() { |
| 284 | - Image($r('app.media.reserve_icon')) | ||
| 285 | - .width(22) | ||
| 286 | - .height(18) | 275 | + Image($r('app.media.reserve_new_icon')) |
| 276 | + .width(14) | ||
| 277 | + .height(14) | ||
| 278 | + .margin({ | ||
| 279 | + right: 3 | ||
| 280 | + }) | ||
| 287 | Text('预约') | 281 | Text('预约') |
| 288 | - .fontSize('11fp') | 282 | + .fontSize('12vp') |
| 289 | .fontWeight(400) | 283 | .fontWeight(400) |
| 290 | .fontColor(Color.White) | 284 | .fontColor(Color.White) |
| 291 | } | 285 | } |
| @@ -511,9 +505,5 @@ struct ReserveMorePage { | @@ -511,9 +505,5 @@ struct ReserveMorePage { | ||
| 511 | } | 505 | } |
| 512 | } | 506 | } |
| 513 | 507 | ||
| 514 | - async liveAppointment(item: ContentDTO) { | ||
| 515 | - const liveDetail = await LiveModel.liveAppointment(item?.relId || '', item?.objectId || '', this.isAppointmentLive || false) | ||
| 516 | - } | ||
| 517 | - | ||
| 518 | 508 | ||
| 519 | } | 509 | } |
| @@ -131,10 +131,8 @@ export struct SearchResultComponent { | @@ -131,10 +131,8 @@ export struct SearchResultComponent { | ||
| 131 | .barWidth('100%') | 131 | .barWidth('100%') |
| 132 | .barHeight('84lpx') | 132 | .barHeight('84lpx') |
| 133 | .animationDuration(0) | 133 | .animationDuration(0) |
| 134 | - .onChange((index: number) => { | ||
| 135 | - this.currentIndex = index | ||
| 136 | - }) | ||
| 137 | .width('100%') | 134 | .width('100%') |
| 135 | + .scrollable(false) | ||
| 138 | .layoutWeight(1) | 136 | .layoutWeight(1) |
| 139 | } | 137 | } |
| 140 | }.width('100%') | 138 | }.width('100%') |
| @@ -15,7 +15,7 @@ export struct CustomBottomFuctionUI { | @@ -15,7 +15,7 @@ export struct CustomBottomFuctionUI { | ||
| 15 | .height('20') | 15 | .height('20') |
| 16 | .margin({right:'31lpx' }) | 16 | .margin({right:'31lpx' }) |
| 17 | 17 | ||
| 18 | - Text(this.isAllSelect?'取消':'全选') | 18 | + Text(this.isAllSelect?'取消全选':'全选') |
| 19 | .fontColor($r('app.color.color_222222')) | 19 | .fontColor($r('app.color.color_222222')) |
| 20 | .backgroundColor(Color.White) | 20 | .backgroundColor(Color.White) |
| 21 | } | 21 | } |
| @@ -22,7 +22,7 @@ export struct LikeComponent { | @@ -22,7 +22,7 @@ export struct LikeComponent { | ||
| 22 | @Prop data: Record<string, string> | 22 | @Prop data: Record<string, string> |
| 23 | enableBtn = true | 23 | enableBtn = true |
| 24 | componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口 | 24 | componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口 |
| 25 | - styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) | 25 | + styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) 3 透明背景 |
| 26 | @State likeCount: number = 0 //点赞数 | 26 | @State likeCount: number = 0 //点赞数 |
| 27 | 27 | ||
| 28 | //上层传值 样例 | 28 | //上层传值 样例 |
| @@ -41,7 +41,6 @@ export struct LikeComponent { | @@ -41,7 +41,6 @@ export struct LikeComponent { | ||
| 41 | //获取点赞数 | 41 | //获取点赞数 |
| 42 | this.getLikeCount() | 42 | this.getLikeCount() |
| 43 | } | 43 | } |
| 44 | - | ||
| 45 | } | 44 | } |
| 46 | 45 | ||
| 47 | build() { | 46 | build() { |
| @@ -50,11 +49,15 @@ export struct LikeComponent { | @@ -50,11 +49,15 @@ export struct LikeComponent { | ||
| 50 | //2: 新闻页中间位置样式 | 49 | //2: 新闻页中间位置样式 |
| 51 | this.likeCompStyle2() | 50 | this.likeCompStyle2() |
| 52 | } else if (this.componentType == 3) { | 51 | } else if (this.componentType == 3) { |
| 52 | + //卡片底部互动样式 | ||
| 53 | this.likeCompStyle3() | 53 | this.likeCompStyle3() |
| 54 | } else if (this.componentType == 4) { | 54 | } else if (this.componentType == 4) { |
| 55 | // 直播,点赞按钮底测有灰色圆角背景+右上点赞数量 | 55 | // 直播,点赞按钮底测有灰色圆角背景+右上点赞数量 |
| 56 | this.likeCompStyle4() | 56 | this.likeCompStyle4() |
| 57 | - } else { | 57 | + } else if (this.componentType == 5) { |
| 58 | + // 图集点赞,展示标识 | ||
| 59 | + this.likeCompStyle5() | ||
| 60 | + }else { | ||
| 58 | //1: 底部栏目样式 默认样式 | 61 | //1: 底部栏目样式 默认样式 |
| 59 | this.likeCompStyle1() | 62 | this.likeCompStyle1() |
| 60 | } | 63 | } |
| @@ -67,7 +70,7 @@ export struct LikeComponent { | @@ -67,7 +70,7 @@ export struct LikeComponent { | ||
| 67 | if (this.likesStyle === 1) { | 70 | if (this.likesStyle === 1) { |
| 68 | return { | 71 | return { |
| 69 | url: this.likeStatus ? $r(`app.media.ic_like_check`) : | 72 | url: this.likeStatus ? $r(`app.media.ic_like_check`) : |
| 70 | - this.styleType == 1 ? $r('app.media.icon_like_default') : $r(`app.media.ic_like_uncheck`), | 73 | + this.styleType == 1 ? this.componentType == 3?$r(`app.media.CarderInteraction_like`):$r('app.media.icon_like_default') : $r(`app.media.ic_like_uncheck`), |
| 71 | name: '赞' | 74 | name: '赞' |
| 72 | } | 75 | } |
| 73 | } else if (this.likesStyle === 2) { | 76 | } else if (this.likesStyle === 2) { |
| @@ -133,8 +136,8 @@ export struct LikeComponent { | @@ -133,8 +136,8 @@ export struct LikeComponent { | ||
| 133 | Image(this.transLikeStyle().url) | 136 | Image(this.transLikeStyle().url) |
| 134 | .width(18) | 137 | .width(18) |
| 135 | .height(18) | 138 | .height(18) |
| 136 | - // Text(this.likeStatus ? '已赞' : '点赞') | ||
| 137 | - Text(this.likeCount > 0 ? this.likeCount.toString() : '点赞') | 139 | + Text(this.likeStatus ? '已赞' : '点赞') |
| 140 | + // Text(this.likeCount > 0 ? this.likeCount.toString() : '点赞') | ||
| 138 | .margin({ left: 4 }) | 141 | .margin({ left: 4 }) |
| 139 | .fontSize(14) | 142 | .fontSize(14) |
| 140 | .fontColor(this.likeStatus ? '#ED2800' : '#666666') | 143 | .fontColor(this.likeStatus ? '#ED2800' : '#666666') |
| @@ -160,6 +163,36 @@ export struct LikeComponent { | @@ -160,6 +163,36 @@ export struct LikeComponent { | ||
| 160 | } | 163 | } |
| 161 | 164 | ||
| 162 | @Builder | 165 | @Builder |
| 166 | + likeCompStyle5() { | ||
| 167 | + //1: 底部栏目样式 默认样式 | ||
| 168 | + Stack({ alignContent: Alignment.Bottom }) { | ||
| 169 | + Column() { | ||
| 170 | + // Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default')) | ||
| 171 | + Image(this.transLikeStyle().url) | ||
| 172 | + .width(24) | ||
| 173 | + .height(24) | ||
| 174 | + .onClick(() => { | ||
| 175 | + this.clickButtonEvent() | ||
| 176 | + }) | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + Row() { | ||
| 180 | + Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) | ||
| 181 | + .fontSize(8) | ||
| 182 | + .fontColor(Color.White) | ||
| 183 | + .padding({ left: 4, right: 2 }) | ||
| 184 | + } | ||
| 185 | + .height(12) | ||
| 186 | + .alignItems(VerticalAlign.Center) | ||
| 187 | + .position({ x: '100%', }) | ||
| 188 | + .markAnchor({ x: '100%' }) | ||
| 189 | + .backgroundImage(this.likeStatus? $r('app.media.ic_like_back_Select'):$r('app.media.ic_like_back')) | ||
| 190 | + .backgroundImageSize(ImageSize.Auto) | ||
| 191 | + .visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden) | ||
| 192 | + }.width(24).height(24) | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + @Builder | ||
| 163 | likeCompStyle4() { | 196 | likeCompStyle4() { |
| 164 | Stack({ alignContent: Alignment.Bottom }) { | 197 | Stack({ alignContent: Alignment.Bottom }) { |
| 165 | Column() { | 198 | Column() { |
| @@ -59,6 +59,7 @@ export struct OperRowListView { | @@ -59,6 +59,7 @@ export struct OperRowListView { | ||
| 59 | * 7:图集详情页 | 59 | * 7:图集详情页 |
| 60 | */ | 60 | */ |
| 61 | @Prop componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口 | 61 | @Prop componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口 |
| 62 | + @Prop pageComponentType: number = -1 //1:视频详情页 | ||
| 62 | @State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 63 | @State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 63 | @State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件 | 64 | @State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件 |
| 64 | @State needLike: boolean = true | 65 | @State needLike: boolean = true |
| @@ -115,6 +116,8 @@ export struct OperRowListView { | @@ -115,6 +116,8 @@ export struct OperRowListView { | ||
| 115 | } | 116 | } |
| 116 | 117 | ||
| 117 | build() { | 118 | build() { |
| 119 | + // 视频详情页 | ||
| 120 | + | ||
| 118 | Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { | 121 | Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { |
| 119 | // AudioDialog() | 122 | // AudioDialog() |
| 120 | Row() { | 123 | Row() { |
| @@ -162,6 +165,7 @@ export struct OperRowListView { | @@ -162,6 +165,7 @@ export struct OperRowListView { | ||
| 162 | bottom: `${this.bottomSafeHeight}px` | 165 | bottom: `${this.bottomSafeHeight}px` |
| 163 | // bottom: 50 | 166 | // bottom: 50 |
| 164 | }) | 167 | }) |
| 168 | + | ||
| 165 | } | 169 | } |
| 166 | 170 | ||
| 167 | /** | 171 | /** |
| @@ -174,12 +178,16 @@ export struct OperRowListView { | @@ -174,12 +178,16 @@ export struct OperRowListView { | ||
| 174 | CommentTabComponent({ | 178 | CommentTabComponent({ |
| 175 | publishCommentModel: this.publishCommentModel, | 179 | publishCommentModel: this.publishCommentModel, |
| 176 | contentDetail: this.contentDetailData, | 180 | contentDetail: this.contentDetailData, |
| 177 | - onCommentFocus: this.onCommentFocus | 181 | + onCommentFocus: this.onCommentFocus, |
| 182 | + pageComponentType: this.pageComponentType | ||
| 178 | }) | 183 | }) |
| 179 | } | 184 | } |
| 180 | } | 185 | } |
| 181 | - .flexShrink(1) | ||
| 182 | - | 186 | + .layoutWeight(1) |
| 187 | + .margin({ | ||
| 188 | + right: this.pageComponentType === 1 ? 16 : 0, | ||
| 189 | + }) | ||
| 190 | + | ||
| 183 | if (this.showCommentIcon) { | 191 | if (this.showCommentIcon) { |
| 184 | Column() { | 192 | Column() { |
| 185 | if (this.publishCommentModel?.targetId) { | 193 | if (this.publishCommentModel?.targetId) { |
| @@ -330,6 +338,8 @@ export struct OperRowListView { | @@ -330,6 +338,8 @@ export struct OperRowListView { | ||
| 330 | contentList: [{ | 338 | contentList: [{ |
| 331 | contentId: this.contentDetailData?.newsId + '', | 339 | contentId: this.contentDetailData?.newsId + '', |
| 332 | contentType: this.contentDetailData?.newsType + '', | 340 | contentType: this.contentDetailData?.newsType + '', |
| 341 | + relType:this.contentDetailData?.reLInfo?.relType + '', | ||
| 342 | + contentRelId:this.contentDetailData?.reLInfo?.relId + '', | ||
| 333 | }], | 343 | }], |
| 334 | 344 | ||
| 335 | } | 345 | } |
| @@ -2,6 +2,8 @@ import { Action, NewspaperListBean, NewspaperListItemBean, NewspaperPositionItem | @@ -2,6 +2,8 @@ import { Action, NewspaperListBean, NewspaperListItemBean, NewspaperPositionItem | ||
| 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 { WDRouterRule } from 'wdRouter/Index' | 3 | import { WDRouterRule } from 'wdRouter/Index' |
| 4 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog' | 4 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog' |
| 5 | +import { Logger } from 'wdKit'; | ||
| 6 | +import { window } from '@kit.ArkUI'; | ||
| 5 | 7 | ||
| 6 | /** | 8 | /** |
| 7 | * 读报纸半屏弹窗 | 9 | * 读报纸半屏弹窗 |
| @@ -35,6 +37,12 @@ export struct ENewspaperListDialog { | @@ -35,6 +37,12 @@ export struct ENewspaperListDialog { | ||
| 35 | // listDialogController: CustomDialogController | 37 | // listDialogController: CustomDialogController |
| 36 | public closeDialog?: () => void | 38 | public closeDialog?: () => void |
| 37 | 39 | ||
| 40 | + // 手势滑动相关 | ||
| 41 | + private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Up | PanDirection.Down }) | ||
| 42 | + private topFixedHeight = 124 | ||
| 43 | + @State topHeight: number = 124 | ||
| 44 | + private deviceHeight: number = 0 | ||
| 45 | + | ||
| 38 | //watch监听报纸页码回调 | 46 | //watch监听报纸页码回调 |
| 39 | onCurrentPageNumUpdated(): void { | 47 | onCurrentPageNumUpdated(): void { |
| 40 | console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum) | 48 | console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum) |
| @@ -46,7 +54,13 @@ export struct ENewspaperListDialog { | @@ -46,7 +54,13 @@ export struct ENewspaperListDialog { | ||
| 46 | } | 54 | } |
| 47 | } | 55 | } |
| 48 | 56 | ||
| 49 | - aboutToAppear(): void { | 57 | + async aboutToAppear() { |
| 58 | + // 屏幕高度 - 滑动高度计算 | ||
| 59 | + let windowClass: window.Window = await window.getLastWindow(getContext(this)); | ||
| 60 | + let changeHeight = 85 + 44 + px2vp(windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height) | ||
| 61 | + changeHeight += px2vp(windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).bottomRect.height) | ||
| 62 | + this.deviceHeight = px2vp(windowClass.getWindowProperties().windowRect.height) - changeHeight | ||
| 63 | + | ||
| 50 | this.isCurrentViewOpen = true | 64 | this.isCurrentViewOpen = true |
| 51 | console.log("ENewspaperListDialog-aboutToAppear", "currentPageNum:", this.currentPageNum) | 65 | console.log("ENewspaperListDialog-aboutToAppear", "currentPageNum:", this.currentPageNum) |
| 52 | let _scrollIndex = Number.parseInt(this.currentPageNum) | 66 | let _scrollIndex = Number.parseInt(this.currentPageNum) |
| @@ -56,60 +70,76 @@ export struct ENewspaperListDialog { | @@ -56,60 +70,76 @@ export struct ENewspaperListDialog { | ||
| 56 | } | 70 | } |
| 57 | 71 | ||
| 58 | aboutToDisappear() { | 72 | aboutToDisappear() { |
| 59 | - // if (this.pageListDialogController) { | ||
| 60 | - // this.pageListDialogController = null | ||
| 61 | - // } | ||
| 62 | this.isCurrentViewOpen = false | 73 | this.isCurrentViewOpen = false |
| 63 | } | 74 | } |
| 64 | 75 | ||
| 65 | build() { | 76 | build() { |
| 66 | Stack() { | 77 | Stack() { |
| 67 | Column() { | 78 | Column() { |
| 68 | - Row() | ||
| 69 | - .width(43) | ||
| 70 | - .height(4) | ||
| 71 | - .backgroundColor('#EDEDED') | ||
| 72 | - .margin({ | ||
| 73 | - top: 10, | ||
| 74 | - bottom: 10 | ||
| 75 | - }) | 79 | + Column() { |
| 80 | + Row() | ||
| 81 | + .width(43) | ||
| 82 | + .height(4) | ||
| 83 | + .backgroundColor('#EDEDED') | ||
| 84 | + .margin({ | ||
| 85 | + top: 10, | ||
| 86 | + bottom: 10 | ||
| 87 | + }) | ||
| 88 | + .onClick(() => { | ||
| 89 | + if (this.closeDialog) { | ||
| 90 | + this.closeDialog() | ||
| 91 | + } | ||
| 92 | + }) | ||
| 93 | + Row() { | ||
| 94 | + Text(this.currentPageNum) | ||
| 95 | + .fontSize($r('app.float.font_size_36')) | ||
| 96 | + .fontColor($r('app.color.color_222222')) | ||
| 97 | + .fontFamily('BebasNeueBold') | ||
| 98 | + Text('版') | ||
| 99 | + .fontSize($r('app.float.font_size_16')) | ||
| 100 | + .fontColor($r('app.color.color_222222')) | ||
| 101 | + .margin({ bottom: 6 }) | ||
| 102 | + | ||
| 103 | + Image($r('app.media.icon_triangle_black')) | ||
| 104 | + .width($r('app.float.border_radius_6')) | ||
| 105 | + .height($r('app.float.border_radius_6')) | ||
| 106 | + .margin({ left: 2, bottom: 6 }) | ||
| 107 | + } | ||
| 108 | + .alignItems(VerticalAlign.Bottom) | ||
| 109 | + .margin({ left: 15 }) | ||
| 110 | + .alignSelf(ItemAlign.Start) | ||
| 76 | .onClick(() => { | 111 | .onClick(() => { |
| 77 | - if (this.closeDialog) { | ||
| 78 | - this.closeDialog() | 112 | + this.pageDialogShow = !this.pageDialogShow |
| 113 | + if (this.pageDialogShow) { | ||
| 114 | + this.pageListDialogController.open() | ||
| 115 | + } else { | ||
| 116 | + this.pageListDialogController.close() | ||
| 79 | } | 117 | } |
| 80 | }) | 118 | }) |
| 81 | - Row() { | ||
| 82 | - Text(this.currentPageNum) | ||
| 83 | - .fontSize($r('app.float.font_size_36')) | ||
| 84 | - .fontColor($r('app.color.color_222222')) | ||
| 85 | - .fontFamily('BebasNeueBold') | ||
| 86 | - Text('版') | ||
| 87 | - .fontSize($r('app.float.font_size_16')) | ||
| 88 | - .fontColor($r('app.color.color_222222')) | ||
| 89 | - .margin({ bottom: 6 }) | ||
| 90 | 119 | ||
| 91 | - Image($r('app.media.icon_triangle_black')) | ||
| 92 | - .width($r('app.float.border_radius_6')) | ||
| 93 | - .height($r('app.float.border_radius_6')) | ||
| 94 | - .margin({ left: 2, bottom: 6 }) | 120 | + Image($r('app.media.line')) |
| 121 | + .width('100%') | ||
| 122 | + .height(6) | ||
| 123 | + .margin({ top: 20, left: 16, right: 16 }) | ||
| 124 | + .objectFit(ImageFit.Contain) | ||
| 95 | } | 125 | } |
| 96 | - .alignItems(VerticalAlign.Bottom) | ||
| 97 | - .margin({ left: 15 }) | ||
| 98 | - .alignSelf(ItemAlign.Start) | ||
| 99 | - .onClick(() => { | ||
| 100 | - this.pageDialogShow = !this.pageDialogShow | ||
| 101 | - if (this.pageDialogShow) { | ||
| 102 | - this.pageListDialogController.open() | ||
| 103 | - } else { | ||
| 104 | - this.pageListDialogController.close() | ||
| 105 | - } | ||
| 106 | - }) | 126 | + .width('100%') |
| 127 | + .gesture( | ||
| 128 | + PanGesture(this.panOption) | ||
| 129 | + .onActionStart((event: GestureEvent) => { | ||
| 130 | + Logger.debug('ENewspaperListDialog','Pan start') | ||
| 131 | + }) | ||
| 132 | + .onActionUpdate((event: GestureEvent) => { | ||
| 133 | + if (this.topFixedHeight + event.offsetY >= this.topFixedHeight) { | ||
| 134 | + this.topHeight = this.topFixedHeight + event.offsetY | ||
| 135 | + } | ||
| 136 | + Logger.debug('ENewspaperListDialog', 'topHeight:' + this.topHeight) | ||
| 137 | + }) | ||
| 138 | + .onActionEnd(() => { | ||
| 139 | + this.onCloseGestureDialog() | ||
| 140 | + }) | ||
| 141 | + ) | ||
| 107 | 142 | ||
| 108 | - Image($r('app.media.line')) | ||
| 109 | - .width('100%') | ||
| 110 | - .height(6) | ||
| 111 | - .margin({ top: 20, left: 16, right: 16 }) | ||
| 112 | - .objectFit(ImageFit.Contain) | ||
| 113 | 143 | ||
| 114 | List({ scroller: this.listScroller, initialIndex: this.scrollIndex }) { | 144 | List({ scroller: this.listScroller, initialIndex: this.scrollIndex }) { |
| 115 | ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => { | 145 | ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => { |
| @@ -137,7 +167,7 @@ export struct ENewspaperListDialog { | @@ -137,7 +167,7 @@ export struct ENewspaperListDialog { | ||
| 137 | .fontSize($r('app.float.font_size_14')) | 167 | .fontSize($r('app.float.font_size_14')) |
| 138 | .fontColor($r('app.color.color_222222')) | 168 | .fontColor($r('app.color.color_222222')) |
| 139 | .fontWeight(600) | 169 | .fontWeight(600) |
| 140 | - .maxLines(2) | 170 | + // .maxLines(2) |
| 141 | .margin({ | 171 | .margin({ |
| 142 | bottom: 8 | 172 | bottom: 8 |
| 143 | }) | 173 | }) |
| @@ -151,7 +181,7 @@ export struct ENewspaperListDialog { | @@ -151,7 +181,7 @@ export struct ENewspaperListDialog { | ||
| 151 | .margin({ | 181 | .margin({ |
| 152 | bottom: 8 | 182 | bottom: 8 |
| 153 | }) | 183 | }) |
| 154 | - .maxLines(2) | 184 | + // .maxLines(2) |
| 155 | } | 185 | } |
| 156 | 186 | ||
| 157 | if (positionItem.downTitle) { | 187 | if (positionItem.downTitle) { |
| @@ -162,7 +192,7 @@ export struct ENewspaperListDialog { | @@ -162,7 +192,7 @@ export struct ENewspaperListDialog { | ||
| 162 | .margin({ | 192 | .margin({ |
| 163 | bottom: 8 | 193 | bottom: 8 |
| 164 | }) | 194 | }) |
| 165 | - .maxLines(2) | 195 | + // .maxLines(2) |
| 166 | } | 196 | } |
| 167 | if (positionItem.newsTxt) { | 197 | if (positionItem.newsTxt) { |
| 168 | Text(positionItem.newsTxt) | 198 | Text(positionItem.newsTxt) |
| @@ -251,16 +281,13 @@ export struct ENewspaperListDialog { | @@ -251,16 +281,13 @@ export struct ENewspaperListDialog { | ||
| 251 | this.currentPageNum = `${firstIndex < 9 ? '0' + (firstIndex + 1) : firstIndex + 1}` | 281 | this.currentPageNum = `${firstIndex < 9 ? '0' + (firstIndex + 1) : firstIndex + 1}` |
| 252 | // } | 282 | // } |
| 253 | }) | 283 | }) |
| 254 | - .onScroll((scrollOffset: number, scrollState: ScrollState) => { | ||
| 255 | - // console.info(`onScroll scrollState = ScrollState` + scrollState + `, scrollOffset = ` + scrollOffset) | ||
| 256 | - // if (this.scrollOffset == 0) { | ||
| 257 | - // this.scrollOffset = 0 | ||
| 258 | - // } | ||
| 259 | - }) | ||
| 260 | } | 284 | } |
| 261 | - .margin({ top: 124 }) | 285 | + // .margin({ top: 124 }) |
| 286 | + .margin({ top: this.topHeight }) | ||
| 287 | + | ||
| 262 | .width('100%') | 288 | .width('100%') |
| 263 | .backgroundColor(Color.White) | 289 | .backgroundColor(Color.White) |
| 290 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) | ||
| 264 | .onClick(() => { | 291 | .onClick(() => { |
| 265 | 292 | ||
| 266 | }) | 293 | }) |
| @@ -272,6 +299,33 @@ export struct ENewspaperListDialog { | @@ -272,6 +299,33 @@ export struct ENewspaperListDialog { | ||
| 272 | this.closeDialog() | 299 | this.closeDialog() |
| 273 | } | 300 | } |
| 274 | }) | 301 | }) |
| 302 | + .gesture( | ||
| 303 | + PanGesture(this.panOption) | ||
| 304 | + .onActionStart((event: GestureEvent) => { | ||
| 305 | + Logger.debug('ENewspaperListDialog','Pan start') | ||
| 306 | + }) | ||
| 307 | + .onActionUpdate((event: GestureEvent) => { | ||
| 308 | + if (event) { | ||
| 309 | + if (this.topFixedHeight + event.offsetY >= this.topFixedHeight) { | ||
| 310 | + this.topHeight = this.topFixedHeight + event.offsetY | ||
| 311 | + } | ||
| 312 | + Logger.debug('ENewspaperListDialog', 'topHeight:' + this.topHeight) | ||
| 313 | + } | ||
| 314 | + }) | ||
| 315 | + .onActionEnd(() => { | ||
| 316 | + this.onCloseGestureDialog() | ||
| 317 | + }) | ||
| 318 | + ) | ||
| 319 | + } | ||
| 320 | + | ||
| 321 | + onCloseGestureDialog() { | ||
| 322 | + if (this.topHeight >= this.deviceHeight ) { | ||
| 323 | + if (this.closeDialog) { | ||
| 324 | + this.closeDialog() | ||
| 325 | + } | ||
| 326 | + } else { | ||
| 327 | + this.topHeight = this.topFixedHeight | ||
| 328 | + } | ||
| 275 | } | 329 | } |
| 276 | 330 | ||
| 277 | updateRecordsData() { | 331 | updateRecordsData() { |
| 1 | + | ||
| 2 | +/** | ||
| 3 | + * WDMessageCenterMessageType 拉取消息类型 | ||
| 4 | + */ | ||
| 5 | +export const enum WDMessageCenterMessageType { | ||
| 6 | + WDMessageCenterMessageType_Interact = 1, //互动通知 | ||
| 7 | + WDMessageCenterMessageType_Subscribe = 2, //预约消息 | ||
| 8 | + WDMessageCenterMessageType_System, //系统消息 | ||
| 9 | +} | ||
| 10 | + | ||
| 11 | + | ||
| 12 | +export interface InteractMessageListModel{ | ||
| 13 | + data: InteractMessageMItem | ||
| 14 | + code: number | ||
| 15 | + message: string | ||
| 16 | + success: string | ||
| 17 | + timestamp: number | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | + | ||
| 21 | +export class InteractMessageMItem{ | ||
| 22 | + pageNum:number = 0 | ||
| 23 | + pageSize:number = 0 | ||
| 24 | + totalCount:number = 0 | ||
| 25 | + hasNext:number = 0 | ||
| 26 | + list:InteractMessageModel[] = [] | ||
| 27 | + | ||
| 28 | + constructor(list?:InteractMessageModel[],pageNum?: number,pageSize?: number,totalCount?: number,hasNext?:number) { | ||
| 29 | + } | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +export class InteractMessageModel { | ||
| 33 | + classify: string = ''; | ||
| 34 | + contentId: string = ''; | ||
| 35 | + contentType: string = ''; | ||
| 36 | + id: number = 0; | ||
| 37 | + message: string = ''; | ||
| 38 | + platform: string = ''; | ||
| 39 | + privateMailId: number = 0; | ||
| 40 | + privateMailIdList: number[] = []; | ||
| 41 | + privateMailIds: string = ''; | ||
| 42 | + privateMailNum: number = 0; | ||
| 43 | + read: boolean = true; | ||
| 44 | + source: string = ''; | ||
| 45 | + time: string = ''; | ||
| 46 | + title: string = ''; | ||
| 47 | + userId: string = ''; | ||
| 48 | + remark: string = ''; | ||
| 49 | + InteractMsubM:InteractMsubModel = new InteractMsubModel; | ||
| 50 | +} | ||
| 51 | + | ||
| 52 | +export class InteractMsubModel { | ||
| 53 | + beReply: string = ''; | ||
| 54 | + headUrl: string = ''; | ||
| 55 | + contentId: string = ''; | ||
| 56 | + contentRelObjectid: string = ''; | ||
| 57 | + contentTitle: string = ''; | ||
| 58 | + commentContent: string = ''; | ||
| 59 | + userName: string = ''; | ||
| 60 | + userId: string = ''; | ||
| 61 | + contentRelId: string = ''; | ||
| 62 | + shareUrl: string = ''; | ||
| 63 | + userType: string = ''; | ||
| 64 | + contentRelType: string = ''; | ||
| 65 | + visitor: string = ''; | ||
| 66 | + contentType: string = ''; | ||
| 67 | +} | ||
| 68 | + | ||
| 69 | +export interface InteractMParams { | ||
| 70 | + contentType?: string; | ||
| 71 | + pageNum?: string; | ||
| 72 | + pageSize?: string; | ||
| 73 | + userId?: string; | ||
| 74 | + createTime?: string; | ||
| 75 | +} | ||
| 76 | + | ||
| 77 | +export interface InteractMDTO{ | ||
| 78 | + success: boolean; | ||
| 79 | + code: number; | ||
| 80 | + message: string; | ||
| 81 | + data: number; | ||
| 82 | + timestamp?: number; | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +@Observed | ||
| 86 | +export class SubscribeMessageModel{ | ||
| 87 | + dealTime:string = "" | ||
| 88 | + title:string = "" | ||
| 89 | + imgUrl:string = "" | ||
| 90 | + desc:string = "" | ||
| 91 | + time:string = "" | ||
| 92 | + contentId:string = "" | ||
| 93 | + | ||
| 94 | + constructor(dealTime: string, title: string, imgUrl: string, desc: string , time: string, contentId: string) { | ||
| 95 | + this.dealTime = dealTime | ||
| 96 | + this.title = title | ||
| 97 | + this.imgUrl = imgUrl | ||
| 98 | + this.desc = desc | ||
| 99 | + this.time = time | ||
| 100 | + this.contentId = contentId | ||
| 101 | + } | ||
| 102 | +} | ||
| 103 | + | ||
| 104 | +export class Remark{ | ||
| 105 | + relationType:string = "" | ||
| 106 | + coverImageUrl:string = "" | ||
| 107 | + relationId:string = "" | ||
| 108 | + status:string = "" | ||
| 109 | +} |
| @@ -24,6 +24,10 @@ import { CommentLikeOperationRequestItem } from '../viewmodel/CommentLikeOperati | @@ -24,6 +24,10 @@ import { CommentLikeOperationRequestItem } from '../viewmodel/CommentLikeOperati | ||
| 24 | import { FollowOperationRequestItem } from '../viewmodel/FollowOperationRequestItem'; | 24 | import { FollowOperationRequestItem } from '../viewmodel/FollowOperationRequestItem'; |
| 25 | import { SpConstants } from 'wdConstant/Index'; | 25 | import { SpConstants } from 'wdConstant/Index'; |
| 26 | import { MessageItem } from '../viewmodel/MessageItem'; | 26 | import { MessageItem } from '../viewmodel/MessageItem'; |
| 27 | +import { MessageUnReadItem } from '../viewmodel/MessageUnReadItem'; | ||
| 28 | +import { HistoryPushDataItem } from '../viewmodel/HistoryPushDataItem'; | ||
| 29 | +import { HashMap } from '@kit.ArkTS'; | ||
| 30 | +import { InteractMessageMItem } from './InteractMessageModel'; | ||
| 27 | 31 | ||
| 28 | const TAG = "MinePageDatasModel" | 32 | const TAG = "MinePageDatasModel" |
| 29 | 33 | ||
| @@ -597,6 +601,106 @@ class MinePageDatasModel{ | @@ -597,6 +601,106 @@ class MinePageDatasModel{ | ||
| 597 | }) | 601 | }) |
| 598 | }) | 602 | }) |
| 599 | } | 603 | } |
| 604 | + | ||
| 605 | + /** | ||
| 606 | + * 获取消息未读数据 | ||
| 607 | + * @returns | ||
| 608 | + */ | ||
| 609 | + getMessageUnReadData(): Promise<MessageUnReadItem> { | ||
| 610 | + return new Promise<MessageUnReadItem>((success, error) => { | ||
| 611 | + this.fetchMessageUnReadData().then((navResDTO: ResponseDTO<MessageUnReadItem>) => { | ||
| 612 | + if (!navResDTO || navResDTO.code != 0) { | ||
| 613 | + error(null) | ||
| 614 | + return | ||
| 615 | + } | ||
| 616 | + let navigationBean = navResDTO.data as MessageUnReadItem | ||
| 617 | + success(navigationBean); | ||
| 618 | + }).catch((err: Error) => { | ||
| 619 | + error(null) | ||
| 620 | + }) | ||
| 621 | + }) | ||
| 622 | + } | ||
| 623 | + | ||
| 624 | + fetchMessageUnReadData() { | ||
| 625 | + let url = HttpUrlUtils.getMessageUnReadDataUrl() | ||
| 626 | + return WDHttp.get<ResponseDTO<MessageUnReadItem>>(url) | ||
| 627 | + }; | ||
| 628 | + | ||
| 629 | + /** | ||
| 630 | + * 点击消息(进入消息页面) | ||
| 631 | + * @returns | ||
| 632 | + */ | ||
| 633 | + sendClickMessageData(): Promise<String> { | ||
| 634 | + return new Promise<String>((success, error) => { | ||
| 635 | + this.fetchClickMessageData().then((navResDTO: ResponseDTO<String>) => { | ||
| 636 | + if (!navResDTO || navResDTO.code != 0) { | ||
| 637 | + error(null) | ||
| 638 | + return | ||
| 639 | + } | ||
| 640 | + success("1"); | ||
| 641 | + }).catch((err: Error) => { | ||
| 642 | + error(err) | ||
| 643 | + }) | ||
| 644 | + }) | ||
| 645 | + } | ||
| 646 | + | ||
| 647 | + fetchClickMessageData() { | ||
| 648 | + let url = HttpUrlUtils.getSendClickMessageUrl() | ||
| 649 | + return WDHttp.get<ResponseDTO<String>>(url) | ||
| 650 | + }; | ||
| 651 | + | ||
| 652 | + /** | ||
| 653 | + * 历史推送消息 | ||
| 654 | + * @returns | ||
| 655 | + */ | ||
| 656 | + getHistoryPushData(pageSize:string,pageNum:string): Promise<HistoryPushDataItem> { | ||
| 657 | + return new Promise<HistoryPushDataItem>((success, error) => { | ||
| 658 | + this.fetchHistoryPushData(pageSize,pageNum).then((navResDTO: ResponseDTO<HistoryPushDataItem>) => { | ||
| 659 | + if (!navResDTO || navResDTO.code != 0) { | ||
| 660 | + error(null) | ||
| 661 | + return | ||
| 662 | + } | ||
| 663 | + let navigationBean = navResDTO.data as HistoryPushDataItem | ||
| 664 | + success(navigationBean); | ||
| 665 | + }).catch((err: Error) => { | ||
| 666 | + error(err) | ||
| 667 | + }) | ||
| 668 | + }) | ||
| 669 | + } | ||
| 670 | + | ||
| 671 | + fetchHistoryPushData(pageSize:string,pageNum:string) { | ||
| 672 | + let url = HttpUrlUtils.getHistoryPushUrl()+ `?pageSize=${pageSize}&pageNum=${pageNum}` | ||
| 673 | + let headers: HashMap<string, string> = new HashMap<string, string>(); | ||
| 674 | + headers.set('system', 'Android'); | ||
| 675 | + return WDHttp.get<ResponseDTO<HistoryPushDataItem>>(url, headers) | ||
| 676 | + }; | ||
| 677 | + | ||
| 678 | + /** | ||
| 679 | + * 推送消息 | ||
| 680 | + * @returns | ||
| 681 | + */ | ||
| 682 | + getSubscribeMessageData(contentType:number,pageSize:string,pageNum:string): Promise<InteractMessageMItem> { | ||
| 683 | + return new Promise<InteractMessageMItem>((success, error) => { | ||
| 684 | + this.fetchSubscribeMessageData(contentType,pageSize,pageNum).then((navResDTO: ResponseDTO<InteractMessageMItem>) => { | ||
| 685 | + if (!navResDTO || navResDTO.code != 0) { | ||
| 686 | + error(null) | ||
| 687 | + return | ||
| 688 | + } | ||
| 689 | + let navigationBean = navResDTO.data as InteractMessageMItem | ||
| 690 | + success(navigationBean); | ||
| 691 | + }).catch((err: Error) => { | ||
| 692 | + error(err) | ||
| 693 | + }) | ||
| 694 | + }) | ||
| 695 | + } | ||
| 696 | + | ||
| 697 | + fetchSubscribeMessageData(contentType:number,pageSize:string,pageNum:string) { | ||
| 698 | + let userID = HttpUtils.getUserId(); | ||
| 699 | + let url = HttpUrlUtils.getMessageListDataUrl()+`?createTime=${''}&contentType=${contentType}&userId=${userID}&pageSize=${pageSize}&pageNum=${pageNum}` | ||
| 700 | + return WDHttp.get<ResponseDTO<InteractMessageMItem>>(url) | ||
| 701 | + }; | ||
| 702 | + | ||
| 703 | + | ||
| 600 | } | 704 | } |
| 601 | 705 | ||
| 602 | const minePageDatasModel = MinePageDatasModel.getInstance() | 706 | const minePageDatasModel = MinePageDatasModel.getInstance() |
| @@ -43,7 +43,6 @@ export interface MyCollectionListModel{ | @@ -43,7 +43,6 @@ export interface MyCollectionListModel{ | ||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | 45 | ||
| 46 | - | ||
| 47 | export interface contentListItemParams{ | 46 | export interface contentListItemParams{ |
| 48 | contentId?:string; | 47 | contentId?:string; |
| 49 | contentType?:string; | 48 | contentType?:string; |
| 1 | +import { router } from '@kit.ArkUI'; | ||
| 2 | + | ||
| 3 | +@Entry | ||
| 4 | +@Component | ||
| 5 | +struct ShowHomePageHeaderPage { | ||
| 6 | + @State headPhotoUrl: string = ''; | ||
| 7 | + @State params:Record<string, string> = router.getParams() as Record<string, string>; | ||
| 8 | + | ||
| 9 | + onPageShow() { | ||
| 10 | + this.headPhotoUrl = this.params?.['headPhotoUrl']; | ||
| 11 | + } | ||
| 12 | + | ||
| 13 | + build() { | ||
| 14 | + Row() { | ||
| 15 | + Image(this.headPhotoUrl) | ||
| 16 | + .alt( $r('app.media.WDAccountOwnerHedaerDefaultIcon') ) | ||
| 17 | + .width('100%') | ||
| 18 | + .objectFit(ImageFit.Contain) | ||
| 19 | + } | ||
| 20 | + .width('100%') | ||
| 21 | + .height('100%') | ||
| 22 | + .alignItems(VerticalAlign.Center) | ||
| 23 | + .backgroundColor($r('app.color.color_000000')) | ||
| 24 | + .onClick(()=>{ | ||
| 25 | + router.back() | ||
| 26 | + }) | ||
| 27 | + } | ||
| 28 | +} |
| @@ -4,18 +4,16 @@ import { router } from '@kit.ArkUI'; | @@ -4,18 +4,16 @@ import { router } from '@kit.ArkUI'; | ||
| 4 | @Component | 4 | @Component |
| 5 | struct ShowUserHeaderPage { | 5 | struct ShowUserHeaderPage { |
| 6 | @State headPhotoUrl: string = ''; | 6 | @State headPhotoUrl: string = ''; |
| 7 | - @State headType: string = '' | ||
| 8 | @State params:Record<string, string> = router.getParams() as Record<string, string>; | 7 | @State params:Record<string, string> = router.getParams() as Record<string, string>; |
| 9 | 8 | ||
| 10 | onPageShow() { | 9 | onPageShow() { |
| 11 | this.headPhotoUrl = this.params?.['headPhotoUrl']; | 10 | this.headPhotoUrl = this.params?.['headPhotoUrl']; |
| 12 | - this.headType = this.params?.['headType'] ?? ''; | ||
| 13 | } | 11 | } |
| 14 | 12 | ||
| 15 | build() { | 13 | build() { |
| 16 | Row() { | 14 | Row() { |
| 17 | Image(this.headPhotoUrl) | 15 | Image(this.headPhotoUrl) |
| 18 | - .alt(this.headType.length > 0 ? $r('app.media.WDAccountOwnerHedaerDefaultIcon') : $r('app.media.default_head')) | 16 | + .alt($r('app.media.default_head')) |
| 19 | .width('720lpx') | 17 | .width('720lpx') |
| 20 | .height('720lpx') | 18 | .height('720lpx') |
| 21 | .objectFit(ImageFit.Auto) | 19 | .objectFit(ImageFit.Auto) |
| @@ -24,7 +24,8 @@ import { | @@ -24,7 +24,8 @@ import { | ||
| 24 | postInteractAccentionOperateParams, | 24 | postInteractAccentionOperateParams, |
| 25 | postRecommendListParams, | 25 | postRecommendListParams, |
| 26 | GoldenPositionExtraBean, | 26 | GoldenPositionExtraBean, |
| 27 | - FeedbackTypeBean | 27 | + FeedbackTypeBean, |
| 28 | + LiveRoomDataBean | ||
| 28 | } from 'wdBean'; | 29 | } from 'wdBean'; |
| 29 | import { PageUIReqBean } from '../components/page/bean/PageUIReqBean'; | 30 | import { PageUIReqBean } from '../components/page/bean/PageUIReqBean'; |
| 30 | import { ArrayList } from '@kit.ArkTS'; | 31 | import { ArrayList } from '@kit.ArkTS'; |
| @@ -470,4 +471,13 @@ export class PageRepository { | @@ -470,4 +471,13 @@ export class PageRepository { | ||
| 470 | url = url + "?dictCode=" + "CN_OPINION_TYPE"; | 471 | url = url + "?dictCode=" + "CN_OPINION_TYPE"; |
| 471 | return WDHttp.get<ResponseDTO<FeedbackTypeBean[]>>(url) | 472 | return WDHttp.get<ResponseDTO<FeedbackTypeBean[]>>(url) |
| 472 | }; | 473 | }; |
| 474 | + | ||
| 475 | + /** | ||
| 476 | + * 获取更多直播间人数 | ||
| 477 | + * */ | ||
| 478 | + static fetchLiveRoomBatchAllUrl(ids: string) { | ||
| 479 | + let url = HttpUrlUtils.getLiveRoomBatchAllDataUrl() | ||
| 480 | + url = url + "?liveIdList=" + ids; | ||
| 481 | + return WDHttp.get<ResponseDTO<LiveRoomDataBean[]>>(url) | ||
| 482 | + }; | ||
| 473 | } | 483 | } |
| 1 | +export class HistoryPushDataItem{ | ||
| 2 | + hasNext: number = 0 | ||
| 3 | + list: Array< HistoryPushItem > = [] | ||
| 4 | + pageNum: number = 0 | ||
| 5 | + pageSize: number = 0 | ||
| 6 | + totalCount: number = 0 | ||
| 7 | +} | ||
| 8 | + | ||
| 9 | +export class HistoryPushItem{ | ||
| 10 | + activityExt?: null | ||
| 11 | + appStyle: string = "" | ||
| 12 | + askInfo?: null | ||
| 13 | + axisColor: string = "" | ||
| 14 | + bestNoticer?: null | ||
| 15 | + bottomNavId?: null | ||
| 16 | + cardItemId: string = "" | ||
| 17 | + channelId: number= 0 | ||
| 18 | + commentInfo?: null | ||
| 19 | + corner: string = "" | ||
| 20 | + coverSize: string = "" | ||
| 21 | + coverType?: number | ||
| 22 | + coverUrl: string = "" | ||
| 23 | + expIds: string = "" | ||
| 24 | + extra: string = "" | ||
| 25 | + fullColumnImgUrls: Array< FullColumnImgUrl > = [] | ||
| 26 | + hasMore?: null | ||
| 27 | + itemId: string = "" | ||
| 28 | + itemType: string = "" | ||
| 29 | + itemTypeCode: string = "" | ||
| 30 | + keyArticle: number= 0 | ||
| 31 | + landscape?: null | ||
| 32 | + likeStyle?: null | ||
| 33 | + linkUrl: string = "" | ||
| 34 | + liveInfo?: null | ||
| 35 | + menuShow: number = 0 | ||
| 36 | + newTags: string = "" | ||
| 37 | + newsAuthor: string = "" | ||
| 38 | + newsSubTitle: string = "" | ||
| 39 | + newsSummary: string = "" | ||
| 40 | + newsTitle: string = "" | ||
| 41 | + newsTitleColor: string = "" | ||
| 42 | + objectId: string = "" | ||
| 43 | + objectLevel: string = "" | ||
| 44 | + objectType: string = "" | ||
| 45 | + openComment?: null | ||
| 46 | + openLikes?: null | ||
| 47 | + pageId: string = "" | ||
| 48 | + photoNum?: null | ||
| 49 | + position?: null | ||
| 50 | + productNum?: null | ||
| 51 | + publishTime: string = "" | ||
| 52 | + pushTime: number = 0 | ||
| 53 | + pushUnqueId: number = 0 | ||
| 54 | + readFlag: number = 0 | ||
| 55 | + recommend?: null | ||
| 56 | + relId: number = 0 | ||
| 57 | + relObjectId: string = "" | ||
| 58 | + relType: number = 0 | ||
| 59 | + rmhInfo?: null | ||
| 60 | + rmhPlatform: number = 0 | ||
| 61 | + sceneId: string = "" | ||
| 62 | + shareInfo?: null | ||
| 63 | + // slideShows: Array< unknown > | ||
| 64 | + sortValue?: null | ||
| 65 | + source: string = "" | ||
| 66 | + subObjectType: string = "" | ||
| 67 | + subSceneId: string = "" | ||
| 68 | + // tagIds: Array< unknown > | ||
| 69 | + tagWord?: null | ||
| 70 | + titleShow?: null | ||
| 71 | + titleShowPolicy?: null | ||
| 72 | + topicTemplate?: null | ||
| 73 | + traceId: string = "" | ||
| 74 | + traceInfo: string = "" | ||
| 75 | + userInfo?: null | ||
| 76 | + videoInfo?: null | ||
| 77 | + visitorComment: number = 0 | ||
| 78 | + voiceInfo?: null | ||
| 79 | +} | ||
| 80 | + | ||
| 81 | +export class FullColumnImgUrl{ | ||
| 82 | + | ||
| 83 | +} |
| 1 | +// import { collcetRecordParams, MyCollectionItem, MyCollectionListModel } from '../model/MyCollectionModel'; | ||
| 2 | +import { HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | ||
| 3 | +import { Logger } from 'wdKit'; | ||
| 4 | +import promptAction from '@ohos.promptAction'; | ||
| 5 | +import { | ||
| 6 | + InteractMDTO, | ||
| 7 | + InteractMessageListModel, InteractMessageMItem, InteractMParams } from '../model/InteractMessageModel'; | ||
| 8 | + | ||
| 9 | +const TAG = "MyCollectionViewModel" | ||
| 10 | + | ||
| 11 | +class InteractMessageViewModel { | ||
| 12 | + private static instance:InteractMessageViewModel | ||
| 13 | + /** | ||
| 14 | + * 单例模式 | ||
| 15 | + * @returns | ||
| 16 | + */ | ||
| 17 | + public static getInstance(): InteractMessageViewModel { | ||
| 18 | + if (!InteractMessageViewModel.instance) { | ||
| 19 | + InteractMessageViewModel.instance = new InteractMessageViewModel(); | ||
| 20 | + } | ||
| 21 | + return InteractMessageViewModel.instance; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + // ///互动通知 | ||
| 25 | + // WDMessageCenterMessageType_Interact = 1, | ||
| 26 | + // | ||
| 27 | + // ///预约消息 | ||
| 28 | + // WDMessageCenterMessageType_Subscribe = 2, | ||
| 29 | + // | ||
| 30 | + // ///系统消息 | ||
| 31 | + // WDMessageCenterMessageType_System = 3 | ||
| 32 | + | ||
| 33 | + BaseGetRequest(contentType:number,pageNum:number){ | ||
| 34 | + let userID = HttpUtils.getUserId(); | ||
| 35 | + let url = HttpUrlUtils.getMessageListDataUrl()+`?contentType=${contentType}&userId=${userID}&pageSize=${20}&pageNum=${pageNum}` | ||
| 36 | + return WDHttp.get<InteractMessageListModel>(url) | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + | ||
| 40 | + fetchMessageList(contentType:number,pageNum:number):Promise<InteractMessageMItem>{ | ||
| 41 | + return new Promise((success,error) => { | ||
| 42 | + this.BaseGetRequest(contentType,pageNum).then((navResDTO: InteractMessageListModel) => { | ||
| 43 | + if (!navResDTO || navResDTO.code != 0) { | ||
| 44 | + return | ||
| 45 | + } | ||
| 46 | + Logger.info(TAG, "fetchMessageList then,navResDTO.timeStamp:" + navResDTO.timestamp); | ||
| 47 | + success(navResDTO.data) | ||
| 48 | + }).catch((err: Error) => { | ||
| 49 | + Logger.error(TAG, `fetchMessageList catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 50 | + error("page data invalid"); | ||
| 51 | + }) | ||
| 52 | + }) | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + getMessageLikeCount():Promise<number>{ | ||
| 56 | + return new Promise((success,error) => { | ||
| 57 | + WDHttp.get<InteractMDTO>(HttpUrlUtils.getMessageLikeCount()).then((navResDTO: InteractMDTO) => { | ||
| 58 | + if (navResDTO.code == 0) { | ||
| 59 | + success(navResDTO.data) | ||
| 60 | + } | ||
| 61 | + }) | ||
| 62 | + .catch((error: Error) => { | ||
| 63 | + Logger.info(TAG,'executeCollcet','ResponseDTO') | ||
| 64 | + }) | ||
| 65 | + }) | ||
| 66 | + } | ||
| 67 | +} | ||
| 68 | + | ||
| 69 | +const interactMViewModel = InteractMessageViewModel.getInstance(); | ||
| 70 | + | ||
| 71 | +export default interactMViewModel as InteractMessageViewModel |
| 1 | +@Observed | ||
| 1 | export class MessageItem{ | 2 | export class MessageItem{ |
| 2 | imgSrc:Resource = $r("app.media.xxhdpi_pic_wb") | 3 | imgSrc:Resource = $r("app.media.xxhdpi_pic_wb") |
| 3 | title:string = "" | 4 | title:string = "" |
| 4 | desc:string = "" | 5 | desc:string = "" |
| 5 | time:string = "" | 6 | time:string = "" |
| 7 | + unReadCount:number = 0 | ||
| 6 | 8 | ||
| 7 | constructor(imgSrc:Resource,title:string,desc:string,time:string){ | 9 | constructor(imgSrc:Resource,title:string,desc:string,time:string){ |
| 8 | this.imgSrc = imgSrc | 10 | this.imgSrc = imgSrc |
| 1 | +export class MessageUnReadItem{ | ||
| 2 | + activeCount: number = 0 //互动通知未读数 | ||
| 3 | + subscribeCount: number = 0 //预约消息未读数 | ||
| 4 | + systemCount: number = 0 //系统通知未读数 | ||
| 5 | + | ||
| 6 | + subscribeInfo: SubscribeInfo = new SubscribeInfo() | ||
| 7 | + systemInfo: SystemInfo = new SystemInfo() | ||
| 8 | + activeInfo: ActiveInfo = new ActiveInfo | ||
| 9 | +} | ||
| 10 | + | ||
| 11 | +class SubscribeInfo{ | ||
| 12 | + classify: string = "" | ||
| 13 | + contentId: string = "" | ||
| 14 | + contentType: string = "" | ||
| 15 | + id: number = -1 | ||
| 16 | + message: string = "" | ||
| 17 | + platform: string = "" | ||
| 18 | + privateMailId: number = -1 | ||
| 19 | + privateMailIdList: Array< string > = [] | ||
| 20 | + privateMailIds: string = "" | ||
| 21 | + privateMailNum: number = -1 | ||
| 22 | + read: boolean = false | ||
| 23 | + source: string = "" | ||
| 24 | + time: string = "" | ||
| 25 | + title: string = "" | ||
| 26 | + userId: number = -1 | ||
| 27 | + remark: string = "" | ||
| 28 | +} | ||
| 29 | +class SystemInfo{ | ||
| 30 | + classify: string = "" | ||
| 31 | + contentType: string = "" | ||
| 32 | + id: number = -1 | ||
| 33 | + message: string = "" | ||
| 34 | + platform: string = "" | ||
| 35 | + privateMailId: number = -1 | ||
| 36 | + privateMailIdList: Array< string > = [] | ||
| 37 | + privateMailIds: string = "" | ||
| 38 | + privateMailNum: number = -1 | ||
| 39 | + read: boolean = false | ||
| 40 | + source: string = "" | ||
| 41 | + time: string = "" | ||
| 42 | + title: string = "" | ||
| 43 | + userId: number = -1 | ||
| 44 | +} | ||
| 45 | + | ||
| 46 | +class ActiveInfo{ | ||
| 47 | + id:string = "" | ||
| 48 | + message: string = "" | ||
| 49 | + time: string = "" | ||
| 50 | + title: string = "" | ||
| 51 | +} |
| 1 | 1 | ||
| 2 | import FunctionsItem from './FunctionsItem' | 2 | import FunctionsItem from './FunctionsItem' |
| 3 | 3 | ||
| 4 | +@Observed | ||
| 4 | export default class MinePagePersonalFunctionsItem extends FunctionsItem { | 5 | export default class MinePagePersonalFunctionsItem extends FunctionsItem { |
| 6 | + isShowRedPoint:boolean = false | ||
| 5 | } | 7 | } |
| @@ -10,7 +10,8 @@ import { | @@ -10,7 +10,8 @@ import { | ||
| 10 | PageInfoBean, | 10 | PageInfoBean, |
| 11 | PageInfoDTO, | 11 | PageInfoDTO, |
| 12 | GoldenPositionExtraBean, | 12 | GoldenPositionExtraBean, |
| 13 | - NavigationDetailDTO | 13 | + NavigationDetailDTO, |
| 14 | + LiveRoomDataBean | ||
| 14 | } from 'wdBean'; | 15 | } from 'wdBean'; |
| 15 | 16 | ||
| 16 | import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit'; | 17 | import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit'; |
| @@ -439,6 +440,31 @@ export class PageViewModel extends BaseViewModel { | @@ -439,6 +440,31 @@ export class PageViewModel extends BaseViewModel { | ||
| 439 | }) | 440 | }) |
| 440 | }) | 441 | }) |
| 441 | } | 442 | } |
| 443 | + | ||
| 444 | + async getLiveRoomBatchInfo(ids: string): Promise<LiveRoomDataBean[]> { | ||
| 445 | + return new Promise<LiveRoomDataBean[]>((success, error) => { | ||
| 446 | + Logger.info(TAG, `getLiveRoomBatchInfo pageInfo start`); | ||
| 447 | + PageRepository.fetchLiveRoomBatchAllUrl(ids).then((resDTO: ResponseDTO<LiveRoomDataBean[]>) => { | ||
| 448 | + if (!resDTO || !resDTO.data) { | ||
| 449 | + Logger.error(TAG, 'getLiveRoomBatchInfo then navResDTO is empty'); | ||
| 450 | + error('resDTO is empty'); | ||
| 451 | + return | ||
| 452 | + } | ||
| 453 | + if (resDTO.code != 0) { | ||
| 454 | + Logger.error(TAG, `getLiveRoomBatchInfo then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 455 | + error('resDTO Response Code is failure'); | ||
| 456 | + return | ||
| 457 | + } | ||
| 458 | + // let navResStr = JSON.stringify(navResDTO); | ||
| 459 | + Logger.info(TAG, "getLiveRoomBatchInfo then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 460 | + success(resDTO.data); | ||
| 461 | + }).catch((err: Error) => { | ||
| 462 | + Logger.error(TAG, `getLiveRoomBatchInfo catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 463 | + error(err); | ||
| 464 | + }) | ||
| 465 | + }) | ||
| 466 | + } | ||
| 467 | + | ||
| 442 | } | 468 | } |
| 443 | 469 | ||
| 444 | 470 |
sight_harmony/features/wdComponent/src/main/resources/base/media/MessageOriginTextIcon.png
0 → 100644
735 Bytes
sight_harmony/features/wdComponent/src/main/resources/base/media/comment_img_input_black.png
0 → 100644
2.5 KB
809 Bytes
sight_harmony/features/wdComponent/src/main/resources/base/media/icon_live_new_running.png
0 → 100644
1.35 KB
10.1 KB
28.4 KB
13.3 KB
495 Bytes
2.09 KB
sight_harmony/features/wdComponent/src/main/resources/base/media/subscribe_arrow_icon.png
0 → 100644
253 Bytes
| @@ -24,6 +24,8 @@ | @@ -24,6 +24,8 @@ | ||
| 24 | "components/page/ThemeListPage", | 24 | "components/page/ThemeListPage", |
| 25 | "pages/ShowUserHeaderPage", | 25 | "pages/ShowUserHeaderPage", |
| 26 | "pages/MineMessagePage", | 26 | "pages/MineMessagePage", |
| 27 | - "components/page/InteractMessagePage" | 27 | + "components/page/InteractMessagePage", |
| 28 | + "pages/ShowHomePageHeaderPage", | ||
| 29 | + "pages/SubscribeMessagePage" | ||
| 28 | ] | 30 | ] |
| 29 | } | 31 | } |
| @@ -70,6 +70,7 @@ export struct DetailPlayLiveCommon { | @@ -70,6 +70,7 @@ export struct DetailPlayLiveCommon { | ||
| 70 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | 70 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) |
| 71 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | 71 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) |
| 72 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | 72 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) |
| 73 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | ||
| 73 | this.publishCommentModel.commentContent = '' | 74 | this.publishCommentModel.commentContent = '' |
| 74 | // } | 75 | // } |
| 75 | } | 76 | } |
| @@ -121,11 +121,12 @@ export struct PlayUIComponent { | @@ -121,11 +121,12 @@ export struct PlayUIComponent { | ||
| 121 | } | 121 | } |
| 122 | } | 122 | } |
| 123 | .width('100%') | 123 | .width('100%') |
| 124 | + // .width(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? 'calc(100% - 80vp)' : 'calc(100% - 32vp)') | ||
| 124 | .padding({ | 125 | .padding({ |
| 125 | top: 15, | 126 | top: 15, |
| 126 | bottom: 6, | 127 | bottom: 6, |
| 127 | - left: 10, | ||
| 128 | - right: 10 | 128 | + left: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp', |
| 129 | + right: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp' | ||
| 129 | }) | 130 | }) |
| 130 | .alignItems(HorizontalAlign.Start) | 131 | .alignItems(HorizontalAlign.Start) |
| 131 | .visibility(this.isMenuVisible ? Visibility.Visible : Visibility.None) | 132 | .visibility(this.isMenuVisible ? Visibility.Visible : Visibility.None) |
| @@ -292,8 +293,8 @@ export struct PlayUIComponent { | @@ -292,8 +293,8 @@ export struct PlayUIComponent { | ||
| 292 | .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] }) | 293 | .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] }) |
| 293 | .width('100%') | 294 | .width('100%') |
| 294 | .padding({ | 295 | .padding({ |
| 295 | - left: 10, | ||
| 296 | - right: 10, | 296 | + left: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp', |
| 297 | + right: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp', | ||
| 297 | top: 15, | 298 | top: 15, |
| 298 | bottom: 15 | 299 | bottom: 15 |
| 299 | }) | 300 | }) |
| @@ -28,11 +28,11 @@ export struct TopPlayComponent { | @@ -28,11 +28,11 @@ export struct TopPlayComponent { | ||
| 28 | 28 | ||
| 29 | updateData() { | 29 | updateData() { |
| 30 | //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | 30 | //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 |
| 31 | - if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.previewUrl && this.liveDetailsBean.liveInfo.previewUrl.length > 0) { | 31 | + if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.previewUrl && |
| 32 | + this.liveDetailsBean.liveInfo.previewUrl.length > 0) { | ||
| 32 | this.imgUrl = this.liveDetailsBean.liveInfo.previewUrl | 33 | this.imgUrl = this.liveDetailsBean.liveInfo.previewUrl |
| 33 | Logger.debug(TAG, 'ok+' + `${this.imgUrl}`) | 34 | Logger.debug(TAG, 'ok+' + `${this.imgUrl}`) |
| 34 | - } | ||
| 35 | - else if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) { | 35 | + } else if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) { |
| 36 | this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url | 36 | this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url |
| 37 | Logger.debug(TAG, 'ok-' + `${this.imgUrl}`) | 37 | Logger.debug(TAG, 'ok-' + `${this.imgUrl}`) |
| 38 | } | 38 | } |
| @@ -81,6 +81,7 @@ export struct TopPlayComponent { | @@ -81,6 +81,7 @@ export struct TopPlayComponent { | ||
| 81 | .alignSelf(ItemAlign.Center) | 81 | .alignSelf(ItemAlign.Center) |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | - aboutToDisappear(): void { | 84 | + async aboutToDisappear(): Promise<void> { |
| 85 | + await this.playerController?.release() | ||
| 85 | } | 86 | } |
| 86 | } | 87 | } |
| @@ -115,6 +115,7 @@ export struct PlayerCommentComponent { | @@ -115,6 +115,7 @@ export struct PlayerCommentComponent { | ||
| 115 | // 收藏、分享、点赞是否需要根据字段显隐 | 115 | // 收藏、分享、点赞是否需要根据字段显隐 |
| 116 | OperRowListView({ | 116 | OperRowListView({ |
| 117 | styleType: 3, | 117 | styleType: 3, |
| 118 | + componentType: 4, | ||
| 118 | operationButtonList: ['comment', 'collect', 'share', 'like'], | 119 | operationButtonList: ['comment', 'collect', 'share', 'like'], |
| 119 | contentDetailData: this.contentDetailData, | 120 | contentDetailData: this.contentDetailData, |
| 120 | publishCommentModel: this.publishCommentModel, | 121 | publishCommentModel: this.publishCommentModel, |
| @@ -37,11 +37,10 @@ export struct PlayerComponent { | @@ -37,11 +37,10 @@ export struct PlayerComponent { | ||
| 37 | } | 37 | } |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | - aboutToDisappear(): void { | ||
| 41 | - | 40 | + async aboutToDisappear(): Promise<void> { |
| 42 | this.playerController?.pause() | 41 | this.playerController?.pause() |
| 43 | this.playerController?.stop() | 42 | this.playerController?.stop() |
| 44 | - this.playerController?.release() | 43 | + await this.playerController?.release() |
| 45 | } | 44 | } |
| 46 | 45 | ||
| 47 | updateData() { | 46 | updateData() { |
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/CommentComponentPage.ets
0 → 100644
| 1 | +import { ContentDetailDTO } from 'wdBean/Index' | ||
| 2 | +import { | ||
| 3 | + publishCommentModel | ||
| 4 | +} from '../../../../../wdComponent/src/main/ets/components/comment/model/PublishCommentModel' | ||
| 5 | +import { CommentComponent } from '../../../../../wdComponent/src/main/ets/components/comment/view/CommentComponent' | ||
| 6 | + | ||
| 7 | +@Component | ||
| 8 | +export struct CommentComponentPage { | ||
| 9 | + scroller: Scroller = new Scroller() | ||
| 10 | + @Consume contentDetailData: ContentDetailDTO | ||
| 11 | + @Consume showCommentList: boolean | ||
| 12 | + @State publishCommentModel: publishCommentModel = new publishCommentModel() | ||
| 13 | + | ||
| 14 | + aboutToAppear(): void { | ||
| 15 | + | ||
| 16 | + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | ||
| 17 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | ||
| 18 | + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | ||
| 19 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 20 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 21 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 22 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + build() { | ||
| 26 | + Scroll(this.scroller) { | ||
| 27 | + Stack() { | ||
| 28 | + CommentComponent({ | ||
| 29 | + publishCommentModel: this.publishCommentModel | ||
| 30 | + }) | ||
| 31 | + Image($r("app.media.ic_close_black")) | ||
| 32 | + .width(20) | ||
| 33 | + .height(20) | ||
| 34 | + .onClick(() => { | ||
| 35 | + this.showCommentList = false | ||
| 36 | + }) | ||
| 37 | + .margin({ top: 10, right: 20 }) | ||
| 38 | + .position({ x: '100%' }) | ||
| 39 | + .markAnchor({ x: '100%' }) | ||
| 40 | + | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + .zIndex(1000) | ||
| 44 | + .backgroundColor(Color.White) | ||
| 45 | + | ||
| 46 | + } | ||
| 47 | +} |
| 1 | import { ContentDetailDTO, InteractDataDTO } from 'wdBean'; | 1 | import { ContentDetailDTO, InteractDataDTO } from 'wdBean'; |
| 2 | -import { PlayerConstants, WDPlayerController, WDPlayerRenderView } from 'wdPlayer'; | 2 | +import { WDPlayerController, WDPlayerRenderView } from 'wdPlayer'; |
| 3 | import { ContentDetailRequest } from 'wdDetailPlayApi'; | 3 | import { ContentDetailRequest } from 'wdDetailPlayApi'; |
| 4 | import { | 4 | import { |
| 5 | batchLikeAndCollectParams, | 5 | batchLikeAndCollectParams, |
| @@ -11,6 +11,7 @@ import { HttpUtils } from 'wdNetwork/Index'; | @@ -11,6 +11,7 @@ import { HttpUtils } from 'wdNetwork/Index'; | ||
| 11 | import { DateTimeUtils } from 'wdKit/Index'; | 11 | import { DateTimeUtils } from 'wdKit/Index'; |
| 12 | import { PlayerBottomView } from '../view/PlayerBottomView'; | 12 | import { PlayerBottomView } from '../view/PlayerBottomView'; |
| 13 | import { PlayerRightView } from '../view/PlayerRightView'; | 13 | import { PlayerRightView } from '../view/PlayerRightView'; |
| 14 | +import { CommentComponentPage } from './CommentComponentPage'; | ||
| 14 | 15 | ||
| 15 | const TAG = 'DetailPlayShortVideoPage'; | 16 | const TAG = 'DetailPlayShortVideoPage'; |
| 16 | 17 | ||
| @@ -32,6 +33,7 @@ export struct DetailPlayShortVideoPage { | @@ -32,6 +33,7 @@ export struct DetailPlayShortVideoPage { | ||
| 32 | @Provide followStatus: string = '0' // 关注状态 | 33 | @Provide followStatus: string = '0' // 关注状态 |
| 33 | @Provide isOpenDetail: boolean = false // 查看详情按钮点击 | 34 | @Provide isOpenDetail: boolean = false // 查看详情按钮点击 |
| 34 | @Provide isDragging: boolean = false // 拖动时间进度条 | 35 | @Provide isDragging: boolean = false // 拖动时间进度条 |
| 36 | + @Provide showCommentList: boolean = false | ||
| 35 | @Consume @Watch('videoStatusChange') switchVideoStatus: boolean | 37 | @Consume @Watch('videoStatusChange') switchVideoStatus: boolean |
| 36 | @Consume @Watch('pageShowChange') pageShow: number | 38 | @Consume @Watch('pageShowChange') pageShow: number |
| 37 | @Consume topSafeHeight: number | 39 | @Consume topSafeHeight: number |
| @@ -148,6 +150,7 @@ export struct DetailPlayShortVideoPage { | @@ -148,6 +150,7 @@ export struct DetailPlayShortVideoPage { | ||
| 148 | this.progressVal = Math.floor(position * 100 / duration); | 150 | this.progressVal = Math.floor(position * 100 / duration); |
| 149 | } | 151 | } |
| 150 | this.queryNewsInfoOfUser() | 152 | this.queryNewsInfoOfUser() |
| 153 | + | ||
| 151 | } | 154 | } |
| 152 | 155 | ||
| 153 | async aboutToDisappear(): Promise<void> { | 156 | async aboutToDisappear(): Promise<void> { |
| @@ -163,10 +166,14 @@ export struct DetailPlayShortVideoPage { | @@ -163,10 +166,14 @@ export struct DetailPlayShortVideoPage { | ||
| 163 | PlayerBottomView({ | 166 | PlayerBottomView({ |
| 164 | playerController: this.playerController | 167 | playerController: this.playerController |
| 165 | }) | 168 | }) |
| 169 | + | ||
| 166 | PlayerRightView({ | 170 | PlayerRightView({ |
| 167 | playerController: this.playerController | 171 | playerController: this.playerController |
| 168 | }) | 172 | }) |
| 169 | 173 | ||
| 174 | + CommentComponentPage({}).visibility(this.showCommentList ? Visibility.Visible : Visibility.None) | ||
| 175 | + .position({ y: '100%' }) | ||
| 176 | + .markAnchor({ y: '100%' }) | ||
| 170 | } | 177 | } |
| 171 | .height('100%') | 178 | .height('100%') |
| 172 | .width('100%') | 179 | .width('100%') |
| @@ -192,6 +199,7 @@ export struct DetailPlayShortVideoPage { | @@ -192,6 +199,7 @@ export struct DetailPlayShortVideoPage { | ||
| 192 | 199 | ||
| 193 | @Builder | 200 | @Builder |
| 194 | playerViewBuilder() { | 201 | playerViewBuilder() { |
| 202 | + | ||
| 195 | WDPlayerRenderView({ | 203 | WDPlayerRenderView({ |
| 196 | playerController: this.playerController, | 204 | playerController: this.playerController, |
| 197 | onLoad: async () => { | 205 | onLoad: async () => { |
| @@ -205,10 +213,13 @@ export struct DetailPlayShortVideoPage { | @@ -205,10 +213,13 @@ export struct DetailPlayShortVideoPage { | ||
| 205 | .padding({ | 213 | .padding({ |
| 206 | bottom: this.videoLandScape === 1 ? 115 : 0, | 214 | bottom: this.videoLandScape === 1 ? 115 : 0, |
| 207 | }) | 215 | }) |
| 216 | + .layoutWeight(1) | ||
| 208 | .align(this.videoLandScape === 0 ? Alignment.Top : Alignment.Center) | 217 | .align(this.videoLandScape === 0 ? Alignment.Top : Alignment.Center) |
| 209 | .onClick(() => { | 218 | .onClick(() => { |
| 210 | console.error('WDPlayerRenderView=== onClick') | 219 | console.error('WDPlayerRenderView=== onClick') |
| 211 | this.playerController?.switchPlayOrPause(); | 220 | this.playerController?.switchPlayOrPause(); |
| 212 | }) | 221 | }) |
| 222 | + | ||
| 223 | + | ||
| 213 | } | 224 | } |
| 214 | } | 225 | } |
| @@ -43,7 +43,7 @@ export struct DetailDialog { | @@ -43,7 +43,7 @@ export struct DetailDialog { | ||
| 43 | .height(200) | 43 | .height(200) |
| 44 | 44 | ||
| 45 | Row() { | 45 | Row() { |
| 46 | - Image($r('app.media.ic_close')) | 46 | + Image($r("app.media.ic_close_white")) |
| 47 | .height(24).margin({ top: 20 }).onClick(() => { | 47 | .height(24).margin({ top: 20 }).onClick(() => { |
| 48 | this.controller.close() | 48 | this.controller.close() |
| 49 | if (this.isOpenDetail) { | 49 | if (this.isOpenDetail) { |
| @@ -3,20 +3,56 @@ import { PlayerTitleView } from './PlayerTitleView' | @@ -3,20 +3,56 @@ import { PlayerTitleView } from './PlayerTitleView' | ||
| 3 | import { PlayerProgressView } from './PlayerProgressView' | 3 | import { PlayerProgressView } from './PlayerProgressView' |
| 4 | import { PlayerCommentView } from './PlayerCommentView' | 4 | import { PlayerCommentView } from './PlayerCommentView' |
| 5 | import { PlayerTimeSeekView } from './PlayerTimeSeekView' | 5 | import { PlayerTimeSeekView } from './PlayerTimeSeekView' |
| 6 | +import { OperRowListView } from '../../../../../wdComponent/src/main/ets/components/view/OperRowListView' | ||
| 7 | +import { | ||
| 8 | + publishCommentModel | ||
| 9 | +} from '../../../../../wdComponent/src/main/ets/components/comment/model/PublishCommentModel' | ||
| 10 | +import { ContentDetailDTO } from 'wdBean/Index'; | ||
| 11 | +import { WindowModel } from 'wdKit/Index'; | ||
| 6 | 12 | ||
| 7 | @Component | 13 | @Component |
| 8 | export struct PlayerBottomView { | 14 | export struct PlayerBottomView { |
| 9 | private playerController?: WDPlayerController; | 15 | private playerController?: WDPlayerController; |
| 16 | + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | ||
| 10 | @Consume showComment?: boolean | 17 | @Consume showComment?: boolean |
| 11 | @Consume isOpenDetail?: boolean | 18 | @Consume isOpenDetail?: boolean |
| 12 | @Consume isDragging?: boolean | 19 | @Consume isDragging?: boolean |
| 20 | + @Consume contentDetailData: ContentDetailDTO | ||
| 21 | + @State publishCommentModel: publishCommentModel = new publishCommentModel() | ||
| 22 | + | ||
| 23 | + aboutToAppear(): void { | ||
| 24 | + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | ||
| 25 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | ||
| 26 | + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | ||
| 27 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 28 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 29 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 30 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 31 | + this.publishCommentModel.commentContent = '' | ||
| 32 | + } | ||
| 13 | 33 | ||
| 14 | build() { | 34 | build() { |
| 15 | Column() { | 35 | Column() { |
| 16 | PlayerTitleView() | 36 | PlayerTitleView() |
| 17 | PlayerProgressView({ playerController: this.playerController }) | 37 | PlayerProgressView({ playerController: this.playerController }) |
| 18 | if (this.showComment) { | 38 | if (this.showComment) { |
| 19 | - PlayerCommentView() | 39 | + // PlayerCommentView() |
| 40 | + OperRowListView({ | ||
| 41 | + pageComponentType: 1, | ||
| 42 | + styleType: 3, | ||
| 43 | + componentType: 4, | ||
| 44 | + operationButtonList: ['comment',], | ||
| 45 | + contentDetailData: this.contentDetailData, | ||
| 46 | + publishCommentModel: this.publishCommentModel, | ||
| 47 | + showCommentIcon: false, | ||
| 48 | + onBack: () => { | ||
| 49 | + WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 50 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) | ||
| 51 | + } | ||
| 52 | + }) | ||
| 53 | + .padding({ | ||
| 54 | + bottom: -this.bottomSafeHeight + 'px' | ||
| 55 | + }) | ||
| 20 | } | 56 | } |
| 21 | } | 57 | } |
| 22 | .alignItems(HorizontalAlign.Start) | 58 | .alignItems(HorizontalAlign.Start) |
| @@ -32,6 +32,7 @@ export struct PlayerRightView { | @@ -32,6 +32,7 @@ export struct PlayerRightView { | ||
| 32 | @Consume isOpenDetail: boolean | 32 | @Consume isOpenDetail: boolean |
| 33 | @Consume isDragging: boolean | 33 | @Consume isDragging: boolean |
| 34 | @Consume showComment?: boolean | 34 | @Consume showComment?: boolean |
| 35 | + @Consume showCommentList: boolean | ||
| 35 | @State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 36 | @State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 36 | 37 | ||
| 37 | aboutToAppear() { | 38 | aboutToAppear() { |
| @@ -343,7 +344,8 @@ export struct PlayerRightView { | @@ -343,7 +344,8 @@ export struct PlayerRightView { | ||
| 343 | } | 344 | } |
| 344 | .margin({ bottom: 20 }) | 345 | .margin({ bottom: 20 }) |
| 345 | .onClick((event: ClickEvent) => { | 346 | .onClick((event: ClickEvent) => { |
| 346 | - ToastUtils.showToast('评论为公共方法,待开发', 1000); | 347 | + // ToastUtils.showToast('评论为公共方法,待开发', 1000); |
| 348 | + this.showCommentList = true | ||
| 347 | }) | 349 | }) |
| 348 | } | 350 | } |
| 349 | 351 |
| @@ -5,6 +5,14 @@ | @@ -5,6 +5,14 @@ | ||
| 5 | "value": "#FFFFFF" | 5 | "value": "#FFFFFF" |
| 6 | }, | 6 | }, |
| 7 | { | 7 | { |
| 8 | + "name": "color_transparent", | ||
| 9 | + "value": "#00000000" | ||
| 10 | + }, | ||
| 11 | + { | ||
| 12 | + "name": "color_222222", | ||
| 13 | + "value": "#222222" | ||
| 14 | + }, | ||
| 15 | + { | ||
| 8 | "name": "play_track_color", | 16 | "name": "play_track_color", |
| 9 | "value": "#1AFFFFFF" | 17 | "value": "#1AFFFFFF" |
| 10 | }, | 18 | }, |
| @@ -29,6 +37,18 @@ | @@ -29,6 +37,18 @@ | ||
| 29 | "value": "#4DFFFFFF" | 37 | "value": "#4DFFFFFF" |
| 30 | }, | 38 | }, |
| 31 | { | 39 | { |
| 40 | + "name": "color_666666", | ||
| 41 | + "value": "#666666" | ||
| 42 | + }, | ||
| 43 | + { | ||
| 44 | + "name": "color_B0B0B0", | ||
| 45 | + "value": "#B0B0B0" | ||
| 46 | + }, | ||
| 47 | + { | ||
| 48 | + "name": "color_EDEDED", | ||
| 49 | + "value": "#EDEDED" | ||
| 50 | + }, | ||
| 51 | + { | ||
| 32 | "name": "divider_color", | 52 | "name": "divider_color", |
| 33 | "value": "#D3D3D3" | 53 | "value": "#D3D3D3" |
| 34 | }, | 54 | }, |
| @@ -3,6 +3,22 @@ | @@ -3,6 +3,22 @@ | ||
| 3 | { | 3 | { |
| 4 | "name": "shared_desc", | 4 | "name": "shared_desc", |
| 5 | "value": "description" | 5 | "value": "description" |
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "name": "footer_text", | ||
| 9 | + "value": "已显示全部内容" | ||
| 10 | + }, | ||
| 11 | + { | ||
| 12 | + "name": "pull_up_load_text", | ||
| 13 | + "value": "加载中..." | ||
| 14 | + }, | ||
| 15 | + { | ||
| 16 | + "name": "pull_down_refresh_text", | ||
| 17 | + "value": "下拉刷新" | ||
| 18 | + }, | ||
| 19 | + { | ||
| 20 | + "name": "release_refresh_text", | ||
| 21 | + "value": "松开刷新" | ||
| 6 | } | 22 | } |
| 7 | ] | 23 | ] |
| 8 | } | 24 | } |
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/comment_hyphen.png
0 → 100644
244 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/comment_hyphen_block.png
0 → 100644
242 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/comment_icon.png
0 → 100644
1.05 KB
934 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/comment_icon_white.png
0 → 100644
866 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/comment_icon_zhiding.png
0 → 100644
2.7 KB
2.5 KB
1.75 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/comment_pickUp.png
0 → 100644
354 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/comment_reply.png
0 → 100644
333 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/comment_rmh_tag.png
0 → 100644
2.01 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/comment_unfold.png
0 → 100644
373 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/default_head.png
0 → 100644
4.9 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_close.png
deleted
100644 → 0
908 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_close_black.png
0 → 100644
1.03 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_close_white.png
0 → 100644
980 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_collect_check1.png
0 → 100644
2.19 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_like_back.png
0 → 100644
617 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_pull_down_refresh.png
0 → 100644
1.88 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_pull_up_load.gif
0 → 100644
1.75 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_arrow_left.png
0 → 100644
734 Bytes
570 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_like_default.png
0 → 100644
1.15 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/icon_listen.png
0 → 100644
1.67 KB
3.21 KB
2.41 KB
2.65 KB
1.89 KB
487 Bytes
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/wdInput_delete.png
0 → 100644
1.58 KB
| @@ -2,7 +2,10 @@ import HuaweiAuth from './utils/HuaweiAuth' | @@ -2,7 +2,10 @@ import HuaweiAuth from './utils/HuaweiAuth' | ||
| 2 | import { JumpInterceptorAction, RouterJumpInterceptor, WDRouterPage } from 'wdRouter' | 2 | import { JumpInterceptorAction, RouterJumpInterceptor, WDRouterPage } from 'wdRouter' |
| 3 | import { BusinessError } from '@kit.BasicServicesKit' | 3 | import { BusinessError } from '@kit.BasicServicesKit' |
| 4 | import { router } from '@kit.ArkUI' | 4 | import { router } from '@kit.ArkUI' |
| 5 | -import { AccountManagerUtils } from 'wdKit/Index' | 5 | +import { AccountManagerUtils, SPHelper } from 'wdKit/Index' |
| 6 | +import { LoginViewModel } from './pages/login/LoginViewModel' | ||
| 7 | +import { SpConstants } from 'wdConstant/Index' | ||
| 8 | +import { ReportDeviceInfo } from './reportDeviceInfo/ReportDeviceInfo' | ||
| 6 | 9 | ||
| 7 | class LoginJumpHandler implements JumpInterceptorAction { | 10 | class LoginJumpHandler implements JumpInterceptorAction { |
| 8 | 11 | ||
| @@ -37,4 +40,14 @@ export class LoginModule { | @@ -37,4 +40,14 @@ export class LoginModule { | ||
| 37 | } | 40 | } |
| 38 | 41 | ||
| 39 | } | 42 | } |
| 43 | + | ||
| 44 | + // 启动进入主页 和 每次登录成功调用 | ||
| 45 | + static reportDeviceInfo() { | ||
| 46 | + ReportDeviceInfo.reportDeviceInfo().then((res) => { | ||
| 47 | + let nickName = res.touristNickName | ||
| 48 | + if (res.touristNickName) { | ||
| 49 | + SPHelper.default.save(SpConstants.TOURIST_NICK_NAME, res.touristNickName) | ||
| 50 | + } | ||
| 51 | + }) | ||
| 52 | + } | ||
| 40 | } | 53 | } |
| @@ -82,6 +82,30 @@ export class LoginModel { | @@ -82,6 +82,30 @@ export class LoginModel { | ||
| 82 | }) | 82 | }) |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | + // loginType 0:手机号密码 2:手机号登录 3:QQ 4:微信 5:微博 6:APPLEID 7:手机号一键登录8:账号+密码 9:华为一键登录 | ||
| 86 | + thirdPartLogin(loginType: number, otherParams: Record<string, string|number>) { | ||
| 87 | + otherParams['loginType'] = loginType | ||
| 88 | + otherParams['deviceId'] = HttpUtils.getDeviceId() | ||
| 89 | + | ||
| 90 | + return new Promise<LoginBean>((success, fail) => { | ||
| 91 | + HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), otherParams).then((data: ResponseDTO<LoginBean>) => { | ||
| 92 | + Logger.debug("LoginViewModel:success2 ", data.message) | ||
| 93 | + if (!data) { | ||
| 94 | + fail("数据为空") | ||
| 95 | + return | ||
| 96 | + } | ||
| 97 | + if (!data.data||data.code != 0) { | ||
| 98 | + fail(data.message) | ||
| 99 | + return | ||
| 100 | + } | ||
| 101 | + success(data.data) | ||
| 102 | + }, (error: Error) => { | ||
| 103 | + fail(error.message) | ||
| 104 | + Logger.debug("LoginViewModel:error2 ", error.toString()) | ||
| 105 | + }) | ||
| 106 | + }) | ||
| 107 | + } | ||
| 108 | + | ||
| 85 | // {"password":"523acd319228efde34e8a30268ee8ca5e4fc421d72affa531676e1765940d22c","phone":"13625644528","loginType":0,"oldPassword":"BA5FD74F827AF9B271FE17CADC489C36","deviceId":"60da5af6-9c59-3566-8622-8c6c00710994"} | 109 | // {"password":"523acd319228efde34e8a30268ee8ca5e4fc421d72affa531676e1765940d22c","phone":"13625644528","loginType":0,"oldPassword":"BA5FD74F827AF9B271FE17CADC489C36","deviceId":"60da5af6-9c59-3566-8622-8c6c00710994"} |
| 86 | appLoginByPassword(phone: string, loginType: number, password: string, oldPassword: string) { | 110 | appLoginByPassword(phone: string, loginType: number, password: string, oldPassword: string) { |
| 87 | let bean: Record<string, string | number> = {}; | 111 | let bean: Record<string, string | number> = {}; |
| @@ -407,14 +407,9 @@ struct LoginPage { | @@ -407,14 +407,9 @@ struct LoginPage { | ||
| 407 | 407 | ||
| 408 | queryUserDetail(){ | 408 | queryUserDetail(){ |
| 409 | this.loginViewModel.queryUserDetail().then(()=>{ | 409 | this.loginViewModel.queryUserDetail().then(()=>{ |
| 410 | - router.back({ | ||
| 411 | - url: `${WDRouterPage.getBundleInfo()}` | ||
| 412 | - } | ||
| 413 | - ) | 410 | + router.back() |
| 414 | }).catch(()=>{ | 411 | }).catch(()=>{ |
| 415 | - router.back({ | ||
| 416 | - url: `${WDRouterPage.getBundleInfo()}` | ||
| 417 | - }) | 412 | + router.back() |
| 418 | }) | 413 | }) |
| 419 | } | 414 | } |
| 420 | 415 |
| @@ -10,6 +10,7 @@ import { encryptMessage } from '../../utils/cryptoUtil' | @@ -10,6 +10,7 @@ import { encryptMessage } from '../../utils/cryptoUtil' | ||
| 10 | import { SpConstants } from 'wdConstant/Index' | 10 | import { SpConstants } from 'wdConstant/Index' |
| 11 | import { UserDetail } from 'wdBean/Index'; | 11 | import { UserDetail } from 'wdBean/Index'; |
| 12 | import { HttpUtils } from 'wdNetwork/Index' | 12 | import { HttpUtils } from 'wdNetwork/Index' |
| 13 | +import { LoginModule } from '../../LoginModule' | ||
| 13 | 14 | ||
| 14 | const TAG = "LoginViewModel" | 15 | const TAG = "LoginViewModel" |
| 15 | 16 | ||
| @@ -47,15 +48,7 @@ export class LoginViewModel { | @@ -47,15 +48,7 @@ export class LoginViewModel { | ||
| 47 | 48 | ||
| 48 | return new Promise<LoginBean>((success, fail) => { | 49 | return new Promise<LoginBean>((success, fail) => { |
| 49 | this.loginModel.appLogin(phone, loginType, verificationCode).then((data: LoginBean) => { | 50 | this.loginModel.appLogin(phone, loginType, verificationCode).then((data: LoginBean) => { |
| 50 | - SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, data.firstMark) | ||
| 51 | - SPHelper.default.saveSync(SpConstants.USER_ID, data.id) | ||
| 52 | - SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken) | ||
| 53 | - SPHelper.default.saveSync(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, data.longTimeNoLoginMark) | ||
| 54 | - SPHelper.default.saveSync(SpConstants.USER_REFRESH_TOKEN, data.refreshToken) | ||
| 55 | - SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status) | ||
| 56 | - SPHelper.default.saveSync(SpConstants.USER_Type, data.userType) | ||
| 57 | - SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) | ||
| 58 | - EmitterUtils.sendEmptyEvent(EmitterEventId.LOGIN_SUCCESS) | 51 | + this.dealWithLoginSuccess(data) |
| 59 | success(data) | 52 | success(data) |
| 60 | }).catch((error:string) => { | 53 | }).catch((error:string) => { |
| 61 | fail(error) | 54 | fail(error) |
| @@ -63,6 +56,32 @@ export class LoginViewModel { | @@ -63,6 +56,32 @@ export class LoginViewModel { | ||
| 63 | }) | 56 | }) |
| 64 | } | 57 | } |
| 65 | 58 | ||
| 59 | + huaweiOneKeyLogin(authCode: string) { | ||
| 60 | + return new Promise<LoginBean>((success, fail) => { | ||
| 61 | + this.loginModel.thirdPartLogin(9, {"idToken": authCode}).then((data: LoginBean) => { | ||
| 62 | + this.dealWithLoginSuccess(data) | ||
| 63 | + success(data) | ||
| 64 | + }).catch((error:string) => { | ||
| 65 | + fail(error) | ||
| 66 | + }) | ||
| 67 | + }) | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + //TODO: 这里要整体改掉 | ||
| 71 | + dealWithLoginSuccess(data: LoginBean) { | ||
| 72 | + SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, data.firstMark) | ||
| 73 | + SPHelper.default.saveSync(SpConstants.USER_ID, data.id) | ||
| 74 | + SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken) | ||
| 75 | + SPHelper.default.saveSync(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, data.longTimeNoLoginMark) | ||
| 76 | + SPHelper.default.saveSync(SpConstants.USER_REFRESH_TOKEN, data.refreshToken) | ||
| 77 | + SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status) | ||
| 78 | + SPHelper.default.saveSync(SpConstants.USER_Type, data.userType) | ||
| 79 | + SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) | ||
| 80 | + EmitterUtils.sendEmptyEvent(EmitterEventId.LOGIN_SUCCESS) | ||
| 81 | + | ||
| 82 | + LoginModule.reportDeviceInfo() | ||
| 83 | + } | ||
| 84 | + | ||
| 66 | async appLoginByPassword(phone: string, loginType: number, password: string, oldPassword: string) { | 85 | async appLoginByPassword(phone: string, loginType: number, password: string, oldPassword: string) { |
| 67 | let newLoginType: number | 86 | let newLoginType: number |
| 68 | let isPhone = this.verifyIsPhoneNumber(phone) | 87 | let isPhone = this.verifyIsPhoneNumber(phone) |
| @@ -75,15 +94,7 @@ export class LoginViewModel { | @@ -75,15 +94,7 @@ export class LoginViewModel { | ||
| 75 | let passwordNew = await this.doMd(password) | 94 | let passwordNew = await this.doMd(password) |
| 76 | Logger.debug(TAG, "PASSWORD:" + passwordNew) | 95 | Logger.debug(TAG, "PASSWORD:" + passwordNew) |
| 77 | this.loginModel.appLoginByPassword(phone, newLoginType, passwordNew, oldPassword).then((data: LoginBean) => { | 96 | this.loginModel.appLoginByPassword(phone, newLoginType, passwordNew, oldPassword).then((data: LoginBean) => { |
| 78 | - SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, data.firstMark) | ||
| 79 | - SPHelper.default.saveSync(SpConstants.USER_ID, data.id) | ||
| 80 | - SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken) | ||
| 81 | - SPHelper.default.saveSync(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, data.longTimeNoLoginMark) | ||
| 82 | - SPHelper.default.saveSync(SpConstants.USER_REFRESH_TOKEN, data.refreshToken) | ||
| 83 | - SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status) | ||
| 84 | - SPHelper.default.saveSync(SpConstants.USER_Type, data.userType) | ||
| 85 | - SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) | ||
| 86 | - EmitterUtils.sendEmptyEvent(EmitterEventId.LOGIN_SUCCESS) | 97 | + this.dealWithLoginSuccess(data) |
| 87 | success(data) | 98 | success(data) |
| 88 | }).catch((value: string) => { | 99 | }).catch((value: string) => { |
| 89 | fail(value) | 100 | fail(value) |
| @@ -219,18 +230,29 @@ export class LoginViewModel { | @@ -219,18 +230,29 @@ export class LoginViewModel { | ||
| 219 | this.loginModel.queryUserDetail().then((data: UserDetail) => { | 230 | this.loginModel.queryUserDetail().then((data: UserDetail) => { |
| 220 | //保存sp | 231 | //保存sp |
| 221 | if(data){ | 232 | if(data){ |
| 222 | - SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) | ||
| 223 | - SPHelper.default.saveSync(SpConstants.USER_PHONE, data.phone) | 233 | + if(data.userName!=undefined){ |
| 234 | + SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) | ||
| 235 | + } | ||
| 236 | + if(data.phone!=undefined){ | ||
| 237 | + SPHelper.default.saveSync(SpConstants.USER_PHONE, data.phone) | ||
| 238 | + } | ||
| 224 | } | 239 | } |
| 225 | if(data.userExtend){ | 240 | if(data.userExtend){ |
| 226 | - SPHelper.default.saveSync(SpConstants.USER_SEX, data.userExtend.sex) | ||
| 227 | - SPHelper.default.saveSync(SpConstants.USER_CREATOR_ID, data.userExtend.creatorId+"") | ||
| 228 | - SPHelper.default.saveSync(SpConstants.USER_HEAD_PHOTO_URL, data.userExtend.headPhotoUrl) | ||
| 229 | - SPHelper.default.saveSync(SpConstants.USER_BIRTHDAY, data.userExtend.birthday) | 241 | + if(data.userExtend.sex!=undefined){ |
| 242 | + SPHelper.default.saveSync(SpConstants.USER_SEX, data.userExtend.sex) | ||
| 243 | + } | ||
| 244 | + if(data.userExtend.creatorId!=undefined){ | ||
| 245 | + SPHelper.default.saveSync(SpConstants.USER_CREATOR_ID, data.userExtend.creatorId+"") | ||
| 246 | + } | ||
| 247 | + if(data.userExtend.headPhotoUrl!=undefined){ | ||
| 248 | + SPHelper.default.saveSync(SpConstants.USER_HEAD_PHOTO_URL, data.userExtend.headPhotoUrl) | ||
| 249 | + } | ||
| 250 | + if(data.userExtend.birthday!=undefined){ | ||
| 251 | + SPHelper.default.saveSync(SpConstants.USER_BIRTHDAY, data.userExtend.birthday) | ||
| 252 | + } | ||
| 230 | } | 253 | } |
| 231 | - | ||
| 232 | success(data) | 254 | success(data) |
| 233 | - }).catch(() => { | 255 | + }).catch((error:Error) => { |
| 234 | fail() | 256 | fail() |
| 235 | }) | 257 | }) |
| 236 | }) | 258 | }) |
| @@ -3,13 +3,30 @@ import { Params } from 'wdBean/Index' | @@ -3,13 +3,30 @@ import { Params } from 'wdBean/Index' | ||
| 3 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | 3 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' |
| 4 | import HuaweiAuth from '../../utils/HuaweiAuth' | 4 | import HuaweiAuth from '../../utils/HuaweiAuth' |
| 5 | import { BusinessError } from '@kit.BasicServicesKit' | 5 | import { BusinessError } from '@kit.BasicServicesKit' |
| 6 | -import { ToastUtils } from 'wdKit/Index' | 6 | +import { Logger, ToastUtils, CustomToast, EmitterUtils, EmitterEventId } from 'wdKit/Index' |
| 7 | +import { LoginViewModel } from './LoginViewModel' | ||
| 8 | +import {InterestsHobbiesModel} from '../../../../../../../products/phone/src/main/ets/pages/viewModel/InterestsHobbiesModel' | ||
| 9 | + | ||
| 10 | +const TAG = "OneKeyLoginPage" | ||
| 7 | 11 | ||
| 8 | @Entry | 12 | @Entry |
| 9 | @Component | 13 | @Component |
| 10 | struct OneKeyLoginPage { | 14 | struct OneKeyLoginPage { |
| 11 | anonymousPhone: string = '' | 15 | anonymousPhone: string = '' |
| 12 | @State agreeProtocol: boolean = false | 16 | @State agreeProtocol: boolean = false |
| 17 | + viewModel: LoginViewModel = new LoginViewModel() | ||
| 18 | + @State toastText:string = "" | ||
| 19 | + dialogToast: CustomDialogController = new CustomDialogController({ | ||
| 20 | + builder: CustomToast({ | ||
| 21 | + msg: this.toastText, | ||
| 22 | + }), | ||
| 23 | + autoCancel: false, | ||
| 24 | + alignment: DialogAlignment.Center, | ||
| 25 | + offset: { dx: 0, dy: -20 }, | ||
| 26 | + gridCount: 1, | ||
| 27 | + customStyle: true, | ||
| 28 | + maskColor:"#00000000" | ||
| 29 | + }) | ||
| 13 | 30 | ||
| 14 | aboutToAppear(): void { | 31 | aboutToAppear(): void { |
| 15 | this.anonymousPhone = HuaweiAuth.sharedInstance().anonymousPhone||"" | 32 | this.anonymousPhone = HuaweiAuth.sharedInstance().anonymousPhone||"" |
| @@ -44,17 +61,7 @@ struct OneKeyLoginPage { | @@ -44,17 +61,7 @@ struct OneKeyLoginPage { | ||
| 44 | if (!this.agreeProtocol) { | 61 | if (!this.agreeProtocol) { |
| 45 | return | 62 | return |
| 46 | } | 63 | } |
| 47 | - HuaweiAuth.sharedInstance().oneKeyLogin().then((authorizeCode) => { | ||
| 48 | - //TODO: 调用服务端接口登录 | ||
| 49 | - | ||
| 50 | - ToastUtils.shortToast("获取到授权code: " + authorizeCode + ",由于需要后台接口支持,暂时先跳转其他登录方式") | ||
| 51 | - setTimeout(() => { | ||
| 52 | - router.replaceUrl({url: WDRouterPage.loginPage.url()}) | ||
| 53 | - }, 3000) | ||
| 54 | - | ||
| 55 | - }).catch((error: BusinessError) => { | ||
| 56 | - | ||
| 57 | - }) | 64 | + this.requestLogin() |
| 58 | }) | 65 | }) |
| 59 | } | 66 | } |
| 60 | .padding({ left: 25, right: 25 }) | 67 | .padding({ left: 25, right: 25 }) |
| @@ -113,4 +120,47 @@ struct OneKeyLoginPage { | @@ -113,4 +120,47 @@ struct OneKeyLoginPage { | ||
| 113 | }.margin({ top: 15, right: 15 }) | 120 | }.margin({ top: 15, right: 15 }) |
| 114 | .width("100%") | 121 | .width("100%") |
| 115 | } | 122 | } |
| 123 | + | ||
| 124 | + async requestLogin() { | ||
| 125 | + try { | ||
| 126 | + let authorizeCode = await HuaweiAuth.sharedInstance().oneKeyLogin() | ||
| 127 | + | ||
| 128 | + let data = await this.viewModel.huaweiOneKeyLogin(authorizeCode) | ||
| 129 | + | ||
| 130 | + Logger.debug(TAG, "requestLogin: " + data.jwtToken) | ||
| 131 | + this.showToastTip('登录成功') | ||
| 132 | + | ||
| 133 | + ///同步兴趣tag | ||
| 134 | + let interestsModel = new InterestsHobbiesModel() | ||
| 135 | + interestsModel.updateInterests() | ||
| 136 | + this.queryUserDetail() | ||
| 137 | + EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION) | ||
| 138 | + | ||
| 139 | + } catch (error) { | ||
| 140 | + if (typeof error == "string") { | ||
| 141 | + this.showToastTip(error) | ||
| 142 | + } else { | ||
| 143 | + (error as BusinessError) | ||
| 144 | + this.showToastTip("登录失败") | ||
| 145 | + } | ||
| 146 | + } | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + showToastTip(msg:string){ | ||
| 150 | + this.toastText = msg | ||
| 151 | + this.dialogToast.open() | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + queryUserDetail(){ | ||
| 155 | + this.viewModel.queryUserDetail().then(()=>{ | ||
| 156 | + router.back({ | ||
| 157 | + url: `${WDRouterPage.getBundleInfo()}` | ||
| 158 | + } | ||
| 159 | + ) | ||
| 160 | + }).catch(()=>{ | ||
| 161 | + router.back({ | ||
| 162 | + url: `${WDRouterPage.getBundleInfo()}` | ||
| 163 | + }) | ||
| 164 | + }) | ||
| 165 | + } | ||
| 116 | } | 166 | } |
| 1 | +import { AppUtils, DeviceUtil, Logger, UserDataLocal } from 'wdKit/Index'; | ||
| 2 | +import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index'; | ||
| 3 | + | ||
| 4 | +export class ReportDeviceInfo { | ||
| 5 | + static reportDeviceInfo() { | ||
| 6 | + const userId = UserDataLocal.getUserId() || "" | ||
| 7 | + const url = HttpUrlUtils.reportDeviceInfo() | ||
| 8 | + | ||
| 9 | + let bean: Record<string, string | number> = {}; | ||
| 10 | + bean['deviceId'] = DeviceUtil.clientId() | ||
| 11 | + bean['appVersion'] = AppUtils.getAppVersionCode() | ||
| 12 | + bean['platform'] = 3 /// 1Android 2iOS | ||
| 13 | + bean['userId'] = userId | ||
| 14 | + bean['brand'] = DeviceUtil.getMarketName() | ||
| 15 | + bean['modelSystemVersion'] = DeviceUtil.getDisplayVersion() | ||
| 16 | + bean['tenancy'] = 3 ///1-视界 2-英文版 3-中文版 | ||
| 17 | + | ||
| 18 | + return new Promise<ReportDeviceInfoRes>((success, fail) => { | ||
| 19 | + HttpBizUtil.post<ResponseDTO<ReportDeviceInfoRes>>(url,bean).then((data: ResponseDTO<ReportDeviceInfoRes>) => { | ||
| 20 | + if (!data) { | ||
| 21 | + fail("数据为空") | ||
| 22 | + return | ||
| 23 | + } | ||
| 24 | + if (data.code != 0) { | ||
| 25 | + fail(data.message) | ||
| 26 | + return | ||
| 27 | + } | ||
| 28 | + success(data.data!) | ||
| 29 | + }, (error: Error) => { | ||
| 30 | + fail(error.message) | ||
| 31 | + Logger.debug("ReportDeviceInfo", error.toString()) | ||
| 32 | + }) | ||
| 33 | + }) | ||
| 34 | + | ||
| 35 | + } | ||
| 36 | +} | ||
| 37 | + | ||
| 38 | +export class ReportDeviceInfoRes { | ||
| 39 | + clean : number = 0 | ||
| 40 | + touristNickName : string = "" | ||
| 41 | +} |
| @@ -94,10 +94,9 @@ export struct WDPlayerRenderView { | @@ -94,10 +94,9 @@ export struct WDPlayerRenderView { | ||
| 94 | .renderFit(RenderFit.RESIZE_COVER) | 94 | .renderFit(RenderFit.RESIZE_COVER) |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | - // .onAreaChange(() => { | ||
| 98 | - // this.updateLayout() | ||
| 99 | - // }) | ||
| 100 | - | 97 | + .onAreaChange(() => { |
| 98 | + this.updateLayout() | ||
| 99 | + }) | ||
| 101 | .backgroundColor("#000000") | 100 | .backgroundColor("#000000") |
| 102 | 101 | ||
| 103 | // .height('100%') | 102 | // .height('100%') |
| @@ -4,21 +4,7 @@ import UIAbility from '@ohos.app.ability.UIAbility'; | @@ -4,21 +4,7 @@ import UIAbility from '@ohos.app.ability.UIAbility'; | ||
| 4 | import Want from '@ohos.app.ability.Want'; | 4 | import Want from '@ohos.app.ability.Want'; |
| 5 | import window from '@ohos.window'; | 5 | import window from '@ohos.window'; |
| 6 | import { BusinessError } from '@ohos.base'; | 6 | import { BusinessError } from '@ohos.base'; |
| 7 | -import { registerRouter } from 'wdRouter'; | ||
| 8 | -import { | ||
| 9 | - EmitterEventId, | ||
| 10 | - EmitterUtils, | ||
| 11 | - Logger, | ||
| 12 | - MpaasUtils, | ||
| 13 | - NetworkManager, | ||
| 14 | - NetworkType, | ||
| 15 | - SPHelper, | ||
| 16 | - StringUtils, | ||
| 17 | - UmengStats, | ||
| 18 | - WindowModel | ||
| 19 | -} from 'wdKit'; | ||
| 20 | -import { HostEnum, HostManager, WDHttp } from 'wdNetwork'; | ||
| 21 | -import { LoginModule } from 'wdLogin/src/main/ets/LoginModule'; | 7 | +import { EmitterEventId, EmitterUtils, WindowModel } from 'wdKit'; |
| 22 | import { ConfigurationConstant } from '@kit.AbilityKit'; | 8 | import { ConfigurationConstant } from '@kit.AbilityKit'; |
| 23 | import { WDPushNotificationManager } from 'wdHwAbility/Index'; | 9 | import { WDPushNotificationManager } from 'wdHwAbility/Index'; |
| 24 | import { StartupManager } from '../startupmanager/StartupManager'; | 10 | import { StartupManager } from '../startupmanager/StartupManager'; |
| @@ -60,7 +46,7 @@ export default class EntryAbility extends UIAbility { | @@ -60,7 +46,7 @@ export default class EntryAbility extends UIAbility { | ||
| 60 | AppStorage.setOrCreate('topSafeHeight', topSafeHeight); | 46 | AppStorage.setOrCreate('topSafeHeight', topSafeHeight); |
| 61 | AppStorage.setOrCreate('windowWidth', width); | 47 | AppStorage.setOrCreate('windowWidth', width); |
| 62 | AppStorage.setOrCreate('windowHeight', height); | 48 | AppStorage.setOrCreate('windowHeight', height); |
| 63 | - let audioWidth = px2vp(width)*0.65 | 49 | + let audioWidth = px2vp(width) * 0.65 |
| 64 | console.info('floatWindowClass audioWidth' + audioWidth); | 50 | console.info('floatWindowClass audioWidth' + audioWidth); |
| 65 | 51 | ||
| 66 | 52 | ||
| @@ -71,7 +57,8 @@ export default class EntryAbility extends UIAbility { | @@ -71,7 +57,8 @@ export default class EntryAbility extends UIAbility { | ||
| 71 | hilog.info(0x0000, 'testTag', 'setPreferredOrientation Succeeded'); | 57 | hilog.info(0x0000, 'testTag', 'setPreferredOrientation Succeeded'); |
| 72 | }) | 58 | }) |
| 73 | .catch((err: Error) => { | 59 | .catch((err: Error) => { |
| 74 | - hilog.error(0x0000, 'testTag', `setPreferredOrientation catch, error error.name : ${err.name}, error.message:${err.message}`); | 60 | + hilog.error(0x0000, 'testTag', |
| 61 | + `setPreferredOrientation catch, error error.name : ${err.name}, error.message:${err.message}`); | ||
| 75 | }) | 62 | }) |
| 76 | //../../../../../../features/wdLogin/src/main/ets/pages/launchPage/LaunchPage | 63 | //../../../../../../features/wdLogin/src/main/ets/pages/launchPage/LaunchPage |
| 77 | windowStage.loadContent('pages/launchPage/LaunchPage', (err, data) => { | 64 | windowStage.loadContent('pages/launchPage/LaunchPage', (err, data) => { |
| @@ -16,12 +16,15 @@ struct ImageAndTextDetailPage { | @@ -16,12 +16,15 @@ struct ImageAndTextDetailPage { | ||
| 16 | } | 16 | } |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | - pageTransition(){ | ||
| 20 | - // 定义页面进入时的效果,从右边侧滑入 | ||
| 21 | - PageTransitionEnter({ type: RouteType.None, duration: 300 }) | 19 | + pageTransition() { |
| 20 | + // 为目标页面时,进入:从右边侧滑入,退出:是右侧划出;跳转别的页面:左侧划出,返回:左侧划入。 | ||
| 21 | + PageTransitionEnter({ type: RouteType.Push, duration: 300 }) | ||
| 22 | .slide(SlideEffect.Right) | 22 | .slide(SlideEffect.Right) |
| 23 | - // 定义页面退出时的效果,向右边侧滑出 | ||
| 24 | - PageTransitionExit({ type: RouteType.None, duration: 300 }) | 23 | + PageTransitionEnter({ type: RouteType.Pop, duration: 300 }) |
| 24 | + .slide(SlideEffect.Left) | ||
| 25 | + PageTransitionExit({ type: RouteType.Push, duration: 300 }) | ||
| 26 | + .slide(SlideEffect.Left) | ||
| 27 | + PageTransitionExit({ type: RouteType.Pop, duration: 300 }) | ||
| 25 | .slide(SlideEffect.Right) | 28 | .slide(SlideEffect.Right) |
| 26 | } | 29 | } |
| 27 | 30 |
| @@ -3,11 +3,12 @@ import { BreakpointConstants } from 'wdConstant'; | @@ -3,11 +3,12 @@ import { BreakpointConstants } from 'wdConstant'; | ||
| 3 | 3 | ||
| 4 | import { HWLocationUtils, WDPushNotificationManager } from 'wdHwAbility/Index'; | 4 | import { HWLocationUtils, WDPushNotificationManager } from 'wdHwAbility/Index'; |
| 5 | import { common } from '@kit.AbilityKit'; | 5 | import { common } from '@kit.AbilityKit'; |
| 6 | -import { BreakpointSystem, EmitterEventId, EmitterUtils, Logger, MpaasUpgradeCheck } from 'wdKit'; | ||
| 7 | -import router from '@ohos.router'; | ||
| 8 | -import { promptAction } from '@kit.ArkUI'; | 6 | +import { BreakpointSystem, EmitterEventId, EmitterUtils, Logger, MpaasUpgradeCheck, WindowModel } from 'wdKit'; |
| 7 | +import { promptAction, window } from '@kit.ArkUI'; | ||
| 9 | import { UpgradeTipDialog } from "./upgradePage/UpgradeTipDialog" | 8 | import { UpgradeTipDialog } from "./upgradePage/UpgradeTipDialog" |
| 10 | import { ProcessUtils } from 'wdRouter/Index'; | 9 | import { ProcessUtils } from 'wdRouter/Index'; |
| 10 | +import { StartupManager } from '../startupmanager/StartupManager'; | ||
| 11 | +import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 11 | 12 | ||
| 12 | const TAG = 'MainPage'; | 13 | const TAG = 'MainPage'; |
| 13 | 14 | ||
| @@ -17,7 +18,8 @@ struct MainPage { | @@ -17,7 +18,8 @@ struct MainPage { | ||
| 17 | @Provide pageShow: number = -1 | 18 | @Provide pageShow: number = -1 |
| 18 | @Provide pageHide: number = -1 | 19 | @Provide pageHide: number = -1 |
| 19 | private breakpointSystem: BreakpointSystem = new BreakpointSystem() | 20 | private breakpointSystem: BreakpointSystem = new BreakpointSystem() |
| 20 | - @StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS; | 21 | + @StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = |
| 22 | + BreakpointConstants.BREAKPOINT_XS; | ||
| 21 | @State isPermission: boolean = false | 23 | @State isPermission: boolean = false |
| 22 | upgradeDialogController?: CustomDialogController | 24 | upgradeDialogController?: CustomDialogController |
| 23 | 25 | ||
| @@ -27,6 +29,8 @@ struct MainPage { | @@ -27,6 +29,8 @@ struct MainPage { | ||
| 27 | 29 | ||
| 28 | aboutToAppear() { | 30 | aboutToAppear() { |
| 29 | 31 | ||
| 32 | + StartupManager.sharedInstance().appReachMainPage() | ||
| 33 | + | ||
| 30 | this.breakpointSystem.register() | 34 | this.breakpointSystem.register() |
| 31 | 35 | ||
| 32 | let context = getContext(this) as common.UIAbilityContext | 36 | let context = getContext(this) as common.UIAbilityContext |
| @@ -44,7 +48,7 @@ struct MainPage { | @@ -44,7 +48,7 @@ struct MainPage { | ||
| 44 | LogoutViewModel.clearLoginInfo() | 48 | LogoutViewModel.clearLoginInfo() |
| 45 | }) | 49 | }) |
| 46 | EmitterUtils.receiveEvent(EmitterEventId.LOCATION, () => { | 50 | EmitterUtils.receiveEvent(EmitterEventId.LOCATION, () => { |
| 47 | - this.isPermission=true | 51 | + this.isPermission = true |
| 48 | }) | 52 | }) |
| 49 | } | 53 | } |
| 50 | 54 | ||
| @@ -78,7 +82,7 @@ struct MainPage { | @@ -78,7 +82,7 @@ struct MainPage { | ||
| 78 | 82 | ||
| 79 | this.upgradeDialogController = new CustomDialogController({ | 83 | this.upgradeDialogController = new CustomDialogController({ |
| 80 | builder: UpgradeTipDialog({ | 84 | builder: UpgradeTipDialog({ |
| 81 | - tipContent:data, | 85 | + tipContent: data, |
| 82 | confirm: () => { | 86 | confirm: () => { |
| 83 | ProcessUtils.jumpExternalWebPage(data.downloadUrl); | 87 | ProcessUtils.jumpExternalWebPage(data.downloadUrl); |
| 84 | } | 88 | } |
| @@ -101,12 +105,26 @@ struct MainPage { | @@ -101,12 +105,26 @@ struct MainPage { | ||
| 101 | 105 | ||
| 102 | onBackPress() { | 106 | onBackPress() { |
| 103 | Logger.info(TAG, 'onBackPress'); | 107 | Logger.info(TAG, 'onBackPress'); |
| 108 | + try { | ||
| 109 | + // 拦截返回键,切到后台 | ||
| 110 | + const windowClass = WindowModel.shared.getWindowClass() as window.Window | ||
| 111 | + windowClass.minimize().then(() => { | ||
| 112 | + Logger.debug(TAG, 'Succeeded in minimizing the window.'); | ||
| 113 | + }).catch((err: BusinessError) => { | ||
| 114 | + Logger.error(TAG, 'Failed to minimize the window. Cause: ' + JSON.stringify(err)); | ||
| 115 | + return false | ||
| 116 | + }); | ||
| 117 | + } catch (err) { | ||
| 118 | + Logger.error(TAG, 'Failed to minimize: ' + JSON.stringify(err)); | ||
| 119 | + return false | ||
| 120 | + } | ||
| 121 | + return true | ||
| 104 | } | 122 | } |
| 105 | 123 | ||
| 106 | build() { | 124 | build() { |
| 107 | - Stack({alignContent:Alignment.Top}) { | 125 | + Stack({ alignContent: Alignment.Top }) { |
| 108 | BottomNavigationComponent() | 126 | BottomNavigationComponent() |
| 109 | - if(this.isPermission){ | 127 | + if (this.isPermission) { |
| 110 | PermissionDesComponent() | 128 | PermissionDesComponent() |
| 111 | } | 129 | } |
| 112 | } | 130 | } |
| @@ -18,11 +18,14 @@ struct SpacialTopicPage { | @@ -18,11 +18,14 @@ struct SpacialTopicPage { | ||
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | pageTransition() { | 20 | pageTransition() { |
| 21 | - // 定义页面进入时的效果,从右边侧滑入 | ||
| 22 | - PageTransitionEnter({ type: RouteType.None, duration: 300 }) | 21 | + // 为目标页面时,进入:从右边侧滑入,退出:是右侧划出;跳转别的页面:左侧划出,返回:左侧划入。 |
| 22 | + PageTransitionEnter({ type: RouteType.Push, duration: 300 }) | ||
| 23 | .slide(SlideEffect.Right) | 23 | .slide(SlideEffect.Right) |
| 24 | - // 定义页面退出时的效果,向右边侧滑出 | ||
| 25 | - PageTransitionExit({ type: RouteType.None, duration: 300 }) | 24 | + PageTransitionEnter({ type: RouteType.Pop, duration: 300 }) |
| 25 | + .slide(SlideEffect.Left) | ||
| 26 | + PageTransitionExit({ type: RouteType.Push, duration: 300 }) | ||
| 27 | + .slide(SlideEffect.Left) | ||
| 28 | + PageTransitionExit({ type: RouteType.Pop, duration: 300 }) | ||
| 26 | .slide(SlideEffect.Right) | 29 | .slide(SlideEffect.Right) |
| 27 | } | 30 | } |
| 28 | 31 |
| @@ -70,7 +70,7 @@ struct LaunchInterestsHobbiesPage { | @@ -70,7 +70,7 @@ struct LaunchInterestsHobbiesPage { | ||
| 70 | .width('100%') | 70 | .width('100%') |
| 71 | .height('100%') | 71 | .height('100%') |
| 72 | .backgroundColor(Color.Gray) | 72 | .backgroundColor(Color.Gray) |
| 73 | - .opacity(item.choose?0.7:0) | 73 | + .opacity(item.choose?0.85:0) |
| 74 | .borderRadius(5) | 74 | .borderRadius(5) |
| 75 | } | 75 | } |
| 76 | 76 | ||
| @@ -134,7 +134,7 @@ struct LaunchInterestsHobbiesPage { | @@ -134,7 +134,7 @@ struct LaunchInterestsHobbiesPage { | ||
| 134 | .width('662lpx') | 134 | .width('662lpx') |
| 135 | .height('84lpx') | 135 | .height('84lpx') |
| 136 | .backgroundColor(Color.White) | 136 | .backgroundColor(Color.White) |
| 137 | - .opacity(this.selectCount == 0 ? 0.6 : 0) | 137 | + .opacity(this.selectCount == 0 ? 0.3 : 0) |
| 138 | .borderRadius('10lpx') | 138 | .borderRadius('10lpx') |
| 139 | .onClick(()=>{ | 139 | .onClick(()=>{ |
| 140 | if (this.selectCount == 0) { | 140 | if (this.selectCount == 0) { |
| @@ -90,6 +90,9 @@ export class StartupManager { | @@ -90,6 +90,9 @@ export class StartupManager { | ||
| 90 | appReachMainPage() : Promise<void> { | 90 | appReachMainPage() : Promise<void> { |
| 91 | return new Promise((resolve) => { | 91 | return new Promise((resolve) => { |
| 92 | Logger.debug(TAG, "App 进入首页,开始其他任务初始化") | 92 | Logger.debug(TAG, "App 进入首页,开始其他任务初始化") |
| 93 | + | ||
| 94 | + LoginModule.reportDeviceInfo() | ||
| 95 | + | ||
| 93 | //TODO: | 96 | //TODO: |
| 94 | 97 | ||
| 95 | resolve() | 98 | resolve() |
| @@ -132,18 +135,18 @@ export class StartupManager { | @@ -132,18 +135,18 @@ export class StartupManager { | ||
| 132 | private initNetwork() { | 135 | private initNetwork() { |
| 133 | Logger.debug(TAG, "App 网络 初始化") | 136 | Logger.debug(TAG, "App 网络 初始化") |
| 134 | WDHttp.initHttpHeader() | 137 | WDHttp.initHttpHeader() |
| 135 | - // 注册监听网络连接 | ||
| 136 | - EmitterUtils.receiveEvent(EmitterEventId.NETWORK_CONNECTED, ((str?: string) => { | ||
| 137 | - let type: NetworkType | null = null | ||
| 138 | - if (str) { | ||
| 139 | - type = JSON.parse(str) as NetworkType | ||
| 140 | - } | ||
| 141 | - Logger.info('network connected: ' + type?.toString()) | ||
| 142 | - })) | ||
| 143 | - // 注册监听网络断开 | ||
| 144 | - EmitterUtils.receiveEvent(EmitterEventId.NETWORK_DISCONNECTED, (() => { | ||
| 145 | - Logger.info('network disconnected') | ||
| 146 | - })) | 138 | + // 注册监听网络连接,没有实质业务意义,可删除 |
| 139 | + // EmitterUtils.receiveEvent(EmitterEventId.NETWORK_CONNECTED, ((str?: string) => { | ||
| 140 | + // let type: NetworkType | null = null | ||
| 141 | + // if (str) { | ||
| 142 | + // type = JSON.parse(str) as NetworkType | ||
| 143 | + // } | ||
| 144 | + // Logger.info('network connected: ' + type?.toString()) | ||
| 145 | + // })) | ||
| 146 | + // // 注册监听网络断开 | ||
| 147 | + // EmitterUtils.receiveEvent(EmitterEventId.NETWORK_DISCONNECTED, (() => { | ||
| 148 | + // Logger.info('network disconnected') | ||
| 149 | + // })) | ||
| 147 | } | 150 | } |
| 148 | 151 | ||
| 149 | private initCheckDeviceId() { | 152 | private initCheckDeviceId() { |
| 1 | +import { insightIntent, InsightIntentExecutor } from '@kit.AbilityKit'; | ||
| 2 | +import { window } from '@kit.ArkUI'; | ||
| 3 | +import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 意图调用 | ||
| 7 | + */ | ||
| 8 | +export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | ||
| 9 | + private static readonly ViewColumn = 'ViewColumn'; | ||
| 10 | + /** | ||
| 11 | + * override 执行前台UIAbility意图 | ||
| 12 | + * | ||
| 13 | + * @param name 意图名称 | ||
| 14 | + * @param param 意图参数 | ||
| 15 | + * @param pageLoader 窗口 | ||
| 16 | + * @returns 意图调用结果 | ||
| 17 | + */ | ||
| 18 | + onExecuteInUIAbilityForegroundMode(name: string, param: Record<string, Object>, pageLoader: window.WindowStage): | ||
| 19 | + Promise<insightIntent.ExecuteResult> { | ||
| 20 | + // 根据意图名称分发处理逻辑 | ||
| 21 | + switch (name) { | ||
| 22 | + case InsightIntentExecutorImpl.ViewColumn: | ||
| 23 | + return this.jumpToView(param, pageLoader); | ||
| 24 | + default: | ||
| 25 | + break; | ||
| 26 | + } | ||
| 27 | + return Promise.resolve({ | ||
| 28 | + code: -1, | ||
| 29 | + result: { | ||
| 30 | + message: 'unknown intent' | ||
| 31 | + } | ||
| 32 | + } as insightIntent.ExecuteResult) | ||
| 33 | + } | ||
| 34 | + /** | ||
| 35 | + * 实现跳转新闻页面功能 | ||
| 36 | + * | ||
| 37 | + * @param param 意图参数 | ||
| 38 | + * @param pageLoader 窗口 | ||
| 39 | + */ | ||
| 40 | + private jumpToView(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> { | ||
| 41 | + return new Promise((resolve, reject) => { | ||
| 42 | + // TODO 实现意图调用,loadContent的入参为歌曲落地页路径,例如:pages/SongPage | ||
| 43 | + pageLoader.loadContent('pages/MainPage') | ||
| 44 | + .then(() => { | ||
| 45 | + let entityId: string = (param.items as Array<object>)?.[0]?.['entityId']; | ||
| 46 | + // TODO 调用成功的情况,此处可以打印日志 | ||
| 47 | + resolve({ | ||
| 48 | + code: 0, | ||
| 49 | + result: { | ||
| 50 | + message: 'Intent execute success' | ||
| 51 | + } | ||
| 52 | + }); | ||
| 53 | + }) | ||
| 54 | + .catch((err: BusinessError) => { | ||
| 55 | + // TODO 调用失败的情况 | ||
| 56 | + resolve({ | ||
| 57 | + code: -1, | ||
| 58 | + result: { | ||
| 59 | + message: 'Intent execute failed' | ||
| 60 | + } | ||
| 61 | + }) | ||
| 62 | + }); | ||
| 63 | + }) | ||
| 64 | + } | ||
| 65 | +} |
| 1 | +{ | ||
| 2 | + "insightIntents": [ | ||
| 3 | + { | ||
| 4 | + "intentName": "ViewColumn", | ||
| 5 | + "domain": "", | ||
| 6 | + "intentVersion": "1.0.1", | ||
| 7 | + "srcEntry": "./ets/utils/InsightIntentExecutorImpl.ets", | ||
| 8 | + "uiAbility": { | ||
| 9 | + "ability": "EntryAbility", | ||
| 10 | + "executeMode": [ | ||
| 11 | + "background", | ||
| 12 | + "foreground" | ||
| 13 | + ] | ||
| 14 | + } | ||
| 15 | + } | ||
| 16 | + ] | ||
| 17 | +} |
-
Please register or login to post a comment