Showing
77 changed files
with
1778 additions
and
1177 deletions
Too many changes to show.
To preserve performance only 77 of 77+ files are displayed.
sight_harmony/.ohpmrc
0 → 100644
| 1 | +@mpaas:registry=https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/meta |
| @@ -2,4 +2,5 @@ export default class BuildProfile { | @@ -2,4 +2,5 @@ export default class BuildProfile { | ||
| 2 | static readonly HAR_VERSION = '1.0.0'; | 2 | static readonly HAR_VERSION = '1.0.0'; |
| 3 | static readonly BUILD_MODE_NAME = 'debug'; | 3 | static readonly BUILD_MODE_NAME = 'debug'; |
| 4 | static readonly DEBUG = true; | 4 | static readonly DEBUG = true; |
| 5 | + static readonly TARGET_NAME = 'default'; | ||
| 5 | } | 6 | } |
| 1 | +import { expect } from '@ohos/hypium'; | ||
| 2 | + | ||
| 1 | export { Logger } from './src/main/ets/utils/Logger' | 3 | export { Logger } from './src/main/ets/utils/Logger' |
| 2 | 4 | ||
| 3 | export { ResourcesUtils } from './src/main/ets/utils/ResourcesUtils' | 5 | export { ResourcesUtils } from './src/main/ets/utils/ResourcesUtils' |
| @@ -53,3 +55,9 @@ export { NetworkType } from './src/main/ets/network/NetworkType' | @@ -53,3 +55,9 @@ export { NetworkType } from './src/main/ets/network/NetworkType' | ||
| 53 | export { CustomToast } from './src/main/ets/reusable/CustomToast' | 55 | export { CustomToast } from './src/main/ets/reusable/CustomToast' |
| 54 | 56 | ||
| 55 | export { UmengStats } from "./src/main/ets/umeng/UmengStats" | 57 | export { UmengStats } from "./src/main/ets/umeng/UmengStats" |
| 58 | + | ||
| 59 | +export { MpaasUtils } from './src/main/ets/mpaas/MpaasUtils' | ||
| 60 | + | ||
| 61 | +export { MpaasUpgradeCheck, UpgradeTipContent } from './src/main/ets/mpaas/MpaasUpgradeCheck' | ||
| 62 | + | ||
| 63 | +export { TingyunAPM } from './src/main/ets/tingyunAPM/TingyunAPM' |
| @@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
| 7 | "main": "Index.ets", | 7 | "main": "Index.ets", |
| 8 | "version": "1.0.0", | 8 | "version": "1.0.0", |
| 9 | "dependencies": { | 9 | "dependencies": { |
| 10 | + "@tingyun/harmonyos": "file:./src/main/ets/tingyunAPM/tingyun_0.0.6.har", | ||
| 10 | "@umeng/common": "^1.0.21", | 11 | "@umeng/common": "^1.0.21", |
| 11 | "@umeng/analytics": "^1.0.19" | 12 | "@umeng/analytics": "^1.0.19" |
| 12 | } | 13 | } |
| 1 | +import { MPUpgradeService } from '@mpaas/upgrade' | ||
| 2 | +import { upgradeRes } from '@mpaas/upgrade/src/main/ets/t4/a' | ||
| 3 | +import { AppUtils } from '../utils/AppUtils' | ||
| 4 | +import { SPHelper } from '../utils/SPHelper' | ||
| 5 | + | ||
| 6 | +export interface UpgradeTipContent { | ||
| 7 | + | ||
| 8 | + content: string | ||
| 9 | + newVersion: string | ||
| 10 | + downloadUrl: string | ||
| 11 | + forceUpgrade: boolean | ||
| 12 | +} | ||
| 13 | + | ||
| 14 | +export class MpaasUpgradeCheck { | ||
| 15 | + | ||
| 16 | + /// 默认提示框 | ||
| 17 | + checkNewVersionAndShow() { | ||
| 18 | + try { | ||
| 19 | + MPUpgradeService.checkNewVersionAndShow() | ||
| 20 | + } catch (error) { | ||
| 21 | + console.log("mpaas upgrade fail", JSON.stringify(error)) | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + checkNewVersion(): Promise<UpgradeTipContent | null> { | ||
| 26 | + | ||
| 27 | + return new Promise((resolve, fail) => { | ||
| 28 | + MPUpgradeService.checkNewVersion().then((response)=>{ | ||
| 29 | + let str = JSON.stringify(response) | ||
| 30 | + console.log("mpaas upgrade check", str) | ||
| 31 | + | ||
| 32 | + /* | ||
| 33 | + { | ||
| 34 | + "android64FileSize": 0, | ||
| 35 | + "downloadURL": "https://appgallery.huawei.com/#/app", | ||
| 36 | + "fileSize": 0, | ||
| 37 | + "fullMd5": "no md5", | ||
| 38 | + "guideMemo": "欢迎使用新版本", | ||
| 39 | + "isWifi": 0, | ||
| 40 | + "netType": "ALL", | ||
| 41 | + "newestVersion": "1.0.1", | ||
| 42 | + "resultStatus": 204, | ||
| 43 | + "silentType": 0, | ||
| 44 | + "upgradeVersion": "1.0.1" | ||
| 45 | + }*/ | ||
| 46 | + | ||
| 47 | + let res = response as upgradeRes | ||
| 48 | + | ||
| 49 | + // AliUpgradeNewVersion = 201, /*当前使用的已是最新版本*/ | ||
| 50 | + // AliUpgradeOneTime = 202, /*客户端已有新版本,单次提醒*/ | ||
| 51 | + // AliUpgradeForceUpdate = 203, /*客户端已有新版本,强制升级(已废弃)*/ | ||
| 52 | + // AliUpgradeEveryTime = 204, /*客户端已有新版本,多次提醒*/ | ||
| 53 | + // AliUpgradeRejectLogin = 205, /*限制登录(已废弃)*/ | ||
| 54 | + // AliUpgradeForceUpdateWithLogin = 206 /*客户端已有新版本,强制升级*/ | ||
| 55 | + | ||
| 56 | + const currentAppVersoin = AppUtils.getAppVersionName() | ||
| 57 | + | ||
| 58 | + if (res.resultStatus == 201) { | ||
| 59 | + resolve(null) | ||
| 60 | + return | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + // 单次升级控制 | ||
| 64 | + if (res.resultStatus == 202) { | ||
| 65 | + const oldOnceValue = SPHelper.default.getSync("upgradeOnceKey", false) as boolean | ||
| 66 | + if (true == oldOnceValue) { | ||
| 67 | + resolve(null) | ||
| 68 | + return | ||
| 69 | + } | ||
| 70 | + SPHelper.default.save("upgradeOnceKey", true) | ||
| 71 | + } else { | ||
| 72 | + SPHelper.default.save("upgradeOnceKey", false) | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + if (res.resultStatus == 202 || res.resultStatus == 204 || res.resultStatus == 206) { | ||
| 76 | + let content: UpgradeTipContent = { | ||
| 77 | + content: res.guideMemo, | ||
| 78 | + newVersion: res.upgradeVersion, | ||
| 79 | + downloadUrl: res.downloadURL, | ||
| 80 | + forceUpgrade: res.resultStatus == 206 | ||
| 81 | + } | ||
| 82 | + resolve(content) | ||
| 83 | + return | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + resolve(null) | ||
| 87 | + }).catch((error: Error) => { | ||
| 88 | + console.log("mpaas upgrade fail", `name: ${error.name}, message: ${error.message}, \nstack: ${error.stack}`) | ||
| 89 | + fail("检测升级失败") | ||
| 90 | + }) | ||
| 91 | + }) | ||
| 92 | + } | ||
| 93 | +} |
| 1 | +import { MPFramework } from '@mpaas/framework' | ||
| 2 | +import { common } from '@kit.AbilityKit'; | ||
| 3 | + | ||
| 4 | +/* | ||
| 5 | +对接mpaas注意: | ||
| 6 | +* 1、后台创建mpaas.config,需要包名。放到rawfile目录 | ||
| 7 | +* 2、网关加密hs_1222.png图片,放到rawfile目录 | ||
| 8 | +* 3. 配置和加密图片,需要包名和签名对应,否则无法使用 | ||
| 9 | + * */ | ||
| 10 | + | ||
| 11 | +export class MpaasUtils { | ||
| 12 | + | ||
| 13 | + // 启动时onCreate()方法调用 | ||
| 14 | + static initApp(context: common.UIAbilityContext) { | ||
| 15 | + MPFramework.create(context); | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + // 获取mPaaS utdid | ||
| 19 | + static async mpaasUtdid() { | ||
| 20 | + let utdid = await MPFramework.instance.udid | ||
| 21 | + return utdid | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + // 登录和退出登录调用,用来管理白名单用 | ||
| 25 | + static setupUserId(userId?: string) { | ||
| 26 | + MPFramework.instance.userId = userId | ||
| 27 | + } | ||
| 28 | +} |
| @@ -30,6 +30,7 @@ export struct CustomToast { | @@ -30,6 +30,7 @@ export struct CustomToast { | ||
| 30 | .fontSize("27lpx") | 30 | .fontSize("27lpx") |
| 31 | .lineHeight("38lpx") | 31 | .lineHeight("38lpx") |
| 32 | }.borderRadius(`${this.bgBorderRadius}lpx`) | 32 | }.borderRadius(`${this.bgBorderRadius}lpx`) |
| 33 | + .constraintSize({maxWidth:"86%"}) | ||
| 33 | .padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"}) | 34 | .padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"}) |
| 34 | .backgroundColor($r("app.color.black")) | 35 | .backgroundColor($r("app.color.black")) |
| 35 | .opacity(0.7) | 36 | .opacity(0.7) |
| 1 | +import { common } from '@kit.AbilityKit'; | ||
| 2 | +import tingyun, { LogLevel } from '@tingyun/harmonyos'; | ||
| 3 | + | ||
| 4 | + | ||
| 5 | +export class TingyunAPM { | ||
| 6 | + | ||
| 7 | + private static TINGYUN_APP_KEY = "" //TODO: | ||
| 8 | + private static TINGYUN_REDIRECT_HOST = "wkrt.tingyun.com" | ||
| 9 | + | ||
| 10 | + private static logEnable() { | ||
| 11 | + return true | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + // | ||
| 15 | + static initApp(context: common.UIAbilityContext, deviceId?: string) { | ||
| 16 | + tingyun.init({ | ||
| 17 | + redirectHost: TingyunAPM.TINGYUN_REDIRECT_HOST, | ||
| 18 | + appKey: TingyunAPM.TINGYUN_APP_KEY, | ||
| 19 | + context: context, | ||
| 20 | + | ||
| 21 | + httpEnabled: true, | ||
| 22 | + logLevel: TingyunAPM.logEnable() ? LogLevel.DEBUG : LogLevel.NONE, | ||
| 23 | + | ||
| 24 | + // TODO: axios实例对象 | ||
| 25 | + // axios:axiosInstance, | ||
| 26 | + network: { | ||
| 27 | + enabled: true, | ||
| 28 | + }, | ||
| 29 | + | ||
| 30 | + crash: { | ||
| 31 | + enabled: true, | ||
| 32 | + jsCrashEnabled: true, | ||
| 33 | + cppCrashEnabled: true, | ||
| 34 | + }, | ||
| 35 | + | ||
| 36 | + freeze: { | ||
| 37 | + enabled: true | ||
| 38 | + } | ||
| 39 | + }); | ||
| 40 | + if (deviceId) { | ||
| 41 | + tingyun.setUserId(deviceId) | ||
| 42 | + } | ||
| 43 | + tingyun.startNextSession() | ||
| 44 | + } | ||
| 45 | +} |
No preview for this file type
| @@ -63,5 +63,16 @@ export class AppUtils { | @@ -63,5 +63,16 @@ export class AppUtils { | ||
| 63 | // TODO: 待确认,暂时写死Android | 63 | // TODO: 待确认,暂时写死Android |
| 64 | return "Harmony" | 64 | return "Harmony" |
| 65 | } | 65 | } |
| 66 | + | ||
| 67 | + static getFingerprint(): string { | ||
| 68 | + try { | ||
| 69 | + let bundleInfo = | ||
| 70 | + bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO); | ||
| 71 | + let finger = bundleInfo.signatureInfo.fingerprint; | ||
| 72 | + } catch (e) { | ||
| 73 | + Logger.warn(TAG, 'get app signatureinfo error:' + e?.message); | ||
| 74 | + } | ||
| 75 | + return ''; | ||
| 76 | + } | ||
| 66 | } | 77 | } |
| 67 | 78 |
| @@ -9,6 +9,10 @@ export class HttpUrlUtils { | @@ -9,6 +9,10 @@ export class HttpUrlUtils { | ||
| 9 | */ | 9 | */ |
| 10 | static readonly BOTTOM_NAV_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup"; | 10 | static readonly BOTTOM_NAV_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup"; |
| 11 | /** | 11 | /** |
| 12 | + * 底导详情接口 | ||
| 13 | + */ | ||
| 14 | + static readonly BOTTOM_NAV_DETAIL_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup/detail"; | ||
| 15 | + /** | ||
| 12 | * 展现pageInfo接口 | 16 | * 展现pageInfo接口 |
| 13 | */ | 17 | */ |
| 14 | static readonly PAGE_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/pageInfo"; | 18 | static readonly PAGE_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/pageInfo"; |
| @@ -293,6 +297,10 @@ export class HttpUrlUtils { | @@ -293,6 +297,10 @@ export class HttpUrlUtils { | ||
| 293 | */ | 297 | */ |
| 294 | static readonly ATTENTION_BATCH_DATA_PATH: string = "/api/rmrb-interact/interact/zh/c/attention/batch"; | 298 | static readonly ATTENTION_BATCH_DATA_PATH: string = "/api/rmrb-interact/interact/zh/c/attention/batch"; |
| 295 | 299 | ||
| 300 | + /** | ||
| 301 | + * 查询是否设置过密码checkSetPassword | ||
| 302 | + */ | ||
| 303 | + static readonly CHECK_SET_PASSWORD_PATH: string = "/api/rmrb-user-center/user/zh/c/ifSetPassword"; | ||
| 296 | 304 | ||
| 297 | static getHost(): string { | 305 | static getHost(): string { |
| 298 | return HostManager.getHost(); | 306 | return HostManager.getHost(); |
| @@ -685,4 +693,10 @@ export class HttpUrlUtils { | @@ -685,4 +693,10 @@ export class HttpUrlUtils { | ||
| 685 | return url; | 693 | return url; |
| 686 | } | 694 | } |
| 687 | 695 | ||
| 696 | + //查询是否设置过密码 | ||
| 697 | + static checkSetPassword() { | ||
| 698 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.CHECK_SET_PASSWORD_PATH; | ||
| 699 | + return url; | ||
| 700 | + } | ||
| 701 | + | ||
| 688 | } | 702 | } |
| @@ -68,6 +68,7 @@ export class WDRouterPage { | @@ -68,6 +68,7 @@ export class WDRouterPage { | ||
| 68 | static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); | 68 | static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); |
| 69 | static oneKeyLoginPage = new WDRouterPage("wdLogin", "ets/pages/login/OneKeyLoginPage"); | 69 | static oneKeyLoginPage = new WDRouterPage("wdLogin", "ets/pages/login/OneKeyLoginPage"); |
| 70 | static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); | 70 | static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); |
| 71 | + static modifyPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ModifyPasswordPage"); | ||
| 71 | //我的 预约 | 72 | //我的 预约 |
| 72 | static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage"); | 73 | static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage"); |
| 73 | //我的 关注 | 74 | //我的 关注 |
| @@ -156,10 +156,8 @@ function handleJsCallAppInnerLinkMethod(data: Message) { | @@ -156,10 +156,8 @@ function handleJsCallAppInnerLinkMethod(data: Message) { | ||
| 156 | relType: urlParams.get('relType') || '', | 156 | relType: urlParams.get('relType') || '', |
| 157 | pageId: urlParams.get('pageId') || '', | 157 | pageId: urlParams.get('pageId') || '', |
| 158 | objectType: '', | 158 | objectType: '', |
| 159 | - linkUrl: urlParams.get('url') || '' | 159 | + linkUrl: encodeURI(urlParams.get('url') || '') |
| 160 | } as ContentDTO | 160 | } as ContentDTO |
| 161 | - if (urlParams.get('skipType') === '1') { | ||
| 162 | - | ||
| 163 | switch (urlParams.get('type')) { | 161 | switch (urlParams.get('type')) { |
| 164 | case 'video': | 162 | case 'video': |
| 165 | content.objectType = ContentConstants.TYPE_VOD | 163 | content.objectType = ContentConstants.TYPE_VOD |
| @@ -182,8 +180,14 @@ function handleJsCallAppInnerLinkMethod(data: Message) { | @@ -182,8 +180,14 @@ function handleJsCallAppInnerLinkMethod(data: Message) { | ||
| 182 | ProcessUtils.processPage(content) | 180 | ProcessUtils.processPage(content) |
| 183 | break; | 181 | break; |
| 184 | case 'h5': | 182 | case 'h5': |
| 185 | - content.objectType = ContentConstants.TYPE_LINK | ||
| 186 | - ProcessUtils.processPage(content) | 183 | + if (urlParams.get('skipType') === '1') { |
| 184 | + content.objectType = ContentConstants.TYPE_LINK | ||
| 185 | + ProcessUtils.processPage(content) | ||
| 186 | + } | ||
| 187 | + if (urlParams.get('skipType') === '4') { | ||
| 188 | + content.objectType = ContentConstants.TYPE_LINK | ||
| 189 | + ProcessUtils.jumpExternalWebPage(content.linkUrl) | ||
| 190 | + } | ||
| 187 | break; | 191 | break; |
| 188 | case 'topic': | 192 | case 'topic': |
| 189 | if (urlParams.get('subType') === 'h5') { | 193 | if (urlParams.get('subType') === 'h5') { |
| @@ -208,7 +212,7 @@ function handleJsCallAppInnerLinkMethod(data: Message) { | @@ -208,7 +212,7 @@ function handleJsCallAppInnerLinkMethod(data: Message) { | ||
| 208 | default: | 212 | default: |
| 209 | break; | 213 | break; |
| 210 | } | 214 | } |
| 211 | - } | 215 | + |
| 212 | } | 216 | } |
| 213 | 217 | ||
| 214 | function handleJsCallGetAppLoginAuthInfo() { | 218 | function handleJsCallGetAppLoginAuthInfo() { |
| @@ -48,8 +48,8 @@ export struct WdWebLocalComponent { | @@ -48,8 +48,8 @@ export struct WdWebLocalComponent { | ||
| 48 | 48 | ||
| 49 | Row() { | 49 | Row() { |
| 50 | RelativeContainer() { | 50 | RelativeContainer() { |
| 51 | - Web({ src: this.webResource, controller: this.webviewControl, renderMode: RenderMode.SYNC_RENDER }) | ||
| 52 | - // Web({ src: this.webResource, controller: this.webviewControl}) | 51 | + // Web({ src: this.webResource, controller: this.webviewControl, renderMode: RenderMode.SYNC_RENDER }) |
| 52 | + Web({ src: this.webResource, controller: this.webviewControl}) | ||
| 53 | .domStorageAccess(true) | 53 | .domStorageAccess(true) |
| 54 | .databaseAccess(true) | 54 | .databaseAccess(true) |
| 55 | .javaScriptAccess(true) | 55 | .javaScriptAccess(true) |
| @@ -59,7 +59,7 @@ export struct WdWebLocalComponent { | @@ -59,7 +59,7 @@ export struct WdWebLocalComponent { | ||
| 59 | .enableNativeEmbedMode(true) | 59 | .enableNativeEmbedMode(true) |
| 60 | .layoutMode(WebLayoutMode.FIT_CONTENT) | 60 | .layoutMode(WebLayoutMode.FIT_CONTENT) |
| 61 | // .nestedScroll({ scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.PARENT_FIRST }) | 61 | // .nestedScroll({ scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.PARENT_FIRST }) |
| 62 | - // .height(this.webHeight) | 62 | + .height(this.webHeight) |
| 63 | .onPageBegin((event) => { | 63 | .onPageBegin((event) => { |
| 64 | this.onPageBegin(event?.url); | 64 | this.onPageBegin(event?.url); |
| 65 | }) | 65 | }) |
| 1 | // navigation | 1 | // navigation |
| 2 | -export { NavigationBodyDTO } from './src/main/ets/bean/navigation/NavigationBodyDTO'; | 2 | +export { NavigationBodyDTO, NavigationDetailDTO } from './src/main/ets/bean/navigation/NavigationBodyDTO'; |
| 3 | 3 | ||
| 4 | export { BottomNavDTO } from './src/main/ets/bean/navigation/BottomNavDTO'; | 4 | export { BottomNavDTO } from './src/main/ets/bean/navigation/BottomNavDTO'; |
| 5 | 5 | ||
| @@ -167,3 +167,5 @@ export { | @@ -167,3 +167,5 @@ export { | ||
| 167 | export { GoldenPositionExtraBean } from './src/main/ets/bean/content/GoldenPositionExtraBean'; | 167 | export { GoldenPositionExtraBean } from './src/main/ets/bean/content/GoldenPositionExtraBean'; |
| 168 | export { ClassBean } from './src/main/ets/bean/content/ClassBean'; | 168 | export { ClassBean } from './src/main/ets/bean/content/ClassBean'; |
| 169 | export { CreatorsBean } from './src/main/ets/bean/content/CreatorsBean'; | 169 | export { CreatorsBean } from './src/main/ets/bean/content/CreatorsBean'; |
| 170 | + | ||
| 171 | +export { MasterDetailRes } from './src/main/ets/bean/user/MasterDetailRes'; |
| @@ -180,6 +180,8 @@ export interface LiveInfo { | @@ -180,6 +180,8 @@ export interface LiveInfo { | ||
| 180 | liveStyle: number; | 180 | liveStyle: number; |
| 181 | vlive: Array<Vlive> | 181 | vlive: Array<Vlive> |
| 182 | mlive: MLive | 182 | mlive: MLive |
| 183 | + // 背景图片先取这个? | ||
| 184 | + previewUrl: string | ||
| 183 | } | 185 | } |
| 184 | 186 | ||
| 185 | export interface MLive { | 187 | export interface MLive { |
| 1 | import { AudioDataList } from './AudioDataList'; | 1 | import { AudioDataList } from './AudioDataList'; |
| 2 | -import { OperDataList } from './OperDataList'; | 2 | +import { ContentDTO } from '../content/ContentDTO'; |
| 3 | 3 | ||
| 4 | export interface CompList { | 4 | export interface CompList { |
| 5 | audioDataList: AudioDataList[]; | 5 | audioDataList: AudioDataList[]; |
| @@ -36,7 +36,7 @@ export interface CompList { | @@ -36,7 +36,7 @@ export interface CompList { | ||
| 36 | 36 | ||
| 37 | // openComment?: any; | 37 | // openComment?: any; |
| 38 | // openLikes?: any; | 38 | // openLikes?: any; |
| 39 | - operDataList: OperDataList[]; | 39 | + operDataList: ContentDTO[]; |
| 40 | pageId: string; | 40 | pageId: string; |
| 41 | 41 | ||
| 42 | // position?: any; | 42 | // position?: any; |
| @@ -39,4 +39,21 @@ export interface BottomNavDTO { | @@ -39,4 +39,21 @@ export interface BottomNavDTO { | ||
| 39 | type: string; // 底部导航类型,1普通 2我的;【rmrb需要扩展】 | 39 | type: string; // 底部导航类型,1普通 2我的;【rmrb需要扩展】 |
| 40 | fmorningAndEveningUrl: string; // 迭代四:早晚报背景框 | 40 | fmorningAndEveningUrl: string; // 迭代四:早晚报背景框 |
| 41 | dropDownAnimationColor: string; // 下拉加载动画颜色,1白色,2灰色。未配置值是null | 41 | dropDownAnimationColor: string; // 下拉加载动画颜色,1白色,2灰色。未配置值是null |
| 42 | +} | ||
| 43 | + | ||
| 44 | +export interface BottomNavCompDTO { | ||
| 45 | + id: string; | ||
| 46 | + navId: string; | ||
| 47 | + compType: string; | ||
| 48 | + compStyle: string; | ||
| 49 | + extraData: string; | ||
| 50 | + leftIconUrl: string; | ||
| 51 | + leftObjectId: string; | ||
| 52 | + leftRelId: string; | ||
| 53 | + leftObjectType: string; //0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14动态图文,15动态视频 | ||
| 54 | + leftObjectLevel: string; // 对象分类;频道(1:一级频道,2:二级频道),专题(21:文章专题,22:音频专题,23:直播专题,24:话题专题) | ||
| 55 | + leftObjectPageId: string; //leftObjectType=5,11;返回对应页面id | ||
| 56 | + leftLinkUrl: string; | ||
| 57 | + rightIconUrl: string; | ||
| 58 | + immersiveRightIconUrl: string; | ||
| 42 | } | 59 | } |
| 1 | -import { BottomNavDTO } from './BottomNavDTO'; | 1 | +import { BottomNavDTO, BottomNavCompDTO } from './BottomNavDTO'; |
| 2 | +import { TopNavDTO } from './TopNavDTO'; | ||
| 2 | 3 | ||
| 3 | /** | 4 | /** |
| 4 | * 导航Body数据 | 5 | * 导航Body数据 |
| @@ -11,3 +12,9 @@ export interface NavigationBodyDTO { | @@ -11,3 +12,9 @@ export interface NavigationBodyDTO { | ||
| 11 | immersiveBackgroundColor: string; // 迭代二新增-底部导航背景色(沉浸式频道) | 12 | immersiveBackgroundColor: string; // 迭代二新增-底部导航背景色(沉浸式频道) |
| 12 | nightBackgroundColor: string; // 迭代三新增-底部导航背景色(夜间模式) | 13 | nightBackgroundColor: string; // 迭代三新增-底部导航背景色(夜间模式) |
| 13 | } | 14 | } |
| 15 | + | ||
| 16 | +export interface NavigationDetailDTO { | ||
| 17 | + id: string; // 迭代二新增-底部导航背景色(信息流频道) | ||
| 18 | + bottomNavCompList: BottomNavCompDTO[]; | ||
| 19 | + topNavChannelList: TopNavDTO[]; | ||
| 20 | +} |
| 1 | +export class MasterDetailRes { | ||
| 2 | + shareUrl = ""; | ||
| 3 | + contentPublish = 0; | ||
| 4 | + authId = 0; | ||
| 5 | + cnLiveCommentControl = 0; | ||
| 6 | + liveGiftControl = 0; | ||
| 7 | + livePublish = 0; | ||
| 8 | + province = ""; | ||
| 9 | + fansNum = 0; | ||
| 10 | + articleCreation = 0; | ||
| 11 | + cnIsComment = 0; | ||
| 12 | + cnIsLike = 0; | ||
| 13 | + creatorId = ""; | ||
| 14 | + browseNum = 0; | ||
| 15 | + cnLiveLikeControl = 0; | ||
| 16 | + cnLiveShareControl = 0; | ||
| 17 | + banControl = 0; | ||
| 18 | + userId = ""; | ||
| 19 | + videoCreation = 0; | ||
| 20 | + avatarFrame = ""; | ||
| 21 | + headPhotoUrl = ""; | ||
| 22 | + subjectType = 0; | ||
| 23 | + liveLikeControl = 0; | ||
| 24 | + region = ""; | ||
| 25 | + isAttention = 0; | ||
| 26 | + cnContentPublish = 0; | ||
| 27 | + authIcon = ""; | ||
| 28 | + honoraryTitle = ""; | ||
| 29 | + videoCollectionCreation = 0; | ||
| 30 | + pictureCollectionCreation = 0; | ||
| 31 | + liveSwitch = 0; | ||
| 32 | + shareControl = 0; | ||
| 33 | + isComment = 0; | ||
| 34 | + district = ""; | ||
| 35 | + originUserId = ""; | ||
| 36 | + liveCommentControl = 0; | ||
| 37 | + posterShareControl = 0; | ||
| 38 | + honoraryIcon = ""; | ||
| 39 | + isLike = 0; | ||
| 40 | + registTime: number = 0; | ||
| 41 | + dynamicCreation = 0; | ||
| 42 | + userName = ""; | ||
| 43 | + attentionNum = 0; | ||
| 44 | + cnShareControl = 0; | ||
| 45 | + cnLivePublish = 0; | ||
| 46 | + categoryAuth = ""; | ||
| 47 | + cnLiveGiftControl = 0; | ||
| 48 | + city = ""; | ||
| 49 | + dynamicControl = 0; | ||
| 50 | + userType = ""; | ||
| 51 | + authTitle = ""; | ||
| 52 | + introduction = ""; | ||
| 53 | + liveShareControl = 0; | ||
| 54 | + authPersonal = ""; | ||
| 55 | + mainControl: number = -1; | ||
| 56 | +} |
| 1 | +import { SPHelper,Logger,ToastUtils } from 'wdKit'; | ||
| 2 | +import { ContentDetailDTO, Action, ContentDTO,batchLikeAndCollectResult } from 'wdBean'; | ||
| 3 | +import { ProcessUtils } from 'wdRouter'; | ||
| 4 | +import router from '@ohos.router'; | ||
| 5 | +import { batchLikeAndCollectParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | ||
| 6 | +import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | ||
| 7 | +import { SpConstants } from 'wdConstant/Index'; | ||
| 8 | +import { WDShare } from 'wdShare/Index'; | ||
| 9 | +import {LikeComponent} from './view/LikeComponent' | ||
| 10 | +const TAG = 'CarderInteraction' | ||
| 11 | +/** | ||
| 12 | + * 卡片 分享、评论、点赞公用组件 | ||
| 13 | + */ | ||
| 14 | +@Component | ||
| 15 | +export struct CarderInteraction { | ||
| 16 | + @Prop contentDTO: ContentDTO | ||
| 17 | + @State contentId: string = '' | ||
| 18 | + @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | ||
| 19 | + @State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult// 点赞、收藏状态 | ||
| 20 | + @State likeBean: Record<string, string> = {} | ||
| 21 | + async aboutToAppear() { | ||
| 22 | + await this.getContentDetailData() | ||
| 23 | + // 点赞需要数据 | ||
| 24 | + this.likeBean['contentId'] = this.contentDetailData.newsId + '' | ||
| 25 | + this.likeBean['userName'] = this.contentDetailData.userInfo?.userName + '' | ||
| 26 | + this.likeBean['contentType'] = this.contentDetailData.newsType + '' | ||
| 27 | + this.likeBean['title'] = this.contentDetailData.newsTitle + '' | ||
| 28 | + this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + '' | ||
| 29 | + this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' | ||
| 30 | + } | ||
| 31 | + build() { | ||
| 32 | + Row(){ | ||
| 33 | + Row(){ | ||
| 34 | + Image($r('app.media.CarderInteraction_share')) | ||
| 35 | + .width(18) | ||
| 36 | + .height(18) | ||
| 37 | + Text('分享') | ||
| 38 | + .margin({left:4}) | ||
| 39 | + .fontSize(14) | ||
| 40 | + .fontColor('#666666') | ||
| 41 | + } | ||
| 42 | + .justifyContent(FlexAlign.Center) | ||
| 43 | + .onClick(()=>{ | ||
| 44 | + WDShare.shareContent(this.contentDetailData) | ||
| 45 | + }) | ||
| 46 | + Row(){ | ||
| 47 | + Image($r('app.media.CarderInteraction_comment')) | ||
| 48 | + .width(18) | ||
| 49 | + .height(18) | ||
| 50 | + Text('评论') | ||
| 51 | + .margin({left:4}) | ||
| 52 | + .fontSize(14) | ||
| 53 | + .fontColor('#666666') | ||
| 54 | + } | ||
| 55 | + .justifyContent(FlexAlign.Center) | ||
| 56 | + .onClick(()=>{ | ||
| 57 | + ProcessUtils.processPage(this.contentDTO) | ||
| 58 | + }) | ||
| 59 | + this.builderLike() | ||
| 60 | + } | ||
| 61 | + .width('100%') | ||
| 62 | + .margin({top:11}) | ||
| 63 | + .padding({ | ||
| 64 | + left:21, | ||
| 65 | + right:21 | ||
| 66 | + }) | ||
| 67 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 68 | + .alignItems(VerticalAlign.Center) | ||
| 69 | + } | ||
| 70 | + /** | ||
| 71 | + * 点赞组件 | ||
| 72 | + */ | ||
| 73 | + @Builder | ||
| 74 | + builderLike() { | ||
| 75 | + Row(){ | ||
| 76 | + if (this.likeBean?.contentId) { | ||
| 77 | + LikeComponent({ | ||
| 78 | + data: this.likeBean, | ||
| 79 | + componentType: 3 | ||
| 80 | + }) | ||
| 81 | + } | ||
| 82 | + } | ||
| 83 | + .width(42) | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + /** | ||
| 87 | + * 请求(动态)详情页数据 | ||
| 88 | + * */ | ||
| 89 | + private async getContentDetailData() { | ||
| 90 | + try { | ||
| 91 | + let data = await MultiPictureDetailViewModel.getDetailData(this.contentDTO.relId, this.contentDTO.objectId, this.contentDTO.relType) | ||
| 92 | + this.contentDetailData = data[0]; | ||
| 93 | + console.log('动态详情',JSON.stringify(this.contentDetailData)) | ||
| 94 | + } catch (exception) { | ||
| 95 | + console.log('请求失败',JSON.stringify(exception)) | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | +} | ||
| 100 | + |
| @@ -61,6 +61,8 @@ export struct DynamicDetailComponent { | @@ -61,6 +61,8 @@ export struct DynamicDetailComponent { | ||
| 61 | @State isNetConnected: boolean = true | 61 | @State isNetConnected: boolean = true |
| 62 | @State isPageEnd: boolean = false | 62 | @State isPageEnd: boolean = false |
| 63 | 63 | ||
| 64 | + @State publishCommentModel: publishCommentModel = new publishCommentModel() | ||
| 65 | + | ||
| 64 | 66 | ||
| 65 | async aboutToAppear() { | 67 | async aboutToAppear() { |
| 66 | await this.getContentDetailData() | 68 | await this.getContentDetailData() |
| @@ -431,19 +433,13 @@ export struct DynamicDetailComponent { | @@ -431,19 +433,13 @@ export struct DynamicDetailComponent { | ||
| 431 | } | 433 | } |
| 432 | } | 434 | } |
| 433 | //底部交互区 | 435 | //底部交互区 |
| 434 | - OperRowListView({ contentDetailData: this.contentDetailData | ||
| 435 | - ,interactData:this.interactDataDTO | ||
| 436 | - ,newsStatusOfUser:this.newsStatusOfUser | ||
| 437 | - ,publishCommentModel: { | ||
| 438 | - targetId: String(this.contentDetailData?.newsId || ''), | ||
| 439 | - targetRelId: this.contentDetailData?.reLInfo?.relId, | ||
| 440 | - targetTitle: this.contentDetailData?.newsTitle, | ||
| 441 | - targetRelType: this.contentDetailData?.reLInfo?.relType, | ||
| 442 | - targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId), | ||
| 443 | - keyArticle: String(this.contentDetailData?.keyArticle), | ||
| 444 | - targetType: String(this.contentDetailData?.newsType), | ||
| 445 | - } as publishCommentModel | ||
| 446 | - ,needLike:false}) | 436 | + OperRowListView({ |
| 437 | + contentDetailData: this.contentDetailData, | ||
| 438 | + publishCommentModel: this.publishCommentModel, | ||
| 439 | + operationButtonList: ['comment', 'collect', 'share'], | ||
| 440 | + styleType: 1, | ||
| 441 | + }) | ||
| 442 | + | ||
| 447 | } | 443 | } |
| 448 | } | 444 | } |
| 449 | .alignSelf(ItemAlign.Start) | 445 | .alignSelf(ItemAlign.Start) |
| @@ -9,6 +9,7 @@ import font from '@ohos.font'; | @@ -9,6 +9,7 @@ import font from '@ohos.font'; | ||
| 9 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'; | 9 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'; |
| 10 | import { RMCalendarBean } from './calendar/RMCalendarBean'; | 10 | import { RMCalendarBean } from './calendar/RMCalendarBean'; |
| 11 | import { newsSkeleton } from './skeleton/newsSkeleton'; | 11 | import { newsSkeleton } from './skeleton/newsSkeleton'; |
| 12 | +import { Logger, ToastUtils } from 'wdKit/Index'; | ||
| 12 | 13 | ||
| 13 | @Component | 14 | @Component |
| 14 | export struct ENewspaperPageComponent { | 15 | export struct ENewspaperPageComponent { |
| @@ -150,7 +151,9 @@ export struct ENewspaperPageComponent { | @@ -150,7 +151,9 @@ export struct ENewspaperPageComponent { | ||
| 150 | center: { anchor: "__container__", align: VerticalAlign.Center } | 151 | center: { anchor: "__container__", align: VerticalAlign.Center } |
| 151 | }) | 152 | }) |
| 152 | .id('e_newspaper_share') | 153 | .id('e_newspaper_share') |
| 153 | - .visibility(Visibility.Hidden) | 154 | + .onClick(() => { |
| 155 | + ToastUtils.showToast('分享为公共方法,待开发', 1000); | ||
| 156 | + }) | ||
| 154 | } | 157 | } |
| 155 | .margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) | 158 | .margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) |
| 156 | .height($r('app.float.top_bar_height')) | 159 | .height($r('app.float.top_bar_height')) |
| @@ -194,6 +197,7 @@ export struct ENewspaperPageComponent { | @@ -194,6 +197,7 @@ export struct ENewspaperPageComponent { | ||
| 194 | top: { anchor: "e_newspaper_top", align: VerticalAlign.Bottom }, | 197 | top: { anchor: "e_newspaper_top", align: VerticalAlign.Bottom }, |
| 195 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 198 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| 196 | }) | 199 | }) |
| 200 | + .effectMode(EdgeEffect.None) | ||
| 197 | .onChange((index: number) => { | 201 | .onChange((index: number) => { |
| 198 | this.currentPageNum = this.newspaperListBean?.list[index]?.pageNum | 202 | this.currentPageNum = this.newspaperListBean?.list[index]?.pageNum |
| 199 | this.swiperIndex = index | 203 | this.swiperIndex = index |
| @@ -201,12 +205,12 @@ export struct ENewspaperPageComponent { | @@ -201,12 +205,12 @@ export struct ENewspaperPageComponent { | ||
| 201 | 205 | ||
| 202 | Image($r('app.media.newspaper_shadow')) | 206 | Image($r('app.media.newspaper_shadow')) |
| 203 | .height($r('app.float.vp_12')) | 207 | .height($r('app.float.vp_12')) |
| 204 | - .margin({ left: 20, right: 20, top: -1 }) | 208 | + .margin({ left: 10, right: 10, top: -1 }) |
| 205 | .objectFit(ImageFit.Contain) | 209 | .objectFit(ImageFit.Contain) |
| 206 | .alignRules({ | 210 | .alignRules({ |
| 207 | top: { anchor: "e_newspaper_content", align: VerticalAlign.Bottom }, | 211 | top: { anchor: "e_newspaper_content", align: VerticalAlign.Bottom }, |
| 208 | - left: { anchor: 'e_newspaper_content', align: HorizontalAlign.Start }, | ||
| 209 | - right: { anchor: 'e_newspaper_content', align: HorizontalAlign.End } | 212 | + // left: { anchor: 'e_newspaper_content', align: HorizontalAlign.Start }, |
| 213 | + // right: { anchor: 'e_newspaper_content', align: HorizontalAlign.End } | ||
| 210 | }) | 214 | }) |
| 211 | .id('e_newspaper_shadow') | 215 | .id('e_newspaper_shadow') |
| 212 | 216 | ||
| @@ -310,6 +314,8 @@ export struct ENewspaperPageComponent { | @@ -310,6 +314,8 @@ export struct ENewspaperPageComponent { | ||
| 310 | let newspaperTimes = await NewspaperViewModel.getNewspaperTime(this.calendarDate) | 314 | let newspaperTimes = await NewspaperViewModel.getNewspaperTime(this.calendarDate) |
| 311 | if (newspaperTimes && newspaperTimes.length > 0) { | 315 | if (newspaperTimes && newspaperTimes.length > 0) { |
| 312 | this.calendarDate = newspaperTimes[0].date | 316 | this.calendarDate = newspaperTimes[0].date |
| 317 | + this.selectDate = new Date(this.calendarDate) | ||
| 318 | + Logger.debug('ENewspaperPageComponent', this.calendarDate) | ||
| 313 | this.currentPageNum = '01' | 319 | this.currentPageNum = '01' |
| 314 | } | 320 | } |
| 315 | } | 321 | } |
| @@ -47,7 +47,8 @@ export struct ImageAndTextPageComponent { | @@ -47,7 +47,8 @@ export struct ImageAndTextPageComponent { | ||
| 47 | @State isPageEnd: boolean = false | 47 | @State isPageEnd: boolean = false |
| 48 | @State publishTime: string = '' | 48 | @State publishTime: string = '' |
| 49 | @State publishCommentModel: publishCommentModel = new publishCommentModel() | 49 | @State publishCommentModel: publishCommentModel = new publishCommentModel() |
| 50 | - @State operationButtonList: string[] = ['comment', 'collect', 'share'] | 50 | + // @State operationButtonList: string[] = ['comment', 'collect', 'share'] |
| 51 | + @State operationButtonList: string[] = [] | ||
| 51 | @State isNetConnected: boolean = true | 52 | @State isNetConnected: boolean = true |
| 52 | @State info: Area | null = null | 53 | @State info: Area | null = null |
| 53 | @State likeNum: number = 0 | 54 | @State likeNum: number = 0 |
| @@ -60,7 +61,7 @@ export struct ImageAndTextPageComponent { | @@ -60,7 +61,7 @@ export struct ImageAndTextPageComponent { | ||
| 60 | .height(28) | 61 | .height(28) |
| 61 | Text(this.publishTime) | 62 | Text(this.publishTime) |
| 62 | .fontColor($r('app.color.color_B0B0B0')) | 63 | .fontColor($r('app.color.color_B0B0B0')) |
| 63 | - .fontSize($r('app.float.font_size_13')) | 64 | + .fontSize(13) |
| 64 | } | 65 | } |
| 65 | .width(CommonConstants.FULL_WIDTH) | 66 | .width(CommonConstants.FULL_WIDTH) |
| 66 | .height(32) | 67 | .height(32) |
| @@ -151,7 +152,7 @@ export struct ImageAndTextPageComponent { | @@ -151,7 +152,7 @@ export struct ImageAndTextPageComponent { | ||
| 151 | 152 | ||
| 152 | } | 153 | } |
| 153 | .width(CommonConstants.FULL_WIDTH) | 154 | .width(CommonConstants.FULL_WIDTH) |
| 154 | - .height(CommonConstants.FULL_HEIGHT) | 155 | + // .height(CommonConstants.FULL_HEIGHT) |
| 155 | .padding({ bottom: 76 }) | 156 | .padding({ bottom: 76 }) |
| 156 | .scrollBar(BarState.Off) | 157 | .scrollBar(BarState.Off) |
| 157 | .align(Alignment.Top) | 158 | .align(Alignment.Top) |
| @@ -170,11 +171,14 @@ export struct ImageAndTextPageComponent { | @@ -170,11 +171,14 @@ export struct ImageAndTextPageComponent { | ||
| 170 | } | 171 | } |
| 171 | } | 172 | } |
| 172 | //底部交互区 | 173 | //底部交互区 |
| 173 | - OperRowListView({ | ||
| 174 | - contentDetailData: this.contentDetailData[0], | ||
| 175 | - publishCommentModel: this.publishCommentModel, | ||
| 176 | - operationButtonList: this.operationButtonList, | ||
| 177 | - }) | 174 | + if (this.operationButtonList.length) { |
| 175 | + OperRowListView({ | ||
| 176 | + contentDetailData: this.contentDetailData[0], | ||
| 177 | + publishCommentModel: this.publishCommentModel, | ||
| 178 | + operationButtonList: this.operationButtonList, | ||
| 179 | + styleType: 1, | ||
| 180 | + }) | ||
| 181 | + } | ||
| 178 | } | 182 | } |
| 179 | 183 | ||
| 180 | } | 184 | } |
| @@ -224,8 +228,11 @@ export struct ImageAndTextPageComponent { | @@ -224,8 +228,11 @@ export struct ImageAndTextPageComponent { | ||
| 224 | this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle) | 228 | this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle) |
| 225 | this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType) | 229 | this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType) |
| 226 | } | 230 | } |
| 227 | - if (this.contentDetailData[0]?.audioList?.length && this.contentDetailData[0]?.audioList[0].audioUrl) { | 231 | + if (this.contentDetailData[0]?.openAudio && this.contentDetailData[0]?.audioList?.length && |
| 232 | + this.contentDetailData[0]?.audioList[0].audioUrl) { | ||
| 228 | this.operationButtonList = ['comment', 'collect', 'listen', 'share'] | 233 | this.operationButtonList = ['comment', 'collect', 'listen', 'share'] |
| 234 | + } else { | ||
| 235 | + this.operationButtonList = ['comment', 'collect', 'share'] | ||
| 229 | } | 236 | } |
| 230 | } | 237 | } |
| 231 | } | 238 | } |
| @@ -34,6 +34,7 @@ export struct ImageAndTextWebComponent { | @@ -34,6 +34,7 @@ export struct ImageAndTextWebComponent { | ||
| 34 | let sourcePage: string = '5' | 34 | let sourcePage: string = '5' |
| 35 | let creatorId = await SPHelper.default.get(SpConstants.USER_CREATOR_ID, '') || '' | 35 | let creatorId = await SPHelper.default.get(SpConstants.USER_CREATOR_ID, '') || '' |
| 36 | let isLogin = await SPHelper.default.get(SpConstants.USER_STATUS, '') || '0' | 36 | let isLogin = await SPHelper.default.get(SpConstants.USER_STATUS, '') || '0' |
| 37 | + let loadImageOnlyWifiSwitch = await SPHelper.default.get(SpConstants.SETTING_WIFI_IMAGE_SWITCH, '') || false | ||
| 37 | if (this.action.params) { | 38 | if (this.action.params) { |
| 38 | if (this.action.params.contentID) { | 39 | if (this.action.params.contentID) { |
| 39 | contentId = this.action.params?.contentID | 40 | contentId = this.action.params?.contentID |
| @@ -63,8 +64,8 @@ export struct ImageAndTextWebComponent { | @@ -63,8 +64,8 @@ export struct ImageAndTextWebComponent { | ||
| 63 | creatorId: creatorId, | 64 | creatorId: creatorId, |
| 64 | cnsTraceId: '', | 65 | cnsTraceId: '', |
| 65 | isLogin: isLogin, | 66 | isLogin: isLogin, |
| 66 | - loadImageOnlyWifiSwitch: '2', | ||
| 67 | - networkStatus: Number(NetworkUtil.isNetConnected()), | 67 | + loadImageOnlyWifiSwitch: loadImageOnlyWifiSwitch ? '1' : '2', |
| 68 | + networkStatus: Number(NetworkUtil.getNetworkType()), | ||
| 68 | darkMode: 'light', | 69 | darkMode: 'light', |
| 69 | fontSizes: 'small' | 70 | fontSizes: 'small' |
| 70 | 71 |
| 1 | // import { FrontLinkObject, MorningEveningPaperDTO, PageInfoBean } from 'wdBean'; | 1 | // import { FrontLinkObject, MorningEveningPaperDTO, PageInfoBean } from 'wdBean'; |
| 2 | -import { CompList, PageInfoBean } from 'wdBean'; | 2 | +import { |
| 3 | + CompList, | ||
| 4 | + PageInfoBean, | ||
| 5 | + ContentDTO, | ||
| 6 | + contentListParams, | ||
| 7 | + InteractDataDTO | ||
| 8 | +} from 'wdBean'; | ||
| 3 | import { DateTimeUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index'; | 9 | import { DateTimeUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index'; |
| 4 | import { PaperReaderSimpleDialog } from '../../dialog/PaperReaderDialog'; | 10 | import { PaperReaderSimpleDialog } from '../../dialog/PaperReaderDialog'; |
| 5 | import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel'; | 11 | import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel'; |
| @@ -13,6 +19,8 @@ import { image } from '@kit.ImageKit'; | @@ -13,6 +19,8 @@ import { image } from '@kit.ImageKit'; | ||
| 13 | import { getPicture, imageNet2PixelMap } from '../../utils/ImageUtils'; | 19 | import { getPicture, imageNet2PixelMap } from '../../utils/ImageUtils'; |
| 14 | import { effectKit } from '@kit.ArkGraphics2D'; | 20 | import { effectKit } from '@kit.ArkGraphics2D'; |
| 15 | import { window } from '@kit.ArkUI'; | 21 | import { window } from '@kit.ArkUI'; |
| 22 | +import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel'; | ||
| 23 | +import { AudioSuspensionModel } from '../../viewmodel/AudioSuspensionModel' | ||
| 16 | 24 | ||
| 17 | const TAG = 'MorningEveningPaperComponent'; | 25 | const TAG = 'MorningEveningPaperComponent'; |
| 18 | 26 | ||
| @@ -22,6 +30,7 @@ export struct MorningEveningPaperComponent { | @@ -22,6 +30,7 @@ export struct MorningEveningPaperComponent { | ||
| 22 | @State pageInfoBean: PageInfoBean = {} as PageInfoBean | 30 | @State pageInfoBean: PageInfoBean = {} as PageInfoBean |
| 23 | // @State compInfoBean: CompInfoBean = {} as CompInfoBean | 31 | // @State compInfoBean: CompInfoBean = {} as CompInfoBean |
| 24 | @State compListItem: CompList = {} as CompList | 32 | @State compListItem: CompList = {} as CompList |
| 33 | + @Provide commentList: InteractDataDTO[] = [] | ||
| 25 | @State audioPlayUrl: string = "" | 34 | @State audioPlayUrl: string = "" |
| 26 | // @Consume dailyPaperTopicPageId: number | 35 | // @Consume dailyPaperTopicPageId: number |
| 27 | // @Provide compListItem: CompList = {} as CompList | 36 | // @Provide compListItem: CompList = {} as CompList |
| @@ -66,6 +75,7 @@ export struct MorningEveningPaperComponent { | @@ -66,6 +75,7 @@ export struct MorningEveningPaperComponent { | ||
| 66 | offset: { dx: 12, dy: -150 }, | 75 | offset: { dx: 12, dy: -150 }, |
| 67 | 76 | ||
| 68 | }) | 77 | }) |
| 78 | + private AudioSuspension = new AudioSuspensionModel() | ||
| 69 | 79 | ||
| 70 | onCancel() { | 80 | onCancel() { |
| 71 | Logger.info(TAG, "cj2024 onCancel = ") | 81 | Logger.info(TAG, "cj2024 onCancel = ") |
| @@ -128,6 +138,10 @@ export struct MorningEveningPaperComponent { | @@ -128,6 +138,10 @@ export struct MorningEveningPaperComponent { | ||
| 128 | // this.compInfoBean = compInfoBean | 138 | // this.compInfoBean = compInfoBean |
| 129 | if (compInfoBean?.compList[0]) { | 139 | if (compInfoBean?.compList[0]) { |
| 130 | this.compListItem = compInfoBean?.compList[0] | 140 | this.compListItem = compInfoBean?.compList[0] |
| 141 | + Logger.debug(TAG, '获取评论数据' + `${this.compListItem.operDataList.length}`) | ||
| 142 | + if (this.compListItem.operDataList && this.compListItem.operDataList.length > 0) { | ||
| 143 | + this.getAllContentInteractData(this.compListItem.operDataList) | ||
| 144 | + } | ||
| 131 | if (compInfoBean?.compList[0].audioDataList) { | 145 | if (compInfoBean?.compList[0].audioDataList) { |
| 132 | this.audioPlayUrl = compInfoBean?.compList[0].audioDataList[0].audioUrl | 146 | this.audioPlayUrl = compInfoBean?.compList[0].audioDataList[0].audioUrl |
| 133 | this.audioTitle = compInfoBean?.compList[0].audioDataList[0].title | 147 | this.audioTitle = compInfoBean?.compList[0].audioDataList[0].title |
| @@ -146,6 +160,29 @@ export struct MorningEveningPaperComponent { | @@ -146,6 +160,29 @@ export struct MorningEveningPaperComponent { | ||
| 146 | 160 | ||
| 147 | } | 161 | } |
| 148 | 162 | ||
| 163 | + // 批量查询内容当前用户点赞、收藏状态评论个数 | ||
| 164 | + private async getAllContentInteractData(list: ContentDTO[]) { | ||
| 165 | + try { | ||
| 166 | + // 获取列表数据 | ||
| 167 | + const params: contentListParams = { | ||
| 168 | + contentList: [] | ||
| 169 | + } | ||
| 170 | + list.forEach((item: ContentDTO) => { | ||
| 171 | + params.contentList.push({ | ||
| 172 | + contentId: item.objectId, | ||
| 173 | + contentType: Number(item.objectType ?? '1') | ||
| 174 | + }) | ||
| 175 | + }) | ||
| 176 | + Logger.debug(TAG, '获取评论数据' + `${JSON.stringify(params)}`) | ||
| 177 | + | ||
| 178 | + this.commentList = await PeopleShipMainViewModel.getContentInteractInfo(params) | ||
| 179 | + Logger.debug(TAG, '获取评论数据' + `${JSON.stringify(this.commentList)}`) | ||
| 180 | + | ||
| 181 | + } catch (exception) { | ||
| 182 | + | ||
| 183 | + } | ||
| 184 | + } | ||
| 185 | + | ||
| 149 | async setComponentBgColor(imageUrl: string) { | 186 | async setComponentBgColor(imageUrl: string) { |
| 150 | // 图片转换为PixelMap对象 | 187 | // 图片转换为PixelMap对象 |
| 151 | // const pixelMap: image.PixelMap = await image2PixelMap(item.icon); | 188 | // const pixelMap: image.PixelMap = await image2PixelMap(item.icon); |
| @@ -203,7 +240,9 @@ export struct MorningEveningPaperComponent { | @@ -203,7 +240,9 @@ export struct MorningEveningPaperComponent { | ||
| 203 | } | 240 | } |
| 204 | 241 | ||
| 205 | ListItem() { | 242 | ListItem() { |
| 206 | - SingleColumn999Component({ compListItem: this.compListItem }) | 243 | + SingleColumn999Component({ |
| 244 | + compListItem: this.compListItem, | ||
| 245 | + }) | ||
| 207 | .margin({ | 246 | .margin({ |
| 208 | top: this.pageInfoBean?.topicInfo?.frontLinkObject ? 10 : 44 | 247 | top: this.pageInfoBean?.topicInfo?.frontLinkObject ? 10 : 44 |
| 209 | }) | 248 | }) |
| @@ -261,8 +300,9 @@ export struct MorningEveningPaperComponent { | @@ -261,8 +300,9 @@ export struct MorningEveningPaperComponent { | ||
| 261 | .objectFit(ImageFit.Contain) | 300 | .objectFit(ImageFit.Contain) |
| 262 | .onClick(() => { | 301 | .onClick(() => { |
| 263 | Logger.info("TAG", "cj compInfoBean onClick1 = " + this.isAudioPlaying) | 302 | Logger.info("TAG", "cj compInfoBean onClick1 = " + this.isAudioPlaying) |
| 264 | - dialog.open() | ||
| 265 | - this.playerController.firstPlay(this.audioPlayUrl) | 303 | + // dialog.open() |
| 304 | + this.AudioSuspension.showWindow() | ||
| 305 | + // this.playerController.firstPlay(this.audioPlayUrl) | ||
| 266 | Logger.info("TAG", "cj compInfoBean onClick2 = " + this.isAudioPlaying) | 306 | Logger.info("TAG", "cj compInfoBean onClick2 = " + this.isAudioPlaying) |
| 267 | }) | 307 | }) |
| 268 | } | 308 | } |
| @@ -27,35 +27,51 @@ export struct PaperTitleComponent { | @@ -27,35 +27,51 @@ export struct PaperTitleComponent { | ||
| 27 | 27 | ||
| 28 | Row() { | 28 | Row() { |
| 29 | // 在 29 * 18 的矩形框中绘制一个三角形,起点(0, 0),经过(0, 18),经过(20, 18),终点(29, 0) | 29 | // 在 29 * 18 的矩形框中绘制一个三角形,起点(0, 0),经过(0, 18),经过(20, 18),终点(29, 0) |
| 30 | - Polygon({ width: 29, height: 18 }) | ||
| 31 | - .points([[0, 0], [0, 18], [20, 18], [29, 0]])// .fill(Color.White) | ||
| 32 | - .fillOpacity(0.2) | ||
| 33 | - .fill(Color.White) | 30 | + // Polygon({ width: 29, height: 18 }) |
| 31 | + // .points([[0, 0], [0, 18], [20, 18], [29, 0]])// .fill(Color.White) | ||
| 32 | + // .fillOpacity(0.2) | ||
| 33 | + // .fill(Color.White) | ||
| 34 | // .linearGradient({ | 34 | // .linearGradient({ |
| 35 | // direction: GradientDirection.Right, | 35 | // direction: GradientDirection.Right, |
| 36 | // colors: [[0xffffff, 1.0], [0xffffff, 0.75], [0xffffff, 0.5], [0xffffff, 0.0], [0xffffff, 0.0]] | 36 | // colors: [[0xffffff, 1.0], [0xffffff, 0.75], [0xffffff, 0.5], [0xffffff, 0.0], [0xffffff, 0.0]] |
| 37 | // }) | 37 | // }) |
| 38 | + Row() | ||
| 39 | + .width('29vp') | ||
| 40 | + .height('18vp') | ||
| 41 | + .clip(new Path({ | ||
| 42 | + commands: `M0 0 H${vp2px(29)} L${vp2px(20)} ${vp2px(18)} L0 ${vp2px(18)} Z` | ||
| 43 | + })) | ||
| 44 | + .linearGradient({ | ||
| 45 | + direction: GradientDirection.Right, // 渐变方向 | ||
| 46 | + repeating: false, // 渐变颜色是否重复 | ||
| 47 | + colors: [[0x1affffff, 0.0],[0x1affffff, 0.3], [0x33ffffff, 0.6], [0x4dffffff,1]] // 数组末尾元素占比小于1时满足重复着色效果 | ||
| 48 | + }) | ||
| 49 | + | ||
| 38 | Text(this.title ?? "") | 50 | Text(this.title ?? "") |
| 39 | - .margin({ left: 5 }) | ||
| 40 | - .fontSize(20) | 51 | + .margin({ left: 10 }) |
| 52 | + .fontSize(22) | ||
| 41 | .fontColor($r('app.color.white')) | 53 | .fontColor($r('app.color.white')) |
| 54 | + .fontWeight(900) | ||
| 42 | .maxLines(1) | 55 | .maxLines(1) |
| 43 | 56 | ||
| 57 | + | ||
| 44 | Text(this.subTitle ?? '')// Text('2024年\n1月16日') | 58 | Text(this.subTitle ?? '')// Text('2024年\n1月16日') |
| 45 | // .width(50) | 59 | // .width(50) |
| 46 | - .margin({ left: 5 }) | ||
| 47 | - .fontSize(8) | 60 | + .margin({ left: 6 }) |
| 61 | + .fontSize(10) | ||
| 48 | .fontColor($r('app.color.white')) | 62 | .fontColor($r('app.color.white')) |
| 49 | .maxLines(2) | 63 | .maxLines(2) |
| 64 | + .textAlign(TextAlign.End) | ||
| 50 | this.rightDecorateBuilder() | 65 | this.rightDecorateBuilder() |
| 51 | // .linearGradient({ | 66 | // .linearGradient({ |
| 52 | // direction: GradientDirection.Right, | 67 | // direction: GradientDirection.Right, |
| 53 | // colors: [[0x4Dffffff, 1.0], [0x4Dffffff, 0.75], [0x4Dffffff, 0.5], [0x4Dffffff, 0.75], [0x1ffffff, 0.0]] | 68 | // colors: [[0x4Dffffff, 1.0], [0x4Dffffff, 0.75], [0x4Dffffff, 0.5], [0x4Dffffff, 0.75], [0x1ffffff, 0.0]] |
| 54 | // }) | 69 | // }) |
| 55 | - Image($r('app.media.bg_event_status_end')) | ||
| 56 | - .height($r('app.float.top_arrow_size')) | ||
| 57 | - .width(100) | ||
| 58 | - .visibility(Visibility.None) | 70 | + // Image($r('app.media.bg_event_status_end')) |
| 71 | + // .height($r('app.float.top_arrow_size')) | ||
| 72 | + // .width(100) | ||
| 73 | + // .visibility(Visibility.None) | ||
| 74 | + | ||
| 59 | } | 75 | } |
| 60 | .height('100%') | 76 | .height('100%') |
| 61 | .alignItems(VerticalAlign.Center) | 77 | .alignItems(VerticalAlign.Center) |
| @@ -87,7 +103,7 @@ export struct PaperTitleComponent { | @@ -87,7 +103,7 @@ export struct PaperTitleComponent { | ||
| 87 | center: { anchor: "__container__", align: VerticalAlign.Center } | 103 | center: { anchor: "__container__", align: VerticalAlign.Center } |
| 88 | }) | 104 | }) |
| 89 | .id('img_share') | 105 | .id('img_share') |
| 90 | - .margin({ right: 13 }) | 106 | + .margin({ right: 16 }) |
| 91 | .onClick(() => { | 107 | .onClick(() => { |
| 92 | ToastUtils.showToast('分享为公共方法,待开发', 1000) | 108 | ToastUtils.showToast('分享为公共方法,待开发', 1000) |
| 93 | }) | 109 | }) |
| @@ -105,19 +121,32 @@ export struct PaperTitleComponent { | @@ -105,19 +121,32 @@ export struct PaperTitleComponent { | ||
| 105 | 121 | ||
| 106 | @Builder | 122 | @Builder |
| 107 | rightDecorateBuilder() { | 123 | rightDecorateBuilder() { |
| 108 | - Row() { | ||
| 109 | - Polygon({ width: 20, height: 18 }) | ||
| 110 | - .points([[8, 0], [0, 18], [20, 18], [20, 0]])// .fill(Color.White) | ||
| 111 | - .fillOpacity(0.3) | ||
| 112 | - .fill(Color.White) | ||
| 113 | - Rect({ width: 80, height: 18 })// .fillOpacity(0.3) | ||
| 114 | - .fill(Color.White) | ||
| 115 | - .fillOpacity(0.01) | 124 | + Row() |
| 125 | + .width('100vp') | ||
| 126 | + .height('18vp') | ||
| 127 | + .clip(new Path({ | ||
| 128 | + commands: `M${vp2px(9)} 0 H${vp2px(91)} V${vp2px(18)} L0 ${vp2px(18)} Z` | ||
| 129 | + })) | ||
| 116 | .linearGradient({ | 130 | .linearGradient({ |
| 117 | - direction: GradientDirection.Right, | ||
| 118 | - colors: [[0x4Dffffff, 1.0], [0x4Dffffff, 0.75], [0x4Dffffff, 0.5], [0x40ffffff, 0.25], [0x1ffffff, 0.0]] | 131 | + direction: GradientDirection.Right, // 渐变方向 |
| 132 | + repeating: false, // 渐变颜色是否重复 | ||
| 133 | + colors: [[0x4dffffff, 0.0], [0x33ffffff, 0.3], [0x1affffff,0.6], [0x03ffffff,1]] // 数组末尾元素占比小于1时满足重复着色效果 | ||
| 119 | }) | 134 | }) |
| 120 | - } | ||
| 121 | - .margin({ left: 6 }) | 135 | + .margin({ left:8, right: 0}) |
| 136 | + | ||
| 137 | + // Row() { | ||
| 138 | + // Polygon({ width: 20, height: 18 }) | ||
| 139 | + // .points([[8, 0], [0, 18], [20, 18], [20, 0]])// .fill(Color.White) | ||
| 140 | + // .fillOpacity(0.3) | ||
| 141 | + // .fill(Color.White) | ||
| 142 | + // Rect({ width: 80, height: 18 })// .fillOpacity(0.3) | ||
| 143 | + // .fill(Color.White) | ||
| 144 | + // .fillOpacity(0.01) | ||
| 145 | + // .linearGradient({ | ||
| 146 | + // direction: GradientDirection.Right, | ||
| 147 | + // colors: [[0x4Dffffff, 1.0], [0x4Dffffff, 0.75], [0x4Dffffff, 0.5], [0x40ffffff, 0.25], [0x1ffffff, 0.0]] | ||
| 148 | + // }) | ||
| 149 | + // } | ||
| 150 | + // .margin({ left: 6 }) | ||
| 122 | } | 151 | } |
| 123 | } | 152 | } |
| 1 | -import { CompList, ContentDTO } from 'wdBean'; | 1 | +import { it } from '@ohos/hypium'; |
| 2 | +import { CompList, ContentDTO, InteractDataDTO} from 'wdBean'; | ||
| 2 | import { BreakpointConstants } from 'wdConstant'; | 3 | import { BreakpointConstants } from 'wdConstant'; |
| 3 | import { Logger } from 'wdKit'; | 4 | import { Logger } from 'wdKit'; |
| 4 | import { PaperSingleColumn999CardView } from '../page/CardView'; | 5 | import { PaperSingleColumn999CardView } from '../page/CardView'; |
| @@ -13,6 +14,7 @@ const TAG = 'SingleColumn999Component'; | @@ -13,6 +14,7 @@ const TAG = 'SingleColumn999Component'; | ||
| 13 | export struct SingleColumn999Component { | 14 | export struct SingleColumn999Component { |
| 14 | // @Consume compListItem?: CompList | 15 | // @Consume compListItem?: CompList |
| 15 | @Prop compListItem?: CompList | 16 | @Prop compListItem?: CompList |
| 17 | + | ||
| 16 | @StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS; | 18 | @StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS; |
| 17 | 19 | ||
| 18 | // @State compDTO: CompDTO = { | 20 | // @State compDTO: CompDTO = { |
| @@ -122,8 +124,6 @@ export struct SingleColumn999Component { | @@ -122,8 +124,6 @@ export struct SingleColumn999Component { | ||
| 122 | this.buildPaperItem(item, index) | 124 | this.buildPaperItem(item, index) |
| 123 | } | 125 | } |
| 124 | }, (item: ContentDTO, index: number) => JSON.stringify(item)) | 126 | }, (item: ContentDTO, index: number) => JSON.stringify(item)) |
| 125 | - // } | ||
| 126 | - // .divider({ strokeWidth: 1, color: '#EFEFEF' }) // 每行之间的分界线 | ||
| 127 | 127 | ||
| 128 | ListItem() { | 128 | ListItem() { |
| 129 | Text("已显示全部内容") | 129 | Text("已显示全部内容") |
| @@ -170,7 +170,7 @@ export struct SingleColumn999Component { | @@ -170,7 +170,7 @@ export struct SingleColumn999Component { | ||
| 170 | buildPaperItem(item: ContentDTO, index: number) { | 170 | buildPaperItem(item: ContentDTO, index: number) { |
| 171 | PaperSingleColumn999CardView({ | 171 | PaperSingleColumn999CardView({ |
| 172 | item: item, | 172 | item: item, |
| 173 | - index: index | 173 | + index: index, |
| 174 | }) | 174 | }) |
| 175 | } | 175 | } |
| 176 | } | 176 | } |
| @@ -364,6 +364,7 @@ export struct MultiPictureDetailPageComponent { | @@ -364,6 +364,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 364 | contentDetailData: this.contentDetailData, | 364 | contentDetailData: this.contentDetailData, |
| 365 | publishCommentModel: this.publishCommentModel, | 365 | publishCommentModel: this.publishCommentModel, |
| 366 | operationButtonList: this.operationButtonList, | 366 | operationButtonList: this.operationButtonList, |
| 367 | + styleType: 2, | ||
| 367 | }) | 368 | }) |
| 368 | } | 369 | } |
| 369 | .transition(TransitionEffect.OPACITY.animation({ duration: this.duration, curve: Curve.Ease }).combine( | 370 | .transition(TransitionEffect.OPACITY.animation({ duration: this.duration, curve: Curve.Ease }).combine( |
| @@ -23,6 +23,7 @@ export struct SpacialTopicPageComponent { | @@ -23,6 +23,7 @@ export struct SpacialTopicPageComponent { | ||
| 23 | private webPrepared = false; | 23 | private webPrepared = false; |
| 24 | private dataPrepared = false; | 24 | private dataPrepared = false; |
| 25 | @State publishCommentModel: publishCommentModel = new publishCommentModel() | 25 | @State publishCommentModel: publishCommentModel = new publishCommentModel() |
| 26 | + @State operationButtonList: string[] = ['comment', 'collect', 'share'] | ||
| 26 | 27 | ||
| 27 | private trySendData2H5() { | 28 | private trySendData2H5() { |
| 28 | if (!this.webPrepared || !this.dataPrepared) { | 29 | if (!this.webPrepared || !this.dataPrepared) { |
| @@ -63,7 +64,7 @@ export struct SpacialTopicPageComponent { | @@ -63,7 +64,7 @@ export struct SpacialTopicPageComponent { | ||
| 63 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) | 64 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) |
| 64 | if (detailBeans && detailBeans.length > 0) { | 65 | if (detailBeans && detailBeans.length > 0) { |
| 65 | this.contentDetailData = detailBeans; | 66 | this.contentDetailData = detailBeans; |
| 66 | - if (this.contentDetailData[0]?.openComment) { | 67 | + // if (this.contentDetailData[0]?.openComment) { |
| 67 | this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '') | 68 | this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '') |
| 68 | this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId) | 69 | this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId) |
| 69 | this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle | 70 | this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle |
| @@ -71,7 +72,7 @@ export struct SpacialTopicPageComponent { | @@ -71,7 +72,7 @@ export struct SpacialTopicPageComponent { | ||
| 71 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId) | 72 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId) |
| 72 | this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle) | 73 | this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle) |
| 73 | this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType) | 74 | this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType) |
| 74 | - } | 75 | + // } |
| 75 | this.trySendData2H5() | 76 | this.trySendData2H5() |
| 76 | } | 77 | } |
| 77 | } | 78 | } |
| @@ -91,6 +92,7 @@ export struct SpacialTopicPageComponent { | @@ -91,6 +92,7 @@ export struct SpacialTopicPageComponent { | ||
| 91 | } | 92 | } |
| 92 | .width(CommonConstants.FULL_WIDTH) | 93 | .width(CommonConstants.FULL_WIDTH) |
| 93 | .height(CommonConstants.FULL_HEIGHT) | 94 | .height(CommonConstants.FULL_HEIGHT) |
| 95 | + .padding({bottom:75}) | ||
| 94 | 96 | ||
| 95 | if (!this.isPageEnd) { | 97 | if (!this.isPageEnd) { |
| 96 | detailedSkeleton() | 98 | detailedSkeleton() |
| @@ -98,7 +100,8 @@ export struct SpacialTopicPageComponent { | @@ -98,7 +100,8 @@ export struct SpacialTopicPageComponent { | ||
| 98 | //底部交互区 | 100 | //底部交互区 |
| 99 | OperRowListView({ | 101 | OperRowListView({ |
| 100 | contentDetailData: this.contentDetailData[0], | 102 | contentDetailData: this.contentDetailData[0], |
| 101 | - publishCommentModel: this.publishCommentModel | 103 | + publishCommentModel: this.publishCommentModel, |
| 104 | + operationButtonList: this.operationButtonList, | ||
| 102 | }) | 105 | }) |
| 103 | } | 106 | } |
| 104 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | 107 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) |
| 1 | import { RMCalendarBean } from './RMCalendarBean' | 1 | import { RMCalendarBean } from './RMCalendarBean' |
| 2 | import { RMCalenderCell } from './RMCalendarCell' | 2 | import { RMCalenderCell } from './RMCalendarCell' |
| 3 | 3 | ||
| 4 | -const TAG = "RMCalendar" | ||
| 5 | - | ||
| 6 | @Component | 4 | @Component |
| 7 | export struct RMCalendar { | 5 | export struct RMCalendar { |
| 8 | @State selectItem: RMCalendarBean = new RMCalendarBean() | 6 | @State selectItem: RMCalendarBean = new RMCalendarBean() |
| @@ -12,6 +10,9 @@ export struct RMCalendar { | @@ -12,6 +10,9 @@ export struct RMCalendar { | ||
| 12 | startDate: Date = new Date() | 10 | startDate: Date = new Date() |
| 13 | // 截止日期 | 11 | // 截止日期 |
| 14 | endDate: Date = new Date() | 12 | endDate: Date = new Date() |
| 13 | + // 当前时间 | ||
| 14 | + private nowDate: Date = new Date() | ||
| 15 | + | ||
| 15 | //当前日期-当前显示的月份的第一天 | 16 | //当前日期-当前显示的月份的第一天 |
| 16 | // private startDay: Date = new Date( | 17 | // private startDay: Date = new Date( |
| 17 | // this.selectDay.getFullYear(), | 18 | // this.selectDay.getFullYear(), |
| @@ -50,6 +51,8 @@ export struct RMCalendar { | @@ -50,6 +51,8 @@ export struct RMCalendar { | ||
| 50 | selectFontColor: ResourceColor = "#FFFFFF" | 51 | selectFontColor: ResourceColor = "#FFFFFF" |
| 51 | // 选中日期背景颜色, 默认与selectDayFontColor一致 | 52 | // 选中日期背景颜色, 默认与selectDayFontColor一致 |
| 52 | selectItemBgColor: ResourceColor = "#ED2800" | 53 | selectItemBgColor: ResourceColor = "#ED2800" |
| 54 | + // 当前日期未选中颜色 | ||
| 55 | + nowFontColor: ResourceColor = "#ED2800" | ||
| 53 | @State private title: string = '' | 56 | @State private title: string = '' |
| 54 | // 计算的总加载 | 57 | // 计算的总加载 |
| 55 | @State dates: Array<RMCalendarBean> = new Array() | 58 | @State dates: Array<RMCalendarBean> = new Array() |
| @@ -96,6 +99,7 @@ export struct RMCalendar { | @@ -96,6 +99,7 @@ export struct RMCalendar { | ||
| 96 | disabledFontColor: this.disabledFontColor, | 99 | disabledFontColor: this.disabledFontColor, |
| 97 | hasPre: this.hasPre, | 100 | hasPre: this.hasPre, |
| 98 | hasNext: this.hasNext, | 101 | hasNext: this.hasNext, |
| 102 | + nowFontColor: this.nowFontColor, | ||
| 99 | disableClick: (item: RMCalendarBean) => { | 103 | disableClick: (item: RMCalendarBean) => { |
| 100 | if (this.disableCellClick) { | 104 | if (this.disableCellClick) { |
| 101 | this.disableCellClick(item) | 105 | this.disableCellClick(item) |
| @@ -229,6 +233,8 @@ export struct RMCalendar { | @@ -229,6 +233,8 @@ export struct RMCalendar { | ||
| 229 | // 补齐上一个月差的天数,需要在当月展示的部分,下面计算日期循环加1天 | 233 | // 补齐上一个月差的天数,需要在当月展示的部分,下面计算日期循环加1天 |
| 230 | tempDate.setDate(this.selectDay.getDate() - preCount) | 234 | tempDate.setDate(this.selectDay.getDate() - preCount) |
| 231 | 235 | ||
| 236 | + // 当前时间除去时分秒 | ||
| 237 | + this.nowDate.setHours(0,0,0,0) | ||
| 232 | // 添加当月需要展示的日期 | 238 | // 添加当月需要展示的日期 |
| 233 | for (let index = 0; index < totalCount; index++) { | 239 | for (let index = 0; index < totalCount; index++) { |
| 234 | let item = new RMCalendarBean( | 240 | let item = new RMCalendarBean( |
| @@ -241,6 +247,7 @@ export struct RMCalendar { | @@ -241,6 +247,7 @@ export struct RMCalendar { | ||
| 241 | // LunarCalendar.convertSolarToLunar(tempDate), | 247 | // LunarCalendar.convertSolarToLunar(tempDate), |
| 242 | (index < preCount ? true : false) || this.startDate.getTime() > tempDate.getTime(), | 248 | (index < preCount ? true : false) || this.startDate.getTime() > tempDate.getTime(), |
| 243 | (index >= preCount + count ? true : false) || this.endDate.getTime() < tempDate.getTime(), | 249 | (index >= preCount + count ? true : false) || this.endDate.getTime() < tempDate.getTime(), |
| 250 | + tempDate.getTime() == this.nowDate.getTime() | ||
| 244 | ) | 251 | ) |
| 245 | if (this.reBuildDateItem) { | 252 | if (this.reBuildDateItem) { |
| 246 | this.reBuildDateItem(item) | 253 | this.reBuildDateItem(item) |
| @@ -7,12 +7,14 @@ export class RMCalendarBean { | @@ -7,12 +7,14 @@ export class RMCalendarBean { | ||
| 7 | time?: number | 7 | time?: number |
| 8 | isPre?: boolean // 是否是上一个月的 / 在startDate 之前 | 8 | isPre?: boolean // 是否是上一个月的 / 在startDate 之前 |
| 9 | isNext?: boolean // 是否是下一个月的 / 在endDate 之后 | 9 | isNext?: boolean // 是否是下一个月的 / 在endDate 之后 |
| 10 | + isNow?: boolean // 是否是当前时间 | ||
| 10 | 11 | ||
| 11 | constructor(fullYear?: number, month?: number, | 12 | constructor(fullYear?: number, month?: number, |
| 12 | - date?: number, day?: number, | ||
| 13 | - time?: number, | ||
| 14 | - isPre?: boolean, | ||
| 15 | - isNext?: boolean) { | 13 | + date?: number, day?: number, |
| 14 | + time?: number, | ||
| 15 | + isPre?: boolean, | ||
| 16 | + isNext?: boolean, | ||
| 17 | + isNow?: boolean) { | ||
| 16 | this.fullYear = fullYear | 18 | this.fullYear = fullYear |
| 17 | this.month = month | 19 | this.month = month |
| 18 | this.date = date | 20 | this.date = date |
| @@ -20,5 +22,6 @@ export class RMCalendarBean { | @@ -20,5 +22,6 @@ export class RMCalendarBean { | ||
| 20 | this.time = time | 22 | this.time = time |
| 21 | this.isPre = isPre | 23 | this.isPre = isPre |
| 22 | this.isNext = isNext | 24 | this.isNext = isNext |
| 25 | + this.isNow = isNow | ||
| 23 | } | 26 | } |
| 24 | } | 27 | } |
| @@ -11,6 +11,7 @@ export struct RMCalenderCell { | @@ -11,6 +11,7 @@ export struct RMCalenderCell { | ||
| 11 | selectFontColor: ResourceColor = {} as ResourceColor | 11 | selectFontColor: ResourceColor = {} as ResourceColor |
| 12 | selectItemBgColor: ResourceColor = {} as ResourceColor | 12 | selectItemBgColor: ResourceColor = {} as ResourceColor |
| 13 | disabledFontColor: ResourceColor = {} as ResourceColor | 13 | disabledFontColor: ResourceColor = {} as ResourceColor |
| 14 | + nowFontColor: ResourceColor = {} as ResourceColor | ||
| 14 | // 今日时间戳 | 15 | // 今日时间戳 |
| 15 | selectDay: number = 0 | 16 | selectDay: number = 0 |
| 16 | @Link selectItem: RMCalendarBean | 17 | @Link selectItem: RMCalendarBean |
| @@ -37,7 +38,9 @@ export struct RMCalenderCell { | @@ -37,7 +38,9 @@ export struct RMCalenderCell { | ||
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | getItemColor() { | 40 | getItemColor() { |
| 40 | - if (this.item.isPre) { | 41 | + if (!this.isShowSelectBg() && this.item.isNow) { |
| 42 | + return this.nowFontColor | ||
| 43 | + } else if (this.item.isPre) { | ||
| 41 | return this.disabledFontColor | 44 | return this.disabledFontColor |
| 42 | } else if (this.item.isNext) { | 45 | } else if (this.item.isNext) { |
| 43 | return this.disabledFontColor | 46 | return this.disabledFontColor |
| @@ -93,6 +96,7 @@ export struct RMCalenderCell { | @@ -93,6 +96,7 @@ export struct RMCalenderCell { | ||
| 93 | .aspectRatio(1)// .borderRadius(999) | 96 | .aspectRatio(1)// .borderRadius(999) |
| 94 | .backgroundColor(this.getSelectItemBg()) | 97 | .backgroundColor(this.getSelectItemBg()) |
| 95 | .opacity(this.getSelectItemBgOpa()) | 98 | .opacity(this.getSelectItemBgOpa()) |
| 99 | + .borderRadius(2) | ||
| 96 | .transition({ type: TransitionType.Insert, opacity: 1 }) | 100 | .transition({ type: TransitionType.Insert, opacity: 1 }) |
| 97 | .transition({ type: TransitionType.Delete, opacity: 0 }) | 101 | .transition({ type: TransitionType.Delete, opacity: 0 }) |
| 98 | } | 102 | } |
| @@ -5,9 +5,9 @@ import { | @@ -5,9 +5,9 @@ import { | ||
| 5 | ContentDetailRequest, | 5 | ContentDetailRequest, |
| 6 | postInteractAccentionOperateParams | 6 | postInteractAccentionOperateParams |
| 7 | } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | 7 | } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; |
| 8 | -import { postBatchAttentionStatusParams, RmhInfoDTO } from 'wdBean/Index'; | 8 | +import { ContentDetailDTO, Params, postBatchAttentionStatusParams, RmhInfoDTO } from 'wdBean/Index'; |
| 9 | import { SpConstants } from 'wdConstant/Index'; | 9 | import { SpConstants } from 'wdConstant/Index'; |
| 10 | -import { Logger, SPHelper } from 'wdKit/Index'; | 10 | +import { Logger, SPHelper, ToastUtils } from 'wdKit/Index'; |
| 11 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 11 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 12 | import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'; | 12 | import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'; |
| 13 | 13 | ||
| @@ -16,6 +16,8 @@ const TAG = 'LiveFollowComponent' | @@ -16,6 +16,8 @@ const TAG = 'LiveFollowComponent' | ||
| 16 | @Component | 16 | @Component |
| 17 | export struct LiveFollowComponent { | 17 | export struct LiveFollowComponent { |
| 18 | @Prop rmhInfo: RmhInfoDTO | 18 | @Prop rmhInfo: RmhInfoDTO |
| 19 | + @Consume contentDetailData: ContentDetailDTO | ||
| 20 | + @Consume @Watch('getBatchAttentionStatus') pageShow: number | ||
| 19 | 21 | ||
| 20 | aboutToAppear(): void { | 22 | aboutToAppear(): void { |
| 21 | this.getBatchAttentionStatus() | 23 | this.getBatchAttentionStatus() |
| @@ -42,6 +44,16 @@ export struct LiveFollowComponent { | @@ -42,6 +44,16 @@ export struct LiveFollowComponent { | ||
| 42 | .width(24) | 44 | .width(24) |
| 43 | .height(24) | 45 | .height(24) |
| 44 | .borderRadius(90) | 46 | .borderRadius(90) |
| 47 | + .onClick(() => { | ||
| 48 | + // 跳转到号主页 | ||
| 49 | + if (this.contentDetailData.rmhInfo?.cnMainControl === 1) { | ||
| 50 | + const params: Params = { | ||
| 51 | + creatorId: this.contentDetailData.rmhInfo.rmhId, | ||
| 52 | + pageID: '' | ||
| 53 | + } | ||
| 54 | + WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) | ||
| 55 | + } | ||
| 56 | + }) | ||
| 45 | Text(this.rmhInfo.rmhName) | 57 | Text(this.rmhInfo.rmhName) |
| 46 | .fontColor(Color.White) | 58 | .fontColor(Color.White) |
| 47 | .maxLines(1) | 59 | .maxLines(1) |
| @@ -66,6 +78,7 @@ export struct LiveFollowComponent { | @@ -66,6 +78,7 @@ export struct LiveFollowComponent { | ||
| 66 | .borderRadius(2) | 78 | .borderRadius(2) |
| 67 | .margin({ right: 2 }) | 79 | .margin({ right: 2 }) |
| 68 | .backgroundColor(this.followStatus === '0' ? $r('app.color.color_ED2800') : $r('app.color.color_CCCCCC')) | 80 | .backgroundColor(this.followStatus === '0' ? $r('app.color.color_ED2800') : $r('app.color.color_CCCCCC')) |
| 81 | + .visibility(this.followStatus === '0' ? Visibility.Visible : Visibility.None) | ||
| 69 | .onClick(() => { | 82 | .onClick(() => { |
| 70 | this.handleAccention() | 83 | this.handleAccention() |
| 71 | }) | 84 | }) |
| @@ -114,6 +127,13 @@ export struct LiveFollowComponent { | @@ -114,6 +127,13 @@ export struct LiveFollowComponent { | ||
| 114 | this.followStatus = '0' | 127 | this.followStatus = '0' |
| 115 | } else { | 128 | } else { |
| 116 | this.followStatus = '1' | 129 | this.followStatus = '1' |
| 130 | + // 弹窗样式与何时调用待确认 | ||
| 131 | + ContentDetailRequest.postPointLevelOperate({ operateType: 6 }).then((res) => { | ||
| 132 | + console.log('关注号主获取积分==', JSON.stringify(res.data)) | ||
| 133 | + if (res.data?.showToast) { | ||
| 134 | + ToastUtils.showToast(res.data.ruleName + '+' + res.data.rulePoint + '积分', 1000); | ||
| 135 | + } | ||
| 136 | + }) | ||
| 117 | } | 137 | } |
| 118 | }) | 138 | }) |
| 119 | } | 139 | } |
| @@ -37,6 +37,8 @@ export struct RmhTitle { | @@ -37,6 +37,8 @@ export struct RmhTitle { | ||
| 37 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime))) | 37 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime))) |
| 38 | .fontSize($r("app.float.font_size_12")) | 38 | .fontSize($r("app.float.font_size_12")) |
| 39 | .fontColor($r("app.color.color_B0B0B0")) | 39 | .fontColor($r("app.color.color_B0B0B0")) |
| 40 | + } | ||
| 41 | + if (this.publishTime && this.rmhInfo.rmhDesc) { | ||
| 40 | Image($r('app.media.point')) | 42 | Image($r('app.media.point')) |
| 41 | .width(16) | 43 | .width(16) |
| 42 | .height(16) | 44 | .height(16) |
| @@ -3,6 +3,8 @@ import { CommonConstants } from 'wdConstant'; | @@ -3,6 +3,8 @@ import { CommonConstants } from 'wdConstant'; | ||
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; | 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; |
| 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; | 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; |
| 6 | +import { Notes } from './notes'; | ||
| 7 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 6 | 8 | ||
| 7 | /** | 9 | /** |
| 8 | * 大专题卡--CompStyle: 10 | 10 | * 大专题卡--CompStyle: 10 |
| @@ -13,6 +15,11 @@ const TAG: string = 'Card10Component'; | @@ -13,6 +15,11 @@ const TAG: string = 'Card10Component'; | ||
| 13 | @Component | 15 | @Component |
| 14 | export struct Card10Component { | 16 | export struct Card10Component { |
| 15 | @State contentDTO: ContentDTO = {} as ContentDTO; | 17 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 18 | + @State loadImg: boolean = false; | ||
| 19 | + | ||
| 20 | + async aboutToAppear(): Promise<void> { | ||
| 21 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 22 | + } | ||
| 16 | 23 | ||
| 17 | build() { | 24 | build() { |
| 18 | Column() { | 25 | Column() { |
| @@ -31,7 +38,8 @@ export struct Card10Component { | @@ -31,7 +38,8 @@ export struct Card10Component { | ||
| 31 | } | 38 | } |
| 32 | // 大图 | 39 | // 大图 |
| 33 | Stack() { | 40 | Stack() { |
| 34 | - Image(this.contentDTO && this.contentDTO.coverUrl) | 41 | + Image(this.loadImg ? this.contentDTO?.coverUrl : '') |
| 42 | + .backgroundColor(0xf5f5f5) | ||
| 35 | .width('100%') | 43 | .width('100%') |
| 36 | .borderRadius({ | 44 | .borderRadius({ |
| 37 | topLeft: $r('app.float.image_border_radius'), | 45 | topLeft: $r('app.float.image_border_radius'), |
| @@ -40,19 +48,8 @@ export struct Card10Component { | @@ -40,19 +48,8 @@ export struct Card10Component { | ||
| 40 | .onClick((event: ClickEvent) => { | 48 | .onClick((event: ClickEvent) => { |
| 41 | ProcessUtils.processPage(this.contentDTO) | 49 | ProcessUtils.processPage(this.contentDTO) |
| 42 | }) | 50 | }) |
| 43 | - // Text('专题') | ||
| 44 | - // .fontSize($r('app.float.font_size_12')) | ||
| 45 | - // .padding({ left: 8, right: 8, top: 3, bottom: 3 }) | ||
| 46 | - // .backgroundColor(Color.Red) | ||
| 47 | - // .fontColor(Color.White) | ||
| 48 | - // .borderRadius($r('app.float.button_border_radius')) | ||
| 49 | - // .margin({ left: 5, bottom: 5 }) | ||
| 50 | 51 | ||
| 51 | - ImageSpan($r('app.media.special')) | ||
| 52 | - .width($r('app.float.font_size_36')) | ||
| 53 | - .objectFit(ImageFit.Fill) | ||
| 54 | - .verticalAlign(ImageSpanAlignment.CENTER) | ||
| 55 | - .margin({ left: 5, bottom: 5 }) | 52 | + Notes({ objectType: 5 }).margin({ left: 5, bottom: 5 }) |
| 56 | }.alignContent(Alignment.BottomStart) | 53 | }.alignContent(Alignment.BottomStart) |
| 57 | 54 | ||
| 58 | // 专题列表--后端返回三个, | 55 | // 专题列表--后端返回三个, |
| @@ -99,31 +96,18 @@ export struct Card10Component { | @@ -99,31 +96,18 @@ export struct Card10Component { | ||
| 99 | timelineItem(item: slideShows, index: number) { | 96 | timelineItem(item: slideShows, index: number) { |
| 100 | Row() { | 97 | Row() { |
| 101 | Column() { | 98 | Column() { |
| 102 | - | ||
| 103 | - Text(item.newsTitle) { | 99 | + Stack() { |
| 104 | if (item.objectType == '5') { | 100 | if (item.objectType == '5') { |
| 105 | - // Text('专题') | ||
| 106 | - // .fontSize($r('app.float.font_size_12')) | ||
| 107 | - // .padding({ left: 8, right: 8, top: 3, bottom: 3 }) | ||
| 108 | - // .backgroundColor(Color.Red) | ||
| 109 | - // .fontColor(Color.White) | ||
| 110 | - // .borderRadius($r('app.float.button_border_radius')) | ||
| 111 | - // .margin({ right: 5 }) | ||
| 112 | - ImageSpan($r('app.media.special')) | ||
| 113 | - .width($r('app.float.font_size_36')) | ||
| 114 | - .objectFit(ImageFit.Fill) | ||
| 115 | - .verticalAlign(ImageSpanAlignment.CENTER) | ||
| 116 | - .margin({ right: 5 }) | 101 | + Notes({ objectType: 5 }) |
| 117 | } | 102 | } |
| 118 | - | ||
| 119 | - Span(item.newsTitle) | ||
| 120 | - } | ||
| 121 | - .fontSize($r('app.float.font_size_17')) | ||
| 122 | - .fontWeight(400) | ||
| 123 | - .fontColor($r('app.color.color_222222')) | ||
| 124 | - .maxLines(2) | ||
| 125 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 126 | - | 103 | + Text(item.newsTitle) |
| 104 | + .fontSize($r('app.float.font_size_17')) | ||
| 105 | + .fontWeight(400) | ||
| 106 | + .fontColor($r('app.color.color_222222')) | ||
| 107 | + .maxLines(2) | ||
| 108 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 109 | + .textIndent(item.objectType == '5' ? 40 : 0) | ||
| 110 | + }.alignContent(Alignment.TopStart) | ||
| 127 | 111 | ||
| 128 | CardSourceInfo( | 112 | CardSourceInfo( |
| 129 | { | 113 | { |
| @@ -140,7 +124,8 @@ export struct Card10Component { | @@ -140,7 +124,8 @@ export struct Card10Component { | ||
| 140 | // 右侧图片 | 124 | // 右侧图片 |
| 141 | if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) { | 125 | if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) { |
| 142 | Stack() { | 126 | Stack() { |
| 143 | - Image(item.fullColumnImgUrls[0].url) | 127 | + Image(this.loadImg ? item.fullColumnImgUrls[0].url : '') |
| 128 | + .backgroundColor(0xf5f5f5) | ||
| 144 | .width(117) | 129 | .width(117) |
| 145 | .height(78) | 130 | .height(78) |
| 146 | .objectFit(ImageFit.Cover) | 131 | .objectFit(ImageFit.Cover) |
| @@ -12,12 +12,13 @@ const TAG = 'Card11Component'; | @@ -12,12 +12,13 @@ const TAG = 'Card11Component'; | ||
| 12 | @Component | 12 | @Component |
| 13 | export struct Card11Component { | 13 | export struct Card11Component { |
| 14 | @State contentDTO: ContentDTO = {} as ContentDTO; | 14 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 15 | + @State clicked: boolean = false; | ||
| 15 | 16 | ||
| 16 | build() { | 17 | build() { |
| 17 | Column() { | 18 | Column() { |
| 18 | Text(this.contentDTO.newsTitle) | 19 | Text(this.contentDTO.newsTitle) |
| 19 | .fontSize($r("app.float.font_size_16")) | 20 | .fontSize($r("app.float.font_size_16")) |
| 20 | - .fontColor($r("app.color.color_222222")) | 21 | + .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) |
| 21 | .maxLines(3) | 22 | .maxLines(3) |
| 22 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 23 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 23 | .width(CommonConstants.FULL_WIDTH) | 24 | .width(CommonConstants.FULL_WIDTH) |
| @@ -32,6 +33,8 @@ export struct Card11Component { | @@ -32,6 +33,8 @@ export struct Card11Component { | ||
| 32 | }) | 33 | }) |
| 33 | .backgroundColor($r("app.color.white")) | 34 | .backgroundColor($r("app.color.white")) |
| 34 | .onClick((event: ClickEvent) => { | 35 | .onClick((event: ClickEvent) => { |
| 36 | + | ||
| 37 | + this.clicked = true; | ||
| 35 | ProcessUtils.processPage(this.contentDTO) | 38 | ProcessUtils.processPage(this.contentDTO) |
| 36 | }) | 39 | }) |
| 37 | } | 40 | } |
| @@ -3,6 +3,7 @@ import { RmhTitle } from '../cardCommon/RmhTitle' | @@ -3,6 +3,7 @@ import { RmhTitle } from '../cardCommon/RmhTitle' | ||
| 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 4 | import { CommonConstants } from 'wdConstant/Index'; | 4 | import { CommonConstants } from 'wdConstant/Index'; |
| 5 | import { ProcessUtils } from 'wdRouter'; | 5 | import { ProcessUtils } from 'wdRouter'; |
| 6 | +import {CarderInteraction} from '../CarderInteraction' | ||
| 6 | 7 | ||
| 7 | const TAG = 'Card12Component'; | 8 | const TAG = 'Card12Component'; |
| 8 | 9 | ||
| @@ -12,6 +13,7 @@ const TAG = 'Card12Component'; | @@ -12,6 +13,7 @@ const TAG = 'Card12Component'; | ||
| 12 | @Component | 13 | @Component |
| 13 | export struct Card12Component { | 14 | export struct Card12Component { |
| 14 | @State contentDTO: ContentDTO = {} as ContentDTO; | 15 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 16 | + @State clicked: boolean = false; | ||
| 15 | 17 | ||
| 16 | aboutToAppear(): void { | 18 | aboutToAppear(): void { |
| 17 | } | 19 | } |
| @@ -26,7 +28,7 @@ export struct Card12Component { | @@ -26,7 +28,7 @@ export struct Card12Component { | ||
| 26 | if (this.contentDTO.newsTitle) { | 28 | if (this.contentDTO.newsTitle) { |
| 27 | Text(this.contentDTO.newsTitle) | 29 | Text(this.contentDTO.newsTitle) |
| 28 | .fontSize($r('app.float.font_size_17')) | 30 | .fontSize($r('app.float.font_size_17')) |
| 29 | - .fontColor($r('app.color.color_222222')) | 31 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 30 | .width(CommonConstants.FULL_WIDTH) | 32 | .width(CommonConstants.FULL_WIDTH) |
| 31 | .textOverflowStyle(3) | 33 | .textOverflowStyle(3) |
| 32 | .margin({ bottom: 8 }) | 34 | .margin({ bottom: 8 }) |
| @@ -34,7 +36,7 @@ export struct Card12Component { | @@ -34,7 +36,7 @@ export struct Card12Component { | ||
| 34 | .lineHeight(25) | 36 | .lineHeight(25) |
| 35 | .fontFamily('PingFang SC-Regular') | 37 | .fontFamily('PingFang SC-Regular') |
| 36 | } | 38 | } |
| 37 | - | 39 | + CarderInteraction({contentDTO: this.contentDTO}) |
| 38 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 40 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 39 | } | 41 | } |
| 40 | .padding({ | 42 | .padding({ |
| @@ -44,6 +46,7 @@ export struct Card12Component { | @@ -44,6 +46,7 @@ export struct Card12Component { | ||
| 44 | bottom: $r('app.float.card_comp_pagePadding_tb') | 46 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 45 | }) | 47 | }) |
| 46 | .onClick((event: ClickEvent) => { | 48 | .onClick((event: ClickEvent) => { |
| 49 | + this.clicked = true; | ||
| 47 | ProcessUtils.processPage(this.contentDTO) | 50 | ProcessUtils.processPage(this.contentDTO) |
| 48 | }) | 51 | }) |
| 49 | } | 52 | } |
| @@ -3,6 +3,8 @@ import { RmhTitle } from '../cardCommon/RmhTitle' | @@ -3,6 +3,8 @@ import { RmhTitle } from '../cardCommon/RmhTitle' | ||
| 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 4 | import { CommonConstants } from 'wdConstant/Index'; | 4 | import { CommonConstants } from 'wdConstant/Index'; |
| 5 | import { ProcessUtils } from 'wdRouter'; | 5 | import { ProcessUtils } from 'wdRouter'; |
| 6 | +import {CarderInteraction} from '../CarderInteraction' | ||
| 7 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 6 | 8 | ||
| 7 | const TAG = 'Card14Component'; | 9 | const TAG = 'Card14Component'; |
| 8 | 10 | ||
| @@ -11,41 +13,12 @@ const TAG = 'Card14Component'; | @@ -11,41 +13,12 @@ const TAG = 'Card14Component'; | ||
| 11 | */ | 13 | */ |
| 12 | @Component | 14 | @Component |
| 13 | export struct Card14Component { | 15 | export struct Card14Component { |
| 14 | - @State contentDTO: ContentDTO = { | ||
| 15 | - appStyle: '20', | ||
| 16 | - coverType: 1, | ||
| 17 | - coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 18 | - fullColumnImgUrls: [ | ||
| 19 | - { | ||
| 20 | - landscape: 1, | ||
| 21 | - size: 1, | ||
| 22 | - url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 23 | - weight: 1600 | ||
| 24 | - } | ||
| 25 | - ], | ||
| 26 | - newsTitle: '好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》', | ||
| 27 | - rmhInfo: { | ||
| 28 | - authIcon: | ||
| 29 | - 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png', | ||
| 30 | - authTitle: '10后音乐人王烁然个人人民号', | ||
| 31 | - authTitle2: '10后音乐人王烁然个人人民号', | ||
| 32 | - banControl: 0, | ||
| 33 | - cnIsAttention: 1, | ||
| 34 | - rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人', | ||
| 35 | - rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg', | ||
| 36 | - rmhName: '王烁然', | ||
| 37 | - userId: '522435359667845', | ||
| 38 | - userType: '2' | ||
| 39 | - }, | ||
| 40 | - objectType: '1', | ||
| 41 | - videoInfo: { | ||
| 42 | - firstFrameImageUri: '', | ||
| 43 | - videoDuration: 37, | ||
| 44 | - videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4' | ||
| 45 | - } | ||
| 46 | - } as ContentDTO; | 16 | + @State contentDTO: ContentDTO = {} as ContentDTO; |
| 17 | + @State loadImg: boolean = false; | ||
| 18 | + @State clicked: boolean = false; | ||
| 47 | 19 | ||
| 48 | - aboutToAppear(): void { | 20 | + async aboutToAppear(): Promise<void> { |
| 21 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 49 | } | 22 | } |
| 50 | 23 | ||
| 51 | build() { | 24 | build() { |
| @@ -59,7 +32,7 @@ export struct Card14Component { | @@ -59,7 +32,7 @@ export struct Card14Component { | ||
| 59 | 32 | ||
| 60 | Text(this.contentDTO.newsTitle) | 33 | Text(this.contentDTO.newsTitle) |
| 61 | .fontSize($r('app.float.font_size_17')) | 34 | .fontSize($r('app.float.font_size_17')) |
| 62 | - .fontColor($r('app.color.color_222222')) | 35 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 63 | .textOverflowStyle(3) | 36 | .textOverflowStyle(3) |
| 64 | .lineHeight(25) | 37 | .lineHeight(25) |
| 65 | .fontFamily('PingFang SC-Regular') | 38 | .fontFamily('PingFang SC-Regular') |
| @@ -68,7 +41,8 @@ export struct Card14Component { | @@ -68,7 +41,8 @@ export struct Card14Component { | ||
| 68 | .margin({right: 12}) | 41 | .margin({right: 12}) |
| 69 | .flexBasis(214) | 42 | .flexBasis(214) |
| 70 | 43 | ||
| 71 | - Image(this.contentDTO.coverUrl) | 44 | + Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 45 | + .backgroundColor(0xf5f5f5) | ||
| 72 | .flexBasis(117) | 46 | .flexBasis(117) |
| 73 | .height(78) | 47 | .height(78) |
| 74 | .borderRadius($r('app.float.image_border_radius')) | 48 | .borderRadius($r('app.float.image_border_radius')) |
| @@ -79,7 +53,7 @@ export struct Card14Component { | @@ -79,7 +53,7 @@ export struct Card14Component { | ||
| 79 | .width(CommonConstants.FULL_WIDTH) | 53 | .width(CommonConstants.FULL_WIDTH) |
| 80 | .margin({ bottom: 8 }) | 54 | .margin({ bottom: 8 }) |
| 81 | .height(75) | 55 | .height(75) |
| 82 | - | 56 | + CarderInteraction({contentDTO: this.contentDTO}) |
| 83 | 57 | ||
| 84 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 58 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 85 | } | 59 | } |
| @@ -90,6 +64,7 @@ export struct Card14Component { | @@ -90,6 +64,7 @@ export struct Card14Component { | ||
| 90 | bottom: $r('app.float.card_comp_pagePadding_tb') | 64 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 91 | }) | 65 | }) |
| 92 | .onClick((event: ClickEvent) => { | 66 | .onClick((event: ClickEvent) => { |
| 67 | + this.clicked = true; | ||
| 93 | ProcessUtils.processPage(this.contentDTO) | 68 | ProcessUtils.processPage(this.contentDTO) |
| 94 | }) | 69 | }) |
| 95 | } | 70 | } |
| @@ -3,6 +3,8 @@ import { ProcessUtils } from 'wdRouter'; | @@ -3,6 +3,8 @@ import { ProcessUtils } from 'wdRouter'; | ||
| 3 | import { RmhTitle } from '../cardCommon/RmhTitle' | 3 | import { RmhTitle } from '../cardCommon/RmhTitle' |
| 4 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 4 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 5 | import { CommonConstants } from 'wdConstant/Index'; | 5 | import { CommonConstants } from 'wdConstant/Index'; |
| 6 | +import {CarderInteraction} from '../CarderInteraction' | ||
| 7 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 6 | 8 | ||
| 7 | const TAG: string = 'Card15Component'; | 9 | const TAG: string = 'Card15Component'; |
| 8 | 10 | ||
| @@ -15,45 +17,14 @@ const TAG: string = 'Card15Component'; | @@ -15,45 +17,14 @@ const TAG: string = 'Card15Component'; | ||
| 15 | */ | 17 | */ |
| 16 | @Component | 18 | @Component |
| 17 | export struct Card15Component { | 19 | export struct Card15Component { |
| 18 | - @State contentDTO: ContentDTO = { | ||
| 19 | - // appStyle: '15', | ||
| 20 | - // coverType: 1, | ||
| 21 | - // objectType: '9', | ||
| 22 | - // coverUrl: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/img/2024/0413/VL20Z09ISBEKXZU_963672030241091584.jpeg?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90', | ||
| 23 | - // fullColumnImgUrls: [ | ||
| 24 | - // { | ||
| 25 | - // landscape: 2, | ||
| 26 | - // size: 1, | ||
| 27 | - // url: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/img/2024/0413/VL20Z09ISBEKXZU_963672030241091584.jpeg?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90', | ||
| 28 | - // weight: 1170 | ||
| 29 | - // } | ||
| 30 | - // ], | ||
| 31 | - // newsTitle: '押解画面公开!被湖北民警从柬埔寨押解回国被湖北民警从柬埔寨押解回国的130名涉赌诈嫌疑人是他们被湖北民警从柬埔寨押解回国的130名涉赌诈嫌疑人是他们的130名涉赌诈嫌疑人是他们', | ||
| 32 | - // publishTime: '1712993333000', | ||
| 33 | - // rmhInfo: { | ||
| 34 | - // authIcon: '', | ||
| 35 | - // authTitle: '', | ||
| 36 | - // authTitle2: '', | ||
| 37 | - // banControl: 0, | ||
| 38 | - // cnIsAttention: 1, | ||
| 39 | - // rmhDesc: '中共武汉市委机关报长江日报官方人民号', | ||
| 40 | - // rmhHeadUrl: 'https://uatjdcdnphoto.aikan.pdnews.cn/vod/content/202302/202302Sa121448724/TUw.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg', | ||
| 41 | - // rmhId: '4255270', | ||
| 42 | - // rmhName: '长江日报', | ||
| 43 | - // userId: '513696944662469', | ||
| 44 | - // userType: '3' | ||
| 45 | - // }, | ||
| 46 | - // videoInfo: { | ||
| 47 | - // firstFrameImageUri: '', | ||
| 48 | - // videoDuration: 12, | ||
| 49 | - // // videoLandscape: 2, | ||
| 50 | - // videoUrl: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/video/2024/0413/VL20Z09ISBEKXZU_963672027208609792.mp4' | ||
| 51 | - // }, | ||
| 52 | - // photoNum: '9', | ||
| 53 | - // voiceInfo: { | ||
| 54 | - // voiceDuration: 12 | ||
| 55 | - // } | ||
| 56 | - } as ContentDTO; | 20 | + @State contentDTO: ContentDTO = {} as ContentDTO; |
| 21 | + @State loadImg: boolean = false; | ||
| 22 | + @State clicked: boolean = false; | ||
| 23 | + | ||
| 24 | + async aboutToAppear(): Promise<void> { | ||
| 25 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 26 | + } | ||
| 27 | + | ||
| 57 | 28 | ||
| 58 | build() { | 29 | build() { |
| 59 | Column() { | 30 | Column() { |
| @@ -63,14 +34,15 @@ export struct Card15Component { | @@ -63,14 +34,15 @@ export struct Card15Component { | ||
| 63 | if (this.contentDTO.newsTitle) { | 34 | if (this.contentDTO.newsTitle) { |
| 64 | Text(this.contentDTO.newsTitle) | 35 | Text(this.contentDTO.newsTitle) |
| 65 | .fontSize($r('app.float.font_size_17')) | 36 | .fontSize($r('app.float.font_size_17')) |
| 66 | - .fontColor($r('app.color.color_222222')) | 37 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 67 | .width(CommonConstants.FULL_WIDTH) | 38 | .width(CommonConstants.FULL_WIDTH) |
| 68 | .textOverflowStyle(2) | 39 | .textOverflowStyle(2) |
| 69 | .margin({ bottom: 8 }) | 40 | .margin({ bottom: 8 }) |
| 70 | } | 41 | } |
| 71 | //大图 | 42 | //大图 |
| 72 | Stack() { | 43 | Stack() { |
| 73 | - Image(this.contentDTO.coverUrl) | 44 | + Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 45 | + .backgroundColor(0xf5f5f5) | ||
| 74 | .borderRadius($r('app.float.image_border_radius')) | 46 | .borderRadius($r('app.float.image_border_radius')) |
| 75 | //播放状态+时长 | 47 | //播放状态+时长 |
| 76 | CardMediaInfo({ | 48 | CardMediaInfo({ |
| @@ -80,7 +52,7 @@ export struct Card15Component { | @@ -80,7 +52,7 @@ export struct Card15Component { | ||
| 80 | .width(CommonConstants.FULL_WIDTH) | 52 | .width(CommonConstants.FULL_WIDTH) |
| 81 | .aspectRatio(16 / 9) | 53 | .aspectRatio(16 / 9) |
| 82 | .alignContent(Alignment.BottomEnd) | 54 | .alignContent(Alignment.BottomEnd) |
| 83 | - | 55 | + CarderInteraction({contentDTO: this.contentDTO}) |
| 84 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 56 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 85 | } | 57 | } |
| 86 | .padding({ | 58 | .padding({ |
| @@ -90,6 +62,7 @@ export struct Card15Component { | @@ -90,6 +62,7 @@ export struct Card15Component { | ||
| 90 | bottom: $r('app.float.card_comp_pagePadding_tb') | 62 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 91 | }) | 63 | }) |
| 92 | .onClick((event: ClickEvent) => { | 64 | .onClick((event: ClickEvent) => { |
| 65 | + this.clicked = true; | ||
| 93 | ProcessUtils.processPage(this.contentDTO) | 66 | ProcessUtils.processPage(this.contentDTO) |
| 94 | }) | 67 | }) |
| 95 | } | 68 | } |
| @@ -3,6 +3,8 @@ import { RmhTitle } from '../cardCommon/RmhTitle' | @@ -3,6 +3,8 @@ import { RmhTitle } from '../cardCommon/RmhTitle' | ||
| 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 4 | import { CommonConstants } from 'wdConstant/Index'; | 4 | import { CommonConstants } from 'wdConstant/Index'; |
| 5 | import { ProcessUtils } from 'wdRouter'; | 5 | import { ProcessUtils } from 'wdRouter'; |
| 6 | +import {CarderInteraction} from '../CarderInteraction' | ||
| 7 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 6 | 8 | ||
| 7 | const TAG = 'Card16Component'; | 9 | const TAG = 'Card16Component'; |
| 8 | 10 | ||
| @@ -17,8 +19,11 @@ interface fullColumnImgUrlItem { | @@ -17,8 +19,11 @@ interface fullColumnImgUrlItem { | ||
| 17 | @Component | 19 | @Component |
| 18 | export struct Card16Component { | 20 | export struct Card16Component { |
| 19 | @State contentDTO: ContentDTO = {} as ContentDTO; | 21 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 22 | + @State loadImg: boolean = false; | ||
| 23 | + @State clicked: boolean = false; | ||
| 20 | 24 | ||
| 21 | - aboutToAppear(): void { | 25 | + async aboutToAppear(): Promise<void> { |
| 26 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 22 | } | 27 | } |
| 23 | 28 | ||
| 24 | build() { | 29 | build() { |
| @@ -31,7 +36,7 @@ export struct Card16Component { | @@ -31,7 +36,7 @@ export struct Card16Component { | ||
| 31 | if (this.contentDTO.newsTitle) { | 36 | if (this.contentDTO.newsTitle) { |
| 32 | Text(this.contentDTO.newsTitle) | 37 | Text(this.contentDTO.newsTitle) |
| 33 | .fontSize($r('app.float.font_size_17')) | 38 | .fontSize($r('app.float.font_size_17')) |
| 34 | - .fontColor($r('app.color.color_222222')) | 39 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 35 | .width(CommonConstants.FULL_WIDTH) | 40 | .width(CommonConstants.FULL_WIDTH) |
| 36 | .textOverflowStyle(2) | 41 | .textOverflowStyle(2) |
| 37 | .margin({ bottom: 8 }) | 42 | .margin({ bottom: 8 }) |
| @@ -40,10 +45,15 @@ export struct Card16Component { | @@ -40,10 +45,15 @@ export struct Card16Component { | ||
| 40 | if (this.contentDTO.fullColumnImgUrls?.length > 0) { | 45 | if (this.contentDTO.fullColumnImgUrls?.length > 0) { |
| 41 | Flex() { | 46 | Flex() { |
| 42 | ForEach(this.contentDTO.fullColumnImgUrls.slice(0, 3), (item: fullColumnImgUrlItem, index: number) => { | 47 | ForEach(this.contentDTO.fullColumnImgUrls.slice(0, 3), (item: fullColumnImgUrlItem, index: number) => { |
| 43 | - Image(item.url).flexBasis(113).height(75).margin({ right: index > 1 ? 0 : 2 }) | 48 | + Image(this.loadImg ? item.url : '') |
| 49 | + .backgroundColor(0xf5f5f5) | ||
| 50 | + .flexBasis(113) | ||
| 51 | + .height(75) | ||
| 52 | + .margin({ right: index > 1 ? 0 : 2 }) | ||
| 44 | }) | 53 | }) |
| 45 | } | 54 | } |
| 46 | } | 55 | } |
| 56 | + CarderInteraction({contentDTO: this.contentDTO}) | ||
| 47 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 57 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 48 | } | 58 | } |
| 49 | .padding({ | 59 | .padding({ |
| @@ -53,6 +63,7 @@ export struct Card16Component { | @@ -53,6 +63,7 @@ export struct Card16Component { | ||
| 53 | bottom: $r('app.float.card_comp_pagePadding_tb') | 63 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 54 | }) | 64 | }) |
| 55 | .onClick((event: ClickEvent) => { | 65 | .onClick((event: ClickEvent) => { |
| 66 | + this.clicked = true; | ||
| 56 | ProcessUtils.processPage(this.contentDTO) | 67 | ProcessUtils.processPage(this.contentDTO) |
| 57 | }) | 68 | }) |
| 58 | } | 69 | } |
| @@ -68,6 +79,11 @@ interface radiusType { | @@ -68,6 +79,11 @@ interface radiusType { | ||
| 68 | @Component | 79 | @Component |
| 69 | struct createImg { | 80 | struct createImg { |
| 70 | @Prop contentDTO: ContentDTO | 81 | @Prop contentDTO: ContentDTO |
| 82 | + @State loadImg: boolean = false; | ||
| 83 | + | ||
| 84 | + async aboutToAppear(): Promise<void> { | ||
| 85 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 86 | + } | ||
| 71 | 87 | ||
| 72 | build() { | 88 | build() { |
| 73 | GridRow() { | 89 | GridRow() { |
| @@ -77,7 +93,8 @@ struct createImg { | @@ -77,7 +93,8 @@ struct createImg { | ||
| 77 | span: { xs: 12 } | 93 | span: { xs: 12 } |
| 78 | }) { | 94 | }) { |
| 79 | Stack() { | 95 | Stack() { |
| 80 | - Image(this.contentDTO.coverUrl) | 96 | + Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 97 | + .backgroundColor(0xf5f5f5) | ||
| 81 | .width(CommonConstants.FULL_WIDTH) | 98 | .width(CommonConstants.FULL_WIDTH) |
| 82 | .aspectRatio(16 / 9) | 99 | .aspectRatio(16 / 9) |
| 83 | .borderRadius($r('app.float.image_border_radius')) | 100 | .borderRadius($r('app.float.image_border_radius')) |
| @@ -91,7 +108,8 @@ struct createImg { | @@ -91,7 +108,8 @@ struct createImg { | ||
| 91 | span: { xs: 6 } | 108 | span: { xs: 6 } |
| 92 | }) { | 109 | }) { |
| 93 | Stack() { | 110 | Stack() { |
| 94 | - Image(this.contentDTO.coverUrl) | 111 | + Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 112 | + .backgroundColor(0xf5f5f5) | ||
| 95 | .width(CommonConstants.FULL_WIDTH) | 113 | .width(CommonConstants.FULL_WIDTH) |
| 96 | .borderRadius($r('app.float.image_border_radius')) | 114 | .borderRadius($r('app.float.image_border_radius')) |
| 97 | CardMediaInfo({ contentDTO: this.contentDTO }) | 115 | CardMediaInfo({ contentDTO: this.contentDTO }) |
| @@ -5,6 +5,8 @@ import { DateTimeUtils } from 'wdKit'; | @@ -5,6 +5,8 @@ import { DateTimeUtils } from 'wdKit'; | ||
| 5 | import { WDRouterRule } from 'wdRouter'; | 5 | import { WDRouterRule } from 'wdRouter'; |
| 6 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 6 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 7 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 7 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 8 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 9 | + | ||
| 8 | const TAG = 'Card17Component'; | 10 | const TAG = 'Card17Component'; |
| 9 | 11 | ||
| 10 | /** | 12 | /** |
| @@ -14,13 +16,20 @@ const TAG = 'Card17Component'; | @@ -14,13 +16,20 @@ const TAG = 'Card17Component'; | ||
| 14 | export struct Card17Component { | 16 | export struct Card17Component { |
| 15 | @State compDTO: CompDTO = {} as CompDTO | 17 | @State compDTO: CompDTO = {} as CompDTO |
| 16 | @State contentDTO: ContentDTO = {} as ContentDTO; | 18 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 19 | + @State loadImg: boolean = false; | ||
| 20 | + @State clicked: boolean = false; | ||
| 21 | + | ||
| 22 | + async aboutToAppear(): Promise<void> { | ||
| 23 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 24 | + } | ||
| 25 | + | ||
| 17 | 26 | ||
| 18 | build() { | 27 | build() { |
| 19 | Column({ space: 8 }) { | 28 | Column({ space: 8 }) { |
| 20 | Text(this.contentDTO.newsTitle) | 29 | Text(this.contentDTO.newsTitle) |
| 21 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 30 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 22 | .fontSize($r('app.float.font_size_17')) | 31 | .fontSize($r('app.float.font_size_17')) |
| 23 | - .fontColor($r('app.color.color_222222')) | 32 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 24 | .lineHeight(25) | 33 | .lineHeight(25) |
| 25 | .maxLines(3) | 34 | .maxLines(3) |
| 26 | .width(CommonConstants.FULL_WIDTH) | 35 | .width(CommonConstants.FULL_WIDTH) |
| @@ -29,8 +38,8 @@ export struct Card17Component { | @@ -29,8 +38,8 @@ export struct Card17Component { | ||
| 29 | // 三个图, | 38 | // 三个图, |
| 30 | GridRow({ gutter: 2 }) { | 39 | GridRow({ gutter: 2 }) { |
| 31 | GridCol({ span: { xs: 8 } }) { | 40 | GridCol({ span: { xs: 8 } }) { |
| 32 | - Image(this.contentDTO.fullColumnImgUrls.length > 0 ?this.contentDTO.fullColumnImgUrls[0].url:'') | ||
| 33 | - .backgroundColor('#f5f5f5') | 41 | + Image(this.loadImg ? this.contentDTO.fullColumnImgUrls.length > 0 ?this.contentDTO.fullColumnImgUrls[0].url:'' : '') |
| 42 | + .backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5) | ||
| 34 | .width(CommonConstants.FULL_WIDTH) | 43 | .width(CommonConstants.FULL_WIDTH) |
| 35 | .aspectRatio(16 / 9) | 44 | .aspectRatio(16 / 9) |
| 36 | .borderRadius({ | 45 | .borderRadius({ |
| @@ -40,8 +49,8 @@ export struct Card17Component { | @@ -40,8 +49,8 @@ export struct Card17Component { | ||
| 40 | } | 49 | } |
| 41 | 50 | ||
| 42 | GridCol({ span: { xs: 4 } }) { | 51 | GridCol({ span: { xs: 4 } }) { |
| 43 | - Image(this.contentDTO.fullColumnImgUrls.length > 1? this.contentDTO.fullColumnImgUrls[1].url:'') | ||
| 44 | - .backgroundColor('#f5f5f5') | 52 | + Image(this.loadImg ? this.contentDTO.fullColumnImgUrls.length > 1? this.contentDTO.fullColumnImgUrls[1].url:'' : '') |
| 53 | + .backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5) | ||
| 45 | .width(CommonConstants.FULL_WIDTH) | 54 | .width(CommonConstants.FULL_WIDTH) |
| 46 | .aspectRatio(16 / 9) | 55 | .aspectRatio(16 / 9) |
| 47 | .margin({ bottom: 1 }) | 56 | .margin({ bottom: 1 }) |
| @@ -56,8 +65,8 @@ export struct Card17Component { | @@ -56,8 +65,8 @@ export struct Card17Component { | ||
| 56 | } | 65 | } |
| 57 | 66 | ||
| 58 | GridCol({ span: { xs: 4 } }) { | 67 | GridCol({ span: { xs: 4 } }) { |
| 59 | - Image(this.contentDTO.fullColumnImgUrls.length > 2? this.contentDTO.fullColumnImgUrls[2].url:'') | ||
| 60 | - .backgroundColor('#f5f5f5') | 68 | + Image(this.loadImg ? this.contentDTO.fullColumnImgUrls.length > 2? this.contentDTO.fullColumnImgUrls[2].url:'' : '') |
| 69 | + .backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5) | ||
| 61 | .width(CommonConstants.FULL_WIDTH) | 70 | .width(CommonConstants.FULL_WIDTH) |
| 62 | .aspectRatio(16 / 9) | 71 | .aspectRatio(16 / 9) |
| 63 | .margin({ top: 1 }) | 72 | .margin({ top: 1 }) |
| @@ -71,6 +80,7 @@ export struct Card17Component { | @@ -71,6 +80,7 @@ export struct Card17Component { | ||
| 71 | } | 80 | } |
| 72 | .width(CommonConstants.FULL_WIDTH) | 81 | .width(CommonConstants.FULL_WIDTH) |
| 73 | .onClick((event: ClickEvent) => { | 82 | .onClick((event: ClickEvent) => { |
| 83 | + this.clicked = true; | ||
| 74 | let taskAction: Action = { | 84 | let taskAction: Action = { |
| 75 | type: 'JUMP_DETAIL_PAGE', | 85 | type: 'JUMP_DETAIL_PAGE', |
| 76 | params: { | 86 | params: { |
| @@ -2,6 +2,8 @@ import { ContentDTO, FullColumnImgUrlDTO, PhotoListBean } from 'wdBean'; | @@ -2,6 +2,8 @@ import { ContentDTO, FullColumnImgUrlDTO, PhotoListBean } from 'wdBean'; | ||
| 2 | import { RmhTitle } from '../cardCommon/RmhTitle' | 2 | import { RmhTitle } from '../cardCommon/RmhTitle' |
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { CommonConstants } from 'wdConstant/Index'; | 4 | import { CommonConstants } from 'wdConstant/Index'; |
| 5 | +import {CarderInteraction} from '../CarderInteraction' | ||
| 6 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 5 | 7 | ||
| 6 | const TAG = 'Card19Component'; | 8 | const TAG = 'Card19Component'; |
| 7 | 9 | ||
| @@ -11,68 +13,8 @@ const TAG = 'Card19Component'; | @@ -11,68 +13,8 @@ const TAG = 'Card19Component'; | ||
| 11 | @Component | 13 | @Component |
| 12 | export struct Card19Component { | 14 | export struct Card19Component { |
| 13 | @State contentDTO: ContentDTO = { | 15 | @State contentDTO: ContentDTO = { |
| 14 | - // appStyle: '19', | ||
| 15 | - // coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg', | ||
| 16 | - // fullColumnImgUrls: [ | ||
| 17 | - // { | ||
| 18 | - // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994155727712256.png?x-oss-process=image/quality,q_90/auto-orient,1', | ||
| 19 | - // height: 1500, | ||
| 20 | - // landscape: 1, | ||
| 21 | - // size: 1, | ||
| 22 | - // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg', | ||
| 23 | - // weight: 2000 | ||
| 24 | - // }, | ||
| 25 | - // { | ||
| 26 | - // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994155727712256.png?x-oss-process=image/quality,q_90/auto-orient,1', | ||
| 27 | - // height: 1500, | ||
| 28 | - // landscape: 1, | ||
| 29 | - // size: 1, | ||
| 30 | - // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994155727712256.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg', | ||
| 31 | - // weight: 2000 | ||
| 32 | - // }, | ||
| 33 | - // { | ||
| 34 | - // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/quality,q_90/auto-orient,1', | ||
| 35 | - // height: 1280, | ||
| 36 | - // landscape: 1, | ||
| 37 | - // size: 1, | ||
| 38 | - // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg', | ||
| 39 | - // weight: 1707 | ||
| 40 | - // }, | ||
| 41 | - // { | ||
| 42 | - // fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/quality,q_90/auto-orient,1', | ||
| 43 | - // height: 1280, | ||
| 44 | - // landscape: 1, | ||
| 45 | - // size: 1, | ||
| 46 | - // url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg', | ||
| 47 | - // weight: 1707 | ||
| 48 | - // } | ||
| 49 | - // ], | ||
| 50 | - // newsSummary: '#平安建设双提升#【进工地,送安全】3月21日下午,@合肥交警 包河大队走进辖区建筑工地为驾驶员、安全员们开展春季交通安全主题宣传活动。活动中,交警结合涉工程运输车、渣土车交通事故案例,详细讲解行驶注意事项,并普及了“一盔一带”“右转必停”等安全常识,要求驾驶员牢固树立交通安全意识,自觉遵守交通法律法规,确保出行安全。', | ||
| 51 | - // newsTitle: '#平安建设双提升#【进工地,送安全】3月21日下午,@合肥交警 包河大队走进辖区建筑工地为驾驶员、安全员们开展春季交通安全主题宣传活动。活动中,交警结合涉工程运输车、渣土车交通事故案例,详细讲解行驶注意事项,并普及了“一盔一带”“右转必停”等安全常识,要求驾驶员牢固树立交通安全意识,自觉遵守交通法律法规,确保出行安全。', | ||
| 52 | - // publishTime: '1711185754000', | ||
| 53 | - // relType: '1', | ||
| 54 | - // rmhInfo: { | ||
| 55 | - // authIcon: '', | ||
| 56 | - // authTitle: '', | ||
| 57 | - // authTitle2: '', | ||
| 58 | - // banControl: 0, | ||
| 59 | - // cnIsAttention: 1, | ||
| 60 | - // cnIsComment: 1, | ||
| 61 | - // cnIsLike: 1, | ||
| 62 | - // cnMainControl: 1, | ||
| 63 | - // cnShareControl: 1, | ||
| 64 | - // posterShareControl: 1, | ||
| 65 | - // rmhDesc: '合肥市公安局官方人民号', | ||
| 66 | - // rmhHeadUrl: 'https://uatjdcdnphoto.aikan.pdnews.cn/vod/content/202302/202302Sa121448724/TUw.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg', | ||
| 67 | - // rmhId: '4255290', | ||
| 68 | - // rmhName: '合肥警方', | ||
| 69 | - // userId: '513697181730757', | ||
| 70 | - // userType: '2' | ||
| 71 | - // } | ||
| 72 | } as ContentDTO | 16 | } as ContentDTO |
| 73 | - | ||
| 74 | - aboutToAppear(): void { | ||
| 75 | - } | 17 | + @State clicked: boolean = false; |
| 76 | 18 | ||
| 77 | build() { | 19 | build() { |
| 78 | Column() { | 20 | Column() { |
| @@ -82,11 +24,12 @@ export struct Card19Component { | @@ -82,11 +24,12 @@ export struct Card19Component { | ||
| 82 | if (this.contentDTO.newsTitle) { | 24 | if (this.contentDTO.newsTitle) { |
| 83 | Text(this.contentDTO.newsTitle) | 25 | Text(this.contentDTO.newsTitle) |
| 84 | .fontSize($r('app.float.font_size_17')) | 26 | .fontSize($r('app.float.font_size_17')) |
| 85 | - .fontColor($r('app.color.color_222222')) | ||
| 86 | - .textOverflowStyle(2) | 27 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 28 | + .textOverflowStyle(3) | ||
| 87 | .margin({ bottom: 8 }) | 29 | .margin({ bottom: 8 }) |
| 88 | .width(CommonConstants.FULL_WIDTH) | 30 | .width(CommonConstants.FULL_WIDTH) |
| 89 | .onClick((event: ClickEvent) => { | 31 | .onClick((event: ClickEvent) => { |
| 32 | + this.clicked = true; | ||
| 90 | ProcessUtils.processPage(this.contentDTO) | 33 | ProcessUtils.processPage(this.contentDTO) |
| 91 | }) | 34 | }) |
| 92 | } | 35 | } |
| @@ -104,6 +47,7 @@ export struct Card19Component { | @@ -104,6 +47,7 @@ export struct Card19Component { | ||
| 104 | }) | 47 | }) |
| 105 | ProcessUtils.gotoMultiPictureListPage(photoList,0) | 48 | ProcessUtils.gotoMultiPictureListPage(photoList,0) |
| 106 | }) | 49 | }) |
| 50 | + CarderInteraction({contentDTO: this.contentDTO}) | ||
| 107 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 51 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 108 | } | 52 | } |
| 109 | .padding({ | 53 | .padding({ |
| @@ -113,6 +57,7 @@ export struct Card19Component { | @@ -113,6 +57,7 @@ export struct Card19Component { | ||
| 113 | bottom: $r('app.float.card_comp_pagePadding_tb') | 57 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 114 | }) | 58 | }) |
| 115 | .onClick((event: ClickEvent) => { | 59 | .onClick((event: ClickEvent) => { |
| 60 | + this.clicked = true; | ||
| 116 | ProcessUtils.processPage(this.contentDTO) | 61 | ProcessUtils.processPage(this.contentDTO) |
| 117 | }) | 62 | }) |
| 118 | } | 63 | } |
| @@ -130,13 +75,17 @@ struct createImg { | @@ -130,13 +75,17 @@ struct createImg { | ||
| 130 | @Prop fullColumnImgUrls: FullColumnImgUrlDTO[] | 75 | @Prop fullColumnImgUrls: FullColumnImgUrlDTO[] |
| 131 | @State picWidth: number = 0; | 76 | @State picWidth: number = 0; |
| 132 | @State picHeight: number = 0; | 77 | @State picHeight: number = 0; |
| 133 | - aboutToAppear(): void { | 78 | + @State loadImg: boolean = false; |
| 79 | + | ||
| 80 | + async aboutToAppear(): Promise<void> { | ||
| 81 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 134 | if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位 | 82 | if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位 |
| 135 | this.fullColumnImgUrls.splice(2,0, { | 83 | this.fullColumnImgUrls.splice(2,0, { |
| 136 | fullUrl: '' | 84 | fullUrl: '' |
| 137 | } as FullColumnImgUrlDTO) | 85 | } as FullColumnImgUrlDTO) |
| 138 | } | 86 | } |
| 139 | } | 87 | } |
| 88 | + | ||
| 140 | caclImageRadius(index: number) { | 89 | caclImageRadius(index: number) { |
| 141 | let radius: radiusType = { | 90 | let radius: radiusType = { |
| 142 | topLeft: index === 0 ? $r('app.float.image_border_radius') : 0, | 91 | topLeft: index === 0 ? $r('app.float.image_border_radius') : 0, |
| @@ -189,13 +138,14 @@ struct createImg { | @@ -189,13 +138,14 @@ struct createImg { | ||
| 189 | alignContent: Alignment.BottomEnd | 138 | alignContent: Alignment.BottomEnd |
| 190 | }) { | 139 | }) { |
| 191 | if (this.getPicType() === 1) { | 140 | if (this.getPicType() === 1) { |
| 192 | - Image(item.fullUrl) | 141 | + Image(this.loadImg ? item.fullUrl : '') |
| 142 | + .backgroundColor(0xf5f5f5) | ||
| 193 | .width('100%') | 143 | .width('100%') |
| 194 | .height(172) | 144 | .height(172) |
| 195 | .autoResize(true) | 145 | .autoResize(true) |
| 196 | .borderRadius(this.caclImageRadius(index)) | 146 | .borderRadius(this.caclImageRadius(index)) |
| 197 | } else if (this.getPicType() === 2) { | 147 | } else if (this.getPicType() === 2) { |
| 198 | - Image(item.fullUrl) | 148 | + Image(this.loadImg ? item.fullUrl : '') |
| 199 | .width('100%') | 149 | .width('100%') |
| 200 | .height(305) | 150 | .height(305) |
| 201 | .autoResize(true) | 151 | .autoResize(true) |
| @@ -211,6 +161,7 @@ struct createImg { | @@ -211,6 +161,7 @@ struct createImg { | ||
| 211 | .fontWeight(400) | 161 | .fontWeight(400) |
| 212 | .fontColor(0xffffff) | 162 | .fontColor(0xffffff) |
| 213 | .fontFamily('PingFang SC') | 163 | .fontFamily('PingFang SC') |
| 164 | + .shadow({radius: 4, color: 0xc3cbd5, offsetX: 4, offsetY: 4}) | ||
| 214 | } | 165 | } |
| 215 | .width(48) | 166 | .width(48) |
| 216 | .padding({bottom: 9}) | 167 | .padding({bottom: 9}) |
| @@ -221,7 +172,8 @@ struct createImg { | @@ -221,7 +172,8 @@ struct createImg { | ||
| 221 | GridCol({ | 172 | GridCol({ |
| 222 | span: { xs: 8 } | 173 | span: { xs: 8 } |
| 223 | }) { | 174 | }) { |
| 224 | - Image(item.fullUrl) | 175 | + Image(this.loadImg ? item.fullUrl : '') |
| 176 | + .backgroundColor(0xf5f5f5) | ||
| 225 | .width('100%') | 177 | .width('100%') |
| 226 | .borderRadius(this.caclImageRadius(index)) | 178 | .borderRadius(this.caclImageRadius(index)) |
| 227 | .autoResize(true) | 179 | .autoResize(true) |
| @@ -236,7 +188,8 @@ struct createImg { | @@ -236,7 +188,8 @@ struct createImg { | ||
| 236 | GridCol({ | 188 | GridCol({ |
| 237 | span: { xs: 4 } | 189 | span: { xs: 4 } |
| 238 | }) { | 190 | }) { |
| 239 | - Image(item.fullUrl) | 191 | + Image(this.loadImg ? item.fullUrl : '') |
| 192 | + .backgroundColor(0xf5f5f5) | ||
| 240 | .aspectRatio(1) | 193 | .aspectRatio(1) |
| 241 | .borderRadius(this.caclImageRadius(index)) | 194 | .borderRadius(this.caclImageRadius(index)) |
| 242 | } | 195 | } |
| @@ -244,7 +197,8 @@ struct createImg { | @@ -244,7 +197,8 @@ struct createImg { | ||
| 244 | GridCol({ | 197 | GridCol({ |
| 245 | span: { sm: 4, lg: 3 } | 198 | span: { sm: 4, lg: 3 } |
| 246 | }) { | 199 | }) { |
| 247 | - Image(item.fullUrl) | 200 | + Image(this.loadImg ? item.fullUrl : '') |
| 201 | + .backgroundColor(0xf5f5f5) | ||
| 248 | .aspectRatio(1) | 202 | .aspectRatio(1) |
| 249 | .borderRadius(this.caclImageRadius(index)) | 203 | .borderRadius(this.caclImageRadius(index)) |
| 250 | } | 204 | } |
| @@ -3,6 +3,9 @@ import { RmhTitle } from '../cardCommon/RmhTitle' | @@ -3,6 +3,9 @@ import { RmhTitle } from '../cardCommon/RmhTitle' | ||
| 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 4 | import { CommonConstants } from 'wdConstant/Index'; | 4 | import { CommonConstants } from 'wdConstant/Index'; |
| 5 | import { ProcessUtils } from 'wdRouter'; | 5 | import { ProcessUtils } from 'wdRouter'; |
| 6 | +import {CarderInteraction} from '../CarderInteraction' | ||
| 7 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 8 | + | ||
| 6 | const TAG = 'Card20Component'; | 9 | const TAG = 'Card20Component'; |
| 7 | 10 | ||
| 8 | /** | 11 | /** |
| @@ -11,38 +14,8 @@ const TAG = 'Card20Component'; | @@ -11,38 +14,8 @@ const TAG = 'Card20Component'; | ||
| 11 | @Component | 14 | @Component |
| 12 | export struct Card20Component { | 15 | export struct Card20Component { |
| 13 | @State contentDTO: ContentDTO = { | 16 | @State contentDTO: ContentDTO = { |
| 14 | - // appStyle: '20', | ||
| 15 | - // coverType: 1, | ||
| 16 | - // coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 17 | - // fullColumnImgUrls: [ | ||
| 18 | - // { | ||
| 19 | - // landscape: 1, | ||
| 20 | - // size: 1, | ||
| 21 | - // url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 22 | - // weight: 1600 | ||
| 23 | - // } | ||
| 24 | - // ], | ||
| 25 | - // newsTitle: '好玩!》', | ||
| 26 | - // rmhInfo: { | ||
| 27 | - // authIcon: | ||
| 28 | - // 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png', | ||
| 29 | - // authTitle: '10后音乐人王烁然个人人民号', | ||
| 30 | - // authTitle2: '10后音乐人王烁然个人人民号', | ||
| 31 | - // banControl: 0, | ||
| 32 | - // cnIsAttention: 1, | ||
| 33 | - // rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人', | ||
| 34 | - // rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg', | ||
| 35 | - // rmhName: '王烁然', | ||
| 36 | - // userId: '522435359667845', | ||
| 37 | - // userType: '2' | ||
| 38 | - // }, | ||
| 39 | - // objectType: '1', | ||
| 40 | - // videoInfo: { | ||
| 41 | - // firstFrameImageUri: '', | ||
| 42 | - // videoDuration: 37, | ||
| 43 | - // videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4' | ||
| 44 | - // } | ||
| 45 | } as ContentDTO; | 17 | } as ContentDTO; |
| 18 | + @State clicked: boolean = false; | ||
| 46 | 19 | ||
| 47 | aboutToAppear(): void { | 20 | aboutToAppear(): void { |
| 48 | } | 21 | } |
| @@ -55,15 +28,16 @@ export struct Card20Component { | @@ -55,15 +28,16 @@ export struct Card20Component { | ||
| 55 | if (this.contentDTO.newsTitle) { | 28 | if (this.contentDTO.newsTitle) { |
| 56 | Text(this.contentDTO.newsTitle) | 29 | Text(this.contentDTO.newsTitle) |
| 57 | .fontSize($r('app.float.font_size_17')) | 30 | .fontSize($r('app.float.font_size_17')) |
| 58 | - .fontColor($r('app.color.color_222222')) | 31 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 59 | .width(CommonConstants.FULL_WIDTH) | 32 | .width(CommonConstants.FULL_WIDTH) |
| 60 | - .textOverflowStyle(2) | 33 | + .textOverflowStyle(3) |
| 61 | .margin({ bottom: 8 }) | 34 | .margin({ bottom: 8 }) |
| 62 | .lineHeight(20) | 35 | .lineHeight(20) |
| 63 | } | 36 | } |
| 64 | if (this.contentDTO.fullColumnImgUrls[0]) { | 37 | if (this.contentDTO.fullColumnImgUrls[0]) { |
| 65 | createImg({ contentDTO: this.contentDTO }) | 38 | createImg({ contentDTO: this.contentDTO }) |
| 66 | } | 39 | } |
| 40 | + CarderInteraction({contentDTO: this.contentDTO}) | ||
| 67 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 41 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 68 | } | 42 | } |
| 69 | .padding({ | 43 | .padding({ |
| @@ -73,6 +47,7 @@ export struct Card20Component { | @@ -73,6 +47,7 @@ export struct Card20Component { | ||
| 73 | bottom: $r('app.float.card_comp_pagePadding_tb') | 47 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 74 | }) | 48 | }) |
| 75 | .onClick((event: ClickEvent) => { | 49 | .onClick((event: ClickEvent) => { |
| 50 | + this.clicked = true; | ||
| 76 | ProcessUtils.processPage(this.contentDTO) | 51 | ProcessUtils.processPage(this.contentDTO) |
| 77 | }) | 52 | }) |
| 78 | } | 53 | } |
| @@ -88,6 +63,12 @@ interface radiusType { | @@ -88,6 +63,12 @@ interface radiusType { | ||
| 88 | @Component | 63 | @Component |
| 89 | struct createImg { | 64 | struct createImg { |
| 90 | @Prop contentDTO: ContentDTO | 65 | @Prop contentDTO: ContentDTO |
| 66 | + @State loadImg: boolean = false; | ||
| 67 | + | ||
| 68 | + async aboutToAppear(): Promise<void> { | ||
| 69 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 70 | + } | ||
| 71 | + | ||
| 91 | 72 | ||
| 92 | build() { | 73 | build() { |
| 93 | GridRow() { | 74 | GridRow() { |
| @@ -97,7 +78,8 @@ struct createImg { | @@ -97,7 +78,8 @@ struct createImg { | ||
| 97 | span: { xs: 12 } | 78 | span: { xs: 12 } |
| 98 | }) { | 79 | }) { |
| 99 | Stack() { | 80 | Stack() { |
| 100 | - Image(this.contentDTO.coverUrl) | 81 | + Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 82 | + .backgroundColor(0xf5f5f5) | ||
| 101 | .width(CommonConstants.FULL_WIDTH) | 83 | .width(CommonConstants.FULL_WIDTH) |
| 102 | .aspectRatio(16 / 9) | 84 | .aspectRatio(16 / 9) |
| 103 | .borderRadius($r('app.float.image_border_radius')) | 85 | .borderRadius($r('app.float.image_border_radius')) |
| @@ -114,7 +96,8 @@ struct createImg { | @@ -114,7 +96,8 @@ struct createImg { | ||
| 114 | span: { xs: 6 } | 96 | span: { xs: 6 } |
| 115 | }) { | 97 | }) { |
| 116 | Stack() { | 98 | Stack() { |
| 117 | - Image(this.contentDTO.coverUrl) | 99 | + Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 100 | + .backgroundColor(0xf5f5f5) | ||
| 118 | .width(CommonConstants.FULL_WIDTH) | 101 | .width(CommonConstants.FULL_WIDTH) |
| 119 | .borderRadius($r('app.float.image_border_radius')) | 102 | .borderRadius($r('app.float.image_border_radius')) |
| 120 | CardMediaInfo({ contentDTO: this.contentDTO }) | 103 | CardMediaInfo({ contentDTO: this.contentDTO }) |
| @@ -3,6 +3,8 @@ import { CommonConstants, CompStyle } from 'wdConstant'; | @@ -3,6 +3,8 @@ import { CommonConstants, CompStyle } from 'wdConstant'; | ||
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { RmhTitle } from '../cardCommon/RmhTitle' | 4 | import { RmhTitle } from '../cardCommon/RmhTitle' |
| 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 6 | +import {CarderInteraction} from '../CarderInteraction' | ||
| 7 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 6 | 8 | ||
| 7 | const TAG: string = 'Card6Component-Card13Component'; | 9 | const TAG: string = 'Card6Component-Card13Component'; |
| 8 | 10 | ||
| @@ -12,6 +14,12 @@ const TAG: string = 'Card6Component-Card13Component'; | @@ -12,6 +14,12 @@ const TAG: string = 'Card6Component-Card13Component'; | ||
| 12 | @Component | 14 | @Component |
| 13 | export struct Card21Component { | 15 | export struct Card21Component { |
| 14 | @State contentDTO: ContentDTO = {} as ContentDTO; | 16 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 17 | + @State loadImg: boolean = false; | ||
| 18 | + @State clicked: boolean = false; | ||
| 19 | + | ||
| 20 | + async aboutToAppear(): Promise<void> { | ||
| 21 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 22 | + } | ||
| 15 | 23 | ||
| 16 | build() { | 24 | build() { |
| 17 | Column() { | 25 | Column() { |
| @@ -22,7 +30,7 @@ export struct Card21Component { | @@ -22,7 +30,7 @@ export struct Card21Component { | ||
| 22 | GridItem() { | 30 | GridItem() { |
| 23 | Text(`${this.contentDTO.newsTitle}`) | 31 | Text(`${this.contentDTO.newsTitle}`) |
| 24 | .fontSize($r('app.float.selected_text_size')) | 32 | .fontSize($r('app.float.selected_text_size')) |
| 25 | - .fontColor($r('app.color.color_222222')) | 33 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 26 | .width(CommonConstants.FULL_WIDTH) | 34 | .width(CommonConstants.FULL_WIDTH) |
| 27 | .maxLines(4) | 35 | .maxLines(4) |
| 28 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 36 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| @@ -32,7 +40,8 @@ export struct Card21Component { | @@ -32,7 +40,8 @@ export struct Card21Component { | ||
| 32 | 40 | ||
| 33 | GridItem() { | 41 | GridItem() { |
| 34 | Stack() { | 42 | Stack() { |
| 35 | - Image(this.contentDTO.coverUrl) | 43 | + Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 44 | + .backgroundColor(0xf5f5f5) | ||
| 36 | .width(CommonConstants.FULL_WIDTH) | 45 | .width(CommonConstants.FULL_WIDTH) |
| 37 | .borderRadius($r('app.float.image_border_radius')) | 46 | .borderRadius($r('app.float.image_border_radius')) |
| 38 | CardMediaInfo({ contentDTO: this.contentDTO }) | 47 | CardMediaInfo({ contentDTO: this.contentDTO }) |
| @@ -42,10 +51,11 @@ export struct Card21Component { | @@ -42,10 +51,11 @@ export struct Card21Component { | ||
| 42 | } | 51 | } |
| 43 | .columnsTemplate('2fr 1fr') | 52 | .columnsTemplate('2fr 1fr') |
| 44 | .maxCount(1) | 53 | .maxCount(1) |
| 45 | - | 54 | + CarderInteraction({contentDTO: this.contentDTO}) |
| 46 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 55 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 47 | } | 56 | } |
| 48 | .onClick((event: ClickEvent) => { | 57 | .onClick((event: ClickEvent) => { |
| 58 | + this.clicked = true; | ||
| 49 | ProcessUtils.processPage(this.contentDTO) | 59 | ProcessUtils.processPage(this.contentDTO) |
| 50 | }) | 60 | }) |
| 51 | .padding({ | 61 | .padding({ |
| @@ -2,8 +2,11 @@ | @@ -2,8 +2,11 @@ | ||
| 2 | import { ContentDTO } from 'wdBean'; | 2 | import { ContentDTO } from 'wdBean'; |
| 3 | import { CommonConstants } from 'wdConstant/Index'; | 3 | import { CommonConstants } from 'wdConstant/Index'; |
| 4 | import { ProcessUtils } from 'wdRouter'; | 4 | import { ProcessUtils } from 'wdRouter'; |
| 5 | -import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 6 | -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 5 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; |
| 6 | +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; | ||
| 7 | +import { Notes } from './notes'; | ||
| 8 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 9 | + | ||
| 7 | const TAG: string = 'Card2Component'; | 10 | const TAG: string = 'Card2Component'; |
| 8 | 11 | ||
| 9 | /** | 12 | /** |
| @@ -15,38 +18,39 @@ const TAG: string = 'Card2Component'; | @@ -15,38 +18,39 @@ const TAG: string = 'Card2Component'; | ||
| 15 | */ | 18 | */ |
| 16 | @Component | 19 | @Component |
| 17 | export struct Card2Component { | 20 | export struct Card2Component { |
| 18 | - @State contentDTO: ContentDTO = { | ||
| 19 | - // appStyle: '2', | ||
| 20 | - // objectType: '1', | ||
| 21 | - // coverUrl: | ||
| 22 | - // 'https://rmrbcmsonline.peopleapp.com/upload/image/202404/202404141115457926.png?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90', | ||
| 23 | - // newsTitle: '又见花开!新疆伊犁花海延绵清新怡人', | ||
| 24 | - // publishTime: '1713067227000', | ||
| 25 | - // source: '荔枝新闻', | ||
| 26 | - // videoInfo: { | ||
| 27 | - // videoDuration: 25, | ||
| 28 | - // videoLandscape: 1, | ||
| 29 | - // videoUrl: | ||
| 30 | - // 'https://rmrbcmsonline.peopleapp.com/upload/video/mp4/202404/1713064515901314d148763996.mp4' | ||
| 31 | - // } | ||
| 32 | - } as ContentDTO; | 21 | + @State contentDTO: ContentDTO = {} as ContentDTO; |
| 22 | + @State loadImg: boolean = false; | ||
| 23 | + @State clicked: boolean = false; | ||
| 24 | + | ||
| 25 | + async aboutToAppear(): Promise<void> { | ||
| 26 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 27 | + } | ||
| 33 | 28 | ||
| 34 | build() { | 29 | build() { |
| 35 | Column() { | 30 | Column() { |
| 36 | Column() { | 31 | Column() { |
| 37 | - //新闻标题 | ||
| 38 | - Text(this.contentDTO.newsTitle) | ||
| 39 | - .fontSize($r('app.float.font_size_17')) | ||
| 40 | - .fontColor($r('app.color.color_222222')) | ||
| 41 | - .maxLines(2) | ||
| 42 | - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | ||
| 43 | - .align(Alignment.Start) | 32 | + Stack() { |
| 33 | + //新闻标题 | ||
| 34 | + if (this.contentDTO.objectType == '5') { | ||
| 35 | + Notes({ objectType: this.contentDTO.objectType }) | ||
| 36 | + } | ||
| 37 | + Text(this.contentDTO.newsTitle) | ||
| 38 | + .fontSize($r('app.float.font_size_17')) | ||
| 39 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | ||
| 40 | + .maxLines(2) | ||
| 41 | + .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | ||
| 42 | + .align(Alignment.Start) | ||
| 43 | + .textIndent(this.contentDTO.objectType == '5' ? 40 : 0) | ||
| 44 | + } | ||
| 45 | + .alignContent(Alignment.TopStart) | ||
| 46 | + | ||
| 44 | //大图 | 47 | //大图 |
| 45 | Stack() { | 48 | Stack() { |
| 46 | - Image(this.contentDTO.coverUrl) | 49 | + Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 47 | .width(CommonConstants.FULL_WIDTH) | 50 | .width(CommonConstants.FULL_WIDTH) |
| 48 | .aspectRatio(16 / 9) | 51 | .aspectRatio(16 / 9) |
| 49 | .borderRadius($r('app.float.image_border_radius')) | 52 | .borderRadius($r('app.float.image_border_radius')) |
| 53 | + .backgroundColor(0xf5f5f5) | ||
| 50 | //播放状态+时长 | 54 | //播放状态+时长 |
| 51 | CardMediaInfo({ | 55 | CardMediaInfo({ |
| 52 | contentDTO: this.contentDTO | 56 | contentDTO: this.contentDTO |
| @@ -70,6 +74,7 @@ export struct Card2Component { | @@ -70,6 +74,7 @@ export struct Card2Component { | ||
| 70 | bottom: $r('app.float.card_comp_pagePadding_tb') | 74 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 71 | }) | 75 | }) |
| 72 | .onClick((event: ClickEvent) => { | 76 | .onClick((event: ClickEvent) => { |
| 77 | + this.clicked = true; | ||
| 73 | ProcessUtils.processPage(this.contentDTO) | 78 | ProcessUtils.processPage(this.contentDTO) |
| 74 | }) | 79 | }) |
| 75 | } | 80 | } |
| @@ -10,22 +10,14 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | @@ -10,22 +10,14 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | ||
| 10 | @Component | 10 | @Component |
| 11 | export struct Card3Component { | 11 | export struct Card3Component { |
| 12 | @State contentDTO: ContentDTO = { | 12 | @State contentDTO: ContentDTO = { |
| 13 | - // appStyle: '3', | ||
| 14 | - // channelId: '2002', | ||
| 15 | - // newsTitle: '习近平向斯洛伐克当选总统佩', | ||
| 16 | - // objectId: '30044351686', | ||
| 17 | - // objectType: '8', | ||
| 18 | - // publishTime: '1712967589000', | ||
| 19 | - // relId: '500005307414', | ||
| 20 | - // relType: '1', | ||
| 21 | - // source: '新华社', | ||
| 22 | } as ContentDTO; | 13 | } as ContentDTO; |
| 14 | + @State clicked: boolean = false; | ||
| 23 | 15 | ||
| 24 | build() { | 16 | build() { |
| 25 | Column() { | 17 | Column() { |
| 26 | Text(this.contentDTO.newsTitle) | 18 | Text(this.contentDTO.newsTitle) |
| 27 | .fontSize($r("app.float.font_size_16")) | 19 | .fontSize($r("app.float.font_size_16")) |
| 28 | - .fontColor($r("app.color.color_222222")) | 20 | + .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) |
| 29 | .width(CommonConstants.FULL_WIDTH) | 21 | .width(CommonConstants.FULL_WIDTH) |
| 30 | // 评论等信息 | 22 | // 评论等信息 |
| 31 | CardSourceInfo({ contentDTO: this.contentDTO }) | 23 | CardSourceInfo({ contentDTO: this.contentDTO }) |
| @@ -38,6 +30,7 @@ export struct Card3Component { | @@ -38,6 +30,7 @@ export struct Card3Component { | ||
| 38 | bottom: $r('app.float.card_comp_pagePadding_tb') | 30 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 39 | }) | 31 | }) |
| 40 | .onClick((event: ClickEvent) => { | 32 | .onClick((event: ClickEvent) => { |
| 33 | + this.clicked = true; | ||
| 41 | ProcessUtils.processPage(this.contentDTO) | 34 | ProcessUtils.processPage(this.contentDTO) |
| 42 | }) | 35 | }) |
| 43 | } | 36 | } |
| @@ -3,6 +3,7 @@ import { CommonConstants } from 'wdConstant/Index'; | @@ -3,6 +3,7 @@ import { CommonConstants } from 'wdConstant/Index'; | ||
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 6 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 6 | const TAG: string = 'Card4Component'; | 7 | const TAG: string = 'Card4Component'; |
| 7 | 8 | ||
| 8 | /** | 9 | /** |
| @@ -14,62 +15,14 @@ const TAG: string = 'Card4Component'; | @@ -14,62 +15,14 @@ const TAG: string = 'Card4Component'; | ||
| 14 | */ | 15 | */ |
| 15 | @Component | 16 | @Component |
| 16 | export struct Card4Component { | 17 | export struct Card4Component { |
| 17 | - @State contentDTO: ContentDTO = { | ||
| 18 | - // appStyle: '4', | ||
| 19 | - // fullColumnImgUrls: [ | ||
| 20 | - // { | ||
| 21 | - // format: null, | ||
| 22 | - // fullUrl: '', | ||
| 23 | - // height: 187, | ||
| 24 | - // landscape: 1, | ||
| 25 | - // size: 1, | ||
| 26 | - // url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118198_0c20f7c31c7b4eca6b0d0871e7771c62.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90', | ||
| 27 | - // weight: 248 | ||
| 28 | - // }, | ||
| 29 | - // { | ||
| 30 | - // format: null, | ||
| 31 | - // fullUrl: '', | ||
| 32 | - // height: 187, | ||
| 33 | - // landscape: 1, | ||
| 34 | - // size: 1, | ||
| 35 | - // url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118198_0c20f7c31c7b4eca6b0d0871e7771c62.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90', | ||
| 36 | - // weight: 248 | ||
| 37 | - // }, | ||
| 38 | - // { | ||
| 39 | - // format: null, | ||
| 40 | - // fullUrl: '', | ||
| 41 | - // height: 187, | ||
| 42 | - // landscape: 1, | ||
| 43 | - // size: 1, | ||
| 44 | - // url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118200_d10309bee894a67311e6c8f77df676d4.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90', | ||
| 45 | - // weight: 248 | ||
| 46 | - // }, | ||
| 47 | - // { | ||
| 48 | - // format: null, | ||
| 49 | - // fullUrl: '', | ||
| 50 | - // height: 187, | ||
| 51 | - // landscape: 1, | ||
| 52 | - // size: 1, | ||
| 53 | - // url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118202_f33743e452fb69ee2c45c18a56eccdf6.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90', | ||
| 54 | - // weight: 248 | ||
| 55 | - // } | ||
| 56 | - // ], | ||
| 57 | - // newsTitle: '科普:如何发现家中是否有白蚁危害?丨又到白蚁分飞季②', | ||
| 58 | - // rmhInfo: { | ||
| 59 | - // authIcon: | ||
| 60 | - // 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/blue.png', | ||
| 61 | - // authTitle: '封面新闻', | ||
| 62 | - // rmhDesc: '封面新闻,亿万年轻人的生活方式。', | ||
| 63 | - // rmhHeadUrl: | ||
| 64 | - // 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221212/122faff796.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg', | ||
| 65 | - // rmhId: '2016608', | ||
| 66 | - // rmhName: '封面新闻', | ||
| 67 | - // userId: '522390888224390', | ||
| 68 | - // userType: '2' | ||
| 69 | - // }, | ||
| 70 | - // source: '头条号', | ||
| 71 | - // publishTime: '1651204607000', | ||
| 72 | - } as ContentDTO; | 18 | + @State contentDTO: ContentDTO = {} as ContentDTO; |
| 19 | + @State loadImg: boolean = false; | ||
| 20 | + @State clicked: boolean = false; | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + async aboutToAppear(): Promise<void> { | ||
| 24 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 25 | + } | ||
| 73 | 26 | ||
| 74 | build() { | 27 | build() { |
| 75 | Column() { | 28 | Column() { |
| @@ -78,7 +31,7 @@ export struct Card4Component { | @@ -78,7 +31,7 @@ export struct Card4Component { | ||
| 78 | //新闻标题 | 31 | //新闻标题 |
| 79 | Text(this.contentDTO.newsTitle) | 32 | Text(this.contentDTO.newsTitle) |
| 80 | .fontSize($r('app.float.font_size_17')) | 33 | .fontSize($r('app.float.font_size_17')) |
| 81 | - .fontColor($r('app.color.color_222222')) | 34 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 82 | .maxLines(3) | 35 | .maxLines(3) |
| 83 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | 36 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 |
| 84 | //三图 | 37 | //三图 |
| @@ -88,7 +41,8 @@ export struct Card4Component { | @@ -88,7 +41,8 @@ export struct Card4Component { | ||
| 88 | ForEach(this.contentDTO.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => { | 41 | ForEach(this.contentDTO.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => { |
| 89 | if (index < 3) { | 42 | if (index < 3) { |
| 90 | GridCol({ span: { xs: 4 } }) { | 43 | GridCol({ span: { xs: 4 } }) { |
| 91 | - Image(item.url) | 44 | + Image(this.loadImg ? item.url : '') |
| 45 | + .backgroundColor(0xf5f5f5) | ||
| 92 | .width('100%') | 46 | .width('100%') |
| 93 | .aspectRatio(113 / 75) | 47 | .aspectRatio(113 / 75) |
| 94 | .borderRadius({ | 48 | .borderRadius({ |
| @@ -115,6 +69,7 @@ export struct Card4Component { | @@ -115,6 +69,7 @@ export struct Card4Component { | ||
| 115 | .justifyContent(FlexAlign.Start) | 69 | .justifyContent(FlexAlign.Start) |
| 116 | .alignItems(HorizontalAlign.Start) | 70 | .alignItems(HorizontalAlign.Start) |
| 117 | .onClick((event: ClickEvent) => { | 71 | .onClick((event: ClickEvent) => { |
| 72 | + this.clicked = true; | ||
| 118 | ProcessUtils.processPage(this.contentDTO) | 73 | ProcessUtils.processPage(this.contentDTO) |
| 119 | }) | 74 | }) |
| 120 | //bottom 评论等信息 | 75 | //bottom 评论等信息 |
| 1 | import { ContentDTO } from 'wdBean'; | 1 | import { ContentDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant'; | 2 | import { CommonConstants } from 'wdConstant'; |
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 5 | +import { Notes } from './notes'; | ||
| 4 | 6 | ||
| 5 | const TAG: string = 'Card5Component'; | 7 | const TAG: string = 'Card5Component'; |
| 6 | 8 | ||
| 7 | /** | 9 | /** |
| 8 | * 卡片样式:"appStyle":"5" 头图卡 | 10 | * 卡片样式:"appStyle":"5" 头图卡 |
| 9 | */ | 11 | */ |
| 10 | -// @Entry | ||
| 11 | @Component | 12 | @Component |
| 12 | export struct Card5Component { | 13 | export struct Card5Component { |
| 13 | - @State contentDTO: ContentDTO = { | ||
| 14 | - // coverSize: '850*478', | ||
| 15 | - // coverType: 1, | ||
| 16 | - // coverUrl: | ||
| 17 | - // 'https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20240323/image/display/54ce2de0d20842839e96a644c78361b7.jpg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg', | ||
| 18 | - // linkUrl: | ||
| 19 | - // 'https://pd-people-uat.pdnews.cn/h/atv/collect/1000000472?hiddenNavigator=1', | ||
| 20 | - // newsTitle: '今天是周日,天气阴天,明天是周一。', | ||
| 21 | - // objectType: '6' | ||
| 22 | - } as ContentDTO; | 14 | + @State contentDTO: ContentDTO = {} as ContentDTO; |
| 23 | @State titleShowPolicy: number | string = 1 | 15 | @State titleShowPolicy: number | string = 1 |
| 16 | + @State loadImg: boolean = false; | ||
| 17 | + @State clicked: boolean = false; | ||
| 18 | + | ||
| 19 | + async aboutToAppear(): Promise<void> { | ||
| 20 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 21 | + } | ||
| 24 | 22 | ||
| 25 | build() { | 23 | build() { |
| 26 | Stack() { | 24 | Stack() { |
| 27 | - Image(this.contentDTO.coverUrl) | 25 | + Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 26 | + .backgroundColor(0xf5f5f5) | ||
| 28 | .width(CommonConstants.FULL_WIDTH) | 27 | .width(CommonConstants.FULL_WIDTH) |
| 29 | .autoResize(true) | 28 | .autoResize(true) |
| 30 | .borderRadius($r('app.float.image_border_radius')) | 29 | .borderRadius($r('app.float.image_border_radius')) |
| 31 | - if ((this.titleShowPolicy === 1 || this.contentDTO.titleShow === 1) && this.contentDTO.newsTitle) { | 30 | + // if ((this.titleShowPolicy === 1 || this.contentDTO.titleShow === 1) && this.contentDTO.newsTitle) { |
| 32 | Row() | 31 | Row() |
| 33 | .width(CommonConstants.FULL_WIDTH) | 32 | .width(CommonConstants.FULL_WIDTH) |
| 34 | .height(59) | 33 | .height(59) |
| @@ -38,22 +37,24 @@ export struct Card5Component { | @@ -38,22 +37,24 @@ export struct Card5Component { | ||
| 38 | ] | 37 | ] |
| 39 | }) | 38 | }) |
| 40 | Row() { | 39 | Row() { |
| 41 | - if (this.titleShowPolicy === 1) { | 40 | + Stack() { |
| 41 | + if (this.contentDTO.objectType == '5') { | ||
| 42 | + Notes({ objectType: this.contentDTO.objectType }) | ||
| 43 | + } | ||
| 42 | Text(this.contentDTO.newsTitle) | 44 | Text(this.contentDTO.newsTitle) |
| 43 | - .width(CommonConstants.FULL_WIDTH) | ||
| 44 | - .height(CommonConstants.FULL_HEIGHT) | 45 | + .width(CommonConstants.FULL_WIDTH)// .height(CommonConstants.FULL_HEIGHT) |
| 45 | .fontColor(Color.White) | 46 | .fontColor(Color.White) |
| 46 | .fontSize($r('app.float.normal_text_size')) | 47 | .fontSize($r('app.float.normal_text_size')) |
| 47 | .fontWeight(FontWeight.Bold) | 48 | .fontWeight(FontWeight.Bold) |
| 48 | .maxLines(2) | 49 | .maxLines(2) |
| 49 | - .align(Alignment.Bottom) | ||
| 50 | - } | ||
| 51 | - | 50 | + .align(Alignment.TopStart) |
| 51 | + .textIndent(this.contentDTO.objectType == '5' ? 40 : 0) | ||
| 52 | + }.alignContent(Alignment.TopStart) | ||
| 52 | } | 53 | } |
| 53 | .justifyContent(FlexAlign.Start) | 54 | .justifyContent(FlexAlign.Start) |
| 54 | - .height(40) | 55 | + // .height(40) |
| 55 | .margin({ left: 12, bottom: 10, right: 12 }) | 56 | .margin({ left: 12, bottom: 10, right: 12 }) |
| 56 | - } | 57 | + // } |
| 57 | } | 58 | } |
| 58 | .alignContent(Alignment.Bottom) | 59 | .alignContent(Alignment.Bottom) |
| 59 | .width(CommonConstants.FULL_WIDTH) | 60 | .width(CommonConstants.FULL_WIDTH) |
| @@ -64,6 +65,7 @@ export struct Card5Component { | @@ -64,6 +65,7 @@ export struct Card5Component { | ||
| 64 | bottom: $r('app.float.card_comp_pagePadding_tb') | 65 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 65 | }) | 66 | }) |
| 66 | .onClick((event: ClickEvent) => { | 67 | .onClick((event: ClickEvent) => { |
| 68 | + this.clicked = true; | ||
| 67 | ProcessUtils.processPage(this.contentDTO) | 69 | ProcessUtils.processPage(this.contentDTO) |
| 68 | }) | 70 | }) |
| 69 | 71 |
| 1 | import { ContentDTO } from 'wdBean'; | 1 | import { ContentDTO } from 'wdBean'; |
| 2 | import { CommonConstants, CompStyle } from 'wdConstant'; | 2 | import { CommonConstants, CompStyle } from 'wdConstant'; |
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | ||
| 5 | -import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 4 | +import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; |
| 5 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; | ||
| 6 | +import { Notes } from './notes'; | ||
| 7 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 8 | + | ||
| 6 | const TAG: string = 'Card6Component-Card13Component'; | 9 | const TAG: string = 'Card6Component-Card13Component'; |
| 7 | 10 | ||
| 8 | /** | 11 | /** |
| @@ -11,6 +14,12 @@ const TAG: string = 'Card6Component-Card13Component'; | @@ -11,6 +14,12 @@ const TAG: string = 'Card6Component-Card13Component'; | ||
| 11 | @Component | 14 | @Component |
| 12 | export struct Card6Component { | 15 | export struct Card6Component { |
| 13 | @State contentDTO: ContentDTO = {} as ContentDTO; | 16 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 17 | + @State loadImg: boolean = false; | ||
| 18 | + @State clicked: boolean = false; | ||
| 19 | + | ||
| 20 | + async aboutToAppear(): Promise<void> { | ||
| 21 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 22 | + } | ||
| 14 | 23 | ||
| 15 | build() { | 24 | build() { |
| 16 | Row() { | 25 | Row() { |
| @@ -26,12 +35,22 @@ export struct Card6Component { | @@ -26,12 +35,22 @@ export struct Card6Component { | ||
| 26 | // .padding(2) | 35 | // .padding(2) |
| 27 | // .margin({ right: 2 }) | 36 | // .margin({ right: 2 }) |
| 28 | // } | 37 | // } |
| 29 | - Text(`${this.contentDTO.newsTitle}`) | ||
| 30 | - .fontSize(16) | ||
| 31 | - .fontWeight(FontWeight.Normal) | ||
| 32 | - .maxLines(3)// | ||
| 33 | - .alignSelf(ItemAlign.Start) | ||
| 34 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | 38 | + Stack() { |
| 39 | + if (this.contentDTO.newTags) { | ||
| 40 | + Notes({ newTags: this.contentDTO.newTags }) | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + Text(`${this.contentDTO.newsTitle}`) | ||
| 44 | + .fontColor(this.clicked ? 0x848484 : 0x222222) | ||
| 45 | + .fontSize(16) | ||
| 46 | + .fontWeight(FontWeight.Normal) | ||
| 47 | + .maxLines(3) | ||
| 48 | + .alignSelf(ItemAlign.Start) | ||
| 49 | + .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | ||
| 50 | + .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 60 : | ||
| 51 | + this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length < 3 ? 30 : 0) | ||
| 52 | + }.alignContent(Alignment.TopStart) | ||
| 53 | + | ||
| 35 | }.height("80%") | 54 | }.height("80%") |
| 36 | .justifyContent(FlexAlign.Start) | 55 | .justifyContent(FlexAlign.Start) |
| 37 | 56 | ||
| @@ -42,9 +61,10 @@ export struct Card6Component { | @@ -42,9 +61,10 @@ export struct Card6Component { | ||
| 42 | .alignItems(HorizontalAlign.Start) | 61 | .alignItems(HorizontalAlign.Start) |
| 43 | .justifyContent(FlexAlign.Start) | 62 | .justifyContent(FlexAlign.Start) |
| 44 | .width('58%') | 63 | .width('58%') |
| 64 | + | ||
| 45 | Stack() { | 65 | Stack() { |
| 46 | - Image(this.contentDTO.coverUrl) | ||
| 47 | - .backgroundColor($r('app.color.color_B0B0B0')) | 66 | + Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 67 | + .backgroundColor( this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5) | ||
| 48 | .borderRadius(5) | 68 | .borderRadius(5) |
| 49 | .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) | 69 | .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) |
| 50 | .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 90 : 180) | 70 | .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 90 : 180) |
| @@ -53,6 +73,7 @@ export struct Card6Component { | @@ -53,6 +73,7 @@ export struct Card6Component { | ||
| 53 | .alignContent(Alignment.BottomEnd) | 73 | .alignContent(Alignment.BottomEnd) |
| 54 | } | 74 | } |
| 55 | .onClick((event: ClickEvent) => { | 75 | .onClick((event: ClickEvent) => { |
| 76 | + this.clicked = true; | ||
| 56 | ProcessUtils.processPage(this.contentDTO) | 77 | ProcessUtils.processPage(this.contentDTO) |
| 57 | }) | 78 | }) |
| 58 | .padding({ | 79 | .padding({ |
| @@ -2,6 +2,8 @@ import { ContentDTO, slideShows } from 'wdBean'; | @@ -2,6 +2,8 @@ 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 | +import { Notes } from './notes'; | ||
| 6 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 5 | 7 | ||
| 6 | /** | 8 | /** |
| 7 | * 时间链卡--CompStyle: 09 | 9 | * 时间链卡--CompStyle: 09 |
| @@ -11,12 +13,19 @@ const TAG: string = 'Card9Component'; | @@ -11,12 +13,19 @@ const TAG: string = 'Card9Component'; | ||
| 11 | @Component | 13 | @Component |
| 12 | export struct Card9Component { | 14 | export struct Card9Component { |
| 13 | @State contentDTO: ContentDTO = {} as ContentDTO; | 15 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 16 | + @State loadImg: boolean = false; | ||
| 17 | + @State clicked: boolean = false; | ||
| 18 | + | ||
| 19 | + async aboutToAppear(): Promise<void> { | ||
| 20 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 21 | + } | ||
| 14 | 22 | ||
| 15 | build() { | 23 | build() { |
| 16 | Column() { | 24 | Column() { |
| 17 | // 顶部标题,最多两行 | 25 | // 顶部标题,最多两行 |
| 18 | if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { | 26 | if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { |
| 19 | Text(this.contentDTO.newsTitle) | 27 | Text(this.contentDTO.newsTitle) |
| 28 | + .fontColor(this.clicked ? 0x848484 : 0x222222) | ||
| 20 | .width(CommonConstants.FULL_WIDTH) | 29 | .width(CommonConstants.FULL_WIDTH) |
| 21 | .fontSize($r('app.float.font_size_17')) | 30 | .fontSize($r('app.float.font_size_17')) |
| 22 | .fontWeight(600) | 31 | .fontWeight(600) |
| @@ -26,18 +35,15 @@ export struct Card9Component { | @@ -26,18 +35,15 @@ export struct Card9Component { | ||
| 26 | } | 35 | } |
| 27 | // 大图 | 36 | // 大图 |
| 28 | Stack() { | 37 | Stack() { |
| 29 | - Image(this.contentDTO.coverUrl) | 38 | + Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 39 | + .backgroundColor(0xf5f5f5) | ||
| 30 | .width('100%') | 40 | .width('100%') |
| 31 | .borderRadius({ | 41 | .borderRadius({ |
| 32 | topLeft: $r('app.float.image_border_radius'), | 42 | topLeft: $r('app.float.image_border_radius'), |
| 33 | topRight: $r('app.float.image_border_radius') | 43 | topRight: $r('app.float.image_border_radius') |
| 34 | }) | 44 | }) |
| 35 | - Text('专题') | ||
| 36 | - .fontSize($r('app.float.font_size_12')) | ||
| 37 | - .padding({ left: 8, right: 8, top: 3, bottom: 3 }) | ||
| 38 | - .backgroundColor(Color.Red) | ||
| 39 | - .fontColor(Color.White) | ||
| 40 | - .borderRadius($r('app.float.button_border_radius')) | 45 | + |
| 46 | + Notes({ objectType: 5 }) | ||
| 41 | .margin({ left: 5, bottom: 5 }) | 47 | .margin({ left: 5, bottom: 5 }) |
| 42 | }.alignContent(Alignment.BottomStart) | 48 | }.alignContent(Alignment.BottomStart) |
| 43 | 49 | ||
| @@ -77,6 +83,7 @@ export struct Card9Component { | @@ -77,6 +83,7 @@ export struct Card9Component { | ||
| 77 | .backgroundColor($r("app.color.white")) | 83 | .backgroundColor($r("app.color.white")) |
| 78 | .margin({ bottom: 8 }) | 84 | .margin({ bottom: 8 }) |
| 79 | .onClick((event: ClickEvent) => { | 85 | .onClick((event: ClickEvent) => { |
| 86 | + this.clicked = true; | ||
| 80 | ProcessUtils.processPage(this.contentDTO) | 87 | ProcessUtils.processPage(this.contentDTO) |
| 81 | }) | 88 | }) |
| 82 | } | 89 | } |
| @@ -130,7 +137,8 @@ export struct Card9Component { | @@ -130,7 +137,8 @@ export struct Card9Component { | ||
| 130 | .alignSelf(ItemAlign.Center) | 137 | .alignSelf(ItemAlign.Center) |
| 131 | .margin({ left: 12 }) | 138 | .margin({ left: 12 }) |
| 132 | if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) { | 139 | if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) { |
| 133 | - Image(item.fullColumnImgUrls[0].url) | 140 | + Image(this.loadImg? item.fullColumnImgUrls[0].url : '') |
| 141 | + .backgroundColor(0xf5f5f5) | ||
| 134 | .width(90) | 142 | .width(90) |
| 135 | .height(60) | 143 | .height(60) |
| 136 | .borderRadius($r('app.float.image_border_radius')) | 144 | .borderRadius($r('app.float.image_border_radius')) |
| 1 | +/** | ||
| 2 | + * 表示 | ||
| 3 | + * objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频, | ||
| 4 | + 14动态图文,15动态视频16问政;100人民号,101标签 | ||
| 5 | + */ | ||
| 6 | + | ||
| 7 | +@Preview | ||
| 8 | +@Component | ||
| 9 | +export struct Notes { | ||
| 10 | + @State objectType: number | string = 5 | ||
| 11 | + @State newTags: string = '' | ||
| 12 | + | ||
| 13 | + build() { | ||
| 14 | + if (this.returnTypeTitleFn()) { | ||
| 15 | + Text(this.returnTypeTitleFn()) | ||
| 16 | + .fontSize($r('app.float.font_size_12')) | ||
| 17 | + .padding({ | ||
| 18 | + left: 5, | ||
| 19 | + right: 5, | ||
| 20 | + top: 3, | ||
| 21 | + bottom: 3 | ||
| 22 | + }) | ||
| 23 | + .linearGradient({ angle: 90, colors: [['#FFFF2B00', 0.0], ['#FFFE6A00', 1.0]] }) | ||
| 24 | + .fontColor(Color.White) | ||
| 25 | + .borderRadius($r('app.float.button_border_radius')) | ||
| 26 | + } | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + returnTypeTitleFn(): string { | ||
| 30 | + if (this.newTags) { | ||
| 31 | + return this.newTags | ||
| 32 | + } else { | ||
| 33 | + if (this.objectType == 5) { | ||
| 34 | + return '专题' | ||
| 35 | + } else if (this.objectType == 10) { | ||
| 36 | + return 'H5' | ||
| 37 | + } else if (this.objectType == 8) { | ||
| 38 | + return '文章' | ||
| 39 | + } | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + return '' | ||
| 43 | + } | ||
| 44 | +} |
| @@ -35,7 +35,7 @@ export class publishCommentModel { | @@ -35,7 +35,7 @@ export class publishCommentModel { | ||
| 35 | 35 | ||
| 36 | 36 | ||
| 37 | //可选 | 37 | //可选 |
| 38 | - placeHolderText: string = "优质评论会获得最佳评论人的称号" | 38 | + placeHolderText: string = "说两句..." |
| 39 | 39 | ||
| 40 | //最新发布的评论 | 40 | //最新发布的评论 |
| 41 | lastCommentModel: commentItemModel = new commentItemModel() | 41 | lastCommentModel: commentItemModel = new commentItemModel() |
| 1 | -import ArrayList from '@ohos.util.ArrayList' | ||
| 2 | -import { ViewType } from 'wdConstant/Index'; | ||
| 3 | import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource } from 'wdKit/Index'; | 1 | import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource } from 'wdKit/Index'; |
| 4 | -import PageModel from '../../../viewmodel/PageModel'; | ||
| 5 | -import { commentItemModel, commentListModel, WDPublicUserType } from '../model/CommentModel'; | ||
| 6 | -import commentViewModel from '../viewmodel/CommentViewModel' | 2 | +import { commentItemModel, WDPublicUserType } from '../model/CommentModel'; |
| 3 | +import commentViewModel from '../viewmodel/CommentViewModel'; | ||
| 7 | import { CommentText } from './CommentText'; | 4 | import { CommentText } from './CommentText'; |
| 8 | -import measure from '@ohos.measure' | ||
| 9 | -import { CommentCustomDialog } from './CommentCustomDialog' | 5 | +import { CommentCustomDialog } from './CommentCustomDialog'; |
| 10 | import { publishCommentModel } from '../model/PublishCommentModel'; | 6 | import { publishCommentModel } from '../model/PublishCommentModel'; |
| 11 | -import { ifaa } from '@kit.OnlineAuthenticationKit'; | ||
| 12 | -import { HttpUrlUtils, HttpUtils } from 'wdNetwork/Index'; | ||
| 13 | -import NoMoreLayout from '../../page/NoMoreLayout'; | 7 | +import { HttpUtils } from 'wdNetwork/Index'; |
| 14 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 8 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 9 | +import { EmptyComponent } from '../../view/EmptyComponent'; | ||
| 15 | 10 | ||
| 16 | const TAG = 'CommentComponent'; | 11 | const TAG = 'CommentComponent'; |
| 17 | 12 | ||
| @@ -22,14 +17,12 @@ const testString = '因为读书的人\n是低着头向上看的人\n身处一 | @@ -22,14 +17,12 @@ const testString = '因为读书的人\n是低着头向上看的人\n身处一 | ||
| 22 | @Component | 17 | @Component |
| 23 | export struct CommentComponent { | 18 | export struct CommentComponent { |
| 24 | @State hasMore: boolean = true; | 19 | @State hasMore: boolean = true; |
| 25 | - @State currentPage: number = 1; | 20 | + @State currentPage: number = 1; |
| 26 | // @State private browSingModel: commentListModel = new commentListModel() | 21 | // @State private browSingModel: commentListModel = new commentListModel() |
| 27 | /*必传*/ | 22 | /*必传*/ |
| 28 | @ObjectLink publishCommentModel: publishCommentModel | 23 | @ObjectLink publishCommentModel: publishCommentModel |
| 29 | - | ||
| 30 | listScroller: ListScroller = new ListScroller(); // scroller控制器 | 24 | listScroller: ListScroller = new ListScroller(); // scroller控制器 |
| 31 | historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset | 25 | historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset |
| 32 | - | ||
| 33 | isloading: boolean = false | 26 | isloading: boolean = false |
| 34 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); | 27 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); |
| 35 | @State dialogController: CustomDialogController | null = null; | 28 | @State dialogController: CustomDialogController | null = null; |
| @@ -66,6 +59,7 @@ export struct CommentComponent { | @@ -66,6 +59,7 @@ export struct CommentComponent { | ||
| 66 | dx: 0, | 59 | dx: 0, |
| 67 | dy: -20 | 60 | dy: -20 |
| 68 | }, | 61 | }, |
| 62 | + backgroundColor: "#50000000", | ||
| 69 | }) | 63 | }) |
| 70 | 64 | ||
| 71 | this.getData(); | 65 | this.getData(); |
| @@ -140,7 +134,7 @@ export struct CommentComponent { | @@ -140,7 +134,7 @@ export struct CommentComponent { | ||
| 140 | 134 | ||
| 141 | build() { | 135 | build() { |
| 142 | Column() { | 136 | Column() { |
| 143 | - List({scroller:this.listScroller}) { | 137 | + List({ scroller: this.listScroller }) { |
| 144 | ListItemGroup({ header: this.titleHeader() }) | 138 | ListItemGroup({ header: this.titleHeader() }) |
| 145 | 139 | ||
| 146 | LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { | 140 | LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { |
| @@ -179,10 +173,15 @@ export struct CommentComponent { | @@ -179,10 +173,15 @@ export struct CommentComponent { | ||
| 179 | 173 | ||
| 180 | // 加载更多 | 174 | // 加载更多 |
| 181 | ListItem() { | 175 | ListItem() { |
| 182 | - if (this.hasMore === false) NoMoreLayout() | 176 | + if (this.hasMore === false) { |
| 177 | + // NoMoreLayout() | ||
| 178 | + EmptyComponent({ emptyType: 17 }) | ||
| 179 | + .height(300) | ||
| 180 | + } | ||
| 181 | + | ||
| 183 | } | 182 | } |
| 184 | } | 183 | } |
| 185 | - .onReachEnd(()=>{ | 184 | + .onReachEnd(() => { |
| 186 | if (this.hasMore) { | 185 | if (this.hasMore) { |
| 187 | this.getData() | 186 | this.getData() |
| 188 | } | 187 | } |
| @@ -195,11 +194,13 @@ export struct CommentComponent { | @@ -195,11 +194,13 @@ export struct CommentComponent { | ||
| 195 | 194 | ||
| 196 | //获取数据 | 195 | //获取数据 |
| 197 | async getData() { | 196 | async getData() { |
| 198 | - commentViewModel.fetchContentCommentList(this.currentPage + '', this.publishCommentModel.targetId, this.publishCommentModel.targetType) | 197 | + commentViewModel.fetchContentCommentList(this.currentPage + '', this.publishCommentModel.targetId, |
| 198 | + this.publishCommentModel.targetType) | ||
| 199 | .then(commentListModel => { | 199 | .then(commentListModel => { |
| 200 | this.currentPage++ | 200 | this.currentPage++ |
| 201 | 201 | ||
| 202 | - if (Number.parseInt(commentListModel.totalCommentNum) > Number.parseInt(this.publishCommentModel.totalCommentNumer)) { | 202 | + if (Number.parseInt(commentListModel.totalCommentNum) > |
| 203 | + Number.parseInt(this.publishCommentModel.totalCommentNumer)) { | ||
| 203 | this.publishCommentModel.totalCommentNumer = commentListModel.totalCommentNum + '' | 204 | this.publishCommentModel.totalCommentNumer = commentListModel.totalCommentNum + '' |
| 204 | } | 205 | } |
| 205 | 206 | ||
| @@ -221,7 +222,7 @@ export struct CommentComponent { | @@ -221,7 +222,7 @@ export struct CommentComponent { | ||
| 221 | }); | 222 | }); |
| 222 | 223 | ||
| 223 | 224 | ||
| 224 | - }else{ | 225 | + } else { |
| 225 | this.hasMore = false | 226 | this.hasMore = false |
| 226 | } | 227 | } |
| 227 | }) | 228 | }) |
| @@ -316,14 +317,7 @@ struct ChildCommentItem { | @@ -316,14 +317,7 @@ struct ChildCommentItem { | ||
| 316 | }) | 317 | }) |
| 317 | .margin({ left: 95, right: 16, top: -5 }) | 318 | .margin({ left: 95, right: 16, top: -5 }) |
| 318 | .onClick(() => { | 319 | .onClick(() => { |
| 319 | - | ||
| 320 | - | ||
| 321 | - this.publishCommentModel.rootCommentId = this.item.rootCommentId | ||
| 322 | - this.publishCommentModel.parentId = this.item.id | ||
| 323 | - this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':' | ||
| 324 | - if (this.dialogController != null) { | ||
| 325 | - this.dialogController.open() | ||
| 326 | - } | 320 | + this.replyComment() |
| 327 | }) | 321 | }) |
| 328 | 322 | ||
| 329 | 323 | ||
| @@ -335,6 +329,17 @@ struct ChildCommentItem { | @@ -335,6 +329,17 @@ struct ChildCommentItem { | ||
| 335 | }.alignItems(HorizontalAlign.Start) | 329 | }.alignItems(HorizontalAlign.Start) |
| 336 | .width('100%') | 330 | .width('100%') |
| 337 | } | 331 | } |
| 332 | + | ||
| 333 | + replyComment() { | ||
| 334 | + if (this.item.id && this.item.checkStatus == '2') { // 审核通过的才显示回复 | ||
| 335 | + this.publishCommentModel.rootCommentId = this.item.rootCommentId | ||
| 336 | + this.publishCommentModel.parentId = this.item.id | ||
| 337 | + this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':' | ||
| 338 | + if (this.dialogController != null) { | ||
| 339 | + this.dialogController.open() | ||
| 340 | + } | ||
| 341 | + } | ||
| 342 | + } | ||
| 338 | } | 343 | } |
| 339 | 344 | ||
| 340 | 345 | ||
| @@ -484,12 +489,7 @@ struct commentHeaderView { | @@ -484,12 +489,7 @@ struct commentHeaderView { | ||
| 484 | }) | 489 | }) |
| 485 | .margin({ left: 59, right: 16, top: -5 }) | 490 | .margin({ left: 59, right: 16, top: -5 }) |
| 486 | .onClick(() => { | 491 | .onClick(() => { |
| 487 | - this.publishCommentModel.rootCommentId = this.item.rootCommentId | ||
| 488 | - this.publishCommentModel.parentId = this.item.id | ||
| 489 | - this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':' | ||
| 490 | - if (this.dialogController != null) { | ||
| 491 | - this.dialogController.open() | ||
| 492 | - } | 492 | + this.replyComment() |
| 493 | }) | 493 | }) |
| 494 | 494 | ||
| 495 | commentFooterView({ | 495 | commentFooterView({ |
| @@ -499,6 +499,17 @@ struct commentHeaderView { | @@ -499,6 +499,17 @@ struct commentHeaderView { | ||
| 499 | }).margin({ left: 59, right: 16 }) | 499 | }).margin({ left: 59, right: 16 }) |
| 500 | }.alignItems(HorizontalAlign.Start) | 500 | }.alignItems(HorizontalAlign.Start) |
| 501 | } | 501 | } |
| 502 | + | ||
| 503 | + replyComment() { | ||
| 504 | + if (this.item.id && this.item.checkStatus == '2') { // 审核通过的才显示回复 | ||
| 505 | + this.publishCommentModel.rootCommentId = this.item.rootCommentId | ||
| 506 | + this.publishCommentModel.parentId = this.item.id | ||
| 507 | + this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':' | ||
| 508 | + if (this.dialogController != null) { | ||
| 509 | + this.dialogController.open() | ||
| 510 | + } | ||
| 511 | + } | ||
| 512 | + } | ||
| 502 | } | 513 | } |
| 503 | 514 | ||
| 504 | /*评论内容下面的IP地址时间点赞*/ | 515 | /*评论内容下面的IP地址时间点赞*/ |
| @@ -525,56 +536,68 @@ struct commentFooterView { | @@ -525,56 +536,68 @@ struct commentFooterView { | ||
| 525 | .fontColor($r('app.color.color_B0B0B0')) | 536 | .fontColor($r('app.color.color_B0B0B0')) |
| 526 | .fontSize(12) | 537 | .fontSize(12) |
| 527 | 538 | ||
| 528 | - Image($r('app.media.comment_hyphen_block')) | ||
| 529 | - .size({ | ||
| 530 | - width: 4, | ||
| 531 | - height: 4 | ||
| 532 | - }) | ||
| 533 | - | ||
| 534 | - Text('回复') | ||
| 535 | - .fontColor($r('app.color.color_222222')) | ||
| 536 | - .fontSize(12) | ||
| 537 | - .onClick(() => { | ||
| 538 | - this.publishCommentModel.rootCommentId = this.item.rootCommentId | ||
| 539 | - this.publishCommentModel.parentId = this.item.id | ||
| 540 | - this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':' | ||
| 541 | - if (this.dialogController != null) { | ||
| 542 | - this.dialogController.open() | ||
| 543 | - } | ||
| 544 | - }) | 539 | + if (this.item.id && this.item.checkStatus == '2') { // 审核通过的才显示回复 |
| 540 | + Image($r('app.media.comment_hyphen_block')) | ||
| 541 | + .size({ | ||
| 542 | + width: 4, | ||
| 543 | + height: 4 | ||
| 544 | + }) | ||
| 545 | + | ||
| 546 | + Text('回复') | ||
| 547 | + .fontColor($r('app.color.color_222222')) | ||
| 548 | + .fontSize(12) | ||
| 549 | + .onClick(() => { | ||
| 550 | + this.replyComment() | ||
| 551 | + }) | ||
| 552 | + } | ||
| 545 | } | 553 | } |
| 546 | 554 | ||
| 547 | - Row({ space: 6 }) { | ||
| 548 | - Text(this.item.likeNum) | ||
| 549 | - .fontColor($r('app.color.color_666666')) | ||
| 550 | - .fontSize(14) | ||
| 551 | - | ||
| 552 | - Image($r(this.item.api_status ? 'app.media.comment_like_select' : 'app.media.comment_like_normal')) | ||
| 553 | - .size({ | ||
| 554 | - width: 16, | ||
| 555 | - height: 16 | ||
| 556 | - }) | ||
| 557 | - | ||
| 558 | - } | ||
| 559 | - .onClick(() => { | ||
| 560 | - // 未登录,跳转登录 | ||
| 561 | - const user_id = HttpUtils.getUserId() | ||
| 562 | - if (!user_id) { | ||
| 563 | - WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 564 | - return | 555 | + if (this.item.id) { // 审核通过的才显示点赞 |
| 556 | + Row({ space: 6 }) { | ||
| 557 | + Text(this.item.likeNum) | ||
| 558 | + .fontColor($r('app.color.color_666666')) | ||
| 559 | + .fontSize(14) | ||
| 560 | + | ||
| 561 | + Image($r(this.item.api_status ? 'app.media.comment_like_select' : 'app.media.comment_like_normal')) | ||
| 562 | + .size({ | ||
| 563 | + width: 16, | ||
| 564 | + height: 16 | ||
| 565 | + }) | ||
| 565 | } | 566 | } |
| 566 | - commentLikeChange(this.item) | ||
| 567 | - commentViewModel.commentLike(this.item).then(() => { | ||
| 568 | - }).catch(() => { | ||
| 569 | - commentLikeChange(this.item) | 567 | + .onClick(() => { |
| 568 | + this.clickLike() | ||
| 570 | }) | 569 | }) |
| 571 | - }) | ||
| 572 | - | 570 | + } |
| 573 | } | 571 | } |
| 574 | .justifyContent(FlexAlign.SpaceBetween) | 572 | .justifyContent(FlexAlign.SpaceBetween) |
| 575 | .width('100%') | 573 | .width('100%') |
| 576 | .height(30) | 574 | .height(30) |
| 577 | } | 575 | } |
| 576 | + | ||
| 577 | + replyComment() { | ||
| 578 | + if (this.item.id && this.item.checkStatus == '2') { // 审核通过的才显示回复 | ||
| 579 | + this.publishCommentModel.rootCommentId = this.item.rootCommentId | ||
| 580 | + this.publishCommentModel.parentId = this.item.id | ||
| 581 | + this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':' | ||
| 582 | + if (this.dialogController != null) { | ||
| 583 | + this.dialogController.open() | ||
| 584 | + } | ||
| 585 | + } | ||
| 586 | + } | ||
| 587 | + | ||
| 588 | + clickLike() { | ||
| 589 | + // 未登录,跳转登录 | ||
| 590 | + const user_id = HttpUtils.getUserId() | ||
| 591 | + if (!user_id) { | ||
| 592 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 593 | + return | ||
| 594 | + } | ||
| 595 | + commentLikeChange(this.item) | ||
| 596 | + commentViewModel.commentLike(this.item).then(() => { | ||
| 597 | + }).catch(() => { | ||
| 598 | + commentLikeChange(this.item) | ||
| 599 | + }) | ||
| 600 | + } | ||
| 578 | } | 601 | } |
| 579 | 602 | ||
| 580 | function commentLikeChange(item: commentItemModel) { | 603 | function commentLikeChange(item: commentItemModel) { |
| @@ -2,15 +2,20 @@ import { DisplayUtils, EmitterEventId, EmitterUtils } from 'wdKit/Index' | @@ -2,15 +2,20 @@ import { DisplayUtils, EmitterEventId, EmitterUtils } from 'wdKit/Index' | ||
| 2 | import { publishCommentModel } from '../model/PublishCommentModel' | 2 | import { publishCommentModel } from '../model/PublishCommentModel' |
| 3 | import { CommentCustomDialog } from './CommentCustomDialog' | 3 | import { CommentCustomDialog } from './CommentCustomDialog' |
| 4 | import measure from '@ohos.measure' | 4 | import measure from '@ohos.measure' |
| 5 | +import { ContentDetailDTO } from 'wdBean/Index' | ||
| 5 | 6 | ||
| 6 | @Preview | 7 | @Preview |
| 7 | @Component | 8 | @Component |
| 8 | export struct CommentTabComponent { | 9 | export struct CommentTabComponent { |
| 10 | + private onCommentFocus: () => void = () => { | ||
| 11 | + } | ||
| 9 | @ObjectLink publishCommentModel: publishCommentModel | 12 | @ObjectLink publishCommentModel: publishCommentModel |
| 13 | + @Prop contentDetail: ContentDetailDTO | ||
| 10 | /*展示类型*/ | 14 | /*展示类型*/ |
| 11 | @State type: number = 1 | 15 | @State type: number = 1 |
| 12 | @State placeHolder: string = '说两句...' | 16 | @State placeHolder: string = '说两句...' |
| 13 | @State dialogController: CustomDialogController | null = null; | 17 | @State dialogController: CustomDialogController | null = null; |
| 18 | + styleType : number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) | ||
| 14 | /*回调方法*/ | 19 | /*回调方法*/ |
| 15 | dialogControllerConfirm: () => void = () => { | 20 | dialogControllerConfirm: () => void = () => { |
| 16 | } | 21 | } |
| @@ -32,6 +37,7 @@ export struct CommentTabComponent { | @@ -32,6 +37,7 @@ export struct CommentTabComponent { | ||
| 32 | dx: 0, | 37 | dx: 0, |
| 33 | dy: -20 | 38 | dy: -20 |
| 34 | }, | 39 | }, |
| 40 | + backgroundColor: "#50000000", | ||
| 35 | }) | 41 | }) |
| 36 | 42 | ||
| 37 | } | 43 | } |
| @@ -39,15 +45,41 @@ export struct CommentTabComponent { | @@ -39,15 +45,41 @@ export struct CommentTabComponent { | ||
| 39 | build() { | 45 | build() { |
| 40 | Row() { | 46 | Row() { |
| 41 | Stack({ alignContent: Alignment.Start }) { | 47 | Stack({ alignContent: Alignment.Start }) { |
| 42 | - Image($r('app.media.comment_img_input_hui')).width(151).height(30) | ||
| 43 | - Text(this.placeHolder).fontSize(12).fontColor('#999999').margin({ left: 10 }) | 48 | + RelativeContainer() { |
| 49 | + Image($r('app.media.comment_img_input_hui')) | ||
| 50 | + .objectFit(ImageFit.Fill) | ||
| 51 | + .resizable({ slice: { top: 1, left: 1, right: 20, bottom: 1 } }) | ||
| 52 | + .alignRules({ | ||
| 53 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 54 | + left: { anchor: "__container__", align: HorizontalAlign.Start }, | ||
| 55 | + right: { anchor: "__container__", align: HorizontalAlign.End }, | ||
| 56 | + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | ||
| 57 | + }) | ||
| 58 | + .id("Image") | ||
| 59 | + Text(this.placeHolder) | ||
| 60 | + .fontSize(12) | ||
| 61 | + .fontColor('#999999') | ||
| 62 | + .margin({ left: 10 }) | ||
| 63 | + .alignRules({ | ||
| 64 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 65 | + left: { anchor: "__container__", align: HorizontalAlign.Start }, | ||
| 66 | + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | ||
| 67 | + }) | ||
| 68 | + .id("Text") | ||
| 69 | + } | ||
| 44 | } | 70 | } |
| 45 | - }.width(151).height(30) | 71 | + } |
| 72 | + .height(30) | ||
| 46 | .onClick(() => { | 73 | .onClick(() => { |
| 74 | + this.onCommentFocus && this.onCommentFocus() | ||
| 47 | 75 | ||
| 48 | this.publishCommentModel.rootCommentId = '-1'; | 76 | this.publishCommentModel.rootCommentId = '-1'; |
| 49 | this.publishCommentModel.parentId = '-1'; | 77 | this.publishCommentModel.parentId = '-1'; |
| 50 | - this.publishCommentModel.placeHolderText = "优质评论会获得最佳评论人的称号" | 78 | + this.publishCommentModel.placeHolderText = "说两句..." |
| 79 | + if (this.contentDetail.bestNoticer === 1) { | ||
| 80 | + this.publishCommentModel.placeHolderText = "优质评论会获得最佳评论人的称号" | ||
| 81 | + } | ||
| 82 | + | ||
| 51 | this.dialogController?.open(); | 83 | this.dialogController?.open(); |
| 52 | }) | 84 | }) |
| 53 | } | 85 | } |
| @@ -59,7 +91,7 @@ export struct CommentIconComponent { | @@ -59,7 +91,7 @@ export struct CommentIconComponent { | ||
| 59 | @ObjectLink publishCommentModel: publishCommentModel | 91 | @ObjectLink publishCommentModel: publishCommentModel |
| 60 | /*展示类型*/ | 92 | /*展示类型*/ |
| 61 | @State type: number = 1 | 93 | @State type: number = 1 |
| 62 | - | 94 | + styleType : number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) |
| 63 | // aboutToAppear(): void { | 95 | // aboutToAppear(): void { |
| 64 | // setTimeout(() => { | 96 | // setTimeout(() => { |
| 65 | // this.publishCommentModel.totalCommentNumer = '444' | 97 | // this.publishCommentModel.totalCommentNumer = '444' |
| @@ -78,47 +110,57 @@ export struct CommentIconComponent { | @@ -78,47 +110,57 @@ export struct CommentIconComponent { | ||
| 78 | build() { | 110 | build() { |
| 79 | Row() { | 111 | Row() { |
| 80 | Stack({ alignContent: Alignment.TopEnd }) { | 112 | Stack({ alignContent: Alignment.TopEnd }) { |
| 81 | - Image($r('app.media.comment_icon')).width(24).height(24) | 113 | + // Image($r('app.media.comment_icon')).width(24).height(24) |
| 114 | + Image(this.styleType == 1 ? $r('app.media.comment_icon') : | ||
| 115 | + $r('app.media.comment_icon_white')).width(24).height(24) | ||
| 82 | // Stack({alignContent:Alignment.Start}) { | 116 | // Stack({alignContent:Alignment.Start}) { |
| 83 | - // if(Number.parseInt(this.publishCommentModel.totalCommentNumer) != 0){ | ||
| 84 | - RelativeContainer() { | ||
| 85 | - Image($r('app.media.comment_icon_number_bg')) | ||
| 86 | - .objectFit(ImageFit.Fill) | ||
| 87 | - .resizable({ slice: { top: 1, left: 20, right: 1, bottom: 1 } }) | ||
| 88 | - .alignRules({ | ||
| 89 | - top: { anchor: "Text", align: VerticalAlign.Top }, | ||
| 90 | - left: { anchor: "Text", align: HorizontalAlign.Start }, | ||
| 91 | - right: { anchor: "Text", align: HorizontalAlign.End }, | ||
| 92 | - bottom: { anchor: "Text", align: VerticalAlign.Bottom }, | ||
| 93 | - })// .offset({ | ||
| 94 | - // x:-6 | ||
| 95 | - // }) | ||
| 96 | - .id("Image") | ||
| 97 | - | ||
| 98 | - Text(this.publishCommentModel.totalCommentNumer)// Text("44444444") | ||
| 99 | - .fontSize(8) | ||
| 100 | - .fontColor('#ffffff')// .backgroundColor('#ED2800') | ||
| 101 | - .height(12) | ||
| 102 | - .textAlign(TextAlign.Center) | ||
| 103 | - .alignRules({ | ||
| 104 | - top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 105 | - left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 106 | - })// .margin({left: 4,right:4 | ||
| 107 | - // }) | ||
| 108 | - /*动态计算文字宽度*/ | ||
| 109 | - .width(this.getMeasureText(this.publishCommentModel.totalCommentNumer) + 12)// .backgroundColor(Color.Green) | ||
| 110 | - .id("Text") | ||
| 111 | - // .offset({ | ||
| 112 | - // x: 3 | ||
| 113 | - // }) | 117 | + if (Number.parseInt(this.publishCommentModel.totalCommentNumer) != 0) { |
| 118 | + RelativeContainer() { | ||
| 119 | + Image($r('app.media.comment_icon_number_bg')) | ||
| 120 | + .objectFit(ImageFit.Fill) | ||
| 121 | + .resizable({ | ||
| 122 | + slice: { | ||
| 123 | + top: 1, | ||
| 124 | + left: 20, | ||
| 125 | + right: 1, | ||
| 126 | + bottom: 1 | ||
| 127 | + } | ||
| 128 | + }) | ||
| 129 | + .alignRules({ | ||
| 130 | + top: { anchor: "Text", align: VerticalAlign.Top }, | ||
| 131 | + left: { anchor: "Text", align: HorizontalAlign.Start }, | ||
| 132 | + right: { anchor: "Text", align: HorizontalAlign.End }, | ||
| 133 | + bottom: { anchor: "Text", align: VerticalAlign.Bottom }, | ||
| 134 | + })// .offset({ | ||
| 135 | + // x:-6 | ||
| 136 | + // }) | ||
| 137 | + .id("Image") | ||
| 138 | + | ||
| 139 | + Text(this.publishCommentModel.totalCommentNumer)// Text("44444444") | ||
| 140 | + .fontSize(8) | ||
| 141 | + .fontColor('#ffffff')// .backgroundColor('#ED2800') | ||
| 142 | + .height(12) | ||
| 143 | + .textAlign(TextAlign.Center) | ||
| 144 | + .alignRules({ | ||
| 145 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 146 | + left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 147 | + })// .margin({left: 4,right:4 | ||
| 148 | + // }) | ||
| 149 | + /*动态计算文字宽度*/ | ||
| 150 | + .width(this.getMeasureText(this.publishCommentModel.totalCommentNumer) + | ||
| 151 | + 12)// .backgroundColor(Color.Green) | ||
| 152 | + .id("Text") | ||
| 153 | + // .offset({ | ||
| 154 | + // x: 3 | ||
| 155 | + // }) | ||
| 156 | + | ||
| 157 | + } | ||
| 158 | + // } | ||
| 159 | + .offset({ | ||
| 160 | + x: 12 | ||
| 161 | + }) | ||
| 114 | 162 | ||
| 115 | } | 163 | } |
| 116 | - // } | ||
| 117 | - .offset({ | ||
| 118 | - x: 12 | ||
| 119 | - }) | ||
| 120 | - | ||
| 121 | - // } | ||
| 122 | } | 164 | } |
| 123 | }.width(24).height(24) | 165 | }.width(24).height(24) |
| 124 | 166 |
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, ToastUtils, WindowModel } from 'wdKit/Index' |
| 3 | import { commentItemModel } 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 { HttpUtils } from 'wdNetwork/Index' | 6 | +import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork/Index' |
| 7 | import { ErrorComponent } from '../../view/ErrorComponent' | 7 | import { ErrorComponent } from '../../view/ErrorComponent' |
| 8 | import { EmptyComponent, WDViewDefaultType } from '../../view/EmptyComponent' | 8 | import { EmptyComponent, WDViewDefaultType } from '../../view/EmptyComponent' |
| 9 | import NoMoreLayout from '../../page/NoMoreLayout' | 9 | import NoMoreLayout from '../../page/NoMoreLayout' |
| 10 | import { CommentCustomDialog } from './CommentCustomDialog' | 10 | import { CommentCustomDialog } from './CommentCustomDialog' |
| 11 | import { publishCommentModel } from '../model/PublishCommentModel' | 11 | import { publishCommentModel } from '../model/PublishCommentModel' |
| 12 | import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index' | 12 | import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index' |
| 13 | -import { ContentDTO } from 'wdBean/Index' | 13 | +import { ContentDTO, MasterDetailRes } from 'wdBean/Index' |
| 14 | 14 | ||
| 15 | const TAG = 'QualityCommentsComponent'; | 15 | const TAG = 'QualityCommentsComponent'; |
| 16 | 16 | ||
| @@ -71,6 +71,7 @@ export struct QualityCommentsComponent { | @@ -71,6 +71,7 @@ export struct QualityCommentsComponent { | ||
| 71 | dx: 0, | 71 | dx: 0, |
| 72 | dy: -20 | 72 | dy: -20 |
| 73 | }, | 73 | }, |
| 74 | + backgroundColor: "#50000000", | ||
| 74 | }) | 75 | }) |
| 75 | } | 76 | } |
| 76 | 77 | ||
| @@ -303,6 +304,9 @@ struct QualityCommentItem { | @@ -303,6 +304,9 @@ struct QualityCommentItem { | ||
| 303 | y: -16 | 304 | y: -16 |
| 304 | } | 305 | } |
| 305 | ) | 306 | ) |
| 307 | + .onClick(() => { | ||
| 308 | + this.jumpToAccountOwner() | ||
| 309 | + }) | ||
| 306 | Text(this.item.fromUserName) | 310 | Text(this.item.fromUserName) |
| 307 | .fontSize(14) | 311 | .fontSize(14) |
| 308 | .fontColor('#222222') | 312 | .fontColor('#222222') |
| @@ -335,6 +339,9 @@ struct QualityCommentItem { | @@ -335,6 +339,9 @@ struct QualityCommentItem { | ||
| 335 | .fontColor('#222222') | 339 | .fontColor('#222222') |
| 336 | .fontWeight(FontWeight.Medium) | 340 | .fontWeight(FontWeight.Medium) |
| 337 | }.margin({ top: 10 }) | 341 | }.margin({ top: 10 }) |
| 342 | + .onClick(() => { | ||
| 343 | + this.replyComment() | ||
| 344 | + }) | ||
| 338 | 345 | ||
| 339 | /*分割线*/ | 346 | /*分割线*/ |
| 340 | Row() { | 347 | Row() { |
| @@ -377,19 +384,9 @@ struct QualityCommentItem { | @@ -377,19 +384,9 @@ struct QualityCommentItem { | ||
| 377 | Row({ space: 16 }) { | 384 | Row({ space: 16 }) { |
| 378 | Row() { | 385 | Row() { |
| 379 | Image($r('app.media.comment_icon_pinglun')).width(16).height(16) | 386 | Image($r('app.media.comment_icon_pinglun')).width(16).height(16) |
| 380 | - }.onClick(()=>{ | ||
| 381 | - this.publishCommentModel.targetId = this.item.targetId | ||
| 382 | - this.publishCommentModel.targetRelId = this.item.targetRelId | ||
| 383 | - this.publishCommentModel.targetTitle = this.item.targetTitle | ||
| 384 | - this.publishCommentModel.targetRelType = this.item.targetRelType | ||
| 385 | - this.publishCommentModel.targetRelObjectId = this.item.targetRelObjectId | ||
| 386 | - this.publishCommentModel.targetType = this.item.targetType | ||
| 387 | - // this.publishCommentModel.keyArticle = this.item.keyArticle | ||
| 388 | - | ||
| 389 | - this.publishCommentModel.rootCommentId = this.item.rootCommentId | ||
| 390 | - this.publishCommentModel.parentId = this.item.id | ||
| 391 | - | ||
| 392 | - this.dialogController?.open() | 387 | + }.height('100%') |
| 388 | + .onClick(()=>{ | ||
| 389 | + this.replyComment() | ||
| 393 | }) | 390 | }) |
| 394 | 391 | ||
| 395 | Row() { | 392 | Row() { |
| @@ -403,17 +400,7 @@ struct QualityCommentItem { | @@ -403,17 +400,7 @@ struct QualityCommentItem { | ||
| 403 | .margin({ left: 3 }) | 400 | .margin({ left: 3 }) |
| 404 | } | 401 | } |
| 405 | }.onClick(() => { | 402 | }.onClick(() => { |
| 406 | - // 未登录,跳转登录 | ||
| 407 | - const user_id = HttpUtils.getUserId() | ||
| 408 | - if (!user_id) { | ||
| 409 | - WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 410 | - return | ||
| 411 | - } | ||
| 412 | - commentLikeChange(this.item) | ||
| 413 | - commentViewModel.commentLike(this.item).then(() => { | ||
| 414 | - }).catch(() => { | ||
| 415 | - commentLikeChange(this.item) | ||
| 416 | - }) | 403 | + this.clickLikeComment() |
| 417 | }) | 404 | }) |
| 418 | } | 405 | } |
| 419 | }.height(38).width('100%').justifyContent(FlexAlign.SpaceBetween) | 406 | }.height(38).width('100%').justifyContent(FlexAlign.SpaceBetween) |
| @@ -423,6 +410,37 @@ struct QualityCommentItem { | @@ -423,6 +410,37 @@ struct QualityCommentItem { | ||
| 423 | 410 | ||
| 424 | } | 411 | } |
| 425 | 412 | ||
| 413 | + jumpToAccountOwner() { | ||
| 414 | + | ||
| 415 | + let url = HttpUrlUtils.getOtherUserDetailDataUrl() | ||
| 416 | + let item : Record<string, string >= { | ||
| 417 | + "creatorId": this.item.fromCreatorId || "", | ||
| 418 | + "userType": `${this.item.fromUserType}`, | ||
| 419 | + "userId": this.item.fromUserId || "-1", | ||
| 420 | + } | ||
| 421 | + HttpBizUtil.post<ResponseDTO<MasterDetailRes>>(url, item).then((result) => { | ||
| 422 | + if (!result.data || result.data.mainControl != 1) { | ||
| 423 | + ToastUtils.longToast("暂时无法查看该创作者主页") | ||
| 424 | + return | ||
| 425 | + } | ||
| 426 | + | ||
| 427 | + if (result.data.banControl == 1) { | ||
| 428 | + ToastUtils.longToast("该账号已封禁,不予访问") | ||
| 429 | + return | ||
| 430 | + } | ||
| 431 | + | ||
| 432 | + if (result.data.userType === "1") { // 普通用户 | ||
| 433 | + let params: Record<string, string> = {'userId': result.data.userId}; | ||
| 434 | + WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params) | ||
| 435 | + } else { // 非普通用户 | ||
| 436 | + ProcessUtils.gotoPeopleShipHomePage(result.data.creatorId) | ||
| 437 | + } | ||
| 438 | + | ||
| 439 | + }).catch(() => { | ||
| 440 | + ToastUtils.longToast("暂时无法查看该创作者主页") | ||
| 441 | + }) | ||
| 442 | + } | ||
| 443 | + | ||
| 426 | jumpToDetail() { | 444 | jumpToDetail() { |
| 427 | // programInfoModel.api_isCommentAction = YES; | 445 | // programInfoModel.api_isCommentAction = YES; |
| 428 | 446 | ||
| @@ -438,6 +456,37 @@ struct QualityCommentItem { | @@ -438,6 +456,37 @@ struct QualityCommentItem { | ||
| 438 | 456 | ||
| 439 | ProcessUtils.processPage(program) | 457 | ProcessUtils.processPage(program) |
| 440 | } | 458 | } |
| 459 | + | ||
| 460 | + replyComment() { | ||
| 461 | + this.publishCommentModel.targetId = this.item.targetId | ||
| 462 | + this.publishCommentModel.targetRelId = this.item.targetRelId | ||
| 463 | + this.publishCommentModel.targetTitle = this.item.targetTitle | ||
| 464 | + this.publishCommentModel.targetRelType = this.item.targetRelType | ||
| 465 | + this.publishCommentModel.targetRelObjectId = this.item.targetRelObjectId | ||
| 466 | + this.publishCommentModel.targetType = this.item.targetType | ||
| 467 | + // this.publishCommentModel.keyArticle = this.item.keyArticle | ||
| 468 | + | ||
| 469 | + this.publishCommentModel.rootCommentId = this.item.rootCommentId | ||
| 470 | + this.publishCommentModel.parentId = this.item.id | ||
| 471 | + | ||
| 472 | + this.publishCommentModel.placeHolderText = '回复 ' + this.item.fromUserName + ':' | ||
| 473 | + | ||
| 474 | + this.dialogController?.open() | ||
| 475 | + } | ||
| 476 | + | ||
| 477 | + clickLikeComment() { | ||
| 478 | + // 未登录,跳转登录 | ||
| 479 | + const user_id = HttpUtils.getUserId() | ||
| 480 | + if (!user_id) { | ||
| 481 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 482 | + return | ||
| 483 | + } | ||
| 484 | + commentLikeChange(this.item) | ||
| 485 | + commentViewModel.commentLike(this.item).then(() => { | ||
| 486 | + }).catch(() => { | ||
| 487 | + commentLikeChange(this.item) | ||
| 488 | + }) | ||
| 489 | + } | ||
| 441 | } | 490 | } |
| 442 | 491 | ||
| 443 | function commentLikeChange(item: commentItemModel) { | 492 | function commentLikeChange(item: commentItemModel) { |
| @@ -4,7 +4,8 @@ import { BreakPointType, Logger } from 'wdKit'; | @@ -4,7 +4,8 @@ import { BreakPointType, Logger } from 'wdKit'; | ||
| 4 | import { CompUtils } from '../../utils/CompUtils'; | 4 | import { CompUtils } from '../../utils/CompUtils'; |
| 5 | import { ProcessUtils } from 'wdRouter'; | 5 | import { ProcessUtils } from 'wdRouter'; |
| 6 | import { EmptyComponent } from '../view/EmptyComponent'; | 6 | import { EmptyComponent } from '../view/EmptyComponent'; |
| 7 | -import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 7 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; |
| 8 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 8 | 9 | ||
| 9 | const TAG = 'Zh_Carousel_Layout-01'; | 10 | const TAG = 'Zh_Carousel_Layout-01'; |
| 10 | 11 | ||
| @@ -163,13 +164,19 @@ export struct ZhCarouselLayout01 { | @@ -163,13 +164,19 @@ export struct ZhCarouselLayout01 { | ||
| 163 | struct CarouselLayout01CardView { | 164 | struct CarouselLayout01CardView { |
| 164 | private item: ContentDTO = {} as ContentDTO; | 165 | private item: ContentDTO = {} as ContentDTO; |
| 165 | private length: number = 1; // 轮播图数量 | 166 | private length: number = 1; // 轮播图数量 |
| 167 | + @State loadImg: boolean = false; | ||
| 168 | + | ||
| 169 | + async aboutToAppear(): Promise<void> { | ||
| 170 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 171 | + } | ||
| 166 | 172 | ||
| 167 | build() { | 173 | build() { |
| 168 | Stack() { | 174 | Stack() { |
| 169 | - Image(this.item.coverUrl) | 175 | + Image(this.loadImg ? this.item.coverUrl : '') |
| 170 | .width(CommonConstants.FULL_PARENT) | 176 | .width(CommonConstants.FULL_PARENT) |
| 171 | .height(CommonConstants.FULL_PARENT) | 177 | .height(CommonConstants.FULL_PARENT) |
| 172 | .objectFit(ImageFit.Cover) | 178 | .objectFit(ImageFit.Cover) |
| 179 | + .backgroundColor(0xf5f5f5) | ||
| 173 | 180 | ||
| 174 | Row() | 181 | Row() |
| 175 | .width(CommonConstants.FULL_PARENT) | 182 | .width(CommonConstants.FULL_PARENT) |
| @@ -3,6 +3,7 @@ import { CommonConstants } from 'wdConstant/Index'; | @@ -3,6 +3,7 @@ import { CommonConstants } from 'wdConstant/Index'; | ||
| 3 | import { Logger } from 'wdKit/Index'; | 3 | import { Logger } from 'wdKit/Index'; |
| 4 | import { ProcessUtils } from 'wdRouter'; | 4 | import { ProcessUtils } from 'wdRouter'; |
| 5 | import PageViewModel from '../../viewmodel/PageViewModel'; | 5 | import PageViewModel from '../../viewmodel/PageViewModel'; |
| 6 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 6 | 7 | ||
| 7 | const TAG = 'Zh_Grid_Layout-02'; | 8 | const TAG = 'Zh_Grid_Layout-02'; |
| 8 | const FULL_PARENT: string = '100%'; | 9 | const FULL_PARENT: string = '100%'; |
| @@ -18,18 +19,22 @@ let listSize: number = 2; | @@ -18,18 +19,22 @@ let listSize: number = 2; | ||
| 18 | export struct ZhGridLayout02 { | 19 | export struct ZhGridLayout02 { |
| 19 | @State compDTO: CompDTO = {} as CompDTO | 20 | @State compDTO: CompDTO = {} as CompDTO |
| 20 | @State operDataList: ContentDTO[] = [] | 21 | @State operDataList: ContentDTO[] = [] |
| 21 | - currentPage = 1 | ||
| 22 | - pageSize = 12 | 22 | + @State loadImg: boolean = false; |
| 23 | 23 | ||
| 24 | - aboutToAppear() { | 24 | + async aboutToAppear(): Promise<void> { |
| 25 | Logger.debug(TAG, 'aboutToAppear ' + this.compDTO.objectTitle) | 25 | Logger.debug(TAG, 'aboutToAppear ' + this.compDTO.objectTitle) |
| 26 | this.currentPage = 1 | 26 | this.currentPage = 1 |
| 27 | PageViewModel.getLiveReviewUrl(this.currentPage, this.pageSize).then((liveReviewDTO) => { | 27 | PageViewModel.getLiveReviewUrl(this.currentPage, this.pageSize).then((liveReviewDTO) => { |
| 28 | this.operDataList = [] | 28 | this.operDataList = [] |
| 29 | this.operDataList.push(...liveReviewDTO.list) | 29 | this.operDataList.push(...liveReviewDTO.list) |
| 30 | }) | 30 | }) |
| 31 | + | ||
| 32 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 31 | } | 33 | } |
| 32 | 34 | ||
| 35 | + currentPage = 1 | ||
| 36 | + pageSize = 12 | ||
| 37 | + | ||
| 33 | build() { | 38 | build() { |
| 34 | Column() { | 39 | Column() { |
| 35 | Scroll() { | 40 | Scroll() { |
| @@ -96,7 +101,8 @@ export struct ZhGridLayout02 { | @@ -96,7 +101,8 @@ export struct ZhGridLayout02 { | ||
| 96 | @Builder | 101 | @Builder |
| 97 | buildItemCard(item: ContentDTO) { | 102 | buildItemCard(item: ContentDTO) { |
| 98 | Column() { | 103 | Column() { |
| 99 | - Image(item.fullColumnImgUrls[0].url) | 104 | + Image(this.loadImg ? item.fullColumnImgUrls[0].url : '') |
| 105 | + .backgroundColor(0xf5f5f5) | ||
| 100 | .width('100%') | 106 | .width('100%') |
| 101 | .height(95) | 107 | .height(95) |
| 102 | .borderRadius(4) | 108 | .borderRadius(4) |
| @@ -3,6 +3,7 @@ import { CompStyle } from 'wdConstant'; | @@ -3,6 +3,7 @@ import { CompStyle } from 'wdConstant'; | ||
| 3 | import { Logger } from 'wdKit'; | 3 | import { Logger } from 'wdKit'; |
| 4 | import { WDRouterRule } from 'wdRouter'; | 4 | import { WDRouterRule } from 'wdRouter'; |
| 5 | import { ProcessUtils } from 'wdRouter'; | 5 | import { ProcessUtils } from 'wdRouter'; |
| 6 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 6 | 7 | ||
| 7 | const TAG = 'Zh_Grid_Layout-03'; | 8 | const TAG = 'Zh_Grid_Layout-03'; |
| 8 | const FULL_PARENT: string = '100%'; | 9 | const FULL_PARENT: string = '100%'; |
| @@ -18,11 +19,13 @@ let listSize: number = 4; | @@ -18,11 +19,13 @@ let listSize: number = 4; | ||
| 18 | @Component | 19 | @Component |
| 19 | export struct ZhGridLayout03 { | 20 | export struct ZhGridLayout03 { |
| 20 | @State compDTO: CompDTO = {} as CompDTO | 21 | @State compDTO: CompDTO = {} as CompDTO |
| 22 | + @State loadImg: boolean = false; | ||
| 21 | 23 | ||
| 22 | - aboutToAppear() { | 24 | + async aboutToAppear(): Promise<void> { |
| 23 | if (this.compDTO.operDataList) { | 25 | if (this.compDTO.operDataList) { |
| 24 | listSize = this.compDTO.operDataList.length > 5 ? 4 : this.compDTO.operDataList.length; | 26 | listSize = this.compDTO.operDataList.length > 5 ? 4 : this.compDTO.operDataList.length; |
| 25 | } | 27 | } |
| 28 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 26 | } | 29 | } |
| 27 | 30 | ||
| 28 | build() { | 31 | build() { |
| @@ -52,7 +55,8 @@ export struct ZhGridLayout03 { | @@ -52,7 +55,8 @@ export struct ZhGridLayout03 { | ||
| 52 | @Builder | 55 | @Builder |
| 53 | buildItemCard(item: ContentDTO) { | 56 | buildItemCard(item: ContentDTO) { |
| 54 | Column() { | 57 | Column() { |
| 55 | - Image(item.coverUrl) | 58 | + Image(this.loadImg ? item.coverUrl : '') |
| 59 | + .backgroundColor(0xf5f5f5) | ||
| 56 | .width(44) | 60 | .width(44) |
| 57 | .aspectRatio(1 / 1) | 61 | .aspectRatio(1 / 1) |
| 58 | .margin({ | 62 | .margin({ |
| @@ -4,7 +4,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index'; | @@ -4,7 +4,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index'; | ||
| 4 | import { postInteractAccentionOperateParams } from 'wdBean'; | 4 | import { postInteractAccentionOperateParams } from 'wdBean'; |
| 5 | import { PageRepository } from '../../repository/PageRepository'; | 5 | import { PageRepository } from '../../repository/PageRepository'; |
| 6 | import { CommonConstants } from 'wdConstant/Index'; | 6 | import { CommonConstants } from 'wdConstant/Index'; |
| 7 | - | 7 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 8 | /** | 8 | /** |
| 9 | * 兴趣卡 | 9 | * 兴趣卡 |
| 10 | * Zh_Single_Column-09 | 10 | * Zh_Single_Column-09 |
| @@ -18,12 +18,13 @@ export struct ZhSingleColumn09 { | @@ -18,12 +18,13 @@ export struct ZhSingleColumn09 { | ||
| 18 | @State activeIndexs: Array<number> = [] | 18 | @State activeIndexs: Array<number> = [] |
| 19 | @State operDataList: ContentDTO[] = this.compDTO?.operDataList || [] | 19 | @State operDataList: ContentDTO[] = this.compDTO?.operDataList || [] |
| 20 | @State selfClosed: Boolean = false; | 20 | @State selfClosed: Boolean = false; |
| 21 | + @State loadImg: boolean = false; | ||
| 21 | 22 | ||
| 22 | - aboutToAppear(): void { | 23 | + async aboutToAppear(): Promise<void> { |
| 24 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 23 | this.operDataList = this.shuffleArray(this.compDTO?.operDataList) | 25 | this.operDataList = this.shuffleArray(this.compDTO?.operDataList) |
| 24 | } | 26 | } |
| 25 | 27 | ||
| 26 | - | ||
| 27 | getItemWidth(index: number) { | 28 | getItemWidth(index: number) { |
| 28 | if (index % 4 === 0 || index % 4 === 3) { | 29 | if (index % 4 === 0 || index % 4 === 3) { |
| 29 | return 80 | 30 | return 80 |
| @@ -84,7 +85,8 @@ export struct ZhSingleColumn09 { | @@ -84,7 +85,8 @@ export struct ZhSingleColumn09 { | ||
| 84 | ForEach(this.operDataList, (item: ContentDTO, index: number) => { | 85 | ForEach(this.operDataList, (item: ContentDTO, index: number) => { |
| 85 | GridItem() { | 86 | GridItem() { |
| 86 | Stack({alignContent: Alignment.TopEnd}) { | 87 | Stack({alignContent: Alignment.TopEnd}) { |
| 87 | - Image(item.coverUrl) | 88 | + Image(this.loadImg ? item.coverUrl : '') |
| 89 | + .backgroundColor(0xf5f5f5) | ||
| 88 | .width('100%') | 90 | .width('100%') |
| 89 | .height('100%') | 91 | .height('100%') |
| 90 | Text(item.newsTitle) | 92 | Text(item.newsTitle) |
| @@ -5,6 +5,7 @@ import { PageRepository } from '../../repository/PageRepository'; | @@ -5,6 +5,7 @@ import { PageRepository } from '../../repository/PageRepository'; | ||
| 5 | import { CommonConstants } from 'wdConstant/Index'; | 5 | import { CommonConstants } from 'wdConstant/Index'; |
| 6 | import { ProcessUtils } from 'wdRouter'; | 6 | import { ProcessUtils } from 'wdRouter'; |
| 7 | import { HttpUtils } from 'wdNetwork/Index'; | 7 | import { HttpUtils } from 'wdNetwork/Index'; |
| 8 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 8 | 9 | ||
| 9 | /** | 10 | /** |
| 10 | * 小视频横划卡 | 11 | * 小视频横划卡 |
| @@ -104,13 +105,21 @@ function textOverflowStyle(maxLine: number) { | @@ -104,13 +105,21 @@ function textOverflowStyle(maxLine: number) { | ||
| 104 | struct CreatorItem { | 105 | struct CreatorItem { |
| 105 | @Prop item: ContentDTO | 106 | @Prop item: ContentDTO |
| 106 | @State rmhIsAttention: number = 0 | 107 | @State rmhIsAttention: number = 0 |
| 108 | + @State loadImg: boolean = false; | ||
| 109 | + | ||
| 110 | + async aboutToAppear(): Promise<void> { | ||
| 111 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 112 | + } | ||
| 113 | + | ||
| 107 | build() { | 114 | build() { |
| 108 | ListItem() { | 115 | ListItem() { |
| 109 | Column() { | 116 | Column() { |
| 110 | Stack({ alignContent: Alignment.Bottom }) { | 117 | Stack({ alignContent: Alignment.Bottom }) { |
| 111 | - Image(this.item.coverUrl) | 118 | + Image(this.loadImg ? this.item.coverUrl : '') |
| 112 | .width(156) | 119 | .width(156) |
| 113 | .height(208) | 120 | .height(208) |
| 121 | + .backgroundColor(0xf5f5f5) | ||
| 122 | + | ||
| 114 | Row() | 123 | Row() |
| 115 | .width(156) | 124 | .width(156) |
| 116 | .height(80) | 125 | .height(80) |
| @@ -4,9 +4,11 @@ import { postInteractAccentionOperateParams } from 'wdBean'; | @@ -4,9 +4,11 @@ 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 | +import { DateTimeUtils, SPHelper } from 'wdKit'; |
| 8 | import { LiveModel } from '../../viewmodel/LiveModel' | 8 | import { LiveModel } from '../../viewmodel/LiveModel' |
| 9 | import { Logger, ToastUtils } from 'wdKit'; | 9 | import { Logger, ToastUtils } from 'wdKit'; |
| 10 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 11 | +import { SpConstants } from 'wdConstant/Index' | ||
| 10 | 12 | ||
| 11 | /** | 13 | /** |
| 12 | * 直播预约卡 | 14 | * 直播预约卡 |
| @@ -32,12 +34,15 @@ export struct ZhSingleRow03 { | @@ -32,12 +34,15 @@ export struct ZhSingleRow03 { | ||
| 32 | @State isEndEdge: boolean = false; | 34 | @State isEndEdge: boolean = false; |
| 33 | // @State reserveStatus: reserveItem[] = [] | 35 | // @State reserveStatus: reserveItem[] = [] |
| 34 | @State reservedIds: string[] = []; | 36 | @State reservedIds: string[] = []; |
| 35 | - scroller: Scroller = new Scroller() | 37 | + @State loadImg: boolean = false; |
| 36 | 38 | ||
| 37 | - aboutToAppear(): void { | 39 | + async aboutToAppear(): Promise<void> { |
| 38 | this.getReserveState(); | 40 | this.getReserveState(); |
| 41 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 39 | } | 42 | } |
| 40 | 43 | ||
| 44 | + scroller: Scroller = new Scroller() | ||
| 45 | + | ||
| 41 | // 请求所有预约状态 | 46 | // 请求所有预约状态 |
| 42 | async getReserveState() { | 47 | async getReserveState() { |
| 43 | const reserveBean: reserveReqItem[] = this.compDTO.operDataList.map((item: ContentDTO) => { | 48 | const reserveBean: reserveReqItem[] = this.compDTO.operDataList.map((item: ContentDTO) => { |
| @@ -63,6 +68,13 @@ export struct ZhSingleRow03 { | @@ -63,6 +68,13 @@ export struct ZhSingleRow03 { | ||
| 63 | 68 | ||
| 64 | // 预约/取消预约 | 69 | // 预约/取消预约 |
| 65 | async bookAndCancel(relationId: string, liveId: string, isSubscribe: boolean) { | 70 | async bookAndCancel(relationId: string, liveId: string, isSubscribe: boolean) { |
| 71 | + // 未登录,跳转登录 | ||
| 72 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 73 | + if (!user_id) { | ||
| 74 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 75 | + return | ||
| 76 | + } | ||
| 77 | + | ||
| 66 | const res = await LiveModel.liveAppointment(relationId.toString(), liveId.toString(), isSubscribe); | 78 | const res = await LiveModel.liveAppointment(relationId.toString(), liveId.toString(), isSubscribe); |
| 67 | if (res.code == 0) { | 79 | if (res.code == 0) { |
| 68 | ToastUtils.shortToast(isSubscribe ? '预约成功' : '取消预约成功') | 80 | ToastUtils.shortToast(isSubscribe ? '预约成功' : '取消预约成功') |
| @@ -128,10 +140,12 @@ export struct ZhSingleRow03 { | @@ -128,10 +140,12 @@ export struct ZhSingleRow03 { | ||
| 128 | ItemCard(item: ContentDTO) { | 140 | ItemCard(item: ContentDTO) { |
| 129 | Column() { | 141 | Column() { |
| 130 | Row() { | 142 | Row() { |
| 131 | - Image(item.coverUrl) | 143 | + Image(this.loadImg ? item.coverUrl : '') |
| 132 | .width(106) | 144 | .width(106) |
| 133 | .height(60) | 145 | .height(60) |
| 134 | .margin({right: 12}) | 146 | .margin({right: 12}) |
| 147 | + .backgroundColor(0xf5f5f5) | ||
| 148 | + | ||
| 135 | Text(item.newsTitle) | 149 | Text(item.newsTitle) |
| 136 | .width(154) | 150 | .width(154) |
| 137 | .height(60) | 151 | .height(60) |
| @@ -256,11 +270,17 @@ function textOverflowStyle(maxLine: number) { | @@ -256,11 +270,17 @@ function textOverflowStyle(maxLine: number) { | ||
| 256 | struct CreatorItem { | 270 | struct CreatorItem { |
| 257 | @Prop item: ContentDTO | 271 | @Prop item: ContentDTO |
| 258 | @State rmhIsAttention: number = 0 | 272 | @State rmhIsAttention: number = 0 |
| 273 | + @State loadImg: boolean = false; | ||
| 274 | + | ||
| 275 | + async aboutToAppear(): Promise<void> { | ||
| 276 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 277 | + } | ||
| 259 | build() { | 278 | build() { |
| 260 | ListItem() { | 279 | ListItem() { |
| 261 | Column() { | 280 | Column() { |
| 262 | Stack({ alignContent: Alignment.Bottom }) { | 281 | Stack({ alignContent: Alignment.Bottom }) { |
| 263 | - Image(this.item.coverUrl) | 282 | + Image(this.loadImg ? this.item.coverUrl : '') |
| 283 | + .backgroundColor(0xf5f5f5) | ||
| 264 | .width(156) | 284 | .width(156) |
| 265 | .height(208) | 285 | .height(208) |
| 266 | Row() | 286 | Row() |
| @@ -64,7 +64,7 @@ export struct ZhSingleRow04 { | @@ -64,7 +64,7 @@ export struct ZhSingleRow04 { | ||
| 64 | operDataListItem: item | 64 | operDataListItem: item |
| 65 | } | 65 | } |
| 66 | ) | 66 | ) |
| 67 | - .margin({right: index === this.compDTO.operDataList.length - 1 ? $r('app.float.card_comp_pagePadding_lf') : 0, left: | 67 | + .margin({right: index === this.compDTO.operDataList.length - 1 ? 26 : 0, left: |
| 68 | index === 0 ? $r('app.float.card_comp_pagePadding_lf') : 0, | 68 | index === 0 ? $r('app.float.card_comp_pagePadding_lf') : 0, |
| 69 | top: 6}) | 69 | top: 6}) |
| 70 | .onClick(() => { | 70 | .onClick(() => { |
| @@ -106,6 +106,9 @@ struct localCard { | @@ -106,6 +106,9 @@ struct localCard { | ||
| 106 | .align(Alignment.TopStart) | 106 | .align(Alignment.TopStart) |
| 107 | .maxLines(3) | 107 | .maxLines(3) |
| 108 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 108 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 109 | + .lineHeight(20) | ||
| 110 | + .margin({bottom: 17}) | ||
| 111 | + .fontWeight(500) | ||
| 109 | Row() { | 112 | Row() { |
| 110 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.operDataListItem.publishTime))) | 113 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.operDataListItem.publishTime))) |
| 111 | .fontSize($r("app.float.font_size_12")) | 114 | .fontSize($r("app.float.font_size_12")) |
| @@ -136,7 +139,7 @@ struct localCard { | @@ -136,7 +139,7 @@ struct localCard { | ||
| 136 | .border({ | 139 | .border({ |
| 137 | radius: 2, | 140 | radius: 2, |
| 138 | }) | 141 | }) |
| 139 | - .shadow({ radius: 15, color: '#1A000000', offsetX: 2, offsetY: 2 }) | 142 | + .shadow({ radius: 6, color: '#1A000000', offsetX: 3, offsetY: 0 }) |
| 140 | .margin({ | 143 | .margin({ |
| 141 | right: 10 | 144 | right: 10 |
| 142 | }) | 145 | }) |
| 1 | import { commentInfo, CompDTO, ContentDTO, Params } from 'wdBean'; | 1 | import { commentInfo, CompDTO, ContentDTO, Params } from 'wdBean'; |
| 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 3 | -import { HttpUtils } from 'wdNetwork/Index'; | ||
| 4 | -import { postInteractAccentionOperateParams } from 'wdBean'; | ||
| 5 | -import { PageRepository } from '../../repository/PageRepository'; | ||
| 6 | -import { DateTimeUtils } from 'wdKit/Index'; | 3 | +import { DateTimeUtils, SPHelper } from 'wdKit/Index'; |
| 7 | import { ProcessUtils } from 'wdRouter'; | 4 | import { ProcessUtils } from 'wdRouter'; |
| 5 | +import { SpConstants } from 'wdConstant/Index' | ||
| 8 | 6 | ||
| 9 | /** | 7 | /** |
| 10 | * 精选评论卡 | 8 | * 精选评论卡 |
| @@ -32,6 +30,20 @@ export struct ZhSingleRow06 { | @@ -32,6 +30,20 @@ export struct ZhSingleRow06 { | ||
| 32 | @State compDTO: CompDTO = {} as CompDTO | 30 | @State compDTO: CompDTO = {} as CompDTO |
| 33 | @State likeBl: boolean = false; | 31 | @State likeBl: boolean = false; |
| 34 | 32 | ||
| 33 | + async likeAction() { | ||
| 34 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 35 | + if (!user_id) { | ||
| 36 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 37 | + return | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + if (this.likeBl) { | ||
| 41 | + this.likeBl = false; | ||
| 42 | + } else { | ||
| 43 | + this.likeBl = true; | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + | ||
| 35 | build() { | 47 | build() { |
| 36 | Column() { | 48 | Column() { |
| 37 | //顶部 | 49 | //顶部 |
| @@ -41,6 +53,7 @@ export struct ZhSingleRow06 { | @@ -41,6 +53,7 @@ export struct ZhSingleRow06 { | ||
| 41 | 53 | ||
| 42 | Column(){ | 54 | Column(){ |
| 43 | Text(this.compDTO.operDataList[0]?.commentInfo?.commentTitle) | 55 | Text(this.compDTO.operDataList[0]?.commentInfo?.commentTitle) |
| 56 | + .fontWeight(500) | ||
| 44 | .maxLines(4) | 57 | .maxLines(4) |
| 45 | .textOverflow({overflow: TextOverflow.Ellipsis}) | 58 | .textOverflow({overflow: TextOverflow.Ellipsis}) |
| 46 | .lineHeight(23) | 59 | .lineHeight(23) |
| @@ -88,15 +101,11 @@ export struct ZhSingleRow06 { | @@ -88,15 +101,11 @@ export struct ZhSingleRow06 { | ||
| 88 | .margin({right: 3}) | 101 | .margin({right: 3}) |
| 89 | 102 | ||
| 90 | Text('点赞') | 103 | Text('点赞') |
| 91 | - .fontSize(14) | 104 | + .fontSize(15) |
| 92 | .fontColor(0x999999) | 105 | .fontColor(0x999999) |
| 93 | } | 106 | } |
| 94 | .onClick(() => { | 107 | .onClick(() => { |
| 95 | - if (this.likeBl) { | ||
| 96 | - this.likeBl = false; | ||
| 97 | - } else { | ||
| 98 | - this.likeBl = true; | ||
| 99 | - } | 108 | + this.likeAction() |
| 100 | }) | 109 | }) |
| 101 | } | 110 | } |
| 102 | .justifyContent(FlexAlign.SpaceBetween) | 111 | .justifyContent(FlexAlign.SpaceBetween) |
| @@ -125,6 +134,7 @@ export struct ZhSingleRow06 { | @@ -125,6 +134,7 @@ export struct ZhSingleRow06 { | ||
| 125 | .fontSize(14) | 134 | .fontSize(14) |
| 126 | .fontColor(0x222222) | 135 | .fontColor(0x222222) |
| 127 | .maxLines(1) | 136 | .maxLines(1) |
| 137 | + .fontWeight(500) | ||
| 128 | .textOverflow({overflow: TextOverflow.Ellipsis}) | 138 | .textOverflow({overflow: TextOverflow.Ellipsis}) |
| 129 | } | 139 | } |
| 130 | .onClick(() => { | 140 | .onClick(() => { |
| @@ -155,106 +165,3 @@ function textOverflowStyle(maxLine: number) { | @@ -155,106 +165,3 @@ function textOverflowStyle(maxLine: number) { | ||
| 155 | .maxLines(maxLine) | 165 | .maxLines(maxLine) |
| 156 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 166 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 157 | } | 167 | } |
| 158 | - | ||
| 159 | -@Component | ||
| 160 | -struct CreatorItem { | ||
| 161 | - @Prop item: ContentDTO | ||
| 162 | - @State rmhIsAttention: number = 0 | ||
| 163 | - build() { | ||
| 164 | - ListItem() { | ||
| 165 | - Column() { | ||
| 166 | - Flex({direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween}) { | ||
| 167 | - Column() { | ||
| 168 | - Row() { | ||
| 169 | - Image('') | ||
| 170 | - .width(20) | ||
| 171 | - .height(20) | ||
| 172 | - .margin({right: 4}) | ||
| 173 | - .border({width: 1, color: 0xcccccc, radius: 10}) | ||
| 174 | - Text('立志之间') | ||
| 175 | - .fontColor(0x212228) | ||
| 176 | - .fontSize(12) | ||
| 177 | - } | ||
| 178 | - } | ||
| 179 | - | ||
| 180 | - Column() { | ||
| 181 | - Row() { | ||
| 182 | - Image($r('app.media.icon_like_no')) | ||
| 183 | - .width(16) | ||
| 184 | - .height(16) | ||
| 185 | - .margin({right: 4}) | ||
| 186 | - Text('3835') | ||
| 187 | - .fontSize(14) | ||
| 188 | - .fontColor(0x999999) | ||
| 189 | - } | ||
| 190 | - } | ||
| 191 | - } | ||
| 192 | - .margin({top: 10, left: 10, right: 10, bottom: 8}) | ||
| 193 | - | ||
| 194 | - Text('就业不仅是民生问题,也是发展问题,就业不仅是民生问题,也是发展问题,就业不仅是民生问题,也是发展问题,') | ||
| 195 | - .maxLines(2) | ||
| 196 | - .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 197 | - .margin({left: 10, right: 10, bottom: 8}) | ||
| 198 | - .fontSize(17) | ||
| 199 | - .fontColor(0x212228) | ||
| 200 | - .lineHeight(25) | ||
| 201 | - | ||
| 202 | - Row() { | ||
| 203 | - Image('') | ||
| 204 | - .width(66) | ||
| 205 | - .height(44) | ||
| 206 | - .borderRadius({topLeft: 3, topRight: 0, bottomLeft: 3, bottomRight: 0}) | ||
| 207 | - Text('原文|强化就业优先政策 健全就业促进机制原文|强化就业优先政策 健全就业促进机制原文|强化就业优先政策 健全就业促进机制') | ||
| 208 | - .margin({left: 8}) | ||
| 209 | - .width(172) | ||
| 210 | - .maxLines(2) | ||
| 211 | - .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 212 | - } | ||
| 213 | - .linearGradient({ | ||
| 214 | - direction: GradientDirection.Right, | ||
| 215 | - colors: [[0xffffff, 0.0],[0xffffff, 0.8], [0xf9f9f9, 1.0]] | ||
| 216 | - }) | ||
| 217 | - } | ||
| 218 | - .width(276) | ||
| 219 | - .height(150) | ||
| 220 | - .margin({ right: 10 }) | ||
| 221 | - .borderWidth(1) | ||
| 222 | - .borderColor($r('app.color.color_EDEDED')) | ||
| 223 | - .borderRadius($r('app.float.image_border_radius')) | ||
| 224 | - .backgroundColor(0xf9f9f9) | ||
| 225 | - } | ||
| 226 | - .onClick(() => { | ||
| 227 | - console.log('跳转到rmh'); | ||
| 228 | - }) | ||
| 229 | - } | ||
| 230 | - | ||
| 231 | - /** | ||
| 232 | - * 关注号主 TODO 这里后面需要抽离 | ||
| 233 | - */ | ||
| 234 | - handleAccention(item: ContentDTO, status: number) { | ||
| 235 | - this.rmhIsAttention = this.rmhIsAttention ? 0 : 1 | ||
| 236 | - return | ||
| 237 | - // 未登录,跳转登录 | ||
| 238 | - if (!HttpUtils.getUserId()) { | ||
| 239 | - WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 240 | - return | ||
| 241 | - } | ||
| 242 | - | ||
| 243 | - const params: postInteractAccentionOperateParams = { | ||
| 244 | - attentionUserType: item.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号) | ||
| 245 | - attentionUserId: item.rmhInfo?.userId || '', // 被关注用户号主id | ||
| 246 | - attentionCreatorId: item.rmhInfo?.rmhId || '', // 被关注用户号主id | ||
| 247 | - // userType: 1, | ||
| 248 | - // userId: '1', // TODO 用户id需要从本地获取 | ||
| 249 | - status: status, | ||
| 250 | - } | ||
| 251 | - PageRepository.postInteractAccentionOperate(params).then(res => { | ||
| 252 | - console.log(TAG, '关注号主==', JSON.stringify(res.data)) | ||
| 253 | - if (status === 1) { | ||
| 254 | - this.rmhIsAttention = 0 | ||
| 255 | - } else { | ||
| 256 | - this.rmhIsAttention = 1 | ||
| 257 | - } | ||
| 258 | - }) | ||
| 259 | - } | ||
| 260 | -} |
| @@ -47,7 +47,7 @@ export default struct MinePageMoreFunctionUI { | @@ -47,7 +47,7 @@ export default struct MinePageMoreFunctionUI { | ||
| 47 | .fontWeight(400) | 47 | .fontWeight(400) |
| 48 | 48 | ||
| 49 | Blank() | 49 | Blank() |
| 50 | - Image($r('app.media.mine_user_arrow')) | 50 | + Image($r('app.media.mine_user_arrow_2')) |
| 51 | .width('27lpx') | 51 | .width('27lpx') |
| 52 | .height('27lpx') | 52 | .height('27lpx') |
| 53 | .objectFit(ImageFit.Auto) | 53 | .objectFit(ImageFit.Auto) |
| @@ -83,14 +83,15 @@ export default struct MinePageUserSimpleInfoUI { | @@ -83,14 +83,15 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 83 | .height('29lpx') | 83 | .height('29lpx') |
| 84 | }.margin({top:'15lpx'}) | 84 | }.margin({top:'15lpx'}) |
| 85 | }.alignItems(HorizontalAlign.Start) | 85 | }.alignItems(HorizontalAlign.Start) |
| 86 | - .margin({top:'12lpx',left:'17lpx'}) | 86 | + .margin({top:'12lpx',left:'23lpx'}) |
| 87 | .width('352lpx') | 87 | .width('352lpx') |
| 88 | }else{ | 88 | }else{ |
| 89 | Row(){ | 89 | Row(){ |
| 90 | Text("登录注册") | 90 | Text("登录注册") |
| 91 | .fontColor($r('app.color.color_222222')) | 91 | .fontColor($r('app.color.color_222222')) |
| 92 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 93 | - .fontSize('33lpx') | 92 | + .fontSize('38lpx') |
| 93 | + .lineHeight("46lpx") | ||
| 94 | + .fontWeight(600) | ||
| 94 | 95 | ||
| 95 | Image($r('app.media.mine_user_edit')) | 96 | Image($r('app.media.mine_user_edit')) |
| 96 | .width('11lpx') | 97 | .width('11lpx') |
| @@ -101,7 +102,7 @@ export default struct MinePageUserSimpleInfoUI { | @@ -101,7 +102,7 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 101 | }.onClick(()=>{ | 102 | }.onClick(()=>{ |
| 102 | this.jumpLogin() | 103 | this.jumpLogin() |
| 103 | }) | 104 | }) |
| 104 | - .margin({top:'11lpx',left:'17lpx'}) | 105 | + .margin({top:'11lpx',left:'23lpx'}) |
| 105 | .width('352lpx') | 106 | .width('352lpx') |
| 106 | } | 107 | } |
| 107 | 108 | ||
| @@ -170,12 +171,19 @@ export default struct MinePageUserSimpleInfoUI { | @@ -170,12 +171,19 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 170 | if(value!=null){ | 171 | if(value!=null){ |
| 171 | if(StringUtils.isEmpty(this.levelHead)){ | 172 | if(StringUtils.isEmpty(this.levelHead)){ |
| 172 | if(this.userType === "1"){ | 173 | if(this.userType === "1"){ |
| 173 | - this.levelHead = value.levelHead | 174 | + if(value.levelHead != undefined){ |
| 175 | + this.levelHead = value.levelHead | ||
| 176 | + } | ||
| 174 | } | 177 | } |
| 175 | } | 178 | } |
| 176 | - this.levelId = value.levelId | ||
| 177 | - UserDataLocal.setUserLevel(this.levelId) | ||
| 178 | - UserDataLocal.setUserLevelHeaderUrl(this.levelHead + "") | 179 | + if(value.levelId != undefined){ |
| 180 | + this.levelId = value.levelId | ||
| 181 | + UserDataLocal.setUserLevel(this.levelId) | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + if(StringUtils.isNotEmpty(this.levelHead)){ | ||
| 185 | + UserDataLocal.setUserLevelHeaderUrl(this.levelHead + "") | ||
| 186 | + } | ||
| 179 | } | 187 | } |
| 180 | }).catch((err:Error)=>{ | 188 | }).catch((err:Error)=>{ |
| 181 | console.log(TAG,JSON.stringify(err)) | 189 | console.log(TAG,JSON.stringify(err)) |
| @@ -17,9 +17,7 @@ export struct AppointmentListChildComponent{ | @@ -17,9 +17,7 @@ export struct AppointmentListChildComponent{ | ||
| 17 | }), | 17 | }), |
| 18 | autoCancel: true, | 18 | autoCancel: true, |
| 19 | alignment: DialogAlignment.Center, | 19 | alignment: DialogAlignment.Center, |
| 20 | - offset: { dx: 0, dy: -20 }, | ||
| 21 | - gridCount: 4, | ||
| 22 | - customStyle: false | 20 | + customStyle: true |
| 23 | }) | 21 | }) |
| 24 | 22 | ||
| 25 | 23 |
| @@ -115,10 +115,9 @@ export struct FollowChildComponent{ | @@ -115,10 +115,9 @@ export struct FollowChildComponent{ | ||
| 115 | }.height('202lpx') | 115 | }.height('202lpx') |
| 116 | .justifyContent(FlexAlign.Start) | 116 | .justifyContent(FlexAlign.Start) |
| 117 | 117 | ||
| 118 | - Divider().width('100%') | ||
| 119 | - .height('1lpx') | ||
| 120 | - .strokeWidth('1lpx') | ||
| 121 | - .backgroundColor($r('app.color.color_EDEDED')) | 118 | + Text().backgroundColor($r('app.color.color_EDEDED')) |
| 119 | + .width('100%') | ||
| 120 | + .height('2lpx') | ||
| 122 | }.width('100%') | 121 | }.width('100%') |
| 123 | 122 | ||
| 124 | }else { | 123 | }else { |
| @@ -228,13 +227,10 @@ export struct FollowChildComponent{ | @@ -228,13 +227,10 @@ export struct FollowChildComponent{ | ||
| 228 | 227 | ||
| 229 | }.height('146lpx') | 228 | }.height('146lpx') |
| 230 | .justifyContent(FlexAlign.Center) | 229 | .justifyContent(FlexAlign.Center) |
| 231 | - .onClick(()=>{ | ||
| 232 | - }) | ||
| 233 | 230 | ||
| 234 | - Divider().width('100%') | ||
| 235 | - .height('1lpx') | ||
| 236 | - .strokeWidth('1lpx') | ||
| 237 | - .backgroundColor($r('app.color.color_EDEDED')) | 231 | + Text().backgroundColor($r('app.color.color_EDEDED')) |
| 232 | + .width('100%') | ||
| 233 | + .height('2lpx') | ||
| 238 | }.width('100%') | 234 | }.width('100%') |
| 239 | 235 | ||
| 240 | } | 236 | } |
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowSecondTabsComponent.ets
| @@ -16,10 +16,9 @@ export struct FollowSecondTabsComponent{ | @@ -16,10 +16,9 @@ export struct FollowSecondTabsComponent{ | ||
| 16 | 16 | ||
| 17 | build(){ | 17 | build(){ |
| 18 | Column(){ | 18 | Column(){ |
| 19 | - Divider().width('100%') | 19 | + Text().backgroundColor($r('app.color.color_EDEDED')) |
| 20 | + .width('100%') | ||
| 20 | .height('2lpx') | 21 | .height('2lpx') |
| 21 | - .strokeWidth('1lpx') | ||
| 22 | - .backgroundColor($r('app.color.color_EDEDED')) | ||
| 23 | 22 | ||
| 24 | if(this.data != null){ | 23 | if(this.data != null){ |
| 25 | if(this.data[this.firstIndex].children == null || this.data[this.firstIndex].children.length == 0){ | 24 | if(this.data[this.firstIndex].children == null || this.data[this.firstIndex].children.length == 0){ |
| @@ -35,7 +35,7 @@ export struct FollowThirdTabsComponent{ | @@ -35,7 +35,7 @@ export struct FollowThirdTabsComponent{ | ||
| 35 | 35 | ||
| 36 | Text(item.directoryName) | 36 | Text(item.directoryName) |
| 37 | .fontSize('27lpx') | 37 | .fontSize('27lpx') |
| 38 | - .fontWeight(this.currentIndex === index ? "600lpx" : "400lpx") | 38 | + .fontWeight(this.currentIndex === index ? 600 : 400) |
| 39 | .fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor) | 39 | .fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor) |
| 40 | .lineHeight('35lpx') | 40 | .lineHeight('35lpx') |
| 41 | .backgroundImage($r('app.media.ic_collect_mid')) | 41 | .backgroundImage($r('app.media.ic_collect_mid')) |
| @@ -61,6 +61,7 @@ export struct ChildCommentComponent { | @@ -61,6 +61,7 @@ export struct ChildCommentComponent { | ||
| 61 | .lineHeight("31lpx") | 61 | .lineHeight("31lpx") |
| 62 | .fontColor(this.data.like_status === 0 ? $r('app.color.color_666666') : $r('app.color.color_ED2800')) | 62 | .fontColor(this.data.like_status === 0 ? $r('app.color.color_666666') : $r('app.color.color_ED2800')) |
| 63 | .margin({ right: '8lpx' }) | 63 | .margin({ right: '8lpx' }) |
| 64 | + .visibility(this.data.likeNum <= 0||StringUtils.isEmpty(this.data.likeNum.toString()) ? Visibility.Hidden : Visibility.Visible) | ||
| 64 | Image(this.data.like_status === 0 ? $r('app.media.like_default_status') : $r('app.media.liked_status')) | 65 | Image(this.data.like_status === 0 ? $r('app.media.like_default_status') : $r('app.media.liked_status')) |
| 65 | .width('31lpx') | 66 | .width('31lpx') |
| 66 | .height('31lpx') | 67 | .height('31lpx') |
| 1 | +import { DateTimeUtils, LazyDataSource, UserDataLocal } from 'wdKit'; | ||
| 2 | +import MinePageDatasModel from '../../../model/MinePageDatasModel'; | ||
| 3 | +import { CommentListItem } from '../../../viewmodel/CommentListItem'; | ||
| 4 | +import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem'; | ||
| 5 | +import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | ||
| 6 | +import { EmptyComponent } from '../../view/EmptyComponent'; | ||
| 7 | +import { ChildCommentComponent } from './ChildCommentComponent'; | ||
| 8 | +import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem'; | ||
| 9 | +import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; | ||
| 10 | + | ||
| 11 | +const TAG = "HomePageBottomCommentComponent" | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 我的主页 评论tab | ||
| 15 | + */ | ||
| 16 | +@Component | ||
| 17 | +export struct HomePageBottomCommentComponent { | ||
| 18 | + @State data_comment: LazyDataSource<CommentListItem> = new LazyDataSource(); | ||
| 19 | + @State isLoading: boolean = false | ||
| 20 | + @State hasMore: boolean = true | ||
| 21 | + curPageNum: number = 1; | ||
| 22 | + @State count: number = 0; | ||
| 23 | + @Link commentNum: number | ||
| 24 | + @State isGetRequest: boolean = false | ||
| 25 | + | ||
| 26 | + aboutToAppear() { | ||
| 27 | + this.getNewPageData() | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + build() { | ||
| 31 | + Column() { | ||
| 32 | + if (this.isGetRequest == true) { | ||
| 33 | + Divider().width('100%') | ||
| 34 | + .height('2lpx') | ||
| 35 | + .strokeWidth('1lpx') | ||
| 36 | + .backgroundColor($r('app.color.color_EDEDED')) | ||
| 37 | + } | ||
| 38 | + if (this.count === 0) { | ||
| 39 | + if (this.isGetRequest == true) { | ||
| 40 | + EmptyComponent({ emptyType: 11 }) | ||
| 41 | + .layoutWeight(1) | ||
| 42 | + .width('100%') | ||
| 43 | + .offset({ y: "-200lpx" }) | ||
| 44 | + } | ||
| 45 | + } else { | ||
| 46 | + List({ space: 3 }) { | ||
| 47 | + LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => { | ||
| 48 | + ListItem() { | ||
| 49 | + ChildCommentComponent({ | ||
| 50 | + data: item, | ||
| 51 | + levelHead: UserDataLocal.getUserLevelHeaderUrl(), | ||
| 52 | + isLastItem: index === this.data_comment.totalCount() - 1 | ||
| 53 | + }) | ||
| 54 | + } | ||
| 55 | + }, (item: CommentListItem, index: number) => index.toString()) | ||
| 56 | + | ||
| 57 | + //没有更多数据 显示提示 | ||
| 58 | + if (!this.hasMore) { | ||
| 59 | + ListItem() { | ||
| 60 | + ListHasNoMoreDataUI() | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + .cachedCount(15) | ||
| 65 | + .layoutWeight(1) | ||
| 66 | + .scrollBar(BarState.Off) | ||
| 67 | + .edgeEffect(EdgeEffect.None) | ||
| 68 | + .nestedScroll({ | ||
| 69 | + scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 70 | + scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 71 | + }) | ||
| 72 | + .onReachEnd(() => { | ||
| 73 | + console.log(TAG, "触底了"); | ||
| 74 | + if (!this.isLoading) { | ||
| 75 | + this.isLoading = true | ||
| 76 | + //加载分页数据 | ||
| 77 | + this.getNewPageData() | ||
| 78 | + } | ||
| 79 | + }) | ||
| 80 | + } | ||
| 81 | + }.layoutWeight(1) | ||
| 82 | + .justifyContent(FlexAlign.Start) | ||
| 83 | + .width('100%') | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + getNewPageData() { | ||
| 87 | + this.isLoading = true | ||
| 88 | + if (this.hasMore) { | ||
| 89 | + let time = encodeURI(DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) | ||
| 90 | + let object = new FollowListDetailRequestItem(-1, 20, this.curPageNum) | ||
| 91 | + | ||
| 92 | + MinePageDatasModel.getMineCommentListData(time, object, getContext(this)).then((value) => { | ||
| 93 | + if (!this.data_comment || value.list.length == 0) { | ||
| 94 | + this.hasMore = false | ||
| 95 | + this.isLoading = false | ||
| 96 | + this.isGetRequest = true | ||
| 97 | + } else { | ||
| 98 | + this.getCommentListStatus(value) | ||
| 99 | + } | ||
| 100 | + }).catch((err: Error) => { | ||
| 101 | + console.log(TAG, "请求失败") | ||
| 102 | + this.isLoading = false | ||
| 103 | + this.isGetRequest = true | ||
| 104 | + }) | ||
| 105 | + } else { | ||
| 106 | + this.isLoading = false | ||
| 107 | + this.isGetRequest = true | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + getCommentListStatus(value: MineCommentListDetailItem) { | ||
| 112 | + | ||
| 113 | + let status = new OtherUserCommentLikeStatusRequestItem() | ||
| 114 | + let data: CommentListItem[] = [] | ||
| 115 | + value.list.forEach((item) => { | ||
| 116 | + if (item.checkStatus === 2) { | ||
| 117 | + status.commentIdList.push(item.id) | ||
| 118 | + } | ||
| 119 | + let commentContent = item.commentContent | ||
| 120 | + if (item.sensitiveShow === 0 && item.sensitiveExist === 1) { | ||
| 121 | + commentContent = item.commentContentSensitive | ||
| 122 | + } | ||
| 123 | + let parentCommentContent = "" | ||
| 124 | + if (item.parentCommentVo != null) { | ||
| 125 | + parentCommentContent = item.parentCommentVo.commentContent | ||
| 126 | + } | ||
| 127 | + let parentCommentUserName = "" | ||
| 128 | + if (item.parentCommentVo != null) { | ||
| 129 | + parentCommentUserName = item.parentCommentVo.fromUserName | ||
| 130 | + } | ||
| 131 | + data.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, item.createTime, | ||
| 132 | + commentContent, item.likeNum, 0, item.id, item.targetId, item.targetType, item.targetRelId, | ||
| 133 | + item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, parentCommentContent, | ||
| 134 | + parentCommentUserName)) | ||
| 135 | + }) | ||
| 136 | + | ||
| 137 | + if (status.commentIdList.length === 0) { | ||
| 138 | + data.forEach((item) => { | ||
| 139 | + let publishTime = | ||
| 140 | + DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(item.createTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) | ||
| 141 | + this.data_comment.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, | ||
| 142 | + publishTime, item.commentContent, item.likeNum, item.like_status, item.id, item.targetId, item.targetType, | ||
| 143 | + item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, | ||
| 144 | + 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 | + MinePageDatasModel.getOtherUserCommentLikeStatusData(status, getContext(this)).then((newValue) => { | ||
| 163 | + newValue.forEach((item) => { | ||
| 164 | + data.forEach((list) => { | ||
| 165 | + if (item.commentId == list.id) { | ||
| 166 | + list.like_status = item.status | ||
| 167 | + } | ||
| 168 | + }) | ||
| 169 | + }) | ||
| 170 | + | ||
| 171 | + data.forEach((item) => { | ||
| 172 | + let publishTime = | ||
| 173 | + DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(item.createTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) | ||
| 174 | + this.data_comment.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, | ||
| 175 | + publishTime, item.commentContent, item.likeNum, item.like_status, item.id, item.targetId, item.targetType, | ||
| 176 | + item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, | ||
| 177 | + item.parentCommentContent, item.parentCommentUserName)) | ||
| 178 | + }) | ||
| 179 | + | ||
| 180 | + this.data_comment.notifyDataReload() | ||
| 181 | + | ||
| 182 | + this.count = this.data_comment.totalCount() | ||
| 183 | + this.commentNum = value.totalCount | ||
| 184 | + if (this.data_comment.totalCount() < value.totalCount) { | ||
| 185 | + this.curPageNum++ | ||
| 186 | + } else { | ||
| 187 | + this.hasMore = false | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + this.isLoading = false | ||
| 191 | + this.isGetRequest = true | ||
| 192 | + }).catch((err: Error) => { | ||
| 193 | + console.log(TAG, "请求失败") | ||
| 194 | + this.isLoading = false | ||
| 195 | + this.isGetRequest = true | ||
| 196 | + }) | ||
| 197 | + } | ||
| 198 | +} |
| 1 | -import { DateTimeUtils, LazyDataSource, SPHelper,UserDataLocal } from 'wdKit'; | ||
| 2 | -import { WDRouterPage, WDRouterRule } from 'wdRouter'; | ||
| 3 | -import MinePageDatasModel from '../../../model/MinePageDatasModel'; | ||
| 4 | -import { CommentListItem } from '../../../viewmodel/CommentListItem'; | ||
| 5 | -import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; | ||
| 6 | -import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem'; | ||
| 7 | -import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | ||
| 8 | -import { FollowChildComponent } from '../follow/FollowChildComponent'; | ||
| 9 | -import dataPreferences from '@ohos.data.preferences'; | ||
| 10 | -import { EmptyComponent } from '../../view/EmptyComponent'; | ||
| 11 | -import { ChildCommentComponent } from './ChildCommentComponent'; | ||
| 12 | -import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem'; | ||
| 13 | -import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; | ||
| 14 | - | ||
| 15 | -const TAG = "HomePageBottomComponent" | ||
| 16 | -@Component | ||
| 17 | -export struct HomePageBottomComponent{ | ||
| 18 | - @State style:number = 0; //0 评论 ,1 关注 | ||
| 19 | - @State data_follow: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); | ||
| 20 | - @State data_comment: LazyDataSource<CommentListItem> = new LazyDataSource(); | ||
| 21 | - @State isLoading:boolean = false | ||
| 22 | - @State hasMore:boolean = true | ||
| 23 | - curPageNum:number = 1; | ||
| 24 | - @State count:number = 0; | ||
| 25 | - @State isMineAccount:boolean = true; | ||
| 26 | - @State userId:string = ""; | ||
| 27 | - @Link commentNum:number | ||
| 28 | - preferences: dataPreferences.Preferences | null = null; | ||
| 29 | - @State isGetRequest:boolean = false | ||
| 30 | - observer = (key: string) => { | ||
| 31 | - if (key == UserDataLocal.USER_FOLLOW_OPERATION) { | ||
| 32 | - let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION,"") as string | ||
| 33 | - let arr = value.split(',') | ||
| 34 | - if(arr[1] == "0"){ | ||
| 35 | - this.data_follow.getDataArray().forEach((element,index) => { | ||
| 36 | - if (element.creatorId === arr[0]) { | ||
| 37 | - this.data_follow.deleteItem(index) | ||
| 38 | - this.count = this.data_follow.size() | ||
| 39 | - } | ||
| 40 | - }); | ||
| 41 | - }else{ | ||
| 42 | - if(!this.isLoading){ | ||
| 43 | - this.isLoading = true | ||
| 44 | - this.hasMore = true | ||
| 45 | - this.curPageNum = 1 | ||
| 46 | - this.data_follow.clear() | ||
| 47 | - this.data_follow.notifyDataReload() | ||
| 48 | - this.getMyFollowListDetail() | ||
| 49 | - } | ||
| 50 | - } | ||
| 51 | - } | ||
| 52 | - } | ||
| 53 | - | ||
| 54 | - aboutToAppear(){ | ||
| 55 | - this.getNewPageData() | ||
| 56 | - this.addFollowStatusObserver() | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - async addFollowStatusObserver() { | ||
| 60 | - this.preferences = await SPHelper.default.getPreferences(); | ||
| 61 | - this.preferences.on('change', this.observer); | ||
| 62 | - } | ||
| 63 | - | ||
| 64 | - aboutToDisappear(): void { | ||
| 65 | - if(this.preferences){ | ||
| 66 | - this.preferences.off('change', this.observer); | ||
| 67 | - } | ||
| 68 | - } | ||
| 69 | - | ||
| 70 | - build(){ | ||
| 71 | - Column(){ | ||
| 72 | - if(this.isGetRequest == true){ | ||
| 73 | - Divider().width('100%') | ||
| 74 | - .height('2lpx') | ||
| 75 | - .strokeWidth('1lpx') | ||
| 76 | - .backgroundColor($r('app.color.color_EDEDED')) | ||
| 77 | - } | ||
| 78 | - | ||
| 79 | - if(this.count === 0 ){ | ||
| 80 | - if(this.style === 1){ | ||
| 81 | - Column(){ | ||
| 82 | - Row(){ | ||
| 83 | - Text("关注更多人民号") | ||
| 84 | - .fontWeight('400lpx') | ||
| 85 | - .fontColor($r('app.color.color_222222')) | ||
| 86 | - .lineHeight('38lpx') | ||
| 87 | - .fontSize('27lpx') | ||
| 88 | - .textAlign(TextAlign.Center) | ||
| 89 | - .margin({right:'4lpx'}) | ||
| 90 | - Image($r('app.media.arrow_icon_right')) | ||
| 91 | - .objectFit(ImageFit.Auto) | ||
| 92 | - .width('27lpx') | ||
| 93 | - .height('27lpx') | ||
| 94 | - }.height('69lpx') | ||
| 95 | - .width('659lpx') | ||
| 96 | - .alignItems(VerticalAlign.Center) | ||
| 97 | - .justifyContent(FlexAlign.Center) | ||
| 98 | - .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 99 | - .margin({top:'31lpx',bottom:'4lpx'}) | ||
| 100 | - .onClick(()=>{ | ||
| 101 | - let params = {'index': "1"} as Record<string, string> | ||
| 102 | - WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) | ||
| 103 | - }) | ||
| 104 | - if(this.isGetRequest == true){ | ||
| 105 | - EmptyComponent({emptyType:14}) | ||
| 106 | - .layoutWeight(1) | ||
| 107 | - .width('100%') | ||
| 108 | - .offset({y:"-200lpx"}) | ||
| 109 | - } | ||
| 110 | - }.layoutWeight(1) | ||
| 111 | - .justifyContent(FlexAlign.Start) | ||
| 112 | - }else{ | ||
| 113 | - if(this.isGetRequest == true){ | ||
| 114 | - EmptyComponent({emptyType:11}) | ||
| 115 | - .layoutWeight(1) | ||
| 116 | - .width('100%') | ||
| 117 | - .offset({y:"-200lpx"}) | ||
| 118 | - } | ||
| 119 | - } | ||
| 120 | - }else{ | ||
| 121 | - if(this.style === 1){ | ||
| 122 | - List({ space: 3 }) { | ||
| 123 | - | ||
| 124 | - ListItem() { | ||
| 125 | - Row(){ | ||
| 126 | - Text("关注更多人民号") | ||
| 127 | - .fontWeight('400lpx') | ||
| 128 | - .fontColor($r('app.color.color_222222')) | ||
| 129 | - .lineHeight('38lpx') | ||
| 130 | - .fontSize('27lpx') | ||
| 131 | - .textAlign(TextAlign.Center) | ||
| 132 | - .margin({right:'4lpx'}) | ||
| 133 | - Image($r('app.media.arrow_icon_right')) | ||
| 134 | - .objectFit(ImageFit.Auto) | ||
| 135 | - .width('27lpx') | ||
| 136 | - .height('27lpx') | ||
| 137 | - }.height('69lpx') | ||
| 138 | - .width('659lpx') | ||
| 139 | - .alignItems(VerticalAlign.Center) | ||
| 140 | - .justifyContent(FlexAlign.Center) | ||
| 141 | - .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 142 | - .margin({top:'31lpx',bottom:'4lpx'}) | ||
| 143 | - }.onClick(()=>{ | ||
| 144 | - let params = {'index': "1"} as Record<string, string> | ||
| 145 | - WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) | ||
| 146 | - }) | ||
| 147 | - | ||
| 148 | - LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { | ||
| 149 | - ListItem() { | ||
| 150 | - FollowChildComponent({data: item,type:2}) | ||
| 151 | - } | ||
| 152 | - .onClick(() => { | ||
| 153 | - }) | ||
| 154 | - }, (item: FollowListDetailItem, index: number) => index.toString()) | ||
| 155 | - | ||
| 156 | - //没有更多数据 显示提示 | ||
| 157 | - if(!this.hasMore){ | ||
| 158 | - ListItem(){ | ||
| 159 | - ListHasNoMoreDataUI() | ||
| 160 | - } | ||
| 161 | - } | ||
| 162 | - }.cachedCount(15) | ||
| 163 | - .padding({left:'31lpx',right:'31lpx'}) | ||
| 164 | - .layoutWeight(1) | ||
| 165 | - .scrollBar(BarState.Off) | ||
| 166 | - .edgeEffect(EdgeEffect.None) | ||
| 167 | - .nestedScroll({ | ||
| 168 | - scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 169 | - scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 170 | - }) | ||
| 171 | - .onReachEnd(()=>{ | ||
| 172 | - console.log(TAG,"触底了"); | ||
| 173 | - if(!this.isLoading){ | ||
| 174 | - this.isLoading = true | ||
| 175 | - //加载分页数据 | ||
| 176 | - this.getNewPageData() | ||
| 177 | - } | ||
| 178 | - }) | ||
| 179 | - }else if(this.style === 0){ | ||
| 180 | - List({ space: 3 }) { | ||
| 181 | - LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => { | ||
| 182 | - ListItem() { | ||
| 183 | - ChildCommentComponent({data: item,levelHead:UserDataLocal.getUserLevelHeaderUrl(),isLastItem:index===this.data_comment.totalCount()-1}) | ||
| 184 | - } | ||
| 185 | - .onClick(() => { | ||
| 186 | - }) | ||
| 187 | - }, (item: CommentListItem, index: number) => index.toString()) | ||
| 188 | - | ||
| 189 | - //没有更多数据 显示提示 | ||
| 190 | - if(!this.hasMore){ | ||
| 191 | - ListItem(){ | ||
| 192 | - ListHasNoMoreDataUI() | ||
| 193 | - } | ||
| 194 | - } | ||
| 195 | - }.cachedCount(15) | ||
| 196 | - .layoutWeight(1) | ||
| 197 | - .scrollBar(BarState.Off) | ||
| 198 | - .edgeEffect(EdgeEffect.None) | ||
| 199 | - .nestedScroll({ | ||
| 200 | - scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 201 | - scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 202 | - }) | ||
| 203 | - .onReachEnd(()=>{ | ||
| 204 | - console.log(TAG,"触底了"); | ||
| 205 | - if(!this.isLoading){ | ||
| 206 | - this.isLoading = true | ||
| 207 | - //加载分页数据 | ||
| 208 | - this.getNewPageData() | ||
| 209 | - } | ||
| 210 | - }) | ||
| 211 | - } | ||
| 212 | - } | ||
| 213 | - }.layoutWeight(1) | ||
| 214 | - .justifyContent(FlexAlign.Start) | ||
| 215 | - .width('100%') | ||
| 216 | - } | ||
| 217 | - | ||
| 218 | - | ||
| 219 | - @Styles | ||
| 220 | - listStyle() { | ||
| 221 | - .backgroundColor(Color.White) | ||
| 222 | - .height(72) | ||
| 223 | - .width("100%") | ||
| 224 | - .borderRadius(12) | ||
| 225 | - } | ||
| 226 | - | ||
| 227 | - | ||
| 228 | - getMyFollowListDetail(){ | ||
| 229 | - if(this.hasMore){ | ||
| 230 | - let object = new FollowListDetailRequestItem(-1,20,this.curPageNum) | ||
| 231 | - | ||
| 232 | - MinePageDatasModel.getMineFollowListData(object,getContext(this)).then((value)=>{ | ||
| 233 | - if (!this.data_follow || value.list.length == 0){ | ||
| 234 | - this.hasMore = false | ||
| 235 | - }else{ | ||
| 236 | - value.list.forEach((value)=>{ | ||
| 237 | - let fansNum:number = value.fansNum | ||
| 238 | - let fansNumString = "" | ||
| 239 | - if (fansNum > 10000) { | ||
| 240 | - let temp = (fansNum / 10000) + "" | ||
| 241 | - let index = temp.indexOf('.') | ||
| 242 | - if (index != -1) { | ||
| 243 | - temp = temp.substring(0, index + 2) | ||
| 244 | - } else { | ||
| 245 | - temp = temp | ||
| 246 | - } | ||
| 247 | - fansNumString = temp + "万" | ||
| 248 | - } else { | ||
| 249 | - fansNumString = fansNum + "" | ||
| 250 | - } | ||
| 251 | - this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,fansNumString,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId,value.mainControl,value.banControl,value.authIcon)) | ||
| 252 | - }) | ||
| 253 | - this.data_follow.notifyDataReload() | ||
| 254 | - this.count = this.data_follow.totalCount() | ||
| 255 | - if (this.data_follow.totalCount() < value.totalCount) { | ||
| 256 | - this.curPageNum++ | ||
| 257 | - }else { | ||
| 258 | - this.hasMore = false | ||
| 259 | - } | ||
| 260 | - } | ||
| 261 | - this.isLoading = false | ||
| 262 | - this.isGetRequest = true | ||
| 263 | - }).catch((err:Error)=>{ | ||
| 264 | - console.log(TAG,"请求失败") | ||
| 265 | - this.isLoading = false | ||
| 266 | - this.isGetRequest = true | ||
| 267 | - }) | ||
| 268 | - }else{ | ||
| 269 | - this.isLoading = false | ||
| 270 | - this.isGetRequest = true | ||
| 271 | - } | ||
| 272 | - } | ||
| 273 | - | ||
| 274 | - getNewPageData(){ | ||
| 275 | - this.isLoading = true | ||
| 276 | - //我的关注列表 | ||
| 277 | - if (this.style === 1){ | ||
| 278 | - this.getMyFollowListDetail() | ||
| 279 | - }else if(this.style === 0){ | ||
| 280 | - if(this.hasMore){ | ||
| 281 | - let time = encodeURI(DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) | ||
| 282 | - let object = new FollowListDetailRequestItem(-1,20,this.curPageNum) | ||
| 283 | - | ||
| 284 | - MinePageDatasModel.getMineCommentListData(time,object,getContext(this)).then((value)=>{ | ||
| 285 | - if (!this.data_comment || value.list.length == 0){ | ||
| 286 | - this.hasMore = false | ||
| 287 | - this.isLoading = false | ||
| 288 | - this.isGetRequest = true | ||
| 289 | - }else{ | ||
| 290 | - this.getCommentListStatus(value) | ||
| 291 | - } | ||
| 292 | - }).catch((err:Error)=>{ | ||
| 293 | - console.log(TAG,"请求失败") | ||
| 294 | - this.isLoading = false | ||
| 295 | - this.isGetRequest = true | ||
| 296 | - }) | ||
| 297 | - }else{ | ||
| 298 | - this.isLoading = false | ||
| 299 | - this.isGetRequest = true | ||
| 300 | - } | ||
| 301 | - } | ||
| 302 | - } | ||
| 303 | - | ||
| 304 | - getCommentListStatus(value:MineCommentListDetailItem){ | ||
| 305 | - | ||
| 306 | - let status = new OtherUserCommentLikeStatusRequestItem() | ||
| 307 | - let data : CommentListItem[] = [] | ||
| 308 | - value.list.forEach((item)=>{ | ||
| 309 | - if(item.checkStatus === 2){ | ||
| 310 | - status.commentIdList.push(item.id) | ||
| 311 | - } | ||
| 312 | - let commentContent = item.commentContent | ||
| 313 | - if(item.sensitiveShow === 0 && item.sensitiveExist === 1){ | ||
| 314 | - commentContent = item.commentContentSensitive | ||
| 315 | - } | ||
| 316 | - let parentCommentContent = "" | ||
| 317 | - if(item.parentCommentVo!=null ){ | ||
| 318 | - parentCommentContent = item.parentCommentVo.commentContent | ||
| 319 | - } | ||
| 320 | - let parentCommentUserName = "" | ||
| 321 | - if(item.parentCommentVo!=null ){ | ||
| 322 | - parentCommentUserName = item.parentCommentVo.fromUserName | ||
| 323 | - } | ||
| 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)) | ||
| 325 | - }) | ||
| 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 | - | ||
| 348 | - MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{ | ||
| 349 | - newValue.forEach((item)=>{ | ||
| 350 | - data.forEach((list)=>{ | ||
| 351 | - if (item.commentId == list.id) { | ||
| 352 | - list.like_status = item.status | ||
| 353 | - } | ||
| 354 | - }) | ||
| 355 | - }) | ||
| 356 | - | ||
| 357 | - data.forEach((item)=>{ | ||
| 358 | - let publishTime = DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(item.createTime,DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) | ||
| 359 | - 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)) | ||
| 360 | - }) | ||
| 361 | - | ||
| 362 | - this.data_comment.notifyDataReload() | ||
| 363 | - | ||
| 364 | - this.count = this.data_comment.totalCount() | ||
| 365 | - this.commentNum = value.totalCount | ||
| 366 | - if (this.data_comment.totalCount() < value.totalCount) { | ||
| 367 | - this.curPageNum++ | ||
| 368 | - }else { | ||
| 369 | - this.hasMore = false | ||
| 370 | - } | ||
| 371 | - | ||
| 372 | - this.isLoading = false | ||
| 373 | - this.isGetRequest = true | ||
| 374 | - }).catch((err:Error)=>{ | ||
| 375 | - console.log(TAG,"请求失败") | ||
| 376 | - this.isLoading = false | ||
| 377 | - this.isGetRequest = true | ||
| 378 | - }) | ||
| 379 | - } | ||
| 380 | - | ||
| 381 | -} |
| 1 | +import { LazyDataSource, SPHelper, UserDataLocal } from 'wdKit'; | ||
| 2 | +import { WDRouterPage, WDRouterRule } from 'wdRouter'; | ||
| 3 | +import MinePageDatasModel from '../../../model/MinePageDatasModel'; | ||
| 4 | +import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; | ||
| 5 | +import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem'; | ||
| 6 | +import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | ||
| 7 | +import { FollowChildComponent } from '../follow/FollowChildComponent'; | ||
| 8 | +import dataPreferences from '@ohos.data.preferences'; | ||
| 9 | +import { EmptyComponent } from '../../view/EmptyComponent'; | ||
| 10 | + | ||
| 11 | +const TAG = "HomePageBottomFollowComponent" | ||
| 12 | +/** | ||
| 13 | + * 我的主页 关注 tab | ||
| 14 | + */ | ||
| 15 | +@Component | ||
| 16 | +export struct HomePageBottomFollowComponent { | ||
| 17 | + @State data_follow: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); | ||
| 18 | + @State isLoading: boolean = false | ||
| 19 | + @State hasMore: boolean = true | ||
| 20 | + curPageNum: number = 1; | ||
| 21 | + @State count: number = 0; | ||
| 22 | + preferences: dataPreferences.Preferences | null = null; | ||
| 23 | + @State isGetRequest: boolean = false | ||
| 24 | + observer = (key: string) => { | ||
| 25 | + if (key == UserDataLocal.USER_FOLLOW_OPERATION) { | ||
| 26 | + let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION, "") as string | ||
| 27 | + let arr = value.split(',') | ||
| 28 | + if (arr[1] == "0") { | ||
| 29 | + this.data_follow.getDataArray().forEach((element, index) => { | ||
| 30 | + if (element.creatorId === arr[0]) { | ||
| 31 | + this.data_follow.deleteItem(index) | ||
| 32 | + this.count = this.data_follow.size() | ||
| 33 | + } | ||
| 34 | + }); | ||
| 35 | + } else { | ||
| 36 | + if (!this.isLoading) { | ||
| 37 | + this.isLoading = true | ||
| 38 | + this.hasMore = true | ||
| 39 | + this.curPageNum = 1 | ||
| 40 | + this.data_follow.clear() | ||
| 41 | + this.data_follow.notifyDataReload() | ||
| 42 | + this.getMyFollowListDetail() | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + aboutToAppear() { | ||
| 49 | + this.getNewPageData() | ||
| 50 | + this.addFollowStatusObserver() | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + async addFollowStatusObserver() { | ||
| 54 | + this.preferences = await SPHelper.default.getPreferences(); | ||
| 55 | + this.preferences.on('change', this.observer); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + aboutToDisappear(): void { | ||
| 59 | + if (this.preferences) { | ||
| 60 | + this.preferences.off('change', this.observer); | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + build() { | ||
| 65 | + | ||
| 66 | + Column() { | ||
| 67 | + if (this.isGetRequest == true) { | ||
| 68 | + Divider().width('100%') | ||
| 69 | + .height('2lpx') | ||
| 70 | + .strokeWidth('1lpx') | ||
| 71 | + .backgroundColor($r('app.color.color_EDEDED')) | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + if (this.count === 0) { | ||
| 75 | + Stack({ alignContent: Alignment.Top }) { | ||
| 76 | + if (this.isGetRequest == true) { | ||
| 77 | + EmptyComponent({ emptyType: 14 }) | ||
| 78 | + .layoutWeight(1) | ||
| 79 | + .width('100%') | ||
| 80 | + .offset({ y: "-200lpx" }) | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + Row() { | ||
| 84 | + Text("关注更多人民号") | ||
| 85 | + .fontWeight('400lpx') | ||
| 86 | + .fontColor($r('app.color.color_222222')) | ||
| 87 | + .lineHeight('38lpx') | ||
| 88 | + .fontSize('27lpx') | ||
| 89 | + .textAlign(TextAlign.Center) | ||
| 90 | + .margin({ right: '4lpx' }) | ||
| 91 | + Image($r('app.media.arrow_icon_right')) | ||
| 92 | + .objectFit(ImageFit.Auto) | ||
| 93 | + .width('27lpx') | ||
| 94 | + .height('27lpx') | ||
| 95 | + } | ||
| 96 | + .height('69lpx') | ||
| 97 | + .width('659lpx') | ||
| 98 | + .alignItems(VerticalAlign.Center) | ||
| 99 | + .justifyContent(FlexAlign.Center) | ||
| 100 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 101 | + .margin({ top: '31lpx', bottom: '4lpx' }) | ||
| 102 | + .onClick(() => { | ||
| 103 | + let params = { 'index': "1" } as Record<string, string> | ||
| 104 | + WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params) | ||
| 105 | + }) | ||
| 106 | + }.layoutWeight(1) | ||
| 107 | + } else { | ||
| 108 | + List({ space: 3 }) { | ||
| 109 | + | ||
| 110 | + ListItem() { | ||
| 111 | + Row() { | ||
| 112 | + Text("关注更多人民号") | ||
| 113 | + .fontWeight('400lpx') | ||
| 114 | + .fontColor($r('app.color.color_222222')) | ||
| 115 | + .lineHeight('38lpx') | ||
| 116 | + .fontSize('27lpx') | ||
| 117 | + .textAlign(TextAlign.Center) | ||
| 118 | + .margin({ right: '4lpx' }) | ||
| 119 | + Image($r('app.media.arrow_icon_right')) | ||
| 120 | + .objectFit(ImageFit.Auto) | ||
| 121 | + .width('27lpx') | ||
| 122 | + .height('27lpx') | ||
| 123 | + } | ||
| 124 | + .height('69lpx') | ||
| 125 | + .width('659lpx') | ||
| 126 | + .alignItems(VerticalAlign.Center) | ||
| 127 | + .justifyContent(FlexAlign.Center) | ||
| 128 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 129 | + .margin({ top: '31lpx', bottom: '4lpx' }) | ||
| 130 | + }.onClick(() => { | ||
| 131 | + let params = { 'index': "1" } as Record<string, string> | ||
| 132 | + WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params) | ||
| 133 | + }) | ||
| 134 | + | ||
| 135 | + LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { | ||
| 136 | + ListItem() { | ||
| 137 | + FollowChildComponent({ data: item, type: 2 }) | ||
| 138 | + } | ||
| 139 | + }, (item: FollowListDetailItem, index: number) => index.toString()) | ||
| 140 | + | ||
| 141 | + //没有更多数据 显示提示 | ||
| 142 | + if (!this.hasMore) { | ||
| 143 | + ListItem() { | ||
| 144 | + ListHasNoMoreDataUI() | ||
| 145 | + } | ||
| 146 | + } | ||
| 147 | + } | ||
| 148 | + .cachedCount(15) | ||
| 149 | + .padding({ left: '31lpx', right: '31lpx' }) | ||
| 150 | + .layoutWeight(1) | ||
| 151 | + .scrollBar(BarState.Off) | ||
| 152 | + .edgeEffect(EdgeEffect.None) | ||
| 153 | + .nestedScroll({ | ||
| 154 | + scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 155 | + scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 156 | + }) | ||
| 157 | + .onReachEnd(() => { | ||
| 158 | + console.log(TAG, "触底了"); | ||
| 159 | + if (!this.isLoading) { | ||
| 160 | + this.isLoading = true | ||
| 161 | + //加载分页数据 | ||
| 162 | + this.getNewPageData() | ||
| 163 | + } | ||
| 164 | + }) | ||
| 165 | + } | ||
| 166 | + }.layoutWeight(1) | ||
| 167 | + .justifyContent(FlexAlign.Start) | ||
| 168 | + .width('100%') | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + @Styles | ||
| 172 | + listStyle() { | ||
| 173 | + .backgroundColor(Color.White) | ||
| 174 | + .height(72) | ||
| 175 | + .width("100%") | ||
| 176 | + .borderRadius(12) | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + getMyFollowListDetail() { | ||
| 180 | + if (this.hasMore) { | ||
| 181 | + let object = new FollowListDetailRequestItem(-1, 20, this.curPageNum) | ||
| 182 | + | ||
| 183 | + MinePageDatasModel.getMineFollowListData(object, getContext(this)).then((value) => { | ||
| 184 | + if (!this.data_follow || value.list.length == 0) { | ||
| 185 | + this.hasMore = false | ||
| 186 | + } else { | ||
| 187 | + value.list.forEach((value) => { | ||
| 188 | + let fansNum: number = value.fansNum | ||
| 189 | + let fansNumString = "" | ||
| 190 | + if (fansNum > 10000) { | ||
| 191 | + let temp = (fansNum / 10000) + "" | ||
| 192 | + let index = temp.indexOf('.') | ||
| 193 | + if (index != -1) { | ||
| 194 | + temp = temp.substring(0, index + 2) | ||
| 195 | + } else { | ||
| 196 | + temp = temp | ||
| 197 | + } | ||
| 198 | + fansNumString = temp + "万" | ||
| 199 | + } else { | ||
| 200 | + fansNumString = fansNum + "" | ||
| 201 | + } | ||
| 202 | + this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl, value.attentionUserName, | ||
| 203 | + fansNumString, value.introduction, value.attentionCreatorId, "1", value.attentionUserId, | ||
| 204 | + value.attentionUserType, value.attentionUserId, value.mainControl, value.banControl, value.authIcon)) | ||
| 205 | + }) | ||
| 206 | + this.data_follow.notifyDataReload() | ||
| 207 | + this.count = this.data_follow.totalCount() | ||
| 208 | + if (this.data_follow.totalCount() < value.totalCount) { | ||
| 209 | + this.curPageNum++ | ||
| 210 | + } else { | ||
| 211 | + this.hasMore = false | ||
| 212 | + } | ||
| 213 | + } | ||
| 214 | + this.isLoading = false | ||
| 215 | + this.isGetRequest = true | ||
| 216 | + }).catch((err: Error) => { | ||
| 217 | + console.log(TAG, "请求失败") | ||
| 218 | + this.isLoading = false | ||
| 219 | + this.isGetRequest = true | ||
| 220 | + }) | ||
| 221 | + } else { | ||
| 222 | + this.isLoading = false | ||
| 223 | + this.isGetRequest = true | ||
| 224 | + } | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + getNewPageData() { | ||
| 228 | + this.isLoading = true | ||
| 229 | + //我的关注列表 | ||
| 230 | + this.getMyFollowListDetail() | ||
| 231 | + } | ||
| 232 | +} |
| @@ -9,7 +9,9 @@ import { ChildCommentComponent } from './ChildCommentComponent'; | @@ -9,7 +9,9 @@ import { ChildCommentComponent } from './ChildCommentComponent'; | ||
| 9 | import { EmptyComponent } from '../../view/EmptyComponent'; | 9 | import { EmptyComponent } from '../../view/EmptyComponent'; |
| 10 | 10 | ||
| 11 | const TAG = "HomePageBottomComponent" | 11 | const TAG = "HomePageBottomComponent" |
| 12 | - | 12 | +/** |
| 13 | + * 普通用户的主页 评论 tab | ||
| 14 | + */ | ||
| 13 | @Component | 15 | @Component |
| 14 | export struct OtherHomePageBottomCommentComponent { | 16 | export struct OtherHomePageBottomCommentComponent { |
| 15 | @Prop curUserId: string | 17 | @Prop curUserId: string |
| @@ -9,6 +9,10 @@ import { EmptyComponent } from '../../view/EmptyComponent'; | @@ -9,6 +9,10 @@ import { EmptyComponent } from '../../view/EmptyComponent'; | ||
| 9 | import { FollowChildComponent } from '../follow/FollowChildComponent'; | 9 | import { FollowChildComponent } from '../follow/FollowChildComponent'; |
| 10 | 10 | ||
| 11 | const TAG = "HomePageBottomComponent" | 11 | const TAG = "HomePageBottomComponent" |
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 普通用户的主页 关注 tab | ||
| 15 | + */ | ||
| 12 | @Component | 16 | @Component |
| 13 | export struct OtherHomePageBottomFollowComponent{ | 17 | export struct OtherHomePageBottomFollowComponent{ |
| 14 | @State data_follow: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); | 18 | @State data_follow: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); |
| @@ -7,6 +7,7 @@ import { CompUtils } from '../../utils/CompUtils'; | @@ -7,6 +7,7 @@ import { CompUtils } from '../../utils/CompUtils'; | ||
| 7 | import PageViewModel from '../../viewmodel/PageViewModel'; | 7 | import PageViewModel from '../../viewmodel/PageViewModel'; |
| 8 | import HomeChannelUtils, { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; | 8 | import HomeChannelUtils, { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; |
| 9 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | 9 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; |
| 10 | +import { VideoChannelPage } from './VideoChannelPage'; | ||
| 10 | 11 | ||
| 11 | const TAG = 'BottomNavigationComponent'; | 12 | const TAG = 'BottomNavigationComponent'; |
| 12 | let storage = LocalStorage.getShared(); | 13 | let storage = LocalStorage.getShared(); |
| @@ -29,6 +30,7 @@ export struct BottomNavigationComponent { | @@ -29,6 +30,7 @@ export struct BottomNavigationComponent { | ||
| 29 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 30 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 30 | @State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = [] // 底导/顶导全部数据 | 31 | @State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = [] // 底导/顶导全部数据 |
| 31 | @State currentNavIndex: number = BottomNavi.NEWS; // 底导当前选中/焦点下标 | 32 | @State currentNavIndex: number = BottomNavi.NEWS; // 底导当前选中/焦点下标 |
| 33 | + @State topNavList: TopNavDTO[] = [] | ||
| 32 | // 底导TabsController | 34 | // 底导TabsController |
| 33 | private navController: TabsController = new TabsController(); | 35 | private navController: TabsController = new TabsController(); |
| 34 | readonly ASPECT_RATIO_1_1: number = 1 / 1; // 底导图片宽高比 | 36 | readonly ASPECT_RATIO_1_1: number = 1 / 1; // 底导图片宽高比 |
| @@ -54,6 +56,7 @@ export struct BottomNavigationComponent { | @@ -54,6 +56,7 @@ export struct BottomNavigationComponent { | ||
| 54 | bottomNav.bottomNavList = bottomNav.bottomNavList.filter(item => item.name !== '服务'); | 56 | bottomNav.bottomNavList = bottomNav.bottomNavList.filter(item => item.name !== '服务'); |
| 55 | this.bottomNavList = bottomNav.bottomNavList | 57 | this.bottomNavList = bottomNav.bottomNavList |
| 56 | } | 58 | } |
| 59 | + this.getTopNavList(this.bottomNavList[0]?.id) | ||
| 57 | HomeChannelUtils.setBottomNavData(bottomNav) | 60 | HomeChannelUtils.setBottomNavData(bottomNav) |
| 58 | 61 | ||
| 59 | EmitterUtils.receiveEvent(EmitterEventId.JUMP_HOME_CHANNEL, (str?: string) => { | 62 | EmitterUtils.receiveEvent(EmitterEventId.JUMP_HOME_CHANNEL, (str?: string) => { |
| @@ -74,35 +77,41 @@ export struct BottomNavigationComponent { | @@ -74,35 +77,41 @@ export struct BottomNavigationComponent { | ||
| 74 | Tabs({ barPosition: BarPosition.End, index: this.currentNavIndex, controller: this.navController }) { | 77 | Tabs({ barPosition: BarPosition.End, index: this.currentNavIndex, controller: this.navController }) { |
| 75 | ForEach(this.bottomNavList, (navItem: BottomNavDTO, index: number) => { | 78 | ForEach(this.bottomNavList, (navItem: BottomNavDTO, index: number) => { |
| 76 | TabContent() { | 79 | TabContent() { |
| 77 | - Column() { | ||
| 78 | - if (CompUtils.isMine(navItem)) { | ||
| 79 | - // 我的页面组件数据列表 | ||
| 80 | - MinePageComponent() | ||
| 81 | - } else { | ||
| 82 | - TopNavigationComponent({ | ||
| 83 | - groupId: navItem.id, | ||
| 84 | - topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), | ||
| 85 | - _currentNavIndex: $currentNavIndex, | ||
| 86 | - navIndex: index, | ||
| 87 | - currentBottomNavName: navItem.name, | ||
| 88 | - assignChannel: this.assignChannel, | ||
| 89 | - autoRefresh: this.autoRefresh | ||
| 90 | - }) | ||
| 91 | - } | ||
| 92 | - | 80 | + if (CompUtils.isMine(navItem)) { |
| 81 | + // 我的页面组件数据列表 | ||
| 82 | + MinePageComponent() | ||
| 83 | + } else if (navItem.name === '视频') { | ||
| 84 | + // 视频频道,包含视频和直播 | ||
| 85 | + VideoChannelPage({ | ||
| 86 | + topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), | ||
| 87 | + _currentNavIndex: $currentNavIndex, | ||
| 88 | + }) | ||
| 89 | + } else { | ||
| 90 | + TopNavigationComponent({ | ||
| 91 | + groupId: navItem.id, | ||
| 92 | + topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), | ||
| 93 | + _currentNavIndex: $currentNavIndex, | ||
| 94 | + navIndex: index, | ||
| 95 | + currentBottomNavName: navItem.name, | ||
| 96 | + assignChannel: this.assignChannel, | ||
| 97 | + autoRefresh: this.autoRefresh | ||
| 98 | + }) | ||
| 93 | } | 99 | } |
| 94 | } | 100 | } |
| 95 | .tabBar(this.tabBarBuilder(navItem, index)) | 101 | .tabBar(this.tabBarBuilder(navItem, index)) |
| 102 | + | ||
| 103 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) | ||
| 96 | }); | 104 | }); |
| 97 | 105 | ||
| 98 | } | 106 | } |
| 107 | + .scrollable(false) | ||
| 99 | .animationDuration(0) | 108 | .animationDuration(0) |
| 100 | .barHeight($r('app.float.bottom_navigation_barHeight')) | 109 | .barHeight($r('app.float.bottom_navigation_barHeight')) |
| 101 | .barMode(BarMode.Fixed) | 110 | .barMode(BarMode.Fixed) |
| 102 | .barBackgroundColor(this.barBackgroundColor) | 111 | .barBackgroundColor(this.barBackgroundColor) |
| 103 | // 备注:鸿蒙目前只有修改三线导航背景方法,对于全面屏导航条手机需要设置背景色并使其扩散到导航区域 | 112 | // 备注:鸿蒙目前只有修改三线导航背景方法,对于全面屏导航条手机需要设置背景色并使其扩散到导航区域 |
| 104 | .backgroundColor(this.barBackgroundColor) | 113 | .backgroundColor(this.barBackgroundColor) |
| 105 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | 114 | + .expandSafeArea([SafeAreaType.SYSTEM]) |
| 106 | 115 | ||
| 107 | // .padding({ bottom: this.bottomRectHeight + 'px', top: this.topRectHeight + 'px' }) // 此处margin具体数值在实际中应与导航条区域高度保持一致 | 116 | // .padding({ bottom: this.bottomRectHeight + 'px', top: this.topRectHeight + 'px' }) // 此处margin具体数值在实际中应与导航条区域高度保持一致 |
| 108 | 117 | ||
| @@ -113,7 +122,12 @@ export struct BottomNavigationComponent { | @@ -113,7 +122,12 @@ export struct BottomNavigationComponent { | ||
| 113 | Stack({ alignContent: Alignment.Bottom }) { | 122 | Stack({ alignContent: Alignment.Bottom }) { |
| 114 | Image(this.currentNavIndex === index ? navItem.iconC : navItem.icon) | 123 | Image(this.currentNavIndex === index ? navItem.iconC : navItem.icon) |
| 115 | .height(CommonConstants.FULL_PARENT) | 124 | .height(CommonConstants.FULL_PARENT) |
| 116 | - .padding({ bottom: 15, left: 10, right: 10, top: 2 }) | 125 | + .padding({ |
| 126 | + bottom: 15, | ||
| 127 | + left: 10, | ||
| 128 | + right: 10, | ||
| 129 | + top: 2 | ||
| 130 | + }) | ||
| 117 | .aspectRatio(this.ASPECT_RATIO_1_1) | 131 | .aspectRatio(this.ASPECT_RATIO_1_1) |
| 118 | 132 | ||
| 119 | Text(navItem.name) | 133 | Text(navItem.name) |
| @@ -127,35 +141,40 @@ export struct BottomNavigationComponent { | @@ -127,35 +141,40 @@ export struct BottomNavigationComponent { | ||
| 127 | .height($r('app.float.bottom_navigation_barHeight')) | 141 | .height($r('app.float.bottom_navigation_barHeight')) |
| 128 | .hoverEffect(HoverEffect.Highlight) | 142 | .hoverEffect(HoverEffect.Highlight) |
| 129 | .onClick(() => { | 143 | .onClick(() => { |
| 130 | - if (navItem.name === '我的') { | ||
| 131 | - this.barBackgroundColor = Color.White | ||
| 132 | - this.currentBottomNavInfo = {} as BottomNavDTO | ||
| 133 | - } else { | ||
| 134 | - if (this.currentNavIndex === index) { | ||
| 135 | - // 当前tab,单击事件 | ||
| 136 | - this.autoRefresh++ | ||
| 137 | - } else { | ||
| 138 | - // 切换tab | ||
| 139 | - this.currentBottomNavInfo = navItem | ||
| 140 | - } | ||
| 141 | - } | ||
| 142 | - | ||
| 143 | - this.currentNavIndex = index; | ||
| 144 | Logger.info(TAG, `onChange, index: ${index}`); | 144 | Logger.info(TAG, `onChange, index: ${index}`); |
| 145 | - | 145 | + this.onBottomNavigationIndexChange(navItem, index) |
| 146 | }) | 146 | }) |
| 147 | 147 | ||
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | // 底导切换函数 | 150 | // 底导切换函数 |
| 151 | - onBottomNavigationIndexChange() { | 151 | + async onBottomNavigationIndexChange(navItem: BottomNavDTO, index: number) { |
| 152 | Logger.info(TAG, `onBottomNavigationIndexChange this.currentNavIndex: ${this.currentNavIndex}`); | 152 | Logger.info(TAG, `onBottomNavigationIndexChange this.currentNavIndex: ${this.currentNavIndex}`); |
| 153 | + if (navItem.name === '我的') { | ||
| 154 | + this.barBackgroundColor = Color.White | ||
| 155 | + this.currentBottomNavInfo = {} as BottomNavDTO | ||
| 156 | + } else { | ||
| 157 | + if (this.currentNavIndex === index) { | ||
| 158 | + // 当前tab,单击事件 | ||
| 159 | + this.autoRefresh++ | ||
| 160 | + } else { | ||
| 161 | + // 切换tab | ||
| 162 | + this.currentBottomNavInfo = navItem | ||
| 163 | + } | ||
| 164 | + } | ||
| 165 | + this.currentNavIndex = index; | ||
| 166 | + | ||
| 153 | // 请求顶导数据(参数): | 167 | // 请求顶导数据(参数): |
| 154 | } | 168 | } |
| 155 | 169 | ||
| 170 | + //请求顶导数据 | ||
| 171 | + async getTopNavList(id: number) { | ||
| 172 | + let bottomNavDetail = await PageViewModel.getBottomNavDetailData(id) | ||
| 173 | + this.topNavList = bottomNavDetail?.topNavChannelList || [] | ||
| 174 | + } | ||
| 175 | + | ||
| 156 | onBottomNavigationDataUpdated() { | 176 | onBottomNavigationDataUpdated() { |
| 157 | // Logger.info(TAG, `onBottomNavigationDataUpdated currentNavIndex: ${this.currentNavIndex},length:${this.bottomNavItemList.length}`); | 177 | // Logger.info(TAG, `onBottomNavigationDataUpdated currentNavIndex: ${this.currentNavIndex},length:${this.bottomNavItemList.length}`); |
| 158 | - this.onBottomNavigationIndexChange() | ||
| 159 | } | 178 | } |
| 160 | 179 | ||
| 161 | /** | 180 | /** |
-
Please register or login to post a comment