Merge remote-tracking branch 'origin/main'
# Conflicts: # sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponent.ets
Showing
100 changed files
with
1856 additions
and
420 deletions
Too many changes to show.
To preserve performance only 100 of 100+ files are displayed.
| @@ -244,6 +244,30 @@ | @@ -244,6 +244,30 @@ | ||
| 244 | ] | 244 | ] |
| 245 | } | 245 | } |
| 246 | ] | 246 | ] |
| 247 | + }, | ||
| 248 | + { | ||
| 249 | + "name": "wdShareBase", | ||
| 250 | + "srcPath": "./commons/wdShareBase", | ||
| 251 | + "targets": [ | ||
| 252 | + { | ||
| 253 | + "name": "default", | ||
| 254 | + "applyToProducts": [ | ||
| 255 | + "default" | ||
| 256 | + ] | ||
| 257 | + } | ||
| 258 | + ] | ||
| 259 | + }, | ||
| 260 | + { | ||
| 261 | + "name": "wdShare", | ||
| 262 | + "srcPath": "./features/wdShare", | ||
| 263 | + "targets": [ | ||
| 264 | + { | ||
| 265 | + "name": "default", | ||
| 266 | + "applyToProducts": [ | ||
| 267 | + "default" | ||
| 268 | + ] | ||
| 269 | + } | ||
| 270 | + ] | ||
| 247 | } | 271 | } |
| 248 | ] | 272 | ] |
| 249 | } | 273 | } |
| @@ -12,6 +12,8 @@ export class ContentConstants { | @@ -12,6 +12,8 @@ export class ContentConstants { | ||
| 12 | * 2:直播 | 12 | * 2:直播 |
| 13 | */ | 13 | */ |
| 14 | static readonly TYPE_LIVE: string = "2"; | 14 | static readonly TYPE_LIVE: string = "2"; |
| 15 | + | ||
| 16 | + static readonly TYPE_FOUR: string = "4"; | ||
| 15 | /** | 17 | /** |
| 16 | * 5:专题详情 | 18 | * 5:专题详情 |
| 17 | */ | 19 | */ |
| @@ -44,4 +44,7 @@ export class SpConstants{ | @@ -44,4 +44,7 @@ export class SpConstants{ | ||
| 44 | //频道信息流页面左右挂角 | 44 | //频道信息流页面左右挂角 |
| 45 | static APP_PAGE_CORNER_ADV = 'app_page_corner_adv_' | 45 | static APP_PAGE_CORNER_ADV = 'app_page_corner_adv_' |
| 46 | 46 | ||
| 47 | + | ||
| 48 | + //游客状态下首次评论时间 | ||
| 49 | + static FIRSTCOMMENTTIME = 'firstCommentTime' | ||
| 47 | } | 50 | } |
| @@ -53,5 +53,15 @@ export class AppUtils { | @@ -53,5 +53,15 @@ export class AppUtils { | ||
| 53 | } | 53 | } |
| 54 | return ''; | 54 | return ''; |
| 55 | } | 55 | } |
| 56 | + | ||
| 57 | + static getAppChannel() { | ||
| 58 | + // TODO: 待确认,暂时写死一个 | ||
| 59 | + return "rmrb_china_0000" | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + static getOSName() { | ||
| 63 | + // TODO: 待确认,暂时写死Android | ||
| 64 | + return "Harmony" | ||
| 65 | + } | ||
| 56 | } | 66 | } |
| 57 | 67 |
| @@ -70,10 +70,16 @@ export class DeviceUtil { | @@ -70,10 +70,16 @@ export class DeviceUtil { | ||
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | /** | 72 | /** |
| 73 | + * 获取设备型号: HUAWEI Mate 60 Pro | ||
| 74 | + */ | ||
| 75 | + static getMarketName() { | ||
| 76 | + return deviceInfo.marketName | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + /** | ||
| 73 | * 客户端日志链路追踪traceid生成:在每个请求头加上参数Key:EagleEye-TraceID ,value为32位生成随机值 | 80 | * 客户端日志链路追踪traceid生成:在每个请求头加上参数Key:EagleEye-TraceID ,value为32位生成随机值 |
| 74 | */ | 81 | */ |
| 75 | static getRandomUUIDForTraceID(): string { | 82 | static getRandomUUIDForTraceID(): string { |
| 76 | - deviceInfo.productModel | ||
| 77 | - return util.generateRandomUUID().toUpperCase().replace('-', '') | 83 | + return util.generateRandomUUID().toUpperCase().replace(/-/g, '') |
| 78 | } | 84 | } |
| 79 | } | 85 | } |
| @@ -17,6 +17,14 @@ export enum EmitterEventId { | @@ -17,6 +17,14 @@ export enum EmitterEventId { | ||
| 17 | 17 | ||
| 18 | // 关注,取消关注 | 18 | // 关注,取消关注 |
| 19 | PEOPLE_SHIP_ATTENTION = 7, | 19 | PEOPLE_SHIP_ATTENTION = 7, |
| 20 | + // 我的关注 为null | ||
| 21 | + MY_FOLLOW_EMPTY = 8, | ||
| 22 | + | ||
| 23 | + // 登录成功 | ||
| 24 | + LOGIN_SUCCESS = 8, | ||
| 25 | + | ||
| 26 | + // 换绑成功 | ||
| 27 | + PHONE_CHANGE_SUCCESS = 9, | ||
| 20 | 28 | ||
| 21 | // App回到前台 | 29 | // App回到前台 |
| 22 | APP_ENTER_FOREGROUD = 100, | 30 | APP_ENTER_FOREGROUD = 100, |
| @@ -72,6 +72,10 @@ export class UserDataLocal { | @@ -72,6 +72,10 @@ export class UserDataLocal { | ||
| 72 | SPHelper.default.save(UserDataLocal.USER_HEADER_URL, url) | 72 | SPHelper.default.save(UserDataLocal.USER_HEADER_URL, url) |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | + public static setUserType(type:string) { | ||
| 76 | + SPHelper.default.save(UserDataLocal.USER_Type, type) | ||
| 77 | + } | ||
| 78 | + | ||
| 75 | public static setUserFollowOperation(timestamp:string) { | 79 | public static setUserFollowOperation(timestamp:string) { |
| 76 | SPHelper.default.saveSync(UserDataLocal.USER_FOLLOW_OPERATION, timestamp) | 80 | SPHelper.default.saveSync(UserDataLocal.USER_FOLLOW_OPERATION, timestamp) |
| 77 | } | 81 | } |
| @@ -6,6 +6,9 @@ | @@ -6,6 +6,9 @@ | ||
| 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |
| 7 | "specifiers": { | 7 | "specifiers": { |
| 8 | "@ohos/axios@^2.1.1": "@ohos/axios@2.2.0", | 8 | "@ohos/axios@^2.1.1": "@ohos/axios@2.2.0", |
| 9 | + "@umeng/analytics@^1.0.19": "@umeng/analytics@1.0.19", | ||
| 10 | + "@umeng/common@^1.0.21": "@umeng/common@1.0.21", | ||
| 11 | + "libcommon.so@../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon": "libcommon.so@../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon", | ||
| 9 | "wdConstant@../wdConstant": "wdConstant@../wdConstant", | 12 | "wdConstant@../wdConstant": "wdConstant@../wdConstant", |
| 10 | "wdKit@../wdKit": "wdKit@../wdKit" | 13 | "wdKit@../wdKit": "wdKit@../wdKit" |
| 11 | }, | 14 | }, |
| @@ -16,6 +19,26 @@ | @@ -16,6 +19,26 @@ | ||
| 16 | "resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.2.0.har", | 19 | "resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.2.0.har", |
| 17 | "registryType": "ohpm" | 20 | "registryType": "ohpm" |
| 18 | }, | 21 | }, |
| 22 | + "@umeng/analytics@1.0.19": { | ||
| 23 | + "name": "@umeng/analytics", | ||
| 24 | + "integrity": "sha512-0m9z5l8to+POjDl9UkCQC8s4P+e2E1OILwUglC7ME4QwqfH44e59GLJtQdwF0h6kwpsy3YBft4SoWK8MYbuP7g==", | ||
| 25 | + "resolved": "https://ohpm.openharmony.cn/ohpm/@umeng/analytics/-/analytics-1.0.19.har", | ||
| 26 | + "registryType": "ohpm" | ||
| 27 | + }, | ||
| 28 | + "@umeng/common@1.0.21": { | ||
| 29 | + "name": "@umeng/common", | ||
| 30 | + "integrity": "sha512-EbXsd4OoRisTQf5egNY/+z1D2bvrYw9VwC2xu3EJA9TiDPSbnaJZ5+yltA/Se6yZ4oCcFvq6e5/AAfPuumunbw==", | ||
| 31 | + "resolved": "https://ohpm.openharmony.cn/ohpm/@umeng/common/-/common-1.0.21.har", | ||
| 32 | + "registryType": "ohpm", | ||
| 33 | + "dependencies": { | ||
| 34 | + "libcommon.so": "./src/main/cpp/types/libcommon" | ||
| 35 | + } | ||
| 36 | + }, | ||
| 37 | + "libcommon.so@../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon": { | ||
| 38 | + "name": "libcommon.so", | ||
| 39 | + "resolved": "../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon", | ||
| 40 | + "registryType": "local" | ||
| 41 | + }, | ||
| 19 | "wdConstant@../wdConstant": { | 42 | "wdConstant@../wdConstant": { |
| 20 | "name": "wdconstant", | 43 | "name": "wdconstant", |
| 21 | "resolved": "../wdConstant", | 44 | "resolved": "../wdConstant", |
| @@ -24,7 +47,11 @@ | @@ -24,7 +47,11 @@ | ||
| 24 | "wdKit@../wdKit": { | 47 | "wdKit@../wdKit": { |
| 25 | "name": "wdkit", | 48 | "name": "wdkit", |
| 26 | "resolved": "../wdKit", | 49 | "resolved": "../wdKit", |
| 27 | - "registryType": "local" | 50 | + "registryType": "local", |
| 51 | + "dependencies": { | ||
| 52 | + "@umeng/common": "^1.0.21", | ||
| 53 | + "@umeng/analytics": "^1.0.19" | ||
| 54 | + } | ||
| 28 | } | 55 | } |
| 29 | } | 56 | } |
| 30 | } | 57 | } |
| 1 | import { SpConstants } from 'wdConstant'; | 1 | import { SpConstants } from 'wdConstant'; |
| 2 | -import { DateTimeUtils, DeviceUtil, SPHelper, StringUtils } from 'wdKit'; | 2 | +import { AppUtils, DateTimeUtils, DeviceUtil, SPHelper, StringUtils } from 'wdKit'; |
| 3 | import { HttpUtils } from '../utils/HttpUtils'; | 3 | import { HttpUtils } from '../utils/HttpUtils'; |
| 4 | import { HostEnum, HostManager } from './HttpHostManager'; | 4 | import { HostEnum, HostManager } from './HttpHostManager'; |
| 5 | 5 | ||
| @@ -11,16 +11,16 @@ export class HttpParams { | @@ -11,16 +11,16 @@ export class HttpParams { | ||
| 11 | let headers: Record<string, string> = {}; | 11 | let headers: Record<string, string> = {}; |
| 12 | // 通用请求头 | 12 | // 通用请求头 |
| 13 | headers['User-Agent'] = 'Dalvik/2.1.0 (Linux; U; Android 13; 22101317C Build/TKQ1.221013.002)' // TODO | 13 | headers['User-Agent'] = 'Dalvik/2.1.0 (Linux; U; Android 13; 22101317C Build/TKQ1.221013.002)' // TODO |
| 14 | - headers['channel'] = 'rmrb_china_0000' // 自有渠道 | 14 | + headers['channel'] = AppUtils.getAppChannel() |
| 15 | headers['plat'] = DeviceUtil.getPlat() | 15 | headers['plat'] = DeviceUtil.getPlat() |
| 16 | headers['Content-Type'] = 'application/json; charset=utf-8' | 16 | headers['Content-Type'] = 'application/json; charset=utf-8' |
| 17 | headers['device_id'] = DeviceUtil.clientId() | 17 | headers['device_id'] = DeviceUtil.clientId() |
| 18 | headers['build_version'] = HttpParams.getVersion() | 18 | headers['build_version'] = HttpParams.getVersion() |
| 19 | headers['adcode'] = HttpUtils.getProvinceCode() | 19 | headers['adcode'] = HttpUtils.getProvinceCode() |
| 20 | headers['os_version'] = DeviceUtil.getOsVersion() | 20 | headers['os_version'] = DeviceUtil.getOsVersion() |
| 21 | - headers['system'] = 'Android' // TODO 后续是否新增鸿蒙标识 | ||
| 22 | - headers['versionCode'] = HttpParams.getVersionCode() | ||
| 23 | - headers['version_name'] = HttpParams.getVersionName() | 21 | + headers['system'] = AppUtils.getOSName() |
| 22 | + headers['versionCode'] = AppUtils.getAppVersionCode() | ||
| 23 | + headers['version_name'] = AppUtils.getAppVersionName() | ||
| 24 | headers['EagleEye-TraceID'] = DeviceUtil.getRandomUUIDForTraceID() | 24 | headers['EagleEye-TraceID'] = DeviceUtil.getRandomUUIDForTraceID() |
| 25 | headers['imei'] = DeviceUtil.clientId() | 25 | headers['imei'] = DeviceUtil.clientId() |
| 26 | headers['Accept-Language'] = 'zh' | 26 | headers['Accept-Language'] = 'zh' |
| @@ -441,6 +441,12 @@ export class HttpUrlUtils { | @@ -441,6 +441,12 @@ export class HttpUrlUtils { | ||
| 441 | return url; | 441 | return url; |
| 442 | } | 442 | } |
| 443 | 443 | ||
| 444 | + //游客评论合并 | ||
| 445 | + static visitorMergeComment() { | ||
| 446 | + let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/visitorMerge"; | ||
| 447 | + return url; | ||
| 448 | + } | ||
| 449 | + | ||
| 444 | static getAppointmentListDataUrl() { | 450 | static getAppointmentListDataUrl() { |
| 445 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH | 451 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH |
| 446 | return url | 452 | return url |
| @@ -67,7 +67,7 @@ export class ProcessUtils { | @@ -67,7 +67,7 @@ export class ProcessUtils { | ||
| 67 | linkUrl: advert.linkUrl, | 67 | linkUrl: advert.linkUrl, |
| 68 | pageId: advert.pageId, | 68 | pageId: advert.pageId, |
| 69 | objectId: advert.objectId, | 69 | objectId: advert.objectId, |
| 70 | - objectType: advert.objectType, | 70 | + objectType: advert.objectType.toString(), |
| 71 | relId: advert.relId, | 71 | relId: advert.relId, |
| 72 | bottomNavId: advert.bottomNavId | 72 | bottomNavId: advert.bottomNavId |
| 73 | } as ContentDTO; | 73 | } as ContentDTO; |
| @@ -100,6 +100,9 @@ export class ProcessUtils { | @@ -100,6 +100,9 @@ export class ProcessUtils { | ||
| 100 | case ContentConstants.TYPE_LIVE: | 100 | case ContentConstants.TYPE_LIVE: |
| 101 | ProcessUtils.gotoLive(content) | 101 | ProcessUtils.gotoLive(content) |
| 102 | break | 102 | break |
| 103 | + case ContentConstants.TYPE_FOUR: | ||
| 104 | + ProcessUtils.gotoDefaultWeb(content); | ||
| 105 | + break | ||
| 103 | case ContentConstants.TYPE_AUDIO: | 106 | case ContentConstants.TYPE_AUDIO: |
| 104 | ProcessUtils.gotoAudio(content) | 107 | ProcessUtils.gotoAudio(content) |
| 105 | break; | 108 | break; |
| @@ -121,6 +124,7 @@ export class ProcessUtils { | @@ -121,6 +124,7 @@ export class ProcessUtils { | ||
| 121 | //动态详情页(动态图文) | 124 | //动态详情页(动态图文) |
| 122 | case ContentConstants.TYPE_FOURTEEN: | 125 | case ContentConstants.TYPE_FOURTEEN: |
| 123 | ProcessUtils.gotoDynamicDetailPage(content); | 126 | ProcessUtils.gotoDynamicDetailPage(content); |
| 127 | + break; | ||
| 124 | //动态详情页(动态视频) | 128 | //动态详情页(动态视频) |
| 125 | case ContentConstants.TYPE_FIFTEEN: | 129 | case ContentConstants.TYPE_FIFTEEN: |
| 126 | ProcessUtils.gotoDynamicDetailPage(content); | 130 | ProcessUtils.gotoDynamicDetailPage(content); |
| @@ -319,6 +323,8 @@ export class ProcessUtils { | @@ -319,6 +323,8 @@ export class ProcessUtils { | ||
| 319 | extra: { | 323 | extra: { |
| 320 | relType: content?.relType, | 324 | relType: content?.relType, |
| 321 | relId: content?.relId, | 325 | relId: content?.relId, |
| 326 | + extra: content?.extra, | ||
| 327 | + title: content?.newsTitle | ||
| 322 | } as ExtraDTO | 328 | } as ExtraDTO |
| 323 | } as Params, | 329 | } as Params, |
| 324 | }; | 330 | }; |
sight_harmony/commons/wdShareBase/.gitignore
0 → 100644
sight_harmony/commons/wdShareBase/Index.ets
0 → 100644
| 1 | +{ | ||
| 2 | + "apiType": "stageMode", | ||
| 3 | + "buildOption": { | ||
| 4 | + }, | ||
| 5 | + "buildOptionSet": [ | ||
| 6 | + { | ||
| 7 | + "name": "release", | ||
| 8 | + "arkOptions": { | ||
| 9 | + "obfuscation": { | ||
| 10 | + "ruleOptions": { | ||
| 11 | + "enable": true, | ||
| 12 | + "files": [ | ||
| 13 | + "./obfuscation-rules.txt" | ||
| 14 | + ] | ||
| 15 | + } | ||
| 16 | + } | ||
| 17 | + }, | ||
| 18 | + }, | ||
| 19 | + ], | ||
| 20 | + "targets": [ | ||
| 21 | + { | ||
| 22 | + "name": "default" | ||
| 23 | + } | ||
| 24 | + ] | ||
| 25 | +} |
| 1 | +# Define project specific obfuscation rules here. | ||
| 2 | +# You can include the obfuscation configuration files in the current module's build-profile.json5. | ||
| 3 | +# | ||
| 4 | +# For more details, see | ||
| 5 | +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md | ||
| 6 | + | ||
| 7 | +# Obfuscation options: | ||
| 8 | +# -disable-obfuscation: disable all obfuscations | ||
| 9 | +# -enable-property-obfuscation: obfuscate the property names | ||
| 10 | +# -enable-toplevel-obfuscation: obfuscate the names in the global scope | ||
| 11 | +# -compact: remove unnecessary blank spaces and all line feeds | ||
| 12 | +# -remove-log: remove all console.* statements | ||
| 13 | +# -print-namecache: print the name cache that contains the mapping from the old names to new names | ||
| 14 | +# -apply-namecache: reuse the given cache file | ||
| 15 | + | ||
| 16 | +# Keep options: | ||
| 17 | +# -keep-property-name: specifies property names that you want to keep | ||
| 18 | +# -keep-global-name: specifies names that you want to keep in the global scope |
| 1 | + | ||
| 2 | +export const enum ShareType { | ||
| 3 | + System = 0, | ||
| 4 | + WeChat, | ||
| 5 | + QQ, | ||
| 6 | + Weibo, | ||
| 7 | + | ||
| 8 | +} | ||
| 9 | + | ||
| 10 | +export const enum ShareScene { | ||
| 11 | + System = 0, | ||
| 12 | + | ||
| 13 | + WeChatSession, | ||
| 14 | + WeChatTimeline, | ||
| 15 | + | ||
| 16 | + QQFriend, | ||
| 17 | + QQZone, | ||
| 18 | + | ||
| 19 | + Weibo, | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +export const enum ShareContentType { | ||
| 23 | + PrueText = 1, | ||
| 24 | + ImageAndText, | ||
| 25 | + Link, | ||
| 26 | +} | ||
| 27 | + | ||
| 28 | +export interface ShareContentText { | ||
| 29 | + text: string | ||
| 30 | +} | ||
| 31 | +export interface ShareContentImageAndText { | ||
| 32 | + title: string | ||
| 33 | + desc?: string | ||
| 34 | + imgURI: string | ||
| 35 | + | ||
| 36 | +} | ||
| 37 | +export interface ShareContentLink { | ||
| 38 | + title: string | ||
| 39 | + desc?: string | ||
| 40 | + link: string | ||
| 41 | + icon?: string | ||
| 42 | +} | ||
| 43 | + | ||
| 44 | +export type ShareContent = ShareContentText | ShareContentImageAndText | ShareContentLink |
| 1 | +import { ShareContent, ShareContentImageAndText, ShareContentLink, ShareContentText, | ||
| 2 | + ShareContentType, | ||
| 3 | + ShareScene } from '../Constant'; | ||
| 4 | +import { WDShareInterface } from '../WDShareInterface'; | ||
| 5 | +import { AsyncCallback } from '@kit.BasicServicesKit'; | ||
| 6 | +import { common } from '@kit.AbilityKit'; | ||
| 7 | +import { systemShare } from '@kit.ShareKit'; | ||
| 8 | +import { uniformTypeDescriptor as utd } from '@kit.ArkData'; | ||
| 9 | + | ||
| 10 | +export class WDSystemShare implements WDShareInterface { | ||
| 11 | + | ||
| 12 | + shareContent(scene: ShareScene, content: ShareContent, contentType: ShareContentType): Promise<string> { | ||
| 13 | + | ||
| 14 | + return new Promise((resolve, fail) => { | ||
| 15 | + try { | ||
| 16 | + | ||
| 17 | + let controller: systemShare.ShareController = new systemShare.ShareController(this.getShareData(content, contentType)); | ||
| 18 | + let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext | ||
| 19 | + | ||
| 20 | + controller.on('dismiss', () => { | ||
| 21 | + | ||
| 22 | + resolve("dismiss") | ||
| 23 | + }); | ||
| 24 | + | ||
| 25 | + controller.show(context, { | ||
| 26 | + previewMode: systemShare.SharePreviewMode.DEFAULT, | ||
| 27 | + selectionMode: systemShare.SelectionMode.SINGLE | ||
| 28 | + }); | ||
| 29 | + | ||
| 30 | + console.log("分享控制器调用完成") | ||
| 31 | + } catch (e) { | ||
| 32 | + fail(e) | ||
| 33 | + } | ||
| 34 | + }) | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + getShareData(content: ShareContent, contentType: ShareContentType) : systemShare.SharedData { | ||
| 38 | + if (contentType === ShareContentType.PrueText) { | ||
| 39 | + let prueText = content as ShareContentText | ||
| 40 | + console.log("分享纯文本") | ||
| 41 | + return new systemShare.SharedData({ | ||
| 42 | + utd: utd.UniformDataType.PLAIN_TEXT, | ||
| 43 | + content: prueText.text | ||
| 44 | + }); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + if (contentType === ShareContentType.ImageAndText) { | ||
| 48 | + let imageAndText = content as ShareContentImageAndText | ||
| 49 | + console.log("分享图片和文本") | ||
| 50 | + let data: systemShare.SharedData = new systemShare.SharedData({ | ||
| 51 | + utd: utd.UniformDataType.PLAIN_TEXT, | ||
| 52 | + content: imageAndText.title | ||
| 53 | + }); | ||
| 54 | + data.addRecord({ | ||
| 55 | + utd: utd.UniformDataType.PNG, | ||
| 56 | + uri: imageAndText.imgURI | ||
| 57 | + }); | ||
| 58 | + return data | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + console.log("分享链接和文本") | ||
| 62 | + let link = content as ShareContentLink | ||
| 63 | + let data: systemShare.SharedData = new systemShare.SharedData({ | ||
| 64 | + utd: utd.UniformDataType.PLAIN_TEXT, | ||
| 65 | + content: link.title | ||
| 66 | + }); | ||
| 67 | + data.addRecord({ | ||
| 68 | + utd: utd.UniformDataType.HYPERLINK, | ||
| 69 | + uri: link.link | ||
| 70 | + }); | ||
| 71 | + return data | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + | ||
| 75 | +} |
| 1 | +import { ShareContent, ShareContentType, ShareScene, ShareType } from './Constant' | ||
| 2 | +import { HashMap } from '@kit.ArkTS' | ||
| 3 | +import { WDShareInterface } from './WDShareInterface' | ||
| 4 | +import { WDSystemShare } from './System/WDSystemShare' | ||
| 5 | + | ||
| 6 | +export interface WDShareObject { | ||
| 7 | + to: ShareType, | ||
| 8 | + scene: ShareScene, | ||
| 9 | + type: ShareContentType, | ||
| 10 | + obj: ShareContent | ||
| 11 | +} | ||
| 12 | + | ||
| 13 | +export class WDShareBase { | ||
| 14 | + | ||
| 15 | + private static instance?: WDShareBase | ||
| 16 | + static getInstance() : WDShareBase { | ||
| 17 | + if (!WDShareBase.instance) { | ||
| 18 | + WDShareBase.instance = new WDShareBase() | ||
| 19 | + WDShareBase.instance.register() | ||
| 20 | + } | ||
| 21 | + return WDShareBase.instance | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + private handles: HashMap<ShareType, WDShareInterface> = new HashMap() | ||
| 25 | + | ||
| 26 | + register() { | ||
| 27 | + this.handles.set(ShareType.System, new WDSystemShare()) | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + share(obj: WDShareObject) : null | Promise<string> { | ||
| 31 | + let shareHandler: WDShareInterface = this.handles.get(obj.to) | ||
| 32 | + if (shareHandler) { | ||
| 33 | + return shareHandler.shareContent(obj.scene, obj.obj, obj.type) | ||
| 34 | + } | ||
| 35 | + return null | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + | ||
| 40 | + | ||
| 41 | +} |
| 1 | +import { ShareContent, ShareContentType, ShareScene } from './Constant' | ||
| 2 | +import { AsyncCallback } from '@kit.BasicServicesKit' | ||
| 3 | + | ||
| 4 | +export interface WDShareInterface { | ||
| 5 | + // shareContent(scene:ShareScene, content: ShareContent, callback: AsyncCallback<void>): void | ||
| 6 | + shareContent(scene:ShareScene, content: ShareContent, contentType: ShareContentType): Promise<string> | ||
| 7 | + | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +} |
| 1 | +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; | ||
| 2 | + | ||
| 3 | +export default function localUnitTest() { | ||
| 4 | + describe('localUnitTest',() => { | ||
| 5 | + // Defines a test suite. Two parameters are supported: test suite name and test suite function. | ||
| 6 | + beforeAll(() => { | ||
| 7 | + // Presets an action, which is performed only once before all test cases of the test suite start. | ||
| 8 | + // This API supports only one parameter: preset action function. | ||
| 9 | + }); | ||
| 10 | + beforeEach(() => { | ||
| 11 | + // Presets an action, which is performed before each unit test case starts. | ||
| 12 | + // The number of execution times is the same as the number of test cases defined by **it**. | ||
| 13 | + // This API supports only one parameter: preset action function. | ||
| 14 | + }); | ||
| 15 | + afterEach(() => { | ||
| 16 | + // Presets a clear action, which is performed after each unit test case ends. | ||
| 17 | + // The number of execution times is the same as the number of test cases defined by **it**. | ||
| 18 | + // This API supports only one parameter: clear action function. | ||
| 19 | + }); | ||
| 20 | + afterAll(() => { | ||
| 21 | + // Presets a clear action, which is performed after all test cases of the test suite end. | ||
| 22 | + // This API supports only one parameter: clear action function. | ||
| 23 | + }); | ||
| 24 | + it('assertContain', 0, () => { | ||
| 25 | + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. | ||
| 26 | + let a = 'abc'; | ||
| 27 | + let b = 'b'; | ||
| 28 | + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. | ||
| 29 | + expect(a).assertContain(b); | ||
| 30 | + expect(a).assertEqual(a); | ||
| 31 | + }); | ||
| 32 | + }); | ||
| 33 | +} |
| @@ -9,13 +9,17 @@ import router from '@ohos.router'; | @@ -9,13 +9,17 @@ import router from '@ohos.router'; | ||
| 9 | import Url from '@ohos.url' | 9 | import Url from '@ohos.url' |
| 10 | import { ContentDTO, PhotoListBean } from 'wdBean'; | 10 | import { ContentDTO, PhotoListBean } from 'wdBean'; |
| 11 | import { handleJsCallAppService } from './JsCallAppService' | 11 | import { handleJsCallAppService } from './JsCallAppService' |
| 12 | - | 12 | +import { HttpUtils } from 'wdNetwork/Index'; |
| 13 | const TAG = 'JsBridgeBiz' | 13 | const TAG = 'JsBridgeBiz' |
| 14 | 14 | ||
| 15 | class AppInfo { | 15 | class AppInfo { |
| 16 | plat: string = '' | 16 | plat: string = '' |
| 17 | system: string = '' | 17 | system: string = '' |
| 18 | networkStatus: number = 1 | 18 | networkStatus: number = 1 |
| 19 | + screenStatusBarHeight: number = 40 // TODO 这里需要动态获取 | ||
| 20 | + screenTabbarSafeHeight: number = 42 // TODO 这里需要动态获取 | ||
| 21 | + imei: string = HttpUtils.getImei() | ||
| 22 | + device_id: string = HttpUtils.getDeviceId() | ||
| 19 | // TODO 完善 | 23 | // TODO 完善 |
| 20 | } | 24 | } |
| 21 | 25 |
| @@ -4,6 +4,7 @@ import { Logger } from 'wdKit/Index'; | @@ -4,6 +4,7 @@ import { Logger } from 'wdKit/Index'; | ||
| 4 | import { performJSCallNative } from './JsBridgeBiz'; | 4 | 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 | 8 | ||
| 8 | const TAG = 'WdWebLocalComponent'; | 9 | const TAG = 'WdWebLocalComponent'; |
| 9 | 10 | ||
| @@ -22,6 +23,13 @@ export struct WdWebLocalComponent { | @@ -22,6 +23,13 @@ export struct WdWebLocalComponent { | ||
| 22 | @State positionLeft: number = 0 | 23 | @State positionLeft: number = 0 |
| 23 | @State positionTop: number = 0 | 24 | @State positionTop: number = 0 |
| 24 | @State videoLandscape: string = '1' | 25 | @State videoLandscape: string = '1' |
| 26 | + @State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X | ||
| 27 | + @State sliderStartTime: string = ''; | ||
| 28 | + @State currentTime: number = 0; | ||
| 29 | + @State durationTime: number = 0; | ||
| 30 | + @State durationStringTime: string = ''; | ||
| 31 | + @State isPause: boolean = true; | ||
| 32 | + controller: VideoController = new VideoController() | ||
| 25 | 33 | ||
| 26 | build() { | 34 | build() { |
| 27 | Column() { | 35 | Column() { |
| @@ -77,22 +85,87 @@ export struct WdWebLocalComponent { | @@ -77,22 +85,87 @@ export struct WdWebLocalComponent { | ||
| 77 | }) | 85 | }) |
| 78 | 86 | ||
| 79 | if (this.videoUrl) { | 87 | if (this.videoUrl) { |
| 80 | - Video({ src: this.videoUrl }) | ||
| 81 | - .autoPlay(true) | ||
| 82 | - .objectFit(ImageFit.Contain) | ||
| 83 | - .width(this.positionWidth) | ||
| 84 | - .height(this.positionHeight) | ||
| 85 | - .borderRadius(5) | ||
| 86 | - .alignRules({ | ||
| 87 | - top: { anchor: "__container__", align: VerticalAlign.Top }, | 88 | + Stack({ alignContent: Alignment.Bottom }) { |
| 89 | + Video({ | ||
| 90 | + src: this.videoUrl, | ||
| 91 | + currentProgressRate: this.curRate, | ||
| 92 | + controller: this.controller | ||
| 88 | }) | 93 | }) |
| 89 | - .offset({ | ||
| 90 | - x: this.positionLeft, | ||
| 91 | - y: this.positionTop | ||
| 92 | - }) | ||
| 93 | - .id("video") | ||
| 94 | - } | 94 | + .borderRadius(5) |
| 95 | + .controls(false) | ||
| 96 | + .autoPlay(true) | ||
| 97 | + .objectFit(ImageFit.Contain) | ||
| 98 | + .onStart(() => { | ||
| 99 | + this.isPause = false | ||
| 100 | + }) | ||
| 101 | + .onPause(() => { | ||
| 102 | + this.isPause = true | ||
| 103 | + }) | ||
| 104 | + .onPrepared((event) => { | ||
| 105 | + if (event) { | ||
| 106 | + this.durationTime = event.duration | ||
| 107 | + } | ||
| 108 | + }) | ||
| 109 | + .onUpdate((event) => { | ||
| 110 | + if (event) { | ||
| 111 | + this.currentTime = event.time | ||
| 112 | + } | ||
| 113 | + }) | ||
| 114 | + Row() { | ||
| 115 | + Image($r(this.isPause ? 'app.media.icon_play' : 'app.media.icon_pause')) | ||
| 116 | + .width(24) | ||
| 117 | + .height(24) | ||
| 118 | + .onClick(()=>{ | ||
| 119 | + if(this.isPause){ | ||
| 120 | + this.controller.start() | ||
| 121 | + }else{ | ||
| 122 | + this.controller.pause() | ||
| 123 | + } | ||
| 124 | + }) | ||
| 125 | + Row() { | ||
| 126 | + Text(DateTimeUtils.getFormattedDuration(this.currentTime * 1000)).fontSize(12).fontColor(Color.White).fontWeight(600) | ||
| 127 | + Slider({ | ||
| 128 | + value: this.currentTime, | ||
| 129 | + min: 0, | ||
| 130 | + max: this.durationTime | ||
| 131 | + }) | ||
| 132 | + .width("50%") | ||
| 133 | + .selectedColor('#ED2800') | ||
| 134 | + .margin({ left: 4, right: 4 }) | ||
| 135 | + // .blockStyle({ | ||
| 136 | + // type: SliderBlockType.IMAGE, | ||
| 137 | + // image: $r('app.media.slider_block') | ||
| 138 | + // }) | ||
| 139 | + // .blockSize({ width: 18, height: 12 }) | ||
| 140 | + .onChange((value: number, mode: SliderChangeMode) => { | ||
| 141 | + this.controller.setCurrentTime(value); | ||
| 142 | + }) | ||
| 143 | + Text(DateTimeUtils.getFormattedDuration(this.durationTime * 1000)).fontSize(12).fontColor(Color.White).fontWeight(600) | ||
| 144 | + } | ||
| 145 | + .justifyContent(FlexAlign.Center) | ||
| 95 | 146 | ||
| 147 | + Image($r('app.media.icon_full_screen')) | ||
| 148 | + .width(24) | ||
| 149 | + .height(24) | ||
| 150 | + .onClick(()=>{ | ||
| 151 | + this.controller.requestFullscreen(true) | ||
| 152 | + }) | ||
| 153 | + } | ||
| 154 | + .opacity(0.8) | ||
| 155 | + .width("100%") | ||
| 156 | + .justifyContent(FlexAlign.SpaceAround) | ||
| 157 | + } | ||
| 158 | + .width(this.positionWidth) | ||
| 159 | + .height(this.positionHeight) | ||
| 160 | + .alignRules({ | ||
| 161 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 162 | + }) | ||
| 163 | + .offset({ | ||
| 164 | + x: this.positionLeft, | ||
| 165 | + y: this.positionTop | ||
| 166 | + }) | ||
| 167 | + .id("video") | ||
| 168 | + } | ||
| 96 | } | 169 | } |
| 97 | }.width('100%') | 170 | }.width('100%') |
| 98 | .height(this.webHeight) | 171 | .height(this.webHeight) |
289 Bytes
339 Bytes
293 Bytes
1.79 KB
497 Bytes
| @@ -130,8 +130,6 @@ export { LiveInfoDTO } from './src/main/ets/bean/detail/LiveInfoDTO'; | @@ -130,8 +130,6 @@ export { LiveInfoDTO } from './src/main/ets/bean/detail/LiveInfoDTO'; | ||
| 130 | 130 | ||
| 131 | export { postRecommendListParams } from './src/main/ets/bean/detail/postRecommendListParams'; | 131 | export { postRecommendListParams } from './src/main/ets/bean/detail/postRecommendListParams'; |
| 132 | 132 | ||
| 133 | -export { postThemeListParams } from './src/main/ets/bean/detail/postThemeListParams'; | ||
| 134 | - | ||
| 135 | export { LiveDTO } from './src/main/ets/bean/peoples/LiveDTO'; | 133 | export { LiveDTO } from './src/main/ets/bean/peoples/LiveDTO'; |
| 136 | 134 | ||
| 137 | export { contentVideosDTO } from './src/main/ets/bean/content/contentVideosDTO'; | 135 | export { contentVideosDTO } from './src/main/ets/bean/content/contentVideosDTO'; |
| @@ -165,3 +163,7 @@ export { | @@ -165,3 +163,7 @@ export { | ||
| 165 | AttentionBatchDTO, | 163 | AttentionBatchDTO, |
| 166 | CreatorDTO | 164 | CreatorDTO |
| 167 | } from './src/main/ets/bean/peoples/AttentionBatchDTO'; | 165 | } from './src/main/ets/bean/peoples/AttentionBatchDTO'; |
| 166 | + | ||
| 167 | +export { GoldenPositionExtraBean } from './src/main/ets/bean/content/GoldenPositionExtraBean'; | ||
| 168 | +export { ClassBean } from './src/main/ets/bean/content/ClassBean'; | ||
| 169 | +export { CreatorsBean } from './src/main/ets/bean/content/CreatorsBean'; |
| 1 | +/** | ||
| 2 | + * @Description: 广告扩展信息的解析模型 | ||
| 3 | + * @Author: | ||
| 4 | + * @Email: liyubing@wondertek.com.cn | ||
| 5 | + * @CreateDate: | ||
| 6 | + * @UpdateRemark: 更新说明 | ||
| 7 | + * @Version: 1.0 | ||
| 8 | + */ | ||
| 9 | +export interface AdvExtraData { | ||
| 10 | + | ||
| 11 | + | ||
| 12 | + itemTopImage: string; | ||
| 13 | + itemMore: AdvExtraItemData; | ||
| 14 | + item: AdvExtraItemData[] | ||
| 15 | + | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +export interface AdvExtraItemData { | ||
| 19 | +/** | ||
| 20 | + * 图片地址 | ||
| 21 | + */ | ||
| 22 | + image: string; | ||
| 23 | + /** | ||
| 24 | + * 标题 | ||
| 25 | + */ | ||
| 26 | + title: string ; | ||
| 27 | + /** | ||
| 28 | + * 跳转地址 | ||
| 29 | + */ | ||
| 30 | + linkUrl: string; | ||
| 31 | + /** | ||
| 32 | + * 跳转类型 | ||
| 33 | + */ | ||
| 34 | + linkType: string; | ||
| 35 | + | ||
| 36 | +} |
| @@ -17,4 +17,6 @@ export interface ExtraDTO extends ItemDTO { | @@ -17,4 +17,6 @@ export interface ExtraDTO extends ItemDTO { | ||
| 17 | photoList: PhotoListBean[]; | 17 | photoList: PhotoListBean[]; |
| 18 | swiperIndex?: number | 18 | swiperIndex?: number |
| 19 | commentId?: string; | 19 | commentId?: string; |
| 20 | + extra?:string | ||
| 21 | + title: string | ||
| 20 | } | 22 | } |
| 1 | +import { FullColumnImgUrlDTO } from '../detail/FullColumnImgUrlDTO'; | ||
| 2 | +import { LiveInfoDTO } from '../detail/LiveInfoDTO'; | ||
| 3 | +import { VideoInfoDTO } from '../detail/VideoInfoDTO'; | ||
| 4 | +import { InteractDataDTO } from './InteractDataDTO'; | ||
| 5 | +import { slideShows } from '../morningevening/slideShows'; | ||
| 6 | +import { VoiceInfoDTO } from '../detail/VoiceInfoDTO'; | ||
| 7 | +import { RmhInfoDTO } from '../detail/RmhInfoDTO'; | ||
| 8 | +import { commentInfo } from './commentInfo'; | ||
| 9 | +import { ArrayList } from '@kit.ArkTS'; | ||
| 10 | + | ||
| 11 | +export interface ClassBean { | ||
| 12 | + secondClassifyName:string | ||
| 13 | + classifyName:string | ||
| 14 | +} |
| @@ -77,7 +77,11 @@ export interface ContentDTO { | @@ -77,7 +77,11 @@ export interface ContentDTO { | ||
| 77 | newTags: string; | 77 | newTags: string; |
| 78 | titleShow?: number; | 78 | titleShow?: number; |
| 79 | isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据 | 79 | isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据 |
| 80 | + isCollection?: boolean; // 是否是收藏的结果,区分搜索和主页的数据 | ||
| 80 | commentInfo?: commentInfo | 81 | commentInfo?: commentInfo |
| 81 | //底部导航栏 id(用于频道跳转) | 82 | //底部导航栏 id(用于频道跳转) |
| 82 | bottomNavId:string; | 83 | bottomNavId:string; |
| 84 | + // 链接类型: 0:无链接;1:内链(文章);2:外链 | ||
| 85 | + openType:string | ||
| 86 | + extra:string | ||
| 83 | } | 87 | } |
| 1 | +import { ArrayList } from '@kit.ArkTS'; | ||
| 2 | +import { ClassBean } from './ClassBean'; | ||
| 3 | +import { CreatorsBean } from './CreatorsBean'; | ||
| 4 | + | ||
| 5 | +export interface GoldenPositionExtraBean { | ||
| 6 | + sort:number | ||
| 7 | + pageNum:number | ||
| 8 | + pageSize:number | ||
| 9 | + channelId:string | ||
| 10 | + topicId:string | ||
| 11 | + keyWord:string | ||
| 12 | + aggregateType:string | ||
| 13 | + poolCode:string | ||
| 14 | + showPublishStartTime:string | ||
| 15 | + showPublishEndTime:string | ||
| 16 | + keywordsType:string | ||
| 17 | + keywords:ArrayList<string> | ||
| 18 | + classifys: ArrayList<ClassBean> | ||
| 19 | + creatorTags: ArrayList<CreatorsBean> | ||
| 20 | +} |
| @@ -159,7 +159,7 @@ export interface LiveDetailsBean { | @@ -159,7 +159,7 @@ export interface LiveDetailsBean { | ||
| 159 | } | 159 | } |
| 160 | */ | 160 | */ |
| 161 | liveInfo: LiveInfo | 161 | liveInfo: LiveInfo |
| 162 | - fullColumnImgUrls: Array<FullColumnImgUrls> | 162 | + fullColumnImgUrls: Array<FullColumnImgUrlBean> |
| 163 | newsTitle: string | 163 | newsTitle: string |
| 164 | newsId: string | 164 | newsId: string |
| 165 | newIntroduction: string | 165 | newIntroduction: string |
| @@ -186,8 +186,12 @@ export interface MLive { | @@ -186,8 +186,12 @@ export interface MLive { | ||
| 186 | mliveId: string | 186 | mliveId: string |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | -export interface FullColumnImgUrls { | 189 | +export interface FullColumnImgUrlBean { |
| 190 | url: string | 190 | url: string |
| 191 | + height: string | ||
| 192 | + landscape: number | ||
| 193 | + size: string | ||
| 194 | + weight: string | ||
| 191 | } | 195 | } |
| 192 | 196 | ||
| 193 | export interface Vlive { | 197 | export interface Vlive { |
| 1 | +import { FullColumnImgUrlBean } from './LiveDetailsBean' | ||
| 2 | + | ||
| 1 | export interface LiveRoomBean { | 3 | export interface LiveRoomBean { |
| 2 | pageNum: number | 4 | pageNum: number |
| 3 | pageSize: number | 5 | pageSize: number |
| @@ -15,6 +17,7 @@ export interface LiveRoomItemBean { | @@ -15,6 +17,7 @@ export interface LiveRoomItemBean { | ||
| 15 | isWall: number | 17 | isWall: number |
| 16 | //是否置顶 1置顶0不置顶 | 18 | //是否置顶 1置顶0不置顶 |
| 17 | isTop: number | 19 | isTop: number |
| 20 | + //guest :嘉宾,host:主持人 | ||
| 18 | role: string | 21 | role: string |
| 19 | //ZH_TEXT_AND_IMAGE_MSG :图文,ZH_TEXT_MSG:文本,ZH_VIDEO_MSG:视频,ZH_AUDIO_MSG:音频 | 22 | //ZH_TEXT_AND_IMAGE_MSG :图文,ZH_TEXT_MSG:文本,ZH_VIDEO_MSG:视频,ZH_AUDIO_MSG:音频 |
| 20 | dataType: string | 23 | dataType: string |
| @@ -28,5 +31,7 @@ export interface LiveRoomItemBean { | @@ -28,5 +31,7 @@ export interface LiveRoomItemBean { | ||
| 28 | duration: number | 31 | duration: number |
| 29 | //音频地址 | 32 | //音频地址 |
| 30 | audioUrl: string | 33 | audioUrl: string |
| 34 | + //详情页面插入数据bean | ||
| 35 | + fullColumnImgUrlDto: FullColumnImgUrlBean | ||
| 31 | 36 | ||
| 32 | } | 37 | } |
| @@ -25,6 +25,7 @@ import { Card2Component } from './cardview/Card2Component'; | @@ -25,6 +25,7 @@ import { Card2Component } from './cardview/Card2Component'; | ||
| 25 | import { Card5Component } from './cardview/Card5Component'; | 25 | import { Card5Component } from './cardview/Card5Component'; |
| 26 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 26 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 27 | import { AdvCardParser } from './cardViewAdv/AdvCardParser'; | 27 | import { AdvCardParser } from './cardViewAdv/AdvCardParser'; |
| 28 | +import PageModel from '../viewmodel/PageModel'; | ||
| 28 | 29 | ||
| 29 | /** | 30 | /** |
| 30 | * comp适配器. | 31 | * comp适配器. |
| @@ -34,7 +35,9 @@ import { AdvCardParser } from './cardViewAdv/AdvCardParser'; | @@ -34,7 +35,9 @@ import { AdvCardParser } from './cardViewAdv/AdvCardParser'; | ||
| 34 | @Component | 35 | @Component |
| 35 | export struct CompParser { | 36 | export struct CompParser { |
| 36 | @State compDTO: CompDTO = {} as CompDTO | 37 | @State compDTO: CompDTO = {} as CompDTO |
| 37 | - compIndex: number = 0; | 38 | + |
| 39 | + @State private pageModel: PageModel = new PageModel(); | ||
| 40 | + @State compIndex: number = 0; | ||
| 38 | 41 | ||
| 39 | build() { | 42 | build() { |
| 40 | Column() { | 43 | Column() { |
| @@ -44,7 +47,7 @@ export struct CompParser { | @@ -44,7 +47,7 @@ export struct CompParser { | ||
| 44 | 47 | ||
| 45 | @Builder | 48 | @Builder |
| 46 | componentBuilder(compDTO: CompDTO, compIndex: number) { | 49 | componentBuilder(compDTO: CompDTO, compIndex: number) { |
| 47 | - // if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口 | 50 | + //if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口 |
| 48 | if (compDTO.compStyle === CompStyle.Label_03) { | 51 | if (compDTO.compStyle === CompStyle.Label_03) { |
| 49 | LabelComponent({ compDTO: compDTO }) | 52 | LabelComponent({ compDTO: compDTO }) |
| 50 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 53 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| @@ -77,8 +80,8 @@ export struct CompParser { | @@ -77,8 +80,8 @@ export struct CompParser { | ||
| 77 | ZhSingleRow04({ compDTO: compDTO }) | 80 | ZhSingleRow04({ compDTO: compDTO }) |
| 78 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 81 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 79 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_05) { | 82 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_05) { |
| 80 | - ZhSingleRow05({ compDTO }) | ||
| 81 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 83 | + // ZhSingleRow05({ compDTO }) |
| 84 | + // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 82 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) { | 85 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) { |
| 83 | ZhSingleRow06({ compDTO }) | 86 | ZhSingleRow06({ compDTO }) |
| 84 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 87 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| @@ -100,7 +103,8 @@ export struct CompParser { | @@ -100,7 +103,8 @@ export struct CompParser { | ||
| 100 | ZhSingleColumn09({ compDTO }) | 103 | ZhSingleColumn09({ compDTO }) |
| 101 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 104 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 102 | } else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告 | 105 | } else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告 |
| 103 | - AdvCardParser({compDTO}) | 106 | + AdvCardParser({pageModel:this.pageModel,compDTO}) |
| 107 | + //Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 }) | ||
| 104 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 108 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 105 | } else if (!Number.isNaN(Number(compDTO.compStyle))) { | 109 | } else if (!Number.isNaN(Number(compDTO.compStyle))) { |
| 106 | CardParser({ contentDTO: compDTO.operDataList[0] }); | 110 | CardParser({ contentDTO: compDTO.operDataList[0] }); |
| @@ -119,6 +123,6 @@ export struct CompParser { | @@ -119,6 +123,6 @@ export struct CompParser { | ||
| 119 | } | 123 | } |
| 120 | } | 124 | } |
| 121 | 125 | ||
| 122 | - // } | 126 | + // } |
| 123 | } | 127 | } |
| 124 | 128 |
| 1 | -import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper, NumberFormatterUtils } from 'wdKit'; | 1 | +import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper, NumberFormatterUtils, DisplayUtils } from 'wdKit'; |
| 2 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 2 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 3 | import { ContentDetailDTO,postBatchAttentionStatusParams, | 3 | import { ContentDetailDTO,postBatchAttentionStatusParams, |
| 4 | PhotoListBean, | 4 | PhotoListBean, |
| @@ -53,7 +53,7 @@ export struct DynamicDetailComponent { | @@ -53,7 +53,7 @@ export struct DynamicDetailComponent { | ||
| 53 | //跳转 | 53 | //跳转 |
| 54 | private mJumpInfo: ContentDTO = {} as ContentDTO; | 54 | private mJumpInfo: ContentDTO = {} as ContentDTO; |
| 55 | 55 | ||
| 56 | - @State publishCommentModel: publishCommentModel = new publishCommentModel() | 56 | + |
| 57 | 57 | ||
| 58 | async aboutToAppear() { | 58 | async aboutToAppear() { |
| 59 | await this.getContentDetailData() | 59 | await this.getContentDetailData() |
| @@ -83,7 +83,7 @@ export struct DynamicDetailComponent { | @@ -83,7 +83,7 @@ export struct DynamicDetailComponent { | ||
| 83 | Image($r('app.media.ic_news_detail_division')) | 83 | Image($r('app.media.ic_news_detail_division')) |
| 84 | .width('100%') | 84 | .width('100%') |
| 85 | .height($r('app.float.margin_7')) | 85 | .height($r('app.float.margin_7')) |
| 86 | - .margin({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} ) | 86 | + .padding({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} ) |
| 87 | Stack({ alignContent: Alignment.Bottom }) { | 87 | Stack({ alignContent: Alignment.Bottom }) { |
| 88 | Scroll(this.scroller) { | 88 | Scroll(this.scroller) { |
| 89 | Column() { | 89 | Column() { |
| @@ -97,15 +97,29 @@ export struct DynamicDetailComponent { | @@ -97,15 +97,29 @@ export struct DynamicDetailComponent { | ||
| 97 | .height($r('app.float.margin_32')) | 97 | .height($r('app.float.margin_32')) |
| 98 | .objectFit(ImageFit.Cover) | 98 | .objectFit(ImageFit.Cover) |
| 99 | .borderRadius($r('app.float.margin_16')) | 99 | .borderRadius($r('app.float.margin_16')) |
| 100 | - Image($r('app.media.icon_border_test')) | 100 | + Image(this.contentDetailData.rmhInfo?.honoraryIcon) |
| 101 | .width($r('app.float.margin_48')) | 101 | .width($r('app.float.margin_48')) |
| 102 | .height($r('app.float.margin_48')) | 102 | .height($r('app.float.margin_48')) |
| 103 | .objectFit(ImageFit.Cover) | 103 | .objectFit(ImageFit.Cover) |
| 104 | .borderRadius($r('app.float.margin_24')) | 104 | .borderRadius($r('app.float.margin_24')) |
| 105 | + if(!StringUtils.isEmpty(this.contentDetailData.rmhInfo?.authIcon)){ | ||
| 106 | + Stack() { | ||
| 107 | + Image(this.contentDetailData.rmhInfo?.authIcon) | ||
| 108 | + .width($r('app.float.vp_12')) | ||
| 109 | + .height($r('app.float.vp_12')) | ||
| 110 | + .objectFit(ImageFit.Cover) | ||
| 111 | + } | ||
| 112 | + .width($r('app.float.margin_48')) | ||
| 113 | + .height($r('app.float.margin_48')) | ||
| 114 | + .alignContent(Alignment.BottomEnd) | ||
| 115 | + } | ||
| 105 | } | 116 | } |
| 106 | .width($r('app.float.margin_48')) | 117 | .width($r('app.float.margin_48')) |
| 107 | .height($r('app.float.margin_48')) | 118 | .height($r('app.float.margin_48')) |
| 108 | .alignContent(Alignment.Center) | 119 | .alignContent(Alignment.Center) |
| 120 | + .onClick(() => { | ||
| 121 | + ProcessUtils.gotoPeopleShipHomePage(this.contentDetailData.rmhInfo == null ?"":this.contentDetailData.rmhInfo.rmhId) | ||
| 122 | + }) | ||
| 109 | Column(){ | 123 | Column(){ |
| 110 | //昵称 | 124 | //昵称 |
| 111 | Text(this.contentDetailData.rmhInfo?.rmhName) | 125 | Text(this.contentDetailData.rmhInfo?.rmhName) |
| @@ -128,7 +142,7 @@ export struct DynamicDetailComponent { | @@ -128,7 +142,7 @@ export struct DynamicDetailComponent { | ||
| 128 | .margin({right: $r('app.float.margin_6')}) | 142 | .margin({right: $r('app.float.margin_6')}) |
| 129 | if(!StringUtils.isEmpty(this.followStatus)){ | 143 | if(!StringUtils.isEmpty(this.followStatus)){ |
| 130 | if (this.followStatus == '0') { | 144 | if (this.followStatus == '0') { |
| 131 | - Text('关注') | 145 | + Text('+关注') |
| 132 | .width($r('app.float.margin_54')) | 146 | .width($r('app.float.margin_54')) |
| 133 | .height($r('app.float.margin_24')) | 147 | .height($r('app.float.margin_24')) |
| 134 | .textAlign(TextAlign.Center) | 148 | .textAlign(TextAlign.Center) |
| @@ -147,7 +161,8 @@ export struct DynamicDetailComponent { | @@ -147,7 +161,8 @@ export struct DynamicDetailComponent { | ||
| 147 | .textAlign(TextAlign.Center) | 161 | .textAlign(TextAlign.Center) |
| 148 | .fontSize($r('app.float.font_size_12')) | 162 | .fontSize($r('app.float.font_size_12')) |
| 149 | .borderRadius($r('app.float.vp_3')) | 163 | .borderRadius($r('app.float.vp_3')) |
| 150 | - .borderColor($r('app.color.color_CCCCCC')) | 164 | + .borderColor($r('app.color.color_CCCCCC_1A')) |
| 165 | + .backgroundColor($r('app.color.color_CCCCCC_1A')) | ||
| 151 | .fontColor($r('app.color.color_CCCCCC')) | 166 | .fontColor($r('app.color.color_CCCCCC')) |
| 152 | .onClick(() => { | 167 | .onClick(() => { |
| 153 | this.handleAccention() | 168 | this.handleAccention() |
| @@ -275,8 +290,8 @@ export struct DynamicDetailComponent { | @@ -275,8 +290,8 @@ export struct DynamicDetailComponent { | ||
| 275 | Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)? | 290 | Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)? |
| 276 | this.contentDetailData.fullColumnImgUrls[0].url: | 291 | this.contentDetailData.fullColumnImgUrls[0].url: |
| 277 | this.contentDetailData.videoInfo[0].firstFrameImageUri) | 292 | this.contentDetailData.videoInfo[0].firstFrameImageUri) |
| 278 | - .width(CommonConstants.FULL_WIDTH) | ||
| 279 | - .aspectRatio(16 / 9) | 293 | + .width(DisplayUtils.getDeviceWidth()- 32) |
| 294 | + .height((DisplayUtils.getDeviceWidth()-32)* 9 / 16) | ||
| 280 | .borderRadius($r('app.float.image_border_radius')) | 295 | .borderRadius($r('app.float.image_border_radius')) |
| 281 | CardMediaInfo({ contentDTO: this.mJumpInfo }) | 296 | CardMediaInfo({ contentDTO: this.mJumpInfo }) |
| 282 | } | 297 | } |
| @@ -291,7 +306,8 @@ export struct DynamicDetailComponent { | @@ -291,7 +306,8 @@ export struct DynamicDetailComponent { | ||
| 291 | Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)? | 306 | Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)? |
| 292 | this.contentDetailData.fullColumnImgUrls[0].url: | 307 | this.contentDetailData.fullColumnImgUrls[0].url: |
| 293 | this.contentDetailData.videoInfo[0].firstFrameImageUri) | 308 | this.contentDetailData.videoInfo[0].firstFrameImageUri) |
| 294 | - .width(CommonConstants.FULL_WIDTH) | 309 | + .width(DisplayUtils.getDeviceWidth()/2) |
| 310 | + .height(DisplayUtils.getDeviceWidth()/2* 4 / 3) | ||
| 295 | .borderRadius($r('app.float.image_border_radius')) | 311 | .borderRadius($r('app.float.image_border_radius')) |
| 296 | CardMediaInfo({ contentDTO: this.mJumpInfo }) | 312 | CardMediaInfo({ contentDTO: this.mJumpInfo }) |
| 297 | } | 313 | } |
| @@ -299,7 +315,7 @@ export struct DynamicDetailComponent { | @@ -299,7 +315,7 @@ export struct DynamicDetailComponent { | ||
| 299 | } | 315 | } |
| 300 | } | 316 | } |
| 301 | } | 317 | } |
| 302 | - .margin({ left: $r('app.float.margin_16'),right: $r('app.float.margin_16'),top: $r('app.float.margin_8')}) | 318 | + .padding({ left: this.contentDetailData.videoInfo[0].videoLandScape === 1?0: 25,top: $r('app.float.margin_8')}) |
| 303 | .onClick((event: ClickEvent) => { | 319 | .onClick((event: ClickEvent) => { |
| 304 | ProcessUtils.processPage(this.mJumpInfo) | 320 | ProcessUtils.processPage(this.mJumpInfo) |
| 305 | }) | 321 | }) |
| @@ -311,8 +327,8 @@ export struct DynamicDetailComponent { | @@ -311,8 +327,8 @@ export struct DynamicDetailComponent { | ||
| 311 | .fontSize($r('app.float.font_size_12')) | 327 | .fontSize($r('app.float.font_size_12')) |
| 312 | .lineHeight($r('app.float.margin_16')) | 328 | .lineHeight($r('app.float.margin_16')) |
| 313 | .margin({ top: $r('app.float.margin_16') | 329 | .margin({ top: $r('app.float.margin_16') |
| 314 | - ,left: $r('app.float.margin_16') | ||
| 315 | - ,right: $r('app.float.margin_16') }) | 330 | + ,left: $r('app.float.vp_12') |
| 331 | + ,right: $r('app.float.vp_12') }) | ||
| 316 | //微信/朋友圈/微博 | 332 | //微信/朋友圈/微博 |
| 317 | Row(){ | 333 | Row(){ |
| 318 | Image($r('app.media.xxhdpi_pic_wechat')) | 334 | Image($r('app.media.xxhdpi_pic_wechat')) |
| @@ -362,9 +378,17 @@ export struct DynamicDetailComponent { | @@ -362,9 +378,17 @@ export struct DynamicDetailComponent { | ||
| 362 | }) | 378 | }) |
| 363 | // 评论 | 379 | // 评论 |
| 364 | if (this.contentDetailData?.openComment) { | 380 | if (this.contentDetailData?.openComment) { |
| 365 | - Divider().strokeWidth(6).color('#f5f5f5') | 381 | + Divider().strokeWidth(6).color('#f5f5f5').margin({top:$r('app.float.margin_24')}) |
| 366 | CommentComponent({ | 382 | CommentComponent({ |
| 367 | - publishCommentModel: this.publishCommentModel | 383 | + publishCommentModel: { |
| 384 | + targetId: String(this.contentDetailData?.newsId || ''), | ||
| 385 | + targetRelId: this.contentDetailData?.reLInfo?.relId, | ||
| 386 | + targetTitle: this.contentDetailData?.newsTitle, | ||
| 387 | + targetRelType: this.contentDetailData?.reLInfo?.relType, | ||
| 388 | + targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId), | ||
| 389 | + keyArticle: String(this.contentDetailData?.keyArticle), | ||
| 390 | + targetType: String(this.contentDetailData?.newsType), | ||
| 391 | + } as publishCommentModel | ||
| 368 | }) | 392 | }) |
| 369 | } | 393 | } |
| 370 | Blank().layoutWeight(1) | 394 | Blank().layoutWeight(1) |
| @@ -379,7 +403,15 @@ export struct DynamicDetailComponent { | @@ -379,7 +403,15 @@ export struct DynamicDetailComponent { | ||
| 379 | OperRowListView({ contentDetailData: this.contentDetailData | 403 | OperRowListView({ contentDetailData: this.contentDetailData |
| 380 | ,interactData:this.interactDataDTO | 404 | ,interactData:this.interactDataDTO |
| 381 | ,newsStatusOfUser:this.newsStatusOfUser | 405 | ,newsStatusOfUser:this.newsStatusOfUser |
| 382 | - ,publishCommentModel: this.publishCommentModel | 406 | + ,publishCommentModel: { |
| 407 | + targetId: String(this.contentDetailData?.newsId || ''), | ||
| 408 | + targetRelId: this.contentDetailData?.reLInfo?.relId, | ||
| 409 | + targetTitle: this.contentDetailData?.newsTitle, | ||
| 410 | + targetRelType: this.contentDetailData?.reLInfo?.relType, | ||
| 411 | + targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId), | ||
| 412 | + keyArticle: String(this.contentDetailData?.keyArticle), | ||
| 413 | + targetType: String(this.contentDetailData?.newsType), | ||
| 414 | + } as publishCommentModel | ||
| 383 | ,needLike:false}) | 415 | ,needLike:false}) |
| 384 | } | 416 | } |
| 385 | } | 417 | } |
| @@ -399,17 +431,6 @@ export struct DynamicDetailComponent { | @@ -399,17 +431,6 @@ export struct DynamicDetailComponent { | ||
| 399 | } catch (exception) { | 431 | } catch (exception) { |
| 400 | console.log('请求失败',JSON.stringify(exception)) | 432 | console.log('请求失败',JSON.stringify(exception)) |
| 401 | } | 433 | } |
| 402 | - if (this.contentDetailData.openComment) { | ||
| 403 | - this.publishCommentModel = { | ||
| 404 | - targetId: String(this.contentDetailData?.newsId || ''), | ||
| 405 | - targetRelId: this.contentDetailData?.reLInfo?.relId, | ||
| 406 | - targetTitle: this.contentDetailData?.newsTitle, | ||
| 407 | - targetRelType: this.contentDetailData?.reLInfo?.relType, | ||
| 408 | - targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId), | ||
| 409 | - keyArticle: String(this.contentDetailData?.keyArticle), | ||
| 410 | - targetType: String(this.contentDetailData?.newsType), | ||
| 411 | - } as publishCommentModel | ||
| 412 | - } | ||
| 413 | this.getBatchAttentionStatus() | 434 | this.getBatchAttentionStatus() |
| 414 | this.getInteractDataStatus() | 435 | this.getInteractDataStatus() |
| 415 | this.makeJumpInfo() | 436 | this.makeJumpInfo() |
| @@ -42,10 +42,12 @@ export struct ENewspaperPageComponent { | @@ -42,10 +42,12 @@ export struct ENewspaperPageComponent { | ||
| 42 | console.log("onDateChange-日历选择弹框", "date:", JSON.stringify(date)) | 42 | console.log("onDateChange-日历选择弹框", "date:", JSON.stringify(date)) |
| 43 | if (date.fullYear && date.month && date.date) { | 43 | if (date.fullYear && date.month && date.date) { |
| 44 | let month: number = date.month + 1 | 44 | let month: number = date.month + 1 |
| 45 | - this.calendarDate = `${date.fullYear}-${month > 9 ? month : '0' + month}-${date.date > 9 ? date.date : '0' + date.date}` | 45 | + this.calendarDate = |
| 46 | + `${date.fullYear}-${month > 9 ? month : '0' + month}-${date.date > 9 ? date.date : '0' + date.date}` | ||
| 46 | this.getNewspaperTime() | 47 | this.getNewspaperTime() |
| 47 | this.getNewspaperList() | 48 | this.getNewspaperList() |
| 48 | - this.selectDate = new Date(date.fullYear ? date.fullYear : 0, date.month ? date.month : 0, date.date ? date.date : 0) | 49 | + this.selectDate = |
| 50 | + new Date(date.fullYear ? date.fullYear : 0, date.month ? date.month : 0, date.date ? date.date : 0) | ||
| 49 | } | 51 | } |
| 50 | } | 52 | } |
| 51 | }), | 53 | }), |
| @@ -81,8 +83,8 @@ export struct ENewspaperPageComponent { | @@ -81,8 +83,8 @@ export struct ENewspaperPageComponent { | ||
| 81 | this.picHeight = this.picWidth * 566 / 378 | 83 | this.picHeight = this.picWidth * 566 / 378 |
| 82 | //注册字体 | 84 | //注册字体 |
| 83 | font.registerFont({ | 85 | font.registerFont({ |
| 84 | - familyName: 'BebasNeue_Regular', | ||
| 85 | - familySrc: $rawfile('font/BebasNeue_Regular.otf') | 86 | + familyName: 'BebasNeueBold', |
| 87 | + familySrc: $rawfile('font/BebasNeueBold.otf') | ||
| 86 | }) | 88 | }) |
| 87 | this.getNewspaperTime() | 89 | this.getNewspaperTime() |
| 88 | this.getNewspaperList() | 90 | this.getNewspaperList() |
| @@ -117,7 +119,7 @@ export struct ENewspaperPageComponent { | @@ -117,7 +119,7 @@ export struct ENewspaperPageComponent { | ||
| 117 | Text(this.calendarDate?.replace('-', '.')?.replace('-', '.')) | 119 | Text(this.calendarDate?.replace('-', '.')?.replace('-', '.')) |
| 118 | .fontSize($r('app.float.font_size_20')) | 120 | .fontSize($r('app.float.font_size_20')) |
| 119 | .fontColor($r('app.color.white')) | 121 | .fontColor($r('app.color.white')) |
| 120 | - .fontFamily('BebasNeue_Regular') | 122 | + .fontFamily('BebasNeueBold') |
| 121 | .fontWeight(FontWeight.Regular) | 123 | .fontWeight(FontWeight.Regular) |
| 122 | 124 | ||
| 123 | Image($r('app.media.icon_triangle')) | 125 | Image($r('app.media.icon_triangle')) |
| @@ -148,6 +150,7 @@ export struct ENewspaperPageComponent { | @@ -148,6 +150,7 @@ export struct ENewspaperPageComponent { | ||
| 148 | center: { anchor: "__container__", align: VerticalAlign.Center } | 150 | center: { anchor: "__container__", align: VerticalAlign.Center } |
| 149 | }) | 151 | }) |
| 150 | .id('e_newspaper_share') | 152 | .id('e_newspaper_share') |
| 153 | + .visibility(Visibility.Hidden) | ||
| 151 | } | 154 | } |
| 152 | .margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) | 155 | .margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) |
| 153 | .height($r('app.float.top_bar_height')) | 156 | .height($r('app.float.top_bar_height')) |
| @@ -208,13 +211,15 @@ export struct ENewspaperPageComponent { | @@ -208,13 +211,15 @@ export struct ENewspaperPageComponent { | ||
| 208 | .id('e_newspaper_shadow') | 211 | .id('e_newspaper_shadow') |
| 209 | 212 | ||
| 210 | Row() { | 213 | Row() { |
| 211 | - Text(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? '已到底部,可以选择其他日期' : '滑动查看下一版') | 214 | + Text(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? '已到底部,可以选择其他日期' : |
| 215 | + '滑动查看下一版') | ||
| 212 | .fontColor(Color.White) | 216 | .fontColor(Color.White) |
| 213 | .fontSize($r('app.float.font_size_14')) | 217 | .fontSize($r('app.float.font_size_14')) |
| 214 | Image($r('app.media.icon_next_page')) | 218 | Image($r('app.media.icon_next_page')) |
| 215 | .width($r('app.float.vp_16')) | 219 | .width($r('app.float.vp_16')) |
| 216 | .height($r('app.float.vp_16')) | 220 | .height($r('app.float.vp_16')) |
| 217 | - .visibility(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? Visibility.None : Visibility.Visible) | 221 | + .visibility(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? Visibility.None : |
| 222 | + Visibility.Visible) | ||
| 218 | } | 223 | } |
| 219 | .justifyContent(FlexAlign.Center) | 224 | .justifyContent(FlexAlign.Center) |
| 220 | .margin({ top: $r('app.float.margin_16') }) | 225 | .margin({ top: $r('app.float.margin_16') }) |
| @@ -232,7 +237,7 @@ export struct ENewspaperPageComponent { | @@ -232,7 +237,7 @@ export struct ENewspaperPageComponent { | ||
| 232 | Text(this.currentPageNum) | 237 | Text(this.currentPageNum) |
| 233 | .fontSize($r('app.float.font_size_36')) | 238 | .fontSize($r('app.float.font_size_36')) |
| 234 | .fontColor($r('app.color.white')) | 239 | .fontColor($r('app.color.white')) |
| 235 | - .fontFamily('BebasNeue_Regular') | 240 | + .fontFamily('BebasNeueBold') |
| 236 | Text('版') | 241 | Text('版') |
| 237 | .fontSize($r('app.float.font_size_16')) | 242 | .fontSize($r('app.float.font_size_16')) |
| 238 | .fontColor($r('app.color.white')) | 243 | .fontColor($r('app.color.white')) |
| 1 | -import { Logger, NumberFormatterUtils, DateTimeUtils } from 'wdKit'; | 1 | +import { |
| 2 | + Logger, | ||
| 3 | + NumberFormatterUtils, | ||
| 4 | + DateTimeUtils, | ||
| 5 | + EmitterUtils, | ||
| 6 | + EmitterEventId, | ||
| 7 | + NetworkUtil, | ||
| 8 | + DisplayUtils | ||
| 9 | +} from 'wdKit'; | ||
| 2 | import { | 10 | import { |
| 3 | Action, | 11 | Action, |
| 4 | ContentDetailDTO, | 12 | ContentDetailDTO, |
| @@ -20,7 +28,7 @@ import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailView | @@ -20,7 +28,7 @@ import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailView | ||
| 20 | import { PageRepository } from '../repository/PageRepository'; | 28 | import { PageRepository } from '../repository/PageRepository'; |
| 21 | import { detailedSkeleton } from './skeleton/detailSkeleton'; | 29 | import { detailedSkeleton } from './skeleton/detailSkeleton'; |
| 22 | import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; | 30 | import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; |
| 23 | - | 31 | +import { EmptyComponent } from '../components/view/EmptyComponent'; |
| 24 | import { CommentComponent } from '../components/comment/view/CommentComponent' | 32 | import { CommentComponent } from '../components/comment/view/CommentComponent' |
| 25 | import { HttpUtils } from 'wdNetwork/Index'; | 33 | import { HttpUtils } from 'wdNetwork/Index'; |
| 26 | 34 | ||
| @@ -39,6 +47,9 @@ export struct ImageAndTextPageComponent { | @@ -39,6 +47,9 @@ export struct ImageAndTextPageComponent { | ||
| 39 | @State isPageEnd: boolean = false | 47 | @State isPageEnd: boolean = false |
| 40 | @State publishTime: string = '' | 48 | @State publishTime: string = '' |
| 41 | @State publishCommentModel: publishCommentModel = new publishCommentModel() | 49 | @State publishCommentModel: publishCommentModel = new publishCommentModel() |
| 50 | + @State operationButtonList: string[] = ['comment', 'collect', 'share'] | ||
| 51 | + @State isNetConnected: boolean = true | ||
| 52 | + @State info: Area | null = null | ||
| 42 | 53 | ||
| 43 | build() { | 54 | build() { |
| 44 | Column() { | 55 | Column() { |
| @@ -83,17 +94,21 @@ export struct ImageAndTextPageComponent { | @@ -83,17 +94,21 @@ export struct ImageAndTextPageComponent { | ||
| 83 | Row() { | 94 | Row() { |
| 84 | Row() { | 95 | Row() { |
| 85 | if (this.newsStatusOfUser?.likeStatus === '1') { | 96 | if (this.newsStatusOfUser?.likeStatus === '1') { |
| 86 | - Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : $r('app.media.icon_candle_active'))) | 97 | + Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') : |
| 98 | + (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : | ||
| 99 | + $r('app.media.icon_candle_active'))) | ||
| 87 | .width(24) | 100 | .width(24) |
| 88 | .height(24) | 101 | .height(24) |
| 89 | .margin({ right: 5 }) | 102 | .margin({ right: 5 }) |
| 90 | } else { | 103 | } else { |
| 91 | - Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : $r('app.media.icon_candle'))) | 104 | + Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') : |
| 105 | + (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : | ||
| 106 | + $r('app.media.icon_candle'))) | ||
| 92 | .width(24) | 107 | .width(24) |
| 93 | .height(24) | 108 | .height(24) |
| 94 | .margin({ right: 5 }) | 109 | .margin({ right: 5 }) |
| 95 | } | 110 | } |
| 96 | - if (this.interactData?.likeNum !== '0') { | 111 | + if (this.interactData?.likeNum != '0') { |
| 97 | Text(`${this.interactData?.likeNum}`) | 112 | Text(`${this.interactData?.likeNum}`) |
| 98 | .fontSize(16) | 113 | .fontSize(16) |
| 99 | .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999') | 114 | .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999') |
| @@ -125,7 +140,11 @@ export struct ImageAndTextPageComponent { | @@ -125,7 +140,11 @@ export struct ImageAndTextPageComponent { | ||
| 125 | Divider().strokeWidth(6).color('#f5f5f5') | 140 | Divider().strokeWidth(6).color('#f5f5f5') |
| 126 | CommentComponent({ | 141 | CommentComponent({ |
| 127 | publishCommentModel: this.publishCommentModel | 142 | publishCommentModel: this.publishCommentModel |
| 143 | + }).onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 144 | + this.info = newValue | ||
| 128 | }) | 145 | }) |
| 146 | + // .onMeasureSize() | ||
| 147 | + | ||
| 129 | } | 148 | } |
| 130 | } | 149 | } |
| 131 | } | 150 | } |
| @@ -135,18 +154,27 @@ export struct ImageAndTextPageComponent { | @@ -135,18 +154,27 @@ export struct ImageAndTextPageComponent { | ||
| 135 | .height(CommonConstants.FULL_HEIGHT) | 154 | .height(CommonConstants.FULL_HEIGHT) |
| 136 | .padding({ bottom: 76 }) | 155 | .padding({ bottom: 76 }) |
| 137 | .scrollBar(BarState.Off) | 156 | .scrollBar(BarState.Off) |
| 157 | + .align(Alignment.Top) | ||
| 138 | 158 | ||
| 139 | - if (!this.isPageEnd) { | ||
| 140 | - detailedSkeleton() | 159 | + if (!this.isNetConnected) { |
| 160 | + EmptyComponent({ | ||
| 161 | + emptyType: 1, | ||
| 162 | + emptyButton: true, | ||
| 163 | + retry: () => { | ||
| 164 | + this.getDetail() | ||
| 165 | + } | ||
| 166 | + }).padding({ bottom: 200 }) | ||
| 167 | + } else { | ||
| 168 | + if (!this.isPageEnd) { | ||
| 169 | + detailedSkeleton() | ||
| 170 | + } | ||
| 141 | } | 171 | } |
| 142 | - | ||
| 143 | //底部交互区 | 172 | //底部交互区 |
| 144 | - if (this.contentDetailData?.length) { | ||
| 145 | - OperRowListView({ | ||
| 146 | - contentDetailData: this.contentDetailData[0], | ||
| 147 | - publishCommentModel: this.publishCommentModel | ||
| 148 | - }) | ||
| 149 | - } | 173 | + OperRowListView({ |
| 174 | + contentDetailData: this.contentDetailData[0], | ||
| 175 | + publishCommentModel: this.publishCommentModel, | ||
| 176 | + operationButtonList: this.operationButtonList, | ||
| 177 | + }) | ||
| 150 | } | 178 | } |
| 151 | 179 | ||
| 152 | } | 180 | } |
| @@ -155,6 +183,7 @@ export struct ImageAndTextPageComponent { | @@ -155,6 +183,7 @@ export struct ImageAndTextPageComponent { | ||
| 155 | } | 183 | } |
| 156 | 184 | ||
| 157 | private async getDetail() { | 185 | private async getDetail() { |
| 186 | + this.isNetConnected = NetworkUtil.isNetConnected() | ||
| 158 | let contentId: string = '' | 187 | let contentId: string = '' |
| 159 | let relId: string = '' | 188 | let relId: string = '' |
| 160 | let relType: string = '' | 189 | let relType: string = '' |
| @@ -174,7 +203,8 @@ export struct ImageAndTextPageComponent { | @@ -174,7 +203,8 @@ export struct ImageAndTextPageComponent { | ||
| 174 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) | 203 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) |
| 175 | if (detailBeans && detailBeans.length > 0) { | 204 | if (detailBeans && detailBeans.length > 0) { |
| 176 | this.contentDetailData = detailBeans; | 205 | this.contentDetailData = detailBeans; |
| 177 | - let dateTime = DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN); | 206 | + let dateTime = |
| 207 | + DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN); | ||
| 178 | this.publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN) | 208 | this.publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN) |
| 179 | if (this.contentDetailData[0]?.recommendShow === 1) { | 209 | if (this.contentDetailData[0]?.recommendShow === 1) { |
| 180 | this.getRecommend() | 210 | this.getRecommend() |
| @@ -184,13 +214,16 @@ export struct ImageAndTextPageComponent { | @@ -184,13 +214,16 @@ export struct ImageAndTextPageComponent { | ||
| 184 | this.queryContentInteractCount() | 214 | this.queryContentInteractCount() |
| 185 | } | 215 | } |
| 186 | if (this.contentDetailData[0]?.openComment) { | 216 | if (this.contentDetailData[0]?.openComment) { |
| 187 | - this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '') | ||
| 188 | - this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId) | ||
| 189 | - this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle | ||
| 190 | - this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType) | ||
| 191 | - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId) | ||
| 192 | - this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle) | ||
| 193 | - this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType) | 217 | + this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '') |
| 218 | + this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId) | ||
| 219 | + this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle | ||
| 220 | + this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType) | ||
| 221 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId) | ||
| 222 | + this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle) | ||
| 223 | + this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType) | ||
| 224 | + } | ||
| 225 | + if (this.contentDetailData[0]?.audioList?.length && this.contentDetailData[0]?.audioList[0].audioUrl) { | ||
| 226 | + this.operationButtonList = ['comment', 'collect', 'listen', 'share'] | ||
| 194 | } | 227 | } |
| 195 | } | 228 | } |
| 196 | } | 229 | } |
| @@ -198,11 +231,10 @@ export struct ImageAndTextPageComponent { | @@ -198,11 +231,10 @@ export struct ImageAndTextPageComponent { | ||
| 198 | 231 | ||
| 199 | private async getRecommend() { | 232 | private async getRecommend() { |
| 200 | let params: postRecommendListParams = { | 233 | let params: postRecommendListParams = { |
| 201 | - // TODO ? imei: HttpUtils.getImei() | ||
| 202 | - imei: "8272c108-4fa2-34ce-80b9-bc425a7c2a7e", | 234 | + imei: HttpUtils.getImei(), |
| 203 | userId: HttpUtils.getUserId(), | 235 | userId: HttpUtils.getUserId(), |
| 204 | contentId: String(this.contentDetailData[0]?.newsId), | 236 | contentId: String(this.contentDetailData[0]?.newsId), |
| 205 | - recType: 1, | 237 | + recType: Number(this.contentDetailData[0]?.reLInfo?.relType), |
| 206 | contentType: this.contentDetailData[0]?.newsType, | 238 | contentType: this.contentDetailData[0]?.newsType, |
| 207 | relId: this.contentDetailData[0]?.reLInfo?.relId, | 239 | relId: this.contentDetailData[0]?.reLInfo?.relId, |
| 208 | channelId: String(this.contentDetailData[0]?.reLInfo?.channelId) | 240 | channelId: String(this.contentDetailData[0]?.reLInfo?.channelId) |
| @@ -280,6 +312,24 @@ export struct ImageAndTextPageComponent { | @@ -280,6 +312,24 @@ export struct ImageAndTextPageComponent { | ||
| 280 | 312 | ||
| 281 | aboutToAppear() { | 313 | aboutToAppear() { |
| 282 | this.getDetail() | 314 | this.getDetail() |
| 315 | + //注册通知,来自别的组件的评论成功通知 | ||
| 316 | + EmitterUtils.receiveEvent(EmitterEventId.COMMENT_PUBLISH, (targetId?: string) => { | ||
| 317 | + if (targetId) { | ||
| 318 | + if (targetId == this.publishCommentModel.targetId) { | ||
| 319 | + // 滚动到评论列表 | ||
| 320 | + if (this.info) { | ||
| 321 | + // let height = DisplayUtils.getDeviceHeight() / 2 | ||
| 322 | + let offSetY = this.info?.globalPosition.y as number | ||
| 323 | + //头部距离48 | ||
| 324 | + this.scroller.scrollTo({ | ||
| 325 | + yOffset: offSetY - 100, | ||
| 326 | + xOffset: 0, | ||
| 327 | + animation: { duration: 1000, curve: Curve.Ease } | ||
| 328 | + }) | ||
| 329 | + } | ||
| 330 | + } | ||
| 331 | + } | ||
| 332 | + }) | ||
| 283 | } | 333 | } |
| 284 | 334 | ||
| 285 | aboutToDisappear() { | 335 | aboutToDisappear() { |
| @@ -117,7 +117,7 @@ export struct ImageAndTextWebComponent { | @@ -117,7 +117,7 @@ export struct ImageAndTextWebComponent { | ||
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) { | 119 | private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) { |
| 120 | - Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData'); | 120 | + Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData',JSON.stringify(h5ReceiveAppData)); |
| 121 | this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData, | 121 | this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData, |
| 122 | JSON.stringify(h5ReceiveAppData), (data: string) => { | 122 | JSON.stringify(h5ReceiveAppData), (data: string) => { |
| 123 | Logger.debug('ImageAndTextWebComponent', "from js data = " + data); | 123 | Logger.debug('ImageAndTextWebComponent', "from js data = " + data); |
| 1 | // import { FrontLinkObject, MorningEveningPaperDTO, PageInfoBean } from 'wdBean'; | 1 | // import { FrontLinkObject, MorningEveningPaperDTO, PageInfoBean } from 'wdBean'; |
| 2 | import { CompList, PageInfoBean } from 'wdBean'; | 2 | import { CompList, PageInfoBean } from 'wdBean'; |
| 3 | -import { DateTimeUtils, Logger, SPHelper } from 'wdKit/Index'; | 3 | +import { DateTimeUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index'; |
| 4 | import { PaperReaderSimpleDialog } from '../../dialog/PaperReaderDialog'; | 4 | import { PaperReaderSimpleDialog } from '../../dialog/PaperReaderDialog'; |
| 5 | import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel'; | 5 | import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel'; |
| 6 | // import { AudioBarView } from './AudioBarView'; | 6 | // import { AudioBarView } from './AudioBarView'; |
| @@ -102,6 +102,7 @@ export struct MorningEveningPaperComponent { | @@ -102,6 +102,7 @@ export struct MorningEveningPaperComponent { | ||
| 102 | async aboutToAppear() { | 102 | async aboutToAppear() { |
| 103 | let windowHight: window.Window = await window.getLastWindow(getContext(this)); | 103 | let windowHight: window.Window = await window.getLastWindow(getContext(this)); |
| 104 | await windowHight.setWindowLayoutFullScreen(true); | 104 | await windowHight.setWindowLayoutFullScreen(true); |
| 105 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) | ||
| 105 | this.topSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height) | 106 | this.topSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height) |
| 106 | 107 | ||
| 107 | let dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String | 108 | let dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String |
| @@ -173,6 +174,7 @@ export struct MorningEveningPaperComponent { | @@ -173,6 +174,7 @@ export struct MorningEveningPaperComponent { | ||
| 173 | async aboutToDisappear() { | 174 | async aboutToDisappear() { |
| 174 | let windowHight: window.Window = await window.getLastWindow(getContext(this)); | 175 | let windowHight: window.Window = await window.getLastWindow(getContext(this)); |
| 175 | await windowHight.setWindowLayoutFullScreen(false); | 176 | await windowHight.setWindowLayoutFullScreen(false); |
| 177 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) | ||
| 176 | } | 178 | } |
| 177 | 179 | ||
| 178 | onPageHide() { | 180 | onPageHide() { |
| @@ -34,7 +34,7 @@ export struct PaperTitleComponent { | @@ -34,7 +34,7 @@ export struct PaperTitleComponent { | ||
| 34 | Text(this.subTitle ?? '')// Text('2024年\n1月16日') | 34 | Text(this.subTitle ?? '')// Text('2024年\n1月16日') |
| 35 | // .width(50) | 35 | // .width(50) |
| 36 | .margin({ left: 5 }) | 36 | .margin({ left: 5 }) |
| 37 | - .fontSize(12) | 37 | + .fontSize(8) |
| 38 | .fontColor($r('app.color.white')) | 38 | .fontColor($r('app.color.white')) |
| 39 | .maxLines(2) | 39 | .maxLines(2) |
| 40 | 40 | ||
| @@ -47,7 +47,8 @@ export struct PaperTitleComponent { | @@ -47,7 +47,8 @@ export struct PaperTitleComponent { | ||
| 47 | .alignItems(VerticalAlign.Center) | 47 | .alignItems(VerticalAlign.Center) |
| 48 | .alignRules({ | 48 | .alignRules({ |
| 49 | left: { anchor: "img_logo1", align: HorizontalAlign.End }, | 49 | left: { anchor: "img_logo1", align: HorizontalAlign.End }, |
| 50 | - center: { anchor: "__container__", align: VerticalAlign.Center } }) | 50 | + center: { anchor: "__container__", align: VerticalAlign.Center } |
| 51 | + }) | ||
| 51 | .id('row_paper_date') | 52 | .id('row_paper_date') |
| 52 | 53 | ||
| 53 | Image($r('app.media.icon_close')) | 54 | Image($r('app.media.icon_close')) |
| @@ -55,7 +56,8 @@ export struct PaperTitleComponent { | @@ -55,7 +56,8 @@ export struct PaperTitleComponent { | ||
| 55 | .width($r('app.float.top_arrow_size')) | 56 | .width($r('app.float.top_arrow_size')) |
| 56 | .alignRules({ | 57 | .alignRules({ |
| 57 | right: { anchor: "__container__", align: HorizontalAlign.End }, | 58 | right: { anchor: "__container__", align: HorizontalAlign.End }, |
| 58 | - center: { anchor: "__container__", align: VerticalAlign.Center } }) | 59 | + center: { anchor: "__container__", align: VerticalAlign.Center } |
| 60 | + }) | ||
| 59 | .id('img_close') | 61 | .id('img_close') |
| 60 | .onClick((event: ClickEvent) => { | 62 | .onClick((event: ClickEvent) => { |
| 61 | // console.info(TAG, "img_close") | 63 | // console.info(TAG, "img_close") |
| @@ -68,11 +70,12 @@ export struct PaperTitleComponent { | @@ -68,11 +70,12 @@ export struct PaperTitleComponent { | ||
| 68 | .width($r('app.float.top_arrow_size')) | 70 | .width($r('app.float.top_arrow_size')) |
| 69 | .alignRules({ | 71 | .alignRules({ |
| 70 | right: { anchor: "img_close", align: HorizontalAlign.Start }, | 72 | right: { anchor: "img_close", align: HorizontalAlign.Start }, |
| 71 | - center: { anchor: "__container__", align: VerticalAlign.Center } }) | 73 | + center: { anchor: "__container__", align: VerticalAlign.Center } |
| 74 | + }) | ||
| 72 | .id('img_share') | 75 | .id('img_share') |
| 73 | .margin({ right: 13 }) | 76 | .margin({ right: 13 }) |
| 74 | } | 77 | } |
| 75 | - // .margin({ left: 14, right: 14 }) | 78 | + .margin({ left: 14, right: 14 }) |
| 76 | .height($r('app.float.top_bar_height')) | 79 | .height($r('app.float.top_bar_height')) |
| 77 | 80 | ||
| 78 | // .backgroundColor(Color.Black) | 81 | // .backgroundColor(Color.Black) |
| @@ -150,7 +150,10 @@ export struct SingleColumn999Component { | @@ -150,7 +150,10 @@ export struct SingleColumn999Component { | ||
| 150 | scrollBackward: NestedScrollMode.SELF_FIRST | 150 | scrollBackward: NestedScrollMode.SELF_FIRST |
| 151 | }) | 151 | }) |
| 152 | } else { | 152 | } else { |
| 153 | - EmptyComponent({ emptyHeight: 200 }) | 153 | + if (this.compListItem && this.compListItem?.operDataList) { |
| 154 | + EmptyComponent({ emptyHeight: 200 }) | ||
| 155 | + } | ||
| 156 | + | ||
| 154 | } | 157 | } |
| 155 | } | 158 | } |
| 156 | 159 |
| @@ -5,7 +5,8 @@ import { | @@ -5,7 +5,8 @@ import { | ||
| 5 | PhotoListBean, | 5 | PhotoListBean, |
| 6 | postInteractBrowsOperateParams, | 6 | postInteractBrowsOperateParams, |
| 7 | postBatchAttentionStatusParams, | 7 | postBatchAttentionStatusParams, |
| 8 | - postInteractAccentionOperateParams | 8 | + postInteractAccentionOperateParams, |
| 9 | + Params | ||
| 9 | } from 'wdBean'; | 10 | } from 'wdBean'; |
| 10 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 11 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 11 | import display from '@ohos.display'; | 12 | import display from '@ohos.display'; |
| @@ -13,6 +14,7 @@ import font from '@ohos.font'; | @@ -13,6 +14,7 @@ import font from '@ohos.font'; | ||
| 13 | import { OperRowListView } from './view/OperRowListView'; | 14 | import { OperRowListView } from './view/OperRowListView'; |
| 14 | import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent'; | 15 | import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent'; |
| 15 | import { ImageDownloadComponent } from '../components/ImageDownloadComponent'; | 16 | import { ImageDownloadComponent } from '../components/ImageDownloadComponent'; |
| 17 | +import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; | ||
| 16 | import { EmptyComponent } from './view/EmptyComponent'; | 18 | import { EmptyComponent } from './view/EmptyComponent'; |
| 17 | import { DateTimeUtils } from 'wdKit/Index'; | 19 | import { DateTimeUtils } from 'wdKit/Index'; |
| 18 | import { HttpUrlUtils } from 'wdNetwork/Index'; | 20 | import { HttpUrlUtils } from 'wdNetwork/Index'; |
| @@ -42,6 +44,8 @@ export struct MultiPictureDetailPageComponent { | @@ -42,6 +44,8 @@ export struct MultiPictureDetailPageComponent { | ||
| 42 | private scroller: Scroller = new Scroller() | 44 | private scroller: Scroller = new Scroller() |
| 43 | @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图 | 45 | @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图 |
| 44 | @State showDownload: Boolean = false // 控制是否显示下载默认隐藏 | 46 | @State showDownload: Boolean = false // 控制是否显示下载默认隐藏 |
| 47 | + @State publishCommentModel: publishCommentModel = new publishCommentModel() | ||
| 48 | + @State operationButtonList: string[] = ['comment', 'like', 'collect', 'share'] | ||
| 45 | 49 | ||
| 46 | //watch监听页码回调 | 50 | //watch监听页码回调 |
| 47 | onCurrentPageNumUpdated(): void { | 51 | onCurrentPageNumUpdated(): void { |
| @@ -59,10 +63,10 @@ export struct MultiPictureDetailPageComponent { | @@ -59,10 +63,10 @@ export struct MultiPictureDetailPageComponent { | ||
| 59 | this.picHeight = this.picWidth * 578 / 375 | 63 | this.picHeight = this.picWidth * 578 / 375 |
| 60 | this.titleHeight = this.screenWidth * 178 / 375 | 64 | this.titleHeight = this.screenWidth * 178 / 375 |
| 61 | //注册字体 | 65 | //注册字体 |
| 62 | - font.registerFont({ | ||
| 63 | - familyName: 'BebasNeue_Regular', | ||
| 64 | - familySrc: $rawfile('font/BebasNeue_Regular.otf') | ||
| 65 | - }) | 66 | + // font.registerFont({ |
| 67 | + // familyName: 'BebasNeueBold', | ||
| 68 | + // familySrc: $rawfile('font/BebasNeueBold.otf') | ||
| 69 | + // }) | ||
| 66 | // 注册监听网络连接 | 70 | // 注册监听网络连接 |
| 67 | let netStatus = NetworkUtil.isNetConnected() | 71 | let netStatus = NetworkUtil.isNetConnected() |
| 68 | if (netStatus) { | 72 | if (netStatus) { |
| @@ -96,19 +100,31 @@ export struct MultiPictureDetailPageComponent { | @@ -96,19 +100,31 @@ export struct MultiPictureDetailPageComponent { | ||
| 96 | if (this.contentDetailData.rmhPlatform == 1) { | 100 | if (this.contentDetailData.rmhPlatform == 1) { |
| 97 | Row() { | 101 | Row() { |
| 98 | Row({ space: 8 }) { | 102 | Row({ space: 8 }) { |
| 99 | - Row() { | ||
| 100 | - Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl) | ||
| 101 | - .borderRadius(24) | ||
| 102 | - .aspectRatio(1) | ||
| 103 | - .border({ width: 1, color: Color.White, style: BorderStyle.Solid }) | ||
| 104 | - .alt($r('app.media.picture_loading')) | ||
| 105 | - .width(36) | ||
| 106 | - .height(36) | ||
| 107 | - .objectFit(ImageFit.Fill) | ||
| 108 | - .interpolation(ImageInterpolation.High) | 103 | + if (this.getImgUrl()){ |
| 104 | + Row() { | ||
| 105 | + Image(this.getImgUrl()) | ||
| 106 | + .borderRadius(24) | ||
| 107 | + .aspectRatio(1) | ||
| 108 | + .border({ width: 1, color: Color.White, style: BorderStyle.Solid }) | ||
| 109 | + .width(36) | ||
| 110 | + .height(36) | ||
| 111 | + .objectFit(ImageFit.Fill) | ||
| 112 | + .interpolation(ImageInterpolation.High) | ||
| 113 | + .onClick(() => { | ||
| 114 | + if (this.contentDetailData.rmhInfo?.cnMainControl === 1) { | ||
| 115 | + // 号主页 | ||
| 116 | + const params: Params = { | ||
| 117 | + creatorId: this.contentDetailData.rmhInfo.rmhId, | ||
| 118 | + pageID: '' | ||
| 119 | + } | ||
| 120 | + WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + }) | ||
| 124 | + } | ||
| 125 | + .width('13%') | ||
| 126 | + .height('100%') | ||
| 109 | } | 127 | } |
| 110 | - .width('13%') | ||
| 111 | - .height('100%') | ||
| 112 | 128 | ||
| 113 | Row() { | 129 | Row() { |
| 114 | Flex({ | 130 | Flex({ |
| @@ -188,6 +204,7 @@ export struct MultiPictureDetailPageComponent { | @@ -188,6 +204,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 188 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 204 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| 189 | }) | 205 | }) |
| 190 | .id('e_attention') | 206 | .id('e_attention') |
| 207 | + .visibility(!this.showDownload ? Visibility.Visible : Visibility.None) | ||
| 191 | } | 208 | } |
| 192 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) { | 209 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) { |
| 193 | Swiper(this.swiperController) { | 210 | Swiper(this.swiperController) { |
| @@ -302,10 +319,9 @@ export struct MultiPictureDetailPageComponent { | @@ -302,10 +319,9 @@ export struct MultiPictureDetailPageComponent { | ||
| 302 | } | 319 | } |
| 303 | OperRowListView({ | 320 | OperRowListView({ |
| 304 | contentDetailData: this.contentDetailData, | 321 | contentDetailData: this.contentDetailData, |
| 322 | + publishCommentModel: this.publishCommentModel, | ||
| 323 | + operationButtonList: this.operationButtonList, | ||
| 305 | }) | 324 | }) |
| 306 | - .width('100%') | ||
| 307 | - .height(56) | ||
| 308 | - .border({ width: { top: 0.5 }, color: '#FFFFFF' }) | ||
| 309 | } | 325 | } |
| 310 | .visibility(!this.showDownload ? Visibility.Visible : Visibility.None) | 326 | .visibility(!this.showDownload ? Visibility.Visible : Visibility.None) |
| 311 | Column(){ | 327 | Column(){ |
| @@ -369,10 +385,20 @@ export struct MultiPictureDetailPageComponent { | @@ -369,10 +385,20 @@ export struct MultiPictureDetailPageComponent { | ||
| 369 | statusBarContentColor: '#ffffff', | 385 | statusBarContentColor: '#ffffff', |
| 370 | }) | 386 | }) |
| 371 | } | 387 | } |
| 388 | + if (this.contentDetailData?.openComment) { | ||
| 389 | + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | ||
| 390 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId) | ||
| 391 | + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | ||
| 392 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType) | ||
| 393 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | ||
| 394 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | ||
| 395 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | ||
| 396 | + } | ||
| 372 | // this.contentDetailData.photoList = [] | 397 | // this.contentDetailData.photoList = [] |
| 373 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { | 398 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { |
| 374 | // 暂无内容 | 399 | // 暂无内容 |
| 375 | this.netStatus = 0 | 400 | this.netStatus = 0 |
| 401 | + this.operationButtonList = [] | ||
| 376 | Logger.info(TAG, `this.netStatus:${JSON.stringify(this.netStatus)}`) | 402 | Logger.info(TAG, `this.netStatus:${JSON.stringify(this.netStatus)}`) |
| 377 | } | 403 | } |
| 378 | Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`) | 404 | Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`) |
| @@ -387,12 +413,17 @@ export struct MultiPictureDetailPageComponent { | @@ -387,12 +413,17 @@ export struct MultiPictureDetailPageComponent { | ||
| 387 | Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); | 413 | Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); |
| 388 | // 内容获取失败 | 414 | // 内容获取失败 |
| 389 | this.netStatus = 9 | 415 | this.netStatus = 9 |
| 416 | + this.operationButtonList = [] | ||
| 390 | }) | 417 | }) |
| 391 | } catch (exception) { | 418 | } catch (exception) { |
| 392 | 419 | ||
| 393 | } | 420 | } |
| 394 | } | 421 | } |
| 395 | 422 | ||
| 423 | + getImgUrl() { | ||
| 424 | + return this.contentDetailData?.rmhInfo?.rmhHeadUrl || this.contentDetailData?.userInfo?.userHeadUrl | ||
| 425 | + } | ||
| 426 | + | ||
| 396 | // 记录浏览历史 | 427 | // 记录浏览历史 |
| 397 | private getInteractBrowsOperate() { | 428 | private getInteractBrowsOperate() { |
| 398 | try { | 429 | try { |
| @@ -7,6 +7,7 @@ import { detailedSkeleton } from './skeleton/detailSkeleton' | @@ -7,6 +7,7 @@ import { detailedSkeleton } from './skeleton/detailSkeleton' | ||
| 7 | import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; | 7 | import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; |
| 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 | 11 | ||
| 11 | const TAG: string = 'SpacialTopicPageComponent' | 12 | const TAG: string = 'SpacialTopicPageComponent' |
| 12 | 13 | ||
| @@ -21,6 +22,7 @@ export struct SpacialTopicPageComponent { | @@ -21,6 +22,7 @@ export struct SpacialTopicPageComponent { | ||
| 21 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean | 22 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean |
| 22 | private webPrepared = false; | 23 | private webPrepared = false; |
| 23 | private dataPrepared = false; | 24 | private dataPrepared = false; |
| 25 | + @State publishCommentModel: publishCommentModel = new publishCommentModel() | ||
| 24 | 26 | ||
| 25 | private trySendData2H5() { | 27 | private trySendData2H5() { |
| 26 | if (!this.webPrepared || !this.dataPrepared) { | 28 | if (!this.webPrepared || !this.dataPrepared) { |
| @@ -61,6 +63,15 @@ export struct SpacialTopicPageComponent { | @@ -61,6 +63,15 @@ export struct SpacialTopicPageComponent { | ||
| 61 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) | 63 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) |
| 62 | if (detailBeans && detailBeans.length > 0) { | 64 | if (detailBeans && detailBeans.length > 0) { |
| 63 | this.contentDetailData = detailBeans; | 65 | this.contentDetailData = detailBeans; |
| 66 | + if (this.contentDetailData[0]?.openComment) { | ||
| 67 | + this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '') | ||
| 68 | + this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId) | ||
| 69 | + this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle | ||
| 70 | + this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType) | ||
| 71 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId) | ||
| 72 | + this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle) | ||
| 73 | + this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType) | ||
| 74 | + } | ||
| 64 | this.trySendData2H5() | 75 | this.trySendData2H5() |
| 65 | } | 76 | } |
| 66 | } | 77 | } |
| @@ -80,13 +91,15 @@ export struct SpacialTopicPageComponent { | @@ -80,13 +91,15 @@ export struct SpacialTopicPageComponent { | ||
| 80 | } | 91 | } |
| 81 | .width(CommonConstants.FULL_WIDTH) | 92 | .width(CommonConstants.FULL_WIDTH) |
| 82 | .height(CommonConstants.FULL_HEIGHT) | 93 | .height(CommonConstants.FULL_HEIGHT) |
| 83 | - .padding({ bottom: 126 }) | ||
| 84 | 94 | ||
| 85 | if (!this.isPageEnd) { | 95 | if (!this.isPageEnd) { |
| 86 | detailedSkeleton() | 96 | detailedSkeleton() |
| 87 | } | 97 | } |
| 88 | //底部交互区 | 98 | //底部交互区 |
| 89 | - OperRowListView({ contentDetailData: this.contentDetailData[0] }) | 99 | + OperRowListView({ |
| 100 | + contentDetailData: this.contentDetailData[0], | ||
| 101 | + publishCommentModel: this.publishCommentModel | ||
| 102 | + }) | ||
| 90 | } | 103 | } |
| 91 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | 104 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) |
| 92 | } | 105 | } |
| @@ -110,7 +110,7 @@ export struct RMCalendar { | @@ -110,7 +110,7 @@ export struct RMCalendar { | ||
| 110 | if (this.onDateChange) { | 110 | if (this.onDateChange) { |
| 111 | this.onDateChange(item) | 111 | this.onDateChange(item) |
| 112 | if (item.fullYear && item.month) { | 112 | if (item.fullYear && item.month) { |
| 113 | - this.title = `${item.fullYear}年${item.month + 1}月` | 113 | + this.title = `${item.fullYear}年${this.getMonthStr(item.month + 1)}月` |
| 114 | } | 114 | } |
| 115 | } | 115 | } |
| 116 | } | 116 | } |
| @@ -191,18 +191,20 @@ export struct RMCalendar { | @@ -191,18 +191,20 @@ export struct RMCalendar { | ||
| 191 | */ | 191 | */ |
| 192 | private calcData() { | 192 | private calcData() { |
| 193 | 193 | ||
| 194 | - this.title = `${this.selectDay.getFullYear()}年${this.selectDay.getMonth() + 1}月` | 194 | + this.title = `${this.selectDay.getFullYear()}年${this.getMonthStr(this.selectDay.getMonth() + 1)}月` |
| 195 | this.selectDay.setDate(1) | 195 | this.selectDay.setDate(1) |
| 196 | 196 | ||
| 197 | if (this.selectDay.getFullYear() < this.startDate.getFullYear() | 197 | if (this.selectDay.getFullYear() < this.startDate.getFullYear() |
| 198 | - || (this.selectDay.getFullYear() == this.startDate.getFullYear() && this.selectDay.getMonth() <= this.startDate.getMonth())) { | 198 | + || (this.selectDay.getFullYear() == this.startDate.getFullYear() && |
| 199 | + this.selectDay.getMonth() <= this.startDate.getMonth())) { | ||
| 199 | this.hasPre = false | 200 | this.hasPre = false |
| 200 | } else { | 201 | } else { |
| 201 | this.hasPre = true | 202 | this.hasPre = true |
| 202 | } | 203 | } |
| 203 | 204 | ||
| 204 | if (this.selectDay.getFullYear() > this.endDate.getFullYear() | 205 | if (this.selectDay.getFullYear() > this.endDate.getFullYear() |
| 205 | - || (this.selectDay.getFullYear() == this.endDate.getFullYear() && this.selectDay.getMonth() >= this.endDate.getMonth())) { | 206 | + || (this.selectDay.getFullYear() == this.endDate.getFullYear() && |
| 207 | + this.selectDay.getMonth() >= this.endDate.getMonth())) { | ||
| 206 | this.hasNext = false | 208 | this.hasNext = false |
| 207 | } else { | 209 | } else { |
| 208 | this.hasNext = true | 210 | this.hasNext = true |
| @@ -274,7 +276,8 @@ export struct RMCalendar { | @@ -274,7 +276,8 @@ export struct RMCalendar { | ||
| 274 | Text(this.title) | 276 | Text(this.title) |
| 275 | .fontSize(this.titleFontSize) | 277 | .fontSize(this.titleFontSize) |
| 276 | .fontColor(this.titleFontColor) | 278 | .fontColor(this.titleFontColor) |
| 277 | - .fontWeight(this.titleFontWeight) | 279 | + .fontWeight(600) |
| 280 | + .fontFamily('PingFang SC-Semibold') | ||
| 278 | } | 281 | } |
| 279 | 282 | ||
| 280 | Blank() | 283 | Blank() |
| @@ -318,7 +321,22 @@ export struct RMCalendar { | @@ -318,7 +321,22 @@ export struct RMCalendar { | ||
| 318 | left: 35, | 321 | left: 35, |
| 319 | right: 35 | 322 | right: 35 |
| 320 | }) | 323 | }) |
| 324 | + .padding( | ||
| 325 | + { bottom: 20 }) | ||
| 321 | .border({ radius: 4 }) | 326 | .border({ radius: 4 }) |
| 322 | } | 327 | } |
| 323 | } | 328 | } |
| 329 | + | ||
| 330 | + getMonthStr(month?: number): string { | ||
| 331 | + if (!month) { | ||
| 332 | + return '' | ||
| 333 | + } | ||
| 334 | + if (month <= 0) { | ||
| 335 | + return '' | ||
| 336 | + } | ||
| 337 | + if (month <= 9) { | ||
| 338 | + return '0' + month | ||
| 339 | + } | ||
| 340 | + return month + '' | ||
| 341 | + } | ||
| 324 | } | 342 | } |
| @@ -100,7 +100,7 @@ export struct RMCalenderCell { | @@ -100,7 +100,7 @@ export struct RMCalenderCell { | ||
| 100 | .fontSize(this.itemFontSize) | 100 | .fontSize(this.itemFontSize) |
| 101 | .fontColor(this.getItemColor()) | 101 | .fontColor(this.getItemColor()) |
| 102 | .fontWeight(this.itemFontWeight) | 102 | .fontWeight(this.itemFontWeight) |
| 103 | - .fontFamily('BebasNeue_Regular') | 103 | + .fontFamily('BebasNeueBold') |
| 104 | } | 104 | } |
| 105 | } | 105 | } |
| 106 | // .justifyContent(FlexAlign.Center) | 106 | // .justifyContent(FlexAlign.Center) |
| @@ -16,12 +16,12 @@ export struct CardMediaInfo { | @@ -16,12 +16,12 @@ export struct CardMediaInfo { | ||
| 16 | 16 | ||
| 17 | build() { | 17 | build() { |
| 18 | Row() { | 18 | Row() { |
| 19 | - if (this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15') { | 19 | + if (this.contentDTO?.objectType === '1' || this.contentDTO?.objectType === '15') { |
| 20 | // 点播、动态视频 | 20 | // 点播、动态视频 |
| 21 | Row() { | 21 | Row() { |
| 22 | Image($r('app.media.card_play')) | 22 | Image($r('app.media.card_play')) |
| 23 | .mediaLogo() | 23 | .mediaLogo() |
| 24 | - if(this.contentDTO.videoInfo!=null){ | 24 | + if (this.contentDTO.videoInfo != null) { |
| 25 | Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000)) | 25 | Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000)) |
| 26 | .mediaText() | 26 | .mediaText() |
| 27 | } | 27 | } |
| @@ -30,23 +30,23 @@ export struct CardMediaInfo { | @@ -30,23 +30,23 @@ export struct CardMediaInfo { | ||
| 30 | // liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | 30 | // liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 |
| 31 | // 显示直播信息 | 31 | // 显示直播信息 |
| 32 | Row() { | 32 | Row() { |
| 33 | - if(this.contentDTO.liveInfo.liveState === 'wait') { | 33 | + if (this.contentDTO?.liveInfo?.liveState === 'wait') { |
| 34 | Image($r('app.media.card_wait')) | 34 | Image($r('app.media.card_wait')) |
| 35 | .mediaLogo() | 35 | .mediaLogo() |
| 36 | Text('预约') | 36 | Text('预约') |
| 37 | .mediaText() | 37 | .mediaText() |
| 38 | - } else if (this.contentDTO.liveInfo.liveState === 'running') { | 38 | + } else if (this.contentDTO?.liveInfo?.liveState === 'running') { |
| 39 | Image($r('app.media.card_live')) | 39 | Image($r('app.media.card_live')) |
| 40 | .mediaLogo() | 40 | .mediaLogo() |
| 41 | Text('直播中') | 41 | Text('直播中') |
| 42 | .mediaText() | 42 | .mediaText() |
| 43 | - } else if (this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo.replayUri) { | 43 | + } else if (this.contentDTO?.liveInfo?.liveState === 'end' && this.contentDTO?.liveInfo?.replayUri) { |
| 44 | Image($r('app.media.card_play')) | 44 | Image($r('app.media.card_play')) |
| 45 | .mediaLogo() | 45 | .mediaLogo() |
| 46 | Text('回看') | 46 | Text('回看') |
| 47 | .mediaText() | 47 | .mediaText() |
| 48 | - } else if(this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo | ||
| 49 | - .replayUri) { | 48 | + } else if (this.contentDTO?.liveInfo?.liveState === 'end' && this.contentDTO?.liveInfo |
| 49 | + ?.replayUri) { | ||
| 50 | // Image($r('app.media.card_live')) | 50 | // Image($r('app.media.card_live')) |
| 51 | // .mediaLogo() | 51 | // .mediaLogo() |
| 52 | Text('直播结束') | 52 | Text('直播结束') |
| @@ -69,6 +69,15 @@ export struct CardMediaInfo { | @@ -69,6 +69,15 @@ export struct CardMediaInfo { | ||
| 69 | Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000)) | 69 | Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000)) |
| 70 | .mediaText() | 70 | .mediaText() |
| 71 | } | 71 | } |
| 72 | + } else if (this.contentDTO.objectType === '4') {//广告标签 | ||
| 73 | + Text($r('app.string.comp_advertisement')) | ||
| 74 | + .fontSize('10fp') | ||
| 75 | + .fontColor($r('app.color.white')) | ||
| 76 | + .width(28) | ||
| 77 | + .height(16) | ||
| 78 | + .backgroundColor('#4D000000') | ||
| 79 | + .borderRadius(3) | ||
| 80 | + .textAlign(TextAlign.Center) | ||
| 72 | } | 81 | } |
| 73 | } | 82 | } |
| 74 | .margin(6) | 83 | .margin(6) |
| @@ -28,7 +28,7 @@ export struct CardSourceInfo { | @@ -28,7 +28,7 @@ export struct CardSourceInfo { | ||
| 28 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 28 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 29 | } | 29 | } |
| 30 | // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 | 30 | // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 |
| 31 | - if (this.contentDTO.isSearch || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime | 31 | + if (this.contentDTO.isSearch || this.contentDTO.isCollection || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime |
| 32 | (Number | 32 | (Number |
| 33 | .parseFloat(this | 33 | .parseFloat(this |
| 34 | .contentDTO.publishTime)) | 34 | .contentDTO.publishTime)) |
| @@ -30,7 +30,7 @@ export struct LiveFollowComponent { | @@ -30,7 +30,7 @@ export struct LiveFollowComponent { | ||
| 30 | Stack() { | 30 | Stack() { |
| 31 | Stack() | 31 | Stack() |
| 32 | .height(22) | 32 | .height(22) |
| 33 | - .width(130) | 33 | + .width(150) |
| 34 | .backgroundColor('#000000') | 34 | .backgroundColor('#000000') |
| 35 | .opacity(0.3) | 35 | .opacity(0.3) |
| 36 | .borderRadius({ | 36 | .borderRadius({ |
| @@ -71,7 +71,7 @@ export struct LiveFollowComponent { | @@ -71,7 +71,7 @@ export struct LiveFollowComponent { | ||
| 71 | }) | 71 | }) |
| 72 | } | 72 | } |
| 73 | .height(22) | 73 | .height(22) |
| 74 | - .width(130) | 74 | + .width(150) |
| 75 | } | 75 | } |
| 76 | } | 76 | } |
| 77 | 77 |
| @@ -31,21 +31,25 @@ export struct RmhTitle { | @@ -31,21 +31,25 @@ export struct RmhTitle { | ||
| 31 | .fontColor($r('app.color.color_222222')) | 31 | .fontColor($r('app.color.color_222222')) |
| 32 | .fontWeight(600) | 32 | .fontWeight(600) |
| 33 | .alignSelf(ItemAlign.Start) | 33 | .alignSelf(ItemAlign.Start) |
| 34 | - Row() { | ||
| 35 | - if (this.publishTime) { | ||
| 36 | - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime))) | 34 | + Flex({alignContent: FlexAlign.Start, wrap: FlexWrap.NoWrap}) { |
| 35 | + Row() { | ||
| 36 | + if (this.publishTime) { | ||
| 37 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime))) | ||
| 38 | + .fontSize($r("app.float.font_size_12")) | ||
| 39 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 40 | + Image($r('app.media.point')) | ||
| 41 | + .width(16) | ||
| 42 | + .height(16) | ||
| 43 | + } | ||
| 44 | + Text(this.rmhInfo.rmhDesc) | ||
| 37 | .fontSize($r("app.float.font_size_12")) | 45 | .fontSize($r("app.float.font_size_12")) |
| 38 | .fontColor($r("app.color.color_B0B0B0")) | 46 | .fontColor($r("app.color.color_B0B0B0")) |
| 39 | - Image($r('app.media.point')) | ||
| 40 | - .width(16) | ||
| 41 | - .height(16) | 47 | + .maxLines(1) |
| 48 | + .alignSelf(ItemAlign.Start) | ||
| 49 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 50 | + .textAlign(TextAlign.Start) | ||
| 42 | } | 51 | } |
| 43 | - Text(this.rmhInfo.rmhDesc) | ||
| 44 | - .fontSize($r("app.float.font_size_12")) | ||
| 45 | - .fontColor($r("app.color.color_B0B0B0")) | ||
| 46 | - .maxLines(1) | ||
| 47 | - .alignSelf(ItemAlign.Start) | ||
| 48 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | 52 | + .width('75%') |
| 49 | } | 53 | } |
| 50 | } | 54 | } |
| 51 | 55 |
| @@ -7,6 +7,7 @@ import { CardAdvBigImageComponent } from './CardAdvBigImageComponent'; | @@ -7,6 +7,7 @@ import { CardAdvBigImageComponent } from './CardAdvBigImageComponent'; | ||
| 7 | import { CardAdvVideoComponent } from './CardAdvVideoComponent'; | 7 | import { CardAdvVideoComponent } from './CardAdvVideoComponent'; |
| 8 | import { CardAdvGanMiComponent } from './CardAdvGanMiComponent'; | 8 | import { CardAdvGanMiComponent } from './CardAdvGanMiComponent'; |
| 9 | import { CardAdvVideoExComponent } from './CardAdvVideoExComponent'; | 9 | import { CardAdvVideoExComponent } from './CardAdvVideoExComponent'; |
| 10 | +import PageModel from '../../viewmodel/PageModel'; | ||
| 10 | 11 | ||
| 11 | /** | 12 | /** |
| 12 | * @Description: 广告稿件解析类 | 13 | * @Description: 广告稿件解析类 |
| @@ -19,28 +20,29 @@ import { CardAdvVideoExComponent } from './CardAdvVideoExComponent'; | @@ -19,28 +20,29 @@ import { CardAdvVideoExComponent } from './CardAdvVideoExComponent'; | ||
| 19 | @Component | 20 | @Component |
| 20 | export struct AdvCardParser { | 21 | export struct AdvCardParser { |
| 21 | @State compDTO: CompDTO = {} as CompDTO; | 22 | @State compDTO: CompDTO = {} as CompDTO; |
| 23 | + pageModel: PageModel = new PageModel(); | ||
| 22 | 24 | ||
| 23 | build() { | 25 | build() { |
| 24 | - this.contentBuilder(this.compDTO); | 26 | + this.contentBuilder(this.pageModel, this.compDTO); |
| 25 | } | 27 | } |
| 26 | 28 | ||
| 27 | @Builder | 29 | @Builder |
| 28 | - contentBuilder(compDTO: CompDTO) { | 30 | + contentBuilder(pageModel: PageModel, compDTO: CompDTO) { |
| 29 | if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_5) { //三图广告 | 31 | if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_5) { //三图广告 |
| 30 | - CardAdvThreeImageComponent({ compDTO }) | 32 | + CardAdvThreeImageComponent({ pageModel, compDTO }) |
| 31 | } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_6) { //小图广告 | 33 | } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_6) { //小图广告 |
| 32 | - CardAdvSmallImageComponent({ compDTO }) | 34 | + CardAdvSmallImageComponent({ pageModel, compDTO }) |
| 33 | } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_7 || | 35 | } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_7 || |
| 34 | compDTO.matInfo.advSubType === CompStyle.Card_Adv_12) { // 长通栏广告 和 顶部长通栏广告 | 36 | compDTO.matInfo.advSubType === CompStyle.Card_Adv_12) { // 长通栏广告 和 顶部长通栏广告 |
| 35 | - CardAdvLongImageComponent({ compDTO }) | 37 | + CardAdvLongImageComponent({ pageModel, compDTO }) |
| 36 | } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_8) { //大图广告 | 38 | } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_8) { //大图广告 |
| 37 | - CardAdvBigImageComponent({ compDTO }) | 39 | + CardAdvBigImageComponent({ pageModel, compDTO }) |
| 38 | } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_9) { //视频广告 | 40 | } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_9) { //视频广告 |
| 39 | - CardAdvVideoComponent({ compDTO }) | 41 | + CardAdvVideoComponent({ pageModel, compDTO }) |
| 40 | } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_10) { //展会广告 | 42 | } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_10) { //展会广告 |
| 41 | - CardAdvVideoExComponent({ compDTO }) | 43 | + CardAdvVideoExComponent({ pageModel, compDTO}) |
| 42 | } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_11) { //冠名广告 | 44 | } else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_11) { //冠名广告 |
| 43 | - CardAdvGanMiComponent({ compDTO }) | 45 | + CardAdvGanMiComponent({ pageModel, compDTO }) |
| 44 | } | 46 | } |
| 45 | } | 47 | } |
| 46 | } | 48 | } |
| 1 | -//全标题 "appStyle":"2", | ||
| 2 | -import { CompDTO, ContentDTO } from 'wdBean'; | 1 | +import { CompDTO } from 'wdBean'; |
| 3 | import { CommonConstants } from 'wdConstant/Index'; | 2 | import { CommonConstants } from 'wdConstant/Index'; |
| 4 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 5 | -import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 6 | -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 4 | +import PageModel from '../../viewmodel/PageModel'; |
| 5 | +import { CardAdvBottom } from './CardAdvBottom'; | ||
| 7 | 6 | ||
| 8 | const TAG: string = 'Card2Component'; | 7 | const TAG: string = 'Card2Component'; |
| 9 | 8 | ||
| 10 | -/** | ||
| 11 | - * @Description: 广告---大图卡 | ||
| 12 | - * @Author: | ||
| 13 | - * @Email: liyubing@wondertek.com.cn | ||
| 14 | - * @CreateDate: | ||
| 15 | - * @UpdateRemark: 更新说明 | ||
| 16 | - * @Version: 1.0 | 9 | +/** |
| 10 | + * @Description: 广告---大图卡 | ||
| 11 | + * @Author: | ||
| 12 | + * @Email: liyubing@wondertek.com.cn | ||
| 13 | + * @CreateDate: | ||
| 14 | + * @UpdateRemark: 更新说明 | ||
| 15 | + * @Version: 1.0 | ||
| 17 | */ | 16 | */ |
| 18 | @Component | 17 | @Component |
| 19 | export struct CardAdvBigImageComponent { | 18 | export struct CardAdvBigImageComponent { |
| 20 | - | ||
| 21 | @State compDTO: CompDTO = {} as CompDTO | 19 | @State compDTO: CompDTO = {} as CompDTO |
| 22 | - | 20 | + pageModel: PageModel = new PageModel(); |
| 23 | aboutToAppear(): void { | 21 | aboutToAppear(): void { |
| 24 | 22 | ||
| 25 | - console.error('ZZZXXXXX', '----大图卡----aboutToAppear-----') | ||
| 26 | } | 23 | } |
| 27 | 24 | ||
| 28 | aboutToDisappear(): void { | 25 | aboutToDisappear(): void { |
| 29 | 26 | ||
| 30 | - console.error('ZZZXXXXX', '---大图卡-----aboutToDisappear-----') | ||
| 31 | } | 27 | } |
| 32 | 28 | ||
| 33 | build() { | 29 | build() { |
| 34 | 30 | ||
| 35 | Column() { | 31 | Column() { |
| 36 | - Text(this.compDTO.matInfo.advTitle) | ||
| 37 | - .fontSize($r('app.float.font_size_17')) | ||
| 38 | - .fontColor($r('app.color.color_222222')) | ||
| 39 | - .maxLines(3) | ||
| 40 | - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | ||
| 41 | - .align(Alignment.Start) | 32 | + |
| 33 | + //新闻标题 | ||
| 34 | + Text(this.compDTO.matInfo.advTitle).bottomTextStyle().margin({ bottom: 8, }) | ||
| 35 | + //大图 | ||
| 36 | + Image(this.compDTO.matInfo.matImageUrl[0]) | ||
| 37 | + .width(CommonConstants.FULL_WIDTH) | ||
| 38 | + .aspectRatio(16 / 9) | ||
| 39 | + .borderRadius(4) | ||
| 40 | + .borderWidth(0.5) | ||
| 41 | + .borderColor($r('app.color.color_0D000000')) | ||
| 42 | + .width(CommonConstants.FULL_WIDTH) | ||
| 43 | + | ||
| 44 | + CardAdvBottom({pageModel:this.pageModel,compDTO:this.compDTO}).margin({ | ||
| 45 | + top: 8, | ||
| 46 | + }) | ||
| 42 | } | 47 | } |
| 43 | .width(CommonConstants.FULL_WIDTH) | 48 | .width(CommonConstants.FULL_WIDTH) |
| 44 | .padding({ | 49 | .padding({ |
| @@ -48,13 +53,21 @@ export struct CardAdvBigImageComponent { | @@ -48,13 +53,21 @@ export struct CardAdvBigImageComponent { | ||
| 48 | bottom: $r('app.float.card_comp_pagePadding_tb') | 53 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 49 | }) | 54 | }) |
| 50 | .onClick((event: ClickEvent) => { | 55 | .onClick((event: ClickEvent) => { |
| 51 | - //ProcessUtils.processPage(this.contentDTO) | 56 | + ProcessUtils.openAdvDetail(this.compDTO.matInfo) |
| 52 | }) | 57 | }) |
| 53 | } | 58 | } |
| 54 | } | 59 | } |
| 55 | 60 | ||
| 61 | +/* | ||
| 62 | + 标题样式 | ||
| 63 | + */ | ||
| 56 | @Extend(Text) | 64 | @Extend(Text) |
| 57 | function bottomTextStyle() { | 65 | function bottomTextStyle() { |
| 58 | - .fontSize(12) | ||
| 59 | - .fontColor('#B0B0B0') | 66 | + .fontSize('18fp') |
| 67 | + .fontColor($r('app.color.color_222222')) | ||
| 68 | + .maxLines(3) | ||
| 69 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | ||
| 70 | + .align(Alignment.Start) | ||
| 71 | + .width('100%') | ||
| 72 | + .lineHeight(25) | ||
| 60 | } | 73 | } |
| 1 | import { CompDTO } from 'wdBean/Index'; | 1 | import { CompDTO } from 'wdBean/Index'; |
| 2 | +import { Logger } from 'wdKit/Index'; | ||
| 3 | +import PageModel from '../../viewmodel/PageModel'; | ||
| 2 | 4 | ||
| 3 | /** | 5 | /** |
| 4 | - * @Description: 广告稿件 底部标签+删除按钮 | 6 | + * @Description: 广告稿件 底部标签+删除按钮 |
| 5 | * @Author: | 7 | * @Author: |
| 6 | - * @Email: liyubing@wondertek.com.cn | 8 | + * @Email: liyubing@wondertek.com.cn |
| 7 | * @CreateDate: | 9 | * @CreateDate: |
| 8 | - * @UpdateRemark: 更新说明 | ||
| 9 | - * @Version: 1.0 | 10 | + * @UpdateRemark: 更新说明 |
| 11 | + * @Version: 1.0 | ||
| 10 | */ | 12 | */ |
| 11 | @Component | 13 | @Component |
| 12 | export struct CardAdvBottom { | 14 | export struct CardAdvBottom { |
| 13 | - @State compDTO: CompDTO = {} as CompDTO; | 15 | + pageModel: PageModel = new PageModel(); |
| 16 | + @State compDTO: CompDTO = {} as CompDTO | ||
| 14 | 17 | ||
| 15 | build() { | 18 | build() { |
| 16 | 19 | ||
| @@ -36,6 +39,30 @@ export struct CardAdvBottom { | @@ -36,6 +39,30 @@ export struct CardAdvBottom { | ||
| 36 | .borderColor($r('app.color.color_EDEDED')) | 39 | .borderColor($r('app.color.color_EDEDED')) |
| 37 | .borderRadius(4) | 40 | .borderRadius(4) |
| 38 | 41 | ||
| 39 | - }.width('100%') | 42 | + }.width('100%').onClick(() => { |
| 43 | + | ||
| 44 | + this.delComp() | ||
| 45 | + }) | ||
| 46 | + } | ||
| 47 | + /** | ||
| 48 | + * 删除稿件 | ||
| 49 | + */ | ||
| 50 | + private delComp() { | ||
| 51 | + if (this.pageModel) { | ||
| 52 | + | ||
| 53 | + let a = this.compDTO; | ||
| 54 | + let currentIndex = -1 | ||
| 55 | + for (let i = 0; i < this.pageModel.compList.size(); i++) { | ||
| 56 | + let b = this.pageModel.compList.getData(i) | ||
| 57 | + if (a.compStyle === b.compStyle && a.matInfo === b.matInfo) { | ||
| 58 | + currentIndex = i | ||
| 59 | + break; | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + Logger.error("ZZZXXXXX","currentIndex====>"+currentIndex); | ||
| 63 | + if (currentIndex >= 0) { | ||
| 64 | + this.pageModel.compList.deleteItem(currentIndex) | ||
| 65 | + } | ||
| 66 | + } | ||
| 40 | } | 67 | } |
| 41 | } | 68 | } |
| 1 | //全标题 "appStyle":"2", | 1 | //全标题 "appStyle":"2", |
| 2 | import { CompDTO, ContentDTO } from 'wdBean'; | 2 | import { CompDTO, ContentDTO } from 'wdBean'; |
| 3 | +import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/AdvExtraData'; | ||
| 4 | +import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean'; | ||
| 3 | import { CommonConstants } from 'wdConstant/Index'; | 5 | import { CommonConstants } from 'wdConstant/Index'; |
| 4 | import { ProcessUtils } from 'wdRouter'; | 6 | import { ProcessUtils } from 'wdRouter'; |
| 7 | +import PageModel from '../../viewmodel/PageModel'; | ||
| 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 8 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 6 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 9 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 10 | +import { CardAdvTop } from './CardAdvTop'; | ||
| 7 | 11 | ||
| 8 | const TAG: string = 'Card2Component'; | 12 | const TAG: string = 'Card2Component'; |
| 9 | 13 | ||
| 10 | -/** | ||
| 11 | - * @Description: 广告---冠名广告 | ||
| 12 | - * @Author: | ||
| 13 | - * @Email: liyubing@wondertek.com.cn | ||
| 14 | - * @CreateDate: | ||
| 15 | - * @UpdateRemark: 更新说明 | ||
| 16 | - * @Version: 1.0 | 14 | +/** |
| 15 | + * @Description: 广告---冠名广告 | ||
| 16 | + * @Author: | ||
| 17 | + * @Email: liyubing@wondertek.com.cn | ||
| 18 | + * @CreateDate: | ||
| 19 | + * @UpdateRemark: 更新说明 | ||
| 20 | + * @Version: 1.0 | ||
| 17 | */ | 21 | */ |
| 18 | @Component | 22 | @Component |
| 19 | export struct CardAdvGanMiComponent { | 23 | export struct CardAdvGanMiComponent { |
| 20 | - | ||
| 21 | @State compDTO: CompDTO = {} as CompDTO | 24 | @State compDTO: CompDTO = {} as CompDTO |
| 25 | + @State advExtraData: AdvExtraData = {} as AdvExtraData | ||
| 26 | + @State advLength: number = 0; | ||
| 27 | + pageModel: PageModel = new PageModel(); | ||
| 22 | 28 | ||
| 23 | aboutToAppear(): void { | 29 | aboutToAppear(): void { |
| 24 | 30 | ||
| 25 | - console.error('ZZZXXXXX', '--冠名广告------aboutToAppear-----') | 31 | + let extraData = this.compDTO.matInfo.extraData |
| 32 | + let labelDTO = JSON.parse(extraData) as AdvExtraData | ||
| 33 | + this.advExtraData = labelDTO | ||
| 34 | + //this.advExtraData.item = [this.advExtraData.item[0]] | ||
| 35 | + // this.advExtraData.item[2].title ="我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国" | ||
| 36 | + this.advLength = this.advExtraData.item.length | ||
| 26 | } | 37 | } |
| 27 | 38 | ||
| 28 | aboutToDisappear(): void { | 39 | aboutToDisappear(): void { |
| 29 | 40 | ||
| 30 | - console.error('ZZZXXXXX', '--冠名广告------aboutToDisappear-----') | ||
| 31 | } | 41 | } |
| 32 | 42 | ||
| 33 | build() { | 43 | build() { |
| 34 | 44 | ||
| 35 | Column() { | 45 | Column() { |
| 36 | - Text(this.compDTO.matInfo.advTitle) | ||
| 37 | - .fontSize($r('app.float.font_size_17')) | ||
| 38 | - .fontColor($r('app.color.color_222222')) | ||
| 39 | - .maxLines(3) | ||
| 40 | - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | ||
| 41 | - .align(Alignment.Start) | 46 | + |
| 47 | + | ||
| 48 | + Row() { | ||
| 49 | + Stack() { | ||
| 50 | + //长图 | ||
| 51 | + Image(this.advExtraData.itemTopImage) | ||
| 52 | + .width(CommonConstants.FULL_WIDTH) | ||
| 53 | + .aspectRatio(343 / 40) | ||
| 54 | + .borderRadius(4) | ||
| 55 | + .borderWidth(0.5) | ||
| 56 | + .borderColor($r('app.color.color_0D000000')) | ||
| 57 | + | ||
| 58 | + // 广告标签和删除功能 | ||
| 59 | + CardAdvTop({ pageModel: this.pageModel, compDTO: this.compDTO }) | ||
| 60 | + } | ||
| 61 | + .alignContent(Alignment.Top) | ||
| 62 | + .width(CommonConstants.FULL_WIDTH) | ||
| 63 | + }.width('100%').padding({ | ||
| 64 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 65 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 66 | + }) | ||
| 67 | + | ||
| 68 | + | ||
| 69 | + // | ||
| 70 | + List({ space: 8 }) { | ||
| 71 | + | ||
| 72 | + ForEach(this.advExtraData.item, (content: AdvExtraItemData, index: number) => { | ||
| 73 | + | ||
| 74 | + ListItem() { | ||
| 75 | + // 广告列表信息 | ||
| 76 | + Column() { | ||
| 77 | + | ||
| 78 | + Image(content.image) | ||
| 79 | + .width('100%') | ||
| 80 | + .aspectRatio(150 / 84) | ||
| 81 | + .borderWidth(0.5) | ||
| 82 | + .borderColor($r('app.color.color_0D000000')) | ||
| 83 | + .borderRadius(4) | ||
| 84 | + | ||
| 85 | + Text(content.title) | ||
| 86 | + .fontSize('16fp') | ||
| 87 | + .fontColor($r('app.color.color_222222')) | ||
| 88 | + .fontSize('15fp') | ||
| 89 | + .maxLines(3) | ||
| 90 | + .lineHeight(20) | ||
| 91 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 92 | + .width('100%') | ||
| 93 | + .margin({ top: 8 }) | ||
| 94 | + | ||
| 95 | + } | ||
| 96 | + .width(this.advLength >= 3 ? 150 : this.advLength == 2 ? 210 : '100%') | ||
| 97 | + .margin({ left: index === 0 ? this.advLength == 1 ? 0 : 16 : 0 }) | ||
| 98 | + .onClick(() => { | ||
| 99 | + | ||
| 100 | + let matInfo: CompAdvMatInfoBean = { | ||
| 101 | + linkUrl: content.linkUrl, | ||
| 102 | + linkType: content.linkType | ||
| 103 | + } as CompAdvMatInfoBean; | ||
| 104 | + ProcessUtils.openAdvDetail(matInfo) | ||
| 105 | + | ||
| 106 | + }) | ||
| 107 | + | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + }) | ||
| 111 | + | ||
| 112 | + } | ||
| 113 | + .width('100%') | ||
| 114 | + .listDirection(Axis.Horizontal) | ||
| 115 | + .edgeEffect(EdgeEffect.None) | ||
| 116 | + .scrollBar(BarState.Off) | ||
| 117 | + // .contentStartOffset(this.advLength == 1 ? 0 : 16) | ||
| 118 | + .contentEndOffset(this.advLength == 1 ? 0 : 16) | ||
| 119 | + .margin({ top: 10, bottom: 10 }) | ||
| 120 | + .padding({ | ||
| 121 | + left: this.advLength == 1 ? 16 : 0, | ||
| 122 | + right: this.advLength == 1 ? 16 : 0, | ||
| 123 | + }) | ||
| 124 | + | ||
| 125 | + // 更多按钮 | ||
| 126 | + commonButton(this.advExtraData) | ||
| 127 | + | ||
| 42 | } | 128 | } |
| 43 | .width(CommonConstants.FULL_WIDTH) | 129 | .width(CommonConstants.FULL_WIDTH) |
| 44 | .padding({ | 130 | .padding({ |
| 45 | - left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 46 | - right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 47 | top: $r('app.float.card_comp_pagePadding_tb'), | 131 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 48 | bottom: $r('app.float.card_comp_pagePadding_tb') | 132 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 49 | }) | 133 | }) |
| 50 | - .onClick((event: ClickEvent) => { | ||
| 51 | - //ProcessUtils.processPage(this.contentDTO) | ||
| 52 | - }) | 134 | + |
| 53 | } | 135 | } |
| 54 | } | 136 | } |
| 55 | 137 | ||
| 56 | -@Extend(Text) | ||
| 57 | -function bottomTextStyle() { | ||
| 58 | - .fontSize(12) | ||
| 59 | - .fontColor('#B0B0B0') | 138 | +/* |
| 139 | + 标题样式 | ||
| 140 | + */ | ||
| 141 | +@Builder | ||
| 142 | +function commonButton(advExtraData: AdvExtraData) { | ||
| 143 | + | ||
| 144 | + | ||
| 145 | + Row() { | ||
| 146 | + Row() { | ||
| 147 | + Blank() | ||
| 148 | + Text('查看更多').fontColor('#222222').fontSize('14fp') | ||
| 149 | + Image($r('app.media.icon_comp_more_right_red')).width(16).height(16) | ||
| 150 | + Blank() | ||
| 151 | + | ||
| 152 | + } | ||
| 153 | + .width('100%') | ||
| 154 | + .backgroundColor('#F5F5F5') | ||
| 155 | + .borderRadius(3) | ||
| 156 | + .padding({ top: 10, bottom: 10, }) | ||
| 157 | + .onClick(() => { | ||
| 158 | + let matInfo: CompAdvMatInfoBean = { | ||
| 159 | + linkUrl: advExtraData.itemMore.linkUrl, | ||
| 160 | + linkType: advExtraData.itemMore.linkType | ||
| 161 | + } as CompAdvMatInfoBean; | ||
| 162 | + ProcessUtils.openAdvDetail(matInfo) | ||
| 163 | + }) | ||
| 164 | + }.width('100%').padding({ | ||
| 165 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 166 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 167 | + | ||
| 168 | + }) | ||
| 169 | + | ||
| 60 | } | 170 | } |
sight_harmony/features/wdComponent/src/main/ets/components/cardViewAdv/CardAdvLongImageComponent.ets
| 1 | //全标题 "appStyle":"2", | 1 | //全标题 "appStyle":"2", |
| 2 | -import { CompDTO, ContentDTO } from 'wdBean'; | ||
| 3 | -import { CommonConstants } from 'wdConstant/Index'; | 2 | +import { CompDTO } from 'wdBean'; |
| 3 | +import { CommonConstants, CompStyle } from 'wdConstant/Index'; | ||
| 4 | import { ProcessUtils } from 'wdRouter'; | 4 | import { ProcessUtils } from 'wdRouter'; |
| 5 | -import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 6 | -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 5 | +import PageModel from '../../viewmodel/PageModel'; |
| 6 | +import { CardAdvBottom } from './CardAdvBottom'; | ||
| 7 | 7 | ||
| 8 | const TAG: string = 'Card2Component'; | 8 | const TAG: string = 'Card2Component'; |
| 9 | 9 | ||
| 10 | -/** | ||
| 11 | - * @Description: 广告---长通栏广告 和 顶部长通栏广告 | ||
| 12 | - * @Author: | ||
| 13 | - * @Email: liyubing@wondertek.com.cn | ||
| 14 | - * @CreateDate: | ||
| 15 | - * @UpdateRemark: 更新说明 | ||
| 16 | - * @Version: 1.0 | 10 | +/** |
| 11 | + * @Description: 广告---长通栏广告 和 顶部长通栏广告 | ||
| 12 | + * @Author: | ||
| 13 | + * @Email: liyubing@wondertek.com.cn | ||
| 14 | + * @CreateDate: | ||
| 15 | + * @UpdateRemark: 更新说明 | ||
| 16 | + * @Version: 1.0 | ||
| 17 | */ | 17 | */ |
| 18 | @Component | 18 | @Component |
| 19 | export struct CardAdvLongImageComponent { | 19 | export struct CardAdvLongImageComponent { |
| 20 | - | ||
| 21 | @State compDTO: CompDTO = {} as CompDTO | 20 | @State compDTO: CompDTO = {} as CompDTO |
| 21 | + @State haveTitle: boolean = true | ||
| 22 | + pageModel: PageModel = new PageModel(); | ||
| 22 | 23 | ||
| 23 | aboutToAppear(): void { | 24 | aboutToAppear(): void { |
| 24 | - | ||
| 25 | - console.error('ZZZXXXXX', '--长通栏广告 和 顶部长通栏广告------aboutToAppear-----') | 25 | + this.haveTitle = this.compDTO.matInfo.advSubType === CompStyle.Card_Adv_7; |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | aboutToDisappear(): void { | 28 | aboutToDisappear(): void { |
| 29 | 29 | ||
| 30 | - console.error('ZZZXXXXX', '--长通栏广告 和 顶部长通栏广告------aboutToDisappear-----') | ||
| 31 | } | 30 | } |
| 32 | 31 | ||
| 33 | build() { | 32 | build() { |
| 34 | 33 | ||
| 35 | Column() { | 34 | Column() { |
| 36 | - Text(this.compDTO.matInfo.advTitle) | ||
| 37 | - .fontSize($r('app.float.font_size_17')) | ||
| 38 | - .fontColor($r('app.color.color_222222')) | ||
| 39 | - .maxLines(3) | ||
| 40 | - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | ||
| 41 | - .align(Alignment.Start) | 35 | + //新闻标题 |
| 36 | + if (this.haveTitle) { | ||
| 37 | + Text(this.compDTO.matInfo.advTitle).width('100%').bottomTextStyle().margin({ bottom: 8, }) | ||
| 38 | + } | ||
| 39 | + //长图 | ||
| 40 | + Image(this.compDTO.matInfo.matImageUrl[0]) | ||
| 41 | + .width(CommonConstants.FULL_WIDTH) | ||
| 42 | + .aspectRatio(343 / 96) | ||
| 43 | + .borderRadius(4) | ||
| 44 | + .borderWidth(0.5) | ||
| 45 | + .borderColor($r('app.color.color_0D000000')) | ||
| 46 | + | ||
| 47 | + CardAdvBottom({ pageModel: this.pageModel, compDTO:this.compDTO }).margin({ | ||
| 48 | + top: 8, | ||
| 49 | + }) | ||
| 42 | } | 50 | } |
| 43 | .width(CommonConstants.FULL_WIDTH) | 51 | .width(CommonConstants.FULL_WIDTH) |
| 44 | .padding({ | 52 | .padding({ |
| @@ -48,13 +56,20 @@ export struct CardAdvLongImageComponent { | @@ -48,13 +56,20 @@ export struct CardAdvLongImageComponent { | ||
| 48 | bottom: $r('app.float.card_comp_pagePadding_tb') | 56 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 49 | }) | 57 | }) |
| 50 | .onClick((event: ClickEvent) => { | 58 | .onClick((event: ClickEvent) => { |
| 51 | - //ProcessUtils.processPage(this.contentDTO) | 59 | + ProcessUtils.openAdvDetail(this.compDTO.matInfo) |
| 52 | }) | 60 | }) |
| 53 | } | 61 | } |
| 54 | } | 62 | } |
| 55 | 63 | ||
| 64 | +/* | ||
| 65 | + 标题样式 | ||
| 66 | + */ | ||
| 56 | @Extend(Text) | 67 | @Extend(Text) |
| 57 | function bottomTextStyle() { | 68 | function bottomTextStyle() { |
| 58 | - .fontSize(12) | ||
| 59 | - .fontColor('#B0B0B0') | 69 | + .fontSize('18fp') |
| 70 | + .fontColor($r('app.color.color_222222')) | ||
| 71 | + .maxLines(3) | ||
| 72 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | ||
| 73 | + .align(Alignment.Start) | ||
| 74 | + .lineHeight(25) | ||
| 60 | } | 75 | } |
| @@ -5,6 +5,7 @@ import { ProcessUtils } from 'wdRouter'; | @@ -5,6 +5,7 @@ import { ProcessUtils } from 'wdRouter'; | ||
| 5 | import measure from '@ohos.measure'; | 5 | import measure from '@ohos.measure'; |
| 6 | import { DisplayUtils } from 'wdKit/Index'; | 6 | import { DisplayUtils } from 'wdKit/Index'; |
| 7 | import { CardAdvBottom } from './CardAdvBottom'; | 7 | import { CardAdvBottom } from './CardAdvBottom'; |
| 8 | +import PageModel from '../../viewmodel/PageModel'; | ||
| 8 | 9 | ||
| 9 | const TAG: string = 'CardAdvSmallImageComponent'; | 10 | const TAG: string = 'CardAdvSmallImageComponent'; |
| 10 | 11 | ||
| @@ -20,10 +21,9 @@ const TAG: string = 'CardAdvSmallImageComponent'; | @@ -20,10 +21,9 @@ const TAG: string = 'CardAdvSmallImageComponent'; | ||
| 20 | export struct CardAdvSmallImageComponent { | 21 | export struct CardAdvSmallImageComponent { |
| 21 | @State compDTO: CompDTO = {} as CompDTO | 22 | @State compDTO: CompDTO = {} as CompDTO |
| 22 | @State isBigThreeLine: boolean = false // 标题的行数大于等于3行 是true | 23 | @State isBigThreeLine: boolean = false // 标题的行数大于等于3行 是true |
| 23 | - | 24 | + pageModel: PageModel = new PageModel(); |
| 24 | aboutToAppear(): void { | 25 | aboutToAppear(): void { |
| 25 | 26 | ||
| 26 | - console.error('ZZZXXXXX', '----小图卡----aboutToAppear-----') | ||
| 27 | // 计算标题文本行数 | 27 | // 计算标题文本行数 |
| 28 | let screenWith = DisplayUtils.getDeviceWidth(); | 28 | let screenWith = DisplayUtils.getDeviceWidth(); |
| 29 | screenWith = screenWith * 0.62 | 29 | screenWith = screenWith * 0.62 |
| @@ -33,7 +33,6 @@ export struct CardAdvSmallImageComponent { | @@ -33,7 +33,6 @@ export struct CardAdvSmallImageComponent { | ||
| 33 | 33 | ||
| 34 | aboutToDisappear(): void { | 34 | aboutToDisappear(): void { |
| 35 | 35 | ||
| 36 | - console.error('ZZZXXXXX', '---小图卡-----aboutToDisappear-----') | ||
| 37 | } | 36 | } |
| 38 | 37 | ||
| 39 | build() { | 38 | build() { |
| @@ -62,6 +61,7 @@ export struct CardAdvSmallImageComponent { | @@ -62,6 +61,7 @@ export struct CardAdvSmallImageComponent { | ||
| 62 | .borderWidth(0.5) | 61 | .borderWidth(0.5) |
| 63 | .borderColor($r('app.color.color_0D000000')) | 62 | .borderColor($r('app.color.color_0D000000')) |
| 64 | .borderRadius(4) | 63 | .borderRadius(4) |
| 64 | + //.alt('wwww.baidu.com') | ||
| 65 | .alignRules({ | 65 | .alignRules({ |
| 66 | top: { anchor: 'title_name', align: VerticalAlign.Top }, | 66 | top: { anchor: 'title_name', align: VerticalAlign.Top }, |
| 67 | left: { anchor: 'title_name', align: HorizontalAlign.End }, | 67 | left: { anchor: 'title_name', align: HorizontalAlign.End }, |
| @@ -69,7 +69,7 @@ export struct CardAdvSmallImageComponent { | @@ -69,7 +69,7 @@ export struct CardAdvSmallImageComponent { | ||
| 69 | .margin({ left: 12 }) | 69 | .margin({ left: 12 }) |
| 70 | 70 | ||
| 71 | 71 | ||
| 72 | - CardAdvBottom().width('62%').id('bottom_adv').alignRules({ | 72 | + CardAdvBottom({pageModel:this.pageModel,compDTO:this.compDTO}).width('62%').id('bottom_adv').alignRules({ |
| 73 | bottom: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: VerticalAlign.Bottom }, | 73 | bottom: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: VerticalAlign.Bottom }, |
| 74 | right: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: HorizontalAlign.Start }, | 74 | right: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: HorizontalAlign.Start }, |
| 75 | top: { anchor: this.isBigThreeLine ? 'title_name' : '', align: VerticalAlign.Bottom }, | 75 | top: { anchor: this.isBigThreeLine ? 'title_name' : '', align: VerticalAlign.Bottom }, |
| @@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
| 2 | import { CompDTO, 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 PageModel from '../../viewmodel/PageModel'; | ||
| 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 6 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 6 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 7 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 7 | import { CardAdvBottom } from './CardAdvBottom'; | 8 | import { CardAdvBottom } from './CardAdvBottom'; |
| @@ -19,15 +20,13 @@ const TAG: string = 'Card2Component'; | @@ -19,15 +20,13 @@ const TAG: string = 'Card2Component'; | ||
| 19 | @Component | 20 | @Component |
| 20 | export struct CardAdvThreeImageComponent { | 21 | export struct CardAdvThreeImageComponent { |
| 21 | @State compDTO: CompDTO = {} as CompDTO | 22 | @State compDTO: CompDTO = {} as CompDTO |
| 22 | - | 23 | + pageModel: PageModel = new PageModel(); |
| 23 | aboutToAppear(): void { | 24 | aboutToAppear(): void { |
| 24 | 25 | ||
| 25 | - console.error('ZZZXXXXX', '---三图卡-----aboutToAppear-----') | ||
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | aboutToDisappear(): void { | 28 | aboutToDisappear(): void { |
| 29 | 29 | ||
| 30 | - console.error('ZZZXXXXX', '----三图卡----aboutToDisappear-----') | ||
| 31 | } | 30 | } |
| 32 | 31 | ||
| 33 | build() { | 32 | build() { |
| @@ -65,7 +64,7 @@ export struct CardAdvThreeImageComponent { | @@ -65,7 +64,7 @@ export struct CardAdvThreeImageComponent { | ||
| 65 | .margin({ top: 8 }) | 64 | .margin({ top: 8 }) |
| 66 | 65 | ||
| 67 | // 广告工具组件 | 66 | // 广告工具组件 |
| 68 | - CardAdvBottom().width('100%').margin({ top: 8 }) | 67 | + CardAdvBottom({pageModel:this.pageModel,compDTO:this.compDTO}).width('100%').margin({ top: 8 }) |
| 69 | } | 68 | } |
| 70 | .width('100%') | 69 | .width('100%') |
| 71 | .justifyContent(FlexAlign.Start) | 70 | .justifyContent(FlexAlign.Start) |
| 1 | +import { CompDTO } from 'wdBean/Index'; | ||
| 2 | +import { Logger } from 'wdKit/Index'; | ||
| 3 | +import PageModel from '../../viewmodel/PageModel'; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * @Description: 广告稿件 顶部标签+删除按钮 | ||
| 7 | + * @Author: | ||
| 8 | + * @Email: liyubing@wondertek.com.cn | ||
| 9 | + * @CreateDate: | ||
| 10 | + * @UpdateRemark: 更新说明 | ||
| 11 | + * @Version: 1.0 | ||
| 12 | + */ | ||
| 13 | +@Component | ||
| 14 | +export struct CardAdvTop { | ||
| 15 | + pageModel: PageModel = new PageModel(); | ||
| 16 | + compDTO: CompDTO = {} as CompDTO | ||
| 17 | + | ||
| 18 | + build() { | ||
| 19 | + | ||
| 20 | + Row() { | ||
| 21 | + Text($r('app.string.comp_advertisement')) | ||
| 22 | + .fontSize('10fp') | ||
| 23 | + .fontColor($r('app.color.white')) | ||
| 24 | + .width(28) | ||
| 25 | + .height(16) | ||
| 26 | + .backgroundColor('#4D000000') | ||
| 27 | + .borderRadius(4) | ||
| 28 | + .textAlign(TextAlign.Center) | ||
| 29 | + | ||
| 30 | + Blank() | ||
| 31 | + | ||
| 32 | + Stack() { | ||
| 33 | + Image($r('app.media.comp_adv_close_white')) | ||
| 34 | + .width(9) | ||
| 35 | + .height(9) | ||
| 36 | + .borderRadius({ | ||
| 37 | + topLeft: '4vp', | ||
| 38 | + topRight: '4vp', | ||
| 39 | + bottomLeft: '4vp', | ||
| 40 | + bottomRight: '4vp' | ||
| 41 | + }) | ||
| 42 | + } | ||
| 43 | + .width(18) | ||
| 44 | + .height(14) | ||
| 45 | + .backgroundColor('#4D000000') | ||
| 46 | + .borderWidth(0.5) | ||
| 47 | + .borderColor($r('app.color.white')) | ||
| 48 | + .borderRadius(4) | ||
| 49 | + | ||
| 50 | + }.width('100%').padding({ | ||
| 51 | + top: 8, | ||
| 52 | + left: 8, | ||
| 53 | + right: 8 | ||
| 54 | + }).onClick(() => { | ||
| 55 | + this.delComp() | ||
| 56 | + }) | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * 删除稿件 | ||
| 61 | + */ | ||
| 62 | + private delComp() { | ||
| 63 | + if (this.pageModel) { | ||
| 64 | + | ||
| 65 | + let a = this.compDTO; | ||
| 66 | + let currentIndex = -1 | ||
| 67 | + for (let i = 0; i < this.pageModel.compList.size(); i++) { | ||
| 68 | + let b = this.pageModel.compList.getData(i) | ||
| 69 | + if (a.compStyle === b.compStyle && a.matInfo === b.matInfo) { | ||
| 70 | + currentIndex = i | ||
| 71 | + break; | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + Logger.error("ZZZXXXXX","currentIndex====>"+currentIndex); | ||
| 76 | + if (currentIndex >= 0) { | ||
| 77 | + this.pageModel.compList.deleteItem(currentIndex) | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | +} |
| 1 | //全标题 "appStyle":"2", | 1 | //全标题 "appStyle":"2", |
| 2 | -import { CompDTO, ContentDTO } from 'wdBean'; | 2 | +import { CompDTO, ContentDTO, VideoInfoDTO } 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 { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 6 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 6 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 7 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 8 | +import { CardAdvBottom } from './CardAdvBottom'; | ||
| 7 | 9 | ||
| 8 | const TAG: string = 'Card2Component'; | 10 | const TAG: string = 'Card2Component'; |
| 9 | 11 | ||
| 10 | -/** | ||
| 11 | - * @Description: 广告---视频广告 | ||
| 12 | - * @Author: | ||
| 13 | - * @Email: liyubing@wondertek.com.cn | ||
| 14 | - * @CreateDate: | ||
| 15 | - * @UpdateRemark: 更新说明 | ||
| 16 | - * @Version: 1.0 | 12 | +/** |
| 13 | + * @Description: 广告---视频广告 | ||
| 14 | + * @Author: | ||
| 15 | + * @Email: liyubing@wondertek.com.cn | ||
| 16 | + * @CreateDate: | ||
| 17 | + * @UpdateRemark: 更新说明 | ||
| 18 | + * @Version: 1.0 | ||
| 17 | */ | 19 | */ |
| 18 | @Component | 20 | @Component |
| 19 | export struct CardAdvVideoComponent { | 21 | export struct CardAdvVideoComponent { |
| 20 | - | ||
| 21 | @State compDTO: CompDTO = {} as CompDTO | 22 | @State compDTO: CompDTO = {} as CompDTO |
| 22 | - | 23 | + @State contentDTO: ContentDTO = {} as ContentDTO |
| 24 | + pageModel: PageModel = new PageModel(); | ||
| 23 | aboutToAppear(): void { | 25 | aboutToAppear(): void { |
| 24 | 26 | ||
| 25 | - console.error('ZZZXXXXX', '--视频广告------aboutToAppear-----') | 27 | + // this.contentDTO.objectType = '1' |
| 28 | + // this.contentDTO.videoInfo = { videoDuration: 1000 } as VideoInfoDTO | ||
| 26 | } | 29 | } |
| 27 | 30 | ||
| 28 | aboutToDisappear(): void { | 31 | aboutToDisappear(): void { |
| 29 | 32 | ||
| 30 | - console.error('ZZZXXXXX', '---视频广告-----aboutToDisappear-----') | ||
| 31 | } | 33 | } |
| 32 | 34 | ||
| 33 | build() { | 35 | build() { |
| 34 | 36 | ||
| 35 | Column() { | 37 | Column() { |
| 36 | - Text(this.compDTO.matInfo.advTitle) | ||
| 37 | - .fontSize($r('app.float.font_size_17')) | ||
| 38 | - .fontColor($r('app.color.color_222222')) | ||
| 39 | - .maxLines(3) | ||
| 40 | - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | ||
| 41 | - .align(Alignment.Start) | 38 | + |
| 39 | + //新闻标题 | ||
| 40 | + Text(this.compDTO.matInfo.advTitle).bottomTextStyle() | ||
| 41 | + //大图 | ||
| 42 | + Stack() { | ||
| 43 | + Image(this.compDTO.matInfo.matImageUrl[0]) | ||
| 44 | + .width(CommonConstants.FULL_WIDTH) | ||
| 45 | + .aspectRatio(16 / 9) | ||
| 46 | + .borderRadius(4) | ||
| 47 | + .borderWidth(0.5) | ||
| 48 | + .borderColor($r('app.color.color_0D000000')) | ||
| 49 | + //播放状态+时长 | ||
| 50 | + CardMediaInfo({ | ||
| 51 | + contentDTO: this.contentDTO | ||
| 52 | + }) | ||
| 53 | + } | ||
| 54 | + .alignContent(Alignment.BottomEnd) | ||
| 55 | + .width(CommonConstants.FULL_WIDTH) | ||
| 56 | + .margin({ top: 8 }) | ||
| 57 | + | ||
| 58 | + CardAdvBottom({pageModel:this.pageModel,compDTO:this.compDTO}).margin({ | ||
| 59 | + top: 8, | ||
| 60 | + }) | ||
| 42 | } | 61 | } |
| 43 | .width(CommonConstants.FULL_WIDTH) | 62 | .width(CommonConstants.FULL_WIDTH) |
| 44 | .padding({ | 63 | .padding({ |
| @@ -48,13 +67,21 @@ export struct CardAdvVideoComponent { | @@ -48,13 +67,21 @@ export struct CardAdvVideoComponent { | ||
| 48 | bottom: $r('app.float.card_comp_pagePadding_tb') | 67 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 49 | }) | 68 | }) |
| 50 | .onClick((event: ClickEvent) => { | 69 | .onClick((event: ClickEvent) => { |
| 51 | - //ProcessUtils.processPage(this.contentDTO) | 70 | + ProcessUtils.openAdvDetail(this.compDTO.matInfo) |
| 52 | }) | 71 | }) |
| 53 | } | 72 | } |
| 54 | } | 73 | } |
| 55 | 74 | ||
| 75 | +/* | ||
| 76 | + 标题样式 | ||
| 77 | + */ | ||
| 56 | @Extend(Text) | 78 | @Extend(Text) |
| 57 | function bottomTextStyle() { | 79 | function bottomTextStyle() { |
| 58 | - .fontSize(12) | ||
| 59 | - .fontColor('#B0B0B0') | 80 | + .fontSize('18fp') |
| 81 | + .fontColor($r('app.color.color_222222')) | ||
| 82 | + .maxLines(3) | ||
| 83 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | ||
| 84 | + .align(Alignment.Start) | ||
| 85 | + .width('100%') | ||
| 86 | + .lineHeight(25) | ||
| 60 | } | 87 | } |
| 1 | -//全标题 "appStyle":"2", | ||
| 2 | -import { CompDTO, ContentDTO } from 'wdBean'; | 1 | +import { CompDTO } from 'wdBean'; |
| 2 | +import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/AdvExtraData'; | ||
| 3 | +import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean'; | ||
| 3 | import { CommonConstants } from 'wdConstant/Index'; | 4 | import { CommonConstants } from 'wdConstant/Index'; |
| 4 | import { ProcessUtils } from 'wdRouter'; | 5 | import { ProcessUtils } from 'wdRouter'; |
| 5 | -import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 6 | -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 6 | +import PageModel from '../../viewmodel/PageModel'; |
| 7 | +import { CardAdvTop } from './CardAdvTop'; | ||
| 7 | 8 | ||
| 8 | const TAG: string = 'Card2Component'; | 9 | const TAG: string = 'Card2Component'; |
| 9 | 10 | ||
| 10 | -/** | ||
| 11 | - * @Description: 广告---冠名广告 | ||
| 12 | - * @Author: | ||
| 13 | - * @Email: liyubing@wondertek.com.cn | ||
| 14 | - * @CreateDate: | ||
| 15 | - * @UpdateRemark: 更新说明 | ||
| 16 | - * @Version: 1.0 | 11 | +/** |
| 12 | + * @Description: 广告---展会广告 | ||
| 13 | + * @Author: | ||
| 14 | + * @Email: liyubing@wondertek.com.cn | ||
| 15 | + * @CreateDate: | ||
| 16 | + * @UpdateRemark: 更新说明 | ||
| 17 | + * @Version: 1.0 | ||
| 17 | */ | 18 | */ |
| 18 | @Component | 19 | @Component |
| 19 | export struct CardAdvVideoExComponent { | 20 | export struct CardAdvVideoExComponent { |
| 20 | - | ||
| 21 | @State compDTO: CompDTO = {} as CompDTO | 21 | @State compDTO: CompDTO = {} as CompDTO |
| 22 | + @State advExtraData: AdvExtraData = {} as AdvExtraData | ||
| 23 | + pageModel: PageModel = new PageModel(); | ||
| 22 | 24 | ||
| 23 | aboutToAppear(): void { | 25 | aboutToAppear(): void { |
| 24 | 26 | ||
| 25 | - console.error('ZZZXXXXX', '--冠名广告------aboutToAppear-----') | 27 | + |
| 28 | + let extraData = this.compDTO.matInfo.extraData | ||
| 29 | + let labelDTO = JSON.parse(extraData) as AdvExtraData | ||
| 30 | + this.advExtraData = labelDTO | ||
| 26 | } | 31 | } |
| 27 | 32 | ||
| 28 | aboutToDisappear(): void { | 33 | aboutToDisappear(): void { |
| 29 | 34 | ||
| 30 | - console.error('ZZZXXXXX', '----冠名广告----aboutToDisappear-----') | ||
| 31 | } | 35 | } |
| 32 | 36 | ||
| 33 | build() { | 37 | build() { |
| 34 | 38 | ||
| 35 | Column() { | 39 | Column() { |
| 36 | - Text(this.compDTO.matInfo.advTitle) | ||
| 37 | - .fontSize($r('app.float.font_size_17')) | ||
| 38 | - .fontColor($r('app.color.color_222222')) | ||
| 39 | - .maxLines(3) | ||
| 40 | - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | ||
| 41 | - .align(Alignment.Start) | 40 | + |
| 41 | + Stack() { | ||
| 42 | + //长图 | ||
| 43 | + Image(this.advExtraData.itemTopImage) | ||
| 44 | + .width(CommonConstants.FULL_WIDTH) | ||
| 45 | + .aspectRatio(343 / 80) | ||
| 46 | + .borderRadius(4) | ||
| 47 | + .borderWidth(0.5) | ||
| 48 | + .borderColor($r('app.color.color_0D000000')) | ||
| 49 | + | ||
| 50 | + | ||
| 51 | + CardAdvTop({ pageModel: this.pageModel, compDTO: this.compDTO }) | ||
| 52 | + } | ||
| 53 | + .alignContent(Alignment.Top) | ||
| 54 | + .width(CommonConstants.FULL_WIDTH) | ||
| 55 | + | ||
| 56 | + // | ||
| 57 | + List({ space: 10 }) { | ||
| 58 | + | ||
| 59 | + ForEach(this.advExtraData.item, (content: AdvExtraItemData) => { | ||
| 60 | + | ||
| 61 | + ListItem() { | ||
| 62 | + | ||
| 63 | + Text(content.title).fontSize('16fp').fontColor($r('app.color.color_222222')).width('100%').onClick(() => { | ||
| 64 | + let matInfo: CompAdvMatInfoBean = { | ||
| 65 | + linkUrl: content.linkUrl, | ||
| 66 | + linkType: content.linkType | ||
| 67 | + } as CompAdvMatInfoBean; | ||
| 68 | + ProcessUtils.openAdvDetail(matInfo) | ||
| 69 | + }) | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + }) | ||
| 73 | + | ||
| 74 | + }.width('100%').listDirection(Axis.Vertical).margin({ top: 10, bottom: 10 }) | ||
| 75 | + | ||
| 76 | + // 更多按钮 | ||
| 77 | + commonButton(this.advExtraData) | ||
| 78 | + | ||
| 42 | } | 79 | } |
| 43 | .width(CommonConstants.FULL_WIDTH) | 80 | .width(CommonConstants.FULL_WIDTH) |
| 44 | .padding({ | 81 | .padding({ |
| @@ -47,14 +84,33 @@ export struct CardAdvVideoExComponent { | @@ -47,14 +84,33 @@ export struct CardAdvVideoExComponent { | ||
| 47 | top: $r('app.float.card_comp_pagePadding_tb'), | 84 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 48 | bottom: $r('app.float.card_comp_pagePadding_tb') | 85 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 49 | }) | 86 | }) |
| 50 | - .onClick((event: ClickEvent) => { | ||
| 51 | - //ProcessUtils.processPage(this.contentDTO) | ||
| 52 | - }) | 87 | + |
| 53 | } | 88 | } |
| 54 | } | 89 | } |
| 55 | 90 | ||
| 56 | -@Extend(Text) | ||
| 57 | -function bottomTextStyle() { | ||
| 58 | - .fontSize(12) | ||
| 59 | - .fontColor('#B0B0B0') | 91 | +/* |
| 92 | + 标题样式 | ||
| 93 | + */ | ||
| 94 | +@Builder | ||
| 95 | +function commonButton(advExtraData: AdvExtraData) { | ||
| 96 | + | ||
| 97 | + | ||
| 98 | + Row() { | ||
| 99 | + Blank() | ||
| 100 | + Text('查看更多').fontColor('#222222').fontSize('14fp') | ||
| 101 | + Image($r('app.media.icon_comp_more_right_red')).width(16).height(16) | ||
| 102 | + Blank() | ||
| 103 | + | ||
| 104 | + } | ||
| 105 | + .width('100%') | ||
| 106 | + .backgroundColor('#F5F5F5') | ||
| 107 | + .borderRadius(3) | ||
| 108 | + .padding({ top: 10, bottom: 10, }) | ||
| 109 | + .onClick(() => { | ||
| 110 | + let matInfo: CompAdvMatInfoBean = { | ||
| 111 | + linkUrl: advExtraData.itemMore.linkUrl, | ||
| 112 | + linkType: advExtraData.itemMore.linkType | ||
| 113 | + } as CompAdvMatInfoBean; | ||
| 114 | + ProcessUtils.openAdvDetail(matInfo) | ||
| 115 | + }) | ||
| 60 | } | 116 | } |
| 1 | import { ContentDTO, slideShows } from 'wdBean'; | 1 | import { ContentDTO, slideShows } from 'wdBean'; |
| 2 | -import { CommonConstants } from 'wdConstant' | ||
| 3 | -import { DateTimeUtils } from 'wdKit'; | 2 | +import { CommonConstants } from 'wdConstant'; |
| 4 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 5 | -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | ||
| 6 | -import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 4 | +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; |
| 5 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; | ||
| 7 | 6 | ||
| 8 | /** | 7 | /** |
| 9 | * 大专题卡--CompStyle: 10 | 8 | * 大专题卡--CompStyle: 10 |
| @@ -110,12 +109,23 @@ export struct Card10Component { | @@ -110,12 +109,23 @@ export struct Card10Component { | ||
| 110 | 109 | ||
| 111 | // 右侧图片 | 110 | // 右侧图片 |
| 112 | if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) { | 111 | if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) { |
| 113 | - Image(item.fullColumnImgUrls[0].url) | ||
| 114 | - .width(117) | ||
| 115 | - .height(78) | ||
| 116 | - .objectFit(ImageFit.Cover) | ||
| 117 | - .borderRadius($r('app.float.image_border_radius')) | ||
| 118 | - .margin({ left: 12 }) | 112 | + Stack() { |
| 113 | + Image(item.fullColumnImgUrls[0].url) | ||
| 114 | + .width(117) | ||
| 115 | + .height(78) | ||
| 116 | + .objectFit(ImageFit.Cover) | ||
| 117 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 118 | + .margin({ left: 12 }) | ||
| 119 | + CardMediaInfo({ | ||
| 120 | + contentDTO: { | ||
| 121 | + objectType: String(item.objectType), | ||
| 122 | + videoInfo: { videoDuration: Number(item.videoDuration) as number }, | ||
| 123 | + photoNum: Number(item.photoNum), | ||
| 124 | + voiceInfo: { voiceDuration: Number(item.voiceDuration) as number } | ||
| 125 | + } as ContentDTO | ||
| 126 | + }) | ||
| 127 | + } | ||
| 128 | + .alignContent(Alignment.BottomEnd) | ||
| 119 | } | 129 | } |
| 120 | } | 130 | } |
| 121 | .padding({ top: 10, bottom: 10 }) | 131 | .padding({ top: 10, bottom: 10 }) |
| 1 | import { ContentDTO, slideShows } from 'wdBean'; | 1 | import { ContentDTO, slideShows } from 'wdBean'; |
| 2 | -import { CommonConstants } from 'wdConstant' | 2 | +import { CommonConstants } from 'wdConstant'; |
| 3 | import { DateTimeUtils } from 'wdKit'; | 3 | import { DateTimeUtils } from 'wdKit'; |
| 4 | import { ProcessUtils } from 'wdRouter'; | 4 | import { ProcessUtils } from 'wdRouter'; |
| 5 | 5 | ||
| @@ -104,10 +104,12 @@ export struct Card9Component { | @@ -104,10 +104,12 @@ export struct Card9Component { | ||
| 104 | Column() { | 104 | Column() { |
| 105 | Row() { | 105 | Row() { |
| 106 | // 标题 | 106 | // 标题 |
| 107 | - Image($r("app.media.timeline_rect")) | 107 | + Image($r("app.media.timeAxis")) |
| 108 | .width(9) | 108 | .width(9) |
| 109 | .height(9) | 109 | .height(9) |
| 110 | .margin({ right: 5 }) | 110 | .margin({ right: 5 }) |
| 111 | + .fillColor(item.newsTitleColor) | ||
| 112 | + | ||
| 111 | Text(DateTimeUtils.formatDate(item.publishTime, "MM月dd日 HH:mm")) | 113 | Text(DateTimeUtils.formatDate(item.publishTime, "MM月dd日 HH:mm")) |
| 112 | .fontSize($r('app.float.font_size_12')) | 114 | .fontSize($r('app.float.font_size_12')) |
| 113 | .fontColor($r('app.color.color_222222')) | 115 | .fontColor($r('app.color.color_222222')) |
| @@ -15,7 +15,7 @@ export class publishCommentModel { | @@ -15,7 +15,7 @@ export class publishCommentModel { | ||
| 15 | /*【迭代二新增】关联的频道id/专题id; 页面必传*/ | 15 | /*【迭代二新增】关联的频道id/专题id; 页面必传*/ |
| 16 | targetRelObjectId: string = "" | 16 | targetRelObjectId: string = "" |
| 17 | /*【迭代二新增】是否是重点稿件 1是 0否 页面必传*/ | 17 | /*【迭代二新增】是否是重点稿件 1是 0否 页面必传*/ |
| 18 | - keyArticle: string = '' | 18 | + keyArticle: string = '0' |
| 19 | /*内容类别, 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14:动态(13和14为中文版新增) 页面必传*/ | 19 | /*内容类别, 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14:动态(13和14为中文版新增) 页面必传*/ |
| 20 | targetType: string = '' | 20 | targetType: string = '' |
| 21 | /*评论总数*/ | 21 | /*评论总数*/ |
| @@ -9,8 +9,9 @@ import measure from '@ohos.measure' | @@ -9,8 +9,9 @@ import measure from '@ohos.measure' | ||
| 9 | import { CommentCustomDialog } from './CommentCustomDialog' | 9 | import { CommentCustomDialog } from './CommentCustomDialog' |
| 10 | import { publishCommentModel } from '../model/PublishCommentModel'; | 10 | import { publishCommentModel } from '../model/PublishCommentModel'; |
| 11 | import { ifaa } from '@kit.OnlineAuthenticationKit'; | 11 | import { ifaa } from '@kit.OnlineAuthenticationKit'; |
| 12 | -import { HttpUrlUtils } from 'wdNetwork/Index'; | 12 | +import { HttpUrlUtils, HttpUtils } from 'wdNetwork/Index'; |
| 13 | import NoMoreLayout from '../../page/NoMoreLayout'; | 13 | import NoMoreLayout from '../../page/NoMoreLayout'; |
| 14 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 14 | 15 | ||
| 15 | const TAG = 'CommentComponent'; | 16 | const TAG = 'CommentComponent'; |
| 16 | 17 | ||
| @@ -25,6 +26,10 @@ export struct CommentComponent { | @@ -25,6 +26,10 @@ export struct CommentComponent { | ||
| 25 | // @State private browSingModel: commentListModel = new commentListModel() | 26 | // @State private browSingModel: commentListModel = new commentListModel() |
| 26 | /*必传*/ | 27 | /*必传*/ |
| 27 | @ObjectLink publishCommentModel: publishCommentModel | 28 | @ObjectLink publishCommentModel: publishCommentModel |
| 29 | + | ||
| 30 | + listScroller: ListScroller = new ListScroller(); // scroller控制器 | ||
| 31 | + historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset | ||
| 32 | + | ||
| 28 | isloading: boolean = false | 33 | isloading: boolean = false |
| 29 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); | 34 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); |
| 30 | @State dialogController: CustomDialogController | null = null; | 35 | @State dialogController: CustomDialogController | null = null; |
| @@ -69,11 +74,12 @@ export struct CommentComponent { | @@ -69,11 +74,12 @@ export struct CommentComponent { | ||
| 69 | 74 | ||
| 70 | // | 75 | // |
| 71 | addCommentLocal() { | 76 | addCommentLocal() { |
| 72 | - let model = commentViewModel.deepCopyCommentItemModel(this.publishCommentModel.lastCommentModel) | 77 | + // let model = commentViewModel.deepCopyCommentItemModel(this.publishCommentModel.lastCommentModel) |
| 78 | + let model = this.publishCommentModel.lastCommentModel | ||
| 73 | /*一级评论*/ | 79 | /*一级评论*/ |
| 80 | + // if (this.publishCommentModel.lastCommentModel) | ||
| 74 | if (this.publishCommentModel.lastCommentModel.parentId == '-1') { | 81 | if (this.publishCommentModel.lastCommentModel.parentId == '-1') { |
| 75 | this.allDatas.addFirstItem(model) | 82 | this.allDatas.addFirstItem(model) |
| 76 | - //TODO 跳转顶部 | ||
| 77 | } else { | 83 | } else { |
| 78 | //二级评论 | 84 | //二级评论 |
| 79 | this.allDatas.getDataArray().forEach(element => { | 85 | this.allDatas.getDataArray().forEach(element => { |
| @@ -134,7 +140,7 @@ export struct CommentComponent { | @@ -134,7 +140,7 @@ export struct CommentComponent { | ||
| 134 | 140 | ||
| 135 | build() { | 141 | build() { |
| 136 | Column() { | 142 | Column() { |
| 137 | - List() { | 143 | + List({scroller:this.listScroller}) { |
| 138 | ListItemGroup({ header: this.titleHeader() }) | 144 | ListItemGroup({ header: this.titleHeader() }) |
| 139 | 145 | ||
| 140 | LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { | 146 | LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { |
| @@ -176,7 +182,6 @@ export struct CommentComponent { | @@ -176,7 +182,6 @@ export struct CommentComponent { | ||
| 176 | if (this.hasMore === false) NoMoreLayout() | 182 | if (this.hasMore === false) NoMoreLayout() |
| 177 | } | 183 | } |
| 178 | } | 184 | } |
| 179 | - | ||
| 180 | .onReachEnd(()=>{ | 185 | .onReachEnd(()=>{ |
| 181 | if (this.hasMore) { | 186 | if (this.hasMore) { |
| 182 | this.getData() | 187 | this.getData() |
| @@ -552,6 +557,12 @@ struct commentFooterView { | @@ -552,6 +557,12 @@ struct commentFooterView { | ||
| 552 | 557 | ||
| 553 | } | 558 | } |
| 554 | .onClick(() => { | 559 | .onClick(() => { |
| 560 | + // 未登录,跳转登录 | ||
| 561 | + const user_id = HttpUtils.getUserId() | ||
| 562 | + if (!user_id) { | ||
| 563 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 564 | + return | ||
| 565 | + } | ||
| 555 | commentLikeChange(this.item) | 566 | commentLikeChange(this.item) |
| 556 | commentViewModel.commentLike(this.item).then(() => { | 567 | commentViewModel.commentLike(this.item).then(() => { |
| 557 | }).catch(() => { | 568 | }).catch(() => { |
| @@ -7,17 +7,17 @@ import commentViewModel from '../viewmodel/CommentViewModel' | @@ -7,17 +7,17 @@ import commentViewModel from '../viewmodel/CommentViewModel' | ||
| 7 | @Preview | 7 | @Preview |
| 8 | @CustomDialog | 8 | @CustomDialog |
| 9 | export struct CommentCustomDialog { | 9 | export struct CommentCustomDialog { |
| 10 | - | ||
| 11 | @ObjectLink publishCommentModel: publishCommentModel | 10 | @ObjectLink publishCommentModel: publishCommentModel |
| 12 | controller?: CustomDialogController | 11 | controller?: CustomDialogController |
| 13 | confirm: (value: Record<string, string>) => void = () => { | 12 | confirm: (value: Record<string, string>) => void = () => { |
| 14 | } | 13 | } |
| 15 | @State private emojiSwitch: boolean = false | 14 | @State private emojiSwitch: boolean = false |
| 16 | textInputController: TextAreaController = new TextAreaController() | 15 | textInputController: TextAreaController = new TextAreaController() |
| 16 | + @State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 } | ||
| 17 | 17 | ||
| 18 | aboutToAppear(): void { | 18 | aboutToAppear(): void { |
| 19 | 19 | ||
| 20 | - | 20 | + // this.textInputController.caretPosition(0) |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | publishCommentRequest() { | 23 | publishCommentRequest() { |
| @@ -25,9 +25,11 @@ export struct CommentCustomDialog { | @@ -25,9 +25,11 @@ export struct CommentCustomDialog { | ||
| 25 | // this.publishCommentModel.commentContent = this.commentText | 25 | // this.publishCommentModel.commentContent = this.commentText |
| 26 | //TODO 判断类型 | 26 | //TODO 判断类型 |
| 27 | this.publishCommentModel.commentType = '2' | 27 | this.publishCommentModel.commentType = '2' |
| 28 | - commentViewModel.publishComment(this.publishCommentModel).then((model:commentItemModel) => { | 28 | + commentViewModel.publishComment(this.publishCommentModel).then((model: commentItemModel) => { |
| 29 | this.publishCommentModel.commentContent = '' | 29 | this.publishCommentModel.commentContent = '' |
| 30 | - this.publishCommentModel.lastCommentModel = model | 30 | + // |
| 31 | + | ||
| 32 | + this.publishCommentModel.lastCommentModel = commentViewModel.deepCopyCommentItemModel(model) | ||
| 31 | // this.commentText = '' | 33 | // this.commentText = '' |
| 32 | if (this.controller != null) { | 34 | if (this.controller != null) { |
| 33 | this.controller.close() | 35 | this.controller.close() |
| @@ -72,12 +74,13 @@ export struct CommentCustomDialog { | @@ -72,12 +74,13 @@ export struct CommentCustomDialog { | ||
| 72 | .height(30) | 74 | .height(30) |
| 73 | .onClick(() => { | 75 | .onClick(() => { |
| 74 | 76 | ||
| 75 | - // this.commentText = this.commentText + '神鼎' | 77 | + this.positionInfo = this.textInputController.getCaretOffset() |
| 78 | + | ||
| 76 | this.emojiSwitch = !this.emojiSwitch | 79 | this.emojiSwitch = !this.emojiSwitch |
| 77 | if (this.emojiSwitch) { | 80 | if (this.emojiSwitch) { |
| 78 | this.textInputController.stopEditing() | 81 | this.textInputController.stopEditing() |
| 79 | } else { | 82 | } else { |
| 80 | - this.textInputController.caretPosition(this.textInputController.getTextContentRect().x) | 83 | + // this.textInputController.caretPosition(this.textInputController.getTextContentRect().x) |
| 81 | } | 84 | } |
| 82 | 85 | ||
| 83 | }) | 86 | }) |
| @@ -114,7 +117,7 @@ export struct CommentCustomDialog { | @@ -114,7 +117,7 @@ export struct CommentCustomDialog { | ||
| 114 | 117 | ||
| 115 | //表情view | 118 | //表情view |
| 116 | if (this.emojiSwitch) { | 119 | if (this.emojiSwitch) { |
| 117 | - emojiView() | 120 | + emojiView({ publishCommentModel: this.publishCommentModel }).height(150) |
| 118 | } | 121 | } |
| 119 | 122 | ||
| 120 | }.backgroundColor(Color.White) | 123 | }.backgroundColor(Color.White) |
| @@ -127,10 +130,90 @@ export struct CommentCustomDialog { | @@ -127,10 +130,90 @@ export struct CommentCustomDialog { | ||
| 127 | 130 | ||
| 128 | @Component | 131 | @Component |
| 129 | struct emojiView { | 132 | struct emojiView { |
| 133 | + @ObjectLink publishCommentModel: publishCommentModel | ||
| 134 | + /*没找到获取系统emoji的方案*/ | ||
| 135 | + private emojiString = '😀,😁,😂,😃,😄,😅,😆,😇,😈,😉,😊,😋,😌,😍,😎,😏,😐,😑,😒,😓,😔,😕,😖,😗,😘,😙,😚,😛,😜,😝,😞,😟,😠,😡,😢,😣,😤,😥,😦,😧,😨,😩,😪,😫,😬,😭,😮,😯,😰,😱,😲,😳,😴,😵,😶,😷,😸,😹,😺,😻,😼,😽,😾,😿,🙀,🙅,🙆,🙇,🙈,🙉,🙊,🙋,🙌,🙍,🙎,🙏' | ||
| 136 | + private displayArray: string[][] = [] | ||
| 137 | + private swiperController: SwiperController = new SwiperController() | ||
| 138 | + | ||
| 139 | + aboutToAppear(): void { | ||
| 140 | + | ||
| 141 | + | ||
| 142 | + | ||
| 143 | + this.displayArray = chunk(this.emojiString.split(','), 20) | ||
| 144 | + | ||
| 145 | + //补上删除按钮以及空白占位 | ||
| 146 | + let lastElement = this.displayArray.slice(-1)[0]; | ||
| 147 | + if (lastElement.length < 20) { | ||
| 148 | + let needLength = (20 - lastElement.length) | ||
| 149 | + for (let index = 0; index < needLength; index++) { | ||
| 150 | + lastElement.push('') | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + this.displayArray.forEach(element => { | ||
| 155 | + element.push('删除') | ||
| 156 | + }); | ||
| 157 | + | ||
| 158 | + } | ||
| 159 | + | ||
| 130 | build() { | 160 | build() { |
| 161 | + | ||
| 162 | + // String.fromCodePoint() | ||
| 163 | + Swiper(this.swiperController) { | ||
| 164 | + | ||
| 165 | + ForEach(this.displayArray, (array: [], index) => { | ||
| 166 | + Column() { | ||
| 167 | + Grid() { | ||
| 168 | + ForEach(array, (emoji: string, subIndex: number) => { | ||
| 169 | + GridItem() { | ||
| 170 | + Text() { | ||
| 171 | + if (emoji == '删除') { | ||
| 172 | + ImageSpan($r('app.media.wdInput_delete')) | ||
| 173 | + } else { | ||
| 174 | + Span(emoji) | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + }.textAlign(TextAlign.Center).width(30).height(30) | ||
| 178 | + | ||
| 179 | + // .backgroundColor(Color.Orange) | ||
| 180 | + }.onClick(() => { | ||
| 181 | + if (emoji == '删除') { | ||
| 182 | + this.publishCommentModel.commentContent = this.publishCommentModel.commentContent.substring(0, this.publishCommentModel.commentContent.length -1) | ||
| 183 | + } else if (emoji == '') { | ||
| 184 | + | ||
| 185 | + } else { | ||
| 186 | + this.publishCommentModel.commentContent = this.publishCommentModel.commentContent + emoji | ||
| 187 | + } | ||
| 188 | + | ||
| 189 | + }) | ||
| 190 | + }) | ||
| 191 | + } | ||
| 192 | + .maxCount(6) | ||
| 193 | + .columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr') | ||
| 194 | + .rowsGap(10) | ||
| 195 | + .layoutDirection(GridDirection.Row) | ||
| 196 | + | ||
| 197 | + Row().height(40) | ||
| 198 | + } | ||
| 199 | + }) | ||
| 200 | + } | ||
| 201 | + .indicator(true) | ||
| 202 | + .vertical(false) | ||
| 203 | + .height(140) | ||
| 131 | } | 204 | } |
| 132 | } | 205 | } |
| 133 | 206 | ||
| 207 | +function chunk<T>(array: T[], size: number): T[][] { | ||
| 208 | + const result: T[][] = []; | ||
| 209 | + | ||
| 210 | + for (let i = 0; i < array.length; i += size) { | ||
| 211 | + result.push(array.slice(i, i + size)); | ||
| 212 | + } | ||
| 213 | + | ||
| 214 | + return result; | ||
| 215 | +} | ||
| 216 | + | ||
| 134 | 217 | ||
| 135 | 218 | ||
| 136 | 219 |
| @@ -44,7 +44,10 @@ export struct CommentTabComponent { | @@ -44,7 +44,10 @@ export struct CommentTabComponent { | ||
| 44 | } | 44 | } |
| 45 | }.width(151).height(30) | 45 | }.width(151).height(30) |
| 46 | .onClick(() => { | 46 | .onClick(() => { |
| 47 | + | ||
| 48 | + this.publishCommentModel.rootCommentId = '-1'; | ||
| 47 | this.publishCommentModel.parentId = '-1'; | 49 | this.publishCommentModel.parentId = '-1'; |
| 50 | + this.publishCommentModel.placeHolderText = "优质评论会获得最佳评论人的称号" | ||
| 48 | this.dialogController?.open(); | 51 | this.dialogController?.open(); |
| 49 | }) | 52 | }) |
| 50 | } | 53 | } |
| @@ -71,6 +71,7 @@ export struct LiveCommentComponent { | @@ -71,6 +71,7 @@ export struct LiveCommentComponent { | ||
| 71 | left: 6, | 71 | left: 6, |
| 72 | right: 2 | 72 | right: 2 |
| 73 | }) | 73 | }) |
| 74 | + .visibility(this.heartNum > 0 ? Visibility.Visible : Visibility.Hidden) | ||
| 74 | Image(this.isLike ? $r('app.media.icon_like_selected_redheart') : $r('app.media.iv_live_heart_normal')) | 75 | Image(this.isLike ? $r('app.media.icon_like_selected_redheart') : $r('app.media.iv_live_heart_normal')) |
| 75 | .width(24) | 76 | .width(24) |
| 76 | .height(24) | 77 | .height(24) |
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/QualityCommentsComponent.ets
| 1 | import { ViewType } from 'wdConstant/Index' | 1 | import { ViewType } from 'wdConstant/Index' |
| 2 | import { DateTimeUtils, LazyDataSource, WindowModel } from 'wdKit/Index' | 2 | import { DateTimeUtils, LazyDataSource, WindowModel } from 'wdKit/Index' |
| 3 | -import { commentItemModel, commentListModel } from '../model/CommentModel' | 3 | +import { commentItemModel } from '../model/CommentModel' |
| 4 | import commentViewModel from '../viewmodel/CommentViewModel' | 4 | import commentViewModel from '../viewmodel/CommentViewModel' |
| 5 | import { router, window } from '@kit.ArkUI' | 5 | import { router, window } from '@kit.ArkUI' |
| 6 | -import { CustomTitleUI } from '../../reusable/CustomTitleUI' | ||
| 7 | -import { MyCommentDataSource } from '../model/MyCommentDataSource' | ||
| 8 | -import { HttpUrlUtils } from 'wdNetwork/Index' | ||
| 9 | -import PageModel from '../../../viewmodel/PageModel' | 6 | +import { HttpUtils } from 'wdNetwork/Index' |
| 10 | import { ErrorComponent } from '../../view/ErrorComponent' | 7 | import { ErrorComponent } from '../../view/ErrorComponent' |
| 11 | -import { EmptyComponent , WDViewDefaultType} from '../../view/EmptyComponent' | ||
| 12 | -import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh' | 8 | +import { EmptyComponent, WDViewDefaultType } from '../../view/EmptyComponent' |
| 13 | import NoMoreLayout from '../../page/NoMoreLayout' | 9 | import NoMoreLayout from '../../page/NoMoreLayout' |
| 10 | +import { CommentCustomDialog } from './CommentCustomDialog' | ||
| 11 | +import { publishCommentModel } from '../model/PublishCommentModel' | ||
| 12 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | ||
| 14 | 13 | ||
| 15 | const TAG = 'QualityCommentsComponent'; | 14 | const TAG = 'QualityCommentsComponent'; |
| 16 | 15 | ||
| @@ -24,9 +23,6 @@ export struct QualityCommentsComponent { | @@ -24,9 +23,6 @@ export struct QualityCommentsComponent { | ||
| 24 | @State hasMore: boolean = true; | 23 | @State hasMore: boolean = true; |
| 25 | @State currentPage: number = 1; | 24 | @State currentPage: number = 1; |
| 26 | private scroller: Scroller = new Scroller(); | 25 | private scroller: Scroller = new Scroller(); |
| 27 | - | ||
| 28 | - | ||
| 29 | - | ||
| 30 | @State tileOpacity: number = 0; | 26 | @State tileOpacity: number = 0; |
| 31 | firstPositionY: number = 0; | 27 | firstPositionY: number = 0; |
| 32 | bottomSafeHeight: string = AppStorage.get<number>('bottomSafeHeight') + 'px'; | 28 | bottomSafeHeight: string = AppStorage.get<number>('bottomSafeHeight') + 'px'; |
| @@ -34,6 +30,11 @@ export struct QualityCommentsComponent { | @@ -34,6 +30,11 @@ export struct QualityCommentsComponent { | ||
| 34 | lastWindowColor: string = '#ffffff' | 30 | lastWindowColor: string = '#ffffff' |
| 35 | currentWindowColor: string = '#FF4202' | 31 | currentWindowColor: string = '#FF4202' |
| 36 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); | 32 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); |
| 33 | + @State dialogController: CustomDialogController | null = null; | ||
| 34 | + | ||
| 35 | + /*必传*/ | ||
| 36 | + @State publishCommentModel: publishCommentModel = new publishCommentModel() | ||
| 37 | + | ||
| 37 | 38 | ||
| 38 | aboutToDisappear(): void { | 39 | aboutToDisappear(): void { |
| 39 | 40 | ||
| @@ -43,13 +44,33 @@ export struct QualityCommentsComponent { | @@ -43,13 +44,33 @@ export struct QualityCommentsComponent { | ||
| 43 | windowClass.setWindowLayoutFullScreen(false) | 44 | windowClass.setWindowLayoutFullScreen(false) |
| 44 | // windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' }) | 45 | // windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' }) |
| 45 | 46 | ||
| 47 | + this.dialogController = null // 将dialogController置空 | ||
| 48 | + | ||
| 46 | } | 49 | } |
| 47 | 50 | ||
| 48 | aboutToAppear(): void { | 51 | aboutToAppear(): void { |
| 49 | 52 | ||
| 50 | this.fullScreen(); | 53 | this.fullScreen(); |
| 51 | this.getData(); | 54 | this.getData(); |
| 55 | + this.showAlert() | ||
| 56 | + } | ||
| 52 | 57 | ||
| 58 | + showAlert(){ | ||
| 59 | + this.dialogController = new CustomDialogController({ | ||
| 60 | + builder: CommentCustomDialog({ | ||
| 61 | + confirm: (value: Record<string, string>) => { | ||
| 62 | + | ||
| 63 | + }, | ||
| 64 | + publishCommentModel: this.publishCommentModel | ||
| 65 | + }), | ||
| 66 | + autoCancel: true, | ||
| 67 | + alignment: DialogAlignment.Bottom, | ||
| 68 | + customStyle: true, | ||
| 69 | + offset: { | ||
| 70 | + dx: 0, | ||
| 71 | + dy: -20 | ||
| 72 | + }, | ||
| 73 | + }) | ||
| 53 | } | 74 | } |
| 54 | 75 | ||
| 55 | getData(resolve?: (value: string | PromiseLike<string>) => void){ | 76 | getData(resolve?: (value: string | PromiseLike<string>) => void){ |
| @@ -217,7 +238,7 @@ export struct QualityCommentsComponent { | @@ -217,7 +238,7 @@ export struct QualityCommentsComponent { | ||
| 217 | // ListItemGroup({ header: this.titleHeader() }) | 238 | // ListItemGroup({ header: this.titleHeader() }) |
| 218 | LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { | 239 | LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { |
| 219 | ListItem() { | 240 | ListItem() { |
| 220 | - QualityCommentItem({ item: item, index: index }).margin({ left: 12, right: 12 }) | 241 | + QualityCommentItem({ item: item, index: index , dialogController:this.dialogController, publishCommentModel:this.publishCommentModel}).margin({ left: 12, right: 12 }) |
| 221 | } | 242 | } |
| 222 | }) | 243 | }) |
| 223 | // 加载更多 | 244 | // 加载更多 |
| @@ -243,16 +264,6 @@ export struct QualityCommentsComponent { | @@ -243,16 +264,6 @@ export struct QualityCommentsComponent { | ||
| 243 | } | 264 | } |
| 244 | 265 | ||
| 245 | 266 | ||
| 246 | - @Builder | ||
| 247 | - testLayout(){ | ||
| 248 | - List({ space: 12, scroller:this.scroller }){ | ||
| 249 | - LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { | ||
| 250 | - ListItem() { | ||
| 251 | - QualityCommentItem({ item: item, index: index }).margin({ left: 12, right: 12 }) | ||
| 252 | - } | ||
| 253 | - }) | ||
| 254 | - } | ||
| 255 | - } | ||
| 256 | 267 | ||
| 257 | } | 268 | } |
| 258 | 269 | ||
| @@ -261,6 +272,8 @@ export struct QualityCommentsComponent { | @@ -261,6 +272,8 @@ export struct QualityCommentsComponent { | ||
| 261 | 272 | ||
| 262 | @Component | 273 | @Component |
| 263 | struct QualityCommentItem { | 274 | struct QualityCommentItem { |
| 275 | + @ObjectLink publishCommentModel: publishCommentModel | ||
| 276 | + dialogController: CustomDialogController | null = null; | ||
| 264 | @ObjectLink item: commentItemModel | 277 | @ObjectLink item: commentItemModel |
| 265 | index: number = 0 | 278 | index: number = 0 |
| 266 | 279 | ||
| @@ -360,7 +373,20 @@ struct QualityCommentItem { | @@ -360,7 +373,20 @@ struct QualityCommentItem { | ||
| 360 | Row({ space: 16 }) { | 373 | Row({ space: 16 }) { |
| 361 | Row() { | 374 | Row() { |
| 362 | Image($r('app.media.comment_icon_pinglun')).width(16).height(16) | 375 | Image($r('app.media.comment_icon_pinglun')).width(16).height(16) |
| 363 | - } | 376 | + }.onClick(()=>{ |
| 377 | + this.publishCommentModel.targetId = this.item.targetId | ||
| 378 | + this.publishCommentModel.targetRelId = this.item.targetRelId | ||
| 379 | + this.publishCommentModel.targetTitle = this.item.targetTitle | ||
| 380 | + this.publishCommentModel.targetRelType = this.item.targetRelType | ||
| 381 | + this.publishCommentModel.targetRelObjectId = this.item.targetRelObjectId | ||
| 382 | + this.publishCommentModel.targetType = this.item.targetType | ||
| 383 | + // this.publishCommentModel.keyArticle = this.item.keyArticle | ||
| 384 | + | ||
| 385 | + this.publishCommentModel.rootCommentId = this.item.rootCommentId | ||
| 386 | + this.publishCommentModel.parentId = this.item.id | ||
| 387 | + | ||
| 388 | + this.dialogController?.open() | ||
| 389 | + }) | ||
| 364 | 390 | ||
| 365 | Row() { | 391 | Row() { |
| 366 | Image($r(this.item.api_status ? 'app.media.comment_like_select' : 'app.media.comment_like_normal')) | 392 | Image($r(this.item.api_status ? 'app.media.comment_like_select' : 'app.media.comment_like_normal')) |
| @@ -373,6 +399,12 @@ struct QualityCommentItem { | @@ -373,6 +399,12 @@ struct QualityCommentItem { | ||
| 373 | .margin({ left: 3 }) | 399 | .margin({ left: 3 }) |
| 374 | } | 400 | } |
| 375 | }.onClick(() => { | 401 | }.onClick(() => { |
| 402 | + // 未登录,跳转登录 | ||
| 403 | + const user_id = HttpUtils.getUserId() | ||
| 404 | + if (!user_id) { | ||
| 405 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 406 | + return | ||
| 407 | + } | ||
| 376 | commentLikeChange(this.item) | 408 | commentLikeChange(this.item) |
| 377 | commentViewModel.commentLike(this.item).then(() => { | 409 | commentViewModel.commentLike(this.item).then(() => { |
| 378 | }).catch(() => { | 410 | }).catch(() => { |
| 1 | -import { DateTimeUtils, Logger, ToastUtils, UserDataLocal } from 'wdKit/Index'; | 1 | +import { SpConstants } from 'wdConstant/Index'; |
| 2 | +import { DateTimeUtils, Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit/Index'; | ||
| 2 | import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index'; | 3 | import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index'; |
| 3 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | 4 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; |
| 4 | import { | 5 | import { |
| @@ -183,6 +184,14 @@ class CommentViewModel { | @@ -183,6 +184,14 @@ class CommentViewModel { | ||
| 183 | } | 184 | } |
| 184 | ToastUtils.showToast(data.message, 1000); | 185 | ToastUtils.showToast(data.message, 1000); |
| 185 | let model = data.data as commentItemModel | 186 | let model = data.data as commentItemModel |
| 187 | + | ||
| 188 | + let userId = HttpUtils.getUserId() | ||
| 189 | + let FIRSTCOMMENTTIME = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, '') | ||
| 190 | + | ||
| 191 | + if (!userId && !FIRSTCOMMENTTIME) { | ||
| 192 | + //保存首次评论时间 | ||
| 193 | + SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, DateTimeUtils.formatDate(data.timestamp, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) | ||
| 194 | + } | ||
| 186 | success(model) | 195 | success(model) |
| 187 | }, (error: Error) => { | 196 | }, (error: Error) => { |
| 188 | ToastUtils.showToast('评论失败', 1000); | 197 | ToastUtils.showToast('评论失败', 1000); |
| @@ -180,7 +180,7 @@ struct CarouselLayout01CardView { | @@ -180,7 +180,7 @@ struct CarouselLayout01CardView { | ||
| 180 | }) | 180 | }) |
| 181 | Column() { | 181 | Column() { |
| 182 | // 这里用于展示轮播图右上角信息,这里只对直播类型的展示 | 182 | // 这里用于展示轮播图右上角信息,这里只对直播类型的展示 |
| 183 | - if (this.item.objectType === '2') { | 183 | + if (this.item.objectType === '2' || this.item.objectType ==='4') { |
| 184 | CardMediaInfo({ contentDTO: this.item }) | 184 | CardMediaInfo({ contentDTO: this.item }) |
| 185 | .width(CommonConstants.FULL_PARENT) | 185 | .width(CommonConstants.FULL_PARENT) |
| 186 | } | 186 | } |
| @@ -4,6 +4,7 @@ import { postInteractAccentionOperateParams } from 'wdBean'; | @@ -4,6 +4,7 @@ import { postInteractAccentionOperateParams } from 'wdBean'; | ||
| 4 | import { PageRepository } from '../../repository/PageRepository'; | 4 | import { PageRepository } from '../../repository/PageRepository'; |
| 5 | import { ProcessUtils } from 'wdRouter'; | 5 | import { ProcessUtils } from 'wdRouter'; |
| 6 | import { HttpUtils } from 'wdNetwork/Index'; | 6 | import { HttpUtils } from 'wdNetwork/Index'; |
| 7 | +import { DateTimeUtils } from 'wdKit'; | ||
| 7 | 8 | ||
| 8 | /** | 9 | /** |
| 9 | * 直播预约卡 | 10 | * 直播预约卡 |
| @@ -17,6 +18,22 @@ export struct ZhSingleRow03 { | @@ -17,6 +18,22 @@ export struct ZhSingleRow03 { | ||
| 17 | @State compDTO: CompDTO = {} as CompDTO | 18 | @State compDTO: CompDTO = {} as CompDTO |
| 18 | scroller: Scroller = new Scroller() | 19 | scroller: Scroller = new Scroller() |
| 19 | 20 | ||
| 21 | + format(timeNum: number) { | ||
| 22 | + const todayDate = new Date().setHours(0,0,0,0) | ||
| 23 | + const parseDate = new Date(timeNum).setHours(0,0,0,0); | ||
| 24 | + if (todayDate === parseDate) { | ||
| 25 | + return '今天' | ||
| 26 | + } else { const str = DateTimeUtils.formatDate(timeNum, 'MM月dd日') | ||
| 27 | + const month: string = str.split('月')[0]; | ||
| 28 | + if (month[0] === "0") { | ||
| 29 | + return str.slice(1) | ||
| 30 | + } else { | ||
| 31 | + return str.slice(0) | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + } | ||
| 36 | + | ||
| 20 | build() { | 37 | build() { |
| 21 | Column() { | 38 | Column() { |
| 22 | //顶部 | 39 | //顶部 |
| @@ -42,7 +59,8 @@ export struct ZhSingleRow03 { | @@ -42,7 +59,8 @@ export struct ZhSingleRow03 { | ||
| 42 | Row() { | 59 | Row() { |
| 43 | Flex({justifyContent: FlexAlign.SpaceBetween}){ | 60 | Flex({justifyContent: FlexAlign.SpaceBetween}){ |
| 44 | Row() { | 61 | Row() { |
| 45 | - Text(item.liveInfo.liveStartTime.split(' ')[0].slice(5).split('-').join('月')+'日') | 62 | + Text(this.format(new Date(item.liveInfo.liveStartTime).getTime())) |
| 63 | + // Text(item.liveInfo.liveStartTime.split(' ')[0].slice(5).split('-').join('月')+'日') | ||
| 46 | .margin({right: 6}) | 64 | .margin({right: 6}) |
| 47 | .fontColor(0x000000) | 65 | .fontColor(0x000000) |
| 48 | .fontSize(13) | 66 | .fontSize(13) |
| @@ -106,7 +124,7 @@ export struct ZhSingleRow03 { | @@ -106,7 +124,7 @@ export struct ZhSingleRow03 { | ||
| 106 | .width(3) | 124 | .width(3) |
| 107 | .height(16) | 125 | .height(16) |
| 108 | .margin({ right: 4 }) | 126 | .margin({ right: 4 }) |
| 109 | - Text('直播预约') | 127 | + Text('直播预告') |
| 110 | .fontSize($r("app.float.font_size_17")) | 128 | .fontSize($r("app.float.font_size_17")) |
| 111 | .fontColor($r("app.color.color_222222")) | 129 | .fontColor($r("app.color.color_222222")) |
| 112 | .fontWeight(600) | 130 | .fontWeight(600) |
| @@ -30,6 +30,7 @@ const TAG = 'Zh_Single_Row-06' | @@ -30,6 +30,7 @@ const TAG = 'Zh_Single_Row-06' | ||
| 30 | @Component | 30 | @Component |
| 31 | export struct ZhSingleRow06 { | 31 | export struct ZhSingleRow06 { |
| 32 | @State compDTO: CompDTO = {} as CompDTO | 32 | @State compDTO: CompDTO = {} as CompDTO |
| 33 | + @State likeBl: boolean = false; | ||
| 33 | 34 | ||
| 34 | build() { | 35 | build() { |
| 35 | Column() { | 36 | Column() { |
| @@ -81,7 +82,7 @@ export struct ZhSingleRow06 { | @@ -81,7 +82,7 @@ export struct ZhSingleRow06 { | ||
| 81 | .fontColor(0x999999) | 82 | .fontColor(0x999999) |
| 82 | 83 | ||
| 83 | Row(){ | 84 | Row(){ |
| 84 | - Image($r('app.media.icon_like_no')) | 85 | + Image(this.likeBl ? $r('app.media.icon_like_select') : $r('app.media.icon_like')) |
| 85 | .width(16) | 86 | .width(16) |
| 86 | .height(16) | 87 | .height(16) |
| 87 | .margin({right: 3}) | 88 | .margin({right: 3}) |
| @@ -90,6 +91,13 @@ export struct ZhSingleRow06 { | @@ -90,6 +91,13 @@ export struct ZhSingleRow06 { | ||
| 90 | .fontSize(14) | 91 | .fontSize(14) |
| 91 | .fontColor(0x999999) | 92 | .fontColor(0x999999) |
| 92 | } | 93 | } |
| 94 | + .onClick(() => { | ||
| 95 | + if (this.likeBl) { | ||
| 96 | + this.likeBl = false; | ||
| 97 | + } else { | ||
| 98 | + this.likeBl = true; | ||
| 99 | + } | ||
| 100 | + }) | ||
| 93 | } | 101 | } |
| 94 | .justifyContent(FlexAlign.SpaceBetween) | 102 | .justifyContent(FlexAlign.SpaceBetween) |
| 95 | .width('100%') | 103 | .width('100%') |
| @@ -9,13 +9,12 @@ export default struct MinePageMoreFunctionUI { | @@ -9,13 +9,12 @@ export default struct MinePageMoreFunctionUI { | ||
| 9 | build() { | 9 | build() { |
| 10 | Column() { | 10 | Column() { |
| 11 | Column() { | 11 | Column() { |
| 12 | - Text(`更多功能`) | ||
| 13 | - .width('456lpx') | ||
| 14 | - .height('38lpx') | ||
| 15 | - .fontColor($r('app.color.color_666666')) | 12 | + Text("更多功能") |
| 13 | + .fontColor($r('app.color.color_222222')) | ||
| 16 | .fontSize('29lpx') | 14 | .fontSize('29lpx') |
| 17 | .margin({ left: "31lpx" }) | 15 | .margin({ left: "31lpx" }) |
| 18 | - .fontWeight('600lpx') | 16 | + .lineHeight('46lpx') |
| 17 | + .fontWeight(FontWeight.Bold) | ||
| 19 | }.height('92lpx') | 18 | }.height('92lpx') |
| 20 | .width('100%') | 19 | .width('100%') |
| 21 | .justifyContent(FlexAlign.Center) | 20 | .justifyContent(FlexAlign.Center) |
| @@ -9,13 +9,13 @@ export default struct MinePageUserSimpleInfoUI { | @@ -9,13 +9,13 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 9 | @Watch('loginStateChange') @Prop isLogin :boolean | 9 | @Watch('loginStateChange') @Prop isLogin :boolean |
| 10 | @State userName:string = "登陆注册" | 10 | @State userName:string = "登陆注册" |
| 11 | @State headPhotoUrl:string = "" | 11 | @State headPhotoUrl:string = "" |
| 12 | + userType:string = "1" | ||
| 12 | @State levelHead:string = "" | 13 | @State levelHead:string = "" |
| 13 | @State levelId:number = 0 | 14 | @State levelId:number = 0 |
| 14 | 15 | ||
| 15 | loginStateChange(){ | 16 | loginStateChange(){ |
| 16 | if(this.isLogin){ | 17 | if(this.isLogin){ |
| 17 | this.getUserInfo() | 18 | this.getUserInfo() |
| 18 | - this.getUserLevel() | ||
| 19 | }else{ | 19 | }else{ |
| 20 | this.headPhotoUrl = "" | 20 | this.headPhotoUrl = "" |
| 21 | this.levelHead = "" | 21 | this.levelHead = "" |
| @@ -54,8 +54,10 @@ export default struct MinePageUserSimpleInfoUI { | @@ -54,8 +54,10 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 54 | Text(this.userName) | 54 | Text(this.userName) |
| 55 | .fontColor($r('app.color.color_222222')) | 55 | .fontColor($r('app.color.color_222222')) |
| 56 | .maxLines(1) | 56 | .maxLines(1) |
| 57 | + .fontWeight(FontWeight.Bold) | ||
| 57 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 58 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 58 | .fontSize('33lpx') | 59 | .fontSize('33lpx') |
| 60 | + .lineHeight("46lpx") | ||
| 59 | 61 | ||
| 60 | Image($r('app.media.mine_user_edit')) | 62 | Image($r('app.media.mine_user_edit')) |
| 61 | .width('27lpx') | 63 | .width('27lpx') |
| @@ -144,7 +146,21 @@ export default struct MinePageUserSimpleInfoUI { | @@ -144,7 +146,21 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 144 | this.userName = value.userName | 146 | this.userName = value.userName |
| 145 | this.headPhotoUrl = value.headPhotoUrl | 147 | this.headPhotoUrl = value.headPhotoUrl |
| 146 | UserDataLocal.setUserHeaderUrl(value.headPhotoUrl) | 148 | UserDataLocal.setUserHeaderUrl(value.headPhotoUrl) |
| 149 | + | ||
| 150 | + this.userType = value.userType | ||
| 151 | + UserDataLocal.setUserType(value.userType) | ||
| 152 | + | ||
| 153 | + if(this.userType === "1"){ | ||
| 154 | + if(StringUtils.isNotEmpty(value.honoraryIcon)){ | ||
| 155 | + this.levelHead = value.honoraryIcon | ||
| 156 | + return | ||
| 157 | + } | ||
| 158 | + if(StringUtils.isNotEmpty(value.avatarFrame)){ | ||
| 159 | + this.levelHead = value.avatarFrame | ||
| 160 | + } | ||
| 161 | + } | ||
| 147 | } | 162 | } |
| 163 | + this.getUserLevel() | ||
| 148 | }).catch((err:Error)=>{ | 164 | }).catch((err:Error)=>{ |
| 149 | console.log(TAG,JSON.stringify(err)) | 165 | console.log(TAG,JSON.stringify(err)) |
| 150 | }) | 166 | }) |
| @@ -152,10 +168,14 @@ export default struct MinePageUserSimpleInfoUI { | @@ -152,10 +168,14 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 152 | getUserLevel(){ | 168 | getUserLevel(){ |
| 153 | MinePageDatasModel.getUserLevelData(getContext(this)).then((value)=>{ | 169 | MinePageDatasModel.getUserLevelData(getContext(this)).then((value)=>{ |
| 154 | if(value!=null){ | 170 | if(value!=null){ |
| 155 | - this.levelHead = value.levelHead | 171 | + if(StringUtils.isEmpty(this.levelHead)){ |
| 172 | + if(this.userType === "1"){ | ||
| 173 | + this.levelHead = value.levelHead | ||
| 174 | + } | ||
| 175 | + } | ||
| 156 | this.levelId = value.levelId | 176 | this.levelId = value.levelId |
| 157 | - UserDataLocal.setUserLevel(value.levelId) | ||
| 158 | - UserDataLocal.setUserLevelHeaderUrl(value.levelHead + "") | 177 | + UserDataLocal.setUserLevel(this.levelId) |
| 178 | + UserDataLocal.setUserLevelHeaderUrl(this.levelHead + "") | ||
| 159 | } | 179 | } |
| 160 | }).catch((err:Error)=>{ | 180 | }).catch((err:Error)=>{ |
| 161 | console.log(TAG,JSON.stringify(err)) | 181 | console.log(TAG,JSON.stringify(err)) |
| @@ -19,7 +19,7 @@ export struct FollowChildComponent{ | @@ -19,7 +19,7 @@ export struct FollowChildComponent{ | ||
| 19 | Row() { | 19 | Row() { |
| 20 | Row(){ | 20 | Row(){ |
| 21 | Stack({alignContent: Alignment.Bottom}){ | 21 | Stack({alignContent: Alignment.Bottom}){ |
| 22 | - Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl) | 22 | + Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.icon_default_head_mater'):this.data.headPhotoUrl) |
| 23 | .objectFit(ImageFit.Auto) | 23 | .objectFit(ImageFit.Auto) |
| 24 | .width('92lpx') | 24 | .width('92lpx') |
| 25 | .height('92lpx') | 25 | .height('92lpx') |
| @@ -128,7 +128,7 @@ export struct FollowChildComponent{ | @@ -128,7 +128,7 @@ export struct FollowChildComponent{ | ||
| 128 | Row() { | 128 | Row() { |
| 129 | Row(){ | 129 | Row(){ |
| 130 | Stack({alignContent: Alignment.Bottom}){ | 130 | Stack({alignContent: Alignment.Bottom}){ |
| 131 | - Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl) | 131 | + Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.icon_default_head_mater'):this.data.headPhotoUrl) |
| 132 | .objectFit(ImageFit.Auto) | 132 | .objectFit(ImageFit.Auto) |
| 133 | .width('92lpx') | 133 | .width('92lpx') |
| 134 | .height('92lpx') | 134 | .height('92lpx') |
| 1 | +import { EmitterUtils, EmitterEventId, Logger } from 'wdKit/Index' | ||
| 1 | import MinePageDatasModel from '../../../model/MinePageDatasModel' | 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel' |
| 2 | import { FollowListItem } from '../../../viewmodel/FollowListItem' | 3 | import { FollowListItem } from '../../../viewmodel/FollowListItem' |
| 3 | import { CustomTitleUI } from '../../reusable/CustomTitleUI' | 4 | import { CustomTitleUI } from '../../reusable/CustomTitleUI' |
| @@ -20,16 +21,26 @@ export struct FollowFirstTabsComponent{ | @@ -20,16 +21,26 @@ export struct FollowFirstTabsComponent{ | ||
| 20 | }) | 21 | }) |
| 21 | 22 | ||
| 22 | if(this.controller != null && this.data.length>1 && this.changeIndex === 1){ | 23 | if(this.controller != null && this.data.length>1 && this.changeIndex === 1){ |
| 23 | - //个人主页 跳转 关注页 tab 2 | ||
| 24 | - let intervalID = setInterval(() => { | ||
| 25 | - this.currentIndex = this.changeIndex | ||
| 26 | - this.controller.changeIndex(this.currentIndex) | ||
| 27 | - clearInterval(intervalID); | ||
| 28 | - }, 500); | 24 | + this.jumpFollowNextPage() |
| 29 | } | 25 | } |
| 30 | }).catch((err:Error)=>{ | 26 | }).catch((err:Error)=>{ |
| 31 | console.log(TAG,JSON.stringify(err)) | 27 | console.log(TAG,JSON.stringify(err)) |
| 32 | }) | 28 | }) |
| 29 | + | ||
| 30 | + EmitterUtils.receiveEvent(EmitterEventId.MY_FOLLOW_EMPTY, (() => { | ||
| 31 | + if(this.controller != null && this.data.length>1 ){ | ||
| 32 | + this.jumpFollowNextPage() | ||
| 33 | + } | ||
| 34 | + })) | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + jumpFollowNextPage(){ | ||
| 38 | + //个人主页 跳转 关注页 tab 2 | ||
| 39 | + let intervalID = setInterval(() => { | ||
| 40 | + this.currentIndex = 1 | ||
| 41 | + this.controller.changeIndex(this.currentIndex) | ||
| 42 | + clearInterval(intervalID); | ||
| 43 | + }, 500); | ||
| 33 | } | 44 | } |
| 34 | 45 | ||
| 35 | @Builder TabBuilder(index: number, item: FollowListItem) { | 46 | @Builder TabBuilder(index: number, item: FollowListItem) { |
| @@ -74,6 +85,7 @@ export struct FollowFirstTabsComponent{ | @@ -74,6 +85,7 @@ export struct FollowFirstTabsComponent{ | ||
| 74 | .vertical(false) | 85 | .vertical(false) |
| 75 | .barMode(BarMode.Scrollable) | 86 | .barMode(BarMode.Scrollable) |
| 76 | .barWidth('100%') | 87 | .barWidth('100%') |
| 88 | + .barBackgroundColor($r('app.color.white')) | ||
| 77 | .barHeight('84lpx') | 89 | .barHeight('84lpx') |
| 78 | .animationDuration(0) | 90 | .animationDuration(0) |
| 79 | .onChange((index: number) => { | 91 | .onChange((index: number) => { |
| 1 | -import { LazyDataSource, SPHelper, UserDataLocal } from 'wdKit'; | 1 | +import { EmitterEventId, EmitterUtils, LazyDataSource, SPHelper, UserDataLocal } from 'wdKit'; |
| 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; | 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; |
| 3 | import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel'; | 3 | import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel'; |
| 4 | import { CreatorDetailRequestItem } from '../../../viewmodel/CreatorDetailRequestItem'; | 4 | import { CreatorDetailRequestItem } from '../../../viewmodel/CreatorDetailRequestItem'; |
| @@ -70,9 +70,15 @@ export struct FollowListDetailUI { | @@ -70,9 +70,15 @@ 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 | - EmptyComponent({ emptyType: 14 }) | ||
| 74 | - .layoutWeight(1) | ||
| 75 | - .width('100%') | 73 | + if(this.creatorDirectoryId === -1){ |
| 74 | + EmptyComponent({ emptyType: 14,emptyHeight:"100%" }) | ||
| 75 | + .layoutWeight(1) | ||
| 76 | + .width('100%') | ||
| 77 | + }else{ | ||
| 78 | + EmptyComponent({ emptyType: 16,emptyHeight:"100%" }) | ||
| 79 | + .layoutWeight(1) | ||
| 80 | + .width('100%') | ||
| 81 | + } | ||
| 76 | } | 82 | } |
| 77 | 83 | ||
| 78 | } else { | 84 | } else { |
| @@ -156,10 +162,12 @@ export struct FollowListDetailUI { | @@ -156,10 +162,12 @@ export struct FollowListDetailUI { | ||
| 156 | } | 162 | } |
| 157 | this.isLoading = false | 163 | this.isLoading = false |
| 158 | this.isGetRequest = true | 164 | this.isGetRequest = true |
| 165 | + this.sendFollowMessage() | ||
| 159 | }).catch((err: Error) => { | 166 | }).catch((err: Error) => { |
| 160 | console.log(TAG, "请求失败") | 167 | console.log(TAG, "请求失败") |
| 161 | this.isGetRequest = true | 168 | this.isGetRequest = true |
| 162 | this.isLoading = false | 169 | this.isLoading = false |
| 170 | + this.sendFollowMessage() | ||
| 163 | }) | 171 | }) |
| 164 | } else { | 172 | } else { |
| 165 | this.isLoading = false | 173 | this.isLoading = false |
| @@ -167,6 +175,12 @@ export struct FollowListDetailUI { | @@ -167,6 +175,12 @@ export struct FollowListDetailUI { | ||
| 167 | } | 175 | } |
| 168 | } | 176 | } |
| 169 | 177 | ||
| 178 | + sendFollowMessage(){ | ||
| 179 | + if(this.count === 0){ | ||
| 180 | + EmitterUtils.sendEvent(EmitterEventId.MY_FOLLOW_EMPTY) | ||
| 181 | + } | ||
| 182 | + } | ||
| 183 | + | ||
| 170 | getNewPageData() { | 184 | getNewPageData() { |
| 171 | //我的关注列表 | 185 | //我的关注列表 |
| 172 | if (this.creatorDirectoryId === -1) { | 186 | if (this.creatorDirectoryId === -1) { |
| @@ -179,6 +193,7 @@ export struct FollowListDetailUI { | @@ -179,6 +193,7 @@ export struct FollowListDetailUI { | ||
| 179 | if (!this.data || value.list.length == 0) { | 193 | if (!this.data || value.list.length == 0) { |
| 180 | this.hasMore = false | 194 | this.hasMore = false |
| 181 | this.isLoading = false | 195 | this.isLoading = false |
| 196 | + this.isGetRequest = true | ||
| 182 | } else { | 197 | } else { |
| 183 | this.getFollowListStatus(value) | 198 | this.getFollowListStatus(value) |
| 184 | } | 199 | } |
| @@ -226,6 +241,8 @@ export struct FollowListDetailUI { | @@ -226,6 +241,8 @@ export struct FollowListDetailUI { | ||
| 226 | }) | 241 | }) |
| 227 | }) | 242 | }) |
| 228 | this.getFollowStatus(data_temp, result.totalCount) | 243 | this.getFollowStatus(data_temp, result.totalCount) |
| 244 | + }else{ | ||
| 245 | + this.isGetRequest = true | ||
| 229 | } | 246 | } |
| 230 | }).catch((err: Error) => { | 247 | }).catch((err: Error) => { |
| 231 | console.log(TAG, JSON.stringify(err)) | 248 | console.log(TAG, JSON.stringify(err)) |
| 1 | import { FollowListItem, FollowThirdListItem } from '../../../viewmodel/FollowListItem' | 1 | import { FollowListItem, FollowThirdListItem } from '../../../viewmodel/FollowListItem' |
| 2 | import { FollowListDetailUI } from './FollowListDetailUI' | 2 | import { FollowListDetailUI } from './FollowListDetailUI' |
| 3 | +import measure from '@ohos.measure' | ||
| 3 | 4 | ||
| 4 | @Component | 5 | @Component |
| 5 | export struct FollowThirdTabsComponent{ | 6 | export struct FollowThirdTabsComponent{ |
| @@ -11,8 +12,8 @@ export struct FollowThirdTabsComponent{ | @@ -11,8 +12,8 @@ export struct FollowThirdTabsComponent{ | ||
| 11 | 12 | ||
| 12 | 13 | ||
| 13 | private controller: TabsController = new TabsController() | 14 | private controller: TabsController = new TabsController() |
| 14 | - fontColor: string = '#999999' | ||
| 15 | - selectedFontColor: string = '#000000' | 15 | + fontColor: string = '#666666' |
| 16 | + selectedFontColor: string = '#222222' | ||
| 16 | 17 | ||
| 17 | build(){ | 18 | build(){ |
| 18 | if(this.data != null){ | 19 | if(this.data != null){ |
| @@ -26,32 +27,44 @@ export struct FollowThirdTabsComponent{ | @@ -26,32 +27,44 @@ export struct FollowThirdTabsComponent{ | ||
| 26 | 27 | ||
| 27 | @Builder TabBuilder(index: number, item: FollowThirdListItem) { | 28 | @Builder TabBuilder(index: number, item: FollowThirdListItem) { |
| 28 | Column(){ | 29 | Column(){ |
| 29 | - Text(item.directoryName) | ||
| 30 | - .fontSize('30lpx') | ||
| 31 | - .textAlign(TextAlign.Center) | ||
| 32 | - .fontWeight(this.currentIndex === index ? 600 : 400) | ||
| 33 | - .fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor) | ||
| 34 | - .lineHeight('38lpx') | ||
| 35 | - .backgroundColor($r('app.color.color_F9F9F9')) | ||
| 36 | - .padding('13lpx') | ||
| 37 | - .maxLines(1) | 30 | + Row(){ |
| 31 | + Image(index === 0?$r("app.media.ic_collect_left_left"):(index === this.data[this.firstIndex].children[this.secondIndex].children.length-1?$r('app.media.ic_collect_right_left'):$r('app.media.ic_collect_mid_left'))) | ||
| 32 | + .width(index === 0?"19lpx":"35lpx") | ||
| 33 | + .height('61lpx') | ||
| 34 | + .objectFit(ImageFit.Fill) | ||
| 35 | + | ||
| 36 | + Text(item.directoryName) | ||
| 37 | + .fontSize('27lpx') | ||
| 38 | + .fontWeight(this.currentIndex === index ? "600lpx" : "400lpx") | ||
| 39 | + .fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor) | ||
| 40 | + .lineHeight('35lpx') | ||
| 41 | + .backgroundImage($r('app.media.ic_collect_mid')) | ||
| 42 | + .backgroundImageSize(ImageSize.Cover) | ||
| 43 | + .padding({top:"13lpx",bottom:"13lpx"}) | ||
| 44 | + | ||
| 45 | + Image(index === 0?$r("app.media.ic_collect_left_right"):(index === this.data[this.firstIndex].children[this.secondIndex].children.length-1?$r('app.media.ic_collect_right_right'):$r('app.media.ic_collect_mid_right'))) | ||
| 46 | + .width(index === this.data[this.firstIndex].children[this.secondIndex].children.length-1?"19lpx":"35lpx") | ||
| 47 | + .height('61lpx') | ||
| 48 | + .objectFit(ImageFit.Fill) | ||
| 49 | + } | ||
| 38 | } | 50 | } |
| 39 | .onClick(()=>{ | 51 | .onClick(()=>{ |
| 40 | this.currentIndex = index | 52 | this.currentIndex = index |
| 41 | this.controller.changeIndex(this.currentIndex) | 53 | this.controller.changeIndex(this.currentIndex) |
| 42 | }) | 54 | }) |
| 43 | - .height('84lpx') | ||
| 44 | - .margin({right:'9lpx'}) | ||
| 45 | - .padding({left:'20lpx',right:index === this.data[this.firstIndex].children[this.secondIndex].children.length-1?"20lpx":"0lpx"}) | ||
| 46 | - .justifyContent(FlexAlign.Center) | 55 | + .offset({x:index === 0?"0lpx":"-5lpx"}) |
| 56 | + .height('80lpx') | ||
| 57 | + .justifyContent(FlexAlign.End) | ||
| 47 | } | 58 | } |
| 48 | 59 | ||
| 60 | + | ||
| 61 | + | ||
| 49 | @Builder FollowThirdUI(){ | 62 | @Builder FollowThirdUI(){ |
| 50 | 63 | ||
| 51 | Column(){ | 64 | Column(){ |
| 52 | Column() { | 65 | Column() { |
| 53 | // 页签 | 66 | // 页签 |
| 54 | - Row({ space: 7 }) { | 67 | + Row() { |
| 55 | Scroll() { | 68 | Scroll() { |
| 56 | Row() { | 69 | Row() { |
| 57 | ForEach(this.data[this.firstIndex].children[this.secondIndex].children, (item: FollowThirdListItem, index: number ) => { | 70 | ForEach(this.data[this.firstIndex].children[this.secondIndex].children, (item: FollowThirdListItem, index: number ) => { |
| @@ -63,8 +76,8 @@ export struct FollowThirdTabsComponent{ | @@ -63,8 +76,8 @@ export struct FollowThirdTabsComponent{ | ||
| 63 | .align(Alignment.Start) | 76 | .align(Alignment.Start) |
| 64 | .scrollable(ScrollDirection.Horizontal) | 77 | .scrollable(ScrollDirection.Horizontal) |
| 65 | .scrollBar(BarState.Off) | 78 | .scrollBar(BarState.Off) |
| 66 | - .width('90%') | ||
| 67 | - .padding({left:'11lpx'}) | 79 | + .width('100%') |
| 80 | + .padding({left:'31lpx',right:'48lpx'}) | ||
| 68 | } | 81 | } |
| 69 | .alignItems(VerticalAlign.Bottom) | 82 | .alignItems(VerticalAlign.Bottom) |
| 70 | .width('100%') | 83 | .width('100%') |
| @@ -77,11 +90,6 @@ export struct FollowThirdTabsComponent{ | @@ -77,11 +90,6 @@ export struct FollowThirdTabsComponent{ | ||
| 77 | ForEach(this.data[this.firstIndex].children[this.secondIndex].children, (item: FollowThirdListItem, index: number ) => { | 90 | ForEach(this.data[this.firstIndex].children[this.secondIndex].children, (item: FollowThirdListItem, index: number ) => { |
| 78 | TabContent(){ | 91 | TabContent(){ |
| 79 | Column(){ | 92 | Column(){ |
| 80 | - Divider().width('100%') | ||
| 81 | - .height('2lpx') | ||
| 82 | - .strokeWidth('1lpx') | ||
| 83 | - .backgroundColor($r('app.color.color_EDEDED')) | ||
| 84 | - .margin({left:'20lpx'}) | ||
| 85 | FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].children[this.secondIndex].children[index].id}) | 93 | FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].children[this.secondIndex].children[index].id}) |
| 86 | } | 94 | } |
| 87 | } | 95 | } |
| @@ -99,4 +107,19 @@ export struct FollowThirdTabsComponent{ | @@ -99,4 +107,19 @@ export struct FollowThirdTabsComponent{ | ||
| 99 | } | 107 | } |
| 100 | } | 108 | } |
| 101 | 109 | ||
| 110 | + getMeasureText(text: string,index:number) { | ||
| 111 | + let width = measure.measureText({ | ||
| 112 | + textContent: text, | ||
| 113 | + fontSize: px2fp(27), | ||
| 114 | + lineHeight: px2fp(35) | ||
| 115 | + }) | ||
| 116 | + if(index === 0){ | ||
| 117 | + return width + 19+ 35 | ||
| 118 | + }else if(index === this.data[this.firstIndex].children[this.secondIndex].children.length-1){ | ||
| 119 | + return width + 35+ 35 | ||
| 120 | + }else{ | ||
| 121 | + return width + 35+ 19 | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + | ||
| 102 | } | 125 | } |
| 1 | -import { ContentDTO, Params } from 'wdBean'; | ||
| 2 | import { DateTimeUtils, LazyDataSource, SPHelper,UserDataLocal } from 'wdKit'; | 1 | import { DateTimeUtils, LazyDataSource, SPHelper,UserDataLocal } from 'wdKit'; |
| 3 | -import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter'; | 2 | +import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 4 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; | 3 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; |
| 5 | import { CommentListItem } from '../../../viewmodel/CommentListItem'; | 4 | import { CommentListItem } from '../../../viewmodel/CommentListItem'; |
| 6 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; | 5 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; |
| @@ -106,6 +105,7 @@ export struct HomePageBottomComponent{ | @@ -106,6 +105,7 @@ export struct HomePageBottomComponent{ | ||
| 106 | EmptyComponent({emptyType:14}) | 105 | EmptyComponent({emptyType:14}) |
| 107 | .layoutWeight(1) | 106 | .layoutWeight(1) |
| 108 | .width('100%') | 107 | .width('100%') |
| 108 | + .offset({y:"-200lpx"}) | ||
| 109 | } | 109 | } |
| 110 | }.layoutWeight(1) | 110 | }.layoutWeight(1) |
| 111 | .justifyContent(FlexAlign.Start) | 111 | .justifyContent(FlexAlign.Start) |
| @@ -114,6 +114,7 @@ export struct HomePageBottomComponent{ | @@ -114,6 +114,7 @@ export struct HomePageBottomComponent{ | ||
| 114 | EmptyComponent({emptyType:11}) | 114 | EmptyComponent({emptyType:11}) |
| 115 | .layoutWeight(1) | 115 | .layoutWeight(1) |
| 116 | .width('100%') | 116 | .width('100%') |
| 117 | + .offset({y:"-200lpx"}) | ||
| 117 | } | 118 | } |
| 118 | } | 119 | } |
| 119 | }else{ | 120 | }else{ |
| @@ -146,7 +147,7 @@ export struct HomePageBottomComponent{ | @@ -146,7 +147,7 @@ export struct HomePageBottomComponent{ | ||
| 146 | 147 | ||
| 147 | LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { | 148 | LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { |
| 148 | ListItem() { | 149 | ListItem() { |
| 149 | - FollowChildComponent({data: item,type:1}) | 150 | + FollowChildComponent({data: item,type:2}) |
| 150 | } | 151 | } |
| 151 | .onClick(() => { | 152 | .onClick(() => { |
| 152 | }) | 153 | }) |
| @@ -284,6 +285,7 @@ export struct HomePageBottomComponent{ | @@ -284,6 +285,7 @@ export struct HomePageBottomComponent{ | ||
| 284 | if (!this.data_comment || value.list.length == 0){ | 285 | if (!this.data_comment || value.list.length == 0){ |
| 285 | this.hasMore = false | 286 | this.hasMore = false |
| 286 | this.isLoading = false | 287 | this.isLoading = false |
| 288 | + this.isGetRequest = true | ||
| 287 | }else{ | 289 | }else{ |
| 288 | this.getCommentListStatus(value) | 290 | this.getCommentListStatus(value) |
| 289 | } | 291 | } |
| @@ -322,6 +324,27 @@ export struct HomePageBottomComponent{ | @@ -322,6 +324,27 @@ export struct HomePageBottomComponent{ | ||
| 322 | data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,commentContent,item.likeNum,0,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,parentCommentContent,parentCommentUserName)) | 324 | data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,commentContent,item.likeNum,0,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,parentCommentContent,parentCommentUserName)) |
| 323 | }) | 325 | }) |
| 324 | 326 | ||
| 327 | + if(status.commentIdList.length === 0){ | ||
| 328 | + data.forEach((item)=>{ | ||
| 329 | + let publishTime = DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(item.createTime,DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) | ||
| 330 | + this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,publishTime,item.commentContent,item.likeNum,item.like_status,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,item.parentCommentContent,item.parentCommentUserName)) | ||
| 331 | + }) | ||
| 332 | + | ||
| 333 | + this.data_comment.notifyDataReload() | ||
| 334 | + | ||
| 335 | + this.count = this.data_comment.totalCount() | ||
| 336 | + this.commentNum = value.totalCount | ||
| 337 | + if (this.data_comment.totalCount() < value.totalCount) { | ||
| 338 | + this.curPageNum++ | ||
| 339 | + }else { | ||
| 340 | + this.hasMore = false | ||
| 341 | + } | ||
| 342 | + | ||
| 343 | + this.isLoading = false | ||
| 344 | + this.isGetRequest = true | ||
| 345 | + return | ||
| 346 | + } | ||
| 347 | + | ||
| 325 | MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{ | 348 | MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{ |
| 326 | newValue.forEach((item)=>{ | 349 | newValue.forEach((item)=>{ |
| 327 | data.forEach((list)=>{ | 350 | data.forEach((list)=>{ |
| @@ -101,6 +101,7 @@ export struct OtherHomePageBottomCommentComponent { | @@ -101,6 +101,7 @@ export struct OtherHomePageBottomCommentComponent { | ||
| 101 | if (!this.data_comment || value.list.length == 0) { | 101 | if (!this.data_comment || value.list.length == 0) { |
| 102 | this.hasMore = false | 102 | this.hasMore = false |
| 103 | this.isLoading = false | 103 | this.isLoading = false |
| 104 | + this.isGetRequest = true | ||
| 104 | } else { | 105 | } else { |
| 105 | this.getCommentListStatus(value) | 106 | this.getCommentListStatus(value) |
| 106 | } | 107 | } |
| @@ -138,6 +139,27 @@ export struct OtherHomePageBottomCommentComponent { | @@ -138,6 +139,27 @@ export struct OtherHomePageBottomCommentComponent { | ||
| 138 | data.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, item.createTime, commentContent, item.likeNum, 0, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, parentCommentContent, parentCommentUserName)) | 139 | data.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, item.createTime, commentContent, item.likeNum, 0, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, parentCommentContent, parentCommentUserName)) |
| 139 | }) | 140 | }) |
| 140 | 141 | ||
| 142 | + if(status.commentIdList.length === 0){ | ||
| 143 | + data.forEach((item) => { | ||
| 144 | + this.data_comment.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, item.createTime, item.commentContent, item.likeNum, item.like_status, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, item.parentCommentContent, item.parentCommentUserName)) | ||
| 145 | + }) | ||
| 146 | + | ||
| 147 | + this.data_comment.notifyDataReload() | ||
| 148 | + | ||
| 149 | + this.count = this.data_comment.totalCount() | ||
| 150 | + this.commentNum = value.totalCount | ||
| 151 | + if (this.data_comment.totalCount() < value.totalCount) { | ||
| 152 | + this.curPageNum++ | ||
| 153 | + } else { | ||
| 154 | + this.hasMore = false | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + this.isLoading = false | ||
| 158 | + this.isGetRequest = true | ||
| 159 | + return | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + | ||
| 141 | MinePageDatasModel.getOtherUserCommentLikeStatusData(status, getContext(this)).then((newValue) => { | 163 | MinePageDatasModel.getOtherUserCommentLikeStatusData(status, getContext(this)).then((newValue) => { |
| 142 | newValue.forEach((item) => { | 164 | newValue.forEach((item) => { |
| 143 | data.forEach((list) => { | 165 | data.forEach((list) => { |
| @@ -250,10 +250,10 @@ struct ChannelDialog { | @@ -250,10 +250,10 @@ struct ChannelDialog { | ||
| 250 | .fontSize(16) | 250 | .fontSize(16) |
| 251 | .fontWeight(600) | 251 | .fontWeight(600) |
| 252 | .margin({ right: 4 }) | 252 | .margin({ right: 4 }) |
| 253 | - Text(!this.isEditIng ? MY_CHANNEL_TIP1 : MY_CHANNEL_TIP2) | ||
| 254 | - .fontSize(12) | ||
| 255 | - .fontWeight(400) | ||
| 256 | - .fontColor('#222222') | 253 | + // Text(!this.isEditIng ? MY_CHANNEL_TIP1 : MY_CHANNEL_TIP2) |
| 254 | + // .fontSize(12) | ||
| 255 | + // .fontWeight(400) | ||
| 256 | + // .fontColor('#222222') | ||
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | Text(this.isEditIng ? EDIT_DOWN : EDIT_TEXT) | 259 | Text(this.isEditIng ? EDIT_DOWN : EDIT_TEXT) |
| @@ -276,9 +276,9 @@ struct ChannelDialog { | @@ -276,9 +276,9 @@ struct ChannelDialog { | ||
| 276 | Row() { | 276 | Row() { |
| 277 | Text(item.name) | 277 | Text(item.name) |
| 278 | .fontSize(14) | 278 | .fontSize(14) |
| 279 | - .fontColor(this.currentTopNavSelectedItem.channelId === item.channelId ? '#ED2800' : (item.homeChannel === '1' || item.movePermitted === 0 ? '#999999' : '#222222')) | 279 | + .fontColor(this.currentTopNavSelectedItem.channelId === item.channelId ? '#ED2800' : (item.headlinesOn === 1 || item.movePermitted === 0 ? '#999999' : '#222222')) |
| 280 | 280 | ||
| 281 | - if (this.isEditIng && item.delPermitted === 1) { | 281 | + if (this.isEditIng && item.delPermitted === 1 && item.movePermitted === 1) { |
| 282 | Image($r('app.media.icon_audio_close')) | 282 | Image($r('app.media.icon_audio_close')) |
| 283 | .width(12) | 283 | .width(12) |
| 284 | .margin({ left: 1 }) | 284 | .margin({ left: 1 }) |
| @@ -287,12 +287,12 @@ struct ChannelDialog { | @@ -287,12 +287,12 @@ struct ChannelDialog { | ||
| 287 | .width('100%') | 287 | .width('100%') |
| 288 | .height('100%') | 288 | .height('100%') |
| 289 | .justifyContent(FlexAlign.Center) | 289 | .justifyContent(FlexAlign.Center) |
| 290 | - .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff') | 290 | + .backgroundColor(item.headlinesOn === 1 || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff') |
| 291 | } | 291 | } |
| 292 | .width('23%') | 292 | .width('23%') |
| 293 | .height(40) | 293 | .height(40) |
| 294 | .border({ | 294 | .border({ |
| 295 | - width: item.homeChannel === '1' ? 0 : 1, | 295 | + width: item.headlinesOn === 1 || item.movePermitted === 0 ? 0 : 1, |
| 296 | color: '#EDEDED', | 296 | color: '#EDEDED', |
| 297 | radius: 3 | 297 | radius: 3 |
| 298 | }) | 298 | }) |
| @@ -303,7 +303,7 @@ struct ChannelDialog { | @@ -303,7 +303,7 @@ struct ChannelDialog { | ||
| 303 | TapGesture() | 303 | TapGesture() |
| 304 | .onAction((event?: GestureEvent) => { | 304 | .onAction((event?: GestureEvent) => { |
| 305 | if (this.isEditIng) { | 305 | if (this.isEditIng) { |
| 306 | - if (item.delPermitted === 1) { | 306 | + if (item.delPermitted === 1 && item.movePermitted === 1) { |
| 307 | this.delChannelItem(index) | 307 | this.delChannelItem(index) |
| 308 | } | 308 | } |
| 309 | } else { | 309 | } else { |
| @@ -319,7 +319,7 @@ struct ChannelDialog { | @@ -319,7 +319,7 @@ struct ChannelDialog { | ||
| 319 | } | 319 | } |
| 320 | } | 320 | } |
| 321 | }), | 321 | }), |
| 322 | - PanGesture({ fingers: 1, direction: null, distance: 0 }) | 322 | + PanGesture({ fingers: 1, direction: this.isEditIng ? PanDirection.All:PanDirection.None, distance: 0 }) |
| 323 | .onActionStart((event: GestureEvent) => { | 323 | .onActionStart((event: GestureEvent) => { |
| 324 | this.dragItem = item.num | 324 | this.dragItem = item.num |
| 325 | this.dragRefOffsetX = 0 | 325 | this.dragRefOffsetX = 0 |
| @@ -449,7 +449,7 @@ struct ChannelDialog { | @@ -449,7 +449,7 @@ struct ChannelDialog { | ||
| 449 | }.width('100%').height('100%') | 449 | }.width('100%').height('100%') |
| 450 | .scrollBar(BarState.Off) | 450 | .scrollBar(BarState.Off) |
| 451 | } | 451 | } |
| 452 | - .padding({ top: 40, right: 15, bottom: 20, left: 15 }) | 452 | + .padding({ top: 40, right: 15, bottom: 40, left: 15 }) |
| 453 | .backgroundColor('#ffffff') | 453 | .backgroundColor('#ffffff') |
| 454 | } | 454 | } |
| 455 | } | 455 | } |
| @@ -526,10 +526,9 @@ struct ChannelSubscriptionLayout { | @@ -526,10 +526,9 @@ struct ChannelSubscriptionLayout { | ||
| 526 | .width(18) | 526 | .width(18) |
| 527 | } | 527 | } |
| 528 | .width(36) | 528 | .width(36) |
| 529 | - .height(36) | 529 | + .height(40) |
| 530 | .justifyContent(FlexAlign.Center) | 530 | .justifyContent(FlexAlign.Center) |
| 531 | - .padding({ bottom: 6 }) | ||
| 532 | - .backgroundColor('#ffffff') | 531 | + .backgroundColor(Color.White) |
| 533 | .onClick(() => { | 532 | .onClick(() => { |
| 534 | if (this.dialogController != null) { | 533 | if (this.dialogController != null) { |
| 535 | this.dialogController.open() | 534 | this.dialogController.open() |
| @@ -3,6 +3,7 @@ import { RefreshLayoutBean } from './RefreshLayoutBean'; | @@ -3,6 +3,7 @@ import { RefreshLayoutBean } from './RefreshLayoutBean'; | ||
| 3 | 3 | ||
| 4 | /** | 4 | /** |
| 5 | * Custom layout to show refresh or load. | 5 | * Custom layout to show refresh or load. |
| 6 | + * @deprecated | ||
| 6 | */ | 7 | */ |
| 7 | @Component | 8 | @Component |
| 8 | export default struct CustomLayout { | 9 | export default struct CustomLayout { |
| @@ -128,7 +128,8 @@ struct EditUserInfoPage { | @@ -128,7 +128,8 @@ struct EditUserInfoPage { | ||
| 128 | onAccept:(value:DatePickerResult) => { | 128 | onAccept:(value:DatePickerResult) => { |
| 129 | let mon = value.month as number + 1 | 129 | let mon = value.month as number + 1 |
| 130 | let monStr = mon < 10? '0'+mon.toString():mon.toString(); | 130 | let monStr = mon < 10? '0'+mon.toString():mon.toString(); |
| 131 | - this.currentUserInfo.userExtend.birthday = value.year+'-'+monStr+'-'+value.day; | 131 | + let dayStr = value.day as number < 10? '0'+value.day:value.day; |
| 132 | + this.currentUserInfo.userExtend.birthday = value.year+'-'+monStr+'-'+dayStr; | ||
| 132 | this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_birthday | 133 | this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_birthday |
| 133 | this.updateEditModel() | 134 | this.updateEditModel() |
| 134 | } | 135 | } |
| @@ -8,6 +8,7 @@ import MinePageMoreFunctionUI from '../mine/MinePageMoreFunctionUI' | @@ -8,6 +8,7 @@ import MinePageMoreFunctionUI from '../mine/MinePageMoreFunctionUI' | ||
| 8 | import { SPHelper, StringUtils } from 'wdKit' | 8 | import { SPHelper, StringUtils } from 'wdKit' |
| 9 | import { SpConstants } from 'wdConstant' | 9 | import { SpConstants } from 'wdConstant' |
| 10 | import dataPreferences from '@ohos.data.preferences'; | 10 | import dataPreferences from '@ohos.data.preferences'; |
| 11 | +import { MergeRecordDialog } from '../../dialog/MergeRecordDialog' | ||
| 11 | 12 | ||
| 12 | const TAG = 'MinePageComponent'; | 13 | const TAG = 'MinePageComponent'; |
| 13 | 14 | ||
| @@ -30,9 +31,23 @@ export struct MinePageComponent { | @@ -30,9 +31,23 @@ export struct MinePageComponent { | ||
| 30 | this.isLogin = false | 31 | this.isLogin = false |
| 31 | }else { | 32 | }else { |
| 32 | this.isLogin = true | 33 | this.isLogin = true |
| 34 | + this.addRecordDialog() | ||
| 33 | } | 35 | } |
| 34 | } | 36 | } |
| 35 | } | 37 | } |
| 38 | + mergeDialogController: CustomDialogController = new CustomDialogController({ | ||
| 39 | + builder: MergeRecordDialog({ | ||
| 40 | + cancel: () => { | ||
| 41 | + this.clearMergeRecord() | ||
| 42 | + }, | ||
| 43 | + confirm: () => { | ||
| 44 | + this.dealMergeRecordData() | ||
| 45 | + } | ||
| 46 | + }), | ||
| 47 | + customStyle: true, | ||
| 48 | + alignment: DialogAlignment.Center, | ||
| 49 | + autoCancel: false | ||
| 50 | + }) | ||
| 36 | 51 | ||
| 37 | aboutToAppear(){ | 52 | aboutToAppear(){ |
| 38 | this.getUserLogin() | 53 | this.getUserLogin() |
| @@ -112,5 +127,29 @@ export struct MinePageComponent { | @@ -112,5 +127,29 @@ export struct MinePageComponent { | ||
| 112 | } | 127 | } |
| 113 | } | 128 | } |
| 114 | 129 | ||
| 130 | + addRecordDialog() { | ||
| 131 | + setTimeout(() => { | ||
| 132 | + this.dealMergeRecordDialog() | ||
| 133 | + }, 300) | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + dealMergeRecordDialog() { | ||
| 137 | + let commentTime = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, "") | ||
| 138 | + if (StringUtils.isNotEmpty(commentTime)) { | ||
| 139 | + this.mergeDialogController.open() | ||
| 140 | + } | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + dealMergeRecordData() { | ||
| 144 | + MinePageDatasModel.visitorMergeComment().then(() => { | ||
| 145 | + this.mergeDialogController.close() | ||
| 146 | + }).catch(() => { | ||
| 147 | + this.mergeDialogController.close() | ||
| 148 | + }) | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + clearMergeRecord(){ | ||
| 152 | + SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, "") | ||
| 153 | + } | ||
| 115 | } | 154 | } |
| 116 | 155 |
| @@ -47,6 +47,7 @@ struct MyCollectionListPage { | @@ -47,6 +47,7 @@ struct MyCollectionListPage { | ||
| 47 | CustomPullToRefresh({ | 47 | CustomPullToRefresh({ |
| 48 | alldata:this.allDatas, | 48 | alldata:this.allDatas, |
| 49 | scroller:this.scroller, | 49 | scroller:this.scroller, |
| 50 | + hasMore:this.browSingModel.hasMore, | ||
| 50 | customList:()=>{ | 51 | customList:()=>{ |
| 51 | this.ListLayout() | 52 | this.ListLayout() |
| 52 | }, | 53 | }, |
| @@ -122,10 +123,14 @@ struct MyCollectionListPage { | @@ -122,10 +123,14 @@ struct MyCollectionListPage { | ||
| 122 | if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { | 123 | if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { |
| 123 | if (this.currentPage === 1) { | 124 | if (this.currentPage === 1) { |
| 124 | this.allDatas = [] | 125 | this.allDatas = [] |
| 125 | - this.allDatas.push(...collectionItem.list) | ||
| 126 | - }else { | ||
| 127 | - this.allDatas = this.allDatas.concat(...collectionItem.list) | ||
| 128 | } | 126 | } |
| 127 | + | ||
| 128 | + for (let index = 0; index < collectionItem.list.length; index++) { | ||
| 129 | + const compDTO = collectionItem.list[index]; | ||
| 130 | + compDTO.isCollection = true ///用于时间展示 | ||
| 131 | + this.allDatas.push(compDTO) | ||
| 132 | + } | ||
| 133 | + | ||
| 129 | if (collectionItem.hasNext === 0) { | 134 | if (collectionItem.hasNext === 0) { |
| 130 | this.browSingModel.hasMore = false; | 135 | this.browSingModel.hasMore = false; |
| 131 | } else { | 136 | } else { |
| @@ -188,8 +193,17 @@ struct MyCollectionListPage { | @@ -188,8 +193,17 @@ struct MyCollectionListPage { | ||
| 188 | }) | 193 | }) |
| 189 | 194 | ||
| 190 | //重置删除状态 | 195 | //重置删除状态 |
| 196 | + this.updataUIState() | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + updataUIState(){ | ||
| 191 | this.isEditState = false | 200 | this.isEditState = false |
| 192 | this.isAllSelect = false | 201 | this.isAllSelect = false |
| 202 | + | ||
| 203 | + if (this.allDatas.length === 0) { | ||
| 204 | + this.browSingModel.viewType = ViewType.EMPTY; | ||
| 205 | + this.browSingModel.hasMore === true | ||
| 206 | + } | ||
| 193 | } | 207 | } |
| 194 | 208 | ||
| 195 | } | 209 | } |
| @@ -5,12 +5,15 @@ import { RefreshConstants } from '../../utils/RefreshConstants' | @@ -5,12 +5,15 @@ import { RefreshConstants } from '../../utils/RefreshConstants' | ||
| 5 | */ | 5 | */ |
| 6 | @Component | 6 | @Component |
| 7 | export default struct NoMoreLayout { | 7 | export default struct NoMoreLayout { |
| 8 | + | ||
| 9 | + | ||
| 8 | build() { | 10 | build() { |
| 9 | - Row() { | 11 | + Column() { |
| 10 | Text($r('app.string.footer_text')) | 12 | Text($r('app.string.footer_text')) |
| 11 | - .margin({ left: RefreshConstants.NoMoreLayoutConstant_NORMAL_PADDING }) | ||
| 12 | .fontSize(RefreshConstants.NoMoreLayoutConstant_TITLE_FONT) | 13 | .fontSize(RefreshConstants.NoMoreLayoutConstant_TITLE_FONT) |
| 13 | .textAlign(TextAlign.Center) | 14 | .textAlign(TextAlign.Center) |
| 15 | + .fontColor('#CCCCCC') | ||
| 16 | + .margin({bottom:40}) | ||
| 14 | } | 17 | } |
| 15 | .width(RefreshConstants.FULL_WIDTH) | 18 | .width(RefreshConstants.FULL_WIDTH) |
| 16 | .justifyContent(FlexAlign.Center) | 19 | .justifyContent(FlexAlign.Center) |
-
Please register or login to post a comment