wangliang_wd

feat:解决冲突

Showing 78 changed files with 1722 additions and 1077 deletions

Too many changes to show.

To preserve performance only 78 of 78+ files are displayed.

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