Merge remote-tracking branch 'origin/main'
# Conflicts: # sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets # sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card19Component.ets
Showing
84 changed files
with
2099 additions
and
751 deletions
Too many changes to show.
To preserve performance only 84 of 84+ files are displayed.
| @@ -20,6 +20,8 @@ export { WindowModel } from './src/main/ets/utils/WindowModel' | @@ -20,6 +20,8 @@ export { WindowModel } from './src/main/ets/utils/WindowModel' | ||
| 20 | 20 | ||
| 21 | export { SPHelper } from './src/main/ets/utils/SPHelper' | 21 | export { SPHelper } from './src/main/ets/utils/SPHelper' |
| 22 | 22 | ||
| 23 | +export { KVStoreHelper } from './src/main/ets/utils/KVStoreHelper' | ||
| 24 | + | ||
| 23 | export { AccountManagerUtils } from './src/main/ets/utils/AccountManagerUtils' | 25 | export { AccountManagerUtils } from './src/main/ets/utils/AccountManagerUtils' |
| 24 | 26 | ||
| 25 | export { CollectionUtils } from './src/main/ets/utils/CollectionUtils' | 27 | export { CollectionUtils } from './src/main/ets/utils/CollectionUtils' |
| @@ -4,7 +4,7 @@ import tingyun, { LogLevel } from '@tingyun/harmonyos'; | @@ -4,7 +4,7 @@ import tingyun, { LogLevel } from '@tingyun/harmonyos'; | ||
| 4 | 4 | ||
| 5 | export class TingyunAPM { | 5 | export class TingyunAPM { |
| 6 | 6 | ||
| 7 | - private static TINGYUN_APP_KEY = "" //TODO: | 7 | + private static TINGYUN_APP_KEY = "ebe0ed7f09f54af681201b784858dde2" |
| 8 | private static TINGYUN_REDIRECT_HOST = "wkrt.tingyun.com" | 8 | private static TINGYUN_REDIRECT_HOST = "wkrt.tingyun.com" |
| 9 | 9 | ||
| 10 | private static logEnable() { | 10 | private static logEnable() { |
| @@ -2,46 +2,30 @@ import { StringUtils } from './StringUtils'; | @@ -2,46 +2,30 @@ import { StringUtils } from './StringUtils'; | ||
| 2 | import { SPHelper } from './SPHelper'; | 2 | import { SPHelper } from './SPHelper'; |
| 3 | import { Logger } from './Logger'; | 3 | import { Logger } from './Logger'; |
| 4 | 4 | ||
| 5 | -const KEY_USER_TOKEN = 'userToken'; | ||
| 6 | - | ||
| 7 | const TAG: string = 'AccountManagerUtils'; | 5 | const TAG: string = 'AccountManagerUtils'; |
| 8 | 6 | ||
| 9 | // 是否已登录hadLogin | 7 | // 是否已登录hadLogin |
| 10 | let hasLogin: boolean = false; | 8 | let hasLogin: boolean = false; |
| 11 | 9 | ||
| 12 | export class AccountManagerUtils { | 10 | export class AccountManagerUtils { |
| 13 | - // 是否已登录hadLogin | ||
| 14 | - // private static hasLogin: boolean = undefined; | 11 | + |
| 12 | + // 这里需要和其他模块value值一致 !!!! | ||
| 13 | + // TODO: 以前清楚谁写的遗留代码,后续考虑删除 | ||
| 14 | + static readonly USER_ID = "userId" | ||
| 15 | 15 | ||
| 16 | constructor() { | 16 | constructor() { |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | - static async getUserToken(): Promise<string> { | ||
| 20 | - let userToken = await SPHelper.default.get(KEY_USER_TOKEN, '') as string; | 19 | + static async getUserId(): Promise<string> { |
| 20 | + let userId = await SPHelper.default.get(AccountManagerUtils.USER_ID, '') as string; | ||
| 21 | // Logger.info(TAG, 'getUserToken UserToken.' + userToken); | 21 | // Logger.info(TAG, 'getUserToken UserToken.' + userToken); |
| 22 | - return userToken; | 22 | + return userId; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | - static getUserTokenSync(): string { | ||
| 26 | - let userToken = SPHelper.default.getSync(KEY_USER_TOKEN, '') as string; | 25 | + static getUserIdSync(): string { |
| 26 | + let userId = SPHelper.default.getSync(AccountManagerUtils.USER_ID, '') as string; | ||
| 27 | // Logger.info(TAG, 'getUserToken UserToken.' + userToken); | 27 | // Logger.info(TAG, 'getUserToken UserToken.' + userToken); |
| 28 | - return userToken; | ||
| 29 | - } | ||
| 30 | - | ||
| 31 | - static async putUserToken(value: string) { | ||
| 32 | - await SPHelper.default.save(KEY_USER_TOKEN, value); | ||
| 33 | - } | ||
| 34 | - | ||
| 35 | - static putUserTokenSync(value: string) { | ||
| 36 | - SPHelper.default.saveSync(KEY_USER_TOKEN, value); | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | - static async deleteUserToken() { | ||
| 40 | - await SPHelper.default.delete(KEY_USER_TOKEN); | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | - static deleteUserTokenSync() { | ||
| 44 | - SPHelper.default.deleteSync(KEY_USER_TOKEN); | 28 | + return userId; |
| 45 | } | 29 | } |
| 46 | 30 | ||
| 47 | /** | 31 | /** |
| @@ -51,7 +35,7 @@ export class AccountManagerUtils { | @@ -51,7 +35,7 @@ export class AccountManagerUtils { | ||
| 51 | */ | 35 | */ |
| 52 | static async isLogin() { | 36 | static async isLogin() { |
| 53 | Logger.info(TAG, 'isLogin hasLogin1:' + hasLogin); | 37 | Logger.info(TAG, 'isLogin hasLogin1:' + hasLogin); |
| 54 | - let lastUserToken = await AccountManagerUtils.getUserToken() | 38 | + let lastUserToken = await AccountManagerUtils.getUserId() |
| 55 | Logger.info(TAG, 'isLogin lastUserToken:' + lastUserToken); | 39 | Logger.info(TAG, 'isLogin lastUserToken:' + lastUserToken); |
| 56 | if (StringUtils.isEmpty(lastUserToken)) { | 40 | if (StringUtils.isEmpty(lastUserToken)) { |
| 57 | hasLogin = false; | 41 | hasLogin = false; |
| @@ -72,7 +56,7 @@ export class AccountManagerUtils { | @@ -72,7 +56,7 @@ export class AccountManagerUtils { | ||
| 72 | */ | 56 | */ |
| 73 | static isLoginSync() { | 57 | static isLoginSync() { |
| 74 | Logger.info(TAG, 'isLogin hasLogin1:' + hasLogin); | 58 | Logger.info(TAG, 'isLogin hasLogin1:' + hasLogin); |
| 75 | - let lastUserToken = AccountManagerUtils.getUserTokenSync() | 59 | + let lastUserToken = AccountManagerUtils.getUserIdSync() |
| 76 | Logger.info(TAG, 'isLogin lastUserToken:' + lastUserToken); | 60 | Logger.info(TAG, 'isLogin lastUserToken:' + lastUserToken); |
| 77 | if (StringUtils.isEmpty(lastUserToken)) { | 61 | if (StringUtils.isEmpty(lastUserToken)) { |
| 78 | hasLogin = false; | 62 | hasLogin = false; |
| @@ -37,6 +37,7 @@ export abstract class BasicDataSource<T> implements IDataSource { | @@ -37,6 +37,7 @@ export abstract class BasicDataSource<T> implements IDataSource { | ||
| 37 | }) | 37 | }) |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | + | ||
| 40 | // 通知控制器数据增加 | 41 | // 通知控制器数据增加 |
| 41 | public notifyDataAdd(index: number): void { | 42 | public notifyDataAdd(index: number): void { |
| 42 | this.listeners.forEach(listener => { | 43 | this.listeners.forEach(listener => { |
| @@ -82,4 +82,20 @@ export class DeviceUtil { | @@ -82,4 +82,20 @@ export class DeviceUtil { | ||
| 82 | static getRandomUUIDForTraceID(): string { | 82 | static getRandomUUIDForTraceID(): string { |
| 83 | return util.generateRandomUUID().toUpperCase().replace(/-/g, '') | 83 | return util.generateRandomUUID().toUpperCase().replace(/-/g, '') |
| 84 | } | 84 | } |
| 85 | + | ||
| 86 | + /** | ||
| 87 | + * 是否为phone设备(可折叠手机即便完全展开状态也返回true) | ||
| 88 | + * @returns | ||
| 89 | + */ | ||
| 90 | + static isPhone(): boolean { | ||
| 91 | + return deviceInfo.deviceType == 'phone' || deviceInfo.deviceType == 'default'; | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + static isNotPhone(): boolean { | ||
| 95 | + return !DeviceUtil.isPhone(); | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + static isTablet(): boolean { | ||
| 99 | + return deviceInfo.deviceType == 'tablet'; | ||
| 100 | + } | ||
| 85 | } | 101 | } |
| @@ -34,6 +34,14 @@ export enum EmitterEventId { | @@ -34,6 +34,14 @@ export enum EmitterEventId { | ||
| 34 | // App进入后台 | 34 | // App进入后台 |
| 35 | APP_ENTER_BACKGROUD = 101, | 35 | APP_ENTER_BACKGROUD = 101, |
| 36 | 36 | ||
| 37 | + // 更换音频名称 | ||
| 38 | + AUDIO_CHANGE_TITLe = 10, | ||
| 39 | + | ||
| 40 | + // 更换音频状态 | ||
| 41 | + AUDIO_CHANGE_STATUS = 11, | ||
| 42 | + | ||
| 43 | + // 获取音频悬浮窗焦点状态 | ||
| 44 | + AUDIO_WINDOW_TYPE = 12, | ||
| 37 | 45 | ||
| 38 | } | 46 | } |
| 39 | 47 |
| @@ -23,7 +23,7 @@ export class EmitterUtils { | @@ -23,7 +23,7 @@ export class EmitterUtils { | ||
| 23 | * @param eventId 事件id | 23 | * @param eventId 事件id |
| 24 | * @param str 字符串数据 | 24 | * @param str 字符串数据 |
| 25 | */ | 25 | */ |
| 26 | - static sendEvent(eventId: number, str?: string) { | 26 | + static sendEvent(eventId: number, str?: string | number) { |
| 27 | let event: emitter.InnerEvent = { | 27 | let event: emitter.InnerEvent = { |
| 28 | eventId: eventId, | 28 | eventId: eventId, |
| 29 | priority: emitter.EventPriority.LOW | 29 | priority: emitter.EventPriority.LOW |
| 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 | +} |
| @@ -255,6 +255,7 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | @@ -255,6 +255,7 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | ||
| 255 | this.replaceAll() | 255 | this.replaceAll() |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | + | ||
| 258 | // 把数据全部删除,再添加全部新元素 | 259 | // 把数据全部删除,再添加全部新元素 |
| 259 | public replaceAll(...items: T[]): void { | 260 | public replaceAll(...items: T[]): void { |
| 260 | // 从数组中的0位置开始删除dataArray.length个元素,并在同一位置插入((1个或多个))新元素,返回已删除的元素。 | 261 | // 从数组中的0位置开始删除dataArray.length个元素,并在同一位置插入((1个或多个))新元素,返回已删除的元素。 |
| @@ -262,6 +263,8 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | @@ -262,6 +263,8 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | ||
| 262 | this.notifyDataReload() | 263 | this.notifyDataReload() |
| 263 | } | 264 | } |
| 264 | 265 | ||
| 266 | + | ||
| 267 | + | ||
| 265 | // 获取指定元素的下标 | 268 | // 获取指定元素的下标 |
| 266 | public getIndexOf(element: T): number { | 269 | public getIndexOf(element: T): number { |
| 267 | for (let index = 0; index < this.dataArray.length; index++) { | 270 | for (let index = 0; index < this.dataArray.length; index++) { |
| @@ -293,4 +296,13 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | @@ -293,4 +296,13 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | ||
| 293 | public reloadData(): void { | 296 | public reloadData(): void { |
| 294 | this.notifyDataReload(); | 297 | this.notifyDataReload(); |
| 295 | } | 298 | } |
| 299 | + //**********************////////// | ||
| 300 | + | ||
| 301 | + | ||
| 302 | + public clearAllData(){ | ||
| 303 | + | ||
| 304 | + this.dataArray = [] | ||
| 305 | + this.notifyDataReload(); | ||
| 306 | + } | ||
| 307 | + | ||
| 296 | } | 308 | } |
| @@ -4,7 +4,7 @@ import { Logger } from './Logger'; | @@ -4,7 +4,7 @@ import { Logger } from './Logger'; | ||
| 4 | const TAG = 'SPHelper' | 4 | const TAG = 'SPHelper' |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 7 | - * sp存储 | 7 | + * sp存储,单条数据,value<1k;业务数据超过1k的,建议使用KVStoreHelper |
| 8 | */ | 8 | */ |
| 9 | export class SPHelper { | 9 | export class SPHelper { |
| 10 | private static context: Context; | 10 | private static context: Context; |
| @@ -5,7 +5,7 @@ export class ToastUtils { | @@ -5,7 +5,7 @@ export class ToastUtils { | ||
| 5 | private static shortToastTime: number = 1000 | 5 | private static shortToastTime: number = 1000 |
| 6 | 6 | ||
| 7 | static showToast(message: ResourceStr, duration: number) { | 7 | static showToast(message: ResourceStr, duration: number) { |
| 8 | - prompt.showToast({ message: message, duration: duration }) | 8 | + prompt.showToast({ message: message, duration: duration, alignment: Alignment.Center }) |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | static shortToast(message: ResourceStr) { | 11 | static shortToast(message: ResourceStr) { |
| @@ -12,3 +12,5 @@ export { HttpUtils } from "./src/main/ets/utils/HttpUtils" | @@ -12,3 +12,5 @@ export { HttpUtils } from "./src/main/ets/utils/HttpUtils" | ||
| 12 | 12 | ||
| 13 | export { HostEnum, HostManager } from "./src/main/ets/http/HttpHostManager" | 13 | export { HostEnum, HostManager } from "./src/main/ets/http/HttpHostManager" |
| 14 | 14 | ||
| 15 | +export { CacheData } from "./src/main/ets/utils/CacheData" | ||
| 16 | + |
| @@ -330,6 +330,26 @@ export class HttpUrlUtils { | @@ -330,6 +330,26 @@ export class HttpUrlUtils { | ||
| 330 | static readonly MESSAGE_UN_READ_DATA_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/polymerizationInfo?createTime="; | 330 | static readonly MESSAGE_UN_READ_DATA_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/polymerizationInfo?createTime="; |
| 331 | 331 | ||
| 332 | /** | 332 | /** |
| 333 | + * 直播详情-直播人数 | ||
| 334 | + */ | ||
| 335 | + static readonly LIVE_ROOM_BATCH_ALL_DATA_PATH: string = "/api/live-center-message/zh/a/live/room/number/batch/all"; | ||
| 336 | + | ||
| 337 | + /** | ||
| 338 | + * 点击消息 | ||
| 339 | + */ | ||
| 340 | + static readonly SEND_MESSAGE_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/touch?createTime="; | ||
| 341 | + | ||
| 342 | + /** | ||
| 343 | + * 点击具体某个消息 | ||
| 344 | + */ | ||
| 345 | + static readonly ENTER_MESSAGE_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/readAll?contentType="; | ||
| 346 | + | ||
| 347 | + /** | ||
| 348 | + * 推送消息 | ||
| 349 | + */ | ||
| 350 | + static readonly HISTORY_PUSH_MESSAGE_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/push"; | ||
| 351 | + | ||
| 352 | + /** | ||
| 333 | * 意见反馈-提交 | 353 | * 意见反馈-提交 |
| 334 | */ | 354 | */ |
| 335 | static readonly FEEDBACK_COMMIT_PATH: string = "/api/rmrb-interact/interact/zh/c/user/feedBack"; | 355 | static readonly FEEDBACK_COMMIT_PATH: string = "/api/rmrb-interact/interact/zh/c/user/feedBack"; |
| @@ -444,7 +464,7 @@ export class HttpUrlUtils { | @@ -444,7 +464,7 @@ export class HttpUrlUtils { | ||
| 444 | 464 | ||
| 445 | /*游客发布评论*/ | 465 | /*游客发布评论*/ |
| 446 | static getNoUserPublishCommentUrl() { | 466 | static getNoUserPublishCommentUrl() { |
| 447 | - let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/commentLike" | 467 | + let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/visitorPublish" |
| 448 | return url | 468 | return url |
| 449 | } | 469 | } |
| 450 | 470 | ||
| @@ -751,4 +771,29 @@ export class HttpUrlUtils { | @@ -751,4 +771,29 @@ export class HttpUrlUtils { | ||
| 751 | let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/common/user/c/device/push"; | 771 | let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/common/user/c/device/push"; |
| 752 | return url; | 772 | return url; |
| 753 | } | 773 | } |
| 774 | + | ||
| 775 | + //获取直播人数 | ||
| 776 | + static getLiveRoomBatchAllDataUrl() { | ||
| 777 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_ROOM_BATCH_ALL_DATA_PATH | ||
| 778 | + return url | ||
| 779 | + } | ||
| 780 | + | ||
| 781 | + | ||
| 782 | + //点击消息 | ||
| 783 | + static getSendClickMessageUrl() { | ||
| 784 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEND_MESSAGE_PATH | ||
| 785 | + return url | ||
| 786 | + } | ||
| 787 | + | ||
| 788 | + //消息 历史推送消息 | ||
| 789 | + static getHistoryPushUrl() { | ||
| 790 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.HISTORY_PUSH_MESSAGE_PATH | ||
| 791 | + return url | ||
| 792 | + } | ||
| 793 | + | ||
| 794 | + //点击具体某个消息 | ||
| 795 | + static getEnterClickMessageUrl() { | ||
| 796 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.ENTER_MESSAGE_PATH | ||
| 797 | + return url | ||
| 798 | + } | ||
| 754 | } | 799 | } |
| 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 | //人民号主页 |
| @@ -20,14 +20,15 @@ export class HomeChannelUtils { | @@ -20,14 +20,15 @@ export class HomeChannelUtils { | ||
| 20 | * @param channelId 频道id【顶导id】 | 20 | * @param channelId 频道id【顶导id】 |
| 21 | * @param pageId 目标页面id | 21 | * @param pageId 目标页面id |
| 22 | */ | 22 | */ |
| 23 | - jumpChannelTab(channelId: string, pageId: string) { | 23 | + jumpChannelTab(channelId: string, pageId: string, pageName?: string) { |
| 24 | // 1、首页所有展示频道遍历,找到目标频道 | 24 | // 1、首页所有展示频道遍历,找到目标频道 |
| 25 | // 2、频道管理里的,非我的频道所有列表遍历,找到目标频道 【这步去掉,和this.bottomNavData重复了】 | 25 | // 2、频道管理里的,非我的频道所有列表遍历,找到目标频道 【这步去掉,和this.bottomNavData重复了】 |
| 26 | // 3、一级频道【1、2里找到目标】->【切换底导、切换频道/新增临时频道】 | 26 | // 3、一级频道【1、2里找到目标】->【切换底导、切换频道/新增临时频道】 |
| 27 | // 4、二级频道【1、2里都没有找到目标】->【跳转栏目页面-ColumnPageComponent】 | 27 | // 4、二级频道【1、2里都没有找到目标】->【跳转栏目页面-ColumnPageComponent】 |
| 28 | 28 | ||
| 29 | // 1. 遍历查找目标channel | 29 | // 1. 遍历查找目标channel |
| 30 | - if (this.bottomNavData == null || this.bottomNavData.bottomNavList == null || this.bottomNavData.bottomNavList.length <= 0) { | 30 | + if (this.bottomNavData == null || this.bottomNavData.bottomNavList == null || |
| 31 | + this.bottomNavData.bottomNavList.length <= 0) { | ||
| 31 | this.jumpColumn(channelId, pageId) | 32 | this.jumpColumn(channelId, pageId) |
| 32 | return | 33 | return |
| 33 | } | 34 | } |
| @@ -51,16 +52,17 @@ export class HomeChannelUtils { | @@ -51,16 +52,17 @@ export class HomeChannelUtils { | ||
| 51 | } | 52 | } |
| 52 | } | 53 | } |
| 53 | if (StringUtils.isEmpty(bean.bottomNavId)) { | 54 | if (StringUtils.isEmpty(bean.bottomNavId)) { |
| 54 | - this.jumpColumn(channelId, pageId) | 55 | + this.jumpColumn(channelId, pageId, pageName) |
| 55 | } else { | 56 | } else { |
| 56 | this.jumpHomeChannel(bean) | 57 | this.jumpHomeChannel(bean) |
| 57 | } | 58 | } |
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | - jumpColumn(channelId: string, pageId: string) { | 61 | + jumpColumn(channelId: string, pageId: string, pageName?: string) { |
| 61 | let params: AssignChannelParam = new AssignChannelParam() | 62 | let params: AssignChannelParam = new AssignChannelParam() |
| 62 | params.pageId = pageId | 63 | params.pageId = pageId |
| 63 | params.channelId = channelId | 64 | params.channelId = channelId |
| 65 | + params.pageName = pageName || '' | ||
| 64 | WDRouterRule.jumpWithPage(WDRouterPage.columnPage, params) | 66 | WDRouterRule.jumpWithPage(WDRouterPage.columnPage, params) |
| 65 | } | 67 | } |
| 66 | 68 | ||
| @@ -77,6 +79,8 @@ export class AssignChannelParam { | @@ -77,6 +79,8 @@ export class AssignChannelParam { | ||
| 77 | pageId: string = ''; | 79 | pageId: string = ''; |
| 78 | channelId: string = ''; | 80 | channelId: string = ''; |
| 79 | bottomNavId: string = ''; | 81 | bottomNavId: string = ''; |
| 82 | + // 跳转专题/二级栏目用到 | ||
| 83 | + pageName: string = '' | ||
| 80 | } | 84 | } |
| 81 | 85 | ||
| 82 | let homeChannelUtils = new HomeChannelUtils(); | 86 | let homeChannelUtils = new HomeChannelUtils(); |
| @@ -108,9 +108,9 @@ export class ProcessUtils { | @@ -108,9 +108,9 @@ export class ProcessUtils { | ||
| 108 | break; | 108 | break; |
| 109 | case ContentConstants.TYPE_TELETEXT: | 109 | case ContentConstants.TYPE_TELETEXT: |
| 110 | // 图文详情,跳转h5 | 110 | // 图文详情,跳转h5 |
| 111 | - if(content?.linkUrl){ //有 linkUrl 走专题页展示逻辑 | ||
| 112 | - ProcessUtils.gotoSpecialTopic(content) | ||
| 113 | - }else{ | 111 | + if (content?.linkUrl) { //有 linkUrl 走专题页展示逻辑 |
| 112 | + ProcessUtils.gotoSpecialTopic(content,true) | ||
| 113 | + } else { | ||
| 114 | ProcessUtils.gotoWeb(content); | 114 | ProcessUtils.gotoWeb(content); |
| 115 | } | 115 | } |
| 116 | break; | 116 | break; |
| @@ -191,13 +191,14 @@ export class ProcessUtils { | @@ -191,13 +191,14 @@ export class ProcessUtils { | ||
| 191 | WDRouterRule.jumpWithAction(taskAction) | 191 | WDRouterRule.jumpWithAction(taskAction) |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | - public static gotoSpecialTopic(content: ContentDTO) { | 194 | + public static gotoSpecialTopic(content: ContentDTO, backVisibility?: boolean) { |
| 195 | let taskAction: Action = { | 195 | let taskAction: Action = { |
| 196 | type: 'JUMP_INNER_NEW_PAGE', | 196 | type: 'JUMP_INNER_NEW_PAGE', |
| 197 | params: { | 197 | params: { |
| 198 | contentID: content?.objectId, | 198 | contentID: content?.objectId, |
| 199 | url: content.linkUrl, | 199 | url: content.linkUrl, |
| 200 | pageID: 'SPACIAL_TOPIC_PAGE', | 200 | pageID: 'SPACIAL_TOPIC_PAGE', |
| 201 | + backVisibility: backVisibility, | ||
| 201 | extra: { | 202 | extra: { |
| 202 | relType: content?.relType, | 203 | relType: content?.relType, |
| 203 | relId: content?.relId, | 204 | relId: content?.relId, |
| @@ -219,14 +220,26 @@ export class ProcessUtils { | @@ -219,14 +220,26 @@ export class ProcessUtils { | ||
| 219 | } | 220 | } |
| 220 | 221 | ||
| 221 | public static gotoDefaultWeb(content: ContentDTO) { | 222 | public static gotoDefaultWeb(content: ContentDTO) { |
| 222 | - let taskAction: Action = { | ||
| 223 | - type: 'JUMP_H5_BY_WEB_VIEW', | ||
| 224 | - params: { | ||
| 225 | - url: content.linkUrl, | ||
| 226 | - } as Params, | ||
| 227 | - }; | ||
| 228 | - WDRouterRule.jumpWithAction(taskAction) | ||
| 229 | - Logger.debug(TAG, `gotoWeb, ${content.objectId}`); | 223 | + |
| 224 | + // 内链 | ||
| 225 | + if(content.openType == '1'){ | ||
| 226 | + let taskAction: Action = { | ||
| 227 | + type: 'JUMP_H5_BY_WEB_VIEW', | ||
| 228 | + params: { | ||
| 229 | + url: content.linkUrl, | ||
| 230 | + } as Params, | ||
| 231 | + }; | ||
| 232 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 233 | + }else if(content.openType == '2') { | ||
| 234 | + // 外链 | ||
| 235 | + ProcessUtils.jumpExternalWebPage(content.linkUrl); | ||
| 236 | + }else { | ||
| 237 | + // 无需跳转 | ||
| 238 | + | ||
| 239 | + } | ||
| 240 | + | ||
| 241 | + | ||
| 242 | + Logger.debug(TAG, `gotoWeb, ${content.objectId}`) | ||
| 230 | } | 243 | } |
| 231 | 244 | ||
| 232 | static commentGotoWeb(content: commentInfo) { | 245 | static commentGotoWeb(content: commentInfo) { |
| @@ -433,8 +446,8 @@ export class ProcessUtils { | @@ -433,8 +446,8 @@ export class ProcessUtils { | ||
| 433 | * | 446 | * |
| 434 | * @param channelId 频道id【顶导id】 | 447 | * @param channelId 频道id【顶导id】 |
| 435 | */ | 448 | */ |
| 436 | - public static jumpChannelTab(channelId: string, pageId: string) { | ||
| 437 | - HomeChannelUtils.jumpChannelTab(channelId, pageId) | 449 | + public static jumpChannelTab(channelId: string, pageId: string, pageName?: string) { |
| 450 | + HomeChannelUtils.jumpChannelTab(channelId, pageId, pageName) | ||
| 438 | } | 451 | } |
| 439 | 452 | ||
| 440 | /** | 453 | /** |
| @@ -18,7 +18,6 @@ export function handleJsCallAppService(data: Message, callback: (res: string) => | @@ -18,7 +18,6 @@ export function handleJsCallAppService(data: Message, callback: (res: string) => | ||
| 18 | if (queryString) { | 18 | if (queryString) { |
| 19 | url = url + `?${queryString}` | 19 | url = url + `?${queryString}` |
| 20 | } | 20 | } |
| 21 | - console.log('yzl', queryString, url) | ||
| 22 | WDHttp.get(url).then((res) => { | 21 | WDHttp.get(url).then((res) => { |
| 23 | callback(JSON.stringify({ | 22 | callback(JSON.stringify({ |
| 24 | netError: '0', | 23 | netError: '0', |
| @@ -12,26 +12,14 @@ const TAG = 'WdWebComponent'; | @@ -12,26 +12,14 @@ const TAG = 'WdWebComponent'; | ||
| 12 | @Component | 12 | @Component |
| 13 | export struct WdWebComponent { | 13 | export struct WdWebComponent { |
| 14 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | 14 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() |
| 15 | - onWebPrepared: () => void = () => {} | ||
| 16 | - @Prop backVisibility: boolean = false | 15 | + onWebPrepared: () => void = () => { |
| 16 | + } | ||
| 17 | @Prop webUrl: string = '' | 17 | @Prop webUrl: string = '' |
| 18 | + @Prop @Watch('onReloadStateChanged') reload: number = 0 | ||
| 18 | @Link isPageEnd: boolean | 19 | @Link isPageEnd: boolean |
| 19 | 20 | ||
| 20 | build() { | 21 | build() { |
| 21 | Column() { | 22 | Column() { |
| 22 | - Row() { | ||
| 23 | - Image($r("app.media.ic_back")) | ||
| 24 | - .width(44) | ||
| 25 | - .padding(13) | ||
| 26 | - .aspectRatio(1) | ||
| 27 | - .onClick(() => { | ||
| 28 | - router.back(); | ||
| 29 | - }) | ||
| 30 | - }.backgroundColor(Color.Black) | ||
| 31 | - .width('100%') | ||
| 32 | - .height(44) | ||
| 33 | - .visibility(this.backVisibility ? Visibility.Visible : Visibility.None) | ||
| 34 | - | ||
| 35 | Web({ src: this.webUrl, controller: this.webviewControl }) | 23 | Web({ src: this.webUrl, controller: this.webviewControl }) |
| 36 | .domStorageAccess(true) | 24 | .domStorageAccess(true) |
| 37 | .databaseAccess(true) | 25 | .databaseAccess(true) |
| @@ -76,6 +64,7 @@ export struct WdWebComponent { | @@ -76,6 +64,7 @@ export struct WdWebComponent { | ||
| 76 | this.webviewControl.registerHandler(handleName, { handle: handle }); | 64 | this.webviewControl.registerHandler(handleName, { handle: handle }); |
| 77 | } | 65 | } |
| 78 | } | 66 | } |
| 67 | + | ||
| 79 | /** | 68 | /** |
| 80 | * 默认【CallNative】逻辑处理 | 69 | * 默认【CallNative】逻辑处理 |
| 81 | */ | 70 | */ |
| @@ -99,5 +88,11 @@ export struct WdWebComponent { | @@ -99,5 +88,11 @@ export struct WdWebComponent { | ||
| 99 | Logger.debug(TAG, 'onLoadIntercept return false'); | 88 | Logger.debug(TAG, 'onLoadIntercept return false'); |
| 100 | return false | 89 | return false |
| 101 | } | 90 | } |
| 91 | + onReloadStateChanged() { | ||
| 92 | + Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`); | ||
| 93 | + if (this.reload > 0) { | ||
| 94 | + this.webviewControl.refresh() | ||
| 95 | + } | ||
| 96 | + } | ||
| 102 | } | 97 | } |
| 103 | 98 |
| @@ -5,14 +5,17 @@ import { performJSCallNative } from './JsBridgeBiz'; | @@ -5,14 +5,17 @@ import { performJSCallNative } from './JsBridgeBiz'; | ||
| 5 | import { H5CallNativeType } from './H5CallNativeType'; | 5 | import { H5CallNativeType } from './H5CallNativeType'; |
| 6 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | 6 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; |
| 7 | import { DateTimeUtils } from 'wdKit' | 7 | import { DateTimeUtils } from 'wdKit' |
| 8 | + | ||
| 8 | const TAG = 'WdWebLocalComponent'; | 9 | const TAG = 'WdWebLocalComponent'; |
| 9 | 10 | ||
| 10 | @Component | 11 | @Component |
| 11 | export struct WdWebLocalComponent { | 12 | export struct WdWebLocalComponent { |
| 12 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | 13 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() |
| 13 | - onWebPrepared: () => void = () => {} | 14 | + onWebPrepared: () => void = () => { |
| 15 | + } | ||
| 14 | @Prop backVisibility: boolean = false | 16 | @Prop backVisibility: boolean = false |
| 15 | @Prop webResource: Resource = {} as Resource | 17 | @Prop webResource: Resource = {} as Resource |
| 18 | + @Prop @Watch('onReloadStateChanged') reload: number = 0 | ||
| 16 | @State webHeight: string | number = '100%' | 19 | @State webHeight: string | number = '100%' |
| 17 | @Link isPageEnd: boolean | 20 | @Link isPageEnd: boolean |
| 18 | @State videoUrl: string = '' | 21 | @State videoUrl: string = '' |
| @@ -47,16 +50,15 @@ export struct WdWebLocalComponent { | @@ -47,16 +50,15 @@ export struct WdWebLocalComponent { | ||
| 47 | Row() { | 50 | Row() { |
| 48 | RelativeContainer() { | 51 | RelativeContainer() { |
| 49 | // Web({ src: this.webResource, controller: this.webviewControl, renderMode: RenderMode.SYNC_RENDER }) | 52 | // Web({ src: this.webResource, controller: this.webviewControl, renderMode: RenderMode.SYNC_RENDER }) |
| 50 | - Web({ src: this.webResource, controller: this.webviewControl}) | 53 | + Web({ src: this.webResource, controller: this.webviewControl }) |
| 51 | .domStorageAccess(true) | 54 | .domStorageAccess(true) |
| 52 | .databaseAccess(true) | 55 | .databaseAccess(true) |
| 53 | .javaScriptAccess(true) | 56 | .javaScriptAccess(true) |
| 54 | .imageAccess(true) | 57 | .imageAccess(true) |
| 55 | .mixedMode(MixedMode.All) | 58 | .mixedMode(MixedMode.All) |
| 56 | .onlineImageAccess(true) | 59 | .onlineImageAccess(true) |
| 57 | - .enableNativeEmbedMode(true) | ||
| 58 | - // .layoutMode(WebLayoutMode.FIT_CONTENT) | ||
| 59 | - // .nestedScroll({ scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.PARENT_FIRST }) | 60 | + .enableNativeEmbedMode(true)// .layoutMode(WebLayoutMode.FIT_CONTENT) |
| 61 | + // .nestedScroll({ scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.PARENT_FIRST }) | ||
| 60 | .height(this.webHeight) | 62 | .height(this.webHeight) |
| 61 | .onPageBegin((event) => { | 63 | .onPageBegin((event) => { |
| 62 | this.onPageBegin(event?.url); | 64 | this.onPageBegin(event?.url); |
| @@ -113,18 +115,21 @@ export struct WdWebLocalComponent { | @@ -113,18 +115,21 @@ export struct WdWebLocalComponent { | ||
| 113 | } | 115 | } |
| 114 | }) | 116 | }) |
| 115 | Row() { | 117 | Row() { |
| 116 | - Image($r(this.isPause ? 'app.media.icon_play' : 'app.media.icon_pause')) | 118 | + Image(this.isPause ? $r('app.media.icon_play') : $r('app.media.icon_pause')) |
| 117 | .width(24) | 119 | .width(24) |
| 118 | .height(24) | 120 | .height(24) |
| 119 | - .onClick(()=>{ | ||
| 120 | - if(this.isPause){ | 121 | + .onClick(() => { |
| 122 | + if (this.isPause) { | ||
| 121 | this.controller.start() | 123 | this.controller.start() |
| 122 | - }else{ | 124 | + } else { |
| 123 | this.controller.pause() | 125 | this.controller.pause() |
| 124 | } | 126 | } |
| 125 | }) | 127 | }) |
| 126 | Row() { | 128 | Row() { |
| 127 | - Text(DateTimeUtils.getFormattedDuration(this.currentTime * 1000)).fontSize(12).fontColor(Color.White).fontWeight(600) | 129 | + Text(DateTimeUtils.getFormattedDuration(this.currentTime * 1000)) |
| 130 | + .fontSize(12) | ||
| 131 | + .fontColor(Color.White) | ||
| 132 | + .fontWeight(600) | ||
| 128 | Slider({ | 133 | Slider({ |
| 129 | value: this.currentTime, | 134 | value: this.currentTime, |
| 130 | min: 0, | 135 | min: 0, |
| @@ -132,23 +137,25 @@ export struct WdWebLocalComponent { | @@ -132,23 +137,25 @@ export struct WdWebLocalComponent { | ||
| 132 | }) | 137 | }) |
| 133 | .width("50%") | 138 | .width("50%") |
| 134 | .selectedColor('#ED2800') | 139 | .selectedColor('#ED2800') |
| 135 | - .margin({ left: 4, right: 4 }) | ||
| 136 | - // .blockStyle({ | ||
| 137 | - // type: SliderBlockType.IMAGE, | ||
| 138 | - // image: $r('app.media.slider_block') | ||
| 139 | - // }) | ||
| 140 | - // .blockSize({ width: 18, height: 12 }) | 140 | + .margin({ left: 4, right: 4 })// .blockStyle({ |
| 141 | + // type: SliderBlockType.IMAGE, | ||
| 142 | + // image: $r('app.media.slider_block') | ||
| 143 | + // }) | ||
| 144 | + // .blockSize({ width: 18, height: 12 }) | ||
| 141 | .onChange((value: number, mode: SliderChangeMode) => { | 145 | .onChange((value: number, mode: SliderChangeMode) => { |
| 142 | this.controller.setCurrentTime(value); | 146 | this.controller.setCurrentTime(value); |
| 143 | }) | 147 | }) |
| 144 | - Text(DateTimeUtils.getFormattedDuration(this.durationTime * 1000)).fontSize(12).fontColor(Color.White).fontWeight(600) | 148 | + Text(DateTimeUtils.getFormattedDuration(this.durationTime * 1000)) |
| 149 | + .fontSize(12) | ||
| 150 | + .fontColor(Color.White) | ||
| 151 | + .fontWeight(600) | ||
| 145 | } | 152 | } |
| 146 | .justifyContent(FlexAlign.Center) | 153 | .justifyContent(FlexAlign.Center) |
| 147 | 154 | ||
| 148 | Image($r('app.media.icon_full_screen')) | 155 | Image($r('app.media.icon_full_screen')) |
| 149 | .width(24) | 156 | .width(24) |
| 150 | .height(24) | 157 | .height(24) |
| 151 | - .onClick(()=>{ | 158 | + .onClick(() => { |
| 152 | this.controller.requestFullscreen(true) | 159 | this.controller.requestFullscreen(true) |
| 153 | }) | 160 | }) |
| 154 | } | 161 | } |
| @@ -234,5 +241,11 @@ export struct WdWebLocalComponent { | @@ -234,5 +241,11 @@ export struct WdWebLocalComponent { | ||
| 234 | Logger.debug(TAG, 'onLoadIntercept return false'); | 241 | Logger.debug(TAG, 'onLoadIntercept return false'); |
| 235 | return false | 242 | return false |
| 236 | } | 243 | } |
| 244 | + onReloadStateChanged() { | ||
| 245 | + Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`); | ||
| 246 | + if (this.reload > 0) { | ||
| 247 | + this.webviewControl.refresh() | ||
| 248 | + } | ||
| 249 | + } | ||
| 237 | } | 250 | } |
| 238 | 251 |
| @@ -10,73 +10,77 @@ | @@ -10,73 +10,77 @@ | ||
| 10 | /* | 10 | /* |
| 11 | 信息流广告素材解析累 | 11 | 信息流广告素材解析累 |
| 12 | */ | 12 | */ |
| 13 | -export interface CompAdvMatInfoBean { | 13 | +export class CompAdvMatInfoBean { |
| 14 | 14 | ||
| 15 | + id:number = 0 | ||
| 15 | /** | 16 | /** |
| 16 | * 广告标题 | 17 | * 广告标题 |
| 17 | */ | 18 | */ |
| 18 | - advTitle: string | 19 | + advTitle: string = '' |
| 19 | /** | 20 | /** |
| 20 | * 3:信息流广告 | 21 | * 3:信息流广告 |
| 21 | */ | 22 | */ |
| 22 | - advType: string | 23 | + advType: string ='' |
| 23 | /** | 24 | /** |
| 24 | * 信息流广告类型(4:轮播图 5:三图广告 6:小图广告 7:长通栏广告 8:大图广告 9:视频广告 10:展会广告 11:冠名广告 12:顶部长通栏广告) | 25 | * 信息流广告类型(4:轮播图 5:三图广告 6:小图广告 7:长通栏广告 8:大图广告 9:视频广告 10:展会广告 11:冠名广告 12:顶部长通栏广告) |
| 25 | */ | 26 | */ |
| 26 | - advSubType: number | 27 | + advSubType: number = 0 |
| 27 | /** | 28 | /** |
| 28 | * 素材图片信息;adv_subtype=4,5,6,7,8,9,12 时使用 | 29 | * 素材图片信息;adv_subtype=4,5,6,7,8,9,12 时使用 |
| 29 | */ | 30 | */ |
| 30 | - matImageUrl: string[] | 31 | + matImageUrl: string[] = [] |
| 31 | /** | 32 | /** |
| 32 | * 视频广告地址(adv_subtype=9) | 33 | * 视频广告地址(adv_subtype=9) |
| 33 | */ | 34 | */ |
| 34 | - matVideoUrl: string | 35 | + matVideoUrl: string = '' |
| 35 | /** | 36 | /** |
| 36 | * 扩展信息:advSubType=10,11时使用,字段示例见接口备注。 | 37 | * 扩展信息:advSubType=10,11时使用,字段示例见接口备注。 |
| 37 | */ | 38 | */ |
| 38 | - extraData: string | 39 | + extraData: string = '' |
| 39 | /** | 40 | /** |
| 40 | * 链接类型: 0:无链接;1:内链(文章);2:外链 | 41 | * 链接类型: 0:无链接;1:内链(文章);2:外链 |
| 41 | */ | 42 | */ |
| 42 | - linkType: string | 43 | + linkType: string = '' |
| 43 | /** | 44 | /** |
| 44 | * 链接跳转类型 :0-没链接,不用打开,1-端内打开,2-端外打开 | 45 | * 链接跳转类型 :0-没链接,不用打开,1-端内打开,2-端外打开 |
| 45 | */ | 46 | */ |
| 46 | - openType: string | 47 | + openType: string = '' |
| 47 | /** | 48 | /** |
| 48 | * 广告跳转链接 | 49 | * 广告跳转链接 |
| 49 | */ | 50 | */ |
| 50 | - linkUrl: string | 51 | + linkUrl: string = '' |
| 51 | /** | 52 | /** |
| 52 | * 素材类型(0:图片 1:视频) | 53 | * 素材类型(0:图片 1:视频) |
| 53 | */ | 54 | */ |
| 54 | - matType: string | 55 | + matType: string = '' |
| 55 | /** | 56 | /** |
| 56 | * 开屏样式(1:全屏样式 0:底部固定Logo) | 57 | * 开屏样式(1:全屏样式 0:底部固定Logo) |
| 57 | */ | 58 | */ |
| 58 | - startStyle: string | 59 | + startStyle: string = '' |
| 60 | + | ||
| 61 | + // 本地字段 | ||
| 62 | + originalPostion : number = -1 // 广告原始投放位置 | ||
| 59 | } | 63 | } |
| 60 | 64 | ||
| 61 | /** | 65 | /** |
| 62 | * 信息流广告位 | 66 | * 信息流广告位 |
| 63 | */ | 67 | */ |
| 64 | -export interface CompAdvSlotInfoBean { | 68 | +export class CompAdvSlotInfoBean { |
| 65 | 69 | ||
| 66 | 70 | ||
| 67 | /** | 71 | /** |
| 68 | * 组件id | 72 | * 组件id |
| 69 | */ | 73 | */ |
| 70 | - compId: string; | 74 | + compId: string = ''; |
| 71 | 75 | ||
| 72 | /** | 76 | /** |
| 73 | * 广告位位置 从1开始 | 77 | * 广告位位置 从1开始 |
| 74 | */ | 78 | */ |
| 75 | - position: number; | 79 | + position: number = 0; |
| 76 | 80 | ||
| 77 | /** | 81 | /** |
| 78 | * 频道id | 82 | * 频道id |
| 79 | */ | 83 | */ |
| 80 | - channelId: string; | 84 | + channelId: string = ''; |
| 81 | 85 | ||
| 82 | } | 86 | } |
| @@ -4,48 +4,88 @@ import { ContentDTO } from '../content/ContentDTO'; | @@ -4,48 +4,88 @@ import { ContentDTO } from '../content/ContentDTO'; | ||
| 4 | import { BaseDTO } from './BaseDTO'; | 4 | import { BaseDTO } from './BaseDTO'; |
| 5 | 5 | ||
| 6 | @Observed | 6 | @Observed |
| 7 | -export class CompDTO implements BaseDTO{ | ||
| 8 | - backgroundColor: string=''; | ||
| 9 | - backgroundImgUrl: string=''; | ||
| 10 | - cityCode: string=''; | ||
| 11 | - compStyle: string=''; | ||
| 12 | - compType: string=''; | ||
| 13 | - | 7 | +export class CompDTO implements BaseDTO { |
| 8 | + backgroundColor: string = ''; | ||
| 9 | + backgroundImgUrl: string = ''; | ||
| 10 | + cityCode: string = ''; | ||
| 11 | + compStyle: string = ''; | ||
| 12 | + compType: string = ''; | ||
| 14 | // dataSourceRequest: any[]; | 13 | // dataSourceRequest: any[]; |
| 15 | - districtCode: string=''; | 14 | + districtCode: string = ''; |
| 16 | extraData?: string; | 15 | extraData?: string; |
| 17 | - hasAdInfo: number=-1; | ||
| 18 | - id: number=0; | ||
| 19 | - imgSize: string=''; | ||
| 20 | - innerUrl: string=''; | ||
| 21 | - linkUrl: string=''; | ||
| 22 | - | 16 | + hasAdInfo: number = -1; |
| 17 | + id: number = 0; | ||
| 18 | + imgSize: string = ''; | ||
| 19 | + innerUrl: string = ''; | ||
| 20 | + linkUrl: string = ''; | ||
| 23 | // meddleDataList: any[]; | 21 | // meddleDataList: any[]; |
| 24 | - name: string=''; | ||
| 25 | - objectId: string=''; // 跳转页面id? | ||
| 26 | - objectTitle: string=''; // comp标题 | 22 | + name: string = ''; |
| 23 | + objectId: string = ''; // 跳转页面id? | ||
| 24 | + objectTitle: string = ''; // comp标题 | ||
| 27 | // objectType?: string; // 跳转类型,枚举: | 25 | // objectType?: string; // 跳转类型,枚举: |
| 28 | - operDataList: ContentDTO[]=[]; // 运营数据列表【正常运营配置的强运营数据,部分推荐场景的配置(自动源兜底数据)】 | 26 | + operDataList: ContentDTO[] = []; // 运营数据列表【正常运营配置的强运营数据,部分推荐场景的配置(自动源兜底数据)】 |
| 29 | // pageId?: any; | 27 | // pageId?: any; |
| 30 | - posterSize: string=''; | ||
| 31 | - posterUrl: string=''; | ||
| 32 | - provinceCode: string=''; | ||
| 33 | - sortValue: number=-1; | ||
| 34 | - subType: string=''; | ||
| 35 | - imageScale: number=-1; // 封面图比例 1-4:3, 2-16:9, 3-3:2 | ||
| 36 | - audioDataList: AudioDTO[]=[]; | ||
| 37 | - titleShowPolicy: string | number=''; | ||
| 38 | - | 28 | + posterSize: string = ''; |
| 29 | + posterUrl: string = ''; | ||
| 30 | + provinceCode: string = ''; | ||
| 31 | + sortValue: number = -1; | ||
| 32 | + subType: string = ''; | ||
| 33 | + imageScale: number = -1; // 封面图比例 1-4:3, 2-16:9, 3-3:2 | ||
| 34 | + audioDataList: AudioDTO[] = []; | ||
| 35 | + titleShowPolicy: string | number = ''; | ||
| 39 | /** | 36 | /** |
| 40 | * 组件内容源类型 (LIVE_HORIZONTAL_CARD\LIVE_RESERVATION\LIVE_LARGE_CARD\LIVE_END\LIVE_MONTHLY_RANKING ) | 37 | * 组件内容源类型 (LIVE_HORIZONTAL_CARD\LIVE_RESERVATION\LIVE_LARGE_CARD\LIVE_END\LIVE_MONTHLY_RANKING ) |
| 41 | */ | 38 | */ |
| 42 | - dataSourceType: string=''; | ||
| 43 | - | 39 | + dataSourceType: string = ''; |
| 44 | /** | 40 | /** |
| 45 | * 信息流广告素材 | 41 | * 信息流广告素材 |
| 46 | */ | 42 | */ |
| 47 | - matInfo: CompAdvMatInfoBean = {} as CompAdvMatInfoBean | ||
| 48 | - | 43 | + matInfo: CompAdvMatInfoBean = new CompAdvMatInfoBean |
| 49 | pageId?: string; | 44 | pageId?: string; |
| 50 | objectType?: string; | 45 | objectType?: string; |
| 46 | + hasMore: number = 1 | ||
| 47 | + | ||
| 48 | + // keyGenerator相关字符串,用于刷新list布局 | ||
| 49 | + timestamp: String = '1' | ||
| 50 | + /** | ||
| 51 | + * 创建新的compbean对象 | ||
| 52 | + * @param old | ||
| 53 | + * @returns | ||
| 54 | + */ | ||
| 55 | + static createNewsBean(old: CompDTO): CompDTO { | ||
| 56 | + let comp: CompDTO = new CompDTO | ||
| 57 | + comp.compStyle = old.compStyle | ||
| 58 | + comp.compType = old.compType | ||
| 59 | + comp.operDataList = old.operDataList | ||
| 60 | + comp.extraData = old.extraData | ||
| 61 | + comp.matInfo = old.matInfo | ||
| 62 | + | ||
| 63 | + comp.backgroundColor = old.backgroundColor | ||
| 64 | + comp.backgroundImgUrl = old.backgroundImgUrl | ||
| 65 | + comp.cityCode = old.cityCode | ||
| 66 | + comp.districtCode = old.districtCode | ||
| 67 | + comp.provinceCode = old.provinceCode | ||
| 68 | + comp.hasAdInfo = old.hasAdInfo | ||
| 69 | + comp.id = old.id | ||
| 70 | + comp.imgSize = old.imgSize | ||
| 71 | + comp.innerUrl = old.innerUrl | ||
| 72 | + comp.linkUrl = old.linkUrl | ||
| 73 | + comp.name = old.name | ||
| 74 | + comp.objectId = old.objectId | ||
| 75 | + comp.objectTitle = old.objectTitle | ||
| 76 | + comp.posterSize = old.posterSize | ||
| 77 | + comp.posterUrl = old.posterUrl | ||
| 78 | + comp.sortValue = old.sortValue | ||
| 79 | + comp.subType = old.subType | ||
| 80 | + comp.imageScale = old.imageScale | ||
| 81 | + comp.audioDataList = old.audioDataList | ||
| 82 | + comp.titleShowPolicy = old.titleShowPolicy | ||
| 83 | + comp.pageId = old.pageId | ||
| 84 | + comp.extraData = old.extraData | ||
| 85 | + comp.dataSourceType = old.dataSourceType | ||
| 86 | + comp.objectType = old.objectType | ||
| 87 | + comp.hasMore = old.hasMore | ||
| 88 | + | ||
| 89 | + return comp | ||
| 90 | + } | ||
| 51 | } | 91 | } |
| @@ -10,6 +10,7 @@ import { BaseDTO } from '../component/BaseDTO'; | @@ -10,6 +10,7 @@ import { BaseDTO } from '../component/BaseDTO'; | ||
| 10 | 10 | ||
| 11 | @Observed | 11 | @Observed |
| 12 | export class ContentDTO implements BaseDTO { | 12 | export class ContentDTO implements BaseDTO { |
| 13 | + shareFlag?:string='1'; | ||
| 13 | appStyle: string = ''; | 14 | appStyle: string = ''; |
| 14 | cityCode: string = ''; | 15 | cityCode: string = ''; |
| 15 | coverSize: string = ''; | 16 | coverSize: string = ''; |
| @@ -61,6 +62,7 @@ export class ContentDTO implements BaseDTO { | @@ -61,6 +62,7 @@ export class ContentDTO implements BaseDTO { | ||
| 61 | videoInfo: VideoInfoDTO = {} as VideoInfoDTO; // 视频新闻信息【BFF聚合】,视频非原片+清晰度最高的 | 62 | videoInfo: VideoInfoDTO = {} as VideoInfoDTO; // 视频新闻信息【BFF聚合】,视频非原片+清晰度最高的 |
| 62 | 63 | ||
| 63 | newsSummary: string = ''; //appstyle:2 ,新闻详情 | 64 | newsSummary: string = ''; //appstyle:2 ,新闻详情 |
| 65 | + contentText?: string =''; | ||
| 64 | 66 | ||
| 65 | // 二次请求接口,返回的数据,这里组装到content里; | 67 | // 二次请求接口,返回的数据,这里组装到content里; |
| 66 | interactData?: InteractDataDTO; | 68 | interactData?: InteractDataDTO; |
| @@ -2,6 +2,8 @@ | @@ -2,6 +2,8 @@ | ||
| 2 | * page接口返回的Page数据DTO | 2 | * page接口返回的Page数据DTO |
| 3 | */ | 3 | */ |
| 4 | import { AdvRuleBean, CompAdvBean } from '../adv/AdvsRuleBean'; | 4 | import { AdvRuleBean, CompAdvBean } from '../adv/AdvsRuleBean'; |
| 5 | +import { ArrayList } from '@kit.ArkTS'; | ||
| 6 | +import { CompDTO } from '../component/CompDTO'; | ||
| 5 | 7 | ||
| 6 | export interface PageInfoDTO { | 8 | export interface PageInfoDTO { |
| 7 | pageId: string; // 页面id | 9 | pageId: string; // 页面id |
| @@ -27,6 +29,18 @@ export interface PageInfoDTO { | @@ -27,6 +29,18 @@ export interface PageInfoDTO { | ||
| 27 | */ | 29 | */ |
| 28 | cornersAdv2: CompAdvBean[] | 30 | cornersAdv2: CompAdvBean[] |
| 29 | 31 | ||
| 32 | + | ||
| 33 | + // 本地字段 | ||
| 34 | + /* | ||
| 35 | + 记录一次请求获取到的楼层comp数据,如 完成一次刷新到结束,获取所有楼层的稿件数据 | ||
| 36 | + */ | ||
| 37 | + oneRequestPageGroupCompList: ArrayList<CompDTO> | ||
| 38 | + | ||
| 39 | + /* | ||
| 40 | + 记录页面楼层所有的信息流广告数据 | ||
| 41 | + */ | ||
| 42 | + pageAdList:CompAdvBean[] | ||
| 43 | + | ||
| 30 | } | 44 | } |
| 31 | 45 | ||
| 32 | export interface ChannelInfoDTO { | 46 | export interface ChannelInfoDTO { |
| @@ -87,3 +87,5 @@ export { WDLiveViewDefaultType } from "./src/main/ets/components/view/LiveEmptyC | @@ -87,3 +87,5 @@ export { WDLiveViewDefaultType } from "./src/main/ets/components/view/LiveEmptyC | ||
| 87 | 87 | ||
| 88 | export { LiveFollowComponent } from "./src/main/ets/components/cardCommon/LiveFollowComponent" | 88 | export { LiveFollowComponent } from "./src/main/ets/components/cardCommon/LiveFollowComponent" |
| 89 | 89 | ||
| 90 | +export { publishCommentModel } from './src/main/ets/components/comment/model/PublishCommentModel'; | ||
| 91 | + |
| @@ -16,6 +16,7 @@ import { Card17Component } from './cardview/Card17Component'; | @@ -16,6 +16,7 @@ import { Card17Component } from './cardview/Card17Component'; | ||
| 16 | import { Card19Component } from './cardview/Card19Component'; | 16 | import { Card19Component } from './cardview/Card19Component'; |
| 17 | import { Card20Component } from './cardview/Card20Component'; | 17 | import { Card20Component } from './cardview/Card20Component'; |
| 18 | import { Card21Component } from './cardview/Card21Component'; | 18 | import { Card21Component } from './cardview/Card21Component'; |
| 19 | +import { SearchContentComponent } from './cardview/SearchContentComponent'; | ||
| 19 | 20 | ||
| 20 | /** | 21 | /** |
| 21 | * card适配器,卡片样式汇总,依据ContentDTO#appStyle | 22 | * card适配器,卡片样式汇总,依据ContentDTO#appStyle |
| @@ -24,53 +25,58 @@ import { Card21Component } from './cardview/Card21Component'; | @@ -24,53 +25,58 @@ import { Card21Component } from './cardview/Card21Component'; | ||
| 24 | @Component | 25 | @Component |
| 25 | export struct CardParser { | 26 | export struct CardParser { |
| 26 | @State contentDTO: ContentDTO = new ContentDTO(); | 27 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 27 | - @State compDTO: CompDTO = {} as CompDTO | 28 | + @ObjectLink compDTO: CompDTO |
| 28 | 29 | ||
| 29 | build() { | 30 | build() { |
| 30 | - this.contentBuilder(this.contentDTO, this.compDTO); | 31 | + this.contentBuilder(this.contentDTO); |
| 31 | } | 32 | } |
| 32 | 33 | ||
| 33 | @Builder | 34 | @Builder |
| 34 | - contentBuilder(contentDTO: ContentDTO, compDTO: CompDTO) { | ||
| 35 | - if (contentDTO.appStyle === CompStyle.Card_02) { | ||
| 36 | - Card2Component({ contentDTO }) | ||
| 37 | - } else if (contentDTO.appStyle === CompStyle.Card_03) { | ||
| 38 | - Card3Component({ contentDTO }) | ||
| 39 | - } else if (contentDTO.appStyle === CompStyle.Card_04) { | ||
| 40 | - Card4Component({ contentDTO }) | ||
| 41 | - } else if (contentDTO.appStyle === CompStyle.Card_05) { | ||
| 42 | - Card5Component({ contentDTO, titleShowPolicy: compDTO.titleShowPolicy }) | ||
| 43 | - } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle | ||
| 44 | - .Card_13) { | ||
| 45 | - Card6Component({ contentDTO }) | ||
| 46 | - } else if (contentDTO.appStyle === CompStyle.Card_09) { | ||
| 47 | - Card9Component({ contentDTO }) | ||
| 48 | - } else if (contentDTO.appStyle === CompStyle.Card_10) { | ||
| 49 | - Card10Component({ contentDTO }) | ||
| 50 | - } else if (contentDTO.appStyle === CompStyle.Card_11) { | ||
| 51 | - Card11Component({ contentDTO }) | ||
| 52 | - } else if (contentDTO.appStyle === CompStyle.Card_12) { | ||
| 53 | - Card12Component({ contentDTO }) | ||
| 54 | - } else if (contentDTO.appStyle === CompStyle.Card_14) { | ||
| 55 | - Card14Component({ contentDTO }) | ||
| 56 | - } else if (contentDTO.appStyle === CompStyle.Card_15) { | ||
| 57 | - Card15Component({ contentDTO }) | ||
| 58 | - } else if (contentDTO.appStyle === CompStyle.Card_16) { | ||
| 59 | - Card16Component({ contentDTO }) | ||
| 60 | - } else if (contentDTO.appStyle === CompStyle.Card_17) { | ||
| 61 | - Card17Component({ contentDTO }) | ||
| 62 | - } else if (contentDTO.appStyle === CompStyle.Card_19) { | ||
| 63 | - Card19Component({ contentDTO }) | ||
| 64 | - } else if (contentDTO.appStyle === CompStyle.Card_20) { | ||
| 65 | - Card20Component({ contentDTO }) | ||
| 66 | - } else if (contentDTO.appStyle === CompStyle.Card_21) { | ||
| 67 | - Card21Component({ contentDTO }) | 35 | + contentBuilder(contentDTO: ContentDTO) { |
| 36 | + // Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO }) | ||
| 37 | + if (!!contentDTO.contentText) { | ||
| 38 | + SearchContentComponent({ contentDTO }) | ||
| 68 | } else { | 39 | } else { |
| 69 | - // todo:组件未实现 / Component Not Implemented | ||
| 70 | - // Text(contentDTO.appStyle) | ||
| 71 | - // .width(CommonConstants.FULL_PARENT) | ||
| 72 | - // .padding(10) | ||
| 73 | - // .backgroundColor(Color.Brown) // 展示本页未实现的compStyle | 40 | + if (contentDTO.appStyle === CompStyle.Card_02) { |
| 41 | + Card2Component({ compDTO: this.compDTO, contentDTO }) | ||
| 42 | + } else if (contentDTO.appStyle === CompStyle.Card_03) { | ||
| 43 | + Card3Component({ compDTO: this.compDTO, contentDTO }) | ||
| 44 | + } else if (contentDTO.appStyle === CompStyle.Card_04) { | ||
| 45 | + Card4Component({ compDTO: this.compDTO, contentDTO }) | ||
| 46 | + } else if (contentDTO.appStyle === CompStyle.Card_05) { | ||
| 47 | + Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy, compDTO: this.compDTO }) | ||
| 48 | + } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle | ||
| 49 | + .Card_13) { | ||
| 50 | + Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO }) | ||
| 51 | + } else if (contentDTO.appStyle === CompStyle.Card_09) { | ||
| 52 | + Card9Component({ contentDTO }) | ||
| 53 | + } else if (contentDTO.appStyle === CompStyle.Card_10) { | ||
| 54 | + Card10Component({ compDTO: this.compDTO, contentDTO }) | ||
| 55 | + } else if (contentDTO.appStyle === CompStyle.Card_11) { | ||
| 56 | + Card11Component({ compDTO: this.compDTO, contentDTO }) | ||
| 57 | + } else if (contentDTO.appStyle === CompStyle.Card_12) { | ||
| 58 | + Card12Component({ contentDTO }) | ||
| 59 | + } else if (contentDTO.appStyle === CompStyle.Card_14) { | ||
| 60 | + Card14Component({ contentDTO }) | ||
| 61 | + } else if (contentDTO.appStyle === CompStyle.Card_15) { | ||
| 62 | + Card15Component({ contentDTO }) | ||
| 63 | + } else if (contentDTO.appStyle === CompStyle.Card_16) { | ||
| 64 | + Card16Component({ contentDTO }) | ||
| 65 | + } else if (contentDTO.appStyle === CompStyle.Card_17) { | ||
| 66 | + Card17Component({ compDTO: this.compDTO, contentDTO }) | ||
| 67 | + } else if (contentDTO.appStyle === CompStyle.Card_19) { | ||
| 68 | + Card19Component({ contentDTO }) | ||
| 69 | + } else if (contentDTO.appStyle === CompStyle.Card_20) { | ||
| 70 | + Card20Component({ contentDTO }) | ||
| 71 | + } else if (contentDTO.appStyle === CompStyle.Card_21) { | ||
| 72 | + Card21Component({ contentDTO }) | ||
| 73 | + } else { | ||
| 74 | + // todo:组件未实现 / Component Not Implemented | ||
| 75 | + // Text(contentDTO.appStyle) | ||
| 76 | + // .width(CommonConstants.FULL_PARENT) | ||
| 77 | + // .padding(10) | ||
| 78 | + // .backgroundColor(Color.Brown) // 展示本页未实现的compStyle | ||
| 79 | + } | ||
| 74 | } | 80 | } |
| 75 | } | 81 | } |
| 76 | } | 82 | } |
| @@ -30,23 +30,28 @@ export struct CarderInteraction { | @@ -30,23 +30,28 @@ export struct CarderInteraction { | ||
| 30 | this.likeBean['title'] = this.contentDetailData.newsTitle + '' | 30 | this.likeBean['title'] = this.contentDetailData.newsTitle + '' |
| 31 | this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + '' | 31 | this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + '' |
| 32 | this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' | 32 | this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' |
| 33 | + this.contentDTO.shareFlag = this.contentDTO.shareFlag?this.contentDTO.shareFlag:'1' | ||
| 34 | + console.log('是否显示分享',this.contentDTO.shareFlag) | ||
| 33 | } | 35 | } |
| 34 | 36 | ||
| 35 | build() { | 37 | build() { |
| 36 | Row() { | 38 | Row() { |
| 37 | - Row() { | ||
| 38 | - Image($r('app.media.CarderInteraction_share')) | ||
| 39 | - .width(18) | ||
| 40 | - .height(18) | ||
| 41 | - Text('分享') | ||
| 42 | - .margin({ left: 4 }) | ||
| 43 | - .fontSize(14) | ||
| 44 | - .fontColor('#666666') | 39 | + if(this.contentDTO.shareFlag === '1'){ |
| 40 | + Row() { | ||
| 41 | + Image($r('app.media.CarderInteraction_share')) | ||
| 42 | + .width(18) | ||
| 43 | + .height(18) | ||
| 44 | + Text('分享') | ||
| 45 | + .margin({ left: 4 }) | ||
| 46 | + .fontSize(14) | ||
| 47 | + .fontColor('#666666') | ||
| 48 | + } | ||
| 49 | + .justifyContent(FlexAlign.Center) | ||
| 50 | + .onClick(() => { | ||
| 51 | + WDShare.shareContent(this.contentDetailData) | ||
| 52 | + }) | ||
| 45 | } | 53 | } |
| 46 | - .justifyContent(FlexAlign.Center) | ||
| 47 | - .onClick(() => { | ||
| 48 | - WDShare.shareContent(this.contentDetailData) | ||
| 49 | - }) | 54 | + |
| 50 | 55 | ||
| 51 | Row() { | 56 | Row() { |
| 52 | Image($r('app.media.CarderInteraction_comment')) | 57 | Image($r('app.media.CarderInteraction_comment')) |
| @@ -66,11 +71,11 @@ export struct CarderInteraction { | @@ -66,11 +71,11 @@ export struct CarderInteraction { | ||
| 66 | } | 71 | } |
| 67 | .width('100%') | 72 | .width('100%') |
| 68 | .margin({ top: 11 }) | 73 | .margin({ top: 11 }) |
| 69 | - .padding({ | ||
| 70 | - left: 21, | ||
| 71 | - right: 21 | ||
| 72 | - }) | ||
| 73 | - .justifyContent(FlexAlign.SpaceBetween) | 74 | + // .padding({ |
| 75 | + // left: 21, | ||
| 76 | + // right: 21 | ||
| 77 | + // }) | ||
| 78 | + .justifyContent(FlexAlign.SpaceAround) | ||
| 74 | .alignItems(VerticalAlign.Center) | 79 | .alignItems(VerticalAlign.Center) |
| 75 | } | 80 | } |
| 76 | 81 |
| 1 | import { CompDTO } from 'wdBean'; | 1 | import { CompDTO } from 'wdBean'; |
| 2 | -import { CommonConstants, CompStyle } from 'wdConstant'; | ||
| 3 | -import { LabelComponent } from './view/LabelComponent'; | 2 | +import { CommonConstants, CompStyle } from 'wdConstant/Index'; |
| 3 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 4 | +import PageModel from '../viewmodel/PageModel'; | ||
| 5 | +import { CardParser } from './CardParser'; | ||
| 6 | +import { Card2Component } from './cardview/Card2Component'; | ||
| 7 | +import { Card5Component } from './cardview/Card5Component'; | ||
| 8 | +import { AdvCardParser } from './cardViewAdv/AdvCardParser'; | ||
| 9 | +import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01'; | ||
| 10 | +import { ZhGridLayout02 } from './compview/ZhGridLayout02'; | ||
| 11 | +import { ZhGridLayout03 } from './compview/ZhGridLayout03'; | ||
| 12 | +import { ZhSingleColumn04 } from './compview/ZhSingleColumn04'; | ||
| 13 | +import { ZhSingleColumn05 } from './compview/ZhSingleColumn05'; | ||
| 14 | +import { ZhSingleColumn09 } from './compview/ZhSingleColumn09'; | ||
| 15 | +import { ZhSingleRow02 } from './compview/ZhSingleRow02'; | ||
| 16 | +import { ZhSingleRow03 } from './compview/ZhSingleRow03'; | ||
| 17 | +import { ZhSingleRow04 } from './compview/ZhSingleRow04'; | ||
| 18 | +import { ZhSingleRow06 } from './compview/ZhSingleRow06'; | ||
| 4 | import { | 19 | import { |
| 5 | HorizontalStrokeCardThreeTwoRadioForMoreComponent | 20 | HorizontalStrokeCardThreeTwoRadioForMoreComponent |
| 6 | } from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent'; | 21 | } from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent'; |
| 7 | import { | 22 | import { |
| 8 | HorizontalStrokeCardThreeTwoRadioForOneComponent | 23 | HorizontalStrokeCardThreeTwoRadioForOneComponent |
| 9 | } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent'; | 24 | } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent'; |
| 10 | -import { ZhSingleRow02 } from './compview/ZhSingleRow02'; | ||
| 11 | -import { ZhSingleRow03 } from './compview/ZhSingleRow03'; | ||
| 12 | -import { ZhSingleRow04 } from './compview/ZhSingleRow04'; | ||
| 13 | -import { ZhSingleRow06 } from './compview/ZhSingleRow06'; | ||
| 14 | -import { ZhSingleColumn04 } from './compview/ZhSingleColumn04'; | ||
| 15 | -import { ZhSingleColumn09 } from './compview/ZhSingleColumn09'; | ||
| 16 | -import { ZhGridLayout03 } from './compview/ZhGridLayout03'; | ||
| 17 | -import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01'; | ||
| 18 | -import { CardParser } from './CardParser'; | ||
| 19 | -import { ZhGridLayout02 } from './compview/ZhGridLayout02'; | ||
| 20 | -import { Card2Component } from './cardview/Card2Component'; | ||
| 21 | -import { Card5Component } from './cardview/Card5Component'; | ||
| 22 | -import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 23 | -import { AdvCardParser } from './cardViewAdv/AdvCardParser'; | ||
| 24 | -import PageModel from '../viewmodel/PageModel'; | 25 | +import { LabelComponent } from './view/LabelComponent'; |
| 25 | import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'; | 26 | import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'; |
| 26 | 27 | ||
| 27 | /** | 28 | /** |
| 28 | * comp适配器. | 29 | * comp适配器. |
| 29 | * 首页楼层comp解析器. | 30 | * 首页楼层comp解析器. |
| 30 | */ | 31 | */ |
| 31 | -@Preview | ||
| 32 | @Component | 32 | @Component |
| 33 | export struct CompParser { | 33 | export struct CompParser { |
| 34 | - @State compDTO: CompDTO = {} as CompDTO | 34 | + @ObjectLink compDTO: CompDTO |
| 35 | @State compIndex: number = 0; | 35 | @State compIndex: number = 0; |
| 36 | @State private pageModel: PageModel = new PageModel(); | 36 | @State private pageModel: PageModel = new PageModel(); |
| 37 | 37 | ||
| @@ -39,90 +39,95 @@ export struct CompParser { | @@ -39,90 +39,95 @@ export struct CompParser { | ||
| 39 | Column() { | 39 | Column() { |
| 40 | if (this.compDTO.name != "月度排行卡") { | 40 | if (this.compDTO.name != "月度排行卡") { |
| 41 | 41 | ||
| 42 | - this.componentBuilder(this.compDTO, this.compIndex); | 42 | + this.componentBuilder(); |
| 43 | } | 43 | } |
| 44 | } | 44 | } |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | @Builder | 47 | @Builder |
| 48 | - componentBuilder(compDTO: CompDTO, compIndex: number) { | ||
| 49 | - //if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口 | ||
| 50 | - if (compDTO.compStyle === CompStyle.Label_03) { | ||
| 51 | - LabelComponent({ compDTO: compDTO }) | ||
| 52 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 53 | - } else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { | ||
| 54 | - ZhCarouselLayout01({ compDTO: compDTO }) | ||
| 55 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 56 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && | ||
| 57 | - compDTO.imageScale === 2) { // && compDTO.name ==="横划卡" | 48 | + componentBuilder() { |
| 49 | + | ||
| 50 | + //CardParser({ contentDTO: this.compDTO.operDataList[0], compDTO:this.compDTO }) | ||
| 58 | 51 | ||
| 59 | - LiveHorizontalCardComponent({ compDTO: compDTO }) | ||
| 60 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 61 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 3) { | ||
| 62 | - if (compDTO.operDataList.length > 1) { | ||
| 63 | - HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: compDTO }) | 52 | + if (this.compDTO.operDataList[0]?.objectType !== '3' && |
| 53 | + this.compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口 | ||
| 54 | + if (this.compDTO.compStyle === CompStyle.Label_03) { | ||
| 55 | + LabelComponent({ compDTO: this.compDTO }) | ||
| 56 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 57 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { | ||
| 58 | + ZhCarouselLayout01({ compDTO: this.compDTO }) | ||
| 59 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 60 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 && | ||
| 61 | + this.compDTO.imageScale === 2) { // && compDTO.name ==="横划卡" | ||
| 62 | + | ||
| 63 | + LiveHorizontalCardComponent({ compDTO: this.compDTO }) | ||
| 64 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 65 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 && this.compDTO.imageScale === 3) { | ||
| 66 | + if (this.compDTO.operDataList.length > 1) { | ||
| 67 | + HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: this.compDTO }) | ||
| 68 | + } else { | ||
| 69 | + HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: this.compDTO }) | ||
| 70 | + } | ||
| 71 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 72 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_02) { | ||
| 73 | + ZhSingleRow02({ compDTO: this.compDTO }) | ||
| 74 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 75 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_03) { | ||
| 76 | + ZhSingleRow03({ compDTO: this.compDTO }) | ||
| 77 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 78 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { | ||
| 79 | + ZhGridLayout02({ compDTO: this.compDTO }) | ||
| 80 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 81 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { | ||
| 82 | + ZhGridLayout03({ compDTO: this.compDTO }) | ||
| 83 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 84 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_04) { | ||
| 85 | + ZhSingleRow04({ compDTO: this.compDTO }) | ||
| 86 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 87 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_05) { | ||
| 88 | + // ZhSingleRow05({ compDTO }) | ||
| 89 | + // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 90 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_06) { | ||
| 91 | + ZhSingleRow06({ compDTO: this.compDTO }) | ||
| 92 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 93 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_02) { | ||
| 94 | + //头图卡 和comStyle 2相同, | ||
| 95 | + Card5Component({ contentDTO: this.compDTO.operDataList[0], titleShowPolicy: this.compDTO.titleShowPolicy }) | ||
| 96 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 97 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_03) { | ||
| 98 | + // 大图卡 | ||
| 99 | + Card2Component({ compDTO: this.compDTO, contentDTO: this.compDTO.operDataList[0] }) | ||
| 100 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 101 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_04) { | ||
| 102 | + ZhSingleColumn04({ compDTO: this.compDTO }) | ||
| 103 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 104 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_05) { | ||
| 105 | + // ZhSingleColumn05({ compDTO: compDTO }) | ||
| 106 | + // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 107 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_09) { | ||
| 108 | + Divider().strokeWidth(3).color('#ffffff').padding({ left: 16, right: 16 }).margin({top: -3}) | ||
| 109 | + Divider().strokeWidth(6).color('#f5f5f5') | ||
| 110 | + ZhSingleColumn09({ compDTO: this.compDTO }) | ||
| 111 | + Divider().strokeWidth(6).color('#f5f5f5') | ||
| 112 | + } else if (this.compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告 | ||
| 113 | + AdvCardParser({ pageModel: this.pageModel, compDTO: this.compDTO }) | ||
| 114 | + //Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 }) | ||
| 115 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 116 | + } else if (!Number.isNaN(Number(this.compDTO.compStyle))) { | ||
| 117 | + CardParser({ contentDTO: this.compDTO.operDataList[0], compDTO: this.compDTO }); | ||
| 118 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 64 | } else { | 119 | } else { |
| 65 | - HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO }) | 120 | + Text(this.compDTO.compStyle) |
| 121 | + .width(CommonConstants.FULL_PARENT) | ||
| 122 | + .padding(10) | ||
| 123 | + .onClick(() => { | ||
| 124 | + if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_06) { //精选评论 | ||
| 125 | + WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage) | ||
| 126 | + } | ||
| 127 | + }) | ||
| 128 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 66 | } | 129 | } |
| 67 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 68 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) { | ||
| 69 | - ZhSingleRow02({ compDTO }) | ||
| 70 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 71 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) { | ||
| 72 | - ZhSingleRow03({ compDTO: compDTO }) | ||
| 73 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 74 | - } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { | ||
| 75 | - ZhGridLayout02({ compDTO: compDTO }) | ||
| 76 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 77 | - } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { | ||
| 78 | - ZhGridLayout03({ compDTO: compDTO }) | ||
| 79 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 80 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) { | ||
| 81 | - ZhSingleRow04({ compDTO: compDTO }) | ||
| 82 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 83 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_05) { | ||
| 84 | - // ZhSingleRow05({ compDTO }) | ||
| 85 | - // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 86 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) { | ||
| 87 | - ZhSingleRow06({ compDTO }) | ||
| 88 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 89 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) { | ||
| 90 | - //头图卡 和comStyle 2相同, | ||
| 91 | - Card5Component({ contentDTO: compDTO.operDataList[0], titleShowPolicy: compDTO.titleShowPolicy }) | ||
| 92 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 93 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) { | ||
| 94 | - // 大图卡 | ||
| 95 | - Card2Component({ contentDTO: compDTO.operDataList[0] }) | ||
| 96 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 97 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) { | ||
| 98 | - ZhSingleColumn04({ compDTO: compDTO }) | ||
| 99 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 100 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) { | ||
| 101 | - // ZhSingleColumn05({ compDTO: compDTO }) | ||
| 102 | - // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 103 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_09) { | ||
| 104 | - ZhSingleColumn09({ compDTO }) | ||
| 105 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 106 | - } else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告 | ||
| 107 | - AdvCardParser({ pageModel: this.pageModel, compDTO }) | ||
| 108 | - //Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 }) | ||
| 109 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 110 | - } else if (!Number.isNaN(Number(compDTO.compStyle))) { | ||
| 111 | - CardParser({ contentDTO: compDTO.operDataList[0], compDTO }); | ||
| 112 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 113 | - } else { | ||
| 114 | - Text(compDTO.compStyle) | ||
| 115 | - .width(CommonConstants.FULL_PARENT) | ||
| 116 | - .padding(10) | ||
| 117 | - .onClick(() => { | ||
| 118 | - if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) { //精选评论 | ||
| 119 | - WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage) | ||
| 120 | - } | ||
| 121 | - }) | ||
| 122 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 123 | } | 130 | } |
| 124 | - } | ||
| 125 | - | ||
| 126 | - // } | ||
| 127 | -} | ||
| 128 | 131 | ||
| 132 | + } | ||
| 133 | +} |
| @@ -74,6 +74,7 @@ export struct DynamicDetailComponent { | @@ -74,6 +74,7 @@ export struct DynamicDetailComponent { | ||
| 74 | @State isPageEnd: boolean = false | 74 | @State isPageEnd: boolean = false |
| 75 | @State publishCommentModel: publishCommentModel = new publishCommentModel() | 75 | @State publishCommentModel: publishCommentModel = new publishCommentModel() |
| 76 | @State reachEndIncreament: number = 0 | 76 | @State reachEndIncreament: number = 0 |
| 77 | + @State operationButtonList: string[] = [] | ||
| 77 | 78 | ||
| 78 | async aboutToAppear() { | 79 | async aboutToAppear() { |
| 79 | await this.getContentDetailData() | 80 | await this.getContentDetailData() |
| @@ -106,7 +107,7 @@ export struct DynamicDetailComponent { | @@ -106,7 +107,7 @@ export struct DynamicDetailComponent { | ||
| 106 | //分割线 | 107 | //分割线 |
| 107 | Image($r('app.media.ic_news_detail_division')) | 108 | Image($r('app.media.ic_news_detail_division')) |
| 108 | .width('100%') | 109 | .width('100%') |
| 109 | - .height($r('app.float.margin_7')) | 110 | + .height($r('app.float.margin_12')) |
| 110 | .padding({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) | 111 | .padding({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) |
| 111 | Stack({ alignContent: Alignment.Bottom }) { | 112 | Stack({ alignContent: Alignment.Bottom }) { |
| 112 | if (!this.isNetConnected) { | 113 | if (!this.isNetConnected) { |
| @@ -279,12 +280,18 @@ export struct DynamicDetailComponent { | @@ -279,12 +280,18 @@ export struct DynamicDetailComponent { | ||
| 279 | } | 280 | } |
| 280 | Flex({ direction: FlexDirection.Row }) { | 281 | Flex({ direction: FlexDirection.Row }) { |
| 281 | Image($r('app.media.icon_long_pic')) | 282 | Image($r('app.media.icon_long_pic')) |
| 282 | - .width(14) | ||
| 283 | - .height(14) | 283 | + .width(12) |
| 284 | + .height(12) | ||
| 284 | .margin({ right: 4 }) | 285 | .margin({ right: 4 }) |
| 285 | Text('长图') | 286 | Text('长图') |
| 286 | - .fontSize(12) | 287 | + .fontSize(10) |
| 287 | .fontWeight(400) | 288 | .fontWeight(400) |
| 289 | + .textShadow({ | ||
| 290 | + radius: 1, | ||
| 291 | + color: `rgba(0,0,0,0.5)`, | ||
| 292 | + offsetY:1, | ||
| 293 | + offsetX:1 | ||
| 294 | + }) | ||
| 288 | .fontColor(0xffffff) | 295 | .fontColor(0xffffff) |
| 289 | .fontFamily('PingFang SC') | 296 | .fontFamily('PingFang SC') |
| 290 | } | 297 | } |
| @@ -292,6 +299,7 @@ export struct DynamicDetailComponent { | @@ -292,6 +299,7 @@ export struct DynamicDetailComponent { | ||
| 292 | .padding({ bottom: 9 }) | 299 | .padding({ bottom: 9 }) |
| 293 | 300 | ||
| 294 | } | 301 | } |
| 302 | + | ||
| 295 | } | 303 | } |
| 296 | .onClick(async (event: ClickEvent) => { | 304 | .onClick(async (event: ClickEvent) => { |
| 297 | let retvalue = await FastClickUtil.isMinDelayTime() | 305 | let retvalue = await FastClickUtil.isMinDelayTime() |
| @@ -326,9 +334,33 @@ export struct DynamicDetailComponent { | @@ -326,9 +334,33 @@ export struct DynamicDetailComponent { | ||
| 326 | GridCol({ | 334 | GridCol({ |
| 327 | span: { xs: 4 } | 335 | span: { xs: 4 } |
| 328 | }) { | 336 | }) { |
| 329 | - Image(item.picPath) | ||
| 330 | - .aspectRatio(1) | ||
| 331 | - .borderRadius(this.caclImageRadius(index)) | 337 | + Stack({alignContent: Alignment.BottomEnd}) { |
| 338 | + Image(item.picPath) | ||
| 339 | + .aspectRatio(1) | ||
| 340 | + .borderRadius(this.caclImageRadius(index)) | ||
| 341 | + if(this.getPicType(item) !== 3){ | ||
| 342 | + Flex({ direction: FlexDirection.Row }) { | ||
| 343 | + Image($r('app.media.icon_long_pic')) | ||
| 344 | + .width(12) | ||
| 345 | + .height(12) | ||
| 346 | + .margin({ right: 4 }) | ||
| 347 | + Text('长图') | ||
| 348 | + .fontSize(10) | ||
| 349 | + .fontWeight(400) | ||
| 350 | + .textShadow({ | ||
| 351 | + radius: 1, | ||
| 352 | + color: `rgba(0,0,0,0.5)`, | ||
| 353 | + offsetY:1, | ||
| 354 | + offsetX:1 | ||
| 355 | + }) | ||
| 356 | + .fontColor(0xffffff) | ||
| 357 | + .fontFamily('PingFang SC') | ||
| 358 | + } | ||
| 359 | + .width(48) | ||
| 360 | + .align(Alignment.BottomEnd) | ||
| 361 | + .padding({ bottom: 3 }) | ||
| 362 | + } | ||
| 363 | + } | ||
| 332 | } | 364 | } |
| 333 | .onClick(async (event: ClickEvent) => { | 365 | .onClick(async (event: ClickEvent) => { |
| 334 | let retvalue = await FastClickUtil.isMinDelayTime() | 366 | let retvalue = await FastClickUtil.isMinDelayTime() |
| @@ -341,9 +373,33 @@ export struct DynamicDetailComponent { | @@ -341,9 +373,33 @@ export struct DynamicDetailComponent { | ||
| 341 | GridCol({ | 373 | GridCol({ |
| 342 | span: { sm: 4, lg: 3 } | 374 | span: { sm: 4, lg: 3 } |
| 343 | }) { | 375 | }) { |
| 344 | - Image(item.picPath) | ||
| 345 | - .aspectRatio(1) | ||
| 346 | - .borderRadius(this.caclImageRadius(index)) | 376 | + Stack({alignContent: Alignment.BottomEnd}) { |
| 377 | + Image(item.picPath) | ||
| 378 | + .aspectRatio(1) | ||
| 379 | + .borderRadius(this.caclImageRadius(index)) | ||
| 380 | + if(this.getPicType(item) !== 3){ | ||
| 381 | + Flex({ direction: FlexDirection.Row }) { | ||
| 382 | + Image($r('app.media.icon_long_pic')) | ||
| 383 | + .width(12) | ||
| 384 | + .height(12) | ||
| 385 | + .margin({ right: 4 }) | ||
| 386 | + Text('长图') | ||
| 387 | + .fontSize(10) | ||
| 388 | + .fontWeight(400) | ||
| 389 | + .textShadow({ | ||
| 390 | + radius: 1, | ||
| 391 | + color: `rgba(0,0,0,0.5)`, | ||
| 392 | + offsetY:1, | ||
| 393 | + offsetX:1 | ||
| 394 | + }) | ||
| 395 | + .fontColor(0xffffff) | ||
| 396 | + .fontFamily('PingFang SC') | ||
| 397 | + } | ||
| 398 | + .width(48) | ||
| 399 | + .align(Alignment.BottomEnd) | ||
| 400 | + .padding({ bottom: 3}) | ||
| 401 | + } | ||
| 402 | + } | ||
| 347 | } | 403 | } |
| 348 | .onClick(async (event: ClickEvent) => { | 404 | .onClick(async (event: ClickEvent) => { |
| 349 | let retvalue = await FastClickUtil.isMinDelayTime() | 405 | let retvalue = await FastClickUtil.isMinDelayTime() |
| @@ -481,15 +537,7 @@ export struct DynamicDetailComponent { | @@ -481,15 +537,7 @@ export struct DynamicDetailComponent { | ||
| 481 | if (this.contentDetailData?.openComment) { | 537 | if (this.contentDetailData?.openComment) { |
| 482 | Divider().strokeWidth(6).color('#f5f5f5').margin({ top: $r('app.float.margin_24') }) | 538 | Divider().strokeWidth(6).color('#f5f5f5').margin({ top: $r('app.float.margin_24') }) |
| 483 | CommentComponent({ | 539 | CommentComponent({ |
| 484 | - publishCommentModel: { | ||
| 485 | - targetId: String(this.contentDetailData?.newsId || ''), | ||
| 486 | - targetRelId: this.contentDetailData?.reLInfo?.relId, | ||
| 487 | - targetTitle: this.contentDetailData?.newsTitle, | ||
| 488 | - targetRelType: this.contentDetailData?.reLInfo?.relType, | ||
| 489 | - targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId), | ||
| 490 | - keyArticle: String(this.contentDetailData?.keyArticle), | ||
| 491 | - targetType: String(this.contentDetailData?.newsType), | ||
| 492 | - } as publishCommentModel | 540 | + publishCommentModel: this.publishCommentModel |
| 493 | }) | 541 | }) |
| 494 | } | 542 | } |
| 495 | Blank().layoutWeight(1) | 543 | Blank().layoutWeight(1) |
| @@ -506,7 +554,7 @@ export struct DynamicDetailComponent { | @@ -506,7 +554,7 @@ export struct DynamicDetailComponent { | ||
| 506 | OperRowListView({ | 554 | OperRowListView({ |
| 507 | contentDetailData: this.contentDetailData, | 555 | contentDetailData: this.contentDetailData, |
| 508 | publishCommentModel: this.publishCommentModel, | 556 | publishCommentModel: this.publishCommentModel, |
| 509 | - operationButtonList: ['comment', 'collect', 'share'], | 557 | + operationButtonList: this.operationButtonList, |
| 510 | styleType: 1, | 558 | styleType: 1, |
| 511 | }) | 559 | }) |
| 512 | 560 | ||
| @@ -523,13 +571,6 @@ export struct DynamicDetailComponent { | @@ -523,13 +571,6 @@ export struct DynamicDetailComponent { | ||
| 523 | * */ | 571 | * */ |
| 524 | private async getContentDetailData() { | 572 | private async getContentDetailData() { |
| 525 | this.isNetConnected = NetworkUtil.isNetConnected() | 573 | this.isNetConnected = NetworkUtil.isNetConnected() |
| 526 | - this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | ||
| 527 | - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | ||
| 528 | - this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | ||
| 529 | - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 530 | - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 531 | - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 532 | - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 533 | try { | 574 | try { |
| 534 | let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) | 575 | let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) |
| 535 | this.isPageEnd = true; | 576 | this.isPageEnd = true; |
| @@ -539,6 +580,20 @@ export struct DynamicDetailComponent { | @@ -539,6 +580,20 @@ export struct DynamicDetailComponent { | ||
| 539 | let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN) | 580 | let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN) |
| 540 | this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime) | 581 | this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime) |
| 541 | console.log('动态详情', JSON.stringify(this.contentDetailData)) | 582 | console.log('动态详情', JSON.stringify(this.contentDetailData)) |
| 583 | + | ||
| 584 | + if (this.contentDetailData?.openComment) { | ||
| 585 | + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | ||
| 586 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') | ||
| 587 | + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | ||
| 588 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '') | ||
| 589 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '') | ||
| 590 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '') | ||
| 591 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') | ||
| 592 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') | ||
| 593 | + } | ||
| 594 | + | ||
| 595 | + this.operationButtonList = ['comment', 'collect', 'share'] | ||
| 596 | + | ||
| 542 | } catch (exception) { | 597 | } catch (exception) { |
| 543 | console.log('请求失败', JSON.stringify(exception)) | 598 | console.log('请求失败', JSON.stringify(exception)) |
| 544 | this.isPageEnd = true; | 599 | this.isPageEnd = true; |
| @@ -642,10 +697,10 @@ export struct DynamicDetailComponent { | @@ -642,10 +697,10 @@ export struct DynamicDetailComponent { | ||
| 642 | } | 697 | } |
| 643 | 698 | ||
| 644 | getPicType(item: PhotoListBean) { | 699 | getPicType(item: PhotoListBean) { |
| 645 | - if (item.width && item.width) { | ||
| 646 | - if (item.width / item.height > 343 / 172) { | 700 | + if (item.width && item.height) { |
| 701 | + if (item.width / item.height > 2/1) { | ||
| 647 | return 1; //横长图 | 702 | return 1; //横长图 |
| 648 | - } else if (item.height / item.width > 305 / 228) { | 703 | + } else if (item.width / item.height < 1/2) { |
| 649 | return 2; //竖长图 | 704 | return 2; //竖长图 |
| 650 | } else { | 705 | } else { |
| 651 | return 3 | 706 | return 3 |
| @@ -654,7 +709,6 @@ export struct DynamicDetailComponent { | @@ -654,7 +709,6 @@ export struct DynamicDetailComponent { | ||
| 654 | return 3; //普通图 | 709 | return 3; //普通图 |
| 655 | } | 710 | } |
| 656 | } | 711 | } |
| 657 | - | ||
| 658 | /** | 712 | /** |
| 659 | * 关注号主 | 713 | * 关注号主 |
| 660 | */ | 714 | */ |
| @@ -55,6 +55,7 @@ export struct ENewspaperPageComponent { | @@ -55,6 +55,7 @@ export struct ENewspaperPageComponent { | ||
| 55 | alignment: DialogAlignment.Top, | 55 | alignment: DialogAlignment.Top, |
| 56 | offset: { dx: 0, dy: 80 }, | 56 | offset: { dx: 0, dy: 80 }, |
| 57 | customStyle: true, | 57 | customStyle: true, |
| 58 | + maskColor: $r('app.color.color_80000000'), | ||
| 58 | }) | 59 | }) |
| 59 | //图片版选择弹框 | 60 | //图片版选择弹框 |
| 60 | pageDialogController: CustomDialogController = new CustomDialogController({ | 61 | pageDialogController: CustomDialogController = new CustomDialogController({ |
| @@ -65,6 +66,7 @@ export struct ENewspaperPageComponent { | @@ -65,6 +66,7 @@ export struct ENewspaperPageComponent { | ||
| 65 | alignment: DialogAlignment.BottomStart, | 66 | alignment: DialogAlignment.BottomStart, |
| 66 | offset: { dx: 0, dy: -90 }, | 67 | offset: { dx: 0, dy: -90 }, |
| 67 | customStyle: true, | 68 | customStyle: true, |
| 69 | + maskColor: $r('app.color.color_80000000'), | ||
| 68 | }) | 70 | }) |
| 69 | //文字报纸弹框 | 71 | //文字报纸弹框 |
| 70 | @State isOpenListDialog: boolean = false | 72 | @State isOpenListDialog: boolean = false |
| @@ -52,35 +52,11 @@ export struct ImageAndTextPageComponent { | @@ -52,35 +52,11 @@ 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 | + @State reachEndIncreament: number = 0 |
| 56 | + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | ||
| 56 | 57 | ||
| 57 | build() { | 58 | build() { |
| 58 | - Column() { | ||
| 59 | - // 发布时间 | ||
| 60 | - Row() { | ||
| 61 | - Image(this.contentDetailData?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb')) | ||
| 62 | - .width(80) | ||
| 63 | - .height(28) | ||
| 64 | - Text(this.publishTime) | ||
| 65 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 66 | - .fontSize(13) | ||
| 67 | - } | ||
| 68 | - .width(CommonConstants.FULL_WIDTH) | ||
| 69 | - .height(32) | ||
| 70 | - .padding({ left: 15, right: 15, }) | ||
| 71 | - .justifyContent(FlexAlign.SpaceBetween) | ||
| 72 | - .alignItems(VerticalAlign.Bottom) | ||
| 73 | - | ||
| 74 | - Row() { | ||
| 75 | - Image($r('app.media.line')) | ||
| 76 | - .width('100%') | ||
| 77 | - .height(6) | ||
| 78 | - .objectFit(ImageFit.Cover) | ||
| 79 | - .margin({ top: 10 }) | ||
| 80 | - } | ||
| 81 | - .padding({ left: 15, right: 15 }) | ||
| 82 | - .backgroundColor(Color.White) | ||
| 83 | - | 59 | + Stack({ alignContent: Alignment.Top }) { |
| 84 | Stack({ alignContent: Alignment.Bottom }) { | 60 | Stack({ alignContent: Alignment.Bottom }) { |
| 85 | Scroll(this.scroller) { | 61 | Scroll(this.scroller) { |
| 86 | Column() { | 62 | Column() { |
| @@ -89,7 +65,7 @@ export struct ImageAndTextPageComponent { | @@ -89,7 +65,7 @@ export struct ImageAndTextPageComponent { | ||
| 89 | action: this.action, | 65 | action: this.action, |
| 90 | isPageEnd: $isPageEnd | 66 | isPageEnd: $isPageEnd |
| 91 | }) | 67 | }) |
| 92 | - .padding({ bottom: 10 }) | 68 | + .padding({ top: 15, bottom: 10 }) |
| 93 | Column() { | 69 | Column() { |
| 94 | // 点赞 | 70 | // 点赞 |
| 95 | if (this.contentDetailData?.openLikes && this.contentDetailData?.likesStyle !== 4) { | 71 | if (this.contentDetailData?.openLikes && this.contentDetailData?.likesStyle !== 4) { |
| @@ -156,11 +132,9 @@ export struct ImageAndTextPageComponent { | @@ -156,11 +132,9 @@ export struct ImageAndTextPageComponent { | ||
| 156 | } | 132 | } |
| 157 | } | 133 | } |
| 158 | } | 134 | } |
| 159 | - | ||
| 160 | } | 135 | } |
| 161 | .width(CommonConstants.FULL_WIDTH) | 136 | .width(CommonConstants.FULL_WIDTH) |
| 162 | - // .height(CommonConstants.FULL_HEIGHT) | ||
| 163 | - .padding({ bottom: 76 }) | 137 | + .height(CommonConstants.FULL_HEIGHT) |
| 164 | .scrollBar(BarState.Off) | 138 | .scrollBar(BarState.Off) |
| 165 | .align(Alignment.Top) | 139 | .align(Alignment.Top) |
| 166 | .onReachEnd(() => { | 140 | .onReachEnd(() => { |
| @@ -177,20 +151,49 @@ export struct ImageAndTextPageComponent { | @@ -177,20 +151,49 @@ export struct ImageAndTextPageComponent { | ||
| 177 | }).padding({ bottom: 200 }) | 151 | }).padding({ bottom: 200 }) |
| 178 | } else { | 152 | } else { |
| 179 | if (!this.isPageEnd) { | 153 | if (!this.isPageEnd) { |
| 180 | - detailedSkeleton() | 154 | + detailedSkeleton().padding({ bottom: this.bottomSafeHeight }) |
| 181 | } | 155 | } |
| 182 | } | 156 | } |
| 183 | - //底部交互区 | ||
| 184 | - if (this.operationButtonList.length) { | ||
| 185 | - OperRowListView({ | ||
| 186 | - contentDetailData: this.contentDetailData, | ||
| 187 | - publishCommentModel: this.publishCommentModel, | ||
| 188 | - operationButtonList: this.operationButtonList, | ||
| 189 | - styleType: 1, | ||
| 190 | - }) | ||
| 191 | - } | 157 | + // 底部交互区 |
| 158 | + OperRowListView({ | ||
| 159 | + contentDetailData: this.contentDetailData, | ||
| 160 | + publishCommentModel: this.publishCommentModel, | ||
| 161 | + operationButtonList: this.operationButtonList, | ||
| 162 | + styleType: 1, | ||
| 163 | + }) | ||
| 164 | + .position({y: '100%'}) | ||
| 192 | } | 165 | } |
| 166 | + .width(CommonConstants.FULL_WIDTH) | ||
| 167 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 168 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 169 | + .padding({ top: 38 }) | ||
| 170 | + | ||
| 171 | + // 发布时间 | ||
| 172 | + Column() { | ||
| 173 | + Row() { | ||
| 174 | + Image(this.contentDetailData?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb')) | ||
| 175 | + .width(80) | ||
| 176 | + .height(28) | ||
| 177 | + Text(this.publishTime) | ||
| 178 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 179 | + .fontSize(13) | ||
| 180 | + } | ||
| 181 | + .width(CommonConstants.FULL_WIDTH) | ||
| 182 | + .height(32) | ||
| 183 | + .padding({ left: 15, right: 15, }) | ||
| 184 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 185 | + .alignItems(VerticalAlign.Bottom) | ||
| 193 | 186 | ||
| 187 | + Row() { | ||
| 188 | + Image($r('app.media.line')) | ||
| 189 | + .width('100%') | ||
| 190 | + .height(6) | ||
| 191 | + .objectFit(ImageFit.Cover) | ||
| 192 | + .margin({ top: 10 }) | ||
| 193 | + } | ||
| 194 | + .padding({ left: 15, right: 15 }) | ||
| 195 | + .backgroundColor(Color.White) | ||
| 196 | + }.backgroundColor(Color.White) | ||
| 194 | } | 197 | } |
| 195 | .width(CommonConstants.FULL_WIDTH) | 198 | .width(CommonConstants.FULL_WIDTH) |
| 196 | .height(CommonConstants.FULL_HEIGHT) | 199 | .height(CommonConstants.FULL_HEIGHT) |
| @@ -231,13 +234,13 @@ export struct ImageAndTextPageComponent { | @@ -231,13 +234,13 @@ export struct ImageAndTextPageComponent { | ||
| 231 | } | 234 | } |
| 232 | if (this.contentDetailData?.openComment) { | 235 | if (this.contentDetailData?.openComment) { |
| 233 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | 236 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') |
| 234 | - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | 237 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') |
| 235 | this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | 238 | this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle |
| 236 | - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 237 | - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 238 | - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 239 | - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 240 | - this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | 239 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '') |
| 240 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '') | ||
| 241 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '') | ||
| 242 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') | ||
| 243 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') | ||
| 241 | } | 244 | } |
| 242 | if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length && | 245 | if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length && |
| 243 | this.contentDetailData?.audioList[0].audioUrl) { | 246 | this.contentDetailData?.audioList[0].audioUrl) { |
| @@ -260,7 +263,11 @@ export struct ImageAndTextPageComponent { | @@ -260,7 +263,11 @@ export struct ImageAndTextPageComponent { | ||
| 260 | channelId: String(this.contentDetailData?.reLInfo?.channelId) | 263 | channelId: String(this.contentDetailData?.reLInfo?.channelId) |
| 261 | } | 264 | } |
| 262 | let recommendList = await DetailViewModel.postRecommendList(params) | 265 | let recommendList = await DetailViewModel.postRecommendList(params) |
| 263 | - this.recommendList = recommendList; | 266 | + if (recommendList.length > 0) { |
| 267 | + //推荐列表过滤音频和活动入口 | ||
| 268 | + this.recommendList = recommendList.filter(item => item.objectType !== '3' && item.objectType !== '13'); | ||
| 269 | + } | ||
| 270 | + | ||
| 264 | } | 271 | } |
| 265 | 272 | ||
| 266 | // 已登录->查询用户对作品点赞、收藏状态 | 273 | // 已登录->查询用户对作品点赞、收藏状态 |
| @@ -23,7 +23,6 @@ export struct ImageAndTextWebComponent { | @@ -23,7 +23,6 @@ export struct ImageAndTextWebComponent { | ||
| 23 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean | 23 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean |
| 24 | private webPrepared = false; | 24 | private webPrepared = false; |
| 25 | private dataPrepared = false; | 25 | private dataPrepared = false; |
| 26 | - | ||
| 27 | async onDetailDataUpdated() { | 26 | async onDetailDataUpdated() { |
| 28 | if (this.action) { | 27 | if (this.action) { |
| 29 | let contentId: string = '' | 28 | let contentId: string = '' |
| @@ -96,6 +95,7 @@ export struct ImageAndTextWebComponent { | @@ -96,6 +95,7 @@ export struct ImageAndTextWebComponent { | ||
| 96 | Column() { | 95 | Column() { |
| 97 | WdWebLocalComponent({ | 96 | WdWebLocalComponent({ |
| 98 | webviewControl: this.webviewControl, | 97 | webviewControl: this.webviewControl, |
| 98 | + reload:this.reload, | ||
| 99 | webResource: $rawfile('apph5/index.html'), | 99 | webResource: $rawfile('apph5/index.html'), |
| 100 | backVisibility: false, | 100 | backVisibility: false, |
| 101 | onWebPrepared: this.onWebPrepared.bind(this), | 101 | onWebPrepared: this.onWebPrepared.bind(this), |
| @@ -25,6 +25,7 @@ export struct ImageDownloadComponent { | @@ -25,6 +25,7 @@ export struct ImageDownloadComponent { | ||
| 25 | build() { | 25 | build() { |
| 26 | Column() { | 26 | Column() { |
| 27 | SaveButton({ icon: SaveIconStyle.LINES }) | 27 | SaveButton({ icon: SaveIconStyle.LINES }) |
| 28 | + .iconSize(24) | ||
| 28 | .iconColor(Color.White) | 29 | .iconColor(Color.White) |
| 29 | .onClick(async () => { | 30 | .onClick(async () => { |
| 30 | console.info(`cj2024 onClick ${this.imageBuffer}`) | 31 | console.info(`cj2024 onClick ${this.imageBuffer}`) |
| 1 | import { ContentDTO } from 'wdBean/Index'; | 1 | import { ContentDTO } from 'wdBean/Index'; |
| 2 | import { ProcessUtils } from 'wdRouter/Index'; | 2 | import { ProcessUtils } from 'wdRouter/Index'; |
| 3 | import { InteractMessageModel } from '../../model/InteractMessageModel' | 3 | import { InteractMessageModel } from '../../model/InteractMessageModel' |
| 4 | - | 4 | +import { DateTimeUtils} from 'wdKit/Index' |
| 5 | @Component | 5 | @Component |
| 6 | export struct InteractMComponent { | 6 | export struct InteractMComponent { |
| 7 | messageModel:InteractMessageModel = new InteractMessageModel; | 7 | messageModel:InteractMessageModel = new InteractMessageModel; |
| @@ -15,6 +15,7 @@ export struct InteractMComponent { | @@ -15,6 +15,7 @@ export struct InteractMComponent { | ||
| 15 | build() { | 15 | build() { |
| 16 | Row(){ | 16 | Row(){ |
| 17 | Image(this.messageModel.InteractMsubM.headUrl) | 17 | Image(this.messageModel.InteractMsubM.headUrl) |
| 18 | + .alt($r('app.media.default_head')) | ||
| 18 | .width(36) | 19 | .width(36) |
| 19 | .height(36) | 20 | .height(36) |
| 20 | .borderRadius(18) | 21 | .borderRadius(18) |
| @@ -29,7 +30,7 @@ export struct InteractMComponent { | @@ -29,7 +30,7 @@ export struct InteractMComponent { | ||
| 29 | .margin({left:5}) | 30 | .margin({left:5}) |
| 30 | }.width('100%') | 31 | }.width('100%') |
| 31 | 32 | ||
| 32 | - Text(this.messageModel.time) | 33 | + Text(this.getPublishTime(this.messageModel.time,DateTimeUtils.getDateTimestamp(this.messageModel.time)+"")) |
| 33 | .margin({top:2}) | 34 | .margin({top:2}) |
| 34 | .fontSize('12fp').fontColor('#B0B0B0').margin({top:10,bottom:10}) | 35 | .fontSize('12fp').fontColor('#B0B0B0').margin({top:10,bottom:10}) |
| 35 | 36 | ||
| @@ -41,42 +42,44 @@ export struct InteractMComponent { | @@ -41,42 +42,44 @@ export struct InteractMComponent { | ||
| 41 | .constraintSize({maxHeight:500}) | 42 | .constraintSize({maxHeight:500}) |
| 42 | } | 43 | } |
| 43 | 44 | ||
| 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%') | 45 | + if(this.messageModel.contentType != '211'){ |
| 46 | + Column(){ | ||
| 47 | + if (this.messageModel.contentType === '207' || this.messageModel.contentType === '209'){ | ||
| 48 | + Text('[你的评论]'+this.buildCommentContent()).fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500}) | ||
| 49 | + .margin({top:15,bottom:10}) | ||
| 50 | + .width('100%') | ||
| 49 | 51 | ||
| 50 | - Divider() | ||
| 51 | - .color('#EDEDED') | ||
| 52 | - .backgroundColor('#EDEDED') | ||
| 53 | - .width('100%') | ||
| 54 | - .height(1) | ||
| 55 | - } | ||
| 56 | - Row(){ | ||
| 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}) | 52 | + Divider() |
| 53 | + .color('#EDEDED') | ||
| 54 | + .backgroundColor('#EDEDED') | ||
| 55 | + .width('100%') | ||
| 56 | + .height(1) | ||
| 57 | + } | ||
| 58 | + Row(){ | ||
| 59 | + Image($r('app.media.MessageOriginTextIcon')) | ||
| 60 | + .width('12') | ||
| 61 | + .height('12') | ||
| 62 | + Text(this.messageModel.InteractMsubM.contentTitle) | ||
| 63 | + .fontSize('12fp') | ||
| 64 | + .fontColor('#666666') | ||
| 65 | + .maxLines(1) | ||
| 66 | + .width('90%') | ||
| 67 | + .textOverflow({overflow:TextOverflow.Ellipsis}) | ||
| 66 | 68 | ||
| 67 | - Blank() | 69 | + Blank() |
| 68 | 70 | ||
| 69 | - Image($r('app.media.mine_user_edit')) | ||
| 70 | - .width('12') | ||
| 71 | - .height('12') | ||
| 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 | - }) | 71 | + Image($r('app.media.mine_user_edit')) |
| 72 | + .width('12') | ||
| 73 | + .height('12') | ||
| 74 | + }.margin({top:10,bottom:15}) | ||
| 75 | + }.padding({left:10,right:10}).alignItems(HorizontalAlign.Start).backgroundColor('#f5f5f5').borderRadius(5) | ||
| 76 | + .onClick(()=>{ | ||
| 77 | + let contentDTO :ContentDTO = new ContentDTO(); | ||
| 78 | + contentDTO.objectType = this.messageModel.InteractMsubM.contentType | ||
| 79 | + contentDTO.objectId = this.messageModel.InteractMsubM.contentId | ||
| 80 | + ProcessUtils.processPage(contentDTO) | ||
| 81 | + }) | ||
| 82 | + } | ||
| 80 | }.padding({left:5,right:5}).alignItems(HorizontalAlign.Start).width('90%') | 83 | }.padding({left:5,right:5}).alignItems(HorizontalAlign.Start).width('90%') |
| 81 | }.padding({top:10,left:16,right:16}).width('100%').alignItems(VerticalAlign.Top) | 84 | }.padding({top:10,left:16,right:16}).width('100%').alignItems(VerticalAlign.Top) |
| 82 | } | 85 | } |
| @@ -102,4 +105,49 @@ export struct InteractMComponent { | @@ -102,4 +105,49 @@ export struct InteractMComponent { | ||
| 102 | let contentString : string = this.messageModel.contentType === '207'?this.messageModel.message:this.messageModel.InteractMsubM.beReply; | 105 | let contentString : string = this.messageModel.contentType === '207'?this.messageModel.message:this.messageModel.InteractMsubM.beReply; |
| 103 | return contentString; | 106 | return contentString; |
| 104 | } | 107 | } |
| 108 | + | ||
| 109 | + getPublishTime(data:string,publishTime: string): string { | ||
| 110 | + const publishTimestamp = parseInt(publishTime) | ||
| 111 | + const currentTime = Date.now(); // 当前时间戳 | ||
| 112 | + | ||
| 113 | + // 计算差异 | ||
| 114 | + const timeDifference = currentTime - publishTimestamp; | ||
| 115 | + | ||
| 116 | + // 转换为分钟、小时和天 | ||
| 117 | + const minutes = Math.floor(timeDifference / (1000 * 60)); | ||
| 118 | + const hours = Math.floor(timeDifference / (1000 * 60 * 60)); | ||
| 119 | + const days = Math.floor(timeDifference / (1000 * 60 * 60 * 24)); | ||
| 120 | + | ||
| 121 | + // 根据时间差返回对应的字符串 | ||
| 122 | + let result: string; | ||
| 123 | + | ||
| 124 | + if (minutes < 60) { | ||
| 125 | + result = `${minutes}分钟前`; | ||
| 126 | + if (minutes === 0) { | ||
| 127 | + result = `刚刚`; | ||
| 128 | + } | ||
| 129 | + } else if (hours < 24) { | ||
| 130 | + result = `${hours}小时前`; | ||
| 131 | + } else { | ||
| 132 | + result = `${days}天前`; | ||
| 133 | + if (days > 1) { | ||
| 134 | + let arr = data.split(" ") | ||
| 135 | + if (arr.length === 2) { | ||
| 136 | + let arr2 = arr[0].split("-") | ||
| 137 | + if (arr2.length === 3) { | ||
| 138 | + result = `${arr2[1]}-${arr2[2]}` | ||
| 139 | + } | ||
| 140 | + } else { | ||
| 141 | + //原始数据是时间戳 需要转成dateString | ||
| 142 | + let time = DateTimeUtils.formatDate(Number(publishTime)) | ||
| 143 | + let arr = time.split("-") | ||
| 144 | + if (arr.length === 3) { | ||
| 145 | + result = `${arr[1]}-${arr[2]}` | ||
| 146 | + } | ||
| 147 | + } | ||
| 148 | + } | ||
| 149 | + } | ||
| 150 | + console.log(result); | ||
| 151 | + return result | ||
| 152 | + } | ||
| 105 | } | 153 | } |
| @@ -21,6 +21,8 @@ import { effectKit } from '@kit.ArkGraphics2D'; | @@ -21,6 +21,8 @@ import { effectKit } from '@kit.ArkGraphics2D'; | ||
| 21 | import { window } from '@kit.ArkUI'; | 21 | import { window } from '@kit.ArkUI'; |
| 22 | import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel'; | 22 | import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel'; |
| 23 | import { AudioSuspensionModel } from '../../viewmodel/AudioSuspensionModel' | 23 | import { AudioSuspensionModel } from '../../viewmodel/AudioSuspensionModel' |
| 24 | +import { viewColumInsightIntentShare } from '../../utils/InsightIntentShare' | ||
| 25 | +import { common } from '@kit.AbilityKit'; | ||
| 24 | 26 | ||
| 25 | const TAG = 'MorningEveningPaperComponent'; | 27 | const TAG = 'MorningEveningPaperComponent'; |
| 26 | 28 | ||
| @@ -77,7 +79,7 @@ export struct MorningEveningPaperComponent { | @@ -77,7 +79,7 @@ export struct MorningEveningPaperComponent { | ||
| 77 | offset: { dx: 12, dy: -150 }, | 79 | offset: { dx: 12, dy: -150 }, |
| 78 | 80 | ||
| 79 | }) | 81 | }) |
| 80 | - private AudioSuspension = new AudioSuspensionModel() | 82 | + // private AudioSuspension = new AudioSuspensionModel() |
| 81 | 83 | ||
| 82 | onCancel() { | 84 | onCancel() { |
| 83 | Logger.info(TAG, "cj2024 onCancel = ") | 85 | Logger.info(TAG, "cj2024 onCancel = ") |
| @@ -126,6 +128,10 @@ export struct MorningEveningPaperComponent { | @@ -126,6 +128,10 @@ export struct MorningEveningPaperComponent { | ||
| 126 | // let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + this.dailyPaperTopicPageId) | 128 | // let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + this.dailyPaperTopicPageId) |
| 127 | let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + dailyPaperTopicPageId) //"25091" | 129 | let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + dailyPaperTopicPageId) //"25091" |
| 128 | this.pageInfoBean = pageInfoBean; | 130 | this.pageInfoBean = pageInfoBean; |
| 131 | + //早晚报意图上报 | ||
| 132 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 133 | + viewColumInsightIntentShare(context,String(dailyPaperTopicPageId), this.pageInfoBean) | ||
| 134 | + | ||
| 129 | this.title = this.pageInfoBean?.topicInfo?.title | 135 | this.title = this.pageInfoBean?.topicInfo?.title |
| 130 | let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN) | 136 | let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN) |
| 131 | const dateShow = new Date(dateTime) | 137 | const dateShow = new Date(dateTime) |
| @@ -145,6 +151,7 @@ export struct MorningEveningPaperComponent { | @@ -145,6 +151,7 @@ export struct MorningEveningPaperComponent { | ||
| 145 | if (this.compListItem.operDataList && this.compListItem.operDataList.length > 0) { | 151 | if (this.compListItem.operDataList && this.compListItem.operDataList.length > 0) { |
| 146 | this.getAllContentInteractData(this.compListItem.operDataList) | 152 | this.getAllContentInteractData(this.compListItem.operDataList) |
| 147 | } | 153 | } |
| 154 | + Logger.debug('compInfoBean?.compList[0].audioDataList', JSON.stringify(compInfoBean?.compList[0].audioDataList)) | ||
| 148 | if (compInfoBean?.compList[0].audioDataList) { | 155 | if (compInfoBean?.compList[0].audioDataList) { |
| 149 | this.audioPlayUrl = compInfoBean?.compList[0].audioDataList[0].audioUrl | 156 | this.audioPlayUrl = compInfoBean?.compList[0].audioDataList[0].audioUrl |
| 150 | this.audioTitle = compInfoBean?.compList[0].audioDataList[0].title | 157 | this.audioTitle = compInfoBean?.compList[0].audioDataList[0].title |
| @@ -305,8 +312,9 @@ export struct MorningEveningPaperComponent { | @@ -305,8 +312,9 @@ export struct MorningEveningPaperComponent { | ||
| 305 | .onClick(() => { | 312 | .onClick(() => { |
| 306 | Logger.info("TAG", "cj compInfoBean onClick1 = " + this.isAudioPlaying) | 313 | Logger.info("TAG", "cj compInfoBean onClick1 = " + this.isAudioPlaying) |
| 307 | // dialog.open() | 314 | // dialog.open() |
| 308 | - this.AudioSuspension.showWindow() | ||
| 309 | - // this.playerController.firstPlay(this.audioPlayUrl) | 315 | + // this.playerController.firstPlay(this.audioPlayUrl, this.audioTitle) |
| 316 | + // this.AudioSuspension.setPlayerUrl(this.audioPlayUrl, this.audioTitle) | ||
| 317 | + Logger.info(TAG, "this.audioPlayUrl = " + this.audioPlayUrl) | ||
| 310 | Logger.info("TAG", "cj compInfoBean onClick2 = " + this.isAudioPlaying) | 318 | Logger.info("TAG", "cj compInfoBean onClick2 = " + this.isAudioPlaying) |
| 311 | }) | 319 | }) |
| 312 | } | 320 | } |
| @@ -366,6 +366,8 @@ export struct MultiPictureDetailPageComponent { | @@ -366,6 +366,8 @@ 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, | ||
| 370 | + pageComponentType: 3 | ||
| 369 | }) | 371 | }) |
| 370 | } | 372 | } |
| 371 | .transition(TransitionEffect.OPACITY.animation({ duration: this.duration, curve: Curve.Ease }).combine( | 373 | .transition(TransitionEffect.OPACITY.animation({ duration: this.duration, curve: Curve.Ease }).combine( |
| @@ -443,13 +445,13 @@ export struct MultiPictureDetailPageComponent { | @@ -443,13 +445,13 @@ export struct MultiPictureDetailPageComponent { | ||
| 443 | // } | 445 | // } |
| 444 | if (this.contentDetailData?.openComment) { | 446 | if (this.contentDetailData?.openComment) { |
| 445 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | 447 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') |
| 446 | - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | 448 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') |
| 447 | this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | 449 | this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle |
| 448 | - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 449 | - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 450 | - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 451 | - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 452 | - this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | 450 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '') |
| 451 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '') | ||
| 452 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '') | ||
| 453 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') | ||
| 454 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') | ||
| 453 | } | 455 | } |
| 454 | // this.contentDetailData.photoList = [] | 456 | // this.contentDetailData.photoList = [] |
| 455 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { | 457 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { |
| @@ -8,6 +8,8 @@ import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5 | @@ -8,6 +8,8 @@ import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5 | ||
| 8 | import { OperRowListView } from './view/OperRowListView'; | 8 | import { OperRowListView } from './view/OperRowListView'; |
| 9 | import DetailViewModel from '../viewmodel/DetailViewModel'; | 9 | import DetailViewModel from '../viewmodel/DetailViewModel'; |
| 10 | import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; | 10 | import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; |
| 11 | +import { EmptyComponent } from '../components/view/EmptyComponent'; | ||
| 12 | +import { NetworkUtil, WindowModel } from 'wdKit'; | ||
| 11 | 13 | ||
| 12 | const TAG: string = 'SpacialTopicPageComponent' | 14 | const TAG: string = 'SpacialTopicPageComponent' |
| 13 | 15 | ||
| @@ -18,12 +20,15 @@ export struct SpacialTopicPageComponent { | @@ -18,12 +20,15 @@ export struct SpacialTopicPageComponent { | ||
| 18 | action: Action = {} as Action | 20 | action: Action = {} as Action |
| 19 | @State webUrl: string = ''; | 21 | @State webUrl: string = ''; |
| 20 | @State isPageEnd: boolean = false | 22 | @State isPageEnd: boolean = false |
| 23 | + @Prop reload: number = 0; | ||
| 21 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 24 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 22 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean | 25 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean |
| 23 | private webPrepared = false; | 26 | private webPrepared = false; |
| 24 | private dataPrepared = false; | 27 | private dataPrepared = false; |
| 25 | @State publishCommentModel: publishCommentModel = new publishCommentModel() | 28 | @State publishCommentModel: publishCommentModel = new publishCommentModel() |
| 26 | @State operationButtonList: string[] = ['comment', 'collect', 'share'] | 29 | @State operationButtonList: string[] = ['comment', 'collect', 'share'] |
| 30 | + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | ||
| 31 | + @State isNetConnected: boolean = true | ||
| 27 | 32 | ||
| 28 | private trySendData2H5() { | 33 | private trySendData2H5() { |
| 29 | if (!this.webPrepared || !this.dataPrepared) { | 34 | if (!this.webPrepared || !this.dataPrepared) { |
| @@ -45,6 +50,8 @@ export struct SpacialTopicPageComponent { | @@ -45,6 +50,8 @@ export struct SpacialTopicPageComponent { | ||
| 45 | } | 50 | } |
| 46 | 51 | ||
| 47 | private async getDetail() { | 52 | private async getDetail() { |
| 53 | + this.isNetConnected = NetworkUtil.isNetConnected() | ||
| 54 | + | ||
| 48 | let contentId: string = '' | 55 | let contentId: string = '' |
| 49 | let relId: string = '' | 56 | let relId: string = '' |
| 50 | let relType: string = '' | 57 | let relType: string = '' |
| @@ -66,13 +73,13 @@ export struct SpacialTopicPageComponent { | @@ -66,13 +73,13 @@ export struct SpacialTopicPageComponent { | ||
| 66 | this.contentDetailData = detailBeans[0]; | 73 | this.contentDetailData = detailBeans[0]; |
| 67 | // if (this.contentDetailData[0]?.openComment) { | 74 | // if (this.contentDetailData[0]?.openComment) { |
| 68 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | 75 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') |
| 69 | - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | 76 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') |
| 70 | this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | 77 | this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle |
| 71 | - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 72 | - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 73 | - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 74 | - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 75 | - this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | 78 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '') |
| 79 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '') | ||
| 80 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '') | ||
| 81 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') | ||
| 82 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') | ||
| 76 | // } | 83 | // } |
| 77 | this.trySendData2H5() | 84 | this.trySendData2H5() |
| 78 | } | 85 | } |
| @@ -83,20 +90,39 @@ export struct SpacialTopicPageComponent { | @@ -83,20 +90,39 @@ export struct SpacialTopicPageComponent { | ||
| 83 | Column() { | 90 | Column() { |
| 84 | Stack({ alignContent: Alignment.Bottom }) { | 91 | Stack({ alignContent: Alignment.Bottom }) { |
| 85 | Column() { | 92 | Column() { |
| 93 | + Text(this.contentDetailData?.newsTitle) | ||
| 94 | + .backgroundColor(Color.White) | ||
| 95 | + .width('100%') | ||
| 96 | + .height(40) | ||
| 97 | + .fontSize(18) | ||
| 98 | + .textAlign(TextAlign.Center) | ||
| 99 | + .fontWeight(500) | ||
| 100 | + .visibility(this.action?.params?.backVisibility && this.isPageEnd ? Visibility.Visible : Visibility.None) | ||
| 101 | + | ||
| 86 | WdWebComponent({ | 102 | WdWebComponent({ |
| 87 | webviewControl: this.webviewControl, | 103 | webviewControl: this.webviewControl, |
| 88 | webUrl: this.webUrl, | 104 | webUrl: this.webUrl, |
| 89 | - backVisibility: false, | 105 | + reload: this.reload, |
| 90 | onWebPrepared: this.onWebPrepared.bind(this), | 106 | onWebPrepared: this.onWebPrepared.bind(this), |
| 91 | - isPageEnd: $isPageEnd | 107 | + isPageEnd: $isPageEnd, |
| 92 | }) | 108 | }) |
| 93 | } | 109 | } |
| 94 | .width(CommonConstants.FULL_WIDTH) | 110 | .width(CommonConstants.FULL_WIDTH) |
| 95 | .height(CommonConstants.FULL_HEIGHT) | 111 | .height(CommonConstants.FULL_HEIGHT) |
| 96 | - .padding({ bottom: 75 }) | 112 | + .padding({ bottom: this.action?.params?.backVisibility ? 115 : 75 }) |
| 97 | 113 | ||
| 98 | - if (!this.isPageEnd) { | ||
| 99 | - detailedSkeleton() | 114 | + if (!this.isNetConnected) { |
| 115 | + EmptyComponent({ | ||
| 116 | + emptyType: 1, | ||
| 117 | + emptyButton: true, | ||
| 118 | + retry: () => { | ||
| 119 | + this.getDetail() | ||
| 120 | + } | ||
| 121 | + }).padding({ bottom: 200 }) | ||
| 122 | + } else { | ||
| 123 | + if (!this.isPageEnd) { | ||
| 124 | + detailedSkeleton().padding({ bottom: this.bottomSafeHeight }) | ||
| 125 | + } | ||
| 100 | } | 126 | } |
| 101 | //底部交互区 | 127 | //底部交互区 |
| 102 | OperRowListView({ | 128 | OperRowListView({ |
| @@ -109,9 +135,16 @@ export struct SpacialTopicPageComponent { | @@ -109,9 +135,16 @@ export struct SpacialTopicPageComponent { | ||
| 109 | } | 135 | } |
| 110 | 136 | ||
| 111 | aboutToAppear() { | 137 | aboutToAppear() { |
| 112 | - if (this.action) { | ||
| 113 | - this.webUrl = this.action.params?.url || '' | 138 | + if (!this.action?.params?.backVisibility) { |
| 139 | + WindowModel.shared.setWindowLayoutFullScreen(true) | ||
| 114 | } | 140 | } |
| 141 | + this.webUrl = this.action?.params?.url || '' | ||
| 115 | this.getDetail() | 142 | this.getDetail() |
| 116 | } | 143 | } |
| 144 | + | ||
| 145 | + aboutToDisappear() { | ||
| 146 | + if (!this.action?.params?.backVisibility) { | ||
| 147 | + WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 148 | + } | ||
| 149 | + } | ||
| 117 | } | 150 | } |
| 1 | -import { ContentDTO } from 'wdBean' | 1 | +import { CompDTO, ContentDTO } from 'wdBean' |
| 2 | import { CommonConstants } from 'wdConstant/Index'; | 2 | import { CommonConstants } from 'wdConstant/Index'; |
| 3 | import { DateTimeUtils } from 'wdKit/Index'; | 3 | import { DateTimeUtils } from 'wdKit/Index'; |
| 4 | 4 | ||
| 5 | @Component | 5 | @Component |
| 6 | export struct CardSourceInfo { | 6 | export struct CardSourceInfo { |
| 7 | @State contentDTO: ContentDTO = new ContentDTO(); | 7 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 8 | + @ObjectLink compDTO: CompDTO | ||
| 8 | 9 | ||
| 9 | build() { | 10 | build() { |
| 10 | Flex() { | 11 | Flex() { |
| 11 | if (this.contentDTO.corner) { | 12 | if (this.contentDTO.corner) { |
| 12 | Text(this.contentDTO.corner) | 13 | Text(this.contentDTO.corner) |
| 13 | - .fontSize($r("app.float.font_size_12")) | 14 | + .fontSize($r("app.float.font_size_11")) |
| 14 | .fontColor($r("app.color.color_ED2800")) | 15 | .fontColor($r("app.color.color_ED2800")) |
| 15 | .margin({ right: 2 }) | 16 | .margin({ right: 2 }) |
| 16 | } | 17 | } |
| 17 | if (this.contentDTO.rmhPlatform === 1) { | 18 | if (this.contentDTO.rmhPlatform === 1) { |
| 18 | Text(this.contentDTO.rmhInfo?.rmhName) | 19 | Text(this.contentDTO.rmhInfo?.rmhName) |
| 19 | - .fontSize($r("app.float.font_size_12")) | 20 | + .fontSize($r("app.float.font_size_11")) |
| 20 | .fontColor($r("app.color.color_B0B0B0")) | 21 | .fontColor($r("app.color.color_B0B0B0")) |
| 21 | .maxLines(1) | 22 | .maxLines(1) |
| 22 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 23 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 23 | } else if (this.contentDTO.source) { | 24 | } else if (this.contentDTO.source) { |
| 24 | Text(`${this.contentDTO.source}`) | 25 | Text(`${this.contentDTO.source}`) |
| 25 | - .fontSize($r("app.float.font_size_12")) | 26 | + .fontSize($r("app.float.font_size_11")) |
| 26 | .fontColor($r("app.color.color_B0B0B0")) | 27 | .fontColor($r("app.color.color_B0B0B0")) |
| 27 | .maxLines(1) | 28 | .maxLines(1) |
| 28 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 29 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 29 | } | 30 | } |
| 30 | // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 | 31 | // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 |
| 31 | - if (this.contentDTO.isSearch || this.contentDTO.isCollection || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime | ||
| 32 | - (Number | ||
| 33 | - .parseFloat(this | ||
| 34 | - .contentDTO.publishTime)) | ||
| 35 | - .indexOf | ||
| 36 | - ('-') === -1) { | ||
| 37 | - if(this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName || this | 32 | + if (this.contentDTO.isSearch || this.contentDTO.isCollection || |
| 33 | + !this.contentDTO.isSearch && DateTimeUtils.getCommentTime | ||
| 34 | + (Number | ||
| 35 | + .parseFloat(this | ||
| 36 | + .contentDTO.publishTime)) | ||
| 37 | + .indexOf | ||
| 38 | + ('-') === -1) { | ||
| 39 | + if (this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName || this | ||
| 38 | .contentDTO.rmhPlatform !== 1 && this.contentDTO.source) { | 40 | .contentDTO.rmhPlatform !== 1 && this.contentDTO.source) { |
| 39 | Image($r("app.media.point")) | 41 | Image($r("app.media.point")) |
| 40 | .width(16) | 42 | .width(16) |
| 41 | .height(16) | 43 | .height(16) |
| 42 | } | 44 | } |
| 43 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | 45 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) |
| 44 | - .fontSize($r("app.float.font_size_12")) | 46 | + .fontSize($r("app.float.font_size_11")) |
| 45 | .fontColor($r("app.color.color_B0B0B0")) | 47 | .fontColor($r("app.color.color_B0B0B0")) |
| 46 | .flexShrink(0) | 48 | .flexShrink(0) |
| 47 | } | 49 | } |
| 48 | - if (this.contentDTO?.interactData?.commentNum) { | ||
| 49 | - Text(`${this.contentDTO.interactData.commentNum}评`) | ||
| 50 | - .fontSize($r("app.float.font_size_12")) | 50 | + if (this.getContentDtoBean()?.interactData?.commentNum) { |
| 51 | + Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`) | ||
| 52 | + .fontSize($r("app.float.font_size_11")) | ||
| 51 | .fontColor($r("app.color.color_B0B0B0")) | 53 | .fontColor($r("app.color.color_B0B0B0")) |
| 52 | .flexShrink(0) | 54 | .flexShrink(0) |
| 53 | .margin({ left: 6 }) | 55 | .margin({ left: 6 }) |
| 54 | - .visibility(Number(this.contentDTO?.interactData?.commentNum) === 0 ? Visibility.None : Visibility.Visible) | 56 | + .visibility(Number(this.getContentDtoBean()?.interactData?.commentNum) === 0 ? Visibility.None : Visibility.Visible) |
| 55 | } | 57 | } |
| 56 | } | 58 | } |
| 57 | .width(CommonConstants.FULL_WIDTH) | 59 | .width(CommonConstants.FULL_WIDTH) |
| 58 | .margin({ top: 8 }) | 60 | .margin({ top: 8 }) |
| 59 | } | 61 | } |
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * 获取稿件业务对象 | ||
| 65 | + * @returns | ||
| 66 | + */ | ||
| 67 | + private getContentDtoBean(): ContentDTO { | ||
| 68 | + if (this.compDTO == undefined) { | ||
| 69 | + return this.contentDTO | ||
| 70 | + } | ||
| 71 | + if(this.compDTO.operDataList.length == 0){ | ||
| 72 | + return this.contentDTO | ||
| 73 | + } | ||
| 74 | + return this.compDTO.operDataList[0] | ||
| 75 | + } | ||
| 60 | } | 76 | } |
| @@ -13,11 +13,13 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | @@ -13,11 +13,13 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 13 | import router from '@ohos.router' | 13 | import router from '@ohos.router' |
| 14 | import { postBatchAttentionStatusParams } from 'wdBean/Index'; | 14 | import { postBatchAttentionStatusParams } from 'wdBean/Index'; |
| 15 | import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel' | 15 | import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel' |
| 16 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 16 | 17 | ||
| 17 | @Component | 18 | @Component |
| 18 | export struct RmhTitle { | 19 | export struct RmhTitle { |
| 19 | @Prop rmhInfo: RmhInfoDTO | 20 | @Prop rmhInfo: RmhInfoDTO |
| 20 | @Prop publishTime: string | undefined | 21 | @Prop publishTime: string | undefined |
| 22 | + @State loadImg: boolean = false; | ||
| 21 | /** | 23 | /** |
| 22 | * 是否需要隐藏发布时间超过2天的时间展示,默认不隐藏 | 24 | * 是否需要隐藏发布时间超过2天的时间展示,默认不隐藏 |
| 23 | */ | 25 | */ |
| @@ -76,13 +78,15 @@ export struct RmhTitle { | @@ -76,13 +78,15 @@ export struct RmhTitle { | ||
| 76 | } | 78 | } |
| 77 | } | 79 | } |
| 78 | 80 | ||
| 79 | - aboutToAppear(): void { | 81 | + async aboutToAppear(): Promise<void> { |
| 80 | this.getBatchAttentionStatus() | 82 | this.getBatchAttentionStatus() |
| 81 | 83 | ||
| 82 | let page = router.getState(); | 84 | let page = router.getState(); |
| 83 | if (page.path.includes('/page/PeopleShipHomePage') || page.path.includes('/pages/MainPage')) { | 85 | if (page.path.includes('/page/PeopleShipHomePage') || page.path.includes('/pages/MainPage')) { |
| 84 | this.hideTime = true; | 86 | this.hideTime = true; |
| 85 | } | 87 | } |
| 88 | + | ||
| 89 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 86 | } | 90 | } |
| 87 | 91 | ||
| 88 | getDaysBetweenDates(date: number) { | 92 | getDaysBetweenDates(date: number) { |
| @@ -96,10 +100,10 @@ export struct RmhTitle { | @@ -96,10 +100,10 @@ export struct RmhTitle { | ||
| 96 | build() { | 100 | build() { |
| 97 | Flex() { | 101 | Flex() { |
| 98 | Stack() { | 102 | Stack() { |
| 99 | - Image(this.rmhInfo.rmhHeadUrl) | 103 | + Image(this.loadImg ? this.rmhInfo?.rmhHeadUrl : $r('app.media.comment_rmh_tag')) |
| 100 | .width(36) | 104 | .width(36) |
| 101 | .height(36).borderRadius(50) | 105 | .height(36).borderRadius(50) |
| 102 | - Image(this.rmhInfo.authIcon) | 106 | + Image(this.rmhInfo?.authIcon) |
| 103 | .width(14) | 107 | .width(14) |
| 104 | .height(14) | 108 | .height(14) |
| 105 | .borderRadius(50) | 109 | .borderRadius(50) |
| @@ -109,7 +113,7 @@ export struct RmhTitle { | @@ -109,7 +113,7 @@ export struct RmhTitle { | ||
| 109 | .flexShrink(0) | 113 | .flexShrink(0) |
| 110 | 114 | ||
| 111 | Column() { | 115 | Column() { |
| 112 | - Text(this.rmhInfo.rmhName) | 116 | + Text(this.rmhInfo?.rmhName) |
| 113 | .fontSize($r('app.float.font_size_13')) | 117 | .fontSize($r('app.float.font_size_13')) |
| 114 | .fontColor($r('app.color.color_222222')) | 118 | .fontColor($r('app.color.color_222222')) |
| 115 | .fontWeight(600) | 119 | .fontWeight(600) |
| @@ -122,13 +126,13 @@ export struct RmhTitle { | @@ -122,13 +126,13 @@ export struct RmhTitle { | ||
| 122 | .fontSize($r("app.float.font_size_12")) | 126 | .fontSize($r("app.float.font_size_12")) |
| 123 | .fontColor($r("app.color.color_B0B0B0")) | 127 | .fontColor($r("app.color.color_B0B0B0")) |
| 124 | } | 128 | } |
| 125 | - if (this.publishTime && this.rmhInfo.rmhDesc) { | 129 | + if (this.publishTime && this.rmhInfo?.rmhDesc) { |
| 126 | Image($r('app.media.point')) | 130 | Image($r('app.media.point')) |
| 127 | .width(16) | 131 | .width(16) |
| 128 | .height(16) | 132 | .height(16) |
| 129 | } | 133 | } |
| 130 | } | 134 | } |
| 131 | - Text(this.rmhInfo.rmhDesc) | 135 | + Text(this.rmhInfo?.rmhDesc) |
| 132 | .fontSize($r("app.float.font_size_12")) | 136 | .fontSize($r("app.float.font_size_12")) |
| 133 | .fontColor($r("app.color.color_B0B0B0")) | 137 | .fontColor($r("app.color.color_B0B0B0")) |
| 134 | .maxLines(1) | 138 | .maxLines(1) |
| @@ -141,7 +145,7 @@ export struct RmhTitle { | @@ -141,7 +145,7 @@ export struct RmhTitle { | ||
| 141 | } | 145 | } |
| 142 | 146 | ||
| 143 | Blank() | 147 | Blank() |
| 144 | - if (this.rmhInfo.cnIsAttention) { | 148 | + if (this.rmhInfo?.cnIsAttention) { |
| 145 | Row() { | 149 | Row() { |
| 146 | if (Number(this.followStatus) === 0) { | 150 | if (Number(this.followStatus) === 0) { |
| 147 | Image($r('app.media.rmh_follow')) | 151 | Image($r('app.media.rmh_follow')) |
| @@ -54,14 +54,13 @@ export struct CardAdvBottom { | @@ -54,14 +54,13 @@ export struct CardAdvBottom { | ||
| 54 | let currentIndex = -1 | 54 | let currentIndex = -1 |
| 55 | for (let i = 0; i < this.pageModel.compList.size(); i++) { | 55 | for (let i = 0; i < this.pageModel.compList.size(); i++) { |
| 56 | let b = this.pageModel.compList.getData(i) as CompDTO | 56 | let b = this.pageModel.compList.getData(i) as CompDTO |
| 57 | - if (a.compStyle === b.compStyle && a.matInfo === b.matInfo) { | 57 | + if (a.compStyle == b.compStyle && a.matInfo.id == b.matInfo.id && a.matInfo.originalPostion == b.matInfo.originalPostion) { |
| 58 | currentIndex = i | 58 | currentIndex = i |
| 59 | break; | 59 | break; |
| 60 | } | 60 | } |
| 61 | } | 61 | } |
| 62 | if (currentIndex >= 0) { | 62 | if (currentIndex >= 0) { |
| 63 | this.pageModel.compList.deleteItem(currentIndex) | 63 | this.pageModel.compList.deleteItem(currentIndex) |
| 64 | - this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 65 | } | 64 | } |
| 66 | } | 65 | } |
| 67 | } | 66 | } |
| 1 | //全标题 "appStyle":"2", | 1 | //全标题 "appStyle":"2", |
| 2 | -import { CompDTO, ContentDTO } from 'wdBean'; | 2 | +import { CompDTO } from 'wdBean'; |
| 3 | import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/AdvExtraData'; | 3 | import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/AdvExtraData'; |
| 4 | import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean'; | 4 | import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean'; |
| 5 | import { CommonConstants } from 'wdConstant/Index'; | 5 | import { CommonConstants } from 'wdConstant/Index'; |
| 6 | import { ProcessUtils } from 'wdRouter'; | 6 | import { ProcessUtils } from 'wdRouter'; |
| 7 | import PageModel from '../../viewmodel/PageModel'; | 7 | import PageModel from '../../viewmodel/PageModel'; |
| 8 | -import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 9 | -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | ||
| 10 | import { CardAdvTop } from './CardAdvTop'; | 8 | import { CardAdvTop } from './CardAdvTop'; |
| 11 | 9 | ||
| 12 | const TAG: string = 'Card2Component'; | 10 | const TAG: string = 'Card2Component'; |
| 1 | //全标题 "appStyle":"2", | 1 | //全标题 "appStyle":"2", |
| 2 | -import { CompDTO, ContentDTO } from 'wdBean'; | 2 | +import { CompDTO } from 'wdBean'; |
| 3 | import { CommonConstants } from 'wdConstant/Index'; | 3 | import { CommonConstants } from 'wdConstant/Index'; |
| 4 | import { ProcessUtils } from 'wdRouter'; | 4 | import { ProcessUtils } from 'wdRouter'; |
| 5 | import PageModel from '../../viewmodel/PageModel'; | 5 | import PageModel from '../../viewmodel/PageModel'; |
| 6 | -import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 7 | -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | ||
| 8 | import { CardAdvBottom } from './CardAdvBottom'; | 6 | import { CardAdvBottom } from './CardAdvBottom'; |
| 9 | 7 | ||
| 10 | const TAG: string = 'Card2Component'; | 8 | const TAG: string = 'Card2Component'; |
| @@ -66,14 +66,13 @@ export struct CardAdvTop { | @@ -66,14 +66,13 @@ export struct CardAdvTop { | ||
| 66 | let currentIndex = -1 | 66 | let currentIndex = -1 |
| 67 | for (let i = 0; i < this.pageModel.compList.size(); i++) { | 67 | for (let i = 0; i < this.pageModel.compList.size(); i++) { |
| 68 | let b = this.pageModel.compList.getData(i) as CompDTO | 68 | let b = this.pageModel.compList.getData(i) as CompDTO |
| 69 | - if (a.compStyle === b.compStyle && a.matInfo === b.matInfo) { | 69 | + if (a.compStyle == b.compStyle && a.matInfo.id == b.matInfo.id && a.matInfo.originalPostion == b.matInfo.originalPostion) { |
| 70 | currentIndex = i | 70 | currentIndex = i |
| 71 | break; | 71 | break; |
| 72 | } | 72 | } |
| 73 | } | 73 | } |
| 74 | if (currentIndex >= 0) { | 74 | if (currentIndex >= 0) { |
| 75 | this.pageModel.compList.deleteItem(currentIndex) | 75 | this.pageModel.compList.deleteItem(currentIndex) |
| 76 | - this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 77 | } | 76 | } |
| 78 | } | 77 | } |
| 79 | } | 78 | } |
| 1 | //全标题 "appStyle":"2", | 1 | //全标题 "appStyle":"2", |
| 2 | -import { CompDTO, ContentDTO, VideoInfoDTO } from 'wdBean'; | 2 | +import { CompDTO, ContentDTO } from 'wdBean'; |
| 3 | import { CommonConstants } from 'wdConstant/Index'; | 3 | import { CommonConstants } from 'wdConstant/Index'; |
| 4 | import { ProcessUtils } from 'wdRouter'; | 4 | import { ProcessUtils } from 'wdRouter'; |
| 5 | import PageModel from '../../viewmodel/PageModel'; | 5 | import PageModel from '../../viewmodel/PageModel'; |
| 6 | -import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 7 | -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 6 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; |
| 8 | import { CardAdvBottom } from './CardAdvBottom'; | 7 | import { CardAdvBottom } from './CardAdvBottom'; |
| 9 | 8 | ||
| 10 | const TAG: string = 'Card2Component'; | 9 | const TAG: string = 'Card2Component'; |
| 1 | -import { ContentDTO, slideShows, VideoInfoDTO } from 'wdBean'; | 1 | +import { ContentDTO, slideShows, VideoInfoDTO, CompDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant'; | 2 | import { CommonConstants } from 'wdConstant'; |
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; | 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; |
| @@ -16,18 +16,42 @@ const TAG: string = 'Card10Component'; | @@ -16,18 +16,42 @@ const TAG: string = 'Card10Component'; | ||
| 16 | export struct Card10Component { | 16 | export struct Card10Component { |
| 17 | @State contentDTO: ContentDTO = new ContentDTO(); | 17 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 18 | @State loadImg: boolean = false; | 18 | @State loadImg: boolean = false; |
| 19 | + @ObjectLink compDTO: CompDTO | ||
| 20 | + @State titleMarked: boolean = false; | ||
| 21 | + @State str01: string = ''; | ||
| 22 | + @State str02: string = ''; | ||
| 23 | + @State str03: string = ''; | ||
| 19 | 24 | ||
| 20 | async aboutToAppear(): Promise<void> { | 25 | async aboutToAppear(): Promise<void> { |
| 26 | + this.titleInit(); | ||
| 21 | this.loadImg = await onlyWifiLoadImg(); | 27 | this.loadImg = await onlyWifiLoadImg(); |
| 22 | } | 28 | } |
| 23 | 29 | ||
| 30 | + titleInit() { | ||
| 31 | + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { | ||
| 32 | + this.titleMarked = true; | ||
| 33 | + this.str01 = this.contentDTO.title?.split('<em>')[0] || ''; | ||
| 34 | + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || ''; | ||
| 35 | + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || ''; | ||
| 36 | + } | ||
| 37 | + } | ||
| 38 | + | ||
| 24 | build() { | 39 | build() { |
| 25 | Column() { | 40 | Column() { |
| 26 | // 顶部标题,最多两行 | 41 | // 顶部标题,最多两行 |
| 27 | if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { | 42 | if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { |
| 28 | - Text(this.contentDTO.newsTitle) | 43 | + Text() { |
| 44 | + if (this.titleMarked) { | ||
| 45 | + Span(this.str01) | ||
| 46 | + Span(this.str02) | ||
| 47 | + .fontColor(0xED2800) | ||
| 48 | + Span(this.str03) | ||
| 49 | + } else { | ||
| 50 | + Span(this.contentDTO.newsTitle) | ||
| 51 | + } | ||
| 52 | + } | ||
| 29 | .width(CommonConstants.FULL_WIDTH) | 53 | .width(CommonConstants.FULL_WIDTH) |
| 30 | - .fontSize($r('app.float.font_size_17')) | 54 | + .fontSize($r('app.float.font_size_18')) |
| 31 | .fontWeight(600) | 55 | .fontWeight(600) |
| 32 | .maxLines(2) | 56 | .maxLines(2) |
| 33 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 57 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| @@ -110,8 +134,10 @@ export struct Card10Component { | @@ -110,8 +134,10 @@ export struct Card10Component { | ||
| 110 | .textIndent(item.objectType == '5' ? 38 : 0) | 134 | .textIndent(item.objectType == '5' ? 38 : 0) |
| 111 | }.alignContent(Alignment.TopStart) | 135 | }.alignContent(Alignment.TopStart) |
| 112 | 136 | ||
| 137 | + //bottom 评论等信息 | ||
| 113 | CardSourceInfo( | 138 | CardSourceInfo( |
| 114 | { | 139 | { |
| 140 | + compDTO: this.compDTO, | ||
| 115 | contentDTO: this.createContent(item) | 141 | contentDTO: this.createContent(item) |
| 116 | } | 142 | } |
| 117 | ) | 143 | ) |
| 1 | //缩略标题 | 1 | //缩略标题 |
| 2 | -import { CommonConstants } from 'wdConstant' | ||
| 3 | -import { ContentDTO } from 'wdBean' | 2 | +import { CompDTO, ContentDTO } from 'wdBean' |
| 4 | import { DateTimeUtils } from 'wdKit' | 3 | import { DateTimeUtils } from 'wdKit' |
| 4 | +import { CommonConstants } from 'wdConstant'; | ||
| 5 | import { ProcessUtils } from 'wdRouter'; | 5 | import { ProcessUtils } from 'wdRouter'; |
| 6 | -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 6 | +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; |
| 7 | +import { Notes } from './notes'; | ||
| 8 | + | ||
| 7 | const TAG = 'Card11Component'; | 9 | const TAG = 'Card11Component'; |
| 8 | 10 | ||
| 9 | /** | 11 | /** |
| @@ -13,17 +15,57 @@ const TAG = 'Card11Component'; | @@ -13,17 +15,57 @@ const TAG = 'Card11Component'; | ||
| 13 | export struct Card11Component { | 15 | export struct Card11Component { |
| 14 | @State contentDTO: ContentDTO = new ContentDTO(); | 16 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 15 | @State clicked: boolean = false; | 17 | @State clicked: boolean = false; |
| 18 | + @ObjectLink compDTO: CompDTO | ||
| 19 | + @State titleMarked: boolean = false; | ||
| 20 | + @State str01: string = ''; | ||
| 21 | + @State str02: string = ''; | ||
| 22 | + @State str03: string = ''; | ||
| 23 | + | ||
| 24 | + async aboutToAppear(): Promise<void> { | ||
| 25 | + this.titleInit(); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + titleInit() { | ||
| 29 | + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { | ||
| 30 | + this.titleMarked = true; | ||
| 31 | + this.str01 = this.contentDTO.title?.split('<em>')[0] || ''; | ||
| 32 | + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || ''; | ||
| 33 | + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || ''; | ||
| 34 | + } | ||
| 35 | + } | ||
| 16 | 36 | ||
| 17 | build() { | 37 | build() { |
| 18 | Column() { | 38 | Column() { |
| 19 | - Text(this.contentDTO.newsTitle) | ||
| 20 | - .fontSize($r("app.float.font_size_16")) | 39 | + Stack() { |
| 40 | + if (this.contentDTO.newTags) { | ||
| 41 | + Notes({ newTags: this.contentDTO.newTags }) | ||
| 42 | + } else if (this.contentDTO.objectType == '5') { | ||
| 43 | + Notes({ objectType: this.contentDTO.objectType }) | ||
| 44 | + } | ||
| 45 | + Text() { | ||
| 46 | + if (this.titleMarked) { | ||
| 47 | + Span(this.str01) | ||
| 48 | + Span(this.str02) | ||
| 49 | + .fontColor(0xED2800) | ||
| 50 | + Span(this.str03) | ||
| 51 | + } else { | ||
| 52 | + Span(this.contentDTO.newsTitle) | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + .fontSize($r("app.float.font_size_18")) | ||
| 21 | .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) | 56 | .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) |
| 22 | .maxLines(3) | 57 | .maxLines(3) |
| 23 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 58 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 24 | .width(CommonConstants.FULL_WIDTH) | 59 | .width(CommonConstants.FULL_WIDTH) |
| 60 | + .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | ||
| 61 | + (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | ||
| 62 | + this.contentDTO.objectType == '5' ? 30 : 0) | ||
| 63 | + | ||
| 64 | + }.alignContent(Alignment.TopStart) | ||
| 65 | + | ||
| 66 | + | ||
| 25 | // 评论等信息 | 67 | // 评论等信息 |
| 26 | - CardSourceInfo({ contentDTO: this.contentDTO }) | 68 | + CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO }) |
| 27 | }.width(CommonConstants.FULL_WIDTH) | 69 | }.width(CommonConstants.FULL_WIDTH) |
| 28 | .padding({ | 70 | .padding({ |
| 29 | left: $r('app.float.card_comp_pagePadding_lf'), | 71 | left: $r('app.float.card_comp_pagePadding_lf'), |
| @@ -14,8 +14,22 @@ const TAG = 'Card12Component'; | @@ -14,8 +14,22 @@ const TAG = 'Card12Component'; | ||
| 14 | export struct Card12Component { | 14 | export struct Card12Component { |
| 15 | @State contentDTO: ContentDTO = new ContentDTO(); | 15 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 16 | @State clicked: boolean = false; | 16 | @State clicked: boolean = false; |
| 17 | + @State titleMarked: boolean = false; | ||
| 18 | + @State str01: string = ''; | ||
| 19 | + @State str02: string = ''; | ||
| 20 | + @State str03: string = ''; | ||
| 17 | 21 | ||
| 18 | aboutToAppear(): void { | 22 | aboutToAppear(): void { |
| 23 | + this.titleInit(); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + titleInit() { | ||
| 27 | + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { | ||
| 28 | + this.titleMarked = true; | ||
| 29 | + this.str01 = this.contentDTO.title?.split('<em>')[0] || ''; | ||
| 30 | + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || ''; | ||
| 31 | + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || ''; | ||
| 32 | + } | ||
| 19 | } | 33 | } |
| 20 | 34 | ||
| 21 | build() { | 35 | build() { |
| @@ -26,8 +40,17 @@ export struct Card12Component { | @@ -26,8 +40,17 @@ export struct Card12Component { | ||
| 26 | } | 40 | } |
| 27 | // 标题 | 41 | // 标题 |
| 28 | if (this.contentDTO.newsTitle) { | 42 | if (this.contentDTO.newsTitle) { |
| 29 | - Text(this.contentDTO.newsTitle) | ||
| 30 | - .fontSize($r('app.float.font_size_17')) | 43 | + Text() { |
| 44 | + if (this.titleMarked) { | ||
| 45 | + Span(this.str01) | ||
| 46 | + Span(this.str02) | ||
| 47 | + .fontColor(0xED2800) | ||
| 48 | + Span(this.str03) | ||
| 49 | + } else { | ||
| 50 | + Span(this.contentDTO.newsTitle) | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + .fontSize($r('app.float.font_size_18')) | ||
| 31 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 54 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 32 | .width(CommonConstants.FULL_WIDTH) | 55 | .width(CommonConstants.FULL_WIDTH) |
| 33 | .textOverflowStyle(3) | 56 | .textOverflowStyle(3) |
| @@ -37,7 +60,6 @@ export struct Card12Component { | @@ -37,7 +60,6 @@ export struct Card12Component { | ||
| 37 | .fontFamily('PingFang SC-Regular') | 60 | .fontFamily('PingFang SC-Regular') |
| 38 | } | 61 | } |
| 39 | CarderInteraction({contentDTO: this.contentDTO}) | 62 | CarderInteraction({contentDTO: this.contentDTO}) |
| 40 | - //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | ||
| 41 | } | 63 | } |
| 42 | .padding({ | 64 | .padding({ |
| 43 | left: $r('app.float.card_comp_pagePadding_lf'), | 65 | left: $r('app.float.card_comp_pagePadding_lf'), |
| @@ -16,11 +16,25 @@ export struct Card14Component { | @@ -16,11 +16,25 @@ export struct Card14Component { | ||
| 16 | @State contentDTO: ContentDTO = new ContentDTO(); | 16 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 17 | @State loadImg: boolean = false; | 17 | @State loadImg: boolean = false; |
| 18 | @State clicked: boolean = false; | 18 | @State clicked: boolean = false; |
| 19 | + @State titleMarked: boolean = false; | ||
| 20 | + @State str01: string = ''; | ||
| 21 | + @State str02: string = ''; | ||
| 22 | + @State str03: string = ''; | ||
| 19 | 23 | ||
| 20 | async aboutToAppear(): Promise<void> { | 24 | async aboutToAppear(): Promise<void> { |
| 25 | + this.titleInit(); | ||
| 21 | this.loadImg = await onlyWifiLoadImg(); | 26 | this.loadImg = await onlyWifiLoadImg(); |
| 22 | } | 27 | } |
| 23 | 28 | ||
| 29 | + titleInit() { | ||
| 30 | + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { | ||
| 31 | + this.titleMarked = true; | ||
| 32 | + this.str01 = this.contentDTO.title?.split('<em>')[0] || ''; | ||
| 33 | + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || ''; | ||
| 34 | + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || ''; | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + | ||
| 24 | build() { | 38 | build() { |
| 25 | Column() { | 39 | Column() { |
| 26 | // rmh信息 | 40 | // rmh信息 |
| @@ -30,8 +44,17 @@ export struct Card14Component { | @@ -30,8 +44,17 @@ export struct Card14Component { | ||
| 30 | // 左标题,右图 | 44 | // 左标题,右图 |
| 31 | Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) { | 45 | Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) { |
| 32 | 46 | ||
| 33 | - Text(this.contentDTO.newsTitle) | ||
| 34 | - .fontSize($r('app.float.font_size_17')) | 47 | + Text() { |
| 48 | + if (this.titleMarked) { | ||
| 49 | + Span(this.str01) | ||
| 50 | + Span(this.str02) | ||
| 51 | + .fontColor(0xED2800) | ||
| 52 | + Span(this.str03) | ||
| 53 | + } else { | ||
| 54 | + Span(this.contentDTO.newsTitle) | ||
| 55 | + } | ||
| 56 | + } | ||
| 57 | + .fontSize($r('app.float.font_size_18')) | ||
| 35 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 58 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 36 | .textOverflowStyle(3) | 59 | .textOverflowStyle(3) |
| 37 | .lineHeight(25) | 60 | .lineHeight(25) |
| @@ -20,11 +20,24 @@ export struct Card15Component { | @@ -20,11 +20,24 @@ export struct Card15Component { | ||
| 20 | @State contentDTO: ContentDTO = new ContentDTO(); | 20 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 21 | @State loadImg: boolean = false; | 21 | @State loadImg: boolean = false; |
| 22 | @State clicked: boolean = false; | 22 | @State clicked: boolean = false; |
| 23 | + @State titleMarked: boolean = false; | ||
| 24 | + @State str01: string = ''; | ||
| 25 | + @State str02: string = ''; | ||
| 26 | + @State str03: string = ''; | ||
| 23 | 27 | ||
| 24 | async aboutToAppear(): Promise<void> { | 28 | async aboutToAppear(): Promise<void> { |
| 29 | + this.titleInit(); | ||
| 25 | this.loadImg = await onlyWifiLoadImg(); | 30 | this.loadImg = await onlyWifiLoadImg(); |
| 26 | } | 31 | } |
| 27 | 32 | ||
| 33 | + titleInit() { | ||
| 34 | + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { | ||
| 35 | + this.titleMarked = true; | ||
| 36 | + this.str01 = this.contentDTO.title?.split('<em>')[0] || ''; | ||
| 37 | + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || ''; | ||
| 38 | + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || ''; | ||
| 39 | + } | ||
| 40 | + } | ||
| 28 | 41 | ||
| 29 | build() { | 42 | build() { |
| 30 | Column() { | 43 | Column() { |
| @@ -32,8 +45,17 @@ export struct Card15Component { | @@ -32,8 +45,17 @@ export struct Card15Component { | ||
| 32 | RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime }) | 45 | RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime }) |
| 33 | //新闻标题 | 46 | //新闻标题 |
| 34 | if (this.contentDTO.newsTitle) { | 47 | if (this.contentDTO.newsTitle) { |
| 35 | - Text(this.contentDTO.newsTitle) | ||
| 36 | - .fontSize($r('app.float.font_size_17')) | 48 | + Text() { |
| 49 | + if (this.titleMarked) { | ||
| 50 | + Span(this.str01) | ||
| 51 | + Span(this.str02) | ||
| 52 | + .fontColor(0xED2800) | ||
| 53 | + Span(this.str03) | ||
| 54 | + } else { | ||
| 55 | + Span(this.contentDTO.newsTitle) | ||
| 56 | + } | ||
| 57 | + } | ||
| 58 | + .fontSize($r('app.float.font_size_18')) | ||
| 37 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 59 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 38 | .width(CommonConstants.FULL_WIDTH) | 60 | .width(CommonConstants.FULL_WIDTH) |
| 39 | .textOverflowStyle(2) | 61 | .textOverflowStyle(2) |
| @@ -21,11 +21,25 @@ export struct Card16Component { | @@ -21,11 +21,25 @@ export struct Card16Component { | ||
| 21 | @State contentDTO: ContentDTO = new ContentDTO(); | 21 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 22 | @State loadImg: boolean = false; | 22 | @State loadImg: boolean = false; |
| 23 | @State clicked: boolean = false; | 23 | @State clicked: boolean = false; |
| 24 | + @State titleMarked: boolean = false; | ||
| 25 | + @State str01: string = ''; | ||
| 26 | + @State str02: string = ''; | ||
| 27 | + @State str03: string = ''; | ||
| 24 | 28 | ||
| 25 | async aboutToAppear(): Promise<void> { | 29 | async aboutToAppear(): Promise<void> { |
| 30 | + this.titleInit(); | ||
| 26 | this.loadImg = await onlyWifiLoadImg(); | 31 | this.loadImg = await onlyWifiLoadImg(); |
| 27 | } | 32 | } |
| 28 | 33 | ||
| 34 | + titleInit() { | ||
| 35 | + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { | ||
| 36 | + this.titleMarked = true; | ||
| 37 | + this.str01 = this.contentDTO.title?.split('<em>')[0] || ''; | ||
| 38 | + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || ''; | ||
| 39 | + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || ''; | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + | ||
| 29 | build() { | 43 | build() { |
| 30 | Column() { | 44 | Column() { |
| 31 | // rmh信息 | 45 | // rmh信息 |
| @@ -34,8 +48,17 @@ export struct Card16Component { | @@ -34,8 +48,17 @@ export struct Card16Component { | ||
| 34 | } | 48 | } |
| 35 | // 标题 | 49 | // 标题 |
| 36 | if (this.contentDTO.newsTitle) { | 50 | if (this.contentDTO.newsTitle) { |
| 37 | - Text(this.contentDTO.newsTitle) | ||
| 38 | - .fontSize($r('app.float.font_size_17')) | 51 | + Text() { |
| 52 | + if (this.titleMarked) { | ||
| 53 | + Span(this.str01) | ||
| 54 | + Span(this.str02) | ||
| 55 | + .fontColor(0xED2800) | ||
| 56 | + Span(this.str03) | ||
| 57 | + } else { | ||
| 58 | + Span(this.contentDTO.newsTitle) | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + .fontSize($r('app.float.font_size_18')) | ||
| 39 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 62 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 40 | .width(CommonConstants.FULL_WIDTH) | 63 | .width(CommonConstants.FULL_WIDTH) |
| 41 | .textOverflowStyle(2) | 64 | .textOverflowStyle(2) |
| 1 | import { Action, CompDTO, ContentDTO, Params } from 'wdBean'; | 1 | import { Action, CompDTO, ContentDTO, Params } from 'wdBean'; |
| 2 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; | 2 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; |
| 3 | import { CommonConstants } from 'wdConstant/Index'; | 3 | import { CommonConstants } from 'wdConstant/Index'; |
| 4 | -import { DateTimeUtils } from 'wdKit'; | ||
| 5 | import { WDRouterRule } from 'wdRouter'; | 4 | import { WDRouterRule } from 'wdRouter'; |
| 6 | -import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 7 | -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 5 | +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; |
| 8 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 6 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 7 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; | ||
| 9 | 8 | ||
| 10 | const TAG = 'Card17Component'; | 9 | const TAG = 'Card17Component'; |
| 11 | 10 | ||
| @@ -14,21 +13,43 @@ const TAG = 'Card17Component'; | @@ -14,21 +13,43 @@ const TAG = 'Card17Component'; | ||
| 14 | */ | 13 | */ |
| 15 | @Component | 14 | @Component |
| 16 | export struct Card17Component { | 15 | export struct Card17Component { |
| 17 | - @State compDTO: CompDTO = {} as CompDTO | ||
| 18 | @State contentDTO: ContentDTO = new ContentDTO(); | 16 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 19 | @State loadImg: boolean = false; | 17 | @State loadImg: boolean = false; |
| 20 | @State clicked: boolean = false; | 18 | @State clicked: boolean = false; |
| 19 | + @ObjectLink compDTO: CompDTO | ||
| 20 | + @State titleMarked: boolean = false; | ||
| 21 | + @State str01: string = ''; | ||
| 22 | + @State str02: string = ''; | ||
| 23 | + @State str03: string = ''; | ||
| 21 | 24 | ||
| 22 | async aboutToAppear(): Promise<void> { | 25 | async aboutToAppear(): Promise<void> { |
| 26 | + this.titleInit(); | ||
| 23 | this.loadImg = await onlyWifiLoadImg(); | 27 | this.loadImg = await onlyWifiLoadImg(); |
| 24 | } | 28 | } |
| 25 | 29 | ||
| 30 | + titleInit() { | ||
| 31 | + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { | ||
| 32 | + this.titleMarked = true; | ||
| 33 | + this.str01 = this.contentDTO.title?.split('<em>')[0] || ''; | ||
| 34 | + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || ''; | ||
| 35 | + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || ''; | ||
| 36 | + } | ||
| 37 | + } | ||
| 26 | 38 | ||
| 27 | build() { | 39 | build() { |
| 28 | Column({ space: 8 }) { | 40 | Column({ space: 8 }) { |
| 29 | - Text(this.contentDTO.newsTitle) | 41 | + Text() { |
| 42 | + if (this.titleMarked) { | ||
| 43 | + Span(this.str01) | ||
| 44 | + Span(this.str02) | ||
| 45 | + .fontColor(0xED2800) | ||
| 46 | + Span(this.str03) | ||
| 47 | + } else { | ||
| 48 | + Span(this.contentDTO.newsTitle) | ||
| 49 | + } | ||
| 50 | + } | ||
| 30 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 51 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 31 | - .fontSize($r('app.float.font_size_17')) | 52 | + .fontSize($r('app.float.font_size_18')) |
| 32 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 53 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 33 | .lineHeight(25) | 54 | .lineHeight(25) |
| 34 | .maxLines(3) | 55 | .maxLines(3) |
| @@ -38,10 +59,11 @@ export struct Card17Component { | @@ -38,10 +59,11 @@ export struct Card17Component { | ||
| 38 | // 三个图, | 59 | // 三个图, |
| 39 | GridRow({ gutter: 2 }) { | 60 | GridRow({ gutter: 2 }) { |
| 40 | GridCol({ span: { xs: 8 } }) { | 61 | GridCol({ span: { xs: 8 } }) { |
| 41 | - Image(this.loadImg ? this.contentDTO.fullColumnImgUrls.length > 0 ?this.contentDTO.fullColumnImgUrls[0].url:'' : '') | 62 | + Image(this.loadImg ? |
| 63 | + this.contentDTO.fullColumnImgUrls.length > 0 ? this.contentDTO.fullColumnImgUrls[0].url : '' : '') | ||
| 42 | .backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5) | 64 | .backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5) |
| 43 | .width(CommonConstants.FULL_WIDTH) | 65 | .width(CommonConstants.FULL_WIDTH) |
| 44 | - .aspectRatio(16 / 9) | 66 | + .height(160)// .aspectRatio(CompUtils.ASPECT_RATIO_16_9) |
| 45 | .borderRadius({ | 67 | .borderRadius({ |
| 46 | topLeft: $r('app.float.image_border_radius'), | 68 | topLeft: $r('app.float.image_border_radius'), |
| 47 | bottomLeft: $r('app.float.image_border_radius'), | 69 | bottomLeft: $r('app.float.image_border_radius'), |
| @@ -49,10 +71,11 @@ export struct Card17Component { | @@ -49,10 +71,11 @@ export struct Card17Component { | ||
| 49 | } | 71 | } |
| 50 | 72 | ||
| 51 | GridCol({ span: { xs: 4 } }) { | 73 | GridCol({ span: { xs: 4 } }) { |
| 52 | - Image(this.loadImg ? this.contentDTO.fullColumnImgUrls.length > 1? this.contentDTO.fullColumnImgUrls[1].url:'' : '') | 74 | + Image(this.loadImg ? |
| 75 | + this.contentDTO.fullColumnImgUrls.length > 1 ? this.contentDTO.fullColumnImgUrls[1].url : '' : '') | ||
| 53 | .backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5) | 76 | .backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5) |
| 54 | .width(CommonConstants.FULL_WIDTH) | 77 | .width(CommonConstants.FULL_WIDTH) |
| 55 | - .aspectRatio(16 / 9) | 78 | + .height(79)// .aspectRatio(CompUtils.ASPECT_RATIO_16_9) |
| 56 | .margin({ bottom: 1 }) | 79 | .margin({ bottom: 1 }) |
| 57 | .borderRadius({ | 80 | .borderRadius({ |
| 58 | topRight: $r('app.float.image_border_radius'), | 81 | topRight: $r('app.float.image_border_radius'), |
| @@ -65,10 +88,11 @@ export struct Card17Component { | @@ -65,10 +88,11 @@ export struct Card17Component { | ||
| 65 | } | 88 | } |
| 66 | 89 | ||
| 67 | GridCol({ span: { xs: 4 } }) { | 90 | GridCol({ span: { xs: 4 } }) { |
| 68 | - Image(this.loadImg ? this.contentDTO.fullColumnImgUrls.length > 2? this.contentDTO.fullColumnImgUrls[2].url:'' : '') | 91 | + Image(this.loadImg ? |
| 92 | + this.contentDTO.fullColumnImgUrls.length > 2 ? this.contentDTO.fullColumnImgUrls[2].url : '' : '') | ||
| 69 | .backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5) | 93 | .backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5) |
| 70 | .width(CommonConstants.FULL_WIDTH) | 94 | .width(CommonConstants.FULL_WIDTH) |
| 71 | - .aspectRatio(16 / 9) | 95 | + .height(79)// .aspectRatio(CompUtils.ASPECT_RATIO_16_9) |
| 72 | .margin({ top: 1 }) | 96 | .margin({ top: 1 }) |
| 73 | .borderRadius({ | 97 | .borderRadius({ |
| 74 | bottomRight: $r('app.float.image_border_radius'), | 98 | bottomRight: $r('app.float.image_border_radius'), |
| @@ -94,8 +118,9 @@ export struct Card17Component { | @@ -94,8 +118,9 @@ export struct Card17Component { | ||
| 94 | }; | 118 | }; |
| 95 | WDRouterRule.jumpWithAction(taskAction) | 119 | WDRouterRule.jumpWithAction(taskAction) |
| 96 | }) | 120 | }) |
| 121 | + | ||
| 97 | // 评论等信息 | 122 | // 评论等信息 |
| 98 | - CardSourceInfo({ contentDTO: this.contentDTO }) | 123 | + CardSourceInfo({compDTO:this.compDTO, contentDTO: this.contentDTO }) |
| 99 | } | 124 | } |
| 100 | .width(CommonConstants.FULL_WIDTH) | 125 | .width(CommonConstants.FULL_WIDTH) |
| 101 | .padding({ | 126 | .padding({ |
| @@ -105,4 +130,12 @@ export struct Card17Component { | @@ -105,4 +130,12 @@ export struct Card17Component { | ||
| 105 | bottom: $r('app.float.card_comp_pagePadding_tb') | 130 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 106 | }) | 131 | }) |
| 107 | } | 132 | } |
| 133 | +} | ||
| 134 | + | ||
| 135 | +// 全局公共样式 | ||
| 136 | +@Styles | ||
| 137 | +function ImageSize() { | ||
| 138 | + .padding({ right: 18, left: 18 }) | ||
| 139 | + .width('100%') | ||
| 140 | + .margin({ top: 10 }) | ||
| 108 | } | 141 | } |
| @@ -2,7 +2,7 @@ import { ContentDTO, FullColumnImgUrlDTO, PhotoListBean } from 'wdBean'; | @@ -2,7 +2,7 @@ import { ContentDTO, FullColumnImgUrlDTO, PhotoListBean } from 'wdBean'; | ||
| 2 | import { RmhTitle } from '../cardCommon/RmhTitle' | 2 | import { RmhTitle } from '../cardCommon/RmhTitle' |
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { CommonConstants } from 'wdConstant/Index'; | 4 | import { CommonConstants } from 'wdConstant/Index'; |
| 5 | -import {CarderInteraction} from '../CarderInteraction' | 5 | +import { CarderInteraction } from '../CarderInteraction' |
| 6 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 6 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 7 | 7 | ||
| 8 | const TAG = 'Card19Component'; | 8 | const TAG = 'Card19Component'; |
| @@ -14,6 +14,24 @@ const TAG = 'Card19Component'; | @@ -14,6 +14,24 @@ const TAG = 'Card19Component'; | ||
| 14 | export struct Card19Component { | 14 | export struct Card19Component { |
| 15 | @State contentDTO: ContentDTO = new ContentDTO() | 15 | @State contentDTO: ContentDTO = new ContentDTO() |
| 16 | @State clicked: boolean = false; | 16 | @State clicked: boolean = false; |
| 17 | + @State titleMarked: boolean = false; | ||
| 18 | + @State str01: string = ''; | ||
| 19 | + @State str02: string = ''; | ||
| 20 | + @State str03: string = ''; | ||
| 21 | + | ||
| 22 | + async aboutToAppear(): Promise<void> { | ||
| 23 | + this.titleInit(); | ||
| 24 | + console.log('card19',JSON.stringify(this.contentDTO)) | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + titleInit() { | ||
| 28 | + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { | ||
| 29 | + this.titleMarked = true; | ||
| 30 | + this.str01 = this.contentDTO.title?.split('<em>')[0] || ''; | ||
| 31 | + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || ''; | ||
| 32 | + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || ''; | ||
| 33 | + } | ||
| 34 | + } | ||
| 17 | 35 | ||
| 18 | build() { | 36 | build() { |
| 19 | Column() { | 37 | Column() { |
| @@ -21,12 +39,22 @@ export struct Card19Component { | @@ -21,12 +39,22 @@ export struct Card19Component { | ||
| 21 | RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime }) | 39 | RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime }) |
| 22 | // 标题 | 40 | // 标题 |
| 23 | if (this.contentDTO.newsTitle) { | 41 | if (this.contentDTO.newsTitle) { |
| 24 | - Text(this.contentDTO.newsTitle) | ||
| 25 | - .fontSize($r('app.float.font_size_17')) | 42 | + Text() { |
| 43 | + if (this.titleMarked) { | ||
| 44 | + Span(this.str01) | ||
| 45 | + Span(this.str02) | ||
| 46 | + .fontColor(0xED2800) | ||
| 47 | + Span(this.str03) | ||
| 48 | + } else { | ||
| 49 | + Span(this.contentDTO.newsTitle) | ||
| 50 | + } | ||
| 51 | + } | ||
| 52 | + .fontSize($r('app.float.font_size_18')) | ||
| 26 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 53 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 27 | .textOverflowStyle(3) | 54 | .textOverflowStyle(3) |
| 28 | .margin({ bottom: 8 }) | 55 | .margin({ bottom: 8 }) |
| 29 | .width(CommonConstants.FULL_WIDTH) | 56 | .width(CommonConstants.FULL_WIDTH) |
| 57 | + .lineHeight(25) | ||
| 30 | .onClick((event: ClickEvent) => { | 58 | .onClick((event: ClickEvent) => { |
| 31 | this.clicked = true; | 59 | this.clicked = true; |
| 32 | ProcessUtils.processPage(this.contentDTO) | 60 | ProcessUtils.processPage(this.contentDTO) |
| @@ -39,16 +67,16 @@ export struct Card19Component { | @@ -39,16 +67,16 @@ export struct Card19Component { | ||
| 39 | const photo: PhotoListBean = { | 67 | const photo: PhotoListBean = { |
| 40 | width: item.weight, | 68 | width: item.weight, |
| 41 | height: item.height, | 69 | height: item.height, |
| 42 | - picPath: item.fullUrl, | 70 | + picPath: item.fullUrl||item.url, |
| 43 | picDesc: '', | 71 | picDesc: '', |
| 44 | itemType:2, | 72 | itemType:2, |
| 45 | id:0 | 73 | id:0 |
| 46 | } | 74 | } |
| 47 | return photo | 75 | return photo |
| 48 | }) | 76 | }) |
| 49 | - ProcessUtils.gotoMultiPictureListPage(photoList,0) | 77 | + ProcessUtils.gotoMultiPictureListPage(photoList, 0) |
| 50 | }) | 78 | }) |
| 51 | - CarderInteraction({contentDTO: this.contentDTO}) | 79 | + CarderInteraction({ contentDTO: this.contentDTO }) |
| 52 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 80 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 53 | } | 81 | } |
| 54 | .padding({ | 82 | .padding({ |
| @@ -80,11 +108,12 @@ struct createImg { | @@ -80,11 +108,12 @@ struct createImg { | ||
| 80 | 108 | ||
| 81 | async aboutToAppear(): Promise<void> { | 109 | async aboutToAppear(): Promise<void> { |
| 82 | this.loadImg = await onlyWifiLoadImg(); | 110 | this.loadImg = await onlyWifiLoadImg(); |
| 83 | - if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位 | ||
| 84 | - this.fullColumnImgUrls.splice(2,0, { | 111 | + if (this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位 |
| 112 | + this.fullColumnImgUrls.splice(2, 0, { | ||
| 85 | fullUrl: '' | 113 | fullUrl: '' |
| 86 | } as FullColumnImgUrlDTO) | 114 | } as FullColumnImgUrlDTO) |
| 87 | } | 115 | } |
| 116 | + console.log('card19-this.fullColumnImgUrls',JSON.stringify(this.fullColumnImgUrls)) | ||
| 88 | } | 117 | } |
| 89 | 118 | ||
| 90 | caclImageRadius(index: number) { | 119 | caclImageRadius(index: number) { |
| @@ -111,10 +140,10 @@ struct createImg { | @@ -111,10 +140,10 @@ struct createImg { | ||
| 111 | } | 140 | } |
| 112 | 141 | ||
| 113 | getPicType(){ | 142 | getPicType(){ |
| 114 | - if (this.picWidth && this.picWidth) { | ||
| 115 | - if (this.picWidth / this.picHeight > 343/172) { | 143 | + if (this.picWidth && this.picHeight) { |
| 144 | + if (this.picWidth / this.picHeight > 2/1) { | ||
| 116 | return 1; //横长图 | 145 | return 1; //横长图 |
| 117 | - } else if (this.picHeight / this.picWidth > 305/228) { | 146 | + } else if ( this.picWidth/this.picHeight < 1/2) { |
| 118 | return 2; //竖长图 | 147 | return 2; //竖长图 |
| 119 | } else { | 148 | } else { |
| 120 | return 3 | 149 | return 3 |
| @@ -124,7 +153,6 @@ struct createImg { | @@ -124,7 +153,6 @@ struct createImg { | ||
| 124 | } | 153 | } |
| 125 | } | 154 | } |
| 126 | 155 | ||
| 127 | - | ||
| 128 | build() { | 156 | build() { |
| 129 | GridRow({ | 157 | GridRow({ |
| 130 | gutter: { x: 2, y: 2 } | 158 | gutter: { x: 2, y: 2 } |
| @@ -139,14 +167,14 @@ struct createImg { | @@ -139,14 +167,14 @@ struct createImg { | ||
| 139 | alignContent: Alignment.BottomEnd | 167 | alignContent: Alignment.BottomEnd |
| 140 | }) { | 168 | }) { |
| 141 | if (this.getPicType() === 1) { | 169 | if (this.getPicType() === 1) { |
| 142 | - Image(this.loadImg ? item.fullUrl : '') | 170 | + Image(this.loadImg ? item.fullUrl||item.url : '') |
| 143 | .backgroundColor(0xf5f5f5) | 171 | .backgroundColor(0xf5f5f5) |
| 144 | .width('100%') | 172 | .width('100%') |
| 145 | .height(172) | 173 | .height(172) |
| 146 | .autoResize(true) | 174 | .autoResize(true) |
| 147 | .borderRadius(this.caclImageRadius(index)) | 175 | .borderRadius(this.caclImageRadius(index)) |
| 148 | } else if (this.getPicType() === 2) { | 176 | } else if (this.getPicType() === 2) { |
| 149 | - Image(this.loadImg ? item.fullUrl : '') | 177 | + Image(this.loadImg ? item.fullUrl||item.url : '') |
| 150 | .width('100%') | 178 | .width('100%') |
| 151 | .height(305) | 179 | .height(305) |
| 152 | .autoResize(true) | 180 | .autoResize(true) |
| @@ -154,15 +182,20 @@ struct createImg { | @@ -154,15 +182,20 @@ struct createImg { | ||
| 154 | } | 182 | } |
| 155 | Flex({ direction: FlexDirection.Row }) { | 183 | Flex({ direction: FlexDirection.Row }) { |
| 156 | Image($r('app.media.icon_long_pic')) | 184 | Image($r('app.media.icon_long_pic')) |
| 157 | - .width(14) | ||
| 158 | - .height(14) | 185 | + .width(12) |
| 186 | + .height(12) | ||
| 159 | .margin({right: 4}) | 187 | .margin({right: 4}) |
| 160 | Text('长图') | 188 | Text('长图') |
| 161 | - .fontSize(12) | 189 | + .fontSize(10) |
| 162 | .fontWeight(400) | 190 | .fontWeight(400) |
| 191 | + .textShadow({ | ||
| 192 | + radius: 1, | ||
| 193 | + color: '#777', | ||
| 194 | + offsetX:1, | ||
| 195 | + offsetY:1 | ||
| 196 | + }) | ||
| 163 | .fontColor(0xffffff) | 197 | .fontColor(0xffffff) |
| 164 | .fontFamily('PingFang SC') | 198 | .fontFamily('PingFang SC') |
| 165 | - .shadow({radius: 4, color: 0xc3cbd5, offsetX: 4, offsetY: 4}) | ||
| 166 | } | 199 | } |
| 167 | .width(48) | 200 | .width(48) |
| 168 | .padding({bottom: 9}) | 201 | .padding({bottom: 9}) |
| @@ -189,19 +222,75 @@ struct createImg { | @@ -189,19 +222,75 @@ struct createImg { | ||
| 189 | GridCol({ | 222 | GridCol({ |
| 190 | span: { xs: 4 } | 223 | span: { xs: 4 } |
| 191 | }) { | 224 | }) { |
| 192 | - Image(this.loadImg ? item.fullUrl : '') | ||
| 193 | - .backgroundColor(0xf5f5f5) | ||
| 194 | - .aspectRatio(1) | ||
| 195 | - .borderRadius(this.caclImageRadius(index)) | 225 | + Stack({alignContent: Alignment.BottomEnd}) { |
| 226 | + Image(this.loadImg ? item.fullUrl : '') | ||
| 227 | + .backgroundColor(0xf5f5f5) | ||
| 228 | + .aspectRatio(1) | ||
| 229 | + .borderRadius(this.caclImageRadius(index)) | ||
| 230 | + .onComplete(callback => { | ||
| 231 | + this.picWidth = callback?.width || 0; | ||
| 232 | + this.picHeight = callback?.height || 0; | ||
| 233 | + }) | ||
| 234 | + if(this.getPicType() !== 3){ | ||
| 235 | + Flex({ direction: FlexDirection.Row }) { | ||
| 236 | + Image($r('app.media.icon_long_pic')) | ||
| 237 | + .width(12) | ||
| 238 | + .height(12) | ||
| 239 | + .margin({ right: 4 }) | ||
| 240 | + Text('长图') | ||
| 241 | + .fontSize(10) | ||
| 242 | + .fontWeight(400) | ||
| 243 | + .textShadow({ | ||
| 244 | + radius: 1, | ||
| 245 | + color: `rgba(0,0,0,0.5)`, | ||
| 246 | + offsetY:1, | ||
| 247 | + offsetX:1 | ||
| 248 | + }) | ||
| 249 | + .fontColor(0xffffff) | ||
| 250 | + .fontFamily('PingFang SC') | ||
| 251 | + } | ||
| 252 | + .width(48) | ||
| 253 | + .align(Alignment.BottomEnd) | ||
| 254 | + .padding({ bottom: 3 }) | ||
| 255 | + } | ||
| 256 | + } | ||
| 196 | } | 257 | } |
| 197 | } else { | 258 | } else { |
| 198 | GridCol({ | 259 | GridCol({ |
| 199 | span: { sm: 4, lg: 3 } | 260 | span: { sm: 4, lg: 3 } |
| 200 | }) { | 261 | }) { |
| 201 | - Image(this.loadImg ? item.fullUrl : '') | ||
| 202 | - .backgroundColor(0xf5f5f5) | ||
| 203 | - .aspectRatio(1) | ||
| 204 | - .borderRadius(this.caclImageRadius(index)) | 262 | + Stack({ alignContent: Alignment.BottomEnd }) { |
| 263 | + Image(this.loadImg ? item.fullUrl : '') | ||
| 264 | + .backgroundColor(0xf5f5f5) | ||
| 265 | + .aspectRatio(1) | ||
| 266 | + .borderRadius(this.caclImageRadius(index)) | ||
| 267 | + .onComplete(callback => { | ||
| 268 | + this.picWidth = callback?.width || 0; | ||
| 269 | + this.picHeight = callback?.height || 0; | ||
| 270 | + }) | ||
| 271 | + if (this.getPicType() !== 3) { | ||
| 272 | + Flex({ direction: FlexDirection.Row }) { | ||
| 273 | + Image($r('app.media.icon_long_pic')) | ||
| 274 | + .width(12) | ||
| 275 | + .height(12) | ||
| 276 | + .margin({ right: 4 }) | ||
| 277 | + Text('长图') | ||
| 278 | + .fontSize(10) | ||
| 279 | + .fontWeight(400) | ||
| 280 | + .textShadow({ | ||
| 281 | + radius: 1, | ||
| 282 | + color: `rgba(0,0,0,0.5)`, | ||
| 283 | + offsetY: 1, | ||
| 284 | + offsetX: 1 | ||
| 285 | + }) | ||
| 286 | + .fontColor(0xffffff) | ||
| 287 | + .fontFamily('PingFang SC') | ||
| 288 | + } | ||
| 289 | + .width(48) | ||
| 290 | + .align(Alignment.BottomEnd) | ||
| 291 | + .padding({ bottom: 3 }) | ||
| 292 | + } | ||
| 293 | + } | ||
| 205 | } | 294 | } |
| 206 | } | 295 | } |
| 207 | }) | 296 | }) |
| @@ -15,8 +15,22 @@ const TAG = 'Card20Component'; | @@ -15,8 +15,22 @@ const TAG = 'Card20Component'; | ||
| 15 | export struct Card20Component { | 15 | export struct Card20Component { |
| 16 | @State contentDTO: ContentDTO = new ContentDTO(); | 16 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 17 | @State clicked: boolean = false; | 17 | @State clicked: boolean = false; |
| 18 | + @State titleMarked: boolean = false; | ||
| 19 | + @State str01: string = ''; | ||
| 20 | + @State str02: string = ''; | ||
| 21 | + @State str03: string = ''; | ||
| 18 | 22 | ||
| 19 | aboutToAppear(): void { | 23 | aboutToAppear(): void { |
| 24 | + this.titleInit(); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + titleInit() { | ||
| 28 | + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { | ||
| 29 | + this.titleMarked = true; | ||
| 30 | + this.str01 = this.contentDTO.title?.split('<em>')[0] || ''; | ||
| 31 | + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || ''; | ||
| 32 | + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || ''; | ||
| 33 | + } | ||
| 20 | } | 34 | } |
| 21 | 35 | ||
| 22 | build() { | 36 | build() { |
| @@ -25,13 +39,23 @@ export struct Card20Component { | @@ -25,13 +39,23 @@ export struct Card20Component { | ||
| 25 | RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime }) | 39 | RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime }) |
| 26 | // 标题 | 40 | // 标题 |
| 27 | if (this.contentDTO.newsTitle) { | 41 | if (this.contentDTO.newsTitle) { |
| 28 | - Text(this.contentDTO.newsTitle) | ||
| 29 | - .fontSize($r('app.float.font_size_17')) | 42 | + Text() { |
| 43 | + | ||
| 44 | + if (this.titleMarked) { | ||
| 45 | + Span(this.str01) | ||
| 46 | + Span(this.str02) | ||
| 47 | + .fontColor(0xED2800) | ||
| 48 | + Span(this.str03) | ||
| 49 | + } else { | ||
| 50 | + Span(this.contentDTO.newsTitle) | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + .fontSize($r('app.float.font_size_18')) | ||
| 30 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 54 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 31 | .width(CommonConstants.FULL_WIDTH) | 55 | .width(CommonConstants.FULL_WIDTH) |
| 32 | .textOverflowStyle(3) | 56 | .textOverflowStyle(3) |
| 33 | .margin({ bottom: 8 }) | 57 | .margin({ bottom: 8 }) |
| 34 | - .lineHeight(20) | 58 | + .lineHeight(22) |
| 35 | } | 59 | } |
| 36 | if (this.contentDTO.fullColumnImgUrls[0]) { | 60 | if (this.contentDTO.fullColumnImgUrls[0]) { |
| 37 | createImg({ contentDTO: this.contentDTO }) | 61 | createImg({ contentDTO: this.contentDTO }) |
| @@ -16,11 +16,25 @@ export struct Card21Component { | @@ -16,11 +16,25 @@ export struct Card21Component { | ||
| 16 | @State contentDTO: ContentDTO = new ContentDTO(); | 16 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 17 | @State loadImg: boolean = false; | 17 | @State loadImg: boolean = false; |
| 18 | @State clicked: boolean = false; | 18 | @State clicked: boolean = false; |
| 19 | + @State titleMarked: boolean = false; | ||
| 20 | + @State str01: string = ''; | ||
| 21 | + @State str02: string = ''; | ||
| 22 | + @State str03: string = ''; | ||
| 19 | 23 | ||
| 20 | async aboutToAppear(): Promise<void> { | 24 | async aboutToAppear(): Promise<void> { |
| 25 | + this.titleInit(); | ||
| 21 | this.loadImg = await onlyWifiLoadImg(); | 26 | this.loadImg = await onlyWifiLoadImg(); |
| 22 | } | 27 | } |
| 23 | 28 | ||
| 29 | + titleInit() { | ||
| 30 | + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { | ||
| 31 | + this.titleMarked = true; | ||
| 32 | + this.str01 = this.contentDTO.title?.split('<em>')[0] || ''; | ||
| 33 | + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || ''; | ||
| 34 | + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || ''; | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + | ||
| 24 | build() { | 38 | build() { |
| 25 | Column() { | 39 | Column() { |
| 26 | // 顶部 rmh信息 | 40 | // 顶部 rmh信息 |
| @@ -28,8 +42,17 @@ export struct Card21Component { | @@ -28,8 +42,17 @@ export struct Card21Component { | ||
| 28 | // 中间内容 | 42 | // 中间内容 |
| 29 | Grid() { | 43 | Grid() { |
| 30 | GridItem() { | 44 | GridItem() { |
| 31 | - Text(`${this.contentDTO.newsTitle}`) | ||
| 32 | - .fontSize($r('app.float.selected_text_size')) | 45 | + Text() { |
| 46 | + if (this.titleMarked) { | ||
| 47 | + Span(this.str01) | ||
| 48 | + Span(this.str02) | ||
| 49 | + .fontColor(0xED2800) | ||
| 50 | + Span(this.str03) | ||
| 51 | + } else { | ||
| 52 | + Span(this.contentDTO.newsTitle) | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + .fontSize(18) | ||
| 33 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 56 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 34 | .width(CommonConstants.FULL_WIDTH) | 57 | .width(CommonConstants.FULL_WIDTH) |
| 35 | .maxLines(4) | 58 | .maxLines(4) |
| 1 | //全标题 "appStyle":"2", | 1 | //全标题 "appStyle":"2", |
| 2 | -import { ContentDTO } from 'wdBean'; | 2 | +import { CompDTO, ContentDTO } from 'wdBean'; |
| 3 | import { CommonConstants } from 'wdConstant/Index'; | 3 | import { CommonConstants } from 'wdConstant/Index'; |
| 4 | import { ProcessUtils } from 'wdRouter'; | 4 | import { ProcessUtils } from 'wdRouter'; |
| 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; | 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; |
| 6 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; | 6 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; |
| 7 | import { Notes } from './notes'; | 7 | import { Notes } from './notes'; |
| 8 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 8 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 9 | - | 9 | +// import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; |
| 10 | const TAG: string = 'Card2Component'; | 10 | const TAG: string = 'Card2Component'; |
| 11 | 11 | ||
| 12 | /** | 12 | /** |
| @@ -21,9 +21,25 @@ export struct Card2Component { | @@ -21,9 +21,25 @@ export struct Card2Component { | ||
| 21 | @State contentDTO: ContentDTO = new ContentDTO(); | 21 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 22 | @State loadImg: boolean = false; | 22 | @State loadImg: boolean = false; |
| 23 | @State clicked: boolean = false; | 23 | @State clicked: boolean = false; |
| 24 | + @ObjectLink compDTO: CompDTO | ||
| 25 | + @State titleMarked: boolean = false; | ||
| 26 | + @State str01: string = ''; | ||
| 27 | + @State str02: string = ''; | ||
| 28 | + @State str03: string = ''; | ||
| 24 | 29 | ||
| 25 | async aboutToAppear(): Promise<void> { | 30 | async aboutToAppear(): Promise<void> { |
| 31 | + this.titleInit(); | ||
| 26 | this.loadImg = await onlyWifiLoadImg(); | 32 | this.loadImg = await onlyWifiLoadImg(); |
| 33 | + // this.clicked = hasClicked(this.contentDTO.objectId) | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + titleInit() { | ||
| 37 | + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { | ||
| 38 | + this.titleMarked = true; | ||
| 39 | + this.str01 = this.contentDTO.title?.split('<em>')[0] || ''; | ||
| 40 | + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || ''; | ||
| 41 | + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || ''; | ||
| 42 | + } | ||
| 27 | } | 43 | } |
| 28 | 44 | ||
| 29 | build() { | 45 | build() { |
| @@ -31,18 +47,34 @@ export struct Card2Component { | @@ -31,18 +47,34 @@ export struct Card2Component { | ||
| 31 | Column() { | 47 | Column() { |
| 32 | Stack() { | 48 | Stack() { |
| 33 | //新闻标题 | 49 | //新闻标题 |
| 34 | - if (this.contentDTO.objectType == '5') { | ||
| 35 | - Notes({ objectType: this.contentDTO.objectType }) | 50 | + if (this.contentDTO.newTags) { |
| 51 | + Notes({ newTags: this.contentDTO.newTags }) | ||
| 52 | + } else if (this.contentDTO.objectType == '5') { | ||
| 53 | + Notes({ objectType: this.contentDTO.objectType }) | ||
| 36 | } | 54 | } |
| 37 | - Text(this.contentDTO.newsTitle) | ||
| 38 | - .fontSize($r('app.float.font_size_17')) | ||
| 39 | - .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | ||
| 40 | - .maxLines(2) | ||
| 41 | - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | ||
| 42 | - .align(Alignment.Start) | ||
| 43 | - .textIndent(this.contentDTO.objectType == '5' ? 35 : 0) | ||
| 44 | - } | ||
| 45 | - .alignContent(Alignment.TopStart) | 55 | + |
| 56 | + Text() { | ||
| 57 | + if (this.titleMarked) { | ||
| 58 | + Span(this.str01) | ||
| 59 | + Span(this.str02) | ||
| 60 | + .fontColor(0xED2800) | ||
| 61 | + Span(this.str03) | ||
| 62 | + } else { | ||
| 63 | + Span(this.contentDTO.newsTitle) | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + .fontSize($r('app.float.font_size_18')) | ||
| 67 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | ||
| 68 | + .maxLines(2) | ||
| 69 | + .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | ||
| 70 | + .align(Alignment.Start) | ||
| 71 | + .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | ||
| 72 | + (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | ||
| 73 | + this.contentDTO.objectType == '5' ? 30 : 0) | ||
| 74 | + }.alignContent(Alignment.TopStart) | ||
| 75 | + //.textIndent(this.contentDTO.objectType == '5' ? 35 : 0) | ||
| 76 | + // } | ||
| 77 | + // .alignContent(Alignment.TopStart) | ||
| 46 | 78 | ||
| 47 | //大图 | 79 | //大图 |
| 48 | Stack() { | 80 | Stack() { |
| @@ -64,7 +96,7 @@ export struct Card2Component { | @@ -64,7 +96,7 @@ export struct Card2Component { | ||
| 64 | 96 | ||
| 65 | //bottom | 97 | //bottom |
| 66 | // 评论等信息 | 98 | // 评论等信息 |
| 67 | - CardSourceInfo({ contentDTO: this.contentDTO }) | 99 | + CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO }) |
| 68 | } | 100 | } |
| 69 | .width(CommonConstants.FULL_WIDTH) | 101 | .width(CommonConstants.FULL_WIDTH) |
| 70 | .padding({ | 102 | .padding({ |
| @@ -75,6 +107,7 @@ export struct Card2Component { | @@ -75,6 +107,7 @@ export struct Card2Component { | ||
| 75 | }) | 107 | }) |
| 76 | .onClick((event: ClickEvent) => { | 108 | .onClick((event: ClickEvent) => { |
| 77 | this.clicked = true; | 109 | this.clicked = true; |
| 110 | + // persistentStorage(this.contentDTO.objectId); | ||
| 78 | ProcessUtils.processPage(this.contentDTO) | 111 | ProcessUtils.processPage(this.contentDTO) |
| 79 | }) | 112 | }) |
| 80 | } | 113 | } |
| 1 | -import { ContentDTO } from 'wdBean'; | ||
| 2 | -import { CommonConstants } from 'wdConstant' | 1 | +import { CommonConstants } from 'wdConstant'; |
| 2 | +import { CompDTO, ContentDTO } from 'wdBean'; | ||
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 4 | +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; |
| 5 | +import { Notes } from './notes'; | ||
| 5 | 6 | ||
| 6 | /** | 7 | /** |
| 7 | * 卡片样式:"appStyle":"3" | 8 | * 卡片样式:"appStyle":"3" |
| @@ -11,15 +12,55 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | @@ -11,15 +12,55 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | ||
| 11 | export struct Card3Component { | 12 | export struct Card3Component { |
| 12 | @State contentDTO: ContentDTO = new ContentDTO(); | 13 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 13 | @State clicked: boolean = false; | 14 | @State clicked: boolean = false; |
| 15 | + @ObjectLink compDTO: CompDTO | ||
| 16 | + @State titleMarked: boolean = false; | ||
| 17 | + @State str01: string = ''; | ||
| 18 | + @State str02: string = ''; | ||
| 19 | + @State str03: string = ''; | ||
| 20 | + | ||
| 21 | + async aboutToAppear(): Promise<void> { | ||
| 22 | + this.titleInit(); | ||
| 23 | + // this.clicked = hasClicked(this.contentDTO.objectId) | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + titleInit() { | ||
| 27 | + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { | ||
| 28 | + this.titleMarked = true; | ||
| 29 | + this.str01 = this.contentDTO.title?.split('<em>')[0] || ''; | ||
| 30 | + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || ''; | ||
| 31 | + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || ''; | ||
| 32 | + } | ||
| 33 | + } | ||
| 14 | 34 | ||
| 15 | build() { | 35 | build() { |
| 16 | Column() { | 36 | Column() { |
| 17 | - Text(this.contentDTO.newsTitle) | ||
| 18 | - .fontSize($r("app.float.font_size_16")) | 37 | + Stack() { |
| 38 | + if (this.contentDTO.newTags) { | ||
| 39 | + Notes({ newTags: this.contentDTO.newTags }) | ||
| 40 | + } else if (this.contentDTO.objectType == '5') { | ||
| 41 | + Notes({ objectType: this.contentDTO.objectType }) | ||
| 42 | + } | ||
| 43 | + Text() { | ||
| 44 | + if (this.titleMarked) { | ||
| 45 | + Span(this.str01) | ||
| 46 | + Span(this.str02) | ||
| 47 | + .fontColor(0xED2800) | ||
| 48 | + Span(this.str03) | ||
| 49 | + } else { | ||
| 50 | + Span(this.contentDTO.newsTitle) | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + .lineHeight(27) | ||
| 54 | + .fontSize($r("app.float.font_size_18")) | ||
| 19 | .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) | 55 | .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) |
| 20 | .width(CommonConstants.FULL_WIDTH) | 56 | .width(CommonConstants.FULL_WIDTH) |
| 57 | + .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | ||
| 58 | + (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | ||
| 59 | + this.contentDTO.objectType == '5' ? 30 : 0) | ||
| 60 | + }.alignContent(Alignment.TopStart) | ||
| 61 | + | ||
| 21 | // 评论等信息 | 62 | // 评论等信息 |
| 22 | - CardSourceInfo({ contentDTO: this.contentDTO }) | 63 | + CardSourceInfo({compDTO:this.compDTO, contentDTO: this.contentDTO }) |
| 23 | } | 64 | } |
| 24 | .width(CommonConstants.FULL_WIDTH) | 65 | .width(CommonConstants.FULL_WIDTH) |
| 25 | .padding({ | 66 | .padding({ |
| 1 | -import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean'; | 1 | +import { CompDTO, ContentDTO, FullColumnImgUrlDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant/Index'; | 2 | import { CommonConstants } from 'wdConstant/Index'; |
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 6 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 6 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 7 | +import { Notes } from './notes'; | ||
| 7 | const TAG: string = 'Card4Component'; | 8 | const TAG: string = 'Card4Component'; |
| 8 | 9 | ||
| 9 | /** | 10 | /** |
| @@ -18,22 +19,54 @@ export struct Card4Component { | @@ -18,22 +19,54 @@ export struct Card4Component { | ||
| 18 | @State contentDTO: ContentDTO = new ContentDTO(); | 19 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 19 | @State loadImg: boolean = false; | 20 | @State loadImg: boolean = false; |
| 20 | @State clicked: boolean = false; | 21 | @State clicked: boolean = false; |
| 21 | - | 22 | + @State titleMarked: boolean = false; |
| 23 | + @State str01: string = ''; | ||
| 24 | + @State str02: string = ''; | ||
| 25 | + @State str03: string = ''; | ||
| 26 | + @ObjectLink compDTO: CompDTO | ||
| 22 | 27 | ||
| 23 | async aboutToAppear(): Promise<void> { | 28 | async aboutToAppear(): Promise<void> { |
| 29 | + this.titleInit(); | ||
| 24 | this.loadImg = await onlyWifiLoadImg(); | 30 | this.loadImg = await onlyWifiLoadImg(); |
| 25 | } | 31 | } |
| 26 | 32 | ||
| 33 | + titleInit() { | ||
| 34 | + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { | ||
| 35 | + this.titleMarked = true; | ||
| 36 | + this.str01 = this.contentDTO.title?.split('<em>')[0] || ''; | ||
| 37 | + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || ''; | ||
| 38 | + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || ''; | ||
| 39 | + } | ||
| 40 | + } | ||
| 41 | + | ||
| 27 | build() { | 42 | build() { |
| 28 | Column() { | 43 | Column() { |
| 29 | //body | 44 | //body |
| 30 | Column() { | 45 | Column() { |
| 31 | //新闻标题 | 46 | //新闻标题 |
| 32 | - Text(this.contentDTO.newsTitle) | ||
| 33 | - .fontSize($r('app.float.font_size_17')) | 47 | + if (this.contentDTO.newTags) { |
| 48 | + Notes({ newTags: this.contentDTO.newTags }) | ||
| 49 | + } else if (this.contentDTO.objectType == '5') { | ||
| 50 | + Notes({ objectType: this.contentDTO.objectType }) | ||
| 51 | + } | ||
| 52 | + Text() { | ||
| 53 | + if (this.titleMarked) { | ||
| 54 | + Span(this.str01) | ||
| 55 | + Span(this.str02) | ||
| 56 | + .fontColor(0xED2800) | ||
| 57 | + Span(this.str03) | ||
| 58 | + } else { | ||
| 59 | + Span(this.contentDTO.newsTitle) | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + .fontSize($r('app.float.font_size_18')) | ||
| 34 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 63 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 35 | .maxLines(3) | 64 | .maxLines(3) |
| 36 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | 65 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 66 | + .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | ||
| 67 | + (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | ||
| 68 | + this.contentDTO.objectType == '5' ? 30 : 0) | ||
| 69 | + .alignContent(Alignment.TopStart)// 超出的部分显示省略号。 | ||
| 37 | //三图 | 70 | //三图 |
| 38 | Stack(){ | 71 | Stack(){ |
| 39 | Row() { | 72 | Row() { |
| @@ -73,7 +106,7 @@ export struct Card4Component { | @@ -73,7 +106,7 @@ export struct Card4Component { | ||
| 73 | ProcessUtils.processPage(this.contentDTO) | 106 | ProcessUtils.processPage(this.contentDTO) |
| 74 | }) | 107 | }) |
| 75 | //bottom 评论等信息 | 108 | //bottom 评论等信息 |
| 76 | - CardSourceInfo({ contentDTO: this.contentDTO }) | 109 | + CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO }) |
| 77 | } | 110 | } |
| 78 | .width(CommonConstants.FULL_WIDTH) | 111 | .width(CommonConstants.FULL_WIDTH) |
| 79 | .padding({ | 112 | .padding({ |
| 1 | -import { ContentDTO } from 'wdBean'; | 1 | +import { ContentDTO, CompDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant'; | 2 | import { CommonConstants } from 'wdConstant'; |
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 4 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 5 | import { Notes } from './notes'; | 5 | import { Notes } from './notes'; |
| 6 | +import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare' | ||
| 7 | +import { common } from '@kit.AbilityKit'; | ||
| 6 | 8 | ||
| 7 | const TAG: string = 'Card5Component'; | 9 | const TAG: string = 'Card5Component'; |
| 8 | 10 | ||
| @@ -13,22 +15,37 @@ const TAG: string = 'Card5Component'; | @@ -13,22 +15,37 @@ const TAG: string = 'Card5Component'; | ||
| 13 | export struct Card5Component { | 15 | export struct Card5Component { |
| 14 | @State contentDTO: ContentDTO = new ContentDTO(); | 16 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 15 | @Prop titleShowPolicy: number | string | 17 | @Prop titleShowPolicy: number | string |
| 18 | + @Prop compDTO: CompDTO = {} as CompDTO | ||
| 16 | @State loadImg: boolean = false; | 19 | @State loadImg: boolean = false; |
| 17 | @State clicked: boolean = false; | 20 | @State clicked: boolean = false; |
| 21 | + @State titleMarked: boolean = false; | ||
| 22 | + @State str01: string = ''; | ||
| 23 | + @State str02: string = ''; | ||
| 24 | + @State str03: string = ''; | ||
| 18 | 25 | ||
| 19 | async aboutToAppear(): Promise<void> { | 26 | async aboutToAppear(): Promise<void> { |
| 20 | this.loadImg = await onlyWifiLoadImg(); | 27 | this.loadImg = await onlyWifiLoadImg(); |
| 28 | + | ||
| 29 | + this.titleInit(); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + titleInit() { | ||
| 33 | + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { | ||
| 34 | + this.titleMarked = true; | ||
| 35 | + this.str01 = this.contentDTO.title?.split('<em>')[0] || ''; | ||
| 36 | + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || ''; | ||
| 37 | + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || ''; | ||
| 38 | + } | ||
| 21 | } | 39 | } |
| 22 | 40 | ||
| 23 | build() { | 41 | build() { |
| 24 | Stack() { | 42 | Stack() { |
| 25 | - | ||
| 26 | Image(this.loadImg ? this.contentDTO.coverUrl : '') | 43 | Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 27 | .backgroundColor(0xf5f5f5) | 44 | .backgroundColor(0xf5f5f5) |
| 28 | .width(CommonConstants.FULL_WIDTH) | 45 | .width(CommonConstants.FULL_WIDTH) |
| 29 | .autoResize(true) | 46 | .autoResize(true) |
| 30 | .borderRadius($r('app.float.image_border_radius')) | 47 | .borderRadius($r('app.float.image_border_radius')) |
| 31 | - if (this.titleShowPolicy === 1) { | 48 | + if (this.titleShowPolicy === 1 || this.titleShowPolicy === null) { |
| 32 | Row() | 49 | Row() |
| 33 | .width(CommonConstants.FULL_WIDTH) | 50 | .width(CommonConstants.FULL_WIDTH) |
| 34 | .height(59) | 51 | .height(59) |
| @@ -39,18 +56,32 @@ export struct Card5Component { | @@ -39,18 +56,32 @@ export struct Card5Component { | ||
| 39 | }) | 56 | }) |
| 40 | Row() { | 57 | Row() { |
| 41 | Stack() { | 58 | Stack() { |
| 42 | - if (this.contentDTO.objectType == '5') { | 59 | + if (this.contentDTO.newTags) { |
| 60 | + Notes({ newTags: this.contentDTO.newTags }) | ||
| 61 | + } else if (this.contentDTO.objectType == '5') { | ||
| 43 | Notes({ objectType: this.contentDTO.objectType }) | 62 | Notes({ objectType: this.contentDTO.objectType }) |
| 44 | } | 63 | } |
| 45 | 64 | ||
| 46 | - Text(this.contentDTO.newsTitle) | ||
| 47 | - .width(CommonConstants.FULL_WIDTH) | ||
| 48 | - .fontColor(Color.White) | ||
| 49 | - .fontSize($r('app.float.normal_text_size')) | ||
| 50 | - .fontWeight(FontWeight.Bold) | ||
| 51 | - .maxLines(2) | ||
| 52 | - .align(Alignment.TopStart) | ||
| 53 | - .textIndent(this.contentDTO.objectType == '5' ? 35 : 0) | 65 | + Text() { |
| 66 | + if (this.titleMarked) { | ||
| 67 | + Span(this.str01) | ||
| 68 | + Span(this.str02) | ||
| 69 | + .fontColor(0xED2800) | ||
| 70 | + Span(this.str03) | ||
| 71 | + } else { | ||
| 72 | + Span(this.contentDTO.newsTitle) | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + .width(CommonConstants.FULL_WIDTH) | ||
| 76 | + .fontColor(Color.White) | ||
| 77 | + .fontSize($r('app.float.font_size_18')) | ||
| 78 | + .fontWeight(FontWeight.Bold) | ||
| 79 | + .maxLines(2) | ||
| 80 | + .align(Alignment.TopStart) | ||
| 81 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | ||
| 82 | + .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | ||
| 83 | + (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | ||
| 84 | + this.contentDTO.objectType == '5' ? 30 : 0) | ||
| 54 | }.alignContent(Alignment.TopStart) | 85 | }.alignContent(Alignment.TopStart) |
| 55 | } | 86 | } |
| 56 | .justifyContent(FlexAlign.Start) | 87 | .justifyContent(FlexAlign.Start) |
| @@ -69,6 +100,8 @@ export struct Card5Component { | @@ -69,6 +100,8 @@ export struct Card5Component { | ||
| 69 | .onClick((event: ClickEvent) => { | 100 | .onClick((event: ClickEvent) => { |
| 70 | this.clicked = true; | 101 | this.clicked = true; |
| 71 | ProcessUtils.processPage(this.contentDTO) | 102 | ProcessUtils.processPage(this.contentDTO) |
| 103 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 104 | + viewBlogInsightIntentShare(context, this.contentDTO?.channelId, [this.compDTO], ActionMode.EXECUTED) | ||
| 72 | }) | 105 | }) |
| 73 | 106 | ||
| 74 | } | 107 | } |
| 1 | -import { ContentDTO } from 'wdBean'; | 1 | +import { CompDTO, ContentDTO } from 'wdBean'; |
| 2 | import { CommonConstants, CompStyle } from 'wdConstant'; | 2 | import { CommonConstants, CompStyle } from 'wdConstant'; |
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; | 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; |
| 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; | 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; |
| 6 | import { Notes } from './notes'; | 6 | import { Notes } from './notes'; |
| 7 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 7 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 8 | +import { Logger } from 'wdKit/Index'; | ||
| 8 | 9 | ||
| 9 | const TAG: string = 'Card6Component-Card13Component'; | 10 | const TAG: string = 'Card6Component-Card13Component'; |
| 10 | 11 | ||
| @@ -13,12 +14,28 @@ const TAG: string = 'Card6Component-Card13Component'; | @@ -13,12 +14,28 @@ const TAG: string = 'Card6Component-Card13Component'; | ||
| 13 | */ | 14 | */ |
| 14 | @Component | 15 | @Component |
| 15 | export struct Card6Component { | 16 | export struct Card6Component { |
| 16 | - @State contentDTO: ContentDTO = new ContentDTO(); | ||
| 17 | @State loadImg: boolean = false; | 17 | @State loadImg: boolean = false; |
| 18 | @State clicked: boolean = false; | 18 | @State clicked: boolean = false; |
| 19 | + @State titleMarked: boolean = false; | ||
| 20 | + @State str01: string = ''; | ||
| 21 | + @State str02: string = ''; | ||
| 22 | + @State str03: string = ''; | ||
| 23 | + @ObjectLink compDTO: CompDTO | ||
| 24 | + @State contentDTO: ContentDTO = new ContentDTO(); | ||
| 19 | 25 | ||
| 20 | async aboutToAppear(): Promise<void> { | 26 | async aboutToAppear(): Promise<void> { |
| 27 | + this.titleInit(); | ||
| 21 | this.loadImg = await onlyWifiLoadImg(); | 28 | this.loadImg = await onlyWifiLoadImg(); |
| 29 | + // this.clicked = hasClicked(this.contentDTO.objectId) | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + titleInit() { | ||
| 33 | + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { | ||
| 34 | + this.titleMarked = true; | ||
| 35 | + this.str01 = this.contentDTO.title?.split('<em>')[0] || ''; | ||
| 36 | + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || ''; | ||
| 37 | + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || ''; | ||
| 38 | + } | ||
| 22 | } | 39 | } |
| 23 | 40 | ||
| 24 | build() { | 41 | build() { |
| @@ -42,9 +59,19 @@ export struct Card6Component { | @@ -42,9 +59,19 @@ export struct Card6Component { | ||
| 42 | Notes({ objectType: this.contentDTO.objectType }) | 59 | Notes({ objectType: this.contentDTO.objectType }) |
| 43 | } | 60 | } |
| 44 | 61 | ||
| 45 | - Text(`${this.contentDTO.newsTitle}`) | 62 | + Text() { |
| 63 | + if (this.titleMarked) { | ||
| 64 | + Span(this.str01) | ||
| 65 | + Span(this.str02) | ||
| 66 | + .fontColor(0xED2800) | ||
| 67 | + Span(this.str03) | ||
| 68 | + } else { | ||
| 69 | + Span(this.contentDTO.newsTitle) | ||
| 70 | + } | ||
| 71 | + } | ||
| 46 | .fontColor(this.clicked ? 0x848484 : 0x222222) | 72 | .fontColor(this.clicked ? 0x848484 : 0x222222) |
| 47 | - .fontSize(16) | 73 | + .fontSize(18) |
| 74 | + .lineHeight(27) | ||
| 48 | .fontWeight(FontWeight.Normal) | 75 | .fontWeight(FontWeight.Normal) |
| 49 | .maxLines(3) | 76 | .maxLines(3) |
| 50 | .alignSelf(ItemAlign.Start) | 77 | .alignSelf(ItemAlign.Start) |
| @@ -54,29 +81,30 @@ export struct Card6Component { | @@ -54,29 +81,30 @@ export struct Card6Component { | ||
| 54 | this.contentDTO.objectType == '5' ? 30 : 0) | 81 | this.contentDTO.objectType == '5' ? 30 : 0) |
| 55 | }.alignContent(Alignment.TopStart) | 82 | }.alignContent(Alignment.TopStart) |
| 56 | 83 | ||
| 57 | - }.height("80%") | 84 | + } |
| 58 | .justifyContent(FlexAlign.Start) | 85 | .justifyContent(FlexAlign.Start) |
| 59 | 86 | ||
| 60 | 87 | ||
| 61 | //bottom 评论等信息 | 88 | //bottom 评论等信息 |
| 62 | - CardSourceInfo({ contentDTO: this.contentDTO }) | 89 | + CardSourceInfo({ compDTO: this.compDTO,contentDTO:this.contentDTO }) |
| 63 | } | 90 | } |
| 64 | .alignItems(HorizontalAlign.Start) | 91 | .alignItems(HorizontalAlign.Start) |
| 65 | .justifyContent(FlexAlign.Start) | 92 | .justifyContent(FlexAlign.Start) |
| 66 | - .width('58%') | 93 | + .width('64%') |
| 67 | 94 | ||
| 68 | Stack() { | 95 | Stack() { |
| 69 | Image(this.loadImg ? this.contentDTO.coverUrl : '') | 96 | Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 70 | .backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5) | 97 | .backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5) |
| 71 | .borderRadius(5) | 98 | .borderRadius(5) |
| 72 | .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) | 99 | .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) |
| 73 | - .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 90 : 180) | 100 | + .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78 : 156) |
| 74 | CardMediaInfo({ contentDTO: this.contentDTO }) | 101 | CardMediaInfo({ contentDTO: this.contentDTO }) |
| 75 | } | 102 | } |
| 76 | .alignContent(Alignment.BottomEnd) | 103 | .alignContent(Alignment.BottomEnd) |
| 77 | } | 104 | } |
| 78 | .onClick((event: ClickEvent) => { | 105 | .onClick((event: ClickEvent) => { |
| 79 | this.clicked = true; | 106 | this.clicked = true; |
| 107 | + // persistentStorage(this.contentDTO.objectId); | ||
| 80 | ProcessUtils.processPage(this.contentDTO) | 108 | ProcessUtils.processPage(this.contentDTO) |
| 81 | }) | 109 | }) |
| 82 | .padding({ | 110 | .padding({ |
| @@ -86,7 +114,7 @@ export struct Card6Component { | @@ -86,7 +114,7 @@ export struct Card6Component { | ||
| 86 | bottom: $r('app.float.card_comp_pagePadding_tb') | 114 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 87 | }) | 115 | }) |
| 88 | .width(CommonConstants.FULL_WIDTH) | 116 | .width(CommonConstants.FULL_WIDTH) |
| 89 | - .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 127 : 217) | 117 | + .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 107 : 217) |
| 90 | .justifyContent(FlexAlign.SpaceBetween) | 118 | .justifyContent(FlexAlign.SpaceBetween) |
| 91 | } | 119 | } |
| 92 | } | 120 | } |
| @@ -15,29 +15,63 @@ export struct Card9Component { | @@ -15,29 +15,63 @@ export struct Card9Component { | ||
| 15 | @State contentDTO: ContentDTO = new ContentDTO(); | 15 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 16 | @State loadImg: boolean = false; | 16 | @State loadImg: boolean = false; |
| 17 | @State clicked: boolean = false; | 17 | @State clicked: boolean = false; |
| 18 | + @State titleMarked: boolean = false; | ||
| 19 | + @State str01: string = ''; | ||
| 20 | + @State str02: string = ''; | ||
| 21 | + @State str03: string = ''; | ||
| 18 | 22 | ||
| 19 | async aboutToAppear(): Promise<void> { | 23 | async aboutToAppear(): Promise<void> { |
| 24 | + this.titleInit(); | ||
| 20 | this.loadImg = await onlyWifiLoadImg(); | 25 | this.loadImg = await onlyWifiLoadImg(); |
| 21 | } | 26 | } |
| 22 | 27 | ||
| 28 | + titleInit() { | ||
| 29 | + if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { | ||
| 30 | + this.titleMarked = true; | ||
| 31 | + this.str01 = this.contentDTO.title?.split('<em>')[0] || ''; | ||
| 32 | + this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || ''; | ||
| 33 | + this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || ''; | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | + | ||
| 23 | build() { | 37 | build() { |
| 24 | Column() { | 38 | Column() { |
| 25 | // 顶部标题,最多两行 | 39 | // 顶部标题,最多两行 |
| 26 | if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { | 40 | if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { |
| 27 | - Text(this.contentDTO.newsTitle) | ||
| 28 | - .fontColor(this.clicked ? 0x848484 : 0x222222) | ||
| 29 | - .width(CommonConstants.FULL_WIDTH) | ||
| 30 | - .fontSize($r('app.float.font_size_17')) | ||
| 31 | - .fontWeight(600) | ||
| 32 | - .maxLines(2) | ||
| 33 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 34 | - .margin({ bottom: 19 }) | 41 | + if (this.contentDTO.newTags) { |
| 42 | + Notes({ newTags: this.contentDTO.newTags }) | ||
| 43 | + } else if (this.contentDTO.objectType == '5') { | ||
| 44 | + Notes({ objectType: this.contentDTO.objectType }) | ||
| 45 | + } | ||
| 46 | + Text() { | ||
| 47 | + if (this.titleMarked) { | ||
| 48 | + Span(this.str01) | ||
| 49 | + Span(this.str02) | ||
| 50 | + .fontColor(0xED2800) | ||
| 51 | + Span(this.str03) | ||
| 52 | + } else { | ||
| 53 | + Span(this.contentDTO.newsTitle) | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + .fontColor(this.clicked ? 0x848484 : 0x222222) | ||
| 57 | + .width(CommonConstants.FULL_WIDTH) | ||
| 58 | + .fontSize($r('app.float.font_size_18')) | ||
| 59 | + .fontWeight(600) | ||
| 60 | + .maxLines(2) | ||
| 61 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 62 | + .margin({ bottom: 19 }) | ||
| 63 | + .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | ||
| 64 | + (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | ||
| 65 | + this.contentDTO.objectType == '5' ? 30 : 0) | ||
| 66 | + .alignContent(Alignment.TopStart) | ||
| 67 | + | ||
| 35 | } | 68 | } |
| 36 | // 大图 | 69 | // 大图 |
| 37 | Stack() { | 70 | Stack() { |
| 38 | Image(this.loadImg ? this.contentDTO.coverUrl : '') | 71 | Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 39 | .backgroundColor(0xf5f5f5) | 72 | .backgroundColor(0xf5f5f5) |
| 40 | .width('100%') | 73 | .width('100%') |
| 74 | + .height(133) | ||
| 41 | .borderRadius({ | 75 | .borderRadius({ |
| 42 | topLeft: $r('app.float.image_border_radius'), | 76 | topLeft: $r('app.float.image_border_radius'), |
| 43 | topRight: $r('app.float.image_border_radius') | 77 | topRight: $r('app.float.image_border_radius') |
| @@ -78,7 +112,7 @@ export struct Card9Component { | @@ -78,7 +112,7 @@ export struct Card9Component { | ||
| 78 | } | 112 | } |
| 79 | .width(CommonConstants.FULL_WIDTH) | 113 | .width(CommonConstants.FULL_WIDTH) |
| 80 | .padding({ | 114 | .padding({ |
| 81 | - top: 14, | 115 | + top: 5, |
| 82 | left: 16, | 116 | left: 16, |
| 83 | right: 16, | 117 | right: 16, |
| 84 | bottom: 14 | 118 | bottom: 14 |
sight_harmony/features/wdComponent/src/main/ets/components/cardview/SearchContentComponent.ets
0 → 100644
| 1 | +import { CompDTO, ContentDTO, FullColumnImgUrlDTO } from 'wdBean'; | ||
| 2 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 3 | +import { ProcessUtils } from 'wdRouter'; | ||
| 4 | +import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | ||
| 5 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 6 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 7 | +const TAG: string = 'Card4Component'; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 上图下文,用于搜索页命中搜索内容展示 | ||
| 11 | + */ | ||
| 12 | +@Component | ||
| 13 | +export struct SearchContentComponent { | ||
| 14 | + @State contentDTO: ContentDTO = new ContentDTO(); | ||
| 15 | + @State loadImg: boolean = false; | ||
| 16 | + @State clicked: boolean = false; | ||
| 17 | + @State str01: string = ''; | ||
| 18 | + @State str02: string = ''; | ||
| 19 | + @State str03: string = ''; | ||
| 20 | + | ||
| 21 | + | ||
| 22 | + async aboutToAppear(): Promise<void> { | ||
| 23 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 24 | + this.titleInit(); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + titleInit() { | ||
| 28 | + this.str01 = this.contentDTO.contentText?.split('<em>')[0] || ''; | ||
| 29 | + this.str02 = this.contentDTO.contentText?.split('<em>')[1].split('</em>')[0] || ''; | ||
| 30 | + this.str03 = this.contentDTO.contentText?.split('<em>')[1].split('</em>')[1] || ''; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + build() { | ||
| 34 | + Column() { | ||
| 35 | + //body | ||
| 36 | + Column() { | ||
| 37 | + //新闻标题 | ||
| 38 | + Text(this.contentDTO.newsTitle) | ||
| 39 | + .fontSize($r('app.float.font_size_18')) | ||
| 40 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | ||
| 41 | + .maxLines(3) | ||
| 42 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | ||
| 43 | + | ||
| 44 | + // 命中内容 | ||
| 45 | + Text(this.contentDTO.contentText) { | ||
| 46 | + Span(this.str01) | ||
| 47 | + Span(this.str02) | ||
| 48 | + .fontColor(0xED2800) | ||
| 49 | + Span(this.str03) | ||
| 50 | + } | ||
| 51 | + .fontSize(13) | ||
| 52 | + .width(CommonConstants.FULL_PARENT) | ||
| 53 | + .margin({ top: 8 }) | ||
| 54 | + .fontColor(0x222222) | ||
| 55 | + } | ||
| 56 | + .width('100%') | ||
| 57 | + .justifyContent(FlexAlign.Start) | ||
| 58 | + .alignItems(HorizontalAlign.Start) | ||
| 59 | + .onClick((event: ClickEvent) => { | ||
| 60 | + this.clicked = true; | ||
| 61 | + ProcessUtils.processPage(this.contentDTO) | ||
| 62 | + }) | ||
| 63 | + //bottom 评论等信息 | ||
| 64 | + CardSourceInfo({compDTO:new CompDTO, contentDTO: this.contentDTO }) | ||
| 65 | + } | ||
| 66 | + .width(CommonConstants.FULL_WIDTH) | ||
| 67 | + .padding({ | ||
| 68 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 69 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 70 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 71 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 72 | + }) | ||
| 73 | + } | ||
| 74 | +} | ||
| 75 | + | ||
| 76 | + | ||
| 77 | +@Extend(Text) | ||
| 78 | +function bottomTextStyle() { | ||
| 79 | + .fontSize(12) | ||
| 80 | + .fontColor('#B0B0B0') | ||
| 81 | +} |
| @@ -68,7 +68,7 @@ export class commentItemModel { | @@ -68,7 +68,7 @@ export class commentItemModel { | ||
| 68 | fromUserHeader: string = '' | 68 | fromUserHeader: string = '' |
| 69 | fromUserId: string = '' | 69 | fromUserId: string = '' |
| 70 | fromUserName: string = '' | 70 | fromUserName: string = '' |
| 71 | - fromUserType: WDPublicUserType = 0 | 71 | + fromUserType: WDPublicUserType = 1 |
| 72 | id: string = '' | 72 | id: string = '' |
| 73 | likeNum: string = '0' | 73 | likeNum: string = '0' |
| 74 | mySelf: string = '' | 74 | mySelf: string = '' |
| @@ -11,7 +11,7 @@ export struct CommentTabComponent { | @@ -11,7 +11,7 @@ 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 | + @Prop pageComponentType: number = -1 //1:视频详情页 2:竖屏直播页 |
| 15 | /*展示类型*/ | 15 | /*展示类型*/ |
| 16 | @State type: number = 1 | 16 | @State type: number = 1 |
| 17 | @State placeHolder: string = '说两句...' | 17 | @State placeHolder: string = '说两句...' |
| @@ -43,6 +43,17 @@ export struct CommentTabComponent { | @@ -43,6 +43,17 @@ export struct CommentTabComponent { | ||
| 43 | 43 | ||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | + getCommentInputBackImg() { | ||
| 47 | + if (this.pageComponentType === 2) { | ||
| 48 | + return $r('app.media.comment_img_input_black') | ||
| 49 | + } else if (this.pageComponentType === 3) { | ||
| 50 | + return $r('app.media.comment_img_input_hui1') | ||
| 51 | + } else { | ||
| 52 | + return $r('app.media.comment_img_input_hui') | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + } | ||
| 56 | + | ||
| 46 | build() { | 57 | build() { |
| 47 | Row() { | 58 | Row() { |
| 48 | Stack({ alignContent: Alignment.Start }) { | 59 | Stack({ alignContent: Alignment.Start }) { |
| @@ -67,7 +78,7 @@ export struct CommentTabComponent { | @@ -67,7 +78,7 @@ export struct CommentTabComponent { | ||
| 67 | }) | 78 | }) |
| 68 | .id("RowBg") | 79 | .id("RowBg") |
| 69 | } else { | 80 | } else { |
| 70 | - Image($r('app.media.comment_img_input_hui')) | 81 | + Image(this.getCommentInputBackImg()) |
| 71 | .objectFit(ImageFit.Fill) | 82 | .objectFit(ImageFit.Fill) |
| 72 | .resizable({ | 83 | .resizable({ |
| 73 | slice: { | 84 | slice: { |
| @@ -145,7 +156,7 @@ export struct CommentIconComponent { | @@ -145,7 +156,7 @@ export struct CommentIconComponent { | ||
| 145 | // Stack({alignContent:Alignment.Start}) { | 156 | // Stack({alignContent:Alignment.Start}) { |
| 146 | if (Number.parseInt(this.publishCommentModel.totalCommentNumer) != 0) { | 157 | if (Number.parseInt(this.publishCommentModel.totalCommentNumer) != 0) { |
| 147 | RelativeContainer() { | 158 | RelativeContainer() { |
| 148 | - Image($r('app.media.comment_icon_number_bg')) | 159 | + Image(this.styleType == 1 ? $r('app.media.comment_icon_number_bg'):$r('app.media.ic_like_back_Select')) |
| 149 | .objectFit(ImageFit.Fill) | 160 | .objectFit(ImageFit.Fill) |
| 150 | .resizable({ | 161 | .resizable({ |
| 151 | slice: { | 162 | slice: { |
| @@ -179,6 +190,7 @@ export struct CommentIconComponent { | @@ -179,6 +190,7 @@ export struct CommentIconComponent { | ||
| 179 | .width(this.getMeasureText(this.publishCommentModel.totalCommentNumer) + | 190 | .width(this.getMeasureText(this.publishCommentModel.totalCommentNumer) + |
| 180 | 12)// .backgroundColor(Color.Green) | 191 | 12)// .backgroundColor(Color.Green) |
| 181 | .id("Text") | 192 | .id("Text") |
| 193 | + .visibility(this.publishCommentModel.totalCommentNumer ? Visibility.Visible : Visibility.Hidden) | ||
| 182 | // .offset({ | 194 | // .offset({ |
| 183 | // x: 3 | 195 | // x: 3 |
| 184 | // }) | 196 | // }) |
| @@ -3,8 +3,8 @@ import curves from '@ohos.curves'; | @@ -3,8 +3,8 @@ import curves from '@ohos.curves'; | ||
| 3 | import { BusinessError } from '@ohos.base'; | 3 | import { BusinessError } from '@ohos.base'; |
| 4 | import display from '@ohos.display'; | 4 | import display from '@ohos.display'; |
| 5 | 5 | ||
| 6 | -const collapseString = '...展开全文' | ||
| 7 | -const uncollapseString = '...收起' | 6 | +const collapseString = '...展开' |
| 7 | +const uncollapseString = ' 收起' | ||
| 8 | 8 | ||
| 9 | const TestLongText = "超过三行超\n过三行超过\n三行超超过三行\n超过三行超过三行超过三\n行超过" | 9 | const TestLongText = "超过三行超\n过三行超过\n三行超超过三行\n超过三行超过三行超过三\n行超过" |
| 10 | 10 | ||
| @@ -129,7 +129,9 @@ export struct CommentText { | @@ -129,7 +129,9 @@ export struct CommentText { | ||
| 129 | // Stack({ alignContent: Alignment.BottomEnd }) { | 129 | // Stack({ alignContent: Alignment.BottomEnd }) { |
| 130 | Text(this.longMessage) { | 130 | Text(this.longMessage) { |
| 131 | Span(this.expandedStates ? this.longMessage : this.maxLineMesssage) | 131 | Span(this.expandedStates ? this.longMessage : this.maxLineMesssage) |
| 132 | - Span(this.collapseText).onClick(() => { | 132 | + Span(this.collapseText) |
| 133 | + .fontColor("#999999") | ||
| 134 | + .onClick(() => { | ||
| 133 | if (this.collapseText == collapseString) { | 135 | if (this.collapseText == collapseString) { |
| 134 | this.collapseText = uncollapseString; | 136 | this.collapseText = uncollapseString; |
| 135 | this.expandedStates = true; | 137 | this.expandedStates = true; |
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/QualityCommentsComponent.ets
| @@ -26,7 +26,7 @@ export struct QualityCommentsComponent { | @@ -26,7 +26,7 @@ export struct QualityCommentsComponent { | ||
| 26 | private scroller: Scroller = new Scroller(); | 26 | private scroller: Scroller = new Scroller(); |
| 27 | @State tileOpacity: number = 0; | 27 | @State tileOpacity: number = 0; |
| 28 | firstPositionY: number = 0; | 28 | firstPositionY: number = 0; |
| 29 | - bottomSafeHeight: string = AppStorage.get<number>('bottomSafeHeight') + 'px'; | 29 | + bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0; |
| 30 | topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; | 30 | topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; |
| 31 | lastWindowColor: string = '#ffffff' | 31 | lastWindowColor: string = '#ffffff' |
| 32 | currentWindowColor: string = '#FF4202' | 32 | currentWindowColor: string = '#FF4202' |
| @@ -38,20 +38,19 @@ export struct QualityCommentsComponent { | @@ -38,20 +38,19 @@ export struct QualityCommentsComponent { | ||
| 38 | 38 | ||
| 39 | 39 | ||
| 40 | aboutToDisappear(): void { | 40 | aboutToDisappear(): void { |
| 41 | - | ||
| 42 | - const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage | ||
| 43 | - const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口 | ||
| 44 | - windowClass.setWindowBackgroundColor(this.lastWindowColor) | ||
| 45 | - windowClass.setWindowLayoutFullScreen(false) | ||
| 46 | // windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' }) | 41 | // windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' }) |
| 47 | - | ||
| 48 | this.dialogController = null // 将dialogController置空 | 42 | this.dialogController = null // 将dialogController置空 |
| 43 | + } | ||
| 49 | 44 | ||
| 45 | + onPageShow(): void { | ||
| 46 | + WindowModel.shared.setWindowLayoutFullScreen(true) | ||
| 50 | } | 47 | } |
| 51 | 48 | ||
| 52 | - aboutToAppear(): void { | 49 | + onPageHide(): void { |
| 50 | + WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 51 | + } | ||
| 53 | 52 | ||
| 54 | - this.fullScreen(); | 53 | + aboutToAppear(): void { |
| 55 | this.getData(); | 54 | this.getData(); |
| 56 | this.showAlert() | 55 | this.showAlert() |
| 57 | } | 56 | } |
| @@ -100,13 +99,6 @@ export struct QualityCommentsComponent { | @@ -100,13 +99,6 @@ export struct QualityCommentsComponent { | ||
| 100 | }) | 99 | }) |
| 101 | } | 100 | } |
| 102 | 101 | ||
| 103 | - fullScreen() { | ||
| 104 | - const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage | ||
| 105 | - const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口 | ||
| 106 | - windowClass.setWindowLayoutFullScreen(true) | ||
| 107 | - | ||
| 108 | - } | ||
| 109 | - | ||
| 110 | @Builder | 102 | @Builder |
| 111 | titleHeader() { | 103 | titleHeader() { |
| 112 | Row() { | 104 | Row() { |
| @@ -247,9 +239,9 @@ export struct QualityCommentsComponent { | @@ -247,9 +239,9 @@ export struct QualityCommentsComponent { | ||
| 247 | ListItem() { | 239 | ListItem() { |
| 248 | if (this.hasMore === false) NoMoreLayout() | 240 | if (this.hasMore === false) NoMoreLayout() |
| 249 | } | 241 | } |
| 250 | - ListItem() { | ||
| 251 | - | ||
| 252 | - }.height(this.bottomSafeHeight) | 242 | + // ListItem() { |
| 243 | + // | ||
| 244 | + // }.height(`${this.bottomSafeHeight}` + 'px') | ||
| 253 | }.onReachEnd(()=>{ | 245 | }.onReachEnd(()=>{ |
| 254 | this.currentPage++ | 246 | this.currentPage++ |
| 255 | this.getData() | 247 | this.getData() |
| @@ -257,8 +249,7 @@ export struct QualityCommentsComponent { | @@ -257,8 +249,7 @@ export struct QualityCommentsComponent { | ||
| 257 | .margin({ top: 196 }) | 249 | .margin({ top: 196 }) |
| 258 | .height("100%") | 250 | .height("100%") |
| 259 | .width("100%") | 251 | .width("100%") |
| 260 | - // .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果 | ||
| 261 | - .edgeEffect(EdgeEffect.Spring) | 252 | + .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果 |
| 262 | .nestedScroll({ | 253 | .nestedScroll({ |
| 263 | scrollForward: NestedScrollMode.PARENT_FIRST, | 254 | scrollForward: NestedScrollMode.PARENT_FIRST, |
| 264 | scrollBackward: NestedScrollMode.SELF_FIRST | 255 | scrollBackward: NestedScrollMode.SELF_FIRST |
| @@ -352,7 +343,7 @@ struct QualityCommentItem { | @@ -352,7 +343,7 @@ struct QualityCommentItem { | ||
| 352 | Row() { | 343 | Row() { |
| 353 | Row() { | 344 | Row() { |
| 354 | Image($r('app.media.comment_img_link')).width(16).height(16) | 345 | Image($r('app.media.comment_img_link')).width(16).height(16) |
| 355 | - Text(this.item.shareInfo.shareTitle) | 346 | + Text(this.item.targetTitle) |
| 356 | .fontSize(14) | 347 | .fontSize(14) |
| 357 | .fontColor('#666666') | 348 | .fontColor('#666666') |
| 358 | .margin({ left: 6, right: 12 }) | 349 | .margin({ left: 6, right: 12 }) |
| @@ -164,7 +164,7 @@ class CommentViewModel { | @@ -164,7 +164,7 @@ class CommentViewModel { | ||
| 164 | publishComment(model: publishCommentModel) { | 164 | publishComment(model: publishCommentModel) { |
| 165 | 165 | ||
| 166 | return new Promise<commentItemModel>((success, fail) => { | 166 | return new Promise<commentItemModel>((success, fail) => { |
| 167 | - const visitorMode = model.visitorComment == "1" && AccountManagerUtils.isLoginSync() == false | 167 | + const visitorMode = model.visitorComment == "1" && HttpUtils.isLogin() == false |
| 168 | let url = visitorMode ? HttpUrlUtils.getNoUserPublishCommentUrl() : HttpUrlUtils.getPublishCommentUrl() | 168 | let url = visitorMode ? HttpUrlUtils.getNoUserPublishCommentUrl() : HttpUrlUtils.getPublishCommentUrl() |
| 169 | 169 | ||
| 170 | let bean: Record<string, string> = {}; | 170 | let bean: Record<string, string> = {}; |
| @@ -485,10 +485,13 @@ class CommentViewModel { | @@ -485,10 +485,13 @@ class CommentViewModel { | ||
| 485 | 485 | ||
| 486 | jumpToAccountPage(commentItem: commentItemModel) { | 486 | jumpToAccountPage(commentItem: commentItemModel) { |
| 487 | let url = HttpUrlUtils.getOtherUserDetailDataUrl() | 487 | let url = HttpUrlUtils.getOtherUserDetailDataUrl() |
| 488 | - let item : Record<string, string >= { | ||
| 489 | - "creatorId": commentItem.fromCreatorId || "", | ||
| 490 | - "userType": `${commentItem.fromUserType}`, | ||
| 491 | - "userId": commentItem.fromUserId || "-1", | 488 | + let item : Record<string, string >= {} |
| 489 | + | ||
| 490 | + if (commentItem.fromCreatorId) { | ||
| 491 | + item["creatorId"] = commentItem.fromCreatorId | ||
| 492 | + } else { | ||
| 493 | + item["userType"] = `${commentItem.fromUserType}` | ||
| 494 | + item["userId"] = commentItem.fromUserId | ||
| 492 | } | 495 | } |
| 493 | HttpBizUtil.post<ResponseDTO<MasterDetailRes>>(url, item).then((result) => { | 496 | HttpBizUtil.post<ResponseDTO<MasterDetailRes>>(url, item).then((result) => { |
| 494 | if (!result.data || result.data.mainControl != 1) { | 497 | if (!result.data || result.data.mainControl != 1) { |
| @@ -208,7 +208,7 @@ struct CarouselLayout01CardView { | @@ -208,7 +208,7 @@ struct CarouselLayout01CardView { | ||
| 208 | Text(`${this.item.corner}${this.item.newsTitle}`) | 208 | Text(`${this.item.corner}${this.item.newsTitle}`) |
| 209 | .width(CommonConstants.FULL_PARENT) | 209 | .width(CommonConstants.FULL_PARENT) |
| 210 | .fontColor(Color.White) | 210 | .fontColor(Color.White) |
| 211 | - .fontSize($r('app.float.font_size_16')) | 211 | + .fontSize($r('app.float.font_size_18')) |
| 212 | .fontWeight(FontWeight.Medium) | 212 | .fontWeight(FontWeight.Medium) |
| 213 | .textAlign(TextAlign.Start) | 213 | .textAlign(TextAlign.Start) |
| 214 | .align(Alignment.Bottom) | 214 | .align(Alignment.Bottom) |
| @@ -231,7 +231,7 @@ struct CarouselLayout01CardView { | @@ -231,7 +231,7 @@ struct CarouselLayout01CardView { | ||
| 231 | .height(CommonConstants.FULL_PARENT) | 231 | .height(CommonConstants.FULL_PARENT) |
| 232 | } | 232 | } |
| 233 | .width(CommonConstants.FULL_WIDTH) | 233 | .width(CommonConstants.FULL_WIDTH) |
| 234 | - .aspectRatio(CompUtils.ASPECT_RATIO_2_1) | 234 | + .aspectRatio(CompUtils.ASPECT_RATIO_16_9) |
| 235 | .alignContent(Alignment.BottomStart) | 235 | .alignContent(Alignment.BottomStart) |
| 236 | .hoverEffect(HoverEffect.Scale) | 236 | .hoverEffect(HoverEffect.Scale) |
| 237 | } | 237 | } |
| 1 | -import { CompDTO, ContentDTO } from 'wdBean'; | 1 | +import { CompDTO, ContentDTO, LiveRoomDataBean } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant/Index'; | 2 | import { CommonConstants } from 'wdConstant/Index'; |
| 3 | import { Logger } from 'wdKit/Index'; | 3 | import { Logger } from 'wdKit/Index'; |
| 4 | import { ProcessUtils } from 'wdRouter'; | 4 | import { ProcessUtils } from 'wdRouter'; |
| @@ -20,6 +20,9 @@ export struct ZhGridLayout02 { | @@ -20,6 +20,9 @@ export struct ZhGridLayout02 { | ||
| 20 | @State compDTO: CompDTO = {} as CompDTO | 20 | @State compDTO: CompDTO = {} as CompDTO |
| 21 | @State operDataList: ContentDTO[] = [] | 21 | @State operDataList: ContentDTO[] = [] |
| 22 | @State loadImg: boolean = false; | 22 | @State loadImg: boolean = false; |
| 23 | + @State liveRoomList: LiveRoomDataBean[] = [] | ||
| 24 | + currentPage = 1 | ||
| 25 | + pageSize = 12 | ||
| 23 | 26 | ||
| 24 | async aboutToAppear(): Promise<void> { | 27 | async aboutToAppear(): Promise<void> { |
| 25 | Logger.debug(TAG, 'aboutToAppear ' + this.compDTO.objectTitle) | 28 | Logger.debug(TAG, 'aboutToAppear ' + this.compDTO.objectTitle) |
| @@ -27,14 +30,12 @@ export struct ZhGridLayout02 { | @@ -27,14 +30,12 @@ export struct ZhGridLayout02 { | ||
| 27 | PageViewModel.getLiveReviewUrl(this.currentPage, this.pageSize).then((liveReviewDTO) => { | 30 | PageViewModel.getLiveReviewUrl(this.currentPage, this.pageSize).then((liveReviewDTO) => { |
| 28 | this.operDataList = [] | 31 | this.operDataList = [] |
| 29 | this.operDataList.push(...liveReviewDTO.list) | 32 | this.operDataList.push(...liveReviewDTO.list) |
| 33 | + this.getLiveRoomDataInfo(this.operDataList) | ||
| 30 | }) | 34 | }) |
| 31 | 35 | ||
| 32 | this.loadImg = await onlyWifiLoadImg(); | 36 | this.loadImg = await onlyWifiLoadImg(); |
| 33 | } | 37 | } |
| 34 | 38 | ||
| 35 | - currentPage = 1 | ||
| 36 | - pageSize = 12 | ||
| 37 | - | ||
| 38 | build() { | 39 | build() { |
| 39 | Column() { | 40 | Column() { |
| 40 | Scroll() { | 41 | Scroll() { |
| @@ -50,12 +51,11 @@ export struct ZhGridLayout02 { | @@ -50,12 +51,11 @@ export struct ZhGridLayout02 { | ||
| 50 | .fontWeight(600) | 51 | .fontWeight(600) |
| 51 | } | 52 | } |
| 52 | .justifyContent(FlexAlign.Start) | 53 | .justifyContent(FlexAlign.Start) |
| 53 | - | ||
| 54 | - .margin({ top: 8, bottom: 8 }) | 54 | + .margin({ top: 16, bottom: 8 }) |
| 55 | .width(CommonConstants.FULL_WIDTH) | 55 | .width(CommonConstants.FULL_WIDTH) |
| 56 | 56 | ||
| 57 | GridRow({ | 57 | GridRow({ |
| 58 | - gutter: { x: 12, y: 22 }, | 58 | + gutter: { x: 12, y: 13 }, |
| 59 | columns: { sm: listSize, md: 2 }, | 59 | columns: { sm: listSize, md: 2 }, |
| 60 | breakpoints: { value: ['320vp', '520vp', '840vp'] } | 60 | breakpoints: { value: ['320vp', '520vp', '840vp'] } |
| 61 | }) { | 61 | }) { |
| @@ -101,12 +101,26 @@ export struct ZhGridLayout02 { | @@ -101,12 +101,26 @@ export struct ZhGridLayout02 { | ||
| 101 | @Builder | 101 | @Builder |
| 102 | buildItemCard(item: ContentDTO) { | 102 | buildItemCard(item: ContentDTO) { |
| 103 | Column() { | 103 | Column() { |
| 104 | - Image(this.loadImg ? item.fullColumnImgUrls[0].url : '') | ||
| 105 | - .backgroundColor(0xf5f5f5) | ||
| 106 | - .width('100%') | ||
| 107 | - .height(95) | ||
| 108 | - .borderRadius(4) | 104 | + Stack({ alignContent: Alignment.BottomEnd }) { |
| 105 | + Image(this.loadImg ? item.fullColumnImgUrls[0].url : '') | ||
| 106 | + .backgroundColor(0xf5f5f5) | ||
| 107 | + .width('100%') | ||
| 108 | + .height(95) | ||
| 109 | + .borderRadius(4) | ||
| 110 | + if (this.getLiveRoomNumber(item).length > 0) { | ||
| 111 | + Text(this.getLiveRoomNumber(item)) | ||
| 112 | + .fontSize('11vp') | ||
| 113 | + .fontWeight(400) | ||
| 114 | + .fontColor(Color.White) | ||
| 115 | + .margin({ | ||
| 116 | + right: '5vp', | ||
| 117 | + bottom: '5vp' | ||
| 118 | + }) | ||
| 119 | + } | ||
| 120 | + } | ||
| 121 | + | ||
| 109 | Text(item.newsTitle) | 122 | Text(item.newsTitle) |
| 123 | + .margin({top:'6'}) | ||
| 110 | .fontSize(13) | 124 | .fontSize(13) |
| 111 | .maxLines(2) | 125 | .maxLines(2) |
| 112 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 126 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| @@ -117,14 +131,56 @@ export struct ZhGridLayout02 { | @@ -117,14 +131,56 @@ export struct ZhGridLayout02 { | ||
| 117 | }) | 131 | }) |
| 118 | } | 132 | } |
| 119 | 133 | ||
| 134 | + // 获取评论数 | ||
| 135 | + async getLiveRoomDataInfo(list: ContentDTO[]) { | ||
| 136 | + const reserveIds = this.getLiveDetailIds(list) | ||
| 137 | + PageViewModel.getLiveRoomBatchInfo(reserveIds).then((result) => { | ||
| 138 | + if (result && result.length > 0) { | ||
| 139 | + this.liveRoomList.push(...result) | ||
| 140 | + } | ||
| 141 | + }).catch(() => { | ||
| 142 | + }) | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + // 判断是否预约 | ||
| 146 | + getLiveRoomNumber(item: ContentDTO): string { | ||
| 147 | + const objc = this.liveRoomList.find((element: LiveRoomDataBean) => { | ||
| 148 | + return element.liveId.toString() == item.objectId | ||
| 149 | + }) | ||
| 150 | + if (objc && objc.pv && objc.pv > 0) { | ||
| 151 | + return this.computeShowNum(objc.pv) | ||
| 152 | + } | ||
| 153 | + return '' | ||
| 154 | + } | ||
| 155 | + | ||
| 120 | addItems() { | 156 | addItems() { |
| 121 | Logger.debug(TAG, 'addItems') | 157 | Logger.debug(TAG, 'addItems') |
| 122 | this.currentPage++ | 158 | this.currentPage++ |
| 123 | PageViewModel.getLiveReviewUrl(this.currentPage, this.pageSize).then((liveReviewDTO) => { | 159 | PageViewModel.getLiveReviewUrl(this.currentPage, this.pageSize).then((liveReviewDTO) => { |
| 124 | this.operDataList.push(...liveReviewDTO.list) | 160 | this.operDataList.push(...liveReviewDTO.list) |
| 161 | + this.getLiveRoomDataInfo(this.operDataList) | ||
| 125 | Logger.debug(TAG, 'addItems after: ' + this.operDataList.length) | 162 | Logger.debug(TAG, 'addItems after: ' + this.operDataList.length) |
| 126 | }) | 163 | }) |
| 127 | } | 164 | } |
| 165 | + | ||
| 166 | + private getLiveDetailIds(list: ContentDTO[]): string { | ||
| 167 | + let idList: string[] = [] | ||
| 168 | + list.forEach(item => { | ||
| 169 | + idList.push(item.objectId) | ||
| 170 | + }); | ||
| 171 | + return idList.join(',') | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + private computeShowNum(count: number): string { | ||
| 175 | + if (count >= 10000) { | ||
| 176 | + let num = (count / 10000).toFixed(1) | ||
| 177 | + if (Number(num.substring(num.length - 1)) == 0) { | ||
| 178 | + num = num.substring(0, num.length - 2) | ||
| 179 | + } | ||
| 180 | + return num + '万人参加' | ||
| 181 | + } | ||
| 182 | + return `${count}人参加` | ||
| 183 | + } | ||
| 128 | } | 184 | } |
| 129 | 185 | ||
| 130 | 186 |
| @@ -59,18 +59,22 @@ export struct ZhGridLayout03 { | @@ -59,18 +59,22 @@ export struct ZhGridLayout03 { | ||
| 59 | .backgroundColor(0xf5f5f5) | 59 | .backgroundColor(0xf5f5f5) |
| 60 | .width(44) | 60 | .width(44) |
| 61 | .aspectRatio(1 / 1) | 61 | .aspectRatio(1 / 1) |
| 62 | - .margin({ | ||
| 63 | - bottom: 16 | ||
| 64 | - }) | 62 | + // .margin({ |
| 63 | + // bottom: 16 | ||
| 64 | + // }) | ||
| 65 | Text(item.newsTitle) | 65 | Text(item.newsTitle) |
| 66 | .fontSize(13) | 66 | .fontSize(13) |
| 67 | .maxLines(1) | 67 | .maxLines(1) |
| 68 | + .margin({ | ||
| 69 | + top: 8, | ||
| 70 | + bottom:11 | ||
| 71 | + }) | ||
| 68 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 72 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 69 | } | 73 | } |
| 70 | .width('100%') | 74 | .width('100%') |
| 71 | .onClick((event: ClickEvent) => { | 75 | .onClick((event: ClickEvent) => { |
| 72 | if (item.objectType === '11') { | 76 | if (item.objectType === '11') { |
| 73 | - ProcessUtils.jumpChannelTab(item.objectId, item.pageId) | 77 | + ProcessUtils.jumpChannelTab(item.objectId, item.pageId, item.newsTitle) |
| 74 | } else { | 78 | } else { |
| 75 | ProcessUtils.processPage(item) | 79 | ProcessUtils.processPage(item) |
| 76 | } | 80 | } |
| @@ -57,7 +57,7 @@ export struct ZhSingleColumn04 { | @@ -57,7 +57,7 @@ export struct ZhSingleColumn04 { | ||
| 57 | .width(12) | 57 | .width(12) |
| 58 | .margin({ left: 12, right: 8 }) | 58 | .margin({ left: 12, right: 8 }) |
| 59 | Text(item.newsTitle) | 59 | Text(item.newsTitle) |
| 60 | - .fontSizeColorWeight($r('app.float.font_size_17'), $r('app.color.color_222222'), 400) | 60 | + .fontSizeColorWeight($r('app.float.font_size_18'), $r('app.color.color_222222'), 400) |
| 61 | .maxLines(1) | 61 | .maxLines(1) |
| 62 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 62 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 63 | .layoutWeight(1) | 63 | .layoutWeight(1) |
| @@ -81,7 +81,7 @@ export struct ZhSingleRow02 { | @@ -81,7 +81,7 @@ export struct ZhSingleRow02 { | ||
| 81 | .visibility(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '' ? Visibility.None : Visibility.Visible) | 81 | .visibility(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '' ? Visibility.None : Visibility.Visible) |
| 82 | .onClick(() => { | 82 | .onClick(() => { |
| 83 | if (this.compDTO?.objectType === '11') { | 83 | if (this.compDTO?.objectType === '11') { |
| 84 | - ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string) | 84 | + ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle) |
| 85 | } else if (this.compDTO?.objectType === '5') { | 85 | } else if (this.compDTO?.objectType === '5') { |
| 86 | ProcessUtils._gotoSpecialTopic(this.compDTO.linkUrl) | 86 | ProcessUtils._gotoSpecialTopic(this.compDTO.linkUrl) |
| 87 | } else if (this.compDTO?.objectType === '6') { | 87 | } else if (this.compDTO?.objectType === '6') { |
| @@ -40,7 +40,6 @@ export struct ZhSingleRow03 { | @@ -40,7 +40,6 @@ export struct ZhSingleRow03 { | ||
| 40 | 40 | ||
| 41 | // 请求所有预约状态 | 41 | // 请求所有预约状态 |
| 42 | async getReserveState() { | 42 | async getReserveState() { |
| 43 | - this.reservedIds = [] | ||
| 44 | const reserveBean: reserveReqItem[] = this.compDTO.operDataList.map((item: ContentDTO) => { | 43 | const reserveBean: reserveReqItem[] = this.compDTO.operDataList.map((item: ContentDTO) => { |
| 45 | const reqItem: reserveReqItem = { | 44 | const reqItem: reserveReqItem = { |
| 46 | liveId: item.objectId.toString(), | 45 | liveId: item.objectId.toString(), |
| @@ -49,6 +48,7 @@ export struct ZhSingleRow03 { | @@ -49,6 +48,7 @@ export struct ZhSingleRow03 { | ||
| 49 | return reqItem; | 48 | return reqItem; |
| 50 | }) | 49 | }) |
| 51 | const res = await LiveModel.getAppointmentStatus(reserveBean); | 50 | const res = await LiveModel.getAppointmentStatus(reserveBean); |
| 51 | + this.reservedIds = [] | ||
| 52 | // this.reserveStatus = res; | 52 | // this.reserveStatus = res; |
| 53 | Logger.debug(TAG, '数据信息:' + `${JSON.stringify(res)}`) | 53 | Logger.debug(TAG, '数据信息:' + `${JSON.stringify(res)}`) |
| 54 | res.map((item: ReserveItemBean) => { | 54 | res.map((item: ReserveItemBean) => { |
| @@ -280,6 +280,8 @@ struct CreatorItem { | @@ -280,6 +280,8 @@ struct CreatorItem { | ||
| 280 | .backgroundColor(0xf5f5f5) | 280 | .backgroundColor(0xf5f5f5) |
| 281 | .width(156) | 281 | .width(156) |
| 282 | .height(208) | 282 | .height(208) |
| 283 | + .border({width: 1}) | ||
| 284 | + .borderRadius(3) | ||
| 283 | Row() | 285 | Row() |
| 284 | .width(156) | 286 | .width(156) |
| 285 | .height(80) | 287 | .height(80) |
| @@ -39,7 +39,7 @@ export struct ZhSingleRow04 { | @@ -39,7 +39,7 @@ export struct ZhSingleRow04 { | ||
| 39 | .visibility(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '' ? Visibility.None : Visibility.Visible) | 39 | .visibility(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '' ? Visibility.None : Visibility.Visible) |
| 40 | .onClick(() => { | 40 | .onClick(() => { |
| 41 | if (this.compDTO?.objectType === '11') { | 41 | if (this.compDTO?.objectType === '11') { |
| 42 | - ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string) | 42 | + ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle) |
| 43 | } else if (this.compDTO?.objectType === '5') { | 43 | } else if (this.compDTO?.objectType === '5') { |
| 44 | ProcessUtils._gotoSpecialTopic(this.compDTO.linkUrl) | 44 | ProcessUtils._gotoSpecialTopic(this.compDTO.linkUrl) |
| 45 | } else if (this.compDTO?.objectType === '6') { | 45 | } else if (this.compDTO?.objectType === '6') { |
| @@ -101,7 +101,7 @@ struct localCard { | @@ -101,7 +101,7 @@ struct localCard { | ||
| 101 | Text(this.operDataListItem.newsTitle) | 101 | Text(this.operDataListItem.newsTitle) |
| 102 | .width(CommonConstants.FULL_PARENT) | 102 | .width(CommonConstants.FULL_PARENT) |
| 103 | .height(CommonConstants.FULL_PARENT) | 103 | .height(CommonConstants.FULL_PARENT) |
| 104 | - .fontSize($r('app.float.font_size_16')) | 104 | + .fontSize($r('app.float.font_size_18')) |
| 105 | .fontColor('#000000') | 105 | .fontColor('#000000') |
| 106 | .align(Alignment.TopStart) | 106 | .align(Alignment.TopStart) |
| 107 | .maxLines(3) | 107 | .maxLines(3) |
| @@ -9,6 +9,7 @@ import { | @@ -9,6 +9,7 @@ import { | ||
| 9 | import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'; | 9 | import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'; |
| 10 | import commentViewModel from '../../components/comment/viewmodel/CommentViewModel'; | 10 | import commentViewModel from '../../components/comment/viewmodel/CommentViewModel'; |
| 11 | import { commentItemModel } from '../../components/comment/model/CommentModel' | 11 | import { commentItemModel } from '../../components/comment/model/CommentModel' |
| 12 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 12 | 13 | ||
| 13 | /** | 14 | /** |
| 14 | * 精选评论卡 | 15 | * 精选评论卡 |
| @@ -22,9 +23,11 @@ export struct ZhSingleRow06 { | @@ -22,9 +23,11 @@ export struct ZhSingleRow06 { | ||
| 22 | @State newsStatusOfUser: batchLikeAndCollectResult = { | 23 | @State newsStatusOfUser: batchLikeAndCollectResult = { |
| 23 | likeStatus: '0' | 24 | likeStatus: '0' |
| 24 | } as batchLikeAndCollectResult // 点赞、收藏状态 | 25 | } as batchLikeAndCollectResult // 点赞、收藏状态 |
| 26 | + @State loadImg: boolean = false; | ||
| 25 | 27 | ||
| 26 | - aboutToAppear(): void { | 28 | + async aboutToAppear(): Promise<void> { |
| 27 | this.getInteractDataStatus() | 29 | this.getInteractDataStatus() |
| 30 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 28 | } | 31 | } |
| 29 | 32 | ||
| 30 | /** | 33 | /** |
| @@ -160,7 +163,12 @@ export struct ZhSingleRow06 { | @@ -160,7 +163,12 @@ export struct ZhSingleRow06 { | ||
| 160 | CompHeader(item: CompDTO) { | 163 | CompHeader(item: CompDTO) { |
| 161 | Row() { | 164 | Row() { |
| 162 | Row() { | 165 | Row() { |
| 163 | - Image(item.operDataList[0]?.commentInfo?.userHeaderUrl ? item.operDataList[0].commentInfo.userHeaderUrl : $r('app.media.default_head')) | 166 | + Image( |
| 167 | + this.loadImg | ||
| 168 | + ? item.operDataList[0]?.commentInfo?.userHeaderUrl | ||
| 169 | + ? item.operDataList[0].commentInfo.userHeaderUrl | ||
| 170 | + : $r('app.media.default_head') | ||
| 171 | + : $r('app.media.comment_rmh_tag')) | ||
| 164 | .width(32) | 172 | .width(32) |
| 165 | .height(32) | 173 | .height(32) |
| 166 | .borderRadius(16) | 174 | .borderRadius(16) |
| 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' |
| 3 | import { PagePersonFunction } from './PagePersonFunction' | 4 | import { PagePersonFunction } from './PagePersonFunction' |
| 4 | 5 | ||
| 6 | + | ||
| 7 | +const TAG = "MinePagePersonFunctionUI" | ||
| 5 | @Component | 8 | @Component |
| 6 | export default struct MinePagePersonFunctionUI { | 9 | export default struct MinePagePersonFunctionUI { |
| 7 | @Link personalData:MinePagePersonalFunctionsItem[] | 10 | @Link personalData:MinePagePersonalFunctionsItem[] |
| @@ -62,6 +65,7 @@ export default struct MinePagePersonFunctionUI { | @@ -62,6 +65,7 @@ export default struct MinePagePersonFunctionUI { | ||
| 62 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 65 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 63 | return | 66 | return |
| 64 | } | 67 | } |
| 68 | + this.messageClick() | ||
| 65 | WDRouterRule.jumpWithPage(WDRouterPage.mineMessagePage) | 69 | WDRouterRule.jumpWithPage(WDRouterPage.mineMessagePage) |
| 66 | break; | 70 | break; |
| 67 | } | 71 | } |
| @@ -75,5 +79,13 @@ export default struct MinePagePersonFunctionUI { | @@ -75,5 +79,13 @@ export default struct MinePagePersonFunctionUI { | ||
| 75 | .height('234lpx') | 79 | .height('234lpx') |
| 76 | .margin({top:'31lpx',left:'23lpx',right:'23lpx' }) | 80 | .margin({top:'31lpx',left:'23lpx',right:'23lpx' }) |
| 77 | } | 81 | } |
| 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 | + } | ||
| 78 | } | 90 | } |
| 79 | 91 |
| 1 | -import { EmitterUtils, EmitterEventId, Logger } from 'wdKit/Index' | 1 | +import { EmitterUtils, EmitterEventId, Logger, NetworkUtil } from 'wdKit/Index' |
| 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel' | 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel' |
| 3 | import { FollowListItem } from '../../../viewmodel/FollowListItem' | 3 | import { FollowListItem } from '../../../viewmodel/FollowListItem' |
| 4 | import { CustomTitleUI } from '../../reusable/CustomTitleUI' | 4 | import { CustomTitleUI } from '../../reusable/CustomTitleUI' |
| 5 | +import { EmptyComponent } from '../../view/EmptyComponent' | ||
| 5 | import { FollowSecondTabsComponent } from './FollowSecondTabsComponent' | 6 | import { FollowSecondTabsComponent } from './FollowSecondTabsComponent' |
| 6 | const TAG = "FollowFirstTabsComponent" | 7 | const TAG = "FollowFirstTabsComponent" |
| 7 | @Component | 8 | @Component |
| @@ -12,13 +13,24 @@ export struct FollowFirstTabsComponent{ | @@ -12,13 +13,24 @@ export struct FollowFirstTabsComponent{ | ||
| 12 | @State data:FollowListItem[] = [] | 13 | @State data:FollowListItem[] = [] |
| 13 | fontColor: string = '#999999' | 14 | fontColor: string = '#999999' |
| 14 | selectedFontColor: string = '#000000' | 15 | selectedFontColor: string = '#000000' |
| 16 | + @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() | ||
| 15 | 17 | ||
| 16 | aboutToAppear(){ | 18 | aboutToAppear(){ |
| 19 | + this.getFollowTabList() | ||
| 20 | + | ||
| 21 | + EmitterUtils.receiveEvent(EmitterEventId.MY_FOLLOW_EMPTY, (() => { | ||
| 22 | + if(this.controller != null && this.data.length>1 ){ | ||
| 23 | + this.jumpFollowNextPage() | ||
| 24 | + } | ||
| 25 | + })) | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + getFollowTabList(){ | ||
| 17 | MinePageDatasModel.getFollowListData(getContext(this)).then((value)=>{ | 29 | MinePageDatasModel.getFollowListData(getContext(this)).then((value)=>{ |
| 18 | this.data.push(new FollowListItem("我的")) | 30 | this.data.push(new FollowListItem("我的")) |
| 19 | - value.forEach((element)=>{ | ||
| 20 | - this.data.push(element) | ||
| 21 | - }) | 31 | + value.forEach((element)=>{ |
| 32 | + this.data.push(element) | ||
| 33 | + }) | ||
| 22 | 34 | ||
| 23 | if(this.controller != null && this.data.length>1 && this.changeIndex === 1){ | 35 | if(this.controller != null && this.data.length>1 && this.changeIndex === 1){ |
| 24 | this.jumpFollowNextPage() | 36 | this.jumpFollowNextPage() |
| @@ -26,12 +38,6 @@ export struct FollowFirstTabsComponent{ | @@ -26,12 +38,6 @@ export struct FollowFirstTabsComponent{ | ||
| 26 | }).catch((err:Error)=>{ | 38 | }).catch((err:Error)=>{ |
| 27 | console.log(TAG,JSON.stringify(err)) | 39 | console.log(TAG,JSON.stringify(err)) |
| 28 | }) | 40 | }) |
| 29 | - | ||
| 30 | - EmitterUtils.receiveEvent(EmitterEventId.MY_FOLLOW_EMPTY, (() => { | ||
| 31 | - if(this.controller != null && this.data.length>1 ){ | ||
| 32 | - this.jumpFollowNextPage() | ||
| 33 | - } | ||
| 34 | - })) | ||
| 35 | } | 41 | } |
| 36 | 42 | ||
| 37 | jumpFollowNextPage(){ | 43 | jumpFollowNextPage(){ |
| @@ -75,24 +81,40 @@ export struct FollowFirstTabsComponent{ | @@ -75,24 +81,40 @@ export struct FollowFirstTabsComponent{ | ||
| 75 | //标题栏目 | 81 | //标题栏目 |
| 76 | CustomTitleUI({titleName:"关注列表"}) | 82 | CustomTitleUI({titleName:"关注列表"}) |
| 77 | 83 | ||
| 78 | - Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { | ||
| 79 | - ForEach(this.data, (item: FollowListItem, index: number ) => { | ||
| 80 | - TabContent(){ | ||
| 81 | - FollowSecondTabsComponent({data:$data,firstIndex:index}) | ||
| 82 | - }.tabBar(this.TabBuilder(index,item)) | ||
| 83 | - }, (item: FollowListItem, index: number) => index.toString()) | 84 | + if(!this.isConnectNetwork){ |
| 85 | + EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | ||
| 86 | + this.reloadNetWork() | ||
| 87 | + },}) | ||
| 88 | + .layoutWeight(1) | ||
| 89 | + .width('100%') | ||
| 90 | + }else{ | ||
| 91 | + Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { | ||
| 92 | + ForEach(this.data, (item: FollowListItem, index: number ) => { | ||
| 93 | + TabContent(){ | ||
| 94 | + FollowSecondTabsComponent({data:$data,firstIndex:index}) | ||
| 95 | + }.tabBar(this.TabBuilder(index,item)) | ||
| 96 | + }, (item: FollowListItem, index: number) => index.toString()) | ||
| 97 | + } | ||
| 98 | + .vertical(false) | ||
| 99 | + .barMode(BarMode.Scrollable) | ||
| 100 | + .barWidth('100%') | ||
| 101 | + .barBackgroundColor($r('app.color.white')) | ||
| 102 | + .barHeight('84lpx') | ||
| 103 | + .animationDuration(0) | ||
| 104 | + .onChange((index: number) => { | ||
| 105 | + this.currentIndex = index | ||
| 106 | + }) | ||
| 107 | + .width('100%') | ||
| 108 | + .layoutWeight(1) | ||
| 84 | } | 109 | } |
| 85 | - .vertical(false) | ||
| 86 | - .barMode(BarMode.Scrollable) | ||
| 87 | - .barWidth('100%') | ||
| 88 | - .barBackgroundColor($r('app.color.white')) | ||
| 89 | - .barHeight('84lpx') | ||
| 90 | - .animationDuration(0) | ||
| 91 | - .onChange((index: number) => { | ||
| 92 | - this.currentIndex = index | ||
| 93 | - }) | ||
| 94 | - .width('100%') | ||
| 95 | - .layoutWeight(1) | ||
| 96 | }.width('100%') | 110 | }.width('100%') |
| 97 | } | 111 | } |
| 112 | + | ||
| 113 | + reloadNetWork(){ | ||
| 114 | + let c = NetworkUtil.isNetConnected() | ||
| 115 | + if(c){ | ||
| 116 | + this.getFollowTabList() | ||
| 117 | + this.isConnectNetwork = c | ||
| 118 | + } | ||
| 119 | + } | ||
| 98 | } | 120 | } |
| 1 | -import { EmitterEventId, EmitterUtils, LazyDataSource, SPHelper, UserDataLocal } from 'wdKit'; | 1 | +import { EmitterEventId, EmitterUtils, LazyDataSource, NetworkUtil, SPHelper, UserDataLocal } from 'wdKit'; |
| 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; | 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; |
| 3 | import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel'; | 3 | import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel'; |
| 4 | import { CreatorDetailRequestItem } from '../../../viewmodel/CreatorDetailRequestItem'; | 4 | import { CreatorDetailRequestItem } from '../../../viewmodel/CreatorDetailRequestItem'; |
| @@ -70,7 +70,11 @@ export struct FollowListDetailUI { | @@ -70,7 +70,11 @@ export struct FollowListDetailUI { | ||
| 70 | Column() { | 70 | Column() { |
| 71 | if (this.count === 0) { | 71 | if (this.count === 0) { |
| 72 | if (this.isGetRequest == true) { | 72 | if (this.isGetRequest == true) { |
| 73 | - if(this.creatorDirectoryId === -1){ | 73 | + if(!NetworkUtil.isNetConnected()){ |
| 74 | + EmptyComponent({ emptyType: 1,emptyHeight:"100%" }) | ||
| 75 | + .layoutWeight(1) | ||
| 76 | + .width('100%') | ||
| 77 | + }else if(this.creatorDirectoryId === -1){ | ||
| 74 | EmptyComponent({ emptyType: 14,emptyHeight:"100%" }) | 78 | EmptyComponent({ emptyType: 14,emptyHeight:"100%" }) |
| 75 | .layoutWeight(1) | 79 | .layoutWeight(1) |
| 76 | .width('100%') | 80 | .width('100%') |
| @@ -7,6 +7,7 @@ import { EmptyComponent } from '../../view/EmptyComponent'; | @@ -7,6 +7,7 @@ import { EmptyComponent } from '../../view/EmptyComponent'; | ||
| 7 | import { ChildCommentComponent } from './ChildCommentComponent'; | 7 | import { ChildCommentComponent } from './ChildCommentComponent'; |
| 8 | import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem'; | 8 | import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem'; |
| 9 | import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; | 9 | import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; |
| 10 | +import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'; | ||
| 10 | 11 | ||
| 11 | const TAG = "HomePageBottomCommentComponent" | 12 | const TAG = "HomePageBottomCommentComponent" |
| 12 | 13 | ||
| @@ -22,6 +23,7 @@ export struct HomePageBottomCommentComponent { | @@ -22,6 +23,7 @@ export struct HomePageBottomCommentComponent { | ||
| 22 | @State count: number = 0; | 23 | @State count: number = 0; |
| 23 | @Link commentNum: number | 24 | @Link commentNum: number |
| 24 | @State isGetRequest: boolean = false | 25 | @State isGetRequest: boolean = false |
| 26 | + private scroller: Scroller = new Scroller(); | ||
| 25 | 27 | ||
| 26 | aboutToAppear() { | 28 | aboutToAppear() { |
| 27 | this.getNewPageData() | 29 | this.getNewPageData() |
| @@ -42,39 +44,31 @@ export struct HomePageBottomCommentComponent { | @@ -42,39 +44,31 @@ export struct HomePageBottomCommentComponent { | ||
| 42 | .offset({ y: "-200lpx" }) | 44 | .offset({ y: "-200lpx" }) |
| 43 | } | 45 | } |
| 44 | } else { | 46 | } else { |
| 45 | - List({ space: 3 }) { | ||
| 46 | - LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => { | ||
| 47 | - ListItem() { | ||
| 48 | - ChildCommentComponent({ | ||
| 49 | - data: item, | ||
| 50 | - levelHead: UserDataLocal.getUserLevelHeaderUrl(), | ||
| 51 | - isLastItem: index === this.data_comment.totalCount() - 1 | ||
| 52 | - }) | 47 | + CustomPullToRefresh({ |
| 48 | + alldata:this.data_comment, | ||
| 49 | + scroller:this.scroller, | ||
| 50 | + customList:()=>{ | ||
| 51 | + this.ListLayout() | ||
| 52 | + }, | ||
| 53 | + onRefresh:(resolve)=>{ | ||
| 54 | + this.curPageNum = 1; | ||
| 55 | + this.hasMore = true | ||
| 56 | + this.isGetRequest = false | ||
| 57 | + this.data_comment.clear() | ||
| 58 | + | ||
| 59 | + if (!this.isLoading){ | ||
| 60 | + this.getNewPageData() | ||
| 61 | + if(resolve) resolve('刷新成功') | ||
| 53 | } | 62 | } |
| 54 | - }, (item: CommentListItem, index: number) => index.toString()) | ||
| 55 | - | ||
| 56 | - //没有更多数据 显示提示 | ||
| 57 | - if (!this.hasMore) { | ||
| 58 | - ListItem() { | ||
| 59 | - ListHasNoMoreDataUI() | 63 | + }, |
| 64 | + onLoadMore:(resolve)=> { | ||
| 65 | + console.log(TAG, "触底了"); | ||
| 66 | + if (!this.isLoading) { | ||
| 67 | + this.isLoading = true | ||
| 68 | + //加载分页数据 | ||
| 69 | + this.getNewPageData() | ||
| 60 | } | 70 | } |
| 61 | } | 71 | } |
| 62 | - } | ||
| 63 | - .cachedCount(15) | ||
| 64 | - .layoutWeight(1) | ||
| 65 | - .scrollBar(BarState.Off) | ||
| 66 | - .edgeEffect(EdgeEffect.None) | ||
| 67 | - .nestedScroll({ | ||
| 68 | - scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 69 | - scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 70 | - }) | ||
| 71 | - .onReachEnd(() => { | ||
| 72 | - console.log(TAG, "触底了"); | ||
| 73 | - if (!this.isLoading) { | ||
| 74 | - this.isLoading = true | ||
| 75 | - //加载分页数据 | ||
| 76 | - this.getNewPageData() | ||
| 77 | - } | ||
| 78 | }) | 72 | }) |
| 79 | } | 73 | } |
| 80 | }.layoutWeight(1) | 74 | }.layoutWeight(1) |
| @@ -82,6 +76,35 @@ export struct HomePageBottomCommentComponent { | @@ -82,6 +76,35 @@ export struct HomePageBottomCommentComponent { | ||
| 82 | .width('100%') | 76 | .width('100%') |
| 83 | } | 77 | } |
| 84 | 78 | ||
| 79 | + @Builder ListLayout(){ | ||
| 80 | + List({ space: 3,scroller: this.scroller }) { | ||
| 81 | + LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => { | ||
| 82 | + ListItem() { | ||
| 83 | + ChildCommentComponent({ | ||
| 84 | + data: item, | ||
| 85 | + levelHead: UserDataLocal.getUserLevelHeaderUrl(), | ||
| 86 | + isLastItem: index === this.data_comment.totalCount() - 1 | ||
| 87 | + }) | ||
| 88 | + } | ||
| 89 | + }, (item: CommentListItem, index: number) => index.toString()) | ||
| 90 | + | ||
| 91 | + //没有更多数据 显示提示 | ||
| 92 | + if (!this.hasMore) { | ||
| 93 | + ListItem() { | ||
| 94 | + ListHasNoMoreDataUI() | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + .cachedCount(15) | ||
| 99 | + .layoutWeight(1) | ||
| 100 | + .scrollBar(BarState.Off) | ||
| 101 | + .edgeEffect(EdgeEffect.None) | ||
| 102 | + .nestedScroll({ | ||
| 103 | + scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 104 | + scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 105 | + }) | ||
| 106 | + } | ||
| 107 | + | ||
| 85 | getNewPageData() { | 108 | getNewPageData() { |
| 86 | this.isLoading = true | 109 | this.isLoading = true |
| 87 | if (this.hasMore) { | 110 | if (this.hasMore) { |
| @@ -7,6 +7,7 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | @@ -7,6 +7,7 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | ||
| 7 | import { FollowChildComponent } from '../follow/FollowChildComponent'; | 7 | import { FollowChildComponent } from '../follow/FollowChildComponent'; |
| 8 | import dataPreferences from '@ohos.data.preferences'; | 8 | import dataPreferences from '@ohos.data.preferences'; |
| 9 | import { EmptyComponent } from '../../view/EmptyComponent'; | 9 | import { EmptyComponent } from '../../view/EmptyComponent'; |
| 10 | +import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'; | ||
| 10 | 11 | ||
| 11 | const TAG = "HomePageBottomFollowComponent" | 12 | const TAG = "HomePageBottomFollowComponent" |
| 12 | /** | 13 | /** |
| @@ -14,6 +15,7 @@ const TAG = "HomePageBottomFollowComponent" | @@ -14,6 +15,7 @@ const TAG = "HomePageBottomFollowComponent" | ||
| 14 | */ | 15 | */ |
| 15 | @Component | 16 | @Component |
| 16 | export struct HomePageBottomFollowComponent { | 17 | export struct HomePageBottomFollowComponent { |
| 18 | + private scroller: Scroller = new Scroller(); | ||
| 17 | @State data_follow: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); | 19 | @State data_follow: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); |
| 18 | @State isLoading: boolean = false | 20 | @State isLoading: boolean = false |
| 19 | @State hasMore: boolean = true | 21 | @State hasMore: boolean = true |
| @@ -104,61 +106,30 @@ export struct HomePageBottomFollowComponent { | @@ -104,61 +106,30 @@ export struct HomePageBottomFollowComponent { | ||
| 104 | }) | 106 | }) |
| 105 | }.layoutWeight(1) | 107 | }.layoutWeight(1) |
| 106 | } else { | 108 | } else { |
| 107 | - List({ space: 3 }) { | 109 | + CustomPullToRefresh({ |
| 110 | + alldata:this.data_follow, | ||
| 111 | + scroller:this.scroller, | ||
| 112 | + customList:()=>{ | ||
| 113 | + this.ListLayout() | ||
| 114 | + }, | ||
| 115 | + onRefresh:(resolve)=>{ | ||
| 116 | + this.curPageNum = 1; | ||
| 117 | + this.hasMore = true | ||
| 118 | + this.isGetRequest = false | ||
| 119 | + this.data_follow.clear() | ||
| 108 | 120 | ||
| 109 | - ListItem() { | ||
| 110 | - Row() { | ||
| 111 | - Text("关注更多人民号") | ||
| 112 | - .fontWeight('400lpx') | ||
| 113 | - .fontColor($r('app.color.color_222222')) | ||
| 114 | - .lineHeight('38lpx') | ||
| 115 | - .fontSize('27lpx') | ||
| 116 | - .textAlign(TextAlign.Center) | ||
| 117 | - .margin({ right: '4lpx' }) | ||
| 118 | - Image($r('app.media.arrow_icon_right')) | ||
| 119 | - .objectFit(ImageFit.Auto) | ||
| 120 | - .width('27lpx') | ||
| 121 | - .height('27lpx') | 121 | + if (!this.isLoading){ |
| 122 | + this.getNewPageData() | ||
| 123 | + if(resolve) resolve('刷新成功') | ||
| 122 | } | 124 | } |
| 123 | - .height('69lpx') | ||
| 124 | - .width('659lpx') | ||
| 125 | - .alignItems(VerticalAlign.Center) | ||
| 126 | - .justifyContent(FlexAlign.Center) | ||
| 127 | - .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 128 | - .margin({ top: '31lpx', bottom: '4lpx' }) | ||
| 129 | - }.onClick(() => { | ||
| 130 | - let params = { 'index': "1" } as Record<string, string> | ||
| 131 | - WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params) | ||
| 132 | - }) | ||
| 133 | - | ||
| 134 | - LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { | ||
| 135 | - ListItem() { | ||
| 136 | - FollowChildComponent({ data: item, type: 2 }) | 125 | + }, |
| 126 | + onLoadMore:(resolve)=> { | ||
| 127 | + console.log(TAG, "触底了"); | ||
| 128 | + if (!this.isLoading) { | ||
| 129 | + this.isLoading = true | ||
| 130 | + //加载分页数据 | ||
| 131 | + this.getNewPageData() | ||
| 137 | } | 132 | } |
| 138 | - }, (item: FollowListDetailItem, index: number) => index.toString()) | ||
| 139 | - | ||
| 140 | - //没有更多数据 显示提示 | ||
| 141 | - if (!this.hasMore) { | ||
| 142 | - ListItem() { | ||
| 143 | - ListHasNoMoreDataUI() | ||
| 144 | - } | ||
| 145 | - } | ||
| 146 | - } | ||
| 147 | - .cachedCount(15) | ||
| 148 | - .padding({ left: '31lpx', right: '31lpx' }) | ||
| 149 | - .layoutWeight(1) | ||
| 150 | - .scrollBar(BarState.Off) | ||
| 151 | - .edgeEffect(EdgeEffect.None) | ||
| 152 | - .nestedScroll({ | ||
| 153 | - scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 154 | - scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 155 | - }) | ||
| 156 | - .onReachEnd(() => { | ||
| 157 | - console.log(TAG, "触底了"); | ||
| 158 | - if (!this.isLoading) { | ||
| 159 | - this.isLoading = true | ||
| 160 | - //加载分页数据 | ||
| 161 | - this.getNewPageData() | ||
| 162 | } | 133 | } |
| 163 | }) | 134 | }) |
| 164 | } | 135 | } |
| @@ -167,6 +138,56 @@ export struct HomePageBottomFollowComponent { | @@ -167,6 +138,56 @@ export struct HomePageBottomFollowComponent { | ||
| 167 | .width('100%') | 138 | .width('100%') |
| 168 | } | 139 | } |
| 169 | 140 | ||
| 141 | + @Builder ListLayout(){ | ||
| 142 | + List({ space: 3 ,scroller:this.scroller}) { | ||
| 143 | + ListItem() { | ||
| 144 | + Row() { | ||
| 145 | + Text("关注更多人民号") | ||
| 146 | + .fontWeight('400lpx') | ||
| 147 | + .fontColor($r('app.color.color_222222')) | ||
| 148 | + .lineHeight('38lpx') | ||
| 149 | + .fontSize('27lpx') | ||
| 150 | + .textAlign(TextAlign.Center) | ||
| 151 | + .margin({ right: '4lpx' }) | ||
| 152 | + Image($r('app.media.arrow_icon_right')) | ||
| 153 | + .objectFit(ImageFit.Auto) | ||
| 154 | + .width('27lpx') | ||
| 155 | + .height('27lpx') | ||
| 156 | + } | ||
| 157 | + .height('69lpx') | ||
| 158 | + .width('659lpx') | ||
| 159 | + .alignItems(VerticalAlign.Center) | ||
| 160 | + .justifyContent(FlexAlign.Center) | ||
| 161 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 162 | + .margin({ top: '31lpx', bottom: '4lpx' }) | ||
| 163 | + }.onClick(() => { | ||
| 164 | + let params = { 'index': "1" } as Record<string, string> | ||
| 165 | + WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params) | ||
| 166 | + }) | ||
| 167 | + | ||
| 168 | + LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { | ||
| 169 | + ListItem() { | ||
| 170 | + FollowChildComponent({ data: item, type: 2 }) | ||
| 171 | + } | ||
| 172 | + }, (item: FollowListDetailItem, index: number) => index.toString()) | ||
| 173 | + //没有更多数据 显示提示 | ||
| 174 | + if (!this.hasMore) { | ||
| 175 | + ListItem() { | ||
| 176 | + ListHasNoMoreDataUI() | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + } | ||
| 180 | + .cachedCount(15) | ||
| 181 | + .padding({ left: '31lpx', right: '31lpx' }) | ||
| 182 | + .layoutWeight(1) | ||
| 183 | + .scrollBar(BarState.Off) | ||
| 184 | + .edgeEffect(EdgeEffect.None) | ||
| 185 | + .nestedScroll({ | ||
| 186 | + scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 187 | + scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 188 | + }) | ||
| 189 | + } | ||
| 190 | + | ||
| 170 | @Styles | 191 | @Styles |
| 171 | listStyle() { | 192 | listStyle() { |
| 172 | .backgroundColor(Color.White) | 193 | .backgroundColor(Color.White) |
-
Please register or login to post a comment