Merge remote-tracking branch 'origin/main'
# Conflicts: # sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets # sight_harmony/features/wdBean/Index.ets
Showing
85 changed files
with
1785 additions
and
1033 deletions
Too many changes to show.
To preserve performance only 85 of 85+ 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 | +} |
| 1 | @CustomDialog | 1 | @CustomDialog |
| 2 | export struct CustomToast { | 2 | export struct CustomToast { |
| 3 | - public static LENGTH_LONG = 5000; | ||
| 4 | - public static LENGTH_SHORT = 3000; | 3 | + public static LENGTH_LONG = 4000; |
| 4 | + public static LENGTH_SHORT = 2000; | ||
| 5 | 5 | ||
| 6 | @State msg: string = "" | 6 | @State msg: string = "" |
| 7 | @State duration: number = CustomToast.LENGTH_SHORT | 7 | @State duration: number = CustomToast.LENGTH_SHORT |
| @@ -29,7 +29,9 @@ export struct CustomToast { | @@ -29,7 +29,9 @@ export struct CustomToast { | ||
| 29 | .fontColor($r('app.color.white')) | 29 | .fontColor($r('app.color.white')) |
| 30 | .fontSize("27lpx") | 30 | .fontSize("27lpx") |
| 31 | .lineHeight("38lpx") | 31 | .lineHeight("38lpx") |
| 32 | + .textAlign(TextAlign.Center) | ||
| 32 | }.borderRadius(`${this.bgBorderRadius}lpx`) | 33 | }.borderRadius(`${this.bgBorderRadius}lpx`) |
| 34 | + .constraintSize({maxWidth:"86%"}) | ||
| 33 | .padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"}) | 35 | .padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"}) |
| 34 | .backgroundColor($r("app.color.black")) | 36 | .backgroundColor($r("app.color.black")) |
| 35 | .opacity(0.7) | 37 | .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 |
| @@ -26,6 +26,9 @@ export enum EmitterEventId { | @@ -26,6 +26,9 @@ export enum EmitterEventId { | ||
| 26 | // 换绑成功 | 26 | // 换绑成功 |
| 27 | PHONE_CHANGE_SUCCESS = 9, | 27 | PHONE_CHANGE_SUCCESS = 9, |
| 28 | 28 | ||
| 29 | + // 直播间-取消-预约成功 | ||
| 30 | + LIVE_ROOM_SUBSCRIBE = 10, | ||
| 31 | + | ||
| 29 | // App回到前台 | 32 | // App回到前台 |
| 30 | APP_ENTER_FOREGROUD = 100, | 33 | APP_ENTER_FOREGROUD = 100, |
| 31 | // App进入后台 | 34 | // App进入后台 |
| @@ -213,7 +213,7 @@ export class HttpUrlUtils { | @@ -213,7 +213,7 @@ export class HttpUrlUtils { | ||
| 213 | /** | 213 | /** |
| 214 | * 预约状态 | 214 | * 预约状态 |
| 215 | */ | 215 | */ |
| 216 | - static readonly LIVE_APPOINTMENT_BATCH_PATH: string = "api/live-center-message/zh/c/live/subscribe/user/batch"; | 216 | + static readonly LIVE_APPOINTMENT_BATCH_PATH: string = "/api/live-center-message/zh/c/live/subscribe/user/batch"; |
| 217 | /** | 217 | /** |
| 218 | 218 | ||
| 219 | * 搜索结果 显示tab 数 | 219 | * 搜索结果 显示tab 数 |
| @@ -298,6 +298,10 @@ export class HttpUrlUtils { | @@ -298,6 +298,10 @@ export class HttpUrlUtils { | ||
| 298 | 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"; |
| 299 | 299 | ||
| 300 | /** | 300 | /** |
| 301 | + * 查询是否设置过密码checkSetPassword | ||
| 302 | + */ | ||
| 303 | + static readonly CHECK_SET_PASSWORD_PATH: string = "/api/rmrb-user-center/user/zh/c/ifSetPassword"; | ||
| 304 | + /** | ||
| 301 | * 获取oss 配置 | 305 | * 获取oss 配置 |
| 302 | */ | 306 | */ |
| 303 | static readonly OSS_PARAMS_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/oss/configs"; | 307 | static readonly OSS_PARAMS_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/oss/configs"; |
| @@ -704,4 +708,10 @@ export class HttpUrlUtils { | @@ -704,4 +708,10 @@ export class HttpUrlUtils { | ||
| 704 | return url; | 708 | return url; |
| 705 | } | 709 | } |
| 706 | 710 | ||
| 711 | + //查询是否设置过密码 | ||
| 712 | + static checkSetPassword() { | ||
| 713 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.CHECK_SET_PASSWORD_PATH; | ||
| 714 | + return url; | ||
| 715 | + } | ||
| 716 | + | ||
| 707 | } | 717 | } |
| @@ -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 | //我的 关注 |
| @@ -82,6 +83,9 @@ export class WDRouterPage { | @@ -82,6 +83,9 @@ export class WDRouterPage { | ||
| 82 | static browsingHistoryPage = new WDRouterPage("wdComponent", "ets/components/page/BrowsingHistoryPage"); | 83 | static browsingHistoryPage = new WDRouterPage("wdComponent", "ets/components/page/BrowsingHistoryPage"); |
| 83 | //我的收藏 | 84 | //我的收藏 |
| 84 | static myCollectionListPagePage = new WDRouterPage("wdComponent", "ets/components/page/MyCollectionListPage"); | 85 | static myCollectionListPagePage = new WDRouterPage("wdComponent", "ets/components/page/MyCollectionListPage"); |
| 86 | + //互动消息 | ||
| 87 | + static interactMessagePage = new WDRouterPage("wdComponent", "ets/components/page/InteractMessagePage"); | ||
| 88 | + | ||
| 85 | static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview"); | 89 | static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview"); |
| 86 | //我的主页 | 90 | //我的主页 |
| 87 | static mineHomePage = new WDRouterPage("wdComponent", "ets/pages/MineHomePage"); | 91 | static mineHomePage = new WDRouterPage("wdComponent", "ets/pages/MineHomePage"); |
| @@ -113,6 +117,8 @@ export class WDRouterPage { | @@ -113,6 +117,8 @@ export class WDRouterPage { | ||
| 113 | static broadcastPage = new WDRouterPage("phone", "ets/pages/broadcast/BroadcastPage"); | 117 | static broadcastPage = new WDRouterPage("phone", "ets/pages/broadcast/BroadcastPage"); |
| 114 | //搜索主页 | 118 | //搜索主页 |
| 115 | static searchPage = new WDRouterPage("wdComponent", "ets/pages/SearchPage"); | 119 | static searchPage = new WDRouterPage("wdComponent", "ets/pages/SearchPage"); |
| 120 | + //消息主页 | ||
| 121 | + static mineMessagePage = new WDRouterPage("wdComponent", "ets/pages/MineMessagePage"); | ||
| 116 | //搜索人民号主页 | 122 | //搜索人民号主页 |
| 117 | static searchCreatorPage = new WDRouterPage("wdComponent", "ets/pages/SearchCreatorPage"); | 123 | static searchCreatorPage = new WDRouterPage("wdComponent", "ets/pages/SearchCreatorPage"); |
| 118 | //人民号主页 | 124 | //人民号主页 |
| @@ -120,7 +126,7 @@ export class WDRouterPage { | @@ -120,7 +126,7 @@ export class WDRouterPage { | ||
| 120 | //直播更多页 | 126 | //直播更多页 |
| 121 | static liveMorePage = new WDRouterPage("wdComponent", "ets/components/page/LiveMorePage"); | 127 | static liveMorePage = new WDRouterPage("wdComponent", "ets/components/page/LiveMorePage"); |
| 122 | //预约更多页 | 128 | //预约更多页 |
| 123 | - static reserveMorePage = new WDRouterPage("wdComponent", "ets/components/page/ReserveMorePage"); | 129 | + static reserveMorePage = new WDRouterPage("wdComponent", "ets/components/reserveMore/ReserveMorePage"); |
| 124 | //金刚位聚合页 | 130 | //金刚位聚合页 |
| 125 | static themeListPage = new WDRouterPage("wdComponent", "ets/components/page/ThemeListPage"); | 131 | static themeListPage = new WDRouterPage("wdComponent", "ets/components/page/ThemeListPage"); |
| 126 | // 栏目页面、频道详情 | 132 | // 栏目页面、频道详情 |
| @@ -46,7 +46,7 @@ export class ProcessUtils { | @@ -46,7 +46,7 @@ export class ProcessUtils { | ||
| 46 | 46 | ||
| 47 | if ('1' == type) { | 47 | if ('1' == type) { |
| 48 | // 内链 | 48 | // 内链 |
| 49 | - let content: ContentDTO = {} as ContentDTO; | 49 | + let content: ContentDTO = new ContentDTO(); |
| 50 | content.linkUrl = linkUrl; | 50 | content.linkUrl = linkUrl; |
| 51 | ProcessUtils.gotoWeb(content); | 51 | ProcessUtils.gotoWeb(content); |
| 52 | } else if ('2' == type) { | 52 | } else if ('2' == type) { |
| @@ -62,16 +62,13 @@ export class ProcessUtils { | @@ -62,16 +62,13 @@ export class ProcessUtils { | ||
| 62 | * @param advert 展现中心的展现广告 | 62 | * @param advert 展现中心的展现广告 |
| 63 | */ | 63 | */ |
| 64 | static advJumpMainPage(advert: AdvertsBean) { | 64 | static advJumpMainPage(advert: AdvertsBean) { |
| 65 | - | ||
| 66 | - let content: ContentDTO = { | ||
| 67 | - linkUrl: advert.linkUrl, | ||
| 68 | - pageId: advert.pageId, | ||
| 69 | - objectId: advert.objectId, | ||
| 70 | - objectType: advert.objectType.toString(), | ||
| 71 | - relId: advert.relId, | ||
| 72 | - bottomNavId: advert.bottomNavId | ||
| 73 | - } as ContentDTO; | ||
| 74 | - | 65 | + let content: ContentDTO = new ContentDTO() |
| 66 | + content.linkUrl = advert.linkUrl; | ||
| 67 | + content.pageId = advert.pageId; | ||
| 68 | + content.objectId = advert.objectId; | ||
| 69 | + content.objectType = advert.objectType.toString(); | ||
| 70 | + content.relId = advert.relId; | ||
| 71 | + content.bottomNavId = advert.bottomNavId; | ||
| 75 | ProcessUtils.processPage(content); | 72 | ProcessUtils.processPage(content); |
| 76 | } | 73 | } |
| 77 | 74 |
| @@ -21,7 +21,7 @@ class AppInfo { | @@ -21,7 +21,7 @@ class AppInfo { | ||
| 21 | screenTabbarSafeHeight: number = 42 // TODO 这里需要动态获取 | 21 | screenTabbarSafeHeight: number = 42 // TODO 这里需要动态获取 |
| 22 | imei: string = HttpUtils.getImei() | 22 | imei: string = HttpUtils.getImei() |
| 23 | device_id: string = HttpUtils.getDeviceId() | 23 | device_id: string = HttpUtils.getDeviceId() |
| 24 | - fontSizes: string = 'small' | 24 | + // fontSizes: string = 'small' |
| 25 | // TODO 完善 | 25 | // TODO 完善 |
| 26 | } | 26 | } |
| 27 | 27 | ||
| @@ -103,7 +103,7 @@ function getAppPublicInfo(): string { | @@ -103,7 +103,7 @@ function getAppPublicInfo(): string { | ||
| 103 | let info = new AppInfo() | 103 | let info = new AppInfo() |
| 104 | info.plat = 'Phone' | 104 | info.plat = 'Phone' |
| 105 | // 直接用Android,后续适配再新增鸿蒙 | 105 | // 直接用Android,后续适配再新增鸿蒙 |
| 106 | - info.system = 'Android' | 106 | + // info.system = 'Android' |
| 107 | info.networkStatus = 1 | 107 | info.networkStatus = 1 |
| 108 | let result = JSON.stringify(info) | 108 | let result = JSON.stringify(info) |
| 109 | Logger.debug(TAG, 'getAppPublicInfo: ' + JSON.stringify(info)) | 109 | Logger.debug(TAG, 'getAppPublicInfo: ' + JSON.stringify(info)) |
| @@ -134,12 +134,12 @@ function handleJsCallReceiveH5Data(data: Message) { | @@ -134,12 +134,12 @@ function handleJsCallReceiveH5Data(data: Message) { | ||
| 134 | break; | 134 | break; |
| 135 | case '6': | 135 | case '6': |
| 136 | let contentJson: IDataJson = JSON.parse(data?.data?.dataJson || '{}') | 136 | let contentJson: IDataJson = JSON.parse(data?.data?.dataJson || '{}') |
| 137 | - let content: ContentDTO = { | ||
| 138 | - objectId: contentJson?.newsId, | ||
| 139 | - relId: contentJson?.newsRelId, | ||
| 140 | - pageId: contentJson?.pageId, | ||
| 141 | - objectType: String(contentJson?.newsObjectType) | ||
| 142 | - } as ContentDTO | 137 | + let content: ContentDTO = new ContentDTO(); |
| 138 | + | ||
| 139 | + content.objectId = contentJson?.newsId; | ||
| 140 | + content.relId = contentJson?.newsRelId; | ||
| 141 | + content.pageId = contentJson?.pageId; | ||
| 142 | + content.objectType = String(contentJson?.newsObjectType); | ||
| 143 | ProcessUtils.processPage(content) | 143 | ProcessUtils.processPage(content) |
| 144 | break; | 144 | break; |
| 145 | default: | 145 | default: |
| @@ -150,17 +150,15 @@ function handleJsCallReceiveH5Data(data: Message) { | @@ -150,17 +150,15 @@ function handleJsCallReceiveH5Data(data: Message) { | ||
| 150 | function handleJsCallAppInnerLinkMethod(data: Message) { | 150 | function handleJsCallAppInnerLinkMethod(data: Message) { |
| 151 | let urlObject = Url.URL.parseURL(data?.data?.appInnerLink); | 151 | let urlObject = Url.URL.parseURL(data?.data?.appInnerLink); |
| 152 | let urlParams = new Url.URLParams(urlObject.search); | 152 | let urlParams = new Url.URLParams(urlObject.search); |
| 153 | - let content: ContentDTO = { | ||
| 154 | - objectId: urlParams.get('contentId') || '', | ||
| 155 | - relId: urlParams.get('relId') || '', | ||
| 156 | - relType: urlParams.get('relType') || '', | ||
| 157 | - pageId: urlParams.get('pageId') || '', | ||
| 158 | - objectType: '', | ||
| 159 | - linkUrl: urlParams.get('url') || '' | ||
| 160 | - } as ContentDTO | ||
| 161 | - if (urlParams.get('skipType') === '1') { | 153 | + let content: ContentDTO = new ContentDTO() |
| 162 | 154 | ||
| 163 | - switch (urlParams.get('type')) { | 155 | + content.objectId = urlParams.get('contentId') || ''; |
| 156 | + content.relId = urlParams.get('relId') || ''; | ||
| 157 | + content.relType = urlParams.get('relType') || ''; | ||
| 158 | + content.pageId = urlParams.get('pageId') || ''; | ||
| 159 | + content.objectType = ''; | ||
| 160 | + content.linkUrl = encodeURI(urlParams.get('url') || ''); | ||
| 161 | + switch (urlParams.get('type')) { | ||
| 164 | case 'video': | 162 | case 'video': |
| 165 | content.objectType = ContentConstants.TYPE_VOD | 163 | content.objectType = ContentConstants.TYPE_VOD |
| 166 | ProcessUtils.processPage(content) | 164 | ProcessUtils.processPage(content) |
| @@ -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() { |
| @@ -5,14 +5,12 @@ import { performJSCallNative } from './JsBridgeBiz'; | @@ -5,14 +5,12 @@ import { performJSCallNative } from './JsBridgeBiz'; | ||
| 5 | import { H5CallNativeType } from './H5CallNativeType'; | 5 | import { H5CallNativeType } from './H5CallNativeType'; |
| 6 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | 6 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; |
| 7 | import { DateTimeUtils } from 'wdKit' | 7 | import { DateTimeUtils } from 'wdKit' |
| 8 | - | ||
| 9 | const TAG = 'WdWebLocalComponent'; | 8 | const TAG = 'WdWebLocalComponent'; |
| 10 | 9 | ||
| 11 | @Component | 10 | @Component |
| 12 | export struct WdWebLocalComponent { | 11 | export struct WdWebLocalComponent { |
| 13 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | 12 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() |
| 14 | - onWebPrepared: () => void = () => { | ||
| 15 | - } | 13 | + onWebPrepared: () => void = () => {} |
| 16 | @Prop backVisibility: boolean = false | 14 | @Prop backVisibility: boolean = false |
| 17 | @Prop webResource: Resource = {} as Resource | 15 | @Prop webResource: Resource = {} as Resource |
| 18 | @State webHeight: string | number = '100%' | 16 | @State webHeight: string | number = '100%' |
| @@ -170,4 +170,8 @@ export { CreatorsBean } from './src/main/ets/bean/content/CreatorsBean'; | @@ -170,4 +170,8 @@ export { CreatorsBean } from './src/main/ets/bean/content/CreatorsBean'; | ||
| 170 | 170 | ||
| 171 | export { MasterDetailRes } from './src/main/ets/bean/user/MasterDetailRes'; | 171 | export { MasterDetailRes } from './src/main/ets/bean/user/MasterDetailRes'; |
| 172 | 172 | ||
| 173 | +export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean'; | ||
| 174 | + | ||
| 175 | + | ||
| 176 | + | ||
| 173 | export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean'; | 177 | export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean'; |
| @@ -3,47 +3,48 @@ import { AudioDTO } from '../content/AudioDTO'; | @@ -3,47 +3,48 @@ import { AudioDTO } from '../content/AudioDTO'; | ||
| 3 | import { ContentDTO } from '../content/ContentDTO'; | 3 | import { ContentDTO } from '../content/ContentDTO'; |
| 4 | import { BaseDTO } from './BaseDTO'; | 4 | import { BaseDTO } from './BaseDTO'; |
| 5 | 5 | ||
| 6 | -export interface CompDTO extends BaseDTO{ | ||
| 7 | - backgroundColor: string; | ||
| 8 | - backgroundImgUrl: string; | ||
| 9 | - cityCode: string; | ||
| 10 | - compStyle: string; | ||
| 11 | - compType: string; | 6 | +@Observed |
| 7 | +export class CompDTO implements BaseDTO{ | ||
| 8 | + backgroundColor: string=''; | ||
| 9 | + backgroundImgUrl: string=''; | ||
| 10 | + cityCode: string=''; | ||
| 11 | + compStyle: string=''; | ||
| 12 | + compType: string=''; | ||
| 12 | 13 | ||
| 13 | // dataSourceRequest: any[]; | 14 | // dataSourceRequest: any[]; |
| 14 | - districtCode: string; | 15 | + districtCode: string=''; |
| 15 | extraData?: string; | 16 | extraData?: string; |
| 16 | - hasAdInfo: number; | ||
| 17 | - id: number; | ||
| 18 | - imgSize: string; | ||
| 19 | - innerUrl: string; | ||
| 20 | - linkUrl: string; | 17 | + hasAdInfo: number=-1; |
| 18 | + id: number=0; | ||
| 19 | + imgSize: string=''; | ||
| 20 | + innerUrl: string=''; | ||
| 21 | + linkUrl: string=''; | ||
| 21 | 22 | ||
| 22 | // meddleDataList: any[]; | 23 | // meddleDataList: any[]; |
| 23 | - name: string; | ||
| 24 | - objectId: string; // 跳转页面id? | ||
| 25 | - objectTitle: string; // comp标题 | 24 | + name: string=''; |
| 25 | + objectId: string=''; // 跳转页面id? | ||
| 26 | + objectTitle: string=''; // comp标题 | ||
| 26 | // objectType?: string; // 跳转类型,枚举: | 27 | // objectType?: string; // 跳转类型,枚举: |
| 27 | - operDataList: ContentDTO[]; // 运营数据列表【正常运营配置的强运营数据,部分推荐场景的配置(自动源兜底数据)】 | 28 | + operDataList: ContentDTO[]=[]; // 运营数据列表【正常运营配置的强运营数据,部分推荐场景的配置(自动源兜底数据)】 |
| 28 | // pageId?: any; | 29 | // pageId?: any; |
| 29 | - posterSize: string; | ||
| 30 | - posterUrl: string; | ||
| 31 | - provinceCode: string; | ||
| 32 | - sortValue: number; | ||
| 33 | - subType: string; | ||
| 34 | - imageScale: number; // 封面图比例 1-4:3, 2-16:9, 3-3:2 | ||
| 35 | - audioDataList: AudioDTO[]; | ||
| 36 | - titleShowPolicy: string | number; | 30 | + posterSize: string=''; |
| 31 | + posterUrl: string=''; | ||
| 32 | + provinceCode: string=''; | ||
| 33 | + sortValue: number=-1; | ||
| 34 | + subType: string=''; | ||
| 35 | + imageScale: number=-1; // 封面图比例 1-4:3, 2-16:9, 3-3:2 | ||
| 36 | + audioDataList: AudioDTO[]=[]; | ||
| 37 | + titleShowPolicy: string | number=''; | ||
| 37 | 38 | ||
| 38 | /** | 39 | /** |
| 39 | * 组件内容源类型 (LIVE_HORIZONTAL_CARD\LIVE_RESERVATION\LIVE_LARGE_CARD\LIVE_END\LIVE_MONTHLY_RANKING ) | 40 | * 组件内容源类型 (LIVE_HORIZONTAL_CARD\LIVE_RESERVATION\LIVE_LARGE_CARD\LIVE_END\LIVE_MONTHLY_RANKING ) |
| 40 | */ | 41 | */ |
| 41 | - dataSourceType: string; | 42 | + dataSourceType: string=''; |
| 42 | 43 | ||
| 43 | /** | 44 | /** |
| 44 | * 信息流广告素材 | 45 | * 信息流广告素材 |
| 45 | */ | 46 | */ |
| 46 | - matInfo: CompAdvMatInfoBean | 47 | + matInfo: CompAdvMatInfoBean = {} as CompAdvMatInfoBean |
| 47 | 48 | ||
| 48 | pageId?: string; | 49 | pageId?: string; |
| 49 | objectType?: string; | 50 | objectType?: string; |
| @@ -8,81 +8,148 @@ import { RmhInfoDTO } from '../detail/RmhInfoDTO'; | @@ -8,81 +8,148 @@ import { RmhInfoDTO } from '../detail/RmhInfoDTO'; | ||
| 8 | import { commentInfo } from './commentInfo'; | 8 | import { commentInfo } from './commentInfo'; |
| 9 | import { BaseDTO } from '../component/BaseDTO'; | 9 | import { BaseDTO } from '../component/BaseDTO'; |
| 10 | 10 | ||
| 11 | -export interface ContentDTO extends BaseDTO { | ||
| 12 | - appStyle: string; | ||
| 13 | - cityCode: string; | ||
| 14 | - coverSize: string; | ||
| 15 | - coverType: number; | ||
| 16 | - coverUrl: string; | ||
| 17 | - description: string; | ||
| 18 | - districtCode: string; | ||
| 19 | - endTime: string; | ||
| 20 | - hImageUrl: string; | ||
| 21 | - heatValue: string; | ||
| 22 | - innerUrl: string; | ||
| 23 | - landscape: number; | 11 | +@Observed |
| 12 | +export class ContentDTO implements BaseDTO { | ||
| 13 | + appStyle: string = ''; | ||
| 14 | + cityCode: string = ''; | ||
| 15 | + coverSize: string = ''; | ||
| 16 | + coverType: number = -1; | ||
| 17 | + coverUrl: string = ''; | ||
| 18 | + description: string = ''; | ||
| 19 | + districtCode: string = ''; | ||
| 20 | + endTime: string = ''; | ||
| 21 | + hImageUrl: string = ''; | ||
| 22 | + heatValue: string = ''; | ||
| 23 | + innerUrl: string = ''; | ||
| 24 | + landscape: number = -1; | ||
| 24 | lengthTime?: object; | 25 | lengthTime?: object; |
| 25 | - linkUrl: string; | ||
| 26 | - openLikes: number; | 26 | + linkUrl: string = ''; |
| 27 | + openLikes: number = 0; | ||
| 27 | openComment?: number; | 28 | openComment?: number; |
| 28 | - openUrl: string; | ||
| 29 | - pageId: string; | ||
| 30 | - | 29 | + openUrl: string = ''; |
| 30 | + pageId: string = ''; | ||
| 31 | // playUrls: any[]; | 31 | // playUrls: any[]; |
| 32 | - programAuth: string; | ||
| 33 | - programId: string; | ||
| 34 | - programName: string; | ||
| 35 | - programSource: number; | ||
| 36 | - programType: number; | ||
| 37 | - provinceCode: string; | ||
| 38 | - | 32 | + programAuth: string = ''; |
| 33 | + programId: string = ''; | ||
| 34 | + programName: string = ''; | ||
| 35 | + programSource: number = -1; | ||
| 36 | + programType: number = -1; | ||
| 37 | + provinceCode: string = ''; | ||
| 39 | // rankingList: any[]; | 38 | // rankingList: any[]; |
| 40 | - showTitleEd: string; | ||
| 41 | - showTitleIng: string; | ||
| 42 | - showTitleNo: string; | ||
| 43 | - | 39 | + showTitleEd: string = ''; |
| 40 | + showTitleIng: string = ''; | ||
| 41 | + showTitleNo: string = ''; | ||
| 44 | // sortValue?: any; | 42 | // sortValue?: any; |
| 45 | - startTime: string; | ||
| 46 | - subType: string; | ||
| 47 | - subtitle: string; | ||
| 48 | - title: string; | ||
| 49 | - vImageUrl: string; | ||
| 50 | - screenType: string; | ||
| 51 | - source: string; | ||
| 52 | - objectId: string; | ||
| 53 | - objectType: string; | ||
| 54 | - channelId: string; | ||
| 55 | - relId: string; | ||
| 56 | - relType: string; | ||
| 57 | - newsTitle: string; //单图卡/2行标题/3行标题 | ||
| 58 | - publishTime: string; | ||
| 59 | - publishTimestamp: string; | ||
| 60 | - visitorComment: number; | ||
| 61 | - fullColumnImgUrls: FullColumnImgUrlDTO[]; | ||
| 62 | - liveInfo: LiveInfoDTO; // 直播新闻信息【BFF聚合】 | ||
| 63 | - videoInfo: VideoInfoDTO; // 视频新闻信息【BFF聚合】,视频非原片+清晰度最高的 | 43 | + startTime: string = ''; |
| 44 | + subType: string = ''; | ||
| 45 | + subtitle: string = ''; | ||
| 46 | + title: string = ''; | ||
| 47 | + vImageUrl: string = ''; | ||
| 48 | + screenType: string = ''; | ||
| 49 | + source: string = ''; | ||
| 50 | + objectId: string = ''; | ||
| 51 | + objectType: string = ''; | ||
| 52 | + channelId: string = ''; | ||
| 53 | + relId: string = ''; | ||
| 54 | + relType: string = ''; | ||
| 55 | + newsTitle: string = ''; //单图卡/2行标题/3行标题 | ||
| 56 | + publishTime: string = ''; | ||
| 57 | + publishTimestamp: string = ''; | ||
| 58 | + visitorComment: number = 0; | ||
| 59 | + fullColumnImgUrls: FullColumnImgUrlDTO[] = []; | ||
| 60 | + liveInfo: LiveInfoDTO = {} as LiveInfoDTO; // 直播新闻信息【BFF聚合】 | ||
| 61 | + videoInfo: VideoInfoDTO = {} as VideoInfoDTO; // 视频新闻信息【BFF聚合】,视频非原片+清晰度最高的 | ||
| 64 | 62 | ||
| 65 | - newsSummary: string; //appstyle:2 ,新闻详情 | 63 | + newsSummary: string = ''; //appstyle:2 ,新闻详情 |
| 66 | 64 | ||
| 67 | // 二次请求接口,返回的数据,这里组装到content里; | 65 | // 二次请求接口,返回的数据,这里组装到content里; |
| 68 | - interactData: InteractDataDTO; | ||
| 69 | - hasMore: number, | ||
| 70 | - slideShows: slideShows[], | ||
| 71 | - voiceInfo: VoiceInfoDTO, | ||
| 72 | - tagWord: number, | ||
| 73 | - isSelect: boolean; | ||
| 74 | - rmhInfo: RmhInfoDTO; // 人民号信息 | ||
| 75 | - photoNum: number; | ||
| 76 | - corner: string; | ||
| 77 | - rmhPlatform: number; | ||
| 78 | - newTags: string; | 66 | + interactData?: InteractDataDTO; |
| 67 | + hasMore: number = -1; | ||
| 68 | + slideShows: slideShows[] = []; | ||
| 69 | + voiceInfo: VoiceInfoDTO = {} as VoiceInfoDTO; | ||
| 70 | + tagWord: number = -1; | ||
| 71 | + isSelect: boolean = false; | ||
| 72 | + rmhInfo: RmhInfoDTO = {} as RmhInfoDTO; // 人民号信息 | ||
| 73 | + photoNum: number = 0; | ||
| 74 | + corner: string = ''; | ||
| 75 | + rmhPlatform: number = 0; | ||
| 76 | + newTags: string = ''; | ||
| 79 | titleShow?: number; | 77 | titleShow?: number; |
| 80 | isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据 | 78 | isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据 |
| 81 | isCollection?: boolean; // 是否是收藏的结果,区分搜索和主页的数据 | 79 | isCollection?: boolean; // 是否是收藏的结果,区分搜索和主页的数据 |
| 82 | commentInfo?: commentInfo | 80 | commentInfo?: commentInfo |
| 83 | //底部导航栏 id(用于频道跳转) | 81 | //底部导航栏 id(用于频道跳转) |
| 84 | - bottomNavId:string; | 82 | + bottomNavId: string = ''; |
| 85 | // 链接类型: 0:无链接;1:内链(文章);2:外链 | 83 | // 链接类型: 0:无链接;1:内链(文章);2:外链 |
| 86 | - openType:string | ||
| 87 | - extra:string | 84 | + openType: string = ''; |
| 85 | + extra: string = '' | ||
| 86 | + | ||
| 87 | + static clone(old:ContentDTO): ContentDTO { | ||
| 88 | + let content = new ContentDTO(); | ||
| 89 | + content.appStyle = old.appStyle; | ||
| 90 | + content.cityCode = old.cityCode; | ||
| 91 | + content.coverSize = old.coverSize; | ||
| 92 | + content.coverType = old.coverType; | ||
| 93 | + content.coverUrl = old.coverUrl; | ||
| 94 | + content.description = old.description; | ||
| 95 | + content.districtCode = old.districtCode; | ||
| 96 | + content.endTime = old.endTime; | ||
| 97 | + content.hImageUrl = old.hImageUrl; | ||
| 98 | + content.heatValue = old.heatValue; | ||
| 99 | + content.innerUrl = old.innerUrl; | ||
| 100 | + content.landscape = old.landscape; | ||
| 101 | + content.lengthTime = old.lengthTime; | ||
| 102 | + content.linkUrl = old.linkUrl; | ||
| 103 | + content.openLikes = old.openLikes; | ||
| 104 | + content.openComment = old.openComment; | ||
| 105 | + content.openUrl = old.openUrl; | ||
| 106 | + content.pageId = old.pageId; | ||
| 107 | + content.programAuth = old.programAuth; | ||
| 108 | + content.programId = old.programId; | ||
| 109 | + content.programName = old.programName; | ||
| 110 | + content.programSource = old.programSource; | ||
| 111 | + content.programType = old.programType; | ||
| 112 | + content.provinceCode = old.provinceCode; | ||
| 113 | + content.showTitleEd = old.showTitleEd; | ||
| 114 | + content.showTitleIng = old.showTitleIng; | ||
| 115 | + content.showTitleNo = old.showTitleNo; | ||
| 116 | + content.startTime = old.startTime; | ||
| 117 | + content.subType = old.subType; | ||
| 118 | + content.subtitle = old.subtitle; | ||
| 119 | + content.title = old.title; | ||
| 120 | + content.vImageUrl = old.vImageUrl; | ||
| 121 | + content.source = old.source; | ||
| 122 | + content.objectId = old.objectId; | ||
| 123 | + content.objectType = old.objectType; | ||
| 124 | + content.channelId = old.channelId; | ||
| 125 | + content.relId = old.relId; | ||
| 126 | + content.relType = old.relType; | ||
| 127 | + content.newsTitle = old.newsTitle; | ||
| 128 | + content.publishTime = old.publishTime; | ||
| 129 | + content.publishTimestamp = old.publishTimestamp; | ||
| 130 | + content.visitorComment = old.visitorComment; | ||
| 131 | + content.fullColumnImgUrls = old.fullColumnImgUrls; | ||
| 132 | + content.liveInfo = old.liveInfo; | ||
| 133 | + content.videoInfo = old.videoInfo; | ||
| 134 | + content.newsSummary = old.newsSummary; | ||
| 135 | + content.interactData = old.interactData; | ||
| 136 | + content.hasMore = old.hasMore; | ||
| 137 | + content.slideShows = old.slideShows; | ||
| 138 | + content.voiceInfo = old.voiceInfo; | ||
| 139 | + content.tagWord = old.tagWord; | ||
| 140 | + content.isSelect = old.isSelect; | ||
| 141 | + content.rmhInfo = old.rmhInfo; | ||
| 142 | + content.photoNum = old.photoNum; | ||
| 143 | + content.corner = old.corner; | ||
| 144 | + content.rmhPlatform = old.rmhPlatform; | ||
| 145 | + content.newTags = old.newTags; | ||
| 146 | + content.titleShow = old.titleShow; | ||
| 147 | + content.isSearch = old.isSearch; | ||
| 148 | + content.isCollection = old.isCollection; | ||
| 149 | + content.commentInfo = old.commentInfo; | ||
| 150 | + content.bottomNavId = old.bottomNavId; | ||
| 151 | + content.openType = old.openType; | ||
| 152 | + content.extra = old.extra; | ||
| 153 | + return content; | ||
| 154 | + } | ||
| 88 | } | 155 | } |
| 1 | /** | 1 | /** |
| 2 | * 批查接口查询互动相关数据,返回数据bean | 2 | * 批查接口查询互动相关数据,返回数据bean |
| 3 | */ | 3 | */ |
| 4 | -export interface InteractDataDTO { | ||
| 5 | - collectNum: number | string; | ||
| 6 | - commentNum: number | string; | ||
| 7 | - contentId: string; | ||
| 8 | - contentType: number; | ||
| 9 | - likeNum: number | string; | ||
| 10 | - readNum: number; | ||
| 11 | - shareNum: number; | 4 | +@Observed |
| 5 | +export class InteractDataDTO { | ||
| 6 | + collectNum: number | string = 0; | ||
| 7 | + commentNum: number | string = 0; | ||
| 8 | + contentId: string = ''; | ||
| 9 | + contentType: number = 0; | ||
| 10 | + likeNum: number | string = 0; | ||
| 11 | + readNum: number = 0; | ||
| 12 | + shareNum: number = 0; | ||
| 12 | } | 13 | } |
| 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; |
| @@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
| 4 | export interface TopNavDTO { | 4 | export interface TopNavDTO { |
| 5 | channelId: number; | 5 | channelId: number; |
| 6 | channelStyle: number; | 6 | channelStyle: number; |
| 7 | - channelType: number; | 7 | + channelType: number; // 频道样式;1-沉浸式;2-信息流;3-特殊频道(跳转指定页面的,如版面) |
| 8 | defaultPermitted: number; | 8 | defaultPermitted: number; |
| 9 | delPermitted: number; | 9 | delPermitted: number; |
| 10 | fontCColor: string; // 频道展示样式颜色(选中状态) | 10 | fontCColor: string; // 频道展示样式颜色(选中状态) |
| @@ -7,7 +7,7 @@ | @@ -7,7 +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 | - "@ohos/lottie": "2.0.0", | 10 | + "@ohos/lottie": "2.0.10", |
| 11 | "wdConstant": "file:../../commons/wdConstant", | 11 | "wdConstant": "file:../../commons/wdConstant", |
| 12 | "wdPlayer": "file:../../features/wdPlayer", | 12 | "wdPlayer": "file:../../features/wdPlayer", |
| 13 | "wdLogin": "file:../../features/wdLogin", | 13 | "wdLogin": "file:../../features/wdLogin", |
| @@ -23,7 +23,7 @@ import { Card21Component } from './cardview/Card21Component'; | @@ -23,7 +23,7 @@ import { Card21Component } from './cardview/Card21Component'; | ||
| 23 | */ | 23 | */ |
| 24 | @Component | 24 | @Component |
| 25 | export struct CardParser { | 25 | export struct CardParser { |
| 26 | - @State contentDTO: ContentDTO = {} as ContentDTO; | 26 | + @State contentDTO: ContentDTO = new ContentDTO(); |
| 27 | 27 | ||
| 28 | build() { | 28 | build() { |
| 29 | this.contentBuilder(this.contentDTO); | 29 | this.contentBuilder(this.contentDTO); |
| 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 | + |
| @@ -55,7 +55,7 @@ export struct DynamicDetailComponent { | @@ -55,7 +55,7 @@ export struct DynamicDetailComponent { | ||
| 55 | 55 | ||
| 56 | @State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult// 点赞、收藏状态 | 56 | @State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult// 点赞、收藏状态 |
| 57 | //跳转 | 57 | //跳转 |
| 58 | - private mJumpInfo: ContentDTO = {} as ContentDTO; | 58 | + private mJumpInfo: ContentDTO = new ContentDTO(); |
| 59 | 59 | ||
| 60 | @State publishTime: string = '' | 60 | @State publishTime: string = '' |
| 61 | @State isNetConnected: boolean = true | 61 | @State isNetConnected: boolean = true |
| @@ -6,7 +6,7 @@ import { | @@ -6,7 +6,7 @@ import { | ||
| 6 | H5ReceiveDetailBean, | 6 | H5ReceiveDetailBean, |
| 7 | ResponseBean | 7 | ResponseBean |
| 8 | } from 'wdBean'; | 8 | } from 'wdBean'; |
| 9 | -import { Logger, SPHelper, NetworkUtil } from 'wdKit'; | 9 | +import { Logger, SPHelper, NetworkUtil, DisplayUtils } from 'wdKit'; |
| 10 | import { SpConstants } from 'wdConstant'; | 10 | import { SpConstants } from 'wdConstant'; |
| 11 | import { WdWebLocalComponent } from 'wdWebComponent'; | 11 | import { WdWebLocalComponent } from 'wdWebComponent'; |
| 12 | import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; | 12 | import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; |
| @@ -67,7 +67,7 @@ export struct ImageAndTextWebComponent { | @@ -67,7 +67,7 @@ export struct ImageAndTextWebComponent { | ||
| 67 | loadImageOnlyWifiSwitch: loadImageOnlyWifiSwitch ? '1' : '2', | 67 | loadImageOnlyWifiSwitch: loadImageOnlyWifiSwitch ? '1' : '2', |
| 68 | networkStatus: Number(NetworkUtil.getNetworkType()), | 68 | networkStatus: Number(NetworkUtil.getNetworkType()), |
| 69 | darkMode: 'light', | 69 | darkMode: 'light', |
| 70 | - fontSizes: 'small' | 70 | + fontSizes: 'normalsize' |
| 71 | 71 | ||
| 72 | } as H5ReceiveDataExtraBean | 72 | } as H5ReceiveDataExtraBean |
| 73 | let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = { | 73 | let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = { |
sight_harmony/features/wdComponent/src/main/ets/components/InteractMessage/InteractMComponent.ets
0 → 100644
| 1 | + | ||
| 2 | +@Component | ||
| 3 | +export struct InteractMComponent { | ||
| 4 | + build() { | ||
| 5 | + Row(){ | ||
| 6 | + Image('') | ||
| 7 | + .backgroundColor(Color.Red) | ||
| 8 | + .width(36) | ||
| 9 | + .height(36) | ||
| 10 | + .borderRadius(18) | ||
| 11 | + | ||
| 12 | + Column(){ | ||
| 13 | + Row(){ | ||
| 14 | + Text('用户名') | ||
| 15 | + .fontSize('14fp').fontColor('#222222') | ||
| 16 | + | ||
| 17 | + Text('回复了你的评论') | ||
| 18 | + .fontSize('14fp').fontColor('#999999') | ||
| 19 | + .margin({left:5}) | ||
| 20 | + }.width('100%') | ||
| 21 | + | ||
| 22 | + Text('两天前') | ||
| 23 | + .margin({top:2}) | ||
| 24 | + .fontSize('12fp').fontColor('#B0B0B0') | ||
| 25 | + | ||
| 26 | + Text('评论内容') | ||
| 27 | + .margin({top:8,bottom:10}) | ||
| 28 | + .fontSize('16fp').fontColor('#222222') | ||
| 29 | + .width('100%') | ||
| 30 | + .constraintSize({maxHeight:500}) | ||
| 31 | + | ||
| 32 | + Column(){ | ||
| 33 | + Text('[你的评论]乐事薯片,大家的最爱').fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500}) | ||
| 34 | + .margin({top:5,bottom:5}) | ||
| 35 | + .width('100%') | ||
| 36 | + | ||
| 37 | + Divider() | ||
| 38 | + .color('#f5f5f5') | ||
| 39 | + .backgroundColor('#f5f5f5') | ||
| 40 | + .width('100%') | ||
| 41 | + .height(1) | ||
| 42 | + | ||
| 43 | + Row(){ | ||
| 44 | + Text('乐事薯片,大家的最爱!!!!').fontSize('12fp').fontColor('#666666').constraintSize({maxHeight:500}) | ||
| 45 | + | ||
| 46 | + Blank() | ||
| 47 | + | ||
| 48 | + Image($r('app.media.mine_user_edit')) | ||
| 49 | + .width('12') | ||
| 50 | + .height('12') | ||
| 51 | + }.margin({top:5,bottom:5}).width('100%') | ||
| 52 | + }.alignItems(HorizontalAlign.Start).backgroundColor('#f5f5f5').borderRadius(5) | ||
| 53 | + }.padding({left:5}).alignItems(HorizontalAlign.Start) | ||
| 54 | + }.padding({top:5,left:16,right:16}).width('100%').height(160).alignItems(VerticalAlign.Top).backgroundColor(Color.Red) | ||
| 55 | + } | ||
| 56 | +} |
| 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 | } |
| @@ -270,6 +270,7 @@ export struct MultiPictureDetailPageComponent { | @@ -270,6 +270,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 270 | .indicator(false) | 270 | .indicator(false) |
| 271 | .displayCount(1) | 271 | .displayCount(1) |
| 272 | .loop(false) | 272 | .loop(false) |
| 273 | + .effectMode(EdgeEffect.None) | ||
| 273 | .id('e_swiper_content') | 274 | .id('e_swiper_content') |
| 274 | .alignRules({ | 275 | .alignRules({ |
| 275 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 276 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| @@ -9,7 +9,7 @@ import { DateTimeUtils } from 'wdKit/Index' | @@ -9,7 +9,7 @@ import { DateTimeUtils } from 'wdKit/Index' | ||
| 9 | */ | 9 | */ |
| 10 | @Component | 10 | @Component |
| 11 | export struct CardMediaInfo { | 11 | export struct CardMediaInfo { |
| 12 | - @State contentDTO: ContentDTO = {} as ContentDTO // 如果有duraion,代表点播,显示时长;如果不传或者传0,显示直播中 | 12 | + @State contentDTO: ContentDTO = new ContentDTO() // 如果有duraion,代表点播,显示时长;如果不传或者传0,显示直播中 |
| 13 | 13 | ||
| 14 | // objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频, | 14 | // objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频, |
| 15 | // 14动态图文,15动态视频16问政;100人民号,101标签 | 15 | // 14动态图文,15动态视频16问政;100人民号,101标签 |
| @@ -4,7 +4,7 @@ import { DateTimeUtils } from 'wdKit/Index'; | @@ -4,7 +4,7 @@ import { DateTimeUtils } from 'wdKit/Index'; | ||
| 4 | 4 | ||
| 5 | @Component | 5 | @Component |
| 6 | export struct CardSourceInfo { | 6 | export struct CardSourceInfo { |
| 7 | - @State contentDTO: ContentDTO = {} as ContentDTO; | 7 | + @State contentDTO: ContentDTO = new ContentDTO(); |
| 8 | 8 | ||
| 9 | build() { | 9 | build() { |
| 10 | Flex() { | 10 | Flex() { |
| @@ -51,6 +51,7 @@ export struct CardSourceInfo { | @@ -51,6 +51,7 @@ export struct CardSourceInfo { | ||
| 51 | .fontColor($r("app.color.color_B0B0B0")) | 51 | .fontColor($r("app.color.color_B0B0B0")) |
| 52 | .flexShrink(0) | 52 | .flexShrink(0) |
| 53 | .margin({ left: 6 }) | 53 | .margin({ left: 6 }) |
| 54 | + .visibility(Number(this.contentDTO?.interactData?.commentNum) === 0 ? Visibility.None : Visibility.Visible) | ||
| 54 | } | 55 | } |
| 55 | } | 56 | } |
| 56 | .width(CommonConstants.FULL_WIDTH) | 57 | .width(CommonConstants.FULL_WIDTH) |
| @@ -3,12 +3,40 @@ | @@ -3,12 +3,40 @@ | ||
| 3 | */ | 3 | */ |
| 4 | import { RmhInfoDTO } from 'wdBean' | 4 | import { RmhInfoDTO } from 'wdBean' |
| 5 | import { CommonConstants } from 'wdConstant/Index'; | 5 | import { CommonConstants } from 'wdConstant/Index'; |
| 6 | -import { DateTimeUtils } from 'wdKit'; | 6 | +import { DateTimeUtils, SPHelper } from 'wdKit'; |
| 7 | +import { SpConstants } from 'wdConstant/Index' | ||
| 8 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 9 | +import router from '@ohos.router' | ||
| 7 | 10 | ||
| 8 | @Component | 11 | @Component |
| 9 | export struct RmhTitle { | 12 | export struct RmhTitle { |
| 10 | @Prop rmhInfo: RmhInfoDTO | 13 | @Prop rmhInfo: RmhInfoDTO |
| 11 | @Prop publishTime: string | undefined | 14 | @Prop publishTime: string | undefined |
| 15 | + @Prop hideTime: boolean | ||
| 16 | + | ||
| 17 | + async appointReq() { | ||
| 18 | + // 未登录,跳转登录 | ||
| 19 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 20 | + if (!user_id) { | ||
| 21 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 22 | + return | ||
| 23 | + } | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + aboutToAppear(): void { | ||
| 27 | + let page = router.getState(); | ||
| 28 | + if (page.path.includes('/page/PeopleShipHomePage') || page.path.includes('/pages/MainPage')) { | ||
| 29 | + this.hideTime = true; | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + getDaysBetweenDates(date: number) { | ||
| 34 | + const oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数 | ||
| 35 | + const time1 = new Date().getTime(); // 今天日期的时间戳 | ||
| 36 | + const time2 = new Date(date).getTime(); // 要比较日期的时间戳 | ||
| 37 | + const diffDays = Math.round(Math.abs((time1 - time2) / oneDay)); // 两个日期时间戳差值除以一天的毫秒数得到天数,取绝对值并四舍五入 | ||
| 38 | + return Math.ceil(diffDays); | ||
| 39 | + } | ||
| 12 | 40 | ||
| 13 | build() { | 41 | build() { |
| 14 | Flex() { | 42 | Flex() { |
| @@ -33,15 +61,17 @@ export struct RmhTitle { | @@ -33,15 +61,17 @@ export struct RmhTitle { | ||
| 33 | .alignSelf(ItemAlign.Start) | 61 | .alignSelf(ItemAlign.Start) |
| 34 | Flex({alignContent: FlexAlign.Start, wrap: FlexWrap.NoWrap}) { | 62 | Flex({alignContent: FlexAlign.Start, wrap: FlexWrap.NoWrap}) { |
| 35 | Row() { | 63 | Row() { |
| 36 | - if (this.publishTime) { | ||
| 37 | - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime))) | ||
| 38 | - .fontSize($r("app.float.font_size_12")) | ||
| 39 | - .fontColor($r("app.color.color_B0B0B0")) | ||
| 40 | - } | ||
| 41 | - if (this.publishTime && this.rmhInfo.rmhDesc) { | ||
| 42 | - Image($r('app.media.point')) | ||
| 43 | - .width(16) | ||
| 44 | - .height(16) | 64 | + if (!(this.hideTime && this.getDaysBetweenDates(Number(this.publishTime)) > 2)) { |
| 65 | + if (this.publishTime) { | ||
| 66 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime))) | ||
| 67 | + .fontSize($r("app.float.font_size_12")) | ||
| 68 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 69 | + } | ||
| 70 | + if (this.publishTime && this.rmhInfo.rmhDesc) { | ||
| 71 | + Image($r('app.media.point')) | ||
| 72 | + .width(16) | ||
| 73 | + .height(16) | ||
| 74 | + } | ||
| 45 | } | 75 | } |
| 46 | Text(this.rmhInfo.rmhDesc) | 76 | Text(this.rmhInfo.rmhDesc) |
| 47 | .fontSize($r("app.float.font_size_12")) | 77 | .fontSize($r("app.float.font_size_12")) |
| @@ -68,7 +98,7 @@ export struct RmhTitle { | @@ -68,7 +98,7 @@ export struct RmhTitle { | ||
| 68 | .flexShrink(0) | 98 | .flexShrink(0) |
| 69 | .alignSelf(ItemAlign.Center) | 99 | .alignSelf(ItemAlign.Center) |
| 70 | .onClick(() => { | 100 | .onClick(() => { |
| 71 | - // TODO 调用关注接口 | 101 | + this.appointReq(); |
| 72 | }) | 102 | }) |
| 73 | } | 103 | } |
| 74 | } | 104 | } |
| @@ -20,7 +20,7 @@ const TAG: string = 'Card2Component'; | @@ -20,7 +20,7 @@ const TAG: string = 'Card2Component'; | ||
| 20 | @Component | 20 | @Component |
| 21 | export struct CardAdvVideoComponent { | 21 | export struct CardAdvVideoComponent { |
| 22 | @State compDTO: CompDTO = {} as CompDTO | 22 | @State compDTO: CompDTO = {} as CompDTO |
| 23 | - @State contentDTO: ContentDTO = {} as ContentDTO | 23 | + @State contentDTO: ContentDTO = new ContentDTO() |
| 24 | pageModel: PageModel = new PageModel(); | 24 | pageModel: PageModel = new PageModel(); |
| 25 | aboutToAppear(): void { | 25 | aboutToAppear(): void { |
| 26 | 26 |
| 1 | -import { ContentDTO, slideShows } from 'wdBean'; | 1 | +import { ContentDTO, slideShows, VideoInfoDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant'; | 2 | import { CommonConstants } from 'wdConstant'; |
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; | 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; |
| 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 |
| @@ -12,7 +14,12 @@ const TAG: string = 'Card10Component'; | @@ -12,7 +14,12 @@ const TAG: string = 'Card10Component'; | ||
| 12 | @Preview | 14 | @Preview |
| 13 | @Component | 15 | @Component |
| 14 | export struct Card10Component { | 16 | export struct Card10Component { |
| 15 | - @State contentDTO: ContentDTO = {} as ContentDTO; | 17 | + @State contentDTO: ContentDTO = new 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,38 +96,22 @@ export struct Card10Component { | @@ -99,38 +96,22 @@ 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 | { |
| 130 | - contentDTO: { | ||
| 131 | - publishTime: item.publishTime || '', | ||
| 132 | - source: item.source || '' | ||
| 133 | - } as ContentDTO | 114 | + contentDTO: this.createContent(item) |
| 134 | } | 115 | } |
| 135 | ) | 116 | ) |
| 136 | } | 117 | } |
| @@ -140,19 +121,15 @@ export struct Card10Component { | @@ -140,19 +121,15 @@ export struct Card10Component { | ||
| 140 | // 右侧图片 | 121 | // 右侧图片 |
| 141 | if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) { | 122 | if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) { |
| 142 | Stack() { | 123 | Stack() { |
| 143 | - Image(item.fullColumnImgUrls[0].url) | 124 | + Image(this.loadImg ? item.fullColumnImgUrls[0].url : '') |
| 125 | + .backgroundColor(0xf5f5f5) | ||
| 144 | .width(117) | 126 | .width(117) |
| 145 | .height(78) | 127 | .height(78) |
| 146 | .objectFit(ImageFit.Cover) | 128 | .objectFit(ImageFit.Cover) |
| 147 | .borderRadius($r('app.float.image_border_radius')) | 129 | .borderRadius($r('app.float.image_border_radius')) |
| 148 | .margin({ left: 12 }) | 130 | .margin({ left: 12 }) |
| 149 | CardMediaInfo({ | 131 | CardMediaInfo({ |
| 150 | - contentDTO: { | ||
| 151 | - objectType: String(item.objectType), | ||
| 152 | - videoInfo: { videoDuration: Number(item.videoDuration) as number }, | ||
| 153 | - photoNum: Number(item.photoNum), | ||
| 154 | - voiceInfo: { voiceDuration: Number(item.voiceDuration) as number } | ||
| 155 | - } as ContentDTO | 132 | + contentDTO: this.createMediaInfoContent(item) |
| 156 | }) | 133 | }) |
| 157 | } | 134 | } |
| 158 | .alignContent(Alignment.BottomEnd) | 135 | .alignContent(Alignment.BottomEnd) |
| @@ -168,4 +145,20 @@ export struct Card10Component { | @@ -168,4 +145,20 @@ export struct Card10Component { | ||
| 168 | ProcessUtils.processPage(data) | 145 | ProcessUtils.processPage(data) |
| 169 | }) | 146 | }) |
| 170 | } | 147 | } |
| 148 | + | ||
| 149 | + private createContent(item: slideShows): ContentDTO { | ||
| 150 | + let contentDTO = new ContentDTO() | ||
| 151 | + contentDTO.publishTime = item.publishTime.toString() || ''; | ||
| 152 | + contentDTO.source = item.source || ''; | ||
| 153 | + return contentDTO; | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + private createMediaInfoContent(item: slideShows): ContentDTO { | ||
| 157 | + let contentDTO = new ContentDTO() | ||
| 158 | + contentDTO.objectType = String(item.objectType); | ||
| 159 | + contentDTO.videoInfo = { videoDuration: Number(item.videoDuration) as number } as VideoInfoDTO; | ||
| 160 | + contentDTO.photoNum = Number(item.photoNum); | ||
| 161 | + contentDTO.voiceInfo = { voiceDuration: Number(item.voiceDuration) as number }; | ||
| 162 | + return contentDTO; | ||
| 163 | + } | ||
| 171 | } | 164 | } |
| @@ -11,13 +11,14 @@ const TAG = 'Card11Component'; | @@ -11,13 +11,14 @@ const TAG = 'Card11Component'; | ||
| 11 | */ | 11 | */ |
| 12 | @Component | 12 | @Component |
| 13 | export struct Card11Component { | 13 | export struct Card11Component { |
| 14 | - @State contentDTO: ContentDTO = {} as ContentDTO; | 14 | + @State contentDTO: ContentDTO = new 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 | ||
| @@ -11,7 +12,8 @@ const TAG = 'Card12Component'; | @@ -11,7 +12,8 @@ const TAG = 'Card12Component'; | ||
| 11 | */ | 12 | */ |
| 12 | @Component | 13 | @Component |
| 13 | export struct Card12Component { | 14 | export struct Card12Component { |
| 14 | - @State contentDTO: ContentDTO = {} as ContentDTO; | 15 | + @State contentDTO: ContentDTO = new 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 = new 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 = new 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 | ||
| @@ -16,9 +18,12 @@ interface fullColumnImgUrlItem { | @@ -16,9 +18,12 @@ interface fullColumnImgUrlItem { | ||
| 16 | */ | 18 | */ |
| 17 | @Component | 19 | @Component |
| 18 | export struct Card16Component { | 20 | export struct Card16Component { |
| 19 | - @State contentDTO: ContentDTO = {} as ContentDTO; | 21 | + @State contentDTO: ContentDTO = new 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 | /** |
| @@ -13,14 +15,21 @@ const TAG = 'Card17Component'; | @@ -13,14 +15,21 @@ const TAG = 'Card17Component'; | ||
| 13 | @Component | 15 | @Component |
| 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 = new 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 | ||
| @@ -10,69 +12,8 @@ const TAG = 'Card19Component'; | @@ -10,69 +12,8 @@ const TAG = 'Card19Component'; | ||
| 10 | */ | 12 | */ |
| 11 | @Component | 13 | @Component |
| 12 | export struct Card19Component { | 14 | export struct Card19Component { |
| 13 | - @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 | ||
| 73 | - | ||
| 74 | - aboutToAppear(): void { | ||
| 75 | - } | 15 | + @State contentDTO: ContentDTO = new ContentDTO() |
| 16 | + @State clicked: boolean = false; | ||
| 76 | 17 | ||
| 77 | build() { | 18 | build() { |
| 78 | Column() { | 19 | Column() { |
| @@ -82,11 +23,12 @@ export struct Card19Component { | @@ -82,11 +23,12 @@ export struct Card19Component { | ||
| 82 | if (this.contentDTO.newsTitle) { | 23 | if (this.contentDTO.newsTitle) { |
| 83 | Text(this.contentDTO.newsTitle) | 24 | Text(this.contentDTO.newsTitle) |
| 84 | .fontSize($r('app.float.font_size_17')) | 25 | .fontSize($r('app.float.font_size_17')) |
| 85 | - .fontColor($r('app.color.color_222222')) | 26 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 86 | .textOverflowStyle(3) | 27 | .textOverflowStyle(3) |
| 87 | .margin({ bottom: 8 }) | 28 | .margin({ bottom: 8 }) |
| 88 | .width(CommonConstants.FULL_WIDTH) | 29 | .width(CommonConstants.FULL_WIDTH) |
| 89 | .onClick((event: ClickEvent) => { | 30 | .onClick((event: ClickEvent) => { |
| 31 | + this.clicked = true; | ||
| 90 | ProcessUtils.processPage(this.contentDTO) | 32 | ProcessUtils.processPage(this.contentDTO) |
| 91 | }) | 33 | }) |
| 92 | } | 34 | } |
| @@ -104,6 +46,7 @@ export struct Card19Component { | @@ -104,6 +46,7 @@ export struct Card19Component { | ||
| 104 | }) | 46 | }) |
| 105 | ProcessUtils.gotoMultiPictureListPage(photoList,0) | 47 | ProcessUtils.gotoMultiPictureListPage(photoList,0) |
| 106 | }) | 48 | }) |
| 49 | + CarderInteraction({contentDTO: this.contentDTO}) | ||
| 107 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 50 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 108 | } | 51 | } |
| 109 | .padding({ | 52 | .padding({ |
| @@ -113,6 +56,7 @@ export struct Card19Component { | @@ -113,6 +56,7 @@ export struct Card19Component { | ||
| 113 | bottom: $r('app.float.card_comp_pagePadding_tb') | 56 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 114 | }) | 57 | }) |
| 115 | .onClick((event: ClickEvent) => { | 58 | .onClick((event: ClickEvent) => { |
| 59 | + this.clicked = true; | ||
| 116 | ProcessUtils.processPage(this.contentDTO) | 60 | ProcessUtils.processPage(this.contentDTO) |
| 117 | }) | 61 | }) |
| 118 | } | 62 | } |
| @@ -130,13 +74,17 @@ struct createImg { | @@ -130,13 +74,17 @@ struct createImg { | ||
| 130 | @Prop fullColumnImgUrls: FullColumnImgUrlDTO[] | 74 | @Prop fullColumnImgUrls: FullColumnImgUrlDTO[] |
| 131 | @State picWidth: number = 0; | 75 | @State picWidth: number = 0; |
| 132 | @State picHeight: number = 0; | 76 | @State picHeight: number = 0; |
| 133 | - aboutToAppear(): void { | 77 | + @State loadImg: boolean = false; |
| 78 | + | ||
| 79 | + async aboutToAppear(): Promise<void> { | ||
| 80 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 134 | if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位 | 81 | if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位 |
| 135 | this.fullColumnImgUrls.splice(2,0, { | 82 | this.fullColumnImgUrls.splice(2,0, { |
| 136 | fullUrl: '' | 83 | fullUrl: '' |
| 137 | } as FullColumnImgUrlDTO) | 84 | } as FullColumnImgUrlDTO) |
| 138 | } | 85 | } |
| 139 | } | 86 | } |
| 87 | + | ||
| 140 | caclImageRadius(index: number) { | 88 | caclImageRadius(index: number) { |
| 141 | let radius: radiusType = { | 89 | let radius: radiusType = { |
| 142 | topLeft: index === 0 ? $r('app.float.image_border_radius') : 0, | 90 | topLeft: index === 0 ? $r('app.float.image_border_radius') : 0, |
| @@ -189,14 +137,15 @@ struct createImg { | @@ -189,14 +137,15 @@ struct createImg { | ||
| 189 | alignContent: Alignment.BottomEnd | 137 | alignContent: Alignment.BottomEnd |
| 190 | }) { | 138 | }) { |
| 191 | if (this.getPicType() === 1) { | 139 | if (this.getPicType() === 1) { |
| 192 | - Image(item.fullUrl) | 140 | + Image(this.loadImg ? item.fullUrl : '') |
| 141 | + .backgroundColor(0xf5f5f5) | ||
| 193 | .width('100%') | 142 | .width('100%') |
| 194 | - // .height(172) | 143 | + .height(172) |
| 195 | .autoResize(true) | 144 | .autoResize(true) |
| 196 | .borderRadius(this.caclImageRadius(index)) | 145 | .borderRadius(this.caclImageRadius(index)) |
| 197 | } else if (this.getPicType() === 2) { | 146 | } else if (this.getPicType() === 2) { |
| 198 | - Image(item.fullUrl) | ||
| 199 | - // .width('100%') | 147 | + Image(this.loadImg ? item.fullUrl : '') |
| 148 | + .width('100%') | ||
| 200 | .height(305) | 149 | .height(305) |
| 201 | .autoResize(true) | 150 | .autoResize(true) |
| 202 | .borderRadius(this.caclImageRadius(index)) | 151 | .borderRadius(this.caclImageRadius(index)) |
| @@ -211,6 +160,7 @@ struct createImg { | @@ -211,6 +160,7 @@ struct createImg { | ||
| 211 | .fontWeight(400) | 160 | .fontWeight(400) |
| 212 | .fontColor(0xffffff) | 161 | .fontColor(0xffffff) |
| 213 | .fontFamily('PingFang SC') | 162 | .fontFamily('PingFang SC') |
| 163 | + .shadow({radius: 4, color: 0xc3cbd5, offsetX: 4, offsetY: 4}) | ||
| 214 | } | 164 | } |
| 215 | .width(48) | 165 | .width(48) |
| 216 | .padding({bottom: 9}) | 166 | .padding({bottom: 9}) |
| @@ -221,7 +171,8 @@ struct createImg { | @@ -221,7 +171,8 @@ struct createImg { | ||
| 221 | GridCol({ | 171 | GridCol({ |
| 222 | span: { xs: 8 } | 172 | span: { xs: 8 } |
| 223 | }) { | 173 | }) { |
| 224 | - Image(item.fullUrl) | 174 | + Image(this.loadImg ? item.fullUrl : '') |
| 175 | + .backgroundColor(0xf5f5f5) | ||
| 225 | .width('100%') | 176 | .width('100%') |
| 226 | .borderRadius(this.caclImageRadius(index)) | 177 | .borderRadius(this.caclImageRadius(index)) |
| 227 | .autoResize(true) | 178 | .autoResize(true) |
| @@ -236,7 +187,8 @@ struct createImg { | @@ -236,7 +187,8 @@ struct createImg { | ||
| 236 | GridCol({ | 187 | GridCol({ |
| 237 | span: { xs: 4 } | 188 | span: { xs: 4 } |
| 238 | }) { | 189 | }) { |
| 239 | - Image(item.fullUrl) | 190 | + Image(this.loadImg ? item.fullUrl : '') |
| 191 | + .backgroundColor(0xf5f5f5) | ||
| 240 | .aspectRatio(1) | 192 | .aspectRatio(1) |
| 241 | .borderRadius(this.caclImageRadius(index)) | 193 | .borderRadius(this.caclImageRadius(index)) |
| 242 | } | 194 | } |
| @@ -244,7 +196,8 @@ struct createImg { | @@ -244,7 +196,8 @@ struct createImg { | ||
| 244 | GridCol({ | 196 | GridCol({ |
| 245 | span: { sm: 4, lg: 3 } | 197 | span: { sm: 4, lg: 3 } |
| 246 | }) { | 198 | }) { |
| 247 | - Image(item.fullUrl) | 199 | + Image(this.loadImg ? item.fullUrl : '') |
| 200 | + .backgroundColor(0xf5f5f5) | ||
| 248 | .aspectRatio(1) | 201 | .aspectRatio(1) |
| 249 | .borderRadius(this.caclImageRadius(index)) | 202 | .borderRadius(this.caclImageRadius(index)) |
| 250 | } | 203 | } |
| @@ -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 | /** |
| @@ -10,39 +13,8 @@ const TAG = 'Card20Component'; | @@ -10,39 +13,8 @@ const TAG = 'Card20Component'; | ||
| 10 | */ | 13 | */ |
| 11 | @Component | 14 | @Component |
| 12 | export struct Card20Component { | 15 | export struct Card20Component { |
| 13 | - @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; | 16 | + @State contentDTO: ContentDTO = new ContentDTO(); |
| 17 | + @State clicked: boolean = false; | ||
| 46 | 18 | ||
| 47 | aboutToAppear(): void { | 19 | aboutToAppear(): void { |
| 48 | } | 20 | } |
| @@ -55,7 +27,7 @@ export struct Card20Component { | @@ -55,7 +27,7 @@ export struct Card20Component { | ||
| 55 | if (this.contentDTO.newsTitle) { | 27 | if (this.contentDTO.newsTitle) { |
| 56 | Text(this.contentDTO.newsTitle) | 28 | Text(this.contentDTO.newsTitle) |
| 57 | .fontSize($r('app.float.font_size_17')) | 29 | .fontSize($r('app.float.font_size_17')) |
| 58 | - .fontColor($r('app.color.color_222222')) | 30 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 59 | .width(CommonConstants.FULL_WIDTH) | 31 | .width(CommonConstants.FULL_WIDTH) |
| 60 | .textOverflowStyle(3) | 32 | .textOverflowStyle(3) |
| 61 | .margin({ bottom: 8 }) | 33 | .margin({ bottom: 8 }) |
| @@ -64,6 +36,7 @@ export struct Card20Component { | @@ -64,6 +36,7 @@ export struct Card20Component { | ||
| 64 | if (this.contentDTO.fullColumnImgUrls[0]) { | 36 | if (this.contentDTO.fullColumnImgUrls[0]) { |
| 65 | createImg({ contentDTO: this.contentDTO }) | 37 | createImg({ contentDTO: this.contentDTO }) |
| 66 | } | 38 | } |
| 39 | + CarderInteraction({contentDTO: this.contentDTO}) | ||
| 67 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 40 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 68 | } | 41 | } |
| 69 | .padding({ | 42 | .padding({ |
| @@ -73,6 +46,7 @@ export struct Card20Component { | @@ -73,6 +46,7 @@ export struct Card20Component { | ||
| 73 | bottom: $r('app.float.card_comp_pagePadding_tb') | 46 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 74 | }) | 47 | }) |
| 75 | .onClick((event: ClickEvent) => { | 48 | .onClick((event: ClickEvent) => { |
| 49 | + this.clicked = true; | ||
| 76 | ProcessUtils.processPage(this.contentDTO) | 50 | ProcessUtils.processPage(this.contentDTO) |
| 77 | }) | 51 | }) |
| 78 | } | 52 | } |
| @@ -88,6 +62,12 @@ interface radiusType { | @@ -88,6 +62,12 @@ interface radiusType { | ||
| 88 | @Component | 62 | @Component |
| 89 | struct createImg { | 63 | struct createImg { |
| 90 | @Prop contentDTO: ContentDTO | 64 | @Prop contentDTO: ContentDTO |
| 65 | + @State loadImg: boolean = false; | ||
| 66 | + | ||
| 67 | + async aboutToAppear(): Promise<void> { | ||
| 68 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 69 | + } | ||
| 70 | + | ||
| 91 | 71 | ||
| 92 | build() { | 72 | build() { |
| 93 | GridRow() { | 73 | GridRow() { |
| @@ -97,7 +77,8 @@ struct createImg { | @@ -97,7 +77,8 @@ struct createImg { | ||
| 97 | span: { xs: 12 } | 77 | span: { xs: 12 } |
| 98 | }) { | 78 | }) { |
| 99 | Stack() { | 79 | Stack() { |
| 100 | - Image(this.contentDTO.coverUrl) | 80 | + Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 81 | + .backgroundColor(0xf5f5f5) | ||
| 101 | .width(CommonConstants.FULL_WIDTH) | 82 | .width(CommonConstants.FULL_WIDTH) |
| 102 | .aspectRatio(16 / 9) | 83 | .aspectRatio(16 / 9) |
| 103 | .borderRadius($r('app.float.image_border_radius')) | 84 | .borderRadius($r('app.float.image_border_radius')) |
| @@ -114,7 +95,8 @@ struct createImg { | @@ -114,7 +95,8 @@ struct createImg { | ||
| 114 | span: { xs: 6 } | 95 | span: { xs: 6 } |
| 115 | }) { | 96 | }) { |
| 116 | Stack() { | 97 | Stack() { |
| 117 | - Image(this.contentDTO.coverUrl) | 98 | + Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 99 | + .backgroundColor(0xf5f5f5) | ||
| 118 | .width(CommonConstants.FULL_WIDTH) | 100 | .width(CommonConstants.FULL_WIDTH) |
| 119 | .borderRadius($r('app.float.image_border_radius')) | 101 | .borderRadius($r('app.float.image_border_radius')) |
| 120 | CardMediaInfo({ contentDTO: this.contentDTO }) | 102 | 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 | ||
| @@ -11,7 +13,13 @@ const TAG: string = 'Card6Component-Card13Component'; | @@ -11,7 +13,13 @@ const TAG: string = 'Card6Component-Card13Component'; | ||
| 11 | */ | 13 | */ |
| 12 | @Component | 14 | @Component |
| 13 | export struct Card21Component { | 15 | export struct Card21Component { |
| 14 | - @State contentDTO: ContentDTO = {} as ContentDTO; | 16 | + @State contentDTO: ContentDTO = new 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 = new 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 | } |
| @@ -9,23 +9,14 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | @@ -9,23 +9,14 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | ||
| 9 | */ | 9 | */ |
| 10 | @Component | 10 | @Component |
| 11 | export struct Card3Component { | 11 | export struct Card3Component { |
| 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; | 12 | + @State contentDTO: ContentDTO = new ContentDTO(); |
| 13 | + @State clicked: boolean = false; | ||
| 23 | 14 | ||
| 24 | build() { | 15 | build() { |
| 25 | Column() { | 16 | Column() { |
| 26 | Text(this.contentDTO.newsTitle) | 17 | Text(this.contentDTO.newsTitle) |
| 27 | .fontSize($r("app.float.font_size_16")) | 18 | .fontSize($r("app.float.font_size_16")) |
| 28 | - .fontColor($r("app.color.color_222222")) | 19 | + .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) |
| 29 | .width(CommonConstants.FULL_WIDTH) | 20 | .width(CommonConstants.FULL_WIDTH) |
| 30 | // 评论等信息 | 21 | // 评论等信息 |
| 31 | CardSourceInfo({ contentDTO: this.contentDTO }) | 22 | CardSourceInfo({ contentDTO: this.contentDTO }) |
| @@ -38,6 +29,7 @@ export struct Card3Component { | @@ -38,6 +29,7 @@ export struct Card3Component { | ||
| 38 | bottom: $r('app.float.card_comp_pagePadding_tb') | 29 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 39 | }) | 30 | }) |
| 40 | .onClick((event: ClickEvent) => { | 31 | .onClick((event: ClickEvent) => { |
| 32 | + this.clicked = true; | ||
| 41 | ProcessUtils.processPage(this.contentDTO) | 33 | ProcessUtils.processPage(this.contentDTO) |
| 42 | }) | 34 | }) |
| 43 | } | 35 | } |
| @@ -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 = new 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 = new 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 | /** |
| @@ -10,7 +13,13 @@ const TAG: string = 'Card6Component-Card13Component'; | @@ -10,7 +13,13 @@ const TAG: string = 'Card6Component-Card13Component'; | ||
| 10 | */ | 13 | */ |
| 11 | @Component | 14 | @Component |
| 12 | export struct Card6Component { | 15 | export struct Card6Component { |
| 13 | - @State contentDTO: ContentDTO = {} as ContentDTO; | 16 | + @State contentDTO: ContentDTO = new 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,25 @@ export struct Card6Component { | @@ -26,12 +35,25 @@ 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 | + } else if (this.contentDTO.objectType == '5') { | ||
| 42 | + Notes({ objectType: this.contentDTO.objectType }) | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + Text(`${this.contentDTO.newsTitle}`) | ||
| 46 | + .fontColor(this.clicked ? 0x848484 : 0x222222) | ||
| 47 | + .fontSize(16) | ||
| 48 | + .fontWeight(FontWeight.Normal) | ||
| 49 | + .maxLines(3) | ||
| 50 | + .alignSelf(ItemAlign.Start) | ||
| 51 | + .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | ||
| 52 | + .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 60 : | ||
| 53 | + (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | ||
| 54 | + this.contentDTO.objectType == '5' ? 30 : 0) | ||
| 55 | + }.alignContent(Alignment.TopStart) | ||
| 56 | + | ||
| 35 | }.height("80%") | 57 | }.height("80%") |
| 36 | .justifyContent(FlexAlign.Start) | 58 | .justifyContent(FlexAlign.Start) |
| 37 | 59 | ||
| @@ -42,9 +64,10 @@ export struct Card6Component { | @@ -42,9 +64,10 @@ export struct Card6Component { | ||
| 42 | .alignItems(HorizontalAlign.Start) | 64 | .alignItems(HorizontalAlign.Start) |
| 43 | .justifyContent(FlexAlign.Start) | 65 | .justifyContent(FlexAlign.Start) |
| 44 | .width('58%') | 66 | .width('58%') |
| 67 | + | ||
| 45 | Stack() { | 68 | Stack() { |
| 46 | - Image(this.contentDTO.coverUrl) | ||
| 47 | - .backgroundColor($r('app.color.color_B0B0B0')) | 69 | + Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| 70 | + .backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5) | ||
| 48 | .borderRadius(5) | 71 | .borderRadius(5) |
| 49 | .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) | 72 | .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) |
| 50 | .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 90 : 180) | 73 | .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 90 : 180) |
| @@ -53,6 +76,7 @@ export struct Card6Component { | @@ -53,6 +76,7 @@ export struct Card6Component { | ||
| 53 | .alignContent(Alignment.BottomEnd) | 76 | .alignContent(Alignment.BottomEnd) |
| 54 | } | 77 | } |
| 55 | .onClick((event: ClickEvent) => { | 78 | .onClick((event: ClickEvent) => { |
| 79 | + this.clicked = true; | ||
| 56 | ProcessUtils.processPage(this.contentDTO) | 80 | ProcessUtils.processPage(this.contentDTO) |
| 57 | }) | 81 | }) |
| 58 | .padding({ | 82 | .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 |
| @@ -10,13 +12,20 @@ const TAG: string = 'Card9Component'; | @@ -10,13 +12,20 @@ const TAG: string = 'Card9Component'; | ||
| 10 | 12 | ||
| 11 | @Component | 13 | @Component |
| 12 | export struct Card9Component { | 14 | export struct Card9Component { |
| 13 | - @State contentDTO: ContentDTO = {} as ContentDTO; | 15 | + @State contentDTO: ContentDTO = new 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 | } |
| @@ -129,12 +136,13 @@ export struct Card9Component { | @@ -129,12 +136,13 @@ export struct Card9Component { | ||
| 129 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 136 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 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) { | ||
| 133 | - Image(item.fullColumnImgUrls[0].url) | ||
| 134 | - .width(90) | ||
| 135 | - .height(60) | ||
| 136 | - .borderRadius($r('app.float.image_border_radius')) | ||
| 137 | - } | 139 | + // if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) { |
| 140 | + // Image(this.loadImg? item.fullColumnImgUrls[0].url : '') | ||
| 141 | + // .backgroundColor(0xf5f5f5) | ||
| 142 | + // .width(90) | ||
| 143 | + // .height(60) | ||
| 144 | + // .borderRadius($r('app.float.image_border_radius')) | ||
| 145 | + // } | ||
| 138 | } | 146 | } |
| 139 | } | 147 | } |
| 140 | } | 148 | } |
| 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 | +} |
| 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'; |
| 15 | -import { ColorUtils } from '../../../utils/ColorUtils'; | 9 | +import NoMoreLayout from '../../page/NoMoreLayout'; |
| 10 | +import { EmptyComponent } from '../../view/EmptyComponent'; | ||
| 16 | 11 | ||
| 17 | const TAG = 'CommentComponent'; | 12 | const TAG = 'CommentComponent'; |
| 18 | 13 | ||
| @@ -23,18 +18,18 @@ const testString = '因为读书的人\n是低着头向上看的人\n身处一 | @@ -23,18 +18,18 @@ const testString = '因为读书的人\n是低着头向上看的人\n身处一 | ||
| 23 | @Component | 18 | @Component |
| 24 | export struct CommentComponent { | 19 | export struct CommentComponent { |
| 25 | @State hasMore: boolean = true; | 20 | @State hasMore: boolean = true; |
| 26 | - @State currentPage: number = 1; | ||
| 27 | - // @State private browSingModel: commentListModel = new commentListModel() | 21 | + @State currentPage: number = 1; |
| 22 | + @State isComments: boolean = true | ||
| 28 | /*必传*/ | 23 | /*必传*/ |
| 29 | @ObjectLink publishCommentModel: publishCommentModel | 24 | @ObjectLink publishCommentModel: publishCommentModel |
| 30 | - | ||
| 31 | listScroller: ListScroller = new ListScroller(); // scroller控制器 | 25 | listScroller: ListScroller = new ListScroller(); // scroller控制器 |
| 32 | historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset | 26 | historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset |
| 33 | - | ||
| 34 | isloading: boolean = false | 27 | isloading: boolean = false |
| 35 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); | 28 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); |
| 36 | @State dialogController: CustomDialogController | null = null; | 29 | @State dialogController: CustomDialogController | null = null; |
| 37 | 30 | ||
| 31 | + // @State private browSingModel: commentListModel = new commentListModel() | ||
| 32 | + | ||
| 38 | // 在自定义组件即将析构销毁时将dialogControlle置空 | 33 | // 在自定义组件即将析构销毁时将dialogControlle置空 |
| 39 | aboutToDisappear() { | 34 | aboutToDisappear() { |
| 40 | this.dialogController = null // 将dialogController置空 | 35 | this.dialogController = null // 将dialogController置空 |
| @@ -142,53 +137,63 @@ export struct CommentComponent { | @@ -142,53 +137,63 @@ export struct CommentComponent { | ||
| 142 | 137 | ||
| 143 | build() { | 138 | build() { |
| 144 | Column() { | 139 | Column() { |
| 145 | - List({scroller:this.listScroller}) { | 140 | + List({ scroller: this.listScroller }) { |
| 146 | ListItemGroup({ header: this.titleHeader() }) | 141 | ListItemGroup({ header: this.titleHeader() }) |
| 147 | 142 | ||
| 148 | - LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { | ||
| 149 | - if (item.hasMore) { | ||
| 150 | - ListItemGroup({ header: this.CommentHeaderItem(item, index), footer: this.GroupFooterView(item, index) }) { | ||
| 151 | - LazyForEach(item.childCommentsLazyDataSource, (childItem: commentItemModel, subIndex: number) => { | ||
| 152 | - ListItem() { | ||
| 153 | - ChildCommentItem({ | ||
| 154 | - item: childItem, | ||
| 155 | - dialogController: this.dialogController, | ||
| 156 | - publishCommentModel: this.publishCommentModel | ||
| 157 | - }); | ||
| 158 | - } | ||
| 159 | - .onClick(() => { | ||
| 160 | - console.log(TAG) | ||
| 161 | - }) | ||
| 162 | - }, (childItem: commentItemModel, subIndex: number) => JSON.stringify(childItem) + subIndex.toString()) | 143 | + if (!this.isComments) { |
| 144 | + EmptyComponent({ emptyType: 17 }) | ||
| 145 | + .height(300) | ||
| 146 | + } else { | ||
| 147 | + LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { | ||
| 148 | + if (item.hasMore) { | ||
| 149 | + ListItemGroup({ | ||
| 150 | + header: this.CommentHeaderItem(item, index), | ||
| 151 | + footer: this.GroupFooterView(item, index) | ||
| 152 | + }) { | ||
| 153 | + LazyForEach(item.childCommentsLazyDataSource, (childItem: commentItemModel, subIndex: number) => { | ||
| 154 | + ListItem() { | ||
| 155 | + ChildCommentItem({ | ||
| 156 | + item: childItem, | ||
| 157 | + dialogController: this.dialogController, | ||
| 158 | + publishCommentModel: this.publishCommentModel | ||
| 159 | + }); | ||
| 160 | + } | ||
| 161 | + .onClick(() => { | ||
| 162 | + console.log(TAG) | ||
| 163 | + }) | ||
| 164 | + }, (childItem: commentItemModel, subIndex: number) => JSON.stringify(childItem) + subIndex.toString()) | ||
| 165 | + } | ||
| 166 | + } else { | ||
| 167 | + ListItemGroup({ header: this.CommentHeaderItem(item, index) }) { | ||
| 168 | + LazyForEach(item.childCommentsLazyDataSource, (childItem: commentItemModel, subIndex: number) => { | ||
| 169 | + ListItem() { | ||
| 170 | + ChildCommentItem({ | ||
| 171 | + item: childItem, | ||
| 172 | + dialogController: this.dialogController, | ||
| 173 | + publishCommentModel: this.publishCommentModel | ||
| 174 | + }); | ||
| 175 | + } | ||
| 176 | + .onClick(() => { | ||
| 177 | + console.log(TAG) | ||
| 178 | + }) | ||
| 179 | + }, (childItem: commentItemModel, subIndex: number) => JSON.stringify(childItem) + subIndex.toString()) | ||
| 180 | + } | ||
| 163 | } | 181 | } |
| 164 | - } else { | ||
| 165 | - ListItemGroup({ header: this.CommentHeaderItem(item, index) }) { | ||
| 166 | - LazyForEach(item.childCommentsLazyDataSource, (childItem: commentItemModel, subIndex: number) => { | ||
| 167 | - ListItem() { | ||
| 168 | - ChildCommentItem({ | ||
| 169 | - item: childItem, | ||
| 170 | - dialogController: this.dialogController, | ||
| 171 | - publishCommentModel: this.publishCommentModel | ||
| 172 | - }); | ||
| 173 | - } | ||
| 174 | - .onClick(() => { | ||
| 175 | - console.log(TAG) | ||
| 176 | - }) | ||
| 177 | - }, (childItem: commentItemModel, subIndex: number) => JSON.stringify(childItem) + subIndex.toString()) | 182 | + }, (item: commentItemModel, index: number) => JSON.stringify(item) + index.toString()) |
| 183 | + | ||
| 184 | + // 加载更多 | ||
| 185 | + ListItem() { | ||
| 186 | + if (this.hasMore === false) { | ||
| 187 | + NoMoreLayout() | ||
| 178 | } | 188 | } |
| 179 | } | 189 | } |
| 180 | - }, (item: commentItemModel, index: number) => JSON.stringify(item) + index.toString()) | ||
| 181 | - | ||
| 182 | - // 加载更多 | ||
| 183 | - ListItem() { | ||
| 184 | - if (this.hasMore === false) NoMoreLayout() | ||
| 185 | } | 190 | } |
| 191 | + | ||
| 186 | } | 192 | } |
| 187 | - .onReachEnd(()=>{ | 193 | + .onReachEnd(() => { |
| 188 | if (this.hasMore) { | 194 | if (this.hasMore) { |
| 189 | this.getData() | 195 | this.getData() |
| 190 | } | 196 | } |
| 191 | - | ||
| 192 | }) | 197 | }) |
| 193 | .enableScrollInteraction(false) | 198 | .enableScrollInteraction(false) |
| 194 | } | 199 | } |
| @@ -197,14 +202,20 @@ export struct CommentComponent { | @@ -197,14 +202,20 @@ export struct CommentComponent { | ||
| 197 | 202 | ||
| 198 | //获取数据 | 203 | //获取数据 |
| 199 | async getData() { | 204 | async getData() { |
| 200 | - commentViewModel.fetchContentCommentList(this.currentPage + '', this.publishCommentModel.targetId, this.publishCommentModel.targetType) | 205 | + commentViewModel.fetchContentCommentList(this.currentPage + '', this.publishCommentModel.targetId, |
| 206 | + this.publishCommentModel.targetType) | ||
| 201 | .then(commentListModel => { | 207 | .then(commentListModel => { |
| 202 | this.currentPage++ | 208 | this.currentPage++ |
| 203 | 209 | ||
| 204 | - if (Number.parseInt(commentListModel.totalCommentNum) > Number.parseInt(this.publishCommentModel.totalCommentNumer)) { | 210 | + if (Number.parseInt(commentListModel.totalCommentNum) > |
| 211 | + Number.parseInt(this.publishCommentModel.totalCommentNumer)) { | ||
| 205 | this.publishCommentModel.totalCommentNumer = commentListModel.totalCommentNum + '' | 212 | this.publishCommentModel.totalCommentNumer = commentListModel.totalCommentNum + '' |
| 206 | } | 213 | } |
| 207 | 214 | ||
| 215 | + if (commentListModel.list.length === 0) { | ||
| 216 | + this.isComments = false | ||
| 217 | + } | ||
| 218 | + | ||
| 208 | if (commentListModel.hasNext === 0) { | 219 | if (commentListModel.hasNext === 0) { |
| 209 | this.hasMore = false; | 220 | this.hasMore = false; |
| 210 | } else { | 221 | } else { |
| @@ -223,11 +234,10 @@ export struct CommentComponent { | @@ -223,11 +234,10 @@ export struct CommentComponent { | ||
| 223 | }); | 234 | }); |
| 224 | 235 | ||
| 225 | 236 | ||
| 226 | - }else{ | 237 | + } else { |
| 227 | this.hasMore = false | 238 | this.hasMore = false |
| 228 | } | 239 | } |
| 229 | }) | 240 | }) |
| 230 | - | ||
| 231 | } | 241 | } |
| 232 | } | 242 | } |
| 233 | 243 | ||
| @@ -318,14 +328,7 @@ struct ChildCommentItem { | @@ -318,14 +328,7 @@ struct ChildCommentItem { | ||
| 318 | }) | 328 | }) |
| 319 | .margin({ left: 95, right: 16, top: -5 }) | 329 | .margin({ left: 95, right: 16, top: -5 }) |
| 320 | .onClick(() => { | 330 | .onClick(() => { |
| 321 | - | ||
| 322 | - | ||
| 323 | - this.publishCommentModel.rootCommentId = this.item.rootCommentId | ||
| 324 | - this.publishCommentModel.parentId = this.item.id | ||
| 325 | - this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':' | ||
| 326 | - if (this.dialogController != null) { | ||
| 327 | - this.dialogController.open() | ||
| 328 | - } | 331 | + this.replyComment() |
| 329 | }) | 332 | }) |
| 330 | 333 | ||
| 331 | 334 | ||
| @@ -337,6 +340,17 @@ struct ChildCommentItem { | @@ -337,6 +340,17 @@ struct ChildCommentItem { | ||
| 337 | }.alignItems(HorizontalAlign.Start) | 340 | }.alignItems(HorizontalAlign.Start) |
| 338 | .width('100%') | 341 | .width('100%') |
| 339 | } | 342 | } |
| 343 | + | ||
| 344 | + replyComment() { | ||
| 345 | + if (this.item.id && this.item.checkStatus == '2') { // 审核通过的才显示回复 | ||
| 346 | + this.publishCommentModel.rootCommentId = this.item.rootCommentId | ||
| 347 | + this.publishCommentModel.parentId = this.item.id | ||
| 348 | + this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':' | ||
| 349 | + if (this.dialogController != null) { | ||
| 350 | + this.dialogController.open() | ||
| 351 | + } | ||
| 352 | + } | ||
| 353 | + } | ||
| 340 | } | 354 | } |
| 341 | 355 | ||
| 342 | 356 | ||
| @@ -486,12 +500,7 @@ struct commentHeaderView { | @@ -486,12 +500,7 @@ struct commentHeaderView { | ||
| 486 | }) | 500 | }) |
| 487 | .margin({ left: 59, right: 16, top: -5 }) | 501 | .margin({ left: 59, right: 16, top: -5 }) |
| 488 | .onClick(() => { | 502 | .onClick(() => { |
| 489 | - this.publishCommentModel.rootCommentId = this.item.rootCommentId | ||
| 490 | - this.publishCommentModel.parentId = this.item.id | ||
| 491 | - this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':' | ||
| 492 | - if (this.dialogController != null) { | ||
| 493 | - this.dialogController.open() | ||
| 494 | - } | 503 | + this.replyComment() |
| 495 | }) | 504 | }) |
| 496 | 505 | ||
| 497 | commentFooterView({ | 506 | commentFooterView({ |
| @@ -501,6 +510,17 @@ struct commentHeaderView { | @@ -501,6 +510,17 @@ struct commentHeaderView { | ||
| 501 | }).margin({ left: 59, right: 16 }) | 510 | }).margin({ left: 59, right: 16 }) |
| 502 | }.alignItems(HorizontalAlign.Start) | 511 | }.alignItems(HorizontalAlign.Start) |
| 503 | } | 512 | } |
| 513 | + | ||
| 514 | + replyComment() { | ||
| 515 | + if (this.item.id && this.item.checkStatus == '2') { // 审核通过的才显示回复 | ||
| 516 | + this.publishCommentModel.rootCommentId = this.item.rootCommentId | ||
| 517 | + this.publishCommentModel.parentId = this.item.id | ||
| 518 | + this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':' | ||
| 519 | + if (this.dialogController != null) { | ||
| 520 | + this.dialogController.open() | ||
| 521 | + } | ||
| 522 | + } | ||
| 523 | + } | ||
| 504 | } | 524 | } |
| 505 | 525 | ||
| 506 | /*评论内容下面的IP地址时间点赞*/ | 526 | /*评论内容下面的IP地址时间点赞*/ |
| @@ -538,12 +558,7 @@ struct commentFooterView { | @@ -538,12 +558,7 @@ struct commentFooterView { | ||
| 538 | .fontColor($r('app.color.color_222222')) | 558 | .fontColor($r('app.color.color_222222')) |
| 539 | .fontSize(12) | 559 | .fontSize(12) |
| 540 | .onClick(() => { | 560 | .onClick(() => { |
| 541 | - this.publishCommentModel.rootCommentId = this.item.rootCommentId | ||
| 542 | - this.publishCommentModel.parentId = this.item.id | ||
| 543 | - this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':' | ||
| 544 | - if (this.dialogController != null) { | ||
| 545 | - this.dialogController.open() | ||
| 546 | - } | 561 | + this.replyComment() |
| 547 | }) | 562 | }) |
| 548 | } | 563 | } |
| 549 | } | 564 | } |
| @@ -570,6 +585,17 @@ struct commentFooterView { | @@ -570,6 +585,17 @@ struct commentFooterView { | ||
| 570 | .height(30) | 585 | .height(30) |
| 571 | } | 586 | } |
| 572 | 587 | ||
| 588 | + replyComment() { | ||
| 589 | + if (this.item.id && this.item.checkStatus == '2') { // 审核通过的才显示回复 | ||
| 590 | + this.publishCommentModel.rootCommentId = this.item.rootCommentId | ||
| 591 | + this.publishCommentModel.parentId = this.item.id | ||
| 592 | + this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':' | ||
| 593 | + if (this.dialogController != null) { | ||
| 594 | + this.dialogController.open() | ||
| 595 | + } | ||
| 596 | + } | ||
| 597 | + } | ||
| 598 | + | ||
| 573 | clickLike() { | 599 | clickLike() { |
| 574 | // 未登录,跳转登录 | 600 | // 未登录,跳转登录 |
| 575 | const user_id = HttpUtils.getUserId() | 601 | const user_id = HttpUtils.getUserId() |
| @@ -45,10 +45,31 @@ export struct CommentTabComponent { | @@ -45,10 +45,31 @@ export struct CommentTabComponent { | ||
| 45 | build() { | 45 | build() { |
| 46 | Row() { | 46 | Row() { |
| 47 | Stack({ alignContent: Alignment.Start }) { | 47 | Stack({ alignContent: Alignment.Start }) { |
| 48 | - Image($r('app.media.comment_img_input_hui')).width(151).height(30) | ||
| 49 | - 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 | + } | ||
| 50 | } | 70 | } |
| 51 | - }.width(151).height(30) | 71 | + } |
| 72 | + .height(30) | ||
| 52 | .onClick(() => { | 73 | .onClick(() => { |
| 53 | this.onCommentFocus && this.onCommentFocus() | 74 | this.onCommentFocus && this.onCommentFocus() |
| 54 | 75 |
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/QualityCommentsComponent.ets
| @@ -443,18 +443,14 @@ struct QualityCommentItem { | @@ -443,18 +443,14 @@ struct QualityCommentItem { | ||
| 443 | 443 | ||
| 444 | jumpToDetail() { | 444 | jumpToDetail() { |
| 445 | // programInfoModel.api_isCommentAction = YES; | 445 | // programInfoModel.api_isCommentAction = YES; |
| 446 | - | ||
| 447 | - let program: ContentDTO = { | ||
| 448 | - objectId: this.item.targetId, | ||
| 449 | - objectType: this.item.targetType, | ||
| 450 | - relId: this.item.targetRelId, | ||
| 451 | - relType: this.item.targetRelType, | ||
| 452 | - // objectLevel: this.item.topicType, | ||
| 453 | - pageId: this.item.pageId, | ||
| 454 | - linkUrl: this.item.h5Url, | ||
| 455 | - } as ContentDTO | ||
| 456 | - | ||
| 457 | - ProcessUtils.processPage(program) | 446 | + let content = new ContentDTO() |
| 447 | + content.objectId = this.item.targetId; | ||
| 448 | + content.objectType = this.item.targetType; | ||
| 449 | + content.relId = this.item.targetRelId; | ||
| 450 | + content.relType = this.item.targetRelType; | ||
| 451 | + content.pageId = this.item.pageId; | ||
| 452 | + content.linkUrl = this.item.h5Url; | ||
| 453 | + ProcessUtils.processPage(content) | ||
| 458 | } | 454 | } |
| 459 | 455 | ||
| 460 | replyComment() { | 456 | replyComment() { |
| 1 | import { CompDTO, ContentDTO, } from 'wdBean'; | 1 | import { CompDTO, ContentDTO, } from 'wdBean'; |
| 2 | -import { BreakpointConstants, CommonConstants, DurationEnum } from 'wdConstant'; | 2 | +import { BreakpointConstants, CommonConstants } from 'wdConstant'; |
| 3 | import { BreakPointType, Logger } from 'wdKit'; | 3 | 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'; | ||
| 9 | +import { Notes } from '../cardview/notes'; | ||
| 8 | 10 | ||
| 9 | const TAG = 'Zh_Carousel_Layout-01'; | 11 | const TAG = 'Zh_Carousel_Layout-01'; |
| 10 | 12 | ||
| @@ -39,19 +41,21 @@ class MyDataSource implements IDataSource { | @@ -39,19 +41,21 @@ class MyDataSource implements IDataSource { | ||
| 39 | 41 | ||
| 40 | @Component | 42 | @Component |
| 41 | export struct ZhCarouselLayout01 { | 43 | export struct ZhCarouselLayout01 { |
| 42 | - @StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS; | 44 | + @StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = |
| 45 | + BreakpointConstants.BREAKPOINT_XS; | ||
| 43 | @State compDTO: CompDTO = {} as CompDTO | 46 | @State compDTO: CompDTO = {} as CompDTO |
| 44 | - private data: MyDataSource = new MyDataSource([]) | ||
| 45 | @State firstWd: number = 0 | 47 | @State firstWd: number = 0 |
| 46 | @State SecondWd: number = 0 | 48 | @State SecondWd: number = 0 |
| 47 | @State swiperIndex: number = 0 | 49 | @State swiperIndex: number = 0 |
| 50 | + private data: MyDataSource = new MyDataSource([]) | ||
| 48 | 51 | ||
| 49 | watchCurrentBreakpoint() { | 52 | watchCurrentBreakpoint() { |
| 50 | Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`); | 53 | Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`); |
| 51 | } | 54 | } |
| 52 | 55 | ||
| 53 | aboutToAppear() { | 56 | aboutToAppear() { |
| 54 | - Logger.info(TAG, `aboutToAppear, beanList:${this.compDTO?.operDataList?.length}, currentBreakpoint:${this.currentBreakpoint}`); | 57 | + Logger.info(TAG, |
| 58 | + `aboutToAppear, beanList:${this.compDTO?.operDataList?.length}, currentBreakpoint:${this.currentBreakpoint}`); | ||
| 55 | let list: number[] = [] | 59 | let list: number[] = [] |
| 56 | for (let i = 1; i <= this.compDTO?.operDataList?.length; i++) { | 60 | for (let i = 1; i <= this.compDTO?.operDataList?.length; i++) { |
| 57 | list.push(i); | 61 | list.push(i); |
| @@ -154,22 +158,33 @@ export struct ZhCarouselLayout01 { | @@ -154,22 +158,33 @@ export struct ZhCarouselLayout01 { | ||
| 154 | } | 158 | } |
| 155 | 159 | ||
| 156 | public buildDisplayCount(): number { | 160 | public buildDisplayCount(): number { |
| 157 | - return new BreakPointType({ xs: 1, sm: 1, md: 2, lg: 3 }).getValue(this.currentBreakpoint) | 161 | + return new BreakPointType({ |
| 162 | + xs: 1, | ||
| 163 | + sm: 1, | ||
| 164 | + md: 2, | ||
| 165 | + lg: 3 | ||
| 166 | + }).getValue(this.currentBreakpoint) | ||
| 158 | } | 167 | } |
| 159 | } | 168 | } |
| 160 | 169 | ||
| 161 | 170 | ||
| 162 | @Component | 171 | @Component |
| 163 | struct CarouselLayout01CardView { | 172 | struct CarouselLayout01CardView { |
| 164 | - private item: ContentDTO = {} as ContentDTO; | 173 | + @State loadImg: boolean = false; |
| 174 | + private item: ContentDTO = new ContentDTO(); | ||
| 165 | private length: number = 1; // 轮播图数量 | 175 | private length: number = 1; // 轮播图数量 |
| 166 | 176 | ||
| 177 | + async aboutToAppear(): Promise<void> { | ||
| 178 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 179 | + } | ||
| 180 | + | ||
| 167 | build() { | 181 | build() { |
| 168 | Stack() { | 182 | Stack() { |
| 169 | - Image(this.item.coverUrl) | 183 | + Image(this.loadImg ? this.item.coverUrl : '') |
| 170 | .width(CommonConstants.FULL_PARENT) | 184 | .width(CommonConstants.FULL_PARENT) |
| 171 | .height(CommonConstants.FULL_PARENT) | 185 | .height(CommonConstants.FULL_PARENT) |
| 172 | .objectFit(ImageFit.Cover) | 186 | .objectFit(ImageFit.Cover) |
| 187 | + .backgroundColor(0xf5f5f5) | ||
| 173 | 188 | ||
| 174 | Row() | 189 | Row() |
| 175 | .width(CommonConstants.FULL_PARENT) | 190 | .width(CommonConstants.FULL_PARENT) |
| @@ -180,29 +195,37 @@ struct CarouselLayout01CardView { | @@ -180,29 +195,37 @@ struct CarouselLayout01CardView { | ||
| 180 | }) | 195 | }) |
| 181 | Column() { | 196 | Column() { |
| 182 | // 这里用于展示轮播图右上角信息,这里只对直播类型的展示 | 197 | // 这里用于展示轮播图右上角信息,这里只对直播类型的展示 |
| 183 | - if (this.item.objectType === '2' || this.item.objectType ==='4') { | 198 | + if (this.item.objectType === '2' || this.item.objectType === '4') { |
| 184 | CardMediaInfo({ contentDTO: this.item }) | 199 | CardMediaInfo({ contentDTO: this.item }) |
| 185 | .width(CommonConstants.FULL_PARENT) | 200 | .width(CommonConstants.FULL_PARENT) |
| 186 | } | 201 | } |
| 187 | Blank() | 202 | Blank() |
| 188 | // 文本信息 | 203 | // 文本信息 |
| 189 | - Text(`${this.item.corner}${this.item.newsTitle}`) | ||
| 190 | - .width(CommonConstants.FULL_PARENT) | ||
| 191 | - .height(39) | ||
| 192 | - .padding({ | ||
| 193 | - left: 10, | ||
| 194 | - right: 10 | ||
| 195 | - }) | ||
| 196 | - .margin({ | ||
| 197 | - bottom: this.length > 1 ? 28 : 10 | ||
| 198 | - }) | ||
| 199 | - .fontColor(Color.White) | ||
| 200 | - .fontSize($r('app.float.font_size_16')) | ||
| 201 | - .fontWeight(FontWeight.Medium) | ||
| 202 | - .textAlign(TextAlign.Start) | ||
| 203 | - .align(Alignment.Bottom) | ||
| 204 | - .maxLines(CompUtils.MAX_LINES_2) | ||
| 205 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | 204 | + Stack() { |
| 205 | + if (this.item.objectType == '5') { | ||
| 206 | + Notes({ objectType: this.item.objectType }) | ||
| 207 | + } | ||
| 208 | + Text(`${this.item.corner}${this.item.newsTitle}`) | ||
| 209 | + .width(CommonConstants.FULL_PARENT) | ||
| 210 | + .fontColor(Color.White) | ||
| 211 | + .fontSize($r('app.float.font_size_16')) | ||
| 212 | + .fontWeight(FontWeight.Medium) | ||
| 213 | + .textAlign(TextAlign.Start) | ||
| 214 | + .align(Alignment.Bottom) | ||
| 215 | + .maxLines(CompUtils.MAX_LINES_2) | ||
| 216 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 217 | + .textIndent(this.item.objectType == '5' ? 40 : 0) | ||
| 218 | + } | ||
| 219 | + // .height(39) | ||
| 220 | + .padding({ | ||
| 221 | + left: 10, | ||
| 222 | + right: 10 | ||
| 223 | + }) | ||
| 224 | + .margin({ | ||
| 225 | + bottom: this.length > 1 ? 28 : 10 | ||
| 226 | + }) | ||
| 227 | + .alignContent(Alignment.TopStart) | ||
| 228 | + | ||
| 206 | } | 229 | } |
| 207 | .width(CommonConstants.FULL_PARENT) | 230 | .width(CommonConstants.FULL_PARENT) |
| 208 | .height(CommonConstants.FULL_PARENT) | 231 | .height(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) |
| 1 | -import { CompDTO, ContentDTO, Params, Action } from 'wdBean'; | 1 | +import { CompDTO, ContentDTO, Params, Action, ReserveItemBean} from 'wdBean'; |
| 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 3 | import { postInteractAccentionOperateParams } from 'wdBean'; | 3 | 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 | * 直播预约卡 |
| @@ -14,11 +16,6 @@ import { Logger, ToastUtils } from 'wdKit'; | @@ -14,11 +16,6 @@ import { Logger, ToastUtils } from 'wdKit'; | ||
| 14 | */ | 16 | */ |
| 15 | const TAG = 'Zh_Single_Row-03' | 17 | const TAG = 'Zh_Single_Row-03' |
| 16 | 18 | ||
| 17 | -interface reserveItem { | ||
| 18 | - liveId: number, | ||
| 19 | - relationId: string, | ||
| 20 | - subscribe: boolean | ||
| 21 | -} | ||
| 22 | 19 | ||
| 23 | interface reserveReqItem { | 20 | interface reserveReqItem { |
| 24 | liveId: string, | 21 | liveId: string, |
| @@ -32,24 +29,28 @@ export struct ZhSingleRow03 { | @@ -32,24 +29,28 @@ export struct ZhSingleRow03 { | ||
| 32 | @State isEndEdge: boolean = false; | 29 | @State isEndEdge: boolean = false; |
| 33 | // @State reserveStatus: reserveItem[] = [] | 30 | // @State reserveStatus: reserveItem[] = [] |
| 34 | @State reservedIds: string[] = []; | 31 | @State reservedIds: string[] = []; |
| 35 | - scroller: Scroller = new Scroller() | 32 | + @State loadImg: boolean = false; |
| 36 | 33 | ||
| 37 | - aboutToAppear(): void { | 34 | + async aboutToAppear(): Promise<void> { |
| 38 | this.getReserveState(); | 35 | this.getReserveState(); |
| 36 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 39 | } | 37 | } |
| 40 | 38 | ||
| 39 | + scroller: Scroller = new Scroller() | ||
| 40 | + | ||
| 41 | // 请求所有预约状态 | 41 | // 请求所有预约状态 |
| 42 | async getReserveState() { | 42 | async getReserveState() { |
| 43 | const reserveBean: reserveReqItem[] = this.compDTO.operDataList.map((item: ContentDTO) => { | 43 | const reserveBean: reserveReqItem[] = this.compDTO.operDataList.map((item: ContentDTO) => { |
| 44 | const reqItem: reserveReqItem = { | 44 | const reqItem: reserveReqItem = { |
| 45 | - liveId: item.objectId, | ||
| 46 | - relationId: item.relId | 45 | + liveId: item.objectId.toString(), |
| 46 | + relationId: item.relId.toString() | ||
| 47 | } | 47 | } |
| 48 | return reqItem; | 48 | return reqItem; |
| 49 | }) | 49 | }) |
| 50 | const res = await LiveModel.getAppointmentStatus(reserveBean); | 50 | const res = await LiveModel.getAppointmentStatus(reserveBean); |
| 51 | // this.reserveStatus = res; | 51 | // this.reserveStatus = res; |
| 52 | - res.map((item: reserveItem) => { | 52 | + Logger.debug(TAG, '数据信息:' + `${JSON.stringify(res)}`) |
| 53 | + res.map((item: ReserveItemBean) => { | ||
| 53 | if (item.subscribe) { | 54 | if (item.subscribe) { |
| 54 | this.reservedIds.push(item.liveId.toString()) | 55 | this.reservedIds.push(item.liveId.toString()) |
| 55 | } | 56 | } |
| @@ -63,6 +64,13 @@ export struct ZhSingleRow03 { | @@ -63,6 +64,13 @@ export struct ZhSingleRow03 { | ||
| 63 | 64 | ||
| 64 | // 预约/取消预约 | 65 | // 预约/取消预约 |
| 65 | async bookAndCancel(relationId: string, liveId: string, isSubscribe: boolean) { | 66 | async bookAndCancel(relationId: string, liveId: string, isSubscribe: boolean) { |
| 67 | + // 未登录,跳转登录 | ||
| 68 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 69 | + if (!user_id) { | ||
| 70 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 71 | + return | ||
| 72 | + } | ||
| 73 | + | ||
| 66 | const res = await LiveModel.liveAppointment(relationId.toString(), liveId.toString(), isSubscribe); | 74 | const res = await LiveModel.liveAppointment(relationId.toString(), liveId.toString(), isSubscribe); |
| 67 | if (res.code == 0) { | 75 | if (res.code == 0) { |
| 68 | ToastUtils.shortToast(isSubscribe ? '预约成功' : '取消预约成功') | 76 | ToastUtils.shortToast(isSubscribe ? '预约成功' : '取消预约成功') |
| @@ -128,10 +136,12 @@ export struct ZhSingleRow03 { | @@ -128,10 +136,12 @@ export struct ZhSingleRow03 { | ||
| 128 | ItemCard(item: ContentDTO) { | 136 | ItemCard(item: ContentDTO) { |
| 129 | Column() { | 137 | Column() { |
| 130 | Row() { | 138 | Row() { |
| 131 | - Image(item.coverUrl) | 139 | + Image(this.loadImg ? item.coverUrl : '') |
| 132 | .width(106) | 140 | .width(106) |
| 133 | .height(60) | 141 | .height(60) |
| 134 | .margin({right: 12}) | 142 | .margin({right: 12}) |
| 143 | + .backgroundColor(0xf5f5f5) | ||
| 144 | + | ||
| 135 | Text(item.newsTitle) | 145 | Text(item.newsTitle) |
| 136 | .width(154) | 146 | .width(154) |
| 137 | .height(60) | 147 | .height(60) |
| @@ -256,11 +266,17 @@ function textOverflowStyle(maxLine: number) { | @@ -256,11 +266,17 @@ function textOverflowStyle(maxLine: number) { | ||
| 256 | struct CreatorItem { | 266 | struct CreatorItem { |
| 257 | @Prop item: ContentDTO | 267 | @Prop item: ContentDTO |
| 258 | @State rmhIsAttention: number = 0 | 268 | @State rmhIsAttention: number = 0 |
| 269 | + @State loadImg: boolean = false; | ||
| 270 | + | ||
| 271 | + async aboutToAppear(): Promise<void> { | ||
| 272 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 273 | + } | ||
| 259 | build() { | 274 | build() { |
| 260 | ListItem() { | 275 | ListItem() { |
| 261 | Column() { | 276 | Column() { |
| 262 | Stack({ alignContent: Alignment.Bottom }) { | 277 | Stack({ alignContent: Alignment.Bottom }) { |
| 263 | - Image(this.item.coverUrl) | 278 | + Image(this.loadImg ? this.item.coverUrl : '') |
| 279 | + .backgroundColor(0xf5f5f5) | ||
| 264 | .width(156) | 280 | .width(156) |
| 265 | .height(208) | 281 | .height(208) |
| 266 | Row() | 282 | 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) |
| @@ -78,7 +91,7 @@ export struct ZhSingleRow06 { | @@ -78,7 +91,7 @@ export struct ZhSingleRow06 { | ||
| 78 | 91 | ||
| 79 | Row() { | 92 | Row() { |
| 80 | Text(DateTimeUtils.getCommentTime(this.compDTO.operDataList[0]?.commentInfo?.publishTime)) | 93 | Text(DateTimeUtils.getCommentTime(this.compDTO.operDataList[0]?.commentInfo?.publishTime)) |
| 81 | - .fontSize(14) | 94 | + .fontSize(12) |
| 82 | .fontColor(0x999999) | 95 | .fontColor(0x999999) |
| 83 | 96 | ||
| 84 | Row(){ | 97 | Row(){ |
| @@ -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) |
| @@ -78,6 +78,14 @@ export default struct MinePagePersonFunctionUI { | @@ -78,6 +78,14 @@ export default struct MinePagePersonFunctionUI { | ||
| 78 | WDRouterRule.jumpWithPage(WDRouterPage.browsingHistoryPage) | 78 | WDRouterRule.jumpWithPage(WDRouterPage.browsingHistoryPage) |
| 79 | break; | 79 | break; |
| 80 | } | 80 | } |
| 81 | + case "消息":{ | ||
| 82 | + if(!this.isLogin){ | ||
| 83 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 84 | + return | ||
| 85 | + } | ||
| 86 | + WDRouterRule.jumpWithPage(WDRouterPage.mineMessagePage) | ||
| 87 | + break; | ||
| 88 | + } | ||
| 81 | } | 89 | } |
| 82 | }).width('169lpx') | 90 | }).width('169lpx') |
| 83 | .height('117lpx') | 91 | .height('117lpx') |
| @@ -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 |
| @@ -80,6 +80,7 @@ export struct FollowChildComponent{ | @@ -80,6 +80,7 @@ export struct FollowChildComponent{ | ||
| 80 | } | 80 | } |
| 81 | .justifyContent(FlexAlign.Center) | 81 | .justifyContent(FlexAlign.Center) |
| 82 | .width('100lpx') | 82 | .width('100lpx') |
| 83 | + .backgroundColor($r("app.color.color_F5F5F5")) | ||
| 83 | .height('46lpx') | 84 | .height('46lpx') |
| 84 | .onClick(()=>{ | 85 | .onClick(()=>{ |
| 85 | this.followOperation() | 86 | this.followOperation() |
| @@ -115,10 +116,9 @@ export struct FollowChildComponent{ | @@ -115,10 +116,9 @@ export struct FollowChildComponent{ | ||
| 115 | }.height('202lpx') | 116 | }.height('202lpx') |
| 116 | .justifyContent(FlexAlign.Start) | 117 | .justifyContent(FlexAlign.Start) |
| 117 | 118 | ||
| 118 | - Divider().width('100%') | ||
| 119 | - .height('1lpx') | ||
| 120 | - .strokeWidth('1lpx') | ||
| 121 | - .backgroundColor($r('app.color.color_EDEDED')) | 119 | + Text().backgroundColor($r('app.color.color_EDEDED')) |
| 120 | + .width('100%') | ||
| 121 | + .height('2lpx') | ||
| 122 | }.width('100%') | 122 | }.width('100%') |
| 123 | 123 | ||
| 124 | }else { | 124 | }else { |
| @@ -193,6 +193,7 @@ export struct FollowChildComponent{ | @@ -193,6 +193,7 @@ export struct FollowChildComponent{ | ||
| 193 | .fontWeight('500lpx') | 193 | .fontWeight('500lpx') |
| 194 | .lineHeight('35lpx') | 194 | .lineHeight('35lpx') |
| 195 | } | 195 | } |
| 196 | + .backgroundColor($r("app.color.color_F5F5F5")) | ||
| 196 | .justifyContent(FlexAlign.Center) | 197 | .justifyContent(FlexAlign.Center) |
| 197 | .width('100lpx') | 198 | .width('100lpx') |
| 198 | .height('46lpx') | 199 | .height('46lpx') |
| @@ -228,13 +229,10 @@ export struct FollowChildComponent{ | @@ -228,13 +229,10 @@ export struct FollowChildComponent{ | ||
| 228 | 229 | ||
| 229 | }.height('146lpx') | 230 | }.height('146lpx') |
| 230 | .justifyContent(FlexAlign.Center) | 231 | .justifyContent(FlexAlign.Center) |
| 231 | - .onClick(()=>{ | ||
| 232 | - }) | ||
| 233 | 232 | ||
| 234 | - Divider().width('100%') | ||
| 235 | - .height('1lpx') | ||
| 236 | - .strokeWidth('1lpx') | ||
| 237 | - .backgroundColor($r('app.color.color_EDEDED')) | 233 | + Text().backgroundColor($r('app.color.color_EDEDED')) |
| 234 | + .width('100%') | ||
| 235 | + .height('2lpx') | ||
| 238 | }.width('100%') | 236 | }.width('100%') |
| 239 | 237 | ||
| 240 | } | 238 | } |
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%') | ||
| 20 | - .height('1lpx') | ||
| 21 | - .strokeWidth('1lpx') | ||
| 22 | - .backgroundColor($r('app.color.color_EDEDED')) | 19 | + Text().backgroundColor($r('app.color.color_EDEDED')) |
| 20 | + .width('100%') | ||
| 21 | + .height('2lpx') | ||
| 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')) |
| @@ -195,13 +195,12 @@ export struct ChildCommentComponent { | @@ -195,13 +195,12 @@ export struct ChildCommentComponent { | ||
| 195 | }.height('69lpx') | 195 | }.height('69lpx') |
| 196 | .justifyContent(FlexAlign.Center) | 196 | .justifyContent(FlexAlign.Center) |
| 197 | .onClick(() => { | 197 | .onClick(() => { |
| 198 | - ProcessUtils.processPage( | ||
| 199 | - { | ||
| 200 | - objectId: this.data.targetId, | ||
| 201 | - relType: this.data.targetRelType + "", | ||
| 202 | - relId: this.data.targetRelId, | ||
| 203 | - objectType: this.data.targetType + "", | ||
| 204 | - } as ContentDTO) | 198 | + let content = new ContentDTO() |
| 199 | + content.objectId = this.data.targetId; | ||
| 200 | + content.relType = this.data.targetRelType + ""; | ||
| 201 | + content.relId = this.data.targetRelId; | ||
| 202 | + content.objectType = this.data.targetType + ""; | ||
| 203 | + ProcessUtils.processPage(content) | ||
| 205 | }) | 204 | }) |
| 206 | } | 205 | } |
| 207 | .margin({ top: '19lpx', bottom: '31lpx', left: '31lpx', right: '31lpx' }) | 206 | .margin({ top: '19lpx', bottom: '31lpx', left: '31lpx', right: '31lpx' }) |
sight_harmony/features/wdComponent/src/main/ets/components/mine/message/MessageListUI.ets
0 → 100644
| 1 | +import { StringUtils, ToastUtils } from 'wdKit/Index' | ||
| 2 | +import MinePageDatasModel from '../../../model/MinePageDatasModel' | ||
| 3 | +import { MessageItem } from '../../../viewmodel/MessageItem' | ||
| 4 | +import { CustomTitleUI } from '../../reusable/CustomTitleUI' | ||
| 5 | + | ||
| 6 | +const TAG = "MessageListUI" | ||
| 7 | + | ||
| 8 | +@Component | ||
| 9 | +export struct MessageListUI { | ||
| 10 | + @State msgData: MessageItem[] = [] | ||
| 11 | + | ||
| 12 | + aboutToAppear() { | ||
| 13 | + this.msgData = MinePageDatasModel.getMessageData() | ||
| 14 | + } | ||
| 15 | + | ||
| 16 | + build() { | ||
| 17 | + Column() { | ||
| 18 | + //标题栏目 | ||
| 19 | + CustomTitleUI({ titleName: "消息" }) | ||
| 20 | + | ||
| 21 | + List() { | ||
| 22 | + ForEach(this.msgData, (item: MessageItem, index: number) => { | ||
| 23 | + ListItem() { | ||
| 24 | + Column(){ | ||
| 25 | + Column() { | ||
| 26 | + Row() { | ||
| 27 | + Row() { | ||
| 28 | + Image(item.imgSrc) | ||
| 29 | + .objectFit(ImageFit.Auto) | ||
| 30 | + .width('92lpx') | ||
| 31 | + .height('92lpx') | ||
| 32 | + .margin({ right: '15lpx' }) | ||
| 33 | + | ||
| 34 | + Column() { | ||
| 35 | + Text(item.title) | ||
| 36 | + .fontWeight(500) | ||
| 37 | + .fontSize('31lpx') | ||
| 38 | + .lineHeight('42lpx') | ||
| 39 | + .fontColor($r('app.color.color_222222')) | ||
| 40 | + .maxLines(1) | ||
| 41 | + .margin({ bottom: StringUtils.isNotEmpty(item.desc)?'8lpx':0 }) | ||
| 42 | + | ||
| 43 | + if(StringUtils.isNotEmpty(item.desc)){ | ||
| 44 | + Text(`${item.desc}`) | ||
| 45 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 46 | + .fontSize('23lpx') | ||
| 47 | + .lineHeight('38lpx') | ||
| 48 | + .fontWeight(400) | ||
| 49 | + .maxLines(1) | ||
| 50 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + .height('92lpx') | ||
| 54 | + .layoutWeight(1) | ||
| 55 | + .alignItems(HorizontalAlign.Start) | ||
| 56 | + .justifyContent(StringUtils.isNotEmpty(item.desc)?FlexAlign.Start:FlexAlign.Center) | ||
| 57 | + }.layoutWeight(1) | ||
| 58 | + | ||
| 59 | + Row() { | ||
| 60 | + Text(`${item.time}`) | ||
| 61 | + .fontColor($r('app.color.color_999999')) | ||
| 62 | + .fontSize('23lpx') | ||
| 63 | + .fontWeight(500) | ||
| 64 | + .lineHeight('35lpx') | ||
| 65 | + } | ||
| 66 | + .justifyContent(FlexAlign.Start) | ||
| 67 | + .alignItems(VerticalAlign.Top) | ||
| 68 | + .height('92lpx') | ||
| 69 | + } | ||
| 70 | + .width('100%') | ||
| 71 | + .height('92lpx') | ||
| 72 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 73 | + | ||
| 74 | + }.height('154lpx') | ||
| 75 | + .width("100%") | ||
| 76 | + .justifyContent(FlexAlign.Center) | ||
| 77 | + | ||
| 78 | + Text().backgroundColor($r('app.color.color_EDEDED')) | ||
| 79 | + .width('100%') | ||
| 80 | + .height('1lpx') | ||
| 81 | + .visibility(index != 3 ?Visibility.Visible:Visibility.None) | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + .padding({left:"31lpx",right:"31lpx"}) | ||
| 85 | + .onClick(() => { | ||
| 86 | + ToastUtils.shortToast(index+"") | ||
| 87 | + switch (index) { | ||
| 88 | + case 0: //互动消息 | ||
| 89 | + break; | ||
| 90 | + case 1: //预约消息 | ||
| 91 | + break; | ||
| 92 | + case 2: //历史推送 | ||
| 93 | + break; | ||
| 94 | + case 3: //系统消息 | ||
| 95 | + break; | ||
| 96 | + } | ||
| 97 | + }) | ||
| 98 | + .height('154lpx') | ||
| 99 | + .width("100%") | ||
| 100 | + }) | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + .backgroundColor($r('app.color.white')) | ||
| 104 | + .height('100%') | ||
| 105 | + .width('100%') | ||
| 106 | + } | ||
| 107 | +} |
| @@ -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(); |
| @@ -76,35 +77,41 @@ export struct BottomNavigationComponent { | @@ -76,35 +77,41 @@ export struct BottomNavigationComponent { | ||
| 76 | Tabs({ barPosition: BarPosition.End, index: this.currentNavIndex, controller: this.navController }) { | 77 | Tabs({ barPosition: BarPosition.End, index: this.currentNavIndex, controller: this.navController }) { |
| 77 | ForEach(this.bottomNavList, (navItem: BottomNavDTO, index: number) => { | 78 | ForEach(this.bottomNavList, (navItem: BottomNavDTO, index: number) => { |
| 78 | TabContent() { | 79 | TabContent() { |
| 79 | - Column() { | ||
| 80 | - if (CompUtils.isMine(navItem)) { | ||
| 81 | - // 我的页面组件数据列表 | ||
| 82 | - MinePageComponent() | ||
| 83 | - } else { | ||
| 84 | - TopNavigationComponent({ | ||
| 85 | - groupId: navItem.id, | ||
| 86 | - topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), | ||
| 87 | - _currentNavIndex: $currentNavIndex, | ||
| 88 | - navIndex: index, | ||
| 89 | - currentBottomNavName: navItem.name, | ||
| 90 | - assignChannel: this.assignChannel, | ||
| 91 | - autoRefresh: this.autoRefresh | ||
| 92 | - }) | ||
| 93 | - } | ||
| 94 | - | 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 | + }) | ||
| 95 | } | 99 | } |
| 96 | } | 100 | } |
| 97 | .tabBar(this.tabBarBuilder(navItem, index)) | 101 | .tabBar(this.tabBarBuilder(navItem, index)) |
| 102 | + | ||
| 103 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) | ||
| 98 | }); | 104 | }); |
| 99 | 105 | ||
| 100 | } | 106 | } |
| 107 | + .scrollable(false) | ||
| 101 | .animationDuration(0) | 108 | .animationDuration(0) |
| 102 | .barHeight($r('app.float.bottom_navigation_barHeight')) | 109 | .barHeight($r('app.float.bottom_navigation_barHeight')) |
| 103 | .barMode(BarMode.Fixed) | 110 | .barMode(BarMode.Fixed) |
| 104 | .barBackgroundColor(this.barBackgroundColor) | 111 | .barBackgroundColor(this.barBackgroundColor) |
| 105 | // 备注:鸿蒙目前只有修改三线导航背景方法,对于全面屏导航条手机需要设置背景色并使其扩散到导航区域 | 112 | // 备注:鸿蒙目前只有修改三线导航背景方法,对于全面屏导航条手机需要设置背景色并使其扩散到导航区域 |
| 106 | .backgroundColor(this.barBackgroundColor) | 113 | .backgroundColor(this.barBackgroundColor) |
| 107 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | 114 | + .expandSafeArea([SafeAreaType.SYSTEM]) |
| 108 | 115 | ||
| 109 | // .padding({ bottom: this.bottomRectHeight + 'px', top: this.topRectHeight + 'px' }) // 此处margin具体数值在实际中应与导航条区域高度保持一致 | 116 | // .padding({ bottom: this.bottomRectHeight + 'px', top: this.topRectHeight + 'px' }) // 此处margin具体数值在实际中应与导航条区域高度保持一致 |
| 110 | 117 | ||
| @@ -115,7 +122,12 @@ export struct BottomNavigationComponent { | @@ -115,7 +122,12 @@ export struct BottomNavigationComponent { | ||
| 115 | Stack({ alignContent: Alignment.Bottom }) { | 122 | Stack({ alignContent: Alignment.Bottom }) { |
| 116 | Image(this.currentNavIndex === index ? navItem.iconC : navItem.icon) | 123 | Image(this.currentNavIndex === index ? navItem.iconC : navItem.icon) |
| 117 | .height(CommonConstants.FULL_PARENT) | 124 | .height(CommonConstants.FULL_PARENT) |
| 118 | - .padding({ bottom: 15, left: 10, right: 10, top: 2 }) | 125 | + .padding({ |
| 126 | + bottom: 15, | ||
| 127 | + left: 10, | ||
| 128 | + right: 10, | ||
| 129 | + top: 2 | ||
| 130 | + }) | ||
| 119 | .aspectRatio(this.ASPECT_RATIO_1_1) | 131 | .aspectRatio(this.ASPECT_RATIO_1_1) |
| 120 | 132 | ||
| 121 | Text(navItem.name) | 133 | Text(navItem.name) |
| @@ -130,13 +142,13 @@ export struct BottomNavigationComponent { | @@ -130,13 +142,13 @@ export struct BottomNavigationComponent { | ||
| 130 | .hoverEffect(HoverEffect.Highlight) | 142 | .hoverEffect(HoverEffect.Highlight) |
| 131 | .onClick(() => { | 143 | .onClick(() => { |
| 132 | Logger.info(TAG, `onChange, index: ${index}`); | 144 | Logger.info(TAG, `onChange, index: ${index}`); |
| 133 | - this.onBottomNavigationIndexChange(navItem,index) | 145 | + this.onBottomNavigationIndexChange(navItem, index) |
| 134 | }) | 146 | }) |
| 135 | 147 | ||
| 136 | } | 148 | } |
| 137 | 149 | ||
| 138 | // 底导切换函数 | 150 | // 底导切换函数 |
| 139 | - async onBottomNavigationIndexChange(navItem:BottomNavDTO,index:number) { | 151 | + async onBottomNavigationIndexChange(navItem: BottomNavDTO, index: number) { |
| 140 | Logger.info(TAG, `onBottomNavigationIndexChange this.currentNavIndex: ${this.currentNavIndex}`); | 152 | Logger.info(TAG, `onBottomNavigationIndexChange this.currentNavIndex: ${this.currentNavIndex}`); |
| 141 | if (navItem.name === '我的') { | 153 | if (navItem.name === '我的') { |
| 142 | this.barBackgroundColor = Color.White | 154 | this.barBackgroundColor = Color.White |
| @@ -154,8 +166,9 @@ export struct BottomNavigationComponent { | @@ -154,8 +166,9 @@ export struct BottomNavigationComponent { | ||
| 154 | 166 | ||
| 155 | // 请求顶导数据(参数): | 167 | // 请求顶导数据(参数): |
| 156 | } | 168 | } |
| 169 | + | ||
| 157 | //请求顶导数据 | 170 | //请求顶导数据 |
| 158 | - async getTopNavList(id:number){ | 171 | + async getTopNavList(id: number) { |
| 159 | let bottomNavDetail = await PageViewModel.getBottomNavDetailData(id) | 172 | let bottomNavDetail = await PageViewModel.getBottomNavDetailData(id) |
| 160 | this.topNavList = bottomNavDetail?.topNavChannelList || [] | 173 | this.topNavList = bottomNavDetail?.topNavChannelList || [] |
| 161 | } | 174 | } |
| @@ -7,7 +7,6 @@ import { ErrorComponent } from '../view/ErrorComponent' | @@ -7,7 +7,6 @@ import { ErrorComponent } from '../view/ErrorComponent' | ||
| 7 | import RefreshLayout from './RefreshLayout' | 7 | import RefreshLayout from './RefreshLayout' |
| 8 | import { RefreshLayoutBean } from './RefreshLayoutBean'; | 8 | import { RefreshLayoutBean } from './RefreshLayoutBean'; |
| 9 | import { CompDTO, ContentDTO } from 'wdBean' | 9 | import { CompDTO, ContentDTO } from 'wdBean' |
| 10 | -import LoadMoreLayout from './LoadMoreLayout' | ||
| 11 | import NoMoreLayout from './NoMoreLayout' | 10 | import NoMoreLayout from './NoMoreLayout' |
| 12 | import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; | 11 | import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; |
| 13 | import { CustomSelectUI } from '../view/CustomSelectUI'; | 12 | import { CustomSelectUI } from '../view/CustomSelectUI'; |
| 1 | -import { Action, ContentDTO, Params } from 'wdBean'; | 1 | +import { Action, ContentDTO, Params, InteractDataDTO } from 'wdBean'; |
| 2 | import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant'; | 2 | import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant'; |
| 3 | import { Logger, ToastUtils, DateTimeUtils } from 'wdKit'; | 3 | import { Logger, ToastUtils, DateTimeUtils } from 'wdKit'; |
| 4 | import { CompUtils } from '../../utils/CompUtils'; | 4 | import { CompUtils } from '../../utils/CompUtils'; |
| @@ -15,7 +15,7 @@ const TAG: string = 'CardView'; | @@ -15,7 +15,7 @@ const TAG: string = 'CardView'; | ||
| 15 | */ | 15 | */ |
| 16 | @Component | 16 | @Component |
| 17 | export struct CarouselLayout01CardView { | 17 | export struct CarouselLayout01CardView { |
| 18 | - private item: ContentDTO = {} as ContentDTO; | 18 | + private item: ContentDTO = new ContentDTO(); |
| 19 | private index: number = -1; | 19 | private index: number = -1; |
| 20 | 20 | ||
| 21 | build() { | 21 | build() { |
| @@ -85,7 +85,7 @@ export struct CarouselLayout01CardView { | @@ -85,7 +85,7 @@ export struct CarouselLayout01CardView { | ||
| 85 | */ | 85 | */ |
| 86 | @Component | 86 | @Component |
| 87 | export struct SingleColumn01CardView { | 87 | export struct SingleColumn01CardView { |
| 88 | - private item: ContentDTO = {} as ContentDTO; | 88 | + private item: ContentDTO = new ContentDTO(); |
| 89 | private index: number = -1; | 89 | private index: number = -1; |
| 90 | 90 | ||
| 91 | build() { | 91 | build() { |
| @@ -164,7 +164,7 @@ export struct SingleColumn01CardView { | @@ -164,7 +164,7 @@ export struct SingleColumn01CardView { | ||
| 164 | */ | 164 | */ |
| 165 | @Component | 165 | @Component |
| 166 | export struct SingleColumn02CardView { | 166 | export struct SingleColumn02CardView { |
| 167 | - private item: ContentDTO = {} as ContentDTO; | 167 | + private item: ContentDTO = new ContentDTO(); |
| 168 | private index: number = -1; | 168 | private index: number = -1; |
| 169 | 169 | ||
| 170 | build() { | 170 | build() { |
| @@ -288,7 +288,7 @@ export struct SingleColumn02CardView { | @@ -288,7 +288,7 @@ export struct SingleColumn02CardView { | ||
| 288 | */ | 288 | */ |
| 289 | @Component | 289 | @Component |
| 290 | export struct MasonryLayout01CardView { | 290 | export struct MasonryLayout01CardView { |
| 291 | - private item: ContentDTO = {} as ContentDTO; | 291 | + private item: ContentDTO = new ContentDTO(); |
| 292 | private index: number = -1; | 292 | private index: number = -1; |
| 293 | 293 | ||
| 294 | build() { | 294 | build() { |
| @@ -387,8 +387,10 @@ export struct MasonryLayout01CardView { | @@ -387,8 +387,10 @@ export struct MasonryLayout01CardView { | ||
| 387 | */ | 387 | */ |
| 388 | @Component | 388 | @Component |
| 389 | export struct PaperSingleColumn999CardView { | 389 | export struct PaperSingleColumn999CardView { |
| 390 | - private item: ContentDTO = {} as ContentDTO; | 390 | + private item: ContentDTO = new ContentDTO(); |
| 391 | private index: number = -1; | 391 | private index: number = -1; |
| 392 | + @State interactData: InteractDataDTO = {} as InteractDataDTO; | ||
| 393 | + @Consume @Watch('onChangeCommentList') commentList: InteractDataDTO[] | ||
| 392 | 394 | ||
| 393 | getPublishTime(): string { | 395 | getPublishTime(): string { |
| 394 | const publishTimestamp = parseInt(this.item?.publishTime) | 396 | const publishTimestamp = parseInt(this.item?.publishTime) |
| @@ -471,7 +473,7 @@ export struct PaperSingleColumn999CardView { | @@ -471,7 +473,7 @@ export struct PaperSingleColumn999CardView { | ||
| 471 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | 473 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 |
| 472 | .margin({ left: 22, right: 22 }) | 474 | .margin({ left: 22, right: 22 }) |
| 473 | } | 475 | } |
| 474 | - if (this.item?.visitorComment) { | 476 | + if (this.item) { |
| 475 | Row() { | 477 | Row() { |
| 476 | Row() { | 478 | Row() { |
| 477 | Text(this.item?.source) | 479 | Text(this.item?.source) |
| @@ -485,10 +487,17 @@ export struct PaperSingleColumn999CardView { | @@ -485,10 +487,17 @@ export struct PaperSingleColumn999CardView { | ||
| 485 | Text(this.getPublishTime()) | 487 | Text(this.getPublishTime()) |
| 486 | .fontSize(12) | 488 | .fontSize(12) |
| 487 | .fontColor(Color.Gray) | 489 | .fontColor(Color.Gray) |
| 488 | - Text(this.item?.visitorComment + "评") | ||
| 489 | - .fontSize(12) | ||
| 490 | - .fontColor(Color.Gray) | ||
| 491 | - .margin({ left: 6 }) | 490 | + if (this.interactData && this.interactData.commentNum) { |
| 491 | + Text(this.interactData.commentNum + "评") | ||
| 492 | + .fontSize(12) | ||
| 493 | + .fontColor(Color.Gray) | ||
| 494 | + .margin({ left: 6 }) | ||
| 495 | + }else if (this.commentList && this.commentList.length) { | ||
| 496 | + Text(this.interactData.commentNum + "评") | ||
| 497 | + .fontSize(12) | ||
| 498 | + .fontColor(Color.Gray) | ||
| 499 | + .margin({ left: 6 }) | ||
| 500 | + } | ||
| 492 | } | 501 | } |
| 493 | .justifyContent(FlexAlign.Start) | 502 | .justifyContent(FlexAlign.Start) |
| 494 | 503 | ||
| @@ -508,10 +517,28 @@ export struct PaperSingleColumn999CardView { | @@ -508,10 +517,28 @@ export struct PaperSingleColumn999CardView { | ||
| 508 | } | 517 | } |
| 509 | } | 518 | } |
| 510 | .backgroundColor(Color.White) | 519 | .backgroundColor(Color.White) |
| 511 | - .margin({ bottom: 5, left: 12, right: 12 }) | 520 | + .margin({ bottom: 14, left: 12, right: 12 }) |
| 512 | .borderRadius(4) | 521 | .borderRadius(4) |
| 513 | .onClick(() => { | 522 | .onClick(() => { |
| 514 | ProcessUtils.processPage(this.item) | 523 | ProcessUtils.processPage(this.item) |
| 515 | }) | 524 | }) |
| 516 | } | 525 | } |
| 526 | + | ||
| 527 | + aboutToAppear(): void { | ||
| 528 | + this.onChangeCommentList() | ||
| 529 | + } | ||
| 530 | + | ||
| 531 | + onChangeCommentList() { | ||
| 532 | + // 获取评论 | ||
| 533 | + if (this.commentList && this.commentList.length > 0 && this.item && this.item.objectId) { | ||
| 534 | + const objc = this.commentList.find((interactModel: InteractDataDTO) => { | ||
| 535 | + return this.item.objectId == interactModel.contentId | ||
| 536 | + }) | ||
| 537 | + if (objc) { | ||
| 538 | + this.interactData = objc | ||
| 539 | + } | ||
| 540 | + } | ||
| 541 | + } | ||
| 542 | + | ||
| 543 | + | ||
| 517 | } | 544 | } |
| @@ -13,8 +13,20 @@ const LOCAL_CHANNEL: string = '地方频道' | @@ -13,8 +13,20 @@ const LOCAL_CHANNEL: string = '地方频道' | ||
| 13 | 13 | ||
| 14 | const TAG: string = 'ChannelSubscriptionLayout' | 14 | const TAG: string = 'ChannelSubscriptionLayout' |
| 15 | 15 | ||
| 16 | -@CustomDialog | ||
| 17 | -struct ChannelDialog { | 16 | +// @Entry |
| 17 | +@Component | ||
| 18 | +struct ChannelSubscriptionLayout { | ||
| 19 | + @State indexSettingArray: string [] = ['推荐', '热点'] | ||
| 20 | + //当前选中的频道 | ||
| 21 | + @Link currentTopNavSelectedIndex: number; | ||
| 22 | + @Prop homeChannelList: TopNavDTO [] | ||
| 23 | + @Prop indexSettingChannelId: number | ||
| 24 | + @Link myChannelList: TopNavDTO [] | ||
| 25 | + @Link moreChannelList: TopNavDTO [] | ||
| 26 | + @Link localChannelList: TopNavDTO [] | ||
| 27 | + @Link channelIds: number [] | ||
| 28 | + @StorageLink('channelIds') storeChannelIds: string = '' | ||
| 29 | + @State isShow: boolean = false | ||
| 18 | @State dragItem: number = -1 | 30 | @State dragItem: number = -1 |
| 19 | private dragRefOffsetX: number = 0 | 31 | private dragRefOffsetX: number = 0 |
| 20 | private dragRefOffsetY: number = 0 | 32 | private dragRefOffsetY: number = 0 |
| @@ -25,26 +37,40 @@ struct ChannelDialog { | @@ -25,26 +37,40 @@ struct ChannelDialog { | ||
| 25 | @State indexSettingTabIndex: number = 0 | 37 | @State indexSettingTabIndex: number = 0 |
| 26 | @State isEditIng: boolean = false | 38 | @State isEditIng: boolean = false |
| 27 | @State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO | 39 | @State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO |
| 28 | - @Link currentTopNavSelectedIndex: number | ||
| 29 | - @Link myChannelList: TopNavDTO[] | ||
| 30 | - @Link moreChannelList: TopNavDTO[] | ||
| 31 | - @Link localChannelList: TopNavDTO[] | ||
| 32 | - @Link homeChannelList: TopNavDTO[] | ||
| 33 | - @Link indexSettingChannelId: number | ||
| 34 | - controller?: CustomDialogController | ||
| 35 | - confirm: (index: number) => void = () => { | ||
| 36 | - } | ||
| 37 | - changeChannelIndex: (index1: number, index2: number) => void = () => { | ||
| 38 | - } | ||
| 39 | - delChannelItem: (index: number) => void = () => { | ||
| 40 | - } | ||
| 41 | - addChannelItem: (item: TopNavDTO) => void = () => { | 40 | + changeTab: (index: number) => void = () => { |
| 42 | } | 41 | } |
| 43 | 42 | ||
| 44 | aboutToAppear() { | 43 | aboutToAppear() { |
| 45 | this.currentTopNavSelectedItem = this.myChannelList[this.currentTopNavSelectedIndex] | 44 | this.currentTopNavSelectedItem = this.myChannelList[this.currentTopNavSelectedIndex] |
| 46 | } | 45 | } |
| 47 | 46 | ||
| 47 | + //交换我的频道数组中的位置 | ||
| 48 | + changeChannelIndex(index1: number, index2: number) { | ||
| 49 | + let tmp = this.myChannelList.splice(index1, 1) | ||
| 50 | + let channelIdTmp = this.channelIds.splice(index1, 1) | ||
| 51 | + this.myChannelList.splice(index2, 0, tmp[0]) | ||
| 52 | + this.channelIds.splice(index2, 0, channelIdTmp[0]) | ||
| 53 | + this.storeChannelIds = this.channelIds.join(',') | ||
| 54 | + } | ||
| 55 | + //删除频道 | ||
| 56 | + delChannelItem(index: number){ | ||
| 57 | + let item = this.myChannelList.splice(index, 1)[0] | ||
| 58 | + this.channelIds.splice(index, 1) | ||
| 59 | + this.storeChannelIds = this.channelIds.join(',') | ||
| 60 | + if (item.moreChannel === '1') { | ||
| 61 | + this.moreChannelList.unshift(item) | ||
| 62 | + } | ||
| 63 | + if (item.localChannel === '1') { | ||
| 64 | + this.localChannelList.unshift(item) | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + // 添加频道 | ||
| 68 | + addChannelItem(item: TopNavDTO){ | ||
| 69 | + this.channelIds.push(item.channelId) | ||
| 70 | + this.myChannelList.push(item) | ||
| 71 | + this.storeChannelIds = this.channelIds.join(',') | ||
| 72 | + } | ||
| 73 | + | ||
| 48 | itemMove(index: number, newIndex: number): void { | 74 | itemMove(index: number, newIndex: number): void { |
| 49 | let targetItem = this.myChannelList[newIndex] | 75 | let targetItem = this.myChannelList[newIndex] |
| 50 | if (!(targetItem?.headlinesOn === 1 || targetItem?.movePermitted === 0 || targetItem?.homeChannel === '1')) { | 76 | if (!(targetItem?.headlinesOn === 1 || targetItem?.movePermitted === 0 || targetItem?.homeChannel === '1')) { |
| @@ -176,7 +202,8 @@ struct ChannelDialog { | @@ -176,7 +202,8 @@ struct ChannelDialog { | ||
| 176 | } | 202 | } |
| 177 | } | 203 | } |
| 178 | 204 | ||
| 179 | - build() { | 205 | + @Builder |
| 206 | + sheetBuilder() { | ||
| 180 | Column() { | 207 | Column() { |
| 181 | Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { | 208 | Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { |
| 182 | Image($r('app.media.icon_ren_min_ri_bao')) | 209 | Image($r('app.media.icon_ren_min_ri_bao')) |
| @@ -185,7 +212,7 @@ struct ChannelDialog { | @@ -185,7 +212,7 @@ struct ChannelDialog { | ||
| 185 | Image($r('app.media.close_button')) | 212 | Image($r('app.media.close_button')) |
| 186 | .width(24) | 213 | .width(24) |
| 187 | .onClick(() => { | 214 | .onClick(() => { |
| 188 | - this.controller?.close() | 215 | + this.isShow = false |
| 189 | }) | 216 | }) |
| 190 | } | 217 | } |
| 191 | .width('100%') | 218 | .width('100%') |
| @@ -310,8 +337,8 @@ struct ChannelDialog { | @@ -310,8 +337,8 @@ struct ChannelDialog { | ||
| 310 | this.delChannelItem(index) | 337 | this.delChannelItem(index) |
| 311 | } | 338 | } |
| 312 | } else { | 339 | } else { |
| 313 | - this.confirm(index) | ||
| 314 | - this.controller?.close() | 340 | + this.changeTab(index) |
| 341 | + this.isShow = false | ||
| 315 | } | 342 | } |
| 316 | }), | 343 | }), |
| 317 | LongPressGesture({ repeat: true }) | 344 | LongPressGesture({ repeat: true }) |
| @@ -464,73 +491,6 @@ struct ChannelDialog { | @@ -464,73 +491,6 @@ struct ChannelDialog { | ||
| 464 | }) | 491 | }) |
| 465 | .backgroundColor('#ffffff') | 492 | .backgroundColor('#ffffff') |
| 466 | } | 493 | } |
| 467 | -} | ||
| 468 | - | ||
| 469 | -// @Entry | ||
| 470 | -@Component | ||
| 471 | -struct ChannelSubscriptionLayout { | ||
| 472 | - @State indexSettingArray: string [] = ['推荐', '热点'] | ||
| 473 | - //当前选中的频道 | ||
| 474 | - @Link currentTopNavSelectedIndex: number; | ||
| 475 | - @Prop homeChannelList: TopNavDTO [] | ||
| 476 | - @Prop indexSettingChannelId: number | ||
| 477 | - @Link myChannelList: TopNavDTO [] | ||
| 478 | - @Link moreChannelList: TopNavDTO [] | ||
| 479 | - @Link localChannelList: TopNavDTO [] | ||
| 480 | - @Link channelIds: number [] | ||
| 481 | - @StorageLink('channelIds') storeChannelIds: string = '' | ||
| 482 | - changeTab: (index: number) => void = () => { | ||
| 483 | - } | ||
| 484 | - //频道弹窗点击切换频道 | ||
| 485 | - onAccept = (index: number) => { | ||
| 486 | - this.changeTab(index) | ||
| 487 | - } | ||
| 488 | - //交换我的频道数组中的位置 | ||
| 489 | - changeChannelIndex = (index1: number, index2: number) => { | ||
| 490 | - let tmp = this.myChannelList.splice(index1, 1) | ||
| 491 | - let channelIdTmp = this.channelIds.splice(index1, 1) | ||
| 492 | - this.myChannelList.splice(index2, 0, tmp[0]) | ||
| 493 | - this.channelIds.splice(index2, 0, channelIdTmp[0]) | ||
| 494 | - this.storeChannelIds = this.channelIds.join(',') | ||
| 495 | - } | ||
| 496 | - //删除频道 | ||
| 497 | - delChannelItem = (index: number) => { | ||
| 498 | - let item = this.myChannelList.splice(index, 1)[0] | ||
| 499 | - this.channelIds.splice(index, 1) | ||
| 500 | - this.storeChannelIds = this.channelIds.join(',') | ||
| 501 | - if (item.moreChannel === '1') { | ||
| 502 | - this.moreChannelList.unshift(item) | ||
| 503 | - } | ||
| 504 | - if (item.localChannel === '1') { | ||
| 505 | - this.localChannelList.unshift(item) | ||
| 506 | - } | ||
| 507 | - } | ||
| 508 | - // 添加频道 | ||
| 509 | - addChannelItem = (item: TopNavDTO) => { | ||
| 510 | - this.channelIds.push(item.channelId) | ||
| 511 | - this.myChannelList.push(item) | ||
| 512 | - this.storeChannelIds = this.channelIds.join(',') | ||
| 513 | - } | ||
| 514 | - dialogController: CustomDialogController | null = new CustomDialogController({ | ||
| 515 | - builder: ChannelDialog({ | ||
| 516 | - currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | ||
| 517 | - indexSettingChannelId: $indexSettingChannelId, | ||
| 518 | - homeChannelList: $homeChannelList, | ||
| 519 | - myChannelList: $myChannelList, | ||
| 520 | - moreChannelList: $moreChannelList, | ||
| 521 | - localChannelList: $localChannelList, | ||
| 522 | - confirm: this.onAccept, | ||
| 523 | - changeChannelIndex: this.changeChannelIndex, | ||
| 524 | - delChannelItem: this.delChannelItem, | ||
| 525 | - addChannelItem: this.addChannelItem | ||
| 526 | - }), | ||
| 527 | - alignment: DialogAlignment.TopEnd, | ||
| 528 | - customStyle: true, | ||
| 529 | - }) | ||
| 530 | - | ||
| 531 | - aboutToDisappear() { | ||
| 532 | - this.dialogController = null // 将dialogController置空 | ||
| 533 | - } | ||
| 534 | 494 | ||
| 535 | build() { | 495 | build() { |
| 536 | Row() { | 496 | Row() { |
| @@ -542,10 +502,9 @@ struct ChannelSubscriptionLayout { | @@ -542,10 +502,9 @@ struct ChannelSubscriptionLayout { | ||
| 542 | .justifyContent(FlexAlign.Center) | 502 | .justifyContent(FlexAlign.Center) |
| 543 | .backgroundColor(Color.White) | 503 | .backgroundColor(Color.White) |
| 544 | .onClick(() => { | 504 | .onClick(() => { |
| 545 | - if (this.dialogController != null) { | ||
| 546 | - this.dialogController.open() | ||
| 547 | - } | 505 | + this.isShow = true |
| 548 | }) | 506 | }) |
| 507 | + .bindContentCover(this.isShow, this.sheetBuilder()) | ||
| 549 | } | 508 | } |
| 550 | } | 509 | } |
| 551 | 510 |
| @@ -37,9 +37,9 @@ struct EditUserIntroductionPage { | @@ -37,9 +37,9 @@ struct EditUserIntroductionPage { | ||
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | Divider() | 39 | Divider() |
| 40 | - .margin(12) | 40 | + .margin(20) |
| 41 | 41 | ||
| 42 | - Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、出于商业或作为素材恶搞目的,而将国旗、国徽以及国家领导人用于头像、昵称;\n3、最多60个字,只能输入中文、数字、英文字母。') | 42 | + Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多60个字,只能输入中文、数字、英文字母。') |
| 43 | .fontSize(13) | 43 | .fontSize(13) |
| 44 | .padding(12) | 44 | .padding(12) |
| 45 | .fontColor(Color.Gray) | 45 | .fontColor(Color.Gray) |
| @@ -39,9 +39,9 @@ struct EditUserNikeNamePage { | @@ -39,9 +39,9 @@ struct EditUserNikeNamePage { | ||
| 39 | .alignItems(VerticalAlign.Center) | 39 | .alignItems(VerticalAlign.Center) |
| 40 | 40 | ||
| 41 | Divider() | 41 | Divider() |
| 42 | - .margin(12) | 42 | + .margin(20) |
| 43 | 43 | ||
| 44 | - Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、出于商业或作为素材恶搞目的,而将国旗、国徽以及国家领导人用于头像、昵称;\n3、最多16个字,只能输入中文、数字、英文字母。') | 44 | + Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多16个字,只能输入中文、数字、英文字母。') |
| 45 | .fontSize(13) | 45 | .fontSize(13) |
| 46 | .padding(12) | 46 | .padding(12) |
| 47 | .fontColor(Color.Gray) | 47 | .fontColor(Color.Gray) |
| 1 | + | ||
| 2 | +import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel'; | ||
| 3 | +import PageModel from '../../viewmodel/PageModel'; | ||
| 4 | +import { CommonConstants, ViewType } from 'wdConstant' | ||
| 5 | +import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent' | ||
| 6 | +import { ContentDTO } from 'wdBean' | ||
| 7 | +import NoMoreLayout from './NoMoreLayout' | ||
| 8 | +import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; | ||
| 9 | +import { CustomSelectUI } from '../view/CustomSelectUI'; | ||
| 10 | +import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; | ||
| 11 | +import { BigPicCardComponent } from '../view/BigPicCardComponent'; | ||
| 12 | + | ||
| 13 | +import { CustomTitleUI } from '../reusable/CustomTitleUI'; | ||
| 14 | +import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | ||
| 15 | +import { InteractMComponent } from '../InteractMessage/InteractMComponent'; | ||
| 16 | + | ||
| 17 | +@Entry | ||
| 18 | +@Component | ||
| 19 | +struct InteractMessagePage { | ||
| 20 | + @State private browSingModel: PageModel = new PageModel() | ||
| 21 | + isloading : boolean = false | ||
| 22 | + @Provide isEditState:boolean = false | ||
| 23 | + @State allDatas :ContentDTO[] = []; | ||
| 24 | + private scroller: Scroller = new Scroller(); | ||
| 25 | + @State likeNum: number = 20 | ||
| 26 | + | ||
| 27 | + aboutToAppear(){ | ||
| 28 | + this.getData() | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + build() { | ||
| 32 | + Column(){ | ||
| 33 | + CustomTitleUI({titleName:'互动消息'}) | ||
| 34 | + this.ListLayout() | ||
| 35 | + // if(this.browSingModel.viewType == ViewType.ERROR){ | ||
| 36 | + // EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NetworkFailed}) | ||
| 37 | + // }else if(this.browSingModel.viewType == ViewType.EMPTY){ | ||
| 38 | + // EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoHistory}) | ||
| 39 | + // }else { | ||
| 40 | + // CustomPullToRefresh({ | ||
| 41 | + // alldata:this.allDatas, | ||
| 42 | + // scroller:this.scroller, | ||
| 43 | + // customList:()=>{ | ||
| 44 | + // this.ListLayout() | ||
| 45 | + // }, | ||
| 46 | + // onRefresh:(resolve)=>{ | ||
| 47 | + // this.browSingModel.currentPage = 0 | ||
| 48 | + // this.getData(resolve) | ||
| 49 | + // }, | ||
| 50 | + // onLoadMore:(resolve)=> { | ||
| 51 | + // this.browSingModel.currentPage++ | ||
| 52 | + // this.getData() | ||
| 53 | + // } | ||
| 54 | + // }) | ||
| 55 | + // } | ||
| 56 | + | ||
| 57 | + } | ||
| 58 | + .width(CommonConstants.FULL_WIDTH) | ||
| 59 | + .height(CommonConstants.FULL_HEIGHT) | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @Builder ListLayout() { | ||
| 63 | + List({scroller: this.scroller}) { | ||
| 64 | + ListItem(){ | ||
| 65 | + this.likeUILayout() | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + // 下拉刷新 | ||
| 69 | + ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => { | ||
| 70 | + ListItem() { | ||
| 71 | + InteractMComponent() | ||
| 72 | + } | ||
| 73 | + }) | ||
| 74 | + // 加载更多 | ||
| 75 | + ListItem() { | ||
| 76 | + if (this.browSingModel.hasMore) { | ||
| 77 | + } else { | ||
| 78 | + NoMoreLayout() | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | + } | ||
| 82 | + .height(CommonConstants.FULL_PARENT) | ||
| 83 | + .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果 | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + @Builder | ||
| 87 | + likeUILayout(){ | ||
| 88 | + Column(){ | ||
| 89 | + Row(){ | ||
| 90 | + Text('共获') | ||
| 91 | + .fontSize(18) | ||
| 92 | + Text(this.likeNum.toString()) | ||
| 93 | + .fontSize(30) | ||
| 94 | + .fontColor(Color.Red) | ||
| 95 | + Text('赞') | ||
| 96 | + .fontSize(18) | ||
| 97 | + | ||
| 98 | + }.height(75) | ||
| 99 | + | ||
| 100 | + | ||
| 101 | + Divider() | ||
| 102 | + .color('#f5f5f5') | ||
| 103 | + .backgroundColor('#f5f5f5') | ||
| 104 | + .width('100%') | ||
| 105 | + .height(5) | ||
| 106 | + } | ||
| 107 | + .alignItems(HorizontalAlign.Start) | ||
| 108 | + .padding({ left:16,right:16 }) | ||
| 109 | + .width('100%') | ||
| 110 | + .height(80) | ||
| 111 | + | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + async getData(resolve?: (value: string | PromiseLike<string>) => void){ | ||
| 115 | + MyCollectionViewModel.fetchMyCollectList(2,'1',this.browSingModel.currentPage,getContext(this)).then(collectionItem => { | ||
| 116 | + if(resolve) resolve('刷新成功') | ||
| 117 | + if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { | ||
| 118 | + this.browSingModel.viewType = ViewType.LOADED; | ||
| 119 | + this.allDatas.push(...collectionItem.list) | ||
| 120 | + if (collectionItem.list.length === this.browSingModel.pageSize) { | ||
| 121 | + this.browSingModel.currentPage++; | ||
| 122 | + this.browSingModel.hasMore = true; | ||
| 123 | + } else { | ||
| 124 | + this.browSingModel.hasMore = false; | ||
| 125 | + } | ||
| 126 | + } else { | ||
| 127 | + this.browSingModel.viewType = ViewType.EMPTY; | ||
| 128 | + } | ||
| 129 | + }) | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | +} |
| @@ -29,7 +29,7 @@ struct LiveMorePage { | @@ -29,7 +29,7 @@ struct LiveMorePage { | ||
| 29 | pageSize: number = 20; | 29 | pageSize: number = 20; |
| 30 | operDataList: ContentDTO[] = []; | 30 | operDataList: ContentDTO[] = []; |
| 31 | title: string = '直播列表' | 31 | title: string = '直播列表' |
| 32 | - @State contentDTO: ContentDTO = { | 32 | + @State contentDTO: ContentDTO = new ContentDTO(); |
| 33 | // appStyle: '15', | 33 | // appStyle: '15', |
| 34 | // coverType: 1, | 34 | // coverType: 1, |
| 35 | // objectType: '9', | 35 | // objectType: '9', |
| @@ -67,7 +67,7 @@ struct LiveMorePage { | @@ -67,7 +67,7 @@ struct LiveMorePage { | ||
| 67 | // voiceInfo: { | 67 | // voiceInfo: { |
| 68 | // voiceDuration: 12 | 68 | // voiceDuration: 12 |
| 69 | // } | 69 | // } |
| 70 | - } as ContentDTO; | 70 | + // } as ContentDTO; |
| 71 | 71 | ||
| 72 | aboutToAppear(): void { | 72 | aboutToAppear(): void { |
| 73 | PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then((liveReviewDTO) => { | 73 | PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then((liveReviewDTO) => { |
| 1 | -import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; | ||
| 2 | -import { RefreshLayoutBean } from './RefreshLayoutBean'; | 1 | +import CustomLoadMoreLayout from '../refresh/CustomLoadMoreLayout'; |
| 3 | 2 | ||
| 4 | /** | 3 | /** |
| 5 | * The load more layout component. | 4 | * The load more layout component. |
| 6 | */ | 5 | */ |
| 7 | @Component | 6 | @Component |
| 8 | export default struct LoadMoreLayout { | 7 | export default struct LoadMoreLayout { |
| 9 | - @ObjectLink refreshBean: RefreshLayoutBean; | 8 | + @Prop isVisible: boolean; |
| 10 | 9 | ||
| 11 | build() { | 10 | build() { |
| 12 | Column() { | 11 | Column() { |
| 13 | - if (this.refreshBean.isVisible) { | ||
| 14 | - CustomRefreshLoadLayout({ | ||
| 15 | - refreshBean: new RefreshLayoutBean(this.refreshBean.isVisible, | ||
| 16 | - this.refreshBean.imageSrc, this.refreshBean.textValue, this.refreshBean.heightValue) | ||
| 17 | - }) | ||
| 18 | - } else { | ||
| 19 | - CustomRefreshLoadLayout({ | ||
| 20 | - refreshBean: new RefreshLayoutBean(this.refreshBean.isVisible, | ||
| 21 | - this.refreshBean.imageSrc, this.refreshBean.textValue, 0) | ||
| 22 | - }) | 12 | + if (this.isVisible) { |
| 13 | + CustomLoadMoreLayout() | ||
| 23 | } | 14 | } |
| 24 | } | 15 | } |
| 25 | } | 16 | } |
| @@ -28,7 +28,7 @@ export struct PageComponent { | @@ -28,7 +28,7 @@ export struct PageComponent { | ||
| 28 | // 自动刷新通知 | 28 | // 自动刷新通知 |
| 29 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 | 29 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 |
| 30 | private listScroller: Scroller = new Scroller(); | 30 | private listScroller: Scroller = new Scroller(); |
| 31 | - | 31 | + needload: boolean = true; |
| 32 | build() { | 32 | build() { |
| 33 | Column() { | 33 | Column() { |
| 34 | if (this.pageModel.viewType == ViewType.LOADING) { | 34 | if (this.pageModel.viewType == ViewType.LOADING) { |
| @@ -84,10 +84,7 @@ export struct PageComponent { | @@ -84,10 +84,7 @@ export struct PageComponent { | ||
| 84 | // 加载更多 | 84 | // 加载更多 |
| 85 | ListItem() { | 85 | ListItem() { |
| 86 | if (this.pageModel.hasMore) { | 86 | if (this.pageModel.hasMore) { |
| 87 | - // LoadMoreLayout({ | ||
| 88 | - // refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage, | ||
| 89 | - // this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight) | ||
| 90 | - // }) | 87 | + LoadMoreLayout({ isVisible: this.pageModel.isVisiblePullUpLoad }) |
| 91 | } else if (!this.pageModel.contentNeedScroll) { | 88 | } else if (!this.pageModel.contentNeedScroll) { |
| 92 | PageNoMoreLayout({ noMoreBean: new NoMoreBean(this.pageModel.pageInfo.baselineCopywriting) }) | 89 | PageNoMoreLayout({ noMoreBean: new NoMoreBean(this.pageModel.pageInfo.baselineCopywriting) }) |
| 93 | } | 90 | } |
| @@ -96,7 +93,7 @@ export struct PageComponent { | @@ -96,7 +93,7 @@ export struct PageComponent { | ||
| 96 | // comp自己处理分页,这里设置EdgeEffect.None | 93 | // comp自己处理分页,这里设置EdgeEffect.None |
| 97 | .edgeEffect(this.pageModel.contentNeedScroll ? EdgeEffect.None : EdgeEffect.Spring) | 94 | .edgeEffect(this.pageModel.contentNeedScroll ? EdgeEffect.None : EdgeEffect.Spring) |
| 98 | .scrollBar(BarState.Off) | 95 | .scrollBar(BarState.Off) |
| 99 | - .cachedCount(8) | 96 | + .cachedCount(5) |
| 100 | .height(CommonConstants.FULL_PARENT) | 97 | .height(CommonConstants.FULL_PARENT) |
| 101 | .onScrollIndex((start: number, end: number) => { | 98 | .onScrollIndex((start: number, end: number) => { |
| 102 | // Listen to the first index of the current list. | 99 | // Listen to the first index of the current list. |
| @@ -220,13 +217,17 @@ export struct PageComponent { | @@ -220,13 +217,17 @@ export struct PageComponent { | ||
| 220 | // 选中tab,才请求数据。拦截大量接口请求 | 217 | // 选中tab,才请求数据。拦截大量接口请求 |
| 221 | if (this.navIndex === this.currentTopNavSelectedIndex) { | 218 | if (this.navIndex === this.currentTopNavSelectedIndex) { |
| 222 | this.getData(); | 219 | this.getData(); |
| 220 | + this.needload = false; | ||
| 223 | } | 221 | } |
| 224 | } | 222 | } |
| 225 | 223 | ||
| 226 | onChange() { | 224 | onChange() { |
| 227 | Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`); | 225 | Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`); |
| 228 | if (this.navIndex === this.currentTopNavSelectedIndex) { | 226 | if (this.navIndex === this.currentTopNavSelectedIndex) { |
| 229 | - this.getData(); | 227 | + if(this.needload){ |
| 228 | + this.getData(); | ||
| 229 | + } | ||
| 230 | + this.needload = false; | ||
| 230 | } | 231 | } |
| 231 | } | 232 | } |
| 232 | 233 |
-
Please register or login to post a comment